@supabase/supabase-js 2.115.0 → 2.116.0-canary.0
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 +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +17 -1
- package/dist/index.mjs.map +1 -1
- package/dist/umd/supabase.js +7 -7
- package/package.json +6 -6
- package/src/SupabaseClient.ts +2 -0
- package/src/lib/helpers.ts +39 -0
- 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.
|
|
3
|
+
"version": "2.116.0-canary.0",
|
|
4
4
|
"description": "Isomorphic Javascript SDK for Supabase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -77,11 +77,11 @@
|
|
|
77
77
|
"directory": "packages/core/supabase-js"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@supabase/auth-js": "2.
|
|
81
|
-
"@supabase/postgrest-js": "2.
|
|
82
|
-
"@supabase/storage-js": "2.
|
|
83
|
-
"@supabase/realtime-js": "2.
|
|
84
|
-
"@supabase/functions-js": "2.
|
|
80
|
+
"@supabase/auth-js": "2.116.0-canary.0",
|
|
81
|
+
"@supabase/postgrest-js": "2.116.0-canary.0",
|
|
82
|
+
"@supabase/storage-js": "2.116.0-canary.0",
|
|
83
|
+
"@supabase/realtime-js": "2.116.0-canary.0",
|
|
84
|
+
"@supabase/functions-js": "2.116.0-canary.0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@opentelemetry/api": ">=1.0.0"
|
package/src/SupabaseClient.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
import { checkApiKeyFormat, fetchWithAuth } from './lib/fetch'
|
|
26
26
|
import {
|
|
27
27
|
applySettingDefaults,
|
|
28
|
+
checkTopLevelSchemaOption,
|
|
28
29
|
validateSupabaseUrl,
|
|
29
30
|
type ResolvedSupabaseClientOptions,
|
|
30
31
|
} from './lib/helpers'
|
|
@@ -320,6 +321,7 @@ export default class SupabaseClient<
|
|
|
320
321
|
const baseUrl = validateSupabaseUrl(supabaseUrl)
|
|
321
322
|
if (!supabaseKey) throw new Error('supabaseKey is required.')
|
|
322
323
|
checkApiKeyFormat(supabaseKey)
|
|
324
|
+
checkTopLevelSchemaOption(options)
|
|
323
325
|
|
|
324
326
|
this.realtimeUrl = new URL('realtime/v1', baseUrl)
|
|
325
327
|
this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace('http', 'ws')
|
package/src/lib/helpers.ts
CHANGED
|
@@ -21,6 +21,45 @@ export function ensureTrailingSlash(url: string): string {
|
|
|
21
21
|
|
|
22
22
|
export const isBrowser = () => typeof window !== 'undefined'
|
|
23
23
|
|
|
24
|
+
let warnedTopLevelSchema = false
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Warn (once per process) when `schema` is passed at the top level of the client options
|
|
28
|
+
* instead of under `db`. A top-level `schema` is not part of the options shape and is
|
|
29
|
+
* ignored, so queries silently go to the default schema. Never throws.
|
|
30
|
+
*
|
|
31
|
+
* Only `undefined` counts as unset, matching `db.schema`, where any other value is sent
|
|
32
|
+
* as the profile header.
|
|
33
|
+
*/
|
|
34
|
+
export function checkTopLevelSchemaOption(options: unknown): void {
|
|
35
|
+
if (warnedTopLevelSchema) {
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
if (
|
|
39
|
+
typeof options !== 'object' ||
|
|
40
|
+
options === null ||
|
|
41
|
+
!('schema' in options) ||
|
|
42
|
+
(options as { schema?: unknown }).schema === undefined
|
|
43
|
+
) {
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
warnedTopLevelSchema = true
|
|
47
|
+
console.warn(
|
|
48
|
+
'@supabase/supabase-js: The "schema" option must be nested under "db", ' +
|
|
49
|
+
"e.g. createClient(url, key, { db: { schema: 'myschema' } }). " +
|
|
50
|
+
'A top-level "schema" is ignored and queries go to the default schema.'
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* For tests only. Resets the one-time top-level `schema` warning.
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export function _resetTopLevelSchemaWarning(): void {
|
|
60
|
+
warnedTopLevelSchema = false
|
|
61
|
+
}
|
|
62
|
+
|
|
24
63
|
export type ResolvedSupabaseClientOptions<SchemaName> = Omit<
|
|
25
64
|
Required<SupabaseClientOptions<SchemaName>>,
|
|
26
65
|
'tracePropagation'
|
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.
|
|
7
|
+
export const version = '2.116.0-canary.0'
|