@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 2.67 kB
Source Map (JSON)
{"version":3,"file":"verify-email-change-revert.mjs","names":["accountServices.verifyEmailChangeRevert"],"sources":["../../../../../src/libs/http/controllers/account/verify-email-change-revert.ts"],"sourcesContent":["import { createFactory } from \"hono/factory\";\nimport { describeRoute } from \"hono-openapi\";\nimport { controllerSchemas } from \"../../../../schemas/account.js\";\nimport { accountServices } from \"../../../../services/index.js\";\nimport { LucidAPIError } from \"../../../../utils/errors/index.js\";\nimport serviceWrapper from \"../../../../utils/services/service-wrapper.js\";\nimport { copy } from \"../../../i18n/index.js\";\nimport validate from \"../../middleware/validate.js\";\nimport openAPI from \"../../openapi/index.js\";\nimport createServiceContext from \"../../utils/create-service-context.js\";\n\nconst factory = createFactory();\n\nconst verifyEmailChangeRevertController = factory.createHandlers(\n\tdescribeRoute({\n\t\tdescription: \"Verifies an email change cancel/revert token is valid.\",\n\t\ttags: [\"account\"],\n\t\tsummary: \"Verify Email Change Revert Token\",\n\t\tresponses: openAPI.responses(),\n\t\tparameters: openAPI.parameters({\n\t\t\tparams: controllerSchemas.verifyEmailChangeRevert.params,\n\t\t}),\n\t}),\n\tvalidate(\"param\", controllerSchemas.verifyEmailChangeRevert.params),\n\tasync (c) => {\n\t\tconst { token } = c.req.valid(\"param\");\n\t\tconst context = createServiceContext(c);\n\n\t\tconst tokenResult = await serviceWrapper(\n\t\t\taccountServices.verifyEmailChangeRevert,\n\t\t\t{\n\t\t\t\ttransaction: false,\n\t\t\t\tdefaultError: {\n\t\t\t\t\ttype: \"basic\",\n\t\t\t\t\tname: copy(\n\t\t\t\t\t\t\"server:core.routes.verify.email.change.revert.error.message\",\n\t\t\t\t\t),\n\t\t\t\t\tmessage: copy(\n\t\t\t\t\t\t\"server:core.routes.verify.email.change.revert.error.message\",\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t)(context, {\n\t\t\ttoken,\n\t\t});\n\n\t\tif (tokenResult.error) throw new LucidAPIError(tokenResult.error);\n\n\t\tc.status(204);\n\t\treturn c.body(null);\n\t},\n);\n\nexport default verifyEmailChangeRevertController;\n"],"mappings":"2hBAaA,MAAM,EAFU,EAEgC,CAAC,CAAC,eACjD,EAAc,CACb,YAAa,yDACb,KAAM,CAAC,SAAS,EAChB,QAAS,mCACT,UAAW,EAAQ,UAAU,EAC7B,WAAY,EAAQ,WAAW,CAC9B,OAAQ,EAAkB,wBAAwB,MACnD,CAAC,CACF,CAAC,EACD,EAAS,QAAS,EAAkB,wBAAwB,MAAM,EAClE,KAAO,IAAM,CACZ,GAAM,CAAE,SAAU,EAAE,IAAI,MAAM,OAAO,EAC/B,EAAU,EAAqB,CAAC,EAEhC,EAAc,MAAM,EACzBA,EACA,CACC,YAAa,GACb,aAAc,CACb,KAAM,QACN,KAAM,EACL,6DACD,EACA,QAAS,EACR,6DACD,CACD,CACD,CACD,CAAC,CAAC,EAAS,CACV,OACD,CAAC,EAED,GAAI,EAAY,MAAO,MAAM,IAAI,EAAc,EAAY,KAAK,EAGhE,OADA,EAAE,OAAO,GAAG,EACL,EAAE,KAAK,IAAI,CACnB,CACD"}