pulse-ts-sdk 0.0.54 → 0.0.56
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/BaseClient.d.ts +4 -0
- package/dist/cjs/BaseClient.js +3 -2
- package/dist/cjs/Client.js +12 -12
- package/dist/cjs/api/resources/jobs/client/Client.js +12 -12
- package/dist/cjs/api/resources/webhooks/client/Client.js +6 -6
- 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.d.mts +4 -0
- package/dist/esm/BaseClient.mjs +3 -2
- package/dist/esm/Client.mjs +12 -12
- package/dist/esm/api/resources/jobs/client/Client.mjs +13 -13
- package/dist/esm/api/resources/webhooks/client/Client.mjs +7 -7
- 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/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Instantiate and use the client with the following:
|
|
|
42
42
|
import { createReadStream } from "fs";
|
|
43
43
|
import { PulseClient } from "pulse-ts-sdk";
|
|
44
44
|
|
|
45
|
-
const client = new PulseClient({ apiKey: "YOUR_API_KEY" });
|
|
45
|
+
const client = new PulseClient({ apiKey: "YOUR_API_KEY", apiKey: "YOUR_API_KEY" });
|
|
46
46
|
await client.extract({});
|
|
47
47
|
```
|
|
48
48
|
|
|
@@ -87,7 +87,7 @@ You can upload files using the client:
|
|
|
87
87
|
import { createReadStream } from "fs";
|
|
88
88
|
import { PulseClient } from "pulse-ts-sdk";
|
|
89
89
|
|
|
90
|
-
const client = new PulseClient({ apiKey: "YOUR_API_KEY" });
|
|
90
|
+
const client = new PulseClient({ apiKey: "YOUR_API_KEY", apiKey: "YOUR_API_KEY" });
|
|
91
91
|
await client.extract({});
|
|
92
92
|
```
|
|
93
93
|
The client accepts a variety of types for file upload parameters:
|
package/dist/cjs/BaseClient.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export type BaseClientOptions = {
|
|
|
5
5
|
environment?: core.Supplier<environments.PulseEnvironment | string>;
|
|
6
6
|
/** Specify a custom URL to connect the client to. */
|
|
7
7
|
baseUrl?: core.Supplier<string>;
|
|
8
|
+
/** Override the x-api-key header */
|
|
9
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
8
10
|
/** Additional headers to include in requests. */
|
|
9
11
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
10
12
|
/** The default maximum time to wait for a response in seconds. */
|
|
@@ -23,6 +25,8 @@ export interface BaseRequestOptions {
|
|
|
23
25
|
maxRetries?: number;
|
|
24
26
|
/** A hook to abort the request. */
|
|
25
27
|
abortSignal?: AbortSignal;
|
|
28
|
+
/** Override the x-api-key header */
|
|
29
|
+
apiKey?: string | undefined;
|
|
26
30
|
/** Additional query string parameters to include in the request. */
|
|
27
31
|
queryParams?: Record<string, unknown>;
|
|
28
32
|
/** Additional headers to include in the request. */
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,10 +43,11 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "pulse-ts-sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "0.0.
|
|
47
|
-
"User-Agent": "pulse-ts-sdk/0.0.
|
|
46
|
+
"X-Fern-SDK-Version": "0.0.56",
|
|
47
|
+
"User-Agent": "pulse-ts-sdk/0.0.56",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
|
+
"x-api-key": options === null || options === void 0 ? void 0 : options.apiKey,
|
|
50
51
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
51
52
|
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
52
53
|
}
|
package/dist/cjs/Client.js
CHANGED
|
@@ -87,7 +87,7 @@ class PulseClient {
|
|
|
87
87
|
}
|
|
88
88
|
__extract(request, requestOptions) {
|
|
89
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
90
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
91
91
|
const _request = yield core.newFormData();
|
|
92
92
|
if (request.file != null) {
|
|
93
93
|
yield _request.appendFile("file", request.file);
|
|
@@ -137,19 +137,19 @@ class PulseClient {
|
|
|
137
137
|
_request.append("storage", (0, json_js_1.toJson)(request.storage));
|
|
138
138
|
}
|
|
139
139
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
140
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
140
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
141
141
|
const _response = yield core.fetcher({
|
|
142
|
-
url: core.url.join((
|
|
142
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PulseEnvironment.Default, "extract"),
|
|
143
143
|
method: "POST",
|
|
144
144
|
headers: _headers,
|
|
145
145
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
146
146
|
requestType: "file",
|
|
147
147
|
duplex: _maybeEncodedRequest.duplex,
|
|
148
148
|
body: _maybeEncodedRequest.body,
|
|
149
|
-
timeoutMs: ((
|
|
150
|
-
maxRetries: (
|
|
149
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
150
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
151
151
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
152
|
-
fetchFn: (
|
|
152
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
153
153
|
logging: this._options.logging,
|
|
154
154
|
});
|
|
155
155
|
if (_response.ok) {
|
|
@@ -195,7 +195,7 @@ class PulseClient {
|
|
|
195
195
|
}
|
|
196
196
|
__extractAsync(request, requestOptions) {
|
|
197
197
|
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
198
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
199
199
|
const _request = yield core.newFormData();
|
|
200
200
|
if (request.file != null) {
|
|
201
201
|
yield _request.appendFile("file", request.file);
|
|
@@ -245,19 +245,19 @@ class PulseClient {
|
|
|
245
245
|
_request.append("storage", (0, json_js_1.toJson)(request.storage));
|
|
246
246
|
}
|
|
247
247
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
248
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
248
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
249
249
|
const _response = yield core.fetcher({
|
|
250
|
-
url: core.url.join((
|
|
250
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PulseEnvironment.Default, "extract_async"),
|
|
251
251
|
method: "POST",
|
|
252
252
|
headers: _headers,
|
|
253
253
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
254
254
|
requestType: "file",
|
|
255
255
|
duplex: _maybeEncodedRequest.duplex,
|
|
256
256
|
body: _maybeEncodedRequest.body,
|
|
257
|
-
timeoutMs: ((
|
|
258
|
-
maxRetries: (
|
|
257
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
258
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
259
259
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
260
|
-
fetchFn: (
|
|
260
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
261
261
|
logging: this._options.logging,
|
|
262
262
|
});
|
|
263
263
|
if (_response.ok) {
|
|
@@ -78,18 +78,18 @@ class JobsClient {
|
|
|
78
78
|
}
|
|
79
79
|
__getJob(request, requestOptions) {
|
|
80
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
81
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
82
82
|
const { jobId } = request;
|
|
83
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
83
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
84
84
|
const _response = yield core.fetcher({
|
|
85
|
-
url: core.url.join((
|
|
85
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PulseEnvironment.Default, `job/${core.url.encodePathParam(jobId)}`),
|
|
86
86
|
method: "GET",
|
|
87
87
|
headers: _headers,
|
|
88
88
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
89
|
-
timeoutMs: ((
|
|
90
|
-
maxRetries: (
|
|
89
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
90
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
91
91
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
92
|
-
fetchFn: (
|
|
92
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
93
93
|
logging: this._options.logging,
|
|
94
94
|
});
|
|
95
95
|
if (_response.ok) {
|
|
@@ -141,18 +141,18 @@ class JobsClient {
|
|
|
141
141
|
}
|
|
142
142
|
__cancelJob(request, requestOptions) {
|
|
143
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
144
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
145
145
|
const { jobId } = request;
|
|
146
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
146
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
147
147
|
const _response = yield core.fetcher({
|
|
148
|
-
url: core.url.join((
|
|
148
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PulseEnvironment.Default, `job/${core.url.encodePathParam(jobId)}`),
|
|
149
149
|
method: "DELETE",
|
|
150
150
|
headers: _headers,
|
|
151
151
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
152
|
-
timeoutMs: ((
|
|
153
|
-
maxRetries: (
|
|
152
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
153
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
154
154
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
155
|
-
fetchFn: (
|
|
155
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
156
156
|
logging: this._options.logging,
|
|
157
157
|
});
|
|
158
158
|
if (_response.ok) {
|
|
@@ -71,17 +71,17 @@ class WebhooksClient {
|
|
|
71
71
|
}
|
|
72
72
|
__createWebhookLink(requestOptions) {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
75
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
75
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
76
76
|
const _response = yield core.fetcher({
|
|
77
|
-
url: core.url.join((
|
|
77
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PulseEnvironment.Default, "webhook"),
|
|
78
78
|
method: "POST",
|
|
79
79
|
headers: _headers,
|
|
80
80
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
81
|
-
timeoutMs: ((
|
|
82
|
-
maxRetries: (
|
|
81
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
82
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
83
83
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
84
|
-
fetchFn: (
|
|
84
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
85
85
|
logging: this._options.logging,
|
|
86
86
|
});
|
|
87
87
|
if (_response.ok) {
|
package/dist/cjs/environments.js
CHANGED
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.56";
|
package/dist/cjs/version.js
CHANGED
|
@@ -5,6 +5,8 @@ export type BaseClientOptions = {
|
|
|
5
5
|
environment?: core.Supplier<environments.PulseEnvironment | string>;
|
|
6
6
|
/** Specify a custom URL to connect the client to. */
|
|
7
7
|
baseUrl?: core.Supplier<string>;
|
|
8
|
+
/** Override the x-api-key header */
|
|
9
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
8
10
|
/** Additional headers to include in requests. */
|
|
9
11
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
10
12
|
/** The default maximum time to wait for a response in seconds. */
|
|
@@ -23,6 +25,8 @@ export interface BaseRequestOptions {
|
|
|
23
25
|
maxRetries?: number;
|
|
24
26
|
/** A hook to abort the request. */
|
|
25
27
|
abortSignal?: AbortSignal;
|
|
28
|
+
/** Override the x-api-key header */
|
|
29
|
+
apiKey?: string | undefined;
|
|
26
30
|
/** Additional query string parameters to include in the request. */
|
|
27
31
|
queryParams?: Record<string, unknown>;
|
|
28
32
|
/** Additional headers to include in the request. */
|
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,10 +6,11 @@ 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": "0.0.
|
|
10
|
-
"User-Agent": "pulse-ts-sdk/0.0.
|
|
9
|
+
"X-Fern-SDK-Version": "0.0.56",
|
|
10
|
+
"User-Agent": "pulse-ts-sdk/0.0.56",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
|
+
"x-api-key": options === null || options === void 0 ? void 0 : options.apiKey,
|
|
13
14
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
14
15
|
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
15
16
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -51,7 +51,7 @@ export class PulseClient {
|
|
|
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, _j;
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
55
55
|
const _request = yield core.newFormData();
|
|
56
56
|
if (request.file != null) {
|
|
57
57
|
yield _request.appendFile("file", request.file);
|
|
@@ -101,19 +101,19 @@ export class PulseClient {
|
|
|
101
101
|
_request.append("storage", toJson(request.storage));
|
|
102
102
|
}
|
|
103
103
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
104
|
-
const _headers = mergeHeaders((_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);
|
|
104
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
105
105
|
const _response = yield core.fetcher({
|
|
106
|
-
url: core.url.join((
|
|
106
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PulseEnvironment.Default, "extract"),
|
|
107
107
|
method: "POST",
|
|
108
108
|
headers: _headers,
|
|
109
109
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
110
110
|
requestType: "file",
|
|
111
111
|
duplex: _maybeEncodedRequest.duplex,
|
|
112
112
|
body: _maybeEncodedRequest.body,
|
|
113
|
-
timeoutMs: ((
|
|
114
|
-
maxRetries: (
|
|
113
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
114
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
115
115
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
116
|
-
fetchFn: (
|
|
116
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
117
117
|
logging: this._options.logging,
|
|
118
118
|
});
|
|
119
119
|
if (_response.ok) {
|
|
@@ -159,7 +159,7 @@ export class PulseClient {
|
|
|
159
159
|
}
|
|
160
160
|
__extractAsync(request, requestOptions) {
|
|
161
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
162
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
163
163
|
const _request = yield core.newFormData();
|
|
164
164
|
if (request.file != null) {
|
|
165
165
|
yield _request.appendFile("file", request.file);
|
|
@@ -209,19 +209,19 @@ export class PulseClient {
|
|
|
209
209
|
_request.append("storage", toJson(request.storage));
|
|
210
210
|
}
|
|
211
211
|
const _maybeEncodedRequest = yield _request.getRequest();
|
|
212
|
-
const _headers = mergeHeaders((_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);
|
|
212
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
213
213
|
const _response = yield core.fetcher({
|
|
214
|
-
url: core.url.join((
|
|
214
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PulseEnvironment.Default, "extract_async"),
|
|
215
215
|
method: "POST",
|
|
216
216
|
headers: _headers,
|
|
217
217
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
218
218
|
requestType: "file",
|
|
219
219
|
duplex: _maybeEncodedRequest.duplex,
|
|
220
220
|
body: _maybeEncodedRequest.body,
|
|
221
|
-
timeoutMs: ((
|
|
222
|
-
maxRetries: (
|
|
221
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
222
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
223
223
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
224
|
-
fetchFn: (
|
|
224
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
225
225
|
logging: this._options.logging,
|
|
226
226
|
});
|
|
227
227
|
if (_response.ok) {
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { normalizeClientOptions } 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";
|
|
@@ -42,18 +42,18 @@ export class JobsClient {
|
|
|
42
42
|
}
|
|
43
43
|
__getJob(request, requestOptions) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
46
46
|
const { jobId } = request;
|
|
47
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
47
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
48
48
|
const _response = yield core.fetcher({
|
|
49
|
-
url: core.url.join((
|
|
49
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PulseEnvironment.Default, `job/${core.url.encodePathParam(jobId)}`),
|
|
50
50
|
method: "GET",
|
|
51
51
|
headers: _headers,
|
|
52
52
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
53
|
-
timeoutMs: ((
|
|
54
|
-
maxRetries: (
|
|
53
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
54
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
55
55
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
56
|
-
fetchFn: (
|
|
56
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
57
57
|
logging: this._options.logging,
|
|
58
58
|
});
|
|
59
59
|
if (_response.ok) {
|
|
@@ -105,18 +105,18 @@ export class JobsClient {
|
|
|
105
105
|
}
|
|
106
106
|
__cancelJob(request, requestOptions) {
|
|
107
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
108
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
109
109
|
const { jobId } = request;
|
|
110
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
110
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
111
111
|
const _response = yield core.fetcher({
|
|
112
|
-
url: core.url.join((
|
|
112
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PulseEnvironment.Default, `job/${core.url.encodePathParam(jobId)}`),
|
|
113
113
|
method: "DELETE",
|
|
114
114
|
headers: _headers,
|
|
115
115
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
116
|
-
timeoutMs: ((
|
|
117
|
-
maxRetries: (
|
|
116
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
117
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
118
118
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
119
|
-
fetchFn: (
|
|
119
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
120
120
|
logging: this._options.logging,
|
|
121
121
|
});
|
|
122
122
|
if (_response.ok) {
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { normalizeClientOptions } 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";
|
|
@@ -35,17 +35,17 @@ export class WebhooksClient {
|
|
|
35
35
|
}
|
|
36
36
|
__createWebhookLink(requestOptions) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
39
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
39
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
40
40
|
const _response = yield core.fetcher({
|
|
41
|
-
url: core.url.join((
|
|
41
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PulseEnvironment.Default, "webhook"),
|
|
42
42
|
method: "POST",
|
|
43
43
|
headers: _headers,
|
|
44
44
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
45
|
-
timeoutMs: ((
|
|
46
|
-
maxRetries: (
|
|
45
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
46
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
47
47
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
48
|
-
fetchFn: (
|
|
48
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
49
49
|
logging: this._options.logging,
|
|
50
50
|
});
|
|
51
51
|
if (_response.ok) {
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.56";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.0.
|
|
1
|
+
export const SDK_VERSION = "0.0.56";
|