Deleted unnecessary schema files and reorganized their imports into more logical order. Modified the package script structure to align more accurately with standard conventions. Also refactored the team-billing.service file to improve action structure, making it easier to understand and edit. Furthermore, upgraded various dependencies, reflecting their new versions in the lockfile.
61 lines
1.3 KiB
TypeScript
61 lines
1.3 KiB
TypeScript
import type { Provider } from '@supabase/gotrue-js';
|
|
|
|
import { z } from 'zod';
|
|
|
|
const providers: z.ZodType<Provider> = getProviders();
|
|
|
|
const AuthConfigSchema = z.object({
|
|
captchaTokenSiteKey: z.string().min(1).optional(),
|
|
providers: z.object({
|
|
password: z.boolean({
|
|
description: 'Enable password authentication.',
|
|
}),
|
|
magicLink: z.boolean({
|
|
description: 'Enable magic link authentication.',
|
|
}),
|
|
oAuth: providers.array(),
|
|
}),
|
|
});
|
|
|
|
const authConfig = AuthConfigSchema.parse({
|
|
// NB: This is a public key, so it's safe to expose.
|
|
// Copy the value from the Supabase Dashboard.
|
|
captchaTokenSiteKey: process.env.NEXT_PUBLIC_CAPTCHA_SITE_KEY,
|
|
|
|
// NB: Enable the providers below in the Supabase Console
|
|
// in your production project
|
|
providers: {
|
|
password: process.env.NEXT_PUBLIC_AUTH_PASSWORD === 'true',
|
|
magicLink: process.env.NEXT_PUBLIC_AUTH_MAGIC_LINK === 'true',
|
|
oAuth: ['google'],
|
|
},
|
|
} satisfies z.infer<typeof AuthConfigSchema>);
|
|
|
|
export default authConfig;
|
|
|
|
function getProviders() {
|
|
return z.enum([
|
|
'apple',
|
|
'azure',
|
|
'bitbucket',
|
|
'discord',
|
|
'facebook',
|
|
'figma',
|
|
'github',
|
|
'gitlab',
|
|
'google',
|
|
'kakao',
|
|
'keycloak',
|
|
'linkedin',
|
|
'linkedin_oidc',
|
|
'notion',
|
|
'slack',
|
|
'spotify',
|
|
'twitch',
|
|
'twitter',
|
|
'workos',
|
|
'zoom',
|
|
'fly',
|
|
]);
|
|
}
|