@supabase/supabase-js 2.72.1-canary.8 → 2.79.1-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/README.md +23 -12
- package/dist/main/SupabaseClient.d.ts.map +1 -1
- package/dist/main/SupabaseClient.js +5 -6
- package/dist/main/SupabaseClient.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +8 -0
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +23 -0
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/types.d.ts +9 -1
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/module/SupabaseClient.d.ts.map +1 -1
- package/dist/module/SupabaseClient.js +6 -7
- package/dist/module/SupabaseClient.js.map +1 -1
- package/dist/module/lib/helpers.d.ts +8 -0
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js +22 -0
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/types.d.ts +9 -1
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/umd/supabase.js +1 -1
- package/package.json +20 -28
- package/src/SupabaseClient.ts +8 -6
- package/src/lib/helpers.ts +25 -0
- package/src/lib/types.ts +9 -1
- package/src/lib/version.ts +1 -1
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supabase/supabase-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.79.1-canary.0",
|
|
4
4
|
"description": "Isomorphic Javascript client for Supabase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
7
7
|
"typescript",
|
|
8
8
|
"supabase"
|
|
9
9
|
],
|
|
10
|
-
"homepage": "https://github.com/supabase/supabase-js
|
|
11
|
-
"bugs": "https://github.com/supabase/supabase-js
|
|
10
|
+
"homepage": "https://github.com/supabase/supabase-js/tree/master/packages/core/supabase-js",
|
|
11
|
+
"bugs": "https://github.com/supabase/supabase-js/issues",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"author": "Supabase",
|
|
14
14
|
"files": [
|
|
@@ -21,49 +21,46 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/supabase/supabase-js
|
|
24
|
+
"url": "https://github.com/supabase/supabase-js.git",
|
|
25
25
|
"directory": "packages/core/supabase-js"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"clean": "rimraf dist docs/v2",
|
|
29
|
-
"
|
|
30
|
-
"build": "npm run clean && npm run format && npm run build:main && npm run build:module && npm run build:umd",
|
|
29
|
+
"build": "npm run clean && npx nx build:main supabase-js && npx nx build:module supabase-js && npx nx build:umd supabase-js",
|
|
31
30
|
"build:main": "tsc -p tsconfig.json",
|
|
32
31
|
"build:module": "tsc -p tsconfig.module.json",
|
|
33
32
|
"build:umd": "webpack --env mode=production",
|
|
34
|
-
"test": "
|
|
35
|
-
"test:all": "
|
|
33
|
+
"test": "npx nx test:types supabase-js && npx nx test:run supabase-js",
|
|
34
|
+
"test:all": "npx nx test:types supabase-js && npx nx test:run supabase-js && npx nx test:integration supabase-js && npx nx test:integration:browser supabase-js",
|
|
36
35
|
"test:run": "jest --runInBand --detectOpenHandles",
|
|
37
36
|
"test:unit": "jest --runInBand --detectOpenHandles test/unit",
|
|
38
37
|
"test:coverage": "jest --runInBand --coverage --testPathIgnorePatterns=\"test/integration|test/deno\"",
|
|
39
38
|
"test:integration": "jest --runInBand --detectOpenHandles test/integration.test.ts",
|
|
40
39
|
"test:integration:browser": "deno test --allow-all test/integration.browser.test.ts",
|
|
41
|
-
"test:edge-functions": "deno test --allow-all --no-check --unstable-sloppy-imports test/deno/edge-functions-integration.test.ts",
|
|
40
|
+
"test:edge-functions": "deno test --allow-all --no-check --unstable-sloppy-imports --config test/deno/deno.json test/deno/edge-functions-integration.test.ts",
|
|
42
41
|
"test:watch": "jest --watch --verbose false --silent false",
|
|
43
42
|
"test:node:playwright": "cd test/integration/node-browser && npm install && cp ../../../dist/umd/supabase.js . && npm run test",
|
|
44
43
|
"test:bun": "cd test/integration/bun && bun install && bun test",
|
|
45
|
-
"test:types": "
|
|
44
|
+
"test:types": "npx nx build:module supabase-js && tsd --files test/types/*.test-d.ts && jsr publish --dry-run --allow-dirty",
|
|
46
45
|
"docs": "typedoc --entryPoints src/index.ts --out docs/v2",
|
|
47
46
|
"docs:json": "typedoc --entryPoints src/index.ts --json docs/v2/spec.json --excludeExternals",
|
|
48
|
-
"serve:coverage": "
|
|
49
|
-
"update:test-deps": "
|
|
50
|
-
"update:test-deps:expo": "
|
|
51
|
-
"update:test-deps:next": "
|
|
52
|
-
"update:test-deps:deno": "
|
|
53
|
-
"update:test-deps:bun": "
|
|
47
|
+
"serve:coverage": "npx nx test:coverage supabase-js && serve test/coverage",
|
|
48
|
+
"update:test-deps": "npx nx build supabase-js && npm pack && cp supabase-supabase-js-*.tgz test/integration/expo/supabase-supabase-js-0.0.0-automated.tgz && cp supabase-supabase-js-*.tgz test/integration/next/supabase-supabase-js-0.0.0-automated.tgz && cp supabase-supabase-js-*.tgz test/deno/supabase-supabase-js-0.0.0-automated.tgz && cp supabase-supabase-js-*.tgz test/integration/bun/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/expo && npm install && cd ../next && npm install --legacy-peer-deps && cd ../../deno && npm install && cd ../integration/bun && bun install",
|
|
49
|
+
"update:test-deps:expo": "npx nx build supabase-js && npm pack && cp supabase-supabase-js-*.tgz test/integration/expo/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/expo && npm install",
|
|
50
|
+
"update:test-deps:next": "npx nx build supabase-js && npm pack && cp supabase-supabase-js-*.tgz test/integration/next/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/next && npm install --legacy-peer-deps",
|
|
51
|
+
"update:test-deps:deno": "npx nx build supabase-js && npm pack && cp supabase-supabase-js-*.tgz test/deno/supabase-supabase-js-0.0.0-automated.tgz && cd test/deno && npm install",
|
|
52
|
+
"update:test-deps:bun": "npx nx build supabase-js && npm pack && cp supabase-supabase-js-*.tgz test/integration/bun/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/bun && bun install"
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
56
|
-
"@supabase/auth-js": "2.
|
|
57
|
-
"@supabase/functions-js": "2.
|
|
58
|
-
"@supabase/postgrest-js": "2.
|
|
59
|
-
"@supabase/realtime-js": "2.
|
|
60
|
-
"@supabase/storage-js": "2.
|
|
55
|
+
"@supabase/auth-js": "2.79.1-canary.0",
|
|
56
|
+
"@supabase/functions-js": "2.79.1-canary.0",
|
|
57
|
+
"@supabase/postgrest-js": "2.79.1-canary.0",
|
|
58
|
+
"@supabase/realtime-js": "2.79.1-canary.0",
|
|
59
|
+
"@supabase/storage-js": "2.79.1-canary.0",
|
|
61
60
|
"@supabase/node-fetch": "2.6.15"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
64
63
|
"@sebbo2002/semantic-release-jsr": "^1.0.0",
|
|
65
|
-
"@solana/wallet-standard-features": "^1.3.0",
|
|
66
|
-
"husky": "^4.3.8",
|
|
67
64
|
"jsr": "^0.13.5",
|
|
68
65
|
"pretty-quick": "^3.1.3",
|
|
69
66
|
"puppeteer": "^24.9.0",
|
|
@@ -75,11 +72,6 @@
|
|
|
75
72
|
"webpack": "^5.69.1",
|
|
76
73
|
"webpack-cli": "^4.9.2"
|
|
77
74
|
},
|
|
78
|
-
"husky": {
|
|
79
|
-
"hooks": {
|
|
80
|
-
"pre-commit": "pretty-quick --staged"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
75
|
"jsdelivr": "dist/umd/supabase.js",
|
|
84
76
|
"unpkg": "dist/umd/supabase.js"
|
|
85
77
|
}
|
package/src/SupabaseClient.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
DEFAULT_REALTIME_OPTIONS,
|
|
20
20
|
} from './lib/constants'
|
|
21
21
|
import { fetchWithAuth } from './lib/fetch'
|
|
22
|
-
import {
|
|
22
|
+
import { applySettingDefaults, validateSupabaseUrl } from './lib/helpers'
|
|
23
23
|
import { SupabaseAuthClient } from './lib/SupabaseAuthClient'
|
|
24
24
|
import { Fetch, GenericSchema, SupabaseClientOptions, SupabaseAuthClientOptions } from './lib/types'
|
|
25
25
|
|
|
@@ -101,12 +101,9 @@ export default class SupabaseClient<
|
|
|
101
101
|
protected supabaseKey: string,
|
|
102
102
|
options?: SupabaseClientOptions<SchemaName>
|
|
103
103
|
) {
|
|
104
|
-
|
|
104
|
+
const baseUrl = validateSupabaseUrl(supabaseUrl)
|
|
105
105
|
if (!supabaseKey) throw new Error('supabaseKey is required.')
|
|
106
106
|
|
|
107
|
-
const _supabaseUrl = ensureTrailingSlash(supabaseUrl)
|
|
108
|
-
const baseUrl = new URL(_supabaseUrl)
|
|
109
|
-
|
|
110
107
|
this.realtimeUrl = new URL('realtime/v1', baseUrl)
|
|
111
108
|
this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace('http', 'ws')
|
|
112
109
|
this.authUrl = new URL('auth/v1', baseUrl)
|
|
@@ -316,6 +313,7 @@ export default class SupabaseClient<
|
|
|
316
313
|
persistSession,
|
|
317
314
|
detectSessionInUrl,
|
|
318
315
|
storage,
|
|
316
|
+
userStorage,
|
|
319
317
|
storageKey,
|
|
320
318
|
flowType,
|
|
321
319
|
lock,
|
|
@@ -336,13 +334,16 @@ export default class SupabaseClient<
|
|
|
336
334
|
persistSession,
|
|
337
335
|
detectSessionInUrl,
|
|
338
336
|
storage,
|
|
337
|
+
userStorage,
|
|
339
338
|
flowType,
|
|
340
339
|
lock,
|
|
341
340
|
debug,
|
|
342
341
|
fetch,
|
|
343
342
|
// auth checks if there is a custom authorizaiton header using this flag
|
|
344
343
|
// so it knows whether to return an error when getUser is called with no session
|
|
345
|
-
hasCustomAuthorizationHeader:
|
|
344
|
+
hasCustomAuthorizationHeader: Object.keys(this.headers).some(
|
|
345
|
+
(key) => key.toLowerCase() === 'authorization'
|
|
346
|
+
),
|
|
346
347
|
})
|
|
347
348
|
}
|
|
348
349
|
|
|
@@ -370,6 +371,7 @@ export default class SupabaseClient<
|
|
|
370
371
|
this.changedAccessToken !== token
|
|
371
372
|
) {
|
|
372
373
|
this.changedAccessToken = token
|
|
374
|
+
this.realtime.setAuth(token)
|
|
373
375
|
} else if (event === 'SIGNED_OUT') {
|
|
374
376
|
this.realtime.setAuth()
|
|
375
377
|
if (source == 'STORAGE') this.auth.signOut()
|
package/src/lib/helpers.ts
CHANGED
|
@@ -71,3 +71,28 @@ export function applySettingDefaults<
|
|
|
71
71
|
|
|
72
72
|
return result
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Validates a Supabase client URL
|
|
77
|
+
*
|
|
78
|
+
* @param {string} supabaseUrl - The Supabase client URL string.
|
|
79
|
+
* @returns {URL} - The validated base URL.
|
|
80
|
+
* @throws {Error}
|
|
81
|
+
*/
|
|
82
|
+
export function validateSupabaseUrl(supabaseUrl: string): URL {
|
|
83
|
+
const trimmedUrl = supabaseUrl?.trim()
|
|
84
|
+
|
|
85
|
+
if (!trimmedUrl) {
|
|
86
|
+
throw new Error('supabaseUrl is required.')
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!trimmedUrl.match(/^https?:\/\//i)) {
|
|
90
|
+
throw new Error('Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.')
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
return new URL(ensureTrailingSlash(trimmedUrl))
|
|
95
|
+
} catch {
|
|
96
|
+
throw Error('Invalid supabaseUrl: Provided URL is malformed.')
|
|
97
|
+
}
|
|
98
|
+
}
|
package/src/lib/types.ts
CHANGED
|
@@ -1,7 +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
|
|
4
|
+
import type { StorageClientOptions } from '@supabase/storage-js'
|
|
5
5
|
|
|
6
6
|
type AuthClientOptions = ConstructorParameters<typeof AuthClient>[0]
|
|
7
7
|
|
|
@@ -38,6 +38,14 @@ export type SupabaseClientOptions<SchemaName> = {
|
|
|
38
38
|
* A storage provider. Used to store the logged-in session.
|
|
39
39
|
*/
|
|
40
40
|
storage?: SupabaseAuthClientOptions['storage']
|
|
41
|
+
/**
|
|
42
|
+
* A storage provider to store the user profile separately from the session.
|
|
43
|
+
* Useful when you need to store the session information in cookies,
|
|
44
|
+
* without bloating the data with the redundant user object.
|
|
45
|
+
*
|
|
46
|
+
* @experimental
|
|
47
|
+
*/
|
|
48
|
+
userStorage?: SupabaseAuthClientOptions['userStorage']
|
|
41
49
|
/**
|
|
42
50
|
* OAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications.
|
|
43
51
|
*/
|
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.79.1-canary.0'
|