@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
@@ -6,7 +6,10 @@ const { yup, validateYupSchema } = strapiUtils;
6
6
  const { isMediaAttribute, isScalarAttribute, getWritableAttributes } = strapiUtils.contentTypes;
7
7
  const { ValidationError } = strapiUtils.errors;
8
8
  const isInteger = (value) => Number.isInteger(value);
9
- const addMinMax = (validator, { attr, updatedAttribute }) => {
9
+ const addMinMax = (validator, {
10
+ attr,
11
+ updatedAttribute
12
+ }) => {
10
13
  let nextValidator = validator;
11
14
  if (isInteger(attr.min) && ("required" in attr && attr.required || Array.isArray(updatedAttribute.value) && updatedAttribute.value.length > 0)) {
12
15
  nextValidator = nextValidator.min(attr.min);
@@ -17,7 +20,9 @@ const addMinMax = (validator, { attr, updatedAttribute }) => {
17
20
  return nextValidator;
18
21
  };
19
22
  const addRequiredValidation = (createOrUpdate) => {
20
- return (validator, { attr: { required } }) => {
23
+ return (validator, {
24
+ attr: { required }
25
+ }) => {
21
26
  let nextValidator = validator;
22
27
  if (required) {
23
28
  if (createOrUpdate === "creation") {
@@ -47,7 +52,11 @@ const addDefault = (createOrUpdate) => {
47
52
  };
48
53
  };
49
54
  const preventCast = (validator) => validator.transform((val, originalVal) => originalVal);
50
- const createComponentValidator = (createOrUpdate) => ({ attr, updatedAttribute }, { isDraft }) => {
55
+ const createComponentValidator = (createOrUpdate) => ({
56
+ attr,
57
+ updatedAttribute,
58
+ componentContext
59
+ }, { isDraft }) => {
51
60
  const model = strapi.getModel(attr.component);
52
61
  if (!model) {
53
62
  throw new Error("Validation failed: Model not found");
@@ -55,7 +64,10 @@ const createComponentValidator = (createOrUpdate) => ({ attr, updatedAttribute }
55
64
  if (attr?.repeatable) {
56
65
  let validator2 = yup.array().of(
57
66
  yup.lazy(
58
- (item) => createModelValidator(createOrUpdate)({ model, data: item }, { isDraft }).notNull()
67
+ (item) => createModelValidator(createOrUpdate)(
68
+ { componentContext, model, data: item },
69
+ { isDraft }
70
+ ).notNull()
59
71
  )
60
72
  );
61
73
  validator2 = addRequiredValidation(createOrUpdate)(validator2, {
@@ -66,7 +78,11 @@ const createComponentValidator = (createOrUpdate) => ({ attr, updatedAttribute }
66
78
  return validator2;
67
79
  }
68
80
  let validator = createModelValidator(createOrUpdate)(
69
- { model, data: updatedAttribute.value },
81
+ {
82
+ model,
83
+ data: updatedAttribute.value,
84
+ componentContext
85
+ },
70
86
  { isDraft }
71
87
  );
72
88
  validator = addRequiredValidation(createOrUpdate)(validator, {
@@ -75,7 +91,7 @@ const createComponentValidator = (createOrUpdate) => ({ attr, updatedAttribute }
75
91
  });
76
92
  return validator;
77
93
  };
78
- const createDzValidator = (createOrUpdate) => ({ attr, updatedAttribute }, { isDraft }) => {
94
+ const createDzValidator = (createOrUpdate) => ({ attr, updatedAttribute, componentContext }, { isDraft }) => {
79
95
  let validator;
80
96
  validator = yup.array().of(
81
97
  yup.lazy((item) => {
@@ -83,7 +99,12 @@ const createDzValidator = (createOrUpdate) => ({ attr, updatedAttribute }, { isD
83
99
  const schema = yup.object().shape({
84
100
  __component: yup.string().required().oneOf(Object.keys(strapi.components))
85
101
  }).notNull();
86
- return model ? schema.concat(createModelValidator(createOrUpdate)({ model, data: item }, { isDraft })) : schema;
102
+ return model ? schema.concat(
103
+ createModelValidator(createOrUpdate)(
104
+ { model, data: item, componentContext },
105
+ { isDraft }
106
+ )
107
+ ) : schema;
87
108
  })
88
109
  // FIXME: yup v1
89
110
  );
@@ -128,12 +149,37 @@ const createAttributeValidator = (createOrUpdate) => (metas, options) => {
128
149
  validator = createScalarAttributeValidator(createOrUpdate)(metas, options);
129
150
  } else {
130
151
  if (metas.attr.type === "component") {
152
+ const pathToComponent = [
153
+ ...metas?.componentContext?.pathToComponent ?? [],
154
+ metas.updatedAttribute.name
155
+ ];
156
+ const repeatableData = metas.attr.repeatable && pathToComponent.length === 1 ? metas.updatedAttribute.value : metas.componentContext?.repeatableData;
157
+ const newComponentContext = {
158
+ ...metas?.componentContext ?? {},
159
+ pathToComponent,
160
+ repeatableData
161
+ };
131
162
  validator = createComponentValidator(createOrUpdate)(
132
- { attr: metas.attr, updatedAttribute: metas.updatedAttribute },
163
+ {
164
+ componentContext: newComponentContext,
165
+ attr: metas.attr,
166
+ updatedAttribute: metas.updatedAttribute
167
+ },
133
168
  options
134
169
  );
135
170
  } else if (metas.attr.type === "dynamiczone") {
136
- validator = createDzValidator(createOrUpdate)(metas, options);
171
+ const pathToComponent = [
172
+ ...metas?.componentContext?.pathToComponent ?? [],
173
+ metas.updatedAttribute.name
174
+ ];
175
+ const newComponentContext = {
176
+ ...metas?.componentContext ?? {},
177
+ pathToComponent
178
+ };
179
+ validator = createDzValidator(createOrUpdate)(
180
+ { ...metas, componentContext: newComponentContext },
181
+ options
182
+ );
137
183
  } else if (metas.attr.type === "relation") {
138
184
  validator = createRelationValidator(createOrUpdate)(
139
185
  {
@@ -148,19 +194,23 @@ const createAttributeValidator = (createOrUpdate) => (metas, options) => {
148
194
  validator = addDefault(createOrUpdate)(validator, metas);
149
195
  return validator;
150
196
  };
151
- const createModelValidator = (createOrUpdate) => ({ model, data, entity }, options) => {
197
+ const createModelValidator = (createOrUpdate) => ({ componentContext, model, data, entity }, options) => {
152
198
  const writableAttributes = model ? getWritableAttributes(model) : [];
153
- const schema = writableAttributes.reduce((validators2, attributeName) => {
154
- const metas = {
155
- attr: model.attributes[attributeName],
156
- updatedAttribute: { name: attributeName, value: prop(attributeName, data) },
157
- model,
158
- entity
159
- };
160
- const validator = createAttributeValidator(createOrUpdate)(metas, options);
161
- validators2[attributeName] = validator;
162
- return validators2;
163
- }, {});
199
+ const schema = writableAttributes.reduce(
200
+ (validators2, attributeName) => {
201
+ const metas = {
202
+ attr: model.attributes[attributeName],
203
+ updatedAttribute: { name: attributeName, value: prop(attributeName, data) },
204
+ model,
205
+ entity,
206
+ componentContext
207
+ };
208
+ const validator = createAttributeValidator(createOrUpdate)(metas, options);
209
+ validators2[attributeName] = validator;
210
+ return validators2;
211
+ },
212
+ {}
213
+ );
164
214
  return yup.object().shape(schema);
165
215
  };
166
216
  const createValidateEntity = (createOrUpdate) => {
@@ -172,22 +222,42 @@ const createValidateEntity = (createOrUpdate) => {
172
222
  );
173
223
  }
174
224
  const validator = createModelValidator(createOrUpdate)(
175
- { model, data, entity },
225
+ {
226
+ model,
227
+ data,
228
+ entity,
229
+ componentContext: {
230
+ // Set up the initial component context.
231
+ // Keeping track of parent content type context in which a component will be used.
232
+ // This is necessary to validate component field constraints such as uniqueness.
233
+ parentContent: {
234
+ id: entity?.id,
235
+ model,
236
+ options
237
+ },
238
+ pathToComponent: [],
239
+ repeatableData: []
240
+ }
241
+ },
176
242
  {
177
243
  isDraft: options?.isDraft ?? false,
178
244
  locale: options?.locale ?? null
179
245
  }
180
- ).test("relations-test", "check that all relations exist", async function(data2) {
181
- try {
182
- await checkRelationsExist(buildRelationsStore({ uid: model.uid, data: data2 }));
183
- } catch (e) {
184
- return this.createError({
185
- path: this.path,
186
- message: e instanceof ValidationError && e.message || "Invalid relations"
187
- });
246
+ ).test(
247
+ "relations-test",
248
+ "check that all relations exist",
249
+ async function relationsValidation(data2) {
250
+ try {
251
+ await checkRelationsExist(buildRelationsStore({ uid: model.uid, data: data2 }));
252
+ } catch (e) {
253
+ return this.createError({
254
+ path: this.path,
255
+ message: e instanceof ValidationError && e.message || "Invalid relations"
256
+ });
257
+ }
258
+ return true;
188
259
  }
189
- return true;
190
- }).required();
260
+ ).required();
191
261
  return validateYupSchema(validator, {
192
262
  strict: false,
193
263
  abortEarly: false
@@ -205,96 +275,99 @@ const buildRelationsStore = ({
205
275
  return {};
206
276
  }
207
277
  const currentModel = strapi.getModel(uid);
208
- return Object.keys(currentModel.attributes).reduce((result, attributeName) => {
209
- const attribute = currentModel.attributes[attributeName];
210
- const value = data[attributeName];
211
- if (isNil(value)) {
212
- return result;
213
- }
214
- switch (attribute.type) {
215
- case "relation":
216
- case "media": {
217
- if (attribute.type === "relation" && (attribute.relation === "morphToMany" || attribute.relation === "morphToOne")) {
218
- break;
219
- }
220
- const target = (
221
- // eslint-disable-next-line no-nested-ternary
222
- attribute.type === "media" ? "plugin::upload.file" : attribute.target
223
- );
224
- let source;
225
- if (Array.isArray(value)) {
226
- source = value;
227
- } else if (isObject(value)) {
228
- if ("connect" in value && !isNil(value.connect)) {
229
- source = value.connect;
230
- } else if ("set" in value && !isNil(value.set)) {
231
- source = value.set;
232
- } else {
233
- source = [];
234
- }
235
- } else {
236
- source = castArray(value);
237
- }
238
- const idArray = source.map((v) => ({
239
- id: typeof v === "object" ? v.id : v
240
- }));
241
- result[target] = result[target] || [];
242
- result[target].push(...idArray);
243
- break;
278
+ return Object.keys(currentModel.attributes).reduce(
279
+ (result, attributeName) => {
280
+ const attribute = currentModel.attributes[attributeName];
281
+ const value = data[attributeName];
282
+ if (isNil(value)) {
283
+ return result;
244
284
  }
245
- case "component": {
246
- return castArray(value).reduce((relationsStore, componentValue) => {
247
- if (!attribute.component) {
248
- throw new ValidationError(
249
- `Cannot build relations store from component, component identifier is undefined`
250
- );
285
+ switch (attribute.type) {
286
+ case "relation":
287
+ case "media": {
288
+ if (attribute.type === "relation" && (attribute.relation === "morphToMany" || attribute.relation === "morphToOne")) {
289
+ break;
251
290
  }
252
- return mergeWith(
253
- relationsStore,
254
- buildRelationsStore({
255
- uid: attribute.component,
256
- data: componentValue
257
- }),
258
- (objValue, srcValue) => {
259
- if (isArray(objValue)) {
260
- return objValue.concat(srcValue);
261
- }
262
- }
291
+ const target = (
292
+ // eslint-disable-next-line no-nested-ternary
293
+ attribute.type === "media" ? "plugin::upload.file" : attribute.target
263
294
  );
264
- }, result);
265
- }
266
- case "dynamiczone": {
267
- return castArray(value).reduce((relationsStore, dzValue) => {
268
- const value2 = dzValue;
269
- if (!value2.__component) {
270
- throw new ValidationError(
271
- `Cannot build relations store from dynamiczone, component identifier is undefined`
272
- );
295
+ let source;
296
+ if (Array.isArray(value)) {
297
+ source = value;
298
+ } else if (isObject(value)) {
299
+ if ("connect" in value && !isNil(value.connect)) {
300
+ source = value.connect;
301
+ } else if ("set" in value && !isNil(value.set)) {
302
+ source = value.set;
303
+ } else {
304
+ source = [];
305
+ }
306
+ } else {
307
+ source = castArray(value);
273
308
  }
274
- return mergeWith(
275
- relationsStore,
276
- buildRelationsStore({
277
- uid: value2.__component,
278
- data: value2
279
- }),
280
- (objValue, srcValue) => {
281
- if (isArray(objValue)) {
282
- return objValue.concat(srcValue);
309
+ const idArray = source.map((v) => ({
310
+ id: typeof v === "object" ? v.id : v
311
+ }));
312
+ result[target] = result[target] || [];
313
+ result[target].push(...idArray);
314
+ break;
315
+ }
316
+ case "component": {
317
+ return castArray(value).reduce((relationsStore, componentValue) => {
318
+ if (!attribute.component) {
319
+ throw new ValidationError(
320
+ `Cannot build relations store from component, component identifier is undefined`
321
+ );
322
+ }
323
+ return mergeWith(
324
+ relationsStore,
325
+ buildRelationsStore({
326
+ uid: attribute.component,
327
+ data: componentValue
328
+ }),
329
+ (objValue, srcValue) => {
330
+ if (isArray(objValue)) {
331
+ return objValue.concat(srcValue);
332
+ }
283
333
  }
334
+ );
335
+ }, result);
336
+ }
337
+ case "dynamiczone": {
338
+ return castArray(value).reduce((relationsStore, dzValue) => {
339
+ const value2 = dzValue;
340
+ if (!value2.__component) {
341
+ throw new ValidationError(
342
+ `Cannot build relations store from dynamiczone, component identifier is undefined`
343
+ );
284
344
  }
285
- );
286
- }, result);
345
+ return mergeWith(
346
+ relationsStore,
347
+ buildRelationsStore({
348
+ uid: value2.__component,
349
+ data: value2
350
+ }),
351
+ (objValue, srcValue) => {
352
+ if (isArray(objValue)) {
353
+ return objValue.concat(srcValue);
354
+ }
355
+ }
356
+ );
357
+ }, result);
358
+ }
287
359
  }
288
- }
289
- return result;
290
- }, {});
360
+ return result;
361
+ },
362
+ {}
363
+ );
291
364
  };
292
365
  const checkRelationsExist = async (relationsStore = {}) => {
293
366
  const promises = [];
294
367
  for (const [key, value] of Object.entries(relationsStore)) {
295
368
  const evaluate = async () => {
296
369
  const uniqueValues = uniqBy(value, `id`);
297
- const count = await strapi.query(key).count({
370
+ const count = await strapi.db.query(key).count({
298
371
  where: {
299
372
  id: {
300
373
  $in: uniqueValues.map((v) => v.id)
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","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":["validator","validators","data","value"],"mappings":";;;;AAaA,MAAM,EAAE,KAAK,kBAAsB,IAAA;AACnC,MAAM,EAAE,kBAAkB,mBAAmB,sBAAA,IAA0B,YAAY;AACnF,MAAM,EAAE,gBAAgB,IAAI,YAAY;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,mBAAmB,YAAY;AAE7B,WAAA,KAAK,SAAS,eAAe,KAAK,cAAe,KAAK,SAAS,kBACjE,CAAC,KAAK,UACN;AACgB,wBAAA,cAAc,QAAQ,CAAA,CAAE;AAAA,MAAA,OACnC;AACW,wBAAA,cAAc,QAAQ,KAAK,OAAO;AAAA,MACpD;AAAA,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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":["validator","validators","data","value"],"mappings":";;;;AAaA,MAAM,EAAE,KAAK,kBAAsB,IAAA;AACnC,MAAM,EAAE,kBAAkB,mBAAmB,sBAAA,IAA0B,YAAY;AACnF,MAAM,EAAE,gBAAgB,IAAI,YAAY;AAkDxC,MAAM,YAAY,CAAC,UAAoC,OAAO,UAAU,KAAK;AAE7E,MAAM,YAAY,CAMhB,WACA;AAAA,EACE;AAAA,EACA;AACF,MACM;AACN,MAAI,gBAAmB;AAEvB,MACE,UAAU,KAAK,GAAG,MAChB,cAAc,QAAQ,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Y;AACrB,YAAA,eAAe,OAAO,OAAO,IAAI;AACvC,YAAM,QAAQ,MAAM,OAAO,GAAG,MAAM,GAAiB,EAAE,MAAM;AAAA,QAC3D,OAAO;AAAA,UACL,IAAI;AAAA,YACF,KAAK,aAAa,IAAI,CAAC,MAAM,EAAE,EAAE;AAAA,UACnC;AAAA,QACF;AAAA,MAAA,CACD;AAEG,UAAA,UAAU,aAAa,QAAQ;AACjC,cAAM,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,kBAA2D;AAAA,EAC/D,wBAAwB,qBAAqB,UAAU;AAAA,EACvD,sBAAsB,qBAAqB,QAAQ;AACrD;"}
@@ -1,39 +1,41 @@
1
- import strapiUtils from '@strapi/utils';
2
- import type { Attribute, Schema } from '@strapi/types';
3
- interface ValidatorMetas<TAttribute extends Attribute.Any> {
1
+ import { yup } from '@strapi/utils';
2
+ import type { Schema, Struct, Modules } from '@strapi/types';
3
+ import type { ComponentContext } from '.';
4
+ interface ValidatorMetas<TAttribute extends Schema.Attribute.AnyAttribute> {
4
5
  attr: TAttribute;
5
- model: Schema.ContentType;
6
+ model: Struct.ContentTypeSchema;
6
7
  updatedAttribute: {
7
8
  name: string;
8
9
  value: unknown;
9
10
  };
10
- entity: Record<string, unknown> | null;
11
+ entity: Modules.EntityValidator.Entity;
12
+ componentContext: ComponentContext;
11
13
  }
12
14
  interface ValidatorOptions {
13
15
  isDraft: boolean;
14
16
  locale?: string;
15
17
  }
16
18
  declare const _default: {
17
- string: (metas: ValidatorMetas<Attribute.Email | Attribute.Password | Attribute.RichText | (Attribute.OfType<"string"> & Attribute.StringProperties & Attribute.ConfigurableOption & Attribute.DefaultOption<string> & Attribute.MinMaxLengthOption & Attribute.PrivateOption & Attribute.UniqueOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption) | Attribute.Text | Attribute.UID<string, Attribute.UIDOptions>>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
18
- text: (metas: ValidatorMetas<Attribute.Email | Attribute.Password | Attribute.RichText | (Attribute.OfType<"string"> & Attribute.StringProperties & Attribute.ConfigurableOption & Attribute.DefaultOption<string> & Attribute.MinMaxLengthOption & Attribute.PrivateOption & Attribute.UniqueOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption) | Attribute.Text | Attribute.UID<string, Attribute.UIDOptions>>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
19
- richtext: (metas: ValidatorMetas<Attribute.Email | Attribute.Password | Attribute.RichText | (Attribute.OfType<"string"> & Attribute.StringProperties & Attribute.ConfigurableOption & Attribute.DefaultOption<string> & Attribute.MinMaxLengthOption & Attribute.PrivateOption & Attribute.UniqueOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption) | Attribute.Text | Attribute.UID<string, Attribute.UIDOptions>>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
20
- password: (metas: ValidatorMetas<Attribute.Email | Attribute.Password | Attribute.RichText | (Attribute.OfType<"string"> & Attribute.StringProperties & Attribute.ConfigurableOption & Attribute.DefaultOption<string> & Attribute.MinMaxLengthOption & Attribute.PrivateOption & Attribute.UniqueOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption) | Attribute.Text | Attribute.UID<string, Attribute.UIDOptions>>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
21
- email: (metas: ValidatorMetas<Attribute.Email>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
19
+ string: (metas: ValidatorMetas<(Schema.Attribute.OfType<"email"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"password"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"richtext"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"string"> & Schema.Attribute.StringProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"text"> & Schema.Attribute.TextProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"uid"> & Schema.Attribute.UIDProperties<string, Schema.Attribute.UIDOptions> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
20
+ text: (metas: ValidatorMetas<(Schema.Attribute.OfType<"email"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"password"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"richtext"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"string"> & Schema.Attribute.StringProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"text"> & Schema.Attribute.TextProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"uid"> & Schema.Attribute.UIDProperties<string, Schema.Attribute.UIDOptions> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
21
+ richtext: (metas: ValidatorMetas<(Schema.Attribute.OfType<"email"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"password"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"richtext"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"string"> & Schema.Attribute.StringProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"text"> & Schema.Attribute.TextProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"uid"> & Schema.Attribute.UIDProperties<string, Schema.Attribute.UIDOptions> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
22
+ password: (metas: ValidatorMetas<(Schema.Attribute.OfType<"email"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"password"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"richtext"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"string"> & Schema.Attribute.StringProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"text"> & Schema.Attribute.TextProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"uid"> & Schema.Attribute.UIDProperties<string, Schema.Attribute.UIDOptions> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
23
+ email: (metas: ValidatorMetas<Schema.Attribute.OfType<"email"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
22
24
  enumeration: ({ attr }: {
23
- attr: Attribute.Enumeration<[]>;
25
+ attr: Schema.Attribute.OfType<"enumeration"> & Schema.Attribute.EnumerationProperties<[]> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<never> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption;
24
26
  }) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
25
- boolean: () => strapiUtils.yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
26
- uid: (metas: ValidatorMetas<Attribute.UID<string, Attribute.UIDOptions>>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
27
+ boolean: () => yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
28
+ uid: (metas: ValidatorMetas<Schema.Attribute.OfType<"uid"> & Schema.Attribute.UIDProperties<string, Schema.Attribute.UIDOptions> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
27
29
  json: () => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
28
- integer: (metas: ValidatorMetas<Attribute.BigInteger | Attribute.Integer>, options: ValidatorOptions) => strapiUtils.yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
29
- biginteger: (metas: ValidatorMetas<Attribute.BigInteger>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
30
- float: (metas: ValidatorMetas<Attribute.Decimal | Attribute.Float>, options: ValidatorOptions) => strapiUtils.yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
31
- decimal: (metas: ValidatorMetas<Attribute.Decimal | Attribute.Float>, options: ValidatorOptions) => strapiUtils.yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
32
- date: (metas: ValidatorMetas<Attribute.DateTime | Attribute.Date | Attribute.Time | Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
33
- time: (metas: ValidatorMetas<Attribute.DateTime | Attribute.Date | Attribute.Time | Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
34
- datetime: (metas: ValidatorMetas<Attribute.DateTime | Attribute.Date | Attribute.Time | Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
35
- timestamp: (metas: ValidatorMetas<Attribute.DateTime | Attribute.Date | Attribute.Time | Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
36
- blocks: (metas: any, options: any) => strapiUtils.yup.ArraySchema<any, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
30
+ integer: (metas: ValidatorMetas<(Schema.Attribute.OfType<"biginteger"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxOption<string> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption) | (Schema.Attribute.OfType<"integer"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<number> & Schema.Attribute.MinMaxOption<number> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption)>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
31
+ biginteger: (metas: ValidatorMetas<Schema.Attribute.OfType<"biginteger"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxOption<string> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
32
+ float: (metas: ValidatorMetas<(Schema.Attribute.OfType<"decimal"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<number> & Schema.Attribute.MinMaxOption<number> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption) | (Schema.Attribute.OfType<"float"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<number> & Schema.Attribute.MinMaxOption<number> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption)>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
33
+ decimal: (metas: ValidatorMetas<(Schema.Attribute.OfType<"decimal"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<number> & Schema.Attribute.MinMaxOption<number> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption) | (Schema.Attribute.OfType<"float"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<number> & Schema.Attribute.MinMaxOption<number> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption)>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
34
+ date: (metas: ValidatorMetas<(Schema.Attribute.OfType<"datetime"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateTimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"date"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"time"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"timestamp"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimestampValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
35
+ time: (metas: ValidatorMetas<(Schema.Attribute.OfType<"datetime"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateTimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"date"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"time"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"timestamp"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimestampValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
36
+ datetime: (metas: ValidatorMetas<(Schema.Attribute.OfType<"datetime"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateTimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"date"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"time"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"timestamp"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimestampValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
37
+ timestamp: (metas: ValidatorMetas<(Schema.Attribute.OfType<"datetime"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateTimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"date"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"time"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"timestamp"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimestampValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
38
+ blocks: (metas: any, options: any) => yup.ArraySchema<any, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
37
39
  };
38
40
  export default _default;
39
41
  //# sourceMappingURL=validators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/services/entity-validator/validators.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvD,UAAU,cAAc,CAAC,UAAU,SAAS,SAAS,CAAC,GAAG;IACvD,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC;IAC1B,gBAAgB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACnD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACxC;AAED,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;;;;;;;;;;;;;;;;;;;;;;AA0PD,wBAmBE"}
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/services/entity-validator/validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAC;AAE1C,UAAU,cAAc,CAAC,UAAU,SAAS,MAAM,CAAC,SAAS,CAAC,YAAY;IACvE,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,iBAAiB,CAAC;IAChC,gBAAgB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACnD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;;;;;;;;;;;;;;;;;;;;;;AAwVD,wBAmBE"}