@strapi/core 0.0.0-experimental.d362bf200f5f9359a4bbd4a549603de5ee1f04ca → 0.0.0-experimental.d834c9e658d1fb037e6da1105150593521c667cc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (507) hide show
  1. package/LICENSE +18 -3
  2. package/dist/Strapi.d.ts +37 -46
  3. package/dist/Strapi.d.ts.map +1 -1
  4. package/dist/Strapi.js +190 -225
  5. package/dist/Strapi.js.map +1 -1
  6. package/dist/Strapi.mjs +159 -214
  7. package/dist/Strapi.mjs.map +1 -1
  8. package/dist/configuration/config-loader.d.ts.map +1 -1
  9. package/dist/configuration/config-loader.js +9 -5
  10. package/dist/configuration/config-loader.js.map +1 -1
  11. package/dist/configuration/config-loader.mjs +9 -5
  12. package/dist/configuration/config-loader.mjs.map +1 -1
  13. package/dist/configuration/get-dirs.d.ts +10 -0
  14. package/dist/configuration/get-dirs.d.ts.map +1 -0
  15. package/dist/{utils → configuration}/get-dirs.js +3 -2
  16. package/dist/configuration/get-dirs.js.map +1 -0
  17. package/dist/{utils → configuration}/get-dirs.mjs +3 -2
  18. package/dist/configuration/get-dirs.mjs.map +1 -0
  19. package/dist/configuration/index.d.ts +4 -7
  20. package/dist/configuration/index.d.ts.map +1 -1
  21. package/dist/configuration/index.js +8 -6
  22. package/dist/configuration/index.js.map +1 -1
  23. package/dist/configuration/index.mjs +5 -4
  24. package/dist/configuration/index.mjs.map +1 -1
  25. package/dist/core-api/controller/collection-type.d.ts.map +1 -1
  26. package/dist/core-api/controller/collection-type.js +6 -3
  27. package/dist/core-api/controller/collection-type.js.map +1 -1
  28. package/dist/core-api/controller/collection-type.mjs +3 -0
  29. package/dist/core-api/controller/collection-type.mjs.map +1 -1
  30. package/dist/core-api/controller/index.js +2 -2
  31. package/dist/core-api/controller/index.js.map +1 -1
  32. package/dist/core-api/controller/single-type.d.ts.map +1 -1
  33. package/dist/core-api/controller/single-type.js +3 -2
  34. package/dist/core-api/controller/single-type.js.map +1 -1
  35. package/dist/core-api/controller/single-type.mjs +1 -0
  36. package/dist/core-api/controller/single-type.mjs.map +1 -1
  37. package/dist/core-api/controller/transform.js +8 -8
  38. package/dist/core-api/controller/transform.js.map +1 -1
  39. package/dist/core-api/routes/index.d.ts.map +1 -1
  40. package/dist/core-api/service/collection-type.d.ts +5 -11
  41. package/dist/core-api/service/collection-type.d.ts.map +1 -1
  42. package/dist/core-api/service/collection-type.js +18 -7
  43. package/dist/core-api/service/collection-type.js.map +1 -1
  44. package/dist/core-api/service/collection-type.mjs +19 -8
  45. package/dist/core-api/service/collection-type.mjs.map +1 -1
  46. package/dist/core-api/service/pagination.d.ts +4 -11
  47. package/dist/core-api/service/pagination.d.ts.map +1 -1
  48. package/dist/core-api/service/pagination.js +18 -44
  49. package/dist/core-api/service/pagination.js.map +1 -1
  50. package/dist/core-api/service/pagination.mjs +16 -42
  51. package/dist/core-api/service/pagination.mjs.map +1 -1
  52. package/dist/core-api/service/single-type.d.ts.map +1 -1
  53. package/dist/core-api/service/single-type.js +9 -2
  54. package/dist/core-api/service/single-type.js.map +1 -1
  55. package/dist/core-api/service/single-type.mjs +9 -2
  56. package/dist/core-api/service/single-type.mjs.map +1 -1
  57. package/dist/domain/content-type/index.js +4 -4
  58. package/dist/domain/content-type/index.js.map +1 -1
  59. package/dist/ee/index.d.ts +2 -0
  60. package/dist/ee/index.d.ts.map +1 -1
  61. package/dist/ee/index.js +3 -3
  62. package/dist/ee/index.js.map +1 -1
  63. package/dist/ee/index.mjs.map +1 -1
  64. package/dist/ee/license.d.ts.map +1 -1
  65. package/dist/ee/license.js +2 -1
  66. package/dist/ee/license.js.map +1 -1
  67. package/dist/ee/license.mjs +2 -1
  68. package/dist/ee/license.mjs.map +1 -1
  69. package/dist/factories.d.ts +2 -2
  70. package/dist/factories.d.ts.map +1 -1
  71. package/dist/factories.js +4 -4
  72. package/dist/factories.js.map +1 -1
  73. package/dist/factories.mjs.map +1 -1
  74. package/dist/index.d.ts +18 -2
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +25 -1
  77. package/dist/index.js.map +1 -1
  78. package/dist/index.mjs +27 -3
  79. package/dist/index.mjs.map +1 -1
  80. package/dist/loaders/admin.js +0 -1
  81. package/dist/loaders/admin.js.map +1 -1
  82. package/dist/loaders/admin.mjs +0 -1
  83. package/dist/loaders/admin.mjs.map +1 -1
  84. package/dist/loaders/apis.d.ts.map +1 -1
  85. package/dist/loaders/apis.js +12 -12
  86. package/dist/loaders/apis.js.map +1 -1
  87. package/dist/loaders/apis.mjs +10 -10
  88. package/dist/loaders/apis.mjs.map +1 -1
  89. package/dist/loaders/index.d.ts.map +1 -1
  90. package/dist/loaders/index.js +0 -2
  91. package/dist/loaders/index.js.map +1 -1
  92. package/dist/loaders/index.mjs +0 -2
  93. package/dist/loaders/index.mjs.map +1 -1
  94. package/dist/loaders/plugins/get-enabled-plugins.d.ts.map +1 -1
  95. package/dist/loaders/plugins/get-enabled-plugins.js +41 -15
  96. package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
  97. package/dist/loaders/plugins/get-enabled-plugins.mjs +11 -7
  98. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
  99. package/dist/loaders/plugins/get-user-plugins-config.js +2 -2
  100. package/dist/loaders/plugins/get-user-plugins-config.js.map +1 -1
  101. package/dist/loaders/plugins/index.js +6 -6
  102. package/dist/loaders/plugins/index.js.map +1 -1
  103. package/dist/middlewares/body.d.ts +2 -2
  104. package/dist/middlewares/body.d.ts.map +1 -1
  105. package/dist/middlewares/body.js +6 -6
  106. package/dist/middlewares/body.js.map +1 -1
  107. package/dist/middlewares/body.mjs +4 -4
  108. package/dist/middlewares/body.mjs.map +1 -1
  109. package/dist/middlewares/cors.d.ts.map +1 -1
  110. package/dist/middlewares/cors.js +9 -7
  111. package/dist/middlewares/cors.js.map +1 -1
  112. package/dist/middlewares/cors.mjs +9 -7
  113. package/dist/middlewares/cors.mjs.map +1 -1
  114. package/dist/middlewares/public.js +3 -3
  115. package/dist/middlewares/public.js.map +1 -1
  116. package/dist/middlewares/public.mjs +1 -1
  117. package/dist/middlewares/public.mjs.map +1 -1
  118. package/dist/middlewares/query.d.ts.map +1 -1
  119. package/dist/middlewares/query.js.map +1 -1
  120. package/dist/middlewares/query.mjs.map +1 -1
  121. package/dist/middlewares/responses.js +2 -2
  122. package/dist/middlewares/responses.js.map +1 -1
  123. package/dist/middlewares/security.d.ts.map +1 -1
  124. package/dist/middlewares/security.js +12 -5
  125. package/dist/middlewares/security.js.map +1 -1
  126. package/dist/middlewares/security.mjs +11 -4
  127. package/dist/middlewares/security.mjs.map +1 -1
  128. package/dist/middlewares/session.js +2 -2
  129. package/dist/middlewares/session.js.map +1 -1
  130. package/dist/migrations/database/5.0.0-discard-drafts.d.ts +30 -0
  131. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -0
  132. package/dist/migrations/database/5.0.0-discard-drafts.js +50 -0
  133. package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -0
  134. package/dist/migrations/database/5.0.0-discard-drafts.mjs +50 -0
  135. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -0
  136. package/dist/migrations/draft-publish.d.ts.map +1 -1
  137. package/dist/migrations/draft-publish.js +14 -31
  138. package/dist/migrations/draft-publish.js.map +1 -1
  139. package/dist/migrations/draft-publish.mjs +15 -32
  140. package/dist/migrations/draft-publish.mjs.map +1 -1
  141. package/dist/providers/admin.d.ts +3 -0
  142. package/dist/providers/admin.d.ts.map +1 -0
  143. package/dist/providers/admin.js +20 -0
  144. package/dist/providers/admin.js.map +1 -0
  145. package/dist/providers/admin.mjs +21 -0
  146. package/dist/providers/admin.mjs.map +1 -0
  147. package/dist/providers/coreStore.d.ts +3 -0
  148. package/dist/providers/coreStore.d.ts.map +1 -0
  149. package/dist/providers/coreStore.js +11 -0
  150. package/dist/providers/coreStore.js.map +1 -0
  151. package/dist/providers/coreStore.mjs +12 -0
  152. package/dist/providers/coreStore.mjs.map +1 -0
  153. package/dist/providers/cron.d.ts +3 -0
  154. package/dist/providers/cron.d.ts.map +1 -0
  155. package/dist/providers/cron.js +20 -0
  156. package/dist/providers/cron.js.map +1 -0
  157. package/dist/providers/cron.mjs +21 -0
  158. package/dist/providers/cron.mjs.map +1 -0
  159. package/dist/providers/index.d.ts +3 -0
  160. package/dist/providers/index.d.ts.map +1 -0
  161. package/dist/providers/index.js +11 -0
  162. package/dist/providers/index.js.map +1 -0
  163. package/dist/providers/index.mjs +11 -0
  164. package/dist/providers/index.mjs.map +1 -0
  165. package/dist/providers/provider.d.ts +9 -0
  166. package/dist/providers/provider.d.ts.map +1 -0
  167. package/dist/providers/provider.js +5 -0
  168. package/dist/providers/provider.js.map +1 -0
  169. package/dist/providers/provider.mjs +5 -0
  170. package/dist/providers/provider.mjs.map +1 -0
  171. package/dist/providers/registries.d.ts +3 -0
  172. package/dist/providers/registries.d.ts.map +1 -0
  173. package/dist/providers/registries.js +35 -0
  174. package/dist/providers/registries.js.map +1 -0
  175. package/dist/providers/registries.mjs +36 -0
  176. package/dist/providers/registries.mjs.map +1 -0
  177. package/dist/providers/telemetry.d.ts +3 -0
  178. package/dist/providers/telemetry.d.ts.map +1 -0
  179. package/dist/providers/telemetry.js +19 -0
  180. package/dist/providers/telemetry.js.map +1 -0
  181. package/dist/providers/telemetry.mjs +20 -0
  182. package/dist/providers/telemetry.mjs.map +1 -0
  183. package/dist/providers/webhooks.d.ts +3 -0
  184. package/dist/providers/webhooks.d.ts.map +1 -0
  185. package/dist/providers/webhooks.js +30 -0
  186. package/dist/providers/webhooks.js.map +1 -0
  187. package/dist/providers/webhooks.mjs +31 -0
  188. package/dist/providers/webhooks.mjs.map +1 -0
  189. package/dist/registries/apis.js +2 -2
  190. package/dist/registries/apis.js.map +1 -1
  191. package/dist/registries/components.js +2 -2
  192. package/dist/registries/components.js.map +1 -1
  193. package/dist/registries/content-types.js +3 -3
  194. package/dist/registries/content-types.js.map +1 -1
  195. package/dist/registries/controllers.js +3 -3
  196. package/dist/registries/controllers.js.map +1 -1
  197. package/dist/registries/custom-fields.js +4 -4
  198. package/dist/registries/custom-fields.js.map +1 -1
  199. package/dist/registries/hooks.js +2 -2
  200. package/dist/registries/hooks.js.map +1 -1
  201. package/dist/registries/index.d.ts +0 -1
  202. package/dist/registries/index.d.ts.map +1 -1
  203. package/dist/registries/middlewares.js +3 -3
  204. package/dist/registries/middlewares.js.map +1 -1
  205. package/dist/registries/modules.js +3 -3
  206. package/dist/registries/modules.js.map +1 -1
  207. package/dist/registries/plugins.js +2 -2
  208. package/dist/registries/plugins.js.map +1 -1
  209. package/dist/registries/policies.d.ts +1 -1
  210. package/dist/registries/policies.d.ts.map +1 -1
  211. package/dist/registries/policies.js +5 -5
  212. package/dist/registries/policies.js.map +1 -1
  213. package/dist/registries/policies.mjs +1 -1
  214. package/dist/registries/policies.mjs.map +1 -1
  215. package/dist/registries/services.js +3 -3
  216. package/dist/registries/services.js.map +1 -1
  217. package/dist/services/auth/index.js +3 -3
  218. package/dist/services/auth/index.js.map +1 -1
  219. package/dist/services/config.d.ts +3 -0
  220. package/dist/services/config.d.ts.map +1 -0
  221. package/dist/{registries → services}/config.js +11 -7
  222. package/dist/services/config.js.map +1 -0
  223. package/dist/{registries → services}/config.mjs +10 -7
  224. package/dist/services/config.mjs.map +1 -0
  225. package/dist/services/content-api/index.d.ts +6 -12
  226. package/dist/services/content-api/index.d.ts.map +1 -1
  227. package/dist/services/content-api/index.js +1 -1
  228. package/dist/services/content-api/index.js.map +1 -1
  229. package/dist/services/content-api/index.mjs +1 -1
  230. package/dist/services/content-api/index.mjs.map +1 -1
  231. package/dist/services/content-api/permissions/index.d.ts +6 -12
  232. package/dist/services/content-api/permissions/index.d.ts.map +1 -1
  233. package/dist/services/content-api/permissions/index.js +1 -1
  234. package/dist/services/content-api/permissions/index.js.map +1 -1
  235. package/dist/services/content-api/permissions/index.mjs +1 -1
  236. package/dist/services/content-api/permissions/index.mjs.map +1 -1
  237. package/dist/services/content-api/permissions/providers/action.d.ts +3 -6
  238. package/dist/services/content-api/permissions/providers/action.d.ts.map +1 -1
  239. package/dist/services/content-api/permissions/providers/condition.d.ts +3 -6
  240. package/dist/services/content-api/permissions/providers/condition.d.ts.map +1 -1
  241. package/dist/services/core-store.d.ts.map +1 -1
  242. package/dist/services/core-store.js +3 -3
  243. package/dist/services/core-store.js.map +1 -1
  244. package/dist/services/cron.js +3 -3
  245. package/dist/services/cron.js.map +1 -1
  246. package/dist/services/document-service/attributes/index.d.ts +6 -0
  247. package/dist/services/document-service/attributes/index.d.ts.map +1 -0
  248. package/dist/services/{entity-service → document-service}/attributes/index.js +5 -5
  249. package/dist/services/document-service/attributes/index.js.map +1 -0
  250. package/dist/services/{entity-service → document-service}/attributes/index.mjs +5 -5
  251. package/dist/services/document-service/attributes/index.mjs.map +1 -0
  252. package/dist/services/document-service/attributes/transforms.d.ts.map +1 -0
  253. package/dist/services/{entity-service → document-service}/attributes/transforms.js +3 -3
  254. package/dist/services/document-service/attributes/transforms.js.map +1 -0
  255. package/dist/services/document-service/attributes/transforms.mjs.map +1 -0
  256. package/dist/services/document-service/common.d.ts +1 -1
  257. package/dist/services/document-service/common.d.ts.map +1 -1
  258. package/dist/services/document-service/common.js.map +1 -1
  259. package/dist/services/document-service/common.mjs.map +1 -1
  260. package/dist/services/document-service/components.d.ts +25 -1
  261. package/dist/services/document-service/components.d.ts.map +1 -1
  262. package/dist/services/{entity-service → document-service}/components.js +46 -56
  263. package/dist/services/document-service/components.js.map +1 -0
  264. package/dist/services/{entity-service → document-service}/components.mjs +36 -46
  265. package/dist/services/document-service/components.mjs.map +1 -0
  266. package/dist/services/document-service/draft-and-publish.js +16 -16
  267. package/dist/services/document-service/draft-and-publish.js.map +1 -1
  268. package/dist/services/document-service/entries.d.ts +10 -0
  269. package/dist/services/document-service/entries.d.ts.map +1 -0
  270. package/dist/services/document-service/entries.js +96 -0
  271. package/dist/services/document-service/entries.js.map +1 -0
  272. package/dist/services/document-service/entries.mjs +96 -0
  273. package/dist/services/document-service/entries.mjs.map +1 -0
  274. package/dist/services/document-service/events.d.ts +25 -0
  275. package/dist/services/document-service/events.d.ts.map +1 -0
  276. package/dist/services/document-service/events.js +47 -0
  277. package/dist/services/document-service/events.js.map +1 -0
  278. package/dist/services/document-service/events.mjs +47 -0
  279. package/dist/services/document-service/events.mjs.map +1 -0
  280. package/dist/services/document-service/index.d.ts +0 -2
  281. package/dist/services/document-service/index.d.ts.map +1 -1
  282. package/dist/services/document-service/index.js +13 -2
  283. package/dist/services/document-service/index.js.map +1 -1
  284. package/dist/services/document-service/index.mjs +13 -2
  285. package/dist/services/document-service/index.mjs.map +1 -1
  286. package/dist/services/document-service/internationalization.d.ts.map +1 -1
  287. package/dist/services/document-service/internationalization.js +21 -12
  288. package/dist/services/document-service/internationalization.js.map +1 -1
  289. package/dist/services/document-service/internationalization.mjs +14 -5
  290. package/dist/services/document-service/internationalization.mjs.map +1 -1
  291. package/dist/services/document-service/middlewares/middleware-manager.d.ts +5 -2
  292. package/dist/services/document-service/middlewares/middleware-manager.d.ts.map +1 -1
  293. package/dist/services/document-service/middlewares/middleware-manager.js +8 -5
  294. package/dist/services/document-service/middlewares/middleware-manager.js.map +1 -1
  295. package/dist/services/document-service/middlewares/middleware-manager.mjs +8 -5
  296. package/dist/services/document-service/middlewares/middleware-manager.mjs.map +1 -1
  297. package/dist/services/document-service/params.d.ts +3 -1
  298. package/dist/services/document-service/params.d.ts.map +1 -1
  299. package/dist/services/{entity-service → document-service}/params.js +2 -2
  300. package/dist/services/document-service/params.js.map +1 -0
  301. package/dist/services/document-service/params.mjs.map +1 -0
  302. package/dist/services/document-service/repository.d.ts.map +1 -1
  303. package/dist/services/document-service/repository.js +141 -160
  304. package/dist/services/document-service/repository.js.map +1 -1
  305. package/dist/services/document-service/repository.mjs +117 -136
  306. package/dist/services/document-service/repository.mjs.map +1 -1
  307. package/dist/services/document-service/transform/data.d.ts.map +1 -1
  308. package/dist/services/document-service/transform/data.js +4 -2
  309. package/dist/services/document-service/transform/data.js.map +1 -1
  310. package/dist/services/document-service/transform/data.mjs +4 -2
  311. package/dist/services/document-service/transform/data.mjs.map +1 -1
  312. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  313. package/dist/services/document-service/transform/id-transform.js +2 -2
  314. package/dist/services/document-service/transform/id-transform.js.map +1 -1
  315. package/dist/services/document-service/transform/query.d.ts +5 -0
  316. package/dist/services/document-service/transform/query.d.ts.map +1 -0
  317. package/dist/services/document-service/transform/query.js +9 -0
  318. package/dist/services/document-service/transform/query.js.map +1 -0
  319. package/dist/services/document-service/transform/query.mjs +9 -0
  320. package/dist/services/document-service/transform/query.mjs.map +1 -0
  321. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts +8 -7
  322. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts.map +1 -1
  323. package/dist/services/document-service/transform/relations/extract/data-ids.js +45 -78
  324. package/dist/services/document-service/transform/relations/extract/data-ids.js.map +1 -1
  325. package/dist/services/document-service/transform/relations/extract/data-ids.mjs +44 -77
  326. package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +1 -1
  327. package/dist/services/document-service/transform/relations/transform/data-ids.d.ts +7 -3
  328. package/dist/services/document-service/transform/relations/transform/data-ids.d.ts.map +1 -1
  329. package/dist/services/document-service/transform/relations/transform/data-ids.js +61 -126
  330. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +1 -1
  331. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +61 -126
  332. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +1 -1
  333. package/dist/services/document-service/transform/relations/transform/default-locale.d.ts +9 -0
  334. package/dist/services/document-service/transform/relations/transform/default-locale.d.ts.map +1 -0
  335. package/dist/services/document-service/transform/relations/transform/default-locale.js +32 -0
  336. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +1 -0
  337. package/dist/services/document-service/transform/relations/transform/default-locale.mjs +32 -0
  338. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +1 -0
  339. package/dist/services/document-service/transform/relations/utils/dp.js +2 -2
  340. package/dist/services/document-service/transform/relations/utils/dp.js.map +1 -1
  341. package/dist/services/document-service/transform/relations/utils/i18n.d.ts +2 -2
  342. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  343. package/dist/services/document-service/transform/relations/utils/i18n.js +3 -9
  344. package/dist/services/document-service/transform/relations/utils/i18n.js.map +1 -1
  345. package/dist/services/document-service/transform/relations/utils/i18n.mjs +3 -9
  346. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +1 -1
  347. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts +6 -0
  348. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts.map +1 -0
  349. package/dist/services/document-service/transform/relations/utils/map-relation.js +91 -0
  350. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +1 -0
  351. package/dist/services/document-service/transform/relations/utils/map-relation.mjs +91 -0
  352. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +1 -0
  353. package/dist/services/document-service/transform/relations/utils/types.d.ts +6 -0
  354. package/dist/services/document-service/transform/relations/utils/types.d.ts.map +1 -1
  355. package/dist/services/document-service/utils/populate.d.ts.map +1 -1
  356. package/dist/services/document-service/utils/populate.js +4 -0
  357. package/dist/services/document-service/utils/populate.js.map +1 -1
  358. package/dist/services/document-service/utils/populate.mjs +4 -0
  359. package/dist/services/document-service/utils/populate.mjs.map +1 -1
  360. package/dist/services/entity-service/index.d.ts.map +1 -1
  361. package/dist/services/entity-service/index.js +11 -4
  362. package/dist/services/entity-service/index.js.map +1 -1
  363. package/dist/services/entity-service/index.mjs +11 -4
  364. package/dist/services/entity-service/index.mjs.map +1 -1
  365. package/dist/services/entity-validator/blocks-validator.d.ts +1 -2
  366. package/dist/services/entity-validator/blocks-validator.d.ts.map +1 -1
  367. package/dist/services/entity-validator/blocks-validator.js +4 -3
  368. package/dist/services/entity-validator/blocks-validator.js.map +1 -1
  369. package/dist/services/entity-validator/blocks-validator.mjs +3 -3
  370. package/dist/services/entity-validator/blocks-validator.mjs.map +1 -1
  371. package/dist/services/entity-validator/index.d.ts +15 -1
  372. package/dist/services/entity-validator/index.d.ts.map +1 -1
  373. package/dist/services/entity-validator/index.js +183 -125
  374. package/dist/services/entity-validator/index.js.map +1 -1
  375. package/dist/services/entity-validator/index.mjs +178 -120
  376. package/dist/services/entity-validator/index.mjs.map +1 -1
  377. package/dist/services/entity-validator/validators.d.ts +36 -25
  378. package/dist/services/entity-validator/validators.d.ts.map +1 -1
  379. package/dist/services/entity-validator/validators.js +148 -33
  380. package/dist/services/entity-validator/validators.js.map +1 -1
  381. package/dist/services/entity-validator/validators.mjs +140 -25
  382. package/dist/services/entity-validator/validators.mjs.map +1 -1
  383. package/dist/services/event-hub.d.ts +1 -0
  384. package/dist/services/event-hub.d.ts.map +1 -1
  385. package/dist/services/event-hub.js +9 -4
  386. package/dist/services/event-hub.js.map +1 -1
  387. package/dist/services/event-hub.mjs +9 -4
  388. package/dist/services/event-hub.mjs.map +1 -1
  389. package/dist/services/metrics/middleware.d.ts.map +1 -1
  390. package/dist/services/metrics/rate-limiter.d.ts.map +1 -1
  391. package/dist/services/metrics/rate-limiter.js.map +1 -1
  392. package/dist/services/metrics/rate-limiter.mjs.map +1 -1
  393. package/dist/services/reloader.d.ts +7 -0
  394. package/dist/services/reloader.d.ts.map +1 -0
  395. package/dist/services/reloader.js +36 -0
  396. package/dist/services/reloader.js.map +1 -0
  397. package/dist/services/reloader.mjs +36 -0
  398. package/dist/services/reloader.mjs.map +1 -0
  399. package/dist/services/server/compose-endpoint.d.ts.map +1 -1
  400. package/dist/services/server/compose-endpoint.js +7 -7
  401. package/dist/services/server/compose-endpoint.js.map +1 -1
  402. package/dist/services/server/index.js +1 -1
  403. package/dist/services/server/index.js.map +1 -1
  404. package/dist/services/server/index.mjs +1 -1
  405. package/dist/services/server/index.mjs.map +1 -1
  406. package/dist/services/server/koa.d.ts.map +1 -1
  407. package/dist/services/server/koa.js +4 -4
  408. package/dist/services/server/koa.js.map +1 -1
  409. package/dist/services/server/koa.mjs +1 -1
  410. package/dist/services/server/koa.mjs.map +1 -1
  411. package/dist/services/server/middleware.js +3 -3
  412. package/dist/services/server/middleware.js.map +1 -1
  413. package/dist/services/server/register-routes.js +3 -3
  414. package/dist/services/server/register-routes.js.map +1 -1
  415. package/dist/services/server/register-routes.mjs +3 -3
  416. package/dist/services/server/register-routes.mjs.map +1 -1
  417. package/dist/services/server/routing.d.ts +1 -1
  418. package/dist/services/server/routing.js +2 -2
  419. package/dist/services/server/routing.js.map +1 -1
  420. package/dist/services/utils/dynamic-zones.js +5 -5
  421. package/dist/services/utils/dynamic-zones.js.map +1 -1
  422. package/dist/services/webhook-runner.d.ts +2 -1
  423. package/dist/services/webhook-runner.d.ts.map +1 -1
  424. package/dist/services/webhook-runner.js.map +1 -1
  425. package/dist/services/webhook-runner.mjs.map +1 -1
  426. package/dist/services/webhook-store.d.ts +2 -8
  427. package/dist/services/webhook-store.d.ts.map +1 -1
  428. package/dist/services/webhook-store.js +14 -8
  429. package/dist/services/webhook-store.js.map +1 -1
  430. package/dist/services/webhook-store.mjs +14 -8
  431. package/dist/services/webhook-store.mjs.map +1 -1
  432. package/dist/utils/cron.js +3 -3
  433. package/dist/utils/cron.js.map +1 -1
  434. package/dist/utils/fetch.d.ts.map +1 -1
  435. package/dist/utils/fetch.js +4 -3
  436. package/dist/utils/fetch.js.map +1 -1
  437. package/dist/utils/fetch.mjs +4 -3
  438. package/dist/utils/fetch.mjs.map +1 -1
  439. package/dist/utils/filepath-to-prop-path.d.ts +1 -1
  440. package/dist/utils/filepath-to-prop-path.d.ts.map +1 -1
  441. package/dist/utils/filepath-to-prop-path.js +27 -6
  442. package/dist/utils/filepath-to-prop-path.js.map +1 -1
  443. package/dist/utils/filepath-to-prop-path.mjs +25 -5
  444. package/dist/utils/filepath-to-prop-path.mjs.map +1 -1
  445. package/dist/utils/index.d.ts +2 -1
  446. package/dist/utils/index.d.ts.map +1 -1
  447. package/dist/utils/is-initialized.js +3 -3
  448. package/dist/utils/is-initialized.js.map +1 -1
  449. package/dist/utils/load-files.d.ts.map +1 -1
  450. package/dist/utils/resolve-working-dirs.d.ts +19 -0
  451. package/dist/utils/resolve-working-dirs.d.ts.map +1 -0
  452. package/dist/utils/resolve-working-dirs.js +13 -0
  453. package/dist/utils/resolve-working-dirs.js.map +1 -0
  454. package/dist/utils/resolve-working-dirs.mjs +11 -0
  455. package/dist/utils/resolve-working-dirs.mjs.map +1 -0
  456. package/dist/utils/startup-logger.d.ts.map +1 -1
  457. package/dist/utils/startup-logger.js +4 -4
  458. package/dist/utils/startup-logger.js.map +1 -1
  459. package/dist/utils/startup-logger.mjs +3 -3
  460. package/dist/utils/startup-logger.mjs.map +1 -1
  461. package/dist/utils/transform-content-types-to-models.d.ts +23 -18
  462. package/dist/utils/transform-content-types-to-models.d.ts.map +1 -1
  463. package/dist/utils/transform-content-types-to-models.js +112 -61
  464. package/dist/utils/transform-content-types-to-models.js.map +1 -1
  465. package/dist/utils/transform-content-types-to-models.mjs +111 -60
  466. package/dist/utils/transform-content-types-to-models.mjs.map +1 -1
  467. package/dist/utils/update-notifier/index.d.ts +1 -6
  468. package/dist/utils/update-notifier/index.d.ts.map +1 -1
  469. package/dist/utils/update-notifier/index.js +11 -14
  470. package/dist/utils/update-notifier/index.js.map +1 -1
  471. package/dist/utils/update-notifier/index.mjs +11 -14
  472. package/dist/utils/update-notifier/index.mjs.map +1 -1
  473. package/package.json +31 -27
  474. package/dist/registries/config.d.ts +0 -4
  475. package/dist/registries/config.d.ts.map +0 -1
  476. package/dist/registries/config.js.map +0 -1
  477. package/dist/registries/config.mjs.map +0 -1
  478. package/dist/services/document-service/document-engine.d.ts +0 -2
  479. package/dist/services/document-service/document-engine.d.ts.map +0 -1
  480. package/dist/services/document-service/transform/relations/transform/output-ids.d.ts +0 -2
  481. package/dist/services/document-service/transform/relations/transform/output-ids.d.ts.map +0 -1
  482. package/dist/services/document-service/transform/relations/utils/data.js +0 -12
  483. package/dist/services/document-service/transform/relations/utils/data.js.map +0 -1
  484. package/dist/services/document-service/transform/relations/utils/data.mjs +0 -12
  485. package/dist/services/document-service/transform/relations/utils/data.mjs.map +0 -1
  486. package/dist/services/entity-service/attributes/index.d.ts +0 -6
  487. package/dist/services/entity-service/attributes/index.d.ts.map +0 -1
  488. package/dist/services/entity-service/attributes/index.js.map +0 -1
  489. package/dist/services/entity-service/attributes/index.mjs.map +0 -1
  490. package/dist/services/entity-service/attributes/transforms.d.ts.map +0 -1
  491. package/dist/services/entity-service/attributes/transforms.js.map +0 -1
  492. package/dist/services/entity-service/attributes/transforms.mjs.map +0 -1
  493. package/dist/services/entity-service/components.d.ts +0 -95
  494. package/dist/services/entity-service/components.d.ts.map +0 -1
  495. package/dist/services/entity-service/components.js.map +0 -1
  496. package/dist/services/entity-service/components.mjs.map +0 -1
  497. package/dist/services/entity-service/params.d.ts +0 -8
  498. package/dist/services/entity-service/params.d.ts.map +0 -1
  499. package/dist/services/entity-service/params.js.map +0 -1
  500. package/dist/services/entity-service/params.mjs.map +0 -1
  501. package/dist/utils/get-dirs.d.ts +0 -9
  502. package/dist/utils/get-dirs.d.ts.map +0 -1
  503. package/dist/utils/get-dirs.js.map +0 -1
  504. package/dist/utils/get-dirs.mjs.map +0 -1
  505. /package/dist/services/{entity-service → document-service}/attributes/transforms.d.ts +0 -0
  506. /package/dist/services/{entity-service → document-service}/attributes/transforms.mjs +0 -0
  507. /package/dist/services/{entity-service → document-service}/params.mjs +0 -0
@@ -1,39 +1,50 @@
1
- import strapiUtils from '@strapi/utils';
2
- import type { Schema, Struct } from '@strapi/types';
3
- interface ValidatorMetas<TAttribute extends Schema.Attribute.AnyAttribute> {
1
+ import { yup } from '@strapi/utils';
2
+ import type { Schema, Struct, Modules } from '@strapi/types';
3
+ import type { ComponentContext } from '.';
4
+ export interface ValidatorMetas<TAttribute extends Schema.Attribute.AnyAttribute = Schema.Attribute.AnyAttribute, TValue extends Schema.Attribute.Value<TAttribute> = Schema.Attribute.Value<TAttribute>> {
4
5
  attr: TAttribute;
5
- model: Struct.ContentTypeSchema;
6
+ model: Struct.Schema;
6
7
  updatedAttribute: {
7
8
  name: string;
8
- value: unknown;
9
+ value: TValue;
9
10
  };
10
- entity: Record<string, unknown> | null;
11
+ componentContext?: ComponentContext;
12
+ entity?: Modules.EntityValidator.Entity;
11
13
  }
12
14
  interface ValidatorOptions {
13
15
  isDraft: boolean;
14
16
  locale?: string;
15
17
  }
16
- declare const _default: {
17
- 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>;
18
- 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>;
19
- 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>;
20
- 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>;
21
- 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>;
18
+ export declare const emailValidator: (metas: ValidatorMetas<Schema.Attribute.Email>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
19
+ export declare const uidValidator: (metas: ValidatorMetas<Schema.Attribute.UID>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
20
+ export declare const enumerationValidator: ({ attr }: {
21
+ attr: Schema.Attribute.Enumeration;
22
+ }) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
23
+ export declare const integerValidator: (metas: ValidatorMetas<Schema.Attribute.Integer | Schema.Attribute.BigInteger>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
24
+ export declare const floatValidator: (metas: ValidatorMetas<Schema.Attribute.Decimal | Schema.Attribute.Float>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
25
+ export declare const bigintegerValidator: (metas: ValidatorMetas<Schema.Attribute.BigInteger>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
26
+ export declare const datesValidator: (metas: ValidatorMetas<Schema.Attribute.Date | Schema.Attribute.DateTime | Schema.Attribute.Time | Schema.Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
27
+ export declare const Validators: {
28
+ string: (metas: ValidatorMetas<Schema.Attribute.String | Schema.Attribute.Text | Schema.Attribute.RichText | Schema.Attribute.Password | Schema.Attribute.Email | Schema.Attribute.UID>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
29
+ text: (metas: ValidatorMetas<Schema.Attribute.String | Schema.Attribute.Text | Schema.Attribute.RichText | Schema.Attribute.Password | Schema.Attribute.Email | Schema.Attribute.UID>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
30
+ richtext: (metas: ValidatorMetas<Schema.Attribute.String | Schema.Attribute.Text | Schema.Attribute.RichText | Schema.Attribute.Password | Schema.Attribute.Email | Schema.Attribute.UID>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
31
+ password: (metas: ValidatorMetas<Schema.Attribute.String | Schema.Attribute.Text | Schema.Attribute.RichText | Schema.Attribute.Password | Schema.Attribute.Email | Schema.Attribute.UID>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
32
+ email: (metas: ValidatorMetas<Schema.Attribute.Email>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
22
33
  enumeration: ({ attr }: {
23
- 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;
34
+ attr: Schema.Attribute.Enumeration;
24
35
  }) => 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<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>;
36
+ boolean: () => yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
37
+ uid: (metas: ValidatorMetas<Schema.Attribute.UID>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
27
38
  json: () => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
28
- 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) => strapiUtils.yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
29
- 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>;
30
- 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) => strapiUtils.yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
31
- 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) => strapiUtils.yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
32
- 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>;
33
- 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>;
34
- 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>;
35
- 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>;
36
- blocks: (metas: any, options: any) => strapiUtils.yup.ArraySchema<any, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
39
+ integer: (metas: ValidatorMetas<Schema.Attribute.Integer | Schema.Attribute.BigInteger>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
40
+ biginteger: (metas: ValidatorMetas<Schema.Attribute.BigInteger>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
41
+ float: (metas: ValidatorMetas<Schema.Attribute.Decimal | Schema.Attribute.Float>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
42
+ decimal: (metas: ValidatorMetas<Schema.Attribute.Decimal | Schema.Attribute.Float>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
43
+ date: (metas: ValidatorMetas<Schema.Attribute.Date | Schema.Attribute.DateTime | Schema.Attribute.Time | Schema.Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
44
+ time: (metas: ValidatorMetas<Schema.Attribute.Date | Schema.Attribute.DateTime | Schema.Attribute.Time | Schema.Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
45
+ datetime: (metas: ValidatorMetas<Schema.Attribute.Date | Schema.Attribute.DateTime | Schema.Attribute.Time | Schema.Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
46
+ timestamp: (metas: ValidatorMetas<Schema.Attribute.Date | Schema.Attribute.DateTime | Schema.Attribute.Time | Schema.Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
47
+ blocks: () => yup.ArraySchema<any, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
37
48
  };
38
- export default _default;
49
+ export {};
39
50
  //# 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,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKpD,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,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;;;;;;;;;;;;;;;;;;;;;;;AAuQD,wBAmBE"}
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/services/entity-validator/validators.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe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,WAAW,CAAA;KAAE;;iBAZ5E,eAAe,OAAO,SAAS,CAAC,GAAG,CAAC,WAClC,gBAAgB;;qBAkBlB,eAAe,OAAO,SAAS,CAAC,OAAO,GAAG,OAAO,SAAS,WAAW,CAAC,WACpE,gBAAgB;wBAyBlB,eAAe,OAAO,SAAS,WAAW,CAAC,WACzC,gBAAgB;mBAdlB,eAAe,OAAO,SAAS,CAAC,OAAO,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC,WAC/D,gBAAgB;qBADlB,eAAe,OAAO,SAAS,CAAC,OAAO,GAAG,OAAO,SAAS,CAAC,KAAK,CAAC,WAC/D,gBAAgB;kBAoBlB,eACH,OAAO,SAAS,KAAK,GACrB,OAAO,SAAS,CAAC,QAAQ,GACzB,OAAO,SAAS,CAAC,IAAI,GACrB,OAAO,SAAS,CAAC,SAAS,CAC7B,WACQ,gBAAgB;kBANlB,eACH,OAAO,SAAS,KAAK,GACrB,OAAO,SAAS,CAAC,QAAQ,GACzB,OAAO,SAAS,CAAC,IAAI,GACrB,OAAO,SAAS,CAAC,SAAS,CAC7B,WACQ,gBAAgB;sBANlB,eACH,OAAO,SAAS,KAAK,GACrB,OAAO,SAAS,CAAC,QAAQ,GACzB,OAAO,SAAS,CAAC,IAAI,GACrB,OAAO,SAAS,CAAC,SAAS,CAC7B,WACQ,gBAAgB;uBANlB,eACH,OAAO,SAAS,KAAK,GACrB,OAAO,SAAS,CAAC,QAAQ,GACzB,OAAO,SAAS,CAAC,IAAI,GACrB,OAAO,SAAS,CAAC,SAAS,CAC7B,WACQ,gBAAgB;;CAyB1B,CAAC"}
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
3
  const _ = require("lodash");
3
4
  const strapiUtils = require("@strapi/utils");
4
5
  const blocksValidator = require("./blocks-validator.js");
5
6
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
6
7
  const ___default = /* @__PURE__ */ _interopDefault(_);
7
- const strapiUtils__default = /* @__PURE__ */ _interopDefault(strapiUtils);
8
- const { yup } = strapiUtils__default.default;
9
8
  const addMinLengthValidator = (validator, {
10
9
  attr
11
10
  }, { isDraft }) => {
@@ -18,100 +17,209 @@ const addMaxLengthValidator = (validator, {
18
17
  };
19
18
  const addMinIntegerValidator = (validator, {
20
19
  attr
21
- }) => ___default.default.isNumber(attr.min) ? validator.min(___default.default.toInteger(attr.min)) : validator;
20
+ }, { isDraft }) => ___default.default.isNumber(attr.min) && !isDraft ? validator.min(___default.default.toInteger(attr.min)) : validator;
22
21
  const addMaxIntegerValidator = (validator, {
23
22
  attr
24
23
  }) => ___default.default.isNumber(attr.max) ? validator.max(___default.default.toInteger(attr.max)) : validator;
25
24
  const addMinFloatValidator = (validator, {
26
25
  attr
27
- }) => ___default.default.isNumber(attr.min) ? validator.min(attr.min) : validator;
26
+ }, { isDraft }) => ___default.default.isNumber(attr.min) && !isDraft ? validator.min(attr.min) : validator;
28
27
  const addMaxFloatValidator = (validator, {
29
28
  attr
30
29
  }) => ___default.default.isNumber(attr.max) ? validator.max(attr.max) : validator;
31
30
  const addStringRegexValidator = (validator, {
32
31
  attr
33
- }) => {
34
- return "regex" in attr && !___default.default.isUndefined(attr.regex) ? validator.matches(new RegExp(attr.regex), { excludeEmptyString: !attr.required }) : validator;
32
+ }, { isDraft }) => {
33
+ return "regex" in attr && !___default.default.isUndefined(attr.regex) && !isDraft ? validator.matches(new RegExp(attr.regex), { excludeEmptyString: !attr.required }) : validator;
35
34
  };
36
35
  const addUniqueValidator = (validator, {
37
36
  attr,
38
37
  model,
39
38
  updatedAttribute,
40
- entity
39
+ entity,
40
+ componentContext
41
41
  }, options) => {
42
42
  if (attr.type !== "uid" && !attr.unique) {
43
43
  return validator;
44
44
  }
45
+ const validateUniqueFieldWithinComponent = async (value) => {
46
+ if (!componentContext) {
47
+ return false;
48
+ }
49
+ const hasRepeatableData = componentContext.repeatableData.length > 0;
50
+ if (hasRepeatableData) {
51
+ const { name: updatedName, value: updatedValue } = updatedAttribute;
52
+ const pathToCheck = [...componentContext.pathToComponent.slice(1), updatedName].join(".");
53
+ const values = componentContext.repeatableData.map((item) => {
54
+ return pathToCheck.split(".").reduce((acc, key) => acc[key], item);
55
+ });
56
+ const isUpdatedAttributeRepeatedInThisEntity = values.filter((value2) => value2 === updatedValue).length > 1;
57
+ if (isUpdatedAttributeRepeatedInThisEntity) {
58
+ return false;
59
+ }
60
+ }
61
+ const {
62
+ model: parentModel,
63
+ options: parentOptions,
64
+ id: excludeId
65
+ } = componentContext.parentContent;
66
+ const whereConditions = {};
67
+ const isParentDraft = parentOptions && parentOptions.isDraft;
68
+ whereConditions.publishedAt = isParentDraft ? null : { $notNull: true };
69
+ if (parentOptions?.locale) {
70
+ whereConditions.locale = parentOptions.locale;
71
+ }
72
+ if (excludeId && !Number.isNaN(excludeId)) {
73
+ whereConditions.id = { $ne: excludeId };
74
+ }
75
+ const queryUid = parentModel.uid;
76
+ const queryWhere = {
77
+ ...componentContext.pathToComponent.reduceRight((acc, key) => ({ [key]: acc }), {
78
+ [updatedAttribute.name]: value
79
+ }),
80
+ ...whereConditions
81
+ };
82
+ return !await strapi.db.query(queryUid).findOne({ where: queryWhere });
83
+ };
84
+ const validateUniqueFieldWithinDynamicZoneComponent = async (startOfPath) => {
85
+ if (!componentContext) {
86
+ return false;
87
+ }
88
+ const targetComponentUID = model.uid;
89
+ const countOfValueInThisEntity = (componentContext?.fullDynamicZoneContent ?? []).reduce(
90
+ (acc, component) => {
91
+ if (component.__component !== targetComponentUID) {
92
+ return acc;
93
+ }
94
+ const updatedValue = component[updatedAttribute.name];
95
+ return updatedValue === updatedAttribute.value ? acc + 1 : acc;
96
+ },
97
+ 0
98
+ );
99
+ if (countOfValueInThisEntity > 1) {
100
+ return false;
101
+ }
102
+ const query = {
103
+ select: ["id"],
104
+ where: {},
105
+ populate: {
106
+ [startOfPath]: {
107
+ on: {
108
+ [targetComponentUID]: {
109
+ select: ["id"],
110
+ where: { [updatedAttribute.name]: updatedAttribute.value }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ };
116
+ const { options: options2, id } = componentContext.parentContent;
117
+ if (options2?.isDraft !== void 0) {
118
+ query.where.published_at = options2.isDraft ? { $eq: null } : { $ne: null };
119
+ }
120
+ if (id) {
121
+ query.where.id = { $ne: id };
122
+ }
123
+ if (options2?.locale) {
124
+ query.where.locale = options2.locale;
125
+ }
126
+ const parentModelQueryResult = await strapi.db.query(componentContext.parentContent.model.uid).findMany(query);
127
+ const filteredResults = parentModelQueryResult.filter((result) => Array.isArray(result[startOfPath]) && result[startOfPath].length).flatMap((result) => result[startOfPath]).filter((dynamicZoneComponent) => dynamicZoneComponent.__component === targetComponentUID);
128
+ if (filteredResults.length >= 1) {
129
+ return false;
130
+ }
131
+ return true;
132
+ };
45
133
  return validator.test("unique", "This attribute must be unique", async (value) => {
46
- const isPublish = options.isDraft === false;
47
- if (___default.default.isNil(value)) {
134
+ if (___default.default.isNil(value) || value === "") {
48
135
  return true;
49
136
  }
50
- if (!isPublish && value === entity?.[updatedAttribute.name]) {
137
+ if (options.isDraft) {
51
138
  return true;
52
139
  }
53
- const record = await strapi.db.query(model.uid).findOne({
54
- where: {
55
- locale: options.locale,
56
- publishedAt: options.isDraft ? null : { $notNull: true },
57
- [updatedAttribute.name]: value,
58
- ...entity?.id ? { id: { $ne: entity.id } } : {}
140
+ const hasPathToComponent = componentContext && componentContext.pathToComponent.length > 0;
141
+ if (hasPathToComponent) {
142
+ const startOfPath = componentContext.pathToComponent[0];
143
+ const testingDZ = componentContext.parentContent.model.attributes[startOfPath].type === "dynamiczone";
144
+ if (testingDZ) {
145
+ return validateUniqueFieldWithinDynamicZoneComponent(startOfPath);
59
146
  }
60
- });
61
- return !record;
147
+ return validateUniqueFieldWithinComponent(value);
148
+ }
149
+ const scalarAttributeWhere = {
150
+ [updatedAttribute.name]: value,
151
+ publishedAt: { $notNull: true }
152
+ };
153
+ if (options?.locale) {
154
+ scalarAttributeWhere.locale = options.locale;
155
+ }
156
+ if (entity?.id) {
157
+ scalarAttributeWhere.id = { $ne: entity.id };
158
+ }
159
+ return !await strapi.db.query(model.uid).findOne({ where: scalarAttributeWhere, select: ["id"] });
62
160
  });
63
161
  };
64
162
  const stringValidator = (metas, options) => {
65
- let schema = yup.string().transform((val, originalVal) => originalVal);
163
+ let schema = strapiUtils.yup.string().transform((val, originalVal) => originalVal);
66
164
  schema = addMinLengthValidator(schema, metas, options);
67
165
  schema = addMaxLengthValidator(schema, metas);
68
- schema = addStringRegexValidator(schema, metas);
166
+ schema = addStringRegexValidator(schema, metas, options);
69
167
  schema = addUniqueValidator(schema, metas, options);
70
168
  return schema;
71
169
  };
72
170
  const emailValidator = (metas, options) => {
73
171
  const schema = stringValidator(metas, options);
74
- return schema.email().min(1, "${path} cannot be empty");
172
+ if (options.isDraft) {
173
+ return schema;
174
+ }
175
+ return schema.email().min(
176
+ 1,
177
+ // eslint-disable-next-line no-template-curly-in-string
178
+ "${path} cannot be empty"
179
+ );
75
180
  };
76
181
  const uidValidator = (metas, options) => {
77
182
  const schema = stringValidator(metas, options);
183
+ if (options.isDraft) {
184
+ return schema;
185
+ }
78
186
  return schema.matches(/^[A-Za-z0-9-_.~]*$/);
79
187
  };
80
188
  const enumerationValidator = ({ attr }) => {
81
- return yup.string().oneOf((Array.isArray(attr.enum) ? attr.enum : [attr.enum]).concat(null));
189
+ return strapiUtils.yup.string().oneOf((Array.isArray(attr.enum) ? attr.enum : [attr.enum]).concat(null));
82
190
  };
83
191
  const integerValidator = (metas, options) => {
84
- let schema = yup.number().integer();
85
- schema = addMinIntegerValidator(schema, metas);
192
+ let schema = strapiUtils.yup.number().integer();
193
+ schema = addMinIntegerValidator(schema, metas, options);
86
194
  schema = addMaxIntegerValidator(schema, metas);
87
195
  schema = addUniqueValidator(schema, metas, options);
88
196
  return schema;
89
197
  };
90
198
  const floatValidator = (metas, options) => {
91
- let schema = yup.number();
92
- schema = addMinFloatValidator(schema, metas);
199
+ let schema = strapiUtils.yup.number();
200
+ schema = addMinFloatValidator(schema, metas, options);
93
201
  schema = addMaxFloatValidator(schema, metas);
94
202
  schema = addUniqueValidator(schema, metas, options);
95
203
  return schema;
96
204
  };
97
205
  const bigintegerValidator = (metas, options) => {
98
- const schema = yup.mixed();
206
+ const schema = strapiUtils.yup.mixed();
99
207
  return addUniqueValidator(schema, metas, options);
100
208
  };
101
209
  const datesValidator = (metas, options) => {
102
- const schema = yup.mixed();
210
+ const schema = strapiUtils.yup.mixed();
103
211
  return addUniqueValidator(schema, metas, options);
104
212
  };
105
- const validators = {
213
+ const Validators = {
106
214
  string: stringValidator,
107
215
  text: stringValidator,
108
216
  richtext: stringValidator,
109
217
  password: stringValidator,
110
218
  email: emailValidator,
111
219
  enumeration: enumerationValidator,
112
- boolean: () => yup.boolean(),
220
+ boolean: () => strapiUtils.yup.boolean(),
113
221
  uid: uidValidator,
114
- json: () => yup.mixed(),
222
+ json: () => strapiUtils.yup.mixed(),
115
223
  integer: integerValidator,
116
224
  biginteger: bigintegerValidator,
117
225
  float: floatValidator,
@@ -120,7 +228,14 @@ const validators = {
120
228
  time: datesValidator,
121
229
  datetime: datesValidator,
122
230
  timestamp: datesValidator,
123
- blocks: blocksValidator
231
+ blocks: blocksValidator.blocksValidator
124
232
  };
125
- module.exports = validators;
233
+ exports.Validators = Validators;
234
+ exports.bigintegerValidator = bigintegerValidator;
235
+ exports.datesValidator = datesValidator;
236
+ exports.emailValidator = emailValidator;
237
+ exports.enumerationValidator = enumerationValidator;
238
+ exports.floatValidator = floatValidator;
239
+ exports.integerValidator = integerValidator;
240
+ exports.uidValidator = uidValidator;
126
241
  //# sourceMappingURL=validators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.js","sources":["../../../src/services/entity-validator/validators.ts"],"sourcesContent":["import _ from 'lodash';\nimport strapiUtils from '@strapi/utils';\nimport type { Schema, Struct } from '@strapi/types';\nimport blocksValidator from './blocks-validator';\n\nconst { yup } = strapiUtils;\n\ninterface ValidatorMetas<TAttribute extends Schema.Attribute.AnyAttribute> {\n attr: TAttribute;\n model: Struct.ContentTypeSchema;\n updatedAttribute: { name: string; value: unknown };\n entity: Record<string, unknown> | null;\n}\n\ninterface ValidatorOptions {\n isDraft: boolean;\n locale?: string;\n}\n\n/* Validator utils */\n\n/**\n * Adds minLength validator\n */\nconst addMinLengthValidator = (\n validator: strapiUtils.yup.StringSchema,\n {\n attr,\n }: {\n attr:\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID;\n },\n { isDraft }: ValidatorOptions\n) => {\n return attr.minLength && _.isInteger(attr.minLength) && !isDraft\n ? validator.min(attr.minLength)\n : validator;\n};\n\n/**\n * Adds maxLength validator\n * @returns {StringSchema}\n */\nconst addMaxLengthValidator = (\n validator: strapiUtils.yup.StringSchema,\n {\n attr,\n }: {\n attr:\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID;\n }\n) => {\n return attr.maxLength && _.isInteger(attr.maxLength) ? validator.max(attr.maxLength) : validator;\n};\n\n/**\n * Adds min integer validator\n * @returns {NumberSchema}\n */\nconst addMinIntegerValidator = (\n validator: strapiUtils.yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Integer | Schema.Attribute.BigInteger;\n }\n) => (_.isNumber(attr.min) ? validator.min(_.toInteger(attr.min)) : validator);\n\n/**\n * Adds max integer validator\n */\nconst addMaxIntegerValidator = (\n validator: strapiUtils.yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Integer | Schema.Attribute.BigInteger;\n }\n) => (_.isNumber(attr.max) ? validator.max(_.toInteger(attr.max)) : validator);\n\n/**\n * Adds min float/decimal validator\n */\nconst addMinFloatValidator = (\n validator: strapiUtils.yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Decimal | Schema.Attribute.Float;\n }\n) => (_.isNumber(attr.min) ? validator.min(attr.min) : validator);\n\n/**\n * Adds max float/decimal validator\n */\nconst addMaxFloatValidator = (\n validator: strapiUtils.yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Decimal | Schema.Attribute.Float;\n }\n) => (_.isNumber(attr.max) ? validator.max(attr.max) : validator);\n\n/**\n * Adds regex validator\n */\nconst addStringRegexValidator = (\n validator: strapiUtils.yup.StringSchema,\n {\n attr,\n }: {\n attr:\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID;\n }\n) => {\n return 'regex' in attr && !_.isUndefined(attr.regex)\n ? validator.matches(new RegExp(attr.regex), { excludeEmptyString: !attr.required })\n : validator;\n};\n\n/**\n * Adds unique validator\n */\nconst addUniqueValidator = <T extends strapiUtils.yup.AnySchema>(\n validator: T,\n {\n attr,\n model,\n updatedAttribute,\n entity,\n }: ValidatorMetas<Schema.Attribute.AnyAttribute & Schema.Attribute.UniqueOption>,\n options: ValidatorOptions\n): T => {\n if (attr.type !== 'uid' && !attr.unique) {\n return validator;\n }\n\n return validator.test('unique', 'This attribute must be unique', async (value) => {\n const isPublish = options.isDraft === false;\n\n /**\n * If the attribute value is `null` we want to skip the unique validation.\n * Otherwise it'll only accept a single `null` entry in the database.\n */\n if (_.isNil(value)) {\n return true;\n }\n\n /**\n * If we are updating a draft and the value is unchanged we skip the unique verification. This will\n * prevent the validator to be triggered in case the user activated the\n * unique constraint after already creating multiple entries with\n * the same attribute value for that field.\n */\n if (!isPublish && value === entity?.[updatedAttribute.name]) {\n return true;\n }\n\n /**\n * At this point we know that we are creating a new entry, publishing an entry or that the unique field value has changed\n * We check if there is an entry of this content type in the same locale, publication state and with the same unique field value\n */\n const record = await strapi.db.query(model.uid).findOne({\n where: {\n locale: options.locale,\n publishedAt: options.isDraft ? null : { $notNull: true },\n [updatedAttribute.name]: value,\n ...(entity?.id ? { id: { $ne: entity.id } } : {}),\n },\n });\n\n return !record;\n });\n};\n\n/* Type validators */\n\nconst stringValidator = (\n metas: ValidatorMetas<\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID\n >,\n options: ValidatorOptions\n) => {\n let schema = yup.string().transform((val, originalVal) => originalVal);\n\n schema = addMinLengthValidator(schema, metas, options);\n schema = addMaxLengthValidator(schema, metas);\n schema = addStringRegexValidator(schema, metas);\n schema = addUniqueValidator(schema, metas, options);\n\n return schema;\n};\n\nconst emailValidator = (\n metas: ValidatorMetas<Schema.Attribute.Email>,\n options: ValidatorOptions\n) => {\n const schema = stringValidator(metas, options);\n return schema.email().min(1, '${path} cannot be empty');\n};\n\nconst uidValidator = (metas: ValidatorMetas<Schema.Attribute.UID>, options: ValidatorOptions) => {\n const schema = stringValidator(metas, options);\n\n return schema.matches(/^[A-Za-z0-9-_.~]*$/);\n};\n\nconst enumerationValidator = ({ attr }: { attr: Schema.Attribute.Enumeration }) => {\n return yup\n .string()\n .oneOf((Array.isArray(attr.enum) ? attr.enum : [attr.enum]).concat(null as any));\n};\n\nconst integerValidator = (\n metas: ValidatorMetas<Schema.Attribute.Integer | Schema.Attribute.BigInteger>,\n options: ValidatorOptions\n) => {\n let schema = yup.number().integer();\n\n schema = addMinIntegerValidator(schema, metas);\n schema = addMaxIntegerValidator(schema, metas);\n schema = addUniqueValidator(schema, metas, options);\n\n return schema;\n};\n\nconst floatValidator = (\n metas: ValidatorMetas<Schema.Attribute.Decimal | Schema.Attribute.Float>,\n options: ValidatorOptions\n) => {\n let schema = yup.number();\n schema = addMinFloatValidator(schema, metas);\n schema = addMaxFloatValidator(schema, metas);\n schema = addUniqueValidator(schema, metas, options);\n\n return schema;\n};\n\nconst bigintegerValidator = (\n metas: ValidatorMetas<Schema.Attribute.BigInteger>,\n options: ValidatorOptions\n) => {\n const schema = yup.mixed();\n return addUniqueValidator(schema, metas, options);\n};\n\nconst datesValidator = (\n metas: ValidatorMetas<\n | Schema.Attribute.Date\n | Schema.Attribute.DateTime\n | Schema.Attribute.Time\n | Schema.Attribute.Timestamp\n >,\n options: ValidatorOptions\n) => {\n const schema = yup.mixed();\n return addUniqueValidator(schema, metas, options);\n};\n\nexport default {\n string: stringValidator,\n text: stringValidator,\n richtext: stringValidator,\n password: stringValidator,\n email: emailValidator,\n enumeration: enumerationValidator,\n boolean: () => yup.boolean(),\n uid: uidValidator,\n json: () => yup.mixed(),\n integer: integerValidator,\n biginteger: bigintegerValidator,\n float: floatValidator,\n decimal: floatValidator,\n date: datesValidator,\n time: datesValidator,\n datetime: datesValidator,\n timestamp: datesValidator,\n blocks: blocksValidator,\n};\n"],"names":["strapiUtils","_"],"mappings":";;;;;;;AAKA,MAAM,EAAE,IAAQ,IAAAA;AAmBhB,MAAM,wBAAwB,CAC5B,WACA;AAAA,EACE;AACF,GASA,EAAE,cACC;AACH,SAAO,KAAK,aAAaC,WAAE,QAAA,UAAU,KAAK,SAAS,KAAK,CAAC,UACrD,UAAU,IAAI,KAAK,SAAS,IAC5B;AACN;AAMA,MAAM,wBAAwB,CAC5B,WACA;AAAA,EACE;AACF,MASG;AACI,SAAA,KAAK,aAAaA,mBAAE,UAAU,KAAK,SAAS,IAAI,UAAU,IAAI,KAAK,SAAS,IAAI;AACzF;AAMA,MAAM,yBAAyB,CAC7B,WACA;AAAA,EACE;AACF,MAGIA,WAAE,QAAA,SAAS,KAAK,GAAG,IAAI,UAAU,IAAIA,WAAAA,QAAE,UAAU,KAAK,GAAG,CAAC,IAAI;AAKpE,MAAM,yBAAyB,CAC7B,WACA;AAAA,EACE;AACF,MAGIA,WAAE,QAAA,SAAS,KAAK,GAAG,IAAI,UAAU,IAAIA,WAAAA,QAAE,UAAU,KAAK,GAAG,CAAC,IAAI;AAKpE,MAAM,uBAAuB,CAC3B,WACA;AAAA,EACE;AACF,MAGIA,mBAAE,SAAS,KAA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AAU;AAAA,EACV,UAAU;AAAA,EACV,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS,MAAM,IAAI,QAAQ;AAAA,EAC3B,KAAK;AAAA,EACL,MAAM,MAAM,IAAI,MAAM;AAAA,EACtB,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AAAA,EACX,QAAQ;AACV;;"}
1
+ {"version":3,"file":"validators.js","sources":["../../../src/services/entity-validator/validators.ts"],"sourcesContent":["/**\n * Validators check if the entry data meets specific criteria before saving or publishing.\n * (e.g., length, range, format).\n *\n * Drafts have limited validations (mainly max constraints),\n * while published content undergoes full validation.\n *\n * The system also takes locales into account when validating data.\n * E.g, unique fields must be unique within the same locale.\n */\nimport _ from 'lodash';\nimport { yup } from '@strapi/utils';\nimport type { Schema, Struct, Modules } from '@strapi/types';\nimport { blocksValidator } from './blocks-validator';\n\nimport type { ComponentContext } from '.';\n\nexport interface ValidatorMetas<\n TAttribute extends Schema.Attribute.AnyAttribute = Schema.Attribute.AnyAttribute,\n TValue extends Schema.Attribute.Value<TAttribute> = Schema.Attribute.Value<TAttribute>,\n> {\n attr: TAttribute;\n model: Struct.Schema;\n updatedAttribute: {\n name: string;\n value: TValue;\n };\n componentContext?: ComponentContext;\n entity?: Modules.EntityValidator.Entity;\n}\n\ninterface ValidatorOptions {\n isDraft: boolean;\n locale?: string;\n}\n\n/* Validator utils */\n\n/**\n * Adds minLength validator\n */\nconst addMinLengthValidator = (\n validator: yup.StringSchema,\n {\n attr,\n }: {\n attr:\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID;\n },\n { isDraft }: ValidatorOptions\n) => {\n return attr.minLength && _.isInteger(attr.minLength) && !isDraft\n ? validator.min(attr.minLength)\n : validator;\n};\n\n/**\n * Adds maxLength validator\n * @returns {StringSchema}\n */\nconst addMaxLengthValidator = (\n validator: yup.StringSchema,\n {\n attr,\n }: {\n attr:\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID;\n }\n) => {\n return attr.maxLength && _.isInteger(attr.maxLength) ? validator.max(attr.maxLength) : validator;\n};\n\n/**\n * Adds min integer validator\n * @returns {NumberSchema}\n */\nconst addMinIntegerValidator = (\n validator: yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Integer | Schema.Attribute.BigInteger;\n },\n { isDraft }: ValidatorOptions\n) => (_.isNumber(attr.min) && !isDraft ? validator.min(_.toInteger(attr.min)) : validator);\n\n/**\n * Adds max integer validator\n */\nconst addMaxIntegerValidator = (\n validator: yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Integer | Schema.Attribute.BigInteger;\n }\n) => (_.isNumber(attr.max) ? validator.max(_.toInteger(attr.max)) : validator);\n\n/**\n * Adds min float/decimal validator\n */\nconst addMinFloatValidator = (\n validator: yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Decimal | Schema.Attribute.Float;\n },\n { isDraft }: ValidatorOptions\n) => (_.isNumber(attr.min) && !isDraft ? validator.min(attr.min) : validator);\n\n/**\n * Adds max float/decimal validator\n */\nconst addMaxFloatValidator = (\n validator: yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Decimal | Schema.Attribute.Float;\n }\n) => (_.isNumber(attr.max) ? validator.max(attr.max) : validator);\n\n/**\n * Adds regex validator\n */\nconst addStringRegexValidator = (\n validator: yup.StringSchema,\n {\n attr,\n }: {\n attr:\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID;\n },\n { isDraft }: ValidatorOptions\n) => {\n return 'regex' in attr && !_.isUndefined(attr.regex) && !isDraft\n ? validator.matches(new RegExp(attr.regex), { excludeEmptyString: !attr.required })\n : validator;\n};\n\nconst addUniqueValidator = <T extends yup.AnySchema>(\n validator: T,\n {\n attr,\n model,\n updatedAttribute,\n entity,\n componentContext,\n }: ValidatorMetas<Schema.Attribute.AnyAttribute & Schema.Attribute.UniqueOption>,\n options: ValidatorOptions\n): T => {\n if (attr.type !== 'uid' && !attr.unique) {\n return validator;\n }\n\n const validateUniqueFieldWithinComponent = async (value: any): Promise<boolean> => {\n if (!componentContext) {\n return false;\n }\n\n // If we are validating a unique field within a repeatable component,\n // we first need to ensure that the repeatable in the current entity is\n // valid against itself.\n const hasRepeatableData = componentContext.repeatableData.length > 0;\n if (hasRepeatableData) {\n const { name: updatedName, value: updatedValue } = updatedAttribute;\n // Construct the full path to the unique field within the component.\n const pathToCheck = [...componentContext.pathToComponent.slice(1), updatedName].join('.');\n\n // Extract the values from the repeatable data using the constructed path\n const values = componentContext.repeatableData.map((item) => {\n return pathToCheck.split('.').reduce((acc, key) => acc[key], item as any);\n });\n\n // Check if the value is repeated in the current entity\n const isUpdatedAttributeRepeatedInThisEntity =\n values.filter((value) => value === updatedValue).length > 1;\n\n if (isUpdatedAttributeRepeatedInThisEntity) {\n return false;\n }\n }\n\n /**\n * When `componentContext` is present it means we are dealing with a unique\n * field within a component.\n *\n * The unique validation must consider the specific context of the\n * component, which will always be contained within a parent content type\n * and may also be nested within another component.\n *\n * We construct a query that takes into account the parent's model UID,\n * dimensions (such as draft and publish state/locale) and excludes the current\n * content type entity by its ID if provided.\n */\n const {\n model: parentModel,\n options: parentOptions,\n id: excludeId,\n } = componentContext.parentContent;\n\n const whereConditions: Record<string, any> = {};\n const isParentDraft = parentOptions && parentOptions.isDraft;\n\n whereConditions.publishedAt = isParentDraft ? null : { $notNull: true };\n\n if (parentOptions?.locale) {\n whereConditions.locale = parentOptions.locale;\n }\n\n if (excludeId && !Number.isNaN(excludeId)) {\n whereConditions.id = { $ne: excludeId };\n }\n\n const queryUid = parentModel.uid;\n const queryWhere = {\n ...componentContext.pathToComponent.reduceRight((acc, key) => ({ [key]: acc }), {\n [updatedAttribute.name]: value,\n }),\n\n ...whereConditions,\n };\n\n // The validation should pass if there is no other record found from the query\n return !(await strapi.db.query(queryUid).findOne({ where: queryWhere }));\n };\n\n const validateUniqueFieldWithinDynamicZoneComponent = async (\n startOfPath: string\n ): Promise<boolean> => {\n if (!componentContext) {\n return false;\n }\n\n const targetComponentUID = model.uid;\n // Ensure that the value is unique within the dynamic zone in this entity.\n const countOfValueInThisEntity = (componentContext?.fullDynamicZoneContent ?? []).reduce(\n (acc, component) => {\n if (component.__component !== targetComponentUID) {\n return acc;\n }\n\n const updatedValue = component[updatedAttribute.name];\n return updatedValue === updatedAttribute.value ? acc + 1 : acc;\n },\n 0\n );\n\n if (countOfValueInThisEntity > 1) {\n // If the value is repeated in the current entity, the validation fails.\n return false;\n }\n\n // Build a query for the parent content type to find all entities in the\n // same locale and publication state\n type QueryType = {\n select: string[];\n where: {\n published_at?: { $eq: null } | { $ne: null };\n id?: { $ne: number };\n locale?: string;\n };\n populate: {\n [key: string]: {\n on: {\n [key: string]: {\n select: string[];\n where: { [key: string]: string | number | boolean };\n };\n };\n };\n };\n };\n\n // Populate the dynamic zone for any components that share the same value\n // as the updated attribute.\n const query: QueryType = {\n select: ['id'],\n where: {},\n populate: {\n [startOfPath]: {\n on: {\n [targetComponentUID]: {\n select: ['id'],\n where: { [updatedAttribute.name]: updatedAttribute.value },\n },\n },\n },\n },\n };\n\n const { options, id } = componentContext.parentContent;\n\n if (options?.isDraft !== undefined) {\n query.where.published_at = options.isDraft ? { $eq: null } : { $ne: null };\n }\n\n if (id) {\n query.where.id = { $ne: id };\n }\n\n if (options?.locale) {\n query.where.locale = options.locale;\n }\n\n const parentModelQueryResult = await strapi.db\n .query(componentContext.parentContent.model.uid)\n .findMany(query);\n\n // Filter the results to only include results that have components in the\n // dynamic zone that match the target component type.\n const filteredResults = parentModelQueryResult\n .filter((result) => Array.isArray(result[startOfPath]) && result[startOfPath].length)\n .flatMap((result) => result[startOfPath])\n .filter((dynamicZoneComponent) => dynamicZoneComponent.__component === targetComponentUID);\n\n if (filteredResults.length >= 1) {\n return false;\n }\n\n return true;\n };\n\n return validator.test('unique', 'This attribute must be unique', async (value) => {\n /**\n * If the attribute value is `null` or an empty string we want to skip the unique validation.\n * Otherwise it'll only accept a single entry with that value in the database.\n */\n if (_.isNil(value) || value === '') {\n return true;\n }\n\n /**\n * We don't validate any unique constraint for draft entries.\n */\n if (options.isDraft) {\n return true;\n }\n\n const hasPathToComponent = componentContext && componentContext.pathToComponent.length > 0;\n if (hasPathToComponent) {\n // Detect if we are validating within a dynamiczone by checking if the first\n // path is a dynamiczone attribute in the parent content type.\n const startOfPath = componentContext.pathToComponent[0];\n const testingDZ =\n componentContext.parentContent.model.attributes[startOfPath].type === 'dynamiczone';\n\n if (testingDZ) {\n return validateUniqueFieldWithinDynamicZoneComponent(startOfPath);\n }\n\n return validateUniqueFieldWithinComponent(value);\n }\n\n /**\n * Here we are validating a scalar unique field from the content type's schema.\n * We construct a query to check if the value is unique\n * considering dimensions (e.g. locale, publication state) and excluding the current entity by its ID if available.\n */\n const scalarAttributeWhere: Record<string, any> = {\n [updatedAttribute.name]: value,\n publishedAt: { $notNull: true },\n };\n\n if (options?.locale) {\n scalarAttributeWhere.locale = options.locale;\n }\n\n if (entity?.id) {\n scalarAttributeWhere.id = { $ne: entity.id };\n }\n\n // The validation should pass if there is no other record found from the query\n return !(await strapi.db\n .query(model.uid)\n .findOne({ where: scalarAttributeWhere, select: ['id'] }));\n });\n};\n\n/* Type validators */\n\nconst stringValidator = (\n metas: ValidatorMetas<\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID\n >,\n options: ValidatorOptions\n) => {\n let schema = yup.string().transform((val, originalVal) => originalVal);\n\n schema = addMinLengthValidator(schema, metas, options);\n schema = addMaxLengthValidator(schema, metas);\n schema = addStringRegexValidator(schema, metas, options);\n schema = addUniqueValidator(schema, metas, options);\n\n return schema;\n};\n\nexport const emailValidator = (\n metas: ValidatorMetas<Schema.Attribute.Email>,\n options: ValidatorOptions\n) => {\n const schema = stringValidator(metas, options);\n\n if (options.isDraft) {\n return schema;\n }\n\n return schema.email().min(\n 1,\n // eslint-disable-next-line no-template-curly-in-string\n '${path} cannot be empty'\n );\n};\n\nexport const uidValidator = (\n metas: ValidatorMetas<Schema.Attribute.UID>,\n options: ValidatorOptions\n) => {\n const schema = stringValidator(metas, options);\n\n if (options.isDraft) {\n return schema;\n }\n\n return schema.matches(/^[A-Za-z0-9-_.~]*$/);\n};\n\nexport const enumerationValidator = ({ attr }: { attr: Schema.Attribute.Enumeration }) => {\n return yup\n .string()\n .oneOf((Array.isArray(attr.enum) ? attr.enum : [attr.enum]).concat(null as any));\n};\n\nexport const integerValidator = (\n metas: ValidatorMetas<Schema.Attribute.Integer | Schema.Attribute.BigInteger>,\n options: ValidatorOptions\n) => {\n let schema = yup.number().integer();\n\n schema = addMinIntegerValidator(schema, metas, options);\n schema = addMaxIntegerValidator(schema, metas);\n schema = addUniqueValidator(schema, metas, options);\n\n return schema;\n};\n\nexport const floatValidator = (\n metas: ValidatorMetas<Schema.Attribute.Decimal | Schema.Attribute.Float>,\n options: ValidatorOptions\n) => {\n let schema = yup.number();\n\n schema = addMinFloatValidator(schema, metas, options);\n schema = addMaxFloatValidator(schema, metas);\n schema = addUniqueValidator(schema, metas, options);\n\n return schema;\n};\n\nexport const bigintegerValidator = (\n metas: ValidatorMetas<Schema.Attribute.BigInteger>,\n options: ValidatorOptions\n) => {\n const schema = yup.mixed();\n return addUniqueValidator(schema, metas, options);\n};\n\nexport const datesValidator = (\n metas: ValidatorMetas<\n | Schema.Attribute.Date\n | Schema.Attribute.DateTime\n | Schema.Attribute.Time\n | Schema.Attribute.Timestamp\n >,\n options: ValidatorOptions\n) => {\n const schema = yup.mixed();\n return addUniqueValidator(schema, metas, options);\n};\n\nexport const Validators = {\n string: stringValidator,\n text: stringValidator,\n richtext: stringValidator,\n password: stringValidator,\n email: emailValidator,\n enumeration: enumerationValidator,\n boolean: () => yup.boolean(),\n uid: uidValidator,\n json: () => yup.mixed(),\n integer: integerValidator,\n biginteger: bigintegerValidator,\n float: floatValidator,\n decimal: floatValidator,\n date: datesValidator,\n time: datesValidator,\n datetime: datesValidator,\n timestamp: datesValidator,\n blocks: blocksValidator,\n};\n"],"names":["_","value","options","yup","blocksValidator"],"mappings":";;;;;;;AAyCA,MAAM,wBAAwB,CAC5B,WACA;AAAA,EACE;AACF,GASA,EAAE,cACC;AACH,SAAO,KAAK,aAAaA,WAAE,QAAA,UAAU,KAAK,SAAS,KAAK,CAAC,UACrD,UAAU,IAAI,KAAK,SAAS,IAC5B;AACN;AAMA,MAAM,wBAAwB,CAC5B,WACA;AAAA,EACE;AACF,MASG;AACI,SAAA,KAAK,aAAaA,mBAAE,UAAU,KAAK,SAAS,IAAI,UAAU,IAAI,KAAK,SAAS,IAAI;AACzF;AAMA,MAAM,yBAAyB,CAC7B,WACA;AAAA,EACE;AACF,GAGA,EAAE,QAAQ,MACNA,WAAE,QAAA,SAAS,KAAK,GAAG,KAAK,CAAC,UAAU,UAAU,IAAIA,WAAAA,QAAE,UAAU,KAAK,GAAG,CAAC,IAAI;AAKhF,MAAM,yBAAyB,CAC7B,WACA;AAAA,EACE;AACF,MAGIA,WAAE,QAAA,SAAS,KAAK,GAAG,IAAI,UAAU,IAAIA,WAAAA,QAAE,UAAU,KAAK,GAAG,CAAC,IAAI;AAKpE,MAAM,uBAAuB,CAC3B,WACA;AAAA,EACE;AACF,GAGA,EAAE,QACE,MAAAA,WAAA,QAAE,SAAS,KAAK,GAAG,KAAK,CAAC,UAAU,UAAU,IAAI,KAAK,GAAG,IAAI;AAKnE,MAAM,uBAAuB,CAC3B,WACA;AAAA,EACE;AACF,MAGIA,mBAAE,SAAS,KAAK,GAAG,IAAI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