@veryfi/veryfi-sdk 1.3.2 → 1.4.1
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.
- package/README.md +443 -145
- package/lib/anydocs/deleteAnyDocument.js +12 -0
- package/lib/anydocs/getAnyDocument.js +22 -0
- package/lib/anydocs/getAnyDocuments.js +30 -0
- package/lib/anydocs/processAnyDocument.js +33 -0
- package/lib/anydocs/processAnyDocumentBase64.js +31 -0
- package/lib/anydocs/processAnyDocumentStream.js +33 -0
- package/lib/anydocs/processAnyDocumentUrl.js +30 -0
- package/lib/bankstatements/deleteBankStatement.js +12 -0
- package/lib/bankstatements/getBankStatement.js +24 -0
- package/lib/bankstatements/getBankStatements.js +28 -0
- package/lib/bankstatements/processBankStatement.js +33 -0
- package/lib/bankstatements/processBankStatementBase64.js +31 -0
- package/lib/bankstatements/processBankStatementStream.js +31 -0
- package/lib/bankstatements/processBankStatementUrl.js +30 -0
- package/lib/businesscards/deleteBusinessCard.js +12 -0
- package/lib/businesscards/getBusinessCard.js +24 -0
- package/lib/businesscards/getBusinessCards.js +28 -0
- package/lib/businesscards/processBusinessCard.js +27 -0
- package/lib/businesscards/processBusinessCardBase64.js +25 -0
- package/lib/businesscards/processBusinessCardStream.js +25 -0
- package/lib/businesscards/processBusinessCardUrl.js +24 -0
- package/lib/checks/deleteCheck.js +12 -0
- package/lib/checks/getCheck.js +24 -0
- package/lib/checks/getChecks.js +28 -0
- package/lib/checks/processCheck.js +33 -0
- package/lib/checks/processCheckBase64.js +31 -0
- package/lib/checks/processCheckStream.js +31 -0
- package/lib/checks/processCheckUrl.js +30 -0
- package/lib/client/client.js +63 -0
- package/lib/client/constructor.js +27 -0
- package/lib/client/function.js +6 -0
- package/lib/client/generateSignature.js +26 -0
- package/lib/client/getHeaders.js +21 -0
- package/lib/client/getUrl.js +9 -0
- package/lib/client/request.js +58 -0
- package/lib/documents/deleteDocument.js +12 -0
- package/lib/documents/getDocument.js +14 -0
- package/lib/documents/getDocuments.js +31 -0
- package/lib/documents/processDocument.js +37 -0
- package/lib/documents/processDocumentBase64.js +37 -0
- package/lib/documents/processDocumentStream.js +33 -0
- package/lib/documents/processDocumentUrl.js +41 -0
- package/lib/documents/tags/addTag.js +14 -0
- package/lib/documents/tags/addTags.js +14 -0
- package/lib/documents/tags/deleteTags.js +12 -0
- package/lib/documents/tags/replaceTags.js +14 -0
- package/lib/documents/updateDocument.js +17 -0
- package/lib/types/BillTo.ts +11 -0
- package/lib/types/BoundingElement.ts +6 -0
- package/lib/types/Client.ts +1058 -0
- package/lib/types/LineItem.ts +39 -0
- package/lib/types/Payment.ts +8 -0
- package/lib/types/ShipTo.ts +7 -0
- package/lib/types/Tag.ts +4 -0
- package/lib/types/TaxLine.ts +9 -0
- package/lib/types/Vendor.ts +35 -0
- package/lib/types/VeryfiDocument.ts +151 -0
- package/lib/types/VeryfiExtraArgs.ts +9 -0
- package/lib/w2s/deleteW2.js +12 -0
- package/lib/w2s/getW2.js +17 -0
- package/lib/w2s/getW2s.js +13 -0
- package/lib/w2s/processW2.js +28 -0
- package/lib/w2s/processW2Base64.js +30 -0
- package/lib/w2s/processW2Stream.js +30 -0
- package/lib/w2s/processW2Url.js +32 -0
- package/lib/w8bene/deleteW8BENE.js +12 -0
- package/lib/w8bene/getW8BENE.js +24 -0
- package/lib/w8bene/getW8BENEs.js +28 -0
- package/lib/w8bene/processW8BENE.js +33 -0
- package/lib/w8bene/processW8BENEBase64.js +31 -0
- package/lib/w8bene/processW8BENEStream.js +31 -0
- package/lib/w8bene/processW8BENEUrl.js +30 -0
- package/lib/w9s/deleteW9.js +12 -0
- package/lib/w9s/getW9.js +24 -0
- package/lib/w9s/getW9s.js +28 -0
- package/lib/w9s/processW9.js +30 -0
- package/lib/w9s/processW9Base64.js +31 -0
- package/lib/w9s/processW9Stream.js +31 -0
- package/lib/w9s/processW9Url.js +27 -0
- package/package.json +4 -4
- package/lib/main.js +0 -783
- package/lib/types/main.d.ts +0 -541
package/lib/w9s/getW9.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const Client = require('../client/constructor');
|
|
2
|
+
/**
|
|
3
|
+
* Get a w9 document https://docs.veryfi.com/api/w9s/get-a-w-9/
|
|
4
|
+
* @memberof Client
|
|
5
|
+
* @param {number} document_id The unique identifier of the document.
|
|
6
|
+
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
|
|
7
|
+
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
|
|
8
|
+
* @param {Object} kwargs Additional request parameters
|
|
9
|
+
* @returns {JSON} Object of a previously processed blueprinted document.
|
|
10
|
+
*/
|
|
11
|
+
Client.prototype.get_w9 = async function (
|
|
12
|
+
document_id,
|
|
13
|
+
bounding_boxes = false,
|
|
14
|
+
confidence_details = false,
|
|
15
|
+
{...kwargs} = {}
|
|
16
|
+
) {
|
|
17
|
+
let endpoint_name = `/w9s/${document_id}/`;
|
|
18
|
+
let request_arguments = {
|
|
19
|
+
"bounding_boxes": bounding_boxes,
|
|
20
|
+
"confidence_details": confidence_details
|
|
21
|
+
};
|
|
22
|
+
let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false);
|
|
23
|
+
return document['data'];
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const Client = require('../client/constructor');
|
|
2
|
+
/**
|
|
3
|
+
* Get all w9 documents. https://docs.veryfi.com/api/w9s/get-w-9-s/
|
|
4
|
+
* @memberof Client
|
|
5
|
+
* @param {number} page The page number. The response is capped to maximum of 50 results per page.
|
|
6
|
+
* @param {number} page_size The number of Documents per page.
|
|
7
|
+
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
|
|
8
|
+
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
|
|
9
|
+
* @param {Object} kwargs Additional request parameters
|
|
10
|
+
* @returns {JSON} Object of previously processed any documents
|
|
11
|
+
*/
|
|
12
|
+
Client.prototype.get_w9s = async function (
|
|
13
|
+
page = 1,
|
|
14
|
+
page_size = 50,
|
|
15
|
+
bounding_boxes = false,
|
|
16
|
+
confidence_details = false,
|
|
17
|
+
{...kwargs} = {}
|
|
18
|
+
) {
|
|
19
|
+
let endpoint_name = `/w9s/`;
|
|
20
|
+
let request_arguments = {
|
|
21
|
+
"page": page,
|
|
22
|
+
"page_size": page_size,
|
|
23
|
+
"bounding_boxes": bounding_boxes,
|
|
24
|
+
"confidence_details": confidence_details
|
|
25
|
+
};
|
|
26
|
+
let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false);
|
|
27
|
+
return document['data'];
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const Client = require('../client/constructor');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
/**
|
|
5
|
+
* Upload a w9 document from a file path. https://docs.veryfi.com/api/w9s/process-a-w-9/
|
|
6
|
+
* @memberof Client
|
|
7
|
+
* @param {String} file_path Path on disk to a file to submit for data extraction
|
|
8
|
+
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
|
|
9
|
+
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
|
|
10
|
+
* @param {Object} kwargs Additional request parameters
|
|
11
|
+
* @returns {JSON} Data extracted from the document
|
|
12
|
+
*/
|
|
13
|
+
Client.prototype.process_w9 = async function (
|
|
14
|
+
file_path,
|
|
15
|
+
bounding_boxes = false,
|
|
16
|
+
confidence_details = false,
|
|
17
|
+
{...kwargs} = {}
|
|
18
|
+
) {
|
|
19
|
+
|
|
20
|
+
let file = fs.createReadStream(file_path);
|
|
21
|
+
let file_name = path.basename(file_path);
|
|
22
|
+
|
|
23
|
+
return this.process_w9_from_stream(
|
|
24
|
+
file,
|
|
25
|
+
file_name,
|
|
26
|
+
bounding_boxes,
|
|
27
|
+
confidence_details,
|
|
28
|
+
kwargs
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const Client = require('../client/constructor');
|
|
2
|
+
/**
|
|
3
|
+
* Upload a w9 document from a buffer. https://docs.veryfi.com/api/w9s/process-a-w-9/
|
|
4
|
+
* @memberof Client
|
|
5
|
+
* @param {String} file_name The file name including the extension
|
|
6
|
+
* @param {String} file_base64_string To submit a file for data extraction, encode the file in Base64 format and ensure it includes the MIME type. The Base64 string should follow this structure: data:${mimeType};base64,${base64String}
|
|
7
|
+
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
|
|
8
|
+
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
|
|
9
|
+
* @param {Object} kwargs Additional request parameters
|
|
10
|
+
* @returns {JSON} Data extracted from the document
|
|
11
|
+
*/
|
|
12
|
+
Client.prototype.process_w9_from_base64 = async function (
|
|
13
|
+
file_name,
|
|
14
|
+
file_base64_string,
|
|
15
|
+
bounding_boxes = false,
|
|
16
|
+
confidence_details = false,
|
|
17
|
+
{...kwargs} = {}
|
|
18
|
+
) {
|
|
19
|
+
|
|
20
|
+
let endpoint_name = "/w9s/";
|
|
21
|
+
let request_arguments = {
|
|
22
|
+
"file_name": file_name,
|
|
23
|
+
"file_data": file_base64_string,
|
|
24
|
+
"bounding_boxes": bounding_boxes,
|
|
25
|
+
"confidence_details": confidence_details,
|
|
26
|
+
};
|
|
27
|
+
request_arguments = Object.assign(request_arguments, kwargs);
|
|
28
|
+
let document = await this._request("POST", endpoint_name, request_arguments);
|
|
29
|
+
return document['data'];
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const Client = require('../client/constructor');
|
|
2
|
+
/**
|
|
3
|
+
* Upload a w9 document from a buffer. https://docs.veryfi.com/api/w9s/process-a-w-9/
|
|
4
|
+
* @memberof Client
|
|
5
|
+
* @param {fs.ReadStream} file file to submit for data extraction
|
|
6
|
+
* @param {String} file_name The file name including the extension
|
|
7
|
+
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
|
|
8
|
+
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
|
|
9
|
+
* @param {Object} kwargs Additional request parameters
|
|
10
|
+
* @returns {JSON} Data extracted from the document
|
|
11
|
+
*/
|
|
12
|
+
Client.prototype.process_w9_from_stream = async function (
|
|
13
|
+
file,
|
|
14
|
+
file_name,
|
|
15
|
+
bounding_boxes = false,
|
|
16
|
+
confidence_details = false,
|
|
17
|
+
{...kwargs} = {}
|
|
18
|
+
) {
|
|
19
|
+
|
|
20
|
+
let endpoint_name = "/w9s/";
|
|
21
|
+
let request_arguments = {
|
|
22
|
+
"file": file,
|
|
23
|
+
"file_name": file_name,
|
|
24
|
+
"bounding_boxes": bounding_boxes,
|
|
25
|
+
"confidence_details": confidence_details,
|
|
26
|
+
};
|
|
27
|
+
request_arguments = Object.assign(request_arguments, kwargs);
|
|
28
|
+
let document = await this._request("POST", endpoint_name, request_arguments, null, true);
|
|
29
|
+
return document['data'];
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const Client = require('../client/constructor');
|
|
2
|
+
/**
|
|
3
|
+
* Process a w9 document from an url. https://docs.veryfi.com/api/w9s/process-a-w-9/
|
|
4
|
+
* @memberof Client
|
|
5
|
+
* @param {String} file_url url file to submit for data extraction
|
|
6
|
+
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
|
|
7
|
+
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
|
|
8
|
+
* @param {Object} kwargs Additional request parameters
|
|
9
|
+
* @returns {JSON} Data extracted from the document
|
|
10
|
+
*/
|
|
11
|
+
Client.prototype.process_w9_from_url = async function (
|
|
12
|
+
file_url,
|
|
13
|
+
bounding_boxes = false,
|
|
14
|
+
confidence_details = false,
|
|
15
|
+
{...kwargs} = {}
|
|
16
|
+
) {
|
|
17
|
+
|
|
18
|
+
let endpoint_name = "/w9s/";
|
|
19
|
+
let request_arguments = {
|
|
20
|
+
"file_url": file_url,
|
|
21
|
+
"bounding_boxes": bounding_boxes,
|
|
22
|
+
"confidence_details": confidence_details,
|
|
23
|
+
};
|
|
24
|
+
request_arguments = Object.assign(request_arguments, kwargs);
|
|
25
|
+
let document = await this._request("POST", endpoint_name, request_arguments, null, false);
|
|
26
|
+
return document['data'];
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veryfi/veryfi-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Node.js module for communicating with the Veryfi OCR API",
|
|
5
|
-
"main": "lib/
|
|
6
|
-
"typings": "lib/types/
|
|
5
|
+
"main": "lib/client/client.js",
|
|
6
|
+
"typings": "lib/types/Client.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "jest",
|
|
9
9
|
"doc": "jsdoc -d docs --configure jsconf.json main.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@jest/globals": "^29.0.3",
|
|
36
|
-
"axios": "^1.7.
|
|
36
|
+
"axios": "^1.7.4",
|
|
37
37
|
"docdash": "^1.2.0",
|
|
38
38
|
"form-data": "^4.0.0",
|
|
39
39
|
"jest-config": "^29.0.3"
|