strapi-plugin-navigation 1.1.3 → 2.0.0-beta.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 (149) hide show
  1. package/README.md +61 -87
  2. package/admin/src/components/EmptyView/index.js +7 -16
  3. package/admin/src/components/Item/ItemCardBadge/index.js +8 -0
  4. package/admin/src/components/Item/ItemCardHeader/Wrapper.js +21 -0
  5. package/admin/src/components/Item/ItemCardHeader/index.js +59 -0
  6. package/admin/src/components/Item/Wrapper.js +39 -0
  7. package/admin/src/components/Item/index.js +78 -124
  8. package/admin/src/components/NavigationItemList/Wrapper.js +22 -0
  9. package/admin/src/components/NavigationItemList/index.js +56 -0
  10. package/admin/src/components/PluginIcon/index.js +6 -0
  11. package/admin/src/components/Search/index.js +46 -83
  12. package/admin/src/index.js +49 -45
  13. package/admin/src/pages/App/index.js +31 -0
  14. package/admin/src/{containers → pages}/DataManagerProvider/actions.js +0 -0
  15. package/admin/src/{containers → pages}/DataManagerProvider/index.js +77 -84
  16. package/admin/src/{containers → pages}/DataManagerProvider/init.js +0 -0
  17. package/admin/src/pages/DataManagerProvider/reducer.js +125 -0
  18. package/admin/src/pages/View/components/NavigationContentHeader/index.js +18 -0
  19. package/admin/src/pages/View/components/NavigationHeader/index.js +60 -0
  20. package/admin/src/pages/View/components/NavigationItemForm/index.js +403 -0
  21. package/admin/src/{containers → pages}/View/components/NavigationItemForm/utils/form.js +2 -2
  22. package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.js +40 -0
  23. package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.js +20 -0
  24. package/admin/src/{containers → pages}/View/components/NavigationItemPopup/index.js +16 -16
  25. package/admin/src/pages/View/index.js +221 -0
  26. package/admin/src/{containers → pages}/View/utils/enums.js +0 -0
  27. package/admin/src/{containers → pages}/View/utils/form.js +1 -1
  28. package/admin/src/{containers → pages}/View/utils/index.js +0 -0
  29. package/admin/src/{containers → pages}/View/utils/parsers.js +13 -12
  30. package/admin/src/pluginId.js +3 -2
  31. package/admin/src/translations/en.json +47 -38
  32. package/admin/src/translations/fr.json +7 -1
  33. package/admin/src/utils/getTrad.js +2 -2
  34. package/package.json +18 -7
  35. package/server/bootstrap.js +41 -0
  36. package/server/config/index.js +8 -0
  37. package/server/config.js +8 -0
  38. package/server/content-types/audience/index.js +9 -0
  39. package/{models/audience.js → server/content-types/audience/lifecycle.js} +0 -0
  40. package/{models/audience.settings.json → server/content-types/audience/schema.json} +4 -2
  41. package/server/content-types/index.js +13 -0
  42. package/server/content-types/navigation/index.js +9 -0
  43. package/{models/navigation.js → server/content-types/navigation/lifecycle.js} +0 -0
  44. package/server/content-types/navigation/schema.js +45 -0
  45. package/server/content-types/navigation-item/index.js +9 -0
  46. package/{models/navigationItem.js → server/content-types/navigation-item/lifecycle.js} +0 -0
  47. package/{models/navigationItem.settings.json → server/content-types/navigation-item/schema.json} +16 -12
  48. package/server/content-types/navigations-items-related/index.js +9 -0
  49. package/{models/navigations_items_related.js → server/content-types/navigations-items-related/lifecycle.js} +0 -0
  50. package/{models/navigations_items_related.settings.json → server/content-types/navigations-items-related/schema.json} +4 -2
  51. package/server/controllers/index.js +7 -0
  52. package/{controllers → server/controllers}/navigation.js +20 -31
  53. package/server/graphql/index.js +23 -0
  54. package/server/graphql/queries/index.js +17 -0
  55. package/server/graphql/queries/render-navigation-child.js +16 -0
  56. package/server/graphql/queries/render-navigation.js +15 -0
  57. package/server/graphql/resolvers-config.js +4 -0
  58. package/server/graphql/types/content-types-name-fields.js +8 -0
  59. package/server/graphql/types/content-types.js +16 -0
  60. package/server/graphql/types/create-navigation-item.js +17 -0
  61. package/server/graphql/types/create-navigation-related.js +8 -0
  62. package/server/graphql/types/create-navigation.js +7 -0
  63. package/server/graphql/types/index.js +15 -0
  64. package/server/graphql/types/navigation-config.js +9 -0
  65. package/server/graphql/types/navigation-details.js +10 -0
  66. package/server/graphql/types/navigation-item.js +29 -0
  67. package/server/graphql/types/navigation-related.js +23 -0
  68. package/server/graphql/types/navigation-render-type.js +4 -0
  69. package/server/graphql/types/navigation.js +9 -0
  70. package/server/register.js +5 -0
  71. package/server/routes/admin.js +38 -0
  72. package/server/routes/client.js +21 -0
  73. package/server/routes/index.js +4 -0
  74. package/{services → server/services}/__tests__/navigation.test.js +0 -0
  75. package/server/services/index.js +7 -0
  76. package/server/services/navigation.js +729 -0
  77. package/{services → server/services}/utils/constant.js +3 -1
  78. package/server/services/utils/functions.js +185 -0
  79. package/strapi-admin.js +1 -0
  80. package/strapi-server.js +20 -0
  81. package/__mocks__/helpers/another-plugin/blog-post.settings.json +0 -31
  82. package/__mocks__/helpers/another-plugin/pages.settings.json +0 -28
  83. package/__mocks__/helpers/blog-post.settings.json +0 -31
  84. package/__mocks__/helpers/home-page.settings.json +0 -4
  85. package/__mocks__/helpers/my-homepage.settings.json +0 -27
  86. package/__mocks__/helpers/pages.settings.json +0 -27
  87. package/__mocks__/helpers/strapi.js +0 -101
  88. package/admin/src/assets/images/icon-cross-blue.svg +0 -1
  89. package/admin/src/assets/images/icon_remove.svg +0 -19
  90. package/admin/src/components/Container/index.js +0 -7
  91. package/admin/src/components/Input/index.js +0 -41
  92. package/admin/src/components/Item/CardItem.js +0 -46
  93. package/admin/src/components/Item/CardItemLevelAdd.js +0 -41
  94. package/admin/src/components/Item/CardItemLevelWrapper.js +0 -27
  95. package/admin/src/components/Item/CardItemPath.js +0 -9
  96. package/admin/src/components/Item/CardItemRestore.js +0 -19
  97. package/admin/src/components/Item/CardItemTitle.js +0 -5
  98. package/admin/src/components/Item/CardWrapper.js +0 -78
  99. package/admin/src/components/ItemFooter/CardItemError.js +0 -11
  100. package/admin/src/components/ItemFooter/CardItemRelation.js +0 -18
  101. package/admin/src/components/ItemFooter/CardItemRelationStatus.js +0 -17
  102. package/admin/src/components/ItemFooter/CardItemType.js +0 -18
  103. package/admin/src/components/ItemFooter/Wrapper.js +0 -26
  104. package/admin/src/components/ItemFooter/index.js +0 -66
  105. package/admin/src/components/ItemOrdering/CardOrderingButton.js +0 -24
  106. package/admin/src/components/ItemOrdering/Wrapper.js +0 -24
  107. package/admin/src/components/ItemOrdering/index.js +0 -36
  108. package/admin/src/components/List/Container.js +0 -34
  109. package/admin/src/components/List/ListLevelRoot.js +0 -18
  110. package/admin/src/components/List/index.js +0 -81
  111. package/admin/src/components/Option/OptionButton.js +0 -18
  112. package/admin/src/components/Option/OptionSet.js +0 -14
  113. package/admin/src/components/Option/Wrapper.js +0 -15
  114. package/admin/src/components/Option/index.js +0 -47
  115. package/admin/src/components/Select/ClearIndicator.js +0 -15
  116. package/admin/src/components/Select/DropdownIndicator.js +0 -39
  117. package/admin/src/components/Select/ErrorMessage.js +0 -10
  118. package/admin/src/components/Select/IndicatorSeparator.js +0 -3
  119. package/admin/src/components/Select/MultiValueContainer.js +0 -43
  120. package/admin/src/components/Select/StyledOption.js +0 -11
  121. package/admin/src/components/Select/index.js +0 -68
  122. package/admin/src/components/Select/utils/styles.js +0 -92
  123. package/admin/src/containers/App/Wrapper.js +0 -14
  124. package/admin/src/containers/App/index.js +0 -34
  125. package/admin/src/containers/DataManagerProvider/reducer.js +0 -136
  126. package/admin/src/containers/DetailsView/Wrapper.js +0 -21
  127. package/admin/src/containers/DetailsView/index.js +0 -111
  128. package/admin/src/containers/Initializer/index.js +0 -26
  129. package/admin/src/containers/ListView/Footer.js +0 -56
  130. package/admin/src/containers/ListView/components.js +0 -138
  131. package/admin/src/containers/ListView/index.js +0 -54
  132. package/admin/src/containers/View/FadedWrapper.js +0 -51
  133. package/admin/src/containers/View/HeaderForm.js +0 -9
  134. package/admin/src/containers/View/HeaderFormCell.js +0 -25
  135. package/admin/src/containers/View/Wrapper.js +0 -17
  136. package/admin/src/containers/View/components/NavigationItemForm/ModalFooter.js +0 -45
  137. package/admin/src/containers/View/components/NavigationItemForm/index.js +0 -427
  138. package/admin/src/containers/View/components/NavigationItemPopup/MediumPopup.js +0 -6
  139. package/admin/src/containers/View/index.js +0 -240
  140. package/admin/src/lifecycles.js +0 -3
  141. package/admin/src/permissions.js +0 -14
  142. package/config/functions/bootstrap.js +0 -138
  143. package/config/routes.json +0 -60
  144. package/config/schema.graphql.js +0 -209
  145. package/examples/audit-log-integrations.js.md +0 -38
  146. package/models/navigation.settings.json +0 -43
  147. package/public/assets/preview.png +0 -0
  148. package/services/navigation.js +0 -732
  149. package/services/utils/functions.js +0 -186
@@ -0,0 +1,45 @@
1
+ module.exports = {
2
+ collectionName: "navigations",
3
+ info: {
4
+ singularName: "navigation",
5
+ pluralName: "navigations",
6
+ displayName: "Navigation",
7
+ name: "navigation"
8
+ },
9
+ options: {
10
+ increments: true,
11
+ comment: ""
12
+ },
13
+ pluginOptions: {
14
+ "content-manager": {
15
+ visible: true
16
+ },
17
+ "content-type-builder": {
18
+ visible: false
19
+ }
20
+ },
21
+ attributes: {
22
+ name: {
23
+ type: "text",
24
+ configurable: false,
25
+ required: true
26
+ },
27
+ slug: {
28
+ type: "uid",
29
+ target: "name",
30
+ configurable: false,
31
+ required: true
32
+ },
33
+ visible: {
34
+ type: "boolean",
35
+ default: false,
36
+ configurable: false
37
+ },
38
+ items: {
39
+ type: "relation",
40
+ relation: "oneToMany",
41
+ target: "plugin::navigation.navigation-item",
42
+ configurable: false
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,9 @@
1
+ "use strict"
2
+
3
+ const schema = require("./schema");
4
+ const lifecycle = require("./lifecycle");
5
+
6
+ module.exports = {
7
+ lifecycle,
8
+ schema
9
+ };
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "collectionName": "navigations_items",
3
3
  "info": {
4
- "name": "navigationItem",
5
- "description": ""
4
+ "singularName": "navigation-item",
5
+ "pluralName": "navigation-items",
6
+ "displayName": "Navigation Item",
7
+ "tableName": "navigation-item"
6
8
  },
7
9
  "options": {
8
10
  "increments": true,
@@ -64,26 +66,28 @@
64
66
  "configurable": false
65
67
  },
66
68
  "related": {
67
- "collection": "navigations_items_related",
68
- "plugin": "navigation",
69
+ "type": "relation",
70
+ "relation": "oneToOne",
71
+ "target": "plugin::navigation.navigations-items-related",
69
72
  "configurable": false
70
73
  },
71
74
  "parent": {
72
- "columnName": "parent",
73
- "model": "navigationItem",
74
- "plugin": "navigation",
75
+ "type": "relation",
76
+ "relation": "oneToOne",
77
+ "target": "plugin::navigation.navigation-item",
75
78
  "configurable": false,
76
79
  "default": null
77
80
  },
78
81
  "master": {
79
- "columnName": "master",
80
- "model": "navigation",
81
- "plugin": "navigation",
82
+ "type": "relation",
83
+ "relation": "manyToOne",
84
+ "target": "plugin::navigation.navigation",
82
85
  "configurable": false
83
86
  },
84
87
  "audience": {
85
- "collection": "audience",
86
- "plugin": "navigation"
88
+ "type": "relation",
89
+ "relation": "oneToMany",
90
+ "target": "plugin::navigation.audience"
87
91
  }
88
92
  }
89
93
  }
@@ -0,0 +1,9 @@
1
+ "use strict"
2
+
3
+ const schema = require("./schema");
4
+ const lifecycle = require("./lifecycle");
5
+
6
+ module.exports = {
7
+ lifecycle,
8
+ schema
9
+ };
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "collectionName": "navigations_items_related",
3
3
  "info": {
4
- "name": "navigations_items_related",
5
- "description": ""
4
+ "singularName": "navigations-items-related",
5
+ "pluralName": "navigations-items-relateds",
6
+ "displayName": "Navigations Items Related",
7
+ "name": "navigations_items_related"
6
8
  },
7
9
  "options": {
8
10
  "increments": true,
@@ -0,0 +1,7 @@
1
+ "use strict"
2
+
3
+ const navigation = require("./navigation");
4
+
5
+ module.exports = {
6
+ navigation
7
+ };
@@ -1,11 +1,6 @@
1
- 'use strict';
1
+ const { NavigationError } = require('../../utils/NavigationError');
2
2
 
3
- const { NavigationError } = require('../utils/NavigationError');
4
- /**
5
- * navigation.js controller
6
- *
7
- * @description: A set of functions called "actions" of the `navigation` plugin.
8
- */
3
+ const getService = () => strapi.plugin('navigation').service('navigation');
9
4
 
10
5
  const parseParams = (params) =>
11
6
  Object.keys(params).reduce((prev, curr) => {
@@ -23,28 +18,36 @@ const errorHandler = (ctx) => (error) => {
23
18
  }
24
19
  throw error;
25
20
  };
26
- const getService = () => strapi.plugins.navigation.services.navigation;
27
21
 
28
22
  module.exports = {
29
- /**
30
- * Default action.
31
- *
32
- * @return {Object}
33
- */
34
23
  async config() {
35
24
  return getService().config();
36
25
  },
37
-
38
26
  async get() {
39
27
  return getService().get();
40
28
  },
41
-
42
29
  async getById(ctx) {
43
30
  const { params } = ctx;
44
31
  const { id } = parseParams(params);
45
32
  return getService().getById(id);
46
33
  },
47
-
34
+ async getContentTypeItems(ctx) {
35
+ const { params } = ctx;
36
+ const { model } = parseParams(params);
37
+ return getService().getContentTypeItems(model)
38
+ },
39
+ post(ctx) {
40
+ const { auditLog } = ctx;
41
+ const { body = {} } = ctx.request;
42
+ return getService().post(body, auditLog);
43
+ },
44
+ put(ctx) {
45
+ const { params, auditLog } = ctx;
46
+ const { id } = parseParams(params);
47
+ const { body = {} } = ctx.request;
48
+ return getService().put(id, body, auditLog)
49
+ .catch(errorHandler(ctx));
50
+ },
48
51
  async render(ctx) {
49
52
  const { params, query = {} } = ctx;
50
53
  const { type, menu: menuOnly } = query;
@@ -66,18 +69,4 @@ module.exports = {
66
69
  menuOnly
67
70
  );
68
71
  },
69
-
70
- post(ctx) {
71
- const { auditLog } = ctx;
72
- const { body = {} } = ctx.request;
73
- return getService().post(body, auditLog);
74
- },
75
-
76
- put(ctx) {
77
- const { params, auditLog } = ctx;
78
- const { id } = parseParams(params);
79
- const { body = {} } = ctx.request;
80
- return getService().put(id, body, auditLog)
81
- .catch(errorHandler(ctx));
82
- },
83
- };
72
+ };
@@ -0,0 +1,23 @@
1
+ const getTypes = require('./types');
2
+ const getQueries = require('./queries');
3
+ const getResolversConfig = require('./resolvers-config');
4
+
5
+ module.exports = () => {
6
+ const extensionService = strapi.plugin('graphql').service('extension');
7
+
8
+ extensionService.shadowCRUD('plugin::navigation.audience').disable();
9
+ extensionService.shadowCRUD('plugin::navigation.navigation').disable();
10
+ extensionService.shadowCRUD('plugin::navigation.navigation-item').disable();
11
+ extensionService.shadowCRUD('plugin::navigation.navigations-items-related').disable();
12
+
13
+ extensionService.use(({ nexus }) => {
14
+ const types = getTypes({ strapi, nexus });
15
+ const queries = getQueries({ strapi, nexus });
16
+ const resolversConfig = getResolversConfig({ strapi });
17
+
18
+ return {
19
+ types: [types, queries],
20
+ resolversConfig,
21
+ }
22
+ });
23
+ }
@@ -0,0 +1,17 @@
1
+ module.exports = (context) => {
2
+ const queries = {
3
+ renderNavigationChild: require('./render-navigation-child'),
4
+ renderNavigation: require('./render-navigation'),
5
+ }
6
+
7
+ return context.nexus.extendType({
8
+ type: 'Query',
9
+ definition(t) {
10
+ for (const [name, configFactory] of Object.entries(queries)) {
11
+ const config = configFactory(context);
12
+
13
+ t.field(name, config);
14
+ }
15
+ },
16
+ });
17
+ };
@@ -0,0 +1,16 @@
1
+ module.exports = ({ strapi, nexus }) => {
2
+ const { nonNull, list, stringArg, booleanArg } = nexus;
3
+ return {
4
+ type: nonNull(list('NavigationItem')),
5
+ args: {
6
+ id: nonNull(stringArg()),
7
+ childUiKey: nonNull(stringArg()),
8
+ type: 'NavigationRenderType',
9
+ menuOnly: booleanArg()
10
+ },
11
+ resolve(obj, args) {
12
+ const { id, childUIKey, type, menuOnly } = args;
13
+ return strapi.plugin('navigation').service('navigation').renderChildren(id, childUIKey, type, menuOnly);
14
+ },
15
+ };
16
+ }
@@ -0,0 +1,15 @@
1
+ module.exports = ({ strapi, nexus }) => {
2
+ const { nonNull, list, stringArg, booleanArg } = nexus;
3
+ return {
4
+ type: nonNull(list('NavigationItem')),
5
+ args: {
6
+ navigationIdOrSlug: nonNull(stringArg()),
7
+ type: 'NavigationRenderType',
8
+ menuOnly: booleanArg()
9
+ },
10
+ resolve(obj, args) {
11
+ const { navigationIdOrSlug, type, menuOnly } = args;
12
+ return strapi.plugin('navigation').service('navigation').render(navigationIdOrSlug, type, menuOnly);
13
+ },
14
+ };
15
+ }
@@ -0,0 +1,4 @@
1
+ module.exports = ({ }) => ({
2
+ 'Query.renderNavigationChild': { auth: false },
3
+ 'Query.renderNavigation': { auth: false },
4
+ });
@@ -0,0 +1,8 @@
1
+ module.exports = ({ nexus }) => nexus.objectType({
2
+ name: "ContentTypesNameFields",
3
+ definition(t) {
4
+ t.nonNull.list.nonNull.string("default")
5
+ const contentTypesNameFields = strapi.plugin('navigation').config('contentTypesNameFields')
6
+ Object.keys(contentTypesNameFields || {}).forEach(key => t.nonNull.list.string(key))
7
+ }
8
+ })
@@ -0,0 +1,16 @@
1
+ module.exports = ({ nexus }) => nexus.objectType({
2
+ name: "ContentTypes",
3
+ definition(t) {
4
+ t.nonNull.string("uid")
5
+ t.nonNull.string("name")
6
+ t.nonNull.boolean("isSingle")
7
+ t.nonNull.string("collectionName")
8
+ t.nonNull.string("contentTypeName")
9
+ t.nonNull.string("label")
10
+ t.nonNull.string("relatedField")
11
+ t.nonNull.string("labelSingular")
12
+ t.nonNull.string("endpoint")
13
+ t.nonNull.boolean("available")
14
+ t.nonNull.boolean("visible")
15
+ }
16
+ })
@@ -0,0 +1,17 @@
1
+ module.exports = ({ nexus }) => nexus.inputObjectType({
2
+ name: "CreateNavigationItem",
3
+ definition(t) {
4
+ t.nonNull.string("title")
5
+ t.nonNull.string("type")
6
+ t.string("path")
7
+ t.string("externalPath")
8
+ t.nonNull.string("uiRouterKey")
9
+ t.nonNull.boolean("menuAttached")
10
+ t.nonNull.int("order")
11
+ t.int("parent")
12
+ t.int("master")
13
+ t.list.field("items", { type: 'CreateNavigationItem' })
14
+ t.list.string("audience")
15
+ t.field("related", { type: 'CreateNavigationRelated' })
16
+ }
17
+ });
@@ -0,0 +1,8 @@
1
+ module.exports = ({ nexus }) => nexus.inputObjectType({
2
+ name: "CreateNavigationRelated",
3
+ definition(t) {
4
+ t.nonNull.string("ref")
5
+ t.nonNull.string("field")
6
+ t.nonNull.string("refId")
7
+ }
8
+ });
@@ -0,0 +1,7 @@
1
+ module.exports = ({ nexus }) => nexus.inputObjectType({
2
+ name: "CreateNavigation",
3
+ definition(t) {
4
+ t.nonNull.string("name")
5
+ t.nonNull.list.field("items", { type: 'CreateNavigationItem' })
6
+ }
7
+ });
@@ -0,0 +1,15 @@
1
+ const typesFactories = [
2
+ require('./navigation-item'),
3
+ require('./navigation-related'),
4
+ require('./navigation-render-type'),
5
+ require('./navigation'),
6
+ require('./navigation-details'),
7
+ require('./content-types-name-fields'),
8
+ require('./content-types'),
9
+ require('./navigation-config'),
10
+ require('./create-navigation-related'),
11
+ require('./create-navigation-item'),
12
+ require('./create-navigation'),
13
+ ];
14
+
15
+ module.exports = context => typesFactories.map(factory => factory(context));
@@ -0,0 +1,9 @@
1
+ module.exports = ({ nexus }) => nexus.objectType({
2
+ name: "NavigationConfig",
3
+ definition(t) {
4
+ t.int("allowedLevels");
5
+ t.nonNull.list.string("additionalFields");
6
+ t.field("contentTypesNameFields", { type: 'ContentTypesNameFields' });
7
+ t.list.field("contentTypes", { type: 'ContentTypes' });
8
+ }
9
+ })
@@ -0,0 +1,10 @@
1
+ module.exports = ({ nexus }) => nexus.objectType({
2
+ name: "NavigationDetails",
3
+ definition(t) {
4
+ t.nonNull.string("id")
5
+ t.nonNull.string("name")
6
+ t.nonNull.string("slug")
7
+ t.nonNull.boolean("visible")
8
+ t.nonNull.list.field("items", { type: 'NavigationItem' })
9
+ }
10
+ })
@@ -0,0 +1,29 @@
1
+ module.exports = ({ nexus }) =>
2
+ nexus.objectType({
3
+ name: "NavigationItem",
4
+ definition(t) {
5
+ t.nonNull.int("id")
6
+ t.nonNull.string("title")
7
+ t.nonNull.string("type")
8
+ t.string("path")
9
+ t.string("externalPath")
10
+ t.nonNull.string("uiRouterKey")
11
+ t.nonNull.boolean("menuAttached")
12
+ t.nonNull.int("order")
13
+ t.int("parent")
14
+ t.int("master")
15
+ t.list.field("items", { type: 'NavigationItem' })
16
+ t.list.field("related", { type: 'NavigationRelated' })
17
+ t.list.string("audience")
18
+ // SQL
19
+ t.string("created_at")
20
+ t.string("updated_at")
21
+ t.string("created_by")
22
+ t.string("updated_by")
23
+ // MONGO
24
+ t.string("createdAt")
25
+ t.string("updatedAt")
26
+ t.string("createdBy")
27
+ t.string("updatedBy")
28
+ }
29
+ });
@@ -0,0 +1,23 @@
1
+ module.exports = ({ strapi, nexus }) => {
2
+ const related = strapi.plugin('navigation').config('gql').navigationItemRelated;
3
+ const name = "NavigationRelated";
4
+
5
+ if (related?.length) {
6
+ return nexus.unionType({
7
+ name,
8
+ definition(t) {
9
+ t.members(...related)
10
+ },
11
+ resolveType: (item) => strapi.contentTypes[item.__contentType]?.globalId
12
+ });
13
+ }
14
+
15
+ return nexus.objectType({
16
+ name,
17
+ definition(t) {
18
+ t.int("id")
19
+ t.string("title")
20
+ t.string("name")
21
+ }
22
+ })
23
+ }
@@ -0,0 +1,4 @@
1
+ module.exports = ({nexus}) => nexus.enumType({
2
+ name: "NavigationRenderType",
3
+ members: ['FLAT','TREE','RFR'],
4
+ });
@@ -0,0 +1,9 @@
1
+ module.exports = ({ nexus }) => nexus.objectType({
2
+ name: "Navigation",
3
+ definition(t) {
4
+ t.nonNull.string("id")
5
+ t.nonNull.string("name")
6
+ t.nonNull.string("slug")
7
+ t.nonNull.boolean("visible")
8
+ }
9
+ })
@@ -0,0 +1,5 @@
1
+ module.exports = ({ strapi }) => {
2
+ if (strapi.plugin('graphql')) {
3
+ require('./graphql')({ strapi });
4
+ }
5
+ };
@@ -0,0 +1,38 @@
1
+ module.exports = {
2
+ type: 'admin',
3
+ routes: [
4
+ {
5
+ method: 'GET',
6
+ path: '/',
7
+ handler: 'navigation.get',
8
+ },
9
+ {
10
+ method: 'POST',
11
+ path: '/',
12
+ handler: 'navigation.post',
13
+ },
14
+ {
15
+ method: 'GET',
16
+ path: '/config',
17
+ handler: 'navigation.config',
18
+ },
19
+ {
20
+ method: 'GET',
21
+ path: '/:id',
22
+ handler: 'navigation.getById',
23
+ },
24
+ {
25
+ method: 'PUT',
26
+ path: '/:id',
27
+ handler: 'navigation.put',
28
+ },
29
+ {
30
+ method: 'GET',
31
+ path: '/content-type-items/:model',
32
+ handler: 'navigation.getContentTypeItems',
33
+ policies: [
34
+ 'admin::isAuthenticatedAdmin'
35
+ ]
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,21 @@
1
+ module.exports = {
2
+ type: 'content-api',
3
+ routes: [
4
+ {
5
+ method: "GET",
6
+ path: "/render/:idOrSlug",
7
+ handler: "navigation.render",
8
+ config: {
9
+ policies: []
10
+ }
11
+ },
12
+ {
13
+ method: "GET",
14
+ path: "/render/:idOrSlug/:childUIKey",
15
+ handler: "navigation.renderChild",
16
+ config: {
17
+ policies: []
18
+ }
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ 'admin': require('./admin'),
3
+ 'content-api': require('./client'),
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict"
2
+
3
+ const navigation = require("./navigation");
4
+
5
+ module.exports = {
6
+ navigation
7
+ };