@supabase/supabase-js 2.55.0 → 2.56.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 +6 -0
- package/dist/main/SupabaseClient.d.ts +18 -6
- package/dist/main/SupabaseClient.d.ts.map +1 -1
- package/dist/main/SupabaseClient.js.map +1 -1
- package/dist/main/index.d.ts +12 -2
- 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 +18 -6
- package/dist/module/SupabaseClient.d.ts.map +1 -1
- package/dist/module/SupabaseClient.js.map +1 -1
- package/dist/module/index.d.ts +12 -2
- 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 +2 -2
- package/src/SupabaseClient.ts +38 -11
- package/src/index.ts +18 -8
- 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.
|
|
3
|
+
"version": "2.56.0",
|
|
4
4
|
"description": "Isomorphic Javascript client for Supabase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@supabase/auth-js": "2.71.1",
|
|
54
54
|
"@supabase/functions-js": "2.4.5",
|
|
55
55
|
"@supabase/node-fetch": "2.6.15",
|
|
56
|
-
"@supabase/postgrest-js": "1.
|
|
56
|
+
"@supabase/postgrest-js": "1.21.3",
|
|
57
57
|
"@supabase/realtime-js": "2.15.1",
|
|
58
58
|
"@supabase/storage-js": "^2.10.4"
|
|
59
59
|
},
|
package/src/SupabaseClient.ts
CHANGED
|
@@ -30,12 +30,36 @@ import { Fetch, GenericSchema, SupabaseClientOptions, SupabaseAuthClientOptions
|
|
|
30
30
|
*/
|
|
31
31
|
export default class SupabaseClient<
|
|
32
32
|
Database = any,
|
|
33
|
-
|
|
33
|
+
// The second type parameter is also used for specifying db_schema, so we
|
|
34
|
+
// support both cases.
|
|
35
|
+
// TODO: Allow setting db_schema from ClientOptions.
|
|
36
|
+
SchemaNameOrClientOptions extends
|
|
37
|
+
| (string & keyof Omit<Database, '__InternalSupabase'>)
|
|
38
|
+
| { PostgrestVersion: string } = 'public' extends keyof Omit<Database, '__InternalSupabase'>
|
|
34
39
|
? 'public'
|
|
35
|
-
: string & keyof Database,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
: string & keyof Omit<Database, '__InternalSupabase'>,
|
|
41
|
+
SchemaName extends string &
|
|
42
|
+
keyof Omit<Database, '__InternalSupabase'> = SchemaNameOrClientOptions extends string &
|
|
43
|
+
keyof Omit<Database, '__InternalSupabase'>
|
|
44
|
+
? SchemaNameOrClientOptions
|
|
45
|
+
: 'public' extends keyof Omit<Database, '__InternalSupabase'>
|
|
46
|
+
? 'public'
|
|
47
|
+
: string & keyof Omit<Omit<Database, '__InternalSupabase'>, '__InternalSupabase'>,
|
|
48
|
+
Schema extends Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema
|
|
49
|
+
? Omit<Database, '__InternalSupabase'>[SchemaName]
|
|
50
|
+
: never = Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema
|
|
51
|
+
? Omit<Database, '__InternalSupabase'>[SchemaName]
|
|
52
|
+
: never,
|
|
53
|
+
ClientOptions extends { PostgrestVersion: string } = SchemaNameOrClientOptions extends string &
|
|
54
|
+
keyof Omit<Database, '__InternalSupabase'>
|
|
55
|
+
? // If the version isn't explicitly set, look for it in the __InternalSupabase object to infer the right version
|
|
56
|
+
Database extends { __InternalSupabase: { PostgrestVersion: string } }
|
|
57
|
+
? Database['__InternalSupabase']
|
|
58
|
+
: // otherwise default to 12
|
|
59
|
+
{ PostgrestVersion: '12' }
|
|
60
|
+
: SchemaNameOrClientOptions extends { PostgrestVersion: string }
|
|
61
|
+
? SchemaNameOrClientOptions
|
|
62
|
+
: never
|
|
39
63
|
> {
|
|
40
64
|
/**
|
|
41
65
|
* Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies.
|
|
@@ -51,7 +75,7 @@ export default class SupabaseClient<
|
|
|
51
75
|
protected authUrl: URL
|
|
52
76
|
protected storageUrl: URL
|
|
53
77
|
protected functionsUrl: URL
|
|
54
|
-
protected rest: PostgrestClient<Database,
|
|
78
|
+
protected rest: PostgrestClient<Database, ClientOptions, SchemaName>
|
|
55
79
|
protected storageKey: string
|
|
56
80
|
protected fetch?: Fetch
|
|
57
81
|
protected changedAccessToken?: string
|
|
@@ -161,16 +185,16 @@ export default class SupabaseClient<
|
|
|
161
185
|
from<
|
|
162
186
|
TableName extends string & keyof Schema['Tables'],
|
|
163
187
|
Table extends Schema['Tables'][TableName]
|
|
164
|
-
>(relation: TableName): PostgrestQueryBuilder<Schema, Table, TableName>
|
|
188
|
+
>(relation: TableName): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName>
|
|
165
189
|
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(
|
|
166
190
|
relation: ViewName
|
|
167
|
-
): PostgrestQueryBuilder<Schema, View, ViewName>
|
|
191
|
+
): PostgrestQueryBuilder<ClientOptions, Schema, View, ViewName>
|
|
168
192
|
/**
|
|
169
193
|
* Perform a query on a table or a view.
|
|
170
194
|
*
|
|
171
195
|
* @param relation - The table or view name to query
|
|
172
196
|
*/
|
|
173
|
-
from(relation: string): PostgrestQueryBuilder<
|
|
197
|
+
from(relation: string): PostgrestQueryBuilder<ClientOptions, Schema, any> {
|
|
174
198
|
return this.rest.from(relation)
|
|
175
199
|
}
|
|
176
200
|
|
|
@@ -182,10 +206,11 @@ export default class SupabaseClient<
|
|
|
182
206
|
*
|
|
183
207
|
* @param schema - The schema to query
|
|
184
208
|
*/
|
|
185
|
-
schema<DynamicSchema extends string & keyof Database
|
|
209
|
+
schema<DynamicSchema extends string & keyof Omit<Database, '__InternalSupabase'>>(
|
|
186
210
|
schema: DynamicSchema
|
|
187
211
|
): PostgrestClient<
|
|
188
212
|
Database,
|
|
213
|
+
ClientOptions,
|
|
189
214
|
DynamicSchema,
|
|
190
215
|
Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any
|
|
191
216
|
> {
|
|
@@ -225,6 +250,7 @@ export default class SupabaseClient<
|
|
|
225
250
|
count?: 'exact' | 'planned' | 'estimated'
|
|
226
251
|
} = {}
|
|
227
252
|
): PostgrestFilterBuilder<
|
|
253
|
+
ClientOptions,
|
|
228
254
|
Schema,
|
|
229
255
|
Fn['Returns'] extends any[]
|
|
230
256
|
? Fn['Returns'][number] extends Record<string, unknown>
|
|
@@ -233,7 +259,8 @@ export default class SupabaseClient<
|
|
|
233
259
|
: never,
|
|
234
260
|
Fn['Returns'],
|
|
235
261
|
FnName,
|
|
236
|
-
null
|
|
262
|
+
null,
|
|
263
|
+
'RPC'
|
|
237
264
|
> {
|
|
238
265
|
return this.rest.rpc(fn, args, options)
|
|
239
266
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import SupabaseClient from './SupabaseClient'
|
|
2
|
-
import type {
|
|
2
|
+
import type { SupabaseClientOptions } from './lib/types'
|
|
3
3
|
|
|
4
4
|
export * from '@supabase/auth-js'
|
|
5
5
|
export type { User as AuthUser, Session as AuthSession } from '@supabase/auth-js'
|
|
@@ -26,18 +26,28 @@ export type { SupabaseClientOptions, QueryResult, QueryData, QueryError } from '
|
|
|
26
26
|
*/
|
|
27
27
|
export const createClient = <
|
|
28
28
|
Database = any,
|
|
29
|
-
|
|
29
|
+
SchemaNameOrClientOptions extends
|
|
30
|
+
| (string & keyof Omit<Database, '__InternalSupabase'>)
|
|
31
|
+
| { PostgrestVersion: string } = 'public' extends keyof Omit<Database, '__InternalSupabase'>
|
|
30
32
|
? 'public'
|
|
31
|
-
: string & keyof Database,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
: string & keyof Omit<Database, '__InternalSupabase'>,
|
|
34
|
+
SchemaName extends string &
|
|
35
|
+
keyof Omit<Database, '__InternalSupabase'> = SchemaNameOrClientOptions extends string &
|
|
36
|
+
keyof Omit<Database, '__InternalSupabase'>
|
|
37
|
+
? SchemaNameOrClientOptions
|
|
38
|
+
: 'public' extends keyof Omit<Database, '__InternalSupabase'>
|
|
39
|
+
? 'public'
|
|
40
|
+
: string & keyof Omit<Omit<Database, '__InternalSupabase'>, '__InternalSupabase'>
|
|
35
41
|
>(
|
|
36
42
|
supabaseUrl: string,
|
|
37
43
|
supabaseKey: string,
|
|
38
44
|
options?: SupabaseClientOptions<SchemaName>
|
|
39
|
-
): SupabaseClient<Database,
|
|
40
|
-
return new SupabaseClient<Database,
|
|
45
|
+
): SupabaseClient<Database, SchemaNameOrClientOptions, SchemaName> => {
|
|
46
|
+
return new SupabaseClient<Database, SchemaNameOrClientOptions, SchemaName>(
|
|
47
|
+
supabaseUrl,
|
|
48
|
+
supabaseKey,
|
|
49
|
+
options
|
|
50
|
+
)
|
|
41
51
|
}
|
|
42
52
|
|
|
43
53
|
// Check for Node.js <= 18 deprecation
|
package/src/lib/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.
|
|
1
|
+
export const version = '2.56.0'
|