@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 12.4 kB
JavaScript
import{resolvedAdminCopySchema as e}from"../libs/i18n/copy.mjs";import{translate as t}from"../libs/i18n/translate.mjs";import{queryFormatted as n,queryString as r}from"./helpers/querystring.mjs";import{mediaCropInputSchema as i,mediaOriginSchema as a,profilePictureResponseSchema as o}from"./media.mjs";import s from"zod";const c=s.object({id:s.string().trim().meta({description:`The user's ID`,example:1})}),l=s.object({localeCode:s.string().trim().meta({description:`The locale code for the translated profile picture metadata`,example:`en`}),value:s.string().trim().nullable().meta({description:`The translated value`,example:`Profile photo`})}),u=s.object({fileName:s.string().trim().meta({description:`The profile picture file name`,example:`profile.png`}),mimeType:s.string().trim().meta({description:`The profile picture MIME type`,example:`image/png`}),size:s.number().nonnegative().meta({description:`The file size in bytes`,example:1048576})}),d=s.object({partNumber:s.number().int().positive(),etag:s.string().trim(),size:s.number().nonnegative().optional()}),f=s.discriminatedUnion(`mode`,[s.object({mode:s.literal(`single`),key:s.string(),url:s.string(),headers:s.record(s.string(),s.string()).optional()}),s.object({mode:s.literal(`resumable`),key:s.string(),sessionId:s.string(),partSize:s.number(),expiresAt:s.string(),uploadedParts:s.array(d)})]),p=s.object({crop:i.nullable().optional(),key:s.string().trim().optional().meta({description:`The uploaded media key`,example:`public/123e4567e89b12d3a456426614174000`}),fileName:s.string().trim().optional().meta({description:`The profile picture file name`,example:`profile.png`}),width:s.number().optional().meta({description:`The image width`,example:100}),height:s.number().optional().meta({description:`The image height`,example:100}),focalPoint:s.object({x:s.number().min(0).max(1).meta({description:`Horizontal focal point, normalized from 0 to 1`,example:.5}),y:s.number().min(0).max(1).meta({description:`Vertical focal point, normalized from 0 to 1`,example:.5})}).nullable().optional().meta({description:`The image focal point`}),blurHash:s.string().trim().optional().meta({description:`The blur hash`,example:`AQABAAAABAAAAgAA...`}),averageColor:s.string().trim().optional().meta({description:`The average color`,example:`rgba(255, 255, 255, 1)`}),base64:s.string().trim().nullable().optional().meta({description:`Tiny base64-encoded image placeholder`,example:`data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoKAAcAAUAmJQBOgCH5AQAA`}),isDark:s.boolean().optional().meta({description:`Whether the image is dark`,example:!0}),isLight:s.boolean().optional().meta({description:`Whether the image is light`,example:!0}),origin:a.optional().meta({description:`The provenance origin of the profile picture`,example:`human`}),aiGenerationRequestId:s.string().trim().optional().meta({description:`The AI generation request ID to link to this profile picture`,example:`123e4567-e89b-12d3-a456-426614174000`}),title:s.array(l).optional().meta({description:`Translated profile picture titles`}),alt:s.array(l).optional().meta({description:`Translated profile picture alt text`})}).refine(e=>e.key===void 0==(e.fileName===void 0),{message:t(`server:core.profile.picture.file.name.key.required`),path:[`fileName`]}),m=s.string().meta({description:`A permission identifier`,example:`users:create`}),h=s.object({id:s.number().meta({description:`The role ID`,example:1}),name:s.string().meta({description:`The role name`,example:`Admin`})}),g=s.object({id:s.number().meta({description:`The user's ID`,example:1}),superAdmin:s.boolean().meta({description:`Whether the user is a superadmin.`,example:!0}).optional(),email:s.email().meta({description:`The user's email address`,example:`admin@lucidcms.io`}),pendingEmailChange:s.object({email:s.email().meta({description:`The pending email address awaiting confirmation`,example:`new-admin@lucidcms.io`}),requestedAt:s.string().nullable().meta({description:`When the email change was requested`,example:`2021-06-10T20:00:00.000Z`}),expiresAt:s.string().nullable().meta({description:`When the pending email change expires`,example:`2021-06-11T20:00:00.000Z`})}).nullable().optional(),profilePicture:o.nullable().meta({description:`The user's profile picture media reference`}),username:s.string().meta({description:`The user's username`,example:`admin`}),firstName:s.string().nullable().meta({description:`The user's first name`,example:`John`}),lastName:s.string().nullable().meta({description:`The user's last name`,example:`Smith`}),isLocked:s.boolean().meta({description:`If the user is locked from logging in`,example:!1}).optional(),triggerPasswordReset:s.boolean().nullable().meta({description:`Should the UI force a password reset?`,example:!1}).optional(),invitationAccepted:s.boolean().meta({description:`If the user has accepted the invitation`,example:!0}).optional(),roles:s.array(h).meta({description:`The user's roles`}).optional(),permissions:s.array(m).optional(),tenants:s.array(s.object({key:s.string().meta({description:`The tenant key`,example:`alpha`}),name:e.meta({description:`The tenant's name`,example:{type:`lucid.copy`,scope:`admin`,key:`tenants.alpha.name`,defaultMessage:`Alpha`}}),default:s.boolean().optional().meta({description:`Whether this tenant is the default admin selection`,example:!0})})).meta({description:`The tenants the user has access to`}).optional(),isDeleted:s.boolean().meta({description:`If the user is soft-deleted or not`,example:!0}),deletedAt:s.string().nullable().meta({description:`The date the user was deleted`,example:`2021-06-10T20:00:00.000Z`}).optional(),createdAt:s.string().nullable().meta({description:`The date the user was added`,example:`2021-06-10T20:00:00.000Z`}).optional(),updatedAt:s.string().nullable().meta({description:`The date the user row was last updated`,example:`2021-06-10T20:00:00.000Z`}).optional(),hasPassword:s.boolean().meta({description:`Whether the user has a password set`,example:!0}).optional(),authProviders:s.array(s.object({id:s.number().meta({description:`The auth provider link ID`,example:1}),providerKey:s.string().meta({description:`The provider key`,example:`github`}),providerUserId:s.string().meta({description:`The provider's user identifier for this user`,example:`123456`}),linkedAt:s.string().nullable().meta({description:`When the provider was linked`,example:null})})).meta({description:`Actively linked auth providers for the user`}).optional()}),_={createSingle:{body:s.object({email:s.email().trim().toLowerCase().meta({description:`The user's email address`,example:`admin@lucidcms.io`}),username:s.string().trim().meta({description:`The user's username`,example:`Admin`}),roleIds:s.array(s.number()).meta({description:`A list of role IDs to attach to the user`,example:[1,2]}),firstName:s.string().trim().meta({description:`The user's first name`,example:`John`}).optional(),lastName:s.string().trim().meta({description:`The user's last name`,example:`Smith`}).optional(),superAdmin:s.boolean().meta({description:`Whether the user is a super admin or not`,example:!0}).optional(),tenantKeys:s.array(s.string()).meta({description:`A list of tenant keys to give the user access to. Only super admins can set this, for other users the new user is added to the current tenant. Required for standard users when multi-tenancy is enabled.`,example:[`alpha`]}).optional()}),query:{string:void 0,formatted:void 0},params:void 0,response:void 0},updateSingle:{body:s.object({roleIds:s.array(s.number()).meta({description:`A list of role IDs to attach to the user`,example:[1,2]}).optional(),superAdmin:s.boolean().meta({description:`Whether the user is a super admin or not`,example:!0}).optional(),triggerPasswordReset:s.boolean().meta({description:`Whether the user should be forced to update their password in the UI`,example:!0}).optional(),isDeleted:s.literal(!1).meta({description:`Restore a deleted user`,example:!1}).optional(),isLocked:s.boolean().meta({description:`Lock or unlock the user`,example:!1}).optional(),tenantKeys:s.array(s.string()).meta({description:`A list of tenant keys to give the user access to. Replaces the user's existing tenant memberships. Only super admins can set this. Required for standard users when multi-tenancy is enabled.`,example:[`alpha`]}).optional()}),query:{string:void 0,formatted:void 0},params:c,response:void 0},createProfilePictureUploadSession:{body:u,query:{string:void 0,formatted:void 0},params:c,response:f},updateProfilePicture:{body:p,query:{string:void 0,formatted:void 0},params:c,response:void 0},deleteProfilePicture:{body:void 0,query:{string:void 0,formatted:void 0},params:c,response:void 0},getSingle:{body:void 0,query:{string:void 0,formatted:void 0},params:c,response:g},getMultiple:{query:{string:s.object({"filter[firstName]":r.schema.filter(!1,{example:`John`}),"filter[lastName]":r.schema.filter(!1,{example:`Smith`}),"filter[email]":r.schema.filter(!1,{example:`team@lucidjs.build`}),"filter[username]":r.schema.filter(!1,{example:`admin`}),"filter[roleIds]":r.schema.filter(!0,{example:`1,2,3`}),"filter[id]":r.schema.filter(!0,{example:`1,2`}),"filter[isDeleted]":r.schema.filter(!1,{example:`true`}),"filter[isLocked]":r.schema.filter(!1,{example:`true`}),"filter[invitationAccepted]":r.schema.filter(!1,{example:`true`}),"filter[superAdmin]":r.schema.filter(!1,{example:`true`}),"filter[triggerPasswordReset]":r.schema.filter(!1,{example:`true`}),"filter[deletedBy]":r.schema.filter(!0,{example:`1`}),"filter[createdAt]":r.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),"filter[updatedAt]":r.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),sort:r.schema.sort(`createdAt,updatedAt,firstName,lastName,email,username,isLocked`),include:r.schema.include(`permissions`),page:r.schema.page,perPage:r.schema.perPage}).meta(r.meta),formatted:s.object({filter:s.object({firstName:n.schema.filters.single.optional(),lastName:n.schema.filters.single.optional(),email:n.schema.filters.single.optional(),username:n.schema.filters.single.optional(),roleIds:n.schema.filters.union.optional(),id:n.schema.filters.union.optional(),isDeleted:n.schema.filters.single.optional(),isLocked:n.schema.filters.single.optional(),invitationAccepted:n.schema.filters.single.optional(),superAdmin:n.schema.filters.single.optional(),triggerPasswordReset:n.schema.filters.single.optional(),deletedBy:n.schema.filters.union.optional(),createdAt:n.schema.filters.single.optional(),updatedAt:n.schema.filters.single.optional()}).optional(),filterOr:n.schema.filterOr,sort:s.array(s.object({key:s.enum([`createdAt`,`updatedAt`,`firstName`,`lastName`,`email`,`username`,`isLocked`]),direction:s.enum([`asc`,`desc`])})).optional(),include:s.array(s.enum([`permissions`])).optional(),page:n.schema.page,perPage:n.schema.perPage})},params:void 0,body:void 0,response:s.array(g)},restoreMultiple:{body:s.object({ids:s.array(s.number()).meta({description:`An array of user IDs you wish to restore`,example:[1,2,3]})}),query:{string:void 0,formatted:void 0},params:void 0,response:void 0},unlinkAuthProvider:{body:void 0,query:{string:void 0,formatted:void 0},params:s.object({id:s.string().trim().meta({description:`The user's ID`,example:1}),providerId:s.string().trim().min(1).meta({description:`The provider key you wish to unlink`,example:`github`})}),response:void 0},deleteSingle:{body:void 0,query:{string:void 0,formatted:void 0},params:s.object({id:s.string().trim().meta({description:`The user's ID`,example:1})}),response:void 0},deleteSinglePermanently:{body:void 0,query:{string:void 0,formatted:void 0},params:s.object({id:s.string().trim().meta({description:`The user's ID`,example:1})}),response:void 0},deleteMultiplePermanently:{body:s.object({ids:s.array(s.number()).meta({description:`An array of user IDs you wish to permanently delete`,example:[1,2,3]})}),query:{string:void 0,formatted:void 0},params:void 0,response:void 0},resendInvitation:{body:void 0,query:{string:void 0,formatted:void 0},params:s.object({id:s.string().trim().meta({description:`The user's ID`,example:1})}),response:void 0},revokeRefreshTokens:{body:void 0,query:{string:void 0,formatted:void 0},params:s.object({id:s.string().trim().meta({description:`The user's ID`,example:1})}),response:void 0}};export{_ as controllerSchemas,g as userResponseSchema};
//# sourceMappingURL=users.mjs.map