@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.08 kB
JavaScript
import e from"../../constants/constants.mjs";import{getTenantConfig as t}from"../helpers/tenants.mjs";const n=t=>t!==void 0&&Object.values(e.media.visibilityKeys).includes(t),r=t=>n(t)||t===e.media.awaitingSyncKey,i=t=>t!==void 0&&e.media.reservedTenantKeys.includes(t),a=e=>e!==void 0&&/^[a-f0-9]{32}$/i.test(e),o=t=>{let o=Array.isArray(t)?t:t.split(`/`).filter(Boolean),s=r(o[0])?o[0]:null,c=s?0:-1,l=n(s??void 0)?s:null,u=l?c:-1,d=o[c+1],f=c!==-1&&o[c+2]!==void 0&&!i(d)&&!a(d)?c+1:-1,p=c===-1?-1:f===-1?c+1:f+1,m=u!==-1&&o[p]===e.media.processedKey?p:-1,h=c===-1?-1:m===-1?p:m+1;return{parts:o,root:s,rootIndex:c,visibility:l,visibilityIndex:u,tenantKey:f===-1?null:o[f]??null,tenantIndex:f,scopedPathStartIndex:p,processedIndex:m,identityIndex:h,identity:h===-1?null:o[h]??null,isProcessed:m!==-1}},s=e=>o(e).tenantKey,c=(e,n)=>!n||!Array.isArray(e.tenants)?null:t(e,n)??null,l=(e,t)=>c(e,s(t));export{o as getMediaKeyParts,s as getMediaKeyTenantKey,a as isGeneratedMediaIdSegment,l as resolveMediaKeyTenant,c as resolveMediaTenant};
//# sourceMappingURL=media-key-tenant.mjs.map