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.63 kB
import{copy as e}from"../../../i18n/copy.mjs";import t from"../../../../constants/constants.mjs";import n from"../../../../utils/errors/lucid-api-error.mjs";import r from"../../../../services/account/revoke-all-refresh-tokens.mjs";import i from"../../../../services/auth/access-token/clear-token.mjs";import a from"../../../../services/auth/csrf/clear-token.mjs";import o from"../../utils/create-service-context.mjs";import s from"../../../../services/auth/refresh-token/clear-token.mjs";import c from"../../../../utils/services/service-wrapper.mjs";import l from"../../middleware/authenticate.mjs";import u from"../../middleware/validate-csrf.mjs";import d from"../../openapi/index.mjs";import{createFactory as f}from"hono/factory";import{describeRoute as p}from"hono-openapi";const m=f().createHandlers(p({description:`Revoke all refresh tokens for the authenticated user and clear the current auth session.`,tags:[`account`],summary:`Revoke All Authenticated User Refresh Tokens`,responses:d.responses(),parameters:d.parameters({headers:{csrf:!0}})}),u,l(),async l=>{let u=o(l),d=l.get(`auth`),f=await c(r,{transaction:!1,defaultError:{type:`basic`,name:e(`server:core.routes.user.me.update.error.name`),message:e(`server:core.routes.user.me.update.error.message`)}})(u,{userId:d.id});if(f.error)throw new n(f.error);let[p,m,h]=await Promise.all([s(l,{revokeReason:t.refreshTokenRevokeReasons.accountRevokeAll}),i(l),a(l)]);if(p.error)throw new n(p.error);if(m.error)throw new n(m.error);if(h.error)throw new n(h.error);return l.status(204),l.body(null)});export{m as default}; //# sourceMappingURL=revoke-refresh-tokens.mjs.map