@strapi/core 0.0.0-experimental.d362bf200f5f9359a4bbd4a549603de5ee1f04ca → 0.0.0-experimental.d65615a2b9130dd742d3c396674457d7971da928

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 (532) hide show
  1. package/LICENSE +18 -3
  2. package/dist/Strapi.d.ts +37 -46
  3. package/dist/Strapi.d.ts.map +1 -1
  4. package/dist/Strapi.js +190 -225
  5. package/dist/Strapi.js.map +1 -1
  6. package/dist/Strapi.mjs +159 -214
  7. package/dist/Strapi.mjs.map +1 -1
  8. package/dist/configuration/config-loader.d.ts.map +1 -1
  9. package/dist/configuration/config-loader.js +9 -5
  10. package/dist/configuration/config-loader.js.map +1 -1
  11. package/dist/configuration/config-loader.mjs +9 -5
  12. package/dist/configuration/config-loader.mjs.map +1 -1
  13. package/dist/configuration/get-dirs.d.ts +10 -0
  14. package/dist/configuration/get-dirs.d.ts.map +1 -0
  15. package/dist/{utils → configuration}/get-dirs.js +3 -2
  16. package/dist/configuration/get-dirs.js.map +1 -0
  17. package/dist/{utils → configuration}/get-dirs.mjs +3 -2
  18. package/dist/configuration/get-dirs.mjs.map +1 -0
  19. package/dist/configuration/index.d.ts +4 -7
  20. package/dist/configuration/index.d.ts.map +1 -1
  21. package/dist/configuration/index.js +8 -6
  22. package/dist/configuration/index.js.map +1 -1
  23. package/dist/configuration/index.mjs +5 -4
  24. package/dist/configuration/index.mjs.map +1 -1
  25. package/dist/core-api/controller/collection-type.d.ts.map +1 -1
  26. package/dist/core-api/controller/collection-type.js +6 -3
  27. package/dist/core-api/controller/collection-type.js.map +1 -1
  28. package/dist/core-api/controller/collection-type.mjs +3 -0
  29. package/dist/core-api/controller/collection-type.mjs.map +1 -1
  30. package/dist/core-api/controller/index.js +2 -2
  31. package/dist/core-api/controller/index.js.map +1 -1
  32. package/dist/core-api/controller/single-type.d.ts.map +1 -1
  33. package/dist/core-api/controller/single-type.js +3 -2
  34. package/dist/core-api/controller/single-type.js.map +1 -1
  35. package/dist/core-api/controller/single-type.mjs +1 -0
  36. package/dist/core-api/controller/single-type.mjs.map +1 -1
  37. package/dist/core-api/controller/transform.js +8 -8
  38. package/dist/core-api/controller/transform.js.map +1 -1
  39. package/dist/core-api/routes/index.d.ts.map +1 -1
  40. package/dist/core-api/service/collection-type.d.ts +3 -9
  41. package/dist/core-api/service/collection-type.d.ts.map +1 -1
  42. package/dist/core-api/service/collection-type.js +18 -7
  43. package/dist/core-api/service/collection-type.js.map +1 -1
  44. package/dist/core-api/service/collection-type.mjs +19 -8
  45. package/dist/core-api/service/collection-type.mjs.map +1 -1
  46. package/dist/core-api/service/pagination.d.ts +4 -11
  47. package/dist/core-api/service/pagination.d.ts.map +1 -1
  48. package/dist/core-api/service/pagination.js +18 -44
  49. package/dist/core-api/service/pagination.js.map +1 -1
  50. package/dist/core-api/service/pagination.mjs +16 -42
  51. package/dist/core-api/service/pagination.mjs.map +1 -1
  52. package/dist/core-api/service/single-type.d.ts.map +1 -1
  53. package/dist/core-api/service/single-type.js +9 -2
  54. package/dist/core-api/service/single-type.js.map +1 -1
  55. package/dist/core-api/service/single-type.mjs +9 -2
  56. package/dist/core-api/service/single-type.mjs.map +1 -1
  57. package/dist/domain/content-type/index.js +4 -4
  58. package/dist/domain/content-type/index.js.map +1 -1
  59. package/dist/ee/index.d.ts +2 -0
  60. package/dist/ee/index.d.ts.map +1 -1
  61. package/dist/ee/index.js +3 -3
  62. package/dist/ee/index.js.map +1 -1
  63. package/dist/ee/index.mjs.map +1 -1
  64. package/dist/ee/license.d.ts.map +1 -1
  65. package/dist/ee/license.js +2 -1
  66. package/dist/ee/license.js.map +1 -1
  67. package/dist/ee/license.mjs +2 -1
  68. package/dist/ee/license.mjs.map +1 -1
  69. package/dist/factories.d.ts +2 -2
  70. package/dist/factories.d.ts.map +1 -1
  71. package/dist/factories.js +4 -4
  72. package/dist/factories.js.map +1 -1
  73. package/dist/factories.mjs.map +1 -1
  74. package/dist/index.d.ts +18 -2
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +25 -1
  77. package/dist/index.js.map +1 -1
  78. package/dist/index.mjs +27 -3
  79. package/dist/index.mjs.map +1 -1
  80. package/dist/loaders/admin.js +0 -1
  81. package/dist/loaders/admin.js.map +1 -1
  82. package/dist/loaders/admin.mjs +0 -1
  83. package/dist/loaders/admin.mjs.map +1 -1
  84. package/dist/loaders/apis.d.ts.map +1 -1
  85. package/dist/loaders/apis.js +12 -12
  86. package/dist/loaders/apis.js.map +1 -1
  87. package/dist/loaders/apis.mjs +10 -10
  88. package/dist/loaders/apis.mjs.map +1 -1
  89. package/dist/loaders/index.d.ts.map +1 -1
  90. package/dist/loaders/index.js +0 -2
  91. package/dist/loaders/index.js.map +1 -1
  92. package/dist/loaders/index.mjs +0 -2
  93. package/dist/loaders/index.mjs.map +1 -1
  94. package/dist/loaders/plugins/get-enabled-plugins.d.ts.map +1 -1
  95. package/dist/loaders/plugins/get-enabled-plugins.js +46 -17
  96. package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
  97. package/dist/loaders/plugins/get-enabled-plugins.mjs +16 -9
  98. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
  99. package/dist/loaders/plugins/get-user-plugins-config.js +2 -2
  100. package/dist/loaders/plugins/get-user-plugins-config.js.map +1 -1
  101. package/dist/loaders/plugins/index.d.ts.map +1 -1
  102. package/dist/loaders/plugins/index.js +34 -7
  103. package/dist/loaders/plugins/index.js.map +1 -1
  104. package/dist/loaders/plugins/index.mjs +9 -1
  105. package/dist/loaders/plugins/index.mjs.map +1 -1
  106. package/dist/middlewares/body.d.ts +2 -2
  107. package/dist/middlewares/body.d.ts.map +1 -1
  108. package/dist/middlewares/body.js +6 -6
  109. package/dist/middlewares/body.js.map +1 -1
  110. package/dist/middlewares/body.mjs +4 -4
  111. package/dist/middlewares/body.mjs.map +1 -1
  112. package/dist/middlewares/cors.d.ts.map +1 -1
  113. package/dist/middlewares/cors.js +9 -7
  114. package/dist/middlewares/cors.js.map +1 -1
  115. package/dist/middlewares/cors.mjs +9 -7
  116. package/dist/middlewares/cors.mjs.map +1 -1
  117. package/dist/middlewares/public.js +3 -3
  118. package/dist/middlewares/public.js.map +1 -1
  119. package/dist/middlewares/public.mjs +1 -1
  120. package/dist/middlewares/public.mjs.map +1 -1
  121. package/dist/middlewares/query.d.ts.map +1 -1
  122. package/dist/middlewares/query.js.map +1 -1
  123. package/dist/middlewares/query.mjs.map +1 -1
  124. package/dist/middlewares/responses.js +2 -2
  125. package/dist/middlewares/responses.js.map +1 -1
  126. package/dist/middlewares/security.d.ts.map +1 -1
  127. package/dist/middlewares/security.js +12 -5
  128. package/dist/middlewares/security.js.map +1 -1
  129. package/dist/middlewares/security.mjs +11 -4
  130. package/dist/middlewares/security.mjs.map +1 -1
  131. package/dist/middlewares/session.js +2 -2
  132. package/dist/middlewares/session.js.map +1 -1
  133. package/dist/migrations/database/5.0.0-discard-drafts.d.ts +33 -0
  134. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -0
  135. package/dist/migrations/database/5.0.0-discard-drafts.js +94 -0
  136. package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -0
  137. package/dist/migrations/database/5.0.0-discard-drafts.mjs +94 -0
  138. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -0
  139. package/dist/migrations/draft-publish.d.ts +1 -1
  140. package/dist/migrations/draft-publish.d.ts.map +1 -1
  141. package/dist/migrations/draft-publish.js +14 -31
  142. package/dist/migrations/draft-publish.js.map +1 -1
  143. package/dist/migrations/draft-publish.mjs +15 -32
  144. package/dist/migrations/draft-publish.mjs.map +1 -1
  145. package/dist/migrations/i18n.d.ts +5 -0
  146. package/dist/migrations/i18n.d.ts.map +1 -0
  147. package/dist/migrations/i18n.js +54 -0
  148. package/dist/migrations/i18n.js.map +1 -0
  149. package/dist/migrations/i18n.mjs +54 -0
  150. package/dist/migrations/i18n.mjs.map +1 -0
  151. package/dist/migrations/index.d.ts +5 -0
  152. package/dist/migrations/index.d.ts.map +1 -0
  153. package/dist/migrations/index.js +15 -0
  154. package/dist/migrations/index.js.map +1 -0
  155. package/dist/migrations/index.mjs +15 -0
  156. package/dist/migrations/index.mjs.map +1 -0
  157. package/dist/providers/admin.d.ts +3 -0
  158. package/dist/providers/admin.d.ts.map +1 -0
  159. package/dist/providers/admin.js +20 -0
  160. package/dist/providers/admin.js.map +1 -0
  161. package/dist/providers/admin.mjs +21 -0
  162. package/dist/providers/admin.mjs.map +1 -0
  163. package/dist/providers/coreStore.d.ts +3 -0
  164. package/dist/providers/coreStore.d.ts.map +1 -0
  165. package/dist/providers/coreStore.js +11 -0
  166. package/dist/providers/coreStore.js.map +1 -0
  167. package/dist/providers/coreStore.mjs +12 -0
  168. package/dist/providers/coreStore.mjs.map +1 -0
  169. package/dist/providers/cron.d.ts +3 -0
  170. package/dist/providers/cron.d.ts.map +1 -0
  171. package/dist/providers/cron.js +20 -0
  172. package/dist/providers/cron.js.map +1 -0
  173. package/dist/providers/cron.mjs +21 -0
  174. package/dist/providers/cron.mjs.map +1 -0
  175. package/dist/providers/index.d.ts +3 -0
  176. package/dist/providers/index.d.ts.map +1 -0
  177. package/dist/providers/index.js +11 -0
  178. package/dist/providers/index.js.map +1 -0
  179. package/dist/providers/index.mjs +11 -0
  180. package/dist/providers/index.mjs.map +1 -0
  181. package/dist/providers/provider.d.ts +9 -0
  182. package/dist/providers/provider.d.ts.map +1 -0
  183. package/dist/providers/provider.js +5 -0
  184. package/dist/providers/provider.js.map +1 -0
  185. package/dist/providers/provider.mjs +5 -0
  186. package/dist/providers/provider.mjs.map +1 -0
  187. package/dist/providers/registries.d.ts +3 -0
  188. package/dist/providers/registries.d.ts.map +1 -0
  189. package/dist/providers/registries.js +35 -0
  190. package/dist/providers/registries.js.map +1 -0
  191. package/dist/providers/registries.mjs +36 -0
  192. package/dist/providers/registries.mjs.map +1 -0
  193. package/dist/providers/telemetry.d.ts +3 -0
  194. package/dist/providers/telemetry.d.ts.map +1 -0
  195. package/dist/providers/telemetry.js +19 -0
  196. package/dist/providers/telemetry.js.map +1 -0
  197. package/dist/providers/telemetry.mjs +20 -0
  198. package/dist/providers/telemetry.mjs.map +1 -0
  199. package/dist/providers/webhooks.d.ts +3 -0
  200. package/dist/providers/webhooks.d.ts.map +1 -0
  201. package/dist/providers/webhooks.js +30 -0
  202. package/dist/providers/webhooks.js.map +1 -0
  203. package/dist/providers/webhooks.mjs +31 -0
  204. package/dist/providers/webhooks.mjs.map +1 -0
  205. package/dist/registries/apis.js +2 -2
  206. package/dist/registries/apis.js.map +1 -1
  207. package/dist/registries/components.js +2 -2
  208. package/dist/registries/components.js.map +1 -1
  209. package/dist/registries/content-types.js +3 -3
  210. package/dist/registries/content-types.js.map +1 -1
  211. package/dist/registries/controllers.js +3 -3
  212. package/dist/registries/controllers.js.map +1 -1
  213. package/dist/registries/custom-fields.js +4 -4
  214. package/dist/registries/custom-fields.js.map +1 -1
  215. package/dist/registries/hooks.js +2 -2
  216. package/dist/registries/hooks.js.map +1 -1
  217. package/dist/registries/index.d.ts +0 -1
  218. package/dist/registries/index.d.ts.map +1 -1
  219. package/dist/registries/middlewares.js +3 -3
  220. package/dist/registries/middlewares.js.map +1 -1
  221. package/dist/registries/modules.js +3 -3
  222. package/dist/registries/modules.js.map +1 -1
  223. package/dist/registries/plugins.js +2 -2
  224. package/dist/registries/plugins.js.map +1 -1
  225. package/dist/registries/policies.d.ts +1 -1
  226. package/dist/registries/policies.d.ts.map +1 -1
  227. package/dist/registries/policies.js +5 -5
  228. package/dist/registries/policies.js.map +1 -1
  229. package/dist/registries/policies.mjs +1 -1
  230. package/dist/registries/policies.mjs.map +1 -1
  231. package/dist/registries/services.js +3 -3
  232. package/dist/registries/services.js.map +1 -1
  233. package/dist/services/auth/index.js +3 -3
  234. package/dist/services/auth/index.js.map +1 -1
  235. package/dist/services/config.d.ts +3 -0
  236. package/dist/services/config.d.ts.map +1 -0
  237. package/dist/{registries → services}/config.js +11 -7
  238. package/dist/services/config.js.map +1 -0
  239. package/dist/{registries → services}/config.mjs +10 -7
  240. package/dist/services/config.mjs.map +1 -0
  241. package/dist/services/content-api/index.d.ts +10 -12
  242. package/dist/services/content-api/index.d.ts.map +1 -1
  243. package/dist/services/content-api/index.js +1 -1
  244. package/dist/services/content-api/index.js.map +1 -1
  245. package/dist/services/content-api/index.mjs +1 -1
  246. package/dist/services/content-api/index.mjs.map +1 -1
  247. package/dist/services/content-api/permissions/index.d.ts +10 -12
  248. package/dist/services/content-api/permissions/index.d.ts.map +1 -1
  249. package/dist/services/content-api/permissions/index.js +1 -1
  250. package/dist/services/content-api/permissions/index.js.map +1 -1
  251. package/dist/services/content-api/permissions/index.mjs +1 -1
  252. package/dist/services/content-api/permissions/index.mjs.map +1 -1
  253. package/dist/services/content-api/permissions/providers/action.d.ts +5 -6
  254. package/dist/services/content-api/permissions/providers/action.d.ts.map +1 -1
  255. package/dist/services/content-api/permissions/providers/condition.d.ts +5 -6
  256. package/dist/services/content-api/permissions/providers/condition.d.ts.map +1 -1
  257. package/dist/services/core-store.d.ts.map +1 -1
  258. package/dist/services/core-store.js +3 -3
  259. package/dist/services/core-store.js.map +1 -1
  260. package/dist/services/cron.d.ts +3 -3
  261. package/dist/services/cron.d.ts.map +1 -1
  262. package/dist/services/cron.js +3 -3
  263. package/dist/services/cron.js.map +1 -1
  264. package/dist/services/cron.mjs.map +1 -1
  265. package/dist/services/document-service/attributes/index.d.ts +6 -0
  266. package/dist/services/document-service/attributes/index.d.ts.map +1 -0
  267. package/dist/services/{entity-service → document-service}/attributes/index.js +5 -5
  268. package/dist/services/document-service/attributes/index.js.map +1 -0
  269. package/dist/services/{entity-service → document-service}/attributes/index.mjs +5 -5
  270. package/dist/services/document-service/attributes/index.mjs.map +1 -0
  271. package/dist/services/document-service/attributes/transforms.d.ts.map +1 -0
  272. package/dist/services/{entity-service → document-service}/attributes/transforms.js +3 -3
  273. package/dist/services/document-service/attributes/transforms.js.map +1 -0
  274. package/dist/services/document-service/attributes/transforms.mjs.map +1 -0
  275. package/dist/services/document-service/common.d.ts +1 -1
  276. package/dist/services/document-service/common.d.ts.map +1 -1
  277. package/dist/services/document-service/common.js.map +1 -1
  278. package/dist/services/document-service/common.mjs.map +1 -1
  279. package/dist/services/document-service/components.d.ts +25 -1
  280. package/dist/services/document-service/components.d.ts.map +1 -1
  281. package/dist/services/{entity-service → document-service}/components.js +46 -56
  282. package/dist/services/document-service/components.js.map +1 -0
  283. package/dist/services/{entity-service → document-service}/components.mjs +36 -46
  284. package/dist/services/document-service/components.mjs.map +1 -0
  285. package/dist/services/document-service/draft-and-publish.js +16 -16
  286. package/dist/services/document-service/draft-and-publish.js.map +1 -1
  287. package/dist/services/document-service/entries.d.ts +10 -0
  288. package/dist/services/document-service/entries.d.ts.map +1 -0
  289. package/dist/services/document-service/entries.js +96 -0
  290. package/dist/services/document-service/entries.js.map +1 -0
  291. package/dist/services/document-service/entries.mjs +96 -0
  292. package/dist/services/document-service/entries.mjs.map +1 -0
  293. package/dist/services/document-service/events.d.ts +25 -0
  294. package/dist/services/document-service/events.d.ts.map +1 -0
  295. package/dist/services/document-service/events.js +47 -0
  296. package/dist/services/document-service/events.js.map +1 -0
  297. package/dist/services/document-service/events.mjs +47 -0
  298. package/dist/services/document-service/events.mjs.map +1 -0
  299. package/dist/services/document-service/index.d.ts +0 -2
  300. package/dist/services/document-service/index.d.ts.map +1 -1
  301. package/dist/services/document-service/index.js +13 -2
  302. package/dist/services/document-service/index.js.map +1 -1
  303. package/dist/services/document-service/index.mjs +13 -2
  304. package/dist/services/document-service/index.mjs.map +1 -1
  305. package/dist/services/document-service/internationalization.d.ts.map +1 -1
  306. package/dist/services/document-service/internationalization.js +21 -12
  307. package/dist/services/document-service/internationalization.js.map +1 -1
  308. package/dist/services/document-service/internationalization.mjs +14 -5
  309. package/dist/services/document-service/internationalization.mjs.map +1 -1
  310. package/dist/services/document-service/middlewares/middleware-manager.d.ts +5 -2
  311. package/dist/services/document-service/middlewares/middleware-manager.d.ts.map +1 -1
  312. package/dist/services/document-service/middlewares/middleware-manager.js +8 -5
  313. package/dist/services/document-service/middlewares/middleware-manager.js.map +1 -1
  314. package/dist/services/document-service/middlewares/middleware-manager.mjs +8 -5
  315. package/dist/services/document-service/middlewares/middleware-manager.mjs.map +1 -1
  316. package/dist/services/document-service/params.d.ts +3 -1
  317. package/dist/services/document-service/params.d.ts.map +1 -1
  318. package/dist/services/{entity-service → document-service}/params.js +2 -2
  319. package/dist/services/document-service/params.js.map +1 -0
  320. package/dist/services/document-service/params.mjs.map +1 -0
  321. package/dist/services/document-service/repository.d.ts.map +1 -1
  322. package/dist/services/document-service/repository.js +177 -160
  323. package/dist/services/document-service/repository.js.map +1 -1
  324. package/dist/services/document-service/repository.mjs +154 -137
  325. package/dist/services/document-service/repository.mjs.map +1 -1
  326. package/dist/services/document-service/transform/data.d.ts.map +1 -1
  327. package/dist/services/document-service/transform/data.js +4 -2
  328. package/dist/services/document-service/transform/data.js.map +1 -1
  329. package/dist/services/document-service/transform/data.mjs +4 -2
  330. package/dist/services/document-service/transform/data.mjs.map +1 -1
  331. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  332. package/dist/services/document-service/transform/id-transform.js +2 -2
  333. package/dist/services/document-service/transform/id-transform.js.map +1 -1
  334. package/dist/services/document-service/transform/query.d.ts +5 -0
  335. package/dist/services/document-service/transform/query.d.ts.map +1 -0
  336. package/dist/services/document-service/transform/query.js +9 -0
  337. package/dist/services/document-service/transform/query.js.map +1 -0
  338. package/dist/services/document-service/transform/query.mjs +9 -0
  339. package/dist/services/document-service/transform/query.mjs.map +1 -0
  340. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts +8 -7
  341. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts.map +1 -1
  342. package/dist/services/document-service/transform/relations/extract/data-ids.js +45 -78
  343. package/dist/services/document-service/transform/relations/extract/data-ids.js.map +1 -1
  344. package/dist/services/document-service/transform/relations/extract/data-ids.mjs +44 -77
  345. package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +1 -1
  346. package/dist/services/document-service/transform/relations/transform/data-ids.d.ts +7 -3
  347. package/dist/services/document-service/transform/relations/transform/data-ids.d.ts.map +1 -1
  348. package/dist/services/document-service/transform/relations/transform/data-ids.js +61 -126
  349. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +1 -1
  350. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +61 -126
  351. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +1 -1
  352. package/dist/services/document-service/transform/relations/transform/default-locale.d.ts +9 -0
  353. package/dist/services/document-service/transform/relations/transform/default-locale.d.ts.map +1 -0
  354. package/dist/services/document-service/transform/relations/transform/default-locale.js +32 -0
  355. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +1 -0
  356. package/dist/services/document-service/transform/relations/transform/default-locale.mjs +32 -0
  357. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +1 -0
  358. package/dist/services/document-service/transform/relations/utils/dp.js +2 -2
  359. package/dist/services/document-service/transform/relations/utils/dp.js.map +1 -1
  360. package/dist/services/document-service/transform/relations/utils/i18n.d.ts +2 -2
  361. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  362. package/dist/services/document-service/transform/relations/utils/i18n.js +3 -9
  363. package/dist/services/document-service/transform/relations/utils/i18n.js.map +1 -1
  364. package/dist/services/document-service/transform/relations/utils/i18n.mjs +3 -9
  365. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +1 -1
  366. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts +6 -0
  367. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts.map +1 -0
  368. package/dist/services/document-service/transform/relations/utils/map-relation.js +91 -0
  369. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +1 -0
  370. package/dist/services/document-service/transform/relations/utils/map-relation.mjs +91 -0
  371. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +1 -0
  372. package/dist/services/document-service/transform/relations/utils/types.d.ts +6 -0
  373. package/dist/services/document-service/transform/relations/utils/types.d.ts.map +1 -1
  374. package/dist/services/document-service/utils/populate.d.ts.map +1 -1
  375. package/dist/services/document-service/utils/populate.js +7 -1
  376. package/dist/services/document-service/utils/populate.js.map +1 -1
  377. package/dist/services/document-service/utils/populate.mjs +7 -1
  378. package/dist/services/document-service/utils/populate.mjs.map +1 -1
  379. package/dist/services/document-service/utils/unidirectional-relations.d.ts +33 -0
  380. package/dist/services/document-service/utils/unidirectional-relations.d.ts.map +1 -0
  381. package/dist/services/document-service/utils/unidirectional-relations.js +57 -0
  382. package/dist/services/document-service/utils/unidirectional-relations.js.map +1 -0
  383. package/dist/services/document-service/utils/unidirectional-relations.mjs +57 -0
  384. package/dist/services/document-service/utils/unidirectional-relations.mjs.map +1 -0
  385. package/dist/services/entity-service/index.d.ts.map +1 -1
  386. package/dist/services/entity-service/index.js +11 -4
  387. package/dist/services/entity-service/index.js.map +1 -1
  388. package/dist/services/entity-service/index.mjs +11 -4
  389. package/dist/services/entity-service/index.mjs.map +1 -1
  390. package/dist/services/entity-validator/blocks-validator.d.ts +1 -2
  391. package/dist/services/entity-validator/blocks-validator.d.ts.map +1 -1
  392. package/dist/services/entity-validator/blocks-validator.js +4 -3
  393. package/dist/services/entity-validator/blocks-validator.js.map +1 -1
  394. package/dist/services/entity-validator/blocks-validator.mjs +3 -3
  395. package/dist/services/entity-validator/blocks-validator.mjs.map +1 -1
  396. package/dist/services/entity-validator/index.d.ts +15 -1
  397. package/dist/services/entity-validator/index.d.ts.map +1 -1
  398. package/dist/services/entity-validator/index.js +189 -127
  399. package/dist/services/entity-validator/index.js.map +1 -1
  400. package/dist/services/entity-validator/index.mjs +184 -122
  401. package/dist/services/entity-validator/index.mjs.map +1 -1
  402. package/dist/services/entity-validator/validators.d.ts +36 -25
  403. package/dist/services/entity-validator/validators.d.ts.map +1 -1
  404. package/dist/services/entity-validator/validators.js +148 -33
  405. package/dist/services/entity-validator/validators.js.map +1 -1
  406. package/dist/services/entity-validator/validators.mjs +140 -25
  407. package/dist/services/entity-validator/validators.mjs.map +1 -1
  408. package/dist/services/event-hub.d.ts +1 -0
  409. package/dist/services/event-hub.d.ts.map +1 -1
  410. package/dist/services/event-hub.js +9 -4
  411. package/dist/services/event-hub.js.map +1 -1
  412. package/dist/services/event-hub.mjs +9 -4
  413. package/dist/services/event-hub.mjs.map +1 -1
  414. package/dist/services/metrics/middleware.d.ts.map +1 -1
  415. package/dist/services/metrics/rate-limiter.d.ts.map +1 -1
  416. package/dist/services/metrics/rate-limiter.js.map +1 -1
  417. package/dist/services/metrics/rate-limiter.mjs.map +1 -1
  418. package/dist/services/reloader.d.ts +7 -0
  419. package/dist/services/reloader.d.ts.map +1 -0
  420. package/dist/services/reloader.js +36 -0
  421. package/dist/services/reloader.js.map +1 -0
  422. package/dist/services/reloader.mjs +36 -0
  423. package/dist/services/reloader.mjs.map +1 -0
  424. package/dist/services/server/compose-endpoint.d.ts.map +1 -1
  425. package/dist/services/server/compose-endpoint.js +7 -7
  426. package/dist/services/server/compose-endpoint.js.map +1 -1
  427. package/dist/services/server/index.js +1 -1
  428. package/dist/services/server/index.js.map +1 -1
  429. package/dist/services/server/index.mjs +1 -1
  430. package/dist/services/server/index.mjs.map +1 -1
  431. package/dist/services/server/koa.d.ts.map +1 -1
  432. package/dist/services/server/koa.js +4 -4
  433. package/dist/services/server/koa.js.map +1 -1
  434. package/dist/services/server/koa.mjs +1 -1
  435. package/dist/services/server/koa.mjs.map +1 -1
  436. package/dist/services/server/middleware.js +3 -3
  437. package/dist/services/server/middleware.js.map +1 -1
  438. package/dist/services/server/register-routes.js +3 -3
  439. package/dist/services/server/register-routes.js.map +1 -1
  440. package/dist/services/server/register-routes.mjs +3 -3
  441. package/dist/services/server/register-routes.mjs.map +1 -1
  442. package/dist/services/server/routing.d.ts +1 -1
  443. package/dist/services/server/routing.js +2 -2
  444. package/dist/services/server/routing.js.map +1 -1
  445. package/dist/services/utils/dynamic-zones.js +5 -5
  446. package/dist/services/utils/dynamic-zones.js.map +1 -1
  447. package/dist/services/webhook-runner.d.ts +2 -1
  448. package/dist/services/webhook-runner.d.ts.map +1 -1
  449. package/dist/services/webhook-runner.js.map +1 -1
  450. package/dist/services/webhook-runner.mjs.map +1 -1
  451. package/dist/services/webhook-store.d.ts +2 -8
  452. package/dist/services/webhook-store.d.ts.map +1 -1
  453. package/dist/services/webhook-store.js +14 -8
  454. package/dist/services/webhook-store.js.map +1 -1
  455. package/dist/services/webhook-store.mjs +14 -8
  456. package/dist/services/webhook-store.mjs.map +1 -1
  457. package/dist/utils/cron.js +3 -3
  458. package/dist/utils/cron.js.map +1 -1
  459. package/dist/utils/fetch.d.ts.map +1 -1
  460. package/dist/utils/fetch.js +4 -3
  461. package/dist/utils/fetch.js.map +1 -1
  462. package/dist/utils/fetch.mjs +4 -3
  463. package/dist/utils/fetch.mjs.map +1 -1
  464. package/dist/utils/filepath-to-prop-path.d.ts +1 -1
  465. package/dist/utils/filepath-to-prop-path.d.ts.map +1 -1
  466. package/dist/utils/filepath-to-prop-path.js +27 -6
  467. package/dist/utils/filepath-to-prop-path.js.map +1 -1
  468. package/dist/utils/filepath-to-prop-path.mjs +25 -5
  469. package/dist/utils/filepath-to-prop-path.mjs.map +1 -1
  470. package/dist/utils/index.d.ts +2 -1
  471. package/dist/utils/index.d.ts.map +1 -1
  472. package/dist/utils/is-initialized.js +3 -3
  473. package/dist/utils/is-initialized.js.map +1 -1
  474. package/dist/utils/load-files.d.ts.map +1 -1
  475. package/dist/utils/resolve-working-dirs.d.ts +19 -0
  476. package/dist/utils/resolve-working-dirs.d.ts.map +1 -0
  477. package/dist/utils/resolve-working-dirs.js +13 -0
  478. package/dist/utils/resolve-working-dirs.js.map +1 -0
  479. package/dist/utils/resolve-working-dirs.mjs +11 -0
  480. package/dist/utils/resolve-working-dirs.mjs.map +1 -0
  481. package/dist/utils/startup-logger.d.ts.map +1 -1
  482. package/dist/utils/startup-logger.js +4 -4
  483. package/dist/utils/startup-logger.js.map +1 -1
  484. package/dist/utils/startup-logger.mjs +3 -3
  485. package/dist/utils/startup-logger.mjs.map +1 -1
  486. package/dist/utils/transform-content-types-to-models.d.ts +23 -18
  487. package/dist/utils/transform-content-types-to-models.d.ts.map +1 -1
  488. package/dist/utils/transform-content-types-to-models.js +112 -61
  489. package/dist/utils/transform-content-types-to-models.js.map +1 -1
  490. package/dist/utils/transform-content-types-to-models.mjs +111 -60
  491. package/dist/utils/transform-content-types-to-models.mjs.map +1 -1
  492. package/dist/utils/update-notifier/index.d.ts +1 -6
  493. package/dist/utils/update-notifier/index.d.ts.map +1 -1
  494. package/dist/utils/update-notifier/index.js +11 -14
  495. package/dist/utils/update-notifier/index.js.map +1 -1
  496. package/dist/utils/update-notifier/index.mjs +11 -14
  497. package/dist/utils/update-notifier/index.mjs.map +1 -1
  498. package/package.json +34 -30
  499. package/dist/registries/config.d.ts +0 -4
  500. package/dist/registries/config.d.ts.map +0 -1
  501. package/dist/registries/config.js.map +0 -1
  502. package/dist/registries/config.mjs.map +0 -1
  503. package/dist/services/document-service/document-engine.d.ts +0 -2
  504. package/dist/services/document-service/document-engine.d.ts.map +0 -1
  505. package/dist/services/document-service/transform/relations/transform/output-ids.d.ts +0 -2
  506. package/dist/services/document-service/transform/relations/transform/output-ids.d.ts.map +0 -1
  507. package/dist/services/document-service/transform/relations/utils/data.js +0 -12
  508. package/dist/services/document-service/transform/relations/utils/data.js.map +0 -1
  509. package/dist/services/document-service/transform/relations/utils/data.mjs +0 -12
  510. package/dist/services/document-service/transform/relations/utils/data.mjs.map +0 -1
  511. package/dist/services/entity-service/attributes/index.d.ts +0 -6
  512. package/dist/services/entity-service/attributes/index.d.ts.map +0 -1
  513. package/dist/services/entity-service/attributes/index.js.map +0 -1
  514. package/dist/services/entity-service/attributes/index.mjs.map +0 -1
  515. package/dist/services/entity-service/attributes/transforms.d.ts.map +0 -1
  516. package/dist/services/entity-service/attributes/transforms.js.map +0 -1
  517. package/dist/services/entity-service/attributes/transforms.mjs.map +0 -1
  518. package/dist/services/entity-service/components.d.ts +0 -95
  519. package/dist/services/entity-service/components.d.ts.map +0 -1
  520. package/dist/services/entity-service/components.js.map +0 -1
  521. package/dist/services/entity-service/components.mjs.map +0 -1
  522. package/dist/services/entity-service/params.d.ts +0 -8
  523. package/dist/services/entity-service/params.d.ts.map +0 -1
  524. package/dist/services/entity-service/params.js.map +0 -1
  525. package/dist/services/entity-service/params.mjs.map +0 -1
  526. package/dist/utils/get-dirs.d.ts +0 -9
  527. package/dist/utils/get-dirs.d.ts.map +0 -1
  528. package/dist/utils/get-dirs.js.map +0 -1
  529. package/dist/utils/get-dirs.mjs.map +0 -1
  530. /package/dist/services/{entity-service → document-service}/attributes/transforms.d.ts +0 -0
  531. /package/dist/services/{entity-service → document-service}/attributes/transforms.mjs +0 -0
  532. /package/dist/services/{entity-service → document-service}/params.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"admin.mjs","sources":["../../src/loaders/admin.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core, Struct } from '@strapi/types';\nimport { getGlobalId } from '../domain/content-type';\n\nexport default async function loadAdmin(strapi: Core.Strapi) {\n strapi.admin = require('@strapi/admin/strapi-server');\n\n strapi.get('services').add(`admin::`, strapi.admin?.services);\n strapi.get('controllers').add(`admin::`, strapi.admin?.controllers);\n strapi.get('content-types').add(`admin::`, formatContentTypes(strapi.admin?.contentTypes ?? {}));\n strapi.get('policies').add(`admin::`, strapi.admin?.policies);\n strapi.get('middlewares').add(`admin::`, strapi.admin?.middlewares);\n\n const userAdminConfig = strapi.config.get('admin');\n strapi.get('config').set('admin', _.merge(strapi.admin?.config, userAdminConfig));\n}\n\nconst formatContentTypes = (contentTypes: Record<string, { schema: Struct.ContentTypeSchema }>) => {\n Object.values(contentTypes).forEach((definition) => {\n const { schema } = definition;\n\n Object.assign(schema, {\n plugin: 'admin',\n globalId: getGlobalId(schema, 'admin'),\n });\n });\n\n return contentTypes;\n};\n"],"names":[],"mappings":";;AAIA,eAA8B,UAAU,QAAqB;AACpD,SAAA,QAAQ,QAAQ,6BAA6B;AAEpD,SAAO,IAAI,UAAU,EAAE,IAAI,WAAW,OAAO,OAAO,QAAQ;AAC5D,SAAO,IAAI,aAAa,EAAE,IAAI,WAAW,OAAO,OAAO,WAAW;AAC3D,SAAA,IAAI,eAAe,EAAE,IAAI,WAAW,mBAAmB,OAAO,OAAO,gBAAgB,CAAA,CAAE,CAAC;AAC/F,SAAO,IAAI,UAAU,EAAE,IAAI,WAAW,OAAO,OAAO,QAAQ;AAC5D,SAAO,IAAI,aAAa,EAAE,IAAI,WAAW,OAAO,OAAO,WAAW;AAElE,QAAM,kBAAkB,OAAO,OAAO,IAAI,OAAO;AAC1C,SAAA,IAAI,QAAQ,EAAE,IAAI,SAAS,EAAE,MAAM,OAAO,OAAO,QAAQ,eAAe,CAAC;AAClF;AAEA,MAAM,qBAAqB,CAAC,iBAAuE;AACjG,SAAO,OAAO,YAAY,EAAE,QAAQ,CAAC,eAAe;AAC5C,UAAA,EAAE,OAAW,IAAA;AAEnB,WAAO,OAAO,QAAQ;AAAA,MACpB,QAAQ;AAAA,MACR,UAAU,YAAY,QAAQ,OAAO;AAAA,IAAA,CACtC;AAAA,EAAA,CACF;AAEM,SAAA;AACT;"}
1
+ {"version":3,"file":"admin.mjs","sources":["../../src/loaders/admin.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core, Struct } from '@strapi/types';\nimport { getGlobalId } from '../domain/content-type';\n\nexport default async function loadAdmin(strapi: Core.Strapi) {\n // strapi.admin = require('@strapi/admin/strapi-server');\n\n strapi.get('services').add(`admin::`, strapi.admin?.services);\n strapi.get('controllers').add(`admin::`, strapi.admin?.controllers);\n strapi.get('content-types').add(`admin::`, formatContentTypes(strapi.admin?.contentTypes ?? {}));\n strapi.get('policies').add(`admin::`, strapi.admin?.policies);\n strapi.get('middlewares').add(`admin::`, strapi.admin?.middlewares);\n\n const userAdminConfig = strapi.config.get('admin');\n strapi.get('config').set('admin', _.merge(strapi.admin?.config, userAdminConfig));\n}\n\nconst formatContentTypes = (contentTypes: Record<string, { schema: Struct.ContentTypeSchema }>) => {\n Object.values(contentTypes).forEach((definition) => {\n const { schema } = definition;\n\n Object.assign(schema, {\n plugin: 'admin',\n globalId: getGlobalId(schema, 'admin'),\n });\n });\n\n return contentTypes;\n};\n"],"names":[],"mappings":";;AAIA,eAA8B,UAAU,QAAqB;AAG3D,SAAO,IAAI,UAAU,EAAE,IAAI,WAAW,OAAO,OAAO,QAAQ;AAC5D,SAAO,IAAI,aAAa,EAAE,IAAI,WAAW,OAAO,OAAO,WAAW;AAC3D,SAAA,IAAI,eAAe,EAAE,IAAI,WAAW,mBAAmB,OAAO,OAAO,gBAAgB,CAAA,CAAE,CAAC;AAC/F,SAAO,IAAI,UAAU,EAAE,IAAI,WAAW,OAAO,OAAO,QAAQ;AAC5D,SAAO,IAAI,aAAa,EAAE,IAAI,WAAW,OAAO,OAAO,WAAW;AAElE,QAAM,kBAAkB,OAAO,OAAO,IAAI,OAAO;AAC1C,SAAA,IAAI,QAAQ,EAAE,IAAI,SAAS,EAAE,MAAM,OAAO,OAAO,QAAQ,eAAe,CAAC;AAClF;AAEA,MAAM,qBAAqB,CAAC,iBAAuE;AACjG,SAAO,OAAO,YAAY,EAAE,QAAQ,CAAC,eAAe;AAC5C,UAAA,EAAE,OAAW,IAAA;AAEnB,WAAO,OAAO,QAAQ;AAAA,MACpB,QAAQ;AAAA,MACR,UAAU,YAAY,QAAQ,OAAO;AAAA,IAAA,CACtC;AAAA,EAAA,CACF;AAEM,SAAA;AACT;"}
@@ -1 +1 @@
1
- {"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../src/loaders/apis.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAU,MAAM,eAAe,CAAC;AAgClD,wBAA8B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,iBAwBzD"}
1
+ {"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../src/loaders/apis.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAU,MAAM,eAAe,CAAC;AAgClD,wBAA8B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,iBAyBzD"}
@@ -3,7 +3,7 @@ const path = require("path");
3
3
  const fse = require("fs-extra");
4
4
  const _ = require("lodash");
5
5
  const strapiUtils = require("@strapi/utils");
6
- const _$1 = require("lodash/fp");
6
+ const fp = require("lodash/fp");
7
7
  const index = require("../domain/content-type/index.js");
8
8
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
9
9
  const fse__default = /* @__PURE__ */ _interopDefault(fse);
@@ -53,7 +53,7 @@ const validateContentTypesUnicity = (apis) => {
53
53
  });
54
54
  };
55
55
  const loadAPI = async (apiName, dir) => {
56
- const [index2, config, routes, controllers, services, policies, middlewares, contentTypes] = await Promise.all([
56
+ const [index2, config, routes, controllers, services, policies, middlewares, contentTypes] = (await Promise.all([
57
57
  loadIndex(dir),
58
58
  loadDir(path.join(dir, "config")),
59
59
  loadDir(path.join(dir, "routes")),
@@ -62,7 +62,7 @@ const loadAPI = async (apiName, dir) => {
62
62
  loadDir(path.join(dir, "policies")),
63
63
  loadDir(path.join(dir, "middlewares")),
64
64
  loadContentTypes(apiName, path.join(dir, "content-types"))
65
- ]);
65
+ ])).map((result) => result?.result);
66
66
  return {
67
67
  ...index2 || {},
68
68
  config: config || {},
@@ -90,8 +90,8 @@ const loadContentTypes = async (apiName, dir) => {
90
90
  continue;
91
91
  }
92
92
  const contentTypeName = normalizeName(fd.name);
93
- const loadedContentType = await loadDir(path.join(dir, fd.name));
94
- if (_$1.isEmpty(loadedContentType) || _$1.isEmpty(loadedContentType.schema)) {
93
+ const loadedContentType = (await loadDir(path.join(dir, fd.name)))?.result;
94
+ if (fp.isEmpty(loadedContentType) || fp.isEmpty(loadedContentType.schema)) {
95
95
  throw new Error(`Could not load content type found at ${dir}`);
96
96
  }
97
97
  const contentType = {
@@ -105,7 +105,7 @@ const loadContentTypes = async (apiName, dir) => {
105
105
  });
106
106
  contentTypes[normalizeName(contentTypeName)] = contentType;
107
107
  }
108
- return contentTypes;
108
+ return { result: contentTypes };
109
109
  };
110
110
  const loadDir = async (dir) => {
111
111
  if (!await fse__default.default.pathExists(dir)) {
@@ -118,19 +118,19 @@ const loadDir = async (dir) => {
118
118
  continue;
119
119
  }
120
120
  const key = path.basename(fd.name, path.extname(fd.name));
121
- root[normalizeName(key)] = await loadFile(path.join(dir, fd.name));
121
+ root[normalizeName(key)] = (await loadFile(path.join(dir, fd.name))).result;
122
122
  }
123
- return root;
123
+ return { result: root };
124
124
  };
125
- const loadFile = (file) => {
125
+ const loadFile = async (file) => {
126
126
  const ext = path.extname(file);
127
127
  switch (ext) {
128
128
  case ".js":
129
- return strapiUtils.importDefault(file);
129
+ return { result: strapiUtils.importDefault(file) };
130
130
  case ".json":
131
- return fse__default.default.readJSON(file);
131
+ return { result: await fse__default.default.readJSON(file) };
132
132
  default:
133
- return {};
133
+ return { result: {} };
134
134
  }
135
135
  };
136
136
  module.exports = loadAPIs;
@@ -1 +1 @@
1
- {"version":3,"file":"apis.js","sources":["../../src/loaders/apis.ts"],"sourcesContent":["import { join, extname, basename } from 'path';\nimport fse, { existsSync } from 'fs-extra';\nimport _ from 'lodash';\nimport { strings, importDefault } from '@strapi/utils';\nimport { isEmpty } from 'lodash/fp';\nimport type { Core, Struct } from '@strapi/types';\nimport { getGlobalId, type ContentTypeDefinition } from '../domain/content-type';\n\ninterface API {\n bootstrap: () => void | Promise<void>;\n destroy: () => void | Promise<void>;\n register: () => void | Promise<void>;\n config: Record<string, unknown>;\n routes: Record<string, Core.Router>;\n controllers: Record<string, Core.Controller>;\n services: Record<string, Core.Service>;\n policies: Record<string, Core.Policy>;\n middlewares: Record<string, Core.Middleware>;\n contentTypes: Record<string, { schema: Struct.ContentTypeSchema }>;\n}\n\ninterface APIs {\n [key: string]: API;\n}\n\nconst DEFAULT_CONTENT_TYPE = {\n schema: {},\n actions: {},\n lifecycles: {},\n};\n\n// to handle names with numbers in it we first check if it is already in kebabCase\nconst normalizeName = (name: string) => (strings.isKebabCase(name) ? name : _.kebabCase(name));\n\nconst isDirectory = (fd: fse.Dirent) => fd.isDirectory();\nconst isDotFile = (fd: fse.Dirent) => fd.name.startsWith('.');\n\nexport default async function loadAPIs(strapi: Core.Strapi) {\n if (!existsSync(strapi.dirs.dist.api)) {\n return;\n }\n\n const apisFDs = await (await fse.readdir(strapi.dirs.dist.api, { withFileTypes: true }))\n .filter(isDirectory)\n .filter(_.negate(isDotFile));\n\n const apis: APIs = {};\n\n // only load folders\n for (const apiFD of apisFDs) {\n const apiName = normalizeName(apiFD.name);\n const api = await loadAPI(apiName, join(strapi.dirs.dist.api, apiFD.name));\n\n apis[apiName] = api;\n }\n\n validateContentTypesUnicity(apis);\n\n for (const apiName of Object.keys(apis)) {\n strapi.get('apis').add(apiName, apis[apiName]);\n }\n}\n\nconst validateContentTypesUnicity = (apis: APIs) => {\n const allApisSchemas = Object.values(apis).flatMap((api) => Object.values(api.contentTypes));\n\n const names: string[] = [];\n allApisSchemas.forEach(({ schema }) => {\n if (schema.info.singularName) {\n const singularName = _.kebabCase(schema.info.singularName);\n if (names.includes(singularName)) {\n throw new Error(`The singular name \"${schema.info.singularName}\" should be unique`);\n }\n names.push(singularName);\n }\n\n if (schema.info.pluralName) {\n const pluralName = _.kebabCase(schema.info.pluralName);\n if (names.includes(pluralName)) {\n throw new Error(`The plural name \"${schema.info.pluralName}\" should be unique`);\n }\n names.push(pluralName);\n }\n });\n};\n\nconst loadAPI = async (apiName: string, dir: string) => {\n const [index, config, routes, controllers, services, policies, middlewares, contentTypes] =\n await Promise.all([\n loadIndex(dir),\n loadDir(join(dir, 'config')),\n loadDir(join(dir, 'routes')),\n loadDir(join(dir, 'controllers')),\n loadDir(join(dir, 'services')),\n loadDir(join(dir, 'policies')),\n loadDir(join(dir, 'middlewares')),\n loadContentTypes(apiName, join(dir, 'content-types')),\n ]);\n\n return {\n ...(index || {}),\n config: config || {},\n routes: routes || [],\n controllers: controllers || {},\n services: services || {},\n policies: policies || {},\n middlewares: middlewares || {},\n contentTypes: contentTypes || {},\n };\n};\n\nconst loadIndex = async (dir: string) => {\n if (await fse.pathExists(join(dir, 'index.js'))) {\n return loadFile(join(dir, 'index.js'));\n }\n};\n\nconst loadContentTypes = async (apiName: string, dir: string) => {\n if (!(await fse.pathExists(dir))) {\n return;\n }\n\n const fds = await fse.readdir(dir, { withFileTypes: true });\n const contentTypes: API['contentTypes'] = {};\n\n // only load folders\n for (const fd of fds) {\n if (fd.isFile()) {\n continue;\n }\n\n const contentTypeName = normalizeName(fd.name);\n const loadedContentType = await loadDir(join(dir, fd.name));\n\n if (isEmpty(loadedContentType) || isEmpty(loadedContentType.schema)) {\n throw new Error(`Could not load content type found at ${dir}`);\n }\n\n const contentType = {\n ...DEFAULT_CONTENT_TYPE,\n ...loadedContentType,\n } as ContentTypeDefinition;\n\n Object.assign(contentType.schema, {\n apiName,\n collectionName: contentType.schema.collectionName || contentType.schema.info.singularName,\n globalId: getGlobalId(contentType.schema),\n });\n\n contentTypes[normalizeName(contentTypeName)] = contentType;\n }\n\n return contentTypes;\n};\n\nconst loadDir = async (dir: string) => {\n if (!(await fse.pathExists(dir))) {\n return;\n }\n\n const fds = await fse.readdir(dir, { withFileTypes: true });\n\n const root: Record<string, unknown> = {};\n for (const fd of fds) {\n if (!fd.isFile() || extname(fd.name) === '.map') {\n continue;\n }\n\n const key = basename(fd.name, extname(fd.name));\n\n root[normalizeName(key)] = await loadFile(join(dir, fd.name));\n }\n\n return root;\n};\n\nconst loadFile = (file: string) => {\n const ext = extname(file);\n\n switch (ext) {\n case '.js':\n return importDefault(file);\n case '.json':\n return fse.readJSON(file);\n default:\n return {};\n }\n};\n"],"names":["strings","_","existsSync","fse","join","index","isEmpty","getGlobalId","extname","basename","importDefault"],"mappings":";;;;;;;;;;AAyBA,MAA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,UAAM,MAAMC,KAAS,SAAA,GAAG,MAAMD,KAAAA,QAAQ,GAAG,IAAI,CAAC;AAEzC,SAAA,cAAc,GAAG,CAAC,IAAI,MAAM,SAASJ,KAAK,KAAA,KAAK,GAAG,IAAI,CAAC;AAAA,EAC9D;AAEO,SAAA;AACT;AAEA,MAAM,WAAW,CAAC,SAAiB;AAC3B,QAAA,MAAMI,aAAQ,IAAI;AAExB,UAAQ,KAAK;AAAA,IACX,KAAK;AACH,aAAOE,YAAAA,cAAc,IAAI;AAAA,IAC3B,KAAK;AACI,aAAAP,aAAA,QAAI,SAAS,IAAI;AAAA,IAC1B;AACE,aAAO;EACX;AACF;;"}
1
+ {"version":3,"file":"apis.js","sources":["../../src/loaders/apis.ts"],"sourcesContent":["import { join, extname, basename } from 'path';\nimport fse, { existsSync } from 'fs-extra';\nimport _ from 'lodash';\nimport { strings, importDefault } from '@strapi/utils';\nimport { isEmpty } from 'lodash/fp';\nimport type { Core, Struct } from '@strapi/types';\nimport { getGlobalId, type ContentTypeDefinition } from '../domain/content-type';\n\ninterface API {\n bootstrap: () => void | Promise<void>;\n destroy: () => void | Promise<void>;\n register: () => void | Promise<void>;\n config: Record<string, unknown>;\n routes: Record<string, Core.Router>;\n controllers: Record<string, Core.Controller>;\n services: Record<string, Core.Service>;\n policies: Record<string, Core.Policy>;\n middlewares: Record<string, Core.Middleware>;\n contentTypes: Record<string, { schema: Struct.ContentTypeSchema }>;\n}\n\ninterface APIs {\n [key: string]: API;\n}\n\nconst DEFAULT_CONTENT_TYPE = {\n schema: {},\n actions: {},\n lifecycles: {},\n};\n\n// to handle names with numbers in it we first check if it is already in kebabCase\nconst normalizeName = (name: string) => (strings.isKebabCase(name) ? name : _.kebabCase(name));\n\nconst isDirectory = (fd: fse.Dirent) => fd.isDirectory();\nconst isDotFile = (fd: fse.Dirent) => fd.name.startsWith('.');\n\nexport default async function loadAPIs(strapi: Core.Strapi) {\n if (!existsSync(strapi.dirs.dist.api)) {\n return;\n }\n\n const apisFDs = await (await fse.readdir(strapi.dirs.dist.api, { withFileTypes: true }))\n .filter(isDirectory)\n .filter(_.negate(isDotFile));\n\n const apis: APIs = {};\n\n // only load folders\n for (const apiFD of apisFDs) {\n const apiName = normalizeName(apiFD.name);\n const api = await loadAPI(apiName, join(strapi.dirs.dist.api, apiFD.name));\n\n // @ts-expect-error TODO verify that it's a valid api, not missing bootstrap, register, and destroy\n apis[apiName] = api;\n }\n\n validateContentTypesUnicity(apis);\n\n for (const apiName of Object.keys(apis)) {\n strapi.get('apis').add(apiName, apis[apiName]);\n }\n}\n\nconst validateContentTypesUnicity = (apis: APIs) => {\n const allApisSchemas = Object.values(apis).flatMap((api) => Object.values(api.contentTypes));\n\n const names: string[] = [];\n allApisSchemas.forEach(({ schema }) => {\n if (schema.info.singularName) {\n const singularName = _.kebabCase(schema.info.singularName);\n if (names.includes(singularName)) {\n throw new Error(`The singular name \"${schema.info.singularName}\" should be unique`);\n }\n names.push(singularName);\n }\n\n if (schema.info.pluralName) {\n const pluralName = _.kebabCase(schema.info.pluralName);\n if (names.includes(pluralName)) {\n throw new Error(`The plural name \"${schema.info.pluralName}\" should be unique`);\n }\n names.push(pluralName);\n }\n });\n};\n\nconst loadAPI = async (apiName: string, dir: string) => {\n const [index, config, routes, controllers, services, policies, middlewares, contentTypes] = (\n await Promise.all([\n loadIndex(dir),\n loadDir(join(dir, 'config')),\n loadDir(join(dir, 'routes')),\n loadDir(join(dir, 'controllers')),\n loadDir(join(dir, 'services')),\n loadDir(join(dir, 'policies')),\n loadDir(join(dir, 'middlewares')),\n loadContentTypes(apiName, join(dir, 'content-types')),\n ])\n ).map((result) => result?.result);\n\n return {\n ...(index || {}),\n config: config || {},\n routes: routes || [],\n controllers: controllers || {},\n services: services || {},\n policies: policies || {},\n middlewares: middlewares || {},\n contentTypes: contentTypes || {},\n };\n};\n\nconst loadIndex = async (dir: string) => {\n if (await fse.pathExists(join(dir, 'index.js'))) {\n return loadFile(join(dir, 'index.js'));\n }\n};\n\n// because this is async and its contents are dynamic, we must return it within an object to avoid a property called `then` being interpreted as a Promise\nconst loadContentTypes = async (apiName: string, dir: string) => {\n if (!(await fse.pathExists(dir))) {\n return;\n }\n\n const fds = await fse.readdir(dir, { withFileTypes: true });\n const contentTypes: API['contentTypes'] = {};\n\n // only load folders\n for (const fd of fds) {\n if (fd.isFile()) {\n continue;\n }\n\n const contentTypeName = normalizeName(fd.name);\n const loadedContentType = (await loadDir(join(dir, fd.name)))?.result;\n\n if (isEmpty(loadedContentType) || isEmpty(loadedContentType.schema)) {\n throw new Error(`Could not load content type found at ${dir}`);\n }\n\n const contentType = {\n ...DEFAULT_CONTENT_TYPE,\n ...loadedContentType,\n } as ContentTypeDefinition;\n\n Object.assign(contentType.schema, {\n apiName,\n collectionName: contentType.schema.collectionName || contentType.schema.info.singularName,\n globalId: getGlobalId(contentType.schema),\n });\n\n contentTypes[normalizeName(contentTypeName)] = contentType;\n }\n\n return { result: contentTypes };\n};\n\n// because this is async and its contents are dynamic, we must return it within an object to avoid a property called `then` being interpreted as a Promise\nconst loadDir = async (dir: string) => {\n if (!(await fse.pathExists(dir))) {\n return;\n }\n\n const fds = await fse.readdir(dir, { withFileTypes: true });\n\n const root: Record<string, unknown> = {};\n for (const fd of fds) {\n if (!fd.isFile() || extname(fd.name) === '.map') {\n continue;\n }\n\n const key = basename(fd.name, extname(fd.name));\n\n root[normalizeName(key)] = (await loadFile(join(dir, fd.name))).result;\n }\n\n return { result: root };\n};\n\n// because this is async and its contents are dynamic, we must return it as an array to avoid a property called `then` being interpreted as a Promise\nconst loadFile = async (file: string): Promise<{ result: unknown }> => {\n const ext = extname(file);\n\n switch (ext) {\n case '.js':\n return { result: importDefault(file) };\n case '.json':\n return { result: await fse.readJSON(file) };\n default:\n return { result: {} };\n }\n};\n"],"names":["strings","_","existsSync","fse","join","index","isEmpty","getGlobalId","extname","basename","importDefault"],"mappings":";;;;;;;;;;AAyBA,MAAM,uBAAuB;AAAA,EAC3B,QAAQ,CA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AC/C;AAAA,IACF;AAEA,UAAM,MAAMC,KAAS,SAAA,GAAG,MAAMD,KAAAA,QAAQ,GAAG,IAAI,CAAC;AAEzC,SAAA,cAAc,GAAG,CAAC,KAAK,MAAM,SAASJ,KAAA,KAAK,KAAK,GAAG,IAAI,CAAC,GAAG;AAAA,EAClE;AAEO,SAAA,EAAE,QAAQ;AACnB;AAGA,MAAM,WAAW,OAAO,SAA+C;AAC/D,QAAA,MAAMI,aAAQ,IAAI;AAExB,UAAQ,KAAK;AAAA,IACX,KAAK;AACH,aAAO,EAAE,QAAQE,0BAAc,IAAI,EAAE;AAAA,IACvC,KAAK;AACH,aAAO,EAAE,QAAQ,MAAMP,aAAAA,QAAI,SAAS,IAAI,EAAE;AAAA,IAC5C;AACS,aAAA,EAAE,QAAQ,CAAA;EACrB;AACF;;"}
@@ -49,7 +49,7 @@ const validateContentTypesUnicity = (apis) => {
49
49
  });
50
50
  };
51
51
  const loadAPI = async (apiName, dir) => {
52
- const [index, config, routes, controllers, services, policies, middlewares, contentTypes] = await Promise.all([
52
+ const [index, config, routes, controllers, services, policies, middlewares, contentTypes] = (await Promise.all([
53
53
  loadIndex(dir),
54
54
  loadDir(join(dir, "config")),
55
55
  loadDir(join(dir, "routes")),
@@ -58,7 +58,7 @@ const loadAPI = async (apiName, dir) => {
58
58
  loadDir(join(dir, "policies")),
59
59
  loadDir(join(dir, "middlewares")),
60
60
  loadContentTypes(apiName, join(dir, "content-types"))
61
- ]);
61
+ ])).map((result) => result?.result);
62
62
  return {
63
63
  ...index || {},
64
64
  config: config || {},
@@ -86,7 +86,7 @@ const loadContentTypes = async (apiName, dir) => {
86
86
  continue;
87
87
  }
88
88
  const contentTypeName = normalizeName(fd.name);
89
- const loadedContentType = await loadDir(join(dir, fd.name));
89
+ const loadedContentType = (await loadDir(join(dir, fd.name)))?.result;
90
90
  if (isEmpty(loadedContentType) || isEmpty(loadedContentType.schema)) {
91
91
  throw new Error(`Could not load content type found at ${dir}`);
92
92
  }
@@ -101,7 +101,7 @@ const loadContentTypes = async (apiName, dir) => {
101
101
  });
102
102
  contentTypes[normalizeName(contentTypeName)] = contentType;
103
103
  }
104
- return contentTypes;
104
+ return { result: contentTypes };
105
105
  };
106
106
  const loadDir = async (dir) => {
107
107
  if (!await fse.pathExists(dir)) {
@@ -114,19 +114,19 @@ const loadDir = async (dir) => {
114
114
  continue;
115
115
  }
116
116
  const key = basename(fd.name, extname(fd.name));
117
- root[normalizeName(key)] = await loadFile(join(dir, fd.name));
117
+ root[normalizeName(key)] = (await loadFile(join(dir, fd.name))).result;
118
118
  }
119
- return root;
119
+ return { result: root };
120
120
  };
121
- const loadFile = (file) => {
121
+ const loadFile = async (file) => {
122
122
  const ext = extname(file);
123
123
  switch (ext) {
124
124
  case ".js":
125
- return importDefault(file);
125
+ return { result: importDefault(file) };
126
126
  case ".json":
127
- return fse.readJSON(file);
127
+ return { result: await fse.readJSON(file) };
128
128
  default:
129
- return {};
129
+ return { result: {} };
130
130
  }
131
131
  };
132
132
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"apis.mjs","sources":["../../src/loaders/apis.ts"],"sourcesContent":["import { join, extname, basename } from 'path';\nimport fse, { existsSync } from 'fs-extra';\nimport _ from 'lodash';\nimport { strings, importDefault } from '@strapi/utils';\nimport { isEmpty } from 'lodash/fp';\nimport type { Core, Struct } from '@strapi/types';\nimport { getGlobalId, type ContentTypeDefinition } from '../domain/content-type';\n\ninterface API {\n bootstrap: () => void | Promise<void>;\n destroy: () => void | Promise<void>;\n register: () => void | Promise<void>;\n config: Record<string, unknown>;\n routes: Record<string, Core.Router>;\n controllers: Record<string, Core.Controller>;\n services: Record<string, Core.Service>;\n policies: Record<string, Core.Policy>;\n middlewares: Record<string, Core.Middleware>;\n contentTypes: Record<string, { schema: Struct.ContentTypeSchema }>;\n}\n\ninterface APIs {\n [key: string]: API;\n}\n\nconst DEFAULT_CONTENT_TYPE = {\n schema: {},\n actions: {},\n lifecycles: {},\n};\n\n// to handle names with numbers in it we first check if it is already in kebabCase\nconst normalizeName = (name: string) => (strings.isKebabCase(name) ? name : _.kebabCase(name));\n\nconst isDirectory = (fd: fse.Dirent) => fd.isDirectory();\nconst isDotFile = (fd: fse.Dirent) => fd.name.startsWith('.');\n\nexport default async function loadAPIs(strapi: Core.Strapi) {\n if (!existsSync(strapi.dirs.dist.api)) {\n return;\n }\n\n const apisFDs = await (await fse.readdir(strapi.dirs.dist.api, { withFileTypes: true }))\n .filter(isDirectory)\n .filter(_.negate(isDotFile));\n\n const apis: APIs = {};\n\n // only load folders\n for (const apiFD of apisFDs) {\n const apiName = normalizeName(apiFD.name);\n const api = await loadAPI(apiName, join(strapi.dirs.dist.api, apiFD.name));\n\n apis[apiName] = api;\n }\n\n validateContentTypesUnicity(apis);\n\n for (const apiName of Object.keys(apis)) {\n strapi.get('apis').add(apiName, apis[apiName]);\n }\n}\n\nconst validateContentTypesUnicity = (apis: APIs) => {\n const allApisSchemas = Object.values(apis).flatMap((api) => Object.values(api.contentTypes));\n\n const names: string[] = [];\n allApisSchemas.forEach(({ schema }) => {\n if (schema.info.singularName) {\n const singularName = _.kebabCase(schema.info.singularName);\n if (names.includes(singularName)) {\n throw new Error(`The singular name \"${schema.info.singularName}\" should be unique`);\n }\n names.push(singularName);\n }\n\n if (schema.info.pluralName) {\n const pluralName = _.kebabCase(schema.info.pluralName);\n if (names.includes(pluralName)) {\n throw new Error(`The plural name \"${schema.info.pluralName}\" should be unique`);\n }\n names.push(pluralName);\n }\n });\n};\n\nconst loadAPI = async (apiName: string, dir: string) => {\n const [index, config, routes, controllers, services, policies, middlewares, contentTypes] =\n await Promise.all([\n loadIndex(dir),\n loadDir(join(dir, 'config')),\n loadDir(join(dir, 'routes')),\n loadDir(join(dir, 'controllers')),\n loadDir(join(dir, 'services')),\n loadDir(join(dir, 'policies')),\n loadDir(join(dir, 'middlewares')),\n loadContentTypes(apiName, join(dir, 'content-types')),\n ]);\n\n return {\n ...(index || {}),\n config: config || {},\n routes: routes || [],\n controllers: controllers || {},\n services: services || {},\n policies: policies || {},\n middlewares: middlewares || {},\n contentTypes: contentTypes || {},\n };\n};\n\nconst loadIndex = async (dir: string) => {\n if (await fse.pathExists(join(dir, 'index.js'))) {\n return loadFile(join(dir, 'index.js'));\n }\n};\n\nconst loadContentTypes = async (apiName: string, dir: string) => {\n if (!(await fse.pathExists(dir))) {\n return;\n }\n\n const fds = await fse.readdir(dir, { withFileTypes: true });\n const contentTypes: API['contentTypes'] = {};\n\n // only load folders\n for (const fd of fds) {\n if (fd.isFile()) {\n continue;\n }\n\n const contentTypeName = normalizeName(fd.name);\n const loadedContentType = await loadDir(join(dir, fd.name));\n\n if (isEmpty(loadedContentType) || isEmpty(loadedContentType.schema)) {\n throw new Error(`Could not load content type found at ${dir}`);\n }\n\n const contentType = {\n ...DEFAULT_CONTENT_TYPE,\n ...loadedContentType,\n } as ContentTypeDefinition;\n\n Object.assign(contentType.schema, {\n apiName,\n collectionName: contentType.schema.collectionName || contentType.schema.info.singularName,\n globalId: getGlobalId(contentType.schema),\n });\n\n contentTypes[normalizeName(contentTypeName)] = contentType;\n }\n\n return contentTypes;\n};\n\nconst loadDir = async (dir: string) => {\n if (!(await fse.pathExists(dir))) {\n return;\n }\n\n const fds = await fse.readdir(dir, { withFileTypes: true });\n\n const root: Record<string, unknown> = {};\n for (const fd of fds) {\n if (!fd.isFile() || extname(fd.name) === '.map') {\n continue;\n }\n\n const key = basename(fd.name, extname(fd.name));\n\n root[normalizeName(key)] = await loadFile(join(dir, fd.name));\n }\n\n return root;\n};\n\nconst loadFile = (file: string) => {\n const ext = extname(file);\n\n switch (ext) {\n case '.js':\n return importDefault(file);\n case '.json':\n return fse.readJSON(file);\n default:\n return {};\n }\n};\n"],"names":[],"mappings":";;;;;;AAyBA,MAAM,uBAAuB;AAAA,EAC3B,QAAQ,CAAC;AAAA,EACT,SAAS,CAAC;AAAA,EACV,YAAY,CAAC;AACf;AAGA,MAAM,gBAAgB,CAAC,SAAkB,QAAQ,YAA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aAAA,IAAI,SAAS,IAAI;AAAA,IAC1B;AACE,aAAO;EACX;AACF;"}
1
+ {"version":3,"file":"apis.mjs","sources":["../../src/loaders/apis.ts"],"sourcesContent":["import { join, extname, basename } from 'path';\nimport fse, { existsSync } from 'fs-extra';\nimport _ from 'lodash';\nimport { strings, importDefault } from '@strapi/utils';\nimport { isEmpty } from 'lodash/fp';\nimport type { Core, Struct } from '@strapi/types';\nimport { getGlobalId, type ContentTypeDefinition } from '../domain/content-type';\n\ninterface API {\n bootstrap: () => void | Promise<void>;\n destroy: () => void | Promise<void>;\n register: () => void | Promise<void>;\n config: Record<string, unknown>;\n routes: Record<string, Core.Router>;\n controllers: Record<string, Core.Controller>;\n services: Record<string, Core.Service>;\n policies: Record<string, Core.Policy>;\n middlewares: Record<string, Core.Middleware>;\n contentTypes: Record<string, { schema: Struct.ContentTypeSchema }>;\n}\n\ninterface APIs {\n [key: string]: API;\n}\n\nconst DEFAULT_CONTENT_TYPE = {\n schema: {},\n actions: {},\n lifecycles: {},\n};\n\n// to handle names with numbers in it we first check if it is already in kebabCase\nconst normalizeName = (name: string) => (strings.isKebabCase(name) ? name : _.kebabCase(name));\n\nconst isDirectory = (fd: fse.Dirent) => fd.isDirectory();\nconst isDotFile = (fd: fse.Dirent) => fd.name.startsWith('.');\n\nexport default async function loadAPIs(strapi: Core.Strapi) {\n if (!existsSync(strapi.dirs.dist.api)) {\n return;\n }\n\n const apisFDs = await (await fse.readdir(strapi.dirs.dist.api, { withFileTypes: true }))\n .filter(isDirectory)\n .filter(_.negate(isDotFile));\n\n const apis: APIs = {};\n\n // only load folders\n for (const apiFD of apisFDs) {\n const apiName = normalizeName(apiFD.name);\n const api = await loadAPI(apiName, join(strapi.dirs.dist.api, apiFD.name));\n\n // @ts-expect-error TODO verify that it's a valid api, not missing bootstrap, register, and destroy\n apis[apiName] = api;\n }\n\n validateContentTypesUnicity(apis);\n\n for (const apiName of Object.keys(apis)) {\n strapi.get('apis').add(apiName, apis[apiName]);\n }\n}\n\nconst validateContentTypesUnicity = (apis: APIs) => {\n const allApisSchemas = Object.values(apis).flatMap((api) => Object.values(api.contentTypes));\n\n const names: string[] = [];\n allApisSchemas.forEach(({ schema }) => {\n if (schema.info.singularName) {\n const singularName = _.kebabCase(schema.info.singularName);\n if (names.includes(singularName)) {\n throw new Error(`The singular name \"${schema.info.singularName}\" should be unique`);\n }\n names.push(singularName);\n }\n\n if (schema.info.pluralName) {\n const pluralName = _.kebabCase(schema.info.pluralName);\n if (names.includes(pluralName)) {\n throw new Error(`The plural name \"${schema.info.pluralName}\" should be unique`);\n }\n names.push(pluralName);\n }\n });\n};\n\nconst loadAPI = async (apiName: string, dir: string) => {\n const [index, config, routes, controllers, services, policies, middlewares, contentTypes] = (\n await Promise.all([\n loadIndex(dir),\n loadDir(join(dir, 'config')),\n loadDir(join(dir, 'routes')),\n loadDir(join(dir, 'controllers')),\n loadDir(join(dir, 'services')),\n loadDir(join(dir, 'policies')),\n loadDir(join(dir, 'middlewares')),\n loadContentTypes(apiName, join(dir, 'content-types')),\n ])\n ).map((result) => result?.result);\n\n return {\n ...(index || {}),\n config: config || {},\n routes: routes || [],\n controllers: controllers || {},\n services: services || {},\n policies: policies || {},\n middlewares: middlewares || {},\n contentTypes: contentTypes || {},\n };\n};\n\nconst loadIndex = async (dir: string) => {\n if (await fse.pathExists(join(dir, 'index.js'))) {\n return loadFile(join(dir, 'index.js'));\n }\n};\n\n// because this is async and its contents are dynamic, we must return it within an object to avoid a property called `then` being interpreted as a Promise\nconst loadContentTypes = async (apiName: string, dir: string) => {\n if (!(await fse.pathExists(dir))) {\n return;\n }\n\n const fds = await fse.readdir(dir, { withFileTypes: true });\n const contentTypes: API['contentTypes'] = {};\n\n // only load folders\n for (const fd of fds) {\n if (fd.isFile()) {\n continue;\n }\n\n const contentTypeName = normalizeName(fd.name);\n const loadedContentType = (await loadDir(join(dir, fd.name)))?.result;\n\n if (isEmpty(loadedContentType) || isEmpty(loadedContentType.schema)) {\n throw new Error(`Could not load content type found at ${dir}`);\n }\n\n const contentType = {\n ...DEFAULT_CONTENT_TYPE,\n ...loadedContentType,\n } as ContentTypeDefinition;\n\n Object.assign(contentType.schema, {\n apiName,\n collectionName: contentType.schema.collectionName || contentType.schema.info.singularName,\n globalId: getGlobalId(contentType.schema),\n });\n\n contentTypes[normalizeName(contentTypeName)] = contentType;\n }\n\n return { result: contentTypes };\n};\n\n// because this is async and its contents are dynamic, we must return it within an object to avoid a property called `then` being interpreted as a Promise\nconst loadDir = async (dir: string) => {\n if (!(await fse.pathExists(dir))) {\n return;\n }\n\n const fds = await fse.readdir(dir, { withFileTypes: true });\n\n const root: Record<string, unknown> = {};\n for (const fd of fds) {\n if (!fd.isFile() || extname(fd.name) === '.map') {\n continue;\n }\n\n const key = basename(fd.name, extname(fd.name));\n\n root[normalizeName(key)] = (await loadFile(join(dir, fd.name))).result;\n }\n\n return { result: root };\n};\n\n// because this is async and its contents are dynamic, we must return it as an array to avoid a property called `then` being interpreted as a Promise\nconst loadFile = async (file: string): Promise<{ result: unknown }> => {\n const ext = extname(file);\n\n switch (ext) {\n case '.js':\n return { result: importDefault(file) };\n case '.json':\n return { result: await fse.readJSON(file) };\n default:\n return { result: {} };\n }\n};\n"],"names":[],"mappings":";;;;;;AAyBA,MAAM,uBAAuB;AAAA,EAC3B,QAAQ,CAAC;AAAA,EACT,SAAS,CAAC;AAAA,EACV,YAAY,CAAC;AACf;AAGA,MAAM,gBAAgB,CAAC,SAAkB,QAAQ,YAAY,IAAI,IAAI,OAAO,EAAE,UAAU,IAAI;AAE5F,MAAM,cAAc,CAAC,OAAmB,GAAG,YAAY;AACvD,MAAM,YAAY,CAAC,OAAmB,GAAG,KAAK,WAAW,GAAG;AAE5D,eAA8B,SAAS,QAAqB;AAC1D,MAAI,CAAC,WAAW,OAAO,KAAK,KAAK,GAAG,GAAG;AACrC;AAAA,EACF;AAEM,QAAA,UAAU,OAAO,MAAM,IAAI,QAAQ,OAAO,KAAK,KAAK,KAAK,E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E,IAAI,EAAE,MAAM,eAAe,CAAC;AAY1C,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,iBAY/D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAW1C,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,iBAW/D"}
@@ -6,7 +6,6 @@ const middlewares = require("./middlewares.js");
6
6
  const components = require("./components.js");
7
7
  const policies = require("./policies.js");
8
8
  const index = require("./plugins/index.js");
9
- const admin = require("./admin.js");
10
9
  const sanitizers = require("./sanitizers.js");
11
10
  const validators = require("./validators.js");
12
11
  async function loadApplicationContext(strapi) {
@@ -15,7 +14,6 @@ async function loadApplicationContext(strapi) {
15
14
  sanitizers(strapi),
16
15
  validators(strapi),
17
16
  index(strapi),
18
- admin(strapi),
19
17
  apis(strapi),
20
18
  components(strapi),
21
19
  middlewares(strapi),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/loaders/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport loadSrcIndex from './src-index';\nimport loadAPIs from './apis';\nimport loadMiddlewares from './middlewares';\nimport loadComponents from './components';\nimport loadPolicies from './policies';\nimport loadPlugins from './plugins';\nimport loadAdmin from './admin';\nimport loadSanitizers from './sanitizers';\nimport loadValidators from './validators';\n\nexport async function loadApplicationContext(strapi: Core.Strapi) {\n await Promise.all([\n loadSrcIndex(strapi),\n loadSanitizers(strapi),\n loadValidators(strapi),\n loadPlugins(strapi),\n loadAdmin(strapi),\n loadAPIs(strapi),\n loadComponents(strapi),\n loadMiddlewares(strapi),\n loadPolicies(strapi),\n ]);\n}\n"],"names":["loadSrcIndex","loadSanitizers","loadValidators","loadPlugins","loadAdmin","loadAPIs","loadComponents","loadMiddlewares","loadPolicies"],"mappings":";;;;;;;;;;;AAYA,eAAsB,uBAAuB,QAAqB;AAChE,QAAM,QAAQ,IAAI;AAAA,IAChBA,SAAa,MAAM;AAAA,IACnBC,WAAe,MAAM;AAAA,IACrBC,WAAe,MAAM;AAAA,IACrBC,MAAY,MAAM;AAAA,IAClBC,MAAU,MAAM;AAAA,IAChBC,KAAS,MAAM;AAAA,IACfC,WAAe,MAAM;AAAA,IACrBC,YAAgB,MAAM;AAAA,IACtBC,SAAa,MAAM;AAAA,EAAA,CACpB;AACH;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/loaders/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport loadSrcIndex from './src-index';\nimport loadAPIs from './apis';\nimport loadMiddlewares from './middlewares';\nimport loadComponents from './components';\nimport loadPolicies from './policies';\nimport loadPlugins from './plugins';\nimport loadSanitizers from './sanitizers';\nimport loadValidators from './validators';\n\nexport async function loadApplicationContext(strapi: Core.Strapi) {\n await Promise.all([\n loadSrcIndex(strapi),\n loadSanitizers(strapi),\n loadValidators(strapi),\n loadPlugins(strapi),\n loadAPIs(strapi),\n loadComponents(strapi),\n loadMiddlewares(strapi),\n loadPolicies(strapi),\n ]);\n}\n"],"names":["loadSrcIndex","loadSanitizers","loadValidators","loadPlugins","loadAPIs","loadComponents","loadMiddlewares","loadPolicies"],"mappings":";;;;;;;;;;AAWA,eAAsB,uBAAuB,QAAqB;AAChE,QAAM,QAAQ,IAAI;AAAA,IAChBA,SAAa,MAAM;AAAA,IACnBC,WAAe,MAAM;AAAA,IACrBC,WAAe,MAAM;AAAA,IACrBC,MAAY,MAAM;AAAA,IAClBC,KAAS,MAAM;AAAA,IACfC,WAAe,MAAM;AAAA,IACrBC,YAAgB,MAAM;AAAA,IACtBC,SAAa,MAAM;AAAA,EAAA,CACpB;AACH;;"}
@@ -4,7 +4,6 @@ import loadMiddlewares from "./middlewares.mjs";
4
4
  import loadComponents from "./components.mjs";
5
5
  import loadPolicies from "./policies.mjs";
6
6
  import loadPlugins from "./plugins/index.mjs";
7
- import loadAdmin from "./admin.mjs";
8
7
  import loadSanitizers from "./sanitizers.mjs";
9
8
  import loadValidators from "./validators.mjs";
10
9
  async function loadApplicationContext(strapi) {
@@ -13,7 +12,6 @@ async function loadApplicationContext(strapi) {
13
12
  loadSanitizers(strapi),
14
13
  loadValidators(strapi),
15
14
  loadPlugins(strapi),
16
- loadAdmin(strapi),
17
15
  loadAPIs(strapi),
18
16
  loadComponents(strapi),
19
17
  loadMiddlewares(strapi),
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/loaders/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport loadSrcIndex from './src-index';\nimport loadAPIs from './apis';\nimport loadMiddlewares from './middlewares';\nimport loadComponents from './components';\nimport loadPolicies from './policies';\nimport loadPlugins from './plugins';\nimport loadAdmin from './admin';\nimport loadSanitizers from './sanitizers';\nimport loadValidators from './validators';\n\nexport async function loadApplicationContext(strapi: Core.Strapi) {\n await Promise.all([\n loadSrcIndex(strapi),\n loadSanitizers(strapi),\n loadValidators(strapi),\n loadPlugins(strapi),\n loadAdmin(strapi),\n loadAPIs(strapi),\n loadComponents(strapi),\n loadMiddlewares(strapi),\n loadPolicies(strapi),\n ]);\n}\n"],"names":[],"mappings":";;;;;;;;;AAYA,eAAsB,uBAAuB,QAAqB;AAChE,QAAM,QAAQ,IAAI;AAAA,IAChB,aAAa,MAAM;AAAA,IACnB,eAAe,MAAM;AAAA,IACrB,eAAe,MAAM;AAAA,IACrB,YAAY,MAAM;AAAA,IAClB,UAAU,MAAM;AAAA,IAChB,SAAS,MAAM;AAAA,IACf,eAAe,MAAM;AAAA,IACrB,gBAAgB,MAAM;AAAA,IACtB,aAAa,MAAM;AAAA,EAAA,CACpB;AACH;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/loaders/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport loadSrcIndex from './src-index';\nimport loadAPIs from './apis';\nimport loadMiddlewares from './middlewares';\nimport loadComponents from './components';\nimport loadPolicies from './policies';\nimport loadPlugins from './plugins';\nimport loadSanitizers from './sanitizers';\nimport loadValidators from './validators';\n\nexport async function loadApplicationContext(strapi: Core.Strapi) {\n await Promise.all([\n loadSrcIndex(strapi),\n loadSanitizers(strapi),\n loadValidators(strapi),\n loadPlugins(strapi),\n loadAPIs(strapi),\n loadComponents(strapi),\n loadMiddlewares(strapi),\n loadPolicies(strapi),\n ]);\n}\n"],"names":[],"mappings":";;;;;;;;AAWA,eAAsB,uBAAuB,QAAqB;AAChE,QAAM,QAAQ,IAAI;AAAA,IAChB,aAAa,MAAM;AAAA,IACnB,eAAe,MAAM;AAAA,IACrB,eAAe,MAAM;AAAA,IACrB,YAAY,MAAM;AAAA,IAClB,SAAS,MAAM;AAAA,IACf,eAAe,MAAM;AAAA,IACrB,gBAAgB,MAAM;AAAA,IACtB,aAAa,MAAM;AAAA,EAAA,CACpB;AACH;"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-enabled-plugins.d.ts","sourceRoot":"","sources":["../../../src/loaders/plugins/get-enabled-plugins.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AA6E1C,eAAO,MAAM,iBAAiB,WAAkB,KAAK,MAAM;;kBA2E1D,CAAC"}
1
+ {"version":3,"file":"get-enabled-plugins.d.ts","sourceRoot":"","sources":["../../../src/loaders/plugins/get-enabled-plugins.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAkF1C,eAAO,MAAM,iBAAiB,WAAkB,KAAK,MAAM;;kBAoF1D,CAAC"}
@@ -1,22 +1,45 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
2
24
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
25
  const path = require("path");
4
26
  const fs = require("fs");
5
27
  const _ = require("lodash");
6
- const _$1 = require("lodash/fp");
28
+ const fp = require("lodash/fp");
7
29
  const strapiUtils = require("@strapi/utils");
8
30
  const getUserPluginsConfig = require("./get-user-plugins-config.js");
9
31
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
32
  const ___default = /* @__PURE__ */ _interopDefault(_);
11
33
  const INTERNAL_PLUGINS = [
12
- "@strapi/plugin-content-manager",
13
- "@strapi/plugin-content-type-builder",
14
- "@strapi/plugin-email",
15
- "@strapi/plugin-upload",
16
- "@strapi/plugin-i18n",
17
- "@strapi/content-releases"
34
+ "@strapi/content-manager",
35
+ "@strapi/content-type-builder",
36
+ "@strapi/email",
37
+ "@strapi/upload",
38
+ "@strapi/i18n",
39
+ "@strapi/content-releases",
40
+ "@strapi/review-workflows"
18
41
  ];
19
- const isStrapiPlugin = (info) => _$1.get("strapi.kind", info) === "plugin";
42
+ const isStrapiPlugin = (info) => fp.get("strapi.kind", info) === "plugin";
20
43
  const validatePluginName = (pluginName) => {
21
44
  if (!strapiUtils.strings.isKebabCase(pluginName)) {
22
45
  throw new Error(`Plugin name "${pluginName}" is not in kebab (an-example-of-kebab-case)`);
@@ -51,11 +74,15 @@ const getEnabledPlugins = async (strapi2, { client } = { client: false }) => {
51
74
  const internalPlugins = {};
52
75
  for (const dep of INTERNAL_PLUGINS) {
53
76
  const packagePath = path.join(dep, "package.json");
54
- const packageInfo = require(packagePath);
77
+ const packageModulePath = require.resolve(packagePath, {
78
+ paths: [require.resolve("@strapi/strapi/package.json"), process.cwd()]
79
+ });
80
+ const packageInfo = require(packageModulePath);
55
81
  validatePluginName(packageInfo.strapi.name);
56
82
  internalPlugins[packageInfo.strapi.name] = {
57
83
  ...toDetailedDeclaration({ enabled: true, resolve: packagePath, isModule: client }),
58
- info: packageInfo.strapi
84
+ info: packageInfo.strapi,
85
+ packageInfo
59
86
  };
60
87
  }
61
88
  const installedPlugins = {};
@@ -75,7 +102,8 @@ const getEnabledPlugins = async (strapi2, { client } = { client: false }) => {
75
102
  info: {
76
103
  ...packageInfo.strapi,
77
104
  packageName: packageInfo.name
78
- }
105
+ },
106
+ packageInfo
79
107
  };
80
108
  }
81
109
  }
@@ -93,18 +121,19 @@ const getEnabledPlugins = async (strapi2, { client } = { client: false }) => {
93
121
  const packageInfo = require(packagePath);
94
122
  if (isStrapiPlugin(packageInfo)) {
95
123
  declaredPlugins[pluginName].info = packageInfo.strapi || {};
124
+ declaredPlugins[pluginName].packageInfo = packageInfo;
96
125
  }
97
126
  }
98
127
  });
99
- const declaredPluginsResolves = _$1.map(_$1.prop("pathToPlugin"), declaredPlugins);
100
- const installedPluginsNotAlreadyUsed = _$1.pickBy(
128
+ const declaredPluginsResolves = fp.map(fp.prop("pathToPlugin"), declaredPlugins);
129
+ const installedPluginsNotAlreadyUsed = fp.pickBy(
101
130
  (p) => !declaredPluginsResolves.includes(p.pathToPlugin),
102
131
  installedPlugins
103
132
  );
104
- const enabledPlugins = _$1.pipe(
105
- _$1.defaultsDeep(declaredPlugins),
106
- _$1.defaultsDeep(installedPluginsNotAlreadyUsed),
107
- _$1.pickBy((p) => p.enabled)
133
+ const enabledPlugins = fp.pipe(
134
+ fp.defaultsDeep(declaredPlugins),
135
+ fp.defaultsDeep(installedPluginsNotAlreadyUsed),
136
+ fp.pickBy((p) => p.enabled)
108
137
  )(internalPlugins);
109
138
  return enabledPlugins;
110
139
  };
@@ -1 +1 @@
1
- {"version":3,"file":"get-enabled-plugins.js","sources":["../../../src/loaders/plugins/get-enabled-plugins.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\nimport { dirname, join, resolve } from 'path';\nimport { statSync, existsSync } from 'fs';\nimport _ from 'lodash';\nimport { get, pickBy, defaultsDeep, map, prop, pipe } from 'lodash/fp';\nimport { strings } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\nimport { getUserPluginsConfig } from './get-user-plugins-config';\n\ninterface PluginMeta {\n enabled: boolean;\n pathToPlugin?: string;\n info: Record<string, unknown>;\n}\n\ntype PluginMetas = Record<string, PluginMeta>;\n\ninterface PluginInfo {\n name: string;\n kind: string;\n}\n\ninterface PluginDeclaration {\n enabled: boolean;\n resolve: string;\n isModule: boolean;\n}\n\n/**\n * otherwise known as \"core features\"\n */\nconst INTERNAL_PLUGINS = [\n '@strapi/plugin-content-manager',\n '@strapi/plugin-content-type-builder',\n '@strapi/plugin-email',\n '@strapi/plugin-upload',\n '@strapi/plugin-i18n',\n '@strapi/content-releases',\n];\n\nconst isStrapiPlugin = (info: PluginInfo) => get('strapi.kind', info) === 'plugin';\n\nconst validatePluginName = (pluginName: string) => {\n if (!strings.isKebabCase(pluginName)) {\n throw new Error(`Plugin name \"${pluginName}\" is not in kebab (an-example-of-kebab-case)`);\n }\n};\n\nconst toDetailedDeclaration = (declaration: boolean | PluginDeclaration) => {\n if (typeof declaration === 'boolean') {\n return { enabled: declaration };\n }\n\n const detailedDeclaration: { enabled: boolean; pathToPlugin?: string } = {\n enabled: declaration.enabled,\n };\n\n if (declaration?.resolve) {\n let pathToPlugin = '';\n\n if (declaration.isModule) {\n /**\n * we only want the node_module here, not the package.json\n */\n pathToPlugin = join(declaration.resolve, '..');\n } else {\n try {\n pathToPlugin = dirname(require.resolve(declaration.resolve));\n } catch (e) {\n pathToPlugin = resolve(strapi.dirs.app.root, declaration.resolve);\n\n if (!existsSync(pathToPlugin) || !statSync(pathToPlugin).isDirectory()) {\n throw new Error(`${declaration.resolve} couldn't be resolved`);\n }\n }\n }\n\n detailedDeclaration.pathToPlugin = pathToPlugin;\n }\n\n return detailedDeclaration;\n};\n\nexport const getEnabledPlugins = async (strapi: Core.Strapi, { client } = { client: false }) => {\n const internalPlugins: PluginMetas = {};\n\n for (const dep of INTERNAL_PLUGINS) {\n const packagePath = join(dep, 'package.json');\n const packageInfo = require(packagePath);\n\n validatePluginName(packageInfo.strapi.name);\n internalPlugins[packageInfo.strapi.name] = {\n ...toDetailedDeclaration({ enabled: true, resolve: packagePath, isModule: client }),\n info: packageInfo.strapi,\n };\n }\n\n const installedPlugins: PluginMetas = {};\n const dependencies = strapi.config.get('info.dependencies', {});\n\n for (const dep of Object.keys(dependencies)) {\n const packagePath = join(dep, 'package.json');\n let packageInfo;\n try {\n packageInfo = require(packagePath);\n } catch {\n continue;\n }\n\n if (isStrapiPlugin(packageInfo)) {\n validatePluginName(packageInfo.strapi.name);\n installedPlugins[packageInfo.strapi.name] = {\n ...toDetailedDeclaration({ enabled: true, resolve: packagePath, isModule: client }),\n info: {\n ...packageInfo.strapi,\n packageName: packageInfo.name,\n },\n };\n }\n }\n\n const declaredPlugins: PluginMetas = {};\n const userPluginsConfig = await getUserPluginsConfig();\n\n _.forEach(userPluginsConfig, (declaration, pluginName) => {\n validatePluginName(pluginName);\n\n declaredPlugins[pluginName] = {\n ...toDetailedDeclaration(declaration),\n info: {},\n };\n\n const { pathToPlugin } = declaredPlugins[pluginName];\n\n // for manually resolved plugins\n if (pathToPlugin) {\n const packagePath = join(pathToPlugin, 'package.json');\n const packageInfo = require(packagePath);\n\n if (isStrapiPlugin(packageInfo)) {\n declaredPlugins[pluginName].info = packageInfo.strapi || {};\n }\n }\n });\n\n const declaredPluginsResolves = map(prop('pathToPlugin'), declaredPlugins);\n const installedPluginsNotAlreadyUsed = pickBy(\n (p) => !declaredPluginsResolves.includes(p.pathToPlugin),\n installedPlugins\n );\n\n const enabledPlugins = pipe(\n defaultsDeep(declaredPlugins),\n defaultsDeep(installedPluginsNotAlreadyUsed),\n pickBy((p: PluginMeta) => p.enabled)\n )(internalPlugins);\n\n return enabledPlugins;\n};\n"],"names":["get","strings","join","dirname","resolve","existsSync","statSync","strapi","getUserPluginsConfig","_","map","prop","pickBy","pipe","defaultsDeep"],"mappings":";;;;;;;;;;AA+BA,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,iBAAiB,CAAC,SAAqBA,IAAAA,IAAI,eAAe,IAAI,MAAM;AAE1E,MAAM,qBAAqB,CAAC,eAAuB;AACjD,MAAI,CAACC,YAAA,QAAQ,YAAY,UAAU,GAAG;AACpC,UAAM,IAAI,MAAM,gBAAgB,UAAU,8CAA8C;AAAA,EAC1F;AACF;AAEA,MAAM,wBAAwB,CAAC,gBAA6C;AACtE,MAAA,OAAO,gBAAgB,WAAW;AAC7B,WAAA,EAAE,SAAS;EACpB;AAEA,QAAM,sBAAmE;AAAA,IACvE,SAAS,YAAY;AAAA,EAAA;AAGvB,MAAI,aAAa,SAAS;AACxB,QAAI,eAAe;AAEnB,QAAI,YAAY,UAAU;AAIT,qBAAAC,KAAAA,KAAK,YAAY,SAAS,IAAI;AAAA,IAAA,OACxC;AACD,UAAA;AACF,uBAAeC,KAAQ,QAAA,QAAQ,QAAQ,YAAY,OAAO,CAAC;AAAA,eACpD,GAAG;AACV,uBAAeC,KAAAA,QAAQ,OAAO,KAAK,IAAI,MAAM,YAAY,OAAO;AAE5D,YAAA,CAACC,cAAW,YAAY,KAAK,CAACC,GAAAA,SAAS,YAA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AAgB,UAAU,IAAI;AAAA,MAC5B,GAAG,sBAAsB,WAAW;AAAA,MACpC,MAAM,CAAC;AAAA,IAAA;AAGT,UAAM,EAAE,aAAA,IAAiB,gBAAgB,UAAU;AAGnD,QAAI,cAAc;AACV,YAAA,cAAcP,KAAAA,KAAK,cAAc,cAAc;AAC/C,YAAA,cAAc,QAAQ,WAAW;AAEnC,UAAA,eAAe,WAAW,GAAG;AAC/B,wBAAgB,UAAU,EAAE,OAAO,YAAY,UAAU,CAAA;AAAA,MAC3D;AAAA,IACF;AAAA,EAAA,CACD;AAED,QAAM,0BAA0BQ,IAAAA,IAAIC,IAAAA,KAAK,cAAc,GAAG,eAAe;AACzE,QAAM,iCAAiCC,IAAA;AAAA,IACrC,CAAC,MAAM,CAAC,wBAAwB,SAAS,EAAE,YAAY;AAAA,IACvD;AAAA,EAAA;AAGF,QAAM,iBAAiBC,IAAA;AAAA,IACrBC,IAAAA,aAAa,eAAe;AAAA,IAC5BA,IAAAA,aAAa,8BAA8B;AAAA,IAC3CF,IAAAA,OAAO,CAAC,MAAkB,EAAE,OAAO;AAAA,IACnC,eAAe;AAEV,SAAA;AACT;;"}
1
+ {"version":3,"file":"get-enabled-plugins.js","sources":["../../../src/loaders/plugins/get-enabled-plugins.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\nimport { dirname, join, resolve } from 'path';\nimport { statSync, existsSync } from 'fs';\nimport _ from 'lodash';\nimport { get, pickBy, defaultsDeep, map, prop, pipe } from 'lodash/fp';\nimport { strings } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\nimport { getUserPluginsConfig } from './get-user-plugins-config';\n\ninterface PluginMeta {\n enabled: boolean;\n pathToPlugin?: string;\n info: Record<string, unknown>;\n packageInfo?: Record<string, unknown>;\n}\n\ntype PluginMetas = Record<string, PluginMeta>;\n\ninterface PluginInfo {\n name: string;\n kind: string;\n}\n\ninterface PluginDeclaration {\n enabled: boolean;\n resolve: string;\n isModule: boolean;\n}\n\n/**\n * otherwise known as \"core features\"\n *\n * NOTE: These are excluded from the content manager plugin list, as they are always enabled.\n * See admin.ts server controller on the content-manager plugin for more details.\n */\nconst INTERNAL_PLUGINS = [\n '@strapi/content-manager',\n '@strapi/content-type-builder',\n '@strapi/email',\n '@strapi/upload',\n '@strapi/i18n',\n '@strapi/content-releases',\n '@strapi/review-workflows',\n];\n\nconst isStrapiPlugin = (info: PluginInfo) => get('strapi.kind', info) === 'plugin';\n\nconst validatePluginName = (pluginName: string) => {\n if (!strings.isKebabCase(pluginName)) {\n throw new Error(`Plugin name \"${pluginName}\" is not in kebab (an-example-of-kebab-case)`);\n }\n};\n\nconst toDetailedDeclaration = (declaration: boolean | PluginDeclaration) => {\n if (typeof declaration === 'boolean') {\n return { enabled: declaration };\n }\n\n const detailedDeclaration: { enabled: boolean; pathToPlugin?: string } = {\n enabled: declaration.enabled,\n };\n\n if (declaration?.resolve) {\n let pathToPlugin = '';\n\n if (declaration.isModule) {\n /**\n * we only want the node_module here, not the package.json\n */\n pathToPlugin = join(declaration.resolve, '..');\n } else {\n try {\n pathToPlugin = dirname(require.resolve(declaration.resolve));\n } catch (e) {\n pathToPlugin = resolve(strapi.dirs.app.root, declaration.resolve);\n\n if (!existsSync(pathToPlugin) || !statSync(pathToPlugin).isDirectory()) {\n throw new Error(`${declaration.resolve} couldn't be resolved`);\n }\n }\n }\n\n detailedDeclaration.pathToPlugin = pathToPlugin;\n }\n\n return detailedDeclaration;\n};\n\nexport const getEnabledPlugins = async (strapi: Core.Strapi, { client } = { client: false }) => {\n const internalPlugins: PluginMetas = {};\n\n for (const dep of INTERNAL_PLUGINS) {\n const packagePath = join(dep, 'package.json');\n\n // NOTE: internal plugins should be resolved from the strapi package\n const packageModulePath = require.resolve(packagePath, {\n paths: [require.resolve('@strapi/strapi/package.json'), process.cwd()],\n });\n\n const packageInfo = require(packageModulePath);\n\n validatePluginName(packageInfo.strapi.name);\n internalPlugins[packageInfo.strapi.name] = {\n ...toDetailedDeclaration({ enabled: true, resolve: packagePath, isModule: client }),\n info: packageInfo.strapi,\n packageInfo,\n };\n }\n\n const installedPlugins: PluginMetas = {};\n const dependencies = strapi.config.get('info.dependencies', {});\n\n for (const dep of Object.keys(dependencies)) {\n const packagePath = join(dep, 'package.json');\n let packageInfo;\n try {\n packageInfo = require(packagePath);\n } catch {\n continue;\n }\n\n if (isStrapiPlugin(packageInfo)) {\n validatePluginName(packageInfo.strapi.name);\n installedPlugins[packageInfo.strapi.name] = {\n ...toDetailedDeclaration({ enabled: true, resolve: packagePath, isModule: client }),\n info: {\n ...packageInfo.strapi,\n packageName: packageInfo.name,\n },\n packageInfo,\n };\n }\n }\n\n const declaredPlugins: PluginMetas = {};\n const userPluginsConfig = await getUserPluginsConfig();\n\n _.forEach(userPluginsConfig, (declaration, pluginName) => {\n validatePluginName(pluginName);\n\n declaredPlugins[pluginName] = {\n ...toDetailedDeclaration(declaration),\n info: {},\n };\n\n const { pathToPlugin } = declaredPlugins[pluginName];\n\n // for manually resolved plugins\n if (pathToPlugin) {\n const packagePath = join(pathToPlugin, 'package.json');\n const packageInfo = require(packagePath);\n\n if (isStrapiPlugin(packageInfo)) {\n declaredPlugins[pluginName].info = packageInfo.strapi || {};\n declaredPlugins[pluginName].packageInfo = packageInfo;\n }\n }\n });\n\n const declaredPluginsResolves = map(prop('pathToPlugin'), declaredPlugins);\n const installedPluginsNotAlreadyUsed = pickBy(\n (p) => !declaredPluginsResolves.includes(p.pathToPlugin),\n installedPlugins\n );\n\n const enabledPlugins = pipe(\n defaultsDeep(declaredPlugins),\n defaultsDeep(installedPluginsNotAlreadyUsed),\n pickBy((p: PluginMeta) => p.enabled)\n )(internalPlugins);\n\n return enabledPlugins;\n};\n"],"names":["get","strings","join","dirname","resolve","existsSync","statSync","strapi","getUserPluginsConfig","_","map","prop","pickBy","pipe","defaultsDeep"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AA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C,wBAAA,UAAU,EAAE,cAAc;AAAA,MAC5C;AAAA,IACF;AAAA,EAAA,CACD;AAED,QAAM,0BAA0BQ,GAAAA,IAAIC,GAAAA,KAAK,cAAc,GAAG,eAAe;AACzE,QAAM,iCAAiCC,GAAA;AAAA,IACrC,CAAC,MAAM,CAAC,wBAAwB,SAAS,EAAE,YAAY;AAAA,IACvD;AAAA,EAAA;AAGF,QAAM,iBAAiBC,GAAA;AAAA,IACrBC,GAAAA,aAAa,eAAe;AAAA,IAC5BA,GAAAA,aAAa,8BAA8B;AAAA,IAC3CF,GAAAA,OAAO,CAAC,MAAkB,EAAE,OAAO;AAAA,IACnC,eAAe;AAEV,SAAA;AACT;;"}
@@ -5,12 +5,13 @@ import { map, prop, pickBy, pipe, defaultsDeep, get } from "lodash/fp";
5
5
  import { strings } from "@strapi/utils";
6
6
  import { getUserPluginsConfig } from "./get-user-plugins-config.mjs";
7
7
  const INTERNAL_PLUGINS = [
8
- "@strapi/plugin-content-manager",
9
- "@strapi/plugin-content-type-builder",
10
- "@strapi/plugin-email",
11
- "@strapi/plugin-upload",
12
- "@strapi/plugin-i18n",
13
- "@strapi/content-releases"
8
+ "@strapi/content-manager",
9
+ "@strapi/content-type-builder",
10
+ "@strapi/email",
11
+ "@strapi/upload",
12
+ "@strapi/i18n",
13
+ "@strapi/content-releases",
14
+ "@strapi/review-workflows"
14
15
  ];
15
16
  const isStrapiPlugin = (info) => get("strapi.kind", info) === "plugin";
16
17
  const validatePluginName = (pluginName) => {
@@ -47,11 +48,15 @@ const getEnabledPlugins = async (strapi2, { client } = { client: false }) => {
47
48
  const internalPlugins = {};
48
49
  for (const dep of INTERNAL_PLUGINS) {
49
50
  const packagePath = join(dep, "package.json");
50
- const packageInfo = require(packagePath);
51
+ const packageModulePath = require.resolve(packagePath, {
52
+ paths: [require.resolve("@strapi/strapi/package.json"), process.cwd()]
53
+ });
54
+ const packageInfo = require(packageModulePath);
51
55
  validatePluginName(packageInfo.strapi.name);
52
56
  internalPlugins[packageInfo.strapi.name] = {
53
57
  ...toDetailedDeclaration({ enabled: true, resolve: packagePath, isModule: client }),
54
- info: packageInfo.strapi
58
+ info: packageInfo.strapi,
59
+ packageInfo
55
60
  };
56
61
  }
57
62
  const installedPlugins = {};
@@ -71,7 +76,8 @@ const getEnabledPlugins = async (strapi2, { client } = { client: false }) => {
71
76
  info: {
72
77
  ...packageInfo.strapi,
73
78
  packageName: packageInfo.name
74
- }
79
+ },
80
+ packageInfo
75
81
  };
76
82
  }
77
83
  }
@@ -89,6 +95,7 @@ const getEnabledPlugins = async (strapi2, { client } = { client: false }) => {
89
95
  const packageInfo = require(packagePath);
90
96
  if (isStrapiPlugin(packageInfo)) {
91
97
  declaredPlugins[pluginName].info = packageInfo.strapi || {};
98
+ declaredPlugins[pluginName].packageInfo = packageInfo;
92
99
  }
93
100
  }
94
101
  });
@@ -1 +1 @@
1
- {"version":3,"file":"get-enabled-plugins.mjs","sources":["../../../src/loaders/plugins/get-enabled-plugins.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\nimport { dirname, join, resolve } from 'path';\nimport { statSync, existsSync } from 'fs';\nimport _ from 'lodash';\nimport { get, pickBy, defaultsDeep, map, prop, pipe } from 'lodash/fp';\nimport { strings } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\nimport { getUserPluginsConfig } from './get-user-plugins-config';\n\ninterface PluginMeta {\n enabled: boolean;\n pathToPlugin?: string;\n info: Record<string, unknown>;\n}\n\ntype PluginMetas = Record<string, PluginMeta>;\n\ninterface PluginInfo {\n name: string;\n kind: string;\n}\n\ninterface PluginDeclaration {\n enabled: boolean;\n resolve: string;\n isModule: boolean;\n}\n\n/**\n * otherwise known as \"core features\"\n */\nconst INTERNAL_PLUGINS = [\n '@strapi/plugin-content-manager',\n '@strapi/plugin-content-type-builder',\n '@strapi/plugin-email',\n '@strapi/plugin-upload',\n '@strapi/plugin-i18n',\n '@strapi/content-releases',\n];\n\nconst isStrapiPlugin = (info: PluginInfo) => get('strapi.kind', info) === 'plugin';\n\nconst validatePluginName = (pluginName: string) => {\n if (!strings.isKebabCase(pluginName)) {\n throw new Error(`Plugin name \"${pluginName}\" is not in kebab (an-example-of-kebab-case)`);\n }\n};\n\nconst toDetailedDeclaration = (declaration: boolean | PluginDeclaration) => {\n if (typeof declaration === 'boolean') {\n return { enabled: declaration };\n }\n\n const detailedDeclaration: { enabled: boolean; pathToPlugin?: string } = {\n enabled: declaration.enabled,\n };\n\n if (declaration?.resolve) {\n let pathToPlugin = '';\n\n if (declaration.isModule) {\n /**\n * we only want the node_module here, not the package.json\n */\n pathToPlugin = join(declaration.resolve, '..');\n } else {\n try {\n pathToPlugin = dirname(require.resolve(declaration.resolve));\n } catch (e) {\n pathToPlugin = resolve(strapi.dirs.app.root, declaration.resolve);\n\n if (!existsSync(pathToPlugin) || !statSync(pathToPlugin).isDirectory()) {\n throw new Error(`${declaration.resolve} couldn't be resolved`);\n }\n }\n }\n\n detailedDeclaration.pathToPlugin = pathToPlugin;\n }\n\n return detailedDeclaration;\n};\n\nexport const getEnabledPlugins = async (strapi: Core.Strapi, { client } = { client: false }) => {\n const internalPlugins: PluginMetas = {};\n\n for (const dep of INTERNAL_PLUGINS) {\n const packagePath = join(dep, 'package.json');\n const packageInfo = require(packagePath);\n\n validatePluginName(packageInfo.strapi.name);\n internalPlugins[packageInfo.strapi.name] = {\n ...toDetailedDeclaration({ enabled: true, resolve: packagePath, isModule: client }),\n info: packageInfo.strapi,\n };\n }\n\n const installedPlugins: PluginMetas = {};\n const dependencies = strapi.config.get('info.dependencies', {});\n\n for (const dep of Object.keys(dependencies)) {\n const packagePath = join(dep, 'package.json');\n let packageInfo;\n try {\n packageInfo = require(packagePath);\n } catch {\n continue;\n }\n\n if (isStrapiPlugin(packageInfo)) {\n validatePluginName(packageInfo.strapi.name);\n installedPlugins[packageInfo.strapi.name] = {\n ...toDetailedDeclaration({ enabled: true, resolve: packagePath, isModule: client }),\n info: {\n ...packageInfo.strapi,\n packageName: packageInfo.name,\n },\n };\n }\n }\n\n const declaredPlugins: PluginMetas = {};\n const userPluginsConfig = await getUserPluginsConfig();\n\n _.forEach(userPluginsConfig, (declaration, pluginName) => {\n validatePluginName(pluginName);\n\n declaredPlugins[pluginName] = {\n ...toDetailedDeclaration(declaration),\n info: {},\n };\n\n const { pathToPlugin } = declaredPlugins[pluginName];\n\n // for manually resolved plugins\n if (pathToPlugin) {\n const packagePath = join(pathToPlugin, 'package.json');\n const packageInfo = require(packagePath);\n\n if (isStrapiPlugin(packageInfo)) {\n declaredPlugins[pluginName].info = packageInfo.strapi || {};\n }\n }\n });\n\n const declaredPluginsResolves = map(prop('pathToPlugin'), declaredPlugins);\n const installedPluginsNotAlreadyUsed = pickBy(\n (p) => !declaredPluginsResolves.includes(p.pathToPlugin),\n installedPlugins\n );\n\n const enabledPlugins = pipe(\n defaultsDeep(declaredPlugins),\n defaultsDeep(installedPluginsNotAlreadyUsed),\n pickBy((p: PluginMeta) => p.enabled)\n )(internalPlugins);\n\n return enabledPlugins;\n};\n"],"names":["strapi"],"mappings":";;;;;;AA+BA,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,iBAAiB,CAAC,SAAqB,IAAI,eAAe,IAAI,MAAM;AAE1E,MAAM,qBAAqB,CAAC,eAAuB;AACjD,MAAI,CAAC,QAAQ,YAAY,UAAU,GAAG;AACpC,UAAM,IAAI,MAAM,gBAAgB,UAAU,8CAA8C;AAAA,EAC1F;AACF;AAEA,MAAM,wBAAwB,CAAC,gBAA6C;AACtE,MAAA,OAAO,gBAAgB,WAAW;AAC7B,WAAA,EAAE,SAAS;EACpB;AAEA,QAAM,sBAAmE;AAAA,IACvE,SAAS,YAAY;AAAA,EAAA;AAGvB,MAAI,aAAa,SAAS;AACxB,QAAI,eAAe;AAEnB,QAAI,YAAY,UAAU;AAIT,qBAAA,KAAK,YAAY,SAAS,IAAI;AAAA,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AAA,MAAA;AAAA,IAEJ;AAAA,EACF;AAEA,QAAM,kBAA+B,CAAA;AAC/B,QAAA,oBAAoB,MAAM;AAEhC,IAAE,QAAQ,mBAAmB,CAAC,aAAa,eAAe;AACxD,uBAAmB,UAAU;AAE7B,oBAAgB,UAAU,IAAI;AAAA,MAC5B,GAAG,sBAAsB,WAAW;AAAA,MACpC,MAAM,CAAC;AAAA,IAAA;AAGT,UAAM,EAAE,aAAA,IAAiB,gBAAgB,UAAU;AAGnD,QAAI,cAAc;AACV,YAAA,cAAc,KAAK,cAAc,cAAc;AAC/C,YAAA,cAAc,QAAQ,WAAW;AAEnC,UAAA,eAAe,WAAW,GAAG;AAC/B,wBAAgB,UAAU,EAAE,OAAO,YAAY,UAAU,CAAA;AAAA,MAC3D;AAAA,IACF;AAAA,EAAA,CACD;AAED,QAAM,0BAA0B,IAAI,KAAK,cAAc,GAAG,eAAe;AACzE,QAAM,iCAAiC;AAAA,IACrC,CAAC,MAAM,CAAC,wBAAwB,SAAS,EAAE,YAAY;AAAA,IACvD;AAAA,EAAA;AAGF,QAAM,iBAAiB;AAAA,IACrB,aAAa,eAAe;AAAA,IAC5B,aAAa,8BAA8B;AAAA,IAC3C,OAAO,CAAC,MAAkB,EAAE,OAAO;AAAA,IACnC,eAAe;AAEV,SAAA;AACT;"}
1
+ {"version":3,"file":"get-enabled-plugins.mjs","sources":["../../../src/loaders/plugins/get-enabled-plugins.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\nimport { dirname, join, resolve } from 'path';\nimport { statSync, existsSync } from 'fs';\nimport _ from 'lodash';\nimport { get, pickBy, defaultsDeep, map, prop, pipe } from 'lodash/fp';\nimport { strings } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\nimport { getUserPluginsConfig } from './get-user-plugins-config';\n\ninterface PluginMeta {\n enabled: boolean;\n pathToPlugin?: string;\n info: Record<string, unknown>;\n packageInfo?: Record<string, unknown>;\n}\n\ntype PluginMetas = Record<string, PluginMeta>;\n\ninterface PluginInfo {\n name: string;\n kind: string;\n}\n\ninterface PluginDeclaration {\n enabled: boolean;\n resolve: string;\n isModule: boolean;\n}\n\n/**\n * otherwise known as \"core features\"\n *\n * NOTE: These are excluded from the content manager plugin list, as they are always enabled.\n * See admin.ts server controller on the content-manager plugin for more details.\n */\nconst INTERNAL_PLUGINS = [\n '@strapi/content-manager',\n '@strapi/content-type-builder',\n '@strapi/email',\n '@strapi/upload',\n '@strapi/i18n',\n '@strapi/content-releases',\n '@strapi/review-workflows',\n];\n\nconst isStrapiPlugin = (info: PluginInfo) => get('strapi.kind', info) === 'plugin';\n\nconst validatePluginName = (pluginName: string) => {\n if (!strings.isKebabCase(pluginName)) {\n throw new Error(`Plugin name \"${pluginName}\" is not in kebab (an-example-of-kebab-case)`);\n }\n};\n\nconst toDetailedDeclaration = (declaration: boolean | PluginDeclaration) => {\n if (typeof declaration === 'boolean') {\n return { enabled: declaration };\n }\n\n const detailedDeclaration: { enabled: boolean; pathToPlugin?: string } = {\n enabled: declaration.enabled,\n };\n\n if (declaration?.resolve) {\n let pathToPlugin = '';\n\n if (declaration.isModule) {\n /**\n * we only want the node_module here, not the package.json\n */\n pathToPlugin = join(declaration.resolve, '..');\n } else {\n try {\n pathToPlugin = dirname(require.resolve(declaration.resolve));\n } catch (e) {\n pathToPlugin = resolve(strapi.dirs.app.root, declaration.resolve);\n\n if (!existsSync(pathToPlugin) || !statSync(pathToPlugin).isDirectory()) {\n throw new Error(`${declaration.resolve} couldn't be resolved`);\n }\n }\n }\n\n detailedDeclaration.pathToPlugin = pathToPlugin;\n }\n\n return detailedDeclaration;\n};\n\nexport const getEnabledPlugins = async (strapi: Core.Strapi, { client } = { client: false }) => {\n const internalPlugins: PluginMetas = {};\n\n for (const dep of INTERNAL_PLUGINS) {\n const packagePath = join(dep, 'package.json');\n\n // NOTE: internal plugins should be resolved from the strapi package\n const packageModulePath = require.resolve(packagePath, {\n paths: [require.resolve('@strapi/strapi/package.json'), process.cwd()],\n });\n\n const packageInfo = require(packageModulePath);\n\n validatePluginName(packageInfo.strapi.name);\n internalPlugins[packageInfo.strapi.name] = {\n ...toDetailedDeclaration({ enabled: true, resolve: packagePath, isModule: client }),\n info: packageInfo.strapi,\n packageInfo,\n };\n }\n\n const installedPlugins: PluginMetas = {};\n const dependencies = strapi.config.get('info.dependencies', {});\n\n for (const dep of Object.keys(dependencies)) {\n const packagePath = join(dep, 'package.json');\n let packageInfo;\n try {\n packageInfo = require(packagePath);\n } catch {\n continue;\n }\n\n if (isStrapiPlugin(packageInfo)) {\n validatePluginName(packageInfo.strapi.name);\n installedPlugins[packageInfo.strapi.name] = {\n ...toDetailedDeclaration({ enabled: true, resolve: packagePath, isModule: client }),\n info: {\n ...packageInfo.strapi,\n packageName: packageInfo.name,\n },\n packageInfo,\n };\n }\n }\n\n const declaredPlugins: PluginMetas = {};\n const userPluginsConfig = await getUserPluginsConfig();\n\n _.forEach(userPluginsConfig, (declaration, pluginName) => {\n validatePluginName(pluginName);\n\n declaredPlugins[pluginName] = {\n ...toDetailedDeclaration(declaration),\n info: {},\n };\n\n const { pathToPlugin } = declaredPlugins[pluginName];\n\n // for manually resolved plugins\n if (pathToPlugin) {\n const packagePath = join(pathToPlugin, 'package.json');\n const packageInfo = require(packagePath);\n\n if (isStrapiPlugin(packageInfo)) {\n declaredPlugins[pluginName].info = packageInfo.strapi || {};\n declaredPlugins[pluginName].packageInfo = packageInfo;\n }\n }\n });\n\n const declaredPluginsResolves = map(prop('pathToPlugin'), declaredPlugins);\n const installedPluginsNotAlreadyUsed = pickBy(\n (p) => !declaredPluginsResolves.includes(p.pathToPlugin),\n installedPlugins\n );\n\n const enabledPlugins = pipe(\n defaultsDeep(declaredPlugins),\n defaultsDeep(installedPluginsNotAlreadyUsed),\n pickBy((p: PluginMeta) => p.enabled)\n )(internalPlugins);\n\n return enabledPlugins;\n};\n"],"names":["strapi"],"mappings":";;;;;;AAmCA,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAA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AI,KAAK,cAAc,GAAG,eAAe;AACzE,QAAM,iCAAiC;AAAA,IACrC,CAAC,MAAM,CAAC,wBAAwB,SAAS,EAAE,YAAY;AAAA,IACvD;AAAA,EAAA;AAGF,QAAM,iBAAiB;AAAA,IACrB,aAAa,eAAe;AAAA,IAC5B,aAAa,8BAA8B;AAAA,IAC3C,OAAO,CAAC,MAAkB,EAAE,OAAO;AAAA,IACnC,eAAe;AAEV,SAAA;AACT;"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const path = require("path");
4
4
  const fse = require("fs-extra");
5
- const _ = require("lodash/fp");
5
+ const fp = require("lodash/fp");
6
6
  const loadConfigFile = require("../../utils/load-config-file.js");
7
7
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
8
8
  const fse__default = /* @__PURE__ */ _interopDefault(fse);
@@ -19,7 +19,7 @@ const getUserPluginsConfig = async () => {
19
19
  config = loadConfigFile.loadConfigFile(globalUserConfigPath);
20
20
  }
21
21
  if (await fse__default.default.pathExists(currentEnvUserConfigPath)) {
22
- config = _.merge(config, loadConfigFile.loadConfigFile(currentEnvUserConfigPath));
22
+ config = fp.merge(config, loadConfigFile.loadConfigFile(currentEnvUserConfigPath));
23
23
  }
24
24
  return config;
25
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"get-user-plugins-config.js","sources":["../../../src/loaders/plugins/get-user-plugins-config.ts"],"sourcesContent":["import { join } from 'path';\nimport fse from 'fs-extra';\nimport { merge } from 'lodash/fp';\nimport { loadConfigFile } from '../../utils/load-config-file';\n\n/**\n * Return user defined plugins' config\n * first load config from `config/plugins.js`\n * and then merge config from `config/env/{env}/plugins.js`\n */\nexport const getUserPluginsConfig = async () => {\n const globalUserConfigPath = join(strapi.dirs.dist.config, 'plugins.js');\n const currentEnvUserConfigPath = join(\n strapi.dirs.dist.config,\n 'env',\n process.env.NODE_ENV as string,\n 'plugins.js'\n );\n let config = {};\n\n // assign global user config if exists\n if (await fse.pathExists(globalUserConfigPath)) {\n config = loadConfigFile(globalUserConfigPath);\n }\n\n // and merge user config by environment if exists\n if (await fse.pathExists(currentEnvUserConfigPath)) {\n config = merge(config, loadConfigFile(currentEnvUserConfigPath));\n }\n\n return config;\n};\n"],"names":["join","fse","loadConfigFile","merge"],"mappings":";;;;;;;;AAUO,MAAM,uBAAuB,YAAY;AAC9C,QAAM,uBAAuBA,KAAAA,KAAK,OAAO,KAAK,KAAK,QAAQ,YAAY;AACvE,QAAM,2BAA2BA,KAAA;AAAA,IAC/B,OAAO,KAAK,KAAK;AAAA,IACjB;AAAA,IACA,QAAQ,IAAI;AAAA,IACZ;AAAA,EAAA;AAEF,MAAI,SAAS,CAAA;AAGb,MAAI,MAAMC,aAAA,QAAI,WAAW,oBAAoB,GAAG;AAC9C,aAASC,eAAAA,eAAe,oBAAoB;AAAA,EAC9C;AAGA,MAAI,MAAMD,aAAA,QAAI,WAAW,wBAAwB,GAAG;AAClD,aAASE,EAAAA,MAAM,QAAQD,eAAAA,eAAe,wBAAwB,CAAC;AAAA,EACjE;AAEO,SAAA;AACT;;"}
1
+ {"version":3,"file":"get-user-plugins-config.js","sources":["../../../src/loaders/plugins/get-user-plugins-config.ts"],"sourcesContent":["import { join } from 'path';\nimport fse from 'fs-extra';\nimport { merge } from 'lodash/fp';\nimport { loadConfigFile } from '../../utils/load-config-file';\n\n/**\n * Return user defined plugins' config\n * first load config from `config/plugins.js`\n * and then merge config from `config/env/{env}/plugins.js`\n */\nexport const getUserPluginsConfig = async () => {\n const globalUserConfigPath = join(strapi.dirs.dist.config, 'plugins.js');\n const currentEnvUserConfigPath = join(\n strapi.dirs.dist.config,\n 'env',\n process.env.NODE_ENV as string,\n 'plugins.js'\n );\n let config = {};\n\n // assign global user config if exists\n if (await fse.pathExists(globalUserConfigPath)) {\n config = loadConfigFile(globalUserConfigPath);\n }\n\n // and merge user config by environment if exists\n if (await fse.pathExists(currentEnvUserConfigPath)) {\n config = merge(config, loadConfigFile(currentEnvUserConfigPath));\n }\n\n return config;\n};\n"],"names":["join","fse","loadConfigFile","merge"],"mappings":";;;;;;;;AAUO,MAAM,uBAAuB,YAAY;AAC9C,QAAM,uBAAuBA,KAAAA,KAAK,OAAO,KAAK,KAAK,QAAQ,YAAY;AACvE,QAAM,2BAA2BA,KAAA;AAAA,IAC/B,OAAO,KAAK,KAAK;AAAA,IACjB;AAAA,IACA,QAAQ,IAAI;AAAA,IACZ;AAAA,EAAA;AAEF,MAAI,SAAS,CAAA;AAGb,MAAI,MAAMC,aAAA,QAAI,WAAW,oBAAoB,GAAG;AAC9C,aAASC,eAAAA,eAAe,oBAAoB;AAAA,EAC9C;AAGA,MAAI,MAAMD,aAAA,QAAI,WAAW,wBAAwB,GAAG;AAClD,aAASE,GAAAA,MAAM,QAAQD,eAAAA,eAAe,wBAAwB,CAAC;AAAA,EACjE;AAEO,SAAA;AACT;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/loaders/plugins/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,eAAe,CAAC;AAiF1D,wBAA8B,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,iBA0C5D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/loaders/plugins/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,eAAe,CAAC;AAiF1D,wBAA8B,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,iBAqD5D"}