@supabase/auth-js 3.0.0-next.17 → 3.0.0-next.19

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/src/lib/locks.ts CHANGED
@@ -176,7 +176,7 @@ export async function navigatorLock<R>(
176
176
  '@supabase/gotrue-js: Navigator LockManager state',
177
177
  JSON.stringify(result, null, ' ')
178
178
  )
179
- } catch (e: any) {
179
+ } catch (e) {
180
180
  console.warn(
181
181
  '@supabase/gotrue-js: Error when querying Navigator LockManager state',
182
182
  e
@@ -198,14 +198,21 @@ export async function navigatorLock<R>(
198
198
  }
199
199
  }
200
200
  )
201
- } catch (e: any) {
201
+ } catch (e) {
202
202
  // Always clear the acquire timeout once the request settles, so it cannot
203
203
  // fire later and incorrectly abort/log after a rejection.
204
204
  if (acquireTimeout > 0) {
205
205
  clearTimeout(acquireTimeoutTimer)
206
206
  }
207
207
 
208
- if (e?.name === 'AbortError' && acquireTimeout > 0) {
208
+ // DOMException does not extend Error in Node.js, so use structural check
209
+ if (
210
+ e !== null &&
211
+ typeof e === 'object' &&
212
+ 'name' in e &&
213
+ e.name === 'AbortError' &&
214
+ acquireTimeout > 0
215
+ ) {
209
216
  if (abortController.signal.aborted) {
210
217
  // OUR timeout fired — the lock is genuinely orphaned. Steal it.
211
218
  //
@@ -370,14 +377,14 @@ export async function processLock<R>(
370
377
  if (timeoutId !== null) {
371
378
  clearTimeout(timeoutId)
372
379
  }
373
- } catch (e: any) {
380
+ } catch (e) {
374
381
  // Clear the timeout on error path as well
375
382
  if (timeoutId !== null) {
376
383
  clearTimeout(timeoutId)
377
384
  }
378
385
 
379
386
  // Re-throw timeout errors, ignore others
380
- if (e && e.isAcquireTimeout) {
387
+ if (e instanceof LockAcquireTimeoutError) {
381
388
  throw e
382
389
  }
383
390
  // Fall through to run fn() - previous operation finished with error
@@ -391,8 +398,8 @@ export async function processLock<R>(
391
398
  PROCESS_LOCKS[name] = (async () => {
392
399
  try {
393
400
  return await currentOperation
394
- } catch (e: any) {
395
- if (e && e.isAcquireTimeout) {
401
+ } catch (e) {
402
+ if (e instanceof LockAcquireTimeoutError) {
396
403
  // if the current operation timed out, it doesn't mean that the previous
397
404
  // operation finished, so we need continue waiting for it to finish
398
405
  try {
@@ -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 = '3.0.0-next.17'
7
+ export const version = '3.0.0-next.19'