extend-ai 1.14.0 → 1.15.0
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/BaseClient.js +2 -2
- package/Client.d.ts +3 -1
- package/Client.js +5 -3
- package/api/client/requests/ExtractRequest.d.ts +12 -2
- package/api/resources/extractRuns/client/Client.d.ts +15 -1
- package/api/resources/extractRuns/client/Client.js +17 -3
- package/api/resources/extractRuns/client/requests/ExtractRunsCreateRequest.d.ts +26 -2
- package/api/resources/extractRuns/types/ExtractRunsCreateRequestFile.d.ts +3 -1
- package/api/types/ExtractRequestFile.d.ts +3 -1
- package/api/types/ExtractRun.d.ts +7 -1
- package/api/types/ExtractRunSummary.d.ts +7 -1
- package/api/types/MultiFileRunPackage.d.ts +10 -0
- package/api/types/MultiFileRunPackage.js +3 -0
- package/api/types/MultiFileRunPackageFilesItem.d.ts +2 -0
- package/api/types/MultiFileRunPackageFilesItem.js +3 -0
- package/api/types/index.d.ts +2 -0
- package/api/types/index.js +2 -0
- package/package.json +1 -1
- package/reference.md +2 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/resources/extractRuns/ExtractRunsWrapper.test.js +1 -1
- package/wrapper/webhooks/Webhooks.test.js +1 -0
package/BaseClient.js
CHANGED
|
@@ -44,8 +44,8 @@ function normalizeClientOptions(options) {
|
|
|
44
44
|
const headers = (0, headers_1.mergeHeaders)({
|
|
45
45
|
"X-Fern-Language": "JavaScript",
|
|
46
46
|
"X-Fern-SDK-Name": "extend-ai",
|
|
47
|
-
"X-Fern-SDK-Version": "1.
|
|
48
|
-
"User-Agent": "extend-ai/1.
|
|
47
|
+
"X-Fern-SDK-Version": "1.15.0",
|
|
48
|
+
"User-Agent": "extend-ai/1.15.0",
|
|
49
49
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
50
50
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
51
51
|
"x-extend-api-version": (_a = options === null || options === void 0 ? void 0 : options.extendApiVersion) !== null && _a !== void 0 ? _a : "2026-02-09",
|
package/Client.d.ts
CHANGED
|
@@ -165,6 +165,8 @@ export declare class ExtendClient {
|
|
|
165
165
|
*
|
|
166
166
|
* The Extract endpoint allows you to extract structured data from files using an existing extractor, an inline configuration, or no configuration at all. When neither is provided, Extend automatically infers a schema from the document before extraction — no extractor or schema is required.
|
|
167
167
|
*
|
|
168
|
+
* Pass `file` for a single document, or `package` to extract from multiple files in a single run. Exactly one of `file` or `package` must be provided.
|
|
169
|
+
*
|
|
168
170
|
* For more details, see the [Extract File guide](https://docs.extend.ai/2026-02-09/extraction/overview).
|
|
169
171
|
*
|
|
170
172
|
* @param {Extend.ExtractRequest} request
|
|
@@ -224,7 +226,7 @@ export declare class ExtendClient {
|
|
|
224
226
|
* }
|
|
225
227
|
* })
|
|
226
228
|
*/
|
|
227
|
-
extract(request
|
|
229
|
+
extract(request?: Extend.ExtractRequest, requestOptions?: ExtendClient.RequestOptions): core.HttpResponsePromise<Extend.ExtractRun>;
|
|
228
230
|
private __extract;
|
|
229
231
|
/**
|
|
230
232
|
* Classify a document synchronously, waiting for the result before returning. This endpoint has a **5-minute timeout** — if processing takes longer, the request will fail.
|
package/Client.js
CHANGED
|
@@ -386,6 +386,8 @@ class ExtendClient {
|
|
|
386
386
|
*
|
|
387
387
|
* The Extract endpoint allows you to extract structured data from files using an existing extractor, an inline configuration, or no configuration at all. When neither is provided, Extend automatically infers a schema from the document before extraction — no extractor or schema is required.
|
|
388
388
|
*
|
|
389
|
+
* Pass `file` for a single document, or `package` to extract from multiple files in a single run. Exactly one of `file` or `package` must be provided.
|
|
390
|
+
*
|
|
389
391
|
* For more details, see the [Extract File guide](https://docs.extend.ai/2026-02-09/extraction/overview).
|
|
390
392
|
*
|
|
391
393
|
* @param {Extend.ExtractRequest} request
|
|
@@ -445,11 +447,11 @@ class ExtendClient {
|
|
|
445
447
|
* }
|
|
446
448
|
* })
|
|
447
449
|
*/
|
|
448
|
-
extract(request, requestOptions) {
|
|
450
|
+
extract(request = {}, requestOptions) {
|
|
449
451
|
return core.HttpResponsePromise.fromPromise(this.__extract(request, requestOptions));
|
|
450
452
|
}
|
|
451
|
-
__extract(
|
|
452
|
-
return __awaiter(this,
|
|
453
|
+
__extract() {
|
|
454
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
453
455
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
454
456
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
455
457
|
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -50,7 +50,17 @@ export interface ExtractRequest {
|
|
|
50
50
|
extractor?: Extend.ExtractRequestExtractor;
|
|
51
51
|
/** Inline extract configuration. Mutually exclusive with `extractor` — provide one or the other, or omit both to have Extend infer a schema from the document. */
|
|
52
52
|
config?: Extend.ExtractConfigJson;
|
|
53
|
-
/**
|
|
54
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The file to be extracted from. Mutually exclusive with `package` — provide one or the other.
|
|
55
|
+
*
|
|
56
|
+
* Files can be provided as a URL, Extend file ID, or raw text.
|
|
57
|
+
*/
|
|
58
|
+
file?: Extend.ExtractRequestFile;
|
|
59
|
+
/**
|
|
60
|
+
* A collection of files to extract from together in a single run. Mutually exclusive with `file` — provide one or the other.
|
|
61
|
+
*
|
|
62
|
+
* See [Multifile Extraction](https://docs.extend.ai/2026-02-09/extraction/multifile) for details.
|
|
63
|
+
*/
|
|
64
|
+
package?: Extend.MultiFileRunPackage;
|
|
55
65
|
metadata?: Extend.RunMetadata;
|
|
56
66
|
}
|
|
@@ -60,8 +60,22 @@ export declare class ExtractRunsClient {
|
|
|
60
60
|
* url: "https://example.com/invoice.pdf"
|
|
61
61
|
* }
|
|
62
62
|
* })
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* await client.extractRuns.create({
|
|
66
|
+
* extractor: {
|
|
67
|
+
* id: "ex_1234567890"
|
|
68
|
+
* },
|
|
69
|
+
* "package": {
|
|
70
|
+
* files: [{
|
|
71
|
+
* url: "https://example.com/invoice1.pdf"
|
|
72
|
+
* }, {
|
|
73
|
+
* url: "https://example.com/invoice2.pdf"
|
|
74
|
+
* }]
|
|
75
|
+
* }
|
|
76
|
+
* })
|
|
63
77
|
*/
|
|
64
|
-
create(request
|
|
78
|
+
create(request?: Extend.ExtractRunsCreateRequest, requestOptions?: ExtractRunsClient.RequestOptions): core.HttpResponsePromise<Extend.ExtractRun>;
|
|
65
79
|
private __create;
|
|
66
80
|
/**
|
|
67
81
|
* Retrieve details about a specific extract run, including its status, outputs, and any edits made during review.
|
|
@@ -170,12 +170,26 @@ class ExtractRunsClient {
|
|
|
170
170
|
* url: "https://example.com/invoice.pdf"
|
|
171
171
|
* }
|
|
172
172
|
* })
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* await client.extractRuns.create({
|
|
176
|
+
* extractor: {
|
|
177
|
+
* id: "ex_1234567890"
|
|
178
|
+
* },
|
|
179
|
+
* "package": {
|
|
180
|
+
* files: [{
|
|
181
|
+
* url: "https://example.com/invoice1.pdf"
|
|
182
|
+
* }, {
|
|
183
|
+
* url: "https://example.com/invoice2.pdf"
|
|
184
|
+
* }]
|
|
185
|
+
* }
|
|
186
|
+
* })
|
|
173
187
|
*/
|
|
174
|
-
create(request, requestOptions) {
|
|
188
|
+
create(request = {}, requestOptions) {
|
|
175
189
|
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
176
190
|
}
|
|
177
|
-
__create(
|
|
178
|
-
return __awaiter(this,
|
|
191
|
+
__create() {
|
|
192
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
179
193
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
180
194
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
181
195
|
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -9,14 +9,38 @@ import type * as Extend from "../../../../index";
|
|
|
9
9
|
* url: "https://example.com/invoice.pdf"
|
|
10
10
|
* }
|
|
11
11
|
* }
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* {
|
|
15
|
+
* extractor: {
|
|
16
|
+
* id: "ex_1234567890"
|
|
17
|
+
* },
|
|
18
|
+
* "package": {
|
|
19
|
+
* files: [{
|
|
20
|
+
* url: "https://example.com/invoice1.pdf"
|
|
21
|
+
* }, {
|
|
22
|
+
* url: "https://example.com/invoice2.pdf"
|
|
23
|
+
* }]
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
12
26
|
*/
|
|
13
27
|
export interface ExtractRunsCreateRequest {
|
|
14
28
|
/** Reference to an existing extractor. Mutually exclusive with `config` — provide one or the other, or omit both to have Extend infer a schema from the document. */
|
|
15
29
|
extractor?: Extend.ExtractRunsCreateRequestExtractor;
|
|
16
30
|
/** Inline extract configuration. Mutually exclusive with `extractor` — provide one or the other, or omit both to have Extend infer a schema from the document. */
|
|
17
31
|
config?: Extend.ExtractConfigJson;
|
|
18
|
-
/**
|
|
19
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The file to be extracted from. Mutually exclusive with `package` — provide one or the other.
|
|
34
|
+
*
|
|
35
|
+
* Files can be provided as a URL, Extend file ID, or raw text.
|
|
36
|
+
*/
|
|
37
|
+
file?: Extend.ExtractRunsCreateRequestFile;
|
|
38
|
+
/**
|
|
39
|
+
* A collection of files to extract from together in a single run. Mutually exclusive with `file` — provide one or the other.
|
|
40
|
+
*
|
|
41
|
+
* See [Multifile Extraction](https://docs.extend.ai/2026-02-09/extraction/multifile) for details.
|
|
42
|
+
*/
|
|
43
|
+
package?: Extend.MultiFileRunPackage;
|
|
20
44
|
priority?: Extend.RunPriority;
|
|
21
45
|
metadata?: Extend.RunMetadata;
|
|
22
46
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type * as Extend from "../../../index";
|
|
2
2
|
/**
|
|
3
|
-
* The file to be extracted from.
|
|
3
|
+
* The file to be extracted from. Mutually exclusive with `package` — provide one or the other.
|
|
4
|
+
*
|
|
5
|
+
* Files can be provided as a URL, Extend file ID, or raw text.
|
|
4
6
|
*/
|
|
5
7
|
export type ExtractRunsCreateRequestFile = Extend.FileFromUrl | Extend.FileFromId | Extend.FileFromText;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type * as Extend from "../index";
|
|
2
2
|
/**
|
|
3
|
-
* The file to be extracted from.
|
|
3
|
+
* The file to be extracted from. Mutually exclusive with `package` — provide one or the other.
|
|
4
|
+
*
|
|
5
|
+
* Files can be provided as a URL, Extend file ID, or raw text.
|
|
4
6
|
*/
|
|
5
7
|
export type ExtractRequestFile = Extend.FileFromUrl | Extend.FileFromId | Extend.FileFromText;
|
|
@@ -94,8 +94,14 @@ export interface ExtractRun {
|
|
|
94
94
|
* **Availability:** Present when an extractor reference was provided. Not present when using inline `config`.
|
|
95
95
|
*/
|
|
96
96
|
extractorVersion: Extend.ExtractorVersionSummary | null;
|
|
97
|
-
/** The file that was processed. `null` when the file could not be accessed or processed (for example a run that failed during file ingestion
|
|
97
|
+
/** The file that was processed. `null` for multifile runs (use `files` instead), and `null` when the file could not be accessed or processed (for example, a run that failed during file ingestion). */
|
|
98
98
|
file: Extend.FileSummary | null;
|
|
99
|
+
/**
|
|
100
|
+
* The files that were processed, in the order they were submitted. Only populated for multifile runs (created with `package`).
|
|
101
|
+
*
|
|
102
|
+
* For single-file runs, this is `null` — use `file` instead.
|
|
103
|
+
*/
|
|
104
|
+
files: Extend.FileSummary[] | null;
|
|
99
105
|
/**
|
|
100
106
|
* The ID of the parse run that was used for this extract run.
|
|
101
107
|
*
|
|
@@ -56,8 +56,14 @@ export interface ExtractRunSummary {
|
|
|
56
56
|
reviewed: boolean;
|
|
57
57
|
/** Indicates whether the run results have been edited during review. */
|
|
58
58
|
edited: boolean;
|
|
59
|
-
/** The file that was processed. `null` when the file could not be accessed or processed (for example a run that failed during file ingestion
|
|
59
|
+
/** The file that was processed. `null` for multifile runs (use `files` instead), and `null` when the file could not be accessed or processed (for example, a run that failed during file ingestion). */
|
|
60
60
|
file: Extend.FileSummary | null;
|
|
61
|
+
/**
|
|
62
|
+
* The files that were processed, in the order they were submitted. Only populated for multifile runs (created with `package`).
|
|
63
|
+
*
|
|
64
|
+
* For single-file runs, this is `null` — use `file` instead.
|
|
65
|
+
*/
|
|
66
|
+
files: Extend.FileSummary[] | null;
|
|
61
67
|
/**
|
|
62
68
|
* The ID of the parse run that was used for this extract run.
|
|
63
69
|
*
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Extend from "../index";
|
|
2
|
+
/**
|
|
3
|
+
* An ordered collection of files to extract from together in a single run. Use this instead of `file` when you want to run extraction across multiple documents at once.
|
|
4
|
+
*
|
|
5
|
+
* Exactly one of `file` or `package` must be provided on a request — they are mutually exclusive.
|
|
6
|
+
*/
|
|
7
|
+
export interface MultiFileRunPackage {
|
|
8
|
+
/** The files to extract from. Each entry can be a URL or an existing Extend file ID. */
|
|
9
|
+
files: Extend.MultiFileRunPackageFilesItem[];
|
|
10
|
+
}
|
package/api/types/index.d.ts
CHANGED
|
@@ -266,6 +266,8 @@ export * from "./MergeExtractStepDefinitionConfig";
|
|
|
266
266
|
export * from "./MergeExtractStepDefinitionConfigMergeOrder";
|
|
267
267
|
export * from "./MergeExtractStepRun";
|
|
268
268
|
export * from "./MergeExtractStepRunStep";
|
|
269
|
+
export * from "./MultiFileRunPackage";
|
|
270
|
+
export * from "./MultiFileRunPackageFilesItem";
|
|
269
271
|
export * from "./NextPageToken";
|
|
270
272
|
export * from "./PageRanges";
|
|
271
273
|
export * from "./PageRangesItem";
|
package/api/types/index.js
CHANGED
|
@@ -282,6 +282,8 @@ __exportStar(require("./MergeExtractStepDefinitionConfig"), exports);
|
|
|
282
282
|
__exportStar(require("./MergeExtractStepDefinitionConfigMergeOrder"), exports);
|
|
283
283
|
__exportStar(require("./MergeExtractStepRun"), exports);
|
|
284
284
|
__exportStar(require("./MergeExtractStepRunStep"), exports);
|
|
285
|
+
__exportStar(require("./MultiFileRunPackage"), exports);
|
|
286
|
+
__exportStar(require("./MultiFileRunPackageFilesItem"), exports);
|
|
285
287
|
__exportStar(require("./NextPageToken"), exports);
|
|
286
288
|
__exportStar(require("./PageRanges"), exports);
|
|
287
289
|
__exportStar(require("./PageRangesItem"), exports);
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -170,6 +170,8 @@ Extract structured data from a file synchronously, waiting for the result before
|
|
|
170
170
|
|
|
171
171
|
The Extract endpoint allows you to extract structured data from files using an existing extractor, an inline configuration, or no configuration at all. When neither is provided, Extend automatically infers a schema from the document before extraction — no extractor or schema is required.
|
|
172
172
|
|
|
173
|
+
Pass `file` for a single document, or `package` to extract from multiple files in a single run. Exactly one of `file` or `package` must be provided.
|
|
174
|
+
|
|
173
175
|
For more details, see the [Extract File guide](https://docs.extend.ai/2026-02-09/extraction/overview).
|
|
174
176
|
</dd>
|
|
175
177
|
</dl>
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.15.0";
|
package/version.js
CHANGED
|
@@ -51,7 +51,7 @@ function createMockExtractRun(overrides = {}) {
|
|
|
51
51
|
metadata: {},
|
|
52
52
|
createdAt: "2024-01-01T00:00:00Z",
|
|
53
53
|
updatedAt: "2024-01-01T00:00:00Z",
|
|
54
|
-
}, dashboardUrl: "https://dashboard.extend.ai/extract-runs/extract_run_test123", edits: {}, usage: { credits: 1 }, failureReason: null, failureMessage: null, parseRunId: null, createdAt: "2024-01-01T00:00:00Z", updatedAt: "2024-01-01T00:00:00Z" }, overrides);
|
|
54
|
+
}, files: null, dashboardUrl: "https://dashboard.extend.ai/extract-runs/extract_run_test123", edits: {}, usage: { credits: 1 }, failureReason: null, failureMessage: null, parseRunId: null, createdAt: "2024-01-01T00:00:00Z", updatedAt: "2024-01-01T00:00:00Z" }, overrides);
|
|
55
55
|
}
|
|
56
56
|
// ============================================================================
|
|
57
57
|
// Tests
|
|
@@ -145,6 +145,7 @@ const sampleExtractRunPayload = {
|
|
|
145
145
|
createdAt: "2024-01-01T00:00:00Z",
|
|
146
146
|
updatedAt: "2024-01-01T00:00:00Z",
|
|
147
147
|
},
|
|
148
|
+
files: null,
|
|
148
149
|
dashboardUrl: "https://dashboard.extend.ai/extract-runs/extract_run_def456",
|
|
149
150
|
edits: {},
|
|
150
151
|
usage: { credits: 1 },
|