mindee 4.14.1 → 4.16.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 (163) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/package.json +2 -1
  3. package/src/client.d.ts +5 -3
  4. package/src/client.js +7 -1
  5. package/src/http/endpoint.d.ts +3 -1
  6. package/src/http/endpoint.js +12 -8
  7. package/src/http/responseValidation.js +11 -4
  8. package/src/imageOperations/invoiceSplitterExtractor/invoiceSplitterExtractor.d.ts +2 -1
  9. package/src/imageOperations/invoiceSplitterExtractor/invoiceSplitterExtractor.js +2 -1
  10. package/src/imageOperations/multiReceiptsExtractor/multiReceiptsExtractor.js +3 -1
  11. package/src/input/localResponse.d.ts +1 -0
  12. package/src/input/localResponse.js +1 -0
  13. package/src/parsing/common/document.d.ts +1 -0
  14. package/src/parsing/common/document.js +27 -6
  15. package/src/parsing/common/extras/fullTextOcrExtra.d.ts +11 -0
  16. package/src/parsing/common/extras/fullTextOcrExtra.js +20 -0
  17. package/src/parsing/common/extras/index.d.ts +3 -0
  18. package/src/parsing/common/extras/index.js +9 -0
  19. package/src/parsing/common/index.d.ts +2 -0
  20. package/src/parsing/common/index.js +28 -1
  21. package/src/parsing/common/page.d.ts +1 -0
  22. package/src/parsing/common/page.js +30 -7
  23. package/src/parsing/common/summaryHelper.d.ts +10 -0
  24. package/src/parsing/common/summaryHelper.js +27 -1
  25. package/src/parsing/generated/generatedObject.d.ts +3 -3
  26. package/src/parsing/generated/generatedObject.js +14 -5
  27. package/src/parsing/standard/amount.d.ts +0 -1
  28. package/src/parsing/standard/amount.js +4 -11
  29. package/src/parsing/standard/index.d.ts +1 -1
  30. package/src/parsing/standard/index.js +1 -2
  31. package/src/parsing/standard/tax.js +4 -4
  32. package/src/pdf/pdfOperation.d.ts +1 -1
  33. package/src/pdf/pdfOperation.js +12 -7
  34. package/src/product/billOfLading/billOfLadingV1.d.ts +16 -0
  35. package/src/product/billOfLading/billOfLadingV1.js +27 -0
  36. package/src/product/billOfLading/billOfLadingV1Carrier.d.ts +32 -0
  37. package/src/product/billOfLading/billOfLadingV1Carrier.js +62 -0
  38. package/src/product/billOfLading/billOfLadingV1CarrierItem.d.ts +38 -0
  39. package/src/product/billOfLading/billOfLadingV1CarrierItem.js +117 -0
  40. package/src/product/billOfLading/billOfLadingV1Consignee.d.ts +34 -0
  41. package/src/product/billOfLading/billOfLadingV1Consignee.js +67 -0
  42. package/src/product/billOfLading/billOfLadingV1Document.d.ts +39 -0
  43. package/src/product/billOfLading/billOfLadingV1Document.js +95 -0
  44. package/src/product/billOfLading/billOfLadingV1NotifyParty.d.ts +34 -0
  45. package/src/product/billOfLading/billOfLadingV1NotifyParty.js +67 -0
  46. package/src/product/billOfLading/billOfLadingV1Shipper.d.ts +34 -0
  47. package/src/product/billOfLading/billOfLadingV1Shipper.js +67 -0
  48. package/src/product/billOfLading/index.d.ts +1 -0
  49. package/src/product/billOfLading/index.js +5 -0
  50. package/src/product/billOfLading/internal.d.ts +7 -0
  51. package/src/product/billOfLading/internal.js +17 -0
  52. package/src/product/financialDocument/financialDocumentV1LineItem.d.ts +8 -8
  53. package/src/product/financialDocument/financialDocumentV1LineItem.js +47 -22
  54. package/src/product/fr/bankAccountDetails/bankAccountDetailsV2Bban.d.ts +4 -4
  55. package/src/product/fr/energyBill/energyBillV1.d.ts +16 -0
  56. package/src/product/fr/energyBill/energyBillV1.js +27 -0
  57. package/src/product/fr/energyBill/energyBillV1Document.d.ts +49 -0
  58. package/src/product/fr/energyBill/energyBillV1Document.js +143 -0
  59. package/src/product/fr/energyBill/energyBillV1EnergyConsumer.d.ts +30 -0
  60. package/src/product/fr/energyBill/energyBillV1EnergyConsumer.js +57 -0
  61. package/src/product/fr/energyBill/energyBillV1EnergySupplier.d.ts +30 -0
  62. package/src/product/fr/energyBill/energyBillV1EnergySupplier.js +57 -0
  63. package/src/product/fr/energyBill/energyBillV1EnergyUsage.d.ts +38 -0
  64. package/src/product/fr/energyBill/energyBillV1EnergyUsage.js +117 -0
  65. package/src/product/fr/energyBill/energyBillV1MeterDetail.d.ts +32 -0
  66. package/src/product/fr/energyBill/energyBillV1MeterDetail.js +62 -0
  67. package/src/product/fr/energyBill/energyBillV1Subscription.d.ts +38 -0
  68. package/src/product/fr/energyBill/energyBillV1Subscription.js +117 -0
  69. package/src/product/fr/energyBill/energyBillV1TaxesAndContribution.d.ts +38 -0
  70. package/src/product/fr/energyBill/energyBillV1TaxesAndContribution.js +117 -0
  71. package/src/product/fr/energyBill/index.d.ts +1 -0
  72. package/src/product/fr/energyBill/index.js +5 -0
  73. package/src/product/fr/energyBill/internal.d.ts +8 -0
  74. package/src/product/fr/energyBill/internal.js +19 -0
  75. package/src/product/fr/index.d.ts +2 -0
  76. package/src/product/fr/index.js +5 -1
  77. package/src/product/fr/internal.d.ts +2 -0
  78. package/src/product/fr/internal.js +3 -1
  79. package/src/product/fr/payslip/index.d.ts +1 -0
  80. package/src/product/fr/payslip/index.js +5 -0
  81. package/src/product/fr/payslip/internal.d.ts +10 -0
  82. package/src/product/fr/payslip/internal.js +23 -0
  83. package/src/product/fr/payslip/payslipV2.d.ts +16 -0
  84. package/src/product/fr/payslip/payslipV2.js +27 -0
  85. package/src/product/fr/payslip/payslipV2BankAccountDetail.d.ts +32 -0
  86. package/src/product/fr/payslip/payslipV2BankAccountDetail.js +62 -0
  87. package/src/product/fr/payslip/payslipV2Document.d.ts +35 -0
  88. package/src/product/fr/payslip/payslipV2Document.js +80 -0
  89. package/src/product/fr/payslip/payslipV2Employee.d.ts +40 -0
  90. package/src/product/fr/payslip/payslipV2Employee.js +82 -0
  91. package/src/product/fr/payslip/payslipV2Employer.d.ts +40 -0
  92. package/src/product/fr/payslip/payslipV2Employer.js +82 -0
  93. package/src/product/fr/payslip/payslipV2Employment.d.ts +38 -0
  94. package/src/product/fr/payslip/payslipV2Employment.js +85 -0
  95. package/src/product/fr/payslip/payslipV2PayDetail.d.ts +46 -0
  96. package/src/product/fr/payslip/payslipV2PayDetail.js +168 -0
  97. package/src/product/fr/payslip/payslipV2PayPeriod.d.ts +36 -0
  98. package/src/product/fr/payslip/payslipV2PayPeriod.js +72 -0
  99. package/src/product/fr/payslip/payslipV2Pto.d.ts +32 -0
  100. package/src/product/fr/payslip/payslipV2Pto.js +84 -0
  101. package/src/product/fr/payslip/payslipV2SalaryDetail.d.ts +34 -0
  102. package/src/product/fr/payslip/payslipV2SalaryDetail.js +97 -0
  103. package/src/product/generated/generatedV1.js +2 -1
  104. package/src/product/index.d.ts +2 -0
  105. package/src/product/index.js +5 -1
  106. package/src/product/internal.d.ts +2 -0
  107. package/src/product/internal.js +3 -1
  108. package/src/product/invoice/invoiceV4LineItem.d.ts +8 -8
  109. package/src/product/invoice/invoiceV4LineItem.js +47 -22
  110. package/src/product/nutritionFactsLabel/index.d.ts +1 -0
  111. package/src/product/nutritionFactsLabel/index.js +5 -0
  112. package/src/product/nutritionFactsLabel/internal.d.ts +15 -0
  113. package/src/product/nutritionFactsLabel/internal.js +33 -0
  114. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1.d.ts +16 -0
  115. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1.js +27 -0
  116. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1AddedSugar.d.ts +32 -0
  117. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1AddedSugar.js +84 -0
  118. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Calorie.d.ts +32 -0
  119. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Calorie.js +84 -0
  120. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Cholesterol.d.ts +32 -0
  121. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Cholesterol.js +84 -0
  122. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1DietaryFiber.d.ts +32 -0
  123. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1DietaryFiber.js +84 -0
  124. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Document.d.ts +53 -0
  125. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Document.js +117 -0
  126. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Nutrient.d.ts +36 -0
  127. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Nutrient.js +107 -0
  128. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Protein.d.ts +32 -0
  129. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Protein.js +84 -0
  130. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1SaturatedFat.d.ts +32 -0
  131. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1SaturatedFat.js +84 -0
  132. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1ServingSize.d.ts +30 -0
  133. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1ServingSize.js +65 -0
  134. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Sodium.d.ts +34 -0
  135. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1Sodium.js +89 -0
  136. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalCarbohydrate.d.ts +32 -0
  137. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalCarbohydrate.js +84 -0
  138. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalFat.d.ts +32 -0
  139. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalFat.js +84 -0
  140. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalSugar.d.ts +32 -0
  141. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TotalSugar.js +84 -0
  142. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TransFat.d.ts +32 -0
  143. package/src/product/nutritionFactsLabel/nutritionFactsLabelV1TransFat.js +84 -0
  144. package/src/product/receipt/receiptV5LineItem.d.ts +4 -4
  145. package/src/product/receipt/receiptV5LineItem.js +27 -12
  146. package/src/product/resume/resumeV1Certificate.d.ts +4 -4
  147. package/src/product/resume/resumeV1Certificate.js +9 -8
  148. package/src/product/resume/resumeV1Education.d.ts +7 -7
  149. package/src/product/resume/resumeV1Education.js +15 -14
  150. package/src/product/resume/resumeV1Language.d.ts +2 -2
  151. package/src/product/resume/resumeV1Language.js +5 -4
  152. package/src/product/resume/resumeV1ProfessionalExperience.d.ts +8 -8
  153. package/src/product/resume/resumeV1ProfessionalExperience.js +17 -16
  154. package/src/product/resume/resumeV1SocialNetworksUrl.d.ts +2 -2
  155. package/src/product/resume/resumeV1SocialNetworksUrl.js +5 -4
  156. package/src/product/us/healthcareCard/healthcareCardV1Copay.d.ts +2 -2
  157. package/src/product/us/healthcareCard/healthcareCardV1Copay.js +11 -6
  158. package/src/product/us/usMail/index.d.ts +1 -0
  159. package/src/product/us/usMail/index.js +5 -0
  160. package/src/product/us/usMail/usMailV2RecipientAddress.d.ts +7 -7
  161. package/src/product/us/usMail/usMailV2RecipientAddress.js +17 -15
  162. package/src/product/us/usMail/usMailV2SenderAddress.d.ts +5 -5
  163. package/src/product/us/usMail/usMailV2SenderAddress.js +5 -25
@@ -0,0 +1,16 @@
1
+ import { Inference, StringDict, Page } from "../../parsing/common";
2
+ import { NutritionFactsLabelV1Document } from "./nutritionFactsLabelV1Document";
3
+ /**
4
+ * Nutrition Facts Label API version 1 inference prediction.
5
+ */
6
+ export declare class NutritionFactsLabelV1 extends Inference {
7
+ /** The endpoint's name. */
8
+ endpointName: string;
9
+ /** The endpoint's version. */
10
+ endpointVersion: string;
11
+ /** The document-level prediction. */
12
+ prediction: NutritionFactsLabelV1Document;
13
+ /** The document's pages. */
14
+ pages: Page<NutritionFactsLabelV1Document>[];
15
+ constructor(rawPrediction: StringDict);
16
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NutritionFactsLabelV1 = void 0;
4
+ const common_1 = require("../../parsing/common");
5
+ const nutritionFactsLabelV1Document_1 = require("./nutritionFactsLabelV1Document");
6
+ /**
7
+ * Nutrition Facts Label API version 1 inference prediction.
8
+ */
9
+ class NutritionFactsLabelV1 extends common_1.Inference {
10
+ constructor(rawPrediction) {
11
+ super(rawPrediction);
12
+ /** The endpoint's name. */
13
+ this.endpointName = "nutrition_facts";
14
+ /** The endpoint's version. */
15
+ this.endpointVersion = "1";
16
+ /** The document's pages. */
17
+ this.pages = [];
18
+ this.prediction = new nutritionFactsLabelV1Document_1.NutritionFactsLabelV1Document(rawPrediction["prediction"]);
19
+ rawPrediction["pages"].forEach((page) => {
20
+ if (page.prediction !== undefined && page.prediction !== null &&
21
+ Object.keys(page.prediction).length > 0) {
22
+ this.pages.push(new common_1.Page(nutritionFactsLabelV1Document_1.NutritionFactsLabelV1Document, page, page["id"], page["orientation"]));
23
+ }
24
+ });
25
+ }
26
+ }
27
+ exports.NutritionFactsLabelV1 = NutritionFactsLabelV1;
@@ -0,0 +1,32 @@
1
+ import { StringDict } from "../../parsing/common";
2
+ import { Polygon } from "../../geometry";
3
+ /**
4
+ * The amount of added sugars in the product.
5
+ */
6
+ export declare class NutritionFactsLabelV1AddedSugar {
7
+ #private;
8
+ /** DVs are the recommended amounts of added sugars to consume or not to exceed each day. */
9
+ dailyValue: number | null;
10
+ /** The amount of added sugars per 100g of the product. */
11
+ per100G: number | null;
12
+ /** The amount of added sugars per serving of the product. */
13
+ perServing: number | null;
14
+ /** Confidence score */
15
+ confidence: number;
16
+ /** The document page on which the information was found. */
17
+ pageId: number;
18
+ /**
19
+ * Contains the relative vertices coordinates (points) of a polygon containing
20
+ * the field in the document.
21
+ */
22
+ polygon: Polygon;
23
+ constructor({ prediction }: StringDict);
24
+ /**
25
+ * Default string representation.
26
+ */
27
+ toString(): string;
28
+ /**
29
+ * Output in a format suitable for inclusion in a field list.
30
+ */
31
+ toFieldList(): string;
32
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _NutritionFactsLabelV1AddedSugar_instances, _NutritionFactsLabelV1AddedSugar_printableValues;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.NutritionFactsLabelV1AddedSugar = void 0;
10
+ const common_1 = require("../../parsing/common");
11
+ /**
12
+ * The amount of added sugars in the product.
13
+ */
14
+ class NutritionFactsLabelV1AddedSugar {
15
+ constructor({ prediction = {} }) {
16
+ _NutritionFactsLabelV1AddedSugar_instances.add(this);
17
+ /** Confidence score */
18
+ this.confidence = 0.0;
19
+ /**
20
+ * Contains the relative vertices coordinates (points) of a polygon containing
21
+ * the field in the document.
22
+ */
23
+ this.polygon = [];
24
+ if (prediction["daily_value"] !== undefined &&
25
+ prediction["daily_value"] !== null &&
26
+ !isNaN(prediction["daily_value"])) {
27
+ this.dailyValue = +parseFloat(prediction["daily_value"]);
28
+ }
29
+ else {
30
+ this.dailyValue = null;
31
+ }
32
+ if (prediction["per_100g"] !== undefined &&
33
+ prediction["per_100g"] !== null &&
34
+ !isNaN(prediction["per_100g"])) {
35
+ this.per100G = +parseFloat(prediction["per_100g"]);
36
+ }
37
+ else {
38
+ this.per100G = null;
39
+ }
40
+ if (prediction["per_serving"] !== undefined &&
41
+ prediction["per_serving"] !== null &&
42
+ !isNaN(prediction["per_serving"])) {
43
+ this.perServing = +parseFloat(prediction["per_serving"]);
44
+ }
45
+ else {
46
+ this.perServing = null;
47
+ }
48
+ this.pageId = prediction["page_id"];
49
+ this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
50
+ if (prediction["polygon"]) {
51
+ this.polygon = prediction.polygon;
52
+ }
53
+ }
54
+ /**
55
+ * Default string representation.
56
+ */
57
+ toString() {
58
+ const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1AddedSugar_instances, "m", _NutritionFactsLabelV1AddedSugar_printableValues).call(this);
59
+ return ("Daily Value: " +
60
+ printable.dailyValue +
61
+ ", Per 100g: " +
62
+ printable.per100G +
63
+ ", Per Serving: " +
64
+ printable.perServing);
65
+ }
66
+ /**
67
+ * Output in a format suitable for inclusion in a field list.
68
+ */
69
+ toFieldList() {
70
+ const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1AddedSugar_instances, "m", _NutritionFactsLabelV1AddedSugar_printableValues).call(this);
71
+ return `
72
+ :Daily Value: ${printable.dailyValue}
73
+ :Per 100g: ${printable.per100G}
74
+ :Per Serving: ${printable.perServing}`.trimEnd();
75
+ }
76
+ }
77
+ exports.NutritionFactsLabelV1AddedSugar = NutritionFactsLabelV1AddedSugar;
78
+ _NutritionFactsLabelV1AddedSugar_instances = new WeakSet(), _NutritionFactsLabelV1AddedSugar_printableValues = function _NutritionFactsLabelV1AddedSugar_printableValues() {
79
+ return {
80
+ dailyValue: this.dailyValue !== undefined ? (0, common_1.floatToString)(this.dailyValue) : "",
81
+ per100G: this.per100G !== undefined ? (0, common_1.floatToString)(this.per100G) : "",
82
+ perServing: this.perServing !== undefined ? (0, common_1.floatToString)(this.perServing) : "",
83
+ };
84
+ };
@@ -0,0 +1,32 @@
1
+ import { StringDict } from "../../parsing/common";
2
+ import { Polygon } from "../../geometry";
3
+ /**
4
+ * The amount of calories in the product.
5
+ */
6
+ export declare class NutritionFactsLabelV1Calorie {
7
+ #private;
8
+ /** DVs are the recommended amounts of calories to consume or not to exceed each day. */
9
+ dailyValue: number | null;
10
+ /** The amount of calories per 100g of the product. */
11
+ per100G: number | null;
12
+ /** The amount of calories per serving of the product. */
13
+ perServing: number | null;
14
+ /** Confidence score */
15
+ confidence: number;
16
+ /** The document page on which the information was found. */
17
+ pageId: number;
18
+ /**
19
+ * Contains the relative vertices coordinates (points) of a polygon containing
20
+ * the field in the document.
21
+ */
22
+ polygon: Polygon;
23
+ constructor({ prediction }: StringDict);
24
+ /**
25
+ * Default string representation.
26
+ */
27
+ toString(): string;
28
+ /**
29
+ * Output in a format suitable for inclusion in a field list.
30
+ */
31
+ toFieldList(): string;
32
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _NutritionFactsLabelV1Calorie_instances, _NutritionFactsLabelV1Calorie_printableValues;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.NutritionFactsLabelV1Calorie = void 0;
10
+ const common_1 = require("../../parsing/common");
11
+ /**
12
+ * The amount of calories in the product.
13
+ */
14
+ class NutritionFactsLabelV1Calorie {
15
+ constructor({ prediction = {} }) {
16
+ _NutritionFactsLabelV1Calorie_instances.add(this);
17
+ /** Confidence score */
18
+ this.confidence = 0.0;
19
+ /**
20
+ * Contains the relative vertices coordinates (points) of a polygon containing
21
+ * the field in the document.
22
+ */
23
+ this.polygon = [];
24
+ if (prediction["daily_value"] !== undefined &&
25
+ prediction["daily_value"] !== null &&
26
+ !isNaN(prediction["daily_value"])) {
27
+ this.dailyValue = +parseFloat(prediction["daily_value"]);
28
+ }
29
+ else {
30
+ this.dailyValue = null;
31
+ }
32
+ if (prediction["per_100g"] !== undefined &&
33
+ prediction["per_100g"] !== null &&
34
+ !isNaN(prediction["per_100g"])) {
35
+ this.per100G = +parseFloat(prediction["per_100g"]);
36
+ }
37
+ else {
38
+ this.per100G = null;
39
+ }
40
+ if (prediction["per_serving"] !== undefined &&
41
+ prediction["per_serving"] !== null &&
42
+ !isNaN(prediction["per_serving"])) {
43
+ this.perServing = +parseFloat(prediction["per_serving"]);
44
+ }
45
+ else {
46
+ this.perServing = null;
47
+ }
48
+ this.pageId = prediction["page_id"];
49
+ this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
50
+ if (prediction["polygon"]) {
51
+ this.polygon = prediction.polygon;
52
+ }
53
+ }
54
+ /**
55
+ * Default string representation.
56
+ */
57
+ toString() {
58
+ const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1Calorie_instances, "m", _NutritionFactsLabelV1Calorie_printableValues).call(this);
59
+ return ("Daily Value: " +
60
+ printable.dailyValue +
61
+ ", Per 100g: " +
62
+ printable.per100G +
63
+ ", Per Serving: " +
64
+ printable.perServing);
65
+ }
66
+ /**
67
+ * Output in a format suitable for inclusion in a field list.
68
+ */
69
+ toFieldList() {
70
+ const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1Calorie_instances, "m", _NutritionFactsLabelV1Calorie_printableValues).call(this);
71
+ return `
72
+ :Daily Value: ${printable.dailyValue}
73
+ :Per 100g: ${printable.per100G}
74
+ :Per Serving: ${printable.perServing}`.trimEnd();
75
+ }
76
+ }
77
+ exports.NutritionFactsLabelV1Calorie = NutritionFactsLabelV1Calorie;
78
+ _NutritionFactsLabelV1Calorie_instances = new WeakSet(), _NutritionFactsLabelV1Calorie_printableValues = function _NutritionFactsLabelV1Calorie_printableValues() {
79
+ return {
80
+ dailyValue: this.dailyValue !== undefined ? (0, common_1.floatToString)(this.dailyValue) : "",
81
+ per100G: this.per100G !== undefined ? (0, common_1.floatToString)(this.per100G) : "",
82
+ perServing: this.perServing !== undefined ? (0, common_1.floatToString)(this.perServing) : "",
83
+ };
84
+ };
@@ -0,0 +1,32 @@
1
+ import { StringDict } from "../../parsing/common";
2
+ import { Polygon } from "../../geometry";
3
+ /**
4
+ * The amount of cholesterol in the product.
5
+ */
6
+ export declare class NutritionFactsLabelV1Cholesterol {
7
+ #private;
8
+ /** DVs are the recommended amounts of cholesterol to consume or not to exceed each day. */
9
+ dailyValue: number | null;
10
+ /** The amount of cholesterol per 100g of the product. */
11
+ per100G: number | null;
12
+ /** The amount of cholesterol per serving of the product. */
13
+ perServing: number | null;
14
+ /** Confidence score */
15
+ confidence: number;
16
+ /** The document page on which the information was found. */
17
+ pageId: number;
18
+ /**
19
+ * Contains the relative vertices coordinates (points) of a polygon containing
20
+ * the field in the document.
21
+ */
22
+ polygon: Polygon;
23
+ constructor({ prediction }: StringDict);
24
+ /**
25
+ * Default string representation.
26
+ */
27
+ toString(): string;
28
+ /**
29
+ * Output in a format suitable for inclusion in a field list.
30
+ */
31
+ toFieldList(): string;
32
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _NutritionFactsLabelV1Cholesterol_instances, _NutritionFactsLabelV1Cholesterol_printableValues;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.NutritionFactsLabelV1Cholesterol = void 0;
10
+ const common_1 = require("../../parsing/common");
11
+ /**
12
+ * The amount of cholesterol in the product.
13
+ */
14
+ class NutritionFactsLabelV1Cholesterol {
15
+ constructor({ prediction = {} }) {
16
+ _NutritionFactsLabelV1Cholesterol_instances.add(this);
17
+ /** Confidence score */
18
+ this.confidence = 0.0;
19
+ /**
20
+ * Contains the relative vertices coordinates (points) of a polygon containing
21
+ * the field in the document.
22
+ */
23
+ this.polygon = [];
24
+ if (prediction["daily_value"] !== undefined &&
25
+ prediction["daily_value"] !== null &&
26
+ !isNaN(prediction["daily_value"])) {
27
+ this.dailyValue = +parseFloat(prediction["daily_value"]);
28
+ }
29
+ else {
30
+ this.dailyValue = null;
31
+ }
32
+ if (prediction["per_100g"] !== undefined &&
33
+ prediction["per_100g"] !== null &&
34
+ !isNaN(prediction["per_100g"])) {
35
+ this.per100G = +parseFloat(prediction["per_100g"]);
36
+ }
37
+ else {
38
+ this.per100G = null;
39
+ }
40
+ if (prediction["per_serving"] !== undefined &&
41
+ prediction["per_serving"] !== null &&
42
+ !isNaN(prediction["per_serving"])) {
43
+ this.perServing = +parseFloat(prediction["per_serving"]);
44
+ }
45
+ else {
46
+ this.perServing = null;
47
+ }
48
+ this.pageId = prediction["page_id"];
49
+ this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
50
+ if (prediction["polygon"]) {
51
+ this.polygon = prediction.polygon;
52
+ }
53
+ }
54
+ /**
55
+ * Default string representation.
56
+ */
57
+ toString() {
58
+ const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1Cholesterol_instances, "m", _NutritionFactsLabelV1Cholesterol_printableValues).call(this);
59
+ return ("Daily Value: " +
60
+ printable.dailyValue +
61
+ ", Per 100g: " +
62
+ printable.per100G +
63
+ ", Per Serving: " +
64
+ printable.perServing);
65
+ }
66
+ /**
67
+ * Output in a format suitable for inclusion in a field list.
68
+ */
69
+ toFieldList() {
70
+ const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1Cholesterol_instances, "m", _NutritionFactsLabelV1Cholesterol_printableValues).call(this);
71
+ return `
72
+ :Daily Value: ${printable.dailyValue}
73
+ :Per 100g: ${printable.per100G}
74
+ :Per Serving: ${printable.perServing}`.trimEnd();
75
+ }
76
+ }
77
+ exports.NutritionFactsLabelV1Cholesterol = NutritionFactsLabelV1Cholesterol;
78
+ _NutritionFactsLabelV1Cholesterol_instances = new WeakSet(), _NutritionFactsLabelV1Cholesterol_printableValues = function _NutritionFactsLabelV1Cholesterol_printableValues() {
79
+ return {
80
+ dailyValue: this.dailyValue !== undefined ? (0, common_1.floatToString)(this.dailyValue) : "",
81
+ per100G: this.per100G !== undefined ? (0, common_1.floatToString)(this.per100G) : "",
82
+ perServing: this.perServing !== undefined ? (0, common_1.floatToString)(this.perServing) : "",
83
+ };
84
+ };
@@ -0,0 +1,32 @@
1
+ import { StringDict } from "../../parsing/common";
2
+ import { Polygon } from "../../geometry";
3
+ /**
4
+ * The amount of dietary fiber in the product.
5
+ */
6
+ export declare class NutritionFactsLabelV1DietaryFiber {
7
+ #private;
8
+ /** DVs are the recommended amounts of dietary fiber to consume or not to exceed each day. */
9
+ dailyValue: number | null;
10
+ /** The amount of dietary fiber per 100g of the product. */
11
+ per100G: number | null;
12
+ /** The amount of dietary fiber per serving of the product. */
13
+ perServing: number | null;
14
+ /** Confidence score */
15
+ confidence: number;
16
+ /** The document page on which the information was found. */
17
+ pageId: number;
18
+ /**
19
+ * Contains the relative vertices coordinates (points) of a polygon containing
20
+ * the field in the document.
21
+ */
22
+ polygon: Polygon;
23
+ constructor({ prediction }: StringDict);
24
+ /**
25
+ * Default string representation.
26
+ */
27
+ toString(): string;
28
+ /**
29
+ * Output in a format suitable for inclusion in a field list.
30
+ */
31
+ toFieldList(): string;
32
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _NutritionFactsLabelV1DietaryFiber_instances, _NutritionFactsLabelV1DietaryFiber_printableValues;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.NutritionFactsLabelV1DietaryFiber = void 0;
10
+ const common_1 = require("../../parsing/common");
11
+ /**
12
+ * The amount of dietary fiber in the product.
13
+ */
14
+ class NutritionFactsLabelV1DietaryFiber {
15
+ constructor({ prediction = {} }) {
16
+ _NutritionFactsLabelV1DietaryFiber_instances.add(this);
17
+ /** Confidence score */
18
+ this.confidence = 0.0;
19
+ /**
20
+ * Contains the relative vertices coordinates (points) of a polygon containing
21
+ * the field in the document.
22
+ */
23
+ this.polygon = [];
24
+ if (prediction["daily_value"] !== undefined &&
25
+ prediction["daily_value"] !== null &&
26
+ !isNaN(prediction["daily_value"])) {
27
+ this.dailyValue = +parseFloat(prediction["daily_value"]);
28
+ }
29
+ else {
30
+ this.dailyValue = null;
31
+ }
32
+ if (prediction["per_100g"] !== undefined &&
33
+ prediction["per_100g"] !== null &&
34
+ !isNaN(prediction["per_100g"])) {
35
+ this.per100G = +parseFloat(prediction["per_100g"]);
36
+ }
37
+ else {
38
+ this.per100G = null;
39
+ }
40
+ if (prediction["per_serving"] !== undefined &&
41
+ prediction["per_serving"] !== null &&
42
+ !isNaN(prediction["per_serving"])) {
43
+ this.perServing = +parseFloat(prediction["per_serving"]);
44
+ }
45
+ else {
46
+ this.perServing = null;
47
+ }
48
+ this.pageId = prediction["page_id"];
49
+ this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
50
+ if (prediction["polygon"]) {
51
+ this.polygon = prediction.polygon;
52
+ }
53
+ }
54
+ /**
55
+ * Default string representation.
56
+ */
57
+ toString() {
58
+ const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1DietaryFiber_instances, "m", _NutritionFactsLabelV1DietaryFiber_printableValues).call(this);
59
+ return ("Daily Value: " +
60
+ printable.dailyValue +
61
+ ", Per 100g: " +
62
+ printable.per100G +
63
+ ", Per Serving: " +
64
+ printable.perServing);
65
+ }
66
+ /**
67
+ * Output in a format suitable for inclusion in a field list.
68
+ */
69
+ toFieldList() {
70
+ const printable = __classPrivateFieldGet(this, _NutritionFactsLabelV1DietaryFiber_instances, "m", _NutritionFactsLabelV1DietaryFiber_printableValues).call(this);
71
+ return `
72
+ :Daily Value: ${printable.dailyValue}
73
+ :Per 100g: ${printable.per100G}
74
+ :Per Serving: ${printable.perServing}`.trimEnd();
75
+ }
76
+ }
77
+ exports.NutritionFactsLabelV1DietaryFiber = NutritionFactsLabelV1DietaryFiber;
78
+ _NutritionFactsLabelV1DietaryFiber_instances = new WeakSet(), _NutritionFactsLabelV1DietaryFiber_printableValues = function _NutritionFactsLabelV1DietaryFiber_printableValues() {
79
+ return {
80
+ dailyValue: this.dailyValue !== undefined ? (0, common_1.floatToString)(this.dailyValue) : "",
81
+ per100G: this.per100G !== undefined ? (0, common_1.floatToString)(this.per100G) : "",
82
+ perServing: this.perServing !== undefined ? (0, common_1.floatToString)(this.perServing) : "",
83
+ };
84
+ };
@@ -0,0 +1,53 @@
1
+ import { Prediction, StringDict } from "../../parsing/common";
2
+ import { NutritionFactsLabelV1ServingSize } from "./nutritionFactsLabelV1ServingSize";
3
+ import { NutritionFactsLabelV1Calorie } from "./nutritionFactsLabelV1Calorie";
4
+ import { NutritionFactsLabelV1TotalFat } from "./nutritionFactsLabelV1TotalFat";
5
+ import { NutritionFactsLabelV1SaturatedFat } from "./nutritionFactsLabelV1SaturatedFat";
6
+ import { NutritionFactsLabelV1TransFat } from "./nutritionFactsLabelV1TransFat";
7
+ import { NutritionFactsLabelV1Cholesterol } from "./nutritionFactsLabelV1Cholesterol";
8
+ import { NutritionFactsLabelV1TotalCarbohydrate } from "./nutritionFactsLabelV1TotalCarbohydrate";
9
+ import { NutritionFactsLabelV1DietaryFiber } from "./nutritionFactsLabelV1DietaryFiber";
10
+ import { NutritionFactsLabelV1TotalSugar } from "./nutritionFactsLabelV1TotalSugar";
11
+ import { NutritionFactsLabelV1AddedSugar } from "./nutritionFactsLabelV1AddedSugar";
12
+ import { NutritionFactsLabelV1Protein } from "./nutritionFactsLabelV1Protein";
13
+ import { NutritionFactsLabelV1Sodium } from "./nutritionFactsLabelV1Sodium";
14
+ import { NutritionFactsLabelV1Nutrient } from "./nutritionFactsLabelV1Nutrient";
15
+ import { AmountField } from "../../parsing/standard";
16
+ /**
17
+ * Nutrition Facts Label API version 1.0 document data.
18
+ */
19
+ export declare class NutritionFactsLabelV1Document implements Prediction {
20
+ /** The amount of added sugars in the product. */
21
+ addedSugars: NutritionFactsLabelV1AddedSugar;
22
+ /** The amount of calories in the product. */
23
+ calories: NutritionFactsLabelV1Calorie;
24
+ /** The amount of cholesterol in the product. */
25
+ cholesterol: NutritionFactsLabelV1Cholesterol;
26
+ /** The amount of dietary fiber in the product. */
27
+ dietaryFiber: NutritionFactsLabelV1DietaryFiber;
28
+ /** The amount of nutrients in the product. */
29
+ nutrients: NutritionFactsLabelV1Nutrient[];
30
+ /** The amount of protein in the product. */
31
+ protein: NutritionFactsLabelV1Protein;
32
+ /** The amount of saturated fat in the product. */
33
+ saturatedFat: NutritionFactsLabelV1SaturatedFat;
34
+ /** The number of servings in each box of the product. */
35
+ servingPerBox: AmountField;
36
+ /** The size of a single serving of the product. */
37
+ servingSize: NutritionFactsLabelV1ServingSize;
38
+ /** The amount of sodium in the product. */
39
+ sodium: NutritionFactsLabelV1Sodium;
40
+ /** The total amount of carbohydrates in the product. */
41
+ totalCarbohydrate: NutritionFactsLabelV1TotalCarbohydrate;
42
+ /** The total amount of fat in the product. */
43
+ totalFat: NutritionFactsLabelV1TotalFat;
44
+ /** The total amount of sugars in the product. */
45
+ totalSugars: NutritionFactsLabelV1TotalSugar;
46
+ /** The amount of trans fat in the product. */
47
+ transFat: NutritionFactsLabelV1TransFat;
48
+ constructor(rawPrediction: StringDict, pageId?: number);
49
+ /**
50
+ * Default string representation.
51
+ */
52
+ toString(): string;
53
+ }