diff --git a/src/index.ts b/src/index.ts index e754ab8..f0a2805 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import Skyflow from './vault/skyflow'; -import { LogLevel, Env, RedactionType } from './utils'; +import { LogLevel, Env, RedactionType, METHOD } from './utils'; import InsertRequest from './vault/model/request/insert'; import InsertOptions from './vault/model/options/insert'; import GetRequest from './vault/model/request/get'; @@ -17,10 +17,20 @@ import { generateBearerToken, generateBearerTokenFromCreds, generateSignedDataTo import { isExpired } from './utils/jwt-utils'; import UpdateOptions from './vault/model/options/update'; import InvokeConnectionRequest from './vault/model/request/inkove'; +import GetColumnRequest from './vault/model/request/get-column'; +import InsertResponse from './vault/model/response/insert'; +import GetResponse from './vault/model/response/get'; +import DetokenizeResponse from './vault/model/response/detokenize'; +import DeleteResponse from './vault/model/response/delete'; +import UpdateResponse from './vault/model/response/update'; +import FileUploadResponse from './vault/model/response/file-upload'; +import QueryResponse from './vault/model/response/query'; +import InvokeConnectionResponse from './vault/model/response/invoke/invoke'; export { Env, LogLevel, + METHOD, Skyflow, generateBearerToken, generateBearerTokenFromCreds, @@ -31,16 +41,25 @@ export { RedactionType, InsertRequest, InsertOptions, + InsertResponse, GetRequest, + GetColumnRequest, GetOptions, + GetResponse, DetokenizeRequest, DetokenizeOptions, + DetokenizeResponse, DeleteRequest, + DeleteResponse, UpdateRequest, UpdateOptions, + UpdateResponse, FileUploadRequest, + FileUploadResponse, QueryRequest, + QueryResponse, TokenizeRequest, TokenizeResponse, - InvokeConnectionRequest + InvokeConnectionRequest, + InvokeConnectionResponse }; \ No newline at end of file diff --git a/src/vault/controller/vault/index.ts b/src/vault/controller/vault/index.ts index c2ab9fc..8e8705a 100644 --- a/src/vault/controller/vault/index.ts +++ b/src/vault/controller/vault/index.ts @@ -266,7 +266,7 @@ class VaultController { TYPES.UPDATE ).then(data => { const updatedRecord = { - skyflowID: data.skyflow_id, + skyflowId: data.skyflow_id, ...data?.tokens }; resolve(new UpdateResponse({ updatedField: updatedRecord, errors: [] })); @@ -403,7 +403,7 @@ class VaultController { ), TYPES.FILE_UPLOAD ).then(data => { - resolve(new FileUploadResponse({ skyflowID: data.skyflow_id, errors: [] })); + resolve(new FileUploadResponse({ skyflowId: data.skyflow_id, errors: [] })); }) .catch(error => { if (error instanceof Error) diff --git a/src/vault/model/response/file-upload/index.ts b/src/vault/model/response/file-upload/index.ts index 5ebeb66..ba0bfd0 100644 --- a/src/vault/model/response/file-upload/index.ts +++ b/src/vault/model/response/file-upload/index.ts @@ -3,12 +3,12 @@ class FileUploadResponse { //fields - skyflowID?: string; + skyflowId?: string; errors?: Object; - constructor({ skyflowID, errors }: { skyflowID?: string, errors?: object }) { - this.skyflowID = skyflowID; + constructor({ skyflowId, errors }: { skyflowId?: string, errors?: object }) { + this.skyflowId = skyflowId; this.errors = errors; } diff --git a/test/vault/controller/vault.test.js b/test/vault/controller/vault.test.js index cd09e6c..495b775 100644 --- a/test/vault/controller/vault.test.js +++ b/test/vault/controller/vault.test.js @@ -943,7 +943,7 @@ describe('VaultController update method', () => { expect.any(Object) // Headers ); expect(response).toBeInstanceOf(UpdateResponse); - expect(response.updatedField.skyflowID).toBe('id123'); + expect(response.updatedField.skyflowId).toBe('id123'); expect(response.updatedField.field1).toBe('token123'); expect(response.errors).toHaveLength(0); }); @@ -969,7 +969,7 @@ describe('VaultController update method', () => { expect.any(Object) // Headers ); expect(response).toBeInstanceOf(UpdateResponse); - expect(response.updatedField.skyflowID).toBe('id123'); + expect(response.updatedField.skyflowId).toBe('id123'); expect(response.updatedField.field1).toBe('token123'); expect(response.errors).toHaveLength(0); }); @@ -997,7 +997,7 @@ describe('VaultController update method', () => { expect.any(Object) // Headers ); expect(response).toBeInstanceOf(UpdateResponse); - expect(response.updatedField.skyflowID).toBe('id123'); + expect(response.updatedField.skyflowId).toBe('id123'); expect(response.updatedField.field1).toBe('token123'); expect(response.errors).toHaveLength(0); }); @@ -1127,7 +1127,7 @@ describe('VaultController uploadFile method', () => { expect(mockFs.createReadStream).toHaveBeenCalledWith(mockRequest.filePath); expect(response).toBeInstanceOf(FileUploadResponse); - expect(response.skyflowID).toBe('id123'); + expect(response.skyflowId).toBe('id123'); expect(response.errors).toHaveLength(0); });