mindee 4.29.0-rc2 → 4.29.0-rc4
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 +15 -0
- package/package.json +1 -1
- package/src/clientV2.d.ts +5 -5
- package/src/clientV2.js +1 -1
- package/src/http/mindeeApiV2.d.ts +3 -3
- package/src/http/mindeeApiV2.js +14 -8
- package/src/input/sources/urlInput.d.ts +1 -1
- package/src/parsing/v2/field/baseField.d.ts +0 -2
- package/src/parsing/v2/field/baseField.js +0 -6
- package/src/parsing/v2/field/dynamicField.d.ts +7 -0
- package/src/parsing/v2/field/dynamicField.js +16 -0
- package/src/parsing/v2/field/inferenceFields.js +2 -2
- package/src/parsing/v2/field/objectField.d.ts +2 -2
- package/src/parsing/v2/field/objectField.js +2 -2
- package/src/parsing/v2/field/simpleField.d.ts +2 -2
- package/src/parsing/v2/field/simpleField.js +12 -5
- package/src/parsing/v2/index.d.ts +3 -3
- package/src/parsing/v2/index.js +7 -7
- package/src/parsing/v2/inference.d.ts +4 -4
- package/src/parsing/v2/inference.js +4 -4
- package/src/parsing/v2/{inferenceResultFile.d.ts → inferenceFile.d.ts} +9 -1
- package/src/parsing/v2/inferenceFile.js +20 -0
- package/src/parsing/v2/{inferenceResultModel.d.ts → inferenceModel.d.ts} +1 -1
- package/src/parsing/v2/{inferenceResultModel.js → inferenceModel.js} +3 -3
- package/src/parsing/v2/job.d.ts +2 -2
- package/src/parsing/v2/job.js +2 -2
- package/src/parsing/v2/{jobResponseWebhook.d.ts → jobWebhook.d.ts} +3 -3
- package/src/parsing/v2/{jobResponseWebhook.js → jobWebhook.js} +4 -4
- package/src/parsing/v2/inferenceResultFile.js +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v4.29.0-rc4 - 2025-07-29
|
|
4
|
+
### Changes
|
|
5
|
+
* :sparkles: add support for page count & mime type + fix syntaxes
|
|
6
|
+
* :recycle: update internal field syntaxes to match other SDKs
|
|
7
|
+
* :recycle: upgrade toString() display for most fields
|
|
8
|
+
* :recycle: fix internals & upgrade tests
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## v4.29.0-rc3 - 2025-07-25
|
|
12
|
+
### Changes
|
|
13
|
+
* :sparkles: add support for URL input source
|
|
14
|
+
### Fixes
|
|
15
|
+
* :arrow_up: bump dependencies to cover vulnerabilities
|
|
16
|
+
|
|
17
|
+
|
|
3
18
|
## v4.29.0-rc2 - 2025-07-25
|
|
4
19
|
### Changes
|
|
5
20
|
* :recycle: harmonize with other client libraries
|
package/package.json
CHANGED
package/src/clientV2.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Base64Input, BufferInput, BytesInput,
|
|
1
|
+
import { Base64Input, BufferInput, BytesInput, InputSource, PathInput, StreamInput, UrlInput } from "./input";
|
|
2
2
|
import { InferenceResponse, JobResponse } from "./parsing/v2";
|
|
3
3
|
import { MindeeApiV2 } from "./http/mindeeApiV2";
|
|
4
4
|
import { Readable } from "stream";
|
|
@@ -106,7 +106,7 @@ export interface ClientOptions {
|
|
|
106
106
|
*/
|
|
107
107
|
export declare class ClientV2 {
|
|
108
108
|
#private;
|
|
109
|
-
/**
|
|
109
|
+
/** Mindee API handler. */
|
|
110
110
|
protected mindeeApi: MindeeApiV2;
|
|
111
111
|
/**
|
|
112
112
|
* @param {ClientOptions} options options for the initialization of a client.
|
|
@@ -114,12 +114,12 @@ export declare class ClientV2 {
|
|
|
114
114
|
constructor({ apiKey, throwOnError, debug }?: ClientOptions);
|
|
115
115
|
/**
|
|
116
116
|
* Send the document to an asynchronous endpoint and return its ID in the queue.
|
|
117
|
-
* @param inputSource file to parse.
|
|
117
|
+
* @param inputSource file or URL to parse.
|
|
118
118
|
* @param params parameters relating to prediction options.
|
|
119
119
|
* @category Asynchronous
|
|
120
120
|
* @returns a `Promise` containing the job (queue) corresponding to a document.
|
|
121
121
|
*/
|
|
122
|
-
enqueueInference(inputSource:
|
|
122
|
+
enqueueInference(inputSource: InputSource, params: InferenceParameters): Promise<JobResponse>;
|
|
123
123
|
/**
|
|
124
124
|
* Retrieves an inference.
|
|
125
125
|
*
|
|
@@ -152,7 +152,7 @@ export declare class ClientV2 {
|
|
|
152
152
|
* @category Synchronous
|
|
153
153
|
* @returns a `Promise` containing parsing results.
|
|
154
154
|
*/
|
|
155
|
-
enqueueAndGetInference(inputDoc:
|
|
155
|
+
enqueueAndGetInference(inputDoc: InputSource, params: InferenceParameters): Promise<InferenceResponse>;
|
|
156
156
|
/**
|
|
157
157
|
* Load an input source from a local path.
|
|
158
158
|
* @param inputPath
|
package/src/clientV2.js
CHANGED
|
@@ -38,7 +38,7 @@ class ClientV2 {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* Send the document to an asynchronous endpoint and return its ID in the queue.
|
|
41
|
-
* @param inputSource file to parse.
|
|
41
|
+
* @param inputSource file or URL to parse.
|
|
42
42
|
* @param params parameters relating to prediction options.
|
|
43
43
|
* @category Asynchronous
|
|
44
44
|
* @returns a `Promise` containing the job (queue) corresponding to a document.
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { ApiSettingsV2 } from "./apiSettingsV2";
|
|
2
2
|
import { InferenceParameters } from "../clientV2";
|
|
3
3
|
import { InferenceResponse, JobResponse } from "../parsing/v2";
|
|
4
|
-
import {
|
|
4
|
+
import { InputSource } from "../input";
|
|
5
5
|
export declare class MindeeApiV2 {
|
|
6
6
|
#private;
|
|
7
7
|
settings: ApiSettingsV2;
|
|
8
8
|
constructor(apiKey?: string);
|
|
9
9
|
/**
|
|
10
10
|
* Sends a file to the inference queue.
|
|
11
|
-
* @param
|
|
11
|
+
* @param inputSource Local file loaded as an input.
|
|
12
12
|
* @param params {InferenceParameters} parameters relating to the enqueueing options.
|
|
13
13
|
* @category V2
|
|
14
14
|
* @throws Error if the server's response contains one.
|
|
15
15
|
* @returns a `Promise` containing a job response.
|
|
16
16
|
*/
|
|
17
|
-
reqPostInferenceEnqueue(
|
|
17
|
+
reqPostInferenceEnqueue(inputSource: InputSource, params: InferenceParameters): Promise<JobResponse>;
|
|
18
18
|
/**
|
|
19
19
|
* Requests the job of a queued document from the API.
|
|
20
20
|
* Throws an error if the server's response contains one.
|
package/src/http/mindeeApiV2.js
CHANGED
|
@@ -14,6 +14,7 @@ const apiSettingsV2_1 = require("./apiSettingsV2");
|
|
|
14
14
|
const v2_1 = require("../parsing/v2");
|
|
15
15
|
const form_data_1 = __importDefault(require("form-data"));
|
|
16
16
|
const baseEndpoint_1 = require("./baseEndpoint");
|
|
17
|
+
const input_1 = require("../input");
|
|
17
18
|
const mindeeError_1 = require("../errors/mindeeError");
|
|
18
19
|
const logger_1 = require("../logger");
|
|
19
20
|
class MindeeApiV2 {
|
|
@@ -23,18 +24,18 @@ class MindeeApiV2 {
|
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* Sends a file to the inference queue.
|
|
26
|
-
* @param
|
|
27
|
+
* @param inputSource Local file loaded as an input.
|
|
27
28
|
* @param params {InferenceParameters} parameters relating to the enqueueing options.
|
|
28
29
|
* @category V2
|
|
29
30
|
* @throws Error if the server's response contains one.
|
|
30
31
|
* @returns a `Promise` containing a job response.
|
|
31
32
|
*/
|
|
32
|
-
async reqPostInferenceEnqueue(
|
|
33
|
-
await
|
|
33
|
+
async reqPostInferenceEnqueue(inputSource, params) {
|
|
34
|
+
await inputSource.init();
|
|
34
35
|
if (params.modelId === undefined || params.modelId === null || params.modelId === "") {
|
|
35
36
|
throw new Error("Model ID must be provided");
|
|
36
37
|
}
|
|
37
|
-
const result = await __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_documentEnqueuePost).call(this,
|
|
38
|
+
const result = await __classPrivateFieldGet(this, _MindeeApiV2_instances, "m", _MindeeApiV2_documentEnqueuePost).call(this, inputSource, params);
|
|
38
39
|
if (result.data.error?.code !== undefined) {
|
|
39
40
|
throw new mindeeError_1.MindeeHttpErrorV2(result.data.error.code, result.data.error.message ?? "Unknown error.");
|
|
40
41
|
}
|
|
@@ -78,7 +79,7 @@ _MindeeApiV2_instances = new WeakSet(), _MindeeApiV2_processResponse = function
|
|
|
78
79
|
logger_1.logger.error(`Raised '${e}' Couldn't deserialize response object:\n${JSON.stringify(result.data)}`);
|
|
79
80
|
throw new mindeeError_1.MindeeApiV2Error("Couldn't deserialize response object.");
|
|
80
81
|
}
|
|
81
|
-
}, _MindeeApiV2_documentEnqueuePost = function _MindeeApiV2_documentEnqueuePost(
|
|
82
|
+
}, _MindeeApiV2_documentEnqueuePost = function _MindeeApiV2_documentEnqueuePost(inputSource, params) {
|
|
82
83
|
const form = new form_data_1.default();
|
|
83
84
|
form.append("model_id", params.modelId);
|
|
84
85
|
if (params.rag) {
|
|
@@ -87,9 +88,14 @@ _MindeeApiV2_instances = new WeakSet(), _MindeeApiV2_processResponse = function
|
|
|
87
88
|
if (params.webhookIds && params.webhookIds.length > 0) {
|
|
88
89
|
form.append("webhook_ids", params.webhookIds.join(","));
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
if (inputSource instanceof input_1.LocalInputSource) {
|
|
92
|
+
form.append("file", inputSource.fileObject, {
|
|
93
|
+
filename: inputSource.filename,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
form.append("url", inputSource.url);
|
|
98
|
+
}
|
|
93
99
|
const path = "/v2/inferences/enqueue";
|
|
94
100
|
const headers = { ...this.settings.baseHeaders, ...form.getHeaders() };
|
|
95
101
|
const options = {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { FieldConfidence } from "./fieldConfidence";
|
|
2
|
-
import { FieldLocation } from "./fieldLocation";
|
|
3
2
|
import { StringDict } from "../../common";
|
|
4
3
|
export declare abstract class BaseField {
|
|
5
4
|
protected _indentLevel: number;
|
|
6
|
-
locations: Array<FieldLocation> | undefined;
|
|
7
5
|
confidence: FieldConfidence | undefined;
|
|
8
6
|
protected constructor(rawResponse: StringDict, indentLevel?: number);
|
|
9
7
|
}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseField = void 0;
|
|
4
|
-
const fieldLocation_1 = require("./fieldLocation");
|
|
5
4
|
class BaseField {
|
|
6
5
|
constructor(rawResponse, indentLevel = 0) {
|
|
7
6
|
this._indentLevel = indentLevel;
|
|
8
|
-
if (rawResponse["locations"]) {
|
|
9
|
-
this.locations = rawResponse["locations"].map((location) => {
|
|
10
|
-
return location ? new fieldLocation_1.FieldLocation(location) : "";
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
7
|
if (rawResponse["confidence"] !== undefined) {
|
|
14
8
|
this.confidence = rawResponse["confidence"];
|
|
15
9
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseField } from "./baseField";
|
|
2
|
+
import { FieldLocation } from "./fieldLocation";
|
|
3
|
+
import { StringDict } from "../../common";
|
|
4
|
+
export declare class DynamicField extends BaseField {
|
|
5
|
+
locations: Array<FieldLocation> | undefined;
|
|
6
|
+
constructor(rawResponse: StringDict, indentLevel?: number);
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamicField = void 0;
|
|
4
|
+
const baseField_1 = require("./baseField");
|
|
5
|
+
const fieldLocation_1 = require("./fieldLocation");
|
|
6
|
+
class DynamicField extends baseField_1.BaseField {
|
|
7
|
+
constructor(rawResponse, indentLevel = 0) {
|
|
8
|
+
super(rawResponse, indentLevel);
|
|
9
|
+
if (rawResponse["locations"]) {
|
|
10
|
+
this.locations = rawResponse["locations"].map((location) => {
|
|
11
|
+
return location ? new fieldLocation_1.FieldLocation(location) : "";
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.DynamicField = DynamicField;
|
|
@@ -27,8 +27,8 @@ class InferenceFields extends Map {
|
|
|
27
27
|
line += fieldValue.toString();
|
|
28
28
|
}
|
|
29
29
|
else if (fieldValue.constructor.name === "SimpleField") {
|
|
30
|
-
const val = fieldValue.
|
|
31
|
-
line += val
|
|
30
|
+
const val = fieldValue.toString();
|
|
31
|
+
line += val.length > 0 ? " " + val.toString() : "";
|
|
32
32
|
}
|
|
33
33
|
lines.push(line);
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BaseField } from "./baseField";
|
|
2
1
|
import { InferenceFields } from "./inferenceFields";
|
|
3
2
|
import { StringDict } from "../../common";
|
|
4
|
-
|
|
3
|
+
import { DynamicField } from "./dynamicField";
|
|
4
|
+
export declare class ObjectField extends DynamicField {
|
|
5
5
|
readonly fields: InferenceFields;
|
|
6
6
|
constructor(serverResponse: StringDict, indentLevel?: number);
|
|
7
7
|
toString(): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ObjectField = void 0;
|
|
4
|
-
const baseField_1 = require("./baseField");
|
|
5
4
|
const inferenceFields_1 = require("./inferenceFields");
|
|
6
|
-
|
|
5
|
+
const dynamicField_1 = require("./dynamicField");
|
|
6
|
+
class ObjectField extends dynamicField_1.DynamicField {
|
|
7
7
|
constructor(serverResponse, indentLevel = 0) {
|
|
8
8
|
super(serverResponse, indentLevel);
|
|
9
9
|
this.fields = new inferenceFields_1.InferenceFields(serverResponse["fields"], this._indentLevel + 1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseField } from "./baseField";
|
|
2
1
|
import { StringDict } from "../../common";
|
|
3
|
-
|
|
2
|
+
import { DynamicField } from "./dynamicField";
|
|
3
|
+
export declare class SimpleField extends DynamicField {
|
|
4
4
|
readonly value: string | number | boolean | null;
|
|
5
5
|
constructor(serverResponse: StringDict, indentLevel?: number);
|
|
6
6
|
toString(): string;
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SimpleField = void 0;
|
|
4
|
-
const
|
|
5
|
-
class SimpleField extends
|
|
4
|
+
const dynamicField_1 = require("./dynamicField");
|
|
5
|
+
class SimpleField extends dynamicField_1.DynamicField {
|
|
6
6
|
constructor(serverResponse, indentLevel = 0) {
|
|
7
7
|
super(serverResponse, indentLevel);
|
|
8
8
|
this.value =
|
|
9
9
|
serverResponse["value"] !== undefined ? serverResponse["value"] : null;
|
|
10
10
|
}
|
|
11
11
|
toString() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
if (this.value === null) {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
if (typeof this.value === "number" && Number.isInteger(this.value)) {
|
|
16
|
+
return this.value.toString() + ".0";
|
|
17
|
+
}
|
|
18
|
+
if (typeof this.value === "boolean") {
|
|
19
|
+
return this.value ? "True" : "False";
|
|
20
|
+
}
|
|
21
|
+
return this.value.toString();
|
|
15
22
|
}
|
|
16
23
|
}
|
|
17
24
|
exports.SimpleField = SimpleField;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { CommonResponse } from "./commonResponse";
|
|
2
2
|
export { ErrorResponse } from "./errorResponse";
|
|
3
3
|
export { Inference } from "./inference";
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
4
|
+
export { InferenceFile } from "./inferenceFile";
|
|
5
|
+
export { InferenceModel } from "./inferenceModel";
|
|
6
6
|
export { InferenceResultOptions } from "./inferenceResultOptions";
|
|
7
7
|
export { InferenceResponse } from "./inferenceResponse";
|
|
8
8
|
export { InferenceResult } from "./inferenceResult";
|
|
9
9
|
export { Job } from "./job";
|
|
10
10
|
export { JobResponse } from "./jobResponse";
|
|
11
11
|
export { RawText } from "./rawText";
|
|
12
|
-
export {
|
|
12
|
+
export { JobWebhook } from "./jobWebhook";
|
package/src/parsing/v2/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.JobWebhook = exports.RawText = exports.JobResponse = exports.Job = exports.InferenceResult = exports.InferenceResponse = exports.InferenceResultOptions = exports.InferenceModel = exports.InferenceFile = exports.Inference = exports.ErrorResponse = exports.CommonResponse = void 0;
|
|
4
4
|
var commonResponse_1 = require("./commonResponse");
|
|
5
5
|
Object.defineProperty(exports, "CommonResponse", { enumerable: true, get: function () { return commonResponse_1.CommonResponse; } });
|
|
6
6
|
var errorResponse_1 = require("./errorResponse");
|
|
7
7
|
Object.defineProperty(exports, "ErrorResponse", { enumerable: true, get: function () { return errorResponse_1.ErrorResponse; } });
|
|
8
8
|
var inference_1 = require("./inference");
|
|
9
9
|
Object.defineProperty(exports, "Inference", { enumerable: true, get: function () { return inference_1.Inference; } });
|
|
10
|
-
var
|
|
11
|
-
Object.defineProperty(exports, "
|
|
12
|
-
var
|
|
13
|
-
Object.defineProperty(exports, "
|
|
10
|
+
var inferenceFile_1 = require("./inferenceFile");
|
|
11
|
+
Object.defineProperty(exports, "InferenceFile", { enumerable: true, get: function () { return inferenceFile_1.InferenceFile; } });
|
|
12
|
+
var inferenceModel_1 = require("./inferenceModel");
|
|
13
|
+
Object.defineProperty(exports, "InferenceModel", { enumerable: true, get: function () { return inferenceModel_1.InferenceModel; } });
|
|
14
14
|
var inferenceResultOptions_1 = require("./inferenceResultOptions");
|
|
15
15
|
Object.defineProperty(exports, "InferenceResultOptions", { enumerable: true, get: function () { return inferenceResultOptions_1.InferenceResultOptions; } });
|
|
16
16
|
var inferenceResponse_1 = require("./inferenceResponse");
|
|
@@ -23,5 +23,5 @@ var jobResponse_1 = require("./jobResponse");
|
|
|
23
23
|
Object.defineProperty(exports, "JobResponse", { enumerable: true, get: function () { return jobResponse_1.JobResponse; } });
|
|
24
24
|
var rawText_1 = require("./rawText");
|
|
25
25
|
Object.defineProperty(exports, "RawText", { enumerable: true, get: function () { return rawText_1.RawText; } });
|
|
26
|
-
var
|
|
27
|
-
Object.defineProperty(exports, "
|
|
26
|
+
var jobWebhook_1 = require("./jobWebhook");
|
|
27
|
+
Object.defineProperty(exports, "JobWebhook", { enumerable: true, get: function () { return jobWebhook_1.JobWebhook; } });
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { StringDict } from "../common";
|
|
2
|
-
import {
|
|
2
|
+
import { InferenceModel } from "./inferenceModel";
|
|
3
3
|
import { InferenceResult } from "./inferenceResult";
|
|
4
|
-
import {
|
|
4
|
+
import { InferenceFile } from "./inferenceFile";
|
|
5
5
|
export declare class Inference {
|
|
6
6
|
/**
|
|
7
7
|
* Model info for the inference.
|
|
8
8
|
*/
|
|
9
|
-
model:
|
|
9
|
+
model: InferenceModel;
|
|
10
10
|
/**
|
|
11
11
|
* File info for the inference.
|
|
12
12
|
*/
|
|
13
|
-
file:
|
|
13
|
+
file: InferenceFile;
|
|
14
14
|
/**
|
|
15
15
|
* Result of the inference.
|
|
16
16
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Inference = void 0;
|
|
4
|
-
const
|
|
4
|
+
const inferenceModel_1 = require("./inferenceModel");
|
|
5
5
|
const inferenceResult_1 = require("./inferenceResult");
|
|
6
|
-
const
|
|
6
|
+
const inferenceFile_1 = require("./inferenceFile");
|
|
7
7
|
class Inference {
|
|
8
8
|
constructor(serverResponse) {
|
|
9
|
-
this.model = new
|
|
10
|
-
this.file = new
|
|
9
|
+
this.model = new inferenceModel_1.InferenceModel(serverResponse["model"]);
|
|
10
|
+
this.file = new inferenceFile_1.InferenceFile(serverResponse["file"]);
|
|
11
11
|
this.result = new inferenceResult_1.InferenceResult(serverResponse["result"]);
|
|
12
12
|
if ("id" in serverResponse) {
|
|
13
13
|
this.id = serverResponse["id"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StringDict } from "../common";
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class InferenceFile {
|
|
3
3
|
/**
|
|
4
4
|
* Name of the file.
|
|
5
5
|
*/
|
|
@@ -8,6 +8,14 @@ export declare class InferenceResultFile {
|
|
|
8
8
|
* Optional alias for the file.
|
|
9
9
|
*/
|
|
10
10
|
alias: string;
|
|
11
|
+
/**
|
|
12
|
+
* Page count.
|
|
13
|
+
*/
|
|
14
|
+
pageCount: number;
|
|
15
|
+
/**
|
|
16
|
+
* MIME type.
|
|
17
|
+
*/
|
|
18
|
+
mimeType: string;
|
|
11
19
|
constructor(serverResponse: StringDict);
|
|
12
20
|
toString(): string;
|
|
13
21
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InferenceFile = void 0;
|
|
4
|
+
class InferenceFile {
|
|
5
|
+
constructor(serverResponse) {
|
|
6
|
+
this.name = serverResponse["name"];
|
|
7
|
+
this.alias = serverResponse["alias"];
|
|
8
|
+
this.pageCount = serverResponse["page_count"];
|
|
9
|
+
this.mimeType = serverResponse["mime_type"];
|
|
10
|
+
}
|
|
11
|
+
toString() {
|
|
12
|
+
return ("File\n" +
|
|
13
|
+
"====\n" +
|
|
14
|
+
`:Name: ${this.name}\n` +
|
|
15
|
+
`:Alias:${this.alias ? " " + this.alias : ""}\n`) +
|
|
16
|
+
`:Page Count: ${this.pageCount}\n` +
|
|
17
|
+
`:MIME Type: ${this.mimeType}\n`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.InferenceFile = InferenceFile;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
class
|
|
3
|
+
exports.InferenceModel = void 0;
|
|
4
|
+
class InferenceModel {
|
|
5
5
|
constructor(serverResponse) {
|
|
6
6
|
this.id = serverResponse["id"];
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
exports.
|
|
9
|
+
exports.InferenceModel = InferenceModel;
|
package/src/parsing/v2/job.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StringDict } from "../common";
|
|
2
2
|
import { ErrorResponse } from "./errorResponse";
|
|
3
|
-
import {
|
|
3
|
+
import { JobWebhook } from "./jobWebhook";
|
|
4
4
|
/**
|
|
5
5
|
* Job information for a V2 polling attempt.
|
|
6
6
|
*/
|
|
@@ -44,6 +44,6 @@ export declare class Job {
|
|
|
44
44
|
/**
|
|
45
45
|
* ID of webhooks associated with the job.
|
|
46
46
|
*/
|
|
47
|
-
webhooks: Array<
|
|
47
|
+
webhooks: Array<JobWebhook>;
|
|
48
48
|
constructor(serverResponse: StringDict);
|
|
49
49
|
}
|
package/src/parsing/v2/job.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Job = void 0;
|
|
4
4
|
const errorResponse_1 = require("./errorResponse");
|
|
5
|
-
const
|
|
5
|
+
const common_1 = require("../common");
|
|
6
6
|
/**
|
|
7
7
|
* Job information for a V2 polling attempt.
|
|
8
8
|
*/
|
|
@@ -17,7 +17,7 @@ class Job {
|
|
|
17
17
|
Object.keys(serverResponse["error"]).length > 0) {
|
|
18
18
|
this.error = new errorResponse_1.ErrorResponse(serverResponse["error"]);
|
|
19
19
|
}
|
|
20
|
-
this.createdAt = (0,
|
|
20
|
+
this.createdAt = (0, common_1.parseDate)(serverResponse["created_at"]);
|
|
21
21
|
this.modelId = serverResponse["model_id"];
|
|
22
22
|
this.pollingUrl = serverResponse["polling_url"];
|
|
23
23
|
this.filename = serverResponse["filename"];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ErrorResponse } from "./errorResponse";
|
|
2
2
|
import { StringDict } from "../common";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* JobWebhook information.
|
|
5
5
|
*/
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class JobWebhook {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* JobWebhook ID.
|
|
9
9
|
*/
|
|
10
10
|
id: string;
|
|
11
11
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.JobWebhook = void 0;
|
|
4
4
|
const errorResponse_1 = require("./errorResponse");
|
|
5
5
|
const common_1 = require("../common");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* JobWebhook information.
|
|
8
8
|
*/
|
|
9
|
-
class
|
|
9
|
+
class JobWebhook {
|
|
10
10
|
constructor(serverResponse) {
|
|
11
11
|
this.id = serverResponse["id"];
|
|
12
12
|
this.createdAt = (0, common_1.parseDate)(serverResponse["created_at"]);
|
|
@@ -16,4 +16,4 @@ class JobResponseWebhook {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
exports.
|
|
19
|
+
exports.JobWebhook = JobWebhook;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InferenceResultFile = void 0;
|
|
4
|
-
class InferenceResultFile {
|
|
5
|
-
constructor(serverResponse) {
|
|
6
|
-
this.name = serverResponse["name"];
|
|
7
|
-
this.alias = serverResponse["alias"];
|
|
8
|
-
}
|
|
9
|
-
toString() {
|
|
10
|
-
return ("File\n" +
|
|
11
|
-
"====\n" +
|
|
12
|
-
`:Name: ${this.name}\n` +
|
|
13
|
-
`:Alias:${this.alias ? " " + this.alias : ""}\n`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.InferenceResultFile = InferenceResultFile;
|