@webiny/api-page-builder-import-export 5.23.1 → 5.24.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.
- package/exportPages/process/index.js +5 -5
- package/exportPages/utils.d.ts +1 -1
- package/graphql/crud/pages.crud.js +5 -2
- package/graphql/graphql/utils/resolve.d.ts +1 -1
- package/importPages/create/index.js +3 -1
- package/importPages/process/index.js +3 -1
- package/importPages/utils.d.ts +3 -4
- package/importPages/utils.js +3 -6
- package/package.json +23 -20
@@ -7,16 +7,16 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _types = require("../../types");
|
9
9
|
|
10
|
-
var _utils = require("../../importPages/utils");
|
11
|
-
|
12
10
|
var _client = require("../../importPages/client");
|
13
11
|
|
14
12
|
var _handlerGraphql = require("@webiny/handler-graphql");
|
15
13
|
|
16
|
-
var
|
14
|
+
var _utils = require("../utils");
|
17
15
|
|
18
16
|
var _mockSecurity = require("../../mockSecurity");
|
19
17
|
|
18
|
+
var _utils2 = require("@webiny/utils");
|
19
|
+
|
20
20
|
/**
|
21
21
|
* Handles the export pages process workflow.
|
22
22
|
*/
|
@@ -48,7 +48,7 @@ var _default = configuration => ({
|
|
48
48
|
* Note: We're not going to DB for finding the next sub-task to process,
|
49
49
|
* because the data might be out of sync due to GSI eventual consistency.
|
50
50
|
*/
|
51
|
-
subTask = await pageBuilder.pageImportExportTask.getSubTask(taskId, (0,
|
51
|
+
subTask = await pageBuilder.pageImportExportTask.getSubTask(taskId, (0, _utils2.zeroPad)(subTaskIndex, 5));
|
52
52
|
/**
|
53
53
|
* Base condition!!
|
54
54
|
* Bail out early, if task not found or task's status is not "pending".
|
@@ -119,7 +119,7 @@ var _default = configuration => ({
|
|
119
119
|
prevStatusOfSubTask = subTask.status;
|
120
120
|
log(`Extracting page data and uploading to storage...`); // Extract Page
|
121
121
|
|
122
|
-
const pageDataZip = await (0,
|
122
|
+
const pageDataZip = await (0, _utils.exportPage)(page, exportPagesDataKey, fileManager);
|
123
123
|
log(`Finish uploading zip...`); // Update task record in DB
|
124
124
|
|
125
125
|
subTask = await pageBuilder.pageImportExportTask.updateSubTask(taskId, subTask.id, {
|
package/exportPages/utils.d.ts
CHANGED
@@ -7,7 +7,7 @@ export interface ExportedPageData {
|
|
7
7
|
files: ImageFile[];
|
8
8
|
}
|
9
9
|
export declare function exportPage(page: Page, exportPagesDataKey: string, fileManager: FileManagerContext["fileManager"]): Promise<S3.ManagedUpload.SendData>;
|
10
|
-
export interface ImageFile extends File {
|
10
|
+
export interface ImageFile extends Omit<File, "src"> {
|
11
11
|
key: string;
|
12
12
|
}
|
13
13
|
export declare function extractFilesFromPageData(data: Record<string, any>, files?: any[]): ImageFile[];
|
@@ -23,6 +23,8 @@ var _utils = require("../../importPages/utils");
|
|
23
23
|
|
24
24
|
var _utils2 = require("../../exportPages/utils");
|
25
25
|
|
26
|
+
var _utils3 = require("@webiny/utils");
|
27
|
+
|
26
28
|
const PERMISSION_NAME = "pb.page";
|
27
29
|
const EXPORT_PAGES_PROCESS_HANDLER = process.env.EXPORT_PAGES_PROCESS_HANDLER;
|
28
30
|
const IMPORT_PAGES_CREATE_HANDLER = process.env.IMPORT_PAGES_CREATE_HANDLER;
|
@@ -86,7 +88,8 @@ var _default = new _handler.ContextPlugin(context => {
|
|
86
88
|
let pages = [];
|
87
89
|
let meta = {
|
88
90
|
hasMoreItems: true,
|
89
|
-
cursor: null
|
91
|
+
cursor: null,
|
92
|
+
totalCount: 0
|
90
93
|
}; // Paginate pages
|
91
94
|
|
92
95
|
while (meta.hasMoreItems) {
|
@@ -114,7 +117,7 @@ var _default = new _handler.ContextPlugin(context => {
|
|
114
117
|
for (let i = 0; i < pageIds.length; i++) {
|
115
118
|
const pageId = pageIds[i]; // Create sub task.
|
116
119
|
|
117
|
-
await context.pageBuilder.pageImportExportTask.createSubTask(task.id, (0,
|
120
|
+
await context.pageBuilder.pageImportExportTask.createSubTask(task.id, (0, _utils3.zeroPad)(i + 1, 5), {
|
118
121
|
status: _types.PageImportExportTaskStatus.PENDING,
|
119
122
|
input: {
|
120
123
|
pageId,
|
@@ -13,6 +13,8 @@ var _client = require("../client");
|
|
13
13
|
|
14
14
|
var _mockSecurity = require("../../mockSecurity");
|
15
15
|
|
16
|
+
var _utils2 = require("@webiny/utils");
|
17
|
+
|
16
18
|
/**
|
17
19
|
* Handles the import page workflow.
|
18
20
|
*/
|
@@ -43,7 +45,7 @@ var _default = configuration => ({
|
|
43
45
|
for (let i = 0; i < pageImportDataList.length; i++) {
|
44
46
|
const pagesDirMap = pageImportDataList[i]; // Create sub task
|
45
47
|
|
46
|
-
const subtask = await pageBuilder.pageImportExportTask.createSubTask(task.id, (0,
|
48
|
+
const subtask = await pageBuilder.pageImportExportTask.createSubTask(task.id, (0, _utils2.zeroPad)(i + 1, 5), {
|
47
49
|
status: _types.PageImportExportTaskStatus.PENDING,
|
48
50
|
data: {
|
49
51
|
pageKey: pagesDirMap.key,
|
@@ -13,6 +13,8 @@ var _client = require("../client");
|
|
13
13
|
|
14
14
|
var _mockSecurity = require("../../mockSecurity");
|
15
15
|
|
16
|
+
var _utils2 = require("@webiny/utils");
|
17
|
+
|
16
18
|
/**
|
17
19
|
* Handles the import page workflow.
|
18
20
|
*/
|
@@ -43,7 +45,7 @@ var _default = configuration => ({
|
|
43
45
|
* Note: We're not going to DB for getting next sub-task to process,
|
44
46
|
* because the data might be out of sync due to GSI eventual consistency.
|
45
47
|
*/
|
46
|
-
subTask = await pageBuilder.pageImportExportTask.getSubTask(taskId, (0,
|
48
|
+
subTask = await pageBuilder.pageImportExportTask.getSubTask(taskId, (0, _utils2.zeroPad)(subTaskIndex, 5));
|
47
49
|
/**
|
48
50
|
* Base condition!!
|
49
51
|
* Bail out early, if task not found or task's status is not "pending".
|
package/importPages/utils.d.ts
CHANGED
@@ -32,12 +32,11 @@ interface PageImportData {
|
|
32
32
|
* @return PageImportData S3 file keys for all uploaded assets group by page.
|
33
33
|
*/
|
34
34
|
export declare function readExtractAndUploadZipFileContents(zipFileKey: string): Promise<PageImportData[]>;
|
35
|
-
export declare
|
36
|
-
|
37
|
-
pending: any;
|
35
|
+
export declare function initialStats(total: number): {
|
36
|
+
pending: number;
|
38
37
|
processing: number;
|
39
38
|
completed: number;
|
40
39
|
failed: number;
|
41
|
-
total:
|
40
|
+
total: number;
|
42
41
|
};
|
43
42
|
export {};
|
package/importPages/utils.js
CHANGED
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
exports.importPage = importPage;
|
9
9
|
exports.initialStats = initialStats;
|
10
10
|
exports.readExtractAndUploadZipFileContents = readExtractAndUploadZipFileContents;
|
11
|
-
exports.
|
11
|
+
exports.uploadPageAssets = void 0;
|
12
12
|
|
13
13
|
var _uniqid = _interopRequireDefault(require("uniqid"));
|
14
14
|
|
@@ -64,7 +64,7 @@ function updateImageInPageSettings({
|
|
64
64
|
newSettings = _dotPropImmutable.default.set(newSettings, "social.image.src", `${srcPrefixWithoutTrailingSlash}/${fileIdToKeyMap.get(settings.social.image.id)}`);
|
65
65
|
}
|
66
66
|
|
67
|
-
return
|
67
|
+
return newSettings;
|
68
68
|
}
|
69
69
|
|
70
70
|
function updateFilesInPageData({
|
@@ -387,11 +387,8 @@ async function deleteS3Folder(key) {
|
|
387
387
|
const deleteFilePromises = keys.map(key => _s3Stream.s3Stream.deleteObject(key));
|
388
388
|
await Promise.all(deleteFilePromises);
|
389
389
|
console.log(`Successfully deleted ${deleteFilePromises.length} files.`);
|
390
|
-
}
|
391
|
-
|
392
|
-
const zeroPad = version => `${version}`.padStart(5, "0");
|
390
|
+
} // export const zeroPad = version => `${version}`.padStart(5, "0");
|
393
391
|
|
394
|
-
exports.zeroPad = zeroPad;
|
395
392
|
|
396
393
|
function initialStats(total) {
|
397
394
|
return {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@webiny/api-page-builder-import-export",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.24.0-beta.0",
|
4
4
|
"main": "index.js",
|
5
5
|
"keywords": [
|
6
6
|
"pbie:base"
|
@@ -16,15 +16,16 @@
|
|
16
16
|
"dependencies": {
|
17
17
|
"@babel/runtime": "7.16.7",
|
18
18
|
"@commodo/fields": "1.1.2-beta.20",
|
19
|
-
"@webiny/api-file-manager": "5.
|
20
|
-
"@webiny/api-page-builder": "5.
|
21
|
-
"@webiny/api-security": "5.
|
22
|
-
"@webiny/error": "5.
|
23
|
-
"@webiny/handler": "5.
|
24
|
-
"@webiny/handler-args": "5.
|
25
|
-
"@webiny/handler-aws": "5.
|
26
|
-
"@webiny/handler-graphql": "5.
|
27
|
-
"@webiny/
|
19
|
+
"@webiny/api-file-manager": "5.24.0-beta.0",
|
20
|
+
"@webiny/api-page-builder": "5.24.0-beta.0",
|
21
|
+
"@webiny/api-security": "5.24.0-beta.0",
|
22
|
+
"@webiny/error": "5.24.0-beta.0",
|
23
|
+
"@webiny/handler": "5.24.0-beta.0",
|
24
|
+
"@webiny/handler-args": "5.24.0-beta.0",
|
25
|
+
"@webiny/handler-aws": "5.24.0-beta.0",
|
26
|
+
"@webiny/handler-graphql": "5.24.0-beta.0",
|
27
|
+
"@webiny/utils": "5.24.0-beta.0",
|
28
|
+
"@webiny/validation": "5.24.0-beta.0",
|
28
29
|
"archiver": "5.3.0",
|
29
30
|
"commodo-fields-object": "1.0.6",
|
30
31
|
"dot-prop-immutable": "2.1.1",
|
@@ -45,16 +46,18 @@
|
|
45
46
|
"@babel/preset-typescript": "^7.16.0",
|
46
47
|
"@elastic/elasticsearch": "7.12.0",
|
47
48
|
"@shelf/jest-elasticsearch": "^1.0.0",
|
49
|
+
"@types/archiver": "^5.3.1",
|
48
50
|
"@types/puppeteer": "^5.4.2",
|
49
|
-
"@
|
50
|
-
"@webiny/api-
|
51
|
-
"@webiny/api-
|
52
|
-
"@webiny/api-
|
53
|
-
"@webiny/api-
|
54
|
-
"@webiny/api-tenancy
|
55
|
-
"@webiny/
|
56
|
-
"@webiny/
|
57
|
-
"@webiny/
|
51
|
+
"@types/yauzl": "^2.9.2",
|
52
|
+
"@webiny/api-dynamodb-to-elasticsearch": "^5.24.0-beta.0",
|
53
|
+
"@webiny/api-file-manager-ddb-es": "^5.24.0-beta.0",
|
54
|
+
"@webiny/api-i18n-ddb": "^5.24.0-beta.0",
|
55
|
+
"@webiny/api-security-so-ddb": "^5.24.0-beta.0",
|
56
|
+
"@webiny/api-tenancy": "^5.24.0-beta.0",
|
57
|
+
"@webiny/api-tenancy-so-ddb": "^5.24.0-beta.0",
|
58
|
+
"@webiny/cli": "^5.24.0-beta.0",
|
59
|
+
"@webiny/db": "^5.24.0-beta.0",
|
60
|
+
"@webiny/project-utils": "^5.24.0-beta.0",
|
58
61
|
"jest": "^26.6.3",
|
59
62
|
"jest-dynalite": "^3.2.0",
|
60
63
|
"rimraf": "^3.0.2",
|
@@ -76,5 +79,5 @@
|
|
76
79
|
]
|
77
80
|
}
|
78
81
|
},
|
79
|
-
"gitHead": "
|
82
|
+
"gitHead": "05b90b92bbaf2ef3adf275d008c4641580cf5f42"
|
80
83
|
}
|