pulse-ts-sdk 0.0.57 → 0.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/BaseClient.d.ts +2 -12
  3. package/dist/cjs/BaseClient.js +2 -15
  4. package/dist/cjs/Client.js +12 -12
  5. package/dist/cjs/api/resources/jobs/client/Client.js +12 -12
  6. package/dist/cjs/api/resources/webhooks/client/Client.js +6 -6
  7. package/dist/cjs/core/index.d.ts +0 -2
  8. package/dist/cjs/core/index.js +0 -2
  9. package/dist/cjs/version.d.ts +1 -1
  10. package/dist/cjs/version.js +1 -1
  11. package/dist/esm/BaseClient.d.mts +2 -12
  12. package/dist/esm/BaseClient.mjs +2 -14
  13. package/dist/esm/Client.mjs +12 -12
  14. package/dist/esm/api/resources/jobs/client/Client.mjs +13 -13
  15. package/dist/esm/api/resources/webhooks/client/Client.mjs +7 -7
  16. package/dist/esm/core/index.d.mts +0 -2
  17. package/dist/esm/core/index.mjs +0 -2
  18. package/dist/esm/version.d.mts +1 -1
  19. package/dist/esm/version.mjs +1 -1
  20. package/package.json +1 -1
  21. package/dist/cjs/auth/HeaderAuthProvider.d.ts +0 -16
  22. package/dist/cjs/auth/HeaderAuthProvider.js +0 -71
  23. package/dist/cjs/auth/index.d.ts +0 -1
  24. package/dist/cjs/auth/index.js +0 -5
  25. package/dist/cjs/core/auth/AuthProvider.d.ts +0 -7
  26. package/dist/cjs/core/auth/AuthProvider.js +0 -2
  27. package/dist/cjs/core/auth/AuthRequest.d.ts +0 -9
  28. package/dist/cjs/core/auth/AuthRequest.js +0 -2
  29. package/dist/cjs/core/auth/BasicAuth.d.ts +0 -8
  30. package/dist/cjs/core/auth/BasicAuth.js +0 -27
  31. package/dist/cjs/core/auth/BearerToken.d.ts +0 -7
  32. package/dist/cjs/core/auth/BearerToken.js +0 -16
  33. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +0 -5
  34. package/dist/cjs/core/auth/NoOpAuthProvider.js +0 -9
  35. package/dist/cjs/core/auth/index.d.ts +0 -5
  36. package/dist/cjs/core/auth/index.js +0 -9
  37. package/dist/cjs/core/base64.d.ts +0 -2
  38. package/dist/cjs/core/base64.js +0 -26
  39. package/dist/esm/auth/HeaderAuthProvider.d.mts +0 -16
  40. package/dist/esm/auth/HeaderAuthProvider.mjs +0 -34
  41. package/dist/esm/auth/index.d.mts +0 -1
  42. package/dist/esm/auth/index.mjs +0 -1
  43. package/dist/esm/core/auth/AuthProvider.d.mts +0 -7
  44. package/dist/esm/core/auth/AuthProvider.mjs +0 -1
  45. package/dist/esm/core/auth/AuthRequest.d.mts +0 -9
  46. package/dist/esm/core/auth/AuthRequest.mjs +0 -1
  47. package/dist/esm/core/auth/BasicAuth.d.mts +0 -8
  48. package/dist/esm/core/auth/BasicAuth.mjs +0 -24
  49. package/dist/esm/core/auth/BearerToken.d.mts +0 -7
  50. package/dist/esm/core/auth/BearerToken.mjs +0 -13
  51. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +0 -5
  52. package/dist/esm/core/auth/NoOpAuthProvider.mjs +0 -5
  53. package/dist/esm/core/auth/index.d.mts +0 -5
  54. package/dist/esm/core/auth/index.mjs +0 -3
  55. package/dist/esm/core/base64.d.mts +0 -2
  56. package/dist/esm/core/base64.mjs +0 -22
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", apiKey: "YOUR_API_KEY" });
45
+ const client = new PulseClient;
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", apiKey: "YOUR_API_KEY" });
90
+ const client = new PulseClient;
91
91
  await client.extract({});
92
92
  ```
93
93
  The client accepts a variety of types for file upload parameters:
@@ -1,12 +1,9 @@
1
- import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.js";
2
1
  import * as core from "./core/index.js";
3
2
  import type * as environments from "./environments.js";
4
- export type BaseClientOptions = {
3
+ export interface BaseClientOptions {
5
4
  environment?: core.Supplier<environments.PulseEnvironment | string>;
6
5
  /** Specify a custom URL to connect the client to. */
7
6
  baseUrl?: core.Supplier<string>;
8
- /** Override the x-api-key header */
9
- apiKey?: core.Supplier<string | undefined>;
10
7
  /** Additional headers to include in requests. */
11
8
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
12
9
  /** The default maximum time to wait for a response in seconds. */
@@ -17,7 +14,7 @@ export type BaseClientOptions = {
17
14
  fetch?: typeof fetch;
18
15
  /** Configure logging for the client. */
19
16
  logging?: core.logging.LogConfig | core.logging.Logger;
20
- } & HeaderAuthProvider.AuthOptions;
17
+ }
21
18
  export interface BaseRequestOptions {
22
19
  /** The maximum time to wait for a response in seconds. */
23
20
  timeoutInSeconds?: number;
@@ -25,8 +22,6 @@ export interface BaseRequestOptions {
25
22
  maxRetries?: number;
26
23
  /** A hook to abort the request. */
27
24
  abortSignal?: AbortSignal;
28
- /** Override the x-api-key header */
29
- apiKey?: string | undefined;
30
25
  /** Additional query string parameters to include in the request. */
31
26
  queryParams?: Record<string, unknown>;
32
27
  /** Additional headers to include in the request. */
@@ -34,10 +29,5 @@ export interface BaseRequestOptions {
34
29
  }
35
30
  export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
36
31
  logging: core.logging.Logger;
37
- authProvider?: core.AuthProvider;
38
- };
39
- export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
40
- authProvider: core.AuthProvider;
41
32
  };
42
33
  export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
43
- export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
@@ -35,29 +35,16 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.normalizeClientOptions = normalizeClientOptions;
38
- exports.normalizeClientOptionsWithAuth = normalizeClientOptionsWithAuth;
39
- const HeaderAuthProvider_js_1 = require("./auth/HeaderAuthProvider.js");
40
38
  const headers_js_1 = require("./core/headers.js");
41
39
  const core = __importStar(require("./core/index.js"));
42
40
  function normalizeClientOptions(options) {
43
41
  const headers = (0, headers_js_1.mergeHeaders)({
44
42
  "X-Fern-Language": "JavaScript",
45
43
  "X-Fern-SDK-Name": "pulse-ts-sdk",
46
- "X-Fern-SDK-Version": "0.0.57",
47
- "User-Agent": "pulse-ts-sdk/0.0.57",
44
+ "X-Fern-SDK-Version": "0.0.58",
45
+ "User-Agent": "pulse-ts-sdk/0.0.58",
48
46
  "X-Fern-Runtime": core.RUNTIME.type,
49
47
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
- "x-api-key": options === null || options === void 0 ? void 0 : options.apiKey,
51
48
  }, options === null || options === void 0 ? void 0 : options.headers);
52
49
  return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
53
50
  }
54
- function normalizeClientOptionsWithAuth(options) {
55
- var _a;
56
- const normalized = normalizeClientOptions(options);
57
- const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
58
- (_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new HeaderAuthProvider_js_1.HeaderAuthProvider(normalizedWithNoOpAuthProvider));
59
- return normalized;
60
- }
61
- function withNoOpAuthProvider(options) {
62
- return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
63
- }
@@ -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, _k, _l;
90
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
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({ "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);
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);
141
141
  const _response = yield core.fetcher({
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"),
142
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PulseEnvironment.Default, "extract"),
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: ((_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,
149
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
150
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
151
151
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
152
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
152
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.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, _k, _l;
198
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
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({ "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);
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);
249
249
  const _response = yield core.fetcher({
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"),
250
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PulseEnvironment.Default, "extract_async"),
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: ((_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,
257
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
258
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
259
259
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
260
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
260
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.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, _k, _l;
81
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
82
82
  const { jobId } = request;
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);
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);
84
84
  const _response = yield core.fetcher({
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)}`),
85
+ 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, `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: ((_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,
89
+ 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,
90
+ 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,
91
91
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
92
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
92
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.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, _k, _l;
144
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
145
145
  const { jobId } = request;
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);
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);
147
147
  const _response = yield core.fetcher({
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)}`),
148
+ 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, `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: ((_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,
152
+ 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,
153
+ 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,
154
154
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
155
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
155
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.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, _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);
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);
76
76
  const _response = yield core.fetcher({
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"),
77
+ 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, "webhook"),
78
78
  method: "POST",
79
79
  headers: _headers,
80
80
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
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,
81
+ 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,
82
+ 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,
83
83
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
84
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
84
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
85
85
  logging: this._options.logging,
86
86
  });
87
87
  if (_response.ok) {
@@ -1,5 +1,3 @@
1
- export * from "./auth/index.js";
2
- export * from "./base64.js";
3
1
  export * from "./fetcher/index.js";
4
2
  export * as file from "./file/index.js";
5
3
  export * from "./form-data-utils/index.js";
@@ -37,8 +37,6 @@ var __importStar = (this && this.__importStar) || (function () {
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.url = exports.logging = exports.file = void 0;
40
- __exportStar(require("./auth/index.js"), exports);
41
- __exportStar(require("./base64.js"), exports);
42
40
  __exportStar(require("./fetcher/index.js"), exports);
43
41
  exports.file = __importStar(require("./file/index.js"));
44
42
  __exportStar(require("./form-data-utils/index.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.57";
1
+ export declare const SDK_VERSION = "0.0.58";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.57";
4
+ exports.SDK_VERSION = "0.0.58";
@@ -1,12 +1,9 @@
1
- import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.mjs";
2
1
  import * as core from "./core/index.mjs";
3
2
  import type * as environments from "./environments.mjs";
4
- export type BaseClientOptions = {
3
+ export interface BaseClientOptions {
5
4
  environment?: core.Supplier<environments.PulseEnvironment | string>;
6
5
  /** Specify a custom URL to connect the client to. */
7
6
  baseUrl?: core.Supplier<string>;
8
- /** Override the x-api-key header */
9
- apiKey?: core.Supplier<string | undefined>;
10
7
  /** Additional headers to include in requests. */
11
8
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
12
9
  /** The default maximum time to wait for a response in seconds. */
@@ -17,7 +14,7 @@ export type BaseClientOptions = {
17
14
  fetch?: typeof fetch;
18
15
  /** Configure logging for the client. */
19
16
  logging?: core.logging.LogConfig | core.logging.Logger;
20
- } & HeaderAuthProvider.AuthOptions;
17
+ }
21
18
  export interface BaseRequestOptions {
22
19
  /** The maximum time to wait for a response in seconds. */
23
20
  timeoutInSeconds?: number;
@@ -25,8 +22,6 @@ export interface BaseRequestOptions {
25
22
  maxRetries?: number;
26
23
  /** A hook to abort the request. */
27
24
  abortSignal?: AbortSignal;
28
- /** Override the x-api-key header */
29
- apiKey?: string | undefined;
30
25
  /** Additional query string parameters to include in the request. */
31
26
  queryParams?: Record<string, unknown>;
32
27
  /** Additional headers to include in the request. */
@@ -34,10 +29,5 @@ export interface BaseRequestOptions {
34
29
  }
35
30
  export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
36
31
  logging: core.logging.Logger;
37
- authProvider?: core.AuthProvider;
38
- };
39
- export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
40
- authProvider: core.AuthProvider;
41
32
  };
42
33
  export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
43
- export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
@@ -1,26 +1,14 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.mjs";
3
2
  import { mergeHeaders } from "./core/headers.mjs";
4
3
  import * as core from "./core/index.mjs";
5
4
  export function normalizeClientOptions(options) {
6
5
  const headers = mergeHeaders({
7
6
  "X-Fern-Language": "JavaScript",
8
7
  "X-Fern-SDK-Name": "pulse-ts-sdk",
9
- "X-Fern-SDK-Version": "0.0.57",
10
- "User-Agent": "pulse-ts-sdk/0.0.57",
8
+ "X-Fern-SDK-Version": "0.0.58",
9
+ "User-Agent": "pulse-ts-sdk/0.0.58",
11
10
  "X-Fern-Runtime": core.RUNTIME.type,
12
11
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
- "x-api-key": options === null || options === void 0 ? void 0 : options.apiKey,
14
12
  }, options === null || options === void 0 ? void 0 : options.headers);
15
13
  return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
16
14
  }
17
- export function normalizeClientOptionsWithAuth(options) {
18
- var _a;
19
- const normalized = normalizeClientOptions(options);
20
- const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
21
- (_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new HeaderAuthProvider(normalizedWithNoOpAuthProvider));
22
- return normalized;
23
- }
24
- function withNoOpAuthProvider(options) {
25
- return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
26
- }
@@ -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, _k, _l;
54
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
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({ "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);
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);
105
105
  const _response = yield core.fetcher({
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"),
106
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PulseEnvironment.Default, "extract"),
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: ((_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,
113
+ 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,
114
+ 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,
115
115
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
116
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
116
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.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, _k, _l;
162
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
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({ "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);
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);
213
213
  const _response = yield core.fetcher({
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"),
214
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PulseEnvironment.Default, "extract_async"),
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: ((_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,
221
+ 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,
222
+ 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,
223
223
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
224
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
224
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.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, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
12
+ import { mergeHeaders } 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, _k, _l;
45
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
46
46
  const { jobId } = request;
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);
47
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
48
48
  const _response = yield core.fetcher({
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)}`),
49
+ 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, `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: ((_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,
53
+ 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,
54
+ 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,
55
55
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
56
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
56
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.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, _k, _l;
108
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
109
109
  const { jobId } = request;
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);
110
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
111
111
  const _response = yield core.fetcher({
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)}`),
112
+ 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, `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: ((_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,
116
+ 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,
117
+ 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,
118
118
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
119
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
119
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.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, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
12
+ import { mergeHeaders } 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, _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);
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);
40
40
  const _response = yield core.fetcher({
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"),
41
+ 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, "webhook"),
42
42
  method: "POST",
43
43
  headers: _headers,
44
44
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
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,
45
+ 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,
46
+ 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,
47
47
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
48
- fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
48
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
49
49
  logging: this._options.logging,
50
50
  });
51
51
  if (_response.ok) {
@@ -1,5 +1,3 @@
1
- export * from "./auth/index.mjs";
2
- export * from "./base64.mjs";
3
1
  export * from "./fetcher/index.mjs";
4
2
  export * as file from "./file/index.mjs";
5
3
  export * from "./form-data-utils/index.mjs";
@@ -1,5 +1,3 @@
1
- export * from "./auth/index.mjs";
2
- export * from "./base64.mjs";
3
1
  export * from "./fetcher/index.mjs";
4
2
  export * as file from "./file/index.mjs";
5
3
  export * from "./form-data-utils/index.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.57";
1
+ export declare const SDK_VERSION = "0.0.58";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.57";
1
+ export const SDK_VERSION = "0.0.58";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulse-ts-sdk",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,16 +0,0 @@
1
- import * as core from "../core/index.js";
2
- export declare namespace HeaderAuthProvider {
3
- interface AuthOptions {
4
- apiKey?: core.Supplier<string>;
5
- }
6
- interface Options extends AuthOptions {
7
- }
8
- }
9
- export declare class HeaderAuthProvider implements core.AuthProvider {
10
- private readonly headerValue;
11
- constructor(options: HeaderAuthProvider.Options);
12
- static canCreate(options: HeaderAuthProvider.Options): boolean;
13
- getAuthRequest(_arg?: {
14
- endpointMetadata?: core.EndpointMetadata;
15
- }): Promise<core.AuthRequest>;
16
- }
@@ -1,71 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
- return new (P || (P = Promise))(function (resolve, reject) {
39
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
- step((generator = generator.apply(thisArg, _arguments || [])).next());
43
- });
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.HeaderAuthProvider = void 0;
47
- const core = __importStar(require("../core/index.js"));
48
- const errors = __importStar(require("../errors/index.js"));
49
- class HeaderAuthProvider {
50
- constructor(options) {
51
- this.headerValue = options.apiKey;
52
- }
53
- static canCreate(options) {
54
- return options.apiKey != null;
55
- }
56
- getAuthRequest(_arg) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- const apiKey = yield core.Supplier.get(this.headerValue);
59
- if (apiKey == null) {
60
- throw new errors.PulseError({
61
- message: "Please specify a apiKey by passing it in to the constructor",
62
- });
63
- }
64
- const headerValue = apiKey;
65
- return {
66
- headers: { "x-api-key": headerValue },
67
- };
68
- });
69
- }
70
- }
71
- exports.HeaderAuthProvider = HeaderAuthProvider;
@@ -1 +0,0 @@
1
- export { HeaderAuthProvider } from "./HeaderAuthProvider.js";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HeaderAuthProvider = void 0;
4
- var HeaderAuthProvider_js_1 = require("./HeaderAuthProvider.js");
5
- Object.defineProperty(exports, "HeaderAuthProvider", { enumerable: true, get: function () { return HeaderAuthProvider_js_1.HeaderAuthProvider; } });
@@ -1,7 +0,0 @@
1
- import type { EndpointMetadata } from "../fetcher/EndpointMetadata.js";
2
- import type { AuthRequest } from "./AuthRequest.js";
3
- export interface AuthProvider {
4
- getAuthRequest(arg?: {
5
- endpointMetadata?: EndpointMetadata;
6
- }): Promise<AuthRequest>;
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- /**
2
- * Request parameters for authentication requests.
3
- */
4
- export interface AuthRequest {
5
- /**
6
- * The headers to be included in the request.
7
- */
8
- headers: Record<string, string>;
9
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- export interface BasicAuth {
2
- username: string;
3
- password: string;
4
- }
5
- export declare const BasicAuth: {
6
- toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
7
- fromAuthorizationHeader: (header: string) => BasicAuth;
8
- };
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BasicAuth = void 0;
4
- const base64_js_1 = require("../base64.js");
5
- const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
6
- exports.BasicAuth = {
7
- toAuthorizationHeader: (basicAuth) => {
8
- if (basicAuth == null) {
9
- return undefined;
10
- }
11
- const token = (0, base64_js_1.base64Encode)(`${basicAuth.username}:${basicAuth.password}`);
12
- return `Basic ${token}`;
13
- },
14
- fromAuthorizationHeader: (header) => {
15
- const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, "");
16
- const decoded = (0, base64_js_1.base64Decode)(credentials);
17
- const [username, ...passwordParts] = decoded.split(":");
18
- const password = passwordParts.length > 0 ? passwordParts.join(":") : undefined;
19
- if (username == null || password == null) {
20
- throw new Error("Invalid basic auth");
21
- }
22
- return {
23
- username,
24
- password,
25
- };
26
- },
27
- };
@@ -1,7 +0,0 @@
1
- export type BearerToken = string;
2
- declare function toAuthorizationHeader(token: string | undefined): string | undefined;
3
- export declare const BearerToken: {
4
- toAuthorizationHeader: typeof toAuthorizationHeader;
5
- fromAuthorizationHeader: (header: string) => BearerToken;
6
- };
7
- export {};
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BearerToken = void 0;
4
- const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i;
5
- function toAuthorizationHeader(token) {
6
- if (token == null) {
7
- return undefined;
8
- }
9
- return `Bearer ${token}`;
10
- }
11
- exports.BearerToken = {
12
- toAuthorizationHeader: toAuthorizationHeader,
13
- fromAuthorizationHeader: (header) => {
14
- return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim();
15
- },
16
- };
@@ -1,5 +0,0 @@
1
- import type { AuthProvider } from "./AuthProvider.js";
2
- import type { AuthRequest } from "./AuthRequest.js";
3
- export declare class NoOpAuthProvider implements AuthProvider {
4
- getAuthRequest(): Promise<AuthRequest>;
5
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoOpAuthProvider = void 0;
4
- class NoOpAuthProvider {
5
- getAuthRequest() {
6
- return Promise.resolve({ headers: {} });
7
- }
8
- }
9
- exports.NoOpAuthProvider = NoOpAuthProvider;
@@ -1,5 +0,0 @@
1
- export type { AuthProvider } from "./AuthProvider.js";
2
- export type { AuthRequest } from "./AuthRequest.js";
3
- export { BasicAuth } from "./BasicAuth.js";
4
- export { BearerToken } from "./BearerToken.js";
5
- export { NoOpAuthProvider } from "./NoOpAuthProvider.js";
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoOpAuthProvider = exports.BearerToken = exports.BasicAuth = void 0;
4
- var BasicAuth_js_1 = require("./BasicAuth.js");
5
- Object.defineProperty(exports, "BasicAuth", { enumerable: true, get: function () { return BasicAuth_js_1.BasicAuth; } });
6
- var BearerToken_js_1 = require("./BearerToken.js");
7
- Object.defineProperty(exports, "BearerToken", { enumerable: true, get: function () { return BearerToken_js_1.BearerToken; } });
8
- var NoOpAuthProvider_js_1 = require("./NoOpAuthProvider.js");
9
- Object.defineProperty(exports, "NoOpAuthProvider", { enumerable: true, get: function () { return NoOpAuthProvider_js_1.NoOpAuthProvider; } });
@@ -1,2 +0,0 @@
1
- export declare function base64Encode(input: string): string;
2
- export declare function base64Decode(input: string): string;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.base64Encode = base64Encode;
4
- exports.base64Decode = base64Decode;
5
- function base64ToBytes(base64) {
6
- const binString = atob(base64);
7
- return Uint8Array.from(binString, (m) => m.codePointAt(0));
8
- }
9
- function bytesToBase64(bytes) {
10
- const binString = String.fromCodePoint(...bytes);
11
- return btoa(binString);
12
- }
13
- function base64Encode(input) {
14
- if (typeof Buffer !== "undefined") {
15
- return Buffer.from(input, "utf8").toString("base64");
16
- }
17
- const bytes = new TextEncoder().encode(input);
18
- return bytesToBase64(bytes);
19
- }
20
- function base64Decode(input) {
21
- if (typeof Buffer !== "undefined") {
22
- return Buffer.from(input, "base64").toString("utf8");
23
- }
24
- const bytes = base64ToBytes(input);
25
- return new TextDecoder().decode(bytes);
26
- }
@@ -1,16 +0,0 @@
1
- import * as core from "../core/index.mjs";
2
- export declare namespace HeaderAuthProvider {
3
- interface AuthOptions {
4
- apiKey?: core.Supplier<string>;
5
- }
6
- interface Options extends AuthOptions {
7
- }
8
- }
9
- export declare class HeaderAuthProvider implements core.AuthProvider {
10
- private readonly headerValue;
11
- constructor(options: HeaderAuthProvider.Options);
12
- static canCreate(options: HeaderAuthProvider.Options): boolean;
13
- getAuthRequest(_arg?: {
14
- endpointMetadata?: core.EndpointMetadata;
15
- }): Promise<core.AuthRequest>;
16
- }
@@ -1,34 +0,0 @@
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 * as core from "../core/index.mjs";
12
- import * as errors from "../errors/index.mjs";
13
- export class HeaderAuthProvider {
14
- constructor(options) {
15
- this.headerValue = options.apiKey;
16
- }
17
- static canCreate(options) {
18
- return options.apiKey != null;
19
- }
20
- getAuthRequest(_arg) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const apiKey = yield core.Supplier.get(this.headerValue);
23
- if (apiKey == null) {
24
- throw new errors.PulseError({
25
- message: "Please specify a apiKey by passing it in to the constructor",
26
- });
27
- }
28
- const headerValue = apiKey;
29
- return {
30
- headers: { "x-api-key": headerValue },
31
- };
32
- });
33
- }
34
- }
@@ -1 +0,0 @@
1
- export { HeaderAuthProvider } from "./HeaderAuthProvider.mjs";
@@ -1 +0,0 @@
1
- export { HeaderAuthProvider } from "./HeaderAuthProvider.mjs";
@@ -1,7 +0,0 @@
1
- import type { EndpointMetadata } from "../fetcher/EndpointMetadata.mjs";
2
- import type { AuthRequest } from "./AuthRequest.mjs";
3
- export interface AuthProvider {
4
- getAuthRequest(arg?: {
5
- endpointMetadata?: EndpointMetadata;
6
- }): Promise<AuthRequest>;
7
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- /**
2
- * Request parameters for authentication requests.
3
- */
4
- export interface AuthRequest {
5
- /**
6
- * The headers to be included in the request.
7
- */
8
- headers: Record<string, string>;
9
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export interface BasicAuth {
2
- username: string;
3
- password: string;
4
- }
5
- export declare const BasicAuth: {
6
- toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
7
- fromAuthorizationHeader: (header: string) => BasicAuth;
8
- };
@@ -1,24 +0,0 @@
1
- import { base64Decode, base64Encode } from "../base64.mjs";
2
- const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
3
- export const BasicAuth = {
4
- toAuthorizationHeader: (basicAuth) => {
5
- if (basicAuth == null) {
6
- return undefined;
7
- }
8
- const token = base64Encode(`${basicAuth.username}:${basicAuth.password}`);
9
- return `Basic ${token}`;
10
- },
11
- fromAuthorizationHeader: (header) => {
12
- const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, "");
13
- const decoded = base64Decode(credentials);
14
- const [username, ...passwordParts] = decoded.split(":");
15
- const password = passwordParts.length > 0 ? passwordParts.join(":") : undefined;
16
- if (username == null || password == null) {
17
- throw new Error("Invalid basic auth");
18
- }
19
- return {
20
- username,
21
- password,
22
- };
23
- },
24
- };
@@ -1,7 +0,0 @@
1
- export type BearerToken = string;
2
- declare function toAuthorizationHeader(token: string | undefined): string | undefined;
3
- export declare const BearerToken: {
4
- toAuthorizationHeader: typeof toAuthorizationHeader;
5
- fromAuthorizationHeader: (header: string) => BearerToken;
6
- };
7
- export {};
@@ -1,13 +0,0 @@
1
- const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i;
2
- function toAuthorizationHeader(token) {
3
- if (token == null) {
4
- return undefined;
5
- }
6
- return `Bearer ${token}`;
7
- }
8
- export const BearerToken = {
9
- toAuthorizationHeader: toAuthorizationHeader,
10
- fromAuthorizationHeader: (header) => {
11
- return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim();
12
- },
13
- };
@@ -1,5 +0,0 @@
1
- import type { AuthProvider } from "./AuthProvider.mjs";
2
- import type { AuthRequest } from "./AuthRequest.mjs";
3
- export declare class NoOpAuthProvider implements AuthProvider {
4
- getAuthRequest(): Promise<AuthRequest>;
5
- }
@@ -1,5 +0,0 @@
1
- export class NoOpAuthProvider {
2
- getAuthRequest() {
3
- return Promise.resolve({ headers: {} });
4
- }
5
- }
@@ -1,5 +0,0 @@
1
- export type { AuthProvider } from "./AuthProvider.mjs";
2
- export type { AuthRequest } from "./AuthRequest.mjs";
3
- export { BasicAuth } from "./BasicAuth.mjs";
4
- export { BearerToken } from "./BearerToken.mjs";
5
- export { NoOpAuthProvider } from "./NoOpAuthProvider.mjs";
@@ -1,3 +0,0 @@
1
- export { BasicAuth } from "./BasicAuth.mjs";
2
- export { BearerToken } from "./BearerToken.mjs";
3
- export { NoOpAuthProvider } from "./NoOpAuthProvider.mjs";
@@ -1,2 +0,0 @@
1
- export declare function base64Encode(input: string): string;
2
- export declare function base64Decode(input: string): string;
@@ -1,22 +0,0 @@
1
- function base64ToBytes(base64) {
2
- const binString = atob(base64);
3
- return Uint8Array.from(binString, (m) => m.codePointAt(0));
4
- }
5
- function bytesToBase64(bytes) {
6
- const binString = String.fromCodePoint(...bytes);
7
- return btoa(binString);
8
- }
9
- export function base64Encode(input) {
10
- if (typeof Buffer !== "undefined") {
11
- return Buffer.from(input, "utf8").toString("base64");
12
- }
13
- const bytes = new TextEncoder().encode(input);
14
- return bytesToBase64(bytes);
15
- }
16
- export function base64Decode(input) {
17
- if (typeof Buffer !== "undefined") {
18
- return Buffer.from(input, "base64").toString("utf8");
19
- }
20
- const bytes = base64ToBytes(input);
21
- return new TextDecoder().decode(bytes);
22
- }