Socket
Socket
Sign inDemoInstall

@veryfi/veryfi-sdk

Package Overview
Dependencies
Maintainers
5
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@veryfi/veryfi-sdk - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

218

lib/main.js

@@ -70,3 +70,3 @@ const {createHmac} = require('crypto');

let final_headers = {
"User-Agent": "Node.js Veryfi-Nodejs/1.3.1",
"User-Agent": "Node.js Veryfi-Nodejs/1.3.2",
"Accept": "application/json",

@@ -178,3 +178,9 @@ "Content-Type": "application/json",

*/
Client.prototype.get_documents = async function () {
Client.prototype.get_documents = async function (
page = 1,
page_size = 50,
bounding_boxes = false,
confidence_details = false,
{...kwargs} = {}
) {
let endpoint_name = "/documents/";

@@ -568,5 +574,213 @@ let request_arguments = {};

/**
* Process any document and extract all the fields from it
* @example
* veryfi_client.process_any_document('file/path','blue_print')
*
* @memberof Client
* @param {String} file_path Path on disk to a file to submit for data extraction
* @param {String} template_name name of the extraction templates.
* @param {number} max_pages_to_process The number of pages to process for the document. The limit is 50 pages per document.
* @param {Object} kwargs Additional request parameters
* @returns {JSON} Data extracted from the document
*/
Client.prototype.process_any_document = async function (
file_path,
template_name,
max_pages_to_process = 20,
{...kwargs} = {}
) {
let endpoint_name = "/any-documents/";
let file_name = path.basename(file_path);
const image_file = fs.readFileSync(file_path, {encoding: 'base64'});
const base64_encoded_string = Buffer.from(image_file).toString('utf-8');
let request_arguments = {
"file_name": file_name,
"file_data": base64_encoded_string,
"template_name": template_name,
"max_pages_to_process": max_pages_to_process,
};
request_arguments = Object.assign(request_arguments, kwargs);
let document = await this._request("POST", endpoint_name, request_arguments);
return document['data'];
}
/**
* Process any document and extract all the fields from it
* @example
* veryfi_client.process_any_document_url('file_url','blue_print')
*
* @memberof Client
* @param {String} file_url url file to submit for data extraction
* @param {String} template_name name of the extraction templates.
* @param {number} max_pages_to_process The number of pages to process for the document. The limit is 50 pages per document.
* @param {Object} kwargs Additional request parameters
* @returns {JSON} Data extracted from the document
*/
Client.prototype.process_any_document_url = async function (
file_url,
template_name,
max_pages_to_process = 20,
{...kwargs} = {}
) {
let endpoint_name = "/any-documents/";
let request_arguments = {
"file_url": file_url,
"template_name": template_name,
"max_pages_to_process": max_pages_to_process,
};
request_arguments = Object.assign(request_arguments, kwargs);
let document = await this._request("POST", endpoint_name, request_arguments);
return document['data'];
}
/**
* Get all any documents
* @memberof Client
* @param {number} page The page number. The response is capped to maximum of 50 results per page.
* @param {number} page_size The number of Documents per page.
* @returns {JSON} Object of previously processed any documents
*/
Client.prototype.get_any_documents = async function (
page = 1,
page_size = 50) {
let endpoint_name = "/any-documents/";
let request_arguments = {"page": page, "page_size": page_size};
let documents = await this._request("GET", endpoint_name, request_arguments);
if ("data" in documents) {
documents = documents["data"];
}
return documents;
}
/**
* Get a specific any document
* @memberof Client
* @param {number} document_id The unique identifier of the document.
* @returns {JSON} Object of a previously processed blueprinted document.
*/
Client.prototype.get_any_document = async function (document_id) {
let endpoint_name = `/any-documents/${document_id}/`;
let request_arguments = {};
let document = await this._request("GET", endpoint_name, request_arguments);
return document['data'];
}
/**
* Get a specific bank statement
* @memberof Client
* @param {number} document_id The unique identifier of the document.
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
* @returns {JSON} Object of a previously processed blueprinted document.
*/
Client.prototype.get_bank_statement = async function (
document_id,
bounding_boxes = false,
confidence_details = false
) {
let endpoint_name = `/bank-statements/${document_id}/`;
let request_arguments = {
"bounding_boxes": bounding_boxes,
"confidence_details": confidence_details
};
let document = await this._request("GET", endpoint_name, request_arguments);
return document['data'];
}
/**
* Get all bank statements
* @memberof Client
* @param {number} page The page number. The response is capped to maximum of 50 results per page.
* @param {number} page_size The number of Documents per page.
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
* @returns {JSON} Object of previously processed any documents
*/
Client.prototype.get_bank_statements = async function (
page = 1,
page_size = 50,
bounding_boxes = false,
confidence_details = false
) {
let endpoint_name = `/bank-statements/`;
let request_arguments = {
"page": page,
"page_size": page_size,
"bounding_boxes": bounding_boxes,
"confidence_details": confidence_details
};
let document = await this._request("GET", endpoint_name, request_arguments);
return document['data'];
}
/**
* Process bank statement and extract all the fields from it
* @example
* veryfi_client.process_bank_statement('file_path')
*
* @memberof Client
* @param {String} file_path Path on disk to a file to submit for data extraction
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
* @param {Object} kwargs Additional request parameters
* @returns {JSON} Data extracted from the document
*/
Client.prototype.process_bank_statement = async function (
file_path,
bounding_boxes = false,
confidence_details = false,
{...kwargs} = {}
) {
let endpoint_name = "/bank-statements/";
let file_name = path.basename(file_path);
const image_file = fs.readFileSync(file_path, {encoding: 'base64'});
const base64_encoded_string = Buffer.from(image_file).toString('utf-8');
let request_arguments = {
"file_name": file_name,
"file_data": base64_encoded_string,
"bounding_boxes": bounding_boxes,
"confidence_details": confidence_details,
};
request_arguments = Object.assign(request_arguments, kwargs);
let document = await this._request("POST", endpoint_name, request_arguments);
return document['data'];
}
/**
* Process bank statement and extract all the fields from it
* @example
* veryfi_client.process_bank_statement_url('file_url')
*
* @memberof Client
* @param {String} file_url url file to submit for data extraction
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
* @param {Object} kwargs Additional request parameters
* @returns {JSON} Data extracted from the document
*/
Client.prototype.process_bank_statement_url = async function (
file_url,
bounding_boxes = false,
confidence_details = false,
{...kwargs} = {}
) {
let endpoint_name = "/bank-statements/";
let request_arguments = {
"file_url": file_url,
"bounding_boxes": bounding_boxes,
"confidence_details": confidence_details,
};
request_arguments = Object.assign(request_arguments, kwargs);
let document = await this._request("POST", endpoint_name, request_arguments);
return document['data'];
}
// Exports
module.exports = Client;
import fs from "fs";
import path from "path";

@@ -18,2 +19,4 @@ /**

export type JsonObject = Record<string, any>;
/**

@@ -118,3 +121,3 @@ * Object of data extracted from the document

tags?: null | null[];
tax?: null | number| BoundingElement;
tax?: null | number | BoundingElement;
tax_rate?: null | number;

@@ -225,3 +228,8 @@ total?: null | number | BoundingElement;

*/
public get_documents(): Promise<VeryfiDocument[]>;
public get_documents(
page?: number,
page_size?: number,
bounding_boxes?: boolean,
confidence_details?: boolean
): Promise<VeryfiDocument[]>;

@@ -258,3 +266,3 @@ /**

delete_after_processing?: boolean,
{ ...kwargs }?: VeryfiExtraArgs
{...kwargs}?: VeryfiExtraArgs
): Promise<VeryfiDocument>;

@@ -284,3 +292,3 @@

delete_after_processing?: boolean,
{ ...kwargs }?: VeryfiExtraArgs
{...kwargs}?: VeryfiExtraArgs
): Promise<VeryfiDocument>;

@@ -308,3 +316,3 @@

delete_after_processing?: boolean,
{ ...kwargs }?: VeryfiExtraArgs
{...kwargs}?: VeryfiExtraArgs
): Promise<VeryfiDocument>;

@@ -333,3 +341,3 @@

max_pages_to_process?: number,
{ ...kwargs }?: VeryfiExtraArgs
{...kwargs}?: VeryfiExtraArgs
): Promise<VeryfiDocument>;

@@ -359,3 +367,3 @@

document_id: string,
{ ...kwargs }?: VeryfiExtraArgs
{...kwargs}?: VeryfiExtraArgs
): Promise<VeryfiDocument>;

@@ -398,2 +406,122 @@

/**
* Process any document and extract all the fields from it
* @example
* veryfi_client.process_any_document('file/path','template_name')
*
* @memberof Client
* @param {String} file_path Path on disk to a file to submit for data extraction
* @param {String} template_name name of the extraction templates.
* @param {number} max_pages_to_process The number of pages to process for the document. The limit is 50 pages per document.
* @param {Object} kwargs Additional request parameters
* @returns {JSON} Data extracted from the document
*/
public process_any_document(
file_path: string,
template_name?: string,
max_pages_to_process?: number,
{...kwargs}?: VeryfiExtraArgs
): Promise<JsonObject>;
/**
* Process any document and extract all the fields from it
* @example
* veryfi_client.process_any_document_url('file_url','template_name')
*
* @memberof Client
* @param {String} file_url url file to submit for data extraction
* @param {String} template_name name of the extraction templates.
* @param {number} max_pages_to_process The number of pages to process for the document. The limit is 50 pages per document.
* @param {Object} kwargs Additional request parameters
* @returns {JSON} Data extracted from the document
*/
public process_any_document_url(
file_url: string,
template_name?: string,
max_pages_to_process?: number,
{...kwargs}?: VeryfiExtraArgs
): Promise<JsonObject>;
/**
* Get all any documents
* @memberof Client
* @param {number} page The page number. The response is capped to maximum of 50 results per page.
* @param {number} page_size The number of Documents per page.
* @returns {Promise<JsonObject>} Object of previously processed any documents
*/
public get_any_documents(page?: number, page_size?: number): Promise<JsonObject[]>;
/**
* Get a specific any document
* @memberof Client
* @param {number} document_id The unique identifier of the document.
* @returns {Promise<JsonObject>} Object of a previously processed blueprinted document.
*/
public get_any_document(document_id: number): Promise<JsonObject[]>;
/**
* Get a specific bank statement
* @memberof Client
* @param {number} document_id The unique identifier of the document.
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
* @returns {Promise<JsonObject>} Object of a previously processed blueprinted document.
*/
public get_bank_statement(document_id: number, bounding_boxes?: boolean,
confidence_details?: boolean): Promise<JsonObject[]>;
/**
* Get all bank statements
* @memberof Client
* @param {number} page The page number. The response is capped to maximum of 50 results per page.
* @param {number} page_size The number of Documents per page.
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
* @returns {Promise<JsonObject>} Object of previously processed any documents
*/
public get_bank_statements(
page?: number,
page_size?: number,
bounding_boxes?: boolean,
confidence_details?: boolean
): Promise<JsonObject[]>;
/**
* Process bank statement and extract all the fields from it
* @example
* veryfi_client.process_bank_statement('file/path')
*
* @memberof Client
* @param {String} file_path Path on disk to a file to submit for data extraction
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
* @param {Object} kwargs Additional request parameters
* @returns {JSON} Data extracted from the document
*/
public process_bank_statement(
file_path: string,
bounding_boxes?: boolean,
confidence_details?: boolean,
{...kwargs}?: VeryfiExtraArgs
): Promise<JsonObject>;
/**
* Process any document and extract all the fields from it
* @example
* veryfi_client.process_bank_statement_url('file_url')
*
* @memberof Client
* @param {String} file_url url file to submit for data extraction
* @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response.
* @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response.
* @param {Object} kwargs Additional request parameters
* @returns {JSON} Data extracted from the document
*/
public process_bank_statement_url(
file_url: string,
bounding_boxes?: boolean,
confidence_details?: boolean,
{...kwargs}?: VeryfiExtraArgs
): Promise<JsonObject>;
}

@@ -400,0 +528,0 @@

2

package.json
{
"name": "@veryfi/veryfi-sdk",
"version": "1.3.1",
"version": "1.3.2",
"description": "Node.js module for communicating with the Veryfi OCR API",

@@ -5,0 +5,0 @@ "main": "lib/main.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc