pulse-ts-sdk 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/Client.js +8 -2
- package/dist/cjs/api/client/requests/ExtractAsyncRequest.d.ts +2 -0
- package/dist/cjs/api/client/requests/ExtractRequest.d.ts +2 -0
- package/dist/cjs/api/resources/form/client/Client.d.ts +47 -24
- package/dist/cjs/api/resources/form/client/Client.js +123 -39
- package/dist/cjs/api/{types → resources/form/client/requests}/FormClearMultipartInput.d.ts +6 -6
- package/dist/cjs/api/{types → resources/form/client/requests}/FormDetectMultipartInput.d.ts +6 -5
- package/dist/cjs/api/{types → resources/form/client/requests}/FormFillMultipartInput.d.ts +9 -7
- package/dist/cjs/api/resources/form/client/requests/index.d.ts +3 -3
- package/dist/cjs/api/types/ExtractInput.d.ts +2 -0
- package/dist/cjs/api/types/ExtractOptions.d.ts +2 -0
- package/dist/cjs/api/{resources/form/client/requests → types}/FormClearJsonInput.d.ts +3 -3
- package/dist/cjs/api/{resources/form/client/requests → types}/FormDetectJsonInput.d.ts +2 -2
- package/dist/cjs/api/{resources/form/client/requests → types}/FormFillJsonInput.d.ts +3 -5
- package/dist/cjs/api/types/PipelineStepBatchExtractConfig.d.ts +2 -0
- package/dist/cjs/api/types/index.d.ts +3 -3
- package/dist/cjs/api/types/index.js +3 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +8 -2
- package/dist/esm/api/client/requests/ExtractAsyncRequest.d.mts +2 -0
- package/dist/esm/api/client/requests/ExtractRequest.d.mts +2 -0
- package/dist/esm/api/resources/form/client/Client.d.mts +47 -24
- package/dist/esm/api/resources/form/client/Client.mjs +124 -40
- package/dist/esm/api/{types → resources/form/client/requests}/FormClearMultipartInput.d.mts +6 -6
- package/dist/esm/api/{types → resources/form/client/requests}/FormDetectMultipartInput.d.mts +6 -5
- package/dist/esm/api/{types → resources/form/client/requests}/FormFillMultipartInput.d.mts +9 -7
- package/dist/esm/api/resources/form/client/requests/index.d.mts +3 -3
- package/dist/esm/api/types/ExtractInput.d.mts +2 -0
- package/dist/esm/api/types/ExtractOptions.d.mts +2 -0
- package/dist/esm/api/{resources/form/client/requests → types}/FormClearJsonInput.d.mts +3 -3
- package/dist/esm/api/{resources/form/client/requests → types}/FormDetectJsonInput.d.mts +2 -2
- package/dist/esm/api/{resources/form/client/requests → types}/FormFillJsonInput.d.mts +3 -5
- package/dist/esm/api/types/PipelineStepBatchExtractConfig.d.mts +2 -0
- package/dist/esm/api/types/index.d.mts +3 -3
- package/dist/esm/api/types/index.mjs +3 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +41 -21
- /package/dist/cjs/api/{types → resources/form/client/requests}/FormClearMultipartInput.js +0 -0
- /package/dist/cjs/api/{types → resources/form/client/requests}/FormDetectMultipartInput.js +0 -0
- /package/dist/cjs/api/{types → resources/form/client/requests}/FormFillMultipartInput.js +0 -0
- /package/dist/cjs/api/{resources/form/client/requests → types}/FormClearJsonInput.js +0 -0
- /package/dist/cjs/api/{resources/form/client/requests → types}/FormDetectJsonInput.js +0 -0
- /package/dist/cjs/api/{resources/form/client/requests → types}/FormFillJsonInput.js +0 -0
- /package/dist/esm/api/{types → resources/form/client/requests}/FormClearMultipartInput.mjs +0 -0
- /package/dist/esm/api/{types → resources/form/client/requests}/FormDetectMultipartInput.mjs +0 -0
- /package/dist/esm/api/{types → resources/form/client/requests}/FormFillMultipartInput.mjs +0 -0
- /package/dist/esm/api/{resources/form/client/requests → types}/FormClearJsonInput.mjs +0 -0
- /package/dist/esm/api/{resources/form/client/requests → types}/FormDetectJsonInput.mjs +0 -0
- /package/dist/esm/api/{resources/form/client/requests → types}/FormFillJsonInput.mjs +0 -0
|
@@ -32,9 +32,9 @@ __exportStar(require("./ExtractResultCore.js"), exports);
|
|
|
32
32
|
__exportStar(require("./ExtractSource.js"), exports);
|
|
33
33
|
__exportStar(require("./FormCell.js"), exports);
|
|
34
34
|
__exportStar(require("./FormCheckboxDetail.js"), exports);
|
|
35
|
-
__exportStar(require("./
|
|
36
|
-
__exportStar(require("./
|
|
37
|
-
__exportStar(require("./
|
|
35
|
+
__exportStar(require("./FormClearJsonInput.js"), exports);
|
|
36
|
+
__exportStar(require("./FormDetectJsonInput.js"), exports);
|
|
37
|
+
__exportStar(require("./FormFillJsonInput.js"), exports);
|
|
38
38
|
__exportStar(require("./FormFillSharedOptions.js"), exports);
|
|
39
39
|
__exportStar(require("./FormPlanInfo.js"), exports);
|
|
40
40
|
__exportStar(require("./FormResult.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.12";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -93,6 +93,9 @@ export class PulseClient {
|
|
|
93
93
|
if (request.model != null) {
|
|
94
94
|
_request.append("model", request.model);
|
|
95
95
|
}
|
|
96
|
+
if (request.extractionConfigId != null) {
|
|
97
|
+
_request.append("extractionConfigId", request.extractionConfigId);
|
|
98
|
+
}
|
|
96
99
|
if (request.pages != null) {
|
|
97
100
|
_request.append("pages", request.pages);
|
|
98
101
|
}
|
|
@@ -115,7 +118,7 @@ export class PulseClient {
|
|
|
115
118
|
_request.append("structuredOutput", toJson(request.structuredOutput));
|
|
116
119
|
}
|
|
117
120
|
if (request.schema != null) {
|
|
118
|
-
_request.append("schema",
|
|
121
|
+
_request.append("schema", toJson(request.schema));
|
|
119
122
|
}
|
|
120
123
|
if (request.schemaPrompt != null) {
|
|
121
124
|
_request.append("schemaPrompt", request.schemaPrompt);
|
|
@@ -221,6 +224,9 @@ export class PulseClient {
|
|
|
221
224
|
if (request.model != null) {
|
|
222
225
|
_request.append("model", request.model);
|
|
223
226
|
}
|
|
227
|
+
if (request.extractionConfigId != null) {
|
|
228
|
+
_request.append("extractionConfigId", request.extractionConfigId);
|
|
229
|
+
}
|
|
224
230
|
if (request.pages != null) {
|
|
225
231
|
_request.append("pages", request.pages);
|
|
226
232
|
}
|
|
@@ -243,7 +249,7 @@ export class PulseClient {
|
|
|
243
249
|
_request.append("structuredOutput", toJson(request.structuredOutput));
|
|
244
250
|
}
|
|
245
251
|
if (request.schema != null) {
|
|
246
|
-
_request.append("schema",
|
|
252
|
+
_request.append("schema", toJson(request.schema));
|
|
247
253
|
}
|
|
248
254
|
if (request.schemaPrompt != null) {
|
|
249
255
|
_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`
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* - `
|
|
30
|
-
*
|
|
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.
|
|
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
|
-
*
|
|
59
|
+
* import { createReadStream } from "fs";
|
|
60
|
+
* await client.form.detect({})
|
|
54
61
|
*/
|
|
55
|
-
detect(request
|
|
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`
|
|
65
|
-
*
|
|
66
|
-
*
|
|
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
|
-
* - `
|
|
69
|
-
*
|
|
70
|
-
*
|
|
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.
|
|
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.
|
|
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`
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* - `
|
|
113
|
-
*
|
|
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.
|
|
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
|
-
*
|
|
166
|
+
* import { createReadStream } from "fs";
|
|
167
|
+
* await client.form.clear({})
|
|
145
168
|
*/
|
|
146
|
-
clear(request
|
|
169
|
+
clear(request: Pulse.FormClearMultipartInput, requestOptions?: FormClient.RequestOptions): core.HttpResponsePromise<Pulse.FormResult>;
|
|
147
170
|
private __clear;
|
|
148
171
|
}
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
-
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
12
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../environments.mjs";
|
|
15
15
|
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
@@ -32,11 +32,17 @@ export class FormClient {
|
|
|
32
32
|
* path and reuse the cached cells.
|
|
33
33
|
*
|
|
34
34
|
* **Input modes** — provide exactly one of:
|
|
35
|
-
* - `form_id`
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* - `
|
|
39
|
-
*
|
|
35
|
+
* - `form_id` — re-detect cells on a previously stored PDF.
|
|
36
|
+
* Useful when callers want to refresh layout after editing or
|
|
37
|
+
* when chaining detect calls.
|
|
38
|
+
* - `file_url` — public or pre-signed URL Pulse will download.
|
|
39
|
+
* - `file` — direct binary upload of the PDF.
|
|
40
|
+
*
|
|
41
|
+
* All three input modes ride on the same `multipart/form-data`
|
|
42
|
+
* request body. (Callers sending `Content-Type: application/json`
|
|
43
|
+
* with `form_id` / `file_url` are still accepted server-side for
|
|
44
|
+
* backward compatibility, but the SDKs only model the multipart
|
|
45
|
+
* form.)
|
|
40
46
|
*
|
|
41
47
|
* Optional `page_range` (alias `pages`, e.g. `"1-3,5"`) restricts
|
|
42
48
|
* the operation to a subset of pages.
|
|
@@ -48,7 +54,7 @@ export class FormClient {
|
|
|
48
54
|
* Billed at **1 credit per page**. Requires the `form_filler`
|
|
49
55
|
* feature flag to be enabled for your organization.
|
|
50
56
|
*
|
|
51
|
-
* @param {Pulse.
|
|
57
|
+
* @param {Pulse.FormDetectMultipartInput} request
|
|
52
58
|
* @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
53
59
|
*
|
|
54
60
|
* @throws {@link Pulse.BadRequestError}
|
|
@@ -59,24 +65,42 @@ export class FormClient {
|
|
|
59
65
|
* @throws {@link Pulse.InternalServerError}
|
|
60
66
|
*
|
|
61
67
|
* @example
|
|
62
|
-
*
|
|
68
|
+
* import { createReadStream } from "fs";
|
|
69
|
+
* await client.form.detect({})
|
|
63
70
|
*/
|
|
64
|
-
detect(request
|
|
71
|
+
detect(request, requestOptions) {
|
|
65
72
|
return core.HttpResponsePromise.fromPromise(this.__detect(request, requestOptions));
|
|
66
73
|
}
|
|
67
|
-
__detect() {
|
|
68
|
-
return __awaiter(this,
|
|
74
|
+
__detect(request, requestOptions) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
76
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
77
|
+
const _request = yield core.newFormData();
|
|
78
|
+
if (request.file != null) {
|
|
79
|
+
yield _request.appendFile("file", request.file);
|
|
80
|
+
}
|
|
81
|
+
if (request.file_url != null) {
|
|
82
|
+
_request.append("file_url", request.file_url);
|
|
83
|
+
}
|
|
84
|
+
if (request.form_id != null) {
|
|
85
|
+
_request.append("form_id", request.form_id);
|
|
86
|
+
}
|
|
87
|
+
if (request.page_range != null) {
|
|
88
|
+
_request.append("page_range", request.page_range);
|
|
89
|
+
}
|
|
90
|
+
if (request.async != null) {
|
|
91
|
+
_request.append("async", request.async);
|
|
92
|
+
}
|
|
93
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
70
94
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
71
|
-
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
95
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
72
96
|
const _response = yield core.fetcher({
|
|
73
97
|
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"),
|
|
74
98
|
method: "POST",
|
|
75
99
|
headers: _headers,
|
|
76
|
-
contentType: "application/json",
|
|
77
100
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
78
|
-
requestType: "
|
|
79
|
-
|
|
101
|
+
requestType: "file",
|
|
102
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
103
|
+
body: _maybeEncodedRequest.body,
|
|
80
104
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
|
|
81
105
|
? requestOptions.timeoutInSeconds * 1000
|
|
82
106
|
: ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
|
|
@@ -122,13 +146,20 @@ export class FormClient {
|
|
|
122
146
|
* are rendered as an overlay using detected cells from OCR).
|
|
123
147
|
*
|
|
124
148
|
* **Input modes** — provide exactly one of:
|
|
125
|
-
* - `form_id`
|
|
126
|
-
*
|
|
127
|
-
*
|
|
149
|
+
* - `form_id` — reuse a previously processed form from a prior
|
|
150
|
+
* `/form/detect`, `/form/fill`, or `/form/clear` call. Skips
|
|
151
|
+
* re-detection (fast path); the cached `form_fields` are
|
|
128
152
|
* reused.
|
|
129
|
-
* - `
|
|
130
|
-
*
|
|
131
|
-
*
|
|
153
|
+
* - `file_url` — public or pre-signed URL of a PDF Pulse will
|
|
154
|
+
* download.
|
|
155
|
+
* - `file` — direct binary upload of the PDF. Pulse runs cell
|
|
156
|
+
* detection internally before filling.
|
|
157
|
+
*
|
|
158
|
+
* All three input modes ride on the same `multipart/form-data`
|
|
159
|
+
* request body. (Callers sending `Content-Type: application/json`
|
|
160
|
+
* with `form_id` / `file_url` are still accepted server-side for
|
|
161
|
+
* backward compatibility, but the SDKs only model the multipart
|
|
162
|
+
* form.)
|
|
132
163
|
*
|
|
133
164
|
* Optional `form_fields` lets callers supply or edit the detected
|
|
134
165
|
* cells before filling. Optional `page_range` (alias `pages`,
|
|
@@ -142,7 +173,7 @@ export class FormClient {
|
|
|
142
173
|
* Billed at **3 credits per page**. Requires the `form_filler`
|
|
143
174
|
* feature flag to be enabled for your organization.
|
|
144
175
|
*
|
|
145
|
-
* @param {Pulse.
|
|
176
|
+
* @param {Pulse.FormFillMultipartInput} request
|
|
146
177
|
* @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
147
178
|
*
|
|
148
179
|
* @throws {@link Pulse.BadRequestError}
|
|
@@ -153,6 +184,7 @@ export class FormClient {
|
|
|
153
184
|
* @throws {@link Pulse.InternalServerError}
|
|
154
185
|
*
|
|
155
186
|
* @example
|
|
187
|
+
* import { createReadStream } from "fs";
|
|
156
188
|
* await client.form.fill({
|
|
157
189
|
* instructions: "instructions"
|
|
158
190
|
* })
|
|
@@ -163,16 +195,37 @@ export class FormClient {
|
|
|
163
195
|
__fill(request, requestOptions) {
|
|
164
196
|
return __awaiter(this, void 0, void 0, function* () {
|
|
165
197
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
198
|
+
const _request = yield core.newFormData();
|
|
199
|
+
if (request.file != null) {
|
|
200
|
+
yield _request.appendFile("file", request.file);
|
|
201
|
+
}
|
|
202
|
+
if (request.file_url != null) {
|
|
203
|
+
_request.append("file_url", request.file_url);
|
|
204
|
+
}
|
|
205
|
+
if (request.form_id != null) {
|
|
206
|
+
_request.append("form_id", request.form_id);
|
|
207
|
+
}
|
|
208
|
+
_request.append("instructions", request.instructions);
|
|
209
|
+
if (request.form_fields != null) {
|
|
210
|
+
_request.append("form_fields", request.form_fields);
|
|
211
|
+
}
|
|
212
|
+
if (request.page_range != null) {
|
|
213
|
+
_request.append("page_range", request.page_range);
|
|
214
|
+
}
|
|
215
|
+
if (request.async != null) {
|
|
216
|
+
_request.append("async", request.async);
|
|
217
|
+
}
|
|
218
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
166
219
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
167
|
-
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
220
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
168
221
|
const _response = yield core.fetcher({
|
|
169
222
|
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"),
|
|
170
223
|
method: "POST",
|
|
171
224
|
headers: _headers,
|
|
172
|
-
contentType: "application/json",
|
|
173
225
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
174
|
-
requestType: "
|
|
175
|
-
|
|
226
|
+
requestType: "file",
|
|
227
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
228
|
+
body: _maybeEncodedRequest.body,
|
|
176
229
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
|
|
177
230
|
? requestOptions.timeoutInSeconds * 1000
|
|
178
231
|
: ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
|
|
@@ -219,11 +272,18 @@ export class FormClient {
|
|
|
219
272
|
* preserved.
|
|
220
273
|
*
|
|
221
274
|
* **Input modes** — provide exactly one of:
|
|
222
|
-
* - `form_id`
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* - `
|
|
226
|
-
*
|
|
275
|
+
* - `form_id` — reuse a previously processed form from a prior
|
|
276
|
+
* `/form/detect`, `/form/fill`, or `/form/clear` call (fast
|
|
277
|
+
* path; cached layout reused).
|
|
278
|
+
* - `file_url` — public or pre-signed URL of a PDF Pulse will
|
|
279
|
+
* download.
|
|
280
|
+
* - `file` — direct binary upload of the PDF.
|
|
281
|
+
*
|
|
282
|
+
* All three input modes ride on the same `multipart/form-data`
|
|
283
|
+
* request body. (Callers sending `Content-Type: application/json`
|
|
284
|
+
* with `form_id` / `file_url` are still accepted server-side for
|
|
285
|
+
* backward compatibility, but the SDKs only model the multipart
|
|
286
|
+
* form.)
|
|
227
287
|
*
|
|
228
288
|
* `instructions` is optional. When omitted, Pulse clears every
|
|
229
289
|
* user-filled field deterministically (no LLM call) on AcroForm
|
|
@@ -243,7 +303,7 @@ export class FormClient {
|
|
|
243
303
|
* Billed at **3 credits per page**. Requires the `form_filler`
|
|
244
304
|
* feature flag to be enabled for your organization.
|
|
245
305
|
*
|
|
246
|
-
* @param {Pulse.
|
|
306
|
+
* @param {Pulse.FormClearMultipartInput} request
|
|
247
307
|
* @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
248
308
|
*
|
|
249
309
|
* @throws {@link Pulse.BadRequestError}
|
|
@@ -254,24 +314,48 @@ export class FormClient {
|
|
|
254
314
|
* @throws {@link Pulse.InternalServerError}
|
|
255
315
|
*
|
|
256
316
|
* @example
|
|
257
|
-
*
|
|
317
|
+
* import { createReadStream } from "fs";
|
|
318
|
+
* await client.form.clear({})
|
|
258
319
|
*/
|
|
259
|
-
clear(request
|
|
320
|
+
clear(request, requestOptions) {
|
|
260
321
|
return core.HttpResponsePromise.fromPromise(this.__clear(request, requestOptions));
|
|
261
322
|
}
|
|
262
|
-
__clear() {
|
|
263
|
-
return __awaiter(this,
|
|
323
|
+
__clear(request, requestOptions) {
|
|
324
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
264
325
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
326
|
+
const _request = yield core.newFormData();
|
|
327
|
+
if (request.file != null) {
|
|
328
|
+
yield _request.appendFile("file", request.file);
|
|
329
|
+
}
|
|
330
|
+
if (request.file_url != null) {
|
|
331
|
+
_request.append("file_url", request.file_url);
|
|
332
|
+
}
|
|
333
|
+
if (request.form_id != null) {
|
|
334
|
+
_request.append("form_id", request.form_id);
|
|
335
|
+
}
|
|
336
|
+
if (request.instructions != null) {
|
|
337
|
+
_request.append("instructions", request.instructions);
|
|
338
|
+
}
|
|
339
|
+
if (request.form_fields != null) {
|
|
340
|
+
_request.append("form_fields", request.form_fields);
|
|
341
|
+
}
|
|
342
|
+
if (request.page_range != null) {
|
|
343
|
+
_request.append("page_range", request.page_range);
|
|
344
|
+
}
|
|
345
|
+
if (request.async != null) {
|
|
346
|
+
_request.append("async", request.async);
|
|
347
|
+
}
|
|
348
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
265
349
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
266
|
-
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
350
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
267
351
|
const _response = yield core.fetcher({
|
|
268
352
|
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"),
|
|
269
353
|
method: "POST",
|
|
270
354
|
headers: _headers,
|
|
271
|
-
contentType: "application/json",
|
|
272
355
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
273
|
-
requestType: "
|
|
274
|
-
|
|
356
|
+
requestType: "file",
|
|
357
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
358
|
+
body: _maybeEncodedRequest.body,
|
|
275
359
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
|
|
276
360
|
? requestOptions.timeoutInSeconds * 1000
|
|
277
361
|
: ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import type * as core from "../../../../../core/index.mjs";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* `file_url`, or `form_id`.
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
5
|
*/
|
|
6
6
|
export interface FormClearMultipartInput {
|
|
7
|
-
/**
|
|
8
|
-
file?:
|
|
9
|
-
/**
|
|
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;
|
package/dist/esm/api/{types → resources/form/client/requests}/FormDetectMultipartInput.d.mts
RENAMED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type * as core from "../../../../../core/index.mjs";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
4
5
|
*/
|
|
5
6
|
export interface FormDetectMultipartInput {
|
|
6
|
-
/**
|
|
7
|
-
file?:
|
|
8
|
-
/**
|
|
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.mjs";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* instructions: "instructions"
|
|
6
|
+
* }
|
|
5
7
|
*/
|
|
6
8
|
export interface FormFillMultipartInput {
|
|
7
|
-
/**
|
|
8
|
-
file?:
|
|
9
|
-
/**
|
|
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
|
|
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 {
|
|
2
|
-
export type {
|
|
3
|
-
export type {
|
|
1
|
+
export type { FormClearMultipartInput } from "./FormClearMultipartInput.mjs";
|
|
2
|
+
export type { FormDetectMultipartInput } from "./FormDetectMultipartInput.mjs";
|
|
3
|
+
export type { FormFillMultipartInput } from "./FormFillMultipartInput.mjs";
|
|
@@ -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 "
|
|
1
|
+
import type * as Pulse from "../index.mjs";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
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
|
-
*
|
|
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 "
|
|
1
|
+
import type * as Pulse from "../index.mjs";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
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.mjs";
|
|
|
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. */
|