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
|
@@ -4,9 +4,9 @@ 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 _MindeeApiV2_instances, _MindeeApiV2_paramsToFormData, _MindeeApiV2_processResponse;
|
|
7
|
-
import { ApiSettings } from "./apiSettings.js";
|
|
8
7
|
import { FormData } from "undici";
|
|
9
|
-
import {
|
|
8
|
+
import { ApiSettings } from "./apiSettings.js";
|
|
9
|
+
import { ErrorResponse, JobResponse, } from "../parsing/index.js";
|
|
10
10
|
import { sendRequestAndReadResponse } from "../../http/apiCore.js";
|
|
11
11
|
import { LocalInputSource } from "../../input/index.js";
|
|
12
12
|
import { MindeeDeserializationError, MindeeError } from "../../errors/index.js";
|
|
@@ -34,12 +34,11 @@ export class MindeeApiV2 {
|
|
|
34
34
|
else {
|
|
35
35
|
form.set("url", inputSource.url);
|
|
36
36
|
}
|
|
37
|
-
const path = `/v2/products/${product.slug}/enqueue`;
|
|
38
37
|
const options = {
|
|
39
38
|
method: "POST",
|
|
40
39
|
headers: this.settings.baseHeaders,
|
|
41
40
|
hostname: this.settings.hostname,
|
|
42
|
-
path:
|
|
41
|
+
path: `/v2/products/${product.slug}/enqueue`,
|
|
43
42
|
body: form,
|
|
44
43
|
timeoutSecs: this.settings.timeoutSecs,
|
|
45
44
|
};
|
|
@@ -123,6 +122,83 @@ export class MindeeApiV2 {
|
|
|
123
122
|
const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
|
|
124
123
|
return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, search.responseClass);
|
|
125
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Get a document's info and annotations from the RAG database.
|
|
127
|
+
* @param product the product definition to use.
|
|
128
|
+
* @param documentId the document id to get.
|
|
129
|
+
* @returns a `Promise` containing an annotation response.
|
|
130
|
+
*/
|
|
131
|
+
async reqGetRagAnnotation(product, documentId) {
|
|
132
|
+
const options = {
|
|
133
|
+
method: "GET",
|
|
134
|
+
headers: this.settings.baseHeaders,
|
|
135
|
+
hostname: this.settings.hostname,
|
|
136
|
+
path: `/v2/products/${product.slug}/rag-documents/${documentId}`,
|
|
137
|
+
timeoutSecs: this.settings.timeoutSecs,
|
|
138
|
+
};
|
|
139
|
+
const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
|
|
140
|
+
return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, product.annotationResponseClass);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Add a document to the RAG database.
|
|
144
|
+
* @param product the product definition to use.
|
|
145
|
+
* @param parameters the parameters to use.
|
|
146
|
+
* @param inputSource the file to upload.
|
|
147
|
+
* @returns a `Promise` containing an annotation response.
|
|
148
|
+
*/
|
|
149
|
+
async reqPostRagDocument(product, parameters, inputSource) {
|
|
150
|
+
const form = __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_paramsToFormData).call(this, parameters.getRequestParameters());
|
|
151
|
+
form.set("file", new Blob([inputSource.fileObject]), inputSource.filename);
|
|
152
|
+
const options = {
|
|
153
|
+
method: "POST",
|
|
154
|
+
headers: this.settings.baseHeaders,
|
|
155
|
+
hostname: this.settings.hostname,
|
|
156
|
+
path: `/v2/products/${product.slug}/rag-documents`,
|
|
157
|
+
body: form,
|
|
158
|
+
timeoutSecs: this.settings.timeoutSecs,
|
|
159
|
+
};
|
|
160
|
+
const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
|
|
161
|
+
return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, product.annotationResponseClass);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Update a document's annotations in the RAG database.
|
|
165
|
+
* @param product the product definition to use.
|
|
166
|
+
* @param parameters the parameters to use.
|
|
167
|
+
* @returns a `Promise` containing an annotation response.
|
|
168
|
+
*/
|
|
169
|
+
async reqPatchRagAnnotation(product, parameters) {
|
|
170
|
+
const options = {
|
|
171
|
+
method: "PATCH",
|
|
172
|
+
headers: {
|
|
173
|
+
...this.settings.baseHeaders,
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
175
|
+
"Content-Type": "application/json",
|
|
176
|
+
},
|
|
177
|
+
hostname: this.settings.hostname,
|
|
178
|
+
path: `/v2/products/${product.slug}/rag-documents/${parameters.documentId}`,
|
|
179
|
+
body: JSON.stringify(parameters.getRequestParameters()),
|
|
180
|
+
timeoutSecs: this.settings.timeoutSecs,
|
|
181
|
+
};
|
|
182
|
+
const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
|
|
183
|
+
return __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_processResponse).call(this, response, product.annotationResponseClass);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Deletes a document from the RAG database.
|
|
187
|
+
* @param product the product definition to use.
|
|
188
|
+
* @param documentId the document's ID.
|
|
189
|
+
* @returns true if the document was deleted successfully, false otherwise.
|
|
190
|
+
*/
|
|
191
|
+
async reqDeleteRagDocument(product, documentId) {
|
|
192
|
+
const options = {
|
|
193
|
+
method: "DELETE",
|
|
194
|
+
headers: this.settings.baseHeaders,
|
|
195
|
+
hostname: this.settings.hostname,
|
|
196
|
+
path: `/v2/products/${product.slug}/rag-documents/${documentId}`,
|
|
197
|
+
timeoutSecs: this.settings.timeoutSecs,
|
|
198
|
+
};
|
|
199
|
+
const response = await sendRequestAndReadResponse(this.settings.dispatcher, options);
|
|
200
|
+
return response.messageObj?.statusCode >= 200 && response.messageObj?.statusCode < 400;
|
|
201
|
+
}
|
|
126
202
|
}
|
|
127
203
|
_MindeeApiV2_instances = new WeakSet(), _MindeeApiV2_paramsToFormData = function _MindeeApiV2_paramsToFormData(params) {
|
|
128
204
|
const form = new FormData();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseResponse } from "./baseResponse.js";
|
|
2
|
+
import { StringDict } from "../../parsing/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Base class for all RAG document responses from the V2 API.
|
|
5
|
+
*/
|
|
6
|
+
export declare class BaseRagAnnotationResponse extends BaseResponse {
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier of the RAG document.
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* Original filename of the uploaded document.
|
|
13
|
+
*/
|
|
14
|
+
filename: string;
|
|
15
|
+
/**
|
|
16
|
+
* Date and time of the document creation.
|
|
17
|
+
*/
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
/**
|
|
20
|
+
* Current status of the RAG document.
|
|
21
|
+
*/
|
|
22
|
+
status: string;
|
|
23
|
+
constructor(serverResponse: StringDict);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Constructor signature for typed v2 response classes.
|
|
27
|
+
*/
|
|
28
|
+
export type AnnotationResponseConstructor<T extends BaseRagAnnotationResponse> = new (serverResponse: StringDict) => T;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseResponse } from "./baseResponse.js";
|
|
2
|
+
import { parseDate } from "../../parsing/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Base class for all RAG document responses from the V2 API.
|
|
5
|
+
*/
|
|
6
|
+
export class BaseRagAnnotationResponse extends BaseResponse {
|
|
7
|
+
constructor(serverResponse) {
|
|
8
|
+
super(serverResponse);
|
|
9
|
+
this.id = serverResponse["id"];
|
|
10
|
+
this.filename = serverResponse["filename"];
|
|
11
|
+
this.createdAt = parseDate(serverResponse["created_at"]);
|
|
12
|
+
this.status = serverResponse["status"];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { StringDict } from "../../parsing/stringDict.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Base response contract for v2 product responses.
|
|
4
|
+
*/
|
|
3
5
|
export declare abstract class BaseResponse {
|
|
4
6
|
/**
|
|
5
7
|
* Raw text representation of the API's response.
|
|
@@ -15,5 +17,7 @@ export declare abstract class BaseResponse {
|
|
|
15
17
|
*/
|
|
16
18
|
getRawHttp(): StringDict;
|
|
17
19
|
}
|
|
18
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Constructor signature for typed v2 response classes.
|
|
22
|
+
*/
|
|
19
23
|
export type ResponseConstructor<T extends BaseResponse> = new (serverResponse: StringDict) => T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/stringDict.js";
|
|
2
2
|
import { ErrorItem } from "./errorItem.js";
|
|
3
3
|
import { ErrorDetails } from "./errorDetails.js";
|
|
4
|
-
import { BaseResponse } from "
|
|
4
|
+
import { BaseResponse } from "../baseResponse.js";
|
|
5
5
|
/**
|
|
6
6
|
* Error response detailing a problem. The format adheres to RFC 9457.
|
|
7
7
|
*/
|
|
@@ -5,4 +5,6 @@ export { BaseInference, InferenceFile, InferenceModel, FailedInferenceResponse,
|
|
|
5
5
|
export { LocalResponse } from "./localResponse.js";
|
|
6
6
|
export { BaseResponse } from "./baseResponse.js";
|
|
7
7
|
export type { ResponseConstructor } from "./baseResponse.js";
|
|
8
|
+
export { BaseRagAnnotationResponse } from "./baseRagAnnotationResponse.js";
|
|
9
|
+
export type { AnnotationResponseConstructor } from "./baseRagAnnotationResponse.js";
|
|
8
10
|
export * as field from "./inference/field/index.js";
|
package/src/v2/parsing/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { Job, JobResponse, JobWebhook, } from "./job/index.js";
|
|
|
3
3
|
export { BaseInference, InferenceFile, InferenceModel, FailedInferenceResponse, } from "./inference/index.js";
|
|
4
4
|
export { LocalResponse } from "./localResponse.js";
|
|
5
5
|
export { BaseResponse } from "./baseResponse.js";
|
|
6
|
+
export { BaseRagAnnotationResponse } from "./baseRagAnnotationResponse.js";
|
|
6
7
|
export * as field from "./inference/field/index.js";
|
|
@@ -2,7 +2,9 @@ import { StringDict } from "../../../parsing/index.js";
|
|
|
2
2
|
import { InferenceModel } from "./inferenceModel.js";
|
|
3
3
|
import { InferenceFile } from "./inferenceFile.js";
|
|
4
4
|
import { InferenceJob } from "./inferenceJob.js";
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Shared metadata container for v2 inference payloads.
|
|
7
|
+
*/
|
|
6
8
|
export declare abstract class BaseInference {
|
|
7
9
|
/**
|
|
8
10
|
* Model info for the inference.
|
|
@@ -21,6 +23,8 @@ export declare abstract class BaseInference {
|
|
|
21
23
|
*/
|
|
22
24
|
id: string;
|
|
23
25
|
protected constructor(serverResponse: StringDict);
|
|
24
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Returns a printable representation of inference metadata.
|
|
28
|
+
*/
|
|
25
29
|
toString(): string;
|
|
26
30
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { InferenceModel } from "./inferenceModel.js";
|
|
2
2
|
import { InferenceFile } from "./inferenceFile.js";
|
|
3
3
|
import { InferenceJob } from "./inferenceJob.js";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Shared metadata container for v2 inference payloads.
|
|
6
|
+
*/
|
|
5
7
|
export class BaseInference {
|
|
6
8
|
constructor(serverResponse) {
|
|
7
9
|
this.id = serverResponse["id"];
|
|
@@ -9,7 +11,9 @@ export class BaseInference {
|
|
|
9
11
|
this.model = new InferenceModel(serverResponse["model"]);
|
|
10
12
|
this.file = new InferenceFile(serverResponse["file"]);
|
|
11
13
|
}
|
|
12
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Returns a printable representation of inference metadata.
|
|
16
|
+
*/
|
|
13
17
|
toString() {
|
|
14
18
|
return ("Inference\n" +
|
|
15
19
|
"#########\n" +
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/index.js";
|
|
2
|
-
import { ErrorResponse } from "
|
|
3
|
-
import { BaseResponse } from "
|
|
2
|
+
import { ErrorResponse } from "../../index.js";
|
|
3
|
+
import { BaseResponse } from "../baseResponse.js";
|
|
4
4
|
/**
|
|
5
5
|
* Webhook payload returned when an inference fails before producing a result.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseDate } from "../../../parsing/index.js";
|
|
2
|
-
import { ErrorResponse } from "
|
|
3
|
-
import { BaseResponse } from "
|
|
2
|
+
import { ErrorResponse } from "../../index.js";
|
|
3
|
+
import { BaseResponse } from "../baseResponse.js";
|
|
4
4
|
/**
|
|
5
5
|
* Webhook payload returned when an inference fails before producing a result.
|
|
6
6
|
*/
|
|
@@ -2,11 +2,17 @@ import { FieldConfidence } from "./fieldConfidence.js";
|
|
|
2
2
|
import { StringDict } from "../../../../parsing/stringDict.js";
|
|
3
3
|
import { FieldLocation } from "./fieldLocation.js";
|
|
4
4
|
export declare abstract class BaseField {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Indentation level used when rendering field text output.
|
|
7
|
+
*/
|
|
6
8
|
protected _indentLevel: number;
|
|
7
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Confidence level associated with this field.
|
|
11
|
+
*/
|
|
8
12
|
confidence: FieldConfidence | undefined;
|
|
9
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Optional list of source locations for this field.
|
|
15
|
+
*/
|
|
10
16
|
locations: Array<FieldLocation> | undefined;
|
|
11
17
|
protected constructor(rawResponse: StringDict, indentLevel?: number);
|
|
12
18
|
}
|
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
* Confidence level of a field as returned by the V2 API.
|
|
3
3
|
*/
|
|
4
4
|
export declare enum FieldConfidence {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Maximum confidence level.
|
|
7
|
+
*/
|
|
6
8
|
Certain = "Certain",
|
|
7
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* High confidence level.
|
|
11
|
+
*/
|
|
8
12
|
High = "High",
|
|
9
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Medium confidence level.
|
|
15
|
+
*/
|
|
10
16
|
Medium = "Medium",
|
|
11
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Low confidence level.
|
|
19
|
+
*/
|
|
12
20
|
Low = "Low"
|
|
13
21
|
}
|
|
14
22
|
export declare namespace FieldConfidence {
|
|
@@ -4,13 +4,21 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export var FieldConfidence;
|
|
6
6
|
(function (FieldConfidence) {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Maximum confidence level.
|
|
9
|
+
*/
|
|
8
10
|
FieldConfidence["Certain"] = "Certain";
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* High confidence level.
|
|
13
|
+
*/
|
|
10
14
|
FieldConfidence["High"] = "High";
|
|
11
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Medium confidence level.
|
|
17
|
+
*/
|
|
12
18
|
FieldConfidence["Medium"] = "Medium";
|
|
13
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Low confidence level.
|
|
21
|
+
*/
|
|
14
22
|
FieldConfidence["Low"] = "Low";
|
|
15
23
|
})(FieldConfidence || (FieldConfidence = {}));
|
|
16
24
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
@@ -4,11 +4,17 @@ import { StringDict } from "../../../../parsing/stringDict.js";
|
|
|
4
4
|
* A field's location on the document.
|
|
5
5
|
*/
|
|
6
6
|
export declare class FieldLocation {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Position information as a list of points in clockwise order.
|
|
9
|
+
*/
|
|
8
10
|
readonly polygon: Polygon;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* 0-based page index of where the polygon is located.
|
|
13
|
+
*/
|
|
10
14
|
readonly page: any;
|
|
11
15
|
constructor(serverResponse: StringDict);
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Returns a readable location string.
|
|
18
|
+
*/
|
|
13
19
|
toString(): string;
|
|
14
20
|
}
|
|
@@ -7,7 +7,9 @@ export class FieldLocation {
|
|
|
7
7
|
this.polygon = new Polygon(...serverResponse["polygon"]);
|
|
8
8
|
this.page = serverResponse["page"];
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Returns a readable location string.
|
|
12
|
+
*/
|
|
11
13
|
toString() {
|
|
12
14
|
return `${this.polygon} on page ${this.page}`;
|
|
13
15
|
}
|
|
@@ -2,16 +2,26 @@ import { StringDict } from "../../../../parsing/stringDict.js";
|
|
|
2
2
|
import type { ListField } from "./listField.js";
|
|
3
3
|
import type { ObjectField } from "./objectField.js";
|
|
4
4
|
import type { SimpleField } from "./simpleField.js";
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Typed map of extraction fields returned by the API.
|
|
7
|
+
*/
|
|
6
8
|
export declare class InferenceFields extends Map<string, SimpleField | ObjectField | ListField> {
|
|
7
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Indentation level used when rendering text output.
|
|
11
|
+
*/
|
|
8
12
|
protected _indentLevel: number;
|
|
9
13
|
constructor(serverResponse: StringDict, indentLevel?: number);
|
|
10
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Returns a field as a `SimpleField`, or throws if the type mismatches.
|
|
16
|
+
*/
|
|
11
17
|
getSimpleField(fieldName: string): SimpleField;
|
|
12
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Returns a field as an `ObjectField`, or throws if the type mismatches.
|
|
20
|
+
*/
|
|
13
21
|
getObjectField(fieldName: string): ObjectField;
|
|
14
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Returns a field as a `ListField`, or throws if the type mismatches.
|
|
24
|
+
*/
|
|
15
25
|
getListField(fieldName: string): ListField;
|
|
16
26
|
toString(indent?: number): string;
|
|
17
27
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createField } from "./fieldFactory.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Typed map of extraction fields returned by the API.
|
|
4
|
+
*/
|
|
3
5
|
export class InferenceFields extends Map {
|
|
4
6
|
constructor(serverResponse, indentLevel = 0) {
|
|
5
7
|
super(Object.entries(serverResponse).map(([key, value]) => {
|
|
@@ -7,7 +9,9 @@ export class InferenceFields extends Map {
|
|
|
7
9
|
}));
|
|
8
10
|
this._indentLevel = indentLevel;
|
|
9
11
|
}
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Returns a field as a `SimpleField`, or throws if the type mismatches.
|
|
14
|
+
*/
|
|
11
15
|
getSimpleField(fieldName) {
|
|
12
16
|
const field = this.get(fieldName);
|
|
13
17
|
if (field === undefined) {
|
|
@@ -18,7 +22,9 @@ export class InferenceFields extends Map {
|
|
|
18
22
|
}
|
|
19
23
|
return field;
|
|
20
24
|
}
|
|
21
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Returns a field as an `ObjectField`, or throws if the type mismatches.
|
|
27
|
+
*/
|
|
22
28
|
getObjectField(fieldName) {
|
|
23
29
|
const field = this.get(fieldName);
|
|
24
30
|
if (field === undefined) {
|
|
@@ -29,7 +35,9 @@ export class InferenceFields extends Map {
|
|
|
29
35
|
}
|
|
30
36
|
return field;
|
|
31
37
|
}
|
|
32
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Returns a field as a `ListField`, or throws if the type mismatches.
|
|
40
|
+
*/
|
|
33
41
|
getListField(fieldName) {
|
|
34
42
|
const field = this.get(fieldName);
|
|
35
43
|
if (field === undefined) {
|
|
@@ -2,7 +2,9 @@ import { StringDict } from "../../../../parsing/stringDict.js";
|
|
|
2
2
|
import { BaseField } from "./baseField.js";
|
|
3
3
|
import { ObjectField } from "./objectField.js";
|
|
4
4
|
import { SimpleField } from "./simpleField.js";
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* List-valued inference field.
|
|
7
|
+
*/
|
|
6
8
|
export declare class ListField extends BaseField {
|
|
7
9
|
/**
|
|
8
10
|
* Items contained in the list.
|
|
@@ -17,6 +19,8 @@ export declare class ListField extends BaseField {
|
|
|
17
19
|
* SimpleField items from the list.
|
|
18
20
|
*/
|
|
19
21
|
get objectItems(): Array<ObjectField>;
|
|
20
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Returns a readable representation of list items.
|
|
24
|
+
*/
|
|
21
25
|
toString(): string;
|
|
22
26
|
}
|
|
@@ -3,7 +3,9 @@ import { BaseField } from "./baseField.js";
|
|
|
3
3
|
import { ObjectField } from "./objectField.js";
|
|
4
4
|
import { SimpleField } from "./simpleField.js";
|
|
5
5
|
import { createField } from "./fieldFactory.js";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* List-valued inference field.
|
|
8
|
+
*/
|
|
7
9
|
export class ListField extends BaseField {
|
|
8
10
|
constructor(serverResponse, indentLevel = 0) {
|
|
9
11
|
super(serverResponse, indentLevel);
|
|
@@ -44,7 +46,9 @@ export class ListField extends BaseField {
|
|
|
44
46
|
}
|
|
45
47
|
return result;
|
|
46
48
|
}
|
|
47
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Returns a readable representation of list items.
|
|
51
|
+
*/
|
|
48
52
|
toString() {
|
|
49
53
|
if (!this.items || this.items.length === 0) {
|
|
50
54
|
return "\n";
|
|
@@ -3,10 +3,15 @@ import { StringDict } from "../../../../parsing/stringDict.js";
|
|
|
3
3
|
import { BaseField } from "./baseField.js";
|
|
4
4
|
import type { SimpleField } from "./simpleField.js";
|
|
5
5
|
import type { ListField } from "./listField.js";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Object-valued inference field.
|
|
8
|
+
*/
|
|
7
9
|
export declare class ObjectField extends BaseField {
|
|
8
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Nested fields carried by this object.
|
|
12
|
+
*/
|
|
9
13
|
readonly fields: InferenceFields;
|
|
14
|
+
constructor(serverResponse: StringDict, indentLevel?: number);
|
|
10
15
|
/**
|
|
11
16
|
* Retrieves the simple sub-fields in the object.
|
|
12
17
|
*
|
|
@@ -29,29 +34,32 @@ export declare class ObjectField extends BaseField {
|
|
|
29
34
|
* Retrieves a SimpleField by its name if it exists and is of the correct type.
|
|
30
35
|
*
|
|
31
36
|
* @param {string} fieldName - The name of the field to retrieve.
|
|
32
|
-
* @return {SimpleField} The
|
|
33
|
-
* @throws {Error} If the field does not exist or is
|
|
37
|
+
* @return {SimpleField} The field instance if it exists and is valid, or undefined if not.
|
|
38
|
+
* @throws {Error} If the field does not exist or is of wrong type.
|
|
34
39
|
*/
|
|
35
40
|
getSimpleField(fieldName: string): SimpleField;
|
|
36
41
|
/**
|
|
37
42
|
* Retrieves a ListField by its name if it exists and is of the correct type.
|
|
38
43
|
*
|
|
39
44
|
* @param {string} fieldName - The name of the field to retrieve.
|
|
40
|
-
* @return {ListField} The
|
|
41
|
-
* @throws {Error} If the field does not exist or is
|
|
45
|
+
* @return {ListField} The field instance if it exists and is valid, or undefined if not.
|
|
46
|
+
* @throws {Error} If the field does not exist or is of wrong type.
|
|
42
47
|
*/
|
|
43
48
|
getListField(fieldName: string): ListField;
|
|
44
49
|
/**
|
|
45
50
|
* Retrieves an ObjectField by its name if it exists and is of the correct type.
|
|
46
51
|
*
|
|
47
52
|
* @param {string} fieldName - The name of the field to retrieve.
|
|
48
|
-
* @return {ObjectField} The
|
|
49
|
-
* @throws {Error} If the field does not exist or is
|
|
53
|
+
* @return {ObjectField} The field instance if it exists and is valid, or undefined if not.
|
|
54
|
+
* @throws {Error} If the field does not exist or is of wrong type.
|
|
50
55
|
*/
|
|
51
56
|
getObjectField(fieldName: string): ObjectField;
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Returns a readable representation of nested fields.
|
|
59
|
+
*/
|
|
54
60
|
toString(): string;
|
|
55
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Returns a compact representation suitable for list items.
|
|
63
|
+
*/
|
|
56
64
|
toStringFromList(): string;
|
|
57
65
|
}
|