@strapi/core 0.0.0-experimental.15989d13d8be058bf37afc84b7a8377ef1da3263 → 0.0.0-experimental.16a6ec52546a0c189b42121e51a744fd04fc0d65

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 (689) hide show
  1. package/dist/configuration/index.d.ts.map +1 -1
  2. package/dist/ee/index.d.ts +1 -0
  3. package/dist/ee/index.d.ts.map +1 -1
  4. package/dist/ee/license.d.ts.map +1 -1
  5. package/dist/index.js +10116 -27
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +10094 -29
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/middlewares/body.d.ts.map +1 -1
  10. package/dist/migrations/database/5.0.0-discard-drafts.d.ts +2 -2
  11. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -1
  12. package/dist/migrations/draft-publish.d.ts +1 -1
  13. package/dist/migrations/draft-publish.d.ts.map +1 -1
  14. package/dist/services/document-service/components.d.ts.map +1 -1
  15. package/dist/services/document-service/draft-and-publish.d.ts +1 -1
  16. package/dist/services/document-service/draft-and-publish.d.ts.map +1 -1
  17. package/dist/services/document-service/events.d.ts +1 -1
  18. package/dist/services/document-service/events.d.ts.map +1 -1
  19. package/dist/services/document-service/repository.d.ts.map +1 -1
  20. package/dist/services/document-service/transform/id-map.d.ts +1 -1
  21. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  22. package/dist/services/document-service/transform/id-transform.d.ts +1 -1
  23. package/dist/services/document-service/transform/id-transform.d.ts.map +1 -1
  24. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts +1 -1
  25. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts.map +1 -1
  26. package/dist/services/document-service/transform/relations/utils/dp.d.ts +1 -1
  27. package/dist/services/document-service/transform/relations/utils/dp.d.ts.map +1 -1
  28. package/dist/services/document-service/transform/relations/utils/i18n.d.ts +1 -1
  29. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  30. package/dist/services/document-service/utils/bidirectional-relations.d.ts +95 -0
  31. package/dist/services/document-service/utils/bidirectional-relations.d.ts.map +1 -0
  32. package/dist/services/document-service/utils/populate.d.ts +1 -1
  33. package/dist/services/document-service/utils/populate.d.ts.map +1 -1
  34. package/dist/services/document-service/utils/unidirectional-relations.d.ts +1 -1
  35. package/dist/services/document-service/utils/unidirectional-relations.d.ts.map +1 -1
  36. package/dist/services/entity-validator/index.d.ts +1 -1
  37. package/dist/services/entity-validator/index.d.ts.map +1 -1
  38. package/dist/services/metrics/middleware.d.ts.map +1 -1
  39. package/dist/services/metrics/rate-limiter.d.ts.map +1 -1
  40. package/dist/utils/update-notifier/index.d.ts.map +1 -1
  41. package/package.json +25 -26
  42. package/dist/Strapi.js +0 -437
  43. package/dist/Strapi.js.map +0 -1
  44. package/dist/Strapi.mjs +0 -416
  45. package/dist/Strapi.mjs.map +0 -1
  46. package/dist/compile.js +0 -18
  47. package/dist/compile.js.map +0 -1
  48. package/dist/compile.mjs +0 -17
  49. package/dist/compile.mjs.map +0 -1
  50. package/dist/configuration/config-loader.js +0 -105
  51. package/dist/configuration/config-loader.js.map +0 -1
  52. package/dist/configuration/config-loader.mjs +0 -103
  53. package/dist/configuration/config-loader.mjs.map +0 -1
  54. package/dist/configuration/get-dirs.js +0 -31
  55. package/dist/configuration/get-dirs.js.map +0 -1
  56. package/dist/configuration/get-dirs.mjs +0 -31
  57. package/dist/configuration/get-dirs.mjs.map +0 -1
  58. package/dist/configuration/index.js +0 -85
  59. package/dist/configuration/index.js.map +0 -1
  60. package/dist/configuration/index.mjs +0 -80
  61. package/dist/configuration/index.mjs.map +0 -1
  62. package/dist/configuration/urls.js +0 -68
  63. package/dist/configuration/urls.js.map +0 -1
  64. package/dist/configuration/urls.mjs +0 -66
  65. package/dist/configuration/urls.mjs.map +0 -1
  66. package/dist/container.js +0 -30
  67. package/dist/container.js.map +0 -1
  68. package/dist/container.mjs +0 -30
  69. package/dist/container.mjs.map +0 -1
  70. package/dist/core-api/controller/collection-type.js +0 -84
  71. package/dist/core-api/controller/collection-type.js.map +0 -1
  72. package/dist/core-api/controller/collection-type.mjs +0 -84
  73. package/dist/core-api/controller/collection-type.mjs.map +0 -1
  74. package/dist/core-api/controller/index.js +0 -52
  75. package/dist/core-api/controller/index.js.map +0 -1
  76. package/dist/core-api/controller/index.mjs +0 -52
  77. package/dist/core-api/controller/index.mjs.map +0 -1
  78. package/dist/core-api/controller/single-type.js +0 -46
  79. package/dist/core-api/controller/single-type.js.map +0 -1
  80. package/dist/core-api/controller/single-type.mjs +0 -46
  81. package/dist/core-api/controller/single-type.mjs.map +0 -1
  82. package/dist/core-api/controller/transform.js +0 -76
  83. package/dist/core-api/controller/transform.js.map +0 -1
  84. package/dist/core-api/controller/transform.mjs +0 -76
  85. package/dist/core-api/controller/transform.mjs.map +0 -1
  86. package/dist/core-api/routes/index.js +0 -67
  87. package/dist/core-api/routes/index.js.map +0 -1
  88. package/dist/core-api/routes/index.mjs +0 -67
  89. package/dist/core-api/routes/index.mjs.map +0 -1
  90. package/dist/core-api/service/collection-type.js +0 -67
  91. package/dist/core-api/service/collection-type.js.map +0 -1
  92. package/dist/core-api/service/collection-type.mjs +0 -67
  93. package/dist/core-api/service/collection-type.mjs.map +0 -1
  94. package/dist/core-api/service/core-service.js +0 -12
  95. package/dist/core-api/service/core-service.js.map +0 -1
  96. package/dist/core-api/service/core-service.mjs +0 -12
  97. package/dist/core-api/service/core-service.mjs.map +0 -1
  98. package/dist/core-api/service/index.js +0 -16
  99. package/dist/core-api/service/index.js.map +0 -1
  100. package/dist/core-api/service/index.mjs +0 -16
  101. package/dist/core-api/service/index.mjs.map +0 -1
  102. package/dist/core-api/service/pagination.js +0 -52
  103. package/dist/core-api/service/pagination.js.map +0 -1
  104. package/dist/core-api/service/pagination.mjs +0 -52
  105. package/dist/core-api/service/pagination.mjs.map +0 -1
  106. package/dist/core-api/service/single-type.js +0 -45
  107. package/dist/core-api/service/single-type.js.map +0 -1
  108. package/dist/core-api/service/single-type.mjs +0 -45
  109. package/dist/core-api/service/single-type.mjs.map +0 -1
  110. package/dist/domain/content-type/index.js +0 -111
  111. package/dist/domain/content-type/index.js.map +0 -1
  112. package/dist/domain/content-type/index.mjs +0 -109
  113. package/dist/domain/content-type/index.mjs.map +0 -1
  114. package/dist/domain/content-type/validator.js +0 -77
  115. package/dist/domain/content-type/validator.js.map +0 -1
  116. package/dist/domain/content-type/validator.mjs +0 -75
  117. package/dist/domain/content-type/validator.mjs.map +0 -1
  118. package/dist/domain/module/index.js +0 -107
  119. package/dist/domain/module/index.js.map +0 -1
  120. package/dist/domain/module/index.mjs +0 -105
  121. package/dist/domain/module/index.mjs.map +0 -1
  122. package/dist/domain/module/validation.js +0 -25
  123. package/dist/domain/module/validation.js.map +0 -1
  124. package/dist/domain/module/validation.mjs +0 -25
  125. package/dist/domain/module/validation.mjs.map +0 -1
  126. package/dist/ee/index.js +0 -158
  127. package/dist/ee/index.js.map +0 -1
  128. package/dist/ee/index.mjs +0 -159
  129. package/dist/ee/index.mjs.map +0 -1
  130. package/dist/ee/license.js +0 -91
  131. package/dist/ee/license.js.map +0 -1
  132. package/dist/ee/license.mjs +0 -88
  133. package/dist/ee/license.mjs.map +0 -1
  134. package/dist/factories.js +0 -80
  135. package/dist/factories.js.map +0 -1
  136. package/dist/factories.mjs +0 -80
  137. package/dist/factories.mjs.map +0 -1
  138. package/dist/loaders/admin.js +0 -26
  139. package/dist/loaders/admin.js.map +0 -1
  140. package/dist/loaders/admin.mjs +0 -25
  141. package/dist/loaders/admin.mjs.map +0 -1
  142. package/dist/loaders/apis.js +0 -137
  143. package/dist/loaders/apis.js.map +0 -1
  144. package/dist/loaders/apis.mjs +0 -135
  145. package/dist/loaders/apis.mjs.map +0 -1
  146. package/dist/loaders/components.js +0 -38
  147. package/dist/loaders/components.js.map +0 -1
  148. package/dist/loaders/components.mjs +0 -37
  149. package/dist/loaders/components.mjs.map +0 -1
  150. package/dist/loaders/index.js +0 -24
  151. package/dist/loaders/index.js.map +0 -1
  152. package/dist/loaders/index.mjs +0 -24
  153. package/dist/loaders/index.mjs.map +0 -1
  154. package/dist/loaders/middlewares.js +0 -31
  155. package/dist/loaders/middlewares.js.map +0 -1
  156. package/dist/loaders/middlewares.mjs +0 -30
  157. package/dist/loaders/middlewares.mjs.map +0 -1
  158. package/dist/loaders/plugins/get-enabled-plugins.js +0 -141
  159. package/dist/loaders/plugins/get-enabled-plugins.js.map +0 -1
  160. package/dist/loaders/plugins/get-enabled-plugins.mjs +0 -117
  161. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +0 -1
  162. package/dist/loaders/plugins/get-user-plugins-config.js +0 -27
  163. package/dist/loaders/plugins/get-user-plugins-config.js.map +0 -1
  164. package/dist/loaders/plugins/get-user-plugins-config.mjs +0 -25
  165. package/dist/loaders/plugins/get-user-plugins-config.mjs.map +0 -1
  166. package/dist/loaders/plugins/index.js +0 -144
  167. package/dist/loaders/plugins/index.js.map +0 -1
  168. package/dist/loaders/plugins/index.mjs +0 -125
  169. package/dist/loaders/plugins/index.mjs.map +0 -1
  170. package/dist/loaders/policies.js +0 -25
  171. package/dist/loaders/policies.js.map +0 -1
  172. package/dist/loaders/policies.mjs +0 -24
  173. package/dist/loaders/policies.mjs.map +0 -1
  174. package/dist/loaders/sanitizers.js +0 -6
  175. package/dist/loaders/sanitizers.js.map +0 -1
  176. package/dist/loaders/sanitizers.mjs +0 -7
  177. package/dist/loaders/sanitizers.mjs.map +0 -1
  178. package/dist/loaders/src-index.js +0 -33
  179. package/dist/loaders/src-index.js.map +0 -1
  180. package/dist/loaders/src-index.mjs +0 -34
  181. package/dist/loaders/src-index.mjs.map +0 -1
  182. package/dist/loaders/validators.js +0 -6
  183. package/dist/loaders/validators.js.map +0 -1
  184. package/dist/loaders/validators.mjs +0 -7
  185. package/dist/loaders/validators.mjs.map +0 -1
  186. package/dist/middlewares/body.js +0 -65
  187. package/dist/middlewares/body.js.map +0 -1
  188. package/dist/middlewares/body.mjs +0 -61
  189. package/dist/middlewares/body.mjs.map +0 -1
  190. package/dist/middlewares/compression.js +0 -8
  191. package/dist/middlewares/compression.js.map +0 -1
  192. package/dist/middlewares/compression.mjs +0 -6
  193. package/dist/middlewares/compression.mjs.map +0 -1
  194. package/dist/middlewares/cors.js +0 -53
  195. package/dist/middlewares/cors.js.map +0 -1
  196. package/dist/middlewares/cors.mjs +0 -51
  197. package/dist/middlewares/cors.mjs.map +0 -1
  198. package/dist/middlewares/errors.js +0 -33
  199. package/dist/middlewares/errors.js.map +0 -1
  200. package/dist/middlewares/errors.mjs +0 -33
  201. package/dist/middlewares/errors.mjs.map +0 -1
  202. package/dist/middlewares/favicon.js +0 -22
  203. package/dist/middlewares/favicon.js.map +0 -1
  204. package/dist/middlewares/favicon.mjs +0 -20
  205. package/dist/middlewares/favicon.mjs.map +0 -1
  206. package/dist/middlewares/index.js +0 -34
  207. package/dist/middlewares/index.js.map +0 -1
  208. package/dist/middlewares/index.mjs +0 -34
  209. package/dist/middlewares/index.mjs.map +0 -1
  210. package/dist/middlewares/ip.js +0 -8
  211. package/dist/middlewares/ip.js.map +0 -1
  212. package/dist/middlewares/ip.mjs +0 -6
  213. package/dist/middlewares/ip.mjs.map +0 -1
  214. package/dist/middlewares/logger.js +0 -12
  215. package/dist/middlewares/logger.js.map +0 -1
  216. package/dist/middlewares/logger.mjs +0 -12
  217. package/dist/middlewares/logger.mjs.map +0 -1
  218. package/dist/middlewares/powered-by.js +0 -14
  219. package/dist/middlewares/powered-by.js.map +0 -1
  220. package/dist/middlewares/powered-by.mjs +0 -14
  221. package/dist/middlewares/powered-by.mjs.map +0 -1
  222. package/dist/middlewares/public.js +0 -34
  223. package/dist/middlewares/public.js.map +0 -1
  224. package/dist/middlewares/public.mjs +0 -32
  225. package/dist/middlewares/public.mjs.map +0 -1
  226. package/dist/middlewares/query.js +0 -40
  227. package/dist/middlewares/query.js.map +0 -1
  228. package/dist/middlewares/query.mjs +0 -38
  229. package/dist/middlewares/query.mjs.map +0 -1
  230. package/dist/middlewares/response-time.js +0 -12
  231. package/dist/middlewares/response-time.js.map +0 -1
  232. package/dist/middlewares/response-time.mjs +0 -12
  233. package/dist/middlewares/response-time.mjs.map +0 -1
  234. package/dist/middlewares/responses.js +0 -15
  235. package/dist/middlewares/responses.js.map +0 -1
  236. package/dist/middlewares/responses.mjs +0 -15
  237. package/dist/middlewares/responses.mjs.map +0 -1
  238. package/dist/middlewares/security.js +0 -78
  239. package/dist/middlewares/security.js.map +0 -1
  240. package/dist/middlewares/security.mjs +0 -76
  241. package/dist/middlewares/security.mjs.map +0 -1
  242. package/dist/middlewares/session.js +0 -30
  243. package/dist/middlewares/session.js.map +0 -1
  244. package/dist/middlewares/session.mjs +0 -28
  245. package/dist/middlewares/session.mjs.map +0 -1
  246. package/dist/migrations/database/5.0.0-discard-drafts.js +0 -106
  247. package/dist/migrations/database/5.0.0-discard-drafts.js.map +0 -1
  248. package/dist/migrations/database/5.0.0-discard-drafts.mjs +0 -106
  249. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +0 -1
  250. package/dist/migrations/draft-publish.js +0 -42
  251. package/dist/migrations/draft-publish.js.map +0 -1
  252. package/dist/migrations/draft-publish.mjs +0 -42
  253. package/dist/migrations/draft-publish.mjs.map +0 -1
  254. package/dist/migrations/i18n.js +0 -54
  255. package/dist/migrations/i18n.js.map +0 -1
  256. package/dist/migrations/i18n.mjs +0 -54
  257. package/dist/migrations/i18n.mjs.map +0 -1
  258. package/dist/migrations/index.js +0 -15
  259. package/dist/migrations/index.js.map +0 -1
  260. package/dist/migrations/index.mjs +0 -15
  261. package/dist/migrations/index.mjs.map +0 -1
  262. package/dist/providers/admin.js +0 -20
  263. package/dist/providers/admin.js.map +0 -1
  264. package/dist/providers/admin.mjs +0 -21
  265. package/dist/providers/admin.mjs.map +0 -1
  266. package/dist/providers/coreStore.js +0 -11
  267. package/dist/providers/coreStore.js.map +0 -1
  268. package/dist/providers/coreStore.mjs +0 -12
  269. package/dist/providers/coreStore.mjs.map +0 -1
  270. package/dist/providers/cron.js +0 -20
  271. package/dist/providers/cron.js.map +0 -1
  272. package/dist/providers/cron.mjs +0 -21
  273. package/dist/providers/cron.mjs.map +0 -1
  274. package/dist/providers/index.js +0 -11
  275. package/dist/providers/index.js.map +0 -1
  276. package/dist/providers/index.mjs +0 -11
  277. package/dist/providers/index.mjs.map +0 -1
  278. package/dist/providers/provider.js +0 -5
  279. package/dist/providers/provider.js.map +0 -1
  280. package/dist/providers/provider.mjs +0 -5
  281. package/dist/providers/provider.mjs.map +0 -1
  282. package/dist/providers/registries.js +0 -35
  283. package/dist/providers/registries.js.map +0 -1
  284. package/dist/providers/registries.mjs +0 -36
  285. package/dist/providers/registries.mjs.map +0 -1
  286. package/dist/providers/telemetry.js +0 -19
  287. package/dist/providers/telemetry.js.map +0 -1
  288. package/dist/providers/telemetry.mjs +0 -20
  289. package/dist/providers/telemetry.mjs.map +0 -1
  290. package/dist/providers/webhooks.js +0 -30
  291. package/dist/providers/webhooks.js.map +0 -1
  292. package/dist/providers/webhooks.mjs +0 -31
  293. package/dist/providers/webhooks.mjs.map +0 -1
  294. package/dist/registries/apis.js +0 -23
  295. package/dist/registries/apis.js.map +0 -1
  296. package/dist/registries/apis.mjs +0 -24
  297. package/dist/registries/apis.mjs.map +0 -1
  298. package/dist/registries/components.js +0 -45
  299. package/dist/registries/components.js.map +0 -1
  300. package/dist/registries/components.mjs +0 -46
  301. package/dist/registries/components.mjs.map +0 -1
  302. package/dist/registries/content-types.js +0 -70
  303. package/dist/registries/content-types.js.map +0 -1
  304. package/dist/registries/content-types.mjs +0 -71
  305. package/dist/registries/content-types.mjs.map +0 -1
  306. package/dist/registries/controllers.js +0 -80
  307. package/dist/registries/controllers.js.map +0 -1
  308. package/dist/registries/controllers.mjs +0 -81
  309. package/dist/registries/controllers.mjs.map +0 -1
  310. package/dist/registries/custom-fields.js +0 -71
  311. package/dist/registries/custom-fields.js.map +0 -1
  312. package/dist/registries/custom-fields.mjs +0 -72
  313. package/dist/registries/custom-fields.mjs.map +0 -1
  314. package/dist/registries/hooks.js +0 -58
  315. package/dist/registries/hooks.js.map +0 -1
  316. package/dist/registries/hooks.mjs +0 -59
  317. package/dist/registries/hooks.mjs.map +0 -1
  318. package/dist/registries/middlewares.js +0 -60
  319. package/dist/registries/middlewares.js.map +0 -1
  320. package/dist/registries/middlewares.mjs +0 -61
  321. package/dist/registries/middlewares.mjs.map +0 -1
  322. package/dist/registries/models.js +0 -16
  323. package/dist/registries/models.js.map +0 -1
  324. package/dist/registries/models.mjs +0 -16
  325. package/dist/registries/models.mjs.map +0 -1
  326. package/dist/registries/modules.js +0 -39
  327. package/dist/registries/modules.js.map +0 -1
  328. package/dist/registries/modules.mjs +0 -40
  329. package/dist/registries/modules.mjs.map +0 -1
  330. package/dist/registries/namespace.js +0 -27
  331. package/dist/registries/namespace.js.map +0 -1
  332. package/dist/registries/namespace.mjs +0 -27
  333. package/dist/registries/namespace.mjs.map +0 -1
  334. package/dist/registries/plugins.js +0 -23
  335. package/dist/registries/plugins.js.map +0 -1
  336. package/dist/registries/plugins.mjs +0 -24
  337. package/dist/registries/plugins.mjs.map +0 -1
  338. package/dist/registries/policies.js +0 -108
  339. package/dist/registries/policies.js.map +0 -1
  340. package/dist/registries/policies.mjs +0 -109
  341. package/dist/registries/policies.mjs.map +0 -1
  342. package/dist/registries/sanitizers.js +0 -25
  343. package/dist/registries/sanitizers.js.map +0 -1
  344. package/dist/registries/sanitizers.mjs +0 -24
  345. package/dist/registries/sanitizers.mjs.map +0 -1
  346. package/dist/registries/services.js +0 -80
  347. package/dist/registries/services.js.map +0 -1
  348. package/dist/registries/services.mjs +0 -81
  349. package/dist/registries/services.mjs.map +0 -1
  350. package/dist/registries/validators.js +0 -25
  351. package/dist/registries/validators.js.map +0 -1
  352. package/dist/registries/validators.mjs +0 -24
  353. package/dist/registries/validators.mjs.map +0 -1
  354. package/dist/services/auth/index.js +0 -81
  355. package/dist/services/auth/index.js.map +0 -1
  356. package/dist/services/auth/index.mjs +0 -80
  357. package/dist/services/auth/index.mjs.map +0 -1
  358. package/dist/services/config.js +0 -47
  359. package/dist/services/config.js.map +0 -1
  360. package/dist/services/config.mjs +0 -47
  361. package/dist/services/config.mjs.map +0 -1
  362. package/dist/services/content-api/index.js +0 -85
  363. package/dist/services/content-api/index.js.map +0 -1
  364. package/dist/services/content-api/index.mjs +0 -84
  365. package/dist/services/content-api/index.mjs.map +0 -1
  366. package/dist/services/content-api/permissions/engine.js +0 -7
  367. package/dist/services/content-api/permissions/engine.js.map +0 -1
  368. package/dist/services/content-api/permissions/engine.mjs +0 -6
  369. package/dist/services/content-api/permissions/engine.mjs.map +0 -1
  370. package/dist/services/content-api/permissions/index.js +0 -87
  371. package/dist/services/content-api/permissions/index.js.map +0 -1
  372. package/dist/services/content-api/permissions/index.mjs +0 -86
  373. package/dist/services/content-api/permissions/index.mjs.map +0 -1
  374. package/dist/services/content-api/permissions/providers/action.js +0 -16
  375. package/dist/services/content-api/permissions/providers/action.js.map +0 -1
  376. package/dist/services/content-api/permissions/providers/action.mjs +0 -17
  377. package/dist/services/content-api/permissions/providers/action.mjs.map +0 -1
  378. package/dist/services/content-api/permissions/providers/condition.js +0 -16
  379. package/dist/services/content-api/permissions/providers/condition.js.map +0 -1
  380. package/dist/services/content-api/permissions/providers/condition.mjs +0 -17
  381. package/dist/services/content-api/permissions/providers/condition.mjs.map +0 -1
  382. package/dist/services/core-store.js +0 -107
  383. package/dist/services/core-store.js.map +0 -1
  384. package/dist/services/core-store.mjs +0 -107
  385. package/dist/services/core-store.mjs.map +0 -1
  386. package/dist/services/cron.js +0 -67
  387. package/dist/services/cron.js.map +0 -1
  388. package/dist/services/cron.mjs +0 -68
  389. package/dist/services/cron.mjs.map +0 -1
  390. package/dist/services/custom-fields.js +0 -10
  391. package/dist/services/custom-fields.js.map +0 -1
  392. package/dist/services/custom-fields.mjs +0 -11
  393. package/dist/services/custom-fields.mjs.map +0 -1
  394. package/dist/services/document-service/attributes/index.js +0 -22
  395. package/dist/services/document-service/attributes/index.js.map +0 -1
  396. package/dist/services/document-service/attributes/index.mjs +0 -22
  397. package/dist/services/document-service/attributes/index.mjs.map +0 -1
  398. package/dist/services/document-service/attributes/transforms.js +0 -20
  399. package/dist/services/document-service/attributes/transforms.js.map +0 -1
  400. package/dist/services/document-service/attributes/transforms.mjs +0 -19
  401. package/dist/services/document-service/attributes/transforms.mjs.map +0 -1
  402. package/dist/services/document-service/common.js +0 -7
  403. package/dist/services/document-service/common.js.map +0 -1
  404. package/dist/services/document-service/common.mjs +0 -7
  405. package/dist/services/document-service/common.mjs.map +0 -1
  406. package/dist/services/document-service/components.js +0 -288
  407. package/dist/services/document-service/components.js.map +0 -1
  408. package/dist/services/document-service/components.mjs +0 -286
  409. package/dist/services/document-service/components.mjs.map +0 -1
  410. package/dist/services/document-service/draft-and-publish.js +0 -69
  411. package/dist/services/document-service/draft-and-publish.js.map +0 -1
  412. package/dist/services/document-service/draft-and-publish.mjs +0 -69
  413. package/dist/services/document-service/draft-and-publish.mjs.map +0 -1
  414. package/dist/services/document-service/entries.js +0 -95
  415. package/dist/services/document-service/entries.js.map +0 -1
  416. package/dist/services/document-service/entries.mjs +0 -95
  417. package/dist/services/document-service/entries.mjs.map +0 -1
  418. package/dist/services/document-service/events.js +0 -47
  419. package/dist/services/document-service/events.js.map +0 -1
  420. package/dist/services/document-service/events.mjs +0 -47
  421. package/dist/services/document-service/events.mjs.map +0 -1
  422. package/dist/services/document-service/index.js +0 -36
  423. package/dist/services/document-service/index.js.map +0 -1
  424. package/dist/services/document-service/index.mjs +0 -36
  425. package/dist/services/document-service/index.mjs.map +0 -1
  426. package/dist/services/document-service/internationalization.js +0 -63
  427. package/dist/services/document-service/internationalization.js.map +0 -1
  428. package/dist/services/document-service/internationalization.mjs +0 -63
  429. package/dist/services/document-service/internationalization.mjs.map +0 -1
  430. package/dist/services/document-service/middlewares/errors.js +0 -25
  431. package/dist/services/document-service/middlewares/errors.js.map +0 -1
  432. package/dist/services/document-service/middlewares/errors.mjs +0 -25
  433. package/dist/services/document-service/middlewares/errors.mjs.map +0 -1
  434. package/dist/services/document-service/middlewares/middleware-manager.js +0 -49
  435. package/dist/services/document-service/middlewares/middleware-manager.js.map +0 -1
  436. package/dist/services/document-service/middlewares/middleware-manager.mjs +0 -49
  437. package/dist/services/document-service/middlewares/middleware-manager.mjs.map +0 -1
  438. package/dist/services/document-service/params.js +0 -8
  439. package/dist/services/document-service/params.js.map +0 -1
  440. package/dist/services/document-service/params.mjs +0 -8
  441. package/dist/services/document-service/params.mjs.map +0 -1
  442. package/dist/services/document-service/repository.js +0 -332
  443. package/dist/services/document-service/repository.js.map +0 -1
  444. package/dist/services/document-service/repository.mjs +0 -332
  445. package/dist/services/document-service/repository.mjs.map +0 -1
  446. package/dist/services/document-service/transform/data.js +0 -15
  447. package/dist/services/document-service/transform/data.js.map +0 -1
  448. package/dist/services/document-service/transform/data.mjs +0 -15
  449. package/dist/services/document-service/transform/data.mjs.map +0 -1
  450. package/dist/services/document-service/transform/fields.js +0 -24
  451. package/dist/services/document-service/transform/fields.js.map +0 -1
  452. package/dist/services/document-service/transform/fields.mjs +0 -24
  453. package/dist/services/document-service/transform/fields.mjs.map +0 -1
  454. package/dist/services/document-service/transform/id-map.js +0 -85
  455. package/dist/services/document-service/transform/id-map.js.map +0 -1
  456. package/dist/services/document-service/transform/id-map.mjs +0 -85
  457. package/dist/services/document-service/transform/id-map.mjs.map +0 -1
  458. package/dist/services/document-service/transform/id-transform.js +0 -33
  459. package/dist/services/document-service/transform/id-transform.js.map +0 -1
  460. package/dist/services/document-service/transform/id-transform.mjs +0 -33
  461. package/dist/services/document-service/transform/id-transform.mjs.map +0 -1
  462. package/dist/services/document-service/transform/populate.js +0 -21
  463. package/dist/services/document-service/transform/populate.js.map +0 -1
  464. package/dist/services/document-service/transform/populate.mjs +0 -21
  465. package/dist/services/document-service/transform/populate.mjs.map +0 -1
  466. package/dist/services/document-service/transform/query.js +0 -9
  467. package/dist/services/document-service/transform/query.js.map +0 -1
  468. package/dist/services/document-service/transform/query.mjs +0 -9
  469. package/dist/services/document-service/transform/query.mjs.map +0 -1
  470. package/dist/services/document-service/transform/relations/extract/data-ids.js +0 -64
  471. package/dist/services/document-service/transform/relations/extract/data-ids.js.map +0 -1
  472. package/dist/services/document-service/transform/relations/extract/data-ids.mjs +0 -64
  473. package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +0 -1
  474. package/dist/services/document-service/transform/relations/transform/data-ids.js +0 -85
  475. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +0 -1
  476. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +0 -85
  477. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +0 -1
  478. package/dist/services/document-service/transform/relations/transform/default-locale.js +0 -32
  479. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +0 -1
  480. package/dist/services/document-service/transform/relations/transform/default-locale.mjs +0 -32
  481. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +0 -1
  482. package/dist/services/document-service/transform/relations/utils/dp.js +0 -30
  483. package/dist/services/document-service/transform/relations/utils/dp.js.map +0 -1
  484. package/dist/services/document-service/transform/relations/utils/dp.mjs +0 -30
  485. package/dist/services/document-service/transform/relations/utils/dp.mjs.map +0 -1
  486. package/dist/services/document-service/transform/relations/utils/i18n.js +0 -25
  487. package/dist/services/document-service/transform/relations/utils/i18n.js.map +0 -1
  488. package/dist/services/document-service/transform/relations/utils/i18n.mjs +0 -25
  489. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +0 -1
  490. package/dist/services/document-service/transform/relations/utils/map-relation.js +0 -84
  491. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +0 -1
  492. package/dist/services/document-service/transform/relations/utils/map-relation.mjs +0 -84
  493. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +0 -1
  494. package/dist/services/document-service/utils/populate.js +0 -47
  495. package/dist/services/document-service/utils/populate.js.map +0 -1
  496. package/dist/services/document-service/utils/populate.mjs +0 -47
  497. package/dist/services/document-service/utils/populate.mjs.map +0 -1
  498. package/dist/services/document-service/utils/unidirectional-relations.js +0 -68
  499. package/dist/services/document-service/utils/unidirectional-relations.js.map +0 -1
  500. package/dist/services/document-service/utils/unidirectional-relations.mjs +0 -68
  501. package/dist/services/document-service/utils/unidirectional-relations.mjs.map +0 -1
  502. package/dist/services/entity-service/index.js +0 -169
  503. package/dist/services/entity-service/index.js.map +0 -1
  504. package/dist/services/entity-service/index.mjs +0 -167
  505. package/dist/services/entity-service/index.mjs.map +0 -1
  506. package/dist/services/entity-validator/blocks-validator.js +0 -128
  507. package/dist/services/entity-validator/blocks-validator.js.map +0 -1
  508. package/dist/services/entity-validator/blocks-validator.mjs +0 -128
  509. package/dist/services/entity-validator/blocks-validator.mjs.map +0 -1
  510. package/dist/services/entity-validator/index.js +0 -389
  511. package/dist/services/entity-validator/index.js.map +0 -1
  512. package/dist/services/entity-validator/index.mjs +0 -388
  513. package/dist/services/entity-validator/index.mjs.map +0 -1
  514. package/dist/services/entity-validator/validators.js +0 -241
  515. package/dist/services/entity-validator/validators.js.map +0 -1
  516. package/dist/services/entity-validator/validators.mjs +0 -239
  517. package/dist/services/entity-validator/validators.mjs.map +0 -1
  518. package/dist/services/errors.js +0 -76
  519. package/dist/services/errors.js.map +0 -1
  520. package/dist/services/errors.mjs +0 -74
  521. package/dist/services/errors.mjs.map +0 -1
  522. package/dist/services/event-hub.js +0 -72
  523. package/dist/services/event-hub.js.map +0 -1
  524. package/dist/services/event-hub.mjs +0 -73
  525. package/dist/services/event-hub.mjs.map +0 -1
  526. package/dist/services/features.js +0 -17
  527. package/dist/services/features.js.map +0 -1
  528. package/dist/services/features.mjs +0 -17
  529. package/dist/services/features.mjs.map +0 -1
  530. package/dist/services/fs.js +0 -51
  531. package/dist/services/fs.js.map +0 -1
  532. package/dist/services/fs.mjs +0 -49
  533. package/dist/services/fs.mjs.map +0 -1
  534. package/dist/services/metrics/admin-user-hash.js +0 -14
  535. package/dist/services/metrics/admin-user-hash.js.map +0 -1
  536. package/dist/services/metrics/admin-user-hash.mjs +0 -12
  537. package/dist/services/metrics/admin-user-hash.mjs.map +0 -1
  538. package/dist/services/metrics/index.js +0 -44
  539. package/dist/services/metrics/index.js.map +0 -1
  540. package/dist/services/metrics/index.mjs +0 -45
  541. package/dist/services/metrics/index.mjs.map +0 -1
  542. package/dist/services/metrics/is-truthy.js +0 -9
  543. package/dist/services/metrics/is-truthy.js.map +0 -1
  544. package/dist/services/metrics/is-truthy.mjs +0 -8
  545. package/dist/services/metrics/is-truthy.mjs.map +0 -1
  546. package/dist/services/metrics/middleware.js +0 -25
  547. package/dist/services/metrics/middleware.js.map +0 -1
  548. package/dist/services/metrics/middleware.mjs +0 -26
  549. package/dist/services/metrics/middleware.mjs.map +0 -1
  550. package/dist/services/metrics/rate-limiter.js +0 -21
  551. package/dist/services/metrics/rate-limiter.js.map +0 -1
  552. package/dist/services/metrics/rate-limiter.mjs +0 -22
  553. package/dist/services/metrics/rate-limiter.mjs.map +0 -1
  554. package/dist/services/metrics/sender.js +0 -76
  555. package/dist/services/metrics/sender.js.map +0 -1
  556. package/dist/services/metrics/sender.mjs +0 -70
  557. package/dist/services/metrics/sender.mjs.map +0 -1
  558. package/dist/services/query-params.js +0 -12
  559. package/dist/services/query-params.js.map +0 -1
  560. package/dist/services/query-params.mjs +0 -13
  561. package/dist/services/query-params.mjs.map +0 -1
  562. package/dist/services/reloader.js +0 -36
  563. package/dist/services/reloader.js.map +0 -1
  564. package/dist/services/reloader.mjs +0 -36
  565. package/dist/services/reloader.mjs.map +0 -1
  566. package/dist/services/request-context.js +0 -13
  567. package/dist/services/request-context.js.map +0 -1
  568. package/dist/services/request-context.mjs +0 -14
  569. package/dist/services/request-context.mjs.map +0 -1
  570. package/dist/services/server/admin-api.js +0 -13
  571. package/dist/services/server/admin-api.js.map +0 -1
  572. package/dist/services/server/admin-api.mjs +0 -13
  573. package/dist/services/server/admin-api.mjs.map +0 -1
  574. package/dist/services/server/api.js +0 -30
  575. package/dist/services/server/api.js.map +0 -1
  576. package/dist/services/server/api.mjs +0 -28
  577. package/dist/services/server/api.mjs.map +0 -1
  578. package/dist/services/server/compose-endpoint.js +0 -117
  579. package/dist/services/server/compose-endpoint.js.map +0 -1
  580. package/dist/services/server/compose-endpoint.mjs +0 -116
  581. package/dist/services/server/compose-endpoint.mjs.map +0 -1
  582. package/dist/services/server/content-api.js +0 -12
  583. package/dist/services/server/content-api.js.map +0 -1
  584. package/dist/services/server/content-api.mjs +0 -12
  585. package/dist/services/server/content-api.mjs.map +0 -1
  586. package/dist/services/server/http-server.js +0 -50
  587. package/dist/services/server/http-server.js.map +0 -1
  588. package/dist/services/server/http-server.mjs +0 -48
  589. package/dist/services/server/http-server.mjs.map +0 -1
  590. package/dist/services/server/index.js +0 -87
  591. package/dist/services/server/index.js.map +0 -1
  592. package/dist/services/server/index.mjs +0 -85
  593. package/dist/services/server/index.mjs.map +0 -1
  594. package/dist/services/server/koa.js +0 -52
  595. package/dist/services/server/koa.js.map +0 -1
  596. package/dist/services/server/koa.mjs +0 -48
  597. package/dist/services/server/koa.mjs.map +0 -1
  598. package/dist/services/server/middleware.js +0 -92
  599. package/dist/services/server/middleware.js.map +0 -1
  600. package/dist/services/server/middleware.mjs +0 -90
  601. package/dist/services/server/middleware.mjs.map +0 -1
  602. package/dist/services/server/policy.js +0 -20
  603. package/dist/services/server/policy.js.map +0 -1
  604. package/dist/services/server/policy.mjs +0 -20
  605. package/dist/services/server/policy.mjs.map +0 -1
  606. package/dist/services/server/register-middlewares.js +0 -72
  607. package/dist/services/server/register-middlewares.js.map +0 -1
  608. package/dist/services/server/register-middlewares.mjs +0 -73
  609. package/dist/services/server/register-middlewares.mjs.map +0 -1
  610. package/dist/services/server/register-routes.js +0 -76
  611. package/dist/services/server/register-routes.js.map +0 -1
  612. package/dist/services/server/register-routes.mjs +0 -75
  613. package/dist/services/server/register-routes.mjs.map +0 -1
  614. package/dist/services/server/routing.js +0 -91
  615. package/dist/services/server/routing.js.map +0 -1
  616. package/dist/services/server/routing.mjs +0 -89
  617. package/dist/services/server/routing.mjs.map +0 -1
  618. package/dist/services/utils/dynamic-zones.js +0 -17
  619. package/dist/services/utils/dynamic-zones.js.map +0 -1
  620. package/dist/services/utils/dynamic-zones.mjs +0 -18
  621. package/dist/services/utils/dynamic-zones.mjs.map +0 -1
  622. package/dist/services/webhook-runner.js +0 -133
  623. package/dist/services/webhook-runner.js.map +0 -1
  624. package/dist/services/webhook-runner.mjs +0 -131
  625. package/dist/services/webhook-runner.mjs.map +0 -1
  626. package/dist/services/webhook-store.js +0 -110
  627. package/dist/services/webhook-store.js.map +0 -1
  628. package/dist/services/webhook-store.mjs +0 -110
  629. package/dist/services/webhook-store.mjs.map +0 -1
  630. package/dist/services/worker-queue.js +0 -56
  631. package/dist/services/worker-queue.js.map +0 -1
  632. package/dist/services/worker-queue.mjs +0 -55
  633. package/dist/services/worker-queue.mjs.map +0 -1
  634. package/dist/utils/convert-custom-field-type.js +0 -24
  635. package/dist/utils/convert-custom-field-type.js.map +0 -1
  636. package/dist/utils/convert-custom-field-type.mjs +0 -24
  637. package/dist/utils/convert-custom-field-type.mjs.map +0 -1
  638. package/dist/utils/cron.js +0 -38
  639. package/dist/utils/cron.js.map +0 -1
  640. package/dist/utils/cron.mjs +0 -38
  641. package/dist/utils/cron.mjs.map +0 -1
  642. package/dist/utils/fetch.js +0 -21
  643. package/dist/utils/fetch.js.map +0 -1
  644. package/dist/utils/fetch.mjs +0 -21
  645. package/dist/utils/fetch.mjs.map +0 -1
  646. package/dist/utils/filepath-to-prop-path.js +0 -33
  647. package/dist/utils/filepath-to-prop-path.js.map +0 -1
  648. package/dist/utils/filepath-to-prop-path.mjs +0 -30
  649. package/dist/utils/filepath-to-prop-path.mjs.map +0 -1
  650. package/dist/utils/is-initialized.js +0 -16
  651. package/dist/utils/is-initialized.js.map +0 -1
  652. package/dist/utils/is-initialized.mjs +0 -16
  653. package/dist/utils/is-initialized.mjs.map +0 -1
  654. package/dist/utils/lifecycles.js +0 -9
  655. package/dist/utils/lifecycles.js.map +0 -1
  656. package/dist/utils/lifecycles.mjs +0 -9
  657. package/dist/utils/lifecycles.mjs.map +0 -1
  658. package/dist/utils/load-config-file.js +0 -45
  659. package/dist/utils/load-config-file.js.map +0 -1
  660. package/dist/utils/load-config-file.mjs +0 -42
  661. package/dist/utils/load-config-file.mjs.map +0 -1
  662. package/dist/utils/load-files.js +0 -38
  663. package/dist/utils/load-files.js.map +0 -1
  664. package/dist/utils/load-files.mjs +0 -34
  665. package/dist/utils/load-files.mjs.map +0 -1
  666. package/dist/utils/open-browser.js +0 -11
  667. package/dist/utils/open-browser.js.map +0 -1
  668. package/dist/utils/open-browser.mjs +0 -9
  669. package/dist/utils/open-browser.mjs.map +0 -1
  670. package/dist/utils/resolve-working-dirs.js +0 -13
  671. package/dist/utils/resolve-working-dirs.js.map +0 -1
  672. package/dist/utils/resolve-working-dirs.mjs +0 -11
  673. package/dist/utils/resolve-working-dirs.mjs.map +0 -1
  674. package/dist/utils/signals.js +0 -17
  675. package/dist/utils/signals.js.map +0 -1
  676. package/dist/utils/signals.mjs +0 -17
  677. package/dist/utils/signals.mjs.map +0 -1
  678. package/dist/utils/startup-logger.js +0 -86
  679. package/dist/utils/startup-logger.js.map +0 -1
  680. package/dist/utils/startup-logger.mjs +0 -82
  681. package/dist/utils/startup-logger.mjs.map +0 -1
  682. package/dist/utils/transform-content-types-to-models.js +0 -288
  683. package/dist/utils/transform-content-types-to-models.js.map +0 -1
  684. package/dist/utils/transform-content-types-to-models.mjs +0 -285
  685. package/dist/utils/transform-content-types-to-models.mjs.map +0 -1
  686. package/dist/utils/update-notifier/index.js +0 -85
  687. package/dist/utils/update-notifier/index.js.map +0 -1
  688. package/dist/utils/update-notifier/index.mjs +0 -78
  689. package/dist/utils/update-notifier/index.mjs.map +0 -1
@@ -1,63 +0,0 @@
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();
7
- };
8
- const defaultLocale = async (contentType, params) => {
9
- if (!strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
10
- return params;
11
- }
12
- if (!params.locale) {
13
- return fp.assoc("locale", await getDefaultLocale(), params);
14
- }
15
- return params;
16
- };
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);
27
- };
28
- const multiLocaleToLookup = (contentType, params) => {
29
- if (!strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
30
- 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
- };
40
- const localeToData = (contentType, params) => {
41
- if (!strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
42
- 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
- };
55
- const defaultLocaleCurry = fp.curry(defaultLocale);
56
- const localeToLookupCurry = fp.curry(localeToLookup);
57
- const multiLocaleToLookupCurry = fp.curry(multiLocaleToLookup);
58
- const localeToDataCurry = fp.curry(localeToData);
59
- exports.defaultLocale = defaultLocaleCurry;
60
- exports.localeToData = localeToDataCurry;
61
- exports.localeToLookup = localeToLookupCurry;
62
- exports.multiLocaleToLookup = multiLocaleToLookupCurry;
63
- //# sourceMappingURL=internationalization.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internationalization.js","sources":["../../../src/services/document-service/internationalization.ts"],"sourcesContent":["import type { Struct, Modules } from '@strapi/types';\nimport { errors } from '@strapi/utils';\nimport { curry, assoc } from 'lodash/fp';\n\ntype Transform = (\n contentType: Struct.SingleTypeSchema | Struct.CollectionTypeSchema,\n params: Modules.Documents.Params.All\n) => Modules.Documents.Params.All;\n\ntype AsyncTransform = (\n contentType: Struct.SingleTypeSchema | Struct.CollectionTypeSchema,\n params: Modules.Documents.Params.All\n) => Promise<Modules.Documents.Params.All>;\n\nconst getDefaultLocale = async (): Promise<string> => {\n return strapi.plugin('i18n').service('locales').getDefaultLocale();\n};\n\nconst defaultLocale: AsyncTransform = async (contentType, params) => {\n if (!strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)) {\n return params;\n }\n\n if (!params.locale) {\n return assoc('locale', await getDefaultLocale(), params);\n }\n\n return params;\n};\n\n/**\n * Add locale lookup query to the params\n */\nconst localeToLookup: Transform = (contentType, params) => {\n if (\n !params.locale ||\n !strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)\n ) {\n return params;\n }\n\n if (typeof params.locale !== 'string') {\n // localeToLookup accepts locales of '*'. This is because the document\n // service functions that use this transform work with the '*' locale\n // to return all locales.\n throw new errors.ValidationError(\n `Invalid locale param ${String(params.locale)} provided. Document locales must be strings.`\n );\n }\n\n return assoc(['lookup', 'locale'], params.locale, params);\n};\n\n/**\n * Add locale lookup query to the params\n */\nconst multiLocaleToLookup: Transform = (contentType, params) => {\n if (!strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)) {\n return params;\n }\n\n if (params.locale) {\n if (params.locale === '*') {\n return params;\n }\n\n return assoc(['lookup', 'locale'], params.locale, params);\n }\n\n return params;\n};\n\n/**\n * Translate locale status parameter into the data that will be saved\n */\nconst localeToData: Transform = (contentType, params) => {\n if (!strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)) {\n return params;\n }\n\n if (params.locale) {\n const isValidLocale = typeof params.locale === 'string' && params.locale !== '*';\n if (isValidLocale) {\n return assoc(['data', 'locale'], params.locale, params);\n }\n\n throw new errors.ValidationError(\n `Invalid locale param ${params.locale} provided. Document locales must be strings.`\n );\n }\n\n return params;\n};\n\nconst defaultLocaleCurry = curry(defaultLocale);\nconst localeToLookupCurry = curry(localeToLookup);\nconst multiLocaleToLookupCurry = curry(multiLocaleToLookup);\nconst localeToDataCurry = curry(localeToData);\n\nexport {\n defaultLocaleCurry as defaultLocale,\n localeToLookupCurry as localeToLookup,\n localeToDataCurry as localeToData,\n multiLocaleToLookupCurry as multiLocaleToLookup,\n};\n"],"names":["assoc","errors","curry"],"mappings":";;;;AAcA,MAAM,mBAAmB,YAA6B;AACpD,SAAO,OAAO,OAAO,MAAM,EAAE,QAAQ,SAAS,EAAE,iBAAiB;AACnE;AAEA,MAAM,gBAAgC,OAAO,aAAa,WAAW;AAC/D,MAAA,CAAC,OAAO,OAAO,MAAM,EAAE,QAAQ,eAAe,EAAE,uBAAuB,WAAW,GAAG;AAChF,WAAA;AAAA,EAAA;AAGL,MAAA,CAAC,OAAO,QAAQ;AAClB,WAAOA,GAAM,MAAA,UAAU,MAAM,iBAAA,GAAoB,MAAM;AAAA,EAAA;AAGlD,SAAA;AACT;AAKA,MAAM,iBAA4B,CAAC,aAAa,WAAW;AACzD,MACE,CAAC,OAAO,UACR,CAAC,OAAO,OAAO,MAAM,EAAE,QAAQ,eAAe,EAAE,uBAAuB,WAAW,GAClF;AACO,WAAA;AAAA,EAAA;AAGL,MAAA,OAAO,OAAO,WAAW,UAAU;AAIrC,UAAM,IAAIC,YAAO,OAAA;AAAA,MACf,wBAAwB,OAAO,OAAO,MAAM,CAAC;AAAA,IAC/C;AAAA,EAAA;AAGF,SAAOD,GAAAA,MAAM,CAAC,UAAU,QAAQ,GAAG,OAAO,QAAQ,MAAM;AAC1D;AAKA,MAAM,sBAAiC,CAAC,aAAa,WAAW;AAC1D,MAAA,CAAC,OAAO,OAAO,MAAM,EAAE,QAAQ,eAAe,EAAE,uBAAuB,WAAW,GAAG;AAChF,WAAA;AAAA,EAAA;AAGT,MAAI,OAAO,QAAQ;AACb,QAAA,OAAO,WAAW,KAAK;AAClB,aAAA;AAAA,IAAA;AAGT,WAAOA,GAAAA,MAAM,CAAC,UAAU,QAAQ,GAAG,OAAO,QAAQ,MAAM;AAAA,EAAA;AAGnD,SAAA;AACT;AAKA,MAAM,eAA0B,CAAC,aAAa,WAAW;AACnD,MAAA,CAAC,OAAO,OAAO,MAAM,EAAE,QAAQ,eAAe,EAAE,uBAAuB,WAAW,GAAG;AAChF,WAAA;AAAA,EAAA;AAGT,MAAI,OAAO,QAAQ;AACjB,UAAM,gBAAgB,OAAO,OAAO,WAAW,YAAY,OAAO,WAAW;AAC7E,QAAI,eAAe;AACjB,aAAOA,GAAAA,MAAM,CAAC,QAAQ,QAAQ,GAAG,OAAO,QAAQ,MAAM;AAAA,IAAA;AAGxD,UAAM,IAAIC,YAAO,OAAA;AAAA,MACf,wBAAwB,OAAO,MAAM;AAAA,IACvC;AAAA,EAAA;AAGK,SAAA;AACT;AAEM,MAAA,qBAAqBC,SAAM,aAAa;AACxC,MAAA,sBAAsBA,SAAM,cAAc;AAC1C,MAAA,2BAA2BA,SAAM,mBAAmB;AACpD,MAAA,oBAAoBA,SAAM,YAAY;;;;;"}
@@ -1,63 +0,0 @@
1
- import { errors } from "@strapi/utils";
2
- import { curry, assoc } from "lodash/fp";
3
- const getDefaultLocale = async () => {
4
- return strapi.plugin("i18n").service("locales").getDefaultLocale();
5
- };
6
- const defaultLocale = async (contentType, params) => {
7
- if (!strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
8
- return params;
9
- }
10
- if (!params.locale) {
11
- return assoc("locale", await getDefaultLocale(), params);
12
- }
13
- return params;
14
- };
15
- const localeToLookup = (contentType, params) => {
16
- if (!params.locale || !strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
17
- return params;
18
- }
19
- if (typeof params.locale !== "string") {
20
- throw new errors.ValidationError(
21
- `Invalid locale param ${String(params.locale)} provided. Document locales must be strings.`
22
- );
23
- }
24
- return assoc(["lookup", "locale"], params.locale, params);
25
- };
26
- const multiLocaleToLookup = (contentType, params) => {
27
- if (!strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
28
- return params;
29
- }
30
- if (params.locale) {
31
- if (params.locale === "*") {
32
- return params;
33
- }
34
- return assoc(["lookup", "locale"], params.locale, params);
35
- }
36
- return params;
37
- };
38
- const localeToData = (contentType, params) => {
39
- if (!strapi.plugin("i18n").service("content-types").isLocalizedContentType(contentType)) {
40
- return params;
41
- }
42
- if (params.locale) {
43
- const isValidLocale = typeof params.locale === "string" && params.locale !== "*";
44
- if (isValidLocale) {
45
- return assoc(["data", "locale"], params.locale, params);
46
- }
47
- throw new errors.ValidationError(
48
- `Invalid locale param ${params.locale} provided. Document locales must be strings.`
49
- );
50
- }
51
- return params;
52
- };
53
- const defaultLocaleCurry = curry(defaultLocale);
54
- const localeToLookupCurry = curry(localeToLookup);
55
- const multiLocaleToLookupCurry = curry(multiLocaleToLookup);
56
- const localeToDataCurry = curry(localeToData);
57
- export {
58
- defaultLocaleCurry as defaultLocale,
59
- localeToDataCurry as localeToData,
60
- localeToLookupCurry as localeToLookup,
61
- multiLocaleToLookupCurry as multiLocaleToLookup
62
- };
63
- //# sourceMappingURL=internationalization.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internationalization.mjs","sources":["../../../src/services/document-service/internationalization.ts"],"sourcesContent":["import type { Struct, Modules } from '@strapi/types';\nimport { errors } from '@strapi/utils';\nimport { curry, assoc } from 'lodash/fp';\n\ntype Transform = (\n contentType: Struct.SingleTypeSchema | Struct.CollectionTypeSchema,\n params: Modules.Documents.Params.All\n) => Modules.Documents.Params.All;\n\ntype AsyncTransform = (\n contentType: Struct.SingleTypeSchema | Struct.CollectionTypeSchema,\n params: Modules.Documents.Params.All\n) => Promise<Modules.Documents.Params.All>;\n\nconst getDefaultLocale = async (): Promise<string> => {\n return strapi.plugin('i18n').service('locales').getDefaultLocale();\n};\n\nconst defaultLocale: AsyncTransform = async (contentType, params) => {\n if (!strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)) {\n return params;\n }\n\n if (!params.locale) {\n return assoc('locale', await getDefaultLocale(), params);\n }\n\n return params;\n};\n\n/**\n * Add locale lookup query to the params\n */\nconst localeToLookup: Transform = (contentType, params) => {\n if (\n !params.locale ||\n !strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)\n ) {\n return params;\n }\n\n if (typeof params.locale !== 'string') {\n // localeToLookup accepts locales of '*'. This is because the document\n // service functions that use this transform work with the '*' locale\n // to return all locales.\n throw new errors.ValidationError(\n `Invalid locale param ${String(params.locale)} provided. Document locales must be strings.`\n );\n }\n\n return assoc(['lookup', 'locale'], params.locale, params);\n};\n\n/**\n * Add locale lookup query to the params\n */\nconst multiLocaleToLookup: Transform = (contentType, params) => {\n if (!strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)) {\n return params;\n }\n\n if (params.locale) {\n if (params.locale === '*') {\n return params;\n }\n\n return assoc(['lookup', 'locale'], params.locale, params);\n }\n\n return params;\n};\n\n/**\n * Translate locale status parameter into the data that will be saved\n */\nconst localeToData: Transform = (contentType, params) => {\n if (!strapi.plugin('i18n').service('content-types').isLocalizedContentType(contentType)) {\n return params;\n }\n\n if (params.locale) {\n const isValidLocale = typeof params.locale === 'string' && params.locale !== '*';\n if (isValidLocale) {\n return assoc(['data', 'locale'], params.locale, params);\n }\n\n throw new errors.ValidationError(\n `Invalid locale param ${params.locale} provided. Document locales must be strings.`\n );\n }\n\n return params;\n};\n\nconst defaultLocaleCurry = curry(defaultLocale);\nconst localeToLookupCurry = curry(localeToLookup);\nconst multiLocaleToLookupCurry = curry(multiLocaleToLookup);\nconst localeToDataCurry = curry(localeToData);\n\nexport {\n defaultLocaleCurry as defaultLocale,\n localeToLookupCurry as localeToLookup,\n localeToDataCurry as localeToData,\n multiLocaleToLookupCurry as multiLocaleToLookup,\n};\n"],"names":[],"mappings":";;AAcA,MAAM,mBAAmB,YAA6B;AACpD,SAAO,OAAO,OAAO,MAAM,EAAE,QAAQ,SAAS,EAAE,iBAAiB;AACnE;AAEA,MAAM,gBAAgC,OAAO,aAAa,WAAW;AAC/D,MAAA,CAAC,OAAO,OAAO,MAAM,EAAE,QAAQ,eAAe,EAAE,uBAAuB,WAAW,GAAG;AAChF,WAAA;AAAA,EAAA;AAGL,MAAA,CAAC,OAAO,QAAQ;AAClB,WAAO,MAAM,UAAU,MAAM,iBAAA,GAAoB,MAAM;AAAA,EAAA;AAGlD,SAAA;AACT;AAKA,MAAM,iBAA4B,CAAC,aAAa,WAAW;AACzD,MACE,CAAC,OAAO,UACR,CAAC,OAAO,OAAO,MAAM,EAAE,QAAQ,eAAe,EAAE,uBAAuB,WAAW,GAClF;AACO,WAAA;AAAA,EAAA;AAGL,MAAA,OAAO,OAAO,WAAW,UAAU;AAIrC,UAAM,IAAI,OAAO;AAAA,MACf,wBAAwB,OAAO,OAAO,MAAM,CAAC;AAAA,IAC/C;AAAA,EAAA;AAGF,SAAO,MAAM,CAAC,UAAU,QAAQ,GAAG,OAAO,QAAQ,MAAM;AAC1D;AAKA,MAAM,sBAAiC,CAAC,aAAa,WAAW;AAC1D,MAAA,CAAC,OAAO,OAAO,MAAM,EAAE,QAAQ,eAAe,EAAE,uBAAuB,WAAW,GAAG;AAChF,WAAA;AAAA,EAAA;AAGT,MAAI,OAAO,QAAQ;AACb,QAAA,OAAO,WAAW,KAAK;AAClB,aAAA;AAAA,IAAA;AAGT,WAAO,MAAM,CAAC,UAAU,QAAQ,GAAG,OAAO,QAAQ,MAAM;AAAA,EAAA;AAGnD,SAAA;AACT;AAKA,MAAM,eAA0B,CAAC,aAAa,WAAW;AACnD,MAAA,CAAC,OAAO,OAAO,MAAM,EAAE,QAAQ,eAAe,EAAE,uBAAuB,WAAW,GAAG;AAChF,WAAA;AAAA,EAAA;AAGT,MAAI,OAAO,QAAQ;AACjB,UAAM,gBAAgB,OAAO,OAAO,WAAW,YAAY,OAAO,WAAW;AAC7E,QAAI,eAAe;AACjB,aAAO,MAAM,CAAC,QAAQ,QAAQ,GAAG,OAAO,QAAQ,MAAM;AAAA,IAAA;AAGxD,UAAM,IAAI,OAAO;AAAA,MACf,wBAAwB,OAAO,MAAM;AAAA,IACvC;AAAA,EAAA;AAGK,SAAA;AACT;AAEM,MAAA,qBAAqB,MAAM,aAAa;AACxC,MAAA,sBAAsB,MAAM,cAAc;AAC1C,MAAA,2BAA2B,MAAM,mBAAmB;AACpD,MAAA,oBAAoB,MAAM,YAAY;"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const database = require("@strapi/database");
4
- const strapiUtils = require("@strapi/utils");
5
- const databaseErrorsToTransform = [
6
- database.errors.InvalidTimeError,
7
- database.errors.InvalidDateTimeError,
8
- database.errors.InvalidDateError,
9
- database.errors.InvalidRelationError
10
- ];
11
- const databaseErrorsMiddleware = async (ctx, next) => {
12
- try {
13
- return await next();
14
- } catch (error) {
15
- if (databaseErrorsToTransform.some((errorToTransform) => error instanceof errorToTransform)) {
16
- if (error instanceof Error) {
17
- throw new strapiUtils.errors.ValidationError(error.message);
18
- }
19
- throw error;
20
- }
21
- throw error;
22
- }
23
- };
24
- exports.databaseErrorsMiddleware = databaseErrorsMiddleware;
25
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sources":["../../../../src/services/document-service/middlewares/errors.ts"],"sourcesContent":["import { errors as databaseErrors } from '@strapi/database';\nimport { errors } from '@strapi/utils';\n\nimport type { Middleware } from './middleware-manager';\n\nconst databaseErrorsToTransform = [\n databaseErrors.InvalidTimeError,\n databaseErrors.InvalidDateTimeError,\n databaseErrors.InvalidDateError,\n databaseErrors.InvalidRelationError,\n];\n\n/**\n * Handle database errors\n */\nexport const databaseErrorsMiddleware: Middleware = async (ctx, next) => {\n try {\n return await next();\n } catch (error) {\n if (databaseErrorsToTransform.some((errorToTransform) => error instanceof errorToTransform)) {\n if (error instanceof Error) {\n throw new errors.ValidationError(error.message);\n }\n\n throw error;\n }\n throw error;\n }\n};\n"],"names":["databaseErrors","errors"],"mappings":";;;;AAKA,MAAM,4BAA4B;AAAA,EAChCA,SAAAA,OAAe;AAAA,EACfA,SAAAA,OAAe;AAAA,EACfA,SAAAA,OAAe;AAAA,EACfA,gBAAe;AACjB;AAKa,MAAA,2BAAuC,OAAO,KAAK,SAAS;AACnE,MAAA;AACF,WAAO,MAAM,KAAK;AAAA,WACX,OAAO;AACd,QAAI,0BAA0B,KAAK,CAAC,qBAAqB,iBAAiB,gBAAgB,GAAG;AAC3F,UAAI,iBAAiB,OAAO;AAC1B,cAAM,IAAIC,YAAA,OAAO,gBAAgB,MAAM,OAAO;AAAA,MAAA;AAG1C,YAAA;AAAA,IAAA;AAEF,UAAA;AAAA,EAAA;AAEV;;"}
@@ -1,25 +0,0 @@
1
- import { errors } from "@strapi/database";
2
- import { errors as errors$1 } from "@strapi/utils";
3
- const databaseErrorsToTransform = [
4
- errors.InvalidTimeError,
5
- errors.InvalidDateTimeError,
6
- errors.InvalidDateError,
7
- errors.InvalidRelationError
8
- ];
9
- const databaseErrorsMiddleware = async (ctx, next) => {
10
- try {
11
- return await next();
12
- } catch (error) {
13
- if (databaseErrorsToTransform.some((errorToTransform) => error instanceof errorToTransform)) {
14
- if (error instanceof Error) {
15
- throw new errors$1.ValidationError(error.message);
16
- }
17
- throw error;
18
- }
19
- throw error;
20
- }
21
- };
22
- export {
23
- databaseErrorsMiddleware
24
- };
25
- //# sourceMappingURL=errors.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.mjs","sources":["../../../../src/services/document-service/middlewares/errors.ts"],"sourcesContent":["import { errors as databaseErrors } from '@strapi/database';\nimport { errors } from '@strapi/utils';\n\nimport type { Middleware } from './middleware-manager';\n\nconst databaseErrorsToTransform = [\n databaseErrors.InvalidTimeError,\n databaseErrors.InvalidDateTimeError,\n databaseErrors.InvalidDateError,\n databaseErrors.InvalidRelationError,\n];\n\n/**\n * Handle database errors\n */\nexport const databaseErrorsMiddleware: Middleware = async (ctx, next) => {\n try {\n return await next();\n } catch (error) {\n if (databaseErrorsToTransform.some((errorToTransform) => error instanceof errorToTransform)) {\n if (error instanceof Error) {\n throw new errors.ValidationError(error.message);\n }\n\n throw error;\n }\n throw error;\n }\n};\n"],"names":["databaseErrors","errors"],"mappings":";;AAKA,MAAM,4BAA4B;AAAA,EAChCA,OAAe;AAAA,EACfA,OAAe;AAAA,EACfA,OAAe;AAAA,EACfA,OAAe;AACjB;AAKa,MAAA,2BAAuC,OAAO,KAAK,SAAS;AACnE,MAAA;AACF,WAAO,MAAM,KAAK;AAAA,WACX,OAAO;AACd,QAAI,0BAA0B,KAAK,CAAC,qBAAqB,iBAAiB,gBAAgB,GAAG;AAC3F,UAAI,iBAAiB,OAAO;AAC1B,cAAM,IAAIC,SAAO,gBAAgB,MAAM,OAAO;AAAA,MAAA;AAG1C,YAAA;AAAA,IAAA;AAEF,UAAA;AAAA,EAAA;AAEV;"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const createMiddlewareManager = () => {
4
- const middlewares = [];
5
- const manager = {
6
- use(middleware) {
7
- middlewares.push(middleware);
8
- return () => middlewares.splice(middlewares.indexOf(middleware), 1);
9
- },
10
- async run(ctx, cb) {
11
- let index = 0;
12
- const next = async () => {
13
- if (index < middlewares.length) {
14
- return middlewares[index++](ctx, next);
15
- }
16
- return cb();
17
- };
18
- return next();
19
- },
20
- wrapObject(source, ctxDefaults = {}, opts = {}) {
21
- const facade = {};
22
- const { exclude = [] } = opts;
23
- for (const key in source) {
24
- if (Object.hasOwnProperty.call(source, key)) {
25
- const prop = source[key];
26
- if (exclude.includes(key)) {
27
- facade[key] = prop;
28
- } else if (typeof prop === "function") {
29
- const newMethod = async (params = {}) => {
30
- const ctx = {
31
- ...ctxDefaults,
32
- action: key,
33
- params
34
- };
35
- return manager.run(ctx, () => prop(ctx.params));
36
- };
37
- facade[key] = newMethod;
38
- } else {
39
- facade[key] = prop;
40
- }
41
- }
42
- }
43
- return facade;
44
- }
45
- };
46
- return manager;
47
- };
48
- exports.createMiddlewareManager = createMiddlewareManager;
49
- //# sourceMappingURL=middleware-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"middleware-manager.js","sources":["../../../../src/services/document-service/middlewares/middleware-manager.ts"],"sourcesContent":["export type Middleware = (ctx: any, next: () => Promise<void>) => Promise<void> | void;\n\nexport type Options = {\n exclude?: string[];\n};\n\nexport const createMiddlewareManager = () => {\n const middlewares: Middleware[] = [];\n\n const manager = {\n use(middleware: Middleware) {\n middlewares.push(middleware);\n\n return () => middlewares.splice(middlewares.indexOf(middleware), 1);\n },\n\n async run(ctx: any, cb: () => void) {\n let index = 0;\n const next = async () => {\n if (index < middlewares.length) {\n // eslint-disable-next-line no-plusplus\n return middlewares[index++](ctx, next);\n }\n\n return cb();\n };\n\n return next();\n },\n\n wrapObject<TSource>(source: TSource, ctxDefaults = {}, opts: Options = {}): TSource {\n const facade: TSource = {} as TSource;\n const { exclude = [] } = opts;\n\n for (const key in source) {\n if (Object.hasOwnProperty.call(source, key)) {\n const prop = source[key];\n\n if (exclude.includes(key)) {\n facade[key] = prop;\n } else if (typeof prop === 'function') {\n const newMethod = async (params: any = {}) => {\n const ctx = {\n ...ctxDefaults,\n action: key,\n params,\n };\n\n return manager.run(ctx, () => prop(ctx.params));\n };\n\n facade[key] = newMethod as typeof prop;\n } else {\n facade[key] = prop;\n }\n }\n }\n\n return facade;\n },\n };\n\n return manager;\n};\n"],"names":[],"mappings":";;AAMO,MAAM,0BAA0B,MAAM;AAC3C,QAAM,cAA4B,CAAC;AAEnC,QAAM,UAAU;AAAA,IACd,IAAI,YAAwB;AAC1B,kBAAY,KAAK,UAAU;AAE3B,aAAO,MAAM,YAAY,OAAO,YAAY,QAAQ,UAAU,GAAG,CAAC;AAAA,IACpE;AAAA,IAEA,MAAM,IAAI,KAAU,IAAgB;AAClC,UAAI,QAAQ;AACZ,YAAM,OAAO,YAAY;AACnB,YAAA,QAAQ,YAAY,QAAQ;AAE9B,iBAAO,YAAY,OAAO,EAAE,KAAK,IAAI;AAAA,QAAA;AAGvC,eAAO,GAAG;AAAA,MACZ;AAEA,aAAO,KAAK;AAAA,IACd;AAAA,IAEA,WAAoB,QAAiB,cAAc,CAAA,GAAI,OAAgB,CAAA,GAAa;AAClF,YAAM,SAAkB,CAAC;AACzB,YAAM,EAAE,UAAU,CAAC,EAAA,IAAM;AAEzB,iBAAW,OAAO,QAAQ;AACxB,YAAI,OAAO,eAAe,KAAK,QAAQ,GAAG,GAAG;AACrC,gBAAA,OAAO,OAAO,GAAG;AAEnB,cAAA,QAAQ,SAAS,GAAG,GAAG;AACzB,mBAAO,GAAG,IAAI;AAAA,UAAA,WACL,OAAO,SAAS,YAAY;AACrC,kBAAM,YAAY,OAAO,SAAc,OAAO;AAC5C,oBAAM,MAAM;AAAA,gBACV,GAAG;AAAA,gBACH,QAAQ;AAAA,gBACR;AAAA,cACF;AAEA,qBAAO,QAAQ,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC;AAAA,YAChD;AAEA,mBAAO,GAAG,IAAI;AAAA,UAAA,OACT;AACL,mBAAO,GAAG,IAAI;AAAA,UAAA;AAAA,QAChB;AAAA,MACF;AAGK,aAAA;AAAA,IAAA;AAAA,EAEX;AAEO,SAAA;AACT;;"}
@@ -1,49 +0,0 @@
1
- const createMiddlewareManager = () => {
2
- const middlewares = [];
3
- const manager = {
4
- use(middleware) {
5
- middlewares.push(middleware);
6
- return () => middlewares.splice(middlewares.indexOf(middleware), 1);
7
- },
8
- async run(ctx, cb) {
9
- let index = 0;
10
- const next = async () => {
11
- if (index < middlewares.length) {
12
- return middlewares[index++](ctx, next);
13
- }
14
- return cb();
15
- };
16
- return next();
17
- },
18
- wrapObject(source, ctxDefaults = {}, opts = {}) {
19
- const facade = {};
20
- const { exclude = [] } = opts;
21
- for (const key in source) {
22
- if (Object.hasOwnProperty.call(source, key)) {
23
- const prop = source[key];
24
- if (exclude.includes(key)) {
25
- facade[key] = prop;
26
- } else if (typeof prop === "function") {
27
- const newMethod = async (params = {}) => {
28
- const ctx = {
29
- ...ctxDefaults,
30
- action: key,
31
- params
32
- };
33
- return manager.run(ctx, () => prop(ctx.params));
34
- };
35
- facade[key] = newMethod;
36
- } else {
37
- facade[key] = prop;
38
- }
39
- }
40
- }
41
- return facade;
42
- }
43
- };
44
- return manager;
45
- };
46
- export {
47
- createMiddlewareManager
48
- };
49
- //# sourceMappingURL=middleware-manager.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"middleware-manager.mjs","sources":["../../../../src/services/document-service/middlewares/middleware-manager.ts"],"sourcesContent":["export type Middleware = (ctx: any, next: () => Promise<void>) => Promise<void> | void;\n\nexport type Options = {\n exclude?: string[];\n};\n\nexport const createMiddlewareManager = () => {\n const middlewares: Middleware[] = [];\n\n const manager = {\n use(middleware: Middleware) {\n middlewares.push(middleware);\n\n return () => middlewares.splice(middlewares.indexOf(middleware), 1);\n },\n\n async run(ctx: any, cb: () => void) {\n let index = 0;\n const next = async () => {\n if (index < middlewares.length) {\n // eslint-disable-next-line no-plusplus\n return middlewares[index++](ctx, next);\n }\n\n return cb();\n };\n\n return next();\n },\n\n wrapObject<TSource>(source: TSource, ctxDefaults = {}, opts: Options = {}): TSource {\n const facade: TSource = {} as TSource;\n const { exclude = [] } = opts;\n\n for (const key in source) {\n if (Object.hasOwnProperty.call(source, key)) {\n const prop = source[key];\n\n if (exclude.includes(key)) {\n facade[key] = prop;\n } else if (typeof prop === 'function') {\n const newMethod = async (params: any = {}) => {\n const ctx = {\n ...ctxDefaults,\n action: key,\n params,\n };\n\n return manager.run(ctx, () => prop(ctx.params));\n };\n\n facade[key] = newMethod as typeof prop;\n } else {\n facade[key] = prop;\n }\n }\n }\n\n return facade;\n },\n };\n\n return manager;\n};\n"],"names":[],"mappings":"AAMO,MAAM,0BAA0B,MAAM;AAC3C,QAAM,cAA4B,CAAC;AAEnC,QAAM,UAAU;AAAA,IACd,IAAI,YAAwB;AAC1B,kBAAY,KAAK,UAAU;AAE3B,aAAO,MAAM,YAAY,OAAO,YAAY,QAAQ,UAAU,GAAG,CAAC;AAAA,IACpE;AAAA,IAEA,MAAM,IAAI,KAAU,IAAgB;AAClC,UAAI,QAAQ;AACZ,YAAM,OAAO,YAAY;AACnB,YAAA,QAAQ,YAAY,QAAQ;AAE9B,iBAAO,YAAY,OAAO,EAAE,KAAK,IAAI;AAAA,QAAA;AAGvC,eAAO,GAAG;AAAA,MACZ;AAEA,aAAO,KAAK;AAAA,IACd;AAAA,IAEA,WAAoB,QAAiB,cAAc,CAAA,GAAI,OAAgB,CAAA,GAAa;AAClF,YAAM,SAAkB,CAAC;AACzB,YAAM,EAAE,UAAU,CAAC,EAAA,IAAM;AAEzB,iBAAW,OAAO,QAAQ;AACxB,YAAI,OAAO,eAAe,KAAK,QAAQ,GAAG,GAAG;AACrC,gBAAA,OAAO,OAAO,GAAG;AAEnB,cAAA,QAAQ,SAAS,GAAG,GAAG;AACzB,mBAAO,GAAG,IAAI;AAAA,UAAA,WACL,OAAO,SAAS,YAAY;AACrC,kBAAM,YAAY,OAAO,SAAc,OAAO;AAC5C,oBAAM,MAAM;AAAA,gBACV,GAAG;AAAA,gBACH,QAAQ;AAAA,gBACR;AAAA,cACF;AAEA,qBAAO,QAAQ,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC;AAAA,YAChD;AAEA,mBAAO,GAAG,IAAI;AAAA,UAAA,OACT;AACL,mBAAO,GAAG,IAAI;AAAA,UAAA;AAAA,QAChB;AAAA,MACF;AAGK,aAAA;AAAA,IAAA;AAAA,EAEX;AAEO,SAAA;AACT;"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fp = require("lodash/fp");
4
- const pickSelectionParams = (data) => {
5
- return fp.pick(["fields", "populate", "status"], data);
6
- };
7
- exports.pickSelectionParams = pickSelectionParams;
8
- //# sourceMappingURL=params.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"params.js","sources":["../../../src/services/document-service/params.ts"],"sourcesContent":["import { pick } from 'lodash/fp';\nimport type { UID, Modules } from '@strapi/types';\n\nconst pickSelectionParams = <TUID extends UID.ContentType>(\n data: unknown\n): Modules.Documents.Params.Pick<TUID, 'fields' | 'populate' | 'status'> => {\n return pick(['fields', 'populate', 'status'], data);\n};\n\nexport { pickSelectionParams };\n"],"names":["pick"],"mappings":";;;AAGM,MAAA,sBAAsB,CAC1B,SAC0E;AAC1E,SAAOA,GAAAA,KAAK,CAAC,UAAU,YAAY,QAAQ,GAAG,IAAI;AACpD;;"}
@@ -1,8 +0,0 @@
1
- import { pick } from "lodash/fp";
2
- const pickSelectionParams = (data) => {
3
- return pick(["fields", "populate", "status"], data);
4
- };
5
- export {
6
- pickSelectionParams
7
- };
8
- //# sourceMappingURL=params.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"params.mjs","sources":["../../../src/services/document-service/params.ts"],"sourcesContent":["import { pick } from 'lodash/fp';\nimport type { UID, Modules } from '@strapi/types';\n\nconst pickSelectionParams = <TUID extends UID.ContentType>(\n data: unknown\n): Modules.Documents.Params.Pick<TUID, 'fields' | 'populate' | 'status'> => {\n return pick(['fields', 'populate', 'status'], data);\n};\n\nexport { pickSelectionParams };\n"],"names":[],"mappings":";AAGM,MAAA,sBAAsB,CAC1B,SAC0E;AAC1E,SAAO,KAAK,CAAC,UAAU,YAAY,QAAQ,GAAG,IAAI;AACpD;"}