mindee 5.8.0 → 5.10.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 +12 -0
- package/package.json +103 -95
- package/src/geometry/bbox.d.ts +18 -6
- package/src/geometry/bbox.js +7 -3
- package/src/geometry/boundingBox.d.ts +3 -1
- package/src/geometry/boundingBox.js +3 -1
- package/src/geometry/boundingBoxUtils.d.ts +4 -4
- package/src/geometry/boundingBoxUtils.js +7 -7
- package/src/geometry/minMax.d.ts +9 -3
- package/src/geometry/point.d.ts +3 -1
- package/src/geometry/polygon.d.ts +3 -1
- package/src/geometry/polygon.js +3 -1
- package/src/http/apiCore.js +1 -1
- package/src/http/baseSettings.d.ts +15 -5
- package/src/http/baseSettings.js +4 -2
- package/src/http/dispatcher.js +4 -2
- package/src/image/extractedImage.d.ts +13 -5
- package/src/image/extractedImage.js +3 -3
- package/src/image/extractedImages.d.ts +4 -2
- package/src/image/extractedImages.js +3 -1
- package/src/image/imageCompressor.d.ts +1 -0
- package/src/image/imageCompressor.js +2 -2
- package/src/image/imageExtractor.d.ts +2 -2
- package/src/image/imageExtractor.js +14 -14
- package/src/input/base64Input.d.ts +9 -3
- package/src/input/base64Input.js +9 -3
- package/src/input/bufferInput.d.ts +7 -2
- package/src/input/bufferInput.js +6 -2
- package/src/input/bytesInput.d.ts +10 -3
- package/src/input/bytesInput.js +10 -3
- package/src/input/inputSource.d.ts +4 -2
- package/src/input/inputSource.js +3 -2
- package/src/input/localInputSource.d.ts +20 -7
- package/src/input/localInputSource.js +12 -5
- package/src/input/pageOptions.d.ts +9 -3
- package/src/input/pageOptions.js +6 -2
- package/src/input/pathInput.d.ts +12 -4
- package/src/input/pathInput.js +11 -5
- package/src/input/streamInput.d.ts +14 -5
- package/src/input/streamInput.js +13 -4
- package/src/input/urlInput.d.ts +19 -7
- package/src/input/urlInput.js +20 -12
- package/src/parsing/baseLocalResponse.d.ts +8 -4
- package/src/parsing/baseLocalResponse.js +15 -11
- package/src/parsing/stringDict.d.ts +3 -1
- package/src/pdf/extractedPdf.d.ts +16 -6
- package/src/pdf/extractedPdf.js +5 -3
- package/src/pdf/extractedPdfs.d.ts +4 -2
- package/src/pdf/extractedPdfs.js +3 -1
- package/src/pdf/pdfCompressor.js +14 -14
- package/src/pdf/pdfExtractor.d.ts +1 -1
- package/src/pdf/pdfExtractor.js +3 -3
- package/src/pdf/pdfOperation.d.ts +9 -3
- package/src/pdf/pdfOperation.js +14 -14
- package/src/pdf/pdfUtils.js +1 -1
- package/src/v1/cli.js +1 -1
- package/src/v1/client.d.ts +42 -14
- package/src/v1/client.js +8 -8
- package/src/v1/extraction/invoiceSplitterExtractor/extractedInvoiceSplitterImage.d.ts +6 -2
- package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.d.ts +2 -2
- package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.js +6 -6
- package/src/v1/extraction/multiReceiptsExtractor/extractedMultiReceiptImage.d.ts +6 -2
- package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.d.ts +2 -2
- package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.js +3 -3
- package/src/v1/http/apiSettingsV1.d.ts +15 -5
- package/src/v1/http/apiSettingsV1.js +12 -4
- package/src/v1/http/baseEndpoint.d.ts +7 -3
- package/src/v1/http/endpoint.d.ts +10 -4
- package/src/v1/http/endpoint.js +2 -2
- package/src/v1/http/errors.d.ts +9 -3
- package/src/v1/http/errors.js +6 -2
- package/src/v1/http/httpParams.d.ts +37 -13
- package/src/v1/http/workflowEndpoint.d.ts +2 -2
- package/src/v1/http/workflowEndpoint.js +2 -2
- package/src/v1/parsing/common/apiRequest.d.ts +15 -5
- package/src/v1/parsing/common/apiResponse.d.ts +6 -2
- package/src/v1/parsing/common/asyncPredictResponse.d.ts +21 -7
- package/src/v1/parsing/common/document.d.ts +18 -6
- package/src/v1/parsing/common/document.js +2 -2
- package/src/v1/parsing/common/execution.d.ts +40 -14
- package/src/v1/parsing/common/execution.js +1 -1
- package/src/v1/parsing/common/executionFile.d.ts +6 -2
- package/src/v1/parsing/common/executionPriority.d.ts +12 -4
- package/src/v1/parsing/common/executionPriority.js +12 -4
- package/src/v1/parsing/common/extras/cropperExtra.d.ts +7 -3
- package/src/v1/parsing/common/extras/cropperExtra.js +7 -4
- package/src/v1/parsing/common/extras/extras.d.ts +9 -3
- package/src/v1/parsing/common/extras/extras.js +6 -2
- package/src/v1/parsing/common/extras/fullTextOcrExtra.d.ts +9 -3
- package/src/v1/parsing/common/extras/fullTextOcrExtra.js +3 -1
- package/src/v1/parsing/common/extras/ragExtra.d.ts +3 -1
- package/src/v1/parsing/common/extras/ragExtra.js +3 -1
- package/src/v1/parsing/common/feedback/feedbackResponse.d.ts +3 -1
- package/src/v1/parsing/common/feedback/feedbackResponse.js +0 -1
- package/src/v1/parsing/common/inference.d.ts +24 -8
- package/src/v1/parsing/common/inference.js +6 -2
- package/src/v1/parsing/common/mvisionV1.d.ts +3 -1
- package/src/v1/parsing/common/mvisionV1.js +3 -1
- package/src/v1/parsing/common/ocr.d.ts +3 -1
- package/src/v1/parsing/common/ocrPage.d.ts +7 -3
- package/src/v1/parsing/common/ocrPage.js +7 -3
- package/src/v1/parsing/common/orientation.d.ts +7 -3
- package/src/v1/parsing/common/orientation.js +1 -1
- package/src/v1/parsing/common/page.d.ts +12 -4
- package/src/v1/parsing/common/predictResponse.d.ts +3 -1
- package/src/v1/parsing/common/prediction.d.ts +3 -1
- package/src/v1/parsing/common/prediction.js +3 -1
- package/src/v1/parsing/generated/generatedList.d.ts +7 -3
- package/src/v1/parsing/generated/generatedList.js +1 -1
- package/src/v1/parsing/generated/generatedObject.d.ts +26 -10
- package/src/v1/parsing/generated/generatedObject.js +14 -8
- package/src/v1/parsing/localResponse.d.ts +4 -2
- package/src/v1/parsing/localResponse.js +4 -2
- package/src/v1/parsing/standard/addressField.d.ts +24 -8
- package/src/v1/parsing/standard/amount.d.ts +3 -1
- package/src/v1/parsing/standard/amount.js +4 -2
- package/src/v1/parsing/standard/base.d.ts +27 -9
- package/src/v1/parsing/standard/base.js +6 -2
- package/src/v1/parsing/standard/boolean.d.ts +3 -1
- package/src/v1/parsing/standard/classification.d.ts +6 -2
- package/src/v1/parsing/standard/companyRegistration.d.ts +9 -3
- package/src/v1/parsing/standard/companyRegistration.js +4 -2
- package/src/v1/parsing/standard/date.d.ts +12 -4
- package/src/v1/parsing/standard/date.js +3 -1
- package/src/v1/parsing/standard/field.d.ts +7 -5
- package/src/v1/parsing/standard/field.js +4 -4
- package/src/v1/parsing/standard/locale.d.ts +15 -5
- package/src/v1/parsing/standard/paymentDetails.d.ts +15 -5
- package/src/v1/parsing/standard/position.d.ts +15 -5
- package/src/v1/parsing/standard/tax.d.ts +19 -7
- package/src/v1/parsing/standard/tax.js +16 -6
- package/src/v1/parsing/standard/text.d.ts +6 -2
- package/src/v1/parsing/standard/word.d.ts +9 -3
- package/src/v1/parsing/standard/word.js +3 -1
- package/src/v1/product/barcodeReader/barcodeReaderV1.d.ts +13 -5
- package/src/v1/product/barcodeReader/barcodeReaderV1.js +10 -4
- package/src/v1/product/barcodeReader/barcodeReaderV1Document.d.ts +8 -4
- package/src/v1/product/barcodeReader/barcodeReaderV1Document.js +8 -4
- package/src/v1/product/cliProducts.d.ts +2 -2
- package/src/v1/product/cliProducts.js +1 -1
- package/src/v1/product/cropper/cropperV1.d.ts +13 -5
- package/src/v1/product/cropper/cropperV1.js +10 -4
- package/src/v1/product/cropper/cropperV1Document.d.ts +1 -1
- package/src/v1/product/cropper/cropperV1Page.d.ts +5 -3
- package/src/v1/product/cropper/cropperV1Page.js +5 -3
- package/src/v1/product/driverLicense/driverLicenseV1.d.ts +13 -5
- package/src/v1/product/driverLicense/driverLicenseV1.js +10 -4
- package/src/v1/product/driverLicense/driverLicenseV1Document.d.ts +41 -15
- package/src/v1/product/driverLicense/driverLicenseV1Document.js +2 -2
- package/src/v1/product/financialDocument/financialDocumentV1.d.ts +13 -5
- package/src/v1/product/financialDocument/financialDocumentV1.js +10 -4
- package/src/v1/product/financialDocument/financialDocumentV1Document.d.ts +98 -34
- package/src/v1/product/financialDocument/financialDocumentV1Document.js +17 -7
- package/src/v1/product/financialDocument/financialDocumentV1LineItem.d.ts +30 -10
- package/src/v1/product/financialDocument/financialDocumentV1LineItem.js +4 -2
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +13 -5
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1.js +10 -4
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1Document.d.ts +11 -5
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1Document.js +2 -2
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2.d.ts +13 -5
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2.js +10 -4
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Bban.d.ts +18 -6
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Bban.js +3 -1
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Document.d.ts +14 -6
- package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Document.js +2 -2
- package/src/v1/product/fr/carteGrise/carteGriseV1.d.ts +13 -5
- package/src/v1/product/fr/carteGrise/carteGriseV1.js +10 -4
- package/src/v1/product/fr/carteGrise/carteGriseV1Document.d.ts +125 -43
- package/src/v1/product/fr/carteGrise/carteGriseV1Document.js +2 -2
- package/src/v1/product/fr/idCard/idCardV2.d.ts +13 -5
- package/src/v1/product/fr/idCard/idCardV2.js +10 -4
- package/src/v1/product/fr/idCard/idCardV2Document.d.ts +47 -17
- package/src/v1/product/fr/idCard/idCardV2Document.js +5 -3
- package/src/v1/product/fr/idCard/idCardV2Page.d.ts +8 -4
- package/src/v1/product/fr/idCard/idCardV2Page.js +2 -2
- package/src/v1/product/generated/generatedV1.d.ts +13 -5
- package/src/v1/product/generated/generatedV1.js +10 -4
- package/src/v1/product/generated/generatedV1Document.js +2 -2
- package/src/v1/product/generated/generatedV1Page.js +2 -2
- package/src/v1/product/generated/generatedV1Prediction.d.ts +9 -5
- package/src/v1/product/generated/generatedV1Prediction.js +6 -4
- package/src/v1/product/internationalId/internationalIdV2.d.ts +13 -5
- package/src/v1/product/internationalId/internationalIdV2.js +10 -4
- package/src/v1/product/internationalId/internationalIdV2Document.d.ts +53 -19
- package/src/v1/product/internationalId/internationalIdV2Document.js +8 -4
- package/src/v1/product/invoice/invoiceV4.d.ts +13 -5
- package/src/v1/product/invoice/invoiceV4.js +10 -4
- package/src/v1/product/invoice/invoiceV4Document.d.ts +89 -31
- package/src/v1/product/invoice/invoiceV4Document.js +17 -7
- package/src/v1/product/invoice/invoiceV4LineItem.d.ts +30 -10
- package/src/v1/product/invoice/invoiceV4LineItem.js +4 -2
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1.d.ts +13 -5
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1.js +10 -4
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +4 -2
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1Document.js +4 -2
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1InvoicePageGroup.d.ts +9 -3
- package/src/v1/product/invoiceSplitter/invoiceSplitterV1InvoicePageGroup.js +3 -1
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1.d.ts +13 -5
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1.js +10 -4
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.d.ts +5 -3
- package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.js +5 -3
- package/src/v1/product/passport/passportV1.d.ts +13 -5
- package/src/v1/product/passport/passportV1.js +10 -4
- package/src/v1/product/passport/passportV1Document.d.ts +35 -13
- package/src/v1/product/passport/passportV1Document.js +5 -3
- package/src/v1/product/receipt/receiptV5.d.ts +13 -5
- package/src/v1/product/receipt/receiptV5.js +10 -4
- package/src/v1/product/receipt/receiptV5Document.d.ts +53 -19
- package/src/v1/product/receipt/receiptV5Document.js +8 -4
- package/src/v1/product/receipt/receiptV5LineItem.d.ts +18 -6
- package/src/v1/product/receipt/receiptV5LineItem.js +4 -2
- package/src/v1/product/resume/resumeV1.d.ts +13 -5
- package/src/v1/product/resume/resumeV1.js +10 -4
- package/src/v1/product/resume/resumeV1Certificate.d.ts +18 -6
- package/src/v1/product/resume/resumeV1Certificate.js +4 -2
- package/src/v1/product/resume/resumeV1Document.d.ts +53 -19
- package/src/v1/product/resume/resumeV1Document.js +29 -11
- package/src/v1/product/resume/resumeV1Education.d.ts +27 -9
- package/src/v1/product/resume/resumeV1Education.js +4 -2
- package/src/v1/product/resume/resumeV1Language.d.ts +12 -4
- package/src/v1/product/resume/resumeV1Language.js +4 -2
- package/src/v1/product/resume/resumeV1ProfessionalExperience.d.ts +33 -11
- package/src/v1/product/resume/resumeV1ProfessionalExperience.js +4 -2
- package/src/v1/product/resume/resumeV1SocialNetworksUrl.d.ts +12 -4
- package/src/v1/product/resume/resumeV1SocialNetworksUrl.js +4 -2
- package/src/v1/product/us/bankCheck/bankCheckV1.d.ts +13 -5
- package/src/v1/product/us/bankCheck/bankCheckV1.js +10 -4
- package/src/v1/product/us/bankCheck/bankCheckV1Document.d.ts +20 -8
- package/src/v1/product/us/bankCheck/bankCheckV1Document.js +5 -3
- package/src/v1/product/us/bankCheck/bankCheckV1Page.d.ts +8 -4
- package/src/v1/product/us/bankCheck/bankCheckV1Page.js +5 -3
- package/src/v2/cli.js +2 -2
- package/src/v2/client.d.ts +103 -21
- package/src/v2/client.js +171 -27
- package/src/v2/clientOptions/baseAnnotationParameters.d.ts +23 -0
- package/src/v2/clientOptions/baseAnnotationParameters.js +17 -0
- package/src/v2/clientOptions/baseProductParameters.js +3 -2
- package/src/v2/clientOptions/baseRagDocumentUploadParameters.d.ts +23 -0
- package/src/v2/clientOptions/baseRagDocumentUploadParameters.js +24 -0
- package/src/v2/clientOptions/index.d.ts +2 -0
- package/src/v2/clientOptions/index.js +2 -0
- package/src/v2/clientOptions/pollingOptions.d.ts +30 -10
- package/src/v2/clientOptions/pollingOptions.js +6 -2
- package/src/v2/fileOperations/crop.d.ts +1 -1
- package/src/v2/http/errors.d.ts +1 -1
- package/src/v2/http/mindeeApiV2.d.ts +36 -7
- package/src/v2/http/mindeeApiV2.js +80 -4
- package/src/v2/parsing/baseRagAnnotationResponse.d.ts +28 -0
- package/src/v2/parsing/baseRagAnnotationResponse.js +14 -0
- package/src/v2/parsing/baseResponse.d.ts +6 -2
- package/src/v2/parsing/baseResponse.js +3 -1
- package/src/v2/parsing/error/errorDetails.d.ts +3 -1
- package/src/v2/parsing/error/errorResponse.d.ts +1 -1
- package/src/v2/parsing/error/errorResponse.js +1 -1
- package/src/v2/parsing/index.d.ts +2 -0
- package/src/v2/parsing/index.js +1 -0
- package/src/v2/parsing/inference/baseInference.d.ts +6 -2
- package/src/v2/parsing/inference/baseInference.js +6 -2
- package/src/v2/parsing/inference/failedInferenceResponse.d.ts +2 -2
- package/src/v2/parsing/inference/failedInferenceResponse.js +2 -2
- package/src/v2/parsing/inference/field/baseField.d.ts +9 -3
- package/src/v2/parsing/inference/field/fieldConfidence.d.ts +12 -4
- package/src/v2/parsing/inference/field/fieldConfidence.js +12 -4
- package/src/v2/parsing/inference/field/fieldLocation.d.ts +9 -3
- package/src/v2/parsing/inference/field/fieldLocation.js +3 -1
- package/src/v2/parsing/inference/field/inferenceFields.d.ts +15 -5
- package/src/v2/parsing/inference/field/inferenceFields.js +12 -4
- package/src/v2/parsing/inference/field/listField.d.ts +6 -2
- package/src/v2/parsing/inference/field/listField.js +6 -2
- package/src/v2/parsing/inference/field/objectField.d.ts +19 -11
- package/src/v2/parsing/inference/field/objectField.js +22 -34
- package/src/v2/parsing/inference/field/ragMetadata.d.ts +3 -1
- package/src/v2/parsing/inference/field/ragMetadata.js +3 -1
- package/src/v2/parsing/inference/field/rawText.d.ts +6 -2
- package/src/v2/parsing/inference/field/rawText.js +6 -2
- package/src/v2/parsing/inference/field/simpleField.d.ts +6 -2
- package/src/v2/parsing/inference/field/simpleField.js +8 -4
- package/src/v2/parsing/inference/inferenceFile.d.ts +6 -2
- package/src/v2/parsing/inference/inferenceFile.js +6 -2
- package/src/v2/parsing/inference/inferenceModel.d.ts +6 -2
- package/src/v2/parsing/inference/inferenceModel.js +6 -2
- package/src/v2/parsing/job/job.d.ts +8 -8
- package/src/v2/parsing/job/job.js +1 -1
- package/src/v2/parsing/job/jobResponse.d.ts +1 -1
- package/src/v2/parsing/job/jobResponse.js +1 -1
- package/src/v2/parsing/job/jobWebhook.d.ts +1 -1
- package/src/v2/parsing/job/jobWebhook.js +1 -1
- package/src/v2/parsing/search/baseSearchResponse.d.ts +1 -1
- package/src/v2/parsing/search/baseSearchResponse.js +1 -1
- package/src/v2/parsing/search/searchModels.d.ts +1 -1
- package/src/v2/parsing/search/searchModels.js +1 -1
- package/src/v2/parsing/search/searchRagDocuments.d.ts +1 -1
- package/src/v2/parsing/search/searchRagDocuments.js +1 -1
- package/src/v2/parsing/search/searchResponse.d.ts +1 -1
- package/src/v2/parsing/search/searchResponse.js +1 -1
- package/src/v2/product/baseProduct.d.ts +26 -6
- package/src/v2/product/baseProduct.js +31 -7
- package/src/v2/product/classification/classification.d.ts +10 -4
- package/src/v2/product/classification/classification.js +10 -4
- package/src/v2/product/classification/classificationClassifier.d.ts +7 -3
- package/src/v2/product/classification/classificationClassifier.js +7 -3
- package/src/v2/product/classification/classificationInference.d.ts +7 -3
- package/src/v2/product/classification/classificationInference.js +7 -3
- package/src/v2/product/classification/classificationResponse.d.ts +4 -2
- package/src/v2/product/classification/classificationResponse.js +4 -2
- package/src/v2/product/classification/classificationResult.d.ts +6 -2
- package/src/v2/product/classification/classificationResult.js +6 -2
- package/src/v2/product/classification/params/classificationParameters.d.ts +1 -1
- package/src/v2/product/classification/params/classificationParameters.js +1 -1
- package/src/v2/product/crop/crop.d.ts +10 -4
- package/src/v2/product/crop/crop.js +10 -4
- package/src/v2/product/crop/cropInference.d.ts +8 -4
- package/src/v2/product/crop/cropInference.js +8 -4
- package/src/v2/product/crop/cropItem.d.ts +8 -4
- package/src/v2/product/crop/cropItem.js +9 -5
- package/src/v2/product/crop/cropResponse.d.ts +4 -2
- package/src/v2/product/crop/cropResponse.js +4 -2
- package/src/v2/product/crop/cropResult.d.ts +7 -3
- package/src/v2/product/crop/cropResult.js +8 -4
- package/src/v2/product/crop/params/cropParameters.d.ts +1 -1
- package/src/v2/product/crop/params/cropParameters.js +1 -1
- package/src/v2/product/extraction/dataSchemaActiveOption.d.ts +3 -1
- package/src/v2/product/extraction/dataSchemaActiveOption.js +3 -1
- package/src/v2/product/extraction/extraction.d.ts +25 -5
- package/src/v2/product/extraction/extraction.js +32 -6
- package/src/v2/product/extraction/extractionActiveOptions.d.ts +6 -2
- package/src/v2/product/extraction/extractionActiveOptions.js +6 -2
- package/src/v2/product/extraction/extractionInference.d.ts +7 -3
- package/src/v2/product/extraction/extractionInference.js +7 -3
- package/src/v2/product/extraction/extractionResponse.d.ts +4 -2
- package/src/v2/product/extraction/extractionResponse.js +4 -2
- package/src/v2/product/extraction/extractionResult.d.ts +9 -5
- package/src/v2/product/extraction/extractionResult.js +9 -5
- package/src/v2/product/extraction/index.d.ts +1 -0
- package/src/v2/product/extraction/index.js +1 -0
- package/src/v2/product/extraction/params/dataSchema.d.ts +12 -4
- package/src/v2/product/extraction/params/dataSchema.js +6 -2
- package/src/v2/product/extraction/params/dataSchemaField.d.ts +39 -13
- package/src/v2/product/extraction/params/dataSchemaField.js +9 -3
- package/src/v2/product/extraction/params/dataSchemaReplace.d.ts +12 -4
- package/src/v2/product/extraction/params/dataSchemaReplace.js +6 -2
- package/src/v2/product/extraction/params/extractionParameters.d.ts +1 -1
- package/src/v2/product/extraction/params/extractionParameters.js +4 -4
- package/src/v2/product/extraction/ragDocuments/annotatedBaseField.d.ts +20 -0
- package/src/v2/product/extraction/ragDocuments/annotatedBaseField.js +15 -0
- package/src/v2/product/extraction/ragDocuments/annotatedFields.d.ts +27 -0
- package/src/v2/product/extraction/ragDocuments/annotatedFields.js +57 -0
- package/src/v2/product/extraction/ragDocuments/annotatedListField.d.ts +26 -0
- package/src/v2/product/extraction/ragDocuments/annotatedListField.js +69 -0
- package/src/v2/product/extraction/ragDocuments/annotatedObjectField.d.ts +43 -0
- package/src/v2/product/extraction/ragDocuments/annotatedObjectField.js +47 -0
- package/src/v2/product/extraction/ragDocuments/annotatedSimpleField.d.ts +15 -0
- package/src/v2/product/extraction/ragDocuments/annotatedSimpleField.js +13 -0
- package/src/v2/product/extraction/ragDocuments/extractionRagAnnotationResponse.d.ts +25 -0
- package/src/v2/product/extraction/ragDocuments/extractionRagAnnotationResponse.js +17 -0
- package/src/v2/product/extraction/ragDocuments/fieldFactory.d.ts +12 -0
- package/src/v2/product/extraction/ragDocuments/fieldFactory.js +23 -0
- package/src/v2/product/extraction/ragDocuments/index.d.ts +7 -0
- package/src/v2/product/extraction/ragDocuments/index.js +7 -0
- package/src/v2/product/extraction/ragDocuments/params/index.d.ts +2 -0
- package/src/v2/product/extraction/ragDocuments/params/index.js +2 -0
- package/src/v2/product/extraction/ragDocuments/params/ragDocumentAnnotationParameters.d.ts +27 -0
- package/src/v2/product/extraction/ragDocuments/params/ragDocumentAnnotationParameters.js +43 -0
- package/src/v2/product/extraction/ragDocuments/params/ragDocumentUploadParameters.d.ts +7 -0
- package/src/v2/product/extraction/ragDocuments/params/ragDocumentUploadParameters.js +9 -0
- package/src/v2/product/extraction/ragDocuments/ragAnnotation.d.ts +12 -0
- package/src/v2/product/extraction/ragDocuments/ragAnnotation.js +9 -0
- package/src/v2/product/ocr/ocr.d.ts +10 -4
- package/src/v2/product/ocr/ocr.js +10 -4
- package/src/v2/product/ocr/ocrInference.d.ts +8 -4
- package/src/v2/product/ocr/ocrInference.js +8 -4
- package/src/v2/product/ocr/ocrPage.d.ts +6 -2
- package/src/v2/product/ocr/ocrPage.js +6 -2
- package/src/v2/product/ocr/ocrResponse.d.ts +4 -2
- package/src/v2/product/ocr/ocrResponse.js +4 -2
- package/src/v2/product/ocr/ocrResult.d.ts +3 -1
- package/src/v2/product/ocr/ocrResult.js +3 -1
- package/src/v2/product/ocr/ocrWord.d.ts +6 -2
- package/src/v2/product/ocr/ocrWord.js +6 -2
- package/src/v2/product/ocr/params/ocrParameters.d.ts +1 -1
- package/src/v2/product/ocr/params/ocrParameters.js +1 -1
- package/src/v2/product/split/params/splitParameters.d.ts +1 -1
- package/src/v2/product/split/params/splitParameters.js +1 -1
- package/src/v2/product/split/split.d.ts +10 -4
- package/src/v2/product/split/split.js +10 -4
- package/src/v2/product/split/splitInference.d.ts +7 -3
- package/src/v2/product/split/splitInference.js +7 -3
- package/src/v2/product/split/splitRange.d.ts +4 -2
- package/src/v2/product/split/splitRange.js +5 -3
- package/src/v2/product/split/splitResponse.d.ts +4 -2
- package/src/v2/product/split/splitResponse.js +4 -2
- package/src/v2/product/split/splitResult.d.ts +3 -1
- package/src/v2/product/split/splitResult.js +4 -2
- package/src/v2/search/baseSearch.d.ts +11 -5
- package/src/v2/search/baseSearch.js +9 -3
- package/src/v2/search/models/modelSearch.d.ts +12 -6
- package/src/v2/search/models/modelSearch.js +12 -6
- package/src/v2/search/models/modelSearchParameters.d.ts +4 -2
- package/src/v2/search/models/modelSearchParameters.js +4 -2
- package/src/v2/search/models/modelSearchResponse.d.ts +2 -2
- package/src/v2/search/models/modelSearchResponse.js +2 -2
- package/src/v2/search/ragDocuments/ragDocumentSearch.d.ts +12 -6
- package/src/v2/search/ragDocuments/ragDocumentSearch.js +12 -6
- package/src/v2/search/ragDocuments/ragDocumentSearchParameters.d.ts +4 -2
- package/src/v2/search/ragDocuments/ragDocumentSearchParameters.js +4 -2
- package/src/v2/search/ragDocuments/ragDocumentSearchResponse.d.ts +2 -2
- package/src/v2/search/ragDocuments/ragDocumentSearchResponse.js +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MindeeError, MindeeInputSourceError } from "../../../errors/index.js";
|
|
2
|
-
import { InvoiceSplitterV1 } from "
|
|
3
|
-
import { ExtractedInvoiceSplitterImage } from "
|
|
2
|
+
import { InvoiceSplitterV1 } from "../../product/index.js";
|
|
3
|
+
import { ExtractedInvoiceSplitterImage } from "../index.js";
|
|
4
4
|
import { loadOptionalDependency } from "../../../dependency/index.js";
|
|
5
5
|
let pdfLib = null;
|
|
6
6
|
/**
|
|
@@ -20,13 +20,13 @@ async function getPdfLib() {
|
|
|
20
20
|
* @returns Extracted invoice splitter images.
|
|
21
21
|
*/
|
|
22
22
|
async function splitPdf(pdfDoc, invoicePageGroups) {
|
|
23
|
-
const
|
|
23
|
+
const currentPdfLib = await getPdfLib();
|
|
24
24
|
if (invoicePageGroups.length === 0) {
|
|
25
25
|
return [];
|
|
26
26
|
}
|
|
27
27
|
const generatedPdfs = [];
|
|
28
28
|
for (let i = 0; i < invoicePageGroups.length; i++) {
|
|
29
|
-
const subdocument = await
|
|
29
|
+
const subdocument = await currentPdfLib.PDFDocument.create();
|
|
30
30
|
const fullIndexes = [];
|
|
31
31
|
for (let j = invoicePageGroups[i][0]; j <= invoicePageGroups[i][invoicePageGroups[i].length - 1]; j++) {
|
|
32
32
|
fullIndexes.push(j);
|
|
@@ -46,12 +46,12 @@ async function splitPdf(pdfDoc, invoicePageGroups) {
|
|
|
46
46
|
* @returns PDF document.
|
|
47
47
|
*/
|
|
48
48
|
async function getPdfDoc(inputFile) {
|
|
49
|
-
const
|
|
49
|
+
const currentPdfLib = await getPdfLib();
|
|
50
50
|
await inputFile.init();
|
|
51
51
|
if (!inputFile.isPdf()) {
|
|
52
52
|
throw new MindeeInputSourceError("Invoice Splitter is only compatible with PDF documents.");
|
|
53
53
|
}
|
|
54
|
-
const pdfDoc = await
|
|
54
|
+
const pdfDoc = await currentPdfLib.PDFDocument.load(inputFile.fileObject, {
|
|
55
55
|
ignoreEncryption: true,
|
|
56
56
|
password: ""
|
|
57
57
|
});
|
|
@@ -3,9 +3,13 @@ import { ExtractedImage } from "../../../image/index.js";
|
|
|
3
3
|
* Wrapper class for extracted multiple-receipts images.
|
|
4
4
|
*/
|
|
5
5
|
export declare class ExtractedMultiReceiptImage extends ExtractedImage {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Receipt index within the source page.
|
|
8
|
+
*/
|
|
7
9
|
readonly receiptId: number;
|
|
8
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Source page identifier.
|
|
12
|
+
*/
|
|
9
13
|
readonly pageId: number;
|
|
10
14
|
constructor(buffer: Uint8Array, pageId: number, receiptId: number);
|
|
11
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MultiReceiptsDetectorV1 } from "
|
|
2
|
-
import { ExtractedMultiReceiptImage } from "
|
|
1
|
+
import { MultiReceiptsDetectorV1 } from "../../product/index.js";
|
|
2
|
+
import { ExtractedMultiReceiptImage } from "../index.js";
|
|
3
3
|
import { LocalInputSource } from "../../../input/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Extracts individual receipts from multi-receipts documents.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MindeeError } from "../../../errors/index.js";
|
|
2
2
|
import { createPdfFromInputSource } from "../../../pdf/pdfOperation.js";
|
|
3
|
-
import { ExtractedMultiReceiptImage } from "
|
|
3
|
+
import { ExtractedMultiReceiptImage } from "../index.js";
|
|
4
4
|
import { extractFromPage } from "../../../image/index.js";
|
|
5
5
|
import { loadOptionalDependency } from "../../../dependency/index.js";
|
|
6
6
|
let pdfLib = null;
|
|
@@ -40,7 +40,7 @@ async function extractReceiptsFromPage(pdfPage, boundingBoxes, pageId) {
|
|
|
40
40
|
* @returns Individual extracted receipts as an array of ExtractedMultiReceiptImage.
|
|
41
41
|
*/
|
|
42
42
|
export async function extractReceipts(inputFile, inference) {
|
|
43
|
-
const
|
|
43
|
+
const currentPdfLib = await getPdfLib();
|
|
44
44
|
const images = [];
|
|
45
45
|
if (!inference.prediction.receipts) {
|
|
46
46
|
throw new MindeeError("No possible receipts candidates found for MultiReceipts extraction.");
|
|
@@ -48,7 +48,7 @@ export async function extractReceipts(inputFile, inference) {
|
|
|
48
48
|
const pdfDoc = await createPdfFromInputSource(inputFile);
|
|
49
49
|
for (let pageId = 0; pageId < pdfDoc.getPageCount(); pageId++) {
|
|
50
50
|
const page = pdfDoc.getPage(pageId);
|
|
51
|
-
page.setRotation(
|
|
51
|
+
page.setRotation(currentPdfLib.degrees(inference.pages[pageId].orientation?.value ?? 0));
|
|
52
52
|
const receiptPositions = inference.pages[pageId].prediction.receipts.map((receipt) => receipt.boundingBox);
|
|
53
53
|
const extractedReceipts = await extractReceiptsFromPage(page, receiptPositions, pageId);
|
|
54
54
|
images.push(...extractedReceipts);
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { BaseSettings, MindeeApiConstructorProps } from "../../http/baseSettings.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Default account owner for built-in v1 APIs.
|
|
4
|
+
*/
|
|
3
5
|
export declare const STANDARD_API_OWNER: string;
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Runtime settings container for v1 API calls.
|
|
8
|
+
*/
|
|
5
9
|
export declare class ApiSettingsV1 extends BaseSettings {
|
|
6
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Default headers sent with each v1 API request.
|
|
12
|
+
*/
|
|
7
13
|
baseHeaders: Record<string, string>;
|
|
8
14
|
constructor({ apiKey, dispatcher, }: MindeeApiConstructorProps);
|
|
9
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the API key from environment variables.
|
|
17
|
+
*/
|
|
10
18
|
protected apiKeyFromEnv(): string;
|
|
11
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Resolves the API hostname from environment variables.
|
|
21
|
+
*/
|
|
12
22
|
protected hostnameFromEnv(): string;
|
|
13
23
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { logger } from "../../logger.js";
|
|
2
2
|
import { BaseSettings } from "../../http/baseSettings.js";
|
|
3
3
|
import { MindeeConfigurationError } from "../../errors/index.js";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Default account owner for built-in v1 APIs.
|
|
6
|
+
*/
|
|
5
7
|
export const STANDARD_API_OWNER = "mindee";
|
|
6
8
|
const API_V1_KEY_ENVVAR_NAME = "MINDEE_API_KEY";
|
|
7
9
|
const API_V1_HOST_ENVVAR_NAME = "MINDEE_API_HOST";
|
|
8
10
|
const DEFAULT_MINDEE_API_HOST = "api.mindee.net";
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Runtime settings container for v1 API calls.
|
|
13
|
+
*/
|
|
10
14
|
export class ApiSettingsV1 extends BaseSettings {
|
|
11
15
|
constructor({ apiKey, dispatcher, }) {
|
|
12
16
|
super(apiKey, dispatcher);
|
|
@@ -20,7 +24,9 @@ export class ApiSettingsV1 extends BaseSettings {
|
|
|
20
24
|
Authorization: `Token ${this.apiKey}`,
|
|
21
25
|
};
|
|
22
26
|
}
|
|
23
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Resolves the API key from environment variables.
|
|
29
|
+
*/
|
|
24
30
|
apiKeyFromEnv() {
|
|
25
31
|
const envVarValue = process.env[API_V1_KEY_ENVVAR_NAME];
|
|
26
32
|
if (envVarValue) {
|
|
@@ -29,7 +35,9 @@ export class ApiSettingsV1 extends BaseSettings {
|
|
|
29
35
|
}
|
|
30
36
|
return "";
|
|
31
37
|
}
|
|
32
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the API hostname from environment variables.
|
|
40
|
+
*/
|
|
33
41
|
hostnameFromEnv() {
|
|
34
42
|
const envVarValue = process.env[API_V1_HOST_ENVVAR_NAME];
|
|
35
43
|
if (envVarValue) {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { InputSource, PageOptions } from "../../input/index.js";
|
|
2
|
-
import { ApiSettingsV1 } from "
|
|
2
|
+
import { ApiSettingsV1 } from "./apiSettingsV1.js";
|
|
3
3
|
export declare abstract class BaseEndpoint {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Settings relating to the API.
|
|
6
|
+
*/
|
|
5
7
|
settings: ApiSettingsV1;
|
|
6
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Root of the URL for API calls.
|
|
10
|
+
*/
|
|
7
11
|
urlRoot: string;
|
|
8
12
|
protected constructor(settings: ApiSettingsV1, urlRoot: string);
|
|
9
13
|
/**
|
|
@@ -3,17 +3,23 @@ import { StringDict } from "../../parsing/stringDict.js";
|
|
|
3
3
|
import { BaseHttpResponse } from "../../http/apiCore.js";
|
|
4
4
|
import { ApiSettingsV1 } from "./apiSettingsV1.js";
|
|
5
5
|
import { PredictParams } from "./httpParams.js";
|
|
6
|
-
import { BaseEndpoint } from "
|
|
6
|
+
import { BaseEndpoint } from "./baseEndpoint.js";
|
|
7
7
|
/**
|
|
8
8
|
* Endpoint for a product (OTS or Custom).
|
|
9
9
|
*/
|
|
10
10
|
export declare class Endpoint extends BaseEndpoint {
|
|
11
11
|
#private;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* URL of a product.
|
|
14
|
+
*/
|
|
13
15
|
urlName: string;
|
|
14
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Account owning the product.
|
|
18
|
+
*/
|
|
15
19
|
owner: string;
|
|
16
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Product's version, as a string.
|
|
22
|
+
*/
|
|
17
23
|
version: string;
|
|
18
24
|
constructor(urlName: string, owner: string, version: string, settings: ApiSettingsV1);
|
|
19
25
|
/**
|
package/src/v1/http/endpoint.js
CHANGED
|
@@ -4,13 +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 _Endpoint_instances, _Endpoint_predictReqPost, _Endpoint_predictAsyncReqPost, _Endpoint_documentQueueReqGet, _Endpoint_documentGetReq, _Endpoint_documentFeedbackPutReq;
|
|
7
|
-
import { URLSearchParams } from "url";
|
|
7
|
+
import { URLSearchParams } from "node:url";
|
|
8
8
|
import { FormData } from "undici";
|
|
9
9
|
import { LocalInputSource } from "../../input/index.js";
|
|
10
10
|
import { sendRequestAndReadResponse, } from "../../http/apiCore.js";
|
|
11
11
|
import { handleError } from "./errors.js";
|
|
12
12
|
import { isValidAsyncResponse, isValidSyncResponse } from "./responseValidation.js";
|
|
13
|
-
import { BaseEndpoint } from "
|
|
13
|
+
import { BaseEndpoint } from "./baseEndpoint.js";
|
|
14
14
|
/**
|
|
15
15
|
* Endpoint for a product (OTS or Custom).
|
|
16
16
|
*/
|
package/src/v1/http/errors.d.ts
CHANGED
|
@@ -13,11 +13,17 @@ export declare function handleError(urlName: string, response: BaseHttpResponse,
|
|
|
13
13
|
* Is used when an error is lacking a handled error code.
|
|
14
14
|
*/
|
|
15
15
|
export declare class MindeeHttpErrorV1 extends MindeeError {
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Description of the error.
|
|
18
|
+
*/
|
|
17
19
|
message: string;
|
|
18
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Additional details on the error.
|
|
22
|
+
*/
|
|
19
23
|
details: string | StringDict;
|
|
20
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Standard HTTP error code.
|
|
26
|
+
*/
|
|
21
27
|
code?: number;
|
|
22
28
|
constructor(httpError: StringDict, urlName: string, code?: number);
|
|
23
29
|
}
|
package/src/v1/http/errors.js
CHANGED
|
@@ -83,9 +83,13 @@ export function handleError(urlName, response, serverError) {
|
|
|
83
83
|
export class MindeeHttpErrorV1 extends MindeeError {
|
|
84
84
|
constructor(httpError, urlName, code) {
|
|
85
85
|
super(`${urlName} API ${code} HTTP error: ${httpError.message}`);
|
|
86
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Description of the error.
|
|
88
|
+
*/
|
|
87
89
|
this.message = "";
|
|
88
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Additional details on the error.
|
|
92
|
+
*/
|
|
89
93
|
this.details = "";
|
|
90
94
|
this.details = httpError.details;
|
|
91
95
|
this.message = httpError.message;
|
|
@@ -1,31 +1,55 @@
|
|
|
1
1
|
import { InputSource, PageOptions } from "../../input/index.js";
|
|
2
|
-
import { ExecutionPriority } from "
|
|
2
|
+
import { ExecutionPriority } from "../parsing/common/index.js";
|
|
3
3
|
interface HTTPParams {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Input source to submit to the API.
|
|
6
|
+
*/
|
|
5
7
|
inputDoc: InputSource;
|
|
6
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Enables full-text OCR output when supported.
|
|
10
|
+
*/
|
|
7
11
|
fullText: boolean;
|
|
8
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Optional local page filtering options applied before upload.
|
|
14
|
+
*/
|
|
9
15
|
pageOptions?: PageOptions;
|
|
10
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Enables Retrieval-Augmented Generation when supported.
|
|
18
|
+
*/
|
|
11
19
|
rag?: boolean;
|
|
12
20
|
}
|
|
13
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Parameters sent to synchronous/asynchronous prediction endpoints.
|
|
23
|
+
*/
|
|
14
24
|
export interface PredictParams extends HTTPParams {
|
|
15
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Enables word-level OCR details in the response.
|
|
27
|
+
*/
|
|
16
28
|
includeWords: boolean;
|
|
17
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Enables cropper extras in the response.
|
|
31
|
+
*/
|
|
18
32
|
cropper: boolean;
|
|
19
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Optional workflow ID used for workflow-backed inference.
|
|
35
|
+
*/
|
|
20
36
|
workflowId?: string;
|
|
21
37
|
}
|
|
22
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Parameters sent to workflow execution endpoints.
|
|
40
|
+
*/
|
|
23
41
|
export interface WorkflowParams extends HTTPParams {
|
|
24
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Custom alias assigned to the submitted file.
|
|
44
|
+
*/
|
|
25
45
|
alias?: string;
|
|
26
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Processing priority of the workflow execution.
|
|
48
|
+
*/
|
|
27
49
|
priority?: ExecutionPriority;
|
|
28
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Whether to request a public validation URL.
|
|
52
|
+
*/
|
|
29
53
|
publicUrl?: string;
|
|
30
54
|
}
|
|
31
55
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { InputSource } from "../../input/index.js";
|
|
2
|
-
import { ExecutionPriority } from "
|
|
2
|
+
import { ExecutionPriority } from "../parsing/common/index.js";
|
|
3
3
|
import { BaseHttpResponse } from "../../http/apiCore.js";
|
|
4
4
|
import { ApiSettingsV1 } from "./apiSettingsV1.js";
|
|
5
5
|
import { WorkflowParams } from "./httpParams.js";
|
|
6
|
-
import { BaseEndpoint } from "
|
|
6
|
+
import { BaseEndpoint } from "./baseEndpoint.js";
|
|
7
7
|
/**
|
|
8
8
|
* Endpoint for a workflow.
|
|
9
9
|
*/
|
|
@@ -4,13 +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 _WorkflowEndpoint_instances, _WorkflowEndpoint_workflowReqPost;
|
|
7
|
-
import { URLSearchParams } from "url";
|
|
7
|
+
import { URLSearchParams } from "node:url";
|
|
8
8
|
import { FormData } from "undici";
|
|
9
9
|
import { LocalInputSource } from "../../input/index.js";
|
|
10
10
|
import { sendRequestAndReadResponse, } from "../../http/apiCore.js";
|
|
11
11
|
import { handleError } from "./errors.js";
|
|
12
12
|
import { isValidSyncResponse } from "./responseValidation.js";
|
|
13
|
-
import { BaseEndpoint } from "
|
|
13
|
+
import { BaseEndpoint } from "./baseEndpoint.js";
|
|
14
14
|
/**
|
|
15
15
|
* Endpoint for a workflow.
|
|
16
16
|
*/
|
|
@@ -5,15 +5,25 @@ import { StringDict } from "../../../parsing/stringDict.js";
|
|
|
5
5
|
* @category API Response
|
|
6
6
|
*/
|
|
7
7
|
export declare class ApiRequest {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* An object detailing the error.
|
|
10
|
+
*/
|
|
9
11
|
error: StringDict;
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Target of the request.
|
|
14
|
+
*/
|
|
11
15
|
resources: string[];
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Status of the request. Either "failure" or "success".
|
|
18
|
+
*/
|
|
13
19
|
status: "failure" | "success";
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* HTTP status code
|
|
22
|
+
*/
|
|
15
23
|
statusCode: number;
|
|
16
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* URL of the request.
|
|
26
|
+
*/
|
|
17
27
|
url: string;
|
|
18
28
|
constructor(serverResponse: StringDict);
|
|
19
29
|
}
|
|
@@ -5,9 +5,13 @@ import { StringDict } from "../../../parsing/stringDict.js";
|
|
|
5
5
|
* @category API Response
|
|
6
6
|
*/
|
|
7
7
|
export declare abstract class ApiResponse {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Initial request sent to the API.
|
|
10
|
+
*/
|
|
9
11
|
apiRequest: ApiRequest;
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Raw text representation of the API's response.
|
|
14
|
+
*/
|
|
11
15
|
private readonly rawHttp;
|
|
12
16
|
/**
|
|
13
17
|
* @param serverResponse JSON response from the server.
|
|
@@ -8,17 +8,29 @@ import { Document } from "./document.js";
|
|
|
8
8
|
* @category Asynchronous
|
|
9
9
|
*/
|
|
10
10
|
export declare class Job {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Timestamp noting the enqueueing of a document.
|
|
13
|
+
*/
|
|
12
14
|
issuedAt: Date;
|
|
13
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Timestamp noting the availability of a prediction for an enqueued document.
|
|
17
|
+
*/
|
|
14
18
|
availableAt?: Date;
|
|
15
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Information about an error that occurred during the job processing.
|
|
21
|
+
*/
|
|
16
22
|
error?: StringDict;
|
|
17
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* ID of the job.
|
|
25
|
+
*/
|
|
18
26
|
id: string;
|
|
19
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Status of the job.
|
|
29
|
+
*/
|
|
20
30
|
status?: "waiting" | "processing" | "completed" | "failed";
|
|
21
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* The time taken to process the job, in milliseconds.
|
|
33
|
+
*/
|
|
22
34
|
milliSecsTaken?: number;
|
|
23
35
|
constructor(jsonResponse: StringDict);
|
|
24
36
|
}
|
|
@@ -33,7 +45,9 @@ export declare function datetimeWithTimezone(date: string): Date;
|
|
|
33
45
|
* @category Asynchronous
|
|
34
46
|
*/
|
|
35
47
|
export declare class AsyncPredictResponse<T extends Inference> extends ApiResponse {
|
|
36
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Job for a queue.
|
|
50
|
+
*/
|
|
37
51
|
job: Job;
|
|
38
52
|
/** Prediction for an asynchronous request. Will not be available so long as the job is not
|
|
39
53
|
* `completed`.
|
|
@@ -7,17 +7,29 @@ import { StringDict } from "../../../parsing/stringDict.js";
|
|
|
7
7
|
* @typeParam T an extension of an `Inference`. Mandatory in order to properly create an inference.
|
|
8
8
|
*/
|
|
9
9
|
export declare class Document<T extends Inference> {
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* File name as sent back by the server.
|
|
12
|
+
*/
|
|
11
13
|
filename: string;
|
|
12
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Result of the base inference.
|
|
16
|
+
*/
|
|
13
17
|
inference: T;
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* ID of the document as sent back by the server.
|
|
20
|
+
*/
|
|
15
21
|
id: string;
|
|
16
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Potential `Extras` fields sent back along the prediction.
|
|
24
|
+
*/
|
|
17
25
|
extras?: Extras;
|
|
18
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Raw-text response for `allWords` parsing.
|
|
28
|
+
*/
|
|
19
29
|
ocr?: Ocr;
|
|
20
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Page number as sent back by the API.
|
|
32
|
+
*/
|
|
21
33
|
nPages: number;
|
|
22
34
|
/**
|
|
23
35
|
*
|
|
@@ -50,9 +50,9 @@ export class Document {
|
|
|
50
50
|
${this.inference?.toString()}`;
|
|
51
51
|
}
|
|
52
52
|
injectFullTextOcr(rawPrediction) {
|
|
53
|
-
if (rawPrediction["inference"]["pages"].length
|
|
53
|
+
if (rawPrediction["inference"]["pages"].length === 0 ||
|
|
54
54
|
!("extras" in rawPrediction["inference"]["pages"][0]) ||
|
|
55
|
-
rawPrediction["inference"]["pages"][0]["extras"].length
|
|
55
|
+
rawPrediction["inference"]["pages"][0]["extras"].length === 0 ||
|
|
56
56
|
!("full_text_ocr" in rawPrediction["inference"]["pages"][0]["extras"]) ||
|
|
57
57
|
!rawPrediction["inference"]["pages"][0]["extras"]["full_text_ocr"] ||
|
|
58
58
|
!("content" in rawPrediction["inference"]["pages"][0]["extras"]["full_text_ocr"]) ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Inference } from "./inference.js";
|
|
2
|
-
import { GeneratedV1Document } from "
|
|
2
|
+
import { GeneratedV1Document } from "../../product/generated/generatedV1Document.js";
|
|
3
3
|
import { ExecutionFile } from "./executionFile.js";
|
|
4
4
|
import { StringDict } from "../../../parsing/stringDict.js";
|
|
5
5
|
import { ExecutionPriority } from "./executionPriority.js";
|
|
@@ -8,31 +8,57 @@ import { ExecutionPriority } from "./executionPriority.js";
|
|
|
8
8
|
* @category Workflow
|
|
9
9
|
*/
|
|
10
10
|
export declare class Execution<T extends Inference> {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Identifier for the batch to which the execution belongs.
|
|
13
|
+
*/
|
|
12
14
|
batchName: string;
|
|
13
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* The time at which the execution started.
|
|
17
|
+
*/
|
|
14
18
|
createdAt: Date | null;
|
|
15
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* File representation within a workflow execution.
|
|
21
|
+
*/
|
|
16
22
|
file: ExecutionFile;
|
|
17
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Identifier for the execution.
|
|
25
|
+
*/
|
|
18
26
|
id: string;
|
|
19
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Deserialized inference object.
|
|
29
|
+
*/
|
|
20
30
|
inference: T | null;
|
|
21
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Priority of the execution.
|
|
33
|
+
*/
|
|
22
34
|
priority: ExecutionPriority | null;
|
|
23
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* The time at which the file was tagged as reviewed.
|
|
37
|
+
*/
|
|
24
38
|
reviewedAt: Date | null;
|
|
25
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* The time at which the file was uploaded to a workflow.
|
|
41
|
+
*/
|
|
26
42
|
availableAt: Date | null;
|
|
27
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Reviewed fields and values.
|
|
45
|
+
*/
|
|
28
46
|
reviewedPrediction: GeneratedV1Document | null;
|
|
29
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Execution Status.
|
|
49
|
+
*/
|
|
30
50
|
status: string;
|
|
31
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Execution type.
|
|
53
|
+
*/
|
|
32
54
|
type: string | null;
|
|
33
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* The time at which the file was uploaded to a workflow.
|
|
57
|
+
*/
|
|
34
58
|
uploadedAt: Date | null;
|
|
35
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Identifier for the workflow.
|
|
61
|
+
*/
|
|
36
62
|
workflowId: string;
|
|
37
63
|
constructor(inferenceClass: new (serverResponse: StringDict) => T, jsonResponse: StringDict);
|
|
38
64
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GeneratedV1Document } from "
|
|
1
|
+
import { GeneratedV1Document } from "../../product/generated/generatedV1Document.js";
|
|
2
2
|
import { parseDate } from "../../../parsing/dateParser.js";
|
|
3
3
|
/**
|
|
4
4
|
* Representation of an execution for a workflow.
|
|
@@ -4,9 +4,13 @@ import { StringDict } from "../../../parsing/stringDict.js";
|
|
|
4
4
|
* @category Workflow
|
|
5
5
|
*/
|
|
6
6
|
export declare class ExecutionFile {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* File name.
|
|
9
|
+
*/
|
|
8
10
|
name: string | null;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Optional alias for the file.
|
|
13
|
+
*/
|
|
10
14
|
alias: string | null;
|
|
11
15
|
constructor(jsonResponse: StringDict);
|
|
12
16
|
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Execution priority levels available for workflow requests.
|
|
3
|
+
*/
|
|
2
4
|
export declare enum ExecutionPriority {
|
|
3
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Low-priority background processing.
|
|
7
|
+
*/
|
|
4
8
|
low = "low",
|
|
5
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Standard processing priority.
|
|
11
|
+
*/
|
|
6
12
|
medium = "medium",
|
|
7
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* High-priority processing.
|
|
15
|
+
*/
|
|
8
16
|
high = "high"
|
|
9
17
|
}
|