@webiny/api-page-builder-import-export 5.23.1-beta.0 → 5.24.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.
@@ -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 _utils2 = require("../utils");
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, _utils.zeroPad)(subTaskIndex));
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, _utils2.exportPage)(page, exportPagesDataKey, fileManager);
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, {
@@ -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, _utils.zeroPad)(i + 1), {
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,
@@ -1,3 +1,3 @@
1
1
  import { Response, ErrorResponse } from "@webiny/handler-graphql";
2
- declare const _default: (fn: any) => Promise<Response<any> | ErrorResponse>;
2
+ declare const _default: (fn: () => Promise<any>) => Promise<ErrorResponse | Response<any>>;
3
3
  export default _default;
@@ -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, _utils.zeroPad)(i + 1), {
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, _utils.zeroPad)(subTaskIndex));
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".
@@ -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 const zeroPad: (version: any) => string;
36
- export declare function initialStats(total: any): {
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: any;
40
+ total: number;
42
41
  };
43
42
  export {};
@@ -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.zeroPad = exports.uploadPageAssets = void 0;
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 settings;
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.23.1-beta.0",
3
+ "version": "5.24.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.23.1-beta.0",
20
- "@webiny/api-page-builder": "5.23.1-beta.0",
21
- "@webiny/api-security": "5.23.1-beta.0",
22
- "@webiny/error": "5.23.1-beta.0",
23
- "@webiny/handler": "5.23.1-beta.0",
24
- "@webiny/handler-args": "5.23.1-beta.0",
25
- "@webiny/handler-aws": "5.23.1-beta.0",
26
- "@webiny/handler-graphql": "5.23.1-beta.0",
27
- "@webiny/validation": "5.23.1-beta.0",
19
+ "@webiny/api-file-manager": "5.24.0",
20
+ "@webiny/api-page-builder": "5.24.0",
21
+ "@webiny/api-security": "5.24.0",
22
+ "@webiny/error": "5.24.0",
23
+ "@webiny/handler": "5.24.0",
24
+ "@webiny/handler-args": "5.24.0",
25
+ "@webiny/handler-aws": "5.24.0",
26
+ "@webiny/handler-graphql": "5.24.0",
27
+ "@webiny/utils": "5.24.0",
28
+ "@webiny/validation": "5.24.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
- "@webiny/api-dynamodb-to-elasticsearch": "^5.23.1-beta.0",
50
- "@webiny/api-file-manager-ddb-es": "^5.23.1-beta.0",
51
- "@webiny/api-i18n-ddb": "^5.23.1-beta.0",
52
- "@webiny/api-security-so-ddb": "^5.23.1-beta.0",
53
- "@webiny/api-tenancy": "^5.23.1-beta.0",
54
- "@webiny/api-tenancy-so-ddb": "^5.23.1-beta.0",
55
- "@webiny/cli": "^5.23.1-beta.0",
56
- "@webiny/db": "^5.23.1-beta.0",
57
- "@webiny/project-utils": "^5.23.1-beta.0",
51
+ "@types/yauzl": "^2.9.2",
52
+ "@webiny/api-dynamodb-to-elasticsearch": "^5.24.0",
53
+ "@webiny/api-file-manager-ddb-es": "^5.24.0",
54
+ "@webiny/api-i18n-ddb": "^5.24.0",
55
+ "@webiny/api-security-so-ddb": "^5.24.0",
56
+ "@webiny/api-tenancy": "^5.24.0",
57
+ "@webiny/api-tenancy-so-ddb": "^5.24.0",
58
+ "@webiny/cli": "^5.24.0",
59
+ "@webiny/db": "^5.24.0",
60
+ "@webiny/project-utils": "^5.24.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": "05db67aebc2de3c33ba0622f730157ae14143b95"
82
+ "gitHead": "be0cbfcaa9247c658c44179af7943cc5d6d71bc7"
80
83
  }