@strapi/core 0.0.0-experimental.f31889311d753b5f7d95198ae84d8fce1d156cd6 → 0.0.0-experimental.f56bca7c4d88bc4c61b6de9f65648d857cf242d9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (736) hide show
  1. package/dist/Strapi.d.ts.map +1 -1
  2. package/dist/Strapi.js +427 -403
  3. package/dist/Strapi.js.map +1 -1
  4. package/dist/Strapi.mjs +426 -402
  5. package/dist/Strapi.mjs.map +1 -1
  6. package/dist/compile.js +23 -14
  7. package/dist/compile.js.map +1 -1
  8. package/dist/compile.mjs +22 -14
  9. package/dist/compile.mjs.map +1 -1
  10. package/dist/configuration/config-loader.js +110 -97
  11. package/dist/configuration/config-loader.js.map +1 -1
  12. package/dist/configuration/config-loader.mjs +109 -96
  13. package/dist/configuration/config-loader.mjs.map +1 -1
  14. package/dist/configuration/get-dirs.js +31 -29
  15. package/dist/configuration/get-dirs.js.map +1 -1
  16. package/dist/configuration/get-dirs.mjs +30 -30
  17. package/dist/configuration/get-dirs.mjs.map +1 -1
  18. package/dist/configuration/index.d.ts.map +1 -1
  19. package/dist/configuration/index.js +84 -73
  20. package/dist/configuration/index.js.map +1 -1
  21. package/dist/configuration/index.mjs +83 -69
  22. package/dist/configuration/index.mjs.map +1 -1
  23. package/dist/configuration/urls.d.ts.map +1 -1
  24. package/dist/configuration/urls.js +74 -61
  25. package/dist/configuration/urls.js.map +1 -1
  26. package/dist/configuration/urls.mjs +73 -62
  27. package/dist/configuration/urls.mjs.map +1 -1
  28. package/dist/container.js +27 -23
  29. package/dist/container.js.map +1 -1
  30. package/dist/container.mjs +26 -24
  31. package/dist/container.mjs.map +1 -1
  32. package/dist/core-api/controller/collection-type.js +77 -76
  33. package/dist/core-api/controller/collection-type.js.map +1 -1
  34. package/dist/core-api/controller/collection-type.mjs +76 -77
  35. package/dist/core-api/controller/collection-type.mjs.map +1 -1
  36. package/dist/core-api/controller/index.js +63 -48
  37. package/dist/core-api/controller/index.js.map +1 -1
  38. package/dist/core-api/controller/index.mjs +62 -49
  39. package/dist/core-api/controller/index.mjs.map +1 -1
  40. package/dist/core-api/controller/single-type.js +41 -40
  41. package/dist/core-api/controller/single-type.js.map +1 -1
  42. package/dist/core-api/controller/single-type.mjs +40 -41
  43. package/dist/core-api/controller/single-type.mjs.map +1 -1
  44. package/dist/core-api/controller/transform.js +72 -63
  45. package/dist/core-api/controller/transform.js.map +1 -1
  46. package/dist/core-api/controller/transform.mjs +71 -64
  47. package/dist/core-api/controller/transform.mjs.map +1 -1
  48. package/dist/core-api/routes/index.js +64 -62
  49. package/dist/core-api/routes/index.js.map +1 -1
  50. package/dist/core-api/routes/index.mjs +62 -62
  51. package/dist/core-api/routes/index.mjs.map +1 -1
  52. package/dist/core-api/service/collection-type.d.ts +2 -2
  53. package/dist/core-api/service/collection-type.js +73 -60
  54. package/dist/core-api/service/collection-type.js.map +1 -1
  55. package/dist/core-api/service/collection-type.mjs +72 -62
  56. package/dist/core-api/service/collection-type.mjs.map +1 -1
  57. package/dist/core-api/service/core-service.js +9 -8
  58. package/dist/core-api/service/core-service.js.map +1 -1
  59. package/dist/core-api/service/core-service.mjs +8 -9
  60. package/dist/core-api/service/core-service.mjs.map +1 -1
  61. package/dist/core-api/service/index.js +13 -13
  62. package/dist/core-api/service/index.js.map +1 -1
  63. package/dist/core-api/service/index.mjs +12 -14
  64. package/dist/core-api/service/index.mjs.map +1 -1
  65. package/dist/core-api/service/pagination.js +69 -43
  66. package/dist/core-api/service/pagination.js.map +1 -1
  67. package/dist/core-api/service/pagination.mjs +68 -47
  68. package/dist/core-api/service/pagination.mjs.map +1 -1
  69. package/dist/core-api/service/single-type.js +43 -39
  70. package/dist/core-api/service/single-type.js.map +1 -1
  71. package/dist/core-api/service/single-type.mjs +42 -41
  72. package/dist/core-api/service/single-type.mjs.map +1 -1
  73. package/dist/domain/content-type/index.js +95 -100
  74. package/dist/domain/content-type/index.js.map +1 -1
  75. package/dist/domain/content-type/index.mjs +94 -100
  76. package/dist/domain/content-type/index.mjs.map +1 -1
  77. package/dist/domain/content-type/validator.js +84 -69
  78. package/dist/domain/content-type/validator.js.map +1 -1
  79. package/dist/domain/content-type/validator.mjs +83 -68
  80. package/dist/domain/content-type/validator.mjs.map +1 -1
  81. package/dist/domain/module/index.js +109 -100
  82. package/dist/domain/module/index.js.map +1 -1
  83. package/dist/domain/module/index.mjs +108 -99
  84. package/dist/domain/module/index.mjs.map +1 -1
  85. package/dist/domain/module/validation.js +25 -20
  86. package/dist/domain/module/validation.js.map +1 -1
  87. package/dist/domain/module/validation.mjs +24 -21
  88. package/dist/domain/module/validation.mjs.map +1 -1
  89. package/dist/ee/index.d.ts +1 -0
  90. package/dist/ee/index.d.ts.map +1 -1
  91. package/dist/ee/index.js +171 -132
  92. package/dist/ee/index.js.map +1 -1
  93. package/dist/ee/index.mjs +170 -134
  94. package/dist/ee/index.mjs.map +1 -1
  95. package/dist/ee/license.d.ts.map +1 -1
  96. package/dist/ee/license.js +99 -75
  97. package/dist/ee/license.js.map +1 -1
  98. package/dist/ee/license.mjs +98 -76
  99. package/dist/ee/license.mjs.map +1 -1
  100. package/dist/factories.js +72 -67
  101. package/dist/factories.js.map +1 -1
  102. package/dist/factories.mjs +71 -71
  103. package/dist/factories.mjs.map +1 -1
  104. package/dist/index.js +29 -26
  105. package/dist/index.js.map +1 -1
  106. package/dist/index.mjs +29 -29
  107. package/dist/index.mjs.map +1 -1
  108. package/dist/loaders/admin.d.ts.map +1 -1
  109. package/dist/loaders/admin.js +21 -20
  110. package/dist/loaders/admin.js.map +1 -1
  111. package/dist/loaders/admin.mjs +20 -20
  112. package/dist/loaders/admin.mjs.map +1 -1
  113. package/dist/loaders/apis.js +143 -120
  114. package/dist/loaders/apis.js.map +1 -1
  115. package/dist/loaders/apis.mjs +142 -119
  116. package/dist/loaders/apis.mjs.map +1 -1
  117. package/dist/loaders/components.js +33 -34
  118. package/dist/loaders/components.js.map +1 -1
  119. package/dist/loaders/components.mjs +32 -34
  120. package/dist/loaders/components.mjs.map +1 -1
  121. package/dist/loaders/index.js +22 -20
  122. package/dist/loaders/index.js.map +1 -1
  123. package/dist/loaders/index.mjs +21 -21
  124. package/dist/loaders/index.mjs.map +1 -1
  125. package/dist/loaders/middlewares.js +29 -25
  126. package/dist/loaders/middlewares.js.map +1 -1
  127. package/dist/loaders/middlewares.mjs +28 -25
  128. package/dist/loaders/middlewares.mjs.map +1 -1
  129. package/dist/loaders/plugins/get-enabled-plugins.d.ts.map +1 -1
  130. package/dist/loaders/plugins/get-enabled-plugins.js +125 -127
  131. package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
  132. package/dist/loaders/plugins/get-enabled-plugins.mjs +124 -104
  133. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
  134. package/dist/loaders/plugins/get-user-plugins-config.js +25 -24
  135. package/dist/loaders/plugins/get-user-plugins-config.js.map +1 -1
  136. package/dist/loaders/plugins/get-user-plugins-config.mjs +24 -23
  137. package/dist/loaders/plugins/get-user-plugins-config.mjs.map +1 -1
  138. package/dist/loaders/plugins/index.d.ts.map +1 -1
  139. package/dist/loaders/plugins/index.js +141 -104
  140. package/dist/loaders/plugins/index.js.map +1 -1
  141. package/dist/loaders/plugins/index.mjs +121 -104
  142. package/dist/loaders/plugins/index.mjs.map +1 -1
  143. package/dist/loaders/policies.js +24 -20
  144. package/dist/loaders/policies.js.map +1 -1
  145. package/dist/loaders/policies.mjs +23 -20
  146. package/dist/loaders/policies.mjs.map +1 -1
  147. package/dist/loaders/sanitizers.js +10 -4
  148. package/dist/loaders/sanitizers.js.map +1 -1
  149. package/dist/loaders/sanitizers.mjs +9 -6
  150. package/dist/loaders/sanitizers.mjs.map +1 -1
  151. package/dist/loaders/src-index.js +35 -27
  152. package/dist/loaders/src-index.js.map +1 -1
  153. package/dist/loaders/src-index.mjs +34 -29
  154. package/dist/loaders/src-index.mjs.map +1 -1
  155. package/dist/loaders/validators.js +9 -4
  156. package/dist/loaders/validators.js.map +1 -1
  157. package/dist/loaders/validators.mjs +8 -6
  158. package/dist/loaders/validators.mjs.map +1 -1
  159. package/dist/middlewares/body.d.ts.map +1 -1
  160. package/dist/middlewares/body.js +58 -54
  161. package/dist/middlewares/body.js.map +1 -1
  162. package/dist/middlewares/body.mjs +57 -51
  163. package/dist/middlewares/body.mjs.map +1 -1
  164. package/dist/middlewares/compression.js +6 -6
  165. package/dist/middlewares/compression.js.map +1 -1
  166. package/dist/middlewares/compression.mjs +5 -5
  167. package/dist/middlewares/compression.mjs.map +1 -1
  168. package/dist/middlewares/cors.js +59 -48
  169. package/dist/middlewares/cors.js.map +1 -1
  170. package/dist/middlewares/cors.mjs +58 -47
  171. package/dist/middlewares/cors.mjs.map +1 -1
  172. package/dist/middlewares/errors.js +32 -30
  173. package/dist/middlewares/errors.js.map +1 -1
  174. package/dist/middlewares/errors.mjs +31 -31
  175. package/dist/middlewares/errors.mjs.map +1 -1
  176. package/dist/middlewares/favicon.js +27 -17
  177. package/dist/middlewares/favicon.js.map +1 -1
  178. package/dist/middlewares/favicon.mjs +26 -16
  179. package/dist/middlewares/favicon.mjs.map +1 -1
  180. package/dist/middlewares/index.js +32 -30
  181. package/dist/middlewares/index.js.map +1 -1
  182. package/dist/middlewares/index.mjs +31 -31
  183. package/dist/middlewares/index.mjs.map +1 -1
  184. package/dist/middlewares/ip.js +6 -6
  185. package/dist/middlewares/ip.js.map +1 -1
  186. package/dist/middlewares/ip.mjs +5 -5
  187. package/dist/middlewares/ip.mjs.map +1 -1
  188. package/dist/middlewares/logger.js +10 -9
  189. package/dist/middlewares/logger.js.map +1 -1
  190. package/dist/middlewares/logger.mjs +9 -10
  191. package/dist/middlewares/logger.mjs.map +1 -1
  192. package/dist/middlewares/powered-by.js +13 -9
  193. package/dist/middlewares/powered-by.js.map +1 -1
  194. package/dist/middlewares/powered-by.mjs +12 -10
  195. package/dist/middlewares/powered-by.mjs.map +1 -1
  196. package/dist/middlewares/public.js +33 -29
  197. package/dist/middlewares/public.js.map +1 -1
  198. package/dist/middlewares/public.mjs +32 -28
  199. package/dist/middlewares/public.mjs.map +1 -1
  200. package/dist/middlewares/query.js +35 -32
  201. package/dist/middlewares/query.js.map +1 -1
  202. package/dist/middlewares/query.mjs +34 -31
  203. package/dist/middlewares/query.mjs.map +1 -1
  204. package/dist/middlewares/response-time.js +10 -9
  205. package/dist/middlewares/response-time.js.map +1 -1
  206. package/dist/middlewares/response-time.mjs +9 -10
  207. package/dist/middlewares/response-time.mjs.map +1 -1
  208. package/dist/middlewares/responses.js +14 -12
  209. package/dist/middlewares/responses.js.map +1 -1
  210. package/dist/middlewares/responses.mjs +13 -13
  211. package/dist/middlewares/responses.mjs.map +1 -1
  212. package/dist/middlewares/security.d.ts.map +1 -1
  213. package/dist/middlewares/security.js +109 -71
  214. package/dist/middlewares/security.js.map +1 -1
  215. package/dist/middlewares/security.mjs +108 -70
  216. package/dist/middlewares/security.mjs.map +1 -1
  217. package/dist/middlewares/session.js +26 -25
  218. package/dist/middlewares/session.js.map +1 -1
  219. package/dist/middlewares/session.mjs +25 -24
  220. package/dist/middlewares/session.mjs.map +1 -1
  221. package/dist/migrations/database/5.0.0-discard-drafts.d.ts +14 -11
  222. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -1
  223. package/dist/migrations/database/5.0.0-discard-drafts.js +153 -35
  224. package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -1
  225. package/dist/migrations/database/5.0.0-discard-drafts.mjs +152 -37
  226. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -1
  227. package/dist/migrations/draft-publish.d.ts +2 -2
  228. package/dist/migrations/draft-publish.d.ts.map +1 -1
  229. package/dist/migrations/draft-publish.js +61 -34
  230. package/dist/migrations/draft-publish.js.map +1 -1
  231. package/dist/migrations/draft-publish.mjs +60 -36
  232. package/dist/migrations/draft-publish.mjs.map +1 -1
  233. package/dist/migrations/i18n.d.ts +5 -0
  234. package/dist/migrations/i18n.d.ts.map +1 -0
  235. package/dist/migrations/i18n.js +71 -0
  236. package/dist/migrations/i18n.js.map +1 -0
  237. package/dist/migrations/i18n.mjs +68 -0
  238. package/dist/migrations/i18n.mjs.map +1 -0
  239. package/dist/migrations/index.d.ts +5 -0
  240. package/dist/migrations/index.d.ts.map +1 -0
  241. package/dist/migrations/index.js +29 -0
  242. package/dist/migrations/index.js.map +1 -0
  243. package/dist/migrations/index.mjs +26 -0
  244. package/dist/migrations/index.mjs.map +1 -0
  245. package/dist/package.json.js +182 -0
  246. package/dist/package.json.js.map +1 -0
  247. package/dist/package.json.mjs +159 -0
  248. package/dist/package.json.mjs.map +1 -0
  249. package/dist/providers/admin.d.ts.map +1 -1
  250. package/dist/providers/admin.js +27 -17
  251. package/dist/providers/admin.js.map +1 -1
  252. package/dist/providers/admin.mjs +26 -19
  253. package/dist/providers/admin.mjs.map +1 -1
  254. package/dist/providers/coreStore.js +13 -8
  255. package/dist/providers/coreStore.js.map +1 -1
  256. package/dist/providers/coreStore.mjs +12 -10
  257. package/dist/providers/coreStore.mjs.map +1 -1
  258. package/dist/providers/cron.js +19 -16
  259. package/dist/providers/cron.js.map +1 -1
  260. package/dist/providers/cron.mjs +18 -18
  261. package/dist/providers/cron.mjs.map +1 -1
  262. package/dist/providers/index.js +18 -9
  263. package/dist/providers/index.js.map +1 -1
  264. package/dist/providers/index.mjs +17 -10
  265. package/dist/providers/index.mjs.map +1 -1
  266. package/dist/providers/provider.js +4 -3
  267. package/dist/providers/provider.js.map +1 -1
  268. package/dist/providers/provider.mjs +3 -4
  269. package/dist/providers/provider.mjs.map +1 -1
  270. package/dist/providers/registries.js +37 -32
  271. package/dist/providers/registries.js.map +1 -1
  272. package/dist/providers/registries.mjs +36 -34
  273. package/dist/providers/registries.mjs.map +1 -1
  274. package/dist/providers/telemetry.js +19 -16
  275. package/dist/providers/telemetry.js.map +1 -1
  276. package/dist/providers/telemetry.mjs +18 -18
  277. package/dist/providers/telemetry.mjs.map +1 -1
  278. package/dist/providers/webhooks.js +28 -26
  279. package/dist/providers/webhooks.js.map +1 -1
  280. package/dist/providers/webhooks.mjs +27 -28
  281. package/dist/providers/webhooks.mjs.map +1 -1
  282. package/dist/registries/apis.js +23 -20
  283. package/dist/registries/apis.js.map +1 -1
  284. package/dist/registries/apis.mjs +22 -22
  285. package/dist/registries/apis.mjs.map +1 -1
  286. package/dist/registries/components.js +35 -37
  287. package/dist/registries/components.js.map +1 -1
  288. package/dist/registries/components.mjs +34 -39
  289. package/dist/registries/components.mjs.map +1 -1
  290. package/dist/registries/content-types.js +54 -59
  291. package/dist/registries/content-types.js.map +1 -1
  292. package/dist/registries/content-types.mjs +53 -61
  293. package/dist/registries/content-types.mjs.map +1 -1
  294. package/dist/registries/controllers.js +70 -71
  295. package/dist/registries/controllers.js.map +1 -1
  296. package/dist/registries/controllers.mjs +69 -73
  297. package/dist/registries/controllers.mjs.map +1 -1
  298. package/dist/registries/custom-fields.js +75 -65
  299. package/dist/registries/custom-fields.js.map +1 -1
  300. package/dist/registries/custom-fields.mjs +74 -67
  301. package/dist/registries/custom-fields.mjs.map +1 -1
  302. package/dist/registries/hooks.js +46 -49
  303. package/dist/registries/hooks.js.map +1 -1
  304. package/dist/registries/hooks.mjs +45 -51
  305. package/dist/registries/hooks.mjs.map +1 -1
  306. package/dist/registries/middlewares.js +49 -51
  307. package/dist/registries/middlewares.js.map +1 -1
  308. package/dist/registries/middlewares.mjs +48 -53
  309. package/dist/registries/middlewares.mjs.map +1 -1
  310. package/dist/registries/models.js +14 -13
  311. package/dist/registries/models.js.map +1 -1
  312. package/dist/registries/models.mjs +13 -14
  313. package/dist/registries/models.mjs.map +1 -1
  314. package/dist/registries/modules.js +39 -36
  315. package/dist/registries/modules.js.map +1 -1
  316. package/dist/registries/modules.mjs +38 -38
  317. package/dist/registries/modules.mjs.map +1 -1
  318. package/dist/registries/namespace.js +21 -20
  319. package/dist/registries/namespace.js.map +1 -1
  320. package/dist/registries/namespace.mjs +20 -23
  321. package/dist/registries/namespace.mjs.map +1 -1
  322. package/dist/registries/plugins.js +23 -20
  323. package/dist/registries/plugins.js.map +1 -1
  324. package/dist/registries/plugins.mjs +22 -22
  325. package/dist/registries/plugins.mjs.map +1 -1
  326. package/dist/registries/policies.d.ts +1 -1
  327. package/dist/registries/policies.d.ts.map +1 -1
  328. package/dist/registries/policies.js +103 -96
  329. package/dist/registries/policies.js.map +1 -1
  330. package/dist/registries/policies.mjs +102 -98
  331. package/dist/registries/policies.mjs.map +1 -1
  332. package/dist/registries/sanitizers.js +23 -22
  333. package/dist/registries/sanitizers.js.map +1 -1
  334. package/dist/registries/sanitizers.mjs +22 -22
  335. package/dist/registries/sanitizers.mjs.map +1 -1
  336. package/dist/registries/services.js +71 -71
  337. package/dist/registries/services.js.map +1 -1
  338. package/dist/registries/services.mjs +70 -73
  339. package/dist/registries/services.mjs.map +1 -1
  340. package/dist/registries/validators.js +23 -22
  341. package/dist/registries/validators.js.map +1 -1
  342. package/dist/registries/validators.mjs +22 -22
  343. package/dist/registries/validators.mjs.map +1 -1
  344. package/dist/services/auth/index.js +74 -74
  345. package/dist/services/auth/index.js.map +1 -1
  346. package/dist/services/auth/index.mjs +73 -74
  347. package/dist/services/auth/index.mjs.map +1 -1
  348. package/dist/services/config.js +47 -43
  349. package/dist/services/config.js.map +1 -1
  350. package/dist/services/config.mjs +46 -44
  351. package/dist/services/config.mjs.map +1 -1
  352. package/dist/services/content-api/index.d.ts +10 -12
  353. package/dist/services/content-api/index.d.ts.map +1 -1
  354. package/dist/services/content-api/index.js +80 -79
  355. package/dist/services/content-api/index.js.map +1 -1
  356. package/dist/services/content-api/index.mjs +79 -79
  357. package/dist/services/content-api/index.mjs.map +1 -1
  358. package/dist/services/content-api/permissions/engine.js +8 -5
  359. package/dist/services/content-api/permissions/engine.js.map +1 -1
  360. package/dist/services/content-api/permissions/engine.mjs +7 -5
  361. package/dist/services/content-api/permissions/engine.mjs.map +1 -1
  362. package/dist/services/content-api/permissions/index.d.ts +10 -12
  363. package/dist/services/content-api/permissions/index.d.ts.map +1 -1
  364. package/dist/services/content-api/permissions/index.js +101 -81
  365. package/dist/services/content-api/permissions/index.js.map +1 -1
  366. package/dist/services/content-api/permissions/index.mjs +100 -81
  367. package/dist/services/content-api/permissions/index.mjs.map +1 -1
  368. package/dist/services/content-api/permissions/providers/action.d.ts +5 -6
  369. package/dist/services/content-api/permissions/providers/action.d.ts.map +1 -1
  370. package/dist/services/content-api/permissions/providers/action.js +17 -14
  371. package/dist/services/content-api/permissions/providers/action.js.map +1 -1
  372. package/dist/services/content-api/permissions/providers/action.mjs +16 -16
  373. package/dist/services/content-api/permissions/providers/action.mjs.map +1 -1
  374. package/dist/services/content-api/permissions/providers/condition.d.ts +5 -6
  375. package/dist/services/content-api/permissions/providers/condition.d.ts.map +1 -1
  376. package/dist/services/content-api/permissions/providers/condition.js +17 -14
  377. package/dist/services/content-api/permissions/providers/condition.js.map +1 -1
  378. package/dist/services/content-api/permissions/providers/condition.mjs +16 -16
  379. package/dist/services/content-api/permissions/providers/condition.mjs.map +1 -1
  380. package/dist/services/core-store.js +115 -95
  381. package/dist/services/core-store.js.map +1 -1
  382. package/dist/services/core-store.mjs +114 -97
  383. package/dist/services/core-store.mjs.map +1 -1
  384. package/dist/services/cron.d.ts +3 -3
  385. package/dist/services/cron.d.ts.map +1 -1
  386. package/dist/services/cron.js +74 -60
  387. package/dist/services/cron.js.map +1 -1
  388. package/dist/services/cron.mjs +73 -62
  389. package/dist/services/cron.mjs.map +1 -1
  390. package/dist/services/custom-fields.js +9 -7
  391. package/dist/services/custom-fields.js.map +1 -1
  392. package/dist/services/custom-fields.mjs +8 -9
  393. package/dist/services/custom-fields.mjs.map +1 -1
  394. package/dist/services/document-service/attributes/index.js +23 -18
  395. package/dist/services/document-service/attributes/index.js.map +1 -1
  396. package/dist/services/document-service/attributes/index.mjs +22 -19
  397. package/dist/services/document-service/attributes/index.mjs.map +1 -1
  398. package/dist/services/document-service/attributes/transforms.js +16 -15
  399. package/dist/services/document-service/attributes/transforms.js.map +1 -1
  400. package/dist/services/document-service/attributes/transforms.mjs +15 -15
  401. package/dist/services/document-service/attributes/transforms.mjs.map +1 -1
  402. package/dist/services/document-service/common.d.ts +1 -1
  403. package/dist/services/document-service/common.d.ts.map +1 -1
  404. package/dist/services/document-service/common.js +5 -4
  405. package/dist/services/document-service/common.js.map +1 -1
  406. package/dist/services/document-service/common.mjs +4 -5
  407. package/dist/services/document-service/common.mjs.map +1 -1
  408. package/dist/services/document-service/components.d.ts.map +1 -1
  409. package/dist/services/document-service/components.js +255 -257
  410. package/dist/services/document-service/components.js.map +1 -1
  411. package/dist/services/document-service/components.mjs +254 -262
  412. package/dist/services/document-service/components.mjs.map +1 -1
  413. package/dist/services/document-service/draft-and-publish.d.ts +1 -1
  414. package/dist/services/document-service/draft-and-publish.d.ts.map +1 -1
  415. package/dist/services/document-service/draft-and-publish.js +88 -48
  416. package/dist/services/document-service/draft-and-publish.js.map +1 -1
  417. package/dist/services/document-service/draft-and-publish.mjs +87 -54
  418. package/dist/services/document-service/draft-and-publish.mjs.map +1 -1
  419. package/dist/services/document-service/entries.d.ts +2 -2
  420. package/dist/services/document-service/entries.d.ts.map +1 -1
  421. package/dist/services/document-service/entries.js +109 -92
  422. package/dist/services/document-service/entries.js.map +1 -1
  423. package/dist/services/document-service/entries.mjs +108 -93
  424. package/dist/services/document-service/entries.mjs.map +1 -1
  425. package/dist/services/document-service/events.d.ts +1 -1
  426. package/dist/services/document-service/events.d.ts.map +1 -1
  427. package/dist/services/document-service/events.js +52 -40
  428. package/dist/services/document-service/events.js.map +1 -1
  429. package/dist/services/document-service/events.mjs +51 -41
  430. package/dist/services/document-service/events.mjs.map +1 -1
  431. package/dist/services/document-service/index.d.ts +2 -1
  432. package/dist/services/document-service/index.d.ts.map +1 -1
  433. package/dist/services/document-service/index.js +53 -32
  434. package/dist/services/document-service/index.js.map +1 -1
  435. package/dist/services/document-service/index.mjs +52 -33
  436. package/dist/services/document-service/index.mjs.map +1 -1
  437. package/dist/services/document-service/internationalization.js +62 -46
  438. package/dist/services/document-service/internationalization.js.map +1 -1
  439. package/dist/services/document-service/internationalization.mjs +61 -50
  440. package/dist/services/document-service/internationalization.mjs.map +1 -1
  441. package/dist/services/document-service/middlewares/errors.js +23 -19
  442. package/dist/services/document-service/middlewares/errors.js.map +1 -1
  443. package/dist/services/document-service/middlewares/errors.mjs +22 -20
  444. package/dist/services/document-service/middlewares/errors.mjs.map +1 -1
  445. package/dist/services/document-service/middlewares/middleware-manager.js +46 -44
  446. package/dist/services/document-service/middlewares/middleware-manager.js.map +1 -1
  447. package/dist/services/document-service/middlewares/middleware-manager.mjs +45 -45
  448. package/dist/services/document-service/middlewares/middleware-manager.mjs.map +1 -1
  449. package/dist/services/document-service/params.js +11 -5
  450. package/dist/services/document-service/params.js.map +1 -1
  451. package/dist/services/document-service/params.mjs +10 -6
  452. package/dist/services/document-service/params.mjs.map +1 -1
  453. package/dist/services/document-service/repository.d.ts.map +1 -1
  454. package/dist/services/document-service/repository.js +355 -269
  455. package/dist/services/document-service/repository.js.map +1 -1
  456. package/dist/services/document-service/repository.mjs +354 -270
  457. package/dist/services/document-service/repository.mjs.map +1 -1
  458. package/dist/services/document-service/transform/data.js +22 -12
  459. package/dist/services/document-service/transform/data.js.map +1 -1
  460. package/dist/services/document-service/transform/data.mjs +21 -13
  461. package/dist/services/document-service/transform/data.mjs.map +1 -1
  462. package/dist/services/document-service/transform/fields.js +26 -17
  463. package/dist/services/document-service/transform/fields.js.map +1 -1
  464. package/dist/services/document-service/transform/fields.mjs +25 -18
  465. package/dist/services/document-service/transform/fields.mjs.map +1 -1
  466. package/dist/services/document-service/transform/id-map.d.ts +1 -1
  467. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  468. package/dist/services/document-service/transform/id-map.js +116 -69
  469. package/dist/services/document-service/transform/id-map.js.map +1 -1
  470. package/dist/services/document-service/transform/id-map.mjs +115 -70
  471. package/dist/services/document-service/transform/id-map.mjs.map +1 -1
  472. package/dist/services/document-service/transform/id-transform.d.ts +1 -1
  473. package/dist/services/document-service/transform/id-transform.d.ts.map +1 -1
  474. package/dist/services/document-service/transform/id-transform.js +37 -29
  475. package/dist/services/document-service/transform/id-transform.js.map +1 -1
  476. package/dist/services/document-service/transform/id-transform.mjs +36 -30
  477. package/dist/services/document-service/transform/id-transform.mjs.map +1 -1
  478. package/dist/services/document-service/transform/populate.js +23 -18
  479. package/dist/services/document-service/transform/populate.js.map +1 -1
  480. package/dist/services/document-service/transform/populate.mjs +22 -19
  481. package/dist/services/document-service/transform/populate.mjs.map +1 -1
  482. package/dist/services/document-service/transform/query.js +11 -6
  483. package/dist/services/document-service/transform/query.js.map +1 -1
  484. package/dist/services/document-service/transform/query.mjs +10 -7
  485. package/dist/services/document-service/transform/query.mjs.map +1 -1
  486. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts +1 -1
  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 +71 -48
  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 +70 -49
  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.map +1 -1
  493. package/dist/services/document-service/transform/relations/transform/data-ids.js +97 -63
  494. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +1 -1
  495. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +96 -64
  496. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +1 -1
  497. package/dist/services/document-service/transform/relations/transform/default-locale.js +47 -29
  498. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +1 -1
  499. package/dist/services/document-service/transform/relations/transform/default-locale.mjs +46 -30
  500. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +1 -1
  501. package/dist/services/document-service/transform/relations/utils/dp.d.ts +1 -1
  502. package/dist/services/document-service/transform/relations/utils/dp.d.ts.map +1 -1
  503. package/dist/services/document-service/transform/relations/utils/dp.js +52 -26
  504. package/dist/services/document-service/transform/relations/utils/dp.js.map +1 -1
  505. package/dist/services/document-service/transform/relations/utils/dp.mjs +51 -27
  506. package/dist/services/document-service/transform/relations/utils/dp.mjs.map +1 -1
  507. package/dist/services/document-service/transform/relations/utils/i18n.d.ts +1 -1
  508. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  509. package/dist/services/document-service/transform/relations/utils/i18n.js +20 -18
  510. package/dist/services/document-service/transform/relations/utils/i18n.js.map +1 -1
  511. package/dist/services/document-service/transform/relations/utils/i18n.mjs +19 -21
  512. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +1 -1
  513. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts.map +1 -1
  514. package/dist/services/document-service/transform/relations/utils/map-relation.js +116 -77
  515. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +1 -1
  516. package/dist/services/document-service/transform/relations/utils/map-relation.mjs +115 -79
  517. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +1 -1
  518. package/dist/services/document-service/utils/bidirectional-relations.d.ts +95 -0
  519. package/dist/services/document-service/utils/bidirectional-relations.d.ts.map +1 -0
  520. package/dist/services/document-service/utils/bidirectional-relations.js +148 -0
  521. package/dist/services/document-service/utils/bidirectional-relations.js.map +1 -0
  522. package/dist/services/document-service/utils/bidirectional-relations.mjs +145 -0
  523. package/dist/services/document-service/utils/bidirectional-relations.mjs.map +1 -0
  524. package/dist/services/document-service/utils/populate.d.ts +1 -1
  525. package/dist/services/document-service/utils/populate.d.ts.map +1 -1
  526. package/dist/services/document-service/utils/populate.js +67 -41
  527. package/dist/services/document-service/utils/populate.js.map +1 -1
  528. package/dist/services/document-service/utils/populate.mjs +66 -42
  529. package/dist/services/document-service/utils/populate.mjs.map +1 -1
  530. package/dist/services/document-service/utils/unidirectional-relations.d.ts +36 -0
  531. package/dist/services/document-service/utils/unidirectional-relations.d.ts.map +1 -0
  532. package/dist/services/document-service/utils/unidirectional-relations.js +116 -0
  533. package/dist/services/document-service/utils/unidirectional-relations.js.map +1 -0
  534. package/dist/services/document-service/utils/unidirectional-relations.mjs +113 -0
  535. package/dist/services/document-service/utils/unidirectional-relations.mjs.map +1 -0
  536. package/dist/services/entity-service/index.js +230 -161
  537. package/dist/services/entity-service/index.js.map +1 -1
  538. package/dist/services/entity-service/index.mjs +229 -160
  539. package/dist/services/entity-service/index.mjs.map +1 -1
  540. package/dist/services/entity-validator/blocks-validator.d.ts +1 -2
  541. package/dist/services/entity-validator/blocks-validator.d.ts.map +1 -1
  542. package/dist/services/entity-validator/blocks-validator.js +137 -104
  543. package/dist/services/entity-validator/blocks-validator.js.map +1 -1
  544. package/dist/services/entity-validator/blocks-validator.mjs +135 -105
  545. package/dist/services/entity-validator/blocks-validator.mjs.map +1 -1
  546. package/dist/services/entity-validator/index.d.ts +2 -1
  547. package/dist/services/entity-validator/index.d.ts.map +1 -1
  548. package/dist/services/entity-validator/index.js +362 -368
  549. package/dist/services/entity-validator/index.js.map +1 -1
  550. package/dist/services/entity-validator/index.mjs +358 -365
  551. package/dist/services/entity-validator/index.mjs.map +1 -1
  552. package/dist/services/entity-validator/validators.d.ts +32 -23
  553. package/dist/services/entity-validator/validators.d.ts.map +1 -1
  554. package/dist/services/entity-validator/validators.js +282 -151
  555. package/dist/services/entity-validator/validators.js.map +1 -1
  556. package/dist/services/entity-validator/validators.mjs +273 -150
  557. package/dist/services/entity-validator/validators.mjs.map +1 -1
  558. package/dist/services/errors.js +65 -65
  559. package/dist/services/errors.js.map +1 -1
  560. package/dist/services/errors.mjs +64 -66
  561. package/dist/services/errors.mjs.map +1 -1
  562. package/dist/services/event-hub.js +82 -69
  563. package/dist/services/event-hub.js.map +1 -1
  564. package/dist/services/event-hub.mjs +81 -71
  565. package/dist/services/event-hub.mjs.map +1 -1
  566. package/dist/services/features.js +19 -14
  567. package/dist/services/features.js.map +1 -1
  568. package/dist/services/features.mjs +18 -15
  569. package/dist/services/features.mjs.map +1 -1
  570. package/dist/services/fs.js +41 -40
  571. package/dist/services/fs.js.map +1 -1
  572. package/dist/services/fs.mjs +40 -39
  573. package/dist/services/fs.mjs.map +1 -1
  574. package/dist/services/metrics/admin-user-hash.js +13 -11
  575. package/dist/services/metrics/admin-user-hash.js.map +1 -1
  576. package/dist/services/metrics/admin-user-hash.mjs +12 -10
  577. package/dist/services/metrics/admin-user-hash.mjs.map +1 -1
  578. package/dist/services/metrics/index.js +46 -40
  579. package/dist/services/metrics/index.js.map +1 -1
  580. package/dist/services/metrics/index.mjs +45 -42
  581. package/dist/services/metrics/index.mjs.map +1 -1
  582. package/dist/services/metrics/is-truthy.js +13 -6
  583. package/dist/services/metrics/is-truthy.js.map +1 -1
  584. package/dist/services/metrics/is-truthy.mjs +12 -6
  585. package/dist/services/metrics/is-truthy.mjs.map +1 -1
  586. package/dist/services/metrics/middleware.d.ts.map +1 -1
  587. package/dist/services/metrics/middleware.js +37 -22
  588. package/dist/services/metrics/middleware.js.map +1 -1
  589. package/dist/services/metrics/middleware.mjs +36 -24
  590. package/dist/services/metrics/middleware.mjs.map +1 -1
  591. package/dist/services/metrics/rate-limiter.d.ts.map +1 -1
  592. package/dist/services/metrics/rate-limiter.js +24 -19
  593. package/dist/services/metrics/rate-limiter.js.map +1 -1
  594. package/dist/services/metrics/rate-limiter.mjs +23 -21
  595. package/dist/services/metrics/rate-limiter.mjs.map +1 -1
  596. package/dist/services/metrics/sender.js +78 -69
  597. package/dist/services/metrics/sender.js.map +1 -1
  598. package/dist/services/metrics/sender.mjs +77 -64
  599. package/dist/services/metrics/sender.mjs.map +1 -1
  600. package/dist/services/query-params.js +13 -10
  601. package/dist/services/query-params.js.map +1 -1
  602. package/dist/services/query-params.mjs +12 -12
  603. package/dist/services/query-params.mjs.map +1 -1
  604. package/dist/services/reloader.js +35 -32
  605. package/dist/services/reloader.js.map +1 -1
  606. package/dist/services/reloader.mjs +34 -33
  607. package/dist/services/reloader.mjs.map +1 -1
  608. package/dist/services/request-context.js +11 -8
  609. package/dist/services/request-context.js.map +1 -1
  610. package/dist/services/request-context.mjs +10 -10
  611. package/dist/services/request-context.mjs.map +1 -1
  612. package/dist/services/server/admin-api.js +11 -10
  613. package/dist/services/server/admin-api.js.map +1 -1
  614. package/dist/services/server/admin-api.mjs +10 -11
  615. package/dist/services/server/admin-api.mjs.map +1 -1
  616. package/dist/services/server/api.js +33 -27
  617. package/dist/services/server/api.js.map +1 -1
  618. package/dist/services/server/api.mjs +32 -26
  619. package/dist/services/server/api.mjs.map +1 -1
  620. package/dist/services/server/compose-endpoint.js +116 -105
  621. package/dist/services/server/compose-endpoint.js.map +1 -1
  622. package/dist/services/server/compose-endpoint.mjs +115 -105
  623. package/dist/services/server/compose-endpoint.mjs.map +1 -1
  624. package/dist/services/server/content-api.js +11 -9
  625. package/dist/services/server/content-api.js.map +1 -1
  626. package/dist/services/server/content-api.mjs +10 -10
  627. package/dist/services/server/content-api.mjs.map +1 -1
  628. package/dist/services/server/http-server.js +48 -44
  629. package/dist/services/server/http-server.js.map +1 -1
  630. package/dist/services/server/http-server.mjs +47 -43
  631. package/dist/services/server/http-server.mjs.map +1 -1
  632. package/dist/services/server/index.js +85 -82
  633. package/dist/services/server/index.js.map +1 -1
  634. package/dist/services/server/index.mjs +84 -81
  635. package/dist/services/server/index.mjs.map +1 -1
  636. package/dist/services/server/koa.js +49 -47
  637. package/dist/services/server/koa.js.map +1 -1
  638. package/dist/services/server/koa.mjs +48 -44
  639. package/dist/services/server/koa.mjs.map +1 -1
  640. package/dist/services/server/middleware.js +86 -82
  641. package/dist/services/server/middleware.js.map +1 -1
  642. package/dist/services/server/middleware.mjs +85 -82
  643. package/dist/services/server/middleware.mjs.map +1 -1
  644. package/dist/services/server/policy.js +24 -17
  645. package/dist/services/server/policy.js.map +1 -1
  646. package/dist/services/server/policy.mjs +23 -18
  647. package/dist/services/server/policy.mjs.map +1 -1
  648. package/dist/services/server/register-middlewares.js +68 -61
  649. package/dist/services/server/register-middlewares.js.map +1 -1
  650. package/dist/services/server/register-middlewares.mjs +67 -63
  651. package/dist/services/server/register-middlewares.mjs.map +1 -1
  652. package/dist/services/server/register-routes.js +90 -67
  653. package/dist/services/server/register-routes.js.map +1 -1
  654. package/dist/services/server/register-routes.mjs +89 -67
  655. package/dist/services/server/register-routes.mjs.map +1 -1
  656. package/dist/services/server/routing.js +94 -81
  657. package/dist/services/server/routing.js.map +1 -1
  658. package/dist/services/server/routing.mjs +93 -81
  659. package/dist/services/server/routing.mjs.map +1 -1
  660. package/dist/services/utils/dynamic-zones.js +13 -14
  661. package/dist/services/utils/dynamic-zones.js.map +1 -1
  662. package/dist/services/utils/dynamic-zones.mjs +12 -16
  663. package/dist/services/utils/dynamic-zones.mjs.map +1 -1
  664. package/dist/services/webhook-runner.js +124 -122
  665. package/dist/services/webhook-runner.js.map +1 -1
  666. package/dist/services/webhook-runner.mjs +123 -121
  667. package/dist/services/webhook-runner.mjs.map +1 -1
  668. package/dist/services/webhook-store.js +132 -99
  669. package/dist/services/webhook-store.js.map +1 -1
  670. package/dist/services/webhook-store.mjs +131 -101
  671. package/dist/services/webhook-store.mjs.map +1 -1
  672. package/dist/services/worker-queue.js +44 -49
  673. package/dist/services/worker-queue.js.map +1 -1
  674. package/dist/services/worker-queue.mjs +43 -49
  675. package/dist/services/worker-queue.mjs.map +1 -1
  676. package/dist/utils/convert-custom-field-type.js +17 -20
  677. package/dist/utils/convert-custom-field-type.js.map +1 -1
  678. package/dist/utils/convert-custom-field-type.mjs +16 -21
  679. package/dist/utils/convert-custom-field-type.mjs.map +1 -1
  680. package/dist/utils/cron.js +64 -30
  681. package/dist/utils/cron.js.map +1 -1
  682. package/dist/utils/cron.mjs +63 -31
  683. package/dist/utils/cron.mjs.map +1 -1
  684. package/dist/utils/fetch.js +24 -18
  685. package/dist/utils/fetch.js.map +1 -1
  686. package/dist/utils/fetch.mjs +23 -19
  687. package/dist/utils/fetch.mjs.map +1 -1
  688. package/dist/utils/filepath-to-prop-path.js +20 -28
  689. package/dist/utils/filepath-to-prop-path.js.map +1 -1
  690. package/dist/utils/filepath-to-prop-path.mjs +19 -26
  691. package/dist/utils/filepath-to-prop-path.mjs.map +1 -1
  692. package/dist/utils/is-initialized.js +21 -12
  693. package/dist/utils/is-initialized.js.map +1 -1
  694. package/dist/utils/is-initialized.mjs +20 -13
  695. package/dist/utils/is-initialized.mjs.map +1 -1
  696. package/dist/utils/lifecycles.js +6 -5
  697. package/dist/utils/lifecycles.js.map +1 -1
  698. package/dist/utils/lifecycles.mjs +5 -6
  699. package/dist/utils/lifecycles.mjs.map +1 -1
  700. package/dist/utils/load-config-file.js +40 -38
  701. package/dist/utils/load-config-file.js.map +1 -1
  702. package/dist/utils/load-config-file.mjs +39 -36
  703. package/dist/utils/load-config-file.mjs.map +1 -1
  704. package/dist/utils/load-files.js +40 -35
  705. package/dist/utils/load-files.js.map +1 -1
  706. package/dist/utils/load-files.mjs +39 -32
  707. package/dist/utils/load-files.mjs.map +1 -1
  708. package/dist/utils/open-browser.js +8 -8
  709. package/dist/utils/open-browser.js.map +1 -1
  710. package/dist/utils/open-browser.mjs +7 -7
  711. package/dist/utils/open-browser.mjs.map +1 -1
  712. package/dist/utils/resolve-working-dirs.js +23 -10
  713. package/dist/utils/resolve-working-dirs.js.map +1 -1
  714. package/dist/utils/resolve-working-dirs.mjs +22 -9
  715. package/dist/utils/resolve-working-dirs.mjs.map +1 -1
  716. package/dist/utils/signals.js +20 -14
  717. package/dist/utils/signals.js.map +1 -1
  718. package/dist/utils/signals.mjs +19 -15
  719. package/dist/utils/signals.mjs.map +1 -1
  720. package/dist/utils/startup-logger.d.ts.map +1 -1
  721. package/dist/utils/startup-logger.js +107 -78
  722. package/dist/utils/startup-logger.js.map +1 -1
  723. package/dist/utils/startup-logger.mjs +106 -75
  724. package/dist/utils/startup-logger.mjs.map +1 -1
  725. package/dist/utils/transform-content-types-to-models.d.ts +355 -23
  726. package/dist/utils/transform-content-types-to-models.d.ts.map +1 -1
  727. package/dist/utils/transform-content-types-to-models.js +350 -260
  728. package/dist/utils/transform-content-types-to-models.js.map +1 -1
  729. package/dist/utils/transform-content-types-to-models.mjs +349 -268
  730. package/dist/utils/transform-content-types-to-models.mjs.map +1 -1
  731. package/dist/utils/update-notifier/index.d.ts.map +1 -1
  732. package/dist/utils/update-notifier/index.js +68 -73
  733. package/dist/utils/update-notifier/index.js.map +1 -1
  734. package/dist/utils/update-notifier/index.mjs +67 -67
  735. package/dist/utils/update-notifier/index.mjs.map +1 -1
  736. package/package.json +30 -31
@@ -1,47 +1,59 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const strapiUtils = require("@strapi/utils");
4
- const populate = require("./utils/populate.js");
1
+ 'use strict';
2
+
3
+ var strapiUtils = require('@strapi/utils');
4
+ var populate = require('./utils/populate.js');
5
+
5
6
  const EVENTS = {
6
- ENTRY_CREATE: "entry.create",
7
- ENTRY_UPDATE: "entry.update",
8
- ENTRY_DELETE: "entry.delete",
9
- ENTRY_PUBLISH: "entry.publish",
10
- ENTRY_UNPUBLISH: "entry.unpublish",
11
- ENTRY_DRAFT_DISCARD: "entry.draft-discard"
7
+ ENTRY_CREATE: 'entry.create',
8
+ ENTRY_UPDATE: 'entry.update',
9
+ ENTRY_DELETE: 'entry.delete',
10
+ ENTRY_PUBLISH: 'entry.publish',
11
+ ENTRY_UNPUBLISH: 'entry.unpublish',
12
+ ENTRY_DRAFT_DISCARD: 'entry.draft-discard'
12
13
  };
13
- const createEventManager = (strapi, uid) => {
14
- const populate$1 = populate.getDeepPopulate(uid, {});
15
- const model = strapi.getModel(uid);
16
- const emitEvent = async (eventName, entry) => {
17
- let populatedEntry = entry;
18
- if (![EVENTS.ENTRY_DELETE, EVENTS.ENTRY_UNPUBLISH].includes(eventName)) {
19
- populatedEntry = await strapi.db.query(uid).findOne({ where: { id: entry.id }, populate: populate$1 });
20
- }
21
- const sanitizedEntry = await strapiUtils.sanitize.sanitizers.defaultSanitizeOutput(
22
- {
23
- schema: model,
24
- getModel: (uid2) => strapi.getModel(uid2)
25
- },
26
- populatedEntry
27
- );
28
- await strapi.eventHub.emit(eventName, {
29
- model: model.modelName,
30
- uid: model.uid,
31
- entry: sanitizedEntry
32
- });
33
- };
34
- return {
35
- /**
14
+ /**
15
+ * Manager to trigger entry related events
16
+ *
17
+ * It will populate the entry if it is not a delete event.
18
+ * So the event payload will contain the full entry.
19
+ */ const createEventManager = (strapi, uid)=>{
20
+ const populate$1 = populate.getDeepPopulate(uid, {});
21
+ const model = strapi.getModel(uid);
22
+ const emitEvent = async (eventName, entry)=>{
23
+ // There is no need to populate the entry if it has been deleted
24
+ let populatedEntry = entry;
25
+ if (![
26
+ EVENTS.ENTRY_DELETE,
27
+ EVENTS.ENTRY_UNPUBLISH
28
+ ].includes(eventName)) {
29
+ populatedEntry = await strapi.db.query(uid).findOne({
30
+ where: {
31
+ id: entry.id
32
+ },
33
+ populate: populate$1
34
+ });
35
+ }
36
+ const sanitizedEntry = await strapiUtils.sanitize.sanitizers.defaultSanitizeOutput({
37
+ schema: model,
38
+ getModel: (uid)=>strapi.getModel(uid)
39
+ }, populatedEntry);
40
+ await strapi.eventHub.emit(eventName, {
41
+ model: model.modelName,
42
+ uid: model.uid,
43
+ entry: sanitizedEntry
44
+ });
45
+ };
46
+ return {
47
+ /**
36
48
  * strapi.db.query might reuse the transaction used in the doc service request,
37
49
  * so this is executed after that transaction is committed.
38
- */
39
- emitEvent(eventName, entry) {
40
- strapi.db.transaction(({ onCommit }) => {
41
- onCommit(() => emitEvent(eventName, entry));
42
- });
43
- }
44
- };
50
+ */ emitEvent (eventName, entry) {
51
+ strapi.db.transaction(({ onCommit })=>{
52
+ onCommit(()=>emitEvent(eventName, entry));
53
+ });
54
+ }
55
+ };
45
56
  };
57
+
46
58
  exports.createEventManager = createEventManager;
47
59
  //# sourceMappingURL=events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sources":["../../../src/services/document-service/events.ts"],"sourcesContent":["import { UID, Utils, Modules, Core } from '@strapi/types';\nimport { sanitize } from '@strapi/utils';\n\nimport { getDeepPopulate } from './utils/populate';\n\nconst EVENTS = {\n ENTRY_CREATE: 'entry.create',\n ENTRY_UPDATE: 'entry.update',\n ENTRY_DELETE: 'entry.delete',\n ENTRY_PUBLISH: 'entry.publish',\n ENTRY_UNPUBLISH: 'entry.unpublish',\n ENTRY_DRAFT_DISCARD: 'entry.draft-discard',\n};\n\ntype EventName = Utils.Object.Values<typeof EVENTS>;\n\n/**\n * Manager to trigger entry related events\n *\n * It will populate the entry if it is not a delete event.\n * So the event payload will contain the full entry.\n */\nconst createEventManager = (strapi: Core.Strapi, uid: UID.Schema) => {\n const populate = getDeepPopulate(uid, {});\n const model = strapi.getModel(uid);\n\n const emitEvent = async (eventName: EventName, entry: Modules.Documents.AnyDocument) => {\n // There is no need to populate the entry if it has been deleted\n let populatedEntry = entry;\n if (![EVENTS.ENTRY_DELETE, EVENTS.ENTRY_UNPUBLISH].includes(eventName)) {\n populatedEntry = await strapi.db.query(uid).findOne({ where: { id: entry.id }, populate });\n }\n\n const sanitizedEntry = await sanitize.sanitizers.defaultSanitizeOutput(\n {\n schema: model,\n getModel: (uid) => strapi.getModel(uid as UID.Schema),\n },\n populatedEntry\n );\n\n await strapi.eventHub.emit(eventName, {\n model: model.modelName,\n uid: model.uid,\n entry: sanitizedEntry,\n });\n };\n\n return {\n /**\n * strapi.db.query might reuse the transaction used in the doc service request,\n * so this is executed after that transaction is committed.\n */\n emitEvent(eventName: EventName, entry: Modules.Documents.AnyDocument) {\n strapi.db.transaction(({ onCommit }) => {\n onCommit(() => emitEvent(eventName, entry));\n });\n },\n };\n};\n\nexport { createEventManager };\n"],"names":["populate","getDeepPopulate","sanitize","uid"],"mappings":";;;;AAKA,MAAM,SAAS;AAAA,EACb,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA,EACd,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,qBAAqB;AACvB;AAUM,MAAA,qBAAqB,CAAC,QAAqB,QAAoB;AACnE,QAAMA,aAAWC,SAAAA,gBAAgB,KAAK,CAAE,CAAA;AAClC,QAAA,QAAQ,OAAO,SAAS,GAAG;AAE3B,QAAA,YAAY,OAAO,WAAsB,UAAyC;AAEtF,QAAI,iBAAiB;AACjB,QAAA,CAAC,CAAC,OAAO,cAAc,OAAO,eAAe,EAAE,SAAS,SAAS,GAAG;AACtE,uBAAiB,MAAM,OAAO,GAAG,MAAM,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,MAAM,GAAG,GAAGD,UAAAA,WAAU,CAAA;AAAA,IAC3F;AAEM,UAAA,iBAAiB,MAAME,qBAAS,WAAW;AAAA,MAC/C;AAAA,QACE,QAAQ;AAAA,QACR,UAAU,CAACC,SAAQ,OAAO,SAASA,IAAiB;AAAA,MACtD;AAAA,MACA;AAAA,IAAA;AAGI,UAAA,OAAO,SAAS,KAAK,WAAW;AAAA,MACpC,OAAO,MAAM;AAAA,MACb,KAAK,MAAM;AAAA,MACX,OAAO;AAAA,IAAA,CACR;AAAA,EAAA;AAGI,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,UAAU,WAAsB,OAAsC;AACpE,aAAO,GAAG,YAAY,CAAC,EAAE,eAAe;AACtC,iBAAS,MAAM,UAAU,WAAW,KAAK,CAAC;AAAA,MAAA,CAC3C;AAAA,IACH;AAAA,EAAA;AAEJ;;"}
1
+ {"version":3,"file":"events.js","sources":["../../../src/services/document-service/events.ts"],"sourcesContent":["import type { UID, Utils, Modules, Core } from '@strapi/types';\nimport { sanitize } from '@strapi/utils';\n\nimport { getDeepPopulate } from './utils/populate';\n\nconst EVENTS = {\n ENTRY_CREATE: 'entry.create',\n ENTRY_UPDATE: 'entry.update',\n ENTRY_DELETE: 'entry.delete',\n ENTRY_PUBLISH: 'entry.publish',\n ENTRY_UNPUBLISH: 'entry.unpublish',\n ENTRY_DRAFT_DISCARD: 'entry.draft-discard',\n};\n\ntype EventName = Utils.Object.Values<typeof EVENTS>;\n\n/**\n * Manager to trigger entry related events\n *\n * It will populate the entry if it is not a delete event.\n * So the event payload will contain the full entry.\n */\nconst createEventManager = (strapi: Core.Strapi, uid: UID.Schema) => {\n const populate = getDeepPopulate(uid, {});\n const model = strapi.getModel(uid);\n\n const emitEvent = async (eventName: EventName, entry: Modules.Documents.AnyDocument) => {\n // There is no need to populate the entry if it has been deleted\n let populatedEntry = entry;\n if (![EVENTS.ENTRY_DELETE, EVENTS.ENTRY_UNPUBLISH].includes(eventName)) {\n populatedEntry = await strapi.db.query(uid).findOne({ where: { id: entry.id }, populate });\n }\n\n const sanitizedEntry = await sanitize.sanitizers.defaultSanitizeOutput(\n {\n schema: model,\n getModel: (uid) => strapi.getModel(uid as UID.Schema),\n },\n populatedEntry\n );\n\n await strapi.eventHub.emit(eventName, {\n model: model.modelName,\n uid: model.uid,\n entry: sanitizedEntry,\n });\n };\n\n return {\n /**\n * strapi.db.query might reuse the transaction used in the doc service request,\n * so this is executed after that transaction is committed.\n */\n emitEvent(eventName: EventName, entry: Modules.Documents.AnyDocument) {\n strapi.db.transaction(({ onCommit }) => {\n onCommit(() => emitEvent(eventName, entry));\n });\n },\n };\n};\n\nexport { createEventManager };\n"],"names":["EVENTS","ENTRY_CREATE","ENTRY_UPDATE","ENTRY_DELETE","ENTRY_PUBLISH","ENTRY_UNPUBLISH","ENTRY_DRAFT_DISCARD","createEventManager","strapi","uid","populate","getDeepPopulate","model","getModel","emitEvent","eventName","entry","populatedEntry","includes","db","query","findOne","where","id","sanitizedEntry","sanitize","sanitizers","defaultSanitizeOutput","schema","eventHub","emit","modelName","transaction","onCommit"],"mappings":";;;;;AAKA,MAAMA,MAAS,GAAA;IACbC,YAAc,EAAA,cAAA;IACdC,YAAc,EAAA,cAAA;IACdC,YAAc,EAAA,cAAA;IACdC,aAAe,EAAA,eAAA;IACfC,eAAiB,EAAA,iBAAA;IACjBC,mBAAqB,EAAA;AACvB,CAAA;AAIA;;;;;IAMA,MAAMC,kBAAqB,GAAA,CAACC,MAAqBC,EAAAA,GAAAA,GAAAA;IAC/C,MAAMC,UAAAA,GAAWC,wBAAgBF,CAAAA,GAAAA,EAAK,EAAC,CAAA;IACvC,MAAMG,KAAAA,GAAQJ,MAAOK,CAAAA,QAAQ,CAACJ,GAAAA,CAAAA;IAE9B,MAAMK,SAAAA,GAAY,OAAOC,SAAsBC,EAAAA,KAAAA,GAAAA;;AAE7C,QAAA,IAAIC,cAAiBD,GAAAA,KAAAA;AACrB,QAAA,IAAI,CAAC;AAAChB,YAAAA,MAAAA,CAAOG,YAAY;AAAEH,YAAAA,MAAAA,CAAOK;SAAgB,CAACa,QAAQ,CAACH,SAAY,CAAA,EAAA;YACtEE,cAAiB,GAAA,MAAMT,OAAOW,EAAE,CAACC,KAAK,CAACX,GAAAA,CAAAA,CAAKY,OAAO,CAAC;gBAAEC,KAAO,EAAA;AAAEC,oBAAAA,EAAAA,EAAIP,MAAMO;AAAG,iBAAA;AAAGb,0BAAAA;AAAS,aAAA,CAAA;AAC1F;AAEA,QAAA,MAAMc,iBAAiB,MAAMC,oBAAAA,CAASC,UAAU,CAACC,qBAAqB,CACpE;YACEC,MAAQhB,EAAAA,KAAAA;AACRC,YAAAA,QAAAA,EAAU,CAACJ,GAAAA,GAAQD,MAAOK,CAAAA,QAAQ,CAACJ,GAAAA;SAErCQ,EAAAA,cAAAA,CAAAA;AAGF,QAAA,MAAMT,MAAOqB,CAAAA,QAAQ,CAACC,IAAI,CAACf,SAAW,EAAA;AACpCH,YAAAA,KAAAA,EAAOA,MAAMmB,SAAS;AACtBtB,YAAAA,GAAAA,EAAKG,MAAMH,GAAG;YACdO,KAAOQ,EAAAA;AACT,SAAA,CAAA;AACF,KAAA;IAEA,OAAO;AACL;;;QAIAV,SAAAA,CAAAA,CAAUC,SAAoB,EAAEC,KAAoC,EAAA;AAClER,YAAAA,MAAAA,CAAOW,EAAE,CAACa,WAAW,CAAC,CAAC,EAAEC,QAAQ,EAAE,GAAA;gBACjCA,QAAS,CAAA,IAAMnB,UAAUC,SAAWC,EAAAA,KAAAA,CAAAA,CAAAA;AACtC,aAAA,CAAA;AACF;AACF,KAAA;AACF;;;;"}
@@ -1,47 +1,57 @@
1
- import { sanitize } from "@strapi/utils";
2
- import { getDeepPopulate } from "./utils/populate.mjs";
1
+ import { sanitize } from '@strapi/utils';
2
+ import { getDeepPopulate } from './utils/populate.mjs';
3
+
3
4
  const EVENTS = {
4
- ENTRY_CREATE: "entry.create",
5
- ENTRY_UPDATE: "entry.update",
6
- ENTRY_DELETE: "entry.delete",
7
- ENTRY_PUBLISH: "entry.publish",
8
- ENTRY_UNPUBLISH: "entry.unpublish",
9
- ENTRY_DRAFT_DISCARD: "entry.draft-discard"
5
+ ENTRY_CREATE: 'entry.create',
6
+ ENTRY_UPDATE: 'entry.update',
7
+ ENTRY_DELETE: 'entry.delete',
8
+ ENTRY_PUBLISH: 'entry.publish',
9
+ ENTRY_UNPUBLISH: 'entry.unpublish',
10
+ ENTRY_DRAFT_DISCARD: 'entry.draft-discard'
10
11
  };
11
- const createEventManager = (strapi, uid) => {
12
- const populate = getDeepPopulate(uid, {});
13
- const model = strapi.getModel(uid);
14
- const emitEvent = async (eventName, entry) => {
15
- let populatedEntry = entry;
16
- if (![EVENTS.ENTRY_DELETE, EVENTS.ENTRY_UNPUBLISH].includes(eventName)) {
17
- populatedEntry = await strapi.db.query(uid).findOne({ where: { id: entry.id }, populate });
18
- }
19
- const sanitizedEntry = await sanitize.sanitizers.defaultSanitizeOutput(
20
- {
21
- schema: model,
22
- getModel: (uid2) => strapi.getModel(uid2)
23
- },
24
- populatedEntry
25
- );
26
- await strapi.eventHub.emit(eventName, {
27
- model: model.modelName,
28
- uid: model.uid,
29
- entry: sanitizedEntry
30
- });
31
- };
32
- return {
33
- /**
12
+ /**
13
+ * Manager to trigger entry related events
14
+ *
15
+ * It will populate the entry if it is not a delete event.
16
+ * So the event payload will contain the full entry.
17
+ */ const createEventManager = (strapi, uid)=>{
18
+ const populate = getDeepPopulate(uid, {});
19
+ const model = strapi.getModel(uid);
20
+ const emitEvent = async (eventName, entry)=>{
21
+ // There is no need to populate the entry if it has been deleted
22
+ let populatedEntry = entry;
23
+ if (![
24
+ EVENTS.ENTRY_DELETE,
25
+ EVENTS.ENTRY_UNPUBLISH
26
+ ].includes(eventName)) {
27
+ populatedEntry = await strapi.db.query(uid).findOne({
28
+ where: {
29
+ id: entry.id
30
+ },
31
+ populate
32
+ });
33
+ }
34
+ const sanitizedEntry = await sanitize.sanitizers.defaultSanitizeOutput({
35
+ schema: model,
36
+ getModel: (uid)=>strapi.getModel(uid)
37
+ }, populatedEntry);
38
+ await strapi.eventHub.emit(eventName, {
39
+ model: model.modelName,
40
+ uid: model.uid,
41
+ entry: sanitizedEntry
42
+ });
43
+ };
44
+ return {
45
+ /**
34
46
  * strapi.db.query might reuse the transaction used in the doc service request,
35
47
  * so this is executed after that transaction is committed.
36
- */
37
- emitEvent(eventName, entry) {
38
- strapi.db.transaction(({ onCommit }) => {
39
- onCommit(() => emitEvent(eventName, entry));
40
- });
41
- }
42
- };
43
- };
44
- export {
45
- createEventManager
48
+ */ emitEvent (eventName, entry) {
49
+ strapi.db.transaction(({ onCommit })=>{
50
+ onCommit(()=>emitEvent(eventName, entry));
51
+ });
52
+ }
53
+ };
46
54
  };
55
+
56
+ export { createEventManager };
47
57
  //# sourceMappingURL=events.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.mjs","sources":["../../../src/services/document-service/events.ts"],"sourcesContent":["import { UID, Utils, Modules, Core } from '@strapi/types';\nimport { sanitize } from '@strapi/utils';\n\nimport { getDeepPopulate } from './utils/populate';\n\nconst EVENTS = {\n ENTRY_CREATE: 'entry.create',\n ENTRY_UPDATE: 'entry.update',\n ENTRY_DELETE: 'entry.delete',\n ENTRY_PUBLISH: 'entry.publish',\n ENTRY_UNPUBLISH: 'entry.unpublish',\n ENTRY_DRAFT_DISCARD: 'entry.draft-discard',\n};\n\ntype EventName = Utils.Object.Values<typeof EVENTS>;\n\n/**\n * Manager to trigger entry related events\n *\n * It will populate the entry if it is not a delete event.\n * So the event payload will contain the full entry.\n */\nconst createEventManager = (strapi: Core.Strapi, uid: UID.Schema) => {\n const populate = getDeepPopulate(uid, {});\n const model = strapi.getModel(uid);\n\n const emitEvent = async (eventName: EventName, entry: Modules.Documents.AnyDocument) => {\n // There is no need to populate the entry if it has been deleted\n let populatedEntry = entry;\n if (![EVENTS.ENTRY_DELETE, EVENTS.ENTRY_UNPUBLISH].includes(eventName)) {\n populatedEntry = await strapi.db.query(uid).findOne({ where: { id: entry.id }, populate });\n }\n\n const sanitizedEntry = await sanitize.sanitizers.defaultSanitizeOutput(\n {\n schema: model,\n getModel: (uid) => strapi.getModel(uid as UID.Schema),\n },\n populatedEntry\n );\n\n await strapi.eventHub.emit(eventName, {\n model: model.modelName,\n uid: model.uid,\n entry: sanitizedEntry,\n });\n };\n\n return {\n /**\n * strapi.db.query might reuse the transaction used in the doc service request,\n * so this is executed after that transaction is committed.\n */\n emitEvent(eventName: EventName, entry: Modules.Documents.AnyDocument) {\n strapi.db.transaction(({ onCommit }) => {\n onCommit(() => emitEvent(eventName, entry));\n });\n },\n };\n};\n\nexport { createEventManager };\n"],"names":["uid"],"mappings":";;AAKA,MAAM,SAAS;AAAA,EACb,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA,EACd,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,qBAAqB;AACvB;AAUM,MAAA,qBAAqB,CAAC,QAAqB,QAAoB;AACnE,QAAM,WAAW,gBAAgB,KAAK,CAAE,CAAA;AAClC,QAAA,QAAQ,OAAO,SAAS,GAAG;AAE3B,QAAA,YAAY,OAAO,WAAsB,UAAyC;AAEtF,QAAI,iBAAiB;AACjB,QAAA,CAAC,CAAC,OAAO,cAAc,OAAO,eAAe,EAAE,SAAS,SAAS,GAAG;AACtE,uBAAiB,MAAM,OAAO,GAAG,MAAM,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,MAAM,GAAG,GAAG,SAAU,CAAA;AAAA,IAC3F;AAEM,UAAA,iBAAiB,MAAM,SAAS,WAAW;AAAA,MAC/C;AAAA,QACE,QAAQ;AAAA,QACR,UAAU,CAACA,SAAQ,OAAO,SAASA,IAAiB;AAAA,MACtD;AAAA,MACA;AAAA,IAAA;AAGI,UAAA,OAAO,SAAS,KAAK,WAAW;AAAA,MACpC,OAAO,MAAM;AAAA,MACb,KAAK,MAAM;AAAA,MACX,OAAO;AAAA,IAAA,CACR;AAAA,EAAA;AAGI,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,UAAU,WAAsB,OAAsC;AACpE,aAAO,GAAG,YAAY,CAAC,EAAE,eAAe;AACtC,iBAAS,MAAM,UAAU,WAAW,KAAK,CAAC;AAAA,MAAA,CAC3C;AAAA,IACH;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"events.mjs","sources":["../../../src/services/document-service/events.ts"],"sourcesContent":["import type { UID, Utils, Modules, Core } from '@strapi/types';\nimport { sanitize } from '@strapi/utils';\n\nimport { getDeepPopulate } from './utils/populate';\n\nconst EVENTS = {\n ENTRY_CREATE: 'entry.create',\n ENTRY_UPDATE: 'entry.update',\n ENTRY_DELETE: 'entry.delete',\n ENTRY_PUBLISH: 'entry.publish',\n ENTRY_UNPUBLISH: 'entry.unpublish',\n ENTRY_DRAFT_DISCARD: 'entry.draft-discard',\n};\n\ntype EventName = Utils.Object.Values<typeof EVENTS>;\n\n/**\n * Manager to trigger entry related events\n *\n * It will populate the entry if it is not a delete event.\n * So the event payload will contain the full entry.\n */\nconst createEventManager = (strapi: Core.Strapi, uid: UID.Schema) => {\n const populate = getDeepPopulate(uid, {});\n const model = strapi.getModel(uid);\n\n const emitEvent = async (eventName: EventName, entry: Modules.Documents.AnyDocument) => {\n // There is no need to populate the entry if it has been deleted\n let populatedEntry = entry;\n if (![EVENTS.ENTRY_DELETE, EVENTS.ENTRY_UNPUBLISH].includes(eventName)) {\n populatedEntry = await strapi.db.query(uid).findOne({ where: { id: entry.id }, populate });\n }\n\n const sanitizedEntry = await sanitize.sanitizers.defaultSanitizeOutput(\n {\n schema: model,\n getModel: (uid) => strapi.getModel(uid as UID.Schema),\n },\n populatedEntry\n );\n\n await strapi.eventHub.emit(eventName, {\n model: model.modelName,\n uid: model.uid,\n entry: sanitizedEntry,\n });\n };\n\n return {\n /**\n * strapi.db.query might reuse the transaction used in the doc service request,\n * so this is executed after that transaction is committed.\n */\n emitEvent(eventName: EventName, entry: Modules.Documents.AnyDocument) {\n strapi.db.transaction(({ onCommit }) => {\n onCommit(() => emitEvent(eventName, entry));\n });\n },\n };\n};\n\nexport { createEventManager };\n"],"names":["EVENTS","ENTRY_CREATE","ENTRY_UPDATE","ENTRY_DELETE","ENTRY_PUBLISH","ENTRY_UNPUBLISH","ENTRY_DRAFT_DISCARD","createEventManager","strapi","uid","populate","getDeepPopulate","model","getModel","emitEvent","eventName","entry","populatedEntry","includes","db","query","findOne","where","id","sanitizedEntry","sanitize","sanitizers","defaultSanitizeOutput","schema","eventHub","emit","modelName","transaction","onCommit"],"mappings":";;;AAKA,MAAMA,MAAS,GAAA;IACbC,YAAc,EAAA,cAAA;IACdC,YAAc,EAAA,cAAA;IACdC,YAAc,EAAA,cAAA;IACdC,aAAe,EAAA,eAAA;IACfC,eAAiB,EAAA,iBAAA;IACjBC,mBAAqB,EAAA;AACvB,CAAA;AAIA;;;;;IAMA,MAAMC,kBAAqB,GAAA,CAACC,MAAqBC,EAAAA,GAAAA,GAAAA;IAC/C,MAAMC,QAAAA,GAAWC,eAAgBF,CAAAA,GAAAA,EAAK,EAAC,CAAA;IACvC,MAAMG,KAAAA,GAAQJ,MAAOK,CAAAA,QAAQ,CAACJ,GAAAA,CAAAA;IAE9B,MAAMK,SAAAA,GAAY,OAAOC,SAAsBC,EAAAA,KAAAA,GAAAA;;AAE7C,QAAA,IAAIC,cAAiBD,GAAAA,KAAAA;AACrB,QAAA,IAAI,CAAC;AAAChB,YAAAA,MAAAA,CAAOG,YAAY;AAAEH,YAAAA,MAAAA,CAAOK;SAAgB,CAACa,QAAQ,CAACH,SAAY,CAAA,EAAA;YACtEE,cAAiB,GAAA,MAAMT,OAAOW,EAAE,CAACC,KAAK,CAACX,GAAAA,CAAAA,CAAKY,OAAO,CAAC;gBAAEC,KAAO,EAAA;AAAEC,oBAAAA,EAAAA,EAAIP,MAAMO;AAAG,iBAAA;AAAGb,gBAAAA;AAAS,aAAA,CAAA;AAC1F;AAEA,QAAA,MAAMc,iBAAiB,MAAMC,QAAAA,CAASC,UAAU,CAACC,qBAAqB,CACpE;YACEC,MAAQhB,EAAAA,KAAAA;AACRC,YAAAA,QAAAA,EAAU,CAACJ,GAAAA,GAAQD,MAAOK,CAAAA,QAAQ,CAACJ,GAAAA;SAErCQ,EAAAA,cAAAA,CAAAA;AAGF,QAAA,MAAMT,MAAOqB,CAAAA,QAAQ,CAACC,IAAI,CAACf,SAAW,EAAA;AACpCH,YAAAA,KAAAA,EAAOA,MAAMmB,SAAS;AACtBtB,YAAAA,GAAAA,EAAKG,MAAMH,GAAG;YACdO,KAAOQ,EAAAA;AACT,SAAA,CAAA;AACF,KAAA;IAEA,OAAO;AACL;;;QAIAV,SAAAA,CAAAA,CAAUC,SAAoB,EAAEC,KAAoC,EAAA;AAClER,YAAAA,MAAAA,CAAOW,EAAE,CAACa,WAAW,CAAC,CAAC,EAAEC,QAAQ,EAAE,GAAA;gBACjCA,QAAS,CAAA,IAAMnB,UAAUC,SAAWC,EAAAA,KAAAA,CAAAA,CAAAA;AACtC,aAAA,CAAA;AACF;AACF,KAAA;AACF;;;;"}
@@ -6,6 +6,7 @@ import type { Core, Modules } from '@strapi/types';
6
6
  * - Apply default parameters to document actions
7
7
  *
8
8
  * @param strapi
9
+ * @param validator - validator for database entries
9
10
  * @returns DocumentService
10
11
  *
11
12
  * @example Access documents
@@ -13,5 +14,5 @@ import type { Core, Modules } from '@strapi/types';
13
14
  * const allArticles = strapi.documents('api::article.article').findMany(params)
14
15
  *
15
16
  */
16
- export declare const createDocumentService: (strapi: Core.Strapi) => Modules.Documents.Service;
17
+ export declare const createDocumentService: (strapi: Core.Strapi, validator?: Modules.EntityValidator.EntityValidator) => Modules.Documents.Service;
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAO,MAAM,eAAe,CAAC;AAMxD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,WAAY,KAAK,MAAM,KAAG,QAAQ,SAAS,CAAC,OAmC7E,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAO,MAAM,eAAe,CAAC;AAQxD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,WACxB,KAAK,MAAM,cACR,QAAQ,eAAe,CAAC,eAAe,KACjD,QAAQ,SAAS,CAAC,OAmCpB,CAAC"}
@@ -1,35 +1,56 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const errors = require("./middlewares/errors.js");
4
- const middlewareManager = require("./middlewares/middleware-manager.js");
5
- const repository = require("./repository.js");
6
- const data = require("./transform/data.js");
7
- const createDocumentService = (strapi) => {
8
- const repositories = /* @__PURE__ */ new Map();
9
- const middlewares = middlewareManager.createMiddlewareManager();
10
- middlewares.use(errors.databaseErrorsMiddleware);
11
- const factory = function factory2(uid) {
12
- if (repositories.has(uid)) {
13
- return repositories.get(uid);
14
- }
15
- const contentType = strapi.contentType(uid);
16
- const repository$1 = repository.createContentTypeRepository(uid);
17
- const instance = middlewares.wrapObject(
18
- repository$1,
19
- { uid, contentType },
20
- {
21
- exclude: ["updateComponents", "omitComponentData"]
22
- }
23
- );
24
- repositories.set(uid, instance);
25
- return instance;
26
- };
27
- return Object.assign(factory, {
28
- utils: {
29
- transformData: data.transformData
30
- },
31
- use: middlewares.use.bind(middlewares)
32
- });
1
+ 'use strict';
2
+
3
+ var errors = require('./middlewares/errors.js');
4
+ var middlewareManager = require('./middlewares/middleware-manager.js');
5
+ var repository = require('./repository.js');
6
+ var data = require('./transform/data.js');
7
+ var index = require('../entity-validator/index.js');
8
+
9
+ /**
10
+ * Repository to :
11
+ * - Access documents via actions (findMany, findOne, create, update, delete, ...)
12
+ * - Execute middlewares on document actions
13
+ * - Apply default parameters to document actions
14
+ *
15
+ * @param strapi
16
+ * @param validator - validator for database entries
17
+ * @returns DocumentService
18
+ *
19
+ * @example Access documents
20
+ * const article = strapi.documents('api::article.article').create(params)
21
+ * const allArticles = strapi.documents('api::article.article').findMany(params)
22
+ *
23
+ */ const createDocumentService = (strapi, validator = index)=>{
24
+ // Cache the repositories (one per content type)
25
+ const repositories = new Map();
26
+ // Manager to handle document service middlewares
27
+ const middlewares = middlewareManager.createMiddlewareManager();
28
+ middlewares.use(errors.databaseErrorsMiddleware);
29
+ const factory = function factory(uid) {
30
+ if (repositories.has(uid)) {
31
+ return repositories.get(uid);
32
+ }
33
+ const contentType = strapi.contentType(uid);
34
+ const repository$1 = repository.createContentTypeRepository(uid, validator);
35
+ const instance = middlewares.wrapObject(repository$1, {
36
+ uid,
37
+ contentType
38
+ }, {
39
+ exclude: [
40
+ 'updateComponents',
41
+ 'omitComponentData'
42
+ ]
43
+ });
44
+ repositories.set(uid, instance);
45
+ return instance;
46
+ };
47
+ return Object.assign(factory, {
48
+ utils: {
49
+ transformData: data.transformData
50
+ },
51
+ use: middlewares.use.bind(middlewares)
52
+ });
33
53
  };
54
+
34
55
  exports.createDocumentService = createDocumentService;
35
56
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/services/document-service/index.ts"],"sourcesContent":["import type { Core, Modules, UID } from '@strapi/types';\n\nimport { createMiddlewareManager, databaseErrorsMiddleware } from './middlewares';\nimport { createContentTypeRepository } from './repository';\nimport { transformData } from './transform/data';\n\n/**\n * Repository to :\n * - Access documents via actions (findMany, findOne, create, update, delete, ...)\n * - Execute middlewares on document actions\n * - Apply default parameters to document actions\n *\n * @param strapi\n * @returns DocumentService\n *\n * @example Access documents\n * const article = strapi.documents('api::article.article').create(params)\n * const allArticles = strapi.documents('api::article.article').findMany(params)\n *\n */\nexport const createDocumentService = (strapi: Core.Strapi): Modules.Documents.Service => {\n // Cache the repositories (one per content type)\n const repositories = new Map<string, Modules.Documents.ServiceInstance>();\n\n // Manager to handle document service middlewares\n const middlewares = createMiddlewareManager();\n middlewares.use(databaseErrorsMiddleware);\n\n const factory = function factory(uid: UID.ContentType) {\n if (repositories.has(uid)) {\n return repositories.get(uid)!;\n }\n\n const contentType = strapi.contentType(uid);\n const repository = createContentTypeRepository(uid);\n\n const instance = middlewares.wrapObject(\n repository,\n { uid, contentType },\n {\n exclude: ['updateComponents', 'omitComponentData'],\n }\n );\n\n repositories.set(uid, instance);\n\n return instance;\n } as Modules.Documents.Service;\n\n return Object.assign(factory, {\n utils: {\n transformData,\n },\n use: middlewares.use.bind(middlewares),\n });\n};\n"],"names":["createMiddlewareManager","databaseErrorsMiddleware","factory","repository","createContentTypeRepository","transformData"],"mappings":";;;;;;AAoBa,MAAA,wBAAwB,CAAC,WAAmD;AAEjF,QAAA,mCAAmB;AAGzB,QAAM,cAAcA,kBAAAA;AACpB,cAAY,IAAIC,OAAAA,wBAAwB;AAElC,QAAA,UAAU,SAASC,SAAQ,KAAsB;AACjD,QAAA,aAAa,IAAI,GAAG,GAAG;AAClB,aAAA,aAAa,IAAI,GAAG;AAAA,IAC7B;AAEM,UAAA,cAAc,OAAO,YAAY,GAAG;AACpC,UAAAC,eAAaC,uCAA4B,GAAG;AAElD,UAAM,WAAW,YAAY;AAAA,MAC3BD;AAAAA,MACA,EAAE,KAAK,YAAY;AAAA,MACnB;AAAA,QACE,SAAS,CAAC,oBAAoB,mBAAmB;AAAA,MACnD;AAAA,IAAA;AAGW,iBAAA,IAAI,KAAK,QAAQ;AAEvB,WAAA;AAAA,EAAA;AAGF,SAAA,OAAO,OAAO,SAAS;AAAA,IAC5B,OAAO;AAAA,MAAA,eACLE,KAAA;AAAA,IACF;AAAA,IACA,KAAK,YAAY,IAAI,KAAK,WAAW;AAAA,EAAA,CACtC;AACH;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/services/document-service/index.ts"],"sourcesContent":["import type { Core, Modules, UID } from '@strapi/types';\n\nimport { createMiddlewareManager, databaseErrorsMiddleware } from './middlewares';\nimport { createContentTypeRepository } from './repository';\nimport { transformData } from './transform/data';\n\nimport entityValidator from '../entity-validator';\n\n/**\n * Repository to :\n * - Access documents via actions (findMany, findOne, create, update, delete, ...)\n * - Execute middlewares on document actions\n * - Apply default parameters to document actions\n *\n * @param strapi\n * @param validator - validator for database entries\n * @returns DocumentService\n *\n * @example Access documents\n * const article = strapi.documents('api::article.article').create(params)\n * const allArticles = strapi.documents('api::article.article').findMany(params)\n *\n */\nexport const createDocumentService = (\n strapi: Core.Strapi,\n validator: Modules.EntityValidator.EntityValidator = entityValidator\n): Modules.Documents.Service => {\n // Cache the repositories (one per content type)\n const repositories = new Map<string, Modules.Documents.ServiceInstance>();\n\n // Manager to handle document service middlewares\n const middlewares = createMiddlewareManager();\n middlewares.use(databaseErrorsMiddleware);\n\n const factory = function factory(uid: UID.ContentType) {\n if (repositories.has(uid)) {\n return repositories.get(uid)!;\n }\n\n const contentType = strapi.contentType(uid);\n const repository = createContentTypeRepository(uid, validator);\n\n const instance = middlewares.wrapObject(\n repository,\n { uid, contentType },\n {\n exclude: ['updateComponents', 'omitComponentData'],\n }\n );\n\n repositories.set(uid, instance);\n\n return instance;\n } as Modules.Documents.Service;\n\n return Object.assign(factory, {\n utils: {\n transformData,\n },\n use: middlewares.use.bind(middlewares),\n });\n};\n"],"names":["createDocumentService","strapi","validator","entityValidator","repositories","Map","middlewares","createMiddlewareManager","use","databaseErrorsMiddleware","factory","uid","has","get","contentType","repository","createContentTypeRepository","instance","wrapObject","exclude","set","Object","assign","utils","transformData","bind"],"mappings":";;;;;;;;AAQA;;;;;;;;;;;;;;AAcC,IACYA,MAAAA,qBAAAA,GAAwB,CACnCC,MAAAA,EACAC,YAAqDC,KAAe,GAAA;;AAGpE,IAAA,MAAMC,eAAe,IAAIC,GAAAA,EAAAA;;AAGzB,IAAA,MAAMC,WAAcC,GAAAA,yCAAAA,EAAAA;AACpBD,IAAAA,WAAAA,CAAYE,GAAG,CAACC,+BAAAA,CAAAA;IAEhB,MAAMC,OAAAA,GAAU,SAASA,OAAAA,CAAQC,GAAoB,EAAA;QACnD,IAAIP,YAAAA,CAAaQ,GAAG,CAACD,GAAM,CAAA,EAAA;YACzB,OAAOP,YAAAA,CAAaS,GAAG,CAACF,GAAAA,CAAAA;AAC1B;QAEA,MAAMG,WAAAA,GAAcb,MAAOa,CAAAA,WAAW,CAACH,GAAAA,CAAAA;QACvC,MAAMI,YAAAA,GAAaC,uCAA4BL,GAAKT,EAAAA,SAAAA,CAAAA;AAEpD,QAAA,MAAMe,QAAWX,GAAAA,WAAAA,CAAYY,UAAU,CACrCH,YACA,EAAA;AAAEJ,YAAAA,GAAAA;AAAKG,YAAAA;SACP,EAAA;YACEK,OAAS,EAAA;AAAC,gBAAA,kBAAA;AAAoB,gBAAA;AAAoB;AACpD,SAAA,CAAA;QAGFf,YAAagB,CAAAA,GAAG,CAACT,GAAKM,EAAAA,QAAAA,CAAAA;QAEtB,OAAOA,QAAAA;AACT,KAAA;IAEA,OAAOI,MAAAA,CAAOC,MAAM,CAACZ,OAAS,EAAA;QAC5Ba,KAAO,EAAA;AACLC,2BAAAA;AACF,SAAA;AACAhB,QAAAA,GAAAA,EAAKF,WAAYE,CAAAA,GAAG,CAACiB,IAAI,CAACnB,WAAAA;AAC5B,KAAA,CAAA;AACF;;;;"}
@@ -1,35 +1,54 @@
1
- import { databaseErrorsMiddleware } from "./middlewares/errors.mjs";
2
- import { createMiddlewareManager } from "./middlewares/middleware-manager.mjs";
3
- import { createContentTypeRepository } from "./repository.mjs";
4
- import { transformData } from "./transform/data.mjs";
5
- const createDocumentService = (strapi) => {
6
- const repositories = /* @__PURE__ */ new Map();
7
- const middlewares = createMiddlewareManager();
8
- middlewares.use(databaseErrorsMiddleware);
9
- const factory = function factory2(uid) {
10
- if (repositories.has(uid)) {
11
- return repositories.get(uid);
12
- }
13
- const contentType = strapi.contentType(uid);
14
- const repository = createContentTypeRepository(uid);
15
- const instance = middlewares.wrapObject(
16
- repository,
17
- { uid, contentType },
18
- {
19
- exclude: ["updateComponents", "omitComponentData"]
20
- }
21
- );
22
- repositories.set(uid, instance);
23
- return instance;
24
- };
25
- return Object.assign(factory, {
26
- utils: {
27
- transformData
28
- },
29
- use: middlewares.use.bind(middlewares)
30
- });
31
- };
32
- export {
33
- createDocumentService
1
+ import { databaseErrorsMiddleware } from './middlewares/errors.mjs';
2
+ import { createMiddlewareManager } from './middlewares/middleware-manager.mjs';
3
+ import { createContentTypeRepository } from './repository.mjs';
4
+ import { transformData } from './transform/data.mjs';
5
+ import entityValidator from '../entity-validator/index.mjs';
6
+
7
+ /**
8
+ * Repository to :
9
+ * - Access documents via actions (findMany, findOne, create, update, delete, ...)
10
+ * - Execute middlewares on document actions
11
+ * - Apply default parameters to document actions
12
+ *
13
+ * @param strapi
14
+ * @param validator - validator for database entries
15
+ * @returns DocumentService
16
+ *
17
+ * @example Access documents
18
+ * const article = strapi.documents('api::article.article').create(params)
19
+ * const allArticles = strapi.documents('api::article.article').findMany(params)
20
+ *
21
+ */ const createDocumentService = (strapi, validator = entityValidator)=>{
22
+ // Cache the repositories (one per content type)
23
+ const repositories = new Map();
24
+ // Manager to handle document service middlewares
25
+ const middlewares = createMiddlewareManager();
26
+ middlewares.use(databaseErrorsMiddleware);
27
+ const factory = function factory(uid) {
28
+ if (repositories.has(uid)) {
29
+ return repositories.get(uid);
30
+ }
31
+ const contentType = strapi.contentType(uid);
32
+ const repository = createContentTypeRepository(uid, validator);
33
+ const instance = middlewares.wrapObject(repository, {
34
+ uid,
35
+ contentType
36
+ }, {
37
+ exclude: [
38
+ 'updateComponents',
39
+ 'omitComponentData'
40
+ ]
41
+ });
42
+ repositories.set(uid, instance);
43
+ return instance;
44
+ };
45
+ return Object.assign(factory, {
46
+ utils: {
47
+ transformData
48
+ },
49
+ use: middlewares.use.bind(middlewares)
50
+ });
34
51
  };
52
+
53
+ export { createDocumentService };
35
54
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/services/document-service/index.ts"],"sourcesContent":["import type { Core, Modules, UID } from '@strapi/types';\n\nimport { createMiddlewareManager, databaseErrorsMiddleware } from './middlewares';\nimport { createContentTypeRepository } from './repository';\nimport { transformData } from './transform/data';\n\n/**\n * Repository to :\n * - Access documents via actions (findMany, findOne, create, update, delete, ...)\n * - Execute middlewares on document actions\n * - Apply default parameters to document actions\n *\n * @param strapi\n * @returns DocumentService\n *\n * @example Access documents\n * const article = strapi.documents('api::article.article').create(params)\n * const allArticles = strapi.documents('api::article.article').findMany(params)\n *\n */\nexport const createDocumentService = (strapi: Core.Strapi): Modules.Documents.Service => {\n // Cache the repositories (one per content type)\n const repositories = new Map<string, Modules.Documents.ServiceInstance>();\n\n // Manager to handle document service middlewares\n const middlewares = createMiddlewareManager();\n middlewares.use(databaseErrorsMiddleware);\n\n const factory = function factory(uid: UID.ContentType) {\n if (repositories.has(uid)) {\n return repositories.get(uid)!;\n }\n\n const contentType = strapi.contentType(uid);\n const repository = createContentTypeRepository(uid);\n\n const instance = middlewares.wrapObject(\n repository,\n { uid, contentType },\n {\n exclude: ['updateComponents', 'omitComponentData'],\n }\n );\n\n repositories.set(uid, instance);\n\n return instance;\n } as Modules.Documents.Service;\n\n return Object.assign(factory, {\n utils: {\n transformData,\n },\n use: middlewares.use.bind(middlewares),\n });\n};\n"],"names":["factory"],"mappings":";;;;AAoBa,MAAA,wBAAwB,CAAC,WAAmD;AAEjF,QAAA,mCAAmB;AAGzB,QAAM,cAAc;AACpB,cAAY,IAAI,wBAAwB;AAElC,QAAA,UAAU,SAASA,SAAQ,KAAsB;AACjD,QAAA,aAAa,IAAI,GAAG,GAAG;AAClB,aAAA,aAAa,IAAI,GAAG;AAAA,IAC7B;AAEM,UAAA,cAAc,OAAO,YAAY,GAAG;AACpC,UAAA,aAAa,4BAA4B,GAAG;AAElD,UAAM,WAAW,YAAY;AAAA,MAC3B;AAAA,MACA,EAAE,KAAK,YAAY;AAAA,MACnB;AAAA,QACE,SAAS,CAAC,oBAAoB,mBAAmB;AAAA,MACnD;AAAA,IAAA;AAGW,iBAAA,IAAI,KAAK,QAAQ;AAEvB,WAAA;AAAA,EAAA;AAGF,SAAA,OAAO,OAAO,SAAS;AAAA,IAC5B,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,KAAK,YAAY,IAAI,KAAK,WAAW;AAAA,EAAA,CACtC;AACH;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/services/document-service/index.ts"],"sourcesContent":["import type { Core, Modules, UID } from '@strapi/types';\n\nimport { createMiddlewareManager, databaseErrorsMiddleware } from './middlewares';\nimport { createContentTypeRepository } from './repository';\nimport { transformData } from './transform/data';\n\nimport entityValidator from '../entity-validator';\n\n/**\n * Repository to :\n * - Access documents via actions (findMany, findOne, create, update, delete, ...)\n * - Execute middlewares on document actions\n * - Apply default parameters to document actions\n *\n * @param strapi\n * @param validator - validator for database entries\n * @returns DocumentService\n *\n * @example Access documents\n * const article = strapi.documents('api::article.article').create(params)\n * const allArticles = strapi.documents('api::article.article').findMany(params)\n *\n */\nexport const createDocumentService = (\n strapi: Core.Strapi,\n validator: Modules.EntityValidator.EntityValidator = entityValidator\n): Modules.Documents.Service => {\n // Cache the repositories (one per content type)\n const repositories = new Map<string, Modules.Documents.ServiceInstance>();\n\n // Manager to handle document service middlewares\n const middlewares = createMiddlewareManager();\n middlewares.use(databaseErrorsMiddleware);\n\n const factory = function factory(uid: UID.ContentType) {\n if (repositories.has(uid)) {\n return repositories.get(uid)!;\n }\n\n const contentType = strapi.contentType(uid);\n const repository = createContentTypeRepository(uid, validator);\n\n const instance = middlewares.wrapObject(\n repository,\n { uid, contentType },\n {\n exclude: ['updateComponents', 'omitComponentData'],\n }\n );\n\n repositories.set(uid, instance);\n\n return instance;\n } as Modules.Documents.Service;\n\n return Object.assign(factory, {\n utils: {\n transformData,\n },\n use: middlewares.use.bind(middlewares),\n });\n};\n"],"names":["createDocumentService","strapi","validator","entityValidator","repositories","Map","middlewares","createMiddlewareManager","use","databaseErrorsMiddleware","factory","uid","has","get","contentType","repository","createContentTypeRepository","instance","wrapObject","exclude","set","Object","assign","utils","transformData","bind"],"mappings":";;;;;;AAQA;;;;;;;;;;;;;;AAcC,IACYA,MAAAA,qBAAAA,GAAwB,CACnCC,MAAAA,EACAC,YAAqDC,eAAe,GAAA;;AAGpE,IAAA,MAAMC,eAAe,IAAIC,GAAAA,EAAAA;;AAGzB,IAAA,MAAMC,WAAcC,GAAAA,uBAAAA,EAAAA;AACpBD,IAAAA,WAAAA,CAAYE,GAAG,CAACC,wBAAAA,CAAAA;IAEhB,MAAMC,OAAAA,GAAU,SAASA,OAAAA,CAAQC,GAAoB,EAAA;QACnD,IAAIP,YAAAA,CAAaQ,GAAG,CAACD,GAAM,CAAA,EAAA;YACzB,OAAOP,YAAAA,CAAaS,GAAG,CAACF,GAAAA,CAAAA;AAC1B;QAEA,MAAMG,WAAAA,GAAcb,MAAOa,CAAAA,WAAW,CAACH,GAAAA,CAAAA;QACvC,MAAMI,UAAAA,GAAaC,4BAA4BL,GAAKT,EAAAA,SAAAA,CAAAA;AAEpD,QAAA,MAAMe,QAAWX,GAAAA,WAAAA,CAAYY,UAAU,CACrCH,UACA,EAAA;AAAEJ,YAAAA,GAAAA;AAAKG,YAAAA;SACP,EAAA;YACEK,OAAS,EAAA;AAAC,gBAAA,kBAAA;AAAoB,gBAAA;AAAoB;AACpD,SAAA,CAAA;QAGFf,YAAagB,CAAAA,GAAG,CAACT,GAAKM,EAAAA,QAAAA,CAAAA;QAEtB,OAAOA,QAAAA;AACT,KAAA;IAEA,OAAOI,MAAAA,CAAOC,MAAM,CAACZ,OAAS,EAAA;QAC5Ba,KAAO,EAAA;AACLC,YAAAA;AACF,SAAA;AACAhB,QAAAA,GAAAA,EAAKF,WAAYE,CAAAA,GAAG,CAACiB,IAAI,CAACnB,WAAAA;AAC5B,KAAA,CAAA;AACF;;;;"}
@@ -1,61 +1,77 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const strapiUtils = require("@strapi/utils");
4
- const fp = require("lodash/fp");
5
- const getDefaultLocale = async () => {
6
- return strapi.plugin("i18n").service("locales").getDefaultLocale();
1
+ 'use strict';
2
+
3
+ var strapiUtils = require('@strapi/utils');
4
+ var fp = require('lodash/fp');
5
+
6
+ const getDefaultLocale = async ()=>{
7
+ return strapi.plugin('i18n').service('locales').getDefaultLocale();
7
8
  };
8
- const defaultLocale = async (contentType, params) => {
9
- if (!strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
9
+ const defaultLocale = async (contentType, params)=>{
10
+ if (!strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)) {
11
+ return params;
12
+ }
13
+ if (!params.locale) {
14
+ return fp.assoc('locale', await getDefaultLocale(), params);
15
+ }
10
16
  return params;
11
- }
12
- if (!params.locale) {
13
- return fp.assoc("locale", await getDefaultLocale(), params);
14
- }
15
- return params;
16
17
  };
17
- const localeToLookup = (contentType, params) => {
18
- if (!params.locale || !strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
19
- return params;
20
- }
21
- if (typeof params.locale !== "string") {
22
- throw new strapiUtils.errors.ValidationError(
23
- `Invalid locale param ${String(params.locale)} provided. Document locales must be strings.`
24
- );
25
- }
26
- return fp.assoc(["lookup", "locale"], params.locale, params);
18
+ /**
19
+ * Add locale lookup query to the params
20
+ */ const localeToLookup = (contentType, params)=>{
21
+ if (!params.locale || !strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)) {
22
+ return params;
23
+ }
24
+ if (typeof params.locale !== 'string') {
25
+ // localeToLookup accepts locales of '*'. This is because the document
26
+ // service functions that use this transform work with the '*' locale
27
+ // to return all locales.
28
+ throw new strapiUtils.errors.ValidationError(`Invalid locale param ${String(params.locale)} provided. Document locales must be strings.`);
29
+ }
30
+ return fp.assoc([
31
+ 'lookup',
32
+ 'locale'
33
+ ], params.locale, params);
27
34
  };
28
- const multiLocaleToLookup = (contentType, params) => {
29
- if (!strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
35
+ /**
36
+ * Add locale lookup query to the params
37
+ */ const multiLocaleToLookup = (contentType, params)=>{
38
+ if (!strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)) {
39
+ return params;
40
+ }
41
+ if (params.locale) {
42
+ if (params.locale === '*') {
43
+ return params;
44
+ }
45
+ return fp.assoc([
46
+ 'lookup',
47
+ 'locale'
48
+ ], params.locale, params);
49
+ }
30
50
  return params;
31
- }
32
- if (params.locale) {
33
- if (params.locale === "*") {
34
- return params;
35
- }
36
- return fp.assoc(["lookup", "locale"], params.locale, params);
37
- }
38
- return params;
39
51
  };
40
- const localeToData = (contentType, params) => {
41
- if (!strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
52
+ /**
53
+ * Translate locale status parameter into the data that will be saved
54
+ */ const localeToData = (contentType, params)=>{
55
+ if (!strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)) {
56
+ return params;
57
+ }
58
+ if (params.locale) {
59
+ const isValidLocale = typeof params.locale === 'string' && params.locale !== '*';
60
+ if (isValidLocale) {
61
+ return fp.assoc([
62
+ 'data',
63
+ 'locale'
64
+ ], params.locale, params);
65
+ }
66
+ throw new strapiUtils.errors.ValidationError(`Invalid locale param ${params.locale} provided. Document locales must be strings.`);
67
+ }
42
68
  return params;
43
- }
44
- if (params.locale) {
45
- const isValidLocale = typeof params.locale === "string" && params.locale !== "*";
46
- if (isValidLocale) {
47
- return fp.assoc(["data", "locale"], params.locale, params);
48
- }
49
- throw new strapiUtils.errors.ValidationError(
50
- `Invalid locale param ${params.locale} provided. Document locales must be strings.`
51
- );
52
- }
53
- return params;
54
69
  };
55
70
  const defaultLocaleCurry = fp.curry(defaultLocale);
56
71
  const localeToLookupCurry = fp.curry(localeToLookup);
57
72
  const multiLocaleToLookupCurry = fp.curry(multiLocaleToLookup);
58
73
  const localeToDataCurry = fp.curry(localeToData);
74
+
59
75
  exports.defaultLocale = defaultLocaleCurry;
60
76
  exports.localeToData = localeToDataCurry;
61
77
  exports.localeToLookup = localeToLookupCurry;