@scalemule/sdk 0.0.63 → 0.0.64

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.mts CHANGED
@@ -36,6 +36,28 @@ type ApiError = {
36
36
  status: number;
37
37
  /** Additional context (field errors, retryAfter, etc.) */
38
38
  details?: Record<string, unknown>;
39
+ /**
40
+ * Name of the input field this error is about, when the backend
41
+ * attributes it to one (e.g., 'email'). Used by ScaleMule Signals to
42
+ * route the message to the owning form control instead of a toast.
43
+ */
44
+ field?: string;
45
+ /**
46
+ * Correlation id for this request. Taken from the response envelope
47
+ * (`meta.request_id`) and falling back to the `x-request-id` response
48
+ * header echoed by the gateway.
49
+ */
50
+ requestId?: string;
51
+ /** Distributed-trace id, when the backend supplies `meta.trace_id`. */
52
+ traceId?: string;
53
+ /** Backend hint that retrying the same request may succeed. */
54
+ retryable?: boolean;
55
+ /**
56
+ * The raw `error` object from the response body, unmodified. Escape hatch
57
+ * for consumers (such as `@scalemule/signals` `fromError`) that need
58
+ * fields the SDK does not model yet.
59
+ */
60
+ problem?: unknown;
39
61
  };
40
62
  /**
41
63
  * Paginated response envelope.
@@ -777,7 +799,6 @@ interface DirectoryUserDetail {
777
799
  created_at: string;
778
800
  locale?: string;
779
801
  time_zone?: string;
780
- external_role?: string;
781
802
  auth_methods: string[];
782
803
  }
783
804
  interface DirectoryUsersListResponse {
package/dist/index.d.ts CHANGED
@@ -36,6 +36,28 @@ type ApiError = {
36
36
  status: number;
37
37
  /** Additional context (field errors, retryAfter, etc.) */
38
38
  details?: Record<string, unknown>;
39
+ /**
40
+ * Name of the input field this error is about, when the backend
41
+ * attributes it to one (e.g., 'email'). Used by ScaleMule Signals to
42
+ * route the message to the owning form control instead of a toast.
43
+ */
44
+ field?: string;
45
+ /**
46
+ * Correlation id for this request. Taken from the response envelope
47
+ * (`meta.request_id`) and falling back to the `x-request-id` response
48
+ * header echoed by the gateway.
49
+ */
50
+ requestId?: string;
51
+ /** Distributed-trace id, when the backend supplies `meta.trace_id`. */
52
+ traceId?: string;
53
+ /** Backend hint that retrying the same request may succeed. */
54
+ retryable?: boolean;
55
+ /**
56
+ * The raw `error` object from the response body, unmodified. Escape hatch
57
+ * for consumers (such as `@scalemule/signals` `fromError`) that need
58
+ * fields the SDK does not model yet.
59
+ */
60
+ problem?: unknown;
39
61
  };
40
62
  /**
41
63
  * Paginated response envelope.
@@ -777,7 +799,6 @@ interface DirectoryUserDetail {
777
799
  created_at: string;
778
800
  locale?: string;
779
801
  time_zone?: string;
780
- external_role?: string;
781
802
  auth_methods: string[];
782
803
  }
783
804
  interface DirectoryUsersListResponse {
package/dist/index.js CHANGED
@@ -1230,6 +1230,15 @@ var ScaleMuleClient = class {
1230
1230
  status: response.status,
1231
1231
  details: responseData?.error?.details || responseData?.details
1232
1232
  };
1233
+ const field = responseData?.error?.field;
1234
+ if (field !== void 0) error.field = field;
1235
+ const requestId = responseData?.meta?.request_id ?? response.headers.get("x-request-id") ?? void 0;
1236
+ if (requestId !== void 0) error.requestId = requestId;
1237
+ const traceId = responseData?.meta?.trace_id;
1238
+ if (traceId !== void 0) error.traceId = traceId;
1239
+ const retryable = responseData?.error?.retryable;
1240
+ if (retryable !== void 0) error.retryable = retryable;
1241
+ if (responseData?.error !== void 0) error.problem = responseData.error;
1233
1242
  if (response.status === 401 && this.sessionToken && !init.isAutoRefresh) {
1234
1243
  if (this.debug) console.log("[ScaleMule] 401 received, attempting auto-refresh...");
1235
1244
  let isPrimaryRefresh = false;
package/dist/index.mjs CHANGED
@@ -1126,6 +1126,15 @@ var ScaleMuleClient = class {
1126
1126
  status: response.status,
1127
1127
  details: responseData?.error?.details || responseData?.details
1128
1128
  };
1129
+ const field = responseData?.error?.field;
1130
+ if (field !== void 0) error.field = field;
1131
+ const requestId = responseData?.meta?.request_id ?? response.headers.get("x-request-id") ?? void 0;
1132
+ if (requestId !== void 0) error.requestId = requestId;
1133
+ const traceId = responseData?.meta?.trace_id;
1134
+ if (traceId !== void 0) error.traceId = traceId;
1135
+ const retryable = responseData?.error?.retryable;
1136
+ if (retryable !== void 0) error.retryable = retryable;
1137
+ if (responseData?.error !== void 0) error.problem = responseData.error;
1129
1138
  if (response.status === 401 && this.sessionToken && !init.isAutoRefresh) {
1130
1139
  if (this.debug) console.log("[ScaleMule] 401 received, attempting auto-refresh...");
1131
1140
  let isPrimaryRefresh = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/sdk",
3
- "version": "0.0.63",
3
+ "version": "0.0.64",
4
4
  "description": "Official TypeScript/JavaScript SDK for ScaleMule Backend-as-a-Service",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",