@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 945 B
JavaScript
import e from"../../../kv/cache-keys.mjs";import{getCollectionSignature as t}from"./cache-signature.mjs";const n=new Map,r=new Map,i=(t,n)=>`${e.collection.schema(t)}:${n}`,a=(e,n)=>{let r=e.config.collections.find(e=>e.key===n);if(r)return t(r)},o=async(e,t)=>{let r=a(e,t);if(!r)return;let o=i(t,r),s=n.get(o);if(s)return s;let c=await e.kv.get(e,{key:o});if(c)return n.set(o,c),c},s=async(e,t)=>await o(e,t)!==void 0,c=async(e,t,r)=>{let o=a(e,t);if(!o)return;let s=i(t,o);n.set(s,r),await e.kv.set(e,{key:s,value:r})},l=async(e,t,n)=>{let s=a(e,t);if(!s)return await n();let l=i(t,s),u=await o(e,t);if(u)return{data:u,error:void 0};let d=r.get(l);if(d)return d;let f=(async()=>{try{let r=await n();return r.error||await c(e,t,r.data),r}finally{r.delete(l)}})();return r.set(l,f),f};export{o as getRuntimeSchemaFromCache,s as hasRuntimeSchema,l as resolveRuntimeSchema,c as setRuntimeSchema};
//# sourceMappingURL=runtime-schema-cache.mjs.map