@strapi/plugin-documentation 4.0.0-next.9 → 4.0.0

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 (71) hide show
  1. package/admin/src/components/FieldActionWrapper/index.js +14 -0
  2. package/admin/src/components/PluginIcon/index.js +12 -0
  3. package/admin/src/index.js +23 -11
  4. package/admin/src/pages/PluginPage/index.js +199 -0
  5. package/admin/src/pages/PluginPage/tests/index.test.js +873 -0
  6. package/admin/src/pages/PluginPage/tests/server.js +23 -0
  7. package/admin/src/pages/SettingsPage/index.js +181 -0
  8. package/admin/src/pages/SettingsPage/tests/index.test.js +612 -0
  9. package/admin/src/pages/SettingsPage/tests/server.js +18 -0
  10. package/admin/src/pages/{HomePage/utils → utils}/api.js +5 -4
  11. package/admin/src/pages/{HomePage/utils → utils}/schema.js +0 -0
  12. package/admin/src/pages/utils/useReactQuery.js +46 -0
  13. package/admin/src/translations/ar.json +0 -3
  14. package/admin/src/translations/cs.json +0 -3
  15. package/admin/src/translations/de.json +0 -3
  16. package/admin/src/translations/en.json +14 -3
  17. package/admin/src/translations/es.json +0 -3
  18. package/admin/src/translations/fr.json +0 -3
  19. package/admin/src/translations/id.json +0 -3
  20. package/admin/src/translations/it.json +0 -3
  21. package/admin/src/translations/ko.json +0 -3
  22. package/admin/src/translations/ms.json +0 -3
  23. package/admin/src/translations/nl.json +0 -3
  24. package/admin/src/translations/pl.json +0 -3
  25. package/admin/src/translations/pt-BR.json +0 -3
  26. package/admin/src/translations/pt.json +0 -3
  27. package/admin/src/translations/ru.json +0 -3
  28. package/admin/src/translations/sk.json +0 -3
  29. package/admin/src/translations/th.json +0 -3
  30. package/admin/src/translations/tr.json +0 -3
  31. package/admin/src/translations/uk.json +0 -3
  32. package/admin/src/translations/vi.json +0 -3
  33. package/admin/src/translations/zh-Hans.json +3 -6
  34. package/admin/src/translations/zh.json +0 -3
  35. package/package.json +32 -47
  36. package/server/bootstrap.js +19 -105
  37. package/server/config/default-config.js +12 -15
  38. package/server/config/index.js +10 -2
  39. package/server/controllers/documentation.js +61 -127
  40. package/server/index.js +17 -0
  41. package/server/middlewares/documentation.js +18 -41
  42. package/server/{policies/index-policy.js → middlewares/restrict-access.js} +5 -16
  43. package/{public → server/public}/index.html +0 -0
  44. package/{public → server/public}/login.html +0 -0
  45. package/server/register.js +11 -0
  46. package/server/routes/index.js +18 -25
  47. package/server/services/documentation.js +125 -1835
  48. package/server/utils/builders/build-api-endpoint-path.js +174 -0
  49. package/server/utils/builders/build-api-requests.js +41 -0
  50. package/server/utils/builders/build-api-responses.js +108 -0
  51. package/server/utils/builders/index.js +11 -0
  52. package/server/utils/clean-schema-attributes.js +205 -0
  53. package/server/utils/error-response.js +22 -0
  54. package/server/utils/get-schema-data.js +32 -0
  55. package/server/utils/query-params.js +84 -0
  56. package/strapi-admin.js +3 -0
  57. package/strapi-server.js +1 -19
  58. package/admin/src/assets/images/logo.svg +0 -1
  59. package/admin/src/components/Block/components.js +0 -26
  60. package/admin/src/components/Block/index.js +0 -39
  61. package/admin/src/components/Copy/index.js +0 -36
  62. package/admin/src/components/Header/index.js +0 -72
  63. package/admin/src/components/Row/ButtonContainer.js +0 -67
  64. package/admin/src/components/Row/components.js +0 -83
  65. package/admin/src/components/Row/index.js +0 -51
  66. package/admin/src/pages/App/index.js +0 -21
  67. package/admin/src/pages/HomePage/components.js +0 -59
  68. package/admin/src/pages/HomePage/index.js +0 -175
  69. package/admin/src/pages/HomePage/useHomePage.js +0 -56
  70. package/server/policies/index.js +0 -7
  71. package/server/services/utils/forms.json +0 -29
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Poslední vygenerování",
3
2
  "components.Row.open": "Otevřený",
4
3
  "components.Row.regenerate": "Znovu vygenerovat",
5
4
  "containers.HomePage.Block.title": "Verze",
6
- "containers.HomePage.Button.open": "Otevřít dokumentaci",
7
5
  "containers.HomePage.Button.update": "Uložit",
8
- "containers.HomePage.PluginHeader.description": "Nastavit zásuvný modul dokumentace",
9
6
  "containers.HomePage.PluginHeader.title": "Dokumentace - Nastavení",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Rozumím",
11
8
  "containers.HomePage.PopUpWarning.message": "Jste si jisti, že chcete odstranit tuto verzi?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Letztes Mal generiert",
3
2
  "components.Row.open": "Öffnen",
4
3
  "components.Row.regenerate": "Neu generieren",
5
4
  "containers.HomePage.Block.title": "Versionen",
6
- "containers.HomePage.Button.open": "Dokumentation öffnen",
7
5
  "containers.HomePage.Button.update": "Aktualisieren",
8
- "containers.HomePage.PluginHeader.description": "Einstellungen des Dokumentation-Plugins ändern",
9
6
  "containers.HomePage.PluginHeader.title": "Dokumentation - Einstellungen",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Ich verstehe",
11
8
  "containers.HomePage.PopUpWarning.message": "Sind Sie sich sicher, dass Sie diese Version löschen wollen?",
@@ -1,11 +1,9 @@
1
1
  {
2
- "components.Row.generatedDate": "Last generation",
2
+ "coming-soon": "This content is currently under construction and will be back in a few weeks!",
3
3
  "components.Row.open": "Open",
4
4
  "components.Row.regenerate": "Regenerate",
5
5
  "containers.HomePage.Block.title": "Versions",
6
- "containers.HomePage.Button.open": "Open the documentation",
7
6
  "containers.HomePage.Button.update": "Update",
8
- "containers.HomePage.PluginHeader.description": "Configure the documentation plugin",
9
7
  "containers.HomePage.PluginHeader.title": "Documentation - Settings",
10
8
  "containers.HomePage.PopUpWarning.confirm": "I understand",
11
9
  "containers.HomePage.PopUpWarning.message": "Are you sure you want to delete this version?",
@@ -25,6 +23,19 @@
25
23
  "notification.delete.success": "Doc deleted",
26
24
  "notification.generate.success": "Doc generated",
27
25
  "notification.update.success": "Settings updated successfully",
26
+ "pages.PluginPage.Button.open": "Open documentation",
27
+ "pages.PluginPage.header.description": "Configure the documentation plugin",
28
+ "pages.PluginPage.table.generated": "Last generated",
29
+ "pages.PluginPage.table.icon.delete": "Delete {target}",
30
+ "pages.PluginPage.table.icon.regenerate": "Regenerate {target}",
31
+ "pages.PluginPage.table.icon.show": "Open {target}",
32
+ "pages.PluginPage.table.version": "Version",
33
+ "pages.SettingPage.title": "Settings",
34
+ "pages.SettingsPage.Button.description": "Configure the documentation plugin",
35
+ "pages.SettingsPage.header.save": "Save",
36
+ "pages.SettingsPage.password.label": "Password",
37
+ "pages.SettingsPage.toggle.hint": "Make the documentation endpoint private",
38
+ "pages.SettingsPage.toggle.label": "Restricted Access",
28
39
  "plugin.description.long": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
29
40
  "plugin.description.short": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
30
41
  "plugin.name": "Documentation"
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Última generación",
3
2
  "components.Row.open": "Abrir",
4
3
  "components.Row.regenerate": "Regenerar",
5
4
  "containers.HomePage.Block.title": "Versiones",
6
- "containers.HomePage.Button.open": "Abrir la documentación",
7
5
  "containers.HomePage.Button.update": "Actualizar",
8
- "containers.HomePage.PluginHeader.description": "Configurar el plugin de documentación",
9
6
  "containers.HomePage.PluginHeader.title": "Documentación - Configuración",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Confirmar",
11
8
  "containers.HomePage.PopUpWarning.message": "¿Estás seguro de que deseas eliminar esta versión?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Dernière création",
3
2
  "components.Row.open": "Ouvrir",
4
3
  "components.Row.regenerate": "Recréer",
5
4
  "containers.HomePage.Block.title": "Versions",
6
- "containers.HomePage.Button.open": "Ouvrir la documentation",
7
5
  "containers.HomePage.Button.update": "Mettre à jour",
8
- "containers.HomePage.PluginHeader.description": "Configurez votre plugin de documentation",
9
6
  "containers.HomePage.PluginHeader.title": "Documentation - Paramètres",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Supprimer",
11
8
  "containers.HomePage.PopUpWarning.message": "Êtes-vous sûr·e de vouloir supprimer cette version ?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Generasi terakhir",
3
2
  "components.Row.open": "Buka",
4
3
  "components.Row.regenerate": "Diperbarui",
5
4
  "containers.HomePage.Block.title": "Versi",
6
- "containers.HomePage.Button.open": "Buka dokumentasi",
7
5
  "containers.HomePage.Button.update": "Perbarui",
8
- "containers.HomePage.PluginHeader.description": "Konfigurasikan plugin dokumentasi",
9
6
  "containers.HomePage.PluginHeader.title": "Dokumentasi - Pengaturan",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Saya mengerti",
11
8
  "containers.HomePage.PopUpWarning.message": "Anda yakin ingin menghapus versi ini?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Ultima generazione",
3
2
  "components.Row.open": "Apri",
4
3
  "components.Row.regenerate": "Rigenera",
5
4
  "containers.HomePage.Block.title": "Versioni",
6
- "containers.HomePage.Button.open": "Apri la documentazione",
7
5
  "containers.HomePage.Button.update": "Aggiorna",
8
- "containers.HomePage.PluginHeader.description": "Configura il plugin Documentazione",
9
6
  "containers.HomePage.PluginHeader.title": "Documentazione - Impostazioni",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Ho capito",
11
8
  "containers.HomePage.PopUpWarning.message": "Sei sicuro di voler eliminare questa versione?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Last generation",
3
2
  "components.Row.open": "Open",
4
3
  "components.Row.regenerate": "Regenerate",
5
4
  "containers.HomePage.Block.title": "Versions",
6
- "containers.HomePage.Button.open": "Open the documentation",
7
5
  "containers.HomePage.Button.update": "Update",
8
- "containers.HomePage.PluginHeader.description": "Configure the documentation plugin",
9
6
  "containers.HomePage.PluginHeader.title": "Documentation - Settings",
10
7
  "containers.HomePage.PopUpWarning.confirm": "I understand",
11
8
  "containers.HomePage.PopUpWarning.message": "Are you sure you want to delete this version?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Hasil yang lalu",
3
2
  "components.Row.open": "Buka",
4
3
  "components.Row.regenerate": "Hasilkan Semula",
5
4
  "containers.HomePage.Block.title": "Versi",
6
- "containers.HomePage.Button.open": "Buka Dokumen",
7
5
  "containers.HomePage.Button.update": "Kemas Kini",
8
- "containers.HomePage.PluginHeader.description": "Tetapkan plugin dokumen the documentation plugin",
9
6
  "containers.HomePage.PluginHeader.title": "Dokumen - Tetapan",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Saya faham",
11
8
  "containers.HomePage.PopUpWarning.message": "Anda pasti untuk memadam versi ini?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Last generation",
3
2
  "components.Row.open": "Open",
4
3
  "components.Row.regenerate": "Regenerate",
5
4
  "containers.HomePage.Block.title": "Versions",
6
- "containers.HomePage.Button.open": "Open the documentation",
7
5
  "containers.HomePage.Button.update": "Update",
8
- "containers.HomePage.PluginHeader.description": "Configure the documentation plugin",
9
6
  "containers.HomePage.PluginHeader.title": "Documentation - Settings",
10
7
  "containers.HomePage.PopUpWarning.confirm": "I understand",
11
8
  "containers.HomePage.PopUpWarning.message": "Are you sure you want to delete this version?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Data ostatniego wygenerowania",
3
2
  "components.Row.open": "Otwórz",
4
3
  "components.Row.regenerate": "Wygeneruj ponownie",
5
4
  "containers.HomePage.Block.title": "Wersje",
6
- "containers.HomePage.Button.open": "Otwórz dokumentację",
7
5
  "containers.HomePage.Button.update": "Zaktualizuj",
8
- "containers.HomePage.PluginHeader.description": "Skonfiguruj plugin dokumentacjis",
9
6
  "containers.HomePage.PluginHeader.title": "Dokuemntacja - Ustawienia",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Rozumiem",
11
8
  "containers.HomePage.PopUpWarning.message": "Czy jesteś pewien, że chcesz usunąć tę wersję?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Last generation",
3
2
  "components.Row.open": "Open",
4
3
  "components.Row.regenerate": "Regenerate",
5
4
  "containers.HomePage.Block.title": "Versions",
6
- "containers.HomePage.Button.open": "Open the documentation",
7
5
  "containers.HomePage.Button.update": "Update",
8
- "containers.HomePage.PluginHeader.description": "Configure the documentation plugin",
9
6
  "containers.HomePage.PluginHeader.title": "Documentation - Settings",
10
7
  "containers.HomePage.PopUpWarning.confirm": "I understand",
11
8
  "containers.HomePage.PopUpWarning.message": "Are you sure you want to delete this version?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Last generation",
3
2
  "components.Row.open": "Open",
4
3
  "components.Row.regenerate": "Regenerate",
5
4
  "containers.HomePage.Block.title": "Versions",
6
- "containers.HomePage.Button.open": "Open the documentation",
7
5
  "containers.HomePage.Button.update": "Update",
8
- "containers.HomePage.PluginHeader.description": "Configure the documentation plugin",
9
6
  "containers.HomePage.PluginHeader.title": "Documentation - Settings",
10
7
  "containers.HomePage.PopUpWarning.confirm": "I understand",
11
8
  "containers.HomePage.PopUpWarning.message": "Are you sure you want to delete this version?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Последнее обновление",
3
2
  "components.Row.open": "Открыть",
4
3
  "components.Row.regenerate": "Сгенерировать",
5
4
  "containers.HomePage.Block.title": "Версии",
6
- "containers.HomePage.Button.open": "Открыть документацию",
7
5
  "containers.HomePage.Button.update": "Обновить",
8
- "containers.HomePage.PluginHeader.description": "Настройте плагин документации",
9
6
  "containers.HomePage.PluginHeader.title": "Документация - Настройки",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Я понимаю",
11
8
  "containers.HomePage.PopUpWarning.message": "Вы уверены что хотите удалить эту версию?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Posledný dátum vygenerovania",
3
2
  "components.Row.open": "Otvoriť",
4
3
  "components.Row.regenerate": "Znova vygenerovať",
5
4
  "containers.HomePage.Block.title": "Verzie",
6
- "containers.HomePage.Button.open": "Otvoriť dokumentáciu",
7
5
  "containers.HomePage.Button.update": "Upraviť",
8
- "containers.HomePage.PluginHeader.description": "Nastavenia dokumentácie",
9
6
  "containers.HomePage.PluginHeader.title": "Dokumentácia - Nastavenia",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Rozumiem",
11
8
  "containers.HomePage.PopUpWarning.message": "Ste si istý, že chcete odstrániť túto verziu?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "การสร้างล่าสุด",
3
2
  "components.Row.open": "เปิด",
4
3
  "components.Row.regenerate": "สร้างใหม่",
5
4
  "containers.HomePage.Block.title": "เวอร์ชัน",
6
- "containers.HomePage.Button.open": "เปิดเอกสารคู่มือ",
7
5
  "containers.HomePage.Button.update": "อัพเดต",
8
- "containers.HomePage.PluginHeader.description": "กำหนดค่าปลั๊กอินเอกสารคู่มือ",
9
6
  "containers.HomePage.PluginHeader.title": "เอกสารคู่มือ - การตั้งค่า",
10
7
  "containers.HomePage.PopUpWarning.confirm": "ฉันเข้าใจ",
11
8
  "containers.HomePage.PopUpWarning.message": "คุณแน่ใจว่าต้องการลบเวอร์ชันนี้หรือไม่?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Last generation",
3
2
  "components.Row.open": "Open",
4
3
  "components.Row.regenerate": "Regenerate",
5
4
  "containers.HomePage.Block.title": "Versions",
6
- "containers.HomePage.Button.open": "Open the documentation",
7
5
  "containers.HomePage.Button.update": "Update",
8
- "containers.HomePage.PluginHeader.description": "Configure the documentation plugin",
9
6
  "containers.HomePage.PluginHeader.title": "Documentation - Settings",
10
7
  "containers.HomePage.PopUpWarning.confirm": "I understand",
11
8
  "containers.HomePage.PopUpWarning.message": "Are you sure you want to delete this version?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Згенеровано востаннє",
3
2
  "components.Row.open": "Відкрити",
4
3
  "components.Row.regenerate": "Згенерувати",
5
4
  "containers.HomePage.Block.title": "Версії",
6
- "containers.HomePage.Button.open": "Відкрити документацію",
7
5
  "containers.HomePage.Button.update": "Оновити",
8
- "containers.HomePage.PluginHeader.description": "Налаштуйте плаґін документації",
9
6
  "containers.HomePage.PluginHeader.title": "Документація - Налаштування",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Я усвідомлюю",
11
8
  "containers.HomePage.PopUpWarning.message": "Ви впевнені, що хочете видалити цю версію?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "Lần sinh ra gần nhất",
3
2
  "components.Row.open": "Mở",
4
3
  "components.Row.regenerate": "Sinh lại",
5
4
  "containers.HomePage.Block.title": "Các Phiên Bản",
6
- "containers.HomePage.Button.open": "Mở tải liệu",
7
5
  "containers.HomePage.Button.update": "Cập nhật",
8
- "containers.HomePage.PluginHeader.description": "Cấu hình cho tài liệu của plugin",
9
6
  "containers.HomePage.PluginHeader.title": "Tài liệu - Cài đặt",
10
7
  "containers.HomePage.PopUpWarning.confirm": "Tôi hiểu",
11
8
  "containers.HomePage.PopUpWarning.message": "Bạn có chắc là muốn xóa phiên bản này không?",
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "上一个生成的版本",
3
2
  "components.Row.open": "打开",
4
3
  "components.Row.regenerate": "重新生成",
5
4
  "containers.HomePage.Block.title": "版本号",
6
- "containers.HomePage.Button.open": "打开文档",
7
5
  "containers.HomePage.Button.update": "更新",
8
- "containers.HomePage.PluginHeader.description": "配置文档插件",
9
6
  "containers.HomePage.PluginHeader.title": "文档 - 设置",
10
7
  "containers.HomePage.PopUpWarning.confirm": "我确定",
11
8
  "containers.HomePage.PopUpWarning.message": "您确定要删除此版本吗?",
@@ -22,10 +19,10 @@
22
19
  "error.noVersion": "需要一个版本",
23
20
  "error.regenerateDoc": "重新生成文件时发生错误",
24
21
  "error.regenerateDoc.versionMissing": "您尝试重新生成的版本不存在",
25
- "notification.update.success": "设置更新成功",
26
22
  "notification.delete.success": "文档删除成功",
27
23
  "notification.generate.success": "文档生成成功",
28
- "plugin.name": "文档",
24
+ "notification.update.success": "设置更新成功",
29
25
  "plugin.description.long": "创建OpenAPI文档并使用SwaggerUI可视化你的API",
30
- "plugin.description.short": "创建OpenAPI文档并使用SwaggerUI可视化你的API"
26
+ "plugin.description.short": "创建OpenAPI文档并使用SwaggerUI可视化你的API",
27
+ "plugin.name": "文档"
31
28
  }
@@ -1,11 +1,8 @@
1
1
  {
2
- "components.Row.generatedDate": "最後產生的時間",
3
2
  "components.Row.open": "開啟",
4
3
  "components.Row.regenerate": "重新產生",
5
4
  "containers.HomePage.Block.title": "版本",
6
- "containers.HomePage.Button.open": "打開文件資料",
7
5
  "containers.HomePage.Button.update": "更新",
8
- "containers.HomePage.PluginHeader.description": "配置文件資料擴充套件設定",
9
6
  "containers.HomePage.PluginHeader.title": "文件資料 - 設定",
10
7
  "containers.HomePage.PopUpWarning.confirm": "我了解了",
11
8
  "containers.HomePage.PopUpWarning.message": "你確定要刪除這個版本嗎?",
package/package.json CHANGED
@@ -1,74 +1,59 @@
1
1
  {
2
2
  "name": "@strapi/plugin-documentation",
3
- "version": "4.0.0-next.9",
3
+ "version": "4.0.0",
4
4
  "description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
5
- "strapi": {
6
- "displayName": "Documentation",
7
- "name": "documentation",
8
- "icon": "book",
9
- "description": "documentation.plugin.description",
10
- "kind": "plugin"
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/strapi/strapi.git",
8
+ "directory": "packages/plugins/documentation"
9
+ },
10
+ "license": "SEE LICENSE IN LICENSE",
11
+ "author": {
12
+ "name": "Strapi Solutions SAS",
13
+ "email": "hi@strapi.io",
14
+ "url": "https://strapi.io"
11
15
  },
16
+ "maintainers": [
17
+ {
18
+ "name": "Strapi Solutions SAS",
19
+ "email": "hi@strapi.io",
20
+ "url": "https://strapi.io"
21
+ }
22
+ ],
12
23
  "scripts": {
13
24
  "test": "echo \"no tests yet\""
14
25
  },
15
26
  "dependencies": {
16
- "@strapi/helper-plugin": "^4.0.0-next.9",
27
+ "@strapi/helper-plugin": "4.0.0",
28
+ "@strapi/utils": "4.0.0",
29
+ "bcryptjs": "2.4.3",
17
30
  "cheerio": "^1.0.0-rc.5",
18
31
  "fs-extra": "^9.1.0",
32
+ "koa-session": "6.2.0",
19
33
  "koa-static": "^5.0.0",
20
34
  "lodash": "4.17.21",
21
- "moment": "^2.29.1",
22
- "path-to-regexp": "^3.1.0",
35
+ "path-to-regexp": "6.2.0",
36
+ "pluralize": "8.0.0",
23
37
  "react": "^17.0.2",
24
38
  "react-copy-to-clipboard": "^5.0.3",
25
39
  "react-dom": "^17.0.2",
26
40
  "react-intl": "5.20.2",
27
41
  "react-redux": "7.2.3",
28
42
  "react-router": "^5.2.0",
29
- "react-router-dom": "^5.0.0",
30
- "reactstrap": "8.4.1",
43
+ "react-router-dom": "5.2.0",
31
44
  "redux": "^4.0.1",
32
45
  "reselect": "^4.0.0",
33
46
  "swagger-ui-dist": "3.47.1"
34
47
  },
35
- "author": {
36
- "name": "soupette",
37
- "email": "hi@strapi.io",
38
- "url": "https://strapi.io"
39
- },
40
- "maintainers": [
41
- {
42
- "name": "Strapi",
43
- "email": "hi@strapi.io",
44
- "url": "https://strapi.io"
45
- },
46
- {
47
- "name": "soupette",
48
- "email": "cyril@strapi.io"
49
- },
50
- {
51
- "name": "lauriejim",
52
- "email": "jim@strapi.io"
53
- }
54
- ],
55
- "contributors": [
56
- {
57
- "name": "soupette"
58
- },
59
- {
60
- "name": "Aurelsicoko",
61
- "email": "aurelien@strapi.io"
62
- },
63
- {
64
- "name": "lauriejim",
65
- "email": "jim@strapi.io"
66
- }
67
- ],
68
48
  "engines": {
69
49
  "node": ">=12.x.x <=16.x.x",
70
50
  "npm": ">=6.0.0"
71
51
  },
72
- "license": "SEE LICENSE IN LICENSE",
73
- "gitHead": "231263a3535658bab1e9492c6aaaed8692d62a53"
52
+ "strapi": {
53
+ "displayName": "Documentation",
54
+ "name": "documentation",
55
+ "description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
56
+ "kind": "plugin"
57
+ },
58
+ "gitHead": "b181702f0202b2c6d645d42b195a831f25cd0b03"
74
59
  }
@@ -1,10 +1,6 @@
1
1
  /* eslint-disable no-unreachable */
2
2
  'use strict';
3
3
 
4
- const fs = require('fs');
5
- const path = require('path');
6
- const _ = require('lodash');
7
-
8
4
  // Add permissions
9
5
  const RBAC_ACTIONS = [
10
6
  {
@@ -17,126 +13,44 @@ const RBAC_ACTIONS = [
17
13
  section: 'plugins',
18
14
  displayName: 'Update and delete',
19
15
  uid: 'settings.update',
20
- subCategory: 'settings',
21
16
  pluginName: 'documentation',
22
17
  },
23
18
  {
24
19
  section: 'plugins',
25
20
  displayName: 'Regenerate',
26
21
  uid: 'settings.regenerate',
27
- subCategory: 'settings',
28
22
  pluginName: 'documentation',
29
23
  },
24
+ {
25
+ section: 'settings',
26
+ displayName: 'Access the documentation settings page',
27
+ uid: 'settings.read',
28
+ pluginName: 'documentation',
29
+ category: 'documentation',
30
+ },
30
31
  ];
31
32
 
32
- module.exports = async () => {
33
+ /**
34
+ *
35
+ * @param {{strapi: import("@strapi/strapi").Strapi}} args
36
+ */
37
+ module.exports = async ({ strapi }) => {
33
38
  await strapi.admin.services.permission.actionProvider.registerMany(RBAC_ACTIONS);
34
39
 
35
- return;
36
-
37
- // Check if the plugin users-permissions is installed because the documentation needs it
38
- if (Object.keys(strapi.plugins).indexOf('users-permissions') === -1) {
39
- throw new Error(
40
- 'In order to make the documentation plugin works the users-permissions one is required'
41
- );
42
- }
43
-
44
40
  const pluginStore = strapi.store({
45
41
  environment: '',
46
42
  type: 'plugin',
47
43
  name: 'documentation',
48
44
  });
49
- const restrictedAccess = await pluginStore.get({ key: 'config' });
50
-
51
- if (!restrictedAccess) {
52
- pluginStore.set({ key: 'config', value: { restrictedAccess: false } });
53
- }
54
-
55
- let shouldUpdateFullDoc = false;
56
- const services = strapi.plugins['documentation'].services.documentation;
57
- // Generate plugins' documentation
58
- const pluginsWithDocumentationNeeded = services.getPluginsWithDocumentationNeeded();
59
-
60
- pluginsWithDocumentationNeeded.forEach(plugin => {
61
- const isDocExisting = services.checkIfPluginDocumentationFolderExists(plugin);
62
-
63
- if (!isDocExisting) {
64
- services.createDocumentationDirectory(services.getPluginDocumentationPath(plugin));
65
- // create the overrides directory
66
- services.createDocumentationDirectory(services.getPluginOverrideDocumentationPath(plugin));
67
- services.createPluginDocumentationFile(plugin);
68
- shouldUpdateFullDoc = true;
69
- } else {
70
- const needToUpdatePluginDoc = services.checkIfPluginDocNeedsUpdate(plugin);
71
-
72
- if (needToUpdatePluginDoc) {
73
- services.createPluginDocumentationFile(plugin);
74
- shouldUpdateFullDoc = true;
75
- }
76
- }
77
- });
78
-
79
- // Retrieve all the apis from the apis directory
80
- const apis = services.getApis();
81
- // Generate APIS' documentation
82
- apis.forEach(api => {
83
- const isDocExisting = services.checkIfDocumentationFolderExists(api);
84
45
 
85
- if (!isDocExisting) {
86
- // If the documentation directory doesn't exist create it
87
- services.createDocumentationDirectory(services.getDocumentationPath(api));
88
- // Create the overrides directory
89
- services.createDocumentationDirectory(services.getDocumentationOverridesPath(api));
90
- // Create the documentation files per version
91
- services.createDocumentationFile(api); // Then create the {api}.json documentation file
92
- shouldUpdateFullDoc = true;
93
- } else {
94
- const needToUpdateAPIDoc = services.checkIfAPIDocNeedsUpdate(api);
46
+ const config = await pluginStore.get({ key: 'config' });
95
47
 
96
- if (needToUpdateAPIDoc) {
97
- services.createDocumentationFile(api);
98
- shouldUpdateFullDoc = true;
99
- }
100
- }
101
- });
102
-
103
- const fullDoc = services.generateFullDoc();
104
- // Verify that the correct documentation folder exists in the documentation plugin
105
- const isMergedDocumentationExists = services.checkIfMergedDocumentationFolderExists();
106
- const documentationPath = services.getMergedDocumentationPath();
107
-
108
- if (isMergedDocumentationExists) {
109
- /**
110
- * Retrieve all tags from the documentation and join them
111
- * @param {Object} documentation
112
- * @returns {String}
113
- */
114
- const getDocTagsToString = documentation => {
115
- return _.get(documentation, 'tags', [])
116
- .map(tag => {
117
- return tag.name.toLowerCase();
118
- })
119
- .sort((a, b) => a - b)
120
- .join('.');
121
- };
122
- const oldDoc = require(path.resolve(documentationPath, 'full_documentation.json'));
123
- const oldDocTags = getDocTagsToString(oldDoc);
124
- const currentDocTags = getDocTagsToString(fullDoc);
125
-
126
- // If the tags are different (an api has been deleted) we need to rebuild the documentation
127
- if (oldDocTags !== currentDocTags) {
128
- shouldUpdateFullDoc = true;
129
- }
48
+ if (!config) {
49
+ pluginStore.set({ key: 'config', value: { restrictedAccess: false } });
130
50
  }
131
51
 
132
- if (!isMergedDocumentationExists || shouldUpdateFullDoc) {
133
- // Create the folder
134
- services.createDocumentationDirectory(documentationPath);
135
- // Write the file
136
- fs.writeFileSync(
137
- path.resolve(documentationPath, 'full_documentation.json'),
138
- JSON.stringify(fullDoc, null, 2),
139
- 'utf8'
140
- );
141
- }
52
+ await strapi
53
+ .plugin('documentation')
54
+ .service('documentation')
55
+ .generateFullDoc();
142
56
  };
@@ -21,28 +21,25 @@ module.exports = {
21
21
  path: '/documentation',
22
22
  showGeneratedFiles: true,
23
23
  generateDefaultResponse: true,
24
+ plugins: ['email', 'upload'],
24
25
  },
25
- servers: [
26
- {
27
- url: 'http://localhost:1337',
28
- description: 'Development server',
29
- },
30
- {
31
- url: 'YOUR_STAGING_SERVER',
32
- description: 'Staging server',
33
- },
34
- {
35
- url: 'YOUR_PRODUCTION_SERVER',
36
- description: 'Production server',
37
- },
38
- ],
26
+ servers: [],
39
27
  externalDocs: {
40
28
  description: 'Find out more',
41
- url: 'https://strapi.io/documentation/developer-docs/latest/getting-started/introduction.html',
29
+ url: 'https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html',
42
30
  },
43
31
  security: [
44
32
  {
45
33
  bearerAuth: [],
46
34
  },
47
35
  ],
36
+ components: {
37
+ securitySchemes: {
38
+ bearerAuth: {
39
+ type: 'http',
40
+ scheme: 'bearer',
41
+ bearerFormat: 'JWT',
42
+ },
43
+ },
44
+ },
48
45
  };
@@ -1,8 +1,16 @@
1
1
  'use strict';
2
2
 
3
- const defaultConfig = require('./default-config');
3
+ const defaultDocumentationConfig = require('./default-config');
4
+
5
+ const defaultConfig = {
6
+ ...defaultDocumentationConfig,
7
+ session: {
8
+ key: 'plugin::documentation.sess',
9
+ maxAge: 'session',
10
+ secretKeys: ['mySecret'],
11
+ },
12
+ };
4
13
 
5
14
  module.exports = {
6
15
  default: defaultConfig,
7
- validator: () => {},
8
16
  };