Update Supabase clients and refactor codebase

Refactored several Supabase client functions and updated them to use generics. Also, the '@kit/supabase-config' package was removed from the project and all references were replaced accordingly. The project's dependencies were updated as well, including the Supabase package which was upgraded to the latest version.
This commit is contained in:
giancarlo
2024-04-11 12:31:08 +08:00
parent 1c344d0d7f
commit 48f1ee90c4
29 changed files with 1337 additions and 96 deletions

View File

@@ -7,13 +7,13 @@ import { z } from 'zod';
import { LineItemSchema } from '@kit/billing';
import { getBillingGatewayProvider } from '@kit/billing-gateway';
import { getLogger } from '@kit/shared/logger';
import { Database } from '@kit/supabase/database';
import { requireUser } from '@kit/supabase/require-user';
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
import appConfig from '~/config/app.config';
import billingConfig from '~/config/billing.config';
import pathsConfig from '~/config/paths.config';
import { Database } from '~/lib/database.types';
import { TeamCheckoutSchema } from '../../_lib/schema/team-billing.schema';
@@ -314,7 +314,7 @@ async function getBillingPermissionsForAccountId(
* customer ID for the provided account ID
*/
async function getCustomerIdFromAccountId(
client: ReturnType<typeof getSupabaseServerActionClient>,
client: ReturnType<typeof getSupabaseServerActionClient<Database>>,
accountId: string,
) {
const { data, error } = await client