@webiny/api-page-builder-import-export 0.0.0-unstable.d16f688daf → 0.0.0-unstable.d7f521b032

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.
Files changed (84) hide show
  1. package/client.js +2 -6
  2. package/client.js.map +1 -1
  3. package/export/combine/blocksHandler.js +11 -18
  4. package/export/combine/blocksHandler.js.map +1 -1
  5. package/export/combine/index.js +14 -9
  6. package/export/combine/index.js.map +1 -1
  7. package/export/combine/pagesHandler.js +11 -18
  8. package/export/combine/pagesHandler.js.map +1 -1
  9. package/export/combine/templatesHandler.d.ts +6 -0
  10. package/export/combine/templatesHandler.js +99 -0
  11. package/export/combine/templatesHandler.js.map +1 -0
  12. package/export/process/blocksHandler.js +18 -32
  13. package/export/process/blocksHandler.js.map +1 -1
  14. package/export/process/index.js +14 -9
  15. package/export/process/index.js.map +1 -1
  16. package/export/process/pagesHandler.js +19 -34
  17. package/export/process/pagesHandler.js.map +1 -1
  18. package/export/process/templatesHandler.d.ts +6 -0
  19. package/export/process/templatesHandler.js +166 -0
  20. package/export/process/templatesHandler.js.map +1 -0
  21. package/export/s3Stream.js +1 -20
  22. package/export/s3Stream.js.map +1 -1
  23. package/export/utils.d.ts +7 -1
  24. package/export/utils.js +57 -32
  25. package/export/utils.js.map +1 -1
  26. package/export/zipper.js +29 -41
  27. package/export/zipper.js.map +1 -1
  28. package/graphql/crud/blocks.crud.js +19 -37
  29. package/graphql/crud/blocks.crud.js.map +1 -1
  30. package/graphql/crud/importExportTasks.crud.js +9 -57
  31. package/graphql/crud/importExportTasks.crud.js.map +1 -1
  32. package/graphql/crud/pages.crud.js +25 -41
  33. package/graphql/crud/pages.crud.js.map +1 -1
  34. package/graphql/crud/templates.crud.d.ts +4 -0
  35. package/graphql/crud/templates.crud.js +124 -0
  36. package/graphql/crud/templates.crud.js.map +1 -0
  37. package/graphql/crud.js +2 -7
  38. package/graphql/crud.js.map +1 -1
  39. package/graphql/graphql/blocks.gql.js +1 -6
  40. package/graphql/graphql/blocks.gql.js.map +1 -1
  41. package/graphql/graphql/importExportTasks.gql.js +1 -6
  42. package/graphql/graphql/importExportTasks.gql.js.map +1 -1
  43. package/graphql/graphql/pages.gql.js +2 -7
  44. package/graphql/graphql/pages.gql.js.map +1 -1
  45. package/graphql/graphql/templates.gql.d.ts +4 -0
  46. package/graphql/graphql/templates.gql.js +52 -0
  47. package/graphql/graphql/templates.gql.js.map +1 -0
  48. package/graphql/graphql/utils/resolve.d.ts +1 -1
  49. package/graphql/graphql/utils/resolve.js +0 -3
  50. package/graphql/graphql/utils/resolve.js.map +1 -1
  51. package/graphql/graphql.js +2 -6
  52. package/graphql/graphql.js.map +1 -1
  53. package/graphql/index.js +0 -5
  54. package/graphql/index.js.map +1 -1
  55. package/graphql/types.d.ts +17 -0
  56. package/graphql/types.js.map +1 -1
  57. package/import/create/blocksHandler.js +9 -19
  58. package/import/create/blocksHandler.js.map +1 -1
  59. package/import/create/index.d.ts +2 -1
  60. package/import/create/index.js +14 -9
  61. package/import/create/index.js.map +1 -1
  62. package/import/create/pagesHandler.js +12 -20
  63. package/import/create/pagesHandler.js.map +1 -1
  64. package/import/create/templatesHandler.d.ts +3 -0
  65. package/import/create/templatesHandler.js +98 -0
  66. package/import/create/templatesHandler.js.map +1 -0
  67. package/import/process/blocksHandler.js +20 -26
  68. package/import/process/blocksHandler.js.map +1 -1
  69. package/import/process/index.d.ts +1 -0
  70. package/import/process/index.js +14 -9
  71. package/import/process/index.js.map +1 -1
  72. package/import/process/pagesHandler.js +26 -29
  73. package/import/process/pagesHandler.js.map +1 -1
  74. package/import/process/templatesHandler.d.ts +3 -0
  75. package/import/process/templatesHandler.js +169 -0
  76. package/import/process/templatesHandler.js.map +1 -0
  77. package/import/utils.d.ts +8 -1
  78. package/import/utils.js +103 -137
  79. package/import/utils.js.map +1 -1
  80. package/mockSecurity.js +0 -2
  81. package/mockSecurity.js.map +1 -1
  82. package/package.json +24 -24
  83. package/types.js +0 -5
  84. package/types.js.map +1 -1
@@ -1,17 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _blocks = _interopRequireDefault(require("./graphql/blocks.gql"));
11
-
12
9
  var _pages = _interopRequireDefault(require("./graphql/pages.gql"));
13
-
10
+ var _templates = _interopRequireDefault(require("./graphql/templates.gql"));
14
11
  var _importExportTasks = _interopRequireDefault(require("./graphql/importExportTasks.gql"));
15
-
16
- var _default = [_blocks.default, _pages.default, _importExportTasks.default];
12
+ var _default = [_blocks.default, _pages.default, _templates.default, _importExportTasks.default];
17
13
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["blocks","pages","importExportTask"],"sources":["graphql.ts"],"sourcesContent":["import blocks from \"./graphql/blocks.gql\";\nimport pages from \"./graphql/pages.gql\";\nimport importExportTask from \"./graphql/importExportTasks.gql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/types\";\n\nexport default [blocks, pages, importExportTask] as GraphQLSchemaPlugin[];\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;eAGe,CAACA,eAAD,EAASC,cAAT,EAAgBC,0BAAhB,C"}
1
+ {"version":3,"names":["blocks","pages","templates","importExportTask"],"sources":["graphql.ts"],"sourcesContent":["import blocks from \"./graphql/blocks.gql\";\nimport pages from \"./graphql/pages.gql\";\nimport templates from \"./graphql/templates.gql\";\nimport importExportTask from \"./graphql/importExportTasks.gql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/types\";\n\nexport default [blocks, pages, templates, importExportTask] as GraphQLSchemaPlugin[];\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AAA+D,eAGhD,CAACA,eAAM,EAAEC,cAAK,EAAEC,kBAAS,EAAEC,0BAAgB,CAAC;AAAA"}
package/graphql/index.js CHANGED
@@ -1,16 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _crud = _interopRequireDefault(require("./crud"));
11
-
12
9
  var _graphql = _interopRequireDefault(require("./graphql"));
13
-
14
10
  var _default = params => [(0, _crud.default)(params), _graphql.default];
15
-
16
11
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["params","crud","graphql"],"sources":["index.ts"],"sourcesContent":["import crud from \"./crud\";\nimport graphql from \"./graphql\";\nimport { ImportExportPluginsParams } from \"~/graphql/types\";\n\nexport default (params: ImportExportPluginsParams) => [crud(params), graphql];\n"],"mappings":";;;;;;;;;AAAA;;AACA;;eAGgBA,MAAD,IAAuC,CAAC,IAAAC,aAAA,EAAKD,MAAL,CAAD,EAAeE,gBAAf,C"}
1
+ {"version":3,"names":["params","crud","graphql"],"sources":["index.ts"],"sourcesContent":["import crud from \"./crud\";\nimport graphql from \"./graphql\";\nimport { ImportExportPluginsParams } from \"~/graphql/types\";\n\nexport default (params: ImportExportPluginsParams) => [crud(params), graphql];\n"],"mappings":";;;;;;;AAAA;AACA;AAAgC,eAGhBA,MAAiC,IAAK,CAAC,IAAAC,aAAI,EAACD,MAAM,CAAC,EAAEE,gBAAO,CAAC;AAAA"}
@@ -20,6 +20,7 @@ export interface ExportPagesParams {
20
20
  export interface ImportPagesParams {
21
21
  category: string;
22
22
  zipFileUrl: string;
23
+ meta?: Record<string, any>;
23
24
  }
24
25
  export declare type PagesImportExportCrud = {
25
26
  exportPages(params: ExportPagesParams): Promise<{
@@ -48,6 +49,21 @@ export declare type BlocksImportExportCrud = {
48
49
  task: ImportExportTask;
49
50
  }>;
50
51
  };
52
+ export interface ExportTemplatesParams {
53
+ ids?: string[];
54
+ sort?: string[];
55
+ }
56
+ export interface ImportTemplatesParams {
57
+ zipFileUrl: string;
58
+ }
59
+ export declare type TemplatesImportExportCrud = {
60
+ exportTemplates(params: ExportTemplatesParams): Promise<{
61
+ task: ImportExportTask;
62
+ }>;
63
+ importTemplates(params: ImportTemplatesParams): Promise<{
64
+ task: ImportExportTask;
65
+ }>;
66
+ };
51
67
  declare type ImportExportTaskCreateData = Omit<ImportExportTask, "id" | "createdOn" | "createdBy">;
52
68
  export declare type ImportExportTaskCrud = {
53
69
  /**
@@ -73,6 +89,7 @@ export interface PbImportExportContext extends PbContext {
73
89
  pageBuilder: PbContext["pageBuilder"] & {
74
90
  pages: PagesImportExportCrud;
75
91
  blocks: BlocksImportExportCrud;
92
+ templates: TemplatesImportExportCrud;
76
93
  importExportTask: ImportExportTaskCrud;
77
94
  };
78
95
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { PbContext } from \"@webiny/api-page-builder/types\";\nimport {\n ExportRevisionType,\n ImportExportTask,\n ImportExportTaskStatus,\n ImportExportTaskStorageOperations,\n ImportExportTaskStorageOperationsListParams\n} from \"~/types\";\n\nexport interface ExportPagesParams {\n ids?: string[];\n revisionType: ExportRevisionType;\n where?: {\n category?: string;\n status?: string;\n tags?: { query: string[]; rule?: \"any\" | \"all\" };\n [key: string]: any;\n };\n search?: { query?: string };\n sort?: string[];\n}\n\nexport interface ImportPagesParams {\n category: string;\n zipFileUrl: string;\n}\n\nexport type PagesImportExportCrud = {\n exportPages(params: ExportPagesParams): Promise<{ task: ImportExportTask }>;\n importPages(params: ImportPagesParams): Promise<{ task: ImportExportTask }>;\n};\n\nexport interface ExportBlocksParams {\n ids?: string[];\n sort?: string[];\n where?: {\n blockCategory?: string;\n };\n}\n\nexport interface ImportBlocksParams {\n category: string;\n zipFileUrl: string;\n}\n\nexport type BlocksImportExportCrud = {\n exportBlocks(params: ExportBlocksParams): Promise<{ task: ImportExportTask }>;\n importBlocks(params: ImportBlocksParams): Promise<{ task: ImportExportTask }>;\n};\n\ntype ImportExportTaskCreateData = Omit<ImportExportTask, \"id\" | \"createdOn\" | \"createdBy\">;\n\nexport type ImportExportTaskCrud = {\n /**\n * To be used internally in our code.\n * @internal\n */\n storageOperations: ImportExportTaskStorageOperations;\n\n getTask(id: string): Promise<ImportExportTask | null>;\n listTasks(params?: ImportExportTaskStorageOperationsListParams): Promise<ImportExportTask[]>;\n createTask(data: Partial<ImportExportTaskCreateData>): Promise<ImportExportTask>;\n updateTask(id: string, data: Partial<ImportExportTaskCreateData>): Promise<ImportExportTask>;\n updateStats(\n id: string,\n data: {\n prevStatus: ImportExportTaskStatus;\n nextStatus: ImportExportTaskStatus;\n }\n ): Promise<ImportExportTask>;\n deleteTask(id: string): Promise<ImportExportTask>;\n getSubTask(id: string, subtaskId: string): Promise<ImportExportTask | null>;\n listSubTasks(\n id: string,\n status: ImportExportTaskStatus,\n limit: number\n ): Promise<ImportExportTask[]>;\n createSubTask(\n id: string,\n subTaskId: string,\n data: Partial<ImportExportTaskCreateData>\n ): Promise<ImportExportTask>;\n updateSubTask(\n id: string,\n subTaskId: string,\n data: Partial<ImportExportTaskCreateData>\n ): Promise<ImportExportTask>;\n};\n\nexport interface PbImportExportContext extends PbContext {\n pageBuilder: PbContext[\"pageBuilder\"] & {\n pages: PagesImportExportCrud;\n blocks: BlocksImportExportCrud;\n importExportTask: ImportExportTaskCrud;\n };\n}\n\nexport interface ImportExportPluginsParams {\n storageOperations: ImportExportTaskStorageOperations;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { PbContext } from \"@webiny/api-page-builder/types\";\nimport {\n ExportRevisionType,\n ImportExportTask,\n ImportExportTaskStatus,\n ImportExportTaskStorageOperations,\n ImportExportTaskStorageOperationsListParams\n} from \"~/types\";\n\nexport interface ExportPagesParams {\n ids?: string[];\n revisionType: ExportRevisionType;\n where?: {\n category?: string;\n status?: string;\n tags?: { query: string[]; rule?: \"any\" | \"all\" };\n [key: string]: any;\n };\n search?: { query?: string };\n sort?: string[];\n}\n\nexport interface ImportPagesParams {\n category: string;\n zipFileUrl: string;\n meta?: Record<string, any>;\n}\n\nexport type PagesImportExportCrud = {\n exportPages(params: ExportPagesParams): Promise<{ task: ImportExportTask }>;\n importPages(params: ImportPagesParams): Promise<{ task: ImportExportTask }>;\n};\n\nexport interface ExportBlocksParams {\n ids?: string[];\n sort?: string[];\n where?: {\n blockCategory?: string;\n };\n}\n\nexport interface ImportBlocksParams {\n category: string;\n zipFileUrl: string;\n}\n\nexport type BlocksImportExportCrud = {\n exportBlocks(params: ExportBlocksParams): Promise<{ task: ImportExportTask }>;\n importBlocks(params: ImportBlocksParams): Promise<{ task: ImportExportTask }>;\n};\n\nexport interface ExportTemplatesParams {\n ids?: string[];\n sort?: string[];\n}\n\nexport interface ImportTemplatesParams {\n zipFileUrl: string;\n}\n\nexport type TemplatesImportExportCrud = {\n exportTemplates(params: ExportTemplatesParams): Promise<{ task: ImportExportTask }>;\n importTemplates(params: ImportTemplatesParams): Promise<{ task: ImportExportTask }>;\n};\n\ntype ImportExportTaskCreateData = Omit<ImportExportTask, \"id\" | \"createdOn\" | \"createdBy\">;\n\nexport type ImportExportTaskCrud = {\n /**\n * To be used internally in our code.\n * @internal\n */\n storageOperations: ImportExportTaskStorageOperations;\n\n getTask(id: string): Promise<ImportExportTask | null>;\n listTasks(params?: ImportExportTaskStorageOperationsListParams): Promise<ImportExportTask[]>;\n createTask(data: Partial<ImportExportTaskCreateData>): Promise<ImportExportTask>;\n updateTask(id: string, data: Partial<ImportExportTaskCreateData>): Promise<ImportExportTask>;\n updateStats(\n id: string,\n data: {\n prevStatus: ImportExportTaskStatus;\n nextStatus: ImportExportTaskStatus;\n }\n ): Promise<ImportExportTask>;\n deleteTask(id: string): Promise<ImportExportTask>;\n getSubTask(id: string, subtaskId: string): Promise<ImportExportTask | null>;\n listSubTasks(\n id: string,\n status: ImportExportTaskStatus,\n limit: number\n ): Promise<ImportExportTask[]>;\n createSubTask(\n id: string,\n subTaskId: string,\n data: Partial<ImportExportTaskCreateData>\n ): Promise<ImportExportTask>;\n updateSubTask(\n id: string,\n subTaskId: string,\n data: Partial<ImportExportTaskCreateData>\n ): Promise<ImportExportTask>;\n};\n\nexport interface PbImportExportContext extends PbContext {\n pageBuilder: PbContext[\"pageBuilder\"] & {\n pages: PagesImportExportCrud;\n blocks: BlocksImportExportCrud;\n templates: TemplatesImportExportCrud;\n importExportTask: ImportExportTaskCrud;\n };\n}\n\nexport interface ImportExportPluginsParams {\n storageOperations: ImportExportTaskStorageOperations;\n}\n"],"mappings":""}
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.blocksHandler = void 0;
7
-
8
7
  var _types = require("../../types");
9
-
10
8
  var _utils = require("../utils");
11
-
12
9
  var _client = require("../../client");
13
-
14
10
  var _mockSecurity = require("../../mockSecurity");
15
-
16
11
  var _utils2 = require("@webiny/utils");
17
-
18
12
  const blocksHandler = async (configuration, payload, context) => {
19
13
  const log = console.log;
20
14
  const {
@@ -27,10 +21,8 @@ const blocksHandler = async (configuration, payload, context) => {
27
21
  zipFileUrl,
28
22
  identity
29
23
  } = payload;
30
-
31
24
  try {
32
25
  log("RUNNING Import Blocks Create");
33
-
34
26
  if (!zipFileUrl) {
35
27
  return {
36
28
  data: null,
@@ -39,14 +31,14 @@ const blocksHandler = async (configuration, payload, context) => {
39
31
  }
40
32
  };
41
33
  }
34
+ (0, _mockSecurity.mockSecurity)(identity, context);
35
+ // Step 1: Read the zip file
36
+ const blockImportDataList = await (0, _utils.readExtractAndUploadZipFileContents)(zipFileUrl);
42
37
 
43
- (0, _mockSecurity.mockSecurity)(identity, context); // Step 1: Read the zip file
44
-
45
- const blockImportDataList = await (0, _utils.readExtractAndUploadZipFileContents)(zipFileUrl); // For each block create a subtask and invoke the process handler
46
-
38
+ // For each block create a subtask and invoke the process handler
47
39
  for (let i = 0; i < blockImportDataList.length; i++) {
48
- const blocksDirMap = blockImportDataList[i]; // Create sub task
49
-
40
+ const blocksDirMap = blockImportDataList[i];
41
+ // Create sub task
50
42
  const subtask = await pageBuilder.importExportTask.createSubTask(task.id, (0, _utils2.zeroPad)(i + 1, 5), {
51
43
  status: _types.ImportExportTaskStatus.PENDING,
52
44
  data: {
@@ -59,9 +51,8 @@ const blocksHandler = async (configuration, payload, context) => {
59
51
  }
60
52
  });
61
53
  log(`Added SUB_TASK "${subtask.id}" to queue.`);
62
- } // Update main task status
63
-
64
-
54
+ }
55
+ // Update main task status
65
56
  await pageBuilder.importExportTask.updateTask(task.id, {
66
57
  status: _types.ImportExportTaskStatus.PROCESSING,
67
58
  stats: (0, _utils.initialStats)(blockImportDataList.length)
@@ -80,6 +71,7 @@ const blocksHandler = async (configuration, payload, context) => {
80
71
  });
81
72
  } catch (e) {
82
73
  log("[IMPORT_BLOCKS_CREATE] Error => ", e);
74
+
83
75
  /**
84
76
  * In case of error, we'll update the task status to "failed",
85
77
  * so that, client can show notify the user appropriately.
@@ -100,11 +92,9 @@ const blocksHandler = async (configuration, payload, context) => {
100
92
  }
101
93
  };
102
94
  }
103
-
104
95
  return {
105
96
  data: "",
106
97
  error: null
107
98
  };
108
99
  };
109
-
110
100
  exports.blocksHandler = blocksHandler;
@@ -1 +1 @@
1
- {"version":3,"names":["blocksHandler","configuration","payload","context","log","console","pageBuilder","task","type","category","zipFileUrl","identity","data","error","message","mockSecurity","blockImportDataList","readExtractAndUploadZipFileContents","i","length","blocksDirMap","subtask","importExportTask","createSubTask","id","zeroPad","status","ImportExportTaskStatus","PENDING","blockKey","key","input","fileUploadsData","updateTask","PROCESSING","stats","initialStats","invokeHandlerClient","name","handlers","process","taskId","subTaskIndex","security","getIdentity","description","e","FAILED","code"],"sources":["blocksHandler.ts"],"sourcesContent":["import { ImportExportTaskStatus, PbImportExportContext } from \"~/types\";\nimport { initialStats, readExtractAndUploadZipFileContents } from \"~/import/utils\";\nimport { invokeHandlerClient } from \"~/client\";\nimport { Payload as ProcessPayload } from \"../process\";\nimport { mockSecurity } from \"~/mockSecurity\";\nimport { zeroPad } from \"@webiny/utils\";\nimport { Configuration, Payload, Response } from \"~/import/create\";\n\nexport const blocksHandler = async (\n configuration: Configuration,\n payload: Payload,\n context: PbImportExportContext\n): Promise<Response> => {\n const log = console.log;\n\n const { pageBuilder } = context;\n const { task, type, category, zipFileUrl, identity } = payload;\n try {\n log(\"RUNNING Import Blocks Create\");\n if (!zipFileUrl) {\n return {\n data: null,\n error: {\n message: `Missing \"zipFileUrl\"!`\n }\n };\n }\n mockSecurity(identity, context);\n // Step 1: Read the zip file\n const blockImportDataList = await readExtractAndUploadZipFileContents(zipFileUrl);\n\n // For each block create a subtask and invoke the process handler\n for (let i = 0; i < blockImportDataList.length; i++) {\n const blocksDirMap = blockImportDataList[i];\n // Create sub task\n const subtask = await pageBuilder.importExportTask.createSubTask(\n task.id,\n zeroPad(i + 1, 5),\n {\n status: ImportExportTaskStatus.PENDING,\n data: {\n blockKey: blocksDirMap.key,\n category,\n zipFileUrl,\n input: {\n fileUploadsData: blocksDirMap\n }\n }\n }\n );\n log(`Added SUB_TASK \"${subtask.id}\" to queue.`);\n }\n // Update main task status\n await pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.PROCESSING,\n stats: initialStats(blockImportDataList.length)\n });\n\n await invokeHandlerClient<ProcessPayload>({\n context,\n name: configuration.handlers.process,\n payload: {\n taskId: task.id,\n // Execute \"Process\" for the first sub task.\n subTaskIndex: 1,\n type,\n identity: context.security.getIdentity()\n },\n description: \"Import blocks - process - first\"\n });\n } catch (e) {\n log(\"[IMPORT_BLOCKS_CREATE] 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\n await pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.FAILED,\n error: {\n name: e.name,\n message: e.message,\n code: e.code || \"EXPORT_FAILED\"\n }\n });\n\n return {\n data: null,\n error: {\n message: e.message\n }\n };\n }\n\n return {\n data: \"\",\n error: null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B,CAAH;IACH,CAlCD,CAmCA;;;IACA,MAAMlB,WAAW,CAACgB,gBAAZ,CAA6BW,UAA7B,CAAwC1B,IAAI,CAACiB,EAA7C,EAAiD;MACnDE,MAAM,EAAEC,6BAAA,CAAuBO,UADoB;MAEnDC,KAAK,EAAE,IAAAC,mBAAA,EAAapB,mBAAmB,CAACG,MAAjC;IAF4C,CAAjD,CAAN;IAKA,MAAM,IAAAkB,2BAAA,EAAoC;MACtClC,OADsC;MAEtCmC,IAAI,EAAErC,aAAa,CAACsC,QAAd,CAAuBC,OAFS;MAGtCtC,OAAO,EAAE;QACLuC,MAAM,EAAElC,IAAI,CAACiB,EADR;QAEL;QACAkB,YAAY,EAAE,CAHT;QAILlC,IAJK;QAKLG,QAAQ,EAAER,OAAO,CAACwC,QAAR,CAAiBC,WAAjB;MALL,CAH6B;MAUtCC,WAAW,EAAE;IAVyB,CAApC,CAAN;EAYH,CArDD,CAqDE,OAAOC,CAAP,EAAU;IACR1C,GAAG,CAAC,kCAAD,EAAqC0C,CAArC,CAAH;IAEA;AACR;AACA;AACA;;IAEQ,MAAMxC,WAAW,CAACgB,gBAAZ,CAA6BW,UAA7B,CAAwC1B,IAAI,CAACiB,EAA7C,EAAiD;MACnDE,MAAM,EAAEC,6BAAA,CAAuBoB,MADoB;MAEnDlC,KAAK,EAAE;QACHyB,IAAI,EAAEQ,CAAC,CAACR,IADL;QAEHxB,OAAO,EAAEgC,CAAC,CAAChC,OAFR;QAGHkC,IAAI,EAAEF,CAAC,CAACE,IAAF,IAAU;MAHb;IAF4C,CAAjD,CAAN;IASA,OAAO;MACHpC,IAAI,EAAE,IADH;MAEHC,KAAK,EAAE;QACHC,OAAO,EAAEgC,CAAC,CAAChC;MADR;IAFJ,CAAP;EAMH;;EAED,OAAO;IACHF,IAAI,EAAE,EADH;IAEHC,KAAK,EAAE;EAFJ,CAAP;AAIH,CA3FM"}
1
+ {"version":3,"names":["blocksHandler","configuration","payload","context","log","console","pageBuilder","task","type","category","zipFileUrl","identity","data","error","message","mockSecurity","blockImportDataList","readExtractAndUploadZipFileContents","i","length","blocksDirMap","subtask","importExportTask","createSubTask","id","zeroPad","status","ImportExportTaskStatus","PENDING","blockKey","key","input","fileUploadsData","updateTask","PROCESSING","stats","initialStats","invokeHandlerClient","name","handlers","process","taskId","subTaskIndex","security","getIdentity","description","e","FAILED","code"],"sources":["blocksHandler.ts"],"sourcesContent":["import { ImportExportTaskStatus, PbImportExportContext } from \"~/types\";\nimport { initialStats, readExtractAndUploadZipFileContents } from \"~/import/utils\";\nimport { invokeHandlerClient } from \"~/client\";\nimport { Payload as ProcessPayload } from \"../process\";\nimport { mockSecurity } from \"~/mockSecurity\";\nimport { zeroPad } from \"@webiny/utils\";\nimport { Configuration, Payload, Response } from \"~/import/create\";\n\nexport const blocksHandler = async (\n configuration: Configuration,\n payload: Payload,\n context: PbImportExportContext\n): Promise<Response> => {\n const log = console.log;\n\n const { pageBuilder } = context;\n const { task, type, category, zipFileUrl, identity } = payload;\n try {\n log(\"RUNNING Import Blocks Create\");\n if (!zipFileUrl) {\n return {\n data: null,\n error: {\n message: `Missing \"zipFileUrl\"!`\n }\n };\n }\n mockSecurity(identity, context);\n // Step 1: Read the zip file\n const blockImportDataList = await readExtractAndUploadZipFileContents(zipFileUrl);\n\n // For each block create a subtask and invoke the process handler\n for (let i = 0; i < blockImportDataList.length; i++) {\n const blocksDirMap = blockImportDataList[i];\n // Create sub task\n const subtask = await pageBuilder.importExportTask.createSubTask(\n task.id,\n zeroPad(i + 1, 5),\n {\n status: ImportExportTaskStatus.PENDING,\n data: {\n blockKey: blocksDirMap.key,\n category,\n zipFileUrl,\n input: {\n fileUploadsData: blocksDirMap\n }\n }\n }\n );\n log(`Added SUB_TASK \"${subtask.id}\" to queue.`);\n }\n // Update main task status\n await pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.PROCESSING,\n stats: initialStats(blockImportDataList.length)\n });\n\n await invokeHandlerClient<ProcessPayload>({\n context,\n name: configuration.handlers.process,\n payload: {\n taskId: task.id,\n // Execute \"Process\" for the first sub task.\n subTaskIndex: 1,\n type,\n identity: context.security.getIdentity()\n },\n description: \"Import blocks - process - first\"\n });\n } catch (e) {\n log(\"[IMPORT_BLOCKS_CREATE] 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\n await pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.FAILED,\n error: {\n name: e.name,\n message: e.message,\n code: e.code || \"EXPORT_FAILED\"\n }\n });\n\n return {\n data: null,\n error: {\n message: e.message\n }\n };\n }\n\n return {\n data: \"\",\n error: null\n };\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AACA;AAGO,MAAMA,aAAa,GAAG,OACzBC,aAA4B,EAC5BC,OAAgB,EAChBC,OAA8B,KACV;EACpB,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAAG;EAEvB,MAAM;IAAEE;EAAY,CAAC,GAAGH,OAAO;EAC/B,MAAM;IAAEI,IAAI;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGT,OAAO;EAC9D,IAAI;IACAE,GAAG,CAAC,8BAA8B,CAAC;IACnC,IAAI,CAACM,UAAU,EAAE;MACb,OAAO;QACHE,IAAI,EAAE,IAAI;QACVC,KAAK,EAAE;UACHC,OAAO,EAAG;QACd;MACJ,CAAC;IACL;IACA,IAAAC,0BAAY,EAACJ,QAAQ,EAAER,OAAO,CAAC;IAC/B;IACA,MAAMa,mBAAmB,GAAG,MAAM,IAAAC,0CAAmC,EAACP,UAAU,CAAC;;IAEjF;IACA,KAAK,IAAIQ,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,mBAAmB,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;MACjD,MAAME,YAAY,GAAGJ,mBAAmB,CAACE,CAAC,CAAC;MAC3C;MACA,MAAMG,OAAO,GAAG,MAAMf,WAAW,CAAC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kC,IAAI,EAAEF,CAAC,CAACE,IAAI,IAAI;MACpB;IACJ,CAAC,CAAC;IAEF,OAAO;MACHpC,IAAI,EAAE,IAAI;MACVC,KAAK,EAAE;QACHC,OAAO,EAAEgC,CAAC,CAAChC;MACf;IACJ,CAAC;EACL;EAEA,OAAO;IACHF,IAAI,EAAE,EAAE;IACRC,KAAK,EAAE;EACX,CAAC;AACL,CAAC;AAAC"}
@@ -6,11 +6,12 @@ export interface Configuration {
6
6
  };
7
7
  }
8
8
  export interface Payload {
9
- category: string;
9
+ category?: string;
10
10
  zipFileUrl: string;
11
11
  task: ImportExportTask;
12
12
  type: string;
13
13
  identity: SecurityIdentity;
14
+ meta?: Record<string, any>;
14
15
  }
15
16
  export interface Response {
16
17
  data: string | null;
@@ -4,13 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _handlerAws = require("@webiny/handler-aws");
9
-
10
8
  var _blocksHandler = require("./blocksHandler");
11
-
12
9
  var _pagesHandler = require("./pagesHandler");
13
-
10
+ var _templatesHandler = require("./templatesHandler");
14
11
  /**
15
12
  * Handles the import page workflow.
16
13
  */
@@ -19,12 +16,20 @@ var _default = configuration => {
19
16
  payload,
20
17
  context
21
18
  }) => {
22
- if (payload.type === "block") {
23
- return await (0, _blocksHandler.blocksHandler)(configuration, payload, context);
24
- } else {
25
- return await (0, _pagesHandler.pagesHandler)(configuration, payload, context);
19
+ switch (payload.type) {
20
+ case "block":
21
+ {
22
+ return await (0, _blocksHandler.blocksHandler)(configuration, payload, context);
23
+ }
24
+ case "template":
25
+ {
26
+ return await (0, _templatesHandler.templatesHandler)(configuration, payload, context);
27
+ }
28
+ default:
29
+ {
30
+ return await (0, _pagesHandler.pagesHandler)(configuration, payload, context);
31
+ }
26
32
  }
27
33
  });
28
34
  };
29
-
30
35
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["configuration","createRawEventHandler","payload","context","type","blocksHandler","pagesHandler"],"sources":["index.ts"],"sourcesContent":["import { ImportExportTask, PbImportExportContext } from \"~/types\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\nimport { blocksHandler } from \"~/import/create/blocksHandler\";\nimport { pagesHandler } from \"~/import/create/pagesHandler\";\n\nexport interface Configuration {\n handlers: {\n process: string;\n };\n}\n\nexport interface Payload {\n category: string;\n zipFileUrl: string;\n task: ImportExportTask;\n type: string;\n identity: SecurityIdentity;\n}\nexport interface Response {\n data: string | null;\n error: Partial<Error> | null;\n}\n\n/**\n * Handles the import page workflow.\n */\nexport default (configuration: Configuration) => {\n return createRawEventHandler<Payload, PbImportExportContext, Response>(\n async ({ payload, context }) => {\n if (payload.type === \"block\") {\n return await blocksHandler(configuration, payload, context);\n } else {\n return await pagesHandler(configuration, payload, context);\n }\n }\n );\n};\n"],"mappings":";;;;;;;AAEA;;AACA;;AACA;;AAoBA;AACA;AACA;eACgBA,aAAD,IAAkC;EAC7C,OAAO,IAAAC,iCAAA,EACH,OAAO;IAAEC,OAAF;IAAWC;EAAX,CAAP,KAAgC;IAC5B,IAAID,OAAO,CAACE,IAAR,KAAiB,OAArB,EAA8B;MAC1B,OAAO,MAAM,IAAAC,4BAAA,EAAcL,aAAd,EAA6BE,OAA7B,EAAsCC,OAAtC,CAAb;IACH,CAFD,MAEO;MACH,OAAO,MAAM,IAAAG,0BAAA,EAAaN,aAAb,EAA4BE,OAA5B,EAAqCC,OAArC,CAAb;IACH;EACJ,CAPE,CAAP;AASH,C"}
1
+ {"version":3,"names":["configuration","createRawEventHandler","payload","context","type","blocksHandler","templatesHandler","pagesHandler"],"sources":["index.ts"],"sourcesContent":["import { ImportExportTask, PbImportExportContext } from \"~/types\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createRawEventHandler } from \"@webiny/handler-aws\";\nimport { blocksHandler } from \"~/import/create/blocksHandler\";\nimport { pagesHandler } from \"~/import/create/pagesHandler\";\nimport { templatesHandler } from \"~/import/create/templatesHandler\";\n\nexport interface Configuration {\n handlers: {\n process: string;\n };\n}\n\nexport interface Payload {\n category?: string;\n zipFileUrl: string;\n task: ImportExportTask;\n type: string;\n identity: SecurityIdentity;\n meta?: Record<string, any>;\n}\nexport interface Response {\n data: string | null;\n error: Partial<Error> | null;\n}\n\n/**\n * Handles the import page workflow.\n */\nexport default (configuration: Configuration) => {\n return createRawEventHandler<Payload, PbImportExportContext, Response>(\n async ({ payload, context }) => {\n switch (payload.type) {\n case \"block\": {\n return await blocksHandler(configuration, payload, context);\n }\n case \"template\": {\n return await templatesHandler(configuration, payload, context);\n }\n default: {\n return await pagesHandler(configuration, payload, context);\n }\n }\n }\n );\n};\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AAqBA;AACA;AACA;AAFA,eAGgBA,aAA4B,IAAK;EAC7C,OAAO,IAAAC,iCAAqB,EACxB,OAAO;IAAEC,OAAO;IAAEC;EAAQ,CAAC,KAAK;IAC5B,QAAQD,OAAO,CAACE,IAAI;MAChB,KAAK,OAAO;QAAE;UACV,OAAO,MAAM,IAAAC,4BAAa,EAACL,aAAa,EAAEE,OAAO,EAAEC,OAAO,CAAC;QAC/D;MACA,KAAK,UAAU;QAAE;UACb,OAAO,MAAM,IAAAG,kCAAgB,EAACN,aAAa,EAAEE,OAAO,EAAEC,OAAO,CAAC;QAClE;MACA;QAAS;UACL,OAAO,MAAM,IAAAI,0BAAY,EAACP,aAAa,EAAEE,OAAO,EAAEC,OAAO,CAAC;QAC9D;IAAC;EAET,CAAC,CACJ;AACL,CAAC;AAAA"}
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.pagesHandler = void 0;
7
-
8
7
  var _types = require("../../types");
9
-
10
8
  var _utils = require("../utils");
11
-
12
9
  var _client = require("../../client");
13
-
14
10
  var _mockSecurity = require("../../mockSecurity");
15
-
16
11
  var _utils2 = require("@webiny/utils");
17
-
18
12
  const pagesHandler = async (configuration, payload, context) => {
19
13
  const log = console.log;
20
14
  const {
@@ -25,12 +19,11 @@ const pagesHandler = async (configuration, payload, context) => {
25
19
  type,
26
20
  category,
27
21
  zipFileUrl,
28
- identity
22
+ identity,
23
+ meta
29
24
  } = payload;
30
-
31
25
  try {
32
26
  log("RUNNING Import Pages Create");
33
-
34
27
  if (!zipFileUrl) {
35
28
  return {
36
29
  data: null,
@@ -39,29 +32,29 @@ const pagesHandler = async (configuration, payload, context) => {
39
32
  }
40
33
  };
41
34
  }
35
+ (0, _mockSecurity.mockSecurity)(identity, context);
36
+ // Step 1: Read the zip file
37
+ const pageImportDataList = await (0, _utils.readExtractAndUploadZipFileContents)(zipFileUrl);
42
38
 
43
- (0, _mockSecurity.mockSecurity)(identity, context); // Step 1: Read the zip file
44
-
45
- const pageImportDataList = await (0, _utils.readExtractAndUploadZipFileContents)(zipFileUrl); // For each page create a subtask and invoke the process handler
46
-
39
+ // For each page create a subtask and invoke the process handler
47
40
  for (let i = 0; i < pageImportDataList.length; i++) {
48
- const pagesDirMap = pageImportDataList[i]; // Create sub task
49
-
41
+ const pagesDirMap = pageImportDataList[i];
42
+ // Create sub task
50
43
  const subtask = await pageBuilder.importExportTask.createSubTask(task.id, (0, _utils2.zeroPad)(i + 1, 5), {
51
44
  status: _types.ImportExportTaskStatus.PENDING,
52
45
  data: {
53
46
  pageKey: pagesDirMap.key,
54
47
  category,
55
48
  zipFileUrl,
49
+ meta,
56
50
  input: {
57
51
  fileUploadsData: pagesDirMap
58
52
  }
59
53
  }
60
54
  });
61
55
  log(`Added SUB_TASK "${subtask.id}" to queue.`);
62
- } // Update main task status
63
-
64
-
56
+ }
57
+ // Update main task status
65
58
  await pageBuilder.importExportTask.updateTask(task.id, {
66
59
  status: _types.ImportExportTaskStatus.PROCESSING,
67
60
  stats: (0, _utils.initialStats)(pageImportDataList.length)
@@ -80,6 +73,7 @@ const pagesHandler = async (configuration, payload, context) => {
80
73
  });
81
74
  } catch (e) {
82
75
  log("[IMPORT_PAGES_CREATE] Error => ", e);
76
+
83
77
  /**
84
78
  * In case of error, we'll update the task status to "failed",
85
79
  * so that, client can show notify the user appropriately.
@@ -100,11 +94,9 @@ const pagesHandler = async (configuration, payload, context) => {
100
94
  }
101
95
  };
102
96
  }
103
-
104
97
  return {
105
98
  data: "",
106
99
  error: null
107
100
  };
108
101
  };
109
-
110
102
  exports.pagesHandler = pagesHandler;
@@ -1 +1 @@
1
- {"version":3,"names":["pagesHandler","configuration","payload","context","log","console","pageBuilder","task","type","category","zipFileUrl","identity","data","error","message","mockSecurity","pageImportDataList","readExtractAndUploadZipFileContents","i","length","pagesDirMap","subtask","importExportTask","createSubTask","id","zeroPad","status","ImportExportTaskStatus","PENDING","pageKey","key","input","fileUploadsData","updateTask","PROCESSING","stats","initialStats","invokeHandlerClient","name","handlers","process","taskId","subTaskIndex","security","getIdentity","description","e","FAILED","code"],"sources":["pagesHandler.ts"],"sourcesContent":["import { ImportExportTaskStatus, PbImportExportContext } from \"~/types\";\nimport { initialStats, readExtractAndUploadZipFileContents } from \"~/import/utils\";\nimport { invokeHandlerClient } from \"~/client\";\nimport { Payload as ProcessPayload } from \"../process\";\nimport { mockSecurity } from \"~/mockSecurity\";\nimport { zeroPad } from \"@webiny/utils\";\nimport { Configuration, Payload, Response } from \"~/import/create\";\n\nexport const pagesHandler = async (\n configuration: Configuration,\n payload: Payload,\n context: PbImportExportContext\n): Promise<Response> => {\n const log = console.log;\n\n const { pageBuilder } = context;\n const { task, type, category, zipFileUrl, identity } = payload;\n try {\n log(\"RUNNING Import Pages Create\");\n if (!zipFileUrl) {\n return {\n data: null,\n error: {\n message: `Missing \"zipFileUrl\"!`\n }\n };\n }\n mockSecurity(identity, context);\n // Step 1: Read the zip file\n const pageImportDataList = await readExtractAndUploadZipFileContents(zipFileUrl);\n\n // For each page create a subtask and invoke the process handler\n for (let i = 0; i < pageImportDataList.length; i++) {\n const pagesDirMap = pageImportDataList[i];\n // Create sub task\n const subtask = await pageBuilder.importExportTask.createSubTask(\n task.id,\n zeroPad(i + 1, 5),\n {\n status: ImportExportTaskStatus.PENDING,\n data: {\n pageKey: pagesDirMap.key,\n category,\n zipFileUrl,\n input: {\n fileUploadsData: pagesDirMap\n }\n }\n }\n );\n log(`Added SUB_TASK \"${subtask.id}\" to queue.`);\n }\n // Update main task status\n await pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.PROCESSING,\n stats: initialStats(pageImportDataList.length)\n });\n\n await invokeHandlerClient<ProcessPayload>({\n context,\n name: configuration.handlers.process,\n payload: {\n taskId: task.id,\n // Execute \"Process\" for the first sub task.\n subTaskIndex: 1,\n type,\n identity: context.security.getIdentity()\n },\n description: \"Import pages - process - first\"\n });\n } catch (e) {\n log(\"[IMPORT_PAGES_CREATE] 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\n await pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.FAILED,\n error: {\n name: e.name,\n message: e.message,\n code: e.code || \"EXPORT_FAILED\"\n }\n });\n\n return {\n data: null,\n error: {\n message: e.message\n }\n };\n }\n\n return {\n data: \"\",\n error: null\n };\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAGO,MAAMA,YAAY,GAAG,OACxBC,aADwB,EAExBC,OAFwB,EAGxBC,OAHwB,KAIJ;EACpB,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAApB;EAEA,MAAM;IAAEE;EAAF,IAAkBH,OAAxB;EACA,MAAM;IAAEI,IAAF;IAAQC,IAAR;IAAcC,QAAd;IAAwBC,UAAxB;IAAoCC;EAApC,IAAiDT,OAAvD;;EACA,IAAI;IACAE,GAAG,CAAC,6BAAD,CAAH;;IACA,IAAI,CAACM,UAAL,EAAiB;MACb,OAAO;QACHE,IAAI,EAAE,IADH;QAEHC,KAAK,EAAE;UACHC,OAAO,EAAG;QADP;MAFJ,CAAP;IAMH;;IAC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R,CAAiBC,WAAjB;MALL,CAH6B;MAUtCC,WAAW,EAAE;IAVyB,CAApC,CAAN;EAYH,CArDD,CAqDE,OAAOC,CAAP,EAAU;IACR1C,GAAG,CAAC,iCAAD,EAAoC0C,CAApC,CAAH;IAEA;AACR;AACA;AACA;;IAEQ,MAAMxC,WAAW,CAACgB,gBAAZ,CAA6BW,UAA7B,CAAwC1B,IAAI,CAACiB,EAA7C,EAAiD;MACnDE,MAAM,EAAEC,6BAAA,CAAuBoB,MADoB;MAEnDlC,KAAK,EAAE;QACHyB,IAAI,EAAEQ,CAAC,CAACR,IADL;QAEHxB,OAAO,EAAEgC,CAAC,CAAChC,OAFR;QAGHkC,IAAI,EAAEF,CAAC,CAACE,IAAF,IAAU;MAHb;IAF4C,CAAjD,CAAN;IASA,OAAO;MACHpC,IAAI,EAAE,IADH;MAEHC,KAAK,EAAE;QACHC,OAAO,EAAEgC,CAAC,CAAChC;MADR;IAFJ,CAAP;EAMH;;EAED,OAAO;IACHF,IAAI,EAAE,EADH;IAEHC,KAAK,EAAE;EAFJ,CAAP;AAIH,CA3FM"}
1
+ {"version":3,"names":["pagesHandler","configuration","payload","context","log","console","pageBuilder","task","type","category","zipFileUrl","identity","meta","data","error","message","mockSecurity","pageImportDataList","readExtractAndUploadZipFileContents","i","length","pagesDirMap","subtask","importExportTask","createSubTask","id","zeroPad","status","ImportExportTaskStatus","PENDING","pageKey","key","input","fileUploadsData","updateTask","PROCESSING","stats","initialStats","invokeHandlerClient","name","handlers","process","taskId","subTaskIndex","security","getIdentity","description","e","FAILED","code"],"sources":["pagesHandler.ts"],"sourcesContent":["import { ImportExportTaskStatus, PbImportExportContext } from \"~/types\";\nimport { initialStats, readExtractAndUploadZipFileContents } from \"~/import/utils\";\nimport { invokeHandlerClient } from \"~/client\";\nimport { Payload as ProcessPayload } from \"../process\";\nimport { mockSecurity } from \"~/mockSecurity\";\nimport { zeroPad } from \"@webiny/utils\";\nimport { Configuration, Payload, Response } from \"~/import/create\";\n\nexport const pagesHandler = async (\n configuration: Configuration,\n payload: Payload,\n context: PbImportExportContext\n): Promise<Response> => {\n const log = console.log;\n\n const { pageBuilder } = context;\n const { task, type, category, zipFileUrl, identity, meta } = payload;\n try {\n log(\"RUNNING Import Pages Create\");\n if (!zipFileUrl) {\n return {\n data: null,\n error: {\n message: `Missing \"zipFileUrl\"!`\n }\n };\n }\n mockSecurity(identity, context);\n // Step 1: Read the zip file\n const pageImportDataList = await readExtractAndUploadZipFileContents(zipFileUrl);\n\n // For each page create a subtask and invoke the process handler\n for (let i = 0; i < pageImportDataList.length; i++) {\n const pagesDirMap = pageImportDataList[i];\n // Create sub task\n const subtask = await pageBuilder.importExportTask.createSubTask(\n task.id,\n zeroPad(i + 1, 5),\n {\n status: ImportExportTaskStatus.PENDING,\n data: {\n pageKey: pagesDirMap.key,\n category,\n zipFileUrl,\n meta,\n input: {\n fileUploadsData: pagesDirMap\n }\n }\n }\n );\n log(`Added SUB_TASK \"${subtask.id}\" to queue.`);\n }\n // Update main task status\n await pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.PROCESSING,\n stats: initialStats(pageImportDataList.length)\n });\n\n await invokeHandlerClient<ProcessPayload>({\n context,\n name: configuration.handlers.process,\n payload: {\n taskId: task.id,\n // Execute \"Process\" for the first sub task.\n subTaskIndex: 1,\n type,\n identity: context.security.getIdentity()\n },\n description: \"Import pages - process - first\"\n });\n } catch (e) {\n log(\"[IMPORT_PAGES_CREATE] 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\n await pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.FAILED,\n error: {\n name: e.name,\n message: e.message,\n code: e.code || \"EXPORT_FAILED\"\n }\n });\n\n return {\n data: null,\n error: {\n message: e.message\n }\n };\n }\n\n return {\n data: \"\",\n error: null\n };\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AACA;AAGO,MAAMA,YAAY,G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EAAE;MACnDE,MAAM,EAAEC,6BAAsB,CAACO,UAAU;MACzCC,KAAK,EAAE,IAAAC,mBAAY,EAACpB,kBAAkB,CAACG,MAAM;IACjD,CAAC,CAAC;IAEF,MAAM,IAAAkB,2BAAmB,EAAiB;MACtCnC,OAAO;MACPoC,IAAI,EAAEtC,aAAa,CAACuC,QAAQ,CAACC,OAAO;MACpCvC,OAAO,EAAE;QACLwC,MAAM,EAAEnC,IAAI,CAACkB,EAAE;QACf;QACAkB,YAAY,EAAE,CAAC;QACfnC,IAAI;QACJG,QAAQ,EAAER,OAAO,CAACyC,QAAQ,CAACC,WAAW;MAC1C,CAAC;MACDC,WAAW,EAAE;IACjB,CAAC,CAAC;EACN,CAAC,CAAC,OAAOC,CAAC,EAAE;IACR3C,GAAG,CAAC,iCAAiC,EAAE2C,CAAC,CAAC;;IAEzC;AACR;AACA;AACA;;IAEQ,MAAMzC,WAAW,CAACiB,gBAAgB,CAACW,UAAU,CAAC3B,IAAI,CAACkB,EAAE,EAAE;MACnDE,MAAM,EAAEC,6BAAsB,CAACoB,MAAM;MACrClC,KAAK,EAAE;QACHyB,IAAI,EAAEQ,CAAC,CAACR,IAAI;QACZxB,OAAO,EAAEgC,CAAC,CAAChC,OAAO;QAClBkC,IAAI,EAAEF,CAAC,CAACE,IAAI,IAAI;MACpB;IACJ,CAAC,CAAC;IAEF,OAAO;MACHpC,IAAI,EAAE,IAAI;MACVC,KAAK,EAAE;QACHC,OAAO,EAAEgC,CAAC,CAAChC;MACf;IACJ,CAAC;EACL;EAEA,OAAO;IACHF,IAAI,EAAE,EAAE;IACRC,KAAK,EAAE;EACX,CAAC;AACL,CAAC;AAAC"}
@@ -0,0 +1,3 @@
1
+ import { PbImportExportContext } from "../../types";
2
+ import { Configuration, Payload, Response } from ".";
3
+ export declare const templatesHandler: (configuration: Configuration, payload: Payload, context: PbImportExportContext) => Promise<Response>;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.templatesHandler = void 0;
7
+ var _types = require("../../types");
8
+ var _utils = require("../utils");
9
+ var _client = require("../../client");
10
+ var _mockSecurity = require("../../mockSecurity");
11
+ var _utils2 = require("@webiny/utils");
12
+ const templatesHandler = async (configuration, payload, context) => {
13
+ const log = console.log;
14
+ const {
15
+ pageBuilder
16
+ } = context;
17
+ const {
18
+ task,
19
+ type,
20
+ zipFileUrl,
21
+ identity
22
+ } = payload;
23
+ try {
24
+ log("RUNNING Import Templates Create");
25
+ if (!zipFileUrl) {
26
+ return {
27
+ data: null,
28
+ error: {
29
+ message: `Missing "zipFileUrl"!`
30
+ }
31
+ };
32
+ }
33
+ (0, _mockSecurity.mockSecurity)(identity, context);
34
+ // Step 1: Read the zip file
35
+ const templateImportDataList = await (0, _utils.readExtractAndUploadZipFileContents)(zipFileUrl);
36
+
37
+ // For each template create a subtask and invoke the process handler
38
+ for (let i = 0; i < templateImportDataList.length; i++) {
39
+ const templatesDirMap = templateImportDataList[i];
40
+ // Create sub task
41
+ const subtask = await pageBuilder.importExportTask.createSubTask(task.id, (0, _utils2.zeroPad)(i + 1, 5), {
42
+ status: _types.ImportExportTaskStatus.PENDING,
43
+ data: {
44
+ templateKey: templatesDirMap.key,
45
+ zipFileUrl,
46
+ input: {
47
+ fileUploadsData: templatesDirMap
48
+ }
49
+ }
50
+ });
51
+ log(`Added SUB_TASK "${subtask.id}" to queue.`);
52
+ }
53
+ // Update main task status
54
+ await pageBuilder.importExportTask.updateTask(task.id, {
55
+ status: _types.ImportExportTaskStatus.PROCESSING,
56
+ stats: (0, _utils.initialStats)(templateImportDataList.length)
57
+ });
58
+ await (0, _client.invokeHandlerClient)({
59
+ context,
60
+ name: configuration.handlers.process,
61
+ payload: {
62
+ taskId: task.id,
63
+ // Execute "Process" for the first sub task.
64
+ subTaskIndex: 1,
65
+ type,
66
+ identity: context.security.getIdentity()
67
+ },
68
+ description: "Import templates - process - first"
69
+ });
70
+ } catch (e) {
71
+ log("[IMPORT_TEMPLATES_CREATE] Error => ", e);
72
+
73
+ /**
74
+ * In case of error, we'll update the task status to "failed",
75
+ * so that, client can show notify the user appropriately.
76
+ */
77
+
78
+ await pageBuilder.importExportTask.updateTask(task.id, {
79
+ status: _types.ImportExportTaskStatus.FAILED,
80
+ error: {
81
+ name: e.name,
82
+ message: e.message,
83
+ code: e.code || "EXPORT_FAILED"
84
+ }
85
+ });
86
+ return {
87
+ data: null,
88
+ error: {
89
+ message: e.message
90
+ }
91
+ };
92
+ }
93
+ return {
94
+ data: "",
95
+ error: null
96
+ };
97
+ };
98
+ exports.templatesHandler = templatesHandler;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["templatesHandler","configuration","payload","context","log","console","pageBuilder","task","type","zipFileUrl","identity","data","error","message","mockSecurity","templateImportDataList","readExtractAndUploadZipFileContents","i","length","templatesDirMap","subtask","importExportTask","createSubTask","id","zeroPad","status","ImportExportTaskStatus","PENDING","templateKey","key","input","fileUploadsData","updateTask","PROCESSING","stats","initialStats","invokeHandlerClient","name","handlers","process","taskId","subTaskIndex","security","getIdentity","description","e","FAILED","code"],"sources":["templatesHandler.ts"],"sourcesContent":["import { ImportExportTaskStatus, PbImportExportContext } from \"~/types\";\nimport { initialStats, readExtractAndUploadZipFileContents } from \"~/import/utils\";\nimport { invokeHandlerClient } from \"~/client\";\nimport { Payload as ProcessPayload } from \"../process\";\nimport { mockSecurity } from \"~/mockSecurity\";\nimport { zeroPad } from \"@webiny/utils\";\nimport { Configuration, Payload, Response } from \"~/import/create\";\n\nexport const templatesHandler = async (\n configuration: Configuration,\n payload: Payload,\n context: PbImportExportContext\n): Promise<Response> => {\n const log = console.log;\n\n const { pageBuilder } = context;\n const { task, type, zipFileUrl, identity } = payload;\n try {\n log(\"RUNNING Import Templates Create\");\n if (!zipFileUrl) {\n return {\n data: null,\n error: {\n message: `Missing \"zipFileUrl\"!`\n }\n };\n }\n mockSecurity(identity, context);\n // Step 1: Read the zip file\n const templateImportDataList = await readExtractAndUploadZipFileContents(zipFileUrl);\n\n // For each template create a subtask and invoke the process handler\n for (let i = 0; i < templateImportDataList.length; i++) {\n const templatesDirMap = templateImportDataList[i];\n // Create sub task\n const subtask = await pageBuilder.importExportTask.createSubTask(\n task.id,\n zeroPad(i + 1, 5),\n {\n status: ImportExportTaskStatus.PENDING,\n data: {\n templateKey: templatesDirMap.key,\n zipFileUrl,\n input: {\n fileUploadsData: templatesDirMap\n }\n }\n }\n );\n log(`Added SUB_TASK \"${subtask.id}\" to queue.`);\n }\n // Update main task status\n await pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.PROCESSING,\n stats: initialStats(templateImportDataList.length)\n });\n\n await invokeHandlerClient<ProcessPayload>({\n context,\n name: configuration.handlers.process,\n payload: {\n taskId: task.id,\n // Execute \"Process\" for the first sub task.\n subTaskIndex: 1,\n type,\n identity: context.security.getIdentity()\n },\n description: \"Import templates - process - first\"\n });\n } catch (e) {\n log(\"[IMPORT_TEMPLATES_CREATE] 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\n await pageBuilder.importExportTask.updateTask(task.id, {\n status: ImportExportTaskStatus.FAILED,\n error: {\n name: e.name,\n message: e.message,\n code: e.code || \"EXPORT_FAILED\"\n }\n });\n\n return {\n data: null,\n error: {\n message: e.message\n }\n };\n }\n\n return {\n data: \"\",\n error: null\n };\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AACA;AAGO,MAAMA,gBAAgB,GAAG,OAC5BC,aAA4B,EAC5BC,OAAgB,EAChBC,OAA8B,KACV;EACpB,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAAG;EAEvB,MAAM;IAAEE;EAAY,CAAC,GAAGH,OAAO;EAC/B,MAAM;IAAEI,IAAI;IAAEC,IAAI;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGR,OAAO;EACpD,IAAI;IACAE,GAAG,CAAC,iCAAiC,CAAC;IACtC,IA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