UNPKG

@lucidcms/core

Version:

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

2 lines 861 B
import{copy as e}from"../../libs/i18n/copy.mjs";import t from"../../libs/repositories/document-workflows.mjs";import n from"../collections/get-single-instance.mjs";import{getWorkflowConfig as r,workflowStageAllowsTarget as i}from"./helpers/index.mjs";const a=async(a,o)=>{let s=n(a,{key:o.collectionKey});if(s.error)return s;if(!r(s.data))return{error:void 0,data:void 0};let c=await new t(a.db.client,a.config.db).selectSingle({select:[`stage_key`],where:[{key:`collection_key`,operator:`=`,value:o.collectionKey},{key:`document_id`,operator:`=`,value:o.documentId}]});return c.error?c:i({collection:s.data,stageKey:c.data?.stage_key,target:o.target})?{error:void 0,data:void 0}:{error:{type:`basic`,message:e(`server:core.documents.workflows.publish.not.allowed`),status:403},data:void 0}};export{a as default}; //# sourceMappingURL=can-publish-target.mjs.map