mindee 3.7.1 → 3.7.3

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,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v3.7.3 - 2023-04-11
4
+ ### Changes
5
+ * :arrow_up: upgrade to TypeScript 5.0.3
6
+ * :safety_vest: ban-ts-comment should be an error
7
+ * :white_check_mark: Add docs with code samples and use them for testing
8
+
9
+
10
+ ## v3.7.2 - 2023-04-04
11
+ ### Fixes
12
+ * :bug: export DocumentClient class for easier 3rd party integration
13
+ * :bug: only display the job info when CLI parse-queued is processing
14
+
15
+
3
16
  ## v3.7.1 - 2023-03-31
4
17
  ### Fixes
5
18
  * :bug: make sure all documents are exported properly
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.1",
3
+ "version": "3.7.3",
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
@@ -235,7 +235,7 @@ async function callParseQueued(command, queueId, options) {
235
235
  printResponse(response.document, options);
236
236
  }
237
237
  else {
238
- console.log(response);
238
+ console.log(response.job);
239
239
  }
240
240
  }
241
241
  function printResponse(response, options) {
package/src/client.d.ts CHANGED
@@ -40,7 +40,7 @@ export interface PredictOptions {
40
40
  */
41
41
  pageOptions?: PageOptions;
42
42
  }
43
- declare class DocumentClient {
43
+ export declare class DocumentClient {
44
44
  docConfigs: DocConfigs;
45
45
  inputSource?: InputSource;
46
46
  constructor(docConfigs: DocConfigs, inputSource?: InputSource);
package/src/client.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Client = void 0;
3
+ exports.Client = exports.DocumentClient = void 0;
4
4
  const inputs_1 = require("./inputs");
5
5
  const api_1 = require("./api");
6
6
  const documents_1 = require("./documents");
@@ -96,6 +96,7 @@ class DocumentClient {
96
96
  return docConfig;
97
97
  }
98
98
  }
99
+ exports.DocumentClient = DocumentClient;
99
100
  /**
100
101
  * Mindee Client
101
102
  */
@@ -127,7 +128,7 @@ class Client {
127
128
  new api_1.StandardEndpoint("invoices", "4", this.apiKey),
128
129
  ]));
129
130
  this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.InvoiceSplitterV1.name], new documentConfig_1.DocumentConfig(documents_1.InvoiceSplitterV1, [
130
- new api_1.StandardEndpoint("invoice_splitter_async_beta", "1", this.apiKey),
131
+ new api_1.StandardEndpoint("invoice_splitter", "1", this.apiKey),
131
132
  ]));
132
133
  this.docConfigs.set([api_1.STANDARD_API_OWNER, documents_1.ReceiptV3.name], new documentConfig_1.DocumentConfig(documents_1.ReceiptV3, [
133
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";
2
- export { Client, ClientOptions, CustomConfigParams, PredictOptions, } from "./client";
1
+ export { CustomV1, Document, FinancialDocumentV0, FinancialDocumentV1, InvoiceV3, InvoiceV4, InvoiceSplitterV1, PassportV1, ReceiptV3, ReceiptV4, CropperV1, ShippingContainerV1, MindeeVisionV1, ProofOfAddressV1, fr, us, eu, } from "./documents";
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.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,11 +15,13 @@ 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; } });
21
22
  var client_1 = require("./client");
22
23
  Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
24
+ Object.defineProperty(exports, "DocumentClient", { enumerable: true, get: function () { return client_1.DocumentClient; } });
23
25
  var api_1 = require("./api");
24
26
  Object.defineProperty(exports, "Response", { enumerable: true, get: function () { return api_1.Response; } });
25
27
  Object.defineProperty(exports, "AsyncPredictResponse", { enumerable: true, get: function () { return api_1.AsyncPredictResponse; } });
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"])