@strapi/core 5.56.0 → 5.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (377) hide show
  1. package/dist/Strapi.d.ts +29 -0
  2. package/dist/Strapi.d.ts.map +1 -1
  3. package/dist/Strapi.js +10 -3
  4. package/dist/Strapi.js.map +1 -1
  5. package/dist/Strapi.mjs +10 -3
  6. package/dist/Strapi.mjs.map +1 -1
  7. package/dist/configuration/get-dirs.js +2 -2
  8. package/dist/configuration/get-dirs.js.map +1 -1
  9. package/dist/configuration/get-dirs.mjs +2 -2
  10. package/dist/configuration/get-dirs.mjs.map +1 -1
  11. package/dist/configuration/index.d.ts +1 -2
  12. package/dist/configuration/index.d.ts.map +1 -1
  13. package/dist/configuration/index.js +1 -2
  14. package/dist/configuration/index.js.map +1 -1
  15. package/dist/configuration/index.mjs +2 -3
  16. package/dist/configuration/index.mjs.map +1 -1
  17. package/dist/core-api/controller/collection-type.js +3 -3
  18. package/dist/core-api/controller/collection-type.js.map +1 -1
  19. package/dist/core-api/controller/collection-type.mjs +1 -1
  20. package/dist/core-api/controller/collection-type.mjs.map +1 -1
  21. package/dist/core-api/controller/index.js +2 -2
  22. package/dist/core-api/controller/index.js.map +1 -1
  23. package/dist/core-api/controller/index.mjs +2 -2
  24. package/dist/core-api/controller/index.mjs.map +1 -1
  25. package/dist/core-api/controller/single-type.js +2 -2
  26. package/dist/core-api/controller/single-type.js.map +1 -1
  27. package/dist/core-api/controller/single-type.mjs +1 -1
  28. package/dist/core-api/controller/single-type.mjs.map +1 -1
  29. package/dist/core-api/controller/transform.d.ts +1 -4
  30. package/dist/core-api/controller/transform.d.ts.map +1 -1
  31. package/dist/core-api/controller/transform.js +8 -8
  32. package/dist/core-api/controller/transform.js.map +1 -1
  33. package/dist/core-api/controller/transform.mjs +5 -5
  34. package/dist/core-api/controller/transform.mjs.map +1 -1
  35. package/dist/core-api/routes/index.js +1 -1
  36. package/dist/core-api/routes/index.js.map +1 -1
  37. package/dist/core-api/routes/index.mjs +1 -1
  38. package/dist/core-api/routes/index.mjs.map +1 -1
  39. package/dist/core-api/service/pagination.js +9 -9
  40. package/dist/core-api/service/pagination.js.map +1 -1
  41. package/dist/core-api/service/pagination.mjs +7 -7
  42. package/dist/core-api/service/pagination.mjs.map +1 -1
  43. package/dist/domain/content-type/index.d.ts.map +1 -1
  44. package/dist/domain/content-type/index.js +1 -2
  45. package/dist/domain/content-type/index.js.map +1 -1
  46. package/dist/domain/content-type/index.mjs +1 -2
  47. package/dist/domain/content-type/index.mjs.map +1 -1
  48. package/dist/ee/entitlements.d.ts +44 -0
  49. package/dist/ee/entitlements.d.ts.map +1 -0
  50. package/dist/ee/entitlements.js +54 -0
  51. package/dist/ee/entitlements.js.map +1 -0
  52. package/dist/ee/entitlements.mjs +51 -0
  53. package/dist/ee/entitlements.mjs.map +1 -0
  54. package/dist/ee/index.d.ts +33 -0
  55. package/dist/ee/index.d.ts.map +1 -1
  56. package/dist/ee/index.js +74 -7
  57. package/dist/ee/index.js.map +1 -1
  58. package/dist/ee/index.mjs +74 -7
  59. package/dist/ee/index.mjs.map +1 -1
  60. package/dist/ee/license.d.ts +10 -0
  61. package/dist/ee/license.d.ts.map +1 -1
  62. package/dist/ee/license.js +25 -1
  63. package/dist/ee/license.js.map +1 -1
  64. package/dist/ee/license.mjs +25 -2
  65. package/dist/ee/license.mjs.map +1 -1
  66. package/dist/factories.d.ts.map +1 -1
  67. package/dist/factories.js +3 -2
  68. package/dist/factories.js.map +1 -1
  69. package/dist/factories.mjs +3 -2
  70. package/dist/factories.mjs.map +1 -1
  71. package/dist/index.js +1 -1
  72. package/dist/index.mjs +1 -1
  73. package/dist/loaders/apis.d.ts.map +1 -1
  74. package/dist/loaders/apis.js +1 -2
  75. package/dist/loaders/apis.js.map +1 -1
  76. package/dist/loaders/apis.mjs +1 -2
  77. package/dist/loaders/apis.mjs.map +1 -1
  78. package/dist/loaders/plugins/get-enabled-plugins.d.ts +1 -1
  79. package/dist/loaders/plugins/get-enabled-plugins.d.ts.map +1 -1
  80. package/dist/loaders/plugins/get-enabled-plugins.js +6 -5
  81. package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
  82. package/dist/loaders/plugins/get-enabled-plugins.mjs +6 -5
  83. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
  84. package/dist/loaders/plugins/get-user-plugins-config.js +2 -2
  85. package/dist/loaders/plugins/get-user-plugins-config.js.map +1 -1
  86. package/dist/loaders/plugins/get-user-plugins-config.mjs +2 -2
  87. package/dist/loaders/plugins/get-user-plugins-config.mjs.map +1 -1
  88. package/dist/loaders/plugins/index.js +9 -12
  89. package/dist/loaders/plugins/index.js.map +1 -1
  90. package/dist/loaders/plugins/index.mjs +9 -12
  91. package/dist/loaders/plugins/index.mjs.map +1 -1
  92. package/dist/middlewares/body.js +2 -2
  93. package/dist/middlewares/body.js.map +1 -1
  94. package/dist/middlewares/body.mjs +2 -2
  95. package/dist/middlewares/body.mjs.map +1 -1
  96. package/dist/middlewares/public.js +2 -2
  97. package/dist/middlewares/public.js.map +1 -1
  98. package/dist/middlewares/public.mjs +2 -2
  99. package/dist/middlewares/public.mjs.map +1 -1
  100. package/dist/middlewares/responses.d.ts.map +1 -1
  101. package/dist/middlewares/responses.js +1 -3
  102. package/dist/middlewares/responses.js.map +1 -1
  103. package/dist/middlewares/responses.mjs +1 -3
  104. package/dist/middlewares/responses.mjs.map +1 -1
  105. package/dist/middlewares/security.d.ts.map +1 -1
  106. package/dist/middlewares/security.js +3 -3
  107. package/dist/middlewares/security.js.map +1 -1
  108. package/dist/middlewares/security.mjs +3 -3
  109. package/dist/middlewares/security.mjs.map +1 -1
  110. package/dist/middlewares/session.js +2 -2
  111. package/dist/middlewares/session.js.map +1 -1
  112. package/dist/middlewares/session.mjs +2 -2
  113. package/dist/middlewares/session.mjs.map +1 -1
  114. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -1
  115. package/dist/migrations/database/5.0.0-discard-drafts.js +1 -2
  116. package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -1
  117. package/dist/migrations/database/5.0.0-discard-drafts.mjs +1 -2
  118. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -1
  119. package/dist/migrations/i18n.d.ts.map +1 -1
  120. package/dist/migrations/i18n.js +6 -4
  121. package/dist/migrations/i18n.js.map +1 -1
  122. package/dist/migrations/i18n.mjs +6 -4
  123. package/dist/migrations/i18n.mjs.map +1 -1
  124. package/dist/package.json.js +16 -16
  125. package/dist/package.json.mjs +16 -16
  126. package/dist/registries/apis.js +2 -2
  127. package/dist/registries/apis.js.map +1 -1
  128. package/dist/registries/apis.mjs +2 -2
  129. package/dist/registries/apis.mjs.map +1 -1
  130. package/dist/registries/components.js +2 -2
  131. package/dist/registries/components.js.map +1 -1
  132. package/dist/registries/components.mjs +2 -2
  133. package/dist/registries/components.mjs.map +1 -1
  134. package/dist/registries/content-types.d.ts +1 -1
  135. package/dist/registries/content-types.js +3 -3
  136. package/dist/registries/content-types.js.map +1 -1
  137. package/dist/registries/content-types.mjs +3 -3
  138. package/dist/registries/content-types.mjs.map +1 -1
  139. package/dist/registries/controllers.js +3 -3
  140. package/dist/registries/controllers.js.map +1 -1
  141. package/dist/registries/controllers.mjs +3 -3
  142. package/dist/registries/controllers.mjs.map +1 -1
  143. package/dist/registries/custom-fields.js +4 -4
  144. package/dist/registries/custom-fields.js.map +1 -1
  145. package/dist/registries/custom-fields.mjs +4 -4
  146. package/dist/registries/custom-fields.mjs.map +1 -1
  147. package/dist/registries/hooks.d.ts +1 -1
  148. package/dist/registries/hooks.js +2 -2
  149. package/dist/registries/hooks.js.map +1 -1
  150. package/dist/registries/hooks.mjs +2 -2
  151. package/dist/registries/hooks.mjs.map +1 -1
  152. package/dist/registries/middlewares.d.ts +1 -1
  153. package/dist/registries/middlewares.js +3 -3
  154. package/dist/registries/middlewares.js.map +1 -1
  155. package/dist/registries/middlewares.mjs +3 -3
  156. package/dist/registries/middlewares.mjs.map +1 -1
  157. package/dist/registries/modules.d.ts +1 -4
  158. package/dist/registries/modules.d.ts.map +1 -1
  159. package/dist/registries/modules.js +3 -3
  160. package/dist/registries/modules.js.map +1 -1
  161. package/dist/registries/modules.mjs +3 -3
  162. package/dist/registries/modules.mjs.map +1 -1
  163. package/dist/registries/plugins.js +2 -2
  164. package/dist/registries/plugins.js.map +1 -1
  165. package/dist/registries/plugins.mjs +2 -2
  166. package/dist/registries/plugins.mjs.map +1 -1
  167. package/dist/registries/policies.d.ts +1 -1
  168. package/dist/registries/policies.js +4 -4
  169. package/dist/registries/policies.js.map +1 -1
  170. package/dist/registries/policies.mjs +3 -3
  171. package/dist/registries/policies.mjs.map +1 -1
  172. package/dist/registries/services.js +3 -3
  173. package/dist/registries/services.js.map +1 -1
  174. package/dist/registries/services.mjs +3 -3
  175. package/dist/registries/services.mjs.map +1 -1
  176. package/dist/services/auth/index.js +3 -3
  177. package/dist/services/auth/index.js.map +1 -1
  178. package/dist/services/auth/index.mjs +3 -3
  179. package/dist/services/auth/index.mjs.map +1 -1
  180. package/dist/services/core-store.js +3 -3
  181. package/dist/services/core-store.js.map +1 -1
  182. package/dist/services/core-store.mjs +1 -1
  183. package/dist/services/core-store.mjs.map +1 -1
  184. package/dist/services/cron.d.ts.map +1 -1
  185. package/dist/services/cron.js +2 -4
  186. package/dist/services/cron.js.map +1 -1
  187. package/dist/services/cron.mjs +2 -4
  188. package/dist/services/cron.mjs.map +1 -1
  189. package/dist/services/document-service/attributes/index.js +2 -2
  190. package/dist/services/document-service/attributes/index.js.map +1 -1
  191. package/dist/services/document-service/attributes/index.mjs +1 -1
  192. package/dist/services/document-service/attributes/index.mjs.map +1 -1
  193. package/dist/services/document-service/attributes/transforms.js +3 -3
  194. package/dist/services/document-service/attributes/transforms.js.map +1 -1
  195. package/dist/services/document-service/attributes/transforms.mjs +2 -2
  196. package/dist/services/document-service/attributes/transforms.mjs.map +1 -1
  197. package/dist/services/document-service/components.d.ts.map +1 -1
  198. package/dist/services/document-service/components.js +13 -14
  199. package/dist/services/document-service/components.js.map +1 -1
  200. package/dist/services/document-service/components.mjs +12 -13
  201. package/dist/services/document-service/components.mjs.map +1 -1
  202. package/dist/services/document-service/draft-and-publish.js +65 -38
  203. package/dist/services/document-service/draft-and-publish.js.map +1 -1
  204. package/dist/services/document-service/draft-and-publish.mjs +59 -32
  205. package/dist/services/document-service/draft-and-publish.mjs.map +1 -1
  206. package/dist/services/document-service/entries.d.ts +2 -2
  207. package/dist/services/document-service/entries.d.ts.map +1 -1
  208. package/dist/services/document-service/entries.js +16 -8
  209. package/dist/services/document-service/entries.js.map +1 -1
  210. package/dist/services/document-service/entries.mjs +17 -9
  211. package/dist/services/document-service/entries.mjs.map +1 -1
  212. package/dist/services/document-service/first-published-at.js +7 -5
  213. package/dist/services/document-service/first-published-at.js.map +1 -1
  214. package/dist/services/document-service/first-published-at.mjs +7 -5
  215. package/dist/services/document-service/first-published-at.mjs.map +1 -1
  216. package/dist/services/document-service/internationalization.d.ts.map +1 -1
  217. package/dist/services/document-service/internationalization.js +37 -28
  218. package/dist/services/document-service/internationalization.js.map +1 -1
  219. package/dist/services/document-service/internationalization.mjs +33 -24
  220. package/dist/services/document-service/internationalization.mjs.map +1 -1
  221. package/dist/services/document-service/params.d.ts +1 -0
  222. package/dist/services/document-service/params.d.ts.map +1 -1
  223. package/dist/services/document-service/params.js +6 -4
  224. package/dist/services/document-service/params.js.map +1 -1
  225. package/dist/services/document-service/params.mjs +6 -5
  226. package/dist/services/document-service/params.mjs.map +1 -1
  227. package/dist/services/document-service/repository.d.ts.map +1 -1
  228. package/dist/services/document-service/repository.js +84 -61
  229. package/dist/services/document-service/repository.js.map +1 -1
  230. package/dist/services/document-service/repository.mjs +47 -24
  231. package/dist/services/document-service/repository.mjs.map +1 -1
  232. package/dist/services/document-service/transform/fields.d.ts.map +1 -1
  233. package/dist/services/document-service/transform/fields.js +7 -1
  234. package/dist/services/document-service/transform/fields.js.map +1 -1
  235. package/dist/services/document-service/transform/fields.mjs +7 -1
  236. package/dist/services/document-service/transform/fields.mjs.map +1 -1
  237. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  238. package/dist/services/document-service/transform/id-map.js +2 -1
  239. package/dist/services/document-service/transform/id-map.js.map +1 -1
  240. package/dist/services/document-service/transform/id-map.mjs +2 -1
  241. package/dist/services/document-service/transform/id-map.mjs.map +1 -1
  242. package/dist/services/document-service/transform/id-transform.js +2 -2
  243. package/dist/services/document-service/transform/id-transform.js.map +1 -1
  244. package/dist/services/document-service/transform/id-transform.mjs +1 -1
  245. package/dist/services/document-service/transform/id-transform.mjs.map +1 -1
  246. package/dist/services/document-service/transform/populate.d.ts.map +1 -1
  247. package/dist/services/document-service/transform/populate.js +8 -1
  248. package/dist/services/document-service/transform/populate.js.map +1 -1
  249. package/dist/services/document-service/transform/populate.mjs +8 -1
  250. package/dist/services/document-service/transform/populate.mjs.map +1 -1
  251. package/dist/services/document-service/transform/query.d.ts +3 -1
  252. package/dist/services/document-service/transform/query.d.ts.map +1 -1
  253. package/dist/services/document-service/transform/query.js +12 -6
  254. package/dist/services/document-service/transform/query.js.map +1 -1
  255. package/dist/services/document-service/transform/query.mjs +11 -5
  256. package/dist/services/document-service/transform/query.mjs.map +1 -1
  257. package/dist/services/document-service/transform/relations/extract/data-ids.js +2 -2
  258. package/dist/services/document-service/transform/relations/extract/data-ids.js.map +1 -1
  259. package/dist/services/document-service/transform/relations/extract/data-ids.mjs +1 -1
  260. package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +1 -1
  261. package/dist/services/document-service/transform/relations/transform/data-ids.js +2 -2
  262. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +1 -1
  263. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +1 -1
  264. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +1 -1
  265. package/dist/services/document-service/transform/relations/transform/default-locale.js +1 -1
  266. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +1 -1
  267. package/dist/services/document-service/transform/relations/transform/default-locale.mjs +1 -1
  268. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +1 -1
  269. package/dist/services/document-service/transform/relations/utils/dp.d.ts.map +1 -1
  270. package/dist/services/document-service/transform/relations/utils/dp.js +1 -2
  271. package/dist/services/document-service/transform/relations/utils/dp.js.map +1 -1
  272. package/dist/services/document-service/transform/relations/utils/dp.mjs +1 -2
  273. package/dist/services/document-service/transform/relations/utils/dp.mjs.map +1 -1
  274. package/dist/services/document-service/transform/relations/utils/i18n.d.ts +2 -2
  275. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  276. package/dist/services/document-service/transform/relations/utils/i18n.js +2 -2
  277. package/dist/services/document-service/transform/relations/utils/i18n.js.map +1 -1
  278. package/dist/services/document-service/transform/relations/utils/i18n.mjs +2 -2
  279. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +1 -1
  280. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts.map +1 -1
  281. package/dist/services/document-service/transform/relations/utils/map-relation.js +16 -10
  282. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +1 -1
  283. package/dist/services/document-service/transform/relations/utils/map-relation.mjs +13 -7
  284. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +1 -1
  285. package/dist/services/document-service/transform/relations/utils/xto-one.js +3 -3
  286. package/dist/services/document-service/transform/relations/utils/xto-one.js.map +1 -1
  287. package/dist/services/document-service/transform/relations/utils/xto-one.mjs +2 -2
  288. package/dist/services/document-service/transform/relations/utils/xto-one.mjs.map +1 -1
  289. package/dist/services/document-service/utils/bidirectional-relations.js +3 -3
  290. package/dist/services/document-service/utils/bidirectional-relations.js.map +1 -1
  291. package/dist/services/document-service/utils/bidirectional-relations.mjs +3 -3
  292. package/dist/services/document-service/utils/bidirectional-relations.mjs.map +1 -1
  293. package/dist/services/document-service/utils/clone-relations.js +3 -3
  294. package/dist/services/document-service/utils/clone-relations.js.map +1 -1
  295. package/dist/services/document-service/utils/clone-relations.mjs +3 -3
  296. package/dist/services/document-service/utils/clone-relations.mjs.map +1 -1
  297. package/dist/services/document-service/utils/self-referential-relations.js +4 -4
  298. package/dist/services/document-service/utils/self-referential-relations.js.map +1 -1
  299. package/dist/services/document-service/utils/self-referential-relations.mjs +4 -4
  300. package/dist/services/document-service/utils/self-referential-relations.mjs.map +1 -1
  301. package/dist/services/document-service/utils/unidirectional-relations.js +3 -3
  302. package/dist/services/document-service/utils/unidirectional-relations.js.map +1 -1
  303. package/dist/services/document-service/utils/unidirectional-relations.mjs +3 -3
  304. package/dist/services/document-service/utils/unidirectional-relations.mjs.map +1 -1
  305. package/dist/services/entity-validator/index.d.ts.map +1 -1
  306. package/dist/services/entity-validator/index.js +9 -10
  307. package/dist/services/entity-validator/index.js.map +1 -1
  308. package/dist/services/entity-validator/index.mjs +4 -5
  309. package/dist/services/entity-validator/index.mjs.map +1 -1
  310. package/dist/services/localization.d.ts +4 -0
  311. package/dist/services/localization.d.ts.map +1 -0
  312. package/dist/services/localization.js +51 -0
  313. package/dist/services/localization.js.map +1 -0
  314. package/dist/services/localization.mjs +49 -0
  315. package/dist/services/localization.mjs.map +1 -0
  316. package/dist/services/server/compose-endpoint.js +7 -7
  317. package/dist/services/server/compose-endpoint.js.map +1 -1
  318. package/dist/services/server/compose-endpoint.mjs +3 -3
  319. package/dist/services/server/compose-endpoint.mjs.map +1 -1
  320. package/dist/services/server/koa-methods.js +2 -2
  321. package/dist/services/server/koa-methods.js.map +1 -1
  322. package/dist/services/server/koa-methods.mjs +1 -1
  323. package/dist/services/server/koa-methods.mjs.map +1 -1
  324. package/dist/services/server/koa.d.ts.map +1 -1
  325. package/dist/services/server/koa.js +1 -2
  326. package/dist/services/server/koa.js.map +1 -1
  327. package/dist/services/server/koa.mjs +1 -2
  328. package/dist/services/server/koa.mjs.map +1 -1
  329. package/dist/services/server/middleware.d.ts.map +1 -1
  330. package/dist/services/server/middleware.js +1 -2
  331. package/dist/services/server/middleware.js.map +1 -1
  332. package/dist/services/server/middleware.mjs +1 -2
  333. package/dist/services/server/middleware.mjs.map +1 -1
  334. package/dist/services/server/routing.js +2 -2
  335. package/dist/services/server/routing.js.map +1 -1
  336. package/dist/services/server/routing.mjs +2 -2
  337. package/dist/services/server/routing.mjs.map +1 -1
  338. package/dist/services/utils/conditional-fields.d.ts +1 -1
  339. package/dist/services/utils/conditional-fields.d.ts.map +1 -1
  340. package/dist/services/utils/conditional-fields.js +2 -8
  341. package/dist/services/utils/conditional-fields.js.map +1 -1
  342. package/dist/services/utils/conditional-fields.mjs +2 -8
  343. package/dist/services/utils/conditional-fields.mjs.map +1 -1
  344. package/dist/services/utils/dynamic-zones.d.ts.map +1 -1
  345. package/dist/services/utils/dynamic-zones.js +2 -8
  346. package/dist/services/utils/dynamic-zones.js.map +1 -1
  347. package/dist/services/utils/dynamic-zones.mjs +2 -8
  348. package/dist/services/utils/dynamic-zones.mjs.map +1 -1
  349. package/dist/utils/cron.js +2 -2
  350. package/dist/utils/cron.js.map +1 -1
  351. package/dist/utils/cron.mjs +1 -1
  352. package/dist/utils/cron.mjs.map +1 -1
  353. package/dist/utils/detect-customizations.d.ts +31 -0
  354. package/dist/utils/detect-customizations.d.ts.map +1 -0
  355. package/dist/utils/detect-customizations.js +173 -0
  356. package/dist/utils/detect-customizations.js.map +1 -0
  357. package/dist/utils/detect-customizations.mjs +165 -0
  358. package/dist/utils/detect-customizations.mjs.map +1 -0
  359. package/dist/utils/filepath-to-prop-path.d.ts.map +1 -1
  360. package/dist/utils/filepath-to-prop-path.js +5 -12
  361. package/dist/utils/filepath-to-prop-path.js.map +1 -1
  362. package/dist/utils/filepath-to-prop-path.mjs +5 -11
  363. package/dist/utils/filepath-to-prop-path.mjs.map +1 -1
  364. package/dist/utils/is-initialized.js +3 -3
  365. package/dist/utils/is-initialized.js.map +1 -1
  366. package/dist/utils/is-initialized.mjs +2 -2
  367. package/dist/utils/is-initialized.mjs.map +1 -1
  368. package/dist/utils/startup-logger.d.ts.map +1 -1
  369. package/dist/utils/startup-logger.js +2 -4
  370. package/dist/utils/startup-logger.js.map +1 -1
  371. package/dist/utils/startup-logger.mjs +2 -3
  372. package/dist/utils/startup-logger.mjs.map +1 -1
  373. package/dist/utils/transform-content-types-to-models.js +4 -4
  374. package/dist/utils/transform-content-types-to-models.js.map +1 -1
  375. package/dist/utils/transform-content-types-to-models.mjs +3 -3
  376. package/dist/utils/transform-content-types-to-models.mjs.map +1 -1
  377. package/package.json +16 -16
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/migrations/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGxC,QAAA,MAAM,UAAU,GAAU,mCAAmC,KAAK,kBAyBjE,CAAC;AAEF,QAAA,MAAM,WAAW,GAAU,mCAAmC,KAAK,kBAiClE,CAAC;AAEF,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,WAAW,IAAI,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/migrations/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGxC,QAAA,MAAM,UAAU,GAAU,mCAAmC,KAAK,kBAwBjE,CAAC;AAEF,QAAA,MAAM,WAAW,GAAU,mCAAmC,KAAK,kBAuClE,CAAC;AAEF,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,WAAW,IAAI,OAAO,EAAE,CAAC"}
@@ -2,8 +2,7 @@
2
2
 
3
3
  // if i18N enabled set default locale
4
4
  const enableI18n = async ({ oldContentTypes, contentTypes })=>{
5
- const { isLocalizedContentType } = strapi.plugin('i18n')?.service('content-types') ?? {};
6
- const { getDefaultLocale } = strapi.plugin('i18n')?.service('locales') ?? {};
5
+ const { isLocalizedContentType, getDefaultLocale } = strapi.localization;
7
6
  if (!oldContentTypes) {
8
7
  return;
9
8
  }
@@ -27,8 +26,7 @@ const enableI18n = async ({ oldContentTypes, contentTypes })=>{
27
26
  }
28
27
  };
29
28
  const disableI18n = async ({ oldContentTypes, contentTypes })=>{
30
- const { isLocalizedContentType } = strapi.plugin('i18n')?.service('content-types') ?? {};
31
- const { getDefaultLocale } = strapi.plugin('i18n')?.service('locales') ?? {};
29
+ const { isLocalizedContentType, getDefaultLocale } = strapi.localization;
32
30
  if (!oldContentTypes) {
33
31
  return;
34
32
  }
@@ -41,6 +39,10 @@ const disableI18n = async ({ oldContentTypes, contentTypes })=>{
41
39
  // if i18N is disabled remove non default locales before sync
42
40
  if (isLocalizedContentType(oldContentType) && !isLocalizedContentType(contentType)) {
43
41
  const defaultLocale = await getDefaultLocale();
42
+ // `$ne: null` would match every localized row and delete them all
43
+ if (defaultLocale === null) {
44
+ throw new Error(`Cannot disable localization for "${uid}": no default locale is set, so non-default rows cannot be identified.`);
45
+ }
44
46
  await Promise.all([
45
47
  // Delete all entities that are not in the default locale
46
48
  strapi.db.query(uid).deleteMany({
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sources":["../../src/migrations/i18n.ts"],"sourcesContent":["import { Input } from './draft-publish';\n\n// if i18N enabled set default locale\nconst enableI18n = async ({ oldContentTypes, contentTypes }: Input) => {\n const { isLocalizedContentType } = strapi.plugin('i18n')?.service('content-types') ?? {};\n const { getDefaultLocale } = strapi.plugin('i18n')?.service('locales') ?? {};\n\n if (!oldContentTypes) {\n return;\n }\n\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const oldContentType = oldContentTypes[uid];\n const contentType = contentTypes[uid];\n\n if (!isLocalizedContentType(oldContentType) && isLocalizedContentType(contentType)) {\n const defaultLocale = await getDefaultLocale();\n\n await strapi.db.query(uid).updateMany({\n where: { locale: null },\n data: { locale: defaultLocale },\n });\n }\n }\n};\n\nconst disableI18n = async ({ oldContentTypes, contentTypes }: Input) => {\n const { isLocalizedContentType } = strapi.plugin('i18n')?.service('content-types') ?? {};\n const { getDefaultLocale } = strapi.plugin('i18n')?.service('locales') ?? {};\n\n if (!oldContentTypes) {\n return;\n }\n\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const oldContentType = oldContentTypes[uid];\n const contentType = contentTypes[uid];\n\n // if i18N is disabled remove non default locales before sync\n if (isLocalizedContentType(oldContentType) && !isLocalizedContentType(contentType)) {\n const defaultLocale = await getDefaultLocale();\n\n await Promise.all([\n // Delete all entities that are not in the default locale\n strapi.db.query(uid).deleteMany({\n where: { locale: { $ne: defaultLocale } },\n }),\n // Set locale to null for the rest\n strapi.db.query(uid).updateMany({\n where: { locale: { $eq: defaultLocale } },\n data: { locale: null },\n }),\n ]);\n }\n }\n};\n\nexport { enableI18n as enable, disableI18n as disable };\n"],"names":["enableI18n","oldContentTypes","contentTypes","isLocalizedContentType","strapi","plugin","service","getDefaultLocale","uid","oldContentType","contentType","defaultLocale","db","query","updateMany","where","locale","data","disableI18n","Promise","all","deleteMany","$ne","$eq"],"mappings":";;AAEA;AACA,MAAMA,aAAa,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;IAChE,MAAM,EAAEC,sBAAsB,EAAE,GAAGC,MAAAA,CAAOC,MAAM,CAAC,MAAA,CAAA,EAASC,OAAAA,CAAQ,eAAA,CAAA,IAAoB,EAAC;IACvF,MAAM,EAAEC,gBAAgB,EAAE,GAAGH,MAAAA,CAAOC,MAAM,CAAC,MAAA,CAAA,EAASC,OAAAA,CAAQ,SAAA,CAAA,IAAc,EAAC;AAE3E,IAAA,IAAI,CAACL,eAAAA,EAAiB;AACpB,QAAA;AACF,IAAA;IAEA,IAAK,MAAMO,OAAON,YAAAA,CAAc;AAC9B,QAAA,IAAI,CAACD,eAAe,CAACO,GAAAA,CAAI,EAAE;AACzB,YAAA;AACF,QAAA;QAEA,MAAMC,cAAAA,GAAiBR,eAAe,CAACO,GAAAA,CAAI;QAC3C,MAAME,WAAAA,GAAcR,YAAY,CAACM,GAAA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EAAE,CAACC,KAAK,CAACL,GAAAA,CAAAA,CAAKa,UAAU,CAAC;oBAC9BN,KAAAA,EAAO;wBAAEC,MAAAA,EAAQ;4BAAEM,GAAAA,EAAKX;AAAc;AAAE;AAC1C,iBAAA,CAAA;;AAEAP,gBAAAA,MAAAA,CAAOQ,EAAE,CAACC,KAAK,CAACL,GAAAA,CAAAA,CAAKM,UAAU,CAAC;oBAC9BC,KAAAA,EAAO;wBAAEC,MAAAA,EAAQ;4BAAEO,GAAAA,EAAKZ;AAAc;AAAE,qBAAA;oBACxCM,IAAAA,EAAM;wBAAED,MAAAA,EAAQ;AAAK;AACvB,iBAAA;AACD,aAAA,CAAA;AACH,QAAA;AACF,IAAA;AACF;;;;;"}
1
+ {"version":3,"file":"i18n.js","sources":["../../src/migrations/i18n.ts"],"sourcesContent":["import { Input } from './draft-publish';\n\n// if i18N enabled set default locale\nconst enableI18n = async ({ oldContentTypes, contentTypes }: Input) => {\n const { isLocalizedContentType, getDefaultLocale } = strapi.localization;\n\n if (!oldContentTypes) {\n return;\n }\n\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const oldContentType = oldContentTypes[uid];\n const contentType = contentTypes[uid];\n\n if (!isLocalizedContentType(oldContentType) && isLocalizedContentType(contentType)) {\n const defaultLocale = await getDefaultLocale();\n\n await strapi.db.query(uid).updateMany({\n where: { locale: null },\n data: { locale: defaultLocale },\n });\n }\n }\n};\n\nconst disableI18n = async ({ oldContentTypes, contentTypes }: Input) => {\n const { isLocalizedContentType, getDefaultLocale } = strapi.localization;\n\n if (!oldContentTypes) {\n return;\n }\n\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const oldContentType = oldContentTypes[uid];\n const contentType = contentTypes[uid];\n\n // if i18N is disabled remove non default locales before sync\n if (isLocalizedContentType(oldContentType) && !isLocalizedContentType(contentType)) {\n const defaultLocale = await getDefaultLocale();\n\n // `$ne: null` would match every localized row and delete them all\n if (defaultLocale === null) {\n throw new Error(\n `Cannot disable localization for \"${uid}\": no default locale is set, so non-default rows cannot be identified.`\n );\n }\n\n await Promise.all([\n // Delete all entities that are not in the default locale\n strapi.db.query(uid).deleteMany({\n where: { locale: { $ne: defaultLocale } },\n }),\n // Set locale to null for the rest\n strapi.db.query(uid).updateMany({\n where: { locale: { $eq: defaultLocale } },\n data: { locale: null },\n }),\n ]);\n }\n }\n};\n\nexport { enableI18n as enable, disableI18n as disable };\n"],"names":["enableI18n","oldContentTypes","contentTypes","isLocalizedContentType","getDefaultLocale","strapi","localization","uid","oldContentType","contentType","defaultLocale","db","query","updateMany","where","locale","data","disableI18n","Error","Promise","all","deleteMany","$ne","$eq"],"mappings":";;AAEA;AACA,MAAMA,aAAa,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;AAChE,IAAA,MAAM,EAAEC,sBAAsB,EAAEC,gBAAgB,EAAE,GAAGC,OAAOC,YAAY;AAExE,IAAA,IAAI,CAACL,eAAAA,EAAiB;AACpB,QAAA;AACF,IAAA;IAEA,IAAK,MAAMM,OAAOL,YAAAA,CAAc;AAC9B,QAAA,IAAI,CAACD,eAAe,CAACM,GAAAA,CAAI,EAAE;AACzB,YAAA;AACF,QAAA;QAEA,MAAMC,cAAAA,GAAiBP,eAAe,CAACM,GAAAA,CAAI;QAC3C,MAAME,WAAAA,GAAcP,YAAY,CAACK,GAAAA,CAAI;AAErC,QAAA,IAAI,CAACJ,sBAAAA,CAAuBK,cAAAA,CAAAA,IAAmBL,sBAAAA,CAAuBM,WAAAA,CAAAA,EAAc;AAClF,YAAA,MAAMC,gBAAgB,MAAMN,gBAAAA,EAAAA;AAE5B,YAAA,MAAMC,OAAOM,EAAE,CAACC,KAAK,CAACL,GAAAA,CAAAA,CAAKM,UAAU,CAAC;gBACpCC,KAAAA,EAAO;oBAAEC,MAAAA,EAAQ;AAAK,iBAAA;gBACtBC,IAAAA,EAAM;oBAAED,MAAAA,EAAQL;AAAc;AAChC,aAAA,CAAA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AA;AACD,aAAA,CAAA;AACH,QAAA;AACF,IAAA;AACF;;;;;"}
@@ -1,7 +1,6 @@
1
1
  // if i18N enabled set default locale
2
2
  const enableI18n = async ({ oldContentTypes, contentTypes })=>{
3
- const { isLocalizedContentType } = strapi.plugin('i18n')?.service('content-types') ?? {};
4
- const { getDefaultLocale } = strapi.plugin('i18n')?.service('locales') ?? {};
3
+ const { isLocalizedContentType, getDefaultLocale } = strapi.localization;
5
4
  if (!oldContentTypes) {
6
5
  return;
7
6
  }
@@ -25,8 +24,7 @@ const enableI18n = async ({ oldContentTypes, contentTypes })=>{
25
24
  }
26
25
  };
27
26
  const disableI18n = async ({ oldContentTypes, contentTypes })=>{
28
- const { isLocalizedContentType } = strapi.plugin('i18n')?.service('content-types') ?? {};
29
- const { getDefaultLocale } = strapi.plugin('i18n')?.service('locales') ?? {};
27
+ const { isLocalizedContentType, getDefaultLocale } = strapi.localization;
30
28
  if (!oldContentTypes) {
31
29
  return;
32
30
  }
@@ -39,6 +37,10 @@ const disableI18n = async ({ oldContentTypes, contentTypes })=>{
39
37
  // if i18N is disabled remove non default locales before sync
40
38
  if (isLocalizedContentType(oldContentType) && !isLocalizedContentType(contentType)) {
41
39
  const defaultLocale = await getDefaultLocale();
40
+ // `$ne: null` would match every localized row and delete them all
41
+ if (defaultLocale === null) {
42
+ throw new Error(`Cannot disable localization for "${uid}": no default locale is set, so non-default rows cannot be identified.`);
43
+ }
42
44
  await Promise.all([
43
45
  // Delete all entities that are not in the default locale
44
46
  strapi.db.query(uid).deleteMany({
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.mjs","sources":["../../src/migrations/i18n.ts"],"sourcesContent":["import { Input } from './draft-publish';\n\n// if i18N enabled set default locale\nconst enableI18n = async ({ oldContentTypes, contentTypes }: Input) => {\n const { isLocalizedContentType } = strapi.plugin('i18n')?.service('content-types') ?? {};\n const { getDefaultLocale } = strapi.plugin('i18n')?.service('locales') ?? {};\n\n if (!oldContentTypes) {\n return;\n }\n\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const oldContentType = oldContentTypes[uid];\n const contentType = contentTypes[uid];\n\n if (!isLocalizedContentType(oldContentType) && isLocalizedContentType(contentType)) {\n const defaultLocale = await getDefaultLocale();\n\n await strapi.db.query(uid).updateMany({\n where: { locale: null },\n data: { locale: defaultLocale },\n });\n }\n }\n};\n\nconst disableI18n = async ({ oldContentTypes, contentTypes }: Input) => {\n const { isLocalizedContentType } = strapi.plugin('i18n')?.service('content-types') ?? {};\n const { getDefaultLocale } = strapi.plugin('i18n')?.service('locales') ?? {};\n\n if (!oldContentTypes) {\n return;\n }\n\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const oldContentType = oldContentTypes[uid];\n const contentType = contentTypes[uid];\n\n // if i18N is disabled remove non default locales before sync\n if (isLocalizedContentType(oldContentType) && !isLocalizedContentType(contentType)) {\n const defaultLocale = await getDefaultLocale();\n\n await Promise.all([\n // Delete all entities that are not in the default locale\n strapi.db.query(uid).deleteMany({\n where: { locale: { $ne: defaultLocale } },\n }),\n // Set locale to null for the rest\n strapi.db.query(uid).updateMany({\n where: { locale: { $eq: defaultLocale } },\n data: { locale: null },\n }),\n ]);\n }\n }\n};\n\nexport { enableI18n as enable, disableI18n as disable };\n"],"names":["enableI18n","oldContentTypes","contentTypes","isLocalizedContentType","strapi","plugin","service","getDefaultLocale","uid","oldContentType","contentType","defaultLocale","db","query","updateMany","where","locale","data","disableI18n","Promise","all","deleteMany","$ne","$eq"],"mappings":"AAEA;AACA,MAAMA,aAAa,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;IAChE,MAAM,EAAEC,sBAAsB,EAAE,GAAGC,MAAAA,CAAOC,MAAM,CAAC,MAAA,CAAA,EAASC,OAAAA,CAAQ,eAAA,CAAA,IAAoB,EAAC;IACvF,MAAM,EAAEC,gBAAgB,EAAE,GAAGH,MAAAA,CAAOC,MAAM,CAAC,MAAA,CAAA,EA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AA,GAAiBR,eAAe,CAACO,GAAAA,CAAI;QAC3C,MAAME,WAAAA,GAAcR,YAAY,CAACM,GAAAA,CAAI;;AAGrC,QAAA,IAAIL,sBAAAA,CAAuBM,cAAAA,CAAAA,IAAmB,CAACN,sBAAAA,CAAuBO,WAAAA,CAAAA,EAAc;AAClF,YAAA,MAAMC,gBAAgB,MAAMJ,gBAAAA,EAAAA;YAE5B,MAAMY,OAAAA,CAAQC,GAAG,CAAC;;AAEhBhB,gBAAAA,MAAAA,CAAOQ,EAAE,CAACC,KAAK,CAACL,GAAAA,CAAAA,CAAKa,UAAU,CAAC;oBAC9BN,KAAAA,EAAO;wBAAEC,MAAAA,EAAQ;4BAAEM,GAAAA,EAAKX;AAAc;AAAE;AAC1C,iBAAA,CAAA;;AAEAP,gBAAAA,MAAAA,CAAOQ,EAAE,CAACC,KAAK,CAACL,GAAAA,CAAAA,CAAKM,UAAU,CAAC;oBAC9BC,KAAAA,EAAO;wBAAEC,MAAAA,EAAQ;4BAAEO,GAAAA,EAAKZ;AAAc;AAAE,qBAAA;oBACxCM,IAAAA,EAAM;wBAAED,MAAAA,EAAQ;AAAK;AACvB,iBAAA;AACD,aAAA,CAAA;AACH,QAAA;AACF,IAAA;AACF;;;;"}
1
+ {"version":3,"file":"i18n.mjs","sources":["../../src/migrations/i18n.ts"],"sourcesContent":["import { Input } from './draft-publish';\n\n// if i18N enabled set default locale\nconst enableI18n = async ({ oldContentTypes, contentTypes }: Input) => {\n const { isLocalizedContentType, getDefaultLocale } = strapi.localization;\n\n if (!oldContentTypes) {\n return;\n }\n\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const oldContentType = oldContentTypes[uid];\n const contentType = contentTypes[uid];\n\n if (!isLocalizedContentType(oldContentType) && isLocalizedContentType(contentType)) {\n const defaultLocale = await getDefaultLocale();\n\n await strapi.db.query(uid).updateMany({\n where: { locale: null },\n data: { locale: defaultLocale },\n });\n }\n }\n};\n\nconst disableI18n = async ({ oldContentTypes, contentTypes }: Input) => {\n const { isLocalizedContentType, getDefaultLocale } = strapi.localization;\n\n if (!oldContentTypes) {\n return;\n }\n\n for (const uid in contentTypes) {\n if (!oldContentTypes[uid]) {\n continue;\n }\n\n const oldContentType = oldContentTypes[uid];\n const contentType = contentTypes[uid];\n\n // if i18N is disabled remove non default locales before sync\n if (isLocalizedContentType(oldContentType) && !isLocalizedContentType(contentType)) {\n const defaultLocale = await getDefaultLocale();\n\n // `$ne: null` would match every localized row and delete them all\n if (defaultLocale === null) {\n throw new Error(\n `Cannot disable localization for \"${uid}\": no default locale is set, so non-default rows cannot be identified.`\n );\n }\n\n await Promise.all([\n // Delete all entities that are not in the default locale\n strapi.db.query(uid).deleteMany({\n where: { locale: { $ne: defaultLocale } },\n }),\n // Set locale to null for the rest\n strapi.db.query(uid).updateMany({\n where: { locale: { $eq: defaultLocale } },\n data: { locale: null },\n }),\n ]);\n }\n }\n};\n\nexport { enableI18n as enable, disableI18n as disable };\n"],"names":["enableI18n","oldContentTypes","contentTypes","isLocalizedContentType","getDefaultLocale","strapi","localization","uid","oldContentType","contentType","defaultLocale","db","query","updateMany","where","locale","data","disableI18n","Error","Promise","all","deleteMany","$ne","$eq"],"mappings":"AAEA;AACA,MAAMA,aAAa,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAS,GAAA;AAChE,IAAA,MAAM,EAAEC,sBAAsB,EAAEC,gBAAgB,EAAE,GAAGC,OAAOC,YAAY;AAExE,IAAA,IAAI,CAACL,eAAAA,EAAiB;AACpB,QAAA;AACF,IAAA;IAEA,IAAK,MAAMM,OAAOL,YAAAA,CAAc;AAC9B,QAAA,IAAI,CAACD,eAAe,CAACM,GAAAA,CAAI,EAAE;AACzB,YAAA;AACF,QAAA;QAEA,MAAMC,cAAAA,GAAiBP,eAAe,CAACM,GAAAA,CAAI;QAC3C,MAAME,WAAAA,GAAcP,YAAY,CAACK,GAAAA,CAAI;AAErC,QAAA,IAAI,CAACJ,sBAAAA,CAAuBK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AAO;wBAAEC,MAAAA,EAAQ;4BAAEO,GAAAA,EAAKZ;AAAc;AAAE;AAC1C,iBAAA,CAAA;;AAEAL,gBAAAA,MAAAA,CAAOM,EAAE,CAACC,KAAK,CAACL,GAAAA,CAAAA,CAAKM,UAAU,CAAC;oBAC9BC,KAAAA,EAAO;wBAAEC,MAAAA,EAAQ;4BAAEQ,GAAAA,EAAKb;AAAc;AAAE,qBAAA;oBACxCM,IAAAA,EAAM;wBAAED,MAAAA,EAAQ;AAAK;AACvB,iBAAA;AACD,aAAA,CAAA;AACH,QAAA;AACF,IAAA;AACF;;;;"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var name = "@strapi/core";
6
- var version = "5.56.0";
6
+ var version = "5.58.0";
7
7
  var description = "Core of Strapi";
8
8
  var homepage = "https://strapi.io";
9
9
  var bugs = {
@@ -63,18 +63,18 @@ var dependencies = {
63
63
  "@casl/ability": "6.7.5",
64
64
  "@koa/cors": "5.0.0",
65
65
  "@koa/router": "12.0.2",
66
- "@modelcontextprotocol/node": "2.0.0",
67
- "@modelcontextprotocol/server": "2.0.0",
66
+ "@modelcontextprotocol/node": "2.1.1",
67
+ "@modelcontextprotocol/server": "2.3.1",
68
68
  "@paralleldrive/cuid2": "2.2.2",
69
- "@strapi/admin": "5.56.0",
70
- "@strapi/database": "5.56.0",
71
- "@strapi/generators": "5.56.0",
72
- "@strapi/logger": "5.56.0",
73
- "@strapi/openapi": "5.56.0",
74
- "@strapi/permissions": "5.56.0",
75
- "@strapi/types": "5.56.0",
76
- "@strapi/typescript-utils": "5.56.0",
77
- "@strapi/utils": "5.56.0",
69
+ "@strapi/admin": "5.58.0",
70
+ "@strapi/database": "5.58.0",
71
+ "@strapi/generators": "5.58.0",
72
+ "@strapi/logger": "5.58.0",
73
+ "@strapi/openapi": "5.58.0",
74
+ "@strapi/permissions": "5.58.0",
75
+ "@strapi/types": "5.58.0",
76
+ "@strapi/typescript-utils": "5.58.0",
77
+ "@strapi/utils": "5.58.0",
78
78
  "@vercel/stega": "0.1.2",
79
79
  bcryptjs: "2.4.3",
80
80
  boxen: "5.1.2",
@@ -121,7 +121,7 @@ var dependencies = {
121
121
  zod: "4.4.3"
122
122
  };
123
123
  var devDependencies = {
124
- "@modelcontextprotocol/client": "2.0.0",
124
+ "@modelcontextprotocol/client": "2.3.1",
125
125
  "@swc/core": "1.13.5",
126
126
  "@types/bcryptjs": "2.4.3",
127
127
  "@types/configstore": "5.0.1",
@@ -140,12 +140,12 @@ var devDependencies = {
140
140
  "@types/node": "20.19.41",
141
141
  ajv: "8.20.0",
142
142
  "ajv-formats": "3.0.1",
143
- "eslint-config-custom": "5.56.0",
143
+ "eslint-config-custom": "5.58.0",
144
144
  jest: "29.6.0",
145
145
  supertest: "7.2.2",
146
- tsconfig: "5.56.0",
146
+ tsconfig: "5.58.0",
147
147
  vitest: "catalog:",
148
- "vitest-config": "5.56.0"
148
+ "vitest-config": "5.58.0"
149
149
  };
150
150
  var engines = {
151
151
  node: ">=20.0.0 <=26.x.x",
@@ -1,5 +1,5 @@
1
1
  var name = "@strapi/core";
2
- var version = "5.56.0";
2
+ var version = "5.58.0";
3
3
  var description = "Core of Strapi";
4
4
  var homepage = "https://strapi.io";
5
5
  var bugs = {
@@ -59,18 +59,18 @@ var dependencies = {
59
59
  "@casl/ability": "6.7.5",
60
60
  "@koa/cors": "5.0.0",
61
61
  "@koa/router": "12.0.2",
62
- "@modelcontextprotocol/node": "2.0.0",
63
- "@modelcontextprotocol/server": "2.0.0",
62
+ "@modelcontextprotocol/node": "2.1.1",
63
+ "@modelcontextprotocol/server": "2.3.1",
64
64
  "@paralleldrive/cuid2": "2.2.2",
65
- "@strapi/admin": "5.56.0",
66
- "@strapi/database": "5.56.0",
67
- "@strapi/generators": "5.56.0",
68
- "@strapi/logger": "5.56.0",
69
- "@strapi/openapi": "5.56.0",
70
- "@strapi/permissions": "5.56.0",
71
- "@strapi/types": "5.56.0",
72
- "@strapi/typescript-utils": "5.56.0",
73
- "@strapi/utils": "5.56.0",
65
+ "@strapi/admin": "5.58.0",
66
+ "@strapi/database": "5.58.0",
67
+ "@strapi/generators": "5.58.0",
68
+ "@strapi/logger": "5.58.0",
69
+ "@strapi/openapi": "5.58.0",
70
+ "@strapi/permissions": "5.58.0",
71
+ "@strapi/types": "5.58.0",
72
+ "@strapi/typescript-utils": "5.58.0",
73
+ "@strapi/utils": "5.58.0",
74
74
  "@vercel/stega": "0.1.2",
75
75
  bcryptjs: "2.4.3",
76
76
  boxen: "5.1.2",
@@ -117,7 +117,7 @@ var dependencies = {
117
117
  zod: "4.4.3"
118
118
  };
119
119
  var devDependencies = {
120
- "@modelcontextprotocol/client": "2.0.0",
120
+ "@modelcontextprotocol/client": "2.3.1",
121
121
  "@swc/core": "1.13.5",
122
122
  "@types/bcryptjs": "2.4.3",
123
123
  "@types/configstore": "5.0.1",
@@ -136,12 +136,12 @@ var devDependencies = {
136
136
  "@types/node": "20.19.41",
137
137
  ajv: "8.20.0",
138
138
  "ajv-formats": "3.0.1",
139
- "eslint-config-custom": "5.56.0",
139
+ "eslint-config-custom": "5.58.0",
140
140
  jest: "29.6.0",
141
141
  supertest: "7.2.2",
142
- tsconfig: "5.56.0",
142
+ tsconfig: "5.58.0",
143
143
  vitest: "catalog:",
144
- "vitest-config": "5.56.0"
144
+ "vitest-config": "5.58.0"
145
145
  };
146
146
  var engines = {
147
147
  node: ">=20.0.0 <=26.x.x",
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var fp = require('lodash/fp');
3
+ var _ = require('lodash');
4
4
 
5
5
  const apisRegistry = (strapi)=>{
6
6
  const apis = {};
@@ -12,7 +12,7 @@ const apisRegistry = (strapi)=>{
12
12
  return apis;
13
13
  },
14
14
  add (apiName, apiConfig) {
15
- if (fp.has(apiName, apis)) {
15
+ if (_.has(apis, apiName)) {
16
16
  throw new Error(`API ${apiName} has already been registered.`);
17
17
  }
18
18
  const api = strapi.get('modules').add(`api::${apiName}`, apiConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"apis.js","sources":["../../src/registries/apis.ts"],"sourcesContent":["import { has } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\n\nconst apisRegistry = (strapi: Core.Strapi) => {\n const apis: Record<string, unknown> = {};\n\n return {\n get(name: string) {\n return apis[name];\n },\n getAll() {\n return apis;\n },\n add(apiName: string, apiConfig: unknown) {\n if (has(apiName, apis)) {\n throw new Error(`API ${apiName} has already been registered.`);\n }\n\n const api = strapi.get('modules').add(`api::${apiName}`, apiConfig);\n\n apis[apiName] = api;\n\n return apis[apiName];\n },\n };\n};\n\nexport default apisRegistry;\n"],"names":["apisRegistry","strapi","apis","get","name","getAll","add","apiName","apiConfig","has","Error","api"],"mappings":";;;;AAGA,MAAMA,eAAe,CAACC,MAAAA,GAAAA;AACpB,IAAA,MAAMC,OAAgC,EAAC;IAEvC,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,IAAI,CAACE,IAAAA,CAAK;AACnB,QAAA,CAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,IAAAA;AACT,QAAA,CAAA;QACAI,GAAAA,CAAAA,CAAIC,OAAe,EAAEC,SAAkB,EAAA;YACrC,IAAIC,MAAAA,CAAIF,SAASL,IAAAA,CAAAA,EAAO;AACtB,gBAAA,MAAM,IAAIQ,KAAAA,CAAM,CAAC,IAAI,EAAEH,OAAAA,CAAQ,6BAA6B,CAAC,CAAA;AAC/D,YAAA;YAEA,MAAMI,GAAAA,GAAMV,MAAAA,CAAOE,GAAG,CAAC,SAAA,CAAA,CAAWG,GAAG,CAAC,CAAC,KAAK,EAAEC,OAAAA,CAAAA,CAAS,EAAEC,SAAAA,CAAAA;YAEzDN,IAAI,CAACK,QAAQ,GAAGI,GAAAA;YAEhB,OAAOT,IAAI,CAACK,OAAAA,CAAQ;AACtB,QAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"apis.js","sources":["../../src/registries/apis.ts"],"sourcesContent":["import { has } from 'lodash';\nimport type { Core } from '@strapi/types';\n\nconst apisRegistry = (strapi: Core.Strapi) => {\n const apis: Record<string, unknown> = {};\n\n return {\n get(name: string) {\n return apis[name];\n },\n getAll() {\n return apis;\n },\n add(apiName: string, apiConfig: unknown) {\n if (has(apis, apiName)) {\n throw new Error(`API ${apiName} has already been registered.`);\n }\n\n const api = strapi.get('modules').add(`api::${apiName}`, apiConfig);\n\n apis[apiName] = api;\n\n return apis[apiName];\n },\n };\n};\n\nexport default apisRegistry;\n"],"names":["apisRegistry","strapi","apis","get","name","getAll","add","apiName","apiConfig","has","Error","api"],"mappings":";;;;AAGA,MAAMA,eAAe,CAACC,MAAAA,GAAAA;AACpB,IAAA,MAAMC,OAAgC,EAAC;IAEvC,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,IAAI,CAACE,IAAAA,CAAK;AACnB,QAAA,CAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,IAAAA;AACT,QAAA,CAAA;QACAI,GAAAA,CAAAA,CAAIC,OAAe,EAAEC,SAAkB,EAAA;YACrC,IAAIC,KAAAA,CAAIP,MAAMK,OAAAA,CAAAA,EAAU;AACtB,gBAAA,MAAM,IAAIG,KAAAA,CAAM,CAAC,IAAI,EAAEH,OAAAA,CAAQ,6BAA6B,CAAC,CAAA;AAC/D,YAAA;YAEA,MAAMI,GAAAA,GAAMV,MAAAA,CAAOE,GAAG,CAAC,SAAA,CAAA,CAAWG,GAAG,CAAC,CAAC,KAAK,EAAEC,OAAAA,CAAAA,CAAS,EAAEC,SAAAA,CAAAA;YAEzDN,IAAI,CAACK,QAAQ,GAAGI,GAAAA;YAEhB,OAAOT,IAAI,CAACK,OAAAA,CAAQ;AACtB,QAAA;AACF,KAAA;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import { has } from 'lodash/fp';
1
+ import { has } from 'lodash';
2
2
 
3
3
  const apisRegistry = (strapi)=>{
4
4
  const apis = {};
@@ -10,7 +10,7 @@ const apisRegistry = (strapi)=>{
10
10
  return apis;
11
11
  },
12
12
  add (apiName, apiConfig) {
13
- if (has(apiName, apis)) {
13
+ if (has(apis, apiName)) {
14
14
  throw new Error(`API ${apiName} has already been registered.`);
15
15
  }
16
16
  const api = strapi.get('modules').add(`api::${apiName}`, apiConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"apis.mjs","sources":["../../src/registries/apis.ts"],"sourcesContent":["import { has } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\n\nconst apisRegistry = (strapi: Core.Strapi) => {\n const apis: Record<string, unknown> = {};\n\n return {\n get(name: string) {\n return apis[name];\n },\n getAll() {\n return apis;\n },\n add(apiName: string, apiConfig: unknown) {\n if (has(apiName, apis)) {\n throw new Error(`API ${apiName} has already been registered.`);\n }\n\n const api = strapi.get('modules').add(`api::${apiName}`, apiConfig);\n\n apis[apiName] = api;\n\n return apis[apiName];\n },\n };\n};\n\nexport default apisRegistry;\n"],"names":["apisRegistry","strapi","apis","get","name","getAll","add","apiName","apiConfig","has","Error","api"],"mappings":";;AAGA,MAAMA,eAAe,CAACC,MAAAA,GAAAA;AACpB,IAAA,MAAMC,OAAgC,EAAC;IAEvC,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,IAAI,CAACE,IAAAA,CAAK;AACnB,QAAA,CAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,IAAAA;AACT,QAAA,CAAA;QACAI,GAAAA,CAAAA,CAAIC,OAAe,EAAEC,SAAkB,EAAA;YACrC,IAAIC,GAAAA,CAAIF,SAASL,IAAAA,CAAAA,EAAO;AACtB,gBAAA,MAAM,IAAIQ,KAAAA,CAAM,CAAC,IAAI,EAAEH,OAAAA,CAAQ,6BAA6B,CAAC,CAAA;AAC/D,YAAA;YAEA,MAAMI,GAAAA,GAAMV,MAAAA,CAAOE,GAAG,CAAC,SAAA,CAAA,CAAWG,GAAG,CAAC,CAAC,KAAK,EAAEC,OAAAA,CAAAA,CAAS,EAAEC,SAAAA,CAAAA;YAEzDN,IAAI,CAACK,QAAQ,GAAGI,GAAAA;YAEhB,OAAOT,IAAI,CAACK,OAAAA,CAAQ;AACtB,QAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"apis.mjs","sources":["../../src/registries/apis.ts"],"sourcesContent":["import { has } from 'lodash';\nimport type { Core } from '@strapi/types';\n\nconst apisRegistry = (strapi: Core.Strapi) => {\n const apis: Record<string, unknown> = {};\n\n return {\n get(name: string) {\n return apis[name];\n },\n getAll() {\n return apis;\n },\n add(apiName: string, apiConfig: unknown) {\n if (has(apis, apiName)) {\n throw new Error(`API ${apiName} has already been registered.`);\n }\n\n const api = strapi.get('modules').add(`api::${apiName}`, apiConfig);\n\n apis[apiName] = api;\n\n return apis[apiName];\n },\n };\n};\n\nexport default apisRegistry;\n"],"names":["apisRegistry","strapi","apis","get","name","getAll","add","apiName","apiConfig","has","Error","api"],"mappings":";;AAGA,MAAMA,eAAe,CAACC,MAAAA,GAAAA;AACpB,IAAA,MAAMC,OAAgC,EAAC;IAEvC,OAAO;AACLC,QAAAA,GAAAA,CAAAA,CAAIC,IAAY,EAAA;YACd,OAAOF,IAAI,CAACE,IAAAA,CAAK;AACnB,QAAA,CAAA;AACAC,QAAAA,MAAAA,CAAAA,GAAAA;YACE,OAAOH,IAAAA;AACT,QAAA,CAAA;QACAI,GAAAA,CAAAA,CAAIC,OAAe,EAAEC,SAAkB,EAAA;YACrC,IAAIC,GAAAA,CAAIP,MAAMK,OAAAA,CAAAA,EAAU;AACtB,gBAAA,MAAM,IAAIG,KAAAA,CAAM,CAAC,IAAI,EAAEH,OAAAA,CAAQ,6BAA6B,CAAC,CAAA;AAC/D,YAAA;YAEA,MAAMI,GAAAA,GAAMV,MAAAA,CAAOE,GAAG,CAAC,SAAA,CAAA,CAAWG,GAAG,CAAC,CAAC,KAAK,EAAEC,OAAAA,CAAAA,CAAS,EAAEC,SAAAA,CAAAA;YAEzDN,IAAI,CAACK,QAAQ,GAAGI,GAAAA;YAEhB,OAAOT,IAAI,CAACK,OAAAA,CAAQ;AACtB,QAAA;AACF,KAAA;AACF;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var fp = require('lodash/fp');
3
+ var _ = require('lodash');
4
4
 
5
5
  const componentsRegistry = ()=>{
6
6
  const components = {};
@@ -23,7 +23,7 @@ const componentsRegistry = ()=>{
23
23
  /**
24
24
  * Registers a component
25
25
  */ set (uid, component) {
26
- if (fp.has(uid, components)) {
26
+ if (_.has(components, uid)) {
27
27
  throw new Error(`Component ${uid} has already been registered.`);
28
28
  }
29
29
  components[uid] = component;
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sources":["../../src/registries/components.ts"],"sourcesContent":["import { has } from 'lodash/fp';\nimport type { Struct, UID } from '@strapi/types';\n\nconst componentsRegistry = () => {\n const components: Record<UID.Component, Struct.ComponentSchema> = {};\n\n return {\n /**\n * Returns this list of registered components uids\n */\n keys(): UID.Component[] {\n return Object.keys(components) as UID.Component[];\n },\n\n /**\n * Returns the instance of a component. Instantiate the component if not already done\n */\n get(uid: UID.Component) {\n return components[uid];\n },\n\n /**\n * Returns a map with all the components in a namespace\n */\n getAll() {\n return components;\n },\n\n /**\n * Registers a component\n */\n set(uid: UID.Component, component: Struct.ComponentSchema) {\n if (has(uid, components)) {\n throw new Error(`Component ${uid} has already been registered.`);\n }\n\n components[uid] = component;\n\n return this;\n },\n\n /**\n * Registers a map of components for a specific namespace\n */\n add(newComponents: Record<UID.Component, Struct.ComponentSchema>) {\n for (const uid of Object.keys(newComponents) as UID.Component[]) {\n this.set(uid, newComponents[uid]);\n }\n },\n };\n};\n\nexport default componentsRegistry;\n"],"names":["componentsRegistry","components","keys","Object","get","uid","getAll","set","component","has","Error","add","newComponents"],"mappings":";;;;AAGA,MAAMA,kBAAAA,GAAqB,IAAA;AACzB,IAAA,MAAMC,aAA4D,EAAC;IAEnE,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;YACE,OAAOC,MAAAA,CAAOD,IAAI,CAACD,UAAAA,CAAAA;AACrB,QAAA,CAAA;AAEA;;AAEC,QACDG,KAAIC,GAAkB,EAAA;YACpB,OAAOJ,UAAU,CAACI,GAAAA,CAAI;AACxB,QAAA,CAAA;AAEA;;QAGAC,MAAAA,CAAAA,GAAAA;YACE,OAAOL,UAAAA;AACT,QAAA,CAAA;AAEA;;QAGAM,GAAAA,CAAAA,CAAIF,GAAkB,EAAEG,SAAiC,EAAA;YACvD,IAAIC,MAAAA,CAAIJ,KAAKJ,UAAAA,CAAAA,EAAa;AACxB,gBAAA,MAAM,IAAIS,KAAAA,CAAM,CAAC,UAAU,EAAEL,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AACjE,YAAA;YAEAJ,UAAU,CAACI,IAAI,GAAGG,SAAAA;AAElB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA;;AAEC,QACDG,KAAIC,aAA4D,EAAA;AAC9D,YAAA,KAAK,MAAMP,GAAAA,IAAOF,MAAAA,CAAOD,IAAI,CAACU,aAAAA,CAAAA,CAAmC;AAC/D,gBAAA,IAAI,CAACL,GAAG,CAACF,GAAAA,EAAKO,aAAa,CAACP,GAAAA,CAAI,CAAA;AAClC,YAAA;AACF,QAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"components.js","sources":["../../src/registries/components.ts"],"sourcesContent":["import { has } from 'lodash';\nimport type { Struct, UID } from '@strapi/types';\n\nconst componentsRegistry = () => {\n const components: Record<UID.Component, Struct.ComponentSchema> = {};\n\n return {\n /**\n * Returns this list of registered components uids\n */\n keys(): UID.Component[] {\n return Object.keys(components) as UID.Component[];\n },\n\n /**\n * Returns the instance of a component. Instantiate the component if not already done\n */\n get(uid: UID.Component) {\n return components[uid];\n },\n\n /**\n * Returns a map with all the components in a namespace\n */\n getAll() {\n return components;\n },\n\n /**\n * Registers a component\n */\n set(uid: UID.Component, component: Struct.ComponentSchema) {\n if (has(components, uid)) {\n throw new Error(`Component ${uid} has already been registered.`);\n }\n\n components[uid] = component;\n\n return this;\n },\n\n /**\n * Registers a map of components for a specific namespace\n */\n add(newComponents: Record<UID.Component, Struct.ComponentSchema>) {\n for (const uid of Object.keys(newComponents) as UID.Component[]) {\n this.set(uid, newComponents[uid]);\n }\n },\n };\n};\n\nexport default componentsRegistry;\n"],"names":["componentsRegistry","components","keys","Object","get","uid","getAll","set","component","has","Error","add","newComponents"],"mappings":";;;;AAGA,MAAMA,kBAAAA,GAAqB,IAAA;AACzB,IAAA,MAAMC,aAA4D,EAAC;IAEnE,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;YACE,OAAOC,MAAAA,CAAOD,IAAI,CAACD,UAAAA,CAAAA;AACrB,QAAA,CAAA;AAEA;;AAEC,QACDG,KAAIC,GAAkB,EAAA;YACpB,OAAOJ,UAAU,CAACI,GAAAA,CAAI;AACxB,QAAA,CAAA;AAEA;;QAGAC,MAAAA,CAAAA,GAAAA;YACE,OAAOL,UAAAA;AACT,QAAA,CAAA;AAEA;;QAGAM,GAAAA,CAAAA,CAAIF,GAAkB,EAAEG,SAAiC,EAAA;YACvD,IAAIC,KAAAA,CAAIR,YAAYI,GAAAA,CAAAA,EAAM;AACxB,gBAAA,MAAM,IAAIK,KAAAA,CAAM,CAAC,UAAU,EAAEL,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AACjE,YAAA;YAEAJ,UAAU,CAACI,IAAI,GAAGG,SAAAA;AAElB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA;;AAEC,QACDG,KAAIC,aAA4D,EAAA;AAC9D,YAAA,KAAK,MAAMP,GAAAA,IAAOF,MAAAA,CAAOD,IAAI,CAACU,aAAAA,CAAAA,CAAmC;AAC/D,gBAAA,IAAI,CAACL,GAAG,CAACF,GAAAA,EAAKO,aAAa,CAACP,GAAAA,CAAI,CAAA;AAClC,YAAA;AACF,QAAA;AACF,KAAA;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import { has } from 'lodash/fp';
1
+ import { has } from 'lodash';
2
2
 
3
3
  const componentsRegistry = ()=>{
4
4
  const components = {};
@@ -21,7 +21,7 @@ const componentsRegistry = ()=>{
21
21
  /**
22
22
  * Registers a component
23
23
  */ set (uid, component) {
24
- if (has(uid, components)) {
24
+ if (has(components, uid)) {
25
25
  throw new Error(`Component ${uid} has already been registered.`);
26
26
  }
27
27
  components[uid] = component;
@@ -1 +1 @@
1
- {"version":3,"file":"components.mjs","sources":["../../src/registries/components.ts"],"sourcesContent":["import { has } from 'lodash/fp';\nimport type { Struct, UID } from '@strapi/types';\n\nconst componentsRegistry = () => {\n const components: Record<UID.Component, Struct.ComponentSchema> = {};\n\n return {\n /**\n * Returns this list of registered components uids\n */\n keys(): UID.Component[] {\n return Object.keys(components) as UID.Component[];\n },\n\n /**\n * Returns the instance of a component. Instantiate the component if not already done\n */\n get(uid: UID.Component) {\n return components[uid];\n },\n\n /**\n * Returns a map with all the components in a namespace\n */\n getAll() {\n return components;\n },\n\n /**\n * Registers a component\n */\n set(uid: UID.Component, component: Struct.ComponentSchema) {\n if (has(uid, components)) {\n throw new Error(`Component ${uid} has already been registered.`);\n }\n\n components[uid] = component;\n\n return this;\n },\n\n /**\n * Registers a map of components for a specific namespace\n */\n add(newComponents: Record<UID.Component, Struct.ComponentSchema>) {\n for (const uid of Object.keys(newComponents) as UID.Component[]) {\n this.set(uid, newComponents[uid]);\n }\n },\n };\n};\n\nexport default componentsRegistry;\n"],"names":["componentsRegistry","components","keys","Object","get","uid","getAll","set","component","has","Error","add","newComponents"],"mappings":";;AAGA,MAAMA,kBAAAA,GAAqB,IAAA;AACzB,IAAA,MAAMC,aAA4D,EAAC;IAEnE,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;YACE,OAAOC,MAAAA,CAAOD,IAAI,CAACD,UAAAA,CAAAA;AACrB,QAAA,CAAA;AAEA;;AAEC,QACDG,KAAIC,GAAkB,EAAA;YACpB,OAAOJ,UAAU,CAACI,GAAAA,CAAI;AACxB,QAAA,CAAA;AAEA;;QAGAC,MAAAA,CAAAA,GAAAA;YACE,OAAOL,UAAAA;AACT,QAAA,CAAA;AAEA;;QAGAM,GAAAA,CAAAA,CAAIF,GAAkB,EAAEG,SAAiC,EAAA;YACvD,IAAIC,GAAAA,CAAIJ,KAAKJ,UAAAA,CAAAA,EAAa;AACxB,gBAAA,MAAM,IAAIS,KAAAA,CAAM,CAAC,UAAU,EAAEL,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AACjE,YAAA;YAEAJ,UAAU,CAACI,IAAI,GAAGG,SAAAA;AAElB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA;;AAEC,QACDG,KAAIC,aAA4D,EAAA;AAC9D,YAAA,KAAK,MAAMP,GAAAA,IAAOF,MAAAA,CAAOD,IAAI,CAACU,aAAAA,CAAAA,CAAmC;AAC/D,gBAAA,IAAI,CAACL,GAAG,CAACF,GAAAA,EAAKO,aAAa,CAACP,GAAAA,CAAI,CAAA;AAClC,YAAA;AACF,QAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"components.mjs","sources":["../../src/registries/components.ts"],"sourcesContent":["import { has } from 'lodash';\nimport type { Struct, UID } from '@strapi/types';\n\nconst componentsRegistry = () => {\n const components: Record<UID.Component, Struct.ComponentSchema> = {};\n\n return {\n /**\n * Returns this list of registered components uids\n */\n keys(): UID.Component[] {\n return Object.keys(components) as UID.Component[];\n },\n\n /**\n * Returns the instance of a component. Instantiate the component if not already done\n */\n get(uid: UID.Component) {\n return components[uid];\n },\n\n /**\n * Returns a map with all the components in a namespace\n */\n getAll() {\n return components;\n },\n\n /**\n * Registers a component\n */\n set(uid: UID.Component, component: Struct.ComponentSchema) {\n if (has(components, uid)) {\n throw new Error(`Component ${uid} has already been registered.`);\n }\n\n components[uid] = component;\n\n return this;\n },\n\n /**\n * Registers a map of components for a specific namespace\n */\n add(newComponents: Record<UID.Component, Struct.ComponentSchema>) {\n for (const uid of Object.keys(newComponents) as UID.Component[]) {\n this.set(uid, newComponents[uid]);\n }\n },\n };\n};\n\nexport default componentsRegistry;\n"],"names":["componentsRegistry","components","keys","Object","get","uid","getAll","set","component","has","Error","add","newComponents"],"mappings":";;AAGA,MAAMA,kBAAAA,GAAqB,IAAA;AACzB,IAAA,MAAMC,aAA4D,EAAC;IAEnE,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;YACE,OAAOC,MAAAA,CAAOD,IAAI,CAACD,UAAAA,CAAAA;AACrB,QAAA,CAAA;AAEA;;AAEC,QACDG,KAAIC,GAAkB,EAAA;YACpB,OAAOJ,UAAU,CAACI,GAAAA,CAAI;AACxB,QAAA,CAAA;AAEA;;QAGAC,MAAAA,CAAAA,GAAAA;YACE,OAAOL,UAAAA;AACT,QAAA,CAAA;AAEA;;QAGAM,GAAAA,CAAAA,CAAIF,GAAkB,EAAEG,SAAiC,EAAA;YACvD,IAAIC,GAAAA,CAAIR,YAAYI,GAAAA,CAAAA,EAAM;AACxB,gBAAA,MAAM,IAAIK,KAAAA,CAAM,CAAC,UAAU,EAAEL,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AACjE,YAAA;YAEAJ,UAAU,CAACI,IAAI,GAAGG,SAAAA;AAElB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA;;AAEC,QACDG,KAAIC,aAA4D,EAAA;AAC9D,YAAA,KAAK,MAAMP,GAAAA,IAAOF,MAAAA,CAAOD,IAAI,CAACU,aAAAA,CAAAA,CAAmC;AAC/D,gBAAA,IAAI,CAACL,GAAG,CAACF,GAAAA,EAAKO,aAAa,CAACP,GAAAA,CAAI,CAAA;AAClC,YAAA;AACF,QAAA;AACF,KAAA;AACF;;;;"}
@@ -14,7 +14,7 @@ declare const contentTypesRegistry: () => {
14
14
  /**
15
15
  * Returns a map with all the contentTypes in a namespace
16
16
  */
17
- getAll(namespace: string): import("lodash").Dictionary<unknown>;
17
+ getAll(namespace: string): import("lodash").Dictionary<Struct.ContentTypeSchema>;
18
18
  /**
19
19
  * Registers a contentType
20
20
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var fp = require('lodash/fp');
3
+ var _ = require('lodash');
4
4
  var index = require('../domain/content-type/index.js');
5
5
  var namespace = require('./namespace.js');
6
6
 
@@ -28,7 +28,7 @@ const contentTypesRegistry = ()=>{
28
28
  /**
29
29
  * Returns a map with all the contentTypes in a namespace
30
30
  */ getAll (namespace$1) {
31
- return fp.pickBy((_, uid)=>namespace.hasNamespace(uid, namespace$1))(contentTypes);
31
+ return _.pickBy(contentTypes, (_, uid)=>namespace.hasNamespace(uid, namespace$1));
32
32
  },
33
33
  /**
34
34
  * Registers a contentType
@@ -42,7 +42,7 @@ const contentTypesRegistry = ()=>{
42
42
  validateKeySameToSingularName(newContentTypes);
43
43
  for (const rawCtName of Object.keys(newContentTypes)){
44
44
  const uid = namespace.addNamespace(rawCtName, namespace$1);
45
- if (fp.has(uid, contentTypes)) {
45
+ if (_.has(contentTypes, uid)) {
46
46
  throw new Error(`Content-type ${uid} has already been registered.`);
47
47
  }
48
48
  contentTypes[uid] = index.createContentType(uid, newContentTypes[rawCtName]);
@@ -1 +1 @@
1
- {"version":3,"file":"content-types.js","sources":["../../src/registries/content-types.ts"],"sourcesContent":["import { pickBy, has } from 'lodash/fp';\nimport type { UID, Struct } from '@strapi/types';\nimport { createContentType, ContentTypeDefinition } from '../domain/content-type';\nimport { addNamespace, hasNamespace } from './namespace';\n\ntype ContentTypesInput = Record<string, ContentTypeDefinition>;\ntype ContentTypeExtendFn = (contentType: Struct.ContentTypeSchema) => Struct.ContentTypeSchema;\n\nconst validateKeySameToSingularName = (contentTypes: ContentTypesInput) => {\n for (const ctName of Object.keys(contentTypes)) {\n const contentType = contentTypes[ctName];\n\n if (ctName !== contentType.schema.info.singularName) {\n throw new Error(\n `The key of the content-type should be the same as its singularName. Found ${ctName} and ${contentType.schema.info.singularName}.`\n );\n }\n }\n};\n\nconst contentTypesRegistry = () => {\n const contentTypes: Record<string, Struct.ContentTypeSchema> = {};\n\n return {\n /**\n * Returns this list of registered contentTypes uids\n */\n keys() {\n return Object.keys(contentTypes);\n },\n\n /**\n * Returns the instance of a contentType. Instantiate the contentType if not already done\n */\n get(uid: UID.ContentType) {\n return contentTypes[uid];\n },\n\n /**\n * Returns a map with all the contentTypes in a namespace\n */\n getAll(namespace: string) {\n return pickBy((_, uid) => hasNamespace(uid, namespace))(contentTypes);\n },\n\n /**\n * Registers a contentType\n */\n set(uid: UID.ContentType, contentType: Struct.ContentTypeSchema) {\n contentTypes[uid] = contentType;\n return this;\n },\n\n /**\n * Registers a map of contentTypes for a specific namespace\n */\n add(namespace: string, newContentTypes: ContentTypesInput) {\n validateKeySameToSingularName(newContentTypes);\n\n for (const rawCtName of Object.keys(newContentTypes)) {\n const uid = addNamespace(rawCtName, namespace);\n\n if (has(uid, contentTypes)) {\n throw new Error(`Content-type ${uid} has already been registered.`);\n }\n\n contentTypes[uid] = createContentType(uid, newContentTypes[rawCtName]);\n }\n },\n\n /**\n * Wraps a contentType to extend it\n */\n extend(ctUID: UID.ContentType, extendFn: ContentTypeExtendFn) {\n const currentContentType = this.get(ctUID);\n\n if (!currentContentType) {\n throw new Error(`Content-Type ${ctUID} doesn't exist`);\n }\n\n extendFn(currentContentType);\n\n return this;\n },\n };\n};\n\nexport default contentTypesRegistry;\n"],"names":["validateKeySameToSingularName","contentTypes","ctName","Object","keys","contentType","schema","info","singularName","Error","contentTypesRegistry","get","uid","getAll","namespace","pickBy","_","hasNamespace","set","add","newContentTypes","rawCtName","addNamespace","has","createContentType","extend","ctUID","extendFn","currentContentType"],"mappings":";;;;;;AAQA,MAAMA,gCAAgC,CAACC,YAAAA,GAAAA;AACrC,IAAA,KAAK,MAAMC,MAAAA,IAAUC,MAAAA,CAAOC,IAAI,CAACH,YAAAA,CAAAA,CAAe;QAC9C,MAAMI,WA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e;AAC1B,oBAAA,MAAM,IAAIQ,KAAAA,CAAM,CAAC,aAAa,EAAEG,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AACpE,gBAAA;AAEAX,gBAAAA,YAAY,CAACW,GAAAA,CAAI,GAAGY,wBAAkBZ,GAAAA,EAAKQ,eAAe,CAACC,SAAAA,CAAU,CAAA;AACvE,YAAA;AACF,QAAA,CAAA;AAEA;;QAGAI,MAAAA,CAAAA,CAAOC,KAAsB,EAAEC,QAA6B,EAAA;AAC1D,YAAA,MAAMC,kBAAAA,GAAqB,IAAI,CAACjB,GAAG,CAACe,KAAAA,CAAAA;AAEpC,YAAA,IAAI,CAACE,kBAAAA,EAAoB;AACvB,gBAAA,MAAM,IAAInB,KAAAA,CAAM,CAAC,aAAa,EAAEiB,KAAAA,CAAM,cAAc,CAAC,CAAA;AACvD,YAAA;YAEAC,QAAAA,CAASC,kBAAAA,CAAAA;AAET,YAAA,OAAO,IAAI;AACb,QAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"content-types.js","sources":["../../src/registries/content-types.ts"],"sourcesContent":["import { has, pickBy } from 'lodash';\nimport type { UID, Struct } from '@strapi/types';\nimport { createContentType, ContentTypeDefinition } from '../domain/content-type';\nimport { addNamespace, hasNamespace } from './namespace';\n\ntype ContentTypesInput = Record<string, ContentTypeDefinition>;\ntype ContentTypeExtendFn = (contentType: Struct.ContentTypeSchema) => Struct.ContentTypeSchema;\n\nconst validateKeySameToSingularName = (contentTypes: ContentTypesInput) => {\n for (const ctName of Object.keys(contentTypes)) {\n const contentType = contentTypes[ctName];\n\n if (ctName !== contentType.schema.info.singularName) {\n throw new Error(\n `The key of the content-type should be the same as its singularName. Found ${ctName} and ${contentType.schema.info.singularName}.`\n );\n }\n }\n};\n\nconst contentTypesRegistry = () => {\n const contentTypes: Record<string, Struct.ContentTypeSchema> = {};\n\n return {\n /**\n * Returns this list of registered contentTypes uids\n */\n keys() {\n return Object.keys(contentTypes);\n },\n\n /**\n * Returns the instance of a contentType. Instantiate the contentType if not already done\n */\n get(uid: UID.ContentType) {\n return contentTypes[uid];\n },\n\n /**\n * Returns a map with all the contentTypes in a namespace\n */\n getAll(namespace: string) {\n return pickBy(contentTypes, (_, uid) => hasNamespace(uid, namespace));\n },\n\n /**\n * Registers a contentType\n */\n set(uid: UID.ContentType, contentType: Struct.ContentTypeSchema) {\n contentTypes[uid] = contentType;\n return this;\n },\n\n /**\n * Registers a map of contentTypes for a specific namespace\n */\n add(namespace: string, newContentTypes: ContentTypesInput) {\n validateKeySameToSingularName(newContentTypes);\n\n for (const rawCtName of Object.keys(newContentTypes)) {\n const uid = addNamespace(rawCtName, namespace);\n\n if (has(contentTypes, uid)) {\n throw new Error(`Content-type ${uid} has already been registered.`);\n }\n\n contentTypes[uid] = createContentType(uid, newContentTypes[rawCtName]);\n }\n },\n\n /**\n * Wraps a contentType to extend it\n */\n extend(ctUID: UID.ContentType, extendFn: ContentTypeExtendFn) {\n const currentContentType = this.get(ctUID);\n\n if (!currentContentType) {\n throw new Error(`Content-Type ${ctUID} doesn't exist`);\n }\n\n extendFn(currentContentType);\n\n return this;\n },\n };\n};\n\nexport default contentTypesRegistry;\n"],"names":["validateKeySameToSingularName","contentTypes","ctName","Object","keys","contentType","schema","info","singularName","Error","contentTypesRegistry","get","uid","getAll","namespace","pickBy","_","hasNamespace","set","add","newContentTypes","rawCtName","addNamespace","has","createContentType","extend","ctUID","extendFn","currentContentType"],"mappings":";;;;;;AAQA,MAAMA,gCAAgC,CAACC,YAAAA,GAAAA;AACrC,IAAA,KAAK,MAAMC,MAAAA,IAAUC,MAAAA,CAAOC,IAAI,CAACH,YAAAA,CAAAA,CAAe;QAC9C,MAAMI,WAAAA,GAAcJ,YAAY,CAACC,MAAAA,CAAO;AAExC,QAAA,IAAIA,WAAWG,WAAAA,CAAYC,MAAM,CAACC,IAAI,CAACC,YAAY,EAAE;AACnD,YAAA,MAAM,IAAIC,KAAAA,CACR,CAAC,0EAA0E,EAAEP,OAAO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e,CAACC,SAAAA,CAAU,CAAA;AACvE,YAAA;AACF,QAAA,CAAA;AAEA;;QAGAI,MAAAA,CAAAA,CAAOC,KAAsB,EAAEC,QAA6B,EAAA;AAC1D,YAAA,MAAMC,kBAAAA,GAAqB,IAAI,CAACjB,GAAG,CAACe,KAAAA,CAAAA;AAEpC,YAAA,IAAI,CAACE,kBAAAA,EAAoB;AACvB,gBAAA,MAAM,IAAInB,KAAAA,CAAM,CAAC,aAAa,EAAEiB,KAAAA,CAAM,cAAc,CAAC,CAAA;AACvD,YAAA;YAEAC,QAAAA,CAASC,kBAAAA,CAAAA;AAET,YAAA,OAAO,IAAI;AACb,QAAA;AACF,KAAA;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import { has, pickBy } from 'lodash/fp';
1
+ import { has, pickBy } from 'lodash';
2
2
  import { createContentType } from '../domain/content-type/index.mjs';
3
3
  import { addNamespace, hasNamespace } from './namespace.mjs';
4
4
 
@@ -26,7 +26,7 @@ const contentTypesRegistry = ()=>{
26
26
  /**
27
27
  * Returns a map with all the contentTypes in a namespace
28
28
  */ getAll (namespace) {
29
- return pickBy((_, uid)=>hasNamespace(uid, namespace))(contentTypes);
29
+ return pickBy(contentTypes, (_, uid)=>hasNamespace(uid, namespace));
30
30
  },
31
31
  /**
32
32
  * Registers a contentType
@@ -40,7 +40,7 @@ const contentTypesRegistry = ()=>{
40
40
  validateKeySameToSingularName(newContentTypes);
41
41
  for (const rawCtName of Object.keys(newContentTypes)){
42
42
  const uid = addNamespace(rawCtName, namespace);
43
- if (has(uid, contentTypes)) {
43
+ if (has(contentTypes, uid)) {
44
44
  throw new Error(`Content-type ${uid} has already been registered.`);
45
45
  }
46
46
  contentTypes[uid] = createContentType(uid, newContentTypes[rawCtName]);
@@ -1 +1 @@
1
- {"version":3,"file":"content-types.mjs","sources":["../../src/registries/content-types.ts"],"sourcesContent":["import { pickBy, has } from 'lodash/fp';\nimport type { UID, Struct } from '@strapi/types';\nimport { createContentType, ContentTypeDefinition } from '../domain/content-type';\nimport { addNamespace, hasNamespace } from './namespace';\n\ntype ContentTypesInput = Record<string, ContentTypeDefinition>;\ntype ContentTypeExtendFn = (contentType: Struct.ContentTypeSchema) => Struct.ContentTypeSchema;\n\nconst validateKeySameToSingularName = (contentTypes: ContentTypesInput) => {\n for (const ctName of Object.keys(contentTypes)) {\n const contentType = contentTypes[ctName];\n\n if (ctName !== contentType.schema.info.singularName) {\n throw new Error(\n `The key of the content-type should be the same as its singularName. Found ${ctName} and ${contentType.schema.info.singularName}.`\n );\n }\n }\n};\n\nconst contentTypesRegistry = () => {\n const contentTypes: Record<string, Struct.ContentTypeSchema> = {};\n\n return {\n /**\n * Returns this list of registered contentTypes uids\n */\n keys() {\n return Object.keys(contentTypes);\n },\n\n /**\n * Returns the instance of a contentType. Instantiate the contentType if not already done\n */\n get(uid: UID.ContentType) {\n return contentTypes[uid];\n },\n\n /**\n * Returns a map with all the contentTypes in a namespace\n */\n getAll(namespace: string) {\n return pickBy((_, uid) => hasNamespace(uid, namespace))(contentTypes);\n },\n\n /**\n * Registers a contentType\n */\n set(uid: UID.ContentType, contentType: Struct.ContentTypeSchema) {\n contentTypes[uid] = contentType;\n return this;\n },\n\n /**\n * Registers a map of contentTypes for a specific namespace\n */\n add(namespace: string, newContentTypes: ContentTypesInput) {\n validateKeySameToSingularName(newContentTypes);\n\n for (const rawCtName of Object.keys(newContentTypes)) {\n const uid = addNamespace(rawCtName, namespace);\n\n if (has(uid, contentTypes)) {\n throw new Error(`Content-type ${uid} has already been registered.`);\n }\n\n contentTypes[uid] = createContentType(uid, newContentTypes[rawCtName]);\n }\n },\n\n /**\n * Wraps a contentType to extend it\n */\n extend(ctUID: UID.ContentType, extendFn: ContentTypeExtendFn) {\n const currentContentType = this.get(ctUID);\n\n if (!currentContentType) {\n throw new Error(`Content-Type ${ctUID} doesn't exist`);\n }\n\n extendFn(currentContentType);\n\n return this;\n },\n };\n};\n\nexport default contentTypesRegistry;\n"],"names":["validateKeySameToSingularName","contentTypes","ctName","Object","keys","contentType","schema","info","singularName","Error","contentTypesRegistry","get","uid","getAll","namespace","pickBy","_","hasNamespace","set","add","newContentTypes","rawCtName","addNamespace","has","createContentType","extend","ctUID","extendFn","currentContentType"],"mappings":";;;;AAQA,MAAMA,gCAAgC,CAACC,YAAAA,GAAAA;AACrC,IAAA,KAAK,MAAMC,MAAAA,IAAUC,MAAAA,CAAOC,IAAI,CAACH,YAAAA,CAAAA,CAAe;QAC9C,MAAMI,WAAAA,GAAcJ,YAAY,CAACC,MAAAA,CAAO;AAExC,QAAA,IAAIA,WAAWG,WAAAA,CAAYC,MAAM,CAACC,IAAI,CAACC,YAAY,EAAE;AACnD,YAAA,MAAM,IAAIC,KAAAA,CACR,CAAC,0EAA0E,EAAEP,OAAO,KAAK,EAAEG,WAAAA,CAAYC,MAAM,CAACC,IAAI,CAACC,YAAY,CAAC,CAAC,CAAC,CAAA;AAEtI,QAAA;AACF,IAAA;AACF,CAAA;AAEA,MAAME,oBAAAA,GAAuB,IAAA;AAC3B,IAAA,MAAMT,eAAyD,EAAC;IAEhE,OAAO;AACL;;QAGAG,IAAAA,CAAAA,GAAAA;YACE,OAAOD,MAAAA,CAAOC,IAAI,CAACH,YAAAA,CAAAA;AACrB,QAAA,CAAA;AAEA;;AAEC,QACDU,KAAIC,GAAoB,EAAA;YACtB,OAAOX,YAAY,CAACW,GAAAA,CAAI;AAC1B,QAAA,CAAA;AAEA;;AAEC,QACDC,QAAOC,SAAiB,EAAA;AACtB,YAAA,OAAOC,OAAO,CAACC,CAAAA,EAAGJ,GAAAA,GAAQK,YAAAA,CAAaL,KAAKE,SAAAA,CAAAA,CAAAA,CAAYb,YAAAA,CAAAA;AAC1D,QAAA,CAAA;AAEA;;QAGAiB,GAAAA,CAAAA,CAAIN,GAAoB,EAAEP,WAAqC,EAAA;YAC7DJ,YAAY,CAACW,IAAI,GAAGP,WAAAA;AACpB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA;;QAGAc,GAAAA,CAAAA,CAAIL,SAAiB,EAAEM,eAAkC,EAAA;YACvDpB,6BAAAA,CAA8BoB,eAAAA,CAAAA;AAE9B,YAAA,KAAK,MAAMC,SAAAA,IAAalB,MAAAA,CAAOC,IAAI,CAACgB,eAAAA,CAAAA,CAAkB;gBACpD,MAAMR,GAAAA,GAAMU,aAAaD,SAAAA,EAAWP,SAAAA,CAAAA;gBAEpC,IAAIS,GAAAA,CAAIX,KAAKX,YAAAA,CAAAA,EAAe;AAC1B,oBAAA,MAAM,IAAIQ,KAAAA,CAAM,CAAC,aAAa,EAAEG,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AACpE,gBAAA;AAEAX,gBAAAA,YAAY,CAACW,GAAAA,CAAI,GAAGY,kBAAkBZ,GAAAA,EAAKQ,eAAe,CAACC,SAAAA,CAAU,CAAA;AACvE,YAAA;AACF,QAAA,CAAA;AAEA;;QAGAI,MAAAA,CAAAA,CAAOC,KAAsB,EAAEC,QAA6B,EAAA;AAC1D,YAAA,MAAMC,kBAAAA,GAAqB,IAAI,CAACjB,GAAG,CAACe,KAAAA,CAAAA;AAEpC,YAAA,IAAI,CAACE,kBAAAA,EAAoB;AACvB,gBAAA,MAAM,IAAInB,KAAAA,CAAM,CAAC,aAAa,EAAEiB,KAAAA,CAAM,cAAc,CAAC,CAAA;AACvD,YAAA;YAEAC,QAAAA,CAASC,kBAAAA,CAAAA;AAET,YAAA,OAAO,IAAI;AACb,QAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"content-types.mjs","sources":["../../src/registries/content-types.ts"],"sourcesContent":["import { has, pickBy } from 'lodash';\nimport type { UID, Struct } from '@strapi/types';\nimport { createContentType, ContentTypeDefinition } from '../domain/content-type';\nimport { addNamespace, hasNamespace } from './namespace';\n\ntype ContentTypesInput = Record<string, ContentTypeDefinition>;\ntype ContentTypeExtendFn = (contentType: Struct.ContentTypeSchema) => Struct.ContentTypeSchema;\n\nconst validateKeySameToSingularName = (contentTypes: ContentTypesInput) => {\n for (const ctName of Object.keys(contentTypes)) {\n const contentType = contentTypes[ctName];\n\n if (ctName !== contentType.schema.info.singularName) {\n throw new Error(\n `The key of the content-type should be the same as its singularName. Found ${ctName} and ${contentType.schema.info.singularName}.`\n );\n }\n }\n};\n\nconst contentTypesRegistry = () => {\n const contentTypes: Record<string, Struct.ContentTypeSchema> = {};\n\n return {\n /**\n * Returns this list of registered contentTypes uids\n */\n keys() {\n return Object.keys(contentTypes);\n },\n\n /**\n * Returns the instance of a contentType. Instantiate the contentType if not already done\n */\n get(uid: UID.ContentType) {\n return contentTypes[uid];\n },\n\n /**\n * Returns a map with all the contentTypes in a namespace\n */\n getAll(namespace: string) {\n return pickBy(contentTypes, (_, uid) => hasNamespace(uid, namespace));\n },\n\n /**\n * Registers a contentType\n */\n set(uid: UID.ContentType, contentType: Struct.ContentTypeSchema) {\n contentTypes[uid] = contentType;\n return this;\n },\n\n /**\n * Registers a map of contentTypes for a specific namespace\n */\n add(namespace: string, newContentTypes: ContentTypesInput) {\n validateKeySameToSingularName(newContentTypes);\n\n for (const rawCtName of Object.keys(newContentTypes)) {\n const uid = addNamespace(rawCtName, namespace);\n\n if (has(contentTypes, uid)) {\n throw new Error(`Content-type ${uid} has already been registered.`);\n }\n\n contentTypes[uid] = createContentType(uid, newContentTypes[rawCtName]);\n }\n },\n\n /**\n * Wraps a contentType to extend it\n */\n extend(ctUID: UID.ContentType, extendFn: ContentTypeExtendFn) {\n const currentContentType = this.get(ctUID);\n\n if (!currentContentType) {\n throw new Error(`Content-Type ${ctUID} doesn't exist`);\n }\n\n extendFn(currentContentType);\n\n return this;\n },\n };\n};\n\nexport default contentTypesRegistry;\n"],"names":["validateKeySameToSingularName","contentTypes","ctName","Object","keys","contentType","schema","info","singularName","Error","contentTypesRegistry","get","uid","getAll","namespace","pickBy","_","hasNamespace","set","add","newContentTypes","rawCtName","addNamespace","has","createContentType","extend","ctUID","extendFn","currentContentType"],"mappings":";;;;AAQA,MAAMA,gCAAgC,CAACC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R,GAAAA,GAAMU,aAAaD,SAAAA,EAAWP,SAAAA,CAAAA;gBAEpC,IAAIS,GAAAA,CAAItB,cAAcW,GAAAA,CAAAA,EAAM;AAC1B,oBAAA,MAAM,IAAIH,KAAAA,CAAM,CAAC,aAAa,EAAEG,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AACpE,gBAAA;AAEAX,gBAAAA,YAAY,CAACW,GAAAA,CAAI,GAAGY,kBAAkBZ,GAAAA,EAAKQ,eAAe,CAACC,SAAAA,CAAU,CAAA;AACvE,YAAA;AACF,QAAA,CAAA;AAEA;;QAGAI,MAAAA,CAAAA,CAAOC,KAAsB,EAAEC,QAA6B,EAAA;AAC1D,YAAA,MAAMC,kBAAAA,GAAqB,IAAI,CAACjB,GAAG,CAACe,KAAAA,CAAAA;AAEpC,YAAA,IAAI,CAACE,kBAAAA,EAAoB;AACvB,gBAAA,MAAM,IAAInB,KAAAA,CAAM,CAAC,aAAa,EAAEiB,KAAAA,CAAM,cAAc,CAAC,CAAA;AACvD,YAAA;YAEAC,QAAAA,CAASC,kBAAAA,CAAAA;AAET,YAAA,OAAO,IAAI;AACb,QAAA;AACF,KAAA;AACF;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var fp = require('lodash/fp');
3
+ var _ = require('lodash');
4
4
  var namespace = require('./namespace.js');
5
5
 
6
6
  const controllersRegistry = (strapi)=>{
@@ -29,7 +29,7 @@ const controllersRegistry = (strapi)=>{
29
29
  /**
30
30
  * Returns a map with all the controller in a namespace
31
31
  */ getAll (namespace$1) {
32
- const filteredControllers = fp.pickBy((_, uid)=>namespace.hasNamespace(uid, namespace$1))(controllers);
32
+ const filteredControllers = _.pickBy(controllers, (_, uid)=>namespace.hasNamespace(uid, namespace$1));
33
33
  const map = {};
34
34
  for (const uid of Object.keys(filteredControllers)){
35
35
  Object.defineProperty(map, uid, {
@@ -54,7 +54,7 @@ const controllersRegistry = (strapi)=>{
54
54
  for (const controllerName of Object.keys(newControllers)){
55
55
  const controller = newControllers[controllerName];
56
56
  const uid = namespace.addNamespace(controllerName, namespace$1);
57
- if (fp.has(uid, controllers)) {
57
+ if (_.has(controllers, uid)) {
58
58
  throw new Error(`Controller ${uid} has already been registered.`);
59
59
  }
60
60
  controllers[uid] = controller;
@@ -1 +1 @@
1
- {"version":3,"file":"controllers.js","sources":["../../src/registries/controllers.ts"],"sourcesContent":["import { pickBy, has } from 'lodash/fp';\nimport type { Core, UID } from '@strapi/types';\nimport { addNamespace, hasNamespace } from './namespace';\n\nexport type ControllerFactory =\n | ((params: { strapi: Core.Strapi }) => Core.Controller)\n | Core.Controller;\nexport type ControllerFactoryMap = Record<UID.Controller, ControllerFactory>;\nexport type ControllerMap = Record<UID.Controller, Core.Controller>;\nexport type ControllerExtendFn = (service: Core.Controller) => Core.Controller;\n\nconst controllersRegistry = (strapi: Core.Strapi) => {\n const controllers: ControllerFactoryMap = {};\n const instances: ControllerMap = {};\n\n return {\n /**\n * Returns this list of registered controllers uids\n */\n keys() {\n return Object.keys(controllers);\n },\n\n /**\n * Returns the instance of a controller. Instantiate the controller if not already done\n */\n get(uid: UID.Controller) {\n if (instances[uid]) {\n return instances[uid];\n }\n\n const controller = controllers[uid];\n\n if (controller) {\n instances[uid] = typeof controller === 'function' ? controller({ strapi }) : controller;\n return instances[uid];\n }\n },\n\n /**\n * Returns a map with all the controller in a namespace\n */\n getAll(namespace: string) {\n const filteredControllers = pickBy((_, uid) => hasNamespace(uid, namespace))(controllers);\n\n const map = {};\n for (const uid of Object.keys(filteredControllers) as UID.Controller[]) {\n Object.defineProperty(map, uid, {\n enumerable: true,\n get: () => {\n return this.get(uid);\n },\n });\n }\n\n return map;\n },\n\n /**\n * Registers a controller\n */\n set(uid: UID.Controller, value: ControllerFactory) {\n controllers[uid] = value;\n delete instances[uid];\n return this;\n },\n\n /**\n * Registers a map of controllers for a specific namespace\n */\n add(namespace: string, newControllers: ControllerFactoryMap) {\n for (const controllerName of Object.keys(newControllers) as UID.Controller[]) {\n const controller = newControllers[controllerName];\n const uid = addNamespace(controllerName, namespace) as UID.Controller;\n\n if (has(uid, controllers)) {\n throw new Error(`Controller ${uid} has already been registered.`);\n }\n\n controllers[uid] = controller;\n }\n\n return this;\n },\n\n /**\n * Wraps a controller to extend it\n */\n extend(controllerUID: UID.Controller, extendFn: ControllerExtendFn) {\n const currentController = this.get(controllerUID);\n\n if (!currentController) {\n throw new Error(`Controller ${controllerUID} doesn't exist`);\n }\n\n const newController = extendFn(currentController);\n instances[controllerUID] = newController;\n\n return this;\n },\n };\n};\n\nexport default controllersRegistry;\n"],"names":["controllersRegistry","strapi","controllers","instances","keys","Object","get","uid","controller","getAll","namespace","filteredControllers","pickBy","_","hasNamespace","map","defineProperty","enumerable","set","value","add","newControllers","controllerName","addNamespace","has","Error","extend","controllerUID","extendFn","currentController","newController"],"mappings":";;;;;AAWA,MAAMA,sBAAsB,CAACC,MAAAA,GAAAA;AAC3B,IAAA,MAAMC,cAAoC,EAAC;AAC3C,IAAA,MAAMC,YAA2B,EAAC;IAElC,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;YACE,OAAOC,MAAAA,CAAOD,IAAI,CAACF,WAAAA,CAAAA;AACrB,QAAA,CAAA;AAEA;;AAEC,QACDI,KAAIC,GAAmB,EAAA;YACrB,IAAIJ,SAAS,CAACI,GAAAA,CAAI,EAAE;gBAClB,OAAOJ,SAAS,CAACI,GAAAA,CAAI;AACvB,YAAA;YAEA,MAAMC,UAAAA,GAAaN,WAAW,CAACK,GAAAA,CAAI;AAEnC,YAAA,IAAIC,UAAAA,EAAY;AACdL,gBAAAA,SAAS,CAACI,GAAAA,CAAI,GAAG,OAAOC,UAAAA,KAAe,aAAaA,UAAAA,CAAW;AAAEP,oBAAAA;iBAAO,CAAA,GAAKO,UAAAA;gBAC7E,OAAOL,SAAS,CAACI,GAAAA,CAAI;AACvB,YAAA;AACF,QAAA,CAAA;AAEA;;AAEC,QACDE,QAAOC,WAAiB,EAAA;AACtB,YA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AGAkB,MAAAA,CAAAA,CAAOC,aAA6B,EAAEC,QAA4B,EAAA;AAChE,YAAA,MAAMC,iBAAAA,GAAoB,IAAI,CAACvB,GAAG,CAACqB,aAAAA,CAAAA;AAEnC,YAAA,IAAI,CAACE,iBAAAA,EAAmB;AACtB,gBAAA,MAAM,IAAIJ,KAAAA,CAAM,CAAC,WAAW,EAAEE,aAAAA,CAAc,cAAc,CAAC,CAAA;AAC7D,YAAA;AAEA,YAAA,MAAMG,gBAAgBF,QAAAA,CAASC,iBAAAA,CAAAA;YAC/B1B,SAAS,CAACwB,cAAc,GAAGG,aAAAA;AAE3B,YAAA,OAAO,IAAI;AACb,QAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"controllers.js","sources":["../../src/registries/controllers.ts"],"sourcesContent":["import { has, pickBy } from 'lodash';\nimport type { Core, UID } from '@strapi/types';\nimport { addNamespace, hasNamespace } from './namespace';\n\nexport type ControllerFactory =\n | ((params: { strapi: Core.Strapi }) => Core.Controller)\n | Core.Controller;\nexport type ControllerFactoryMap = Record<UID.Controller, ControllerFactory>;\nexport type ControllerMap = Record<UID.Controller, Core.Controller>;\nexport type ControllerExtendFn = (service: Core.Controller) => Core.Controller;\n\nconst controllersRegistry = (strapi: Core.Strapi) => {\n const controllers: ControllerFactoryMap = {};\n const instances: ControllerMap = {};\n\n return {\n /**\n * Returns this list of registered controllers uids\n */\n keys() {\n return Object.keys(controllers);\n },\n\n /**\n * Returns the instance of a controller. Instantiate the controller if not already done\n */\n get(uid: UID.Controller) {\n if (instances[uid]) {\n return instances[uid];\n }\n\n const controller = controllers[uid];\n\n if (controller) {\n instances[uid] = typeof controller === 'function' ? controller({ strapi }) : controller;\n return instances[uid];\n }\n },\n\n /**\n * Returns a map with all the controller in a namespace\n */\n getAll(namespace: string) {\n const filteredControllers = pickBy(controllers, (_, uid) => hasNamespace(uid, namespace));\n\n const map = {};\n for (const uid of Object.keys(filteredControllers) as UID.Controller[]) {\n Object.defineProperty(map, uid, {\n enumerable: true,\n get: () => {\n return this.get(uid);\n },\n });\n }\n\n return map;\n },\n\n /**\n * Registers a controller\n */\n set(uid: UID.Controller, value: ControllerFactory) {\n controllers[uid] = value;\n delete instances[uid];\n return this;\n },\n\n /**\n * Registers a map of controllers for a specific namespace\n */\n add(namespace: string, newControllers: ControllerFactoryMap) {\n for (const controllerName of Object.keys(newControllers) as UID.Controller[]) {\n const controller = newControllers[controllerName];\n const uid = addNamespace(controllerName, namespace) as UID.Controller;\n\n if (has(controllers, uid)) {\n throw new Error(`Controller ${uid} has already been registered.`);\n }\n\n controllers[uid] = controller;\n }\n\n return this;\n },\n\n /**\n * Wraps a controller to extend it\n */\n extend(controllerUID: UID.Controller, extendFn: ControllerExtendFn) {\n const currentController = this.get(controllerUID);\n\n if (!currentController) {\n throw new Error(`Controller ${controllerUID} doesn't exist`);\n }\n\n const newController = extendFn(currentController);\n instances[controllerUID] = newController;\n\n return this;\n },\n };\n};\n\nexport default controllersRegistry;\n"],"names":["controllersRegistry","strapi","controllers","instances","keys","Object","get","uid","controller","getAll","namespace","filteredControllers","pickBy","_","hasNamespace","map","defineProperty","enumerable","set","value","add","newControllers","controllerName","addNamespace","has","Error","extend","controllerUID","extendFn","currentController","newController"],"mappings":";;;;;AAWA,MAAMA,sBAAsB,CAACC,MAAAA,GAAAA;AAC3B,IAAA,MAAMC,cAAoC,EAAC;AAC3C,IAAA,MAAMC,YAA2B,EAAC;IAElC,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;YACE,OAAOC,MAAAA,CAAOD,IAAI,CAACF,WAAAA,CAAAA;AACrB,QAAA,CAAA;AAEA;;AAEC,QACDI,KAAIC,GAAmB,EAAA;YACrB,IAAIJ,SAAS,CAACI,GAAAA,CAAI,EAAE;gBAClB,OAAOJ,SAAS,CAACI,GAAAA,CAAI;AACvB,YAAA;YAEA,MAAMC,UAAAA,GAAaN,WAAW,CAACK,GAAAA,CAAI;AAEnC,YAAA,IAAIC,UAAAA,EAAY;A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,CAAItB,aAAaK,GAAAA,CAAAA,EAAM;AACzB,oBAAA,MAAM,IAAIkB,KAAAA,CAAM,CAAC,WAAW,EAAElB,GAAAA,CAAI,6BAA6B,CAAC,CAAA;AAClE,gBAAA;gBAEAL,WAAW,CAACK,IAAI,GAAGC,UAAAA;AACrB,YAAA;AAEA,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA;;QAGAkB,MAAAA,CAAAA,CAAOC,aAA6B,EAAEC,QAA4B,EAAA;AAChE,YAAA,MAAMC,iBAAAA,GAAoB,IAAI,CAACvB,GAAG,CAACqB,aAAAA,CAAAA;AAEnC,YAAA,IAAI,CAACE,iBAAAA,EAAmB;AACtB,gBAAA,MAAM,IAAIJ,KAAAA,CAAM,CAAC,WAAW,EAAEE,aAAAA,CAAc,cAAc,CAAC,CAAA;AAC7D,YAAA;AAEA,YAAA,MAAMG,gBAAgBF,QAAAA,CAASC,iBAAAA,CAAAA;YAC/B1B,SAAS,CAACwB,cAAc,GAAGG,aAAAA;AAE3B,YAAA,OAAO,IAAI;AACb,QAAA;AACF,KAAA;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import { has, pickBy } from 'lodash/fp';
1
+ import { has, pickBy } from 'lodash';
2
2
  import { addNamespace, hasNamespace } from './namespace.mjs';
3
3
 
4
4
  const controllersRegistry = (strapi)=>{
@@ -27,7 +27,7 @@ const controllersRegistry = (strapi)=>{
27
27
  /**
28
28
  * Returns a map with all the controller in a namespace
29
29
  */ getAll (namespace) {
30
- const filteredControllers = pickBy((_, uid)=>hasNamespace(uid, namespace))(controllers);
30
+ const filteredControllers = pickBy(controllers, (_, uid)=>hasNamespace(uid, namespace));
31
31
  const map = {};
32
32
  for (const uid of Object.keys(filteredControllers)){
33
33
  Object.defineProperty(map, uid, {
@@ -52,7 +52,7 @@ const controllersRegistry = (strapi)=>{
52
52
  for (const controllerName of Object.keys(newControllers)){
53
53
  const controller = newControllers[controllerName];
54
54
  const uid = addNamespace(controllerName, namespace);
55
- if (has(uid, controllers)) {
55
+ if (has(controllers, uid)) {
56
56
  throw new Error(`Controller ${uid} has already been registered.`);
57
57
  }
58
58
  controllers[uid] = controller;
@@ -1 +1 @@
1
- {"version":3,"file":"controllers.mjs","sources":["../../src/registries/controllers.ts"],"sourcesContent":["import { pickBy, has } from 'lodash/fp';\nimport type { Core, UID } from '@strapi/types';\nimport { addNamespace, hasNamespace } from './namespace';\n\nexport type ControllerFactory =\n | ((params: { strapi: Core.Strapi }) => Core.Controller)\n | Core.Controller;\nexport type ControllerFactoryMap = Record<UID.Controller, ControllerFactory>;\nexport type ControllerMap = Record<UID.Controller, Core.Controller>;\nexport type ControllerExtendFn = (service: Core.Controller) => Core.Controller;\n\nconst controllersRegistry = (strapi: Core.Strapi) => {\n const controllers: ControllerFactoryMap = {};\n const instances: ControllerMap = {};\n\n return {\n /**\n * Returns this list of registered controllers uids\n */\n keys() {\n return Object.keys(controllers);\n },\n\n /**\n * Returns the instance of a controller. Instantiate the controller if not already done\n */\n get(uid: UID.Controller) {\n if (instances[uid]) {\n return instances[uid];\n }\n\n const controller = controllers[uid];\n\n if (controller) {\n instances[uid] = typeof controller === 'function' ? controller({ strapi }) : controller;\n return instances[uid];\n }\n },\n\n /**\n * Returns a map with all the controller in a namespace\n */\n getAll(namespace: string) {\n const filteredControllers = pickBy((_, uid) => hasNamespace(uid, namespace))(controllers);\n\n const map = {};\n for (const uid of Object.keys(filteredControllers) as UID.Controller[]) {\n Object.defineProperty(map, uid, {\n enumerable: true,\n get: () => {\n return this.get(uid);\n },\n });\n }\n\n return map;\n },\n\n /**\n * Registers a controller\n */\n set(uid: UID.Controller, value: ControllerFactory) {\n controllers[uid] = value;\n delete instances[uid];\n return this;\n },\n\n /**\n * Registers a map of controllers for a specific namespace\n */\n add(namespace: string, newControllers: ControllerFactoryMap) {\n for (const controllerName of Object.keys(newControllers) as UID.Controller[]) {\n const controller = newControllers[controllerName];\n const uid = addNamespace(controllerName, namespace) as UID.Controller;\n\n if (has(uid, controllers)) {\n throw new Error(`Controller ${uid} has already been registered.`);\n }\n\n controllers[uid] = controller;\n }\n\n return this;\n },\n\n /**\n * Wraps a controller to extend it\n */\n extend(controllerUID: UID.Controller, extendFn: ControllerExtendFn) {\n const currentController = this.get(controllerUID);\n\n if (!currentController) {\n throw new Error(`Controller ${controllerUID} doesn't exist`);\n }\n\n const newController = extendFn(currentController);\n instances[controllerUID] = newController;\n\n return this;\n },\n };\n};\n\nexport default controllersRegistry;\n"],"names":["controllersRegistry","strapi","controllers","instances","keys","Object","get","uid","controller","getAll","namespace","filteredControllers","pickBy","_","hasNamespace","map","defineProperty","enumerable","set","value","add","newControllers","controllerName","addNamespace","has","Error","extend","controllerUID","extendFn","currentController","newController"],"mappings":";;;AAWA,MAAMA,sBAAsB,CAACC,MAAAA,GAAAA;AAC3B,IAAA,MAAMC,cAAoC,EAAC;AAC3C,IAAA,MAAMC,YAA2B,EAAC;IAElC,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;YACE,OAAOC,MAAAA,CAAOD,IAAI,CAACF,WAAAA,CAAAA;AACrB,QAAA,CAAA;AAEA;;AAEC,QACDI,KAAIC,GAAmB,EAAA;YACrB,IAAIJ,SAAS,CAACI,GAAAA,CAAI,EAAE;gBAClB,OAAOJ,SAAS,CAACI,GAAAA,CAAI;AACvB,YAAA;YAEA,MAAMC,UAAAA,GAAaN,WAAW,CAACK,GAAAA,CAAI;AAEnC,YAAA,IAAIC,UAAAA,EAAY;AACdL,gBAAAA,SAAS,CAACI,GAAAA,CAAI,GAAG,OAAOC,UAAAA,KAAe,aAAaA,UAAAA,CAAW;AAAEP,oBAAAA;iBAAO,CAAA,GAAKO,UAAAA;gBAC7E,OAAOL,SAAS,CAACI,GAAAA,CAAI;AACvB,YAAA;AACF,QAAA,CAAA;AAEA;;AAEC,QACDE,QAAOC,SAAiB,EAAA;AACtB,YAAA,MAAMC,sBAAsBC,MAAAA,CAAO,CAACC,GAAGN,GAAAA,GAAQO,YAAAA,CAAaP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BAAAA,GAAoB,IAAI,CAACvB,GAAG,CAACqB,aAAAA,CAAAA;AAEnC,YAAA,IAAI,CAACE,iBAAAA,EAAmB;AACtB,gBAAA,MAAM,IAAIJ,KAAAA,CAAM,CAAC,WAAW,EAAEE,aAAAA,CAAc,cAAc,CAAC,CAAA;AAC7D,YAAA;AAEA,YAAA,MAAMG,gBAAgBF,QAAAA,CAASC,iBAAAA,CAAAA;YAC/B1B,SAAS,CAACwB,cAAc,GAAGG,aAAAA;AAE3B,YAAA,OAAO,IAAI;AACb,QAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"controllers.mjs","sources":["../../src/registries/controllers.ts"],"sourcesContent":["import { has, pickBy } from 'lodash';\nimport type { Core, UID } from '@strapi/types';\nimport { addNamespace, hasNamespace } from './namespace';\n\nexport type ControllerFactory =\n | ((params: { strapi: Core.Strapi }) => Core.Controller)\n | Core.Controller;\nexport type ControllerFactoryMap = Record<UID.Controller, ControllerFactory>;\nexport type ControllerMap = Record<UID.Controller, Core.Controller>;\nexport type ControllerExtendFn = (service: Core.Controller) => Core.Controller;\n\nconst controllersRegistry = (strapi: Core.Strapi) => {\n const controllers: ControllerFactoryMap = {};\n const instances: ControllerMap = {};\n\n return {\n /**\n * Returns this list of registered controllers uids\n */\n keys() {\n return Object.keys(controllers);\n },\n\n /**\n * Returns the instance of a controller. Instantiate the controller if not already done\n */\n get(uid: UID.Controller) {\n if (instances[uid]) {\n return instances[uid];\n }\n\n const controller = controllers[uid];\n\n if (controller) {\n instances[uid] = typeof controller === 'function' ? controller({ strapi }) : controller;\n return instances[uid];\n }\n },\n\n /**\n * Returns a map with all the controller in a namespace\n */\n getAll(namespace: string) {\n const filteredControllers = pickBy(controllers, (_, uid) => hasNamespace(uid, namespace));\n\n const map = {};\n for (const uid of Object.keys(filteredControllers) as UID.Controller[]) {\n Object.defineProperty(map, uid, {\n enumerable: true,\n get: () => {\n return this.get(uid);\n },\n });\n }\n\n return map;\n },\n\n /**\n * Registers a controller\n */\n set(uid: UID.Controller, value: ControllerFactory) {\n controllers[uid] = value;\n delete instances[uid];\n return this;\n },\n\n /**\n * Registers a map of controllers for a specific namespace\n */\n add(namespace: string, newControllers: ControllerFactoryMap) {\n for (const controllerName of Object.keys(newControllers) as UID.Controller[]) {\n const controller = newControllers[controllerName];\n const uid = addNamespace(controllerName, namespace) as UID.Controller;\n\n if (has(controllers, uid)) {\n throw new Error(`Controller ${uid} has already been registered.`);\n }\n\n controllers[uid] = controller;\n }\n\n return this;\n },\n\n /**\n * Wraps a controller to extend it\n */\n extend(controllerUID: UID.Controller, extendFn: ControllerExtendFn) {\n const currentController = this.get(controllerUID);\n\n if (!currentController) {\n throw new Error(`Controller ${controllerUID} doesn't exist`);\n }\n\n const newController = extendFn(currentController);\n instances[controllerUID] = newController;\n\n return this;\n },\n };\n};\n\nexport default controllersRegistry;\n"],"names":["controllersRegistry","strapi","controllers","instances","keys","Object","get","uid","controller","getAll","namespace","filteredControllers","pickBy","_","hasNamespace","map","defineProperty","enumerable","set","value","add","newControllers","controllerName","addNamespace","has","Error","extend","controllerUID","extendFn","currentController","newController"],"mappings":";;;AAWA,MAAMA,sBAAsB,CAACC,MAAAA,GAAAA;AAC3B,IAAA,MAAMC,cAAoC,EAAC;AAC3C,IAAA,MAAMC,YAA2B,EAAC;IAElC,OAAO;AACL;;QAGAC,IAAAA,CAAAA,GAAAA;YACE,OAAOC,MAAAA,CAAOD,IAAI,CAACF,WAAAA,CAAAA;AACrB,QAAA,CAAA;AAEA;;AAEC,QACDI,KAAIC,GAAmB,EAAA;YACrB,IAAIJ,SAAS,CAACI,GAAAA,CAAI,EAAE;gBAClB,OAAOJ,SAAS,CAACI,GAAAA,CAAI;AACvB,YAAA;YAEA,MAAMC,UAAAA,GAAaN,WAAW,CAACK,GAAAA,CAAI;AAEnC,YAAA,IAAIC,UAAAA,EAAY;AACdL,gBAAAA,SAAS,CAACI,GAAAA,CAAI,GAAG,OAAOC,UAAAA,KAAe,aAAaA,UAAA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