Skip to content

Commit a1fa448

Browse files
filipecabacogrdsdevavalletehf
authored
fix: rebase master against next (#1499)
--------- Co-authored-by: Guilherme Souza <[email protected]> Co-authored-by: avallete <[email protected]> Co-authored-by: Andrew Valleteau <[email protected]> Co-authored-by: Stojan Dimitrovski <[email protected]>
1 parent cea0d4c commit a1fa448

File tree

8 files changed

+72
-142
lines changed

8 files changed

+72
-142
lines changed

package-lock.json

Lines changed: 30 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"test:watch": "jest --watch --verbose false --silent false",
4040
"test:node:playwright": "cd test/integration/node-browser && npm install && cp ../../../dist/umd/supabase.js . && npm run test",
4141
"test:bun": "cd test/integration/bun && bun install && bun test",
42-
"test:types": "run-s build:module && tsd --files test/types/*.test-d.ts",
42+
"test:types": "run-s build:module && tsd --files test/types/*.test-d.ts && jsr publish --dry-run",
4343
"docs": "typedoc --entryPoints src/index.ts --out docs/v2 --includes src/**/*.ts",
4444
"docs:json": "typedoc --entryPoints src/index.ts --includes src/**/*.ts --json docs/v2/spec.json --excludeExternals",
4545
"serve:coverage": "npm run test:coverage && serve test/coverage",
@@ -50,10 +50,10 @@
5050
"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"
5151
},
5252
"dependencies": {
53-
"@supabase/auth-js": "2.70.0",
53+
"@supabase/auth-js": "2.71.0",
5454
"@supabase/functions-js": "2.4.5",
5555
"@supabase/node-fetch": "2.6.15",
56-
"@supabase/postgrest-js": "1.21.0",
56+
"@supabase/postgrest-js": "1.19.4",
5757
"@supabase/realtime-js": "2.12.2",
5858
"@supabase/storage-js": "2.7.1"
5959
},
@@ -63,6 +63,7 @@
6363
"@types/jest": "^29.2.5",
6464
"husky": "^4.3.8",
6565
"jest": "^29.3.1",
66+
"jsr": "^0.13.5",
6667
"npm-run-all": "^4.1.5",
6768
"prettier": "^2.5.1",
6869
"pretty-quick": "^3.1.3",

pnpm-lock.yaml

Lines changed: 12 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/SupabaseClient.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {
44
PostgrestClient,
55
PostgrestFilterBuilder,
66
PostgrestQueryBuilder,
7-
ClientServerOptions as PostgrestClientServerOption,
8-
GetGenericDatabaseWithOptions,
97
} from '@supabase/postgrest-js'
108
import {
119
RealtimeChannel,
@@ -30,18 +28,13 @@ import { Fetch, GenericSchema, SupabaseClientOptions, SupabaseAuthClientOptions
3028
*
3129
* An isomorphic Javascript client for interacting with Postgres.
3230
*/
33-
34-
export type ServicesOptions = PostgrestClientServerOption & {}
35-
3631
export default class SupabaseClient<
3732
Database = any,
38-
ClientOptions extends ServicesOptions = { PostgrestVersion: '12' },
39-
SchemaName extends string &
40-
keyof GetGenericDatabaseWithOptions<Database>['db'] = 'public' extends keyof GetGenericDatabaseWithOptions<Database>['db']
33+
SchemaName extends string & keyof Database = 'public' extends keyof Database
4134
? 'public'
42-
: string & keyof GetGenericDatabaseWithOptions<Database>['db'],
43-
Schema extends GenericSchema = GetGenericDatabaseWithOptions<Database>['db'][SchemaName] extends GenericSchema
44-
? GetGenericDatabaseWithOptions<Database>['db'][SchemaName]
35+
: string & keyof Database,
36+
Schema extends GenericSchema = Database[SchemaName] extends GenericSchema
37+
? Database[SchemaName]
4538
: any
4639
> {
4740
/**
@@ -54,7 +47,7 @@ export default class SupabaseClient<
5447
protected authUrl: URL
5548
protected storageUrl: URL
5649
protected functionsUrl: URL
57-
protected rest: PostgrestClient<Database, ClientOptions, SchemaName, Schema>
50+
protected rest: PostgrestClient<Database, SchemaName, Schema>
5851
protected storageKey: string
5952
protected fetch?: Fetch
6053
protected changedAccessToken?: string
@@ -163,16 +156,16 @@ export default class SupabaseClient<
163156
from<
164157
TableName extends string & keyof Schema['Tables'],
165158
Table extends Schema['Tables'][TableName]
166-
>(relation: TableName): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName>
159+
>(relation: TableName): PostgrestQueryBuilder<Schema, Table, TableName>
167160
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(
168161
relation: ViewName
169-
): PostgrestQueryBuilder<ClientOptions, Schema, View, ViewName>
162+
): PostgrestQueryBuilder<Schema, View, ViewName>
170163
/**
171164
* Perform a query on a table or a view.
172165
*
173166
* @param relation - The table or view name to query
174167
*/
175-
from(relation: string): PostgrestQueryBuilder<ClientOptions, Schema, any, any> {
168+
from(relation: string): PostgrestQueryBuilder<Schema, any, any> {
176169
return this.rest.from(relation)
177170
}
178171

@@ -184,11 +177,10 @@ export default class SupabaseClient<
184177
*
185178
* @param schema - The schema to query
186179
*/
187-
schema<DynamicSchema extends string & keyof GetGenericDatabaseWithOptions<Database>['db']>(
180+
schema<DynamicSchema extends string & keyof Database>(
188181
schema: DynamicSchema
189182
): PostgrestClient<
190183
Database,
191-
ClientOptions,
192184
DynamicSchema,
193185
Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any
194186
> {
@@ -228,7 +220,6 @@ export default class SupabaseClient<
228220
count?: 'exact' | 'planned' | 'estimated'
229221
} = {}
230222
): PostgrestFilterBuilder<
231-
ClientOptions,
232223
Schema,
233224
Fn['Returns'] extends any[]
234225
? Fn['Returns'][number] extends Record<string, unknown>
@@ -237,8 +228,7 @@ export default class SupabaseClient<
237228
: never,
238229
Fn['Returns'],
239230
FnName,
240-
null,
241-
'RPC'
231+
null
242232
> {
243233
return this.rest.rpc(fn, args, options)
244234
}

src/index.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import SupabaseClient from './SupabaseClient'
22
import type { GenericSchema, SupabaseClientOptions } from './lib/types'
3-
import type { ServicesOptions } from './SupabaseClient'
4-
import type { GetGenericDatabaseWithOptions } from '@supabase/postgrest-js'
53

64
export * from '@supabase/auth-js'
75
export type { User as AuthUser, Session as AuthSession } from '@supabase/auth-js'
@@ -28,28 +26,16 @@ export type { SupabaseClientOptions, QueryResult, QueryData, QueryError } from '
2826
*/
2927
export const createClient = <
3028
Database = any,
31-
ClientOptions extends ServicesOptions = GetGenericDatabaseWithOptions<Database>['options'],
32-
SchemaName extends string &
33-
keyof GetGenericDatabaseWithOptions<Database>['db'] = 'public' extends keyof GetGenericDatabaseWithOptions<Database>['db']
29+
SchemaName extends string & keyof Database = 'public' extends keyof Database
3430
? 'public'
35-
: string & keyof GetGenericDatabaseWithOptions<Database>['db'],
36-
Schema = GetGenericDatabaseWithOptions<Database>['db'][SchemaName] extends GenericSchema
37-
? GetGenericDatabaseWithOptions<Database>['db'][SchemaName]
31+
: string & keyof Database,
32+
Schema extends GenericSchema = Database[SchemaName] extends GenericSchema
33+
? Database[SchemaName]
3834
: any
3935
>(
4036
supabaseUrl: string,
4137
supabaseKey: string,
4238
options?: SupabaseClientOptions<SchemaName>
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)
39+
): SupabaseClient<Database, SchemaName, Schema> => {
40+
return new SupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, options)
5541
}

test/deno/integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ Deno.test(
5959
const { error: deleteError } = await supabase
6060
.from('todos')
6161
.delete()
62-
.eq('id', createdTodo!.id as string)
62+
.eq('id', createdTodo!.id)
6363

6464
assertEquals(deleteError, null)
6565

6666
// Verify the todo was deleted
6767
const { data: fetchedTodo, error: fetchError } = await supabase
6868
.from('todos')
6969
.select('*')
70-
.eq('id', createdTodo!.id as string)
70+
.eq('id', createdTodo!.id)
7171
.single()
7272

7373
assertExists(fetchError)

0 commit comments

Comments
 (0)