@onfido/api 2.8.0 → 3.0.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 (53) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +118 -126
  3. package/dist/api.d.ts +11690 -0
  4. package/dist/api.js +5113 -0
  5. package/dist/base.d.ts +66 -0
  6. package/dist/base.js +65 -0
  7. package/dist/common.d.ts +66 -0
  8. package/dist/common.js +201 -0
  9. package/dist/configuration.d.ts +93 -0
  10. package/dist/configuration.js +53 -0
  11. package/dist/esm/api.d.ts +11690 -0
  12. package/dist/esm/api.js +5106 -0
  13. package/dist/esm/base.d.ts +66 -0
  14. package/dist/esm/base.js +60 -0
  15. package/dist/esm/common.d.ts +66 -0
  16. package/dist/esm/common.js +189 -0
  17. package/dist/esm/configuration.d.ts +93 -0
  18. package/dist/esm/configuration.js +49 -0
  19. package/dist/esm/index.d.ts +14 -0
  20. package/dist/esm/index.js +16 -0
  21. package/dist/{WebhookEventVerifier.d.ts → esm/webhook-event-verifier.d.ts} +9 -16
  22. package/dist/esm/webhook-event-verifier.js +31 -0
  23. package/dist/index.d.ts +14 -19
  24. package/dist/index.js +31 -553
  25. package/dist/webhook-event-verifier.d.ts +9 -0
  26. package/dist/webhook-event-verifier.js +36 -0
  27. package/package.json +30 -31
  28. package/CHANGELOG.md +0 -117
  29. package/dist/Onfido.d.ts +0 -40
  30. package/dist/OnfidoDownload.d.ts +0 -9
  31. package/dist/Resource.d.ts +0 -22
  32. package/dist/errors/OnfidoApiError.d.ts +0 -10
  33. package/dist/errors/OnfidoError.d.ts +0 -3
  34. package/dist/formatting.d.ts +0 -16
  35. package/dist/index.es.js +0 -544
  36. package/dist/index.es.js.map +0 -1
  37. package/dist/index.js.map +0 -1
  38. package/dist/resources/Addresses.d.ts +0 -27
  39. package/dist/resources/Applicants.d.ts +0 -44
  40. package/dist/resources/Autofill.d.ts +0 -37
  41. package/dist/resources/Checks.d.ts +0 -42
  42. package/dist/resources/ConsentsRequest.d.ts +0 -4
  43. package/dist/resources/Documents.d.ts +0 -34
  44. package/dist/resources/IdNumbers.d.ts +0 -10
  45. package/dist/resources/LivePhotos.d.ts +0 -25
  46. package/dist/resources/LiveVideos.d.ts +0 -19
  47. package/dist/resources/Location.d.ts +0 -8
  48. package/dist/resources/MotionCaptures.d.ts +0 -19
  49. package/dist/resources/Reports.d.ts +0 -24
  50. package/dist/resources/SdkTokens.d.ts +0 -12
  51. package/dist/resources/Webhooks.d.ts +0 -26
  52. package/dist/resources/WorkflowRuns.d.ts +0 -48
  53. package/dist/types/formData.d.ts +0 -27
package/package.json CHANGED
@@ -1,39 +1,41 @@
1
1
  {
2
2
  "name": "@onfido/api",
3
- "version": "2.8.0",
3
+ "version": "3.0.0",
4
4
  "description": "Node.js library for the Onfido API",
5
+ "author": "OpenAPI-Generator Contributors",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/onfido/onfido-node.git"
9
+ },
5
10
  "keywords": [
11
+ "axios",
12
+ "typescript",
13
+ "openapi-client",
14
+ "openapi-generator",
15
+ "@onfido/api",
6
16
  "onfido",
7
17
  "identity",
8
18
  "verification",
9
19
  "api"
10
20
  ],
11
- "homepage": "https://github.com/onfido/onfido-node#readme",
12
21
  "license": "MIT",
13
- "author": "Onfido <api@onfido.com> (https://documentation.onfido.com)",
14
- "repository": "github:onfido/onfido-node",
15
- "main": "dist/index.js",
16
- "module": "dist/index.es.js",
17
- "types": "dist/index.d.ts",
22
+ "main": "./dist/index.js",
23
+ "typings": "./dist/index.d.ts",
24
+ "module": "./dist/esm/index.js",
18
25
  "sideEffects": false,
19
- "files": [
20
- "dist"
21
- ],
22
- "publishConfig": {
23
- "access": "public"
24
- },
25
26
  "scripts": {
26
- "build": "rollup -c rollup.config.ts",
27
27
  "test": "jest",
28
- "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
29
- "inspect": "tslint 'src/**/*.ts' 'test/**/*.ts' && prettier --check README.md",
30
- "format": "tslint 'src/**/*.ts' 'test/**/*.ts' --fix && prettier --write README.md"
28
+ "build": "tsc && tsc -p tsconfig.esm.json",
29
+ "prepare": "npm run build"
31
30
  },
31
+ "files": [
32
+ "/dist"
33
+ ],
32
34
  "jest": {
33
35
  "preset": "ts-jest",
34
36
  "testEnvironment": "node",
35
37
  "moduleNameMapper": {
36
- "onfido-node": "<rootDir>/src/index",
38
+ "onfido-node": "<rootDir>/index",
37
39
  "axios": "axios/dist/node/axios.cjs"
38
40
  },
39
41
  "globals": {
@@ -42,23 +44,20 @@
42
44
  }
43
45
  }
44
46
  },
47
+ "dependencies": {
48
+ "axios": "^1.6.1"
49
+ },
45
50
  "devDependencies": {
46
- "@rollup/plugin-json": "^4.1.0",
51
+ "@faker-js/faker": "^8.4.1",
47
52
  "@types/jest": "^26.0.15",
48
53
  "jest": "^26.6.3",
49
- "nock": "^11.7.0",
50
54
  "prettier": "^1.18.2",
51
- "rollup": "^1.24.0",
52
- "rollup-plugin-typescript2": "^0.25.3",
53
- "snakecase-keys": "^5.4.4",
54
55
  "ts-jest": "^26.4.4",
55
- "tslint": "^5.20.0",
56
- "tslint-config-prettier": "^1.18.0",
57
- "tslint-plugin-prettier": "^2.0.1",
58
- "typescript": "^4.0.5"
56
+ "dotenv": "^16.4.5",
57
+ "@types/node": "^12.11.5",
58
+ "typescript": "^4.0"
59
59
  },
60
- "dependencies": {
61
- "axios": "^1.6.1",
62
- "form-data": "^3.0.0"
60
+ "publishConfig": {
61
+ "access": "public"
63
62
  }
64
- }
63
+ }
package/CHANGELOG.md DELETED
@@ -1,117 +0,0 @@
1
- # Changelog
2
-
3
- ## v2.8.0 24 November 2023
4
-
5
- - Added `signed_evidence_file` method for WorkflowRuns
6
-
7
- ## v2.7.2, 14 June 2023
8
-
9
- - Added `sandbox` field to Check.
10
-
11
- ## v2.7.1, 30 May 2023
12
-
13
- - Fix bug when uploading documents with `validateImageQuality`.
14
-
15
- ## v2.7.0, 24 January 2023
16
-
17
- - Updated to use API v3.6. For more details please see our [release notes](https://developers.onfido.com/release-notes#api-v36)
18
-
19
- ## v2.6.0, 7 December 2022
20
-
21
- - Added WorkflowRuns support
22
-
23
- ## v2.5.0, 22 November 2022
24
-
25
- - Added Motion capture support
26
-
27
- ## v2.4.0, 06 October 2022
28
-
29
- - Updated to use API v3.5. For more details please see our [release notes](https://developers.onfido.com/release-notes#api-v35)
30
-
31
- ## v2.3.1, 24 May 2022
32
-
33
- - Reinstated `privacyNoticesReadConsentGiven` parameter
34
-
35
- ## v2.3.0, 10 May 2022
36
-
37
- - Updated to use API v3.4. For more details please see our [release notes](https://developers.onfido.com/release-notes#api-v34)
38
- - Added `location` to applicant request, applicant response and documents request. `location` is a mandatory parameter for all applicants in order to create a check using API v3.4
39
- - Added `consents` to applicant request. `consents` is a mandatory parameter for any applicant located in the United States in order to create a check using API v3.4
40
- - Added `phoneNumber` to applicant request and response
41
-
42
- ## v2.2.0, 02 March 2022
43
-
44
- - Updated to use API v3.3
45
-
46
- ## v2.1.2, 17 Feb 2022
47
-
48
- - Fixed `advancedValidation` flag when uploading live photo
49
-
50
- ## v2.1.1, 6 Jan 2022
51
-
52
- - Added `validate_image_quality` to document upload request
53
-
54
- ## v2.1.0, 24 June 2021
55
-
56
- - Updated to use API v3.2
57
-
58
- ## v2.0.2, 25 May 2021
59
-
60
- - Added `environments` to Webhook object
61
-
62
- ## v2.0.1, 17 May 2021
63
-
64
- - Added `sub_result` to trigger sandbox pre-determined responses for Document report sub-results
65
- - Added `consider` array functionality for sandbox pre-determined responses
66
-
67
- ## v2.0.0, 9 April 2021
68
-
69
- - Updated to use API v3.1
70
- - Region is now a required argument when constructing an `Onfido` instance. The region previously defaulted to `Region.EU`
71
- - Add support for downloading a check
72
-
73
- ## v1.6.0, 8 March 2021
74
-
75
- - Add `privacy_notices_read_consent_given` to the type for creating a chec
76
-
77
- ## v1.5.4, 12 January 2021
78
-
79
- - Updated dependencies.
80
-
81
- ## v1.5.3, 3 December 2020
82
-
83
- - Library should work now with `esModuleInterop: false`
84
-
85
- ## v1.5.2, 3 September 2020
86
-
87
- - Fix type declaration location for TypeScript users
88
-
89
- ## v1.5.1, 20 August 2020
90
-
91
- - Ensure consistent version in User-Agent
92
-
93
- ## v1.5.0, 14 August 2020
94
-
95
- - Add User Agent header
96
-
97
- ## v1.4.0, 15 July 2020
98
-
99
- - Add support for [Autofill endpoint](https://documentation.onfido.com/#autofill-beta)
100
-
101
- ## v1.3.0, 30 June 2020
102
-
103
- - Add support for `cross_device_url` when generating an SDK token
104
-
105
- ## v1.2.0, 23 June 2020
106
-
107
- - Allow specifying the filepath and content type explicitly for file upload
108
- - Add support for the Canada region (api.ca.onfido.com)
109
- - Add missing `document_ids` field to `CheckRequest` type
110
-
111
- ## v1.1.0, 2 April 2020
112
-
113
- - Improved typing of check and report objects.
114
-
115
- ## v1.0.0, 23 January 2020
116
-
117
- - The initial release of this library, which uses v3 of the Onfido API
package/dist/Onfido.d.ts DELETED
@@ -1,40 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- import { Addresses } from "./resources/Addresses";
3
- import { Applicants } from "./resources/Applicants";
4
- import { Autofill } from "./resources/Autofill";
5
- import { Checks } from "./resources/Checks";
6
- import { Documents } from "./resources/Documents";
7
- import { LivePhotos } from "./resources/LivePhotos";
8
- import { LiveVideos } from "./resources/LiveVideos";
9
- import { MotionCaptures } from "./resources/MotionCaptures";
10
- import { Reports } from "./resources/Reports";
11
- import { SdkTokens } from "./resources/SdkTokens";
12
- import { Webhooks } from "./resources/Webhooks";
13
- import { WorkflowRuns } from "./resources/WorkflowRuns";
14
- export declare enum Region {
15
- EU = "EU",
16
- US = "US",
17
- CA = "CA"
18
- }
19
- export declare type OnfidoOptions = {
20
- apiToken: string;
21
- region: Region;
22
- timeout?: number;
23
- unknownApiUrl?: string;
24
- };
25
- export declare class Onfido {
26
- readonly axiosInstance: AxiosInstance;
27
- readonly applicant: Applicants;
28
- readonly document: Documents;
29
- readonly livePhoto: LivePhotos;
30
- readonly liveVideo: LiveVideos;
31
- readonly motionCapture: MotionCaptures;
32
- readonly check: Checks;
33
- readonly report: Reports;
34
- readonly workflowRun: WorkflowRuns;
35
- readonly address: Addresses;
36
- readonly webhook: Webhooks;
37
- readonly sdkToken: SdkTokens;
38
- readonly autofill: Autofill;
39
- constructor({ apiToken, region, timeout, unknownApiUrl }: OnfidoOptions);
40
- }
@@ -1,9 +0,0 @@
1
- /// <reference types="node" />
2
- import { IncomingMessage } from "http";
3
- import { Readable } from "stream";
4
- export declare class OnfidoDownload {
5
- private readonly incomingMessage;
6
- constructor(incomingMessage: IncomingMessage);
7
- asStream(): Readable;
8
- get contentType(): string;
9
- }
@@ -1,22 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- import { SimpleObject } from "./formatting";
3
- import { OnfidoDownload } from "./OnfidoDownload";
4
- export declare enum Method {
5
- GET = "get",
6
- POST = "post",
7
- PUT = "put",
8
- DELETE = "delete"
9
- }
10
- export declare class Resource<T extends SimpleObject> {
11
- private readonly name;
12
- private readonly axiosInstance;
13
- protected constructor(name: string, axiosInstance: AxiosInstance);
14
- protected request({ method, path, body, query }: {
15
- method: Method;
16
- path?: string;
17
- body?: T;
18
- query?: SimpleObject;
19
- }): Promise<any>;
20
- protected upload(body: T): Promise<any>;
21
- protected download(path: string): Promise<OnfidoDownload>;
22
- }
@@ -1,10 +0,0 @@
1
- import { OnfidoError } from "./OnfidoError";
2
- export declare class OnfidoApiError extends OnfidoError {
3
- readonly responseBody: unknown;
4
- readonly statusCode: number;
5
- readonly type: string;
6
- readonly fields: unknown;
7
- private constructor();
8
- static fromResponse(responseBody: unknown, statusCode: number): OnfidoApiError;
9
- isClientError(): boolean;
10
- }
@@ -1,3 +0,0 @@
1
- export declare class OnfidoError extends Error {
2
- constructor(message?: string);
3
- }
@@ -1,16 +0,0 @@
1
- /// <reference types="node" />
2
- import { Readable } from "stream";
3
- import { IFormData } from "./types/formData";
4
- export declare type SimpleObject = {
5
- [key: string]: unknown;
6
- };
7
- declare type ContentsAndOptions = {
8
- contents: Readable;
9
- filepath: string;
10
- contentType?: string;
11
- };
12
- export declare type FileLike = Readable | ContentsAndOptions;
13
- export declare const convertObjectToSnakeCase: (requestBody: unknown) => unknown;
14
- export declare const convertObjectToCamelCase: (responseBody: SimpleObject) => SimpleObject;
15
- export declare const toFormData: (object: SimpleObject) => IFormData;
16
- export {};