@strapi/admin 4.7.0-beta.0 → 4.9.0-alpha.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 (257) hide show
  1. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +6 -14
  2. package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +1 -1
  3. package/admin/src/content-manager/components/DynamicZone/components/DynamicComponent.js +2 -0
  4. package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +39 -9
  5. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +9 -15
  6. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +4 -12
  7. package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +6 -8
  8. package/admin/src/content-manager/pages/ListView/index.js +6 -11
  9. package/admin/src/hooks/useRegenerate/index.js +2 -2
  10. package/admin/src/hooks/useSettingsMenu/utils/defaultGlobalLinks.js +0 -7
  11. package/admin/src/index.js +1 -0
  12. package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +15 -2
  13. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/CollapsableContentType/index.js +3 -5
  14. package/admin/src/pages/SettingsPage/{components/Tokens/TokenBox → pages/ApiTokens/EditView/components/ContentBox}/index.js +17 -17
  15. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormApiTokenContainer/index.js +142 -52
  16. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormBody/index.js +78 -0
  17. package/admin/src/pages/SettingsPage/{components/Tokens → pages/ApiTokens/EditView/components}/FormHead/index.js +19 -36
  18. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Regenerate/index.js +1 -5
  19. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +14 -37
  20. package/admin/src/pages/SettingsPage/{components/Tokens/Table → pages/ApiTokens/ListView/DynamicTable}/DefaultButton/index.js +1 -1
  21. package/admin/src/pages/SettingsPage/{components/Tokens/Table → pages/ApiTokens/ListView/DynamicTable}/DeleteButton/index.js +1 -1
  22. package/admin/src/pages/SettingsPage/{components/Tokens/Table → pages/ApiTokens/ListView/DynamicTable}/ReadButton/index.js +0 -0
  23. package/admin/src/pages/SettingsPage/{components/Tokens/Table → pages/ApiTokens/ListView/DynamicTable}/UpdateButton/index.js +0 -0
  24. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/index.js +112 -0
  25. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +13 -5
  26. package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/MagicLinkWrapper.js +3 -20
  27. package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +0 -33
  28. package/admin/src/permissions/defaultPermissions.js +2 -23
  29. package/admin/src/translations/ar.json +4 -4
  30. package/admin/src/translations/ca.json +4 -4
  31. package/admin/src/translations/cs.json +4 -4
  32. package/admin/src/translations/de.json +4 -4
  33. package/admin/src/translations/dk.json +4 -4
  34. package/admin/src/translations/en.json +9 -17
  35. package/admin/src/translations/es.json +4 -4
  36. package/admin/src/translations/eu.json +4 -4
  37. package/admin/src/translations/fr.json +4 -4
  38. package/admin/src/translations/gu.json +4 -4
  39. package/admin/src/translations/he.json +4 -4
  40. package/admin/src/translations/hi.json +4 -4
  41. package/admin/src/translations/hu.json +4 -4
  42. package/admin/src/translations/id.json +4 -4
  43. package/admin/src/translations/it.json +4 -4
  44. package/admin/src/translations/ja.json +4 -4
  45. package/admin/src/translations/ko.json +4 -4
  46. package/admin/src/translations/ml.json +4 -4
  47. package/admin/src/translations/ms.json +4 -4
  48. package/admin/src/translations/nl.json +4 -4
  49. package/admin/src/translations/no.json +4 -4
  50. package/admin/src/translations/pl.json +4 -4
  51. package/admin/src/translations/pt-BR.json +4 -4
  52. package/admin/src/translations/pt.json +4 -4
  53. package/admin/src/translations/ru.json +785 -789
  54. package/admin/src/translations/sa.json +4 -4
  55. package/admin/src/translations/sk.json +4 -4
  56. package/admin/src/translations/sv.json +4 -4
  57. package/admin/src/translations/th.json +4 -4
  58. package/admin/src/translations/tr.json +4 -4
  59. package/admin/src/translations/uk.json +4 -4
  60. package/admin/src/translations/vi.json +4 -4
  61. package/admin/src/translations/zh-Hans.json +4 -4
  62. package/admin/src/translations/zh.json +4 -4
  63. package/build/1683.d59d0f23.chunk.js +268 -0
  64. package/build/{4855.bd092921.chunk.js → 2223.1bfea951.chunk.js} +88 -88
  65. package/build/2743.646a1015.chunk.js +45 -0
  66. package/build/3075.3ee481f1.chunk.js +108 -0
  67. package/build/3632.2e378cf8.chunk.js +138 -0
  68. package/build/4318.cd55ce02.chunk.js +30 -0
  69. package/build/8633.00ccd382.chunk.js +1 -0
  70. package/build/9707.b36ed71e.chunk.js +96 -0
  71. package/build/{Admin-authenticatedApp.f29f6021.chunk.js → Admin-authenticatedApp.a73577e1.chunk.js} +2 -2
  72. package/build/{Admin_InternalErrorPage.157152a8.chunk.js → Admin_InternalErrorPage.178ddb90.chunk.js} +1 -1
  73. package/build/{Admin_homePage.b1730882.chunk.js → Admin_homePage.c2f5f27d.chunk.js} +2 -2
  74. package/build/{Admin_marketplace.ea0316c2.chunk.js → Admin_marketplace.1df49c42.chunk.js} +1 -1
  75. package/build/{Admin_pluginsPage.5c24f963.chunk.js → Admin_pluginsPage.8d824408.chunk.js} +2 -2
  76. package/build/{Admin_profilePage.59af1978.chunk.js → Admin_profilePage.cb667bc5.chunk.js} +2 -2
  77. package/build/Admin_settingsPage.f90615fb.chunk.js +178 -0
  78. package/build/{Upload_ConfigureTheView.3f2b6e6a.chunk.js → Upload_ConfigureTheView.d306009d.chunk.js} +1 -1
  79. package/build/admin-app.06f07029.chunk.js +112 -0
  80. package/build/admin-edit-roles-page.35199b9d.chunk.js +1 -0
  81. package/build/admin-edit-users.9e48b00d.chunk.js +10 -0
  82. package/build/admin-users.cf7b4151.chunk.js +11 -0
  83. package/build/{api-tokens-create-page.0db3aec1.chunk.js → api-tokens-create-page.a31c7fba.chunk.js} +1 -1
  84. package/build/{api-tokens-edit-page.671e0e26.chunk.js → api-tokens-edit-page.64fef287.chunk.js} +1 -1
  85. package/build/api-tokens-list-page.e600ad3e.chunk.js +16 -0
  86. package/build/ar-json.39e54aba.chunk.js +1 -0
  87. package/build/{audit-logs-settings-page.c3dce30d.chunk.js → audit-logs-settings-page.d4da4579.chunk.js} +1 -1
  88. package/build/{ca-json.f6a0f472.chunk.js → ca-json.4d999055.chunk.js} +1 -1
  89. package/build/content-manager.255c3a59.chunk.js +1139 -0
  90. package/build/{content-type-builder-list-view.79e84b36.chunk.js → content-type-builder-list-view.8d7a3d68.chunk.js} +5 -5
  91. package/build/content-type-builder.3c8558a5.chunk.js +126 -0
  92. package/build/cs-json.4b44411c.chunk.js +1 -0
  93. package/build/{de-json.30e1f35b.chunk.js → de-json.866f8a28.chunk.js} +1 -1
  94. package/build/{dk-json.e6d9ffa4.chunk.js → dk-json.10f7b1d1.chunk.js} +1 -1
  95. package/build/email-settings-page.b19f2eb2.chunk.js +10 -0
  96. package/build/en-json.1997583c.chunk.js +1 -0
  97. package/build/es-json.ea15c957.chunk.js +1 -0
  98. package/build/{eu-json.fceecd8b.chunk.js → eu-json.3bc24d60.chunk.js} +1 -1
  99. package/build/{fr-json.78545ef8.chunk.js → fr-json.e88fbdfd.chunk.js} +1 -1
  100. package/build/{gu-json.676518f2.chunk.js → gu-json.94f0d242.chunk.js} +1 -1
  101. package/build/{he-json.ad22e8cc.chunk.js → he-json.f0de8cdb.chunk.js} +1 -1
  102. package/build/{hi-json.19b51c09.chunk.js → hi-json.df3a7be2.chunk.js} +1 -1
  103. package/build/{hu-json.f947088f.chunk.js → hu-json.680e6eef.chunk.js} +1 -1
  104. package/build/{i18n-settings-page.b8d8753e.chunk.js → i18n-settings-page.a6b49eac.chunk.js} +1 -1
  105. package/build/{id-json.504daa84.chunk.js → id-json.e0d83d41.chunk.js} +1 -1
  106. package/build/index.html +1 -1
  107. package/build/{it-json.2fd90f4d.chunk.js → it-json.8be59205.chunk.js} +1 -1
  108. package/build/{ja-json.c9f12d0b.chunk.js → ja-json.97ee41ba.chunk.js} +1 -1
  109. package/build/{ko-json.ef463065.chunk.js → ko-json.4cbbf4f2.chunk.js} +1 -1
  110. package/build/main.7f308c20.js +4322 -0
  111. package/build/{ml-json.490f666c.chunk.js → ml-json.e3747091.chunk.js} +1 -1
  112. package/build/ms-json.0eddffd9.chunk.js +1 -0
  113. package/build/{nl-json.c416295a.chunk.js → nl-json.371a15ee.chunk.js} +1 -1
  114. package/build/{no-json.1a2258ba.chunk.js → no-json.9b3cd181.chunk.js} +1 -1
  115. package/build/{pl-json.8cf0c871.chunk.js → pl-json.e535cbce.chunk.js} +1 -1
  116. package/build/{pt-BR-json.51fab8d0.chunk.js → pt-BR-json.e5fafa46.chunk.js} +1 -1
  117. package/build/pt-json.ee554a41.chunk.js +1 -0
  118. package/build/review-workflows-settings.7b4be1b0.chunk.js +63 -0
  119. package/build/{ru-json.aa5cd123.chunk.js → ru-json.866f0ff1.chunk.js} +1 -1
  120. package/build/runtime~main.bf374148.js +2 -0
  121. package/build/{sa-json.f3fa5407.chunk.js → sa-json.7efeb257.chunk.js} +1 -1
  122. package/build/{sk-json.9ec60d9f.chunk.js → sk-json.7bbeb0af.chunk.js} +1 -1
  123. package/build/{sso-settings-page.b85ad080.chunk.js → sso-settings-page.ad2143dd.chunk.js} +1 -1
  124. package/build/{sv-json.c6b0c237.chunk.js → sv-json.dc40951f.chunk.js} +1 -1
  125. package/build/{th-json.6e68155c.chunk.js → th-json.f664b96d.chunk.js} +1 -1
  126. package/build/{tr-json.9f41dc08.chunk.js → tr-json.b79eae31.chunk.js} +1 -1
  127. package/build/uk-json.b7e38370.chunk.js +1 -0
  128. package/build/upload-settings.eb1a7908.chunk.js +84 -0
  129. package/build/upload.700e2c84.chunk.js +33 -0
  130. package/build/{users-advanced-settings-page.fce9908e.chunk.js → users-advanced-settings-page.aae212f2.chunk.js} +1 -1
  131. package/build/{users-email-settings-page.343d0ad2.chunk.js → users-email-settings-page.8a9b0da1.chunk.js} +1 -1
  132. package/build/{users-providers-settings-page.e5a9a3f1.chunk.js → users-providers-settings-page.e6be909d.chunk.js} +10 -10
  133. package/build/{users-roles-settings-page.66312f31.chunk.js → users-roles-settings-page.97d06a80.chunk.js} +3 -3
  134. package/build/vi-json.ee4c5537.chunk.js +1 -0
  135. package/build/webhook-edit-page.9eb0f789.chunk.js +75 -0
  136. package/build/webhook-list-page.66082323.chunk.js +42 -0
  137. package/build/{zh-Hans-json.9c0eac99.chunk.js → zh-Hans-json.30a18940.chunk.js} +1 -1
  138. package/build/{zh-json.f88f563d.chunk.js → zh-json.49d84433.chunk.js} +1 -1
  139. package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +12 -12
  140. package/ee/admin/hooks/useSettingsMenu/utils/customGlobalLinks.js +21 -13
  141. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +137 -0
  142. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +42 -0
  143. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/AddStage/AddStage.js +87 -0
  144. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/AddStage/index.js +1 -0
  145. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +90 -0
  146. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/index.js +1 -0
  147. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stages.js +77 -0
  148. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/index.js +1 -0
  149. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +6 -0
  150. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +63 -0
  151. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/index.js +3 -0
  152. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +102 -0
  153. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/getWorkflowValidationSchema.js +25 -0
  154. package/ee/admin/pages/SettingsPage/utils/customRoutes.js +16 -2
  155. package/ee/admin/permissions/customPermissions.js +7 -0
  156. package/ee/server/bootstrap.js +7 -1
  157. package/ee/server/config/admin-actions.js +10 -0
  158. package/ee/server/constants/default-stages.json +14 -0
  159. package/ee/server/constants/default-workflow.json +1 -0
  160. package/ee/server/constants/workflows.js +7 -0
  161. package/ee/server/content-types/index.js +9 -0
  162. package/ee/server/content-types/workflow/index.js +34 -0
  163. package/ee/server/content-types/workflow-stage/index.js +36 -0
  164. package/ee/server/controllers/index.js +2 -0
  165. package/ee/server/controllers/workflows/index.js +36 -0
  166. package/ee/server/controllers/workflows/stages/index.js +57 -0
  167. package/ee/server/index.js +1 -0
  168. package/ee/server/routes/index.js +87 -0
  169. package/ee/server/services/index.js +3 -0
  170. package/ee/server/services/review-workflows/review-workflows.js +54 -0
  171. package/ee/server/services/review-workflows/stages.js +133 -0
  172. package/ee/server/services/review-workflows/workflows.js +25 -0
  173. package/ee/server/utils/index.js +8 -0
  174. package/ee/server/utils/test.js +11 -0
  175. package/ee/server/validation/review-workflows.js +17 -0
  176. package/package.json +13 -13
  177. package/server/bootstrap.js +0 -2
  178. package/server/config/admin-actions.js +0 -64
  179. package/server/content-types/index.js +0 -2
  180. package/server/controllers/admin.js +0 -55
  181. package/server/controllers/api-token.js +5 -4
  182. package/server/controllers/index.js +0 -1
  183. package/server/register.js +9 -2
  184. package/server/routes/admin.js +0 -28
  185. package/server/routes/index.js +0 -2
  186. package/server/services/api-token.js +3 -2
  187. package/server/services/constants.js +0 -6
  188. package/server/services/index.js +0 -1
  189. package/server/strategies/api-token.js +2 -4
  190. package/server/strategies/index.js +0 -1
  191. package/server/utils/index.d.ts +0 -2
  192. package/server/validation/api-tokens.js +6 -1
  193. package/webpack.config.js +0 -3
  194. package/admin/src/pages/SettingsPage/components/Tokens/FormiTokenContainer/LifeSpanInput.js +0 -96
  195. package/admin/src/pages/SettingsPage/components/Tokens/LifeSpanInput/index.js +0 -98
  196. package/admin/src/pages/SettingsPage/components/Tokens/Regenerate/index.js +0 -73
  197. package/admin/src/pages/SettingsPage/components/Tokens/Table/index.js +0 -135
  198. package/admin/src/pages/SettingsPage/components/Tokens/TokenDescription/index.js +0 -51
  199. package/admin/src/pages/SettingsPage/components/Tokens/TokenName/index.js +0 -46
  200. package/admin/src/pages/SettingsPage/components/Tokens/TokenTypeSelect/index.js +0 -69
  201. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/FormTransferTokenContainer/index.js +0 -105
  202. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/LoadingView/index.js +0 -50
  203. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +0 -201
  204. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/getDateOfExpiration.js +0 -16
  205. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/index.js +0 -4
  206. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +0 -10
  207. package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +0 -182
  208. package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/utils/tableHeaders.js +0 -48
  209. package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedCreateView/index.js +0 -14
  210. package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedEditView/index.js +0 -14
  211. package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedListView/index.js +0 -12
  212. package/build/1683.c8aa7b7c.chunk.js +0 -268
  213. package/build/2743.6d1632f9.chunk.js +0 -45
  214. package/build/3075.dc3894fe.chunk.js +0 -108
  215. package/build/3632.0317b618.chunk.js +0 -138
  216. package/build/4649.15cc0afe.chunk.js +0 -30
  217. package/build/7259.aa68d808.chunk.js +0 -1
  218. package/build/7407.883fb1f5.chunk.js +0 -1
  219. package/build/9707.7290fd92.chunk.js +0 -96
  220. package/build/Admin_settingsPage.178dc6e3.chunk.js +0 -178
  221. package/build/admin-app.77a50e1f.chunk.js +0 -112
  222. package/build/admin-edit-roles-page.446b69dc.chunk.js +0 -1
  223. package/build/admin-edit-users.2ed69bfd.chunk.js +0 -10
  224. package/build/admin-users.fc003b10.chunk.js +0 -11
  225. package/build/api-tokens-list-page.7387102c.chunk.js +0 -16
  226. package/build/ar-json.932794f7.chunk.js +0 -1
  227. package/build/content-manager.42b24d46.chunk.js +0 -1139
  228. package/build/content-type-builder.855db321.chunk.js +0 -126
  229. package/build/cs-json.79879fb6.chunk.js +0 -1
  230. package/build/email-settings-page.d1fcc7a3.chunk.js +0 -10
  231. package/build/en-json.b0748970.chunk.js +0 -1
  232. package/build/es-json.e275481d.chunk.js +0 -1
  233. package/build/main.1022ed01.js +0 -4393
  234. package/build/ms-json.db87d8d3.chunk.js +0 -1
  235. package/build/pt-json.62927d1e.chunk.js +0 -1
  236. package/build/runtime~main.84941a97.js +0 -2
  237. package/build/transfer-tokens-create-page.16e23791.chunk.js +0 -1
  238. package/build/transfer-tokens-edit-page.3886c973.chunk.js +0 -1
  239. package/build/transfer-tokens-list-page.e8010a89.chunk.js +0 -16
  240. package/build/uk-json.b2fcd567.chunk.js +0 -1
  241. package/build/upload-settings.ef64bbf9.chunk.js +0 -84
  242. package/build/upload.c5730dfa.chunk.js +0 -33
  243. package/build/vi-json.f08d7d03.chunk.js +0 -1
  244. package/build/webhook-edit-page.73e51e64.chunk.js +0 -75
  245. package/build/webhook-list-page.1134f130.chunk.js +0 -42
  246. package/server/content-types/transfer-token-permission.js +0 -36
  247. package/server/content-types/transfer-token.js +0 -66
  248. package/server/controllers/transfer/index.js +0 -13
  249. package/server/controllers/transfer/runner.js +0 -24
  250. package/server/controllers/transfer/token.js +0 -131
  251. package/server/routes/transfer.js +0 -95
  252. package/server/services/transfer/index.js +0 -6
  253. package/server/services/transfer/permission.js +0 -22
  254. package/server/services/transfer/token.js +0 -409
  255. package/server/strategies/data-transfer.js +0 -107
  256. package/server/validation/transfer/index.js +0 -5
  257. package/server/validation/transfer/token.js +0 -34
@@ -3,11 +3,9 @@
3
3
  const path = require('path');
4
4
 
5
5
  const { map, values, sumBy, pipe, flatMap, propEq } = require('lodash/fp');
6
- const execa = require('execa');
7
6
  const _ = require('lodash');
8
7
  const { exists } = require('fs-extra');
9
8
  const { env } = require('@strapi/utils');
10
- const { ValidationError } = require('@strapi/utils').errors;
11
9
  const { isUsingTypeScript } = require('@strapi/typescript-utils');
12
10
  // eslint-disable-next-line node/no-extraneous-require
13
11
  const ee = require('@strapi/strapi/lib/utils/ee');
@@ -19,15 +17,6 @@ const {
19
17
  } = require('../validation/project-settings');
20
18
  const { getService } = require('../utils');
21
19
 
22
- const PLUGIN_NAME_REGEX = /^[A-Za-z][A-Za-z0-9-_]+$/;
23
-
24
- /**
25
- * Validates a plugin name format
26
- */
27
- const isValidPluginName = (plugin) => {
28
- return _.isString(plugin) && !_.isEmpty(plugin) && PLUGIN_NAME_REGEX.test(plugin);
29
- };
30
-
31
20
  /**
32
21
  * A set of functions called "actions" for `Admin`
33
22
  */
@@ -146,28 +135,6 @@ module.exports = {
146
135
  };
147
136
  },
148
137
 
149
- async installPlugin(ctx) {
150
- try {
151
- const { plugin } = ctx.request.body;
152
-
153
- if (!isValidPluginName(plugin)) {
154
- throw new ValidationError('Invalid plugin name');
155
- }
156
-
157
- strapi.reload.isWatching = false;
158
-
159
- strapi.log.info(`Installing ${plugin}...`);
160
- await execa('npm', ['run', 'strapi', '--', 'install', plugin]);
161
-
162
- ctx.send({ ok: true });
163
-
164
- strapi.reload();
165
- } catch (err) {
166
- strapi.reload.isWatching = true;
167
- throw err;
168
- }
169
- },
170
-
171
138
  async plugins(ctx) {
172
139
  const enabledPlugins = strapi.config.get('enabledPlugins');
173
140
 
@@ -180,26 +147,4 @@ module.exports = {
180
147
 
181
148
  ctx.send({ plugins });
182
149
  },
183
-
184
- async uninstallPlugin(ctx) {
185
- try {
186
- const { plugin } = ctx.params;
187
-
188
- if (!isValidPluginName(plugin)) {
189
- throw new ValidationError('Invalid plugin name');
190
- }
191
-
192
- strapi.reload.isWatching = false;
193
-
194
- strapi.log.info(`Uninstalling ${plugin}...`);
195
- await execa('npm', ['run', 'strapi', '--', 'uninstall', plugin, '-d']);
196
-
197
- ctx.send({ ok: true });
198
-
199
- strapi.reload();
200
- } catch (err) {
201
- strapi.reload.isWatching = true;
202
- throw err;
203
- }
204
- },
205
150
  };
@@ -2,7 +2,8 @@
2
2
 
3
3
  const { stringEquals } = require('@strapi/utils/lib');
4
4
  const { ApplicationError } = require('@strapi/utils').errors;
5
- const { trim, has } = require('lodash/fp');
5
+ const { trim } = require('lodash/fp');
6
+ const has = require('lodash/has');
6
7
  const { getService } = require('../utils');
7
8
  const {
8
9
  validateApiTokenCreationInput,
@@ -92,11 +93,11 @@ module.exports = {
92
93
  * - having a space at the end or start of the value.
93
94
  * - having only spaces as value;
94
95
  */
95
- if (has('name', attributes)) {
96
+ if (has(attributes, 'name')) {
96
97
  attributes.name = trim(body.name);
97
98
  }
98
99
 
99
- if (has('description', attributes) || attributes.description === null) {
100
+ if (has(attributes, 'description') || attributes.description === null) {
100
101
  attributes.description = trim(body.description);
101
102
  }
102
103
 
@@ -107,7 +108,7 @@ module.exports = {
107
108
  return ctx.notFound('API Token not found');
108
109
  }
109
110
 
110
- if (has('name', attributes)) {
111
+ if (has(attributes, 'name')) {
111
112
  const nameAlreadyTaken = await apiTokenService.getByName(attributes.name);
112
113
 
113
114
  /**
@@ -7,7 +7,6 @@ module.exports = {
7
7
  authentication: require('./authentication'),
8
8
  permission: require('./permission'),
9
9
  role: require('./role'),
10
- transfer: require('./transfer'),
11
10
  user: require('./user'),
12
11
  webhooks: require('./webhooks'),
13
12
  'content-api': require('./content-api'),
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const registerAdminPanelRoute = require('./routes/serve-admin-panel');
3
+ // const { register: registerDataTransferRoute } = require('@strapi/data-transfer/lib/strapi');
4
4
 
5
+ const registerAdminPanelRoute = require('./routes/serve-admin-panel');
5
6
  const adminAuthStrategy = require('./strategies/admin');
6
-
7
7
  const apiTokenAuthStrategy = require('./strategies/api-token');
8
8
 
9
9
  module.exports = ({ strapi }) => {
@@ -16,4 +16,11 @@ module.exports = ({ strapi }) => {
16
16
  if (strapi.config.serveAdminPanel) {
17
17
  registerAdminPanelRoute({ strapi });
18
18
  }
19
+
20
+ // if (
21
+ // process.env.STRAPI_EXPERIMENTAL === 'true' &&
22
+ // process.env.STRAPI_DISABLE_REMOTE_DATA_TRANSFER !== 'true'
23
+ // ) {
24
+ // registerDataTransferRoute(strapi);
25
+ // }
19
26
  };
@@ -68,32 +68,4 @@ module.exports = [
68
68
  ],
69
69
  },
70
70
  },
71
- {
72
- method: 'POST',
73
- path: '/plugins/install',
74
- handler: 'admin.installPlugin',
75
- config: {
76
- policies: [
77
- 'admin::isAuthenticatedAdmin',
78
- {
79
- name: 'admin::hasPermissions',
80
- config: { actions: ['admin::marketplace.plugins.install'] },
81
- },
82
- ],
83
- },
84
- },
85
- {
86
- method: 'DELETE',
87
- path: '/plugins/uninstall/:plugin',
88
- handler: 'admin.uninstallPlugin',
89
- config: {
90
- policies: [
91
- 'admin::isAuthenticatedAdmin',
92
- {
93
- name: 'admin::hasPermissions',
94
- config: { actions: ['admin::marketplace.plugins.uninstall'] },
95
- },
96
- ],
97
- },
98
- },
99
71
  ];
@@ -8,7 +8,6 @@ const roles = require('./roles');
8
8
  const webhooks = require('./webhooks');
9
9
  const apiTokens = require('./api-tokens');
10
10
  const contentApi = require('./content-api');
11
- const transfer = require('./transfer');
12
11
 
13
12
  module.exports = [
14
13
  ...admin,
@@ -19,5 +18,4 @@ module.exports = [
19
18
  ...webhooks,
20
19
  ...apiTokens,
21
20
  ...contentApi,
22
- ...transfer,
23
21
  ];
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const crypto = require('crypto');
4
- const { omit, difference, isNil, isEmpty, map, isArray, uniq } = require('lodash/fp');
4
+ const { isNil } = require('lodash/fp');
5
+ const { omit, difference, isEmpty, map, isArray, uniq } = require('lodash/fp');
5
6
  const { ValidationError, NotFoundError } = require('@strapi/utils').errors;
6
7
  const constants = require('./constants');
7
8
 
@@ -77,7 +78,7 @@ const assertCustomTokenPermissionsValidity = (attributes) => {
77
78
  };
78
79
 
79
80
  /**
80
- * Assert that a token's lifespan is valid
81
+ * Assert that a token's permissions attribute is valid for its type
81
82
  *
82
83
  * @param {ApiToken} token
83
84
  */
@@ -24,10 +24,4 @@ module.exports = {
24
24
  DAYS_30: 30 * DAY_IN_MS,
25
25
  DAYS_90: 90 * DAY_IN_MS,
26
26
  },
27
- TRANSFER_TOKEN_LIFESPANS: {
28
- UNLIMITED: null,
29
- DAYS_7: 7 * DAY_IN_MS,
30
- DAYS_30: 30 * DAY_IN_MS,
31
- DAYS_90: 90 * DAY_IN_MS,
32
- },
33
27
  };
@@ -13,6 +13,5 @@ module.exports = {
13
13
  auth: require('./auth'),
14
14
  action: require('./action'),
15
15
  'api-token': require('./api-token'),
16
- transfer: require('./transfer'),
17
16
  'project-settings': require('./project-settings'),
18
17
  };
@@ -24,8 +24,7 @@ const extractToken = (ctx) => {
24
24
  /**
25
25
  * Authenticate the validity of the token
26
26
  *
27
- * @type {import('.').AuthenticateFunction}
28
- */
27
+ * @type {import('.').AuthenticateFunction} */
29
28
  const authenticate = async (ctx) => {
30
29
  const apiTokenService = getService('api-token');
31
30
  const token = extractToken(ctx);
@@ -73,8 +72,7 @@ const authenticate = async (ctx) => {
73
72
  /**
74
73
  * Verify the token has the required abilities for the requested scope
75
74
  *
76
- * @type {import('.').VerifyFunction}
77
- */
75
+ * @type {import('.').VerifyFunction} */
78
76
  const verify = (auth, config) => {
79
77
  const { credentials: apiToken, ability } = auth;
80
78
 
@@ -21,6 +21,5 @@
21
21
  */
22
22
  module.exports = {
23
23
  admin: require('./admin'),
24
- 'data-transfer': require('./data-transfer'),
25
24
  'api-token': require('./api-token'),
26
25
  };
@@ -7,7 +7,6 @@ import * as token from '../services/token';
7
7
  import * as auth from '../services/auth';
8
8
  import * as apiToken from '../services/api-token';
9
9
  import * as projectSettings from '../services/project-settings';
10
- import * as transfer from '../services/transfer';
11
10
 
12
11
  type S = {
13
12
  role: typeof role;
@@ -19,7 +18,6 @@ type S = {
19
18
  metrics: typeof metrics;
20
19
  'api-token': typeof apiToken;
21
20
  'project-settings': typeof projectSettings;
22
- transfer: typeof transfer;
23
21
  };
24
22
 
25
23
  export function getService<T extends keyof S>(name: T): S[T];
@@ -10,7 +10,12 @@ const apiTokenCreationSchema = yup
10
10
  description: yup.string().optional(),
11
11
  type: yup.string().oneOf(Object.values(constants.API_TOKEN_TYPE)).required(),
12
12
  permissions: yup.array().of(yup.string()).nullable(),
13
- lifespan: yup.number().min(1).oneOf(Object.values(constants.API_TOKEN_LIFESPANS)).nullable(),
13
+ lifespan: yup
14
+ .number()
15
+ .integer()
16
+ .min(1)
17
+ .oneOf(Object.values(constants.API_TOKEN_LIFESPANS))
18
+ .nullable(),
14
19
  })
15
20
  .noUnknown()
16
21
  .strict();
package/webpack.config.js CHANGED
@@ -8,7 +8,6 @@ const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin');
8
8
  const HtmlWebpackPlugin = require('html-webpack-plugin');
9
9
  const { ESBuildMinifyPlugin } = require('esbuild-loader');
10
10
  const WebpackBar = require('webpackbar');
11
- const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
12
11
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
13
12
  const browserslistToEsbuild = require('browserslist-to-esbuild');
14
13
 
@@ -232,8 +231,6 @@ module.exports = ({
232
231
  }),
233
232
  new webpack.DefinePlugin(envVariables),
234
233
 
235
- new NodePolyfillPlugin(),
236
-
237
234
  new ForkTsCheckerPlugin({
238
235
  typescript: {
239
236
  configFile: tsConfigFilePath,
@@ -1,96 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { useIntl } from 'react-intl';
4
- import { usePersistentState } from '@strapi/helper-plugin';
5
- import { Select, Option } from '@strapi/design-system/Select';
6
- import { Typography } from '@strapi/design-system/Typography';
7
- import { getDateOfExpiration } from '../../../pages/ApiTokens/EditView/utils';
8
-
9
- const LifeSpanInput = ({ token, errors, values, onChange, disabled }) => {
10
- const { formatMessage } = useIntl();
11
- const [lang] = usePersistentState('strapi-admin-language', 'en');
12
-
13
- return (
14
- <>
15
- <Select
16
- name="lifespan"
17
- label={formatMessage({
18
- id: 'Settings.apiTokens.form.duration',
19
- defaultMessage: 'Token duration',
20
- })}
21
- value={values.lifespan !== null ? values.lifespan : '0'}
22
- error={
23
- errors.lifespan
24
- ? formatMessage(
25
- errors.lifespan?.id
26
- ? errors.lifespan
27
- : { id: errors.lifespan, defaultMessage: errors.lifespan }
28
- )
29
- : null
30
- }
31
- onChange={(value) => {
32
- onChange({ target: { name: 'lifespan', value } });
33
- }}
34
- required
35
- disabled={disabled}
36
- placeholder="Select"
37
- >
38
- <Option value="604800000">
39
- {formatMessage({
40
- id: 'Settings.apiTokens.duration.7-days',
41
- defaultMessage: '7 days',
42
- })}
43
- </Option>
44
- <Option value="2592000000">
45
- {formatMessage({
46
- id: 'Settings.apiTokens.duration.30-days',
47
- defaultMessage: '30 days',
48
- })}
49
- </Option>
50
- <Option value="7776000000">
51
- {formatMessage({
52
- id: 'Settings.apiTokens.duration.90-days',
53
- defaultMessage: '90 days',
54
- })}
55
- </Option>
56
- <Option value="0">
57
- {formatMessage({
58
- id: 'Settings.apiTokens.duration.unlimited',
59
- defaultMessage: 'Unlimited',
60
- })}
61
- </Option>
62
- </Select>
63
- <Typography variant="pi" textColor="neutral600">
64
- {disabled &&
65
- `${formatMessage({
66
- id: 'Settings.apiTokens.duration.expiration-date',
67
- defaultMessage: 'Expiration date',
68
- })}: ${getDateOfExpiration(token?.createdAt, parseInt(values.lifespan, 10, lang))}`}
69
- </Typography>
70
- </>
71
- );
72
- };
73
-
74
- LifeSpanInput.propTypes = {
75
- errors: PropTypes.string,
76
- onChange: PropTypes.func.isRequired,
77
- values: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
78
- disabled: PropTypes.bool.isRequired,
79
- token: PropTypes.shape({
80
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
81
- type: PropTypes.string,
82
- lifespan: PropTypes.string,
83
- name: PropTypes.string,
84
- accessKey: PropTypes.string,
85
- permissions: PropTypes.array,
86
- description: PropTypes.string,
87
- createdAt: PropTypes.string,
88
- }),
89
- };
90
-
91
- LifeSpanInput.defaultProps = {
92
- errors: {},
93
- token: {},
94
- };
95
-
96
- export default LifeSpanInput;
@@ -1,98 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { useIntl } from 'react-intl';
4
- import { Select, Option } from '@strapi/design-system/Select';
5
- import { Typography } from '@strapi/design-system/Typography';
6
- import { getDateOfExpiration } from '../../../pages/ApiTokens/EditView/utils';
7
-
8
- const LifeSpanInput = ({ token, errors, values, onChange, isCreating }) => {
9
- const { formatMessage } = useIntl();
10
-
11
- return (
12
- <>
13
- <Select
14
- name="lifespan"
15
- label={formatMessage({
16
- id: 'Settings.apiTokens.form.duration',
17
- defaultMessage: 'Token duration',
18
- })}
19
- value={values.lifespan !== null ? values.lifespan : '0'}
20
- error={
21
- errors.lifespan
22
- ? formatMessage(
23
- errors.lifespan?.id
24
- ? errors.lifespan
25
- : { id: errors.lifespan, defaultMessage: errors.lifespan }
26
- )
27
- : null
28
- }
29
- onChange={(value) => {
30
- onChange({ target: { name: 'lifespan', value } });
31
- }}
32
- required
33
- disabled={!isCreating}
34
- placeholder="Select"
35
- >
36
- <Option value="604800000">
37
- {formatMessage({
38
- id: 'Settings.tokens.duration.7-days',
39
- defaultMessage: '7 days',
40
- })}
41
- </Option>
42
- <Option value="2592000000">
43
- {formatMessage({
44
- id: 'Settings.tokens.duration.30-days',
45
- defaultMessage: '30 days',
46
- })}
47
- </Option>
48
- <Option value="7776000000">
49
- {formatMessage({
50
- id: 'Settings.tokens.duration.90-days',
51
- defaultMessage: '90 days',
52
- })}
53
- </Option>
54
- <Option value="0">
55
- {formatMessage({
56
- id: 'Settings.tokens.duration.unlimited',
57
- defaultMessage: 'Unlimited',
58
- })}
59
- </Option>
60
- </Select>
61
- <Typography variant="pi" textColor="neutral600">
62
- {!isCreating &&
63
- `${formatMessage({
64
- id: 'Settings.tokens.duration.expiration-date',
65
- defaultMessage: 'Expiration date',
66
- })}: ${getDateOfExpiration(token?.createdAt, parseInt(values.lifespan, 10))}`}
67
- </Typography>
68
- </>
69
- );
70
- };
71
-
72
- LifeSpanInput.propTypes = {
73
- errors: PropTypes.shape({
74
- lifespan: PropTypes.string,
75
- }),
76
- onChange: PropTypes.func.isRequired,
77
- values: PropTypes.shape({
78
- lifespan: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
79
- }).isRequired,
80
- isCreating: PropTypes.bool.isRequired,
81
- token: PropTypes.shape({
82
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
83
- type: PropTypes.string,
84
- lifespan: PropTypes.string,
85
- name: PropTypes.string,
86
- accessKey: PropTypes.string,
87
- permissions: PropTypes.array,
88
- description: PropTypes.string,
89
- createdAt: PropTypes.string,
90
- }),
91
- };
92
-
93
- LifeSpanInput.defaultProps = {
94
- errors: {},
95
- token: {},
96
- };
97
-
98
- export default LifeSpanInput;
@@ -1,73 +0,0 @@
1
- import React, { useState } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { useIntl } from 'react-intl';
4
- import { Button } from '@strapi/design-system/Button';
5
- import Refresh from '@strapi/icons/Refresh';
6
- import { ConfirmDialog } from '@strapi/helper-plugin';
7
- import { useRegenerate } from '../../../../../hooks';
8
-
9
- export const Regenerate = ({ onRegenerate, idToRegenerate, backUrl }) => {
10
- const { formatMessage } = useIntl();
11
- const [showConfirmDialog, setShowConfirmDialog] = useState(false);
12
- const { regenerateData, isLoadingConfirmation } = useRegenerate(
13
- backUrl,
14
- idToRegenerate,
15
- onRegenerate
16
- );
17
- const handleConfirmRegeneration = async () => {
18
- regenerateData();
19
- setShowConfirmDialog(false);
20
- };
21
-
22
- return (
23
- <>
24
- <Button
25
- startIcon={<Refresh />}
26
- type="button"
27
- size="S"
28
- variant="tertiary"
29
- onClick={() => setShowConfirmDialog(true)}
30
- name="regenerate"
31
- >
32
- {formatMessage({
33
- id: 'Settings.apiTokens.regenerate',
34
- defaultMessage: 'Regenerate',
35
- })}
36
- </Button>
37
-
38
- <ConfirmDialog
39
- bodyText={{
40
- id: 'Settings.apiTokens.popUpWarning.message',
41
- defaultMessage: 'Are you sure you want to regenerate this token?',
42
- }}
43
- iconRightButton={<Refresh />}
44
- isConfirmButtonLoading={isLoadingConfirmation}
45
- isOpen={showConfirmDialog}
46
- onToggleDialog={() => setShowConfirmDialog(false)}
47
- onConfirm={handleConfirmRegeneration}
48
- leftButtonText={{
49
- id: 'Settings.apiTokens.Button.cancel',
50
- defaultMessage: 'Cancel',
51
- }}
52
- rightButtonText={{
53
- id: 'Settings.apiTokens.Button.regenerate',
54
- defaultMessage: 'Regenerate',
55
- }}
56
- title={{
57
- id: 'Settings.apiTokens.RegenerateDialog.title',
58
- defaultMessage: 'Regenerate token',
59
- }}
60
- />
61
- </>
62
- );
63
- };
64
-
65
- Regenerate.defaultProps = { onRegenerate() {} };
66
-
67
- Regenerate.propTypes = {
68
- onRegenerate: PropTypes.func,
69
- idToRegenerate: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
70
- backUrl: PropTypes.string.isRequired,
71
- };
72
-
73
- export default Regenerate;