@strapi/core 5.37.1 → 5.38.1

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 (387) hide show
  1. package/dist/Strapi.js.map +1 -1
  2. package/dist/Strapi.mjs.map +1 -1
  3. package/dist/compile.js.map +1 -1
  4. package/dist/compile.mjs.map +1 -1
  5. package/dist/configuration/config-loader.js.map +1 -1
  6. package/dist/configuration/config-loader.mjs.map +1 -1
  7. package/dist/configuration/get-dirs.js.map +1 -1
  8. package/dist/configuration/get-dirs.mjs +1 -1
  9. package/dist/configuration/get-dirs.mjs.map +1 -1
  10. package/dist/configuration/index.js.map +1 -1
  11. package/dist/configuration/index.mjs.map +1 -1
  12. package/dist/configuration/urls.js.map +1 -1
  13. package/dist/configuration/urls.mjs.map +1 -1
  14. package/dist/container.js.map +1 -1
  15. package/dist/container.mjs.map +1 -1
  16. package/dist/core-api/controller/collection-type.js.map +1 -1
  17. package/dist/core-api/controller/collection-type.mjs.map +1 -1
  18. package/dist/core-api/controller/index.js.map +1 -1
  19. package/dist/core-api/controller/index.mjs.map +1 -1
  20. package/dist/core-api/controller/single-type.js.map +1 -1
  21. package/dist/core-api/controller/single-type.mjs.map +1 -1
  22. package/dist/core-api/controller/transform.js.map +1 -1
  23. package/dist/core-api/controller/transform.mjs.map +1 -1
  24. package/dist/core-api/routes/index.js.map +1 -1
  25. package/dist/core-api/routes/index.mjs.map +1 -1
  26. package/dist/core-api/routes/validation/attributes.js.map +1 -1
  27. package/dist/core-api/routes/validation/attributes.mjs +1 -1
  28. package/dist/core-api/routes/validation/attributes.mjs.map +1 -1
  29. package/dist/core-api/routes/validation/common.js.map +1 -1
  30. package/dist/core-api/routes/validation/common.mjs.map +1 -1
  31. package/dist/core-api/routes/validation/component.js.map +1 -1
  32. package/dist/core-api/routes/validation/component.mjs.map +1 -1
  33. package/dist/core-api/routes/validation/constants.js.map +1 -1
  34. package/dist/core-api/routes/validation/constants.mjs.map +1 -1
  35. package/dist/core-api/routes/validation/content-type.js.map +1 -1
  36. package/dist/core-api/routes/validation/content-type.mjs.map +1 -1
  37. package/dist/core-api/routes/validation/mappers.js.map +1 -1
  38. package/dist/core-api/routes/validation/mappers.mjs.map +1 -1
  39. package/dist/core-api/routes/validation/utils.js.map +1 -1
  40. package/dist/core-api/routes/validation/utils.mjs.map +1 -1
  41. package/dist/core-api/service/collection-type.js.map +1 -1
  42. package/dist/core-api/service/collection-type.mjs.map +1 -1
  43. package/dist/core-api/service/core-service.js.map +1 -1
  44. package/dist/core-api/service/core-service.mjs.map +1 -1
  45. package/dist/core-api/service/index.js.map +1 -1
  46. package/dist/core-api/service/index.mjs.map +1 -1
  47. package/dist/core-api/service/pagination.js.map +1 -1
  48. package/dist/core-api/service/pagination.mjs +1 -1
  49. package/dist/core-api/service/pagination.mjs.map +1 -1
  50. package/dist/core-api/service/single-type.js.map +1 -1
  51. package/dist/core-api/service/single-type.mjs.map +1 -1
  52. package/dist/domain/content-type/index.js.map +1 -1
  53. package/dist/domain/content-type/index.mjs.map +1 -1
  54. package/dist/domain/content-type/validator.js.map +1 -1
  55. package/dist/domain/content-type/validator.mjs.map +1 -1
  56. package/dist/domain/module/index.js.map +1 -1
  57. package/dist/domain/module/index.mjs.map +1 -1
  58. package/dist/domain/module/validation.js.map +1 -1
  59. package/dist/domain/module/validation.mjs.map +1 -1
  60. package/dist/ee/index.js.map +1 -1
  61. package/dist/ee/index.mjs +2 -2
  62. package/dist/ee/index.mjs.map +1 -1
  63. package/dist/ee/license.js.map +1 -1
  64. package/dist/ee/license.mjs.map +1 -1
  65. package/dist/factories.js +4 -4
  66. package/dist/factories.js.map +1 -1
  67. package/dist/factories.mjs.map +1 -1
  68. package/dist/index.js.map +1 -1
  69. package/dist/index.mjs.map +1 -1
  70. package/dist/loaders/admin.js.map +1 -1
  71. package/dist/loaders/admin.mjs.map +1 -1
  72. package/dist/loaders/apis.js.map +1 -1
  73. package/dist/loaders/apis.mjs.map +1 -1
  74. package/dist/loaders/components.js.map +1 -1
  75. package/dist/loaders/components.mjs.map +1 -1
  76. package/dist/loaders/index.js.map +1 -1
  77. package/dist/loaders/index.mjs.map +1 -1
  78. package/dist/loaders/middlewares.js.map +1 -1
  79. package/dist/loaders/middlewares.mjs.map +1 -1
  80. package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
  81. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
  82. package/dist/loaders/plugins/get-user-plugins-config.js.map +1 -1
  83. package/dist/loaders/plugins/get-user-plugins-config.mjs.map +1 -1
  84. package/dist/loaders/plugins/index.js.map +1 -1
  85. package/dist/loaders/plugins/index.mjs +1 -1
  86. package/dist/loaders/plugins/index.mjs.map +1 -1
  87. package/dist/loaders/policies.js.map +1 -1
  88. package/dist/loaders/policies.mjs.map +1 -1
  89. package/dist/loaders/sanitizers.js.map +1 -1
  90. package/dist/loaders/sanitizers.mjs.map +1 -1
  91. package/dist/loaders/src-index.js.map +1 -1
  92. package/dist/loaders/src-index.mjs.map +1 -1
  93. package/dist/loaders/validators.js.map +1 -1
  94. package/dist/loaders/validators.mjs.map +1 -1
  95. package/dist/middlewares/body.js.map +1 -1
  96. package/dist/middlewares/body.mjs.map +1 -1
  97. package/dist/middlewares/compression.js.map +1 -1
  98. package/dist/middlewares/compression.mjs.map +1 -1
  99. package/dist/middlewares/cors.js.map +1 -1
  100. package/dist/middlewares/cors.mjs.map +1 -1
  101. package/dist/middlewares/errors.js.map +1 -1
  102. package/dist/middlewares/errors.mjs.map +1 -1
  103. package/dist/middlewares/favicon.js.map +1 -1
  104. package/dist/middlewares/favicon.mjs.map +1 -1
  105. package/dist/middlewares/index.js.map +1 -1
  106. package/dist/middlewares/index.mjs.map +1 -1
  107. package/dist/middlewares/ip.js.map +1 -1
  108. package/dist/middlewares/ip.mjs.map +1 -1
  109. package/dist/middlewares/logger.js.map +1 -1
  110. package/dist/middlewares/logger.mjs.map +1 -1
  111. package/dist/middlewares/powered-by.js.map +1 -1
  112. package/dist/middlewares/powered-by.mjs.map +1 -1
  113. package/dist/middlewares/public.js.map +1 -1
  114. package/dist/middlewares/public.mjs.map +1 -1
  115. package/dist/middlewares/query.js.map +1 -1
  116. package/dist/middlewares/query.mjs.map +1 -1
  117. package/dist/middlewares/response-time.js.map +1 -1
  118. package/dist/middlewares/response-time.mjs.map +1 -1
  119. package/dist/middlewares/responses.js.map +1 -1
  120. package/dist/middlewares/responses.mjs.map +1 -1
  121. package/dist/middlewares/security.js.map +1 -1
  122. package/dist/middlewares/security.mjs.map +1 -1
  123. package/dist/middlewares/session.js.map +1 -1
  124. package/dist/middlewares/session.mjs.map +1 -1
  125. package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -1
  126. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -1
  127. package/dist/migrations/draft-publish.js.map +1 -1
  128. package/dist/migrations/draft-publish.mjs.map +1 -1
  129. package/dist/migrations/first-published-at.js.map +1 -1
  130. package/dist/migrations/first-published-at.mjs.map +1 -1
  131. package/dist/migrations/i18n.js.map +1 -1
  132. package/dist/migrations/i18n.mjs.map +1 -1
  133. package/dist/migrations/index.mjs +2 -2
  134. package/dist/package.json.js +18 -17
  135. package/dist/package.json.js.map +1 -1
  136. package/dist/package.json.mjs +23 -22
  137. package/dist/package.json.mjs.map +1 -1
  138. package/dist/providers/admin.js.map +1 -1
  139. package/dist/providers/admin.mjs.map +1 -1
  140. package/dist/providers/coreStore.js.map +1 -1
  141. package/dist/providers/coreStore.mjs.map +1 -1
  142. package/dist/providers/cron.js.map +1 -1
  143. package/dist/providers/cron.mjs.map +1 -1
  144. package/dist/providers/index.js.map +1 -1
  145. package/dist/providers/index.mjs.map +1 -1
  146. package/dist/providers/provider.js.map +1 -1
  147. package/dist/providers/provider.mjs.map +1 -1
  148. package/dist/providers/registries.js.map +1 -1
  149. package/dist/providers/registries.mjs.map +1 -1
  150. package/dist/providers/session-manager.js.map +1 -1
  151. package/dist/providers/session-manager.mjs.map +1 -1
  152. package/dist/providers/telemetry.js.map +1 -1
  153. package/dist/providers/telemetry.mjs.map +1 -1
  154. package/dist/providers/webhooks.js.map +1 -1
  155. package/dist/providers/webhooks.mjs.map +1 -1
  156. package/dist/registries/apis.js.map +1 -1
  157. package/dist/registries/apis.mjs.map +1 -1
  158. package/dist/registries/components.js.map +1 -1
  159. package/dist/registries/components.mjs.map +1 -1
  160. package/dist/registries/content-types.js.map +1 -1
  161. package/dist/registries/content-types.mjs +2 -2
  162. package/dist/registries/content-types.mjs.map +1 -1
  163. package/dist/registries/controllers.js.map +1 -1
  164. package/dist/registries/controllers.mjs +2 -2
  165. package/dist/registries/controllers.mjs.map +1 -1
  166. package/dist/registries/custom-fields.js.map +1 -1
  167. package/dist/registries/custom-fields.mjs.map +1 -1
  168. package/dist/registries/hooks.js.map +1 -1
  169. package/dist/registries/hooks.mjs +1 -1
  170. package/dist/registries/hooks.mjs.map +1 -1
  171. package/dist/registries/middlewares.js.map +1 -1
  172. package/dist/registries/middlewares.mjs +2 -2
  173. package/dist/registries/middlewares.mjs.map +1 -1
  174. package/dist/registries/models.js.map +1 -1
  175. package/dist/registries/models.mjs.map +1 -1
  176. package/dist/registries/modules.js.map +1 -1
  177. package/dist/registries/modules.mjs +1 -1
  178. package/dist/registries/modules.mjs.map +1 -1
  179. package/dist/registries/namespace.js.map +1 -1
  180. package/dist/registries/namespace.mjs.map +1 -1
  181. package/dist/registries/plugins.js.map +1 -1
  182. package/dist/registries/plugins.mjs.map +1 -1
  183. package/dist/registries/policies.js.map +1 -1
  184. package/dist/registries/policies.mjs +2 -2
  185. package/dist/registries/policies.mjs.map +1 -1
  186. package/dist/registries/sanitizers.js.map +1 -1
  187. package/dist/registries/sanitizers.mjs.map +1 -1
  188. package/dist/registries/services.js.map +1 -1
  189. package/dist/registries/services.mjs +2 -2
  190. package/dist/registries/services.mjs.map +1 -1
  191. package/dist/registries/validators.js.map +1 -1
  192. package/dist/registries/validators.mjs.map +1 -1
  193. package/dist/services/auth/index.js.map +1 -1
  194. package/dist/services/auth/index.mjs.map +1 -1
  195. package/dist/services/config.js.map +1 -1
  196. package/dist/services/config.mjs +1 -1
  197. package/dist/services/config.mjs.map +1 -1
  198. package/dist/services/content-api/index.js.map +1 -1
  199. package/dist/services/content-api/index.mjs +1 -1
  200. package/dist/services/content-api/index.mjs.map +1 -1
  201. package/dist/services/content-api/permissions/engine.js.map +1 -1
  202. package/dist/services/content-api/permissions/engine.mjs.map +1 -1
  203. package/dist/services/content-api/permissions/index.js.map +1 -1
  204. package/dist/services/content-api/permissions/index.mjs.map +1 -1
  205. package/dist/services/content-api/permissions/providers/action.js.map +1 -1
  206. package/dist/services/content-api/permissions/providers/action.mjs.map +1 -1
  207. package/dist/services/content-api/permissions/providers/condition.js.map +1 -1
  208. package/dist/services/content-api/permissions/providers/condition.mjs.map +1 -1
  209. package/dist/services/content-source-maps.js.map +1 -1
  210. package/dist/services/content-source-maps.mjs.map +1 -1
  211. package/dist/services/core-store.js.map +1 -1
  212. package/dist/services/core-store.mjs.map +1 -1
  213. package/dist/services/cron.js.map +1 -1
  214. package/dist/services/cron.mjs.map +1 -1
  215. package/dist/services/custom-fields.js.map +1 -1
  216. package/dist/services/custom-fields.mjs.map +1 -1
  217. package/dist/services/document-service/attributes/index.js.map +1 -1
  218. package/dist/services/document-service/attributes/index.mjs.map +1 -1
  219. package/dist/services/document-service/attributes/transforms.js.map +1 -1
  220. package/dist/services/document-service/attributes/transforms.mjs.map +1 -1
  221. package/dist/services/document-service/common.js.map +1 -1
  222. package/dist/services/document-service/common.mjs.map +1 -1
  223. package/dist/services/document-service/components.js.map +1 -1
  224. package/dist/services/document-service/components.mjs.map +1 -1
  225. package/dist/services/document-service/draft-and-publish.js.map +1 -1
  226. package/dist/services/document-service/draft-and-publish.mjs.map +1 -1
  227. package/dist/services/document-service/entries.js.map +1 -1
  228. package/dist/services/document-service/entries.mjs +2 -2
  229. package/dist/services/document-service/entries.mjs.map +1 -1
  230. package/dist/services/document-service/events.js +1 -6
  231. package/dist/services/document-service/events.js.map +1 -1
  232. package/dist/services/document-service/events.mjs +1 -6
  233. package/dist/services/document-service/events.mjs.map +1 -1
  234. package/dist/services/document-service/first-published-at.js.map +1 -1
  235. package/dist/services/document-service/first-published-at.mjs.map +1 -1
  236. package/dist/services/document-service/index.js.map +1 -1
  237. package/dist/services/document-service/index.mjs.map +1 -1
  238. package/dist/services/document-service/internationalization.js.map +1 -1
  239. package/dist/services/document-service/internationalization.mjs.map +1 -1
  240. package/dist/services/document-service/middlewares/errors.js.map +1 -1
  241. package/dist/services/document-service/middlewares/errors.mjs.map +1 -1
  242. package/dist/services/document-service/middlewares/middleware-manager.js.map +1 -1
  243. package/dist/services/document-service/middlewares/middleware-manager.mjs.map +1 -1
  244. package/dist/services/document-service/params.js.map +1 -1
  245. package/dist/services/document-service/params.mjs.map +1 -1
  246. package/dist/services/document-service/repository.js +0 -2
  247. package/dist/services/document-service/repository.js.map +1 -1
  248. package/dist/services/document-service/repository.mjs +4 -6
  249. package/dist/services/document-service/repository.mjs.map +1 -1
  250. package/dist/services/document-service/transform/data.js.map +1 -1
  251. package/dist/services/document-service/transform/data.mjs.map +1 -1
  252. package/dist/services/document-service/transform/fields.js.map +1 -1
  253. package/dist/services/document-service/transform/fields.mjs.map +1 -1
  254. package/dist/services/document-service/transform/id-map.js.map +1 -1
  255. package/dist/services/document-service/transform/id-map.mjs.map +1 -1
  256. package/dist/services/document-service/transform/id-transform.js.map +1 -1
  257. package/dist/services/document-service/transform/id-transform.mjs.map +1 -1
  258. package/dist/services/document-service/transform/populate.js.map +1 -1
  259. package/dist/services/document-service/transform/populate.mjs.map +1 -1
  260. package/dist/services/document-service/transform/query.js.map +1 -1
  261. package/dist/services/document-service/transform/query.mjs.map +1 -1
  262. package/dist/services/document-service/transform/relations/extract/data-ids.js.map +1 -1
  263. package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +1 -1
  264. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +1 -1
  265. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +1 -1
  266. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +1 -1
  267. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +1 -1
  268. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +1 -1
  269. package/dist/services/document-service/transform/relations/utils/dp.js.map +1 -1
  270. package/dist/services/document-service/transform/relations/utils/dp.mjs.map +1 -1
  271. package/dist/services/document-service/transform/relations/utils/i18n.js.map +1 -1
  272. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +1 -1
  273. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +1 -1
  274. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +1 -1
  275. package/dist/services/document-service/utils/bidirectional-relations.js.map +1 -1
  276. package/dist/services/document-service/utils/bidirectional-relations.mjs.map +1 -1
  277. package/dist/services/document-service/utils/clean-component-join-table.js.map +1 -1
  278. package/dist/services/document-service/utils/clean-component-join-table.mjs.map +1 -1
  279. package/dist/services/document-service/utils/ordered-parallel.js.map +1 -1
  280. package/dist/services/document-service/utils/ordered-parallel.mjs.map +1 -1
  281. package/dist/services/document-service/utils/populate.js.map +1 -1
  282. package/dist/services/document-service/utils/populate.mjs.map +1 -1
  283. package/dist/services/document-service/utils/unidirectional-relations.js.map +1 -1
  284. package/dist/services/document-service/utils/unidirectional-relations.mjs.map +1 -1
  285. package/dist/services/entity-service/index.js.map +1 -1
  286. package/dist/services/entity-service/index.mjs +1 -1
  287. package/dist/services/entity-service/index.mjs.map +1 -1
  288. package/dist/services/entity-validator/blocks-validator.js.map +1 -1
  289. package/dist/services/entity-validator/blocks-validator.mjs.map +1 -1
  290. package/dist/services/entity-validator/index.js.map +1 -1
  291. package/dist/services/entity-validator/index.mjs +1 -1
  292. package/dist/services/entity-validator/index.mjs.map +1 -1
  293. package/dist/services/entity-validator/validators.js.map +1 -1
  294. package/dist/services/entity-validator/validators.mjs.map +1 -1
  295. package/dist/services/errors.js.map +1 -1
  296. package/dist/services/errors.mjs.map +1 -1
  297. package/dist/services/event-hub.js.map +1 -1
  298. package/dist/services/event-hub.mjs.map +1 -1
  299. package/dist/services/features.js.map +1 -1
  300. package/dist/services/features.mjs.map +1 -1
  301. package/dist/services/fs.js.map +1 -1
  302. package/dist/services/fs.mjs.map +1 -1
  303. package/dist/services/metrics/admin-user-hash.js.map +1 -1
  304. package/dist/services/metrics/admin-user-hash.mjs.map +1 -1
  305. package/dist/services/metrics/index.js.map +1 -1
  306. package/dist/services/metrics/index.mjs.map +1 -1
  307. package/dist/services/metrics/is-truthy.js.map +1 -1
  308. package/dist/services/metrics/is-truthy.mjs.map +1 -1
  309. package/dist/services/metrics/middleware.js.map +1 -1
  310. package/dist/services/metrics/middleware.mjs.map +1 -1
  311. package/dist/services/metrics/rate-limiter.js.map +1 -1
  312. package/dist/services/metrics/rate-limiter.mjs.map +1 -1
  313. package/dist/services/metrics/sender.js.map +1 -1
  314. package/dist/services/metrics/sender.mjs.map +1 -1
  315. package/dist/services/query-params.js.map +1 -1
  316. package/dist/services/query-params.mjs.map +1 -1
  317. package/dist/services/reloader.js.map +1 -1
  318. package/dist/services/reloader.mjs.map +1 -1
  319. package/dist/services/request-context.js.map +1 -1
  320. package/dist/services/request-context.mjs.map +1 -1
  321. package/dist/services/server/admin-api.js.map +1 -1
  322. package/dist/services/server/admin-api.mjs.map +1 -1
  323. package/dist/services/server/api.js.map +1 -1
  324. package/dist/services/server/api.mjs.map +1 -1
  325. package/dist/services/server/compose-endpoint.js +1 -3
  326. package/dist/services/server/compose-endpoint.js.map +1 -1
  327. package/dist/services/server/compose-endpoint.mjs +1 -3
  328. package/dist/services/server/compose-endpoint.mjs.map +1 -1
  329. package/dist/services/server/content-api.js.map +1 -1
  330. package/dist/services/server/content-api.mjs.map +1 -1
  331. package/dist/services/server/http-server.js.map +1 -1
  332. package/dist/services/server/http-server.mjs.map +1 -1
  333. package/dist/services/server/index.js.map +1 -1
  334. package/dist/services/server/index.mjs.map +1 -1
  335. package/dist/services/server/koa.js.map +1 -1
  336. package/dist/services/server/koa.mjs.map +1 -1
  337. package/dist/services/server/middleware.js.map +1 -1
  338. package/dist/services/server/middleware.mjs.map +1 -1
  339. package/dist/services/server/policy.js.map +1 -1
  340. package/dist/services/server/policy.mjs.map +1 -1
  341. package/dist/services/server/register-middlewares.js.map +1 -1
  342. package/dist/services/server/register-middlewares.mjs.map +1 -1
  343. package/dist/services/server/register-routes.js.map +1 -1
  344. package/dist/services/server/register-routes.mjs.map +1 -1
  345. package/dist/services/server/routing.js.map +1 -1
  346. package/dist/services/server/routing.mjs.map +1 -1
  347. package/dist/services/session-manager.js.map +1 -1
  348. package/dist/services/session-manager.mjs.map +1 -1
  349. package/dist/services/utils/conditional-fields.js.map +1 -1
  350. package/dist/services/utils/conditional-fields.mjs.map +1 -1
  351. package/dist/services/utils/dynamic-zones.js.map +1 -1
  352. package/dist/services/utils/dynamic-zones.mjs.map +1 -1
  353. package/dist/services/webhook-runner.js.map +1 -1
  354. package/dist/services/webhook-runner.mjs.map +1 -1
  355. package/dist/services/webhook-store.js.map +1 -1
  356. package/dist/services/webhook-store.mjs.map +1 -1
  357. package/dist/services/worker-queue.js.map +1 -1
  358. package/dist/services/worker-queue.mjs.map +1 -1
  359. package/dist/utils/convert-custom-field-type.js.map +1 -1
  360. package/dist/utils/convert-custom-field-type.mjs.map +1 -1
  361. package/dist/utils/cron.js.map +1 -1
  362. package/dist/utils/cron.mjs.map +1 -1
  363. package/dist/utils/fetch.js.map +1 -1
  364. package/dist/utils/fetch.mjs.map +1 -1
  365. package/dist/utils/filepath-to-prop-path.js.map +1 -1
  366. package/dist/utils/filepath-to-prop-path.mjs.map +1 -1
  367. package/dist/utils/is-initialized.js.map +1 -1
  368. package/dist/utils/is-initialized.mjs.map +1 -1
  369. package/dist/utils/lifecycles.js.map +1 -1
  370. package/dist/utils/lifecycles.mjs.map +1 -1
  371. package/dist/utils/load-config-file.js.map +1 -1
  372. package/dist/utils/load-config-file.mjs.map +1 -1
  373. package/dist/utils/load-files.js.map +1 -1
  374. package/dist/utils/load-files.mjs.map +1 -1
  375. package/dist/utils/open-browser.js.map +1 -1
  376. package/dist/utils/open-browser.mjs.map +1 -1
  377. package/dist/utils/resolve-working-dirs.js.map +1 -1
  378. package/dist/utils/resolve-working-dirs.mjs.map +1 -1
  379. package/dist/utils/signals.js.map +1 -1
  380. package/dist/utils/signals.mjs.map +1 -1
  381. package/dist/utils/startup-logger.js.map +1 -1
  382. package/dist/utils/startup-logger.mjs.map +1 -1
  383. package/dist/utils/transform-content-types-to-models.js.map +1 -1
  384. package/dist/utils/transform-content-types-to-models.mjs.map +1 -1
  385. package/dist/utils/update-notifier/index.js.map +1 -1
  386. package/dist/utils/update-notifier/index.mjs.map +1 -1
  387. package/package.json +18 -17
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/core-api/routes/validation/constants.ts"],"sourcesContent":["/**\n * Defines the constant literal values for boolean representations.\n *\n * These values can be used to convert string representations of booleans (for example, 'true', 'false', '1', '0')\n * into actual boolean types.\n */\n\nexport const BOOLEAN_LITERAL_VALUES = ['t', '1', 'true', 'f', '0', 'false'] as const;\n"],"names":["BOOLEAN_LITERAL_VALUES"],"mappings":";;AAAA;;;;;UAOaA,sBAAyB,GAAA;AAAC,IAAA,GAAA;AAAK,IAAA,GAAA;AAAK,IAAA,MAAA;AAAQ,IAAA,GAAA;AAAK,IAAA,GAAA;AAAK,IAAA;;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/core-api/routes/validation/constants.ts"],"sourcesContent":["/**\n * Defines the constant literal values for boolean representations.\n *\n * These values can be used to convert string representations of booleans (for example, 'true', 'false', '1', '0')\n * into actual boolean types.\n */\n\nexport const BOOLEAN_LITERAL_VALUES = ['t', '1', 'true', 'f', '0', 'false'] as const;\n"],"names":["BOOLEAN_LITERAL_VALUES"],"mappings":";;AAAA;;;;;UAOaA,sBAAAA,GAAyB;AAAC,IAAA,GAAA;AAAK,IAAA,GAAA;AAAK,IAAA,MAAA;AAAQ,IAAA,GAAA;AAAK,IAAA,GAAA;AAAK,IAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","sources":["../../../../src/core-api/routes/validation/constants.ts"],"sourcesContent":["/**\n * Defines the constant literal values for boolean representations.\n *\n * These values can be used to convert string representations of booleans (for example, 'true', 'false', '1', '0')\n * into actual boolean types.\n */\n\nexport const BOOLEAN_LITERAL_VALUES = ['t', '1', 'true', 'f', '0', 'false'] as const;\n"],"names":["BOOLEAN_LITERAL_VALUES"],"mappings":"AAAA;;;;;UAOaA,sBAAyB,GAAA;AAAC,IAAA,GAAA;AAAK,IAAA,GAAA;AAAK,IAAA,MAAA;AAAQ,IAAA,GAAA;AAAK,IAAA,GAAA;AAAK,IAAA;;;;;"}
1
+ {"version":3,"file":"constants.mjs","sources":["../../../../src/core-api/routes/validation/constants.ts"],"sourcesContent":["/**\n * Defines the constant literal values for boolean representations.\n *\n * These values can be used to convert string representations of booleans (for example, 'true', 'false', '1', '0')\n * into actual boolean types.\n */\n\nexport const BOOLEAN_LITERAL_VALUES = ['t', '1', 'true', 'f', '0', 'false'] as const;\n"],"names":["BOOLEAN_LITERAL_VALUES"],"mappings":"AAAA;;;;;UAOaA,sBAAAA,GAAyB;AAAC,IAAA,GAAA;AAAK,IAAA,GAAA;AAAK,IAAA,MAAA;AAAQ,IAAA,GAAA;AAAK,IAAA,GAAA;AAAK,IAAA;;;;;"}
@@ -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\nexport type QueryParam =\n | 'fields'\n | 'populate'\n | 'sort'\n | 'status'\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(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 hasPublishedVersion() {\n return z\n .union([z.boolean(), z.enum(['true', 'false'])])\n .describe(\n '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(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 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","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","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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA;;;;;;;;;;;;;;;;;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,GAAA;AAC9CC,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACnC,sBAAsB,CAACoC,QAAQ,EAAA;AAClDC,YAAAA,QAAAA,EAAU,IAAM,IAAI,CAAClC,wBAAwB,CAACiC,QAAQ,EAAA;AACtDE,YAAAA,IAAAA,EAAM,IAAM,IAAI,CAAC5B,oBAAoB,CAAC0B,QAAQ,EAAA;AAC9CG,YAAAA,OAAAA,EAAS,IAAM,IAAI,CAACxB,kBAAkB,CAACqB,QAAQ,EAAA;AAC/ClB,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACA,MAAM,CAACkB,QAAQ,EAAA;AAClCI,YAAAA,UAAAA,EAAY,IAAM,IAAI,CAACA,UAAU,CAACJ,QAAQ,EAAA;AAC1CjB,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACA,MAAM,CAACiB,QAAQ,EAAA;AAClChB,YAAAA,mBAAAA,EAAqB,IAAM,IAAI,CAACA,mBAAmB,CAACgB,QAAQ,EAAA;AAC5DK,YAAAA,EAAAA,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,KAAM,GAAEV,GAAG,CAACU,KAAM,CAAA;AAAG,aAAA,GACjD,EAAC,CAAA;AAEL;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\nexport type QueryParam =\n | 'fields'\n | 'populate'\n | 'sort'\n | 'status'\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(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 hasPublishedVersion() {\n return z\n .union([z.boolean(), z.enum(['true', 'false'])])\n .describe(\n '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(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 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","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","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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA;;;;;;;;;;;;;;;;;;IAmBO,MAAMA,6BAAAA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AAEA;;;;;;;;;;;MAYAC,WAAAA,CAAYC,MAAoB,EAAyC;AACvE,QAAA,MAAMC,GAAAA,GAA0C;AAC9CC,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACnC,sBAAsB,CAACoC,QAAQ,EAAA;AAClDC,YAAAA,QAAAA,EAAU,IAAM,IAAI,CAAClC,wBAAwB,CAACiC,QAAQ,EAAA;AACtDE,YAAAA,IAAAA,EAAM,IAAM,IAAI,CAAC5B,oBAAoB,CAAC0B,QAAQ,EAAA;AAC9CG,YAAAA,OAAAA,EAAS,IAAM,IAAI,CAACxB,kBAAkB,CAACqB,QAAQ,EAAA;AAC/ClB,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACA,MAAM,CAACkB,QAAQ,EAAA;AAClCI,YAAAA,UAAAA,EAAY,IAAM,IAAI,CAACA,UAAU,CAACJ,QAAQ,EAAA;AAC1CjB,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACA,MAAM,CAACiB,QAAQ,EAAA;AAClChB,YAAAA,mBAAAA,EAAqB,IAAM,IAAI,CAACA,mBAAmB,CAACgB,QAAQ,EAAA;AAC5DK,YAAAA,EAAAA,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 +1 @@
1
- {"version":3,"file":"content-type.mjs","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\nexport type QueryParam =\n | 'fields'\n | 'populate'\n | 'sort'\n | 'status'\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(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 hasPublishedVersion() {\n return z\n .union([z.boolean(), z.enum(['true', 'false'])])\n .describe(\n '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(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 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","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","hasPublishedVersion","boolean","data","isWritableAttribute","attributeName","contentTypes","_schema","createAttributesInputSchema","query","body","partialBody","partial","queryParams","params","map","fields","optional","populate","sort","filters","pag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,WAAAA,CAAYC,MAAoB,EAAyC;AACvE,QAAA,MAAMC,GAA0C,GAAA;AAC9CC,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACnC,sBAAsB,CAACoC,QAAQ,EAAA;AAClDC,YAAAA,QAAAA,EAAU,IAAM,IAAI,CAAClC,wBAAwB,CAACiC,QAAQ,EAAA;AACtDE,YAAAA,IAAAA,EAAM,IAAM,IAAI,CAAC5B,oBAAoB,CAAC0B,QAAQ,EAAA;AAC9CG,YAAAA,OAAAA,EAAS,IAAM,IAAI,CAACxB,kBAAkB,CAACqB,QAAQ,EAAA;AAC/ClB,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACA,MAAM,CAACkB,QAAQ,EAAA;AAClCI,YAAAA,UAAAA,EAAY,IAAM,IAAI,CAACA,UAAU,CAACJ,QAAQ,EAAA;AAC1CjB,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACA,MAAM,CAACiB,QAAQ,EAAA;AAClChB,YAAAA,mBAAAA,EAAqB,IAAM,IAAI,CAACA,mBAAmB,CAACgB,QAAQ,EAAA;AAC5DK,YAAAA,EAAAA,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,KAAM,GAAEV,GAAG,CAACU,KAAM,CAAA;AAAG,aAAA,GACjD,EAAC,CAAA;AAEL;AACF;;;;"}
1
+ {"version":3,"file":"content-type.mjs","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\nexport type QueryParam =\n | 'fields'\n | 'populate'\n | 'sort'\n | 'status'\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(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 hasPublishedVersion() {\n return z\n .union([z.boolean(), z.enum(['true', 'false'])])\n .describe(\n '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(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 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","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","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":";;;;;AAoBA;;;;;;;;;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AAAG,SAAA,CAAA;AAC9C,IAAA;AAEA;;;;;;;;;;;MAYAC,WAAAA,CAAYC,MAAoB,EAAyC;AACvE,QAAA,MAAMC,GAAAA,GAA0C;AAC9CC,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACnC,sBAAsB,CAACoC,QAAQ,EAAA;AAClDC,YAAAA,QAAAA,EAAU,IAAM,IAAI,CAAClC,wBAAwB,CAACiC,QAAQ,EAAA;AACtDE,YAAAA,IAAAA,EAAM,IAAM,IAAI,CAAC5B,oBAAoB,CAAC0B,QAAQ,EAAA;AAC9CG,YAAAA,OAAAA,EAAS,IAAM,IAAI,CAACxB,kBAAkB,CAACqB,QAAQ,EAAA;AAC/ClB,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACA,MAAM,CAACkB,QAAQ,EAAA;AAClCI,YAAAA,UAAAA,EAAY,IAAM,IAAI,CAACA,UAAU,CAACJ,QAAQ,EAAA;AAC1CjB,YAAAA,MAAAA,EAAQ,IAAM,IAAI,CAACA,MAAM,CAACiB,QAAQ,EAAA;AAClChB,YAAAA,mBAAAA,EAAqB,IAAM,IAAI,CAACA,mBAAmB,CAACgB,QAAQ,EAAA;AAC5DK,YAAAA,EAAAA,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 +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 { 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 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(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 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(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 = (attribute: Schema.Attribute.AnyAttribute): 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(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(attribute);\n case 'relation':\n return attributes.relationToSchema(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 strapiInstance = global.strapi;\n if (!strapiInstance) {\n throw new Error('Strapi instance not available for custom field conversion');\n }\n\n const customField = strapiInstance.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({ ...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 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 strapiInstance = global.strapi;\n if (!strapiInstance) {\n throw new Error('Strapi instance not available for custom field conversion');\n }\n\n const customField = strapiInstance.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({ ...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","attributes","reduce","acc","name","extend","mapAttributeToSchema","z","object","createAttributesInputSchema","mapAttributeToInputSchema","attrCF","strapiInstance","global","strapi","Error","get"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAMA,yBAAyB,CAC7BC,SAAAA,GAAAA;AAEA,IAAA,OACE,CAAC,CAACA,SACF,IAAA,OAAOA,cAAc,QACrB,IAACA,SAAkBC,CAAAA,IAAI,KAAK,aAC5B,IAAA,OAAO,SAACD,CAAkBE,WAAW,KAAK,QAAA;AAE9C,CAAA;AAEA;;;;;;;;;;;;;;;;IAiBaC,MAAAA,sBAAAA,GAAyB,CACpCC,UAAAA,GAAAA;AAEA,IAAA,OAAOA,WAAWC,MAAM,CAAC,CAACC,GAAK,EAAA,CAACC,MAAMP,SAAU,CAAA,GAAA;QAC9C,OAAOM,GAAAA,CAAIE,MAAM,CAAC;YAChB,KAAKD,MAAQ,GA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AAA,CAAAA;QACtC,KAAK,MAAA;YACH,OAAOI,4BAA4B,CAACJ,SAAAA,CAAAA;QACtC,KAAK,WAAA;YACH,OAAOI,iCAAiC,CAACJ,SAAAA,CAAAA;QAC3C,KAAK,KAAA;YACH,OAAOI,2BAA2B,CAACJ,SAAAA,CAAAA;AACrC,QAAA;AAAS,YAAA;AACP,gBAAA,IAAID,uBAAuBC,SAAY,CAAA,EAAA;AACrC,oBAAA,MAAMc,MAASd,GAAAA,SAAAA;oBACf,MAAMe,cAAAA,GAAiBC,OAAOC,MAAM;AACpC,oBAAA,IAAI,CAACF,cAAgB,EAAA;AACnB,wBAAA,MAAM,IAAIG,KAAM,CAAA,2DAAA,CAAA;AAClB;oBAEA,MAAMhB,WAAAA,GAAca,eAAeI,GAAG,CAAC,iBAAiBA,GAAG,CAACL,OAAOZ,WAAW,CAAA;AAC9E,oBAAA,IAAI,CAACA,WAAa,EAAA;wBAChB,MAAM,IAAIgB,MAAM,CAAC,cAAc,EAAEJ,MAAOZ,CAAAA,WAAW,CAAC,WAAW,CAAC,CAAA;AAClE;;AAGA,oBAAA,OAAOW,yBAA0B,CAAA;AAAE,wBAAA,GAAGC,MAAM;AAAEb,wBAAAA,IAAAA,EAAMC,YAAYD;AAAK,qBAAA,CAAA;AACvE;gBAEA,MAAM,EAAEA,IAAI,EAAE,GAAGD,SAAAA;AAEjB,gBAAA,MAAM,IAAIkB,KAAAA,CAAM,CAAC,4BAA4B,EAAEjB,IAAM,CAAA,CAAA,CAAA;AACvD;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 { 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 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(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 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(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 = (attribute: Schema.Attribute.AnyAttribute): 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(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(attribute);\n case 'relation':\n return attributes.relationToSchema(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 strapiInstance = global.strapi;\n if (!strapiInstance) {\n throw new Error('Strapi instance not available for custom field conversion');\n }\n\n const customField = strapiInstance.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({ ...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 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 strapiInstance = global.strapi;\n if (!strapiInstance) {\n throw new Error('Strapi instance not available for custom field conversion');\n }\n\n const customField = strapiInstance.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({ ...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","attributes","reduce","acc","name","extend","mapAttributeToSchema","z","object","createAttributesInputSchema","mapAttributeToInputSchema","attrCF","strapiInstance","global","strapi","Error","get"],"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;;;;;;;;;;;;;;;;IAiBO,MAAMC,sBAAAA,GAAyB,CACpCC,UAAAA,GAAAA;AAEA,IAAA,OAAOA,WAAWC,MAAM,CAAC,CAACC,GAAAA,EAAK,CAACC,MAAMP,SAAAA,CAAU,GAAA;QAC9C,OAAOM,GAAAA,CAAIE,MAAM,CAAC;YAChB,KAAKD,MAAK,GAAG;AACX,gBAAA,OAAOE,oBAAAA,CAAqBT,SAAAA,CAAAA;AAC9B,YAAA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A;QACtC,KAAK,MAAA;YACH,OAAOI,4BAA4B,CAACJ,SAAAA,CAAAA;QACtC,KAAK,WAAA;YACH,OAAOI,iCAAiC,CAACJ,SAAAA,CAAAA;QAC3C,KAAK,KAAA;YACH,OAAOI,2BAA2B,CAACJ,SAAAA,CAAAA;AACrC,QAAA;AAAS,YAAA;AACP,gBAAA,IAAID,uBAAuBC,SAAAA,CAAAA,EAAY;AACrC,oBAAA,MAAMc,MAAAA,GAASd,SAAAA;oBACf,MAAMe,cAAAA,GAAiBC,OAAOC,MAAM;AACpC,oBAAA,IAAI,CAACF,cAAAA,EAAgB;AACnB,wBAAA,MAAM,IAAIG,KAAAA,CAAM,2DAAA,CAAA;AAClB,oBAAA;oBAEA,MAAMhB,WAAAA,GAAca,eAAeI,GAAG,CAAC,iBAAiBA,GAAG,CAACL,OAAOZ,WAAW,CAAA;AAC9E,oBAAA,IAAI,CAACA,WAAAA,EAAa;wBAChB,MAAM,IAAIgB,MAAM,CAAC,cAAc,EAAEJ,MAAAA,CAAOZ,WAAW,CAAC,WAAW,CAAC,CAAA;AAClE,oBAAA;;AAGA,oBAAA,OAAOW,yBAAAA,CAA0B;AAAE,wBAAA,GAAGC,MAAM;AAAEb,wBAAAA,IAAAA,EAAMC,YAAYD;AAAK,qBAAA,CAAA;AACvE,gBAAA;gBAEA,MAAM,EAAEA,IAAI,EAAE,GAAGD,SAAAA;AAEjB,gBAAA,MAAM,IAAIkB,KAAAA,CAAM,CAAC,4BAA4B,EAAEjB,IAAAA,CAAAA,CAAM,CAAA;AACvD,YAAA;AACF;AACF;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.mjs","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 { 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 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(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 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(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 = (attribute: Schema.Attribute.AnyAttribute): 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(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(attribute);\n case 'relation':\n return attributes.relationToSchema(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 strapiInstance = global.strapi;\n if (!strapiInstance) {\n throw new Error('Strapi instance not available for custom field conversion');\n }\n\n const customField = strapiInstance.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({ ...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 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 strapiInstance = global.strapi;\n if (!strapiInstance) {\n throw new Error('Strapi instance not available for custom field conversion');\n }\n\n const customField = strapiInstance.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({ ...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","attributes","reduce","acc","name","extend","mapAttributeToSchema","z","object","createAttributesInputSchema","mapAttributeToInputSchema","attrCF","strapiInstance","global","strapi","Error","get"],"mappings":";;;AAWA,MAAMA,yBAAyB,CAC7BC,SAAAA,GAAAA;AAEA,IAAA,OACE,CAAC,CAACA,SACF,IAAA,OAAOA,cAAc,QACrB,IAACA,SAAkBC,CAAAA,IAAI,KAAK,aAC5B,IAAA,OAAO,SAACD,CAAkBE,WAAW,KAAK,QAAA;AAE9C,CAAA;AAEA;;;;;;;;;;;;;;;;IAiBaC,MAAAA,sBAAAA,GAAyB,CACpCC,UAAAA,GAAAA;AAEA,IAAA,OAAOA,WAAWC,MAAM,CAAC,CAACC,GAAK,EAAA,CAACC,MAAMP,SAAU,CAAA,GAAA;QAC9C,OAAOM,GAAAA,CAAIE,MAAM,CAAC;YAChB,KAAKD,MAAQ,GAAA;AACX,gBAAA,OAAOE,oBAAqBT,CAAAA,SAAAA,CAA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AAAA;QACtC,KAAK,WAAA;YACH,OAAOI,sBAAiC,CAACJ,SAAAA,CAAAA;QAC3C,KAAK,KAAA;YACH,OAAOI,gBAA2B,CAACJ,SAAAA,CAAAA;AACrC,QAAA;AAAS,YAAA;AACP,gBAAA,IAAID,uBAAuBC,SAAY,CAAA,EAAA;AACrC,oBAAA,MAAMc,MAASd,GAAAA,SAAAA;oBACf,MAAMe,cAAAA,GAAiBC,OAAOC,MAAM;AACpC,oBAAA,IAAI,CAACF,cAAgB,EAAA;AACnB,wBAAA,MAAM,IAAIG,KAAM,CAAA,2DAAA,CAAA;AAClB;oBAEA,MAAMhB,WAAAA,GAAca,eAAeI,GAAG,CAAC,iBAAiBA,GAAG,CAACL,OAAOZ,WAAW,CAAA;AAC9E,oBAAA,IAAI,CAACA,WAAa,EAAA;wBAChB,MAAM,IAAIgB,MAAM,CAAC,cAAc,EAAEJ,MAAOZ,CAAAA,WAAW,CAAC,WAAW,CAAC,CAAA;AAClE;;AAGA,oBAAA,OAAOW,yBAA0B,CAAA;AAAE,wBAAA,GAAGC,MAAM;AAAEb,wBAAAA,IAAAA,EAAMC,YAAYD;AAAK,qBAAA,CAAA;AACvE;gBAEA,MAAM,EAAEA,IAAI,EAAE,GAAGD,SAAAA;AAEjB,gBAAA,MAAM,IAAIkB,KAAAA,CAAM,CAAC,4BAA4B,EAAEjB,IAAM,CAAA,CAAA,CAAA;AACvD;AACF;AACF;;;;"}
1
+ {"version":3,"file":"mappers.mjs","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 { 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 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(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 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(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 = (attribute: Schema.Attribute.AnyAttribute): 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(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(attribute);\n case 'relation':\n return attributes.relationToSchema(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 strapiInstance = global.strapi;\n if (!strapiInstance) {\n throw new Error('Strapi instance not available for custom field conversion');\n }\n\n const customField = strapiInstance.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({ ...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 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 strapiInstance = global.strapi;\n if (!strapiInstance) {\n throw new Error('Strapi instance not available for custom field conversion');\n }\n\n const customField = strapiInstance.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({ ...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","attributes","reduce","acc","name","extend","mapAttributeToSchema","z","object","createAttributesInputSchema","mapAttributeToInputSchema","attrCF","strapiInstance","global","strapi","Error","get"],"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;;;;;;;;;;;;;;;;IAiBO,MAAMC,sBAAAA,GAAyB,CACpCC,UAAAA,GAAAA;AAEA,IAAA,OAAOA,WAAWC,MAAM,CAAC,CAACC,GAAAA,EAAK,CAACC,MAAMP,SAAAA,CAAU,GAAA;QAC9C,OAAOM,GAAAA,CAAIE,MAAM,CAAC;YAChB,KAAKD,MAAK,GAAG;AACX,gBAAA,OAAOE,oBAAAA,CAAqBT,SAAAA,CAAAA;AAC9B,YAAA;AACF,SAAA,CAAA;IACF,CAAA,EAAGU,CAAAA,CAAEC,MAAM,CAAC,EAAC,CAAA,CAAA;AACf;AAEA;;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SAAAA,CAAAA;QAC3C,KAAK,KAAA;YACH,OAAOI,gBAA2B,CAACJ,SAAAA,CAAAA;AACrC,QAAA;AAAS,YAAA;AACP,gBAAA,IAAID,uBAAuBC,SAAAA,CAAAA,EAAY;AACrC,oBAAA,MAAMc,MAAAA,GAASd,SAAAA;oBACf,MAAMe,cAAAA,GAAiBC,OAAOC,MAAM;AACpC,oBAAA,IAAI,CAACF,cAAAA,EAAgB;AACnB,wBAAA,MAAM,IAAIG,KAAAA,CAAM,2DAAA,CAAA;AAClB,oBAAA;oBAEA,MAAMhB,WAAAA,GAAca,eAAeI,GAAG,CAAC,iBAAiBA,GAAG,CAACL,OAAOZ,WAAW,CAAA;AAC9E,oBAAA,IAAI,CAACA,WAAAA,EAAa;wBAChB,MAAM,IAAIgB,MAAM,CAAC,cAAc,EAAEJ,MAAAA,CAAOZ,WAAW,CAAC,WAAW,CAAC,CAAA;AAClE,oBAAA;;AAGA,oBAAA,OAAOW,yBAAAA,CAA0B;AAAE,wBAAA,GAAGC,MAAM;AAAEb,wBAAAA,IAAAA,EAAMC,YAAYD;AAAK,qBAAA,CAAA;AACvE,gBAAA;gBAEA,MAAM,EAAEA,IAAI,EAAE,GAAGD,SAAAA;AAEjB,gBAAA,MAAM,IAAIkB,KAAAA,CAAM,CAAC,4BAA4B,EAAEjB,IAAAA,CAAAA,CAAM,CAAA;AACvD,YAAA;AACF;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../src/core-api/routes/validation/utils.ts"],"sourcesContent":["import { transformUidToValidOpenApiName } from '@strapi/utils';\nimport type { 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 = (id: Internal.UID.Schema, schema: z.ZodType) => {\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 // Register the new schema with the transformed ID\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 = (id: Internal.UID.Schema, callback: () => z.ZodType) => {\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 // Built-in schemas keep at debug level to avoid clutter\n strapi.log.debug(`Initializing validation schema for ${transformedId}`);\n } else {\n // User content\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(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(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","id","schema","_idmap","idMap","z","globalRegistry","transformedId","transformUidToValidOpenApiName","isReplacing","has","delete","strapi","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,qBAAwB,GAAA,CAACC,EAAyBC,EAAAA,MAAAA,GAAAA;IAC7D,IAAI;AACF,QAAA,MAAM,EAAEC,MAAQC,EAAAA,KAAK,EAAE,GAAGC,aAAEC,cAAc;AAE1C,QAAA,MAAMC,gBAAgBC,0CAA+BP,CAAAA,EAAAA,CAAAA;QAErD,MAAMQ,WAAAA,GAAcL,KAAMM,CAAAA,GAAG,CAACH,aAAAA,CAAAA;AAE9B,QAAA,IAAIE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esContent":["import { transformUidToValidOpenApiName } from '@strapi/utils';\nimport type { 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 = (id: Internal.UID.Schema, schema: z.ZodType) => {\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 // Register the new schema with the transformed ID\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 = (id: Internal.UID.Schema, callback: () => z.ZodType) => {\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 // Built-in schemas keep at debug level to avoid clutter\n strapi.log.debug(`Initializing validation schema for ${transformedId}`);\n } else {\n // User content\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(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(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","id","schema","_idmap","idMap","z","globalRegistry","transformedId","transformUidToValidOpenApiName","isReplacing","has","delete","strapi","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,q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ES,UAAAA,CAAW,sBAAsB,EAAEI,UAAAA,CAAW,OAAO,CAAC,CAAA;AAClF,QAAA;QAEA,OAAOzB,MAAAA;AACT,IAAA,CAAA,CAAE,OAAOc,KAAAA,EAAO;AACdJ,QAAAA,MAAAA,CAAOC,GAAG,CAACG,KAAK,CAAC,CAAC,gDAAgD,EAAEf,EAAAA,CAAAA,CAAI,CAAA;QAExE,MAAMe,KAAAA;AACR,IAAA;AACF;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../../../src/core-api/routes/validation/utils.ts"],"sourcesContent":["import { transformUidToValidOpenApiName } from '@strapi/utils';\nimport type { 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 = (id: Internal.UID.Schema, schema: z.ZodType) => {\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 // Register the new schema with the transformed ID\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 = (id: Internal.UID.Schema, callback: () => z.ZodType) => {\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 // Built-in schemas keep at debug level to avoid clutter\n strapi.log.debug(`Initializing validation schema for ${transformedId}`);\n } else {\n // User content\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(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(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","id","schema","_idmap","idMap","z","globalRegistry","transformedId","transformUidToValidOpenApiName","isReplacing","has","delete","strapi","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,qBAAwB,GAAA,CAACC,EAAyBC,EAAAA,MAAAA,GAAAA;IAC7D,IAAI;AACF,QAAA,MAAM,EAAEC,MAAQC,EAAAA,KAAK,EAAE,GAAGC,EAAEC,cAAc;AAE1C,QAAA,MAAMC,gBAAgBC,8BAA+BP,CAAAA,EAAAA,CAAAA;QAErD,MAAMQ,WAAAA,GAAcL,KAAMM,CAAAA,GAAG,CAACH,aAAAA,CAAAA;AAE9B,QAAA,IAAIE,WAAa,EAAA;;AAEfL,YAAAA,KAAAA,CAAMO,MAAM,CAACJ,aAAAA,CAAAA;AACf;;AAGAK,QAAAA,MAAAA,CAAOC,GAAG,CAACC,KAAK,CACd,CAAGL,EAAAA,WAAAA,GAAc,WAAc,GAAA,aAAA,CAAc,QAAQ,EAAEF,aAAc,CAAA,mBAAmB,CAAC,CAAA;AAE3FF,QAAAA,CAAAA,CAAEC,cAAc,CAACS,GAAG,CAACb,MAAQ,EAAA;YAAED,EAAIM,EAAAA;AAAc,SAAA,CAAA;AACnD,KAAA,CAAE,OAAOS,KAAO,EAAA;QACdJ,MAAOC,CAAAA,GAAG,CAACG,KAAK,CACd,CAAC,sDAAsD,EAAEf,EAAG,CAAA,mBAAmB,CAAC,CAAA;QAGlF,MAAMe,KAAAA;AACR;AACF;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BC,IACM,MAAMC,kBAAqB,GAAA,CAAChB,EAAyBiB,EAAAA,QAAAA,GAAAA;IA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AAS,IAAA,EAAIC,CAAAA,CAAAA,MAAM,IAAI,CAAA;AAC7E,YAAA,MAAMT,UAAahB,GAAAA,aAAAA,CAChBiB,OAAO,CAAC,YAAY,EACpBA,CAAAA,CAAAA,OAAO,CAAC,OAAA,EAAS,EACjBA,CAAAA,CAAAA,OAAO,CAAC,UAAA,EAAY,OACpBC,IAAI,EAAA;AACPb,YAAAA,MAAAA,CAAOC,GAAG,CAACC,KAAK,CAAC,CAAC,MAAM,EAAES,UAAAA,CAAW,sBAAsB,EAAEI,UAAW,CAAA,OAAO,CAAC,CAAA;AAClF;QAEA,OAAOzB,MAAAA;AACT,KAAA,CAAE,OAAOc,KAAO,EAAA;AACdJ,QAAAA,MAAAA,CAAOC,GAAG,CAACG,KAAK,CAAC,CAAC,gDAAgD,EAAEf,EAAI,CAAA,CAAA,CAAA;QAExE,MAAMe,KAAAA;AACR;AACF;;;;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../../../src/core-api/routes/validation/utils.ts"],"sourcesContent":["import { transformUidToValidOpenApiName } from '@strapi/utils';\nimport type { 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 = (id: Internal.UID.Schema, schema: z.ZodType) => {\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 // Register the new schema with the transformed ID\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 = (id: Internal.UID.Schema, callback: () => z.ZodType) => {\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 // Built-in schemas keep at debug level to avoid clutter\n strapi.log.debug(`Initializing validation schema for ${transformedId}`);\n } else {\n // User content\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(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(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","id","schema","_idmap","idMap","z","globalRegistry","transformedId","transformUidToValidOpenApiName","isReplacing","has","delete","strapi","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,CAACC,EAAAA,EAAyBC,MAAAA,GAAAA;IAC7D,IAAI;AACF,QAAA,MAAM,EAAEC,MAAAA,EAAQC,KAAK,EAAE,GAAGC,EAAEC,cAAc;AAE1C,QAAA,MAAMC,gBAAgBC,8BAAAA,CAA+BP,EAAAA,CAAAA;QAErD,MAAMQ,WAAAA,GAAcL,KAAAA,CAAMM,GAAG,CAACH,aAAAA,CAAAA;AAE9B,QAAA,IAAIE,WAAAA,EAAa;;AAEfL,YAAAA,KAAAA,CAAMO,MAAM,CAACJ,aAAAA,CAAAA;AACf,QAAA;;AAGAK,QAAAA,MAAAA,CAAOC,GAAG,CAACC,KAAK,CACd,CAAA,EAAGL,WAAAA,GAAc,WAAA,GAAc,aAAA,CAAc,QAAQ,EAAEF,aAAAA,CAAc,mBAAmB,CAAC,CAAA;AAE3FF,QAAAA,CAAAA,CAAEC,cAAc,CAACS,GAAG,CAACb,MAAAA,EAAQ;YAAED,EAAAA,EAAIM;AAAc,SAAA,CAAA;AACnD,IAA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vB,qBAAAA,CAAsBC,EAAAA,EAAII,EAAEqB,GAAG,EAAA,CAAA;;AAG/B,QAAA,MAAMxB,MAAAA,GAASgB,QAAAA,EAAAA;;AAGflB,QAAAA,qBAAAA,CAAsBC,EAAAA,EAAIC,MAAAA,CAAAA;;AAG1B,QAAA,IAAI,CAACmB,eAAAA,EAAiB;YACpB,MAAMM,UAAAA,GAAaC,MAAAA,CAAOC,IAAI,CAAE3B,MAAAA,EAAgB4B,IAAAA,EAAMC,KAAAA,IAAS,EAAC,CAAA,CAAGC,MAAM,IAAI,CAAA;AAC7E,YAAA,MAAMT,UAAAA,GAAahB,aAAAA,CAChBiB,OAAO,CAAC,YAAY,EAAA,CAAA,CACpBA,OAAO,CAAC,OAAA,EAAS,EAAA,CAAA,CACjBA,OAAO,CAAC,UAAA,EAAY,OACpBC,IAAI,EAAA;AACPb,YAAAA,MAAAA,CAAOC,GAAG,CAACC,KAAK,CAAC,CAAC,MAAM,EAAES,UAAAA,CAAW,sBAAsB,EAAEI,UAAAA,CAAW,OAAO,CAAC,CAAA;AAClF,QAAA;QAEA,OAAOzB,MAAAA;AACT,IAAA,CAAA,CAAE,OAAOc,KAAAA,EAAO;AACdJ,QAAAA,MAAAA,CAAOC,GAAG,CAACG,KAAK,CAAC,CAAC,gDAAgD,EAAEf,EAAAA,CAAAA,CAAI,CAAA;QAExE,MAAMe,KAAAA;AACR,IAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"collection-type.js","sources":["../../../src/core-api/service/collection-type.ts"],"sourcesContent":["import type { Core, Struct, Modules } from '@strapi/types';\n\nimport {\n getPaginationInfo,\n shouldCount,\n isPagedPagination,\n transformPaginationResponse,\n} from './pagination';\n\nimport { CoreService } from './core-service';\n\nexport class CollectionTypeService\n extends CoreService\n implements Core.CoreAPI.Service.CollectionType\n{\n private contentType: Struct.CollectionTypeSchema;\n\n constructor(contentType: Struct.CollectionTypeSchema) {\n super();\n\n this.contentType = contentType;\n }\n\n async find(params = {}) {\n const { uid } = this.contentType;\n\n const fetchParams = this.getFetchParams(params);\n\n const paginationInfo = getPaginationInfo(fetchParams);\n const isPaged = isPagedPagination(fetchParams.pagination);\n\n const results = await strapi.documents(uid).findMany({\n ...fetchParams,\n ...paginationInfo,\n });\n\n if (shouldCount(fetchParams)) {\n const count = await strapi.documents(uid).count({ ...fetchParams, ...paginationInfo });\n\n if (typeof count !== 'number') {\n throw new Error('Count should be a number');\n }\n\n return {\n results,\n pagination: transformPaginationResponse(paginationInfo, count, isPaged),\n };\n }\n\n return {\n results,\n pagination: transformPaginationResponse(paginationInfo, undefined, isPaged),\n };\n }\n\n findOne(documentId: Modules.Documents.ID, params = {}) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).findOne({\n ...this.getFetchParams(params),\n documentId,\n });\n }\n\n async create(params = { data: {} }) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).create(this.getFetchParams(params));\n }\n\n update(documentId: Modules.Documents.ID, params = { data: {} }) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).update({\n ...this.getFetchParams(params),\n documentId,\n });\n }\n\n async delete(documentId: Modules.Documents.ID, params = {}) {\n const { uid } = this.contentType;\n\n const { entries } = await strapi.documents(uid).delete({\n ...this.getFetchParams(params),\n documentId,\n });\n\n return { deletedEntries: entries.length };\n }\n}\n\n/**\n *\n * Returns a collection type service to handle default core-api actions\n */\n\nconst createCollectionTypeService = (\n contentType: Struct.CollectionTypeSchema\n): Core.CoreAPI.Service.CollectionType => {\n return new CollectionTypeService(contentType);\n};\n\nexport { createCollectionTypeService };\n"],"names":["CollectionTypeService","CoreService","find","params","uid","contentType","fetchParams","getFetchParams","paginationInfo","getPaginationInfo","isPaged","isPagedPagination","pagination","results","strapi","documents","findMany","shouldCount","count","Error","transformPaginationResponse","undefined","findOne","documentId","create","data","update","delete","entries","deletedEntries","length","createCollectionTypeService"],"mappings":";;;;;AAWO,MAAMA,qBACHC,SAAAA,uBAAAA,CAAAA;AAWR,IAAA,MAAMC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ClC1B,WAAAA,GAAAA;AAEA,IAAA,OAAO,IAAIL,qBAAsBK,CAAAA,WAAAA,CAAAA;AACnC;;;;;"}
1
+ {"version":3,"file":"collection-type.js","sources":["../../../src/core-api/service/collection-type.ts"],"sourcesContent":["import type { Core, Struct, Modules } from '@strapi/types';\n\nimport {\n getPaginationInfo,\n shouldCount,\n isPagedPagination,\n transformPaginationResponse,\n} from './pagination';\n\nimport { CoreService } from './core-service';\n\nexport class CollectionTypeService\n extends CoreService\n implements Core.CoreAPI.Service.CollectionType\n{\n private contentType: Struct.CollectionTypeSchema;\n\n constructor(contentType: Struct.CollectionTypeSchema) {\n super();\n\n this.contentType = contentType;\n }\n\n async find(params = {}) {\n const { uid } = this.contentType;\n\n const fetchParams = this.getFetchParams(params);\n\n const paginationInfo = getPaginationInfo(fetchParams);\n const isPaged = isPagedPagination(fetchParams.pagination);\n\n const results = await strapi.documents(uid).findMany({\n ...fetchParams,\n ...paginationInfo,\n });\n\n if (shouldCount(fetchParams)) {\n const count = await strapi.documents(uid).count({ ...fetchParams, ...paginationInfo });\n\n if (typeof count !== 'number') {\n throw new Error('Count should be a number');\n }\n\n return {\n results,\n pagination: transformPaginationResponse(paginationInfo, count, isPaged),\n };\n }\n\n return {\n results,\n pagination: transformPaginationResponse(paginationInfo, undefined, isPaged),\n };\n }\n\n findOne(documentId: Modules.Documents.ID, params = {}) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).findOne({\n ...this.getFetchParams(params),\n documentId,\n });\n }\n\n async create(params = { data: {} }) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).create(this.getFetchParams(params));\n }\n\n update(documentId: Modules.Documents.ID, params = { data: {} }) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).update({\n ...this.getFetchParams(params),\n documentId,\n });\n }\n\n async delete(documentId: Modules.Documents.ID, params = {}) {\n const { uid } = this.contentType;\n\n const { entries } = await strapi.documents(uid).delete({\n ...this.getFetchParams(params),\n documentId,\n });\n\n return { deletedEntries: entries.length };\n }\n}\n\n/**\n *\n * Returns a collection type service to handle default core-api actions\n */\n\nconst createCollectionTypeService = (\n contentType: Struct.CollectionTypeSchema\n): Core.CoreAPI.Service.CollectionType => {\n return new CollectionTypeService(contentType);\n};\n\nexport { createCollectionTypeService };\n"],"names":["CollectionTypeService","CoreService","find","params","uid","contentType","fetchParams","getFetchParams","paginationInfo","getPaginationInfo","isPaged","isPagedPagination","pagination","results","strapi","documents","findMany","shouldCount","count","Error","transformPaginationResponse","undefined","findOne","documentId","create","data","update","delete","entries","deletedEntries","length","createCollectionTypeService"],"mappings":";;;;;AAWO,MAAMA,qBAAAA,SACHC,uBAAAA,CAAAA;AAWR,IAAA,MAAMC,IAAAA,CAAKC,MAAAA,GAAS,EAAE,EAAE;AACtB,QAAA,MAAM,EAAEC,GAAG,EAAE,GAAG,IAAI,CAACC,WAAW;AAEhC,QAAA,MAAMC,WAAAA,GAAc,IAAI,CAACC,cAAc,CAACJ,MAAAA,CAAAA;AAExC,QAAA,MAAMK,iBAAiBC,4BAAAA,CAAkBH,WAAAA,CAAAA;QACzC,MAAMI,OAAAA,GAAUC,4BAAAA,CAAkBL,WAAAA,CAAYM,UAAU,CAAA;AAExD,QAAA,MAAMC,UAAU,MAAMC,MAAAA,CAAOC,SAAS,CAACX,GAAAA,CAAAA,CAAKY,QAAQ,CAAC;AACnD,YAAA,GAAGV,WAAW;AACd,YAAA,GAAGE;AACL,SAAA,CAAA;AAEA,QAAA,IAAIS,uBAAYX,WAAAA,CAAAA,EAAc;AAC5B,YAAA,MAAMY,QAAQ,MAAMJ,MAAAA,CAAOC,SAAS,CAACX,GAAAA,CAAAA,CAAKc,KAAK,CAAC;AAAE,gBAAA,GAAGZ,WAAW;AAAE,gBAAA,GAAGE;AAAe,aAAA,CAAA;YAEpF,IAAI,OAAOU,UAAU,QAAA,EAAU;AAC7B,gBAAA,MAAM,IAAIC,KAAAA,CAAM,0BAAA,CAAA;AAClB,YAAA;YAEA,OAAO;AACLN,gBAAAA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EAAE,EAAE;AAC1D,QAAA,MAAM,EAAEC,GAAG,EAAE,GAAG,IAAI,CAACC,WAAW;QAEhC,MAAM,EAAEuB,OAAO,EAAE,GAAG,MAAMd,OAAOC,SAAS,CAACX,GAAAA,CAAAA,CAAKuB,MAAM,CAAC;AACrD,YAAA,GAAG,IAAI,CAACpB,cAAc,CAACJ,MAAAA,CAAO;AAC9BoB,YAAAA;AACF,SAAA,CAAA;QAEA,OAAO;AAAEM,YAAAA,cAAAA,EAAgBD,QAAQE;AAAO,SAAA;AAC1C,IAAA;AAvEA,IAAA,WAAA,CAAYzB,WAAwC,CAAE;QACpD,KAAK,EAAA;QAEL,IAAI,CAACA,WAAW,GAAGA,WAAAA;AACrB,IAAA;AAoEF;AAEA;;;IAKA,MAAM0B,8BAA8B,CAClC1B,WAAAA,GAAAA;AAEA,IAAA,OAAO,IAAIL,qBAAAA,CAAsBK,WAAAA,CAAAA;AACnC;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"collection-type.mjs","sources":["../../../src/core-api/service/collection-type.ts"],"sourcesContent":["import type { Core, Struct, Modules } from '@strapi/types';\n\nimport {\n getPaginationInfo,\n shouldCount,\n isPagedPagination,\n transformPaginationResponse,\n} from './pagination';\n\nimport { CoreService } from './core-service';\n\nexport class CollectionTypeService\n extends CoreService\n implements Core.CoreAPI.Service.CollectionType\n{\n private contentType: Struct.CollectionTypeSchema;\n\n constructor(contentType: Struct.CollectionTypeSchema) {\n super();\n\n this.contentType = contentType;\n }\n\n async find(params = {}) {\n const { uid } = this.contentType;\n\n const fetchParams = this.getFetchParams(params);\n\n const paginationInfo = getPaginationInfo(fetchParams);\n const isPaged = isPagedPagination(fetchParams.pagination);\n\n const results = await strapi.documents(uid).findMany({\n ...fetchParams,\n ...paginationInfo,\n });\n\n if (shouldCount(fetchParams)) {\n const count = await strapi.documents(uid).count({ ...fetchParams, ...paginationInfo });\n\n if (typeof count !== 'number') {\n throw new Error('Count should be a number');\n }\n\n return {\n results,\n pagination: transformPaginationResponse(paginationInfo, count, isPaged),\n };\n }\n\n return {\n results,\n pagination: transformPaginationResponse(paginationInfo, undefined, isPaged),\n };\n }\n\n findOne(documentId: Modules.Documents.ID, params = {}) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).findOne({\n ...this.getFetchParams(params),\n documentId,\n });\n }\n\n async create(params = { data: {} }) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).create(this.getFetchParams(params));\n }\n\n update(documentId: Modules.Documents.ID, params = { data: {} }) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).update({\n ...this.getFetchParams(params),\n documentId,\n });\n }\n\n async delete(documentId: Modules.Documents.ID, params = {}) {\n const { uid } = this.contentType;\n\n const { entries } = await strapi.documents(uid).delete({\n ...this.getFetchParams(params),\n documentId,\n });\n\n return { deletedEntries: entries.length };\n }\n}\n\n/**\n *\n * Returns a collection type service to handle default core-api actions\n */\n\nconst createCollectionTypeService = (\n contentType: Struct.CollectionTypeSchema\n): Core.CoreAPI.Service.CollectionType => {\n return new CollectionTypeService(contentType);\n};\n\nexport { createCollectionTypeService };\n"],"names":["CollectionTypeService","CoreService","find","params","uid","contentType","fetchParams","getFetchParams","paginationInfo","getPaginationInfo","isPaged","isPagedPagination","pagination","results","strapi","documents","findMany","shouldCount","count","Error","transformPaginationResponse","undefined","findOne","documentId","create","data","update","delete","entries","deletedEntries","length","createCollectionTypeService"],"mappings":";;;AAWO,MAAMA,qBACHC,SAAAA,WAAAA,CAAAA;AAWR,IAAA,MAAMC,IAAKC,CAAAA,MAAAA,GAAS,EAAE,EAAE;AACtB,QAAA,MAAM,EAAEC,GAAG,EAAE,GAAG,IAAI,CAACC,WAAW;AAEhC,QAAA,MAAMC,WAAc,GAAA,IAAI,CAACC,cAAc,CAACJ,MAAAA,CAAAA;AAExC,QAAA,MAAMK,iBAAiBC,iBAAkBH,CAAAA,WAAAA,CAAAA;QACzC,MAAMI,OAAAA,GAAUC,iBAAkBL,CAAAA,WAAAA,CAAYM,UAA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,CAAC,IAAI,CAACjB,cAAc,CAACJ,MAAAA,CAAAA,CAAAA;AAC1D;IAEAuB,MAAOH,CAAAA,UAAgC,EAAEpB,MAAS,GAAA;AAAEsB,QAAAA,IAAAA,EAAM;AAAG,KAAC,EAAE;AAC9D,QAAA,MAAM,EAAErB,GAAG,EAAE,GAAG,IAAI,CAACC,WAAW;AAEhC,QAAA,OAAOS,MAAOC,CAAAA,SAAS,CAACX,GAAAA,CAAAA,CAAKsB,MAAM,CAAC;AAClC,YAAA,GAAG,IAAI,CAACnB,cAAc,CAACJ,MAAO,CAAA;AAC9BoB,YAAAA;AACF,SAAA,CAAA;AACF;AAEA,IAAA,MAAMI,OAAOJ,UAAgC,EAAEpB,MAAS,GAAA,EAAE,EAAE;AAC1D,QAAA,MAAM,EAAEC,GAAG,EAAE,GAAG,IAAI,CAACC,WAAW;QAEhC,MAAM,EAAEuB,OAAO,EAAE,GAAG,MAAMd,OAAOC,SAAS,CAACX,GAAKuB,CAAAA,CAAAA,MAAM,CAAC;AACrD,YAAA,GAAG,IAAI,CAACpB,cAAc,CAACJ,MAAO,CAAA;AAC9BoB,YAAAA;AACF,SAAA,CAAA;QAEA,OAAO;AAAEM,YAAAA,cAAAA,EAAgBD,QAAQE;AAAO,SAAA;AAC1C;AAvEA,IAAA,WAAA,CAAYzB,WAAwC,CAAE;QACpD,KAAK,EAAA;QAEL,IAAI,CAACA,WAAW,GAAGA,WAAAA;AACrB;AAoEF;AAEA;;;IAKA,MAAM0B,8BAA8B,CAClC1B,WAAAA,GAAAA;AAEA,IAAA,OAAO,IAAIL,qBAAsBK,CAAAA,WAAAA,CAAAA;AACnC;;;;"}
1
+ {"version":3,"file":"collection-type.mjs","sources":["../../../src/core-api/service/collection-type.ts"],"sourcesContent":["import type { Core, Struct, Modules } from '@strapi/types';\n\nimport {\n getPaginationInfo,\n shouldCount,\n isPagedPagination,\n transformPaginationResponse,\n} from './pagination';\n\nimport { CoreService } from './core-service';\n\nexport class CollectionTypeService\n extends CoreService\n implements Core.CoreAPI.Service.CollectionType\n{\n private contentType: Struct.CollectionTypeSchema;\n\n constructor(contentType: Struct.CollectionTypeSchema) {\n super();\n\n this.contentType = contentType;\n }\n\n async find(params = {}) {\n const { uid } = this.contentType;\n\n const fetchParams = this.getFetchParams(params);\n\n const paginationInfo = getPaginationInfo(fetchParams);\n const isPaged = isPagedPagination(fetchParams.pagination);\n\n const results = await strapi.documents(uid).findMany({\n ...fetchParams,\n ...paginationInfo,\n });\n\n if (shouldCount(fetchParams)) {\n const count = await strapi.documents(uid).count({ ...fetchParams, ...paginationInfo });\n\n if (typeof count !== 'number') {\n throw new Error('Count should be a number');\n }\n\n return {\n results,\n pagination: transformPaginationResponse(paginationInfo, count, isPaged),\n };\n }\n\n return {\n results,\n pagination: transformPaginationResponse(paginationInfo, undefined, isPaged),\n };\n }\n\n findOne(documentId: Modules.Documents.ID, params = {}) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).findOne({\n ...this.getFetchParams(params),\n documentId,\n });\n }\n\n async create(params = { data: {} }) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).create(this.getFetchParams(params));\n }\n\n update(documentId: Modules.Documents.ID, params = { data: {} }) {\n const { uid } = this.contentType;\n\n return strapi.documents(uid).update({\n ...this.getFetchParams(params),\n documentId,\n });\n }\n\n async delete(documentId: Modules.Documents.ID, params = {}) {\n const { uid } = this.contentType;\n\n const { entries } = await strapi.documents(uid).delete({\n ...this.getFetchParams(params),\n documentId,\n });\n\n return { deletedEntries: entries.length };\n }\n}\n\n/**\n *\n * Returns a collection type service to handle default core-api actions\n */\n\nconst createCollectionTypeService = (\n contentType: Struct.CollectionTypeSchema\n): Core.CoreAPI.Service.CollectionType => {\n return new CollectionTypeService(contentType);\n};\n\nexport { createCollectionTypeService };\n"],"names":["CollectionTypeService","CoreService","find","params","uid","contentType","fetchParams","getFetchParams","paginationInfo","getPaginationInfo","isPaged","isPagedPagination","pagination","results","strapi","documents","findMany","shouldCount","count","Error","transformPaginationResponse","undefined","findOne","documentId","create","data","update","delete","entries","deletedEntries","length","createCollectionTypeService"],"mappings":";;;AAWO,MAAMA,qBAAAA,SACHC,WAAAA,CAAAA;AAWR,IAAA,MAAMC,IAAAA,CAAKC,MAAAA,GAAS,EAAE,EAAE;AACtB,QAAA,MAAM,EAAEC,GAAG,EAAE,GAAG,IAAI,CAACC,WAAW;AAEhC,QAAA,MAAMC,WAAAA,GAAc,IAAI,CAACC,cAAc,CAACJ,MAAAA,CAAAA;AAExC,QAAA,MAAMK,iBAAiBC,iBAAAA,CAAkBH,WAAAA,CAAAA;QACzC,MAAMI,OAAAA,GAAUC,iBAAAA,CAAkBL,WAAAA,CAAYM,UAAU,CAAA;AAExD,QAAA,MAAMC,UAAU,MAAMC,MAAAA,CAAOC,SAAS,CAACX,GAAAA,CAAAA,CAAKY,QAAQ,CAAC;AACnD,YAAA,GAAGV,WAAW;AACd,YAAA,GAAGE;AACL,SAAA,CAAA;AAEA,QAAA,IAAIS,YAAYX,WAAAA,CAAAA,EAAc;AAC5B,YAAA,MAAMY,QAAQ,MAAMJ,MAAAA,CAAOC,SAAS,CAACX,GAAAA,CAAAA,CAAKc,KAAK,CAAC;AAAE,gBAAA,GAAGZ,WAAW;AAAE,gBAAA,GAAGE;AAAe,aAAA,CAAA;YAEpF,IAAI,OAAOU,UAAU,QAAA,EAAU;AAC7B,gBAAA,MAAM,IAAIC,KAAAA,CAAM,0BAAA,CAAA;AAClB,YAAA;YAEA,OAAO;AACLN,gBAAAA,OAAAA;gBACAD,UAAAA,EAAYQ,2BAAAA,CAA4BZ,gBAAgBU,KAAAA,EAAOR,OAAAA;AACjE,aAAA;AACF,QAAA;QAEA,OAAO;AACLG,YAAAA,OAAAA;YACAD,UAAAA,EAAYQ,2BAAAA,CAA4BZ,gBAAgBa,SAAAA,EAAWX,OAAAA;AACrE,SAAA;AACF,IAAA;AAEAY,IAAAA,OAAAA,CAAQC,UAAgC,EAAEpB,MAAAA,GAAS,EAAE,EAAE;AAC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AAgBD,QAAQE;AAAO,SAAA;AAC1C,IAAA;AAvEA,IAAA,WAAA,CAAYzB,WAAwC,CAAE;QACpD,KAAK,EAAA;QAEL,IAAI,CAACA,WAAW,GAAGA,WAAAA;AACrB,IAAA;AAoEF;AAEA;;;IAKA,MAAM0B,8BAA8B,CAClC1B,WAAAA,GAAAA;AAEA,IAAA,OAAO,IAAIL,qBAAAA,CAAsBK,WAAAA,CAAAA;AACnC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"core-service.js","sources":["../../../src/core-api/service/core-service.ts"],"sourcesContent":["export abstract class CoreService {\n getFetchParams(params = {}): any {\n return {\n status: 'published',\n ...params,\n };\n }\n}\n"],"names":["CoreService","getFetchParams","params","status"],"mappings":";;AAAO,MAAeA,WAAAA,CAAAA;IACpBC,cAAeC,CAAAA,MAAAA,GAAS,EAAE,EAAO;QAC/B,OAAO;YACLC,MAAQ,EAAA,WAAA;AACR,YAAA,GAAGD;AACL,SAAA;AACF;AACF;;;;"}
1
+ {"version":3,"file":"core-service.js","sources":["../../../src/core-api/service/core-service.ts"],"sourcesContent":["export abstract class CoreService {\n getFetchParams(params = {}): any {\n return {\n status: 'published',\n ...params,\n };\n }\n}\n"],"names":["CoreService","getFetchParams","params","status"],"mappings":";;AAAO,MAAeA,WAAAA,CAAAA;IACpBC,cAAAA,CAAeC,MAAAA,GAAS,EAAE,EAAO;QAC/B,OAAO;YACLC,MAAAA,EAAQ,WAAA;AACR,YAAA,GAAGD;AACL,SAAA;AACF,IAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"core-service.mjs","sources":["../../../src/core-api/service/core-service.ts"],"sourcesContent":["export abstract class CoreService {\n getFetchParams(params = {}): any {\n return {\n status: 'published',\n ...params,\n };\n }\n}\n"],"names":["CoreService","getFetchParams","params","status"],"mappings":"AAAO,MAAeA,WAAAA,CAAAA;IACpBC,cAAeC,CAAAA,MAAAA,GAAS,EAAE,EAAO;QAC/B,OAAO;YACLC,MAAQ,EAAA,WAAA;AACR,YAAA,GAAGD;AACL,SAAA;AACF;AACF;;;;"}
1
+ {"version":3,"file":"core-service.mjs","sources":["../../../src/core-api/service/core-service.ts"],"sourcesContent":["export abstract class CoreService {\n getFetchParams(params = {}): any {\n return {\n status: 'published',\n ...params,\n };\n }\n}\n"],"names":["CoreService","getFetchParams","params","status"],"mappings":"AAAO,MAAeA,WAAAA,CAAAA;IACpBC,cAAAA,CAAeC,MAAAA,GAAS,EAAE,EAAO;QAC/B,OAAO;YACLC,MAAAA,EAAQ,WAAA;AACR,YAAA,GAAGD;AACL,SAAA;AACF,IAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/core-api/service/index.ts"],"sourcesContent":["import { contentTypes as contentTypeUtils } from '@strapi/utils';\nimport type { Core, Struct } from '@strapi/types';\n\nimport { createSingleTypeService } from './single-type';\nimport { createCollectionTypeService } from './collection-type';\n\nconst isSingleType = (\n contentType: Struct.ContentTypeSchema\n): contentType is Struct.SingleTypeSchema => contentTypeUtils.isSingleType(contentType);\n\n/**\n * Returns a core api for the provided model\n */\nfunction createService<T extends Struct.SingleTypeSchema | Struct.CollectionTypeSchema>(opts: {\n contentType: T;\n}): T extends Struct.SingleTypeSchema\n ? Core.CoreAPI.Service.SingleType\n : Core.CoreAPI.Service.CollectionType;\nfunction createService({\n contentType,\n}: {\n contentType: Struct.CollectionTypeSchema | Struct.SingleTypeSchema;\n}): Core.CoreAPI.Service.SingleType | Core.CoreAPI.Service.CollectionType {\n if (isSingleType(contentType)) {\n return createSingleTypeService(contentType);\n }\n\n return createCollectionTypeService(contentType);\n}\n\nexport { createService };\n"],"names":["isSingleType","contentType","contentTypeUtils","createService","createSingleTypeService","createCollectionTypeService"],"mappings":";;;;;;AAMA,MAAMA,YAAe,GAAA,CACnBC,WAC2CC,GAAAA,wBAAAA,CAAiBF,YAAY,CAACC,WAAAA,CAAAA;AAU3E,SAASE,aAAAA,CAAc,EACrBF,WAAW,EAGZ,EAAA;AACC,IAAA,IAAID,aAAaC,WAAc,CAAA,EAAA;AAC7B,QAAA,OAAOG,kCAAwBH,CAAAA,WAAAA,CAAAA;AACjC;AAEA,IAAA,OAAOI,0CAA4BJ,CAAAA,WAAAA,CAAAA;AACrC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/core-api/service/index.ts"],"sourcesContent":["import { contentTypes as contentTypeUtils } from '@strapi/utils';\nimport type { Core, Struct } from '@strapi/types';\n\nimport { createSingleTypeService } from './single-type';\nimport { createCollectionTypeService } from './collection-type';\n\nconst isSingleType = (\n contentType: Struct.ContentTypeSchema\n): contentType is Struct.SingleTypeSchema => contentTypeUtils.isSingleType(contentType);\n\n/**\n * Returns a core api for the provided model\n */\nfunction createService<T extends Struct.SingleTypeSchema | Struct.CollectionTypeSchema>(opts: {\n contentType: T;\n}): T extends Struct.SingleTypeSchema\n ? Core.CoreAPI.Service.SingleType\n : Core.CoreAPI.Service.CollectionType;\nfunction createService({\n contentType,\n}: {\n contentType: Struct.CollectionTypeSchema | Struct.SingleTypeSchema;\n}): Core.CoreAPI.Service.SingleType | Core.CoreAPI.Service.CollectionType {\n if (isSingleType(contentType)) {\n return createSingleTypeService(contentType);\n }\n\n return createCollectionTypeService(contentType);\n}\n\nexport { createService };\n"],"names":["isSingleType","contentType","contentTypeUtils","createService","createSingleTypeService","createCollectionTypeService"],"mappings":";;;;;;AAMA,MAAMA,YAAAA,GAAe,CACnBC,WAAAA,GAC2CC,wBAAAA,CAAiBF,YAAY,CAACC,WAAAA,CAAAA;AAU3E,SAASE,aAAAA,CAAc,EACrBF,WAAW,EAGZ,EAAA;AACC,IAAA,IAAID,aAAaC,WAAAA,CAAAA,EAAc;AAC7B,QAAA,OAAOG,kCAAAA,CAAwBH,WAAAA,CAAAA;AACjC,IAAA;AAEA,IAAA,OAAOI,0CAAAA,CAA4BJ,WAAAA,CAAAA;AACrC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/core-api/service/index.ts"],"sourcesContent":["import { contentTypes as contentTypeUtils } from '@strapi/utils';\nimport type { Core, Struct } from '@strapi/types';\n\nimport { createSingleTypeService } from './single-type';\nimport { createCollectionTypeService } from './collection-type';\n\nconst isSingleType = (\n contentType: Struct.ContentTypeSchema\n): contentType is Struct.SingleTypeSchema => contentTypeUtils.isSingleType(contentType);\n\n/**\n * Returns a core api for the provided model\n */\nfunction createService<T extends Struct.SingleTypeSchema | Struct.CollectionTypeSchema>(opts: {\n contentType: T;\n}): T extends Struct.SingleTypeSchema\n ? Core.CoreAPI.Service.SingleType\n : Core.CoreAPI.Service.CollectionType;\nfunction createService({\n contentType,\n}: {\n contentType: Struct.CollectionTypeSchema | Struct.SingleTypeSchema;\n}): Core.CoreAPI.Service.SingleType | Core.CoreAPI.Service.CollectionType {\n if (isSingleType(contentType)) {\n return createSingleTypeService(contentType);\n }\n\n return createCollectionTypeService(contentType);\n}\n\nexport { createService };\n"],"names":["isSingleType","contentType","contentTypeUtils","createService","createSingleTypeService","createCollectionTypeService"],"mappings":";;;;AAMA,MAAMA,YAAe,GAAA,CACnBC,WAC2CC,GAAAA,YAAAA,CAAiBF,YAAY,CAACC,WAAAA,CAAAA;AAU3E,SAASE,aAAAA,CAAc,EACrBF,WAAW,EAGZ,EAAA;AACC,IAAA,IAAID,aAAaC,WAAc,CAAA,EAAA;AAC7B,QAAA,OAAOG,uBAAwBH,CAAAA,WAAAA,CAAAA;AACjC;AAEA,IAAA,OAAOI,2BAA4BJ,CAAAA,WAAAA,CAAAA;AACrC;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/core-api/service/index.ts"],"sourcesContent":["import { contentTypes as contentTypeUtils } from '@strapi/utils';\nimport type { Core, Struct } from '@strapi/types';\n\nimport { createSingleTypeService } from './single-type';\nimport { createCollectionTypeService } from './collection-type';\n\nconst isSingleType = (\n contentType: Struct.ContentTypeSchema\n): contentType is Struct.SingleTypeSchema => contentTypeUtils.isSingleType(contentType);\n\n/**\n * Returns a core api for the provided model\n */\nfunction createService<T extends Struct.SingleTypeSchema | Struct.CollectionTypeSchema>(opts: {\n contentType: T;\n}): T extends Struct.SingleTypeSchema\n ? Core.CoreAPI.Service.SingleType\n : Core.CoreAPI.Service.CollectionType;\nfunction createService({\n contentType,\n}: {\n contentType: Struct.CollectionTypeSchema | Struct.SingleTypeSchema;\n}): Core.CoreAPI.Service.SingleType | Core.CoreAPI.Service.CollectionType {\n if (isSingleType(contentType)) {\n return createSingleTypeService(contentType);\n }\n\n return createCollectionTypeService(contentType);\n}\n\nexport { createService };\n"],"names":["isSingleType","contentType","contentTypeUtils","createService","createSingleTypeService","createCollectionTypeService"],"mappings":";;;;AAMA,MAAMA,YAAAA,GAAe,CACnBC,WAAAA,GAC2CC,YAAAA,CAAiBF,YAAY,CAACC,WAAAA,CAAAA;AAU3E,SAASE,aAAAA,CAAc,EACrBF,WAAW,EAGZ,EAAA;AACC,IAAA,IAAID,aAAaC,WAAAA,CAAAA,EAAc;AAC7B,QAAA,OAAOG,uBAAAA,CAAwBH,WAAAA,CAAAA;AACjC,IAAA;AAEA,IAAA,OAAOI,2BAAAA,CAA4BJ,WAAAA,CAAAA;AACrC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","sources":["../../../src/core-api/service/pagination.ts"],"sourcesContent":["import { omit, has, toNumber, isNil } from 'lodash/fp';\n\nimport { errors, pagination } from '@strapi/utils';\n\ninterface BasePaginationParams {\n withCount?: boolean | 't' | '1' | 'true' | 'f' | '0' | 'false' | 0 | 1;\n}\n\ntype PagedPagination = BasePaginationParams & {\n page?: number;\n pageSize?: number;\n};\n\ntype OffsetPagination = BasePaginationParams & {\n start?: number;\n limit?: number;\n};\n\nexport type PaginationParams = PagedPagination | OffsetPagination;\n\ntype PaginationInfo =\n | {\n page: number;\n pageSize: number;\n }\n | {\n start: number;\n limit: number;\n };\n\n/**\n * Default limit values from config\n */\nconst getLimitConfigDefaults = () => ({\n defaultLimit: toNumber(strapi.config.get('api.rest.defaultLimit', 25)),\n maxLimit: toNumber(strapi.config.get('api.rest.maxLimit')) || null,\n});\n\nconst isOffsetPagination = (pagination?: PaginationParams): pagination is OffsetPagination =>\n has('start', pagination) || has('limit', pagination);\n\nconst isPagedPagination = (pagination?: PaginationParams): pagination is PagedPagination =>\n has('page', pagination) || has('pageSize', pagination) || !isOffsetPagination(pagination);\n\nconst shouldCount = (params: { pagination?: PaginationParams }) => {\n if (has('pagination.withCount', params)) {\n const withCount = params.pagination?.withCount;\n\n if (typeof withCount === 'boolean') {\n return withCount;\n }\n\n if (typeof withCount === 'undefined') {\n return false;\n }\n\n if (['true', 't', '1', 1].includes(withCount)) {\n return true;\n }\n\n if (['false', 'f', '0', 0].includes(withCount)) {\n return false;\n }\n\n throw new errors.ValidationError(\n 'Invalid withCount parameter. Expected \"t\",\"1\",\"true\",\"false\",\"0\",\"f\"'\n );\n }\n\n return Boolean(strapi.config.get('api.rest.withCount', true));\n};\n\nconst getPaginationInfo = (params: { pagination?: PaginationParams }): PaginationInfo => {\n const { defaultLimit, maxLimit } = getLimitConfigDefaults();\n\n const { start, limit } = pagination.withDefaultPagination(params.pagination || {}, {\n defaults: { offset: { limit: defaultLimit }, page: { pageSize: defaultLimit } },\n maxLimit: maxLimit || -1,\n });\n\n return { start, limit };\n};\n\nconst transformPaginationResponse = (\n paginationInfo: PaginationInfo,\n total: number | undefined,\n isPaged: boolean\n) => {\n const transform = isPaged\n ? pagination.transformPagedPaginationInfo\n : pagination.transformOffsetPaginationInfo;\n\n const paginationResponse = transform(paginationInfo, total!);\n\n if (isNil(total)) {\n // Ignore total and pageCount if `total` value is not available.\n return omit(['total', 'pageCount'], paginationResponse) as ReturnType<typeof transform>;\n }\n\n return paginationResponse;\n};\n\nexport { isPagedPagination, shouldCount, getPaginationInfo, transformPaginationResponse };\n"],"names":["getLimitConfigDefaults","defaultLimit","toNumber","strapi","config","get","maxLimit","isOffsetPagination","pagination","has","isPagedPagination","shouldCount","params","withCount","includes","errors","ValidationError","Boolean","getPaginationInfo","start","limit","withDefaultPagination","defaults","offset","page","pageSize","transformPaginationResponse","paginationInfo","total","isPaged","transform","transformPagedPaginationInfo","transformOffsetPaginationInfo","paginationResponse","isNil","omit"],"mappings":";;;;;AA8BA;;IAGA,MAAMA,sBAAyB,GAAA,KAAO;AACpCC,QAAAA,YAAAA,EAAcC,YAASC,MAAOC,CAAAA,MAAM,CAACC,GAAG,CAAC,uBAAyB,EAAA,EAAA,CAAA,CAAA;AAClEC,QAAAA,QAAAA,EAAUJ,YAASC,MAAOC,CAAAA,MAAM,CAACC,GAAG,CAAC,mBAAyB,CAAA,CAAA,IAAA;KAChE,CAAA;AAEA,MAAME,qBAAqB,CAACC,UAAAA,GAC1BC,OAAI,OAASD,EAAAA,UAAAA,CAAAA,IAAeC,OAAI,OAASD,EAAAA,UAAAA,CAAAA;AAErCE,MAAAA,iBAAAA,GAAoB,CAACF,UAAAA,GACzBC,MAAI,CAAA,MAAA,EAAQD,eAAeC,MAAI,CAAA,UAAA,EAAYD,UAAe,CAAA,IAAA,CAACD,kBAAmBC,CAAAA,UAAAA;AAEhF,MAAMG,cAAc,CAACC,MAAAA,GAAAA;IACnB,IAAIH,MAAAA,CAAI,wBAAwBG,MAAS,CAAA,EAAA;QACvC,MAAMC,SAAAA,GAAYD,MAAOJ,CAAAA,UAAU,EAAEK,SAAAA;QAErC,IAAI,OAAOA,cAAc,SAAW,EAAA;YAClC,OAAOA,SAAAA;AACT;QAEA,IAAI,OAAOA,cAAc,WAAa,EAAA;YACpC,OAAO,KAAA;AACT;QAEA,IAAI;AAAC,YAAA,MAAA;AAAQ,YAAA,GAAA;AAAK,YAAA,GAAA;AAAK,YAAA;SAAE,CAACC,QAAQ,CAACD,SAAY,CAAA,EAAA;YAC7C,OAAO,IAAA;AACT;QAEA,IAAI;AAAC,YAAA,OAAA;AAAS,YAAA,GAAA;AAAK,YAAA,GAAA;AAAK,YAAA;SAAE,CAACC,QAAQ,CAACD,SAAY,CAAA,EAAA;YAC9C,OAAO,KAAA;AACT;QAEA,MAAM,IAAIE,kBAAOC,CAAAA,eAAe,CAC9B,sEAAA,CAAA;AAEJ;AAEA,IAAA,OAAOC,QAAQd,MAAOC,CAAAA,MAAM,CAACC,GAAG,CAAC,oBAAsB,EAAA,IAAA,CAAA,CAAA;AACzD;AAEA,MAAMa,oBAAoB,CAACN,MAAAA,GAAAA;AACzB,IAAA,MAAM,EAAEX,YAAY,EAAEK,QAAQ,EAAE,GAAGN,sBAAAA,EAAAA;AAEnC,IAAA,MAAM,EAAEmB,KAAK,EAAEC,KAAK,EAAE,GAAGZ,sBAAWa,CAAAA,qBAAqB,CAACT,MAAAA,CAAOJ,UAAU,IAAI,EAAI,EAAA;QACjFc,QAAU,EAAA;YAAEC,MAAQ,EAAA;gBAAEH,KAAOnB,EAAAA;AAAa,aAAA;YAAGuB,IAAM,EAAA;gBAAEC,QAAUxB,EAAAA;AAAa;AAAE,SAAA;AAC9EK,QAAAA,QAAAA,EAAUA,YAAY,CAAC;AACzB,KAAA,CAAA;IAEA,OAAO;AAAEa,QAAAA,KAAAA;AAAOC,QAAAA;AAAM,KAAA;AACxB;AAEMM,MAAAA,2BAAAA,GAA8B,CAClCC,cAAAA,EACAC,KACAC,EAAAA,OAAAA,GAAAA;AAEA,IAAA,MAAMC,YAAYD,OACdrB,GAAAA,sBAAAA,CAAWuB,4BAA4B,GACvCvB,uBAAWwB,6BAA6B;IAE5C,MAAMC,kBAAAA,GAAqBH,UAAUH,cAAgBC,EAAAA,KAAAA,CAAAA;AAErD,IAAA,IAAIM,SAAMN,KAAQ,CAAA,EAAA;;AAEhB,QAAA,OAAOO,OAAK,CAAA;AAAC,YAAA,OAAA;AAAS,YAAA;SAAY,EAAEF,kBAAAA,CAAAA;AACtC;IAEA,OAAOA,kBAAAA;AACT;;;;;;;"}
1
+ {"version":3,"file":"pagination.js","sources":["../../../src/core-api/service/pagination.ts"],"sourcesContent":["import { omit, has, toNumber, isNil } from 'lodash/fp';\n\nimport { errors, pagination } from '@strapi/utils';\n\ninterface BasePaginationParams {\n withCount?: boolean | 't' | '1' | 'true' | 'f' | '0' | 'false' | 0 | 1;\n}\n\ntype PagedPagination = BasePaginationParams & {\n page?: number;\n pageSize?: number;\n};\n\ntype OffsetPagination = BasePaginationParams & {\n start?: number;\n limit?: number;\n};\n\nexport type PaginationParams = PagedPagination | OffsetPagination;\n\ntype PaginationInfo =\n | {\n page: number;\n pageSize: number;\n }\n | {\n start: number;\n limit: number;\n };\n\n/**\n * Default limit values from config\n */\nconst getLimitConfigDefaults = () => ({\n defaultLimit: toNumber(strapi.config.get('api.rest.defaultLimit', 25)),\n maxLimit: toNumber(strapi.config.get('api.rest.maxLimit')) || null,\n});\n\nconst isOffsetPagination = (pagination?: PaginationParams): pagination is OffsetPagination =>\n has('start', pagination) || has('limit', pagination);\n\nconst isPagedPagination = (pagination?: PaginationParams): pagination is PagedPagination =>\n has('page', pagination) || has('pageSize', pagination) || !isOffsetPagination(pagination);\n\nconst shouldCount = (params: { pagination?: PaginationParams }) => {\n if (has('pagination.withCount', params)) {\n const withCount = params.pagination?.withCount;\n\n if (typeof withCount === 'boolean') {\n return withCount;\n }\n\n if (typeof withCount === 'undefined') {\n return false;\n }\n\n if (['true', 't', '1', 1].includes(withCount)) {\n return true;\n }\n\n if (['false', 'f', '0', 0].includes(withCount)) {\n return false;\n }\n\n throw new errors.ValidationError(\n 'Invalid withCount parameter. Expected \"t\",\"1\",\"true\",\"false\",\"0\",\"f\"'\n );\n }\n\n return Boolean(strapi.config.get('api.rest.withCount', true));\n};\n\nconst getPaginationInfo = (params: { pagination?: PaginationParams }): PaginationInfo => {\n const { defaultLimit, maxLimit } = getLimitConfigDefaults();\n\n const { start, limit } = pagination.withDefaultPagination(params.pagination || {}, {\n defaults: { offset: { limit: defaultLimit }, page: { pageSize: defaultLimit } },\n maxLimit: maxLimit || -1,\n });\n\n return { start, limit };\n};\n\nconst transformPaginationResponse = (\n paginationInfo: PaginationInfo,\n total: number | undefined,\n isPaged: boolean\n) => {\n const transform = isPaged\n ? pagination.transformPagedPaginationInfo\n : pagination.transformOffsetPaginationInfo;\n\n const paginationResponse = transform(paginationInfo, total!);\n\n if (isNil(total)) {\n // Ignore total and pageCount if `total` value is not available.\n return omit(['total', 'pageCount'], paginationResponse) as ReturnType<typeof transform>;\n }\n\n return paginationResponse;\n};\n\nexport { isPagedPagination, shouldCount, getPaginationInfo, transformPaginationResponse };\n"],"names":["getLimitConfigDefaults","defaultLimit","toNumber","strapi","config","get","maxLimit","isOffsetPagination","pagination","has","isPagedPagination","shouldCount","params","withCount","includes","errors","ValidationError","Boolean","getPaginationInfo","start","limit","withDefaultPagination","defaults","offset","page","pageSize","transformPaginationResponse","paginationInfo","total","isPaged","transform","transformPagedPaginationInfo","transformOffsetPaginationInfo","paginationResponse","isNil","omit"],"mappings":";;;;;AA8BA;;IAGA,MAAMA,sBAAAA,GAAyB,KAAO;AACpCC,QAAAA,YAAAA,EAAcC,YAASC,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,uBAAA,EAAyB,EAAA,CAAA,CAAA;AAClEC,QAAAA,QAAAA,EAAUJ,YAASC,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,mBAAA,CAAA,CAAA,IAAyB;KAChE,CAAA;AAEA,MAAME,qBAAqB,CAACC,UAAAA,GAC1BC,OAAI,OAAA,EAASD,UAAAA,CAAAA,IAAeC,OAAI,OAAA,EAASD,UAAAA,CAAAA;AAE3C,MAAME,iBAAAA,GAAoB,CAACF,UAAAA,GACzBC,MAAAA,CAAI,MAAA,EAAQD,eAAeC,MAAAA,CAAI,UAAA,EAAYD,UAAAA,CAAAA,IAAe,CAACD,kBAAAA,CAAmBC,UAAAA;AAEhF,MAAMG,cAAc,CAACC,MAAAA,GAAAA;IACnB,IAAIH,MAAAA,CAAI,wBAAwBG,MAAAA,CAAAA,EAAS;QACvC,MAAMC,SAAAA,GAAYD,MAAAA,CAAOJ,UAAU,EAAEK,SAAAA;QAErC,I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AA,GACdrB,sBAAAA,CAAWuB,4BAA4B,GACvCvB,uBAAWwB,6BAA6B;IAE5C,MAAMC,kBAAAA,GAAqBH,UAAUH,cAAAA,EAAgBC,KAAAA,CAAAA;AAErD,IAAA,IAAIM,SAAMN,KAAAA,CAAAA,EAAQ;;AAEhB,QAAA,OAAOO,OAAAA,CAAK;AAAC,YAAA,OAAA;AAAS,YAAA;SAAY,EAAEF,kBAAAA,CAAAA;AACtC,IAAA;IAEA,OAAOA,kBAAAA;AACT;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { has, isNil, omit, toNumber } from 'lodash/fp';
2
- import { errors, pagination } from '@strapi/utils';
2
+ import { pagination, errors } from '@strapi/utils';
3
3
 
4
4
  /**
5
5
  * Default limit values from config
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.mjs","sources":["../../../src/core-api/service/pagination.ts"],"sourcesContent":["import { omit, has, toNumber, isNil } from 'lodash/fp';\n\nimport { errors, pagination } from '@strapi/utils';\n\ninterface BasePaginationParams {\n withCount?: boolean | 't' | '1' | 'true' | 'f' | '0' | 'false' | 0 | 1;\n}\n\ntype PagedPagination = BasePaginationParams & {\n page?: number;\n pageSize?: number;\n};\n\ntype OffsetPagination = BasePaginationParams & {\n start?: number;\n limit?: number;\n};\n\nexport type PaginationParams = PagedPagination | OffsetPagination;\n\ntype PaginationInfo =\n | {\n page: number;\n pageSize: number;\n }\n | {\n start: number;\n limit: number;\n };\n\n/**\n * Default limit values from config\n */\nconst getLimitConfigDefaults = () => ({\n defaultLimit: toNumber(strapi.config.get('api.rest.defaultLimit', 25)),\n maxLimit: toNumber(strapi.config.get('api.rest.maxLimit')) || null,\n});\n\nconst isOffsetPagination = (pagination?: PaginationParams): pagination is OffsetPagination =>\n has('start', pagination) || has('limit', pagination);\n\nconst isPagedPagination = (pagination?: PaginationParams): pagination is PagedPagination =>\n has('page', pagination) || has('pageSize', pagination) || !isOffsetPagination(pagination);\n\nconst shouldCount = (params: { pagination?: PaginationParams }) => {\n if (has('pagination.withCount', params)) {\n const withCount = params.pagination?.withCount;\n\n if (typeof withCount === 'boolean') {\n return withCount;\n }\n\n if (typeof withCount === 'undefined') {\n return false;\n }\n\n if (['true', 't', '1', 1].includes(withCount)) {\n return true;\n }\n\n if (['false', 'f', '0', 0].includes(withCount)) {\n return false;\n }\n\n throw new errors.ValidationError(\n 'Invalid withCount parameter. Expected \"t\",\"1\",\"true\",\"false\",\"0\",\"f\"'\n );\n }\n\n return Boolean(strapi.config.get('api.rest.withCount', true));\n};\n\nconst getPaginationInfo = (params: { pagination?: PaginationParams }): PaginationInfo => {\n const { defaultLimit, maxLimit } = getLimitConfigDefaults();\n\n const { start, limit } = pagination.withDefaultPagination(params.pagination || {}, {\n defaults: { offset: { limit: defaultLimit }, page: { pageSize: defaultLimit } },\n maxLimit: maxLimit || -1,\n });\n\n return { start, limit };\n};\n\nconst transformPaginationResponse = (\n paginationInfo: PaginationInfo,\n total: number | undefined,\n isPaged: boolean\n) => {\n const transform = isPaged\n ? pagination.transformPagedPaginationInfo\n : pagination.transformOffsetPaginationInfo;\n\n const paginationResponse = transform(paginationInfo, total!);\n\n if (isNil(total)) {\n // Ignore total and pageCount if `total` value is not available.\n return omit(['total', 'pageCount'], paginationResponse) as ReturnType<typeof transform>;\n }\n\n return paginationResponse;\n};\n\nexport { isPagedPagination, shouldCount, getPaginationInfo, transformPaginationResponse };\n"],"names":["getLimitConfigDefaults","defaultLimit","toNumber","strapi","config","get","maxLimit","isOffsetPagination","pagination","has","isPagedPagination","shouldCount","params","withCount","includes","errors","ValidationError","Boolean","getPaginationInfo","start","limit","withDefaultPagination","defaults","offset","page","pageSize","transformPaginationResponse","paginationInfo","total","isPaged","transform","transformPagedPaginationInfo","transformOffsetPaginationInfo","paginationResponse","isNil","omit"],"mappings":";;;AA8BA;;IAGA,MAAMA,sBAAyB,GAAA,KAAO;AACpCC,QAAAA,YAAAA,EAAcC,SAASC,MAAOC,CAAAA,MAAM,CAACC,GAAG,CAAC,uBA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,EAAEK,QAAQ,EAAE,GAAGN,sBAAAA,EAAAA;AAEnC,IAAA,MAAM,EAAEmB,KAAK,EAAEC,KAAK,EAAE,GAAGZ,UAAWa,CAAAA,qBAAqB,CAACT,MAAAA,CAAOJ,UAAU,IAAI,EAAI,EAAA;QACjFc,QAAU,EAAA;YAAEC,MAAQ,EAAA;gBAAEH,KAAOnB,EAAAA;AAAa,aAAA;YAAGuB,IAAM,EAAA;gBAAEC,QAAUxB,EAAAA;AAAa;AAAE,SAAA;AAC9EK,QAAAA,QAAAA,EAAUA,YAAY,CAAC;AACzB,KAAA,CAAA;IAEA,OAAO;AAAEa,QAAAA,KAAAA;AAAOC,QAAAA;AAAM,KAAA;AACxB;AAEMM,MAAAA,2BAAAA,GAA8B,CAClCC,cAAAA,EACAC,KACAC,EAAAA,OAAAA,GAAAA;AAEA,IAAA,MAAMC,YAAYD,OACdrB,GAAAA,UAAAA,CAAWuB,4BAA4B,GACvCvB,WAAWwB,6BAA6B;IAE5C,MAAMC,kBAAAA,GAAqBH,UAAUH,cAAgBC,EAAAA,KAAAA,CAAAA;AAErD,IAAA,IAAIM,MAAMN,KAAQ,CAAA,EAAA;;AAEhB,QAAA,OAAOO,IAAK,CAAA;AAAC,YAAA,OAAA;AAAS,YAAA;SAAY,EAAEF,kBAAAA,CAAAA;AACtC;IAEA,OAAOA,kBAAAA;AACT;;;;"}
1
+ {"version":3,"file":"pagination.mjs","sources":["../../../src/core-api/service/pagination.ts"],"sourcesContent":["import { omit, has, toNumber, isNil } from 'lodash/fp';\n\nimport { errors, pagination } from '@strapi/utils';\n\ninterface BasePaginationParams {\n withCount?: boolean | 't' | '1' | 'true' | 'f' | '0' | 'false' | 0 | 1;\n}\n\ntype PagedPagination = BasePaginationParams & {\n page?: number;\n pageSize?: number;\n};\n\ntype OffsetPagination = BasePaginationParams & {\n start?: number;\n limit?: number;\n};\n\nexport type PaginationParams = PagedPagination | OffsetPagination;\n\ntype PaginationInfo =\n | {\n page: number;\n pageSize: number;\n }\n | {\n start: number;\n limit: number;\n };\n\n/**\n * Default limit values from config\n */\nconst getLimitConfigDefaults = () => ({\n defaultLimit: toNumber(strapi.config.get('api.rest.defaultLimit', 25)),\n maxLimit: toNumber(strapi.config.get('api.rest.maxLimit')) || null,\n});\n\nconst isOffsetPagination = (pagination?: PaginationParams): pagination is OffsetPagination =>\n has('start', pagination) || has('limit', pagination);\n\nconst isPagedPagination = (pagination?: PaginationParams): pagination is PagedPagination =>\n has('page', pagination) || has('pageSize', pagination) || !isOffsetPagination(pagination);\n\nconst shouldCount = (params: { pagination?: PaginationParams }) => {\n if (has('pagination.withCount', params)) {\n const withCount = params.pagination?.withCount;\n\n if (typeof withCount === 'boolean') {\n return withCount;\n }\n\n if (typeof withCount === 'undefined') {\n return false;\n }\n\n if (['true', 't', '1', 1].includes(withCount)) {\n return true;\n }\n\n if (['false', 'f', '0', 0].includes(withCount)) {\n return false;\n }\n\n throw new errors.ValidationError(\n 'Invalid withCount parameter. Expected \"t\",\"1\",\"true\",\"false\",\"0\",\"f\"'\n );\n }\n\n return Boolean(strapi.config.get('api.rest.withCount', true));\n};\n\nconst getPaginationInfo = (params: { pagination?: PaginationParams }): PaginationInfo => {\n const { defaultLimit, maxLimit } = getLimitConfigDefaults();\n\n const { start, limit } = pagination.withDefaultPagination(params.pagination || {}, {\n defaults: { offset: { limit: defaultLimit }, page: { pageSize: defaultLimit } },\n maxLimit: maxLimit || -1,\n });\n\n return { start, limit };\n};\n\nconst transformPaginationResponse = (\n paginationInfo: PaginationInfo,\n total: number | undefined,\n isPaged: boolean\n) => {\n const transform = isPaged\n ? pagination.transformPagedPaginationInfo\n : pagination.transformOffsetPaginationInfo;\n\n const paginationResponse = transform(paginationInfo, total!);\n\n if (isNil(total)) {\n // Ignore total and pageCount if `total` value is not available.\n return omit(['total', 'pageCount'], paginationResponse) as ReturnType<typeof transform>;\n }\n\n return paginationResponse;\n};\n\nexport { isPagedPagination, shouldCount, getPaginationInfo, transformPaginationResponse };\n"],"names":["getLimitConfigDefaults","defaultLimit","toNumber","strapi","config","get","maxLimit","isOffsetPagination","pagination","has","isPagedPagination","shouldCount","params","withCount","includes","errors","ValidationError","Boolean","getPaginationInfo","start","limit","withDefaultPagination","defaults","offset","page","pageSize","transformPaginationResponse","paginationInfo","total","isPaged","transform","transformPagedPaginationInfo","transformOffsetPaginationInfo","paginationResponse","isNil","omit"],"mappings":";;;AA8BA;;IAGA,MAAMA,sBAAAA,GAAyB,KAAO;AACpCC,QAAAA,YAAAA,EAAcC,SAASC,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,uBAAA,EAAyB,EAAA,CAAA,CAAA;AAClEC,QAAAA,QAAAA,EAAUJ,SAASC,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,mBAAA,CAAA,CAAA,IAAyB;KAChE,CAAA;AAEA,MAAME,qBAAqB,CAACC,UAAAA,GAC1BC,IAAI,OAAA,EAASD,UAAAA,CAAAA,IAAeC,IAAI,OAAA,EAASD,UAAAA,CAAAA;AAE3C,MAAME,iBAAAA,GAAoB,CAACF,UAAAA,GACzBC,GAAAA,CAAI,MAAA,EAAQD,eAAeC,GAAAA,CAAI,UAAA,EAAYD,UAAAA,CAAAA,IAAe,CAACD,kBAAAA,CAAmBC,UAAAA;AAEhF,MAAMG,cAAc,CAACC,MAAAA,GAAAA;IACnB,IAAIH,GAAAA,CAAI,wBAAwBG,MAAAA,CAAAA,EAAS;QACvC,MAAMC,SAAAA,GAAYD,MAAAA,CAAOJ,UAAU,EAAEK,SAAAA;QAErC,IAAI,OAAOA,cAAc,SAAA,EAAW;YAClC,OAAOA,SAAAA;AACT,QAAA;QAEA,IAAI,OAAOA,cAAc,WAAA,EAAa;YACpC,OAAO,KAAA;AACT,QAAA;QAEA,IAAI;AAAC,YAAA,MAAA;AAAQ,YAAA,GAAA;AAAK,YAAA,GAAA;AAAK,YAAA;SAAE,CAACC,QAAQ,CAACD,SAAAA,CAAAA,EAAY;YAC7C,OAAO,IAAA;AACT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