@strapi/plugin-documentation 5.0.0-beta.0 → 5.0.0-beta.1

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 (184) hide show
  1. package/README.md +0 -1
  2. package/dist/_chunks/{index-7xstUX8_.mjs → App-ig-uE4do.mjs} +48 -14
  3. package/dist/_chunks/App-ig-uE4do.mjs.map +1 -0
  4. package/dist/_chunks/{index-D1KkfApT.js → App-o4uH8gaQ.js} +73 -20
  5. package/dist/_chunks/App-o4uH8gaQ.js.map +1 -0
  6. package/dist/_chunks/{index-VpLAJXMs.mjs → Settings-3hsPOP_b.mjs} +64 -33
  7. package/dist/_chunks/Settings-3hsPOP_b.mjs.map +1 -0
  8. package/dist/_chunks/{index-NbPCucJl.js → Settings-XmOzLTUn.js} +69 -37
  9. package/dist/_chunks/Settings-XmOzLTUn.js.map +1 -0
  10. package/dist/_chunks/getTrad-bnElvR8_.js +5 -0
  11. package/dist/_chunks/getTrad-bnElvR8_.js.map +1 -0
  12. package/dist/_chunks/getTrad-md7Tjpcv.mjs +6 -0
  13. package/dist/_chunks/getTrad-md7Tjpcv.mjs.map +1 -0
  14. package/{server/public/index.html → dist/_chunks/index-MKWIGajW.mjs} +9 -4
  15. package/dist/_chunks/index-MKWIGajW.mjs.map +1 -0
  16. package/dist/_chunks/index-WbbYm9_u.js +75 -0
  17. package/dist/_chunks/index-WbbYm9_u.js.map +1 -0
  18. package/dist/_chunks/{index-NvJ4m2q5.mjs → index-jpDwTC-Q.mjs} +121 -117
  19. package/dist/_chunks/index-jpDwTC-Q.mjs.map +1 -0
  20. package/dist/_chunks/{index-r7HsQTou.js → index-vNbIS1u2.js} +119 -115
  21. package/dist/_chunks/index-vNbIS1u2.js.map +1 -0
  22. package/dist/_chunks/login-HAajOKpu.js +150 -0
  23. package/dist/_chunks/login-HAajOKpu.js.map +1 -0
  24. package/{server/public/login.html → dist/_chunks/login-slUa679p.mjs} +6 -1
  25. package/dist/_chunks/login-slUa679p.mjs.map +1 -0
  26. package/dist/admin/index.js +1 -1
  27. package/dist/admin/index.mjs +2 -2
  28. package/dist/admin/src/components/SettingsForm.d.ts +8 -0
  29. package/dist/admin/src/constants.d.ts +18 -0
  30. package/dist/admin/src/index.d.ts +14 -0
  31. package/dist/admin/src/pages/App.d.ts +2 -0
  32. package/dist/admin/src/pages/Settings.d.ts +2 -0
  33. package/dist/admin/src/pluginId.d.ts +1 -0
  34. package/dist/admin/src/services/api.d.ts +25 -0
  35. package/dist/admin/src/types.d.ts +16 -0
  36. package/dist/admin/src/utils/baseQuery.d.ts +20 -0
  37. package/dist/admin/src/utils/getTrad.d.ts +1 -0
  38. package/dist/admin/src/utils/index.d.ts +2 -0
  39. package/dist/admin/src/utils/prefixPluginTranslations.d.ts +2 -0
  40. package/dist/server/index.js +1263 -0
  41. package/dist/server/index.js.map +1 -0
  42. package/dist/server/index.mjs +1238 -0
  43. package/dist/server/index.mjs.map +1 -0
  44. package/dist/server/src/bootstrap.d.ts +5 -0
  45. package/dist/server/src/bootstrap.d.ts.map +1 -0
  46. package/dist/server/src/config/default-plugin-config.d.ts +3 -0
  47. package/dist/server/src/config/default-plugin-config.d.ts.map +1 -0
  48. package/dist/server/src/config/index.d.ts +4 -0
  49. package/dist/server/src/config/index.d.ts.map +1 -0
  50. package/dist/server/src/controllers/documentation.d.ts +12 -0
  51. package/dist/server/src/controllers/documentation.d.ts.map +1 -0
  52. package/dist/server/src/controllers/index.d.ts +14 -0
  53. package/dist/server/src/controllers/index.d.ts.map +1 -0
  54. package/dist/server/src/index.d.ts +91 -0
  55. package/dist/server/src/index.d.ts.map +1 -0
  56. package/dist/server/src/middlewares/documentation.d.ts +5 -0
  57. package/dist/server/src/middlewares/documentation.d.ts.map +1 -0
  58. package/dist/server/src/middlewares/restrict-access.d.ts +4 -0
  59. package/dist/server/src/middlewares/restrict-access.d.ts.map +1 -0
  60. package/dist/server/src/register.d.ts +5 -0
  61. package/dist/server/src/register.d.ts.map +1 -0
  62. package/dist/server/src/routes/index.d.ts +36 -0
  63. package/dist/server/src/routes/index.d.ts.map +1 -0
  64. package/dist/server/src/services/__mocks__/mock-content-types.d.ts +449 -0
  65. package/dist/server/src/services/__mocks__/mock-content-types.d.ts.map +1 -0
  66. package/dist/server/src/services/__mocks__/mock-strapi-data.d.ts +592 -0
  67. package/dist/server/src/services/__mocks__/mock-strapi-data.d.ts.map +1 -0
  68. package/dist/server/src/services/documentation.d.ts +36 -0
  69. package/dist/server/src/services/documentation.d.ts.map +1 -0
  70. package/dist/server/src/services/helpers/build-api-endpoint-path.d.ts +7 -0
  71. package/dist/server/src/services/helpers/build-api-endpoint-path.d.ts.map +1 -0
  72. package/dist/server/src/services/helpers/build-component-schema.d.ts +4 -0
  73. package/dist/server/src/services/helpers/build-component-schema.d.ts.map +1 -0
  74. package/dist/server/src/services/helpers/index.d.ts +4 -0
  75. package/dist/server/src/services/helpers/index.d.ts.map +1 -0
  76. package/dist/server/src/services/helpers/utils/clean-schema-attributes.d.ts +15 -0
  77. package/dist/server/src/services/helpers/utils/clean-schema-attributes.d.ts.map +1 -0
  78. package/dist/server/src/services/helpers/utils/get-api-responses.d.ts +15 -0
  79. package/dist/server/src/services/helpers/utils/get-api-responses.d.ts.map +1 -0
  80. package/dist/server/src/services/helpers/utils/get-schema-data.d.ts +12 -0
  81. package/dist/server/src/services/helpers/utils/get-schema-data.d.ts.map +1 -0
  82. package/dist/server/src/services/helpers/utils/loop-content-type-names.d.ts +7 -0
  83. package/dist/server/src/services/helpers/utils/loop-content-type-names.d.ts.map +1 -0
  84. package/dist/server/src/services/helpers/utils/pascal-case.d.ts +3 -0
  85. package/dist/server/src/services/helpers/utils/pascal-case.d.ts.map +1 -0
  86. package/dist/server/src/services/helpers/utils/query-params.d.ts +4 -0
  87. package/dist/server/src/services/helpers/utils/query-params.d.ts.map +1 -0
  88. package/dist/server/src/services/helpers/utils/routes.d.ts +3 -0
  89. package/dist/server/src/services/helpers/utils/routes.d.ts.map +1 -0
  90. package/dist/server/src/services/index.d.ts +43 -0
  91. package/dist/server/src/services/index.d.ts.map +1 -0
  92. package/dist/server/src/services/override.d.ts +21 -0
  93. package/dist/server/src/services/override.d.ts.map +1 -0
  94. package/dist/server/src/services/utils/get-plugins-that-need-documentation.d.ts +4 -0
  95. package/dist/server/src/services/utils/get-plugins-that-need-documentation.d.ts.map +1 -0
  96. package/dist/server/src/types.d.ts +28 -0
  97. package/dist/server/src/types.d.ts.map +1 -0
  98. package/dist/server/src/utils.d.ts +12 -0
  99. package/dist/server/src/utils.d.ts.map +1 -0
  100. package/package.json +33 -15
  101. package/strapi-server.js +1 -1
  102. package/.eslintignore +0 -1
  103. package/.eslintrc +0 -17
  104. package/admin/src/constants.js +0 -17
  105. package/admin/src/hooks/useDocumentation.js +0 -81
  106. package/admin/src/index.js +0 -62
  107. package/admin/src/pages/PluginPage/index.jsx +0 -212
  108. package/admin/src/pages/PluginPage/tests/index.test.jsx +0 -160
  109. package/admin/src/pages/SettingsPage/index.jsx +0 -202
  110. package/admin/src/pages/SettingsPage/tests/index.test.jsx +0 -72
  111. package/admin/src/pluginId.js +0 -5
  112. package/admin/src/translations/ar.json +0 -20
  113. package/admin/src/translations/cs.json +0 -21
  114. package/admin/src/translations/de.json +0 -26
  115. package/admin/src/translations/dk.json +0 -39
  116. package/admin/src/translations/en.json +0 -39
  117. package/admin/src/translations/es.json +0 -39
  118. package/admin/src/translations/fr.json +0 -26
  119. package/admin/src/translations/id.json +0 -24
  120. package/admin/src/translations/it.json +0 -26
  121. package/admin/src/translations/ko.json +0 -39
  122. package/admin/src/translations/ms.json +0 -23
  123. package/admin/src/translations/nl.json +0 -21
  124. package/admin/src/translations/pl.json +0 -39
  125. package/admin/src/translations/pt-BR.json +0 -21
  126. package/admin/src/translations/pt.json +0 -21
  127. package/admin/src/translations/ru.json +0 -39
  128. package/admin/src/translations/sk.json +0 -24
  129. package/admin/src/translations/sv.json +0 -39
  130. package/admin/src/translations/th.json +0 -24
  131. package/admin/src/translations/tr.json +0 -39
  132. package/admin/src/translations/uk.json +0 -23
  133. package/admin/src/translations/vi.json +0 -24
  134. package/admin/src/translations/zh-Hans.json +0 -28
  135. package/admin/src/translations/zh.json +0 -39
  136. package/admin/src/utils/getTrad.js +0 -5
  137. package/admin/src/utils/index.js +0 -2
  138. package/admin/src/utils/prefixPluginTranslations.js +0 -13
  139. package/dist/_chunks/index-7xstUX8_.mjs.map +0 -1
  140. package/dist/_chunks/index-D1KkfApT.js.map +0 -1
  141. package/dist/_chunks/index-NbPCucJl.js.map +0 -1
  142. package/dist/_chunks/index-NvJ4m2q5.mjs.map +0 -1
  143. package/dist/_chunks/index-VpLAJXMs.mjs.map +0 -1
  144. package/dist/_chunks/index-r7HsQTou.js.map +0 -1
  145. package/dist/_chunks/useDocumentation-6Ks-_Ms6.mjs +0 -68
  146. package/dist/_chunks/useDocumentation-6Ks-_Ms6.mjs.map +0 -1
  147. package/dist/_chunks/useDocumentation-S0e4mU-U.js +0 -67
  148. package/dist/_chunks/useDocumentation-S0e4mU-U.js.map +0 -1
  149. package/jest.config.front.js +0 -7
  150. package/jest.config.js +0 -6
  151. package/packup.config.ts +0 -22
  152. package/server/bootstrap.js +0 -54
  153. package/server/config/default-plugin-config.js +0 -35
  154. package/server/config/index.js +0 -7
  155. package/server/controllers/documentation.js +0 -241
  156. package/server/controllers/index.js +0 -7
  157. package/server/index.js +0 -17
  158. package/server/middlewares/documentation.js +0 -25
  159. package/server/middlewares/index.js +0 -7
  160. package/server/middlewares/restrict-access.js +0 -24
  161. package/server/register.js +0 -11
  162. package/server/routes/index.js +0 -84
  163. package/server/services/__mocks__/mock-content-types.js +0 -264
  164. package/server/services/__mocks__/mock-strapi-data.js +0 -183
  165. package/server/services/__tests__/build-component-schema.test.js +0 -761
  166. package/server/services/__tests__/documentation.test.js +0 -481
  167. package/server/services/__tests__/override.test.js +0 -85
  168. package/server/services/documentation.js +0 -246
  169. package/server/services/helpers/build-api-endpoint-path.js +0 -186
  170. package/server/services/helpers/build-component-schema.js +0 -254
  171. package/server/services/helpers/index.js +0 -9
  172. package/server/services/helpers/utils/clean-schema-attributes.js +0 -246
  173. package/server/services/helpers/utils/get-api-responses.js +0 -105
  174. package/server/services/helpers/utils/get-schema-data.js +0 -32
  175. package/server/services/helpers/utils/loop-content-type-names.js +0 -55
  176. package/server/services/helpers/utils/pascal-case.js +0 -9
  177. package/server/services/helpers/utils/query-params.js +0 -105
  178. package/server/services/helpers/utils/routes.js +0 -10
  179. package/server/services/index.js +0 -9
  180. package/server/services/override.js +0 -52
  181. package/server/services/utils/default-openapi-components.js +0 -40
  182. package/server/services/utils/get-plugins-that-need-documentation.js +0 -24
  183. package/tests/server.js +0 -37
  184. package/tests/setup.js +0 -15
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- openapi: '3.0.0',
5
- info: {
6
- version: '1.0.0',
7
- title: 'DOCUMENTATION',
8
- description: '',
9
- termsOfService: 'YOUR_TERMS_OF_SERVICE_URL',
10
- contact: {
11
- name: 'TEAM',
12
- email: 'contact-email@something.io',
13
- url: 'mywebsite.io',
14
- },
15
- license: {
16
- name: 'Apache 2.0',
17
- url: 'https://www.apache.org/licenses/LICENSE-2.0.html',
18
- },
19
- },
20
- 'x-strapi-config': {
21
- path: '/documentation',
22
- plugins: null,
23
- mutateDocumentation: null,
24
- },
25
- servers: [],
26
- externalDocs: {
27
- description: 'Find out more',
28
- url: 'https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html',
29
- },
30
- security: [
31
- {
32
- bearerAuth: [],
33
- },
34
- ],
35
- };
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- const defaultPluginConfig = require('./default-plugin-config');
4
-
5
- module.exports = {
6
- default: defaultPluginConfig,
7
- };
@@ -1,241 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Documentation.js controller
5
- *
6
- * @description: A set of functions called "actions" of the `documentation` plugin.
7
- */
8
-
9
- // Core dependencies.
10
- const path = require('path');
11
- const bcrypt = require('bcryptjs');
12
-
13
- // Public dependencies.
14
- const fs = require('fs-extra');
15
- const _ = require('lodash');
16
- const koaStatic = require('koa-static');
17
-
18
- module.exports = {
19
- async getInfos(ctx) {
20
- try {
21
- const docService = strapi.plugin('documentation').service('documentation');
22
- const docVersions = docService.getDocumentationVersions();
23
- const documentationAccess = await docService.getDocumentationAccess();
24
-
25
- ctx.send({
26
- docVersions,
27
- currentVersion: docService.getDocumentationVersion(),
28
- prefix: strapi.plugin('documentation').config('x-strapi-config').path,
29
- documentationAccess,
30
- });
31
- } catch (err) {
32
- ctx.badRequest(null, err.message);
33
- }
34
- },
35
-
36
- async index(ctx, next) {
37
- try {
38
- /**
39
- * We don't expose the specs using koa-static or something else due to security reasons.
40
- * That's why, we need to read the file localy and send the specs through it when we serve the Swagger UI.
41
- */
42
- const { major, minor, patch } = ctx.params;
43
- const version =
44
- major && minor && patch
45
- ? `${major}.${minor}.${patch}`
46
- : strapi.plugin('documentation').service('documentation').getDocumentationVersion();
47
-
48
- const openAPISpecsPath = path.join(
49
- strapi.dirs.app.extensions,
50
- 'documentation',
51
- 'documentation',
52
- version,
53
- 'full_documentation.json'
54
- );
55
-
56
- try {
57
- const documentation = fs.readFileSync(openAPISpecsPath, 'utf8');
58
- const layout = fs.readFileSync(
59
- path.resolve(__dirname, '..', 'public', 'index.html'),
60
- 'utf8'
61
- );
62
- const filledLayout = _.template(layout)({
63
- backendUrl: strapi.config.server.url,
64
- spec: JSON.stringify(JSON.parse(documentation)),
65
- });
66
-
67
- try {
68
- const layoutPath = path.resolve(
69
- strapi.dirs.app.extensions,
70
- 'documentation',
71
- 'public',
72
- 'index.html'
73
- );
74
- await fs.ensureFile(layoutPath);
75
- await fs.writeFile(layoutPath, filledLayout);
76
-
77
- // Serve the file.
78
- ctx.url = path.basename(`${ctx.url}/index.html`);
79
-
80
- try {
81
- const staticFolder = path.resolve(
82
- strapi.dirs.app.extensions,
83
- 'documentation',
84
- 'public'
85
- );
86
- return koaStatic(staticFolder)(ctx, next);
87
- } catch (e) {
88
- strapi.log.error(e);
89
- }
90
- } catch (e) {
91
- strapi.log.error(e);
92
- }
93
- } catch (e) {
94
- strapi.log.error(e);
95
- }
96
- } catch (e) {
97
- strapi.log.error(e);
98
- }
99
- },
100
-
101
- async loginView(ctx, next) {
102
- // lazy require cheerio
103
- const cheerio = require('cheerio');
104
-
105
- const { error } = ctx.query;
106
-
107
- try {
108
- const layout = fs.readFileSync(path.join(__dirname, '..', 'public', 'login.html'));
109
- const filledLayout = _.template(layout)({
110
- actionUrl: `${strapi.config.server.url}${
111
- strapi.config.get('plugin::documentation.x-strapi-config').path
112
- }/login`,
113
- });
114
- const $ = cheerio.load(filledLayout);
115
-
116
- $('.error').text(_.isEmpty(error) ? '' : 'Wrong password...');
117
-
118
- try {
119
- const layoutPath = path.resolve(
120
- strapi.dirs.app.extensions,
121
- 'documentation',
122
- 'public',
123
- 'login.html'
124
- );
125
- await fs.ensureFile(layoutPath);
126
- await fs.writeFile(layoutPath, $.html());
127
-
128
- ctx.url = path.basename(`${ctx.url}/login.html`);
129
-
130
- try {
131
- const staticFolder = path.resolve(strapi.dirs.app.extensions, 'documentation', 'public');
132
- return koaStatic(staticFolder)(ctx, next);
133
- } catch (e) {
134
- strapi.log.error(e);
135
- }
136
- } catch (e) {
137
- strapi.log.error(e);
138
- }
139
- } catch (e) {
140
- strapi.log.error(e);
141
- }
142
- },
143
-
144
- async login(ctx) {
145
- const {
146
- body: { password },
147
- } = ctx.request;
148
-
149
- const { password: hash } = await strapi
150
- .store({ type: 'plugin', name: 'documentation', key: 'config' })
151
- .get();
152
-
153
- const isValid = await bcrypt.compare(password, hash);
154
-
155
- let querystring = '?error=password';
156
-
157
- if (isValid) {
158
- ctx.session.documentation = {
159
- logged: true,
160
- };
161
-
162
- querystring = '';
163
- }
164
-
165
- ctx.redirect(
166
- `${strapi.config.server.url}${
167
- strapi.config.get('plugin::documentation.x-strapi-config').path
168
- }${querystring}`
169
- );
170
- },
171
-
172
- async regenerateDoc(ctx) {
173
- const { version } = ctx.request.body;
174
-
175
- const service = strapi.service('plugin::documentation.documentation');
176
-
177
- const documentationVersions = service.getDocumentationVersions().map((el) => el.version);
178
-
179
- if (_.isEmpty(version)) {
180
- return ctx.badRequest('Please provide a version.');
181
- }
182
-
183
- if (!documentationVersions.includes(version)) {
184
- return ctx.badRequest('The version you are trying to generate does not exist.');
185
- }
186
-
187
- try {
188
- strapi.reload.isWatching = false;
189
- await service.generateFullDoc(version);
190
- ctx.send({ ok: true });
191
- } finally {
192
- strapi.reload.isWatching = true;
193
- }
194
- },
195
-
196
- async deleteDoc(ctx) {
197
- const { version } = ctx.params;
198
-
199
- const service = strapi.service('plugin::documentation.documentation');
200
-
201
- const documentationVersions = service.getDocumentationVersions().map((el) => el.version);
202
-
203
- if (_.isEmpty(version)) {
204
- return ctx.badRequest('Please provide a version.');
205
- }
206
-
207
- if (!documentationVersions.includes(version)) {
208
- return ctx.badRequest('The version you are trying to delete does not exist.');
209
- }
210
-
211
- try {
212
- strapi.reload.isWatching = false;
213
- await service.deleteDocumentation(version);
214
- ctx.send({ ok: true });
215
- } finally {
216
- strapi.reload.isWatching = true;
217
- }
218
- },
219
-
220
- async updateSettings(ctx) {
221
- const { restrictedAccess, password } = ctx.request.body;
222
-
223
- const pluginStore = strapi.store({ type: 'plugin', name: 'documentation' });
224
-
225
- const config = {
226
- restrictedAccess: Boolean(restrictedAccess),
227
- };
228
-
229
- if (restrictedAccess) {
230
- if (_.isEmpty(password)) {
231
- return ctx.badRequest('Please provide a password');
232
- }
233
-
234
- config.password = await bcrypt.hash(password, 10);
235
- }
236
-
237
- await pluginStore.set({ key: 'config', value: config });
238
-
239
- return ctx.send({ ok: true });
240
- },
241
- };
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- const documentation = require('./documentation');
4
-
5
- module.exports = {
6
- documentation,
7
- };
package/server/index.js DELETED
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- const bootstrap = require('./bootstrap');
4
- const services = require('./services');
5
- const routes = require('./routes');
6
- const controllers = require('./controllers');
7
- const register = require('./register');
8
- const config = require('./config');
9
-
10
- module.exports = () => ({
11
- bootstrap,
12
- config,
13
- routes,
14
- controllers,
15
- register,
16
- services,
17
- });
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const koaStatic = require('koa-static');
5
- const swaggerUi = require('swagger-ui-dist');
6
-
7
- module.exports = async ({ strapi }) => {
8
- strapi.server.routes([
9
- {
10
- method: 'GET',
11
- path: '/plugins/documentation/(.*)',
12
- async handler(ctx, next) {
13
- ctx.url = path.basename(ctx.url);
14
-
15
- return koaStatic(swaggerUi.getAbsoluteFSPath(), {
16
- maxage: 86400000,
17
- defer: true,
18
- })(ctx, next);
19
- },
20
- config: {
21
- auth: false,
22
- },
23
- },
24
- ]);
25
- };
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- const documentation = require('./documentation');
4
-
5
- module.exports = {
6
- documentation,
7
- };
@@ -1,24 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = async (ctx, next) => {
4
- const pluginStore = strapi.store({ type: 'plugin', name: 'documentation' });
5
-
6
- const config = await pluginStore.get({ key: 'config' });
7
-
8
- if (!config.restrictedAccess) {
9
- return next();
10
- }
11
-
12
- if (!ctx.session.documentation || !ctx.session.documentation.logged) {
13
- const querystring = ctx.querystring ? `?${ctx.querystring}` : '';
14
-
15
- return ctx.redirect(
16
- `${strapi.config.server.url}${
17
- strapi.config.get('plugin::documentation.x-strapi-config').path
18
- }/login${querystring}`
19
- );
20
- }
21
-
22
- // Execute the action.
23
- return next();
24
- };
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- const registerDocumentationMiddleWare = require('./middlewares/documentation');
4
-
5
- /**
6
- * Register upload plugin
7
- * @param {{ strapi: import('@strapi/strapi').Strapi }}
8
- */
9
- module.exports = async ({ strapi }) => {
10
- await registerDocumentationMiddleWare({ strapi });
11
- };
@@ -1,84 +0,0 @@
1
- 'use strict';
2
-
3
- const restrictAccess = require('../middlewares/restrict-access');
4
-
5
- module.exports = [
6
- {
7
- method: 'GET',
8
- path: '/',
9
- handler: 'documentation.index',
10
- config: {
11
- auth: false,
12
- middlewares: [restrictAccess],
13
- },
14
- },
15
- {
16
- method: 'GET',
17
- path: '/v:major(\\d+).:minor(\\d+).:patch(\\d+)',
18
- handler: 'documentation.index',
19
- config: {
20
- auth: false,
21
- middlewares: [restrictAccess],
22
- },
23
- },
24
- {
25
- method: 'GET',
26
- path: '/login',
27
- handler: 'documentation.loginView',
28
- config: {
29
- auth: false,
30
- },
31
- },
32
- {
33
- method: 'POST',
34
- path: '/login',
35
- handler: 'documentation.login',
36
- config: {
37
- auth: false,
38
- },
39
- },
40
- {
41
- method: 'GET',
42
- path: '/getInfos',
43
- handler: 'documentation.getInfos',
44
- config: {
45
- policies: [
46
- { name: 'admin::hasPermissions', config: { actions: ['plugin::documentation.read'] } },
47
- ],
48
- },
49
- },
50
- {
51
- method: 'POST',
52
- path: '/regenerateDoc',
53
- handler: 'documentation.regenerateDoc',
54
- config: {
55
- policies: [
56
- {
57
- name: 'admin::hasPermissions',
58
- config: { actions: ['plugin::documentation.settings.regenerate'] },
59
- },
60
- ],
61
- },
62
- },
63
- {
64
- method: 'PUT',
65
- path: '/updateSettings',
66
- handler: 'documentation.updateSettings',
67
- config: {
68
- policies: [
69
- {
70
- name: 'admin::hasPermissions',
71
- config: { actions: ['plugin::documentation.settings.update'] },
72
- },
73
- ],
74
- },
75
- },
76
- {
77
- method: 'DELETE',
78
- path: '/deleteDoc/:version',
79
- handler: 'documentation.deleteDoc',
80
- config: {
81
- policies: [],
82
- },
83
- },
84
- ];