@strapi/admin 4.6.0 → 4.7.0-beta.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 (211) hide show
  1. package/.browserslistrc +2 -1
  2. package/admin/src/assets/images/onboarding-preview.png +0 -0
  3. package/admin/src/components/AuthenticatedApp/utils/api.js +5 -4
  4. package/admin/src/components/LeftMenu/index.js +9 -3
  5. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +18 -16
  6. package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +5 -5
  7. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findLeafByPathAndReplace.js +1 -3
  8. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +6 -5
  9. package/admin/src/content-manager/components/InputUID/index.js +4 -4
  10. package/admin/src/content-manager/components/Inputs/index.js +0 -2
  11. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +35 -14
  12. package/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +4 -3
  13. package/admin/src/content-manager/hooks/useLazyComponents/index.js +9 -13
  14. package/admin/src/content-manager/hooks/useRelation/useRelation.js +4 -4
  15. package/admin/src/content-manager/pages/App/useModels.js +8 -3
  16. package/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +3 -2
  17. package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +4 -4
  18. package/admin/src/content-manager/pages/EditSettingsView/utils/api.js +4 -2
  19. package/admin/src/content-manager/pages/ListSettingsView/utils/api.js +4 -2
  20. package/admin/src/content-manager/pages/ListView/index.js +9 -9
  21. package/admin/src/core/utils/index.js +0 -1
  22. package/admin/src/hooks/useFetchEnabledPlugins/utils/api.js +3 -2
  23. package/admin/src/hooks/useInjectReducer/index.js +1 -0
  24. package/admin/src/hooks/useInjectReducer/useInjectReducer.js +19 -0
  25. package/admin/src/hooks/useRegenerate/index.js +4 -4
  26. package/admin/src/hooks/useRolesList/index.js +5 -3
  27. package/admin/src/hooks/useSettingsMenu/utils/defaultGlobalLinks.js +7 -0
  28. package/admin/src/index.js +4 -3
  29. package/admin/src/pages/Admin/Onboarding/constants.js +46 -0
  30. package/admin/src/pages/Admin/Onboarding/index.js +161 -89
  31. package/admin/src/pages/Admin/index.js +5 -2
  32. package/admin/src/pages/ProfilePage/utils/api.js +5 -3
  33. package/admin/src/pages/SettingsPage/{pages/Users/ListPage → components}/Filters/index.js +0 -0
  34. package/admin/src/pages/SettingsPage/{pages/ApiTokens/EditView/components → components/Tokens}/FormHead/index.js +36 -19
  35. package/admin/src/pages/SettingsPage/components/Tokens/FormiTokenContainer/LifeSpanInput.js +96 -0
  36. package/admin/src/pages/SettingsPage/components/Tokens/LifeSpanInput/index.js +98 -0
  37. package/admin/src/pages/SettingsPage/components/Tokens/Regenerate/index.js +73 -0
  38. package/admin/src/pages/SettingsPage/{pages/ApiTokens/ListView/DynamicTable → components/Tokens/Table}/DefaultButton/index.js +1 -1
  39. package/admin/src/pages/SettingsPage/{pages/ApiTokens/ListView/DynamicTable → components/Tokens/Table}/DeleteButton/index.js +1 -1
  40. package/admin/src/pages/SettingsPage/{pages/ApiTokens/ListView/DynamicTable → components/Tokens/Table}/ReadButton/index.js +0 -0
  41. package/admin/src/pages/SettingsPage/{pages/ApiTokens/ListView/DynamicTable → components/Tokens/Table}/UpdateButton/index.js +0 -0
  42. package/admin/src/pages/SettingsPage/components/Tokens/Table/index.js +135 -0
  43. package/admin/src/pages/SettingsPage/{pages/ApiTokens/EditView/components/ContentBox → components/Tokens/TokenBox}/index.js +17 -17
  44. package/admin/src/pages/SettingsPage/components/Tokens/TokenDescription/index.js +51 -0
  45. package/admin/src/pages/SettingsPage/components/Tokens/TokenName/index.js +46 -0
  46. package/admin/src/pages/SettingsPage/components/Tokens/TokenTypeSelect/index.js +69 -0
  47. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/CollapsableContentType/index.js +5 -3
  48. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormApiTokenContainer/index.js +52 -142
  49. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Regenerate/index.js +5 -1
  50. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +43 -19
  51. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +9 -16
  52. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +5 -3
  53. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/FormTransferTokenContainer/index.js +105 -0
  54. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/LoadingView/index.js +50 -0
  55. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +201 -0
  56. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/getDateOfExpiration.js +16 -0
  57. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/index.js +4 -0
  58. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +10 -0
  59. package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +182 -0
  60. package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/utils/tableHeaders.js +48 -0
  61. package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedCreateView/index.js +14 -0
  62. package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedEditView/index.js +14 -0
  63. package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedListView/index.js +12 -0
  64. package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +6 -3
  65. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +9 -3
  66. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
  67. package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +6 -3
  68. package/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +3 -2
  69. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +3 -2
  70. package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +33 -0
  71. package/admin/src/permissions/defaultPermissions.js +8 -0
  72. package/admin/src/translations/en.json +25 -6
  73. package/admin/src/translations/eu.json +796 -0
  74. package/admin/src/translations/languageNativeNames.js +1 -0
  75. package/admin/src/translations/ru.json +9 -9
  76. package/build/1412.936ed920.chunk.js +159 -0
  77. package/build/1683.c8aa7b7c.chunk.js +268 -0
  78. package/build/19eb2dfcf2603eb55733.png +0 -0
  79. package/build/2607.2e48dbf8.chunk.js +66 -0
  80. package/build/2743.6d1632f9.chunk.js +45 -0
  81. package/build/3075.dc3894fe.chunk.js +108 -0
  82. package/build/3632.0317b618.chunk.js +138 -0
  83. package/build/4649.15cc0afe.chunk.js +30 -0
  84. package/build/{5910.a5374848.chunk.js → 4855.bd092921.chunk.js} +65 -65
  85. package/build/7259.aa68d808.chunk.js +1 -0
  86. package/build/7407.883fb1f5.chunk.js +1 -0
  87. package/build/9707.7290fd92.chunk.js +96 -0
  88. package/build/Admin-authenticatedApp.f29f6021.chunk.js +79 -0
  89. package/build/{Admin_homePage.79ab880c.chunk.js → Admin_homePage.b1730882.chunk.js} +1 -1
  90. package/build/{Admin_marketplace.eabf21b2.chunk.js → Admin_marketplace.ea0316c2.chunk.js} +2 -2
  91. package/build/Admin_pluginsPage.5c24f963.chunk.js +6 -0
  92. package/build/Admin_profilePage.59af1978.chunk.js +15 -0
  93. package/build/Admin_settingsPage.178dc6e3.chunk.js +178 -0
  94. package/build/admin-app.77a50e1f.chunk.js +112 -0
  95. package/build/admin-edit-roles-page.446b69dc.chunk.js +1 -0
  96. package/build/admin-edit-users.2ed69bfd.chunk.js +10 -0
  97. package/build/admin-users.fc003b10.chunk.js +11 -0
  98. package/build/{api-tokens-create-page.0e686c30.chunk.js → api-tokens-create-page.0db3aec1.chunk.js} +1 -1
  99. package/build/{api-tokens-edit-page.d6c7487b.chunk.js → api-tokens-edit-page.671e0e26.chunk.js} +1 -1
  100. package/build/api-tokens-list-page.7387102c.chunk.js +16 -0
  101. package/build/audit-logs-settings-page.c3dce30d.chunk.js +1 -0
  102. package/build/content-manager.42b24d46.chunk.js +1139 -0
  103. package/build/{content-type-builder-list-view.4243b2b1.chunk.js → content-type-builder-list-view.79e84b36.chunk.js} +1 -6
  104. package/build/{content-type-builder.365b6bf4.chunk.js → content-type-builder.855db321.chunk.js} +16 -15
  105. package/build/{email-settings-page.379552b1.chunk.js → email-settings-page.d1fcc7a3.chunk.js} +4 -9
  106. package/build/en-json.b0748970.chunk.js +1 -0
  107. package/build/eu-json.fceecd8b.chunk.js +1 -0
  108. package/build/i18n-settings-page.b8d8753e.chunk.js +60 -0
  109. package/build/index.html +1 -1
  110. package/build/main.1022ed01.js +4393 -0
  111. package/build/ru-json.aa5cd123.chunk.js +1 -0
  112. package/build/runtime~main.84941a97.js +2 -0
  113. package/build/sso-settings-page.b85ad080.chunk.js +41 -0
  114. package/build/transfer-tokens-create-page.16e23791.chunk.js +1 -0
  115. package/build/transfer-tokens-edit-page.3886c973.chunk.js +1 -0
  116. package/build/transfer-tokens-list-page.e8010a89.chunk.js +16 -0
  117. package/build/upload-settings.ef64bbf9.chunk.js +84 -0
  118. package/build/upload.c5730dfa.chunk.js +33 -0
  119. package/build/users-advanced-settings-page.fce9908e.chunk.js +8 -0
  120. package/build/users-email-settings-page.343d0ad2.chunk.js +23 -0
  121. package/build/users-providers-settings-page.e5a9a3f1.chunk.js +99 -0
  122. package/build/users-roles-settings-page.66312f31.chunk.js +30 -0
  123. package/build/webhook-edit-page.73e51e64.chunk.js +75 -0
  124. package/build/{webhook-list-page.f75ba3f2.chunk.js → webhook-list-page.1134f130.chunk.js} +1 -1
  125. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/ComboboxFilter/index.js +41 -0
  126. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionBody.js +1 -3
  127. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/TableRows/index.js +1 -1
  128. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +47 -0
  129. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/index.js +30 -31
  130. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getActionTypesDefaultMessages.js +7 -9
  131. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +88 -0
  132. package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +4 -2
  133. package/ee/server/migrations/audit-logs-table.js +45 -0
  134. package/ee/server/register.js +2 -0
  135. package/ee/server/services/audit-logs.js +11 -1
  136. package/package.json +30 -30
  137. package/server/bootstrap.js +2 -0
  138. package/server/config/admin-actions.js +48 -0
  139. package/server/content-types/index.js +2 -0
  140. package/server/content-types/transfer-token-permission.js +36 -0
  141. package/server/content-types/transfer-token.js +66 -0
  142. package/server/controllers/admin.js +16 -0
  143. package/server/controllers/api-token.js +4 -5
  144. package/server/controllers/index.js +1 -0
  145. package/server/controllers/transfer/index.js +13 -0
  146. package/server/controllers/transfer/runner.js +24 -0
  147. package/server/controllers/transfer/token.js +131 -0
  148. package/server/register.js +2 -9
  149. package/server/routes/index.js +2 -0
  150. package/server/routes/transfer.js +95 -0
  151. package/server/services/api-token.js +2 -3
  152. package/server/services/constants.js +6 -0
  153. package/server/services/index.js +1 -0
  154. package/server/services/transfer/index.js +6 -0
  155. package/server/services/transfer/permission.js +22 -0
  156. package/server/services/transfer/token.js +409 -0
  157. package/server/strategies/api-token.js +4 -2
  158. package/server/strategies/data-transfer.js +107 -0
  159. package/server/strategies/index.js +1 -0
  160. package/server/utils/index.d.ts +2 -0
  161. package/server/validation/api-tokens.js +1 -6
  162. package/server/validation/transfer/index.js +5 -0
  163. package/server/validation/transfer/token.js +34 -0
  164. package/admin/src/content-manager/components/InputJSON/FieldWrapper.js +0 -40
  165. package/admin/src/content-manager/components/InputJSON/Label.js +0 -35
  166. package/admin/src/content-manager/components/InputJSON/components.js +0 -36
  167. package/admin/src/content-manager/components/InputJSON/index.js +0 -223
  168. package/admin/src/content-manager/components/InputJSON/jsonlint.js +0 -680
  169. package/admin/src/core/utils/axiosInstance.js +0 -40
  170. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormBody/index.js +0 -78
  171. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/index.js +0 -112
  172. package/build/2607.ce06608e.chunk.js +0 -66
  173. package/build/2743.dea372fb.chunk.js +0 -42
  174. package/build/3075.03ebe93d.chunk.js +0 -115
  175. package/build/3632.963ac97d.chunk.js +0 -138
  176. package/build/4318.8cb388a5.chunk.js +0 -30
  177. package/build/4656.a0d43cca.chunk.js +0 -159
  178. package/build/8633.4af74a50.chunk.js +0 -1
  179. package/build/9641.a311b612.chunk.js +0 -276
  180. package/build/9707.62831b4d.chunk.js +0 -101
  181. package/build/Admin-authenticatedApp.50dc27f9.chunk.js +0 -75
  182. package/build/Admin_pluginsPage.953e796b.chunk.js +0 -6
  183. package/build/Admin_profilePage.5c2efda5.chunk.js +0 -15
  184. package/build/Admin_settingsPage.19cfb9ca.chunk.js +0 -178
  185. package/build/admin-app.34295b50.chunk.js +0 -112
  186. package/build/admin-edit-roles-page.d50d9654.chunk.js +0 -1
  187. package/build/admin-edit-users.912b856d.chunk.js +0 -10
  188. package/build/admin-users.e36e7111.chunk.js +0 -11
  189. package/build/api-tokens-list-page.1cd86136.chunk.js +0 -16
  190. package/build/audit-logs-settings-page.308a6250.chunk.js +0 -1
  191. package/build/codemirror-addon-closebrackets.71aa4bbd.chunk.js +0 -2
  192. package/build/codemirror-addon-lint-js.405f70fb.chunk.js +0 -1
  193. package/build/codemirror-addon-lint.8487ad3d.chunk.js +0 -1
  194. package/build/codemirror-addon-mark-selection.1928c849.chunk.js +0 -1
  195. package/build/codemirror-css.359a2a4b.chunk.js +0 -345
  196. package/build/codemirror-javacript.af237b68.chunk.js +0 -1
  197. package/build/codemirror-theme.2fe63a16.chunk.js +0 -33
  198. package/build/content-manager.851f40ce.chunk.js +0 -1170
  199. package/build/en-json.38d182e5.chunk.js +0 -1
  200. package/build/i18n-settings-page.3ab28b1a.chunk.js +0 -65
  201. package/build/main.9f31732e.js +0 -4454
  202. package/build/ru-json.3b411a39.chunk.js +0 -1
  203. package/build/runtime~main.2b8e2318.js +0 -2
  204. package/build/sso-settings-page.b64a44e8.chunk.js +0 -41
  205. package/build/upload-settings.6c26ff37.chunk.js +0 -89
  206. package/build/upload.2c69d238.chunk.js +0 -38
  207. package/build/users-advanced-settings-page.c4270682.chunk.js +0 -13
  208. package/build/users-email-settings-page.60422a2f.chunk.js +0 -28
  209. package/build/users-providers-settings-page.e1834060.chunk.js +0 -104
  210. package/build/users-roles-settings-page.3ef35132.chunk.js +0 -30
  211. package/build/webhook-edit-page.c0080dc1.chunk.js +0 -75
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/admin",
3
- "version": "4.6.0",
3
+ "version": "4.7.0-beta.0",
4
4
  "description": "Strapi Admin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,25 +38,25 @@
38
38
  "test:front:ce:cov": "cross-env IS_EE=false jest --config ./jest.config.front.js --coverage"
39
39
  },
40
40
  "dependencies": {
41
- "@babel/core": "7.18.10",
42
- "@babel/plugin-transform-runtime": "7.18.10",
43
- "@babel/preset-env": "7.18.10",
44
- "@babel/preset-react": "7.18.6",
45
- "@babel/runtime": "7.18.9",
41
+ "@babel/core": "^7.20.12",
42
+ "@babel/plugin-transform-runtime": "^7.19.6",
43
+ "@babel/preset-env": "^7.20.2",
44
+ "@babel/preset-react": "^7.18.6",
45
+ "@babel/runtime": "^7.20.13",
46
46
  "@casl/ability": "^5.4.3",
47
47
  "@fingerprintjs/fingerprintjs": "3.3.6",
48
48
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
49
- "@strapi/babel-plugin-switch-ee-ce": "4.6.0",
50
- "@strapi/data-transfer": "4.6.0",
51
- "@strapi/design-system": "1.6.1",
52
- "@strapi/helper-plugin": "4.6.0",
53
- "@strapi/icons": "1.6.1",
54
- "@strapi/permissions": "4.6.0",
55
- "@strapi/provider-audit-logs-local": "4.6.0",
56
- "@strapi/typescript-utils": "4.6.0",
57
- "@strapi/utils": "4.6.0",
49
+ "@strapi/babel-plugin-switch-ee-ce": "4.7.0-beta.0",
50
+ "@strapi/data-transfer": "4.7.0-beta.0",
51
+ "@strapi/design-system": "1.6.3",
52
+ "@strapi/helper-plugin": "4.7.0-beta.0",
53
+ "@strapi/icons": "1.6.3",
54
+ "@strapi/permissions": "4.7.0-beta.0",
55
+ "@strapi/provider-audit-logs-local": "4.7.0-beta.0",
56
+ "@strapi/typescript-utils": "4.7.0-beta.0",
57
+ "@strapi/utils": "4.7.0-beta.0",
58
58
  "axios": "1.2.2",
59
- "babel-loader": "8.2.5",
59
+ "babel-loader": "^9.1.2",
60
60
  "babel-plugin-styled-components": "2.0.2",
61
61
  "bcryptjs": "2.4.3",
62
62
  "browserslist-to-esbuild": "1.2.0",
@@ -64,10 +64,10 @@
64
64
  "chokidar": "^3.5.1",
65
65
  "codemirror": "^5.65.11",
66
66
  "cross-env": "^7.0.3",
67
- "css-loader": "6.7.2",
67
+ "css-loader": "^6.7.3",
68
68
  "date-fns": "2.29.3",
69
69
  "dotenv": "8.5.1",
70
- "esbuild-loader": "^2.20.0",
70
+ "esbuild-loader": "^2.21.0",
71
71
  "execa": "^1.0.0",
72
72
  "fast-deep-equal": "3.1.3",
73
73
  "find-root": "1.1.0",
@@ -77,9 +77,9 @@
77
77
  "highlight.js": "^10.4.1",
78
78
  "history": "^4.9.0",
79
79
  "hoist-non-react-statics": "^3.3.0",
80
- "html-loader": "3.1.2",
80
+ "html-loader": "^4.2.0",
81
81
  "html-webpack-plugin": "5.5.0",
82
- "immer": "9.0.15",
82
+ "immer": "9.0.19",
83
83
  "invariant": "^2.2.4",
84
84
  "js-cookie": "2.2.1",
85
85
  "jsonwebtoken": "9.0.0",
@@ -99,8 +99,7 @@
99
99
  "markdown-it-sub": "^1.0.0",
100
100
  "markdown-it-sup": "1.0.0",
101
101
  "match-sorter": "^4.0.2",
102
- "mini-css-extract-plugin": "2.4.4",
103
- "msw": "0.49.1",
102
+ "mini-css-extract-plugin": "2.7.2",
104
103
  "node-polyfill-webpack-plugin": "2.0.1",
105
104
  "node-schedule": "2.1.0",
106
105
  "p-map": "4.0.0",
@@ -115,15 +114,15 @@
115
114
  "react-error-boundary": "3.1.4",
116
115
  "react-fast-compare": "^3.2.0",
117
116
  "react-helmet": "^6.1.0",
118
- "react-intl": "5.25.1",
117
+ "react-intl": "6.2.7",
119
118
  "react-is": "^17.0.2",
120
119
  "react-query": "3.24.3",
121
- "react-redux": "7.2.8",
120
+ "react-redux": "8.0.5",
122
121
  "react-refresh": "0.14.0",
123
122
  "react-router": "5.2.0",
124
123
  "react-router-dom": "5.3.4",
125
124
  "react-window": "1.8.7",
126
- "redux": "^4.0.1",
125
+ "redux": "^4.2.1",
127
126
  "reselect": "^4.0.0",
128
127
  "rimraf": "3.0.2",
129
128
  "sanitize-html": "2.7.3",
@@ -132,9 +131,9 @@
132
131
  "style-loader": "3.3.1",
133
132
  "styled-components": "5.3.3",
134
133
  "typescript": "4.6.2",
135
- "webpack": "^5.74.0",
136
- "webpack-cli": "^4.10.0",
137
- "webpack-dev-server": "^4.9.3",
134
+ "webpack": "^5.75.0",
135
+ "webpack-cli": "^5.0.1",
136
+ "webpack-dev-server": "^4.11.1",
138
137
  "webpackbar": "^5.0.2",
139
138
  "yup": "^0.32.9"
140
139
  },
@@ -145,9 +144,10 @@
145
144
  "@testing-library/user-event": "14.4.3",
146
145
  "duplicate-dependencies-webpack-plugin": "^1.0.2",
147
146
  "glob": "8.0.3",
147
+ "msw": "1.0.0",
148
148
  "react-test-renderer": "^17.0.2",
149
149
  "speed-measure-webpack-plugin": "1.5.0",
150
- "webpack-bundle-analyzer": "^4.6.1"
150
+ "webpack-bundle-analyzer": "^4.7.0"
151
151
  },
152
152
  "peerDependencies": {
153
153
  "@strapi/strapi": "^4.3.4"
@@ -165,5 +165,5 @@
165
165
  }
166
166
  }
167
167
  },
168
- "gitHead": "a9e55435c489f3379d88565bf3f729deb29bfb45"
168
+ "gitHead": "880ba7af867ad43c4cc45b47467b76a9b5606b6e"
169
169
  }
@@ -78,6 +78,7 @@ module.exports = async () => {
78
78
  const userService = getService('user');
79
79
  const roleService = getService('role');
80
80
  const apiTokenService = getService('api-token');
81
+ const transferService = getService('transfer');
81
82
  const tokenService = getService('token');
82
83
 
83
84
  await roleService.createRolesIfNoneExist();
@@ -93,5 +94,6 @@ module.exports = async () => {
93
94
  await syncAPITokensPermissions();
94
95
 
95
96
  apiTokenService.checkSaltIsDefined();
97
+ transferService.token.checkSaltIsDefined();
96
98
  tokenService.checkSecretIsDefined();
97
99
  };
@@ -180,5 +180,53 @@ module.exports = {
180
180
  section: 'settings',
181
181
  category: 'project',
182
182
  },
183
+ {
184
+ uid: 'transfer.tokens.access',
185
+ displayName: 'Access the transfer tokens settings page',
186
+ pluginName: 'admin',
187
+ section: 'settings',
188
+ category: 'transfer tokens',
189
+ subCategory: 'transfer tokens',
190
+ },
191
+ {
192
+ uid: 'transfer.tokens.create',
193
+ displayName: 'Create (generate)',
194
+ pluginName: 'admin',
195
+ section: 'settings',
196
+ category: 'transfer tokens',
197
+ subCategory: 'general',
198
+ },
199
+ {
200
+ uid: 'transfer.tokens.read',
201
+ displayName: 'Read',
202
+ pluginName: 'admin',
203
+ section: 'settings',
204
+ category: 'transfer tokens',
205
+ subCategory: 'general',
206
+ },
207
+ {
208
+ uid: 'transfer.tokens.update',
209
+ displayName: 'Update',
210
+ pluginName: 'admin',
211
+ section: 'settings',
212
+ category: 'transfer tokens',
213
+ subCategory: 'general',
214
+ },
215
+ {
216
+ uid: 'transfer.tokens.regenerate',
217
+ displayName: 'Regenerate',
218
+ pluginName: 'admin',
219
+ section: 'settings',
220
+ category: 'transfer tokens',
221
+ subCategory: 'general',
222
+ },
223
+ {
224
+ uid: 'transfer.tokens.delete',
225
+ displayName: 'Delete (revoke)',
226
+ pluginName: 'admin',
227
+ section: 'settings',
228
+ category: 'transfer tokens',
229
+ subCategory: 'general',
230
+ },
183
231
  ],
184
232
  };
@@ -6,4 +6,6 @@ module.exports = {
6
6
  role: { schema: require('./Role') },
7
7
  'api-token': { schema: require('./api-token') },
8
8
  'api-token-permission': { schema: require('./api-token-permission') },
9
+ 'transfer-token': { schema: require('./transfer-token') },
10
+ 'transfer-token-permission': { schema: require('./transfer-token-permission') },
9
11
  };
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ collectionName: 'strapi_transfer_token_permissions',
5
+ info: {
6
+ name: 'Transfer Token Permission',
7
+ description: '',
8
+ singularName: 'transfer-token-permission',
9
+ pluralName: 'transfer-token-permissions',
10
+ displayName: 'Transfer Token Permission',
11
+ },
12
+ options: {},
13
+ pluginOptions: {
14
+ 'content-manager': {
15
+ visible: false,
16
+ },
17
+ 'content-type-builder': {
18
+ visible: false,
19
+ },
20
+ },
21
+ attributes: {
22
+ action: {
23
+ type: 'string',
24
+ minLength: 1,
25
+ configurable: false,
26
+ required: true,
27
+ },
28
+ token: {
29
+ configurable: false,
30
+ type: 'relation',
31
+ relation: 'manyToOne',
32
+ inversedBy: 'permissions',
33
+ target: 'admin::transfer-token',
34
+ },
35
+ },
36
+ };
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ collectionName: 'strapi_transfer_tokens',
5
+ info: {
6
+ name: 'Transfer Token',
7
+ singularName: 'transfer-token',
8
+ pluralName: 'transfer-tokens',
9
+ displayName: 'Transfer Token',
10
+ description: '',
11
+ },
12
+ options: {},
13
+ pluginOptions: {
14
+ 'content-manager': {
15
+ visible: false,
16
+ },
17
+ 'content-type-builder': {
18
+ visible: false,
19
+ },
20
+ },
21
+ attributes: {
22
+ name: {
23
+ type: 'string',
24
+ minLength: 1,
25
+ configurable: false,
26
+ required: true,
27
+ unique: true,
28
+ },
29
+ description: {
30
+ type: 'string',
31
+ minLength: 1,
32
+ configurable: false,
33
+ required: false,
34
+ default: '',
35
+ },
36
+ accessKey: {
37
+ type: 'string',
38
+ minLength: 1,
39
+ configurable: false,
40
+ required: true,
41
+ },
42
+ lastUsedAt: {
43
+ type: 'datetime',
44
+ configurable: false,
45
+ required: false,
46
+ },
47
+ permissions: {
48
+ type: 'relation',
49
+ target: 'admin::transfer-token-permission',
50
+ relation: 'oneToMany',
51
+ mappedBy: 'token',
52
+ configurable: false,
53
+ required: false,
54
+ },
55
+ expiresAt: {
56
+ type: 'datetime',
57
+ configurable: false,
58
+ required: false,
59
+ },
60
+ lifespan: {
61
+ type: 'biginteger',
62
+ configurable: false,
63
+ required: false,
64
+ },
65
+ },
66
+ };
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('path');
4
+
5
+ const { map, values, sumBy, pipe, flatMap, propEq } = require('lodash/fp');
4
6
  const execa = require('execa');
5
7
  const _ = require('lodash');
6
8
  const { exists } = require('fs-extra');
@@ -97,11 +99,25 @@ module.exports = {
97
99
  );
98
100
  const isHostedOnStrapiCloud = env('STRAPI_HOSTING', null) === 'strapi.cloud';
99
101
 
102
+ const numberOfAllContentTypes = _.size(strapi.contentTypes);
103
+ const numberOfComponents = _.size(strapi.components);
104
+
105
+ const getNumberOfDynamicZones = () => {
106
+ return pipe(
107
+ map('attributes'),
108
+ flatMap(values),
109
+ sumBy(propEq('type', 'dynamiczone'))
110
+ )(strapi.contentTypes);
111
+ };
112
+
100
113
  return {
101
114
  data: {
102
115
  useTypescriptOnServer,
103
116
  useTypescriptOnAdmin,
104
117
  isHostedOnStrapiCloud,
118
+ numberOfAllContentTypes, // TODO: V5: This event should be renamed numberOfContentTypes in V5 as the name is already taken to describe the number of content types using i18n.
119
+ numberOfComponents,
120
+ numberOfDynamicZones: getNumberOfDynamicZones(),
105
121
  },
106
122
  };
107
123
  },
@@ -2,8 +2,7 @@
2
2
 
3
3
  const { stringEquals } = require('@strapi/utils/lib');
4
4
  const { ApplicationError } = require('@strapi/utils').errors;
5
- const { trim } = require('lodash/fp');
6
- const has = require('lodash/has');
5
+ const { trim, has } = require('lodash/fp');
7
6
  const { getService } = require('../utils');
8
7
  const {
9
8
  validateApiTokenCreationInput,
@@ -93,11 +92,11 @@ module.exports = {
93
92
  * - having a space at the end or start of the value.
94
93
  * - having only spaces as value;
95
94
  */
96
- if (has(attributes, 'name')) {
95
+ if (has('name', attributes)) {
97
96
  attributes.name = trim(body.name);
98
97
  }
99
98
 
100
- if (has(attributes, 'description') || attributes.description === null) {
99
+ if (has('description', attributes) || attributes.description === null) {
101
100
  attributes.description = trim(body.description);
102
101
  }
103
102
 
@@ -108,7 +107,7 @@ module.exports = {
108
107
  return ctx.notFound('API Token not found');
109
108
  }
110
109
 
111
- if (has(attributes, 'name')) {
110
+ if (has('name', attributes)) {
112
111
  const nameAlreadyTaken = await apiTokenService.getByName(attributes.name);
113
112
 
114
113
  /**
@@ -7,6 +7,7 @@ module.exports = {
7
7
  authentication: require('./authentication'),
8
8
  permission: require('./permission'),
9
9
  role: require('./role'),
10
+ transfer: require('./transfer'),
10
11
  user: require('./user'),
11
12
  webhooks: require('./webhooks'),
12
13
  'content-api': require('./content-api'),
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ const { mapKeys } = require('lodash/fp');
4
+
5
+ const runner = require('./runner');
6
+ const token = require('./token');
7
+
8
+ const prefixActionsName = (prefix, dict) => mapKeys((key) => `${prefix}-${key}`, dict);
9
+
10
+ module.exports = {
11
+ ...prefixActionsName('runner', runner),
12
+ ...prefixActionsName('token', token),
13
+ };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ const { remote } = require('@strapi/data-transfer/lib/strapi');
4
+ const { UnauthorizedError } = require('@strapi/utils/lib/errors');
5
+
6
+ const dataTransferAuthStrategy = require('../../strategies/data-transfer');
7
+
8
+ /**
9
+ * @param {import('koa').Context} ctx
10
+ * @param {string} [scope]
11
+ */
12
+ const verify = async (ctx, scope) => {
13
+ const { auth } = ctx.state;
14
+
15
+ if (!auth) {
16
+ throw new UnauthorizedError();
17
+ }
18
+
19
+ await dataTransferAuthStrategy.verify(auth, { scope });
20
+ };
21
+
22
+ module.exports = {
23
+ connect: remote.handlers.createTransferHandler({ verify }),
24
+ };
@@ -0,0 +1,131 @@
1
+ 'use strict';
2
+
3
+ const { trim, has } = require('lodash/fp');
4
+ const {
5
+ errors: { ApplicationError },
6
+ stringEquals,
7
+ } = require('@strapi/utils');
8
+
9
+ const {
10
+ token: { validateTransferTokenCreationInput, validateTransferTokenUpdateInput },
11
+ } = require('../../validation/transfer');
12
+ const { getService } = require('../../utils');
13
+
14
+ module.exports = {
15
+ async list(ctx) {
16
+ const transferService = getService('transfer');
17
+ const transferTokens = await transferService.token.list();
18
+
19
+ ctx.body = { data: transferTokens };
20
+ },
21
+
22
+ async getById(ctx) {
23
+ const { id } = ctx.params;
24
+ const tokenService = getService('transfer').token;
25
+
26
+ const transferToken = await tokenService.getById(id);
27
+
28
+ if (!transferToken) {
29
+ ctx.notFound('Transfer token not found');
30
+ return;
31
+ }
32
+
33
+ ctx.body = { data: transferToken };
34
+ },
35
+
36
+ async create(ctx) {
37
+ const { body } = ctx.request;
38
+ const { token: tokenService } = getService('transfer');
39
+
40
+ /**
41
+ * We trim fields to avoid having issues with either:
42
+ * - having a space at the end or start of the value
43
+ * - having only spaces as value (so that an empty field can be caught in validation)
44
+ */
45
+ const attributes = {
46
+ name: trim(body.name),
47
+ description: trim(body.description),
48
+ permissions: body.permissions,
49
+ lifespan: body.lifespan,
50
+ };
51
+
52
+ await validateTransferTokenCreationInput(attributes);
53
+
54
+ const alreadyExists = await tokenService.exists({ name: attributes.name });
55
+ if (alreadyExists) {
56
+ throw new ApplicationError('Name already taken');
57
+ }
58
+
59
+ const transferTokens = await tokenService.create(attributes);
60
+
61
+ ctx.created({ data: transferTokens });
62
+ },
63
+
64
+ async update(ctx) {
65
+ const { body } = ctx.request;
66
+ const { id } = ctx.params;
67
+ const { token: tokenService } = getService('transfer');
68
+
69
+ const attributes = body;
70
+ /**
71
+ * We trim fields to avoid having issues with either:
72
+ * - having a space at the end or start of the value
73
+ * - having only spaces as value (so that an empty field can be caught in validation)
74
+ */
75
+ if (has('name', attributes)) {
76
+ attributes.name = trim(body.name);
77
+ }
78
+
79
+ if (has('description', attributes) || attributes.description === null) {
80
+ attributes.description = trim(body.description);
81
+ }
82
+
83
+ await validateTransferTokenUpdateInput(attributes);
84
+
85
+ const apiTokenExists = await tokenService.getById(id);
86
+ if (!apiTokenExists) {
87
+ return ctx.notFound('Transfer token not found');
88
+ }
89
+
90
+ if (has('name', attributes)) {
91
+ const nameAlreadyTaken = await tokenService.getByName(attributes.name);
92
+
93
+ /**
94
+ * We cast the ids as string as the one coming from the ctx isn't cast
95
+ * as a Number in case it is supposed to be an integer. It remains
96
+ * as a string. This way we avoid issues with integers in the db.
97
+ */
98
+ if (!!nameAlreadyTaken && !stringEquals(nameAlreadyTaken.id, id)) {
99
+ throw new ApplicationError('Name already taken');
100
+ }
101
+ }
102
+
103
+ const apiToken = await tokenService.update(id, attributes);
104
+
105
+ ctx.body = { data: apiToken };
106
+ },
107
+
108
+ async revoke(ctx) {
109
+ const { id } = ctx.params;
110
+ const { token: tokenService } = getService('transfer');
111
+
112
+ const transferToken = await tokenService.revoke(id);
113
+
114
+ ctx.deleted({ data: transferToken });
115
+ },
116
+
117
+ async regenerate(ctx) {
118
+ const { id } = ctx.params;
119
+ const { token: tokenService } = getService('transfer');
120
+
121
+ const exists = await tokenService.getById(id);
122
+ if (!exists) {
123
+ ctx.notFound('Transfer token not found');
124
+ return;
125
+ }
126
+
127
+ const accessToken = await tokenService.regenerate(id);
128
+
129
+ ctx.created({ data: accessToken });
130
+ },
131
+ };
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- // const { register: registerDataTransferRoute } = require('@strapi/data-transfer/lib/strapi');
4
-
5
3
  const registerAdminPanelRoute = require('./routes/serve-admin-panel');
4
+
6
5
  const adminAuthStrategy = require('./strategies/admin');
6
+
7
7
  const apiTokenAuthStrategy = require('./strategies/api-token');
8
8
 
9
9
  module.exports = ({ strapi }) => {
@@ -16,11 +16,4 @@ 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
- // }
26
19
  };
@@ -8,6 +8,7 @@ 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');
11
12
 
12
13
  module.exports = [
13
14
  ...admin,
@@ -18,4 +19,5 @@ module.exports = [
18
19
  ...webhooks,
19
20
  ...apiTokens,
20
21
  ...contentApi,
22
+ ...transfer,
21
23
  ];