mindee 5.3.0 → 5.3.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 +6 -0
- package/package.json +3 -3
- package/src/v2/client.d.ts +10 -0
- package/src/v2/client.js +14 -1
- package/src/v2/parsing/localResponse.d.ts +17 -5
- package/src/v2/parsing/localResponse.js +17 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Mindee Node.js API Library Changelog
|
|
2
2
|
|
|
3
|
+
## v5.3.1 - 2026-06-11
|
|
4
|
+
### Fixes
|
|
5
|
+
* :arrow_up: bump 'tmp' and 'file-type'
|
|
6
|
+
* :bug: :sparkles: get results by URL directly
|
|
7
|
+
|
|
8
|
+
|
|
3
9
|
## v5.3.0 - 2026-05-07
|
|
4
10
|
### Changes
|
|
5
11
|
* :sparkles: Add support for extraction in crop, split, and classify products
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindee",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "Mindee Client Library for Node.js",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mindee",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"commander": "^14.0.3",
|
|
51
|
-
"file-type": "^21.3.
|
|
52
|
-
"tmp": "^0.2.
|
|
51
|
+
"file-type": "^21.3.4",
|
|
52
|
+
"tmp": "^0.2.7",
|
|
53
53
|
"undici": ">=6.24.0 <7.0.0 || >=7.24.0 <8.0.0"
|
|
54
54
|
},
|
|
55
55
|
"optionalDependencies": {
|
package/src/v2/client.d.ts
CHANGED
|
@@ -41,6 +41,16 @@ export declare class Client {
|
|
|
41
41
|
* @returns a `Promise` containing the inference.
|
|
42
42
|
*/
|
|
43
43
|
getResult<P extends typeof BaseProduct>(product: P, inferenceId: string): Promise<InstanceType<P["responseClass"]>>;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieves the result of a previously enqueued request.
|
|
46
|
+
* This method is used when manually polling the server for the result URL.
|
|
47
|
+
*
|
|
48
|
+
* @param product the product to retrieve.
|
|
49
|
+
* @param url URL as given in the `getJob()` response.
|
|
50
|
+
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
|
|
51
|
+
* @returns a `Promise` containing the inference.
|
|
52
|
+
*/
|
|
53
|
+
getResultByUrl<P extends typeof BaseProduct>(product: P, url: string): Promise<InstanceType<P["responseClass"]>>;
|
|
44
54
|
/**
|
|
45
55
|
* Get the processing status of a previously enqueued request.
|
|
46
56
|
* Can be used for polling.
|
package/src/v2/client.js
CHANGED
|
@@ -53,6 +53,19 @@ export class Client {
|
|
|
53
53
|
logger.debug(`Attempting to get inference with ID: ${inferenceId} using response type: ${product.name}`);
|
|
54
54
|
return await this.mindeeApi.getProductResultById(product, inferenceId);
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves the result of a previously enqueued request.
|
|
58
|
+
* This method is used when manually polling the server for the result URL.
|
|
59
|
+
*
|
|
60
|
+
* @param product the product to retrieve.
|
|
61
|
+
* @param url URL as given in the `getJob()` response.
|
|
62
|
+
* @typeParam T an extension of an `Inference`. Can be omitted as it will be inferred from the `productClass`.
|
|
63
|
+
* @returns a `Promise` containing the inference.
|
|
64
|
+
*/
|
|
65
|
+
async getResultByUrl(product, url) {
|
|
66
|
+
logger.debug(`Attempting to get inference from: ${url} using response type: ${product.name}`);
|
|
67
|
+
return await this.mindeeApi.getProductResultByUrl(product, url);
|
|
68
|
+
}
|
|
56
69
|
/**
|
|
57
70
|
* Get the processing status of a previously enqueued request.
|
|
58
71
|
* Can be used for polling.
|
|
@@ -109,7 +122,7 @@ export class Client {
|
|
|
109
122
|
if (!pollResults.job.resultUrl) {
|
|
110
123
|
throw new MindeeError("The result URL is undefined. This is a server error, try again later or contact support.");
|
|
111
124
|
}
|
|
112
|
-
return this.
|
|
125
|
+
return this.getResultByUrl(product, pollResults.job.resultUrl);
|
|
113
126
|
}
|
|
114
127
|
await setTimeout(pollingOptions.delaySec * 1000, undefined, pollingOptions.recurringTimerOptions);
|
|
115
128
|
retryCounter++;
|
|
@@ -7,13 +7,25 @@ import { BaseResponse } from "./baseResponse.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class LocalResponse extends LocalResponseBase {
|
|
9
9
|
/**
|
|
10
|
-
* Deserialize the loaded local response into
|
|
10
|
+
* Deserialize the loaded local response into a product response class.
|
|
11
11
|
*
|
|
12
|
-
* Typically used when dealing with V2 webhook callbacks
|
|
12
|
+
* Typically used when dealing with V2 webhook callbacks to parse the raw
|
|
13
|
+
* JSON payload pushed to your endpoint into a typed response object.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Pass the response class that matches the product you used when enqueuing
|
|
16
|
+
* the document. All product response classes are exported from the `mindee`
|
|
17
|
+
* package and can be used here:
|
|
18
|
+
*
|
|
19
|
+
* - `mindee.product.ExtractionResponse`
|
|
20
|
+
* - `mindee.product.ClassificationResponse`
|
|
21
|
+
* - `mindee.product.OcrResponse`
|
|
22
|
+
* - `mindee.product.CropResponse`
|
|
23
|
+
* - `mindee.product.SplitResponse`
|
|
24
|
+
*
|
|
25
|
+
* @typeParam ResponseT - A class that extends `BaseResponse`.
|
|
26
|
+
* @param responseClass - The constructor of the product response class into
|
|
27
|
+
* which the payload should be deserialized.
|
|
28
|
+
* @returns An instance of `responseClass` populated with the webhook payload.
|
|
17
29
|
* @throws MindeeError If the provided class cannot be instantiated.
|
|
18
30
|
*/
|
|
19
31
|
deserializeResponse<ResponseT extends BaseResponse>(responseClass: new (serverResponse: StringDict) => ResponseT): Promise<ResponseT>;
|
|
@@ -6,13 +6,25 @@ import { LocalResponseBase } from "../../parsing/localResponseBase.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export class LocalResponse extends LocalResponseBase {
|
|
8
8
|
/**
|
|
9
|
-
* Deserialize the loaded local response into
|
|
9
|
+
* Deserialize the loaded local response into a product response class.
|
|
10
10
|
*
|
|
11
|
-
* Typically used when dealing with V2 webhook callbacks
|
|
11
|
+
* Typically used when dealing with V2 webhook callbacks to parse the raw
|
|
12
|
+
* JSON payload pushed to your endpoint into a typed response object.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Pass the response class that matches the product you used when enqueuing
|
|
15
|
+
* the document. All product response classes are exported from the `mindee`
|
|
16
|
+
* package and can be used here:
|
|
17
|
+
*
|
|
18
|
+
* - `mindee.product.ExtractionResponse`
|
|
19
|
+
* - `mindee.product.ClassificationResponse`
|
|
20
|
+
* - `mindee.product.OcrResponse`
|
|
21
|
+
* - `mindee.product.CropResponse`
|
|
22
|
+
* - `mindee.product.SplitResponse`
|
|
23
|
+
*
|
|
24
|
+
* @typeParam ResponseT - A class that extends `BaseResponse`.
|
|
25
|
+
* @param responseClass - The constructor of the product response class into
|
|
26
|
+
* which the payload should be deserialized.
|
|
27
|
+
* @returns An instance of `responseClass` populated with the webhook payload.
|
|
16
28
|
* @throws MindeeError If the provided class cannot be instantiated.
|
|
17
29
|
*/
|
|
18
30
|
async deserializeResponse(responseClass) {
|