@strapi/core 5.48.1 → 5.50.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 (420) hide show
  1. package/dist/Strapi.d.ts.map +1 -1
  2. package/dist/Strapi.js +11 -5
  3. package/dist/Strapi.js.map +1 -1
  4. package/dist/Strapi.mjs +2 -1
  5. package/dist/Strapi.mjs.map +1 -1
  6. package/dist/ai.d.ts +2 -0
  7. package/dist/ai.d.ts.map +1 -0
  8. package/dist/ai.js +8 -0
  9. package/dist/ai.js.map +1 -0
  10. package/dist/ai.mjs +3 -0
  11. package/dist/ai.mjs.map +1 -0
  12. package/dist/configuration/config-loader.d.ts.map +1 -1
  13. package/dist/configuration/config-loader.js +11 -6
  14. package/dist/configuration/config-loader.js.map +1 -1
  15. package/dist/configuration/get-dirs.d.ts.map +1 -1
  16. package/dist/configuration/index.d.ts +0 -3
  17. package/dist/configuration/index.d.ts.map +1 -1
  18. package/dist/configuration/index.js +22 -18
  19. package/dist/configuration/index.js.map +1 -1
  20. package/dist/configuration/index.mjs +0 -3
  21. package/dist/configuration/index.mjs.map +1 -1
  22. package/dist/configuration/server-config.d.ts +11 -0
  23. package/dist/configuration/server-config.d.ts.map +1 -0
  24. package/dist/configuration/server-config.js +16 -0
  25. package/dist/configuration/server-config.js.map +1 -0
  26. package/dist/configuration/server-config.mjs +14 -0
  27. package/dist/configuration/server-config.mjs.map +1 -0
  28. package/dist/configuration/urls.d.ts.map +1 -1
  29. package/dist/configuration/urls.js +11 -7
  30. package/dist/configuration/urls.js.map +1 -1
  31. package/dist/core-api/controller/collection-type.d.ts.map +1 -1
  32. package/dist/core-api/controller/single-type.d.ts.map +1 -1
  33. package/dist/core-api/controller/transform.d.ts.map +1 -1
  34. package/dist/core-api/routes/index.d.ts.map +1 -1
  35. package/dist/core-api/routes/index.js +3 -2
  36. package/dist/core-api/routes/index.js.map +1 -1
  37. package/dist/core-api/routes/validation/attributes.d.ts.map +1 -1
  38. package/dist/core-api/routes/validation/common.js +3 -2
  39. package/dist/core-api/routes/validation/common.js.map +1 -1
  40. package/dist/core-api/routes/validation/content-type.js +3 -2
  41. package/dist/core-api/routes/validation/content-type.js.map +1 -1
  42. package/dist/core-api/routes/validation/mappers.d.ts.map +1 -1
  43. package/dist/core-api/routes/validation/mappers.js +3 -2
  44. package/dist/core-api/routes/validation/mappers.js.map +1 -1
  45. package/dist/core-api/routes/validation/utils.d.ts.map +1 -1
  46. package/dist/core-api/routes/validation/utils.js +3 -2
  47. package/dist/core-api/routes/validation/utils.js.map +1 -1
  48. package/dist/core-api/service/collection-type.d.ts.map +1 -1
  49. package/dist/core-api/service/pagination.d.ts.map +1 -1
  50. package/dist/core-api/service/single-type.d.ts.map +1 -1
  51. package/dist/domain/content-type/index.d.ts.map +1 -1
  52. package/dist/domain/content-type/index.js +9 -5
  53. package/dist/domain/content-type/index.js.map +1 -1
  54. package/dist/domain/content-type/validator.d.ts.map +1 -1
  55. package/dist/domain/content-type/validator.js +6 -2
  56. package/dist/domain/content-type/validator.js.map +1 -1
  57. package/dist/domain/module/index.d.ts.map +1 -1
  58. package/dist/domain/module/index.js +6 -2
  59. package/dist/domain/module/index.js.map +1 -1
  60. package/dist/domain/module/validation.d.ts.map +1 -1
  61. package/dist/ee/index.d.ts +2 -1
  62. package/dist/ee/index.d.ts.map +1 -1
  63. package/dist/ee/license.d.ts.map +1 -1
  64. package/dist/ee/license.js +8 -3
  65. package/dist/ee/license.js.map +1 -1
  66. package/dist/factories.d.ts.map +1 -1
  67. package/dist/index.d.ts +5 -1
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +2 -0
  70. package/dist/index.js.map +1 -1
  71. package/dist/index.mjs +2 -0
  72. package/dist/index.mjs.map +1 -1
  73. package/dist/loaders/admin.js +5 -1
  74. package/dist/loaders/admin.js.map +1 -1
  75. package/dist/loaders/apis.js +16 -11
  76. package/dist/loaders/apis.js.map +1 -1
  77. package/dist/loaders/components.js +6 -2
  78. package/dist/loaders/components.js.map +1 -1
  79. package/dist/loaders/middlewares.js +6 -2
  80. package/dist/loaders/middlewares.js.map +1 -1
  81. package/dist/loaders/plugins/get-enabled-plugins.d.ts.map +1 -1
  82. package/dist/loaders/plugins/get-enabled-plugins.js +5 -1
  83. package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
  84. package/dist/loaders/plugins/get-user-plugins-config.js +6 -2
  85. package/dist/loaders/plugins/get-user-plugins-config.js.map +1 -1
  86. package/dist/loaders/plugins/index.js +8 -4
  87. package/dist/loaders/plugins/index.js.map +1 -1
  88. package/dist/loaders/policies.js +6 -2
  89. package/dist/loaders/policies.js.map +1 -1
  90. package/dist/loaders/sanitizers.d.ts.map +1 -1
  91. package/dist/loaders/src-index.d.ts.map +1 -1
  92. package/dist/loaders/validators.d.ts.map +1 -1
  93. package/dist/mcp.d.ts +4 -0
  94. package/dist/mcp.d.ts.map +1 -0
  95. package/dist/mcp.js +12 -0
  96. package/dist/mcp.js.map +1 -0
  97. package/dist/mcp.mjs +4 -0
  98. package/dist/mcp.mjs.map +1 -0
  99. package/dist/middlewares/body.d.ts.map +1 -1
  100. package/dist/middlewares/body.js +9 -4
  101. package/dist/middlewares/body.js.map +1 -1
  102. package/dist/middlewares/body.mjs +1 -1
  103. package/dist/middlewares/body.mjs.map +1 -1
  104. package/dist/middlewares/compression.js +5 -1
  105. package/dist/middlewares/compression.js.map +1 -1
  106. package/dist/middlewares/cors.d.ts.map +1 -1
  107. package/dist/middlewares/cors.js +5 -1
  108. package/dist/middlewares/cors.js.map +1 -1
  109. package/dist/middlewares/errors.d.ts +5 -0
  110. package/dist/middlewares/errors.d.ts.map +1 -1
  111. package/dist/middlewares/errors.js.map +1 -1
  112. package/dist/middlewares/errors.mjs.map +1 -1
  113. package/dist/middlewares/favicon.d.ts +0 -1
  114. package/dist/middlewares/favicon.d.ts.map +1 -1
  115. package/dist/middlewares/favicon.js +5 -1
  116. package/dist/middlewares/favicon.js.map +1 -1
  117. package/dist/middlewares/ip.js +5 -1
  118. package/dist/middlewares/ip.js.map +1 -1
  119. package/dist/middlewares/public.js +5 -1
  120. package/dist/middlewares/public.js.map +1 -1
  121. package/dist/middlewares/query.js +6 -2
  122. package/dist/middlewares/query.js.map +1 -1
  123. package/dist/middlewares/security.js +5 -1
  124. package/dist/middlewares/security.js.map +1 -1
  125. package/dist/migrations/database/5.0.0-discard-drafts.js +5 -1
  126. package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -1
  127. package/dist/migrations/draft-publish.d.ts.map +1 -1
  128. package/dist/migrations/first-published-at.d.ts.map +1 -1
  129. package/dist/migrations/first-published-at.js +5 -1
  130. package/dist/migrations/first-published-at.js.map +1 -1
  131. package/dist/migrations/i18n.d.ts.map +1 -1
  132. package/dist/migrations/index.d.ts.map +1 -1
  133. package/dist/package.json.js +18 -21
  134. package/dist/package.json.js.map +1 -1
  135. package/dist/package.json.mjs +18 -21
  136. package/dist/package.json.mjs.map +1 -1
  137. package/dist/providers/provider.d.ts.map +1 -1
  138. package/dist/registries/apis.d.ts.map +1 -1
  139. package/dist/registries/components.d.ts +1 -1
  140. package/dist/registries/components.d.ts.map +1 -1
  141. package/dist/registries/content-types.d.ts +2 -3
  142. package/dist/registries/content-types.d.ts.map +1 -1
  143. package/dist/registries/controllers.d.ts +3 -3
  144. package/dist/registries/controllers.d.ts.map +1 -1
  145. package/dist/registries/custom-fields.d.ts.map +1 -1
  146. package/dist/registries/hooks.d.ts +3 -4
  147. package/dist/registries/hooks.d.ts.map +1 -1
  148. package/dist/registries/middlewares.d.ts +2 -3
  149. package/dist/registries/middlewares.d.ts.map +1 -1
  150. package/dist/registries/models.d.ts +1 -1
  151. package/dist/registries/modules.d.ts.map +1 -1
  152. package/dist/registries/namespace.d.ts.map +1 -1
  153. package/dist/registries/plugins.d.ts.map +1 -1
  154. package/dist/registries/policies.d.ts +1 -2
  155. package/dist/registries/policies.d.ts.map +1 -1
  156. package/dist/registries/sanitizers.d.ts +2 -2
  157. package/dist/registries/sanitizers.js +7 -3
  158. package/dist/registries/sanitizers.js.map +1 -1
  159. package/dist/registries/services.d.ts +3 -3
  160. package/dist/registries/services.d.ts.map +1 -1
  161. package/dist/registries/validators.d.ts +2 -2
  162. package/dist/registries/validators.js +7 -3
  163. package/dist/registries/validators.js.map +1 -1
  164. package/dist/services/ai.d.ts.map +1 -1
  165. package/dist/services/auth/index.js +7 -3
  166. package/dist/services/auth/index.js.map +1 -1
  167. package/dist/services/config.d.ts.map +1 -1
  168. package/dist/services/content-api/index.d.ts +4 -4
  169. package/dist/services/content-api/index.d.ts.map +1 -1
  170. package/dist/services/content-api/index.js +10 -6
  171. package/dist/services/content-api/index.js.map +1 -1
  172. package/dist/services/content-api/permissions/engine.d.ts.map +1 -1
  173. package/dist/services/content-api/permissions/engine.js +5 -1
  174. package/dist/services/content-api/permissions/engine.js.map +1 -1
  175. package/dist/services/content-api/permissions/index.d.ts +2 -2
  176. package/dist/services/content-api/permissions/index.d.ts.map +1 -1
  177. package/dist/services/content-api/permissions/index.js +10 -6
  178. package/dist/services/content-api/permissions/index.js.map +1 -1
  179. package/dist/services/content-api/permissions/providers/action.d.ts +1 -1
  180. package/dist/services/content-api/permissions/providers/action.d.ts.map +1 -1
  181. package/dist/services/content-api/permissions/providers/condition.d.ts +1 -1
  182. package/dist/services/content-api/permissions/providers/condition.d.ts.map +1 -1
  183. package/dist/services/content-source-maps.d.ts.map +1 -1
  184. package/dist/services/core-store.d.ts.map +1 -1
  185. package/dist/services/cron.d.ts +5 -5
  186. package/dist/services/custom-fields.d.ts.map +1 -1
  187. package/dist/services/document-service/attributes/index.d.ts +0 -1
  188. package/dist/services/document-service/attributes/index.d.ts.map +1 -1
  189. package/dist/services/document-service/attributes/transforms.js +5 -1
  190. package/dist/services/document-service/attributes/transforms.js.map +1 -1
  191. package/dist/services/document-service/common.d.ts.map +1 -1
  192. package/dist/services/document-service/components.d.ts +2 -2
  193. package/dist/services/document-service/components.d.ts.map +1 -1
  194. package/dist/services/document-service/components.js +14 -10
  195. package/dist/services/document-service/components.js.map +1 -1
  196. package/dist/services/document-service/components.mjs.map +1 -1
  197. package/dist/services/document-service/draft-and-publish.d.ts +0 -1
  198. package/dist/services/document-service/draft-and-publish.d.ts.map +1 -1
  199. package/dist/services/document-service/draft-and-publish.js +1 -1
  200. package/dist/services/document-service/draft-and-publish.js.map +1 -1
  201. package/dist/services/document-service/draft-and-publish.mjs +1 -1
  202. package/dist/services/document-service/draft-and-publish.mjs.map +1 -1
  203. package/dist/services/document-service/entries.d.ts.map +1 -1
  204. package/dist/services/document-service/entries.js +6 -2
  205. package/dist/services/document-service/entries.js.map +1 -1
  206. package/dist/services/document-service/entries.mjs +7 -3
  207. package/dist/services/document-service/entries.mjs.map +1 -1
  208. package/dist/services/document-service/events.d.ts.map +1 -1
  209. package/dist/services/document-service/first-published-at.d.ts.map +1 -1
  210. package/dist/services/document-service/index.d.ts.map +1 -1
  211. package/dist/services/document-service/internationalization.d.ts +0 -1
  212. package/dist/services/document-service/internationalization.d.ts.map +1 -1
  213. package/dist/services/document-service/internationalization.js.map +1 -1
  214. package/dist/services/document-service/internationalization.mjs.map +1 -1
  215. package/dist/services/document-service/middlewares/middleware-manager.d.ts.map +1 -1
  216. package/dist/services/document-service/params.d.ts +1 -1
  217. package/dist/services/document-service/params.d.ts.map +1 -1
  218. package/dist/services/document-service/publication-filter.d.ts +1 -1
  219. package/dist/services/document-service/publication-filter.d.ts.map +1 -1
  220. package/dist/services/document-service/transform/data.d.ts +2 -0
  221. package/dist/services/document-service/transform/data.d.ts.map +1 -1
  222. package/dist/services/document-service/transform/data.js +7 -1
  223. package/dist/services/document-service/transform/data.js.map +1 -1
  224. package/dist/services/document-service/transform/data.mjs +7 -2
  225. package/dist/services/document-service/transform/data.mjs.map +1 -1
  226. package/dist/services/document-service/transform/fields.d.ts.map +1 -1
  227. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  228. package/dist/services/document-service/transform/id-map.js +7 -4
  229. package/dist/services/document-service/transform/id-map.js.map +1 -1
  230. package/dist/services/document-service/transform/id-map.mjs +7 -4
  231. package/dist/services/document-service/transform/id-map.mjs.map +1 -1
  232. package/dist/services/document-service/transform/id-transform.d.ts +0 -1
  233. package/dist/services/document-service/transform/id-transform.d.ts.map +1 -1
  234. package/dist/services/document-service/transform/populate.d.ts.map +1 -1
  235. package/dist/services/document-service/transform/query.d.ts +0 -1
  236. package/dist/services/document-service/transform/query.d.ts.map +1 -1
  237. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts.map +1 -1
  238. package/dist/services/document-service/transform/relations/transform/data-ids.d.ts.map +1 -1
  239. package/dist/services/document-service/transform/relations/transform/default-locale.d.ts.map +1 -1
  240. package/dist/services/document-service/transform/relations/utils/data.d.ts.map +1 -1
  241. package/dist/services/document-service/transform/relations/utils/dp.d.ts +1 -1
  242. package/dist/services/document-service/transform/relations/utils/dp.d.ts.map +1 -1
  243. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  244. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts +0 -1
  245. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts.map +1 -1
  246. package/dist/services/document-service/transform/relations/utils/xto-one.d.ts.map +1 -1
  247. package/dist/services/document-service/utils/bidirectional-relations.d.ts.map +1 -1
  248. package/dist/services/document-service/utils/bidirectional-relations.js +7 -2
  249. package/dist/services/document-service/utils/bidirectional-relations.js.map +1 -1
  250. package/dist/services/document-service/utils/bidirectional-relations.mjs +7 -2
  251. package/dist/services/document-service/utils/bidirectional-relations.mjs.map +1 -1
  252. package/dist/services/document-service/utils/clean-component-join-table.d.ts.map +1 -1
  253. package/dist/services/document-service/utils/ordered-parallel.d.ts.map +1 -1
  254. package/dist/services/document-service/utils/populate.d.ts +1 -1
  255. package/dist/services/document-service/utils/populate.d.ts.map +1 -1
  256. package/dist/services/document-service/utils/populate.js.map +1 -1
  257. package/dist/services/document-service/utils/populate.mjs.map +1 -1
  258. package/dist/services/document-service/utils/self-referential-relations.d.ts.map +1 -1
  259. package/dist/services/document-service/utils/unidirectional-relations.d.ts.map +1 -1
  260. package/dist/services/entity-service/index.d.ts.map +1 -1
  261. package/dist/services/entity-service/index.js +9 -4
  262. package/dist/services/entity-service/index.js.map +1 -1
  263. package/dist/services/entity-validator/index.d.ts.map +1 -1
  264. package/dist/services/entity-validator/index.js +9 -4
  265. package/dist/services/entity-validator/index.js.map +1 -1
  266. package/dist/services/entity-validator/index.mjs.map +1 -1
  267. package/dist/services/entity-validator/validators.d.ts.map +1 -1
  268. package/dist/services/entity-validator/validators.js +10 -6
  269. package/dist/services/entity-validator/validators.js.map +1 -1
  270. package/dist/services/errors.d.ts.map +1 -1
  271. package/dist/services/errors.js +7 -3
  272. package/dist/services/errors.js.map +1 -1
  273. package/dist/services/features.d.ts.map +1 -1
  274. package/dist/services/fs.d.ts.map +1 -1
  275. package/dist/services/fs.js +10 -5
  276. package/dist/services/fs.js.map +1 -1
  277. package/dist/services/mcp/authentication.d.ts.map +1 -1
  278. package/dist/services/mcp/handlers/handlePost.d.ts.map +1 -1
  279. package/dist/services/mcp/index.d.ts.map +1 -1
  280. package/dist/services/mcp/internal/McpCapabilityRegistry.d.ts +2 -2
  281. package/dist/services/mcp/internal/McpServerFactory.d.ts.map +1 -1
  282. package/dist/services/mcp/internal/syncMcpSessionCapabilities.d.ts.map +1 -1
  283. package/dist/services/mcp/metrics/metrics.d.ts.map +1 -1
  284. package/dist/services/mcp/metrics/normalizeMcpCapability.d.ts.map +1 -1
  285. package/dist/services/mcp/metrics/wrapCapabilityHandlerForMetrics.d.ts.map +1 -1
  286. package/dist/services/mcp/middleware/oauthDiscoveryFallback.d.ts.map +1 -1
  287. package/dist/services/mcp/prompt-registry.d.ts +31 -3
  288. package/dist/services/mcp/prompt-registry.d.ts.map +1 -1
  289. package/dist/services/mcp/prompt-registry.js +31 -0
  290. package/dist/services/mcp/prompt-registry.js.map +1 -1
  291. package/dist/services/mcp/prompt-registry.mjs +31 -1
  292. package/dist/services/mcp/prompt-registry.mjs.map +1 -1
  293. package/dist/services/mcp/resource-registry.d.ts +31 -1
  294. package/dist/services/mcp/resource-registry.d.ts.map +1 -1
  295. package/dist/services/mcp/resource-registry.js +31 -0
  296. package/dist/services/mcp/resource-registry.js.map +1 -1
  297. package/dist/services/mcp/resource-registry.mjs +31 -1
  298. package/dist/services/mcp/resource-registry.mjs.map +1 -1
  299. package/dist/services/mcp/routes.d.ts +1 -1
  300. package/dist/services/mcp/routes.d.ts.map +1 -1
  301. package/dist/services/mcp/tool-registry.d.ts +36 -9
  302. package/dist/services/mcp/tool-registry.d.ts.map +1 -1
  303. package/dist/services/mcp/tool-registry.js +35 -3
  304. package/dist/services/mcp/tool-registry.js.map +1 -1
  305. package/dist/services/mcp/tool-registry.mjs +35 -3
  306. package/dist/services/mcp/tool-registry.mjs.map +1 -1
  307. package/dist/services/mcp/tools/log.d.ts +15 -85
  308. package/dist/services/mcp/tools/log.d.ts.map +1 -1
  309. package/dist/services/mcp/utils/createSafeCapabilityRegistration.d.ts.map +1 -1
  310. package/dist/services/mcp/utils/safeHandlerWrapper.d.ts.map +1 -1
  311. package/dist/services/mcp/utils/sendJsonRpcError.d.ts +0 -1
  312. package/dist/services/mcp/utils/sendJsonRpcError.d.ts.map +1 -1
  313. package/dist/services/mcp/utils/withTimeout.d.ts.map +1 -1
  314. package/dist/services/metrics/admin-user-hash.d.ts.map +1 -1
  315. package/dist/services/metrics/admin-user-hash.js +5 -1
  316. package/dist/services/metrics/admin-user-hash.js.map +1 -1
  317. package/dist/services/metrics/index.d.ts.map +1 -1
  318. package/dist/services/metrics/is-truthy.d.ts.map +1 -1
  319. package/dist/services/metrics/is-truthy.js +5 -1
  320. package/dist/services/metrics/is-truthy.js.map +1 -1
  321. package/dist/services/metrics/middleware.d.ts.map +1 -1
  322. package/dist/services/metrics/rate-limiter.d.ts +2 -1
  323. package/dist/services/metrics/rate-limiter.d.ts.map +1 -1
  324. package/dist/services/metrics/sender.d.ts.map +1 -1
  325. package/dist/services/metrics/sender.js +17 -9
  326. package/dist/services/metrics/sender.js.map +1 -1
  327. package/dist/services/query-params.d.ts.map +1 -1
  328. package/dist/services/reloader.d.ts.map +1 -1
  329. package/dist/services/request-context.d.ts.map +1 -1
  330. package/dist/services/server/admin-api.d.ts +3 -5
  331. package/dist/services/server/admin-api.d.ts.map +1 -1
  332. package/dist/services/server/api.d.ts +3 -4
  333. package/dist/services/server/api.d.ts.map +1 -1
  334. package/dist/services/server/api.js +5 -1
  335. package/dist/services/server/api.js.map +1 -1
  336. package/dist/services/server/compose-endpoint.d.ts.map +1 -1
  337. package/dist/services/server/compose-endpoint.js +5 -1
  338. package/dist/services/server/compose-endpoint.js.map +1 -1
  339. package/dist/services/server/content-api.d.ts +3 -5
  340. package/dist/services/server/content-api.d.ts.map +1 -1
  341. package/dist/services/server/http-server.d.ts +0 -1
  342. package/dist/services/server/http-server.d.ts.map +1 -1
  343. package/dist/services/server/http-server.js +5 -1
  344. package/dist/services/server/http-server.js.map +1 -1
  345. package/dist/services/server/index.d.ts.map +1 -1
  346. package/dist/services/server/index.js +5 -1
  347. package/dist/services/server/index.js.map +1 -1
  348. package/dist/services/server/koa-methods.d.ts +107 -0
  349. package/dist/services/server/koa-methods.d.ts.map +1 -0
  350. package/dist/services/server/koa-methods.js +24 -0
  351. package/dist/services/server/koa-methods.js.map +1 -0
  352. package/dist/services/server/koa-methods.mjs +22 -0
  353. package/dist/services/server/koa-methods.mjs.map +1 -0
  354. package/dist/services/server/koa.d.ts +0 -9
  355. package/dist/services/server/koa.d.ts.map +1 -1
  356. package/dist/services/server/koa.js +14 -10
  357. package/dist/services/server/koa.js.map +1 -1
  358. package/dist/services/server/koa.mjs +7 -9
  359. package/dist/services/server/koa.mjs.map +1 -1
  360. package/dist/services/server/middleware.d.ts.map +1 -1
  361. package/dist/services/server/middleware.js +5 -1
  362. package/dist/services/server/middleware.js.map +1 -1
  363. package/dist/services/server/openapi.d.ts.map +1 -1
  364. package/dist/services/server/openapi.js +11 -6
  365. package/dist/services/server/openapi.js.map +1 -1
  366. package/dist/services/server/policy.d.ts.map +1 -1
  367. package/dist/services/server/register-middlewares.d.ts.map +1 -1
  368. package/dist/services/server/register-routes.d.ts.map +1 -1
  369. package/dist/services/server/register-routes.js +8 -4
  370. package/dist/services/server/register-routes.js.map +1 -1
  371. package/dist/services/server/routing.d.ts +0 -2
  372. package/dist/services/server/routing.d.ts.map +1 -1
  373. package/dist/services/server/routing.js +5 -1
  374. package/dist/services/server/routing.js.map +1 -1
  375. package/dist/services/session-manager.d.ts +20 -0
  376. package/dist/services/session-manager.d.ts.map +1 -1
  377. package/dist/services/session-manager.js +71 -9
  378. package/dist/services/session-manager.js.map +1 -1
  379. package/dist/services/session-manager.mjs +57 -0
  380. package/dist/services/session-manager.mjs.map +1 -1
  381. package/dist/services/webhook-runner.js +7 -2
  382. package/dist/services/webhook-runner.js.map +1 -1
  383. package/dist/services/webhook-store.d.ts.map +1 -1
  384. package/dist/services/worker-queue.js +5 -1
  385. package/dist/services/worker-queue.js.map +1 -1
  386. package/dist/utils/convert-custom-field-type.d.ts.map +1 -1
  387. package/dist/utils/cron.d.ts.map +1 -1
  388. package/dist/utils/fetch.d.ts.map +1 -1
  389. package/dist/utils/filepath-to-prop-path.d.ts.map +1 -1
  390. package/dist/utils/filepath-to-prop-path.js +13 -8
  391. package/dist/utils/filepath-to-prop-path.js.map +1 -1
  392. package/dist/utils/is-initialized.d.ts.map +1 -1
  393. package/dist/utils/load-config-file.d.ts.map +1 -1
  394. package/dist/utils/load-config-file.js +7 -2
  395. package/dist/utils/load-config-file.js.map +1 -1
  396. package/dist/utils/load-files.d.ts +1 -1
  397. package/dist/utils/load-files.d.ts.map +1 -1
  398. package/dist/utils/load-files.js +12 -6
  399. package/dist/utils/load-files.js.map +1 -1
  400. package/dist/utils/open-browser.d.ts +0 -1
  401. package/dist/utils/open-browser.d.ts.map +1 -1
  402. package/dist/utils/open-browser.js +5 -1
  403. package/dist/utils/open-browser.js.map +1 -1
  404. package/dist/utils/resolve-working-dirs.d.ts.map +1 -1
  405. package/dist/utils/resolve-working-dirs.js +6 -2
  406. package/dist/utils/resolve-working-dirs.js.map +1 -1
  407. package/dist/utils/signals.d.ts.map +1 -1
  408. package/dist/utils/startup-logger.d.ts.map +1 -1
  409. package/dist/utils/startup-logger.js +27 -21
  410. package/dist/utils/startup-logger.js.map +1 -1
  411. package/dist/utils/transform-content-types-to-models.d.ts +3 -3
  412. package/dist/utils/transform-content-types-to-models.d.ts.map +1 -1
  413. package/dist/utils/transform-content-types-to-models.js +10 -5
  414. package/dist/utils/transform-content-types-to-models.js.map +1 -1
  415. package/dist/utils/update-notifier/index.d.ts.map +1 -1
  416. package/dist/utils/update-notifier/index.js +21 -8
  417. package/dist/utils/update-notifier/index.js.map +1 -1
  418. package/dist/utils/update-notifier/index.mjs +6 -1
  419. package/dist/utils/update-notifier/index.mjs.map +1 -1
  420. package/package.json +18 -21
@@ -1 +1 @@
1
- {"version":3,"file":"content-type.js","sources":["../../../../src/core-api/routes/validation/content-type.ts"],"sourcesContent":["import type { Schema, UID } from '@strapi/types';\n\nimport { contentTypes } from '@strapi/utils';\nimport * as z from 'zod/v4';\n\n// eslint-disable-next-line import/no-cycle\nimport { createAttributesInputSchema, createAttributesSchema } from './mappers';\nimport { AbstractCoreRouteValidator } from './common';\n\n/** REST query param names. `hasPublishedVersion` is deprecated in favor of `publicationFilter`. */\nexport type QueryParam =\n | 'fields'\n | 'populate'\n | 'sort'\n | 'status'\n | 'publicationFilter'\n | 'hasPublishedVersion'\n | 'locale'\n | 'pagination'\n | 'filters'\n | '_q';\n\n/**\n * A validator for core content-type routes.\n *\n * Provides validation schemas and utilities for handling content-type-specific route validation.\n * Extends the base AbstractRouteValidator with schema-aware validation for Strapi content types.\n *\n * @example\n * ```ts\n * const strapi = // ... strapi instance\n * const uid = 'api::article.article'\n * const validator = new CoreContentTypeRouteValidator(strapi, uid);\n *\n * // Get validation schema for document\n * const documentSchema = validator.document;\n *\n * // Validate query parameters with schema awareness\n * const querySchema = validator.queryParams(['fields', 'populate', 'sort']);\n * ```\n */\nexport class CoreContentTypeRouteValidator extends AbstractCoreRouteValidator<UID.ContentType> {\n /**\n * Generates a validation schema for document IDs\n *\n * @returns A schema that validates UUIDs\n *\n * @example\n * ```ts\n * const validator = new CoreContentTypeRouteValidator(strapi, uid);\n * const idSchema = validator.documentID;\n * ```\n */\n get documentID() {\n return z.uuid().describe('The document ID, represented by a UUID');\n }\n\n /**\n * Generates a comprehensive validation schema for a single document.\n *\n * Combines scalar fields and populatable fields into a single schema.\n *\n * @returns A schema for validating complete documents\n *\n * @example\n * ```ts\n * const validator = new CoreContentTypeRouteValidator(strapi, uid);\n * const docSchema = validator.document;\n * ```\n */\n get document() {\n const entries = Object.entries({ ...this._scalarFields, ...this._populatableFields });\n\n const sanitizedAttributes = entries\n // Remove passwords from the attribute list\n .filter(([, attribute]) => !['password'].includes(attribute.type));\n\n // Merge all attributes into a single schema\n const attributesSchema = createAttributesSchema(this._strapi, sanitizedAttributes);\n\n return z\n .object({\n documentId: this.documentID,\n id: z.union([z.string(), z.number()]),\n })\n .extend(attributesSchema.shape);\n }\n\n /**\n * Generates a validation schema for an array of documents\n *\n * @returns A schema for validating arrays of documents\n *\n * @example\n * ```ts\n * const validator = new CoreContentTypeRouteValidator(strapi, uid);\n * const docsSchema = validator.documents;\n * ```\n */\n get documents() {\n return z.array(this.document);\n }\n\n /**\n * Schema-aware fields validation that restricts to actual model fields\n */\n protected get schemaAwareQueryFields() {\n return this.scalarFieldsArray\n .readonly()\n .describe(\n `The fields to return, this doesn't include populatable fields like relations, components, files, or dynamic zones`\n );\n }\n\n /**\n * Schema-aware populate validation that restricts to actual populatable fields\n */\n protected get schemaAwareQueryPopulate() {\n const wildcardPopulate = z\n .literal('*')\n .readonly()\n .describe(\n 'Populate all the first level relations, components, files, and dynamic zones for the entry'\n );\n\n const singleFieldPopulate = this.populatableFieldsEnum\n .readonly()\n .describe('Populate a single relation, component, file, or dynamic zone');\n\n const multiPopulate = this.populatableFieldsArray.describe(\n 'Populate a selection of multiple relations, components, files, or dynamic zones'\n );\n\n return z.union([wildcardPopulate, singleFieldPopulate, multiPopulate]);\n }\n\n /**\n * Schema-aware sort validation that restricts to actual model fields\n */\n protected get schemaAwareQuerySort() {\n const orderDirection = z.enum(['asc', 'desc']);\n\n // TODO: Handle nested sorts but very low priority, very little usage\n return z\n .union([\n this.scalarFieldsEnum, // 'name' | 'title'\n this.scalarFieldsArray, // ['name', 'title']\n this.fieldRecord(orderDirection), // { name: 'desc' } | { title: 'asc' }\n z.array(this.fieldRecord(orderDirection)), // [{ name: 'desc'}, { title: 'asc' }]\n ])\n .describe('Sort the result');\n }\n\n /**\n * Schema-aware filters validation that restricts to actual model fields\n */\n protected get schemaAwareFilters() {\n return z.record(this.scalarFieldsEnum, z.any()).describe('Filters to apply to the query');\n }\n\n get locale() {\n return z.string().describe('Select a locale');\n }\n\n get status() {\n return z\n .enum(['draft', 'published'])\n .describe('Fetch documents based on their status. Default to \"published\" if not specified.');\n }\n\n get publicationFilter() {\n return z\n .enum([\n 'never-published',\n 'has-published-version',\n 'modified',\n 'unmodified',\n 'never-published-document',\n 'has-published-version-document',\n 'published-without-draft',\n 'published-with-draft',\n ])\n .describe(\n 'Derived publication cohort: pair-scoped (per documentId+locale), document-scoped variants (-document), or published-slice diagnostics (published-without-draft / published-with-draft)'\n );\n }\n\n /** @deprecated Use `publicationFilter` instead (`never-published`, `has-published-version`, …). */\n get hasPublishedVersion() {\n return z\n .union([z.boolean(), z.enum(['true', 'false'])])\n .describe(\n '[Deprecated: prefer publicationFilter] Filter documents by whether they have a published version. Use with status=draft to find documents that have never been published'\n );\n }\n\n get data() {\n const isWritableAttribute = ([attributeName]: [string, Schema.Attribute.AnyAttribute]) => {\n return contentTypes.isWritableAttribute(this._schema, attributeName);\n };\n\n const entries = Object.entries({ ...this._scalarFields, ...this._populatableFields });\n\n const sanitizedAttributes = entries\n // Remove non-writable attributes\n .filter(isWritableAttribute);\n\n return createAttributesInputSchema(this._strapi, sanitizedAttributes);\n }\n\n get query() {\n return z.string();\n }\n\n get body() {\n return z.object({ data: this.data });\n }\n\n get partialBody() {\n return z.object({ data: this.data.partial() });\n }\n\n /**\n * Creates validation schemas for query parameters\n *\n * @param params - Array of query parameters to validate ('fields', 'populate', 'sort', ...)\n * @returns Object containing validation schemas for requested parameters\n *\n * @example\n * ```ts\n * const validator = new CoreContentTypeRouteValidator(strapi, uid);\n * const querySchemas = validator.queryParams(['fields', 'populate']);\n * ```\n */\n queryParams(params: QueryParam[]): Partial<Record<QueryParam, z.Schema>> {\n const map: Record<QueryParam, () => z.Schema> = {\n fields: () => this.schemaAwareQueryFields.optional(),\n populate: () => this.schemaAwareQueryPopulate.optional(),\n sort: () => this.schemaAwareQuerySort.optional(),\n filters: () => this.schemaAwareFilters.optional(),\n locale: () => this.locale.optional(),\n pagination: () => this.pagination.optional(),\n status: () => this.status.optional(),\n publicationFilter: () => this.publicationFilter.optional(),\n hasPublishedVersion: () => this.hasPublishedVersion.optional(),\n _q: () => this.query.optional(),\n } as const;\n\n return params.reduce(\n (acc, param) => ({ ...acc, [param]: map[param]() }),\n {} as Partial<Record<QueryParam, z.Schema>>\n );\n }\n}\n"],"names":["CoreContentTypeRouteValidator","AbstractCoreRouteValidator","documentID","z","uuid","describe","document","entries","Object","_scalarFields","_populatableFields","sanitizedAttributes","filter","attribute","includes","type","attributesSchema","createAttributesSchema","_strapi","object","documentId","id","union","string","number","extend","shape","documents","array","schemaAwareQueryFields","scalarFieldsArray","readonly","schemaAwareQueryPopulate","wildcardPopulate","literal","singleFieldPopulate","populatableFieldsEnum","multiPopulate","populatableFieldsArray","schemaAwareQuerySort","orderDirection","enum","scalarFieldsEnum","fieldRecord","schemaAwareFilters","record","any","locale","status","publicationFilter","hasPublishedVersion","boolean","data","isWritableAttribute","attributeName","contentTypes","_schema","createAttributesInputSchema","query","body","partialBody","partial","queryParams","params","map","fields","optional","populate","sort","filters","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AAA,EAAI,IAAM,IAAI,CAACb,KAAK,CAACQ,QAAQ;AAC/B,SAAA;AAEA,QAAA,OAAOH,OAAOS,MAAM,CAClB,CAACC,GAAAA,EAAKC,SAAW;AAAE,gBAAA,GAAGD,GAAG;AAAE,gBAAA,CAACC,KAAAA,GAAQV,GAAG,CAACU,KAAAA,CAAM;AAAG,aAAA,GACjD,EAAC,CAAA;AAEL,IAAA;AACF;;;;"}
1
+ {"version":3,"file":"content-type.js","sources":["../../../../src/core-api/routes/validation/content-type.ts"],"sourcesContent":["import type { Schema, UID } from '@strapi/types';\n\nimport { contentTypes } from '@strapi/utils';\nimport * as z from 'zod/v4';\n\n// eslint-disable-next-line import/no-cycle\nimport { createAttributesInputSchema, createAttributesSchema } from './mappers';\nimport { AbstractCoreRouteValidator } from './common';\n\n/** REST query param names. `hasPublishedVersion` is deprecated in favor of `publicationFilter`. */\nexport type QueryParam =\n | 'fields'\n | 'populate'\n | 'sort'\n | 'status'\n | 'publicationFilter'\n | 'hasPublishedVersion'\n | 'locale'\n | 'pagination'\n | 'filters'\n | '_q';\n\n/**\n * A validator for core content-type routes.\n *\n * Provides validation schemas and utilities for handling content-type-specific route validation.\n * Extends the base AbstractRouteValidator with schema-aware validation for Strapi content types.\n *\n * @example\n * ```ts\n * const strapi = // ... strapi instance\n * const uid = 'api::article.article'\n * const validator = new CoreContentTypeRouteValidator(strapi, uid);\n *\n * // Get validation schema for document\n * const documentSchema = validator.document;\n *\n * // Validate query parameters with schema awareness\n * const querySchema = validator.queryParams(['fields', 'populate', 'sort']);\n * ```\n */\nexport class CoreContentTypeRouteValidator extends AbstractCoreRouteValidator<UID.ContentType> {\n /**\n * Generates a validation schema for document IDs\n *\n * @returns A schema that validates UUIDs\n *\n * @example\n * ```ts\n * const validator = new CoreContentTypeRouteValidator(strapi, uid);\n * const idSchema = validator.documentID;\n * ```\n */\n get documentID() {\n return z.uuid().describe('The document ID, represented by a UUID');\n }\n\n /**\n * Generates a comprehensive validation schema for a single document.\n *\n * Combines scalar fields and populatable fields into a single schema.\n *\n * @returns A schema for validating complete documents\n *\n * @example\n * ```ts\n * const validator = new CoreContentTypeRouteValidator(strapi, uid);\n * const docSchema = validator.document;\n * ```\n */\n get document() {\n const entries = Object.entries({ ...this._scalarFields, ...this._populatableFields });\n\n const sanitizedAttributes = entries\n // Remove passwords from the attribute list\n .filter(([, attribute]) => !['password'].includes(attribute.type));\n\n // Merge all attributes into a single schema\n const attributesSchema = createAttributesSchema(this._strapi, sanitizedAttributes);\n\n return z\n .object({\n documentId: this.documentID,\n id: z.union([z.string(), z.number()]),\n })\n .extend(attributesSchema.shape);\n }\n\n /**\n * Generates a validation schema for an array of documents\n *\n * @returns A schema for validating arrays of documents\n *\n * @example\n * ```ts\n * const validator = new CoreContentTypeRouteValidator(strapi, uid);\n * const docsSchema = validator.documents;\n * ```\n */\n get documents() {\n return z.array(this.document);\n }\n\n /**\n * Schema-aware fields validation that restricts to actual model fields\n */\n protected get schemaAwareQueryFields() {\n return this.scalarFieldsArray\n .readonly()\n .describe(\n `The fields to return, this doesn't include populatable fields like relations, components, files, or dynamic zones`\n );\n }\n\n /**\n * Schema-aware populate validation that restricts to actual populatable fields\n */\n protected get schemaAwareQueryPopulate() {\n const wildcardPopulate = z\n .literal('*')\n .readonly()\n .describe(\n 'Populate all the first level relations, components, files, and dynamic zones for the entry'\n );\n\n const singleFieldPopulate = this.populatableFieldsEnum\n .readonly()\n .describe('Populate a single relation, component, file, or dynamic zone');\n\n const multiPopulate = this.populatableFieldsArray.describe(\n 'Populate a selection of multiple relations, components, files, or dynamic zones'\n );\n\n return z.union([wildcardPopulate, singleFieldPopulate, multiPopulate]);\n }\n\n /**\n * Schema-aware sort validation that restricts to actual model fields\n */\n protected get schemaAwareQuerySort() {\n const orderDirection = z.enum(['asc', 'desc']);\n\n // TODO: Handle nested sorts but very low priority, very little usage\n return z\n .union([\n this.scalarFieldsEnum, // 'name' | 'title'\n this.scalarFieldsArray, // ['name', 'title']\n this.fieldRecord(orderDirection), // { name: 'desc' } | { title: 'asc' }\n z.array(this.fieldRecord(orderDirection)), // [{ name: 'desc'}, { title: 'asc' }]\n ])\n .describe('Sort the result');\n }\n\n /**\n * Schema-aware filters validation that restricts to actual model fields\n */\n protected get schemaAwareFilters() {\n return z.record(this.scalarFieldsEnum, z.any()).describe('Filters to apply to the query');\n }\n\n get locale() {\n return z.string().describe('Select a locale');\n }\n\n get status() {\n return z\n .enum(['draft', 'published'])\n .describe('Fetch documents based on their status. Default to \"published\" if not specified.');\n }\n\n get publicationFilter() {\n return z\n .enum([\n 'never-published',\n 'has-published-version',\n 'modified',\n 'unmodified',\n 'never-published-document',\n 'has-published-version-document',\n 'published-without-draft',\n 'published-with-draft',\n ])\n .describe(\n 'Derived publication cohort: pair-scoped (per documentId+locale), document-scoped variants (-document), or published-slice diagnostics (published-without-draft / published-with-draft)'\n );\n }\n\n /** @deprecated Use `publicationFilter` instead (`never-published`, `has-published-version`, …). */\n get hasPublishedVersion() {\n return z\n .union([z.boolean(), z.enum(['true', 'false'])])\n .describe(\n '[Deprecated: prefer publicationFilter] Filter documents by whether they have a published version. Use with status=draft to find documents that have never been published'\n );\n }\n\n get data() {\n const isWritableAttribute = ([attributeName]: [string, Schema.Attribute.AnyAttribute]) => {\n return contentTypes.isWritableAttribute(this._schema, attributeName);\n };\n\n const entries = Object.entries({ ...this._scalarFields, ...this._populatableFields });\n\n const sanitizedAttributes = entries\n // Remove non-writable attributes\n .filter(isWritableAttribute);\n\n return createAttributesInputSchema(this._strapi, sanitizedAttributes);\n }\n\n get query() {\n return z.string();\n }\n\n get body() {\n return z.object({ data: this.data });\n }\n\n get partialBody() {\n return z.object({ data: this.data.partial() });\n }\n\n /**\n * Creates validation schemas for query parameters\n *\n * @param params - Array of query parameters to validate ('fields', 'populate', 'sort', ...)\n * @returns Object containing validation schemas for requested parameters\n *\n * @example\n * ```ts\n * const validator = new CoreContentTypeRouteValidator(strapi, uid);\n * const querySchemas = validator.queryParams(['fields', 'populate']);\n * ```\n */\n queryParams(params: QueryParam[]): Partial<Record<QueryParam, z.Schema>> {\n const map: Record<QueryParam, () => z.Schema> = {\n fields: () => this.schemaAwareQueryFields.optional(),\n populate: () => this.schemaAwareQueryPopulate.optional(),\n sort: () => this.schemaAwareQuerySort.optional(),\n filters: () => this.schemaAwareFilters.optional(),\n locale: () => this.locale.optional(),\n pagination: () => this.pagination.optional(),\n status: () => this.status.optional(),\n publicationFilter: () => this.publicationFilter.optional(),\n hasPublishedVersion: () => this.hasPublishedVersion.optional(),\n _q: () => this.query.optional(),\n } as const;\n\n return params.reduce(\n (acc, param) => ({ ...acc, [param]: map[param]() }),\n {} as Partial<Record<QueryParam, z.Schema>>\n );\n }\n}\n"],"names":["CoreContentTypeRouteValidator","AbstractCoreRouteValidator","documentID","z","uuid","describe","document","entries","Object","_scalarFields","_populatableFields","sanitizedAttributes","filter","attribute","includes","type","attributesSchema","createAttributesSchema","_strapi","object","documentId","id","union","string","number","extend","shape","documents","array","schemaAwareQueryFields","scalarFieldsArray","readonly","schemaAwareQueryPopulate","wildcardPopulate","literal","singleFieldPopulate","populatableFieldsEnum","multiPopulate","populatableFieldsArray","schemaAwareQuerySort","orderDirection","enum","scalarFieldsEnum","fieldRecord","schemaAwareFilters","record","any","locale","status","publicationFilter","hasPublishedVersion","boolean","data","isWritableAttribute","attributeName","contentTypes","_schema","createAttributesInputSchema","query","body","partialBody","partial","queryParams","params","map","fields","optional","populate","sort","filters","pagination","_q","reduce","acc","param"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA;;;;;;;;;;;;;;;;;;IAmBO,MAAMA,6BAAAA,SAAsCC,iCAAAA,CAAAA;AACjD;;;;;;;;;;AAUC,MACD,IAAIC,UAAAA,GAAa;AACf,QAAA,OAAOC,YAAAA,CAAEC,IAAI,EAAA,CAAGC,QAAQ,CAAC,wCAAA,CAAA;AAC3B,IAAA;AAEA;;;;;;;;;;;;AAYC,MACD,IAAIC,QAAAA,GAAW;QACb,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../src/core-api/routes/validation/mappers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAgB5B;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,WACzB,KAAK,MAAM,cACP,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,SAAS,CAAC,YAAY,CAAC,EAAE,mCASvE,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,2BAA2B,WAC9B,KAAK,MAAM,cACP,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,SAAS,CAAC,YAAY,CAAC,EAAE,mCASvE,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,WACvB,KAAK,MAAM,aACR,OAAO,SAAS,CAAC,YAAY,KACvC,EAAE,UA4DJ,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,yBAAyB,WAC5B,KAAK,MAAM,aACR,OAAO,SAAS,CAAC,YAAY,KACvC,EAAE,UA4DJ,CAAC"}
1
+ {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/core-api/routes/validation/mappers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAgB5B;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,IAAI,CAAC,MAAM,EACnB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,mCASvE,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,2BAA2B,GACtC,QAAQ,IAAI,CAAC,MAAM,EACnB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,mCASvE,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,IAAI,CAAC,MAAM,EACnB,WAAW,MAAM,CAAC,SAAS,CAAC,YAAY,KACvC,CAAC,CAAC,UA4DJ,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,IAAI,CAAC,MAAM,EACnB,WAAW,MAAM,CAAC,SAAS,CAAC,YAAY,KACvC,CAAC,CAAC,UA4DJ,CAAC"}
@@ -3,7 +3,8 @@
3
3
  var z = require('zod/v4');
4
4
  var attributes = require('./attributes.js');
5
5
 
6
- function _interopNamespaceDefault(e) {
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
7
8
  var n = Object.create(null);
8
9
  if (e) {
9
10
  Object.keys(e).forEach(function (k) {
@@ -20,7 +21,7 @@ function _interopNamespaceDefault(e) {
20
21
  return Object.freeze(n);
21
22
  }
22
23
 
23
- var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
24
+ var z__namespace = /*#__PURE__*/_interopNamespace(z);
24
25
 
25
26
  const isCustomFieldAttribute = (attribute)=>{
26
27
  return !!attribute && typeof attribute === 'object' && attribute.type === 'customField' && typeof attribute.customField === 'string';
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.js","sources":["../../../../src/core-api/routes/validation/mappers.ts"],"sourcesContent":["/**\n * @fileoverview\n * This file contains functions responsible for mapping Strapi attribute definitions to Zod schemas.\n */\n\nimport type { Core, Schema } from '@strapi/types';\nimport * as z from 'zod/v4';\n\n// eslint-disable-next-line import/no-cycle\nimport * as attributes from './attributes';\n\nconst isCustomFieldAttribute = (\n attribute: unknown\n): attribute is { type: 'customField'; customField: string } => {\n return (\n !!attribute &&\n typeof attribute === 'object' &&\n (attribute as any).type === 'customField' &&\n typeof (attribute as any).customField === 'string'\n );\n};\n\n/**\n * Creates a Zod schema for a collection of Strapi attributes.\n *\n * @param attributes - An array of tuples, where each tuple contains the attribute name and its schema definition.\n * @returns A Zod object schema representing the combined attributes.\n *\n * @example\n * ```typescript\n * const myAttributes = [\n * ['title', { type: 'string', required: true }],\n * ['description', { type: 'text' }],\n * ];\n * const schema = createAttributesSchema(myAttributes);\n * // schema will be a Zod object with 'title' and 'description' fields,\n * // each mapped to their respective Zod schemas based on their Strapi attribute types.\n * ```\n */\nexport const createAttributesSchema = (\n strapi: Core.Strapi,\n attributes: [name: string, attribute: Schema.Attribute.AnyAttribute][]\n) => {\n return attributes.reduce((acc, [name, attribute]) => {\n return acc.extend({\n get [name]() {\n return mapAttributeToSchema(strapi, attribute);\n },\n });\n }, z.object({}));\n};\n\n/**\n * Creates a Zod input schema for a collection of Strapi attributes.\n * This is typically used for validating incoming data (e.g., from API requests).\n *\n * @param attributes - An array of tuples, where each tuple contains the attribute name and its schema definition.\n * @returns A Zod object schema representing the combined input attributes.\n *\n * @example\n * ```typescript\n * const myInputAttributes = [\n * ['email', { type: 'email', required: true }],\n * ['description', { type: 'text', minLength: 8 }],\n * ];\n * const inputSchema = createAttributesInputSchema(myInputAttributes);\n * // inputSchema will be a Zod object with 'email' and 'description' fields,\n * // mapped to Zod schemas suitable for input validation.\n * ```\n */\nexport const createAttributesInputSchema = (\n strapi: Core.Strapi,\n attributes: [name: string, attribute: Schema.Attribute.AnyAttribute][]\n) => {\n return attributes.reduce((acc, [name, attribute]) => {\n return acc.extend({\n get [name]() {\n return mapAttributeToInputSchema(strapi, attribute);\n },\n });\n }, z.object({}));\n};\n\n/**\n * Maps a Strapi attribute definition to a corresponding Zod validation schema.\n *\n * This function handles every Strapi attribute types and converts them into\n * appropriate Zod validation schemas.\n *\n * @param attribute - The Strapi attribute configuration object.\n * @returns A Zod schema that corresponds to the input attribute's type.\n * @throws {Error} Throws an error if an unsupported attribute type is provided.\n *\n * @example\n * ```typescript\n * const stringAttribute = { type: 'string', minLength: 3 };\n * const stringSchema = mapAttributeToSchema(stringAttribute); // Returns a Zod string schema with minLength.\n *\n * const booleanAttribute = { type: 'boolean', default: false };\n * const booleanSchema = mapAttributeToSchema(booleanAttribute); // Returns a Zod boolean schema with a default.\n * ```\n */\nexport const mapAttributeToSchema = (\n strapi: Core.Strapi,\n attribute: Schema.Attribute.AnyAttribute\n): z.ZodTypeAny => {\n switch (attribute.type) {\n case 'biginteger':\n return attributes.bigIntegerToSchema(attribute);\n case 'blocks':\n return attributes.blocksToSchema();\n case 'boolean':\n return attributes.booleanToSchema(attribute);\n case 'component':\n return attributes.componentToSchema(strapi, attribute);\n case 'date':\n return attributes.dateToSchema(attribute);\n case 'datetime':\n return attributes.datetimeToSchema(attribute);\n case 'decimal':\n return attributes.decimalToSchema(attribute);\n case 'dynamiczone':\n return attributes.dynamicZoneToSchema(attribute);\n case 'email':\n return attributes.emailToSchema(attribute);\n case 'enumeration':\n return attributes.enumToSchema(attribute);\n case 'float':\n return attributes.floatToSchema(attribute);\n case 'integer':\n return attributes.integerToSchema(attribute);\n case 'json':\n return attributes.jsonToSchema(attribute);\n case 'media':\n return attributes.mediaToSchema(strapi, attribute);\n case 'relation':\n return attributes.relationToSchema(strapi, attribute);\n case 'password':\n case 'text':\n case 'richtext':\n case 'string':\n return attributes.stringToSchema(attribute);\n case 'time':\n return attributes.timeToSchema(attribute);\n case 'timestamp':\n return attributes.timestampToSchema(attribute);\n case 'uid':\n return attributes.uidToSchema(attribute);\n default: {\n if (isCustomFieldAttribute(attribute)) {\n const attrCF = attribute as { type: 'customField'; customField: string };\n const customField = strapi.get('custom-fields').get(attrCF.customField);\n if (!customField) {\n throw new Error(`Custom field '${attrCF.customField}' not found`);\n }\n\n // Re-dispatch with the resolved underlying Strapi kind\n return mapAttributeToSchema(strapi, { ...attrCF, type: customField.type });\n }\n\n const { type } = attribute as Schema.Attribute.AnyAttribute;\n\n throw new Error(`Unsupported attribute type: ${type}`);\n }\n }\n};\n\n/**\n * Maps a Strapi attribute definition to a corresponding Zod input validation schema.\n *\n * This function handles every Strapi attribute types and converts them into\n * appropriate Zod validation schemas with their respective constraints.\n *\n * @param attribute - The Strapi attribute configuration object. Contains type information\n * and validation rules for the attribute.\n *\n * @returns A Zod schema that corresponds to the input attribute's type and validation rules\n *\n * @example\n * ```typescript\n * // String attribute with constraints\n * const stringAttribute = {\n * type: 'string',\n * minLength: 3,\n * maxLength: 50,\n * required: true\n * };\n * const stringSchema = mapAttributeToInputSchema(stringAttribute);\n *\n * // Enumeration attribute\n * const enumAttribute = {\n * type: 'enumeration',\n * enum: ['draft', 'published', 'archived']\n * };\n * const enumSchema = mapAttributeToInputSchema(enumAttribute);\n *\n * // Media attribute with multiple files\n * const mediaAttribute = {\n * type: 'media',\n * multiple: true\n * };\n * const mediaSchema = mapAttributeToInputSchema(mediaAttribute);\n * ```\n *\n * @throws {Error} Throws an error if an unsupported attribute type is provided\n *\n */\nexport const mapAttributeToInputSchema = (\n strapi: Core.Strapi,\n attribute: Schema.Attribute.AnyAttribute\n): z.ZodTypeAny => {\n switch (attribute.type) {\n case 'biginteger':\n return attributes.bigIntegerToInputSchema(attribute);\n case 'blocks':\n return attributes.blocksToInputSchema();\n case 'boolean':\n return attributes.booleanToInputSchema(attribute);\n case 'component':\n return attributes.componentToInputSchema(attribute);\n case 'date':\n return attributes.dateToInputSchema(attribute);\n case 'datetime':\n return attributes.datetimeToInputSchema(attribute);\n case 'decimal':\n return attributes.decimalToInputSchema(attribute);\n case 'dynamiczone':\n return attributes.dynamicZoneToInputSchema(attribute);\n case 'email':\n return attributes.emailToInputSchema(attribute);\n case 'enumeration':\n return attributes.enumerationToInputSchema(attribute);\n case 'float':\n return attributes.floatToInputSchema(attribute);\n case 'integer':\n return attributes.integerToInputSchema(attribute);\n case 'json':\n return attributes.jsonToInputSchema(attribute);\n case 'media':\n return attributes.mediaToInputSchema(attribute);\n case 'relation':\n return attributes.relationToInputSchema(attribute);\n case 'password':\n case 'text':\n case 'richtext':\n case 'string':\n return attributes.textToInputSchema(attribute);\n case 'time':\n return attributes.timeToInputSchema(attribute);\n case 'timestamp':\n return attributes.timestampToInputSchema(attribute);\n case 'uid':\n return attributes.uidToInputSchema(attribute);\n default: {\n if (isCustomFieldAttribute(attribute)) {\n const attrCF = attribute as { type: 'customField'; customField: string };\n const customField = strapi.get('custom-fields').get(attrCF.customField);\n if (!customField) {\n throw new Error(`Custom field '${attrCF.customField}' not found`);\n }\n\n // Re-dispatch with the resolved underlying Strapi kind\n return mapAttributeToInputSchema(strapi, { ...attrCF, type: customField.type });\n }\n\n const { type } = attribute as Schema.Attribute.AnyAttribute;\n\n throw new Error(`Unsupported attribute type: ${type}`);\n }\n }\n};\n"],"names":["isCustomFieldAttribute","attribute","type","customField","createAttributesSchema","strapi","attributes","reduce","acc","name","extend","mapAttributeToSchema","z","object","createAttributesInputSchema","mapAttributeToInputSchema","attrCF","get","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAMA,yBAAyB,CAC7BC,SAAAA,GAAAA;AAEA,IAAA,OACE,CAAC,CAACA,SAAAA,IACF,OAAOA,cAAc,QAAA,IACpBA,SAAAA,CAAkBC,IAAI,KAAK,aAAA,IAC5B,OAAO,SAACD,CAAkBE,WAAW,KAAK,QAAA;AAE9C,CAAA;AAEA;;;;;;;;;;;;;;;;AAgBC,IACM,MAAMC,sBAAAA,GAAyB,CACpCC,MAAAA,EACAC,UAAAA,GAAAA;AAEA,IAAA,OAAOA,WAAWC,MAAM,CAAC,CAACC,GAAAA,EAAK,CAACC,MAAMR,SAAAA,CAAU,GAAA;QAC9C,OAAOO,GAAAA,CAAIE,MAAM,CAAC;YAChB,KAAKD,MAAK,GAAG;AACX,gBAAA,OAAOE,qBAAqBN,MAAAA,EAAQJ,SA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,SAAAA,CAAAA;QACtC,KAAK,WAAA;YACH,OAAOK,iCAAiC,CAACL,SAAAA,CAAAA;QAC3C,KAAK,KAAA;YACH,OAAOK,2BAA2B,CAACL,SAAAA,CAAAA;AACrC,QAAA;AAAS,YAAA;AACP,gBAAA,IAAID,uBAAuBC,SAAAA,CAAAA,EAAY;AACrC,oBAAA,MAAMe,MAAAA,GAASf,SAAAA;oBACf,MAAME,WAAAA,GAAcE,OAAOY,GAAG,CAAC,iBAAiBA,GAAG,CAACD,OAAOb,WAAW,CAAA;AACtE,oBAAA,IAAI,CAACA,WAAAA,EAAa;wBAChB,MAAM,IAAIe,MAAM,CAAC,cAAc,EAAEF,MAAAA,CAAOb,WAAW,CAAC,WAAW,CAAC,CAAA;AAClE,oBAAA;;AAGA,oBAAA,OAAOY,0BAA0BV,MAAAA,EAAQ;AAAE,wBAAA,GAAGW,MAAM;AAAEd,wBAAAA,IAAAA,EAAMC,YAAYD;AAAK,qBAAA,CAAA;AAC/E,gBAAA;gBAEA,MAAM,EAAEA,IAAI,EAAE,GAAGD,SAAAA;AAEjB,gBAAA,MAAM,IAAIiB,KAAAA,CAAM,CAAC,4BAA4B,EAAEhB,IAAAA,CAAAA,CAAM,CAAA;AACvD,YAAA;AACF;AACF;;;;;;;"}
1
+ {"version":3,"file":"mappers.js","sources":["../../../../src/core-api/routes/validation/mappers.ts"],"sourcesContent":["/**\n * @fileoverview\n * This file contains functions responsible for mapping Strapi attribute definitions to Zod schemas.\n */\n\nimport type { Core, Schema } from '@strapi/types';\nimport * as z from 'zod/v4';\n\n// eslint-disable-next-line import/no-cycle\nimport * as attributes from './attributes';\n\nconst isCustomFieldAttribute = (\n attribute: unknown\n): attribute is { type: 'customField'; customField: string } => {\n return (\n !!attribute &&\n typeof attribute === 'object' &&\n (attribute as any).type === 'customField' &&\n typeof (attribute as any).customField === 'string'\n );\n};\n\n/**\n * Creates a Zod schema for a collection of Strapi attributes.\n *\n * @param attributes - An array of tuples, where each tuple contains the attribute name and its schema definition.\n * @returns A Zod object schema representing the combined attributes.\n *\n * @example\n * ```typescript\n * const myAttributes = [\n * ['title', { type: 'string', required: true }],\n * ['description', { type: 'text' }],\n * ];\n * const schema = createAttributesSchema(myAttributes);\n * // schema will be a Zod object with 'title' and 'description' fields,\n * // each mapped to their respective Zod schemas based on their Strapi attribute types.\n * ```\n */\nexport const createAttributesSchema = (\n strapi: Core.Strapi,\n attributes: [name: string, attribute: Schema.Attribute.AnyAttribute][]\n) => {\n return attributes.reduce((acc, [name, attribute]) => {\n return acc.extend({\n get [name]() {\n return mapAttributeToSchema(strapi, attribute);\n },\n });\n }, z.object({}));\n};\n\n/**\n * Creates a Zod input schema for a collection of Strapi attributes.\n * This is typically used for validating incoming data (e.g., from API requests).\n *\n * @param attributes - An array of tuples, where each tuple contains the attribute name and its schema definition.\n * @returns A Zod object schema representing the combined input attributes.\n *\n * @example\n * ```typescript\n * const myInputAttributes = [\n * ['email', { type: 'email', required: true }],\n * ['description', { type: 'text', minLength: 8 }],\n * ];\n * const inputSchema = createAttributesInputSchema(myInputAttributes);\n * // inputSchema will be a Zod object with 'email' and 'description' fields,\n * // mapped to Zod schemas suitable for input validation.\n * ```\n */\nexport const createAttributesInputSchema = (\n strapi: Core.Strapi,\n attributes: [name: string, attribute: Schema.Attribute.AnyAttribute][]\n) => {\n return attributes.reduce((acc, [name, attribute]) => {\n return acc.extend({\n get [name]() {\n return mapAttributeToInputSchema(strapi, attribute);\n },\n });\n }, z.object({}));\n};\n\n/**\n * Maps a Strapi attribute definition to a corresponding Zod validation schema.\n *\n * This function handles every Strapi attribute types and converts them into\n * appropriate Zod validation schemas.\n *\n * @param attribute - The Strapi attribute configuration object.\n * @returns A Zod schema that corresponds to the input attribute's type.\n * @throws {Error} Throws an error if an unsupported attribute type is provided.\n *\n * @example\n * ```typescript\n * const stringAttribute = { type: 'string', minLength: 3 };\n * const stringSchema = mapAttributeToSchema(stringAttribute); // Returns a Zod string schema with minLength.\n *\n * const booleanAttribute = { type: 'boolean', default: false };\n * const booleanSchema = mapAttributeToSchema(booleanAttribute); // Returns a Zod boolean schema with a default.\n * ```\n */\nexport const mapAttributeToSchema = (\n strapi: Core.Strapi,\n attribute: Schema.Attribute.AnyAttribute\n): z.ZodTypeAny => {\n switch (attribute.type) {\n case 'biginteger':\n return attributes.bigIntegerToSchema(attribute);\n case 'blocks':\n return attributes.blocksToSchema();\n case 'boolean':\n return attributes.booleanToSchema(attribute);\n case 'component':\n return attributes.componentToSchema(strapi, attribute);\n case 'date':\n return attributes.dateToSchema(attribute);\n case 'datetime':\n return attributes.datetimeToSchema(attribute);\n case 'decimal':\n return attributes.decimalToSchema(attribute);\n case 'dynamiczone':\n return attributes.dynamicZoneToSchema(attribute);\n case 'email':\n return attributes.emailToSchema(attribute);\n case 'enumeration':\n return attributes.enumToSchema(attribute);\n case 'float':\n return attributes.floatToSchema(attribute);\n case 'integer':\n return attributes.integerToSchema(attribute);\n case 'json':\n return attributes.jsonToSchema(attribute);\n case 'media':\n return attributes.mediaToSchema(strapi, attribute);\n case 'relation':\n return attributes.relationToSchema(strapi, attribute);\n case 'password':\n case 'text':\n case 'richtext':\n case 'string':\n return attributes.stringToSchema(attribute);\n case 'time':\n return attributes.timeToSchema(attribute);\n case 'timestamp':\n return attributes.timestampToSchema(attribute);\n case 'uid':\n return attributes.uidToSchema(attribute);\n default: {\n if (isCustomFieldAttribute(attribute)) {\n const attrCF = attribute as { type: 'customField'; customField: string };\n const customField = strapi.get('custom-fields').get(attrCF.customField);\n if (!customField) {\n throw new Error(`Custom field '${attrCF.customField}' not found`);\n }\n\n // Re-dispatch with the resolved underlying Strapi kind\n return mapAttributeToSchema(strapi, { ...attrCF, type: customField.type });\n }\n\n const { type } = attribute as Schema.Attribute.AnyAttribute;\n\n throw new Error(`Unsupported attribute type: ${type}`);\n }\n }\n};\n\n/**\n * Maps a Strapi attribute definition to a corresponding Zod input validation schema.\n *\n * This function handles every Strapi attribute types and converts them into\n * appropriate Zod validation schemas with their respective constraints.\n *\n * @param attribute - The Strapi attribute configuration object. Contains type information\n * and validation rules for the attribute.\n *\n * @returns A Zod schema that corresponds to the input attribute's type and validation rules\n *\n * @example\n * ```typescript\n * // String attribute with constraints\n * const stringAttribute = {\n * type: 'string',\n * minLength: 3,\n * maxLength: 50,\n * required: true\n * };\n * const stringSchema = mapAttributeToInputSchema(stringAttribute);\n *\n * // Enumeration attribute\n * const enumAttribute = {\n * type: 'enumeration',\n * enum: ['draft', 'published', 'archived']\n * };\n * const enumSchema = mapAttributeToInputSchema(enumAttribute);\n *\n * // Media attribute with multiple files\n * const mediaAttribute = {\n * type: 'media',\n * multiple: true\n * };\n * const mediaSchema = mapAttributeToInputSchema(mediaAttribute);\n * ```\n *\n * @throws {Error} Throws an error if an unsupported attribute type is provided\n *\n */\nexport const mapAttributeToInputSchema = (\n strapi: Core.Strapi,\n attribute: Schema.Attribute.AnyAttribute\n): z.ZodTypeAny => {\n switch (attribute.type) {\n case 'biginteger':\n return attributes.bigIntegerToInputSchema(attribute);\n case 'blocks':\n return attributes.blocksToInputSchema();\n case 'boolean':\n return attributes.booleanToInputSchema(attribute);\n case 'component':\n return attributes.componentToInputSchema(attribute);\n case 'date':\n return attributes.dateToInputSchema(attribute);\n case 'datetime':\n return attributes.datetimeToInputSchema(attribute);\n case 'decimal':\n return attributes.decimalToInputSchema(attribute);\n case 'dynamiczone':\n return attributes.dynamicZoneToInputSchema(attribute);\n case 'email':\n return attributes.emailToInputSchema(attribute);\n case 'enumeration':\n return attributes.enumerationToInputSchema(attribute);\n case 'float':\n return attributes.floatToInputSchema(attribute);\n case 'integer':\n return attributes.integerToInputSchema(attribute);\n case 'json':\n return attributes.jsonToInputSchema(attribute);\n case 'media':\n return attributes.mediaToInputSchema(attribute);\n case 'relation':\n return attributes.relationToInputSchema(attribute);\n case 'password':\n case 'text':\n case 'richtext':\n case 'string':\n return attributes.textToInputSchema(attribute);\n case 'time':\n return attributes.timeToInputSchema(attribute);\n case 'timestamp':\n return attributes.timestampToInputSchema(attribute);\n case 'uid':\n return attributes.uidToInputSchema(attribute);\n default: {\n if (isCustomFieldAttribute(attribute)) {\n const attrCF = attribute as { type: 'customField'; customField: string };\n const customField = strapi.get('custom-fields').get(attrCF.customField);\n if (!customField) {\n throw new Error(`Custom field '${attrCF.customField}' not found`);\n }\n\n // Re-dispatch with the resolved underlying Strapi kind\n return mapAttributeToInputSchema(strapi, { ...attrCF, type: customField.type });\n }\n\n const { type } = attribute as Schema.Attribute.AnyAttribute;\n\n throw new Error(`Unsupported attribute type: ${type}`);\n }\n }\n};\n"],"names":["isCustomFieldAttribute","attribute","type","customField","createAttributesSchema","strapi","attributes","reduce","acc","name","extend","mapAttributeToSchema","z","object","createAttributesInputSchema","mapAttributeToInputSchema","attrCF","get","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAMA,yBAAyB,CAC7BC,SAAAA,GAAAA;AAEA,IAAA,OACE,CAAC,CAACA,SAAAA,IACF,OAAOA,cAAc,QAAA,IACpBA,SAAAA,CAAkBC,IAAI,KAAK,aAAA,IAC5B,OAAO,SAACD,CAAkBE,WAAW,KAAK,QAAA;AAE9C,CAAA;AAEA;;;;;;;;;;;;;;;;AAgBC,IACM,MAAMC,sBAAAA,GAAyB,CACpCC,MAAAA,EACAC,UAAAA,GAAAA;AAEA,IAAA,OAAOA,WAAWC,MAAM,CAAC,CAACC,GAAAA,EAAK,CAACC,MAAMR,SAAAA,CAAU,GAAA;QAC9C,OAAOO,GAAAA,CAAIE,MAAM,CAAC;YAChB,KAAKD,MAAK,GAAG;AACX,gBAAA,OAAOE,qBAAqBN,MAAAA,EAAQJ,SAAAA,CAAAA;AACtC,YAAA;AACF,SAAA,CAAA;IACF,CAAA,EAAGW,YAAAA,CAAEC,MAAM,CAAC,EAAC,CAAA,CAAA;AACf;AAEA;;;;;;;;;;;;;;;;;AAiBC,IACM,MAAMC,2BAAAA,GAA8B,CACzCT,MAAAA,EACAC,UAAAA,GAAAA;AAEA,IAA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oBAAA,MAAMe,MAAAA,GAASf,SAAAA;oBACf,MAAME,WAAAA,GAAcE,OAAOY,GAAG,CAAC,iBAAiBA,GAAG,CAACD,OAAOb,WAAW,CAAA;AACtE,oBAAA,IAAI,CAACA,WAAAA,EAAa;wBAChB,MAAM,IAAIe,MAAM,CAAC,cAAc,EAAEF,MAAAA,CAAOb,WAAW,CAAC,WAAW,CAAC,CAAA;AAClE,oBAAA;;AAGA,oBAAA,OAAOY,0BAA0BV,MAAAA,EAAQ;AAAE,wBAAA,GAAGW,MAAM;AAAEd,wBAAAA,IAAAA,EAAMC,YAAYD;AAAK,qBAAA,CAAA;AAC/E,gBAAA;gBAEA,MAAM,EAAEA,IAAI,EAAE,GAAGD,SAAAA;AAEjB,gBAAA,MAAM,IAAIiB,KAAAA,CAAM,CAAC,4BAA4B,EAAEhB,IAAAA,CAAAA,CAAM,CAAA;AACvD,YAAA;AACF;AACF;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/core-api/routes/validation/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,WACxB,KAAK,MAAM,MACf,SAAS,GAAG,CAAC,MAAM,UACf,EAAE,OAAO,SAyBlB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,kBAAkB,WACrB,KAAK,MAAM,MACf,SAAS,GAAG,CAAC,MAAM,YACb,MAAM,EAAE,OAAO,kFAyD1B,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/core-api/routes/validation/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,IAAI,CAAC,MAAM,EACnB,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,EACvB,QAAQ,CAAC,CAAC,OAAO,SAyBlB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,IAAI,CAAC,MAAM,EACnB,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,EACvB,UAAU,MAAM,CAAC,CAAC,OAAO,kFAyD1B,CAAC"}
@@ -3,7 +3,8 @@
3
3
  var strapiUtils = require('@strapi/utils');
4
4
  var z = require('zod/v4');
5
5
 
6
- function _interopNamespaceDefault(e) {
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
7
8
  var n = Object.create(null);
8
9
  if (e) {
9
10
  Object.keys(e).forEach(function (k) {
@@ -20,7 +21,7 @@ function _interopNamespaceDefault(e) {
20
21
  return Object.freeze(n);
21
22
  }
22
23
 
23
- var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
24
+ var z__namespace = /*#__PURE__*/_interopNamespace(z);
24
25
 
25
26
  // Schema generation happens on-demand when schemas don't exist in the registry
26
27
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../src/core-api/routes/validation/utils.ts"],"sourcesContent":["import { transformUidToValidOpenApiName } from '@strapi/utils';\nimport type { Core, Internal } from '@strapi/types';\nimport * as z from 'zod/v4';\n\n// Schema generation happens on-demand when schemas don't exist in the registry\n\n/**\n * Safely adds or updates a schema in Zod's global registry.\n *\n * If a schema with the given `id` already exists, it will be removed before adding the new one.\n *\n * This is useful for hot-reloading or preventing issues with cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param schema - The Zod schema to register.\n * @example\n * ```typescript\n * safeGlobalRegistrySet(\"mySchema\", z.object({ name: z.string() }));\n * ```\n */\nexport const safeGlobalRegistrySet = (\n strapi: Core.Strapi,\n id: Internal.UID.Schema,\n schema: z.ZodType\n) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n const isReplacing = idMap.has(transformedId);\n\n if (isReplacing) {\n // Remove existing schema to prevent conflicts\n idMap.delete(transformedId);\n }\n\n strapi.log.debug(\n `${isReplacing ? 'Replacing' : 'Registering'} schema ${transformedId} in global registry`\n );\n z.globalRegistry.add(schema, { id: transformedId });\n } catch (error) {\n strapi.log.error(\n `Schema registration failed: Failed to register schema ${id} in global registry`\n );\n\n throw error;\n }\n};\n\n/**\n * Safely creates and registers a Zod schema in the global registry, particularly useful for handling cyclical data structures.\n *\n * If a schema with the given `id` already exists in the global registry, it returns the existing schema.\n *\n * Otherwise, it registers a temporary `z.any()` schema, calls the provided `callback` to create the actual schema,\n * and then replaces the temporary schema with the actual one in the registry.\n *\n * This prevents infinite loops in cases of cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param callback - A function that returns the Zod schema to be created and registered.\n * @returns The created or retrieved Zod schema.\n * @example\n * ```typescript\n * const CategorySchema = safeSchemaCreation(\"Category\", () =>\n * z.object({\n * name: z.string(),\n * products: z.array(safeSchemaCreation(\"Product\", () =>\n * z.object({\n * name: z.string(),\n * category: z.lazy(() => CategorySchema) // Cyclical reference\n * })\n * ))\n * })\n * );\n * ```\n */\nexport const safeSchemaCreation = (\n strapi: Core.Strapi,\n id: Internal.UID.Schema,\n callback: () => z.ZodType\n) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n // Return existing schema if already registered\n const mapItem = idMap.get(transformedId);\n if (mapItem) {\n // Schema already exists, return it silently\n return mapItem;\n }\n\n strapi.log.debug(`Schema ${transformedId} not found in registry, generating new schema`);\n\n // Determine if this is a built-in schema or user content\n const isBuiltInSchema = id.startsWith('plugin::') || id.startsWith('admin');\n\n if (isBuiltInSchema) {\n strapi.log.debug(`Initializing validation schema for ${transformedId}`);\n } else {\n const schemaName = transformedId\n .replace('Document', '')\n .replace('Entry', '')\n .replace(/([A-Z])/g, ' $1')\n .trim();\n strapi.log.debug(`📝 Generating validation schema for \"${schemaName}\"`);\n }\n\n // Temporary any placeholder before replacing with the actual schema type\n // Used to prevent infinite loops in cyclical data structures\n safeGlobalRegistrySet(strapi, id, z.any());\n\n // Generate the actual schema using the callback\n const schema = callback();\n\n // Replace the placeholder with the real schema\n safeGlobalRegistrySet(strapi, id, schema);\n\n // Show completion for user content only\n if (!isBuiltInSchema) {\n const fieldCount = Object.keys((schema as any)?._def?.shape || {}).length || 0;\n const schemaName = transformedId\n .replace('Document', '')\n .replace('Entry', '')\n .replace(/([A-Z])/g, ' $1')\n .trim();\n strapi.log.debug(` ✅ \"${schemaName}\" schema created with ${fieldCount} fields`);\n }\n\n return schema;\n } catch (error) {\n strapi.log.error(`Schema creation failed: Failed to create schema ${id}`);\n\n throw error;\n }\n};\n"],"names":["safeGlobalRegistrySet","strapi","id","schema","_idmap","idMap","z","globalRegistry","transformedId","transformUidToValidOpenApiName","isReplacing","has","delete","log","debug","add","error","safeSchemaCreation","callback","mapItem","get","isBuiltInSchema","startsWith","schemaName","replace","trim","any","fieldCount","Object","keys","_def","shape","length"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIA;AAEA;;;;;;;;;;;;;AAaC,IACM,MAAMA,qBAAAA,GAAwB,CACnCC,QACAC,EAAAA,EACAC,MAAAA,GAAAA;IAEA,IAAI;AACF,QAAA,MAAM,EAAEC,MAAAA,EAAQC,KAAK,EAAE,GAAGC,aAAEC,cAAc;AAE1C,QAAA,MAAMC,gBAAgBC,0CAAAA,CAA+BP,EAAAA,CAAAA;QAErD,MAAMQ,WAAAA,GAAcL,KAAAA,CAAMM,GAAG,CAACH,aAAAA,CAAAA;AAE9B,QAAA,IAAIE,WAAAA,EAAa;;AAEfL,YAAAA,KAAAA,CAAMO,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":"utils.js","sources":["../../../../src/core-api/routes/validation/utils.ts"],"sourcesContent":["import { transformUidToValidOpenApiName } from '@strapi/utils';\nimport type { Core, Internal } from '@strapi/types';\nimport * as z from 'zod/v4';\n\n// Schema generation happens on-demand when schemas don't exist in the registry\n\n/**\n * Safely adds or updates a schema in Zod's global registry.\n *\n * If a schema with the given `id` already exists, it will be removed before adding the new one.\n *\n * This is useful for hot-reloading or preventing issues with cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param schema - The Zod schema to register.\n * @example\n * ```typescript\n * safeGlobalRegistrySet(\"mySchema\", z.object({ name: z.string() }));\n * ```\n */\nexport const safeGlobalRegistrySet = (\n strapi: Core.Strapi,\n id: Internal.UID.Schema,\n schema: z.ZodType\n) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n const isReplacing = idMap.has(transformedId);\n\n if (isReplacing) {\n // Remove existing schema to prevent conflicts\n idMap.delete(transformedId);\n }\n\n strapi.log.debug(\n `${isReplacing ? 'Replacing' : 'Registering'} schema ${transformedId} in global registry`\n );\n z.globalRegistry.add(schema, { id: transformedId });\n } catch (error) {\n strapi.log.error(\n `Schema registration failed: Failed to register schema ${id} in global registry`\n );\n\n throw error;\n }\n};\n\n/**\n * Safely creates and registers a Zod schema in the global registry, particularly useful for handling cyclical data structures.\n *\n * If a schema with the given `id` already exists in the global registry, it returns the existing schema.\n *\n * Otherwise, it registers a temporary `z.any()` schema, calls the provided `callback` to create the actual schema,\n * and then replaces the temporary schema with the actual one in the registry.\n *\n * This prevents infinite loops in cases of cyclical dependencies.\n *\n * @param id - The unique identifier for the schema in the global registry.\n * @param callback - A function that returns the Zod schema to be created and registered.\n * @returns The created or retrieved Zod schema.\n * @example\n * ```typescript\n * const CategorySchema = safeSchemaCreation(\"Category\", () =>\n * z.object({\n * name: z.string(),\n * products: z.array(safeSchemaCreation(\"Product\", () =>\n * z.object({\n * name: z.string(),\n * category: z.lazy(() => CategorySchema) // Cyclical reference\n * })\n * ))\n * })\n * );\n * ```\n */\nexport const safeSchemaCreation = (\n strapi: Core.Strapi,\n id: Internal.UID.Schema,\n callback: () => z.ZodType\n) => {\n try {\n const { _idmap: idMap } = z.globalRegistry;\n\n const transformedId = transformUidToValidOpenApiName(id);\n\n // Return existing schema if already registered\n const mapItem = idMap.get(transformedId);\n if (mapItem) {\n // Schema already exists, return it silently\n return mapItem;\n }\n\n strapi.log.debug(`Schema ${transformedId} not found in registry, generating new schema`);\n\n // Determine if this is a built-in schema or user content\n const isBuiltInSchema = id.startsWith('plugin::') || id.startsWith('admin');\n\n if (isBuiltInSchema) {\n strapi.log.debug(`Initializing validation schema for ${transformedId}`);\n } else {\n const schemaName = transformedId\n .replace('Document', '')\n .replace('Entry', '')\n .replace(/([A-Z])/g, ' $1')\n .trim();\n strapi.log.debug(`📝 Generating validation schema for \"${schemaName}\"`);\n }\n\n // Temporary any placeholder before replacing with the actual schema type\n // Used to prevent infinite loops in cyclical data structures\n safeGlobalRegistrySet(strapi, id, z.any());\n\n // Generate the actual schema using the callback\n const schema = callback();\n\n // Replace the placeholder with the real schema\n safeGlobalRegistrySet(strapi, id, schema);\n\n // Show completion for user content only\n if (!isBuiltInSchema) {\n const fieldCount = Object.keys((schema as any)?._def?.shape || {}).length || 0;\n const schemaName = transformedId\n .replace('Document', '')\n .replace('Entry', '')\n .replace(/([A-Z])/g, ' $1')\n .trim();\n strapi.log.debug(` ✅ \"${schemaName}\" schema created with ${fieldCount} fields`);\n }\n\n return schema;\n } catch (error) {\n strapi.log.error(`Schema creation failed: Failed to create schema ${id}`);\n\n throw error;\n }\n};\n"],"names":["safeGlobalRegistrySet","strapi","id","schema","_idmap","idMap","z","globalRegistry","transformedId","transformUidToValidOpenApiName","isReplacing","has","delete","log","debug","add","error","safeSchemaCreation","callback","mapItem","get","isBuiltInSchema","startsWith","schemaName","replace","trim","any","fieldCount","Object","keys","_def","shape","length"],"mappings":";;;;;;;;;;;;;;;;;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Y,OACpBC,IAAI,EAAA;AACPxB,YAAAA,MAAAA,CAAOY,GAAG,CAACC,KAAK,CAAC,CAAC,MAAM,EAAES,UAAAA,CAAW,sBAAsB,EAAEI,UAAAA,CAAW,OAAO,CAAC,CAAA;AAClF,QAAA;QAEA,OAAOxB,MAAAA;AACT,IAAA,CAAA,CAAE,OAAOa,KAAAA,EAAO;AACdf,QAAAA,MAAAA,CAAOY,GAAG,CAACG,KAAK,CAAC,CAAC,gDAAgD,EAAEd,EAAAA,CAAAA,CAAI,CAAA;QAExE,MAAMc,KAAAA;AACR,IAAA;AACF;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"collection-type.d.ts","sourceRoot":"","sources":["../../../src/core-api/service/collection-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAS3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,qBAAa,qBACX,SAAQ,WACR,YAAW,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc;IAE9C,OAAO,CAAC,WAAW,CAA8B;gBAErC,WAAW,EAAE,MAAM,CAAC,oBAAoB;IAM9C,IAAI,CAAC,MAAM,KAAK;;;;IAgCtB,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,KAAK;IAS/C,MAAM,CAAC,MAAM;;KAAe;IAMlC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM;;KAAe;IASxD,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,KAAK;;;CAU3D;AAED;;;GAGG;AAEH,QAAA,MAAM,2BAA2B,gBAClB,OAAO,oBAAoB,KACvC,KAAK,OAAO,CAAC,OAAO,CAAC,cAEvB,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
1
+ {"version":3,"file":"collection-type.d.ts","sourceRoot":"","sources":["../../../src/core-api/service/collection-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAS3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,qBAAa,qBACX,SAAQ,WACR,YAAW,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc;IAE9C,OAAO,CAAC,WAAW,CAA8B;gBAErC,WAAW,EAAE,MAAM,CAAC,oBAAoB;IAM9C,IAAI,CAAC,MAAM,KAAK;;;;IAgCtB,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,KAAK;IAS/C,MAAM,CAAC,MAAM;;KAAe;IAMlC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM;;KAAe;IASxD,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,KAAK;;;CAU3D;AAED;;;GAGG;AAEH,QAAA,MAAM,2BAA2B,GAC/B,aAAa,MAAM,CAAC,oBAAoB,KACvC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,cAEvB,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/core-api/service/pagination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,UAAU,EAAE,MAAM,eAAe,CAAC;AAEnD,UAAU,oBAAoB;IAC5B,SAAS,CAAC,EAAE,OAAO,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;CACxE;AAED,KAAK,eAAe,GAAG,oBAAoB,GAAG;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC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MAAM,CAAC,MAAM,KAAK;;;CAazB;AAED,QAAA,MAAM,uBAAuB,gBACd,OAAO,gBAAgB,KACnC,KAAK,OAAO,CAAC,OAAO,CAAC,UAEvB,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"single-type.d.ts","sourceRoot":"","sources":["../../../src/core-api/service/single-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,qBAAa,iBAAkB,SAAQ,WAAY,YAAW,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU;IAC3F,OAAO,CAAC,WAAW,CAA0B;gBAEjC,WAAW,EAAE,MAAM,CAAC,gBAAgB;IAM1C,aAAa;IASb,IAAI,CAAC,MAAM,KAAK;IAMhB,cAAc,CAAC,MAAM,KAAK;IAe1B,MAAM,CAAC,MAAM,KAAK;;;CAazB;AAED,QAAA,MAAM,uBAAuB,GAC3B,aAAa,MAAM,CAAC,gBAAgB,KACnC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAEvB,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/content-type/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG5C,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAWF,QAAA,MAAM,iBAAiB,QAAS,MAAM,cAAc,qBAAqB,0DAmCxE,CAAC;AA0EF,QAAA,MAAM,WAAW,WAAY,OAAO,WAAW,WAAW,MAAM,WAK/D,CAAC;AAmBF,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/content-type/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG5C,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAWF,QAAA,MAAM,iBAAiB,GAAI,KAAK,MAAM,EAAE,YAAY,qBAAqB,0DAmCxE,CAAC;AA0EF,QAAA,MAAM,WAAW,GAAI,QAAQ,MAAM,CAAC,WAAW,EAAE,SAAS,MAAM,WAK/D,CAAC;AAmBF,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC"}
@@ -5,6 +5,10 @@ var _ = require('lodash');
5
5
  var strapiUtils = require('@strapi/utils');
6
6
  var validator = require('./validator.js');
7
7
 
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var ___default = /*#__PURE__*/_interopDefault(_);
11
+
8
12
  const { CREATED_AT_ATTRIBUTE, UPDATED_AT_ATTRIBUTE, PUBLISHED_AT_ATTRIBUTE, FIRST_PUBLISHED_AT_ATTRIBUTE, CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = strapiUtils.contentTypes.constants;
9
13
  const createContentType = (uid, definition)=>{
10
14
  try {
@@ -47,8 +51,8 @@ const addTimestamps = (schema)=>{
47
51
  });
48
52
  };
49
53
  const addDraftAndPublish = (schema)=>{
50
- if (!_.has(schema, 'options.draftAndPublish')) {
51
- _.set(schema, 'options.draftAndPublish', false); // Disabled by default
54
+ if (!___default.default.has(schema, 'options.draftAndPublish')) {
55
+ ___default.default.set(schema, 'options.draftAndPublish', false); // Disabled by default
52
56
  }
53
57
  schema.attributes[PUBLISHED_AT_ATTRIBUTE] = {
54
58
  type: 'datetime',
@@ -76,7 +80,7 @@ const addFirstPublishedAt = (schema)=>{
76
80
  }
77
81
  };
78
82
  const addCreatorFields = (schema)=>{
79
- const isPrivate = !_.get(schema, 'options.populateCreatorFields', false);
83
+ const isPrivate = !___default.default.get(schema, 'options.populateCreatorFields', false);
80
84
  schema.attributes[CREATED_BY_ATTRIBUTE] = {
81
85
  type: 'relation',
82
86
  relation: 'oneToOne',
@@ -101,10 +105,10 @@ const addCreatorFields = (schema)=>{
101
105
  const getGlobalId = (schema, prefix)=>{
102
106
  const modelName = schema.info.singularName;
103
107
  const globalId = prefix ? `${prefix}-${modelName}` : modelName;
104
- return schema.globalId || _.upperFirst(_.camelCase(globalId));
108
+ return schema.globalId || ___default.default.upperFirst(___default.default.camelCase(globalId));
105
109
  };
106
110
  const pickSchema = (model)=>{
107
- const schema = _.cloneDeep(_.pick(model, [
111
+ const schema = ___default.default.cloneDeep(___default.default.pick(model, [
108
112
  'connection',
109
113
  'collectionName',
110
114
  'info',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/domain/content-type/index.ts"],"sourcesContent":["import { cloneDeep } from 'lodash/fp';\nimport _ from 'lodash';\nimport { yup, contentTypes as contentTypesUtils } from '@strapi/utils';\nimport type { Schema } from '@strapi/types';\nimport { validateContentTypeDefinition } from './validator';\n\nexport type ContentTypeDefinition = {\n schema: Schema.ContentType;\n actions: Record<string, unknown>;\n lifecycles: Record<string, unknown>;\n};\n\nconst {\n CREATED_AT_ATTRIBUTE,\n UPDATED_AT_ATTRIBUTE,\n PUBLISHED_AT_ATTRIBUTE,\n FIRST_PUBLISHED_AT_ATTRIBUTE,\n CREATED_BY_ATTRIBUTE,\n UPDATED_BY_ATTRIBUTE,\n} = contentTypesUtils.constants;\n\nconst createContentType = (uid: string, definition: ContentTypeDefinition) => {\n try {\n validateContentTypeDefinition(definition);\n } catch (e) {\n if (e instanceof yup.ValidationError) {\n throw new Error(`Content Type Definition is invalid for ${uid}'.\\n${e.errors}`);\n }\n\n throw e;\n }\n\n const { schema, actions, lifecycles } = cloneDeep(definition);\n\n // general info\n Object.assign(schema, {\n uid,\n modelType: 'contentType',\n kind: schema.kind || 'collectionType',\n __schema__: pickSchema(definition.schema),\n modelName: definition.schema.info.singularName,\n actions,\n lifecycles,\n });\n\n addTimestamps(schema);\n\n // Published at is added regardless of draft and publish being enabled\n // In case it is not enabled, value will be always published, and it will not contain a draft\n addDraftAndPublish(schema);\n\n addCreatorFields(schema);\n\n addFirstPublishedAt(schema);\n\n return schema;\n};\n\nconst addTimestamps = (schema: Schema.ContentType) => {\n // attributes\n Object.assign(schema.attributes, {\n [CREATED_AT_ATTRIBUTE]: {\n type: 'datetime',\n },\n // TODO: handle on edit set to new date\n [UPDATED_AT_ATTRIBUTE]: {\n type: 'datetime',\n },\n });\n};\n\nconst addDraftAndPublish = (schema: Schema.ContentType) => {\n if (!_.has(schema, 'options.draftAndPublish')) {\n _.set(schema, 'options.draftAndPublish', false); // Disabled by default\n }\n\n schema.attributes[PUBLISHED_AT_ATTRIBUTE] = {\n type: 'datetime',\n configurable: false,\n writable: true,\n visible: true,\n default() {\n return new Date();\n },\n };\n};\n\nconst addFirstPublishedAt = (schema: Schema.ContentType) => {\n const isEnabled = contentTypesUtils.hasFirstPublishedAtField(schema);\n\n // Note: As an expertimental feature, we are okay if this data is deleted if this feature is\n // switched off. Once \"preserve_attributes\" come into play, this will be updated.\n if (isEnabled) {\n strapi.log.warn(`Experimental feature enabled: firstPublishedAt on ${schema.collectionName}`);\n schema.attributes[FIRST_PUBLISHED_AT_ATTRIBUTE] = {\n type: 'datetime',\n configurable: false,\n writable: true,\n visible: false,\n private: !isEnabled,\n };\n }\n};\n\nconst addCreatorFields = (schema: Schema.ContentType) => {\n const isPrivate = !_.get(schema, 'options.populateCreatorFields', false);\n\n schema.attributes[CREATED_BY_ATTRIBUTE] = {\n type: 'relation',\n relation: 'oneToOne',\n target: 'admin::user',\n configurable: false,\n writable: false,\n visible: false,\n useJoinTable: false,\n private: isPrivate,\n };\n\n schema.attributes[UPDATED_BY_ATTRIBUTE] = {\n type: 'relation',\n relation: 'oneToOne',\n target: 'admin::user',\n configurable: false,\n writable: false,\n visible: false,\n useJoinTable: false,\n private: isPrivate,\n };\n};\n\nconst getGlobalId = (schema: Schema.ContentType, prefix?: string) => {\n const modelName = schema.info.singularName;\n const globalId = prefix ? `${prefix}-${modelName}` : modelName;\n\n return schema.globalId || _.upperFirst(_.camelCase(globalId));\n};\n\nconst pickSchema = (model: Schema.ContentType) => {\n const schema = _.cloneDeep(\n _.pick(model, [\n 'connection',\n 'collectionName',\n 'info',\n 'options',\n 'pluginOptions',\n 'attributes',\n 'kind',\n ])\n );\n\n schema.kind = model.kind || 'collectionType';\n return schema;\n};\n\nexport { createContentType, getGlobalId };\n"],"names":["CREATED_AT_ATTRIBUTE","UPDATED_AT_ATTRIBUTE","PUBLISHED_AT_ATTRIBUTE","FIRST_PUBLISHED_AT_ATTRIBUTE","CREATED_BY_ATTRIBUTE","UPDATED_BY_ATTRIBUTE","contentTypesUtils","constants","createContentType","uid","definition","validateContentTypeDefinition","e","yup","ValidationError","Error","errors","schema","actions","lifecycles","cloneDeep","Object","assign","modelType","kind","__schema__","pickSchema","modelName","info","singularName","addTimestamps","addDraftAndPublish","addCreatorFields","addFirstPublishedAt","attributes","type","_","has","set","configurable","writable","visible","default","Date","isEnabled","hasFirstPublishedAtField","strapi","log","warn","collectionName","private","isPrivate","get","relation","target","useJoinTable","getGlobalId","prefix","globalId","upperFirst","camelCase","model","pick"],"mappings":";;;;;;;AAYA,MAAM,EACJA,oBAAoB,EACpBC,oBAAoB,EACpBC,sBAAsB,EACtBC,4BAA4B,EAC5BC,oBAAoB,EACpBC,oBAAoB,EACrB,GAAGC,yBAAkBC,SAAS;AAE/B,MAAMC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ts"],"sourcesContent":["import { cloneDeep } from 'lodash/fp';\nimport _ from 'lodash';\nimport { yup, contentTypes as contentTypesUtils } from '@strapi/utils';\nimport type { Schema } from '@strapi/types';\nimport { validateContentTypeDefinition } from './validator';\n\nexport type ContentTypeDefinition = {\n schema: Schema.ContentType;\n actions: Record<string, unknown>;\n lifecycles: Record<string, unknown>;\n};\n\nconst {\n CREATED_AT_ATTRIBUTE,\n UPDATED_AT_ATTRIBUTE,\n PUBLISHED_AT_ATTRIBUTE,\n FIRST_PUBLISHED_AT_ATTRIBUTE,\n CREATED_BY_ATTRIBUTE,\n UPDATED_BY_ATTRIBUTE,\n} = contentTypesUtils.constants;\n\nconst createContentType = (uid: string, definition: ContentTypeDefinition) => {\n try {\n validateContentTypeDefinition(definition);\n } catch (e) {\n if (e instanceof yup.ValidationError) {\n throw new Error(`Content Type Definition is invalid for ${uid}'.\\n${e.errors}`);\n }\n\n throw e;\n }\n\n const { schema, actions, lifecycles } = cloneDeep(definition);\n\n // general info\n Object.assign(schema, {\n uid,\n modelType: 'contentType',\n kind: schema.kind || 'collectionType',\n __schema__: pickSchema(definition.schema),\n modelName: definition.schema.info.singularName,\n actions,\n lifecycles,\n });\n\n addTimestamps(schema);\n\n // Published at is added regardless of draft and publish being enabled\n // In case it is not enabled, value will be always published, and it will not contain a draft\n addDraftAndPublish(schema);\n\n addCreatorFields(schema);\n\n addFirstPublishedAt(schema);\n\n return schema;\n};\n\nconst addTimestamps = (schema: Schema.ContentType) => {\n // attributes\n Object.assign(schema.attributes, {\n [CREATED_AT_ATTRIBUTE]: {\n type: 'datetime',\n },\n // TODO: handle on edit set to new date\n [UPDATED_AT_ATTRIBUTE]: {\n type: 'datetime',\n },\n });\n};\n\nconst addDraftAndPublish = (schema: Schema.ContentType) => {\n if (!_.has(schema, 'options.draftAndPublish')) {\n _.set(schema, 'options.draftAndPublish', false); // Disabled by default\n }\n\n schema.attributes[PUBLISHED_AT_ATTRIBUTE] = {\n type: 'datetime',\n configurable: false,\n writable: true,\n visible: true,\n default() {\n return new Date();\n },\n };\n};\n\nconst addFirstPublishedAt = (schema: Schema.ContentType) => {\n const isEnabled = contentTypesUtils.hasFirstPublishedAtField(schema);\n\n // Note: As an expertimental feature, we are okay if this data is deleted if this feature is\n // switched off. Once \"preserve_attributes\" come into play, this will be updated.\n if (isEnabled) {\n strapi.log.warn(`Experimental feature enabled: firstPublishedAt on ${schema.collectionName}`);\n schema.attributes[FIRST_PUBLISHED_AT_ATTRIBUTE] = {\n type: 'datetime',\n configurable: false,\n writable: true,\n visible: false,\n private: !isEnabled,\n };\n }\n};\n\nconst addCreatorFields = (schema: Schema.ContentType) => {\n const isPrivate = !_.get(schema, 'options.populateCreatorFields', false);\n\n schema.attributes[CREATED_BY_ATTRIBUTE] = {\n type: 'relation',\n relation: 'oneToOne',\n target: 'admin::user',\n configurable: false,\n writable: false,\n visible: false,\n useJoinTable: false,\n private: isPrivate,\n };\n\n schema.attributes[UPDATED_BY_ATTRIBUTE] = {\n type: 'relation',\n relation: 'oneToOne',\n target: 'admin::user',\n configurable: false,\n writable: false,\n visible: false,\n useJoinTable: false,\n private: isPrivate,\n };\n};\n\nconst getGlobalId = (schema: Schema.ContentType, prefix?: string) => {\n const modelName = schema.info.singularName;\n const globalId = prefix ? `${prefix}-${modelName}` : modelName;\n\n return schema.globalId || _.upperFirst(_.camelCase(globalId));\n};\n\nconst pickSchema = (model: Schema.ContentType) => {\n const schema = _.cloneDeep(\n _.pick(model, [\n 'connection',\n 'collectionName',\n 'info',\n 'options',\n 'pluginOptions',\n 'attributes',\n 'kind',\n ])\n );\n\n schema.kind = model.kind || 'collectionType';\n return schema;\n};\n\nexport { createContentType, getGlobalId };\n"],"names":["CREATED_AT_ATTRIBUTE","UPDATED_AT_ATTRIBUTE","PUBLISHED_AT_ATTRIBUTE","FIRST_PUBLISHED_AT_ATTRIBUTE","CREATED_BY_ATTRIBUTE","UPDATED_BY_ATTRIBUTE","contentTypesUtils","constants","createContentType","uid","definition","validateContentTypeDefinition","e","yup","ValidationError","Error","errors","schema","actions","lifecycles","cloneDeep","Object","assign","modelType","kind","__schema__","pickSchema","modelName","info","singularName","addTimestamps","addDraftAndPublish","addCreatorFields","addFirstPublishedAt","attributes","type","_","has","set","configurable","writable","visible","default","Date","isEnabled","hasFirstPublishedAtField","strapi","log","warn","collectionName","private","isPrivate","get","relation","target","useJoinTable","getGlobalId","prefix","globalId","upperFirst","camelCase","model","pick"],"mappings":";;;;;;;;;;;AAYA,MAAM,EACJA,oBAAoB,EACpBC,oBAAoB,EACpBC,sBAAsB,EACtBC,4BAA4B,EAC5BC,oBAAoB,EACpBC,oBAAoB,EACrB,GAAGC,yBAAkBC,SAAS;AAE/B,MAAMC,iBAAAA,GAAoB,CAACC,GAAAA,EAAaC,UAAAA,GAAAA;IACtC,IAAI;QACFC,uCAAAA,CAA8BD,UAAAA,CAAAA;AAChC,IAAA,CAAA,CAAE,OAAOE,CAAAA,EAAG;QACV,IAAIA,CAAAA,YAAaC,eAAAA,CAAIC,eAAe,EAAE;YACpC,MAAM,IAAIC,KAAAA,CAAM,CAAC,uCAAuC,EAAEN,IAAI,IAAI,EAAEG,CAAAA,CAAEI,MAAM,CAAA,CAAE,CAAA;AAChF,QAAA;QAEA,MAAMJ,CAAAA;AACR,IAAA;IAEA,MAAM,EAAEK,MAAM,EAAEC,OAAO,EAAEC,UAAU,EAAE,GAAGC,YAAAA,CAAUV,UAAAA,CAAAA;;IAGlDW,MAAAA,CAAOC,MAAM,CAACL,MAAAA,EAAQ;AACpBR,QAAAA,GAAAA;QACAc,SAAAA,EAAW,aAAA;QACXC,IAAAA,EAAMP,MAAAA,CAAOO,IAAI,IAAI,gBAAA;QACrBC,UAAAA,EAAYC,UAAAA,CAAWhB,WAAWO,MAAM,CAAA;AACxCU,QAAAA,SAAAA,EAAWjB,UAAAA,CAAWO,MAAM,CAACW,IAAI,CAACC,YAAY;AAC9CX,QAAAA,OAAAA;AACAC,QAAAA;AACF,KAAA,CAAA;IAE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A;AACrD;AAEA,MAAMhC,aAAa,CAACmC,KAAAA,GAAAA;AAClB,IAAA,MAAM5C,SAASmB,kBAAAA,CAAEhB,SAAS,CACxBgB,kBAAAA,CAAE0B,IAAI,CAACD,KAAAA,EAAO;AACZ,QAAA,YAAA;AACA,QAAA,gBAAA;AACA,QAAA,MAAA;AACA,QAAA,SAAA;AACA,QAAA,eAAA;AACA,QAAA,YAAA;AACA,QAAA;AACD,KAAA,CAAA,CAAA;AAGH5C,IAAAA,MAAAA,CAAOO,IAAI,GAAGqC,KAAAA,CAAMrC,IAAI,IAAI,gBAAA;IAC5B,OAAOP,MAAAA;AACT,CAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/domain/content-type/validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAW,MAAM,eAAe,CAAC;AAkG7C,QAAA,MAAM,6BAA6B,SAAU,OAAO;;;;;;;;;;;;;;;;;;;GAEnD,CAAC;AAEF,OAAO,EAAE,6BAA6B,EAAE,CAAC"}
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/domain/content-type/validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAW,MAAM,eAAe,CAAC;AAkG7C,QAAA,MAAM,6BAA6B,GAAI,MAAM,OAAO;;;;;;;;;;;;;;;;;;;GAEnD,CAAC;AAEF,OAAO,EAAE,6BAA6B,EAAE,CAAC"}
@@ -3,6 +3,10 @@
3
3
  var _ = require('lodash');
4
4
  var strapiUtils = require('@strapi/utils');
5
5
 
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var ___default = /*#__PURE__*/_interopDefault(_);
9
+
6
10
  const LIFECYCLES = [
7
11
  'beforeCreate',
8
12
  'afterCreate',
@@ -35,7 +39,7 @@ const LIFECYCLES = [
35
39
  * TODO V5: check if we can avoid this coupling by moving this logic
36
40
  * into the GraphQL plugin.
37
41
  */ const GRAPHQL_ENUM_REGEX = /^[_A-Za-z][_0-9A-Za-z]*$/;
38
- const lifecyclesShape = _.mapValues(_.keyBy(LIFECYCLES), ()=>strapiUtils.yup.mixed().nullable().isFunction());
42
+ const lifecyclesShape = ___default.default.mapValues(___default.default.keyBy(LIFECYCLES), ()=>strapiUtils.yup.mixed().nullable().isFunction());
39
43
  const contentTypeSchemaValidator = strapiUtils.yup.object().shape({
40
44
  schema: strapiUtils.yup.object().shape({
41
45
  info: strapiUtils.yup.object().shape({
@@ -65,7 +69,7 @@ const contentTypeSchemaValidator = strapiUtils.yup.object().shape({
65
69
  });
66
70
  }
67
71
  // should not collide
68
- const duplicates = _.uniq(regressedValues.filter((value, index, values)=>values.indexOf(value) !== index));
72
+ const duplicates = ___default.default.uniq(regressedValues.filter((value, index, values)=>values.indexOf(value) !== index));
69
73
  if (duplicates.length) {
70
74
  const message = `Some enumeration values of the field '${attrName}' collide when normalized: ${duplicates.join(', ')}. Please modify your enumeration.`;
71
75
  return this.createError({
@@ -1 +1 @@
1
- {"version":3,"file":"validator.js","sources":["../../../src/domain/content-type/validator.ts"],"sourcesContent":["import _ from 'lodash';\nimport { yup, strings } from '@strapi/utils';\nimport type { Schema } from '@strapi/types';\n\nconst LIFECYCLES = [\n 'beforeCreate',\n 'afterCreate',\n 'beforeFindOne',\n 'afterFindOne',\n 'beforeFindMany',\n 'afterFindMany',\n 'beforeCount',\n 'afterCount',\n 'beforeCreateMany',\n 'afterCreateMany',\n 'beforeUpdate',\n 'afterUpdate',\n 'beforeUpdateMany',\n 'afterUpdateMany',\n 'beforeDelete',\n 'afterDelete',\n 'beforeDeleteMany',\n 'afterDeleteMany',\n] as const;\n\n/**\n * For enumerations the least common denomiator is GraphQL, where\n * values needs to match the secure name regex:\n * GraphQL Spec https://spec.graphql.org/June2018/#sec-Names\n *\n * Therefore we need to make sure our users only use values, which\n * can be returned by GraphQL, by checking the regressed values\n * agains the GraphQL regex.\n *\n * TODO V5: check if we can avoid this coupling by moving this logic\n * into the GraphQL plugin.\n */\nconst GRAPHQL_ENUM_REGEX = /^[_A-Za-z][_0-9A-Za-z]*$/;\n\nconst lifecyclesShape = _.mapValues(_.keyBy(LIFECYCLES), () => yup.mixed().nullable().isFunction());\n\nconst contentTypeSchemaValidator = yup.object().shape({\n schema: yup.object().shape({\n info: yup\n .object()\n .shape({\n displayName: yup.string().required(),\n singularName: yup.string().isKebabCase().required(),\n pluralName: yup.string().isKebabCase().required(),\n })\n .required(),\n attributes: yup.object().test({\n name: 'valuesCollide',\n message: 'Some values collide when normalized',\n test(attributes: Schema.ContentType['attributes']) {\n for (const attrName of Object.keys(attributes)) {\n const attr = attributes[attrName];\n if (attr.type === 'enumeration') {\n const regressedValues = attr.enum.map(strings.toRegressedEnumValue);\n\n // should match the GraphQL regex\n if (!regressedValues.every((value: string) => GRAPHQL_ENUM_REGEX.test(value))) {\n const message = `Invalid enumeration value. Values should have at least one alphabetical character preceding the first occurence of a number. Update your enumeration '${attrName}'.`;\n\n return this.createError({ message });\n }\n\n // should not contain empty values\n if (regressedValues.some((value: string) => value === '')) {\n return this.createError({\n message: `At least one value of the enumeration '${attrName}' appears to be empty. Only alphanumerical characters are taken into account.`,\n });\n }\n\n // should not collide\n const duplicates = _.uniq(\n regressedValues.filter(\n (value: string, index: number, values: string[]) => values.indexOf(value) !== index\n )\n );\n\n if (duplicates.length) {\n const message = `Some enumeration values of the field '${attrName}' collide when normalized: ${duplicates.join(\n ', '\n )}. Please modify your enumeration.`;\n\n return this.createError({ message });\n }\n }\n }\n\n return true;\n },\n }),\n }),\n actions: yup.object().onlyContainsFunctions(),\n lifecycles: yup.object().shape(lifecyclesShape).noUnknown(),\n});\n\nconst validateContentTypeDefinition = (data: unknown) => {\n return contentTypeSchemaValidator.validateSync(data, { strict: true, abortEarly: false });\n};\n\nexport { validateContentTypeDefinition };\n"],"names":["LIFECYCLES","GRAPHQL_ENUM_REGEX","lifecyclesShape","_","mapValues","keyBy","yup","mixed","nullable","isFunction","contentTypeSchemaValidator","object","shape","schema","info","displayName","string","required","singularName","isKebabCase","pluralName","attributes","test","name","message","attrName","Object","keys","attr","type","regressedValues","enum","map","strings","toRegressedEnumValue","every","value","createError","some","duplicates","uniq","filter","index","values","indexOf","length","join","actions","onlyContainsFunctions","lifecycles","noUnknown","validateContentTypeDefinition","data","validateSync","strict","abortEarly"],"mappings":";;;;;AAIA,MAAMA,UAAAA,GAAa;AACjB,IAAA,cAAA;AACA,IAAA,aAAA;AACA,IAAA,eAAA;AACA,IAAA,cAAA;AACA,IAAA,gBAAA;AACA,IAAA,eAAA;AACA,IAAA,aAAA;AACA,IAAA,YAAA;AACA,IAAA,kBAAA;AACA,IAAA,iBAAA;AACA,IAAA,cAAA;AACA,IAAA,aAAA;AACA,IAAA,kBAAA;AACA,IAAA,iBAAA;AACA,IAAA,cAAA;AACA,IAAA,aAAA;AACA,IAAA,kBAAA;AACA,IAAA;AACD,CAAA;AAED;;;;;;;;;;;AAWC,IACD,MAAMC,kBAAAA,GAAqB,0BAAA;AAE3B,MAAMC,eAAAA,GAAkBC,CAAAA,CAAEC,SAAS,CAACD,EAAEE,KAAK,CAACL,UAAAA,CAAAA,EAAa,IAAMM,eAAAA,CAAIC,KAAK,EAAA,CAAGC,QAAQ,GAAGC,UAAU,EAAA,CAAA;AAEhG,MAAMC,0BAAAA,GAA6BJ,eAAAA,CAAIK,MAAM,EAAA,CAAGC,KAAK,CAAC;AACpDC,IAAAA,MAAAA,EAAQP,eAAAA,CAAIK,MAAM,EAAA,CAAGC,KAAK,CAAC;AACzBE,QAAAA,IAAAA,EAAMR,eAAAA,CACHK,MAAM,EAAA,CACNC,KAAK,CAAC;YACLG,WAAAA,EAAaT,eAAAA,CAAIU,MAAM,EAAA,CAAGC,QAAQ,EAAA;AAClCC,YAAAA,YAAAA,EAAcZ,eAAAA,CAAIU,MAAM,EAAA,CAAGG,WAAW,GAAGF,QAAQ,EAAA;AACjDG,YAAAA,UAAAA,EAAYd,eAAAA,CAAIU,MAAM,E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A,KAAWM,KAAAA,CAAAA,CAAAA;wBAIlF,IAAIH,UAAAA,CAAWM,MAAM,EAAE;AACrB,4BAAA,MAAMrB,OAAAA,GAAU,CAAC,sCAAsC,EAAEC,QAAAA,CAAS,2BAA2B,EAAEc,UAAAA,CAAWO,IAAI,CAC5G,IAAA,CAAA,CACA,iCAAiC,CAAC;4BAEpC,OAAO,IAAI,CAACT,WAAW,CAAC;AAAEb,gCAAAA;AAAQ,6BAAA,CAAA;AACpC,wBAAA;AACF,oBAAA;AACF,gBAAA;gBAEA,OAAO,IAAA;AACT,YAAA;AACF,SAAA;AACF,KAAA,CAAA;IACAuB,OAAAA,EAASzC,eAAAA,CAAIK,MAAM,EAAA,CAAGqC,qBAAqB,EAAA;AAC3CC,IAAAA,UAAAA,EAAY3C,gBAAIK,MAAM,EAAA,CAAGC,KAAK,CAACV,iBAAiBgD,SAAS;AAC3D,CAAA,CAAA;AAEA,MAAMC,gCAAgC,CAACC,IAAAA,GAAAA;IACrC,OAAO1C,0BAAAA,CAA2B2C,YAAY,CAACD,IAAAA,EAAM;QAAEE,MAAAA,EAAQ,IAAA;QAAMC,UAAAA,EAAY;AAAM,KAAA,CAAA;AACzF;;;;"}
1
+ {"version":3,"file":"validator.js","sources":["../../../src/domain/content-type/validator.ts"],"sourcesContent":["import _ from 'lodash';\nimport { yup, strings } from '@strapi/utils';\nimport type { Schema } from '@strapi/types';\n\nconst LIFECYCLES = [\n 'beforeCreate',\n 'afterCreate',\n 'beforeFindOne',\n 'afterFindOne',\n 'beforeFindMany',\n 'afterFindMany',\n 'beforeCount',\n 'afterCount',\n 'beforeCreateMany',\n 'afterCreateMany',\n 'beforeUpdate',\n 'afterUpdate',\n 'beforeUpdateMany',\n 'afterUpdateMany',\n 'beforeDelete',\n 'afterDelete',\n 'beforeDeleteMany',\n 'afterDeleteMany',\n] as const;\n\n/**\n * For enumerations the least common denomiator is GraphQL, where\n * values needs to match the secure name regex:\n * GraphQL Spec https://spec.graphql.org/June2018/#sec-Names\n *\n * Therefore we need to make sure our users only use values, which\n * can be returned by GraphQL, by checking the regressed values\n * agains the GraphQL regex.\n *\n * TODO V5: check if we can avoid this coupling by moving this logic\n * into the GraphQL plugin.\n */\nconst GRAPHQL_ENUM_REGEX = /^[_A-Za-z][_0-9A-Za-z]*$/;\n\nconst lifecyclesShape = _.mapValues(_.keyBy(LIFECYCLES), () => yup.mixed().nullable().isFunction());\n\nconst contentTypeSchemaValidator = yup.object().shape({\n schema: yup.object().shape({\n info: yup\n .object()\n .shape({\n displayName: yup.string().required(),\n singularName: yup.string().isKebabCase().required(),\n pluralName: yup.string().isKebabCase().required(),\n })\n .required(),\n attributes: yup.object().test({\n name: 'valuesCollide',\n message: 'Some values collide when normalized',\n test(attributes: Schema.ContentType['attributes']) {\n for (const attrName of Object.keys(attributes)) {\n const attr = attributes[attrName];\n if (attr.type === 'enumeration') {\n const regressedValues = attr.enum.map(strings.toRegressedEnumValue);\n\n // should match the GraphQL regex\n if (!regressedValues.every((value: string) => GRAPHQL_ENUM_REGEX.test(value))) {\n const message = `Invalid enumeration value. Values should have at least one alphabetical character preceding the first occurence of a number. Update your enumeration '${attrName}'.`;\n\n return this.createError({ message });\n }\n\n // should not contain empty values\n if (regressedValues.some((value: string) => value === '')) {\n return this.createError({\n message: `At least one value of the enumeration '${attrName}' appears to be empty. Only alphanumerical characters are taken into account.`,\n });\n }\n\n // should not collide\n const duplicates = _.uniq(\n regressedValues.filter(\n (value: string, index: number, values: string[]) => values.indexOf(value) !== index\n )\n );\n\n if (duplicates.length) {\n const message = `Some enumeration values of the field '${attrName}' collide when normalized: ${duplicates.join(\n ', '\n )}. Please modify your enumeration.`;\n\n return this.createError({ message });\n }\n }\n }\n\n return true;\n },\n }),\n }),\n actions: yup.object().onlyContainsFunctions(),\n lifecycles: yup.object().shape(lifecyclesShape).noUnknown(),\n});\n\nconst validateContentTypeDefinition = (data: unknown) => {\n return contentTypeSchemaValidator.validateSync(data, { strict: true, abortEarly: false });\n};\n\nexport { validateContentTypeDefinition };\n"],"names":["LIFECYCLES","GRAPHQL_ENUM_REGEX","lifecyclesShape","_","mapValues","keyBy","yup","mixed","nullable","isFunction","contentTypeSchemaValidator","object","shape","schema","info","displayName","string","required","singularName","isKebabCase","pluralName","attributes","test","name","message","attrName","Object","keys","attr","type","regressedValues","enum","map","strings","toRegressedEnumValue","every","value","createError","some","duplicates","uniq","filter","index","values","indexOf","length","join","actions","onlyContainsFunctions","lifecycles","noUnknown","validateContentTypeDefinition","data","validateSync","strict","abortEarly"],"mappings":";;;;;;;;;AAIA,MAAMA,UAAAA,GAAa;AACjB,IAAA,cAAA;AACA,IAAA,aAAA;AACA,IAAA,eAAA;AACA,IAAA,cAAA;AACA,IAAA,gBAAA;AACA,IAAA,eAAA;AACA,IAAA,aAAA;AACA,IAAA,YAAA;AACA,IAAA,kBAAA;AACA,IAAA,iBAAA;AACA,IAAA,cAAA;AACA,IAAA,aAAA;AACA,IAAA,kBAAA;AACA,IAAA,iBAAA;AACA,IAAA,cAAA;AACA,IAAA,aAAA;AACA,IAAA,kBAAA;AACA,IAAA;AACD,CAAA;AAED;;;;;;;;;;;AAWC,IACD,MAAMC,kBAAAA,GAAqB,0BAAA;AAE3B,MAAMC,eAAAA,GAAkBC,kBAAAA,CAAEC,SAAS,CAACD,mBAAEE,KAAK,CAACL,UAAAA,CAAAA,EAAa,IAAMM,eAAAA,CAAIC,KAAK,EAAA,CAAGC,QAAQ,GAAGC,UAAU,EAAA,CAAA;AAEhG,MAAMC,0BAAAA,GAA6BJ,eAAAA,CAAIK,MAAM,EAAA,CAAGC,KAAK,CAAC;AACpDC,IAAAA,MAAAA,EAAQP,eAAAA,CAAIK,MAAM,EAAA,CAAGC,KAAK,CAAC;AACzBE,QAAAA,IAAAA,EAAMR,eAAAA,CACHK,MAAM,EAAA,CACNC,KAAK,CAAC;YACLG,WAAAA,EAAaT,eAAAA,CAAIU,MAAM,EAAA,CAAGC,QAAQ,EAAA;AAClCC,YAAAA,YAAAA,E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,WAAW,EAAE,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC;IACpD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC;IAChD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,CAAC,cAAc,EAAE,GAAG,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7C,UAAU,EAAE,CAAC,cAAc,EAAE,GAAG,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;CAC9C;AAiBD,eAAO,MAAM,YAAY,GACvB,WAAW,MAAM,EACjB,WAAW,SAAS,EACpB,QAAQ,IAAI,CAAC,MAAM,KAClB,MAwFF,CAAC"}
@@ -5,9 +5,13 @@ var strapiUtils = require('@strapi/utils');
5
5
  var namespace = require('../../registries/namespace.js');
6
6
  var validation = require('./validation.js');
7
7
 
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var ___default = /*#__PURE__*/_interopDefault(_);
11
+
8
12
  // Removes the namespace from a map with keys prefixed with a namespace
9
13
  const removeNamespacedKeys = (map, namespace$1)=>{
10
- return _.mapKeys(map, (value, key)=>namespace.removeNamespace(key, namespace$1));
14
+ return ___default.default.mapKeys(map, (value, key)=>namespace.removeNamespace(key, namespace$1));
11
15
  };
12
16
  const defaultModule = {
13
17
  config: {},
@@ -19,7 +23,7 @@ const defaultModule = {
19
23
  middlewares: {}
20
24
  };
21
25
  const createModule = (namespace, rawModule, strapi)=>{
22
- _.defaults(rawModule, defaultModule);
26
+ ___default.default.defaults(rawModule, defaultModule);
23
27
  try {
24
28
  validation.validateModule(rawModule);
25
29
  } catch (e) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/domain/module/index.ts"],"sourcesContent":["import _, { type PropertyPath, flatten } from 'lodash';\nimport { yup } from '@strapi/utils';\nimport type { Core, UID, Struct } from '@strapi/types';\n\nimport { removeNamespace } from '../../registries/namespace';\nimport { validateModule } from './validation';\n\ninterface LifecyclesState {\n bootstrap?: boolean;\n register?: boolean;\n destroy?: boolean;\n}\n\nexport interface RawModule {\n config?: Record<string, unknown>;\n routes?: Core.Module['routes'];\n controllers?: Core.Module['controllers'];\n services?: Core.Module['services'];\n contentTypes?: Core.Module['contentTypes'];\n policies?: Core.Module['policies'];\n middlewares?: Core.Module['middlewares'];\n bootstrap?: (params: { strapi: Core.Strapi }) => Promise<void>;\n register?: (params: { strapi: Core.Strapi }) => Promise<void>;\n destroy?: (params: { strapi: Core.Strapi }) => Promise<void>;\n}\n\nexport interface Module {\n bootstrap: () => Promise<void>;\n register: () => Promise<void>;\n destroy: () => Promise<void>;\n load: () => void;\n routes: Core.Module['routes'];\n config<T = unknown>(key: PropertyPath, defaultVal?: T): T; // TODO: this mirrors ConfigProvider.get, we should use it directly\n contentType: (ctName: UID.ContentType) => Struct.ContentTypeSchema;\n contentTypes: Record<string, Struct.ContentTypeSchema>;\n service: (serviceName: UID.Service) => Core.Service;\n services: Record<string, Core.Service>;\n policy: (policyName: UID.Policy) => Core.Policy;\n policies: Record<string, Core.Policy>;\n middleware: (middlewareName: UID.Middleware) => Core.Middleware;\n middlewares: Record<string, Core.Middleware>;\n controller: (controllerName: UID.Controller) => Core.Controller;\n controllers: Record<string, Core.Controller>;\n}\n\n// Removes the namespace from a map with keys prefixed with a namespace\nconst removeNamespacedKeys = <T extends Record<string, unknown>>(map: T, namespace: string) => {\n return _.mapKeys(map, (value, key) => removeNamespace(key, namespace));\n};\n\nconst defaultModule = {\n config: {},\n routes: [],\n controllers: {},\n services: {},\n contentTypes: {},\n policies: {},\n middlewares: {},\n};\n\nexport const createModule = (\n namespace: string,\n rawModule: RawModule,\n strapi: Core.Strapi\n): Module => {\n _.defaults(rawModule, defaultModule);\n\n try {\n validateModule(rawModule);\n } catch (e) {\n if (e instanceof yup.ValidationError) {\n throw new Error(`strapi-server.js is invalid for '${namespace}'.\\n${e.errors.join('\\n')}`);\n }\n }\n\n const called: LifecyclesState = {};\n return {\n async bootstrap() {\n if (called.bootstrap) {\n throw new Error(`Bootstrap for ${namespace} has already been called`);\n }\n called.bootstrap = true;\n await (rawModule.bootstrap && rawModule.bootstrap({ strapi }));\n },\n async register() {\n if (called.register) {\n throw new Error(`Register for ${namespace} has already been called`);\n }\n called.register = true;\n await (rawModule.register && rawModule.register({ strapi }));\n },\n async destroy() {\n if (called.destroy) {\n throw new Error(`Destroy for ${namespace} has already been called`);\n }\n called.destroy = true;\n await (rawModule.destroy && rawModule.destroy({ strapi }));\n },\n load() {\n strapi.get('content-types').add(namespace, rawModule.contentTypes);\n strapi.get('services').add(namespace, rawModule.services);\n strapi.get('policies').add(namespace, rawModule.policies);\n strapi.get('middlewares').add(namespace, rawModule.middlewares);\n strapi.get('controllers').add(namespace, rawModule.controllers);\n strapi.get('config').set(namespace, rawModule.config);\n },\n get routes() {\n return rawModule.routes ?? {};\n },\n set routes(routes: Record<string, Core.Router>) {\n rawModule.routes = routes;\n },\n config(path: PropertyPath, defaultValue: unknown) {\n const pathArray = flatten([namespace, path]);\n return strapi.get('config').get(pathArray, defaultValue);\n },\n contentType(ctName: UID.ContentType) {\n return strapi.get('content-types').get(`${namespace}.${ctName}`);\n },\n get contentTypes() {\n const contentTypes = strapi.get('content-types').getAll(namespace);\n return removeNamespacedKeys(contentTypes, namespace);\n },\n service(serviceName: UID.Service) {\n return strapi.get('services').get(`${namespace}.${serviceName}`);\n },\n get services() {\n const services = strapi.get('services').getAll(namespace);\n return removeNamespacedKeys(services, namespace);\n },\n policy(policyName: UID.Policy) {\n return strapi.get('policies').get(`${namespace}.${policyName}`);\n },\n get policies() {\n const policies = strapi.get('policies').getAll(namespace);\n return removeNamespacedKeys(policies, namespace);\n },\n middleware(middlewareName: UID.Middleware) {\n return strapi.get('middlewares').get(`${namespace}.${middlewareName}`);\n },\n get middlewares() {\n const middlewares = strapi.get('middlewares').getAll(namespace);\n return removeNamespacedKeys(middlewares, namespace);\n },\n controller(controllerName: UID.Controller) {\n return strapi.get('controllers').get(`${namespace}.${controllerName}`);\n },\n get controllers() {\n const controllers = strapi.get('controllers').getAll(namespace);\n return removeNamespacedKeys(controllers, namespace);\n },\n };\n};\n"],"names":["removeNamespacedKeys","map","namespace","_","mapKeys","value","key","removeNamespace","defaultModule","config","routes","controllers","services","contentTypes","policies","middlewares","createModule","rawModule","strapi","defaults","validateModule","e","yup","ValidationError","Error","errors","join","called","bootstrap","register","destroy","load","get","add","set","path","defaultValue","pathArray","flatten","contentType","ctName","getAll","service","serviceName","policy","policyName","middleware","middlewareName","controller","controllerName"],"mappings":";;;;;;;AA6CA;AACA,MAAMA,oBAAAA,GAAuB,CAAoCC,GAAAA,EAAQC,WAAAA,GAAAA;IACvE,OAAOC,CAAAA,CAAEC,OAAO,CAACH,GAAAA,EAAK,CAACI,KAAAA,EAAOC,GAAAA,GAAQC,0BAAgBD,GAAAA,EAAKJ,WAAAA,CAAAA,CAAAA;AAC7D,CAAA;AAEA,MAAMM,aAAAA,GAAgB;AACpBC,IAAAA,MAAAA,EAAQ,EAAC;AACTC,IAAAA,MAAAA,EAAQ,EAAE;AACVC,IAAAA,WAAAA,EAAa,EAAC;AACdC,IAAAA,QAAAA,EAAU,EAAC;AACXC,IAAAA,YAAAA,EAAc,EAAC;AACfC,IAAAA,QAAAA,EAAU,EAAC;AACXC,IAAAA,WAAAA,EAAa;AACf,CAAA;AAEO,MAAMC,YAAAA,GAAe,CAC1Bd,SAAAA,EACAe,SAAAA,EACAC,MAAAA,GAAAA;IAEAf,CAAAA,CAAEgB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AAA,CAAAA,CAAY,CAAA;AAChE,QAAA,CAAA;AACA,QAAA,IAAI/B,QAAAA,CAAAA,GAAW;AACb,YAAA,MAAMA,WAAWI,MAAAA,CAAOc,GAAG,CAAC,UAAA,CAAA,CAAYS,MAAM,CAACvC,SAAAA,CAAAA;AAC/C,YAAA,OAAOF,qBAAqBc,QAAAA,EAAUZ,SAAAA,CAAAA;AACxC,QAAA,CAAA;AACA4C,QAAAA,UAAAA,CAAAA,CAAWC,cAA8B,EAAA;YACvC,OAAO7B,MAAAA,CAAOc,GAAG,CAAC,aAAA,CAAA,CAAeA,GAAG,CAAC,CAAA,EAAG9B,SAAAA,CAAU,CAAC,EAAE6C,cAAAA,CAAAA,CAAgB,CAAA;AACvE,QAAA,CAAA;AACA,QAAA,IAAIhC,WAAAA,CAAAA,GAAc;AAChB,YAAA,MAAMA,cAAcG,MAAAA,CAAOc,GAAG,CAAC,aAAA,CAAA,CAAeS,MAAM,CAACvC,SAAAA,CAAAA;AACrD,YAAA,OAAOF,qBAAqBe,WAAAA,EAAab,SAAAA,CAAAA;AAC3C,QAAA,CAAA;AACA8C,QAAAA,UAAAA,CAAAA,CAAWC,cAA8B,EAAA;YACvC,OAAO/B,MAAAA,CAAOc,GAAG,CAAC,aAAA,CAAA,CAAeA,GAAG,CAAC,CAAA,EAAG9B,SAAAA,CAAU,CAAC,EAAE+C,cAAAA,CAAAA,CAAgB,CAAA;AACvE,QAAA,CAAA;AACA,QAAA,IAAItC,WAAAA,CAAAA,GAAc;AAChB,YAAA,MAAMA,cAAcO,MAAAA,CAAOc,GAAG,CAAC,aAAA,CAAA,CAAeS,MAAM,CAACvC,SAAAA,CAAAA;AACrD,YAAA,OAAOF,qBAAqBW,WAAAA,EAAaT,SAAAA,CAAAA;AAC3C,QAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/domain/module/index.ts"],"sourcesContent":["import _, { type PropertyPath, flatten } from 'lodash';\nimport { yup } from '@strapi/utils';\nimport type { Core, UID, Struct } from '@strapi/types';\n\nimport { removeNamespace } from '../../registries/namespace';\nimport { validateModule } from './validation';\n\ninterface LifecyclesState {\n bootstrap?: boolean;\n register?: boolean;\n destroy?: boolean;\n}\n\nexport interface RawModule {\n config?: Record<string, unknown>;\n routes?: Core.Module['routes'];\n controllers?: Core.Module['controllers'];\n services?: Core.Module['services'];\n contentTypes?: Core.Module['contentTypes'];\n policies?: Core.Module['policies'];\n middlewares?: Core.Module['middlewares'];\n bootstrap?: (params: { strapi: Core.Strapi }) => Promise<void>;\n register?: (params: { strapi: Core.Strapi }) => Promise<void>;\n destroy?: (params: { strapi: Core.Strapi }) => Promise<void>;\n}\n\nexport interface Module {\n bootstrap: () => Promise<void>;\n register: () => Promise<void>;\n destroy: () => Promise<void>;\n load: () => void;\n routes: Core.Module['routes'];\n config<T = unknown>(key: PropertyPath, defaultVal?: T): T; // TODO: this mirrors ConfigProvider.get, we should use it directly\n contentType: (ctName: UID.ContentType) => Struct.ContentTypeSchema;\n contentTypes: Record<string, Struct.ContentTypeSchema>;\n service: (serviceName: UID.Service) => Core.Service;\n services: Record<string, Core.Service>;\n policy: (policyName: UID.Policy) => Core.Policy;\n policies: Record<string, Core.Policy>;\n middleware: (middlewareName: UID.Middleware) => Core.Middleware;\n middlewares: Record<string, Core.Middleware>;\n controller: (controllerName: UID.Controller) => Core.Controller;\n controllers: Record<string, Core.Controller>;\n}\n\n// Removes the namespace from a map with keys prefixed with a namespace\nconst removeNamespacedKeys = <T extends Record<string, unknown>>(map: T, namespace: string) => {\n return _.mapKeys(map, (value, key) => removeNamespace(key, namespace));\n};\n\nconst defaultModule = {\n config: {},\n routes: [],\n controllers: {},\n services: {},\n contentTypes: {},\n policies: {},\n middlewares: {},\n};\n\nexport const createModule = (\n namespace: string,\n rawModule: RawModule,\n strapi: Core.Strapi\n): Module => {\n _.defaults(rawModule, defaultModule);\n\n try {\n validateModule(rawModule);\n } catch (e) {\n if (e instanceof yup.ValidationError) {\n throw new Error(`strapi-server.js is invalid for '${namespace}'.\\n${e.errors.join('\\n')}`);\n }\n }\n\n const called: LifecyclesState = {};\n return {\n async bootstrap() {\n if (called.bootstrap) {\n throw new Error(`Bootstrap for ${namespace} has already been called`);\n }\n called.bootstrap = true;\n await (rawModule.bootstrap && rawModule.bootstrap({ strapi }));\n },\n async register() {\n if (called.register) {\n throw new Error(`Register for ${namespace} has already been called`);\n }\n called.register = true;\n await (rawModule.register && rawModule.register({ strapi }));\n },\n async destroy() {\n if (called.destroy) {\n throw new Error(`Destroy for ${namespace} has already been called`);\n }\n called.destroy = true;\n await (rawModule.destroy && rawModule.destroy({ strapi }));\n },\n load() {\n strapi.get('content-types').add(namespace, rawModule.contentTypes);\n strapi.get('services').add(namespace, rawModule.services);\n strapi.get('policies').add(namespace, rawModule.policies);\n strapi.get('middlewares').add(namespace, rawModule.middlewares);\n strapi.get('controllers').add(namespace, rawModule.controllers);\n strapi.get('config').set(namespace, rawModule.config);\n },\n get routes() {\n return rawModule.routes ?? {};\n },\n set routes(routes: Record<string, Core.Router>) {\n rawModule.routes = routes;\n },\n config(path: PropertyPath, defaultValue: unknown) {\n const pathArray = flatten([namespace, path]);\n return strapi.get('config').get(pathArray, defaultValue);\n },\n contentType(ctName: UID.ContentType) {\n return strapi.get('content-types').get(`${namespace}.${ctName}`);\n },\n get contentTypes() {\n const contentTypes = strapi.get('content-types').getAll(namespace);\n return removeNamespacedKeys(contentTypes, namespace);\n },\n service(serviceName: UID.Service) {\n return strapi.get('services').get(`${namespace}.${serviceName}`);\n },\n get services() {\n const services = strapi.get('services').getAll(namespace);\n return removeNamespacedKeys(services, namespace);\n },\n policy(policyName: UID.Policy) {\n return strapi.get('policies').get(`${namespace}.${policyName}`);\n },\n get policies() {\n const policies = strapi.get('policies').getAll(namespace);\n return removeNamespacedKeys(policies, namespace);\n },\n middleware(middlewareName: UID.Middleware) {\n return strapi.get('middlewares').get(`${namespace}.${middlewareName}`);\n },\n get middlewares() {\n const middlewares = strapi.get('middlewares').getAll(namespace);\n return removeNamespacedKeys(middlewares, namespace);\n },\n controller(controllerName: UID.Controller) {\n return strapi.get('controllers').get(`${namespace}.${controllerName}`);\n },\n get controllers() {\n const controllers = strapi.get('controllers').getAll(namespace);\n return removeNamespacedKeys(controllers, namespace);\n },\n };\n};\n"],"names":["removeNamespacedKeys","map","namespace","_","mapKeys","value","key","removeNamespace","defaultModule","config","routes","controllers","services","contentTypes","policies","middlewares","createModule","rawModule","strapi","defaults","validateModule","e","yup","ValidationError","Error","errors","join","called","bootstrap","register","destroy","load","get","add","set","path","defaultValue","pathArray","flatten","contentType","ctName","getAll","service","serviceName","policy","policyName","middleware","middlewareName","controller","controllerName"],"mappings":";;;;;;;;;;;AA6CA;AACA,MAAMA,oBAAAA,GAAuB,CAAoCC,GAAAA,EAAQC,WAAAA,GAAAA;IACvE,OAAOC,kBAAAA,CAAEC,OAAO,CAACH,GAAAA,EAAK,CAACI,KAAAA,EAAOC,GAAAA,GAAQC,0BAAgBD,GAAAA,EAAKJ,WAAAA,CAAAA,CAAAA;AAC7D,CAAA;AAEA,MAAMM,aAAAA,GAAgB;AACpBC,IAAAA,MAAAA,EAAQ,EAAC;AACTC,IAAAA,MAAAA,EAAQ,EAAE;AACVC,IAAAA,WAAAA,EAAa,EAAC;AACdC,IAAAA,QAAAA,EAAU,EAAC;AACXC,IAAAA,YAAAA,EAAc,EAAC;AACfC,IAAAA,QAAAA,EAAU,EAAC;AACXC,IAAAA,WAAAA,EAAa;AACf,CAAA;AAEO,MAAMC,YAAAA,GAAe,CAC1Bd,SAAAA,EACAe,SAAAA,EACAC,MAAAA,GAAAA;IAEAf,kBAAAA,CAAEgB,QAAQ,CAACF,SAAAA,EAAWT,aAAAA,CAAAA;IAEtB,IAAI;QACFY,yBAAAA,CAAeH,SAAAA,CAAAA;AACjB,IAAA,CAAA,CAAE,OAAOI,CAAAA,EAAG;QACV,IAAIA,CAAAA,YAAaC,eAAAA,CAAIC,eAAe,EAAE;AACpC,YAAA,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BAAqBc,QAAAA,EAAUZ,SAAAA,CAAAA;AACxC,QAAA,CAAA;AACA4C,QAAAA,UAAAA,CAAAA,CAAWC,cAA8B,EAAA;YACvC,OAAO7B,MAAAA,CAAOc,GAAG,CAAC,aAAA,CAAA,CAAeA,GAAG,CAAC,CAAA,EAAG9B,SAAAA,CAAU,CAAC,EAAE6C,cAAAA,CAAAA,CAAgB,CAAA;AACvE,QAAA,CAAA;AACA,QAAA,IAAIhC,WAAAA,CAAAA,GAAc;AAChB,YAAA,MAAMA,cAAcG,MAAAA,CAAOc,GAAG,CAAC,aAAA,CAAA,CAAeS,MAAM,CAACvC,SAAAA,CAAAA;AACrD,YAAA,OAAOF,qBAAqBe,WAAAA,EAAab,SAAAA,CAAAA;AAC3C,QAAA,CAAA;AACA8C,QAAAA,UAAAA,CAAAA,CAAWC,cAA8B,EAAA;YACvC,OAAO/B,MAAAA,CAAOc,GAAG,CAAC,aAAA,CAAA,CAAeA,GAAG,CAAC,CAAA,EAAG9B,SAAAA,CAAU,CAAC,EAAE+C,cAAAA,CAAAA,CAAgB,CAAA;AACvE,QAAA,CAAA;AACA,QAAA,IAAItC,WAAAA,CAAAA,GAAc;AAChB,YAAA,MAAMA,cAAcO,MAAAA,CAAOc,GAAG,CAAC,aAAA,CAAA,CAAeS,MAAM,CAACvC,SAAAA,CAAAA;AACrD,YAAA,OAAOF,qBAAqBW,WAAAA,EAAaT,SAAAA,CAAAA;AAC3C,QAAA;AACF,KAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/domain/module/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAuBpC,QAAA,MAAM,cAAc,SAAU,OAAO;;;;;;;;;;;GAEpC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/domain/module/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAuBpC,QAAA,MAAM,cAAc,GAAI,MAAM,OAAO;;;;;;;;;;;GAEpC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,6 +1,7 @@
1
+ import type { Logger } from '@strapi/logger';
1
2
  import type { Core } from '@strapi/types';
2
3
  declare const _default: Readonly<{
3
- init: (licenseDir: string, logger?: import("winston").Logger | undefined) => void;
4
+ init: (licenseDir: string, logger?: Logger) => void;
4
5
  checkLicense: ({ strapi }: {
5
6
  strapi: Core.Strapi;
6
7
  }) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ee/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;iCA+Sb,MAAM;;;AAhCnC,wBAkCG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ee/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;;uBAsEhB,MAAM,WAAW,MAAM;+BA4IT;QAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;KAAE;mCA0B5D;QACD,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;KACrB,KAAG,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;;;;;;;;;;kBA7Nd,MAAM;;2BA4PT,MAAM;;kBA5PH,MAAM;;iCA8RN,MAAM;;;AAhCnC,wBAkCG"}
@@ -1 +1 @@
1
- {"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../src/ee/license.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAI1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