@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 666 B
JavaScript
import{copy as e}from"../../i18n/copy.mjs";import t from"../../../utils/errors/lucid-api-error.mjs";import{createMiddleware as n}from"hono/factory";const r=(n,r)=>{let i=n.get(`clientIntegrationAuth`),a=r.filter(e=>!i.scopes.includes(e));if(!r.every(e=>i.scopes.includes(e)))throw new t({type:`authorisation`,name:e(`server:core.client.integrations.scopes.error.name`),message:e(`server:core.client.integrations.scopes.missing.message`,{data:{requiredScopes:r.join(`, `),missingScopes:a.join(`, `)}}),status:403})},i=e=>n(async(t,n)=>(r(t,typeof e==`function`?e(t):e),await n()));export{r as clientScopeCheck,i as default};
//# sourceMappingURL=client-scopes.mjs.map