From 41c9bcc3b0d6cfaa18ccdca69dc36dc953dde7e4 Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo Date: Fri, 18 Oct 2024 15:29:59 +0800 Subject: [PATCH 1/6] feat: postgrest-js 1.17.0-rc.1 --- 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 289834f7..eaa7e18e 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.2", + "@supabase/postgrest-js": "1.17.0-rc.1", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, @@ -1196,9 +1196,9 @@ } }, "node_modules/@supabase/postgrest-js": { - "version": "1.16.2", - "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.16.2.tgz", - "integrity": "sha512-dA/CIrSO2YDQ6ABNpbvEg9DwBMMbuKfWaFuZAU9c66PenoLSoIoyXk1Yq/wC2XISgEIqaMHmTrDAAsO80kjHqg==", + "version": "1.17.0-rc.1", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.0-rc.1.tgz", + "integrity": "sha512-ssxkV6OrRApXjWYw4IqC5VLwploFPx7exBO4+YD2QoGddMnI9jKIB0r2oMAxFWw8sskQD1tVCLCKVf1g59Su+w==", "dependencies": { "@supabase/node-fetch": "^2.6.14" } diff --git a/package.json b/package.json index 7ed414ee..603417d5 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.2", + "@supabase/postgrest-js": "1.17.0-rc.1", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, From 59d1898c08d9f6637babf24d3d4a4d89588d99ff Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo Date: Fri, 18 Oct 2024 15:39:48 +0800 Subject: [PATCH 2/6] fix: update types --- src/lib/types.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 From e8e178c664e39efac127f6b67ab24b438abc2229 Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo Date: Fri, 18 Oct 2024 16:59:01 +0800 Subject: [PATCH 3/6] fix: update rpc types --- src/SupabaseClient.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) } From 3eda615e4e18b8bcb38fc62f1b90ae48a1c153bf Mon Sep 17 00:00:00 2001 From: Andrew Valleteau Date: Mon, 28 Oct 2024 17:09:31 +0100 Subject: [PATCH 4/6] fix: postgrest-js v1.17.0-rc.3 --- package-lock.json | 9 +++++---- package.json | 2 +- test/index.test-d.ts | 5 ++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index eaa7e18e..60bb046a 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-rc.1", + "@supabase/postgrest-js": "1.17.0-rc.3", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, @@ -1196,9 +1196,10 @@ } }, "node_modules/@supabase/postgrest-js": { - "version": "1.17.0-rc.1", - "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.0-rc.1.tgz", - "integrity": "sha512-ssxkV6OrRApXjWYw4IqC5VLwploFPx7exBO4+YD2QoGddMnI9jKIB0r2oMAxFWw8sskQD1tVCLCKVf1g59Su+w==", + "version": "1.17.0-rc.3", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.0-rc.3.tgz", + "integrity": "sha512-EAj7ZfFbK3eAIzRF9UoCDsmTFPEmBXE5j83v4R7GtZm4/yEYTnYLnztwLLt908vxivG0hQYbs05yrrH2AZkTPQ==", + "license": "MIT", "dependencies": { "@supabase/node-fetch": "^2.6.14" } diff --git a/package.json b/package.json index 603417d5..f22ac5c7 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-rc.1", + "@supabase/postgrest-js": "1.17.0-rc.3", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, diff --git a/test/index.test-d.ts b/test/index.test-d.ts index 13a8df1d..c70230f7 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 @@ -98,9 +98,8 @@ 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>(res) } // one-to-one relationship From e2c2206505f3c49ec6857bd0066fb31fb02e0535 Mon Sep 17 00:00:00 2001 From: Andrew Valleteau Date: Mon, 28 Oct 2024 18:41:50 +0100 Subject: [PATCH 5/6] fix: upgrade postgrest-js to rc.4 (#1296) --- package-lock.json | 8 ++++---- package.json | 2 +- test/index.test-d.ts | 6 +++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 60bb046a..1dfd2bd1 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-rc.3", + "@supabase/postgrest-js": "1.17.0-rc.4", "@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-rc.3", - "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.0-rc.3.tgz", - "integrity": "sha512-EAj7ZfFbK3eAIzRF9UoCDsmTFPEmBXE5j83v4R7GtZm4/yEYTnYLnztwLLt908vxivG0hQYbs05yrrH2AZkTPQ==", + "version": "1.17.0-rc.4", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.0-rc.4.tgz", + "integrity": "sha512-hEybGlZJzel3AnROiF/loYMx1eZpD6ETTYdoFN5BLM4mqcrONlmG9P+fD0OFvXdsnwcGjvKB9PDgTbYE545ToQ==", "license": "MIT", "dependencies": { "@supabase/node-fetch": "^2.6.14" diff --git a/package.json b/package.json index f22ac5c7..a22d40c8 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-rc.3", + "@supabase/postgrest-js": "1.17.0-rc.4", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, diff --git a/test/index.test-d.ts b/test/index.test-d.ts index c70230f7..672e4697 100644 --- a/test/index.test-d.ts +++ b/test/index.test-d.ts @@ -98,8 +98,12 @@ 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 d58bc984cd22ff8b0d3cf1bfe2589a0b7d6fa769 Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo Date: Tue, 29 Oct 2024 02:01:57 +0700 Subject: [PATCH 6/6] feat: postgrest-js 1.17.0 --- package-lock.json | 9 ++++----- package.json | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1dfd2bd1..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.17.0-rc.4", + "@supabase/postgrest-js": "1.17.0", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" }, @@ -1196,10 +1196,9 @@ } }, "node_modules/@supabase/postgrest-js": { - "version": "1.17.0-rc.4", - "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.17.0-rc.4.tgz", - "integrity": "sha512-hEybGlZJzel3AnROiF/loYMx1eZpD6ETTYdoFN5BLM4mqcrONlmG9P+fD0OFvXdsnwcGjvKB9PDgTbYE545ToQ==", - "license": "MIT", + "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 a22d40c8..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.17.0-rc.4", + "@supabase/postgrest-js": "1.17.0", "@supabase/realtime-js": "2.10.7", "@supabase/storage-js": "2.7.1" },