extend-ai 1.7.0 → 1.9.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.
Files changed (128) hide show
  1. package/BaseClient.js +2 -2
  2. package/Client.d.ts +3 -0
  3. package/Client.js +53 -48
  4. package/api/resources/batchRuns/client/Client.d.ts +50 -0
  5. package/api/resources/batchRuns/client/Client.js +143 -0
  6. package/api/resources/batchRuns/client/index.d.ts +1 -0
  7. package/api/resources/batchRuns/client/index.js +2 -0
  8. package/api/resources/batchRuns/index.d.ts +1 -0
  9. package/api/resources/batchRuns/index.js +17 -0
  10. package/api/resources/classifierVersions/client/Client.d.ts +6 -3
  11. package/api/resources/classifierVersions/client/Client.js +6 -3
  12. package/api/resources/classifyRuns/client/Client.d.ts +57 -0
  13. package/api/resources/classifyRuns/client/Client.js +111 -1
  14. package/api/resources/classifyRuns/client/requests/ClassifyRunsCreateBatchRequest.d.ts +38 -0
  15. package/api/resources/classifyRuns/client/requests/ClassifyRunsListRequest.d.ts +6 -0
  16. package/api/resources/classifyRuns/client/requests/index.d.ts +1 -0
  17. package/api/resources/classifyRuns/types/ClassifyRunsCreateBatchRequestClassifier.d.ts +11 -0
  18. package/api/resources/classifyRuns/types/ClassifyRunsCreateBatchRequestInputsItem.d.ts +6 -0
  19. package/api/resources/classifyRuns/types/ClassifyRunsCreateBatchRequestInputsItemFile.d.ts +5 -0
  20. package/api/resources/classifyRuns/types/index.d.ts +3 -0
  21. package/api/resources/classifyRuns/types/index.js +3 -0
  22. package/api/resources/extractRuns/client/Client.d.ts +57 -0
  23. package/api/resources/extractRuns/client/Client.js +111 -1
  24. package/api/resources/extractRuns/client/requests/ExtractRunsCreateBatchRequest.d.ts +38 -0
  25. package/api/resources/extractRuns/client/requests/ExtractRunsListRequest.d.ts +6 -0
  26. package/api/resources/extractRuns/client/requests/index.d.ts +1 -0
  27. package/api/resources/extractRuns/types/ExtractRunsCreateBatchRequestExtractor.d.ts +11 -0
  28. package/api/resources/extractRuns/types/ExtractRunsCreateBatchRequestInputsItem.d.ts +6 -0
  29. package/api/resources/extractRuns/types/ExtractRunsCreateBatchRequestInputsItem.js +3 -0
  30. package/api/resources/extractRuns/types/ExtractRunsCreateBatchRequestInputsItemFile.d.ts +5 -0
  31. package/api/resources/extractRuns/types/ExtractRunsCreateBatchRequestInputsItemFile.js +3 -0
  32. package/api/resources/extractRuns/types/index.d.ts +3 -0
  33. package/api/resources/extractRuns/types/index.js +3 -0
  34. package/api/resources/extractorVersions/client/Client.d.ts +6 -3
  35. package/api/resources/extractorVersions/client/Client.js +6 -3
  36. package/api/resources/index.d.ts +1 -0
  37. package/api/resources/index.js +2 -1
  38. package/api/resources/parseRuns/client/Client.d.ts +77 -0
  39. package/api/resources/parseRuns/client/Client.js +189 -0
  40. package/api/resources/parseRuns/client/requests/ParseRunsCreateBatchRequest.d.ts +35 -0
  41. package/api/resources/parseRuns/client/requests/ParseRunsCreateBatchRequest.js +3 -0
  42. package/api/resources/parseRuns/client/requests/ParseRunsListRequest.d.ts +27 -0
  43. package/api/resources/parseRuns/client/requests/ParseRunsListRequest.js +3 -0
  44. package/api/resources/parseRuns/client/requests/index.d.ts +2 -0
  45. package/api/resources/parseRuns/types/ParseRunsCreateBatchRequestInputsItem.d.ts +6 -0
  46. package/api/resources/parseRuns/types/ParseRunsCreateBatchRequestInputsItem.js +3 -0
  47. package/api/resources/parseRuns/types/ParseRunsCreateBatchRequestInputsItemFile.d.ts +5 -0
  48. package/api/resources/parseRuns/types/ParseRunsCreateBatchRequestInputsItemFile.js +3 -0
  49. package/api/resources/parseRuns/types/ParseRunsListRequestStatus.d.ts +7 -0
  50. package/api/resources/parseRuns/types/ParseRunsListRequestStatus.js +10 -0
  51. package/api/resources/parseRuns/types/ParseRunsListResponse.d.ts +6 -0
  52. package/api/resources/parseRuns/types/ParseRunsListResponse.js +3 -0
  53. package/api/resources/parseRuns/types/index.d.ts +4 -0
  54. package/api/resources/parseRuns/types/index.js +4 -0
  55. package/api/resources/splitRuns/client/Client.d.ts +58 -0
  56. package/api/resources/splitRuns/client/Client.js +112 -1
  57. package/api/resources/splitRuns/client/requests/SplitRunsCreateBatchRequest.d.ts +38 -0
  58. package/api/resources/splitRuns/client/requests/SplitRunsCreateBatchRequest.js +3 -0
  59. package/api/resources/splitRuns/client/requests/SplitRunsListRequest.d.ts +6 -0
  60. package/api/resources/splitRuns/client/requests/index.d.ts +1 -0
  61. package/api/resources/splitRuns/types/SplitRunsCreateBatchRequestInputsItem.d.ts +6 -0
  62. package/api/resources/splitRuns/types/SplitRunsCreateBatchRequestInputsItem.js +3 -0
  63. package/api/resources/splitRuns/types/SplitRunsCreateBatchRequestInputsItemFile.d.ts +5 -0
  64. package/api/resources/splitRuns/types/SplitRunsCreateBatchRequestInputsItemFile.js +3 -0
  65. package/api/resources/splitRuns/types/SplitRunsCreateBatchRequestSplitter.d.ts +11 -0
  66. package/api/resources/splitRuns/types/SplitRunsCreateBatchRequestSplitter.js +3 -0
  67. package/api/resources/splitRuns/types/index.d.ts +3 -0
  68. package/api/resources/splitRuns/types/index.js +3 -0
  69. package/api/resources/splitterVersions/client/Client.d.ts +6 -3
  70. package/api/resources/splitterVersions/client/Client.js +6 -3
  71. package/api/resources/workflowVersions/client/Client.d.ts +6 -6
  72. package/api/resources/workflowVersions/client/Client.js +6 -6
  73. package/api/types/BatchParseRunCompletedWebhookEvent.d.ts +6 -0
  74. package/api/types/BatchParseRunCompletedWebhookEvent.js +3 -0
  75. package/api/types/BatchParseRunFailedWebhookEvent.d.ts +6 -0
  76. package/api/types/BatchParseRunFailedWebhookEvent.js +3 -0
  77. package/api/types/BatchProcessorRunCompletedWebhookEvent.d.ts +6 -0
  78. package/api/types/BatchProcessorRunCompletedWebhookEvent.js +3 -0
  79. package/api/types/BatchProcessorRunFailedWebhookEvent.d.ts +6 -0
  80. package/api/types/BatchProcessorRunFailedWebhookEvent.js +3 -0
  81. package/api/types/BatchRun.d.ts +9 -16
  82. package/api/types/BatchRunStatus.d.ts +7 -5
  83. package/api/types/BatchRunStatus.js +7 -5
  84. package/api/types/Block.d.ts +1 -0
  85. package/api/types/BlockDetails.d.ts +1 -1
  86. package/api/types/BlockType.d.ts +2 -0
  87. package/api/types/BlockType.js +2 -0
  88. package/api/types/FormulaDetails.d.ts +9 -0
  89. package/api/types/FormulaDetails.js +3 -0
  90. package/api/types/LegacyListProcessorsResponse.d.ts +1 -1
  91. package/api/types/ParseConfigAdvancedOptions.d.ts +10 -0
  92. package/api/types/ParseConfigAdvancedOptionsFormattingDetectionItem.d.ts +8 -0
  93. package/api/types/ParseConfigAdvancedOptionsFormattingDetectionItem.js +3 -0
  94. package/api/types/ParseConfigBlockOptions.d.ts +2 -0
  95. package/api/types/ParseConfigBlockOptionsFormulas.d.ts +7 -0
  96. package/api/types/ParseConfigBlockOptionsFormulas.js +3 -0
  97. package/api/types/ParseRun.d.ts +10 -1
  98. package/api/types/ParseRunStatusEnum.d.ts +2 -0
  99. package/api/types/ParseRunStatusEnum.js +2 -0
  100. package/api/types/ProcessorRunStatus.d.ts +2 -0
  101. package/api/types/ProcessorRunStatus.js +2 -0
  102. package/api/types/WebhookEndpointEventType.d.ts +4 -0
  103. package/api/types/WebhookEndpointEventType.js +4 -0
  104. package/api/types/WebhookEvent.d.ts +13 -1
  105. package/api/types/WebhookSubscriptionEventType.d.ts +5 -3
  106. package/api/types/WebhookSubscriptionEventType.js +5 -3
  107. package/api/types/index.d.ts +7 -8
  108. package/api/types/index.js +7 -8
  109. package/package.json +1 -1
  110. package/reference.md +574 -15
  111. package/version.d.ts +1 -1
  112. package/version.js +1 -1
  113. package/api/types/BatchProcessorRun.d.ts +0 -66
  114. package/api/types/BatchProcessorRunMetrics.d.ts +0 -6
  115. package/api/types/BatchProcessorRunOptions.d.ts +0 -9
  116. package/api/types/BatchProcessorRunSource.d.ts +0 -12
  117. package/api/types/BatchProcessorRunSource.js +0 -15
  118. package/api/types/BatchProcessorRunStatus.d.ts +0 -14
  119. package/api/types/BatchProcessorRunStatus.js +0 -17
  120. package/api/types/BatchRunEntity.d.ts +0 -18
  121. package/api/types/BatchRunEntityVersion.d.ts +0 -18
  122. package/api/types/BatchRunMetrics.d.ts +0 -6
  123. /package/api/{types/BatchProcessorRun.js → resources/classifyRuns/client/requests/ClassifyRunsCreateBatchRequest.js} +0 -0
  124. /package/api/{types/BatchProcessorRunMetrics.js → resources/classifyRuns/types/ClassifyRunsCreateBatchRequestClassifier.js} +0 -0
  125. /package/api/{types/BatchProcessorRunOptions.js → resources/classifyRuns/types/ClassifyRunsCreateBatchRequestInputsItem.js} +0 -0
  126. /package/api/{types/BatchRunEntity.js → resources/classifyRuns/types/ClassifyRunsCreateBatchRequestInputsItemFile.js} +0 -0
  127. /package/api/{types/BatchRunEntityVersion.js → resources/extractRuns/client/requests/ExtractRunsCreateBatchRequest.js} +0 -0
  128. /package/api/{types/BatchRunMetrics.js → resources/extractRuns/types/ExtractRunsCreateBatchRequestExtractor.js} +0 -0
@@ -10,6 +10,30 @@ export declare namespace ParseRunsClient {
10
10
  export declare class ParseRunsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<ParseRunsClient.Options>;
12
12
  constructor(options: ParseRunsClient.Options);
13
+ /**
14
+ * List parse runs, with optional filters for status, batch ID, and file name.
15
+ *
16
+ * Returns a paginated list of parse runs. Use `GET /parse_runs/{id}` to retrieve the full result including output for a specific run.
17
+ *
18
+ * @param {Extend.ParseRunsListRequest} request
19
+ * @param {ParseRunsClient.RequestOptions} requestOptions - Request-specific configuration.
20
+ *
21
+ * @throws {@link Extend.BadRequestError}
22
+ * @throws {@link Extend.UnauthorizedError}
23
+ * @throws {@link Extend.PaymentRequiredError}
24
+ * @throws {@link Extend.ForbiddenError}
25
+ * @throws {@link Extend.NotFoundError}
26
+ * @throws {@link Extend.UnprocessableEntityError}
27
+ * @throws {@link Extend.TooManyRequestsError}
28
+ * @throws {@link Extend.InternalServerError}
29
+ *
30
+ * @example
31
+ * await client.parseRuns.list({
32
+ * nextPageToken: "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
33
+ * })
34
+ */
35
+ list(request?: Extend.ParseRunsListRequest, requestOptions?: ParseRunsClient.RequestOptions): core.HttpResponsePromise<Extend.ParseRunsListResponse>;
36
+ private __list;
13
37
  /**
14
38
  * Parse files to get cleaned, chunked target content (e.g. markdown).
15
39
  *
@@ -89,4 +113,57 @@ export declare class ParseRunsClient {
89
113
  */
90
114
  delete(id: string, request?: Extend.ParseRunsDeleteRequest, requestOptions?: ParseRunsClient.RequestOptions): core.HttpResponsePromise<Extend.ParseRunsDeleteResponse>;
91
115
  private __delete;
116
+ /**
117
+ * Submit up to **1,000 files** for parsing in a single request. Each file is processed as an independent parse run using the same configuration.
118
+ *
119
+ * Unlike the single [Parse File (Async)](https://docs.extend.ai/2026-02-09/developers/api-reference/endpoints/parse/create-parse-run) endpoint, this batch endpoint accepts an `inputs` array and immediately returns a `BatchRun` object containing a batch `id` and a `PENDING` status. The individual runs are then queued and processed asynchronously.
120
+ *
121
+ * **Monitoring results:**
122
+ * - **Webhooks (recommended):** Subscribe to `batch_parse_run.processed` and `batch_parse_run.failed` events. The webhook payload indicates the batch has finished — fetch individual run results using `GET /parse_runs?batchId={id}`.
123
+ * - **Polling:** Call `GET /batch_runs/{id}` to check the overall batch status, and use `GET /parse_runs?batchId={id}` to retrieve individual run results.
124
+ *
125
+ * **Notes:**
126
+ * - `inputs` must contain between 1 and 1,000 items.
127
+ * - File input supports URLs, Extend file IDs, and raw text strings.
128
+ *
129
+ * @param {Extend.ParseRunsCreateBatchRequest} request
130
+ * @param {ParseRunsClient.RequestOptions} requestOptions - Request-specific configuration.
131
+ *
132
+ * @throws {@link Extend.BadRequestError}
133
+ * @throws {@link Extend.UnauthorizedError}
134
+ * @throws {@link Extend.PaymentRequiredError}
135
+ * @throws {@link Extend.ForbiddenError}
136
+ * @throws {@link Extend.NotFoundError}
137
+ * @throws {@link Extend.UnprocessableEntityError}
138
+ * @throws {@link Extend.TooManyRequestsError}
139
+ * @throws {@link Extend.InternalServerError}
140
+ *
141
+ * @example
142
+ * await client.parseRuns.createBatch({
143
+ * inputs: [{
144
+ * file: {
145
+ * url: "https://example.com/document1.pdf"
146
+ * },
147
+ * metadata: {
148
+ * "customerId": "cust_abc123"
149
+ * }
150
+ * }, {
151
+ * file: {
152
+ * url: "https://example.com/document2.pdf"
153
+ * },
154
+ * metadata: {
155
+ * "customerId": "cust_def456"
156
+ * }
157
+ * }, {
158
+ * file: {
159
+ * text: "This is some raw text to parse."
160
+ * },
161
+ * metadata: {
162
+ * "source": "manual-entry"
163
+ * }
164
+ * }]
165
+ * })
166
+ */
167
+ createBatch(request: Extend.ParseRunsCreateBatchRequest, requestOptions?: ParseRunsClient.RequestOptions): core.HttpResponsePromise<Extend.BatchRun>;
168
+ private __createBatch;
92
169
  }
@@ -55,6 +55,90 @@ class ParseRunsClient {
55
55
  constructor(options) {
56
56
  this._options = (0, BaseClient_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
+ /**
59
+ * List parse runs, with optional filters for status, batch ID, and file name.
60
+ *
61
+ * Returns a paginated list of parse runs. Use `GET /parse_runs/{id}` to retrieve the full result including output for a specific run.
62
+ *
63
+ * @param {Extend.ParseRunsListRequest} request
64
+ * @param {ParseRunsClient.RequestOptions} requestOptions - Request-specific configuration.
65
+ *
66
+ * @throws {@link Extend.BadRequestError}
67
+ * @throws {@link Extend.UnauthorizedError}
68
+ * @throws {@link Extend.PaymentRequiredError}
69
+ * @throws {@link Extend.ForbiddenError}
70
+ * @throws {@link Extend.NotFoundError}
71
+ * @throws {@link Extend.UnprocessableEntityError}
72
+ * @throws {@link Extend.TooManyRequestsError}
73
+ * @throws {@link Extend.InternalServerError}
74
+ *
75
+ * @example
76
+ * await client.parseRuns.list({
77
+ * nextPageToken: "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
78
+ * })
79
+ */
80
+ list(request = {}, requestOptions) {
81
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
82
+ }
83
+ __list() {
84
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
85
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
86
+ const { status, batchId, fileNameContains, nextPageToken, maxPageSize, "x-extend-workspace-id": extendWorkspaceId, } = request;
87
+ const _queryParams = {
88
+ status: status != null ? status : undefined,
89
+ batchId,
90
+ fileNameContains,
91
+ nextPageToken,
92
+ maxPageSize,
93
+ };
94
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
95
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
96
+ "x-extend-workspace-id": extendWorkspaceId,
97
+ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09",
98
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
99
+ const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
100
+ 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, "parse_runs"),
101
+ method: "GET",
102
+ headers: _headers,
103
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
104
+ timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
105
+ maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
106
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
107
+ fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
108
+ logging: this._options.logging,
109
+ });
110
+ if (_response.ok) {
111
+ return { data: _response.body, rawResponse: _response.rawResponse };
112
+ }
113
+ if (_response.error.reason === "status-code") {
114
+ switch (_response.error.statusCode) {
115
+ case 400:
116
+ throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
117
+ case 401:
118
+ throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
119
+ case 402:
120
+ throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
121
+ case 403:
122
+ throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
123
+ case 404:
124
+ throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
125
+ case 422:
126
+ throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
127
+ case 429:
128
+ throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
129
+ case 500:
130
+ throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
131
+ default:
132
+ throw new errors.ExtendError({
133
+ statusCode: _response.error.statusCode,
134
+ body: _response.error.body,
135
+ rawResponse: _response.rawResponse,
136
+ });
137
+ }
138
+ }
139
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/parse_runs");
140
+ });
141
+ }
58
142
  /**
59
143
  * Parse files to get cleaned, chunked target content (e.g. markdown).
60
144
  *
@@ -295,5 +379,110 @@ class ParseRunsClient {
295
379
  return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/parse_runs/{id}");
296
380
  });
297
381
  }
382
+ /**
383
+ * Submit up to **1,000 files** for parsing in a single request. Each file is processed as an independent parse run using the same configuration.
384
+ *
385
+ * Unlike the single [Parse File (Async)](https://docs.extend.ai/2026-02-09/developers/api-reference/endpoints/parse/create-parse-run) endpoint, this batch endpoint accepts an `inputs` array and immediately returns a `BatchRun` object containing a batch `id` and a `PENDING` status. The individual runs are then queued and processed asynchronously.
386
+ *
387
+ * **Monitoring results:**
388
+ * - **Webhooks (recommended):** Subscribe to `batch_parse_run.processed` and `batch_parse_run.failed` events. The webhook payload indicates the batch has finished — fetch individual run results using `GET /parse_runs?batchId={id}`.
389
+ * - **Polling:** Call `GET /batch_runs/{id}` to check the overall batch status, and use `GET /parse_runs?batchId={id}` to retrieve individual run results.
390
+ *
391
+ * **Notes:**
392
+ * - `inputs` must contain between 1 and 1,000 items.
393
+ * - File input supports URLs, Extend file IDs, and raw text strings.
394
+ *
395
+ * @param {Extend.ParseRunsCreateBatchRequest} request
396
+ * @param {ParseRunsClient.RequestOptions} requestOptions - Request-specific configuration.
397
+ *
398
+ * @throws {@link Extend.BadRequestError}
399
+ * @throws {@link Extend.UnauthorizedError}
400
+ * @throws {@link Extend.PaymentRequiredError}
401
+ * @throws {@link Extend.ForbiddenError}
402
+ * @throws {@link Extend.NotFoundError}
403
+ * @throws {@link Extend.UnprocessableEntityError}
404
+ * @throws {@link Extend.TooManyRequestsError}
405
+ * @throws {@link Extend.InternalServerError}
406
+ *
407
+ * @example
408
+ * await client.parseRuns.createBatch({
409
+ * inputs: [{
410
+ * file: {
411
+ * url: "https://example.com/document1.pdf"
412
+ * },
413
+ * metadata: {
414
+ * "customerId": "cust_abc123"
415
+ * }
416
+ * }, {
417
+ * file: {
418
+ * url: "https://example.com/document2.pdf"
419
+ * },
420
+ * metadata: {
421
+ * "customerId": "cust_def456"
422
+ * }
423
+ * }, {
424
+ * file: {
425
+ * text: "This is some raw text to parse."
426
+ * },
427
+ * metadata: {
428
+ * "source": "manual-entry"
429
+ * }
430
+ * }]
431
+ * })
432
+ */
433
+ createBatch(request, requestOptions) {
434
+ return core.HttpResponsePromise.fromPromise(this.__createBatch(request, requestOptions));
435
+ }
436
+ __createBatch(request, requestOptions) {
437
+ return __awaiter(this, void 0, void 0, function* () {
438
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
439
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
440
+ 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);
441
+ const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
442
+ 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, "parse_runs/batch"),
443
+ method: "POST",
444
+ headers: _headers,
445
+ contentType: "application/json",
446
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
447
+ requestType: "json",
448
+ body: request,
449
+ timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
450
+ maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
451
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
452
+ fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
453
+ logging: this._options.logging,
454
+ });
455
+ if (_response.ok) {
456
+ return { data: _response.body, rawResponse: _response.rawResponse };
457
+ }
458
+ if (_response.error.reason === "status-code") {
459
+ switch (_response.error.statusCode) {
460
+ case 400:
461
+ throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
462
+ case 401:
463
+ throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
464
+ case 402:
465
+ throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
466
+ case 403:
467
+ throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
468
+ case 404:
469
+ throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
470
+ case 422:
471
+ throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
472
+ case 429:
473
+ throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
474
+ case 500:
475
+ throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
476
+ default:
477
+ throw new errors.ExtendError({
478
+ statusCode: _response.error.statusCode,
479
+ body: _response.error.body,
480
+ rawResponse: _response.rawResponse,
481
+ });
482
+ }
483
+ }
484
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/parse_runs/batch");
485
+ });
486
+ }
298
487
  }
299
488
  exports.ParseRunsClient = ParseRunsClient;
@@ -0,0 +1,35 @@
1
+ import type * as Extend from "../../../../index";
2
+ /**
3
+ * @example
4
+ * {
5
+ * inputs: [{
6
+ * file: {
7
+ * url: "https://example.com/document1.pdf"
8
+ * },
9
+ * metadata: {
10
+ * "customerId": "cust_abc123"
11
+ * }
12
+ * }, {
13
+ * file: {
14
+ * url: "https://example.com/document2.pdf"
15
+ * },
16
+ * metadata: {
17
+ * "customerId": "cust_def456"
18
+ * }
19
+ * }, {
20
+ * file: {
21
+ * text: "This is some raw text to parse."
22
+ * },
23
+ * metadata: {
24
+ * "source": "manual-entry"
25
+ * }
26
+ * }]
27
+ * }
28
+ */
29
+ export interface ParseRunsCreateBatchRequest {
30
+ /** An array of inputs to parse. Each item produces one parse run. Must contain between 1 and 1,000 items. */
31
+ inputs: Extend.ParseRunsCreateBatchRequestInputsItem[];
32
+ /** Optional parsing configuration applied to every run in this batch. If omitted, default parse settings are used. */
33
+ config?: Extend.ParseConfig;
34
+ priority?: Extend.RunPriority;
35
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,27 @@
1
+ import type * as Extend from "../../../../index";
2
+ /**
3
+ * @example
4
+ * {
5
+ * nextPageToken: "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
6
+ * }
7
+ */
8
+ export interface ParseRunsListRequest {
9
+ /** Filter parse runs by status. */
10
+ status?: Extend.ParseRunsListRequestStatus;
11
+ /**
12
+ * Filter parse runs by the batch they belong to. Use this after submitting a batch via `POST /parse_runs/batch` to retrieve individual run results.
13
+ *
14
+ * Example: `"bpar_Xj8mK2pL9nR4vT7qY5wZ"`
15
+ */
16
+ batchId?: string;
17
+ /**
18
+ * Filters runs by the name of the file. Only returns runs where the file name contains this string.
19
+ *
20
+ * Example: `"invoice"`
21
+ */
22
+ fileNameContains?: string;
23
+ nextPageToken?: Extend.NextPageToken;
24
+ maxPageSize?: Extend.MaxPageSize;
25
+ /** The workspace ID to target. **Required** when using an organization-scoped API key; optional for workspace-scoped keys (the key is already tied to a workspace). See [Authentication](https://docs.extend.ai/2026-02-09/developers/authentication) for details on API key scopes. */
26
+ "x-extend-workspace-id"?: string;
27
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,5 @@
1
+ export type { ParseRunsCreateBatchRequest } from "./ParseRunsCreateBatchRequest";
1
2
  export type { ParseRunsCreateRequest } from "./ParseRunsCreateRequest";
2
3
  export type { ParseRunsDeleteRequest } from "./ParseRunsDeleteRequest";
4
+ export type { ParseRunsListRequest } from "./ParseRunsListRequest";
3
5
  export type { ParseRunsRetrieveRequest } from "./ParseRunsRetrieveRequest";
@@ -0,0 +1,6 @@
1
+ import type * as Extend from "../../../index";
2
+ export interface ParseRunsCreateBatchRequestInputsItem {
3
+ /** The file to parse. Can be a URL, an Extend file ID, or raw text. */
4
+ file: Extend.ParseRunsCreateBatchRequestInputsItemFile;
5
+ metadata?: Extend.RunMetadata;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import type * as Extend from "../../../index";
2
+ /**
3
+ * The file to parse. Can be a URL, an Extend file ID, or raw text.
4
+ */
5
+ export type ParseRunsCreateBatchRequestInputsItemFile = Extend.FileFromUrl | Extend.FileFromId | Extend.FileFromText;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export declare const ParseRunsListRequestStatus: {
2
+ readonly Pending: "PENDING";
3
+ readonly Processing: "PROCESSING";
4
+ readonly Processed: "PROCESSED";
5
+ readonly Failed: "FAILED";
6
+ };
7
+ export type ParseRunsListRequestStatus = (typeof ParseRunsListRequestStatus)[keyof typeof ParseRunsListRequestStatus] | string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ParseRunsListRequestStatus = void 0;
5
+ exports.ParseRunsListRequestStatus = {
6
+ Pending: "PENDING",
7
+ Processing: "PROCESSING",
8
+ Processed: "PROCESSED",
9
+ Failed: "FAILED",
10
+ };
@@ -0,0 +1,6 @@
1
+ import type * as Extend from "../../../index";
2
+ export interface ParseRunsListResponse {
3
+ object: "list";
4
+ data: Extend.ParseRun[];
5
+ nextPageToken?: Extend.NextPageToken;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,7 @@
1
+ export * from "./ParseRunsCreateBatchRequestInputsItem";
2
+ export * from "./ParseRunsCreateBatchRequestInputsItemFile";
1
3
  export * from "./ParseRunsCreateRequestFile";
2
4
  export * from "./ParseRunsDeleteResponse";
5
+ export * from "./ParseRunsListRequestStatus";
6
+ export * from "./ParseRunsListResponse";
3
7
  export * from "./ParseRunsRetrieveRequestResponseType";
@@ -14,6 +14,10 @@ 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("./ParseRunsCreateBatchRequestInputsItem"), exports);
18
+ __exportStar(require("./ParseRunsCreateBatchRequestInputsItemFile"), exports);
17
19
  __exportStar(require("./ParseRunsCreateRequestFile"), exports);
18
20
  __exportStar(require("./ParseRunsDeleteResponse"), exports);
21
+ __exportStar(require("./ParseRunsListRequestStatus"), exports);
22
+ __exportStar(require("./ParseRunsListResponse"), exports);
19
23
  __exportStar(require("./ParseRunsRetrieveRequestResponseType"), exports);
@@ -136,4 +136,62 @@ export declare class SplitRunsClient {
136
136
  */
137
137
  cancel(id: string, request?: Extend.SplitRunsCancelRequest, requestOptions?: SplitRunsClient.RequestOptions): core.HttpResponsePromise<Extend.SplitRun>;
138
138
  private __cancel;
139
+ /**
140
+ * Submit up to **1,000 files** for splitting in a single request. Each file is processed as an independent split run using the same splitter and configuration.
141
+ *
142
+ * Unlike the single [Split File (Async)](https://docs.extend.ai/2026-02-09/developers/api-reference/endpoints/split/create-split-run) endpoint, this batch endpoint accepts an `inputs` array and immediately returns a `BatchRun` object containing a batch `id` and a `PENDING` status. The individual runs are then queued and processed asynchronously.
143
+ *
144
+ * **Monitoring results:**
145
+ * - **Webhooks (recommended):** Subscribe to `batch_processor_run.processed` and `batch_processor_run.failed` events. The webhook payload indicates the batch has finished — fetch individual run results using `GET /split_runs?batchId={id}`.
146
+ * - **Polling:** Call `GET /batch_runs/{id}` to check the overall batch status, and use `GET /split_runs` filtered by `batchId` to retrieve individual run results.
147
+ *
148
+ * **Notes:**
149
+ * - A processor reference (`splitter.id`) is required — inline `config` is not supported for batch requests.
150
+ * - `inputs` must contain between 1 and 1,000 items.
151
+ * - All inputs in a batch use the same splitter version and override config.
152
+ * - Raw text input (`FileFromText`) is not supported for split runs. Use a URL or file ID.
153
+ *
154
+ * @param {Extend.SplitRunsCreateBatchRequest} request
155
+ * @param {SplitRunsClient.RequestOptions} requestOptions - Request-specific configuration.
156
+ *
157
+ * @throws {@link Extend.BadRequestError}
158
+ * @throws {@link Extend.UnauthorizedError}
159
+ * @throws {@link Extend.PaymentRequiredError}
160
+ * @throws {@link Extend.ForbiddenError}
161
+ * @throws {@link Extend.NotFoundError}
162
+ * @throws {@link Extend.UnprocessableEntityError}
163
+ * @throws {@link Extend.TooManyRequestsError}
164
+ * @throws {@link Extend.InternalServerError}
165
+ *
166
+ * @example
167
+ * await client.splitRuns.createBatch({
168
+ * splitter: {
169
+ * id: "spl_xK9mLPqRtN3vS8wF5hB2cQ"
170
+ * },
171
+ * inputs: [{
172
+ * file: {
173
+ * url: "https://example.com/multi-doc1.pdf"
174
+ * },
175
+ * metadata: {
176
+ * "customerId": "cust_abc123"
177
+ * }
178
+ * }, {
179
+ * file: {
180
+ * url: "https://example.com/multi-doc2.pdf"
181
+ * },
182
+ * metadata: {
183
+ * "customerId": "cust_def456"
184
+ * }
185
+ * }, {
186
+ * file: {
187
+ * url: "https://example.com/multi-doc3.pdf"
188
+ * },
189
+ * metadata: {
190
+ * "customerId": "cust_ghi789"
191
+ * }
192
+ * }]
193
+ * })
194
+ */
195
+ createBatch(request: Extend.SplitRunsCreateBatchRequest, requestOptions?: SplitRunsClient.RequestOptions): core.HttpResponsePromise<Extend.BatchRun>;
196
+ private __createBatch;
139
197
  }
@@ -83,10 +83,11 @@ class SplitRunsClient {
83
83
  __list() {
84
84
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
85
85
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
86
- const { status, splitterId, sourceId, source, fileNameContains, sortBy, sortDir, nextPageToken, maxPageSize, "x-extend-workspace-id": extendWorkspaceId, } = request;
86
+ const { status, splitterId, batchId, sourceId, source, fileNameContains, sortBy, sortDir, nextPageToken, maxPageSize, "x-extend-workspace-id": extendWorkspaceId, } = request;
87
87
  const _queryParams = {
88
88
  status: status != null ? status : undefined,
89
89
  splitterId,
90
+ batchId,
90
91
  sourceId,
91
92
  source: source != null ? source : undefined,
92
93
  fileNameContains,
@@ -456,5 +457,115 @@ class SplitRunsClient {
456
457
  return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/split_runs/{id}/cancel");
457
458
  });
458
459
  }
460
+ /**
461
+ * Submit up to **1,000 files** for splitting in a single request. Each file is processed as an independent split run using the same splitter and configuration.
462
+ *
463
+ * Unlike the single [Split File (Async)](https://docs.extend.ai/2026-02-09/developers/api-reference/endpoints/split/create-split-run) endpoint, this batch endpoint accepts an `inputs` array and immediately returns a `BatchRun` object containing a batch `id` and a `PENDING` status. The individual runs are then queued and processed asynchronously.
464
+ *
465
+ * **Monitoring results:**
466
+ * - **Webhooks (recommended):** Subscribe to `batch_processor_run.processed` and `batch_processor_run.failed` events. The webhook payload indicates the batch has finished — fetch individual run results using `GET /split_runs?batchId={id}`.
467
+ * - **Polling:** Call `GET /batch_runs/{id}` to check the overall batch status, and use `GET /split_runs` filtered by `batchId` to retrieve individual run results.
468
+ *
469
+ * **Notes:**
470
+ * - A processor reference (`splitter.id`) is required — inline `config` is not supported for batch requests.
471
+ * - `inputs` must contain between 1 and 1,000 items.
472
+ * - All inputs in a batch use the same splitter version and override config.
473
+ * - Raw text input (`FileFromText`) is not supported for split runs. Use a URL or file ID.
474
+ *
475
+ * @param {Extend.SplitRunsCreateBatchRequest} request
476
+ * @param {SplitRunsClient.RequestOptions} requestOptions - Request-specific configuration.
477
+ *
478
+ * @throws {@link Extend.BadRequestError}
479
+ * @throws {@link Extend.UnauthorizedError}
480
+ * @throws {@link Extend.PaymentRequiredError}
481
+ * @throws {@link Extend.ForbiddenError}
482
+ * @throws {@link Extend.NotFoundError}
483
+ * @throws {@link Extend.UnprocessableEntityError}
484
+ * @throws {@link Extend.TooManyRequestsError}
485
+ * @throws {@link Extend.InternalServerError}
486
+ *
487
+ * @example
488
+ * await client.splitRuns.createBatch({
489
+ * splitter: {
490
+ * id: "spl_xK9mLPqRtN3vS8wF5hB2cQ"
491
+ * },
492
+ * inputs: [{
493
+ * file: {
494
+ * url: "https://example.com/multi-doc1.pdf"
495
+ * },
496
+ * metadata: {
497
+ * "customerId": "cust_abc123"
498
+ * }
499
+ * }, {
500
+ * file: {
501
+ * url: "https://example.com/multi-doc2.pdf"
502
+ * },
503
+ * metadata: {
504
+ * "customerId": "cust_def456"
505
+ * }
506
+ * }, {
507
+ * file: {
508
+ * url: "https://example.com/multi-doc3.pdf"
509
+ * },
510
+ * metadata: {
511
+ * "customerId": "cust_ghi789"
512
+ * }
513
+ * }]
514
+ * })
515
+ */
516
+ createBatch(request, requestOptions) {
517
+ return core.HttpResponsePromise.fromPromise(this.__createBatch(request, requestOptions));
518
+ }
519
+ __createBatch(request, requestOptions) {
520
+ return __awaiter(this, void 0, void 0, function* () {
521
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
522
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
523
+ 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);
524
+ const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
525
+ 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, "split_runs/batch"),
526
+ method: "POST",
527
+ headers: _headers,
528
+ contentType: "application/json",
529
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
530
+ requestType: "json",
531
+ body: request,
532
+ timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
533
+ maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
534
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
535
+ fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
536
+ logging: this._options.logging,
537
+ });
538
+ if (_response.ok) {
539
+ return { data: _response.body, rawResponse: _response.rawResponse };
540
+ }
541
+ if (_response.error.reason === "status-code") {
542
+ switch (_response.error.statusCode) {
543
+ case 400:
544
+ throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
545
+ case 401:
546
+ throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
547
+ case 402:
548
+ throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
549
+ case 403:
550
+ throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
551
+ case 404:
552
+ throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
553
+ case 422:
554
+ throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
555
+ case 429:
556
+ throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
557
+ case 500:
558
+ throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
559
+ default:
560
+ throw new errors.ExtendError({
561
+ statusCode: _response.error.statusCode,
562
+ body: _response.error.body,
563
+ rawResponse: _response.rawResponse,
564
+ });
565
+ }
566
+ }
567
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/split_runs/batch");
568
+ });
569
+ }
459
570
  }
460
571
  exports.SplitRunsClient = SplitRunsClient;