@spacelr/sdk 0.8.0 → 0.9.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.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,7 @@ var HttpClient = class {
|
|
|
115
115
|
});
|
|
116
116
|
const responseBody = await this.parseResponse(response);
|
|
117
117
|
if (!response.ok) {
|
|
118
|
-
if (options.authenticated && response.status === 401) {
|
|
118
|
+
if (options.authenticated && response.status === 401 && !options.skipAuthRefresh) {
|
|
119
119
|
if (await this.recoverFromAuthFailure(isRetry)) {
|
|
120
120
|
return this.requestWithRetry(options, true);
|
|
121
121
|
}
|
|
@@ -1395,7 +1395,11 @@ var AuthModule = class {
|
|
|
1395
1395
|
await this.http.request({
|
|
1396
1396
|
method: "POST",
|
|
1397
1397
|
path: "/auth/logout",
|
|
1398
|
-
authenticated: true
|
|
1398
|
+
authenticated: true,
|
|
1399
|
+
// A 401 here means the session is already gone — do not trigger the
|
|
1400
|
+
// refresh/auth-lost recovery, or an auth-lost handler that calls
|
|
1401
|
+
// logout would recurse into an endless 401 loop.
|
|
1402
|
+
skipAuthRefresh: true
|
|
1399
1403
|
});
|
|
1400
1404
|
} catch {
|
|
1401
1405
|
}
|
|
@@ -3052,6 +3056,9 @@ function createClient(config) {
|
|
|
3052
3056
|
onTokenRefreshed(listener) {
|
|
3053
3057
|
return tokenManager.onTokenRefreshed(listener);
|
|
3054
3058
|
},
|
|
3059
|
+
getAccessToken() {
|
|
3060
|
+
return tokenManager.getAccessToken();
|
|
3061
|
+
},
|
|
3055
3062
|
onConnectionStateChanged(listener) {
|
|
3056
3063
|
return realtime.onConnectionStateChanged(listener);
|
|
3057
3064
|
},
|