@secondlayer/sdk 14.3.0 → 14.4.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.ts CHANGED
@@ -3455,6 +3455,13 @@ declare class ApiError extends SecondLayerError {
3455
3455
  /** Raw response body (parsed JSON if possible) — preserved for callers that need error details. */
3456
3456
  body?: unknown;
3457
3457
  constructor(status: number, message: string, body?: unknown, code?: string, options?: SecondLayerErrorOptions);
3458
+ /** The API's `request_id` for this failure (from the error body), when sent.
3459
+ * Quote it when reporting a failed call. */
3460
+ get requestId(): string | undefined;
3461
+ toJSON(): ReturnType<SecondLayerError["toJSON"]> & {
3462
+ status: number;
3463
+ requestId: string | undefined;
3464
+ };
3458
3465
  }
3459
3466
  /** Thrown on a 401 by both the instance clients and Streams. Carries the
3460
3467
  * server's `{error, code}` envelope when it sent one, so a revoked token reads
package/dist/index.js CHANGED
@@ -88,6 +88,17 @@ class ApiError extends SecondLayerError {
88
88
  this.body = body;
89
89
  this.name = "ApiError";
90
90
  }
91
+ get requestId() {
92
+ const b = this.body;
93
+ return b && typeof b === "object" && typeof b.request_id === "string" ? b.request_id : undefined;
94
+ }
95
+ toJSON() {
96
+ return {
97
+ ...super.toJSON(),
98
+ status: this.status,
99
+ requestId: this.requestId
100
+ };
101
+ }
91
102
  }
92
103
 
93
104
  class AuthError extends ApiError {
@@ -3464,5 +3475,5 @@ export {
3464
3475
  verifyWebhookSignature
3465
3476
  };
3466
3477
 
3467
- //# debugId=B2DAEC1BBFDB7B6E64756E2164756E21
3478
+ //# debugId=9B9AA015232E3E2E64756E2164756E21
3468
3479
  //# sourceMappingURL=index.js.map