skyflow-js 2.5.0-beta.8 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +142 -1
  2. package/dist/sdkNodeBuild/index.js +1 -1
  3. package/dist/sdkNodeBuild/index.js.gz +0 -0
  4. package/package.json +1 -1
  5. package/types/client/index.d.ts +9 -7
  6. package/types/core/constants.d.ts +2 -26
  7. package/types/core/external/collect/collect-container.d.ts +29 -3
  8. package/types/core/external/collect/collect-element.d.ts +5 -2
  9. package/types/core/external/collect/compose-collect-container.d.ts +8 -3
  10. package/types/core/external/collect/compose-collect-element.d.ts +3 -3
  11. package/types/core/external/common/iframe.d.ts +5 -3
  12. package/types/core/external/common/skyflow-element.d.ts +7 -7
  13. package/types/core/external/reveal/reveal-container.d.ts +3 -2
  14. package/types/core/external/reveal/reveal-element.d.ts +2 -1
  15. package/types/core/external/skyflow-container.d.ts +4 -2
  16. package/types/core/internal/frame-element-init.d.ts +0 -11
  17. package/types/core/internal/iframe-form/index.d.ts +0 -5
  18. package/types/core/internal/index.d.ts +1 -2
  19. package/types/core/internal/internal-types/index.d.ts +72 -0
  20. package/types/core/internal/reveal/reveal-frame.d.ts +1 -6
  21. package/types/core/internal/skyflow-frame/skyflow-frame-controller.d.ts +11 -8
  22. package/types/core-utils/collect.d.ts +10 -7
  23. package/types/core-utils/delete.d.ts +2 -2
  24. package/types/core-utils/reveal.d.ts +4 -31
  25. package/types/index-node.d.ts +1 -1
  26. package/types/libs/element-options.d.ts +4 -2
  27. package/types/libs/jss-styles.d.ts +1 -1
  28. package/types/skyflow.d.ts +11 -6
  29. package/types/utils/bus-events/index.d.ts +1 -1
  30. package/types/utils/common/index.d.ts +22 -21
  31. package/types/utils/constants.d.ts +44 -8
  32. package/types/utils/helpers/index.d.ts +8 -8
  33. package/types/utils/logs.d.ts +14 -5
  34. package/types/utils/validators/index.d.ts +4 -3
  35. package/types/core/external/reveal/composable-reveal-container.d.ts +0 -14
  36. package/types/core/external/reveal/composable-reveal-element.d.ts +0 -12
  37. package/types/core/external/reveal/composable-reveal-internal.d.ts +0 -29
  38. package/types/core/internal/composable-frame-element-init.d.ts +0 -21
@@ -2,21 +2,26 @@ import { ElementType, CardType } from './core/constants';
2
2
  import RevealContainer from './core/external/reveal/reveal-container';
3
3
  import CollectContainer from './core/external/collect/collect-container';
4
4
  import SkyflowError from './libs/skyflow-error';
5
- import { RequestMethod, IInsertRecordInput, IDetokenizeInput, IGetInput, RedactionType, EventName, Env, LogLevel, ValidationRuleType, IGetByIdInput, IInsertOptions, IDeleteRecordInput, IDeleteOptions, IGetOptions, InsertResponse, GetResponse, GetByIdResponse, DeleteResponse, ContainerOptions, DetokenizeResponse } from './utils/common';
5
+ import { RequestMethod, IInsertRecordInput, IDetokenizeInput, IGetInput, RedactionType, EventName, Env, LogLevel, ValidationRuleType, IGetByIdInput, IInsertOptions, IDeleteRecordInput, IDeleteOptions, IGetOptions, InsertResponse, GetResponse, GetByIdResponse, DeleteResponse, ContainerOptions, DetokenizeResponse, IUpdateRequest, UpdateResponse, IUpdateOptions } from './utils/common';
6
6
  import ComposableContainer from './core/external/collect/compose-collect-container';
7
7
  import ThreeDS from './core/external/threeds/threeds';
8
- import ComposableRevealContainer from './core/external/reveal/composable-reveal-container';
9
8
  export declare enum ContainerType {
10
9
  COLLECT = "COLLECT",
11
10
  REVEAL = "REVEAL",
12
- COMPOSABLE = "COMPOSABLE",
13
- COMPOSE_REVEAL = "COMPOSABLE_REVEAL"
11
+ COMPOSABLE = "COMPOSABLE"
12
+ }
13
+ export interface SkyflowConfigOptions {
14
+ logLevel?: LogLevel;
15
+ env?: Env;
16
+ trackingKey?: string;
17
+ trackMetrics?: boolean;
18
+ customElementsURL?: string;
14
19
  }
15
20
  export interface ISkyflow {
16
21
  vaultID?: string;
17
22
  vaultURL?: string;
18
23
  getBearerToken: () => Promise<string>;
19
- options?: Record<string, any>;
24
+ options?: SkyflowConfigOptions;
20
25
  }
21
26
  declare class Skyflow {
22
27
  #private;
@@ -25,12 +30,12 @@ declare class Skyflow {
25
30
  container(type: ContainerType.COLLECT, options?: ContainerOptions): CollectContainer;
26
31
  container(type: ContainerType.COMPOSABLE, options?: ContainerOptions): ComposableContainer;
27
32
  container(type: ContainerType.REVEAL, options?: ContainerOptions): RevealContainer;
28
- container(type: ContainerType.COMPOSE_REVEAL, options?: ContainerOptions): ComposableRevealContainer;
29
33
  insert(records: IInsertRecordInput, options?: IInsertOptions): Promise<InsertResponse>;
30
34
  detokenize(detokenizeInput: IDetokenizeInput): Promise<DetokenizeResponse>;
31
35
  getById(getByIdInput: IGetByIdInput): Promise<GetByIdResponse>;
32
36
  get(getInput: IGetInput, options?: IGetOptions): Promise<GetResponse>;
33
37
  delete(records: IDeleteRecordInput, options?: IDeleteOptions): Promise<DeleteResponse>;
38
+ update(record: IUpdateRequest, options?: IUpdateOptions): Promise<UpdateResponse>;
34
39
  static get ContainerType(): typeof ContainerType;
35
40
  static get ElementType(): typeof ElementType;
36
41
  static get RedactionType(): typeof RedactionType;
@@ -1,2 +1,2 @@
1
- export declare function getAccessToken(clientId: any): Promise<unknown>;
1
+ export declare function getAccessToken(clientId: string): Promise<unknown>;
2
2
  export declare function updateElementState(frameName: string, value: any): void;
@@ -53,20 +53,20 @@ export interface IInsertRecord {
53
53
  fields: Record<string, any>;
54
54
  skyflowID?: string;
55
55
  }
56
- export interface IRevealRecord {
57
- token?: string;
58
- redaction?: RedactionType;
59
- column?: string;
60
- skyflowID?: string;
61
- table?: string;
56
+ export interface IUpdateRequest {
57
+ table: string;
58
+ fields: Record<string, unknown>;
59
+ skyflowID: string;
62
60
  }
63
- export interface IRevealRecordComposable {
61
+ export interface IUpdateOptions {
62
+ tokens?: boolean;
63
+ }
64
+ export interface IRevealRecord {
64
65
  token?: string;
65
66
  redaction?: RedactionType;
66
67
  column?: string;
67
68
  skyflowID?: string;
68
69
  table?: string;
69
- iframeName?: string;
70
70
  }
71
71
  export interface IInsertResponse {
72
72
  records: IInsertResponseReocrds[];
@@ -166,6 +166,13 @@ export interface InsertResponse {
166
166
  records?: InsertResponseRecords[];
167
167
  errors?: ErrorRecord[];
168
168
  }
169
+ export interface UpdateResponseType {
170
+ skyflowID: string;
171
+ [key: string]: unknown;
172
+ }
173
+ export interface UpdateResponse {
174
+ updatedField: UpdateResponseType;
175
+ }
169
176
  export interface CollectResponse extends InsertResponse {
170
177
  }
171
178
  export interface DetokenizeRecord extends IRevealRecord {
@@ -175,6 +182,7 @@ export interface DetokenizeResponse extends IRevealResponseType {
175
182
  export interface InsertResponseRecords {
176
183
  fields: Record<string, any>;
177
184
  table: string;
185
+ skyflow_id?: string;
178
186
  }
179
187
  export interface ErrorRecord {
180
188
  code: number;
@@ -268,26 +276,19 @@ export interface ICollectOptions {
268
276
  additionalFields?: IInsertRecordInput;
269
277
  upsert?: Array<IUpsertOptions>;
270
278
  }
271
- export interface MetaData {
272
- [key: string]: any;
273
- }
274
279
  export interface UploadFilesResponse {
275
- fileUploadResponse: [{
276
- skyflow_id: string;
277
- }];
278
- errorResponse: [{
279
- error: ErrorRecord;
280
- }];
280
+ fileUploadResponse?: Record<string, any>;
281
+ errorResponse?: Record<string, any>;
281
282
  }
282
283
  export interface RevealResponse {
283
- success?: {
284
+ success?: Array<{
284
285
  token: string;
285
286
  valueType: string;
286
- };
287
- errors?: {
287
+ }>;
288
+ errors?: Array<{
288
289
  error: ErrorRecord;
289
290
  token: string;
290
- };
291
+ }>;
291
292
  }
292
293
  export interface RenderFileResponse {
293
294
  success?: {
@@ -1,12 +1,4 @@
1
1
  declare const SKYFLOW_ERROR_CODE: {
2
- MULTI_FILE_NOT_SUPPORTED: {
3
- code: number;
4
- description: string;
5
- };
6
- INVALID_REVEAL_COMPOSABLE_INPUT: {
7
- code: number;
8
- description: string;
9
- };
10
2
  INVALID_FILE_NAME: {
11
3
  code: number;
12
4
  description: string;
@@ -267,6 +259,50 @@ declare const SKYFLOW_ERROR_CODE: {
267
259
  code: number;
268
260
  description: string;
269
261
  };
262
+ INVALID_RECORD_KEY_UPDATE: {
263
+ code: number;
264
+ description: string;
265
+ };
266
+ MISSING_TABLE_IN_UPDATE: {
267
+ code: number;
268
+ description: string;
269
+ };
270
+ EMPTY_TABLE_IN_UPDATE: {
271
+ code: number;
272
+ description: string;
273
+ };
274
+ INVALID_TABLE_IN_UPDATE: {
275
+ code: number;
276
+ description: string;
277
+ };
278
+ MISSING_FIELDS_IN_UPDATE: {
279
+ code: number;
280
+ description: string;
281
+ };
282
+ EMPTY_FIELDS_IN_UPDATE: {
283
+ code: number;
284
+ description: string;
285
+ };
286
+ INVALID_FIELDS_IN_UPDATE: {
287
+ code: number;
288
+ description: string;
289
+ };
290
+ MISSING_SKYFLOWID_IN_UPDATE: {
291
+ code: number;
292
+ description: string;
293
+ };
294
+ EMPTY_SKYFLOWID_IN_UPDATE: {
295
+ code: number;
296
+ description: string;
297
+ };
298
+ INVALID_SKYFLOWID_IN_UPDATE: {
299
+ code: number;
300
+ description: string;
301
+ };
302
+ INVALID_TOKENS_IN_UPDATE: {
303
+ code: number;
304
+ description: string;
305
+ };
270
306
  EMPTY_RECORDS_IN_DELETE: {
271
307
  code: number;
272
308
  description: string;
@@ -4,19 +4,19 @@ import { ContainerType, ISkyflow } from '../../skyflow';
4
4
  export declare const flattenObject: (obj: any, roots?: any, sep?: string) => any;
5
5
  export declare function formatFrameNameToId(name: string): string;
6
6
  export declare function removeSpaces(inputString: string): string;
7
- export declare function formatVaultURL(vaultURL: any): any;
7
+ export declare function formatVaultURL(vaultURL?: string): string | undefined;
8
8
  export declare function checkIfDuplicateExists(arr: any): boolean;
9
- export declare const appendZeroToOne: (value: any) => {
9
+ export declare const appendZeroToOne: (value: string) => {
10
10
  isAppended: boolean;
11
- value: any;
11
+ value: string;
12
12
  };
13
- export declare const appendMonthFourDigitYears: (value: any) => {
13
+ export declare const appendMonthFourDigitYears: (value: string) => {
14
14
  isAppended: boolean;
15
- value: any;
15
+ value: string;
16
16
  };
17
- export declare const appendMonthTwoDigitYears: (value: any) => {
17
+ export declare const appendMonthTwoDigitYears: (value: string) => {
18
18
  isAppended: boolean;
19
- value: any;
19
+ value: string;
20
20
  };
21
21
  export declare const getReturnValue: (value: string | Blob, element: string, doesReturnValue: boolean) => string | Blob | undefined;
22
22
  export declare function domReady(fn: any): void;
@@ -27,7 +27,7 @@ export declare const getMaskedOutput: (input: string, format: string, translatio
27
27
  export declare const copyToClipboard: (text: string) => void;
28
28
  export declare const handleCopyIconClick: (textToCopy: string, domCopy: any) => void;
29
29
  export declare const fileValidation: (value: any, required: Boolean | undefined, fileElement: any) => boolean;
30
- export declare const vaildateFileName: (name: any) => boolean;
30
+ export declare const vaildateFileName: (name: string) => boolean;
31
31
  export declare const styleToString: (style: any) => string;
32
32
  export declare const getContainerType: (frameName: string) => ContainerType;
33
33
  export declare const addSeperatorToCardNumberMask: (cardNumberMask: any, seperator?: string) => any;
@@ -4,7 +4,6 @@ declare const logs: {
4
4
  CLIENT_INITIALIZED: string;
5
5
  CREATE_COLLECT_CONTAINER: string;
6
6
  COLLECT_CONTAINER_CREATED: string;
7
- INITIALIZE_COMPOSABLE_CLIENT: string;
8
7
  CREATE_REVEAL_CONTAINER: string;
9
8
  REVEAL_CONTAINER_CREATED: string;
10
9
  VALIDATE_RECORDS: string;
@@ -19,8 +18,6 @@ declare const logs: {
19
18
  ELEMENT_REVEALED: string;
20
19
  FILE_RENDERED: string;
21
20
  COLLECT_SUBMIT_SUCCESS: string;
22
- UPLOAD_FILES_SUCCESS: string;
23
- MULTI_UPLOAD_FILES_SUCCESS: string;
24
21
  REVEAL_SUBMIT_SUCCESS: string;
25
22
  RENDER_SUBMIT_SUCCESS: string;
26
23
  INSERT_DATA_SUCCESS: string;
@@ -35,6 +32,7 @@ declare const logs: {
35
32
  PUREJS_LISTENER_READY: string;
36
33
  EMIT_PURE_JS_CONTROLLER: string;
37
34
  INSERT_TRIGGERED: string;
35
+ UPDATE_TRIGGERED: string;
38
36
  DETOKENIZE_TRIGGERED: string;
39
37
  GET_TRIGGERED: string;
40
38
  GET_BY_ID_TRIGGERED: string;
@@ -45,6 +43,7 @@ declare const logs: {
45
43
  CAPTURE_PUREJS_FRAME: string;
46
44
  FETCH_RECORDS_RESOLVED: string;
47
45
  INSERT_RECORDS_RESOLVED: string;
46
+ UPDATE_RECORD_RESOLVED: string;
48
47
  GET_RESOLVED: string;
49
48
  GET_BY_SKYFLOWID_RESOLVED: string;
50
49
  DELETE_RESOLVED: string;
@@ -77,8 +76,6 @@ declare const logs: {
77
76
  VALIDATE_GET_BY_ID_INPUT: string;
78
77
  };
79
78
  errorLogs: {
80
- MULTI_FILE_NOT_SUPPORTED: string;
81
- INVALID_REVEAL_COMPOSABLE_INPUT: string;
82
79
  NO_ELEMENTS_IN_COLLECT: string;
83
80
  NO_ELEMENTS_IN_COMPOSABLE: string;
84
81
  NO_ELEMENTS_IN_REVEAL: string;
@@ -110,6 +107,17 @@ declare const logs: {
110
107
  INVALID_FIELDS_IN_INSERT: string;
111
108
  INVALID_TOKENS_IN_INSERT: string;
112
109
  RECORDS_KEY_NOT_FOUND_DELETE: string;
110
+ INVALID_RECORD_KEY_UPDATE: string;
111
+ MISSING_TABLE_IN_UPDATE: string;
112
+ EMPTY_TABLE_IN_UPDATE: string;
113
+ INVALID_TABLE_IN_UPDATE: string;
114
+ MISSING_FIELDS_IN_UPDATE: string;
115
+ EMPTY_FIELDS_IN_UPDATE: string;
116
+ INVALID_FIELDS_IN_UPDATE: string;
117
+ MISSING_SKYFLOWID_IN_UPDATE: string;
118
+ EMPTY_SKYFLOWID_IN_UPDATE: string;
119
+ INVALID_SKYFLOWID_IN_UPDATE: string;
120
+ INVALID_TOKENS_IN_UPDATE: string;
113
121
  INVALID_RECORDS_IN_DELETE: string;
114
122
  EMPTY_RECORDS_IN_DELETE: string;
115
123
  MISSING_TABLE_IN_DELETE: string;
@@ -178,6 +186,7 @@ declare const logs: {
178
186
  EMPTY_TOKEN_ID_REVEAL: string;
179
187
  FETCH_RECORDS_REJECTED: string;
180
188
  INSERT_RECORDS_REJECTED: string;
189
+ UPDATE_RECORD_REJECTED: string;
181
190
  GET_REJECTED: string;
182
191
  FAILED_REVEAL: string;
183
192
  FAILED_RENDER: string;
@@ -1,7 +1,7 @@
1
1
  import { CardType } from '../../core/constants';
2
2
  import { IRevealElementInput } from '../../core/external/reveal/reveal-container';
3
3
  import { ISkyflow } from '../../skyflow';
4
- import { IInsertRecordInput, IDetokenizeInput, IGetInput, IGetByIdInput, IDeleteRecordInput, IGetOptions, CollectElementInput } from '../common';
4
+ import { IInsertRecordInput, IDetokenizeInput, IGetInput, IGetByIdInput, IDeleteRecordInput, IGetOptions, CollectElementInput, LogLevel, ContainerOptions, IUpdateRequest, IUpdateOptions } from '../common';
5
5
  export declare const validateCreditCardNumber: (cardNumber: string) => boolean;
6
6
  export declare const detectCardType: (cardNumber?: string) => CardType.DEFAULT;
7
7
  export declare const validateExpiryDate: (date: string, format: string) => boolean;
@@ -10,6 +10,7 @@ export declare const validateExpiryMonth: (month: string) => boolean;
10
10
  export declare const isValidExpiryDateFormat: (format: string) => boolean;
11
11
  export declare const isValidExpiryYearFormat: (format: string) => boolean;
12
12
  export declare const validateInsertRecords: (recordObj: IInsertRecordInput, options: any) => void;
13
+ export declare const validateUpdateRecord: (recordObj: IUpdateRequest, options?: IUpdateOptions) => void;
13
14
  export declare const validateAdditionalFieldsInCollect: (recordObj: IInsertRecordInput) => void;
14
15
  export declare const validateDetokenizeInput: (detokenizeInput: IDetokenizeInput) => void;
15
16
  export declare const validateGetInput: (getInput: IGetInput, options?: IGetOptions) => void;
@@ -21,8 +22,8 @@ export declare const isValidURL: (url: string) => boolean;
21
22
  export declare const isValidRegExp: (input: any) => boolean;
22
23
  export declare const validateCardNumberLengthCheck: (cardNumber?: string) => boolean;
23
24
  export declare const validateInitConfig: (initConfig: ISkyflow) => void;
24
- export declare const validateCollectElementInput: (input: CollectElementInput, logLevel: any) => void;
25
+ export declare const validateCollectElementInput: (input: CollectElementInput, logLevel: LogLevel) => void;
25
26
  export declare const validateUpsertOptions: (upsertOptions: any) => void;
26
- export declare const validateComposableContainerOptions: (options: any) => void;
27
+ export declare const validateComposableContainerOptions: (options: ContainerOptions) => void;
27
28
  export declare const validateBooleanOptions: (option: any) => boolean;
28
29
  export declare const validateInputFormatOptions: (options: any) => void;
@@ -1,14 +0,0 @@
1
- import Container from '../common/container';
2
- import ComposableRevealElement from './composable-reveal-element';
3
- import { RevealElementInput, RevealResponse } from '../../../index-node';
4
- import { IRevealElementOptions } from './reveal-container';
5
- declare class ComposableRevealContainer extends Container {
6
- #private;
7
- type: string;
8
- constructor(options: any, metaData: any, skyflowElements: any, context: any);
9
- create: (input: RevealElementInput, options?: IRevealElementOptions) => ComposableRevealElement;
10
- mount: (domElement: HTMLElement | string) => void;
11
- unmount: () => void;
12
- reveal(): Promise<RevealResponse>;
13
- }
14
- export default ComposableRevealContainer;
@@ -1,12 +0,0 @@
1
- import { RenderFileResponse } from '../../../utils/common';
2
- import { IRevealElementInput, IRevealElementOptions } from './reveal-container';
3
- declare class ComposableRevealElement {
4
- #private;
5
- type: string;
6
- constructor(name: any, eventEmitter: any, iframeName: any);
7
- iframeName(): string;
8
- getID(): string;
9
- renderFile(): Promise<RenderFileResponse>;
10
- update: (options: IRevealElementInput | IRevealElementOptions) => void;
11
- }
12
- export default ComposableRevealElement;
@@ -1,29 +0,0 @@
1
- import { Context, RenderFileResponse } from '../../../utils/common';
2
- import SkyflowElement from '../common/skyflow-element';
3
- import { IRevealElementInput, IRevealElementOptions } from './reveal-container';
4
- export interface RevealComposableGroup {
5
- record: IRevealElementInput;
6
- options: IRevealElementOptions;
7
- }
8
- declare class ComposableRevealInternalElement extends SkyflowElement {
9
- #private;
10
- constructor(elementId: string, recordGroup: RevealComposableGroup[], metaData: any, container: any, isSingleElementAPI: boolean | undefined, context: Context);
11
- private setupRenderFileEventListener;
12
- getID(): string;
13
- mount(domElementSelector: HTMLElement | string): void;
14
- renderFile(recordData: any): Promise<RenderFileResponse>;
15
- iframeName(): string;
16
- isMounted(): boolean;
17
- hasToken(): boolean;
18
- isClientSetError(): boolean;
19
- getRecordData(): any;
20
- setErrorOverride(clientErrorText: string): void;
21
- setError(clientErrorText: string): void;
22
- resetError(): void;
23
- setAltText(altText: string): void;
24
- clearAltText(): void;
25
- setToken(token: string): void;
26
- unmount(): void;
27
- update(options: IRevealElementInput | IRevealElementOptions, record: any): void;
28
- }
29
- export default ComposableRevealInternalElement;
@@ -1,21 +0,0 @@
1
- import { IRevealRecordComposable } from '../../utils/common';
2
- import IFrameFormElement from './iframe-form';
3
- import FrameElement from '.';
4
- export default class RevealComposableFrameElementInit {
5
- #private;
6
- iframeFormElement: IFrameFormElement | undefined;
7
- clientMetaData: any;
8
- frameElement: FrameElement;
9
- private static frameEle?;
10
- containerId: string;
11
- group: any;
12
- frameList: FrameElement[];
13
- iframeFormList: IFrameFormElement[];
14
- revealFrameList: any[];
15
- rootDiv: HTMLDivElement;
16
- constructor();
17
- updateGroupData: () => void;
18
- static startFrameElement: () => void;
19
- revealData(revealRecords: IRevealRecordComposable[], containerId: any, authToken: any): Promise<unknown>;
20
- createContainerDiv: (newGroup: any) => void;
21
- }