@supabase/supabase-js 2.50.2 → 2.50.4
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 +41 -0
- package/dist/main/SupabaseClient.d.ts +10 -7
- package/dist/main/SupabaseClient.d.ts.map +1 -1
- package/dist/main/SupabaseClient.js +0 -5
- package/dist/main/SupabaseClient.js.map +1 -1
- package/dist/main/index.d.ts +14 -1
- package/dist/main/index.d.ts.map +1 -1
- package/dist/main/index.js.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 +10 -7
- package/dist/module/SupabaseClient.d.ts.map +1 -1
- package/dist/module/SupabaseClient.js +0 -5
- package/dist/module/SupabaseClient.js.map +1 -1
- package/dist/module/index.d.ts +14 -1
- package/dist/module/index.d.ts.map +1 -1
- package/dist/module/index.js.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 +11 -4
- package/src/SupabaseClient.ts +20 -10
- package/src/index.ts +20 -6
- 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.50.
|
|
3
|
+
"version": "2.50.4",
|
|
4
4
|
"description": "Isomorphic Javascript client for Supabase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -36,16 +36,23 @@
|
|
|
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
38
|
"test:watch": "jest --watch --verbose false --silent false",
|
|
39
|
+
"test:node:playwright": "cd test/integration/node-browser && npm install && cp ../../../dist/umd/supabase.js . && npm run test",
|
|
40
|
+
"test:bun": "cd test/integration/bun && bun install && bun test",
|
|
39
41
|
"test:types": "run-s build:module && tsd --files test/types/*.test-d.ts",
|
|
40
42
|
"docs": "typedoc --entryPoints src/index.ts --out docs/v2 --includes src/**/*.ts",
|
|
41
43
|
"docs:json": "typedoc --entryPoints src/index.ts --includes src/**/*.ts --json docs/v2/spec.json --excludeExternals",
|
|
42
|
-
"serve:coverage": "npm run test:coverage && serve test/coverage"
|
|
44
|
+
"serve:coverage": "npm run test:coverage && serve test/coverage",
|
|
45
|
+
"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",
|
|
46
|
+
"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",
|
|
47
|
+
"update:test-deps:next": "npm run build && 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",
|
|
48
|
+
"update:test-deps:deno": "npm run build && npm pack && cp supabase-supabase-js-*.tgz test/deno/supabase-supabase-js-0.0.0-automated.tgz && cd test/deno && npm install",
|
|
49
|
+
"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"
|
|
43
50
|
},
|
|
44
51
|
"dependencies": {
|
|
45
52
|
"@supabase/auth-js": "2.70.0",
|
|
46
|
-
"@supabase/functions-js": "2.4.
|
|
53
|
+
"@supabase/functions-js": "2.4.5",
|
|
47
54
|
"@supabase/node-fetch": "2.6.15",
|
|
48
|
-
"@supabase/postgrest-js": "1.
|
|
55
|
+
"@supabase/postgrest-js": "1.21.0",
|
|
49
56
|
"@supabase/realtime-js": "2.11.15",
|
|
50
57
|
"@supabase/storage-js": "2.7.1"
|
|
51
58
|
},
|
package/src/SupabaseClient.ts
CHANGED
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
PostgrestClient,
|
|
5
5
|
PostgrestFilterBuilder,
|
|
6
6
|
PostgrestQueryBuilder,
|
|
7
|
+
ClientServerOptions as PostgrestClientServerOption,
|
|
8
|
+
GetGenericDatabaseWithOptions,
|
|
7
9
|
} from '@supabase/postgrest-js'
|
|
8
10
|
import {
|
|
9
11
|
RealtimeChannel,
|
|
@@ -28,13 +30,18 @@ import { Fetch, GenericSchema, SupabaseClientOptions, SupabaseAuthClientOptions
|
|
|
28
30
|
*
|
|
29
31
|
* An isomorphic Javascript client for interacting with Postgres.
|
|
30
32
|
*/
|
|
33
|
+
|
|
34
|
+
export type ServicesOptions = PostgrestClientServerOption & {}
|
|
35
|
+
|
|
31
36
|
export default class SupabaseClient<
|
|
32
37
|
Database = any,
|
|
33
|
-
|
|
38
|
+
ClientOptions extends ServicesOptions = { PostgrestVersion: '12' },
|
|
39
|
+
SchemaName extends string &
|
|
40
|
+
keyof GetGenericDatabaseWithOptions<Database>['db'] = 'public' extends keyof GetGenericDatabaseWithOptions<Database>['db']
|
|
34
41
|
? 'public'
|
|
35
|
-
: string & keyof Database,
|
|
36
|
-
Schema extends GenericSchema = Database[SchemaName] extends GenericSchema
|
|
37
|
-
? Database[SchemaName]
|
|
42
|
+
: string & keyof GetGenericDatabaseWithOptions<Database>['db'],
|
|
43
|
+
Schema extends GenericSchema = GetGenericDatabaseWithOptions<Database>['db'][SchemaName] extends GenericSchema
|
|
44
|
+
? GetGenericDatabaseWithOptions<Database>['db'][SchemaName]
|
|
38
45
|
: any
|
|
39
46
|
> {
|
|
40
47
|
/**
|
|
@@ -47,7 +54,7 @@ export default class SupabaseClient<
|
|
|
47
54
|
protected authUrl: URL
|
|
48
55
|
protected storageUrl: URL
|
|
49
56
|
protected functionsUrl: URL
|
|
50
|
-
protected rest: PostgrestClient<Database, SchemaName, Schema>
|
|
57
|
+
protected rest: PostgrestClient<Database, ClientOptions, SchemaName, Schema>
|
|
51
58
|
protected storageKey: string
|
|
52
59
|
protected fetch?: Fetch
|
|
53
60
|
protected changedAccessToken?: string
|
|
@@ -156,16 +163,16 @@ export default class SupabaseClient<
|
|
|
156
163
|
from<
|
|
157
164
|
TableName extends string & keyof Schema['Tables'],
|
|
158
165
|
Table extends Schema['Tables'][TableName]
|
|
159
|
-
>(relation: TableName): PostgrestQueryBuilder<Schema, Table, TableName>
|
|
166
|
+
>(relation: TableName): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName>
|
|
160
167
|
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(
|
|
161
168
|
relation: ViewName
|
|
162
|
-
): PostgrestQueryBuilder<Schema, View, ViewName>
|
|
169
|
+
): PostgrestQueryBuilder<ClientOptions, Schema, View, ViewName>
|
|
163
170
|
/**
|
|
164
171
|
* Perform a query on a table or a view.
|
|
165
172
|
*
|
|
166
173
|
* @param relation - The table or view name to query
|
|
167
174
|
*/
|
|
168
|
-
from(relation: string): PostgrestQueryBuilder<Schema, any, any> {
|
|
175
|
+
from(relation: string): PostgrestQueryBuilder<ClientOptions, Schema, any, any> {
|
|
169
176
|
return this.rest.from(relation)
|
|
170
177
|
}
|
|
171
178
|
|
|
@@ -177,10 +184,11 @@ export default class SupabaseClient<
|
|
|
177
184
|
*
|
|
178
185
|
* @param schema - The schema to query
|
|
179
186
|
*/
|
|
180
|
-
schema<DynamicSchema extends string & keyof Database>(
|
|
187
|
+
schema<DynamicSchema extends string & keyof GetGenericDatabaseWithOptions<Database>['db']>(
|
|
181
188
|
schema: DynamicSchema
|
|
182
189
|
): PostgrestClient<
|
|
183
190
|
Database,
|
|
191
|
+
ClientOptions,
|
|
184
192
|
DynamicSchema,
|
|
185
193
|
Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any
|
|
186
194
|
> {
|
|
@@ -220,6 +228,7 @@ export default class SupabaseClient<
|
|
|
220
228
|
count?: 'exact' | 'planned' | 'estimated'
|
|
221
229
|
} = {}
|
|
222
230
|
): PostgrestFilterBuilder<
|
|
231
|
+
ClientOptions,
|
|
223
232
|
Schema,
|
|
224
233
|
Fn['Returns'] extends any[]
|
|
225
234
|
? Fn['Returns'][number] extends Record<string, unknown>
|
|
@@ -228,7 +237,8 @@ export default class SupabaseClient<
|
|
|
228
237
|
: never,
|
|
229
238
|
Fn['Returns'],
|
|
230
239
|
FnName,
|
|
231
|
-
null
|
|
240
|
+
null,
|
|
241
|
+
'RPC'
|
|
232
242
|
> {
|
|
233
243
|
return this.rest.rpc(fn, args, options)
|
|
234
244
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import SupabaseClient from './SupabaseClient'
|
|
2
2
|
import type { GenericSchema, SupabaseClientOptions } from './lib/types'
|
|
3
|
+
import type { ServicesOptions } from './SupabaseClient'
|
|
4
|
+
import type { GetGenericDatabaseWithOptions } from '@supabase/postgrest-js'
|
|
3
5
|
|
|
4
6
|
export * from '@supabase/auth-js'
|
|
5
7
|
export type { User as AuthUser, Session as AuthSession } from '@supabase/auth-js'
|
|
@@ -26,16 +28,28 @@ export type { SupabaseClientOptions, QueryResult, QueryData, QueryError } from '
|
|
|
26
28
|
*/
|
|
27
29
|
export const createClient = <
|
|
28
30
|
Database = any,
|
|
29
|
-
|
|
31
|
+
ClientOptions extends ServicesOptions = GetGenericDatabaseWithOptions<Database>['options'],
|
|
32
|
+
SchemaName extends string &
|
|
33
|
+
keyof GetGenericDatabaseWithOptions<Database>['db'] = 'public' extends keyof GetGenericDatabaseWithOptions<Database>['db']
|
|
30
34
|
? 'public'
|
|
31
|
-
: string & keyof Database,
|
|
32
|
-
Schema
|
|
33
|
-
? Database[SchemaName]
|
|
35
|
+
: string & keyof GetGenericDatabaseWithOptions<Database>['db'],
|
|
36
|
+
Schema = GetGenericDatabaseWithOptions<Database>['db'][SchemaName] extends GenericSchema
|
|
37
|
+
? GetGenericDatabaseWithOptions<Database>['db'][SchemaName]
|
|
34
38
|
: any
|
|
35
39
|
>(
|
|
36
40
|
supabaseUrl: string,
|
|
37
41
|
supabaseKey: string,
|
|
38
42
|
options?: SupabaseClientOptions<SchemaName>
|
|
39
|
-
): SupabaseClient<
|
|
40
|
-
|
|
43
|
+
): SupabaseClient<
|
|
44
|
+
Database,
|
|
45
|
+
ClientOptions,
|
|
46
|
+
SchemaName,
|
|
47
|
+
Schema extends GenericSchema ? Schema : any
|
|
48
|
+
> => {
|
|
49
|
+
return new SupabaseClient<
|
|
50
|
+
Database,
|
|
51
|
+
ClientOptions,
|
|
52
|
+
SchemaName,
|
|
53
|
+
Schema extends GenericSchema ? Schema : any
|
|
54
|
+
>(supabaseUrl, supabaseKey, options)
|
|
41
55
|
}
|
package/src/lib/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.50.
|
|
1
|
+
export const version = '2.50.4'
|