From 3cb884cc8c34ab8cb897d2e78d856a760020f4d6 Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo Date: Wed, 6 Nov 2024 16:52:53 +0800 Subject: [PATCH 1/6] Revert "Merge pull request #1300 from supabase/fix/revert-new-parser" This reverts commit 4c7f57197c0109b9393080db5971543347a6397a, reversing changes made to 963d6a5b075eb813b6fd5d4feded367e837235df. --- package-lock.json | 8 ++++---- package.json | 2 +- src/SupabaseClient.ts | 4 +++- src/lib/types.ts | 10 ++++++++++ test/index.test-d.ts | 7 +++++-- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99851b82..5f07dd4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@supabase/auth-js": "2.65.1", "@supabase/functions-js": "2.4.3", "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.16.3", + "@supabase/postgrest-js": "1.17.0", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, @@ -1196,9 +1196,9 @@ } }, "node_modules/@supabase/postgrest-js": { - "version": "1.16.3", - "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.16.3.tgz", - "integrity": "sha512-HI6dsbW68AKlOPofUjDTaosiDBCtW4XAm0D18pPwxoW3zKOE2Ru13Z69Wuys9fd6iTpfDViNco5sgrtnP0666A==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.0.tgz", + "integrity": "sha512-vbtb72VpyCkDjcD95SAW4C+3B6NNEICNlEN9H6LcSfIxk5qPImwZ9hVYLa20i+P8GXmKWDoSjjJEK2j6qlR1qQ==", "dependencies": { "@supabase/node-fetch": "^2.6.14" } diff --git a/package.json b/package.json index fb375584..980a117b 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@supabase/auth-js": "2.65.1", "@supabase/functions-js": "2.4.3", "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.16.3", + "@supabase/postgrest-js": "1.17.0", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, diff --git a/src/SupabaseClient.ts b/src/SupabaseClient.ts index 9f0a32c7..996685fb 100644 --- a/src/SupabaseClient.ts +++ b/src/SupabaseClient.ts @@ -221,7 +221,9 @@ export default class SupabaseClient< ? Fn['Returns'][number] : never : never, - Fn['Returns'] + Fn['Returns'], + FnName, + null > { return this.rest.rpc(fn, args, options) } diff --git a/src/lib/types.ts b/src/lib/types.ts index 85531a0e..0b8d3290 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -80,16 +80,26 @@ export type SupabaseClientOptions = { accessToken?: () => Promise } +export type GenericRelationship = { + foreignKeyName: string + columns: string[] + isOneToOne?: boolean + referencedRelation: string + referencedColumns: string[] +} + export type GenericTable = { Row: Record Insert: Record Update: Record + Relationships: GenericRelationship[] } export type GenericUpdatableView = GenericTable export type GenericNonUpdatableView = { Row: Record + Relationships: GenericRelationship[] } export type GenericView = GenericUpdatableView | GenericNonUpdatableView diff --git a/test/index.test-d.ts b/test/index.test-d.ts index 13a8df1d..672e4697 100644 --- a/test/index.test-d.ts +++ b/test/index.test-d.ts @@ -84,7 +84,7 @@ const supabase = createClient(URL, KEY) if (error) { throw new Error(error.message) } - expectType(message.user) + expectType(message.user) } // one-to-many relationship @@ -99,8 +99,11 @@ const supabase = createClient(URL, KEY) // referencing missing column { type SelectQueryError = { error: true } & Message + const res = await supabase.from('users').select('username, dat') - expectType[]>>(res) + expectType< + PostgrestSingleResponse[]> + >(res) } // one-to-one relationship From c6c42b603847fc1b6c4f3631357071b9a1d1c2dd Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo Date: Wed, 6 Nov 2024 16:55:21 +0800 Subject: [PATCH 2/6] fix: postgrest-js v1.17.3 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f07dd4d..5172904f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@supabase/auth-js": "2.65.1", "@supabase/functions-js": "2.4.3", "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.17.0", + "@supabase/postgrest-js": "1.17.3", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, @@ -1196,9 +1196,9 @@ } }, "node_modules/@supabase/postgrest-js": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.0.tgz", - "integrity": "sha512-vbtb72VpyCkDjcD95SAW4C+3B6NNEICNlEN9H6LcSfIxk5qPImwZ9hVYLa20i+P8GXmKWDoSjjJEK2j6qlR1qQ==", + "version": "1.17.3", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.3.tgz", + "integrity": "sha512-xR97C2D5XLU7x0yhFrx5d5NflZPplfcwQzeAT4i/YkWzkqgk0KT6Bz81WKzMDaTAhZd2YafMIazLJFGhc+6blQ==", "dependencies": { "@supabase/node-fetch": "^2.6.14" } diff --git a/package.json b/package.json index 980a117b..851742d1 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@supabase/auth-js": "2.65.1", "@supabase/functions-js": "2.4.3", "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.17.0", + "@supabase/postgrest-js": "1.17.3", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, From 64ac43bc084258ccaec57e7869aac05753bbb7d5 Mon Sep 17 00:00:00 2001 From: Andrew Valleteau Date: Wed, 13 Nov 2024 10:27:44 +0100 Subject: [PATCH 3/6] fix: bump postgrest-js to 1.17.4 (#1310) --- package-lock.json | 9 +++++---- package.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5172904f..ed7302ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@supabase/auth-js": "2.65.1", "@supabase/functions-js": "2.4.3", "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.17.3", + "@supabase/postgrest-js": "1.17.4", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, @@ -1196,9 +1196,10 @@ } }, "node_modules/@supabase/postgrest-js": { - "version": "1.17.3", - "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.3.tgz", - "integrity": "sha512-xR97C2D5XLU7x0yhFrx5d5NflZPplfcwQzeAT4i/YkWzkqgk0KT6Bz81WKzMDaTAhZd2YafMIazLJFGhc+6blQ==", + "version": "1.17.4", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.4.tgz", + "integrity": "sha512-01YIUhmPhn4JeYVSF/LTZa4EXpxRXGPjjkghCxRlbm52nOR5yWL6rporLw3ubirh40oT8cGRXOkJU3/mZ2+/pA==", + "license": "MIT", "dependencies": { "@supabase/node-fetch": "^2.6.14" } diff --git a/package.json b/package.json index 851742d1..5e94d150 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@supabase/auth-js": "2.65.1", "@supabase/functions-js": "2.4.3", "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.17.3", + "@supabase/postgrest-js": "1.17.4", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, From be41a744fd03ce4120eb2d371d17cbab5e3e95ff Mon Sep 17 00:00:00 2001 From: avallete Date: Wed, 13 Nov 2024 10:59:30 +0100 Subject: [PATCH 4/6] chore(deps): upgrade postgres-js to 1.17.5 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed7302ce..57b261b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@supabase/auth-js": "2.65.1", "@supabase/functions-js": "2.4.3", "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.17.4", + "@supabase/postgrest-js": "1.17.5", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, @@ -1196,9 +1196,9 @@ } }, "node_modules/@supabase/postgrest-js": { - "version": "1.17.4", - "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.4.tgz", - "integrity": "sha512-01YIUhmPhn4JeYVSF/LTZa4EXpxRXGPjjkghCxRlbm52nOR5yWL6rporLw3ubirh40oT8cGRXOkJU3/mZ2+/pA==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.5.tgz", + "integrity": "sha512-dq04qmKQoz5vH/sfBYvYJSyaNcYzdEkhl01qCFHhmr1c0CwLyVVOpUbfO+viUCBqvA04XrIwzSSp2oR+nBY9+Q==", "license": "MIT", "dependencies": { "@supabase/node-fetch": "^2.6.14" diff --git a/package.json b/package.json index 5e94d150..fdee1fe2 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@supabase/auth-js": "2.65.1", "@supabase/functions-js": "2.4.3", "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.17.4", + "@supabase/postgrest-js": "1.17.5", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, From 917cbf717c49a64b61528835f84a4466c32c3175 Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo <31685197+soedirgo@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:15:45 +0800 Subject: [PATCH 5/6] fix: cut release --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1163ef99..1b8f0c08 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ First of all, you need to install the library: npm install @supabase/supabase-js ``` + Then you're able to import the library and establish the connection with the database: ```js From e74067ce7c5eea68b60a7cf5bd54649ad41db1e7 Mon Sep 17 00:00:00 2001 From: avallete Date: Mon, 9 Dec 2024 14:49:22 +0100 Subject: [PATCH 6/6] chore: upgrade latest postgres-js --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3c73e694..92904d65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@supabase/auth-js": "2.66.1", "@supabase/functions-js": "2.4.3", "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.17.5", + "@supabase/postgrest-js": "1.17.7", "@supabase/realtime-js": "2.11.2", "@supabase/storage-js": "2.7.1" }, @@ -1196,9 +1196,9 @@ } }, "node_modules/@supabase/postgrest-js": { - "version": "1.17.5", - "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.5.tgz", - "integrity": "sha512-dq04qmKQoz5vH/sfBYvYJSyaNcYzdEkhl01qCFHhmr1c0CwLyVVOpUbfO+viUCBqvA04XrIwzSSp2oR+nBY9+Q==", + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.7.tgz", + "integrity": "sha512-aOzOYaTADm/dVTNksyqv9KsbhVa1gHz1Hoxb2ZEF2Ed9H7qlWOfptECQWmkEmrrFjtNaiPrgiSaPECvzI/seDA==", "license": "MIT", "dependencies": { "@supabase/node-fetch": "^2.6.14" diff --git a/package.json b/package.json index da0af60b..0b367c57 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@supabase/auth-js": "2.66.1", "@supabase/functions-js": "2.4.3", "@supabase/node-fetch": "2.6.15", - "@supabase/postgrest-js": "1.17.5", + "@supabase/postgrest-js": "1.17.7", "@supabase/realtime-js": "2.11.2", "@supabase/storage-js": "2.7.1" },