@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 1.19 kB
Source Map (JSON)
{"version":3,"file":"clear-expired-preview-sessions.mjs","names":[],"sources":["../../../src/services/crons/clear-expired-preview-sessions.ts"],"sourcesContent":["import { PreviewSessionsRepository } from \"../../libs/repositories/index.js\";\nimport type { ServiceFn } from \"../../utils/services/types.js\";\n\n/** Deletes expired preview sessions. */\nconst clearExpiredPreviewSessions: ServiceFn<[], undefined> = async (\n\tcontext,\n) => {\n\tconst PreviewSessions = new PreviewSessionsRepository(\n\t\tcontext.db.client,\n\t\tcontext.config.db,\n\t);\n\n\tconst clearRes = await PreviewSessions.deleteMultiple({\n\t\twhere: [\n\t\t\t{\n\t\t\t\tkey: \"expires_at\",\n\t\t\t\toperator: \"<=\",\n\t\t\t\tvalue: new Date().toISOString(),\n\t\t\t},\n\t\t],\n\t});\n\tif (clearRes.error) return clearRes;\n\n\treturn { error: undefined, data: undefined };\n};\n\nexport default clearExpiredPreviewSessions;\n"],"mappings":"4DAIA,MAAM,EAAwD,KAC7D,IACI,CAMJ,IAAM,EAAW,MAAM,IALK,EAC3B,EAAQ,GAAG,OACX,EAAQ,OAAO,EAGqB,CAAC,CAAC,eAAe,CACrD,MAAO,CACN,CACC,IAAK,aACL,SAAU,KACV,MAAO,IAAI,KAAK,CAAA,CAAE,YAAY,CAC/B,CACD,CACD,CAAC,EAGD,OAFI,EAAS,MAAc,EAEpB,CAAE,MAAO,IAAA,GAAW,KAAM,IAAA,EAAU,CAC5C"}