@webiny/api-page-builder-import-export 5.43.3 → 6.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.ts +1 -1
- package/client.js.map +1 -1
- package/export/combine/blocksHandler.d.ts +2 -2
- package/export/combine/blocksHandler.js.map +1 -1
- package/export/combine/formsHandler.d.ts +2 -2
- package/export/combine/formsHandler.js.map +1 -1
- package/export/combine/index.d.ts +2 -2
- package/export/combine/index.js.map +1 -1
- package/export/combine/templatesHandler.d.ts +2 -2
- package/export/combine/templatesHandler.js.map +1 -1
- package/export/pages/ExportPagesCleanup.d.ts +2 -2
- package/export/pages/ExportPagesCleanup.js.map +1 -1
- package/export/pages/ExportPagesController.d.ts +2 -2
- package/export/pages/ExportPagesController.js.map +1 -1
- package/export/pages/ExportPagesZipPages.d.ts +2 -2
- package/export/pages/ExportPagesZipPages.js.map +1 -1
- package/export/pages/controller/CombineZippedPages.d.ts +2 -2
- package/export/pages/controller/CombineZippedPages.js.map +1 -1
- package/export/pages/controller/CreateZipPagesTasks.d.ts +2 -2
- package/export/pages/controller/CreateZipPagesTasks.js.map +1 -1
- package/export/pages/controller/ProcessZipPagesTasks.d.ts +2 -2
- package/export/pages/controller/ProcessZipPagesTasks.js.map +1 -1
- package/export/pages/types.d.ts +2 -2
- package/export/pages/types.js.map +1 -1
- package/export/pages/zipPages/ZipPages.d.ts +2 -2
- package/export/pages/zipPages/ZipPages.js.map +1 -1
- package/export/pages/zipPages/ZipPagesDataManager.d.ts +1 -1
- package/export/pages/zipPages/ZipPagesDataManager.js.map +1 -1
- package/export/pages/zipPages/getPageFactory.d.ts +3 -3
- package/export/pages/zipPages/getPageFactory.js.map +1 -1
- package/export/process/blocksHandler.d.ts +2 -2
- package/export/process/blocksHandler.js.map +1 -1
- package/export/process/exporters/BlockExporter.d.ts +2 -2
- package/export/process/exporters/BlockExporter.js.map +1 -1
- package/export/process/exporters/FormExporter.d.ts +2 -2
- package/export/process/exporters/FormExporter.js.map +1 -1
- package/export/process/exporters/PageExporter.d.ts +2 -2
- package/export/process/exporters/PageExporter.js.map +1 -1
- package/export/process/exporters/PageTemplateExporter.d.ts +2 -2
- package/export/process/exporters/PageTemplateExporter.js.map +1 -1
- package/export/process/formsHandler.d.ts +2 -2
- package/export/process/formsHandler.js.map +1 -1
- package/export/process/index.d.ts +2 -2
- package/export/process/index.js.map +1 -1
- package/export/process/templatesHandler.d.ts +2 -2
- package/export/process/templatesHandler.js.map +1 -1
- package/export/s3Stream.d.ts +3 -2
- package/export/s3Stream.js.map +1 -1
- package/export/utils.d.ts +3 -3
- package/export/utils.js.map +1 -1
- package/export/zipper.d.ts +2 -2
- package/export/zipper.js.map +1 -1
- package/graphql/crud/blocks.crud.d.ts +1 -1
- package/graphql/crud/blocks.crud.js.map +1 -1
- package/graphql/crud/forms.crud.d.ts +1 -1
- package/graphql/crud/forms.crud.js.map +1 -1
- package/graphql/crud/importExportTasks.crud.d.ts +2 -2
- package/graphql/crud/importExportTasks.crud.js.map +1 -1
- package/graphql/crud/pages.crud.d.ts +1 -1
- package/graphql/crud/pages.crud.js.map +1 -1
- package/graphql/crud/templates.crud.d.ts +1 -1
- package/graphql/crud/templates.crud.js.map +1 -1
- package/graphql/crud.d.ts +1 -1
- package/graphql/crud.js.map +1 -1
- package/graphql/graphql/blocks.gql.d.ts +2 -2
- package/graphql/graphql/blocks.gql.js.map +1 -1
- package/graphql/graphql/forms.gql.d.ts +2 -2
- package/graphql/graphql/forms.gql.js.map +1 -1
- package/graphql/graphql/importExportTasks.gql.d.ts +2 -2
- package/graphql/graphql/importExportTasks.gql.js.map +1 -1
- package/graphql/graphql/pages.gql.d.ts +2 -2
- package/graphql/graphql/pages.gql.js.map +1 -1
- package/graphql/graphql/templates.gql.d.ts +2 -2
- package/graphql/graphql/templates.gql.js.map +1 -1
- package/graphql/graphql/utils/resolve.d.ts +2 -2
- package/graphql/graphql.d.ts +1 -1
- package/graphql/graphql.js.map +1 -1
- package/graphql/index.d.ts +1 -1
- package/graphql/index.js.map +1 -1
- package/graphql/types.d.ts +5 -5
- package/graphql/types.js.map +1 -1
- package/import/create/blocksHandler.d.ts +2 -2
- package/import/create/blocksHandler.js.map +1 -1
- package/import/create/formsHandler.d.ts +2 -2
- package/import/create/formsHandler.js.map +1 -1
- package/import/create/index.d.ts +2 -2
- package/import/create/index.js.map +1 -1
- package/import/create/pagesHandler.d.ts +2 -2
- package/import/create/pagesHandler.js.map +1 -1
- package/import/create/templatesHandler.d.ts +2 -2
- package/import/create/templatesHandler.js.map +1 -1
- package/import/pages/ImportPagesController.d.ts +2 -2
- package/import/pages/ImportPagesController.js.map +1 -1
- package/import/pages/ImportPagesProcessPages.d.ts +2 -2
- package/import/pages/ImportPagesProcessPages.js.map +1 -1
- package/import/pages/controller/ImportPagesProcessPagesChecker.d.ts +2 -2
- package/import/pages/controller/ImportPagesProcessPagesChecker.js.map +1 -1
- package/import/pages/controller/ImportPagesProcessZipFile.d.ts +2 -2
- package/import/pages/controller/ImportPagesProcessZipFile.js.map +1 -1
- package/import/pages/process/importPage.d.ts +3 -3
- package/import/pages/process/importPage.js.map +1 -1
- package/import/pages/types.d.ts +3 -3
- package/import/pages/types.js.map +1 -1
- package/import/process/blocks/ElementIdsProcessor.d.ts +1 -1
- package/import/process/blocks/ElementIdsProcessor.js.map +1 -1
- package/import/process/blocks/blocksHandler.d.ts +2 -2
- package/import/process/blocks/blocksHandler.js.map +1 -1
- package/import/process/blocks/importBlock.d.ts +3 -3
- package/import/process/blocks/importBlock.js.map +1 -1
- package/import/process/forms/formsHandler.d.ts +2 -2
- package/import/process/forms/formsHandler.js.map +1 -1
- package/import/process/forms/importForm.d.ts +2 -2
- package/import/process/forms/importForm.js.map +1 -1
- package/import/process/index.d.ts +2 -2
- package/import/process/index.js.map +1 -1
- package/import/process/templates/importTemplate.d.ts +3 -3
- package/import/process/templates/importTemplate.js.map +1 -1
- package/import/process/templates/templatesHandler.d.ts +2 -2
- package/import/process/templates/templatesHandler.js.map +1 -1
- package/import/utils/extractAndUploadZipFileContents.d.ts +1 -1
- package/import/utils/extractAndUploadZipFileContents.js.map +1 -1
- package/import/utils/extractZipAndUploadToS3.d.ts +1 -1
- package/import/utils/extractZipAndUploadToS3.js.map +1 -1
- package/import/utils/prepareDataDirMap.d.ts +1 -1
- package/import/utils/prepareDataDirMap.js.map +1 -1
- package/import/utils/updateFilesInData.d.ts +1 -1
- package/import/utils/updateFilesInData.js.map +1 -1
- package/import/utils/uploadAssets.d.ts +3 -3
- package/import/utils/uploadAssets.js.map +1 -1
- package/import/utils/uploadFilesFromS3.d.ts +1 -1
- package/import/utils/uploadFilesFromS3.js.map +1 -1
- package/mockSecurity.d.ts +1 -1
- package/mockSecurity.js.map +1 -1
- package/package.json +21 -21
- package/tasks/common/ChildTasksCleanup.d.ts +1 -1
- package/tasks/common/ChildTasksCleanup.js.map +1 -1
- package/tasks/pages/exportPagesCleanupTask.d.ts +2 -2
- package/tasks/pages/exportPagesCleanupTask.js.map +1 -1
- package/tasks/pages/exportPagesControllerTask.d.ts +2 -2
- package/tasks/pages/exportPagesControllerTask.js.map +1 -1
- package/tasks/pages/exportPagesZipPagesTask.d.ts +2 -2
- package/tasks/pages/exportPagesZipPagesTask.js.map +1 -1
- package/tasks/pages/importPagesControllerTask.d.ts +2 -2
- package/tasks/pages/importPagesControllerTask.js.map +1 -1
- package/tasks/pages/importPagesProcessPageTask.d.ts +2 -2
- package/tasks/pages/importPagesProcessPageTask.js.map +1 -1
- package/utils/ZipFiles.d.ts +1 -1
- package/utils/ZipFiles.js.map +1 -1
package/mockSecurity.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import { SecurityContext, SecurityIdentity } from "@webiny/api-security/types";
|
1
|
+
import type { SecurityContext, SecurityIdentity } from "@webiny/api-security/types";
|
2
2
|
export declare const mockSecurity: (identity: SecurityIdentity, context: SecurityContext) => void;
|
package/mockSecurity.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["mockSecurity","identity","context","security","setIdentity","exports"],"sources":["mockSecurity.ts"],"sourcesContent":["import { SecurityContext, SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport const mockSecurity = (identity: SecurityIdentity, context: SecurityContext) => {\n context.security.setIdentity(identity);\n};\n"],"mappings":";;;;;;AAEO,MAAMA,YAAY,GAAGA,CAACC,QAA0B,EAAEC,OAAwB,KAAK;EAClFA,OAAO,CAACC,QAAQ,CAACC,WAAW,CAACH,QAAQ,CAAC;AAC1C,CAAC;AAACI,OAAA,CAAAL,YAAA,GAAAA,YAAA","ignoreList":[]}
|
1
|
+
{"version":3,"names":["mockSecurity","identity","context","security","setIdentity","exports"],"sources":["mockSecurity.ts"],"sourcesContent":["import type { SecurityContext, SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport const mockSecurity = (identity: SecurityIdentity, context: SecurityContext) => {\n context.security.setIdentity(identity);\n};\n"],"mappings":";;;;;;AAEO,MAAMA,YAAY,GAAGA,CAACC,QAA0B,EAAEC,OAAwB,KAAK;EAClFA,OAAO,CAACC,QAAQ,CAACC,WAAW,CAACH,QAAQ,CAAC;AAC1C,CAAC;AAACI,OAAA,CAAAL,YAAA,GAAAA,YAAA","ignoreList":[]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@webiny/api-page-builder-import-export",
|
3
|
-
"version": "
|
3
|
+
"version": "6.0.0-alpha.1",
|
4
4
|
"main": "index.js",
|
5
5
|
"keywords": [
|
6
6
|
"pbie:base"
|
@@ -15,19 +15,19 @@
|
|
15
15
|
"license": "MIT",
|
16
16
|
"dependencies": {
|
17
17
|
"@smithy/node-http-handler": "2.1.6",
|
18
|
-
"@webiny/api": "
|
19
|
-
"@webiny/api-file-manager": "
|
20
|
-
"@webiny/api-form-builder": "
|
21
|
-
"@webiny/api-page-builder": "
|
22
|
-
"@webiny/api-security": "
|
23
|
-
"@webiny/aws-sdk": "
|
24
|
-
"@webiny/error": "
|
25
|
-
"@webiny/handler": "
|
26
|
-
"@webiny/handler-aws": "
|
27
|
-
"@webiny/handler-graphql": "
|
28
|
-
"@webiny/pubsub": "
|
29
|
-
"@webiny/tasks": "
|
30
|
-
"@webiny/utils": "
|
18
|
+
"@webiny/api": "6.0.0-alpha.1",
|
19
|
+
"@webiny/api-file-manager": "6.0.0-alpha.1",
|
20
|
+
"@webiny/api-form-builder": "6.0.0-alpha.1",
|
21
|
+
"@webiny/api-page-builder": "6.0.0-alpha.1",
|
22
|
+
"@webiny/api-security": "6.0.0-alpha.1",
|
23
|
+
"@webiny/aws-sdk": "6.0.0-alpha.1",
|
24
|
+
"@webiny/error": "6.0.0-alpha.1",
|
25
|
+
"@webiny/handler": "6.0.0-alpha.1",
|
26
|
+
"@webiny/handler-aws": "6.0.0-alpha.1",
|
27
|
+
"@webiny/handler-graphql": "6.0.0-alpha.1",
|
28
|
+
"@webiny/pubsub": "6.0.0-alpha.1",
|
29
|
+
"@webiny/tasks": "6.0.0-alpha.1",
|
30
|
+
"@webiny/utils": "6.0.0-alpha.1",
|
31
31
|
"archiver": "7.0.1",
|
32
32
|
"dot-prop-immutable": "2.1.1",
|
33
33
|
"fs-extra": "11.2.0",
|
@@ -43,12 +43,12 @@
|
|
43
43
|
"@types/archiver": "5.3.1",
|
44
44
|
"@types/node-fetch": "2.6.2",
|
45
45
|
"@types/yauzl": "2.10.0",
|
46
|
-
"@webiny/api-authentication": "
|
47
|
-
"@webiny/api-dynamodb-to-elasticsearch": "
|
48
|
-
"@webiny/api-tenancy": "
|
49
|
-
"@webiny/api-wcp": "
|
50
|
-
"@webiny/db": "
|
51
|
-
"@webiny/project-utils": "
|
46
|
+
"@webiny/api-authentication": "6.0.0-alpha.1",
|
47
|
+
"@webiny/api-dynamodb-to-elasticsearch": "6.0.0-alpha.1",
|
48
|
+
"@webiny/api-tenancy": "6.0.0-alpha.1",
|
49
|
+
"@webiny/api-wcp": "6.0.0-alpha.1",
|
50
|
+
"@webiny/db": "6.0.0-alpha.1",
|
51
|
+
"@webiny/project-utils": "6.0.0-alpha.1",
|
52
52
|
"jest": "29.7.0",
|
53
53
|
"jest-dynalite": "3.6.1",
|
54
54
|
"rimraf": "6.0.1",
|
@@ -62,5 +62,5 @@
|
|
62
62
|
"build": "node ../cli/bin.js run build",
|
63
63
|
"watch": "node ../cli/bin.js run watch"
|
64
64
|
},
|
65
|
-
"gitHead": "
|
65
|
+
"gitHead": "9bd236cf5e689f209a11bec089207dcc2d41a53c"
|
66
66
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* Cleanup of the child tasks.
|
3
3
|
* This code will remove all the child tasks and their logs, which have no errors in them.
|
4
4
|
*/
|
5
|
-
import { ITask, Context } from "@webiny/tasks";
|
5
|
+
import type { ITask, Context } from "@webiny/tasks";
|
6
6
|
export interface IChildTasksCleanupExecuteParams {
|
7
7
|
context: Context;
|
8
8
|
task: ITask;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_tasks","require","ChildTasksCleanup","execute","params","context","task","items","childTasks","tasks","listTasks","where","parentId","id","limit","length","childTaskIdList","map","childTask","childLogs","listLogs","task_in","deletedChildTaskLogIdList","log","some","item","type","TaskLogItemType","ERROR","deleteLog","includes","push","childTaskId","deleteTask","exports"],"sources":["ChildTasksCleanup.ts"],"sourcesContent":["/**\n * Cleanup of the child tasks.\n * This code will remove all the child tasks and their logs, which have no errors in them.\n */\nimport { ITask, Context
|
1
|
+
{"version":3,"names":["_tasks","require","ChildTasksCleanup","execute","params","context","task","items","childTasks","tasks","listTasks","where","parentId","id","limit","length","childTaskIdList","map","childTask","childLogs","listLogs","task_in","deletedChildTaskLogIdList","log","some","item","type","TaskLogItemType","ERROR","deleteLog","includes","push","childTaskId","deleteTask","exports"],"sources":["ChildTasksCleanup.ts"],"sourcesContent":["/**\n * Cleanup of the child tasks.\n * This code will remove all the child tasks and their logs, which have no errors in them.\n */\nimport type { ITask, Context } from \"@webiny/tasks\";\nimport { TaskLogItemType } from \"@webiny/tasks\";\n\nexport interface IChildTasksCleanupExecuteParams {\n context: Context;\n task: ITask;\n}\nexport class ChildTasksCleanup {\n public async execute(params: IChildTasksCleanupExecuteParams): Promise<void> {\n const { context, task } = params;\n\n const { items: childTasks } = await context.tasks.listTasks({\n where: {\n parentId: task.id\n },\n // Really doubtful there will be more than 10k of child tasks.\n limit: 100000\n });\n if (childTasks.length === 0) {\n return;\n }\n\n const childTaskIdList = childTasks.map(childTask => childTask.id);\n\n const { items: childLogs } = await context.tasks.listLogs({\n where: {\n task_in: childTaskIdList\n },\n limit: 100000\n });\n\n const deletedChildTaskLogIdList: string[] = [];\n /**\n * First, we need to remove all the logs which have no errors.\n */\n for (const log of childLogs) {\n if (log.items.some(item => item.type === TaskLogItemType.ERROR)) {\n continue;\n }\n await context.tasks.deleteLog(log.id);\n if (deletedChildTaskLogIdList.includes(log.task)) {\n continue;\n }\n deletedChildTaskLogIdList.push(log.task);\n }\n /**\n * Now we can remove the tasks.\n */\n for (const childTaskId of deletedChildTaskLogIdList) {\n await context.tasks.deleteTask(childTaskId);\n }\n }\n}\n"],"mappings":";;;;;;AAKA,IAAAA,MAAA,GAAAC,OAAA;AALA;AACA;AACA;AACA;;AAQO,MAAMC,iBAAiB,CAAC;EAC3B,MAAaC,OAAOA,CAACC,MAAuC,EAAiB;IACzE,MAAM;MAAEC,OAAO;MAAEC;IAAK,CAAC,GAAGF,MAAM;IAEhC,MAAM;MAAEG,KAAK,EAAEC;IAAW,CAAC,GAAG,MAAMH,OAAO,CAACI,KAAK,CAACC,SAAS,CAAC;MACxDC,KAAK,EAAE;QACHC,QAAQ,EAAEN,IAAI,CAACO;MACnB,CAAC;MACD;MACAC,KAAK,EAAE;IACX,CAAC,CAAC;IACF,IAAIN,UAAU,CAACO,MAAM,KAAK,CAAC,EAAE;MACzB;IACJ;IAEA,MAAMC,eAAe,GAAGR,UAAU,CAACS,GAAG,CAACC,SAAS,IAAIA,SAAS,CAACL,EAAE,CAAC;IAEjE,MAAM;MAAEN,KAAK,EAAEY;IAAU,CAAC,GAAG,MAAMd,OAAO,CAACI,KAAK,CAACW,QAAQ,CAAC;MACtDT,KAAK,EAAE;QACHU,OAAO,EAAEL;MACb,CAAC;MACDF,KAAK,EAAE;IACX,CAAC,CAAC;IAEF,MAAMQ,yBAAmC,GAAG,EAAE;IAC9C;AACR;AACA;IACQ,KAAK,MAAMC,GAAG,IAAIJ,SAAS,EAAE;MACzB,IAAII,GAAG,CAAChB,KAAK,CAACiB,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,IAAI,KAAKC,sBAAe,CAACC,KAAK,CAAC,EAAE;QAC7D;MACJ;MACA,MAAMvB,OAAO,CAACI,KAAK,CAACoB,SAAS,CAACN,GAAG,CAACV,EAAE,CAAC;MACrC,IAAIS,yBAAyB,CAACQ,QAAQ,CAACP,GAAG,CAACjB,IAAI,CAAC,EAAE;QAC9C;MACJ;MACAgB,yBAAyB,CAACS,IAAI,CAACR,GAAG,CAACjB,IAAI,CAAC;IAC5C;IACA;AACR;AACA;IACQ,KAAK,MAAM0B,WAAW,IAAIV,yBAAyB,EAAE;MACjD,MAAMjB,OAAO,CAACI,KAAK,CAACwB,UAAU,CAACD,WAAW,CAAC;IAC/C;EACJ;AACJ;AAACE,OAAA,CAAAhC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { IExportPagesCleanupInput } from "../../export/pages/types";
|
2
|
-
import { PbImportExportContext } from "../../graphql/types";
|
1
|
+
import type { IExportPagesCleanupInput } from "../../export/pages/types";
|
2
|
+
import type { PbImportExportContext } from "../../graphql/types";
|
3
3
|
export declare const createExportPagesCleanupTask: () => import("@webiny/tasks").TaskDefinitionPlugin<PbImportExportContext, IExportPagesCleanupInput, import("@webiny/tasks").ITaskResponseDoneResultOutput>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_tasks","require","_types","createExportPagesCleanupTask","createPrivateTaskDefinition","id","PageExportTask","Cleanup","title","description","maxIterations","run","param","response","isAborted","aborted","ExportPagesCleanup","exportPagesCleanup","execute","exports"],"sources":["exportPagesCleanupTask.ts"],"sourcesContent":["import { createPrivateTaskDefinition } from \"@webiny/tasks\";\nimport { IExportPagesCleanupInput
|
1
|
+
{"version":3,"names":["_tasks","require","_types","createExportPagesCleanupTask","createPrivateTaskDefinition","id","PageExportTask","Cleanup","title","description","maxIterations","run","param","response","isAborted","aborted","ExportPagesCleanup","exportPagesCleanup","execute","exports"],"sources":["exportPagesCleanupTask.ts"],"sourcesContent":["import { createPrivateTaskDefinition } from \"@webiny/tasks\";\nimport type { IExportPagesCleanupInput } from \"~/export/pages/types\";\nimport { PageExportTask } from \"~/export/pages/types\";\nimport type { PbImportExportContext } from \"~/graphql/types\";\n\nexport const createExportPagesCleanupTask = () => {\n return createPrivateTaskDefinition<PbImportExportContext, IExportPagesCleanupInput>({\n id: PageExportTask.Cleanup,\n title: \"Page Builder - Export Pages Cleanup\",\n description: \"Export pages from the Page Builder - cleanup.\",\n maxIterations: 1,\n run: async param => {\n const { response, isAborted } = param;\n /**\n * We always need to check task status.\n */\n if (isAborted()) {\n return response.aborted();\n }\n\n const { ExportPagesCleanup } = await import(\n /* webpackChunkName: \"ExportPagesCleanup\" */ \"~/export/pages/ExportPagesCleanup\"\n );\n\n const exportPagesCleanup = new ExportPagesCleanup();\n return await exportPagesCleanup.execute(param);\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAGO,MAAME,4BAA4B,GAAGA,CAAA,KAAM;EAC9C,OAAO,IAAAC,kCAA2B,EAAkD;IAChFC,EAAE,EAAEC,qBAAc,CAACC,OAAO;IAC1BC,KAAK,EAAE,qCAAqC;IAC5CC,WAAW,EAAE,+CAA+C;IAC5DC,aAAa,EAAE,CAAC;IAChBC,GAAG,EAAE,MAAMC,KAAK,IAAI;MAChB,MAAM;QAAEC,QAAQ;QAAEC;MAAU,CAAC,GAAGF,KAAK;MACrC;AACZ;AACA;MACY,IAAIE,SAAS,CAAC,CAAC,EAAE;QACb,OAAOD,QAAQ,CAACE,OAAO,CAAC,CAAC;MAC7B;MAEA,MAAM;QAAEC;MAAmB,CAAC,GAAG,MAAM,MAAM,CACvC,mFACJ,CAAC;MAED,MAAMC,kBAAkB,GAAG,IAAID,kBAAkB,CAAC,CAAC;MACnD,OAAO,MAAMC,kBAAkB,CAACC,OAAO,CAACN,KAAK,CAAC;IAClD;EACJ,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAAhB,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { PbImportExportContext } from "../../graphql/types";
|
2
|
-
import { IExportPagesControllerInput, IExportPagesControllerOutput } from "../../export/pages/types";
|
1
|
+
import type { PbImportExportContext } from "../../graphql/types";
|
2
|
+
import type { IExportPagesControllerInput, IExportPagesControllerOutput } from "../../export/pages/types";
|
3
3
|
export declare const createExportPagesControllerTask: () => import("@webiny/tasks").TaskDefinitionPlugin<PbImportExportContext, IExportPagesControllerInput, IExportPagesControllerOutput>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_tasks","require","_types","_ChildTasksCleanup","createExportPagesControllerTask","createTaskDefinition","isPrivate","id","PageExportTask","Controller","title","description","maxIterations","run","params","response","isAborted","aborted","ExportPagesController","exportPagesController","execute","onDone","context","task","tasks","trigger","definition","Cleanup","parent","delay","childTasksCleanup","ChildTasksCleanup","ex","console","error","onError","onAbort","exports"],"sources":["exportPagesControllerTask.ts"],"sourcesContent":["import { createTaskDefinition } from \"@webiny/tasks\";\nimport { PbImportExportContext } from \"~/graphql/types\";\nimport {\n IExportPagesControllerInput,\n IExportPagesControllerOutput
|
1
|
+
{"version":3,"names":["_tasks","require","_types","_ChildTasksCleanup","createExportPagesControllerTask","createTaskDefinition","isPrivate","id","PageExportTask","Controller","title","description","maxIterations","run","params","response","isAborted","aborted","ExportPagesController","exportPagesController","execute","onDone","context","task","tasks","trigger","definition","Cleanup","parent","delay","childTasksCleanup","ChildTasksCleanup","ex","console","error","onError","onAbort","exports"],"sources":["exportPagesControllerTask.ts"],"sourcesContent":["import { createTaskDefinition } from \"@webiny/tasks\";\nimport type { PbImportExportContext } from \"~/graphql/types\";\nimport type {\n IExportPagesControllerInput,\n IExportPagesControllerOutput\n} from \"~/export/pages/types\";\nimport { PageExportTask } from \"~/export/pages/types\";\nimport { ChildTasksCleanup } from \"../common/ChildTasksCleanup\";\n\nexport const createExportPagesControllerTask = () => {\n // TODO make the task private with createPrivateTaskDefinition\n return createTaskDefinition<\n PbImportExportContext,\n IExportPagesControllerInput,\n IExportPagesControllerOutput\n >({\n isPrivate: true,\n id: PageExportTask.Controller,\n title: \"Page Builder - Export Pages - Controller\",\n description: \"Export pages from the Page Builder - controller.\",\n /**\n * We want to have a lot of executions because we need to pool the subtasks all the time.\n */\n maxIterations: 500,\n run: async params => {\n const { response, isAborted } = params;\n /**\n * We always need to check task status.\n */\n if (isAborted()) {\n return response.aborted();\n }\n\n const { ExportPagesController } = await import(\n /* webpackChunkName: \"ExportPagesController\" */ \"~/export/pages/ExportPagesController\"\n );\n\n const exportPagesController = new ExportPagesController();\n return await exportPagesController.execute(params);\n },\n onDone: async ({ context, task }) => {\n await context.tasks.trigger({\n definition: PageExportTask.Cleanup,\n parent: task,\n // delay cleanup for 25hrs\n delay: 25 * 60 * 60\n });\n /**\n * We want to clean all child tasks and logs, which have no errors.\n */\n const childTasksCleanup = new ChildTasksCleanup();\n try {\n await childTasksCleanup.execute({\n context,\n task\n });\n } catch (ex) {\n console.error(\"Error while cleaning child tasks.\", ex);\n }\n },\n onError: async ({ context, task }) => {\n await context.tasks.trigger({\n definition: PageExportTask.Cleanup,\n parent: task\n });\n },\n onAbort: async ({ context, task }) => {\n await context.tasks.trigger({\n definition: PageExportTask.Cleanup,\n parent: task\n });\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA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;IACJ,CAAC;IACDG,OAAO,EAAE,MAAAA,CAAO;MAAEb,OAAO;MAAEC;IAAK,CAAC,KAAK;MAClC,MAAMD,OAAO,CAACE,KAAK,CAACC,OAAO,CAAC;QACxBC,UAAU,EAAElB,qBAAc,CAACmB,OAAO;QAClCC,MAAM,EAAEL;MACZ,CAAC,CAAC;IACN,CAAC;IACDa,OAAO,EAAE,MAAAA,CAAO;MAAEd,OAAO;MAAEC;IAAK,CAAC,KAAK;MAClC,MAAMD,OAAO,CAACE,KAAK,CAACC,OAAO,CAAC;QACxBC,UAAU,EAAElB,qBAAc,CAACmB,OAAO;QAClCC,MAAM,EAAEL;MACZ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACc,OAAA,CAAAjC,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { IExportPagesZipPagesInput, IExportPagesZipPagesOutput } from "../../export/pages/types";
|
2
|
-
import { PbImportExportContext } from "../../graphql/types";
|
1
|
+
import type { IExportPagesZipPagesInput, IExportPagesZipPagesOutput } from "../../export/pages/types";
|
2
|
+
import type { PbImportExportContext } from "../../graphql/types";
|
3
3
|
export declare const createExportPagesZipPagesTask: () => import("@webiny/tasks").TaskDefinitionPlugin<PbImportExportContext, IExportPagesZipPagesInput, IExportPagesZipPagesOutput>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_tasks","require","_types","createExportPagesZipPagesTask","createPrivateTaskDefinition","id","PageExportTask","ZipPages","title","description","maxIterations","run","params","response","isAborted","aborted","ExportPagesZipPages","exportPagesZipPages","execute","exports"],"sources":["exportPagesZipPagesTask.ts"],"sourcesContent":["import { createPrivateTaskDefinition } from \"@webiny/tasks\";\nimport {
|
1
|
+
{"version":3,"names":["_tasks","require","_types","createExportPagesZipPagesTask","createPrivateTaskDefinition","id","PageExportTask","ZipPages","title","description","maxIterations","run","params","response","isAborted","aborted","ExportPagesZipPages","exportPagesZipPages","execute","exports"],"sources":["exportPagesZipPagesTask.ts"],"sourcesContent":["import { createPrivateTaskDefinition } from \"@webiny/tasks\";\nimport type { IExportPagesZipPagesInput, IExportPagesZipPagesOutput } from \"~/export/pages/types\";\nimport { PageExportTask } from \"~/export/pages/types\";\nimport type { PbImportExportContext } from \"~/graphql/types\";\n\nexport const createExportPagesZipPagesTask = () => {\n return createPrivateTaskDefinition<\n PbImportExportContext,\n IExportPagesZipPagesInput,\n IExportPagesZipPagesOutput\n >({\n id: PageExportTask.ZipPages,\n title: \"Page Builder - Export Pages - Zip Pages\",\n description: \"Export pages from the Page Builder - zip pages.\",\n /**\n * If we ever hit the max iterations limit, we should decrease the number of pages being zipped in one task execution.\n */\n maxIterations: 10,\n run: async params => {\n const { response, isAborted } = params;\n /**\n * We always need to check task status.\n */\n if (isAborted()) {\n return response.aborted();\n }\n\n const { ExportPagesZipPages } = await import(\n /* webpackChunkName: \"ExportPagesZipPages\" */ \"~/export/pages/ExportPagesZipPages\"\n );\n\n const exportPagesZipPages = new ExportPagesZipPages();\n return await exportPagesZipPages.execute(params);\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAGO,MAAME,6BAA6B,GAAGA,CAAA,KAAM;EAC/C,OAAO,IAAAC,kCAA2B,EAIhC;IACEC,EAAE,EAAEC,qBAAc,CAACC,QAAQ;IAC3BC,KAAK,EAAE,yCAAyC;IAChDC,WAAW,EAAE,iDAAiD;IAC9D;AACR;AACA;IACQC,aAAa,EAAE,EAAE;IACjBC,GAAG,EAAE,MAAMC,MAAM,IAAI;MACjB,MAAM;QAAEC,QAAQ;QAAEC;MAAU,CAAC,GAAGF,MAAM;MACtC;AACZ;AACA;MACY,IAAIE,SAAS,CAAC,CAAC,EAAE;QACb,OAAOD,QAAQ,CAACE,OAAO,CAAC,CAAC;MAC7B;MAEA,MAAM;QAAEC;MAAoB,CAAC,GAAG,MAAM,MAAM,CACxC,qFACJ,CAAC;MAED,MAAMC,mBAAmB,GAAG,IAAID,mBAAmB,CAAC,CAAC;MACrD,OAAO,MAAMC,mBAAmB,CAACC,OAAO,CAACN,MAAM,CAAC;IACpD;EACJ,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAAhB,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { PbImportExportContext } from "../../graphql/types";
|
2
|
-
import { IImportPagesControllerInput, IImportPagesControllerOutput } from "../../import/pages/types";
|
1
|
+
import type { PbImportExportContext } from "../../graphql/types";
|
2
|
+
import type { IImportPagesControllerInput, IImportPagesControllerOutput } from "../../import/pages/types";
|
3
3
|
export declare const createImportPagesControllerTask: () => import("@webiny/tasks").TaskDefinitionPlugin<PbImportExportContext, IImportPagesControllerInput, IImportPagesControllerOutput>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_tasks","require","_types","createImportPagesControllerTask","createPrivateTaskDefinition","id","PageImportTask","Controller","title","description","maxIterations","run","params","response","isAborted","aborted","ImportPagesController","importPagesController","execute","exports"],"sources":["importPagesControllerTask.ts"],"sourcesContent":["import { createPrivateTaskDefinition } from \"@webiny/tasks\";\nimport { PbImportExportContext } from \"~/graphql/types\";\nimport {\n IImportPagesControllerInput,\n IImportPagesControllerOutput
|
1
|
+
{"version":3,"names":["_tasks","require","_types","createImportPagesControllerTask","createPrivateTaskDefinition","id","PageImportTask","Controller","title","description","maxIterations","run","params","response","isAborted","aborted","ImportPagesController","importPagesController","execute","exports"],"sources":["importPagesControllerTask.ts"],"sourcesContent":["import { createPrivateTaskDefinition } from \"@webiny/tasks\";\nimport type { PbImportExportContext } from \"~/graphql/types\";\nimport type {\n IImportPagesControllerInput,\n IImportPagesControllerOutput\n} from \"~/import/pages/types\";\nimport { PageImportTask } from \"~/import/pages/types\";\n\nexport const createImportPagesControllerTask = () => {\n return createPrivateTaskDefinition<\n PbImportExportContext,\n IImportPagesControllerInput,\n IImportPagesControllerOutput\n >({\n id: PageImportTask.Controller,\n title: \"Page Builder - Import Pages Controlelr\",\n description: \"Import pages from the Page Builder.\",\n /**\n * We want to have a lot of executions because we need to pool the subtasks all the time.\n */\n maxIterations: 500,\n run: async params => {\n const { response, isAborted } = params;\n /**\n * We always need to check task status.\n */\n if (isAborted()) {\n return response.aborted();\n }\n const { ImportPagesController } = await import(\n /* webpackChunkName: \"ImportPagesController\" */ \"~/import/pages/ImportPagesController\"\n );\n\n const importPagesController = new ImportPagesController();\n\n return await importPagesController.execute(params);\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAME,+BAA+B,GAAGA,CAAA,KAAM;EACjD,OAAO,IAAAC,kCAA2B,EAIhC;IACEC,EAAE,EAAEC,qBAAc,CAACC,UAAU;IAC7BC,KAAK,EAAE,wCAAwC;IAC/CC,WAAW,EAAE,qCAAqC;IAClD;AACR;AACA;IACQC,aAAa,EAAE,GAAG;IAClBC,GAAG,EAAE,MAAMC,MAAM,IAAI;MACjB,MAAM;QAAEC,QAAQ;QAAEC;MAAU,CAAC,GAAGF,MAAM;MACtC;AACZ;AACA;MACY,IAAIE,SAAS,CAAC,CAAC,EAAE;QACb,OAAOD,QAAQ,CAACE,OAAO,CAAC,CAAC;MAC7B;MACA,MAAM;QAAEC;MAAsB,CAAC,GAAG,MAAM,MAAM,CAC1C,yFACJ,CAAC;MAED,MAAMC,qBAAqB,GAAG,IAAID,qBAAqB,CAAC,CAAC;MAEzD,OAAO,MAAMC,qBAAqB,CAACC,OAAO,CAACN,MAAM,CAAC;IACtD;EACJ,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAAhB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { PbImportExportContext } from "../../graphql/types";
|
2
|
-
import { IImportPagesProcessPagesInput, IImportPagesProcessPagesOutput } from "../../import/pages/types";
|
1
|
+
import type { PbImportExportContext } from "../../graphql/types";
|
2
|
+
import type { IImportPagesProcessPagesInput, IImportPagesProcessPagesOutput } from "../../import/pages/types";
|
3
3
|
export declare const createImportPagesProcessPagesTask: () => import("@webiny/tasks").TaskDefinitionPlugin<PbImportExportContext, IImportPagesProcessPagesInput, IImportPagesProcessPagesOutput>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_tasks","require","_types","createImportPagesProcessPagesTask","createPrivateTaskDefinition","id","PageImportTask","Process","title","description","maxIterations","run","params","response","isAborted","aborted","ImportPagesProcessPages","importPagesProcessPages","execute","exports"],"sources":["importPagesProcessPageTask.ts"],"sourcesContent":["import { createPrivateTaskDefinition } from \"@webiny/tasks\";\nimport { PbImportExportContext } from \"~/graphql/types\";\nimport {\n IImportPagesProcessPagesInput,\n IImportPagesProcessPagesOutput
|
1
|
+
{"version":3,"names":["_tasks","require","_types","createImportPagesProcessPagesTask","createPrivateTaskDefinition","id","PageImportTask","Process","title","description","maxIterations","run","params","response","isAborted","aborted","ImportPagesProcessPages","importPagesProcessPages","execute","exports"],"sources":["importPagesProcessPageTask.ts"],"sourcesContent":["import { createPrivateTaskDefinition } from \"@webiny/tasks\";\nimport type { PbImportExportContext } from \"~/graphql/types\";\nimport type {\n IImportPagesProcessPagesInput,\n IImportPagesProcessPagesOutput\n} from \"~/import/pages/types\";\nimport { PageImportTask } from \"~/import/pages/types\";\n\nexport const createImportPagesProcessPagesTask = () => {\n return createPrivateTaskDefinition<\n PbImportExportContext,\n IImportPagesProcessPagesInput,\n IImportPagesProcessPagesOutput\n >({\n id: PageImportTask.Process,\n title: \"Page Builder - Import Pages Process\",\n description: \"Import pages from the Page Builder - Process pages.\",\n /**\n * We do not want to have a large number of iterations because we are splitting page processing into multiple tasks.\n */\n maxIterations: 20,\n run: async params => {\n const { response, isAborted } = params;\n /**\n * We always need to check task status.\n */\n if (isAborted()) {\n return response.aborted();\n }\n const { ImportPagesProcessPages } = await import(\n /* webpackChunkName: \"ImportPagesProcessPages\" */ \"~/import/pages/ImportPagesProcessPages\"\n );\n\n const importPagesProcessPages = new ImportPagesProcessPages();\n\n return await importPagesProcessPages.execute(params);\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAME,iCAAiC,GAAGA,CAAA,KAAM;EACnD,OAAO,IAAAC,kCAA2B,EAIhC;IACEC,EAAE,EAAEC,qBAAc,CAACC,OAAO;IAC1BC,KAAK,EAAE,qCAAqC;IAC5CC,WAAW,EAAE,qDAAqD;IAClE;AACR;AACA;IACQC,aAAa,EAAE,EAAE;IACjBC,GAAG,EAAE,MAAMC,MAAM,IAAI;MACjB,MAAM;QAAEC,QAAQ;QAAEC;MAAU,CAAC,GAAGF,MAAM;MACtC;AACZ;AACA;MACY,IAAIE,SAAS,CAAC,CAAC,EAAE;QACb,OAAOD,QAAQ,CAACE,OAAO,CAAC,CAAC;MAC7B;MACA,MAAM;QAAEC;MAAwB,CAAC,GAAG,MAAM,MAAM,CAC5C,6FACJ,CAAC;MAED,MAAMC,uBAAuB,GAAG,IAAID,uBAAuB,CAAC,CAAC;MAE7D,OAAO,MAAMC,uBAAuB,CAACC,OAAO,CAACN,MAAM,CAAC;IACxD;EACJ,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAAhB,iCAAA,GAAAA,iCAAA","ignoreList":[]}
|
package/utils/ZipFiles.d.ts
CHANGED
package/utils/ZipFiles.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_archiver","require","_clientS","_path","_interopRequireDefault","_stream","_libStorage","_nodeHttpHandler","_https","_http","ZipFiles","bucket","process","env","S3_BUCKET","debug","DEBUG","constructor","options","setDebug","targetFileName","files","fileNames","Array","from","s3Client","createS3","requestHandler","NodeHttpHandler","connectionTimeout","httpAgent","HttpAgent","maxSockets","keepAlive","maxFreeSockets","maxTotalSockets","keepAliveMsecs","httpsAgent","HttpsAgent","sessionTimeout","maxCachedSessions","requestTimeout","streamPassThrough","Stream","PassThrough","autoDestroy","upload","Upload","client","params","ACL","Body","Bucket","ContentType","Key","queueSize","partSize","leavePartsOnError","archive","createArchiver","on","error","console","Error","name","code","message","path","stack","pipe","data","log","addFileToArchive","file","shift","setTimeout","finalize","cmd","GetObjectCommand","response","send","basename","append","result","done","destroy","undefined","exports"],"sources":["ZipFiles.ts"],"sourcesContent":["import { ArchiverError
|
1
|
+
{"version":3,"names":["_archiver","require","_clientS","_path","_interopRequireDefault","_stream","_libStorage","_nodeHttpHandler","_https","_http","ZipFiles","bucket","process","env","S3_BUCKET","debug","DEBUG","constructor","options","setDebug","targetFileName","files","fileNames","Array","from","s3Client","createS3","requestHandler","NodeHttpHandler","connectionTimeout","httpAgent","HttpAgent","maxSockets","keepAlive","maxFreeSockets","maxTotalSockets","keepAliveMsecs","httpsAgent","HttpsAgent","sessionTimeout","maxCachedSessions","requestTimeout","streamPassThrough","Stream","PassThrough","autoDestroy","upload","Upload","client","params","ACL","Body","Bucket","ContentType","Key","queueSize","partSize","leavePartsOnError","archive","createArchiver","on","error","console","Error","name","code","message","path","stack","pipe","data","log","addFileToArchive","file","shift","setTimeout","finalize","cmd","GetObjectCommand","response","send","basename","append","result","done","destroy","undefined","exports"],"sources":["ZipFiles.ts"],"sourcesContent":["import type { ArchiverError } from \"archiver\";\nimport { create as createArchiver } from \"archiver\";\nimport type { CompleteMultipartUploadOutput } from \"@webiny/aws-sdk/client-s3\";\nimport { createS3, GetObjectCommand } from \"@webiny/aws-sdk/client-s3\";\nimport path from \"path\";\nimport { type Readable, Stream } from \"stream\";\nimport { Upload } from \"@webiny/aws-sdk/lib-storage\";\nimport { NodeHttpHandler } from \"@smithy/node-http-handler\";\nimport { Agent as HttpsAgent } from \"https\";\nimport { Agent as HttpAgent } from \"http\";\n\nexport interface ZipFilesOptions {\n debug?: boolean;\n}\n\nexport class ZipFiles {\n private readonly bucket: string = process.env.S3_BUCKET as string;\n private debug: boolean = process.env.DEBUG === \"true\";\n\n public constructor(options?: ZipFilesOptions) {\n this.setDebug(options?.debug);\n }\n\n public async process(\n targetFileName: string,\n files: string[]\n ): Promise<CompleteMultipartUploadOutput> {\n const fileNames = Array.from(files);\n const s3Client = createS3({\n requestHandler: new NodeHttpHandler({\n connectionTimeout: 0,\n httpAgent: new HttpAgent({\n maxSockets: 10000,\n keepAlive: true,\n maxFreeSockets: 10000,\n maxTotalSockets: 10000,\n keepAliveMsecs: 900000 // milliseconds / 15 minutes\n }),\n httpsAgent: new HttpsAgent({\n maxSockets: 10000,\n keepAlive: true,\n sessionTimeout: 900, // seconds / 15 minutes\n maxCachedSessions: 100000,\n maxFreeSockets: 10000,\n maxTotalSockets: 10000,\n keepAliveMsecs: 900000 // milliseconds / 15 minutes\n }),\n requestTimeout: 900000 // milliseconds / 15 minutes\n })\n });\n\n const streamPassThrough = new Stream.PassThrough({\n autoDestroy: true\n });\n\n const upload = new Upload({\n client: s3Client,\n params: {\n ACL: \"private\",\n Body: streamPassThrough,\n Bucket: this.bucket,\n ContentType: \"application/zip\",\n Key: targetFileName\n },\n queueSize: 1,\n partSize: 1024 * 1024 * 5,\n leavePartsOnError: false\n });\n\n const archive = createArchiver(\"zip\", {});\n\n archive.on(\"error\", (error: ArchiverError) => {\n console.error(error);\n throw new Error(\n `${error.name} ${error.code} ${error.message} ${error.path} ${error.stack}`\n );\n });\n\n archive.pipe(streamPassThrough);\n\n /**\n * To combine all the files into a single zip file, we need to add files one by one.\n *\n * addFileToArchive() method is called every time an entry event is triggered on the archive - it means that file was added into the archive.\n * The method is called manually, first time, to start the process.\n */\n\n archive.on(\"entry\", data => {\n this.debug && console.log(`Archived file: ${data.name}`);\n addFileToArchive();\n });\n\n const addFileToArchive = async (): Promise<void> => {\n const file = fileNames.shift();\n if (!file) {\n this.debug && console.log(\"No more files to add to the archive.\");\n /**\n * Must call finalize() with a timeout, otherwise the lambda crashes.\n */\n setTimeout(() => {\n archive.finalize();\n }, 200);\n return;\n }\n this.debug && console.log(`Adding file \"${file}\" to the archive.`);\n const cmd = new GetObjectCommand({\n Bucket: this.bucket,\n Key: file\n });\n\n const response = await s3Client.send(cmd);\n // Possible to get a null response.Body?\n // Typescript says yes, so let's check it.\n if (!response.Body) {\n this.debug &&\n console.log(`No response.Body for file \"${file}\", moving to next file.`);\n return addFileToArchive();\n }\n const name = `${path.basename(file)}`;\n\n archive.append(response.Body as Readable, {\n name\n });\n };\n\n addFileToArchive();\n\n const result = await upload.done();\n\n s3Client.destroy();\n return result;\n }\n\n private setDebug(debug?: boolean): void {\n if (debug === undefined) {\n return;\n }\n this.debug = debug;\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAMO,MAAMS,QAAQ,CAAC;EACDC,MAAM,GAAWC,OAAO,CAACC,GAAG,CAACC,SAAS;EAC/CC,KAAK,GAAYH,OAAO,CAACC,GAAG,CAACG,KAAK,KAAK,MAAM;EAE9CC,WAAWA,CAACC,OAAyB,EAAE;IAC1C,IAAI,CAACC,QAAQ,CAACD,OAAO,EAAEH,KAAK,CAAC;EACjC;EAEA,MAAaH,OAAOA,CAChBQ,cAAsB,EACtBC,KAAe,EACuB;IACtC,MAAMC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAACH,KAAK,CAAC;IACnC,MAAMI,QAAQ,GAAG,IAAAC,iBAAQ,EAAC;MACtBC,cAAc,EAAE,IAAIC,gCAAe,CAAC;QAChCC,iBAAiB,EAAE,CAAC;QACpBC,SAAS,EAAE,IAAIC,WAAS,CAAC;UACrBC,UAAU,EAAE,KAAK;UAC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