extend-ai 0.0.10 → 0.0.12

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.
Files changed (56) hide show
  1. package/Client.js +2 -2
  2. package/api/errors/InternalServerError.d.ts +1 -2
  3. package/api/errors/TooManyRequestsError.d.ts +1 -2
  4. package/api/resources/processor/client/Client.d.ts +22 -0
  5. package/api/resources/processor/client/Client.js +94 -0
  6. package/api/resources/processor/client/requests/ProcessorListRequest.d.ts +26 -0
  7. package/api/resources/processor/client/requests/ProcessorListRequest.js +5 -0
  8. package/api/resources/processor/client/requests/index.d.ts +1 -0
  9. package/api/resources/processor/types/ProcessorListRequestSortBy.d.ts +8 -0
  10. package/api/resources/processor/types/ProcessorListRequestSortBy.js +10 -0
  11. package/api/resources/processor/types/ProcessorListRequestSortDir.d.ts +8 -0
  12. package/api/resources/processor/types/ProcessorListRequestSortDir.js +10 -0
  13. package/api/resources/processor/types/index.d.ts +2 -0
  14. package/api/resources/processor/types/index.js +2 -0
  15. package/api/types/ExtractionAdvancedOptions.d.ts +2 -0
  16. package/api/types/ExtractionAdvancedOptionsArrayCitationStrategy.d.ts +11 -0
  17. package/api/types/ExtractionAdvancedOptionsArrayCitationStrategy.js +10 -0
  18. package/api/types/ListProcessorsProcessor.d.ts +35 -0
  19. package/api/types/ListProcessorsProcessor.js +5 -0
  20. package/api/types/ListProcessorsProcessorVersion.d.ts +17 -0
  21. package/api/types/ListProcessorsProcessorVersion.js +5 -0
  22. package/api/types/ListProcessorsResponse.d.ts +14 -0
  23. package/api/types/ListProcessorsResponse.js +5 -0
  24. package/api/types/index.d.ts +4 -0
  25. package/api/types/index.js +4 -0
  26. package/dist/Client.js +2 -2
  27. package/dist/api/errors/InternalServerError.d.ts +1 -2
  28. package/dist/api/errors/TooManyRequestsError.d.ts +1 -2
  29. package/dist/api/resources/processor/client/Client.d.ts +22 -0
  30. package/dist/api/resources/processor/client/Client.js +94 -0
  31. package/dist/api/resources/processor/client/requests/ProcessorListRequest.d.ts +26 -0
  32. package/dist/api/resources/processor/client/requests/ProcessorListRequest.js +5 -0
  33. package/dist/api/resources/processor/client/requests/index.d.ts +1 -0
  34. package/dist/api/resources/processor/types/ProcessorListRequestSortBy.d.ts +8 -0
  35. package/dist/api/resources/processor/types/ProcessorListRequestSortBy.js +10 -0
  36. package/dist/api/resources/processor/types/ProcessorListRequestSortDir.d.ts +8 -0
  37. package/dist/api/resources/processor/types/ProcessorListRequestSortDir.js +10 -0
  38. package/dist/api/resources/processor/types/index.d.ts +2 -0
  39. package/dist/api/resources/processor/types/index.js +2 -0
  40. package/dist/api/types/ExtractionAdvancedOptions.d.ts +2 -0
  41. package/dist/api/types/ExtractionAdvancedOptionsArrayCitationStrategy.d.ts +11 -0
  42. package/dist/api/types/ExtractionAdvancedOptionsArrayCitationStrategy.js +10 -0
  43. package/dist/api/types/ListProcessorsProcessor.d.ts +35 -0
  44. package/dist/api/types/ListProcessorsProcessor.js +5 -0
  45. package/dist/api/types/ListProcessorsProcessorVersion.d.ts +17 -0
  46. package/dist/api/types/ListProcessorsProcessorVersion.js +5 -0
  47. package/dist/api/types/ListProcessorsResponse.d.ts +14 -0
  48. package/dist/api/types/ListProcessorsResponse.js +5 -0
  49. package/dist/api/types/index.d.ts +4 -0
  50. package/dist/api/types/index.js +4 -0
  51. package/dist/version.d.ts +1 -1
  52. package/dist/version.js +1 -1
  53. package/package.json +1 -1
  54. package/reference.md +69 -0
  55. package/version.d.ts +1 -1
  56. package/version.js +1 -1
package/Client.js CHANGED
@@ -81,8 +81,8 @@ class ExtendClient {
81
81
  "x-extend-api-version": (_a = _options === null || _options === void 0 ? void 0 : _options.extendApiVersion) !== null && _a !== void 0 ? _a : "2025-04-21",
82
82
  "X-Fern-Language": "JavaScript",
83
83
  "X-Fern-SDK-Name": "extend-ai",
84
- "X-Fern-SDK-Version": "0.0.10",
85
- "User-Agent": "extend-ai/0.0.10",
84
+ "X-Fern-SDK-Version": "0.0.12",
85
+ "User-Agent": "extend-ai/0.0.12",
86
86
  "X-Fern-Runtime": core.RUNTIME.type,
87
87
  "X-Fern-Runtime-Version": core.RUNTIME.version,
88
88
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -2,8 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as errors from "../../errors/index";
5
- import * as Extend from "../index";
6
5
  import * as core from "../../core";
7
6
  export declare class InternalServerError extends errors.ExtendError {
8
- constructor(body: Extend.ExtendError, rawResponse?: core.RawResponse);
7
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
9
8
  }
@@ -2,8 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as errors from "../../errors/index";
5
- import * as Extend from "../index";
6
5
  import * as core from "../../core";
7
6
  export declare class TooManyRequestsError extends errors.ExtendError {
8
- constructor(body: Extend.TooManyRequestsErrorBody, rawResponse?: core.RawResponse);
7
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
9
8
  }
@@ -34,6 +34,28 @@ export declare namespace Processor {
34
34
  export declare class Processor {
35
35
  protected readonly _options: Processor.Options;
36
36
  constructor(_options?: Processor.Options);
37
+ /**
38
+ * List all processors in your organization
39
+ *
40
+ * @param {Extend.ProcessorListRequest} request
41
+ * @param {Processor.RequestOptions} requestOptions - Request-specific configuration.
42
+ *
43
+ * @throws {@link Extend.BadRequestError}
44
+ * @throws {@link Extend.UnauthorizedError}
45
+ * @throws {@link Extend.TooManyRequestsError}
46
+ * @throws {@link Extend.InternalServerError}
47
+ *
48
+ * @example
49
+ * await client.processor.list({
50
+ * type: "EXTRACT",
51
+ * nextPageToken: "nextPageToken",
52
+ * maxPageSize: 1,
53
+ * sortBy: "createdAt",
54
+ * sortDir: "asc"
55
+ * })
56
+ */
57
+ list(request?: Extend.ProcessorListRequest, requestOptions?: Processor.RequestOptions): core.HttpResponsePromise<Extend.ListProcessorsResponse>;
58
+ private __list;
37
59
  /**
38
60
  * Create a new processor in Extend, optionally cloning from an existing processor
39
61
  *
@@ -55,6 +55,100 @@ class Processor {
55
55
  constructor(_options = {}) {
56
56
  this._options = _options;
57
57
  }
58
+ /**
59
+ * List all processors in your organization
60
+ *
61
+ * @param {Extend.ProcessorListRequest} request
62
+ * @param {Processor.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link Extend.BadRequestError}
65
+ * @throws {@link Extend.UnauthorizedError}
66
+ * @throws {@link Extend.TooManyRequestsError}
67
+ * @throws {@link Extend.InternalServerError}
68
+ *
69
+ * @example
70
+ * await client.processor.list({
71
+ * type: "EXTRACT",
72
+ * nextPageToken: "nextPageToken",
73
+ * maxPageSize: 1,
74
+ * sortBy: "createdAt",
75
+ * sortDir: "asc"
76
+ * })
77
+ */
78
+ list(request = {}, requestOptions) {
79
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
80
+ }
81
+ __list() {
82
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
83
+ var _a, _b, _c, _d, _e;
84
+ const { type: type_, nextPageToken, maxPageSize, sortBy, sortDir } = request;
85
+ const _queryParams = {};
86
+ if (type_ != null) {
87
+ _queryParams["type"] = type_;
88
+ }
89
+ if (nextPageToken != null) {
90
+ _queryParams["nextPageToken"] = nextPageToken;
91
+ }
92
+ if (maxPageSize != null) {
93
+ _queryParams["maxPageSize"] = maxPageSize.toString();
94
+ }
95
+ if (sortBy != null) {
96
+ _queryParams["sortBy"] = sortBy;
97
+ }
98
+ if (sortDir != null) {
99
+ _queryParams["sortDir"] = sortDir;
100
+ }
101
+ let _headers = (0, headers_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
102
+ Authorization: yield this._getAuthorizationHeader(),
103
+ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2025-04-21",
104
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
105
+ const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
106
+ 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, "processors"),
107
+ method: "GET",
108
+ headers: _headers,
109
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
110
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
111
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
112
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
113
+ });
114
+ if (_response.ok) {
115
+ return { data: _response.body, rawResponse: _response.rawResponse };
116
+ }
117
+ if (_response.error.reason === "status-code") {
118
+ switch (_response.error.statusCode) {
119
+ case 400:
120
+ throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
121
+ case 401:
122
+ throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
123
+ case 429:
124
+ throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
125
+ case 500:
126
+ throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
127
+ default:
128
+ throw new errors.ExtendError({
129
+ statusCode: _response.error.statusCode,
130
+ body: _response.error.body,
131
+ rawResponse: _response.rawResponse,
132
+ });
133
+ }
134
+ }
135
+ switch (_response.error.reason) {
136
+ case "non-json":
137
+ throw new errors.ExtendError({
138
+ statusCode: _response.error.statusCode,
139
+ body: _response.error.rawBody,
140
+ rawResponse: _response.rawResponse,
141
+ });
142
+ case "timeout":
143
+ throw new errors.ExtendTimeoutError("Timeout exceeded when calling GET /processors.");
144
+ case "unknown":
145
+ throw new errors.ExtendError({
146
+ message: _response.error.errorMessage,
147
+ rawResponse: _response.rawResponse,
148
+ });
149
+ }
150
+ });
151
+ }
58
152
  /**
59
153
  * Create a new processor in Extend, optionally cloning from an existing processor
60
154
  *
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Extend from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {
8
+ * type: "EXTRACT",
9
+ * nextPageToken: "nextPageToken",
10
+ * maxPageSize: 1,
11
+ * sortBy: "createdAt",
12
+ * sortDir: "asc"
13
+ * }
14
+ */
15
+ export interface ProcessorListRequest {
16
+ /** Filter processors by type */
17
+ type?: Extend.ProcessorType;
18
+ /** Token for retrieving the next page of results */
19
+ nextPageToken?: string;
20
+ /** Maximum number of processors to return per page */
21
+ maxPageSize?: number;
22
+ /** Field to sort by */
23
+ sortBy?: Extend.ProcessorListRequestSortBy;
24
+ /** Sort direction */
25
+ sortDir?: Extend.ProcessorListRequestSortDir;
26
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,3 @@
1
+ export { type ProcessorListRequest } from "./ProcessorListRequest";
1
2
  export { type ProcessorCreateRequest } from "./ProcessorCreateRequest";
2
3
  export { type ProcessorUpdateRequest } from "./ProcessorUpdateRequest";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type ProcessorListRequestSortBy = "createdAt" | "updatedAt";
5
+ export declare const ProcessorListRequestSortBy: {
6
+ readonly CreatedAt: "createdAt";
7
+ readonly UpdatedAt: "updatedAt";
8
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ProcessorListRequestSortBy = void 0;
7
+ exports.ProcessorListRequestSortBy = {
8
+ CreatedAt: "createdAt",
9
+ UpdatedAt: "updatedAt",
10
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type ProcessorListRequestSortDir = "asc" | "desc";
5
+ export declare const ProcessorListRequestSortDir: {
6
+ readonly Asc: "asc";
7
+ readonly Desc: "desc";
8
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ProcessorListRequestSortDir = void 0;
7
+ exports.ProcessorListRequestSortDir = {
8
+ Asc: "asc",
9
+ Desc: "desc",
10
+ };
@@ -1,3 +1,5 @@
1
+ export * from "./ProcessorListRequestSortBy";
2
+ export * from "./ProcessorListRequestSortDir";
1
3
  export * from "./ProcessorCreateRequestConfig";
2
4
  export * from "./ProcessorCreateResponse";
3
5
  export * from "./ProcessorUpdateRequestConfig";
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ProcessorListRequestSortBy"), exports);
18
+ __exportStar(require("./ProcessorListRequestSortDir"), exports);
17
19
  __exportStar(require("./ProcessorCreateRequestConfig"), exports);
18
20
  __exportStar(require("./ProcessorCreateResponse"), exports);
19
21
  __exportStar(require("./ProcessorUpdateRequestConfig"), exports);
@@ -13,6 +13,8 @@ export interface ExtractionAdvancedOptions {
13
13
  advancedMultimodalEnabled?: boolean;
14
14
  /** Whether to enable citations in the output. */
15
15
  citationsEnabled?: boolean;
16
+ /** Granularity for array citations. This requires citationsEnabled=true and a base processor version that supports property-level array citations (extraction_performance ≥ 4.4.0). */
17
+ arrayCitationStrategy?: Extend.ExtractionAdvancedOptionsArrayCitationStrategy;
16
18
  /** Whether to enable advanced figure parsing. */
17
19
  advancedFigureParsingEnabled?: boolean;
18
20
  /** Strategy for handling large arrays in documents. */
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Granularity for array citations. This requires citationsEnabled=true and a base processor version that supports property-level array citations (extraction_performance ≥ 4.4.0).
6
+ */
7
+ export type ExtractionAdvancedOptionsArrayCitationStrategy = "item" | "property";
8
+ export declare const ExtractionAdvancedOptionsArrayCitationStrategy: {
9
+ readonly Item: "item";
10
+ readonly Property: "property";
11
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ExtractionAdvancedOptionsArrayCitationStrategy = void 0;
7
+ exports.ExtractionAdvancedOptionsArrayCitationStrategy = {
8
+ Item: "item",
9
+ Property: "property",
10
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Extend from "../index";
5
+ export interface ListProcessorsProcessor {
6
+ /** The type of response. In this case, it will always be `"document_processor"`. */
7
+ object: "document_processor";
8
+ /**
9
+ * The ID of the processor.
10
+ *
11
+ * Example: `"dp_Xj8mK2pL9nR4vT7qY5wZ"`
12
+ */
13
+ id: string;
14
+ /**
15
+ * The name of the processor.
16
+ *
17
+ * Example: `"Invoice Processor"`
18
+ */
19
+ name: string;
20
+ type: Extend.ProcessorType;
21
+ /** Array of all versions for this processor */
22
+ versions: Extend.ListProcessorsProcessorVersion[];
23
+ /**
24
+ * The time (in UTC) at which the processor was created. Will follow the RFC 3339 format.
25
+ *
26
+ * Example: `"2024-03-21T15:30:00Z"`
27
+ */
28
+ createdAt: string;
29
+ /**
30
+ * The time (in UTC) at which the processor was last updated. Will follow the RFC 3339 format.
31
+ *
32
+ * Example: `"2024-03-21T16:45:00Z"`
33
+ */
34
+ updatedAt: string;
35
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ListProcessorsProcessorVersion {
5
+ /**
6
+ * The unique identifier for this version of the document processor.
7
+ *
8
+ * Example: `"dpv_xK9mLPqRtN3vS8wF5hB2cQ"`
9
+ */
10
+ id: string;
11
+ /**
12
+ * The version number or identifier for this processor version.
13
+ *
14
+ * Example: `"3"`
15
+ */
16
+ version: string;
17
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Extend from "../index";
5
+ export interface ListProcessorsResponse {
6
+ /** Indicates the request was successful */
7
+ success: boolean;
8
+ /** Optional warning message */
9
+ warning?: string;
10
+ /** Array of processors */
11
+ processors: Extend.ListProcessorsProcessor[];
12
+ /** Token for retrieving the next page of results. Will be null if there are no more results. */
13
+ nextPageToken?: string;
14
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -89,6 +89,9 @@ export * from "./SortDirEnum";
89
89
  export * from "./NextPageToken";
90
90
  export * from "./MaxPageSize";
91
91
  export * from "./ProcessorType";
92
+ export * from "./ListProcessorsProcessorVersion";
93
+ export * from "./ListProcessorsProcessor";
94
+ export * from "./ListProcessorsResponse";
92
95
  export * from "./FileType";
93
96
  export * from "./FileContentsPagesItem";
94
97
  export * from "./FileContentsSheetsItem";
@@ -107,6 +110,7 @@ export * from "./ClassificationAdvancedOptionsContext";
107
110
  export * from "./ClassificationAdvancedOptions";
108
111
  export * from "./ExtractionConfigBaseProcessor";
109
112
  export * from "./ExtractionConfig";
113
+ export * from "./ExtractionAdvancedOptionsArrayCitationStrategy";
110
114
  export * from "./ExtractionAdvancedOptionsExcelSheetSelectionStrategy";
111
115
  export * from "./ExtractionAdvancedOptions";
112
116
  export * from "./ExtractChunkingOptionsChunkingStrategy";
@@ -105,6 +105,9 @@ __exportStar(require("./SortDirEnum"), exports);
105
105
  __exportStar(require("./NextPageToken"), exports);
106
106
  __exportStar(require("./MaxPageSize"), exports);
107
107
  __exportStar(require("./ProcessorType"), exports);
108
+ __exportStar(require("./ListProcessorsProcessorVersion"), exports);
109
+ __exportStar(require("./ListProcessorsProcessor"), exports);
110
+ __exportStar(require("./ListProcessorsResponse"), exports);
108
111
  __exportStar(require("./FileType"), exports);
109
112
  __exportStar(require("./FileContentsPagesItem"), exports);
110
113
  __exportStar(require("./FileContentsSheetsItem"), exports);
@@ -123,6 +126,7 @@ __exportStar(require("./ClassificationAdvancedOptionsContext"), exports);
123
126
  __exportStar(require("./ClassificationAdvancedOptions"), exports);
124
127
  __exportStar(require("./ExtractionConfigBaseProcessor"), exports);
125
128
  __exportStar(require("./ExtractionConfig"), exports);
129
+ __exportStar(require("./ExtractionAdvancedOptionsArrayCitationStrategy"), exports);
126
130
  __exportStar(require("./ExtractionAdvancedOptionsExcelSheetSelectionStrategy"), exports);
127
131
  __exportStar(require("./ExtractionAdvancedOptions"), exports);
128
132
  __exportStar(require("./ExtractChunkingOptionsChunkingStrategy"), exports);
package/dist/Client.js CHANGED
@@ -81,8 +81,8 @@ class ExtendClient {
81
81
  "x-extend-api-version": (_a = _options === null || _options === void 0 ? void 0 : _options.extendApiVersion) !== null && _a !== void 0 ? _a : "2025-04-21",
82
82
  "X-Fern-Language": "JavaScript",
83
83
  "X-Fern-SDK-Name": "extend-ai",
84
- "X-Fern-SDK-Version": "0.0.10",
85
- "User-Agent": "extend-ai/0.0.10",
84
+ "X-Fern-SDK-Version": "0.0.12",
85
+ "User-Agent": "extend-ai/0.0.12",
86
86
  "X-Fern-Runtime": core.RUNTIME.type,
87
87
  "X-Fern-Runtime-Version": core.RUNTIME.version,
88
88
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -2,8 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as errors from "../../errors/index";
5
- import * as Extend from "../index";
6
5
  import * as core from "../../core";
7
6
  export declare class InternalServerError extends errors.ExtendError {
8
- constructor(body: Extend.ExtendError, rawResponse?: core.RawResponse);
7
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
9
8
  }
@@ -2,8 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as errors from "../../errors/index";
5
- import * as Extend from "../index";
6
5
  import * as core from "../../core";
7
6
  export declare class TooManyRequestsError extends errors.ExtendError {
8
- constructor(body: Extend.TooManyRequestsErrorBody, rawResponse?: core.RawResponse);
7
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
9
8
  }
@@ -34,6 +34,28 @@ export declare namespace Processor {
34
34
  export declare class Processor {
35
35
  protected readonly _options: Processor.Options;
36
36
  constructor(_options?: Processor.Options);
37
+ /**
38
+ * List all processors in your organization
39
+ *
40
+ * @param {Extend.ProcessorListRequest} request
41
+ * @param {Processor.RequestOptions} requestOptions - Request-specific configuration.
42
+ *
43
+ * @throws {@link Extend.BadRequestError}
44
+ * @throws {@link Extend.UnauthorizedError}
45
+ * @throws {@link Extend.TooManyRequestsError}
46
+ * @throws {@link Extend.InternalServerError}
47
+ *
48
+ * @example
49
+ * await client.processor.list({
50
+ * type: "EXTRACT",
51
+ * nextPageToken: "nextPageToken",
52
+ * maxPageSize: 1,
53
+ * sortBy: "createdAt",
54
+ * sortDir: "asc"
55
+ * })
56
+ */
57
+ list(request?: Extend.ProcessorListRequest, requestOptions?: Processor.RequestOptions): core.HttpResponsePromise<Extend.ListProcessorsResponse>;
58
+ private __list;
37
59
  /**
38
60
  * Create a new processor in Extend, optionally cloning from an existing processor
39
61
  *
@@ -55,6 +55,100 @@ class Processor {
55
55
  constructor(_options = {}) {
56
56
  this._options = _options;
57
57
  }
58
+ /**
59
+ * List all processors in your organization
60
+ *
61
+ * @param {Extend.ProcessorListRequest} request
62
+ * @param {Processor.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link Extend.BadRequestError}
65
+ * @throws {@link Extend.UnauthorizedError}
66
+ * @throws {@link Extend.TooManyRequestsError}
67
+ * @throws {@link Extend.InternalServerError}
68
+ *
69
+ * @example
70
+ * await client.processor.list({
71
+ * type: "EXTRACT",
72
+ * nextPageToken: "nextPageToken",
73
+ * maxPageSize: 1,
74
+ * sortBy: "createdAt",
75
+ * sortDir: "asc"
76
+ * })
77
+ */
78
+ list(request = {}, requestOptions) {
79
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
80
+ }
81
+ __list() {
82
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
83
+ var _a, _b, _c, _d, _e;
84
+ const { type: type_, nextPageToken, maxPageSize, sortBy, sortDir } = request;
85
+ const _queryParams = {};
86
+ if (type_ != null) {
87
+ _queryParams["type"] = type_;
88
+ }
89
+ if (nextPageToken != null) {
90
+ _queryParams["nextPageToken"] = nextPageToken;
91
+ }
92
+ if (maxPageSize != null) {
93
+ _queryParams["maxPageSize"] = maxPageSize.toString();
94
+ }
95
+ if (sortBy != null) {
96
+ _queryParams["sortBy"] = sortBy;
97
+ }
98
+ if (sortDir != null) {
99
+ _queryParams["sortDir"] = sortDir;
100
+ }
101
+ let _headers = (0, headers_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
102
+ Authorization: yield this._getAuthorizationHeader(),
103
+ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2025-04-21",
104
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
105
+ const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
106
+ 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, "processors"),
107
+ method: "GET",
108
+ headers: _headers,
109
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
110
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 300000,
111
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
112
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
113
+ });
114
+ if (_response.ok) {
115
+ return { data: _response.body, rawResponse: _response.rawResponse };
116
+ }
117
+ if (_response.error.reason === "status-code") {
118
+ switch (_response.error.statusCode) {
119
+ case 400:
120
+ throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
121
+ case 401:
122
+ throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
123
+ case 429:
124
+ throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
125
+ case 500:
126
+ throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
127
+ default:
128
+ throw new errors.ExtendError({
129
+ statusCode: _response.error.statusCode,
130
+ body: _response.error.body,
131
+ rawResponse: _response.rawResponse,
132
+ });
133
+ }
134
+ }
135
+ switch (_response.error.reason) {
136
+ case "non-json":
137
+ throw new errors.ExtendError({
138
+ statusCode: _response.error.statusCode,
139
+ body: _response.error.rawBody,
140
+ rawResponse: _response.rawResponse,
141
+ });
142
+ case "timeout":
143
+ throw new errors.ExtendTimeoutError("Timeout exceeded when calling GET /processors.");
144
+ case "unknown":
145
+ throw new errors.ExtendError({
146
+ message: _response.error.errorMessage,
147
+ rawResponse: _response.rawResponse,
148
+ });
149
+ }
150
+ });
151
+ }
58
152
  /**
59
153
  * Create a new processor in Extend, optionally cloning from an existing processor
60
154
  *
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Extend from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {
8
+ * type: "EXTRACT",
9
+ * nextPageToken: "nextPageToken",
10
+ * maxPageSize: 1,
11
+ * sortBy: "createdAt",
12
+ * sortDir: "asc"
13
+ * }
14
+ */
15
+ export interface ProcessorListRequest {
16
+ /** Filter processors by type */
17
+ type?: Extend.ProcessorType;
18
+ /** Token for retrieving the next page of results */
19
+ nextPageToken?: string;
20
+ /** Maximum number of processors to return per page */
21
+ maxPageSize?: number;
22
+ /** Field to sort by */
23
+ sortBy?: Extend.ProcessorListRequestSortBy;
24
+ /** Sort direction */
25
+ sortDir?: Extend.ProcessorListRequestSortDir;
26
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,3 @@
1
+ export { type ProcessorListRequest } from "./ProcessorListRequest";
1
2
  export { type ProcessorCreateRequest } from "./ProcessorCreateRequest";
2
3
  export { type ProcessorUpdateRequest } from "./ProcessorUpdateRequest";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type ProcessorListRequestSortBy = "createdAt" | "updatedAt";
5
+ export declare const ProcessorListRequestSortBy: {
6
+ readonly CreatedAt: "createdAt";
7
+ readonly UpdatedAt: "updatedAt";
8
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ProcessorListRequestSortBy = void 0;
7
+ exports.ProcessorListRequestSortBy = {
8
+ CreatedAt: "createdAt",
9
+ UpdatedAt: "updatedAt",
10
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type ProcessorListRequestSortDir = "asc" | "desc";
5
+ export declare const ProcessorListRequestSortDir: {
6
+ readonly Asc: "asc";
7
+ readonly Desc: "desc";
8
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ProcessorListRequestSortDir = void 0;
7
+ exports.ProcessorListRequestSortDir = {
8
+ Asc: "asc",
9
+ Desc: "desc",
10
+ };
@@ -1,3 +1,5 @@
1
+ export * from "./ProcessorListRequestSortBy";
2
+ export * from "./ProcessorListRequestSortDir";
1
3
  export * from "./ProcessorCreateRequestConfig";
2
4
  export * from "./ProcessorCreateResponse";
3
5
  export * from "./ProcessorUpdateRequestConfig";
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ProcessorListRequestSortBy"), exports);
18
+ __exportStar(require("./ProcessorListRequestSortDir"), exports);
17
19
  __exportStar(require("./ProcessorCreateRequestConfig"), exports);
18
20
  __exportStar(require("./ProcessorCreateResponse"), exports);
19
21
  __exportStar(require("./ProcessorUpdateRequestConfig"), exports);
@@ -13,6 +13,8 @@ export interface ExtractionAdvancedOptions {
13
13
  advancedMultimodalEnabled?: boolean;
14
14
  /** Whether to enable citations in the output. */
15
15
  citationsEnabled?: boolean;
16
+ /** Granularity for array citations. This requires citationsEnabled=true and a base processor version that supports property-level array citations (extraction_performance ≥ 4.4.0). */
17
+ arrayCitationStrategy?: Extend.ExtractionAdvancedOptionsArrayCitationStrategy;
16
18
  /** Whether to enable advanced figure parsing. */
17
19
  advancedFigureParsingEnabled?: boolean;
18
20
  /** Strategy for handling large arrays in documents. */
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Granularity for array citations. This requires citationsEnabled=true and a base processor version that supports property-level array citations (extraction_performance ≥ 4.4.0).
6
+ */
7
+ export type ExtractionAdvancedOptionsArrayCitationStrategy = "item" | "property";
8
+ export declare const ExtractionAdvancedOptionsArrayCitationStrategy: {
9
+ readonly Item: "item";
10
+ readonly Property: "property";
11
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ExtractionAdvancedOptionsArrayCitationStrategy = void 0;
7
+ exports.ExtractionAdvancedOptionsArrayCitationStrategy = {
8
+ Item: "item",
9
+ Property: "property",
10
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Extend from "../index";
5
+ export interface ListProcessorsProcessor {
6
+ /** The type of response. In this case, it will always be `"document_processor"`. */
7
+ object: "document_processor";
8
+ /**
9
+ * The ID of the processor.
10
+ *
11
+ * Example: `"dp_Xj8mK2pL9nR4vT7qY5wZ"`
12
+ */
13
+ id: string;
14
+ /**
15
+ * The name of the processor.
16
+ *
17
+ * Example: `"Invoice Processor"`
18
+ */
19
+ name: string;
20
+ type: Extend.ProcessorType;
21
+ /** Array of all versions for this processor */
22
+ versions: Extend.ListProcessorsProcessorVersion[];
23
+ /**
24
+ * The time (in UTC) at which the processor was created. Will follow the RFC 3339 format.
25
+ *
26
+ * Example: `"2024-03-21T15:30:00Z"`
27
+ */
28
+ createdAt: string;
29
+ /**
30
+ * The time (in UTC) at which the processor was last updated. Will follow the RFC 3339 format.
31
+ *
32
+ * Example: `"2024-03-21T16:45:00Z"`
33
+ */
34
+ updatedAt: string;
35
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ListProcessorsProcessorVersion {
5
+ /**
6
+ * The unique identifier for this version of the document processor.
7
+ *
8
+ * Example: `"dpv_xK9mLPqRtN3vS8wF5hB2cQ"`
9
+ */
10
+ id: string;
11
+ /**
12
+ * The version number or identifier for this processor version.
13
+ *
14
+ * Example: `"3"`
15
+ */
16
+ version: string;
17
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Extend from "../index";
5
+ export interface ListProcessorsResponse {
6
+ /** Indicates the request was successful */
7
+ success: boolean;
8
+ /** Optional warning message */
9
+ warning?: string;
10
+ /** Array of processors */
11
+ processors: Extend.ListProcessorsProcessor[];
12
+ /** Token for retrieving the next page of results. Will be null if there are no more results. */
13
+ nextPageToken?: string;
14
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -89,6 +89,9 @@ export * from "./SortDirEnum";
89
89
  export * from "./NextPageToken";
90
90
  export * from "./MaxPageSize";
91
91
  export * from "./ProcessorType";
92
+ export * from "./ListProcessorsProcessorVersion";
93
+ export * from "./ListProcessorsProcessor";
94
+ export * from "./ListProcessorsResponse";
92
95
  export * from "./FileType";
93
96
  export * from "./FileContentsPagesItem";
94
97
  export * from "./FileContentsSheetsItem";
@@ -107,6 +110,7 @@ export * from "./ClassificationAdvancedOptionsContext";
107
110
  export * from "./ClassificationAdvancedOptions";
108
111
  export * from "./ExtractionConfigBaseProcessor";
109
112
  export * from "./ExtractionConfig";
113
+ export * from "./ExtractionAdvancedOptionsArrayCitationStrategy";
110
114
  export * from "./ExtractionAdvancedOptionsExcelSheetSelectionStrategy";
111
115
  export * from "./ExtractionAdvancedOptions";
112
116
  export * from "./ExtractChunkingOptionsChunkingStrategy";
@@ -105,6 +105,9 @@ __exportStar(require("./SortDirEnum"), exports);
105
105
  __exportStar(require("./NextPageToken"), exports);
106
106
  __exportStar(require("./MaxPageSize"), exports);
107
107
  __exportStar(require("./ProcessorType"), exports);
108
+ __exportStar(require("./ListProcessorsProcessorVersion"), exports);
109
+ __exportStar(require("./ListProcessorsProcessor"), exports);
110
+ __exportStar(require("./ListProcessorsResponse"), exports);
108
111
  __exportStar(require("./FileType"), exports);
109
112
  __exportStar(require("./FileContentsPagesItem"), exports);
110
113
  __exportStar(require("./FileContentsSheetsItem"), exports);
@@ -123,6 +126,7 @@ __exportStar(require("./ClassificationAdvancedOptionsContext"), exports);
123
126
  __exportStar(require("./ClassificationAdvancedOptions"), exports);
124
127
  __exportStar(require("./ExtractionConfigBaseProcessor"), exports);
125
128
  __exportStar(require("./ExtractionConfig"), exports);
129
+ __exportStar(require("./ExtractionAdvancedOptionsArrayCitationStrategy"), exports);
126
130
  __exportStar(require("./ExtractionAdvancedOptionsExcelSheetSelectionStrategy"), exports);
127
131
  __exportStar(require("./ExtractionAdvancedOptions"), exports);
128
132
  __exportStar(require("./ExtractChunkingOptionsChunkingStrategy"), exports);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.10";
1
+ export declare const SDK_VERSION = "0.0.12";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.10";
4
+ exports.SDK_VERSION = "0.0.12";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extend-ai",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "private": false,
5
5
  "repository": "github:extend-hq/extend-typescript-sdk",
6
6
  "main": "./index.js",
package/reference.md CHANGED
@@ -935,6 +935,75 @@ Example: `"dpr_Xj8mK2pL9nR4vT7qY5wZ"`
935
935
 
936
936
  ## Processor
937
937
 
938
+ <details><summary><code>client.processor.<a href="/src/api/resources/processor/client/Client.ts">list</a>({ ...params }) -> Extend.ListProcessorsResponse</code></summary>
939
+ <dl>
940
+ <dd>
941
+
942
+ #### 📝 Description
943
+
944
+ <dl>
945
+ <dd>
946
+
947
+ <dl>
948
+ <dd>
949
+
950
+ List all processors in your organization
951
+
952
+ </dd>
953
+ </dl>
954
+ </dd>
955
+ </dl>
956
+
957
+ #### 🔌 Usage
958
+
959
+ <dl>
960
+ <dd>
961
+
962
+ <dl>
963
+ <dd>
964
+
965
+ ```typescript
966
+ await client.processor.list({
967
+ type: "EXTRACT",
968
+ nextPageToken: "nextPageToken",
969
+ maxPageSize: 1,
970
+ sortBy: "createdAt",
971
+ sortDir: "asc",
972
+ });
973
+ ```
974
+
975
+ </dd>
976
+ </dl>
977
+ </dd>
978
+ </dl>
979
+
980
+ #### ⚙️ Parameters
981
+
982
+ <dl>
983
+ <dd>
984
+
985
+ <dl>
986
+ <dd>
987
+
988
+ **request:** `Extend.ProcessorListRequest`
989
+
990
+ </dd>
991
+ </dl>
992
+
993
+ <dl>
994
+ <dd>
995
+
996
+ **requestOptions:** `Processor.RequestOptions`
997
+
998
+ </dd>
999
+ </dl>
1000
+ </dd>
1001
+ </dl>
1002
+
1003
+ </dd>
1004
+ </dl>
1005
+ </details>
1006
+
938
1007
  <details><summary><code>client.processor.<a href="/src/api/resources/processor/client/Client.ts">create</a>({ ...params }) -> Extend.ProcessorCreateResponse</code></summary>
939
1008
  <dl>
940
1009
  <dd>
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.10";
1
+ export declare const SDK_VERSION = "0.0.12";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.10";
4
+ exports.SDK_VERSION = "0.0.12";