@webiny/api-page-builder-import-export 5.19.1 → 5.20.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.
@@ -82,17 +82,17 @@ var _default = configuration => ({
|
|
82
82
|
try {
|
83
83
|
if (revisionType === _types.PageExportRevisionType.PUBLISHED) {
|
84
84
|
// Get "published" page.
|
85
|
-
page = await pageBuilder.
|
85
|
+
page = await pageBuilder.getPublishedPageById({
|
86
86
|
id: pageId
|
87
87
|
});
|
88
88
|
} else {
|
89
89
|
// Get "latest" page.
|
90
|
-
page = await pageBuilder.
|
90
|
+
page = await pageBuilder.getPage(pageId);
|
91
91
|
}
|
92
92
|
} catch (e) {
|
93
93
|
// If we're looking for "published" page and doesn't found it, get latest page.
|
94
94
|
if (revisionType === _types.PageExportRevisionType.PUBLISHED && e instanceof _handlerGraphql.NotFoundError) {
|
95
|
-
page = await pageBuilder.
|
95
|
+
page = await pageBuilder.getPage(pageId);
|
96
96
|
} else {
|
97
97
|
throw e;
|
98
98
|
}
|
@@ -74,7 +74,7 @@ var _default = ({
|
|
74
74
|
rwd: "r"
|
75
75
|
});
|
76
76
|
const tenant = context.tenancy.getCurrentTenant();
|
77
|
-
const locale = context.i18nContent.
|
77
|
+
const locale = context.i18nContent.getCurrentLocale();
|
78
78
|
const params = {
|
79
79
|
where: {
|
80
80
|
tenant: tenant.id,
|
@@ -106,7 +106,7 @@ var _default = ({
|
|
106
106
|
rwd: "r"
|
107
107
|
});
|
108
108
|
const tenant = context.tenancy.getCurrentTenant();
|
109
|
-
const locale = context.i18nContent.
|
109
|
+
const locale = context.i18nContent.getCurrentLocale();
|
110
110
|
const {
|
111
111
|
sort,
|
112
112
|
limit
|
@@ -147,7 +147,7 @@ var _default = ({
|
|
147
147
|
|
148
148
|
const pageImportExportTask = _objectSpread(_objectSpread({}, data), {}, {
|
149
149
|
tenant: context.tenancy.getCurrentTenant().id,
|
150
|
-
locale: context.i18nContent.
|
150
|
+
locale: context.i18nContent.getCurrentLocale().code,
|
151
151
|
id,
|
152
152
|
createdOn: new Date().toISOString(),
|
153
153
|
createdBy: {
|
@@ -263,7 +263,7 @@ var _default = ({
|
|
263
263
|
|
264
264
|
const pageImportExportSubTask = _objectSpread(_objectSpread({}, data), {}, {
|
265
265
|
tenant: context.tenancy.getCurrentTenant().id,
|
266
|
-
locale: context.i18nContent.
|
266
|
+
locale: context.i18nContent.getCurrentLocale().code,
|
267
267
|
id: id,
|
268
268
|
parent: parent,
|
269
269
|
createdOn: new Date().toISOString(),
|
@@ -325,7 +325,7 @@ var _default = ({
|
|
325
325
|
rwd: "r"
|
326
326
|
});
|
327
327
|
const tenant = context.tenancy.getCurrentTenant();
|
328
|
-
const locale = context.i18nContent.
|
328
|
+
const locale = context.i18nContent.getCurrentLocale();
|
329
329
|
const params = {
|
330
330
|
where: {
|
331
331
|
tenant: tenant.id,
|
@@ -358,7 +358,7 @@ var _default = ({
|
|
358
358
|
rwd: "r"
|
359
359
|
});
|
360
360
|
const tenant = context.tenancy.getCurrentTenant();
|
361
|
-
const locale = context.i18nContent.
|
361
|
+
const locale = context.i18nContent.getCurrentLocale();
|
362
362
|
const listParams = {
|
363
363
|
where: {
|
364
364
|
tenant: tenant.id,
|
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.default = void 0;
|
9
9
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
-
|
12
10
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
13
11
|
|
14
12
|
var _handlerGraphql = require("@webiny/handler-graphql");
|
@@ -25,10 +23,6 @@ var _utils = require("../../importPages/utils");
|
|
25
23
|
|
26
24
|
var _utils2 = require("../../exportPages/utils");
|
27
25
|
|
28
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
29
|
-
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
31
|
-
|
32
26
|
const PERMISSION_NAME = "pb.page";
|
33
27
|
const EXPORT_PAGES_PROCESS_HANDLER = process.env.EXPORT_PAGES_PROCESS_HANDLER;
|
34
28
|
const IMPORT_PAGES_CREATE_HANDLER = process.env.IMPORT_PAGES_CREATE_HANDLER;
|
@@ -44,7 +38,7 @@ var _default = new _ContextPlugin.ContextPlugin(context => {
|
|
44
38
|
rwd: "w"
|
45
39
|
}); // Bail out early if category not found
|
46
40
|
|
47
|
-
const category = await context.pageBuilder.
|
41
|
+
const category = await context.pageBuilder.getCategory(categorySlug);
|
48
42
|
|
49
43
|
if (!category) {
|
50
44
|
throw new _handlerGraphql.NotFoundError(`Category with slug "${categorySlug}" not found.`);
|
@@ -96,7 +90,7 @@ var _default = new _ContextPlugin.ContextPlugin(context => {
|
|
96
90
|
}; // Paginate pages
|
97
91
|
|
98
92
|
while (meta.hasMoreItems) {
|
99
|
-
[pages, meta] = await context.pageBuilder.
|
93
|
+
[pages, meta] = await context.pageBuilder.listLatestPages({
|
100
94
|
after: meta.cursor,
|
101
95
|
where: where,
|
102
96
|
sort: sort,
|
@@ -156,7 +150,7 @@ var _default = new _ContextPlugin.ContextPlugin(context => {
|
|
156
150
|
|
157
151
|
}; // Modify context
|
158
152
|
|
159
|
-
context.pageBuilder.pages =
|
153
|
+
context.pageBuilder.pages = importExportCrud;
|
160
154
|
});
|
161
155
|
|
162
156
|
exports.default = _default;
|
package/graphql/types.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { PbContext } from "@webiny/api-page-builder/types";
|
2
2
|
import { PageExportRevisionType, PageImportExportTask, PageImportExportTaskStatus, PageImportExportTaskStorageOperations, PageImportExportTaskStorageOperationsListParams } from "../types";
|
3
3
|
export interface ExportPagesParams {
|
4
4
|
ids?: string[];
|
@@ -53,7 +53,7 @@ export declare type PageImportExportTaskCrud = {
|
|
53
53
|
};
|
54
54
|
export interface PbPageImportExportContext extends PbContext {
|
55
55
|
pageBuilder: PbContext["pageBuilder"] & {
|
56
|
-
pages:
|
56
|
+
pages: PagesImportExportCrud;
|
57
57
|
pageImportExportTask: PageImportExportTaskCrud;
|
58
58
|
};
|
59
59
|
}
|
@@ -86,9 +86,9 @@ var _default = configuration => ({
|
|
86
86
|
fileUploadsData
|
87
87
|
}); // Create a page
|
88
88
|
|
89
|
-
let pbPage = await context.pageBuilder.
|
89
|
+
let pbPage = await context.pageBuilder.createPage(category); // Update page with data
|
90
90
|
|
91
|
-
pbPage = await context.pageBuilder.
|
91
|
+
pbPage = await context.pageBuilder.updatePage(pbPage.id, {
|
92
92
|
content: page.content,
|
93
93
|
title: page.title,
|
94
94
|
path: page.path,
|
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.20.0",
|
4
4
|
"main": "index.js",
|
5
5
|
"keywords": [
|
6
6
|
"pbie:base"
|
@@ -16,15 +16,15 @@
|
|
16
16
|
"dependencies": {
|
17
17
|
"@babel/runtime": "7.16.3",
|
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/validation": "5.
|
19
|
+
"@webiny/api-file-manager": "5.20.0",
|
20
|
+
"@webiny/api-page-builder": "5.20.0",
|
21
|
+
"@webiny/api-security": "5.20.0",
|
22
|
+
"@webiny/error": "5.20.0",
|
23
|
+
"@webiny/handler": "5.20.0",
|
24
|
+
"@webiny/handler-args": "5.20.0",
|
25
|
+
"@webiny/handler-aws": "5.20.0",
|
26
|
+
"@webiny/handler-graphql": "5.20.0",
|
27
|
+
"@webiny/validation": "5.20.0",
|
28
28
|
"archiver": "5.3.0",
|
29
29
|
"commodo-fields-object": "1.0.6",
|
30
30
|
"dot-prop-immutable": "2.1.1",
|
@@ -46,15 +46,15 @@
|
|
46
46
|
"@elastic/elasticsearch": "7.12.0",
|
47
47
|
"@shelf/jest-elasticsearch": "^1.0.0",
|
48
48
|
"@types/puppeteer": "^5.4.2",
|
49
|
-
"@webiny/api-dynamodb-to-elasticsearch": "^5.
|
50
|
-
"@webiny/api-file-manager-ddb-es": "^5.
|
51
|
-
"@webiny/api-i18n-ddb": "^5.
|
52
|
-
"@webiny/api-security-so-ddb": "^5.
|
53
|
-
"@webiny/api-tenancy": "^5.
|
54
|
-
"@webiny/api-tenancy-so-ddb": "^5.
|
55
|
-
"@webiny/cli": "^5.
|
56
|
-
"@webiny/db": "^5.
|
57
|
-
"@webiny/project-utils": "^5.
|
49
|
+
"@webiny/api-dynamodb-to-elasticsearch": "^5.20.0",
|
50
|
+
"@webiny/api-file-manager-ddb-es": "^5.20.0",
|
51
|
+
"@webiny/api-i18n-ddb": "^5.20.0",
|
52
|
+
"@webiny/api-security-so-ddb": "^5.20.0",
|
53
|
+
"@webiny/api-tenancy": "^5.20.0",
|
54
|
+
"@webiny/api-tenancy-so-ddb": "^5.20.0",
|
55
|
+
"@webiny/cli": "^5.20.0",
|
56
|
+
"@webiny/db": "^5.20.0",
|
57
|
+
"@webiny/project-utils": "^5.20.0",
|
58
58
|
"jest": "^26.6.3",
|
59
59
|
"jest-dynalite": "^3.2.0",
|
60
60
|
"rimraf": "^3.0.2",
|
@@ -76,5 +76,5 @@
|
|
76
76
|
]
|
77
77
|
}
|
78
78
|
},
|
79
|
-
"gitHead": "
|
79
|
+
"gitHead": "816632961750d4ae7f3af0d32d4e8a46c3f287a6"
|
80
80
|
}
|