santoid-sdk 5.2.0 → 5.4.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 (66) hide show
  1. package/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan/sonarcloud-scan.log +263 -295
  2. package/CHANGELOG.md +7 -0
  3. package/README.md +455 -143
  4. package/api/ApiAsyncService.d.ts +32 -0
  5. package/api/ApiAsyncService.js +15 -0
  6. package/api/ApiFaceMatchService.d.ts +30 -0
  7. package/api/ApiFaceMatchService.js +32 -0
  8. package/api/ApiOcrService.d.ts +62 -0
  9. package/api/ApiOcrService.js +25 -0
  10. package/api/ApiTypificationService.d.ts +23 -0
  11. package/api/{TypificationService.js → ApiTypificationService.js} +8 -9
  12. package/browser/index.js +1 -1
  13. package/client/core/commons/BaseCoreService.d.ts +23 -0
  14. package/client/core/commons/BaseCoreService.js +156 -0
  15. package/client/core/index.d.ts +4 -0
  16. package/client/core/index.js +9 -0
  17. package/client/core/methods/faceMatch/Service.d.ts +19 -0
  18. package/client/core/methods/faceMatch/Service.js +122 -0
  19. package/client/core/methods/faceMatch/index.d.ts +15 -0
  20. package/client/core/methods/faceMatch/index.js +43 -0
  21. package/client/core/methods/ocr/Service.d.ts +11 -0
  22. package/client/core/methods/ocr/Service.js +52 -0
  23. package/client/core/methods/ocr/index.d.ts +10 -0
  24. package/client/core/methods/ocr/index.js +40 -0
  25. package/client/core/methods/typification/Service.d.ts +9 -0
  26. package/client/core/methods/typification/Service.js +52 -0
  27. package/client/core/methods/typification/index.d.ts +10 -0
  28. package/client/core/methods/typification/index.js +40 -0
  29. package/client/core/utils/types.d.ts +30 -0
  30. package/client/core/utils/types.js +2 -0
  31. package/client/index.d.ts +6 -0
  32. package/client/index.js +6 -0
  33. package/client/liveness/methods/livenessDetection/Service.js +10 -2
  34. package/client/liveness/methods/livenessDetection/index.js +5 -1
  35. package/client/liveness/methods/uploadIdentificationDocument/Service.d.ts +19 -19
  36. package/client/liveness/methods/uploadIdentificationDocument/Service.js +8 -4
  37. package/client/liveness/methods/uploadIdentificationDocument/index.d.ts +4 -6
  38. package/client/liveness/utils/getNextFrame.d.ts +4 -1
  39. package/client/liveness/utils/getNextFrame.js +9 -3
  40. package/package.json +1 -1
  41. package/server/core/index.d.ts +4 -0
  42. package/server/core/index.js +9 -0
  43. package/server/core/methods/faceMatch/Service.d.ts +9 -0
  44. package/server/core/methods/faceMatch/Service.js +23 -0
  45. package/server/core/methods/faceMatch/index.d.ts +7 -0
  46. package/server/core/methods/faceMatch/index.js +28 -0
  47. package/server/core/methods/ocr/Service.d.ts +9 -0
  48. package/server/core/methods/ocr/Service.js +23 -0
  49. package/server/core/methods/ocr/index.d.ts +7 -0
  50. package/server/core/methods/ocr/index.js +28 -0
  51. package/server/core/methods/typification/Service.d.ts +9 -0
  52. package/server/core/methods/typification/Service.js +23 -0
  53. package/server/core/methods/typification/index.d.ts +7 -0
  54. package/server/core/methods/typification/index.js +28 -0
  55. package/server/index.d.ts +6 -0
  56. package/server/index.js +6 -0
  57. package/server/liveness/methods/livenessDetection/index.js +5 -1
  58. package/server/liveness/methods/uploadIdentificationDocument/Service.d.ts +2 -2
  59. package/server/liveness/methods/uploadIdentificationDocument/Service.js +4 -4
  60. package/server/liveness/methods/uploadIdentificationDocument/index.d.ts +6 -8
  61. package/utils/error.d.ts +19 -2
  62. package/utils/error.js +21 -2
  63. package/utils/types.d.ts +1 -0
  64. package/api/FaceMatchService.d.ts +0 -42
  65. package/api/FaceMatchService.js +0 -26
  66. package/api/TypificationService.d.ts +0 -90
package/utils/error.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SDKError = exports.EUploadIdentificationDocumentErrorCodes = exports.ELivenessDetectionErrorCodes = exports.EDefaultErrorCodes = void 0;
3
+ exports.SDKError = exports.EProcessingErrorCodes = exports.ECameraErrorCodes = exports.EFaceMatchErrorCodes = exports.EUploadIdentificationDocumentErrorCodes = exports.ELivenessDetectionErrorCodes = exports.EDefaultErrorCodes = void 0;
4
4
  var EDefaultErrorCodes;
5
5
  (function (EDefaultErrorCodes) {
6
6
  EDefaultErrorCodes["INITIALIZATION_ERROR"] = "initialization-error";
@@ -17,10 +17,29 @@ var EUploadIdentificationDocumentErrorCodes;
17
17
  EUploadIdentificationDocumentErrorCodes["DOCUMENT_ANALYSIS_ERROR"] = "upload-identification-document/document-analysis-error";
18
18
  EUploadIdentificationDocumentErrorCodes["LIVENESS_DETECTION_ERROR"] = "upload-identification-document/liveness-detection-error";
19
19
  })(EUploadIdentificationDocumentErrorCodes || (exports.EUploadIdentificationDocumentErrorCodes = EUploadIdentificationDocumentErrorCodes = {}));
20
+ var EFaceMatchErrorCodes;
21
+ (function (EFaceMatchErrorCodes) {
22
+ EFaceMatchErrorCodes["FIRST_IMAGE_NOT_SELECTED"] = "face-match/first-image-not-selected";
23
+ })(EFaceMatchErrorCodes || (exports.EFaceMatchErrorCodes = EFaceMatchErrorCodes = {}));
24
+ var ECameraErrorCodes;
25
+ (function (ECameraErrorCodes) {
26
+ ECameraErrorCodes["INITIALIZATION_ERROR"] = "camera/initialization-error";
27
+ ECameraErrorCodes["IS_RUNNING"] = "camera/is-running";
28
+ ECameraErrorCodes["ALREADY_STARTED"] = "camera/already-started";
29
+ ECameraErrorCodes["NOT_INITIALIZED"] = "camera/not-initialized";
30
+ ECameraErrorCodes["CANNOT_CAPTURE_IMAGE"] = "camera/cannot-capture-image";
31
+ ECameraErrorCodes["SHUTDOWN_ERROR"] = "camera/shutdown-error";
32
+ })(ECameraErrorCodes || (exports.ECameraErrorCodes = ECameraErrorCodes = {}));
33
+ var EProcessingErrorCodes;
34
+ (function (EProcessingErrorCodes) {
35
+ EProcessingErrorCodes["PROCESSING_ERROR"] = "processing/processing-error";
36
+ EProcessingErrorCodes["ALREADY_STARTED"] = "processing/already-started";
37
+ })(EProcessingErrorCodes || (exports.EProcessingErrorCodes = EProcessingErrorCodes = {}));
20
38
  class SDKError extends Error {
21
- constructor({ message, code, details }) {
39
+ constructor({ message, code, fatal, details }) {
22
40
  super(message);
23
41
  this.code = code;
42
+ this.fatal = fatal;
24
43
  this.details = details;
25
44
  }
26
45
  }
package/utils/types.d.ts CHANGED
@@ -21,6 +21,7 @@ export type TWebSocketClass<TFrameType> = new (url: string) => IBaseWebSocket<TF
21
21
  export interface IBaseSDKOptions {
22
22
  token: string;
23
23
  track: string;
24
+ template?: string;
24
25
  customId?: string;
25
26
  domain?: string;
26
27
  customWebSocketUrl?: string;
@@ -1,42 +0,0 @@
1
- import { AbstractService } from './AbstractService';
2
- export declare class FaceMatchService<TFileType> extends AbstractService {
3
- faceMatch(imageFile1: TFileType, imageFile2: TFileType, customerRequestId: string): Promise<IFaceMatchResult>;
4
- get(requestId: string): Promise<IFaceMatchGet>;
5
- }
6
- export interface IFaceMatch {
7
- createdAt: string;
8
- message: string;
9
- requestId: string;
10
- }
11
- export interface IError {
12
- error: string;
13
- }
14
- export interface IFaceMatchResult {
15
- domain: string;
16
- track: string;
17
- service: string;
18
- requestId: string;
19
- requestType: string;
20
- customerRequestId: string;
21
- executionDatetime: string;
22
- error?: IError;
23
- status: string;
24
- comparison_score: number;
25
- similarity_score: number;
26
- match: boolean;
27
- fileImage1?: string;
28
- fileImage2?: string;
29
- }
30
- export interface IFaceMatchGet {
31
- createdAt: string;
32
- delivered: boolean;
33
- domain: string;
34
- id: string;
35
- requestType: string;
36
- sourceURI: string;
37
- status: string;
38
- track: string;
39
- fileURL?: string;
40
- fileImage1?: string;
41
- fileImage2?: string;
42
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FaceMatchService = void 0;
4
- const AbstractService_1 = require("./AbstractService");
5
- const index_1 = require("../utils/index");
6
- class FaceMatchService extends AbstractService_1.AbstractService {
7
- async faceMatch(imageFile1, imageFile2, customerRequestId) {
8
- const requestFn = async () => {
9
- const formData = new this.serviceOptions.FormDataClass();
10
- formData.append('track', this.options.track);
11
- formData.append('customerRequestId', customerRequestId);
12
- formData.append('deliveryFront', true);
13
- formData.append('sensitive_data_compliance', true);
14
- formData.append('imageFile1', imageFile1, 'imageFile1.jpg');
15
- formData.append('imageFile2', imageFile2, 'imageFile2.jpg');
16
- const response = await this.request({ contentType: 'multipart/form-data' }).post('/api/v1/face-match-async', formData);
17
- return response.data;
18
- };
19
- return await (0, index_1.retryAsyncFunctionXTimes)(requestFn);
20
- }
21
- async get(requestId) {
22
- const response = await this.request().get(`/api/v1/tracks/${this.options.track}/face-async/` + requestId);
23
- return response.data;
24
- }
25
- }
26
- exports.FaceMatchService = FaceMatchService;
@@ -1,90 +0,0 @@
1
- import { AbstractService } from './AbstractService';
2
- export declare class TypificationService<TFileType> extends AbstractService {
3
- predict(imageFile: TFileType, customerRequestId: string): Promise<ITypificationPredict>;
4
- get(requestId: string): Promise<ITypificationGet>;
5
- }
6
- export interface ITypificationPredict {
7
- createdAt: string;
8
- message: string;
9
- requestId: string;
10
- }
11
- export interface ITypificationGet {
12
- createdAt: string;
13
- delivered: boolean;
14
- domain: string;
15
- id: string;
16
- requestType: string;
17
- sourceURI: string;
18
- status: string;
19
- executionDeadline: number;
20
- validationDuration: number;
21
- track: string;
22
- fileURL?: string;
23
- }
24
- export interface ITypificationResult {
25
- count: number;
26
- customerRequestId: string;
27
- domain: string;
28
- error: object;
29
- executionDatetime: string;
30
- requestId: string;
31
- requestType: string;
32
- service: string;
33
- status: string;
34
- track: string;
35
- documents: Array<{
36
- typification: {
37
- id: string;
38
- score: number;
39
- };
40
- error?: {
41
- message: string;
42
- };
43
- ocr: {
44
- template: string;
45
- labels: Array<{
46
- x: number;
47
- y: number;
48
- w: number;
49
- h: number;
50
- bottomRight: number[];
51
- topLeft: number[];
52
- label: string | null;
53
- text: string | null;
54
- ocr_score: number | null;
55
- crop: string | null;
56
- ocrInterpretive?: boolean | string | null;
57
- ocrList: IOcrListResult[] | null;
58
- serpro_query?: {
59
- serpro_data: any;
60
- search_logs: {
61
- document: string;
62
- type: string;
63
- search_time: string;
64
- status_code: number;
65
- message: string;
66
- };
67
- } | null;
68
- validation: {
69
- type: string | null;
70
- value: number | string | boolean;
71
- } | null;
72
- validationSerpro?: Record<string, number | boolean>;
73
- }> | null;
74
- } | boolean;
75
- }>;
76
- }
77
- export interface IOcrListResult {
78
- x: number;
79
- y: number;
80
- w: number;
81
- h: number;
82
- bottomRight: number[];
83
- topLeft: number[];
84
- dataField?: string;
85
- dataFieldValue?: boolean;
86
- label: string | null;
87
- ocr?: string | null;
88
- ocr_score?: number;
89
- cropBase64?: string | null;
90
- }