@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.22 kB
JavaScript
import e from"./media.mjs";import t from"./index.mjs";const n=e=>{let t=e.collection.getData.workflow;return t?e.stageKey&&t.stages.some(t=>t.key===e.stageKey)?e.stageKey:t.initial:null};var r={formatAssigneeUsers:t=>t.users.map(n=>({id:n.id,email:n.email,username:n.username,firstName:n.firstName,lastName:n.lastName,profilePicture:e.formatProfilePicture({poster:n.profile_picture?.[0],host:t.host})})),formatSingle:r=>{let i=n({collection:r.collection,stageKey:r.workflow?.stage_key});return i?{stage:i,assignees:r.workflow?.assignees?.map(n=>({id:n.id,user:{id:n.user_id,email:n.email??null,username:n.username??null,firstName:n.first_name??null,lastName:n.last_name??null,profilePicture:e.formatProfilePicture({poster:n.profile_picture?.[0],host:r.host})},assignedBy:n.assigned_by,assignedAt:t.formatDate(n.assigned_at)}))??[],createdAt:t.formatDate(r.workflow?.created_at),updatedAt:t.formatDate(r.workflow?.updated_at),updatedBy:r.workflow?.updated_by??null}:null},formatSummary:e=>{let t=n({collection:e.collection,stageKey:e.stageKey});return t?{stage:t,assignees:[],createdAt:null,updatedAt:null,updatedBy:null}:null},getEffectiveStage:n};export{r as default};
//# sourceMappingURL=document-workflows.mjs.map