@iblai/data-layer 1.13.3 → 1.13.5

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.js CHANGED
@@ -39054,6 +39054,19 @@ exports.SERVICES = void 0;
39054
39054
  SERVICES["AXD"] = "AXD";
39055
39055
  SERVICES["STUDIO"] = "STUDIO";
39056
39056
  })(exports.SERVICES || (exports.SERVICES = {}));
39057
+ /**
39058
+ * Client errors a retry cannot fix.
39059
+ *
39060
+ * These reject the request for what it IS — unauthenticated, forbidden,
39061
+ * malformed — not for anything transient. Sending it again unchanged produces
39062
+ * the same answer, just later, while multiplying load behind a failure the
39063
+ * user is already waiting on. A 401 in particular must surface promptly so the
39064
+ * token-refresh path can act on it rather than being buried under backoff.
39065
+ *
39066
+ * Shared so every retry policy agrees; individual call sites add their own
39067
+ * extras (a 402 payment block, a 500 an endpoint treats as terminal).
39068
+ */
39069
+ const NEVER_RETRY_STATUSES = [400, 401, 403];
39057
39070
 
39058
39071
  // Backend contract: ibl_ai_mentor/views/spend_cap_views.py.
39059
39072
  // Spend caps exist at three scopes, all under /api/ai-mentor/orgs/{org}/:
@@ -39193,11 +39206,11 @@ const iblFakeBaseQuery = react.retry(fakeBaseQueryWithLogging, {
39193
39206
  // Stop after 10 retries
39194
39207
  if (attempt >= 10)
39195
39208
  return false;
39196
- // Do NOT retry auth errors
39209
+ // Do NOT retry client errors a retry cannot fix
39197
39210
  // Check direct status (from rawFakeBaseQuery errors)
39198
39211
  const err = error;
39199
39212
  const status = typeof (err === null || err === void 0 ? void 0 : err.status) === 'number' ? err.status : (_a = err === null || err === void 0 ? void 0 : err.data) === null || _a === void 0 ? void 0 : _a.status;
39200
- if (status === 401 || status === 403) {
39213
+ if (typeof status === 'number' && NEVER_RETRY_STATUSES.includes(status)) {
39201
39214
  return false;
39202
39215
  }
39203
39216
  return true;
@@ -39396,8 +39409,14 @@ const getHeaders = async (service) => {
39396
39409
  }
39397
39410
  return token ? { Authorization: `${prefix} ${token}` } : undefined;
39398
39411
  };
39399
- /** Status codes that should not be retried for queryFn endpoints. */
39400
- const QUERYFN_NON_RETRYABLE_STATUSES = [401, 403, 500];
39412
+ /**
39413
+ * Status codes that should not be retried for queryFn endpoints.
39414
+ *
39415
+ * Only the shared client errors. A 5xx is the server failing, not the request
39416
+ * being wrong — it is transient by definition and exactly what the backoff
39417
+ * exists for, so it is retried like any other transient failure.
39418
+ */
39419
+ const QUERYFN_NON_RETRYABLE_STATUSES = [...NEVER_RETRY_STATUSES];
39401
39420
  /**
39402
39421
  * True when an error body carries the spend-cap `spend_cap_exceeded` code.
39403
39422
  * A spend-cap block returns HTTP 429, but unlike a genuine provider rate
@@ -39562,8 +39581,11 @@ const invokeHttpErrorHandler = (status, error) => {
39562
39581
  Config.httpErrorHandlers[numericStatus]({ ...(err || {}) });
39563
39582
  }
39564
39583
  };
39565
- /** HTTP status codes that should not be retried (e.g., 402 Payment Required). */
39566
- const NON_RETRYABLE_STATUS_CODES = [402, 401];
39584
+ /**
39585
+ * HTTP status codes that should not be retried: the shared client errors, plus
39586
+ * 402 Payment Required, which is a hard block rather than a transient failure.
39587
+ */
39588
+ const NON_RETRYABLE_STATUS_CODES = [...NEVER_RETRY_STATUSES, 402];
39567
39589
  /**
39568
39590
  * Wraps a base query to skip retries for non-retryable HTTP status codes.
39569
39591
  * Uses `retry.fail()` to immediately bail out of the retry loop.
@@ -48533,6 +48555,7 @@ exports.MENTOR_CUSTOM_ENDPOINTS = MENTOR_CUSTOM_ENDPOINTS;
48533
48555
  exports.MENTOR_CUSTOM_REDUCER_PATH = MENTOR_CUSTOM_REDUCER_PATH;
48534
48556
  exports.MENTOR_ENDPOINTS = MENTOR_ENDPOINTS;
48535
48557
  exports.MENTOR_SKILL_ASSIGNMENTS_PAGE_SIZE = MENTOR_SKILL_ASSIGNMENTS_PAGE_SIZE;
48558
+ exports.NEVER_RETRY_STATUSES = NEVER_RETRY_STATUSES;
48536
48559
  exports.NOTIFICATIONS_CUSTOM_ENDPOINTS = NOTIFICATIONS_CUSTOM_ENDPOINTS;
48537
48560
  exports.NOTIFICATIONS_CUSTOM_REDUCER_PATH = NOTIFICATIONS_CUSTOM_REDUCER_PATH;
48538
48561
  exports.NOTIFICATIONS_CUSTOM_TAGS = NOTIFICATIONS_CUSTOM_TAGS;