@veryfi/veryfi-sdk 1.2.5 → 1.3.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/lib/main.js +1 -1
- package/lib/types/main.d.ts +141 -100
- package/package.json +3 -3
package/lib/main.js
CHANGED
|
@@ -67,7 +67,7 @@ Client.prototype._check_w2_version = function () {
|
|
|
67
67
|
*/
|
|
68
68
|
Client.prototype._get_headers = function (has_files = false) {
|
|
69
69
|
let final_headers = {
|
|
70
|
-
"User-Agent": "Node.js Veryfi-Nodejs/1.
|
|
70
|
+
"User-Agent": "Node.js Veryfi-Nodejs/1.3.1",
|
|
71
71
|
"Accept": "application/json",
|
|
72
72
|
"Content-Type": "application/json",
|
|
73
73
|
"Client-Id": this.client_id,
|
package/lib/types/main.d.ts
CHANGED
|
@@ -4,124 +4,149 @@ import fs from "fs";
|
|
|
4
4
|
* Additional request parameters type
|
|
5
5
|
*/
|
|
6
6
|
export declare type VeryfiExtraArgs = Record<
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
string | number | symbol,
|
|
8
|
+
string | number | boolean
|
|
9
9
|
>;
|
|
10
10
|
|
|
11
|
+
export declare type BoundingElement = {
|
|
12
|
+
bounding_box?: null | number[];
|
|
13
|
+
bounding_region?: null | number[];
|
|
14
|
+
rotation?: null | number;
|
|
15
|
+
value?: null | number | string;
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
/**
|
|
12
19
|
* Object of data extracted from the document
|
|
13
20
|
*/
|
|
14
21
|
export declare type VeryfiDocument = {
|
|
15
|
-
abn_number?: null | string;
|
|
16
|
-
account_number?: null | string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
abn_number?: null | string | BoundingElement;
|
|
23
|
+
account_number?: null | string | BoundingElement;
|
|
24
|
+
accounting_entry_type?: null | string;
|
|
25
|
+
balance?: null | string | BoundingElement;
|
|
26
|
+
barcodes?: null | string[] | BoundingElement[];
|
|
27
|
+
bill_to?: null | BillTo;
|
|
28
|
+
card_number?: null | string | BoundingElement;
|
|
29
|
+
cashback?: null | number | BoundingElement;
|
|
30
|
+
category?: null | string | BoundingElement;
|
|
31
|
+
created_date?: null | string;
|
|
32
|
+
currency_code?: null | string | BoundingElement;
|
|
33
|
+
custom_fields?: null | VeryfiExtraArgs;
|
|
34
|
+
date?: null | string | BoundingElement;
|
|
35
|
+
default_category?: null | string | BoundingElement;
|
|
36
|
+
delivery_date?: null | string | BoundingElement;
|
|
37
|
+
delivery_note_number?: null | string | BoundingElement;
|
|
38
|
+
discount?: null | number | BoundingElement;
|
|
39
|
+
document_reference_number?: null | string | BoundingElement;
|
|
40
|
+
document_title?: null | string | BoundingElement;
|
|
41
|
+
document_type?: null | string | BoundingElement;
|
|
42
|
+
due_date?: null | string | BoundingElement;
|
|
32
43
|
duplicate_of?: null | number;
|
|
44
|
+
exch_rate?: null | number;
|
|
33
45
|
external_id?: null | string;
|
|
46
|
+
final_balance?: null | number | BoundingElement;
|
|
47
|
+
guest_count?: null | number | BoundingElement;
|
|
34
48
|
id?: null | number;
|
|
49
|
+
img_blur?: null | boolean;
|
|
35
50
|
img_file_name?: null | string;
|
|
36
51
|
img_thumbnail_url?: null | string;
|
|
37
52
|
img_url?: null | string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
53
|
+
incoterms?: null | number | BoundingElement;
|
|
54
|
+
insurance?: null | number | BoundingElement;
|
|
55
|
+
invoice_number?: null | string | BoundingElement;
|
|
56
|
+
is_approved?: null | boolean;
|
|
57
|
+
is_blurry?: null | boolean[];
|
|
58
|
+
is_document?: null | boolean;
|
|
59
|
+
is_duplicate?: null | boolean;
|
|
60
|
+
is_money_in?: null | boolean | BoundingElement;
|
|
61
|
+
license_plate_number?: null | string | BoundingElement;
|
|
41
62
|
line_items?: null | LineItem[];
|
|
63
|
+
line_items_with_scores?: null | LineItem[];
|
|
42
64
|
notes?: null | string;
|
|
43
65
|
ocr_text?: null | string;
|
|
44
|
-
order_date?: null | string;
|
|
66
|
+
order_date?: null | string | BoundingElement;
|
|
45
67
|
payment?: null | Payment;
|
|
46
|
-
payment_display_name?: null | string;
|
|
47
|
-
payment_terms?: null | string;
|
|
48
|
-
payment_type?: null | string;
|
|
49
68
|
pdf_url?: null | string;
|
|
50
|
-
|
|
51
|
-
purchase_order_number?: null | string;
|
|
52
|
-
rounding?: null | number;
|
|
69
|
+
previous_balance?: null | number | BoundingElement;
|
|
70
|
+
purchase_order_number?: null | string | BoundingElement;
|
|
71
|
+
rounding?: null | number | BoundingElement;
|
|
72
|
+
server_name?: null | string | BoundingElement;
|
|
53
73
|
service_end_date?: null | string;
|
|
54
74
|
service_start_date?: null | string;
|
|
55
|
-
ship_date?: null | string;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
store_number?: null | string;
|
|
60
|
-
subtotal?: null | number;
|
|
61
|
-
|
|
75
|
+
ship_date?: null | string | BoundingElement;
|
|
76
|
+
ship_to?: null | ShipTo;
|
|
77
|
+
shipping?: null | number | BoundingElement;
|
|
78
|
+
status?: null | string;
|
|
79
|
+
store_number?: null | string | BoundingElement;
|
|
80
|
+
subtotal?: null | number | BoundingElement;
|
|
81
|
+
tags?: null | Tag[];
|
|
82
|
+
tax?: null | number | BoundingElement;
|
|
62
83
|
tax_lines?: null | TaxLine[];
|
|
63
|
-
tip?: null | number;
|
|
64
|
-
total?: null | number;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
84
|
+
tip?: null | number | BoundingElement;
|
|
85
|
+
total?: null | number | BoundingElement;
|
|
86
|
+
total_pages?: null | number;
|
|
87
|
+
total_quantity?: null | string | BoundingElement;
|
|
88
|
+
total_weight?: null | string | BoundingElement;
|
|
89
|
+
tracking_number?: null | string | BoundingElement;
|
|
90
|
+
tracking_numbers?: null | BoundingElement[];
|
|
91
|
+
updated_date?: null | string;
|
|
92
|
+
vending_person?: null | string | BoundingElement;
|
|
93
|
+
vending_person_number?: null | string | BoundingElement;
|
|
68
94
|
vat_number?: null | string;
|
|
69
95
|
vendor?: null | Vendor;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
vendor_iban?: null | string;
|
|
96
|
+
vendors?: null | BoundingElement[];
|
|
97
|
+
vin_number?: null | string | BoundingElement;
|
|
98
|
+
warnings?: null | string[];
|
|
99
|
+
weights?: null | BoundingElement[];
|
|
75
100
|
};
|
|
76
101
|
|
|
77
102
|
declare type LineItem = {
|
|
78
|
-
date?: null | string;
|
|
79
|
-
description?: null | string;
|
|
80
|
-
discount?: null | number;
|
|
81
|
-
end_date?: null | string;
|
|
103
|
+
date?: null | string | BoundingElement;
|
|
104
|
+
description?: null | string | BoundingElement;
|
|
105
|
+
discount?: null | number | BoundingElement;
|
|
106
|
+
end_date?: null | string | BoundingElement;
|
|
82
107
|
hsn?: null | string;
|
|
83
108
|
id?: null | number;
|
|
84
109
|
order?: null | number;
|
|
85
|
-
price?: null | number;
|
|
86
|
-
quantity?: null | number;
|
|
87
|
-
reference?: null | string;
|
|
110
|
+
price?: null | number | BoundingElement;
|
|
111
|
+
quantity?: null | number | BoundingElement;
|
|
112
|
+
reference?: null | string | BoundingElement;
|
|
88
113
|
section?: null | string;
|
|
89
|
-
sku?: null | string;
|
|
114
|
+
sku?: null | string | BoundingElement;
|
|
90
115
|
start_date?: null | string;
|
|
91
116
|
tags?: null | null[];
|
|
92
|
-
tax?: null | number;
|
|
117
|
+
tax?: null | number| BoundingElement;
|
|
93
118
|
tax_rate?: null | number;
|
|
94
|
-
total?: null | number;
|
|
119
|
+
total?: null | number | BoundingElement;
|
|
95
120
|
type?: null | string;
|
|
96
121
|
unit_of_measure?: null | string;
|
|
97
122
|
};
|
|
98
123
|
|
|
99
124
|
declare type TaxLine = {
|
|
100
|
-
base?: null | number;
|
|
101
|
-
name?: null | string;
|
|
125
|
+
base?: null | number | BoundingElement;
|
|
126
|
+
name?: null | string | BoundingElement;
|
|
102
127
|
order?: null | number;
|
|
103
|
-
rate?: null | number;
|
|
104
|
-
total?: null | number;
|
|
128
|
+
rate?: null | number | BoundingElement;
|
|
129
|
+
total?: null | number | BoundingElement;
|
|
105
130
|
};
|
|
106
131
|
|
|
107
132
|
declare type Vendor = {
|
|
108
|
-
address?: null | string;
|
|
109
|
-
category?: null | string;
|
|
110
|
-
email?: null | string;
|
|
111
|
-
fax_number?: null | string;
|
|
112
|
-
name?: null | string;
|
|
113
|
-
phone_number?: null | string;
|
|
133
|
+
address?: null | string | BoundingElement;
|
|
134
|
+
category?: null | string | BoundingElement;
|
|
135
|
+
email?: null | string | BoundingElement;
|
|
136
|
+
fax_number?: null | string | BoundingElement;
|
|
137
|
+
name?: null | string | BoundingElement;
|
|
138
|
+
phone_number?: null | string | BoundingElement;
|
|
114
139
|
raw_name?: null | string;
|
|
115
|
-
vendor_logo?: null | string;
|
|
116
|
-
vendor_reg_number?: null | string;
|
|
140
|
+
vendor_logo?: null | string | BoundingElement;
|
|
141
|
+
vendor_reg_number?: null | string | BoundingElement;
|
|
117
142
|
vendor_type?: null | string;
|
|
118
|
-
web?: null | string;
|
|
143
|
+
web?: null | string | BoundingElement;
|
|
119
144
|
};
|
|
120
145
|
|
|
121
146
|
declare type Payment = {
|
|
122
|
-
card_number?: null | string;
|
|
123
|
-
display_name?: null | string;
|
|
124
|
-
terms?: null | number;
|
|
147
|
+
card_number?: null | string | BoundingElement;
|
|
148
|
+
display_name?: null | string | BoundingElement;
|
|
149
|
+
terms?: null | number | BoundingElement;
|
|
125
150
|
type?: null | string;
|
|
126
151
|
};
|
|
127
152
|
|
|
@@ -130,6 +155,22 @@ declare type Tag = {
|
|
|
130
155
|
name?: null | string;
|
|
131
156
|
};
|
|
132
157
|
|
|
158
|
+
declare type BillTo = {
|
|
159
|
+
address?: null | string | BoundingElement;
|
|
160
|
+
email?: null | string | BoundingElement;
|
|
161
|
+
name?: null | string | BoundingElement;
|
|
162
|
+
parsed_address?: null | string;
|
|
163
|
+
phone_number?: null | number | string | BoundingElement;
|
|
164
|
+
reg_number?: null | number | string | BoundingElement;
|
|
165
|
+
vat_number?: null | number | string | BoundingElement;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
declare type ShipTo = {
|
|
169
|
+
address?: null | string | BoundingElement;
|
|
170
|
+
name?: null | string | BoundingElement;
|
|
171
|
+
parsed_address?: null | string;
|
|
172
|
+
};
|
|
173
|
+
|
|
133
174
|
export declare class Client {
|
|
134
175
|
/**
|
|
135
176
|
* Create instance of a Client
|
|
@@ -143,13 +184,13 @@ export declare class Client {
|
|
|
143
184
|
* @param {number} timeout
|
|
144
185
|
*/
|
|
145
186
|
constructor(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
187
|
+
client_id: string,
|
|
188
|
+
client_secret: string | undefined,
|
|
189
|
+
username: string,
|
|
190
|
+
api_key: string,
|
|
191
|
+
base_url?: string,
|
|
192
|
+
api_version?: string,
|
|
193
|
+
timeout?: number
|
|
153
194
|
);
|
|
154
195
|
|
|
155
196
|
client_id: string;
|
|
@@ -256,10 +297,10 @@ export declare class Client {
|
|
|
256
297
|
* @returns {Promise<VeryfiDocument>} Object of data extracted from the document
|
|
257
298
|
*/
|
|
258
299
|
public process_document(
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
300
|
+
file_path: string,
|
|
301
|
+
categories?: string[],
|
|
302
|
+
delete_after_processing?: boolean,
|
|
303
|
+
{ ...kwargs }?: VeryfiExtraArgs
|
|
263
304
|
): Promise<VeryfiDocument>;
|
|
264
305
|
|
|
265
306
|
/**
|
|
@@ -276,14 +317,14 @@ export declare class Client {
|
|
|
276
317
|
* @return {Promise<VeryfiDocument>} Object of data extracted from the document
|
|
277
318
|
*/
|
|
278
319
|
public process_document_url(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
320
|
+
file_url?: string,
|
|
321
|
+
file_urls?: string[],
|
|
322
|
+
categories?: string[],
|
|
323
|
+
delete_after_processing?: boolean,
|
|
324
|
+
boost_mode?: number,
|
|
325
|
+
external_id?: string,
|
|
326
|
+
max_pages_to_process?: number,
|
|
327
|
+
{ ...kwargs }?: VeryfiExtraArgs
|
|
287
328
|
): Promise<VeryfiDocument>;
|
|
288
329
|
|
|
289
330
|
/**
|
|
@@ -307,8 +348,8 @@ export declare class Client {
|
|
|
307
348
|
* @return {Promise<VeryfiDocument>} Object of data extracted from the document with updated fields, if fields are writable. Otherwise, a document with unchanged fields.
|
|
308
349
|
*/
|
|
309
350
|
public update_document(
|
|
310
|
-
|
|
311
|
-
|
|
351
|
+
document_id: string,
|
|
352
|
+
{ ...kwargs }?: VeryfiExtraArgs
|
|
312
353
|
): Promise<VeryfiDocument>;
|
|
313
354
|
|
|
314
355
|
/**
|
|
@@ -360,13 +401,13 @@ export declare class Client {
|
|
|
360
401
|
* @param {number} timeout
|
|
361
402
|
*/
|
|
362
403
|
export declare function Client(
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
404
|
+
client_id: string,
|
|
405
|
+
client_secret: string | undefined,
|
|
406
|
+
username: string,
|
|
407
|
+
api_key: string,
|
|
408
|
+
base_url?: string,
|
|
409
|
+
api_version?: string,
|
|
410
|
+
timeout?: number
|
|
370
411
|
): Client;
|
|
371
412
|
|
|
372
413
|
export default Client;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veryfi/veryfi-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Node.js module for communicating with the Veryfi OCR API",
|
|
5
5
|
"main": "lib/main.js",
|
|
6
6
|
"typings": "lib/types/main.d.ts",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"jest": "^29.0.0",
|
|
29
|
-
"jsdoc": "^
|
|
29
|
+
"jsdoc": "^4.0.3",
|
|
30
30
|
"minami": "^1.2.3",
|
|
31
31
|
"ts-jest": "^29.0.1",
|
|
32
32
|
"typescript": "^4.8.3"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@jest/globals": "^29.0.3",
|
|
36
|
-
"axios": "^
|
|
36
|
+
"axios": "^1.7.2",
|
|
37
37
|
"docdash": "^1.2.0",
|
|
38
38
|
"form-data": "^4.0.0",
|
|
39
39
|
"jest-config": "^29.0.3"
|