Skip to content

Commit

Permalink
SK-1621: fix inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
“amith-skyflow” committed Oct 24, 2024
1 parent 41822bc commit d5a2961
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
23 changes: 21 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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,
Expand All @@ -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
};
4 changes: 2 additions & 2 deletions src/vault/controller/vault/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [] }));
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/vault/model/response/file-upload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions test/vault/controller/vault.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
Expand Down Expand Up @@ -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);
});
Expand Down Expand Up @@ -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);
});

Expand Down

0 comments on commit d5a2961

Please sign in to comment.