extend-ai 1.4.0 → 1.6.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/api/resources/files/client/Client.d.ts +3 -2
- package/api/resources/files/client/Client.js +12 -5
- package/api/resources/files/client/requests/FilesUploadRequest.d.ts +6 -1
- package/api/types/FileFromUrl.d.ts +3 -0
- package/api/types/FileFromUrlSettings.d.ts +7 -0
- package/api/types/FileFromUrlSettings.js +3 -0
- package/api/types/ParseConfigAdvancedOptions.d.ts +6 -0
- package/api/types/SplitAdvancedOptions.d.ts +4 -1
- package/api/types/index.d.ts +1 -0
- package/api/types/index.js +1 -0
- package/package.json +1 -1
- package/reference.md +10 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
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.6.0",
|
|
48
|
+
"User-Agent": "extend-ai/1.6.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",
|
|
@@ -93,6 +93,7 @@ export declare class FilesClient {
|
|
|
93
93
|
* This endpoint requires multipart form encoding. Most HTTP clients will handle this encoding automatically (see the examples).
|
|
94
94
|
*
|
|
95
95
|
* @param {File | fs.ReadStream | Blob} file
|
|
96
|
+
* @param {Extend.FilesUploadRequest} request
|
|
96
97
|
* @param {FilesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
97
98
|
*
|
|
98
99
|
* @throws {@link Extend.BadRequestError}
|
|
@@ -106,8 +107,8 @@ export declare class FilesClient {
|
|
|
106
107
|
*
|
|
107
108
|
* @example
|
|
108
109
|
* import { createReadStream } from "fs";
|
|
109
|
-
* await client.files.upload(createReadStream("path/to/file"))
|
|
110
|
+
* await client.files.upload(createReadStream("path/to/file"), {})
|
|
110
111
|
*/
|
|
111
|
-
upload(file: File | fs.ReadStream | Blob, requestOptions?: FilesClient.RequestOptions): core.HttpResponsePromise<Extend.File_>;
|
|
112
|
+
upload(file: File | fs.ReadStream | Blob, request: Extend.FilesUploadRequest, requestOptions?: FilesClient.RequestOptions): core.HttpResponsePromise<Extend.File_>;
|
|
112
113
|
private __upload;
|
|
113
114
|
}
|
|
@@ -296,6 +296,7 @@ class FilesClient {
|
|
|
296
296
|
* This endpoint requires multipart form encoding. Most HTTP clients will handle this encoding automatically (see the examples).
|
|
297
297
|
*
|
|
298
298
|
* @param {File | fs.ReadStream | Blob} file
|
|
299
|
+
* @param {Extend.FilesUploadRequest} request
|
|
299
300
|
* @param {FilesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
300
301
|
*
|
|
301
302
|
* @throws {@link Extend.BadRequestError}
|
|
@@ -309,16 +310,22 @@ class FilesClient {
|
|
|
309
310
|
*
|
|
310
311
|
* @example
|
|
311
312
|
* import { createReadStream } from "fs";
|
|
312
|
-
* await client.files.upload(createReadStream("path/to/file"))
|
|
313
|
+
* await client.files.upload(createReadStream("path/to/file"), {})
|
|
313
314
|
*/
|
|
314
|
-
upload(file, requestOptions) {
|
|
315
|
-
return core.HttpResponsePromise.fromPromise(this.__upload(file, requestOptions));
|
|
315
|
+
upload(file, request, requestOptions) {
|
|
316
|
+
return core.HttpResponsePromise.fromPromise(this.__upload(file, request, requestOptions));
|
|
316
317
|
}
|
|
317
|
-
__upload(file, requestOptions) {
|
|
318
|
+
__upload(file, request, requestOptions) {
|
|
318
319
|
return __awaiter(this, void 0, void 0, function* () {
|
|
319
320
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
321
|
+
const _queryParams = {
|
|
322
|
+
convertToPdf: request.convertToPdf,
|
|
323
|
+
};
|
|
320
324
|
const _body = yield core.newFormData();
|
|
321
325
|
yield _body.appendFile("file", file);
|
|
326
|
+
if (request.password != null) {
|
|
327
|
+
_body.append("password", request.password);
|
|
328
|
+
}
|
|
322
329
|
const _maybeEncodedRequest = yield _body.getRequest();
|
|
323
330
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
324
331
|
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)(Object.assign({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -326,7 +333,7 @@ class FilesClient {
|
|
|
326
333
|
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ExtendEnvironment.Production, "files/upload"),
|
|
327
334
|
method: "POST",
|
|
328
335
|
headers: _headers,
|
|
329
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
336
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
330
337
|
requestType: "file",
|
|
331
338
|
duplex: _maybeEncodedRequest.duplex,
|
|
332
339
|
body: _maybeEncodedRequest.body,
|
|
@@ -2,4 +2,9 @@
|
|
|
2
2
|
* @example
|
|
3
3
|
* {}
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export interface FilesUploadRequest {
|
|
6
|
+
/** When true, converts the uploaded file to PDF. Supported file types include images (JPEG, PNG, TIFF, GIF, BMP, WebP, HEIC/HEIF), Word documents, PowerPoint, Excel, and HTML. */
|
|
7
|
+
convertToPdf?: boolean;
|
|
8
|
+
/** The password to unlock a password-protected PDF. */
|
|
9
|
+
password?: string;
|
|
10
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as Extend from "../index";
|
|
1
2
|
export interface FileFromUrl {
|
|
2
3
|
/**
|
|
3
4
|
* A URL to download the file. For production use cases, we recommend using presigned URLs with a 5-15 minute expiration time.
|
|
@@ -7,4 +8,6 @@ export interface FileFromUrl {
|
|
|
7
8
|
url: string;
|
|
8
9
|
/** The name of the file. If not set, the file name is taken from the URL. */
|
|
9
10
|
name?: string;
|
|
11
|
+
/** Optional settings for the file, such as a password for password-protected PDFs. */
|
|
12
|
+
settings?: Extend.FileFromUrlSettings;
|
|
10
13
|
}
|
|
@@ -14,8 +14,14 @@ export interface ParseConfigAdvancedOptions {
|
|
|
14
14
|
excelParsingMode?: Extend.ParseConfigAdvancedOptionsExcelParsingMode;
|
|
15
15
|
/** Whether to exclude hidden rows, columns, and sheets when parsing Excel files. */
|
|
16
16
|
excelSkipHiddenContent?: boolean;
|
|
17
|
+
/** Whether to return raw calculated cell values instead of locale-formatted values when parsing Excel files. Useful when downstream processing needs the underlying numeric or unformatted data. */
|
|
18
|
+
excelUseRawCellValues?: boolean;
|
|
19
|
+
/** Whether to skip formula recalculation when opening Excel workbooks. Significantly improves parsing speed for formula-heavy spreadsheets. Disable if cell values depend on volatile functions like NOW() or TODAY(). */
|
|
20
|
+
excelSkipCalculation?: boolean;
|
|
17
21
|
/** Multiplier for the Y-axis threshold used to determine if text blocks should be placed on the same line or not (0.1-5.0, default 1.0). Higher values group elements that are further apart vertically. Only applies when the spatial target is set. */
|
|
18
22
|
verticalGroupingThreshold?: number;
|
|
19
23
|
/** Options for returning raw OCR data in the response. */
|
|
20
24
|
returnOcr?: Extend.ParseConfigAdvancedOptionsReturnOcr;
|
|
25
|
+
/** Whether to convert supported file types (images, Word documents, PowerPoint, Excel, HTML) to PDF before parsing. This can improve parsing quality for some file types and ensures spatial output with bounding boxes. */
|
|
26
|
+
alwaysConvertToPdf?: boolean;
|
|
21
27
|
}
|
|
@@ -15,6 +15,9 @@ export interface SplitAdvancedOptions {
|
|
|
15
15
|
/** For Excel documents, split by worksheet. */
|
|
16
16
|
splitExcelDocumentsBySheetEnabled?: boolean;
|
|
17
17
|
pageRanges?: Extend.PageRanges;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* When enabled, the splitter will allow for page overlap when splitting a document such that a page can occur in multiple adjacent splits when context from the previous split is on the page and context from the next split is on the page.
|
|
20
|
+
* **Availability:** Supported on `splitting_light` >= 1.1.0 and `splitting_performance` >= 1.2.0. If provided on older versions, this field is accepted but ignored.
|
|
21
|
+
*/
|
|
19
22
|
pageOverlapEnabled?: boolean;
|
|
20
23
|
}
|
package/api/types/index.d.ts
CHANGED
|
@@ -141,6 +141,7 @@ export * from "./FileContentsSheetsItem";
|
|
|
141
141
|
export * from "./FileFromId";
|
|
142
142
|
export * from "./FileFromText";
|
|
143
143
|
export * from "./FileFromUrl";
|
|
144
|
+
export * from "./FileFromUrlSettings";
|
|
144
145
|
export * from "./FileMetadata";
|
|
145
146
|
export * from "./FileSummary";
|
|
146
147
|
export * from "./FileType";
|
package/api/types/index.js
CHANGED
|
@@ -157,6 +157,7 @@ __exportStar(require("./FileContentsSheetsItem"), exports);
|
|
|
157
157
|
__exportStar(require("./FileFromId"), exports);
|
|
158
158
|
__exportStar(require("./FileFromText"), exports);
|
|
159
159
|
__exportStar(require("./FileFromUrl"), exports);
|
|
160
|
+
__exportStar(require("./FileFromUrlSettings"), exports);
|
|
160
161
|
__exportStar(require("./FileMetadata"), exports);
|
|
161
162
|
__exportStar(require("./FileSummary"), exports);
|
|
162
163
|
__exportStar(require("./FileType"), exports);
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -632,7 +632,7 @@ Example: `"file_xK9mLPqRtN3vS8wF5hB2cQ"`
|
|
|
632
632
|
</dl>
|
|
633
633
|
</details>
|
|
634
634
|
|
|
635
|
-
<details><summary><code>client.files.<a href="/src/api/resources/files/client/Client.ts">upload</a>(file) -> Extend.File_</code></summary>
|
|
635
|
+
<details><summary><code>client.files.<a href="/src/api/resources/files/client/Client.ts">upload</a>(file, { ...params }) -> Extend.File_</code></summary>
|
|
636
636
|
<dl>
|
|
637
637
|
<dd>
|
|
638
638
|
|
|
@@ -667,7 +667,7 @@ This endpoint requires multipart form encoding. Most HTTP clients will handle th
|
|
|
667
667
|
<dd>
|
|
668
668
|
|
|
669
669
|
```typescript
|
|
670
|
-
await client.files.upload(createReadStream("path/to/file"));
|
|
670
|
+
await client.files.upload(createReadStream("path/to/file"), {});
|
|
671
671
|
|
|
672
672
|
```
|
|
673
673
|
</dd>
|
|
@@ -691,6 +691,14 @@ await client.files.upload(createReadStream("path/to/file"));
|
|
|
691
691
|
<dl>
|
|
692
692
|
<dd>
|
|
693
693
|
|
|
694
|
+
**request:** `Extend.FilesUploadRequest`
|
|
695
|
+
|
|
696
|
+
</dd>
|
|
697
|
+
</dl>
|
|
698
|
+
|
|
699
|
+
<dl>
|
|
700
|
+
<dd>
|
|
701
|
+
|
|
694
702
|
**requestOptions:** `FilesClient.RequestOptions`
|
|
695
703
|
|
|
696
704
|
</dd>
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.6.0";
|
package/version.js
CHANGED