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.
Files changed (407) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +103 -95
  3. package/src/geometry/bbox.d.ts +18 -6
  4. package/src/geometry/bbox.js +7 -3
  5. package/src/geometry/boundingBox.d.ts +3 -1
  6. package/src/geometry/boundingBox.js +3 -1
  7. package/src/geometry/boundingBoxUtils.d.ts +4 -4
  8. package/src/geometry/boundingBoxUtils.js +7 -7
  9. package/src/geometry/minMax.d.ts +9 -3
  10. package/src/geometry/point.d.ts +3 -1
  11. package/src/geometry/polygon.d.ts +3 -1
  12. package/src/geometry/polygon.js +3 -1
  13. package/src/http/apiCore.js +1 -1
  14. package/src/http/baseSettings.d.ts +15 -5
  15. package/src/http/baseSettings.js +4 -2
  16. package/src/http/dispatcher.js +4 -2
  17. package/src/image/extractedImage.d.ts +13 -5
  18. package/src/image/extractedImage.js +3 -3
  19. package/src/image/extractedImages.d.ts +4 -2
  20. package/src/image/extractedImages.js +3 -1
  21. package/src/image/imageCompressor.d.ts +1 -0
  22. package/src/image/imageCompressor.js +2 -2
  23. package/src/image/imageExtractor.d.ts +2 -2
  24. package/src/image/imageExtractor.js +14 -14
  25. package/src/input/base64Input.d.ts +9 -3
  26. package/src/input/base64Input.js +9 -3
  27. package/src/input/bufferInput.d.ts +7 -2
  28. package/src/input/bufferInput.js +6 -2
  29. package/src/input/bytesInput.d.ts +10 -3
  30. package/src/input/bytesInput.js +10 -3
  31. package/src/input/inputSource.d.ts +4 -2
  32. package/src/input/inputSource.js +3 -2
  33. package/src/input/localInputSource.d.ts +20 -7
  34. package/src/input/localInputSource.js +12 -5
  35. package/src/input/pageOptions.d.ts +9 -3
  36. package/src/input/pageOptions.js +6 -2
  37. package/src/input/pathInput.d.ts +12 -4
  38. package/src/input/pathInput.js +11 -5
  39. package/src/input/streamInput.d.ts +14 -5
  40. package/src/input/streamInput.js +13 -4
  41. package/src/input/urlInput.d.ts +19 -7
  42. package/src/input/urlInput.js +20 -12
  43. package/src/parsing/baseLocalResponse.d.ts +8 -4
  44. package/src/parsing/baseLocalResponse.js +15 -11
  45. package/src/parsing/stringDict.d.ts +3 -1
  46. package/src/pdf/extractedPdf.d.ts +16 -6
  47. package/src/pdf/extractedPdf.js +5 -3
  48. package/src/pdf/extractedPdfs.d.ts +4 -2
  49. package/src/pdf/extractedPdfs.js +3 -1
  50. package/src/pdf/pdfCompressor.js +14 -14
  51. package/src/pdf/pdfExtractor.d.ts +1 -1
  52. package/src/pdf/pdfExtractor.js +3 -3
  53. package/src/pdf/pdfOperation.d.ts +9 -3
  54. package/src/pdf/pdfOperation.js +14 -14
  55. package/src/pdf/pdfUtils.js +1 -1
  56. package/src/v1/cli.js +1 -1
  57. package/src/v1/client.d.ts +42 -14
  58. package/src/v1/client.js +8 -8
  59. package/src/v1/extraction/invoiceSplitterExtractor/extractedInvoiceSplitterImage.d.ts +6 -2
  60. package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.d.ts +2 -2
  61. package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.js +6 -6
  62. package/src/v1/extraction/multiReceiptsExtractor/extractedMultiReceiptImage.d.ts +6 -2
  63. package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.d.ts +2 -2
  64. package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.js +3 -3
  65. package/src/v1/http/apiSettingsV1.d.ts +15 -5
  66. package/src/v1/http/apiSettingsV1.js +12 -4
  67. package/src/v1/http/baseEndpoint.d.ts +7 -3
  68. package/src/v1/http/endpoint.d.ts +10 -4
  69. package/src/v1/http/endpoint.js +2 -2
  70. package/src/v1/http/errors.d.ts +9 -3
  71. package/src/v1/http/errors.js +6 -2
  72. package/src/v1/http/httpParams.d.ts +37 -13
  73. package/src/v1/http/workflowEndpoint.d.ts +2 -2
  74. package/src/v1/http/workflowEndpoint.js +2 -2
  75. package/src/v1/parsing/common/apiRequest.d.ts +15 -5
  76. package/src/v1/parsing/common/apiResponse.d.ts +6 -2
  77. package/src/v1/parsing/common/asyncPredictResponse.d.ts +21 -7
  78. package/src/v1/parsing/common/document.d.ts +18 -6
  79. package/src/v1/parsing/common/document.js +2 -2
  80. package/src/v1/parsing/common/execution.d.ts +40 -14
  81. package/src/v1/parsing/common/execution.js +1 -1
  82. package/src/v1/parsing/common/executionFile.d.ts +6 -2
  83. package/src/v1/parsing/common/executionPriority.d.ts +12 -4
  84. package/src/v1/parsing/common/executionPriority.js +12 -4
  85. package/src/v1/parsing/common/extras/cropperExtra.d.ts +7 -3
  86. package/src/v1/parsing/common/extras/cropperExtra.js +7 -4
  87. package/src/v1/parsing/common/extras/extras.d.ts +9 -3
  88. package/src/v1/parsing/common/extras/extras.js +6 -2
  89. package/src/v1/parsing/common/extras/fullTextOcrExtra.d.ts +9 -3
  90. package/src/v1/parsing/common/extras/fullTextOcrExtra.js +3 -1
  91. package/src/v1/parsing/common/extras/ragExtra.d.ts +3 -1
  92. package/src/v1/parsing/common/extras/ragExtra.js +3 -1
  93. package/src/v1/parsing/common/feedback/feedbackResponse.d.ts +3 -1
  94. package/src/v1/parsing/common/feedback/feedbackResponse.js +0 -1
  95. package/src/v1/parsing/common/inference.d.ts +24 -8
  96. package/src/v1/parsing/common/inference.js +6 -2
  97. package/src/v1/parsing/common/mvisionV1.d.ts +3 -1
  98. package/src/v1/parsing/common/mvisionV1.js +3 -1
  99. package/src/v1/parsing/common/ocr.d.ts +3 -1
  100. package/src/v1/parsing/common/ocrPage.d.ts +7 -3
  101. package/src/v1/parsing/common/ocrPage.js +7 -3
  102. package/src/v1/parsing/common/orientation.d.ts +7 -3
  103. package/src/v1/parsing/common/orientation.js +1 -1
  104. package/src/v1/parsing/common/page.d.ts +12 -4
  105. package/src/v1/parsing/common/predictResponse.d.ts +3 -1
  106. package/src/v1/parsing/common/prediction.d.ts +3 -1
  107. package/src/v1/parsing/common/prediction.js +3 -1
  108. package/src/v1/parsing/generated/generatedList.d.ts +7 -3
  109. package/src/v1/parsing/generated/generatedList.js +1 -1
  110. package/src/v1/parsing/generated/generatedObject.d.ts +26 -10
  111. package/src/v1/parsing/generated/generatedObject.js +14 -8
  112. package/src/v1/parsing/localResponse.d.ts +4 -2
  113. package/src/v1/parsing/localResponse.js +4 -2
  114. package/src/v1/parsing/standard/addressField.d.ts +24 -8
  115. package/src/v1/parsing/standard/amount.d.ts +3 -1
  116. package/src/v1/parsing/standard/amount.js +4 -2
  117. package/src/v1/parsing/standard/base.d.ts +27 -9
  118. package/src/v1/parsing/standard/base.js +6 -2
  119. package/src/v1/parsing/standard/boolean.d.ts +3 -1
  120. package/src/v1/parsing/standard/classification.d.ts +6 -2
  121. package/src/v1/parsing/standard/companyRegistration.d.ts +9 -3
  122. package/src/v1/parsing/standard/companyRegistration.js +4 -2
  123. package/src/v1/parsing/standard/date.d.ts +12 -4
  124. package/src/v1/parsing/standard/date.js +3 -1
  125. package/src/v1/parsing/standard/field.d.ts +7 -5
  126. package/src/v1/parsing/standard/field.js +4 -4
  127. package/src/v1/parsing/standard/locale.d.ts +15 -5
  128. package/src/v1/parsing/standard/paymentDetails.d.ts +15 -5
  129. package/src/v1/parsing/standard/position.d.ts +15 -5
  130. package/src/v1/parsing/standard/tax.d.ts +19 -7
  131. package/src/v1/parsing/standard/tax.js +16 -6
  132. package/src/v1/parsing/standard/text.d.ts +6 -2
  133. package/src/v1/parsing/standard/word.d.ts +9 -3
  134. package/src/v1/parsing/standard/word.js +3 -1
  135. package/src/v1/product/barcodeReader/barcodeReaderV1.d.ts +13 -5
  136. package/src/v1/product/barcodeReader/barcodeReaderV1.js +10 -4
  137. package/src/v1/product/barcodeReader/barcodeReaderV1Document.d.ts +8 -4
  138. package/src/v1/product/barcodeReader/barcodeReaderV1Document.js +8 -4
  139. package/src/v1/product/cliProducts.d.ts +2 -2
  140. package/src/v1/product/cliProducts.js +1 -1
  141. package/src/v1/product/cropper/cropperV1.d.ts +13 -5
  142. package/src/v1/product/cropper/cropperV1.js +10 -4
  143. package/src/v1/product/cropper/cropperV1Document.d.ts +1 -1
  144. package/src/v1/product/cropper/cropperV1Page.d.ts +5 -3
  145. package/src/v1/product/cropper/cropperV1Page.js +5 -3
  146. package/src/v1/product/driverLicense/driverLicenseV1.d.ts +13 -5
  147. package/src/v1/product/driverLicense/driverLicenseV1.js +10 -4
  148. package/src/v1/product/driverLicense/driverLicenseV1Document.d.ts +41 -15
  149. package/src/v1/product/driverLicense/driverLicenseV1Document.js +2 -2
  150. package/src/v1/product/financialDocument/financialDocumentV1.d.ts +13 -5
  151. package/src/v1/product/financialDocument/financialDocumentV1.js +10 -4
  152. package/src/v1/product/financialDocument/financialDocumentV1Document.d.ts +98 -34
  153. package/src/v1/product/financialDocument/financialDocumentV1Document.js +17 -7
  154. package/src/v1/product/financialDocument/financialDocumentV1LineItem.d.ts +30 -10
  155. package/src/v1/product/financialDocument/financialDocumentV1LineItem.js +4 -2
  156. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1.d.ts +13 -5
  157. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1.js +10 -4
  158. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1Document.d.ts +11 -5
  159. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV1Document.js +2 -2
  160. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2.d.ts +13 -5
  161. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2.js +10 -4
  162. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Bban.d.ts +18 -6
  163. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Bban.js +3 -1
  164. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Document.d.ts +14 -6
  165. package/src/v1/product/fr/bankAccountDetails/bankAccountDetailsV2Document.js +2 -2
  166. package/src/v1/product/fr/carteGrise/carteGriseV1.d.ts +13 -5
  167. package/src/v1/product/fr/carteGrise/carteGriseV1.js +10 -4
  168. package/src/v1/product/fr/carteGrise/carteGriseV1Document.d.ts +125 -43
  169. package/src/v1/product/fr/carteGrise/carteGriseV1Document.js +2 -2
  170. package/src/v1/product/fr/idCard/idCardV2.d.ts +13 -5
  171. package/src/v1/product/fr/idCard/idCardV2.js +10 -4
  172. package/src/v1/product/fr/idCard/idCardV2Document.d.ts +47 -17
  173. package/src/v1/product/fr/idCard/idCardV2Document.js +5 -3
  174. package/src/v1/product/fr/idCard/idCardV2Page.d.ts +8 -4
  175. package/src/v1/product/fr/idCard/idCardV2Page.js +2 -2
  176. package/src/v1/product/generated/generatedV1.d.ts +13 -5
  177. package/src/v1/product/generated/generatedV1.js +10 -4
  178. package/src/v1/product/generated/generatedV1Document.js +2 -2
  179. package/src/v1/product/generated/generatedV1Page.js +2 -2
  180. package/src/v1/product/generated/generatedV1Prediction.d.ts +9 -5
  181. package/src/v1/product/generated/generatedV1Prediction.js +6 -4
  182. package/src/v1/product/internationalId/internationalIdV2.d.ts +13 -5
  183. package/src/v1/product/internationalId/internationalIdV2.js +10 -4
  184. package/src/v1/product/internationalId/internationalIdV2Document.d.ts +53 -19
  185. package/src/v1/product/internationalId/internationalIdV2Document.js +8 -4
  186. package/src/v1/product/invoice/invoiceV4.d.ts +13 -5
  187. package/src/v1/product/invoice/invoiceV4.js +10 -4
  188. package/src/v1/product/invoice/invoiceV4Document.d.ts +89 -31
  189. package/src/v1/product/invoice/invoiceV4Document.js +17 -7
  190. package/src/v1/product/invoice/invoiceV4LineItem.d.ts +30 -10
  191. package/src/v1/product/invoice/invoiceV4LineItem.js +4 -2
  192. package/src/v1/product/invoiceSplitter/invoiceSplitterV1.d.ts +13 -5
  193. package/src/v1/product/invoiceSplitter/invoiceSplitterV1.js +10 -4
  194. package/src/v1/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +4 -2
  195. package/src/v1/product/invoiceSplitter/invoiceSplitterV1Document.js +4 -2
  196. package/src/v1/product/invoiceSplitter/invoiceSplitterV1InvoicePageGroup.d.ts +9 -3
  197. package/src/v1/product/invoiceSplitter/invoiceSplitterV1InvoicePageGroup.js +3 -1
  198. package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1.d.ts +13 -5
  199. package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1.js +10 -4
  200. package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.d.ts +5 -3
  201. package/src/v1/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.js +5 -3
  202. package/src/v1/product/passport/passportV1.d.ts +13 -5
  203. package/src/v1/product/passport/passportV1.js +10 -4
  204. package/src/v1/product/passport/passportV1Document.d.ts +35 -13
  205. package/src/v1/product/passport/passportV1Document.js +5 -3
  206. package/src/v1/product/receipt/receiptV5.d.ts +13 -5
  207. package/src/v1/product/receipt/receiptV5.js +10 -4
  208. package/src/v1/product/receipt/receiptV5Document.d.ts +53 -19
  209. package/src/v1/product/receipt/receiptV5Document.js +8 -4
  210. package/src/v1/product/receipt/receiptV5LineItem.d.ts +18 -6
  211. package/src/v1/product/receipt/receiptV5LineItem.js +4 -2
  212. package/src/v1/product/resume/resumeV1.d.ts +13 -5
  213. package/src/v1/product/resume/resumeV1.js +10 -4
  214. package/src/v1/product/resume/resumeV1Certificate.d.ts +18 -6
  215. package/src/v1/product/resume/resumeV1Certificate.js +4 -2
  216. package/src/v1/product/resume/resumeV1Document.d.ts +53 -19
  217. package/src/v1/product/resume/resumeV1Document.js +29 -11
  218. package/src/v1/product/resume/resumeV1Education.d.ts +27 -9
  219. package/src/v1/product/resume/resumeV1Education.js +4 -2
  220. package/src/v1/product/resume/resumeV1Language.d.ts +12 -4
  221. package/src/v1/product/resume/resumeV1Language.js +4 -2
  222. package/src/v1/product/resume/resumeV1ProfessionalExperience.d.ts +33 -11
  223. package/src/v1/product/resume/resumeV1ProfessionalExperience.js +4 -2
  224. package/src/v1/product/resume/resumeV1SocialNetworksUrl.d.ts +12 -4
  225. package/src/v1/product/resume/resumeV1SocialNetworksUrl.js +4 -2
  226. package/src/v1/product/us/bankCheck/bankCheckV1.d.ts +13 -5
  227. package/src/v1/product/us/bankCheck/bankCheckV1.js +10 -4
  228. package/src/v1/product/us/bankCheck/bankCheckV1Document.d.ts +20 -8
  229. package/src/v1/product/us/bankCheck/bankCheckV1Document.js +5 -3
  230. package/src/v1/product/us/bankCheck/bankCheckV1Page.d.ts +8 -4
  231. package/src/v1/product/us/bankCheck/bankCheckV1Page.js +5 -3
  232. package/src/v2/cli.js +2 -2
  233. package/src/v2/client.d.ts +103 -21
  234. package/src/v2/client.js +171 -27
  235. package/src/v2/clientOptions/baseAnnotationParameters.d.ts +23 -0
  236. package/src/v2/clientOptions/baseAnnotationParameters.js +17 -0
  237. package/src/v2/clientOptions/baseProductParameters.js +3 -2
  238. package/src/v2/clientOptions/baseRagDocumentUploadParameters.d.ts +23 -0
  239. package/src/v2/clientOptions/baseRagDocumentUploadParameters.js +24 -0
  240. package/src/v2/clientOptions/index.d.ts +2 -0
  241. package/src/v2/clientOptions/index.js +2 -0
  242. package/src/v2/clientOptions/pollingOptions.d.ts +30 -10
  243. package/src/v2/clientOptions/pollingOptions.js +6 -2
  244. package/src/v2/fileOperations/crop.d.ts +1 -1
  245. package/src/v2/http/errors.d.ts +1 -1
  246. package/src/v2/http/mindeeApiV2.d.ts +36 -7
  247. package/src/v2/http/mindeeApiV2.js +80 -4
  248. package/src/v2/parsing/baseRagAnnotationResponse.d.ts +28 -0
  249. package/src/v2/parsing/baseRagAnnotationResponse.js +14 -0
  250. package/src/v2/parsing/baseResponse.d.ts +6 -2
  251. package/src/v2/parsing/baseResponse.js +3 -1
  252. package/src/v2/parsing/error/errorDetails.d.ts +3 -1
  253. package/src/v2/parsing/error/errorResponse.d.ts +1 -1
  254. package/src/v2/parsing/error/errorResponse.js +1 -1
  255. package/src/v2/parsing/index.d.ts +2 -0
  256. package/src/v2/parsing/index.js +1 -0
  257. package/src/v2/parsing/inference/baseInference.d.ts +6 -2
  258. package/src/v2/parsing/inference/baseInference.js +6 -2
  259. package/src/v2/parsing/inference/failedInferenceResponse.d.ts +2 -2
  260. package/src/v2/parsing/inference/failedInferenceResponse.js +2 -2
  261. package/src/v2/parsing/inference/field/baseField.d.ts +9 -3
  262. package/src/v2/parsing/inference/field/fieldConfidence.d.ts +12 -4
  263. package/src/v2/parsing/inference/field/fieldConfidence.js +12 -4
  264. package/src/v2/parsing/inference/field/fieldLocation.d.ts +9 -3
  265. package/src/v2/parsing/inference/field/fieldLocation.js +3 -1
  266. package/src/v2/parsing/inference/field/inferenceFields.d.ts +15 -5
  267. package/src/v2/parsing/inference/field/inferenceFields.js +12 -4
  268. package/src/v2/parsing/inference/field/listField.d.ts +6 -2
  269. package/src/v2/parsing/inference/field/listField.js +6 -2
  270. package/src/v2/parsing/inference/field/objectField.d.ts +19 -11
  271. package/src/v2/parsing/inference/field/objectField.js +22 -34
  272. package/src/v2/parsing/inference/field/ragMetadata.d.ts +3 -1
  273. package/src/v2/parsing/inference/field/ragMetadata.js +3 -1
  274. package/src/v2/parsing/inference/field/rawText.d.ts +6 -2
  275. package/src/v2/parsing/inference/field/rawText.js +6 -2
  276. package/src/v2/parsing/inference/field/simpleField.d.ts +6 -2
  277. package/src/v2/parsing/inference/field/simpleField.js +8 -4
  278. package/src/v2/parsing/inference/inferenceFile.d.ts +6 -2
  279. package/src/v2/parsing/inference/inferenceFile.js +6 -2
  280. package/src/v2/parsing/inference/inferenceModel.d.ts +6 -2
  281. package/src/v2/parsing/inference/inferenceModel.js +6 -2
  282. package/src/v2/parsing/job/job.d.ts +8 -8
  283. package/src/v2/parsing/job/job.js +1 -1
  284. package/src/v2/parsing/job/jobResponse.d.ts +1 -1
  285. package/src/v2/parsing/job/jobResponse.js +1 -1
  286. package/src/v2/parsing/job/jobWebhook.d.ts +1 -1
  287. package/src/v2/parsing/job/jobWebhook.js +1 -1
  288. package/src/v2/parsing/search/baseSearchResponse.d.ts +1 -1
  289. package/src/v2/parsing/search/baseSearchResponse.js +1 -1
  290. package/src/v2/parsing/search/searchModels.d.ts +1 -1
  291. package/src/v2/parsing/search/searchModels.js +1 -1
  292. package/src/v2/parsing/search/searchRagDocuments.d.ts +1 -1
  293. package/src/v2/parsing/search/searchRagDocuments.js +1 -1
  294. package/src/v2/parsing/search/searchResponse.d.ts +1 -1
  295. package/src/v2/parsing/search/searchResponse.js +1 -1
  296. package/src/v2/product/baseProduct.d.ts +26 -6
  297. package/src/v2/product/baseProduct.js +31 -7
  298. package/src/v2/product/classification/classification.d.ts +10 -4
  299. package/src/v2/product/classification/classification.js +10 -4
  300. package/src/v2/product/classification/classificationClassifier.d.ts +7 -3
  301. package/src/v2/product/classification/classificationClassifier.js +7 -3
  302. package/src/v2/product/classification/classificationInference.d.ts +7 -3
  303. package/src/v2/product/classification/classificationInference.js +7 -3
  304. package/src/v2/product/classification/classificationResponse.d.ts +4 -2
  305. package/src/v2/product/classification/classificationResponse.js +4 -2
  306. package/src/v2/product/classification/classificationResult.d.ts +6 -2
  307. package/src/v2/product/classification/classificationResult.js +6 -2
  308. package/src/v2/product/classification/params/classificationParameters.d.ts +1 -1
  309. package/src/v2/product/classification/params/classificationParameters.js +1 -1
  310. package/src/v2/product/crop/crop.d.ts +10 -4
  311. package/src/v2/product/crop/crop.js +10 -4
  312. package/src/v2/product/crop/cropInference.d.ts +8 -4
  313. package/src/v2/product/crop/cropInference.js +8 -4
  314. package/src/v2/product/crop/cropItem.d.ts +8 -4
  315. package/src/v2/product/crop/cropItem.js +9 -5
  316. package/src/v2/product/crop/cropResponse.d.ts +4 -2
  317. package/src/v2/product/crop/cropResponse.js +4 -2
  318. package/src/v2/product/crop/cropResult.d.ts +7 -3
  319. package/src/v2/product/crop/cropResult.js +8 -4
  320. package/src/v2/product/crop/params/cropParameters.d.ts +1 -1
  321. package/src/v2/product/crop/params/cropParameters.js +1 -1
  322. package/src/v2/product/extraction/dataSchemaActiveOption.d.ts +3 -1
  323. package/src/v2/product/extraction/dataSchemaActiveOption.js +3 -1
  324. package/src/v2/product/extraction/extraction.d.ts +25 -5
  325. package/src/v2/product/extraction/extraction.js +32 -6
  326. package/src/v2/product/extraction/extractionActiveOptions.d.ts +6 -2
  327. package/src/v2/product/extraction/extractionActiveOptions.js +6 -2
  328. package/src/v2/product/extraction/extractionInference.d.ts +7 -3
  329. package/src/v2/product/extraction/extractionInference.js +7 -3
  330. package/src/v2/product/extraction/extractionResponse.d.ts +4 -2
  331. package/src/v2/product/extraction/extractionResponse.js +4 -2
  332. package/src/v2/product/extraction/extractionResult.d.ts +9 -5
  333. package/src/v2/product/extraction/extractionResult.js +9 -5
  334. package/src/v2/product/extraction/index.d.ts +1 -0
  335. package/src/v2/product/extraction/index.js +1 -0
  336. package/src/v2/product/extraction/params/dataSchema.d.ts +12 -4
  337. package/src/v2/product/extraction/params/dataSchema.js +6 -2
  338. package/src/v2/product/extraction/params/dataSchemaField.d.ts +39 -13
  339. package/src/v2/product/extraction/params/dataSchemaField.js +9 -3
  340. package/src/v2/product/extraction/params/dataSchemaReplace.d.ts +12 -4
  341. package/src/v2/product/extraction/params/dataSchemaReplace.js +6 -2
  342. package/src/v2/product/extraction/params/extractionParameters.d.ts +1 -1
  343. package/src/v2/product/extraction/params/extractionParameters.js +4 -4
  344. package/src/v2/product/extraction/ragDocuments/annotatedBaseField.d.ts +20 -0
  345. package/src/v2/product/extraction/ragDocuments/annotatedBaseField.js +15 -0
  346. package/src/v2/product/extraction/ragDocuments/annotatedFields.d.ts +27 -0
  347. package/src/v2/product/extraction/ragDocuments/annotatedFields.js +57 -0
  348. package/src/v2/product/extraction/ragDocuments/annotatedListField.d.ts +26 -0
  349. package/src/v2/product/extraction/ragDocuments/annotatedListField.js +69 -0
  350. package/src/v2/product/extraction/ragDocuments/annotatedObjectField.d.ts +43 -0
  351. package/src/v2/product/extraction/ragDocuments/annotatedObjectField.js +47 -0
  352. package/src/v2/product/extraction/ragDocuments/annotatedSimpleField.d.ts +15 -0
  353. package/src/v2/product/extraction/ragDocuments/annotatedSimpleField.js +13 -0
  354. package/src/v2/product/extraction/ragDocuments/extractionRagAnnotationResponse.d.ts +25 -0
  355. package/src/v2/product/extraction/ragDocuments/extractionRagAnnotationResponse.js +17 -0
  356. package/src/v2/product/extraction/ragDocuments/fieldFactory.d.ts +12 -0
  357. package/src/v2/product/extraction/ragDocuments/fieldFactory.js +23 -0
  358. package/src/v2/product/extraction/ragDocuments/index.d.ts +7 -0
  359. package/src/v2/product/extraction/ragDocuments/index.js +7 -0
  360. package/src/v2/product/extraction/ragDocuments/params/index.d.ts +2 -0
  361. package/src/v2/product/extraction/ragDocuments/params/index.js +2 -0
  362. package/src/v2/product/extraction/ragDocuments/params/ragDocumentAnnotationParameters.d.ts +27 -0
  363. package/src/v2/product/extraction/ragDocuments/params/ragDocumentAnnotationParameters.js +43 -0
  364. package/src/v2/product/extraction/ragDocuments/params/ragDocumentUploadParameters.d.ts +7 -0
  365. package/src/v2/product/extraction/ragDocuments/params/ragDocumentUploadParameters.js +9 -0
  366. package/src/v2/product/extraction/ragDocuments/ragAnnotation.d.ts +12 -0
  367. package/src/v2/product/extraction/ragDocuments/ragAnnotation.js +9 -0
  368. package/src/v2/product/ocr/ocr.d.ts +10 -4
  369. package/src/v2/product/ocr/ocr.js +10 -4
  370. package/src/v2/product/ocr/ocrInference.d.ts +8 -4
  371. package/src/v2/product/ocr/ocrInference.js +8 -4
  372. package/src/v2/product/ocr/ocrPage.d.ts +6 -2
  373. package/src/v2/product/ocr/ocrPage.js +6 -2
  374. package/src/v2/product/ocr/ocrResponse.d.ts +4 -2
  375. package/src/v2/product/ocr/ocrResponse.js +4 -2
  376. package/src/v2/product/ocr/ocrResult.d.ts +3 -1
  377. package/src/v2/product/ocr/ocrResult.js +3 -1
  378. package/src/v2/product/ocr/ocrWord.d.ts +6 -2
  379. package/src/v2/product/ocr/ocrWord.js +6 -2
  380. package/src/v2/product/ocr/params/ocrParameters.d.ts +1 -1
  381. package/src/v2/product/ocr/params/ocrParameters.js +1 -1
  382. package/src/v2/product/split/params/splitParameters.d.ts +1 -1
  383. package/src/v2/product/split/params/splitParameters.js +1 -1
  384. package/src/v2/product/split/split.d.ts +10 -4
  385. package/src/v2/product/split/split.js +10 -4
  386. package/src/v2/product/split/splitInference.d.ts +7 -3
  387. package/src/v2/product/split/splitInference.js +7 -3
  388. package/src/v2/product/split/splitRange.d.ts +4 -2
  389. package/src/v2/product/split/splitRange.js +5 -3
  390. package/src/v2/product/split/splitResponse.d.ts +4 -2
  391. package/src/v2/product/split/splitResponse.js +4 -2
  392. package/src/v2/product/split/splitResult.d.ts +3 -1
  393. package/src/v2/product/split/splitResult.js +4 -2
  394. package/src/v2/search/baseSearch.d.ts +11 -5
  395. package/src/v2/search/baseSearch.js +9 -3
  396. package/src/v2/search/models/modelSearch.d.ts +12 -6
  397. package/src/v2/search/models/modelSearch.js +12 -6
  398. package/src/v2/search/models/modelSearchParameters.d.ts +4 -2
  399. package/src/v2/search/models/modelSearchParameters.js +4 -2
  400. package/src/v2/search/models/modelSearchResponse.d.ts +2 -2
  401. package/src/v2/search/models/modelSearchResponse.js +2 -2
  402. package/src/v2/search/ragDocuments/ragDocumentSearch.d.ts +12 -6
  403. package/src/v2/search/ragDocuments/ragDocumentSearch.js +12 -6
  404. package/src/v2/search/ragDocuments/ragDocumentSearchParameters.d.ts +4 -2
  405. package/src/v2/search/ragDocuments/ragDocumentSearchParameters.js +4 -2
  406. package/src/v2/search/ragDocuments/ragDocumentSearchResponse.d.ts +2 -2
  407. package/src/v2/search/ragDocuments/ragDocumentSearchResponse.js +2 -2
@@ -1,8 +1,12 @@
1
1
  import { StringDict } from "../../../../parsing/stringDict.js";
2
2
  import { DataSchemaReplace, DataSchemaReplaceJson } from "./dataSchemaReplace.js";
3
- /** JSON payload for top-level data schema options. */
3
+ /**
4
+ * JSON payload for top-level data schema options.
5
+ */
4
6
  export interface DataSchemaJson {
5
- /** Optional full replacement schema. */
7
+ /**
8
+ * Optional full replacement schema.
9
+ */
6
10
  replace?: DataSchemaReplaceJson;
7
11
  }
8
12
  /**
@@ -14,8 +18,12 @@ export declare class DataSchema {
14
18
  */
15
19
  replace?: DataSchemaReplace;
16
20
  constructor(dataSchema: StringDict | string);
17
- /** Serializes the data schema parameters to API format. */
21
+ /**
22
+ * Serializes the data schema parameters to API format.
23
+ */
18
24
  toJSON(): DataSchemaJson;
19
- /** Returns a JSON string representation of the data schema parameters. */
25
+ /**
26
+ * Returns a JSON string representation of the data schema parameters.
27
+ */
20
28
  toString(): string;
21
29
  }
@@ -14,11 +14,15 @@ export class DataSchema {
14
14
  this.replace = new DataSchemaReplace(dataSchema["replace"]);
15
15
  }
16
16
  }
17
- /** Serializes the data schema parameters to API format. */
17
+ /**
18
+ * Serializes the data schema parameters to API format.
19
+ */
18
20
  toJSON() {
19
21
  return { replace: this.replace?.toJSON() };
20
22
  }
21
- /** Returns a JSON string representation of the data schema parameters. */
23
+ /**
24
+ * Returns a JSON string representation of the data schema parameters.
25
+ */
22
26
  toString() {
23
27
  return JSON.stringify(this.toJSON());
24
28
  }
@@ -1,26 +1,48 @@
1
1
  import { StringDict } from "../../../../parsing/index.js";
2
- /** JSON payload for a single data schema field definition. */
2
+ /**
3
+ * JSON payload for a single data schema field definition.
4
+ */
3
5
  export interface DataSchemaFieldJson {
4
- /** Field key used in results. */
6
+ /**
7
+ * Field key used in results.
8
+ */
5
9
  name: string;
6
- /** Human-readable field title. */
10
+ /**
11
+ * Human-readable field title.
12
+ */
7
13
  title: string;
8
- /** Whether the field accepts multiple values. */
14
+ /**
15
+ * Whether the field accepts multiple values.
16
+ */
9
17
  is_array: boolean;
10
- /** Field type name. */
18
+ /**
19
+ * Field type name.
20
+ */
11
21
  type: string;
12
- /** Optional allowed classes for classification fields. */
22
+ /**
23
+ * Optional allowed classes for classification fields.
24
+ */
13
25
  classification_values?: Array<string>;
14
- /** Optional deduplication behavior for array fields. */
26
+ /**
27
+ * Optional deduplication behavior for array fields.
28
+ */
15
29
  unique_values?: boolean;
16
- /** Optional field description. */
30
+ /**
31
+ * Optional field description.
32
+ */
17
33
  description?: string;
18
- /** Optional extraction guidelines. */
34
+ /**
35
+ * Optional extraction guidelines.
36
+ */
19
37
  guidelines?: string;
20
- /** Optional nested schema for object fields. */
38
+ /**
39
+ * Optional nested schema for object fields.
40
+ */
21
41
  nested_fields?: StringDict;
22
42
  }
23
- /** Data schema field definition used by extraction parameters. */
43
+ /**
44
+ * Data schema field definition used by extraction parameters.
45
+ */
24
46
  export declare class DataSchemaField {
25
47
  /**
26
48
  * Display name for the field, also impacts inference results.
@@ -60,8 +82,12 @@ export declare class DataSchemaField {
60
82
  */
61
83
  nestedFields?: StringDict;
62
84
  constructor(fields: StringDict);
63
- /** Serializes the field definition to API format. */
85
+ /**
86
+ * Serializes the field definition to API format.
87
+ */
64
88
  toJSON(): DataSchemaFieldJson;
65
- /** Returns a JSON string representation of the field definition. */
89
+ /**
90
+ * Returns a JSON string representation of the field definition.
91
+ */
66
92
  toString(): string;
67
93
  }
@@ -1,4 +1,6 @@
1
- /** Data schema field definition used by extraction parameters. */
1
+ /**
2
+ * Data schema field definition used by extraction parameters.
3
+ */
2
4
  export class DataSchemaField {
3
5
  constructor(fields) {
4
6
  this.name = fields["name"];
@@ -11,7 +13,9 @@ export class DataSchemaField {
11
13
  this.guidelines = fields["guidelines"];
12
14
  this.nestedFields = fields["nested_fields"];
13
15
  }
14
- /** Serializes the field definition to API format. */
16
+ /**
17
+ * Serializes the field definition to API format.
18
+ */
15
19
  toJSON() {
16
20
  const out = {
17
21
  name: this.name,
@@ -35,7 +39,9 @@ export class DataSchemaField {
35
39
  out.nested_fields = this.nestedFields;
36
40
  return out;
37
41
  }
38
- /** Returns a JSON string representation of the field definition. */
42
+ /**
43
+ * Returns a JSON string representation of the field definition.
44
+ */
39
45
  toString() {
40
46
  return JSON.stringify(this.toJSON());
41
47
  }
@@ -1,8 +1,12 @@
1
1
  import { StringDict } from "../../../../parsing/index.js";
2
2
  import { DataSchemaField, DataSchemaFieldJson } from "./dataSchemaField.js";
3
- /** JSON payload for replacement data schema options. */
3
+ /**
4
+ * JSON payload for replacement data schema options.
5
+ */
4
6
  export interface DataSchemaReplaceJson {
5
- /** Field definitions replacing the current schema. */
7
+ /**
8
+ * Field definitions replacing the current schema.
9
+ */
6
10
  fields: Array<DataSchemaFieldJson>;
7
11
  }
8
12
  /**
@@ -14,8 +18,12 @@ export declare class DataSchemaReplace {
14
18
  */
15
19
  fields: Array<DataSchemaField>;
16
20
  constructor(dataSchemaReplace: StringDict);
17
- /** Serializes the replacement schema to API format. */
21
+ /**
22
+ * Serializes the replacement schema to API format.
23
+ */
18
24
  toJSON(): DataSchemaReplaceJson;
19
- /** Returns a JSON string representation of the replacement schema. */
25
+ /**
26
+ * Returns a JSON string representation of the replacement schema.
27
+ */
20
28
  toString(): string;
21
29
  }
@@ -13,11 +13,15 @@ export class DataSchemaReplace {
13
13
  }
14
14
  this.fields = dataSchemaReplace["fields"].map((field) => (new DataSchemaField(field)));
15
15
  }
16
- /** Serializes the replacement schema to API format. */
16
+ /**
17
+ * Serializes the replacement schema to API format.
18
+ */
17
19
  toJSON() {
18
20
  return { fields: this.fields.map(e => e.toJSON()) };
19
21
  }
20
- /** Returns a JSON string representation of the replacement schema. */
22
+ /**
23
+ * Returns a JSON string representation of the replacement schema.
24
+ */
21
25
  toString() {
22
26
  return JSON.stringify(this.toJSON());
23
27
  }
@@ -1,6 +1,6 @@
1
1
  import { StringDict } from "../../../../parsing/stringDict.js";
2
2
  import { DataSchema } from "./dataSchema.js";
3
- import { BaseProductParameters, BaseProductParametersConstructor } from "../../../../v2/clientOptions/baseProductParameters.js";
3
+ import { BaseProductParameters, BaseProductParametersConstructor } from "../../../clientOptions/baseProductParameters.js";
4
4
  /**
5
5
  * Parameters for sending a file to an Extraction product.
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import { DataSchema } from "./dataSchema.js";
2
- import { BaseProductParameters } from "../../../../v2/clientOptions/baseProductParameters.js";
2
+ import { BaseProductParameters } from "../../../clientOptions/baseProductParameters.js";
3
3
  import { logger } from "../../../../logger.js";
4
4
  /**
5
5
  * Parameters for sending a file to an Extraction product.
@@ -13,11 +13,11 @@ export class ExtractionParameters extends BaseProductParameters {
13
13
  this.confidence = params.confidence;
14
14
  this.textContext = params.textContext;
15
15
  if (params.dataSchema !== undefined && params.dataSchema !== null) {
16
- if (!(params.dataSchema instanceof DataSchema)) {
17
- this.dataSchema = new DataSchema(params.dataSchema);
16
+ if (params.dataSchema instanceof DataSchema) {
17
+ this.dataSchema = params.dataSchema;
18
18
  }
19
19
  else {
20
- this.dataSchema = params.dataSchema;
20
+ this.dataSchema = new DataSchema(params.dataSchema);
21
21
  }
22
22
  }
23
23
  logger.debug("Extraction parameters initialized.");
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Base class for annotated fields.
3
+ */
4
+ export declare abstract class AnnotatedBaseField {
5
+ /**
6
+ * When true, use the RAG information for the final result. When false, use the Data Schema information.
7
+ */
8
+ selected: boolean;
9
+ /**
10
+ * Guidelines or instructions for processing this field.
11
+ */
12
+ guidelines: string | null;
13
+ /**
14
+ * Default constructor.
15
+ * @param selected When true, use the RAG information for the final result.
16
+ * When false, use the Data Schema information.
17
+ * @param guidelines Guidelines or instructions for processing this field.
18
+ */
19
+ protected constructor(selected: boolean, guidelines?: string | null);
20
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Base class for annotated fields.
3
+ */
4
+ export class AnnotatedBaseField {
5
+ /**
6
+ * Default constructor.
7
+ * @param selected When true, use the RAG information for the final result.
8
+ * When false, use the Data Schema information.
9
+ * @param guidelines Guidelines or instructions for processing this field.
10
+ */
11
+ constructor(selected, guidelines = null) {
12
+ this.selected = selected;
13
+ this.guidelines = guidelines;
14
+ }
15
+ }
@@ -0,0 +1,27 @@
1
+ import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
2
+ import { AnnotatedObjectField } from "./annotatedObjectField.js";
3
+ import { AnnotatedListField } from "./annotatedListField.js";
4
+ import { StringDict } from "../../../../parsing/index.js";
5
+ /**
6
+ * A dictionary of field names and their corresponding configured field types.
7
+ */
8
+ export declare class AnnotatedFields extends Map<string, AnnotatedSimpleField | AnnotatedObjectField | AnnotatedListField> {
9
+ constructor(serverResponse: StringDict);
10
+ /**
11
+ * Returns a field as an `AnnotatedSimpleField`, or throws if the type mismatches.
12
+ */
13
+ getSimpleField(fieldName: string): AnnotatedSimpleField;
14
+ /**
15
+ * Returns a field as an `AnnotatedObjectField`, or throws if the type mismatches.
16
+ */
17
+ getObjectField(fieldName: string): AnnotatedObjectField;
18
+ /**
19
+ * Returns a field as an `AnnotatedListField`, or throws if the type mismatches.
20
+ */
21
+ getListField(fieldName: string): AnnotatedListField;
22
+ /**
23
+ * Serializes the fields to API format.
24
+ * Needed because a `Map` is otherwise serialized as an empty object by `JSON.stringify`.
25
+ */
26
+ toJSON(): Record<string, AnnotatedSimpleField | AnnotatedObjectField | AnnotatedListField>;
27
+ }
@@ -0,0 +1,57 @@
1
+ import { createAnnotatedField } from "./fieldFactory.js";
2
+ /**
3
+ * A dictionary of field names and their corresponding configured field types.
4
+ */
5
+ export class AnnotatedFields extends Map {
6
+ constructor(serverResponse) {
7
+ super(Object.entries(serverResponse).map(([key, value]) => {
8
+ return [key, createAnnotatedField(value)];
9
+ }));
10
+ }
11
+ /**
12
+ * Returns a field as an `AnnotatedSimpleField`, or throws if the type mismatches.
13
+ */
14
+ getSimpleField(fieldName) {
15
+ const field = this.get(fieldName);
16
+ if (field === undefined) {
17
+ throw new Error(`The field '${fieldName}' was not found.`);
18
+ }
19
+ if (field.constructor.name !== "AnnotatedSimpleField") {
20
+ throw new Error(`The field '${fieldName}' is not a AnnotatedSimpleField.`);
21
+ }
22
+ return field;
23
+ }
24
+ /**
25
+ * Returns a field as an `AnnotatedObjectField`, or throws if the type mismatches.
26
+ */
27
+ getObjectField(fieldName) {
28
+ const field = this.get(fieldName);
29
+ if (field === undefined) {
30
+ throw new Error(`The field '${fieldName}' was not found.`);
31
+ }
32
+ if (field.constructor.name !== "AnnotatedObjectField") {
33
+ throw new Error(`The field '${fieldName}' is not an ObjectField.`);
34
+ }
35
+ return field;
36
+ }
37
+ /**
38
+ * Returns a field as an `AnnotatedListField`, or throws if the type mismatches.
39
+ */
40
+ getListField(fieldName) {
41
+ const field = this.get(fieldName);
42
+ if (field === undefined) {
43
+ throw new Error(`The field '${fieldName}' was not found.`);
44
+ }
45
+ if (field.constructor.name !== "AnnotatedListField") {
46
+ throw new Error(`The field '${fieldName}' is not a ListField.`);
47
+ }
48
+ return field;
49
+ }
50
+ /**
51
+ * Serializes the fields to API format.
52
+ * Needed because a `Map` is otherwise serialized as an empty object by `JSON.stringify`.
53
+ */
54
+ toJSON() {
55
+ return Object.fromEntries(this);
56
+ }
57
+ }
@@ -0,0 +1,26 @@
1
+ import { StringDict } from "../../../../parsing/stringDict.js";
2
+ import { AnnotatedBaseField } from "./annotatedBaseField.js";
3
+ import { AnnotatedObjectField } from "./annotatedObjectField.js";
4
+ import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
5
+ /**
6
+ * Field having a list of fields.
7
+ */
8
+ export declare class AnnotatedListField extends AnnotatedBaseField {
9
+ /**
10
+ * Items contained in the list.
11
+ */
12
+ items: Array<AnnotatedListField | AnnotatedObjectField | AnnotatedSimpleField>;
13
+ constructor(serverResponse: StringDict);
14
+ /**
15
+ * AnnotatedSimpleField items from the list.
16
+ */
17
+ get simpleItems(): Array<AnnotatedSimpleField>;
18
+ /**
19
+ * AnnotatedObjectField items from the list.
20
+ */
21
+ get objectItems(): Array<AnnotatedObjectField>;
22
+ /**
23
+ * Returns a readable representation of list items.
24
+ */
25
+ toString(): string;
26
+ }
@@ -0,0 +1,69 @@
1
+ import { MindeeDeserializationError } from "../../../../errors/index.js";
2
+ import { AnnotatedBaseField } from "./annotatedBaseField.js";
3
+ import { AnnotatedObjectField } from "./annotatedObjectField.js";
4
+ import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
5
+ import { createAnnotatedField } from "./fieldFactory.js";
6
+ /**
7
+ * Field having a list of fields.
8
+ */
9
+ export class AnnotatedListField extends AnnotatedBaseField {
10
+ constructor(serverResponse) {
11
+ super(serverResponse["selected"], serverResponse["guidelines"]);
12
+ if (!Array.isArray(serverResponse["items"])) {
13
+ throw new MindeeDeserializationError(`Expected "items" to be an array in ${JSON.stringify(serverResponse)}.`);
14
+ }
15
+ this.items = serverResponse["items"].map((item) => {
16
+ return createAnnotatedField(item);
17
+ });
18
+ }
19
+ /**
20
+ * AnnotatedSimpleField items from the list.
21
+ */
22
+ get simpleItems() {
23
+ const result = [];
24
+ for (const item of this.items) {
25
+ if (item instanceof AnnotatedSimpleField) {
26
+ result.push(item);
27
+ }
28
+ else {
29
+ throw new MindeeDeserializationError(`All items must be AnnotatedSimpleField, found item of type ${item.constructor.name}.`);
30
+ }
31
+ }
32
+ return result;
33
+ }
34
+ /**
35
+ * AnnotatedObjectField items from the list.
36
+ */
37
+ get objectItems() {
38
+ const result = [];
39
+ for (const item of this.items) {
40
+ if (item instanceof AnnotatedObjectField) {
41
+ result.push(item);
42
+ }
43
+ else {
44
+ throw new MindeeDeserializationError(`All items must be AnnotatedObjectField, found item of type ${item.constructor.name}.`);
45
+ }
46
+ }
47
+ return result;
48
+ }
49
+ /**
50
+ * Returns a readable representation of list items.
51
+ */
52
+ toString() {
53
+ if (!this.items || this.items.length === 0) {
54
+ return "\n";
55
+ }
56
+ const parts = [""];
57
+ for (const item of this.items) {
58
+ if (!item)
59
+ continue;
60
+ if (item instanceof AnnotatedObjectField) {
61
+ parts.push(item.toStringFromList());
62
+ }
63
+ else {
64
+ parts.push(item.toString());
65
+ }
66
+ }
67
+ return parts.join("\n * ");
68
+ }
69
+ }
@@ -0,0 +1,43 @@
1
+ import { AnnotatedBaseField } from "./annotatedBaseField.js";
2
+ import { StringDict } from "../../../../parsing/index.js";
3
+ import { AnnotatedFields } from "./annotatedFields.js";
4
+ import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
5
+ import { AnnotatedListField } from "./annotatedListField.js";
6
+ /**
7
+ * Field having a set of sub-fields.
8
+ */
9
+ export declare class AnnotatedObjectField extends AnnotatedBaseField {
10
+ /**
11
+ * Nested fields carried by this object.
12
+ */
13
+ readonly fields: AnnotatedFields;
14
+ constructor(serverResponse: StringDict);
15
+ /**
16
+ * Retrieves a AnnotatedSimpleField by its name if it exists and is of the correct type.
17
+ *
18
+ * @param {string} fieldName - The name of the field to retrieve.
19
+ * @return {AnnotatedSimpleField} The field instance if it exists and is valid, or undefined if not.
20
+ * @throws {Error} If the field does not exist or is of wrong type.
21
+ */
22
+ getSimpleField(fieldName: string): AnnotatedSimpleField;
23
+ /**
24
+ * Retrieves a AnnotatedListField by its name if it exists and is of the correct type.
25
+ *
26
+ * @param {string} fieldName - The name of the field to retrieve.
27
+ * @return {AnnotatedListField} The field instance if it exists and is valid, or undefined if not.
28
+ * @throws {Error} If the field does not exist or is of wrong type.
29
+ */
30
+ getListField(fieldName: string): AnnotatedListField;
31
+ /**
32
+ * Retrieves an AnnotatedObjectField by its name if it exists and is of the correct type.
33
+ *
34
+ * @param {string} fieldName - The name of the field to retrieve.
35
+ * @return {AnnotatedObjectField} The field instance if it exists and is valid, or undefined if not.
36
+ * @throws {Error} If the field does not exist or is of wrong type.
37
+ */
38
+ getObjectField(fieldName: string): AnnotatedObjectField;
39
+ /**
40
+ * Returns a compact representation suitable for list items.
41
+ */
42
+ toStringFromList(): string;
43
+ }
@@ -0,0 +1,47 @@
1
+ import { AnnotatedBaseField } from "./annotatedBaseField.js";
2
+ import { AnnotatedFields } from "./annotatedFields.js";
3
+ /**
4
+ * Field having a set of sub-fields.
5
+ */
6
+ export class AnnotatedObjectField extends AnnotatedBaseField {
7
+ constructor(serverResponse) {
8
+ super(serverResponse["selected"], serverResponse["guidelines"]);
9
+ this.fields = new AnnotatedFields(serverResponse["fields"]);
10
+ }
11
+ /**
12
+ * Retrieves a AnnotatedSimpleField by its name if it exists and is of the correct type.
13
+ *
14
+ * @param {string} fieldName - The name of the field to retrieve.
15
+ * @return {AnnotatedSimpleField} The field instance if it exists and is valid, or undefined if not.
16
+ * @throws {Error} If the field does not exist or is of wrong type.
17
+ */
18
+ getSimpleField(fieldName) {
19
+ return this.fields.getSimpleField(fieldName);
20
+ }
21
+ /**
22
+ * Retrieves a AnnotatedListField by its name if it exists and is of the correct type.
23
+ *
24
+ * @param {string} fieldName - The name of the field to retrieve.
25
+ * @return {AnnotatedListField} The field instance if it exists and is valid, or undefined if not.
26
+ * @throws {Error} If the field does not exist or is of wrong type.
27
+ */
28
+ getListField(fieldName) {
29
+ return this.fields.getListField(fieldName);
30
+ }
31
+ /**
32
+ * Retrieves an AnnotatedObjectField by its name if it exists and is of the correct type.
33
+ *
34
+ * @param {string} fieldName - The name of the field to retrieve.
35
+ * @return {AnnotatedObjectField} The field instance if it exists and is valid, or undefined if not.
36
+ * @throws {Error} If the field does not exist or is of wrong type.
37
+ */
38
+ getObjectField(fieldName) {
39
+ return this.fields.getObjectField(fieldName);
40
+ }
41
+ /**
42
+ * Returns a compact representation suitable for list items.
43
+ */
44
+ toStringFromList() {
45
+ return this.fields ? this.fields.toString().substring(4) : "";
46
+ }
47
+ }
@@ -0,0 +1,15 @@
1
+ import { AnnotatedBaseField } from "./annotatedBaseField.js";
2
+ import { StringDict } from "../../../../parsing/index.js";
3
+ /**
4
+ * A SimpleField with additional configuration for annotation.
5
+ */
6
+ export declare class AnnotatedSimpleField extends AnnotatedBaseField {
7
+ /**
8
+ * Field value, one of: string, boolean, number, null.
9
+ */
10
+ value: string | boolean | number | null;
11
+ /**
12
+ * Default constructor.
13
+ */
14
+ constructor(serverResponse: StringDict);
15
+ }
@@ -0,0 +1,13 @@
1
+ import { AnnotatedBaseField } from "./annotatedBaseField.js";
2
+ /**
3
+ * A SimpleField with additional configuration for annotation.
4
+ */
5
+ export class AnnotatedSimpleField extends AnnotatedBaseField {
6
+ /**
7
+ * Default constructor.
8
+ */
9
+ constructor(serverResponse) {
10
+ super(serverResponse["selected"], serverResponse["guidelines"]);
11
+ this.value = serverResponse["value"];
12
+ }
13
+ }
@@ -0,0 +1,25 @@
1
+ import { BaseRagAnnotationResponse } from "../../../parsing/baseRagAnnotationResponse.js";
2
+ import { RagAnnotation } from "./ragAnnotation.js";
3
+ import { StringDict } from "../../../../parsing/index.js";
4
+ /**
5
+ * Response for a RAG document.
6
+ */
7
+ export declare class ExtractionRagAnnotationResponse extends BaseRagAnnotationResponse {
8
+ /**
9
+ * Model identifier linked to the RAG document.
10
+ */
11
+ modelId: string;
12
+ /**
13
+ * Number of times this document was used in an inference.
14
+ */
15
+ totalMatches: number;
16
+ /**
17
+ * Date and time of the latest matching inference, if any.
18
+ */
19
+ lastMatchAt: Date | null;
20
+ /**
21
+ * Annotation metadata associated with the document.
22
+ */
23
+ annotation: RagAnnotation | null;
24
+ constructor(serverResponse: StringDict);
25
+ }
@@ -0,0 +1,17 @@
1
+ import { BaseRagAnnotationResponse } from "../../../parsing/baseRagAnnotationResponse.js";
2
+ import { RagAnnotation } from "./ragAnnotation.js";
3
+ import { parseDate } from "../../../../parsing/index.js";
4
+ /**
5
+ * Response for a RAG document.
6
+ */
7
+ export class ExtractionRagAnnotationResponse extends BaseRagAnnotationResponse {
8
+ constructor(serverResponse) {
9
+ super(serverResponse);
10
+ this.modelId = serverResponse["model_id"];
11
+ this.totalMatches = serverResponse["total_matches"];
12
+ this.lastMatchAt = parseDate(serverResponse["last_match_at"]);
13
+ this.annotation = serverResponse["annotation"]
14
+ ? new RagAnnotation(serverResponse["annotation"])
15
+ : null;
16
+ }
17
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Factory helper.
3
+ */
4
+ import { StringDict } from "../../../../parsing/stringDict.js";
5
+ import { AnnotatedListField } from "./annotatedListField.js";
6
+ import { AnnotatedObjectField } from "./annotatedObjectField.js";
7
+ import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
8
+ /**
9
+ * Create an annotated field from a server response.
10
+ * @param serverResponse Server response.
11
+ */
12
+ export declare function createAnnotatedField(serverResponse: StringDict): AnnotatedSimpleField | AnnotatedListField | AnnotatedObjectField;
@@ -0,0 +1,23 @@
1
+ import { MindeeDeserializationError } from "../../../../errors/index.js";
2
+ import { AnnotatedListField } from "./annotatedListField.js";
3
+ import { AnnotatedObjectField } from "./annotatedObjectField.js";
4
+ import { AnnotatedSimpleField } from "./annotatedSimpleField.js";
5
+ /**
6
+ * Create an annotated field from a server response.
7
+ * @param serverResponse Server response.
8
+ */
9
+ export function createAnnotatedField(serverResponse) {
10
+ if (typeof serverResponse !== "object" || serverResponse === null) {
11
+ throw new MindeeDeserializationError(`Unrecognized field format ${JSON.stringify(serverResponse)}.`);
12
+ }
13
+ if ("items" in serverResponse) {
14
+ return new AnnotatedListField(serverResponse);
15
+ }
16
+ if ("fields" in serverResponse) {
17
+ return new AnnotatedObjectField(serverResponse);
18
+ }
19
+ if ("value" in serverResponse) {
20
+ return new AnnotatedSimpleField(serverResponse);
21
+ }
22
+ throw new MindeeDeserializationError(`Unrecognized field format in ${JSON.stringify(serverResponse)}.`);
23
+ }