pulse-ts-sdk 1.0.10 → 1.0.11

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 (53) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/Client.js +8 -2
  3. package/dist/cjs/api/client/requests/ExtractAsyncRequest.d.ts +2 -0
  4. package/dist/cjs/api/client/requests/ExtractRequest.d.ts +2 -0
  5. package/dist/cjs/api/resources/form/client/Client.d.ts +47 -24
  6. package/dist/cjs/api/resources/form/client/Client.js +123 -39
  7. package/dist/cjs/api/{types → resources/form/client/requests}/FormClearMultipartInput.d.ts +6 -6
  8. package/dist/cjs/api/{types → resources/form/client/requests}/FormDetectMultipartInput.d.ts +6 -5
  9. package/dist/cjs/api/{types → resources/form/client/requests}/FormFillMultipartInput.d.ts +9 -7
  10. package/dist/cjs/api/resources/form/client/requests/index.d.ts +3 -3
  11. package/dist/cjs/api/types/ExtractInput.d.ts +2 -0
  12. package/dist/cjs/api/types/ExtractOptions.d.ts +2 -0
  13. package/dist/cjs/api/{resources/form/client/requests → types}/FormClearJsonInput.d.ts +3 -3
  14. package/dist/cjs/api/{resources/form/client/requests → types}/FormDetectJsonInput.d.ts +2 -2
  15. package/dist/cjs/api/{resources/form/client/requests → types}/FormFillJsonInput.d.ts +3 -5
  16. package/dist/cjs/api/types/PipelineStepBatchExtractConfig.d.ts +2 -0
  17. package/dist/cjs/api/types/index.d.ts +3 -3
  18. package/dist/cjs/api/types/index.js +3 -3
  19. package/dist/cjs/version.d.ts +1 -1
  20. package/dist/cjs/version.js +1 -1
  21. package/dist/esm/Client.mjs +8 -2
  22. package/dist/esm/api/client/requests/ExtractAsyncRequest.d.mts +2 -0
  23. package/dist/esm/api/client/requests/ExtractRequest.d.mts +2 -0
  24. package/dist/esm/api/resources/form/client/Client.d.mts +47 -24
  25. package/dist/esm/api/resources/form/client/Client.mjs +124 -40
  26. package/dist/esm/api/{types → resources/form/client/requests}/FormClearMultipartInput.d.mts +6 -6
  27. package/dist/esm/api/{types → resources/form/client/requests}/FormDetectMultipartInput.d.mts +6 -5
  28. package/dist/esm/api/{types → resources/form/client/requests}/FormFillMultipartInput.d.mts +9 -7
  29. package/dist/esm/api/resources/form/client/requests/index.d.mts +3 -3
  30. package/dist/esm/api/types/ExtractInput.d.mts +2 -0
  31. package/dist/esm/api/types/ExtractOptions.d.mts +2 -0
  32. package/dist/esm/api/{resources/form/client/requests → types}/FormClearJsonInput.d.mts +3 -3
  33. package/dist/esm/api/{resources/form/client/requests → types}/FormDetectJsonInput.d.mts +2 -2
  34. package/dist/esm/api/{resources/form/client/requests → types}/FormFillJsonInput.d.mts +3 -5
  35. package/dist/esm/api/types/PipelineStepBatchExtractConfig.d.mts +2 -0
  36. package/dist/esm/api/types/index.d.mts +3 -3
  37. package/dist/esm/api/types/index.mjs +3 -3
  38. package/dist/esm/version.d.mts +1 -1
  39. package/dist/esm/version.mjs +1 -1
  40. package/package.json +1 -1
  41. package/reference.md +41 -21
  42. /package/dist/cjs/api/{types → resources/form/client/requests}/FormClearMultipartInput.js +0 -0
  43. /package/dist/cjs/api/{types → resources/form/client/requests}/FormDetectMultipartInput.js +0 -0
  44. /package/dist/cjs/api/{types → resources/form/client/requests}/FormFillMultipartInput.js +0 -0
  45. /package/dist/cjs/api/{resources/form/client/requests → types}/FormClearJsonInput.js +0 -0
  46. /package/dist/cjs/api/{resources/form/client/requests → types}/FormDetectJsonInput.js +0 -0
  47. /package/dist/cjs/api/{resources/form/client/requests → types}/FormFillJsonInput.js +0 -0
  48. /package/dist/esm/api/{types → resources/form/client/requests}/FormClearMultipartInput.mjs +0 -0
  49. /package/dist/esm/api/{types → resources/form/client/requests}/FormDetectMultipartInput.mjs +0 -0
  50. /package/dist/esm/api/{types → resources/form/client/requests}/FormFillMultipartInput.mjs +0 -0
  51. /package/dist/esm/api/{resources/form/client/requests → types}/FormClearJsonInput.mjs +0 -0
  52. /package/dist/esm/api/{resources/form/client/requests → types}/FormDetectJsonInput.mjs +0 -0
  53. /package/dist/esm/api/{resources/form/client/requests → types}/FormFillJsonInput.mjs +0 -0
package/README.md CHANGED
@@ -55,7 +55,7 @@ following namespace:
55
55
  ```typescript
56
56
  import { Pulse } from "pulse-ts-sdk";
57
57
 
58
- const request: Pulse.FormDetectJsonInput = {
58
+ const request: Pulse.FormDetectMultipartInput = {
59
59
  ...
60
60
  };
61
61
  ```
@@ -89,7 +89,7 @@ import { createReadStream } from "fs";
89
89
  import { PulseClient } from "pulse-ts-sdk";
90
90
 
91
91
  const client = new PulseClient({ apiKey: "YOUR_API_KEY" });
92
- await client.extract({});
92
+ await client.form.detect({});
93
93
  ```
94
94
  The client accepts a variety of types for file upload parameters:
95
95
  * Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
@@ -129,6 +129,9 @@ class PulseClient {
129
129
  if (request.model != null) {
130
130
  _request.append("model", request.model);
131
131
  }
132
+ if (request.extractionConfigId != null) {
133
+ _request.append("extractionConfigId", request.extractionConfigId);
134
+ }
132
135
  if (request.pages != null) {
133
136
  _request.append("pages", request.pages);
134
137
  }
@@ -151,7 +154,7 @@ class PulseClient {
151
154
  _request.append("structuredOutput", (0, json_js_1.toJson)(request.structuredOutput));
152
155
  }
153
156
  if (request.schema != null) {
154
- _request.append("schema", typeof request.schema === "string" ? request.schema : (0, json_js_1.toJson)(request.schema));
157
+ _request.append("schema", (0, json_js_1.toJson)(request.schema));
155
158
  }
156
159
  if (request.schemaPrompt != null) {
157
160
  _request.append("schemaPrompt", request.schemaPrompt);
@@ -257,6 +260,9 @@ class PulseClient {
257
260
  if (request.model != null) {
258
261
  _request.append("model", request.model);
259
262
  }
263
+ if (request.extractionConfigId != null) {
264
+ _request.append("extractionConfigId", request.extractionConfigId);
265
+ }
260
266
  if (request.pages != null) {
261
267
  _request.append("pages", request.pages);
262
268
  }
@@ -279,7 +285,7 @@ class PulseClient {
279
285
  _request.append("structuredOutput", (0, json_js_1.toJson)(request.structuredOutput));
280
286
  }
281
287
  if (request.schema != null) {
282
- _request.append("schema", typeof request.schema === "string" ? request.schema : (0, json_js_1.toJson)(request.schema));
288
+ _request.append("schema", (0, json_js_1.toJson)(request.schema));
283
289
  }
284
290
  if (request.schemaPrompt != null) {
285
291
  _request.append("schemaPrompt", request.schemaPrompt);
@@ -10,6 +10,8 @@ export interface ExtractAsyncRequest {
10
10
  fileUrl?: string;
11
11
  /** Extraction model to use. When set to `pulse-ultra-2`, routes the request through Pulse Ultra 2 (self-hosted VPC model) instead of the default cloud-based service. If omitted or set to `default`, the default model is used. */
12
12
  model?: ExtractAsyncRequest.Model;
13
+ /** UUID of a saved extraction configuration (a "preset"). When provided, the server loads the saved configuration and applies its options on top of any inline parameters supplied in this request. Inline parameters always take precedence over preset values for the same field. Saved configs are managed via the platform UI or the `input_extractions` admin endpoints. */
14
+ extractionConfigId?: string;
13
15
  /** Page range filter supporting segments such as `1-2` or mixed ranges like `1-2,5`. */
14
16
  pages?: string;
15
17
  /** Settings that control how figures in the document are processed. These affect the markdown output directly (e.g. figure descriptions, chart-to-table conversion, image embedding) and do not produce additional output fields in the response. */
@@ -10,6 +10,8 @@ export interface ExtractRequest {
10
10
  fileUrl?: string;
11
11
  /** Extraction model to use. When set to `pulse-ultra-2`, routes the request through Pulse Ultra 2 (self-hosted VPC model) instead of the default cloud-based service. If omitted or set to `default`, the default model is used. */
12
12
  model?: ExtractRequest.Model;
13
+ /** UUID of a saved extraction configuration (a "preset"). When provided, the server loads the saved configuration and applies its options on top of any inline parameters supplied in this request. Inline parameters always take precedence over preset values for the same field. Saved configs are managed via the platform UI or the `input_extractions` admin endpoints. */
14
+ extractionConfigId?: string;
13
15
  /** Page range filter supporting segments such as `1-2` or mixed ranges like `1-2,5`. */
14
16
  pages?: string;
15
17
  /** Settings that control how figures in the document are processed. These affect the markdown output directly (e.g. figure descriptions, chart-to-table conversion, image embedding) and do not produce additional output fields in the response. */
@@ -23,11 +23,17 @@ export declare class FormClient {
23
23
  * path and reuse the cached cells.
24
24
  *
25
25
  * **Input modes** — provide exactly one of:
26
- * - `form_id` (JSON) — re-detect cells on a previously stored
27
- * PDF. Useful when callers want to refresh layout after editing
28
- * or when chaining detect calls.
29
- * - `file` (multipart) or `file_url` (JSON or multipart) — start
30
- * from a raw PDF.
26
+ * - `form_id` — re-detect cells on a previously stored PDF.
27
+ * Useful when callers want to refresh layout after editing or
28
+ * when chaining detect calls.
29
+ * - `file_url` public or pre-signed URL Pulse will download.
30
+ * - `file` — direct binary upload of the PDF.
31
+ *
32
+ * All three input modes ride on the same `multipart/form-data`
33
+ * request body. (Callers sending `Content-Type: application/json`
34
+ * with `form_id` / `file_url` are still accepted server-side for
35
+ * backward compatibility, but the SDKs only model the multipart
36
+ * form.)
31
37
  *
32
38
  * Optional `page_range` (alias `pages`, e.g. `"1-3,5"`) restricts
33
39
  * the operation to a subset of pages.
@@ -39,7 +45,7 @@ export declare class FormClient {
39
45
  * Billed at **1 credit per page**. Requires the `form_filler`
40
46
  * feature flag to be enabled for your organization.
41
47
  *
42
- * @param {Pulse.FormDetectJsonInput} request
48
+ * @param {Pulse.FormDetectMultipartInput} request
43
49
  * @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
44
50
  *
45
51
  * @throws {@link Pulse.BadRequestError}
@@ -50,9 +56,10 @@ export declare class FormClient {
50
56
  * @throws {@link Pulse.InternalServerError}
51
57
  *
52
58
  * @example
53
- * await client.form.detect()
59
+ * import { createReadStream } from "fs";
60
+ * await client.form.detect({})
54
61
  */
55
- detect(request?: Pulse.FormDetectJsonInput, requestOptions?: FormClient.RequestOptions): core.HttpResponsePromise<Pulse.FormResult>;
62
+ detect(request: Pulse.FormDetectMultipartInput, requestOptions?: FormClient.RequestOptions): core.HttpResponsePromise<Pulse.FormResult>;
56
63
  private __detect;
57
64
  /**
58
65
  * Fill the fields of a PDF form with values inferred from a natural
@@ -61,13 +68,20 @@ export declare class FormClient {
61
68
  * are rendered as an overlay using detected cells from OCR).
62
69
  *
63
70
  * **Input modes** — provide exactly one of:
64
- * - `form_id` (JSON) — reuse a previously processed form from a
65
- * prior `/form/detect`, `/form/fill`, or `/form/clear` call.
66
- * Skips re-detection (fast path); the cached `form_fields` are
71
+ * - `form_id` — reuse a previously processed form from a prior
72
+ * `/form/detect`, `/form/fill`, or `/form/clear` call. Skips
73
+ * re-detection (fast path); the cached `form_fields` are
67
74
  * reused.
68
- * - `file` (multipart) or `file_url` (JSON or multipart) start
69
- * from a raw PDF. Pulse runs cell detection internally before
70
- * filling.
75
+ * - `file_url` public or pre-signed URL of a PDF Pulse will
76
+ * download.
77
+ * - `file` — direct binary upload of the PDF. Pulse runs cell
78
+ * detection internally before filling.
79
+ *
80
+ * All three input modes ride on the same `multipart/form-data`
81
+ * request body. (Callers sending `Content-Type: application/json`
82
+ * with `form_id` / `file_url` are still accepted server-side for
83
+ * backward compatibility, but the SDKs only model the multipart
84
+ * form.)
71
85
  *
72
86
  * Optional `form_fields` lets callers supply or edit the detected
73
87
  * cells before filling. Optional `page_range` (alias `pages`,
@@ -81,7 +95,7 @@ export declare class FormClient {
81
95
  * Billed at **3 credits per page**. Requires the `form_filler`
82
96
  * feature flag to be enabled for your organization.
83
97
  *
84
- * @param {Pulse.FormFillJsonInput} request
98
+ * @param {Pulse.FormFillMultipartInput} request
85
99
  * @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
86
100
  *
87
101
  * @throws {@link Pulse.BadRequestError}
@@ -92,11 +106,12 @@ export declare class FormClient {
92
106
  * @throws {@link Pulse.InternalServerError}
93
107
  *
94
108
  * @example
109
+ * import { createReadStream } from "fs";
95
110
  * await client.form.fill({
96
111
  * instructions: "instructions"
97
112
  * })
98
113
  */
99
- fill(request: Pulse.FormFillJsonInput, requestOptions?: FormClient.RequestOptions): core.HttpResponsePromise<Pulse.FormResult>;
114
+ fill(request: Pulse.FormFillMultipartInput, requestOptions?: FormClient.RequestOptions): core.HttpResponsePromise<Pulse.FormResult>;
100
115
  private __fill;
101
116
  /**
102
117
  * Remove user-entered data from a PDF form, leaving the blank
@@ -106,11 +121,18 @@ export declare class FormClient {
106
121
  * preserved.
107
122
  *
108
123
  * **Input modes** — provide exactly one of:
109
- * - `form_id` (JSON) — reuse a previously processed form from a
110
- * prior `/form/detect`, `/form/fill`, or `/form/clear` call
111
- * (fast path; cached layout reused).
112
- * - `file` (multipart) or `file_url` (JSON or multipart) start
113
- * from a raw PDF.
124
+ * - `form_id` — reuse a previously processed form from a prior
125
+ * `/form/detect`, `/form/fill`, or `/form/clear` call (fast
126
+ * path; cached layout reused).
127
+ * - `file_url` public or pre-signed URL of a PDF Pulse will
128
+ * download.
129
+ * - `file` — direct binary upload of the PDF.
130
+ *
131
+ * All three input modes ride on the same `multipart/form-data`
132
+ * request body. (Callers sending `Content-Type: application/json`
133
+ * with `form_id` / `file_url` are still accepted server-side for
134
+ * backward compatibility, but the SDKs only model the multipart
135
+ * form.)
114
136
  *
115
137
  * `instructions` is optional. When omitted, Pulse clears every
116
138
  * user-filled field deterministically (no LLM call) on AcroForm
@@ -130,7 +152,7 @@ export declare class FormClient {
130
152
  * Billed at **3 credits per page**. Requires the `form_filler`
131
153
  * feature flag to be enabled for your organization.
132
154
  *
133
- * @param {Pulse.FormClearJsonInput} request
155
+ * @param {Pulse.FormClearMultipartInput} request
134
156
  * @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
135
157
  *
136
158
  * @throws {@link Pulse.BadRequestError}
@@ -141,8 +163,9 @@ export declare class FormClient {
141
163
  * @throws {@link Pulse.InternalServerError}
142
164
  *
143
165
  * @example
144
- * await client.form.clear()
166
+ * import { createReadStream } from "fs";
167
+ * await client.form.clear({})
145
168
  */
146
- clear(request?: Pulse.FormClearJsonInput, requestOptions?: FormClient.RequestOptions): core.HttpResponsePromise<Pulse.FormResult>;
169
+ clear(request: Pulse.FormClearMultipartInput, requestOptions?: FormClient.RequestOptions): core.HttpResponsePromise<Pulse.FormResult>;
147
170
  private __clear;
148
171
  }
@@ -68,11 +68,17 @@ class FormClient {
68
68
  * path and reuse the cached cells.
69
69
  *
70
70
  * **Input modes** — provide exactly one of:
71
- * - `form_id` (JSON) — re-detect cells on a previously stored
72
- * PDF. Useful when callers want to refresh layout after editing
73
- * or when chaining detect calls.
74
- * - `file` (multipart) or `file_url` (JSON or multipart) — start
75
- * from a raw PDF.
71
+ * - `form_id` — re-detect cells on a previously stored PDF.
72
+ * Useful when callers want to refresh layout after editing or
73
+ * when chaining detect calls.
74
+ * - `file_url` public or pre-signed URL Pulse will download.
75
+ * - `file` — direct binary upload of the PDF.
76
+ *
77
+ * All three input modes ride on the same `multipart/form-data`
78
+ * request body. (Callers sending `Content-Type: application/json`
79
+ * with `form_id` / `file_url` are still accepted server-side for
80
+ * backward compatibility, but the SDKs only model the multipart
81
+ * form.)
76
82
  *
77
83
  * Optional `page_range` (alias `pages`, e.g. `"1-3,5"`) restricts
78
84
  * the operation to a subset of pages.
@@ -84,7 +90,7 @@ class FormClient {
84
90
  * Billed at **1 credit per page**. Requires the `form_filler`
85
91
  * feature flag to be enabled for your organization.
86
92
  *
87
- * @param {Pulse.FormDetectJsonInput} request
93
+ * @param {Pulse.FormDetectMultipartInput} request
88
94
  * @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
89
95
  *
90
96
  * @throws {@link Pulse.BadRequestError}
@@ -95,24 +101,42 @@ class FormClient {
95
101
  * @throws {@link Pulse.InternalServerError}
96
102
  *
97
103
  * @example
98
- * await client.form.detect()
104
+ * import { createReadStream } from "fs";
105
+ * await client.form.detect({})
99
106
  */
100
- detect(request = {}, requestOptions) {
107
+ detect(request, requestOptions) {
101
108
  return core.HttpResponsePromise.fromPromise(this.__detect(request, requestOptions));
102
109
  }
103
- __detect() {
104
- return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
110
+ __detect(request, requestOptions) {
111
+ return __awaiter(this, void 0, void 0, function* () {
105
112
  var _a, _b, _c, _d, _e, _f, _g, _h;
113
+ const _request = yield core.newFormData();
114
+ if (request.file != null) {
115
+ yield _request.appendFile("file", request.file);
116
+ }
117
+ if (request.file_url != null) {
118
+ _request.append("file_url", request.file_url);
119
+ }
120
+ if (request.form_id != null) {
121
+ _request.append("form_id", request.form_id);
122
+ }
123
+ if (request.page_range != null) {
124
+ _request.append("page_range", request.page_range);
125
+ }
126
+ if (request.async != null) {
127
+ _request.append("async", request.async);
128
+ }
129
+ const _maybeEncodedRequest = yield _request.getRequest();
106
130
  const _authRequest = yield this._options.authProvider.getAuthRequest();
107
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
131
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
108
132
  const _response = yield core.fetcher({
109
133
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PulseEnvironment.Default, "form/detect"),
110
134
  method: "POST",
111
135
  headers: _headers,
112
- contentType: "application/json",
113
136
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
114
- requestType: "json",
115
- body: request,
137
+ requestType: "file",
138
+ duplex: _maybeEncodedRequest.duplex,
139
+ body: _maybeEncodedRequest.body,
116
140
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
117
141
  ? requestOptions.timeoutInSeconds * 1000
118
142
  : ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
@@ -158,13 +182,20 @@ class FormClient {
158
182
  * are rendered as an overlay using detected cells from OCR).
159
183
  *
160
184
  * **Input modes** — provide exactly one of:
161
- * - `form_id` (JSON) — reuse a previously processed form from a
162
- * prior `/form/detect`, `/form/fill`, or `/form/clear` call.
163
- * Skips re-detection (fast path); the cached `form_fields` are
185
+ * - `form_id` — reuse a previously processed form from a prior
186
+ * `/form/detect`, `/form/fill`, or `/form/clear` call. Skips
187
+ * re-detection (fast path); the cached `form_fields` are
164
188
  * reused.
165
- * - `file` (multipart) or `file_url` (JSON or multipart) start
166
- * from a raw PDF. Pulse runs cell detection internally before
167
- * filling.
189
+ * - `file_url` public or pre-signed URL of a PDF Pulse will
190
+ * download.
191
+ * - `file` — direct binary upload of the PDF. Pulse runs cell
192
+ * detection internally before filling.
193
+ *
194
+ * All three input modes ride on the same `multipart/form-data`
195
+ * request body. (Callers sending `Content-Type: application/json`
196
+ * with `form_id` / `file_url` are still accepted server-side for
197
+ * backward compatibility, but the SDKs only model the multipart
198
+ * form.)
168
199
  *
169
200
  * Optional `form_fields` lets callers supply or edit the detected
170
201
  * cells before filling. Optional `page_range` (alias `pages`,
@@ -178,7 +209,7 @@ class FormClient {
178
209
  * Billed at **3 credits per page**. Requires the `form_filler`
179
210
  * feature flag to be enabled for your organization.
180
211
  *
181
- * @param {Pulse.FormFillJsonInput} request
212
+ * @param {Pulse.FormFillMultipartInput} request
182
213
  * @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
183
214
  *
184
215
  * @throws {@link Pulse.BadRequestError}
@@ -189,6 +220,7 @@ class FormClient {
189
220
  * @throws {@link Pulse.InternalServerError}
190
221
  *
191
222
  * @example
223
+ * import { createReadStream } from "fs";
192
224
  * await client.form.fill({
193
225
  * instructions: "instructions"
194
226
  * })
@@ -199,16 +231,37 @@ class FormClient {
199
231
  __fill(request, requestOptions) {
200
232
  return __awaiter(this, void 0, void 0, function* () {
201
233
  var _a, _b, _c, _d, _e, _f, _g, _h;
234
+ const _request = yield core.newFormData();
235
+ if (request.file != null) {
236
+ yield _request.appendFile("file", request.file);
237
+ }
238
+ if (request.file_url != null) {
239
+ _request.append("file_url", request.file_url);
240
+ }
241
+ if (request.form_id != null) {
242
+ _request.append("form_id", request.form_id);
243
+ }
244
+ _request.append("instructions", request.instructions);
245
+ if (request.form_fields != null) {
246
+ _request.append("form_fields", request.form_fields);
247
+ }
248
+ if (request.page_range != null) {
249
+ _request.append("page_range", request.page_range);
250
+ }
251
+ if (request.async != null) {
252
+ _request.append("async", request.async);
253
+ }
254
+ const _maybeEncodedRequest = yield _request.getRequest();
202
255
  const _authRequest = yield this._options.authProvider.getAuthRequest();
203
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
256
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
204
257
  const _response = yield core.fetcher({
205
258
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PulseEnvironment.Default, "form/fill"),
206
259
  method: "POST",
207
260
  headers: _headers,
208
- contentType: "application/json",
209
261
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
210
- requestType: "json",
211
- body: request,
262
+ requestType: "file",
263
+ duplex: _maybeEncodedRequest.duplex,
264
+ body: _maybeEncodedRequest.body,
212
265
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
213
266
  ? requestOptions.timeoutInSeconds * 1000
214
267
  : ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
@@ -255,11 +308,18 @@ class FormClient {
255
308
  * preserved.
256
309
  *
257
310
  * **Input modes** — provide exactly one of:
258
- * - `form_id` (JSON) — reuse a previously processed form from a
259
- * prior `/form/detect`, `/form/fill`, or `/form/clear` call
260
- * (fast path; cached layout reused).
261
- * - `file` (multipart) or `file_url` (JSON or multipart) start
262
- * from a raw PDF.
311
+ * - `form_id` — reuse a previously processed form from a prior
312
+ * `/form/detect`, `/form/fill`, or `/form/clear` call (fast
313
+ * path; cached layout reused).
314
+ * - `file_url` public or pre-signed URL of a PDF Pulse will
315
+ * download.
316
+ * - `file` — direct binary upload of the PDF.
317
+ *
318
+ * All three input modes ride on the same `multipart/form-data`
319
+ * request body. (Callers sending `Content-Type: application/json`
320
+ * with `form_id` / `file_url` are still accepted server-side for
321
+ * backward compatibility, but the SDKs only model the multipart
322
+ * form.)
263
323
  *
264
324
  * `instructions` is optional. When omitted, Pulse clears every
265
325
  * user-filled field deterministically (no LLM call) on AcroForm
@@ -279,7 +339,7 @@ class FormClient {
279
339
  * Billed at **3 credits per page**. Requires the `form_filler`
280
340
  * feature flag to be enabled for your organization.
281
341
  *
282
- * @param {Pulse.FormClearJsonInput} request
342
+ * @param {Pulse.FormClearMultipartInput} request
283
343
  * @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
284
344
  *
285
345
  * @throws {@link Pulse.BadRequestError}
@@ -290,24 +350,48 @@ class FormClient {
290
350
  * @throws {@link Pulse.InternalServerError}
291
351
  *
292
352
  * @example
293
- * await client.form.clear()
353
+ * import { createReadStream } from "fs";
354
+ * await client.form.clear({})
294
355
  */
295
- clear(request = {}, requestOptions) {
356
+ clear(request, requestOptions) {
296
357
  return core.HttpResponsePromise.fromPromise(this.__clear(request, requestOptions));
297
358
  }
298
- __clear() {
299
- return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
359
+ __clear(request, requestOptions) {
360
+ return __awaiter(this, void 0, void 0, function* () {
300
361
  var _a, _b, _c, _d, _e, _f, _g, _h;
362
+ const _request = yield core.newFormData();
363
+ if (request.file != null) {
364
+ yield _request.appendFile("file", request.file);
365
+ }
366
+ if (request.file_url != null) {
367
+ _request.append("file_url", request.file_url);
368
+ }
369
+ if (request.form_id != null) {
370
+ _request.append("form_id", request.form_id);
371
+ }
372
+ if (request.instructions != null) {
373
+ _request.append("instructions", request.instructions);
374
+ }
375
+ if (request.form_fields != null) {
376
+ _request.append("form_fields", request.form_fields);
377
+ }
378
+ if (request.page_range != null) {
379
+ _request.append("page_range", request.page_range);
380
+ }
381
+ if (request.async != null) {
382
+ _request.append("async", request.async);
383
+ }
384
+ const _maybeEncodedRequest = yield _request.getRequest();
301
385
  const _authRequest = yield this._options.authProvider.getAuthRequest();
302
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
386
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
303
387
  const _response = yield core.fetcher({
304
388
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PulseEnvironment.Default, "form/clear"),
305
389
  method: "POST",
306
390
  headers: _headers,
307
- contentType: "application/json",
308
391
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
309
- requestType: "json",
310
- body: request,
392
+ requestType: "file",
393
+ duplex: _maybeEncodedRequest.duplex,
394
+ body: _maybeEncodedRequest.body,
311
395
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
312
396
  ? requestOptions.timeoutInSeconds * 1000
313
397
  : ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
@@ -1,12 +1,12 @@
1
+ import type * as core from "../../../../../core/index.js";
1
2
  /**
2
- * Multipart `/form/clear` request. Use this variant to upload a
3
- * PDF directly via `file`. Provide exactly one of `file`,
4
- * `file_url`, or `form_id`.
3
+ * @example
4
+ * {}
5
5
  */
6
6
  export interface FormClearMultipartInput {
7
- /** PDF file to upload directly. */
8
- file?: string;
9
- /** Alternative to `file`: a public or pre-signed URL Pulse will download. */
7
+ /** Direct binary upload of the PDF. Mutually exclusive with `file_url` and `form_id`. */
8
+ file?: core.file.Uploadable | undefined;
9
+ /** Public or pre-signed URL of a PDF Pulse will download. Mutually exclusive with `file` and `form_id`. */
10
10
  file_url?: string;
11
11
  /** Reference to a previously processed form. Mutually exclusive with `file` / `file_url`. */
12
12
  form_id?: string;
@@ -1,11 +1,12 @@
1
+ import type * as core from "../../../../../core/index.js";
1
2
  /**
2
- * Multipart `/form/detect` request. Use this variant to upload a
3
- * PDF directly via `file`.
3
+ * @example
4
+ * {}
4
5
  */
5
6
  export interface FormDetectMultipartInput {
6
- /** PDF file to upload directly. */
7
- file?: string;
8
- /** Alternative to `file`: a public or pre-signed URL Pulse will download. */
7
+ /** Direct binary upload of the PDF. Mutually exclusive with `file_url` and `form_id`. */
8
+ file?: core.file.Uploadable | undefined;
9
+ /** Public or pre-signed URL of a PDF Pulse will download. Mutually exclusive with `file` and `form_id`. */
9
10
  file_url?: string;
10
11
  /** Reference to a previously processed form. Mutually exclusive with `file` / `file_url`. */
11
12
  form_id?: string;
@@ -1,17 +1,19 @@
1
+ import type * as core from "../../../../../core/index.js";
1
2
  /**
2
- * Multipart `/form/fill` request. Use this variant to upload a
3
- * PDF directly via `file`. Provide exactly one of `file`,
4
- * `file_url`, or `form_id`.
3
+ * @example
4
+ * {
5
+ * instructions: "instructions"
6
+ * }
5
7
  */
6
8
  export interface FormFillMultipartInput {
7
- /** PDF file to upload directly. */
8
- file?: string;
9
- /** Alternative to `file`: a public or pre-signed URL Pulse will download. */
9
+ /** Direct binary upload of the PDF. Mutually exclusive with `file_url` and `form_id`. */
10
+ file?: core.file.Uploadable | undefined;
11
+ /** Public or pre-signed URL of a PDF Pulse will download. Mutually exclusive with `file` and `form_id`. */
10
12
  file_url?: string;
11
13
  /** Reference to a previously processed form. Mutually exclusive with `file` / `file_url`. */
12
14
  form_id?: string;
13
15
  /** Required natural-language fill prompt. */
14
- instructions?: string;
16
+ instructions: string;
15
17
  /** Optional JSON-encoded array of `FormCell` objects to override detected cells. Multipart bodies must serialise this field as a string. */
16
18
  form_fields?: string;
17
19
  /** Restrict the operation to a subset of pages, e.g. `"1-3,5"`. */
@@ -1,3 +1,3 @@
1
- export type { FormClearJsonInput } from "./FormClearJsonInput.js";
2
- export type { FormDetectJsonInput } from "./FormDetectJsonInput.js";
3
- export type { FormFillJsonInput } from "./FormFillJsonInput.js";
1
+ export type { FormClearMultipartInput } from "./FormClearMultipartInput.js";
2
+ export type { FormDetectMultipartInput } from "./FormDetectMultipartInput.js";
3
+ export type { FormFillMultipartInput } from "./FormFillMultipartInput.js";
@@ -8,6 +8,8 @@ export interface ExtractInput {
8
8
  fileUrl?: string;
9
9
  /** Extraction model to use. When set to `pulse-ultra-2`, routes the request through Pulse Ultra 2 (self-hosted VPC model) instead of the default cloud-based service. If omitted or set to `default`, the default model is used. */
10
10
  model?: ExtractInput.Model;
11
+ /** UUID of a saved extraction configuration (a "preset"). When provided, the server loads the saved configuration and applies its options on top of any inline parameters supplied in this request. Inline parameters always take precedence over preset values for the same field. Saved configs are managed via the platform UI or the `input_extractions` admin endpoints. */
12
+ extractionConfigId?: string;
11
13
  /** Page range filter supporting segments such as `1-2` or mixed ranges like `1-2,5`. */
12
14
  pages?: string;
13
15
  /** Settings that control how figures in the document are processed. These affect the markdown output directly (e.g. figure descriptions, chart-to-table conversion, image embedding) and do not produce additional output fields in the response. */
@@ -4,6 +4,8 @@
4
4
  export interface ExtractOptions {
5
5
  /** Extraction model to use. When set to `pulse-ultra-2`, routes the request through Pulse Ultra 2 (self-hosted VPC model) instead of the default cloud-based service. If omitted or set to `default`, the default model is used. */
6
6
  model?: ExtractOptions.Model;
7
+ /** UUID of a saved extraction configuration (a "preset"). When provided, the server loads the saved configuration and applies its options on top of any inline parameters supplied in this request. Inline parameters always take precedence over preset values for the same field. Saved configs are managed via the platform UI or the `input_extractions` admin endpoints. */
8
+ extractionConfigId?: string;
7
9
  /** Page range filter supporting segments such as `1-2` or mixed ranges like `1-2,5`. */
8
10
  pages?: string;
9
11
  /** Settings that control how figures in the document are processed. These affect the markdown output directly (e.g. figure descriptions, chart-to-table conversion, image embedding) and do not produce additional output fields in the response. */
@@ -1,7 +1,7 @@
1
- import type * as Pulse from "../../../../index.js";
1
+ import type * as Pulse from "../index.js";
2
2
  /**
3
- * @example
4
- * {}
3
+ * JSON request body for `/form/clear`. Provide exactly one of
4
+ * `form_id`, `file_url`, or `file` (multipart only).
5
5
  */
6
6
  export interface FormClearJsonInput {
7
7
  /** ID returned by a previous `/form/detect`, `/form/fill`, or `/form/clear` call (fast path; skips re-detection). */
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @example
3
- * {}
2
+ * JSON request body for `/form/detect`. Provide exactly one of
3
+ * `form_id`, `file_url`, or `file` (multipart only).
4
4
  */
5
5
  export interface FormDetectJsonInput {
6
6
  /** Re-detect cells on a previously stored PDF (returned by an earlier `/form/detect`, `/form/fill`, or `/form/clear` call). Useful when chaining detect calls or refreshing layout after edits. */
@@ -1,9 +1,7 @@
1
- import type * as Pulse from "../../../../index.js";
1
+ import type * as Pulse from "../index.js";
2
2
  /**
3
- * @example
4
- * {
5
- * instructions: "instructions"
6
- * }
3
+ * JSON request body for `/form/fill`. Provide exactly one of
4
+ * `form_id`, `file_url`, or `file` (multipart only).
7
5
  */
8
6
  export interface FormFillJsonInput {
9
7
  /** ID returned by a previous `/form/detect`, `/form/fill`, or `/form/clear` call. Reuses the stored PDF and cached `form_fields` (fast path; skips re-detection). */
@@ -5,6 +5,8 @@ import type * as Pulse from "../index.js";
5
5
  export interface PipelineStepBatchExtractConfig {
6
6
  /** Extraction model to use. When set to `pulse-ultra-2`, routes the request through Pulse Ultra 2 (self-hosted VPC model) instead of the default cloud-based service. If omitted or set to `default`, the default model is used. */
7
7
  model?: PipelineStepBatchExtractConfig.Model;
8
+ /** UUID of a saved extraction configuration (a "preset"). When provided, the server loads the saved configuration and applies its options on top of any inline parameters supplied in this request. Inline parameters always take precedence over preset values for the same field. Saved configs are managed via the platform UI or the `input_extractions` admin endpoints. */
9
+ extractionConfigId?: string;
8
10
  /** Page range filter supporting segments such as `1-2` or mixed ranges like `1-2,5`. */
9
11
  pages?: string;
10
12
  /** Settings that control how figures in the document are processed. These affect the markdown output directly (e.g. figure descriptions, chart-to-table conversion, image embedding) and do not produce additional output fields in the response. */
@@ -16,9 +16,9 @@ export * from "./ExtractResultCore.js";
16
16
  export * from "./ExtractSource.js";
17
17
  export * from "./FormCell.js";
18
18
  export * from "./FormCheckboxDetail.js";
19
- export * from "./FormClearMultipartInput.js";
20
- export * from "./FormDetectMultipartInput.js";
21
- export * from "./FormFillMultipartInput.js";
19
+ export * from "./FormClearJsonInput.js";
20
+ export * from "./FormDetectJsonInput.js";
21
+ export * from "./FormFillJsonInput.js";
22
22
  export * from "./FormFillSharedOptions.js";
23
23
  export * from "./FormPlanInfo.js";
24
24
  export * from "./FormResult.js";