@nebulr-group/bridge-svelte 0.9.0-beta.6 → 0.9.0-beta.7
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/core/bridge-fetch.js +15 -3
- package/package.json +3 -3
|
@@ -89,9 +89,21 @@ export function wrapFetchWithBridgeAuth(baseFetch, apiBaseUrl) {
|
|
|
89
89
|
.extensions?.response?.code === 'TOKEN_VERSION_STALE');
|
|
90
90
|
if (!isStale)
|
|
91
91
|
return response;
|
|
92
|
-
// 3. Refresh
|
|
93
|
-
//
|
|
94
|
-
|
|
92
|
+
// 3. Refresh with a token minted AFTER this answer. The server just said
|
|
93
|
+
// our tokenVersion is behind, so a refresh that was already in flight
|
|
94
|
+
// (the per-connect reconcile, the WebSocket user.state_changed path)
|
|
95
|
+
// may have been minted before the bump and come back just as stale —
|
|
96
|
+
// retrying with it fails the same way and the caller sees "access
|
|
97
|
+
// token has been invalidated; refresh required". `fresh` waits for
|
|
98
|
+
// such a refresh and mints again (or joins one that started after
|
|
99
|
+
// this call), so the retry carries the current version.
|
|
100
|
+
// Stage, 2026-09-28: a new user's first CreateApp failed twice this way
|
|
101
|
+
// (retry sent tv 0 while the server was at tv 1). TBP-747.
|
|
102
|
+
// An auth-core older than 0.8.0-beta.2 (the peer range allows 0.7.x)
|
|
103
|
+
// ignores the option and joins the in-flight refresh, as before.
|
|
104
|
+
const auth = getBridgeAuth();
|
|
105
|
+
const refresh = auth.refreshTokens;
|
|
106
|
+
await refresh.call(auth, { fresh: true }).catch(() => { });
|
|
95
107
|
const freshToken = getBridgeAuth().getTokens()?.accessToken;
|
|
96
108
|
const freshHeaders = new Headers(init?.headers);
|
|
97
109
|
if (freshToken)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebulr-group/bridge-svelte",
|
|
3
|
-
"version": "0.9.0-beta.
|
|
3
|
+
"version": "0.9.0-beta.7",
|
|
4
4
|
"description": "Bridge Svelte library, This library helps you to add bridge authentication and feature flags, and payments to your svelte application.",
|
|
5
5
|
"author": "Iman Pouya",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"svelte": "^5.0.0",
|
|
59
59
|
"@sveltejs/kit": "^2.0.0",
|
|
60
60
|
"@stripe/stripe-js": ">=4.0.0",
|
|
61
|
-
"@nebulr-group/bridge-auth-core": ">=0.
|
|
61
|
+
"@nebulr-group/bridge-auth-core": ">=0.8.0-beta.4 <1.0.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependenciesMeta": {
|
|
64
64
|
"@stripe/stripe-js": {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"typescript": "^6.0.0",
|
|
80
80
|
"vite": "^6.2.6",
|
|
81
81
|
"vitest": "^4.1.4",
|
|
82
|
-
"@nebulr-group/bridge-auth-core": "0.8.0-beta.
|
|
82
|
+
"@nebulr-group/bridge-auth-core": "0.8.0-beta.4"
|
|
83
83
|
},
|
|
84
84
|
"keywords": [
|
|
85
85
|
"svelte",
|