UNPKG

@lucidcms/core

Version:

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

1 lines 2.54 kB
{"version":3,"file":"retry.mjs","names":["retry","documentPublishOperationServices.retry"],"sources":["../../../../../src/libs/http/controllers/publish-operations/retry.ts"],"sourcesContent":["import { createFactory } from \"hono/factory\";\nimport { describeRoute } from \"hono-openapi\";\nimport { controllerSchemas } from \"../../../../schemas/publish-operation-management.js\";\nimport { documentPublishOperationServices } from \"../../../../services/index.js\";\nimport { LucidAPIError } from \"../../../../utils/errors/index.js\";\nimport serviceWrapper from \"../../../../utils/services/service-wrapper.js\";\nimport authenticate from \"../../middleware/authenticate.js\";\nimport validate from \"../../middleware/validate.js\";\nimport validateCSRF from \"../../middleware/validate-csrf.js\";\nimport openAPI from \"../../openapi/index.js\";\nimport createServiceContext from \"../../utils/create-service-context.js\";\n\nconst factory = createFactory();\n\nconst retryController = factory.createHandlers(\n\tdescribeRoute({\n\t\tdescription: \"Retry a failed publish operation.\",\n\t\ttags: [\"publish-operations\"],\n\t\tsummary: \"Retry Publish Operation\",\n\t\tresponses: openAPI.responses({\n\t\t\tnoProperties: true,\n\t\t}),\n\t\tparameters: openAPI.parameters({\n\t\t\tparams: controllerSchemas.retry.params,\n\t\t\theaders: {\n\t\t\t\tcsrf: true,\n\t\t\t},\n\t\t}),\n\t}),\n\tvalidateCSRF,\n\tauthenticate(),\n\tvalidate(\"param\", controllerSchemas.retry.params),\n\tasync (c) => {\n\t\tconst { id } = c.req.valid(\"param\");\n\t\tconst context = createServiceContext(c);\n\n\t\tconst retry = await serviceWrapper(documentPublishOperationServices.retry, {\n\t\t\ttransaction: true,\n\t\t})(context, {\n\t\t\tid: Number.parseInt(id, 10),\n\t\t\tuser: c.get(\"auth\"),\n\t\t});\n\t\tif (retry.error) throw new LucidAPIError(retry.error);\n\n\t\tc.status(204);\n\t\treturn c.body(null);\n\t},\n);\n\nexport default retryController;\n"],"mappings":"omBAcA,MAAM,EAFU,EAEc,CAAC,CAAC,eAC/B,EAAc,CACb,YAAa,oCACb,KAAM,CAAC,oBAAoB,EAC3B,QAAS,0BACT,UAAW,EAAQ,UAAU,CAC5B,aAAc,EACf,CAAC,EACD,WAAY,EAAQ,WAAW,CAC9B,OAAQ,EAAkB,MAAM,OAChC,QAAS,CACR,KAAM,EACP,CACD,CAAC,CACF,CAAC,EACD,EACA,EAAa,EACb,EAAS,QAAS,EAAkB,MAAM,MAAM,EAChD,KAAO,IAAM,CACZ,GAAM,CAAE,MAAO,EAAE,IAAI,MAAM,OAAO,EAC5B,EAAU,EAAqB,CAAC,EAEhCA,EAAQ,MAAM,EAAeC,EAAwC,CAC1E,YAAa,EACd,CAAC,CAAC,CAAC,EAAS,CACX,GAAI,OAAO,SAAS,EAAI,EAAE,EAC1B,KAAM,EAAE,IAAI,MAAM,CACnB,CAAC,EACD,GAAID,EAAM,MAAO,MAAM,IAAI,EAAcA,EAAM,KAAK,EAGpD,OADA,EAAE,OAAO,GAAG,EACL,EAAE,KAAK,IAAI,CACnB,CACD"}