"use strict";exports.id=421,exports.ids=[421],exports.modules={63809:(e,t,s)=>{var n=s(92120).default;t.ExportPagesCleanup=void 0;var r=s(72246),a=s(423),o=n(s(51889));t.ExportPagesCleanup=class{async execute(e){const{context:t,response:s,store:n}=e,i=n.getTask();if(!i.parentId)return s.error(`Missing task "${i.id}" parent id.`);const c=await t.tasks.getTask(i.parentId);if(!c)return s.error(`Missing parent task "${i.parentId}" in the database.`);const{items:p}=await t.tasks.listTasks({where:{parentId:c.id,definitionId:r.PageExportTask.ZipPages},limit:1e4});if(0===p.length)return s.done("No subtasks found - nothing to cleanup.");const u=p.reduce(((e,t)=>{const s=t.output?.done;if(!s)return e;const n=Object.values(s).filter(Boolean);return e.push(...n),e}),[]),d=(0,a.createS3)({region:process.env.AWS_REGION}),l=c.output?.key;"string"==typeof l&&await d.deleteObject({Bucket:process.env.S3_BUCKET,Key:l});const f=(0,o.default)(u,500);for(const e of f)await d.deleteObjects({Bucket:process.env.S3_BUCKET,Delete:{Objects:e.map((e=>({Key:e})))}});return s.done("Done with cleanup!")}}}};
//# sourceMappingURL=ExportPagesCleanup.0d3ba7d0.chunk.js.map