@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supabase/supabase-js",
3
- "version": "2.115.0",
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.115.0",
81
- "@supabase/postgrest-js": "2.115.0",
82
- "@supabase/storage-js": "2.115.0",
83
- "@supabase/realtime-js": "2.115.0",
84
- "@supabase/functions-js": "2.115.0"
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"
@@ -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')
@@ -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'
@@ -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.115.0'
7
+ export const version = '2.116.0-canary.0'