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