mindee 5.4.0 → 5.6.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.
- package/CHANGELOG.md +24 -2
- package/package.json +26 -14
- package/src/geometry/bbox.d.ts +5 -0
- package/src/geometry/bbox.js +1 -0
- package/src/geometry/minMax.d.ts +3 -0
- package/src/geometry/polygonUtils.d.ts +23 -0
- package/src/geometry/polygonUtils.js +23 -0
- package/src/http/apiCore.d.ts +1 -0
- package/src/http/apiCore.js +21 -3
- package/src/http/baseSettings.d.ts +5 -0
- package/src/http/baseSettings.js +2 -0
- package/src/image/extractedImage.d.ts +9 -5
- package/src/image/extractedImage.js +2 -2
- package/src/image/extractedImages.d.ts +1 -0
- package/src/image/extractedImages.js +1 -0
- package/src/image/imageCompressor.d.ts +1 -1
- package/src/image/imageExtractor.d.ts +7 -8
- package/src/image/imageExtractor.js +74 -75
- package/src/input/base64Input.d.ts +3 -0
- package/src/input/base64Input.js +3 -0
- package/src/input/bufferInput.d.ts +2 -0
- package/src/input/bufferInput.js +2 -0
- package/src/input/bytesInput.d.ts +3 -0
- package/src/input/bytesInput.js +3 -0
- package/src/input/inputSource.d.ts +15 -0
- package/src/input/inputSource.js +15 -0
- package/src/input/localInputSource.d.ts +6 -0
- package/src/input/localInputSource.js +3 -0
- package/src/input/pathInput.d.ts +4 -0
- package/src/input/pathInput.js +3 -0
- package/src/input/streamInput.d.ts +4 -0
- package/src/input/streamInput.js +4 -0
- package/src/input/urlInput.d.ts +12 -0
- package/src/input/urlInput.js +52 -10
- package/src/logger.js +1 -1
- package/src/parsing/dateParser.d.ts +4 -0
- package/src/parsing/dateParser.js +5 -1
- package/src/parsing/localResponseBase.d.ts +2 -0
- package/src/parsing/localResponseBase.js +2 -0
- package/src/parsing/stringDict.d.ts +1 -0
- package/src/pdf/extractedPdf.d.ts +8 -2
- package/src/pdf/extractedPdf.js +5 -3
- package/src/pdf/extractedPdfs.d.ts +1 -0
- package/src/pdf/extractedPdfs.js +1 -0
- package/src/pdf/pdfCompressor.js +12 -0
- package/src/pdf/pdfExtractor.d.ts +2 -2
- package/src/pdf/pdfExtractor.js +4 -1
- package/src/pdf/pdfOperation.d.ts +3 -0
- package/src/pdf/pdfOperation.js +3 -0
- package/src/pdf/pdfUtils.js +5 -0
- package/src/v1/cli.d.ts +3 -0
- package/src/v1/cli.js +84 -26
- package/src/v1/client.d.ts +16 -16
- package/src/v1/extraction/invoiceSplitterExtractor/extractedInvoiceSplitterImage.d.ts +5 -3
- package/src/v1/extraction/invoiceSplitterExtractor/extractedInvoiceSplitterImage.js +4 -4
- package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.js +14 -0
- package/src/v1/extraction/multiReceiptsExtractor/extractedMultiReceiptImage.d.ts +2 -0
- package/src/v1/extraction/multiReceiptsExtractor/extractedMultiReceiptImage.js +1 -1
- package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.js +3 -0
- package/src/v1/http/apiSettingsV1.d.ts +5 -0
- package/src/v1/http/apiSettingsV1.js +4 -0
- package/src/v1/http/errors.d.ts +7 -1
- package/src/v1/http/errors.js +65 -86
- package/src/v1/http/httpParams.d.ts +12 -0
- package/src/v1/parsing/common/asyncPredictResponse.d.ts +4 -0
- package/src/v1/parsing/common/asyncPredictResponse.js +5 -2
- package/src/v1/parsing/common/executionPriority.d.ts +4 -0
- package/src/v1/parsing/common/executionPriority.js +4 -0
- package/src/v1/parsing/common/extras/cropperExtra.d.ts +2 -0
- package/src/v1/parsing/common/extras/cropperExtra.js +3 -0
- package/src/v1/parsing/common/extras/extras.d.ts +3 -0
- package/src/v1/parsing/common/extras/extras.js +2 -0
- package/src/v1/parsing/common/extras/fullTextOcrExtra.d.ts +3 -0
- package/src/v1/parsing/common/extras/fullTextOcrExtra.js +1 -0
- package/src/v1/parsing/common/extras/ragExtra.d.ts +1 -0
- package/src/v1/parsing/common/extras/ragExtra.js +1 -0
- package/src/v1/parsing/common/feedback/feedbackResponse.js +1 -0
- package/src/v1/parsing/common/index.d.ts +1 -1
- package/src/v1/parsing/common/index.js +1 -1
- package/src/v1/parsing/common/inference.d.ts +2 -0
- package/src/v1/parsing/common/inference.js +2 -0
- package/src/v1/parsing/common/prediction.d.ts +1 -0
- package/src/v1/parsing/common/prediction.js +1 -0
- package/src/v1/parsing/common/summaryHelper.d.ts +12 -1
- package/src/v1/parsing/common/summaryHelper.js +18 -1
- package/src/v1/parsing/generated/generatedObject.d.ts +6 -0
- package/src/v1/parsing/generated/generatedObject.js +38 -27
- package/src/v1/parsing/localResponse.d.ts +1 -0
- package/src/v1/parsing/localResponse.js +1 -0
- package/src/v1/parsing/standard/base.d.ts +6 -0
- package/src/v1/parsing/standard/base.js +1 -0
- package/src/v1/parsing/standard/boolean.d.ts +1 -1
- package/src/v1/parsing/standard/companyRegistration.d.ts +1 -0
- package/src/v1/parsing/standard/companyRegistration.js +1 -0
- package/src/v1/parsing/standard/date.d.ts +1 -0
- package/src/v1/parsing/standard/date.js +1 -0
- package/src/v1/parsing/standard/paymentDetails.d.ts +5 -5
- package/src/v1/parsing/standard/position.d.ts +2 -2
- package/src/v1/parsing/standard/tax.d.ts +1 -0
- package/src/v1/parsing/standard/tax.js +1 -0
- package/src/v1/parsing/standard/text.d.ts +1 -1
- package/src/v1/parsing/standard/word.d.ts +3 -0
- package/src/v1/parsing/standard/word.js +1 -0
- package/src/v1/product/financialDocument/financialDocumentV1LineItem.js +16 -58
- package/src/v1/product/generated/generatedV1Prediction.d.ts +1 -0
- package/src/v1/product/generated/generatedV1Prediction.js +2 -1
- package/src/v1/product/invoice/invoiceV4LineItem.js +5 -16
- package/src/v1/product/receipt/receiptV5LineItem.js +2 -6
- package/src/v1/product/resume/resumeV1Certificate.js +5 -21
- package/src/v1/product/resume/resumeV1Education.js +8 -36
- package/src/v1/product/resume/resumeV1Language.js +3 -11
- package/src/v1/product/resume/resumeV1ProfessionalExperience.js +10 -46
- package/src/v1/product/resume/resumeV1SocialNetworksUrl.js +3 -11
- package/src/v2/cli.d.ts +3 -0
- package/src/v2/cli.js +21 -0
- package/src/v2/client.d.ts +10 -1
- package/src/v2/client.js +18 -8
- package/src/v2/clientOptions/baseParameters.d.ts +3 -2
- package/src/v2/clientOptions/pollingOptions.d.ts +6 -1
- package/src/v2/clientOptions/pollingOptions.js +4 -2
- package/src/v2/fileOperations/crop.js +1 -3
- package/src/v2/fileOperations/split.js +1 -1
- package/src/v2/http/mindeeApiV2.d.ts +23 -10
- package/src/v2/http/mindeeApiV2.js +79 -68
- package/src/v2/parsing/baseResponse.d.ts +2 -0
- package/src/v2/parsing/baseResponse.js +1 -0
- package/src/v2/parsing/error/errorDetails.d.ts +1 -0
- package/src/v2/parsing/index.d.ts +1 -1
- package/src/v2/parsing/index.js +1 -1
- package/src/v2/parsing/inference/baseInference.d.ts +2 -0
- package/src/v2/parsing/inference/baseInference.js +2 -0
- package/src/v2/parsing/inference/failedInferenceResponse.d.ts +33 -0
- package/src/v2/parsing/inference/failedInferenceResponse.js +17 -0
- package/src/v2/parsing/inference/field/baseField.d.ts +3 -0
- package/src/v2/parsing/inference/field/fieldConfidence.d.ts +4 -0
- package/src/v2/parsing/inference/field/fieldConfidence.js +4 -0
- package/src/v2/parsing/inference/field/fieldFactory.d.ts +5 -0
- package/src/v2/parsing/inference/field/fieldFactory.js +5 -0
- package/src/v2/parsing/inference/field/fieldLocation.d.ts +1 -0
- package/src/v2/parsing/inference/field/fieldLocation.js +1 -0
- package/src/v2/parsing/inference/field/inferenceFields.d.ts +5 -0
- package/src/v2/parsing/inference/field/inferenceFields.js +4 -0
- package/src/v2/parsing/inference/field/listField.d.ts +2 -0
- package/src/v2/parsing/inference/field/listField.js +2 -0
- package/src/v2/parsing/inference/field/objectField.d.ts +4 -0
- package/src/v2/parsing/inference/field/objectField.js +3 -0
- package/src/v2/parsing/inference/field/ragMetadata.d.ts +1 -0
- package/src/v2/parsing/inference/field/ragMetadata.js +1 -0
- package/src/v2/parsing/inference/field/rawText.d.ts +2 -0
- package/src/v2/parsing/inference/field/rawText.js +2 -0
- package/src/v2/parsing/inference/field/simpleField.d.ts +2 -0
- package/src/v2/parsing/inference/field/simpleField.js +2 -0
- package/src/v2/parsing/inference/inferenceFile.d.ts +2 -0
- package/src/v2/parsing/inference/inferenceFile.js +2 -0
- package/src/v2/parsing/inference/inferenceModel.d.ts +2 -0
- package/src/v2/parsing/inference/inferenceModel.js +2 -0
- package/src/v2/parsing/job/job.d.ts +1 -1
- package/src/v2/parsing/job/job.js +1 -3
- package/src/v2/parsing/job/jobResponse.d.ts +3 -0
- package/src/v2/parsing/job/jobResponse.js +3 -0
- package/src/v2/parsing/search/index.d.ts +4 -0
- package/src/v2/parsing/search/index.js +4 -0
- package/src/v2/parsing/search/modelWebhook.d.ts +19 -0
- package/src/v2/parsing/search/modelWebhook.js +10 -0
- package/src/v2/parsing/search/paginationMetadata.d.ts +24 -0
- package/src/v2/parsing/search/paginationMetadata.js +19 -0
- package/src/v2/parsing/search/searchModel.d.ts +25 -0
- package/src/v2/parsing/search/searchModel.js +19 -0
- package/src/v2/parsing/search/searchResponse.d.ts +19 -0
- package/src/v2/parsing/search/searchResponse.js +24 -0
- package/src/v2/product/classification/classification.d.ts +3 -0
- package/src/v2/product/classification/classification.js +3 -0
- package/src/v2/product/classification/classificationClassifier.d.ts +2 -0
- package/src/v2/product/classification/classificationClassifier.js +2 -0
- package/src/v2/product/classification/classificationInference.d.ts +2 -0
- package/src/v2/product/classification/classificationInference.js +2 -0
- package/src/v2/product/classification/classificationResponse.d.ts +1 -0
- package/src/v2/product/classification/classificationResponse.js +1 -0
- package/src/v2/product/classification/classificationResult.d.ts +2 -0
- package/src/v2/product/classification/classificationResult.js +2 -0
- package/src/v2/product/crop/crop.d.ts +3 -0
- package/src/v2/product/crop/crop.js +3 -0
- package/src/v2/product/crop/cropInference.d.ts +2 -0
- package/src/v2/product/crop/cropInference.js +2 -0
- package/src/v2/product/crop/cropItem.d.ts +2 -0
- package/src/v2/product/crop/cropItem.js +2 -0
- package/src/v2/product/crop/cropResponse.d.ts +1 -0
- package/src/v2/product/crop/cropResponse.js +1 -0
- package/src/v2/product/crop/cropResult.d.ts +2 -0
- package/src/v2/product/crop/cropResult.js +2 -0
- package/src/v2/product/extraction/dataSchemaActiveOption.d.ts +1 -0
- package/src/v2/product/extraction/dataSchemaActiveOption.js +1 -0
- package/src/v2/product/extraction/extraction.d.ts +3 -0
- package/src/v2/product/extraction/extraction.js +3 -0
- package/src/v2/product/extraction/extractionActiveOptions.d.ts +2 -0
- package/src/v2/product/extraction/extractionActiveOptions.js +2 -0
- package/src/v2/product/extraction/extractionInference.d.ts +2 -0
- package/src/v2/product/extraction/extractionInference.js +2 -0
- package/src/v2/product/extraction/extractionResponse.d.ts +1 -0
- package/src/v2/product/extraction/extractionResponse.js +1 -0
- package/src/v2/product/extraction/extractionResult.d.ts +2 -0
- package/src/v2/product/extraction/extractionResult.js +2 -0
- package/src/v2/product/extraction/params/dataSchema.d.ts +9 -6
- package/src/v2/product/extraction/params/dataSchema.js +2 -0
- package/src/v2/product/extraction/params/dataSchemaField.d.ts +25 -1
- package/src/v2/product/extraction/params/dataSchemaField.js +3 -0
- package/src/v2/product/extraction/params/dataSchemaReplace.d.ts +9 -4
- package/src/v2/product/extraction/params/dataSchemaReplace.js +2 -0
- package/src/v2/product/ocr/ocr.d.ts +3 -0
- package/src/v2/product/ocr/ocr.js +3 -0
- package/src/v2/product/ocr/ocrInference.d.ts +2 -0
- package/src/v2/product/ocr/ocrInference.js +2 -0
- package/src/v2/product/ocr/ocrPage.d.ts +2 -0
- package/src/v2/product/ocr/ocrPage.js +2 -0
- package/src/v2/product/ocr/ocrResponse.d.ts +1 -0
- package/src/v2/product/ocr/ocrResponse.js +1 -0
- package/src/v2/product/ocr/ocrResult.d.ts +1 -0
- package/src/v2/product/ocr/ocrResult.js +1 -0
- package/src/v2/product/ocr/ocrWord.d.ts +2 -0
- package/src/v2/product/ocr/ocrWord.js +2 -0
- package/src/v2/product/split/split.d.ts +3 -0
- package/src/v2/product/split/split.js +3 -0
- package/src/v2/product/split/splitInference.d.ts +2 -0
- package/src/v2/product/split/splitInference.js +2 -0
- package/src/v2/product/split/splitRange.d.ts +1 -0
- package/src/v2/product/split/splitRange.js +1 -0
- package/src/v2/product/split/splitResponse.d.ts +1 -0
- package/src/v2/product/split/splitResponse.js +1 -0
- package/src/v2/product/split/splitResult.d.ts +1 -0
- package/src/v2/product/split/splitResult.js +1 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { cleanOutString } from "../../../v1/parsing/common/index.js";
|
|
2
2
|
import { GeneratedListField, GeneratedObjectField } from "../../../v1/parsing/generated/index.js";
|
|
3
3
|
import { StringField } from "../../../v1/parsing/standard/index.js";
|
|
4
|
+
/** Dynamic prediction container for generated v1 products. */
|
|
4
5
|
export class GeneratedV1Prediction {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.fields = new Map();
|
|
7
8
|
}
|
|
8
9
|
toString() {
|
|
9
10
|
let outStr = "";
|
|
10
|
-
const pattern = /^(\n*
|
|
11
|
+
const pattern = /^(\n* *)( {2}):/;
|
|
11
12
|
this.fields.forEach((fieldValue, fieldName) => {
|
|
12
13
|
let strValue = "";
|
|
13
14
|
if (fieldValue instanceof GeneratedListField &&
|
|
@@ -4,12 +4,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _InvoiceV4LineItem_instances, _InvoiceV4LineItem_printableValues;
|
|
7
|
-
import {
|
|
7
|
+
import { cleanAndTruncate, floatToString } from "../../../v1/parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* List of all the line items present on the invoice.
|
|
11
11
|
*/
|
|
12
12
|
export class InvoiceV4LineItem {
|
|
13
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
13
14
|
constructor({ prediction = {} }) {
|
|
14
15
|
_InvoiceV4LineItem_instances.add(this);
|
|
15
16
|
/** Confidence score */
|
|
@@ -116,25 +117,13 @@ export class InvoiceV4LineItem {
|
|
|
116
117
|
}
|
|
117
118
|
_InvoiceV4LineItem_instances = new WeakSet(), _InvoiceV4LineItem_printableValues = function _InvoiceV4LineItem_printableValues() {
|
|
118
119
|
return {
|
|
119
|
-
description: this.description
|
|
120
|
-
|
|
121
|
-
cleanSpecialChars(this.description) :
|
|
122
|
-
cleanSpecialChars(this.description).slice(0, 33) + "..." :
|
|
123
|
-
"",
|
|
124
|
-
productCode: this.productCode ?
|
|
125
|
-
this.productCode.length <= 12 ?
|
|
126
|
-
cleanSpecialChars(this.productCode) :
|
|
127
|
-
cleanSpecialChars(this.productCode).slice(0, 9) + "..." :
|
|
128
|
-
"",
|
|
120
|
+
description: cleanAndTruncate(this.description, 36),
|
|
121
|
+
productCode: cleanAndTruncate(this.productCode, 12),
|
|
129
122
|
quantity: this.quantity !== undefined ? floatToString(this.quantity) : "",
|
|
130
123
|
taxAmount: this.taxAmount !== undefined ? floatToString(this.taxAmount) : "",
|
|
131
124
|
taxRate: this.taxRate !== undefined ? floatToString(this.taxRate) : "",
|
|
132
125
|
totalAmount: this.totalAmount !== undefined ? floatToString(this.totalAmount) : "",
|
|
133
|
-
unitMeasure: this.unitMeasure
|
|
134
|
-
this.unitMeasure.length <= 15 ?
|
|
135
|
-
cleanSpecialChars(this.unitMeasure) :
|
|
136
|
-
cleanSpecialChars(this.unitMeasure).slice(0, 12) + "..." :
|
|
137
|
-
"",
|
|
126
|
+
unitMeasure: cleanAndTruncate(this.unitMeasure, 15),
|
|
138
127
|
unitPrice: this.unitPrice !== undefined ? floatToString(this.unitPrice) : "",
|
|
139
128
|
};
|
|
140
129
|
};
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ReceiptV5LineItem_instances, _ReceiptV5LineItem_printableValues;
|
|
7
|
-
import {
|
|
7
|
+
import { cleanAndTruncate, floatToString } from "../../../v1/parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* List of all line items on the receipt.
|
|
@@ -82,11 +82,7 @@ export class ReceiptV5LineItem {
|
|
|
82
82
|
}
|
|
83
83
|
_ReceiptV5LineItem_instances = new WeakSet(), _ReceiptV5LineItem_printableValues = function _ReceiptV5LineItem_printableValues() {
|
|
84
84
|
return {
|
|
85
|
-
description: this.description
|
|
86
|
-
this.description.length <= 36 ?
|
|
87
|
-
cleanSpecialChars(this.description) :
|
|
88
|
-
cleanSpecialChars(this.description).slice(0, 33) + "..." :
|
|
89
|
-
"",
|
|
85
|
+
description: cleanAndTruncate(this.description, 36),
|
|
90
86
|
quantity: this.quantity !== undefined ? floatToString(this.quantity) : "",
|
|
91
87
|
totalAmount: this.totalAmount !== undefined ? floatToString(this.totalAmount) : "",
|
|
92
88
|
unitPrice: this.unitPrice !== undefined ? floatToString(this.unitPrice) : "",
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ResumeV1Certificate_instances, _ResumeV1Certificate_printableValues;
|
|
7
|
-
import {
|
|
7
|
+
import { cleanAndTruncate } from "../../../v1/parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* The list of certificates obtained by the candidate.
|
|
@@ -61,25 +61,9 @@ export class ResumeV1Certificate {
|
|
|
61
61
|
}
|
|
62
62
|
_ResumeV1Certificate_instances = new WeakSet(), _ResumeV1Certificate_printableValues = function _ResumeV1Certificate_printableValues() {
|
|
63
63
|
return {
|
|
64
|
-
grade: this.grade
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"",
|
|
69
|
-
name: this.name ?
|
|
70
|
-
this.name.length <= 30 ?
|
|
71
|
-
cleanSpecialChars(this.name) :
|
|
72
|
-
cleanSpecialChars(this.name).slice(0, 27) + "..." :
|
|
73
|
-
"",
|
|
74
|
-
provider: this.provider ?
|
|
75
|
-
this.provider.length <= 25 ?
|
|
76
|
-
cleanSpecialChars(this.provider) :
|
|
77
|
-
cleanSpecialChars(this.provider).slice(0, 22) + "..." :
|
|
78
|
-
"",
|
|
79
|
-
year: this.year ?
|
|
80
|
-
this.year.length <= 4 ?
|
|
81
|
-
cleanSpecialChars(this.year) :
|
|
82
|
-
cleanSpecialChars(this.year).slice(0, 1) + "..." :
|
|
83
|
-
"",
|
|
64
|
+
grade: cleanAndTruncate(this.grade, 10),
|
|
65
|
+
name: cleanAndTruncate(this.name, 30),
|
|
66
|
+
provider: cleanAndTruncate(this.provider, 25),
|
|
67
|
+
year: cleanAndTruncate(this.year, 4),
|
|
84
68
|
};
|
|
85
69
|
};
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ResumeV1Education_instances, _ResumeV1Education_printableValues;
|
|
7
|
-
import {
|
|
7
|
+
import { cleanAndTruncate } from "../../../v1/parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* The list of the candidate's educational background.
|
|
@@ -76,40 +76,12 @@ export class ResumeV1Education {
|
|
|
76
76
|
}
|
|
77
77
|
_ResumeV1Education_instances = new WeakSet(), _ResumeV1Education_printableValues = function _ResumeV1Education_printableValues() {
|
|
78
78
|
return {
|
|
79
|
-
degreeDomain: this.degreeDomain
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
cleanSpecialChars(this.degreeType) :
|
|
87
|
-
cleanSpecialChars(this.degreeType).slice(0, 22) + "..." :
|
|
88
|
-
"",
|
|
89
|
-
endMonth: this.endMonth ?
|
|
90
|
-
this.endMonth.length <= 9 ?
|
|
91
|
-
cleanSpecialChars(this.endMonth) :
|
|
92
|
-
cleanSpecialChars(this.endMonth).slice(0, 6) + "..." :
|
|
93
|
-
"",
|
|
94
|
-
endYear: this.endYear ?
|
|
95
|
-
this.endYear.length <= 8 ?
|
|
96
|
-
cleanSpecialChars(this.endYear) :
|
|
97
|
-
cleanSpecialChars(this.endYear).slice(0, 5) + "..." :
|
|
98
|
-
"",
|
|
99
|
-
school: this.school ?
|
|
100
|
-
this.school.length <= 25 ?
|
|
101
|
-
cleanSpecialChars(this.school) :
|
|
102
|
-
cleanSpecialChars(this.school).slice(0, 22) + "..." :
|
|
103
|
-
"",
|
|
104
|
-
startMonth: this.startMonth ?
|
|
105
|
-
this.startMonth.length <= 11 ?
|
|
106
|
-
cleanSpecialChars(this.startMonth) :
|
|
107
|
-
cleanSpecialChars(this.startMonth).slice(0, 8) + "..." :
|
|
108
|
-
"",
|
|
109
|
-
startYear: this.startYear ?
|
|
110
|
-
this.startYear.length <= 10 ?
|
|
111
|
-
cleanSpecialChars(this.startYear) :
|
|
112
|
-
cleanSpecialChars(this.startYear).slice(0, 7) + "..." :
|
|
113
|
-
"",
|
|
79
|
+
degreeDomain: cleanAndTruncate(this.degreeDomain, 15),
|
|
80
|
+
degreeType: cleanAndTruncate(this.degreeType, 25),
|
|
81
|
+
endMonth: cleanAndTruncate(this.endMonth, 9),
|
|
82
|
+
endYear: cleanAndTruncate(this.endYear, 8),
|
|
83
|
+
school: cleanAndTruncate(this.school, 25),
|
|
84
|
+
startMonth: cleanAndTruncate(this.startMonth, 11),
|
|
85
|
+
startYear: cleanAndTruncate(this.startYear, 10),
|
|
114
86
|
};
|
|
115
87
|
};
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ResumeV1Language_instances, _ResumeV1Language_printableValues;
|
|
7
|
-
import {
|
|
7
|
+
import { cleanAndTruncate } from "../../../v1/parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* The list of languages that the candidate is proficient in.
|
|
@@ -51,15 +51,7 @@ export class ResumeV1Language {
|
|
|
51
51
|
}
|
|
52
52
|
_ResumeV1Language_instances = new WeakSet(), _ResumeV1Language_printableValues = function _ResumeV1Language_printableValues() {
|
|
53
53
|
return {
|
|
54
|
-
language: this.language
|
|
55
|
-
|
|
56
|
-
cleanSpecialChars(this.language) :
|
|
57
|
-
cleanSpecialChars(this.language).slice(0, 5) + "..." :
|
|
58
|
-
"",
|
|
59
|
-
level: this.level ?
|
|
60
|
-
this.level.length <= 20 ?
|
|
61
|
-
cleanSpecialChars(this.level) :
|
|
62
|
-
cleanSpecialChars(this.level).slice(0, 17) + "..." :
|
|
63
|
-
"",
|
|
54
|
+
language: cleanAndTruncate(this.language, 8),
|
|
55
|
+
level: cleanAndTruncate(this.level, 20),
|
|
64
56
|
};
|
|
65
57
|
};
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ResumeV1ProfessionalExperience_instances, _ResumeV1ProfessionalExperience_printableValues;
|
|
7
|
-
import {
|
|
7
|
+
import { cleanAndTruncate } from "../../../v1/parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* The list of the candidate's professional experiences.
|
|
@@ -86,50 +86,14 @@ export class ResumeV1ProfessionalExperience {
|
|
|
86
86
|
}
|
|
87
87
|
_ResumeV1ProfessionalExperience_instances = new WeakSet(), _ResumeV1ProfessionalExperience_printableValues = function _ResumeV1ProfessionalExperience_printableValues() {
|
|
88
88
|
return {
|
|
89
|
-
contractType: this.contractType
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"",
|
|
99
|
-
description: this.description ?
|
|
100
|
-
this.description.length <= 36 ?
|
|
101
|
-
cleanSpecialChars(this.description) :
|
|
102
|
-
cleanSpecialChars(this.description).slice(0, 33) + "..." :
|
|
103
|
-
"",
|
|
104
|
-
employer: this.employer ?
|
|
105
|
-
this.employer.length <= 25 ?
|
|
106
|
-
cleanSpecialChars(this.employer) :
|
|
107
|
-
cleanSpecialChars(this.employer).slice(0, 22) + "..." :
|
|
108
|
-
"",
|
|
109
|
-
endMonth: this.endMonth ?
|
|
110
|
-
this.endMonth.length <= 9 ?
|
|
111
|
-
cleanSpecialChars(this.endMonth) :
|
|
112
|
-
cleanSpecialChars(this.endMonth).slice(0, 6) + "..." :
|
|
113
|
-
"",
|
|
114
|
-
endYear: this.endYear ?
|
|
115
|
-
this.endYear.length <= 8 ?
|
|
116
|
-
cleanSpecialChars(this.endYear) :
|
|
117
|
-
cleanSpecialChars(this.endYear).slice(0, 5) + "..." :
|
|
118
|
-
"",
|
|
119
|
-
role: this.role ?
|
|
120
|
-
this.role.length <= 20 ?
|
|
121
|
-
cleanSpecialChars(this.role) :
|
|
122
|
-
cleanSpecialChars(this.role).slice(0, 17) + "..." :
|
|
123
|
-
"",
|
|
124
|
-
startMonth: this.startMonth ?
|
|
125
|
-
this.startMonth.length <= 11 ?
|
|
126
|
-
cleanSpecialChars(this.startMonth) :
|
|
127
|
-
cleanSpecialChars(this.startMonth).slice(0, 8) + "..." :
|
|
128
|
-
"",
|
|
129
|
-
startYear: this.startYear ?
|
|
130
|
-
this.startYear.length <= 10 ?
|
|
131
|
-
cleanSpecialChars(this.startYear) :
|
|
132
|
-
cleanSpecialChars(this.startYear).slice(0, 7) + "..." :
|
|
133
|
-
"",
|
|
89
|
+
contractType: cleanAndTruncate(this.contractType, 15),
|
|
90
|
+
department: cleanAndTruncate(this.department, 10),
|
|
91
|
+
description: cleanAndTruncate(this.description, 36),
|
|
92
|
+
employer: cleanAndTruncate(this.employer, 25),
|
|
93
|
+
endMonth: cleanAndTruncate(this.endMonth, 9),
|
|
94
|
+
endYear: cleanAndTruncate(this.endYear, 8),
|
|
95
|
+
role: cleanAndTruncate(this.role, 20),
|
|
96
|
+
startMonth: cleanAndTruncate(this.startMonth, 11),
|
|
97
|
+
startYear: cleanAndTruncate(this.startYear, 10),
|
|
134
98
|
};
|
|
135
99
|
};
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ResumeV1SocialNetworksUrl_instances, _ResumeV1SocialNetworksUrl_printableValues;
|
|
7
|
-
import {
|
|
7
|
+
import { cleanAndTruncate } from "../../../v1/parsing/common/index.js";
|
|
8
8
|
import { Polygon } from "../../../geometry/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* The list of social network profiles of the candidate.
|
|
@@ -51,15 +51,7 @@ export class ResumeV1SocialNetworksUrl {
|
|
|
51
51
|
}
|
|
52
52
|
_ResumeV1SocialNetworksUrl_instances = new WeakSet(), _ResumeV1SocialNetworksUrl_printableValues = function _ResumeV1SocialNetworksUrl_printableValues() {
|
|
53
53
|
return {
|
|
54
|
-
name: this.name
|
|
55
|
-
|
|
56
|
-
cleanSpecialChars(this.name) :
|
|
57
|
-
cleanSpecialChars(this.name).slice(0, 17) + "..." :
|
|
58
|
-
"",
|
|
59
|
-
url: this.url ?
|
|
60
|
-
this.url.length <= 50 ?
|
|
61
|
-
cleanSpecialChars(this.url) :
|
|
62
|
-
cleanSpecialChars(this.url).slice(0, 47) + "..." :
|
|
63
|
-
"",
|
|
54
|
+
name: cleanAndTruncate(this.name, 20),
|
|
55
|
+
url: cleanAndTruncate(this.url, 50),
|
|
64
56
|
};
|
|
65
57
|
};
|
package/src/v2/cli.d.ts
CHANGED
package/src/v2/cli.js
CHANGED
|
@@ -6,12 +6,22 @@ const program = new Command();
|
|
|
6
6
|
//
|
|
7
7
|
// EXECUTE THE COMMANDS
|
|
8
8
|
//
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the client.
|
|
11
|
+
* @param options Options.
|
|
12
|
+
*/
|
|
9
13
|
function initClient(options) {
|
|
10
14
|
return new Client({
|
|
11
15
|
apiKey: options.apiKey,
|
|
12
16
|
debug: options.debug,
|
|
13
17
|
});
|
|
14
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Enqueue and get inference.
|
|
21
|
+
* @param product Product.
|
|
22
|
+
* @param inputPath Input path.
|
|
23
|
+
* @param options Options.
|
|
24
|
+
*/
|
|
15
25
|
async function enqueueAndGetInference(product, inputPath, options) {
|
|
16
26
|
const mindeeClient = initClient(options);
|
|
17
27
|
let inputSource;
|
|
@@ -31,6 +41,10 @@ async function enqueueAndGetInference(product, inputPath, options) {
|
|
|
31
41
|
}
|
|
32
42
|
printResponse(response.inference);
|
|
33
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Print response.
|
|
46
|
+
* @param document Document.
|
|
47
|
+
*/
|
|
34
48
|
function printResponse(document) {
|
|
35
49
|
if (document) {
|
|
36
50
|
console.log(`\n${document}`);
|
|
@@ -39,10 +53,17 @@ function printResponse(document) {
|
|
|
39
53
|
//
|
|
40
54
|
// BUILD THE COMMANDS
|
|
41
55
|
//
|
|
56
|
+
/**
|
|
57
|
+
* Add main options.
|
|
58
|
+
* @param prog Program.
|
|
59
|
+
*/
|
|
42
60
|
function addMainOptions(prog) {
|
|
43
61
|
prog.requiredOption("-m, --model <model_id>", "Model ID (required)");
|
|
44
62
|
prog.argument("<input_path>", "full path or URL to the file");
|
|
45
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Build the CLI.
|
|
66
|
+
*/
|
|
46
67
|
export function cli() {
|
|
47
68
|
program.name("mindee")
|
|
48
69
|
.description("Command line interface for Mindee V2 products.")
|
package/src/v2/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Dispatcher } from "undici";
|
|
2
2
|
import { InputSource } from "../input/index.js";
|
|
3
3
|
import { JobResponse } from "./parsing/index.js";
|
|
4
|
+
import { SearchResponse } from "./parsing/search/index.js";
|
|
4
5
|
import { MindeeApiV2 } from "./http/mindeeApiV2.js";
|
|
5
6
|
import { PollingOptions, PollingOptionsConstructor } from "./clientOptions/index.js";
|
|
6
7
|
import { BaseProduct } from "../v2/product/baseProduct.js";
|
|
@@ -31,6 +32,14 @@ export declare class Client {
|
|
|
31
32
|
* @param {ClientOptions} options options for the initialization of a client.
|
|
32
33
|
*/
|
|
33
34
|
constructor({ apiKey, debug, dispatcher }?: ClientOptions);
|
|
35
|
+
/**
|
|
36
|
+
* Search for models available to the account.
|
|
37
|
+
* @param name Optional name filter.
|
|
38
|
+
* @param modelType Optional model type filter.
|
|
39
|
+
* @returns a `Promise` containing the search response.
|
|
40
|
+
*/
|
|
41
|
+
searchModels(name?: string, modelType?: string): Promise<SearchResponse>;
|
|
42
|
+
/** Enqueues a product inference job without waiting for completion. */
|
|
34
43
|
enqueue<P extends typeof BaseProduct>(product: P, inputSource: InputSource, params: InstanceType<P["parametersClass"]> | ConstructorParameters<P["parametersClass"]>[0]): Promise<JobResponse>;
|
|
35
44
|
/**
|
|
36
45
|
* Retrieves the result of a previously enqueued request.
|
|
@@ -79,5 +88,5 @@ export declare class Client {
|
|
|
79
88
|
* until the maximum number of tries is reached.
|
|
80
89
|
* @protected
|
|
81
90
|
*/
|
|
82
|
-
protected pollForResult<P extends typeof BaseProduct>(product: typeof BaseProduct, pollingOptions: PollingOptions,
|
|
91
|
+
protected pollForResult<P extends typeof BaseProduct>(product: typeof BaseProduct, pollingOptions: PollingOptions, jobResponse: JobResponse): Promise<InstanceType<P["responseClass"]>>;
|
|
83
92
|
}
|
package/src/v2/client.js
CHANGED
|
@@ -25,6 +25,16 @@ export class Client {
|
|
|
25
25
|
: LOG_LEVELS["warn"];
|
|
26
26
|
logger.debug("Client V2 Initialized");
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Search for models available to the account.
|
|
30
|
+
* @param name Optional name filter.
|
|
31
|
+
* @param modelType Optional model type filter.
|
|
32
|
+
* @returns a `Promise` containing the search response.
|
|
33
|
+
*/
|
|
34
|
+
async searchModels(name, modelType) {
|
|
35
|
+
return await this.mindeeApi.reqGetSearchModel(name, modelType);
|
|
36
|
+
}
|
|
37
|
+
/** Enqueues a product inference job without waiting for completion. */
|
|
28
38
|
async enqueue(product, inputSource, params) {
|
|
29
39
|
if (inputSource === undefined) {
|
|
30
40
|
throw new MindeeError("An input document is required.");
|
|
@@ -33,7 +43,7 @@ export class Client {
|
|
|
33
43
|
? params
|
|
34
44
|
: new product.parametersClass(params);
|
|
35
45
|
await inputSource.init();
|
|
36
|
-
const jobResponse = await this.mindeeApi.
|
|
46
|
+
const jobResponse = await this.mindeeApi.reqPostProductEnqueue(product, inputSource, paramsInstance);
|
|
37
47
|
if (jobResponse.job.id === undefined || jobResponse.job.id.length === 0) {
|
|
38
48
|
logger.error(`Failed enqueueing:\n${jobResponse.getRawHttp()}`);
|
|
39
49
|
throw new MindeeError("Enqueueing of the document failed.");
|
|
@@ -51,7 +61,7 @@ export class Client {
|
|
|
51
61
|
*/
|
|
52
62
|
async getResult(product, inferenceId) {
|
|
53
63
|
logger.debug(`Attempting to get inference with ID: ${inferenceId} using response type: ${product.name}`);
|
|
54
|
-
return await this.mindeeApi.
|
|
64
|
+
return await this.mindeeApi.reqGetProductResultById(product, inferenceId);
|
|
55
65
|
}
|
|
56
66
|
/**
|
|
57
67
|
* Retrieves the result of a previously enqueued request.
|
|
@@ -64,7 +74,7 @@ export class Client {
|
|
|
64
74
|
*/
|
|
65
75
|
async getResultByUrl(product, url) {
|
|
66
76
|
logger.debug(`Attempting to get inference from: ${url} using response type: ${product.name}`);
|
|
67
|
-
return await this.mindeeApi.
|
|
77
|
+
return await this.mindeeApi.reqGetProductResultByUrl(product, url);
|
|
68
78
|
}
|
|
69
79
|
/**
|
|
70
80
|
* Get the processing status of a previously enqueued request.
|
|
@@ -76,7 +86,7 @@ export class Client {
|
|
|
76
86
|
* parsing is complete.
|
|
77
87
|
*/
|
|
78
88
|
async getJob(jobId) {
|
|
79
|
-
return await this.mindeeApi.
|
|
89
|
+
return await this.mindeeApi.reqGetJobById(jobId);
|
|
80
90
|
}
|
|
81
91
|
/**
|
|
82
92
|
* Enqueue a request and poll the server until the result is sent or
|
|
@@ -94,22 +104,22 @@ export class Client {
|
|
|
94
104
|
const paramsInstance = new product.parametersClass(params);
|
|
95
105
|
const pollingOptionsInstance = new PollingOptions(pollingOptions);
|
|
96
106
|
const jobResponse = await this.enqueue(product, inputSource, paramsInstance);
|
|
97
|
-
return await this.pollForResult(product, pollingOptionsInstance, jobResponse
|
|
107
|
+
return await this.pollForResult(product, pollingOptionsInstance, jobResponse);
|
|
98
108
|
}
|
|
99
109
|
/**
|
|
100
110
|
* Send a document to an endpoint and poll the server until the result is sent or
|
|
101
111
|
* until the maximum number of tries is reached.
|
|
102
112
|
* @protected
|
|
103
113
|
*/
|
|
104
|
-
async pollForResult(product, pollingOptions,
|
|
114
|
+
async pollForResult(product, pollingOptions, jobResponse) {
|
|
105
115
|
logger.debug(`Waiting ${pollingOptions.initialDelaySec} seconds before polling.`);
|
|
106
116
|
await setTimeout(pollingOptions.initialDelaySec * 1000, undefined, pollingOptions.initialTimerOptions);
|
|
107
|
-
logger.debug(`Start polling for inference using job ID: ${
|
|
117
|
+
logger.debug(`Start polling for inference using job ID: ${jobResponse.job.id}.`);
|
|
108
118
|
let retryCounter = 1;
|
|
109
119
|
let pollResults;
|
|
110
120
|
while (retryCounter < pollingOptions.maxRetries + 1) {
|
|
111
121
|
logger.debug(`Attempt ${retryCounter} of ${pollingOptions.maxRetries}`);
|
|
112
|
-
pollResults = await this.
|
|
122
|
+
pollResults = await this.mindeeApi.reqGetJobByUrl(jobResponse.job.pollingUrl);
|
|
113
123
|
const error = pollResults.job.error;
|
|
114
124
|
if (error) {
|
|
115
125
|
throw new MindeeHttpErrorV2(error);
|
|
@@ -28,8 +28,9 @@ export declare abstract class BaseParameters {
|
|
|
28
28
|
*/
|
|
29
29
|
modelId: string;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Optional: a free-form string to tag the request with your own identifier.
|
|
32
|
+
* For example, an internal document ID, reference number, or database key.
|
|
33
|
+
* If set, it will be included in the job and result responses.
|
|
33
34
|
*/
|
|
34
35
|
alias?: string;
|
|
35
36
|
/**
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
/** Optional timer settings used by polling delays. */
|
|
1
2
|
export interface TimerOptions {
|
|
3
|
+
/** Whether the timer should keep the event loop active. */
|
|
2
4
|
ref?: boolean;
|
|
5
|
+
/** Optional signal used to abort timer waits. */
|
|
3
6
|
signal?: AbortSignal;
|
|
4
7
|
}
|
|
5
8
|
export interface PollingOptionsConstructor {
|
|
@@ -51,6 +54,8 @@ export declare class PollingOptions {
|
|
|
51
54
|
/** Options passed to every recurring `setTimeout()`. */
|
|
52
55
|
recurringTimerOptions?: TimerOptions;
|
|
53
56
|
constructor(params?: PollingOptionsConstructor);
|
|
54
|
-
|
|
57
|
+
/** Validates polling options against minimum accepted values. */
|
|
58
|
+
validateSettings(): void;
|
|
59
|
+
/** Returns a compact string representation of the polling options. */
|
|
55
60
|
toString(): string;
|
|
56
61
|
}
|
|
@@ -62,10 +62,11 @@ export class PollingOptions {
|
|
|
62
62
|
if (params.recurringTimerOptions) {
|
|
63
63
|
this.recurringTimerOptions = params.recurringTimerOptions;
|
|
64
64
|
}
|
|
65
|
-
this.
|
|
65
|
+
this.validateSettings();
|
|
66
66
|
logger.debug(`Polling options initialized: ${this.toString()}`);
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
/** Validates polling options against minimum accepted values. */
|
|
69
|
+
validateSettings() {
|
|
69
70
|
if (this.delaySec < minDelaySec) {
|
|
70
71
|
throw new MindeeConfigurationError(`Cannot set auto-parsing delay to less than ${minDelaySec} second(s).`);
|
|
71
72
|
}
|
|
@@ -76,6 +77,7 @@ export class PollingOptions {
|
|
|
76
77
|
throw new MindeeConfigurationError(`Cannot set retry to less than ${minRetries}.`);
|
|
77
78
|
}
|
|
78
79
|
}
|
|
80
|
+
/** Returns a compact string representation of the polling options. */
|
|
79
81
|
toString() {
|
|
80
82
|
return `{ initialDelaySec: ${this.initialDelaySec}, delaySec: ${this.delaySec}, maxRetries: ${this.maxRetries} }`;
|
|
81
83
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MindeeError } from "../../errors/index.js";
|
|
2
2
|
import { extractImagesFromPolygon } from "../../image/imageExtractor.js";
|
|
3
|
-
import { ExtractedImages } from "../../image/index.js";
|
|
4
3
|
import { logger } from "../../logger.js";
|
|
5
4
|
/**
|
|
6
5
|
* Extracts a single specified crop from a given input source.
|
|
@@ -32,6 +31,5 @@ export async function extractMultipleCrops(inputSource, crops, quality) {
|
|
|
32
31
|
}
|
|
33
32
|
polygonsByPage.get(pageId).push(crop.location.polygon);
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
return new ExtractedImages(...extractedCrops);
|
|
34
|
+
return await extractImagesFromPolygon(inputSource, polygonsByPage, quality);
|
|
37
35
|
}
|
|
@@ -32,7 +32,7 @@ export async function extractMultipleSplits(inputSource, splits) {
|
|
|
32
32
|
}
|
|
33
33
|
const pageCount = await pdfExtractor.getPageCount();
|
|
34
34
|
if (splits.length === 1 && splits[0].at(-1) === pageCount - 1) {
|
|
35
|
-
return new ExtractedPdfs(new ExtractedPdf(inputSource.fileObject, inputSource.filename,
|
|
35
|
+
return new ExtractedPdfs(new ExtractedPdf(inputSource.fileObject, inputSource.filename, splits[0]));
|
|
36
36
|
}
|
|
37
37
|
const subDocuments = await pdfExtractor.extractSubDocuments(pageGroups);
|
|
38
38
|
return new ExtractedPdfs(...subDocuments);
|
|
@@ -4,6 +4,7 @@ import { BaseParameters } from "../../v2/index.js";
|
|
|
4
4
|
import { JobResponse } from "../../v2/parsing/index.js";
|
|
5
5
|
import { InputSource } from "../../input/index.js";
|
|
6
6
|
import { BaseProduct } from "../../v2/product/baseProduct.js";
|
|
7
|
+
import { SearchResponse } from "../../v2/parsing/search/index.js";
|
|
7
8
|
/**
|
|
8
9
|
* Mindee V2 API handler.
|
|
9
10
|
*/
|
|
@@ -12,21 +13,33 @@ export declare class MindeeApiV2 {
|
|
|
12
13
|
settings: ApiSettings;
|
|
13
14
|
constructor(dispatcher?: Dispatcher, apiKey?: string);
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
16
|
+
* Search for models available to the account.
|
|
17
|
+
* @param name Optional name filter.
|
|
18
|
+
* @param modelType Optional model type filter.
|
|
19
|
+
* @returns a `Promise` containing the search response.
|
|
20
|
+
*/
|
|
21
|
+
reqGetSearchModel(name?: string, modelType?: string): Promise<SearchResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Sends a document to the inference queue.
|
|
24
|
+
* @param product Product to enqueue.
|
|
25
|
+
* @param inputSource Local or remote file as an input.
|
|
18
26
|
* @param params {ExtractionParameters} parameters relating to the enqueueing options.
|
|
19
|
-
* @throws Error if the server's response contains an error.
|
|
20
|
-
* @returns a `Promise` containing a job response.
|
|
21
27
|
*/
|
|
22
|
-
|
|
28
|
+
reqPostProductEnqueue(product: typeof BaseProduct, inputSource: InputSource, params: BaseParameters): Promise<JobResponse>;
|
|
23
29
|
/**
|
|
24
|
-
* Get the specified Job.
|
|
30
|
+
* Get the specified Job by its ID.
|
|
25
31
|
* Throws an error if the server's response contains an error.
|
|
26
32
|
* @param jobId The Job ID as returned by the enqueue request.
|
|
27
33
|
* @returns a `Promise` containing the job response.
|
|
28
34
|
*/
|
|
29
|
-
|
|
35
|
+
reqGetJobById(jobId: string): Promise<JobResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the specified Job from a polling URL.
|
|
38
|
+
* Throws an error if the server's response contains an error.
|
|
39
|
+
* @param pollingUrl The polling URL as returned by a Job's pollingUrl property.
|
|
40
|
+
* @returns a `Promise` containing the job response.
|
|
41
|
+
*/
|
|
42
|
+
reqGetJobByUrl(pollingUrl: string): Promise<JobResponse>;
|
|
30
43
|
/**
|
|
31
44
|
* Get the result of a queued document from the API.
|
|
32
45
|
* Throws an error if the server's response contains an error.
|
|
@@ -34,7 +47,7 @@ export declare class MindeeApiV2 {
|
|
|
34
47
|
* @param inferenceId The inference ID for the result.
|
|
35
48
|
* @returns a `Promise` containing the parsed result.
|
|
36
49
|
*/
|
|
37
|
-
|
|
50
|
+
reqGetProductResultById<P extends typeof BaseProduct>(product: P, inferenceId: string): Promise<InstanceType<P["responseClass"]>>;
|
|
38
51
|
/**
|
|
39
52
|
* Get the result of a queued document from the API.
|
|
40
53
|
* Throws an error if the server's response contains an error.
|
|
@@ -42,5 +55,5 @@ export declare class MindeeApiV2 {
|
|
|
42
55
|
* @param url The URL as returned by a Job's resultUrl property.
|
|
43
56
|
* @returns a `Promise` containing the parsed result.
|
|
44
57
|
*/
|
|
45
|
-
|
|
58
|
+
reqGetProductResultByUrl<P extends typeof BaseProduct>(product: P, url: string): Promise<InstanceType<P["responseClass"]>>;
|
|
46
59
|
}
|