@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.
Files changed (65) hide show
  1. package/README.md +35 -11
  2. package/admin/src/api/collection-type.ts +1 -7
  3. package/admin/src/api/page-type.ts +4 -5
  4. package/admin/src/components/EditView/CollectionTypeSearch/index.tsx +12 -15
  5. package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/index.tsx +28 -10
  6. package/admin/src/components/EditView/CollectionTypeSettings/index.tsx +35 -80
  7. package/admin/src/components/EditView/Details/index.tsx +2 -13
  8. package/admin/src/components/EditView/PageSettings/index.tsx +5 -61
  9. package/admin/src/components/EditView/index.tsx +2 -8
  10. package/admin/src/components/PageTypeFilter/index.tsx +17 -0
  11. package/admin/src/components/PageTypeFilter/page-type-filter.tsx +130 -0
  12. package/admin/src/index.tsx +2 -2
  13. package/admin/src/utils/sanitizeModules.ts +92 -9
  14. package/dist/package.json +12 -10
  15. package/dist/server/bootstrap/permissions.js +10 -68
  16. package/dist/server/bootstrap.js +25 -41
  17. package/dist/server/controllers/collection-types.js +0 -5
  18. package/dist/server/controllers/index.js +1 -3
  19. package/dist/server/graphql/index.js +2 -2
  20. package/dist/server/graphql/page-by-slug.js +50 -44
  21. package/dist/server/graphql/pages-by-uid.js +9 -11
  22. package/dist/server/register.js +2 -2
  23. package/dist/server/routes/index.js +0 -26
  24. package/dist/server/schema/page-end.json +0 -5
  25. package/dist/server/services/builder.js +5 -15
  26. package/dist/server/services/collection-types.js +0 -7
  27. package/dist/server/services/index.js +1 -3
  28. package/dist/server/services/template.js +1 -2
  29. package/dist/server/utils/strapi.js +1 -4
  30. package/dist/shared/utils/constants.js +1 -3
  31. package/dist/tsconfig.server.tsbuildinfo +1 -1
  32. package/package.json +12 -10
  33. package/server/bootstrap/collection-type-lifecycles.ts +1 -1
  34. package/server/bootstrap/permissions.ts +10 -75
  35. package/server/bootstrap.ts +25 -44
  36. package/server/controllers/collection-types.ts +0 -5
  37. package/server/controllers/index.ts +1 -3
  38. package/server/graphql/index.ts +2 -2
  39. package/server/graphql/page-by-slug.ts +113 -0
  40. package/server/graphql/pages-by-uid.ts +9 -11
  41. package/server/register.ts +2 -2
  42. package/server/routes/index.ts +0 -26
  43. package/server/schema/page-end.json +0 -5
  44. package/server/services/builder.ts +6 -18
  45. package/server/services/collection-types.ts +1 -8
  46. package/server/services/index.ts +1 -3
  47. package/server/services/template.ts +1 -2
  48. package/server/utils/strapi.ts +1 -5
  49. package/shared/utils/constants.ts +0 -2
  50. package/admin/src/api/has-platform-relation.ts +0 -37
  51. package/admin/src/api/platform-page-types.ts +0 -40
  52. package/admin/src/api/platform.ts +0 -34
  53. package/admin/src/components/EditView/Platform/platform-select.tsx +0 -31
  54. package/admin/src/components/PageFilters/PageTypeFilter/index.tsx +0 -39
  55. package/admin/src/components/PageFilters/PlatformFilter/index.tsx +0 -28
  56. package/admin/src/components/PageFilters/filters.tsx +0 -180
  57. package/admin/src/components/PageFilters/index.tsx +0 -30
  58. package/dist/server/controllers/platform.js +0 -20
  59. package/dist/server/graphql/page-by-path.js +0 -89
  60. package/dist/server/schema/platform-start.json +0 -31
  61. package/dist/server/services/platform.js +0 -36
  62. package/server/controllers/platform.ts +0 -21
  63. package/server/graphql/page-by-path.ts +0 -105
  64. package/server/schema/platform-start.json +0 -31
  65. 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
- extend type ${collectionType.type}EntityResponseCollection {
19
- metaInfo: MetaInfo
20
- }
17
+ return `extend type ${collectionType.type}EntityResponseCollection {
18
+ metaInfo: MetaInfo
19
+ }
21
20
 
22
- type Query {
23
- get${collectionType.type}Pages(filters: ${collectionType.type}FiltersInput,pagination: PaginationArg, pageFilters: PageFiltersInput): ${collectionType.type}EntityResponseCollection
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
- start,
64
- limit
60
+ sort: transformedArgs.sort,
61
+ start: start,
62
+ limit: limit
65
63
  }));
66
64
  const entityResponse = toEntityResponseCollection(results || [], {
67
65
  args: transformedArgs,
@@ -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 page_by_path_1 = __importDefault(require("./graphql/page-by-path"));
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, page_by_path_1.default)(strapi));
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;
@@ -86,11 +86,6 @@
86
86
  "type": "relation",
87
87
  "relation": "oneToOne",
88
88
  "target": "api::page-type.page-type"
89
- },
90
- "platform": {
91
- "type": "relation",
92
- "relation": "oneToOne",
93
- "target": "api::platform.platform"
94
89
  }
95
90
  }
96
91
  }
@@ -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 platform_start_json_1 = __importDefault(require("../schema/platform-start.json"));
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.mergeCollectionTypeWithOld(page, constants_1.PAGE_UID);
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.mergeCollectionTypeWithOld(pageType, constants_1.PAGE_TYPE_UID);
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.mergeCollectionTypeWithOld(template, constants_1.TEMPLATE_UID);
91
+ const contentType = this.mergeCollectionTypeWithModules(template, constants_1.TEMPLATE_UID);
97
92
  return { uid: constants_1.TEMPLATE_UID, contentType };
98
93
  },
99
- getPlatformContentType() {
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
- const getpopulatedTemplate = (0, strapi_1.getPopulatedEntity)(constants_1.TEMPLATE_UID, id);
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.PLATFORM = exports.PAGE_TYPE_PAGE = exports.PLATFORM_UID = exports.PAGE_TYPE_UID = exports.TEMPLATE_UID = exports.PAGE_UID = void 0;
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';