@webiny/api-page-builder-import-export 0.0.0-unstable.97a151f74d → 0.0.0-unstable.98511f29f1
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 +2 -2
- package/client.js +2 -6
- package/client.js.map +1 -1
- package/export/combine/blocksHandler.d.ts +6 -0
- package/export/combine/blocksHandler.js +99 -0
- package/export/combine/blocksHandler.js.map +1 -0
- package/export/combine/formsHandler.d.ts +6 -0
- package/export/combine/formsHandler.js +99 -0
- package/export/combine/formsHandler.js.map +1 -0
- package/{exportPages → export}/combine/index.d.ts +3 -2
- package/export/combine/index.js +42 -0
- package/export/combine/index.js.map +1 -0
- package/export/combine/pagesHandler.d.ts +6 -0
- package/export/combine/pagesHandler.js +99 -0
- package/export/combine/pagesHandler.js.map +1 -0
- package/export/combine/templatesHandler.d.ts +6 -0
- package/export/combine/templatesHandler.js +99 -0
- package/export/combine/templatesHandler.js.map +1 -0
- package/export/process/blocksHandler.d.ts +6 -0
- package/export/process/blocksHandler.js +167 -0
- package/export/process/blocksHandler.js.map +1 -0
- package/export/process/exporters/BlockExporter.d.ts +13 -0
- package/export/process/exporters/BlockExporter.js +81 -0
- package/export/process/exporters/BlockExporter.js.map +1 -0
- package/export/process/exporters/FormExporter.d.ts +9 -0
- package/export/process/exporters/FormExporter.js +34 -0
- package/export/process/exporters/FormExporter.js.map +1 -0
- package/export/process/exporters/PageExporter.d.ts +11 -0
- package/export/process/exporters/PageExporter.js +58 -0
- package/export/process/exporters/PageExporter.js.map +1 -0
- package/export/process/exporters/PageTemplateExporter.d.ts +11 -0
- package/export/process/exporters/PageTemplateExporter.js +56 -0
- package/export/process/exporters/PageTemplateExporter.js.map +1 -0
- package/export/process/formsHandler.d.ts +6 -0
- package/export/process/formsHandler.js +187 -0
- package/export/process/formsHandler.js.map +1 -0
- package/{exportPages → export}/process/index.d.ts +4 -6
- package/export/process/index.js +39 -0
- package/export/process/index.js.map +1 -0
- package/export/process/pagesHandler.d.ts +6 -0
- package/export/process/pagesHandler.js +189 -0
- package/export/process/pagesHandler.js.map +1 -0
- package/export/process/templatesHandler.d.ts +6 -0
- package/export/process/templatesHandler.js +166 -0
- package/export/process/templatesHandler.js.map +1 -0
- package/{exportPages → export}/s3Stream.d.ts +5 -2
- package/{exportPages → export}/s3Stream.js +1 -20
- package/export/s3Stream.js.map +1 -0
- package/export/utils.d.ts +2 -0
- package/export/utils.js +35 -0
- package/export/utils.js.map +1 -0
- package/{exportPages → export}/zipper.d.ts +6 -5
- package/{exportPages → export}/zipper.js +38 -49
- package/export/zipper.js.map +1 -0
- package/graphql/crud/blocks.crud.d.ts +4 -0
- package/graphql/crud/blocks.crud.js +130 -0
- package/graphql/crud/blocks.crud.js.map +1 -0
- package/graphql/crud/forms.crud.d.ts +4 -0
- package/graphql/crud/forms.crud.js +134 -0
- package/graphql/crud/forms.crud.js.map +1 -0
- package/graphql/crud/importExportTasks.crud.d.ts +5 -0
- package/graphql/crud/{pageImportExportTasks.crud.js → importExportTasks.crud.js} +92 -139
- package/graphql/crud/importExportTasks.crud.js.map +1 -0
- package/graphql/crud/pages.crud.d.ts +3 -2
- package/graphql/crud/pages.crud.js +50 -59
- package/graphql/crud/pages.crud.js.map +1 -1
- package/graphql/crud/templates.crud.d.ts +4 -0
- package/graphql/crud/templates.crud.js +128 -0
- package/graphql/crud/templates.crud.js.map +1 -0
- package/graphql/crud.d.ts +2 -2
- package/graphql/crud.js +5 -7
- package/graphql/crud.js.map +1 -1
- package/graphql/graphql/blocks.gql.d.ts +4 -0
- package/graphql/graphql/blocks.gql.js +52 -0
- package/graphql/graphql/blocks.gql.js.map +1 -0
- package/graphql/graphql/forms.gql.d.ts +4 -0
- package/graphql/graphql/forms.gql.js +60 -0
- package/graphql/graphql/forms.gql.js.map +1 -0
- package/graphql/graphql/importExportTasks.gql.d.ts +4 -0
- package/graphql/graphql/{pageImportExportTasks.gql.js → importExportTasks.gql.js} +18 -23
- package/graphql/graphql/importExportTasks.gql.js.map +1 -0
- package/graphql/graphql/pages.gql.d.ts +2 -2
- package/graphql/graphql/pages.gql.js +4 -15
- package/graphql/graphql/pages.gql.js.map +1 -1
- package/graphql/graphql/templates.gql.d.ts +4 -0
- package/graphql/graphql/templates.gql.js +52 -0
- package/graphql/graphql/templates.gql.js.map +1 -0
- package/graphql/graphql/utils/resolve.d.ts +1 -1
- package/graphql/graphql/utils/resolve.js +0 -3
- package/graphql/graphql/utils/resolve.js.map +1 -1
- package/graphql/graphql.js +5 -6
- package/graphql/graphql.js.map +1 -1
- package/graphql/index.d.ts +2 -2
- package/graphql/index.js +0 -5
- package/graphql/index.js.map +1 -1
- package/graphql/types.d.ts +82 -23
- package/graphql/types.js.map +1 -1
- package/import/constants.d.ts +3 -0
- package/import/constants.js +14 -0
- package/import/constants.js.map +1 -0
- package/import/create/blocksHandler.d.ts +3 -0
- package/import/create/blocksHandler.js +99 -0
- package/import/create/blocksHandler.js.map +1 -0
- package/import/create/formsHandler.d.ts +3 -0
- package/import/create/formsHandler.js +103 -0
- package/import/create/formsHandler.js.map +1 -0
- package/{importPages → import}/create/index.d.ts +7 -5
- package/import/create/index.js +42 -0
- package/import/create/index.js.map +1 -0
- package/import/create/pagesHandler.d.ts +3 -0
- package/import/create/pagesHandler.js +103 -0
- package/import/create/pagesHandler.js.map +1 -0
- package/import/create/templatesHandler.d.ts +3 -0
- package/import/create/templatesHandler.js +99 -0
- package/import/create/templatesHandler.js.map +1 -0
- package/import/process/blocks/blocksHandler.d.ts +3 -0
- package/import/process/blocks/blocksHandler.js +168 -0
- package/import/process/blocks/blocksHandler.js.map +1 -0
- package/import/process/blocks/importBlock.d.ts +11 -0
- package/import/process/blocks/importBlock.js +106 -0
- package/import/process/blocks/importBlock.js.map +1 -0
- package/import/process/forms/formsHandler.d.ts +3 -0
- package/import/process/forms/formsHandler.js +176 -0
- package/import/process/forms/formsHandler.js.map +1 -0
- package/import/process/forms/importForm.d.ts +9 -0
- package/import/process/forms/importForm.js +43 -0
- package/import/process/forms/importForm.js.map +1 -0
- package/{importPages → import}/process/index.d.ts +5 -3
- package/import/process/index.js +39 -0
- package/import/process/index.js.map +1 -0
- package/import/process/pages/importPage.d.ts +11 -0
- package/import/process/pages/importPage.js +92 -0
- package/import/process/pages/importPage.js.map +1 -0
- package/import/process/pages/pagesHandler.d.ts +3 -0
- package/import/process/pages/pagesHandler.js +183 -0
- package/import/process/pages/pagesHandler.js.map +1 -0
- package/import/process/templates/importTemplate.d.ts +11 -0
- package/import/process/templates/importTemplate.js +66 -0
- package/import/process/templates/importTemplate.js.map +1 -0
- package/import/process/templates/templatesHandler.d.ts +3 -0
- package/import/process/templates/templatesHandler.js +170 -0
- package/import/process/templates/templatesHandler.js.map +1 -0
- package/import/utils/deleteS3Folder.d.ts +1 -0
- package/import/utils/deleteS3Folder.js +19 -0
- package/import/utils/deleteS3Folder.js.map +1 -0
- package/import/utils/extractAndUploadZipFileContents.d.ts +7 -0
- package/import/utils/extractAndUploadZipFileContents.js +122 -0
- package/import/utils/extractAndUploadZipFileContents.js.map +1 -0
- package/import/utils/extractZipAndUploadToS3.d.ts +2 -0
- package/import/utils/extractZipAndUploadToS3.js +98 -0
- package/import/utils/extractZipAndUploadToS3.js.map +1 -0
- package/import/utils/getFileNameWithoutExt.d.ts +1 -0
- package/import/utils/getFileNameWithoutExt.js +11 -0
- package/import/utils/getFileNameWithoutExt.js.map +1 -0
- package/import/utils/index.d.ts +9 -0
- package/import/utils/index.js +104 -0
- package/import/utils/index.js.map +1 -0
- package/import/utils/initialStats.d.ts +7 -0
- package/import/utils/initialStats.js +16 -0
- package/import/utils/initialStats.js.map +1 -0
- package/import/utils/prepareDataDirMap.d.ts +6 -0
- package/import/utils/prepareDataDirMap.js +29 -0
- package/import/utils/prepareDataDirMap.js.map +1 -0
- package/import/utils/updateFilesInData.d.ts +8 -0
- package/import/utils/updateFilesInData.js +49 -0
- package/import/utils/updateFilesInData.js.map +1 -0
- package/import/utils/uploadAssets.d.ts +10 -0
- package/import/utils/uploadAssets.js +87 -0
- package/import/utils/uploadAssets.js.map +1 -0
- package/import/utils/uploadFilesFromS3.d.ts +3 -0
- package/import/utils/uploadFilesFromS3.js +19 -0
- package/import/utils/uploadFilesFromS3.js.map +1 -0
- package/mockSecurity.js +0 -3
- package/mockSecurity.js.map +1 -1
- package/package.json +34 -37
- package/types.d.ts +83 -65
- package/types.js +69 -22
- package/types.js.map +1 -1
- package/exportPages/combine/index.js +0 -114
- package/exportPages/combine/index.js.map +0 -1
- package/exportPages/process/index.js +0 -208
- package/exportPages/process/index.js.map +0 -1
- package/exportPages/s3Stream.js.map +0 -1
- package/exportPages/utils.d.ts +0 -13
- package/exportPages/utils.js +0 -113
- package/exportPages/utils.js.map +0 -1
- package/exportPages/zipper.js.map +0 -1
- package/graphql/crud/pageImportExportTasks.crud.d.ts +0 -5
- package/graphql/crud/pageImportExportTasks.crud.js.map +0 -1
- package/graphql/graphql/pageImportExportTasks.gql.d.ts +0 -4
- package/graphql/graphql/pageImportExportTasks.gql.js.map +0 -1
- package/importPages/create/index.js +0 -118
- package/importPages/create/index.js.map +0 -1
- package/importPages/process/index.js +0 -185
- package/importPages/process/index.js.map +0 -1
- package/importPages/utils.d.ts +0 -50
- package/importPages/utils.js +0 -570
- package/importPages/utils.js.map +0 -1
package/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_types","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","ExportRevisionType","ImportExportTaskStatus"],"sources":["types.ts"],"sourcesContent":["export * from \"./graphql/types\";\n\n// Entities.\nexport enum ExportRevisionType {\n PUBLISHED = \"published\",\n LATEST = \"latest\"\n}\n\nexport enum ImportExportTaskStatus {\n PENDING = \"pending\",\n PROCESSING = \"processing\",\n COMPLETED = \"completed\",\n FAILED = \"failed\"\n}\n\nexport interface ImportExportTaskStats {\n [ImportExportTaskStatus.PENDING]: number;\n [ImportExportTaskStatus.PROCESSING]: number;\n [ImportExportTaskStatus.COMPLETED]: number;\n [ImportExportTaskStatus.FAILED]: number;\n total: number;\n}\n\ninterface CreatedBy {\n id: string;\n type: string;\n displayName: string | null;\n}\n\nexport interface ImportExportTask {\n id: string;\n parent: string;\n status: ImportExportTaskStatus;\n data: Record<string, any>;\n stats: ImportExportTaskStats;\n error: Record<string, any>;\n input: Record<string, any>;\n createdOn: string;\n createdBy: CreatedBy;\n tenant: string;\n locale: string;\n}\n\nexport interface File {\n id: string;\n src: string;\n}\n\nexport interface MetaResponse {\n cursor: string | null;\n totalCount: number;\n hasMoreItems: boolean;\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperationsGetParams {\n where: {\n id: string;\n tenant: string;\n locale: string;\n };\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperationsListParams {\n where: {\n tenant: string;\n locale: string;\n };\n sort?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport type ImportExportTaskStorageOperationsListResponse = [ImportExportTask[], MetaResponse];\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperationsCreateParams {\n input: Record<string, any>;\n task: ImportExportTask;\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperationsUpdateParams {\n input: Record<string, any>;\n original: ImportExportTask;\n task: ImportExportTask;\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperationsDeleteParams {\n task: ImportExportTask;\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperationsGetSubTaskParams {\n where: {\n id: string;\n parent: string;\n tenant: string;\n locale: string;\n };\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperationsListSubTaskParams {\n where: {\n tenant: string;\n locale: string;\n parent: string;\n status: ImportExportTaskStatus;\n createdBy?: string;\n };\n sort?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport type ImportExportTaskStorageOperationsListSubTaskResponse = [\n ImportExportTask[],\n MetaResponse\n];\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperationsCreateSubTaskParams {\n input: Record<string, any>;\n subTask: ImportExportTask;\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperationsUpdateSubTaskParams {\n input: Record<string, any>;\n original: ImportExportTask;\n subTask: ImportExportTask;\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperationsUpdateTaskStatsParams {\n input: {\n prevStatus: ImportExportTaskStatus;\n nextStatus: ImportExportTaskStatus;\n };\n original: ImportExportTask;\n}\n\n/**\n * @category StorageOperations\n * @category ImportExportTaskStorageOperations\n */\nexport interface ImportExportTaskStorageOperations {\n /**\n * Get a single import export task item by given params.\n */\n getTask(params: ImportExportTaskStorageOperationsGetParams): Promise<ImportExportTask | null>;\n\n /**\n * Get all import export tasks by given params.\n */\n listTasks(\n params: ImportExportTaskStorageOperationsListParams\n ): Promise<ImportExportTaskStorageOperationsListResponse>;\n\n createTask(params: ImportExportTaskStorageOperationsCreateParams): Promise<ImportExportTask>;\n\n updateTask(params: ImportExportTaskStorageOperationsUpdateParams): Promise<ImportExportTask>;\n\n deleteTask(params: ImportExportTaskStorageOperationsDeleteParams): Promise<ImportExportTask>;\n\n updateTaskStats(\n params: ImportExportTaskStorageOperationsUpdateTaskStatsParams\n ): Promise<ImportExportTask>;\n\n /**\n * Get a single import export sub-task item by given params.\n */\n getSubTask(\n params: ImportExportTaskStorageOperationsGetSubTaskParams\n ): Promise<ImportExportTask | null>;\n\n /**\n * Get all import export sub-tasks by given params.\n */\n listSubTasks(\n params: ImportExportTaskStorageOperationsListSubTaskParams\n ): Promise<ImportExportTaskStorageOperationsListSubTaskResponse>;\n\n createSubTask(\n params: ImportExportTaskStorageOperationsCreateSubTaskParams\n ): Promise<ImportExportTask>;\n\n updateSubTask(\n params: ImportExportTaskStorageOperationsUpdateSubTaskParams\n ): Promise<ImportExportTask>;\n}\n\nexport interface FileUploadsData {\n /**\n * Location of export data file. Export data contains the relevant entity data (block, page, template), and an\n * array of file objects, exported from the DB, that need to be imported.\n *\n * Example:\n * 'IMPORTS/8lf6y7xp5/8lf6x9v68-header-1/8lf6x9v69-header-1/Header #1.json'\n */\n data: string;\n /**\n * Example:\n * '8ldspraka-9l9iaffak-1.jpeg': 'IMPORTS/8lf6y7xp5/8lf6x9v68-header-1/assets/8ldspraka-9l9iaffak-1.jpeg',\n * '8ldwyq8ao-pb-editor-page-element-rzfKWtdTWN.png': 'IMPORTS/8lf6y7xp5/8lf6x9v69-header-1/assets/8ldwyq8ao-pb-editor-page-element-rzfKWtdTWN.png'\n */\n assets: Record<string, string>;\n}\n\nexport interface ImportData {\n assets: Record<string, string>;\n data: string;\n key: string;\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AAEA;AAAA,IACYS,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAAJ,OAAA,CAAAI,kBAAA,GAAAA,kBAAA;AAAA,IAKlBC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AA8ClC;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AAHAL,OAAA,CAAAK,sBAAA,GAAAA,sBAAA"}
|
@@ -1,114 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _types = require("../../types");
|
9
|
-
|
10
|
-
var _s3Stream = require("../s3Stream");
|
11
|
-
|
12
|
-
var _zipper = require("../zipper");
|
13
|
-
|
14
|
-
var _mockSecurity = require("../../mockSecurity");
|
15
|
-
|
16
|
-
var _handlerAws = require("@webiny/handler-aws");
|
17
|
-
|
18
|
-
/**
|
19
|
-
* Handles the export pages combine workflow.
|
20
|
-
*/
|
21
|
-
var _default = () => {
|
22
|
-
return (0, _handlerAws.createRawEventHandler)(async ({
|
23
|
-
payload,
|
24
|
-
context
|
25
|
-
}) => {
|
26
|
-
const log = console.log;
|
27
|
-
log("RUNNING Export Pages Combine Handler");
|
28
|
-
const {
|
29
|
-
pageBuilder
|
30
|
-
} = context;
|
31
|
-
const {
|
32
|
-
taskId,
|
33
|
-
identity
|
34
|
-
} = payload;
|
35
|
-
(0, _mockSecurity.mockSecurity)(identity, context);
|
36
|
-
|
37
|
-
try {
|
38
|
-
const task = await pageBuilder.pageImportExportTask.getTask(taskId);
|
39
|
-
|
40
|
-
if (!task) {
|
41
|
-
return {
|
42
|
-
data: null,
|
43
|
-
error: {
|
44
|
-
message: `There is no task with ID "${taskId}".`
|
45
|
-
}
|
46
|
-
};
|
47
|
-
}
|
48
|
-
|
49
|
-
const {
|
50
|
-
exportPagesDataKey
|
51
|
-
} = task.input; // Get all files (zip) from given key
|
52
|
-
|
53
|
-
const listObjectResponse = await _s3Stream.s3Stream.listObject(exportPagesDataKey);
|
54
|
-
|
55
|
-
if (!listObjectResponse.Contents) {
|
56
|
-
return {
|
57
|
-
data: null,
|
58
|
-
error: {
|
59
|
-
message: "There is no Contents defined on S3 Stream while combining pages."
|
60
|
-
}
|
61
|
-
};
|
62
|
-
}
|
63
|
-
|
64
|
-
const zipFileKeys = listObjectResponse.Contents.filter(file => file.Key !== exportPagesDataKey).map(file => file.Key).filter(Boolean); // Prepare zip of all zips
|
65
|
-
|
66
|
-
const zipOfZip = new _zipper.ZipOfZip(zipFileKeys); // Upload
|
67
|
-
|
68
|
-
const pageExportUpload = await zipOfZip.process();
|
69
|
-
log(`Done uploading... File is located at ${pageExportUpload.Location} `); // Update task status and save export page data key
|
70
|
-
|
71
|
-
await pageBuilder.pageImportExportTask.updateTask(taskId, {
|
72
|
-
status: _types.PageImportExportTaskStatus.COMPLETED,
|
73
|
-
data: {
|
74
|
-
message: `Finish uploading page export.`,
|
75
|
-
key: pageExportUpload.Key,
|
76
|
-
url: _s3Stream.s3Stream.getPresignedUrl(pageExportUpload.Key)
|
77
|
-
}
|
78
|
-
}); // Remove individual zip files from storage
|
79
|
-
|
80
|
-
const deleteFilePromises = zipFileKeys.map(key => _s3Stream.s3Stream.deleteObject(key));
|
81
|
-
await Promise.all(deleteFilePromises);
|
82
|
-
log(`Successfully deleted ${deleteFilePromises.length} zip files.`);
|
83
|
-
} catch (e) {
|
84
|
-
log("[EXPORT_PAGES_COMBINE] Error => ", e);
|
85
|
-
/**
|
86
|
-
* In case of error, we'll update the task status to "failed",
|
87
|
-
* so that, client can show notify the user appropriately.
|
88
|
-
*/
|
89
|
-
|
90
|
-
await pageBuilder.pageImportExportTask.updateTask(taskId, {
|
91
|
-
status: _types.PageImportExportTaskStatus.FAILED,
|
92
|
-
error: {
|
93
|
-
name: e.name,
|
94
|
-
message: e.message,
|
95
|
-
stack: e.stack,
|
96
|
-
code: "EXPORT_FAILED"
|
97
|
-
}
|
98
|
-
});
|
99
|
-
return {
|
100
|
-
data: null,
|
101
|
-
error: {
|
102
|
-
message: e.message
|
103
|
-
}
|
104
|
-
};
|
105
|
-
}
|
106
|
-
|
107
|
-
return {
|
108
|
-
data: "",
|
109
|
-
error: null
|
110
|
-
};
|
111
|
-
});
|
112
|
-
};
|
113
|
-
|
114
|
-
exports.default = _default;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["createRawEventHandler","payload","context","log","console","pageBuilder","taskId","identity","mockSecurity","task","pageImportExportTask","getTask","data","error","message","exportPagesDataKey","input","listObjectResponse","s3Stream","listObject","Contents","zipFileKeys","filter","file","Key","map","Boolean","zipOfZip","ZipOfZip","pageExportUpload","process","Location","updateTask","status","PageImportExportTaskStatus","COMPLETED","key","url","getPresignedUrl","deleteFilePromises","deleteObject","Promise","all","length","e","FAILED","name","stack","code"],"sources":["index.ts"],"sourcesContent":["import { PageImportExportTaskStatus, PbPageImportExportContext } from \"~/types\";\nimport { s3Stream } from \"../s3Stream\";\nimport { ZipOfZip } from \"../zipper\";\nimport { mockSecurity } from \"~/mockSecurity\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\n\nexport interface Payload {\n taskId: string;\n identity: SecurityIdentity;\n}\n\nexport interface Response {\n data: string | null;\n error: Partial<Error> | null;\n}\n\n/**\n * Handles the export pages combine workflow.\n */\nexport default () => {\n return createRawEventHandler<Payload, PbPageImportExportContext, Response>(\n async ({ payload, context }) => {\n const log = console.log;\n\n log(\"RUNNING Export Pages Combine Handler\");\n const { pageBuilder } = context;\n const { taskId, identity } = payload;\n\n mockSecurity(identity, context);\n\n try {\n const task = await pageBuilder.pageImportExportTask.getTask(taskId);\n if (!task) {\n return {\n data: null,\n error: {\n message: `There is no task with ID \"${taskId}\".`\n }\n };\n }\n\n const { exportPagesDataKey } = task.input;\n\n // Get all files (zip) from given key\n const listObjectResponse = await s3Stream.listObject(exportPagesDataKey);\n if (!listObjectResponse.Contents) {\n return {\n data: null,\n error: {\n message:\n \"There is no Contents defined on S3 Stream while combining pages.\"\n }\n };\n }\n\n const zipFileKeys = listObjectResponse.Contents.filter(\n file => file.Key !== exportPagesDataKey\n )\n .map(file => file.Key)\n .filter(Boolean) as string[];\n\n // Prepare zip of all zips\n const zipOfZip = new ZipOfZip(zipFileKeys);\n\n // Upload\n const pageExportUpload = await zipOfZip.process();\n log(`Done uploading... File is located at ${pageExportUpload.Location} `);\n\n // Update task status and save export page data key\n await pageBuilder.pageImportExportTask.updateTask(taskId, {\n status: PageImportExportTaskStatus.COMPLETED,\n data: {\n message: `Finish uploading page export.`,\n key: pageExportUpload.Key,\n url: s3Stream.getPresignedUrl(pageExportUpload.Key)\n }\n });\n\n // Remove individual zip files from storage\n const deleteFilePromises = zipFileKeys.map(key => s3Stream.deleteObject(key));\n await Promise.all(deleteFilePromises);\n log(`Successfully deleted ${deleteFilePromises.length} zip files.`);\n } catch (e) {\n log(\"[EXPORT_PAGES_COMBINE] Error => \", e);\n\n /**\n * In case of error, we'll update the task status to \"failed\",\n * so that, client can show notify the user appropriately.\n */\n await pageBuilder.pageImportExportTask.updateTask(taskId, {\n status: PageImportExportTaskStatus.FAILED,\n error: {\n name: e.name,\n message: e.message,\n stack: e.stack,\n code: \"EXPORT_FAILED\"\n }\n });\n\n return {\n data: null,\n error: {\n message: e.message\n }\n };\n }\n return {\n data: \"\",\n error: null\n };\n }\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AAYA;AACA;AACA;eACe,MAAM;EACjB,OAAO,IAAAA,iCAAA,EACH,OAAO;IAAEC,OAAF;IAAWC;EAAX,CAAP,KAAgC;IAC5B,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAApB;IAEAA,GAAG,CAAC,sCAAD,CAAH;IACA,MAAM;MAAEE;IAAF,IAAkBH,OAAxB;IACA,MAAM;MAAEI,MAAF;MAAUC;IAAV,IAAuBN,OAA7B;IAEA,IAAAO,0BAAA,EAAaD,QAAb,EAAuBL,OAAvB;;IAEA,IAAI;MACA,MAAMO,IAAI,GAAG,MAAMJ,WAAW,CAACK,oBAAZ,CAAiCC,OAAjC,CAAyCL,MAAzC,CAAnB;;MACA,IAAI,CAACG,IAAL,EAAW;QACP,OAAO;UACHG,IAAI,EAAE,IADH;UAEHC,KAAK,EAAE;YACHC,OAAO,EAAG,6BAA4BR,MAAO;UAD1C;QAFJ,CAAP;MAMH;;MAED,MAAM;QAAES;MAAF,IAAyBN,IAAI,CAACO,KAApC,CAXA,CAaA;;MACA,MAAMC,kBAAkB,GAAG,MAAMC,kBAAA,CAASC,UAAT,CAAoBJ,kBAApB,CAAjC;;MACA,IAAI,CAACE,kBAAkB,CAACG,QAAxB,EAAkC;QAC9B,OAAO;UACHR,IAAI,EAAE,IADH;UAEHC,KAAK,EAAE;YACHC,OAAO,EACH;UAFD;QAFJ,CAAP;MAOH;;MAED,MAAMO,WAAW,GAAGJ,kBAAkB,CAACG,QAAnB,CAA4BE,MAA5B,CAChBC,IAAI,IAAIA,IAAI,CAACC,GAAL,KAAaT,kBADL,EAGfU,GAHe,CAGXF,IAAI,IAAIA,IAAI,CAACC,GAHF,EAIfF,MAJe,CAIRI,OAJQ,CAApB,CAzBA,CA+BA;;MACA,MAAMC,QAAQ,GAAG,IAAIC,g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AC,CAAC9B;QADR;MAFJ,CAAP;IAMH;;IACD,OAAO;MACHF,IAAI,EAAE,EADH;MAEHC,KAAK,EAAE;IAFJ,CAAP;EAIH,CA1FE,CAAP;AA4FH,C"}
|
@@ -1,208 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _types = require("../../types");
|
9
|
-
|
10
|
-
var _client = require("../../client");
|
11
|
-
|
12
|
-
var _handlerGraphql = require("@webiny/handler-graphql");
|
13
|
-
|
14
|
-
var _utils = require("../utils");
|
15
|
-
|
16
|
-
var _mockSecurity = require("../../mockSecurity");
|
17
|
-
|
18
|
-
var _utils2 = require("@webiny/utils");
|
19
|
-
|
20
|
-
var _handlerAws = require("@webiny/handler-aws");
|
21
|
-
|
22
|
-
/**
|
23
|
-
* Handles the export pages process workflow.
|
24
|
-
*/
|
25
|
-
var _default = configuration => {
|
26
|
-
return (0, _handlerAws.createRawEventHandler)(async ({
|
27
|
-
payload,
|
28
|
-
context
|
29
|
-
}) => {
|
30
|
-
const log = console.log;
|
31
|
-
let subTask;
|
32
|
-
let noPendingTask = true;
|
33
|
-
let prevStatusOfSubTask = _types.PageImportExportTaskStatus.PENDING;
|
34
|
-
log("RUNNING Export Pages Process Handler");
|
35
|
-
const {
|
36
|
-
pageBuilder,
|
37
|
-
fileManager
|
38
|
-
} = context;
|
39
|
-
const {
|
40
|
-
taskId,
|
41
|
-
subTaskIndex,
|
42
|
-
identity
|
43
|
-
} = payload; // Disable authorization; this is necessary because we call Page Builder CRUD methods which include authorization checks
|
44
|
-
// and this Lambda is invoked internally, without credentials.
|
45
|
-
|
46
|
-
(0, _mockSecurity.mockSecurity)(identity, context);
|
47
|
-
|
48
|
-
try {
|
49
|
-
/*
|
50
|
-
* Note: We're not going to DB for finding the next sub-task to process,
|
51
|
-
* because the data might be out of sync due to GSI eventual consistency.
|
52
|
-
*/
|
53
|
-
subTask = await pageBuilder.pageImportExportTask.getSubTask(taskId, (0, _utils2.zeroPad)(subTaskIndex, 5));
|
54
|
-
/**
|
55
|
-
* Base condition!!
|
56
|
-
* Bail out early, if task not found or task's status is not "pending".
|
57
|
-
*/
|
58
|
-
|
59
|
-
if (!subTask || subTask.status !== _types.PageImportExportTaskStatus.PENDING) {
|
60
|
-
noPendingTask = true;
|
61
|
-
return {
|
62
|
-
data: "",
|
63
|
-
error: null
|
64
|
-
};
|
65
|
-
} else {
|
66
|
-
noPendingTask = false;
|
67
|
-
}
|
68
|
-
|
69
|
-
log(`Fetched sub task => ${subTask.id}`);
|
70
|
-
const {
|
71
|
-
input
|
72
|
-
} = subTask;
|
73
|
-
const {
|
74
|
-
pageId,
|
75
|
-
exportPagesDataKey,
|
76
|
-
revisionType
|
77
|
-
} = input;
|
78
|
-
/**
|
79
|
-
* At the moment, we only export a single revision of the page.
|
80
|
-
* It could be "published" or "latest" depending upon user input.
|
81
|
-
*
|
82
|
-
* Note: In case of no "published" revision available, we use the latest revision.
|
83
|
-
*/
|
84
|
-
|
85
|
-
let page;
|
86
|
-
|
87
|
-
try {
|
88
|
-
if (revisionType === _types.PageExportRevisionType.PUBLISHED) {
|
89
|
-
// Get "published" page.
|
90
|
-
page = await pageBuilder.getPublishedPageById({
|
91
|
-
id: pageId
|
92
|
-
});
|
93
|
-
} else {
|
94
|
-
// Get "latest" page.
|
95
|
-
page = await pageBuilder.getPage(pageId);
|
96
|
-
}
|
97
|
-
} catch (e) {
|
98
|
-
// If we're looking for "published" page and doesn't found it, get latest page.
|
99
|
-
if (revisionType === _types.PageExportRevisionType.PUBLISHED && e instanceof _handlerGraphql.NotFoundError) {
|
100
|
-
page = await pageBuilder.getPage(pageId);
|
101
|
-
} else {
|
102
|
-
throw e;
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
if (!page) {
|
107
|
-
log(`Unable to load page "${pageId}"`);
|
108
|
-
throw new _handlerGraphql.NotFoundError(`Unable to load page "${pageId}"`);
|
109
|
-
}
|
110
|
-
|
111
|
-
log(`Processing page key "${pageId}" | version ${page.version} | ${page.status}`); // Mark task status as PROCESSING
|
112
|
-
|
113
|
-
subTask = await pageBuilder.pageImportExportTask.updateSubTask(taskId, subTask.id, {
|
114
|
-
status: _types.PageImportExportTaskStatus.PROCESSING
|
115
|
-
}); // Update stats in main task
|
116
|
-
|
117
|
-
await pageBuilder.pageImportExportTask.updateStats(taskId, {
|
118
|
-
prevStatus: prevStatusOfSubTask,
|
119
|
-
nextStatus: _types.PageImportExportTaskStatus.PROCESSING
|
120
|
-
});
|
121
|
-
prevStatusOfSubTask = subTask.status;
|
122
|
-
log(`Extracting page data and uploading to storage...`); // Extract Page
|
123
|
-
|
124
|
-
const pageDataZip = await (0, _utils.exportPage)(page, exportPagesDataKey, fileManager);
|
125
|
-
log(`Finish uploading zip...`); // Update task record in DB
|
126
|
-
|
127
|
-
subTask = await pageBuilder.pageImportExportTask.updateSubTask(taskId, subTask.id, {
|
128
|
-
status: _types.PageImportExportTaskStatus.COMPLETED,
|
129
|
-
data: {
|
130
|
-
message: `Finish uploading data for page "${page.id}" v${page.version} (${page.status}).`,
|
131
|
-
key: pageDataZip.Key
|
132
|
-
}
|
133
|
-
}); // Update stats in main task
|
134
|
-
|
135
|
-
await pageBuilder.pageImportExportTask.updateStats(taskId, {
|
136
|
-
prevStatus: prevStatusOfSubTask,
|
137
|
-
nextStatus: _types.PageImportExportTaskStatus.COMPLETED
|
138
|
-
});
|
139
|
-
prevStatusOfSubTask = subTask.status;
|
140
|
-
} catch (e) {
|
141
|
-
log("[EXPORT_PAGES_PROCESS] Error => ", e);
|
142
|
-
|
143
|
-
if (subTask && subTask.id) {
|
144
|
-
/**
|
145
|
-
* In case of error, we'll update the task status to "failed",
|
146
|
-
* so that, client can show notify the user appropriately.
|
147
|
-
*/
|
148
|
-
subTask = await pageBuilder.pageImportExportTask.updateSubTask(taskId, subTask.id, {
|
149
|
-
status: _types.PageImportExportTaskStatus.FAILED,
|
150
|
-
error: {
|
151
|
-
name: e.name,
|
152
|
-
message: e.message,
|
153
|
-
stack: e.stack,
|
154
|
-
code: "EXPORT_FAILED"
|
155
|
-
}
|
156
|
-
}); // Update stats in main task
|
157
|
-
|
158
|
-
await pageBuilder.pageImportExportTask.updateStats(taskId, {
|
159
|
-
prevStatus: prevStatusOfSubTask,
|
160
|
-
nextStatus: _types.PageImportExportTaskStatus.FAILED
|
161
|
-
});
|
162
|
-
prevStatusOfSubTask = subTask.status;
|
163
|
-
}
|
164
|
-
|
165
|
-
return {
|
166
|
-
data: null,
|
167
|
-
error: {
|
168
|
-
message: e.message
|
169
|
-
}
|
170
|
-
};
|
171
|
-
} finally {
|
172
|
-
// Base condition!
|
173
|
-
if (noPendingTask) {
|
174
|
-
log(`No pending sub-task for task ${taskId}`); // Combine individual page zip files.
|
175
|
-
|
176
|
-
await (0, _client.invokeHandlerClient)({
|
177
|
-
context,
|
178
|
-
name: configuration.handlers.combine,
|
179
|
-
payload: {
|
180
|
-
taskId,
|
181
|
-
identity: context.security.getIdentity()
|
182
|
-
},
|
183
|
-
description: "Export pages - combine"
|
184
|
-
});
|
185
|
-
} else {
|
186
|
-
console.log(`Invoking PROCESS for task "${subTaskIndex + 1}"`); // We want to continue with Self invocation no matter if current page error out.
|
187
|
-
|
188
|
-
await (0, _client.invokeHandlerClient)({
|
189
|
-
context,
|
190
|
-
name: configuration.handlers.process,
|
191
|
-
payload: {
|
192
|
-
taskId,
|
193
|
-
subTaskIndex: subTaskIndex + 1,
|
194
|
-
identity: context.security.getIdentity()
|
195
|
-
},
|
196
|
-
description: "Export pages - process - subtask"
|
197
|
-
});
|
198
|
-
}
|
199
|
-
}
|
200
|
-
|
201
|
-
return {
|
202
|
-
data: "",
|
203
|
-
error: null
|
204
|
-
};
|
205
|
-
});
|
206
|
-
};
|
207
|
-
|
208
|
-
exports.default = _default;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["configuration","createRawEventHandler","payload","context","log","console","subTask","noPendingTask","prevStatusOfSubTask","PageImportExportTaskStatus","PENDING","pageBuilder","fileManager","taskId","subTaskIndex","identity","mockSecurity","pageImportExportTask","getSubTask","zeroPad","status","data","error","id","input","pageId","exportPagesDataKey","revisionType","page","PageExportRevisionType","PUBLISHED","getPublishedPageById","getPage","e","NotFoundError","version","updateSubTask","PROCESSING","updateStats","prevStatus","nextStatus","pageDataZip","exportPage","COMPLETED","message","key","Key","FAILED","name","stack","code","invokeHandlerClient","handlers","combine","security","getIdentity","description","process"],"sources":["index.ts"],"sourcesContent":["import {\n PageExportRevisionType,\n PageImportExportTaskStatus,\n PbPageImportExportContext\n} from \"~/types\";\nimport { invokeHandlerClient } from \"~/client\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { exportPage } from \"~/exportPages/utils\";\nimport { Payload as ExtractPayload } from \"../combine\";\nimport { mockSecurity } from \"~/mockSecurity\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { zeroPad } from \"@webiny/utils\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\n\ninterface Configuration {\n handlers: {\n process: string;\n combine: string;\n };\n}\n\nexport interface Payload {\n taskId: string;\n subTaskIndex: number;\n identity?: SecurityIdentity;\n}\n\nexport interface Response {\n data: string | null;\n error: Partial<Error> | null;\n}\n\n/**\n * Handles the export pages process workflow.\n */\nexport default (configuration: Configuration) => {\n return createRawEventHandler<Payload, PbPageImportExportContext, Response>(\n async ({ payload, context }) => {\n const log = console.log;\n let subTask;\n let noPendingTask = true;\n let prevStatusOfSubTask = PageImportExportTaskStatus.PENDING;\n\n log(\"RUNNING Export Pages Process Handler\");\n const { pageBuilder, fileManager } = context;\n const { taskId, subTaskIndex, identity } = payload;\n // Disable authorization; this is necessary because we call Page Builder CRUD methods which include authorization checks\n // and this Lambda is invoked internally, without credentials.\n mockSecurity(identity as SecurityIdentity, context);\n\n try {\n /*\n * Note: We're not going to DB for finding the next sub-task to process,\n * because the data might be out of sync due to GSI eventual consistency.\n */\n subTask = await pageBuilder.pageImportExportTask.getSubTask(\n taskId,\n zeroPad(subTaskIndex, 5)\n );\n /**\n * Base condition!!\n * Bail out early, if task not found or task's status is not \"pending\".\n */\n if (!subTask || subTask.status !== PageImportExportTaskStatus.PENDING) {\n noPendingTask = true;\n return {\n data: \"\",\n error: null\n };\n } else {\n noPendingTask = false;\n }\n\n log(`Fetched sub task => ${subTask.id}`);\n\n const { input } = subTask;\n const { pageId, exportPagesDataKey, revisionType } = input;\n\n /**\n * At the moment, we only export a single revision of the page.\n * It could be \"published\" or \"latest\" depending upon user input.\n *\n * Note: In case of no \"published\" revision available, we use the latest revision.\n */\n let page;\n try {\n if (revisionType === PageExportRevisionType.PUBLISHED) {\n // Get \"published\" page.\n page = await pageBuilder.getPublishedPageById({ id: pageId });\n } else {\n // Get \"latest\" page.\n page = await pageBuilder.getPage(pageId);\n }\n } catch (e) {\n // If we're looking for \"published\" page and doesn't found it, get latest page.\n if (\n revisionType === PageExportRevisionType.PUBLISHED &&\n e instanceof NotFoundError\n ) {\n page = await pageBuilder.getPage(pageId);\n } else {\n throw e;\n }\n }\n\n if (!page) {\n log(`Unable to load page \"${pageId}\"`);\n throw new NotFoundError(`Unable to load page \"${pageId}\"`);\n }\n\n log(`Processing page key \"${pageId}\" | version ${page.version} | ${page.status}`);\n\n // Mark task status as PROCESSING\n subTask = await pageBuilder.pageImportExportTask.updateSubTask(taskId, subTask.id, {\n status: PageImportExportTaskStatus.PROCESSING\n });\n // Update stats in main task\n await pageBuilder.pageImportExportTask.updateStats(taskId, {\n prevStatus: prevStatusOfSubTask,\n nextStatus: PageImportExportTaskStatus.PROCESSING\n });\n prevStatusOfSubTask = subTask.status;\n\n log(`Extracting page data and uploading to storage...`);\n // Extract Page\n const pageDataZip = await exportPage(page, exportPagesDataKey, fileManager);\n log(`Finish uploading zip...`);\n // Update task record in DB\n subTask = await pageBuilder.pageImportExportTask.updateSubTask(taskId, subTask.id, {\n status: PageImportExportTaskStatus.COMPLETED,\n data: {\n message: `Finish uploading data for page \"${page.id}\" v${page.version} (${page.status}).`,\n key: pageDataZip.Key\n }\n });\n // Update stats in main task\n await pageBuilder.pageImportExportTask.updateStats(taskId, {\n prevStatus: prevStatusOfSubTask,\n nextStatus: PageImportExportTaskStatus.COMPLETED\n });\n prevStatusOfSubTask = subTask.status;\n } catch (e) {\n log(\"[EXPORT_PAGES_PROCESS] Error => \", e);\n\n if (subTask && subTask.id) {\n /**\n * In case of error, we'll update the task status to \"failed\",\n * so that, client can show notify the user appropriately.\n */\n subTask = await pageBuilder.pageImportExportTask.updateSubTask(\n taskId,\n subTask.id,\n {\n status: PageImportExportTaskStatus.FAILED,\n error: {\n name: e.name,\n message: e.message,\n stack: e.stack,\n code: \"EXPORT_FAILED\"\n }\n }\n );\n\n // Update stats in main task\n await pageBuilder.pageImportExportTask.updateStats(taskId, {\n prevStatus: prevStatusOfSubTask,\n nextStatus: PageImportExportTaskStatus.FAILED\n });\n prevStatusOfSubTask = subTask.status;\n }\n\n return {\n data: null,\n error: {\n message: e.message\n }\n };\n } finally {\n // Base condition!\n if (noPendingTask) {\n log(`No pending sub-task for task ${taskId}`);\n // Combine individual page zip files.\n await invokeHandlerClient<ExtractPayload>({\n context,\n name: configuration.handlers.combine,\n payload: {\n taskId,\n identity: context.security.getIdentity()\n },\n description: \"Export pages - combine\"\n });\n } else {\n console.log(`Invoking PROCESS for task \"${subTaskIndex + 1}\"`);\n // We want to continue with Self invocation no matter if current page error out.\n await invokeHandlerClient<Payload>({\n context,\n name: configuration.handlers.process,\n payload: {\n taskId,\n subTaskIndex: subTaskIndex + 1,\n identity: context.security.getIdentity()\n },\n description: \"Export pages - process - subtask\"\n });\n }\n }\n return {\n data: \"\",\n error: null\n };\n }\n );\n};\n"],"mappings":";;;;;;;AAAA;;AAKA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AAoBA;AACA;AACA;eACgBA,aAAD,IAAkC;EAC7C,OAAO,IAAA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AmB,GAAGF,OAAO,CAACc,MAA9B;MACH;;MAED,OAAO;QACHC,IAAI,EAAE,IADH;QAEHC,KAAK,EAAE;UACHsB,OAAO,EAAEX,CAAC,CAACW;QADR;MAFJ,CAAP;IAMH,CA/HD,SA+HU;MACN;MACA,IAAIrC,aAAJ,EAAmB;QACfH,GAAG,CAAE,gCAA+BS,MAAO,EAAxC,CAAH,CADe,CAEf;;QACA,MAAM,IAAAsC,2BAAA,EAAoC;UACtChD,OADsC;UAEtC6C,IAAI,EAAEhD,aAAa,CAACoD,QAAd,CAAuBC,OAFS;UAGtCnD,OAAO,EAAE;YACLW,MADK;YAELE,QAAQ,EAAEZ,OAAO,CAACmD,QAAR,CAAiBC,WAAjB;UAFL,CAH6B;UAOtCC,WAAW,EAAE;QAPyB,CAApC,CAAN;MASH,CAZD,MAYO;QACHnD,OAAO,CAACD,GAAR,CAAa,8BAA6BU,YAAY,GAAG,CAAE,GAA3D,EADG,CAEH;;QACA,MAAM,IAAAqC,2BAAA,EAA6B;UAC/BhD,OAD+B;UAE/B6C,IAAI,EAAEhD,aAAa,CAACoD,QAAd,CAAuBK,OAFE;UAG/BvD,OAAO,EAAE;YACLW,MADK;YAELC,YAAY,EAAEA,YAAY,GAAG,CAFxB;YAGLC,QAAQ,EAAEZ,OAAO,CAACmD,QAAR,CAAiBC,WAAjB;UAHL,CAHsB;UAQ/BC,WAAW,EAAE;QARkB,CAA7B,CAAN;MAUH;IACJ;;IACD,OAAO;MACHnC,IAAI,EAAE,EADH;MAEHC,KAAK,EAAE;IAFJ,CAAP;EAIH,CA9KE,CAAP;AAgLH,C"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["ARCHIVE_CONTENT_TYPE","S3Stream","constructor","s3","S3","region","process","env","AWS_REGION","bucket","S3_BUCKET","getPresignedUrl","key","getSignedUrl","Bucket","Key","Expires","isFileAccessible","getObjectHead","error","console","warn","log","headObject","promise","readStream","getObject","createReadStream","writeStream","contentType","streamPassThrough","Stream","PassThrough","params","ACL","Body","ContentType","streamPassThroughUploadPromise","upload","listObject","prefix","listObjects","Prefix","deleteObject","s3Stream"],"sources":["s3Stream.ts"],"sourcesContent":["import { Stream, PassThrough, Readable } from \"stream\";\nimport S3 from \"aws-sdk/clients/s3\";\n\nconst ARCHIVE_CONTENT_TYPE = \"application/zip\";\n\nclass S3Stream {\n s3: S3;\n bucket: string;\n\n constructor() {\n this.s3 = new S3({\n region: process.env.AWS_REGION as string\n });\n this.bucket = process.env.S3_BUCKET as string;\n }\n\n getPresignedUrl(key: string) {\n return this.s3.getSignedUrl(\"getObject\", {\n Bucket: this.bucket,\n Key: key,\n Expires: 604800 // 1 week\n });\n }\n\n /**\n * We're checking if the file is accessible on S3 by getting object meta data.\n * It help us to filter files that we need to download as part of export data.\n * @param Key {string}\n */\n async isFileAccessible(Key: string): Promise<boolean> {\n try {\n await this.getObjectHead(Key);\n return true;\n } catch (error) {\n console.warn(`Error while fetching meta data for file \"${Key}\"`);\n console.log(error);\n return false;\n }\n }\n\n getObjectHead(Key: string): Promise<S3.HeadObjectOutput> {\n return this.s3.headObject({ Bucket: this.bucket, Key }).promise();\n }\n\n readStream(Key: string): Readable {\n return this.s3.getObject({ Bucket: this.bucket, Key }).createReadStream();\n }\n\n writeStream(\n Key: string,\n contentType: string = ARCHIVE_CONTENT_TYPE\n ): {\n streamPassThrough: PassThrough;\n streamPassThroughUploadPromise: Promise<S3.ManagedUpload.SendData>;\n } {\n const streamPassThrough = new Stream.PassThrough();\n\n const params: S3.PutObjectRequest = {\n ACL: \"private\",\n Body: streamPassThrough,\n Bucket: this.bucket,\n ContentType: contentType,\n Key\n };\n\n return {\n streamPassThrough: streamPassThrough,\n /**\n * We're not using the `FileManager` storage plugin here because it currently doesn't support streams.\n */\n streamPassThroughUploadPromise: this.s3.upload(params).promise()\n };\n }\n\n upload(params: {\n Key: string;\n ContentType: string;\n Body: Buffer;\n }): Promise<S3.ManagedUpload.SendData> {\n return this.s3\n .upload({\n ACL: \"private\",\n Bucket: this.bucket,\n ...params\n })\n .promise();\n }\n\n listObject(prefix: string): Promise<S3.ListObjectsOutput> {\n return this.s3\n .listObjects({\n Bucket: this.bucket,\n Prefix: prefix\n })\n .promise();\n }\n\n deleteObject(key: string): Promise<S3.DeleteObjectOutput> {\n return this.s3.deleteObject({ Key: key, Bucket: this.bucket }).promise();\n }\n}\n\nexport const s3Stream = new S3Stream();\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA,MAAMA,oBAAoB,GAAG,iBAA7B;;AAEA,MAAMC,QAAN,CAAe;EAIXC,WAAW,GAAG;IAAA;IAAA;IACV,KAAKC,EAAL,GAAU,IAAIC,UAAJ,CAAO;MACbC,MAAM,EAAEC,OAAO,CAACC,GAAR,CAAYC;IADP,CAAP,CAAV;IAGA,KAAKC,MAAL,GAAcH,OAAO,CAACC,GAAR,CAAYG,SAA1B;EACH;;EAEDC,eAAe,CAACC,GAAD,EAAc;IACzB,OAAO,KAAKT,EAAL,CAAQU,YAAR,CAAqB,WAArB,EAAkC;MACrCC,MAAM,EAAE,KAAKL,MADwB;MAErCM,GAAG,EAAEH,GAFgC;MAGrCI,OAAO,EAAE,MAH4B,CAGrB;;IAHqB,CAAlC,CAAP;EAKH;EAED;AACJ;AACA;AACA;AACA;;;EAC0B,MAAhBC,gBAAgB,CAACF,GAAD,EAAgC;IAClD,IAAI;MACA,MAAM,KAAKG,aAAL,CAAmBH,GAAnB,CAAN;MACA,OAAO,IAAP;IACH,CAHD,CAGE,OAAOI,KAAP,EAAc;MACZC,OAAO,CAACC,IAAR,CAAc,4CAA2CN,GAAI,GAA7D;MACAK,OAAO,CAACE,GAAR,CAAYH,KAAZ;MACA,OAAO,KAAP;IACH;EACJ;;EAEDD,aAAa,CAACH,GAAD,EAA4C;IACrD,OAAO,KAAKZ,EAAL,CAAQoB,UAAR,CAAmB;MAAET,MAAM,EAAE,KAAKL,MAAf;MAAuBM;IAAvB,CAAnB,EAAiDS,OAAjD,EAAP;EACH;;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0 @@
|
|
1
|
-
import S3 from "aws-sdk/clients/s3";
|
2
|
-
import { Page, File } from "@webiny/api-page-builder/types";
|
3
|
-
import { FileManagerContext } from "@webiny/api-file-manager/types";
|
4
|
-
export declare const EXPORT_PAGES_FOLDER_KEY = "WEBINY_PB_EXPORT_PAGES";
|
5
|
-
export interface ExportedPageData {
|
6
|
-
page: Pick<Page, "content" | "title" | "version" | "status" | "settings" | "path">;
|
7
|
-
files: ImageFile[];
|
8
|
-
}
|
9
|
-
export declare function exportPage(page: Page, exportPagesDataKey: string, fileManager: FileManagerContext["fileManager"]): Promise<S3.ManagedUpload.SendData>;
|
10
|
-
export interface ImageFile extends Omit<File, "src"> {
|
11
|
-
key: string;
|
12
|
-
}
|
13
|
-
export declare function extractFilesFromPageData(data: Record<string, any>, files?: any[]): ImageFile[];
|
package/exportPages/utils.js
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
6
|
-
value: true
|
7
|
-
});
|
8
|
-
exports.EXPORT_PAGES_FOLDER_KEY = void 0;
|
9
|
-
exports.exportPage = exportPage;
|
10
|
-
exports.extractFilesFromPageData = extractFilesFromPageData;
|
11
|
-
|
12
|
-
var _get = _interopRequireDefault(require("lodash/get"));
|
13
|
-
|
14
|
-
var _s3Stream = require("./s3Stream");
|
15
|
-
|
16
|
-
var _zipper = _interopRequireDefault(require("./zipper"));
|
17
|
-
|
18
|
-
const EXPORT_PAGES_FOLDER_KEY = "WEBINY_PB_EXPORT_PAGES";
|
19
|
-
exports.EXPORT_PAGES_FOLDER_KEY = EXPORT_PAGES_FOLDER_KEY;
|
20
|
-
|
21
|
-
async function getFilteredFiles(files) {
|
22
|
-
const uniqueFileKeys = new Map();
|
23
|
-
const promises = files.map(file => _s3Stream.s3Stream.isFileAccessible(file.key));
|
24
|
-
const isFileAvailableResults = await Promise.all(promises);
|
25
|
-
const filesAvailableForDownload = []; // Filter files
|
26
|
-
|
27
|
-
for (let i = 0; i < files.length; i++) {
|
28
|
-
const file = files[i]; // Check file accessibility
|
29
|
-
|
30
|
-
if (isFileAvailableResults[i] && !uniqueFileKeys.has(file.key)) {
|
31
|
-
filesAvailableForDownload.push(file);
|
32
|
-
uniqueFileKeys.set(file.key, true);
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
return filesAvailableForDownload;
|
37
|
-
}
|
38
|
-
|
39
|
-
async function exportPage(page, exportPagesDataKey, fileManager) {
|
40
|
-
// Extract all files
|
41
|
-
const files = extractFilesFromPageData(page.content || {}); // Filter files
|
42
|
-
|
43
|
-
const filesAvailableForDownload = await getFilteredFiles(files); // Extract images from page settings
|
44
|
-
|
45
|
-
const pageSettingsImages = [(0, _get.default)(page, "settings.general.image"), (0, _get.default)(page, "settings.social.image")].filter(image => image && image.src);
|
46
|
-
const pageSettingsImagesData = []; // Get file data for all images inside "page.settings"
|
47
|
-
|
48
|
-
for (let i = 0; i < pageSettingsImages.length; i++) {
|
49
|
-
const {
|
50
|
-
id
|
51
|
-
} = pageSettingsImages[i];
|
52
|
-
const file = await fileManager.files.getFile(id);
|
53
|
-
pageSettingsImagesData.push(file);
|
54
|
-
} // Extract the page data in a json file and upload it to S3
|
55
|
-
|
56
|
-
|
57
|
-
const pageData = {
|
58
|
-
page: {
|
59
|
-
content: page.content,
|
60
|
-
title: page.title,
|
61
|
-
path: page.path,
|
62
|
-
version: page.version,
|
63
|
-
status: page.status,
|
64
|
-
settings: page.settings
|
65
|
-
},
|
66
|
-
files: [...filesAvailableForDownload, ...pageSettingsImagesData]
|
67
|
-
};
|
68
|
-
const pageDataBuffer = Buffer.from(JSON.stringify(pageData));
|
69
|
-
const zipper = new _zipper.default({
|
70
|
-
exportInfo: {
|
71
|
-
files: [...filesAvailableForDownload, ...pageSettingsImagesData],
|
72
|
-
pageTitle: page.title,
|
73
|
-
pageDataBuffer
|
74
|
-
},
|
75
|
-
archiveFileKey: exportPagesDataKey
|
76
|
-
});
|
77
|
-
return zipper.process();
|
78
|
-
}
|
79
|
-
|
80
|
-
function extractFilesFromPageData(data, files = []) {
|
81
|
-
// Base case: termination
|
82
|
-
if (!data || typeof data !== "object") {
|
83
|
-
return files;
|
84
|
-
} // Recursively call function for each element
|
85
|
-
|
86
|
-
|
87
|
-
if (Array.isArray(data)) {
|
88
|
-
for (let i = 0; i < data.length; i++) {
|
89
|
-
const element = data[i];
|
90
|
-
extractFilesFromPageData(element, files);
|
91
|
-
}
|
92
|
-
|
93
|
-
return files;
|
94
|
-
} // Main
|
95
|
-
|
96
|
-
|
97
|
-
const tuple = Object.entries(data);
|
98
|
-
|
99
|
-
for (let i = 0; i < tuple.length; i++) {
|
100
|
-
const [key, value] = tuple[i]; // TODO: @ashutosh extract it to plugins, so that, we can handle cases for other components too.
|
101
|
-
|
102
|
-
if (key === "file" && value) {
|
103
|
-
files.push(value);
|
104
|
-
} else if (key === "images" && Array.isArray(value)) {
|
105
|
-
// Handle case for "images-list" component
|
106
|
-
files.push(...value);
|
107
|
-
} else {
|
108
|
-
extractFilesFromPageData(value, files);
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
|
-
return files;
|
113
|
-
}
|
package/exportPages/utils.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["EXPORT_PAGES_FOLDER_KEY","getFilteredFiles","files","uniqueFileKeys","Map","promises","map","file","s3Stream","isFileAccessible","key","isFileAvailableResults","Promise","all","filesAvailableForDownload","i","length","has","push","set","exportPage","page","exportPagesDataKey","fileManager","extractFilesFromPageData","content","pageSettingsImages","get","filter","image","src","pageSettingsImagesData","id","getFile","pageData","title","path","version","status","settings","pageDataBuffer","Buffer","from","JSON","stringify","zipper","Zipper","exportInfo","pageTitle","archiveFileKey","process","data","Array","isArray","element","tuple","Object","entries","value"],"sources":["utils.ts"],"sourcesContent":["import S3 from \"aws-sdk/clients/s3\";\nimport { Page, File } from \"@webiny/api-page-builder/types\";\nimport { FileManagerContext } from \"@webiny/api-file-manager/types\";\nimport get from \"lodash/get\";\nimport { s3Stream } from \"./s3Stream\";\nimport Zipper from \"./zipper\";\n\nexport const EXPORT_PAGES_FOLDER_KEY = \"WEBINY_PB_EXPORT_PAGES\";\n\nasync function getFilteredFiles(files: ImageFile[]) {\n const uniqueFileKeys = new Map<string, boolean>();\n const promises = files.map(file => s3Stream.isFileAccessible(file.key));\n const isFileAvailableResults = await Promise.all(promises);\n\n const filesAvailableForDownload = [];\n // Filter files\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n // Check file accessibility\n if (isFileAvailableResults[i] && !uniqueFileKeys.has(file.key)) {\n filesAvailableForDownload.push(file);\n uniqueFileKeys.set(file.key, true);\n }\n }\n return filesAvailableForDownload;\n}\n\nexport interface ExportedPageData {\n page: Pick<Page, \"content\" | \"title\" | \"version\" | \"status\" | \"settings\" | \"path\">;\n files: ImageFile[];\n}\n\nexport async function exportPage(\n page: Page,\n exportPagesDataKey: string,\n fileManager: FileManagerContext[\"fileManager\"]\n): Promise<S3.ManagedUpload.SendData> {\n // Extract all files\n const files = extractFilesFromPageData(page.content || {});\n // Filter files\n const filesAvailableForDownload = await getFilteredFiles(files);\n // Extract images from page settings\n const pageSettingsImages = [\n get(page, \"settings.general.image\") as unknown as File,\n get(page, \"settings.social.image\") as unknown as File\n ].filter(image => image && image.src);\n const pageSettingsImagesData = [];\n // Get file data for all images inside \"page.settings\"\n for (let i = 0; i < pageSettingsImages.length; i++) {\n const { id } = pageSettingsImages[i];\n const file = await fileManager.files.getFile(id);\n pageSettingsImagesData.push(file);\n }\n\n // Extract the page data in a json file and upload it to S3\n const pageData = {\n page: {\n content: page.content,\n title: page.title,\n path: page.path,\n version: page.version,\n status: page.status,\n settings: page.settings\n },\n files: [...filesAvailableForDownload, ...pageSettingsImagesData]\n };\n const pageDataBuffer = Buffer.from(JSON.stringify(pageData));\n\n const zipper = new Zipper({\n exportInfo: {\n files: [...filesAvailableForDownload, ...pageSettingsImagesData],\n pageTitle: page.title,\n pageDataBuffer\n },\n archiveFileKey: exportPagesDataKey\n });\n\n return zipper.process();\n}\n\nexport interface ImageFile extends Omit<File, \"src\"> {\n key: string;\n}\n\nexport function extractFilesFromPageData(\n data: Record<string, any>,\n files: any[] = []\n): ImageFile[] {\n // Base case: termination\n if (!data || typeof data !== \"object\") {\n return files;\n }\n // Recursively call function for each element\n if (Array.isArray(data)) {\n for (let i = 0; i < data.length; i++) {\n const element = data[i];\n extractFilesFromPageData(element, files);\n }\n return files;\n }\n\n // Main\n const tuple = Object.entries(data);\n for (let i = 0; i < tuple.length; i++) {\n const [key, value] = tuple[i];\n // TODO: @ashutosh extract it to plugins, so that, we can handle cases for other components too.\n if (key === \"file\" && value) {\n files.push(value);\n } else if (key === \"images\" && Array.isArray(value)) {\n // Handle case for \"images-list\" component\n files.push(...value);\n } else {\n extractFilesFromPageData(value, files);\n }\n }\n return files;\n}\n"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAEO,MAAMA,uBAAuB,GAAG,wBAAhC;;;AAEP,eAAeC,gBAAf,CAAgCC,KAAhC,EAAoD;EAChD,MAAMC,cAAc,GAAG,IAAIC,GAAJ,EAAvB;EACA,MAAMC,QAAQ,GAAGH,KAAK,CAACI,GAAN,CAAUC,IAAI,IAAIC,kBAAA,CAASC,gBAAT,CAA0BF,IAAI,CAACG,GAA/B,CAAlB,CAAjB;EACA,MAAMC,sBAAsB,GAAG,MAAMC,OAAO,CAACC,GAAR,CAAYR,QAAZ,CAArC;EAEA,MAAMS,yBAAyB,GAAG,EAAlC,CALgD,CAMhD;;EACA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGb,KAAK,CAACc,MAA1B,EAAkCD,CAAC,EAAnC,EAAuC;IACnC,MAAMR,IAAI,GAAGL,KAAK,CAACa,CAAD,CAAlB,CADmC,CAEnC;;IACA,IAAIJ,sBAAsB,CAACI,CAAD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,EAAnC,EAAuC;IACnC,MAAM,CAACL,GAAD,EAAMgD,KAAN,IAAeH,KAAK,CAACxC,CAAD,CAA1B,CADmC,CAEnC;;IACA,IAAIL,GAAG,KAAK,MAAR,IAAkBgD,KAAtB,EAA6B;MACzBxD,KAAK,CAACgB,IAAN,CAAWwC,KAAX;IACH,CAFD,MAEO,IAAIhD,GAAG,KAAK,QAAR,IAAoB0C,KAAK,CAACC,OAAN,CAAcK,KAAd,CAAxB,EAA8C;MACjD;MACAxD,KAAK,CAACgB,IAAN,CAAW,GAAGwC,KAAd;IACH,CAHM,MAGA;MACHlC,wBAAwB,CAACkC,KAAD,EAAQxD,KAAR,CAAxB;IACH;EACJ;;EACD,OAAOA,KAAP;AACH"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["Zipper","constructor","config","archiveFileName","uniqueId","archiveFileKey","kebabCase","exportInfo","pageTitle","s3DownloadStreams","prefix","files","map","key","stream","s3Stream","readStream","filename","filesDirName","path","basename","Readable","from","pageDataBuffer","process","streamPassThrough","streamPassThroughUploadPromise","writeStream","s3FilesStreams","archive","vending","create","archiveFormat","on","error","Error","name","code","message","stack","forEach","streamDetails","append","pipe","finalize","PAGE_EXPORT_BASENAME","ZipOfZip","keys","getFileStreams","fileStreamDetails"],"sources":["zipper.ts"],"sourcesContent":["// TODO: Move \"archive\" in layer\nimport vending, { ArchiverError } from \"archiver\";\nimport S3 from \"aws-sdk/clients/s3\";\nimport { Readable } from \"stream\";\nimport * as path from \"path\";\nimport kebabCase from \"lodash/kebabCase\";\nimport uniqueId from \"uniqid\";\nimport { s3Stream } from \"./s3Stream\";\nimport { ImageFile } from \"./utils\";\n\ninterface FileStreamDetails {\n stream: Readable;\n filename: string;\n}\n\ninterface ExportInfo {\n files: ImageFile[];\n pageTitle: string;\n pageDataBuffer: Buffer;\n}\n\nexport interface ZipperConfig {\n exportInfo: ExportInfo;\n archiveFileKey: string;\n}\n\nexport default class Zipper {\n private readonly archiveFormat = \"zip\";\n private readonly filesDirName = \"assets\";\n private readonly archiveFileName: string;\n config: ZipperConfig;\n\n constructor(config: ZipperConfig) {\n this.config = config;\n this.archiveFileName = uniqueId(\n `${this.config.archiveFileKey}/`,\n `-${kebabCase(this.config.exportInfo.pageTitle)}.zip`\n );\n }\n\n s3DownloadStreams(): FileStreamDetails[] {\n const exportInfo = this.config.exportInfo;\n const prefix = uniqueId(\"\", `-${kebabCase(exportInfo.pageTitle)}`);\n const files = exportInfo.files.map(({ key }) => {\n return {\n stream: s3Stream.readStream(key),\n filename: `${prefix}\\\\${this.filesDirName}\\\\${path.basename(key)}`\n };\n });\n\n return [\n ...files,\n {\n stream: Readable.from(exportInfo.pageDataBuffer),\n filename: `${prefix}\\\\${exportInfo.pageTitle}.json`\n }\n ];\n }\n\n process(): Promise<S3.ManagedUpload.SendData> {\n const { streamPassThrough, streamPassThroughUploadPromise } = s3Stream.writeStream(\n this.archiveFileName\n );\n\n // 1. Read all files from S3 using stream.\n const s3FilesStreams = this.s3DownloadStreams();\n\n // 2. Prepare zip from the file stream.\n const archive = vending.create(this.archiveFormat);\n // Handle archive events.\n archive.on(\"error\", (error: ArchiverError) => {\n throw new Error(\n `${error.name} ${error.code} ${error.message} ${error.path} ${error.stack}`\n );\n });\n\n // Append all file streams to archive.\n s3FilesStreams.forEach((streamDetails: FileStreamDetails) =>\n archive.append(streamDetails.stream, { name: streamDetails.filename })\n );\n\n // Pipe archive output to streamPassThrough (Transform Stream) which will be uploaded to S3.\n archive.pipe(streamPassThrough);\n // Finalize the archive (ie we are done appending files but streams have to finish yet)\n // 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand\n archive.finalize();\n\n // 3. Return upload stream promise.\n return streamPassThroughUploadPromise;\n }\n}\n\nconst PAGE_EXPORT_BASENAME = `WEBINY_PAGE_EXPORT.zip`;\n\nexport class ZipOfZip {\n private readonly archiveFormat = \"zip\";\n private readonly archiveFileName: string;\n keys: string[];\n\n constructor(keys: string[]) {\n this.keys = keys;\n this.archiveFileName = uniqueId(\"\", `-${PAGE_EXPORT_BASENAME}`);\n }\n\n getFileStreams(): FileStreamDetails[] {\n return this.keys.map(key => {\n return {\n stream: s3Stream.readStream(key),\n filename: `${path.basename(key)}`\n };\n });\n }\n\n process(): Promise<S3.ManagedUpload.SendData> {\n const { streamPassThrough, streamPassThroughUploadPromise } = s3Stream.writeStream(\n this.archiveFileName\n );\n\n // 1. Read all files from S3 using stream.\n const fileStreamDetails = this.getFileStreams();\n\n // 2. Prepare zip from the file stream.\n const archive = vending.create(this.archiveFormat);\n // Handle archive events.\n archive.on(\"error\", (error: ArchiverError) => {\n throw new Error(\n `${error.name} ${error.code} ${error.message} ${error.path} ${error.stack}`\n );\n });\n\n // Append all file streams to archive.\n fileStreamDetails.forEach((streamDetails: FileStreamDetails) =>\n archive.append(streamDetails.stream, { name: streamDetails.filename })\n );\n\n // Pipe archive output to streamPassThrough (Transform Stream) which will be uploaded to S3.\n archive.pipe(streamPassThrough);\n // Finalize the archive (ie we are done appending files but streams have to finish yet)\n // 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand\n archive.finalize();\n\n // 3. Return upload stream promise.\n return streamPassThroughUploadPromise;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAPA;AA0Be,MAAMA,MAAN,CAAa;EAMxBC,WAAW,CAACC,MAAD,EAAuB;IAAA,qDALD,KAKC;IAAA,oDAJF,QAIE;IAAA;IAAA;IAC9B,KAAKA,MAAL,GAAcA,MAAd;IACA,KAAKC,eAAL,GAAuB,IAAAC,eAAA,EAClB,GAAE,KAAKF,MAAL,CAAYG,cAAe,GADX,EAElB,IAAG,IAAAC,kBAAA,EAAU,KAAKJ,MAAL,CAAYK,UAAZ,CAAuBC,SAAjC,CAA4C,MAF7B,CAAvB;EAIH;;EAEDC,iBAAiB,GAAwB;IACrC,MAAMF,UAAU,GAAG,KAAKL,MAAL,CAAYK,UAA/B;IACA,MAAMG,MAAM,GA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,KAAK,CAACK,KAAM,EADxE,CAAN;IAGH,CAJD,EAX0C,CAiB1C;;IACAU,iBAAiB,CAACT,OAAlB,CAA2BC,aAAD,IACtBZ,OAAO,CAACa,MAAR,CAAeD,aAAa,CAAC3B,MAA7B,EAAqC;MAAEsB,IAAI,EAAEK,aAAa,CAACxB;IAAtB,CAArC,CADJ,EAlB0C,CAsB1C;;IACAY,OAAO,CAACc,IAAR,CAAalB,iBAAb,EAvB0C,CAwB1C;IACA;;IACAI,OAAO,CAACe,QAAR,GA1B0C,CA4B1C;;IACA,OAAOlB,8BAAP;EACH;;AAjDiB"}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import { ContextPlugin } from "@webiny/api";
|
2
|
-
import { PageImportExportPluginsParams } from "../../types";
|
3
|
-
import { PbPageImportExportContext } from "../types";
|
4
|
-
declare const _default: ({ storageOperations }: PageImportExportPluginsParams) => ContextPlugin<PbPageImportExportContext>;
|
5
|
-
export default _default;
|