@delopay/sdk 0.17.0 → 0.18.0
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 +14 -6
- package/dist/{chunk-F6HWLDHA.js → chunk-6UL5TW3X.js} +9 -4
- package/dist/chunk-6UL5TW3X.js.map +1 -0
- package/dist/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/internal.cjs +8 -3
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-F6HWLDHA.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -3350,12 +3350,19 @@ declare class DelopayError extends Error {
|
|
|
3350
3350
|
* still has something to go on.
|
|
3351
3351
|
*/
|
|
3352
3352
|
readonly rawBody?: string;
|
|
3353
|
+
/**
|
|
3354
|
+
* Structured error context the API attaches under `error.data` for select
|
|
3355
|
+
* codes — e.g. `{ retry_after_secs: 248 }` on rate-limit / max-attempt
|
|
3356
|
+
* lockouts. Schema is per-code; consult the API reference for the shape.
|
|
3357
|
+
*/
|
|
3358
|
+
readonly data?: Record<string, unknown>;
|
|
3353
3359
|
constructor(message: string, options: {
|
|
3354
3360
|
status: number;
|
|
3355
3361
|
code: string;
|
|
3356
3362
|
type: string;
|
|
3357
3363
|
requestId?: string;
|
|
3358
3364
|
rawBody?: string;
|
|
3365
|
+
data?: Record<string, unknown>;
|
|
3359
3366
|
});
|
|
3360
3367
|
}
|
|
3361
3368
|
/**
|
|
@@ -3374,6 +3381,7 @@ declare class DelopayAuthenticationError extends DelopayError {
|
|
|
3374
3381
|
type?: string;
|
|
3375
3382
|
requestId?: string;
|
|
3376
3383
|
rawBody?: string;
|
|
3384
|
+
data?: Record<string, unknown>;
|
|
3377
3385
|
});
|
|
3378
3386
|
}
|
|
3379
3387
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3350,12 +3350,19 @@ declare class DelopayError extends Error {
|
|
|
3350
3350
|
* still has something to go on.
|
|
3351
3351
|
*/
|
|
3352
3352
|
readonly rawBody?: string;
|
|
3353
|
+
/**
|
|
3354
|
+
* Structured error context the API attaches under `error.data` for select
|
|
3355
|
+
* codes — e.g. `{ retry_after_secs: 248 }` on rate-limit / max-attempt
|
|
3356
|
+
* lockouts. Schema is per-code; consult the API reference for the shape.
|
|
3357
|
+
*/
|
|
3358
|
+
readonly data?: Record<string, unknown>;
|
|
3353
3359
|
constructor(message: string, options: {
|
|
3354
3360
|
status: number;
|
|
3355
3361
|
code: string;
|
|
3356
3362
|
type: string;
|
|
3357
3363
|
requestId?: string;
|
|
3358
3364
|
rawBody?: string;
|
|
3365
|
+
data?: Record<string, unknown>;
|
|
3359
3366
|
});
|
|
3360
3367
|
}
|
|
3361
3368
|
/**
|
|
@@ -3374,6 +3381,7 @@ declare class DelopayAuthenticationError extends DelopayError {
|
|
|
3374
3381
|
type?: string;
|
|
3375
3382
|
requestId?: string;
|
|
3376
3383
|
rawBody?: string;
|
|
3384
|
+
data?: Record<string, unknown>;
|
|
3377
3385
|
});
|
|
3378
3386
|
}
|
|
3379
3387
|
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -58,6 +58,7 @@ var DelopayError = class extends Error {
|
|
|
58
58
|
this.type = options.type;
|
|
59
59
|
if (options.requestId !== void 0) this.requestId = options.requestId;
|
|
60
60
|
if (options.rawBody !== void 0) this.rawBody = options.rawBody;
|
|
61
|
+
if (options.data !== void 0) this.data = options.data;
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
var DelopayAuthenticationError = class extends DelopayError {
|
|
@@ -70,7 +71,8 @@ var DelopayAuthenticationError = class extends DelopayError {
|
|
|
70
71
|
code: options?.code || "AUTH_01",
|
|
71
72
|
type: options?.type || "authentication_error",
|
|
72
73
|
requestId: options?.requestId,
|
|
73
|
-
rawBody: options?.rawBody
|
|
74
|
+
rawBody: options?.rawBody,
|
|
75
|
+
data: options?.data
|
|
74
76
|
});
|
|
75
77
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
76
78
|
this.name = "DelopayAuthenticationError";
|
|
@@ -2817,13 +2819,15 @@ var Delopay = class {
|
|
|
2817
2819
|
const message = err.message ?? `Request failed with status ${response.status}`;
|
|
2818
2820
|
const code = err.code ?? "";
|
|
2819
2821
|
const type = err.error_type ?? err.type ?? "";
|
|
2822
|
+
const data = err.data && typeof err.data === "object" && !Array.isArray(err.data) ? err.data : void 0;
|
|
2820
2823
|
const truncatedRaw = truncateRawBody(rawBody);
|
|
2821
2824
|
if (response.status === 401) {
|
|
2822
2825
|
throw new DelopayAuthenticationError(message, {
|
|
2823
2826
|
code,
|
|
2824
2827
|
type,
|
|
2825
2828
|
requestId,
|
|
2826
|
-
rawBody: truncatedRaw
|
|
2829
|
+
rawBody: truncatedRaw,
|
|
2830
|
+
data
|
|
2827
2831
|
});
|
|
2828
2832
|
}
|
|
2829
2833
|
const error = new DelopayError(message, {
|
|
@@ -2831,7 +2835,8 @@ var Delopay = class {
|
|
|
2831
2835
|
code,
|
|
2832
2836
|
type,
|
|
2833
2837
|
requestId,
|
|
2834
|
-
rawBody: truncatedRaw
|
|
2838
|
+
rawBody: truncatedRaw,
|
|
2839
|
+
data
|
|
2835
2840
|
});
|
|
2836
2841
|
const isTransientStatus = response.status >= 500 || response.status === 429;
|
|
2837
2842
|
if (isTransientStatus && isRetryable && attempt < this.maxRetries) {
|