@webbio/strapi-plugin-page-builder 0.0.11 → 0.0.12

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 (102) hide show
  1. package/dist/admin/src/pluginId.js +8 -0
  2. package/dist/package.json +71 -0
  3. package/dist/server/bootstrap.js +95 -0
  4. package/dist/server/config/index.js +6 -0
  5. package/dist/server/content-types/index.js +3 -0
  6. package/dist/server/controllers/collection-types.js +19 -0
  7. package/dist/server/controllers/index.js +13 -0
  8. package/dist/server/controllers/page-type.js +13 -0
  9. package/dist/server/controllers/page.js +17 -0
  10. package/dist/server/destroy.js +5 -0
  11. package/dist/server/index.js +27 -0
  12. package/dist/server/middlewares/index.js +3 -0
  13. package/dist/server/policies/index.js +3 -0
  14. package/dist/server/register.js +6 -0
  15. package/dist/server/routes/index.js +43 -0
  16. package/dist/server/schema/page-end.json +97 -0
  17. package/dist/server/schema/page-start.json +87 -0
  18. package/dist/server/schema/page-type-end.json +49 -0
  19. package/dist/server/schema/page-type-start.json +44 -0
  20. package/dist/server/schema/template.json +35 -0
  21. package/dist/server/services/builder.js +97 -0
  22. package/dist/server/services/collection-types.js +46 -0
  23. package/dist/server/services/index.js +15 -0
  24. package/dist/server/services/page-type.js +24 -0
  25. package/dist/server/services/page.js +25 -0
  26. package/dist/server/utils/graphql.js +97 -0
  27. package/dist/server/utils/reload-strapi-on-load.js +12 -0
  28. package/dist/shared/utils/constants.js +7 -0
  29. package/dist/tsconfig.server.tsbuildinfo +1 -0
  30. package/package.json +5 -1
  31. package/.prettierignore +0 -17
  32. package/admin/src/api/collection-type.ts +0 -110
  33. package/admin/src/api/has-page-relation.ts +0 -34
  34. package/admin/src/api/page-type.ts +0 -31
  35. package/admin/src/api/template.ts +0 -25
  36. package/admin/src/components/Combobox/index.tsx +0 -77
  37. package/admin/src/components/Combobox/react-select-custom-styles.tsx +0 -111
  38. package/admin/src/components/Combobox/styles.ts +0 -22
  39. package/admin/src/components/ConfirmModal/index.tsx +0 -90
  40. package/admin/src/components/EditView/CollectionTypeSearch/index.tsx +0 -118
  41. package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/index.tsx +0 -95
  42. package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/styles.ts +0 -26
  43. package/admin/src/components/EditView/CollectionTypeSettings/index.tsx +0 -53
  44. package/admin/src/components/EditView/Details/index.tsx +0 -47
  45. package/admin/src/components/EditView/Details/styles.ts +0 -51
  46. package/admin/src/components/EditView/PageSettings/index.tsx +0 -104
  47. package/admin/src/components/EditView/Template/TemplateConfirmModal/index.tsx +0 -36
  48. package/admin/src/components/EditView/Template/TemplateSelect/index.tsx +0 -64
  49. package/admin/src/components/EditView/Template/TemplateSelect/use-template-modules.ts +0 -30
  50. package/admin/src/components/EditView/index.tsx +0 -27
  51. package/admin/src/components/EditView/page-type-select.tsx +0 -30
  52. package/admin/src/components/EditView/wrapper.tsx +0 -35
  53. package/admin/src/components/Initializer/index.tsx +0 -24
  54. package/admin/src/components/PageTypeFilter/index.tsx +0 -17
  55. package/admin/src/components/PageTypeFilter/page-type-filter.tsx +0 -130
  56. package/admin/src/components/PluginIcon/index.tsx +0 -12
  57. package/admin/src/constants.ts +0 -1
  58. package/admin/src/index.tsx +0 -115
  59. package/admin/src/pages/App/index.tsx +0 -25
  60. package/admin/src/pages/HomePage/index.tsx +0 -19
  61. package/admin/src/pluginId.ts +0 -5
  62. package/admin/src/redux/initialData.reducer.ts +0 -0
  63. package/admin/src/translations/en.json +0 -6
  64. package/admin/src/translations/nl.json +0 -6
  65. package/admin/src/utils/getRequestUrl.ts +0 -11
  66. package/admin/src/utils/getTrad.ts +0 -5
  67. package/admin/src/utils/hooks/useDebounce.ts +0 -17
  68. package/admin/src/utils/hooks/useGetLocaleFromUrl.ts +0 -9
  69. package/admin/src/utils/hooks/usePrevious.ts +0 -12
  70. package/admin/src/utils/sanitizeModules.ts +0 -10
  71. package/custom.d.ts +0 -5
  72. package/server/bootstrap.ts +0 -106
  73. package/server/config/index.ts +0 -4
  74. package/server/content-types/index.ts +0 -1
  75. package/server/controllers/collection-types.ts +0 -27
  76. package/server/controllers/index.ts +0 -9
  77. package/server/controllers/page-type.ts +0 -12
  78. package/server/controllers/page.ts +0 -20
  79. package/server/destroy.ts +0 -5
  80. package/server/index.ts +0 -23
  81. package/server/middlewares/index.ts +0 -1
  82. package/server/policies/index.ts +0 -1
  83. package/server/register.ts +0 -5
  84. package/server/routes/index.ts +0 -42
  85. package/server/schema/page-end.json +0 -97
  86. package/server/schema/page-start.json +0 -87
  87. package/server/schema/page-type-end.json +0 -49
  88. package/server/schema/page-type-start.json +0 -44
  89. package/server/schema/template.json +0 -35
  90. package/server/services/builder.ts +0 -121
  91. package/server/services/collection-types.ts +0 -49
  92. package/server/services/index.ts +0 -11
  93. package/server/services/page-type.ts +0 -22
  94. package/server/services/page.ts +0 -24
  95. package/server/utils/graphql.ts +0 -110
  96. package/server/utils/reload-strapi-on-load.ts +0 -13
  97. package/shared/utils/constants.ts +0 -4
  98. package/shared/utils/sleep.ts +0 -1
  99. package/strapi-admin.js +0 -3
  100. package/strapi-server.js +0 -3
  101. package/tsconfig.json +0 -20
  102. package/tsconfig.server.json +0 -25
@@ -1,42 +0,0 @@
1
- const routes = {
2
- 'page-type': {
3
- type: 'admin',
4
- prefix: undefined,
5
- routes: [
6
- {
7
- method: 'GET',
8
- path: '/page-types/:uid',
9
- handler: 'page-type.findOneByUid'
10
- }
11
- ]
12
- },
13
- page: {
14
- type: 'admin',
15
- prefix: undefined,
16
- routes: [
17
- {
18
- method: 'GET',
19
- path: '/page/:id',
20
- handler: 'page.getPage'
21
- }
22
- ]
23
- },
24
- 'collection-types': {
25
- type: 'admin',
26
- prefix: undefined,
27
- routes: [
28
- {
29
- method: 'GET',
30
- path: '/collection-types/:uid',
31
- handler: 'collection-types.hasPageRelation'
32
- },
33
- {
34
- method: 'GET',
35
- path: '/collection-types-page-links/:uid/:ids?',
36
- handler: 'collection-types.getTranslationPageLinks'
37
- }
38
- ]
39
- }
40
- };
41
-
42
- export default routes;
@@ -1,97 +0,0 @@
1
- {
2
- "draftAndPublish": true,
3
- "displayName": "Pagina's",
4
- "singularName": "page",
5
- "pluralName": "pages",
6
- "description": "",
7
- "plugin": "page-builder",
8
- "pluginOptions": {
9
- "i18n": {
10
- "localized": true
11
- }
12
- },
13
- "kind": "collectionType",
14
- "collectionName": "pages",
15
- "attributes": {
16
- "collectionTypeData": {
17
- "type": "relation",
18
- "relation": "morphToMany",
19
- "configurable": false
20
- },
21
- "title": {
22
- "pluginOptions": {
23
- "i18n": {
24
- "localized": true
25
- }
26
- },
27
- "type": "string",
28
- "required": true
29
- },
30
- "slug": {
31
- "pluginOptions": {
32
- "i18n": {
33
- "localized": true
34
- },
35
- "slug": {
36
- "field": "slug",
37
- "targetField": "title"
38
- }
39
- },
40
- "type": "customField",
41
- "customField": "plugin::slug.slug",
42
- "required": true
43
- },
44
- "path": {
45
- "pluginOptions": {
46
- "i18n": {
47
- "localized": true
48
- }
49
- },
50
- "type": "string",
51
- "required": false
52
- },
53
- "parent": {
54
- "type": "relation",
55
- "relation": "oneToOne",
56
- "target": "api::page.page",
57
- "private": false
58
- },
59
- "excerpt": {
60
- "pluginOptions": {
61
- "i18n": {
62
- "localized": true
63
- }
64
- },
65
- "type": "text"
66
- },
67
- "modules": {
68
- "pluginOptions": {
69
- "i18n": {
70
- "localized": true
71
- }
72
- },
73
- "type": "dynamiczone",
74
- "components": []
75
- },
76
- "seo": {
77
- "type": "component",
78
- "pluginOptions": {
79
- "i18n": {
80
- "localized": true
81
- }
82
- },
83
- "component": "shared.seo"
84
- },
85
- "template": {
86
- "relation": "manyToOne",
87
- "target": "api::template.template",
88
- "targetAttribute": "pages",
89
- "type": "relation"
90
- },
91
- "pageType": {
92
- "type": "relation",
93
- "relation": "oneToOne",
94
- "target": "api::page-type.page-type"
95
- }
96
- }
97
- }
@@ -1,87 +0,0 @@
1
- {
2
- "draftAndPublish": true,
3
- "displayName": "Pagina's",
4
- "singularName": "page",
5
- "pluralName": "pages",
6
- "description": "",
7
- "plugin": "page-builder",
8
- "pluginOptions": {
9
- "i18n": {
10
- "localized": true
11
- }
12
- },
13
- "kind": "collectionType",
14
- "collectionName": "pages",
15
- "attributes": {
16
- "collectionTypeData": {
17
- "type": "relation",
18
- "relation": "morphToMany",
19
- "configurable": false,
20
- "private": false
21
- },
22
- "title": {
23
- "pluginOptions": {
24
- "i18n": {
25
- "localized": true
26
- }
27
- },
28
- "type": "string",
29
- "required": true
30
- },
31
- "slug": {
32
- "pluginOptions": {
33
- "i18n": {
34
- "localized": true
35
- },
36
- "slug": {
37
- "field": "slug",
38
- "targetField": "title"
39
- }
40
- },
41
- "type": "customField",
42
- "customField": "plugin::slug.slug",
43
- "required": true
44
- },
45
- "path": {
46
- "pluginOptions": {
47
- "i18n": {
48
- "localized": true
49
- }
50
- },
51
- "type": "string",
52
- "required": false
53
- },
54
- "parent": {
55
- "type": "relation",
56
- "relation": "oneToOne",
57
- "target": "api::page.page",
58
- "private": false
59
- },
60
- "excerpt": {
61
- "pluginOptions": {
62
- "i18n": {
63
- "localized": true
64
- }
65
- },
66
- "type": "text"
67
- },
68
- "modules": {
69
- "pluginOptions": {
70
- "i18n": {
71
- "localized": true
72
- }
73
- },
74
- "type": "dynamiczone",
75
- "components": []
76
- },
77
- "seo": {
78
- "type": "component",
79
- "pluginOptions": {
80
- "i18n": {
81
- "localized": true
82
- }
83
- },
84
- "component": "shared.seo"
85
- }
86
- }
87
- }
@@ -1,49 +0,0 @@
1
- {
2
- "draftAndPublish": false,
3
- "displayName": "Pagina Types",
4
- "singularName": "page-type",
5
- "pluralName": "page-types",
6
- "description": "",
7
- "plugin": "page-builder",
8
- "pluginOptions": {
9
- "i18n": {
10
- "localized": true
11
- }
12
- },
13
- "kind": "collectionType",
14
- "collectionName": "page_types",
15
- "attributes": {
16
- "uid": {
17
- "type": "string",
18
- "required": true,
19
- "unique": true,
20
- "pluginOptions": {
21
- "i18n": {
22
- "localized": true
23
- }
24
- }
25
- },
26
- "title": {
27
- "type": "string",
28
- "pluginOptions": {
29
- "i18n": {
30
- "localized": true
31
- }
32
- }
33
- },
34
- "modules": {
35
- "type": "dynamiczone",
36
- "components": [],
37
- "pluginOptions": {
38
- "i18n": {
39
- "localized": true
40
- }
41
- }
42
- },
43
- "template": {
44
- "type": "relation",
45
- "relation": "oneToOne",
46
- "target": "api::template.template"
47
- }
48
- }
49
- }
@@ -1,44 +0,0 @@
1
- {
2
- "draftAndPublish": false,
3
- "displayName": "Pagina Types",
4
- "singularName": "page-type",
5
- "pluralName": "page-types",
6
- "description": "",
7
- "plugin": "page-builder",
8
- "pluginOptions": {
9
- "i18n": {
10
- "localized": true
11
- }
12
- },
13
- "kind": "collectionType",
14
- "collectionName": "page_types",
15
- "attributes": {
16
- "uid": {
17
- "type": "string",
18
- "required": true,
19
- "unique": true,
20
- "pluginOptions": {
21
- "i18n": {
22
- "localized": true
23
- }
24
- }
25
- },
26
- "title": {
27
- "type": "string",
28
- "pluginOptions": {
29
- "i18n": {
30
- "localized": true
31
- }
32
- }
33
- },
34
- "modules": {
35
- "type": "dynamiczone",
36
- "components": [],
37
- "pluginOptions": {
38
- "i18n": {
39
- "localized": true
40
- }
41
- }
42
- }
43
- }
44
- }
@@ -1,35 +0,0 @@
1
- {
2
- "draftAndPublish": false,
3
- "displayName": "Templates",
4
- "singularName": "template",
5
- "pluralName": "templates",
6
- "description": "",
7
- "plugin": "page-builder",
8
- "pluginOptions": {
9
- "i18n": {
10
- "localized": true
11
- }
12
- },
13
- "kind": "collectionType",
14
- "collectionName": "templates",
15
- "attributes": {
16
- "title": {
17
- "type": "string",
18
- "required": true,
19
- "pluginOptions": {
20
- "i18n": {
21
- "localized": true
22
- }
23
- }
24
- },
25
- "modules": {
26
- "type": "dynamiczone",
27
- "components": [],
28
- "pluginOptions": {
29
- "i18n": {
30
- "localized": true
31
- }
32
- }
33
- }
34
- }
35
- }
@@ -1,121 +0,0 @@
1
- import partition from 'lodash/partition';
2
-
3
- import { Service } from '@strapi/strapi/lib/types/core/common';
4
-
5
- import pageStart from '../schema/page-start.json';
6
- import pageEnd from '../schema/page-end.json';
7
- import pluginId from '../../admin/src/pluginId';
8
- import { PAGE_UID, TEMPLATE_UID, PAGE_TYPE_UID } from '../../shared/utils/constants';
9
- import { reloadStrapiOnLoad } from '../utils/reload-strapi-on-load';
10
- import pageTypeStart from '../schema/page-type-start.json';
11
- import pageTypeEnd from '../schema/page-type-end.json';
12
- import template from '../schema/template.json';
13
-
14
- const UIDS = [TEMPLATE_UID, PAGE_TYPE_UID, PAGE_UID];
15
-
16
- export default {
17
- async buildContentTypes() {
18
- this.listenToCreatedContentTypes();
19
-
20
- await this.createContentTypes();
21
-
22
- await this.updateContentTypes();
23
- },
24
- listenToCreatedContentTypes() {
25
- strapi.eventHub.on('content-type.create', async (e) => {
26
- if (e.contentType.uid === PAGE_UID) {
27
- reloadStrapiOnLoad();
28
- }
29
- });
30
- },
31
-
32
- async createContentTypes() {
33
- const newContentTypes = UIDS.filter((c) => !Boolean(strapi.contentType(c))).map(
34
- (c) => this.getContentType(c)?.create
35
- );
36
-
37
- await this.synchronizeContentTypes(newContentTypes);
38
- },
39
- async updateContentTypes() {
40
- const updateContentTypes = UIDS.filter((c) => Boolean(strapi.contentType(c))).map(
41
- (c) => this.getContentType(c).update
42
- );
43
-
44
- await this.synchronizeContentTypes(updateContentTypes);
45
- },
46
- async synchronizeContentTypes(contentTypes: { uid: string; contentType: Record<string, any> }[]) {
47
- const ctb = strapi.service('plugin::content-type-builder.content-types') as Service;
48
-
49
- const [oldTypes, newTypes] = partition(contentTypes, (c) => Boolean(strapi.contentType(c.uid)));
50
-
51
- if (newTypes.length > 0) {
52
- console.log(
53
- '[Plugin Page Builder]: Creating content types',
54
- newTypes.map((x) => x.uid)
55
- );
56
- }
57
-
58
- if (oldTypes.length > 0) {
59
- console.log(
60
- '[Plugin Page Builder]: Updating content types',
61
- oldTypes.map((x) => x.uid)
62
- );
63
- }
64
-
65
- if ((newTypes || []).length > 0) {
66
- await ctb.createContentTypes(newTypes.map((c) => ({ contentType: c.contentType, components: [] })));
67
- }
68
-
69
- if ((oldTypes || []).length > 0) {
70
- for (const oldType of oldTypes) {
71
- await ctb.editContentType(oldType.uid, { contentType: oldType.contentType, components: [] });
72
- }
73
- }
74
- },
75
- getContentType(uid: string) {
76
- const contentTypes = {
77
- [PAGE_UID]: {
78
- create: this.getPageContentType(true),
79
- update: this.getPageContentType()
80
- },
81
- [PAGE_TYPE_UID]: {
82
- create: this.getPageTypeContentType(true),
83
- update: this.getPageTypeContentType()
84
- },
85
- [TEMPLATE_UID]: {
86
- create: this.getTemplateContentType(),
87
- update: this.getTemplateContentType()
88
- }
89
- };
90
-
91
- return contentTypes?.[uid];
92
- },
93
- getPageContentType(create?: boolean) {
94
- const page = create ? pageStart : pageEnd;
95
- const contentType = this.addModulesToCollectionType(page);
96
-
97
- return { uid: PAGE_UID, contentType };
98
- },
99
- getPageTypeContentType(create?: boolean) {
100
- const pageType = create ? pageTypeStart : pageTypeEnd;
101
- const contentType = this.addModulesToCollectionType(pageType);
102
-
103
- return { uid: PAGE_TYPE_UID, contentType };
104
- },
105
- getTemplateContentType() {
106
- const contentType = this.addModulesToCollectionType(template);
107
-
108
- return { uid: TEMPLATE_UID, contentType };
109
- },
110
- addModulesToCollectionType(collectionType: Record<string, any>) {
111
- const components = this.getConfigModuleComponents();
112
-
113
- return {
114
- ...collectionType,
115
- attributes: { ...collectionType.attributes, modules: { ...collectionType.attributes.modules, components } }
116
- };
117
- },
118
- getConfigModuleComponents() {
119
- return (strapi.config.get(`plugin.${pluginId}`)?.modules || []).filter(Boolean);
120
- }
121
- };
@@ -1,49 +0,0 @@
1
- import { Strapi } from '@strapi/strapi';
2
- import uniqBy from 'lodash/uniqBy';
3
-
4
- import { IGetTranslationPageLinks } from '../controllers/collection-types';
5
-
6
- export default {
7
- async hasPageRelation(uid: string): Promise<{ hasPageRelation: boolean }> {
8
- const contentType = strapi.contentTypes?.[uid];
9
-
10
- return {
11
- hasPageRelation: Boolean(
12
- contentType?.attributes?.page && contentType?.attributes?.page?.morphBy === 'collectionTypeData'
13
- )
14
- };
15
- },
16
- async getTranslationPageLinks(uid: string, ids: string[]) {
17
- try {
18
- const entities = await (strapi as Strapi).entityService.findMany(uid, {
19
- filters: {
20
- id: { $in: ids }
21
- },
22
- populate: {
23
- page: {
24
- populate: {
25
- localizations: true
26
- }
27
- }
28
- }
29
- });
30
-
31
- let pages: IGetTranslationPageLinks[] = [];
32
-
33
- // Get all pages linked to the entity
34
- entities?.forEach((x: any) => {
35
- x?.page?.forEach((p: any) => {
36
- pages.push({ id: p.id, locale: p.locale });
37
-
38
- p.localizations.forEach((l: any) => {
39
- pages.push({ id: l.id, locale: l.locale });
40
- });
41
- });
42
- });
43
-
44
- return uniqBy(pages, 'id');
45
- } catch {
46
- return [];
47
- }
48
- }
49
- };
@@ -1,11 +0,0 @@
1
- import page from './page';
2
- import builder from './builder';
3
- import pageType from './page-type';
4
- import collectionTypes from './collection-types';
5
-
6
- export default {
7
- page,
8
- builder,
9
- 'page-type': pageType,
10
- 'collection-types': collectionTypes
11
- };
@@ -1,22 +0,0 @@
1
- export default {
2
- async findOneByUid(uid: string) {
3
- const result = await strapi.entityService.findMany('api::page-type.page-type', {
4
- populate: {
5
- template: {
6
- populate: {
7
- modules: true
8
- }
9
- }
10
- },
11
- filters: {
12
- uid
13
- }
14
- });
15
-
16
- if (result.length > 0) {
17
- return result[0];
18
- } else {
19
- return null;
20
- }
21
- }
22
- };
@@ -1,24 +0,0 @@
1
- import { PAGE_UID } from '../../shared/utils/constants';
2
-
3
- export default {
4
- async getPage(id: string) {
5
- // @ts-ignore
6
- const page = await strapi.db.query(PAGE_UID).findOne({
7
- // @ts-ignore
8
- select: 'id',
9
- populate: {
10
- // @ts-ignore
11
- collectionTypeData: true,
12
- pageType: true
13
- },
14
- where: {
15
- id
16
- }
17
- });
18
-
19
- return {
20
- pageType: page.pageType,
21
- collectionTypeData: page.collectionTypeData?.[0] ?? null
22
- };
23
- }
24
- };
@@ -1,110 +0,0 @@
1
- import { Strapi } from '@strapi/strapi';
2
- import { PAGE_UID } from '../../shared/utils/constants';
3
-
4
- const findPageByPath = (strapi: Strapi) => {
5
- const typeDefs = `
6
- type Query {
7
- findPageByPath(path: String, locale: I18NLocaleCode): PageEntityResponse
8
- }
9
- `;
10
-
11
- const resolvers = (strapi: Strapi) => {
12
- const { transformArgs } = strapi.plugin('graphql').service('builders').utils;
13
- const { toEntityResponse, toEntityResponseCollection } = strapi.plugin('graphql').service('format').returnTypes;
14
-
15
- return {
16
- Query: {
17
- findPageByPath: {
18
- resolve: async (parent: any, args: Record<string, any>, ctx: any) => {
19
- const contentType = strapi.getModel(PAGE_UID);
20
- const transformedArgs = transformArgs(args, { contentType });
21
-
22
- const queryResult = await strapi.entityService.findMany(contentType.uid, {
23
- filters: {
24
- path: {
25
- $eq: transformedArgs.path
26
- }
27
- },
28
- locale: transformedArgs.locale
29
- });
30
-
31
- const result = queryResult?.[0];
32
- return toEntityResponse(result, { args: transformedArgs, resourceUID: contentType.uid });
33
- }
34
- }
35
- }
36
- };
37
- };
38
-
39
- const resolversConfig = {
40
- 'Query.findPageByPath': {
41
- auth: false
42
- }
43
- };
44
-
45
- return {
46
- typeDefs,
47
- resolvers: resolvers(strapi),
48
- resolversConfig
49
- };
50
- };
51
-
52
- const findPagePaths = (strapi: Strapi) => {
53
- const typeDefs = `
54
- type PageByPath {
55
- id: Int!
56
- path: String!
57
- title: String!
58
- locale: String!
59
- pageType: ENUM_PAGE_PAGETYPE
60
- updatedAt: DateTime!
61
- publishedAt: DateTime!
62
- }
63
-
64
- type Query {
65
- findPagePaths(locale: String, pageType: String = "all"): [PageByPath]
66
- }
67
- `;
68
-
69
- const resolvers = (strapi: Strapi) => {
70
- const { transformArgs } = strapi.plugin('graphql').service('builders').utils;
71
-
72
- return {
73
- Query: {
74
- findPagePaths: {
75
- resolve: async (parent: any, args: Record<string, any>, ctx: any) => {
76
- const contentType = strapi.getModel(PAGE_UID);
77
- const transformedArgs = transformArgs(args, { contentType });
78
-
79
- const queryResult = await strapi.entityService.findMany(contentType.uid, {
80
- populate: '*',
81
- locale: transformedArgs.locale
82
- });
83
-
84
- const result = queryResult.filter((page) => page?.path);
85
-
86
- return result;
87
- }
88
- }
89
- }
90
- };
91
- };
92
-
93
- const resolversConfig = {
94
- 'Query.findPagePaths': {
95
- auth: false
96
- }
97
- };
98
-
99
- return {
100
- typeDefs,
101
- resolvers: resolvers(strapi),
102
- resolversConfig
103
- };
104
- };
105
-
106
- export const registerGraphQLResolvers = (strapi: Strapi) => {
107
- const extensionService = strapi.plugin('graphql').service('extension');
108
- extensionService.use(findPageByPath(strapi));
109
- extensionService.use(findPagePaths(strapi));
110
- };