mindee 5.5.0 → 5.6.1

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 +21 -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,4 +1,5 @@
1
1
  import { createField } from "./fieldFactory.js";
2
+ /** Typed map of extraction fields returned by the API. */
2
3
  export class InferenceFields extends Map {
3
4
  constructor(serverResponse, indentLevel = 0) {
4
5
  super(Object.entries(serverResponse).map(([key, value]) => {
@@ -6,6 +7,7 @@ export class InferenceFields extends Map {
6
7
  }));
7
8
  this._indentLevel = indentLevel;
8
9
  }
10
+ /** Returns a field as a `SimpleField`, or throws if the type mismatches. */
9
11
  getSimpleField(fieldName) {
10
12
  const field = this.get(fieldName);
11
13
  if (field === undefined) {
@@ -16,6 +18,7 @@ export class InferenceFields extends Map {
16
18
  }
17
19
  return field;
18
20
  }
21
+ /** Returns a field as an `ObjectField`, or throws if the type mismatches. */
19
22
  getObjectField(fieldName) {
20
23
  const field = this.get(fieldName);
21
24
  if (field === undefined) {
@@ -26,6 +29,7 @@ export class InferenceFields extends Map {
26
29
  }
27
30
  return field;
28
31
  }
32
+ /** Returns a field as a `ListField`, or throws if the type mismatches. */
29
33
  getListField(fieldName) {
30
34
  const field = this.get(fieldName);
31
35
  if (field === undefined) {
@@ -2,6 +2,7 @@ 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
+ /** List-valued inference field. */
5
6
  export declare class ListField extends BaseField {
6
7
  /**
7
8
  * Items contained in the list.
@@ -16,5 +17,6 @@ export declare class ListField extends BaseField {
16
17
  */
17
18
  get objectItems(): Array<ObjectField>;
18
19
  constructor(serverResponse: StringDict, indentLevel?: number);
20
+ /** Returns a readable representation of list items. */
19
21
  toString(): string;
20
22
  }
@@ -3,6 +3,7 @@ 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
+ /** List-valued inference field. */
6
7
  export class ListField extends BaseField {
7
8
  /**
8
9
  * SimpleField items from the list.
@@ -43,6 +44,7 @@ export class ListField extends BaseField {
43
44
  return createField(item, indentLevel + 1);
44
45
  });
45
46
  }
47
+ /** Returns a readable representation of list items. */
46
48
  toString() {
47
49
  if (!this.items || this.items.length === 0) {
48
50
  return "\n";
@@ -3,7 +3,9 @@ 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
+ /** Object-valued inference field. */
6
7
  export declare class ObjectField extends BaseField {
8
+ /** Nested fields carried by this object. */
7
9
  readonly fields: InferenceFields;
8
10
  /**
9
11
  * Retrieves the simple sub-fields in the object.
@@ -48,6 +50,8 @@ export declare class ObjectField extends BaseField {
48
50
  */
49
51
  getObjectField(fieldName: string): ObjectField;
50
52
  constructor(serverResponse: StringDict, indentLevel?: number);
53
+ /** Returns a readable representation of nested fields. */
51
54
  toString(): string;
55
+ /** Returns a compact representation suitable for list items. */
52
56
  toStringFromList(): string;
53
57
  }
@@ -1,5 +1,6 @@
1
1
  import { InferenceFields } from "./inferenceFields.js";
2
2
  import { BaseField } from "./baseField.js";
3
+ /** Object-valued inference field. */
3
4
  export class ObjectField extends BaseField {
4
5
  /**
5
6
  * Retrieves the simple sub-fields in the object.
@@ -95,9 +96,11 @@ export class ObjectField extends BaseField {
95
96
  super(serverResponse, indentLevel);
96
97
  this.fields = new InferenceFields(serverResponse["fields"], this._indentLevel + 1);
97
98
  }
99
+ /** Returns a readable representation of nested fields. */
98
100
  toString() {
99
101
  return "\n" + (this.fields ? this.fields.toString(1) : "");
100
102
  }
103
+ /** Returns a compact representation suitable for list items. */
101
104
  toStringFromList() {
102
105
  return this.fields ? this.fields.toString(2).substring(4) : "";
103
106
  }
@@ -1,4 +1,5 @@
1
1
  import { StringDict } from "../../../../parsing/stringDict.js";
2
+ /** Metadata produced by RAG-enabled extraction. */
2
3
  export declare class RagMetadata {
3
4
  /**
4
5
  * The UUID of the matched document used during the RAG operation.
@@ -1,3 +1,4 @@
1
+ /** Metadata produced by RAG-enabled extraction. */
1
2
  export class RagMetadata {
2
3
  constructor(serverResponse) {
3
4
  this.retrievedDocumentId = serverResponse["retrieved_document_id"] ?? undefined;
@@ -1,10 +1,12 @@
1
1
  import { StringDict } from "../../../../parsing/stringDict.js";
2
2
  import { RawTextPage } from "./rawTextPage.js";
3
+ /** Full raw OCR text grouped by page. */
3
4
  export declare class RawText {
4
5
  /**
5
6
  * List of pages with their extracted text content.
6
7
  */
7
8
  pages: Array<RawTextPage>;
8
9
  constructor(serverResponse: StringDict);
10
+ /** Returns concatenated raw text for all pages. */
9
11
  toString(): string;
10
12
  }
@@ -1,8 +1,10 @@
1
1
  import { RawTextPage } from "./rawTextPage.js";
2
+ /** Full raw OCR text grouped by page. */
2
3
  export class RawText {
3
4
  constructor(serverResponse) {
4
5
  this.pages = serverResponse["pages"] ? serverResponse["pages"].map((rawTextPage) => new RawTextPage(rawTextPage)) : [];
5
6
  }
7
+ /** Returns concatenated raw text for all pages. */
6
8
  toString() {
7
9
  return this.pages.map(page => page.toString()).join("\n\n");
8
10
  }
@@ -1,5 +1,6 @@
1
1
  import { StringDict } from "../../../../parsing/stringDict.js";
2
2
  import { BaseField } from "./baseField.js";
3
+ /** Scalar inference field. */
3
4
  export declare class SimpleField extends BaseField {
4
5
  /**
5
6
  * The untyped value of the field.
@@ -23,5 +24,6 @@ export declare class SimpleField extends BaseField {
23
24
  * Retrieves a boolean field value as a boolean.
24
25
  */
25
26
  get booleanValue(): boolean | null;
27
+ /** Returns a readable scalar representation. */
26
28
  toString(): string;
27
29
  }
@@ -1,4 +1,5 @@
1
1
  import { BaseField } from "./baseField.js";
2
+ /** Scalar inference field. */
2
3
  export class SimpleField extends BaseField {
3
4
  constructor(serverResponse, indentLevel = 0) {
4
5
  super(serverResponse, indentLevel);
@@ -32,6 +33,7 @@ export class SimpleField extends BaseField {
32
33
  }
33
34
  return this.value;
34
35
  }
36
+ /** Returns a readable scalar representation. */
35
37
  toString() {
36
38
  if (this.value === null) {
37
39
  return "";
@@ -1,4 +1,5 @@
1
1
  import { StringDict } from "../../../parsing/stringDict.js";
2
+ /** File metadata attached to a v2 inference. */
2
3
  export declare class InferenceFile {
3
4
  /**
4
5
  * Name of the file.
@@ -17,5 +18,6 @@ export declare class InferenceFile {
17
18
  */
18
19
  mimeType: string;
19
20
  constructor(serverResponse: StringDict);
21
+ /** Returns a printable representation of file metadata. */
20
22
  toString(): string;
21
23
  }
@@ -1,3 +1,4 @@
1
+ /** File metadata attached to a v2 inference. */
1
2
  export class InferenceFile {
2
3
  constructor(serverResponse) {
3
4
  this.name = serverResponse["name"];
@@ -5,6 +6,7 @@ export class InferenceFile {
5
6
  this.pageCount = serverResponse["page_count"];
6
7
  this.mimeType = serverResponse["mime_type"];
7
8
  }
9
+ /** Returns a printable representation of file metadata. */
8
10
  toString() {
9
11
  return ("File\n" +
10
12
  "====\n" +
@@ -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
  }