@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.24 kB
JavaScript
import{copy as e}from"../../i18n/copy.mjs";import t from"../../../constants/constants.mjs";import n from"./to-safe-table-name.mjs";import{getFieldDatabaseConfig as r,isCustomFieldTableType as i,isStorageMode as a}from"../custom-fields/storage/index.mjs";import{collectionTableParts as o}from"./table-parts.mjs";const s=(s,c,l)=>{let u=[o.document,c.collection];switch(s){case`document`:break;case`versions`:u.push(o.versions);break;case`brick`:if(!c.brick)return{data:void 0,error:{message:e(`server:core.collections.migration.table.name.brick.key.missing.message`)}};u.push(c.brick);break;case`document-fields`:u.push(o.fields);break}if(i(s)){if(c.fieldPath===void 0||c.fieldPath.length===0)return{data:void 0,error:{message:e(`server:core.collections.migration.table.name.repeater.keys.missing.message`)}};let t=r(s);if(!t||!a(t,`tree-table`)&&!a(t,`relation-table`))return{data:void 0,error:{message:e(`server:core.collections.schema.table.name.format.insufficient.parts`)}};let n=c.brick??o.fields;u.push(n),u.push(t.separator),u.push(...c.fieldPath)}let d=n(`${t.db.prefix}${u.join(t.db.nameSeparator)}`,l);return{data:{name:d.name,rawName:d.rawName},error:void 0}};export{s as default};
//# sourceMappingURL=build-table-name.mjs.map