pulse-ts-sdk 0.0.52 → 0.0.54

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 (88) hide show
  1. package/README.md +44 -3
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +8 -10
  4. package/dist/cjs/Client.js +113 -16
  5. package/dist/cjs/api/client/index.d.ts +1 -0
  6. package/dist/cjs/api/client/index.js +17 -0
  7. package/dist/cjs/api/{types/ExtractMultipartInput.d.ts → client/requests/ExtractAsyncRequest.d.ts} +13 -7
  8. package/dist/{esm/api/types/ExtractJsonInput.d.mts → cjs/api/client/requests/ExtractRequest.d.ts} +13 -9
  9. package/dist/cjs/api/client/requests/index.d.ts +2 -0
  10. package/dist/cjs/api/{types/JsonSource.js → client/requests/index.js} +0 -1
  11. package/dist/cjs/api/index.d.ts +1 -0
  12. package/dist/cjs/api/index.js +1 -0
  13. package/dist/cjs/api/types/ExtractInput.d.ts +63 -1
  14. package/dist/cjs/api/types/ExtractSource.d.ts +9 -0
  15. package/dist/cjs/api/types/index.d.ts +1 -5
  16. package/dist/cjs/api/types/index.js +1 -5
  17. package/dist/cjs/core/exports.d.ts +1 -0
  18. package/dist/cjs/core/exports.js +1 -0
  19. package/dist/cjs/core/file/exports.d.ts +1 -0
  20. package/dist/cjs/core/file/exports.js +2 -0
  21. package/dist/cjs/core/file/file.d.ts +10 -0
  22. package/dist/cjs/core/file/file.js +221 -0
  23. package/dist/cjs/core/file/index.d.ts +2 -0
  24. package/dist/cjs/core/file/index.js +18 -0
  25. package/dist/cjs/core/file/types.d.ts +66 -0
  26. package/dist/cjs/core/file/types.js +2 -0
  27. package/dist/cjs/core/form-data-utils/FormDataWrapper.d.ts +15 -0
  28. package/dist/cjs/core/form-data-utils/FormDataWrapper.js +185 -0
  29. package/dist/cjs/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
  30. package/dist/cjs/core/form-data-utils/encodeAsFormParameter.js +12 -0
  31. package/dist/cjs/core/form-data-utils/index.d.ts +2 -0
  32. package/dist/cjs/core/form-data-utils/index.js +20 -0
  33. package/dist/cjs/core/index.d.ts +2 -0
  34. package/dist/cjs/core/index.js +3 -1
  35. package/dist/cjs/version.d.ts +1 -1
  36. package/dist/cjs/version.js +1 -1
  37. package/dist/esm/BaseClient.mjs +2 -2
  38. package/dist/esm/Client.d.mts +8 -10
  39. package/dist/esm/Client.mjs +114 -17
  40. package/dist/esm/api/client/index.d.mts +1 -0
  41. package/dist/esm/api/client/index.mjs +1 -0
  42. package/dist/esm/api/{types/ExtractMultipartInput.d.mts → client/requests/ExtractAsyncRequest.d.mts} +13 -7
  43. package/dist/{cjs/api/types/ExtractJsonInput.d.ts → esm/api/client/requests/ExtractRequest.d.mts} +13 -9
  44. package/dist/esm/api/client/requests/index.d.mts +2 -0
  45. package/dist/esm/api/client/requests/index.mjs +1 -0
  46. package/dist/esm/api/index.d.mts +1 -0
  47. package/dist/esm/api/index.mjs +1 -0
  48. package/dist/esm/api/types/ExtractInput.d.mts +63 -1
  49. package/dist/esm/api/types/ExtractSource.d.mts +9 -0
  50. package/dist/esm/api/types/index.d.mts +1 -5
  51. package/dist/esm/api/types/index.mjs +1 -5
  52. package/dist/esm/core/exports.d.mts +1 -0
  53. package/dist/esm/core/exports.mjs +1 -0
  54. package/dist/esm/core/file/exports.d.mts +1 -0
  55. package/dist/esm/core/file/exports.mjs +1 -0
  56. package/dist/esm/core/file/file.d.mts +10 -0
  57. package/dist/esm/core/file/file.mjs +184 -0
  58. package/dist/esm/core/file/index.d.mts +2 -0
  59. package/dist/esm/core/file/index.mjs +2 -0
  60. package/dist/esm/core/file/types.d.mts +66 -0
  61. package/dist/esm/core/file/types.mjs +1 -0
  62. package/dist/esm/core/form-data-utils/FormDataWrapper.d.mts +15 -0
  63. package/dist/esm/core/form-data-utils/FormDataWrapper.mjs +147 -0
  64. package/dist/esm/core/form-data-utils/encodeAsFormParameter.d.mts +1 -0
  65. package/dist/esm/core/form-data-utils/encodeAsFormParameter.mjs +9 -0
  66. package/dist/esm/core/form-data-utils/index.d.mts +2 -0
  67. package/dist/esm/core/form-data-utils/index.mjs +2 -0
  68. package/dist/esm/core/index.d.mts +2 -0
  69. package/dist/esm/core/index.mjs +2 -0
  70. package/dist/esm/version.d.mts +1 -1
  71. package/dist/esm/version.mjs +1 -1
  72. package/package.json +1 -1
  73. package/reference.md +4 -8
  74. package/dist/cjs/api/types/ExtractAsyncInput.d.ts +0 -1
  75. package/dist/cjs/api/types/JsonSource.d.ts +0 -7
  76. package/dist/cjs/api/types/MultipartSource.d.ts +0 -10
  77. package/dist/cjs/api/types/MultipartSource.js +0 -3
  78. package/dist/esm/api/types/ExtractAsyncInput.d.mts +0 -1
  79. package/dist/esm/api/types/JsonSource.d.mts +0 -7
  80. package/dist/esm/api/types/JsonSource.mjs +0 -2
  81. package/dist/esm/api/types/MultipartSource.d.mts +0 -10
  82. package/dist/esm/api/types/MultipartSource.mjs +0 -2
  83. /package/dist/cjs/api/{types/ExtractAsyncInput.js → client/requests/ExtractAsyncRequest.js} +0 -0
  84. /package/dist/cjs/api/{types/ExtractJsonInput.js → client/requests/ExtractRequest.js} +0 -0
  85. /package/dist/cjs/api/types/{ExtractMultipartInput.js → ExtractSource.js} +0 -0
  86. /package/dist/esm/api/{types/ExtractAsyncInput.mjs → client/requests/ExtractAsyncRequest.mjs} +0 -0
  87. /package/dist/esm/api/{types/ExtractJsonInput.mjs → client/requests/ExtractRequest.mjs} +0 -0
  88. /package/dist/esm/api/types/{ExtractMultipartInput.mjs → ExtractSource.mjs} +0 -0
package/README.md CHANGED
@@ -12,6 +12,7 @@ The Pulse TypeScript library provides convenient access to the Pulse APIs from T
12
12
  - [Usage](#usage)
13
13
  - [Request and Response Types](#request-and-response-types)
14
14
  - [Exception Handling](#exception-handling)
15
+ - [File Uploads](#file-uploads)
15
16
  - [Advanced](#advanced)
16
17
  - [Additional Headers](#additional-headers)
17
18
  - [Additional Query String Parameters](#additional-query-string-parameters)
@@ -38,12 +39,11 @@ A full reference for this library is available [here](https://github.com/Pulse-S
38
39
  Instantiate and use the client with the following:
39
40
 
40
41
  ```typescript
42
+ import { createReadStream } from "fs";
41
43
  import { PulseClient } from "pulse-ts-sdk";
42
44
 
43
45
  const client = new PulseClient({ apiKey: "YOUR_API_KEY" });
44
- await client.extract({
45
- fileUrl: "fileUrl"
46
- });
46
+ await client.extract({});
47
47
  ```
48
48
 
49
49
  ## Request and Response Types
@@ -79,6 +79,47 @@ try {
79
79
  }
80
80
  ```
81
81
 
82
+ ## File Uploads
83
+
84
+ You can upload files using the client:
85
+
86
+ ```typescript
87
+ import { createReadStream } from "fs";
88
+ import { PulseClient } from "pulse-ts-sdk";
89
+
90
+ const client = new PulseClient({ apiKey: "YOUR_API_KEY" });
91
+ await client.extract({});
92
+ ```
93
+ The client accepts a variety of types for file upload parameters:
94
+ * Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
95
+ * Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array`
96
+
97
+ ### Metadata
98
+
99
+ You can configure metadata when uploading a file:
100
+ ```typescript
101
+ const file: Uploadable.WithMetadata = {
102
+ data: createReadStream("path/to/file"),
103
+ filename: "my-file", // optional
104
+ contentType: "audio/mpeg", // optional
105
+ contentLength: 1949, // optional
106
+ };
107
+ ```
108
+
109
+ Alternatively, you can upload a file directly from a file path:
110
+ ```typescript
111
+ const file : Uploadable.FromPath = {
112
+ path: "path/to/file",
113
+ filename: "my-file", // optional
114
+ contentType: "audio/mpeg", // optional
115
+ contentLength: 1949, // optional
116
+ };
117
+ ```
118
+
119
+ The metadata is used to set the `Content-Length`, `Content-Type`, and `Content-Disposition` headers. If not provided, the client will attempt to determine them automatically.
120
+ For example, `fs.ReadStream` has a `path` property which the SDK uses to retrieve the file size from the filesystem without loading it into memory.
121
+
122
+
82
123
  ## Advanced
83
124
 
84
125
  ### Additional Headers
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "pulse-ts-sdk",
46
- "X-Fern-SDK-Version": "0.0.52",
47
- "User-Agent": "pulse-ts-sdk/0.0.52",
46
+ "X-Fern-SDK-Version": "0.0.54",
47
+ "User-Agent": "pulse-ts-sdk/0.0.54",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -21,7 +21,7 @@ export declare class PulseClient {
21
21
  * file URLs and returns rich markdown content with optional structured data
22
22
  * extraction based on user-provided schemas and extraction options.
23
23
  *
24
- * @param {Pulse.ExtractJsonInput} request
24
+ * @param {Pulse.ExtractRequest} request
25
25
  * @param {PulseClient.RequestOptions} requestOptions - Request-specific configuration.
26
26
  *
27
27
  * @throws {@link Pulse.BadRequestError}
@@ -29,18 +29,17 @@ export declare class PulseClient {
29
29
  * @throws {@link Pulse.TooManyRequestsError}
30
30
  *
31
31
  * @example
32
- * await client.extract({
33
- * fileUrl: "fileUrl"
34
- * })
32
+ * import { createReadStream } from "fs";
33
+ * await client.extract({})
35
34
  */
36
- extract(request: Pulse.ExtractJsonInput, requestOptions?: PulseClient.RequestOptions): core.HttpResponsePromise<Pulse.ExtractResponse>;
35
+ extract(request: Pulse.ExtractRequest, requestOptions?: PulseClient.RequestOptions): core.HttpResponsePromise<Pulse.ExtractResponse>;
37
36
  private __extract;
38
37
  /**
39
38
  * Starts an asynchronous extraction job. The request mirrors the
40
39
  * synchronous options but returns immediately with a job identifier that
41
40
  * clients can poll for completion status.
42
41
  *
43
- * @param {Pulse.ExtractJsonInput} request
42
+ * @param {Pulse.ExtractAsyncRequest} request
44
43
  * @param {PulseClient.RequestOptions} requestOptions - Request-specific configuration.
45
44
  *
46
45
  * @throws {@link Pulse.BadRequestError}
@@ -48,10 +47,9 @@ export declare class PulseClient {
48
47
  * @throws {@link Pulse.TooManyRequestsError}
49
48
  *
50
49
  * @example
51
- * await client.extractAsync({
52
- * fileUrl: "fileUrl"
53
- * })
50
+ * import { createReadStream } from "fs";
51
+ * await client.extractAsync({})
54
52
  */
55
- extractAsync(request: Pulse.ExtractJsonInput, requestOptions?: PulseClient.RequestOptions): core.HttpResponsePromise<Pulse.ExtractAsyncResponse>;
53
+ extractAsync(request: Pulse.ExtractAsyncRequest, requestOptions?: PulseClient.RequestOptions): core.HttpResponsePromise<Pulse.ExtractAsyncResponse>;
56
54
  private __extractAsync;
57
55
  }
@@ -50,6 +50,7 @@ const Client_js_2 = require("./api/resources/webhooks/client/Client.js");
50
50
  const BaseClient_js_1 = require("./BaseClient.js");
51
51
  const headers_js_1 = require("./core/headers.js");
52
52
  const core = __importStar(require("./core/index.js"));
53
+ const json_js_1 = require("./core/json.js");
53
54
  const environments = __importStar(require("./environments.js"));
54
55
  const handleNonStatusCodeError_js_1 = require("./errors/handleNonStatusCodeError.js");
55
56
  const errors = __importStar(require("./errors/index.js"));
@@ -70,7 +71,7 @@ class PulseClient {
70
71
  * file URLs and returns rich markdown content with optional structured data
71
72
  * extraction based on user-provided schemas and extraction options.
72
73
  *
73
- * @param {Pulse.ExtractJsonInput} request
74
+ * @param {Pulse.ExtractRequest} request
74
75
  * @param {PulseClient.RequestOptions} requestOptions - Request-specific configuration.
75
76
  *
76
77
  * @throws {@link Pulse.BadRequestError}
@@ -78,9 +79,8 @@ class PulseClient {
78
79
  * @throws {@link Pulse.TooManyRequestsError}
79
80
  *
80
81
  * @example
81
- * await client.extract({
82
- * fileUrl: "fileUrl"
83
- * })
82
+ * import { createReadStream } from "fs";
83
+ * await client.extract({})
84
84
  */
85
85
  extract(request, requestOptions) {
86
86
  return core.HttpResponsePromise.fromPromise(this.__extract(request, requestOptions));
@@ -88,15 +88,64 @@ class PulseClient {
88
88
  __extract(request, requestOptions) {
89
89
  return __awaiter(this, void 0, void 0, function* () {
90
90
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
91
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
91
+ const _request = yield core.newFormData();
92
+ if (request.file != null) {
93
+ yield _request.appendFile("file", request.file);
94
+ }
95
+ if (request.fileUrl != null) {
96
+ _request.append("fileUrl", request.fileUrl);
97
+ }
98
+ if (request.structuredOutput != null) {
99
+ _request.append("structuredOutput", (0, json_js_1.toJson)(request.structuredOutput));
100
+ }
101
+ if (request.schema != null) {
102
+ _request.append("schema", typeof request.schema === "string" ? request.schema : (0, json_js_1.toJson)(request.schema));
103
+ }
104
+ if (request.experimentalSchema != null) {
105
+ _request.append("experimentalSchema", typeof request.experimentalSchema === "string"
106
+ ? request.experimentalSchema
107
+ : (0, json_js_1.toJson)(request.experimentalSchema));
108
+ }
109
+ if (request.schemaPrompt != null) {
110
+ _request.append("schemaPrompt", request.schemaPrompt);
111
+ }
112
+ if (request.customPrompt != null) {
113
+ _request.append("customPrompt", request.customPrompt);
114
+ }
115
+ if (request.chunking != null) {
116
+ _request.append("chunking", request.chunking);
117
+ }
118
+ if (request.chunkSize != null) {
119
+ _request.append("chunkSize", request.chunkSize.toString());
120
+ }
121
+ if (request.pages != null) {
122
+ _request.append("pages", request.pages);
123
+ }
124
+ if (request.extractFigure != null) {
125
+ _request.append("extractFigure", request.extractFigure.toString());
126
+ }
127
+ if (request.figureDescription != null) {
128
+ _request.append("figureDescription", request.figureDescription.toString());
129
+ }
130
+ if (request.returnHtml != null) {
131
+ _request.append("returnHtml", request.returnHtml.toString());
132
+ }
133
+ if (request.thinking != null) {
134
+ _request.append("thinking", request.thinking.toString());
135
+ }
136
+ if (request.storage != null) {
137
+ _request.append("storage", (0, json_js_1.toJson)(request.storage));
138
+ }
139
+ const _maybeEncodedRequest = yield _request.getRequest();
140
+ const _headers = (0, headers_js_1.mergeHeaders)((_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);
92
141
  const _response = yield core.fetcher({
93
142
  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, "extract"),
94
143
  method: "POST",
95
144
  headers: _headers,
96
- contentType: "application/json",
97
145
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
98
- requestType: "json",
99
- body: request,
146
+ requestType: "file",
147
+ duplex: _maybeEncodedRequest.duplex,
148
+ body: _maybeEncodedRequest.body,
100
149
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
101
150
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
102
151
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -130,7 +179,7 @@ class PulseClient {
130
179
  * synchronous options but returns immediately with a job identifier that
131
180
  * clients can poll for completion status.
132
181
  *
133
- * @param {Pulse.ExtractJsonInput} request
182
+ * @param {Pulse.ExtractAsyncRequest} request
134
183
  * @param {PulseClient.RequestOptions} requestOptions - Request-specific configuration.
135
184
  *
136
185
  * @throws {@link Pulse.BadRequestError}
@@ -138,9 +187,8 @@ class PulseClient {
138
187
  * @throws {@link Pulse.TooManyRequestsError}
139
188
  *
140
189
  * @example
141
- * await client.extractAsync({
142
- * fileUrl: "fileUrl"
143
- * })
190
+ * import { createReadStream } from "fs";
191
+ * await client.extractAsync({})
144
192
  */
145
193
  extractAsync(request, requestOptions) {
146
194
  return core.HttpResponsePromise.fromPromise(this.__extractAsync(request, requestOptions));
@@ -148,15 +196,64 @@ class PulseClient {
148
196
  __extractAsync(request, requestOptions) {
149
197
  return __awaiter(this, void 0, void 0, function* () {
150
198
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
151
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
199
+ const _request = yield core.newFormData();
200
+ if (request.file != null) {
201
+ yield _request.appendFile("file", request.file);
202
+ }
203
+ if (request.fileUrl != null) {
204
+ _request.append("fileUrl", request.fileUrl);
205
+ }
206
+ if (request.structuredOutput != null) {
207
+ _request.append("structuredOutput", (0, json_js_1.toJson)(request.structuredOutput));
208
+ }
209
+ if (request.schema != null) {
210
+ _request.append("schema", typeof request.schema === "string" ? request.schema : (0, json_js_1.toJson)(request.schema));
211
+ }
212
+ if (request.experimentalSchema != null) {
213
+ _request.append("experimentalSchema", typeof request.experimentalSchema === "string"
214
+ ? request.experimentalSchema
215
+ : (0, json_js_1.toJson)(request.experimentalSchema));
216
+ }
217
+ if (request.schemaPrompt != null) {
218
+ _request.append("schemaPrompt", request.schemaPrompt);
219
+ }
220
+ if (request.customPrompt != null) {
221
+ _request.append("customPrompt", request.customPrompt);
222
+ }
223
+ if (request.chunking != null) {
224
+ _request.append("chunking", request.chunking);
225
+ }
226
+ if (request.chunkSize != null) {
227
+ _request.append("chunkSize", request.chunkSize.toString());
228
+ }
229
+ if (request.pages != null) {
230
+ _request.append("pages", request.pages);
231
+ }
232
+ if (request.extractFigure != null) {
233
+ _request.append("extractFigure", request.extractFigure.toString());
234
+ }
235
+ if (request.figureDescription != null) {
236
+ _request.append("figureDescription", request.figureDescription.toString());
237
+ }
238
+ if (request.returnHtml != null) {
239
+ _request.append("returnHtml", request.returnHtml.toString());
240
+ }
241
+ if (request.thinking != null) {
242
+ _request.append("thinking", request.thinking.toString());
243
+ }
244
+ if (request.storage != null) {
245
+ _request.append("storage", (0, json_js_1.toJson)(request.storage));
246
+ }
247
+ const _maybeEncodedRequest = yield _request.getRequest();
248
+ const _headers = (0, headers_js_1.mergeHeaders)((_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);
152
249
  const _response = yield core.fetcher({
153
250
  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, "extract_async"),
154
251
  method: "POST",
155
252
  headers: _headers,
156
- contentType: "application/json",
157
253
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
158
- requestType: "json",
159
- body: request,
254
+ requestType: "file",
255
+ duplex: _maybeEncodedRequest.duplex,
256
+ body: _maybeEncodedRequest.body,
160
257
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
161
258
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
162
259
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -1,13 +1,19 @@
1
+ import type * as core from "../../../core/index.js";
1
2
  /**
2
- * Input schema for multipart/form-data requests (file upload or fileUrl).
3
+ * @example
4
+ * {}
3
5
  */
4
- export interface ExtractMultipartInput {
6
+ export interface ExtractAsyncRequest {
7
+ /** Document to upload directly. Required unless fileUrl is provided. */
8
+ file?: core.file.Uploadable | undefined;
9
+ /** Public or pre-signed URL that Pulse will download and extract. Required unless file is provided. */
10
+ fileUrl?: string;
5
11
  /** Recommended method for schema-guided extraction. Contains the schema and optional prompt in a single object. */
6
- structuredOutput?: ExtractMultipartInput.StructuredOutput;
12
+ structuredOutput?: ExtractAsyncRequest.StructuredOutput;
7
13
  /** (Deprecated) JSON schema describing structured data to extract. Use structuredOutput instead. Accepts either a JSON object or a stringified JSON representation. */
8
- schema?: ExtractMultipartInput.Schema;
14
+ schema?: ExtractAsyncRequest.Schema;
9
15
  /** (Deprecated) Experimental schema definition used for feature flagged behaviour. Accepts either a JSON object or a stringified JSON representation. */
10
- experimentalSchema?: ExtractMultipartInput.ExperimentalSchema;
16
+ experimentalSchema?: ExtractAsyncRequest.ExperimentalSchema;
11
17
  /** (Deprecated) Natural language prompt for schema-guided extraction. Use structuredOutput.schemaPrompt instead. */
12
18
  schemaPrompt?: string;
13
19
  /** (Deprecated) Custom instructions that augment the default extraction behaviour. */
@@ -27,9 +33,9 @@ export interface ExtractMultipartInput {
27
33
  /** (Deprecated) Enables expanded rationale output for debugging. */
28
34
  thinking?: boolean;
29
35
  /** Options for persisting extraction artifacts. When enabled (default), artifacts are saved to storage and a database record is created. */
30
- storage?: ExtractMultipartInput.Storage;
36
+ storage?: ExtractAsyncRequest.Storage;
31
37
  }
32
- export declare namespace ExtractMultipartInput {
38
+ export declare namespace ExtractAsyncRequest {
33
39
  /**
34
40
  * Recommended method for schema-guided extraction. Contains the schema and optional prompt in a single object.
35
41
  */
@@ -1,15 +1,19 @@
1
+ import type * as core from "../../../core/index.js";
1
2
  /**
2
- * Input schema for JSON requests (fileUrl only).
3
+ * @example
4
+ * {}
3
5
  */
4
- export interface ExtractJsonInput {
5
- /** Public or pre-signed URL that Pulse will download and extract. */
6
- fileUrl: string;
6
+ export interface ExtractRequest {
7
+ /** Document to upload directly. Required unless fileUrl is provided. */
8
+ file?: core.file.Uploadable | undefined;
9
+ /** Public or pre-signed URL that Pulse will download and extract. Required unless file is provided. */
10
+ fileUrl?: string;
7
11
  /** Recommended method for schema-guided extraction. Contains the schema and optional prompt in a single object. */
8
- structuredOutput?: ExtractJsonInput.StructuredOutput;
12
+ structuredOutput?: ExtractRequest.StructuredOutput;
9
13
  /** (Deprecated) JSON schema describing structured data to extract. Use structuredOutput instead. Accepts either a JSON object or a stringified JSON representation. */
10
- schema?: ExtractJsonInput.Schema;
14
+ schema?: ExtractRequest.Schema;
11
15
  /** (Deprecated) Experimental schema definition used for feature flagged behaviour. Accepts either a JSON object or a stringified JSON representation. */
12
- experimentalSchema?: ExtractJsonInput.ExperimentalSchema;
16
+ experimentalSchema?: ExtractRequest.ExperimentalSchema;
13
17
  /** (Deprecated) Natural language prompt for schema-guided extraction. Use structuredOutput.schemaPrompt instead. */
14
18
  schemaPrompt?: string;
15
19
  /** (Deprecated) Custom instructions that augment the default extraction behaviour. */
@@ -29,9 +33,9 @@ export interface ExtractJsonInput {
29
33
  /** (Deprecated) Enables expanded rationale output for debugging. */
30
34
  thinking?: boolean;
31
35
  /** Options for persisting extraction artifacts. When enabled (default), artifacts are saved to storage and a database record is created. */
32
- storage?: ExtractJsonInput.Storage;
36
+ storage?: ExtractRequest.Storage;
33
37
  }
34
- export declare namespace ExtractJsonInput {
38
+ export declare namespace ExtractRequest {
35
39
  /**
36
40
  * Recommended method for schema-guided extraction. Contains the schema and optional prompt in a single object.
37
41
  */
@@ -0,0 +1,2 @@
1
+ export type { ExtractAsyncRequest } from "./ExtractAsyncRequest.js";
2
+ export type { ExtractRequest } from "./ExtractRequest.js";
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ export * from "./client/index.js";
1
2
  export * from "./errors/index.js";
2
3
  export * from "./resources/index.js";
3
4
  export * from "./types/index.js";
@@ -14,6 +14,7 @@ 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("./client/index.js"), exports);
17
18
  __exportStar(require("./errors/index.js"), exports);
18
19
  __exportStar(require("./resources/index.js"), exports);
19
20
  __exportStar(require("./types/index.js"), exports);
@@ -1 +1,63 @@
1
- export type ExtractInput = unknown;
1
+ /**
2
+ * Input schema for extraction requests. Provide either file (direct upload) or fileUrl (remote URL).
3
+ */
4
+ export interface ExtractInput {
5
+ /** Document to upload directly. Required unless fileUrl is provided. */
6
+ file?: string;
7
+ /** Public or pre-signed URL that Pulse will download and extract. Required unless file is provided. */
8
+ fileUrl?: string;
9
+ /** Recommended method for schema-guided extraction. Contains the schema and optional prompt in a single object. */
10
+ structuredOutput?: ExtractInput.StructuredOutput;
11
+ /** (Deprecated) JSON schema describing structured data to extract. Use structuredOutput instead. Accepts either a JSON object or a stringified JSON representation. */
12
+ schema?: ExtractInput.Schema;
13
+ /** (Deprecated) Experimental schema definition used for feature flagged behaviour. Accepts either a JSON object or a stringified JSON representation. */
14
+ experimentalSchema?: ExtractInput.ExperimentalSchema;
15
+ /** (Deprecated) Natural language prompt for schema-guided extraction. Use structuredOutput.schemaPrompt instead. */
16
+ schemaPrompt?: string;
17
+ /** (Deprecated) Custom instructions that augment the default extraction behaviour. */
18
+ customPrompt?: string;
19
+ /** Comma-separated list of chunking strategies to apply (for example `semantic,header,page,recursive`). */
20
+ chunking?: string;
21
+ /** Override for maximum characters per chunk when chunking is enabled. */
22
+ chunkSize?: number;
23
+ /** Page range filter supporting segments such as `1-2` or mixed ranges like `1-2,5`. */
24
+ pages?: string;
25
+ /** Toggle to enable figure extraction in results. */
26
+ extractFigure?: boolean;
27
+ /** Toggle to generate descriptive captions for extracted figures. */
28
+ figureDescription?: boolean;
29
+ /** Whether to include HTML representation alongside markdown in the response. */
30
+ returnHtml?: boolean;
31
+ /** (Deprecated) Enables expanded rationale output for debugging. */
32
+ thinking?: boolean;
33
+ /** Options for persisting extraction artifacts. When enabled (default), artifacts are saved to storage and a database record is created. */
34
+ storage?: ExtractInput.Storage;
35
+ }
36
+ export declare namespace ExtractInput {
37
+ /**
38
+ * Recommended method for schema-guided extraction. Contains the schema and optional prompt in a single object.
39
+ */
40
+ interface StructuredOutput {
41
+ /** JSON schema describing the structured data to extract. */
42
+ schema?: Record<string, unknown>;
43
+ /** Natural language prompt with additional extraction instructions. */
44
+ schemaPrompt?: string;
45
+ }
46
+ /**
47
+ * (Deprecated) JSON schema describing structured data to extract. Use structuredOutput instead. Accepts either a JSON object or a stringified JSON representation.
48
+ */
49
+ type Schema = Record<string, unknown> | string;
50
+ /**
51
+ * (Deprecated) Experimental schema definition used for feature flagged behaviour. Accepts either a JSON object or a stringified JSON representation.
52
+ */
53
+ type ExperimentalSchema = Record<string, unknown> | string;
54
+ /**
55
+ * Options for persisting extraction artifacts. When enabled (default), artifacts are saved to storage and a database record is created.
56
+ */
57
+ interface Storage {
58
+ /** Whether to persist extraction artifacts. Set to false for temporary extractions with no storage or database record. */
59
+ enabled?: boolean;
60
+ /** Target folder name to save the extraction to. Creates the folder if it doesn't exist. */
61
+ folderName?: string;
62
+ }
63
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Document source definition for multipart/form-data requests. Provide exactly one of `file` (direct upload) or `fileUrl` (remote URL).
3
+ */
4
+ export interface ExtractSource {
5
+ /** Document to upload directly. Required unless fileUrl is provided. */
6
+ file?: string;
7
+ /** Public or pre-signed URL that Pulse will download and extract. Required unless file is provided. */
8
+ fileUrl?: string;
9
+ }
@@ -1,12 +1,8 @@
1
- export * from "./ExtractAsyncInput.js";
2
1
  export * from "./ExtractAsyncResponse.js";
3
2
  export * from "./ExtractInput.js";
4
- export * from "./ExtractJsonInput.js";
5
- export * from "./ExtractMultipartInput.js";
6
3
  export * from "./ExtractOptions.js";
7
4
  export * from "./ExtractResponse.js";
5
+ export * from "./ExtractSource.js";
8
6
  export * from "./JobCancellationResponse.js";
9
7
  export * from "./JobStatus.js";
10
8
  export * from "./JobStatusResponse.js";
11
- export * from "./JsonSource.js";
12
- export * from "./MultipartSource.js";
@@ -14,15 +14,11 @@ 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("./ExtractAsyncInput.js"), exports);
18
17
  __exportStar(require("./ExtractAsyncResponse.js"), exports);
19
18
  __exportStar(require("./ExtractInput.js"), exports);
20
- __exportStar(require("./ExtractJsonInput.js"), exports);
21
- __exportStar(require("./ExtractMultipartInput.js"), exports);
22
19
  __exportStar(require("./ExtractOptions.js"), exports);
23
20
  __exportStar(require("./ExtractResponse.js"), exports);
21
+ __exportStar(require("./ExtractSource.js"), exports);
24
22
  __exportStar(require("./JobCancellationResponse.js"), exports);
25
23
  __exportStar(require("./JobStatus.js"), exports);
26
24
  __exportStar(require("./JobStatusResponse.js"), exports);
27
- __exportStar(require("./JsonSource.js"), exports);
28
- __exportStar(require("./MultipartSource.js"), exports);
@@ -1 +1,2 @@
1
+ export * from "./file/exports.js";
1
2
  export * from "./logging/exports.js";
@@ -14,4 +14,5 @@ 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("./file/exports.js"), exports);
17
18
  __exportStar(require("./logging/exports.js"), exports);
@@ -0,0 +1 @@
1
+ export type { Uploadable } from "./types.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import type { Uploadable } from "./types.js";
2
+ export declare function toBinaryUploadRequest(file: Uploadable): Promise<{
3
+ body: Uploadable.FileLike;
4
+ headers?: Record<string, string>;
5
+ }>;
6
+ export declare function toMultipartDataPart(file: Uploadable): Promise<{
7
+ data: Uploadable.FileLike;
8
+ filename?: string;
9
+ contentType?: string;
10
+ }>;