Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mindee

Package Overview
Dependencies
Maintainers
7
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mindee - npm Package Compare versions

Comparing version 4.12.0 to 4.13.0

src/input/localResponse.d.ts

11

CHANGELOG.md
# CHANGELOG
## v4.13.0 - 2024-05-28
### Changes
* :sparkles: add support for local response loading
* :sparkles: add support for HMAC validation for webhooks
* :sparkles: add support for US Mail V2
* :sparkles: add support for boolean fields
### Fixes
* :recycle: fixed Locale display
## v4.12.0 - 2024-05-16

@@ -4,0 +15,0 @@ ### Changes

2

package.json
{
"name": "mindee",
"version": "4.12.0",
"version": "4.13.0",
"description": "Mindee Client Library for Node.js",

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

@@ -5,3 +5,3 @@ /// <reference types="node" />

import { Readable } from "stream";
import { Base64Input, BytesInput, InputSource, PathInput, StreamInput, PageOptions, UrlInput, BufferInput } from "./input";
import { Base64Input, BytesInput, InputSource, PathInput, StreamInput, PageOptions, UrlInput, BufferInput, LocalResponse } from "./input";
import { Endpoint } from "./http";

@@ -115,2 +115,3 @@ import { AsyncPredictResponse, FeedbackResponse, Inference, PredictResponse, StringDict } from "./parsing/common";

parseQueued<T extends Inference>(productClass: new (httpResponse: StringDict) => T, queueId: string, params?: PredictOptions): Promise<AsyncPredictResponse<T>>;
loadPrediction<T extends Inference>(productClass: new (httpResponse: StringDict) => T, localResponse: LocalResponse): Promise<AsyncPredictResponse<T> | PredictResponse<T>>;
/**

@@ -117,0 +118,0 @@ * Fetch prediction results from a document already processed.

@@ -18,2 +18,3 @@ "use strict";

const promises_1 = require("node:timers/promises");
const errors_1 = require("./errors");
/**

@@ -107,2 +108,21 @@ * Mindee Client class that centralizes most basic operations.

}
async loadPrediction(productClass, localResponse) {
/**
* Load a prediction.
*
* @param productClass Product class to use for calling the API and parsing the response.
* @param localResponse Local response to load.
* @category Asynchronous
* @returns A valid prediction
*/
try {
if (Object.prototype.hasOwnProperty.call(localResponse.asDict(), "job")) {
return new common_1.AsyncPredictResponse(productClass, localResponse.asDict());
}
return new common_1.PredictResponse(productClass, localResponse.asDict());
}
catch (err) {
throw new errors_1.MindeeError("No prediction found in local response.");
}
}
/**

@@ -109,0 +129,0 @@ * Fetch prediction results from a document already processed.

export * as product from "./product";
export { Client, PredictOptions } from "./client";
export { AsyncPredictResponse, PredictResponse, Inference, Prediction, Document, Page, } from "./parsing/common";
export { InputSource, PageOptionsOperation } from "./input";
export { InputSource, PageOptionsOperation, LocalResponse } from "./input";
export * as internal from "./internal";
export * as imageOperations from "./imageOperations";

@@ -26,3 +26,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.imageOperations = exports.internal = exports.PageOptionsOperation = exports.InputSource = exports.Page = exports.Document = exports.Prediction = exports.Inference = exports.PredictResponse = exports.AsyncPredictResponse = exports.Client = exports.product = void 0;
exports.imageOperations = exports.internal = exports.LocalResponse = exports.PageOptionsOperation = exports.InputSource = exports.Page = exports.Document = exports.Prediction = exports.Inference = exports.PredictResponse = exports.AsyncPredictResponse = exports.Client = exports.product = void 0;
exports.product = __importStar(require("./product"));

@@ -41,3 +41,4 @@ var client_1 = require("./client");

Object.defineProperty(exports, "PageOptionsOperation", { enumerable: true, get: function () { return input_1.PageOptionsOperation; } });
Object.defineProperty(exports, "LocalResponse", { enumerable: true, get: function () { return input_1.LocalResponse; } });
exports.internal = __importStar(require("./internal"));
exports.imageOperations = __importStar(require("./imageOperations"));
export { PageOptions, PageOptionsOperation } from "./pageOptions";
export { Base64Input, BytesInput, PathInput, StreamInput, UrlInput, BufferInput, } from "./sources";
export { InputSource, INPUT_TYPE_BASE64, INPUT_TYPE_BYTES, INPUT_TYPE_PATH, INPUT_TYPE_STREAM, INPUT_TYPE_BUFFER, } from "./base";
export { LocalResponse } from "./localResponse";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.INPUT_TYPE_BUFFER = exports.INPUT_TYPE_STREAM = exports.INPUT_TYPE_PATH = exports.INPUT_TYPE_BYTES = exports.INPUT_TYPE_BASE64 = exports.InputSource = exports.BufferInput = exports.UrlInput = exports.StreamInput = exports.PathInput = exports.BytesInput = exports.Base64Input = exports.PageOptionsOperation = void 0;
exports.LocalResponse = exports.INPUT_TYPE_BUFFER = exports.INPUT_TYPE_STREAM = exports.INPUT_TYPE_PATH = exports.INPUT_TYPE_BYTES = exports.INPUT_TYPE_BASE64 = exports.InputSource = exports.BufferInput = exports.UrlInput = exports.StreamInput = exports.PathInput = exports.BytesInput = exports.Base64Input = exports.PageOptionsOperation = void 0;
var pageOptions_1 = require("./pageOptions");

@@ -20,1 +20,3 @@ Object.defineProperty(exports, "PageOptionsOperation", { enumerable: true, get: function () { return pageOptions_1.PageOptionsOperation; } });

Object.defineProperty(exports, "INPUT_TYPE_BUFFER", { enumerable: true, get: function () { return base_1.INPUT_TYPE_BUFFER; } });
var localResponse_1 = require("./localResponse");
Object.defineProperty(exports, "LocalResponse", { enumerable: true, get: function () { return localResponse_1.LocalResponse; } });

@@ -19,3 +19,3 @@ import { StringDict } from "../common";

/** The value. */
value?: string | number;
value?: string | number | boolean;
/** `true` when the field was reconstructed or computed using other fields. */

@@ -22,0 +22,0 @@ reconstructed: boolean;

export { ClassificationField } from "./classification";
export { Taxes, TaxField } from "./tax";
export { PaymentDetailsField } from "./paymentDetails";
export { BooleanField } from "./boolean";
export { LocaleField } from "./locale";

@@ -5,0 +6,0 @@ export { AmountField, floatToString } from "./amount";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Field = exports.StringField = exports.PositionField = exports.CompanyRegistrationField = exports.BaseField = exports.DateField = exports.floatToString = exports.AmountField = exports.LocaleField = exports.PaymentDetailsField = exports.TaxField = exports.Taxes = exports.ClassificationField = void 0;
exports.Field = exports.StringField = exports.PositionField = exports.CompanyRegistrationField = exports.BaseField = exports.DateField = exports.floatToString = exports.AmountField = exports.LocaleField = exports.BooleanField = exports.PaymentDetailsField = exports.TaxField = exports.Taxes = exports.ClassificationField = void 0;
var classification_1 = require("./classification");

@@ -11,2 +11,4 @@ Object.defineProperty(exports, "ClassificationField", { enumerable: true, get: function () { return classification_1.ClassificationField; } });

Object.defineProperty(exports, "PaymentDetailsField", { enumerable: true, get: function () { return paymentDetails_1.PaymentDetailsField; } });
var boolean_1 = require("./boolean");
Object.defineProperty(exports, "BooleanField", { enumerable: true, get: function () { return boolean_1.BooleanField; } });
var locale_1 = require("./locale");

@@ -13,0 +15,0 @@ Object.defineProperty(exports, "LocaleField", { enumerable: true, get: function () { return locale_1.LocaleField; } });

@@ -13,3 +13,3 @@ "use strict";

constructor({ prediction = {}, reconstructed = false, pageId = undefined, }) {
const valueKey = prediction["value"] !== undefined ? "value" : "language";
const valueKey = prediction["value"] ? "value" : "language";
super({ prediction, valueKey, reconstructed, pageId });

@@ -16,0 +16,0 @@ this.confidence = prediction["confidence"] ? prediction["confidence"] : 0.0;

export { BankCheckV1 } from "./bankCheck/bankCheckV1";
export { DriverLicenseV1 } from "./driverLicense/driverLicenseV1";
export { W9V1 } from "./w9/w9V1";
export { UsMailV2 } from "./usMail/usMailV2";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.W9V1 = exports.DriverLicenseV1 = exports.BankCheckV1 = void 0;
exports.UsMailV2 = exports.W9V1 = exports.DriverLicenseV1 = exports.BankCheckV1 = void 0;
var bankCheckV1_1 = require("./bankCheck/bankCheckV1");

@@ -10,1 +10,3 @@ Object.defineProperty(exports, "BankCheckV1", { enumerable: true, get: function () { return bankCheckV1_1.BankCheckV1; } });

Object.defineProperty(exports, "W9V1", { enumerable: true, get: function () { return w9V1_1.W9V1; } });
var usMailV2_1 = require("./usMail/usMailV2");
Object.defineProperty(exports, "UsMailV2", { enumerable: true, get: function () { return usMailV2_1.UsMailV2; } });
export * as bankCheck from "./bankCheck/internal";
export * as driverLicense from "./driverLicense/internal";
export * as usMail from "./usMail/internal";
export * as w9 from "./w9/internal";

@@ -26,4 +26,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.driverLicense = exports.bankCheck = void 0;
exports.w9 = exports.usMail = exports.driverLicense = exports.bankCheck = void 0;
exports.bankCheck = __importStar(require("./bankCheck/internal"));
exports.driverLicense = __importStar(require("./driverLicense/internal"));
exports.usMail = __importStar(require("./usMail/internal"));
exports.w9 = __importStar(require("./w9/internal"));
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