@payabli/sdk-node 0.0.138 → 0.0.140

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.
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@payabli/sdk-node",
46
- "X-Fern-SDK-Version": "0.0.138",
47
- "User-Agent": "@payabli/sdk-node/0.0.138",
46
+ "X-Fern-SDK-Version": "0.0.140",
47
+ "User-Agent": "@payabli/sdk-node/0.0.140",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,6 +1,6 @@
1
1
  export interface BasicAuth {
2
- username: string;
3
- password: string;
2
+ username?: string;
3
+ password?: string;
4
4
  }
5
5
  export declare const BasicAuth: {
6
6
  toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
@@ -5,10 +5,16 @@ const base64_js_1 = require("../base64.js");
5
5
  const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
6
6
  exports.BasicAuth = {
7
7
  toAuthorizationHeader: (basicAuth) => {
8
+ var _a, _b;
8
9
  if (basicAuth == null) {
9
10
  return undefined;
10
11
  }
11
- const token = (0, base64_js_1.base64Encode)(`${basicAuth.username}:${basicAuth.password}`);
12
+ const username = (_a = basicAuth.username) !== null && _a !== void 0 ? _a : "";
13
+ const password = (_b = basicAuth.password) !== null && _b !== void 0 ? _b : "";
14
+ if (username === "" && password === "") {
15
+ return undefined;
16
+ }
17
+ const token = (0, base64_js_1.base64Encode)(`${username}:${password}`);
12
18
  return `Basic ${token}`;
13
19
  },
14
20
  fromAuthorizationHeader: (header) => {
@@ -38,10 +38,12 @@ export declare namespace Fetcher {
38
38
  }
39
39
  interface TimeoutError {
40
40
  reason: "timeout";
41
+ cause?: unknown;
41
42
  }
42
43
  interface UnknownError {
43
44
  reason: "unknown";
44
45
  errorMessage: string;
46
+ cause?: unknown;
45
47
  }
46
48
  }
47
49
  export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
@@ -261,6 +261,7 @@ function fetcherImpl(args) {
261
261
  error: {
262
262
  reason: "unknown",
263
263
  errorMessage: "The user aborted a request",
264
+ cause: error,
264
265
  },
265
266
  rawResponse: RawResponse_js_1.abortRawResponse,
266
267
  };
@@ -278,6 +279,7 @@ function fetcherImpl(args) {
278
279
  ok: false,
279
280
  error: {
280
281
  reason: "timeout",
282
+ cause: error,
281
283
  },
282
284
  rawResponse: RawResponse_js_1.abortRawResponse,
283
285
  };
@@ -296,6 +298,7 @@ function fetcherImpl(args) {
296
298
  error: {
297
299
  reason: "unknown",
298
300
  errorMessage: error.message,
301
+ cause: error,
299
302
  },
300
303
  rawResponse: RawResponse_js_1.unknownRawResponse,
301
304
  };
@@ -313,6 +316,7 @@ function fetcherImpl(args) {
313
316
  error: {
314
317
  reason: "unknown",
315
318
  errorMessage: (0, json_js_1.toJson)(error),
319
+ cause: error,
316
320
  },
317
321
  rawResponse: RawResponse_js_1.unknownRawResponse,
318
322
  };
@@ -3,10 +3,12 @@ export declare class PayabliError extends Error {
3
3
  readonly statusCode?: number;
4
4
  readonly body?: unknown;
5
5
  readonly rawResponse?: core.RawResponse;
6
- constructor({ message, statusCode, body, rawResponse, }: {
6
+ readonly cause?: unknown;
7
+ constructor({ message, statusCode, body, rawResponse, cause, }: {
7
8
  message?: string;
8
9
  statusCode?: number;
9
10
  body?: unknown;
10
11
  rawResponse?: core.RawResponse;
12
+ cause?: unknown;
11
13
  });
12
14
  }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.PayabliError = void 0;
5
5
  const json_js_1 = require("../core/json.js");
6
6
  class PayabliError extends Error {
7
- constructor({ message, statusCode, body, rawResponse, }) {
7
+ constructor({ message, statusCode, body, rawResponse, cause, }) {
8
8
  super(buildMessage({ message, statusCode, body }));
9
9
  Object.setPrototypeOf(this, new.target.prototype);
10
10
  if (Error.captureStackTrace) {
@@ -14,6 +14,9 @@ class PayabliError extends Error {
14
14
  this.statusCode = statusCode;
15
15
  this.body = body;
16
16
  this.rawResponse = rawResponse;
17
+ if (cause != null) {
18
+ this.cause = cause;
19
+ }
17
20
  }
18
21
  }
19
22
  exports.PayabliError = PayabliError;
@@ -1,3 +1,6 @@
1
1
  export declare class PayabliTimeoutError extends Error {
2
- constructor(message: string);
2
+ readonly cause?: unknown;
3
+ constructor(message: string, opts?: {
4
+ cause?: unknown;
5
+ });
3
6
  }
@@ -3,13 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.PayabliTimeoutError = void 0;
5
5
  class PayabliTimeoutError extends Error {
6
- constructor(message) {
6
+ constructor(message, opts) {
7
7
  super(message);
8
8
  Object.setPrototypeOf(this, new.target.prototype);
9
9
  if (Error.captureStackTrace) {
10
10
  Error.captureStackTrace(this, this.constructor);
11
11
  }
12
12
  this.name = this.constructor.name;
13
+ if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
14
+ this.cause = opts.cause;
15
+ }
13
16
  }
14
17
  }
15
18
  exports.PayabliTimeoutError = PayabliTimeoutError;
@@ -50,11 +50,14 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
50
50
  rawResponse: rawResponse,
51
51
  });
52
52
  case "timeout":
53
- throw new errors.PayabliTimeoutError(`Timeout exceeded when calling ${method} ${path}.`);
53
+ throw new errors.PayabliTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
54
+ cause: error.cause,
55
+ });
54
56
  case "unknown":
55
57
  throw new errors.PayabliError({
56
58
  message: error.errorMessage,
57
59
  rawResponse: rawResponse,
60
+ cause: error.cause,
58
61
  });
59
62
  default:
60
63
  throw new errors.PayabliError({
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.138";
1
+ export declare const SDK_VERSION = "0.0.140";
@@ -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.138";
4
+ exports.SDK_VERSION = "0.0.140";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "@payabli/sdk-node",
9
- "X-Fern-SDK-Version": "0.0.138",
10
- "User-Agent": "@payabli/sdk-node/0.0.138",
9
+ "X-Fern-SDK-Version": "0.0.140",
10
+ "User-Agent": "@payabli/sdk-node/0.0.140",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,6 +1,6 @@
1
1
  export interface BasicAuth {
2
- username: string;
3
- password: string;
2
+ username?: string;
3
+ password?: string;
4
4
  }
5
5
  export declare const BasicAuth: {
6
6
  toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
@@ -2,10 +2,16 @@ import { base64Decode, base64Encode } from "../base64.mjs";
2
2
  const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
3
3
  export const BasicAuth = {
4
4
  toAuthorizationHeader: (basicAuth) => {
5
+ var _a, _b;
5
6
  if (basicAuth == null) {
6
7
  return undefined;
7
8
  }
8
- const token = base64Encode(`${basicAuth.username}:${basicAuth.password}`);
9
+ const username = (_a = basicAuth.username) !== null && _a !== void 0 ? _a : "";
10
+ const password = (_b = basicAuth.password) !== null && _b !== void 0 ? _b : "";
11
+ if (username === "" && password === "") {
12
+ return undefined;
13
+ }
14
+ const token = base64Encode(`${username}:${password}`);
9
15
  return `Basic ${token}`;
10
16
  },
11
17
  fromAuthorizationHeader: (header) => {
@@ -38,10 +38,12 @@ export declare namespace Fetcher {
38
38
  }
39
39
  interface TimeoutError {
40
40
  reason: "timeout";
41
+ cause?: unknown;
41
42
  }
42
43
  interface UnknownError {
43
44
  reason: "unknown";
44
45
  errorMessage: string;
46
+ cause?: unknown;
45
47
  }
46
48
  }
47
49
  export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
@@ -257,6 +257,7 @@ export function fetcherImpl(args) {
257
257
  error: {
258
258
  reason: "unknown",
259
259
  errorMessage: "The user aborted a request",
260
+ cause: error,
260
261
  },
261
262
  rawResponse: abortRawResponse,
262
263
  };
@@ -274,6 +275,7 @@ export function fetcherImpl(args) {
274
275
  ok: false,
275
276
  error: {
276
277
  reason: "timeout",
278
+ cause: error,
277
279
  },
278
280
  rawResponse: abortRawResponse,
279
281
  };
@@ -292,6 +294,7 @@ export function fetcherImpl(args) {
292
294
  error: {
293
295
  reason: "unknown",
294
296
  errorMessage: error.message,
297
+ cause: error,
295
298
  },
296
299
  rawResponse: unknownRawResponse,
297
300
  };
@@ -309,6 +312,7 @@ export function fetcherImpl(args) {
309
312
  error: {
310
313
  reason: "unknown",
311
314
  errorMessage: toJson(error),
315
+ cause: error,
312
316
  },
313
317
  rawResponse: unknownRawResponse,
314
318
  };
@@ -3,10 +3,12 @@ export declare class PayabliError extends Error {
3
3
  readonly statusCode?: number;
4
4
  readonly body?: unknown;
5
5
  readonly rawResponse?: core.RawResponse;
6
- constructor({ message, statusCode, body, rawResponse, }: {
6
+ readonly cause?: unknown;
7
+ constructor({ message, statusCode, body, rawResponse, cause, }: {
7
8
  message?: string;
8
9
  statusCode?: number;
9
10
  body?: unknown;
10
11
  rawResponse?: core.RawResponse;
12
+ cause?: unknown;
11
13
  });
12
14
  }
@@ -1,7 +1,7 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  import { toJson } from "../core/json.mjs";
3
3
  export class PayabliError extends Error {
4
- constructor({ message, statusCode, body, rawResponse, }) {
4
+ constructor({ message, statusCode, body, rawResponse, cause, }) {
5
5
  super(buildMessage({ message, statusCode, body }));
6
6
  Object.setPrototypeOf(this, new.target.prototype);
7
7
  if (Error.captureStackTrace) {
@@ -11,6 +11,9 @@ export class PayabliError extends Error {
11
11
  this.statusCode = statusCode;
12
12
  this.body = body;
13
13
  this.rawResponse = rawResponse;
14
+ if (cause != null) {
15
+ this.cause = cause;
16
+ }
14
17
  }
15
18
  }
16
19
  function buildMessage({ message, statusCode, body, }) {
@@ -1,3 +1,6 @@
1
1
  export declare class PayabliTimeoutError extends Error {
2
- constructor(message: string);
2
+ readonly cause?: unknown;
3
+ constructor(message: string, opts?: {
4
+ cause?: unknown;
5
+ });
3
6
  }
@@ -1,11 +1,14 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  export class PayabliTimeoutError extends Error {
3
- constructor(message) {
3
+ constructor(message, opts) {
4
4
  super(message);
5
5
  Object.setPrototypeOf(this, new.target.prototype);
6
6
  if (Error.captureStackTrace) {
7
7
  Error.captureStackTrace(this, this.constructor);
8
8
  }
9
9
  this.name = this.constructor.name;
10
+ if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
11
+ this.cause = opts.cause;
12
+ }
10
13
  }
11
14
  }
@@ -14,11 +14,14 @@ export function handleNonStatusCodeError(error, rawResponse, method, path) {
14
14
  rawResponse: rawResponse,
15
15
  });
16
16
  case "timeout":
17
- throw new errors.PayabliTimeoutError(`Timeout exceeded when calling ${method} ${path}.`);
17
+ throw new errors.PayabliTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
18
+ cause: error.cause,
19
+ });
18
20
  case "unknown":
19
21
  throw new errors.PayabliError({
20
22
  message: error.errorMessage,
21
23
  rawResponse: rawResponse,
24
+ cause: error.cause,
22
25
  });
23
26
  default:
24
27
  throw new errors.PayabliError({
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.138";
1
+ export declare const SDK_VERSION = "0.0.140";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.138";
1
+ export const SDK_VERSION = "0.0.140";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payabli/sdk-node",
3
- "version": "0.0.138",
3
+ "version": "0.0.140",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -382,7 +382,7 @@
382
382
  "msw": "2.11.2",
383
383
  "@types/node": "^18.19.70",
384
384
  "typescript": "~5.9.3",
385
- "@biomejs/biome": "2.4.9"
385
+ "@biomejs/biome": "2.4.10"
386
386
  },
387
387
  "browser": {
388
388
  "fs": false,
@@ -1,7 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- /**
5
- * The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
6
- */
7
- export {};
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- /**
5
- * The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
6
- */
7
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- /**
5
- * The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry)
6
- */
7
- export {};