pulse-ts-sdk 1.0.1 → 1.0.4
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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +27 -0
- package/dist/cjs/Client.js +75 -0
- package/dist/cjs/api/client/requests/TablesInput.d.ts +15 -0
- package/dist/cjs/api/client/requests/TablesInput.js +3 -0
- package/dist/cjs/api/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/TablesConfig.d.ts +16 -0
- package/dist/cjs/api/types/TablesConfig.js +11 -0
- package/dist/cjs/api/types/TablesResponse.d.ts +31 -0
- package/dist/cjs/api/types/TablesResponse.js +3 -0
- package/dist/cjs/api/types/index.d.ts +2 -0
- package/dist/cjs/api/types/index.js +2 -0
- package/dist/cjs/environments.d.ts +1 -1
- package/dist/cjs/environments.js +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +27 -0
- package/dist/esm/Client.mjs +75 -0
- package/dist/esm/api/client/requests/TablesInput.d.mts +15 -0
- package/dist/esm/api/client/requests/TablesInput.mjs +2 -0
- package/dist/esm/api/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/TablesConfig.d.mts +16 -0
- package/dist/esm/api/types/TablesConfig.mjs +8 -0
- package/dist/esm/api/types/TablesResponse.d.mts +31 -0
- package/dist/esm/api/types/TablesResponse.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +2 -0
- package/dist/esm/api/types/index.mjs +2 -0
- package/dist/esm/environments.d.mts +1 -1
- package/dist/esm/environments.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +72 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "pulse-ts-sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "1.0.
|
|
47
|
-
"User-Agent": "pulse-ts-sdk/1.0.
|
|
46
|
+
"X-Fern-SDK-Version": "1.0.4",
|
|
47
|
+
"User-Agent": "pulse-ts-sdk/1.0.4",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -112,4 +112,31 @@ export declare class PulseClient {
|
|
|
112
112
|
*/
|
|
113
113
|
schema(request?: Pulse.SchemaInput, requestOptions?: PulseClient.RequestOptions): core.HttpResponsePromise<Pulse.SchemaResponse>;
|
|
114
114
|
private __schema;
|
|
115
|
+
/**
|
|
116
|
+
* Extract tables from a previously completed extraction. Processes the
|
|
117
|
+
* extraction's document content and returns structured table data.
|
|
118
|
+
*
|
|
119
|
+
* Requires the `tables_endpoint` feature flag to be enabled for your
|
|
120
|
+
* organization.
|
|
121
|
+
*
|
|
122
|
+
* Set `async: true` to return immediately with a `tables_id` for
|
|
123
|
+
* polling via `GET /job/{tables_id}`.
|
|
124
|
+
*
|
|
125
|
+
* @param {Pulse.TablesInput} request
|
|
126
|
+
* @param {PulseClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
127
|
+
*
|
|
128
|
+
* @throws {@link Pulse.BadRequestError}
|
|
129
|
+
* @throws {@link Pulse.UnauthorizedError}
|
|
130
|
+
* @throws {@link Pulse.ForbiddenError}
|
|
131
|
+
* @throws {@link Pulse.NotFoundError}
|
|
132
|
+
* @throws {@link Pulse.TooManyRequestsError}
|
|
133
|
+
* @throws {@link Pulse.InternalServerError}
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* await client.tables({
|
|
137
|
+
* extraction_id: "extraction_id"
|
|
138
|
+
* })
|
|
139
|
+
*/
|
|
140
|
+
tables(request: Pulse.TablesInput, requestOptions?: PulseClient.RequestOptions): core.HttpResponsePromise<Pulse.TablesResponse>;
|
|
141
|
+
private __tables;
|
|
115
142
|
}
|
package/dist/cjs/Client.js
CHANGED
|
@@ -450,5 +450,80 @@ class PulseClient {
|
|
|
450
450
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/schema");
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Extract tables from a previously completed extraction. Processes the
|
|
455
|
+
* extraction's document content and returns structured table data.
|
|
456
|
+
*
|
|
457
|
+
* Requires the `tables_endpoint` feature flag to be enabled for your
|
|
458
|
+
* organization.
|
|
459
|
+
*
|
|
460
|
+
* Set `async: true` to return immediately with a `tables_id` for
|
|
461
|
+
* polling via `GET /job/{tables_id}`.
|
|
462
|
+
*
|
|
463
|
+
* @param {Pulse.TablesInput} request
|
|
464
|
+
* @param {PulseClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
465
|
+
*
|
|
466
|
+
* @throws {@link Pulse.BadRequestError}
|
|
467
|
+
* @throws {@link Pulse.UnauthorizedError}
|
|
468
|
+
* @throws {@link Pulse.ForbiddenError}
|
|
469
|
+
* @throws {@link Pulse.NotFoundError}
|
|
470
|
+
* @throws {@link Pulse.TooManyRequestsError}
|
|
471
|
+
* @throws {@link Pulse.InternalServerError}
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* await client.tables({
|
|
475
|
+
* extraction_id: "extraction_id"
|
|
476
|
+
* })
|
|
477
|
+
*/
|
|
478
|
+
tables(request, requestOptions) {
|
|
479
|
+
return core.HttpResponsePromise.fromPromise(this.__tables(request, requestOptions));
|
|
480
|
+
}
|
|
481
|
+
__tables(request, requestOptions) {
|
|
482
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
483
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
484
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
485
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
486
|
+
const _response = yield core.fetcher({
|
|
487
|
+
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, "tables"),
|
|
488
|
+
method: "POST",
|
|
489
|
+
headers: _headers,
|
|
490
|
+
contentType: "application/json",
|
|
491
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
492
|
+
requestType: "json",
|
|
493
|
+
body: request,
|
|
494
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
495
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
496
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
497
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
498
|
+
logging: this._options.logging,
|
|
499
|
+
});
|
|
500
|
+
if (_response.ok) {
|
|
501
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
502
|
+
}
|
|
503
|
+
if (_response.error.reason === "status-code") {
|
|
504
|
+
switch (_response.error.statusCode) {
|
|
505
|
+
case 400:
|
|
506
|
+
throw new Pulse.BadRequestError(_response.error.body, _response.rawResponse);
|
|
507
|
+
case 401:
|
|
508
|
+
throw new Pulse.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
509
|
+
case 403:
|
|
510
|
+
throw new Pulse.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
511
|
+
case 404:
|
|
512
|
+
throw new Pulse.NotFoundError(_response.error.body, _response.rawResponse);
|
|
513
|
+
case 429:
|
|
514
|
+
throw new Pulse.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
515
|
+
case 500:
|
|
516
|
+
throw new Pulse.InternalServerError(_response.error.body, _response.rawResponse);
|
|
517
|
+
default:
|
|
518
|
+
throw new errors.PulseError({
|
|
519
|
+
statusCode: _response.error.statusCode,
|
|
520
|
+
body: _response.error.body,
|
|
521
|
+
rawResponse: _response.rawResponse,
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/tables");
|
|
526
|
+
});
|
|
527
|
+
}
|
|
453
528
|
}
|
|
454
529
|
exports.PulseClient = PulseClient;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type * as Pulse from "../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* extraction_id: "extraction_id"
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface TablesInput {
|
|
9
|
+
/** ID of a completed extraction to extract tables from. */
|
|
10
|
+
extraction_id: string;
|
|
11
|
+
/** Table extraction configuration. If omitted, defaults are used (`merge: false`, `table_format: "html"`). */
|
|
12
|
+
tables_config?: Pulse.TablesConfig;
|
|
13
|
+
/** When true, returns immediately with a job ID. Poll `GET /job/{tables_id}` for the result. */
|
|
14
|
+
async?: boolean;
|
|
15
|
+
}
|
|
@@ -2,3 +2,4 @@ export type { ExtractAsyncRequest } from "./ExtractAsyncRequest.js";
|
|
|
2
2
|
export type { ExtractRequest } from "./ExtractRequest.js";
|
|
3
3
|
export type { SchemaInput } from "./SchemaInput.js";
|
|
4
4
|
export type { SplitInput } from "./SplitInput.js";
|
|
5
|
+
export type { TablesInput } from "./TablesInput.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for table extraction.
|
|
3
|
+
*/
|
|
4
|
+
export interface TablesConfig {
|
|
5
|
+
/** When true, adjacent tables that appear to be continuations of each other are merged into a single table. */
|
|
6
|
+
merge?: boolean;
|
|
7
|
+
/** Output format for table content. Currently only `html` is supported. */
|
|
8
|
+
table_format?: TablesConfig.TableFormat;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace TablesConfig {
|
|
11
|
+
/** Output format for table content. Currently only `html` is supported. */
|
|
12
|
+
const TableFormat: {
|
|
13
|
+
readonly Html: "html";
|
|
14
|
+
};
|
|
15
|
+
type TableFormat = (typeof TableFormat)[keyof typeof TableFormat];
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TablesConfig = void 0;
|
|
5
|
+
var TablesConfig;
|
|
6
|
+
(function (TablesConfig) {
|
|
7
|
+
/** Output format for table content. Currently only `html` is supported. */
|
|
8
|
+
TablesConfig.TableFormat = {
|
|
9
|
+
Html: "html",
|
|
10
|
+
};
|
|
11
|
+
})(TablesConfig || (exports.TablesConfig = TablesConfig = {}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of table extraction.
|
|
3
|
+
*/
|
|
4
|
+
export interface TablesResponse {
|
|
5
|
+
/** Persisted tables version ID. Can be used to retrieve the tables result later. */
|
|
6
|
+
tables_id: string;
|
|
7
|
+
/** The extracted tables data. */
|
|
8
|
+
tables_output: TablesResponse.TablesOutput;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace TablesResponse {
|
|
11
|
+
/**
|
|
12
|
+
* The extracted tables data.
|
|
13
|
+
*/
|
|
14
|
+
interface TablesOutput {
|
|
15
|
+
/** Array of extracted table objects. Each table includes its content, citations, and whether it was derived from a chart. */
|
|
16
|
+
tables?: TablesOutput.Tables.Item[];
|
|
17
|
+
}
|
|
18
|
+
namespace TablesOutput {
|
|
19
|
+
type Tables = Tables.Item[];
|
|
20
|
+
namespace Tables {
|
|
21
|
+
interface Item {
|
|
22
|
+
/** The table content in the requested format (e.g. HTML). */
|
|
23
|
+
table_content?: string;
|
|
24
|
+
/** Bounding box table IDs indicating where this table was found (e.g. "tbl-1"). Merged tables list all source IDs. */
|
|
25
|
+
citations?: string[];
|
|
26
|
+
/** Whether this table was extracted from a chart or figure rather than a native table. */
|
|
27
|
+
from_chart?: boolean;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -16,5 +16,7 @@ export * from "./SplitResponse.js";
|
|
|
16
16
|
export * from "./SplitSchemaResponse.js";
|
|
17
17
|
export * from "./StructuredOutputConfig.js";
|
|
18
18
|
export * from "./StructuredOutputResult.js";
|
|
19
|
+
export * from "./TablesConfig.js";
|
|
20
|
+
export * from "./TablesResponse.js";
|
|
19
21
|
export * from "./TopicDefinition.js";
|
|
20
22
|
export * from "./TopicSchemaConfig.js";
|
|
@@ -32,5 +32,7 @@ __exportStar(require("./SplitResponse.js"), exports);
|
|
|
32
32
|
__exportStar(require("./SplitSchemaResponse.js"), exports);
|
|
33
33
|
__exportStar(require("./StructuredOutputConfig.js"), exports);
|
|
34
34
|
__exportStar(require("./StructuredOutputResult.js"), exports);
|
|
35
|
+
__exportStar(require("./TablesConfig.js"), exports);
|
|
36
|
+
__exportStar(require("./TablesResponse.js"), exports);
|
|
35
37
|
__exportStar(require("./TopicDefinition.js"), exports);
|
|
36
38
|
__exportStar(require("./TopicSchemaConfig.js"), exports);
|
package/dist/cjs/environments.js
CHANGED
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.4";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "pulse-ts-sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "1.0.
|
|
10
|
-
"User-Agent": "pulse-ts-sdk/1.0.
|
|
9
|
+
"X-Fern-SDK-Version": "1.0.4",
|
|
10
|
+
"User-Agent": "pulse-ts-sdk/1.0.4",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/esm/Client.d.mts
CHANGED
|
@@ -112,4 +112,31 @@ export declare class PulseClient {
|
|
|
112
112
|
*/
|
|
113
113
|
schema(request?: Pulse.SchemaInput, requestOptions?: PulseClient.RequestOptions): core.HttpResponsePromise<Pulse.SchemaResponse>;
|
|
114
114
|
private __schema;
|
|
115
|
+
/**
|
|
116
|
+
* Extract tables from a previously completed extraction. Processes the
|
|
117
|
+
* extraction's document content and returns structured table data.
|
|
118
|
+
*
|
|
119
|
+
* Requires the `tables_endpoint` feature flag to be enabled for your
|
|
120
|
+
* organization.
|
|
121
|
+
*
|
|
122
|
+
* Set `async: true` to return immediately with a `tables_id` for
|
|
123
|
+
* polling via `GET /job/{tables_id}`.
|
|
124
|
+
*
|
|
125
|
+
* @param {Pulse.TablesInput} request
|
|
126
|
+
* @param {PulseClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
127
|
+
*
|
|
128
|
+
* @throws {@link Pulse.BadRequestError}
|
|
129
|
+
* @throws {@link Pulse.UnauthorizedError}
|
|
130
|
+
* @throws {@link Pulse.ForbiddenError}
|
|
131
|
+
* @throws {@link Pulse.NotFoundError}
|
|
132
|
+
* @throws {@link Pulse.TooManyRequestsError}
|
|
133
|
+
* @throws {@link Pulse.InternalServerError}
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* await client.tables({
|
|
137
|
+
* extraction_id: "extraction_id"
|
|
138
|
+
* })
|
|
139
|
+
*/
|
|
140
|
+
tables(request: Pulse.TablesInput, requestOptions?: PulseClient.RequestOptions): core.HttpResponsePromise<Pulse.TablesResponse>;
|
|
141
|
+
private __tables;
|
|
115
142
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -414,4 +414,79 @@ export class PulseClient {
|
|
|
414
414
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/schema");
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Extract tables from a previously completed extraction. Processes the
|
|
419
|
+
* extraction's document content and returns structured table data.
|
|
420
|
+
*
|
|
421
|
+
* Requires the `tables_endpoint` feature flag to be enabled for your
|
|
422
|
+
* organization.
|
|
423
|
+
*
|
|
424
|
+
* Set `async: true` to return immediately with a `tables_id` for
|
|
425
|
+
* polling via `GET /job/{tables_id}`.
|
|
426
|
+
*
|
|
427
|
+
* @param {Pulse.TablesInput} request
|
|
428
|
+
* @param {PulseClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
429
|
+
*
|
|
430
|
+
* @throws {@link Pulse.BadRequestError}
|
|
431
|
+
* @throws {@link Pulse.UnauthorizedError}
|
|
432
|
+
* @throws {@link Pulse.ForbiddenError}
|
|
433
|
+
* @throws {@link Pulse.NotFoundError}
|
|
434
|
+
* @throws {@link Pulse.TooManyRequestsError}
|
|
435
|
+
* @throws {@link Pulse.InternalServerError}
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* await client.tables({
|
|
439
|
+
* extraction_id: "extraction_id"
|
|
440
|
+
* })
|
|
441
|
+
*/
|
|
442
|
+
tables(request, requestOptions) {
|
|
443
|
+
return core.HttpResponsePromise.fromPromise(this.__tables(request, requestOptions));
|
|
444
|
+
}
|
|
445
|
+
__tables(request, requestOptions) {
|
|
446
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
447
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
448
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
449
|
+
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);
|
|
450
|
+
const _response = yield core.fetcher({
|
|
451
|
+
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, "tables"),
|
|
452
|
+
method: "POST",
|
|
453
|
+
headers: _headers,
|
|
454
|
+
contentType: "application/json",
|
|
455
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
456
|
+
requestType: "json",
|
|
457
|
+
body: request,
|
|
458
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
459
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
460
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
461
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
462
|
+
logging: this._options.logging,
|
|
463
|
+
});
|
|
464
|
+
if (_response.ok) {
|
|
465
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
466
|
+
}
|
|
467
|
+
if (_response.error.reason === "status-code") {
|
|
468
|
+
switch (_response.error.statusCode) {
|
|
469
|
+
case 400:
|
|
470
|
+
throw new Pulse.BadRequestError(_response.error.body, _response.rawResponse);
|
|
471
|
+
case 401:
|
|
472
|
+
throw new Pulse.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
473
|
+
case 403:
|
|
474
|
+
throw new Pulse.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
475
|
+
case 404:
|
|
476
|
+
throw new Pulse.NotFoundError(_response.error.body, _response.rawResponse);
|
|
477
|
+
case 429:
|
|
478
|
+
throw new Pulse.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
479
|
+
case 500:
|
|
480
|
+
throw new Pulse.InternalServerError(_response.error.body, _response.rawResponse);
|
|
481
|
+
default:
|
|
482
|
+
throw new errors.PulseError({
|
|
483
|
+
statusCode: _response.error.statusCode,
|
|
484
|
+
body: _response.error.body,
|
|
485
|
+
rawResponse: _response.rawResponse,
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/tables");
|
|
490
|
+
});
|
|
491
|
+
}
|
|
417
492
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type * as Pulse from "../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* extraction_id: "extraction_id"
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface TablesInput {
|
|
9
|
+
/** ID of a completed extraction to extract tables from. */
|
|
10
|
+
extraction_id: string;
|
|
11
|
+
/** Table extraction configuration. If omitted, defaults are used (`merge: false`, `table_format: "html"`). */
|
|
12
|
+
tables_config?: Pulse.TablesConfig;
|
|
13
|
+
/** When true, returns immediately with a job ID. Poll `GET /job/{tables_id}` for the result. */
|
|
14
|
+
async?: boolean;
|
|
15
|
+
}
|
|
@@ -2,3 +2,4 @@ export type { ExtractAsyncRequest } from "./ExtractAsyncRequest.mjs";
|
|
|
2
2
|
export type { ExtractRequest } from "./ExtractRequest.mjs";
|
|
3
3
|
export type { SchemaInput } from "./SchemaInput.mjs";
|
|
4
4
|
export type { SplitInput } from "./SplitInput.mjs";
|
|
5
|
+
export type { TablesInput } from "./TablesInput.mjs";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for table extraction.
|
|
3
|
+
*/
|
|
4
|
+
export interface TablesConfig {
|
|
5
|
+
/** When true, adjacent tables that appear to be continuations of each other are merged into a single table. */
|
|
6
|
+
merge?: boolean;
|
|
7
|
+
/** Output format for table content. Currently only `html` is supported. */
|
|
8
|
+
table_format?: TablesConfig.TableFormat;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace TablesConfig {
|
|
11
|
+
/** Output format for table content. Currently only `html` is supported. */
|
|
12
|
+
const TableFormat: {
|
|
13
|
+
readonly Html: "html";
|
|
14
|
+
};
|
|
15
|
+
type TableFormat = (typeof TableFormat)[keyof typeof TableFormat];
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var TablesConfig;
|
|
3
|
+
(function (TablesConfig) {
|
|
4
|
+
/** Output format for table content. Currently only `html` is supported. */
|
|
5
|
+
TablesConfig.TableFormat = {
|
|
6
|
+
Html: "html",
|
|
7
|
+
};
|
|
8
|
+
})(TablesConfig || (TablesConfig = {}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of table extraction.
|
|
3
|
+
*/
|
|
4
|
+
export interface TablesResponse {
|
|
5
|
+
/** Persisted tables version ID. Can be used to retrieve the tables result later. */
|
|
6
|
+
tables_id: string;
|
|
7
|
+
/** The extracted tables data. */
|
|
8
|
+
tables_output: TablesResponse.TablesOutput;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace TablesResponse {
|
|
11
|
+
/**
|
|
12
|
+
* The extracted tables data.
|
|
13
|
+
*/
|
|
14
|
+
interface TablesOutput {
|
|
15
|
+
/** Array of extracted table objects. Each table includes its content, citations, and whether it was derived from a chart. */
|
|
16
|
+
tables?: TablesOutput.Tables.Item[];
|
|
17
|
+
}
|
|
18
|
+
namespace TablesOutput {
|
|
19
|
+
type Tables = Tables.Item[];
|
|
20
|
+
namespace Tables {
|
|
21
|
+
interface Item {
|
|
22
|
+
/** The table content in the requested format (e.g. HTML). */
|
|
23
|
+
table_content?: string;
|
|
24
|
+
/** Bounding box table IDs indicating where this table was found (e.g. "tbl-1"). Merged tables list all source IDs. */
|
|
25
|
+
citations?: string[];
|
|
26
|
+
/** Whether this table was extracted from a chart or figure rather than a native table. */
|
|
27
|
+
from_chart?: boolean;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -16,5 +16,7 @@ export * from "./SplitResponse.mjs";
|
|
|
16
16
|
export * from "./SplitSchemaResponse.mjs";
|
|
17
17
|
export * from "./StructuredOutputConfig.mjs";
|
|
18
18
|
export * from "./StructuredOutputResult.mjs";
|
|
19
|
+
export * from "./TablesConfig.mjs";
|
|
20
|
+
export * from "./TablesResponse.mjs";
|
|
19
21
|
export * from "./TopicDefinition.mjs";
|
|
20
22
|
export * from "./TopicSchemaConfig.mjs";
|
|
@@ -16,5 +16,7 @@ export * from "./SplitResponse.mjs";
|
|
|
16
16
|
export * from "./SplitSchemaResponse.mjs";
|
|
17
17
|
export * from "./StructuredOutputConfig.mjs";
|
|
18
18
|
export * from "./StructuredOutputResult.mjs";
|
|
19
|
+
export * from "./TablesConfig.mjs";
|
|
20
|
+
export * from "./TablesResponse.mjs";
|
|
19
21
|
export * from "./TopicDefinition.mjs";
|
|
20
22
|
export * from "./TopicSchemaConfig.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.4";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.0.
|
|
1
|
+
export const SDK_VERSION = "1.0.4";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -277,6 +277,78 @@ await client.schema();
|
|
|
277
277
|
</dl>
|
|
278
278
|
|
|
279
279
|
|
|
280
|
+
</dd>
|
|
281
|
+
</dl>
|
|
282
|
+
</details>
|
|
283
|
+
|
|
284
|
+
<details><summary><code>client.<a href="/src/Client.ts">tables</a>({ ...params }) -> Pulse.TablesResponse</code></summary>
|
|
285
|
+
<dl>
|
|
286
|
+
<dd>
|
|
287
|
+
|
|
288
|
+
#### 📝 Description
|
|
289
|
+
|
|
290
|
+
<dl>
|
|
291
|
+
<dd>
|
|
292
|
+
|
|
293
|
+
<dl>
|
|
294
|
+
<dd>
|
|
295
|
+
|
|
296
|
+
Extract tables from a previously completed extraction. Processes the
|
|
297
|
+
extraction's document content and returns structured table data.
|
|
298
|
+
|
|
299
|
+
Requires the `tables_endpoint` feature flag to be enabled for your
|
|
300
|
+
organization.
|
|
301
|
+
|
|
302
|
+
Set `async: true` to return immediately with a `tables_id` for
|
|
303
|
+
polling via `GET /job/{tables_id}`.
|
|
304
|
+
</dd>
|
|
305
|
+
</dl>
|
|
306
|
+
</dd>
|
|
307
|
+
</dl>
|
|
308
|
+
|
|
309
|
+
#### 🔌 Usage
|
|
310
|
+
|
|
311
|
+
<dl>
|
|
312
|
+
<dd>
|
|
313
|
+
|
|
314
|
+
<dl>
|
|
315
|
+
<dd>
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
await client.tables({
|
|
319
|
+
extraction_id: "extraction_id"
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
</dd>
|
|
324
|
+
</dl>
|
|
325
|
+
</dd>
|
|
326
|
+
</dl>
|
|
327
|
+
|
|
328
|
+
#### ⚙️ Parameters
|
|
329
|
+
|
|
330
|
+
<dl>
|
|
331
|
+
<dd>
|
|
332
|
+
|
|
333
|
+
<dl>
|
|
334
|
+
<dd>
|
|
335
|
+
|
|
336
|
+
**request:** `Pulse.TablesInput`
|
|
337
|
+
|
|
338
|
+
</dd>
|
|
339
|
+
</dl>
|
|
340
|
+
|
|
341
|
+
<dl>
|
|
342
|
+
<dd>
|
|
343
|
+
|
|
344
|
+
**requestOptions:** `PulseClient.RequestOptions`
|
|
345
|
+
|
|
346
|
+
</dd>
|
|
347
|
+
</dl>
|
|
348
|
+
</dd>
|
|
349
|
+
</dl>
|
|
350
|
+
|
|
351
|
+
|
|
280
352
|
</dd>
|
|
281
353
|
</dl>
|
|
282
354
|
</details>
|