@webbio/strapi-plugin-page-builder 0.2.2 → 0.2.4

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 (93) hide show
  1. package/README.md +98 -98
  2. package/admin/src/api/collection-type.ts +110 -110
  3. package/admin/src/api/has-page-relation.ts +34 -34
  4. package/admin/src/api/page-type.ts +31 -31
  5. package/admin/src/api/template.ts +27 -27
  6. package/admin/src/components/Combobox/index.tsx +77 -77
  7. package/admin/src/components/Combobox/react-select-custom-styles.tsx +120 -111
  8. package/admin/src/components/Combobox/styles.ts +22 -22
  9. package/admin/src/components/ConfirmModal/index.tsx +90 -90
  10. package/admin/src/components/EditView/CollectionTypeSearch/index.tsx +124 -124
  11. package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/index.tsx +104 -101
  12. package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/styles.ts +19 -19
  13. package/admin/src/components/EditView/CollectionTypeSettings/index.tsx +74 -74
  14. package/admin/src/components/EditView/Details/index.tsx +47 -47
  15. package/admin/src/components/EditView/Details/styles.ts +51 -51
  16. package/admin/src/components/EditView/PageSettings/index.tsx +104 -104
  17. package/admin/src/components/EditView/Template/TemplateConfirmModal/index.tsx +36 -36
  18. package/admin/src/components/EditView/Template/TemplateSelect/index.tsx +69 -69
  19. package/admin/src/components/EditView/Template/TemplateSelect/use-template-modules.ts +38 -38
  20. package/admin/src/components/EditView/index.tsx +29 -29
  21. package/admin/src/components/EditView/page-type-select.tsx +32 -32
  22. package/admin/src/components/EditView/wrapper.tsx +35 -35
  23. package/admin/src/components/Initializer/index.tsx +24 -24
  24. package/admin/src/components/PageTypeFilter/index.tsx +17 -17
  25. package/admin/src/components/PageTypeFilter/page-type-filter.tsx +130 -130
  26. package/admin/src/components/PluginIcon/index.tsx +12 -12
  27. package/admin/src/constants.ts +3 -3
  28. package/admin/src/index.tsx +59 -59
  29. package/admin/src/middlewares/index.tsx +37 -37
  30. package/admin/src/pluginId.ts +5 -5
  31. package/admin/src/translations/en.json +6 -6
  32. package/admin/src/translations/nl.json +6 -6
  33. package/admin/src/utils/getRequestUrl.ts +11 -11
  34. package/admin/src/utils/getTrad.ts +5 -5
  35. package/admin/src/utils/hooks/useDebounce.ts +17 -17
  36. package/admin/src/utils/hooks/useGetLocaleFromUrl.ts +9 -9
  37. package/admin/src/utils/hooks/usePrevious.ts +12 -12
  38. package/admin/src/utils/sanitizeModules.ts +43 -10
  39. package/custom.d.ts +5 -5
  40. package/dist/package.json +9 -9
  41. package/dist/server/graphql/page-by-slug.js +9 -9
  42. package/dist/server/graphql/pages-by-uid.js +14 -14
  43. package/dist/server/services/builder.js +7 -4
  44. package/dist/server/services/template.js +1 -2
  45. package/dist/server/utils/graphql.js +18 -18
  46. package/dist/server/utils/strapi.js +1 -4
  47. package/dist/tsconfig.server.tsbuildinfo +1 -1
  48. package/package.json +71 -71
  49. package/server/bootstrap/collection-type-lifecycles.ts +47 -47
  50. package/server/bootstrap/permissions.ts +42 -42
  51. package/server/bootstrap.ts +198 -198
  52. package/server/config/index.ts +4 -4
  53. package/server/content-types/index.ts +1 -1
  54. package/server/controllers/collection-types.ts +27 -27
  55. package/server/controllers/index.ts +11 -11
  56. package/server/controllers/page-type.ts +13 -13
  57. package/server/controllers/page.ts +9 -9
  58. package/server/controllers/template.ts +16 -16
  59. package/server/destroy.ts +5 -5
  60. package/server/graphql/index.ts +9 -9
  61. package/server/graphql/page-by-slug.ts +98 -98
  62. package/server/graphql/page-type.ts +67 -67
  63. package/server/graphql/pages-by-uid.ts +127 -127
  64. package/server/index.ts +23 -23
  65. package/server/middlewares/index.ts +1 -1
  66. package/server/policies/index.ts +1 -1
  67. package/server/register.ts +15 -15
  68. package/server/routes/index.ts +58 -58
  69. package/server/schema/page-end.json +91 -91
  70. package/server/schema/page-start.json +87 -87
  71. package/server/schema/page-type-end.json +43 -43
  72. package/server/schema/page-type-start.json +38 -38
  73. package/server/schema/template-start.json +35 -35
  74. package/server/services/builder.ts +137 -134
  75. package/server/services/collection-types.ts +88 -88
  76. package/server/services/index.ts +13 -13
  77. package/server/services/page-type.ts +26 -26
  78. package/server/services/page.ts +24 -24
  79. package/server/services/template.ts +13 -14
  80. package/server/utils/filter-underscore-arguments.ts +12 -12
  81. package/server/utils/graphql.ts +113 -113
  82. package/server/utils/paginationValidation.ts +39 -39
  83. package/server/utils/reload-strapi-on-load.ts +13 -13
  84. package/server/utils/strapi.ts +45 -49
  85. package/shared/utils/constants.ts +4 -4
  86. package/shared/utils/sleep.ts +1 -1
  87. package/strapi-admin.js +3 -3
  88. package/strapi-server.js +3 -3
  89. package/tsconfig.json +20 -20
  90. package/tsconfig.server.json +25 -25
  91. package/dist/server/controllers/platform.js +0 -20
  92. package/dist/server/schema/platform-start.json +0 -31
  93. package/dist/server/services/platform.js +0 -36
@@ -1,59 +1,59 @@
1
- import { prefixPluginTranslations } from '@strapi/helper-plugin';
2
-
3
- import pluginPkg from '../../package.json';
4
- import pluginId from './pluginId';
5
- import Initializer from './components/Initializer';
6
- import PageTypeFilter from './components/PageTypeFilter';
7
- import { EditView } from './components/EditView';
8
- import middlewares from './middlewares';
9
-
10
- const name = pluginPkg.strapi.name;
11
-
12
- export default {
13
- register(app: any) {
14
- app.addMiddlewares(middlewares);
15
- const plugin = {
16
- id: pluginId,
17
- initializer: Initializer,
18
- isReady: false,
19
- name
20
- };
21
-
22
- app.registerPlugin(plugin);
23
- },
24
-
25
- bootstrap(app: any) {
26
- app.injectContentManagerComponent('editView', 'right-links', {
27
- name: 'collection-type-picker',
28
- Component: EditView
29
- });
30
- app.injectContentManagerComponent('listView', 'actions', {
31
- name: 'page-filters',
32
- Component: PageTypeFilter
33
- });
34
- },
35
-
36
- async registerTrads(app: any) {
37
- const { locales } = app;
38
-
39
- const importedTrads = await Promise.all(
40
- (locales as string[]).map((locale) => {
41
- return import(`./translations/${locale}.json`)
42
- .then(({ default: data }) => {
43
- return {
44
- data: prefixPluginTranslations(data, pluginId),
45
- locale
46
- };
47
- })
48
- .catch(() => {
49
- return {
50
- data: {},
51
- locale
52
- };
53
- });
54
- })
55
- );
56
-
57
- return Promise.resolve(importedTrads);
58
- }
59
- };
1
+ import { prefixPluginTranslations } from '@strapi/helper-plugin';
2
+
3
+ import pluginPkg from '../../package.json';
4
+ import pluginId from './pluginId';
5
+ import Initializer from './components/Initializer';
6
+ import PageTypeFilter from './components/PageTypeFilter';
7
+ import { EditView } from './components/EditView';
8
+ import middlewares from './middlewares';
9
+
10
+ const name = pluginPkg.strapi.name;
11
+
12
+ export default {
13
+ register(app: any) {
14
+ app.addMiddlewares(middlewares);
15
+ const plugin = {
16
+ id: pluginId,
17
+ initializer: Initializer,
18
+ isReady: false,
19
+ name
20
+ };
21
+
22
+ app.registerPlugin(plugin);
23
+ },
24
+
25
+ bootstrap(app: any) {
26
+ app.injectContentManagerComponent('editView', 'right-links', {
27
+ name: 'collection-type-picker',
28
+ Component: EditView
29
+ });
30
+ app.injectContentManagerComponent('listView', 'actions', {
31
+ name: 'page-filters',
32
+ Component: PageTypeFilter
33
+ });
34
+ },
35
+
36
+ async registerTrads(app: any) {
37
+ const { locales } = app;
38
+
39
+ const importedTrads = await Promise.all(
40
+ (locales as string[]).map((locale) => {
41
+ return import(`./translations/${locale}.json`)
42
+ .then(({ default: data }) => {
43
+ return {
44
+ data: prefixPluginTranslations(data, pluginId),
45
+ locale
46
+ };
47
+ })
48
+ .catch(() => {
49
+ return {
50
+ data: {},
51
+ locale
52
+ };
53
+ });
54
+ })
55
+ );
56
+
57
+ return Promise.resolve(importedTrads);
58
+ }
59
+ };
@@ -1,37 +1,37 @@
1
- import { getFetchClient } from '@strapi/helper-plugin';
2
-
3
- import { PAGE_UID } from '../../../shared/utils/constants';
4
- import getRequestUrl from '../utils/getRequestUrl';
5
-
6
- const middleware =
7
- () =>
8
- ({ getState }: any) =>
9
- (next: any) =>
10
- async (action: any) => {
11
- // If data is being fetched or after a save
12
- if (
13
- action.type === 'ContentManager/CrudReducer/GET_DATA_SUCCEEDED' ||
14
- action.type === 'ContentManager/CrudReducer/SUBMIT_SUCCEEDED'
15
- ) {
16
- const store = getState();
17
- const layoutSlice = store['content-manager_editViewLayoutManager'];
18
- const uid = layoutSlice.currentLayout.contentType.uid;
19
-
20
- if (uid !== PAGE_UID) {
21
- return next(action);
22
- }
23
-
24
- const { get } = await getFetchClient();
25
- const { data: pageData } = await get(`${getRequestUrl('page')}/${action.data.id}`);
26
-
27
- action.data.collectionTypeTitle = pageData?.collectionTypeData?.title;
28
- action.data.collectionTypeId = pageData?.collectionTypeData?.id;
29
- action.data.initialPageType = pageData?.pageType ? pageData.pageType : undefined;
30
-
31
- return next(action);
32
- }
33
- return next(action);
34
- };
35
-
36
- const middlewares = [middleware];
37
- export default middlewares;
1
+ import { getFetchClient } from '@strapi/helper-plugin';
2
+
3
+ import { PAGE_UID } from '../../../shared/utils/constants';
4
+ import getRequestUrl from '../utils/getRequestUrl';
5
+
6
+ const middleware =
7
+ () =>
8
+ ({ getState }: any) =>
9
+ (next: any) =>
10
+ async (action: any) => {
11
+ // If data is being fetched or after a save
12
+ if (
13
+ action.type === 'ContentManager/CrudReducer/GET_DATA_SUCCEEDED' ||
14
+ action.type === 'ContentManager/CrudReducer/SUBMIT_SUCCEEDED'
15
+ ) {
16
+ const store = getState();
17
+ const layoutSlice = store['content-manager_editViewLayoutManager'];
18
+ const uid = layoutSlice.currentLayout.contentType.uid;
19
+
20
+ if (uid !== PAGE_UID) {
21
+ return next(action);
22
+ }
23
+
24
+ const { get } = await getFetchClient();
25
+ const { data: pageData } = await get(`${getRequestUrl('page')}/${action.data.id}`);
26
+
27
+ action.data.collectionTypeTitle = pageData?.collectionTypeData?.title;
28
+ action.data.collectionTypeId = pageData?.collectionTypeData?.id;
29
+ action.data.initialPageType = pageData?.pageType ? pageData.pageType : undefined;
30
+
31
+ return next(action);
32
+ }
33
+ return next(action);
34
+ };
35
+
36
+ const middlewares = [middleware];
37
+ export default middlewares;
@@ -1,5 +1,5 @@
1
- import pluginPkg from '../../package.json';
2
-
3
- const pluginId = pluginPkg.strapi.name;
4
-
5
- export default pluginId;
1
+ import pluginPkg from '../../package.json';
2
+
3
+ const pluginId = pluginPkg.strapi.name;
4
+
5
+ export default pluginId;
@@ -1,6 +1,6 @@
1
- {
2
- "template.confirmModal.title": "Replace all page modules",
3
- "template.confirmModal.body": "You are about to replace all modules on this page. Are you sure you want to continue?",
4
- "template.confirmModal.buttons.cancel": "No, cancel",
5
- "template.confirmModal.buttons.submit": "Yes, replace all"
6
- }
1
+ {
2
+ "template.confirmModal.title": "Replace all page modules",
3
+ "template.confirmModal.body": "You are about to replace all modules on this page. Are you sure you want to continue?",
4
+ "template.confirmModal.buttons.cancel": "No, cancel",
5
+ "template.confirmModal.buttons.submit": "Yes, replace all"
6
+ }
@@ -1,6 +1,6 @@
1
- {
2
- "template.confirmModal.title": "Pagina modules vervangen",
3
- "template.confirmModal.body": "Weet je zeker dat je alle modules op deze pagina wilt vervangen?",
4
- "template.confirmModal.buttons.cancel": "Nee, annuleer",
5
- "template.confirmModal.buttons.submit": "Ja, vervang modules"
6
- }
1
+ {
2
+ "template.confirmModal.title": "Pagina modules vervangen",
3
+ "template.confirmModal.body": "Weet je zeker dat je alle modules op deze pagina wilt vervangen?",
4
+ "template.confirmModal.buttons.cancel": "Nee, annuleer",
5
+ "template.confirmModal.buttons.submit": "Ja, vervang modules"
6
+ }
@@ -1,11 +1,11 @@
1
- import pluginId from '../pluginId';
2
-
3
- const getRequestUrl = (path: string) => {
4
- if (path.startsWith('/')) {
5
- return `/${pluginId}${path}`;
6
- }
7
-
8
- return `/${pluginId}/${path}`;
9
- };
10
-
11
- export default getRequestUrl;
1
+ import pluginId from '../pluginId';
2
+
3
+ const getRequestUrl = (path: string) => {
4
+ if (path.startsWith('/')) {
5
+ return `/${pluginId}${path}`;
6
+ }
7
+
8
+ return `/${pluginId}/${path}`;
9
+ };
10
+
11
+ export default getRequestUrl;
@@ -1,5 +1,5 @@
1
- import pluginId from '../pluginId';
2
-
3
- const getTrad = (id: string) => `${pluginId}.${id}`;
4
-
5
- export default getTrad;
1
+ import pluginId from '../pluginId';
2
+
3
+ const getTrad = (id: string) => `${pluginId}.${id}`;
4
+
5
+ export default getTrad;
@@ -1,17 +1,17 @@
1
- import React from 'react';
2
-
3
- export function useDebounce<T>(value: T, delay: number): T {
4
- const [debouncedValue, setDebouncedValue] = React.useState(value);
5
-
6
- React.useEffect(() => {
7
- const handler = setTimeout(() => {
8
- setDebouncedValue(value);
9
- }, delay);
10
-
11
- return () => {
12
- clearTimeout(handler);
13
- };
14
- }, [value, delay]);
15
-
16
- return debouncedValue;
17
- }
1
+ import React from 'react';
2
+
3
+ export function useDebounce<T>(value: T, delay: number): T {
4
+ const [debouncedValue, setDebouncedValue] = React.useState(value);
5
+
6
+ React.useEffect(() => {
7
+ const handler = setTimeout(() => {
8
+ setDebouncedValue(value);
9
+ }, delay);
10
+
11
+ return () => {
12
+ clearTimeout(handler);
13
+ };
14
+ }, [value, delay]);
15
+
16
+ return debouncedValue;
17
+ }
@@ -1,9 +1,9 @@
1
- import { useQueryParams } from '@strapi/helper-plugin';
2
-
3
- const useGetLocaleFromUrl = () => {
4
- const [{ query }] = useQueryParams();
5
-
6
- return query?.plugins?.i18n?.locale;
7
- };
8
-
9
- export { useGetLocaleFromUrl };
1
+ import { useQueryParams } from '@strapi/helper-plugin';
2
+
3
+ const useGetLocaleFromUrl = () => {
4
+ const [{ query }] = useQueryParams() as any;
5
+
6
+ return query?.plugins?.i18n?.locale;
7
+ };
8
+
9
+ export { useGetLocaleFromUrl };
@@ -1,12 +1,12 @@
1
- import { useRef, useEffect } from 'react';
2
-
3
- // Hook
4
- export const usePrevious = <T>(value: T): T | null => {
5
- const ref: React.MutableRefObject<T | null> = useRef(null);
6
-
7
- useEffect(() => {
8
- ref.current = value;
9
- }, [value]);
10
-
11
- return ref.current;
12
- };
1
+ import { useRef, useEffect } from 'react';
2
+
3
+ // Hook
4
+ export const usePrevious = <T>(value: T): T | null => {
5
+ const ref: React.MutableRefObject<T | null> = useRef(null);
6
+
7
+ useEffect(() => {
8
+ ref.current = value;
9
+ }, [value]);
10
+
11
+ return ref.current;
12
+ };
@@ -1,10 +1,43 @@
1
- export const sanitizeModules = (modules: Record<string, any>[]) => {
2
- return modules?.map((module, idx) => {
3
- delete module.id;
4
-
5
- return {
6
- ...module,
7
- __temp_key__: idx
8
- };
9
- });
10
- };
1
+ export const sanitizeModules = (modules: Record<string, any>[]) =>
2
+ modules?.map((module, idx) => {
3
+ try {
4
+ const sanitizedModule = sanitizeObject(module, idx);
5
+
6
+ const result = {
7
+ ...sanitizedModule
8
+ };
9
+
10
+ return result;
11
+ } catch (e) {
12
+ console.log('ERROR IN SANITIZE MODULES', e);
13
+ }
14
+ });
15
+
16
+ function sanitizeObject(obj: any, idx: number): any {
17
+ for (let key in obj) {
18
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
19
+ sanitizeObject(obj[key], idx);
20
+ }
21
+ }
22
+
23
+ if (obj.hasOwnProperty('id') && !obj.hasOwnProperty('createdAt')) {
24
+ obj['__temp_key__'] = idx;
25
+ delete obj['id'];
26
+ }
27
+
28
+ if (obj.hasOwnProperty('defaultModuleOptions') && !obj.hasOwnProperty('createdAt')) {
29
+ delete obj['defaultModuleOptions'].id;
30
+ obj['defaultModuleOptions'] = {
31
+ ...obj['defaultModuleOptions'],
32
+ spacing: JSON.stringify(obj['defaultModuleOptions'].spacing),
33
+ __temp_key__: idx
34
+ };
35
+ }
36
+
37
+ if (obj.hasOwnProperty('name') && !obj.hasOwnProperty('mainField') && !obj.hasOwnProperty('label')) {
38
+ obj['label'] = obj['name'];
39
+ obj['mainField'] = obj['name'];
40
+ }
41
+
42
+ return obj;
43
+ }
package/custom.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- declare module '@strapi/design-system/*';
2
- declare module '@strapi/design-system';
3
- declare module '@strapi/icons';
4
- declare module '@strapi/icons/*';
5
- declare module '@strapi/helper-plugin';
1
+ declare module '@strapi/design-system/*';
2
+ declare module '@strapi/design-system';
3
+ declare module '@strapi/icons';
4
+ declare module '@strapi/icons/*';
5
+ declare module '@strapi/helper-plugin';
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webbio/strapi-plugin-page-builder",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "This is the description of the plugin.",
5
5
  "scripts": {
6
6
  "develop": "tsc -p tsconfig.server.json -w",
@@ -20,15 +20,15 @@
20
20
  "url": "https://github.com/webbio/strapi-plugin-page-builder.git"
21
21
  },
22
22
  "dependencies": {
23
- "@strapi/design-system": "^1.11.0",
24
- "@strapi/helper-plugin": "^4.13.6",
23
+ "@strapi/design-system": "^1.13.1",
24
+ "@strapi/helper-plugin": "<4.15.0",
25
25
  "@strapi/icons": "^1.11.0",
26
- "@strapi/typescript-utils": "^4.13.6",
27
- "@strapi/utils": "^4.13.6",
26
+ "@strapi/typescript-utils": "<4.15.0",
27
+ "@strapi/utils": "<4.15.0",
28
28
  "react-select": "^5.7.4"
29
29
  },
30
30
  "devDependencies": {
31
- "@strapi/typescript-utils": "^4.13.6",
31
+ "@strapi/typescript-utils": "<4.15.0",
32
32
  "@types/react": "^18.2.21",
33
33
  "@types/react-dom": "^18.2.7",
34
34
  "@types/react-router-dom": "^5.3.3",
@@ -40,8 +40,8 @@
40
40
  "typescript": "5.1.6"
41
41
  },
42
42
  "peerDependencies": {
43
- "@strapi/strapi": "^4.13.6",
44
- "@webbio/strapi-plugin-slug": "^2.0.2",
43
+ "@strapi/strapi": "<4.15.0",
44
+ "@webbio/strapi-plugin-slug": "^2.0.5",
45
45
  "react": "^17.0.0 || ^18.0.0",
46
46
  "react-dom": "^17.0.0 || ^18.0.0",
47
47
  "react-router-dom": "^5.3.4",
@@ -60,7 +60,7 @@
60
60
  }
61
61
  ],
62
62
  "engines": {
63
- "node": ">=14.19.1 <=18.x.x",
63
+ "node": ">=14.19.1 <=20.x.x",
64
64
  "npm": ">=6.0.0"
65
65
  },
66
66
  "license": "MIT",
@@ -4,15 +4,15 @@ const filter_underscore_arguments_1 = require("../utils/filter-underscore-argume
4
4
  const constants_1 = require("../../shared/utils/constants");
5
5
  const getPageBySlug = (strapi) => {
6
6
  const typeDefs = () => {
7
- return `
8
- extend type Page {
9
- collectionType: GenericMorph
10
- }
11
-
12
- type Query {
13
- getPageBySlug(path: String, _locale: String, _publicationState: PublicationState): PageEntity
14
- }
15
-
7
+ return `
8
+ extend type Page {
9
+ collectionType: GenericMorph
10
+ }
11
+
12
+ type Query {
13
+ getPageBySlug(path: String, _locale: String, _publicationState: PublicationState): PageEntity
14
+ }
15
+
16
16
  `;
17
17
  };
18
18
  const resolvers = (strapi) => {
@@ -7,22 +7,22 @@ const getPageInfoFromUID = (strapi) => {
7
7
  // @ts-ignore service does exist
8
8
  const collectionTypes = strapi.service('plugin::page-builder.collection-types').withPageMorph();
9
9
  const typeDefs = () => {
10
- const metaInfo = `type MetaInfo {
11
- total: Int
12
- page: Int
13
- pageCount: Int
14
- pageSize: Int
10
+ const metaInfo = `type MetaInfo {
11
+ total: Int
12
+ page: Int
13
+ pageCount: Int
14
+ pageSize: Int
15
15
  }`;
16
16
  const entityInfo = collectionTypes.map((collectionType) => {
17
- return `
18
- extend type ${collectionType.type}EntityResponseCollection {
19
- metaInfo: MetaInfo
20
- }
21
-
22
- type Query {
23
- get${collectionType.type}Pages(filters: ${collectionType.type}FiltersInput,pagination: PaginationArg, sort:[String], pageFilters: PageFiltersInput): ${collectionType.type}EntityResponseCollection
24
- }
25
-
17
+ return `
18
+ extend type ${collectionType.type}EntityResponseCollection {
19
+ metaInfo: MetaInfo
20
+ }
21
+
22
+ type Query {
23
+ get${collectionType.type}Pages(filters: ${collectionType.type}FiltersInput,pagination: PaginationArg, sort:[String], pageFilters: PageFiltersInput): ${collectionType.type}EntityResponseCollection
24
+ }
25
+
26
26
  `;
27
27
  });
28
28
  return `${metaInfo} ${entityInfo}`;
@@ -92,12 +92,12 @@ exports.default = {
92
92
  return { uid: constants_1.TEMPLATE_UID, contentType };
93
93
  },
94
94
  mergeCollectionTypeWithModules(collectionType, uid) {
95
- var _a;
95
+ var _a, _b, _c, _d, _e, _f;
96
96
  const { pluginOptions: oldPluginOptions, __schema__: oldSchema } = strapi.contentType(uid) || {};
97
- const components = this.getConfigModuleComponents();
97
+ const modulesFromConfig = ((_a = oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.attributes) === null || _a === void 0 ? void 0 : _a.modules) ? this.getConfigModuleComponents() : undefined;
98
98
  return {
99
99
  ...collectionType,
100
- displayName: ((_a = oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.info) === null || _a === void 0 ? void 0 : _a.displayName) || (collectionType === null || collectionType === void 0 ? void 0 : collectionType.displayName),
100
+ displayName: ((_b = oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.info) === null || _b === void 0 ? void 0 : _b.displayName) || (collectionType === null || collectionType === void 0 ? void 0 : collectionType.displayName),
101
101
  pluginOptions: {
102
102
  ...oldPluginOptions,
103
103
  ...collectionType === null || collectionType === void 0 ? void 0 : collectionType.pluginOptions
@@ -105,7 +105,10 @@ exports.default = {
105
105
  attributes: {
106
106
  ...oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.attributes,
107
107
  ...collectionType.attributes,
108
- modules: { ...collectionType.attributes.modules, components }
108
+ ...(((((_c = collectionType === null || collectionType === void 0 ? void 0 : collectionType.attributes) === null || _c === void 0 ? void 0 : _c.modules) && ((_e = (_d = collectionType === null || collectionType === void 0 ? void 0 : collectionType.attributes) === null || _d === void 0 ? void 0 : _d.modules) === null || _e === void 0 ? void 0 : _e.length) > 0) ||
109
+ modulesFromConfig) && {
110
+ modules: { ...(_f = collectionType === null || collectionType === void 0 ? void 0 : collectionType.attributes) === null || _f === void 0 ? void 0 : _f.modules, components: modulesFromConfig }
111
+ })
109
112
  }
110
113
  };
111
114
  },
@@ -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
  };
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.registerGraphQLResolvers = void 0;
4
4
  const constants_1 = require("../../shared/utils/constants");
5
5
  const findPageByPath = (strapi) => {
6
- const typeDefs = `
7
- type Query {
8
- findPageByPath(path: String, locale: I18NLocaleCode): PageEntityResponse
9
- }
6
+ const typeDefs = `
7
+ type Query {
8
+ findPageByPath(path: String, locale: I18NLocaleCode): PageEntityResponse
9
+ }
10
10
  `;
11
11
  const resolvers = (strapi) => {
12
12
  const { transformArgs } = strapi.plugin('graphql').service('builders').utils;
@@ -47,20 +47,20 @@ const findPageByPath = (strapi) => {
47
47
  };
48
48
  };
49
49
  const findPagePaths = (strapi) => {
50
- const typeDefs = `
51
- type PageByPath {
52
- id: Int!
53
- path: String!
54
- title: String!
55
- locale: String!
56
- pageType: ENUM_PAGE_PAGETYPE
57
- updatedAt: DateTime!
58
- publishedAt: DateTime!
59
- }
60
-
61
- type Query {
62
- findPagePaths(locale: String, pageType: String = "all"): [PageByPath]
63
- }
50
+ const typeDefs = `
51
+ type PageByPath {
52
+ id: Int!
53
+ path: String!
54
+ title: String!
55
+ locale: String!
56
+ pageType: ENUM_PAGE_PAGETYPE
57
+ updatedAt: DateTime!
58
+ publishedAt: DateTime!
59
+ }
60
+
61
+ type Query {
62
+ findPagePaths(locale: String, pageType: String = "all"): [PageByPath]
63
+ }
64
64
  `;
65
65
  const resolvers = (strapi) => {
66
66
  const { transformArgs } = strapi.plugin('graphql').service('builders').utils;
@@ -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') {