@delopay/sdk 0.16.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/dist/index.d.cts CHANGED
@@ -3075,6 +3075,13 @@ declare class FeatureMatrix {
3075
3075
  constructor(request: RequestFn);
3076
3076
  /** Retrieve the feature matrix. `GET /feature_matrix` */
3077
3077
  retrieve(): Promise<Record<string, unknown>>;
3078
+ /**
3079
+ * Retrieve the feature matrix scoped to a merchant. Beta connectors
3080
+ * are filtered against the merchant's allowlist so the dashboard only
3081
+ * surfaces connectors the merchant can actually attach.
3082
+ * `GET /feature_matrix/{merchantId}`
3083
+ */
3084
+ retrieveForMerchant(merchantId: string): Promise<Record<string, unknown>>;
3078
3085
  }
3079
3086
 
3080
3087
  declare class Files {
@@ -3343,12 +3350,19 @@ declare class DelopayError extends Error {
3343
3350
  * still has something to go on.
3344
3351
  */
3345
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>;
3346
3359
  constructor(message: string, options: {
3347
3360
  status: number;
3348
3361
  code: string;
3349
3362
  type: string;
3350
3363
  requestId?: string;
3351
3364
  rawBody?: string;
3365
+ data?: Record<string, unknown>;
3352
3366
  });
3353
3367
  }
3354
3368
  /**
@@ -3367,6 +3381,7 @@ declare class DelopayAuthenticationError extends DelopayError {
3367
3381
  type?: string;
3368
3382
  requestId?: string;
3369
3383
  rawBody?: string;
3384
+ data?: Record<string, unknown>;
3370
3385
  });
3371
3386
  }
3372
3387
 
package/dist/index.d.ts CHANGED
@@ -3075,6 +3075,13 @@ declare class FeatureMatrix {
3075
3075
  constructor(request: RequestFn);
3076
3076
  /** Retrieve the feature matrix. `GET /feature_matrix` */
3077
3077
  retrieve(): Promise<Record<string, unknown>>;
3078
+ /**
3079
+ * Retrieve the feature matrix scoped to a merchant. Beta connectors
3080
+ * are filtered against the merchant's allowlist so the dashboard only
3081
+ * surfaces connectors the merchant can actually attach.
3082
+ * `GET /feature_matrix/{merchantId}`
3083
+ */
3084
+ retrieveForMerchant(merchantId: string): Promise<Record<string, unknown>>;
3078
3085
  }
3079
3086
 
3080
3087
  declare class Files {
@@ -3343,12 +3350,19 @@ declare class DelopayError extends Error {
3343
3350
  * still has something to go on.
3344
3351
  */
3345
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>;
3346
3359
  constructor(message: string, options: {
3347
3360
  status: number;
3348
3361
  code: string;
3349
3362
  type: string;
3350
3363
  requestId?: string;
3351
3364
  rawBody?: string;
3365
+ data?: Record<string, unknown>;
3352
3366
  });
3353
3367
  }
3354
3368
  /**
@@ -3367,6 +3381,7 @@ declare class DelopayAuthenticationError extends DelopayError {
3367
3381
  type?: string;
3368
3382
  requestId?: string;
3369
3383
  rawBody?: string;
3384
+ data?: Record<string, unknown>;
3370
3385
  });
3371
3386
  }
3372
3387
 
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  Regions,
13
13
  Subscriptions,
14
14
  Webhooks
15
- } from "./chunk-VQPHGGNQ.js";
15
+ } from "./chunk-6UL5TW3X.js";
16
16
  export {
17
17
  Analytics,
18
18
  AnalyticsDashboard,
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";
@@ -2423,6 +2425,15 @@ var FeatureMatrix = class {
2423
2425
  async retrieve() {
2424
2426
  return this.request("GET", "/feature_matrix");
2425
2427
  }
2428
+ /**
2429
+ * Retrieve the feature matrix scoped to a merchant. Beta connectors
2430
+ * are filtered against the merchant's allowlist so the dashboard only
2431
+ * surfaces connectors the merchant can actually attach.
2432
+ * `GET /feature_matrix/{merchantId}`
2433
+ */
2434
+ async retrieveForMerchant(merchantId) {
2435
+ return this.request("GET", `/feature_matrix/${encodeURIComponent(merchantId)}`);
2436
+ }
2426
2437
  };
2427
2438
 
2428
2439
  // src/resources/files.ts
@@ -2808,13 +2819,15 @@ var Delopay = class {
2808
2819
  const message = err.message ?? `Request failed with status ${response.status}`;
2809
2820
  const code = err.code ?? "";
2810
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;
2811
2823
  const truncatedRaw = truncateRawBody(rawBody);
2812
2824
  if (response.status === 401) {
2813
2825
  throw new DelopayAuthenticationError(message, {
2814
2826
  code,
2815
2827
  type,
2816
2828
  requestId,
2817
- rawBody: truncatedRaw
2829
+ rawBody: truncatedRaw,
2830
+ data
2818
2831
  });
2819
2832
  }
2820
2833
  const error = new DelopayError(message, {
@@ -2822,7 +2835,8 @@ var Delopay = class {
2822
2835
  code,
2823
2836
  type,
2824
2837
  requestId,
2825
- rawBody: truncatedRaw
2838
+ rawBody: truncatedRaw,
2839
+ data
2826
2840
  });
2827
2841
  const isTransientStatus = response.status >= 500 || response.status === 429;
2828
2842
  if (isTransientStatus && isRetryable && attempt < this.maxRetries) {