@veryfi/veryfi-sdk 1.3.2 → 1.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 (83) hide show
  1. package/README.md +443 -145
  2. package/lib/anydocs/deleteAnyDocument.js +12 -0
  3. package/lib/anydocs/getAnyDocument.js +22 -0
  4. package/lib/anydocs/getAnyDocuments.js +30 -0
  5. package/lib/anydocs/processAnyDocument.js +33 -0
  6. package/lib/anydocs/processAnyDocumentBase64.js +31 -0
  7. package/lib/anydocs/processAnyDocumentStream.js +33 -0
  8. package/lib/anydocs/processAnyDocumentUrl.js +30 -0
  9. package/lib/bankstatements/deleteBankStatement.js +12 -0
  10. package/lib/bankstatements/getBankStatement.js +24 -0
  11. package/lib/bankstatements/getBankStatements.js +28 -0
  12. package/lib/bankstatements/processBankStatement.js +33 -0
  13. package/lib/bankstatements/processBankStatementBase64.js +31 -0
  14. package/lib/bankstatements/processBankStatementStream.js +31 -0
  15. package/lib/bankstatements/processBankStatementUrl.js +30 -0
  16. package/lib/businesscards/deleteBusinessCard.js +12 -0
  17. package/lib/businesscards/getBusinessCard.js +24 -0
  18. package/lib/businesscards/getBusinessCards.js +28 -0
  19. package/lib/businesscards/processBusinessCard.js +27 -0
  20. package/lib/businesscards/processBusinessCardBase64.js +25 -0
  21. package/lib/businesscards/processBusinessCardStream.js +25 -0
  22. package/lib/businesscards/processBusinessCardUrl.js +24 -0
  23. package/lib/checks/deleteCheck.js +12 -0
  24. package/lib/checks/getCheck.js +24 -0
  25. package/lib/checks/getChecks.js +28 -0
  26. package/lib/checks/processCheck.js +33 -0
  27. package/lib/checks/processCheckBase64.js +31 -0
  28. package/lib/checks/processCheckStream.js +31 -0
  29. package/lib/checks/processCheckUrl.js +30 -0
  30. package/lib/client/client.js +63 -0
  31. package/lib/client/constructor.js +27 -0
  32. package/lib/client/function.js +6 -0
  33. package/lib/client/generateSignature.js +26 -0
  34. package/lib/client/getHeaders.js +21 -0
  35. package/lib/client/getUrl.js +9 -0
  36. package/lib/client/request.js +58 -0
  37. package/lib/documents/deleteDocument.js +12 -0
  38. package/lib/documents/getDocument.js +14 -0
  39. package/lib/documents/getDocuments.js +31 -0
  40. package/lib/documents/processDocument.js +37 -0
  41. package/lib/documents/processDocumentBase64.js +37 -0
  42. package/lib/documents/processDocumentStream.js +33 -0
  43. package/lib/documents/processDocumentUrl.js +41 -0
  44. package/lib/documents/tags/addTag.js +14 -0
  45. package/lib/documents/tags/addTags.js +14 -0
  46. package/lib/documents/tags/deleteTags.js +12 -0
  47. package/lib/documents/tags/replaceTags.js +14 -0
  48. package/lib/documents/updateDocument.js +17 -0
  49. package/lib/types/BillTo.ts +11 -0
  50. package/lib/types/BoundingElement.ts +6 -0
  51. package/lib/types/Client.ts +1058 -0
  52. package/lib/types/LineItem.ts +24 -0
  53. package/lib/types/Payment.ts +8 -0
  54. package/lib/types/ShipTo.ts +7 -0
  55. package/lib/types/Tag.ts +4 -0
  56. package/lib/types/TaxLine.ts +9 -0
  57. package/lib/types/Vendor.ts +15 -0
  58. package/lib/types/VeryfiDocument.ts +93 -0
  59. package/lib/types/VeryfiExtraArgs.ts +9 -0
  60. package/lib/w2s/deleteW2.js +12 -0
  61. package/lib/w2s/getW2.js +17 -0
  62. package/lib/w2s/getW2s.js +13 -0
  63. package/lib/w2s/processW2.js +28 -0
  64. package/lib/w2s/processW2Base64.js +30 -0
  65. package/lib/w2s/processW2Stream.js +30 -0
  66. package/lib/w2s/processW2Url.js +32 -0
  67. package/lib/w8bene/deleteW8BENE.js +12 -0
  68. package/lib/w8bene/getW8BENE.js +24 -0
  69. package/lib/w8bene/getW8BENEs.js +28 -0
  70. package/lib/w8bene/processW8BENE.js +33 -0
  71. package/lib/w8bene/processW8BENEBase64.js +31 -0
  72. package/lib/w8bene/processW8BENEStream.js +31 -0
  73. package/lib/w8bene/processW8BENEUrl.js +30 -0
  74. package/lib/w9s/deleteW9.js +12 -0
  75. package/lib/w9s/getW9.js +24 -0
  76. package/lib/w9s/getW9s.js +28 -0
  77. package/lib/w9s/processW9.js +30 -0
  78. package/lib/w9s/processW9Base64.js +31 -0
  79. package/lib/w9s/processW9Stream.js +31 -0
  80. package/lib/w9s/processW9Url.js +27 -0
  81. package/package.json +4 -4
  82. package/lib/main.js +0 -783
  83. package/lib/types/main.d.ts +0 -541
@@ -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.2",
3
+ "version": "1.4.0",
4
4
  "description": "Node.js module for communicating with the Veryfi OCR API",
5
- "main": "lib/main.js",
6
- "typings": "lib/types/main.d.ts",
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.2",
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"