UNPKG

@lucidcms/core

Version:

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

2 lines 1.6 kB
import{copy as e}from"../../../../i18n/copy.mjs";import t from"../../../../../utils/errors/lucid-api-error.mjs";import n from"../../../../kv/cache-keys.mjs";import r from"../../../utils/create-service-context.mjs";import{ClientScopes as i}from"../../../../permission/client-scopes.mjs";import a from"../../../../../utils/services/service-wrapper.mjs";import o from"../../../../../services/locales/client/get-all.mjs";import s from"../../../middleware/cache.mjs";import c from"../../../middleware/client-authenticate.mjs";import l from"../../../openapi/index.mjs";import u from"../../../utils/build-response.mjs";import d from"../../../middleware/client-scopes.mjs";import{controllerSchemas as f}from"../../../../../schemas/locales.mjs";import p from"zod";import{hoursToSeconds as m}from"date-fns";import{createFactory as h}from"hono/factory";import{describeRoute as g}from"hono-openapi";const _=h().createHandlers(g({description:`Returns all enabled locales via the client integration.`,tags:[`client-locales`],summary:`Get All Locales`,responses:l.responses({schema:p.toJSONSchema(f.client.getAll.response),paginated:!0}),parameters:l.parameters({headers:{authorization:!0}})}),c,d([i.LocalesRead]),s({ttl:m(24),mode:`static`,staticKey:n.http.static.clientLocales}),async n=>{let i=r(n),s=await a(o,{transaction:!1,defaultError:{type:`basic`,name:e(`server:core.routes.locale.fetch.error.name`),message:e(`server:core.routes.locale.fetch.error.message`)}})(i);if(s.error)throw new t(s.error);return n.status(200),n.json(u(n,{data:s.data}))});export{_ as default}; //# sourceMappingURL=get-all.mjs.map