@strapi/core 0.0.0-experimental.020096d91bef5bab5a6c32b4216da5aeb9383d33 → 0.0.0-experimental.16eaafeff6bd4cd49d56f3c31d002cad71a1134a

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.

Potentially problematic release.


This version of @strapi/core might be problematic. Click here for more details.

Files changed (748) hide show
  1. package/dist/Strapi.d.ts +52 -59
  2. package/dist/Strapi.d.ts.map +1 -1
  3. package/dist/Strapi.js +193 -209
  4. package/dist/Strapi.js.map +1 -1
  5. package/dist/Strapi.mjs +165 -201
  6. package/dist/Strapi.mjs.map +1 -1
  7. package/dist/configuration/config-loader.d.ts.map +1 -1
  8. package/dist/configuration/config-loader.js +9 -5
  9. package/dist/configuration/config-loader.js.map +1 -1
  10. package/dist/configuration/config-loader.mjs +9 -5
  11. package/dist/configuration/config-loader.mjs.map +1 -1
  12. package/dist/configuration/get-dirs.d.ts +10 -0
  13. package/dist/configuration/get-dirs.d.ts.map +1 -0
  14. package/dist/{utils → configuration}/get-dirs.js +3 -2
  15. package/dist/configuration/get-dirs.js.map +1 -0
  16. package/dist/{utils → configuration}/get-dirs.mjs +3 -2
  17. package/dist/configuration/get-dirs.mjs.map +1 -0
  18. package/dist/configuration/index.d.ts +4 -7
  19. package/dist/configuration/index.d.ts.map +1 -1
  20. package/dist/configuration/index.js +6 -4
  21. package/dist/configuration/index.js.map +1 -1
  22. package/dist/configuration/index.mjs +5 -4
  23. package/dist/configuration/index.mjs.map +1 -1
  24. package/dist/container.d.ts +2 -2
  25. package/dist/container.d.ts.map +1 -1
  26. package/dist/container.js.map +1 -1
  27. package/dist/container.mjs.map +1 -1
  28. package/dist/core-api/controller/collection-type.d.ts +3 -3
  29. package/dist/core-api/controller/collection-type.d.ts.map +1 -1
  30. package/dist/core-api/controller/collection-type.js +3 -0
  31. package/dist/core-api/controller/collection-type.js.map +1 -1
  32. package/dist/core-api/controller/collection-type.mjs +3 -0
  33. package/dist/core-api/controller/collection-type.mjs.map +1 -1
  34. package/dist/core-api/controller/index.d.ts +3 -3
  35. package/dist/core-api/controller/index.d.ts.map +1 -1
  36. package/dist/core-api/controller/index.js +5 -5
  37. package/dist/core-api/controller/index.js.map +1 -1
  38. package/dist/core-api/controller/index.mjs +6 -6
  39. package/dist/core-api/controller/index.mjs.map +1 -1
  40. package/dist/core-api/controller/single-type.d.ts +3 -3
  41. package/dist/core-api/controller/single-type.d.ts.map +1 -1
  42. package/dist/core-api/controller/single-type.js +1 -0
  43. package/dist/core-api/controller/single-type.js.map +1 -1
  44. package/dist/core-api/controller/single-type.mjs +1 -0
  45. package/dist/core-api/controller/single-type.mjs.map +1 -1
  46. package/dist/core-api/controller/transform.d.ts +2 -2
  47. package/dist/core-api/controller/transform.d.ts.map +1 -1
  48. package/dist/core-api/controller/transform.js +2 -5
  49. package/dist/core-api/controller/transform.js.map +1 -1
  50. package/dist/core-api/controller/transform.mjs +2 -5
  51. package/dist/core-api/controller/transform.mjs.map +1 -1
  52. package/dist/core-api/routes/index.d.ts.map +1 -1
  53. package/dist/core-api/service/collection-type.d.ts +11 -17
  54. package/dist/core-api/service/collection-type.d.ts.map +1 -1
  55. package/dist/core-api/service/collection-type.js +18 -7
  56. package/dist/core-api/service/collection-type.js.map +1 -1
  57. package/dist/core-api/service/collection-type.mjs +19 -8
  58. package/dist/core-api/service/collection-type.mjs.map +1 -1
  59. package/dist/core-api/service/index.d.ts +3 -3
  60. package/dist/core-api/service/index.d.ts.map +1 -1
  61. package/dist/core-api/service/index.js.map +1 -1
  62. package/dist/core-api/service/index.mjs.map +1 -1
  63. package/dist/core-api/service/pagination.d.ts +4 -11
  64. package/dist/core-api/service/pagination.d.ts.map +1 -1
  65. package/dist/core-api/service/pagination.js +14 -40
  66. package/dist/core-api/service/pagination.js.map +1 -1
  67. package/dist/core-api/service/pagination.mjs +16 -42
  68. package/dist/core-api/service/pagination.mjs.map +1 -1
  69. package/dist/core-api/service/single-type.d.ts +4 -4
  70. package/dist/core-api/service/single-type.d.ts.map +1 -1
  71. package/dist/core-api/service/single-type.js +9 -2
  72. package/dist/core-api/service/single-type.js.map +1 -1
  73. package/dist/core-api/service/single-type.mjs +9 -2
  74. package/dist/core-api/service/single-type.mjs.map +1 -1
  75. package/dist/domain/content-type/index.d.ts +1 -1
  76. package/dist/domain/content-type/index.d.ts.map +1 -1
  77. package/dist/domain/content-type/index.js +1 -1
  78. package/dist/domain/content-type/index.js.map +1 -1
  79. package/dist/domain/content-type/index.mjs +1 -1
  80. package/dist/domain/content-type/index.mjs.map +1 -1
  81. package/dist/domain/module/index.d.ts +24 -23
  82. package/dist/domain/module/index.d.ts.map +1 -1
  83. package/dist/domain/module/index.js +2 -1
  84. package/dist/domain/module/index.js.map +1 -1
  85. package/dist/domain/module/index.mjs +3 -2
  86. package/dist/domain/module/index.mjs.map +1 -1
  87. package/dist/ee/index.d.ts +4 -2
  88. package/dist/ee/index.d.ts.map +1 -1
  89. package/dist/ee/index.js.map +1 -1
  90. package/dist/ee/index.mjs.map +1 -1
  91. package/dist/ee/license.d.ts +2 -2
  92. package/dist/ee/license.d.ts.map +1 -1
  93. package/dist/ee/license.js +2 -1
  94. package/dist/ee/license.js.map +1 -1
  95. package/dist/ee/license.mjs +2 -1
  96. package/dist/ee/license.mjs.map +1 -1
  97. package/dist/factories.d.ts +10 -10
  98. package/dist/factories.d.ts.map +1 -1
  99. package/dist/factories.js +6 -2
  100. package/dist/factories.js.map +1 -1
  101. package/dist/factories.mjs +6 -2
  102. package/dist/factories.mjs.map +1 -1
  103. package/dist/index.d.ts +4 -2
  104. package/dist/index.d.ts.map +1 -1
  105. package/dist/index.js +25 -1
  106. package/dist/index.js.map +1 -1
  107. package/dist/index.mjs +27 -3
  108. package/dist/index.mjs.map +1 -1
  109. package/dist/loaders/admin.d.ts +2 -2
  110. package/dist/loaders/admin.d.ts.map +1 -1
  111. package/dist/loaders/admin.js +0 -1
  112. package/dist/loaders/admin.js.map +1 -1
  113. package/dist/loaders/admin.mjs +0 -1
  114. package/dist/loaders/admin.mjs.map +1 -1
  115. package/dist/loaders/apis.d.ts +2 -2
  116. package/dist/loaders/apis.d.ts.map +1 -1
  117. package/dist/loaders/apis.js +10 -10
  118. package/dist/loaders/apis.js.map +1 -1
  119. package/dist/loaders/apis.mjs +10 -10
  120. package/dist/loaders/apis.mjs.map +1 -1
  121. package/dist/loaders/components.d.ts +2 -2
  122. package/dist/loaders/components.d.ts.map +1 -1
  123. package/dist/loaders/components.js.map +1 -1
  124. package/dist/loaders/components.mjs.map +1 -1
  125. package/dist/loaders/index.d.ts +2 -2
  126. package/dist/loaders/index.d.ts.map +1 -1
  127. package/dist/loaders/index.js +0 -2
  128. package/dist/loaders/index.js.map +1 -1
  129. package/dist/loaders/index.mjs +0 -2
  130. package/dist/loaders/index.mjs.map +1 -1
  131. package/dist/loaders/middlewares.d.ts +2 -2
  132. package/dist/loaders/middlewares.d.ts.map +1 -1
  133. package/dist/loaders/middlewares.js.map +1 -1
  134. package/dist/loaders/middlewares.mjs.map +1 -1
  135. package/dist/loaders/plugins/get-enabled-plugins.d.ts +2 -2
  136. package/dist/loaders/plugins/get-enabled-plugins.d.ts.map +1 -1
  137. package/dist/loaders/plugins/get-enabled-plugins.js +7 -5
  138. package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
  139. package/dist/loaders/plugins/get-enabled-plugins.mjs +7 -5
  140. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
  141. package/dist/loaders/plugins/index.d.ts +2 -2
  142. package/dist/loaders/plugins/index.d.ts.map +1 -1
  143. package/dist/loaders/plugins/index.js.map +1 -1
  144. package/dist/loaders/plugins/index.mjs.map +1 -1
  145. package/dist/loaders/policies.d.ts +2 -2
  146. package/dist/loaders/policies.d.ts.map +1 -1
  147. package/dist/loaders/policies.js.map +1 -1
  148. package/dist/loaders/policies.mjs.map +1 -1
  149. package/dist/loaders/sanitizers.d.ts +2 -2
  150. package/dist/loaders/sanitizers.d.ts.map +1 -1
  151. package/dist/loaders/sanitizers.js.map +1 -1
  152. package/dist/loaders/sanitizers.mjs.map +1 -1
  153. package/dist/loaders/src-index.d.ts +2 -2
  154. package/dist/loaders/src-index.d.ts.map +1 -1
  155. package/dist/loaders/src-index.js.map +1 -1
  156. package/dist/loaders/src-index.mjs.map +1 -1
  157. package/dist/loaders/validators.d.ts +2 -2
  158. package/dist/loaders/validators.d.ts.map +1 -1
  159. package/dist/loaders/validators.js.map +1 -1
  160. package/dist/loaders/validators.mjs.map +1 -1
  161. package/dist/middlewares/body.d.ts +4 -4
  162. package/dist/middlewares/body.d.ts.map +1 -1
  163. package/dist/middlewares/body.js +4 -4
  164. package/dist/middlewares/body.js.map +1 -1
  165. package/dist/middlewares/body.mjs +4 -4
  166. package/dist/middlewares/body.mjs.map +1 -1
  167. package/dist/middlewares/compression.d.ts +2 -2
  168. package/dist/middlewares/compression.d.ts.map +1 -1
  169. package/dist/middlewares/compression.js.map +1 -1
  170. package/dist/middlewares/compression.mjs.map +1 -1
  171. package/dist/middlewares/cors.d.ts +2 -2
  172. package/dist/middlewares/cors.d.ts.map +1 -1
  173. package/dist/middlewares/cors.js +6 -8
  174. package/dist/middlewares/cors.js.map +1 -1
  175. package/dist/middlewares/cors.mjs +6 -8
  176. package/dist/middlewares/cors.mjs.map +1 -1
  177. package/dist/middlewares/errors.d.ts +2 -2
  178. package/dist/middlewares/errors.d.ts.map +1 -1
  179. package/dist/middlewares/errors.js.map +1 -1
  180. package/dist/middlewares/errors.mjs.map +1 -1
  181. package/dist/middlewares/favicon.d.ts +2 -2
  182. package/dist/middlewares/favicon.d.ts.map +1 -1
  183. package/dist/middlewares/favicon.js.map +1 -1
  184. package/dist/middlewares/favicon.mjs.map +1 -1
  185. package/dist/middlewares/index.d.ts +2 -2
  186. package/dist/middlewares/index.d.ts.map +1 -1
  187. package/dist/middlewares/index.js.map +1 -1
  188. package/dist/middlewares/index.mjs.map +1 -1
  189. package/dist/middlewares/ip.d.ts +2 -2
  190. package/dist/middlewares/ip.d.ts.map +1 -1
  191. package/dist/middlewares/ip.js.map +1 -1
  192. package/dist/middlewares/ip.mjs.map +1 -1
  193. package/dist/middlewares/logger.d.ts +2 -2
  194. package/dist/middlewares/logger.d.ts.map +1 -1
  195. package/dist/middlewares/logger.js.map +1 -1
  196. package/dist/middlewares/logger.mjs.map +1 -1
  197. package/dist/middlewares/powered-by.d.ts +2 -2
  198. package/dist/middlewares/powered-by.d.ts.map +1 -1
  199. package/dist/middlewares/powered-by.js.map +1 -1
  200. package/dist/middlewares/powered-by.mjs.map +1 -1
  201. package/dist/middlewares/public.d.ts +2 -2
  202. package/dist/middlewares/public.d.ts.map +1 -1
  203. package/dist/middlewares/public.js +1 -1
  204. package/dist/middlewares/public.js.map +1 -1
  205. package/dist/middlewares/public.mjs +1 -1
  206. package/dist/middlewares/public.mjs.map +1 -1
  207. package/dist/middlewares/query.d.ts +2 -2
  208. package/dist/middlewares/query.d.ts.map +1 -1
  209. package/dist/middlewares/query.js.map +1 -1
  210. package/dist/middlewares/query.mjs.map +1 -1
  211. package/dist/middlewares/response-time.d.ts +2 -2
  212. package/dist/middlewares/response-time.d.ts.map +1 -1
  213. package/dist/middlewares/response-time.js.map +1 -1
  214. package/dist/middlewares/response-time.mjs.map +1 -1
  215. package/dist/middlewares/responses.d.ts +3 -3
  216. package/dist/middlewares/responses.d.ts.map +1 -1
  217. package/dist/middlewares/responses.js.map +1 -1
  218. package/dist/middlewares/responses.mjs.map +1 -1
  219. package/dist/middlewares/security.d.ts +2 -2
  220. package/dist/middlewares/security.d.ts.map +1 -1
  221. package/dist/middlewares/security.js +11 -4
  222. package/dist/middlewares/security.js.map +1 -1
  223. package/dist/middlewares/security.mjs +12 -5
  224. package/dist/middlewares/security.mjs.map +1 -1
  225. package/dist/middlewares/session.d.ts +2 -2
  226. package/dist/middlewares/session.d.ts.map +1 -1
  227. package/dist/middlewares/session.js.map +1 -1
  228. package/dist/middlewares/session.mjs.map +1 -1
  229. package/dist/migrations/database/5.0.0-discard-drafts.d.ts +30 -0
  230. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -0
  231. package/dist/migrations/database/5.0.0-discard-drafts.js +50 -0
  232. package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -0
  233. package/dist/migrations/database/5.0.0-discard-drafts.mjs +50 -0
  234. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -0
  235. package/dist/migrations/draft-publish.d.ts +17 -0
  236. package/dist/migrations/draft-publish.d.ts.map +1 -0
  237. package/dist/migrations/draft-publish.js +42 -0
  238. package/dist/migrations/draft-publish.js.map +1 -0
  239. package/dist/migrations/draft-publish.mjs +42 -0
  240. package/dist/migrations/draft-publish.mjs.map +1 -0
  241. package/dist/providers/admin.d.ts +3 -0
  242. package/dist/providers/admin.d.ts.map +1 -0
  243. package/dist/providers/admin.js +20 -0
  244. package/dist/providers/admin.js.map +1 -0
  245. package/dist/providers/admin.mjs +21 -0
  246. package/dist/providers/admin.mjs.map +1 -0
  247. package/dist/providers/coreStore.d.ts +3 -0
  248. package/dist/providers/coreStore.d.ts.map +1 -0
  249. package/dist/providers/coreStore.js +11 -0
  250. package/dist/providers/coreStore.js.map +1 -0
  251. package/dist/providers/coreStore.mjs +12 -0
  252. package/dist/providers/coreStore.mjs.map +1 -0
  253. package/dist/providers/cron.d.ts +3 -0
  254. package/dist/providers/cron.d.ts.map +1 -0
  255. package/dist/providers/cron.js +20 -0
  256. package/dist/providers/cron.js.map +1 -0
  257. package/dist/providers/cron.mjs +21 -0
  258. package/dist/providers/cron.mjs.map +1 -0
  259. package/dist/providers/index.d.ts +3 -0
  260. package/dist/providers/index.d.ts.map +1 -0
  261. package/dist/providers/index.js +11 -0
  262. package/dist/providers/index.js.map +1 -0
  263. package/dist/providers/index.mjs +11 -0
  264. package/dist/providers/index.mjs.map +1 -0
  265. package/dist/providers/provider.d.ts +9 -0
  266. package/dist/providers/provider.d.ts.map +1 -0
  267. package/dist/providers/provider.js +5 -0
  268. package/dist/providers/provider.js.map +1 -0
  269. package/dist/providers/provider.mjs +5 -0
  270. package/dist/providers/provider.mjs.map +1 -0
  271. package/dist/providers/registries.d.ts +3 -0
  272. package/dist/providers/registries.d.ts.map +1 -0
  273. package/dist/providers/registries.js +35 -0
  274. package/dist/providers/registries.js.map +1 -0
  275. package/dist/providers/registries.mjs +36 -0
  276. package/dist/providers/registries.mjs.map +1 -0
  277. package/dist/providers/telemetry.d.ts +3 -0
  278. package/dist/providers/telemetry.d.ts.map +1 -0
  279. package/dist/providers/telemetry.js +19 -0
  280. package/dist/providers/telemetry.js.map +1 -0
  281. package/dist/providers/telemetry.mjs +20 -0
  282. package/dist/providers/telemetry.mjs.map +1 -0
  283. package/dist/providers/webhooks.d.ts +3 -0
  284. package/dist/providers/webhooks.d.ts.map +1 -0
  285. package/dist/providers/webhooks.js +30 -0
  286. package/dist/providers/webhooks.js.map +1 -0
  287. package/dist/providers/webhooks.mjs +31 -0
  288. package/dist/providers/webhooks.mjs.map +1 -0
  289. package/dist/registries/apis.d.ts +2 -2
  290. package/dist/registries/apis.d.ts.map +1 -1
  291. package/dist/registries/apis.js.map +1 -1
  292. package/dist/registries/apis.mjs.map +1 -1
  293. package/dist/registries/components.d.ts +6 -6
  294. package/dist/registries/components.d.ts.map +1 -1
  295. package/dist/registries/components.js.map +1 -1
  296. package/dist/registries/components.mjs.map +1 -1
  297. package/dist/registries/content-types.d.ts +5 -5
  298. package/dist/registries/content-types.d.ts.map +1 -1
  299. package/dist/registries/content-types.js.map +1 -1
  300. package/dist/registries/content-types.mjs.map +1 -1
  301. package/dist/registries/controllers.d.ts +10 -10
  302. package/dist/registries/controllers.d.ts.map +1 -1
  303. package/dist/registries/controllers.js.map +1 -1
  304. package/dist/registries/controllers.mjs.map +1 -1
  305. package/dist/registries/custom-fields.d.ts +3 -3
  306. package/dist/registries/custom-fields.d.ts.map +1 -1
  307. package/dist/registries/custom-fields.js.map +1 -1
  308. package/dist/registries/custom-fields.mjs.map +1 -1
  309. package/dist/registries/index.d.ts +0 -1
  310. package/dist/registries/index.d.ts.map +1 -1
  311. package/dist/registries/middlewares.d.ts +6 -6
  312. package/dist/registries/middlewares.d.ts.map +1 -1
  313. package/dist/registries/middlewares.js.map +1 -1
  314. package/dist/registries/middlewares.mjs.map +1 -1
  315. package/dist/registries/modules.d.ts +2 -2
  316. package/dist/registries/modules.d.ts.map +1 -1
  317. package/dist/registries/modules.js.map +1 -1
  318. package/dist/registries/modules.mjs.map +1 -1
  319. package/dist/registries/plugins.d.ts +5 -5
  320. package/dist/registries/plugins.d.ts.map +1 -1
  321. package/dist/registries/plugins.js.map +1 -1
  322. package/dist/registries/plugins.mjs.map +1 -1
  323. package/dist/registries/policies.d.ts +23 -11
  324. package/dist/registries/policies.d.ts.map +1 -1
  325. package/dist/registries/policies.js +64 -18
  326. package/dist/registries/policies.js.map +1 -1
  327. package/dist/registries/policies.mjs +65 -19
  328. package/dist/registries/policies.mjs.map +1 -1
  329. package/dist/registries/services.d.ts +8 -8
  330. package/dist/registries/services.d.ts.map +1 -1
  331. package/dist/registries/services.js.map +1 -1
  332. package/dist/registries/services.mjs.map +1 -1
  333. package/dist/services/auth/index.d.ts +4 -4
  334. package/dist/services/auth/index.d.ts.map +1 -1
  335. package/dist/services/auth/index.js.map +1 -1
  336. package/dist/services/auth/index.mjs.map +1 -1
  337. package/dist/services/config.d.ts +3 -0
  338. package/dist/services/config.d.ts.map +1 -0
  339. package/dist/services/config.js +47 -0
  340. package/dist/services/config.js.map +1 -0
  341. package/dist/services/config.mjs +47 -0
  342. package/dist/services/config.mjs.map +1 -0
  343. package/dist/services/content-api/index.d.ts +21 -3
  344. package/dist/services/content-api/index.d.ts.map +1 -1
  345. package/dist/services/content-api/index.js +28 -2
  346. package/dist/services/content-api/index.js.map +1 -1
  347. package/dist/services/content-api/index.mjs +28 -2
  348. package/dist/services/content-api/index.mjs.map +1 -1
  349. package/dist/services/content-api/permissions/index.d.ts +3 -3
  350. package/dist/services/content-api/permissions/index.d.ts.map +1 -1
  351. package/dist/services/content-api/permissions/index.js +1 -1
  352. package/dist/services/content-api/permissions/index.js.map +1 -1
  353. package/dist/services/content-api/permissions/index.mjs +1 -1
  354. package/dist/services/content-api/permissions/index.mjs.map +1 -1
  355. package/dist/services/core-store.d.ts.map +1 -1
  356. package/dist/services/cron.d.ts +2 -2
  357. package/dist/services/cron.d.ts.map +1 -1
  358. package/dist/services/cron.js.map +1 -1
  359. package/dist/services/cron.mjs.map +1 -1
  360. package/dist/services/custom-fields.d.ts +2 -2
  361. package/dist/services/custom-fields.d.ts.map +1 -1
  362. package/dist/services/custom-fields.js.map +1 -1
  363. package/dist/services/custom-fields.mjs.map +1 -1
  364. package/dist/services/document-service/attributes/index.d.ts +6 -0
  365. package/dist/services/document-service/attributes/index.d.ts.map +1 -0
  366. package/dist/services/{entity-service → document-service}/attributes/index.js +5 -5
  367. package/dist/services/document-service/attributes/index.js.map +1 -0
  368. package/dist/services/{entity-service → document-service}/attributes/index.mjs +5 -5
  369. package/dist/services/document-service/attributes/index.mjs.map +1 -0
  370. package/dist/services/document-service/attributes/transforms.d.ts +10 -0
  371. package/dist/services/document-service/attributes/transforms.d.ts.map +1 -0
  372. package/dist/services/document-service/attributes/transforms.js.map +1 -0
  373. package/dist/services/document-service/attributes/transforms.mjs.map +1 -0
  374. package/dist/services/document-service/common.d.ts +2 -2
  375. package/dist/services/document-service/common.d.ts.map +1 -1
  376. package/dist/services/document-service/common.js.map +1 -1
  377. package/dist/services/document-service/common.mjs.map +1 -1
  378. package/dist/services/document-service/components.d.ts +25 -1
  379. package/dist/services/document-service/components.d.ts.map +1 -1
  380. package/dist/services/{entity-service → document-service}/components.js +41 -137
  381. package/dist/services/document-service/components.js.map +1 -0
  382. package/dist/services/{entity-service → document-service}/components.mjs +42 -138
  383. package/dist/services/document-service/components.mjs.map +1 -0
  384. package/dist/services/document-service/draft-and-publish.d.ts +7 -7
  385. package/dist/services/document-service/draft-and-publish.d.ts.map +1 -1
  386. package/dist/services/document-service/draft-and-publish.js.map +1 -1
  387. package/dist/services/document-service/draft-and-publish.mjs.map +1 -1
  388. package/dist/services/document-service/entries.d.ts +10 -0
  389. package/dist/services/document-service/entries.d.ts.map +1 -0
  390. package/dist/services/document-service/entries.js +96 -0
  391. package/dist/services/document-service/entries.js.map +1 -0
  392. package/dist/services/document-service/entries.mjs +96 -0
  393. package/dist/services/document-service/entries.mjs.map +1 -0
  394. package/dist/services/document-service/events.d.ts +25 -0
  395. package/dist/services/document-service/events.d.ts.map +1 -0
  396. package/dist/services/document-service/events.js +47 -0
  397. package/dist/services/document-service/events.js.map +1 -0
  398. package/dist/services/document-service/events.mjs +47 -0
  399. package/dist/services/document-service/events.mjs.map +1 -0
  400. package/dist/services/document-service/index.d.ts +2 -4
  401. package/dist/services/document-service/index.d.ts.map +1 -1
  402. package/dist/services/document-service/index.js +18 -5
  403. package/dist/services/document-service/index.js.map +1 -1
  404. package/dist/services/document-service/index.mjs +16 -3
  405. package/dist/services/document-service/index.mjs.map +1 -1
  406. package/dist/services/document-service/internationalization.d.ts +5 -5
  407. package/dist/services/document-service/internationalization.d.ts.map +1 -1
  408. package/dist/services/document-service/internationalization.js +14 -5
  409. package/dist/services/document-service/internationalization.js.map +1 -1
  410. package/dist/services/document-service/internationalization.mjs +14 -5
  411. package/dist/services/document-service/internationalization.mjs.map +1 -1
  412. package/dist/services/document-service/middlewares/errors.d.ts +6 -0
  413. package/dist/services/document-service/middlewares/errors.d.ts.map +1 -0
  414. package/dist/services/document-service/middlewares/errors.js +25 -0
  415. package/dist/services/document-service/middlewares/errors.js.map +1 -0
  416. package/dist/services/document-service/middlewares/errors.mjs +25 -0
  417. package/dist/services/document-service/middlewares/errors.mjs.map +1 -0
  418. package/dist/services/document-service/middlewares/index.d.ts +3 -0
  419. package/dist/services/document-service/middlewares/index.d.ts.map +1 -0
  420. package/dist/services/document-service/middlewares/middleware-manager.d.ts +10 -0
  421. package/dist/services/document-service/middlewares/middleware-manager.d.ts.map +1 -0
  422. package/dist/services/document-service/{middlewares.js → middlewares/middleware-manager.js} +9 -6
  423. package/dist/services/document-service/middlewares/middleware-manager.js.map +1 -0
  424. package/dist/services/document-service/{middlewares.mjs → middlewares/middleware-manager.mjs} +9 -6
  425. package/dist/services/document-service/middlewares/middleware-manager.mjs.map +1 -0
  426. package/dist/services/document-service/params.d.ts +3 -1
  427. package/dist/services/document-service/params.d.ts.map +1 -1
  428. package/dist/services/document-service/params.js.map +1 -0
  429. package/dist/services/document-service/params.mjs.map +1 -0
  430. package/dist/services/document-service/repository.d.ts.map +1 -1
  431. package/dist/services/document-service/repository.js +155 -181
  432. package/dist/services/document-service/repository.js.map +1 -1
  433. package/dist/services/document-service/repository.mjs +139 -165
  434. package/dist/services/document-service/repository.mjs.map +1 -1
  435. package/dist/services/document-service/transform/data.d.ts.map +1 -1
  436. package/dist/services/document-service/transform/data.js +4 -2
  437. package/dist/services/document-service/transform/data.js.map +1 -1
  438. package/dist/services/document-service/transform/data.mjs +4 -2
  439. package/dist/services/document-service/transform/data.mjs.map +1 -1
  440. package/dist/services/document-service/transform/fields.d.ts +2 -2
  441. package/dist/services/document-service/transform/fields.d.ts.map +1 -1
  442. package/dist/services/document-service/transform/fields.js.map +1 -1
  443. package/dist/services/document-service/transform/fields.mjs.map +1 -1
  444. package/dist/services/document-service/transform/id-map.d.ts +3 -3
  445. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  446. package/dist/services/document-service/transform/id-map.js +1 -1
  447. package/dist/services/document-service/transform/id-map.js.map +1 -1
  448. package/dist/services/document-service/transform/id-map.mjs +1 -1
  449. package/dist/services/document-service/transform/id-map.mjs.map +1 -1
  450. package/dist/services/document-service/transform/id-transform.d.ts +2 -2
  451. package/dist/services/document-service/transform/id-transform.d.ts.map +1 -1
  452. package/dist/services/document-service/transform/id-transform.js.map +1 -1
  453. package/dist/services/document-service/transform/id-transform.mjs.map +1 -1
  454. package/dist/services/document-service/transform/populate.d.ts +2 -2
  455. package/dist/services/document-service/transform/populate.d.ts.map +1 -1
  456. package/dist/services/document-service/transform/populate.js +1 -1
  457. package/dist/services/document-service/transform/populate.js.map +1 -1
  458. package/dist/services/document-service/transform/populate.mjs +1 -1
  459. package/dist/services/document-service/transform/populate.mjs.map +1 -1
  460. package/dist/services/document-service/transform/query.d.ts +5 -0
  461. package/dist/services/document-service/transform/query.d.ts.map +1 -0
  462. package/dist/services/document-service/transform/query.js +9 -0
  463. package/dist/services/document-service/transform/query.js.map +1 -0
  464. package/dist/services/document-service/transform/query.mjs +9 -0
  465. package/dist/services/document-service/transform/query.mjs.map +1 -0
  466. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts +8 -7
  467. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts.map +1 -1
  468. package/dist/services/document-service/transform/relations/extract/data-ids.js +44 -77
  469. package/dist/services/document-service/transform/relations/extract/data-ids.js.map +1 -1
  470. package/dist/services/document-service/transform/relations/extract/data-ids.mjs +44 -77
  471. package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +1 -1
  472. package/dist/services/document-service/transform/relations/transform/data-ids.d.ts +8 -4
  473. package/dist/services/document-service/transform/relations/transform/data-ids.d.ts.map +1 -1
  474. package/dist/services/document-service/transform/relations/transform/data-ids.js +60 -125
  475. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +1 -1
  476. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +61 -126
  477. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +1 -1
  478. package/dist/services/document-service/transform/relations/transform/default-locale.d.ts +9 -0
  479. package/dist/services/document-service/transform/relations/transform/default-locale.d.ts.map +1 -0
  480. package/dist/services/document-service/transform/relations/transform/default-locale.js +32 -0
  481. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +1 -0
  482. package/dist/services/document-service/transform/relations/transform/default-locale.mjs +32 -0
  483. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +1 -0
  484. package/dist/services/document-service/transform/relations/utils/dp.d.ts +3 -3
  485. package/dist/services/document-service/transform/relations/utils/dp.d.ts.map +1 -1
  486. package/dist/services/document-service/transform/relations/utils/dp.js +9 -4
  487. package/dist/services/document-service/transform/relations/utils/dp.js.map +1 -1
  488. package/dist/services/document-service/transform/relations/utils/dp.mjs +9 -4
  489. package/dist/services/document-service/transform/relations/utils/dp.mjs.map +1 -1
  490. package/dist/services/document-service/transform/relations/utils/i18n.d.ts +6 -6
  491. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  492. package/dist/services/document-service/transform/relations/utils/i18n.js +3 -9
  493. package/dist/services/document-service/transform/relations/utils/i18n.js.map +1 -1
  494. package/dist/services/document-service/transform/relations/utils/i18n.mjs +3 -9
  495. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +1 -1
  496. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts +6 -0
  497. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts.map +1 -0
  498. package/dist/services/document-service/transform/relations/utils/map-relation.js +91 -0
  499. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +1 -0
  500. package/dist/services/document-service/transform/relations/utils/map-relation.mjs +91 -0
  501. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +1 -0
  502. package/dist/services/document-service/transform/relations/utils/types.d.ts +6 -0
  503. package/dist/services/document-service/transform/relations/utils/types.d.ts.map +1 -1
  504. package/dist/services/document-service/transform/types.d.ts +3 -3
  505. package/dist/services/document-service/transform/types.d.ts.map +1 -1
  506. package/dist/services/document-service/utils/populate.d.ts +9 -2
  507. package/dist/services/document-service/utils/populate.d.ts.map +1 -1
  508. package/dist/services/document-service/utils/populate.js +4 -4
  509. package/dist/services/document-service/utils/populate.js.map +1 -1
  510. package/dist/services/document-service/utils/populate.mjs +4 -4
  511. package/dist/services/document-service/utils/populate.mjs.map +1 -1
  512. package/dist/services/entity-service/index.d.ts +4 -6
  513. package/dist/services/entity-service/index.d.ts.map +1 -1
  514. package/dist/services/entity-service/index.js +44 -203
  515. package/dist/services/entity-service/index.js.map +1 -1
  516. package/dist/services/entity-service/index.mjs +38 -197
  517. package/dist/services/entity-service/index.mjs.map +1 -1
  518. package/dist/services/entity-validator/index.d.ts +15 -2
  519. package/dist/services/entity-validator/index.d.ts.map +1 -1
  520. package/dist/services/entity-validator/index.js +182 -109
  521. package/dist/services/entity-validator/index.js.map +1 -1
  522. package/dist/services/entity-validator/index.mjs +182 -109
  523. package/dist/services/entity-validator/index.mjs.map +1 -1
  524. package/dist/services/entity-validator/validators.d.ts +24 -22
  525. package/dist/services/entity-validator/validators.d.ts.map +1 -1
  526. package/dist/services/entity-validator/validators.js +65 -19
  527. package/dist/services/entity-validator/validators.js.map +1 -1
  528. package/dist/services/entity-validator/validators.mjs +58 -11
  529. package/dist/services/entity-validator/validators.mjs.map +1 -1
  530. package/dist/services/event-hub.d.ts +1 -0
  531. package/dist/services/event-hub.d.ts.map +1 -1
  532. package/dist/services/event-hub.js +9 -4
  533. package/dist/services/event-hub.js.map +1 -1
  534. package/dist/services/event-hub.mjs +9 -4
  535. package/dist/services/event-hub.mjs.map +1 -1
  536. package/dist/services/features.d.ts +3 -3
  537. package/dist/services/features.d.ts.map +1 -1
  538. package/dist/services/features.js.map +1 -1
  539. package/dist/services/features.mjs.map +1 -1
  540. package/dist/services/fs.d.ts +2 -2
  541. package/dist/services/fs.d.ts.map +1 -1
  542. package/dist/services/fs.js.map +1 -1
  543. package/dist/services/fs.mjs.map +1 -1
  544. package/dist/services/metrics/admin-user-hash.d.ts +2 -2
  545. package/dist/services/metrics/admin-user-hash.d.ts.map +1 -1
  546. package/dist/services/metrics/admin-user-hash.js.map +1 -1
  547. package/dist/services/metrics/admin-user-hash.mjs.map +1 -1
  548. package/dist/services/metrics/index.d.ts +2 -2
  549. package/dist/services/metrics/index.d.ts.map +1 -1
  550. package/dist/services/metrics/index.js.map +1 -1
  551. package/dist/services/metrics/index.mjs.map +1 -1
  552. package/dist/services/metrics/middleware.d.ts +2 -2
  553. package/dist/services/metrics/middleware.d.ts.map +1 -1
  554. package/dist/services/metrics/middleware.js.map +1 -1
  555. package/dist/services/metrics/middleware.mjs.map +1 -1
  556. package/dist/services/metrics/rate-limiter.d.ts.map +1 -1
  557. package/dist/services/metrics/rate-limiter.js.map +1 -1
  558. package/dist/services/metrics/rate-limiter.mjs.map +1 -1
  559. package/dist/services/metrics/sender.d.ts +3 -3
  560. package/dist/services/metrics/sender.d.ts.map +1 -1
  561. package/dist/services/metrics/sender.js.map +1 -1
  562. package/dist/services/metrics/sender.mjs.map +1 -1
  563. package/dist/services/query-params.d.ts +7 -0
  564. package/dist/services/query-params.d.ts.map +1 -0
  565. package/dist/services/query-params.js +12 -0
  566. package/dist/services/query-params.js.map +1 -0
  567. package/dist/services/query-params.mjs +13 -0
  568. package/dist/services/query-params.mjs.map +1 -0
  569. package/dist/services/reloader.d.ts +7 -0
  570. package/dist/services/reloader.d.ts.map +1 -0
  571. package/dist/services/reloader.js +36 -0
  572. package/dist/services/reloader.js.map +1 -0
  573. package/dist/services/reloader.mjs +36 -0
  574. package/dist/services/reloader.mjs.map +1 -0
  575. package/dist/services/server/admin-api.d.ts +3 -3
  576. package/dist/services/server/admin-api.d.ts.map +1 -1
  577. package/dist/services/server/admin-api.js.map +1 -1
  578. package/dist/services/server/admin-api.mjs.map +1 -1
  579. package/dist/services/server/api.d.ts +3 -3
  580. package/dist/services/server/api.d.ts.map +1 -1
  581. package/dist/services/server/api.js.map +1 -1
  582. package/dist/services/server/api.mjs.map +1 -1
  583. package/dist/services/server/compose-endpoint.d.ts +2 -2
  584. package/dist/services/server/compose-endpoint.d.ts.map +1 -1
  585. package/dist/services/server/compose-endpoint.js +1 -2
  586. package/dist/services/server/compose-endpoint.js.map +1 -1
  587. package/dist/services/server/compose-endpoint.mjs +2 -3
  588. package/dist/services/server/compose-endpoint.mjs.map +1 -1
  589. package/dist/services/server/content-api.d.ts +3 -3
  590. package/dist/services/server/content-api.d.ts.map +1 -1
  591. package/dist/services/server/content-api.js.map +1 -1
  592. package/dist/services/server/content-api.mjs.map +1 -1
  593. package/dist/services/server/http-server.d.ts +2 -2
  594. package/dist/services/server/http-server.d.ts.map +1 -1
  595. package/dist/services/server/http-server.js.map +1 -1
  596. package/dist/services/server/http-server.mjs.map +1 -1
  597. package/dist/services/server/index.d.ts +2 -2
  598. package/dist/services/server/index.d.ts.map +1 -1
  599. package/dist/services/server/index.js +2 -3
  600. package/dist/services/server/index.js.map +1 -1
  601. package/dist/services/server/index.mjs +2 -3
  602. package/dist/services/server/index.mjs.map +1 -1
  603. package/dist/services/server/koa.d.ts.map +1 -1
  604. package/dist/services/server/koa.js +1 -1
  605. package/dist/services/server/koa.js.map +1 -1
  606. package/dist/services/server/koa.mjs +1 -1
  607. package/dist/services/server/koa.mjs.map +1 -1
  608. package/dist/services/server/middleware.d.ts +4 -4
  609. package/dist/services/server/middleware.d.ts.map +1 -1
  610. package/dist/services/server/middleware.js.map +1 -1
  611. package/dist/services/server/middleware.mjs.map +1 -1
  612. package/dist/services/server/policy.d.ts +3 -3
  613. package/dist/services/server/policy.d.ts.map +1 -1
  614. package/dist/services/server/policy.js +4 -4
  615. package/dist/services/server/policy.js.map +1 -1
  616. package/dist/services/server/policy.mjs +4 -4
  617. package/dist/services/server/policy.mjs.map +1 -1
  618. package/dist/services/server/register-middlewares.d.ts +2 -2
  619. package/dist/services/server/register-middlewares.d.ts.map +1 -1
  620. package/dist/services/server/register-middlewares.js.map +1 -1
  621. package/dist/services/server/register-middlewares.mjs.map +1 -1
  622. package/dist/services/server/register-routes.d.ts +2 -2
  623. package/dist/services/server/register-routes.d.ts.map +1 -1
  624. package/dist/services/server/register-routes.js +3 -3
  625. package/dist/services/server/register-routes.js.map +1 -1
  626. package/dist/services/server/register-routes.mjs +3 -3
  627. package/dist/services/server/register-routes.mjs.map +1 -1
  628. package/dist/services/server/routing.d.ts +5 -5
  629. package/dist/services/server/routing.d.ts.map +1 -1
  630. package/dist/services/server/routing.js.map +1 -1
  631. package/dist/services/server/routing.mjs.map +1 -1
  632. package/dist/services/utils/dynamic-zones.d.ts.map +1 -1
  633. package/dist/services/utils/dynamic-zones.js +2 -1
  634. package/dist/services/utils/dynamic-zones.js.map +1 -1
  635. package/dist/services/utils/dynamic-zones.mjs +2 -1
  636. package/dist/services/utils/dynamic-zones.mjs.map +1 -1
  637. package/dist/services/webhook-runner.d.ts +2 -1
  638. package/dist/services/webhook-runner.d.ts.map +1 -1
  639. package/dist/services/webhook-runner.js.map +1 -1
  640. package/dist/services/webhook-runner.mjs.map +1 -1
  641. package/dist/services/webhook-store.d.ts +2 -8
  642. package/dist/services/webhook-store.d.ts.map +1 -1
  643. package/dist/services/webhook-store.js +14 -8
  644. package/dist/services/webhook-store.js.map +1 -1
  645. package/dist/services/webhook-store.mjs +14 -8
  646. package/dist/services/webhook-store.mjs.map +1 -1
  647. package/dist/utils/convert-custom-field-type.d.ts +2 -2
  648. package/dist/utils/convert-custom-field-type.d.ts.map +1 -1
  649. package/dist/utils/convert-custom-field-type.js.map +1 -1
  650. package/dist/utils/convert-custom-field-type.mjs.map +1 -1
  651. package/dist/utils/fetch.d.ts +3 -3
  652. package/dist/utils/fetch.d.ts.map +1 -1
  653. package/dist/utils/fetch.js +4 -3
  654. package/dist/utils/fetch.js.map +1 -1
  655. package/dist/utils/fetch.mjs +4 -3
  656. package/dist/utils/fetch.mjs.map +1 -1
  657. package/dist/utils/index.d.ts +2 -1
  658. package/dist/utils/index.d.ts.map +1 -1
  659. package/dist/utils/is-initialized.d.ts +2 -2
  660. package/dist/utils/is-initialized.d.ts.map +1 -1
  661. package/dist/utils/is-initialized.js +1 -1
  662. package/dist/utils/is-initialized.js.map +1 -1
  663. package/dist/utils/is-initialized.mjs +1 -1
  664. package/dist/utils/is-initialized.mjs.map +1 -1
  665. package/dist/utils/load-files.d.ts.map +1 -1
  666. package/dist/utils/open-browser.d.ts +2 -2
  667. package/dist/utils/open-browser.d.ts.map +1 -1
  668. package/dist/utils/open-browser.js.map +1 -1
  669. package/dist/utils/open-browser.mjs.map +1 -1
  670. package/dist/utils/resolve-working-dirs.d.ts +19 -0
  671. package/dist/utils/resolve-working-dirs.d.ts.map +1 -0
  672. package/dist/utils/resolve-working-dirs.js +13 -0
  673. package/dist/utils/resolve-working-dirs.js.map +1 -0
  674. package/dist/utils/resolve-working-dirs.mjs +11 -0
  675. package/dist/utils/resolve-working-dirs.mjs.map +1 -0
  676. package/dist/utils/signals.d.ts +2 -2
  677. package/dist/utils/signals.d.ts.map +1 -1
  678. package/dist/utils/signals.js.map +1 -1
  679. package/dist/utils/signals.mjs.map +1 -1
  680. package/dist/utils/startup-logger.d.ts +2 -2
  681. package/dist/utils/startup-logger.d.ts.map +1 -1
  682. package/dist/utils/startup-logger.js.map +1 -1
  683. package/dist/utils/startup-logger.mjs.map +1 -1
  684. package/dist/utils/transform-content-types-to-models.d.ts +54 -99
  685. package/dist/utils/transform-content-types-to-models.d.ts.map +1 -1
  686. package/dist/utils/transform-content-types-to-models.js +105 -57
  687. package/dist/utils/transform-content-types-to-models.js.map +1 -1
  688. package/dist/utils/transform-content-types-to-models.mjs +105 -57
  689. package/dist/utils/transform-content-types-to-models.mjs.map +1 -1
  690. package/dist/utils/update-notifier/index.d.ts +2 -7
  691. package/dist/utils/update-notifier/index.d.ts.map +1 -1
  692. package/dist/utils/update-notifier/index.js +11 -14
  693. package/dist/utils/update-notifier/index.js.map +1 -1
  694. package/dist/utils/update-notifier/index.mjs +11 -14
  695. package/dist/utils/update-notifier/index.mjs.map +1 -1
  696. package/package.json +32 -28
  697. package/dist/registries/config.d.ts +0 -4
  698. package/dist/registries/config.d.ts.map +0 -1
  699. package/dist/registries/config.js +0 -31
  700. package/dist/registries/config.js.map +0 -1
  701. package/dist/registries/config.mjs +0 -32
  702. package/dist/registries/config.mjs.map +0 -1
  703. package/dist/services/document-service/middlewares.d.ts +0 -8
  704. package/dist/services/document-service/middlewares.d.ts.map +0 -1
  705. package/dist/services/document-service/middlewares.js.map +0 -1
  706. package/dist/services/document-service/middlewares.mjs.map +0 -1
  707. package/dist/services/document-service/transform/filters.d.ts +0 -3
  708. package/dist/services/document-service/transform/filters.d.ts.map +0 -1
  709. package/dist/services/document-service/transform/relations/transform/output-ids.d.ts +0 -4
  710. package/dist/services/document-service/transform/relations/transform/output-ids.d.ts.map +0 -1
  711. package/dist/services/document-service/transform/relations/utils/data.js +0 -12
  712. package/dist/services/document-service/transform/relations/utils/data.js.map +0 -1
  713. package/dist/services/document-service/transform/relations/utils/data.mjs +0 -12
  714. package/dist/services/document-service/transform/relations/utils/data.mjs.map +0 -1
  715. package/dist/services/document-service/transform/sort.d.ts +0 -5
  716. package/dist/services/document-service/transform/sort.d.ts.map +0 -1
  717. package/dist/services/document-service/transform/utils.d.ts +0 -9
  718. package/dist/services/document-service/transform/utils.d.ts.map +0 -1
  719. package/dist/services/entity-service/attributes/index.d.ts +0 -6
  720. package/dist/services/entity-service/attributes/index.d.ts.map +0 -1
  721. package/dist/services/entity-service/attributes/index.js.map +0 -1
  722. package/dist/services/entity-service/attributes/index.mjs.map +0 -1
  723. package/dist/services/entity-service/attributes/transforms.d.ts +0 -10
  724. package/dist/services/entity-service/attributes/transforms.d.ts.map +0 -1
  725. package/dist/services/entity-service/attributes/transforms.js.map +0 -1
  726. package/dist/services/entity-service/attributes/transforms.mjs.map +0 -1
  727. package/dist/services/entity-service/components.d.ts +0 -23
  728. package/dist/services/entity-service/components.d.ts.map +0 -1
  729. package/dist/services/entity-service/components.js.map +0 -1
  730. package/dist/services/entity-service/components.mjs.map +0 -1
  731. package/dist/services/entity-service/params.d.ts +0 -8
  732. package/dist/services/entity-service/params.d.ts.map +0 -1
  733. package/dist/services/entity-service/params.js.map +0 -1
  734. package/dist/services/entity-service/params.mjs.map +0 -1
  735. package/dist/services/utils/upload-files.d.ts +0 -8
  736. package/dist/services/utils/upload-files.d.ts.map +0 -1
  737. package/dist/services/utils/upload-files.js +0 -64
  738. package/dist/services/utils/upload-files.js.map +0 -1
  739. package/dist/services/utils/upload-files.mjs +0 -63
  740. package/dist/services/utils/upload-files.mjs.map +0 -1
  741. package/dist/utils/get-dirs.d.ts +0 -9
  742. package/dist/utils/get-dirs.d.ts.map +0 -1
  743. package/dist/utils/get-dirs.js.map +0 -1
  744. package/dist/utils/get-dirs.mjs.map +0 -1
  745. /package/dist/services/{entity-service → document-service}/attributes/transforms.js +0 -0
  746. /package/dist/services/{entity-service → document-service}/attributes/transforms.mjs +0 -0
  747. /package/dist/services/{entity-service → document-service}/params.js +0 -0
  748. /package/dist/services/{entity-service → document-service}/params.mjs +0 -0
@@ -9,7 +9,10 @@ const { yup, validateYupSchema } = strapiUtils__default.default;
9
9
  const { isMediaAttribute, isScalarAttribute, getWritableAttributes } = strapiUtils__default.default.contentTypes;
10
10
  const { ValidationError } = strapiUtils__default.default.errors;
11
11
  const isInteger = (value) => Number.isInteger(value);
12
- const addMinMax = (validator, { attr, updatedAttribute }) => {
12
+ const addMinMax = (validator, {
13
+ attr,
14
+ updatedAttribute
15
+ }) => {
13
16
  let nextValidator = validator;
14
17
  if (isInteger(attr.min) && ("required" in attr && attr.required || Array.isArray(updatedAttribute.value) && updatedAttribute.value.length > 0)) {
15
18
  nextValidator = nextValidator.min(attr.min);
@@ -20,7 +23,9 @@ const addMinMax = (validator, { attr, updatedAttribute }) => {
20
23
  return nextValidator;
21
24
  };
22
25
  const addRequiredValidation = (createOrUpdate) => {
23
- return (validator, { attr: { required } }) => {
26
+ return (validator, {
27
+ attr: { required }
28
+ }) => {
24
29
  let nextValidator = validator;
25
30
  if (required) {
26
31
  if (createOrUpdate === "creation") {
@@ -50,7 +55,11 @@ const addDefault = (createOrUpdate) => {
50
55
  };
51
56
  };
52
57
  const preventCast = (validator) => validator.transform((val, originalVal) => originalVal);
53
- const createComponentValidator = (createOrUpdate) => ({ attr, updatedAttribute }, { isDraft }) => {
58
+ const createComponentValidator = (createOrUpdate) => ({
59
+ attr,
60
+ updatedAttribute,
61
+ componentContext
62
+ }, { isDraft }) => {
54
63
  const model = strapi.getModel(attr.component);
55
64
  if (!model) {
56
65
  throw new Error("Validation failed: Model not found");
@@ -58,7 +67,10 @@ const createComponentValidator = (createOrUpdate) => ({ attr, updatedAttribute }
58
67
  if (attr?.repeatable) {
59
68
  let validator2 = yup.array().of(
60
69
  yup.lazy(
61
- (item) => createModelValidator(createOrUpdate)({ model, data: item }, { isDraft }).notNull()
70
+ (item) => createModelValidator(createOrUpdate)(
71
+ { componentContext, model, data: item },
72
+ { isDraft }
73
+ ).notNull()
62
74
  )
63
75
  );
64
76
  validator2 = addRequiredValidation(createOrUpdate)(validator2, {
@@ -69,7 +81,11 @@ const createComponentValidator = (createOrUpdate) => ({ attr, updatedAttribute }
69
81
  return validator2;
70
82
  }
71
83
  let validator = createModelValidator(createOrUpdate)(
72
- { model, data: updatedAttribute.value },
84
+ {
85
+ model,
86
+ data: updatedAttribute.value,
87
+ componentContext
88
+ },
73
89
  { isDraft }
74
90
  );
75
91
  validator = addRequiredValidation(createOrUpdate)(validator, {
@@ -78,7 +94,7 @@ const createComponentValidator = (createOrUpdate) => ({ attr, updatedAttribute }
78
94
  });
79
95
  return validator;
80
96
  };
81
- const createDzValidator = (createOrUpdate) => ({ attr, updatedAttribute }, { isDraft }) => {
97
+ const createDzValidator = (createOrUpdate) => ({ attr, updatedAttribute, componentContext }, { isDraft }) => {
82
98
  let validator;
83
99
  validator = yup.array().of(
84
100
  yup.lazy((item) => {
@@ -86,7 +102,12 @@ const createDzValidator = (createOrUpdate) => ({ attr, updatedAttribute }, { isD
86
102
  const schema = yup.object().shape({
87
103
  __component: yup.string().required().oneOf(Object.keys(strapi.components))
88
104
  }).notNull();
89
- return model ? schema.concat(createModelValidator(createOrUpdate)({ model, data: item }, { isDraft })) : schema;
105
+ return model ? schema.concat(
106
+ createModelValidator(createOrUpdate)(
107
+ { model, data: item, componentContext },
108
+ { isDraft }
109
+ )
110
+ ) : schema;
90
111
  })
91
112
  // FIXME: yup v1
92
113
  );
@@ -131,12 +152,37 @@ const createAttributeValidator = (createOrUpdate) => (metas, options) => {
131
152
  validator = createScalarAttributeValidator(createOrUpdate)(metas, options);
132
153
  } else {
133
154
  if (metas.attr.type === "component") {
155
+ const pathToComponent = [
156
+ ...metas?.componentContext?.pathToComponent ?? [],
157
+ metas.updatedAttribute.name
158
+ ];
159
+ const repeatableData = metas.attr.repeatable && pathToComponent.length === 1 ? metas.updatedAttribute.value : metas.componentContext?.repeatableData;
160
+ const newComponentContext = {
161
+ ...metas?.componentContext ?? {},
162
+ pathToComponent,
163
+ repeatableData
164
+ };
134
165
  validator = createComponentValidator(createOrUpdate)(
135
- { attr: metas.attr, updatedAttribute: metas.updatedAttribute },
166
+ {
167
+ componentContext: newComponentContext,
168
+ attr: metas.attr,
169
+ updatedAttribute: metas.updatedAttribute
170
+ },
136
171
  options
137
172
  );
138
173
  } else if (metas.attr.type === "dynamiczone") {
139
- validator = createDzValidator(createOrUpdate)(metas, options);
174
+ const pathToComponent = [
175
+ ...metas?.componentContext?.pathToComponent ?? [],
176
+ metas.updatedAttribute.name
177
+ ];
178
+ const newComponentContext = {
179
+ ...metas?.componentContext ?? {},
180
+ pathToComponent
181
+ };
182
+ validator = createDzValidator(createOrUpdate)(
183
+ { ...metas, componentContext: newComponentContext },
184
+ options
185
+ );
140
186
  } else if (metas.attr.type === "relation") {
141
187
  validator = createRelationValidator(createOrUpdate)(
142
188
  {
@@ -151,19 +197,23 @@ const createAttributeValidator = (createOrUpdate) => (metas, options) => {
151
197
  validator = addDefault(createOrUpdate)(validator, metas);
152
198
  return validator;
153
199
  };
154
- const createModelValidator = (createOrUpdate) => ({ model, data, entity }, options) => {
200
+ const createModelValidator = (createOrUpdate) => ({ componentContext, model, data, entity }, options) => {
155
201
  const writableAttributes = model ? getWritableAttributes(model) : [];
156
- const schema = writableAttributes.reduce((validators2, attributeName) => {
157
- const metas = {
158
- attr: model.attributes[attributeName],
159
- updatedAttribute: { name: attributeName, value: _.prop(attributeName, data) },
160
- model,
161
- entity
162
- };
163
- const validator = createAttributeValidator(createOrUpdate)(metas, options);
164
- validators2[attributeName] = validator;
165
- return validators2;
166
- }, {});
202
+ const schema = writableAttributes.reduce(
203
+ (validators2, attributeName) => {
204
+ const metas = {
205
+ attr: model.attributes[attributeName],
206
+ updatedAttribute: { name: attributeName, value: _.prop(attributeName, data) },
207
+ model,
208
+ entity,
209
+ componentContext
210
+ };
211
+ const validator = createAttributeValidator(createOrUpdate)(metas, options);
212
+ validators2[attributeName] = validator;
213
+ return validators2;
214
+ },
215
+ {}
216
+ );
167
217
  return yup.object().shape(schema);
168
218
  };
169
219
  const createValidateEntity = (createOrUpdate) => {
@@ -175,22 +225,42 @@ const createValidateEntity = (createOrUpdate) => {
175
225
  );
176
226
  }
177
227
  const validator = createModelValidator(createOrUpdate)(
178
- { model, data, entity },
228
+ {
229
+ model,
230
+ data,
231
+ entity,
232
+ componentContext: {
233
+ // Set up the initial component context.
234
+ // Keeping track of parent content type context in which a component will be used.
235
+ // This is necessary to validate component field constraints such as uniqueness.
236
+ parentContent: {
237
+ id: entity?.id,
238
+ model,
239
+ options
240
+ },
241
+ pathToComponent: [],
242
+ repeatableData: []
243
+ }
244
+ },
179
245
  {
180
246
  isDraft: options?.isDraft ?? false,
181
247
  locale: options?.locale ?? null
182
248
  }
183
- ).test("relations-test", "check that all relations exist", async function(data2) {
184
- try {
185
- await checkRelationsExist(buildRelationsStore({ uid: model.uid, data: data2 }));
186
- } catch (e) {
187
- return this.createError({
188
- path: this.path,
189
- message: e instanceof ValidationError && e.message || "Invalid relations"
190
- });
249
+ ).test(
250
+ "relations-test",
251
+ "check that all relations exist",
252
+ async function relationsValidation(data2) {
253
+ try {
254
+ await checkRelationsExist(buildRelationsStore({ uid: model.uid, data: data2 }));
255
+ } catch (e) {
256
+ return this.createError({
257
+ path: this.path,
258
+ message: e instanceof ValidationError && e.message || "Invalid relations"
259
+ });
260
+ }
261
+ return true;
191
262
  }
192
- return true;
193
- }).required();
263
+ ).required();
194
264
  return validateYupSchema(validator, {
195
265
  strict: false,
196
266
  abortEarly: false
@@ -208,96 +278,99 @@ const buildRelationsStore = ({
208
278
  return {};
209
279
  }
210
280
  const currentModel = strapi.getModel(uid);
211
- return Object.keys(currentModel.attributes).reduce((result, attributeName) => {
212
- const attribute = currentModel.attributes[attributeName];
213
- const value = data[attributeName];
214
- if (_$1.isNil(value)) {
215
- return result;
216
- }
217
- switch (attribute.type) {
218
- case "relation":
219
- case "media": {
220
- if (attribute.type === "relation" && (attribute.relation === "morphToMany" || attribute.relation === "morphToOne")) {
221
- break;
222
- }
223
- const target = (
224
- // eslint-disable-next-line no-nested-ternary
225
- attribute.type === "media" ? "plugin::upload.file" : attribute.target
226
- );
227
- let source;
228
- if (Array.isArray(value)) {
229
- source = value;
230
- } else if (_.isObject(value)) {
231
- if ("connect" in value && !_$1.isNil(value.connect)) {
232
- source = value.connect;
233
- } else if ("set" in value && !_$1.isNil(value.set)) {
234
- source = value.set;
235
- } else {
236
- source = [];
237
- }
238
- } else {
239
- source = _$1.castArray(value);
240
- }
241
- const idArray = source.map((v) => ({
242
- id: typeof v === "object" ? v.id : v
243
- }));
244
- result[target] = result[target] || [];
245
- result[target].push(...idArray);
246
- break;
281
+ return Object.keys(currentModel.attributes).reduce(
282
+ (result, attributeName) => {
283
+ const attribute = currentModel.attributes[attributeName];
284
+ const value = data[attributeName];
285
+ if (_$1.isNil(value)) {
286
+ return result;
247
287
  }
248
- case "component": {
249
- return _$1.castArray(value).reduce((relationsStore, componentValue) => {
250
- if (!attribute.component) {
251
- throw new ValidationError(
252
- `Cannot build relations store from component, component identifier is undefined`
253
- );
288
+ switch (attribute.type) {
289
+ case "relation":
290
+ case "media": {
291
+ if (attribute.type === "relation" && (attribute.relation === "morphToMany" || attribute.relation === "morphToOne")) {
292
+ break;
254
293
  }
255
- return _$1.mergeWith(
256
- relationsStore,
257
- buildRelationsStore({
258
- uid: attribute.component,
259
- data: componentValue
260
- }),
261
- (objValue, srcValue) => {
262
- if (_$1.isArray(objValue)) {
263
- return objValue.concat(srcValue);
264
- }
265
- }
294
+ const target = (
295
+ // eslint-disable-next-line no-nested-ternary
296
+ attribute.type === "media" ? "plugin::upload.file" : attribute.target
266
297
  );
267
- }, result);
268
- }
269
- case "dynamiczone": {
270
- return _$1.castArray(value).reduce((relationsStore, dzValue) => {
271
- const value2 = dzValue;
272
- if (!value2.__component) {
273
- throw new ValidationError(
274
- `Cannot build relations store from dynamiczone, component identifier is undefined`
275
- );
298
+ let source;
299
+ if (Array.isArray(value)) {
300
+ source = value;
301
+ } else if (_.isObject(value)) {
302
+ if ("connect" in value && !_$1.isNil(value.connect)) {
303
+ source = value.connect;
304
+ } else if ("set" in value && !_$1.isNil(value.set)) {
305
+ source = value.set;
306
+ } else {
307
+ source = [];
308
+ }
309
+ } else {
310
+ source = _$1.castArray(value);
276
311
  }
277
- return _$1.mergeWith(
278
- relationsStore,
279
- buildRelationsStore({
280
- uid: value2.__component,
281
- data: value2
282
- }),
283
- (objValue, srcValue) => {
284
- if (_$1.isArray(objValue)) {
285
- return objValue.concat(srcValue);
312
+ const idArray = source.map((v) => ({
313
+ id: typeof v === "object" ? v.id : v
314
+ }));
315
+ result[target] = result[target] || [];
316
+ result[target].push(...idArray);
317
+ break;
318
+ }
319
+ case "component": {
320
+ return _$1.castArray(value).reduce((relationsStore, componentValue) => {
321
+ if (!attribute.component) {
322
+ throw new ValidationError(
323
+ `Cannot build relations store from component, component identifier is undefined`
324
+ );
325
+ }
326
+ return _$1.mergeWith(
327
+ relationsStore,
328
+ buildRelationsStore({
329
+ uid: attribute.component,
330
+ data: componentValue
331
+ }),
332
+ (objValue, srcValue) => {
333
+ if (_$1.isArray(objValue)) {
334
+ return objValue.concat(srcValue);
335
+ }
286
336
  }
337
+ );
338
+ }, result);
339
+ }
340
+ case "dynamiczone": {
341
+ return _$1.castArray(value).reduce((relationsStore, dzValue) => {
342
+ const value2 = dzValue;
343
+ if (!value2.__component) {
344
+ throw new ValidationError(
345
+ `Cannot build relations store from dynamiczone, component identifier is undefined`
346
+ );
287
347
  }
288
- );
289
- }, result);
348
+ return _$1.mergeWith(
349
+ relationsStore,
350
+ buildRelationsStore({
351
+ uid: value2.__component,
352
+ data: value2
353
+ }),
354
+ (objValue, srcValue) => {
355
+ if (_$1.isArray(objValue)) {
356
+ return objValue.concat(srcValue);
357
+ }
358
+ }
359
+ );
360
+ }, result);
361
+ }
290
362
  }
291
- }
292
- return result;
293
- }, {});
363
+ return result;
364
+ },
365
+ {}
366
+ );
294
367
  };
295
368
  const checkRelationsExist = async (relationsStore = {}) => {
296
369
  const promises = [];
297
370
  for (const [key, value] of Object.entries(relationsStore)) {
298
371
  const evaluate = async () => {
299
372
  const uniqueValues = _$1.uniqBy(value, `id`);
300
- const count = await strapi.query(key).count({
373
+ const count = await strapi.db.query(key).count({
301
374
  where: {
302
375
  id: {
303
376
  $in: uniqueValues.map((v) => v.id)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/services/entity-validator/index.ts"],"sourcesContent":["/**\n * Entity validator\n * Module that will validate input data for entity creation or edition\n */\n\nimport { uniqBy, castArray, isNil, isArray, mergeWith } from 'lodash';\nimport { has, prop, isObject, isEmpty } from 'lodash/fp';\nimport strapiUtils from '@strapi/utils';\nimport { EntityValidator, Common, Schema, Attribute, Shared, EntityService } from '@strapi/types';\nimport validators from './validators';\n\ntype CreateOrUpdate = 'creation' | 'update';\n\nconst { yup, validateYupSchema } = strapiUtils;\nconst { isMediaAttribute, isScalarAttribute, getWritableAttributes } = strapiUtils.contentTypes;\nconst { ValidationError } = strapiUtils.errors;\n\ntype Entity = {\n id: ID;\n [key: string]: unknown;\n} | null;\n\ntype ID = { id: string | number };\n\ntype RelationSource = string | number | ID;\n\ninterface ValidatorMeta<TAttribute = Attribute.Any> {\n attr: TAttribute;\n updatedAttribute: { name: string; value: any };\n}\n\ninterface ValidatorContext {\n isDraft?: boolean;\n locale?: string | null;\n}\n\ninterface AttributeValidatorMetas {\n attr: Attribute.Any;\n updatedAttribute: { name: string; value: unknown };\n model: Schema.ContentType | Schema.Component;\n entity?: Entity;\n}\n\ninterface ModelValidatorMetas {\n model: Schema.ContentType | Schema.Component;\n data: Record<string, unknown>;\n entity?: Entity;\n}\n\nconst isInteger = (value: unknown): value is number => Number.isInteger(value);\n\nconst addMinMax = <\n T extends {\n min(value: number): T;\n max(value: number): T;\n }\n>(\n validator: T,\n { attr, updatedAttribute }: ValidatorMeta<Attribute.Any & Attribute.MinMaxOption<string | number>>\n): T => {\n let nextValidator: T = validator;\n\n if (\n isInteger(attr.min) &&\n (('required' in attr && attr.required) ||\n (Array.isArray(updatedAttribute.value) && updatedAttribute.value.length > 0))\n ) {\n nextValidator = nextValidator.min(attr.min);\n }\n if (isInteger(attr.max)) {\n nextValidator = nextValidator.max(attr.max);\n }\n return nextValidator;\n};\n\nconst addRequiredValidation = (createOrUpdate: CreateOrUpdate) => {\n return <T extends strapiUtils.yup.AnySchema>(\n validator: T,\n { attr: { required } }: ValidatorMeta<Partial<Attribute.Any & Attribute.RequiredOption>>\n ): T => {\n let nextValidator = validator;\n\n if (required) {\n if (createOrUpdate === 'creation') {\n nextValidator = nextValidator.notNil();\n } else if (createOrUpdate === 'update') {\n nextValidator = nextValidator.notNull();\n }\n } else {\n nextValidator = nextValidator.nullable();\n }\n return nextValidator;\n };\n};\n\nconst addDefault = (createOrUpdate: CreateOrUpdate) => {\n return (\n validator: strapiUtils.yup.BaseSchema,\n { attr }: ValidatorMeta<Attribute.Any & Attribute.DefaultOption<unknown>>\n ) => {\n let nextValidator = validator;\n\n if (createOrUpdate === 'creation') {\n if (\n ((attr.type === 'component' && attr.repeatable) || attr.type === 'dynamiczone') &&\n !attr.required\n ) {\n nextValidator = nextValidator.default([]);\n } else {\n nextValidator = nextValidator.default(attr.default);\n }\n } else {\n nextValidator = nextValidator.default(undefined);\n }\n\n return nextValidator;\n };\n};\n\nconst preventCast = (validator: strapiUtils.yup.AnySchema) =>\n validator.transform((val, originalVal) => originalVal);\n\nconst createComponentValidator =\n (createOrUpdate: CreateOrUpdate) =>\n (\n { attr, updatedAttribute }: ValidatorMeta<Attribute.Component<Common.UID.Component, boolean>>,\n { isDraft }: ValidatorContext\n ) => {\n const model = strapi.getModel(attr.component);\n if (!model) {\n throw new Error('Validation failed: Model not found');\n }\n\n if (attr?.repeatable) {\n // FIXME: yup v1\n\n let validator = yup\n .array()\n .of(\n yup.lazy((item) =>\n createModelValidator(createOrUpdate)({ model, data: item }, { isDraft }).notNull()\n ) as any\n );\n\n validator = addRequiredValidation(createOrUpdate)(validator, {\n attr: { required: true },\n updatedAttribute,\n });\n\n validator = addMinMax(validator, { attr, updatedAttribute });\n\n return validator;\n }\n\n // FIXME: v4 was broken\n let validator = createModelValidator(createOrUpdate)(\n { model, data: updatedAttribute.value },\n { isDraft }\n );\n\n validator = addRequiredValidation(createOrUpdate)(validator, {\n attr: { required: !isDraft && attr.required },\n updatedAttribute,\n });\n\n return validator;\n };\n\nconst createDzValidator =\n (createOrUpdate: CreateOrUpdate) =>\n ({ attr, updatedAttribute }: ValidatorMeta, { isDraft }: ValidatorContext) => {\n let validator;\n\n validator = yup.array().of(\n yup.lazy((item) => {\n const model = strapi.getModel(prop('__component', item));\n const schema = yup\n .object()\n .shape({\n __component: yup.string().required().oneOf(Object.keys(strapi.components)),\n })\n .notNull();\n\n return model\n ? schema.concat(createModelValidator(createOrUpdate)({ model, data: item }, { isDraft }))\n : schema;\n }) as any // FIXME: yup v1\n );\n\n validator = addRequiredValidation(createOrUpdate)(validator, {\n attr: { required: true },\n updatedAttribute,\n });\n\n validator = addMinMax(validator, { attr, updatedAttribute });\n\n return validator;\n };\n\nconst createRelationValidator =\n (createOrUpdate: CreateOrUpdate) =>\n (\n { attr, updatedAttribute }: ValidatorMeta<Attribute.Relation>,\n { isDraft }: ValidatorContext\n ) => {\n let validator;\n\n if (Array.isArray(updatedAttribute.value)) {\n validator = yup.array().of(yup.mixed());\n } else {\n validator = yup.mixed();\n }\n\n validator = addRequiredValidation(createOrUpdate)(validator, {\n attr: { required: !isDraft && attr.required },\n updatedAttribute,\n });\n\n return validator;\n };\n\nconst createScalarAttributeValidator =\n (createOrUpdate: CreateOrUpdate) => (metas: ValidatorMeta, options: ValidatorContext) => {\n let validator;\n\n if (has(metas.attr.type, validators)) {\n validator = (validators as any)[metas.attr.type](metas, options);\n } else {\n // No validators specified - fall back to mixed\n validator = yup.mixed();\n }\n\n validator = addRequiredValidation(createOrUpdate)(validator, {\n attr: { required: !options.isDraft && metas.attr.required },\n updatedAttribute: metas.updatedAttribute,\n });\n\n return validator;\n };\n\nconst createAttributeValidator =\n (createOrUpdate: CreateOrUpdate) =>\n (metas: AttributeValidatorMetas, options: ValidatorContext) => {\n let validator = yup.mixed();\n\n if (isMediaAttribute(metas.attr)) {\n validator = yup.mixed();\n } else if (isScalarAttribute(metas.attr)) {\n validator = createScalarAttributeValidator(createOrUpdate)(metas, options);\n } else {\n if (metas.attr.type === 'component') {\n validator = createComponentValidator(createOrUpdate)(\n { attr: metas.attr, updatedAttribute: metas.updatedAttribute },\n options\n );\n } else if (metas.attr.type === 'dynamiczone') {\n validator = createDzValidator(createOrUpdate)(metas, options);\n } else if (metas.attr.type === 'relation') {\n validator = createRelationValidator(createOrUpdate)(\n {\n attr: metas.attr,\n updatedAttribute: metas.updatedAttribute,\n },\n options\n );\n }\n\n validator = preventCast(validator);\n }\n\n validator = addDefault(createOrUpdate)(validator, metas);\n\n return validator;\n };\n\nconst createModelValidator =\n (createOrUpdate: CreateOrUpdate) =>\n ({ model, data, entity }: ModelValidatorMetas, options: ValidatorContext) => {\n const writableAttributes = model ? getWritableAttributes(model as any) : [];\n\n const schema = writableAttributes.reduce((validators, attributeName) => {\n const metas = {\n attr: model.attributes[attributeName],\n updatedAttribute: { name: attributeName, value: prop(attributeName, data) },\n model,\n entity,\n };\n\n const validator = createAttributeValidator(createOrUpdate)(metas, options);\n\n validators[attributeName] = validator;\n\n return validators;\n }, {} as Record<string, strapiUtils.yup.BaseSchema>);\n\n return yup.object().shape(schema);\n };\n\nconst createValidateEntity = (createOrUpdate: CreateOrUpdate) => {\n return async <\n TUID extends Common.UID.ContentType,\n TData extends EntityService.Params.Data.Input<TUID>\n >(\n model: Shared.ContentTypes[TUID],\n data: TData | Partial<TData> | undefined,\n options?: ValidatorContext,\n entity?: Entity\n ): Promise<TData> => {\n if (!isObject(data)) {\n const { displayName } = model.info;\n\n throw new ValidationError(\n `Invalid payload submitted for the ${createOrUpdate} of an entity of type ${displayName}. Expected an object, but got ${typeof data}`\n );\n }\n\n const validator = createModelValidator(createOrUpdate)(\n { model, data, entity },\n {\n isDraft: options?.isDraft ?? false,\n locale: options?.locale ?? null,\n }\n )\n .test('relations-test', 'check that all relations exist', async function (data) {\n try {\n await checkRelationsExist(buildRelationsStore({ uid: model.uid, data }));\n } catch (e) {\n return this.createError({\n path: this.path,\n message: (e instanceof ValidationError && e.message) || 'Invalid relations',\n });\n }\n return true;\n })\n .required();\n\n return validateYupSchema(validator, {\n strict: false,\n abortEarly: false,\n })(data);\n };\n};\n\n/**\n * Builds an object containing all the media and relations being associated with an entity\n */\nconst buildRelationsStore = <TUID extends Common.UID.ContentType | Common.UID.Component>({\n uid,\n data,\n}: {\n uid: TUID;\n data: Record<string, unknown> | null;\n}): Record<string, ID[]> => {\n if (!uid) {\n throw new ValidationError(`Cannot build relations store: \"uid\" is undefined`);\n }\n\n if (isEmpty(data)) {\n return {};\n }\n\n const currentModel = strapi.getModel(uid);\n\n return Object.keys(currentModel.attributes).reduce((result, attributeName: string) => {\n const attribute = currentModel.attributes[attributeName];\n const value = data[attributeName];\n\n if (isNil(value)) {\n return result;\n }\n\n switch (attribute.type) {\n case 'relation':\n case 'media': {\n if (\n attribute.type === 'relation' &&\n (attribute.relation === 'morphToMany' || attribute.relation === 'morphToOne')\n ) {\n // TODO: handle polymorphic relations\n break;\n }\n\n const target =\n // eslint-disable-next-line no-nested-ternary\n attribute.type === 'media' ? 'plugin::upload.file' : attribute.target;\n // As there are multiple formats supported for associating relations\n // with an entity, the value here can be an: array, object or number.\n let source: RelationSource[];\n if (Array.isArray(value)) {\n source = value;\n } else if (isObject(value)) {\n if ('connect' in value && !isNil(value.connect)) {\n source = value.connect as RelationSource[];\n } else if ('set' in value && !isNil(value.set)) {\n source = value.set as RelationSource[];\n } else {\n source = [];\n }\n } else {\n source = castArray(value as RelationSource);\n }\n const idArray = source.map((v) => ({\n id: typeof v === 'object' ? v.id : v,\n }));\n\n // Update the relationStore to keep track of all associations being made\n // with relations and media.\n result[target] = result[target] || [];\n result[target].push(...idArray);\n break;\n }\n case 'component': {\n return castArray(value).reduce((relationsStore, componentValue) => {\n if (!attribute.component) {\n throw new ValidationError(\n `Cannot build relations store from component, component identifier is undefined`\n );\n }\n\n return mergeWith(\n relationsStore,\n buildRelationsStore({\n uid: attribute.component,\n data: componentValue as Record<string, unknown>,\n }),\n (objValue, srcValue) => {\n if (isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n }\n );\n }, result) as Record<string, ID[]>;\n }\n case 'dynamiczone': {\n return castArray(value).reduce((relationsStore, dzValue) => {\n const value = dzValue as Record<string, unknown>;\n if (!value.__component) {\n throw new ValidationError(\n `Cannot build relations store from dynamiczone, component identifier is undefined`\n );\n }\n\n return mergeWith(\n relationsStore,\n buildRelationsStore({\n uid: value.__component as Common.UID.Component,\n data: value,\n }),\n (objValue, srcValue) => {\n if (isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n }\n );\n }, result) as Record<string, ID[]>;\n }\n default:\n break;\n }\n\n return result;\n }, {} as Record<string, ID[]>);\n};\n\n/**\n * Iterate through the relations store and validates that every relation or media\n * mentioned exists\n */\nconst checkRelationsExist = async (relationsStore: Record<string, ID[]> = {}) => {\n const promises = [];\n\n for (const [key, value] of Object.entries(relationsStore)) {\n const evaluate = async () => {\n const uniqueValues = uniqBy(value, `id`);\n const count = await strapi.query(key as Common.UID.Schema).count({\n where: {\n id: {\n $in: uniqueValues.map((v) => v.id),\n },\n },\n });\n\n if (count !== uniqueValues.length) {\n throw new ValidationError(\n `${\n uniqueValues.length - count\n } relation(s) of type ${key} associated with this entity do not exist`\n );\n }\n };\n promises.push(evaluate());\n }\n\n return Promise.all(promises);\n};\n\nconst entityValidator: EntityValidator = {\n validateEntityCreation: createValidateEntity('creation'),\n validateEntityUpdate: createValidateEntity('update'),\n};\n\nexport default entityValidator;\n"],"names":["strapiUtils","validator","prop","has","validators","isObject","data","isEmpty","isNil","castArray","mergeWith","isArray","value","uniqBy"],"mappings":";;;;;;;AAaA,MAAM,EAAE,KAAK,kBAAsB,IAAAA;AACnC,MAAM,EAAE,kBAAkB,mBAAmB,sBAAA,IAA0BA,qBAAAA,QAAY;AACnF,MAAM,EAAE,gBAAgB,IAAIA,qBAAY,QAAA;AAkCxC,MAAM,YAAY,CAAC,UAAoC,OAAO,UAAU,KAAK;AAE7E,MAAM,YAAY,CAMhB,WACA,EAAE,MAAM,uBACF;AACN,MAAI,gBAAmB;AAEvB,MACE,UAAU,KAAK,GAAG,MAChB,cAAc,QAAQ,KAAK,YAC1B,MAAM,QAAQ,iBAAiB,KAAK,KAAK,iBAAiB,MAAM,SAAS,IAC5E;AACgB,oBAAA,cAAc,IAAI,KAAK,GAAG;AAAA,EAC5C;AACI,MAAA,UAAU,KAAK,GAAG,GAAG;AACP,oBAAA,cAAc,IAAI,KAAK,GAAG;AAAA,EAC5C;AACO,SAAA;AACT;AAEA,MAAM,wBAAwB,CAAC,mBAAmC;AAChE,SAAO,CACL,WACA,EAAE,MAAM,EAAE,iBACJ;AACN,QAAI,gBAAgB;AAEpB,QAAI,UAAU;AACZ,UAAI,mBAAmB,YAAY;AACjC,wBAAgB,cAAc;MAAO,WAC5B,mBAAmB,UAAU;AACtC,wBAAgB,cAAc;MAChC;AAAA,IAAA,OACK;AACL,sBAAgB,cAAc;IAChC;AACO,WAAA;AAAA,EAAA;AAEX;AAEA,MAAM,aAAa,CAAC,mBAAmC;AACrD,SAAO,CACL,WACA,EAAE,WACC;AACH,QAAI,gBAAgB;AAEpB,QAAI,mBAA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,IAAI;AAAA,UACR,GACE,aAAa,SAAS,KACxB,wBAAwB,GAAG;AAAA,QAAA;AAAA,MAE/B;AAAA,IAAA;AAEO,aAAA,KAAK,UAAU;AAAA,EAC1B;AAEO,SAAA,QAAQ,IAAI,QAAQ;AAC7B;AAEA,MAAM,kBAAmC;AAAA,EACvC,wBAAwB,qBAAqB,UAAU;AAAA,EACvD,sBAAsB,qBAAqB,QAAQ;AACrD;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/services/entity-validator/index.ts"],"sourcesContent":["/**\n * Entity validator\n * Module that will validate input data for entity creation or edition\n */\n\nimport { uniqBy, castArray, isNil, isArray, mergeWith } from 'lodash';\nimport { has, prop, isObject, isEmpty } from 'lodash/fp';\nimport strapiUtils from '@strapi/utils';\nimport { Modules, UID, Struct, Schema } from '@strapi/types';\nimport validators from './validators';\n\ntype CreateOrUpdate = 'creation' | 'update';\n\nconst { yup, validateYupSchema } = strapiUtils;\nconst { isMediaAttribute, isScalarAttribute, getWritableAttributes } = strapiUtils.contentTypes;\nconst { ValidationError } = strapiUtils.errors;\n\ntype ID = { id: string | number };\n\ntype RelationSource = string | number | ID;\n\nexport type ComponentContext = {\n parentContent: {\n // The model of the parent content type that contains the current component.\n model: Struct.Schema;\n // The numeric id of the parent entity that contains the component.\n id?: number;\n // The options passed to the entity validator. From which we can extract\n // entity dimensions such as locale and publication state.\n options?: ValidatorContext;\n };\n // The path to the component within the parent content type schema.\n pathToComponent: string[];\n // If working with a repeatable component this contains the\n // full data of the repeatable component in the current entity.\n repeatableData: Modules.EntityValidator.Entity[];\n};\n\ninterface WithComponentContext {\n componentContext?: ComponentContext;\n}\n\ninterface ValidatorMeta<TAttribute = Schema.Attribute.AnyAttribute> extends WithComponentContext {\n attr: TAttribute;\n updatedAttribute: { name: string; value: any };\n}\n\ninterface ValidatorContext {\n isDraft?: boolean;\n locale?: string | null;\n}\n\ninterface AttributeValidatorMetas extends WithComponentContext {\n attr: Schema.Attribute.AnyAttribute;\n updatedAttribute: { name: string; value: unknown };\n model: Struct.Schema;\n entity?: Modules.EntityValidator.Entity;\n}\n\ninterface ModelValidatorMetas extends WithComponentContext {\n model: Struct.Schema;\n data: Record<string, unknown>;\n entity?: Modules.EntityValidator.Entity;\n}\n\nconst isInteger = (value: unknown): value is number => Number.isInteger(value);\n\nconst addMinMax = <\n T extends {\n min(value: number): T;\n max(value: number): T;\n },\n>(\n validator: T,\n {\n attr,\n updatedAttribute,\n }: ValidatorMeta<Schema.Attribute.AnyAttribute & Schema.Attribute.MinMaxOption<string | number>>\n): T => {\n let nextValidator: T = validator;\n\n if (\n isInteger(attr.min) &&\n (('required' in attr && attr.required) ||\n (Array.isArray(updatedAttribute.value) && updatedAttribute.value.length > 0))\n ) {\n nextValidator = nextValidator.min(attr.min);\n }\n if (isInteger(attr.max)) {\n nextValidator = nextValidator.max(attr.max);\n }\n return nextValidator;\n};\n\nconst addRequiredValidation = (createOrUpdate: CreateOrUpdate) => {\n return <T extends strapiUtils.yup.AnySchema>(\n validator: T,\n {\n attr: { required },\n }: ValidatorMeta<Partial<Schema.Attribute.AnyAttribute & Schema.Attribute.RequiredOption>>\n ): T => {\n let nextValidator = validator;\n\n if (required) {\n if (createOrUpdate === 'creation') {\n nextValidator = nextValidator.notNil();\n } else if (createOrUpdate === 'update') {\n nextValidator = nextValidator.notNull();\n }\n } else {\n nextValidator = nextValidator.nullable();\n }\n return nextValidator;\n };\n};\n\nconst addDefault = (createOrUpdate: CreateOrUpdate) => {\n return (\n validator: strapiUtils.yup.BaseSchema,\n { attr }: ValidatorMeta<Schema.Attribute.AnyAttribute & Schema.Attribute.DefaultOption<unknown>>\n ) => {\n let nextValidator = validator;\n\n if (createOrUpdate === 'creation') {\n if (\n ((attr.type === 'component' && attr.repeatable) || attr.type === 'dynamiczone') &&\n !attr.required\n ) {\n nextValidator = nextValidator.default([]);\n } else {\n nextValidator = nextValidator.default(attr.default);\n }\n } else {\n nextValidator = nextValidator.default(undefined);\n }\n\n return nextValidator;\n };\n};\n\nconst preventCast = (validator: strapiUtils.yup.AnySchema) =>\n validator.transform((val, originalVal) => originalVal);\n\nconst createComponentValidator =\n (createOrUpdate: CreateOrUpdate) =>\n (\n {\n attr,\n updatedAttribute,\n componentContext,\n }: ValidatorMeta<Schema.Attribute.Component<UID.Component, boolean>>,\n { isDraft }: ValidatorContext\n ) => {\n const model = strapi.getModel(attr.component);\n if (!model) {\n throw new Error('Validation failed: Model not found');\n }\n\n if (attr?.repeatable) {\n // FIXME: yup v1\n\n let validator = yup\n .array()\n .of(\n yup.lazy((item) =>\n createModelValidator(createOrUpdate)(\n { componentContext, model, data: item },\n { isDraft }\n ).notNull()\n ) as any\n );\n\n validator = addRequiredValidation(createOrUpdate)(validator, {\n attr: { required: true },\n updatedAttribute,\n });\n\n validator = addMinMax(validator, { attr, updatedAttribute });\n\n return validator;\n }\n\n let validator = createModelValidator(createOrUpdate)(\n {\n model,\n data: updatedAttribute.value,\n componentContext,\n },\n { isDraft }\n );\n\n validator = addRequiredValidation(createOrUpdate)(validator, {\n attr: { required: !isDraft && attr.required },\n updatedAttribute,\n });\n\n return validator;\n };\n\nconst createDzValidator =\n (createOrUpdate: CreateOrUpdate) =>\n ({ attr, updatedAttribute, componentContext }: ValidatorMeta, { isDraft }: ValidatorContext) => {\n let validator;\n\n validator = yup.array().of(\n yup.lazy((item) => {\n const model = strapi.getModel(prop('__component', item));\n const schema = yup\n .object()\n .shape({\n __component: yup.string().required().oneOf(Object.keys(strapi.components)),\n })\n .notNull();\n\n return model\n ? schema.concat(\n createModelValidator(createOrUpdate)(\n { model, data: item, componentContext },\n { isDraft }\n )\n )\n : schema;\n }) as any // FIXME: yup v1\n );\n\n validator = addRequiredValidation(createOrUpdate)(validator, {\n attr: { required: true },\n updatedAttribute,\n });\n\n validator = addMinMax(validator, { attr, updatedAttribute });\n\n return validator;\n };\n\nconst createRelationValidator =\n (createOrUpdate: CreateOrUpdate) =>\n (\n { attr, updatedAttribute }: ValidatorMeta<Schema.Attribute.Relation>,\n { isDraft }: ValidatorContext\n ) => {\n let validator;\n\n if (Array.isArray(updatedAttribute.value)) {\n validator = yup.array().of(yup.mixed());\n } else {\n validator = yup.mixed();\n }\n\n validator = addRequiredValidation(createOrUpdate)(validator, {\n attr: { required: !isDraft && attr.required },\n updatedAttribute,\n });\n\n return validator;\n };\n\nconst createScalarAttributeValidator =\n (createOrUpdate: CreateOrUpdate) => (metas: ValidatorMeta, options: ValidatorContext) => {\n let validator;\n\n if (has(metas.attr.type, validators)) {\n validator = (validators as any)[metas.attr.type](metas, options);\n } else {\n // No validators specified - fall back to mixed\n validator = yup.mixed();\n }\n\n validator = addRequiredValidation(createOrUpdate)(validator, {\n attr: { required: !options.isDraft && metas.attr.required },\n updatedAttribute: metas.updatedAttribute,\n });\n\n return validator;\n };\n\nconst createAttributeValidator =\n (createOrUpdate: CreateOrUpdate) =>\n (metas: AttributeValidatorMetas, options: ValidatorContext) => {\n let validator = yup.mixed();\n\n if (isMediaAttribute(metas.attr)) {\n validator = yup.mixed();\n } else if (isScalarAttribute(metas.attr)) {\n validator = createScalarAttributeValidator(createOrUpdate)(metas, options);\n } else {\n if (metas.attr.type === 'component') {\n // Build the path to the component within the parent content type schema.\n const pathToComponent = [\n ...(metas?.componentContext?.pathToComponent ?? []),\n metas.updatedAttribute.name,\n ];\n\n // If working with a repeatable component, determine the repeatable data\n // based on the component's path.\n\n // In order to validate the repeatable within this entity we need\n // access to the full repeatable data. In case we are validating a\n // nested component within a repeatable.\n // Hence why we set this up when the path to the component is only one level deep.\n const repeatableData = (\n metas.attr.repeatable && pathToComponent.length === 1\n ? metas.updatedAttribute.value\n : metas.componentContext?.repeatableData\n ) as Modules.EntityValidator.Entity[];\n\n const newComponentContext = {\n ...(metas?.componentContext ?? {}),\n pathToComponent,\n repeatableData,\n };\n\n validator = createComponentValidator(createOrUpdate)(\n {\n componentContext: newComponentContext as ComponentContext,\n attr: metas.attr,\n updatedAttribute: metas.updatedAttribute,\n },\n options\n );\n } else if (metas.attr.type === 'dynamiczone') {\n // TODO: fix! query layer fails when building a where for dynamic\n // zones\n const pathToComponent = [\n ...(metas?.componentContext?.pathToComponent ?? []),\n metas.updatedAttribute.name,\n ];\n\n const newComponentContext = {\n ...(metas?.componentContext ?? {}),\n pathToComponent,\n };\n\n validator = createDzValidator(createOrUpdate)(\n { ...metas, componentContext: newComponentContext as ComponentContext },\n options\n );\n } else if (metas.attr.type === 'relation') {\n validator = createRelationValidator(createOrUpdate)(\n {\n attr: metas.attr,\n updatedAttribute: metas.updatedAttribute,\n },\n options\n );\n }\n\n validator = preventCast(validator);\n }\n\n validator = addDefault(createOrUpdate)(validator, metas);\n\n return validator;\n };\n\nconst createModelValidator =\n (createOrUpdate: CreateOrUpdate) =>\n ({ componentContext, model, data, entity }: ModelValidatorMetas, options: ValidatorContext) => {\n const writableAttributes = model ? getWritableAttributes(model as any) : [];\n\n const schema = writableAttributes.reduce(\n (validators, attributeName) => {\n const metas = {\n attr: model.attributes[attributeName],\n updatedAttribute: { name: attributeName, value: prop(attributeName, data) },\n model,\n entity,\n componentContext,\n };\n\n const validator = createAttributeValidator(createOrUpdate)(metas, options);\n\n validators[attributeName] = validator;\n\n return validators;\n },\n {} as Record<string, strapiUtils.yup.BaseSchema>\n );\n\n return yup.object().shape(schema);\n };\n\nconst createValidateEntity = (createOrUpdate: CreateOrUpdate) => {\n return async <\n TUID extends UID.ContentType,\n TData extends Modules.EntityService.Params.Data.Input<TUID>,\n >(\n model: Schema.ContentType<TUID>,\n data: TData | Partial<TData> | undefined,\n options?: ValidatorContext,\n entity?: Modules.EntityValidator.Entity\n ): Promise<TData> => {\n if (!isObject(data)) {\n const { displayName } = model.info;\n\n throw new ValidationError(\n `Invalid payload submitted for the ${createOrUpdate} of an entity of type ${displayName}. Expected an object, but got ${typeof data}`\n );\n }\n\n const validator = createModelValidator(createOrUpdate)(\n {\n model,\n data,\n entity,\n componentContext: {\n // Set up the initial component context.\n // Keeping track of parent content type context in which a component will be used.\n // This is necessary to validate component field constraints such as uniqueness.\n parentContent: {\n id: entity?.id,\n model,\n options,\n },\n pathToComponent: [],\n repeatableData: [],\n },\n },\n {\n isDraft: options?.isDraft ?? false,\n locale: options?.locale ?? null,\n }\n )\n .test(\n 'relations-test',\n 'check that all relations exist',\n async function relationsValidation(data) {\n try {\n await checkRelationsExist(buildRelationsStore({ uid: model.uid, data }));\n } catch (e) {\n return this.createError({\n path: this.path,\n message: (e instanceof ValidationError && e.message) || 'Invalid relations',\n });\n }\n return true;\n }\n )\n .required();\n\n return validateYupSchema(validator, {\n strict: false,\n abortEarly: false,\n })(data);\n };\n};\n\n/**\n * Builds an object containing all the media and relations being associated with an entity\n */\nconst buildRelationsStore = <TUID extends UID.Schema>({\n uid,\n data,\n}: {\n uid: TUID;\n data: Record<string, unknown> | null;\n}): Record<string, ID[]> => {\n if (!uid) {\n throw new ValidationError(`Cannot build relations store: \"uid\" is undefined`);\n }\n\n if (isEmpty(data)) {\n return {};\n }\n\n const currentModel = strapi.getModel(uid);\n\n return Object.keys(currentModel.attributes).reduce(\n (result, attributeName: string) => {\n const attribute = currentModel.attributes[attributeName];\n const value = data[attributeName];\n\n if (isNil(value)) {\n return result;\n }\n\n switch (attribute.type) {\n case 'relation':\n case 'media': {\n if (\n attribute.type === 'relation' &&\n (attribute.relation === 'morphToMany' || attribute.relation === 'morphToOne')\n ) {\n // TODO: handle polymorphic relations\n break;\n }\n\n const target =\n // eslint-disable-next-line no-nested-ternary\n attribute.type === 'media' ? 'plugin::upload.file' : attribute.target;\n // As there are multiple formats supported for associating relations\n // with an entity, the value here can be an: array, object or number.\n let source: RelationSource[];\n if (Array.isArray(value)) {\n source = value;\n } else if (isObject(value)) {\n if ('connect' in value && !isNil(value.connect)) {\n source = value.connect as RelationSource[];\n } else if ('set' in value && !isNil(value.set)) {\n source = value.set as RelationSource[];\n } else {\n source = [];\n }\n } else {\n source = castArray(value as RelationSource);\n }\n const idArray = source.map((v) => ({\n id: typeof v === 'object' ? v.id : v,\n }));\n\n // Update the relationStore to keep track of all associations being made\n // with relations and media.\n result[target] = result[target] || [];\n result[target].push(...idArray);\n break;\n }\n case 'component': {\n return castArray(value).reduce((relationsStore, componentValue) => {\n if (!attribute.component) {\n throw new ValidationError(\n `Cannot build relations store from component, component identifier is undefined`\n );\n }\n\n return mergeWith(\n relationsStore,\n buildRelationsStore({\n uid: attribute.component,\n data: componentValue as Record<string, unknown>,\n }),\n (objValue, srcValue) => {\n if (isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n }\n );\n }, result) as Record<string, ID[]>;\n }\n case 'dynamiczone': {\n return castArray(value).reduce((relationsStore, dzValue) => {\n const value = dzValue as Record<string, unknown>;\n if (!value.__component) {\n throw new ValidationError(\n `Cannot build relations store from dynamiczone, component identifier is undefined`\n );\n }\n\n return mergeWith(\n relationsStore,\n buildRelationsStore({\n uid: value.__component as UID.Component,\n data: value,\n }),\n (objValue, srcValue) => {\n if (isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n }\n );\n }, result) as Record<string, ID[]>;\n }\n default:\n break;\n }\n\n return result;\n },\n {} as Record<string, ID[]>\n );\n};\n\n/**\n * Iterate through the relations store and validates that every relation or media\n * mentioned exists\n */\nconst checkRelationsExist = async (relationsStore: Record<string, ID[]> = {}) => {\n const promises: Promise<void>[] = [];\n\n for (const [key, value] of Object.entries(relationsStore)) {\n const evaluate = async () => {\n const uniqueValues = uniqBy(value, `id`);\n const count = await strapi.db.query(key as UID.Schema).count({\n where: {\n id: {\n $in: uniqueValues.map((v) => v.id),\n },\n },\n });\n\n if (count !== uniqueValues.length) {\n throw new ValidationError(\n `${\n uniqueValues.length - count\n } relation(s) of type ${key} associated with this entity do not exist`\n );\n }\n };\n promises.push(evaluate());\n }\n\n return Promise.all(promises);\n};\n\nconst entityValidator: Modules.EntityValidator.EntityValidator = {\n validateEntityCreation: createValidateEntity('creation'),\n validateEntityUpdate: createValidateEntity('update'),\n};\n\nexport default entityValidator;\n"],"names":["strapiUtils","validator","prop","has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