Skip to content

Commit

Permalink
Add Parquet support
Browse files Browse the repository at this point in the history
  • Loading branch information
dvause committed Dec 14, 2023
1 parent 253c6ae commit a1956b7
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@interzoid/data-matching",
"version": "1.2.1",
"version": "1.2.2",
"author": "Interzoid, Inc. <[email protected]> https://interzoid.com",
"description": "Interzoid SDK for Typescript, Generative-AI powered data matching, data quality, and data normalization for organization and individual name data",
"keywords": [
Expand Down
7 changes: 5 additions & 2 deletions src/api/DelimitedFileMatchKeyReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ function isValidCsvMatchKeyReportRequest(obj: any): {
!obj?.source ||
(obj.source !== Source.CSV &&
obj.source !== Source.TSV &&
obj.source !== Source.EXCEL)
obj.source !== Source.EXCEL &&
obj.source !== Source.PARQUET)
) {
isValid = false;
errors.push("Invalid 'source'. It must be 'CSV', 'TSV' or 'Excel.");
errors.push(
"Invalid 'source'. It must be 'CSV', 'TSV', 'Excel, or 'Parquet'.",
);
}

// Validate category
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/DelimitedFileMatchKeyReportRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Process } from './Process';
* @property {'json' | 'html' | 'text'} [responseFormat] - The format of the response. If not specified, defaults to 'text'.
*/
export interface DelimitedFileMatchKeyReportRequest extends InterzoidRequest {
source: Source.CSV | Source.TSV | Source.EXCEL;
source: Source.CSV | Source.TSV | Source.EXCEL | Source.PARQUET;
process: Process.MATCH_REPORT | Process.KEYS_ONLY;
category: Category;
csvUrl: string;
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/Source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ export enum Source {
CSV = 'CSV',
TSV = 'TSV',
EXCEL = 'Excel',
PARQUET = 'Parquet',
}
24 changes: 24 additions & 0 deletions tests/api/DelimitedFileMatchKeyReport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,30 @@ describe('getCsvMatchKeyReport', () => {
expect(result.Status).toEqual('success');
});

it('returns a response when the request is valid', async () => {
const request: DelimitedFileMatchKeyReportRequest = {
category: Category.COMPANY,
source: Source.PARQUET,
process: Process.MATCH_REPORT,
csvUrl: 'https://dl.interzoid.com/parquet/companies.parquet',
matchColumn: 1,
apiKey: 'test-api-key',
responseFormat: 'json',
};
const mockResponse = {
data: { Status: 'success', Message: '', MatchClusters: [] },
status: 200,
statusText: 'OK',
headers: {},
config: {
headers: new AxiosHeaders(),
},
};
mockedAxios.get.mockResolvedValueOnce(mockResponse);
const result = await getDelimitedFileMatchKeyReport(request);
expect(result.Status).toEqual('success');
});

it('throws an error when the request is invalid', async () => {
const request: DelimitedFileMatchKeyReportRequest = {
category: Category.COMPANY,
Expand Down

0 comments on commit a1956b7

Please sign in to comment.