@webiny/api-page-builder-import-export 0.0.0-unstable.990c3ab1b6 → 0.0.0-unstable.99666aeb00
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.ts +2 -2
- package/client.js.map +1 -1
- package/export/combine/blocksHandler.d.ts +6 -0
- package/export/combine/blocksHandler.js +99 -0
- package/export/combine/blocksHandler.js.map +1 -0
- package/export/combine/formsHandler.d.ts +6 -0
- package/export/combine/formsHandler.js +99 -0
- package/export/combine/formsHandler.js.map +1 -0
- package/{exportPages → export}/combine/index.d.ts +3 -2
- package/export/combine/index.js +42 -0
- package/export/combine/index.js.map +1 -0
- package/export/combine/pagesHandler.d.ts +6 -0
- package/export/combine/pagesHandler.js +99 -0
- package/export/combine/pagesHandler.js.map +1 -0
- package/export/combine/templatesHandler.d.ts +6 -0
- package/export/combine/templatesHandler.js +99 -0
- package/export/combine/templatesHandler.js.map +1 -0
- package/export/process/blocksHandler.d.ts +6 -0
- package/export/process/blocksHandler.js +162 -0
- package/export/process/blocksHandler.js.map +1 -0
- package/export/process/formsHandler.d.ts +6 -0
- package/export/process/formsHandler.js +187 -0
- package/export/process/formsHandler.js.map +1 -0
- package/{exportPages → export}/process/index.d.ts +4 -6
- package/export/process/index.js +39 -0
- package/export/process/index.js.map +1 -0
- package/export/process/pagesHandler.d.ts +6 -0
- package/export/process/pagesHandler.js +189 -0
- package/export/process/pagesHandler.js.map +1 -0
- package/export/process/templatesHandler.d.ts +6 -0
- package/export/process/templatesHandler.js +166 -0
- package/export/process/templatesHandler.js.map +1 -0
- package/{exportPages → export}/s3Stream.d.ts +5 -2
- package/export/s3Stream.js.map +1 -0
- package/export/utils.d.ts +29 -0
- package/export/utils.js +194 -0
- package/export/utils.js.map +1 -0
- package/{exportPages → export}/zipper.d.ts +6 -5
- package/{exportPages → export}/zipper.js +9 -8
- package/export/zipper.js.map +1 -0
- package/graphql/crud/blocks.crud.d.ts +4 -0
- package/graphql/crud/blocks.crud.js +140 -0
- package/graphql/crud/blocks.crud.js.map +1 -0
- package/graphql/crud/forms.crud.d.ts +4 -0
- package/graphql/crud/forms.crud.js +134 -0
- package/graphql/crud/forms.crud.js.map +1 -0
- package/graphql/crud/importExportTasks.crud.d.ts +5 -0
- package/graphql/crud/{pageImportExportTasks.crud.js → importExportTasks.crud.js} +83 -79
- package/graphql/crud/importExportTasks.crud.js.map +1 -0
- package/graphql/crud/pages.crud.d.ts +2 -2
- package/graphql/crud/pages.crud.js +26 -18
- package/graphql/crud/pages.crud.js.map +1 -1
- package/graphql/crud/templates.crud.d.ts +4 -0
- package/graphql/crud/templates.crud.js +128 -0
- package/graphql/crud/templates.crud.js.map +1 -0
- package/graphql/crud.d.ts +2 -2
- package/graphql/crud.js +5 -2
- package/graphql/crud.js.map +1 -1
- package/graphql/graphql/blocks.gql.d.ts +4 -0
- package/graphql/graphql/blocks.gql.js +52 -0
- package/graphql/graphql/blocks.gql.js.map +1 -0
- package/graphql/graphql/forms.gql.d.ts +4 -0
- package/graphql/graphql/forms.gql.js +60 -0
- package/graphql/graphql/forms.gql.js.map +1 -0
- package/graphql/graphql/importExportTasks.gql.d.ts +4 -0
- package/graphql/graphql/{pageImportExportTasks.gql.js → importExportTasks.gql.js} +17 -17
- package/graphql/graphql/importExportTasks.gql.js.map +1 -0
- package/graphql/graphql/pages.gql.d.ts +2 -2
- package/graphql/graphql/pages.gql.js +3 -9
- package/graphql/graphql/pages.gql.js.map +1 -1
- package/graphql/graphql/templates.gql.d.ts +4 -0
- package/graphql/graphql/templates.gql.js +52 -0
- package/graphql/graphql/templates.gql.js.map +1 -0
- package/graphql/graphql/utils/resolve.d.ts +1 -1
- package/graphql/graphql.js +5 -2
- package/graphql/graphql.js.map +1 -1
- package/graphql/index.d.ts +2 -2
- package/graphql/index.js.map +1 -1
- package/graphql/types.d.ts +83 -23
- package/graphql/types.js.map +1 -1
- package/import/constants.d.ts +3 -0
- package/import/constants.js +14 -0
- package/import/constants.js.map +1 -0
- package/import/create/blocksHandler.d.ts +3 -0
- package/import/create/blocksHandler.js +101 -0
- package/import/create/blocksHandler.js.map +1 -0
- package/import/create/formsHandler.d.ts +3 -0
- package/import/create/formsHandler.js +103 -0
- package/import/create/formsHandler.js.map +1 -0
- package/{importPages → import}/create/index.d.ts +7 -5
- package/import/create/index.js +42 -0
- package/import/create/index.js.map +1 -0
- package/import/create/pagesHandler.d.ts +3 -0
- package/import/create/pagesHandler.js +103 -0
- package/import/create/pagesHandler.js.map +1 -0
- package/import/create/templatesHandler.d.ts +3 -0
- package/import/create/templatesHandler.js +99 -0
- package/import/create/templatesHandler.js.map +1 -0
- package/import/process/blocks/blocksHandler.d.ts +3 -0
- package/import/process/blocks/blocksHandler.js +169 -0
- package/import/process/blocks/blocksHandler.js.map +1 -0
- package/import/process/blocks/importBlock.d.ts +11 -0
- package/import/process/blocks/importBlock.js +92 -0
- package/import/process/blocks/importBlock.js.map +1 -0
- package/import/process/forms/formsHandler.d.ts +3 -0
- package/import/process/forms/formsHandler.js +176 -0
- package/import/process/forms/formsHandler.js.map +1 -0
- package/import/process/forms/importForm.d.ts +9 -0
- package/import/process/forms/importForm.js +43 -0
- package/import/process/forms/importForm.js.map +1 -0
- package/{importPages → import}/process/index.d.ts +5 -3
- package/import/process/index.js +39 -0
- package/import/process/index.js.map +1 -0
- package/import/process/pages/importPage.d.ts +11 -0
- package/import/process/pages/importPage.js +92 -0
- package/import/process/pages/importPage.js.map +1 -0
- package/import/process/pages/pagesHandler.d.ts +3 -0
- package/import/process/pages/pagesHandler.js +183 -0
- package/import/process/pages/pagesHandler.js.map +1 -0
- package/import/process/templates/importTemplate.d.ts +11 -0
- package/import/process/templates/importTemplate.js +66 -0
- package/import/process/templates/importTemplate.js.map +1 -0
- package/import/process/templates/templatesHandler.d.ts +3 -0
- package/import/process/templates/templatesHandler.js +170 -0
- package/import/process/templates/templatesHandler.js.map +1 -0
- package/import/utils/deleteS3Folder.d.ts +1 -0
- package/import/utils/deleteS3Folder.js +19 -0
- package/import/utils/deleteS3Folder.js.map +1 -0
- package/import/utils/extractAndUploadZipFileContents.d.ts +7 -0
- package/import/utils/extractAndUploadZipFileContents.js +122 -0
- package/import/utils/extractAndUploadZipFileContents.js.map +1 -0
- package/import/utils/extractZipAndUploadToS3.d.ts +2 -0
- package/import/utils/extractZipAndUploadToS3.js +98 -0
- package/import/utils/extractZipAndUploadToS3.js.map +1 -0
- package/import/utils/getFileNameWithoutExt.d.ts +1 -0
- package/import/utils/getFileNameWithoutExt.js +11 -0
- package/import/utils/getFileNameWithoutExt.js.map +1 -0
- package/import/utils/index.d.ts +9 -0
- package/import/utils/index.js +104 -0
- package/import/utils/index.js.map +1 -0
- package/import/utils/initialStats.d.ts +7 -0
- package/import/utils/initialStats.js +16 -0
- package/import/utils/initialStats.js.map +1 -0
- package/import/utils/prepareDataDirMap.d.ts +6 -0
- package/import/utils/prepareDataDirMap.js +29 -0
- package/import/utils/prepareDataDirMap.js.map +1 -0
- package/import/utils/updateFilesInData.d.ts +8 -0
- package/import/utils/updateFilesInData.js +48 -0
- package/import/utils/updateFilesInData.js.map +1 -0
- package/import/utils/uploadAssets.d.ts +10 -0
- package/import/utils/uploadAssets.js +49 -0
- package/import/utils/uploadAssets.js.map +1 -0
- package/import/utils/uploadFilesFromS3.d.ts +3 -0
- package/import/utils/uploadFilesFromS3.js +19 -0
- package/import/utils/uploadFilesFromS3.js.map +1 -0
- package/mockSecurity.js +0 -1
- package/mockSecurity.js.map +1 -1
- package/package.json +34 -37
- package/types.d.ts +83 -65
- package/types.js +17 -17
- package/types.js.map +1 -1
- package/exportPages/combine/index.js +0 -106
- package/exportPages/combine/index.js.map +0 -1
- package/exportPages/process/index.js +0 -192
- package/exportPages/process/index.js.map +0 -1
- package/exportPages/s3Stream.js.map +0 -1
- package/exportPages/utils.d.ts +0 -13
- package/exportPages/utils.js +0 -100
- package/exportPages/utils.js.map +0 -1
- package/exportPages/zipper.js.map +0 -1
- package/graphql/crud/pageImportExportTasks.crud.d.ts +0 -5
- package/graphql/crud/pageImportExportTasks.crud.js.map +0 -1
- package/graphql/graphql/pageImportExportTasks.gql.d.ts +0 -4
- package/graphql/graphql/pageImportExportTasks.gql.js.map +0 -1
- package/importPages/create/index.js +0 -107
- package/importPages/create/index.js.map +0 -1
- package/importPages/process/index.js +0 -180
- package/importPages/process/index.js.map +0 -1
- package/importPages/utils.d.ts +0 -50
- package/importPages/utils.js +0 -488
- package/importPages/utils.js.map +0 -1
- /package/{exportPages → export}/s3Stream.js +0 -0
@@ -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,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,49 @@
|
|
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 _utils = require("@webiny/utils");
|
10
|
+
var _uploadFilesFromS = require("./uploadFilesFromS3");
|
11
|
+
const uploadAssets = async params => {
|
12
|
+
const {
|
13
|
+
context,
|
14
|
+
files,
|
15
|
+
fileUploadsData
|
16
|
+
} = params;
|
17
|
+
const oldIdToNewFileMap = new Map();
|
18
|
+
|
19
|
+
/**
|
20
|
+
* This function contains logic of file download from S3.
|
21
|
+
* Current we're not mocking zip file download from S3 in tests at the moment.
|
22
|
+
* So, we're manually mocking it in case of test just by returning an empty object.
|
23
|
+
*/
|
24
|
+
if (process.env.NODE_ENV === "test") {
|
25
|
+
return oldIdToNewFileMap;
|
26
|
+
}
|
27
|
+
|
28
|
+
// A map of temporary file keys (created during ZIP upload) to permanent file keys.
|
29
|
+
const uploadFileMap = new Map();
|
30
|
+
|
31
|
+
// Array of file inputs, to insert into the DB.
|
32
|
+
const createFilesInput = [];
|
33
|
+
for (const oldFile of files) {
|
34
|
+
const id = (0, _utils.mdbid)();
|
35
|
+
// We replace the old file ID with a new one.
|
36
|
+
const newKey = `${id}/${oldFile.key.replace(`${oldFile.id}/`, "")}`;
|
37
|
+
const newFile = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, oldFile), {}, {
|
38
|
+
id,
|
39
|
+
key: newKey
|
40
|
+
});
|
41
|
+
createFilesInput.push(newFile);
|
42
|
+
oldIdToNewFileMap.set(oldFile.id, newFile);
|
43
|
+
uploadFileMap.set(fileUploadsData.assets[oldFile.key], newFile);
|
44
|
+
}
|
45
|
+
await (0, _uploadFilesFromS.uploadFilesFromS3)(uploadFileMap);
|
46
|
+
await context.fileManager.createFilesInBatch(createFilesInput);
|
47
|
+
return oldIdToNewFileMap;
|
48
|
+
};
|
49
|
+
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":["import { mdbid } from \"@webiny/utils\";\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":";;;;;;;;AAAA;AAGA;AASO,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,YAAK,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,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
package/mockSecurity.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["mockSecurity","identity","context","security","
|
1
|
+
{"version":3,"names":["mockSecurity","identity","context","security","setIdentity"],"sources":["mockSecurity.ts"],"sourcesContent":["import { SecurityContext, SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport const mockSecurity = (identity: SecurityIdentity, context: SecurityContext) => {\n context.security.setIdentity(identity);\n};\n"],"mappings":";;;;;;AAEO,MAAMA,YAAY,GAAG,CAACC,QAA0B,EAAEC,OAAwB,KAAK;EAClFA,OAAO,CAACC,QAAQ,CAACC,WAAW,CAACH,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": "0.0.0-unstable.
|
3
|
+
"version": "0.0.0-unstable.99666aeb00",
|
4
4
|
"main": "index.js",
|
5
5
|
"keywords": [
|
6
6
|
"pbie:base"
|
@@ -14,53 +14,50 @@
|
|
14
14
|
"author": "Webiny Ltd",
|
15
15
|
"license": "MIT",
|
16
16
|
"dependencies": {
|
17
|
-
"@babel/runtime": "7.20.
|
17
|
+
"@babel/runtime": "7.20.13",
|
18
18
|
"@commodo/fields": "1.1.2-beta.20",
|
19
|
-
"@webiny/api": "0.0.0-unstable.
|
20
|
-
"@webiny/api-file-manager": "0.0.0-unstable.
|
21
|
-
"@webiny/api-
|
22
|
-
"@webiny/api-
|
23
|
-
"@webiny/
|
24
|
-
"@webiny/
|
25
|
-
"@webiny/handler
|
26
|
-
"@webiny/handler-
|
27
|
-
"@webiny/
|
28
|
-
"@webiny/
|
19
|
+
"@webiny/api": "0.0.0-unstable.99666aeb00",
|
20
|
+
"@webiny/api-file-manager": "0.0.0-unstable.99666aeb00",
|
21
|
+
"@webiny/api-form-builder": "0.0.0-unstable.99666aeb00",
|
22
|
+
"@webiny/api-page-builder": "0.0.0-unstable.99666aeb00",
|
23
|
+
"@webiny/api-security": "0.0.0-unstable.99666aeb00",
|
24
|
+
"@webiny/error": "0.0.0-unstable.99666aeb00",
|
25
|
+
"@webiny/handler": "0.0.0-unstable.99666aeb00",
|
26
|
+
"@webiny/handler-aws": "0.0.0-unstable.99666aeb00",
|
27
|
+
"@webiny/handler-graphql": "0.0.0-unstable.99666aeb00",
|
28
|
+
"@webiny/utils": "0.0.0-unstable.99666aeb00",
|
29
|
+
"@webiny/validation": "0.0.0-unstable.99666aeb00",
|
29
30
|
"archiver": "5.3.1",
|
30
31
|
"commodo-fields-object": "1.0.6",
|
31
32
|
"dot-prop-immutable": "2.1.1",
|
32
33
|
"fs-extra": "9.1.0",
|
33
34
|
"load-json-file": "6.2.0",
|
34
35
|
"lodash": "4.17.21",
|
35
|
-
"
|
36
|
-
"node-fetch": "2.6.7",
|
36
|
+
"node-fetch": "2.6.9",
|
37
37
|
"stream": "0.0.2",
|
38
38
|
"uniqid": "5.4.0",
|
39
39
|
"yauzl": "2.10.0"
|
40
40
|
},
|
41
41
|
"devDependencies": {
|
42
|
-
"@babel/cli": "
|
43
|
-
"@babel/core": "
|
44
|
-
"@babel/plugin-proposal-export-default-from": "
|
45
|
-
"@babel/preset-env": "
|
46
|
-
"@babel/preset-typescript": "
|
47
|
-
"@types/archiver": "
|
48
|
-
"@types/node-fetch": "
|
49
|
-
"@types/yauzl": "
|
50
|
-
"@webiny/api-
|
51
|
-
"@webiny/api-
|
52
|
-
"@webiny/api-
|
53
|
-
"@webiny/api-
|
54
|
-
"@webiny/
|
55
|
-
"@webiny/
|
56
|
-
"@webiny/
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
61
|
-
"jest-dynalite": "^3.2.0",
|
62
|
-
"rimraf": "^3.0.2",
|
63
|
-
"ttypescript": "^1.5.12",
|
42
|
+
"@babel/cli": "7.20.7",
|
43
|
+
"@babel/core": "7.20.12",
|
44
|
+
"@babel/plugin-proposal-export-default-from": "7.18.10",
|
45
|
+
"@babel/preset-env": "7.20.2",
|
46
|
+
"@babel/preset-typescript": "7.18.6",
|
47
|
+
"@types/archiver": "5.3.1",
|
48
|
+
"@types/node-fetch": "2.6.2",
|
49
|
+
"@types/yauzl": "2.10.0",
|
50
|
+
"@webiny/api-authentication": "0.0.0-unstable.99666aeb00",
|
51
|
+
"@webiny/api-dynamodb-to-elasticsearch": "0.0.0-unstable.99666aeb00",
|
52
|
+
"@webiny/api-tenancy": "0.0.0-unstable.99666aeb00",
|
53
|
+
"@webiny/api-wcp": "0.0.0-unstable.99666aeb00",
|
54
|
+
"@webiny/cli": "0.0.0-unstable.99666aeb00",
|
55
|
+
"@webiny/db": "0.0.0-unstable.99666aeb00",
|
56
|
+
"@webiny/project-utils": "0.0.0-unstable.99666aeb00",
|
57
|
+
"jest": "29.5.0",
|
58
|
+
"jest-dynalite": "3.6.1",
|
59
|
+
"rimraf": "3.0.2",
|
60
|
+
"ttypescript": "1.5.15",
|
64
61
|
"typescript": "4.7.4"
|
65
62
|
},
|
66
63
|
"publishConfig": {
|
@@ -78,5 +75,5 @@
|
|
78
75
|
]
|
79
76
|
}
|
80
77
|
},
|
81
|
-
"gitHead": "
|
78
|
+
"gitHead": "99666aeb00056c56292eeb5dbb6aba7fda2439e2"
|
82
79
|
}
|
package/types.d.ts
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
export * from "./graphql/types";
|
2
|
-
export declare enum
|
2
|
+
export declare enum ExportRevisionType {
|
3
3
|
PUBLISHED = "published",
|
4
4
|
LATEST = "latest"
|
5
5
|
}
|
6
|
-
export declare enum
|
6
|
+
export declare enum ImportExportTaskStatus {
|
7
7
|
PENDING = "pending",
|
8
8
|
PROCESSING = "processing",
|
9
9
|
COMPLETED = "completed",
|
10
10
|
FAILED = "failed"
|
11
11
|
}
|
12
|
-
export interface
|
13
|
-
[
|
14
|
-
[
|
15
|
-
[
|
16
|
-
[
|
12
|
+
export interface ImportExportTaskStats {
|
13
|
+
[ImportExportTaskStatus.PENDING]: number;
|
14
|
+
[ImportExportTaskStatus.PROCESSING]: number;
|
15
|
+
[ImportExportTaskStatus.COMPLETED]: number;
|
16
|
+
[ImportExportTaskStatus.FAILED]: number;
|
17
17
|
total: number;
|
18
18
|
}
|
19
19
|
interface CreatedBy {
|
@@ -21,12 +21,12 @@ interface CreatedBy {
|
|
21
21
|
type: string;
|
22
22
|
displayName: string | null;
|
23
23
|
}
|
24
|
-
export interface
|
24
|
+
export interface ImportExportTask {
|
25
25
|
id: string;
|
26
26
|
parent: string;
|
27
|
-
status:
|
27
|
+
status: ImportExportTaskStatus;
|
28
28
|
data: Record<string, any>;
|
29
|
-
stats:
|
29
|
+
stats: ImportExportTaskStats;
|
30
30
|
error: Record<string, any>;
|
31
31
|
input: Record<string, any>;
|
32
32
|
createdOn: string;
|
@@ -45,9 +45,9 @@ export interface MetaResponse {
|
|
45
45
|
}
|
46
46
|
/**
|
47
47
|
* @category StorageOperations
|
48
|
-
* @category
|
48
|
+
* @category ImportExportTaskStorageOperations
|
49
49
|
*/
|
50
|
-
export interface
|
50
|
+
export interface ImportExportTaskStorageOperationsGetParams {
|
51
51
|
where: {
|
52
52
|
id: string;
|
53
53
|
tenant: string;
|
@@ -56,9 +56,9 @@ export interface PageImportExportTaskStorageOperationsGetParams {
|
|
56
56
|
}
|
57
57
|
/**
|
58
58
|
* @category StorageOperations
|
59
|
-
* @category
|
59
|
+
* @category ImportExportTaskStorageOperations
|
60
60
|
*/
|
61
|
-
export interface
|
61
|
+
export interface ImportExportTaskStorageOperationsListParams {
|
62
62
|
where: {
|
63
63
|
tenant: string;
|
64
64
|
locale: string;
|
@@ -69,41 +69,38 @@ export interface PageImportExportTaskStorageOperationsListParams {
|
|
69
69
|
}
|
70
70
|
/**
|
71
71
|
* @category StorageOperations
|
72
|
-
* @category
|
72
|
+
* @category ImportExportTaskStorageOperations
|
73
73
|
*/
|
74
|
-
export declare type
|
75
|
-
PageImportExportTask[],
|
76
|
-
MetaResponse
|
77
|
-
];
|
74
|
+
export declare type ImportExportTaskStorageOperationsListResponse = [ImportExportTask[], MetaResponse];
|
78
75
|
/**
|
79
76
|
* @category StorageOperations
|
80
|
-
* @category
|
77
|
+
* @category ImportExportTaskStorageOperations
|
81
78
|
*/
|
82
|
-
export interface
|
79
|
+
export interface ImportExportTaskStorageOperationsCreateParams {
|
83
80
|
input: Record<string, any>;
|
84
|
-
task:
|
81
|
+
task: ImportExportTask;
|
85
82
|
}
|
86
83
|
/**
|
87
84
|
* @category StorageOperations
|
88
|
-
* @category
|
85
|
+
* @category ImportExportTaskStorageOperations
|
89
86
|
*/
|
90
|
-
export interface
|
87
|
+
export interface ImportExportTaskStorageOperationsUpdateParams {
|
91
88
|
input: Record<string, any>;
|
92
|
-
original:
|
93
|
-
task:
|
89
|
+
original: ImportExportTask;
|
90
|
+
task: ImportExportTask;
|
94
91
|
}
|
95
92
|
/**
|
96
93
|
* @category StorageOperations
|
97
|
-
* @category
|
94
|
+
* @category ImportExportTaskStorageOperations
|
98
95
|
*/
|
99
|
-
export interface
|
100
|
-
task:
|
96
|
+
export interface ImportExportTaskStorageOperationsDeleteParams {
|
97
|
+
task: ImportExportTask;
|
101
98
|
}
|
102
99
|
/**
|
103
100
|
* @category StorageOperations
|
104
|
-
* @category
|
101
|
+
* @category ImportExportTaskStorageOperations
|
105
102
|
*/
|
106
|
-
export interface
|
103
|
+
export interface ImportExportTaskStorageOperationsGetSubTaskParams {
|
107
104
|
where: {
|
108
105
|
id: string;
|
109
106
|
parent: string;
|
@@ -113,14 +110,14 @@ export interface PageImportExportTaskStorageOperationsGetSubTaskParams {
|
|
113
110
|
}
|
114
111
|
/**
|
115
112
|
* @category StorageOperations
|
116
|
-
* @category
|
113
|
+
* @category ImportExportTaskStorageOperations
|
117
114
|
*/
|
118
|
-
export interface
|
115
|
+
export interface ImportExportTaskStorageOperationsListSubTaskParams {
|
119
116
|
where: {
|
120
117
|
tenant: string;
|
121
118
|
locale: string;
|
122
119
|
parent: string;
|
123
|
-
status:
|
120
|
+
status: ImportExportTaskStatus;
|
124
121
|
createdBy?: string;
|
125
122
|
};
|
126
123
|
sort?: string[];
|
@@ -129,65 +126,86 @@ export interface PageImportExportTaskStorageOperationsListSubTaskParams {
|
|
129
126
|
}
|
130
127
|
/**
|
131
128
|
* @category StorageOperations
|
132
|
-
* @category
|
129
|
+
* @category ImportExportTaskStorageOperations
|
133
130
|
*/
|
134
|
-
export declare type
|
135
|
-
|
131
|
+
export declare type ImportExportTaskStorageOperationsListSubTaskResponse = [
|
132
|
+
ImportExportTask[],
|
136
133
|
MetaResponse
|
137
134
|
];
|
138
135
|
/**
|
139
136
|
* @category StorageOperations
|
140
|
-
* @category
|
137
|
+
* @category ImportExportTaskStorageOperations
|
141
138
|
*/
|
142
|
-
export interface
|
139
|
+
export interface ImportExportTaskStorageOperationsCreateSubTaskParams {
|
143
140
|
input: Record<string, any>;
|
144
|
-
subTask:
|
141
|
+
subTask: ImportExportTask;
|
145
142
|
}
|
146
143
|
/**
|
147
144
|
* @category StorageOperations
|
148
|
-
* @category
|
145
|
+
* @category ImportExportTaskStorageOperations
|
149
146
|
*/
|
150
|
-
export interface
|
147
|
+
export interface ImportExportTaskStorageOperationsUpdateSubTaskParams {
|
151
148
|
input: Record<string, any>;
|
152
|
-
original:
|
153
|
-
subTask:
|
149
|
+
original: ImportExportTask;
|
150
|
+
subTask: ImportExportTask;
|
154
151
|
}
|
155
152
|
/**
|
156
153
|
* @category StorageOperations
|
157
|
-
* @category
|
154
|
+
* @category ImportExportTaskStorageOperations
|
158
155
|
*/
|
159
|
-
export interface
|
156
|
+
export interface ImportExportTaskStorageOperationsUpdateTaskStatsParams {
|
160
157
|
input: {
|
161
|
-
prevStatus:
|
162
|
-
nextStatus:
|
158
|
+
prevStatus: ImportExportTaskStatus;
|
159
|
+
nextStatus: ImportExportTaskStatus;
|
163
160
|
};
|
164
|
-
original:
|
161
|
+
original: ImportExportTask;
|
165
162
|
}
|
166
163
|
/**
|
167
164
|
* @category StorageOperations
|
168
|
-
* @category
|
165
|
+
* @category ImportExportTaskStorageOperations
|
169
166
|
*/
|
170
|
-
export interface
|
167
|
+
export interface ImportExportTaskStorageOperations {
|
168
|
+
/**
|
169
|
+
* Get a single import export task item by given params.
|
170
|
+
*/
|
171
|
+
getTask(params: ImportExportTaskStorageOperationsGetParams): Promise<ImportExportTask | null>;
|
171
172
|
/**
|
172
|
-
* Get
|
173
|
+
* Get all import export tasks by given params.
|
173
174
|
*/
|
174
|
-
|
175
|
+
listTasks(params: ImportExportTaskStorageOperationsListParams): Promise<ImportExportTaskStorageOperationsListResponse>;
|
176
|
+
createTask(params: ImportExportTaskStorageOperationsCreateParams): Promise<ImportExportTask>;
|
177
|
+
updateTask(params: ImportExportTaskStorageOperationsUpdateParams): Promise<ImportExportTask>;
|
178
|
+
deleteTask(params: ImportExportTaskStorageOperationsDeleteParams): Promise<ImportExportTask>;
|
179
|
+
updateTaskStats(params: ImportExportTaskStorageOperationsUpdateTaskStatsParams): Promise<ImportExportTask>;
|
175
180
|
/**
|
176
|
-
* Get
|
181
|
+
* Get a single import export sub-task item by given params.
|
177
182
|
*/
|
178
|
-
|
179
|
-
createTask(params: PageImportExportTaskStorageOperationsCreateParams): Promise<PageImportExportTask>;
|
180
|
-
updateTask(params: PageImportExportTaskStorageOperationsUpdateParams): Promise<PageImportExportTask>;
|
181
|
-
deleteTask(params: PageImportExportTaskStorageOperationsDeleteParams): Promise<PageImportExportTask>;
|
182
|
-
updateTaskStats(params: PageImportExportTaskStorageOperationsUpdateTaskStatsParams): Promise<PageImportExportTask>;
|
183
|
+
getSubTask(params: ImportExportTaskStorageOperationsGetSubTaskParams): Promise<ImportExportTask | null>;
|
183
184
|
/**
|
184
|
-
* Get
|
185
|
+
* Get all import export sub-tasks by given params.
|
185
186
|
*/
|
186
|
-
|
187
|
+
listSubTasks(params: ImportExportTaskStorageOperationsListSubTaskParams): Promise<ImportExportTaskStorageOperationsListSubTaskResponse>;
|
188
|
+
createSubTask(params: ImportExportTaskStorageOperationsCreateSubTaskParams): Promise<ImportExportTask>;
|
189
|
+
updateSubTask(params: ImportExportTaskStorageOperationsUpdateSubTaskParams): Promise<ImportExportTask>;
|
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;
|
187
200
|
/**
|
188
|
-
*
|
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'
|
189
204
|
*/
|
190
|
-
|
191
|
-
|
192
|
-
|
205
|
+
assets: Record<string, string>;
|
206
|
+
}
|
207
|
+
export interface ImportData {
|
208
|
+
assets: Record<string, string>;
|
209
|
+
data: string;
|
210
|
+
key: string;
|
193
211
|
}
|