@supabase/auth-js 2.112.4-canary.2 → 2.112.4
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/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +14 -0
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.d.ts.map +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/lib/version.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +14 -0
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.d.ts.map +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/lib/version.js.map +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/lockless-coordination.md +2 -2
- package/package.json +1 -1
- package/src/GoTrueClient.ts +19 -0
- package/src/lib/version.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lockless auth coordination
|
|
2
2
|
|
|
3
|
-
**Since:** v2.
|
|
3
|
+
**Since:** v2.107.0
|
|
4
4
|
**Action required by:** v3.0.0
|
|
5
5
|
|
|
6
6
|
`@supabase/auth-js` now coordinates session refreshes without a shared mutex by default. The legacy `lock` option is still honored when supplied, but it is deprecated and will be removed in v3.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
**Callers passing a custom `lock`** (typically React Native `processLock`, Node multi-process setups with shared AsyncStorage, or a custom lock implementation):
|
|
21
21
|
|
|
22
|
-
- v2.x (
|
|
22
|
+
- v2.x (since v2.107.0): your custom `lock` is still invoked exactly as before. The legacy `_acquireLock` machinery is preserved on an opt-in path gated by `settings.lock != null`. No code change required. Since v2.112.4 the client logs a one-time deprecation warning when a `lock` is supplied.
|
|
23
23
|
- v3.0.0 (planned): the `lock` and `lockAcquireTimeout` options will be removed entirely. Drop them from your client options before upgrading to v3.
|
|
24
24
|
|
|
25
25
|
## New APIs worth knowing
|
package/package.json
CHANGED
package/src/GoTrueClient.ts
CHANGED
|
@@ -230,6 +230,10 @@ async function lockNoOp<R>(name: string, acquireTimeout: number, fn: () => Promi
|
|
|
230
230
|
*/
|
|
231
231
|
const GLOBAL_JWKS: { [storageKey: string]: { cachedAt: number; jwks: { keys: JWK[] } } } = {}
|
|
232
232
|
|
|
233
|
+
// Warn once per JS realm, not per client instance — server-side apps can
|
|
234
|
+
// construct many clients per process and must not be spammed.
|
|
235
|
+
let deprecatedLockWarned = false
|
|
236
|
+
|
|
233
237
|
export default class GoTrueClient {
|
|
234
238
|
private static nextInstanceID: Record<string, number> = {}
|
|
235
239
|
|
|
@@ -457,6 +461,13 @@ export default class GoTrueClient {
|
|
|
457
461
|
// by default, no implicit `processLock`.
|
|
458
462
|
if (settings.lock != null) {
|
|
459
463
|
this.lock = settings.lock
|
|
464
|
+
|
|
465
|
+
if (!deprecatedLockWarned) {
|
|
466
|
+
deprecatedLockWarned = true
|
|
467
|
+
console.warn(
|
|
468
|
+
`${this._logPrefix()} The "lock" option is deprecated and will be removed in v3. The client now coordinates session refreshes without a lock, so most apps can drop the option. See https://github.com/supabase/supabase-js/blob/master/packages/core/auth-js/migrations/lockless-coordination.md`
|
|
469
|
+
)
|
|
470
|
+
}
|
|
460
471
|
}
|
|
461
472
|
|
|
462
473
|
if (!this.jwks) {
|
|
@@ -4993,6 +5004,14 @@ export default class GoTrueClient {
|
|
|
4993
5004
|
try {
|
|
4994
5005
|
this.refreshingDeferred = new Deferred<CallRefreshTokenResult>()
|
|
4995
5006
|
|
|
5007
|
+
// Only callers that arrive while this refresh is in flight await the
|
|
5008
|
+
// deferred; the original caller is served by the `throw` in the catch
|
|
5009
|
+
// below. Pre-attach a no-op rejection handler so a failing refresh with
|
|
5010
|
+
// no concurrent callers cannot surface as an unhandled rejection —
|
|
5011
|
+
// concurrent callers attach their own handlers via `.promise` and still
|
|
5012
|
+
// observe the rejection.
|
|
5013
|
+
this.refreshingDeferred.promise.then(undefined, () => {})
|
|
5014
|
+
|
|
4996
5015
|
// Snapshot storage before the fetch. The commit guard discards the
|
|
4997
5016
|
// rotated tokens only when a non-null pre-fetch snapshot changed under
|
|
4998
5017
|
// us — typical case: a concurrent `signOut` ran `_removeSession`, or
|
package/src/lib/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '2.112.4
|
|
7
|
+
export const version = '2.112.4'
|