@webiny/api-page-builder-import-export 5.34.8-beta.1 → 5.35.0-beta.0

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 (148) 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/formsHandler.d.ts +6 -0
  6. package/export/combine/formsHandler.js +99 -0
  7. package/export/combine/formsHandler.js.map +1 -0
  8. package/export/combine/index.js +19 -9
  9. package/export/combine/index.js.map +1 -1
  10. package/export/combine/pagesHandler.js +11 -18
  11. package/export/combine/pagesHandler.js.map +1 -1
  12. package/export/combine/templatesHandler.d.ts +6 -0
  13. package/export/combine/templatesHandler.js +99 -0
  14. package/export/combine/templatesHandler.js.map +1 -0
  15. package/export/process/blocksHandler.js +18 -32
  16. package/export/process/blocksHandler.js.map +1 -1
  17. package/export/process/formsHandler.d.ts +6 -0
  18. package/export/process/formsHandler.js +187 -0
  19. package/export/process/formsHandler.js.map +1 -0
  20. package/export/process/index.js +19 -9
  21. package/export/process/index.js.map +1 -1
  22. package/export/process/pagesHandler.js +19 -34
  23. package/export/process/pagesHandler.js.map +1 -1
  24. package/export/process/templatesHandler.d.ts +6 -0
  25. package/export/process/templatesHandler.js +166 -0
  26. package/export/process/templatesHandler.js.map +1 -0
  27. package/export/s3Stream.d.ts +5 -2
  28. package/export/s3Stream.js +1 -20
  29. package/export/s3Stream.js.map +1 -1
  30. package/export/utils.d.ts +14 -1
  31. package/export/utils.js +88 -35
  32. package/export/utils.js.map +1 -1
  33. package/export/zipper.js +31 -43
  34. package/export/zipper.js.map +1 -1
  35. package/graphql/crud/blocks.crud.js +20 -39
  36. package/graphql/crud/blocks.crud.js.map +1 -1
  37. package/graphql/crud/forms.crud.d.ts +4 -0
  38. package/graphql/crud/forms.crud.js +129 -0
  39. package/graphql/crud/forms.crud.js.map +1 -0
  40. package/graphql/crud/importExportTasks.crud.js +9 -57
  41. package/graphql/crud/importExportTasks.crud.js.map +1 -1
  42. package/graphql/crud/pages.crud.js +25 -41
  43. package/graphql/crud/pages.crud.js.map +1 -1
  44. package/graphql/crud/templates.crud.d.ts +4 -0
  45. package/graphql/crud/templates.crud.js +124 -0
  46. package/graphql/crud/templates.crud.js.map +1 -0
  47. package/graphql/crud.js +3 -7
  48. package/graphql/crud.js.map +1 -1
  49. package/graphql/graphql/blocks.gql.js +1 -6
  50. package/graphql/graphql/blocks.gql.js.map +1 -1
  51. package/graphql/graphql/forms.gql.d.ts +4 -0
  52. package/graphql/graphql/forms.gql.js +60 -0
  53. package/graphql/graphql/forms.gql.js.map +1 -0
  54. package/graphql/graphql/importExportTasks.gql.js +1 -6
  55. package/graphql/graphql/importExportTasks.gql.js.map +1 -1
  56. package/graphql/graphql/pages.gql.js +2 -7
  57. package/graphql/graphql/pages.gql.js.map +1 -1
  58. package/graphql/graphql/templates.gql.d.ts +4 -0
  59. package/graphql/graphql/templates.gql.js +52 -0
  60. package/graphql/graphql/templates.gql.js.map +1 -0
  61. package/graphql/graphql/utils/resolve.d.ts +1 -1
  62. package/graphql/graphql/utils/resolve.js +0 -3
  63. package/graphql/graphql/utils/resolve.js.map +1 -1
  64. package/graphql/graphql.js +3 -6
  65. package/graphql/graphql.js.map +1 -1
  66. package/graphql/index.js +0 -5
  67. package/graphql/index.js.map +1 -1
  68. package/graphql/types.d.ts +40 -0
  69. package/graphql/types.js.map +1 -1
  70. package/import/constants.d.ts +3 -0
  71. package/import/constants.js +14 -0
  72. package/import/constants.js.map +1 -0
  73. package/import/create/blocksHandler.js +11 -20
  74. package/import/create/blocksHandler.js.map +1 -1
  75. package/import/create/formsHandler.d.ts +3 -0
  76. package/import/create/formsHandler.js +103 -0
  77. package/import/create/formsHandler.js.map +1 -0
  78. package/import/create/index.d.ts +2 -1
  79. package/import/create/index.js +19 -9
  80. package/import/create/index.js.map +1 -1
  81. package/import/create/pagesHandler.js +13 -20
  82. package/import/create/pagesHandler.js.map +1 -1
  83. package/import/create/templatesHandler.d.ts +3 -0
  84. package/import/create/templatesHandler.js +99 -0
  85. package/import/create/templatesHandler.js.map +1 -0
  86. package/import/process/blocks/blocksHandler.d.ts +3 -0
  87. package/import/process/blocks/blocksHandler.js +169 -0
  88. package/import/process/blocks/blocksHandler.js.map +1 -0
  89. package/import/process/blocks/importBlock.d.ts +11 -0
  90. package/import/process/blocks/importBlock.js +92 -0
  91. package/import/process/blocks/importBlock.js.map +1 -0
  92. package/import/process/forms/formsHandler.d.ts +3 -0
  93. package/import/process/forms/formsHandler.js +176 -0
  94. package/import/process/forms/formsHandler.js.map +1 -0
  95. package/import/process/forms/importForm.d.ts +9 -0
  96. package/import/process/forms/importForm.js +43 -0
  97. package/import/process/forms/importForm.js.map +1 -0
  98. package/import/process/index.d.ts +1 -0
  99. package/import/process/index.js +21 -11
  100. package/import/process/index.js.map +1 -1
  101. package/import/process/pages/importPage.d.ts +11 -0
  102. package/import/process/pages/importPage.js +92 -0
  103. package/import/process/pages/importPage.js.map +1 -0
  104. package/import/process/pages/pagesHandler.d.ts +3 -0
  105. package/import/process/pages/pagesHandler.js +183 -0
  106. package/import/process/pages/pagesHandler.js.map +1 -0
  107. package/import/process/templates/importTemplate.d.ts +11 -0
  108. package/import/process/templates/importTemplate.js +66 -0
  109. package/import/process/templates/importTemplate.js.map +1 -0
  110. package/import/process/templates/templatesHandler.d.ts +3 -0
  111. package/import/process/templates/templatesHandler.js +170 -0
  112. package/import/process/templates/templatesHandler.js.map +1 -0
  113. package/import/utils/deleteS3Folder.d.ts +1 -0
  114. package/import/utils/deleteS3Folder.js +19 -0
  115. package/import/utils/deleteS3Folder.js.map +1 -0
  116. package/import/utils/extractAndUploadZipFileContents.d.ts +7 -0
  117. package/import/utils/extractAndUploadZipFileContents.js +122 -0
  118. package/import/utils/extractAndUploadZipFileContents.js.map +1 -0
  119. package/import/utils/extractZipAndUploadToS3.d.ts +2 -0
  120. package/import/utils/extractZipAndUploadToS3.js +98 -0
  121. package/import/utils/extractZipAndUploadToS3.js.map +1 -0
  122. package/import/utils/getFileNameWithoutExt.d.ts +1 -0
  123. package/import/utils/getFileNameWithoutExt.js +11 -0
  124. package/import/utils/getFileNameWithoutExt.js.map +1 -0
  125. package/import/utils/index.d.ts +9 -0
  126. package/import/utils/index.js +104 -0
  127. package/import/utils/index.js.map +1 -0
  128. package/import/utils/initialStats.d.ts +7 -0
  129. package/import/utils/initialStats.js +16 -0
  130. package/import/utils/initialStats.js.map +1 -0
  131. package/import/utils/prepareDataDirMap.d.ts +6 -0
  132. package/import/utils/prepareDataDirMap.js +29 -0
  133. package/import/utils/prepareDataDirMap.js.map +1 -0
  134. package/import/utils/updateFilesInData.d.ts +8 -0
  135. package/import/utils/updateFilesInData.js +48 -0
  136. package/import/utils/updateFilesInData.js.map +1 -0
  137. package/import/utils/uploadAssets.d.ts +10 -0
  138. package/import/utils/uploadAssets.js +51 -0
  139. package/import/utils/uploadAssets.js.map +1 -0
  140. package/import/utils/uploadFilesFromS3.d.ts +3 -0
  141. package/import/utils/uploadFilesFromS3.js +19 -0
  142. package/import/utils/uploadFilesFromS3.js.map +1 -0
  143. package/mockSecurity.js +0 -2
  144. package/mockSecurity.js.map +1 -1
  145. package/package.json +25 -24
  146. package/types.d.ts +21 -0
  147. package/types.js +0 -5
  148. package/types.js.map +1 -1
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.initialStats = initialStats;
7
+ var _types = require("../../types");
8
+ function initialStats(total) {
9
+ return {
10
+ [_types.ImportExportTaskStatus.PENDING]: total,
11
+ [_types.ImportExportTaskStatus.PROCESSING]: 0,
12
+ [_types.ImportExportTaskStatus.COMPLETED]: 0,
13
+ [_types.ImportExportTaskStatus.FAILED]: 0,
14
+ total
15
+ };
16
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["initialStats","total","ImportExportTaskStatus","PENDING","PROCESSING","COMPLETED","FAILED"],"sources":["initialStats.ts"],"sourcesContent":["import { ImportExportTaskStatus } from \"~/types\";\n\nexport function initialStats(total: number) {\n return {\n [ImportExportTaskStatus.PENDING]: total,\n [ImportExportTaskStatus.PROCESSING]: 0,\n [ImportExportTaskStatus.COMPLETED]: 0,\n [ImportExportTaskStatus.FAILED]: 0,\n total\n };\n}\n"],"mappings":";;;;;;AAAA;AAEO,SAASA,YAAY,CAACC,KAAa,EAAE;EACxC,OAAO;IACH,CAACC,6BAAsB,CAACC,OAAO,GAAGF,KAAK;IACvC,CAACC,6BAAsB,CAACE,UAAU,GAAG,CAAC;IACtC,CAACF,6BAAsB,CAACG,SAAS,GAAG,CAAC;IACrC,CAACH,6BAAsB,CAACI,MAAM,GAAG,CAAC;IAClCL;EACJ,CAAC;AACL"}
@@ -0,0 +1,6 @@
1
+ import { ImportData } from "../../types";
2
+ export declare function prepareDataDirMap({ map, filePath, newKey }: {
3
+ map: ImportData;
4
+ filePath: string;
5
+ newKey: string;
6
+ }): ImportData;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.prepareDataDirMap = prepareDataDirMap;
8
+ var _dotPropImmutable = _interopRequireDefault(require("dot-prop-immutable"));
9
+ var _constants = require("../constants");
10
+ function prepareDataDirMap({
11
+ map,
12
+ filePath,
13
+ newKey
14
+ }) {
15
+ const isAsset = filePath.includes(_constants.ASSETS_DIR_NAME);
16
+ if (isAsset) {
17
+ /*
18
+ * We want to use dot (.) as part of object key rather than creating nested object(s).
19
+ * Also, the file name might contain dots in it beside the extension, so, we are escaping them all.
20
+ */
21
+ const assetKey = filePath.split(`${_constants.ASSETS_DIR_NAME}/`).pop();
22
+ const oldKey = assetKey.replace(/\./g, "\\.");
23
+ map = _dotPropImmutable.default.set(map, `assets.${oldKey}`, newKey);
24
+ } else {
25
+ // We only need to know the newKey for data file.
26
+ map = _dotPropImmutable.default.set(map, `data`, newKey);
27
+ }
28
+ return map;
29
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["prepareDataDirMap","map","filePath","newKey","isAsset","includes","ASSETS_DIR_NAME","assetKey","split","pop","oldKey","replace","dotProp","set"],"sources":["prepareDataDirMap.ts"],"sourcesContent":["import dotProp from \"dot-prop-immutable\";\nimport { ImportData } from \"~/types\";\nimport { ASSETS_DIR_NAME } from \"~/import/constants\";\n\nexport function prepareDataDirMap({\n map,\n filePath,\n newKey\n}: {\n map: ImportData;\n filePath: string;\n newKey: string;\n}): ImportData {\n const isAsset = filePath.includes(ASSETS_DIR_NAME);\n\n if (isAsset) {\n /*\n * We want to use dot (.) as part of object key rather than creating nested object(s).\n * Also, the file name might contain dots in it beside the extension, so, we are escaping them all.\n */\n const assetKey = filePath.split(`${ASSETS_DIR_NAME}/`).pop() as string;\n const oldKey = assetKey.replace(/\\./g, \"\\\\.\");\n\n map = dotProp.set(map, `assets.${oldKey}`, newKey);\n } else {\n // We only need to know the newKey for data file.\n map = dotProp.set(map, `data`, newKey);\n }\n\n return map;\n}\n"],"mappings":";;;;;;;AAAA;AAEA;AAEO,SAASA,iBAAiB,CAAC;EAC9BC,GAAG;EACHC,QAAQ;EACRC;AAKJ,CAAC,EAAc;EACX,MAAMC,OAAO,GAAGF,QAAQ,CAACG,QAAQ,CAACC,0BAAe,CAAC;EAElD,IAAIF,OAAO,EAAE;IACT;AACR;AACA;AACA;IACQ,MAAMG,QAAQ,GAAGL,QAAQ,CAACM,KAAK,CAAE,GAAEF,0BAAgB,GAAE,CAAC,CAACG,GAAG,EAAY;IACtE,MAAMC,MAAM,GAAGH,QAAQ,CAACI,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;IAE7CV,GAAG,GAAGW,yBAAO,CAACC,GAAG,CAACZ,GAAG,EAAG,UAASS,MAAO,EAAC,EAAEP,MAAM,CAAC;EACtD,CAAC,MAAM;IACH;IACAF,GAAG,GAAGW,yBAAO,CAACC,GAAG,CAACZ,GAAG,EAAG,MAAK,EAAEE,MAAM,CAAC;EAC1C;EAEA,OAAOF,GAAG;AACd"}
@@ -0,0 +1,8 @@
1
+ import { FileInput } from "@webiny/api-file-manager/types";
2
+ interface UpdateFilesInDataParams {
3
+ data: Record<string, any>;
4
+ fileIdToNewFileMap: Map<string, FileInput>;
5
+ srcPrefix: string;
6
+ }
7
+ export declare function updateFilesInData({ data, fileIdToNewFileMap, srcPrefix }: UpdateFilesInDataParams): void;
8
+ export {};
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.updateFilesInData = updateFilesInData;
7
+ function updateFilesInData({
8
+ data,
9
+ fileIdToNewFileMap,
10
+ srcPrefix
11
+ }) {
12
+ if (!data || typeof data !== "object") {
13
+ return;
14
+ }
15
+ // Recursively call function if data is array
16
+ if (Array.isArray(data)) {
17
+ for (let i = 0; i < data.length; i++) {
18
+ const element = data[i];
19
+ updateFilesInData({
20
+ data: element,
21
+ fileIdToNewFileMap,
22
+ srcPrefix
23
+ });
24
+ }
25
+ return;
26
+ }
27
+ // Main logic
28
+ const tuple = Object.entries(data);
29
+ for (let i = 0; i < tuple.length; i++) {
30
+ const [key, value] = tuple[i];
31
+ if (key === "file" && value && fileIdToNewFileMap.has(value.id)) {
32
+ const newFile = fileIdToNewFileMap.get(value.id);
33
+ if (!newFile) {
34
+ continue;
35
+ }
36
+ const cleanSrcPrefix = srcPrefix.endsWith("/") ? srcPrefix.slice(0, -1) : srcPrefix;
37
+ value.key = newFile.key;
38
+ value.name = newFile.name;
39
+ value.src = `${cleanSrcPrefix}/${newFile.key}`;
40
+ } else {
41
+ updateFilesInData({
42
+ data: value,
43
+ srcPrefix,
44
+ fileIdToNewFileMap
45
+ });
46
+ }
47
+ }
48
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["updateFilesInData","data","fileIdToNewFileMap","srcPrefix","Array","isArray","i","length","element","tuple","Object","entries","key","value","has","id","newFile","get","cleanSrcPrefix","endsWith","slice","name","src"],"sources":["updateFilesInData.ts"],"sourcesContent":["import { FileInput } from \"@webiny/api-file-manager/types\";\n\ninterface UpdateFilesInDataParams {\n data: Record<string, any>;\n fileIdToNewFileMap: Map<string, FileInput>;\n srcPrefix: string;\n}\n\nexport function updateFilesInData({\n data,\n fileIdToNewFileMap,\n srcPrefix\n}: UpdateFilesInDataParams) {\n if (!data || typeof data !== \"object\") {\n return;\n }\n // Recursively call function if data is array\n if (Array.isArray(data)) {\n for (let i = 0; i < data.length; i++) {\n const element = data[i];\n updateFilesInData({ data: element, fileIdToNewFileMap, srcPrefix });\n }\n return;\n }\n // Main logic\n const tuple = Object.entries(data);\n for (let i = 0; i < tuple.length; i++) {\n const [key, value] = tuple[i];\n\n if (key === \"file\" && value && fileIdToNewFileMap.has(value.id)) {\n const newFile = fileIdToNewFileMap.get(value.id);\n if (!newFile) {\n continue;\n }\n\n const cleanSrcPrefix = srcPrefix.endsWith(\"/\") ? srcPrefix.slice(0, -1) : srcPrefix;\n\n value.key = newFile.key;\n value.name = newFile.name;\n value.src = `${cleanSrcPrefix}/${newFile.key}`;\n } else {\n updateFilesInData({ data: value, srcPrefix, fileIdToNewFileMap });\n }\n }\n}\n"],"mappings":";;;;;;AAQO,SAASA,iBAAiB,CAAC;EAC9BC,IAAI;EACJC,kBAAkB;EAClBC;AACqB,CAAC,EAAE;EACxB,IAAI,CAACF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IACnC;EACJ;EACA;EACA,IAAIG,KAAK,CAACC,OAAO,CAACJ,IAAI,CAAC,EAAE;IACrB,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,IAAI,CAACM,MAAM,EAAED,CAAC,EAAE,EAAE;MAClC,MAAME,OAAO,GAAGP,IAAI,CAACK,CAAC,CAAC;MACvBN,iBAAiB,CAAC;QAAEC,IAAI,EAAEO,OAAO;QAAEN,kBAAkB;QAAEC;MAAU,CAAC,CAAC;IACvE;IACA;EACJ;EACA;EACA,MAAMM,KAAK,GAAGC,MAAM,CAACC,OAAO,CAACV,IAAI,CAAC;EAClC,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGG,KAAK,CAACF,MAAM,EAAED,CAAC,EAAE,EAAE;IACnC,MAAM,CAACM,GAAG,EAAEC,KAAK,CAAC,GAAGJ,KAAK,CAACH,CAAC,CAAC;IAE7B,IAAIM,GAAG,KAAK,MAAM,IAAIC,KAAK,IAAIX,kBAAkB,CAACY,GAAG,CAACD,KAAK,CAACE,EAAE,CAAC,EAAE;MAC7D,MAAMC,OAAO,GAAGd,kBAAkB,CAACe,GAAG,CAACJ,KAAK,CAACE,EAAE,CAAC;MAChD,IAAI,CAACC,OAAO,EAAE;QACV;MACJ;MAEA,MAAME,cAAc,GAAGf,SAAS,CAACgB,QAAQ,CAAC,GAAG,CAAC,GAAGhB,SAAS,CAACiB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAGjB,SAAS;MAEnFU,KAAK,CAACD,GAAG,GAAGI,OAAO,CAACJ,GAAG;MACvBC,KAAK,CAACQ,IAAI,GAAGL,OAAO,CAACK,IAAI;MACzBR,KAAK,CAACS,GAAG,GAAI,GAAEJ,cAAe,IAAGF,OAAO,CAACJ,GAAI,EAAC;IAClD,CAAC,MAAM;MACHZ,iBAAiB,CAAC;QAAEC,IAAI,EAAEY,KAAK;QAAEV,SAAS;QAAED;MAAmB,CAAC,CAAC;IACrE;EACJ;AACJ"}
@@ -0,0 +1,10 @@
1
+ import { PbImportExportContext } from "../../graphql/types";
2
+ import { File, FileInput } from "@webiny/api-file-manager/types";
3
+ import { FileUploadsData } from "../../types";
4
+ interface UploadAssetsParams {
5
+ context: PbImportExportContext;
6
+ files: File[];
7
+ fileUploadsData: FileUploadsData;
8
+ }
9
+ export declare const uploadAssets: (params: UploadAssetsParams) => Promise<Map<string, FileInput>>;
10
+ export {};
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.uploadAssets = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _mdbid = _interopRequireDefault(require("mdbid"));
10
+ var _uploadFilesFromS = require("./uploadFilesFromS3");
11
+ // @ts-ignore
12
+
13
+ const uploadAssets = async params => {
14
+ const {
15
+ context,
16
+ files,
17
+ fileUploadsData
18
+ } = params;
19
+ const oldIdToNewFileMap = new Map();
20
+
21
+ /**
22
+ * This function contains logic of file download from S3.
23
+ * Current we're not mocking zip file download from S3 in tests at the moment.
24
+ * So, we're manually mocking it in case of test just by returning an empty object.
25
+ */
26
+ if (process.env.NODE_ENV === "test") {
27
+ return oldIdToNewFileMap;
28
+ }
29
+
30
+ // A map of temporary file keys (created during ZIP upload) to permanent file keys.
31
+ const uploadFileMap = new Map();
32
+
33
+ // Array of file inputs, to insert into the DB.
34
+ const createFilesInput = [];
35
+ for (const oldFile of files) {
36
+ const id = (0, _mdbid.default)();
37
+ // We replace the old file ID with a new one.
38
+ const newKey = `${id}/${oldFile.key.replace(`${oldFile.id}/`, "")}`;
39
+ const newFile = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, oldFile), {}, {
40
+ id,
41
+ key: newKey
42
+ });
43
+ createFilesInput.push(newFile);
44
+ oldIdToNewFileMap.set(oldFile.id, newFile);
45
+ uploadFileMap.set(fileUploadsData.assets[oldFile.key], newFile);
46
+ }
47
+ await (0, _uploadFilesFromS.uploadFilesFromS3)(uploadFileMap);
48
+ await context.fileManager.createFilesInBatch(createFilesInput);
49
+ return oldIdToNewFileMap;
50
+ };
51
+ exports.uploadAssets = uploadAssets;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["uploadAssets","params","context","files","fileUploadsData","oldIdToNewFileMap","Map","process","env","NODE_ENV","uploadFileMap","createFilesInput","oldFile","id","mdbid","newKey","key","replace","newFile","push","set","assets","uploadFilesFromS3","fileManager","createFilesInBatch"],"sources":["uploadAssets.ts"],"sourcesContent":["// @ts-ignore\nimport mdbid from \"mdbid\";\nimport { PbImportExportContext } from \"~/graphql/types\";\nimport { File, FileInput } from \"@webiny/api-file-manager/types\";\nimport { UploadFileMap, uploadFilesFromS3 } from \"~/import/utils/uploadFilesFromS3\";\nimport { FileUploadsData } from \"~/types\";\n\ninterface UploadAssetsParams {\n context: PbImportExportContext;\n files: File[];\n fileUploadsData: FileUploadsData;\n}\n\nexport const uploadAssets = async (params: UploadAssetsParams) => {\n const { context, files, fileUploadsData } = params;\n\n const oldIdToNewFileMap = new Map<string, FileInput>();\n\n /**\n * This function contains logic of file download from S3.\n * Current we're not mocking zip file download from S3 in tests at the moment.\n * So, we're manually mocking it in case of test just by returning an empty object.\n */\n if (process.env.NODE_ENV === \"test\") {\n return oldIdToNewFileMap;\n }\n\n // A map of temporary file keys (created during ZIP upload) to permanent file keys.\n const uploadFileMap: UploadFileMap = new Map();\n\n // Array of file inputs, to insert into the DB.\n const createFilesInput: FileInput[] = [];\n\n for (const oldFile of files) {\n const id = mdbid();\n // We replace the old file ID with a new one.\n const newKey = `${id}/${oldFile.key.replace(`${oldFile.id}/`, \"\")}`;\n const newFile: FileInput = { ...oldFile, id, key: newKey };\n\n createFilesInput.push(newFile);\n oldIdToNewFileMap.set(oldFile.id, newFile);\n uploadFileMap.set(fileUploadsData.assets[oldFile.key], newFile);\n }\n\n await uploadFilesFromS3(uploadFileMap);\n\n await context.fileManager.createFilesInBatch(createFilesInput);\n\n return oldIdToNewFileMap;\n};\n"],"mappings":";;;;;;;;AACA;AAGA;AAJA;;AAaO,MAAMA,YAAY,GAAG,MAAOC,MAA0B,IAAK;EAC9D,MAAM;IAAEC,OAAO;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAGH,MAAM;EAElD,MAAMI,iBAAiB,GAAG,IAAIC,GAAG,EAAqB;;EAEtD;AACJ;AACA;AACA;AACA;EACI,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;IACjC,OAAOJ,iBAAiB;EAC5B;;EAEA;EACA,MAAMK,aAA4B,GAAG,IAAIJ,GAAG,EAAE;;EAE9C;EACA,MAAMK,gBAA6B,GAAG,EAAE;EAExC,KAAK,MAAMC,OAAO,IAAIT,KAAK,EAAE;IACzB,MAAMU,EAAE,GAAG,IAAAC,cAAK,GAAE;IAClB;IACA,MAAMC,MAAM,GAAI,GAAEF,EAAG,IAAGD,OAAO,CAACI,GAAG,CAACC,OAAO,CAAE,GAAEL,OAAO,CAACC,EAAG,GAAE,EAAE,EAAE,CAAE,EAAC;IACnE,MAAMK,OAAkB,+DAAQN,OAAO;MAAEC,EAAE;MAAEG,GAAG,EAAED;IAAM,EAAE;IAE1DJ,gBAAgB,CAACQ,IAAI,CAACD,OAAO,CAAC;IAC9Bb,iBAAiB,CAACe,GAAG,CAACR,OAAO,CAACC,EAAE,EAAEK,OAAO,CAAC;IAC1CR,aAAa,CAACU,GAAG,CAAChB,eAAe,CAACiB,MAAM,CAACT,OAAO,CAACI,GAAG,CAAC,EAAEE,OAAO,CAAC;EACnE;EAEA,MAAM,IAAAI,mCAAiB,EAACZ,aAAa,CAAC;EAEtC,MAAMR,OAAO,CAACqB,WAAW,CAACC,kBAAkB,CAACb,gBAAgB,CAAC;EAE9D,OAAON,iBAAiB;AAC5B,CAAC;AAAC"}
@@ -0,0 +1,3 @@
1
+ import { FileInput } from "@webiny/api-file-manager/types";
2
+ export declare type UploadFileMap = Map<string, FileInput>;
3
+ export declare function uploadFilesFromS3(fileMap: UploadFileMap): Promise<import("aws-sdk/clients/s3").ManagedUpload.SendData[]>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.uploadFilesFromS3 = uploadFilesFromS3;
7
+ var _s3Stream = require("../../export/s3Stream");
8
+ async function uploadFilesFromS3(fileMap) {
9
+ const promises = [];
10
+ for (const [source, target] of Array.from(fileMap.entries())) {
11
+ // Read file.
12
+ const readStream = _s3Stream.s3Stream.readStream(source);
13
+ const ws = _s3Stream.s3Stream.writeStream(target.key, target.type);
14
+ readStream.pipe(ws.streamPassThrough);
15
+ promises.push(ws.streamPassThroughUploadPromise);
16
+ console.log(`Successfully queued file "${target.key}"`);
17
+ }
18
+ return Promise.all(promises);
19
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["uploadFilesFromS3","fileMap","promises","source","target","Array","from","entries","readStream","s3Stream","ws","writeStream","key","type","pipe","streamPassThrough","push","streamPassThroughUploadPromise","console","log","Promise","all"],"sources":["uploadFilesFromS3.ts"],"sourcesContent":["import { s3Stream } from \"~/export/s3Stream\";\nimport { FileInput } from \"@webiny/api-file-manager/types\";\n\nexport type UploadFileMap = Map<string, FileInput>;\n\nexport async function uploadFilesFromS3(fileMap: UploadFileMap) {\n const promises = [];\n for (const [source, target] of Array.from(fileMap.entries())) {\n // Read file.\n const readStream = s3Stream.readStream(source);\n\n const ws = s3Stream.writeStream(target.key, target.type);\n readStream.pipe(ws.streamPassThrough);\n promises.push(ws.streamPassThroughUploadPromise);\n\n console.log(`Successfully queued file \"${target.key}\"`);\n }\n\n return Promise.all(promises);\n}\n"],"mappings":";;;;;;AAAA;AAKO,eAAeA,iBAAiB,CAACC,OAAsB,EAAE;EAC5D,MAAMC,QAAQ,GAAG,EAAE;EACnB,KAAK,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,IAAIC,KAAK,CAACC,IAAI,CAACL,OAAO,CAACM,OAAO,EAAE,CAAC,EAAE;IAC1D;IACA,MAAMC,UAAU,GAAGC,kBAAQ,CAACD,UAAU,CAACL,MAAM,CAAC;IAE9C,MAAMO,EAAE,GAAGD,kBAAQ,CAACE,WAAW,CAACP,MAAM,CAACQ,GAAG,EAAER,MAAM,CAACS,IAAI,CAAC;IACxDL,UAAU,CAACM,IAAI,CAACJ,EAAE,CAACK,iBAAiB,CAAC;IACrCb,QAAQ,CAACc,IAAI,CAACN,EAAE,CAACO,8BAA8B,CAAC;IAEhDC,OAAO,CAACC,GAAG,CAAE,6BAA4Bf,MAAM,CAACQ,GAAI,GAAE,CAAC;EAC3D;EAEA,OAAOQ,OAAO,CAACC,GAAG,CAACnB,QAAQ,CAAC;AAChC"}
package/mockSecurity.js CHANGED
@@ -4,10 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.mockSecurity = void 0;
7
-
8
7
  const mockSecurity = (identity, context) => {
9
8
  context.security.disableAuthorization();
10
9
  context.security.setIdentity(identity);
11
10
  };
12
-
13
11
  exports.mockSecurity = mockSecurity;
@@ -1 +1 @@
1
- {"version":3,"names":["mockSecurity","identity","context","security","disableAuthorization","setIdentity"],"sources":["mockSecurity.ts"],"sourcesContent":["import { SecurityContext, SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport const mockSecurity = (identity: SecurityIdentity, context: SecurityContext) => {\n context.security.disableAuthorization();\n context.security.setIdentity(identity);\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,YAAY,GAAG,CAACC,QAAD,EAA6BC,OAA7B,KAA0D;EAClFA,OAAO,CAACC,QAAR,CAAiBC,oBAAjB;EACAF,OAAO,CAACC,QAAR,CAAiBE,WAAjB,CAA6BJ,QAA7B;AACH,CAHM"}
1
+ {"version":3,"names":["mockSecurity","identity","context","security","disableAuthorization","setIdentity"],"sources":["mockSecurity.ts"],"sourcesContent":["import { SecurityContext, SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport const mockSecurity = (identity: SecurityIdentity, context: SecurityContext) => {\n context.security.disableAuthorization();\n context.security.setIdentity(identity);\n};\n"],"mappings":";;;;;;AAEO,MAAMA,YAAY,GAAG,CAACC,QAA0B,EAAEC,OAAwB,KAAK;EAClFA,OAAO,CAACC,QAAQ,CAACC,oBAAoB,EAAE;EACvCF,OAAO,CAACC,QAAQ,CAACE,WAAW,CAACJ,QAAQ,CAAC;AAC1C,CAAC;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-page-builder-import-export",
3
- "version": "5.34.8-beta.1",
3
+ "version": "5.35.0-beta.0",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "pbie:base"
@@ -14,18 +14,19 @@
14
14
  "author": "Webiny Ltd",
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@babel/runtime": "7.19.0",
17
+ "@babel/runtime": "7.20.13",
18
18
  "@commodo/fields": "1.1.2-beta.20",
19
- "@webiny/api": "5.34.8-beta.1",
20
- "@webiny/api-file-manager": "5.34.8-beta.1",
21
- "@webiny/api-page-builder": "5.34.8-beta.1",
22
- "@webiny/api-security": "5.34.8-beta.1",
23
- "@webiny/error": "5.34.8-beta.1",
24
- "@webiny/handler": "5.34.8-beta.1",
25
- "@webiny/handler-aws": "5.34.8-beta.1",
26
- "@webiny/handler-graphql": "5.34.8-beta.1",
27
- "@webiny/utils": "5.34.8-beta.1",
28
- "@webiny/validation": "5.34.8-beta.1",
19
+ "@webiny/api": "5.35.0-beta.0",
20
+ "@webiny/api-file-manager": "5.35.0-beta.0",
21
+ "@webiny/api-form-builder": "5.35.0-beta.0",
22
+ "@webiny/api-page-builder": "5.35.0-beta.0",
23
+ "@webiny/api-security": "5.35.0-beta.0",
24
+ "@webiny/error": "5.35.0-beta.0",
25
+ "@webiny/handler": "5.35.0-beta.0",
26
+ "@webiny/handler-aws": "5.35.0-beta.0",
27
+ "@webiny/handler-graphql": "5.35.0-beta.0",
28
+ "@webiny/utils": "5.35.0-beta.0",
29
+ "@webiny/validation": "5.35.0-beta.0",
29
30
  "archiver": "5.3.1",
30
31
  "commodo-fields-object": "1.0.6",
31
32
  "dot-prop-immutable": "2.1.1",
@@ -33,7 +34,7 @@
33
34
  "load-json-file": "6.2.0",
34
35
  "lodash": "4.17.21",
35
36
  "mdbid": "1.0.0",
36
- "node-fetch": "2.6.7",
37
+ "node-fetch": "2.6.9",
37
38
  "stream": "0.0.2",
38
39
  "uniqid": "5.4.0",
39
40
  "yauzl": "2.10.0"
@@ -47,16 +48,16 @@
47
48
  "@types/archiver": "^5.3.1",
48
49
  "@types/node-fetch": "^2.6.1",
49
50
  "@types/yauzl": "^2.9.2",
50
- "@webiny/api-dynamodb-to-elasticsearch": "^5.34.8-beta.1",
51
- "@webiny/api-file-manager-ddb-es": "^5.34.8-beta.1",
52
- "@webiny/api-i18n-ddb": "^5.34.8-beta.1",
53
- "@webiny/api-security-so-ddb": "^5.34.8-beta.1",
54
- "@webiny/api-tenancy": "^5.34.8-beta.1",
55
- "@webiny/api-tenancy-so-ddb": "^5.34.8-beta.1",
56
- "@webiny/api-wcp": "^5.34.8-beta.1",
57
- "@webiny/cli": "^5.34.8-beta.1",
58
- "@webiny/db": "^5.34.8-beta.1",
59
- "@webiny/project-utils": "^5.34.8-beta.1",
51
+ "@webiny/api-dynamodb-to-elasticsearch": "^5.35.0-beta.0",
52
+ "@webiny/api-file-manager-ddb-es": "^5.35.0-beta.0",
53
+ "@webiny/api-i18n-ddb": "^5.35.0-beta.0",
54
+ "@webiny/api-security-so-ddb": "^5.35.0-beta.0",
55
+ "@webiny/api-tenancy": "^5.35.0-beta.0",
56
+ "@webiny/api-tenancy-so-ddb": "^5.35.0-beta.0",
57
+ "@webiny/api-wcp": "^5.35.0-beta.0",
58
+ "@webiny/cli": "^5.35.0-beta.0",
59
+ "@webiny/db": "^5.35.0-beta.0",
60
+ "@webiny/project-utils": "^5.35.0-beta.0",
60
61
  "jest": "^28.1.0",
61
62
  "jest-dynalite": "^3.2.0",
62
63
  "rimraf": "^3.0.2",
@@ -78,5 +79,5 @@
78
79
  ]
79
80
  }
80
81
  },
81
- "gitHead": "6e77eebaac687279fe82ea04f667b7e84214b96a"
82
+ "gitHead": "8acc9e8892842cabb3980ce0b6432fde55968d5b"
82
83
  }
package/types.d.ts CHANGED
@@ -188,3 +188,24 @@ export interface ImportExportTaskStorageOperations {
188
188
  createSubTask(params: ImportExportTaskStorageOperationsCreateSubTaskParams): Promise<ImportExportTask>;
189
189
  updateSubTask(params: ImportExportTaskStorageOperationsUpdateSubTaskParams): Promise<ImportExportTask>;
190
190
  }
191
+ export interface FileUploadsData {
192
+ /**
193
+ * Location of export data file. Export data contains the relevant entity data (block, page, template), and an
194
+ * array of file objects, exported from the DB, that need to be imported.
195
+ *
196
+ * Example:
197
+ * 'IMPORTS/8lf6y7xp5/8lf6x9v68-header-1/8lf6x9v69-header-1/Header #1.json'
198
+ */
199
+ data: string;
200
+ /**
201
+ * Example:
202
+ * '8ldspraka-9l9iaffak-1.jpeg': 'IMPORTS/8lf6y7xp5/8lf6x9v68-header-1/assets/8ldspraka-9l9iaffak-1.jpeg',
203
+ * '8ldwyq8ao-pb-editor-page-element-rzfKWtdTWN.png': 'IMPORTS/8lf6y7xp5/8lf6x9v69-header-1/assets/8ldwyq8ao-pb-editor-page-element-rzfKWtdTWN.png'
204
+ */
205
+ assets: Record<string, string>;
206
+ }
207
+ export interface ImportData {
208
+ assets: Record<string, string>;
209
+ data: string;
210
+ key: string;
211
+ }
package/types.js CHANGED
@@ -8,9 +8,7 @@ var _exportNames = {
8
8
  ImportExportTaskStatus: true
9
9
  };
10
10
  exports.ImportExportTaskStatus = exports.ExportRevisionType = void 0;
11
-
12
11
  var _types = require("./graphql/types");
13
-
14
12
  Object.keys(_types).forEach(function (key) {
15
13
  if (key === "default" || key === "__esModule") return;
16
14
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -25,15 +23,12 @@ Object.keys(_types).forEach(function (key) {
25
23
  // Entities.
26
24
  let ExportRevisionType;
27
25
  exports.ExportRevisionType = ExportRevisionType;
28
-
29
26
  (function (ExportRevisionType) {
30
27
  ExportRevisionType["PUBLISHED"] = "published";
31
28
  ExportRevisionType["LATEST"] = "latest";
32
29
  })(ExportRevisionType || (exports.ExportRevisionType = ExportRevisionType = {}));
33
-
34
30
  let ImportExportTaskStatus;
35
31
  exports.ImportExportTaskStatus = ImportExportTaskStatus;
36
-
37
32
  (function (ImportExportTaskStatus) {
38
33
  ImportExportTaskStatus["PENDING"] = "pending";
39
34
  ImportExportTaskStatus["PROCESSING"] = "processing";
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["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"],"mappings":";;;;;;;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEA;IACYA,kB;;;WAAAA,kB;EAAAA,kB;EAAAA,kB;GAAAA,kB,kCAAAA,kB;;IAKAC,sB;;;WAAAA,sB;EAAAA,sB;EAAAA,sB;EAAAA,sB;EAAAA,sB;GAAAA,sB,sCAAAA,sB"}
1
+ {"version":3,"names":["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;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEA;AAAA,IACYA,kBAAkB;AAAA;AAAA,WAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;AAAA,GAAlBA,kBAAkB,kCAAlBA,kBAAkB;AAAA,IAKlBC,sBAAsB;AAAA;AAAA,WAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;AAAA,GAAtBA,sBAAsB,sCAAtBA,sBAAsB"}