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.95 kB
import{resolvedAdminCopySchema as e}from"../libs/i18n/copy.mjs";import{fieldConfigSchema as t}from"./collection-fields.mjs";import{brickConfigSchema as n}from"./collection-bricks.mjs";import r from"zod";const i=r.object({requiresMigration:r.boolean().meta({description:`Whether the collection requires a database migration`,example:!1}),missingColumns:r.record(r.string(),r.array(r.string())).meta({description:`Columns that are missing from the database`,example:{"document-fields":[`title`]}}),hiddenFields:r.record(r.string(),r.array(r.string())).meta({description:`Fields that are hidden from the collection`,example:{banner:[`heading`]}})}),a=r.object({key:r.string().meta({description:`The collection key`,example:`page`}),mode:r.enum([`single`,`multiple`]).meta({description:`Whether the collection has one document or multiple documents`,example:`multiple`}),group:r.object({key:r.string().meta({description:`The collection group key`,example:`content`}),name:e.nullable().meta({description:`Display name for the collection group`,example:{type:`lucid.copy`,scope:`admin`,key:`collections.groups.content.name`,defaultMessage:`Content`}}),order:r.number().nullable().meta({description:`Optional order value for sorting collection groups`,example:10})}).nullable().meta({description:`Admin navigation group metadata for the collection`}),documentId:r.number().nullable().meta({description:`The document ID if the collection is mode "single" and had one created`,example:1}).optional(),details:r.object({name:e.meta({description:`Display name for the collection`,example:{type:`lucid.copy`,scope:`admin`,key:`collections.page.name`,defaultMessage:`Pages`}}),singularName:e.meta({description:`Singular display name for items in the collection`,example:{type:`lucid.copy`,scope:`admin`,key:`collections.page.singularName`,defaultMessage:`Page`}}),summary:e.nullable().meta({description:`Description text for the collection`,example:{type:`lucid.copy`,scope:`admin`,key:`collections.page.summary`,defaultMessage:`Manage the pages and content on your website.`}})}),localized:r.boolean().meta({description:`Whether the collection supports localized content`,example:!0}),revisions:r.boolean().meta({description:`Whether the collection supports document revisions`,example:!0}),autoSave:r.boolean().meta({description:`Whether the collection supports auto-save`,example:!0}),scheduling:r.boolean().meta({description:`Whether the collection has release scheduling enabled`,example:!1}),orderable:r.boolean().meta({description:`Whether documents in the collection support manual ordering`,example:!1}),revisionRetentionDays:r.union([r.number(),r.literal(!1)]).meta({description:`Number of days to retain unprotected revisions, or false to retain indefinitely`,example:30}),locked:r.boolean().meta({description:`Whether the collection structure is locked from editing`,example:!1}),review:r.object({requiredFor:r.array(r.string()),allowSelfApproval:r.boolean(),comments:r.object({request:r.enum([`required`,`optional`]),decision:r.enum([`required`,`optional`])})}).optional(),workflow:r.object({initial:r.string(),stages:r.array(r.object({key:r.string(),name:e,color:r.enum([`grey`,`red`,`yellow`,`green`,`blue`,`purple`]),publishTargets:r.array(r.string())}))}).optional(),listing:r.array(r.string()).meta({description:`Field keys included in the document listing columns`,example:[`pageTitle`,`author`,`fullSlug`,`slug`]}),labelFields:r.array(r.string()).meta({description:`Field keys used, in order, to build the main document display label`,example:[`pageTitle`,`slug`]}),environments:r.array(r.object({key:r.string().meta({description:`The environment key`,example:`production`}),name:e.meta({description:`Display name for the environment`,example:{type:`lucid.copy`,scope:`admin`,key:`collections.page.environments.production.name`,defaultMessage:`Production`}}),requires:r.array(r.string()).meta({description:`Environment keys that must match latest before releases can be created for this environment`,example:[`staging`]}),permissions:r.object({publish:r.string().meta({description:`Permission required to publish to this environment`,example:`documents:pages:publish`}),review:r.string().meta({description:`Permission required to review releases for this environment`,example:`documents:pages:review`})})})),preview:r.object({breakpoints:r.array(r.object({key:r.string().meta({description:`The preview breakpoint key`,example:`mobile`}),label:e.meta({description:`Display label for the preview breakpoint`,example:{type:`lucid.literal`,value:`Mobile`}}),width:r.number().int().min(280).max(2560).meta({description:`Preview viewport width in pixels`,example:390})}))}).nullable().meta({description:`Builder preview configuration exposed to the admin interface`}),capabilities:r.object({scheduling:r.boolean().meta({description:`Whether this collection can create scheduled releases in the current runtime`,example:!1}),preview:r.boolean().meta({description:`Whether this collection has a page preview URL resolver`,example:!0})}),permissions:r.object({read:r.string(),create:r.string(),update:r.string(),delete:r.string(),restore:r.string(),publish:r.string(),review:r.string()}),migrationStatus:i.nullable(),get fixedBricks(){return r.array(n).meta({description:`Fixed (non-movable) bricks for all documents in the collection`,example:[]}).optional()},get builderBricks(){return r.array(n).meta({description:`Builder bricks that can be added to documents in the collection`,example:[]}).optional()},get fields(){return r.array(t).meta({description:`Fields that make up documents in the collection`,example:[]})}}),o={getSingle:{body:void 0,query:{string:void 0,formatted:void 0},params:r.object({key:r.string().meta({description:`The collection key`,example:`page`})}),response:a},getAll:{body:void 0,query:{string:void 0,formatted:void 0},params:void 0,response:r.array(a)}};export{o as controllerSchemas}; //# sourceMappingURL=collections.mjs.map