mindee 5.0.2 → 5.1.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.
- package/CHANGELOG.md +12 -0
- package/package.json +11 -8
- package/src/geometry/polygon.js +2 -1
- package/src/v2/cli.js +9 -4
- package/src/v2/parsing/inference/field/fieldLocation.d.ts +5 -5
- package/src/v2/parsing/inference/field/fieldLocation.js +4 -4
- package/src/v2/parsing/job/job.d.ts +5 -1
- package/src/v2/parsing/job/job.js +9 -4
- package/src/v2/parsing/job/jobWebhook.js +1 -1
- package/src/v2/product/crop/cropItem.js +1 -1
- package/src/v2/product/crop/cropResult.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Mindee Node.js API Library Changelog
|
|
2
2
|
|
|
3
|
+
## v5.1.1 - 2026-03-11
|
|
4
|
+
### Changes
|
|
5
|
+
* :heavy_minus_sign: tslib is never imported, remove from dependencies
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## v5.1.0 - 2026-03-02
|
|
9
|
+
### Changes
|
|
10
|
+
* :sparkles: add to job information
|
|
11
|
+
### Fixes
|
|
12
|
+
* :bug: fix for printing crop results
|
|
13
|
+
* :bug: proper init of webhook payload
|
|
14
|
+
|
|
3
15
|
|
|
4
16
|
## v5.0.2 - 2026-02-27
|
|
5
17
|
### Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindee",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "Mindee Client Library for Node.js",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mindee",
|
|
@@ -48,9 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"commander": "^14.0.3",
|
|
51
|
-
"file-type": "^21.3.
|
|
52
|
-
"tmp": "^0.2.
|
|
53
|
-
"tslib": "^2.8.1",
|
|
51
|
+
"file-type": "^21.3.1",
|
|
52
|
+
"tmp": "^0.2.5",
|
|
54
53
|
"undici": ">=6.23.0 <8.0.0"
|
|
55
54
|
},
|
|
56
55
|
"optionalDependencies": {
|
|
@@ -60,15 +59,19 @@
|
|
|
60
59
|
"sharp": "~0.34.5"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
62
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
63
|
+
"@eslint/js": "^10.0.1",
|
|
63
64
|
"@types/mocha": "^10.0.10",
|
|
64
|
-
"@types/node": "^20.19.
|
|
65
|
+
"@types/node": "^20.19.37",
|
|
65
66
|
"@types/tmp": "^0.2.6",
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
67
|
-
"@typescript-eslint/parser": "^8.
|
|
68
|
-
"eslint": "^
|
|
67
|
+
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
68
|
+
"@typescript-eslint/parser": "^8.57.0",
|
|
69
|
+
"eslint": "^10.0.3",
|
|
69
70
|
"eslint-plugin-jsdoc": "^62.7.1",
|
|
71
|
+
"globals": "^17.4.0",
|
|
70
72
|
"mocha": "^11.7.5",
|
|
71
73
|
"tsc-alias": "^1.8.16",
|
|
74
|
+
"tslib": "^2.8.1",
|
|
72
75
|
"tsx": "^4.21.0",
|
|
73
76
|
"typedoc": "^0.28.17",
|
|
74
77
|
"typescript": "^5.9.3"
|
package/src/geometry/polygon.js
CHANGED
|
@@ -37,6 +37,7 @@ export class Polygon extends Array {
|
|
|
37
37
|
return isPointInY(point, yCoords.min, yCoords.max);
|
|
38
38
|
}
|
|
39
39
|
toString() {
|
|
40
|
-
|
|
40
|
+
const points = this.map((point) => `(${point})`).join(", ");
|
|
41
|
+
return `(${points})`;
|
|
41
42
|
}
|
|
42
43
|
}
|
package/src/v2/cli.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import { Client } from "./client.js";
|
|
3
|
-
import { PathInput } from "../input/index.js";
|
|
4
2
|
import * as console from "console";
|
|
3
|
+
import { Client, PathInput, UrlInput } from "../index.js";
|
|
5
4
|
import { Classification, Crop, Extraction, Ocr, Split, } from "../v2/product/index.js";
|
|
6
5
|
const program = new Command();
|
|
7
6
|
//
|
|
@@ -15,7 +14,13 @@ function initClient(options) {
|
|
|
15
14
|
}
|
|
16
15
|
async function enqueueAndGetInference(product, inputPath, options) {
|
|
17
16
|
const mindeeClient = initClient(options);
|
|
18
|
-
|
|
17
|
+
let inputSource;
|
|
18
|
+
if (inputPath.startsWith("https://")) {
|
|
19
|
+
inputSource = new UrlInput({ url: inputPath });
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
inputSource = new PathInput({ inputPath: inputPath });
|
|
23
|
+
}
|
|
19
24
|
const response = await mindeeClient.enqueueAndGetResult(product, inputSource, { modelId: options.model }, {
|
|
20
25
|
initialDelaySec: 2,
|
|
21
26
|
delaySec: 1.5,
|
|
@@ -36,7 +41,7 @@ function printResponse(document) {
|
|
|
36
41
|
//
|
|
37
42
|
function addMainOptions(prog) {
|
|
38
43
|
prog.requiredOption("-m, --model <model_id>", "Model ID (required)");
|
|
39
|
-
prog.argument("<input_path>", "full path to the file");
|
|
44
|
+
prog.argument("<input_path>", "full path or URL to the file");
|
|
40
45
|
}
|
|
41
46
|
export function cli() {
|
|
42
47
|
program.name("mindee")
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Polygon } from "../../../../geometry/index.js";
|
|
2
2
|
import { StringDict } from "../../../../parsing/stringDict.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* A field's location on the document.
|
|
5
5
|
*/
|
|
6
6
|
export declare class FieldLocation {
|
|
7
|
-
/**
|
|
8
|
-
readonly polygon: Polygon
|
|
9
|
-
/**
|
|
10
|
-
readonly page:
|
|
7
|
+
/** Position information as a list of points in clockwise order. */
|
|
8
|
+
readonly polygon: Polygon;
|
|
9
|
+
/** 0-based page index of where the polygon is located. */
|
|
10
|
+
readonly page: any;
|
|
11
11
|
constructor(serverResponse: StringDict);
|
|
12
12
|
toString(): string;
|
|
13
13
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Polygon } from "../../../../geometry/index.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* A field's location on the document.
|
|
4
4
|
*/
|
|
5
5
|
export class FieldLocation {
|
|
6
6
|
constructor(serverResponse) {
|
|
7
|
-
this.polygon =
|
|
8
|
-
this.page =
|
|
7
|
+
this.polygon = new Polygon(...serverResponse["polygon"]);
|
|
8
|
+
this.page = serverResponse["page"];
|
|
9
9
|
}
|
|
10
10
|
toString() {
|
|
11
|
-
return this.polygon
|
|
11
|
+
return `${this.polygon} on page ${this.page}`;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -14,9 +14,13 @@ export declare class Job {
|
|
|
14
14
|
*/
|
|
15
15
|
error?: ErrorResponse;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Date and time of the Job creation.
|
|
18
18
|
*/
|
|
19
19
|
createdAt: Date | null;
|
|
20
|
+
/**
|
|
21
|
+
* Date and time of the Job completion. Filled once processing is finished.
|
|
22
|
+
*/
|
|
23
|
+
completedAt: Date | null | undefined;
|
|
20
24
|
/**
|
|
21
25
|
* ID of the model.
|
|
22
26
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parseDate } from "../../../parsing/index.js";
|
|
2
2
|
import { ErrorResponse } from "../../../v2/index.js";
|
|
3
|
+
import { JobWebhook } from "./jobWebhook.js";
|
|
3
4
|
/**
|
|
4
5
|
* Job information for a V2 polling attempt.
|
|
5
6
|
*/
|
|
@@ -9,17 +10,21 @@ export class Job {
|
|
|
9
10
|
if (serverResponse["status"] !== undefined) {
|
|
10
11
|
this.status = serverResponse["status"];
|
|
11
12
|
}
|
|
12
|
-
if (serverResponse["error"]
|
|
13
|
-
serverResponse["error"] !== null &&
|
|
14
|
-
Object.keys(serverResponse["error"]).length > 0) {
|
|
13
|
+
if (serverResponse["error"]) {
|
|
15
14
|
this.error = new ErrorResponse(serverResponse["error"]);
|
|
16
15
|
}
|
|
17
16
|
this.createdAt = parseDate(serverResponse["created_at"]);
|
|
17
|
+
if (!serverResponse["completed_at"]) {
|
|
18
|
+
this.completedAt = undefined;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.completedAt = parseDate(serverResponse["completed_at"]);
|
|
22
|
+
}
|
|
18
23
|
this.modelId = serverResponse["model_id"];
|
|
19
24
|
this.pollingUrl = serverResponse["polling_url"];
|
|
20
25
|
this.filename = serverResponse["filename"];
|
|
21
26
|
this.resultUrl = serverResponse["result_url"];
|
|
22
27
|
this.alias = serverResponse["alias"];
|
|
23
|
-
this.webhooks = serverResponse["webhooks"];
|
|
28
|
+
this.webhooks = (serverResponse["webhooks"] ?? []).map((webhook) => new JobWebhook(webhook));
|
|
24
29
|
}
|
|
25
30
|
}
|
|
@@ -8,7 +8,7 @@ export class JobWebhook {
|
|
|
8
8
|
this.id = serverResponse["id"];
|
|
9
9
|
this.createdAt = parseDate(serverResponse["created_at"]);
|
|
10
10
|
this.status = serverResponse["status"];
|
|
11
|
-
if (serverResponse["error"]
|
|
11
|
+
if (serverResponse["error"]) {
|
|
12
12
|
this.error = new ErrorResponse(serverResponse["error"]);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -8,7 +8,7 @@ export class CropResult {
|
|
|
8
8
|
this.crops = serverResponse["crops"].map((cropItem) => new CropItem(cropItem));
|
|
9
9
|
}
|
|
10
10
|
toString() {
|
|
11
|
-
const crops = this.crops.map(item => item.toString()).join("\n
|
|
12
|
-
return `
|
|
11
|
+
const crops = this.crops.map(item => item.toString()).join("\n");
|
|
12
|
+
return `Crops\n=====\n${crops}`;
|
|
13
13
|
}
|
|
14
14
|
}
|