@supabase/supabase-js 2.52.0 → 2.53.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.52.0",
3
+ "version": "2.53.0",
4
4
  "description": "Isomorphic Javascript client for Supabase",
5
5
  "keywords": [
6
6
  "javascript",
@@ -35,6 +35,7 @@
35
35
  "test:coverage": "jest --runInBand --coverage --testPathIgnorePatterns=\"test/integration|test/deno\"",
36
36
  "test:integration": "jest --runInBand --detectOpenHandles test/integration.test.ts",
37
37
  "test:integration:browser": "deno test --allow-all test/integration.browser.test.ts",
38
+ "test:edge-functions": "deno test --allow-all --no-check test/deno/edge-functions-integration.test.ts",
38
39
  "test:watch": "jest --watch --verbose false --silent false",
39
40
  "test:node:playwright": "cd test/integration/node-browser && npm install && cp ../../../dist/umd/supabase.js . && npm run test",
40
41
  "test:bun": "cd test/integration/bun && bun install && bun test",
@@ -54,7 +55,7 @@
54
55
  "@supabase/node-fetch": "2.6.15",
55
56
  "@supabase/postgrest-js": "1.19.4",
56
57
  "@supabase/realtime-js": "2.11.15",
57
- "@supabase/storage-js": "2.7.1"
58
+ "@supabase/storage-js": "^2.10.4"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@sebbo2002/semantic-release-jsr": "^1.0.0",
@@ -42,6 +42,10 @@ export default class SupabaseClient<
42
42
  */
43
43
  auth: SupabaseAuthClient
44
44
  realtime: RealtimeClient
45
+ /**
46
+ * Supabase Storage allows you to manage user-generated content, such as photos or videos.
47
+ */
48
+ storage: SupabaseStorageClient
45
49
 
46
50
  protected realtimeUrl: URL
47
51
  protected authUrl: URL
@@ -64,6 +68,7 @@ export default class SupabaseClient<
64
68
  * @param options.auth.persistSession Set to "true" if you want to automatically save the user session into local storage.
65
69
  * @param options.auth.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
66
70
  * @param options.realtime Options passed along to realtime-js constructor.
71
+ * @param options.storage Options passed along to the storage-js constructor.
67
72
  * @param options.global.fetch A custom fetch implementation.
68
73
  * @param options.global.headers Any additional headers to send with each network request.
69
74
  */
@@ -130,6 +135,13 @@ export default class SupabaseClient<
130
135
  fetch: this.fetch,
131
136
  })
132
137
 
138
+ this.storage = new SupabaseStorageClient(
139
+ this.storageUrl.href,
140
+ this.headers,
141
+ this.fetch,
142
+ options?.storage
143
+ )
144
+
133
145
  if (!settings.accessToken) {
134
146
  this._listenForAuthEvents()
135
147
  }
@@ -145,13 +157,6 @@ export default class SupabaseClient<
145
157
  })
146
158
  }
147
159
 
148
- /**
149
- * Supabase Storage allows you to manage user-generated content, such as photos or videos.
150
- */
151
- get storage(): SupabaseStorageClient {
152
- return new SupabaseStorageClient(this.storageUrl.href, this.headers, this.fetch)
153
- }
154
-
155
160
  // NOTE: signatures must be kept in sync with PostgrestClient.from
156
161
  from<
157
162
  TableName extends string & keyof Schema['Tables'],
package/src/index.ts CHANGED
@@ -39,3 +39,31 @@ export const createClient = <
39
39
  ): SupabaseClient<Database, SchemaName, Schema> => {
40
40
  return new SupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, options)
41
41
  }
42
+
43
+ // Check for Node.js <= 18 deprecation
44
+ function shouldShowDeprecationWarning(): boolean {
45
+ if (
46
+ typeof window !== 'undefined' ||
47
+ typeof process === 'undefined' ||
48
+ process.version === undefined ||
49
+ process.version === null
50
+ ) {
51
+ return false
52
+ }
53
+
54
+ const versionMatch = process.version.match(/^v(\d+)\./)
55
+ if (!versionMatch) {
56
+ return false
57
+ }
58
+
59
+ const majorVersion = parseInt(versionMatch[1], 10)
60
+ return majorVersion <= 18
61
+ }
62
+
63
+ if (shouldShowDeprecationWarning()) {
64
+ console.warn(
65
+ `⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. ` +
66
+ `Please upgrade to Node.js 20 or later. ` +
67
+ `For more information, visit: https://github.com/orgs/supabase/discussions/37217`
68
+ )
69
+ }
@@ -50,6 +50,7 @@ export function applySettingDefaults<
50
50
  ...DEFAULT_REALTIME_OPTIONS,
51
51
  ...realtimeOptions,
52
52
  },
53
+ storage: {},
53
54
  global: {
54
55
  ...DEFAULT_GLOBAL_OPTIONS,
55
56
  ...globalOptions,
package/src/lib/types.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AuthClient } from '@supabase/auth-js'
2
2
  import { RealtimeClientOptions } from '@supabase/realtime-js'
3
3
  import { PostgrestError } from '@supabase/postgrest-js'
4
+ import { StorageClientOptions } from '@supabase/storage-js/dist/module/StorageClient'
4
5
 
5
6
  type AuthClientOptions = ConstructorParameters<typeof AuthClient>[0]
6
7
 
@@ -56,6 +57,7 @@ export type SupabaseClientOptions<SchemaName> = {
56
57
  * Options passed to the realtime-js instance
57
58
  */
58
59
  realtime?: RealtimeClientOptions
60
+ storage?: StorageClientOptions
59
61
  global?: {
60
62
  /**
61
63
  * A custom `fetch` implementation.
@@ -1 +1 @@
1
- export const version = '2.52.0'
1
+ export const version = '2.53.0'