From a1956b7185f1d4f06220b2ea60454af22cacc986 Mon Sep 17 00:00:00 2001 From: Dave Vause Date: Wed, 13 Dec 2023 21:44:17 -0500 Subject: [PATCH] Add Parquet support --- package.json | 2 +- src/api/DelimitedFileMatchKeyReport.ts | 7 ++++-- .../DelimitedFileMatchKeyReportRequest.ts | 2 +- src/interfaces/Source.ts | 1 + tests/api/DelimitedFileMatchKeyReport.test.ts | 24 +++++++++++++++++++ 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b603506..95225ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@interzoid/data-matching", - "version": "1.2.1", + "version": "1.2.2", "author": "Interzoid, Inc. 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": [ diff --git a/src/api/DelimitedFileMatchKeyReport.ts b/src/api/DelimitedFileMatchKeyReport.ts index 621211e..d25165b 100644 --- a/src/api/DelimitedFileMatchKeyReport.ts +++ b/src/api/DelimitedFileMatchKeyReport.ts @@ -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 diff --git a/src/interfaces/DelimitedFileMatchKeyReportRequest.ts b/src/interfaces/DelimitedFileMatchKeyReportRequest.ts index 8955ded..0ccc622 100644 --- a/src/interfaces/DelimitedFileMatchKeyReportRequest.ts +++ b/src/interfaces/DelimitedFileMatchKeyReportRequest.ts @@ -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; diff --git a/src/interfaces/Source.ts b/src/interfaces/Source.ts index 5b8665e..90eec5d 100644 --- a/src/interfaces/Source.ts +++ b/src/interfaces/Source.ts @@ -42,4 +42,5 @@ export enum Source { CSV = 'CSV', TSV = 'TSV', EXCEL = 'Excel', + PARQUET = 'Parquet', } diff --git a/tests/api/DelimitedFileMatchKeyReport.test.ts b/tests/api/DelimitedFileMatchKeyReport.test.ts index a0eaa9f..32cdaa6 100644 --- a/tests/api/DelimitedFileMatchKeyReport.test.ts +++ b/tests/api/DelimitedFileMatchKeyReport.test.ts @@ -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,