@webbio/strapi-plugin-page-builder 0.6.0-platform → 0.8.0-platform
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/admin/src/api/has-page-relation.ts +1 -1
- package/admin/src/api/has-platform-relation.ts +1 -1
- package/admin/src/api/platform-page-types.ts +17 -19
- package/admin/src/api/platform.ts +2 -2
- package/admin/src/api/search-filtered-entity.ts +111 -0
- package/admin/src/api/template.ts +10 -7
- package/admin/src/components/Combobox/index.tsx +8 -6
- package/admin/src/components/Combobox/styles.ts +13 -1
- package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/index.tsx +6 -2
- package/admin/src/components/EditView/Details/index.tsx +1 -1
- package/admin/src/components/EditView/PageSettings/index.tsx +1 -1
- package/admin/src/components/EditView/Template/TemplateSelect/index.tsx +3 -2
- package/admin/src/components/EditView/Template/TemplateSelect/use-template-modules.ts +5 -2
- package/admin/src/components/EditView/page-type-select.tsx +1 -1
- package/admin/src/components/EditView/wrapper.tsx +13 -7
- package/admin/src/components/GlobalPlatformSelect/index.tsx +0 -1
- package/admin/src/components/PageFilters/PageTypeFilter/index.tsx +1 -1
- package/admin/src/components/PageFilters/filters.tsx +1 -1
- package/admin/src/components/PageFilters/index.tsx +6 -1
- package/admin/src/components/PageTypeEditView/PageByPlatformSelect/index.tsx +112 -0
- package/admin/src/components/PageTypeEditView/TemplatePlatformSelect/index.tsx +55 -0
- package/admin/src/components/PageTypeEditView/index.tsx +28 -0
- package/admin/src/components/PlatformFilteredSelectField/InputIcon/index.tsx +23 -0
- package/admin/src/components/PlatformFilteredSelectField/Multi/index.tsx +191 -0
- package/admin/src/components/PlatformFilteredSelectField/Single/index.tsx +184 -0
- package/admin/src/components/PlatformFilteredSelectField/hooks/useRelationLoad.tsx +124 -0
- package/admin/src/components/PlatformFilteredSelectField/index.tsx +43 -0
- package/admin/src/components/PlatformFilteredSelectField/styles.tsx +77 -0
- package/admin/src/components/PlatformFilteredSelectField/utils/get-translations.ts +3 -0
- package/admin/src/components/PlatformFilteredSelectField/utils/relation-helper.ts +76 -0
- package/admin/src/index.tsx +26 -0
- package/admin/src/translations/en.json +4 -1
- package/admin/src/translations/nl.json +4 -1
- package/admin/src/utils/getObjectFromFormName.ts +31 -0
- package/admin/src/utils/hooks/usePlatformFormData.ts +1 -0
- package/dist/package.json +3 -3
- package/dist/server/controllers/page-type.js +6 -2
- package/dist/server/register.js +5 -0
- package/dist/server/routes/index.js +1 -1
- package/dist/server/schema/page-type-end.json +15 -5
- package/dist/server/schema/platform-start.json +0 -10
- package/dist/server/schema/template-end.json +40 -0
- package/dist/server/services/builder.js +4 -3
- package/dist/server/services/page-type.js +7 -3
- package/dist/tsconfig.server.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/server/controllers/page-type.ts +6 -1
- package/server/register.ts +6 -0
- package/server/routes/index.ts +1 -1
- package/server/schema/page-type-end.json +15 -5
- package/server/schema/platform-start.json +0 -10
- package/server/schema/template-end.json +40 -0
- package/server/services/builder.ts +4 -3
- package/server/services/page-type.ts +7 -3
- package/admin/src/api/page-type.ts +0 -32
- package/dist/server/graphql/page-by-slug.js +0 -82
- package/dist/server/utils/graphql.js +0 -100
- package/dist/server/utils/paginationValidation.js +0 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webbio/strapi-plugin-page-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-platform",
|
|
4
4
|
"description": "This is the description of the plugin.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"develop": "tsc -p tsconfig.server.json -w",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@strapi/strapi": "^4.15.0",
|
|
45
|
-
"@webbio/strapi-plugin-slug": "^
|
|
45
|
+
"@webbio/strapi-plugin-slug": "^3.0.0",
|
|
46
46
|
"react": "^17.0.0 || ^18.0.0",
|
|
47
47
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
48
48
|
"react-router-dom": "^5.3.4",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
}
|
|
62
62
|
],
|
|
63
63
|
"engines": {
|
|
64
|
-
"node": ">=14.19.1 <=
|
|
64
|
+
"node": ">=14.19.1 <=20.x.x",
|
|
65
65
|
"npm": ">=6.0.0"
|
|
66
66
|
},
|
|
67
67
|
"license": "MIT",
|
|
@@ -3,11 +3,16 @@ import { Strapi } from '@strapi/strapi';
|
|
|
3
3
|
export default {
|
|
4
4
|
async findOneByUid(ctx: any) {
|
|
5
5
|
const uid = ctx?.params?.uid;
|
|
6
|
+
const platformId = ctx?.params?.platformId;
|
|
6
7
|
|
|
7
8
|
if (!uid) {
|
|
8
9
|
return ctx.badRequest('uid is missing.');
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
if (!platformId) {
|
|
13
|
+
return ctx.badRequest('PlatformId is missing.');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return await (strapi as Strapi).service('plugin::page-builder.page-type').findOneByUid(uid, platformId);
|
|
12
17
|
}
|
|
13
18
|
};
|
package/server/register.ts
CHANGED
|
@@ -5,6 +5,12 @@ import pageType from './graphql/page-type';
|
|
|
5
5
|
import getPageInfoFromUID from './graphql/pages-by-uid';
|
|
6
6
|
|
|
7
7
|
export default async ({ strapi }: { strapi: Strapi }) => {
|
|
8
|
+
strapi.customFields.register({
|
|
9
|
+
name: 'filtered-select',
|
|
10
|
+
plugin: 'page-builder',
|
|
11
|
+
type: 'string'
|
|
12
|
+
});
|
|
13
|
+
|
|
8
14
|
const extensionService = strapi.plugin('graphql').service('extension');
|
|
9
15
|
|
|
10
16
|
extensionService.use(pageType);
|
package/server/routes/index.ts
CHANGED
|
@@ -25,6 +25,21 @@
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
+
"template": {
|
|
29
|
+
"type": "relation",
|
|
30
|
+
"relation": "oneToOne",
|
|
31
|
+
"target": "api::template.template"
|
|
32
|
+
},
|
|
33
|
+
"platform": {
|
|
34
|
+
"type": "relation",
|
|
35
|
+
"relation": "oneToOne",
|
|
36
|
+
"target": "api::platform.platform"
|
|
37
|
+
},
|
|
38
|
+
"defaultParent": {
|
|
39
|
+
"type": "relation",
|
|
40
|
+
"relation": "oneToOne",
|
|
41
|
+
"target": "api::page.page"
|
|
42
|
+
},
|
|
28
43
|
"modules": {
|
|
29
44
|
"type": "dynamiczone",
|
|
30
45
|
"components": [],
|
|
@@ -33,11 +48,6 @@
|
|
|
33
48
|
"localized": true
|
|
34
49
|
}
|
|
35
50
|
}
|
|
36
|
-
},
|
|
37
|
-
"template": {
|
|
38
|
-
"type": "relation",
|
|
39
|
-
"relation": "oneToOne",
|
|
40
|
-
"target": "api::template.template"
|
|
41
51
|
}
|
|
42
52
|
}
|
|
43
53
|
}
|
|
@@ -16,16 +16,6 @@
|
|
|
16
16
|
},
|
|
17
17
|
"domain": {
|
|
18
18
|
"type": "string"
|
|
19
|
-
},
|
|
20
|
-
"template": {
|
|
21
|
-
"type": "relation",
|
|
22
|
-
"relation": "oneToMany",
|
|
23
|
-
"target": "api::template.template"
|
|
24
|
-
},
|
|
25
|
-
"pageTypes": {
|
|
26
|
-
"type": "relation",
|
|
27
|
-
"relation": "oneToMany",
|
|
28
|
-
"target": "api::page-type.page-type"
|
|
29
19
|
}
|
|
30
20
|
}
|
|
31
21
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
"platform": {
|
|
26
|
+
"type": "relation",
|
|
27
|
+
"relation": "oneToOne",
|
|
28
|
+
"target": "api::platform.platform"
|
|
29
|
+
},
|
|
30
|
+
"modules": {
|
|
31
|
+
"type": "dynamiczone",
|
|
32
|
+
"components": [],
|
|
33
|
+
"pluginOptions": {
|
|
34
|
+
"i18n": {
|
|
35
|
+
"localized": true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -9,6 +9,7 @@ import { reloadStrapiOnLoad } from '../utils/reload-strapi-on-load';
|
|
|
9
9
|
import pageTypeStart from '../schema/page-type-start.json';
|
|
10
10
|
import pageTypeEnd from '../schema/page-type-end.json';
|
|
11
11
|
import templateStart from '../schema/template-start.json';
|
|
12
|
+
import templateEnd from '../schema/template-end.json';
|
|
12
13
|
import platformStart from '../schema/platform-start.json';
|
|
13
14
|
|
|
14
15
|
const UIDS: Common.UID.ContentType[] = [TEMPLATE_UID, PAGE_TYPE_UID, PLATFORM_UID, PAGE_UID];
|
|
@@ -86,7 +87,7 @@ export default {
|
|
|
86
87
|
update: this.getPageTypeContentType()
|
|
87
88
|
},
|
|
88
89
|
[TEMPLATE_UID]: {
|
|
89
|
-
create: this.getTemplateContentType(),
|
|
90
|
+
create: this.getTemplateContentType(true),
|
|
90
91
|
update: this.getTemplateContentType()
|
|
91
92
|
},
|
|
92
93
|
[PLATFORM_UID]: {
|
|
@@ -109,8 +110,8 @@ export default {
|
|
|
109
110
|
|
|
110
111
|
return { uid: PAGE_TYPE_UID, contentType };
|
|
111
112
|
},
|
|
112
|
-
getTemplateContentType() {
|
|
113
|
-
const template = templateStart;
|
|
113
|
+
getTemplateContentType(create?: boolean) {
|
|
114
|
+
const template = create ? templateStart : templateEnd;
|
|
114
115
|
const contentType = this.mergeCollectionTypeWithOld(template, TEMPLATE_UID);
|
|
115
116
|
|
|
116
117
|
return { uid: TEMPLATE_UID, contentType };
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { PAGE_TYPE_UID } from '../../shared/utils/constants';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
async findOneByUid(uid: string) {
|
|
4
|
+
async findOneByUid(uid: string, platformId: number) {
|
|
5
5
|
const results = await strapi.entityService?.findMany(PAGE_TYPE_UID, {
|
|
6
6
|
populate: {
|
|
7
7
|
template: {
|
|
8
8
|
populate: {
|
|
9
9
|
modules: true
|
|
10
10
|
}
|
|
11
|
-
}
|
|
11
|
+
},
|
|
12
|
+
defaultParent: true
|
|
12
13
|
},
|
|
13
14
|
filters: {
|
|
14
|
-
uid
|
|
15
|
+
uid,
|
|
16
|
+
platform: {
|
|
17
|
+
id: platformId
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
});
|
|
17
21
|
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { useQuery } from 'react-query';
|
|
2
|
-
import { useFetchClient } from '@strapi/helper-plugin';
|
|
3
|
-
|
|
4
|
-
export type PageType = {
|
|
5
|
-
id: number;
|
|
6
|
-
uid: string;
|
|
7
|
-
title?: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const QUERY_KEY = 'page-types';
|
|
11
|
-
|
|
12
|
-
const fetchPageTypes = async ({ fetchClient }: Record<string, any>): Promise<PageType[]> => {
|
|
13
|
-
const { get } = fetchClient;
|
|
14
|
-
const result = await get(`/content-manager/collection-types/api::page-type.page-type?page=1&pageSize=100`);
|
|
15
|
-
|
|
16
|
-
return result?.data?.results?.map((entity: Record<string, any>) => ({
|
|
17
|
-
id: entity.id,
|
|
18
|
-
uid: entity.uid,
|
|
19
|
-
title: entity.title,
|
|
20
|
-
templateId: entity?.template?.id
|
|
21
|
-
}));
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const useGetPageTypes = (params: Record<string, any>) => {
|
|
25
|
-
const fetchClient = useFetchClient();
|
|
26
|
-
params = {
|
|
27
|
-
...params,
|
|
28
|
-
fetchClient
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return useQuery<PageType[], Error>(QUERY_KEY, () => fetchPageTypes(params));
|
|
32
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const filter_underscore_arguments_1 = require("../utils/filter-underscore-arguments");
|
|
4
|
-
const constants_1 = require("../../shared/utils/constants");
|
|
5
|
-
const getPageBySlug = (strapi) => {
|
|
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
|
-
|
|
16
|
-
`;
|
|
17
|
-
};
|
|
18
|
-
const resolvers = (strapi) => {
|
|
19
|
-
const { transformArgs } = strapi.plugin('graphql').service('builders').utils;
|
|
20
|
-
return {
|
|
21
|
-
Query: {
|
|
22
|
-
getPageBySlug: {
|
|
23
|
-
resolve: async (_parent, args, ctx) => {
|
|
24
|
-
var _a;
|
|
25
|
-
const filteredArgs = {
|
|
26
|
-
...(0, filter_underscore_arguments_1.filterUnderscoreArguments)(args)
|
|
27
|
-
};
|
|
28
|
-
const { toEntityResponse } = strapi.plugin('graphql').service('format').returnTypes;
|
|
29
|
-
const getPage = async () => {
|
|
30
|
-
var _a, _b, _c;
|
|
31
|
-
const transformedArgs = transformArgs(filteredArgs, {
|
|
32
|
-
contentType: strapi.contentTypes[constants_1.PAGE_UID],
|
|
33
|
-
usePagination: false
|
|
34
|
-
});
|
|
35
|
-
const results = await ((_a = strapi.entityService) === null || _a === void 0 ? void 0 : _a.findMany(constants_1.PAGE_UID, {
|
|
36
|
-
filters: transformedArgs,
|
|
37
|
-
locale: args._locale,
|
|
38
|
-
publicationState: args._publicationState,
|
|
39
|
-
populate: '*'
|
|
40
|
-
}));
|
|
41
|
-
const entityResponse = toEntityResponse((results === null || results === void 0 ? void 0 : results[0]) || {}, {
|
|
42
|
-
args: transformedArgs,
|
|
43
|
-
resourceUID: constants_1.PAGE_UID
|
|
44
|
-
});
|
|
45
|
-
if (!(entityResponse === null || entityResponse === void 0 ? void 0 : entityResponse.value) || Object.keys(entityResponse.value).length === 0) {
|
|
46
|
-
throw new Error(ctx.koaContext.response.message);
|
|
47
|
-
}
|
|
48
|
-
const collectionTypeDataFilter = (_c = (_b = entityResponse === null || entityResponse === void 0 ? void 0 : entityResponse.value) === null || _b === void 0 ? void 0 : _b.collectionTypeData) === null || _c === void 0 ? void 0 : _c.filter(Boolean);
|
|
49
|
-
const collectionType = collectionTypeDataFilter.length === 1 ? collectionTypeDataFilter === null || collectionTypeDataFilter === void 0 ? void 0 : collectionTypeDataFilter[0] : null;
|
|
50
|
-
const addedAttributes = {
|
|
51
|
-
collectionType: collectionType
|
|
52
|
-
};
|
|
53
|
-
const result = {
|
|
54
|
-
...entityResponse.value,
|
|
55
|
-
...addedAttributes
|
|
56
|
-
};
|
|
57
|
-
return result;
|
|
58
|
-
};
|
|
59
|
-
const results = await getPage();
|
|
60
|
-
if (((_a = Object.values(results)) === null || _a === void 0 ? void 0 : _a.filter(Boolean).length) > 0) {
|
|
61
|
-
return results;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
throw new Error(ctx.koaContext.response.message);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
const resolversConfig = {
|
|
72
|
-
'Query.getPageBySlug': {
|
|
73
|
-
auth: false
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return {
|
|
77
|
-
typeDefs: typeDefs(),
|
|
78
|
-
resolvers: resolvers(strapi),
|
|
79
|
-
resolversConfig
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
exports.default = getPageBySlug;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerGraphQLResolvers = void 0;
|
|
4
|
-
const constants_1 = require("../../shared/utils/constants");
|
|
5
|
-
const findPageByPath = (strapi) => {
|
|
6
|
-
const typeDefs = `
|
|
7
|
-
type Query {
|
|
8
|
-
findPageByPath(path: String, locale: I18NLocaleCode): PageEntityResponse
|
|
9
|
-
}
|
|
10
|
-
`;
|
|
11
|
-
const resolvers = (strapi) => {
|
|
12
|
-
const { transformArgs } = strapi.plugin('graphql').service('builders').utils;
|
|
13
|
-
const { toEntityResponse, toEntityResponseCollection } = strapi.plugin('graphql').service('format').returnTypes;
|
|
14
|
-
return {
|
|
15
|
-
Query: {
|
|
16
|
-
findPageByPath: {
|
|
17
|
-
resolve: async (parent, args, ctx) => {
|
|
18
|
-
const contentType = strapi.getModel(constants_1.PAGE_UID);
|
|
19
|
-
const transformedArgs = transformArgs(args, { contentType });
|
|
20
|
-
const queryResult = await strapi.entityService.findMany(contentType.uid, {
|
|
21
|
-
filters: {
|
|
22
|
-
path: {
|
|
23
|
-
$eq: transformedArgs.path
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
locale: transformedArgs.locale
|
|
27
|
-
});
|
|
28
|
-
const result = queryResult === null || queryResult === void 0 ? void 0 : queryResult[0];
|
|
29
|
-
return toEntityResponse(result, {
|
|
30
|
-
args: transformedArgs,
|
|
31
|
-
resourceUID: contentType.uid
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
const resolversConfig = {
|
|
39
|
-
'Query.findPageByPath': {
|
|
40
|
-
auth: false
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
return {
|
|
44
|
-
typeDefs,
|
|
45
|
-
resolvers: resolvers(strapi),
|
|
46
|
-
resolversConfig
|
|
47
|
-
};
|
|
48
|
-
};
|
|
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
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
const resolvers = (strapi) => {
|
|
66
|
-
const { transformArgs } = strapi.plugin('graphql').service('builders').utils;
|
|
67
|
-
return {
|
|
68
|
-
Query: {
|
|
69
|
-
findPagePaths: {
|
|
70
|
-
resolve: async (parent, args, ctx) => {
|
|
71
|
-
const contentType = strapi.getModel(constants_1.PAGE_UID);
|
|
72
|
-
const transformedArgs = transformArgs(args, { contentType });
|
|
73
|
-
const queryResult = await strapi.entityService.findMany(contentType.uid, {
|
|
74
|
-
populate: '*',
|
|
75
|
-
locale: transformedArgs.locale
|
|
76
|
-
});
|
|
77
|
-
const result = queryResult.filter((page) => page === null || page === void 0 ? void 0 : page.path);
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
const resolversConfig = {
|
|
85
|
-
'Query.findPagePaths': {
|
|
86
|
-
auth: false
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
return {
|
|
90
|
-
typeDefs,
|
|
91
|
-
resolvers: resolvers(strapi),
|
|
92
|
-
resolversConfig
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
const registerGraphQLResolvers = (strapi) => {
|
|
96
|
-
const extensionService = strapi.plugin('graphql').service('extension');
|
|
97
|
-
extensionService.use(findPageByPath(strapi));
|
|
98
|
-
extensionService.use(findPagePaths(strapi));
|
|
99
|
-
};
|
|
100
|
-
exports.registerGraphQLResolvers = registerGraphQLResolvers;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Pagination = void 0;
|
|
4
|
-
class Pagination {
|
|
5
|
-
static checkPagination(page, pageSize) {
|
|
6
|
-
const startPage = page === 1 ? 0 : page - 1;
|
|
7
|
-
const start = startPage * pageSize;
|
|
8
|
-
const limit = (startPage + 1) * pageSize;
|
|
9
|
-
return { start, limit };
|
|
10
|
-
}
|
|
11
|
-
static async getPaginationInfo(transformedpageArgs, transformArgs, start, pageSize, entityResponse, uid) {
|
|
12
|
-
var _a;
|
|
13
|
-
const total = await ((_a = strapi === null || strapi === void 0 ? void 0 : strapi.entityService) === null || _a === void 0 ? void 0 : _a.count(uid, {
|
|
14
|
-
filters: {
|
|
15
|
-
...transformArgs.filters,
|
|
16
|
-
hasPage: { $eq: true },
|
|
17
|
-
page: { ...transformedpageArgs.filters }
|
|
18
|
-
}
|
|
19
|
-
}));
|
|
20
|
-
const pageCount = Math.ceil(total / pageSize);
|
|
21
|
-
const page = Math.floor(start / pageSize) + 1;
|
|
22
|
-
entityResponse.metaInfo = {
|
|
23
|
-
total,
|
|
24
|
-
pageCount,
|
|
25
|
-
page,
|
|
26
|
-
pageSize
|
|
27
|
-
};
|
|
28
|
-
return entityResponse;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.Pagination = Pagination;
|