@symbo.ls/fetch 3.7.4 → 3.7.6
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/adapters/supabase.js +4 -1
- package/index.js +3 -2
- package/package.json +2 -2
package/adapters/supabase.js
CHANGED
|
@@ -10,7 +10,10 @@ export const setup = async ({ url, key, projectId, createClient, ...options }) =
|
|
|
10
10
|
const mod = await import(/* webpackIgnore: true */ pkg)
|
|
11
11
|
createClient = mod.createClient
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
const client = createClient(supabaseUrl, key, options)
|
|
14
|
+
// Guard against no-op createClient (e.g. deserialized placeholder from SSR)
|
|
15
|
+
if (!client || !client.auth) return null
|
|
16
|
+
return supabaseAdapter(client)
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
const applyFilters = (query, params) => {
|
package/index.js
CHANGED
|
@@ -280,7 +280,7 @@ const resolveParams = (params, element, context) => {
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
export const initAdapterAuth = async (adapter, context) => {
|
|
283
|
-
if (adapter.__authInitialized) return
|
|
283
|
+
if (!adapter || adapter.__authInitialized) return
|
|
284
284
|
adapter.__authInitialized = true
|
|
285
285
|
if (!adapter.getSession) return
|
|
286
286
|
const updateAuth = (user, session) => {
|
|
@@ -314,9 +314,10 @@ const resolveAdapter = async (db, context) => {
|
|
|
314
314
|
|
|
315
315
|
db.__resolving = resolveDb(db)
|
|
316
316
|
const resolved = await db.__resolving
|
|
317
|
+
delete db.__resolving
|
|
318
|
+
if (!resolved) return null
|
|
317
319
|
db.__resolved = resolved
|
|
318
320
|
context.fetch = resolved
|
|
319
|
-
delete db.__resolving
|
|
320
321
|
|
|
321
322
|
// Auto-init auth when adapter supports it and db.auth is enabled
|
|
322
323
|
if (db.auth !== false) await initAdapterAuth(resolved, context)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/fetch",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.6",
|
|
4
4
|
"license": "CC-BY-NC-4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"adapters"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@domql/utils": "^3.7.
|
|
28
|
+
"@domql/utils": "^3.7.6"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@supabase/supabase-js": "^2.0.0"
|