mindee 5.5.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/package.json +26 -14
  3. package/src/geometry/bbox.d.ts +5 -0
  4. package/src/geometry/bbox.js +1 -0
  5. package/src/geometry/minMax.d.ts +3 -0
  6. package/src/geometry/polygonUtils.d.ts +23 -0
  7. package/src/geometry/polygonUtils.js +23 -0
  8. package/src/http/baseSettings.d.ts +5 -0
  9. package/src/http/baseSettings.js +2 -0
  10. package/src/image/extractedImage.d.ts +4 -0
  11. package/src/image/extractedImages.d.ts +1 -0
  12. package/src/image/extractedImages.js +1 -0
  13. package/src/image/imageCompressor.d.ts +1 -1
  14. package/src/image/imageExtractor.d.ts +5 -6
  15. package/src/image/imageExtractor.js +71 -73
  16. package/src/input/base64Input.d.ts +3 -0
  17. package/src/input/base64Input.js +3 -0
  18. package/src/input/bufferInput.d.ts +2 -0
  19. package/src/input/bufferInput.js +2 -0
  20. package/src/input/bytesInput.d.ts +3 -0
  21. package/src/input/bytesInput.js +3 -0
  22. package/src/input/inputSource.d.ts +15 -0
  23. package/src/input/inputSource.js +15 -0
  24. package/src/input/localInputSource.d.ts +6 -0
  25. package/src/input/localInputSource.js +3 -0
  26. package/src/input/pathInput.d.ts +4 -0
  27. package/src/input/pathInput.js +3 -0
  28. package/src/input/streamInput.d.ts +4 -0
  29. package/src/input/streamInput.js +4 -0
  30. package/src/input/urlInput.d.ts +12 -0
  31. package/src/input/urlInput.js +52 -10
  32. package/src/logger.js +1 -1
  33. package/src/parsing/dateParser.d.ts +4 -0
  34. package/src/parsing/dateParser.js +5 -1
  35. package/src/parsing/localResponseBase.d.ts +2 -0
  36. package/src/parsing/localResponseBase.js +2 -0
  37. package/src/parsing/stringDict.d.ts +1 -0
  38. package/src/pdf/extractedPdf.d.ts +5 -0
  39. package/src/pdf/extractedPdf.js +1 -0
  40. package/src/pdf/extractedPdfs.d.ts +1 -0
  41. package/src/pdf/extractedPdfs.js +1 -0
  42. package/src/pdf/pdfCompressor.js +12 -0
  43. package/src/pdf/pdfExtractor.js +3 -0
  44. package/src/pdf/pdfOperation.d.ts +3 -0
  45. package/src/pdf/pdfOperation.js +3 -0
  46. package/src/pdf/pdfUtils.js +5 -0
  47. package/src/v1/cli.d.ts +3 -0
  48. package/src/v1/cli.js +84 -26
  49. package/src/v1/client.d.ts +16 -16
  50. package/src/v1/extraction/invoiceSplitterExtractor/extractedInvoiceSplitterImage.d.ts +2 -0
  51. package/src/v1/extraction/invoiceSplitterExtractor/invoiceSplitterExtractor.js +14 -0
  52. package/src/v1/extraction/multiReceiptsExtractor/extractedMultiReceiptImage.d.ts +2 -0
  53. package/src/v1/extraction/multiReceiptsExtractor/multiReceiptsExtractor.js +3 -0
  54. package/src/v1/http/apiSettingsV1.d.ts +5 -0
  55. package/src/v1/http/apiSettingsV1.js +4 -0
  56. package/src/v1/http/errors.d.ts +7 -1
  57. package/src/v1/http/errors.js +65 -86
  58. package/src/v1/http/httpParams.d.ts +12 -0
  59. package/src/v1/parsing/common/asyncPredictResponse.d.ts +4 -0
  60. package/src/v1/parsing/common/asyncPredictResponse.js +5 -2
  61. package/src/v1/parsing/common/executionPriority.d.ts +4 -0
  62. package/src/v1/parsing/common/executionPriority.js +4 -0
  63. package/src/v1/parsing/common/extras/cropperExtra.d.ts +2 -0
  64. package/src/v1/parsing/common/extras/cropperExtra.js +3 -0
  65. package/src/v1/parsing/common/extras/extras.d.ts +3 -0
  66. package/src/v1/parsing/common/extras/extras.js +2 -0
  67. package/src/v1/parsing/common/extras/fullTextOcrExtra.d.ts +3 -0
  68. package/src/v1/parsing/common/extras/fullTextOcrExtra.js +1 -0
  69. package/src/v1/parsing/common/extras/ragExtra.d.ts +1 -0
  70. package/src/v1/parsing/common/extras/ragExtra.js +1 -0
  71. package/src/v1/parsing/common/feedback/feedbackResponse.js +1 -0
  72. package/src/v1/parsing/common/index.d.ts +1 -1
  73. package/src/v1/parsing/common/index.js +1 -1
  74. package/src/v1/parsing/common/inference.d.ts +2 -0
  75. package/src/v1/parsing/common/inference.js +2 -0
  76. package/src/v1/parsing/common/prediction.d.ts +1 -0
  77. package/src/v1/parsing/common/prediction.js +1 -0
  78. package/src/v1/parsing/common/summaryHelper.d.ts +12 -1
  79. package/src/v1/parsing/common/summaryHelper.js +18 -1
  80. package/src/v1/parsing/generated/generatedObject.d.ts +6 -0
  81. package/src/v1/parsing/generated/generatedObject.js +38 -27
  82. package/src/v1/parsing/localResponse.d.ts +1 -0
  83. package/src/v1/parsing/localResponse.js +1 -0
  84. package/src/v1/parsing/standard/base.d.ts +6 -0
  85. package/src/v1/parsing/standard/base.js +1 -0
  86. package/src/v1/parsing/standard/boolean.d.ts +1 -1
  87. package/src/v1/parsing/standard/companyRegistration.d.ts +1 -0
  88. package/src/v1/parsing/standard/companyRegistration.js +1 -0
  89. package/src/v1/parsing/standard/date.d.ts +1 -0
  90. package/src/v1/parsing/standard/date.js +1 -0
  91. package/src/v1/parsing/standard/paymentDetails.d.ts +5 -5
  92. package/src/v1/parsing/standard/position.d.ts +2 -2
  93. package/src/v1/parsing/standard/tax.d.ts +1 -0
  94. package/src/v1/parsing/standard/tax.js +1 -0
  95. package/src/v1/parsing/standard/text.d.ts +1 -1
  96. package/src/v1/parsing/standard/word.d.ts +3 -0
  97. package/src/v1/parsing/standard/word.js +1 -0
  98. package/src/v1/product/financialDocument/financialDocumentV1LineItem.js +16 -58
  99. package/src/v1/product/generated/generatedV1Prediction.d.ts +1 -0
  100. package/src/v1/product/generated/generatedV1Prediction.js +2 -1
  101. package/src/v1/product/invoice/invoiceV4LineItem.js +5 -16
  102. package/src/v1/product/receipt/receiptV5LineItem.js +2 -6
  103. package/src/v1/product/resume/resumeV1Certificate.js +5 -21
  104. package/src/v1/product/resume/resumeV1Education.js +8 -36
  105. package/src/v1/product/resume/resumeV1Language.js +3 -11
  106. package/src/v1/product/resume/resumeV1ProfessionalExperience.js +10 -46
  107. package/src/v1/product/resume/resumeV1SocialNetworksUrl.js +3 -11
  108. package/src/v2/cli.d.ts +3 -0
  109. package/src/v2/cli.js +21 -0
  110. package/src/v2/client.d.ts +1 -0
  111. package/src/v2/client.js +1 -0
  112. package/src/v2/clientOptions/pollingOptions.d.ts +5 -0
  113. package/src/v2/clientOptions/pollingOptions.js +2 -0
  114. package/src/v2/parsing/baseResponse.d.ts +2 -0
  115. package/src/v2/parsing/baseResponse.js +1 -0
  116. package/src/v2/parsing/error/errorDetails.d.ts +1 -0
  117. package/src/v2/parsing/index.d.ts +1 -1
  118. package/src/v2/parsing/index.js +1 -1
  119. package/src/v2/parsing/inference/baseInference.d.ts +2 -0
  120. package/src/v2/parsing/inference/baseInference.js +2 -0
  121. package/src/v2/parsing/inference/failedInferenceResponse.d.ts +33 -0
  122. package/src/v2/parsing/inference/failedInferenceResponse.js +17 -0
  123. package/src/v2/parsing/inference/field/baseField.d.ts +3 -0
  124. package/src/v2/parsing/inference/field/fieldConfidence.d.ts +4 -0
  125. package/src/v2/parsing/inference/field/fieldConfidence.js +4 -0
  126. package/src/v2/parsing/inference/field/fieldFactory.d.ts +5 -0
  127. package/src/v2/parsing/inference/field/fieldFactory.js +5 -0
  128. package/src/v2/parsing/inference/field/fieldLocation.d.ts +1 -0
  129. package/src/v2/parsing/inference/field/fieldLocation.js +1 -0
  130. package/src/v2/parsing/inference/field/inferenceFields.d.ts +5 -0
  131. package/src/v2/parsing/inference/field/inferenceFields.js +4 -0
  132. package/src/v2/parsing/inference/field/listField.d.ts +2 -0
  133. package/src/v2/parsing/inference/field/listField.js +2 -0
  134. package/src/v2/parsing/inference/field/objectField.d.ts +4 -0
  135. package/src/v2/parsing/inference/field/objectField.js +3 -0
  136. package/src/v2/parsing/inference/field/ragMetadata.d.ts +1 -0
  137. package/src/v2/parsing/inference/field/ragMetadata.js +1 -0
  138. package/src/v2/parsing/inference/field/rawText.d.ts +2 -0
  139. package/src/v2/parsing/inference/field/rawText.js +2 -0
  140. package/src/v2/parsing/inference/field/simpleField.d.ts +2 -0
  141. package/src/v2/parsing/inference/field/simpleField.js +2 -0
  142. package/src/v2/parsing/inference/inferenceFile.d.ts +2 -0
  143. package/src/v2/parsing/inference/inferenceFile.js +2 -0
  144. package/src/v2/parsing/inference/inferenceModel.d.ts +2 -0
  145. package/src/v2/parsing/inference/inferenceModel.js +2 -0
  146. package/src/v2/parsing/job/job.d.ts +1 -1
  147. package/src/v2/parsing/job/job.js +1 -3
  148. package/src/v2/parsing/job/jobResponse.d.ts +3 -0
  149. package/src/v2/parsing/job/jobResponse.js +3 -0
  150. package/src/v2/product/classification/classification.d.ts +3 -0
  151. package/src/v2/product/classification/classification.js +3 -0
  152. package/src/v2/product/classification/classificationClassifier.d.ts +2 -0
  153. package/src/v2/product/classification/classificationClassifier.js +2 -0
  154. package/src/v2/product/classification/classificationInference.d.ts +2 -0
  155. package/src/v2/product/classification/classificationInference.js +2 -0
  156. package/src/v2/product/classification/classificationResponse.d.ts +1 -0
  157. package/src/v2/product/classification/classificationResponse.js +1 -0
  158. package/src/v2/product/classification/classificationResult.d.ts +2 -0
  159. package/src/v2/product/classification/classificationResult.js +2 -0
  160. package/src/v2/product/crop/crop.d.ts +3 -0
  161. package/src/v2/product/crop/crop.js +3 -0
  162. package/src/v2/product/crop/cropInference.d.ts +2 -0
  163. package/src/v2/product/crop/cropInference.js +2 -0
  164. package/src/v2/product/crop/cropItem.d.ts +2 -0
  165. package/src/v2/product/crop/cropItem.js +2 -0
  166. package/src/v2/product/crop/cropResponse.d.ts +1 -0
  167. package/src/v2/product/crop/cropResponse.js +1 -0
  168. package/src/v2/product/crop/cropResult.d.ts +2 -0
  169. package/src/v2/product/crop/cropResult.js +2 -0
  170. package/src/v2/product/extraction/dataSchemaActiveOption.d.ts +1 -0
  171. package/src/v2/product/extraction/dataSchemaActiveOption.js +1 -0
  172. package/src/v2/product/extraction/extraction.d.ts +3 -0
  173. package/src/v2/product/extraction/extraction.js +3 -0
  174. package/src/v2/product/extraction/extractionActiveOptions.d.ts +2 -0
  175. package/src/v2/product/extraction/extractionActiveOptions.js +2 -0
  176. package/src/v2/product/extraction/extractionInference.d.ts +2 -0
  177. package/src/v2/product/extraction/extractionInference.js +2 -0
  178. package/src/v2/product/extraction/extractionResponse.d.ts +1 -0
  179. package/src/v2/product/extraction/extractionResponse.js +1 -0
  180. package/src/v2/product/extraction/extractionResult.d.ts +2 -0
  181. package/src/v2/product/extraction/extractionResult.js +2 -0
  182. package/src/v2/product/extraction/params/dataSchema.d.ts +9 -6
  183. package/src/v2/product/extraction/params/dataSchema.js +2 -0
  184. package/src/v2/product/extraction/params/dataSchemaField.d.ts +25 -1
  185. package/src/v2/product/extraction/params/dataSchemaField.js +3 -0
  186. package/src/v2/product/extraction/params/dataSchemaReplace.d.ts +9 -4
  187. package/src/v2/product/extraction/params/dataSchemaReplace.js +2 -0
  188. package/src/v2/product/ocr/ocr.d.ts +3 -0
  189. package/src/v2/product/ocr/ocr.js +3 -0
  190. package/src/v2/product/ocr/ocrInference.d.ts +2 -0
  191. package/src/v2/product/ocr/ocrInference.js +2 -0
  192. package/src/v2/product/ocr/ocrPage.d.ts +2 -0
  193. package/src/v2/product/ocr/ocrPage.js +2 -0
  194. package/src/v2/product/ocr/ocrResponse.d.ts +1 -0
  195. package/src/v2/product/ocr/ocrResponse.js +1 -0
  196. package/src/v2/product/ocr/ocrResult.d.ts +1 -0
  197. package/src/v2/product/ocr/ocrResult.js +1 -0
  198. package/src/v2/product/ocr/ocrWord.d.ts +2 -0
  199. package/src/v2/product/ocr/ocrWord.js +2 -0
  200. package/src/v2/product/split/split.d.ts +3 -0
  201. package/src/v2/product/split/split.js +3 -0
  202. package/src/v2/product/split/splitInference.d.ts +2 -0
  203. package/src/v2/product/split/splitInference.js +2 -0
  204. package/src/v2/product/split/splitRange.d.ts +1 -0
  205. package/src/v2/product/split/splitRange.js +1 -0
  206. package/src/v2/product/split/splitResponse.d.ts +1 -0
  207. package/src/v2/product/split/splitResponse.js +1 -0
  208. package/src/v2/product/split/splitResult.d.ts +1 -0
  209. package/src/v2/product/split/splitResult.js +1 -0
@@ -1,9 +1,11 @@
1
1
  import { StringDict } from "../../../parsing/stringDict.js";
2
+ /** Model metadata attached to a v2 inference. */
2
3
  export declare class InferenceModel {
3
4
  /**
4
5
  * ID of the model.
5
6
  */
6
7
  id: string;
7
8
  constructor(serverResponse: StringDict);
9
+ /** Returns a printable representation of model metadata. */
8
10
  toString(): string;
9
11
  }
@@ -1,7 +1,9 @@
1
+ /** Model metadata attached to a v2 inference. */
1
2
  export class InferenceModel {
2
3
  constructor(serverResponse) {
3
4
  this.id = serverResponse["id"];
4
5
  }
6
+ /** Returns a printable representation of model metadata. */
5
7
  toString() {
6
8
  return "Model\n" +
7
9
  "=====\n" +
@@ -36,7 +36,7 @@ export declare class Job {
36
36
  /**
37
37
  * Status of the job.
38
38
  */
39
- status?: string;
39
+ status: string;
40
40
  /**
41
41
  * URL to poll for the job status.
42
42
  */
@@ -7,9 +7,7 @@ import { JobWebhook } from "./jobWebhook.js";
7
7
  export class Job {
8
8
  constructor(serverResponse) {
9
9
  this.id = serverResponse["id"];
10
- if (serverResponse["status"] !== undefined) {
11
- this.status = serverResponse["status"];
12
- }
10
+ this.status = serverResponse["status"];
13
11
  if (serverResponse["error"]) {
14
12
  this.error = new ErrorResponse(serverResponse["error"]);
15
13
  }
@@ -1,6 +1,9 @@
1
1
  import { BaseResponse } from "../../../v2/parsing/baseResponse.js";
2
2
  import { StringDict } from "../../../parsing/stringDict.js";
3
3
  import { Job } from "./job.js";
4
+ /**
5
+ * Job response class.
6
+ */
4
7
  export declare class JobResponse extends BaseResponse {
5
8
  /**
6
9
  * Job for the polling.
@@ -1,5 +1,8 @@
1
1
  import { BaseResponse } from "../../../v2/parsing/baseResponse.js";
2
2
  import { Job } from "./job.js";
3
+ /**
4
+ * Job response class.
5
+ */
3
6
  export class JobResponse extends BaseResponse {
4
7
  constructor(serverResponse) {
5
8
  super(serverResponse);
@@ -5,7 +5,10 @@ import { BaseProduct } from "../../../v2/product/baseProduct.js";
5
5
  * Automatically sort any image or scanned document into categories.
6
6
  */
7
7
  export declare class Classification extends BaseProduct {
8
+ /** Parameter class accepted by this product. */
8
9
  static get parametersClass(): typeof ClassificationParameters;
10
+ /** Response class returned by this product. */
9
11
  static get responseClass(): typeof ClassificationResponse;
12
+ /** API slug for this product. */
10
13
  static get slug(): string;
11
14
  }
@@ -5,12 +5,15 @@ import { BaseProduct } from "../../../v2/product/baseProduct.js";
5
5
  * Automatically sort any image or scanned document into categories.
6
6
  */
7
7
  export class Classification extends BaseProduct {
8
+ /** Parameter class accepted by this product. */
8
9
  static get parametersClass() {
9
10
  return ClassificationParameters;
10
11
  }
12
+ /** Response class returned by this product. */
11
13
  static get responseClass() {
12
14
  return ClassificationResponse;
13
15
  }
16
+ /** API slug for this product. */
14
17
  static get slug() {
15
18
  return "classification";
16
19
  }
@@ -3,6 +3,7 @@ import { ExtractionResponse } from "../../../v2/product/index.js";
3
3
  /**
4
4
  * Document level classification.
5
5
  */
6
+ /** Classifier output for document-level classification. */
6
7
  export declare class ClassificationClassifier {
7
8
  /**
8
9
  * The document type, as identified on given classification values.
@@ -13,5 +14,6 @@ export declare class ClassificationClassifier {
13
14
  */
14
15
  extractionResponse?: ExtractionResponse;
15
16
  constructor(serverResponse: StringDict);
17
+ /** Returns a readable classifier summary. */
16
18
  toString(): string;
17
19
  }
@@ -2,6 +2,7 @@ import { ExtractionResponse } from "../../../v2/product/index.js";
2
2
  /**
3
3
  * Document level classification.
4
4
  */
5
+ /** Classifier output for document-level classification. */
5
6
  export class ClassificationClassifier {
6
7
  constructor(serverResponse) {
7
8
  this.documentType = serverResponse["document_type"];
@@ -9,6 +10,7 @@ export class ClassificationClassifier {
9
10
  ? new ExtractionResponse(serverResponse["extraction_response"])
10
11
  : undefined;
11
12
  }
13
+ /** Returns a readable classifier summary. */
12
14
  toString() {
13
15
  return `Document Type: ${this.documentType}`;
14
16
  }
@@ -1,11 +1,13 @@
1
1
  import { StringDict } from "../../../parsing/index.js";
2
2
  import { BaseInference } from "../../../v2/parsing/inference/baseInference.js";
3
3
  import { ClassificationResult } from "./classificationResult.js";
4
+ /** Inference payload for classification responses. */
4
5
  export declare class ClassificationInference extends BaseInference {
5
6
  /**
6
7
  * Result of a classification inference.
7
8
  */
8
9
  result: ClassificationResult;
9
10
  constructor(serverResponse: StringDict);
11
+ /** Returns a readable representation of the inference. */
10
12
  toString(): string;
11
13
  }
@@ -1,10 +1,12 @@
1
1
  import { BaseInference } from "../../../v2/parsing/inference/baseInference.js";
2
2
  import { ClassificationResult } from "./classificationResult.js";
3
+ /** Inference payload for classification responses. */
3
4
  export class ClassificationInference extends BaseInference {
4
5
  constructor(serverResponse) {
5
6
  super(serverResponse);
6
7
  this.result = new ClassificationResult(serverResponse["result"]);
7
8
  }
9
+ /** Returns a readable representation of the inference. */
8
10
  toString() {
9
11
  return (super.toString() +
10
12
  this.result.toString() + "\n");
@@ -1,6 +1,7 @@
1
1
  import { StringDict } from "../../../parsing/stringDict.js";
2
2
  import { ClassificationInference } from "./classificationInference.js";
3
3
  import { BaseResponse } from "../../../v2/parsing/index.js";
4
+ /** Response wrapper for classification product calls. */
4
5
  export declare class ClassificationResponse extends BaseResponse {
5
6
  /**
6
7
  * The inference result for a classification utility request.
@@ -1,5 +1,6 @@
1
1
  import { ClassificationInference } from "./classificationInference.js";
2
2
  import { BaseResponse } from "../../../v2/parsing/index.js";
3
+ /** Response wrapper for classification product calls. */
3
4
  export class ClassificationResponse extends BaseResponse {
4
5
  /**
5
6
  * @param serverResponse JSON response from the server.
@@ -1,10 +1,12 @@
1
1
  import { StringDict } from "../../../parsing/stringDict.js";
2
2
  import { ClassificationClassifier } from "./classificationClassifier.js";
3
+ /** Classification section of a classification inference result. */
3
4
  export declare class ClassificationResult {
4
5
  /**
5
6
  * Fields contained in the inference.
6
7
  */
7
8
  classification: ClassificationClassifier;
8
9
  constructor(serverResponse: StringDict);
10
+ /** Returns a readable classification summary. */
9
11
  toString(): string;
10
12
  }
@@ -1,8 +1,10 @@
1
1
  import { ClassificationClassifier } from "./classificationClassifier.js";
2
+ /** Classification section of a classification inference result. */
2
3
  export class ClassificationResult {
3
4
  constructor(serverResponse) {
4
5
  this.classification = new ClassificationClassifier(serverResponse["classification"]);
5
6
  }
7
+ /** Returns a readable classification summary. */
6
8
  toString() {
7
9
  return `Classification\n==============\n${this.classification}`;
8
10
  }
@@ -5,7 +5,10 @@ import { BaseProduct } from "../../../v2/product/baseProduct.js";
5
5
  * Identify the borders of documents on each page, matching each one to a category.
6
6
  */
7
7
  export declare class Crop extends BaseProduct {
8
+ /** Parameter class accepted by this product. */
8
9
  static get parametersClass(): typeof CropParameters;
10
+ /** Response class returned by this product. */
9
11
  static get responseClass(): typeof CropResponse;
12
+ /** API slug for this product. */
10
13
  static get slug(): string;
11
14
  }
@@ -5,12 +5,15 @@ import { BaseProduct } from "../../../v2/product/baseProduct.js";
5
5
  * Identify the borders of documents on each page, matching each one to a category.
6
6
  */
7
7
  export class Crop extends BaseProduct {
8
+ /** Parameter class accepted by this product. */
8
9
  static get parametersClass() {
9
10
  return CropParameters;
10
11
  }
12
+ /** Response class returned by this product. */
11
13
  static get responseClass() {
12
14
  return CropResponse;
13
15
  }
16
+ /** API slug for this product. */
14
17
  static get slug() {
15
18
  return "crop";
16
19
  }
@@ -1,11 +1,13 @@
1
1
  import { StringDict } from "../../../parsing/index.js";
2
2
  import { BaseInference } from "../../../v2/parsing/inference/baseInference.js";
3
3
  import { CropResult } from "../../../v2/product/crop/cropResult.js";
4
+ /** Inference payload for crop responses. */
4
5
  export declare class CropInference extends BaseInference {
5
6
  /**
6
7
  * Result of a crop utility inference.
7
8
  */
8
9
  result: CropResult;
9
10
  constructor(serverResponse: StringDict);
11
+ /** Returns a readable representation of the inference. */
10
12
  toString(): string;
11
13
  }
@@ -1,10 +1,12 @@
1
1
  import { BaseInference } from "../../../v2/parsing/inference/baseInference.js";
2
2
  import { CropResult } from "../../../v2/product/crop/cropResult.js";
3
+ /** Inference payload for crop responses. */
3
4
  export class CropInference extends BaseInference {
4
5
  constructor(serverResponse) {
5
6
  super(serverResponse);
6
7
  this.result = new CropResult(serverResponse["result"]);
7
8
  }
9
+ /** Returns a readable representation of the inference. */
8
10
  toString() {
9
11
  return (super.toString() +
10
12
  this.result.toString() + "\n");
@@ -3,6 +3,7 @@ import { StringDict } from "../../../parsing/index.js";
3
3
  import { LocalInputSource } from "../../../input/index.js";
4
4
  import { ExtractedImage } from "../../../image/index.js";
5
5
  import { ExtractionResponse } from "../../../v2/product/index.js";
6
+ /** Single crop detection returned by the crop product. */
6
7
  export declare class CropItem {
7
8
  /**
8
9
  * Type or classification of the detected object.
@@ -17,6 +18,7 @@ export declare class CropItem {
17
18
  */
18
19
  extractionResponse?: ExtractionResponse;
19
20
  constructor(serverResponse: StringDict);
21
+ /** Returns a readable crop item summary. */
20
22
  toString(): string;
21
23
  /**
22
24
  * Extracts a single crop from an input.
@@ -1,6 +1,7 @@
1
1
  import { FieldLocation } from "../../../v2/parsing/inference/field/index.js";
2
2
  import { extractSingleCrop } from "../../../v2/fileOperations/crop.js";
3
3
  import { ExtractionResponse } from "../../../v2/product/index.js";
4
+ /** Single crop detection returned by the crop product. */
4
5
  export class CropItem {
5
6
  constructor(serverResponse) {
6
7
  this.objectType = serverResponse["object_type"];
@@ -9,6 +10,7 @@ export class CropItem {
9
10
  ? new ExtractionResponse(serverResponse["extraction_response"])
10
11
  : undefined;
11
12
  }
13
+ /** Returns a readable crop item summary. */
12
14
  toString() {
13
15
  return `* :Location: ${this.location}\n :Object Type: ${this.objectType}`;
14
16
  }
@@ -1,6 +1,7 @@
1
1
  import { StringDict } from "../../../parsing/stringDict.js";
2
2
  import { BaseResponse } from "../../../v2/parsing/index.js";
3
3
  import { CropInference } from "./cropInference.js";
4
+ /** Response wrapper for crop product calls. */
4
5
  export declare class CropResponse extends BaseResponse {
5
6
  /**
6
7
  * Response for a crop utility inference.
@@ -1,5 +1,6 @@
1
1
  import { BaseResponse } from "../../../v2/parsing/index.js";
2
2
  import { CropInference } from "./cropInference.js";
3
+ /** Response wrapper for crop product calls. */
3
4
  export class CropResponse extends BaseResponse {
4
5
  /**
5
6
  * @param serverResponse JSON response from the server.
@@ -2,12 +2,14 @@ import { StringDict } from "../../../parsing/stringDict.js";
2
2
  import { CropItem } from "../../../v2/product/crop/cropItem.js";
3
3
  import { LocalInputSource } from "../../../input/index.js";
4
4
  import { ExtractedImages } from "../../../image/extractedImages.js";
5
+ /** Crop section of a crop inference result. */
5
6
  export declare class CropResult {
6
7
  /**
7
8
  * Fields contained in the inference.
8
9
  */
9
10
  crops: CropItem[];
10
11
  constructor(serverResponse: StringDict);
12
+ /** Returns a readable list of detected crops. */
11
13
  toString(): string;
12
14
  /**
13
15
  * Extracts a single crop from an input.
@@ -1,5 +1,6 @@
1
1
  import { CropItem } from "../../../v2/product/crop/cropItem.js";
2
2
  import { extractMultipleCrops } from "../../../v2/fileOperations/crop.js";
3
+ /** Crop section of a crop inference result. */
3
4
  export class CropResult {
4
5
  constructor(serverResponse) {
5
6
  /**
@@ -8,6 +9,7 @@ export class CropResult {
8
9
  this.crops = [];
9
10
  this.crops = serverResponse["crops"].map((cropItem) => new CropItem(cropItem));
10
11
  }
12
+ /** Returns a readable list of detected crops. */
11
13
  toString() {
12
14
  const crops = this.crops.map(item => item.toString()).join("\n");
13
15
  return `Crops\n=====\n${crops}`;
@@ -8,5 +8,6 @@ export declare class DataSchemaActiveOption {
8
8
  */
9
9
  replace: boolean;
10
10
  constructor(serverResponse: StringDict);
11
+ /** Returns a readable representation of active data schema options. */
11
12
  toString(): string;
12
13
  }
@@ -5,6 +5,7 @@ export class DataSchemaActiveOption {
5
5
  constructor(serverResponse) {
6
6
  this.replace = serverResponse["replace"];
7
7
  }
8
+ /** Returns a readable representation of active data schema options. */
8
9
  toString() {
9
10
  return `Data Schema\n-----------\n:Replace: ${this.replace ? "True" : "False"}`;
10
11
  }
@@ -5,7 +5,10 @@ import { BaseProduct } from "../../../v2/product/baseProduct.js";
5
5
  * Automatically extract structured data from any image or scanned document.
6
6
  */
7
7
  export declare class Extraction extends BaseProduct {
8
+ /** Parameter class accepted by this product. */
8
9
  static get parametersClass(): typeof ExtractionParameters;
10
+ /** Response class returned by this product. */
9
11
  static get responseClass(): typeof ExtractionResponse;
12
+ /** API slug for this product. */
10
13
  static get slug(): string;
11
14
  }
@@ -5,12 +5,15 @@ import { BaseProduct } from "../../../v2/product/baseProduct.js";
5
5
  * Automatically extract structured data from any image or scanned document.
6
6
  */
7
7
  export class Extraction extends BaseProduct {
8
+ /** Parameter class accepted by this product. */
8
9
  static get parametersClass() {
9
10
  return ExtractionParameters;
10
11
  }
12
+ /** Response class returned by this product. */
11
13
  static get responseClass() {
12
14
  return ExtractionResponse;
13
15
  }
16
+ /** API slug for this product. */
14
17
  static get slug() {
15
18
  return "extraction";
16
19
  }
@@ -1,5 +1,6 @@
1
1
  import { StringDict } from "../../../parsing/stringDict.js";
2
2
  import { DataSchemaActiveOption } from "./dataSchemaActiveOption.js";
3
+ /** Active extraction options echoed by the API. */
3
4
  export declare class ExtractionActiveOptions {
4
5
  /**
5
6
  * Whether the RAG feature was activated.
@@ -26,5 +27,6 @@ export declare class ExtractionActiveOptions {
26
27
  */
27
28
  dataSchema: DataSchemaActiveOption;
28
29
  constructor(serverResponse: StringDict);
30
+ /** Returns a readable representation of active options. */
29
31
  toString(): string;
30
32
  }
@@ -1,4 +1,5 @@
1
1
  import { DataSchemaActiveOption } from "./dataSchemaActiveOption.js";
2
+ /** Active extraction options echoed by the API. */
2
3
  export class ExtractionActiveOptions {
3
4
  constructor(serverResponse) {
4
5
  this.rag = serverResponse["rag"];
@@ -8,6 +9,7 @@ export class ExtractionActiveOptions {
8
9
  this.textContext = serverResponse["text_context"];
9
10
  this.dataSchema = new DataSchemaActiveOption(serverResponse["data_schema"]);
10
11
  }
12
+ /** Returns a readable representation of active options. */
11
13
  toString() {
12
14
  return "Active Options\n" +
13
15
  "==============\n" +
@@ -2,6 +2,7 @@ import { StringDict } from "../../../parsing/stringDict.js";
2
2
  import { ExtractionResult } from "./extractionResult.js";
3
3
  import { ExtractionActiveOptions } from "./extractionActiveOptions.js";
4
4
  import { BaseInference } from "../../../v2/parsing/inference/baseInference.js";
5
+ /** Inference payload for extraction responses. */
5
6
  export declare class ExtractionInference extends BaseInference {
6
7
  /**
7
8
  * Result of the inference.
@@ -12,5 +13,6 @@ export declare class ExtractionInference extends BaseInference {
12
13
  */
13
14
  activeOptions: ExtractionActiveOptions;
14
15
  constructor(serverResponse: StringDict);
16
+ /** Returns a readable representation of the inference. */
15
17
  toString(): string;
16
18
  }
@@ -1,12 +1,14 @@
1
1
  import { ExtractionResult } from "./extractionResult.js";
2
2
  import { ExtractionActiveOptions } from "./extractionActiveOptions.js";
3
3
  import { BaseInference } from "../../../v2/parsing/inference/baseInference.js";
4
+ /** Inference payload for extraction responses. */
4
5
  export class ExtractionInference extends BaseInference {
5
6
  constructor(serverResponse) {
6
7
  super(serverResponse);
7
8
  this.result = new ExtractionResult(serverResponse["result"]);
8
9
  this.activeOptions = new ExtractionActiveOptions(serverResponse["active_options"]);
9
10
  }
11
+ /** Returns a readable representation of the inference. */
10
12
  toString() {
11
13
  return (super.toString() +
12
14
  this.activeOptions.toString() + "\n" +
@@ -1,6 +1,7 @@
1
1
  import { ExtractionInference } from "./extractionInference.js";
2
2
  import { StringDict } from "../../../parsing/stringDict.js";
3
3
  import { BaseResponse } from "../../../v2/parsing/index.js";
4
+ /** Response wrapper for extraction product calls. */
4
5
  export declare class ExtractionResponse extends BaseResponse {
5
6
  /**
6
7
  * The inference result for an extraction request.
@@ -1,5 +1,6 @@
1
1
  import { ExtractionInference } from "./extractionInference.js";
2
2
  import { BaseResponse } from "../../../v2/parsing/index.js";
3
+ /** Response wrapper for extraction product calls. */
3
4
  export class ExtractionResponse extends BaseResponse {
4
5
  /**
5
6
  * @param serverResponse JSON response from the server.
@@ -2,6 +2,7 @@ import { InferenceFields } from "../../../v2/parsing/inference/field/index.js";
2
2
  import { StringDict } from "../../../parsing/stringDict.js";
3
3
  import { RawText } from "../../../v2/parsing/inference/field/rawText.js";
4
4
  import { RagMetadata } from "../../../v2/parsing/inference/field/ragMetadata.js";
5
+ /** Extraction result payload containing fields and optional extras. */
5
6
  export declare class ExtractionResult {
6
7
  /**
7
8
  * Fields contained in the inference.
@@ -16,5 +17,6 @@ export declare class ExtractionResult {
16
17
  */
17
18
  rag?: RagMetadata;
18
19
  constructor(serverResponse: StringDict);
20
+ /** Returns a readable representation of extracted fields. */
19
21
  toString(): string;
20
22
  }
@@ -1,6 +1,7 @@
1
1
  import { InferenceFields } from "../../../v2/parsing/inference/field/index.js";
2
2
  import { RawText } from "../../../v2/parsing/inference/field/rawText.js";
3
3
  import { RagMetadata } from "../../../v2/parsing/inference/field/ragMetadata.js";
4
+ /** Extraction result payload containing fields and optional extras. */
4
5
  export class ExtractionResult {
5
6
  constructor(serverResponse) {
6
7
  this.fields = new InferenceFields(serverResponse["fields"]);
@@ -11,6 +12,7 @@ export class ExtractionResult {
11
12
  this.rag = new RagMetadata(serverResponse["rag"]);
12
13
  }
13
14
  }
15
+ /** Returns a readable representation of extracted fields. */
14
16
  toString() {
15
17
  return `Fields\n======\n${this.fields}`;
16
18
  }
@@ -1,5 +1,10 @@
1
1
  import { StringDict } from "../../../../parsing/stringDict.js";
2
- import { DataSchemaReplace } from "./dataSchemaReplace.js";
2
+ import { DataSchemaReplace, DataSchemaReplaceJson } from "./dataSchemaReplace.js";
3
+ /** JSON payload for top-level data schema options. */
4
+ export interface DataSchemaJson {
5
+ /** Optional full replacement schema. */
6
+ replace?: DataSchemaReplaceJson;
7
+ }
3
8
  /**
4
9
  * Modify the Data Schema.
5
10
  */
@@ -9,10 +14,8 @@ export declare class DataSchema {
9
14
  */
10
15
  replace?: DataSchemaReplace;
11
16
  constructor(dataSchema: StringDict | string);
12
- toJSON(): {
13
- replace: {
14
- fields: Record<string, unknown>[];
15
- } | undefined;
16
- };
17
+ /** Serializes the data schema parameters to API format. */
18
+ toJSON(): DataSchemaJson;
19
+ /** Returns a JSON string representation of the data schema parameters. */
17
20
  toString(): string;
18
21
  }
@@ -14,9 +14,11 @@ 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
  toJSON() {
18
19
  return { replace: this.replace?.toJSON() };
19
20
  }
21
+ /** Returns a JSON string representation of the data schema parameters. */
20
22
  toString() {
21
23
  return JSON.stringify(this.toJSON());
22
24
  }
@@ -1,4 +1,26 @@
1
1
  import { StringDict } from "../../../../parsing/index.js";
2
+ /** JSON payload for a single data schema field definition. */
3
+ export interface DataSchemaFieldJson {
4
+ /** Field key used in results. */
5
+ name: string;
6
+ /** Human-readable field title. */
7
+ title: string;
8
+ /** Whether the field accepts multiple values. */
9
+ is_array: boolean;
10
+ /** Field type name. */
11
+ type: string;
12
+ /** Optional allowed classes for classification fields. */
13
+ classification_values?: Array<string>;
14
+ /** Optional deduplication behavior for array fields. */
15
+ unique_values?: boolean;
16
+ /** Optional field description. */
17
+ description?: string;
18
+ /** Optional extraction guidelines. */
19
+ guidelines?: string;
20
+ /** Optional nested schema for object fields. */
21
+ nested_fields?: StringDict;
22
+ }
23
+ /** Data schema field definition used by extraction parameters. */
2
24
  export declare class DataSchemaField {
3
25
  /**
4
26
  * Display name for the field, also impacts inference results.
@@ -38,6 +60,8 @@ export declare class DataSchemaField {
38
60
  */
39
61
  nestedFields?: StringDict;
40
62
  constructor(fields: StringDict);
41
- toJSON(): Record<string, unknown>;
63
+ /** Serializes the field definition to API format. */
64
+ toJSON(): DataSchemaFieldJson;
65
+ /** Returns a JSON string representation of the field definition. */
42
66
  toString(): string;
43
67
  }
@@ -1,3 +1,4 @@
1
+ /** Data schema field definition used by extraction parameters. */
1
2
  export class DataSchemaField {
2
3
  constructor(fields) {
3
4
  this.name = fields["name"];
@@ -10,6 +11,7 @@ export class DataSchemaField {
10
11
  this.guidelines = fields["guidelines"];
11
12
  this.nestedFields = fields["nested_fields"];
12
13
  }
14
+ /** Serializes the field definition to API format. */
13
15
  toJSON() {
14
16
  const out = {
15
17
  name: this.name,
@@ -33,6 +35,7 @@ export class DataSchemaField {
33
35
  out.nested_fields = this.nestedFields;
34
36
  return out;
35
37
  }
38
+ /** Returns a JSON string representation of the field definition. */
36
39
  toString() {
37
40
  return JSON.stringify(this.toJSON());
38
41
  }
@@ -1,5 +1,10 @@
1
1
  import { StringDict } from "../../../../parsing/index.js";
2
- import { DataSchemaField } from "./dataSchemaField.js";
2
+ import { DataSchemaField, DataSchemaFieldJson } from "./dataSchemaField.js";
3
+ /** JSON payload for replacement data schema options. */
4
+ export interface DataSchemaReplaceJson {
5
+ /** Field definitions replacing the current schema. */
6
+ fields: Array<DataSchemaFieldJson>;
7
+ }
3
8
  /**
4
9
  * The structure to completely replace the data schema of the model.
5
10
  */
@@ -9,8 +14,8 @@ export declare class DataSchemaReplace {
9
14
  */
10
15
  fields: Array<DataSchemaField>;
11
16
  constructor(dataSchemaReplace: StringDict);
12
- toJSON(): {
13
- fields: Record<string, unknown>[];
14
- };
17
+ /** Serializes the replacement schema to API format. */
18
+ toJSON(): DataSchemaReplaceJson;
19
+ /** Returns a JSON string representation of the replacement schema. */
15
20
  toString(): string;
16
21
  }
@@ -13,9 +13,11 @@ 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
  toJSON() {
17
18
  return { fields: this.fields.map(e => e.toJSON()) };
18
19
  }
20
+ /** Returns a JSON string representation of the replacement schema. */
19
21
  toString() {
20
22
  return JSON.stringify(this.toJSON());
21
23
  }