@strapi/plugin-documentation 0.0.0-d0fee44d6f → 0.0.0-d36609ff26fb4e00a41a7e2b657f16c7466203fe

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 (33) hide show
  1. package/__tests__/build-component-schema.test.js +8 -8
  2. package/admin/src/index.js +3 -3
  3. package/admin/src/pages/PluginPage/index.js +3 -3
  4. package/admin/src/pages/PluginPage/tests/index.test.js +1 -1
  5. package/admin/src/pages/SettingsPage/index.js +3 -3
  6. package/admin/src/pages/SettingsPage/tests/index.test.js +1 -1
  7. package/admin/src/pages/utils/api.js +1 -1
  8. package/admin/src/pages/utils/useReactQuery.js +3 -3
  9. package/admin/src/translations/dk.json +1 -1
  10. package/admin/src/translations/en.json +1 -1
  11. package/admin/src/translations/es.json +1 -1
  12. package/admin/src/translations/ko.json +1 -1
  13. package/admin/src/translations/pl.json +1 -1
  14. package/admin/src/translations/sv.json +39 -0
  15. package/admin/src/translations/tr.json +37 -18
  16. package/admin/src/translations/zh.json +20 -5
  17. package/admin/src/utils/getTrad.js +1 -1
  18. package/admin/src/utils/openWithNewTab.js +1 -1
  19. package/package.json +12 -8
  20. package/server/bootstrap.js +2 -4
  21. package/server/controllers/documentation.js +3 -6
  22. package/server/public/index.html +27 -14
  23. package/server/public/login.html +131 -121
  24. package/server/routes/index.js +1 -0
  25. package/server/services/documentation.js +8 -7
  26. package/server/services/helpers/build-api-endpoint-path.js +10 -10
  27. package/server/services/helpers/build-component-schema.js +82 -22
  28. package/server/services/helpers/utils/clean-schema-attributes.js +51 -28
  29. package/server/services/helpers/utils/get-schema-data.js +2 -2
  30. package/server/services/helpers/utils/loop-content-type-names.js +1 -0
  31. package/server/services/helpers/utils/pascal-case.js +1 -1
  32. package/server/services/helpers/utils/query-params.js +22 -1
  33. package/server/services/helpers/utils/routes.js +2 -2
@@ -79,8 +79,8 @@ describe('Build Component Schema', () => {
79
79
  }
80
80
 
81
81
  const schemaNames = Object.keys(schemas);
82
- const pluginListResponseValue = schemas['UsersPermissionsRoleListResponse'];
83
- const apiListResponseValue = schemas['RestaurantListResponse'];
82
+ const pluginListResponseValue = schemas.UsersPermissionsRoleListResponse;
83
+ const apiListResponseValue = schemas.RestaurantListResponse;
84
84
 
85
85
  const expectedShape = {
86
86
  type: 'object',
@@ -144,8 +144,8 @@ describe('Build Component Schema', () => {
144
144
  }
145
145
 
146
146
  const schemaNames = Object.keys(schemas);
147
- const pluginListResponseValue = schemas['UsersPermissionsRoleRequest'];
148
- const apiListResponseValue = schemas['RestaurantRequest'];
147
+ const pluginListResponseValue = schemas.UsersPermissionsRoleRequest;
148
+ const apiListResponseValue = schemas.RestaurantRequest;
149
149
 
150
150
  const expectedShape = {
151
151
  type: 'object',
@@ -192,8 +192,8 @@ describe('Build Component Schema', () => {
192
192
  }
193
193
 
194
194
  const schemaNames = Object.keys(schemas);
195
- const pluginListResponseValue = schemas['UsersPermissionsRoleLocalizationResponse'];
196
- const apiListResponseValue = schemas['RestaurantLocalizationResponse'];
195
+ const pluginListResponseValue = schemas.UsersPermissionsRoleLocalizationResponse;
196
+ const apiListResponseValue = schemas.RestaurantLocalizationResponse;
197
197
 
198
198
  const expectedShape = {
199
199
  type: 'object',
@@ -236,8 +236,8 @@ describe('Build Component Schema', () => {
236
236
  }
237
237
 
238
238
  const schemaNames = Object.keys(schemas);
239
- const pluginListResponseValue = schemas['UsersPermissionsRoleLocalizationRequest'];
240
- const apiListResponseValue = schemas['RestaurantLocalizationRequest'];
239
+ const pluginListResponseValue = schemas.UsersPermissionsRoleLocalizationRequest;
240
+ const apiListResponseValue = schemas.RestaurantLocalizationRequest;
241
241
 
242
242
  const expectedShape = {
243
243
  type: 'object',
@@ -22,7 +22,7 @@ export default {
22
22
  defaultMessage: 'Documentation',
23
23
  },
24
24
  permissions: pluginPermissions.main,
25
- Component: async () => {
25
+ async Component() {
26
26
  const component = await import(
27
27
  /* webpackChunkName: "documentation-page" */ './pages/PluginPage'
28
28
  );
@@ -44,7 +44,7 @@ export default {
44
44
  },
45
45
  id: 'documentation',
46
46
  to: `/settings/${pluginId}`,
47
- Component: async () => {
47
+ async Component() {
48
48
  const component = await import(
49
49
  /* webpackChunkName: "documentation-settings" */ './pages/SettingsPage'
50
50
  );
@@ -56,7 +56,7 @@ export default {
56
56
  },
57
57
  async registerTrads({ locales }) {
58
58
  const importedTrads = await Promise.all(
59
- locales.map(locale => {
59
+ locales.map((locale) => {
60
60
  return import(
61
61
  /* webpackChunkName: "documentation-translation-[request]" */ `./translations/${locale}.json`
62
62
  )
@@ -49,7 +49,7 @@ const PluginPage = () => {
49
49
  openWithNewTab(`${slash}${data?.prefix}/v${data?.currentVersion}`);
50
50
  };
51
51
 
52
- const handleRegenerateDoc = version => {
52
+ const handleRegenerateDoc = (version) => {
53
53
  regenerateDocMutation.mutate({ version, prefix: data?.prefix });
54
54
  };
55
55
 
@@ -64,7 +64,7 @@ const PluginPage = () => {
64
64
  setIsConfirmButtonLoading(false);
65
65
  };
66
66
 
67
- const handleClickDelete = version => {
67
+ const handleClickDelete = (version) => {
68
68
  setVersionToDelete(version);
69
69
  setShowConfirmDelete(!showConfirmDelete);
70
70
  };
@@ -123,7 +123,7 @@ const PluginPage = () => {
123
123
  <Tbody>
124
124
  {data.docVersions
125
125
  .sort((a, b) => (a.generatedDate < b.generatedDate ? 1 : -1))
126
- .map(doc => (
126
+ .map((doc) => (
127
127
  <Tr key={doc.version}>
128
128
  <Td width="50%">
129
129
  <Typography>{doc.version}</Typography>
@@ -23,7 +23,7 @@ const client = new QueryClient({
23
23
  },
24
24
  });
25
25
 
26
- const makeApp = history => (
26
+ const makeApp = (history) => (
27
27
  <Router history={history}>
28
28
  <ThemeProvider theme={lightTheme}>
29
29
  <QueryClientProvider client={client}>
@@ -36,7 +36,7 @@ const SettingsPage = () => {
36
36
  const { submitMutation, data, isLoading } = useReactQuery();
37
37
  const [passwordShown, setPasswordShown] = useState(false);
38
38
 
39
- const handleUpdateSettingsSubmit = body => {
39
+ const handleUpdateSettingsSubmit = (body) => {
40
40
  submitMutation.mutate({
41
41
  prefix: data?.prefix,
42
42
  body,
@@ -143,9 +143,9 @@ const SettingsPage = () => {
143
143
  }
144
144
  endAction={
145
145
  <FieldActionWrapper
146
- onClick={e => {
146
+ onClick={(e) => {
147
147
  e.stopPropagation();
148
- setPasswordShown(prev => !prev);
148
+ setPasswordShown((prev) => !prev);
149
149
  }}
150
150
  label={formatMessage(
151
151
  passwordShown
@@ -23,7 +23,7 @@ const client = new QueryClient({
23
23
  },
24
24
  });
25
25
 
26
- const makeApp = history => (
26
+ const makeApp = (history) => (
27
27
  <Router history={history}>
28
28
  <ThemeProvider theme={lightTheme}>
29
29
  <QueryClientProvider client={client}>
@@ -5,7 +5,7 @@ const deleteDoc = ({ prefix, version }) => {
5
5
  return request(`${prefix}/deleteDoc/${version}`, { method: 'DELETE' });
6
6
  };
7
7
 
8
- const fetchDocumentationVersions = async toggleNotification => {
8
+ const fetchDocumentationVersions = async (toggleNotification) => {
9
9
  try {
10
10
  const data = await request(`/${pluginId}/getInfos`, { method: 'GET' });
11
11
 
@@ -10,7 +10,7 @@ const useReactQuery = () => {
10
10
  fetchDocumentationVersions(toggleNotification)
11
11
  );
12
12
 
13
- const handleError = err => {
13
+ const handleError = (err) => {
14
14
  toggleNotification({
15
15
  type: 'warning',
16
16
  message: err.response.payload.message,
@@ -27,7 +27,7 @@ const useReactQuery = () => {
27
27
 
28
28
  const deleteMutation = useMutation(deleteDoc, {
29
29
  onSuccess: () => handleSuccess('info', 'notification.delete.success'),
30
- onError: error => handleError(error),
30
+ onError: (error) => handleError(error),
31
31
  });
32
32
 
33
33
  const submitMutation = useMutation(updateSettings, {
@@ -37,7 +37,7 @@ const useReactQuery = () => {
37
37
 
38
38
  const regenerateDocMutation = useMutation(regenerateDoc, {
39
39
  onSuccess: () => handleSuccess('info', 'notification.generate.success'),
40
- onError: error => handleError(error),
40
+ onError: (error) => handleError(error),
41
41
  });
42
42
 
43
43
  return { data, isLoading, deleteMutation, submitMutation, regenerateDocMutation };
@@ -29,7 +29,7 @@
29
29
  "pages.PluginPage.table.icon.regenerate": "Regenerér {target}",
30
30
  "pages.PluginPage.table.icon.show": "Åben {target}",
31
31
  "pages.PluginPage.table.version": "Version",
32
- "pages.SettingsPage.Button.description": "Konfigurér dokumentations pluginnet",
32
+ "pages.SettingsPage.header.description": "Konfigurér dokumentations pluginnet",
33
33
  "pages.SettingsPage.header.save": "Gem",
34
34
  "pages.SettingsPage.toggle.hint": "Gør dokumentationens endpoint privat",
35
35
  "pages.SettingsPage.toggle.label": "Begrænset adgang",
@@ -29,7 +29,7 @@
29
29
  "pages.PluginPage.table.icon.regenerate": "Regenerate {target}",
30
30
  "pages.PluginPage.table.icon.show": "Open {target}",
31
31
  "pages.PluginPage.table.version": "Version",
32
- "pages.SettingsPage.Button.description": "Configure the documentation plugin",
32
+ "pages.SettingsPage.header.description": "Configure the documentation plugin",
33
33
  "pages.SettingsPage.header.save": "Save",
34
34
  "pages.SettingsPage.toggle.hint": "Make the documentation endpoint private",
35
35
  "pages.SettingsPage.toggle.label": "Restricted Access",
@@ -29,7 +29,7 @@
29
29
  "pages.PluginPage.table.icon.regenerate": "Regenerar {target}",
30
30
  "pages.PluginPage.table.icon.show": "Abrir {target}",
31
31
  "pages.PluginPage.table.version": "Versión",
32
- "pages.SettingsPage.Button.description": "Configura el plugin de documentación",
32
+ "pages.SettingsPage.header.description": "Configura el plugin de documentación",
33
33
  "pages.SettingsPage.header.save": "Guardar",
34
34
  "pages.SettingsPage.toggle.hint": "Hacer que la documentación sea privada",
35
35
  "pages.SettingsPage.toggle.label": "Acceso restringido",
@@ -29,7 +29,7 @@
29
29
  "pages.PluginPage.table.icon.regenerate": "{target} 재생성",
30
30
  "pages.PluginPage.table.icon.show": "{target} 열기",
31
31
  "pages.PluginPage.table.version": "버전",
32
- "pages.SettingsPage.Button.description": "도큐멘테이션 플러그인 설정",
32
+ "pages.SettingsPage.header.description": "도큐멘테이션 플러그인 설정",
33
33
  "pages.SettingsPage.header.save": "저장",
34
34
  "pages.SettingsPage.toggle.hint": "도큐멘테이션 엔드포인트를 비공개로 설정합니다.",
35
35
  "pages.SettingsPage.toggle.label": "액세스 제한",
@@ -29,7 +29,7 @@
29
29
  "pages.PluginPage.table.icon.regenerate": "Wygeneruj ponownie {target}",
30
30
  "pages.PluginPage.table.icon.show": "Otwórz {target}",
31
31
  "pages.PluginPage.table.version": "Wersja",
32
- "pages.SettingsPage.Button.description": "Skonfiguruj plugin dokumentacji",
32
+ "pages.SettingsPage.header.description": "Skonfiguruj plugin dokumentacji",
33
33
  "pages.SettingsPage.header.save": "Zapisz",
34
34
  "pages.SettingsPage.toggle.hint": "Ustaw endpoint dokumentacji na prywatny",
35
35
  "pages.SettingsPage.toggle.label": "Dostęp ograniczony",
@@ -0,0 +1,39 @@
1
+ {
2
+ "coming-soon": "Det här innehållet är för närvarande under uppbyggnad och kommer tillbaka om några veckor!",
3
+ "components.Row.open": "Öppen",
4
+ "components.Row.regenerate": "Återskapa",
5
+ "containers.HomePage.Block.title": "Versioner",
6
+ "containers.HomePage.Button.update": "Uppdatera",
7
+ "containers.HomePage.PluginHeader.title": "Dokumentation - Inställningar",
8
+ "containers.HomePage.PopUpWarning.confirm": "Jag förstår",
9
+ "containers.HomePage.PopUpWarning.message": "Är du säker på att du vill ta bort denna versionen?",
10
+ "containers.HomePage.copied": "Token har kopierats till urklipp",
11
+ "containers.HomePage.form.jwtToken": "Hämta din jwt-token",
12
+ "containers.HomePage.form.jwtToken.description": "Kopiera denna token och använd den i swagger för att göra förfrågningar",
13
+ "containers.HomePage.form.password": "Lösenord",
14
+ "containers.HomePage.form.password.inputDescription": "Ställ in lösenordet som ska behövas för att komma åt dokumentationen",
15
+ "containers.HomePage.form.restrictedAccess": "Begränsad åtkomst",
16
+ "containers.HomePage.form.restrictedAccess.inputDescription": "Gör dokumentationensrutten privat. Som standard är åtkomsten publik",
17
+ "containers.HomePage.form.showGeneratedFiles": "Visa genererade filer",
18
+ "containers.HomePage.form.showGeneratedFiles.inputDescription": "Användbart när du vill överskrida den automatiskt genererade dokumentationen. \nPluginet genererar filer uppdelade efter modell och plugin. \nGenom att aktivera det här blir det lättare att anpassa din dokumentation",
19
+ "error.deleteDoc.versionMissing": "Den version du försöker ta bort finns inte.",
20
+ "error.noVersion": "En version krävs",
21
+ "error.regenerateDoc": "Ett fel uppstod när dokumentet återskapades",
22
+ "error.regenerateDoc.versionMissing": "Den version du försöker generera finns inte",
23
+ "notification.delete.success": "Dokument raderat",
24
+ "notification.generate.success": "Dokument genererat",
25
+ "notification.update.success": "Inställningarna har uppdaterats",
26
+ "pages.PluginPage.Button.open": "Öppna dokumentation",
27
+ "pages.PluginPage.header.description": "Konfigurera dokumentationspluginet",
28
+ "pages.PluginPage.table.generated": "Senast genererade",
29
+ "pages.PluginPage.table.icon.regenerate": "Återskapa {target}",
30
+ "pages.PluginPage.table.icon.show": "Öppna {target}",
31
+ "pages.PluginPage.table.version": "Version",
32
+ "pages.SettingsPage.header.description": "Konfigurera dokumentationspluginet",
33
+ "pages.SettingsPage.header.save": "Spara",
34
+ "pages.SettingsPage.toggle.hint": "Gör dokumentationensrutten privat",
35
+ "pages.SettingsPage.toggle.label": "Begränsad åtkomst",
36
+ "plugin.description.long": "Skapa ett OpenAPI-dokument och visualisera din API med SWAGGER UI.",
37
+ "plugin.description.short": "Skapa ett OpenAPI-dokument och visualisera din API med SWAGGER UI.",
38
+ "plugin.name": "Dokumentation"
39
+ }
@@ -1,20 +1,39 @@
1
1
  {
2
- "components.Row.open": "Open",
3
- "components.Row.regenerate": "Regenerate",
4
- "containers.HomePage.Block.title": "Versions",
5
- "containers.HomePage.Button.update": "Update",
6
- "containers.HomePage.PluginHeader.title": "Documentation - Settings",
7
- "containers.HomePage.PopUpWarning.confirm": "I understand",
8
- "containers.HomePage.PopUpWarning.message": "Are you sure you want to delete this version?",
9
- "containers.HomePage.form.password": "Password",
10
- "containers.HomePage.form.password.inputDescription": "Set the password to access the documentation",
11
- "containers.HomePage.form.restrictedAccess": "Restricted access",
12
- "containers.HomePage.form.restrictedAccess.inputDescription": "Make the documentation endpoint private. By default, the access is public",
13
- "containers.HomePage.form.showGeneratedFiles": "Show generated files",
14
- "containers.HomePage.form.showGeneratedFiles.inputDescription": "Useful when you want to override the generated documentation. \nThe plugin will generate files split by model and plugin. \nBy enabling this option it will be easier to customize your documentation",
15
- "error.deleteDoc.versionMissing": "The version you are trying to delete does not exist.",
16
- "error.noVersion": "A version is required",
17
- "error.regenerateDoc": "An error occurred while regenerating the doc",
18
- "error.regenerateDoc.versionMissing": "The version you are trying to generate doesn't exist",
19
- "notification.update.success": "Settings updated successfully"
2
+ "coming-soon": "Bu içerik şuanda düzenleniyor. Bir kaç hafta sonra yayında olacak!",
3
+ "components.Row.open": "",
4
+ "components.Row.regenerate": "Yeniden üret",
5
+ "containers.HomePage.Block.title": "Versiyonlar",
6
+ "containers.HomePage.Button.update": "Güncelle",
7
+ "containers.HomePage.PluginHeader.title": "Dokümantasyon - Ayarlar",
8
+ "containers.HomePage.PopUpWarning.confirm": "Anladım",
9
+ "containers.HomePage.PopUpWarning.message": "Bu versiyonu silmek istediğinden emin misin?",
10
+ "containers.HomePage.copied": "Token panoya kopyalandı",
11
+ "containers.HomePage.form.jwtToken": "JWT tokenını al",
12
+ "containers.HomePage.form.jwtToken.description": "İstek atmak için bu tokenı kopyala ve swaggerda kullan",
13
+ "containers.HomePage.form.password": "Şifre",
14
+ "containers.HomePage.form.password.inputDescription": "Dokümantasyona erişmek için şifreyi belirle",
15
+ "containers.HomePage.form.restrictedAccess": "Kısıtlı erişim",
16
+ "containers.HomePage.form.restrictedAccess.inputDescription": "Dokümantasyon noktasını gizle. Varsayılan olarak erişim herkese açıktır",
17
+ "containers.HomePage.form.showGeneratedFiles": "Üretilen dosyaları göster",
18
+ "containers.HomePage.form.showGeneratedFiles.inputDescription": "Üretilen dokümantasyonun üzerine yazmak istediğinde kullanışlıdır. \nEklenti dosyaları model ve eklentilere göre ayrı olarak üretecektir. \nBu seçeneği etkinleştirerek dokümantasyonu özelleştirmen kolaylaşacaktır.",
19
+ "error.deleteDoc.versionMissing": "Silmek istediğin versiyon bulunmuyor.",
20
+ "error.noVersion": "Bir versiyon gerekli.",
21
+ "error.regenerateDoc": "Dokümanı yeniden üretirken bir hata oluştu",
22
+ "error.regenerateDoc.versionMissing": "Üretmeye çalıştığın versiyon bulunmuyor",
23
+ "notification.delete.success": "Doküman silindi",
24
+ "notification.generate.success": "Doküman üretildi",
25
+ "notification.update.success": "Ayarlar başarıyla güncellendi",
26
+ "pages.PluginPage.Button.open": "Dokümanı aç",
27
+ "pages.PluginPage.header.description": "Dokümantasyon eklentisini ayarla",
28
+ "pages.PluginPage.table.generated": "Son üretilme",
29
+ "pages.PluginPage.table.icon.regenerate": "Yeniden üret: {target}",
30
+ "pages.PluginPage.table.icon.show": "Aç: {target}",
31
+ "pages.PluginPage.table.version": "Versiyon",
32
+ "pages.SettingsPage.header.description": "Dokümantasyon eklentisini ayarla",
33
+ "pages.SettingsPage.header.save": "Kaydet",
34
+ "pages.SettingsPage.toggle.hint": "Dokümantasyon uç noktasını gizli yap",
35
+ "pages.SettingsPage.toggle.label": "Kısıtlı Erişim",
36
+ "plugin.description.long": "Bir OpenAPI Dokümanı oluştur ve SWAGGER UI ile APIni görselleştir.",
37
+ "plugin.description.short": "Bir OpenAPI Dokümanı oluştur ve SWAGGER UI ile APIni görselleştir.",
38
+ "plugin.name": "Dokümantasyon"
20
39
  }
@@ -1,4 +1,5 @@
1
1
  {
2
+ "coming-soon": "此內容目前正在構建,將在幾周後回歸!",
2
3
  "components.Row.open": "開啟",
3
4
  "components.Row.regenerate": "重新產生",
4
5
  "containers.HomePage.Block.title": "版本",
@@ -6,19 +7,33 @@
6
7
  "containers.HomePage.PluginHeader.title": "文件資料 - 設定",
7
8
  "containers.HomePage.PopUpWarning.confirm": "我了解了",
8
9
  "containers.HomePage.PopUpWarning.message": "你確定要刪除這個版本嗎?",
9
- "containers.HomePage.copied": "Token 已經複製到剪貼簿",
10
- "containers.HomePage.form.jwtToken": "存取你的 jwt token",
11
- "containers.HomePage.form.jwtToken.description": "複製這個token並於swagger中使用於發出請求",
10
+ "containers.HomePage.copied": "權杖已經複製到剪貼簿",
11
+ "containers.HomePage.form.jwtToken": "存取你的 jwt 權杖",
12
+ "containers.HomePage.form.jwtToken.description": "複製這個權杖並於 swagger 中使用於發出請求",
12
13
  "containers.HomePage.form.password": "密碼",
13
14
  "containers.HomePage.form.password.inputDescription": "設定密碼存取權限",
14
15
  "containers.HomePage.form.restrictedAccess": "存取受到限制",
15
- "containers.HomePage.form.restrictedAccess.inputDescription": "將endpoints設定為私密的. 預設是對外公開的",
16
+ "containers.HomePage.form.restrictedAccess.inputDescription": "將 endpoints 設定為私密的。預設是對外公開的",
16
17
  "containers.HomePage.form.showGeneratedFiles": "顯示產生的檔案",
17
- "containers.HomePage.form.showGeneratedFiles.inputDescription": "用於覆寫產生的文件檔案時. \n擴充套件會依照model及plugin分別產生檔案. \n啟用這個選項將會方便你客製化文件資料",
18
+ "containers.HomePage.form.showGeneratedFiles.inputDescription": "用於覆寫產生的文件檔案時。\n擴充套件會依照model及plugin分別產生檔案。\n啟用這個選項將會方便你客製化文件資料",
18
19
  "error.deleteDoc.versionMissing": "你想刪除的版本不存在",
19
20
  "error.noVersion": "版本是必填欄位",
20
21
  "error.regenerateDoc": "重新產生文件資料時發生了錯誤",
21
22
  "error.regenerateDoc.versionMissing": "你想產生的版本不存在",
23
+ "notification.delete.success": "文件已刪除",
24
+ "notification.generate.success": "文件已重新產生",
22
25
  "notification.update.success": "更新設定成功",
26
+ "pages.PluginPage.Button.open": "開啟說明文件",
27
+ "pages.PluginPage.header.description": "設定說明文件外掛程式",
28
+ "pages.PluginPage.table.generated": "最後產生時間",
29
+ "pages.PluginPage.table.icon.regenerate": "重新產生 {target}",
30
+ "pages.PluginPage.table.icon.show": "開啟 {target}",
31
+ "pages.PluginPage.table.version": "版本",
32
+ "pages.SettingsPage.header.description": "設定說明文件外掛程式",
33
+ "pages.SettingsPage.header.save": "儲存",
34
+ "pages.SettingsPage.toggle.hint": "將說明文件端點設為私人",
35
+ "pages.SettingsPage.toggle.label": "受限存取",
36
+ "plugin.description.long": "建立 OpenAPI 文件,並透過 SWAGGER UI 可視化您的 API。",
37
+ "plugin.description.short": "建立 OpenAPI 文件,並透過 SWAGGER UI 可視化您的 API。",
23
38
  "plugin.name": "文件資料"
24
39
  }
@@ -1,5 +1,5 @@
1
1
  import pluginId from '../pluginId';
2
2
 
3
- const getTrad = id => `${pluginId}.${id}`;
3
+ const getTrad = (id) => `${pluginId}.${id}`;
4
4
 
5
5
  export default getTrad;
@@ -1,6 +1,6 @@
1
1
  import { startsWith } from 'lodash';
2
2
 
3
- const openWithNewTab = path => {
3
+ const openWithNewTab = (path) => {
4
4
  const url = (() => {
5
5
  if (startsWith(path, '/')) {
6
6
  return `${strapi.backendURL}${path}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-documentation",
3
- "version": "0.0.0-d0fee44d6f",
3
+ "version": "0.0.0-d36609ff26fb4e00a41a7e2b657f16c7466203fe",
4
4
  "description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,8 +24,8 @@
24
24
  "test": "echo \"no tests yet\""
25
25
  },
26
26
  "dependencies": {
27
- "@strapi/helper-plugin": "0.0.0-d0fee44d6f",
28
- "@strapi/utils": "0.0.0-d0fee44d6f",
27
+ "@strapi/helper-plugin": "0.0.0-d36609ff26fb4e00a41a7e2b657f16c7466203fe",
28
+ "@strapi/utils": "0.0.0-d36609ff26fb4e00a41a7e2b657f16c7466203fe",
29
29
  "bcryptjs": "2.4.3",
30
30
  "cheerio": "^1.0.0-rc.12",
31
31
  "fs-extra": "10.0.0",
@@ -36,20 +36,24 @@
36
36
  "react": "^17.0.2",
37
37
  "react-copy-to-clipboard": "^5.1.0",
38
38
  "react-dom": "^17.0.2",
39
- "react-intl": "5.20.2",
39
+ "react-intl": "5.25.1",
40
40
  "react-redux": "7.2.8",
41
41
  "react-router": "^5.2.0",
42
- "react-router-dom": "5.2.0",
42
+ "react-router-dom": "5.3.4",
43
43
  "redux": "^4.0.1",
44
44
  "reselect": "^4.0.0",
45
- "swagger-ui-dist": "4.12.0",
45
+ "swagger-ui-dist": "4.15.5",
46
46
  "yaml": "1.10.2"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@strapi/strapi": "^4.0.0"
50
50
  },
51
+ "devDependencies": {
52
+ "@testing-library/react": "12.1.4",
53
+ "msw": "0.49.1"
54
+ },
51
55
  "engines": {
52
- "node": ">=14.19.1 <=16.x.x",
56
+ "node": ">=14.19.1 <=18.x.x",
53
57
  "npm": ">=6.0.0"
54
58
  },
55
59
  "strapi": {
@@ -58,5 +62,5 @@
58
62
  "description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
59
63
  "kind": "plugin"
60
64
  },
61
- "gitHead": "d0fee44d6f55df264535c9235c90d69bb7bf165b"
65
+ "gitHead": "d36609ff26fb4e00a41a7e2b657f16c7466203fe"
62
66
  }
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable no-unreachable */
2
+
2
3
  'use strict';
3
4
 
4
5
  // Add permissions
@@ -49,8 +50,5 @@ module.exports = async ({ strapi }) => {
49
50
  pluginStore.set({ key: 'config', value: { restrictedAccess: false } });
50
51
  }
51
52
 
52
- await strapi
53
- .plugin('documentation')
54
- .service('documentation')
55
- .generateFullDoc();
53
+ await strapi.plugin('documentation').service('documentation').generateFullDoc();
56
54
  };
@@ -43,10 +43,7 @@ module.exports = {
43
43
  const version =
44
44
  major && minor && patch
45
45
  ? `${major}.${minor}.${patch}`
46
- : strapi
47
- .plugin('documentation')
48
- .service('documentation')
49
- .getDocumentationVersion();
46
+ : strapi.plugin('documentation').service('documentation').getDocumentationVersion();
50
47
 
51
48
  const openAPISpecsPath = path.join(
52
49
  strapi.dirs.app.extensions,
@@ -177,7 +174,7 @@ module.exports = {
177
174
 
178
175
  const service = strapi.service('plugin::documentation.documentation');
179
176
 
180
- const documentationVersions = service.getDocumentationVersions().map(el => el.version);
177
+ const documentationVersions = service.getDocumentationVersions().map((el) => el.version);
181
178
 
182
179
  if (_.isEmpty(version)) {
183
180
  return ctx.badRequest('Please provide a version.');
@@ -201,7 +198,7 @@ module.exports = {
201
198
 
202
199
  const service = strapi.service('plugin::documentation.documentation');
203
200
 
204
- const documentationVersions = service.getDocumentationVersions().map(el => el.version);
201
+ const documentationVersions = service.getDocumentationVersions().map((el) => el.version);
205
202
 
206
203
  if (_.isEmpty(version)) {
207
204
  return ctx.badRequest('Please provide a version.');
@@ -1,12 +1,27 @@
1
- <!-- HTML for static distribution bundle build --><!DOCTYPE html><html lang="en"><head>
2
- <meta charset="UTF-8">
1
+ <!-- HTML for static distribution bundle build --><!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
3
5
  <title>Swagger UI</title>
4
- <link rel="stylesheet" type="text/css" href="<%=backendUrl%>/plugins/documentation/swagger-ui.css">
5
- <link rel="icon" type="image/png" href="<%=backendUrl%>/plugins/documentation/favicon-32x32.png" sizes="32x32">
6
- <link rel="icon" type="image/png" href="<%=backendUrl%>/plugins/documentation/favicon-16x16.png" sizes="16x16">
6
+ <link
7
+ rel="stylesheet"
8
+ type="text/css"
9
+ href="<%=backendUrl%>/plugins/documentation/swagger-ui.css"
10
+ />
11
+ <link
12
+ rel="icon"
13
+ type="image/png"
14
+ href="<%=backendUrl%>/plugins/documentation/favicon-32x32.png"
15
+ sizes="32x32"
16
+ />
17
+ <link
18
+ rel="icon"
19
+ type="image/png"
20
+ href="<%=backendUrl%>/plugins/documentation/favicon-16x16.png"
21
+ sizes="16x16"
22
+ />
7
23
  <style>
8
- html
9
- {
24
+ html {
10
25
  box-sizing: border-box;
11
26
  overflow: -moz-scrollbars-vertical;
12
27
  overflow-y: scroll;
@@ -14,14 +29,12 @@
14
29
 
15
30
  *,
16
31
  *:before,
17
- *:after
18
- {
32
+ *:after {
19
33
  box-sizing: inherit;
20
34
  }
21
35
 
22
- body
23
- {
24
- margin:0;
36
+ body {
37
+ margin: 0;
25
38
  background: #fafafa;
26
39
  }
27
40
  </style>
@@ -51,7 +64,7 @@
51
64
  }
52
65
  </script>
53
66
 
54
- <script src="<%=backendUrl%>/plugins/documentation/swagger-ui-bundle.js"> </script>
55
- <script src="<%=backendUrl%>/plugins/documentation/swagger-ui-standalone-preset.js"> </script>
67
+ <script src="<%=backendUrl%>/plugins/documentation/swagger-ui-bundle.js"></script>
68
+ <script src="<%=backendUrl%>/plugins/documentation/swagger-ui-standalone-preset.js"></script>
56
69
  </body>
57
70
  </html>