@insforge/sdk 1.2.8-dev.1 → 1.2.9
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 +5 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -284,7 +284,10 @@ var TokenManager = class {
|
|
|
284
284
|
// src/lib/http-client.ts
|
|
285
285
|
var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([500, 502, 503, 504]);
|
|
286
286
|
var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "PUT", "DELETE", "OPTIONS"]);
|
|
287
|
-
var
|
|
287
|
+
var REFRESHABLE_AUTH_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
288
|
+
"AUTH_UNAUTHORIZED",
|
|
289
|
+
"PGRST301"
|
|
290
|
+
]);
|
|
288
291
|
function serializeBody(method, body, headers) {
|
|
289
292
|
if (body === void 0) return void 0;
|
|
290
293
|
if (method === "GET" || method === "HEAD") return void 0;
|
|
@@ -394,7 +397,7 @@ var HttpClient = class {
|
|
|
394
397
|
return Math.round(jitter);
|
|
395
398
|
}
|
|
396
399
|
shouldRefreshAccessToken(statusCode, errorCode, authToken, options = {}) {
|
|
397
|
-
return statusCode === 401 && errorCode
|
|
400
|
+
return statusCode === 401 && REFRESHABLE_AUTH_ERROR_CODES.has(errorCode ?? "") && !this.config.isServerMode && !this.config.edgeFunctionToken && !options.skipAuthRefresh && authToken !== null;
|
|
398
401
|
}
|
|
399
402
|
async fetchWithRetry(args) {
|
|
400
403
|
const {
|