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
@@ -4,12 +4,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _InvoiceV4LineItem_instances, _InvoiceV4LineItem_printableValues;
7
- import { cleanSpecialChars, floatToString } from "../../../v1/parsing/common/index.js";
7
+ import { cleanAndTruncate, floatToString } from "../../../v1/parsing/common/index.js";
8
8
  import { Polygon } from "../../../geometry/index.js";
9
9
  /**
10
10
  * List of all the line items present on the invoice.
11
11
  */
12
12
  export class InvoiceV4LineItem {
13
+ // eslint-disable-next-line sonarjs/cognitive-complexity
13
14
  constructor({ prediction = {} }) {
14
15
  _InvoiceV4LineItem_instances.add(this);
15
16
  /** Confidence score */
@@ -116,25 +117,13 @@ export class InvoiceV4LineItem {
116
117
  }
117
118
  _InvoiceV4LineItem_instances = new WeakSet(), _InvoiceV4LineItem_printableValues = function _InvoiceV4LineItem_printableValues() {
118
119
  return {
119
- description: this.description ?
120
- this.description.length <= 36 ?
121
- cleanSpecialChars(this.description) :
122
- cleanSpecialChars(this.description).slice(0, 33) + "..." :
123
- "",
124
- productCode: this.productCode ?
125
- this.productCode.length <= 12 ?
126
- cleanSpecialChars(this.productCode) :
127
- cleanSpecialChars(this.productCode).slice(0, 9) + "..." :
128
- "",
120
+ description: cleanAndTruncate(this.description, 36),
121
+ productCode: cleanAndTruncate(this.productCode, 12),
129
122
  quantity: this.quantity !== undefined ? floatToString(this.quantity) : "",
130
123
  taxAmount: this.taxAmount !== undefined ? floatToString(this.taxAmount) : "",
131
124
  taxRate: this.taxRate !== undefined ? floatToString(this.taxRate) : "",
132
125
  totalAmount: this.totalAmount !== undefined ? floatToString(this.totalAmount) : "",
133
- unitMeasure: this.unitMeasure ?
134
- this.unitMeasure.length <= 15 ?
135
- cleanSpecialChars(this.unitMeasure) :
136
- cleanSpecialChars(this.unitMeasure).slice(0, 12) + "..." :
137
- "",
126
+ unitMeasure: cleanAndTruncate(this.unitMeasure, 15),
138
127
  unitPrice: this.unitPrice !== undefined ? floatToString(this.unitPrice) : "",
139
128
  };
140
129
  };
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _ReceiptV5LineItem_instances, _ReceiptV5LineItem_printableValues;
7
- import { cleanSpecialChars, floatToString } from "../../../v1/parsing/common/index.js";
7
+ import { cleanAndTruncate, floatToString } from "../../../v1/parsing/common/index.js";
8
8
  import { Polygon } from "../../../geometry/index.js";
9
9
  /**
10
10
  * List of all line items on the receipt.
@@ -82,11 +82,7 @@ export class ReceiptV5LineItem {
82
82
  }
83
83
  _ReceiptV5LineItem_instances = new WeakSet(), _ReceiptV5LineItem_printableValues = function _ReceiptV5LineItem_printableValues() {
84
84
  return {
85
- description: this.description ?
86
- this.description.length <= 36 ?
87
- cleanSpecialChars(this.description) :
88
- cleanSpecialChars(this.description).slice(0, 33) + "..." :
89
- "",
85
+ description: cleanAndTruncate(this.description, 36),
90
86
  quantity: this.quantity !== undefined ? floatToString(this.quantity) : "",
91
87
  totalAmount: this.totalAmount !== undefined ? floatToString(this.totalAmount) : "",
92
88
  unitPrice: this.unitPrice !== undefined ? floatToString(this.unitPrice) : "",
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _ResumeV1Certificate_instances, _ResumeV1Certificate_printableValues;
7
- import { cleanSpecialChars } from "../../../v1/parsing/common/index.js";
7
+ import { cleanAndTruncate } from "../../../v1/parsing/common/index.js";
8
8
  import { Polygon } from "../../../geometry/index.js";
9
9
  /**
10
10
  * The list of certificates obtained by the candidate.
@@ -61,25 +61,9 @@ export class ResumeV1Certificate {
61
61
  }
62
62
  _ResumeV1Certificate_instances = new WeakSet(), _ResumeV1Certificate_printableValues = function _ResumeV1Certificate_printableValues() {
63
63
  return {
64
- grade: this.grade ?
65
- this.grade.length <= 10 ?
66
- cleanSpecialChars(this.grade) :
67
- cleanSpecialChars(this.grade).slice(0, 7) + "..." :
68
- "",
69
- name: this.name ?
70
- this.name.length <= 30 ?
71
- cleanSpecialChars(this.name) :
72
- cleanSpecialChars(this.name).slice(0, 27) + "..." :
73
- "",
74
- provider: this.provider ?
75
- this.provider.length <= 25 ?
76
- cleanSpecialChars(this.provider) :
77
- cleanSpecialChars(this.provider).slice(0, 22) + "..." :
78
- "",
79
- year: this.year ?
80
- this.year.length <= 4 ?
81
- cleanSpecialChars(this.year) :
82
- cleanSpecialChars(this.year).slice(0, 1) + "..." :
83
- "",
64
+ grade: cleanAndTruncate(this.grade, 10),
65
+ name: cleanAndTruncate(this.name, 30),
66
+ provider: cleanAndTruncate(this.provider, 25),
67
+ year: cleanAndTruncate(this.year, 4),
84
68
  };
85
69
  };
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _ResumeV1Education_instances, _ResumeV1Education_printableValues;
7
- import { cleanSpecialChars } from "../../../v1/parsing/common/index.js";
7
+ import { cleanAndTruncate } from "../../../v1/parsing/common/index.js";
8
8
  import { Polygon } from "../../../geometry/index.js";
9
9
  /**
10
10
  * The list of the candidate's educational background.
@@ -76,40 +76,12 @@ export class ResumeV1Education {
76
76
  }
77
77
  _ResumeV1Education_instances = new WeakSet(), _ResumeV1Education_printableValues = function _ResumeV1Education_printableValues() {
78
78
  return {
79
- degreeDomain: this.degreeDomain ?
80
- this.degreeDomain.length <= 15 ?
81
- cleanSpecialChars(this.degreeDomain) :
82
- cleanSpecialChars(this.degreeDomain).slice(0, 12) + "..." :
83
- "",
84
- degreeType: this.degreeType ?
85
- this.degreeType.length <= 25 ?
86
- cleanSpecialChars(this.degreeType) :
87
- cleanSpecialChars(this.degreeType).slice(0, 22) + "..." :
88
- "",
89
- endMonth: this.endMonth ?
90
- this.endMonth.length <= 9 ?
91
- cleanSpecialChars(this.endMonth) :
92
- cleanSpecialChars(this.endMonth).slice(0, 6) + "..." :
93
- "",
94
- endYear: this.endYear ?
95
- this.endYear.length <= 8 ?
96
- cleanSpecialChars(this.endYear) :
97
- cleanSpecialChars(this.endYear).slice(0, 5) + "..." :
98
- "",
99
- school: this.school ?
100
- this.school.length <= 25 ?
101
- cleanSpecialChars(this.school) :
102
- cleanSpecialChars(this.school).slice(0, 22) + "..." :
103
- "",
104
- startMonth: this.startMonth ?
105
- this.startMonth.length <= 11 ?
106
- cleanSpecialChars(this.startMonth) :
107
- cleanSpecialChars(this.startMonth).slice(0, 8) + "..." :
108
- "",
109
- startYear: this.startYear ?
110
- this.startYear.length <= 10 ?
111
- cleanSpecialChars(this.startYear) :
112
- cleanSpecialChars(this.startYear).slice(0, 7) + "..." :
113
- "",
79
+ degreeDomain: cleanAndTruncate(this.degreeDomain, 15),
80
+ degreeType: cleanAndTruncate(this.degreeType, 25),
81
+ endMonth: cleanAndTruncate(this.endMonth, 9),
82
+ endYear: cleanAndTruncate(this.endYear, 8),
83
+ school: cleanAndTruncate(this.school, 25),
84
+ startMonth: cleanAndTruncate(this.startMonth, 11),
85
+ startYear: cleanAndTruncate(this.startYear, 10),
114
86
  };
115
87
  };
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _ResumeV1Language_instances, _ResumeV1Language_printableValues;
7
- import { cleanSpecialChars } from "../../../v1/parsing/common/index.js";
7
+ import { cleanAndTruncate } from "../../../v1/parsing/common/index.js";
8
8
  import { Polygon } from "../../../geometry/index.js";
9
9
  /**
10
10
  * The list of languages that the candidate is proficient in.
@@ -51,15 +51,7 @@ export class ResumeV1Language {
51
51
  }
52
52
  _ResumeV1Language_instances = new WeakSet(), _ResumeV1Language_printableValues = function _ResumeV1Language_printableValues() {
53
53
  return {
54
- language: this.language ?
55
- this.language.length <= 8 ?
56
- cleanSpecialChars(this.language) :
57
- cleanSpecialChars(this.language).slice(0, 5) + "..." :
58
- "",
59
- level: this.level ?
60
- this.level.length <= 20 ?
61
- cleanSpecialChars(this.level) :
62
- cleanSpecialChars(this.level).slice(0, 17) + "..." :
63
- "",
54
+ language: cleanAndTruncate(this.language, 8),
55
+ level: cleanAndTruncate(this.level, 20),
64
56
  };
65
57
  };
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _ResumeV1ProfessionalExperience_instances, _ResumeV1ProfessionalExperience_printableValues;
7
- import { cleanSpecialChars } from "../../../v1/parsing/common/index.js";
7
+ import { cleanAndTruncate } from "../../../v1/parsing/common/index.js";
8
8
  import { Polygon } from "../../../geometry/index.js";
9
9
  /**
10
10
  * The list of the candidate's professional experiences.
@@ -86,50 +86,14 @@ export class ResumeV1ProfessionalExperience {
86
86
  }
87
87
  _ResumeV1ProfessionalExperience_instances = new WeakSet(), _ResumeV1ProfessionalExperience_printableValues = function _ResumeV1ProfessionalExperience_printableValues() {
88
88
  return {
89
- contractType: this.contractType ?
90
- this.contractType.length <= 15 ?
91
- cleanSpecialChars(this.contractType) :
92
- cleanSpecialChars(this.contractType).slice(0, 12) + "..." :
93
- "",
94
- department: this.department ?
95
- this.department.length <= 10 ?
96
- cleanSpecialChars(this.department) :
97
- cleanSpecialChars(this.department).slice(0, 7) + "..." :
98
- "",
99
- description: this.description ?
100
- this.description.length <= 36 ?
101
- cleanSpecialChars(this.description) :
102
- cleanSpecialChars(this.description).slice(0, 33) + "..." :
103
- "",
104
- employer: this.employer ?
105
- this.employer.length <= 25 ?
106
- cleanSpecialChars(this.employer) :
107
- cleanSpecialChars(this.employer).slice(0, 22) + "..." :
108
- "",
109
- endMonth: this.endMonth ?
110
- this.endMonth.length <= 9 ?
111
- cleanSpecialChars(this.endMonth) :
112
- cleanSpecialChars(this.endMonth).slice(0, 6) + "..." :
113
- "",
114
- endYear: this.endYear ?
115
- this.endYear.length <= 8 ?
116
- cleanSpecialChars(this.endYear) :
117
- cleanSpecialChars(this.endYear).slice(0, 5) + "..." :
118
- "",
119
- role: this.role ?
120
- this.role.length <= 20 ?
121
- cleanSpecialChars(this.role) :
122
- cleanSpecialChars(this.role).slice(0, 17) + "..." :
123
- "",
124
- startMonth: this.startMonth ?
125
- this.startMonth.length <= 11 ?
126
- cleanSpecialChars(this.startMonth) :
127
- cleanSpecialChars(this.startMonth).slice(0, 8) + "..." :
128
- "",
129
- startYear: this.startYear ?
130
- this.startYear.length <= 10 ?
131
- cleanSpecialChars(this.startYear) :
132
- cleanSpecialChars(this.startYear).slice(0, 7) + "..." :
133
- "",
89
+ contractType: cleanAndTruncate(this.contractType, 15),
90
+ department: cleanAndTruncate(this.department, 10),
91
+ description: cleanAndTruncate(this.description, 36),
92
+ employer: cleanAndTruncate(this.employer, 25),
93
+ endMonth: cleanAndTruncate(this.endMonth, 9),
94
+ endYear: cleanAndTruncate(this.endYear, 8),
95
+ role: cleanAndTruncate(this.role, 20),
96
+ startMonth: cleanAndTruncate(this.startMonth, 11),
97
+ startYear: cleanAndTruncate(this.startYear, 10),
134
98
  };
135
99
  };
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _ResumeV1SocialNetworksUrl_instances, _ResumeV1SocialNetworksUrl_printableValues;
7
- import { cleanSpecialChars } from "../../../v1/parsing/common/index.js";
7
+ import { cleanAndTruncate } from "../../../v1/parsing/common/index.js";
8
8
  import { Polygon } from "../../../geometry/index.js";
9
9
  /**
10
10
  * The list of social network profiles of the candidate.
@@ -51,15 +51,7 @@ export class ResumeV1SocialNetworksUrl {
51
51
  }
52
52
  _ResumeV1SocialNetworksUrl_instances = new WeakSet(), _ResumeV1SocialNetworksUrl_printableValues = function _ResumeV1SocialNetworksUrl_printableValues() {
53
53
  return {
54
- name: this.name ?
55
- this.name.length <= 20 ?
56
- cleanSpecialChars(this.name) :
57
- cleanSpecialChars(this.name).slice(0, 17) + "..." :
58
- "",
59
- url: this.url ?
60
- this.url.length <= 50 ?
61
- cleanSpecialChars(this.url) :
62
- cleanSpecialChars(this.url).slice(0, 47) + "..." :
63
- "",
54
+ name: cleanAndTruncate(this.name, 20),
55
+ url: cleanAndTruncate(this.url, 50),
64
56
  };
65
57
  };
package/src/v2/cli.d.ts CHANGED
@@ -1 +1,4 @@
1
+ /**
2
+ * Build the CLI.
3
+ */
1
4
  export declare function cli(): void;
package/src/v2/cli.js CHANGED
@@ -6,12 +6,22 @@ const program = new Command();
6
6
  //
7
7
  // EXECUTE THE COMMANDS
8
8
  //
9
+ /**
10
+ * Initialize the client.
11
+ * @param options Options.
12
+ */
9
13
  function initClient(options) {
10
14
  return new Client({
11
15
  apiKey: options.apiKey,
12
16
  debug: options.debug,
13
17
  });
14
18
  }
19
+ /**
20
+ * Enqueue and get inference.
21
+ * @param product Product.
22
+ * @param inputPath Input path.
23
+ * @param options Options.
24
+ */
15
25
  async function enqueueAndGetInference(product, inputPath, options) {
16
26
  const mindeeClient = initClient(options);
17
27
  let inputSource;
@@ -31,6 +41,10 @@ async function enqueueAndGetInference(product, inputPath, options) {
31
41
  }
32
42
  printResponse(response.inference);
33
43
  }
44
+ /**
45
+ * Print response.
46
+ * @param document Document.
47
+ */
34
48
  function printResponse(document) {
35
49
  if (document) {
36
50
  console.log(`\n${document}`);
@@ -39,10 +53,17 @@ function printResponse(document) {
39
53
  //
40
54
  // BUILD THE COMMANDS
41
55
  //
56
+ /**
57
+ * Add main options.
58
+ * @param prog Program.
59
+ */
42
60
  function addMainOptions(prog) {
43
61
  prog.requiredOption("-m, --model <model_id>", "Model ID (required)");
44
62
  prog.argument("<input_path>", "full path or URL to the file");
45
63
  }
64
+ /**
65
+ * Build the CLI.
66
+ */
46
67
  export function cli() {
47
68
  program.name("mindee")
48
69
  .description("Command line interface for Mindee V2 products.")
@@ -39,6 +39,7 @@ export declare class Client {
39
39
  * @returns a `Promise` containing the search response.
40
40
  */
41
41
  searchModels(name?: string, modelType?: string): Promise<SearchResponse>;
42
+ /** Enqueues a product inference job without waiting for completion. */
42
43
  enqueue<P extends typeof BaseProduct>(product: P, inputSource: InputSource, params: InstanceType<P["parametersClass"]> | ConstructorParameters<P["parametersClass"]>[0]): Promise<JobResponse>;
43
44
  /**
44
45
  * Retrieves the result of a previously enqueued request.
package/src/v2/client.js CHANGED
@@ -34,6 +34,7 @@ export class Client {
34
34
  async searchModels(name, modelType) {
35
35
  return await this.mindeeApi.reqGetSearchModel(name, modelType);
36
36
  }
37
+ /** Enqueues a product inference job without waiting for completion. */
37
38
  async enqueue(product, inputSource, params) {
38
39
  if (inputSource === undefined) {
39
40
  throw new MindeeError("An input document is required.");
@@ -1,5 +1,8 @@
1
+ /** Optional timer settings used by polling delays. */
1
2
  export interface TimerOptions {
3
+ /** Whether the timer should keep the event loop active. */
2
4
  ref?: boolean;
5
+ /** Optional signal used to abort timer waits. */
3
6
  signal?: AbortSignal;
4
7
  }
5
8
  export interface PollingOptionsConstructor {
@@ -51,6 +54,8 @@ export declare class PollingOptions {
51
54
  /** Options passed to every recurring `setTimeout()`. */
52
55
  recurringTimerOptions?: TimerOptions;
53
56
  constructor(params?: PollingOptionsConstructor);
57
+ /** Validates polling options against minimum accepted values. */
54
58
  validateSettings(): void;
59
+ /** Returns a compact string representation of the polling options. */
55
60
  toString(): string;
56
61
  }
@@ -65,6 +65,7 @@ export class PollingOptions {
65
65
  this.validateSettings();
66
66
  logger.debug(`Polling options initialized: ${this.toString()}`);
67
67
  }
68
+ /** Validates polling options against minimum accepted values. */
68
69
  validateSettings() {
69
70
  if (this.delaySec < minDelaySec) {
70
71
  throw new MindeeConfigurationError(`Cannot set auto-parsing delay to less than ${minDelaySec} second(s).`);
@@ -76,6 +77,7 @@ export class PollingOptions {
76
77
  throw new MindeeConfigurationError(`Cannot set retry to less than ${minRetries}.`);
77
78
  }
78
79
  }
80
+ /** Returns a compact string representation of the polling options. */
79
81
  toString() {
80
82
  return `{ initialDelaySec: ${this.initialDelaySec}, delaySec: ${this.delaySec}, maxRetries: ${this.maxRetries} }`;
81
83
  }
@@ -1,4 +1,5 @@
1
1
  import { StringDict } from "../../parsing/stringDict.js";
2
+ /** Base response contract for v2 product responses. */
2
3
  export declare abstract class BaseResponse {
3
4
  /**
4
5
  * Raw text representation of the API's response.
@@ -14,4 +15,5 @@ export declare abstract class BaseResponse {
14
15
  */
15
16
  getRawHttp(): StringDict;
16
17
  }
18
+ /** Constructor signature for typed v2 response classes. */
17
19
  export type ResponseConstructor<T extends BaseResponse> = new (serverResponse: StringDict) => T;
@@ -1,4 +1,5 @@
1
1
  import { logger } from "../../logger.js";
2
+ /** Base response contract for v2 product responses. */
2
3
  export class BaseResponse {
3
4
  /**
4
5
  * @param serverResponse JSON response from the server.
@@ -1,4 +1,5 @@
1
1
  import { ErrorItem } from "./errorItem.js";
2
+ /** Structured error payload returned by v2 APIs. */
2
3
  export interface ErrorDetails {
3
4
  /**
4
5
  * The HTTP status code returned by the server.
@@ -1,6 +1,6 @@
1
1
  export { ErrorResponse, ErrorItem, } from "./error/index.js";
2
2
  export type { ErrorDetails } from "./error/index.js";
3
- export { Job, JobResponse, JobWebhook } from "./job/index.js";
3
+ export { Job, JobResponse, JobWebhook, } from "./job/index.js";
4
4
  export { BaseInference, InferenceFile, InferenceModel, } from "./inference/index.js";
5
5
  export { LocalResponse } from "./localResponse.js";
6
6
  export { BaseResponse } from "./baseResponse.js";
@@ -1,5 +1,5 @@
1
1
  export { ErrorResponse, ErrorItem, } from "./error/index.js";
2
- export { Job, JobResponse, JobWebhook } from "./job/index.js";
2
+ export { Job, JobResponse, JobWebhook, } from "./job/index.js";
3
3
  export { BaseInference, InferenceFile, InferenceModel, } from "./inference/index.js";
4
4
  export { LocalResponse } from "./localResponse.js";
5
5
  export { BaseResponse } from "./baseResponse.js";
@@ -2,6 +2,7 @@ import { StringDict } from "../../../parsing/index.js";
2
2
  import { InferenceModel } from "./inferenceModel.js";
3
3
  import { InferenceFile } from "./inferenceFile.js";
4
4
  import { InferenceJob } from "./inferenceJob.js";
5
+ /** Shared metadata container for v2 inference payloads. */
5
6
  export declare abstract class BaseInference {
6
7
  /**
7
8
  * Model info for the inference.
@@ -20,5 +21,6 @@ export declare abstract class BaseInference {
20
21
  */
21
22
  id: string;
22
23
  protected constructor(serverResponse: StringDict);
24
+ /** Returns a printable representation of inference metadata. */
23
25
  toString(): string;
24
26
  }
@@ -1,6 +1,7 @@
1
1
  import { InferenceModel } from "./inferenceModel.js";
2
2
  import { InferenceFile } from "./inferenceFile.js";
3
3
  import { InferenceJob } from "./inferenceJob.js";
4
+ /** Shared metadata container for v2 inference payloads. */
4
5
  export class BaseInference {
5
6
  constructor(serverResponse) {
6
7
  this.id = serverResponse["id"];
@@ -8,6 +9,7 @@ export class BaseInference {
8
9
  this.model = new InferenceModel(serverResponse["model"]);
9
10
  this.file = new InferenceFile(serverResponse["file"]);
10
11
  }
12
+ /** Returns a printable representation of inference metadata. */
11
13
  toString() {
12
14
  return ("Inference\n" +
13
15
  "#########\n" +
@@ -0,0 +1,33 @@
1
+ import { StringDict } from "../../../parsing/index.js";
2
+ import { ErrorResponse } from "../../../v2/index.js";
3
+ import { BaseResponse } from "../../../v2/parsing/baseResponse.js";
4
+ /**
5
+ * Webhook payload returned when an inference fails before producing a result.
6
+ */
7
+ export declare class FailedInferenceResponse extends BaseResponse {
8
+ /**
9
+ * UUID of the failed inference.
10
+ */
11
+ inferenceId: string;
12
+ /**
13
+ * UUID of the model used.
14
+ */
15
+ modelId: string;
16
+ /**
17
+ * Name of the input file.
18
+ */
19
+ fileName: string;
20
+ /**
21
+ * Alias sent for the file, if any.
22
+ */
23
+ fileAlias?: string;
24
+ /**
25
+ * Problem details for the failure, if available.
26
+ */
27
+ error: ErrorResponse;
28
+ /**
29
+ * Date and time when the inference was started.
30
+ */
31
+ createdAt: Date | null;
32
+ constructor(serverResponse: StringDict);
33
+ }
@@ -0,0 +1,17 @@
1
+ import { parseDate } from "../../../parsing/index.js";
2
+ import { ErrorResponse } from "../../../v2/index.js";
3
+ import { BaseResponse } from "../../../v2/parsing/baseResponse.js";
4
+ /**
5
+ * Webhook payload returned when an inference fails before producing a result.
6
+ */
7
+ export class FailedInferenceResponse extends BaseResponse {
8
+ constructor(serverResponse) {
9
+ super(serverResponse);
10
+ this.inferenceId = serverResponse["inference_id"];
11
+ this.modelId = serverResponse["model_id"];
12
+ this.fileName = serverResponse["file_name"];
13
+ this.fileAlias = serverResponse["file_alias"];
14
+ this.error = new ErrorResponse(serverResponse["error"]);
15
+ this.createdAt = parseDate(serverResponse["created_at"]);
16
+ }
17
+ }
@@ -2,8 +2,11 @@ import { FieldConfidence } from "./fieldConfidence.js";
2
2
  import { StringDict } from "../../../../parsing/stringDict.js";
3
3
  import { FieldLocation } from "./fieldLocation.js";
4
4
  export declare abstract class BaseField {
5
+ /** Indentation level used when rendering field text output. */
5
6
  protected _indentLevel: number;
7
+ /** Confidence level associated with this field. */
6
8
  confidence: FieldConfidence | undefined;
9
+ /** Optional list of source locations for this field. */
7
10
  locations: Array<FieldLocation> | undefined;
8
11
  protected constructor(rawResponse: StringDict, indentLevel?: number);
9
12
  }
@@ -2,9 +2,13 @@
2
2
  * Confidence level of a field as returned by the V2 API.
3
3
  */
4
4
  export declare enum FieldConfidence {
5
+ /** Maximum confidence level. */
5
6
  Certain = "Certain",
7
+ /** High confidence level. */
6
8
  High = "High",
9
+ /** Medium confidence level. */
7
10
  Medium = "Medium",
11
+ /** Low confidence level. */
8
12
  Low = "Low"
9
13
  }
10
14
  export declare namespace FieldConfidence {
@@ -4,9 +4,13 @@
4
4
  */
5
5
  export var FieldConfidence;
6
6
  (function (FieldConfidence) {
7
+ /** Maximum confidence level. */
7
8
  FieldConfidence["Certain"] = "Certain";
9
+ /** High confidence level. */
8
10
  FieldConfidence["High"] = "High";
11
+ /** Medium confidence level. */
9
12
  FieldConfidence["Medium"] = "Medium";
13
+ /** Low confidence level. */
10
14
  FieldConfidence["Low"] = "Low";
11
15
  })(FieldConfidence || (FieldConfidence = {}));
12
16
  // eslint-disable-next-line @typescript-eslint/no-namespace
@@ -5,4 +5,9 @@ import { StringDict } from "../../../../parsing/stringDict.js";
5
5
  import { ListField } from "./listField.js";
6
6
  import { ObjectField } from "./objectField.js";
7
7
  import { SimpleField } from "./simpleField.js";
8
+ /**
9
+ * Create a field from a server response.
10
+ * @param serverResponse Server response.
11
+ * @param indentLevel Indent level.
12
+ */
8
13
  export declare function createField(serverResponse: StringDict, indentLevel?: number): SimpleField | ObjectField | ListField;
@@ -2,6 +2,11 @@ import { MindeeDeserializationError } from "../../../../errors/index.js";
2
2
  import { ListField } from "./listField.js";
3
3
  import { ObjectField } from "./objectField.js";
4
4
  import { SimpleField } from "./simpleField.js";
5
+ /**
6
+ * Create a field from a server response.
7
+ * @param serverResponse Server response.
8
+ * @param indentLevel Indent level.
9
+ */
5
10
  export function createField(serverResponse, indentLevel = 0) {
6
11
  if (typeof serverResponse !== "object" || serverResponse === null) {
7
12
  throw new MindeeDeserializationError(`Unrecognized field format ${JSON.stringify(serverResponse)}.`);
@@ -9,5 +9,6 @@ export declare class FieldLocation {
9
9
  /** 0-based page index of where the polygon is located. */
10
10
  readonly page: any;
11
11
  constructor(serverResponse: StringDict);
12
+ /** Returns a readable location string. */
12
13
  toString(): string;
13
14
  }
@@ -7,6 +7,7 @@ export class FieldLocation {
7
7
  this.polygon = new Polygon(...serverResponse["polygon"]);
8
8
  this.page = serverResponse["page"];
9
9
  }
10
+ /** Returns a readable location string. */
10
11
  toString() {
11
12
  return `${this.polygon} on page ${this.page}`;
12
13
  }
@@ -2,11 +2,16 @@ import { StringDict } from "../../../../parsing/stringDict.js";
2
2
  import type { ListField } from "./listField.js";
3
3
  import type { ObjectField } from "./objectField.js";
4
4
  import type { SimpleField } from "./simpleField.js";
5
+ /** Typed map of extraction fields returned by the API. */
5
6
  export declare class InferenceFields extends Map<string, SimpleField | ObjectField | ListField> {
7
+ /** Indentation level used when rendering text output. */
6
8
  protected _indentLevel: number;
7
9
  constructor(serverResponse: StringDict, indentLevel?: number);
10
+ /** Returns a field as a `SimpleField`, or throws if the type mismatches. */
8
11
  getSimpleField(fieldName: string): SimpleField;
12
+ /** Returns a field as an `ObjectField`, or throws if the type mismatches. */
9
13
  getObjectField(fieldName: string): ObjectField;
14
+ /** Returns a field as a `ListField`, or throws if the type mismatches. */
10
15
  getListField(fieldName: string): ListField;
11
16
  toString(indent?: number): string;
12
17
  }