recipes.ts57 lines · main
| 1 | /** |
| 2 | * briven-engine recipe catalog (documentation + status only). |
| 3 | * Implementation is Doltgres-native — not SuperTokens Core recipes at runtime. |
| 4 | */ |
| 5 | |
| 6 | export type AuthCoreRecipePhase = 2 | 3 | 4 | 5 | 6; |
| 7 | |
| 8 | export const BRIVEN_ENGINE_RECIPE_CATALOG = [ |
| 9 | { id: 'session', phase: 2, title: 'Sessions', sms: false }, |
| 10 | { id: 'emailpassword', phase: 3, title: 'Email + password', sms: false }, |
| 11 | { id: 'passwordless', phase: 3, title: 'Passwordless (email + SMS)', sms: true }, |
| 12 | { id: 'thirdparty', phase: 3, title: 'Social / third-party', sms: false }, |
| 13 | { id: 'emailverification', phase: 3, title: 'Email verification', sms: false }, |
| 14 | { id: 'webauthn', phase: 3, title: 'Passkeys (WebAuthn)', sms: false }, |
| 15 | { id: 'multifactorauth', phase: 4, title: 'Multi-factor auth', sms: true }, |
| 16 | { id: 'totp', phase: 4, title: 'TOTP (authenticator app)', sms: false }, |
| 17 | { id: 'userroles', phase: 4, title: 'Roles + permissions', sms: false }, |
| 18 | { id: 'usermetadata', phase: 5, title: 'User metadata', sms: false }, |
| 19 | { id: 'accountlinking', phase: 5, title: 'Account linking', sms: false }, |
| 20 | { id: 'dashboard', phase: 5, title: 'Engine dashboard API', sms: false }, |
| 21 | { id: 'multitenancy', phase: 6, title: 'Multitenancy (projects)', sms: false }, |
| 22 | { id: 'oauth2provider', phase: 6, title: 'OAuth2 / IdP', sms: false }, |
| 23 | { id: 'openid', phase: 6, title: 'OpenID', sms: false }, |
| 24 | { id: 'jwt', phase: 6, title: 'JWT', sms: false }, |
| 25 | { id: 'saml', phase: 6, title: 'SAML', sms: false }, |
| 26 | ] as const; |
| 27 | |
| 28 | export function getRecipePhase(): AuthCoreRecipePhase { |
| 29 | const raw = process.env.BRIVEN_AUTH_CORE_RECIPE_PHASE; |
| 30 | if (raw === '2' || raw === '3' || raw === '4' || raw === '5' || raw === '6') { |
| 31 | return Number(raw) as AuthCoreRecipePhase; |
| 32 | } |
| 33 | return 3; |
| 34 | } |
| 35 | |
| 36 | /** No SuperTokens recipe list — Doltgres-native engine. */ |
| 37 | export async function buildRecipeList(): Promise<{ |
| 38 | recipes: never[]; |
| 39 | phase: AuthCoreRecipePhase; |
| 40 | names: string[]; |
| 41 | engine: 'briven-engine'; |
| 42 | smsIncluded: boolean; |
| 43 | storage: 'doltgres'; |
| 44 | }> { |
| 45 | const phase = getRecipePhase(); |
| 46 | const names = BRIVEN_ENGINE_RECIPE_CATALOG.filter((r) => r.phase <= phase).map( |
| 47 | (r) => r.id, |
| 48 | ); |
| 49 | return { |
| 50 | recipes: [], |
| 51 | phase, |
| 52 | names, |
| 53 | engine: 'briven-engine', |
| 54 | smsIncluded: names.includes('passwordless'), |
| 55 | storage: 'doltgres', |
| 56 | }; |
| 57 | } |