@webbio/strapi-plugin-page-builder 0.3.7-platform → 0.3.8-legacy
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/README.md +35 -11
- package/admin/src/api/collection-type.ts +1 -7
- package/admin/src/api/page-type.ts +4 -5
- package/admin/src/components/EditView/CollectionTypeSearch/index.tsx +12 -15
- package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/index.tsx +28 -10
- package/admin/src/components/EditView/CollectionTypeSettings/index.tsx +35 -80
- package/admin/src/components/EditView/Details/index.tsx +2 -13
- package/admin/src/components/EditView/PageSettings/index.tsx +5 -61
- package/admin/src/components/EditView/index.tsx +2 -8
- package/admin/src/components/PageTypeFilter/index.tsx +17 -0
- package/admin/src/components/PageTypeFilter/page-type-filter.tsx +130 -0
- package/admin/src/index.tsx +2 -2
- package/admin/src/utils/sanitizeModules.ts +92 -9
- package/dist/package.json +12 -10
- package/dist/server/bootstrap/permissions.js +10 -68
- package/dist/server/bootstrap.js +25 -41
- package/dist/server/controllers/collection-types.js +0 -5
- package/dist/server/controllers/index.js +1 -3
- package/dist/server/graphql/index.js +2 -2
- package/dist/server/graphql/page-by-slug.js +50 -44
- package/dist/server/graphql/pages-by-uid.js +9 -11
- package/dist/server/register.js +2 -2
- package/dist/server/routes/index.js +0 -26
- package/dist/server/schema/page-end.json +0 -5
- package/dist/server/services/builder.js +5 -15
- package/dist/server/services/collection-types.js +0 -7
- package/dist/server/services/index.js +1 -3
- package/dist/server/services/template.js +1 -2
- package/dist/server/utils/strapi.js +1 -4
- package/dist/shared/utils/constants.js +1 -3
- package/dist/tsconfig.server.tsbuildinfo +1 -1
- package/package.json +12 -10
- package/server/bootstrap/collection-type-lifecycles.ts +1 -1
- package/server/bootstrap/permissions.ts +10 -75
- package/server/bootstrap.ts +25 -44
- package/server/controllers/collection-types.ts +0 -5
- package/server/controllers/index.ts +1 -3
- package/server/graphql/index.ts +2 -2
- package/server/graphql/page-by-slug.ts +113 -0
- package/server/graphql/pages-by-uid.ts +9 -11
- package/server/register.ts +2 -2
- package/server/routes/index.ts +0 -26
- package/server/schema/page-end.json +0 -5
- package/server/services/builder.ts +6 -18
- package/server/services/collection-types.ts +1 -8
- package/server/services/index.ts +1 -3
- package/server/services/template.ts +1 -2
- package/server/utils/strapi.ts +1 -5
- package/shared/utils/constants.ts +0 -2
- package/admin/src/api/has-platform-relation.ts +0 -37
- package/admin/src/api/platform-page-types.ts +0 -40
- package/admin/src/api/platform.ts +0 -34
- package/admin/src/components/EditView/Platform/platform-select.tsx +0 -31
- package/admin/src/components/PageFilters/PageTypeFilter/index.tsx +0 -39
- package/admin/src/components/PageFilters/PlatformFilter/index.tsx +0 -28
- package/admin/src/components/PageFilters/filters.tsx +0 -180
- package/admin/src/components/PageFilters/index.tsx +0 -30
- package/dist/server/controllers/platform.js +0 -20
- package/dist/server/graphql/page-by-path.js +0 -89
- package/dist/server/schema/platform-start.json +0 -31
- package/dist/server/services/platform.js +0 -36
- package/server/controllers/platform.ts +0 -21
- package/server/graphql/page-by-path.ts +0 -105
- package/server/schema/platform-start.json +0 -31
- package/server/services/platform.ts +0 -36
|
@@ -14,16 +14,13 @@ const getPageInfoFromUID = (strapi) => {
|
|
|
14
14
|
pageSize: Int
|
|
15
15
|
}`;
|
|
16
16
|
const entityInfo = collectionTypes.map((collectionType) => {
|
|
17
|
-
return `
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
17
|
+
return `extend type ${collectionType.type}EntityResponseCollection {
|
|
18
|
+
metaInfo: MetaInfo
|
|
19
|
+
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`;
|
|
21
|
+
type Query {
|
|
22
|
+
get${collectionType.type}Pages(filters: ${collectionType.type}FiltersInput, pagination: PaginationArg, sort:[String], pageFilters: PageFiltersInput): ${collectionType.type}EntityResponseCollection
|
|
23
|
+
}`;
|
|
27
24
|
});
|
|
28
25
|
return `${metaInfo} ${entityInfo}`;
|
|
29
26
|
};
|
|
@@ -60,8 +57,9 @@ const getPageInfoFromUID = (strapi) => {
|
|
|
60
57
|
hasPage: { $eq: true },
|
|
61
58
|
page: { ...transformedpageArgs.filters }
|
|
62
59
|
},
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
sort: transformedArgs.sort,
|
|
61
|
+
start: start,
|
|
62
|
+
limit: limit
|
|
65
63
|
}));
|
|
66
64
|
const entityResponse = toEntityResponseCollection(results || [], {
|
|
67
65
|
args: transformedArgs,
|
package/dist/server/register.js
CHANGED
|
@@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const page_by_slug_1 = __importDefault(require("./graphql/page-by-slug"));
|
|
7
7
|
const page_type_1 = __importDefault(require("./graphql/page-type"));
|
|
8
8
|
const pages_by_uid_1 = __importDefault(require("./graphql/pages-by-uid"));
|
|
9
9
|
exports.default = async ({ strapi }) => {
|
|
10
10
|
var _a, _b;
|
|
11
11
|
const extensionService = strapi.plugin('graphql').service('extension');
|
|
12
12
|
extensionService.use(page_type_1.default);
|
|
13
|
-
extensionService.use((0,
|
|
13
|
+
extensionService.use((0, page_by_slug_1.default)(strapi));
|
|
14
14
|
extensionService.use((0, pages_by_uid_1.default)(strapi));
|
|
15
15
|
await ((_b = (_a = strapi.services) === null || _a === void 0 ? void 0 : _a['plugin::page-builder.builder']) === null || _b === void 0 ? void 0 : _b.buildContentTypes());
|
|
16
16
|
};
|
|
@@ -36,11 +36,6 @@ const routes = {
|
|
|
36
36
|
method: 'GET',
|
|
37
37
|
path: '/collection-types-page-links/:uid/:ids?',
|
|
38
38
|
handler: 'collection-types.getTranslationPageLinks'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
method: 'GET',
|
|
42
|
-
path: '/collection-types/hasPlatform/:uid',
|
|
43
|
-
handler: 'collection-types.hasPlatformRelation'
|
|
44
39
|
}
|
|
45
40
|
]
|
|
46
41
|
},
|
|
@@ -59,27 +54,6 @@ const routes = {
|
|
|
59
54
|
handler: 'template.findOneById'
|
|
60
55
|
}
|
|
61
56
|
]
|
|
62
|
-
},
|
|
63
|
-
platform: {
|
|
64
|
-
type: 'admin',
|
|
65
|
-
prefix: undefined,
|
|
66
|
-
routes: [
|
|
67
|
-
{
|
|
68
|
-
method: 'GET',
|
|
69
|
-
path: '/platform',
|
|
70
|
-
handler: 'platform.findAll'
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
method: 'GET',
|
|
74
|
-
path: '/platform/:uid',
|
|
75
|
-
handler: 'platform.findOneByUid'
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
method: 'GET',
|
|
79
|
-
path: '/platform/:platform/page-types',
|
|
80
|
-
handler: 'platform.findPageTypesByPlatform'
|
|
81
|
-
}
|
|
82
|
-
]
|
|
83
57
|
}
|
|
84
58
|
};
|
|
85
59
|
exports.default = routes;
|
|
@@ -12,8 +12,7 @@ const reload_strapi_on_load_1 = require("../utils/reload-strapi-on-load");
|
|
|
12
12
|
const page_type_start_json_1 = __importDefault(require("../schema/page-type-start.json"));
|
|
13
13
|
const page_type_end_json_1 = __importDefault(require("../schema/page-type-end.json"));
|
|
14
14
|
const template_start_json_1 = __importDefault(require("../schema/template-start.json"));
|
|
15
|
-
const
|
|
16
|
-
const UIDS = [constants_1.TEMPLATE_UID, constants_1.PAGE_TYPE_UID, constants_1.PLATFORM_UID, constants_1.PAGE_UID];
|
|
15
|
+
const UIDS = [constants_1.TEMPLATE_UID, constants_1.PAGE_TYPE_UID, constants_1.PAGE_UID];
|
|
17
16
|
exports.default = {
|
|
18
17
|
async buildContentTypes() {
|
|
19
18
|
this.listenToCreatedContentTypes();
|
|
@@ -73,35 +72,26 @@ exports.default = {
|
|
|
73
72
|
[constants_1.TEMPLATE_UID]: {
|
|
74
73
|
create: this.getTemplateContentType(),
|
|
75
74
|
update: this.getTemplateContentType()
|
|
76
|
-
},
|
|
77
|
-
[constants_1.PLATFORM_UID]: {
|
|
78
|
-
create: this.getPlatformContentType(),
|
|
79
|
-
update: this.getPlatformContentType()
|
|
80
75
|
}
|
|
81
76
|
};
|
|
82
77
|
return contentTypes === null || contentTypes === void 0 ? void 0 : contentTypes[uid];
|
|
83
78
|
},
|
|
84
79
|
getPageContentType(create) {
|
|
85
80
|
const page = create ? page_start_json_1.default : page_end_json_1.default;
|
|
86
|
-
const contentType = this.
|
|
81
|
+
const contentType = this.mergeCollectionTypeWithModules(page, constants_1.PAGE_UID);
|
|
87
82
|
return { uid: constants_1.PAGE_UID, contentType };
|
|
88
83
|
},
|
|
89
84
|
getPageTypeContentType(create) {
|
|
90
85
|
const pageType = create ? page_type_start_json_1.default : page_type_end_json_1.default;
|
|
91
|
-
const contentType = this.
|
|
86
|
+
const contentType = this.mergeCollectionTypeWithModules(pageType, constants_1.PAGE_TYPE_UID);
|
|
92
87
|
return { uid: constants_1.PAGE_TYPE_UID, contentType };
|
|
93
88
|
},
|
|
94
89
|
getTemplateContentType() {
|
|
95
90
|
const template = template_start_json_1.default;
|
|
96
|
-
const contentType = this.
|
|
91
|
+
const contentType = this.mergeCollectionTypeWithModules(template, constants_1.TEMPLATE_UID);
|
|
97
92
|
return { uid: constants_1.TEMPLATE_UID, contentType };
|
|
98
93
|
},
|
|
99
|
-
|
|
100
|
-
const platform = platform_start_json_1.default;
|
|
101
|
-
const contentType = this.mergeCollectionTypeWithOld(platform, constants_1.PLATFORM_UID);
|
|
102
|
-
return { uid: constants_1.PLATFORM_UID, contentType };
|
|
103
|
-
},
|
|
104
|
-
mergeCollectionTypeWithOld(collectionType, uid) {
|
|
94
|
+
mergeCollectionTypeWithModules(collectionType, uid) {
|
|
105
95
|
var _a, _b, _c, _d, _e, _f;
|
|
106
96
|
const { pluginOptions: oldPluginOptions, __schema__: oldSchema } = strapi.contentType(uid) || {};
|
|
107
97
|
const modulesFromConfig = ((_a = oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.attributes) === null || _a === void 0 ? void 0 : _a.modules) ? this.getConfigModuleComponents() : undefined;
|
|
@@ -22,13 +22,6 @@ exports.default = {
|
|
|
22
22
|
pageTypesWithUid.length > 0)
|
|
23
23
|
};
|
|
24
24
|
},
|
|
25
|
-
async hasPlatformRelation(uid) {
|
|
26
|
-
var _a, _b, _c;
|
|
27
|
-
const contentType = (_a = strapi.contentTypes) === null || _a === void 0 ? void 0 : _a[uid];
|
|
28
|
-
return {
|
|
29
|
-
hasPlatformRelation: Boolean(((_c = (_b = contentType === null || contentType === void 0 ? void 0 : contentType.attributes) === null || _b === void 0 ? void 0 : _b.platform) === null || _c === void 0 ? void 0 : _c.target) === constants_1.PLATFORM_UID)
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
25
|
withPageMorph() {
|
|
33
26
|
const { getTypeName, getFiltersInputTypeName } = strapi.plugin('graphql').service('utils').naming;
|
|
34
27
|
const collectionTypes = Object.entries(strapi.contentTypes)
|
|
@@ -8,12 +8,10 @@ const builder_1 = __importDefault(require("./builder"));
|
|
|
8
8
|
const page_type_1 = __importDefault(require("./page-type"));
|
|
9
9
|
const collection_types_1 = __importDefault(require("./collection-types"));
|
|
10
10
|
const template_1 = __importDefault(require("./template"));
|
|
11
|
-
const platform_1 = __importDefault(require("./platform"));
|
|
12
11
|
exports.default = {
|
|
13
12
|
page: page_1.default,
|
|
14
13
|
builder: builder_1.default,
|
|
15
14
|
'page-type': page_type_1.default,
|
|
16
15
|
'collection-types': collection_types_1.default,
|
|
17
|
-
template: template_1.default
|
|
18
|
-
platform: platform_1.default
|
|
16
|
+
template: template_1.default
|
|
19
17
|
};
|
|
@@ -8,7 +8,6 @@ exports.default = {
|
|
|
8
8
|
return foundTemplates;
|
|
9
9
|
},
|
|
10
10
|
async findOne(id) {
|
|
11
|
-
|
|
12
|
-
return getpopulatedTemplate;
|
|
11
|
+
return await (0, strapi_1.getPopulatedEntity)(constants_1.TEMPLATE_UID, id);
|
|
13
12
|
}
|
|
14
13
|
};
|
|
@@ -11,15 +11,12 @@ const getDeepPopulate = (uid, populate, depth = 0) => {
|
|
|
11
11
|
const { attributes } = strapi.getModel(uid);
|
|
12
12
|
return Object.keys(attributes).reduce((populateAcc, attributeName) => {
|
|
13
13
|
const attribute = attributes[attributeName];
|
|
14
|
-
if (attribute.type === 'relation') {
|
|
15
|
-
return populateAcc;
|
|
16
|
-
}
|
|
17
14
|
if (attribute.type === 'component') {
|
|
18
15
|
populateAcc[attributeName] = {
|
|
19
16
|
populate: (0, exports.getDeepPopulate)(attribute.component, null, depth + 1)
|
|
20
17
|
};
|
|
21
18
|
}
|
|
22
|
-
if (attribute.type === 'media') {
|
|
19
|
+
if (attribute.type === 'relation' || attribute.type === 'media') {
|
|
23
20
|
populateAcc[attributeName] = true;
|
|
24
21
|
}
|
|
25
22
|
if (attribute.type === 'dynamiczone') {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PAGE_TYPE_PAGE = exports.PAGE_TYPE_UID = exports.TEMPLATE_UID = exports.PAGE_UID = void 0;
|
|
4
4
|
exports.PAGE_UID = 'api::page.page';
|
|
5
5
|
exports.TEMPLATE_UID = 'api::template.template';
|
|
6
6
|
exports.PAGE_TYPE_UID = 'api::page-type.page-type';
|
|
7
|
-
exports.PLATFORM_UID = 'api::platform.platform';
|
|
8
7
|
exports.PAGE_TYPE_PAGE = 'page';
|
|
9
|
-
exports.PLATFORM = 'platform';
|