mindee 3.7.2 → 3.7.4

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v3.7.4 - 2023-04-20
4
+ ### Changes
5
+ * :white_check_mark: minor improvements to tests
6
+
7
+ ### Fixes
8
+ * :bug: fix for options not being passed properly in the CLI tool
9
+
10
+
11
+ ## v3.7.3 - 2023-04-11
12
+ ### Changes
13
+ * :arrow_up: upgrade to TypeScript 5.0.3
14
+ * :safety_vest: ban-ts-comment should be an error
15
+ * :white_check_mark: Add docs with code samples and use them for testing
16
+
17
+
3
18
  ## v3.7.2 - 2023-04-04
4
19
  ### Fixes
5
20
  * :bug: export DocumentClient class for easier 3rd party integration
package/README.md CHANGED
@@ -59,14 +59,14 @@ const mindee = require("mindee");
59
59
  // Init a new client and add your document endpoint
60
60
  const mindeeClient = new mindee.Client({ apiKey: "my-api-key" })
61
61
  .addEndpoint({
62
- accountName: "john",
63
- endpointName: "wsnine",
62
+ accountName: "my-account",
63
+ endpointName: "my-endpoint",
64
64
  });
65
65
 
66
66
  // Load a file from disk and parse it
67
67
  const apiResponse = mindeeClient
68
68
  .docFromPath("/path/to/the/file.ext")
69
- .parse(mindee.CustomV1, { endpointName: "wsnine" });
69
+ .parse(mindee.CustomV1, { endpointName: "my-endpoint" });
70
70
  ```
71
71
 
72
72
  ### Handling the Return
@@ -96,7 +96,13 @@ customize the experience.
96
96
  All the juicy details are described in the
97
97
  **[Official Guide](https://developers.mindee.com/docs/nodejs-sdk)**.
98
98
 
99
+ You can also take a look at the
100
+ **[Reference Documentation](https://mindee.github.io/mindee-api-nodejs/)**.
101
+
99
102
  ## License
100
103
  Copyright © Mindee
101
104
 
102
105
  Available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
106
+
107
+ ## Questions?
108
+ [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "mindee",
3
- "version": "3.7.2",
3
+ "version": "3.7.4",
4
4
  "description": "Mindee Client Library for Node.js",
5
5
  "main": "src/index.js",
6
6
  "bin": "bin/mindee.js",
7
7
  "license": "MIT",
8
8
  "scripts": {
9
9
  "build": "tsc --build",
10
- "build-for-publish": "tsc --build && cp LICENSE README.md CHANGELOG.md ./dist",
11
- "clean": "rm -rf ./dist",
10
+ "build-for-dist": "tsc --build && cp LICENSE README.md CHANGELOG.md ./dist",
11
+ "clean": "rm -rf ./dist ./docs/_build",
12
12
  "test": "mocha 'tests/**/*.spec.ts'",
13
- "lint-fix": "eslint '**/*.ts' --fix",
14
- "lint": "eslint '**/*.ts' --report-unused-disable-directives && echo 'Your .ts files look good.'",
15
- "docs": "jsdoc -r dist/src -d docs"
13
+ "lint-fix": "eslint './src/**/*.ts' --fix",
14
+ "lint": "eslint './src/**/*.ts' --report-unused-disable-directives && echo 'Your .ts files look good.'",
15
+ "docs": "typedoc --out docs/_build ./src/index.ts",
16
+ "docs-for-dist": "typedoc --out docs/_build ./src/index.ts && cp -r ./docs/code_samples ./docs/_build/"
16
17
  },
17
18
  "files": [
18
19
  "src/*",
@@ -40,18 +41,18 @@
40
41
  "devDependencies": {
41
42
  "@types/chai": "^4.3.4",
42
43
  "@types/mocha": "^9.1.1",
43
- "@types/node": "^18.11.18",
44
- "@typescript-eslint/eslint-plugin": "^5.48.0",
45
- "@typescript-eslint/parser": "^5.48.0",
44
+ "@types/node": "^18.15.11",
45
+ "@typescript-eslint/eslint-plugin": "^5.57.1",
46
+ "@typescript-eslint/parser": "^5.57.1",
46
47
  "chai": "^4.3.7",
47
- "eslint": "^8.31.0",
48
+ "eslint": "^8.32.0",
48
49
  "eslint-config-prettier": "^8.6.0",
49
50
  "eslint-plugin-prettier": "^4.2.1",
50
- "jsdoc": "~4.0",
51
+ "typedoc": "~0.23",
51
52
  "mocha": "^10.1.0",
52
53
  "prettier": "^2.8.1",
53
54
  "ts-node": "^10.9.1",
54
- "typescript": "^4.9.4"
55
+ "typescript": "^5.0.3"
55
56
  },
56
57
  "dependencies": {
57
58
  "commander": "~9.4.1",
package/src/cli.js CHANGED
@@ -294,7 +294,9 @@ function addAction(prog) {
294
294
  if (prog.name() === COMMAND_CUSTOM) {
295
295
  prog.action(function (inputPath, options, command) {
296
296
  const allOptions = {
297
- ...program.opts(),
297
+ ...prog.parent?.parent?.opts(),
298
+ ...prog.parent?.opts(),
299
+ ...prog.opts(),
298
300
  ...options,
299
301
  };
300
302
  return routeSwitchboard(command, inputPath, allOptions);
@@ -303,7 +305,9 @@ function addAction(prog) {
303
305
  else {
304
306
  prog.action(function (inputPath, options, command) {
305
307
  const allOptions = {
306
- ...program.opts(),
308
+ ...prog.parent?.parent?.opts(),
309
+ ...prog.parent?.opts(),
310
+ ...prog.opts(),
307
311
  ...options,
308
312
  };
309
313
  return routeSwitchboard(command, inputPath, allOptions);
package/src/client.js CHANGED
@@ -128,7 +128,7 @@ class Client {
128
128
  new api_1.StandardEndpoint("invoices", "4", this.apiKey),
129
129
  ]));
130
130
  this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.InvoiceSplitterV1.name], new documentConfig_1.DocumentConfig(documents_1.InvoiceSplitterV1, [
131
- new api_1.StandardEndpoint("invoice_splitter_async_beta", "1", this.apiKey),
131
+ new api_1.StandardEndpoint("invoice_splitter", "1", this.apiKey),
132
132
  ]));
133
133
  this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.ReceiptV3.name], new documentConfig_1.DocumentConfig(documents_1.ReceiptV3, [
134
134
  new api_1.StandardEndpoint("expense_receipts", "3", this.apiKey),
@@ -16,7 +16,7 @@ export declare class Line {
16
16
  bbox: BBox;
17
17
  /**
18
18
  * The height tolerance used to build the line.
19
- * It helps when the higth of an expected line can vary.
19
+ * It helps when the height of an expected line can vary.
20
20
  */
21
21
  heightTolerance: number;
22
22
  constructor(rowNumber: number, heightTolerance: number);
@@ -105,9 +105,9 @@ function prepare(anchorName, fields, heigthLineTolerance) {
105
105
  }
106
106
  let currentLineNumber = 1;
107
107
  let currentLine = new Line(currentLineNumber, heigthLineTolerance);
108
- let currentValue = anchorField.values[0];
109
- currentLine.extendWith(currentValue.polygon);
110
108
  if (anchorField !== undefined) {
109
+ let currentValue = anchorField.values[0];
110
+ currentLine.extendWith(currentValue.polygon);
111
111
  for (let index = 1; index < anchorField.values.length; index++) {
112
112
  currentValue = anchorField.values[index];
113
113
  const currentFieldBbox = (0, geometry_1.getBbox)(currentValue.polygon);
package/src/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { CustomV1, Document, FinancialDocumentV0, FinancialDocumentV1, InvoiceV3, InvoiceV4, InvoiceSplitterV1, PassportV1, ReceiptV3, ReceiptV4, CropperV1, ShippingContainerV1, MindeeVisionV1, fr, us, eu, } from "./documents";
1
+ export { CustomV1, Document, FinancialDocumentV0, FinancialDocumentV1, InvoiceV3, InvoiceV4, InvoiceSplitterV1, PassportV1, ReceiptV3, ReceiptV4, CropperV1, ShippingContainerV1, MindeeVisionV1, ProofOfAddressV1, fr, us, eu, } from "./documents";
2
2
  export { Client, ClientOptions, CustomConfigParams, DocumentClient, PredictOptions, } from "./client";
3
3
  export { ResponseSig, Response, AsyncPredictResponse } from "./api";
4
4
  export { InputSource, PageOptionsOperation } from "./inputs";
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PageOptionsOperation = exports.InputSource = exports.AsyncPredictResponse = exports.Response = exports.DocumentClient = exports.Client = exports.eu = exports.us = exports.fr = exports.MindeeVisionV1 = exports.ShippingContainerV1 = exports.CropperV1 = exports.ReceiptV4 = exports.ReceiptV3 = exports.PassportV1 = exports.InvoiceSplitterV1 = exports.InvoiceV4 = exports.InvoiceV3 = exports.FinancialDocumentV1 = exports.FinancialDocumentV0 = exports.Document = exports.CustomV1 = void 0;
3
+ exports.PageOptionsOperation = exports.InputSource = exports.AsyncPredictResponse = exports.Response = exports.DocumentClient = exports.Client = exports.eu = exports.us = exports.fr = exports.ProofOfAddressV1 = exports.MindeeVisionV1 = exports.ShippingContainerV1 = exports.CropperV1 = exports.ReceiptV4 = exports.ReceiptV3 = exports.PassportV1 = exports.InvoiceSplitterV1 = exports.InvoiceV4 = exports.InvoiceV3 = exports.FinancialDocumentV1 = exports.FinancialDocumentV0 = exports.Document = exports.CustomV1 = void 0;
4
4
  var documents_1 = require("./documents");
5
5
  Object.defineProperty(exports, "CustomV1", { enumerable: true, get: function () { return documents_1.CustomV1; } });
6
6
  Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return documents_1.Document; } });
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "ReceiptV4", { enumerable: true, get: function ()
15
15
  Object.defineProperty(exports, "CropperV1", { enumerable: true, get: function () { return documents_1.CropperV1; } });
16
16
  Object.defineProperty(exports, "ShippingContainerV1", { enumerable: true, get: function () { return documents_1.ShippingContainerV1; } });
17
17
  Object.defineProperty(exports, "MindeeVisionV1", { enumerable: true, get: function () { return documents_1.MindeeVisionV1; } });
18
+ Object.defineProperty(exports, "ProofOfAddressV1", { enumerable: true, get: function () { return documents_1.ProofOfAddressV1; } });
18
19
  Object.defineProperty(exports, "fr", { enumerable: true, get: function () { return documents_1.fr; } });
19
20
  Object.defineProperty(exports, "us", { enumerable: true, get: function () { return documents_1.us; } });
20
21
  Object.defineProperty(exports, "eu", { enumerable: true, get: function () { return documents_1.eu; } });
package/src/logger.d.ts CHANGED
@@ -9,8 +9,9 @@ interface LoggerInterface {
9
9
  }
10
10
  export declare const LOG_LEVELS: LoggerLevels;
11
11
  declare class Logger implements LoggerInterface {
12
- level: string | number;
13
- constructor(level?: string | number);
12
+ levelToSet: string;
13
+ level: number;
14
+ constructor(levelToSet?: string);
14
15
  debug(...args: any[]): void;
15
16
  info(...args: any[]): void;
16
17
  warn(...args: any[]): void;
package/src/logger.js CHANGED
@@ -8,12 +8,12 @@ exports.LOG_LEVELS = {
8
8
  error: 3,
9
9
  };
10
10
  class Logger {
11
- constructor(level = "warn") {
12
- this.level = level;
13
- if (!(level in exports.LOG_LEVELS)) {
14
- this.level = "debug";
11
+ constructor(levelToSet = "warn") {
12
+ this.levelToSet = levelToSet;
13
+ if (!(levelToSet in exports.LOG_LEVELS)) {
14
+ this.level = exports.LOG_LEVELS["debug"];
15
15
  }
16
- this.level = exports.LOG_LEVELS[level];
16
+ this.level = exports.LOG_LEVELS[levelToSet];
17
17
  }
18
18
  debug(...args) {
19
19
  if (this.level <= exports.LOG_LEVELS["debug"])