@strapi/core 0.0.0-experimental.9df68962083938acba06546a7901c68a63266aec → 0.0.0-experimental.9f12de545908a77b10196617c93b8db59a9151c1

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 (719) hide show
  1. package/LICENSE +18 -3
  2. package/dist/Strapi.d.ts +3 -1
  3. package/dist/Strapi.d.ts.map +1 -1
  4. package/dist/configuration/index.d.ts.map +1 -1
  5. package/dist/core-api/service/collection-type.d.ts +2 -2
  6. package/dist/ee/index.d.ts.map +1 -1
  7. package/dist/index.d.ts +14 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +9954 -27
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +9932 -29
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/loaders/plugins/get-enabled-plugins.d.ts.map +1 -1
  14. package/dist/loaders/plugins/index.d.ts.map +1 -1
  15. package/dist/middlewares/body.d.ts.map +1 -1
  16. package/dist/middlewares/cors.d.ts.map +1 -1
  17. package/dist/middlewares/query.d.ts.map +1 -1
  18. package/dist/middlewares/security.d.ts.map +1 -1
  19. package/dist/migrations/database/5.0.0-discard-drafts.d.ts +14 -11
  20. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -1
  21. package/dist/migrations/draft-publish.d.ts +2 -2
  22. package/dist/migrations/draft-publish.d.ts.map +1 -1
  23. package/dist/migrations/i18n.d.ts +5 -0
  24. package/dist/migrations/i18n.d.ts.map +1 -0
  25. package/dist/migrations/index.d.ts +5 -0
  26. package/dist/migrations/index.d.ts.map +1 -0
  27. package/dist/providers/admin.d.ts.map +1 -1
  28. package/dist/registries/policies.d.ts +1 -1
  29. package/dist/registries/policies.d.ts.map +1 -1
  30. package/dist/services/content-api/index.d.ts +10 -12
  31. package/dist/services/content-api/index.d.ts.map +1 -1
  32. package/dist/services/content-api/permissions/index.d.ts +10 -12
  33. package/dist/services/content-api/permissions/index.d.ts.map +1 -1
  34. package/dist/services/content-api/permissions/providers/action.d.ts +5 -6
  35. package/dist/services/content-api/permissions/providers/action.d.ts.map +1 -1
  36. package/dist/services/content-api/permissions/providers/condition.d.ts +5 -6
  37. package/dist/services/content-api/permissions/providers/condition.d.ts.map +1 -1
  38. package/dist/services/cron.d.ts +3 -3
  39. package/dist/services/cron.d.ts.map +1 -1
  40. package/dist/services/document-service/common.d.ts +1 -1
  41. package/dist/services/document-service/common.d.ts.map +1 -1
  42. package/dist/services/document-service/components.d.ts.map +1 -1
  43. package/dist/services/document-service/draft-and-publish.d.ts +1 -1
  44. package/dist/services/document-service/draft-and-publish.d.ts.map +1 -1
  45. package/dist/services/document-service/entries.d.ts +2 -2
  46. package/dist/services/document-service/entries.d.ts.map +1 -1
  47. package/dist/services/document-service/events.d.ts +1 -1
  48. package/dist/services/document-service/events.d.ts.map +1 -1
  49. package/dist/services/document-service/index.d.ts +2 -1
  50. package/dist/services/document-service/index.d.ts.map +1 -1
  51. package/dist/services/document-service/repository.d.ts.map +1 -1
  52. package/dist/services/document-service/transform/id-map.d.ts +1 -1
  53. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  54. package/dist/services/document-service/transform/id-transform.d.ts +1 -1
  55. package/dist/services/document-service/transform/id-transform.d.ts.map +1 -1
  56. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts +1 -1
  57. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts.map +1 -1
  58. package/dist/services/document-service/transform/relations/transform/data-ids.d.ts.map +1 -1
  59. package/dist/services/document-service/transform/relations/utils/dp.d.ts +1 -1
  60. package/dist/services/document-service/transform/relations/utils/dp.d.ts.map +1 -1
  61. package/dist/services/document-service/transform/relations/utils/i18n.d.ts +1 -1
  62. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  63. package/dist/services/document-service/transform/relations/utils/map-relation.d.ts.map +1 -1
  64. package/dist/services/document-service/utils/populate.d.ts +1 -1
  65. package/dist/services/document-service/utils/populate.d.ts.map +1 -1
  66. package/dist/services/document-service/utils/unidirectional-relations.d.ts +36 -0
  67. package/dist/services/document-service/utils/unidirectional-relations.d.ts.map +1 -0
  68. package/dist/services/entity-validator/blocks-validator.d.ts +1 -2
  69. package/dist/services/entity-validator/blocks-validator.d.ts.map +1 -1
  70. package/dist/services/entity-validator/index.d.ts +15 -1
  71. package/dist/services/entity-validator/index.d.ts.map +1 -1
  72. package/dist/services/entity-validator/validators.d.ts +36 -25
  73. package/dist/services/entity-validator/validators.d.ts.map +1 -1
  74. package/dist/services/metrics/middleware.d.ts.map +1 -1
  75. package/dist/services/metrics/rate-limiter.d.ts.map +1 -1
  76. package/dist/utils/fetch.d.ts.map +1 -1
  77. package/dist/utils/filepath-to-prop-path.d.ts +1 -1
  78. package/dist/utils/filepath-to-prop-path.d.ts.map +1 -1
  79. package/dist/utils/startup-logger.d.ts.map +1 -1
  80. package/dist/utils/transform-content-types-to-models.d.ts +355 -23
  81. package/dist/utils/transform-content-types-to-models.d.ts.map +1 -1
  82. package/dist/utils/update-notifier/index.d.ts.map +1 -1
  83. package/package.json +31 -30
  84. package/dist/Strapi.js +0 -388
  85. package/dist/Strapi.js.map +0 -1
  86. package/dist/Strapi.mjs +0 -386
  87. package/dist/Strapi.mjs.map +0 -1
  88. package/dist/compile.js +0 -18
  89. package/dist/compile.js.map +0 -1
  90. package/dist/compile.mjs +0 -17
  91. package/dist/compile.mjs.map +0 -1
  92. package/dist/configuration/config-loader.js +0 -106
  93. package/dist/configuration/config-loader.js.map +0 -1
  94. package/dist/configuration/config-loader.mjs +0 -104
  95. package/dist/configuration/config-loader.mjs.map +0 -1
  96. package/dist/configuration/get-dirs.js +0 -31
  97. package/dist/configuration/get-dirs.js.map +0 -1
  98. package/dist/configuration/get-dirs.mjs +0 -31
  99. package/dist/configuration/get-dirs.mjs.map +0 -1
  100. package/dist/configuration/index.js +0 -80
  101. package/dist/configuration/index.js.map +0 -1
  102. package/dist/configuration/index.mjs +0 -75
  103. package/dist/configuration/index.mjs.map +0 -1
  104. package/dist/configuration/urls.js +0 -68
  105. package/dist/configuration/urls.js.map +0 -1
  106. package/dist/configuration/urls.mjs +0 -66
  107. package/dist/configuration/urls.mjs.map +0 -1
  108. package/dist/container.js +0 -30
  109. package/dist/container.js.map +0 -1
  110. package/dist/container.mjs +0 -30
  111. package/dist/container.mjs.map +0 -1
  112. package/dist/core-api/controller/collection-type.js +0 -84
  113. package/dist/core-api/controller/collection-type.js.map +0 -1
  114. package/dist/core-api/controller/collection-type.mjs +0 -84
  115. package/dist/core-api/controller/collection-type.mjs.map +0 -1
  116. package/dist/core-api/controller/index.js +0 -52
  117. package/dist/core-api/controller/index.js.map +0 -1
  118. package/dist/core-api/controller/index.mjs +0 -52
  119. package/dist/core-api/controller/index.mjs.map +0 -1
  120. package/dist/core-api/controller/single-type.js +0 -46
  121. package/dist/core-api/controller/single-type.js.map +0 -1
  122. package/dist/core-api/controller/single-type.mjs +0 -46
  123. package/dist/core-api/controller/single-type.mjs.map +0 -1
  124. package/dist/core-api/controller/transform.js +0 -76
  125. package/dist/core-api/controller/transform.js.map +0 -1
  126. package/dist/core-api/controller/transform.mjs +0 -76
  127. package/dist/core-api/controller/transform.mjs.map +0 -1
  128. package/dist/core-api/routes/index.js +0 -67
  129. package/dist/core-api/routes/index.js.map +0 -1
  130. package/dist/core-api/routes/index.mjs +0 -67
  131. package/dist/core-api/routes/index.mjs.map +0 -1
  132. package/dist/core-api/service/collection-type.js +0 -67
  133. package/dist/core-api/service/collection-type.js.map +0 -1
  134. package/dist/core-api/service/collection-type.mjs +0 -67
  135. package/dist/core-api/service/collection-type.mjs.map +0 -1
  136. package/dist/core-api/service/core-service.js +0 -12
  137. package/dist/core-api/service/core-service.js.map +0 -1
  138. package/dist/core-api/service/core-service.mjs +0 -12
  139. package/dist/core-api/service/core-service.mjs.map +0 -1
  140. package/dist/core-api/service/index.js +0 -16
  141. package/dist/core-api/service/index.js.map +0 -1
  142. package/dist/core-api/service/index.mjs +0 -16
  143. package/dist/core-api/service/index.mjs.map +0 -1
  144. package/dist/core-api/service/pagination.js +0 -52
  145. package/dist/core-api/service/pagination.js.map +0 -1
  146. package/dist/core-api/service/pagination.mjs +0 -52
  147. package/dist/core-api/service/pagination.mjs.map +0 -1
  148. package/dist/core-api/service/single-type.js +0 -46
  149. package/dist/core-api/service/single-type.js.map +0 -1
  150. package/dist/core-api/service/single-type.mjs +0 -46
  151. package/dist/core-api/service/single-type.mjs.map +0 -1
  152. package/dist/domain/content-type/index.js +0 -111
  153. package/dist/domain/content-type/index.js.map +0 -1
  154. package/dist/domain/content-type/index.mjs +0 -109
  155. package/dist/domain/content-type/index.mjs.map +0 -1
  156. package/dist/domain/content-type/validator.js +0 -77
  157. package/dist/domain/content-type/validator.js.map +0 -1
  158. package/dist/domain/content-type/validator.mjs +0 -75
  159. package/dist/domain/content-type/validator.mjs.map +0 -1
  160. package/dist/domain/module/index.js +0 -107
  161. package/dist/domain/module/index.js.map +0 -1
  162. package/dist/domain/module/index.mjs +0 -105
  163. package/dist/domain/module/index.mjs.map +0 -1
  164. package/dist/domain/module/validation.js +0 -25
  165. package/dist/domain/module/validation.js.map +0 -1
  166. package/dist/domain/module/validation.mjs +0 -25
  167. package/dist/domain/module/validation.mjs.map +0 -1
  168. package/dist/ee/index.js +0 -153
  169. package/dist/ee/index.js.map +0 -1
  170. package/dist/ee/index.mjs +0 -154
  171. package/dist/ee/index.mjs.map +0 -1
  172. package/dist/ee/license.js +0 -91
  173. package/dist/ee/license.js.map +0 -1
  174. package/dist/ee/license.mjs +0 -88
  175. package/dist/ee/license.mjs.map +0 -1
  176. package/dist/factories.js +0 -80
  177. package/dist/factories.js.map +0 -1
  178. package/dist/factories.mjs +0 -80
  179. package/dist/factories.mjs.map +0 -1
  180. package/dist/loaders/admin.js +0 -26
  181. package/dist/loaders/admin.js.map +0 -1
  182. package/dist/loaders/admin.mjs +0 -25
  183. package/dist/loaders/admin.mjs.map +0 -1
  184. package/dist/loaders/apis.js +0 -137
  185. package/dist/loaders/apis.js.map +0 -1
  186. package/dist/loaders/apis.mjs +0 -135
  187. package/dist/loaders/apis.mjs.map +0 -1
  188. package/dist/loaders/components.js +0 -38
  189. package/dist/loaders/components.js.map +0 -1
  190. package/dist/loaders/components.mjs +0 -37
  191. package/dist/loaders/components.mjs.map +0 -1
  192. package/dist/loaders/index.js +0 -24
  193. package/dist/loaders/index.js.map +0 -1
  194. package/dist/loaders/index.mjs +0 -24
  195. package/dist/loaders/index.mjs.map +0 -1
  196. package/dist/loaders/middlewares.js +0 -31
  197. package/dist/loaders/middlewares.js.map +0 -1
  198. package/dist/loaders/middlewares.mjs +0 -30
  199. package/dist/loaders/middlewares.mjs.map +0 -1
  200. package/dist/loaders/plugins/get-enabled-plugins.js +0 -113
  201. package/dist/loaders/plugins/get-enabled-plugins.js.map +0 -1
  202. package/dist/loaders/plugins/get-enabled-plugins.mjs +0 -111
  203. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +0 -1
  204. package/dist/loaders/plugins/get-user-plugins-config.js +0 -27
  205. package/dist/loaders/plugins/get-user-plugins-config.js.map +0 -1
  206. package/dist/loaders/plugins/get-user-plugins-config.mjs +0 -25
  207. package/dist/loaders/plugins/get-user-plugins-config.mjs.map +0 -1
  208. package/dist/loaders/plugins/index.js +0 -118
  209. package/dist/loaders/plugins/index.js.map +0 -1
  210. package/dist/loaders/plugins/index.mjs +0 -117
  211. package/dist/loaders/plugins/index.mjs.map +0 -1
  212. package/dist/loaders/policies.js +0 -25
  213. package/dist/loaders/policies.js.map +0 -1
  214. package/dist/loaders/policies.mjs +0 -24
  215. package/dist/loaders/policies.mjs.map +0 -1
  216. package/dist/loaders/sanitizers.js +0 -6
  217. package/dist/loaders/sanitizers.js.map +0 -1
  218. package/dist/loaders/sanitizers.mjs +0 -7
  219. package/dist/loaders/sanitizers.mjs.map +0 -1
  220. package/dist/loaders/src-index.js +0 -33
  221. package/dist/loaders/src-index.js.map +0 -1
  222. package/dist/loaders/src-index.mjs +0 -34
  223. package/dist/loaders/src-index.mjs.map +0 -1
  224. package/dist/loaders/validators.js +0 -6
  225. package/dist/loaders/validators.js.map +0 -1
  226. package/dist/loaders/validators.mjs +0 -7
  227. package/dist/loaders/validators.mjs.map +0 -1
  228. package/dist/middlewares/body.js +0 -65
  229. package/dist/middlewares/body.js.map +0 -1
  230. package/dist/middlewares/body.mjs +0 -61
  231. package/dist/middlewares/body.mjs.map +0 -1
  232. package/dist/middlewares/compression.js +0 -8
  233. package/dist/middlewares/compression.js.map +0 -1
  234. package/dist/middlewares/compression.mjs +0 -6
  235. package/dist/middlewares/compression.mjs.map +0 -1
  236. package/dist/middlewares/cors.js +0 -49
  237. package/dist/middlewares/cors.js.map +0 -1
  238. package/dist/middlewares/cors.mjs +0 -47
  239. package/dist/middlewares/cors.mjs.map +0 -1
  240. package/dist/middlewares/errors.js +0 -33
  241. package/dist/middlewares/errors.js.map +0 -1
  242. package/dist/middlewares/errors.mjs +0 -33
  243. package/dist/middlewares/errors.mjs.map +0 -1
  244. package/dist/middlewares/favicon.js +0 -22
  245. package/dist/middlewares/favicon.js.map +0 -1
  246. package/dist/middlewares/favicon.mjs +0 -20
  247. package/dist/middlewares/favicon.mjs.map +0 -1
  248. package/dist/middlewares/index.js +0 -34
  249. package/dist/middlewares/index.js.map +0 -1
  250. package/dist/middlewares/index.mjs +0 -34
  251. package/dist/middlewares/index.mjs.map +0 -1
  252. package/dist/middlewares/ip.js +0 -8
  253. package/dist/middlewares/ip.js.map +0 -1
  254. package/dist/middlewares/ip.mjs +0 -6
  255. package/dist/middlewares/ip.mjs.map +0 -1
  256. package/dist/middlewares/logger.js +0 -12
  257. package/dist/middlewares/logger.js.map +0 -1
  258. package/dist/middlewares/logger.mjs +0 -12
  259. package/dist/middlewares/logger.mjs.map +0 -1
  260. package/dist/middlewares/powered-by.js +0 -14
  261. package/dist/middlewares/powered-by.js.map +0 -1
  262. package/dist/middlewares/powered-by.mjs +0 -14
  263. package/dist/middlewares/powered-by.mjs.map +0 -1
  264. package/dist/middlewares/public.js +0 -34
  265. package/dist/middlewares/public.js.map +0 -1
  266. package/dist/middlewares/public.mjs +0 -32
  267. package/dist/middlewares/public.mjs.map +0 -1
  268. package/dist/middlewares/query.js +0 -40
  269. package/dist/middlewares/query.js.map +0 -1
  270. package/dist/middlewares/query.mjs +0 -38
  271. package/dist/middlewares/query.mjs.map +0 -1
  272. package/dist/middlewares/response-time.js +0 -12
  273. package/dist/middlewares/response-time.js.map +0 -1
  274. package/dist/middlewares/response-time.mjs +0 -12
  275. package/dist/middlewares/response-time.mjs.map +0 -1
  276. package/dist/middlewares/responses.js +0 -15
  277. package/dist/middlewares/responses.js.map +0 -1
  278. package/dist/middlewares/responses.mjs +0 -15
  279. package/dist/middlewares/responses.mjs.map +0 -1
  280. package/dist/middlewares/security.js +0 -78
  281. package/dist/middlewares/security.js.map +0 -1
  282. package/dist/middlewares/security.mjs +0 -76
  283. package/dist/middlewares/security.mjs.map +0 -1
  284. package/dist/middlewares/session.js +0 -30
  285. package/dist/middlewares/session.js.map +0 -1
  286. package/dist/middlewares/session.mjs +0 -28
  287. package/dist/middlewares/session.mjs.map +0 -1
  288. package/dist/migrations/database/5.0.0-discard-drafts.js +0 -50
  289. package/dist/migrations/database/5.0.0-discard-drafts.js.map +0 -1
  290. package/dist/migrations/database/5.0.0-discard-drafts.mjs +0 -50
  291. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +0 -1
  292. package/dist/migrations/draft-publish.js +0 -42
  293. package/dist/migrations/draft-publish.js.map +0 -1
  294. package/dist/migrations/draft-publish.mjs +0 -42
  295. package/dist/migrations/draft-publish.mjs.map +0 -1
  296. package/dist/providers/admin.js +0 -20
  297. package/dist/providers/admin.js.map +0 -1
  298. package/dist/providers/admin.mjs +0 -21
  299. package/dist/providers/admin.mjs.map +0 -1
  300. package/dist/providers/coreStore.js +0 -11
  301. package/dist/providers/coreStore.js.map +0 -1
  302. package/dist/providers/coreStore.mjs +0 -12
  303. package/dist/providers/coreStore.mjs.map +0 -1
  304. package/dist/providers/cron.js +0 -20
  305. package/dist/providers/cron.js.map +0 -1
  306. package/dist/providers/cron.mjs +0 -21
  307. package/dist/providers/cron.mjs.map +0 -1
  308. package/dist/providers/index.js +0 -11
  309. package/dist/providers/index.js.map +0 -1
  310. package/dist/providers/index.mjs +0 -11
  311. package/dist/providers/index.mjs.map +0 -1
  312. package/dist/providers/provider.js +0 -5
  313. package/dist/providers/provider.js.map +0 -1
  314. package/dist/providers/provider.mjs +0 -5
  315. package/dist/providers/provider.mjs.map +0 -1
  316. package/dist/providers/registries.js +0 -35
  317. package/dist/providers/registries.js.map +0 -1
  318. package/dist/providers/registries.mjs +0 -36
  319. package/dist/providers/registries.mjs.map +0 -1
  320. package/dist/providers/telemetry.js +0 -19
  321. package/dist/providers/telemetry.js.map +0 -1
  322. package/dist/providers/telemetry.mjs +0 -20
  323. package/dist/providers/telemetry.mjs.map +0 -1
  324. package/dist/providers/webhooks.js +0 -30
  325. package/dist/providers/webhooks.js.map +0 -1
  326. package/dist/providers/webhooks.mjs +0 -31
  327. package/dist/providers/webhooks.mjs.map +0 -1
  328. package/dist/registries/apis.js +0 -23
  329. package/dist/registries/apis.js.map +0 -1
  330. package/dist/registries/apis.mjs +0 -24
  331. package/dist/registries/apis.mjs.map +0 -1
  332. package/dist/registries/components.js +0 -45
  333. package/dist/registries/components.js.map +0 -1
  334. package/dist/registries/components.mjs +0 -46
  335. package/dist/registries/components.mjs.map +0 -1
  336. package/dist/registries/content-types.js +0 -70
  337. package/dist/registries/content-types.js.map +0 -1
  338. package/dist/registries/content-types.mjs +0 -71
  339. package/dist/registries/content-types.mjs.map +0 -1
  340. package/dist/registries/controllers.js +0 -80
  341. package/dist/registries/controllers.js.map +0 -1
  342. package/dist/registries/controllers.mjs +0 -81
  343. package/dist/registries/controllers.mjs.map +0 -1
  344. package/dist/registries/custom-fields.js +0 -71
  345. package/dist/registries/custom-fields.js.map +0 -1
  346. package/dist/registries/custom-fields.mjs +0 -72
  347. package/dist/registries/custom-fields.mjs.map +0 -1
  348. package/dist/registries/hooks.js +0 -58
  349. package/dist/registries/hooks.js.map +0 -1
  350. package/dist/registries/hooks.mjs +0 -59
  351. package/dist/registries/hooks.mjs.map +0 -1
  352. package/dist/registries/middlewares.js +0 -60
  353. package/dist/registries/middlewares.js.map +0 -1
  354. package/dist/registries/middlewares.mjs +0 -61
  355. package/dist/registries/middlewares.mjs.map +0 -1
  356. package/dist/registries/models.js +0 -16
  357. package/dist/registries/models.js.map +0 -1
  358. package/dist/registries/models.mjs +0 -16
  359. package/dist/registries/models.mjs.map +0 -1
  360. package/dist/registries/modules.js +0 -39
  361. package/dist/registries/modules.js.map +0 -1
  362. package/dist/registries/modules.mjs +0 -40
  363. package/dist/registries/modules.mjs.map +0 -1
  364. package/dist/registries/namespace.js +0 -27
  365. package/dist/registries/namespace.js.map +0 -1
  366. package/dist/registries/namespace.mjs +0 -27
  367. package/dist/registries/namespace.mjs.map +0 -1
  368. package/dist/registries/plugins.js +0 -23
  369. package/dist/registries/plugins.js.map +0 -1
  370. package/dist/registries/plugins.mjs +0 -24
  371. package/dist/registries/plugins.mjs.map +0 -1
  372. package/dist/registries/policies.js +0 -108
  373. package/dist/registries/policies.js.map +0 -1
  374. package/dist/registries/policies.mjs +0 -109
  375. package/dist/registries/policies.mjs.map +0 -1
  376. package/dist/registries/sanitizers.js +0 -25
  377. package/dist/registries/sanitizers.js.map +0 -1
  378. package/dist/registries/sanitizers.mjs +0 -24
  379. package/dist/registries/sanitizers.mjs.map +0 -1
  380. package/dist/registries/services.js +0 -80
  381. package/dist/registries/services.js.map +0 -1
  382. package/dist/registries/services.mjs +0 -81
  383. package/dist/registries/services.mjs.map +0 -1
  384. package/dist/registries/validators.js +0 -25
  385. package/dist/registries/validators.js.map +0 -1
  386. package/dist/registries/validators.mjs +0 -24
  387. package/dist/registries/validators.mjs.map +0 -1
  388. package/dist/services/auth/index.js +0 -81
  389. package/dist/services/auth/index.js.map +0 -1
  390. package/dist/services/auth/index.mjs +0 -80
  391. package/dist/services/auth/index.mjs.map +0 -1
  392. package/dist/services/config.js +0 -47
  393. package/dist/services/config.js.map +0 -1
  394. package/dist/services/config.mjs +0 -47
  395. package/dist/services/config.mjs.map +0 -1
  396. package/dist/services/content-api/index.js +0 -85
  397. package/dist/services/content-api/index.js.map +0 -1
  398. package/dist/services/content-api/index.mjs +0 -84
  399. package/dist/services/content-api/index.mjs.map +0 -1
  400. package/dist/services/content-api/permissions/engine.js +0 -7
  401. package/dist/services/content-api/permissions/engine.js.map +0 -1
  402. package/dist/services/content-api/permissions/engine.mjs +0 -6
  403. package/dist/services/content-api/permissions/engine.mjs.map +0 -1
  404. package/dist/services/content-api/permissions/index.js +0 -87
  405. package/dist/services/content-api/permissions/index.js.map +0 -1
  406. package/dist/services/content-api/permissions/index.mjs +0 -86
  407. package/dist/services/content-api/permissions/index.mjs.map +0 -1
  408. package/dist/services/content-api/permissions/providers/action.js +0 -16
  409. package/dist/services/content-api/permissions/providers/action.js.map +0 -1
  410. package/dist/services/content-api/permissions/providers/action.mjs +0 -17
  411. package/dist/services/content-api/permissions/providers/action.mjs.map +0 -1
  412. package/dist/services/content-api/permissions/providers/condition.js +0 -16
  413. package/dist/services/content-api/permissions/providers/condition.js.map +0 -1
  414. package/dist/services/content-api/permissions/providers/condition.mjs +0 -17
  415. package/dist/services/content-api/permissions/providers/condition.mjs.map +0 -1
  416. package/dist/services/core-store.js +0 -107
  417. package/dist/services/core-store.js.map +0 -1
  418. package/dist/services/core-store.mjs +0 -107
  419. package/dist/services/core-store.mjs.map +0 -1
  420. package/dist/services/cron.js +0 -63
  421. package/dist/services/cron.js.map +0 -1
  422. package/dist/services/cron.mjs +0 -64
  423. package/dist/services/cron.mjs.map +0 -1
  424. package/dist/services/custom-fields.js +0 -10
  425. package/dist/services/custom-fields.js.map +0 -1
  426. package/dist/services/custom-fields.mjs +0 -11
  427. package/dist/services/custom-fields.mjs.map +0 -1
  428. package/dist/services/document-service/attributes/index.js +0 -22
  429. package/dist/services/document-service/attributes/index.js.map +0 -1
  430. package/dist/services/document-service/attributes/index.mjs +0 -22
  431. package/dist/services/document-service/attributes/index.mjs.map +0 -1
  432. package/dist/services/document-service/attributes/transforms.js +0 -20
  433. package/dist/services/document-service/attributes/transforms.js.map +0 -1
  434. package/dist/services/document-service/attributes/transforms.mjs +0 -19
  435. package/dist/services/document-service/attributes/transforms.mjs.map +0 -1
  436. package/dist/services/document-service/common.js +0 -7
  437. package/dist/services/document-service/common.js.map +0 -1
  438. package/dist/services/document-service/common.mjs +0 -7
  439. package/dist/services/document-service/common.mjs.map +0 -1
  440. package/dist/services/document-service/components.js +0 -288
  441. package/dist/services/document-service/components.js.map +0 -1
  442. package/dist/services/document-service/components.mjs +0 -286
  443. package/dist/services/document-service/components.mjs.map +0 -1
  444. package/dist/services/document-service/draft-and-publish.js +0 -69
  445. package/dist/services/document-service/draft-and-publish.js.map +0 -1
  446. package/dist/services/document-service/draft-and-publish.mjs +0 -69
  447. package/dist/services/document-service/draft-and-publish.mjs.map +0 -1
  448. package/dist/services/document-service/entries.js +0 -96
  449. package/dist/services/document-service/entries.js.map +0 -1
  450. package/dist/services/document-service/entries.mjs +0 -96
  451. package/dist/services/document-service/entries.mjs.map +0 -1
  452. package/dist/services/document-service/events.js +0 -47
  453. package/dist/services/document-service/events.js.map +0 -1
  454. package/dist/services/document-service/events.mjs +0 -47
  455. package/dist/services/document-service/events.mjs.map +0 -1
  456. package/dist/services/document-service/index.js +0 -35
  457. package/dist/services/document-service/index.js.map +0 -1
  458. package/dist/services/document-service/index.mjs +0 -35
  459. package/dist/services/document-service/index.mjs.map +0 -1
  460. package/dist/services/document-service/internationalization.js +0 -63
  461. package/dist/services/document-service/internationalization.js.map +0 -1
  462. package/dist/services/document-service/internationalization.mjs +0 -63
  463. package/dist/services/document-service/internationalization.mjs.map +0 -1
  464. package/dist/services/document-service/middlewares/errors.js +0 -25
  465. package/dist/services/document-service/middlewares/errors.js.map +0 -1
  466. package/dist/services/document-service/middlewares/errors.mjs +0 -25
  467. package/dist/services/document-service/middlewares/errors.mjs.map +0 -1
  468. package/dist/services/document-service/middlewares/middleware-manager.js +0 -49
  469. package/dist/services/document-service/middlewares/middleware-manager.js.map +0 -1
  470. package/dist/services/document-service/middlewares/middleware-manager.mjs +0 -49
  471. package/dist/services/document-service/middlewares/middleware-manager.mjs.map +0 -1
  472. package/dist/services/document-service/params.js +0 -8
  473. package/dist/services/document-service/params.js.map +0 -1
  474. package/dist/services/document-service/params.mjs +0 -8
  475. package/dist/services/document-service/params.mjs.map +0 -1
  476. package/dist/services/document-service/repository.js +0 -278
  477. package/dist/services/document-service/repository.js.map +0 -1
  478. package/dist/services/document-service/repository.mjs +0 -278
  479. package/dist/services/document-service/repository.mjs.map +0 -1
  480. package/dist/services/document-service/transform/data.js +0 -15
  481. package/dist/services/document-service/transform/data.js.map +0 -1
  482. package/dist/services/document-service/transform/data.mjs +0 -15
  483. package/dist/services/document-service/transform/data.mjs.map +0 -1
  484. package/dist/services/document-service/transform/fields.js +0 -24
  485. package/dist/services/document-service/transform/fields.js.map +0 -1
  486. package/dist/services/document-service/transform/fields.mjs +0 -24
  487. package/dist/services/document-service/transform/fields.mjs.map +0 -1
  488. package/dist/services/document-service/transform/id-map.js +0 -78
  489. package/dist/services/document-service/transform/id-map.js.map +0 -1
  490. package/dist/services/document-service/transform/id-map.mjs +0 -78
  491. package/dist/services/document-service/transform/id-map.mjs.map +0 -1
  492. package/dist/services/document-service/transform/id-transform.js +0 -33
  493. package/dist/services/document-service/transform/id-transform.js.map +0 -1
  494. package/dist/services/document-service/transform/id-transform.mjs +0 -33
  495. package/dist/services/document-service/transform/id-transform.mjs.map +0 -1
  496. package/dist/services/document-service/transform/populate.js +0 -21
  497. package/dist/services/document-service/transform/populate.js.map +0 -1
  498. package/dist/services/document-service/transform/populate.mjs +0 -21
  499. package/dist/services/document-service/transform/populate.mjs.map +0 -1
  500. package/dist/services/document-service/transform/query.js +0 -9
  501. package/dist/services/document-service/transform/query.js.map +0 -1
  502. package/dist/services/document-service/transform/query.mjs +0 -9
  503. package/dist/services/document-service/transform/query.mjs.map +0 -1
  504. package/dist/services/document-service/transform/relations/extract/data-ids.js +0 -57
  505. package/dist/services/document-service/transform/relations/extract/data-ids.js.map +0 -1
  506. package/dist/services/document-service/transform/relations/extract/data-ids.mjs +0 -57
  507. package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +0 -1
  508. package/dist/services/document-service/transform/relations/transform/data-ids.js +0 -76
  509. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +0 -1
  510. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +0 -76
  511. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +0 -1
  512. package/dist/services/document-service/transform/relations/transform/default-locale.js +0 -32
  513. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +0 -1
  514. package/dist/services/document-service/transform/relations/transform/default-locale.mjs +0 -32
  515. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +0 -1
  516. package/dist/services/document-service/transform/relations/utils/dp.js +0 -30
  517. package/dist/services/document-service/transform/relations/utils/dp.js.map +0 -1
  518. package/dist/services/document-service/transform/relations/utils/dp.mjs +0 -30
  519. package/dist/services/document-service/transform/relations/utils/dp.mjs.map +0 -1
  520. package/dist/services/document-service/transform/relations/utils/i18n.js +0 -25
  521. package/dist/services/document-service/transform/relations/utils/i18n.js.map +0 -1
  522. package/dist/services/document-service/transform/relations/utils/i18n.mjs +0 -25
  523. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +0 -1
  524. package/dist/services/document-service/transform/relations/utils/map-relation.js +0 -91
  525. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +0 -1
  526. package/dist/services/document-service/transform/relations/utils/map-relation.mjs +0 -91
  527. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +0 -1
  528. package/dist/services/document-service/utils/populate.js +0 -41
  529. package/dist/services/document-service/utils/populate.js.map +0 -1
  530. package/dist/services/document-service/utils/populate.mjs +0 -41
  531. package/dist/services/document-service/utils/populate.mjs.map +0 -1
  532. package/dist/services/entity-service/index.js +0 -169
  533. package/dist/services/entity-service/index.js.map +0 -1
  534. package/dist/services/entity-service/index.mjs +0 -167
  535. package/dist/services/entity-service/index.mjs.map +0 -1
  536. package/dist/services/entity-validator/blocks-validator.js +0 -127
  537. package/dist/services/entity-validator/blocks-validator.js.map +0 -1
  538. package/dist/services/entity-validator/blocks-validator.mjs +0 -128
  539. package/dist/services/entity-validator/blocks-validator.mjs.map +0 -1
  540. package/dist/services/entity-validator/index.js +0 -333
  541. package/dist/services/entity-validator/index.js.map +0 -1
  542. package/dist/services/entity-validator/index.mjs +0 -332
  543. package/dist/services/entity-validator/index.mjs.map +0 -1
  544. package/dist/services/entity-validator/validators.js +0 -126
  545. package/dist/services/entity-validator/validators.js.map +0 -1
  546. package/dist/services/entity-validator/validators.mjs +0 -124
  547. package/dist/services/entity-validator/validators.mjs.map +0 -1
  548. package/dist/services/errors.js +0 -76
  549. package/dist/services/errors.js.map +0 -1
  550. package/dist/services/errors.mjs +0 -74
  551. package/dist/services/errors.mjs.map +0 -1
  552. package/dist/services/event-hub.js +0 -72
  553. package/dist/services/event-hub.js.map +0 -1
  554. package/dist/services/event-hub.mjs +0 -73
  555. package/dist/services/event-hub.mjs.map +0 -1
  556. package/dist/services/features.js +0 -17
  557. package/dist/services/features.js.map +0 -1
  558. package/dist/services/features.mjs +0 -17
  559. package/dist/services/features.mjs.map +0 -1
  560. package/dist/services/fs.js +0 -51
  561. package/dist/services/fs.js.map +0 -1
  562. package/dist/services/fs.mjs +0 -49
  563. package/dist/services/fs.mjs.map +0 -1
  564. package/dist/services/metrics/admin-user-hash.js +0 -14
  565. package/dist/services/metrics/admin-user-hash.js.map +0 -1
  566. package/dist/services/metrics/admin-user-hash.mjs +0 -12
  567. package/dist/services/metrics/admin-user-hash.mjs.map +0 -1
  568. package/dist/services/metrics/index.js +0 -45
  569. package/dist/services/metrics/index.js.map +0 -1
  570. package/dist/services/metrics/index.mjs +0 -46
  571. package/dist/services/metrics/index.mjs.map +0 -1
  572. package/dist/services/metrics/is-truthy.js +0 -9
  573. package/dist/services/metrics/is-truthy.js.map +0 -1
  574. package/dist/services/metrics/is-truthy.mjs +0 -8
  575. package/dist/services/metrics/is-truthy.mjs.map +0 -1
  576. package/dist/services/metrics/middleware.js +0 -25
  577. package/dist/services/metrics/middleware.js.map +0 -1
  578. package/dist/services/metrics/middleware.mjs +0 -26
  579. package/dist/services/metrics/middleware.mjs.map +0 -1
  580. package/dist/services/metrics/rate-limiter.js +0 -21
  581. package/dist/services/metrics/rate-limiter.js.map +0 -1
  582. package/dist/services/metrics/rate-limiter.mjs +0 -22
  583. package/dist/services/metrics/rate-limiter.mjs.map +0 -1
  584. package/dist/services/metrics/sender.js +0 -76
  585. package/dist/services/metrics/sender.js.map +0 -1
  586. package/dist/services/metrics/sender.mjs +0 -70
  587. package/dist/services/metrics/sender.mjs.map +0 -1
  588. package/dist/services/query-params.js +0 -12
  589. package/dist/services/query-params.js.map +0 -1
  590. package/dist/services/query-params.mjs +0 -13
  591. package/dist/services/query-params.mjs.map +0 -1
  592. package/dist/services/reloader.js +0 -36
  593. package/dist/services/reloader.js.map +0 -1
  594. package/dist/services/reloader.mjs +0 -36
  595. package/dist/services/reloader.mjs.map +0 -1
  596. package/dist/services/request-context.js +0 -13
  597. package/dist/services/request-context.js.map +0 -1
  598. package/dist/services/request-context.mjs +0 -14
  599. package/dist/services/request-context.mjs.map +0 -1
  600. package/dist/services/server/admin-api.js +0 -13
  601. package/dist/services/server/admin-api.js.map +0 -1
  602. package/dist/services/server/admin-api.mjs +0 -13
  603. package/dist/services/server/admin-api.mjs.map +0 -1
  604. package/dist/services/server/api.js +0 -30
  605. package/dist/services/server/api.js.map +0 -1
  606. package/dist/services/server/api.mjs +0 -28
  607. package/dist/services/server/api.mjs.map +0 -1
  608. package/dist/services/server/compose-endpoint.js +0 -117
  609. package/dist/services/server/compose-endpoint.js.map +0 -1
  610. package/dist/services/server/compose-endpoint.mjs +0 -116
  611. package/dist/services/server/compose-endpoint.mjs.map +0 -1
  612. package/dist/services/server/content-api.js +0 -12
  613. package/dist/services/server/content-api.js.map +0 -1
  614. package/dist/services/server/content-api.mjs +0 -12
  615. package/dist/services/server/content-api.mjs.map +0 -1
  616. package/dist/services/server/http-server.js +0 -50
  617. package/dist/services/server/http-server.js.map +0 -1
  618. package/dist/services/server/http-server.mjs +0 -48
  619. package/dist/services/server/http-server.mjs.map +0 -1
  620. package/dist/services/server/index.js +0 -87
  621. package/dist/services/server/index.js.map +0 -1
  622. package/dist/services/server/index.mjs +0 -85
  623. package/dist/services/server/index.mjs.map +0 -1
  624. package/dist/services/server/koa.js +0 -52
  625. package/dist/services/server/koa.js.map +0 -1
  626. package/dist/services/server/koa.mjs +0 -48
  627. package/dist/services/server/koa.mjs.map +0 -1
  628. package/dist/services/server/middleware.js +0 -92
  629. package/dist/services/server/middleware.js.map +0 -1
  630. package/dist/services/server/middleware.mjs +0 -90
  631. package/dist/services/server/middleware.mjs.map +0 -1
  632. package/dist/services/server/policy.js +0 -20
  633. package/dist/services/server/policy.js.map +0 -1
  634. package/dist/services/server/policy.mjs +0 -20
  635. package/dist/services/server/policy.mjs.map +0 -1
  636. package/dist/services/server/register-middlewares.js +0 -72
  637. package/dist/services/server/register-middlewares.js.map +0 -1
  638. package/dist/services/server/register-middlewares.mjs +0 -73
  639. package/dist/services/server/register-middlewares.mjs.map +0 -1
  640. package/dist/services/server/register-routes.js +0 -76
  641. package/dist/services/server/register-routes.js.map +0 -1
  642. package/dist/services/server/register-routes.mjs +0 -75
  643. package/dist/services/server/register-routes.mjs.map +0 -1
  644. package/dist/services/server/routing.js +0 -91
  645. package/dist/services/server/routing.js.map +0 -1
  646. package/dist/services/server/routing.mjs +0 -89
  647. package/dist/services/server/routing.mjs.map +0 -1
  648. package/dist/services/utils/dynamic-zones.js +0 -17
  649. package/dist/services/utils/dynamic-zones.js.map +0 -1
  650. package/dist/services/utils/dynamic-zones.mjs +0 -18
  651. package/dist/services/utils/dynamic-zones.mjs.map +0 -1
  652. package/dist/services/webhook-runner.js +0 -133
  653. package/dist/services/webhook-runner.js.map +0 -1
  654. package/dist/services/webhook-runner.mjs +0 -131
  655. package/dist/services/webhook-runner.mjs.map +0 -1
  656. package/dist/services/webhook-store.js +0 -110
  657. package/dist/services/webhook-store.js.map +0 -1
  658. package/dist/services/webhook-store.mjs +0 -110
  659. package/dist/services/webhook-store.mjs.map +0 -1
  660. package/dist/services/worker-queue.js +0 -56
  661. package/dist/services/worker-queue.js.map +0 -1
  662. package/dist/services/worker-queue.mjs +0 -55
  663. package/dist/services/worker-queue.mjs.map +0 -1
  664. package/dist/utils/convert-custom-field-type.js +0 -24
  665. package/dist/utils/convert-custom-field-type.js.map +0 -1
  666. package/dist/utils/convert-custom-field-type.mjs +0 -24
  667. package/dist/utils/convert-custom-field-type.mjs.map +0 -1
  668. package/dist/utils/cron.js +0 -38
  669. package/dist/utils/cron.js.map +0 -1
  670. package/dist/utils/cron.mjs +0 -38
  671. package/dist/utils/cron.mjs.map +0 -1
  672. package/dist/utils/fetch.js +0 -20
  673. package/dist/utils/fetch.js.map +0 -1
  674. package/dist/utils/fetch.mjs +0 -20
  675. package/dist/utils/fetch.mjs.map +0 -1
  676. package/dist/utils/filepath-to-prop-path.js +0 -12
  677. package/dist/utils/filepath-to-prop-path.js.map +0 -1
  678. package/dist/utils/filepath-to-prop-path.mjs +0 -10
  679. package/dist/utils/filepath-to-prop-path.mjs.map +0 -1
  680. package/dist/utils/is-initialized.js +0 -16
  681. package/dist/utils/is-initialized.js.map +0 -1
  682. package/dist/utils/is-initialized.mjs +0 -16
  683. package/dist/utils/is-initialized.mjs.map +0 -1
  684. package/dist/utils/lifecycles.js +0 -9
  685. package/dist/utils/lifecycles.js.map +0 -1
  686. package/dist/utils/lifecycles.mjs +0 -9
  687. package/dist/utils/lifecycles.mjs.map +0 -1
  688. package/dist/utils/load-config-file.js +0 -45
  689. package/dist/utils/load-config-file.js.map +0 -1
  690. package/dist/utils/load-config-file.mjs +0 -42
  691. package/dist/utils/load-config-file.mjs.map +0 -1
  692. package/dist/utils/load-files.js +0 -39
  693. package/dist/utils/load-files.js.map +0 -1
  694. package/dist/utils/load-files.mjs +0 -35
  695. package/dist/utils/load-files.mjs.map +0 -1
  696. package/dist/utils/open-browser.js +0 -11
  697. package/dist/utils/open-browser.js.map +0 -1
  698. package/dist/utils/open-browser.mjs +0 -9
  699. package/dist/utils/open-browser.mjs.map +0 -1
  700. package/dist/utils/resolve-working-dirs.js +0 -13
  701. package/dist/utils/resolve-working-dirs.js.map +0 -1
  702. package/dist/utils/resolve-working-dirs.mjs +0 -11
  703. package/dist/utils/resolve-working-dirs.mjs.map +0 -1
  704. package/dist/utils/signals.js +0 -17
  705. package/dist/utils/signals.js.map +0 -1
  706. package/dist/utils/signals.mjs +0 -17
  707. package/dist/utils/signals.mjs.map +0 -1
  708. package/dist/utils/startup-logger.js +0 -81
  709. package/dist/utils/startup-logger.js.map +0 -1
  710. package/dist/utils/startup-logger.mjs +0 -77
  711. package/dist/utils/startup-logger.mjs.map +0 -1
  712. package/dist/utils/transform-content-types-to-models.js +0 -285
  713. package/dist/utils/transform-content-types-to-models.js.map +0 -1
  714. package/dist/utils/transform-content-types-to-models.mjs +0 -282
  715. package/dist/utils/transform-content-types-to-models.mjs.map +0 -1
  716. package/dist/utils/update-notifier/index.js +0 -85
  717. package/dist/utils/update-notifier/index.js.map +0 -1
  718. package/dist/utils/update-notifier/index.mjs +0 -78
  719. package/dist/utils/update-notifier/index.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"validators.mjs","sources":["../../../src/services/entity-validator/validators.ts"],"sourcesContent":["import _ from 'lodash';\nimport strapiUtils from '@strapi/utils';\nimport type { Schema, Struct } from '@strapi/types';\nimport blocksValidator from './blocks-validator';\n\nconst { yup } = strapiUtils;\n\ninterface ValidatorMetas<TAttribute extends Schema.Attribute.AnyAttribute> {\n attr: TAttribute;\n model: Struct.ContentTypeSchema;\n updatedAttribute: { name: string; value: unknown };\n entity: Record<string, unknown> | null;\n}\n\ninterface ValidatorOptions {\n isDraft: boolean;\n locale?: string;\n}\n\n/* Validator utils */\n\n/**\n * Adds minLength validator\n */\nconst addMinLengthValidator = (\n validator: strapiUtils.yup.StringSchema,\n {\n attr,\n }: {\n attr:\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID;\n },\n { isDraft }: ValidatorOptions\n) => {\n return attr.minLength && _.isInteger(attr.minLength) && !isDraft\n ? validator.min(attr.minLength)\n : validator;\n};\n\n/**\n * Adds maxLength validator\n * @returns {StringSchema}\n */\nconst addMaxLengthValidator = (\n validator: strapiUtils.yup.StringSchema,\n {\n attr,\n }: {\n attr:\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID;\n }\n) => {\n return attr.maxLength && _.isInteger(attr.maxLength) ? validator.max(attr.maxLength) : validator;\n};\n\n/**\n * Adds min integer validator\n * @returns {NumberSchema}\n */\nconst addMinIntegerValidator = (\n validator: strapiUtils.yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Integer | Schema.Attribute.BigInteger;\n }\n) => (_.isNumber(attr.min) ? validator.min(_.toInteger(attr.min)) : validator);\n\n/**\n * Adds max integer validator\n */\nconst addMaxIntegerValidator = (\n validator: strapiUtils.yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Integer | Schema.Attribute.BigInteger;\n }\n) => (_.isNumber(attr.max) ? validator.max(_.toInteger(attr.max)) : validator);\n\n/**\n * Adds min float/decimal validator\n */\nconst addMinFloatValidator = (\n validator: strapiUtils.yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Decimal | Schema.Attribute.Float;\n }\n) => (_.isNumber(attr.min) ? validator.min(attr.min) : validator);\n\n/**\n * Adds max float/decimal validator\n */\nconst addMaxFloatValidator = (\n validator: strapiUtils.yup.NumberSchema,\n {\n attr,\n }: {\n attr: Schema.Attribute.Decimal | Schema.Attribute.Float;\n }\n) => (_.isNumber(attr.max) ? validator.max(attr.max) : validator);\n\n/**\n * Adds regex validator\n */\nconst addStringRegexValidator = (\n validator: strapiUtils.yup.StringSchema,\n {\n attr,\n }: {\n attr:\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID;\n }\n) => {\n return 'regex' in attr && !_.isUndefined(attr.regex)\n ? validator.matches(new RegExp(attr.regex), { excludeEmptyString: !attr.required })\n : validator;\n};\n\n/**\n * Adds unique validator\n */\nconst addUniqueValidator = <T extends strapiUtils.yup.AnySchema>(\n validator: T,\n {\n attr,\n model,\n updatedAttribute,\n entity,\n }: ValidatorMetas<Schema.Attribute.AnyAttribute & Schema.Attribute.UniqueOption>,\n options: ValidatorOptions\n): T => {\n if (attr.type !== 'uid' && !attr.unique) {\n return validator;\n }\n\n return validator.test('unique', 'This attribute must be unique', async (value) => {\n const isPublish = options.isDraft === false;\n\n /**\n * If the attribute value is `null` we want to skip the unique validation.\n * Otherwise it'll only accept a single `null` entry in the database.\n */\n if (_.isNil(value)) {\n return true;\n }\n\n /**\n * If we are updating a draft and the value is unchanged we skip the unique verification. This will\n * prevent the validator to be triggered in case the user activated the\n * unique constraint after already creating multiple entries with\n * the same attribute value for that field.\n */\n if (!isPublish && value === entity?.[updatedAttribute.name]) {\n return true;\n }\n\n /**\n * At this point we know that we are creating a new entry, publishing an entry or that the unique field value has changed\n * We check if there is an entry of this content type in the same locale, publication state and with the same unique field value\n */\n const record = await strapi.db.query(model.uid).findOne({\n where: {\n locale: options.locale,\n publishedAt: options.isDraft ? null : { $notNull: true },\n [updatedAttribute.name]: value,\n ...(entity?.id ? { id: { $ne: entity.id } } : {}),\n },\n });\n\n return !record;\n });\n};\n\n/* Type validators */\n\nconst stringValidator = (\n metas: ValidatorMetas<\n | Schema.Attribute.String\n | Schema.Attribute.Text\n | Schema.Attribute.RichText\n | Schema.Attribute.Password\n | Schema.Attribute.Email\n | Schema.Attribute.UID\n >,\n options: ValidatorOptions\n) => {\n let schema = yup.string().transform((val, originalVal) => originalVal);\n\n schema = addMinLengthValidator(schema, metas, options);\n schema = addMaxLengthValidator(schema, metas);\n schema = addStringRegexValidator(schema, metas);\n schema = addUniqueValidator(schema, metas, options);\n\n return schema;\n};\n\nconst emailValidator = (\n metas: ValidatorMetas<Schema.Attribute.Email>,\n options: ValidatorOptions\n) => {\n const schema = stringValidator(metas, options);\n return schema.email().min(1, '${path} cannot be empty');\n};\n\nconst uidValidator = (metas: ValidatorMetas<Schema.Attribute.UID>, options: ValidatorOptions) => {\n const schema = stringValidator(metas, options);\n\n return schema.matches(/^[A-Za-z0-9-_.~]*$/);\n};\n\nconst enumerationValidator = ({ attr }: { attr: Schema.Attribute.Enumeration }) => {\n return yup\n .string()\n .oneOf((Array.isArray(attr.enum) ? attr.enum : [attr.enum]).concat(null as any));\n};\n\nconst integerValidator = (\n metas: ValidatorMetas<Schema.Attribute.Integer | Schema.Attribute.BigInteger>,\n options: ValidatorOptions\n) => {\n let schema = yup.number().integer();\n\n schema = addMinIntegerValidator(schema, metas);\n schema = addMaxIntegerValidator(schema, metas);\n schema = addUniqueValidator(schema, metas, options);\n\n return schema;\n};\n\nconst floatValidator = (\n metas: ValidatorMetas<Schema.Attribute.Decimal | Schema.Attribute.Float>,\n options: ValidatorOptions\n) => {\n let schema = yup.number();\n schema = addMinFloatValidator(schema, metas);\n schema = addMaxFloatValidator(schema, metas);\n schema = addUniqueValidator(schema, metas, options);\n\n return schema;\n};\n\nconst bigintegerValidator = (\n metas: ValidatorMetas<Schema.Attribute.BigInteger>,\n options: ValidatorOptions\n) => {\n const schema = yup.mixed();\n return addUniqueValidator(schema, metas, options);\n};\n\nconst datesValidator = (\n metas: ValidatorMetas<\n | Schema.Attribute.Date\n | Schema.Attribute.DateTime\n | Schema.Attribute.Time\n | Schema.Attribute.Timestamp\n >,\n options: ValidatorOptions\n) => {\n const schema = yup.mixed();\n return addUniqueValidator(schema, metas, options);\n};\n\nexport default {\n string: stringValidator,\n text: stringValidator,\n richtext: stringValidator,\n password: stringValidator,\n email: emailValidator,\n enumeration: enumerationValidator,\n boolean: () => yup.boolean(),\n uid: uidValidator,\n json: () => yup.mixed(),\n integer: integerValidator,\n biginteger: bigintegerValidator,\n float: floatValidator,\n decimal: floatValidator,\n date: datesValidator,\n time: datesValidator,\n datetime: datesValidator,\n timestamp: datesValidator,\n blocks: blocksValidator,\n};\n"],"names":[],"mappings":";;;AAKA,MAAM,EAAE,IAAQ,IAAA;AAmBhB,MAAM,wBAAwB,CAC5B,WACA;AAAA,EACE;AACF,GASA,EAAE,cACC;AACH,SAAO,KAAK,aAAa,EAAE,UAAU,KAAK,SAAS,KAAK,CAAC,UACrD,UAAU,IAAI,KAAK,SAAS,IAC5B;AACN;AAMA,MAAM,wBAAwB,CAC5B,WACA;AAAA,EACE;AACF,MASG;AACI,SAAA,KAAK,aAAa,EAAE,UAAU,KAAK,SAAS,IAAI,UAAU,IAAI,KAAK,SAAS,IAAI;AACzF;AAMA,MAAM,yBAAyB,CAC7B,WACA;AAAA,EACE;AACF,MAGI,EAAE,SAAS,KAAK,GAAG,IAAI,UAAU,IAAI,EAAE,UAAU,KAAK,GAAG,CAAC,IAAI;AAKpE,MAAM,yBAAyB,CAC7B,WACA;AAAA,EACE;AACF,MAGI,EAAE,SAAS,KAAK,GAAG,IAAI,UAAU,IAAI,EAAE,UAAU,KAAK,GAAG,CAAC,IAAI;AAKpE,MAAM,uBAAuB,CAC3B,WACA;AAAA,EACE;AACF,MAGI,EAAE,SAAS,KAAK,GAAG,IAAI,UAAU,IAAI,KAAK,GAAG,IAAI;AAKvD,MAAM,uBAAuB,CAC3B,WACA;AAAA,EACE;AACF,MAGI,EAAE,SAAS,KAAK,GAAG,IAAI,UAAU,IAAI,KAAK,GAAG,IAAI;AAKvD,MAAM,0BAA0B,CAC9B,WACA;AAAA,EACE;AACF,MASG;AACI,SAAA,WAAW,QAAQ,CAAC,EAAE,YAAY,KAAK,KAAK,IAC/C,UAAU,QAAQ,IAAI,OAAO,KAAK,KAAK,GAAG,EAAE,oBAAoB,CAAC,KAAK,UAAU,IAChF;AACN;AAKA,MAAM,qBAAqB,CACzB,WACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACA,YACM;AACN,MAAI,KAAK,SAAS,SAAS,CAAC,KAAK,QAAQ;AAChC,WAAA;AAAA,EACT;AAEA,SAAO,UAAU,KAAK,UAAU,iCAAiC,OAAO,UAAU;AAC1E,UAAA,YAAY,QAAQ,YAAY;AAMlC,QAAA,EAAE,MAAM,KAAK,GAAG;AACX,aAAA;AAAA,IACT;AAQA,QAAI,CAAC,aAAa,UAAU,SAAS,iBAAiB,IAAI,GAAG;AACpD,aAAA;AAAA,IACT;AAMM,UAAA,SAAS,MAAM,OAAO,GAAG,MAAM,MAAM,GAAG,EAAE,QAAQ;AAAA,MACtD,OAAO;AAAA,QACL,QAAQ,QAAQ;AAAA,QAChB,aAAa,QAAQ,UAAU,OAAO,EAAE,UAAU,KAAK;AAAA,QACvD,CAAC,iBAAiB,IAAI,GAAG;AAAA,QACzB,GAAI,QAAQ,KAAK,EAAE,IAAI,EAAE,KAAK,OAAO,GAAK,EAAA,IAAI,CAAC;AAAA,MACjD;AAAA,IAAA,CACD;AAED,WAAO,CAAC;AAAA,EAAA,CACT;AACH;AAIA,MAAM,kBAAkB,CACtB,OAQA,YACG;AACC,MAAA,SAAS,IAAI,OAAO,EAAE,UAAU,CAAC,KAAK,gBAAgB,WAAW;AAE5D,WAAA,sBAAsB,QAAQ,OAAO,OAAO;AAC5C,WAAA,sBAAsB,QAAQ,KAAK;AACnC,WAAA,wBAAwB,QAAQ,KAAK;AACrC,WAAA,mBAAmB,QAAQ,OAAO,OAAO;AAE3C,SAAA;AACT;AAEA,MAAM,iBAAiB,CACrB,OACA,YACG;AACG,QAAA,SAAS,gBAAgB,OAAO,OAAO;AAC7C,SAAO,OAAO,MAAQ,EAAA,IAAI,GAAG,yBAAyB;AACxD;AAEA,MAAM,eAAe,CAAC,OAA6C,YAA8B;AACzF,QAAA,SAAS,gBAAgB,OAAO,OAAO;AAEtC,SAAA,OAAO,QAAQ,oBAAoB;AAC5C;AAEA,MAAM,uBAAuB,CAAC,EAAE,WAAmD;AACjF,SAAO,IACJ,SACA,OAAO,MAAM,QAAQ,KAAK,IAAI,IAAI,KAAK,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,IAAW,CAAC;AACnF;AAEA,MAAM,mBAAmB,CACvB,OACA,YACG;AACH,MAAI,SAAS,IAAI,OAAO,EAAE,QAAQ;AAEzB,WAAA,uBAAuB,QAAQ,KAAK;AACpC,WAAA,uBAAuB,QAAQ,KAAK;AACpC,WAAA,mBAAmB,QAAQ,OAAO,OAAO;AAE3C,SAAA;AACT;AAEA,MAAM,iBAAiB,CACrB,OACA,YACG;AACC,MAAA,SAAS,IAAI;AACR,WAAA,qBAAqB,QAAQ,KAAK;AAClC,WAAA,qBAAqB,QAAQ,KAAK;AAClC,WAAA,mBAAmB,QAAQ,OAAO,OAAO;AAE3C,SAAA;AACT;AAEA,MAAM,sBAAsB,CAC1B,OACA,YACG;AACG,QAAA,SAAS,IAAI;AACZ,SAAA,mBAAmB,QAAQ,OAAO,OAAO;AAClD;AAEA,MAAM,iBAAiB,CACrB,OAMA,YACG;AACG,QAAA,SAAS,IAAI;AACZ,SAAA,mBAAmB,QAAQ,OAAO,OAAO;AAClD;AAEA,MAAe,aAAA;AAAA,EACb,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS,MAAM,IAAI,QAAQ;AAAA,EAC3B,KAAK;AAAA,EACL,MAAM,MAAM,IAAI,MAAM;AAAA,EACtB,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AAAA,EACX,QAAQ;AACV;"}
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const createError = require("http-errors");
4
- const strapiUtils = require("@strapi/utils");
5
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
6
- const createError__default = /* @__PURE__ */ _interopDefault(createError);
7
- const mapErrorsAndStatus = [
8
- {
9
- classError: strapiUtils.errors.UnauthorizedError,
10
- status: 401
11
- },
12
- {
13
- classError: strapiUtils.errors.ForbiddenError,
14
- status: 403
15
- },
16
- {
17
- classError: strapiUtils.errors.NotFoundError,
18
- status: 404
19
- },
20
- {
21
- classError: strapiUtils.errors.PayloadTooLargeError,
22
- status: 413
23
- },
24
- {
25
- classError: strapiUtils.errors.RateLimitError,
26
- status: 429
27
- },
28
- {
29
- classError: strapiUtils.errors.NotImplementedError,
30
- status: 501
31
- }
32
- ];
33
- const formatApplicationError = (error) => {
34
- const errorAndStatus = mapErrorsAndStatus.find((pair) => error instanceof pair.classError);
35
- const status = errorAndStatus ? errorAndStatus.status : 400;
36
- return {
37
- status,
38
- body: {
39
- data: null,
40
- error: {
41
- status,
42
- name: error.name,
43
- message: error.message,
44
- details: error.details
45
- }
46
- }
47
- };
48
- };
49
- const formatHttpError = (error) => {
50
- return {
51
- status: error.status,
52
- body: {
53
- data: null,
54
- error: {
55
- status: error.status,
56
- name: error.name,
57
- message: error.message,
58
- details: error.details
59
- }
60
- }
61
- };
62
- };
63
- const formatInternalError = (error) => {
64
- if (!(error instanceof Error)) {
65
- return formatHttpError(createError__default.default(500));
66
- }
67
- const httpError = createError__default.default(error);
68
- if (httpError.expose) {
69
- return formatHttpError(httpError);
70
- }
71
- return formatHttpError(createError__default.default(httpError.status || 500));
72
- };
73
- exports.formatApplicationError = formatApplicationError;
74
- exports.formatHttpError = formatHttpError;
75
- exports.formatInternalError = formatInternalError;
76
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sources":["../../src/services/errors.ts"],"sourcesContent":["import createError from 'http-errors';\nimport { errors } from '@strapi/utils';\n\nconst mapErrorsAndStatus = [\n {\n classError: errors.UnauthorizedError,\n status: 401,\n },\n {\n classError: errors.ForbiddenError,\n status: 403,\n },\n {\n classError: errors.NotFoundError,\n status: 404,\n },\n {\n classError: errors.PayloadTooLargeError,\n status: 413,\n },\n {\n classError: errors.RateLimitError,\n status: 429,\n },\n {\n classError: errors.NotImplementedError,\n status: 501,\n },\n];\n\nconst formatApplicationError = (error: InstanceType<typeof errors.ApplicationError>) => {\n const errorAndStatus = mapErrorsAndStatus.find((pair) => error instanceof pair.classError);\n const status = errorAndStatus ? errorAndStatus.status : 400;\n\n return {\n status,\n body: {\n data: null,\n error: {\n status,\n name: error.name,\n message: error.message,\n details: error.details,\n },\n },\n };\n};\n\nconst formatHttpError = (error: createError.HttpError) => {\n return {\n status: error.status,\n body: {\n data: null,\n error: {\n status: error.status,\n name: error.name,\n message: error.message,\n details: error.details,\n },\n },\n };\n};\n\nconst formatInternalError = (error: unknown) => {\n if (!(error instanceof Error)) {\n return formatHttpError(createError(500));\n }\n\n const httpError = createError(error);\n\n if (httpError.expose) {\n return formatHttpError(httpError);\n }\n\n return formatHttpError(createError(httpError.status || 500));\n};\n\nexport { formatApplicationError, formatHttpError, formatInternalError };\n"],"names":["errors","createError"],"mappings":";;;;;;AAGA,MAAM,qBAAqB;AAAA,EACzB;AAAA,IACE,YAAYA,YAAO,OAAA;AAAA,IACnB,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,YAAYA,YAAO,OAAA;AAAA,IACnB,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,YAAYA,YAAO,OAAA;AAAA,IACnB,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,YAAYA,YAAO,OAAA;AAAA,IACnB,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,YAAYA,YAAO,OAAA;AAAA,IACnB,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,YAAYA,YAAO,OAAA;AAAA,IACnB,QAAQ;AAAA,EACV;AACF;AAEM,MAAA,yBAAyB,CAAC,UAAwD;AACtF,QAAM,iBAAiB,mBAAmB,KAAK,CAAC,SAAS,iBAAiB,KAAK,UAAU;AACnF,QAAA,SAAS,iBAAiB,eAAe,SAAS;AAEjD,SAAA;AAAA,IACL;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,QACL;AAAA,QACA,MAAM,MAAM;AAAA,QACZ,SAAS,MAAM;AAAA,QACf,SAAS,MAAM;AAAA,MACjB;AAAA,IACF;AAAA,EAAA;AAEJ;AAEM,MAAA,kBAAkB,CAAC,UAAiC;AACjD,SAAA;AAAA,IACL,QAAQ,MAAM;AAAA,IACd,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,QACL,QAAQ,MAAM;AAAA,QACd,MAAM,MAAM;AAAA,QACZ,SAAS,MAAM;AAAA,QACf,SAAS,MAAM;AAAA,MACjB;AAAA,IACF;AAAA,EAAA;AAEJ;AAEM,MAAA,sBAAsB,CAAC,UAAmB;AAC1C,MAAA,EAAE,iBAAiB,QAAQ;AACtB,WAAA,gBAAgBC,qBAAAA,QAAY,GAAG,CAAC;AAAA,EACzC;AAEM,QAAA,YAAYA,6BAAY,KAAK;AAEnC,MAAI,UAAU,QAAQ;AACpB,WAAO,gBAAgB,SAAS;AAAA,EAClC;AAEA,SAAO,gBAAgBA,qBAAAA,QAAY,UAAU,UAAU,GAAG,CAAC;AAC7D;;;;"}
@@ -1,74 +0,0 @@
1
- import createError from "http-errors";
2
- import { errors } from "@strapi/utils";
3
- const mapErrorsAndStatus = [
4
- {
5
- classError: errors.UnauthorizedError,
6
- status: 401
7
- },
8
- {
9
- classError: errors.ForbiddenError,
10
- status: 403
11
- },
12
- {
13
- classError: errors.NotFoundError,
14
- status: 404
15
- },
16
- {
17
- classError: errors.PayloadTooLargeError,
18
- status: 413
19
- },
20
- {
21
- classError: errors.RateLimitError,
22
- status: 429
23
- },
24
- {
25
- classError: errors.NotImplementedError,
26
- status: 501
27
- }
28
- ];
29
- const formatApplicationError = (error) => {
30
- const errorAndStatus = mapErrorsAndStatus.find((pair) => error instanceof pair.classError);
31
- const status = errorAndStatus ? errorAndStatus.status : 400;
32
- return {
33
- status,
34
- body: {
35
- data: null,
36
- error: {
37
- status,
38
- name: error.name,
39
- message: error.message,
40
- details: error.details
41
- }
42
- }
43
- };
44
- };
45
- const formatHttpError = (error) => {
46
- return {
47
- status: error.status,
48
- body: {
49
- data: null,
50
- error: {
51
- status: error.status,
52
- name: error.name,
53
- message: error.message,
54
- details: error.details
55
- }
56
- }
57
- };
58
- };
59
- const formatInternalError = (error) => {
60
- if (!(error instanceof Error)) {
61
- return formatHttpError(createError(500));
62
- }
63
- const httpError = createError(error);
64
- if (httpError.expose) {
65
- return formatHttpError(httpError);
66
- }
67
- return formatHttpError(createError(httpError.status || 500));
68
- };
69
- export {
70
- formatApplicationError,
71
- formatHttpError,
72
- formatInternalError
73
- };
74
- //# sourceMappingURL=errors.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.mjs","sources":["../../src/services/errors.ts"],"sourcesContent":["import createError from 'http-errors';\nimport { errors } from '@strapi/utils';\n\nconst mapErrorsAndStatus = [\n {\n classError: errors.UnauthorizedError,\n status: 401,\n },\n {\n classError: errors.ForbiddenError,\n status: 403,\n },\n {\n classError: errors.NotFoundError,\n status: 404,\n },\n {\n classError: errors.PayloadTooLargeError,\n status: 413,\n },\n {\n classError: errors.RateLimitError,\n status: 429,\n },\n {\n classError: errors.NotImplementedError,\n status: 501,\n },\n];\n\nconst formatApplicationError = (error: InstanceType<typeof errors.ApplicationError>) => {\n const errorAndStatus = mapErrorsAndStatus.find((pair) => error instanceof pair.classError);\n const status = errorAndStatus ? errorAndStatus.status : 400;\n\n return {\n status,\n body: {\n data: null,\n error: {\n status,\n name: error.name,\n message: error.message,\n details: error.details,\n },\n },\n };\n};\n\nconst formatHttpError = (error: createError.HttpError) => {\n return {\n status: error.status,\n body: {\n data: null,\n error: {\n status: error.status,\n name: error.name,\n message: error.message,\n details: error.details,\n },\n },\n };\n};\n\nconst formatInternalError = (error: unknown) => {\n if (!(error instanceof Error)) {\n return formatHttpError(createError(500));\n }\n\n const httpError = createError(error);\n\n if (httpError.expose) {\n return formatHttpError(httpError);\n }\n\n return formatHttpError(createError(httpError.status || 500));\n};\n\nexport { formatApplicationError, formatHttpError, formatInternalError };\n"],"names":[],"mappings":";;AAGA,MAAM,qBAAqB;AAAA,EACzB;AAAA,IACE,YAAY,OAAO;AAAA,IACnB,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,YAAY,OAAO;AAAA,IACnB,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,YAAY,OAAO;AAAA,IACnB,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,YAAY,OAAO;AAAA,IACnB,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,YAAY,OAAO;AAAA,IACnB,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,YAAY,OAAO;AAAA,IACnB,QAAQ;AAAA,EACV;AACF;AAEM,MAAA,yBAAyB,CAAC,UAAwD;AACtF,QAAM,iBAAiB,mBAAmB,KAAK,CAAC,SAAS,iBAAiB,KAAK,UAAU;AACnF,QAAA,SAAS,iBAAiB,eAAe,SAAS;AAEjD,SAAA;AAAA,IACL;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,QACL;AAAA,QACA,MAAM,MAAM;AAAA,QACZ,SAAS,MAAM;AAAA,QACf,SAAS,MAAM;AAAA,MACjB;AAAA,IACF;AAAA,EAAA;AAEJ;AAEM,MAAA,kBAAkB,CAAC,UAAiC;AACjD,SAAA;AAAA,IACL,QAAQ,MAAM;AAAA,IACd,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,QACL,QAAQ,MAAM;AAAA,QACd,MAAM,MAAM;AAAA,QACZ,SAAS,MAAM;AAAA,QACf,SAAS,MAAM;AAAA,MACjB;AAAA,IACF;AAAA,EAAA;AAEJ;AAEM,MAAA,sBAAsB,CAAC,UAAmB;AAC1C,MAAA,EAAE,iBAAiB,QAAQ;AACtB,WAAA,gBAAgB,YAAY,GAAG,CAAC;AAAA,EACzC;AAEM,QAAA,YAAY,YAAY,KAAK;AAEnC,MAAI,UAAU,QAAQ;AACpB,WAAO,gBAAgB,SAAS;AAAA,EAClC;AAEA,SAAO,gBAAgB,YAAY,UAAU,UAAU,GAAG,CAAC;AAC7D;"}
@@ -1,72 +0,0 @@
1
- "use strict";
2
- function createEventHub() {
3
- const listeners = /* @__PURE__ */ new Map();
4
- const defaultSubscriber = async (eventName, ...args) => {
5
- if (listeners.has(eventName)) {
6
- for (const listener of listeners.get(eventName)) {
7
- await listener(...args);
8
- }
9
- }
10
- };
11
- const subscribers = [defaultSubscriber];
12
- const eventHub = {
13
- async emit(eventName, ...args) {
14
- for (const subscriber of subscribers) {
15
- await subscriber(eventName, ...args);
16
- }
17
- },
18
- subscribe(subscriber) {
19
- subscribers.push(subscriber);
20
- return () => {
21
- eventHub.unsubscribe(subscriber);
22
- };
23
- },
24
- unsubscribe(subscriber) {
25
- const subscriberIndex = subscribers.indexOf(subscriber);
26
- if (subscriberIndex >= 0) {
27
- subscribers.splice(subscriberIndex, 1);
28
- }
29
- },
30
- on(eventName, listener) {
31
- if (!listeners.has(eventName)) {
32
- listeners.set(eventName, [listener]);
33
- } else {
34
- listeners.get(eventName).push(listener);
35
- }
36
- return () => {
37
- eventHub.off(eventName, listener);
38
- };
39
- },
40
- off(eventName, listener) {
41
- listeners.get(eventName)?.splice(listeners.get(eventName).indexOf(listener), 1);
42
- },
43
- once(eventName, listener) {
44
- return eventHub.on(eventName, async (...args) => {
45
- eventHub.off(eventName, listener);
46
- return listener(...args);
47
- });
48
- },
49
- destroy() {
50
- this.removeAllListeners();
51
- this.removeAllSubscribers();
52
- return this;
53
- },
54
- removeListener(eventName, listener) {
55
- return eventHub.off(eventName, listener);
56
- },
57
- removeAllListeners() {
58
- listeners.clear();
59
- return this;
60
- },
61
- removeAllSubscribers() {
62
- subscribers.length = 0;
63
- return this;
64
- },
65
- addListener(eventName, listener) {
66
- return eventHub.on(eventName, listener);
67
- }
68
- };
69
- return eventHub;
70
- }
71
- module.exports = createEventHub;
72
- //# sourceMappingURL=event-hub.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-hub.js","sources":["../../src/services/event-hub.ts"],"sourcesContent":["export type Subscriber = (eventName: string, ...args: any[]) => Promise<void>;\nexport type Listener = (...args: any[]) => Promise<void>;\n\nexport interface EventHub {\n emit(eventName: string, ...args: unknown[]): Promise<void>;\n subscribe(subscriber: Subscriber): () => void;\n unsubscribe(subscriber: Subscriber): void;\n on(eventName: string, listener: Listener): () => void;\n off(eventName: string, listener: Listener): void;\n once(eventName: string, listener: Listener): () => void;\n destroy(): EventHub;\n removeListener(eventName: string, listener: Listener): void;\n removeAllListeners(): EventHub;\n removeAllSubscribers(): EventHub;\n addListener(eventName: string, listener: Listener): () => void;\n}\n\n/**\n * The event hub is Strapi's event control center.\n */\nexport default function createEventHub(): EventHub {\n const listeners = new Map();\n\n // Default subscriber to easily add listeners with the on() method\n const defaultSubscriber = async (eventName: string, ...args: unknown[]) => {\n if (listeners.has(eventName)) {\n for (const listener of listeners.get(eventName)) {\n await listener(...args);\n }\n }\n };\n\n // Store of subscribers that will be called when an event is emitted\n const subscribers = [defaultSubscriber];\n\n const eventHub: EventHub = {\n async emit(eventName, ...args) {\n for (const subscriber of subscribers) {\n await subscriber(eventName, ...args);\n }\n },\n\n subscribe(subscriber) {\n subscribers.push(subscriber);\n\n // Return a function to remove the subscriber\n return () => {\n eventHub.unsubscribe(subscriber);\n };\n },\n\n unsubscribe(subscriber) {\n const subscriberIndex = subscribers.indexOf(subscriber);\n\n // Only remove the subscriber if it exists\n if (subscriberIndex >= 0) {\n subscribers.splice(subscriberIndex, 1);\n }\n },\n\n on(eventName, listener) {\n if (!listeners.has(eventName)) {\n listeners.set(eventName, [listener]);\n } else {\n listeners.get(eventName).push(listener);\n }\n\n // Return a function to remove the listener\n return () => {\n eventHub.off(eventName, listener);\n };\n },\n\n off(eventName, listener) {\n listeners.get(eventName)?.splice(listeners.get(eventName).indexOf(listener), 1);\n },\n\n once(eventName, listener) {\n return eventHub.on(eventName, async (...args) => {\n eventHub.off(eventName, listener);\n return listener(...args);\n });\n },\n\n destroy() {\n this.removeAllListeners();\n this.removeAllSubscribers();\n return this;\n },\n\n removeListener(eventName, listener) {\n return eventHub.off(eventName, listener);\n },\n\n removeAllListeners() {\n listeners.clear();\n return this;\n },\n\n removeAllSubscribers() {\n subscribers.length = 0;\n return this;\n },\n\n addListener(eventName, listener) {\n return eventHub.on(eventName, listener);\n },\n };\n\n return eventHub;\n}\n"],"names":[],"mappings":";AAoBA,SAAwB,iBAA2B;AAC3C,QAAA,gCAAgB;AAGhB,QAAA,oBAAoB,OAAO,cAAsB,SAAoB;AACrE,QAAA,UAAU,IAAI,SAAS,GAAG;AAC5B,iBAAW,YAAY,UAAU,IAAI,SAAS,GAAG;AACzC,cAAA,SAAS,GAAG,IAAI;AAAA,MACxB;AAAA,IACF;AAAA,EAAA;AAII,QAAA,cAAc,CAAC,iBAAiB;AAEtC,QAAM,WAAqB;AAAA,IACzB,MAAM,KAAK,cAAc,MAAM;AAC7B,iBAAW,cAAc,aAAa;AAC9B,cAAA,WAAW,WAAW,GAAG,IAAI;AAAA,MACrC;AAAA,IACF;AAAA,IAEA,UAAU,YAAY;AACpB,kBAAY,KAAK,UAAU;AAG3B,aAAO,MAAM;AACX,iBAAS,YAAY,UAAU;AAAA,MAAA;AAAA,IAEnC;AAAA,IAEA,YAAY,YAAY;AAChB,YAAA,kBAAkB,YAAY,QAAQ,UAAU;AAGtD,UAAI,mBAAmB,GAAG;AACZ,oBAAA,OAAO,iBAAiB,CAAC;AAAA,MACvC;AAAA,IACF;AAAA,IAEA,GAAG,WAAW,UAAU;AACtB,UAAI,CAAC,UAAU,IAAI,SAAS,GAAG;AAC7B,kBAAU,IAAI,WAAW,CAAC,QAAQ,CAAC;AAAA,MAAA,OAC9B;AACL,kBAAU,IAAI,SAAS,EAAE,KAAK,QAAQ;AAAA,MACxC;AAGA,aAAO,MAAM;AACF,iBAAA,IAAI,WAAW,QAAQ;AAAA,MAAA;AAAA,IAEpC;AAAA,IAEA,IAAI,WAAW,UAAU;AACb,gBAAA,IAAI,SAAS,GAAG,OAAO,UAAU,IAAI,SAAS,EAAE,QAAQ,QAAQ,GAAG,CAAC;AAAA,IAChF;AAAA,IAEA,KAAK,WAAW,UAAU;AACxB,aAAO,SAAS,GAAG,WAAW,UAAU,SAAS;AACtC,iBAAA,IAAI,WAAW,QAAQ;AACzB,eAAA,SAAS,GAAG,IAAI;AAAA,MAAA,CACxB;AAAA,IACH;AAAA,IAEA,UAAU;AACR,WAAK,mBAAmB;AACxB,WAAK,qBAAqB;AACnB,aAAA;AAAA,IACT;AAAA,IAEA,eAAe,WAAW,UAAU;AAC3B,aAAA,SAAS,IAAI,WAAW,QAAQ;AAAA,IACzC;AAAA,IAEA,qBAAqB;AACnB,gBAAU,MAAM;AACT,aAAA;AAAA,IACT;AAAA,IAEA,uBAAuB;AACrB,kBAAY,SAAS;AACd,aAAA;AAAA,IACT;AAAA,IAEA,YAAY,WAAW,UAAU;AACxB,aAAA,SAAS,GAAG,WAAW,QAAQ;AAAA,IACxC;AAAA,EAAA;AAGK,SAAA;AACT;;"}
@@ -1,73 +0,0 @@
1
- function createEventHub() {
2
- const listeners = /* @__PURE__ */ new Map();
3
- const defaultSubscriber = async (eventName, ...args) => {
4
- if (listeners.has(eventName)) {
5
- for (const listener of listeners.get(eventName)) {
6
- await listener(...args);
7
- }
8
- }
9
- };
10
- const subscribers = [defaultSubscriber];
11
- const eventHub = {
12
- async emit(eventName, ...args) {
13
- for (const subscriber of subscribers) {
14
- await subscriber(eventName, ...args);
15
- }
16
- },
17
- subscribe(subscriber) {
18
- subscribers.push(subscriber);
19
- return () => {
20
- eventHub.unsubscribe(subscriber);
21
- };
22
- },
23
- unsubscribe(subscriber) {
24
- const subscriberIndex = subscribers.indexOf(subscriber);
25
- if (subscriberIndex >= 0) {
26
- subscribers.splice(subscriberIndex, 1);
27
- }
28
- },
29
- on(eventName, listener) {
30
- if (!listeners.has(eventName)) {
31
- listeners.set(eventName, [listener]);
32
- } else {
33
- listeners.get(eventName).push(listener);
34
- }
35
- return () => {
36
- eventHub.off(eventName, listener);
37
- };
38
- },
39
- off(eventName, listener) {
40
- listeners.get(eventName)?.splice(listeners.get(eventName).indexOf(listener), 1);
41
- },
42
- once(eventName, listener) {
43
- return eventHub.on(eventName, async (...args) => {
44
- eventHub.off(eventName, listener);
45
- return listener(...args);
46
- });
47
- },
48
- destroy() {
49
- this.removeAllListeners();
50
- this.removeAllSubscribers();
51
- return this;
52
- },
53
- removeListener(eventName, listener) {
54
- return eventHub.off(eventName, listener);
55
- },
56
- removeAllListeners() {
57
- listeners.clear();
58
- return this;
59
- },
60
- removeAllSubscribers() {
61
- subscribers.length = 0;
62
- return this;
63
- },
64
- addListener(eventName, listener) {
65
- return eventHub.on(eventName, listener);
66
- }
67
- };
68
- return eventHub;
69
- }
70
- export {
71
- createEventHub as default
72
- };
73
- //# sourceMappingURL=event-hub.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-hub.mjs","sources":["../../src/services/event-hub.ts"],"sourcesContent":["export type Subscriber = (eventName: string, ...args: any[]) => Promise<void>;\nexport type Listener = (...args: any[]) => Promise<void>;\n\nexport interface EventHub {\n emit(eventName: string, ...args: unknown[]): Promise<void>;\n subscribe(subscriber: Subscriber): () => void;\n unsubscribe(subscriber: Subscriber): void;\n on(eventName: string, listener: Listener): () => void;\n off(eventName: string, listener: Listener): void;\n once(eventName: string, listener: Listener): () => void;\n destroy(): EventHub;\n removeListener(eventName: string, listener: Listener): void;\n removeAllListeners(): EventHub;\n removeAllSubscribers(): EventHub;\n addListener(eventName: string, listener: Listener): () => void;\n}\n\n/**\n * The event hub is Strapi's event control center.\n */\nexport default function createEventHub(): EventHub {\n const listeners = new Map();\n\n // Default subscriber to easily add listeners with the on() method\n const defaultSubscriber = async (eventName: string, ...args: unknown[]) => {\n if (listeners.has(eventName)) {\n for (const listener of listeners.get(eventName)) {\n await listener(...args);\n }\n }\n };\n\n // Store of subscribers that will be called when an event is emitted\n const subscribers = [defaultSubscriber];\n\n const eventHub: EventHub = {\n async emit(eventName, ...args) {\n for (const subscriber of subscribers) {\n await subscriber(eventName, ...args);\n }\n },\n\n subscribe(subscriber) {\n subscribers.push(subscriber);\n\n // Return a function to remove the subscriber\n return () => {\n eventHub.unsubscribe(subscriber);\n };\n },\n\n unsubscribe(subscriber) {\n const subscriberIndex = subscribers.indexOf(subscriber);\n\n // Only remove the subscriber if it exists\n if (subscriberIndex >= 0) {\n subscribers.splice(subscriberIndex, 1);\n }\n },\n\n on(eventName, listener) {\n if (!listeners.has(eventName)) {\n listeners.set(eventName, [listener]);\n } else {\n listeners.get(eventName).push(listener);\n }\n\n // Return a function to remove the listener\n return () => {\n eventHub.off(eventName, listener);\n };\n },\n\n off(eventName, listener) {\n listeners.get(eventName)?.splice(listeners.get(eventName).indexOf(listener), 1);\n },\n\n once(eventName, listener) {\n return eventHub.on(eventName, async (...args) => {\n eventHub.off(eventName, listener);\n return listener(...args);\n });\n },\n\n destroy() {\n this.removeAllListeners();\n this.removeAllSubscribers();\n return this;\n },\n\n removeListener(eventName, listener) {\n return eventHub.off(eventName, listener);\n },\n\n removeAllListeners() {\n listeners.clear();\n return this;\n },\n\n removeAllSubscribers() {\n subscribers.length = 0;\n return this;\n },\n\n addListener(eventName, listener) {\n return eventHub.on(eventName, listener);\n },\n };\n\n return eventHub;\n}\n"],"names":[],"mappings":"AAoBA,SAAwB,iBAA2B;AAC3C,QAAA,gCAAgB;AAGhB,QAAA,oBAAoB,OAAO,cAAsB,SAAoB;AACrE,QAAA,UAAU,IAAI,SAAS,GAAG;AAC5B,iBAAW,YAAY,UAAU,IAAI,SAAS,GAAG;AACzC,cAAA,SAAS,GAAG,IAAI;AAAA,MACxB;AAAA,IACF;AAAA,EAAA;AAII,QAAA,cAAc,CAAC,iBAAiB;AAEtC,QAAM,WAAqB;AAAA,IACzB,MAAM,KAAK,cAAc,MAAM;AAC7B,iBAAW,cAAc,aAAa;AAC9B,cAAA,WAAW,WAAW,GAAG,IAAI;AAAA,MACrC;AAAA,IACF;AAAA,IAEA,UAAU,YAAY;AACpB,kBAAY,KAAK,UAAU;AAG3B,aAAO,MAAM;AACX,iBAAS,YAAY,UAAU;AAAA,MAAA;AAAA,IAEnC;AAAA,IAEA,YAAY,YAAY;AAChB,YAAA,kBAAkB,YAAY,QAAQ,UAAU;AAGtD,UAAI,mBAAmB,GAAG;AACZ,oBAAA,OAAO,iBAAiB,CAAC;AAAA,MACvC;AAAA,IACF;AAAA,IAEA,GAAG,WAAW,UAAU;AACtB,UAAI,CAAC,UAAU,IAAI,SAAS,GAAG;AAC7B,kBAAU,IAAI,WAAW,CAAC,QAAQ,CAAC;AAAA,MAAA,OAC9B;AACL,kBAAU,IAAI,SAAS,EAAE,KAAK,QAAQ;AAAA,MACxC;AAGA,aAAO,MAAM;AACF,iBAAA,IAAI,WAAW,QAAQ;AAAA,MAAA;AAAA,IAEpC;AAAA,IAEA,IAAI,WAAW,UAAU;AACb,gBAAA,IAAI,SAAS,GAAG,OAAO,UAAU,IAAI,SAAS,EAAE,QAAQ,QAAQ,GAAG,CAAC;AAAA,IAChF;AAAA,IAEA,KAAK,WAAW,UAAU;AACxB,aAAO,SAAS,GAAG,WAAW,UAAU,SAAS;AACtC,iBAAA,IAAI,WAAW,QAAQ;AACzB,eAAA,SAAS,GAAG,IAAI;AAAA,MAAA,CACxB;AAAA,IACH;AAAA,IAEA,UAAU;AACR,WAAK,mBAAmB;AACxB,WAAK,qBAAqB;AACnB,aAAA;AAAA,IACT;AAAA,IAEA,eAAe,WAAW,UAAU;AAC3B,aAAA,SAAS,IAAI,WAAW,QAAQ;AAAA,IACzC;AAAA,IAEA,qBAAqB;AACnB,gBAAU,MAAM;AACT,aAAA;AAAA,IACT;AAAA,IAEA,uBAAuB;AACrB,kBAAY,SAAS;AACd,aAAA;AAAA,IACT;AAAA,IAEA,YAAY,WAAW,UAAU;AACxB,aAAA,SAAS,GAAG,WAAW,QAAQ;AAAA,IACxC;AAAA,EAAA;AAGK,SAAA;AACT;"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const createFeaturesService = (strapi) => {
4
- const service = {
5
- get config() {
6
- return strapi.config.get("features");
7
- },
8
- future: {
9
- isEnabled(futureFlagName) {
10
- return service.config?.future?.[futureFlagName] === true;
11
- }
12
- }
13
- };
14
- return service;
15
- };
16
- exports.createFeaturesService = createFeaturesService;
17
- //# sourceMappingURL=features.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"features.js","sources":["../../src/services/features.ts"],"sourcesContent":["/**\n * The features service is responsible for managing features within strapi,\n * including interacting with the feature configuration file to know\n * which are enabled and disabled.\n */\n\nimport type { Core, Modules } from '@strapi/types';\n\ntype FeatureName = keyof Modules.Features.FeaturesConfig['future'];\n\nconst createFeaturesService = (strapi: Core.Strapi): Modules.Features.FeaturesService => {\n const service: Modules.Features.FeaturesService = {\n get config() {\n return strapi.config.get<Modules.Features.FeaturesService['config']>('features');\n },\n future: {\n isEnabled(futureFlagName: string): boolean {\n return service.config?.future?.[futureFlagName as FeatureName] === true;\n },\n },\n };\n\n return service;\n};\n\nexport { createFeaturesService };\nexport type FeaturesService = Modules.Features.FeaturesService;\n"],"names":[],"mappings":";;AAUM,MAAA,wBAAwB,CAAC,WAA0D;AACvF,QAAM,UAA4C;AAAA,IAChD,IAAI,SAAS;AACJ,aAAA,OAAO,OAAO,IAAgD,UAAU;AAAA,IACjF;AAAA,IACA,QAAQ;AAAA,MACN,UAAU,gBAAiC;AACzC,eAAO,QAAQ,QAAQ,SAAS,cAA6B,MAAM;AAAA,MACrE;AAAA,IACF;AAAA,EAAA;AAGK,SAAA;AACT;;"}
@@ -1,17 +0,0 @@
1
- const createFeaturesService = (strapi) => {
2
- const service = {
3
- get config() {
4
- return strapi.config.get("features");
5
- },
6
- future: {
7
- isEnabled(futureFlagName) {
8
- return service.config?.future?.[futureFlagName] === true;
9
- }
10
- }
11
- };
12
- return service;
13
- };
14
- export {
15
- createFeaturesService
16
- };
17
- //# sourceMappingURL=features.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"features.mjs","sources":["../../src/services/features.ts"],"sourcesContent":["/**\n * The features service is responsible for managing features within strapi,\n * including interacting with the feature configuration file to know\n * which are enabled and disabled.\n */\n\nimport type { Core, Modules } from '@strapi/types';\n\ntype FeatureName = keyof Modules.Features.FeaturesConfig['future'];\n\nconst createFeaturesService = (strapi: Core.Strapi): Modules.Features.FeaturesService => {\n const service: Modules.Features.FeaturesService = {\n get config() {\n return strapi.config.get<Modules.Features.FeaturesService['config']>('features');\n },\n future: {\n isEnabled(futureFlagName: string): boolean {\n return service.config?.future?.[futureFlagName as FeatureName] === true;\n },\n },\n };\n\n return service;\n};\n\nexport { createFeaturesService };\nexport type FeaturesService = Modules.Features.FeaturesService;\n"],"names":[],"mappings":"AAUM,MAAA,wBAAwB,CAAC,WAA0D;AACvF,QAAM,UAA4C;AAAA,IAChD,IAAI,SAAS;AACJ,aAAA,OAAO,OAAO,IAAgD,UAAU;AAAA,IACjF;AAAA,IACA,QAAQ;AAAA,MACN,UAAU,gBAAiC;AACzC,eAAO,QAAQ,QAAQ,SAAS,cAA6B,MAAM;AAAA,MACrE;AAAA,IACF;AAAA,EAAA;AAGK,SAAA;AACT;"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- const path = require("path");
3
- const fse = require("fs-extra");
4
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
5
- const path__default = /* @__PURE__ */ _interopDefault(path);
6
- const fse__default = /* @__PURE__ */ _interopDefault(fse);
7
- const createStrapiFs = (strapi) => {
8
- function normalizePath(optPath) {
9
- const filePath = Array.isArray(optPath) ? optPath.join("/") : optPath;
10
- const normalizedPath = path__default.default.normalize(filePath).replace(/^\/?(\.\/|\.\.\/)+/, "");
11
- return path__default.default.resolve(strapi.dirs.app.root, normalizedPath);
12
- }
13
- const strapiFS = {
14
- /**
15
- * Writes a file in a strapi app
16
- * @param {Array|string} optPath - file path
17
- * @param {string} data - content
18
- */
19
- writeAppFile(optPath, data) {
20
- const writePath = normalizePath(optPath);
21
- return fse__default.default.ensureFile(writePath).then(() => fse__default.default.writeFile(writePath, data));
22
- },
23
- /**
24
- * Writes a file in a plugin extensions folder
25
- * @param {string} plugin - plugin name
26
- * @param {Array|string} optPath - path to file
27
- * @param {string} data - content
28
- */
29
- writePluginFile(plugin, optPath, data) {
30
- const newPath = ["extensions", plugin].concat(optPath).join("/");
31
- return strapiFS.writeAppFile(newPath, data);
32
- },
33
- /**
34
- * Removes a file in strapi app
35
- */
36
- removeAppFile(optPath) {
37
- const removePath = normalizePath(optPath);
38
- return fse__default.default.remove(removePath);
39
- },
40
- /**
41
- * Appends a file in strapi app
42
- */
43
- appendFile(optPath, data) {
44
- const writePath = normalizePath(optPath);
45
- return fse__default.default.appendFileSync(writePath, data);
46
- }
47
- };
48
- return strapiFS;
49
- };
50
- module.exports = createStrapiFs;
51
- //# sourceMappingURL=fs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs.js","sources":["../../src/services/fs.ts"],"sourcesContent":["import path from 'path';\nimport fse from 'fs-extra';\n\nimport type { Core } from '@strapi/types';\n\ninterface StrapiFS {\n writeAppFile(optPath: string | string[], data: string): Promise<void>;\n writePluginFile(plugin: string, optPath: string | string[], data: string): Promise<void>;\n removeAppFile(optPath: string | string[]): Promise<void>;\n appendFile(optPath: string | string[], data: string): void;\n}\n\n/**\n * create strapi fs layer\n */\nexport default (strapi: Core.Strapi) => {\n function normalizePath(optPath: string | string[]) {\n const filePath = Array.isArray(optPath) ? optPath.join('/') : optPath;\n\n const normalizedPath = path.normalize(filePath).replace(/^\\/?(\\.\\/|\\.\\.\\/)+/, '');\n\n return path.resolve(strapi.dirs.app.root, normalizedPath);\n }\n\n const strapiFS: StrapiFS = {\n /**\n * Writes a file in a strapi app\n * @param {Array|string} optPath - file path\n * @param {string} data - content\n */\n writeAppFile(optPath, data) {\n const writePath = normalizePath(optPath);\n return fse.ensureFile(writePath).then(() => fse.writeFile(writePath, data));\n },\n\n /**\n * Writes a file in a plugin extensions folder\n * @param {string} plugin - plugin name\n * @param {Array|string} optPath - path to file\n * @param {string} data - content\n */\n writePluginFile(plugin, optPath, data) {\n const newPath = ['extensions', plugin].concat(optPath).join('/');\n return strapiFS.writeAppFile(newPath, data);\n },\n\n /**\n * Removes a file in strapi app\n */\n removeAppFile(optPath) {\n const removePath = normalizePath(optPath);\n return fse.remove(removePath);\n },\n\n /**\n * Appends a file in strapi app\n */\n appendFile(optPath, data) {\n const writePath = normalizePath(optPath);\n return fse.appendFileSync(writePath, data);\n },\n };\n\n return strapiFS;\n};\n"],"names":["path","fse"],"mappings":";;;;;;AAeA,MAAe,iBAAA,CAAC,WAAwB;AACtC,WAAS,cAAc,SAA4B;AAC3C,UAAA,WAAW,MAAM,QAAQ,OAAO,IAAI,QAAQ,KAAK,GAAG,IAAI;AAE9D,UAAM,iBAAiBA,cAAK,QAAA,UAAU,QAAQ,EAAE,QAAQ,sBAAsB,EAAE;AAEhF,WAAOA,cAAAA,QAAK,QAAQ,OAAO,KAAK,IAAI,MAAM,cAAc;AAAA,EAC1D;AAEA,QAAM,WAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMzB,aAAa,SAAS,MAAM;AACpB,YAAA,YAAY,cAAc,OAAO;AAChC,aAAAC,qBAAI,WAAW,SAAS,EAAE,KAAK,MAAMA,aAAI,QAAA,UAAU,WAAW,IAAI,CAAC;AAAA,IAC5E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,gBAAgB,QAAQ,SAAS,MAAM;AAC/B,YAAA,UAAU,CAAC,cAAc,MAAM,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AACxD,aAAA,SAAS,aAAa,SAAS,IAAI;AAAA,IAC5C;AAAA;AAAA;AAAA;AAAA,IAKA,cAAc,SAAS;AACf,YAAA,aAAa,cAAc,OAAO;AACjC,aAAAA,aAAA,QAAI,OAAO,UAAU;AAAA,IAC9B;AAAA;AAAA;AAAA;AAAA,IAKA,WAAW,SAAS,MAAM;AAClB,YAAA,YAAY,cAAc,OAAO;AAChC,aAAAA,qBAAI,eAAe,WAAW,IAAI;AAAA,IAC3C;AAAA,EAAA;AAGK,SAAA;AACT;;"}
@@ -1,49 +0,0 @@
1
- import path from "path";
2
- import fse from "fs-extra";
3
- const createStrapiFs = (strapi) => {
4
- function normalizePath(optPath) {
5
- const filePath = Array.isArray(optPath) ? optPath.join("/") : optPath;
6
- const normalizedPath = path.normalize(filePath).replace(/^\/?(\.\/|\.\.\/)+/, "");
7
- return path.resolve(strapi.dirs.app.root, normalizedPath);
8
- }
9
- const strapiFS = {
10
- /**
11
- * Writes a file in a strapi app
12
- * @param {Array|string} optPath - file path
13
- * @param {string} data - content
14
- */
15
- writeAppFile(optPath, data) {
16
- const writePath = normalizePath(optPath);
17
- return fse.ensureFile(writePath).then(() => fse.writeFile(writePath, data));
18
- },
19
- /**
20
- * Writes a file in a plugin extensions folder
21
- * @param {string} plugin - plugin name
22
- * @param {Array|string} optPath - path to file
23
- * @param {string} data - content
24
- */
25
- writePluginFile(plugin, optPath, data) {
26
- const newPath = ["extensions", plugin].concat(optPath).join("/");
27
- return strapiFS.writeAppFile(newPath, data);
28
- },
29
- /**
30
- * Removes a file in strapi app
31
- */
32
- removeAppFile(optPath) {
33
- const removePath = normalizePath(optPath);
34
- return fse.remove(removePath);
35
- },
36
- /**
37
- * Appends a file in strapi app
38
- */
39
- appendFile(optPath, data) {
40
- const writePath = normalizePath(optPath);
41
- return fse.appendFileSync(writePath, data);
42
- }
43
- };
44
- return strapiFS;
45
- };
46
- export {
47
- createStrapiFs as default
48
- };
49
- //# sourceMappingURL=fs.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs.mjs","sources":["../../src/services/fs.ts"],"sourcesContent":["import path from 'path';\nimport fse from 'fs-extra';\n\nimport type { Core } from '@strapi/types';\n\ninterface StrapiFS {\n writeAppFile(optPath: string | string[], data: string): Promise<void>;\n writePluginFile(plugin: string, optPath: string | string[], data: string): Promise<void>;\n removeAppFile(optPath: string | string[]): Promise<void>;\n appendFile(optPath: string | string[], data: string): void;\n}\n\n/**\n * create strapi fs layer\n */\nexport default (strapi: Core.Strapi) => {\n function normalizePath(optPath: string | string[]) {\n const filePath = Array.isArray(optPath) ? optPath.join('/') : optPath;\n\n const normalizedPath = path.normalize(filePath).replace(/^\\/?(\\.\\/|\\.\\.\\/)+/, '');\n\n return path.resolve(strapi.dirs.app.root, normalizedPath);\n }\n\n const strapiFS: StrapiFS = {\n /**\n * Writes a file in a strapi app\n * @param {Array|string} optPath - file path\n * @param {string} data - content\n */\n writeAppFile(optPath, data) {\n const writePath = normalizePath(optPath);\n return fse.ensureFile(writePath).then(() => fse.writeFile(writePath, data));\n },\n\n /**\n * Writes a file in a plugin extensions folder\n * @param {string} plugin - plugin name\n * @param {Array|string} optPath - path to file\n * @param {string} data - content\n */\n writePluginFile(plugin, optPath, data) {\n const newPath = ['extensions', plugin].concat(optPath).join('/');\n return strapiFS.writeAppFile(newPath, data);\n },\n\n /**\n * Removes a file in strapi app\n */\n removeAppFile(optPath) {\n const removePath = normalizePath(optPath);\n return fse.remove(removePath);\n },\n\n /**\n * Appends a file in strapi app\n */\n appendFile(optPath, data) {\n const writePath = normalizePath(optPath);\n return fse.appendFileSync(writePath, data);\n },\n };\n\n return strapiFS;\n};\n"],"names":[],"mappings":";;AAeA,MAAe,iBAAA,CAAC,WAAwB;AACtC,WAAS,cAAc,SAA4B;AAC3C,UAAA,WAAW,MAAM,QAAQ,OAAO,IAAI,QAAQ,KAAK,GAAG,IAAI;AAE9D,UAAM,iBAAiB,KAAK,UAAU,QAAQ,EAAE,QAAQ,sBAAsB,EAAE;AAEhF,WAAO,KAAK,QAAQ,OAAO,KAAK,IAAI,MAAM,cAAc;AAAA,EAC1D;AAEA,QAAM,WAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMzB,aAAa,SAAS,MAAM;AACpB,YAAA,YAAY,cAAc,OAAO;AAChC,aAAA,IAAI,WAAW,SAAS,EAAE,KAAK,MAAM,IAAI,UAAU,WAAW,IAAI,CAAC;AAAA,IAC5E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,gBAAgB,QAAQ,SAAS,MAAM;AAC/B,YAAA,UAAU,CAAC,cAAc,MAAM,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AACxD,aAAA,SAAS,aAAa,SAAS,IAAI;AAAA,IAC5C;AAAA;AAAA;AAAA;AAAA,IAKA,cAAc,SAAS;AACf,YAAA,aAAa,cAAc,OAAO;AACjC,aAAA,IAAI,OAAO,UAAU;AAAA,IAC9B;AAAA;AAAA;AAAA;AAAA,IAKA,WAAW,SAAS,MAAM;AAClB,YAAA,YAAY,cAAc,OAAO;AAChC,aAAA,IAAI,eAAe,WAAW,IAAI;AAAA,IAC3C;AAAA,EAAA;AAGK,SAAA;AACT;"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const crypto = require("crypto");
4
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
5
- const crypto__default = /* @__PURE__ */ _interopDefault(crypto);
6
- const generateAdminUserHash = (strapi) => {
7
- const ctx = strapi?.requestContext?.get();
8
- if (!ctx?.state?.user?.email) {
9
- return "";
10
- }
11
- return crypto__default.default.createHash("sha256").update(ctx.state.user.email).digest("hex");
12
- };
13
- exports.generateAdminUserHash = generateAdminUserHash;
14
- //# sourceMappingURL=admin-user-hash.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"admin-user-hash.js","sources":["../../../src/services/metrics/admin-user-hash.ts"],"sourcesContent":["import crypto from 'crypto';\nimport type { Core } from '@strapi/types';\n\n/**\n * Generate an admin user hash\n */\nconst generateAdminUserHash = (strapi: Core.Strapi) => {\n const ctx = strapi?.requestContext?.get();\n if (!ctx?.state?.user?.email) {\n return '';\n }\n return crypto.createHash('sha256').update(ctx.state.user.email).digest('hex');\n};\n\nexport { generateAdminUserHash };\n"],"names":["crypto"],"mappings":";;;;;AAMM,MAAA,wBAAwB,CAAC,WAAwB;AAC/C,QAAA,MAAM,QAAQ,gBAAgB,IAAI;AACxC,MAAI,CAAC,KAAK,OAAO,MAAM,OAAO;AACrB,WAAA;AAAA,EACT;AACO,SAAAA,wBAAO,WAAW,QAAQ,EAAE,OAAO,IAAI,MAAM,KAAK,KAAK,EAAE,OAAO,KAAK;AAC9E;;"}
@@ -1,12 +0,0 @@
1
- import crypto from "crypto";
2
- const generateAdminUserHash = (strapi) => {
3
- const ctx = strapi?.requestContext?.get();
4
- if (!ctx?.state?.user?.email) {
5
- return "";
6
- }
7
- return crypto.createHash("sha256").update(ctx.state.user.email).digest("hex");
8
- };
9
- export {
10
- generateAdminUserHash
11
- };
12
- //# sourceMappingURL=admin-user-hash.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"admin-user-hash.mjs","sources":["../../../src/services/metrics/admin-user-hash.ts"],"sourcesContent":["import crypto from 'crypto';\nimport type { Core } from '@strapi/types';\n\n/**\n * Generate an admin user hash\n */\nconst generateAdminUserHash = (strapi: Core.Strapi) => {\n const ctx = strapi?.requestContext?.get();\n if (!ctx?.state?.user?.email) {\n return '';\n }\n return crypto.createHash('sha256').update(ctx.state.user.email).digest('hex');\n};\n\nexport { generateAdminUserHash };\n"],"names":[],"mappings":";AAMM,MAAA,wBAAwB,CAAC,WAAwB;AAC/C,QAAA,MAAM,QAAQ,gBAAgB,IAAI;AACxC,MAAI,CAAC,KAAK,OAAO,MAAM,OAAO;AACrB,WAAA;AAAA,EACT;AACO,SAAA,OAAO,WAAW,QAAQ,EAAE,OAAO,IAAI,MAAM,KAAK,KAAK,EAAE,OAAO,KAAK;AAC9E;"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- const nodeSchedule = require("node-schedule");
3
- const rateLimiter = require("./rate-limiter.js");
4
- const sender = require("./sender.js");
5
- const middleware = require("./middleware.js");
6
- const isTruthy = require("./is-truthy.js");
7
- const LIMITED_EVENTS = [
8
- "didSaveMediaWithAlternativeText",
9
- "didSaveMediaWithCaption",
10
- "didDisableResponsiveDimensions",
11
- "didEnableResponsiveDimensions",
12
- "didInitializePluginUpload"
13
- ];
14
- const createTelemetryInstance = (strapi) => {
15
- const uuid = strapi.config.get("uuid");
16
- const telemetryDisabled = strapi.config.get("packageJsonStrapi.telemetryDisabled");
17
- const isDisabled = !uuid || isTruthy(process.env.STRAPI_TELEMETRY_DISABLED) || isTruthy(telemetryDisabled);
18
- const crons = [];
19
- const sender$1 = sender(strapi);
20
- const sendEvent = rateLimiter(sender$1, { limitedEvents: LIMITED_EVENTS });
21
- return {
22
- get isDisabled() {
23
- return isDisabled;
24
- },
25
- register() {
26
- if (!isDisabled) {
27
- const pingCron = nodeSchedule.scheduleJob("0 0 12 * * *", () => sendEvent("ping"));
28
- crons.push(pingCron);
29
- strapi.server.use(middleware({ sendEvent }));
30
- }
31
- },
32
- bootstrap() {
33
- },
34
- destroy() {
35
- crons.forEach((cron) => cron.cancel());
36
- },
37
- async send(event, payload = {}) {
38
- if (isDisabled)
39
- return true;
40
- return sendEvent(event, payload);
41
- }
42
- };
43
- };
44
- module.exports = createTelemetryInstance;
45
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/services/metrics/index.ts"],"sourcesContent":["/**\n * Strapi telemetry package.\n * You can learn more at https://docs.strapi.io/developer-docs/latest/getting-started/usage-information.html\n */\n\nimport { Job, scheduleJob } from 'node-schedule';\nimport type { Core } from '@strapi/types';\n\nimport wrapWithRateLimit from './rate-limiter';\nimport createSender from './sender';\nimport createMiddleware from './middleware';\nimport isTruthy from './is-truthy';\n\nconst LIMITED_EVENTS = [\n 'didSaveMediaWithAlternativeText',\n 'didSaveMediaWithCaption',\n 'didDisableResponsiveDimensions',\n 'didEnableResponsiveDimensions',\n 'didInitializePluginUpload',\n];\n\nconst createTelemetryInstance = (strapi: Core.Strapi) => {\n const uuid = strapi.config.get('uuid');\n const telemetryDisabled = strapi.config.get('packageJsonStrapi.telemetryDisabled');\n const isDisabled =\n !uuid || isTruthy(process.env.STRAPI_TELEMETRY_DISABLED) || isTruthy(telemetryDisabled);\n\n const crons: Job[] = [];\n const sender = createSender(strapi);\n const sendEvent = wrapWithRateLimit(sender, { limitedEvents: LIMITED_EVENTS });\n\n return {\n get isDisabled() {\n return isDisabled;\n },\n\n register() {\n if (!isDisabled) {\n const pingCron = scheduleJob('0 0 12 * * *', () => sendEvent('ping'));\n crons.push(pingCron);\n\n strapi.server.use(createMiddleware({ sendEvent }));\n }\n },\n\n bootstrap() {},\n\n destroy() {\n // Clear open handles\n crons.forEach((cron) => cron.cancel());\n },\n\n async send(event: string, payload: Record<string, unknown> = {}) {\n if (isDisabled) return true;\n return sendEvent(event, payload);\n },\n };\n};\n\nexport default createTelemetryInstance;\n"],"names":["sender","createSender","wrapWithRateLimit","scheduleJob","createMiddleware"],"mappings":";;;;;;AAaA,MAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEM,MAAA,0BAA0B,CAAC,WAAwB;AACvD,QAAM,OAAO,OAAO,OAAO,IAAI,MAAM;AACrC,QAAM,oBAAoB,OAAO,OAAO,IAAI,qCAAqC;AAC3E,QAAA,aACJ,CAAC,QAAQ,SAAS,QAAQ,IAAI,yBAAyB,KAAK,SAAS,iBAAiB;AAExF,QAAM,QAAe,CAAA;AACf,QAAAA,WAASC,OAAa,MAAM;AAClC,QAAM,YAAYC,YAAkBF,UAAQ,EAAE,eAAe,gBAAgB;AAEtE,SAAA;AAAA,IACL,IAAI,aAAa;AACR,aAAA;AAAA,IACT;AAAA,IAEA,WAAW;AACT,UAAI,CAAC,YAAY;AACf,cAAM,WAAWG,aAAAA,YAAY,gBAAgB,MAAM,UAAU,MAAM,CAAC;AACpE,cAAM,KAAK,QAAQ;AAEnB,eAAO,OAAO,IAAIC,WAAiB,EAAE,UAAW,CAAA,CAAC;AAAA,MACnD;AAAA,IACF;AAAA,IAEA,YAAY;AAAA,IAAC;AAAA,IAEb,UAAU;AAER,YAAM,QAAQ,CAAC,SAAS,KAAK,OAAQ,CAAA;AAAA,IACvC;AAAA,IAEA,MAAM,KAAK,OAAe,UAAmC,IAAI;AAC3D,UAAA;AAAmB,eAAA;AAChB,aAAA,UAAU,OAAO,OAAO;AAAA,IACjC;AAAA,EAAA;AAEJ;;"}