UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 5.01 kB
import{translate as e}from"../libs/i18n/translate.mjs";import{AuthProviderSchema as t}from"../libs/auth-providers/schema.mjs";import n from"zod";const r={getCSRF:{body:void 0,query:{string:void 0,formatted:void 0},params:void 0,response:n.object({_csrf:n.string().meta({description:`Store this value and use it for the X-CSRF-Token header on required endpoints.`,example:`55b26b90b9715d0e9cc425e8f1ba565cad5157e3d56ae8380d8c832a5fb3fcb7`})})},login:{body:n.object({usernameOrEmail:n.string().trim().meta({description:`Username or email address`,example:`admin`}),password:n.string().meta({description:`User password`,example:`password`})}).meta({description:`User credentials for login`}),query:{string:void 0,formatted:void 0},params:void 0,response:void 0},token:{body:void 0,query:{string:void 0,formatted:void 0},params:void 0,response:void 0},logout:{body:void 0,query:{string:void 0,formatted:void 0},params:void 0,response:void 0},setupRequired:{body:void 0,query:{string:void 0,formatted:void 0},params:void 0,response:n.object({setupRequired:n.boolean().meta({description:`Whether initial user setup is required`,example:!0})})},setup:{body:n.object({email:n.email().trim().toLowerCase().meta({description:`Admin user email address`,example:`admin@example.com`}),username:n.string().trim().meta({description:`Admin username`,example:`admin`}),firstName:n.string().trim().meta({description:`Admin first name`,example:`John`}).optional(),lastName:n.string().trim().meta({description:`Admin last name`,example:`Doe`}).optional(),password:n.string().meta({description:`Admin password`,example:`securepassword123`})}).meta({description:`Initial admin user setup data`}),query:{string:void 0,formatted:void 0},params:void 0,response:void 0},getProviders:{body:void 0,query:{string:void 0,formatted:void 0},params:void 0,response:n.object({disablePassword:n.boolean().meta({description:`Whether password login is disabled`,example:!1}),providers:n.array(t.omit({config:!0}))})},validateInvitation:{body:void 0,query:{string:void 0,formatted:void 0},params:n.object({token:n.string().meta({description:`The invitation token`,example:`abc123def456`})}),response:n.union([n.object({valid:n.literal(!0).meta({description:`Indicates the token is valid`,example:!0}),user:n.object({id:n.number().meta({description:`The user's ID`,example:1}),email:n.string().meta({description:`The user's email address`,example:`user@example.com`}),username:n.string().meta({description:`The user's username`,example:`johndoe`}),firstName:n.string().nullable().meta({description:`The user's first name`,example:`John`}),lastName:n.string().nullable().meta({description:`The user's last name`,example:`Doe`})})}),n.object({valid:n.literal(!1).meta({description:`Indicates the token is not valid`,example:!1})})])},acceptInvitation:{body:n.object({password:n.string().min(8).max(128).meta({description:`Your new password`,example:`password123`}),passwordConfirmation:n.string().min(8).max(128).meta({description:`A repeat of your new password`,example:`password123`})}).refine(e=>e.password===e.passwordConfirmation,{message:e(`server:core.input.ensure.passwords.match`),path:[`passwordConfirmation`]}),query:{string:void 0,formatted:void 0},params:n.object({token:n.string().meta({description:`The invitation token`,example:`abc123def456`})}),response:void 0},providerInitiate:{body:n.object({invitationToken:n.string().meta({description:`An optional invitation token. This is used so on user invite acceptance, providers can be used to authenticate the user.`,example:`abc123def456`}).optional(),actionType:n.enum([`invitation`,`authenticated-link`,`login`]).meta({description:`The type of action to be performed by the auth provider on callback. Are we accepting an invitation (so we should verify the token, user etc.), are we just logging in, or are we authenticated and attempting to link a new provider?`,example:`login`}),redirectPath:n.string().trim().meta({description:`The redirect path on a successful callback`,example:`/lucid`}).optional()}),query:{string:void 0,formatted:void 0},params:n.object({providerKey:n.string().trim().meta({description:`The provider key`,example:`google`})}),response:n.object({redirectUrl:n.string().meta({description:`The redirect URL`,example:`https://example.com/auth/callback`})})},providerOIDCCallback:{body:void 0,query:{string:n.object({code:n.string().meta({description:`The authorization code returned by the OAuth provider`,example:`4/0AY0e-g7xQZ9...`}),state:n.string().meta({description:`The state token for CSRF protection`,example:`abc123def456`})}),formatted:n.object({code:n.string().meta({description:`The authorization code returned by the OAuth provider`,example:`4/0AY0e-g7xQZ9...`}),state:n.string().meta({description:`The state token for CSRF protection`,example:`abc123def456`})})},params:n.object({providerKey:n.string().trim().meta({description:`The provider key`,example:`google`})}),response:void 0}};export{r as controllerSchemas}; //# sourceMappingURL=auth.mjs.map