pulse-ts-sdk 1.0.8 → 1.0.10
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 +22 -22
- package/dist/cjs/BaseClient.js +3 -2
- package/dist/cjs/Client.d.ts +12 -0
- package/dist/cjs/Client.js +78 -28
- package/dist/cjs/api/client/requests/ExtractAsyncRequest.d.ts +17 -5
- package/dist/cjs/api/client/requests/ExtractAsyncRequest.js +3 -2
- package/dist/cjs/api/client/requests/ExtractRequest.d.ts +17 -5
- package/dist/cjs/api/client/requests/ExtractRequest.js +3 -2
- package/dist/cjs/api/errors/GoneError.d.ts +6 -0
- package/dist/cjs/api/errors/GoneError.js +54 -0
- package/dist/cjs/api/errors/index.d.ts +1 -0
- package/dist/cjs/api/errors/index.js +1 -0
- package/dist/cjs/api/resources/batch/client/Client.js +32 -16
- package/dist/cjs/api/resources/form/client/Client.d.ts +148 -0
- package/dist/cjs/api/resources/form/client/Client.js +350 -0
- package/dist/cjs/api/resources/form/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/form/client/index.js +17 -0
- package/dist/cjs/api/resources/form/client/requests/FormClearJsonInput.d.ts +19 -0
- package/dist/cjs/api/resources/form/client/requests/FormClearJsonInput.js +3 -0
- package/dist/cjs/api/resources/form/client/requests/FormDetectJsonInput.d.ts +14 -0
- package/dist/cjs/api/resources/form/client/requests/FormDetectJsonInput.js +3 -0
- package/dist/cjs/api/resources/form/client/requests/FormFillJsonInput.d.ts +21 -0
- package/dist/cjs/api/resources/form/client/requests/FormFillJsonInput.js +3 -0
- package/dist/cjs/api/resources/form/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/form/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/form/index.d.ts +1 -0
- package/dist/cjs/api/resources/form/index.js +17 -0
- package/dist/cjs/api/resources/index.d.ts +8 -0
- package/dist/cjs/api/resources/index.js +9 -1
- package/dist/cjs/api/resources/jobs/client/Client.js +16 -8
- package/dist/cjs/api/resources/largeResults/client/Client.d.ts +41 -0
- package/dist/cjs/api/resources/largeResults/client/Client.js +131 -0
- package/dist/cjs/api/resources/largeResults/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/largeResults/client/index.js +17 -0
- package/dist/cjs/api/resources/largeResults/client/requests/GetLargeResultLargeResultsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/largeResults/client/requests/GetLargeResultLargeResultsRequest.js +3 -0
- package/dist/cjs/api/resources/largeResults/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/largeResults/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/largeResults/index.d.ts +1 -0
- package/dist/cjs/api/resources/largeResults/index.js +17 -0
- package/dist/cjs/api/resources/pipeline/client/Client.d.ts +57 -0
- package/dist/cjs/api/resources/pipeline/client/Client.js +151 -0
- package/dist/cjs/api/resources/pipeline/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/pipeline/client/index.js +17 -0
- package/dist/cjs/api/resources/pipeline/client/requests/PipelineExecuteInput.d.ts +17 -0
- package/dist/cjs/api/resources/pipeline/client/requests/PipelineExecuteInput.js +3 -0
- package/dist/cjs/api/resources/pipeline/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/pipeline/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/pipeline/index.d.ts +1 -0
- package/dist/cjs/api/resources/pipeline/index.js +17 -0
- package/dist/cjs/api/resources/results/client/Client.d.ts +27 -0
- package/dist/cjs/api/resources/results/client/Client.js +116 -0
- package/dist/cjs/api/resources/results/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/results/client/index.js +17 -0
- package/dist/cjs/api/resources/results/client/requests/GetPdfResultsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/results/client/requests/GetPdfResultsRequest.js +3 -0
- package/dist/cjs/api/resources/results/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/results/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/results/index.d.ts +1 -0
- package/dist/cjs/api/resources/results/index.js +17 -0
- package/dist/cjs/api/resources/webhooks/client/Client.js +8 -4
- package/dist/cjs/api/types/AsyncSubmissionResponse.d.ts +2 -0
- package/dist/cjs/api/types/ExtractInput.d.ts +17 -5
- package/dist/cjs/api/types/ExtractInput.js +3 -2
- package/dist/cjs/api/types/ExtractLargeResultResponse.d.ts +25 -0
- package/dist/cjs/api/types/ExtractLargeResultResponse.js +3 -0
- package/dist/cjs/api/types/ExtractOptions.d.ts +17 -5
- package/dist/cjs/api/types/ExtractOptions.js +3 -2
- package/dist/cjs/api/types/ExtractResponse.d.ts +3 -3
- package/dist/cjs/api/types/ExtractResultCore.d.ts +112 -0
- package/dist/cjs/api/types/ExtractResultCore.js +3 -0
- package/dist/cjs/api/types/FormCell.d.ts +40 -0
- package/dist/cjs/api/types/FormCell.js +13 -0
- package/dist/cjs/api/types/FormCheckboxDetail.d.ts +11 -0
- package/dist/cjs/api/types/FormCheckboxDetail.js +3 -0
- package/dist/cjs/api/types/FormClearMultipartInput.d.ts +21 -0
- package/dist/cjs/api/types/FormClearMultipartInput.js +3 -0
- package/dist/cjs/api/types/FormDetectMultipartInput.d.ts +16 -0
- package/dist/cjs/api/types/FormDetectMultipartInput.js +3 -0
- package/dist/cjs/api/types/FormFillMultipartInput.d.ts +21 -0
- package/dist/cjs/api/types/FormFillMultipartInput.js +3 -0
- package/dist/cjs/api/types/FormFillSharedOptions.d.ts +12 -0
- package/dist/cjs/api/types/FormFillSharedOptions.js +3 -0
- package/dist/cjs/api/types/FormPlanInfo.d.ts +11 -0
- package/dist/cjs/api/types/FormPlanInfo.js +3 -0
- package/dist/cjs/api/types/FormResult.d.ts +24 -0
- package/dist/cjs/api/types/FormResult.js +3 -0
- package/dist/cjs/api/types/FormSharedOptions.d.ts +9 -0
- package/dist/cjs/api/types/FormSharedOptions.js +3 -0
- package/dist/cjs/api/types/GoneErrorBody.d.ts +9 -0
- package/dist/cjs/api/types/GoneErrorBody.js +3 -0
- package/dist/cjs/api/types/JobStatusResponse.d.ts +1 -1
- package/dist/cjs/api/types/PipelineBatchExtractResult.d.ts +13 -0
- package/dist/cjs/api/types/PipelineBatchExtractResult.js +3 -0
- package/dist/cjs/api/types/PipelineExecuteMultipartInput.d.ts +13 -0
- package/dist/cjs/api/types/PipelineExecuteMultipartInput.js +3 -0
- package/dist/cjs/api/types/PipelineExecuteResponse.d.ts +21 -0
- package/dist/cjs/api/types/PipelineExecuteResponse.js +11 -0
- package/dist/cjs/api/types/PipelineExtractResult.d.ts +118 -0
- package/dist/cjs/api/types/PipelineExtractResult.js +3 -0
- package/dist/cjs/api/types/PipelineResults.d.ts +16 -0
- package/dist/cjs/api/types/PipelineResults.js +3 -0
- package/dist/cjs/api/types/PipelineSchemaResult.d.ts +14 -0
- package/dist/cjs/api/types/PipelineSchemaResult.js +3 -0
- package/dist/cjs/api/types/PipelineSplitResult.d.ts +18 -0
- package/dist/cjs/api/types/PipelineSplitResult.js +3 -0
- package/dist/cjs/api/types/PipelineStepBatchExtractConfig.d.ts +147 -0
- package/dist/cjs/api/types/PipelineStepBatchExtractConfig.js +27 -0
- package/dist/cjs/api/types/PipelineSteps.d.ts +16 -0
- package/dist/cjs/api/types/PipelineSteps.js +3 -0
- package/dist/cjs/api/types/PipelineTablesResult.d.ts +33 -0
- package/dist/cjs/api/types/PipelineTablesResult.js +3 -0
- package/dist/cjs/api/types/SingleSchemaResponse.d.ts +2 -0
- package/dist/cjs/api/types/SplitResponse.d.ts +1 -6
- package/dist/cjs/api/types/SplitResultCore.d.ts +12 -0
- package/dist/cjs/api/types/SplitResultCore.js +3 -0
- package/dist/cjs/api/types/SplitSchemaResponse.d.ts +2 -0
- package/dist/cjs/api/types/TablesConfig.d.ts +5 -2
- package/dist/cjs/api/types/TablesConfig.js +2 -1
- package/dist/cjs/api/types/TablesResponse.d.ts +4 -2
- package/dist/cjs/api/types/index.d.ts +23 -0
- package/dist/cjs/api/types/index.js +23 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +3 -2
- package/dist/esm/Client.d.mts +12 -0
- package/dist/esm/Client.mjs +74 -24
- package/dist/esm/api/client/requests/ExtractAsyncRequest.d.mts +17 -5
- package/dist/esm/api/client/requests/ExtractAsyncRequest.mjs +3 -2
- package/dist/esm/api/client/requests/ExtractRequest.d.mts +17 -5
- package/dist/esm/api/client/requests/ExtractRequest.mjs +3 -2
- package/dist/esm/api/errors/GoneError.d.mts +6 -0
- package/dist/esm/api/errors/GoneError.mjs +17 -0
- package/dist/esm/api/errors/index.d.mts +1 -0
- package/dist/esm/api/errors/index.mjs +1 -0
- package/dist/esm/api/resources/batch/client/Client.mjs +32 -16
- package/dist/esm/api/resources/form/client/Client.d.mts +148 -0
- package/dist/esm/api/resources/form/client/Client.mjs +313 -0
- package/dist/esm/api/resources/form/client/index.d.mts +1 -0
- package/dist/esm/api/resources/form/client/index.mjs +1 -0
- package/dist/esm/api/resources/form/client/requests/FormClearJsonInput.d.mts +19 -0
- package/dist/esm/api/resources/form/client/requests/FormClearJsonInput.mjs +2 -0
- package/dist/esm/api/resources/form/client/requests/FormDetectJsonInput.d.mts +14 -0
- package/dist/esm/api/resources/form/client/requests/FormDetectJsonInput.mjs +2 -0
- package/dist/esm/api/resources/form/client/requests/FormFillJsonInput.d.mts +21 -0
- package/dist/esm/api/resources/form/client/requests/FormFillJsonInput.mjs +2 -0
- package/dist/esm/api/resources/form/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/form/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/form/index.d.mts +1 -0
- package/dist/esm/api/resources/form/index.mjs +1 -0
- package/dist/esm/api/resources/index.d.mts +8 -0
- package/dist/esm/api/resources/index.mjs +8 -0
- package/dist/esm/api/resources/jobs/client/Client.mjs +16 -8
- package/dist/esm/api/resources/largeResults/client/Client.d.mts +41 -0
- package/dist/esm/api/resources/largeResults/client/Client.mjs +94 -0
- package/dist/esm/api/resources/largeResults/client/index.d.mts +1 -0
- package/dist/esm/api/resources/largeResults/client/index.mjs +1 -0
- package/dist/esm/api/resources/largeResults/client/requests/GetLargeResultLargeResultsRequest.d.mts +10 -0
- package/dist/esm/api/resources/largeResults/client/requests/GetLargeResultLargeResultsRequest.mjs +2 -0
- package/dist/esm/api/resources/largeResults/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/largeResults/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/largeResults/index.d.mts +1 -0
- package/dist/esm/api/resources/largeResults/index.mjs +1 -0
- package/dist/esm/api/resources/pipeline/client/Client.d.mts +57 -0
- package/dist/esm/api/resources/pipeline/client/Client.mjs +114 -0
- package/dist/esm/api/resources/pipeline/client/index.d.mts +1 -0
- package/dist/esm/api/resources/pipeline/client/index.mjs +1 -0
- package/dist/esm/api/resources/pipeline/client/requests/PipelineExecuteInput.d.mts +17 -0
- package/dist/esm/api/resources/pipeline/client/requests/PipelineExecuteInput.mjs +2 -0
- package/dist/esm/api/resources/pipeline/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/pipeline/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/pipeline/index.d.mts +1 -0
- package/dist/esm/api/resources/pipeline/index.mjs +1 -0
- package/dist/esm/api/resources/results/client/Client.d.mts +27 -0
- package/dist/esm/api/resources/results/client/Client.mjs +79 -0
- package/dist/esm/api/resources/results/client/index.d.mts +1 -0
- package/dist/esm/api/resources/results/client/index.mjs +1 -0
- package/dist/esm/api/resources/results/client/requests/GetPdfResultsRequest.d.mts +10 -0
- package/dist/esm/api/resources/results/client/requests/GetPdfResultsRequest.mjs +2 -0
- package/dist/esm/api/resources/results/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/results/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/results/index.d.mts +1 -0
- package/dist/esm/api/resources/results/index.mjs +1 -0
- package/dist/esm/api/resources/webhooks/client/Client.mjs +8 -4
- package/dist/esm/api/types/AsyncSubmissionResponse.d.mts +2 -0
- package/dist/esm/api/types/ExtractInput.d.mts +17 -5
- package/dist/esm/api/types/ExtractInput.mjs +3 -2
- package/dist/esm/api/types/ExtractLargeResultResponse.d.mts +25 -0
- package/dist/esm/api/types/ExtractLargeResultResponse.mjs +2 -0
- package/dist/esm/api/types/ExtractOptions.d.mts +17 -5
- package/dist/esm/api/types/ExtractOptions.mjs +3 -2
- package/dist/esm/api/types/ExtractResponse.d.mts +3 -3
- package/dist/esm/api/types/ExtractResultCore.d.mts +112 -0
- package/dist/esm/api/types/ExtractResultCore.mjs +2 -0
- package/dist/esm/api/types/FormCell.d.mts +40 -0
- package/dist/esm/api/types/FormCell.mjs +10 -0
- package/dist/esm/api/types/FormCheckboxDetail.d.mts +11 -0
- package/dist/esm/api/types/FormCheckboxDetail.mjs +2 -0
- package/dist/esm/api/types/FormClearMultipartInput.d.mts +21 -0
- package/dist/esm/api/types/FormClearMultipartInput.mjs +2 -0
- package/dist/esm/api/types/FormDetectMultipartInput.d.mts +16 -0
- package/dist/esm/api/types/FormDetectMultipartInput.mjs +2 -0
- package/dist/esm/api/types/FormFillMultipartInput.d.mts +21 -0
- package/dist/esm/api/types/FormFillMultipartInput.mjs +2 -0
- package/dist/esm/api/types/FormFillSharedOptions.d.mts +12 -0
- package/dist/esm/api/types/FormFillSharedOptions.mjs +2 -0
- package/dist/esm/api/types/FormPlanInfo.d.mts +11 -0
- package/dist/esm/api/types/FormPlanInfo.mjs +2 -0
- package/dist/esm/api/types/FormResult.d.mts +24 -0
- package/dist/esm/api/types/FormResult.mjs +2 -0
- package/dist/esm/api/types/FormSharedOptions.d.mts +9 -0
- package/dist/esm/api/types/FormSharedOptions.mjs +2 -0
- package/dist/esm/api/types/GoneErrorBody.d.mts +9 -0
- package/dist/esm/api/types/GoneErrorBody.mjs +2 -0
- package/dist/esm/api/types/JobStatusResponse.d.mts +1 -1
- package/dist/esm/api/types/PipelineBatchExtractResult.d.mts +13 -0
- package/dist/esm/api/types/PipelineBatchExtractResult.mjs +2 -0
- package/dist/esm/api/types/PipelineExecuteMultipartInput.d.mts +13 -0
- package/dist/esm/api/types/PipelineExecuteMultipartInput.mjs +2 -0
- package/dist/esm/api/types/PipelineExecuteResponse.d.mts +21 -0
- package/dist/esm/api/types/PipelineExecuteResponse.mjs +8 -0
- package/dist/esm/api/types/PipelineExtractResult.d.mts +118 -0
- package/dist/esm/api/types/PipelineExtractResult.mjs +2 -0
- package/dist/esm/api/types/PipelineResults.d.mts +16 -0
- package/dist/esm/api/types/PipelineResults.mjs +2 -0
- package/dist/esm/api/types/PipelineSchemaResult.d.mts +14 -0
- package/dist/esm/api/types/PipelineSchemaResult.mjs +2 -0
- package/dist/esm/api/types/PipelineSplitResult.d.mts +18 -0
- package/dist/esm/api/types/PipelineSplitResult.mjs +2 -0
- package/dist/esm/api/types/PipelineStepBatchExtractConfig.d.mts +147 -0
- package/dist/esm/api/types/PipelineStepBatchExtractConfig.mjs +24 -0
- package/dist/esm/api/types/PipelineSteps.d.mts +16 -0
- package/dist/esm/api/types/PipelineSteps.mjs +2 -0
- package/dist/esm/api/types/PipelineTablesResult.d.mts +33 -0
- package/dist/esm/api/types/PipelineTablesResult.mjs +2 -0
- package/dist/esm/api/types/SingleSchemaResponse.d.mts +2 -0
- package/dist/esm/api/types/SplitResponse.d.mts +1 -6
- package/dist/esm/api/types/SplitResultCore.d.mts +12 -0
- package/dist/esm/api/types/SplitResultCore.mjs +2 -0
- package/dist/esm/api/types/SplitSchemaResponse.d.mts +2 -0
- package/dist/esm/api/types/TablesConfig.d.mts +5 -2
- package/dist/esm/api/types/TablesConfig.mjs +2 -1
- package/dist/esm/api/types/TablesResponse.d.mts +4 -2
- package/dist/esm/api/types/index.d.mts +23 -0
- package/dist/esm/api/types/index.mjs +23 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +513 -0
|
@@ -51,7 +51,7 @@ export class BatchClient {
|
|
|
51
51
|
}
|
|
52
52
|
__extract(request, requestOptions) {
|
|
53
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
55
55
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
56
56
|
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);
|
|
57
57
|
const _response = yield core.fetcher({
|
|
@@ -62,10 +62,14 @@ export class BatchClient {
|
|
|
62
62
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
63
63
|
requestType: "json",
|
|
64
64
|
body: request,
|
|
65
|
-
timeoutMs: (
|
|
66
|
-
|
|
65
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
|
|
66
|
+
? requestOptions.timeoutInSeconds * 1000
|
|
67
|
+
: ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
|
|
68
|
+
? ((_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) * 1000
|
|
69
|
+
: undefined,
|
|
70
|
+
maxRetries: (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.maxRetries,
|
|
67
71
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
68
|
-
fetchFn: (
|
|
72
|
+
fetchFn: (_h = this._options) === null || _h === void 0 ? void 0 : _h.fetch,
|
|
69
73
|
logging: this._options.logging,
|
|
70
74
|
});
|
|
71
75
|
if (_response.ok) {
|
|
@@ -127,7 +131,7 @@ export class BatchClient {
|
|
|
127
131
|
}
|
|
128
132
|
__schema(request, requestOptions) {
|
|
129
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
134
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
131
135
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
132
136
|
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);
|
|
133
137
|
const _response = yield core.fetcher({
|
|
@@ -138,10 +142,14 @@ export class BatchClient {
|
|
|
138
142
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
139
143
|
requestType: "json",
|
|
140
144
|
body: request,
|
|
141
|
-
timeoutMs: (
|
|
142
|
-
|
|
145
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
|
|
146
|
+
? requestOptions.timeoutInSeconds * 1000
|
|
147
|
+
: ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
|
|
148
|
+
? ((_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) * 1000
|
|
149
|
+
: undefined,
|
|
150
|
+
maxRetries: (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.maxRetries,
|
|
143
151
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
144
|
-
fetchFn: (
|
|
152
|
+
fetchFn: (_h = this._options) === null || _h === void 0 ? void 0 : _h.fetch,
|
|
145
153
|
logging: this._options.logging,
|
|
146
154
|
});
|
|
147
155
|
if (_response.ok) {
|
|
@@ -201,7 +209,7 @@ export class BatchClient {
|
|
|
201
209
|
}
|
|
202
210
|
__tables(request, requestOptions) {
|
|
203
211
|
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
212
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
205
213
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
206
214
|
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);
|
|
207
215
|
const _response = yield core.fetcher({
|
|
@@ -212,10 +220,14 @@ export class BatchClient {
|
|
|
212
220
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
213
221
|
requestType: "json",
|
|
214
222
|
body: request,
|
|
215
|
-
timeoutMs: (
|
|
216
|
-
|
|
223
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
|
|
224
|
+
? requestOptions.timeoutInSeconds * 1000
|
|
225
|
+
: ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
|
|
226
|
+
? ((_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) * 1000
|
|
227
|
+
: undefined,
|
|
228
|
+
maxRetries: (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.maxRetries,
|
|
217
229
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
218
|
-
fetchFn: (
|
|
230
|
+
fetchFn: (_h = this._options) === null || _h === void 0 ? void 0 : _h.fetch,
|
|
219
231
|
logging: this._options.logging,
|
|
220
232
|
});
|
|
221
233
|
if (_response.ok) {
|
|
@@ -280,7 +292,7 @@ export class BatchClient {
|
|
|
280
292
|
}
|
|
281
293
|
__split(request, requestOptions) {
|
|
282
294
|
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
295
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
284
296
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
285
297
|
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);
|
|
286
298
|
const _response = yield core.fetcher({
|
|
@@ -291,10 +303,14 @@ export class BatchClient {
|
|
|
291
303
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
292
304
|
requestType: "json",
|
|
293
305
|
body: request,
|
|
294
|
-
timeoutMs: (
|
|
295
|
-
|
|
306
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
|
|
307
|
+
? requestOptions.timeoutInSeconds * 1000
|
|
308
|
+
: ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
|
|
309
|
+
? ((_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) * 1000
|
|
310
|
+
: undefined,
|
|
311
|
+
maxRetries: (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.maxRetries,
|
|
296
312
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
297
|
-
fetchFn: (
|
|
313
|
+
fetchFn: (_h = this._options) === null || _h === void 0 ? void 0 : _h.fetch,
|
|
298
314
|
logging: this._options.logging,
|
|
299
315
|
});
|
|
300
316
|
if (_response.ok) {
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../core/index.mjs";
|
|
4
|
+
import * as Pulse from "../../../index.mjs";
|
|
5
|
+
export declare namespace FormClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class FormClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<FormClient.Options>;
|
|
12
|
+
constructor(options?: FormClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Run cell detection on a PDF and return the detected `form_fields`
|
|
15
|
+
* along with a reusable `form_id`. No LLM matching, no fill, no
|
|
16
|
+
* clear — this is the OCR / layout step that `/form/fill` and
|
|
17
|
+
* `/form/clear` would otherwise run internally.
|
|
18
|
+
*
|
|
19
|
+
* The returned `form_id` references the uploaded PDF and its
|
|
20
|
+
* detected layout, and can be passed back to a subsequent
|
|
21
|
+
* `/form/fill`, `/form/clear`, or `/form/detect` call as the
|
|
22
|
+
* single input source — Pulse will skip detection on the fast
|
|
23
|
+
* path and reuse the cached cells.
|
|
24
|
+
*
|
|
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.
|
|
31
|
+
*
|
|
32
|
+
* Optional `page_range` (alias `pages`, e.g. `"1-3,5"`) restricts
|
|
33
|
+
* the operation to a subset of pages.
|
|
34
|
+
*
|
|
35
|
+
* Synchronous by default — returns the detected layout inline.
|
|
36
|
+
* Set `async: true` to receive `{job_id, status: "pending"}`
|
|
37
|
+
* immediately and poll [GET /job/{jobId}](api:GET/job/{jobId}).
|
|
38
|
+
*
|
|
39
|
+
* Billed at **1 credit per page**. Requires the `form_filler`
|
|
40
|
+
* feature flag to be enabled for your organization.
|
|
41
|
+
*
|
|
42
|
+
* @param {Pulse.FormDetectJsonInput} request
|
|
43
|
+
* @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
44
|
+
*
|
|
45
|
+
* @throws {@link Pulse.BadRequestError}
|
|
46
|
+
* @throws {@link Pulse.UnauthorizedError}
|
|
47
|
+
* @throws {@link Pulse.ForbiddenError}
|
|
48
|
+
* @throws {@link Pulse.NotFoundError}
|
|
49
|
+
* @throws {@link Pulse.TooManyRequestsError}
|
|
50
|
+
* @throws {@link Pulse.InternalServerError}
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* await client.form.detect()
|
|
54
|
+
*/
|
|
55
|
+
detect(request?: Pulse.FormDetectJsonInput, requestOptions?: FormClient.RequestOptions): core.HttpResponsePromise<Pulse.FormResult>;
|
|
56
|
+
private __detect;
|
|
57
|
+
/**
|
|
58
|
+
* Fill the fields of a PDF form with values inferred from a natural
|
|
59
|
+
* language `instructions` prompt. Works on both AcroForm PDFs
|
|
60
|
+
* (true form fields are written) and flat/scanned PDFs (values
|
|
61
|
+
* are rendered as an overlay using detected cells from OCR).
|
|
62
|
+
*
|
|
63
|
+
* **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
|
|
67
|
+
* reused.
|
|
68
|
+
* - `file` (multipart) or `file_url` (JSON or multipart) — start
|
|
69
|
+
* from a raw PDF. Pulse runs cell detection internally before
|
|
70
|
+
* filling.
|
|
71
|
+
*
|
|
72
|
+
* Optional `form_fields` lets callers supply or edit the detected
|
|
73
|
+
* cells before filling. Optional `page_range` (alias `pages`,
|
|
74
|
+
* e.g. `"1-3,5"`) restricts the operation to a subset of pages.
|
|
75
|
+
*
|
|
76
|
+
* Synchronous by default — returns the filled `FormResult` inline
|
|
77
|
+
* (including a `pdf_url` you can `GET` to download the PDF
|
|
78
|
+
* binary). Set `async: true` to receive `{job_id, status:
|
|
79
|
+
* "pending"}` and poll [GET /job/{jobId}](api:GET/job/{jobId}).
|
|
80
|
+
*
|
|
81
|
+
* Billed at **3 credits per page**. Requires the `form_filler`
|
|
82
|
+
* feature flag to be enabled for your organization.
|
|
83
|
+
*
|
|
84
|
+
* @param {Pulse.FormFillJsonInput} request
|
|
85
|
+
* @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
86
|
+
*
|
|
87
|
+
* @throws {@link Pulse.BadRequestError}
|
|
88
|
+
* @throws {@link Pulse.UnauthorizedError}
|
|
89
|
+
* @throws {@link Pulse.ForbiddenError}
|
|
90
|
+
* @throws {@link Pulse.NotFoundError}
|
|
91
|
+
* @throws {@link Pulse.TooManyRequestsError}
|
|
92
|
+
* @throws {@link Pulse.InternalServerError}
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* await client.form.fill({
|
|
96
|
+
* instructions: "instructions"
|
|
97
|
+
* })
|
|
98
|
+
*/
|
|
99
|
+
fill(request: Pulse.FormFillJsonInput, requestOptions?: FormClient.RequestOptions): core.HttpResponsePromise<Pulse.FormResult>;
|
|
100
|
+
private __fill;
|
|
101
|
+
/**
|
|
102
|
+
* Remove user-entered data from a PDF form, leaving the blank
|
|
103
|
+
* form template intact. Erases handwritten entries, typed values,
|
|
104
|
+
* and unchecks selected checkboxes — printed labels, field
|
|
105
|
+
* titles, section headers, and other static template content are
|
|
106
|
+
* preserved.
|
|
107
|
+
*
|
|
108
|
+
* **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.
|
|
114
|
+
*
|
|
115
|
+
* `instructions` is optional. When omitted, Pulse clears every
|
|
116
|
+
* user-filled field deterministically (no LLM call) on AcroForm
|
|
117
|
+
* PDFs, eliminating any chance of hallucinated content. Provide
|
|
118
|
+
* a natural language prompt to clear only specific fields
|
|
119
|
+
* (e.g. `"clear only the address fields"`); targeted clears go
|
|
120
|
+
* through the LLM matcher with a delete-only filter.
|
|
121
|
+
*
|
|
122
|
+
* Optional `form_fields` and `page_range` (alias `pages`) behave
|
|
123
|
+
* the same as on [Form Fill](api:POST/form/fill).
|
|
124
|
+
*
|
|
125
|
+
* Synchronous by default — returns the cleared `FormResult`
|
|
126
|
+
* inline (including a `pdf_url` you can `GET` to download the
|
|
127
|
+
* PDF binary). Set `async: true` to receive `{job_id, status:
|
|
128
|
+
* "pending"}` and poll [GET /job/{jobId}](api:GET/job/{jobId}).
|
|
129
|
+
*
|
|
130
|
+
* Billed at **3 credits per page**. Requires the `form_filler`
|
|
131
|
+
* feature flag to be enabled for your organization.
|
|
132
|
+
*
|
|
133
|
+
* @param {Pulse.FormClearJsonInput} request
|
|
134
|
+
* @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
135
|
+
*
|
|
136
|
+
* @throws {@link Pulse.BadRequestError}
|
|
137
|
+
* @throws {@link Pulse.UnauthorizedError}
|
|
138
|
+
* @throws {@link Pulse.ForbiddenError}
|
|
139
|
+
* @throws {@link Pulse.NotFoundError}
|
|
140
|
+
* @throws {@link Pulse.TooManyRequestsError}
|
|
141
|
+
* @throws {@link Pulse.InternalServerError}
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* await client.form.clear()
|
|
145
|
+
*/
|
|
146
|
+
clear(request?: Pulse.FormClearJsonInput, requestOptions?: FormClient.RequestOptions): core.HttpResponsePromise<Pulse.FormResult>;
|
|
147
|
+
private __clear;
|
|
148
|
+
}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
17
|
+
import * as Pulse from "../../../index.mjs";
|
|
18
|
+
export class FormClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Run cell detection on a PDF and return the detected `form_fields`
|
|
24
|
+
* along with a reusable `form_id`. No LLM matching, no fill, no
|
|
25
|
+
* clear — this is the OCR / layout step that `/form/fill` and
|
|
26
|
+
* `/form/clear` would otherwise run internally.
|
|
27
|
+
*
|
|
28
|
+
* The returned `form_id` references the uploaded PDF and its
|
|
29
|
+
* detected layout, and can be passed back to a subsequent
|
|
30
|
+
* `/form/fill`, `/form/clear`, or `/form/detect` call as the
|
|
31
|
+
* single input source — Pulse will skip detection on the fast
|
|
32
|
+
* path and reuse the cached cells.
|
|
33
|
+
*
|
|
34
|
+
* **Input modes** — provide exactly one of:
|
|
35
|
+
* - `form_id` (JSON) — re-detect cells on a previously stored
|
|
36
|
+
* PDF. Useful when callers want to refresh layout after editing
|
|
37
|
+
* or when chaining detect calls.
|
|
38
|
+
* - `file` (multipart) or `file_url` (JSON or multipart) — start
|
|
39
|
+
* from a raw PDF.
|
|
40
|
+
*
|
|
41
|
+
* Optional `page_range` (alias `pages`, e.g. `"1-3,5"`) restricts
|
|
42
|
+
* the operation to a subset of pages.
|
|
43
|
+
*
|
|
44
|
+
* Synchronous by default — returns the detected layout inline.
|
|
45
|
+
* Set `async: true` to receive `{job_id, status: "pending"}`
|
|
46
|
+
* immediately and poll [GET /job/{jobId}](api:GET/job/{jobId}).
|
|
47
|
+
*
|
|
48
|
+
* Billed at **1 credit per page**. Requires the `form_filler`
|
|
49
|
+
* feature flag to be enabled for your organization.
|
|
50
|
+
*
|
|
51
|
+
* @param {Pulse.FormDetectJsonInput} request
|
|
52
|
+
* @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
53
|
+
*
|
|
54
|
+
* @throws {@link Pulse.BadRequestError}
|
|
55
|
+
* @throws {@link Pulse.UnauthorizedError}
|
|
56
|
+
* @throws {@link Pulse.ForbiddenError}
|
|
57
|
+
* @throws {@link Pulse.NotFoundError}
|
|
58
|
+
* @throws {@link Pulse.TooManyRequestsError}
|
|
59
|
+
* @throws {@link Pulse.InternalServerError}
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* await client.form.detect()
|
|
63
|
+
*/
|
|
64
|
+
detect(request = {}, requestOptions) {
|
|
65
|
+
return core.HttpResponsePromise.fromPromise(this.__detect(request, requestOptions));
|
|
66
|
+
}
|
|
67
|
+
__detect() {
|
|
68
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
70
|
+
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);
|
|
72
|
+
const _response = yield core.fetcher({
|
|
73
|
+
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
|
+
method: "POST",
|
|
75
|
+
headers: _headers,
|
|
76
|
+
contentType: "application/json",
|
|
77
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
78
|
+
requestType: "json",
|
|
79
|
+
body: request,
|
|
80
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
|
|
81
|
+
? requestOptions.timeoutInSeconds * 1000
|
|
82
|
+
: ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
|
|
83
|
+
? ((_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) * 1000
|
|
84
|
+
: undefined,
|
|
85
|
+
maxRetries: (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.maxRetries,
|
|
86
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
87
|
+
fetchFn: (_h = this._options) === null || _h === void 0 ? void 0 : _h.fetch,
|
|
88
|
+
logging: this._options.logging,
|
|
89
|
+
});
|
|
90
|
+
if (_response.ok) {
|
|
91
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
92
|
+
}
|
|
93
|
+
if (_response.error.reason === "status-code") {
|
|
94
|
+
switch (_response.error.statusCode) {
|
|
95
|
+
case 400:
|
|
96
|
+
throw new Pulse.BadRequestError(_response.error.body, _response.rawResponse);
|
|
97
|
+
case 401:
|
|
98
|
+
throw new Pulse.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
99
|
+
case 403:
|
|
100
|
+
throw new Pulse.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
101
|
+
case 404:
|
|
102
|
+
throw new Pulse.NotFoundError(_response.error.body, _response.rawResponse);
|
|
103
|
+
case 429:
|
|
104
|
+
throw new Pulse.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
105
|
+
case 500:
|
|
106
|
+
throw new Pulse.InternalServerError(_response.error.body, _response.rawResponse);
|
|
107
|
+
default:
|
|
108
|
+
throw new errors.PulseError({
|
|
109
|
+
statusCode: _response.error.statusCode,
|
|
110
|
+
body: _response.error.body,
|
|
111
|
+
rawResponse: _response.rawResponse,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/form/detect");
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Fill the fields of a PDF form with values inferred from a natural
|
|
120
|
+
* language `instructions` prompt. Works on both AcroForm PDFs
|
|
121
|
+
* (true form fields are written) and flat/scanned PDFs (values
|
|
122
|
+
* are rendered as an overlay using detected cells from OCR).
|
|
123
|
+
*
|
|
124
|
+
* **Input modes** — provide exactly one of:
|
|
125
|
+
* - `form_id` (JSON) — reuse a previously processed form from a
|
|
126
|
+
* prior `/form/detect`, `/form/fill`, or `/form/clear` call.
|
|
127
|
+
* Skips re-detection (fast path); the cached `form_fields` are
|
|
128
|
+
* reused.
|
|
129
|
+
* - `file` (multipart) or `file_url` (JSON or multipart) — start
|
|
130
|
+
* from a raw PDF. Pulse runs cell detection internally before
|
|
131
|
+
* filling.
|
|
132
|
+
*
|
|
133
|
+
* Optional `form_fields` lets callers supply or edit the detected
|
|
134
|
+
* cells before filling. Optional `page_range` (alias `pages`,
|
|
135
|
+
* e.g. `"1-3,5"`) restricts the operation to a subset of pages.
|
|
136
|
+
*
|
|
137
|
+
* Synchronous by default — returns the filled `FormResult` inline
|
|
138
|
+
* (including a `pdf_url` you can `GET` to download the PDF
|
|
139
|
+
* binary). Set `async: true` to receive `{job_id, status:
|
|
140
|
+
* "pending"}` and poll [GET /job/{jobId}](api:GET/job/{jobId}).
|
|
141
|
+
*
|
|
142
|
+
* Billed at **3 credits per page**. Requires the `form_filler`
|
|
143
|
+
* feature flag to be enabled for your organization.
|
|
144
|
+
*
|
|
145
|
+
* @param {Pulse.FormFillJsonInput} request
|
|
146
|
+
* @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
147
|
+
*
|
|
148
|
+
* @throws {@link Pulse.BadRequestError}
|
|
149
|
+
* @throws {@link Pulse.UnauthorizedError}
|
|
150
|
+
* @throws {@link Pulse.ForbiddenError}
|
|
151
|
+
* @throws {@link Pulse.NotFoundError}
|
|
152
|
+
* @throws {@link Pulse.TooManyRequestsError}
|
|
153
|
+
* @throws {@link Pulse.InternalServerError}
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* await client.form.fill({
|
|
157
|
+
* instructions: "instructions"
|
|
158
|
+
* })
|
|
159
|
+
*/
|
|
160
|
+
fill(request, requestOptions) {
|
|
161
|
+
return core.HttpResponsePromise.fromPromise(this.__fill(request, requestOptions));
|
|
162
|
+
}
|
|
163
|
+
__fill(request, requestOptions) {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
166
|
+
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);
|
|
168
|
+
const _response = yield core.fetcher({
|
|
169
|
+
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
|
+
method: "POST",
|
|
171
|
+
headers: _headers,
|
|
172
|
+
contentType: "application/json",
|
|
173
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
174
|
+
requestType: "json",
|
|
175
|
+
body: request,
|
|
176
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
|
|
177
|
+
? requestOptions.timeoutInSeconds * 1000
|
|
178
|
+
: ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
|
|
179
|
+
? ((_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) * 1000
|
|
180
|
+
: undefined,
|
|
181
|
+
maxRetries: (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.maxRetries,
|
|
182
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
183
|
+
fetchFn: (_h = this._options) === null || _h === void 0 ? void 0 : _h.fetch,
|
|
184
|
+
logging: this._options.logging,
|
|
185
|
+
});
|
|
186
|
+
if (_response.ok) {
|
|
187
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
188
|
+
}
|
|
189
|
+
if (_response.error.reason === "status-code") {
|
|
190
|
+
switch (_response.error.statusCode) {
|
|
191
|
+
case 400:
|
|
192
|
+
throw new Pulse.BadRequestError(_response.error.body, _response.rawResponse);
|
|
193
|
+
case 401:
|
|
194
|
+
throw new Pulse.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
195
|
+
case 403:
|
|
196
|
+
throw new Pulse.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
197
|
+
case 404:
|
|
198
|
+
throw new Pulse.NotFoundError(_response.error.body, _response.rawResponse);
|
|
199
|
+
case 429:
|
|
200
|
+
throw new Pulse.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
201
|
+
case 500:
|
|
202
|
+
throw new Pulse.InternalServerError(_response.error.body, _response.rawResponse);
|
|
203
|
+
default:
|
|
204
|
+
throw new errors.PulseError({
|
|
205
|
+
statusCode: _response.error.statusCode,
|
|
206
|
+
body: _response.error.body,
|
|
207
|
+
rawResponse: _response.rawResponse,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/form/fill");
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Remove user-entered data from a PDF form, leaving the blank
|
|
216
|
+
* form template intact. Erases handwritten entries, typed values,
|
|
217
|
+
* and unchecks selected checkboxes — printed labels, field
|
|
218
|
+
* titles, section headers, and other static template content are
|
|
219
|
+
* preserved.
|
|
220
|
+
*
|
|
221
|
+
* **Input modes** — provide exactly one of:
|
|
222
|
+
* - `form_id` (JSON) — reuse a previously processed form from a
|
|
223
|
+
* prior `/form/detect`, `/form/fill`, or `/form/clear` call
|
|
224
|
+
* (fast path; cached layout reused).
|
|
225
|
+
* - `file` (multipart) or `file_url` (JSON or multipart) — start
|
|
226
|
+
* from a raw PDF.
|
|
227
|
+
*
|
|
228
|
+
* `instructions` is optional. When omitted, Pulse clears every
|
|
229
|
+
* user-filled field deterministically (no LLM call) on AcroForm
|
|
230
|
+
* PDFs, eliminating any chance of hallucinated content. Provide
|
|
231
|
+
* a natural language prompt to clear only specific fields
|
|
232
|
+
* (e.g. `"clear only the address fields"`); targeted clears go
|
|
233
|
+
* through the LLM matcher with a delete-only filter.
|
|
234
|
+
*
|
|
235
|
+
* Optional `form_fields` and `page_range` (alias `pages`) behave
|
|
236
|
+
* the same as on [Form Fill](api:POST/form/fill).
|
|
237
|
+
*
|
|
238
|
+
* Synchronous by default — returns the cleared `FormResult`
|
|
239
|
+
* inline (including a `pdf_url` you can `GET` to download the
|
|
240
|
+
* PDF binary). Set `async: true` to receive `{job_id, status:
|
|
241
|
+
* "pending"}` and poll [GET /job/{jobId}](api:GET/job/{jobId}).
|
|
242
|
+
*
|
|
243
|
+
* Billed at **3 credits per page**. Requires the `form_filler`
|
|
244
|
+
* feature flag to be enabled for your organization.
|
|
245
|
+
*
|
|
246
|
+
* @param {Pulse.FormClearJsonInput} request
|
|
247
|
+
* @param {FormClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
248
|
+
*
|
|
249
|
+
* @throws {@link Pulse.BadRequestError}
|
|
250
|
+
* @throws {@link Pulse.UnauthorizedError}
|
|
251
|
+
* @throws {@link Pulse.ForbiddenError}
|
|
252
|
+
* @throws {@link Pulse.NotFoundError}
|
|
253
|
+
* @throws {@link Pulse.TooManyRequestsError}
|
|
254
|
+
* @throws {@link Pulse.InternalServerError}
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* await client.form.clear()
|
|
258
|
+
*/
|
|
259
|
+
clear(request = {}, requestOptions) {
|
|
260
|
+
return core.HttpResponsePromise.fromPromise(this.__clear(request, requestOptions));
|
|
261
|
+
}
|
|
262
|
+
__clear() {
|
|
263
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
264
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
265
|
+
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);
|
|
267
|
+
const _response = yield core.fetcher({
|
|
268
|
+
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
|
+
method: "POST",
|
|
270
|
+
headers: _headers,
|
|
271
|
+
contentType: "application/json",
|
|
272
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
273
|
+
requestType: "json",
|
|
274
|
+
body: request,
|
|
275
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null
|
|
276
|
+
? requestOptions.timeoutInSeconds * 1000
|
|
277
|
+
: ((_d = this._options) === null || _d === void 0 ? void 0 : _d.timeoutInSeconds) != null
|
|
278
|
+
? ((_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) * 1000
|
|
279
|
+
: undefined,
|
|
280
|
+
maxRetries: (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.maxRetries,
|
|
281
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
282
|
+
fetchFn: (_h = this._options) === null || _h === void 0 ? void 0 : _h.fetch,
|
|
283
|
+
logging: this._options.logging,
|
|
284
|
+
});
|
|
285
|
+
if (_response.ok) {
|
|
286
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
287
|
+
}
|
|
288
|
+
if (_response.error.reason === "status-code") {
|
|
289
|
+
switch (_response.error.statusCode) {
|
|
290
|
+
case 400:
|
|
291
|
+
throw new Pulse.BadRequestError(_response.error.body, _response.rawResponse);
|
|
292
|
+
case 401:
|
|
293
|
+
throw new Pulse.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
294
|
+
case 403:
|
|
295
|
+
throw new Pulse.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
296
|
+
case 404:
|
|
297
|
+
throw new Pulse.NotFoundError(_response.error.body, _response.rawResponse);
|
|
298
|
+
case 429:
|
|
299
|
+
throw new Pulse.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
300
|
+
case 500:
|
|
301
|
+
throw new Pulse.InternalServerError(_response.error.body, _response.rawResponse);
|
|
302
|
+
default:
|
|
303
|
+
throw new errors.PulseError({
|
|
304
|
+
statusCode: _response.error.statusCode,
|
|
305
|
+
body: _response.error.body,
|
|
306
|
+
rawResponse: _response.rawResponse,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/form/clear");
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as Pulse from "../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface FormClearJsonInput {
|
|
7
|
+
/** ID returned by a previous `/form/detect`, `/form/fill`, or `/form/clear` call (fast path; skips re-detection). */
|
|
8
|
+
form_id?: string;
|
|
9
|
+
/** Public or pre-signed URL of a PDF to download and clear. */
|
|
10
|
+
file_url?: string;
|
|
11
|
+
/** Optional natural-language description of what to clear. When omitted, Pulse clears every user-filled value deterministically (no LLM call) on AcroForm PDFs while preserving the blank form template. */
|
|
12
|
+
instructions?: string;
|
|
13
|
+
/** Optional override for the cells used when filling / clearing. When omitted, Pulse uses the cells stored on the referenced `form_id` (fast path) or runs detection on the uploaded PDF. Useful for editing detected cells before filling. */
|
|
14
|
+
form_fields?: Pulse.FormCell[];
|
|
15
|
+
/** Restrict the operation to a subset of pages. Accepts comma-separated page numbers and ranges, e.g. `"1-3,5"`. Alias: `pages`. */
|
|
16
|
+
page_range?: string;
|
|
17
|
+
/** When `true`, the endpoint returns immediately with `{job_id, status: "pending"}` (HTTP 202) and processes the job in the background. Poll [GET /job/{jobId}](api:GET/job/{jobId}) for the result. Default `false` — return the full result inline. */
|
|
18
|
+
async?: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {}
|
|
4
|
+
*/
|
|
5
|
+
export interface FormDetectJsonInput {
|
|
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. */
|
|
7
|
+
form_id?: string;
|
|
8
|
+
/** Public or pre-signed URL of a PDF to detect cells on. */
|
|
9
|
+
file_url?: string;
|
|
10
|
+
/** Restrict the operation to a subset of pages. Accepts comma-separated page numbers and ranges, e.g. `"1-3,5"`. Alias: `pages`. */
|
|
11
|
+
page_range?: string;
|
|
12
|
+
/** When `true`, the endpoint returns immediately with `{job_id, status: "pending"}` (HTTP 202) and processes the job in the background. Poll [GET /job/{jobId}](api:GET/job/{jobId}) for the result. Default `false` — return the full result inline. */
|
|
13
|
+
async?: boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type * as Pulse from "../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* instructions: "instructions"
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface FormFillJsonInput {
|
|
9
|
+
/** 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). */
|
|
10
|
+
form_id?: string;
|
|
11
|
+
/** Public or pre-signed URL of a PDF to download and fill. */
|
|
12
|
+
file_url?: string;
|
|
13
|
+
/** Required natural-language description of what to fill into the form (e.g. `"Use John Doe, 123 Main St, born 1990-01-01"`). */
|
|
14
|
+
instructions: string;
|
|
15
|
+
/** Optional override for the cells used when filling / clearing. When omitted, Pulse uses the cells stored on the referenced `form_id` (fast path) or runs detection on the uploaded PDF. Useful for editing detected cells before filling. */
|
|
16
|
+
form_fields?: Pulse.FormCell[];
|
|
17
|
+
/** Restrict the operation to a subset of pages. Accepts comma-separated page numbers and ranges, e.g. `"1-3,5"`. Alias: `pages`. */
|
|
18
|
+
page_range?: string;
|
|
19
|
+
/** When `true`, the endpoint returns immediately with `{job_id, status: "pending"}` (HTTP 202) and processes the job in the background. Poll [GET /job/{jobId}](api:GET/job/{jobId}) for the result. Default `false` — return the full result inline. */
|
|
20
|
+
async?: boolean;
|
|
21
|
+
}
|