From c2bb45d5b665fe11d4b129ec73be405e7f84d240 Mon Sep 17 00:00:00 2001 From: avallete Date: Mon, 20 Oct 2025 11:57:14 +0200 Subject: [PATCH 1/3] chore(postgrest): bump postgres-meta to 0.92.0 enable tests --- .../postgrest-js/test/advanced_rpc.test.ts | 89 +-- .../postgrest-js/test/db/docker-compose.yml | 2 +- .../test/embeded_functions_join.test.ts | 68 +- .../core/postgrest-js/test/types.generated.ts | 745 +++++++++++------- 4 files changed, 520 insertions(+), 384 deletions(-) diff --git a/packages/core/postgrest-js/test/advanced_rpc.test.ts b/packages/core/postgrest-js/test/advanced_rpc.test.ts index fbbc145b4..73942b131 100644 --- a/packages/core/postgrest-js/test/advanced_rpc.test.ts +++ b/packages/core/postgrest-js/test/advanced_rpc.test.ts @@ -1,9 +1,9 @@ -import { PostgrestClient } from '../src/index' -import { Database } from './types.override' -import { TypeEqual, expectType } from './types' -import { SelectQueryError } from '../src/select-query-parser/utils' +import type { RequiredDeep } from 'type-fest' import { z } from 'zod' -import { RequiredDeep } from 'type-fest' +import { PostgrestClient } from '../src/index' +import type { SelectQueryError } from '../src/select-query-parser/utils' +import { expectType, type TypeEqual } from './types' +import type { Database } from './types.override' const REST_URL = 'http://localhost:3000' const postgrest = new PostgrestClient(REST_URL) @@ -442,8 +442,7 @@ describe('advanced rpc', () => { .select('channel_id, message, users(username, catchphrase)') let result: Exclude let expected: RequiredDeep>[] - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -503,8 +502,7 @@ describe('advanced rpc', () => { .select('id, username, users(username, catchphrase)') let result: Exclude let expected: RequiredDeep> - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -547,8 +545,7 @@ describe('advanced rpc', () => { let result: Exclude // Should be an error response due to ambiguous function resolution let expected: SelectQueryError<'Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved'> - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -572,8 +569,7 @@ describe('advanced rpc', () => { let result: Exclude // Should be an error response due to ambiguous function resolution let expected: SelectQueryError<'Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved'> - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -612,8 +608,7 @@ describe('advanced rpc', () => { }) let result: Exclude let expected: number - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -631,8 +626,7 @@ describe('advanced rpc', () => { }) let result: Exclude let expected: string - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -650,8 +644,7 @@ describe('advanced rpc', () => { }) let result: Exclude let expected: z.infer[] - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -677,8 +670,7 @@ describe('advanced rpc', () => { let result: Exclude const ExpectedSchema = z.array(MessagesWithoutBlurbSchema) let expected: RequiredDeep> - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -712,8 +704,7 @@ describe('advanced rpc', () => { let result: Exclude const ExpectedSchema = z.array(MessagesWithoutBlurbSchema) let expected: RequiredDeep> - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -761,8 +752,7 @@ describe('advanced rpc', () => { }) let result: Exclude let expected: string - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -776,12 +766,9 @@ describe('advanced rpc', () => { test('polymorphic function with bool param', async () => { const res = await postgrest.rpc('polymorphic_function_with_different_return', { - // TODO: works with latest postgrest-meta type introspection - ////@ts-expect-error Type 'boolean' is not assignable to type 'string' + // @ts-expect-error Type 'boolean' is not assignable to type 'string' '': true, }) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -795,8 +782,7 @@ describe('advanced rpc', () => { test('polymorphic function with unnamed int param', async () => { const res = await postgrest.rpc( - // TODO: works with latest postgrest-meta type introspection - ////@ts-expect-error Argument of type '"polymorphic_function_with_unnamed_integer"' is not assignable to parameter of type '"blurb_message" | "function_returning_row" | "function_returning_set_of_rows" + // @ts-expect-error Argument of type '"polymorphic_function_with_unnamed_integer"' is not assignable to parameter of type '"blurb_message" | "function_returning_row" | "function_returning_set_of_rows" 'polymorphic_function_with_unnamed_integer', { '': 1, @@ -894,8 +880,7 @@ describe('advanced rpc', () => { }) let result: Exclude let expected: string - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -913,8 +898,7 @@ describe('advanced rpc', () => { }) let result: Exclude let expected: string - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -930,8 +914,7 @@ describe('advanced rpc', () => { const res = await postgrest.rpc('polymorphic_function_with_unnamed_default') let result: Exclude let expected: SelectQueryError<'Could not choose the best candidate function between: public.polymorphic_function_with_unnamed_default(), public.polymorphic_function_with_unnamed_default( => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved'> - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -977,8 +960,7 @@ describe('advanced rpc', () => { }) let result: Exclude let expected: string - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -994,8 +976,7 @@ describe('advanced rpc', () => { const res = await postgrest.rpc('polymorphic_function_with_unnamed_default_overload') let result: Exclude let expected: SelectQueryError<'Could not choose the best candidate function between: public.polymorphic_function_with_unnamed_default_overload(), public.polymorphic_function_with_unnamed_default_overload( => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved'> - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -1041,8 +1022,7 @@ describe('advanced rpc', () => { }) let result: Exclude let expected: string - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -1056,14 +1036,12 @@ describe('advanced rpc', () => { test('polymorphic function with unnamed default overload bool param', async () => { const res = await postgrest.rpc('polymorphic_function_with_unnamed_default_overload', { - // TODO: works with latest postgrest-meta type introspection - ////@ts-expect-error Type 'boolean' is not assignable to type 'string' + // @ts-expect-error Type 'boolean' is not assignable to type 'string' '': true, }) let result: Exclude let expected: string - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -1078,9 +1056,8 @@ describe('advanced rpc', () => { test('function with blurb_message', async () => { const res = await postgrest.rpc('blurb_message') let result: Exclude - let expected: never - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + let expected: SelectQueryError<'the function public.blurb_message with parameter or with a single unnamed json/jsonb parameter, but no matches were found in the schema cache'> + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -1110,8 +1087,7 @@ describe('advanced rpc', () => { }) let result: Exclude let expected: SelectQueryError<'the function public.blurb_message with parameter or with a single unnamed json/jsonb parameter, but no matches were found in the schema cache'> - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) expect(res).toMatchInlineSnapshot(` Object { "count": null, @@ -1275,7 +1251,7 @@ describe('advanced rpc', () => { test('should be able to filter before and after select rpc', async () => { const res = await postgrest .rpc('get_user_profile', { - //@ts-expect-error Type '{ username: string; }' is missing the following properties from type '{ age_range: unknown; catchphrase: unknown; data: unknown; status: "ONLINE" | "OFFLINE" | null; username: string; }': age_range, catchphrase, data, status + // @ts-expect-error Type '{ username: string; }' is missing the following properties from type '{ age_range: unknown; catchphrase: unknown; data: unknown; status: "ONLINE" | "OFFLINE" | null; username: string; }': age_range, catchphrase, data, status user_row: { username: 'supabot' }, }) .select('id, username, users(username, catchphrase)') @@ -1292,7 +1268,7 @@ test('should be able to filter before and after select rpc', async () => { `) const res2 = await postgrest .rpc('get_user_profile', { - //@ts-expect-error Type '{ username: string; }' is missing the following properties from type + // @ts-expect-error Type '{ username: string; }' is missing the following properties from type user_row: { username: 'supabot' }, }) // should also be able to fitler before the select @@ -1310,7 +1286,7 @@ test('should be able to filter before and after select rpc', async () => { `) const res3 = await postgrest .rpc('get_user_profile', { - //@ts-expect-error Type '{ username: string; }' is missing the following properties from type + // @ts-expect-error Type '{ username: string; }' is missing the following properties from type user_row: { username: 'supabot' }, }) // should also be able to fitler before the select @@ -1374,7 +1350,6 @@ test('RPC call with subselect and computed field', async () => { }) ) let expected: z.infer - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) diff --git a/packages/core/postgrest-js/test/db/docker-compose.yml b/packages/core/postgrest-js/test/db/docker-compose.yml index c69a68e2e..7d2818653 100644 --- a/packages/core/postgrest-js/test/db/docker-compose.yml +++ b/packages/core/postgrest-js/test/db/docker-compose.yml @@ -39,7 +39,7 @@ services: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres pgmeta: - image: supabase/postgres-meta:v0.91.5 + image: supabase/postgres-meta:v0.92.0 ports: - '8080:8080' environment: diff --git a/packages/core/postgrest-js/test/embeded_functions_join.test.ts b/packages/core/postgrest-js/test/embeded_functions_join.test.ts index 3c63b20fa..1a69cae91 100644 --- a/packages/core/postgrest-js/test/embeded_functions_join.test.ts +++ b/packages/core/postgrest-js/test/embeded_functions_join.test.ts @@ -1,8 +1,8 @@ -import { PostgrestClient } from '../src/index' -import { Database } from './types.override' -import { expectType, TypeEqual } from './types' +import type { RequiredDeep } from 'type-fest' import { z } from 'zod' -import { RequiredDeep } from 'type-fest' +import { PostgrestClient } from '../src/index' +import { expectType, type TypeEqual } from './types' +import type { Database } from './types.override' const REST_URL = 'http://localhost:3000' const postgrest = new PostgrestClient(REST_URL) @@ -75,8 +75,7 @@ describe('embeded functions select', () => { // Assert over the keys of the expected and result objects to ensure consistency between versions of types // should always fallback to a SelectQueryError if the relation cannot be found expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -135,8 +134,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -211,8 +209,7 @@ describe('embeded functions select', () => { ) let expected: RequiredDeep> expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -277,8 +274,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -347,8 +343,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -403,8 +398,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -469,8 +463,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -512,8 +505,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) // Can parse the data because the !inner ensure the join result from function is not nullable ExpectedSchema.parse(res.data) }) @@ -573,8 +565,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -649,8 +640,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -725,8 +715,7 @@ describe('embeded functions select', () => { ) let expected: RequiredDeep> expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -799,8 +788,7 @@ describe('embeded functions select', () => { ) let expected: RequiredDeep> expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -877,8 +865,7 @@ describe('embeded functions select', () => { ) let expected: RequiredDeep> expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -951,8 +938,7 @@ describe('embeded functions select', () => { ) let expected: RequiredDeep> expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -1021,8 +1007,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -1044,8 +1029,7 @@ describe('embeded functions select', () => { `) let result: Exclude let expected: never[] - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) }) test('embeded_function_returning_single_row - can embed single row returns function with row single param', async () => { @@ -1095,8 +1079,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -1120,8 +1103,7 @@ describe('embeded functions select', () => { `) let result: Exclude let expected: never[] - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) }) test('function_using_setof_rows_one', async () => { @@ -1185,8 +1167,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) @@ -1241,8 +1222,7 @@ describe('embeded functions select', () => { ) let expected: z.infer expectType>(true) - // TODO: works with latest postgrest-meta type introspection - // expectType>(true) + expectType>(true) ExpectedSchema.parse(res.data) }) }) diff --git a/packages/core/postgrest-js/test/types.generated.ts b/packages/core/postgrest-js/test/types.generated.ts index ea731f970..de4f725e1 100644 --- a/packages/core/postgrest-js/test/types.generated.ts +++ b/packages/core/postgrest-js/test/types.generated.ts @@ -1,25 +1,25 @@ -export type Json = unknown +export type Json = unknown; export type Database = { personal: { Tables: { users: { Row: { - age_range: unknown | null + age_range: unknown data: Json | null - status: Database['personal']['Enums']['user_status'] | null + status: Database["personal"]["Enums"]["user_status"] | null username: string } Insert: { - age_range?: unknown | null + age_range?: unknown data?: Json | null - status?: Database['personal']['Enums']['user_status'] | null + status?: Database["personal"]["Enums"]["user_status"] | null username: string } Update: { - age_range?: unknown | null + age_range?: unknown data?: Json | null - status?: Database['personal']['Enums']['user_status'] | null + status?: Database["personal"]["Enums"]["user_status"] | null username?: string } Relationships: [] @@ -31,11 +31,11 @@ export type Database = { Functions: { get_status: { Args: { name_param: string } - Returns: Database['personal']['Enums']['user_status'] + Returns: Database["personal"]["Enums"]["user_status"] } } Enums: { - user_status: 'ONLINE' | 'OFFLINE' + user_status: "ONLINE" | "OFFLINE" } CompositeTypes: { [_ in never]: never @@ -64,88 +64,88 @@ export type Database = { } Relationships: [ { - foreignKeyName: 'best_friends_first_user_fkey' - columns: ['first_user'] + foreignKeyName: "best_friends_first_user_fkey" + columns: ["first_user"] isOneToOne: false - referencedRelation: 'active_users' - referencedColumns: ['username'] + referencedRelation: "active_users" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_first_user_fkey' - columns: ['first_user'] + foreignKeyName: "best_friends_first_user_fkey" + columns: ["first_user"] isOneToOne: false - referencedRelation: 'non_updatable_view' - referencedColumns: ['username'] + referencedRelation: "non_updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_first_user_fkey' - columns: ['first_user'] + foreignKeyName: "best_friends_first_user_fkey" + columns: ["first_user"] isOneToOne: false - referencedRelation: 'updatable_view' - referencedColumns: ['username'] + referencedRelation: "updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_first_user_fkey' - columns: ['first_user'] + foreignKeyName: "best_friends_first_user_fkey" + columns: ["first_user"] isOneToOne: false - referencedRelation: 'users' - referencedColumns: ['username'] + referencedRelation: "users" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_second_user_fkey' - columns: ['second_user'] + foreignKeyName: "best_friends_second_user_fkey" + columns: ["second_user"] isOneToOne: false - referencedRelation: 'active_users' - referencedColumns: ['username'] + referencedRelation: "active_users" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_second_user_fkey' - columns: ['second_user'] + foreignKeyName: "best_friends_second_user_fkey" + columns: ["second_user"] isOneToOne: false - referencedRelation: 'non_updatable_view' - referencedColumns: ['username'] + referencedRelation: "non_updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_second_user_fkey' - columns: ['second_user'] + foreignKeyName: "best_friends_second_user_fkey" + columns: ["second_user"] isOneToOne: false - referencedRelation: 'updatable_view' - referencedColumns: ['username'] + referencedRelation: "updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_second_user_fkey' - columns: ['second_user'] + foreignKeyName: "best_friends_second_user_fkey" + columns: ["second_user"] isOneToOne: false - referencedRelation: 'users' - referencedColumns: ['username'] + referencedRelation: "users" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_third_wheel_fkey' - columns: ['third_wheel'] + foreignKeyName: "best_friends_third_wheel_fkey" + columns: ["third_wheel"] isOneToOne: false - referencedRelation: 'active_users' - referencedColumns: ['username'] + referencedRelation: "active_users" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_third_wheel_fkey' - columns: ['third_wheel'] + foreignKeyName: "best_friends_third_wheel_fkey" + columns: ["third_wheel"] isOneToOne: false - referencedRelation: 'non_updatable_view' - referencedColumns: ['username'] + referencedRelation: "non_updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_third_wheel_fkey' - columns: ['third_wheel'] + foreignKeyName: "best_friends_third_wheel_fkey" + columns: ["third_wheel"] isOneToOne: false - referencedRelation: 'updatable_view' - referencedColumns: ['username'] + referencedRelation: "updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'best_friends_third_wheel_fkey' - columns: ['third_wheel'] + foreignKeyName: "best_friends_third_wheel_fkey" + columns: ["third_wheel"] isOneToOne: false - referencedRelation: 'users' - referencedColumns: ['username'] + referencedRelation: "users" + referencedColumns: ["username"] }, ] } @@ -164,11 +164,11 @@ export type Database = { } Relationships: [ { - foreignKeyName: 'booking_hotel_id_fkey' - columns: ['hotel_id'] + foreignKeyName: "booking_hotel_id_fkey" + columns: ["hotel_id"] isOneToOne: false - referencedRelation: 'hotel' - referencedColumns: ['id'] + referencedRelation: "hotel" + referencedColumns: ["id"] }, ] } @@ -205,11 +205,11 @@ export type Database = { } Relationships: [ { - foreignKeyName: 'channel_details_id_fkey' - columns: ['id'] + foreignKeyName: "channel_details_id_fkey" + columns: ["id"] isOneToOne: true - referencedRelation: 'channels' - referencedColumns: ['id'] + referencedRelation: "channels" + referencedColumns: ["id"] }, ] } @@ -249,28 +249,28 @@ export type Database = { } Relationships: [ { - foreignKeyName: 'collections_parent_id_fkey' - columns: ['parent_id'] + foreignKeyName: "collections_parent_id_fkey" + columns: ["parent_id"] isOneToOne: false - referencedRelation: 'collections' - referencedColumns: ['id'] + referencedRelation: "collections" + referencedColumns: ["id"] }, ] } cornercase: { Row: { array_column: string[] | null - 'column whitespace': string | null + "column whitespace": string | null id: number } Insert: { array_column?: string[] | null - 'column whitespace'?: string | null + "column whitespace"?: string | null id: number } Update: { array_column?: string[] | null - 'column whitespace'?: string | null + "column whitespace"?: string | null id?: number } Relationships: [] @@ -315,39 +315,39 @@ export type Database = { } Relationships: [ { - foreignKeyName: 'messages_channel_id_fkey' - columns: ['channel_id'] + foreignKeyName: "messages_channel_id_fkey" + columns: ["channel_id"] isOneToOne: false - referencedRelation: 'channels' - referencedColumns: ['id'] + referencedRelation: "channels" + referencedColumns: ["id"] }, { - foreignKeyName: 'messages_username_fkey' - columns: ['username'] + foreignKeyName: "messages_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'active_users' - referencedColumns: ['username'] + referencedRelation: "active_users" + referencedColumns: ["username"] }, { - foreignKeyName: 'messages_username_fkey' - columns: ['username'] + foreignKeyName: "messages_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'non_updatable_view' - referencedColumns: ['username'] + referencedRelation: "non_updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'messages_username_fkey' - columns: ['username'] + foreignKeyName: "messages_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'updatable_view' - referencedColumns: ['username'] + referencedRelation: "updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'messages_username_fkey' - columns: ['username'] + foreignKeyName: "messages_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'users' - referencedColumns: ['username'] + referencedRelation: "users" + referencedColumns: ["username"] }, ] } @@ -366,18 +366,18 @@ export type Database = { } Relationships: [ { - foreignKeyName: 'product_categories_category_id_fkey' - columns: ['category_id'] + foreignKeyName: "product_categories_category_id_fkey" + columns: ["category_id"] isOneToOne: false - referencedRelation: 'categories' - referencedColumns: ['id'] + referencedRelation: "categories" + referencedColumns: ["id"] }, { - foreignKeyName: 'product_categories_product_id_fkey' - columns: ['product_id'] + foreignKeyName: "product_categories_product_id_fkey" + columns: ["product_id"] isOneToOne: false - referencedRelation: 'products' - referencedColumns: ['id'] + referencedRelation: "products" + referencedColumns: ["id"] }, ] } @@ -406,17 +406,17 @@ export type Database = { Row: { address: string | null id: number - shop_geom: unknown | null + shop_geom: unknown } Insert: { address?: string | null id: number - shop_geom?: unknown | null + shop_geom?: unknown } Update: { address?: string | null id?: number - shop_geom?: unknown | null + shop_geom?: unknown } Relationships: [] } @@ -435,55 +435,55 @@ export type Database = { } Relationships: [ { - foreignKeyName: 'user_profiles_username_fkey' - columns: ['username'] + foreignKeyName: "user_profiles_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'active_users' - referencedColumns: ['username'] + referencedRelation: "active_users" + referencedColumns: ["username"] }, { - foreignKeyName: 'user_profiles_username_fkey' - columns: ['username'] + foreignKeyName: "user_profiles_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'non_updatable_view' - referencedColumns: ['username'] + referencedRelation: "non_updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'user_profiles_username_fkey' - columns: ['username'] + foreignKeyName: "user_profiles_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'updatable_view' - referencedColumns: ['username'] + referencedRelation: "updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'user_profiles_username_fkey' - columns: ['username'] + foreignKeyName: "user_profiles_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'users' - referencedColumns: ['username'] + referencedRelation: "users" + referencedColumns: ["username"] }, ] } users: { Row: { - age_range: unknown | null - catchphrase: unknown | null + age_range: unknown + catchphrase: unknown data: Json | null - status: Database['public']['Enums']['user_status'] | null + status: Database["public"]["Enums"]["user_status"] | null username: string } Insert: { - age_range?: unknown | null - catchphrase?: unknown | null + age_range?: unknown + catchphrase?: unknown data?: Json | null - status?: Database['public']['Enums']['user_status'] | null + status?: Database["public"]["Enums"]["user_status"] | null username: string } Update: { - age_range?: unknown | null - catchphrase?: unknown | null + age_range?: unknown + catchphrase?: unknown data?: Json | null - status?: Database['public']['Enums']['user_status'] | null + status?: Database["public"]["Enums"]["user_status"] | null username?: string } Relationships: [] @@ -492,24 +492,24 @@ export type Database = { Views: { active_users: { Row: { - age_range: unknown | null - catchphrase: unknown | null + age_range: unknown + catchphrase: unknown data: Json | null - status: Database['public']['Enums']['user_status'] | null + status: Database["public"]["Enums"]["user_status"] | null username: string | null } Insert: { - age_range?: unknown | null - catchphrase?: unknown | null + age_range?: unknown + catchphrase?: unknown data?: Json | null - status?: Database['public']['Enums']['user_status'] | null + status?: Database["public"]["Enums"]["user_status"] | null username?: string | null } Update: { - age_range?: unknown | null - catchphrase?: unknown | null + age_range?: unknown + catchphrase?: unknown data?: Json | null - status?: Database['public']['Enums']['user_status'] | null + status?: Database["public"]["Enums"]["user_status"] | null username?: string | null } Relationships: [] @@ -530,39 +530,39 @@ export type Database = { } Relationships: [ { - foreignKeyName: 'messages_channel_id_fkey' - columns: ['channel_id'] + foreignKeyName: "messages_channel_id_fkey" + columns: ["channel_id"] isOneToOne: false - referencedRelation: 'channels' - referencedColumns: ['id'] + referencedRelation: "channels" + referencedColumns: ["id"] }, { - foreignKeyName: 'messages_username_fkey' - columns: ['username'] + foreignKeyName: "messages_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'active_users' - referencedColumns: ['username'] + referencedRelation: "active_users" + referencedColumns: ["username"] }, { - foreignKeyName: 'messages_username_fkey' - columns: ['username'] + foreignKeyName: "messages_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'non_updatable_view' - referencedColumns: ['username'] + referencedRelation: "non_updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'messages_username_fkey' - columns: ['username'] + foreignKeyName: "messages_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'updatable_view' - referencedColumns: ['username'] + referencedRelation: "updatable_view" + referencedColumns: ["username"] }, { - foreignKeyName: 'messages_username_fkey' - columns: ['username'] + foreignKeyName: "messages_username_fkey" + columns: ["username"] isOneToOne: false - referencedRelation: 'users' - referencedColumns: ['username'] + referencedRelation: "users" + referencedColumns: ["username"] }, ] } @@ -584,52 +584,84 @@ export type Database = { } Functions: { blurb_message: { - Args: { '': Database['public']['Tables']['messages']['Row'] } - Returns: string + Args: { "": Database["public"]["Tables"]["messages"]["Row"] } + Returns: { + error: true + } & "the function public.blurb_message with parameter or with a single unnamed json/jsonb parameter, but no matches were found in the schema cache" } function_returning_row: { - Args: Record + Args: never Returns: { - age_range: unknown | null - catchphrase: unknown | null + age_range: unknown + catchphrase: unknown data: Json | null - status: Database['public']['Enums']['user_status'] | null + status: Database["public"]["Enums"]["user_status"] | null username: string } + SetofOptions: { + from: "*" + to: "users" + isOneToOne: true + isSetofReturn: false + } } function_returning_set_of_rows: { - Args: Record + Args: never Returns: { - age_range: unknown | null - catchphrase: unknown | null + age_range: unknown + catchphrase: unknown data: Json | null - status: Database['public']['Enums']['user_status'] | null + status: Database["public"]["Enums"]["user_status"] | null username: string }[] + SetofOptions: { + from: "*" + to: "users" + isOneToOne: false + isSetofReturn: true + } } function_returning_single_row: { - Args: { messages: Database['public']['Tables']['messages']['Row'] } + Args: { messages: Database["public"]["Tables"]["messages"]["Row"] } Returns: { - age_range: unknown | null - catchphrase: unknown | null + age_range: unknown + catchphrase: unknown data: Json | null - status: Database['public']['Enums']['user_status'] | null + status: Database["public"]["Enums"]["user_status"] | null username: string } + SetofOptions: { + from: "messages" + to: "users" + isOneToOne: true + isSetofReturn: false + } } function_using_setof_rows_one: { - Args: { user_row: Database['public']['Tables']['users']['Row'] } + Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } Returns: { id: number username: string | null - }[] + } + SetofOptions: { + from: "users" + to: "user_profiles" + isOneToOne: true + isSetofReturn: true + } } function_using_table_returns: { - Args: { user_row: Database['public']['Tables']['users']['Row'] } + Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } Returns: { id: number username: string | null } + SetofOptions: { + from: "users" + to: "user_profiles" + isOneToOne: true + isSetofReturn: false + } } function_with_array_param: { Args: { param: string[] } @@ -640,19 +672,9 @@ export type Database = { Returns: string } get_active_user_messages: { - Args: { active_user_row: unknown } - Returns: { - channel_id: number - data: Json | null - id: number - message: string | null - username: string - }[] - } - get_messages: { - Args: - | { channel_row: Database['public']['Tables']['channels']['Row'] } - | { user_row: Database['public']['Tables']['users']['Row'] } + Args: { + active_user_row: Database["public"]["Views"]["active_users"]["Row"] + } Returns: { channel_id: number data: Json | null @@ -660,7 +682,48 @@ export type Database = { message: string | null username: string }[] + SetofOptions: { + from: "active_users" + to: "messages" + isOneToOne: false + isSetofReturn: true + } } + get_messages: + | { + Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Returns: { + channel_id: number + data: Json | null + id: number + message: string | null + username: string + }[] + SetofOptions: { + from: "users" + to: "messages" + isOneToOne: false + isSetofReturn: true + } + } + | { + Args: { + channel_row: Database["public"]["Tables"]["channels"]["Row"] + } + Returns: { + channel_id: number + data: Json | null + id: number + message: string | null + username: string + }[] + SetofOptions: { + from: "channels" + to: "messages" + isOneToOne: false + isSetofReturn: true + } + } get_messages_by_username: { Args: { search_username: string } Returns: { @@ -670,6 +733,12 @@ export type Database = { message: string | null username: string }[] + SetofOptions: { + from: "*" + to: "messages" + isOneToOne: false + isSetofReturn: true + } } get_recent_messages_by_username: { Args: { search_username: string } @@ -680,23 +749,37 @@ export type Database = { message: string | null username: string | null }[] + SetofOptions: { + from: "*" + to: "recent_messages" + isOneToOne: false + isSetofReturn: true + } } get_status: { Args: { name_param: string } - Returns: Database['public']['Enums']['user_status'] + Returns: Database["public"]["Enums"]["user_status"] } get_user_first_message: { - Args: { active_user_row: unknown } + Args: { + active_user_row: Database["public"]["Views"]["active_users"]["Row"] + } Returns: { channel_id: number | null data: Json | null id: number | null message: string | null username: string | null - }[] + } + SetofOptions: { + from: "active_users" + to: "recent_messages" + isOneToOne: true + isSetofReturn: true + } } get_user_messages: { - Args: { user_row: Database['public']['Tables']['users']['Row'] } + Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } Returns: { channel_id: number data: Json | null @@ -704,107 +787,203 @@ export type Database = { message: string | null username: string }[] + SetofOptions: { + from: "users" + to: "messages" + isOneToOne: false + isSetofReturn: true + } } get_user_profile: { - Args: { user_row: Database['public']['Tables']['users']['Row'] } + Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } Returns: { id: number username: string | null } + SetofOptions: { + from: "users" + to: "user_profiles" + isOneToOne: true + isSetofReturn: false + } } get_user_profile_non_nullable: { - Args: { user_row: Database['public']['Tables']['users']['Row'] } + Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } Returns: { id: number username: string | null - }[] - } - get_user_recent_messages: { - Args: - | { active_user_row: unknown } - | { user_row: Database['public']['Tables']['users']['Row'] } - Returns: { - channel_id: number | null - data: Json | null - id: number | null - message: string | null - username: string | null - }[] + } + SetofOptions: { + from: "users" + to: "user_profiles" + isOneToOne: true + isSetofReturn: true + } } + get_user_recent_messages: + | { + Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Returns: { + channel_id: number | null + data: Json | null + id: number | null + message: string | null + username: string | null + }[] + SetofOptions: { + from: "users" + to: "recent_messages" + isOneToOne: false + isSetofReturn: true + } + } + | { + Args: { + active_user_row: Database["public"]["Views"]["active_users"]["Row"] + } + Returns: { + channel_id: number | null + data: Json | null + id: number | null + message: string | null + username: string | null + }[] + SetofOptions: { + from: "active_users" + to: "recent_messages" + isOneToOne: false + isSetofReturn: true + } + } get_username_and_status: { Args: { name_param: string } Returns: { - status: Database['public']['Enums']['user_status'] + status: Database["public"]["Enums"]["user_status"] username: string }[] } offline_user: { Args: { name_param: string } - Returns: Database['public']['Enums']['user_status'] + Returns: Database["public"]["Enums"]["user_status"] } polymorphic_function_with_different_return: { - Args: { '': boolean } | { '': number } | { '': string } - Returns: number - } - polymorphic_function_with_no_params_or_unnamed: { - Args: Record | { '': boolean } | { '': string } - Returns: number - } - polymorphic_function_with_unnamed_default: { - Args: Record | { ''?: number } | { ''?: string } - Returns: number - } - polymorphic_function_with_unnamed_default_overload: { - Args: Record | { ''?: boolean } | { ''?: number } | { ''?: string } - Returns: number - } - polymorphic_function_with_unnamed_integer: { - Args: { '': number } - Returns: number + Args: { "": string } + Returns: string } + polymorphic_function_with_no_params_or_unnamed: + | { Args: never; Returns: number } + | { Args: { "": string }; Returns: string } + polymorphic_function_with_unnamed_default: + | { + Args: never + Returns: { + error: true + } & "Could not choose the best candidate function between: public.polymorphic_function_with_unnamed_default(), public.polymorphic_function_with_unnamed_default( => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved" + } + | { Args: { ""?: string }; Returns: string } + polymorphic_function_with_unnamed_default_overload: + | { + Args: never + Returns: { + error: true + } & "Could not choose the best candidate function between: public.polymorphic_function_with_unnamed_default_overload(), public.polymorphic_function_with_unnamed_default_overload( => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved" + } + | { Args: { ""?: string }; Returns: string } polymorphic_function_with_unnamed_json: { - Args: { '': Json } + Args: { "": Json } Returns: number } polymorphic_function_with_unnamed_jsonb: { - Args: { '': Json } + Args: { "": Json } Returns: number } polymorphic_function_with_unnamed_text: { - Args: { '': string } + Args: { "": string } Returns: number } - postgrest_resolvable_with_override_function: { - Args: - | Record - | { a: string } - | { b: number } - | { cid: number; search?: string } - | { profile_id: number } - | { user_row: Database['public']['Tables']['users']['Row'] } - Returns: undefined - } - postgrest_unresolvable_function: { - Args: Record | { a: number } | { a: string } - Returns: undefined - } + postgrest_resolvable_with_override_function: + | { Args: { a: string }; Returns: number } + | { Args: { b: number }; Returns: string } + | { + Args: { profile_id: number } + Returns: { + id: number + username: string | null + }[] + SetofOptions: { + from: "*" + to: "user_profiles" + isOneToOne: false + isSetofReturn: true + } + } + | { + Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Returns: { + channel_id: number + data: Json | null + id: number + message: string | null + username: string + }[] + SetofOptions: { + from: "users" + to: "messages" + isOneToOne: false + isSetofReturn: true + } + } + | { + Args: { cid: number; search?: string } + Returns: { + channel_id: number + data: Json | null + id: number + message: string | null + username: string + }[] + SetofOptions: { + from: "*" + to: "messages" + isOneToOne: false + isSetofReturn: true + } + } + | { Args: never; Returns: undefined } + postgrest_unresolvable_function: + | { + Args: { a: string } + Returns: { + error: true + } & "Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved" + } + | { + Args: { a: number } + Returns: { + error: true + } & "Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved" + } + | { Args: never; Returns: undefined } set_users_offline: { Args: { name_param: string } Returns: { - age_range: unknown | null - catchphrase: unknown | null + age_range: unknown + catchphrase: unknown data: Json | null - status: Database['public']['Enums']['user_status'] | null + status: Database["public"]["Enums"]["user_status"] | null username: string }[] + SetofOptions: { + from: "*" + to: "users" + isOneToOne: false + isSetofReturn: true + } } - void_func: { - Args: Record - Returns: undefined - } + void_func: { Args: never; Returns: undefined } } Enums: { - user_status: 'ONLINE' | 'OFFLINE' + user_status: "ONLINE" | "OFFLINE" } CompositeTypes: { [_ in never]: never @@ -812,31 +991,33 @@ export type Database = { } } -type DatabaseWithoutInternals = Omit +type DatabaseWithoutInternals = Omit -type DefaultSchema = DatabaseWithoutInternals[Extract] +type DefaultSchema = DatabaseWithoutInternals[Extract] export type Tables< DefaultSchemaTableNameOrOptions extends - | keyof (DefaultSchema['Tables'] & DefaultSchema['Views']) + | keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & - DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Views']) + ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"]) : never = never, > = DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & - DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Views'])[TableName] extends { + ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends { Row: infer R } ? R : never - : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema['Tables'] & DefaultSchema['Views']) - ? (DefaultSchema['Tables'] & DefaultSchema['Views'])[DefaultSchemaTableNameOrOptions] extends { + : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & + DefaultSchema["Views"]) + ? (DefaultSchema["Tables"] & + DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends { Row: infer R } ? R @@ -845,23 +1026,23 @@ export type Tables< export type TablesInsert< DefaultSchemaTableNameOrOptions extends - | keyof DefaultSchema['Tables'] + | keyof DefaultSchema["Tables"] | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] : never = never, > = DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'][TableName] extends { + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { Insert: infer I } ? I : never - : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema['Tables'] - ? DefaultSchema['Tables'][DefaultSchemaTableNameOrOptions] extends { + : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] + ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { Insert: infer I } ? I @@ -870,23 +1051,23 @@ export type TablesInsert< export type TablesUpdate< DefaultSchemaTableNameOrOptions extends - | keyof DefaultSchema['Tables'] + | keyof DefaultSchema["Tables"] | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] : never = never, > = DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'][TableName] extends { + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { Update: infer U } ? U : never - : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema['Tables'] - ? DefaultSchema['Tables'][DefaultSchemaTableNameOrOptions] extends { + : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] + ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { Update: infer U } ? U @@ -895,47 +1076,47 @@ export type TablesUpdate< export type Enums< DefaultSchemaEnumNameOrOptions extends - | keyof DefaultSchema['Enums'] + | keyof DefaultSchema["Enums"] | { schema: keyof DatabaseWithoutInternals }, EnumName extends DefaultSchemaEnumNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions['schema']]['Enums'] + ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"] : never = never, > = DefaultSchemaEnumNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions['schema']]['Enums'][EnumName] - : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema['Enums'] - ? DefaultSchema['Enums'][DefaultSchemaEnumNameOrOptions] + ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName] + : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] + ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions] : never export type CompositeTypes< PublicCompositeTypeNameOrOptions extends - | keyof DefaultSchema['CompositeTypes'] + | keyof DefaultSchema["CompositeTypes"] | { schema: keyof DatabaseWithoutInternals }, CompositeTypeName extends PublicCompositeTypeNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'] + ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] : never = never, > = PublicCompositeTypeNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'][CompositeTypeName] - : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema['CompositeTypes'] - ? DefaultSchema['CompositeTypes'][PublicCompositeTypeNameOrOptions] + ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] + : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] + ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] : never export const Constants = { personal: { Enums: { - user_status: ['ONLINE', 'OFFLINE'], + user_status: ["ONLINE", "OFFLINE"], }, }, public: { Enums: { - user_status: ['ONLINE', 'OFFLINE'], + user_status: ["ONLINE", "OFFLINE"], }, }, } as const From 69a008a81110fe237f87975f0f5615f4b98d6bc6 Mon Sep 17 00:00:00 2001 From: avallete Date: Mon, 20 Oct 2025 12:13:22 +0200 Subject: [PATCH 2/3] chore(postgrest): fix tstyche --- .../core/postgrest-js/test/types.generated.ts | 544 +++++++++--------- .../core/postgrest-js/tstyche.config.json | 5 +- 2 files changed, 275 insertions(+), 274 deletions(-) diff --git a/packages/core/postgrest-js/test/types.generated.ts b/packages/core/postgrest-js/test/types.generated.ts index de4f725e1..ea6daa63f 100644 --- a/packages/core/postgrest-js/test/types.generated.ts +++ b/packages/core/postgrest-js/test/types.generated.ts @@ -1,4 +1,4 @@ -export type Json = unknown; +export type Json = unknown export type Database = { personal: { @@ -7,19 +7,19 @@ export type Database = { Row: { age_range: unknown data: Json | null - status: Database["personal"]["Enums"]["user_status"] | null + status: Database['personal']['Enums']['user_status'] | null username: string } Insert: { age_range?: unknown data?: Json | null - status?: Database["personal"]["Enums"]["user_status"] | null + status?: Database['personal']['Enums']['user_status'] | null username: string } Update: { age_range?: unknown data?: Json | null - status?: Database["personal"]["Enums"]["user_status"] | null + status?: Database['personal']['Enums']['user_status'] | null username?: string } Relationships: [] @@ -31,11 +31,11 @@ export type Database = { Functions: { get_status: { Args: { name_param: string } - Returns: Database["personal"]["Enums"]["user_status"] + Returns: Database['personal']['Enums']['user_status'] } } Enums: { - user_status: "ONLINE" | "OFFLINE" + user_status: 'ONLINE' | 'OFFLINE' } CompositeTypes: { [_ in never]: never @@ -64,89 +64,89 @@ export type Database = { } Relationships: [ { - foreignKeyName: "best_friends_first_user_fkey" - columns: ["first_user"] + foreignKeyName: 'best_friends_first_user_fkey' + columns: ['first_user'] isOneToOne: false - referencedRelation: "active_users" - referencedColumns: ["username"] + referencedRelation: 'active_users' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_first_user_fkey" - columns: ["first_user"] + foreignKeyName: 'best_friends_first_user_fkey' + columns: ['first_user'] isOneToOne: false - referencedRelation: "non_updatable_view" - referencedColumns: ["username"] + referencedRelation: 'non_updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_first_user_fkey" - columns: ["first_user"] + foreignKeyName: 'best_friends_first_user_fkey' + columns: ['first_user'] isOneToOne: false - referencedRelation: "updatable_view" - referencedColumns: ["username"] + referencedRelation: 'updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_first_user_fkey" - columns: ["first_user"] + foreignKeyName: 'best_friends_first_user_fkey' + columns: ['first_user'] isOneToOne: false - referencedRelation: "users" - referencedColumns: ["username"] + referencedRelation: 'users' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_second_user_fkey" - columns: ["second_user"] + foreignKeyName: 'best_friends_second_user_fkey' + columns: ['second_user'] isOneToOne: false - referencedRelation: "active_users" - referencedColumns: ["username"] + referencedRelation: 'active_users' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_second_user_fkey" - columns: ["second_user"] + foreignKeyName: 'best_friends_second_user_fkey' + columns: ['second_user'] isOneToOne: false - referencedRelation: "non_updatable_view" - referencedColumns: ["username"] + referencedRelation: 'non_updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_second_user_fkey" - columns: ["second_user"] + foreignKeyName: 'best_friends_second_user_fkey' + columns: ['second_user'] isOneToOne: false - referencedRelation: "updatable_view" - referencedColumns: ["username"] + referencedRelation: 'updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_second_user_fkey" - columns: ["second_user"] + foreignKeyName: 'best_friends_second_user_fkey' + columns: ['second_user'] isOneToOne: false - referencedRelation: "users" - referencedColumns: ["username"] + referencedRelation: 'users' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_third_wheel_fkey" - columns: ["third_wheel"] + foreignKeyName: 'best_friends_third_wheel_fkey' + columns: ['third_wheel'] isOneToOne: false - referencedRelation: "active_users" - referencedColumns: ["username"] + referencedRelation: 'active_users' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_third_wheel_fkey" - columns: ["third_wheel"] + foreignKeyName: 'best_friends_third_wheel_fkey' + columns: ['third_wheel'] isOneToOne: false - referencedRelation: "non_updatable_view" - referencedColumns: ["username"] + referencedRelation: 'non_updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_third_wheel_fkey" - columns: ["third_wheel"] + foreignKeyName: 'best_friends_third_wheel_fkey' + columns: ['third_wheel'] isOneToOne: false - referencedRelation: "updatable_view" - referencedColumns: ["username"] + referencedRelation: 'updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "best_friends_third_wheel_fkey" - columns: ["third_wheel"] + foreignKeyName: 'best_friends_third_wheel_fkey' + columns: ['third_wheel'] isOneToOne: false - referencedRelation: "users" - referencedColumns: ["username"] - }, + referencedRelation: 'users' + referencedColumns: ['username'] + } ] } booking: { @@ -164,12 +164,12 @@ export type Database = { } Relationships: [ { - foreignKeyName: "booking_hotel_id_fkey" - columns: ["hotel_id"] + foreignKeyName: 'booking_hotel_id_fkey' + columns: ['hotel_id'] isOneToOne: false - referencedRelation: "hotel" - referencedColumns: ["id"] - }, + referencedRelation: 'hotel' + referencedColumns: ['id'] + } ] } categories: { @@ -205,12 +205,12 @@ export type Database = { } Relationships: [ { - foreignKeyName: "channel_details_id_fkey" - columns: ["id"] + foreignKeyName: 'channel_details_id_fkey' + columns: ['id'] isOneToOne: true - referencedRelation: "channels" - referencedColumns: ["id"] - }, + referencedRelation: 'channels' + referencedColumns: ['id'] + } ] } channels: { @@ -249,28 +249,28 @@ export type Database = { } Relationships: [ { - foreignKeyName: "collections_parent_id_fkey" - columns: ["parent_id"] + foreignKeyName: 'collections_parent_id_fkey' + columns: ['parent_id'] isOneToOne: false - referencedRelation: "collections" - referencedColumns: ["id"] - }, + referencedRelation: 'collections' + referencedColumns: ['id'] + } ] } cornercase: { Row: { array_column: string[] | null - "column whitespace": string | null + 'column whitespace': string | null id: number } Insert: { array_column?: string[] | null - "column whitespace"?: string | null + 'column whitespace'?: string | null id: number } Update: { array_column?: string[] | null - "column whitespace"?: string | null + 'column whitespace'?: string | null id?: number } Relationships: [] @@ -315,40 +315,40 @@ export type Database = { } Relationships: [ { - foreignKeyName: "messages_channel_id_fkey" - columns: ["channel_id"] + foreignKeyName: 'messages_channel_id_fkey' + columns: ['channel_id'] isOneToOne: false - referencedRelation: "channels" - referencedColumns: ["id"] + referencedRelation: 'channels' + referencedColumns: ['id'] }, { - foreignKeyName: "messages_username_fkey" - columns: ["username"] + foreignKeyName: 'messages_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "active_users" - referencedColumns: ["username"] + referencedRelation: 'active_users' + referencedColumns: ['username'] }, { - foreignKeyName: "messages_username_fkey" - columns: ["username"] + foreignKeyName: 'messages_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "non_updatable_view" - referencedColumns: ["username"] + referencedRelation: 'non_updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "messages_username_fkey" - columns: ["username"] + foreignKeyName: 'messages_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "updatable_view" - referencedColumns: ["username"] + referencedRelation: 'updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "messages_username_fkey" - columns: ["username"] + foreignKeyName: 'messages_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "users" - referencedColumns: ["username"] - }, + referencedRelation: 'users' + referencedColumns: ['username'] + } ] } product_categories: { @@ -366,19 +366,19 @@ export type Database = { } Relationships: [ { - foreignKeyName: "product_categories_category_id_fkey" - columns: ["category_id"] + foreignKeyName: 'product_categories_category_id_fkey' + columns: ['category_id'] isOneToOne: false - referencedRelation: "categories" - referencedColumns: ["id"] + referencedRelation: 'categories' + referencedColumns: ['id'] }, { - foreignKeyName: "product_categories_product_id_fkey" - columns: ["product_id"] + foreignKeyName: 'product_categories_product_id_fkey' + columns: ['product_id'] isOneToOne: false - referencedRelation: "products" - referencedColumns: ["id"] - }, + referencedRelation: 'products' + referencedColumns: ['id'] + } ] } products: { @@ -435,33 +435,33 @@ export type Database = { } Relationships: [ { - foreignKeyName: "user_profiles_username_fkey" - columns: ["username"] + foreignKeyName: 'user_profiles_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "active_users" - referencedColumns: ["username"] + referencedRelation: 'active_users' + referencedColumns: ['username'] }, { - foreignKeyName: "user_profiles_username_fkey" - columns: ["username"] + foreignKeyName: 'user_profiles_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "non_updatable_view" - referencedColumns: ["username"] + referencedRelation: 'non_updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "user_profiles_username_fkey" - columns: ["username"] + foreignKeyName: 'user_profiles_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "updatable_view" - referencedColumns: ["username"] + referencedRelation: 'updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "user_profiles_username_fkey" - columns: ["username"] + foreignKeyName: 'user_profiles_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "users" - referencedColumns: ["username"] - }, + referencedRelation: 'users' + referencedColumns: ['username'] + } ] } users: { @@ -469,21 +469,21 @@ export type Database = { age_range: unknown catchphrase: unknown data: Json | null - status: Database["public"]["Enums"]["user_status"] | null + status: Database['public']['Enums']['user_status'] | null username: string } Insert: { age_range?: unknown catchphrase?: unknown data?: Json | null - status?: Database["public"]["Enums"]["user_status"] | null + status?: Database['public']['Enums']['user_status'] | null username: string } Update: { age_range?: unknown catchphrase?: unknown data?: Json | null - status?: Database["public"]["Enums"]["user_status"] | null + status?: Database['public']['Enums']['user_status'] | null username?: string } Relationships: [] @@ -495,21 +495,21 @@ export type Database = { age_range: unknown catchphrase: unknown data: Json | null - status: Database["public"]["Enums"]["user_status"] | null + status: Database['public']['Enums']['user_status'] | null username: string | null } Insert: { age_range?: unknown catchphrase?: unknown data?: Json | null - status?: Database["public"]["Enums"]["user_status"] | null + status?: Database['public']['Enums']['user_status'] | null username?: string | null } Update: { age_range?: unknown catchphrase?: unknown data?: Json | null - status?: Database["public"]["Enums"]["user_status"] | null + status?: Database['public']['Enums']['user_status'] | null username?: string | null } Relationships: [] @@ -530,40 +530,40 @@ export type Database = { } Relationships: [ { - foreignKeyName: "messages_channel_id_fkey" - columns: ["channel_id"] + foreignKeyName: 'messages_channel_id_fkey' + columns: ['channel_id'] isOneToOne: false - referencedRelation: "channels" - referencedColumns: ["id"] + referencedRelation: 'channels' + referencedColumns: ['id'] }, { - foreignKeyName: "messages_username_fkey" - columns: ["username"] + foreignKeyName: 'messages_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "active_users" - referencedColumns: ["username"] + referencedRelation: 'active_users' + referencedColumns: ['username'] }, { - foreignKeyName: "messages_username_fkey" - columns: ["username"] + foreignKeyName: 'messages_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "non_updatable_view" - referencedColumns: ["username"] + referencedRelation: 'non_updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "messages_username_fkey" - columns: ["username"] + foreignKeyName: 'messages_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "updatable_view" - referencedColumns: ["username"] + referencedRelation: 'updatable_view' + referencedColumns: ['username'] }, { - foreignKeyName: "messages_username_fkey" - columns: ["username"] + foreignKeyName: 'messages_username_fkey' + columns: ['username'] isOneToOne: false - referencedRelation: "users" - referencedColumns: ["username"] - }, + referencedRelation: 'users' + referencedColumns: ['username'] + } ] } updatable_view: { @@ -584,10 +584,10 @@ export type Database = { } Functions: { blurb_message: { - Args: { "": Database["public"]["Tables"]["messages"]["Row"] } + Args: { '': Database['public']['Tables']['messages']['Row'] } Returns: { error: true - } & "the function public.blurb_message with parameter or with a single unnamed json/jsonb parameter, but no matches were found in the schema cache" + } & 'the function public.blurb_message with parameter or with a single unnamed json/jsonb parameter, but no matches were found in the schema cache' } function_returning_row: { Args: never @@ -595,12 +595,12 @@ export type Database = { age_range: unknown catchphrase: unknown data: Json | null - status: Database["public"]["Enums"]["user_status"] | null + status: Database['public']['Enums']['user_status'] | null username: string } SetofOptions: { - from: "*" - to: "users" + from: '*' + to: 'users' isOneToOne: true isSetofReturn: false } @@ -611,54 +611,54 @@ export type Database = { age_range: unknown catchphrase: unknown data: Json | null - status: Database["public"]["Enums"]["user_status"] | null + status: Database['public']['Enums']['user_status'] | null username: string }[] SetofOptions: { - from: "*" - to: "users" + from: '*' + to: 'users' isOneToOne: false isSetofReturn: true } } function_returning_single_row: { - Args: { messages: Database["public"]["Tables"]["messages"]["Row"] } + Args: { messages: Database['public']['Tables']['messages']['Row'] } Returns: { age_range: unknown catchphrase: unknown data: Json | null - status: Database["public"]["Enums"]["user_status"] | null + status: Database['public']['Enums']['user_status'] | null username: string } SetofOptions: { - from: "messages" - to: "users" + from: 'messages' + to: 'users' isOneToOne: true isSetofReturn: false } } function_using_setof_rows_one: { - Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Args: { user_row: Database['public']['Tables']['users']['Row'] } Returns: { id: number username: string | null } SetofOptions: { - from: "users" - to: "user_profiles" + from: 'users' + to: 'user_profiles' isOneToOne: true isSetofReturn: true } } function_using_table_returns: { - Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Args: { user_row: Database['public']['Tables']['users']['Row'] } Returns: { id: number username: string | null } SetofOptions: { - from: "users" - to: "user_profiles" + from: 'users' + to: 'user_profiles' isOneToOne: true isSetofReturn: false } @@ -673,7 +673,7 @@ export type Database = { } get_active_user_messages: { Args: { - active_user_row: Database["public"]["Views"]["active_users"]["Row"] + active_user_row: Database['public']['Views']['active_users']['Row'] } Returns: { channel_id: number @@ -683,15 +683,15 @@ export type Database = { username: string }[] SetofOptions: { - from: "active_users" - to: "messages" + from: 'active_users' + to: 'messages' isOneToOne: false isSetofReturn: true } } get_messages: | { - Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Args: { user_row: Database['public']['Tables']['users']['Row'] } Returns: { channel_id: number data: Json | null @@ -700,15 +700,15 @@ export type Database = { username: string }[] SetofOptions: { - from: "users" - to: "messages" + from: 'users' + to: 'messages' isOneToOne: false isSetofReturn: true } } | { Args: { - channel_row: Database["public"]["Tables"]["channels"]["Row"] + channel_row: Database['public']['Tables']['channels']['Row'] } Returns: { channel_id: number @@ -718,8 +718,8 @@ export type Database = { username: string }[] SetofOptions: { - from: "channels" - to: "messages" + from: 'channels' + to: 'messages' isOneToOne: false isSetofReturn: true } @@ -734,8 +734,8 @@ export type Database = { username: string }[] SetofOptions: { - from: "*" - to: "messages" + from: '*' + to: 'messages' isOneToOne: false isSetofReturn: true } @@ -750,19 +750,19 @@ export type Database = { username: string | null }[] SetofOptions: { - from: "*" - to: "recent_messages" + from: '*' + to: 'recent_messages' isOneToOne: false isSetofReturn: true } } get_status: { Args: { name_param: string } - Returns: Database["public"]["Enums"]["user_status"] + Returns: Database['public']['Enums']['user_status'] } get_user_first_message: { Args: { - active_user_row: Database["public"]["Views"]["active_users"]["Row"] + active_user_row: Database['public']['Views']['active_users']['Row'] } Returns: { channel_id: number | null @@ -772,14 +772,14 @@ export type Database = { username: string | null } SetofOptions: { - from: "active_users" - to: "recent_messages" + from: 'active_users' + to: 'recent_messages' isOneToOne: true isSetofReturn: true } } get_user_messages: { - Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Args: { user_row: Database['public']['Tables']['users']['Row'] } Returns: { channel_id: number data: Json | null @@ -788,41 +788,41 @@ export type Database = { username: string }[] SetofOptions: { - from: "users" - to: "messages" + from: 'users' + to: 'messages' isOneToOne: false isSetofReturn: true } } get_user_profile: { - Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Args: { user_row: Database['public']['Tables']['users']['Row'] } Returns: { id: number username: string | null } SetofOptions: { - from: "users" - to: "user_profiles" + from: 'users' + to: 'user_profiles' isOneToOne: true isSetofReturn: false } } get_user_profile_non_nullable: { - Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Args: { user_row: Database['public']['Tables']['users']['Row'] } Returns: { id: number username: string | null } SetofOptions: { - from: "users" - to: "user_profiles" + from: 'users' + to: 'user_profiles' isOneToOne: true isSetofReturn: true } } get_user_recent_messages: | { - Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Args: { user_row: Database['public']['Tables']['users']['Row'] } Returns: { channel_id: number | null data: Json | null @@ -831,15 +831,15 @@ export type Database = { username: string | null }[] SetofOptions: { - from: "users" - to: "recent_messages" + from: 'users' + to: 'recent_messages' isOneToOne: false isSetofReturn: true } } | { Args: { - active_user_row: Database["public"]["Views"]["active_users"]["Row"] + active_user_row: Database['public']['Views']['active_users']['Row'] } Returns: { channel_id: number | null @@ -849,8 +849,8 @@ export type Database = { username: string | null }[] SetofOptions: { - from: "active_users" - to: "recent_messages" + from: 'active_users' + to: 'recent_messages' isOneToOne: false isSetofReturn: true } @@ -858,47 +858,47 @@ export type Database = { get_username_and_status: { Args: { name_param: string } Returns: { - status: Database["public"]["Enums"]["user_status"] + status: Database['public']['Enums']['user_status'] username: string }[] } offline_user: { Args: { name_param: string } - Returns: Database["public"]["Enums"]["user_status"] + Returns: Database['public']['Enums']['user_status'] } polymorphic_function_with_different_return: { - Args: { "": string } + Args: { '': string } Returns: string } polymorphic_function_with_no_params_or_unnamed: | { Args: never; Returns: number } - | { Args: { "": string }; Returns: string } + | { Args: { '': string }; Returns: string } polymorphic_function_with_unnamed_default: | { Args: never Returns: { error: true - } & "Could not choose the best candidate function between: public.polymorphic_function_with_unnamed_default(), public.polymorphic_function_with_unnamed_default( => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved" + } & 'Could not choose the best candidate function between: public.polymorphic_function_with_unnamed_default(), public.polymorphic_function_with_unnamed_default( => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved' } - | { Args: { ""?: string }; Returns: string } + | { Args: { ''?: string }; Returns: string } polymorphic_function_with_unnamed_default_overload: | { Args: never Returns: { error: true - } & "Could not choose the best candidate function between: public.polymorphic_function_with_unnamed_default_overload(), public.polymorphic_function_with_unnamed_default_overload( => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved" + } & 'Could not choose the best candidate function between: public.polymorphic_function_with_unnamed_default_overload(), public.polymorphic_function_with_unnamed_default_overload( => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved' } - | { Args: { ""?: string }; Returns: string } + | { Args: { ''?: string }; Returns: string } polymorphic_function_with_unnamed_json: { - Args: { "": Json } + Args: { '': Json } Returns: number } polymorphic_function_with_unnamed_jsonb: { - Args: { "": Json } + Args: { '': Json } Returns: number } polymorphic_function_with_unnamed_text: { - Args: { "": string } + Args: { '': string } Returns: number } postgrest_resolvable_with_override_function: @@ -911,14 +911,14 @@ export type Database = { username: string | null }[] SetofOptions: { - from: "*" - to: "user_profiles" + from: '*' + to: 'user_profiles' isOneToOne: false isSetofReturn: true } } | { - Args: { user_row: Database["public"]["Tables"]["users"]["Row"] } + Args: { user_row: Database['public']['Tables']['users']['Row'] } Returns: { channel_id: number data: Json | null @@ -927,8 +927,8 @@ export type Database = { username: string }[] SetofOptions: { - from: "users" - to: "messages" + from: 'users' + to: 'messages' isOneToOne: false isSetofReturn: true } @@ -943,8 +943,8 @@ export type Database = { username: string }[] SetofOptions: { - from: "*" - to: "messages" + from: '*' + to: 'messages' isOneToOne: false isSetofReturn: true } @@ -955,13 +955,13 @@ export type Database = { Args: { a: string } Returns: { error: true - } & "Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved" + } & 'Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved' } | { Args: { a: number } Returns: { error: true - } & "Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved" + } & 'Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved' } | { Args: never; Returns: undefined } set_users_offline: { @@ -970,12 +970,12 @@ export type Database = { age_range: unknown catchphrase: unknown data: Json | null - status: Database["public"]["Enums"]["user_status"] | null + status: Database['public']['Enums']['user_status'] | null username: string }[] SetofOptions: { - from: "*" - to: "users" + from: '*' + to: 'users' isOneToOne: false isSetofReturn: true } @@ -983,7 +983,7 @@ export type Database = { void_func: { Args: never; Returns: undefined } } Enums: { - user_status: "ONLINE" | "OFFLINE" + user_status: 'ONLINE' | 'OFFLINE' } CompositeTypes: { [_ in never]: never @@ -991,132 +991,130 @@ export type Database = { } } -type DatabaseWithoutInternals = Omit +type DatabaseWithoutInternals = Omit -type DefaultSchema = DatabaseWithoutInternals[Extract] +type DefaultSchema = DatabaseWithoutInternals[Extract] export type Tables< DefaultSchemaTableNameOrOptions extends - | keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) + | keyof (DefaultSchema['Tables'] & DefaultSchema['Views']) | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & - DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"]) - : never = never, + ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Views']) + : never = never > = DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & - DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends { + ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & + DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Views'])[TableName] extends { Row: infer R } ? R : never - : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & - DefaultSchema["Views"]) - ? (DefaultSchema["Tables"] & - DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends { - Row: infer R - } - ? R - : never + : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema['Tables'] & DefaultSchema['Views']) + ? (DefaultSchema['Tables'] & DefaultSchema['Views'])[DefaultSchemaTableNameOrOptions] extends { + Row: infer R + } + ? R : never + : never export type TablesInsert< DefaultSchemaTableNameOrOptions extends - | keyof DefaultSchema["Tables"] + | keyof DefaultSchema['Tables'] | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] - : never = never, + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] + : never = never > = DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'][TableName] extends { Insert: infer I } ? I : never - : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] - ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { - Insert: infer I - } - ? I - : never + : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema['Tables'] + ? DefaultSchema['Tables'][DefaultSchemaTableNameOrOptions] extends { + Insert: infer I + } + ? I : never + : never export type TablesUpdate< DefaultSchemaTableNameOrOptions extends - | keyof DefaultSchema["Tables"] + | keyof DefaultSchema['Tables'] | { schema: keyof DatabaseWithoutInternals }, TableName extends DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] - : never = never, + ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] + : never = never > = DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends { + ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'][TableName] extends { Update: infer U } ? U : never - : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] - ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends { - Update: infer U - } - ? U - : never + : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema['Tables'] + ? DefaultSchema['Tables'][DefaultSchemaTableNameOrOptions] extends { + Update: infer U + } + ? U : never + : never export type Enums< DefaultSchemaEnumNameOrOptions extends - | keyof DefaultSchema["Enums"] + | keyof DefaultSchema['Enums'] | { schema: keyof DatabaseWithoutInternals }, EnumName extends DefaultSchemaEnumNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"] - : never = never, + ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions['schema']]['Enums'] + : never = never > = DefaultSchemaEnumNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName] - : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] - ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions] - : never + ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions['schema']]['Enums'][EnumName] + : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema['Enums'] + ? DefaultSchema['Enums'][DefaultSchemaEnumNameOrOptions] + : never export type CompositeTypes< PublicCompositeTypeNameOrOptions extends - | keyof DefaultSchema["CompositeTypes"] + | keyof DefaultSchema['CompositeTypes'] | { schema: keyof DatabaseWithoutInternals }, CompositeTypeName extends PublicCompositeTypeNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] - : never = never, + ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'] + : never = never > = PublicCompositeTypeNameOrOptions extends { schema: keyof DatabaseWithoutInternals } - ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] - : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] - ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] - : never + ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'][CompositeTypeName] + : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema['CompositeTypes'] + ? DefaultSchema['CompositeTypes'][PublicCompositeTypeNameOrOptions] + : never export const Constants = { personal: { Enums: { - user_status: ["ONLINE", "OFFLINE"], + user_status: ['ONLINE', 'OFFLINE'], }, }, public: { Enums: { - user_status: ["ONLINE", "OFFLINE"], + user_status: ['ONLINE', 'OFFLINE'], }, }, } as const diff --git a/packages/core/postgrest-js/tstyche.config.json b/packages/core/postgrest-js/tstyche.config.json index 1112968cc..489cfea96 100644 --- a/packages/core/postgrest-js/tstyche.config.json +++ b/packages/core/postgrest-js/tstyche.config.json @@ -1,4 +1,7 @@ { + "$schema": "https://tstyche.org/schemas/config.json", "tsconfig": "tsconfig.tstyche.json", - "testFileMatch": ["**/*.test-d.ts"] + "testFileMatch": ["./test/**/*.test.ts", "./test/**/*.test-d.ts"], + "checkSourceFiles": false, + "checkSuppressedErrors": true } From 4fe0be25ce164cb18da7efc8c03468be9958e8d6 Mon Sep 17 00:00:00 2001 From: avallete Date: Mon, 20 Oct 2025 12:14:56 +0200 Subject: [PATCH 3/3] chore(postgrest): codegen --- .../core/postgrest-js/test/types.generated.ts | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/core/postgrest-js/test/types.generated.ts b/packages/core/postgrest-js/test/types.generated.ts index ea6daa63f..373ccea56 100644 --- a/packages/core/postgrest-js/test/types.generated.ts +++ b/packages/core/postgrest-js/test/types.generated.ts @@ -146,7 +146,7 @@ export type Database = { isOneToOne: false referencedRelation: 'users' referencedColumns: ['username'] - } + }, ] } booking: { @@ -169,7 +169,7 @@ export type Database = { isOneToOne: false referencedRelation: 'hotel' referencedColumns: ['id'] - } + }, ] } categories: { @@ -210,7 +210,7 @@ export type Database = { isOneToOne: true referencedRelation: 'channels' referencedColumns: ['id'] - } + }, ] } channels: { @@ -254,7 +254,7 @@ export type Database = { isOneToOne: false referencedRelation: 'collections' referencedColumns: ['id'] - } + }, ] } cornercase: { @@ -348,7 +348,7 @@ export type Database = { isOneToOne: false referencedRelation: 'users' referencedColumns: ['username'] - } + }, ] } product_categories: { @@ -378,7 +378,7 @@ export type Database = { isOneToOne: false referencedRelation: 'products' referencedColumns: ['id'] - } + }, ] } products: { @@ -461,7 +461,7 @@ export type Database = { isOneToOne: false referencedRelation: 'users' referencedColumns: ['username'] - } + }, ] } users: { @@ -563,7 +563,7 @@ export type Database = { isOneToOne: false referencedRelation: 'users' referencedColumns: ['username'] - } + }, ] } updatable_view: { @@ -1004,7 +1004,7 @@ export type Tables< } ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Views']) - : never = never + : never = never, > = DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } @@ -1015,12 +1015,12 @@ export type Tables< ? R : never : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema['Tables'] & DefaultSchema['Views']) - ? (DefaultSchema['Tables'] & DefaultSchema['Views'])[DefaultSchemaTableNameOrOptions] extends { - Row: infer R - } - ? R + ? (DefaultSchema['Tables'] & DefaultSchema['Views'])[DefaultSchemaTableNameOrOptions] extends { + Row: infer R + } + ? R + : never : never - : never export type TablesInsert< DefaultSchemaTableNameOrOptions extends @@ -1030,7 +1030,7 @@ export type TablesInsert< schema: keyof DatabaseWithoutInternals } ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] - : never = never + : never = never, > = DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } @@ -1040,12 +1040,12 @@ export type TablesInsert< ? I : never : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema['Tables'] - ? DefaultSchema['Tables'][DefaultSchemaTableNameOrOptions] extends { - Insert: infer I - } - ? I + ? DefaultSchema['Tables'][DefaultSchemaTableNameOrOptions] extends { + Insert: infer I + } + ? I + : never : never - : never export type TablesUpdate< DefaultSchemaTableNameOrOptions extends @@ -1055,7 +1055,7 @@ export type TablesUpdate< schema: keyof DatabaseWithoutInternals } ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] - : never = never + : never = never, > = DefaultSchemaTableNameOrOptions extends { schema: keyof DatabaseWithoutInternals } @@ -1065,12 +1065,12 @@ export type TablesUpdate< ? U : never : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema['Tables'] - ? DefaultSchema['Tables'][DefaultSchemaTableNameOrOptions] extends { - Update: infer U - } - ? U + ? DefaultSchema['Tables'][DefaultSchemaTableNameOrOptions] extends { + Update: infer U + } + ? U + : never : never - : never export type Enums< DefaultSchemaEnumNameOrOptions extends @@ -1080,14 +1080,14 @@ export type Enums< schema: keyof DatabaseWithoutInternals } ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions['schema']]['Enums'] - : never = never + : never = never, > = DefaultSchemaEnumNameOrOptions extends { schema: keyof DatabaseWithoutInternals } ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions['schema']]['Enums'][EnumName] : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema['Enums'] - ? DefaultSchema['Enums'][DefaultSchemaEnumNameOrOptions] - : never + ? DefaultSchema['Enums'][DefaultSchemaEnumNameOrOptions] + : never export type CompositeTypes< PublicCompositeTypeNameOrOptions extends @@ -1097,14 +1097,14 @@ export type CompositeTypes< schema: keyof DatabaseWithoutInternals } ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'] - : never = never + : never = never, > = PublicCompositeTypeNameOrOptions extends { schema: keyof DatabaseWithoutInternals } ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'][CompositeTypeName] : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema['CompositeTypes'] - ? DefaultSchema['CompositeTypes'][PublicCompositeTypeNameOrOptions] - : never + ? DefaultSchema['CompositeTypes'][PublicCompositeTypeNameOrOptions] + : never export const Constants = { personal: {