@webiny/api-page-builder-import-export 5.20.0-beta.1 → 5.20.0-beta.2
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
|
}
|
@@ -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.20.0-beta.
|
3
|
+
"version": "5.20.0-beta.2",
|
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.0-beta.
|
20
|
-
"@webiny/api-page-builder": "5.20.0-beta.
|
21
|
-
"@webiny/api-security": "5.20.0-beta.
|
22
|
-
"@webiny/error": "5.20.0-beta.
|
23
|
-
"@webiny/handler": "5.20.0-beta.
|
24
|
-
"@webiny/handler-args": "5.20.0-beta.
|
25
|
-
"@webiny/handler-aws": "5.20.0-beta.
|
26
|
-
"@webiny/handler-graphql": "5.20.0-beta.
|
27
|
-
"@webiny/validation": "5.20.0-beta.
|
19
|
+
"@webiny/api-file-manager": "5.20.0-beta.2",
|
20
|
+
"@webiny/api-page-builder": "5.20.0-beta.2",
|
21
|
+
"@webiny/api-security": "5.20.0-beta.2",
|
22
|
+
"@webiny/error": "5.20.0-beta.2",
|
23
|
+
"@webiny/handler": "5.20.0-beta.2",
|
24
|
+
"@webiny/handler-args": "5.20.0-beta.2",
|
25
|
+
"@webiny/handler-aws": "5.20.0-beta.2",
|
26
|
+
"@webiny/handler-graphql": "5.20.0-beta.2",
|
27
|
+
"@webiny/validation": "5.20.0-beta.2",
|
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.20.0-beta.
|
50
|
-
"@webiny/api-file-manager-ddb-es": "^5.20.0-beta.
|
51
|
-
"@webiny/api-i18n-ddb": "^5.20.0-beta.
|
52
|
-
"@webiny/api-security-so-ddb": "^5.20.0-beta.
|
53
|
-
"@webiny/api-tenancy": "^5.20.0-beta.
|
54
|
-
"@webiny/api-tenancy-so-ddb": "^5.20.0-beta.
|
55
|
-
"@webiny/cli": "^5.20.0-beta.
|
56
|
-
"@webiny/db": "^5.20.0-beta.
|
57
|
-
"@webiny/project-utils": "^5.20.0-beta.
|
49
|
+
"@webiny/api-dynamodb-to-elasticsearch": "^5.20.0-beta.2",
|
50
|
+
"@webiny/api-file-manager-ddb-es": "^5.20.0-beta.2",
|
51
|
+
"@webiny/api-i18n-ddb": "^5.20.0-beta.2",
|
52
|
+
"@webiny/api-security-so-ddb": "^5.20.0-beta.2",
|
53
|
+
"@webiny/api-tenancy": "^5.20.0-beta.2",
|
54
|
+
"@webiny/api-tenancy-so-ddb": "^5.20.0-beta.2",
|
55
|
+
"@webiny/cli": "^5.20.0-beta.2",
|
56
|
+
"@webiny/db": "^5.20.0-beta.2",
|
57
|
+
"@webiny/project-utils": "^5.20.0-beta.2",
|
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": "86c73ea3b5bf71372f255aa24ee8c6ed98466b7f"
|
80
80
|
}
|