@supabase/supabase-js 2.58.0 → 2.71.2-canary.1

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.
Files changed (73) hide show
  1. package/README.md +1 -1
  2. package/package.json +24 -28
  3. package/src/SupabaseClient.ts +11 -13
  4. package/src/index.ts +2 -2
  5. package/src/lib/helpers.ts +1 -26
  6. package/src/lib/types.ts +1 -9
  7. package/src/lib/version.ts +1 -1
  8. package/LICENSE +0 -21
  9. package/dist/main/SupabaseClient.d.ts +0 -131
  10. package/dist/main/SupabaseClient.d.ts.map +0 -1
  11. package/dist/main/SupabaseClient.js +0 -228
  12. package/dist/main/SupabaseClient.js.map +0 -1
  13. package/dist/main/index.d.ts +0 -24
  14. package/dist/main/index.d.ts.map +0 -1
  15. package/dist/main/index.js +0 -68
  16. package/dist/main/index.js.map +0 -1
  17. package/dist/main/lib/SupabaseAuthClient.d.ts +0 -6
  18. package/dist/main/lib/SupabaseAuthClient.d.ts.map +0 -1
  19. package/dist/main/lib/SupabaseAuthClient.js +0 -11
  20. package/dist/main/lib/SupabaseAuthClient.js.map +0 -1
  21. package/dist/main/lib/constants.d.ts +0 -16
  22. package/dist/main/lib/constants.d.ts.map +0 -1
  23. package/dist/main/lib/constants.js +0 -33
  24. package/dist/main/lib/constants.js.map +0 -1
  25. package/dist/main/lib/fetch.d.ts +0 -6
  26. package/dist/main/lib/fetch.d.ts.map +0 -1
  27. package/dist/main/lib/fetch.js +0 -76
  28. package/dist/main/lib/fetch.js.map +0 -1
  29. package/dist/main/lib/helpers.d.ts +0 -14
  30. package/dist/main/lib/helpers.d.ts.map +0 -1
  31. package/dist/main/lib/helpers.js +0 -71
  32. package/dist/main/lib/helpers.js.map +0 -1
  33. package/dist/main/lib/types.d.ts +0 -125
  34. package/dist/main/lib/types.d.ts.map +0 -1
  35. package/dist/main/lib/types.js +0 -3
  36. package/dist/main/lib/types.js.map +0 -1
  37. package/dist/main/lib/version.d.ts +0 -2
  38. package/dist/main/lib/version.d.ts.map +0 -1
  39. package/dist/main/lib/version.js +0 -5
  40. package/dist/main/lib/version.js.map +0 -1
  41. package/dist/module/SupabaseClient.d.ts +0 -131
  42. package/dist/module/SupabaseClient.d.ts.map +0 -1
  43. package/dist/module/SupabaseClient.js +0 -225
  44. package/dist/module/SupabaseClient.js.map +0 -1
  45. package/dist/module/index.d.ts +0 -24
  46. package/dist/module/index.d.ts.map +0 -1
  47. package/dist/module/index.js +0 -40
  48. package/dist/module/index.js.map +0 -1
  49. package/dist/module/lib/SupabaseAuthClient.d.ts +0 -6
  50. package/dist/module/lib/SupabaseAuthClient.d.ts.map +0 -1
  51. package/dist/module/lib/SupabaseAuthClient.js +0 -7
  52. package/dist/module/lib/SupabaseAuthClient.js.map +0 -1
  53. package/dist/module/lib/constants.d.ts +0 -16
  54. package/dist/module/lib/constants.d.ts.map +0 -1
  55. package/dist/module/lib/constants.js +0 -30
  56. package/dist/module/lib/constants.js.map +0 -1
  57. package/dist/module/lib/fetch.d.ts +0 -6
  58. package/dist/module/lib/fetch.d.ts.map +0 -1
  59. package/dist/module/lib/fetch.js +0 -47
  60. package/dist/module/lib/fetch.js.map +0 -1
  61. package/dist/module/lib/helpers.d.ts +0 -14
  62. package/dist/module/lib/helpers.d.ts.map +0 -1
  63. package/dist/module/lib/helpers.js +0 -63
  64. package/dist/module/lib/helpers.js.map +0 -1
  65. package/dist/module/lib/types.d.ts +0 -125
  66. package/dist/module/lib/types.d.ts.map +0 -1
  67. package/dist/module/lib/types.js +0 -2
  68. package/dist/module/lib/types.js.map +0 -1
  69. package/dist/module/lib/version.d.ts +0 -2
  70. package/dist/module/lib/version.d.ts.map +0 -1
  71. package/dist/module/lib/version.js +0 -2
  72. package/dist/module/lib/version.js.map +0 -1
  73. package/dist/umd/supabase.js +0 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # `supabase-js` - Isomorphic JavaScript Client for Supabase.
2
2
 
3
3
  - **Documentation:** https://supabase.com/docs/reference/javascript/start
4
- - TypeDoc: https://supabase.github.io/supabase-js/v2/
4
+ - TypeDoc: https://supabase.github.io/supabase-js-libs/supabase-js/v2/spec.json
5
5
 
6
6
  <div align="center">
7
7
 
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@supabase/supabase-js",
3
- "version": "2.58.0",
3
+ "version": "2.71.2-canary.1",
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/issues",
10
+ "homepage": "https://github.com/supabase/supabase-js-libs/tree/main/packages/core/supabase-js",
11
+ "bugs": "https://github.com/supabase/supabase-js-libs/issues",
12
12
  "license": "MIT",
13
13
  "author": "Supabase",
14
14
  "files": [
@@ -19,29 +19,32 @@
19
19
  "module": "dist/module/index.js",
20
20
  "types": "dist/module/index.d.ts",
21
21
  "sideEffects": false,
22
- "repository": "supabase/supabase-js",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/supabase/supabase-js-libs.git",
25
+ "directory": "packages/core/supabase-js"
26
+ },
23
27
  "scripts": {
24
28
  "clean": "rimraf dist docs/v2",
25
29
  "format": "prettier --write \"{src,test}/**/*.ts\"",
26
- "build": "run-s clean format build:*",
30
+ "build": "npm run clean && npm run format && npm run build:main && npm run build:module && npm run build:umd",
27
31
  "build:main": "tsc -p tsconfig.json",
28
32
  "build:module": "tsc -p tsconfig.module.json",
29
33
  "build:umd": "webpack --env mode=production",
30
- "types-generate": "dts-gen -m '@supabase/supabase-js' -s",
31
- "test": "run-s test:types test:run",
32
- "test:all": "run-s test:types test:run test:integration test:integration:browser",
34
+ "test": "npm run test:types && npm run test:run",
35
+ "test:all": "npm run test:types && npm run test:run && npm run test:integration && npm run test:integration:browser",
33
36
  "test:run": "jest --runInBand --detectOpenHandles",
34
37
  "test:unit": "jest --runInBand --detectOpenHandles test/unit",
35
38
  "test:coverage": "jest --runInBand --coverage --testPathIgnorePatterns=\"test/integration|test/deno\"",
36
39
  "test:integration": "jest --runInBand --detectOpenHandles test/integration.test.ts",
37
40
  "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",
41
+ "test:edge-functions": "deno test --allow-all --no-check --unstable-sloppy-imports test/deno/edge-functions-integration.test.ts",
39
42
  "test:watch": "jest --watch --verbose false --silent false",
40
43
  "test:node:playwright": "cd test/integration/node-browser && npm install && cp ../../../dist/umd/supabase.js . && npm run test",
41
44
  "test:bun": "cd test/integration/bun && bun install && bun test",
42
- "test:types": "run-s build:module && tsd --files test/types/*.test-d.ts && jsr publish --dry-run",
43
- "docs": "typedoc --entryPoints src/index.ts --out docs/v2 --includes src/**/*.ts",
44
- "docs:json": "typedoc --entryPoints src/index.ts --includes src/**/*.ts --json docs/v2/spec.json --excludeExternals",
45
+ "test:types": "npm run build:module && tsd --files test/types/*.test-d.ts && jsr publish --dry-run",
46
+ "docs": "typedoc --entryPoints src/index.ts --out docs/v2",
47
+ "docs:json": "typedoc --entryPoints src/index.ts --json docs/v2/spec.json --excludeExternals",
45
48
  "serve:coverage": "npm run test:coverage && serve test/coverage",
46
49
  "update:test-deps": "npm run build && 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",
47
50
  "update:test-deps:expo": "npm run build && 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,32 +53,25 @@
50
53
  "update:test-deps:bun": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/integration/bun/supabase-supabase-js-0.0.0-automated.tgz && cd test/integration/bun && bun install"
51
54
  },
52
55
  "dependencies": {
53
- "@supabase/auth-js": "2.72.0",
54
- "@supabase/functions-js": "2.5.0",
55
- "@supabase/node-fetch": "2.6.15",
56
- "@supabase/postgrest-js": "1.21.4",
57
- "@supabase/realtime-js": "2.15.5",
58
- "@supabase/storage-js": "2.12.2"
56
+ "@supabase/auth-js": "2.71.2-canary.1",
57
+ "@supabase/functions-js": "2.71.2-canary.1",
58
+ "@supabase/postgrest-js": "2.71.2-canary.1",
59
+ "@supabase/realtime-js": "2.71.2-canary.1",
60
+ "@supabase/storage-js": "2.71.2-canary.1",
61
+ "@supabase/node-fetch": "2.6.15"
59
62
  },
60
63
  "devDependencies": {
61
64
  "@sebbo2002/semantic-release-jsr": "^1.0.0",
62
- "@types/jest": "^29.2.5",
65
+ "@solana/wallet-standard-features": "^1.3.0",
63
66
  "husky": "^4.3.8",
64
- "jest": "^29.3.1",
65
67
  "jsr": "^0.13.5",
66
- "npm-run-all": "^4.1.5",
67
- "prettier": "^2.5.1",
68
68
  "pretty-quick": "^3.1.3",
69
69
  "puppeteer": "^24.9.0",
70
- "rimraf": "^3.0.2",
71
- "semantic-release-plugin-update-version-in-files": "^1.1.0",
72
70
  "serve": "^14.2.1",
73
71
  "ts-jest": "^29.0.5",
74
- "ts-loader": "^8.0.11",
75
- "ts-node": "^10.9.1",
72
+ "ts-loader": "^9.5.4",
76
73
  "tsd": "^0.30.4",
77
- "typedoc": "^0.23.28",
78
- "typescript": "^4.5.5",
74
+ "eslint-formatter-pretty": "^4.1.0",
79
75
  "webpack": "^5.69.1",
80
76
  "webpack-cli": "^4.9.2"
81
77
  },
@@ -19,7 +19,7 @@ import {
19
19
  DEFAULT_REALTIME_OPTIONS,
20
20
  } from './lib/constants'
21
21
  import { fetchWithAuth } from './lib/fetch'
22
- import { applySettingDefaults, validateSupabaseUrl } from './lib/helpers'
22
+ import { ensureTrailingSlash, applySettingDefaults } from './lib/helpers'
23
23
  import { SupabaseAuthClient } from './lib/SupabaseAuthClient'
24
24
  import { Fetch, GenericSchema, SupabaseClientOptions, SupabaseAuthClientOptions } from './lib/types'
25
25
 
@@ -43,8 +43,8 @@ export default class SupabaseClient<
43
43
  keyof Omit<Database, '__InternalSupabase'>
44
44
  ? SchemaNameOrClientOptions
45
45
  : 'public' extends keyof Omit<Database, '__InternalSupabase'>
46
- ? 'public'
47
- : string & keyof Omit<Omit<Database, '__InternalSupabase'>, '__InternalSupabase'>,
46
+ ? 'public'
47
+ : string & keyof Omit<Omit<Database, '__InternalSupabase'>, '__InternalSupabase'>,
48
48
  Schema extends Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema
49
49
  ? Omit<Database, '__InternalSupabase'>[SchemaName]
50
50
  : never = Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema
@@ -58,8 +58,8 @@ export default class SupabaseClient<
58
58
  : // otherwise default to 12
59
59
  { PostgrestVersion: '12' }
60
60
  : SchemaNameOrClientOptions extends { PostgrestVersion: string }
61
- ? SchemaNameOrClientOptions
62
- : never
61
+ ? SchemaNameOrClientOptions
62
+ : never,
63
63
  > {
64
64
  /**
65
65
  * Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies.
@@ -101,9 +101,12 @@ export default class SupabaseClient<
101
101
  protected supabaseKey: string,
102
102
  options?: SupabaseClientOptions<SchemaName>
103
103
  ) {
104
- const baseUrl = validateSupabaseUrl(supabaseUrl)
104
+ if (!supabaseUrl) throw new Error('supabaseUrl is required.')
105
105
  if (!supabaseKey) throw new Error('supabaseKey is required.')
106
106
 
107
+ const _supabaseUrl = ensureTrailingSlash(supabaseUrl)
108
+ const baseUrl = new URL(_supabaseUrl)
109
+
107
110
  this.realtimeUrl = new URL('realtime/v1', baseUrl)
108
111
  this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace('http', 'ws')
109
112
  this.authUrl = new URL('auth/v1', baseUrl)
@@ -181,7 +184,7 @@ export default class SupabaseClient<
181
184
  // NOTE: signatures must be kept in sync with PostgrestClient.from
182
185
  from<
183
186
  TableName extends string & keyof Schema['Tables'],
184
- Table extends Schema['Tables'][TableName]
187
+ Table extends Schema['Tables'][TableName],
185
188
  >(relation: TableName): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName>
186
189
  from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(
187
190
  relation: ViewName
@@ -313,7 +316,6 @@ export default class SupabaseClient<
313
316
  persistSession,
314
317
  detectSessionInUrl,
315
318
  storage,
316
- userStorage,
317
319
  storageKey,
318
320
  flowType,
319
321
  lock,
@@ -334,16 +336,13 @@ export default class SupabaseClient<
334
336
  persistSession,
335
337
  detectSessionInUrl,
336
338
  storage,
337
- userStorage,
338
339
  flowType,
339
340
  lock,
340
341
  debug,
341
342
  fetch,
342
343
  // auth checks if there is a custom authorizaiton header using this flag
343
344
  // so it knows whether to return an error when getUser is called with no session
344
- hasCustomAuthorizationHeader: Object.keys(this.headers).some(
345
- (key) => key.toLowerCase() === 'authorization'
346
- ),
345
+ hasCustomAuthorizationHeader: 'Authorization' in this.headers,
347
346
  })
348
347
  }
349
348
 
@@ -371,7 +370,6 @@ export default class SupabaseClient<
371
370
  this.changedAccessToken !== token
372
371
  ) {
373
372
  this.changedAccessToken = token
374
- this.realtime.setAuth(token)
375
373
  } else if (event === 'SIGNED_OUT') {
376
374
  this.realtime.setAuth()
377
375
  if (source == 'STORAGE') this.auth.signOut()
package/src/index.ts CHANGED
@@ -36,8 +36,8 @@ export const createClient = <
36
36
  keyof Omit<Database, '__InternalSupabase'>
37
37
  ? SchemaNameOrClientOptions
38
38
  : 'public' extends keyof Omit<Database, '__InternalSupabase'>
39
- ? 'public'
40
- : string & keyof Omit<Omit<Database, '__InternalSupabase'>, '__InternalSupabase'>
39
+ ? 'public'
40
+ : string & keyof Omit<Omit<Database, '__InternalSupabase'>, '__InternalSupabase'>,
41
41
  >(
42
42
  supabaseUrl: string,
43
43
  supabaseKey: string,
@@ -19,7 +19,7 @@ export function applySettingDefaults<
19
19
  Database = any,
20
20
  SchemaName extends string & keyof Database = 'public' extends keyof Database
21
21
  ? 'public'
22
- : string & keyof Database
22
+ : string & keyof Database,
23
23
  >(
24
24
  options: SupabaseClientOptions<SchemaName>,
25
25
  defaults: SupabaseClientOptions<any>
@@ -71,28 +71,3 @@ 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 type { StorageClientOptions } from '@supabase/storage-js'
4
+ import { StorageClientOptions } from '@supabase/storage-js/dist/module/StorageClient'
5
5
 
6
6
  type AuthClientOptions = ConstructorParameters<typeof AuthClient>[0]
7
7
 
@@ -38,14 +38,6 @@ 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']
49
41
  /**
50
42
  * OAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications.
51
43
  */
@@ -1 +1 @@
1
- export const version = '2.58.0'
1
+ export const version = '0.0.0-automated'
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Supabase
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,131 +0,0 @@
1
- import { FunctionsClient } from '@supabase/functions-js';
2
- import { PostgrestClient, PostgrestFilterBuilder, PostgrestQueryBuilder } from '@supabase/postgrest-js';
3
- import { RealtimeChannel, RealtimeChannelOptions, RealtimeClient } from '@supabase/realtime-js';
4
- import { StorageClient as SupabaseStorageClient } from '@supabase/storage-js';
5
- import { SupabaseAuthClient } from './lib/SupabaseAuthClient';
6
- import { Fetch, GenericSchema, SupabaseClientOptions } from './lib/types';
7
- /**
8
- * Supabase Client.
9
- *
10
- * An isomorphic Javascript client for interacting with Postgres.
11
- */
12
- export default class SupabaseClient<Database = any, SchemaNameOrClientOptions extends (string & keyof Omit<Database, '__InternalSupabase'>) | {
13
- PostgrestVersion: string;
14
- } = 'public' extends keyof Omit<Database, '__InternalSupabase'> ? 'public' : string & keyof Omit<Database, '__InternalSupabase'>, SchemaName extends string & keyof Omit<Database, '__InternalSupabase'> = SchemaNameOrClientOptions extends string & keyof Omit<Database, '__InternalSupabase'> ? SchemaNameOrClientOptions : 'public' extends keyof Omit<Database, '__InternalSupabase'> ? 'public' : string & keyof Omit<Omit<Database, '__InternalSupabase'>, '__InternalSupabase'>, Schema extends Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema ? Omit<Database, '__InternalSupabase'>[SchemaName] : never = Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema ? Omit<Database, '__InternalSupabase'>[SchemaName] : never, ClientOptions extends {
15
- PostgrestVersion: string;
16
- } = SchemaNameOrClientOptions extends string & keyof Omit<Database, '__InternalSupabase'> ? Database extends {
17
- __InternalSupabase: {
18
- PostgrestVersion: string;
19
- };
20
- } ? Database['__InternalSupabase'] : {
21
- PostgrestVersion: '12';
22
- } : SchemaNameOrClientOptions extends {
23
- PostgrestVersion: string;
24
- } ? SchemaNameOrClientOptions : never> {
25
- protected supabaseUrl: string;
26
- protected supabaseKey: string;
27
- /**
28
- * Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies.
29
- */
30
- auth: SupabaseAuthClient;
31
- realtime: RealtimeClient;
32
- /**
33
- * Supabase Storage allows you to manage user-generated content, such as photos or videos.
34
- */
35
- storage: SupabaseStorageClient;
36
- protected realtimeUrl: URL;
37
- protected authUrl: URL;
38
- protected storageUrl: URL;
39
- protected functionsUrl: URL;
40
- protected rest: PostgrestClient<Database, ClientOptions, SchemaName>;
41
- protected storageKey: string;
42
- protected fetch?: Fetch;
43
- protected changedAccessToken?: string;
44
- protected accessToken?: () => Promise<string | null>;
45
- protected headers: Record<string, string>;
46
- /**
47
- * Create a new client for use in the browser.
48
- * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.
49
- * @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard.
50
- * @param options.db.schema You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase.
51
- * @param options.auth.autoRefreshToken Set to "true" if you want to automatically refresh the token before expiring.
52
- * @param options.auth.persistSession Set to "true" if you want to automatically save the user session into local storage.
53
- * @param options.auth.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
54
- * @param options.realtime Options passed along to realtime-js constructor.
55
- * @param options.storage Options passed along to the storage-js constructor.
56
- * @param options.global.fetch A custom fetch implementation.
57
- * @param options.global.headers Any additional headers to send with each network request.
58
- */
59
- constructor(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions<SchemaName>);
60
- /**
61
- * Supabase Functions allows you to deploy and invoke edge functions.
62
- */
63
- get functions(): FunctionsClient;
64
- from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(relation: TableName): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName>;
65
- from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<ClientOptions, Schema, View, ViewName>;
66
- /**
67
- * Select a schema to query or perform an function (rpc) call.
68
- *
69
- * The schema needs to be on the list of exposed schemas inside Supabase.
70
- *
71
- * @param schema - The schema to query
72
- */
73
- schema<DynamicSchema extends string & keyof Omit<Database, '__InternalSupabase'>>(schema: DynamicSchema): PostgrestClient<Database, ClientOptions, DynamicSchema, Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any>;
74
- /**
75
- * Perform a function call.
76
- *
77
- * @param fn - The function name to call
78
- * @param args - The arguments to pass to the function call
79
- * @param options - Named parameters
80
- * @param options.head - When set to `true`, `data` will not be returned.
81
- * Useful if you only need the count.
82
- * @param options.get - When set to `true`, the function will be called with
83
- * read-only access mode.
84
- * @param options.count - Count algorithm to use to count rows returned by the
85
- * function. Only applicable for [set-returning
86
- * functions](https://www.postgresql.org/docs/current/functions-srf.html).
87
- *
88
- * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
89
- * hood.
90
- *
91
- * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
92
- * statistics under the hood.
93
- *
94
- * `"estimated"`: Uses exact count for low numbers and planned count for high
95
- * numbers.
96
- */
97
- rpc<FnName extends string & keyof Schema['Functions'], Fn extends Schema['Functions'][FnName]>(fn: FnName, args?: Fn['Args'], options?: {
98
- head?: boolean;
99
- get?: boolean;
100
- count?: 'exact' | 'planned' | 'estimated';
101
- }): PostgrestFilterBuilder<ClientOptions, Schema, Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record<string, unknown> ? Fn['Returns'][number] : never : never, Fn['Returns'], FnName, null, 'RPC'>;
102
- /**
103
- * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes.
104
- *
105
- * @param {string} name - The name of the Realtime channel.
106
- * @param {Object} opts - The options to pass to the Realtime channel.
107
- *
108
- */
109
- channel(name: string, opts?: RealtimeChannelOptions): RealtimeChannel;
110
- /**
111
- * Returns all Realtime channels.
112
- */
113
- getChannels(): RealtimeChannel[];
114
- /**
115
- * Unsubscribes and removes Realtime channel from Realtime client.
116
- *
117
- * @param {RealtimeChannel} channel - The name of the Realtime channel.
118
- *
119
- */
120
- removeChannel(channel: RealtimeChannel): Promise<'ok' | 'timed out' | 'error'>;
121
- /**
122
- * Unsubscribes and removes all Realtime channels from Realtime client.
123
- */
124
- removeAllChannels(): Promise<('ok' | 'timed out' | 'error')[]>;
125
- private _getAccessToken;
126
- private _initSupabaseAuthClient;
127
- private _initRealtimeClient;
128
- private _listenForAuthEvents;
129
- private _handleTokenChanged;
130
- }
131
- //# sourceMappingURL=SupabaseClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SupabaseClient.d.ts","sourceRoot":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