@supabase/supabase-js 2.110.6-canary.0 → 2.110.6-canary.2
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/index.cjs +16 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +16 -11
- package/dist/index.mjs.map +1 -1
- package/dist/umd/supabase.js +7 -7
- package/package.json +6 -6
- package/src/SupabaseClient.ts +2 -2
- package/src/lib/fetch.ts +22 -14
- package/src/lib/version.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supabase/supabase-js",
|
|
3
|
-
"version": "2.110.6-canary.
|
|
3
|
+
"version": "2.110.6-canary.2",
|
|
4
4
|
"description": "Isomorphic Javascript SDK for Supabase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"directory": "packages/core/supabase-js"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@supabase/
|
|
63
|
-
"@supabase/
|
|
64
|
-
"@supabase/
|
|
65
|
-
"@supabase/
|
|
66
|
-
"@supabase/
|
|
62
|
+
"@supabase/auth-js": "2.110.6-canary.2",
|
|
63
|
+
"@supabase/functions-js": "2.110.6-canary.2",
|
|
64
|
+
"@supabase/postgrest-js": "2.110.6-canary.2",
|
|
65
|
+
"@supabase/realtime-js": "2.110.6-canary.2",
|
|
66
|
+
"@supabase/storage-js": "2.110.6-canary.2"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@arethetypeswrong/cli": "^0.18.2",
|
package/src/SupabaseClient.ts
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
DEFAULT_REALTIME_OPTIONS,
|
|
21
21
|
DEFAULT_TRACE_PROPAGATION_OPTIONS,
|
|
22
22
|
} from './lib/constants'
|
|
23
|
-
import {
|
|
23
|
+
import { checkApiKeyFormat, fetchWithAuth } from './lib/fetch'
|
|
24
24
|
import {
|
|
25
25
|
applySettingDefaults,
|
|
26
26
|
validateSupabaseUrl,
|
|
@@ -315,7 +315,7 @@ export default class SupabaseClient<
|
|
|
315
315
|
) {
|
|
316
316
|
const baseUrl = validateSupabaseUrl(supabaseUrl)
|
|
317
317
|
if (!supabaseKey) throw new Error('supabaseKey is required.')
|
|
318
|
-
|
|
318
|
+
checkApiKeyFormat(supabaseKey)
|
|
319
319
|
|
|
320
320
|
this.realtimeUrl = new URL('realtime/v1', baseUrl)
|
|
321
321
|
this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace('http', 'ws')
|
package/src/lib/fetch.ts
CHANGED
|
@@ -24,27 +24,35 @@ export const resolveHeadersConstructor = () => {
|
|
|
24
24
|
/**
|
|
25
25
|
* New-format Supabase API keys (`sb_publishable_…` / `sb_secret_…`) are not JWTs and
|
|
26
26
|
* must never be sent as a Bearer token — they belong only in the `apikey` header.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* see {@link assertSupportedApiKey}.
|
|
27
|
+
* All other keys (legacy JWT keys, `sb_temp_…` temporary keys, unrecognized `sb_`
|
|
28
|
+
* subtypes) keep the Bearer fallback.
|
|
30
29
|
*/
|
|
31
30
|
const isNewApiKey = (key: string): boolean =>
|
|
32
31
|
key.startsWith('sb_publishable_') || key.startsWith('sb_secret_')
|
|
33
32
|
|
|
33
|
+
const TEMP_KEY_PREFIX = 'sb_temp_'
|
|
34
|
+
|
|
35
|
+
const warnedKeySubtypes = new Set<string>()
|
|
36
|
+
|
|
34
37
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* The key itself is never included in the message to avoid leaking secret keys.
|
|
38
|
+
* Warn (once per subtype) when an `sb_` key isn't a subtype this SDK version recognizes.
|
|
39
|
+
* Never throws — the server, not the SDK, decides key validity. The key value is never
|
|
40
|
+
* included in the message.
|
|
39
41
|
*/
|
|
40
|
-
export const
|
|
41
|
-
if (key.startsWith('sb_')
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
export const checkApiKeyFormat = (key: string): void => {
|
|
43
|
+
if (!key.startsWith('sb_') || isNewApiKey(key) || key.startsWith(TEMP_KEY_PREFIX)) {
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
const subtype = key.match(/^sb_[a-zA-Z0-9]+_/)?.[0] ?? 'unknown'
|
|
47
|
+
if (warnedKeySubtypes.has(subtype)) {
|
|
48
|
+
return
|
|
47
49
|
}
|
|
50
|
+
warnedKeySubtypes.add(subtype)
|
|
51
|
+
console.warn(
|
|
52
|
+
'@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed ' +
|
|
53
|
+
'and send this key as-is; if you see authentication errors you may need to upgrade ' +
|
|
54
|
+
'@supabase/supabase-js to a version that recognizes this key type.'
|
|
55
|
+
)
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
export const fetchWithAuth = (
|
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.110.6-canary.
|
|
7
|
+
export const version = '2.110.6-canary.2'
|