@strapi/core 0.0.0-experimental.90ca9123352ed07e0a9cedaf4bcad1475e74137f → 0.0.0-experimental.9612538209f3c68285c5dea8fe26f96e7e470afd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (812) hide show
  1. package/dist/Strapi.d.ts +52 -59
  2. package/dist/Strapi.d.ts.map +1 -1
  3. package/dist/Strapi.js +193 -209
  4. package/dist/Strapi.js.map +1 -1
  5. package/dist/Strapi.mjs +165 -201
  6. package/dist/Strapi.mjs.map +1 -1
  7. package/dist/configuration/config-loader.d.ts.map +1 -1
  8. package/dist/configuration/config-loader.js +9 -5
  9. package/dist/configuration/config-loader.js.map +1 -1
  10. package/dist/configuration/config-loader.mjs +9 -5
  11. package/dist/configuration/config-loader.mjs.map +1 -1
  12. package/dist/configuration/get-dirs.d.ts +10 -0
  13. package/dist/configuration/get-dirs.d.ts.map +1 -0
  14. package/dist/{utils → configuration}/get-dirs.js +3 -2
  15. package/dist/configuration/get-dirs.js.map +1 -0
  16. package/dist/{utils → configuration}/get-dirs.mjs +3 -2
  17. package/dist/configuration/get-dirs.mjs.map +1 -0
  18. package/dist/configuration/index.d.ts +4 -7
  19. package/dist/configuration/index.d.ts.map +1 -1
  20. package/dist/configuration/index.js +10 -8
  21. package/dist/configuration/index.js.map +1 -1
  22. package/dist/configuration/index.mjs +6 -5
  23. package/dist/configuration/index.mjs.map +1 -1
  24. package/dist/configuration/urls.d.ts +8 -0
  25. package/dist/configuration/urls.d.ts.map +1 -0
  26. package/dist/configuration/urls.js +68 -0
  27. package/dist/configuration/urls.js.map +1 -0
  28. package/dist/configuration/urls.mjs +66 -0
  29. package/dist/configuration/urls.mjs.map +1 -0
  30. package/dist/container.d.ts +2 -2
  31. package/dist/container.d.ts.map +1 -1
  32. package/dist/container.js.map +1 -1
  33. package/dist/container.mjs.map +1 -1
  34. package/dist/core-api/controller/collection-type.d.ts +3 -3
  35. package/dist/core-api/controller/collection-type.d.ts.map +1 -1
  36. package/dist/core-api/controller/collection-type.js +3 -0
  37. package/dist/core-api/controller/collection-type.js.map +1 -1
  38. package/dist/core-api/controller/collection-type.mjs +3 -0
  39. package/dist/core-api/controller/collection-type.mjs.map +1 -1
  40. package/dist/core-api/controller/index.d.ts +3 -3
  41. package/dist/core-api/controller/index.d.ts.map +1 -1
  42. package/dist/core-api/controller/index.js +11 -6
  43. package/dist/core-api/controller/index.js.map +1 -1
  44. package/dist/core-api/controller/index.mjs +12 -7
  45. package/dist/core-api/controller/index.mjs.map +1 -1
  46. package/dist/core-api/controller/single-type.d.ts +3 -3
  47. package/dist/core-api/controller/single-type.d.ts.map +1 -1
  48. package/dist/core-api/controller/single-type.js +1 -0
  49. package/dist/core-api/controller/single-type.js.map +1 -1
  50. package/dist/core-api/controller/single-type.mjs +1 -0
  51. package/dist/core-api/controller/single-type.mjs.map +1 -1
  52. package/dist/core-api/controller/transform.d.ts +10 -9
  53. package/dist/core-api/controller/transform.d.ts.map +1 -1
  54. package/dist/core-api/controller/transform.js +17 -11
  55. package/dist/core-api/controller/transform.js.map +1 -1
  56. package/dist/core-api/controller/transform.mjs +17 -11
  57. package/dist/core-api/controller/transform.mjs.map +1 -1
  58. package/dist/core-api/routes/index.d.ts.map +1 -1
  59. package/dist/core-api/service/collection-type.d.ts +11 -17
  60. package/dist/core-api/service/collection-type.d.ts.map +1 -1
  61. package/dist/core-api/service/collection-type.js +18 -7
  62. package/dist/core-api/service/collection-type.js.map +1 -1
  63. package/dist/core-api/service/collection-type.mjs +19 -8
  64. package/dist/core-api/service/collection-type.mjs.map +1 -1
  65. package/dist/core-api/service/index.d.ts +3 -3
  66. package/dist/core-api/service/index.d.ts.map +1 -1
  67. package/dist/core-api/service/index.js.map +1 -1
  68. package/dist/core-api/service/index.mjs.map +1 -1
  69. package/dist/core-api/service/pagination.d.ts +4 -11
  70. package/dist/core-api/service/pagination.d.ts.map +1 -1
  71. package/dist/core-api/service/pagination.js +14 -40
  72. package/dist/core-api/service/pagination.js.map +1 -1
  73. package/dist/core-api/service/pagination.mjs +16 -42
  74. package/dist/core-api/service/pagination.mjs.map +1 -1
  75. package/dist/core-api/service/single-type.d.ts +7 -6
  76. package/dist/core-api/service/single-type.d.ts.map +1 -1
  77. package/dist/core-api/service/single-type.js +21 -3
  78. package/dist/core-api/service/single-type.js.map +1 -1
  79. package/dist/core-api/service/single-type.mjs +21 -3
  80. package/dist/core-api/service/single-type.mjs.map +1 -1
  81. package/dist/domain/content-type/index.d.ts +1 -1
  82. package/dist/domain/content-type/index.d.ts.map +1 -1
  83. package/dist/domain/content-type/index.js +3 -0
  84. package/dist/domain/content-type/index.js.map +1 -1
  85. package/dist/domain/content-type/index.mjs +3 -0
  86. package/dist/domain/content-type/index.mjs.map +1 -1
  87. package/dist/domain/content-type/validator.d.ts.map +1 -1
  88. package/dist/domain/content-type/validator.js +1 -1
  89. package/dist/domain/content-type/validator.js.map +1 -1
  90. package/dist/domain/content-type/validator.mjs +2 -2
  91. package/dist/domain/content-type/validator.mjs.map +1 -1
  92. package/dist/domain/module/index.d.ts +24 -23
  93. package/dist/domain/module/index.d.ts.map +1 -1
  94. package/dist/domain/module/index.js +3 -3
  95. package/dist/domain/module/index.js.map +1 -1
  96. package/dist/domain/module/index.mjs +4 -4
  97. package/dist/domain/module/index.mjs.map +1 -1
  98. package/dist/ee/index.d.ts +4 -2
  99. package/dist/ee/index.d.ts.map +1 -1
  100. package/dist/ee/index.js.map +1 -1
  101. package/dist/ee/index.mjs.map +1 -1
  102. package/dist/ee/license.d.ts +2 -2
  103. package/dist/ee/license.d.ts.map +1 -1
  104. package/dist/ee/license.js +2 -1
  105. package/dist/ee/license.js.map +1 -1
  106. package/dist/ee/license.mjs +2 -1
  107. package/dist/ee/license.mjs.map +1 -1
  108. package/dist/factories.d.ts +10 -10
  109. package/dist/factories.d.ts.map +1 -1
  110. package/dist/factories.js +6 -2
  111. package/dist/factories.js.map +1 -1
  112. package/dist/factories.mjs +6 -2
  113. package/dist/factories.mjs.map +1 -1
  114. package/dist/index.d.ts +4 -2
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +25 -1
  117. package/dist/index.js.map +1 -1
  118. package/dist/index.mjs +27 -3
  119. package/dist/index.mjs.map +1 -1
  120. package/dist/loaders/admin.d.ts +2 -2
  121. package/dist/loaders/admin.d.ts.map +1 -1
  122. package/dist/loaders/admin.js +0 -1
  123. package/dist/loaders/admin.js.map +1 -1
  124. package/dist/loaders/admin.mjs +0 -1
  125. package/dist/loaders/admin.mjs.map +1 -1
  126. package/dist/loaders/apis.d.ts +2 -2
  127. package/dist/loaders/apis.d.ts.map +1 -1
  128. package/dist/loaders/apis.js +11 -11
  129. package/dist/loaders/apis.js.map +1 -1
  130. package/dist/loaders/apis.mjs +12 -12
  131. package/dist/loaders/apis.mjs.map +1 -1
  132. package/dist/loaders/components.d.ts +2 -2
  133. package/dist/loaders/components.d.ts.map +1 -1
  134. package/dist/loaders/components.js.map +1 -1
  135. package/dist/loaders/components.mjs.map +1 -1
  136. package/dist/loaders/index.d.ts +2 -2
  137. package/dist/loaders/index.d.ts.map +1 -1
  138. package/dist/loaders/index.js +0 -2
  139. package/dist/loaders/index.js.map +1 -1
  140. package/dist/loaders/index.mjs +0 -2
  141. package/dist/loaders/index.mjs.map +1 -1
  142. package/dist/loaders/middlewares.d.ts +2 -2
  143. package/dist/loaders/middlewares.d.ts.map +1 -1
  144. package/dist/loaders/middlewares.js.map +1 -1
  145. package/dist/loaders/middlewares.mjs.map +1 -1
  146. package/dist/loaders/plugins/get-enabled-plugins.d.ts +2 -2
  147. package/dist/loaders/plugins/get-enabled-plugins.d.ts.map +1 -1
  148. package/dist/loaders/plugins/get-enabled-plugins.js +8 -6
  149. package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
  150. package/dist/loaders/plugins/get-enabled-plugins.mjs +9 -7
  151. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
  152. package/dist/loaders/plugins/index.d.ts +2 -2
  153. package/dist/loaders/plugins/index.d.ts.map +1 -1
  154. package/dist/loaders/plugins/index.js.map +1 -1
  155. package/dist/loaders/plugins/index.mjs.map +1 -1
  156. package/dist/loaders/policies.d.ts +2 -2
  157. package/dist/loaders/policies.d.ts.map +1 -1
  158. package/dist/loaders/policies.js.map +1 -1
  159. package/dist/loaders/policies.mjs.map +1 -1
  160. package/dist/loaders/sanitizers.d.ts +2 -2
  161. package/dist/loaders/sanitizers.d.ts.map +1 -1
  162. package/dist/loaders/sanitizers.js.map +1 -1
  163. package/dist/loaders/sanitizers.mjs.map +1 -1
  164. package/dist/loaders/src-index.d.ts +2 -2
  165. package/dist/loaders/src-index.d.ts.map +1 -1
  166. package/dist/loaders/src-index.js.map +1 -1
  167. package/dist/loaders/src-index.mjs.map +1 -1
  168. package/dist/loaders/validators.d.ts +2 -2
  169. package/dist/loaders/validators.d.ts.map +1 -1
  170. package/dist/loaders/validators.js.map +1 -1
  171. package/dist/loaders/validators.mjs.map +1 -1
  172. package/dist/middlewares/body.d.ts +4 -4
  173. package/dist/middlewares/body.d.ts.map +1 -1
  174. package/dist/middlewares/body.js +4 -4
  175. package/dist/middlewares/body.js.map +1 -1
  176. package/dist/middlewares/body.mjs +4 -4
  177. package/dist/middlewares/body.mjs.map +1 -1
  178. package/dist/middlewares/compression.d.ts +2 -2
  179. package/dist/middlewares/compression.d.ts.map +1 -1
  180. package/dist/middlewares/compression.js.map +1 -1
  181. package/dist/middlewares/compression.mjs.map +1 -1
  182. package/dist/middlewares/cors.d.ts +2 -2
  183. package/dist/middlewares/cors.d.ts.map +1 -1
  184. package/dist/middlewares/cors.js +6 -8
  185. package/dist/middlewares/cors.js.map +1 -1
  186. package/dist/middlewares/cors.mjs +6 -8
  187. package/dist/middlewares/cors.mjs.map +1 -1
  188. package/dist/middlewares/errors.d.ts +2 -2
  189. package/dist/middlewares/errors.d.ts.map +1 -1
  190. package/dist/middlewares/errors.js.map +1 -1
  191. package/dist/middlewares/errors.mjs.map +1 -1
  192. package/dist/middlewares/favicon.d.ts +2 -2
  193. package/dist/middlewares/favicon.d.ts.map +1 -1
  194. package/dist/middlewares/favicon.js.map +1 -1
  195. package/dist/middlewares/favicon.mjs.map +1 -1
  196. package/dist/middlewares/index.d.ts +2 -2
  197. package/dist/middlewares/index.d.ts.map +1 -1
  198. package/dist/middlewares/index.js.map +1 -1
  199. package/dist/middlewares/index.mjs.map +1 -1
  200. package/dist/middlewares/ip.d.ts +2 -2
  201. package/dist/middlewares/ip.d.ts.map +1 -1
  202. package/dist/middlewares/ip.js.map +1 -1
  203. package/dist/middlewares/ip.mjs.map +1 -1
  204. package/dist/middlewares/logger.d.ts +2 -2
  205. package/dist/middlewares/logger.d.ts.map +1 -1
  206. package/dist/middlewares/logger.js.map +1 -1
  207. package/dist/middlewares/logger.mjs.map +1 -1
  208. package/dist/middlewares/powered-by.d.ts +2 -2
  209. package/dist/middlewares/powered-by.d.ts.map +1 -1
  210. package/dist/middlewares/powered-by.js.map +1 -1
  211. package/dist/middlewares/powered-by.mjs.map +1 -1
  212. package/dist/middlewares/public.d.ts +2 -2
  213. package/dist/middlewares/public.d.ts.map +1 -1
  214. package/dist/middlewares/public.js +1 -1
  215. package/dist/middlewares/public.js.map +1 -1
  216. package/dist/middlewares/public.mjs +1 -1
  217. package/dist/middlewares/public.mjs.map +1 -1
  218. package/dist/middlewares/query.d.ts +2 -2
  219. package/dist/middlewares/query.d.ts.map +1 -1
  220. package/dist/middlewares/query.js.map +1 -1
  221. package/dist/middlewares/query.mjs.map +1 -1
  222. package/dist/middlewares/response-time.d.ts +2 -2
  223. package/dist/middlewares/response-time.d.ts.map +1 -1
  224. package/dist/middlewares/response-time.js.map +1 -1
  225. package/dist/middlewares/response-time.mjs.map +1 -1
  226. package/dist/middlewares/responses.d.ts +3 -3
  227. package/dist/middlewares/responses.d.ts.map +1 -1
  228. package/dist/middlewares/responses.js.map +1 -1
  229. package/dist/middlewares/responses.mjs.map +1 -1
  230. package/dist/middlewares/security.d.ts +2 -2
  231. package/dist/middlewares/security.d.ts.map +1 -1
  232. package/dist/middlewares/security.js +11 -4
  233. package/dist/middlewares/security.js.map +1 -1
  234. package/dist/middlewares/security.mjs +12 -5
  235. package/dist/middlewares/security.mjs.map +1 -1
  236. package/dist/middlewares/session.d.ts +2 -2
  237. package/dist/middlewares/session.d.ts.map +1 -1
  238. package/dist/middlewares/session.js.map +1 -1
  239. package/dist/middlewares/session.mjs.map +1 -1
  240. package/dist/migrations/database/5.0.0-discard-drafts.d.ts +30 -0
  241. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -0
  242. package/dist/migrations/database/5.0.0-discard-drafts.js +50 -0
  243. package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -0
  244. package/dist/migrations/database/5.0.0-discard-drafts.mjs +50 -0
  245. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -0
  246. package/dist/migrations/draft-publish.d.ts +17 -0
  247. package/dist/migrations/draft-publish.d.ts.map +1 -0
  248. package/dist/migrations/draft-publish.js +42 -0
  249. package/dist/migrations/draft-publish.js.map +1 -0
  250. package/dist/migrations/draft-publish.mjs +42 -0
  251. package/dist/migrations/draft-publish.mjs.map +1 -0
  252. package/dist/providers/admin.d.ts +3 -0
  253. package/dist/providers/admin.d.ts.map +1 -0
  254. package/dist/providers/admin.js +20 -0
  255. package/dist/providers/admin.js.map +1 -0
  256. package/dist/providers/admin.mjs +21 -0
  257. package/dist/providers/admin.mjs.map +1 -0
  258. package/dist/providers/coreStore.d.ts +3 -0
  259. package/dist/providers/coreStore.d.ts.map +1 -0
  260. package/dist/providers/coreStore.js +11 -0
  261. package/dist/providers/coreStore.js.map +1 -0
  262. package/dist/providers/coreStore.mjs +12 -0
  263. package/dist/providers/coreStore.mjs.map +1 -0
  264. package/dist/providers/cron.d.ts +3 -0
  265. package/dist/providers/cron.d.ts.map +1 -0
  266. package/dist/providers/cron.js +20 -0
  267. package/dist/providers/cron.js.map +1 -0
  268. package/dist/providers/cron.mjs +21 -0
  269. package/dist/providers/cron.mjs.map +1 -0
  270. package/dist/providers/index.d.ts +3 -0
  271. package/dist/providers/index.d.ts.map +1 -0
  272. package/dist/providers/index.js +11 -0
  273. package/dist/providers/index.js.map +1 -0
  274. package/dist/providers/index.mjs +11 -0
  275. package/dist/providers/index.mjs.map +1 -0
  276. package/dist/providers/provider.d.ts +9 -0
  277. package/dist/providers/provider.d.ts.map +1 -0
  278. package/dist/providers/provider.js +5 -0
  279. package/dist/providers/provider.js.map +1 -0
  280. package/dist/providers/provider.mjs +5 -0
  281. package/dist/providers/provider.mjs.map +1 -0
  282. package/dist/providers/registries.d.ts +3 -0
  283. package/dist/providers/registries.d.ts.map +1 -0
  284. package/dist/providers/registries.js +35 -0
  285. package/dist/providers/registries.js.map +1 -0
  286. package/dist/providers/registries.mjs +36 -0
  287. package/dist/providers/registries.mjs.map +1 -0
  288. package/dist/providers/telemetry.d.ts +3 -0
  289. package/dist/providers/telemetry.d.ts.map +1 -0
  290. package/dist/providers/telemetry.js +19 -0
  291. package/dist/providers/telemetry.js.map +1 -0
  292. package/dist/providers/telemetry.mjs +20 -0
  293. package/dist/providers/telemetry.mjs.map +1 -0
  294. package/dist/providers/webhooks.d.ts +3 -0
  295. package/dist/providers/webhooks.d.ts.map +1 -0
  296. package/dist/providers/webhooks.js +30 -0
  297. package/dist/providers/webhooks.js.map +1 -0
  298. package/dist/providers/webhooks.mjs +31 -0
  299. package/dist/providers/webhooks.mjs.map +1 -0
  300. package/dist/registries/apis.d.ts +2 -2
  301. package/dist/registries/apis.d.ts.map +1 -1
  302. package/dist/registries/apis.js.map +1 -1
  303. package/dist/registries/apis.mjs.map +1 -1
  304. package/dist/registries/components.d.ts +6 -6
  305. package/dist/registries/components.d.ts.map +1 -1
  306. package/dist/registries/components.js.map +1 -1
  307. package/dist/registries/components.mjs.map +1 -1
  308. package/dist/registries/content-types.d.ts +5 -5
  309. package/dist/registries/content-types.d.ts.map +1 -1
  310. package/dist/registries/content-types.js.map +1 -1
  311. package/dist/registries/content-types.mjs.map +1 -1
  312. package/dist/registries/controllers.d.ts +10 -10
  313. package/dist/registries/controllers.d.ts.map +1 -1
  314. package/dist/registries/controllers.js.map +1 -1
  315. package/dist/registries/controllers.mjs.map +1 -1
  316. package/dist/registries/custom-fields.d.ts +3 -3
  317. package/dist/registries/custom-fields.d.ts.map +1 -1
  318. package/dist/registries/custom-fields.js.map +1 -1
  319. package/dist/registries/custom-fields.mjs.map +1 -1
  320. package/dist/registries/index.d.ts +0 -1
  321. package/dist/registries/index.d.ts.map +1 -1
  322. package/dist/registries/middlewares.d.ts +6 -6
  323. package/dist/registries/middlewares.d.ts.map +1 -1
  324. package/dist/registries/middlewares.js.map +1 -1
  325. package/dist/registries/middlewares.mjs.map +1 -1
  326. package/dist/registries/modules.d.ts +2 -2
  327. package/dist/registries/modules.d.ts.map +1 -1
  328. package/dist/registries/modules.js.map +1 -1
  329. package/dist/registries/modules.mjs.map +1 -1
  330. package/dist/registries/plugins.d.ts +5 -5
  331. package/dist/registries/plugins.d.ts.map +1 -1
  332. package/dist/registries/plugins.js.map +1 -1
  333. package/dist/registries/plugins.mjs.map +1 -1
  334. package/dist/registries/policies.d.ts +23 -11
  335. package/dist/registries/policies.d.ts.map +1 -1
  336. package/dist/registries/policies.js +64 -18
  337. package/dist/registries/policies.js.map +1 -1
  338. package/dist/registries/policies.mjs +65 -19
  339. package/dist/registries/policies.mjs.map +1 -1
  340. package/dist/registries/services.d.ts +8 -8
  341. package/dist/registries/services.d.ts.map +1 -1
  342. package/dist/registries/services.js.map +1 -1
  343. package/dist/registries/services.mjs.map +1 -1
  344. package/dist/services/auth/index.d.ts +4 -4
  345. package/dist/services/auth/index.d.ts.map +1 -1
  346. package/dist/services/auth/index.js.map +1 -1
  347. package/dist/services/auth/index.mjs.map +1 -1
  348. package/dist/services/config.d.ts +3 -0
  349. package/dist/services/config.d.ts.map +1 -0
  350. package/dist/services/config.js +47 -0
  351. package/dist/services/config.js.map +1 -0
  352. package/dist/services/config.mjs +47 -0
  353. package/dist/services/config.mjs.map +1 -0
  354. package/dist/services/content-api/index.d.ts +21 -3
  355. package/dist/services/content-api/index.d.ts.map +1 -1
  356. package/dist/services/content-api/index.js +28 -2
  357. package/dist/services/content-api/index.js.map +1 -1
  358. package/dist/services/content-api/index.mjs +28 -2
  359. package/dist/services/content-api/index.mjs.map +1 -1
  360. package/dist/services/content-api/permissions/index.d.ts +3 -3
  361. package/dist/services/content-api/permissions/index.d.ts.map +1 -1
  362. package/dist/services/content-api/permissions/index.js +1 -1
  363. package/dist/services/content-api/permissions/index.js.map +1 -1
  364. package/dist/services/content-api/permissions/index.mjs +1 -1
  365. package/dist/services/content-api/permissions/index.mjs.map +1 -1
  366. package/dist/services/core-store.d.ts.map +1 -1
  367. package/dist/services/cron.d.ts +2 -2
  368. package/dist/services/cron.d.ts.map +1 -1
  369. package/dist/services/cron.js.map +1 -1
  370. package/dist/services/cron.mjs.map +1 -1
  371. package/dist/services/custom-fields.d.ts +2 -2
  372. package/dist/services/custom-fields.d.ts.map +1 -1
  373. package/dist/services/custom-fields.js.map +1 -1
  374. package/dist/services/custom-fields.mjs.map +1 -1
  375. package/dist/services/document-service/attributes/index.d.ts +6 -0
  376. package/dist/services/document-service/attributes/index.d.ts.map +1 -0
  377. package/dist/services/{entity-service → document-service}/attributes/index.js +5 -5
  378. package/dist/services/document-service/attributes/index.js.map +1 -0
  379. package/dist/services/{entity-service → document-service}/attributes/index.mjs +5 -5
  380. package/dist/services/document-service/attributes/index.mjs.map +1 -0
  381. package/dist/services/document-service/attributes/transforms.d.ts +10 -0
  382. package/dist/services/document-service/attributes/transforms.d.ts.map +1 -0
  383. package/dist/services/document-service/attributes/transforms.js.map +1 -0
  384. package/dist/services/document-service/attributes/transforms.mjs.map +1 -0
  385. package/dist/services/document-service/common.d.ts +2 -2
  386. package/dist/services/document-service/common.d.ts.map +1 -1
  387. package/dist/services/document-service/common.js.map +1 -1
  388. package/dist/services/document-service/common.mjs.map +1 -1
  389. package/dist/services/document-service/components.d.ts +25 -1
  390. package/dist/services/document-service/components.d.ts.map +1 -1
  391. package/dist/services/{entity-service → document-service}/components.js +46 -142
  392. package/dist/services/document-service/components.js.map +1 -0
  393. package/dist/services/{entity-service → document-service}/components.mjs +48 -144
  394. package/dist/services/document-service/components.mjs.map +1 -0
  395. package/dist/services/document-service/draft-and-publish.d.ts +9 -23
  396. package/dist/services/document-service/draft-and-publish.d.ts.map +1 -1
  397. package/dist/services/document-service/draft-and-publish.js +37 -9
  398. package/dist/services/document-service/draft-and-publish.js.map +1 -1
  399. package/dist/services/document-service/draft-and-publish.mjs +38 -10
  400. package/dist/services/document-service/draft-and-publish.mjs.map +1 -1
  401. package/dist/services/document-service/entries.d.ts +10 -0
  402. package/dist/services/document-service/entries.d.ts.map +1 -0
  403. package/dist/services/document-service/entries.js +96 -0
  404. package/dist/services/document-service/entries.js.map +1 -0
  405. package/dist/services/document-service/entries.mjs +96 -0
  406. package/dist/services/document-service/entries.mjs.map +1 -0
  407. package/dist/services/document-service/events.d.ts +25 -0
  408. package/dist/services/document-service/events.d.ts.map +1 -0
  409. package/dist/services/document-service/events.js +47 -0
  410. package/dist/services/document-service/events.js.map +1 -0
  411. package/dist/services/document-service/events.mjs +47 -0
  412. package/dist/services/document-service/events.mjs.map +1 -0
  413. package/dist/services/document-service/index.d.ts +2 -4
  414. package/dist/services/document-service/index.d.ts.map +1 -1
  415. package/dist/services/document-service/index.js +20 -7
  416. package/dist/services/document-service/index.js.map +1 -1
  417. package/dist/services/document-service/index.mjs +18 -5
  418. package/dist/services/document-service/index.mjs.map +1 -1
  419. package/dist/services/document-service/internationalization.d.ts +6 -5
  420. package/dist/services/document-service/internationalization.d.ts.map +1 -1
  421. package/dist/services/document-service/internationalization.js +24 -1
  422. package/dist/services/document-service/internationalization.js.map +1 -1
  423. package/dist/services/document-service/internationalization.mjs +25 -2
  424. package/dist/services/document-service/internationalization.mjs.map +1 -1
  425. package/dist/services/document-service/middlewares/errors.d.ts +6 -0
  426. package/dist/services/document-service/middlewares/errors.d.ts.map +1 -0
  427. package/dist/services/document-service/middlewares/errors.js +25 -0
  428. package/dist/services/document-service/middlewares/errors.js.map +1 -0
  429. package/dist/services/document-service/middlewares/errors.mjs +25 -0
  430. package/dist/services/document-service/middlewares/errors.mjs.map +1 -0
  431. package/dist/services/document-service/middlewares/index.d.ts +3 -0
  432. package/dist/services/document-service/middlewares/index.d.ts.map +1 -0
  433. package/dist/services/document-service/middlewares/middleware-manager.d.ts +10 -0
  434. package/dist/services/document-service/middlewares/middleware-manager.d.ts.map +1 -0
  435. package/dist/services/document-service/{middlewares.js → middlewares/middleware-manager.js} +9 -6
  436. package/dist/services/document-service/middlewares/middleware-manager.js.map +1 -0
  437. package/dist/services/document-service/{middlewares.mjs → middlewares/middleware-manager.mjs} +9 -6
  438. package/dist/services/document-service/middlewares/middleware-manager.mjs.map +1 -0
  439. package/dist/services/document-service/params.d.ts +3 -1
  440. package/dist/services/document-service/params.d.ts.map +1 -1
  441. package/dist/services/{entity-service → document-service}/params.js +1 -1
  442. package/dist/services/document-service/params.js.map +1 -0
  443. package/dist/services/{entity-service → document-service}/params.mjs +1 -1
  444. package/dist/services/document-service/params.mjs.map +1 -0
  445. package/dist/services/document-service/repository.d.ts +3 -0
  446. package/dist/services/document-service/repository.d.ts.map +1 -0
  447. package/dist/services/document-service/repository.js +278 -0
  448. package/dist/services/document-service/repository.js.map +1 -0
  449. package/dist/services/document-service/repository.mjs +278 -0
  450. package/dist/services/document-service/repository.mjs.map +1 -0
  451. package/dist/services/document-service/transform/data.d.ts.map +1 -1
  452. package/dist/services/document-service/transform/data.js +4 -2
  453. package/dist/services/document-service/transform/data.js.map +1 -1
  454. package/dist/services/document-service/transform/data.mjs +4 -2
  455. package/dist/services/document-service/transform/data.mjs.map +1 -1
  456. package/dist/services/document-service/transform/fields.d.ts +2 -2
  457. package/dist/services/document-service/transform/fields.d.ts.map +1 -1
  458. package/dist/services/document-service/transform/fields.js +11 -10
  459. package/dist/services/document-service/transform/fields.js.map +1 -1
  460. package/dist/services/document-service/transform/fields.mjs +11 -10
  461. package/dist/services/document-service/transform/fields.mjs.map +1 -1
  462. package/dist/services/document-service/transform/id-map.d.ts +4 -4
  463. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  464. package/dist/services/document-service/transform/id-map.js +15 -9
  465. package/dist/services/document-service/transform/id-map.js.map +1 -1
  466. package/dist/services/document-service/transform/id-map.mjs +16 -10
  467. package/dist/services/document-service/transform/id-map.mjs.map +1 -1
  468. package/dist/services/document-service/transform/id-transform.d.ts +4 -25
  469. package/dist/services/document-service/transform/id-transform.d.ts.map +1 -1
  470. package/dist/services/document-service/transform/id-transform.js +19 -43
  471. package/dist/services/document-service/transform/id-transform.js.map +1 -1
  472. package/dist/services/document-service/transform/id-transform.mjs +20 -44
  473. package/dist/services/document-service/transform/id-transform.mjs.map +1 -1
  474. package/dist/services/document-service/transform/populate.d.ts +5 -2
  475. package/dist/services/document-service/transform/populate.d.ts.map +1 -1
  476. package/dist/services/document-service/transform/populate.js +1 -11
  477. package/dist/services/document-service/transform/populate.js.map +1 -1
  478. package/dist/services/document-service/transform/populate.mjs +1 -11
  479. package/dist/services/document-service/transform/populate.mjs.map +1 -1
  480. package/dist/services/document-service/transform/query.d.ts +5 -0
  481. package/dist/services/document-service/transform/query.d.ts.map +1 -0
  482. package/dist/services/document-service/transform/query.js +9 -0
  483. package/dist/services/document-service/transform/query.js.map +1 -0
  484. package/dist/services/document-service/transform/query.mjs +9 -0
  485. package/dist/services/document-service/transform/query.mjs.map +1 -0
  486. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts +8 -7
  487. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts.map +1 -1
  488. package/dist/services/document-service/transform/relations/extract/data-ids.js +45 -64
  489. package/dist/services/document-service/transform/relations/extract/data-ids.js.map +1 -1
  490. package/dist/services/document-service/transform/relations/extract/data-ids.mjs +45 -64
  491. package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +1 -1
  492. package/dist/services/document-service/transform/relations/transform/data-ids.d.ts +9 -5
  493. package/dist/services/document-service/transform/relations/transform/data-ids.d.ts.map +1 -1
  494. package/dist/services/document-service/transform/relations/transform/data-ids.js +64 -103
  495. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +1 -1
  496. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +64 -103
  497. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +1 -1
  498. package/dist/services/document-service/transform/relations/transform/default-locale.d.ts +9 -0
  499. package/dist/services/document-service/transform/relations/transform/default-locale.d.ts.map +1 -0
  500. package/dist/services/document-service/transform/relations/transform/default-locale.js +32 -0
  501. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +1 -0
  502. package/dist/services/document-service/transform/relations/transform/default-locale.mjs +32 -0
  503. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +1 -0
  504. package/dist/services/document-service/transform/relations/utils/data.d.ts +2 -4
  505. package/dist/services/document-service/transform/relations/utils/data.d.ts.map +1 -1
  506. package/dist/services/document-service/transform/relations/utils/dp.d.ts +10 -0
  507. package/dist/services/document-service/transform/relations/utils/dp.d.ts.map +1 -0
  508. package/dist/services/document-service/transform/relations/utils/dp.js +30 -0
  509. package/dist/services/document-service/transform/relations/utils/dp.js.map +1 -0
  510. package/dist/services/document-service/transform/relations/utils/dp.mjs +30 -0
  511. package/dist/services/document-service/transform/relations/utils/dp.mjs.map +1 -0
  512. package/dist/services/document-service/transform/relations/utils/i18n.d.ts +8 -8
  513. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  514. package/dist/services/document-service/transform/relations/utils/i18n.js +3 -9
  515. package/dist/services/document-service/transform/relations/utils/i18n.js.map +1 -1
  516. package/dist/services/document-service/transform/relations/utils/i18n.mjs +3 -9
  517. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +1 -1
  518. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts +6 -0
  519. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts.map +1 -0
  520. package/dist/services/document-service/transform/relations/utils/map-relation.js +91 -0
  521. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +1 -0
  522. package/dist/services/document-service/transform/relations/utils/map-relation.mjs +91 -0
  523. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +1 -0
  524. package/dist/services/document-service/transform/relations/utils/types.d.ts +15 -2
  525. package/dist/services/document-service/transform/relations/utils/types.d.ts.map +1 -1
  526. package/dist/services/document-service/transform/types.d.ts +4 -4
  527. package/dist/services/document-service/transform/types.d.ts.map +1 -1
  528. package/dist/services/document-service/utils/populate.d.ts +9 -2
  529. package/dist/services/document-service/utils/populate.d.ts.map +1 -1
  530. package/dist/services/document-service/utils/populate.js +9 -5
  531. package/dist/services/document-service/utils/populate.js.map +1 -1
  532. package/dist/services/document-service/utils/populate.mjs +9 -5
  533. package/dist/services/document-service/utils/populate.mjs.map +1 -1
  534. package/dist/services/entity-service/index.d.ts +4 -6
  535. package/dist/services/entity-service/index.d.ts.map +1 -1
  536. package/dist/services/entity-service/index.js +44 -203
  537. package/dist/services/entity-service/index.js.map +1 -1
  538. package/dist/services/entity-service/index.mjs +38 -197
  539. package/dist/services/entity-service/index.mjs.map +1 -1
  540. package/dist/services/entity-validator/index.d.ts +15 -2
  541. package/dist/services/entity-validator/index.d.ts.map +1 -1
  542. package/dist/services/entity-validator/index.js +187 -119
  543. package/dist/services/entity-validator/index.js.map +1 -1
  544. package/dist/services/entity-validator/index.mjs +187 -119
  545. package/dist/services/entity-validator/index.mjs.map +1 -1
  546. package/dist/services/entity-validator/validators.d.ts +24 -22
  547. package/dist/services/entity-validator/validators.d.ts.map +1 -1
  548. package/dist/services/entity-validator/validators.js +65 -19
  549. package/dist/services/entity-validator/validators.js.map +1 -1
  550. package/dist/services/entity-validator/validators.mjs +58 -11
  551. package/dist/services/entity-validator/validators.mjs.map +1 -1
  552. package/dist/services/event-hub.d.ts +1 -0
  553. package/dist/services/event-hub.d.ts.map +1 -1
  554. package/dist/services/event-hub.js +9 -4
  555. package/dist/services/event-hub.js.map +1 -1
  556. package/dist/services/event-hub.mjs +9 -4
  557. package/dist/services/event-hub.mjs.map +1 -1
  558. package/dist/services/features.d.ts +3 -3
  559. package/dist/services/features.d.ts.map +1 -1
  560. package/dist/services/features.js.map +1 -1
  561. package/dist/services/features.mjs.map +1 -1
  562. package/dist/services/fs.d.ts +2 -2
  563. package/dist/services/fs.d.ts.map +1 -1
  564. package/dist/services/fs.js.map +1 -1
  565. package/dist/services/fs.mjs.map +1 -1
  566. package/dist/services/metrics/admin-user-hash.d.ts +2 -2
  567. package/dist/services/metrics/admin-user-hash.d.ts.map +1 -1
  568. package/dist/services/metrics/admin-user-hash.js.map +1 -1
  569. package/dist/services/metrics/admin-user-hash.mjs.map +1 -1
  570. package/dist/services/metrics/index.d.ts +2 -2
  571. package/dist/services/metrics/index.d.ts.map +1 -1
  572. package/dist/services/metrics/index.js.map +1 -1
  573. package/dist/services/metrics/index.mjs.map +1 -1
  574. package/dist/services/metrics/middleware.d.ts +2 -2
  575. package/dist/services/metrics/middleware.d.ts.map +1 -1
  576. package/dist/services/metrics/middleware.js.map +1 -1
  577. package/dist/services/metrics/middleware.mjs.map +1 -1
  578. package/dist/services/metrics/rate-limiter.d.ts.map +1 -1
  579. package/dist/services/metrics/rate-limiter.js.map +1 -1
  580. package/dist/services/metrics/rate-limiter.mjs.map +1 -1
  581. package/dist/services/metrics/sender.d.ts +3 -3
  582. package/dist/services/metrics/sender.d.ts.map +1 -1
  583. package/dist/services/metrics/sender.js.map +1 -1
  584. package/dist/services/metrics/sender.mjs.map +1 -1
  585. package/dist/services/query-params.d.ts +7 -0
  586. package/dist/services/query-params.d.ts.map +1 -0
  587. package/dist/services/query-params.js +12 -0
  588. package/dist/services/query-params.js.map +1 -0
  589. package/dist/services/query-params.mjs +13 -0
  590. package/dist/services/query-params.mjs.map +1 -0
  591. package/dist/services/reloader.d.ts +7 -0
  592. package/dist/services/reloader.d.ts.map +1 -0
  593. package/dist/services/reloader.js +36 -0
  594. package/dist/services/reloader.js.map +1 -0
  595. package/dist/services/reloader.mjs +36 -0
  596. package/dist/services/reloader.mjs.map +1 -0
  597. package/dist/services/server/admin-api.d.ts +3 -3
  598. package/dist/services/server/admin-api.d.ts.map +1 -1
  599. package/dist/services/server/admin-api.js.map +1 -1
  600. package/dist/services/server/admin-api.mjs.map +1 -1
  601. package/dist/services/server/api.d.ts +3 -3
  602. package/dist/services/server/api.d.ts.map +1 -1
  603. package/dist/services/server/api.js.map +1 -1
  604. package/dist/services/server/api.mjs.map +1 -1
  605. package/dist/services/server/compose-endpoint.d.ts +2 -2
  606. package/dist/services/server/compose-endpoint.d.ts.map +1 -1
  607. package/dist/services/server/compose-endpoint.js +1 -2
  608. package/dist/services/server/compose-endpoint.js.map +1 -1
  609. package/dist/services/server/compose-endpoint.mjs +2 -3
  610. package/dist/services/server/compose-endpoint.mjs.map +1 -1
  611. package/dist/services/server/content-api.d.ts +3 -3
  612. package/dist/services/server/content-api.d.ts.map +1 -1
  613. package/dist/services/server/content-api.js.map +1 -1
  614. package/dist/services/server/content-api.mjs.map +1 -1
  615. package/dist/services/server/http-server.d.ts +2 -2
  616. package/dist/services/server/http-server.d.ts.map +1 -1
  617. package/dist/services/server/http-server.js.map +1 -1
  618. package/dist/services/server/http-server.mjs.map +1 -1
  619. package/dist/services/server/index.d.ts +2 -2
  620. package/dist/services/server/index.d.ts.map +1 -1
  621. package/dist/services/server/index.js +2 -3
  622. package/dist/services/server/index.js.map +1 -1
  623. package/dist/services/server/index.mjs +2 -3
  624. package/dist/services/server/index.mjs.map +1 -1
  625. package/dist/services/server/koa.d.ts.map +1 -1
  626. package/dist/services/server/koa.js +1 -1
  627. package/dist/services/server/koa.js.map +1 -1
  628. package/dist/services/server/koa.mjs +1 -1
  629. package/dist/services/server/koa.mjs.map +1 -1
  630. package/dist/services/server/middleware.d.ts +4 -4
  631. package/dist/services/server/middleware.d.ts.map +1 -1
  632. package/dist/services/server/middleware.js.map +1 -1
  633. package/dist/services/server/middleware.mjs.map +1 -1
  634. package/dist/services/server/policy.d.ts +3 -3
  635. package/dist/services/server/policy.d.ts.map +1 -1
  636. package/dist/services/server/policy.js +4 -4
  637. package/dist/services/server/policy.js.map +1 -1
  638. package/dist/services/server/policy.mjs +4 -4
  639. package/dist/services/server/policy.mjs.map +1 -1
  640. package/dist/services/server/register-middlewares.d.ts +2 -2
  641. package/dist/services/server/register-middlewares.d.ts.map +1 -1
  642. package/dist/services/server/register-middlewares.js.map +1 -1
  643. package/dist/services/server/register-middlewares.mjs.map +1 -1
  644. package/dist/services/server/register-routes.d.ts +2 -2
  645. package/dist/services/server/register-routes.d.ts.map +1 -1
  646. package/dist/services/server/register-routes.js +3 -3
  647. package/dist/services/server/register-routes.js.map +1 -1
  648. package/dist/services/server/register-routes.mjs +3 -3
  649. package/dist/services/server/register-routes.mjs.map +1 -1
  650. package/dist/services/server/routing.d.ts +5 -5
  651. package/dist/services/server/routing.d.ts.map +1 -1
  652. package/dist/services/server/routing.js.map +1 -1
  653. package/dist/services/server/routing.mjs.map +1 -1
  654. package/dist/services/utils/dynamic-zones.d.ts.map +1 -1
  655. package/dist/services/utils/dynamic-zones.js +2 -1
  656. package/dist/services/utils/dynamic-zones.js.map +1 -1
  657. package/dist/services/utils/dynamic-zones.mjs +2 -1
  658. package/dist/services/utils/dynamic-zones.mjs.map +1 -1
  659. package/dist/services/webhook-runner.d.ts +2 -1
  660. package/dist/services/webhook-runner.d.ts.map +1 -1
  661. package/dist/services/webhook-runner.js.map +1 -1
  662. package/dist/services/webhook-runner.mjs.map +1 -1
  663. package/dist/services/webhook-store.d.ts +2 -8
  664. package/dist/services/webhook-store.d.ts.map +1 -1
  665. package/dist/services/webhook-store.js +14 -8
  666. package/dist/services/webhook-store.js.map +1 -1
  667. package/dist/services/webhook-store.mjs +14 -8
  668. package/dist/services/webhook-store.mjs.map +1 -1
  669. package/dist/utils/convert-custom-field-type.d.ts +2 -2
  670. package/dist/utils/convert-custom-field-type.d.ts.map +1 -1
  671. package/dist/utils/convert-custom-field-type.js.map +1 -1
  672. package/dist/utils/convert-custom-field-type.mjs.map +1 -1
  673. package/dist/utils/fetch.d.ts +3 -3
  674. package/dist/utils/fetch.d.ts.map +1 -1
  675. package/dist/utils/fetch.js +4 -3
  676. package/dist/utils/fetch.js.map +1 -1
  677. package/dist/utils/fetch.mjs +4 -3
  678. package/dist/utils/fetch.mjs.map +1 -1
  679. package/dist/utils/index.d.ts +2 -1
  680. package/dist/utils/index.d.ts.map +1 -1
  681. package/dist/utils/is-initialized.d.ts +2 -2
  682. package/dist/utils/is-initialized.d.ts.map +1 -1
  683. package/dist/utils/is-initialized.js +1 -1
  684. package/dist/utils/is-initialized.js.map +1 -1
  685. package/dist/utils/is-initialized.mjs +1 -1
  686. package/dist/utils/is-initialized.mjs.map +1 -1
  687. package/dist/utils/load-config-file.js +1 -1
  688. package/dist/utils/load-config-file.js.map +1 -1
  689. package/dist/utils/load-config-file.mjs +2 -2
  690. package/dist/utils/load-config-file.mjs.map +1 -1
  691. package/dist/utils/load-files.d.ts.map +1 -1
  692. package/dist/utils/open-browser.d.ts +2 -2
  693. package/dist/utils/open-browser.d.ts.map +1 -1
  694. package/dist/utils/open-browser.js.map +1 -1
  695. package/dist/utils/open-browser.mjs.map +1 -1
  696. package/dist/utils/resolve-working-dirs.d.ts +19 -0
  697. package/dist/utils/resolve-working-dirs.d.ts.map +1 -0
  698. package/dist/utils/resolve-working-dirs.js +13 -0
  699. package/dist/utils/resolve-working-dirs.js.map +1 -0
  700. package/dist/utils/resolve-working-dirs.mjs +11 -0
  701. package/dist/utils/resolve-working-dirs.mjs.map +1 -0
  702. package/dist/utils/signals.d.ts +2 -2
  703. package/dist/utils/signals.d.ts.map +1 -1
  704. package/dist/utils/signals.js.map +1 -1
  705. package/dist/utils/signals.mjs.map +1 -1
  706. package/dist/utils/startup-logger.d.ts +2 -2
  707. package/dist/utils/startup-logger.d.ts.map +1 -1
  708. package/dist/utils/startup-logger.js.map +1 -1
  709. package/dist/utils/startup-logger.mjs.map +1 -1
  710. package/dist/utils/transform-content-types-to-models.d.ts +129 -3
  711. package/dist/utils/transform-content-types-to-models.d.ts.map +1 -1
  712. package/dist/utils/transform-content-types-to-models.js +134 -47
  713. package/dist/utils/transform-content-types-to-models.js.map +1 -1
  714. package/dist/utils/transform-content-types-to-models.mjs +133 -47
  715. package/dist/utils/transform-content-types-to-models.mjs.map +1 -1
  716. package/dist/utils/update-notifier/index.d.ts +2 -7
  717. package/dist/utils/update-notifier/index.d.ts.map +1 -1
  718. package/dist/utils/update-notifier/index.js +11 -14
  719. package/dist/utils/update-notifier/index.js.map +1 -1
  720. package/dist/utils/update-notifier/index.mjs +11 -14
  721. package/dist/utils/update-notifier/index.mjs.map +1 -1
  722. package/package.json +32 -28
  723. package/dist/registries/config.d.ts +0 -4
  724. package/dist/registries/config.d.ts.map +0 -1
  725. package/dist/registries/config.js +0 -23
  726. package/dist/registries/config.js.map +0 -1
  727. package/dist/registries/config.mjs +0 -22
  728. package/dist/registries/config.mjs.map +0 -1
  729. package/dist/services/document-service/collection-type.d.ts +0 -4
  730. package/dist/services/document-service/collection-type.d.ts.map +0 -1
  731. package/dist/services/document-service/collection-type.js +0 -145
  732. package/dist/services/document-service/collection-type.js.map +0 -1
  733. package/dist/services/document-service/collection-type.mjs +0 -145
  734. package/dist/services/document-service/collection-type.mjs.map +0 -1
  735. package/dist/services/document-service/document-engine.d.ts +0 -8
  736. package/dist/services/document-service/document-engine.d.ts.map +0 -1
  737. package/dist/services/document-service/document-engine.js +0 -249
  738. package/dist/services/document-service/document-engine.js.map +0 -1
  739. package/dist/services/document-service/document-engine.mjs +0 -250
  740. package/dist/services/document-service/document-engine.mjs.map +0 -1
  741. package/dist/services/document-service/middlewares.d.ts +0 -8
  742. package/dist/services/document-service/middlewares.d.ts.map +0 -1
  743. package/dist/services/document-service/middlewares.js.map +0 -1
  744. package/dist/services/document-service/middlewares.mjs.map +0 -1
  745. package/dist/services/document-service/repository-factory.d.ts +0 -3
  746. package/dist/services/document-service/repository-factory.d.ts.map +0 -1
  747. package/dist/services/document-service/repository-factory.js +0 -12
  748. package/dist/services/document-service/repository-factory.js.map +0 -1
  749. package/dist/services/document-service/repository-factory.mjs +0 -12
  750. package/dist/services/document-service/repository-factory.mjs.map +0 -1
  751. package/dist/services/document-service/single-type.d.ts +0 -4
  752. package/dist/services/document-service/single-type.d.ts.map +0 -1
  753. package/dist/services/document-service/single-type.js +0 -92
  754. package/dist/services/document-service/single-type.js.map +0 -1
  755. package/dist/services/document-service/single-type.mjs +0 -92
  756. package/dist/services/document-service/single-type.mjs.map +0 -1
  757. package/dist/services/document-service/transform/filters.d.ts +0 -3
  758. package/dist/services/document-service/transform/filters.d.ts.map +0 -1
  759. package/dist/services/document-service/transform/filters.js +0 -49
  760. package/dist/services/document-service/transform/filters.js.map +0 -1
  761. package/dist/services/document-service/transform/filters.mjs +0 -49
  762. package/dist/services/document-service/transform/filters.mjs.map +0 -1
  763. package/dist/services/document-service/transform/relations/transform/output-ids.d.ts +0 -4
  764. package/dist/services/document-service/transform/relations/transform/output-ids.d.ts.map +0 -1
  765. package/dist/services/document-service/transform/relations/transform/output-ids.js +0 -26
  766. package/dist/services/document-service/transform/relations/transform/output-ids.js.map +0 -1
  767. package/dist/services/document-service/transform/relations/transform/output-ids.mjs +0 -26
  768. package/dist/services/document-service/transform/relations/transform/output-ids.mjs.map +0 -1
  769. package/dist/services/document-service/transform/relations/utils/data.js +0 -12
  770. package/dist/services/document-service/transform/relations/utils/data.js.map +0 -1
  771. package/dist/services/document-service/transform/relations/utils/data.mjs +0 -12
  772. package/dist/services/document-service/transform/relations/utils/data.mjs.map +0 -1
  773. package/dist/services/document-service/transform/sort.d.ts +0 -5
  774. package/dist/services/document-service/transform/sort.d.ts.map +0 -1
  775. package/dist/services/document-service/transform/sort.js +0 -44
  776. package/dist/services/document-service/transform/sort.js.map +0 -1
  777. package/dist/services/document-service/transform/sort.mjs +0 -44
  778. package/dist/services/document-service/transform/sort.mjs.map +0 -1
  779. package/dist/services/document-service/transform/utils.d.ts +0 -9
  780. package/dist/services/document-service/transform/utils.d.ts.map +0 -1
  781. package/dist/services/document-service/transform/utils.js +0 -23
  782. package/dist/services/document-service/transform/utils.js.map +0 -1
  783. package/dist/services/document-service/transform/utils.mjs +0 -23
  784. package/dist/services/document-service/transform/utils.mjs.map +0 -1
  785. package/dist/services/entity-service/attributes/index.d.ts +0 -6
  786. package/dist/services/entity-service/attributes/index.d.ts.map +0 -1
  787. package/dist/services/entity-service/attributes/index.js.map +0 -1
  788. package/dist/services/entity-service/attributes/index.mjs.map +0 -1
  789. package/dist/services/entity-service/attributes/transforms.d.ts +0 -10
  790. package/dist/services/entity-service/attributes/transforms.d.ts.map +0 -1
  791. package/dist/services/entity-service/attributes/transforms.js.map +0 -1
  792. package/dist/services/entity-service/attributes/transforms.mjs.map +0 -1
  793. package/dist/services/entity-service/components.d.ts +0 -23
  794. package/dist/services/entity-service/components.d.ts.map +0 -1
  795. package/dist/services/entity-service/components.js.map +0 -1
  796. package/dist/services/entity-service/components.mjs.map +0 -1
  797. package/dist/services/entity-service/params.d.ts +0 -8
  798. package/dist/services/entity-service/params.d.ts.map +0 -1
  799. package/dist/services/entity-service/params.js.map +0 -1
  800. package/dist/services/entity-service/params.mjs.map +0 -1
  801. package/dist/services/utils/upload-files.d.ts +0 -8
  802. package/dist/services/utils/upload-files.d.ts.map +0 -1
  803. package/dist/services/utils/upload-files.js +0 -64
  804. package/dist/services/utils/upload-files.js.map +0 -1
  805. package/dist/services/utils/upload-files.mjs +0 -63
  806. package/dist/services/utils/upload-files.mjs.map +0 -1
  807. package/dist/utils/get-dirs.d.ts +0 -9
  808. package/dist/utils/get-dirs.d.ts.map +0 -1
  809. package/dist/utils/get-dirs.js.map +0 -1
  810. package/dist/utils/get-dirs.mjs.map +0 -1
  811. /package/dist/services/{entity-service → document-service}/attributes/transforms.js +0 -0
  812. /package/dist/services/{entity-service → document-service}/attributes/transforms.mjs +0 -0
@@ -1,39 +1,41 @@
1
- import strapiUtils from '@strapi/utils';
2
- import type { Attribute, Schema } from '@strapi/types';
3
- interface ValidatorMetas<TAttribute extends Attribute.Any> {
1
+ import { yup } from '@strapi/utils';
2
+ import type { Schema, Struct, Modules } from '@strapi/types';
3
+ import type { ComponentContext } from '.';
4
+ interface ValidatorMetas<TAttribute extends Schema.Attribute.AnyAttribute> {
4
5
  attr: TAttribute;
5
- model: Schema.ContentType;
6
+ model: Struct.ContentTypeSchema;
6
7
  updatedAttribute: {
7
8
  name: string;
8
9
  value: unknown;
9
10
  };
10
- entity: Record<string, unknown> | null;
11
+ entity: Modules.EntityValidator.Entity;
12
+ componentContext: ComponentContext;
11
13
  }
12
14
  interface ValidatorOptions {
13
15
  isDraft: boolean;
14
16
  locale?: string;
15
17
  }
16
18
  declare const _default: {
17
- string: (metas: ValidatorMetas<Attribute.Email | Attribute.Password | Attribute.RichText | (Attribute.OfType<"string"> & Attribute.StringProperties & Attribute.ConfigurableOption & Attribute.DefaultOption<string> & Attribute.MinMaxLengthOption & Attribute.PrivateOption & Attribute.UniqueOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption) | Attribute.Text | Attribute.UID<string, Attribute.UIDOptions>>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
18
- text: (metas: ValidatorMetas<Attribute.Email | Attribute.Password | Attribute.RichText | (Attribute.OfType<"string"> & Attribute.StringProperties & Attribute.ConfigurableOption & Attribute.DefaultOption<string> & Attribute.MinMaxLengthOption & Attribute.PrivateOption & Attribute.UniqueOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption) | Attribute.Text | Attribute.UID<string, Attribute.UIDOptions>>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
19
- richtext: (metas: ValidatorMetas<Attribute.Email | Attribute.Password | Attribute.RichText | (Attribute.OfType<"string"> & Attribute.StringProperties & Attribute.ConfigurableOption & Attribute.DefaultOption<string> & Attribute.MinMaxLengthOption & Attribute.PrivateOption & Attribute.UniqueOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption) | Attribute.Text | Attribute.UID<string, Attribute.UIDOptions>>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
20
- password: (metas: ValidatorMetas<Attribute.Email | Attribute.Password | Attribute.RichText | (Attribute.OfType<"string"> & Attribute.StringProperties & Attribute.ConfigurableOption & Attribute.DefaultOption<string> & Attribute.MinMaxLengthOption & Attribute.PrivateOption & Attribute.UniqueOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption) | Attribute.Text | Attribute.UID<string, Attribute.UIDOptions>>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
21
- email: (metas: ValidatorMetas<Attribute.Email>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
19
+ string: (metas: ValidatorMetas<(Schema.Attribute.OfType<"email"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"password"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"richtext"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"string"> & Schema.Attribute.StringProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"text"> & Schema.Attribute.TextProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"uid"> & Schema.Attribute.UIDProperties<string, Schema.Attribute.UIDOptions> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
20
+ text: (metas: ValidatorMetas<(Schema.Attribute.OfType<"email"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"password"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"richtext"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"string"> & Schema.Attribute.StringProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"text"> & Schema.Attribute.TextProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"uid"> & Schema.Attribute.UIDProperties<string, Schema.Attribute.UIDOptions> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
21
+ richtext: (metas: ValidatorMetas<(Schema.Attribute.OfType<"email"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"password"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"richtext"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"string"> & Schema.Attribute.StringProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"text"> & Schema.Attribute.TextProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"uid"> & Schema.Attribute.UIDProperties<string, Schema.Attribute.UIDOptions> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
22
+ password: (metas: ValidatorMetas<(Schema.Attribute.OfType<"email"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"password"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"richtext"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"string"> & Schema.Attribute.StringProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"text"> & Schema.Attribute.TextProperties & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.UniqueOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"uid"> & Schema.Attribute.UIDProperties<string, Schema.Attribute.UIDOptions> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
23
+ email: (metas: ValidatorMetas<Schema.Attribute.OfType<"email"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
22
24
  enumeration: ({ attr }: {
23
- attr: Attribute.Enumeration<[]>;
25
+ attr: Schema.Attribute.OfType<"enumeration"> & Schema.Attribute.EnumerationProperties<[]> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<never> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption;
24
26
  }) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
25
- boolean: () => strapiUtils.yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
26
- uid: (metas: ValidatorMetas<Attribute.UID<string, Attribute.UIDOptions>>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
27
+ boolean: () => yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
28
+ uid: (metas: ValidatorMetas<Schema.Attribute.OfType<"uid"> & Schema.Attribute.UIDProperties<string, Schema.Attribute.UIDOptions> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxLengthOption & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption>, options: ValidatorOptions) => import("yup").StringSchema<string | undefined, Record<string, any>, string | undefined>;
27
29
  json: () => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
28
- integer: (metas: ValidatorMetas<Attribute.BigInteger | Attribute.Integer>, options: ValidatorOptions) => strapiUtils.yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
29
- biginteger: (metas: ValidatorMetas<Attribute.BigInteger>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
30
- float: (metas: ValidatorMetas<Attribute.Decimal | Attribute.Float>, options: ValidatorOptions) => strapiUtils.yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
31
- decimal: (metas: ValidatorMetas<Attribute.Decimal | Attribute.Float>, options: ValidatorOptions) => strapiUtils.yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
32
- date: (metas: ValidatorMetas<Attribute.DateTime | Attribute.Date | Attribute.Time | Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
33
- time: (metas: ValidatorMetas<Attribute.DateTime | Attribute.Date | Attribute.Time | Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
34
- datetime: (metas: ValidatorMetas<Attribute.DateTime | Attribute.Date | Attribute.Time | Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
35
- timestamp: (metas: ValidatorMetas<Attribute.DateTime | Attribute.Date | Attribute.Time | Attribute.Timestamp>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
36
- blocks: (metas: any, options: any) => strapiUtils.yup.ArraySchema<any, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
30
+ integer: (metas: ValidatorMetas<(Schema.Attribute.OfType<"biginteger"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxOption<string> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption) | (Schema.Attribute.OfType<"integer"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<number> & Schema.Attribute.MinMaxOption<number> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption)>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
31
+ biginteger: (metas: ValidatorMetas<Schema.Attribute.OfType<"biginteger"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<string> & Schema.Attribute.MinMaxOption<string> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
32
+ float: (metas: ValidatorMetas<(Schema.Attribute.OfType<"decimal"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<number> & Schema.Attribute.MinMaxOption<number> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption) | (Schema.Attribute.OfType<"float"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<number> & Schema.Attribute.MinMaxOption<number> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption)>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
33
+ decimal: (metas: ValidatorMetas<(Schema.Attribute.OfType<"decimal"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<number> & Schema.Attribute.MinMaxOption<number> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption) | (Schema.Attribute.OfType<"float"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<number> & Schema.Attribute.MinMaxOption<number> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption & Schema.Attribute.UniqueOption)>, options: ValidatorOptions) => yup.NumberSchema<number | undefined, Record<string, any>, number | undefined>;
34
+ date: (metas: ValidatorMetas<(Schema.Attribute.OfType<"datetime"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateTimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"date"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"time"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"timestamp"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimestampValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
35
+ time: (metas: ValidatorMetas<(Schema.Attribute.OfType<"datetime"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateTimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"date"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"time"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"timestamp"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimestampValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
36
+ datetime: (metas: ValidatorMetas<(Schema.Attribute.OfType<"datetime"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateTimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"date"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"time"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"timestamp"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimestampValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
37
+ timestamp: (metas: ValidatorMetas<(Schema.Attribute.OfType<"datetime"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateTimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"date"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.DateValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"time"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimeValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption) | (Schema.Attribute.OfType<"timestamp"> & Schema.Attribute.ConfigurableOption & Schema.Attribute.DefaultOption<Schema.Attribute.TimestampValue> & Schema.Attribute.PrivateOption & Schema.Attribute.RequiredOption & Schema.Attribute.UniqueOption & Schema.Attribute.WritableOption & Schema.Attribute.VisibleOption)>, options: ValidatorOptions) => import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
38
+ blocks: (metas: any, options: any) => yup.ArraySchema<any, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
37
39
  };
38
40
  export default _default;
39
41
  //# sourceMappingURL=validators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/services/entity-validator/validators.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvD,UAAU,cAAc,CAAC,UAAU,SAAS,SAAS,CAAC,GAAG;IACvD,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC;IAC1B,gBAAgB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACnD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACxC;AAED,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;;;;;;;;;;;;;;;;;;;;;;AA0PD,wBAmBE"}
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/services/entity-validator/validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAC;AAE1C,UAAU,cAAc,CAAC,UAAU,SAAS,MAAM,CAAC,SAAS,CAAC,YAAY;IACvE,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,iBAAiB,CAAC;IAChC,gBAAgB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACnD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;;;;;;;;;;;;;;;;;;;;;;AAwVD,wBAmBE"}
@@ -4,8 +4,6 @@ const strapiUtils = require("@strapi/utils");
4
4
  const blocksValidator = require("./blocks-validator.js");
5
5
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
6
6
  const ___default = /* @__PURE__ */ _interopDefault(_);
7
- const strapiUtils__default = /* @__PURE__ */ _interopDefault(strapiUtils);
8
- const { yup } = strapiUtils__default.default;
9
7
  const addMinLengthValidator = (validator, {
10
8
  attr
11
9
  }, { isDraft }) => {
@@ -33,7 +31,13 @@ const addStringRegexValidator = (validator, {
33
31
  }) => {
34
32
  return "regex" in attr && !___default.default.isUndefined(attr.regex) ? validator.matches(new RegExp(attr.regex), { excludeEmptyString: !attr.required }) : validator;
35
33
  };
36
- const addUniqueValidator = (validator, { attr, model, updatedAttribute, entity }, options) => {
34
+ const addUniqueValidator = (validator, {
35
+ attr,
36
+ model,
37
+ updatedAttribute,
38
+ entity,
39
+ componentContext
40
+ }, options) => {
37
41
  if (attr.type !== "uid" && !attr.unique) {
38
42
  return validator;
39
43
  }
@@ -45,19 +49,61 @@ const addUniqueValidator = (validator, { attr, model, updatedAttribute, entity }
45
49
  if (!isPublish && value === entity?.[updatedAttribute.name]) {
46
50
  return true;
47
51
  }
48
- const record = await strapi.db.query(model.uid).findOne({
49
- where: {
50
- locale: options.locale,
51
- publishedAt: options.isDraft ? null : { $notNull: true },
52
- [updatedAttribute.name]: value,
53
- ...entity?.id ? { id: { $ne: entity.id } } : {}
52
+ let queryUid;
53
+ let queryWhere = {};
54
+ if (componentContext) {
55
+ const hasRepeatableData = componentContext.repeatableData.length > 0;
56
+ if (hasRepeatableData) {
57
+ const { name: updatedName, value: updatedValue } = updatedAttribute;
58
+ const pathToCheck = [...componentContext.pathToComponent.slice(1), updatedName].join(".");
59
+ const values = componentContext.repeatableData.map((item) => {
60
+ return pathToCheck.split(".").reduce((acc, key) => acc[key], item);
61
+ });
62
+ const isUpdatedAttributeRepeatedInThisEntity = values.filter((value2) => value2 === updatedValue).length > 1;
63
+ if (isUpdatedAttributeRepeatedInThisEntity) {
64
+ return false;
65
+ }
54
66
  }
55
- });
56
- return !record;
67
+ const {
68
+ model: parentModel,
69
+ options: parentOptions,
70
+ id: excludeId
71
+ } = componentContext.parentContent;
72
+ queryUid = parentModel.uid;
73
+ const whereConditions = {};
74
+ const isParentDraft = parentOptions && parentOptions.isDraft;
75
+ whereConditions.publishedAt = isParentDraft ? null : { $notNull: true };
76
+ if (parentOptions?.locale) {
77
+ whereConditions.locale = parentOptions.locale;
78
+ }
79
+ if (excludeId && !Number.isNaN(excludeId)) {
80
+ whereConditions.id = { $ne: excludeId };
81
+ }
82
+ queryWhere = {
83
+ ...componentContext.pathToComponent.reduceRight((acc, key) => ({ [key]: acc }), {
84
+ [updatedAttribute.name]: value
85
+ }),
86
+ ...whereConditions
87
+ };
88
+ } else {
89
+ queryUid = model.uid;
90
+ const scalarAttributeWhere = {
91
+ [updatedAttribute.name]: value
92
+ };
93
+ scalarAttributeWhere.publishedAt = options.isDraft ? null : { $notNull: true };
94
+ if (options?.locale) {
95
+ scalarAttributeWhere.locale = options.locale;
96
+ }
97
+ if (entity?.id) {
98
+ scalarAttributeWhere.id = { $ne: entity.id };
99
+ }
100
+ queryWhere = scalarAttributeWhere;
101
+ }
102
+ return !await strapi.db.query(queryUid).findOne({ where: queryWhere });
57
103
  });
58
104
  };
59
105
  const stringValidator = (metas, options) => {
60
- let schema = yup.string().transform((val, originalVal) => originalVal);
106
+ let schema = strapiUtils.yup.string().transform((val, originalVal) => originalVal);
61
107
  schema = addMinLengthValidator(schema, metas, options);
62
108
  schema = addMaxLengthValidator(schema, metas);
63
109
  schema = addStringRegexValidator(schema, metas);
@@ -73,28 +119,28 @@ const uidValidator = (metas, options) => {
73
119
  return schema.matches(/^[A-Za-z0-9-_.~]*$/);
74
120
  };
75
121
  const enumerationValidator = ({ attr }) => {
76
- return yup.string().oneOf((Array.isArray(attr.enum) ? attr.enum : [attr.enum]).concat(null));
122
+ return strapiUtils.yup.string().oneOf((Array.isArray(attr.enum) ? attr.enum : [attr.enum]).concat(null));
77
123
  };
78
124
  const integerValidator = (metas, options) => {
79
- let schema = yup.number().integer();
125
+ let schema = strapiUtils.yup.number().integer();
80
126
  schema = addMinIntegerValidator(schema, metas);
81
127
  schema = addMaxIntegerValidator(schema, metas);
82
128
  schema = addUniqueValidator(schema, metas, options);
83
129
  return schema;
84
130
  };
85
131
  const floatValidator = (metas, options) => {
86
- let schema = yup.number();
132
+ let schema = strapiUtils.yup.number();
87
133
  schema = addMinFloatValidator(schema, metas);
88
134
  schema = addMaxFloatValidator(schema, metas);
89
135
  schema = addUniqueValidator(schema, metas, options);
90
136
  return schema;
91
137
  };
92
138
  const bigintegerValidator = (metas, options) => {
93
- const schema = yup.mixed();
139
+ const schema = strapiUtils.yup.mixed();
94
140
  return addUniqueValidator(schema, metas, options);
95
141
  };
96
142
  const datesValidator = (metas, options) => {
97
- const schema = yup.mixed();
143
+ const schema = strapiUtils.yup.mixed();
98
144
  return addUniqueValidator(schema, metas, options);
99
145
  };
100
146
  const validators = {
@@ -104,9 +150,9 @@ const validators = {
104
150
  password: stringValidator,
105
151
  email: emailValidator,
106
152
  enumeration: enumerationValidator,
107
- boolean: () => yup.boolean(),
153
+ boolean: () => strapiUtils.yup.boolean(),
108
154
  uid: uidValidator,
109
- json: () => yup.mixed(),
155
+ json: () => strapiUtils.yup.mixed(),
110
156
  integer: integerValidator,
111
157
  biginteger: bigintegerValidator,
112
158
  float: floatValidator,
@@ -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 { Attribute, Schema } from '@strapi/types';\nimport blocksValidator from './blocks-validator';\n\nconst { yup } = strapiUtils;\n\ninterface ValidatorMetas<TAttribute extends Attribute.Any> {\n attr: TAttribute;\n model: Schema.ContentType;\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 | Attribute.String\n | Attribute.Text\n | Attribute.RichText\n | Attribute.Password\n | Attribute.Email\n | 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 | Attribute.String\n | Attribute.Text\n | Attribute.RichText\n | Attribute.Password\n | Attribute.Email\n | 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: Attribute.Integer | 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: Attribute.Integer | 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: Attribute.Decimal | 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: Attribute.Decimal | 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 | Attribute.String\n | Attribute.Text\n | Attribute.RichText\n | Attribute.Password\n | Attribute.Email\n | 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 { attr, model, updatedAttribute, entity }: ValidatorMetas<Attribute.Any & 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 | Attribute.String\n | Attribute.Text\n | Attribute.RichText\n | Attribute.Password\n | Attribute.Email\n | 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 = (metas: ValidatorMetas<Attribute.Email>, options: ValidatorOptions) => {\n const schema = stringValidator(metas, options);\n return schema.email().min(1, '${path} cannot be empty');\n};\n\nconst uidValidator = (metas: ValidatorMetas<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: 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<Attribute.Integer | 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<Attribute.Decimal | 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<Attribute.BigInteger>,\n options: ValidatorOptions\n) => {\n const schema = yup.mixed();\n return addUniqueValidator(schema, metas, options);\n};\n\nconst datesValidator = (\n metas: ValidatorMetas<Attribute.Date | Attribute.DateTime | Attribute.Time | Attribute.Timestamp>,\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;AAKp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,MAAe,aAAA;AAAA,EACb,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;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":["import _ 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\ninterface ValidatorMetas<TAttribute extends Schema.Attribute.AnyAttribute> {\n attr: TAttribute;\n model: Struct.ContentTypeSchema;\n updatedAttribute: { name: string; value: unknown };\n entity: Modules.EntityValidator.Entity;\n componentContext: ComponentContext;\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) => (_.isNumber(attr.min) ? 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) => (_.isNumber(attr.min) ? 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) => {\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 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 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 let queryUid: string;\n let queryWhere: Record<string, any> = {};\n\n if (componentContext) {\n const hasRepeatableData = componentContext.repeatableData.length > 0;\n if (hasRepeatableData) {\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\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 queryUid = parentModel.uid;\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 queryWhere = {\n ...componentContext.pathToComponent.reduceRight((acc, key) => ({ [key]: acc }), {\n [updatedAttribute.name]: value,\n }),\n\n ...whereConditions,\n };\n } else {\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 queryUid = model.uid;\n const scalarAttributeWhere: Record<string, any> = {\n [updatedAttribute.name]: value,\n };\n\n scalarAttributeWhere.publishedAt = options.isDraft ? null : { $notNull: true };\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 queryWhere = scalarAttributeWhere;\n }\n\n // The validation should pass if there is no other record found from the query\n // TODO query not working for dynamic zones (type === relation)\n return !(await strapi.db.query(queryUid).findOne({ where: queryWhere }));\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":["_","value","yup"],"mappings":";;;;;;AAyBA,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,MAA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Q,OAAO,OAAO;AAE3C,SAAA;AACT;AAEA,MAAM,iBAAiB,CACrB,OACA,YACG;AACC,MAAA,SAASA,gBAAI;AACR,WAAA,qBAAqB,QAAQ,KAAK;AAClC,WAAA,qBAAqB,QAAQ,KAAK;AAClC,WAAA,mBAAmB,QAAQ,OAAO,OAAO;AAE3C,SAAA;AACT;AAEA,MAAM,sBAAsB,CAC1B,OACA,YACG;AACG,QAAA,SAASA,gBAAI;AACZ,SAAA,mBAAmB,QAAQ,OAAO,OAAO;AAClD;AAEA,MAAM,iBAAiB,CACrB,OAMA,YACG;AACG,QAAA,SAASA,gBAAI;AACZ,SAAA,mBAAmB,QAAQ,OAAO,OAAO;AAClD;AAEA,MAAe,aAAA;AAAA,EACb,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS,MAAMA,YAAA,IAAI,QAAQ;AAAA,EAC3B,KAAK;AAAA,EACL,MAAM,MAAMA,YAAA,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,7 +1,6 @@
1
1
  import _ from "lodash";
2
- import strapiUtils from "@strapi/utils";
2
+ import { yup } from "@strapi/utils";
3
3
  import blocksValidator from "./blocks-validator.mjs";
4
- const { yup } = strapiUtils;
5
4
  const addMinLengthValidator = (validator, {
6
5
  attr
7
6
  }, { isDraft }) => {
@@ -29,7 +28,13 @@ const addStringRegexValidator = (validator, {
29
28
  }) => {
30
29
  return "regex" in attr && !_.isUndefined(attr.regex) ? validator.matches(new RegExp(attr.regex), { excludeEmptyString: !attr.required }) : validator;
31
30
  };
32
- const addUniqueValidator = (validator, { attr, model, updatedAttribute, entity }, options) => {
31
+ const addUniqueValidator = (validator, {
32
+ attr,
33
+ model,
34
+ updatedAttribute,
35
+ entity,
36
+ componentContext
37
+ }, options) => {
33
38
  if (attr.type !== "uid" && !attr.unique) {
34
39
  return validator;
35
40
  }
@@ -41,15 +46,57 @@ const addUniqueValidator = (validator, { attr, model, updatedAttribute, entity }
41
46
  if (!isPublish && value === entity?.[updatedAttribute.name]) {
42
47
  return true;
43
48
  }
44
- const record = await strapi.db.query(model.uid).findOne({
45
- where: {
46
- locale: options.locale,
47
- publishedAt: options.isDraft ? null : { $notNull: true },
48
- [updatedAttribute.name]: value,
49
- ...entity?.id ? { id: { $ne: entity.id } } : {}
49
+ let queryUid;
50
+ let queryWhere = {};
51
+ if (componentContext) {
52
+ const hasRepeatableData = componentContext.repeatableData.length > 0;
53
+ if (hasRepeatableData) {
54
+ const { name: updatedName, value: updatedValue } = updatedAttribute;
55
+ const pathToCheck = [...componentContext.pathToComponent.slice(1), updatedName].join(".");
56
+ const values = componentContext.repeatableData.map((item) => {
57
+ return pathToCheck.split(".").reduce((acc, key) => acc[key], item);
58
+ });
59
+ const isUpdatedAttributeRepeatedInThisEntity = values.filter((value2) => value2 === updatedValue).length > 1;
60
+ if (isUpdatedAttributeRepeatedInThisEntity) {
61
+ return false;
62
+ }
50
63
  }
51
- });
52
- return !record;
64
+ const {
65
+ model: parentModel,
66
+ options: parentOptions,
67
+ id: excludeId
68
+ } = componentContext.parentContent;
69
+ queryUid = parentModel.uid;
70
+ const whereConditions = {};
71
+ const isParentDraft = parentOptions && parentOptions.isDraft;
72
+ whereConditions.publishedAt = isParentDraft ? null : { $notNull: true };
73
+ if (parentOptions?.locale) {
74
+ whereConditions.locale = parentOptions.locale;
75
+ }
76
+ if (excludeId && !Number.isNaN(excludeId)) {
77
+ whereConditions.id = { $ne: excludeId };
78
+ }
79
+ queryWhere = {
80
+ ...componentContext.pathToComponent.reduceRight((acc, key) => ({ [key]: acc }), {
81
+ [updatedAttribute.name]: value
82
+ }),
83
+ ...whereConditions
84
+ };
85
+ } else {
86
+ queryUid = model.uid;
87
+ const scalarAttributeWhere = {
88
+ [updatedAttribute.name]: value
89
+ };
90
+ scalarAttributeWhere.publishedAt = options.isDraft ? null : { $notNull: true };
91
+ if (options?.locale) {
92
+ scalarAttributeWhere.locale = options.locale;
93
+ }
94
+ if (entity?.id) {
95
+ scalarAttributeWhere.id = { $ne: entity.id };
96
+ }
97
+ queryWhere = scalarAttributeWhere;
98
+ }
99
+ return !await strapi.db.query(queryUid).findOne({ where: queryWhere });
53
100
  });
54
101
  };
55
102
  const stringValidator = (metas, options) => {
@@ -1 +1 @@
1
- {"version":3,"file":"validators.mjs","sources":["../../../src/services/entity-validator/validators.ts"],"sourcesContent":["import _ from 'lodash';\nimport strapiUtils from '@strapi/utils';\nimport type { Attribute, Schema } from '@strapi/types';\nimport blocksValidator from './blocks-validator';\n\nconst { yup } = strapiUtils;\n\ninterface ValidatorMetas<TAttribute extends Attribute.Any> {\n attr: TAttribute;\n model: Schema.ContentType;\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 | Attribute.String\n | Attribute.Text\n | Attribute.RichText\n | Attribute.Password\n | Attribute.Email\n | 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 | Attribute.String\n | Attribute.Text\n | Attribute.RichText\n | Attribute.Password\n | Attribute.Email\n | 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: Attribute.Integer | 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: Attribute.Integer | 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: Attribute.Decimal | 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: Attribute.Decimal | 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 | Attribute.String\n | Attribute.Text\n | Attribute.RichText\n | Attribute.Password\n | Attribute.Email\n | 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 { attr, model, updatedAttribute, entity }: ValidatorMetas<Attribute.Any & 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 | Attribute.String\n | Attribute.Text\n | Attribute.RichText\n | Attribute.Password\n | Attribute.Email\n | 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 = (metas: ValidatorMetas<Attribute.Email>, options: ValidatorOptions) => {\n const schema = stringValidator(metas, options);\n return schema.email().min(1, '${path} cannot be empty');\n};\n\nconst uidValidator = (metas: ValidatorMetas<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: 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<Attribute.Integer | 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<Attribute.Decimal | 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<Attribute.BigInteger>,\n options: ValidatorOptions\n) => {\n const schema = yup.mixed();\n return addUniqueValidator(schema, metas, options);\n};\n\nconst datesValidator = (\n metas: ValidatorMetas<Attribute.Date | Attribute.DateTime | Attribute.Time | Attribute.Timestamp>,\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":[],"mappings":";;;AAKA,MAAM,EAAE,IAAQ,IAAA;AAmBhB,MAAM,wBAAwB,CAC5B,WACA;AAAA,EACE;AACF,GASA,EAAE,cACC;AACH,SAAO,KAAK,aAAa,EAAE,UAAU,KAAK,SAAS,KAAK,CAAC,UACrD,UAAU,IAAI,KAAK,SAAS,IAC5B;AACN;AAMA,MAAM,wBAAwB,CAC5B,WACA;AAAA,EACE;AACF,MASG;AACI,SAAA,KAAK,aAAa,EAAE,UAAU,KAAK,SAAS,IAAI,UAAU,IAAI,KAAK,SAAS,IAAI;AACzF;AAMA,MAAM,yBAAyB,CAC7B,WACA;AAAA,EACE;AACF,MAGI,EAAE,SAAS,KAAK,GAAG,IAAI,UAAU,IAAI,EAAE,UAAU,KAAK,GAAG,CAAC,IA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O,OAAO;AAClD;AAEA,MAAM,iBAAiB,CACrB,OACA,YACG;AACG,QAAA,SAAS,IAAI;AACZ,SAAA,mBAAmB,QAAQ,OAAO,OAAO;AAClD;AAEA,MAAe,aAAA;AAAA,EACb,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;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.mjs","sources":["../../../src/services/entity-validator/validators.ts"],"sourcesContent":["import _ 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\ninterface ValidatorMetas<TAttribute extends Schema.Attribute.AnyAttribute> {\n attr: TAttribute;\n model: Struct.ContentTypeSchema;\n updatedAttribute: { name: string; value: unknown };\n entity: Modules.EntityValidator.Entity;\n componentContext: ComponentContext;\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) => (_.isNumber(attr.min) ? 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) => (_.isNumber(attr.min) ? 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) => {\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 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 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 let queryUid: string;\n let queryWhere: Record<string, any> = {};\n\n if (componentContext) {\n const hasRepeatableData = componentContext.repeatableData.length > 0;\n if (hasRepeatableData) {\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\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 queryUid = parentModel.uid;\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 queryWhere = {\n ...componentContext.pathToComponent.reduceRight((acc, key) => ({ [key]: acc }), {\n [updatedAttribute.name]: value,\n }),\n\n ...whereConditions,\n };\n } else {\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 queryUid = model.uid;\n const scalarAttributeWhere: Record<string, any> = {\n [updatedAttribute.name]: value,\n };\n\n scalarAttributeWhere.publishedAt = options.isDraft ? null : { $notNull: true };\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 queryWhere = scalarAttributeWhere;\n }\n\n // The validation should pass if there is no other record found from the query\n // TODO query not working for dynamic zones (type === relation)\n return !(await strapi.db.query(queryUid).findOne({ where: queryWhere }));\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":["value"],"mappings":";;;AAyBA,MAAM,wBAAwB,CAC5B,WACA;AAAA,EACE;AACF,GASA,EAAE,cACC;AAC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uB,QAAQ,KAAK;AACpC,WAAA,mBAAmB,QAAQ,OAAO,OAAO;AAE3C,SAAA;AACT;AAEA,MAAM,iBAAiB,CACrB,OACA,YACG;AACC,MAAA,SAAS,IAAI;AACR,WAAA,qBAAqB,QAAQ,KAAK;AAClC,WAAA,qBAAqB,QAAQ,KAAK;AAClC,WAAA,mBAAmB,QAAQ,OAAO,OAAO;AAE3C,SAAA;AACT;AAEA,MAAM,sBAAsB,CAC1B,OACA,YACG;AACG,QAAA,SAAS,IAAI;AACZ,SAAA,mBAAmB,QAAQ,OAAO,OAAO;AAClD;AAEA,MAAM,iBAAiB,CACrB,OAMA,YACG;AACG,QAAA,SAAS,IAAI;AACZ,SAAA,mBAAmB,QAAQ,OAAO,OAAO;AAClD;AAEA,MAAe,aAAA;AAAA,EACb,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;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;"}
@@ -10,6 +10,7 @@ export interface EventHub {
10
10
  destroy(): EventHub;
11
11
  removeListener(eventName: string, listener: Listener): void;
12
12
  removeAllListeners(): EventHub;
13
+ removeAllSubscribers(): EventHub;
13
14
  addListener(eventName: string, listener: Listener): () => void;
14
15
  }
15
16
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"event-hub.d.ts","sourceRoot":"","sources":["../../src/services/event-hub.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC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AAC;AAEzD,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,IAAI,CAAC;IAC9C,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1C,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;IACtD,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACjD,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;IACxD,OAAO,IAAI,QAAQ,CAAC;IACpB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC5D,kBAAkB,IAAI,QAAQ,CAAC;IAC/B,oBAAoB,IAAI,QAAQ,CAAC;IACjC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,QAAQ,CA0FjD"}
@@ -38,7 +38,7 @@ function createEventHub() {
38
38
  };
39
39
  },
40
40
  off(eventName, listener) {
41
- listeners.get(eventName).splice(listeners.get(eventName).indexOf(listener), 1);
41
+ listeners.get(eventName)?.splice(listeners.get(eventName).indexOf(listener), 1);
42
42
  },
43
43
  once(eventName, listener) {
44
44
  return eventHub.on(eventName, async (...args) => {
@@ -47,15 +47,20 @@ function createEventHub() {
47
47
  });
48
48
  },
49
49
  destroy() {
50
- listeners.clear();
51
- subscribers.length = 0;
50
+ this.removeAllListeners();
51
+ this.removeAllSubscribers();
52
52
  return this;
53
53
  },
54
54
  removeListener(eventName, listener) {
55
55
  return eventHub.off(eventName, listener);
56
56
  },
57
57
  removeAllListeners() {
58
- return eventHub.destroy();
58
+ listeners.clear();
59
+ return this;
60
+ },
61
+ removeAllSubscribers() {
62
+ subscribers.length = 0;
63
+ return this;
59
64
  },
60
65
  addListener(eventName, listener) {
61
66
  return eventHub.on(eventName, listener);
@@ -1 +1 @@
1
- {"version":3,"file":"event-hub.js","sources":["../../src/services/event-hub.ts"],"sourcesContent":["export type Subscriber = (eventName: string, ...args: any[]) => Promise<void>;\nexport type Listener = (...args: any[]) => Promise<void>;\n\nexport interface EventHub {\n emit(eventName: string, ...args: unknown[]): Promise<void>;\n subscribe(subscriber: Subscriber): () => void;\n unsubscribe(subscriber: Subscriber): void;\n on(eventName: string, listener: Listener): () => void;\n off(eventName: string, listener: Listener): void;\n once(eventName: string, listener: Listener): () => void;\n destroy(): EventHub;\n removeListener(eventName: string, listener: Listener): void;\n removeAllListeners(): EventHub;\n addListener(eventName: string, listener: Listener): () => void;\n}\n\n/**\n * The event hub is Strapi's event control center.\n */\nexport default function createEventHub(): EventHub {\n const listeners = new Map();\n\n // Default subscriber to easily add listeners with the on() method\n const defaultSubscriber = async (eventName: string, ...args: unknown[]) => {\n if (listeners.has(eventName)) {\n for (const listener of listeners.get(eventName)) {\n await listener(...args);\n }\n }\n };\n\n // Store of subscribers that will be called when an event is emitted\n const subscribers = [defaultSubscriber];\n\n const eventHub: EventHub = {\n async emit(eventName, ...args) {\n for (const subscriber of subscribers) {\n await subscriber(eventName, ...args);\n }\n },\n\n subscribe(subscriber) {\n subscribers.push(subscriber);\n\n // Return a function to remove the subscriber\n return () => {\n eventHub.unsubscribe(subscriber);\n };\n },\n\n unsubscribe(subscriber) {\n const subscriberIndex = subscribers.indexOf(subscriber);\n\n // Only remove the subscriber if it exists\n if (subscriberIndex >= 0) {\n subscribers.splice(subscriberIndex, 1);\n }\n },\n\n on(eventName, listener) {\n if (!listeners.has(eventName)) {\n listeners.set(eventName, [listener]);\n } else {\n listeners.get(eventName).push(listener);\n }\n\n // Return a function to remove the listener\n return () => {\n eventHub.off(eventName, listener);\n };\n },\n\n off(eventName, listener) {\n listeners.get(eventName).splice(listeners.get(eventName).indexOf(listener), 1);\n },\n\n once(eventName, listener) {\n return eventHub.on(eventName, async (...args) => {\n eventHub.off(eventName, listener);\n return listener(...args);\n });\n },\n\n destroy() {\n listeners.clear();\n subscribers.length = 0;\n return this;\n },\n\n removeListener(eventName, listener) {\n return eventHub.off(eventName, listener);\n },\n\n removeAllListeners() {\n return eventHub.destroy();\n },\n\n addListener(eventName, listener) {\n return eventHub.on(eventName, listener);\n },\n };\n\n return eventHub;\n}\n"],"names":[],"mappings":";AAmBA,SAAwB,iBAA2B;AAC3C,QAAA,gCAAgB;AAGhB,QAAA,oBAAoB,OAAO,cAAsB,SAAoB;AACrE,QAAA,UAAU,IAAI,SAAS,GAAG;AAC5B,iBAAW,YAAY,UAAU,IAAI,SAAS,GAAG;AACzC,cAAA,SAAS,GAAG,IAAI;AAAA,MACxB;AAAA,IACF;AAAA,EAAA;AAII,QAAA,cAAc,CAAC,iBAAiB;AAEtC,QAAM,WAAqB;AAAA,IACzB,MAAM,KAAK,cAAc,MAAM;AAC7B,iBAAW,cAAc,aAAa;AAC9B,cAAA,WAAW,WAAW,GAAG,IAAI;AAAA,MACrC;AAAA,IACF;AAAA,IAEA,UAAU,YAAY;AACpB,kBAAY,KAAK,UAAU;AAG3B,aAAO,MAAM;AACX,iBAAS,YAAY,UAAU;AAAA,MAAA;AAAA,IAEnC;AAAA,IAEA,YAAY,YAAY;AAChB,YAAA,kBAAkB,YAAY,QAAQ,UAAU;AAGtD,UAAI,mBAAmB,GAAG;AACZ,oBAAA,OAAO,iBAAiB,CAAC;AAAA,MACvC;AAAA,IACF;AAAA,IAEA,GAAG,WAAW,UAAU;AACtB,UAAI,CAAC,UAAU,IAAI,SAAS,GAAG;AAC7B,kBAAU,IAAI,WAAW,CAAC,QAAQ,CAAC;AAAA,MAAA,OAC9B;AACL,kBAAU,IAAI,SAAS,EAAE,KAAK,QAAQ;AAAA,MACxC;AAGA,aAAO,MAAM;AACF,iBAAA,IAAI,WAAW,QAAQ;AAAA,MAAA;AAAA,IAEpC;AAAA,IAEA,IAAI,WAAW,UAAU;AACb,gBAAA,IAAI,SAAS,EAAE,OAAO,UAAU,IAAI,SAAS,EAAE,QAAQ,QAAQ,GAAG,CAAC;AAAA,IAC/E;AAAA,IAEA,KAAK,WAAW,UAAU;AACxB,aAAO,SAAS,GAAG,WAAW,UAAU,SAAS;AACtC,iBAAA,IAAI,WAAW,QAAQ;AACzB,eAAA,SAAS,GAAG,IAAI;AAAA,MAAA,CACxB;AAAA,IACH;AAAA,IAEA,UAAU;AACR,gBAAU,MAAM;AAChB,kBAAY,SAAS;AACd,aAAA;AAAA,IACT;AAAA,IAEA,eAAe,WAAW,UAAU;AAC3B,aAAA,SAAS,IAAI,WAAW,QAAQ;AAAA,IACzC;AAAA,IAEA,qBAAqB;AACnB,aAAO,SAAS;IAClB;AAAA,IAEA,YAAY,WAAW,UAAU;AACxB,aAAA,SAAS,GAAG,WAAW,QAAQ;AAAA,IACxC;AAAA,EAAA;AAGK,SAAA;AACT;;"}
1
+ {"version":3,"file":"event-hub.js","sources":["../../src/services/event-hub.ts"],"sourcesContent":["export type Subscriber = (eventName: string, ...args: any[]) => Promise<void>;\nexport type Listener = (...args: any[]) => Promise<void>;\n\nexport interface EventHub {\n emit(eventName: string, ...args: unknown[]): Promise<void>;\n subscribe(subscriber: Subscriber): () => void;\n unsubscribe(subscriber: Subscriber): void;\n on(eventName: string, listener: Listener): () => void;\n off(eventName: string, listener: Listener): void;\n once(eventName: string, listener: Listener): () => void;\n destroy(): EventHub;\n removeListener(eventName: string, listener: Listener): void;\n removeAllListeners(): EventHub;\n removeAllSubscribers(): EventHub;\n addListener(eventName: string, listener: Listener): () => void;\n}\n\n/**\n * The event hub is Strapi's event control center.\n */\nexport default function createEventHub(): EventHub {\n const listeners = new Map();\n\n // Default subscriber to easily add listeners with the on() method\n const defaultSubscriber = async (eventName: string, ...args: unknown[]) => {\n if (listeners.has(eventName)) {\n for (const listener of listeners.get(eventName)) {\n await listener(...args);\n }\n }\n };\n\n // Store of subscribers that will be called when an event is emitted\n const subscribers = [defaultSubscriber];\n\n const eventHub: EventHub = {\n async emit(eventName, ...args) {\n for (const subscriber of subscribers) {\n await subscriber(eventName, ...args);\n }\n },\n\n subscribe(subscriber) {\n subscribers.push(subscriber);\n\n // Return a function to remove the subscriber\n return () => {\n eventHub.unsubscribe(subscriber);\n };\n },\n\n unsubscribe(subscriber) {\n const subscriberIndex = subscribers.indexOf(subscriber);\n\n // Only remove the subscriber if it exists\n if (subscriberIndex >= 0) {\n subscribers.splice(subscriberIndex, 1);\n }\n },\n\n on(eventName, listener) {\n if (!listeners.has(eventName)) {\n listeners.set(eventName, [listener]);\n } else {\n listeners.get(eventName).push(listener);\n }\n\n // Return a function to remove the listener\n return () => {\n eventHub.off(eventName, listener);\n };\n },\n\n off(eventName, listener) {\n listeners.get(eventName)?.splice(listeners.get(eventName).indexOf(listener), 1);\n },\n\n once(eventName, listener) {\n return eventHub.on(eventName, async (...args) => {\n eventHub.off(eventName, listener);\n return listener(...args);\n });\n },\n\n destroy() {\n this.removeAllListeners();\n this.removeAllSubscribers();\n return this;\n },\n\n removeListener(eventName, listener) {\n return eventHub.off(eventName, listener);\n },\n\n removeAllListeners() {\n listeners.clear();\n return this;\n },\n\n removeAllSubscribers() {\n subscribers.length = 0;\n return this;\n },\n\n addListener(eventName, listener) {\n return eventHub.on(eventName, listener);\n },\n };\n\n return eventHub;\n}\n"],"names":[],"mappings":";AAoBA,SAAwB,iBAA2B;AAC3C,QAAA,gCAAgB;AAGhB,QAAA,oBAAoB,OAAO,cAAsB,SAAoB;AACrE,QAAA,UAAU,IAAI,SAAS,GAAG;AAC5B,iBAAW,YAAY,UAAU,IAAI,SAAS,GAAG;AACzC,cAAA,SAAS,GAAG,IAAI;AAAA,MACxB;AAAA,I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,IACT;AAAA,IAEA,uBAAuB;AACrB,kBAAY,SAAS;AACd,aAAA;AAAA,IACT;AAAA,IAEA,YAAY,WAAW,UAAU;AACxB,aAAA,SAAS,GAAG,WAAW,QAAQ;AAAA,IACxC;AAAA,EAAA;AAGK,SAAA;AACT;;"}
@@ -37,7 +37,7 @@ function createEventHub() {
37
37
  };
38
38
  },
39
39
  off(eventName, listener) {
40
- listeners.get(eventName).splice(listeners.get(eventName).indexOf(listener), 1);
40
+ listeners.get(eventName)?.splice(listeners.get(eventName).indexOf(listener), 1);
41
41
  },
42
42
  once(eventName, listener) {
43
43
  return eventHub.on(eventName, async (...args) => {
@@ -46,15 +46,20 @@ function createEventHub() {
46
46
  });
47
47
  },
48
48
  destroy() {
49
- listeners.clear();
50
- subscribers.length = 0;
49
+ this.removeAllListeners();
50
+ this.removeAllSubscribers();
51
51
  return this;
52
52
  },
53
53
  removeListener(eventName, listener) {
54
54
  return eventHub.off(eventName, listener);
55
55
  },
56
56
  removeAllListeners() {
57
- return eventHub.destroy();
57
+ listeners.clear();
58
+ return this;
59
+ },
60
+ removeAllSubscribers() {
61
+ subscribers.length = 0;
62
+ return this;
58
63
  },
59
64
  addListener(eventName, listener) {
60
65
  return eventHub.on(eventName, listener);
@@ -1 +1 @@
1
- {"version":3,"file":"event-hub.mjs","sources":["../../src/services/event-hub.ts"],"sourcesContent":["export type Subscriber = (eventName: string, ...args: any[]) => Promise<void>;\nexport type Listener = (...args: any[]) => Promise<void>;\n\nexport interface EventHub {\n emit(eventName: string, ...args: unknown[]): Promise<void>;\n subscribe(subscriber: Subscriber): () => void;\n unsubscribe(subscriber: Subscriber): void;\n on(eventName: string, listener: Listener): () => void;\n off(eventName: string, listener: Listener): void;\n once(eventName: string, listener: Listener): () => void;\n destroy(): EventHub;\n removeListener(eventName: string, listener: Listener): void;\n removeAllListeners(): EventHub;\n addListener(eventName: string, listener: Listener): () => void;\n}\n\n/**\n * The event hub is Strapi's event control center.\n */\nexport default function createEventHub(): EventHub {\n const listeners = new Map();\n\n // Default subscriber to easily add listeners with the on() method\n const defaultSubscriber = async (eventName: string, ...args: unknown[]) => {\n if (listeners.has(eventName)) {\n for (const listener of listeners.get(eventName)) {\n await listener(...args);\n }\n }\n };\n\n // Store of subscribers that will be called when an event is emitted\n const subscribers = [defaultSubscriber];\n\n const eventHub: EventHub = {\n async emit(eventName, ...args) {\n for (const subscriber of subscribers) {\n await subscriber(eventName, ...args);\n }\n },\n\n subscribe(subscriber) {\n subscribers.push(subscriber);\n\n // Return a function to remove the subscriber\n return () => {\n eventHub.unsubscribe(subscriber);\n };\n },\n\n unsubscribe(subscriber) {\n const subscriberIndex = subscribers.indexOf(subscriber);\n\n // Only remove the subscriber if it exists\n if (subscriberIndex >= 0) {\n subscribers.splice(subscriberIndex, 1);\n }\n },\n\n on(eventName, listener) {\n if (!listeners.has(eventName)) {\n listeners.set(eventName, [listener]);\n } else {\n listeners.get(eventName).push(listener);\n }\n\n // Return a function to remove the listener\n return () => {\n eventHub.off(eventName, listener);\n };\n },\n\n off(eventName, listener) {\n listeners.get(eventName).splice(listeners.get(eventName).indexOf(listener), 1);\n },\n\n once(eventName, listener) {\n return eventHub.on(eventName, async (...args) => {\n eventHub.off(eventName, listener);\n return listener(...args);\n });\n },\n\n destroy() {\n listeners.clear();\n subscribers.length = 0;\n return this;\n },\n\n removeListener(eventName, listener) {\n return eventHub.off(eventName, listener);\n },\n\n removeAllListeners() {\n return eventHub.destroy();\n },\n\n addListener(eventName, listener) {\n return eventHub.on(eventName, listener);\n },\n };\n\n return eventHub;\n}\n"],"names":[],"mappings":"AAmBA,SAAwB,iBAA2B;AAC3C,QAAA,gCAAgB;AAGhB,QAAA,oBAAoB,OAAO,cAAsB,SAAoB;AACrE,QAAA,UAAU,IAAI,SAAS,GAAG;AAC5B,iBAAW,YAAY,UAAU,IAAI,SAAS,GAAG;AACzC,cAAA,SAAS,GAAG,IAAI;AAAA,MACxB;AAAA,IACF;AAAA,EAAA;AAII,QAAA,cAA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AAS,GAAG,WAAW,QAAQ;AAAA,IACxC;AAAA,EAAA;AAGK,SAAA;AACT;"}
1
+ {"version":3,"file":"event-hub.mjs","sources":["../../src/services/event-hub.ts"],"sourcesContent":["export type Subscriber = (eventName: string, ...args: any[]) => Promise<void>;\nexport type Listener = (...args: any[]) => Promise<void>;\n\nexport interface EventHub {\n emit(eventName: string, ...args: unknown[]): Promise<void>;\n subscribe(subscriber: Subscriber): () => void;\n unsubscribe(subscriber: Subscriber): void;\n on(eventName: string, listener: Listener): () => void;\n off(eventName: string, listener: Listener): void;\n once(eventName: string, listener: Listener): () => void;\n destroy(): EventHub;\n removeListener(eventName: string, listener: Listener): void;\n removeAllListeners(): EventHub;\n removeAllSubscribers(): EventHub;\n addListener(eventName: string, listener: Listener): () => void;\n}\n\n/**\n * The event hub is Strapi's event control center.\n */\nexport default function createEventHub(): EventHub {\n const listeners = new Map();\n\n // Default subscriber to easily add listeners with the on() method\n const defaultSubscriber = async (eventName: string, ...args: unknown[]) => {\n if (listeners.has(eventName)) {\n for (const listener of listeners.get(eventName)) {\n await listener(...args);\n }\n }\n };\n\n // Store of subscribers that will be called when an event is emitted\n const subscribers = [defaultSubscriber];\n\n const eventHub: EventHub = {\n async emit(eventName, ...args) {\n for (const subscriber of subscribers) {\n await subscriber(eventName, ...args);\n }\n },\n\n subscribe(subscriber) {\n subscribers.push(subscriber);\n\n // Return a function to remove the subscriber\n return () => {\n eventHub.unsubscribe(subscriber);\n };\n },\n\n unsubscribe(subscriber) {\n const subscriberIndex = subscribers.indexOf(subscriber);\n\n // Only remove the subscriber if it exists\n if (subscriberIndex >= 0) {\n subscribers.splice(subscriberIndex, 1);\n }\n },\n\n on(eventName, listener) {\n if (!listeners.has(eventName)) {\n listeners.set(eventName, [listener]);\n } else {\n listeners.get(eventName).push(listener);\n }\n\n // Return a function to remove the listener\n return () => {\n eventHub.off(eventName, listener);\n };\n },\n\n off(eventName, listener) {\n listeners.get(eventName)?.splice(listeners.get(eventName).indexOf(listener), 1);\n },\n\n once(eventName, listener) {\n return eventHub.on(eventName, async (...args) => {\n eventHub.off(eventName, listener);\n return listener(...args);\n });\n },\n\n destroy() {\n this.removeAllListeners();\n this.removeAllSubscribers();\n return this;\n },\n\n removeListener(eventName, listener) {\n return eventHub.off(eventName, listener);\n },\n\n removeAllListeners() {\n listeners.clear();\n return this;\n },\n\n removeAllSubscribers() {\n subscribers.length = 0;\n return this;\n },\n\n addListener(eventName, listener) {\n return eventHub.on(eventName, listener);\n },\n };\n\n return eventHub;\n}\n"],"names":[],"mappings":"AAoBA,SAAwB,iBAA2B;AAC3C,QAAA,gCAAgB;AAGhB,QAAA,oBAAoB,OAAO,cAAsB,SAAoB;AACrE,QAAA,UAAU,IAAI,SAAS,GAAG;AAC5B,iBAAW,YAAY,UAAU,IAAI,SAAS,GAAG;AACzC,cAAA,SAAS,GAAG,IAAI;AAAA,MACxB;AAAA,IACF;AAAA,EAAA;AAII,QAAA,cAAc,CAAC,iBAAiB;AAEtC,QAAM,WAAqB;AAAA,IACzB,MAAM,KAAK,cAAc,MAAM;AAC7B,iBAAW,cAAc,aAAa;AAC9B,cAAA,WAAW,WAAW,GAAG,IAAI;AAAA,MACrC;AAAA,IACF;AAAA,IAEA,UAAU,YAAY;AACpB,kBAAY,KAAK,UAAU;AAG3B,aAAO,MAAM;AACX,iBAAS,YAAY,UAAU;AAAA,MAAA;AAAA,IAEnC;AAAA,IAEA,YAAY,YAAY;AAChB,YAAA,kBAAkB,YAAY,QAAQ,UAAU;AAGtD,UAAI,mBAAmB,GAAG;AACZ,oBAAA,OAAO,iBAAiB,CAAC;AAAA,MACvC;AAAA,IACF;AAAA,IAEA,GAAG,WAAW,UAAU;AACtB,UAAI,CAAC,UAAU,IAAI,SAAS,GAAG;AAC7B,kBAAU,IAAI,WAAW,CAAC,QAAQ,CAAC;AAAA,MAAA,OAC9B;AACL,kBAAU,IAAI,SAAS,EAAE,KAAK,QAAQ;AAAA,MACxC;AAGA,aAAO,MAAM;AACF,i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