@supabase/auth-js
Advanced tools
Comparing version 2.66.1 to 2.67.0-rc.1
@@ -74,3 +74,10 @@ "use strict"; | ||
// MDN article: https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request | ||
return await globalThis.navigator.locks.request(name, acquireTimeout === 0 | ||
// Wrapping navigator.locks.request() with a plain Promise is done as some | ||
// libraries like zone.js patch the Promise object to track the execution | ||
// context. However, it appears that most browsers use an internal promise | ||
// implementation when using the navigator.locks.request() API causing them | ||
// to lose context and emit confusing log messages or break certain features. | ||
// This wrapping is believed to help zone.js track the execution context | ||
// better. | ||
return await Promise.resolve().then(() => globalThis.navigator.locks.request(name, acquireTimeout === 0 | ||
? { | ||
@@ -122,3 +129,3 @@ mode: 'exclusive', | ||
} | ||
}); | ||
})); | ||
} | ||
@@ -125,0 +132,0 @@ exports.navigatorLock = navigatorLock; |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.66.1"; | ||
export declare const version = "2.67.0-rc.1"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '2.66.1'; | ||
exports.version = '2.67.0-rc.1'; | ||
//# sourceMappingURL=version.js.map |
@@ -68,3 +68,10 @@ import { supportsLocalStorage } from './helpers'; | ||
// MDN article: https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request | ||
return await globalThis.navigator.locks.request(name, acquireTimeout === 0 | ||
// Wrapping navigator.locks.request() with a plain Promise is done as some | ||
// libraries like zone.js patch the Promise object to track the execution | ||
// context. However, it appears that most browsers use an internal promise | ||
// implementation when using the navigator.locks.request() API causing them | ||
// to lose context and emit confusing log messages or break certain features. | ||
// This wrapping is believed to help zone.js track the execution context | ||
// better. | ||
return await Promise.resolve().then(() => globalThis.navigator.locks.request(name, acquireTimeout === 0 | ||
? { | ||
@@ -116,3 +123,3 @@ mode: 'exclusive', | ||
} | ||
}); | ||
})); | ||
} | ||
@@ -119,0 +126,0 @@ const PROCESS_LOCKS = {}; |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.66.1"; | ||
export declare const version = "2.67.0-rc.1"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = '2.66.1'; | ||
export const version = '2.67.0-rc.1'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@supabase/auth-js", | ||
"version": "2.66.1", | ||
"version": "2.67.0-rc.1", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Official client library for Supabase Auth", |
@@ -81,64 +81,73 @@ import { supportsLocalStorage } from './helpers' | ||
return await globalThis.navigator.locks.request( | ||
name, | ||
acquireTimeout === 0 | ||
? { | ||
mode: 'exclusive', | ||
ifAvailable: true, | ||
} | ||
: { | ||
mode: 'exclusive', | ||
signal: abortController.signal, | ||
}, | ||
async (lock) => { | ||
if (lock) { | ||
if (internals.debug) { | ||
console.log('@supabase/gotrue-js: navigatorLock: acquired', name, lock.name) | ||
} | ||
try { | ||
return await fn() | ||
} finally { | ||
if (internals.debug) { | ||
console.log('@supabase/gotrue-js: navigatorLock: released', name, lock.name) | ||
// Wrapping navigator.locks.request() with a plain Promise is done as some | ||
// libraries like zone.js patch the Promise object to track the execution | ||
// context. However, it appears that most browsers use an internal promise | ||
// implementation when using the navigator.locks.request() API causing them | ||
// to lose context and emit confusing log messages or break certain features. | ||
// This wrapping is believed to help zone.js track the execution context | ||
// better. | ||
return await Promise.resolve().then(() => | ||
globalThis.navigator.locks.request( | ||
name, | ||
acquireTimeout === 0 | ||
? { | ||
mode: 'exclusive', | ||
ifAvailable: true, | ||
} | ||
} | ||
} else { | ||
if (acquireTimeout === 0) { | ||
: { | ||
mode: 'exclusive', | ||
signal: abortController.signal, | ||
}, | ||
async (lock) => { | ||
if (lock) { | ||
if (internals.debug) { | ||
console.log('@supabase/gotrue-js: navigatorLock: not immediately available', name) | ||
console.log('@supabase/gotrue-js: navigatorLock: acquired', name, lock.name) | ||
} | ||
throw new NavigatorLockAcquireTimeoutError( | ||
`Acquiring an exclusive Navigator LockManager lock "${name}" immediately failed` | ||
) | ||
try { | ||
return await fn() | ||
} finally { | ||
if (internals.debug) { | ||
console.log('@supabase/gotrue-js: navigatorLock: released', name, lock.name) | ||
} | ||
} | ||
} else { | ||
if (internals.debug) { | ||
try { | ||
const result = await globalThis.navigator.locks.query() | ||
if (acquireTimeout === 0) { | ||
if (internals.debug) { | ||
console.log('@supabase/gotrue-js: navigatorLock: not immediately available', name) | ||
} | ||
console.log( | ||
'@supabase/gotrue-js: Navigator LockManager state', | ||
JSON.stringify(result, null, ' ') | ||
) | ||
} catch (e: any) { | ||
console.warn( | ||
'@supabase/gotrue-js: Error when querying Navigator LockManager state', | ||
e | ||
) | ||
throw new NavigatorLockAcquireTimeoutError( | ||
`Acquiring an exclusive Navigator LockManager lock "${name}" immediately failed` | ||
) | ||
} else { | ||
if (internals.debug) { | ||
try { | ||
const result = await globalThis.navigator.locks.query() | ||
console.log( | ||
'@supabase/gotrue-js: Navigator LockManager state', | ||
JSON.stringify(result, null, ' ') | ||
) | ||
} catch (e: any) { | ||
console.warn( | ||
'@supabase/gotrue-js: Error when querying Navigator LockManager state', | ||
e | ||
) | ||
} | ||
} | ||
} | ||
// Browser is not following the Navigator LockManager spec, it | ||
// returned a null lock when we didn't use ifAvailable. So we can | ||
// pretend the lock is acquired in the name of backward compatibility | ||
// and user experience and just run the function. | ||
console.warn( | ||
'@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request' | ||
) | ||
// Browser is not following the Navigator LockManager spec, it | ||
// returned a null lock when we didn't use ifAvailable. So we can | ||
// pretend the lock is acquired in the name of backward compatibility | ||
// and user experience and just run the function. | ||
console.warn( | ||
'@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request' | ||
) | ||
return await fn() | ||
return await fn() | ||
} | ||
} | ||
} | ||
} | ||
) | ||
) | ||
@@ -145,0 +154,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export const version = '2.66.1' | ||
export const version = '2.67.0-rc.1' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
829335
14764
1