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

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

Potentially problematic release.


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

Files changed (689) hide show
  1. package/dist/configuration/index.d.ts.map +1 -1
  2. package/dist/ee/index.d.ts +1 -0
  3. package/dist/ee/index.d.ts.map +1 -1
  4. package/dist/ee/license.d.ts.map +1 -1
  5. package/dist/index.js +10116 -27
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +10094 -29
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/middlewares/body.d.ts.map +1 -1
  10. package/dist/migrations/database/5.0.0-discard-drafts.d.ts +2 -2
  11. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -1
  12. package/dist/migrations/draft-publish.d.ts +1 -1
  13. package/dist/migrations/draft-publish.d.ts.map +1 -1
  14. package/dist/services/document-service/components.d.ts.map +1 -1
  15. package/dist/services/document-service/draft-and-publish.d.ts +1 -1
  16. package/dist/services/document-service/draft-and-publish.d.ts.map +1 -1
  17. package/dist/services/document-service/events.d.ts +1 -1
  18. package/dist/services/document-service/events.d.ts.map +1 -1
  19. package/dist/services/document-service/repository.d.ts.map +1 -1
  20. package/dist/services/document-service/transform/id-map.d.ts +1 -1
  21. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  22. package/dist/services/document-service/transform/id-transform.d.ts +1 -1
  23. package/dist/services/document-service/transform/id-transform.d.ts.map +1 -1
  24. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts +1 -1
  25. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts.map +1 -1
  26. package/dist/services/document-service/transform/relations/utils/dp.d.ts +1 -1
  27. package/dist/services/document-service/transform/relations/utils/dp.d.ts.map +1 -1
  28. package/dist/services/document-service/transform/relations/utils/i18n.d.ts +1 -1
  29. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  30. package/dist/services/document-service/utils/bidirectional-relations.d.ts +95 -0
  31. package/dist/services/document-service/utils/bidirectional-relations.d.ts.map +1 -0
  32. package/dist/services/document-service/utils/populate.d.ts +1 -1
  33. package/dist/services/document-service/utils/populate.d.ts.map +1 -1
  34. package/dist/services/document-service/utils/unidirectional-relations.d.ts +1 -1
  35. package/dist/services/document-service/utils/unidirectional-relations.d.ts.map +1 -1
  36. package/dist/services/entity-validator/index.d.ts +1 -1
  37. package/dist/services/entity-validator/index.d.ts.map +1 -1
  38. package/dist/services/metrics/middleware.d.ts.map +1 -1
  39. package/dist/services/metrics/rate-limiter.d.ts.map +1 -1
  40. package/dist/utils/update-notifier/index.d.ts.map +1 -1
  41. package/package.json +25 -26
  42. package/dist/Strapi.js +0 -437
  43. package/dist/Strapi.js.map +0 -1
  44. package/dist/Strapi.mjs +0 -416
  45. package/dist/Strapi.mjs.map +0 -1
  46. package/dist/compile.js +0 -18
  47. package/dist/compile.js.map +0 -1
  48. package/dist/compile.mjs +0 -17
  49. package/dist/compile.mjs.map +0 -1
  50. package/dist/configuration/config-loader.js +0 -105
  51. package/dist/configuration/config-loader.js.map +0 -1
  52. package/dist/configuration/config-loader.mjs +0 -103
  53. package/dist/configuration/config-loader.mjs.map +0 -1
  54. package/dist/configuration/get-dirs.js +0 -31
  55. package/dist/configuration/get-dirs.js.map +0 -1
  56. package/dist/configuration/get-dirs.mjs +0 -31
  57. package/dist/configuration/get-dirs.mjs.map +0 -1
  58. package/dist/configuration/index.js +0 -85
  59. package/dist/configuration/index.js.map +0 -1
  60. package/dist/configuration/index.mjs +0 -80
  61. package/dist/configuration/index.mjs.map +0 -1
  62. package/dist/configuration/urls.js +0 -68
  63. package/dist/configuration/urls.js.map +0 -1
  64. package/dist/configuration/urls.mjs +0 -66
  65. package/dist/configuration/urls.mjs.map +0 -1
  66. package/dist/container.js +0 -30
  67. package/dist/container.js.map +0 -1
  68. package/dist/container.mjs +0 -30
  69. package/dist/container.mjs.map +0 -1
  70. package/dist/core-api/controller/collection-type.js +0 -84
  71. package/dist/core-api/controller/collection-type.js.map +0 -1
  72. package/dist/core-api/controller/collection-type.mjs +0 -84
  73. package/dist/core-api/controller/collection-type.mjs.map +0 -1
  74. package/dist/core-api/controller/index.js +0 -52
  75. package/dist/core-api/controller/index.js.map +0 -1
  76. package/dist/core-api/controller/index.mjs +0 -52
  77. package/dist/core-api/controller/index.mjs.map +0 -1
  78. package/dist/core-api/controller/single-type.js +0 -46
  79. package/dist/core-api/controller/single-type.js.map +0 -1
  80. package/dist/core-api/controller/single-type.mjs +0 -46
  81. package/dist/core-api/controller/single-type.mjs.map +0 -1
  82. package/dist/core-api/controller/transform.js +0 -76
  83. package/dist/core-api/controller/transform.js.map +0 -1
  84. package/dist/core-api/controller/transform.mjs +0 -76
  85. package/dist/core-api/controller/transform.mjs.map +0 -1
  86. package/dist/core-api/routes/index.js +0 -67
  87. package/dist/core-api/routes/index.js.map +0 -1
  88. package/dist/core-api/routes/index.mjs +0 -67
  89. package/dist/core-api/routes/index.mjs.map +0 -1
  90. package/dist/core-api/service/collection-type.js +0 -67
  91. package/dist/core-api/service/collection-type.js.map +0 -1
  92. package/dist/core-api/service/collection-type.mjs +0 -67
  93. package/dist/core-api/service/collection-type.mjs.map +0 -1
  94. package/dist/core-api/service/core-service.js +0 -12
  95. package/dist/core-api/service/core-service.js.map +0 -1
  96. package/dist/core-api/service/core-service.mjs +0 -12
  97. package/dist/core-api/service/core-service.mjs.map +0 -1
  98. package/dist/core-api/service/index.js +0 -16
  99. package/dist/core-api/service/index.js.map +0 -1
  100. package/dist/core-api/service/index.mjs +0 -16
  101. package/dist/core-api/service/index.mjs.map +0 -1
  102. package/dist/core-api/service/pagination.js +0 -52
  103. package/dist/core-api/service/pagination.js.map +0 -1
  104. package/dist/core-api/service/pagination.mjs +0 -52
  105. package/dist/core-api/service/pagination.mjs.map +0 -1
  106. package/dist/core-api/service/single-type.js +0 -45
  107. package/dist/core-api/service/single-type.js.map +0 -1
  108. package/dist/core-api/service/single-type.mjs +0 -45
  109. package/dist/core-api/service/single-type.mjs.map +0 -1
  110. package/dist/domain/content-type/index.js +0 -111
  111. package/dist/domain/content-type/index.js.map +0 -1
  112. package/dist/domain/content-type/index.mjs +0 -109
  113. package/dist/domain/content-type/index.mjs.map +0 -1
  114. package/dist/domain/content-type/validator.js +0 -77
  115. package/dist/domain/content-type/validator.js.map +0 -1
  116. package/dist/domain/content-type/validator.mjs +0 -75
  117. package/dist/domain/content-type/validator.mjs.map +0 -1
  118. package/dist/domain/module/index.js +0 -107
  119. package/dist/domain/module/index.js.map +0 -1
  120. package/dist/domain/module/index.mjs +0 -105
  121. package/dist/domain/module/index.mjs.map +0 -1
  122. package/dist/domain/module/validation.js +0 -25
  123. package/dist/domain/module/validation.js.map +0 -1
  124. package/dist/domain/module/validation.mjs +0 -25
  125. package/dist/domain/module/validation.mjs.map +0 -1
  126. package/dist/ee/index.js +0 -158
  127. package/dist/ee/index.js.map +0 -1
  128. package/dist/ee/index.mjs +0 -159
  129. package/dist/ee/index.mjs.map +0 -1
  130. package/dist/ee/license.js +0 -91
  131. package/dist/ee/license.js.map +0 -1
  132. package/dist/ee/license.mjs +0 -88
  133. package/dist/ee/license.mjs.map +0 -1
  134. package/dist/factories.js +0 -80
  135. package/dist/factories.js.map +0 -1
  136. package/dist/factories.mjs +0 -80
  137. package/dist/factories.mjs.map +0 -1
  138. package/dist/loaders/admin.js +0 -26
  139. package/dist/loaders/admin.js.map +0 -1
  140. package/dist/loaders/admin.mjs +0 -25
  141. package/dist/loaders/admin.mjs.map +0 -1
  142. package/dist/loaders/apis.js +0 -137
  143. package/dist/loaders/apis.js.map +0 -1
  144. package/dist/loaders/apis.mjs +0 -135
  145. package/dist/loaders/apis.mjs.map +0 -1
  146. package/dist/loaders/components.js +0 -38
  147. package/dist/loaders/components.js.map +0 -1
  148. package/dist/loaders/components.mjs +0 -37
  149. package/dist/loaders/components.mjs.map +0 -1
  150. package/dist/loaders/index.js +0 -24
  151. package/dist/loaders/index.js.map +0 -1
  152. package/dist/loaders/index.mjs +0 -24
  153. package/dist/loaders/index.mjs.map +0 -1
  154. package/dist/loaders/middlewares.js +0 -31
  155. package/dist/loaders/middlewares.js.map +0 -1
  156. package/dist/loaders/middlewares.mjs +0 -30
  157. package/dist/loaders/middlewares.mjs.map +0 -1
  158. package/dist/loaders/plugins/get-enabled-plugins.js +0 -141
  159. package/dist/loaders/plugins/get-enabled-plugins.js.map +0 -1
  160. package/dist/loaders/plugins/get-enabled-plugins.mjs +0 -117
  161. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +0 -1
  162. package/dist/loaders/plugins/get-user-plugins-config.js +0 -27
  163. package/dist/loaders/plugins/get-user-plugins-config.js.map +0 -1
  164. package/dist/loaders/plugins/get-user-plugins-config.mjs +0 -25
  165. package/dist/loaders/plugins/get-user-plugins-config.mjs.map +0 -1
  166. package/dist/loaders/plugins/index.js +0 -144
  167. package/dist/loaders/plugins/index.js.map +0 -1
  168. package/dist/loaders/plugins/index.mjs +0 -125
  169. package/dist/loaders/plugins/index.mjs.map +0 -1
  170. package/dist/loaders/policies.js +0 -25
  171. package/dist/loaders/policies.js.map +0 -1
  172. package/dist/loaders/policies.mjs +0 -24
  173. package/dist/loaders/policies.mjs.map +0 -1
  174. package/dist/loaders/sanitizers.js +0 -6
  175. package/dist/loaders/sanitizers.js.map +0 -1
  176. package/dist/loaders/sanitizers.mjs +0 -7
  177. package/dist/loaders/sanitizers.mjs.map +0 -1
  178. package/dist/loaders/src-index.js +0 -33
  179. package/dist/loaders/src-index.js.map +0 -1
  180. package/dist/loaders/src-index.mjs +0 -34
  181. package/dist/loaders/src-index.mjs.map +0 -1
  182. package/dist/loaders/validators.js +0 -6
  183. package/dist/loaders/validators.js.map +0 -1
  184. package/dist/loaders/validators.mjs +0 -7
  185. package/dist/loaders/validators.mjs.map +0 -1
  186. package/dist/middlewares/body.js +0 -65
  187. package/dist/middlewares/body.js.map +0 -1
  188. package/dist/middlewares/body.mjs +0 -61
  189. package/dist/middlewares/body.mjs.map +0 -1
  190. package/dist/middlewares/compression.js +0 -8
  191. package/dist/middlewares/compression.js.map +0 -1
  192. package/dist/middlewares/compression.mjs +0 -6
  193. package/dist/middlewares/compression.mjs.map +0 -1
  194. package/dist/middlewares/cors.js +0 -53
  195. package/dist/middlewares/cors.js.map +0 -1
  196. package/dist/middlewares/cors.mjs +0 -51
  197. package/dist/middlewares/cors.mjs.map +0 -1
  198. package/dist/middlewares/errors.js +0 -33
  199. package/dist/middlewares/errors.js.map +0 -1
  200. package/dist/middlewares/errors.mjs +0 -33
  201. package/dist/middlewares/errors.mjs.map +0 -1
  202. package/dist/middlewares/favicon.js +0 -22
  203. package/dist/middlewares/favicon.js.map +0 -1
  204. package/dist/middlewares/favicon.mjs +0 -20
  205. package/dist/middlewares/favicon.mjs.map +0 -1
  206. package/dist/middlewares/index.js +0 -34
  207. package/dist/middlewares/index.js.map +0 -1
  208. package/dist/middlewares/index.mjs +0 -34
  209. package/dist/middlewares/index.mjs.map +0 -1
  210. package/dist/middlewares/ip.js +0 -8
  211. package/dist/middlewares/ip.js.map +0 -1
  212. package/dist/middlewares/ip.mjs +0 -6
  213. package/dist/middlewares/ip.mjs.map +0 -1
  214. package/dist/middlewares/logger.js +0 -12
  215. package/dist/middlewares/logger.js.map +0 -1
  216. package/dist/middlewares/logger.mjs +0 -12
  217. package/dist/middlewares/logger.mjs.map +0 -1
  218. package/dist/middlewares/powered-by.js +0 -14
  219. package/dist/middlewares/powered-by.js.map +0 -1
  220. package/dist/middlewares/powered-by.mjs +0 -14
  221. package/dist/middlewares/powered-by.mjs.map +0 -1
  222. package/dist/middlewares/public.js +0 -34
  223. package/dist/middlewares/public.js.map +0 -1
  224. package/dist/middlewares/public.mjs +0 -32
  225. package/dist/middlewares/public.mjs.map +0 -1
  226. package/dist/middlewares/query.js +0 -40
  227. package/dist/middlewares/query.js.map +0 -1
  228. package/dist/middlewares/query.mjs +0 -38
  229. package/dist/middlewares/query.mjs.map +0 -1
  230. package/dist/middlewares/response-time.js +0 -12
  231. package/dist/middlewares/response-time.js.map +0 -1
  232. package/dist/middlewares/response-time.mjs +0 -12
  233. package/dist/middlewares/response-time.mjs.map +0 -1
  234. package/dist/middlewares/responses.js +0 -15
  235. package/dist/middlewares/responses.js.map +0 -1
  236. package/dist/middlewares/responses.mjs +0 -15
  237. package/dist/middlewares/responses.mjs.map +0 -1
  238. package/dist/middlewares/security.js +0 -78
  239. package/dist/middlewares/security.js.map +0 -1
  240. package/dist/middlewares/security.mjs +0 -76
  241. package/dist/middlewares/security.mjs.map +0 -1
  242. package/dist/middlewares/session.js +0 -30
  243. package/dist/middlewares/session.js.map +0 -1
  244. package/dist/middlewares/session.mjs +0 -28
  245. package/dist/middlewares/session.mjs.map +0 -1
  246. package/dist/migrations/database/5.0.0-discard-drafts.js +0 -106
  247. package/dist/migrations/database/5.0.0-discard-drafts.js.map +0 -1
  248. package/dist/migrations/database/5.0.0-discard-drafts.mjs +0 -106
  249. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +0 -1
  250. package/dist/migrations/draft-publish.js +0 -42
  251. package/dist/migrations/draft-publish.js.map +0 -1
  252. package/dist/migrations/draft-publish.mjs +0 -42
  253. package/dist/migrations/draft-publish.mjs.map +0 -1
  254. package/dist/migrations/i18n.js +0 -54
  255. package/dist/migrations/i18n.js.map +0 -1
  256. package/dist/migrations/i18n.mjs +0 -54
  257. package/dist/migrations/i18n.mjs.map +0 -1
  258. package/dist/migrations/index.js +0 -15
  259. package/dist/migrations/index.js.map +0 -1
  260. package/dist/migrations/index.mjs +0 -15
  261. package/dist/migrations/index.mjs.map +0 -1
  262. package/dist/providers/admin.js +0 -20
  263. package/dist/providers/admin.js.map +0 -1
  264. package/dist/providers/admin.mjs +0 -21
  265. package/dist/providers/admin.mjs.map +0 -1
  266. package/dist/providers/coreStore.js +0 -11
  267. package/dist/providers/coreStore.js.map +0 -1
  268. package/dist/providers/coreStore.mjs +0 -12
  269. package/dist/providers/coreStore.mjs.map +0 -1
  270. package/dist/providers/cron.js +0 -20
  271. package/dist/providers/cron.js.map +0 -1
  272. package/dist/providers/cron.mjs +0 -21
  273. package/dist/providers/cron.mjs.map +0 -1
  274. package/dist/providers/index.js +0 -11
  275. package/dist/providers/index.js.map +0 -1
  276. package/dist/providers/index.mjs +0 -11
  277. package/dist/providers/index.mjs.map +0 -1
  278. package/dist/providers/provider.js +0 -5
  279. package/dist/providers/provider.js.map +0 -1
  280. package/dist/providers/provider.mjs +0 -5
  281. package/dist/providers/provider.mjs.map +0 -1
  282. package/dist/providers/registries.js +0 -35
  283. package/dist/providers/registries.js.map +0 -1
  284. package/dist/providers/registries.mjs +0 -36
  285. package/dist/providers/registries.mjs.map +0 -1
  286. package/dist/providers/telemetry.js +0 -19
  287. package/dist/providers/telemetry.js.map +0 -1
  288. package/dist/providers/telemetry.mjs +0 -20
  289. package/dist/providers/telemetry.mjs.map +0 -1
  290. package/dist/providers/webhooks.js +0 -30
  291. package/dist/providers/webhooks.js.map +0 -1
  292. package/dist/providers/webhooks.mjs +0 -31
  293. package/dist/providers/webhooks.mjs.map +0 -1
  294. package/dist/registries/apis.js +0 -23
  295. package/dist/registries/apis.js.map +0 -1
  296. package/dist/registries/apis.mjs +0 -24
  297. package/dist/registries/apis.mjs.map +0 -1
  298. package/dist/registries/components.js +0 -45
  299. package/dist/registries/components.js.map +0 -1
  300. package/dist/registries/components.mjs +0 -46
  301. package/dist/registries/components.mjs.map +0 -1
  302. package/dist/registries/content-types.js +0 -70
  303. package/dist/registries/content-types.js.map +0 -1
  304. package/dist/registries/content-types.mjs +0 -71
  305. package/dist/registries/content-types.mjs.map +0 -1
  306. package/dist/registries/controllers.js +0 -80
  307. package/dist/registries/controllers.js.map +0 -1
  308. package/dist/registries/controllers.mjs +0 -81
  309. package/dist/registries/controllers.mjs.map +0 -1
  310. package/dist/registries/custom-fields.js +0 -71
  311. package/dist/registries/custom-fields.js.map +0 -1
  312. package/dist/registries/custom-fields.mjs +0 -72
  313. package/dist/registries/custom-fields.mjs.map +0 -1
  314. package/dist/registries/hooks.js +0 -58
  315. package/dist/registries/hooks.js.map +0 -1
  316. package/dist/registries/hooks.mjs +0 -59
  317. package/dist/registries/hooks.mjs.map +0 -1
  318. package/dist/registries/middlewares.js +0 -60
  319. package/dist/registries/middlewares.js.map +0 -1
  320. package/dist/registries/middlewares.mjs +0 -61
  321. package/dist/registries/middlewares.mjs.map +0 -1
  322. package/dist/registries/models.js +0 -16
  323. package/dist/registries/models.js.map +0 -1
  324. package/dist/registries/models.mjs +0 -16
  325. package/dist/registries/models.mjs.map +0 -1
  326. package/dist/registries/modules.js +0 -39
  327. package/dist/registries/modules.js.map +0 -1
  328. package/dist/registries/modules.mjs +0 -40
  329. package/dist/registries/modules.mjs.map +0 -1
  330. package/dist/registries/namespace.js +0 -27
  331. package/dist/registries/namespace.js.map +0 -1
  332. package/dist/registries/namespace.mjs +0 -27
  333. package/dist/registries/namespace.mjs.map +0 -1
  334. package/dist/registries/plugins.js +0 -23
  335. package/dist/registries/plugins.js.map +0 -1
  336. package/dist/registries/plugins.mjs +0 -24
  337. package/dist/registries/plugins.mjs.map +0 -1
  338. package/dist/registries/policies.js +0 -108
  339. package/dist/registries/policies.js.map +0 -1
  340. package/dist/registries/policies.mjs +0 -109
  341. package/dist/registries/policies.mjs.map +0 -1
  342. package/dist/registries/sanitizers.js +0 -25
  343. package/dist/registries/sanitizers.js.map +0 -1
  344. package/dist/registries/sanitizers.mjs +0 -24
  345. package/dist/registries/sanitizers.mjs.map +0 -1
  346. package/dist/registries/services.js +0 -80
  347. package/dist/registries/services.js.map +0 -1
  348. package/dist/registries/services.mjs +0 -81
  349. package/dist/registries/services.mjs.map +0 -1
  350. package/dist/registries/validators.js +0 -25
  351. package/dist/registries/validators.js.map +0 -1
  352. package/dist/registries/validators.mjs +0 -24
  353. package/dist/registries/validators.mjs.map +0 -1
  354. package/dist/services/auth/index.js +0 -81
  355. package/dist/services/auth/index.js.map +0 -1
  356. package/dist/services/auth/index.mjs +0 -80
  357. package/dist/services/auth/index.mjs.map +0 -1
  358. package/dist/services/config.js +0 -47
  359. package/dist/services/config.js.map +0 -1
  360. package/dist/services/config.mjs +0 -47
  361. package/dist/services/config.mjs.map +0 -1
  362. package/dist/services/content-api/index.js +0 -85
  363. package/dist/services/content-api/index.js.map +0 -1
  364. package/dist/services/content-api/index.mjs +0 -84
  365. package/dist/services/content-api/index.mjs.map +0 -1
  366. package/dist/services/content-api/permissions/engine.js +0 -7
  367. package/dist/services/content-api/permissions/engine.js.map +0 -1
  368. package/dist/services/content-api/permissions/engine.mjs +0 -6
  369. package/dist/services/content-api/permissions/engine.mjs.map +0 -1
  370. package/dist/services/content-api/permissions/index.js +0 -87
  371. package/dist/services/content-api/permissions/index.js.map +0 -1
  372. package/dist/services/content-api/permissions/index.mjs +0 -86
  373. package/dist/services/content-api/permissions/index.mjs.map +0 -1
  374. package/dist/services/content-api/permissions/providers/action.js +0 -16
  375. package/dist/services/content-api/permissions/providers/action.js.map +0 -1
  376. package/dist/services/content-api/permissions/providers/action.mjs +0 -17
  377. package/dist/services/content-api/permissions/providers/action.mjs.map +0 -1
  378. package/dist/services/content-api/permissions/providers/condition.js +0 -16
  379. package/dist/services/content-api/permissions/providers/condition.js.map +0 -1
  380. package/dist/services/content-api/permissions/providers/condition.mjs +0 -17
  381. package/dist/services/content-api/permissions/providers/condition.mjs.map +0 -1
  382. package/dist/services/core-store.js +0 -107
  383. package/dist/services/core-store.js.map +0 -1
  384. package/dist/services/core-store.mjs +0 -107
  385. package/dist/services/core-store.mjs.map +0 -1
  386. package/dist/services/cron.js +0 -67
  387. package/dist/services/cron.js.map +0 -1
  388. package/dist/services/cron.mjs +0 -68
  389. package/dist/services/cron.mjs.map +0 -1
  390. package/dist/services/custom-fields.js +0 -10
  391. package/dist/services/custom-fields.js.map +0 -1
  392. package/dist/services/custom-fields.mjs +0 -11
  393. package/dist/services/custom-fields.mjs.map +0 -1
  394. package/dist/services/document-service/attributes/index.js +0 -22
  395. package/dist/services/document-service/attributes/index.js.map +0 -1
  396. package/dist/services/document-service/attributes/index.mjs +0 -22
  397. package/dist/services/document-service/attributes/index.mjs.map +0 -1
  398. package/dist/services/document-service/attributes/transforms.js +0 -20
  399. package/dist/services/document-service/attributes/transforms.js.map +0 -1
  400. package/dist/services/document-service/attributes/transforms.mjs +0 -19
  401. package/dist/services/document-service/attributes/transforms.mjs.map +0 -1
  402. package/dist/services/document-service/common.js +0 -7
  403. package/dist/services/document-service/common.js.map +0 -1
  404. package/dist/services/document-service/common.mjs +0 -7
  405. package/dist/services/document-service/common.mjs.map +0 -1
  406. package/dist/services/document-service/components.js +0 -288
  407. package/dist/services/document-service/components.js.map +0 -1
  408. package/dist/services/document-service/components.mjs +0 -286
  409. package/dist/services/document-service/components.mjs.map +0 -1
  410. package/dist/services/document-service/draft-and-publish.js +0 -69
  411. package/dist/services/document-service/draft-and-publish.js.map +0 -1
  412. package/dist/services/document-service/draft-and-publish.mjs +0 -69
  413. package/dist/services/document-service/draft-and-publish.mjs.map +0 -1
  414. package/dist/services/document-service/entries.js +0 -95
  415. package/dist/services/document-service/entries.js.map +0 -1
  416. package/dist/services/document-service/entries.mjs +0 -95
  417. package/dist/services/document-service/entries.mjs.map +0 -1
  418. package/dist/services/document-service/events.js +0 -47
  419. package/dist/services/document-service/events.js.map +0 -1
  420. package/dist/services/document-service/events.mjs +0 -47
  421. package/dist/services/document-service/events.mjs.map +0 -1
  422. package/dist/services/document-service/index.js +0 -36
  423. package/dist/services/document-service/index.js.map +0 -1
  424. package/dist/services/document-service/index.mjs +0 -36
  425. package/dist/services/document-service/index.mjs.map +0 -1
  426. package/dist/services/document-service/internationalization.js +0 -63
  427. package/dist/services/document-service/internationalization.js.map +0 -1
  428. package/dist/services/document-service/internationalization.mjs +0 -63
  429. package/dist/services/document-service/internationalization.mjs.map +0 -1
  430. package/dist/services/document-service/middlewares/errors.js +0 -25
  431. package/dist/services/document-service/middlewares/errors.js.map +0 -1
  432. package/dist/services/document-service/middlewares/errors.mjs +0 -25
  433. package/dist/services/document-service/middlewares/errors.mjs.map +0 -1
  434. package/dist/services/document-service/middlewares/middleware-manager.js +0 -49
  435. package/dist/services/document-service/middlewares/middleware-manager.js.map +0 -1
  436. package/dist/services/document-service/middlewares/middleware-manager.mjs +0 -49
  437. package/dist/services/document-service/middlewares/middleware-manager.mjs.map +0 -1
  438. package/dist/services/document-service/params.js +0 -8
  439. package/dist/services/document-service/params.js.map +0 -1
  440. package/dist/services/document-service/params.mjs +0 -8
  441. package/dist/services/document-service/params.mjs.map +0 -1
  442. package/dist/services/document-service/repository.js +0 -332
  443. package/dist/services/document-service/repository.js.map +0 -1
  444. package/dist/services/document-service/repository.mjs +0 -332
  445. package/dist/services/document-service/repository.mjs.map +0 -1
  446. package/dist/services/document-service/transform/data.js +0 -15
  447. package/dist/services/document-service/transform/data.js.map +0 -1
  448. package/dist/services/document-service/transform/data.mjs +0 -15
  449. package/dist/services/document-service/transform/data.mjs.map +0 -1
  450. package/dist/services/document-service/transform/fields.js +0 -24
  451. package/dist/services/document-service/transform/fields.js.map +0 -1
  452. package/dist/services/document-service/transform/fields.mjs +0 -24
  453. package/dist/services/document-service/transform/fields.mjs.map +0 -1
  454. package/dist/services/document-service/transform/id-map.js +0 -85
  455. package/dist/services/document-service/transform/id-map.js.map +0 -1
  456. package/dist/services/document-service/transform/id-map.mjs +0 -85
  457. package/dist/services/document-service/transform/id-map.mjs.map +0 -1
  458. package/dist/services/document-service/transform/id-transform.js +0 -33
  459. package/dist/services/document-service/transform/id-transform.js.map +0 -1
  460. package/dist/services/document-service/transform/id-transform.mjs +0 -33
  461. package/dist/services/document-service/transform/id-transform.mjs.map +0 -1
  462. package/dist/services/document-service/transform/populate.js +0 -21
  463. package/dist/services/document-service/transform/populate.js.map +0 -1
  464. package/dist/services/document-service/transform/populate.mjs +0 -21
  465. package/dist/services/document-service/transform/populate.mjs.map +0 -1
  466. package/dist/services/document-service/transform/query.js +0 -9
  467. package/dist/services/document-service/transform/query.js.map +0 -1
  468. package/dist/services/document-service/transform/query.mjs +0 -9
  469. package/dist/services/document-service/transform/query.mjs.map +0 -1
  470. package/dist/services/document-service/transform/relations/extract/data-ids.js +0 -64
  471. package/dist/services/document-service/transform/relations/extract/data-ids.js.map +0 -1
  472. package/dist/services/document-service/transform/relations/extract/data-ids.mjs +0 -64
  473. package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +0 -1
  474. package/dist/services/document-service/transform/relations/transform/data-ids.js +0 -85
  475. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +0 -1
  476. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +0 -85
  477. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +0 -1
  478. package/dist/services/document-service/transform/relations/transform/default-locale.js +0 -32
  479. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +0 -1
  480. package/dist/services/document-service/transform/relations/transform/default-locale.mjs +0 -32
  481. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +0 -1
  482. package/dist/services/document-service/transform/relations/utils/dp.js +0 -30
  483. package/dist/services/document-service/transform/relations/utils/dp.js.map +0 -1
  484. package/dist/services/document-service/transform/relations/utils/dp.mjs +0 -30
  485. package/dist/services/document-service/transform/relations/utils/dp.mjs.map +0 -1
  486. package/dist/services/document-service/transform/relations/utils/i18n.js +0 -25
  487. package/dist/services/document-service/transform/relations/utils/i18n.js.map +0 -1
  488. package/dist/services/document-service/transform/relations/utils/i18n.mjs +0 -25
  489. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +0 -1
  490. package/dist/services/document-service/transform/relations/utils/map-relation.js +0 -84
  491. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +0 -1
  492. package/dist/services/document-service/transform/relations/utils/map-relation.mjs +0 -84
  493. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +0 -1
  494. package/dist/services/document-service/utils/populate.js +0 -47
  495. package/dist/services/document-service/utils/populate.js.map +0 -1
  496. package/dist/services/document-service/utils/populate.mjs +0 -47
  497. package/dist/services/document-service/utils/populate.mjs.map +0 -1
  498. package/dist/services/document-service/utils/unidirectional-relations.js +0 -68
  499. package/dist/services/document-service/utils/unidirectional-relations.js.map +0 -1
  500. package/dist/services/document-service/utils/unidirectional-relations.mjs +0 -68
  501. package/dist/services/document-service/utils/unidirectional-relations.mjs.map +0 -1
  502. package/dist/services/entity-service/index.js +0 -169
  503. package/dist/services/entity-service/index.js.map +0 -1
  504. package/dist/services/entity-service/index.mjs +0 -167
  505. package/dist/services/entity-service/index.mjs.map +0 -1
  506. package/dist/services/entity-validator/blocks-validator.js +0 -128
  507. package/dist/services/entity-validator/blocks-validator.js.map +0 -1
  508. package/dist/services/entity-validator/blocks-validator.mjs +0 -128
  509. package/dist/services/entity-validator/blocks-validator.mjs.map +0 -1
  510. package/dist/services/entity-validator/index.js +0 -389
  511. package/dist/services/entity-validator/index.js.map +0 -1
  512. package/dist/services/entity-validator/index.mjs +0 -388
  513. package/dist/services/entity-validator/index.mjs.map +0 -1
  514. package/dist/services/entity-validator/validators.js +0 -241
  515. package/dist/services/entity-validator/validators.js.map +0 -1
  516. package/dist/services/entity-validator/validators.mjs +0 -239
  517. package/dist/services/entity-validator/validators.mjs.map +0 -1
  518. package/dist/services/errors.js +0 -76
  519. package/dist/services/errors.js.map +0 -1
  520. package/dist/services/errors.mjs +0 -74
  521. package/dist/services/errors.mjs.map +0 -1
  522. package/dist/services/event-hub.js +0 -72
  523. package/dist/services/event-hub.js.map +0 -1
  524. package/dist/services/event-hub.mjs +0 -73
  525. package/dist/services/event-hub.mjs.map +0 -1
  526. package/dist/services/features.js +0 -17
  527. package/dist/services/features.js.map +0 -1
  528. package/dist/services/features.mjs +0 -17
  529. package/dist/services/features.mjs.map +0 -1
  530. package/dist/services/fs.js +0 -51
  531. package/dist/services/fs.js.map +0 -1
  532. package/dist/services/fs.mjs +0 -49
  533. package/dist/services/fs.mjs.map +0 -1
  534. package/dist/services/metrics/admin-user-hash.js +0 -14
  535. package/dist/services/metrics/admin-user-hash.js.map +0 -1
  536. package/dist/services/metrics/admin-user-hash.mjs +0 -12
  537. package/dist/services/metrics/admin-user-hash.mjs.map +0 -1
  538. package/dist/services/metrics/index.js +0 -44
  539. package/dist/services/metrics/index.js.map +0 -1
  540. package/dist/services/metrics/index.mjs +0 -45
  541. package/dist/services/metrics/index.mjs.map +0 -1
  542. package/dist/services/metrics/is-truthy.js +0 -9
  543. package/dist/services/metrics/is-truthy.js.map +0 -1
  544. package/dist/services/metrics/is-truthy.mjs +0 -8
  545. package/dist/services/metrics/is-truthy.mjs.map +0 -1
  546. package/dist/services/metrics/middleware.js +0 -25
  547. package/dist/services/metrics/middleware.js.map +0 -1
  548. package/dist/services/metrics/middleware.mjs +0 -26
  549. package/dist/services/metrics/middleware.mjs.map +0 -1
  550. package/dist/services/metrics/rate-limiter.js +0 -21
  551. package/dist/services/metrics/rate-limiter.js.map +0 -1
  552. package/dist/services/metrics/rate-limiter.mjs +0 -22
  553. package/dist/services/metrics/rate-limiter.mjs.map +0 -1
  554. package/dist/services/metrics/sender.js +0 -76
  555. package/dist/services/metrics/sender.js.map +0 -1
  556. package/dist/services/metrics/sender.mjs +0 -70
  557. package/dist/services/metrics/sender.mjs.map +0 -1
  558. package/dist/services/query-params.js +0 -12
  559. package/dist/services/query-params.js.map +0 -1
  560. package/dist/services/query-params.mjs +0 -13
  561. package/dist/services/query-params.mjs.map +0 -1
  562. package/dist/services/reloader.js +0 -36
  563. package/dist/services/reloader.js.map +0 -1
  564. package/dist/services/reloader.mjs +0 -36
  565. package/dist/services/reloader.mjs.map +0 -1
  566. package/dist/services/request-context.js +0 -13
  567. package/dist/services/request-context.js.map +0 -1
  568. package/dist/services/request-context.mjs +0 -14
  569. package/dist/services/request-context.mjs.map +0 -1
  570. package/dist/services/server/admin-api.js +0 -13
  571. package/dist/services/server/admin-api.js.map +0 -1
  572. package/dist/services/server/admin-api.mjs +0 -13
  573. package/dist/services/server/admin-api.mjs.map +0 -1
  574. package/dist/services/server/api.js +0 -30
  575. package/dist/services/server/api.js.map +0 -1
  576. package/dist/services/server/api.mjs +0 -28
  577. package/dist/services/server/api.mjs.map +0 -1
  578. package/dist/services/server/compose-endpoint.js +0 -117
  579. package/dist/services/server/compose-endpoint.js.map +0 -1
  580. package/dist/services/server/compose-endpoint.mjs +0 -116
  581. package/dist/services/server/compose-endpoint.mjs.map +0 -1
  582. package/dist/services/server/content-api.js +0 -12
  583. package/dist/services/server/content-api.js.map +0 -1
  584. package/dist/services/server/content-api.mjs +0 -12
  585. package/dist/services/server/content-api.mjs.map +0 -1
  586. package/dist/services/server/http-server.js +0 -50
  587. package/dist/services/server/http-server.js.map +0 -1
  588. package/dist/services/server/http-server.mjs +0 -48
  589. package/dist/services/server/http-server.mjs.map +0 -1
  590. package/dist/services/server/index.js +0 -87
  591. package/dist/services/server/index.js.map +0 -1
  592. package/dist/services/server/index.mjs +0 -85
  593. package/dist/services/server/index.mjs.map +0 -1
  594. package/dist/services/server/koa.js +0 -52
  595. package/dist/services/server/koa.js.map +0 -1
  596. package/dist/services/server/koa.mjs +0 -48
  597. package/dist/services/server/koa.mjs.map +0 -1
  598. package/dist/services/server/middleware.js +0 -92
  599. package/dist/services/server/middleware.js.map +0 -1
  600. package/dist/services/server/middleware.mjs +0 -90
  601. package/dist/services/server/middleware.mjs.map +0 -1
  602. package/dist/services/server/policy.js +0 -20
  603. package/dist/services/server/policy.js.map +0 -1
  604. package/dist/services/server/policy.mjs +0 -20
  605. package/dist/services/server/policy.mjs.map +0 -1
  606. package/dist/services/server/register-middlewares.js +0 -72
  607. package/dist/services/server/register-middlewares.js.map +0 -1
  608. package/dist/services/server/register-middlewares.mjs +0 -73
  609. package/dist/services/server/register-middlewares.mjs.map +0 -1
  610. package/dist/services/server/register-routes.js +0 -76
  611. package/dist/services/server/register-routes.js.map +0 -1
  612. package/dist/services/server/register-routes.mjs +0 -75
  613. package/dist/services/server/register-routes.mjs.map +0 -1
  614. package/dist/services/server/routing.js +0 -91
  615. package/dist/services/server/routing.js.map +0 -1
  616. package/dist/services/server/routing.mjs +0 -89
  617. package/dist/services/server/routing.mjs.map +0 -1
  618. package/dist/services/utils/dynamic-zones.js +0 -17
  619. package/dist/services/utils/dynamic-zones.js.map +0 -1
  620. package/dist/services/utils/dynamic-zones.mjs +0 -18
  621. package/dist/services/utils/dynamic-zones.mjs.map +0 -1
  622. package/dist/services/webhook-runner.js +0 -133
  623. package/dist/services/webhook-runner.js.map +0 -1
  624. package/dist/services/webhook-runner.mjs +0 -131
  625. package/dist/services/webhook-runner.mjs.map +0 -1
  626. package/dist/services/webhook-store.js +0 -110
  627. package/dist/services/webhook-store.js.map +0 -1
  628. package/dist/services/webhook-store.mjs +0 -110
  629. package/dist/services/webhook-store.mjs.map +0 -1
  630. package/dist/services/worker-queue.js +0 -56
  631. package/dist/services/worker-queue.js.map +0 -1
  632. package/dist/services/worker-queue.mjs +0 -55
  633. package/dist/services/worker-queue.mjs.map +0 -1
  634. package/dist/utils/convert-custom-field-type.js +0 -24
  635. package/dist/utils/convert-custom-field-type.js.map +0 -1
  636. package/dist/utils/convert-custom-field-type.mjs +0 -24
  637. package/dist/utils/convert-custom-field-type.mjs.map +0 -1
  638. package/dist/utils/cron.js +0 -38
  639. package/dist/utils/cron.js.map +0 -1
  640. package/dist/utils/cron.mjs +0 -38
  641. package/dist/utils/cron.mjs.map +0 -1
  642. package/dist/utils/fetch.js +0 -21
  643. package/dist/utils/fetch.js.map +0 -1
  644. package/dist/utils/fetch.mjs +0 -21
  645. package/dist/utils/fetch.mjs.map +0 -1
  646. package/dist/utils/filepath-to-prop-path.js +0 -33
  647. package/dist/utils/filepath-to-prop-path.js.map +0 -1
  648. package/dist/utils/filepath-to-prop-path.mjs +0 -30
  649. package/dist/utils/filepath-to-prop-path.mjs.map +0 -1
  650. package/dist/utils/is-initialized.js +0 -16
  651. package/dist/utils/is-initialized.js.map +0 -1
  652. package/dist/utils/is-initialized.mjs +0 -16
  653. package/dist/utils/is-initialized.mjs.map +0 -1
  654. package/dist/utils/lifecycles.js +0 -9
  655. package/dist/utils/lifecycles.js.map +0 -1
  656. package/dist/utils/lifecycles.mjs +0 -9
  657. package/dist/utils/lifecycles.mjs.map +0 -1
  658. package/dist/utils/load-config-file.js +0 -45
  659. package/dist/utils/load-config-file.js.map +0 -1
  660. package/dist/utils/load-config-file.mjs +0 -42
  661. package/dist/utils/load-config-file.mjs.map +0 -1
  662. package/dist/utils/load-files.js +0 -38
  663. package/dist/utils/load-files.js.map +0 -1
  664. package/dist/utils/load-files.mjs +0 -34
  665. package/dist/utils/load-files.mjs.map +0 -1
  666. package/dist/utils/open-browser.js +0 -11
  667. package/dist/utils/open-browser.js.map +0 -1
  668. package/dist/utils/open-browser.mjs +0 -9
  669. package/dist/utils/open-browser.mjs.map +0 -1
  670. package/dist/utils/resolve-working-dirs.js +0 -13
  671. package/dist/utils/resolve-working-dirs.js.map +0 -1
  672. package/dist/utils/resolve-working-dirs.mjs +0 -11
  673. package/dist/utils/resolve-working-dirs.mjs.map +0 -1
  674. package/dist/utils/signals.js +0 -17
  675. package/dist/utils/signals.js.map +0 -1
  676. package/dist/utils/signals.mjs +0 -17
  677. package/dist/utils/signals.mjs.map +0 -1
  678. package/dist/utils/startup-logger.js +0 -86
  679. package/dist/utils/startup-logger.js.map +0 -1
  680. package/dist/utils/startup-logger.mjs +0 -82
  681. package/dist/utils/startup-logger.mjs.map +0 -1
  682. package/dist/utils/transform-content-types-to-models.js +0 -288
  683. package/dist/utils/transform-content-types-to-models.js.map +0 -1
  684. package/dist/utils/transform-content-types-to-models.mjs +0 -285
  685. package/dist/utils/transform-content-types-to-models.mjs.map +0 -1
  686. package/dist/utils/update-notifier/index.js +0 -85
  687. package/dist/utils/update-notifier/index.js.map +0 -1
  688. package/dist/utils/update-notifier/index.mjs +0 -78
  689. package/dist/utils/update-notifier/index.mjs.map +0 -1
@@ -1,72 +0,0 @@
1
- "use strict";
2
- const strapiUtils = require("@strapi/utils");
3
- const middleware = require("./middleware.js");
4
- const defaultConfig = [
5
- "strapi::logger",
6
- "strapi::errors",
7
- "strapi::security",
8
- "strapi::cors",
9
- "strapi::poweredBy",
10
- "strapi::session",
11
- "strapi::query",
12
- "strapi::body",
13
- "strapi::favicon",
14
- "strapi::public"
15
- ];
16
- const requiredMiddlewares = [
17
- "strapi::errors",
18
- "strapi::security",
19
- "strapi::cors",
20
- "strapi::query",
21
- "strapi::body",
22
- "strapi::public",
23
- "strapi::favicon"
24
- ];
25
- const middlewareConfigSchema = strapiUtils.yup.array().of(
26
- strapiUtils.yup.lazy((value) => {
27
- if (typeof value === "string") {
28
- return strapiUtils.yup.string().required();
29
- }
30
- if (typeof value === "object") {
31
- return strapiUtils.yup.object({
32
- name: strapiUtils.yup.string(),
33
- resolve: strapiUtils.yup.string(),
34
- config: strapiUtils.yup.mixed()
35
- }).required().noUnknown();
36
- }
37
- return strapiUtils.yup.mixed().test(() => false);
38
- })
39
- // FIXME: yup v1
40
- );
41
- const registerApplicationMiddlewares = async (strapi) => {
42
- const middlewareConfig = strapi.config.get("middlewares", defaultConfig);
43
- await validateMiddlewareConfig(middlewareConfig);
44
- const middlewares = await middleware.resolveMiddlewares(middlewareConfig, strapi);
45
- checkRequiredMiddlewares(middlewares);
46
- for (const middleware2 of middlewares) {
47
- strapi.server.use(middleware2.handler);
48
- }
49
- };
50
- const validateMiddlewareConfig = async (config) => {
51
- try {
52
- await middlewareConfigSchema.validate(config, { strict: true, abortEarly: false });
53
- } catch (error) {
54
- throw new Error(
55
- "Invalid middleware configuration. Expected Array<string|{name?: string, resolve?: string, config: any}."
56
- );
57
- }
58
- };
59
- const checkRequiredMiddlewares = (middlewares) => {
60
- const missingMiddlewares = requiredMiddlewares.filter((name) => {
61
- return middlewares.findIndex((mdl) => mdl.name === name) === -1;
62
- });
63
- if (missingMiddlewares.length > 0) {
64
- throw new Error(
65
- `Missing required middlewares in configuration. Add the following middlewares: "${missingMiddlewares.join(
66
- ", "
67
- )}".`
68
- );
69
- }
70
- };
71
- module.exports = registerApplicationMiddlewares;
72
- //# sourceMappingURL=register-middlewares.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-middlewares.js","sources":["../../../src/services/server/register-middlewares.ts"],"sourcesContent":["import { yup } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\nimport { resolveMiddlewares } from './middleware';\n\ntype MiddlewareConfig = (string | { name?: string; resolve?: string; config?: unknown })[];\n\nconst defaultConfig = [\n 'strapi::logger',\n 'strapi::errors',\n 'strapi::security',\n 'strapi::cors',\n 'strapi::poweredBy',\n 'strapi::session',\n 'strapi::query',\n 'strapi::body',\n 'strapi::favicon',\n 'strapi::public',\n];\n\nconst requiredMiddlewares = [\n 'strapi::errors',\n 'strapi::security',\n 'strapi::cors',\n 'strapi::query',\n 'strapi::body',\n 'strapi::public',\n 'strapi::favicon',\n];\n\nconst middlewareConfigSchema = yup.array().of(\n yup.lazy((value) => {\n if (typeof value === 'string') {\n return yup.string().required();\n }\n\n if (typeof value === 'object') {\n return yup\n .object({\n name: yup.string(),\n resolve: yup.string(),\n config: yup.mixed(),\n })\n .required()\n .noUnknown();\n }\n\n return yup.mixed().test(() => false);\n }) as any // FIXME: yup v1\n);\n\n/**\n * Register middlewares in router\n */\nconst registerApplicationMiddlewares = async (strapi: Core.Strapi) => {\n const middlewareConfig: MiddlewareConfig = strapi.config.get('middlewares', defaultConfig);\n\n await validateMiddlewareConfig(middlewareConfig);\n\n const middlewares = await resolveMiddlewares(middlewareConfig, strapi);\n\n checkRequiredMiddlewares(middlewares);\n\n // NOTE: exclude middlewares that return nothing.\n // this is used for middlewares that only extend the app only need to be added in certain conditions\n for (const middleware of middlewares) {\n strapi.server.use(middleware.handler);\n }\n};\n\n/**\n *\n * @param {MiddlewaresConfig} config\n */\nconst validateMiddlewareConfig = async (config: MiddlewareConfig) => {\n try {\n await middlewareConfigSchema.validate(config, { strict: true, abortEarly: false });\n } catch (error) {\n throw new Error(\n 'Invalid middleware configuration. Expected Array<string|{name?: string, resolve?: string, config: any}.'\n );\n }\n};\n\n/**\n * Check if some required middlewares are missing in configure middlewares\n * @param {Middlewares} middlewares\n */\nconst checkRequiredMiddlewares = (middlewares: { name: string | null }[]) => {\n const missingMiddlewares = requiredMiddlewares.filter((name) => {\n return middlewares.findIndex((mdl) => mdl.name === name) === -1;\n });\n\n if (missingMiddlewares.length > 0) {\n throw new Error(\n `Missing required middlewares in configuration. Add the following middlewares: \"${missingMiddlewares.join(\n ', '\n )}\".`\n );\n }\n};\n\nexport default registerApplicationMiddlewares;\n"],"names":["yup","resolveMiddlewares","middleware"],"mappings":";;;AAMA,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,yBAAyBA,YAAAA,IAAI,MAAA,EAAQ;AAAA,EACzCA,gBAAI,KAAK,CAAC,UAAU;AACd,QAAA,OAAO,UAAU,UAAU;AACtB,aAAAA,YAAA,IAAI,OAAO,EAAE,SAAS;AAAA,IAAA;AAG3B,QAAA,OAAO,UAAU,UAAU;AAC7B,aAAOA,YAAAA,IACJ,OAAO;AAAA,QACN,MAAMA,gBAAI,OAAO;AAAA,QACjB,SAASA,gBAAI,OAAO;AAAA,QACpB,QAAQA,gBAAI,MAAM;AAAA,MAAA,CACnB,EACA,SAAS,EACT,UAAU;AAAA,IAAA;AAGf,WAAOA,YAAI,IAAA,MAAA,EAAQ,KAAK,MAAM,KAAK;AAAA,EACpC,CAAA;AAAA;AACH;AAKM,MAAA,iCAAiC,OAAO,WAAwB;AACpE,QAAM,mBAAqC,OAAO,OAAO,IAAI,eAAe,aAAa;AAEzF,QAAM,yBAAyB,gBAAgB;AAE/C,QAAM,cAAc,MAAMC,8BAAmB,kBAAkB,MAAM;AAErE,2BAAyB,WAAW;AAIpC,aAAWC,eAAc,aAAa;AAC7B,WAAA,OAAO,IAAIA,YAAW,OAAO;AAAA,EAAA;AAExC;AAMA,MAAM,2BAA2B,OAAO,WAA6B;AAC/D,MAAA;AACI,UAAA,uBAAuB,SAAS,QAAQ,EAAE,QAAQ,MAAM,YAAY,OAAO;AAAA,WAC1E,OAAO;AACd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAEJ;AAMA,MAAM,2BAA2B,CAAC,gBAA2C;AAC3E,QAAM,qBAAqB,oBAAoB,OAAO,CAAC,SAAS;AAC9D,WAAO,YAAY,UAAU,CAAC,QAAQ,IAAI,SAAS,IAAI,MAAM;AAAA,EAAA,CAC9D;AAEG,MAAA,mBAAmB,SAAS,GAAG;AACjC,UAAM,IAAI;AAAA,MACR,kFAAkF,mBAAmB;AAAA,QACnG;AAAA,MAAA,CACD;AAAA,IACH;AAAA,EAAA;AAEJ;;"}
@@ -1,73 +0,0 @@
1
- import { yup } from "@strapi/utils";
2
- import { resolveMiddlewares } from "./middleware.mjs";
3
- const defaultConfig = [
4
- "strapi::logger",
5
- "strapi::errors",
6
- "strapi::security",
7
- "strapi::cors",
8
- "strapi::poweredBy",
9
- "strapi::session",
10
- "strapi::query",
11
- "strapi::body",
12
- "strapi::favicon",
13
- "strapi::public"
14
- ];
15
- const requiredMiddlewares = [
16
- "strapi::errors",
17
- "strapi::security",
18
- "strapi::cors",
19
- "strapi::query",
20
- "strapi::body",
21
- "strapi::public",
22
- "strapi::favicon"
23
- ];
24
- const middlewareConfigSchema = yup.array().of(
25
- yup.lazy((value) => {
26
- if (typeof value === "string") {
27
- return yup.string().required();
28
- }
29
- if (typeof value === "object") {
30
- return yup.object({
31
- name: yup.string(),
32
- resolve: yup.string(),
33
- config: yup.mixed()
34
- }).required().noUnknown();
35
- }
36
- return yup.mixed().test(() => false);
37
- })
38
- // FIXME: yup v1
39
- );
40
- const registerApplicationMiddlewares = async (strapi) => {
41
- const middlewareConfig = strapi.config.get("middlewares", defaultConfig);
42
- await validateMiddlewareConfig(middlewareConfig);
43
- const middlewares = await resolveMiddlewares(middlewareConfig, strapi);
44
- checkRequiredMiddlewares(middlewares);
45
- for (const middleware of middlewares) {
46
- strapi.server.use(middleware.handler);
47
- }
48
- };
49
- const validateMiddlewareConfig = async (config) => {
50
- try {
51
- await middlewareConfigSchema.validate(config, { strict: true, abortEarly: false });
52
- } catch (error) {
53
- throw new Error(
54
- "Invalid middleware configuration. Expected Array<string|{name?: string, resolve?: string, config: any}."
55
- );
56
- }
57
- };
58
- const checkRequiredMiddlewares = (middlewares) => {
59
- const missingMiddlewares = requiredMiddlewares.filter((name) => {
60
- return middlewares.findIndex((mdl) => mdl.name === name) === -1;
61
- });
62
- if (missingMiddlewares.length > 0) {
63
- throw new Error(
64
- `Missing required middlewares in configuration. Add the following middlewares: "${missingMiddlewares.join(
65
- ", "
66
- )}".`
67
- );
68
- }
69
- };
70
- export {
71
- registerApplicationMiddlewares as default
72
- };
73
- //# sourceMappingURL=register-middlewares.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-middlewares.mjs","sources":["../../../src/services/server/register-middlewares.ts"],"sourcesContent":["import { yup } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\nimport { resolveMiddlewares } from './middleware';\n\ntype MiddlewareConfig = (string | { name?: string; resolve?: string; config?: unknown })[];\n\nconst defaultConfig = [\n 'strapi::logger',\n 'strapi::errors',\n 'strapi::security',\n 'strapi::cors',\n 'strapi::poweredBy',\n 'strapi::session',\n 'strapi::query',\n 'strapi::body',\n 'strapi::favicon',\n 'strapi::public',\n];\n\nconst requiredMiddlewares = [\n 'strapi::errors',\n 'strapi::security',\n 'strapi::cors',\n 'strapi::query',\n 'strapi::body',\n 'strapi::public',\n 'strapi::favicon',\n];\n\nconst middlewareConfigSchema = yup.array().of(\n yup.lazy((value) => {\n if (typeof value === 'string') {\n return yup.string().required();\n }\n\n if (typeof value === 'object') {\n return yup\n .object({\n name: yup.string(),\n resolve: yup.string(),\n config: yup.mixed(),\n })\n .required()\n .noUnknown();\n }\n\n return yup.mixed().test(() => false);\n }) as any // FIXME: yup v1\n);\n\n/**\n * Register middlewares in router\n */\nconst registerApplicationMiddlewares = async (strapi: Core.Strapi) => {\n const middlewareConfig: MiddlewareConfig = strapi.config.get('middlewares', defaultConfig);\n\n await validateMiddlewareConfig(middlewareConfig);\n\n const middlewares = await resolveMiddlewares(middlewareConfig, strapi);\n\n checkRequiredMiddlewares(middlewares);\n\n // NOTE: exclude middlewares that return nothing.\n // this is used for middlewares that only extend the app only need to be added in certain conditions\n for (const middleware of middlewares) {\n strapi.server.use(middleware.handler);\n }\n};\n\n/**\n *\n * @param {MiddlewaresConfig} config\n */\nconst validateMiddlewareConfig = async (config: MiddlewareConfig) => {\n try {\n await middlewareConfigSchema.validate(config, { strict: true, abortEarly: false });\n } catch (error) {\n throw new Error(\n 'Invalid middleware configuration. Expected Array<string|{name?: string, resolve?: string, config: any}.'\n );\n }\n};\n\n/**\n * Check if some required middlewares are missing in configure middlewares\n * @param {Middlewares} middlewares\n */\nconst checkRequiredMiddlewares = (middlewares: { name: string | null }[]) => {\n const missingMiddlewares = requiredMiddlewares.filter((name) => {\n return middlewares.findIndex((mdl) => mdl.name === name) === -1;\n });\n\n if (missingMiddlewares.length > 0) {\n throw new Error(\n `Missing required middlewares in configuration. Add the following middlewares: \"${missingMiddlewares.join(\n ', '\n )}\".`\n );\n }\n};\n\nexport default registerApplicationMiddlewares;\n"],"names":[],"mappings":";;AAMA,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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0 @@
1
- "use strict";
2
- const _ = require("lodash");
3
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
4
- const ___default = /* @__PURE__ */ _interopDefault(_);
5
- const createRouteScopeGenerator = (namespace) => (route) => {
6
- const prefix = namespace.endsWith("::") ? namespace : `${namespace}.`;
7
- if (typeof route.handler === "string") {
8
- ___default.default.defaultsDeep(route, {
9
- config: {
10
- auth: {
11
- scope: [`${route.handler.startsWith(prefix) ? "" : prefix}${route.handler}`]
12
- }
13
- }
14
- });
15
- }
16
- };
17
- const registerAllRoutes = (strapi) => {
18
- registerAdminRoutes(strapi);
19
- registerAPIRoutes(strapi);
20
- registerPluginRoutes(strapi);
21
- };
22
- const registerAdminRoutes = (strapi) => {
23
- const generateRouteScope = createRouteScopeGenerator(`admin::`);
24
- ___default.default.forEach(strapi.admin.routes, (router) => {
25
- router.type = router.type || "admin";
26
- router.prefix = router.prefix || `/admin`;
27
- router.routes.forEach((route) => {
28
- generateRouteScope(route);
29
- route.info = { pluginName: "admin" };
30
- });
31
- strapi.server.routes(router);
32
- });
33
- };
34
- const registerPluginRoutes = (strapi) => {
35
- for (const pluginName of Object.keys(strapi.plugins)) {
36
- const plugin = strapi.plugins[pluginName];
37
- const generateRouteScope = createRouteScopeGenerator(`plugin::${pluginName}`);
38
- if (Array.isArray(plugin.routes)) {
39
- plugin.routes.forEach((route) => {
40
- generateRouteScope(route);
41
- route.info = { pluginName };
42
- });
43
- strapi.server.routes({
44
- type: "admin",
45
- prefix: `/${pluginName}`,
46
- routes: plugin.routes
47
- });
48
- } else {
49
- ___default.default.forEach(plugin.routes, (router) => {
50
- router.type = router.type || "admin";
51
- router.prefix = router.prefix || `/${pluginName}`;
52
- router.routes.forEach((route) => {
53
- generateRouteScope(route);
54
- route.info = { pluginName };
55
- });
56
- strapi.server.routes(router);
57
- });
58
- }
59
- }
60
- };
61
- const registerAPIRoutes = (strapi) => {
62
- for (const apiName of Object.keys(strapi.apis)) {
63
- const api = strapi.api(apiName);
64
- const generateRouteScope = createRouteScopeGenerator(`api::${apiName}`);
65
- ___default.default.forEach(api.routes, (router) => {
66
- router.type = "content-api";
67
- router.routes?.forEach((route) => {
68
- generateRouteScope(route);
69
- route.info = { apiName };
70
- });
71
- return strapi.server.routes(router);
72
- });
73
- }
74
- };
75
- module.exports = registerAllRoutes;
76
- //# sourceMappingURL=register-routes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-routes.js","sources":["../../../src/services/server/register-routes.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\n\nconst createRouteScopeGenerator = (namespace: string) => (route: Core.RouteInput) => {\n const prefix = namespace.endsWith('::') ? namespace : `${namespace}.`;\n\n if (typeof route.handler === 'string') {\n _.defaultsDeep(route, {\n config: {\n auth: {\n scope: [`${route.handler.startsWith(prefix) ? '' : prefix}${route.handler}`],\n },\n },\n });\n }\n};\n\n/**\n * Register all routes\n */\nexport default (strapi: Core.Strapi) => {\n registerAdminRoutes(strapi);\n registerAPIRoutes(strapi);\n registerPluginRoutes(strapi);\n};\n\n/**\n * Register admin routes\n * @param {import('../../').Strapi} strapi\n */\nconst registerAdminRoutes = (strapi: Core.Strapi) => {\n const generateRouteScope = createRouteScopeGenerator(`admin::`);\n\n _.forEach(strapi.admin.routes, (router) => {\n router.type = router.type || 'admin';\n router.prefix = router.prefix || `/admin`;\n router.routes.forEach((route) => {\n generateRouteScope(route);\n route.info = { pluginName: 'admin' };\n });\n strapi.server.routes(router);\n });\n};\n\n/**\n * Register plugin routes\n * @param {import('../../').Strapi} strapi\n */\nconst registerPluginRoutes = (strapi: Core.Strapi) => {\n for (const pluginName of Object.keys(strapi.plugins)) {\n const plugin = strapi.plugins[pluginName];\n\n const generateRouteScope = createRouteScopeGenerator(`plugin::${pluginName}`);\n\n if (Array.isArray(plugin.routes)) {\n plugin.routes.forEach((route) => {\n generateRouteScope(route);\n route.info = { pluginName };\n });\n\n strapi.server.routes({\n type: 'admin',\n prefix: `/${pluginName}`,\n routes: plugin.routes,\n });\n } else {\n _.forEach(plugin.routes, (router) => {\n router.type = router.type || 'admin';\n router.prefix = router.prefix || `/${pluginName}`;\n router.routes.forEach((route) => {\n generateRouteScope(route);\n route.info = { pluginName };\n });\n\n strapi.server.routes(router);\n });\n }\n }\n};\n\n/**\n * Register api routes\n */\nconst registerAPIRoutes = (strapi: Core.Strapi) => {\n for (const apiName of Object.keys(strapi.apis)) {\n const api = strapi.api(apiName);\n\n const generateRouteScope = createRouteScopeGenerator(`api::${apiName}`);\n\n _.forEach(api.routes, (router) => {\n // TODO: remove once auth setup\n // pass meta down to compose endpoint\n router.type = 'content-api';\n router.routes?.forEach((route) => {\n generateRouteScope(route);\n route.info = { apiName };\n });\n\n return strapi.server.routes(router);\n });\n }\n};\n"],"names":["_"],"mappings":";;;;AAGA,MAAM,4BAA4B,CAAC,cAAsB,CAAC,UAA2B;AACnF,QAAM,SAAS,UAAU,SAAS,IAAI,IAAI,YAAY,GAAG,SAAS;AAE9D,MAAA,OAAO,MAAM,YAAY,UAAU;AACrCA,eAAA,QAAE,aAAa,OAAO;AAAA,MACpB,QAAQ;AAAA,QACN,MAAM;AAAA,UACJ,OAAO,CAAC,GAAG,MAAM,QAAQ,WAAW,MAAM,IAAI,KAAK,MAAM,GAAG,MAAM,OAAO,EAAE;AAAA,QAAA;AAAA,MAC7E;AAAA,IACF,CACD;AAAA,EAAA;AAEL;AAKA,MAAe,oBAAA,CAAC,WAAwB;AACtC,sBAAoB,MAAM;AAC1B,oBAAkB,MAAM;AACxB,uBAAqB,MAAM;AAC7B;AAMA,MAAM,sBAAsB,CAAC,WAAwB;AAC7C,QAAA,qBAAqB,0BAA0B,SAAS;AAE9DA,aAAA,QAAE,QAAQ,OAAO,MAAM,QAAQ,CAAC,WAAW;AAClC,WAAA,OAAO,OAAO,QAAQ;AACtB,WAAA,SAAS,OAAO,UAAU;AAC1B,WAAA,OAAO,QAAQ,CAAC,UAAU;AAC/B,yBAAmB,KAAK;AAClB,YAAA,OA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O,OAAO,MAAM;AAAA,IAAA,CACnC;AAAA,EAAA;AAEL;;"}
@@ -1,75 +0,0 @@
1
- import _ from "lodash";
2
- const createRouteScopeGenerator = (namespace) => (route) => {
3
- const prefix = namespace.endsWith("::") ? namespace : `${namespace}.`;
4
- if (typeof route.handler === "string") {
5
- _.defaultsDeep(route, {
6
- config: {
7
- auth: {
8
- scope: [`${route.handler.startsWith(prefix) ? "" : prefix}${route.handler}`]
9
- }
10
- }
11
- });
12
- }
13
- };
14
- const registerAllRoutes = (strapi) => {
15
- registerAdminRoutes(strapi);
16
- registerAPIRoutes(strapi);
17
- registerPluginRoutes(strapi);
18
- };
19
- const registerAdminRoutes = (strapi) => {
20
- const generateRouteScope = createRouteScopeGenerator(`admin::`);
21
- _.forEach(strapi.admin.routes, (router) => {
22
- router.type = router.type || "admin";
23
- router.prefix = router.prefix || `/admin`;
24
- router.routes.forEach((route) => {
25
- generateRouteScope(route);
26
- route.info = { pluginName: "admin" };
27
- });
28
- strapi.server.routes(router);
29
- });
30
- };
31
- const registerPluginRoutes = (strapi) => {
32
- for (const pluginName of Object.keys(strapi.plugins)) {
33
- const plugin = strapi.plugins[pluginName];
34
- const generateRouteScope = createRouteScopeGenerator(`plugin::${pluginName}`);
35
- if (Array.isArray(plugin.routes)) {
36
- plugin.routes.forEach((route) => {
37
- generateRouteScope(route);
38
- route.info = { pluginName };
39
- });
40
- strapi.server.routes({
41
- type: "admin",
42
- prefix: `/${pluginName}`,
43
- routes: plugin.routes
44
- });
45
- } else {
46
- _.forEach(plugin.routes, (router) => {
47
- router.type = router.type || "admin";
48
- router.prefix = router.prefix || `/${pluginName}`;
49
- router.routes.forEach((route) => {
50
- generateRouteScope(route);
51
- route.info = { pluginName };
52
- });
53
- strapi.server.routes(router);
54
- });
55
- }
56
- }
57
- };
58
- const registerAPIRoutes = (strapi) => {
59
- for (const apiName of Object.keys(strapi.apis)) {
60
- const api = strapi.api(apiName);
61
- const generateRouteScope = createRouteScopeGenerator(`api::${apiName}`);
62
- _.forEach(api.routes, (router) => {
63
- router.type = "content-api";
64
- router.routes?.forEach((route) => {
65
- generateRouteScope(route);
66
- route.info = { apiName };
67
- });
68
- return strapi.server.routes(router);
69
- });
70
- }
71
- };
72
- export {
73
- registerAllRoutes as default
74
- };
75
- //# sourceMappingURL=register-routes.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-routes.mjs","sources":["../../../src/services/server/register-routes.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\n\nconst createRouteScopeGenerator = (namespace: string) => (route: Core.RouteInput) => {\n const prefix = namespace.endsWith('::') ? namespace : `${namespace}.`;\n\n if (typeof route.handler === 'string') {\n _.defaultsDeep(route, {\n config: {\n auth: {\n scope: [`${route.handler.startsWith(prefix) ? '' : prefix}${route.handler}`],\n },\n },\n });\n }\n};\n\n/**\n * Register all routes\n */\nexport default (strapi: Core.Strapi) => {\n registerAdminRoutes(strapi);\n registerAPIRoutes(strapi);\n registerPluginRoutes(strapi);\n};\n\n/**\n * Register admin routes\n * @param {import('../../').Strapi} strapi\n */\nconst registerAdminRoutes = (strapi: Core.Strapi) => {\n const generateRouteScope = createRouteScopeGenerator(`admin::`);\n\n _.forEach(strapi.admin.routes, (router) => {\n router.type = router.type || 'admin';\n router.prefix = router.prefix || `/admin`;\n router.routes.forEach((route) => {\n generateRouteScope(route);\n route.info = { pluginName: 'admin' };\n });\n strapi.server.routes(router);\n });\n};\n\n/**\n * Register plugin routes\n * @param {import('../../').Strapi} strapi\n */\nconst registerPluginRoutes = (strapi: Core.Strapi) => {\n for (const pluginName of Object.keys(strapi.plugins)) {\n const plugin = strapi.plugins[pluginName];\n\n const generateRouteScope = createRouteScopeGenerator(`plugin::${pluginName}`);\n\n if (Array.isArray(plugin.routes)) {\n plugin.routes.forEach((route) => {\n generateRouteScope(route);\n route.info = { pluginName };\n });\n\n strapi.server.routes({\n type: 'admin',\n prefix: `/${pluginName}`,\n routes: plugin.routes,\n });\n } else {\n _.forEach(plugin.routes, (router) => {\n router.type = router.type || 'admin';\n router.prefix = router.prefix || `/${pluginName}`;\n router.routes.forEach((route) => {\n generateRouteScope(route);\n route.info = { pluginName };\n });\n\n strapi.server.routes(router);\n });\n }\n }\n};\n\n/**\n * Register api routes\n */\nconst registerAPIRoutes = (strapi: Core.Strapi) => {\n for (const apiName of Object.keys(strapi.apis)) {\n const api = strapi.api(apiName);\n\n const generateRouteScope = createRouteScopeGenerator(`api::${apiName}`);\n\n _.forEach(api.routes, (router) => {\n // TODO: remove once auth setup\n // pass meta down to compose endpoint\n router.type = 'content-api';\n router.routes?.forEach((route) => {\n generateRouteScope(route);\n route.info = { apiName };\n });\n\n return strapi.server.routes(router);\n });\n }\n};\n"],"names":[],"mappings":";AAGA,MAAM,4BAA4B,CAAC,cAAsB,CAAC,UAA2B;AACnF,QAAM,SAAS,UAAU,SAAS,IAAI,IAAI,YAAY,GAAG,SAAS;AAE9D,MAAA,OAAO,MAAM,YAAY,UAAU;AACrC,MAAE,aAAa,OAAO;AAAA,MACpB,QAAQ;AAAA,QACN,MAAM;AAAA,UACJ,OAAO,CAAC,GAAG,MAAM,QAAQ,WAAW,MAAM,IAAI,KAAK,MAAM,GAAG,MAAM,OAAO,EAAE;AAAA,QAAA;AAAA,MAC7E;AAAA,IACF,CACD;AAAA,EAAA;AAEL;AAKA,MAAe,oBAAA,CAAC,WAAwB;AACtC,sBAAoB,MAAM;AAC1B,oBAAkB,MAAM;AACxB,uBAAqB,MAAM;AAC7B;AAMA,MAAM,sBAAsB,CAAC,WAAwB;AAC7C,QAAA,qBAAqB,0BAA0B,SAAS;AAE9D,IAAE,QAAQ,OAAO,MAAM,QAAQ,CAAC,WAAW;AAClC,WAAA,OAAO,OAAO,QAAQ;AACtB,WAAA,SAAS,OAAO,UAAU;AAC1B,WAAA,OAAO,QAAQ,CAAC,UAAU;AAC/B,yBAAmB,KAAK;AAClB,YAAA,OAAO,EAAE,YAAY,QAAQ;AAAA,IAAA,CACpC;AACM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 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Router = require("@koa/router");
4
- const fp = require("lodash/fp");
5
- const strapiUtils = require("@strapi/utils");
6
- const composeEndpoint = require("./compose-endpoint.js");
7
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
8
- const Router__default = /* @__PURE__ */ _interopDefault(Router);
9
- const policyOrMiddlewareSchema = strapiUtils.yup.lazy((value) => {
10
- if (typeof value === "string") {
11
- return strapiUtils.yup.string().required();
12
- }
13
- if (typeof value === "function") {
14
- return strapiUtils.yup.mixed().isFunction();
15
- }
16
- return strapiUtils.yup.object({
17
- name: strapiUtils.yup.string().required(),
18
- options: strapiUtils.yup.object().notRequired()
19
- // any options
20
- });
21
- });
22
- const routeSchema = strapiUtils.yup.object({
23
- method: strapiUtils.yup.string().oneOf(["GET", "POST", "PUT", "PATCH", "DELETE", "ALL"]).required(),
24
- path: strapiUtils.yup.string().required(),
25
- handler: strapiUtils.yup.lazy((value) => {
26
- if (typeof value === "string") {
27
- return strapiUtils.yup.string().required();
28
- }
29
- if (Array.isArray(value)) {
30
- return strapiUtils.yup.array().required();
31
- }
32
- return strapiUtils.yup.mixed().isFunction().required();
33
- }),
34
- config: strapiUtils.yup.object({
35
- auth: strapiUtils.yup.lazy((value) => {
36
- if (value === false) {
37
- return strapiUtils.yup.boolean().required();
38
- }
39
- return strapiUtils.yup.object({
40
- scope: strapiUtils.yup.array().of(strapiUtils.yup.string()).required()
41
- });
42
- }),
43
- policies: strapiUtils.yup.array().of(policyOrMiddlewareSchema).notRequired(),
44
- middlewares: strapiUtils.yup.array().of(policyOrMiddlewareSchema).notRequired()
45
- }).notRequired()
46
- });
47
- const validateRouteConfig = (routeConfig) => {
48
- try {
49
- return routeSchema.validateSync(routeConfig, {
50
- strict: true,
51
- abortEarly: false,
52
- stripUnknown: true
53
- });
54
- } catch (error) {
55
- if (error instanceof strapiUtils.yup.ValidationError) {
56
- throw new Error(`Invalid route config ${error.message}`);
57
- }
58
- }
59
- };
60
- const createRouteManager = (strapi, opts = {}) => {
61
- const { type } = opts;
62
- const composeEndpoint$1 = composeEndpoint(strapi);
63
- const createRoute = (route, router) => {
64
- validateRouteConfig(route);
65
- const routeWithInfo = Object.assign(route, {
66
- info: {
67
- ...route.info ?? {},
68
- type: type || "api"
69
- }
70
- });
71
- composeEndpoint$1(routeWithInfo, { router });
72
- };
73
- const addRoutes = (routes, router) => {
74
- if (Array.isArray(routes)) {
75
- routes.forEach((route) => createRoute(route, router));
76
- } else if (routes.routes) {
77
- const subRouter = new Router__default.default({ prefix: routes.prefix });
78
- routes.routes.forEach((route) => {
79
- const hasPrefix = fp.has("prefix", route.config);
80
- createRoute(route, hasPrefix ? router : subRouter);
81
- });
82
- return router.use(subRouter.routes(), subRouter.allowedMethods());
83
- }
84
- };
85
- return {
86
- addRoutes
87
- };
88
- };
89
- exports.createRouteManager = createRouteManager;
90
- exports.validateRouteConfig = validateRouteConfig;
91
- //# sourceMappingURL=routing.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routing.js","sources":["../../../src/services/server/routing.ts"],"sourcesContent":["import Router from '@koa/router';\nimport { has } from 'lodash/fp';\nimport { yup } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\n\nimport createEndpointComposer from './compose-endpoint';\n\nconst policyOrMiddlewareSchema = yup.lazy((value) => {\n if (typeof value === 'string') {\n return yup.string().required();\n }\n\n if (typeof value === 'function') {\n return yup.mixed().isFunction();\n }\n\n return yup.object({\n name: yup.string().required(),\n options: yup.object().notRequired(), // any options\n });\n});\n\nconst routeSchema = yup.object({\n method: yup.string().oneOf(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'ALL']).required(),\n path: yup.string().required(),\n handler: yup.lazy((value) => {\n if (typeof value === 'string') {\n return yup.string().required();\n }\n\n if (Array.isArray(value)) {\n return yup.array().required();\n }\n\n return yup.mixed().isFunction().required();\n }),\n config: yup\n .object({\n auth: yup.lazy((value) => {\n if (value === false) {\n return yup.boolean().required();\n }\n\n return yup.object({\n scope: yup.array().of(yup.string()).required(),\n });\n }),\n policies: yup\n .array()\n // FIXME: fixed in yup v1\n .of(policyOrMiddlewareSchema as any)\n .notRequired(),\n middlewares: yup\n .array()\n // FIXME: fixed in yup v1\n .of(policyOrMiddlewareSchema as any)\n .notRequired(),\n })\n .notRequired(),\n});\n\nconst validateRouteConfig = (routeConfig: Core.RouteInput) => {\n try {\n return routeSchema.validateSync(routeConfig, {\n strict: true,\n abortEarly: false,\n stripUnknown: true,\n });\n } catch (error) {\n if (error instanceof yup.ValidationError) {\n throw new Error(`Invalid route config ${error.message}`);\n }\n }\n};\n\nconst createRouteManager = (strapi: Core.Strapi, opts: { type?: string } = {}) => {\n const { type } = opts;\n\n const composeEndpoint = createEndpointComposer(strapi);\n\n const createRoute = (route: Core.RouteInput, router: Router) => {\n validateRouteConfig(route);\n\n // NOTE: the router type is used to tag controller actions and for authentication / authorization so we need to pass this info down to the route level\n const routeWithInfo = Object.assign(route, {\n info: {\n ...(route.info ?? {}),\n type: type || 'api',\n },\n });\n\n composeEndpoint(routeWithInfo, { router });\n };\n\n const addRoutes = (routes: Core.Router | Core.RouteInput[], router: Router) => {\n if (Array.isArray(routes)) {\n routes.forEach((route) => createRoute(route, router));\n } else if (routes.routes) {\n const subRouter = new Router({ prefix: routes.prefix });\n\n routes.routes.forEach((route) => {\n const hasPrefix = has('prefix', route.config);\n createRoute(route, hasPrefix ? router : subRouter);\n });\n\n return router.use(subRouter.routes(), subRouter.allowedMethods());\n }\n };\n\n return {\n addRoutes,\n };\n};\n\nexport { validateRouteConfig, createRouteManager };\n"],"names":["yup","composeEndpoint","createEndpointComposer","Router","has"],"mappings":";;;;;;;;AAOA,MAAM,2BAA2BA,YAAA,IAAI,KAAK,CAAC,UAAU;AAC/C,MAAA,OAAO,UAAU,UAAU;AACtB,WAAAA,YAAA,IAAI,OAAO,EAAE,SAAS;AAAA,EAAA;AAG3B,MAAA,OAAO,UAAU,YAAY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iC;AACxD,MAAA;AACK,WAAA,YAAY,aAAa,aAAa;AAAA,MAC3C,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,cAAc;AAAA,IAAA,CACf;AAAA,WACM,OAAO;AACV,QAAA,iBAAiBA,gBAAI,iBAAiB;AACxC,YAAM,IAAI,MAAM,wBAAwB,MAAM,OAAO,EAAE;AAAA,IAAA;AAAA,EACzD;AAEJ;AAEA,MAAM,qBAAqB,CAAC,QAAqB,OAA0B,OAAO;AAC1E,QAAA,EAAE,SAAS;AAEX,QAAAC,oBAAkBC,gBAAuB,MAAM;AAE/C,QAAA,cAAc,CAAC,OAAwB,WAAmB;AAC9D,wBAAoB,KAAK;AAGnB,UAAA,gBAAgB,OAAO,OAAO,OAAO;AAAA,MACzC,MAAM;AAAA,QACJ,GAAI,MAAM,QAAQ,CAAC;AAAA,QACnB,MAAM,QAAQ;AAAA,MAAA;AAAA,IAChB,CACD;AAEeD,sBAAA,eAAe,EAAE,QAAQ;AAAA,EAC3C;AAEM,QAAA,YAAY,CAAC,QAAyC,WAAmB;AACzE,QAAA,MAAM,QAAQ,MAAM,GAAG;AACzB,aAAO,QAAQ,CAAC,UAAU,YAAY,OAAO,MAAM,CAAC;AAAA,IAAA,WAC3C,OAAO,QAAQ;AACxB,YAAM,YAAY,IAAIE,gBAAA,QAAO,EAAE,QAAQ,OAAO,QAAQ;AAE/C,aAAA,OAAO,QAAQ,CAAC,UAAU;AAC/B,cAAM,YAAYC,GAAA,IAAI,UAAU,MAAM,MAAM;AAChC,oBAAA,OAAO,YAAY,SAAS,SAAS;AAAA,MAAA,CAClD;AAED,aAAO,OAAO,IAAI,UAAU,UAAU,UAAU,gBAAgB;AAAA,IAAA;AAAA,EAEpE;AAEO,SAAA;AAAA,IACL;AAAA,EACF;AACF;;;"}
@@ -1,89 +0,0 @@
1
- import Router from "@koa/router";
2
- import { has } from "lodash/fp";
3
- import { yup } from "@strapi/utils";
4
- import createEndpointComposer from "./compose-endpoint.mjs";
5
- const policyOrMiddlewareSchema = yup.lazy((value) => {
6
- if (typeof value === "string") {
7
- return yup.string().required();
8
- }
9
- if (typeof value === "function") {
10
- return yup.mixed().isFunction();
11
- }
12
- return yup.object({
13
- name: yup.string().required(),
14
- options: yup.object().notRequired()
15
- // any options
16
- });
17
- });
18
- const routeSchema = yup.object({
19
- method: yup.string().oneOf(["GET", "POST", "PUT", "PATCH", "DELETE", "ALL"]).required(),
20
- path: yup.string().required(),
21
- handler: yup.lazy((value) => {
22
- if (typeof value === "string") {
23
- return yup.string().required();
24
- }
25
- if (Array.isArray(value)) {
26
- return yup.array().required();
27
- }
28
- return yup.mixed().isFunction().required();
29
- }),
30
- config: yup.object({
31
- auth: yup.lazy((value) => {
32
- if (value === false) {
33
- return yup.boolean().required();
34
- }
35
- return yup.object({
36
- scope: yup.array().of(yup.string()).required()
37
- });
38
- }),
39
- policies: yup.array().of(policyOrMiddlewareSchema).notRequired(),
40
- middlewares: yup.array().of(policyOrMiddlewareSchema).notRequired()
41
- }).notRequired()
42
- });
43
- const validateRouteConfig = (routeConfig) => {
44
- try {
45
- return routeSchema.validateSync(routeConfig, {
46
- strict: true,
47
- abortEarly: false,
48
- stripUnknown: true
49
- });
50
- } catch (error) {
51
- if (error instanceof yup.ValidationError) {
52
- throw new Error(`Invalid route config ${error.message}`);
53
- }
54
- }
55
- };
56
- const createRouteManager = (strapi, opts = {}) => {
57
- const { type } = opts;
58
- const composeEndpoint = createEndpointComposer(strapi);
59
- const createRoute = (route, router) => {
60
- validateRouteConfig(route);
61
- const routeWithInfo = Object.assign(route, {
62
- info: {
63
- ...route.info ?? {},
64
- type: type || "api"
65
- }
66
- });
67
- composeEndpoint(routeWithInfo, { router });
68
- };
69
- const addRoutes = (routes, router) => {
70
- if (Array.isArray(routes)) {
71
- routes.forEach((route) => createRoute(route, router));
72
- } else if (routes.routes) {
73
- const subRouter = new Router({ prefix: routes.prefix });
74
- routes.routes.forEach((route) => {
75
- const hasPrefix = has("prefix", route.config);
76
- createRoute(route, hasPrefix ? router : subRouter);
77
- });
78
- return router.use(subRouter.routes(), subRouter.allowedMethods());
79
- }
80
- };
81
- return {
82
- addRoutes
83
- };
84
- };
85
- export {
86
- createRouteManager,
87
- validateRouteConfig
88
- };
89
- //# sourceMappingURL=routing.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routing.mjs","sources":["../../../src/services/server/routing.ts"],"sourcesContent":["import Router from '@koa/router';\nimport { has } from 'lodash/fp';\nimport { yup } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\n\nimport createEndpointComposer from './compose-endpoint';\n\nconst policyOrMiddlewareSchema = yup.lazy((value) => {\n if (typeof value === 'string') {\n return yup.string().required();\n }\n\n if (typeof value === 'function') {\n return yup.mixed().isFunction();\n }\n\n return yup.object({\n name: yup.string().required(),\n options: yup.object().notRequired(), // any options\n });\n});\n\nconst routeSchema = yup.object({\n method: yup.string().oneOf(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'ALL']).required(),\n path: yup.string().required(),\n handler: yup.lazy((value) => {\n if (typeof value === 'string') {\n return yup.string().required();\n }\n\n if (Array.isArray(value)) {\n return yup.array().required();\n }\n\n return yup.mixed().isFunction().required();\n }),\n config: yup\n .object({\n auth: yup.lazy((value) => {\n if (value === false) {\n return yup.boolean().required();\n }\n\n return yup.object({\n scope: yup.array().of(yup.string()).required(),\n });\n }),\n policies: yup\n .array()\n // FIXME: fixed in yup v1\n .of(policyOrMiddlewareSchema as any)\n .notRequired(),\n middlewares: yup\n .array()\n // FIXME: fixed in yup v1\n .of(policyOrMiddlewareSchema as any)\n .notRequired(),\n })\n .notRequired(),\n});\n\nconst validateRouteConfig = (routeConfig: Core.RouteInput) => {\n try {\n return routeSchema.validateSync(routeConfig, {\n strict: true,\n abortEarly: false,\n stripUnknown: true,\n });\n } catch (error) {\n if (error instanceof yup.ValidationError) {\n throw new Error(`Invalid route config ${error.message}`);\n }\n }\n};\n\nconst createRouteManager = (strapi: Core.Strapi, opts: { type?: string } = {}) => {\n const { type } = opts;\n\n const composeEndpoint = createEndpointComposer(strapi);\n\n const createRoute = (route: Core.RouteInput, router: Router) => {\n validateRouteConfig(route);\n\n // NOTE: the router type is used to tag controller actions and for authentication / authorization so we need to pass this info down to the route level\n const routeWithInfo = Object.assign(route, {\n info: {\n ...(route.info ?? {}),\n type: type || 'api',\n },\n });\n\n composeEndpoint(routeWithInfo, { router });\n };\n\n const addRoutes = (routes: Core.Router | Core.RouteInput[], router: Router) => {\n if (Array.isArray(routes)) {\n routes.forEach((route) => createRoute(route, router));\n } else if (routes.routes) {\n const subRouter = new Router({ prefix: routes.prefix });\n\n routes.routes.forEach((route) => {\n const hasPrefix = has('prefix', route.config);\n createRoute(route, hasPrefix ? router : subRouter);\n });\n\n return router.use(subRouter.routes(), subRouter.allowedMethods());\n }\n };\n\n return {\n addRoutes,\n };\n};\n\nexport { validateRouteConfig, createRouteManager };\n"],"names":[],"mappings":";;;;AAOA,MAAM,2BAA2B,IAAI,KAAK,CAAC,UAAU;AAC/C,MAAA,OAAO,UAAU,UAAU;AACtB,WAAA,IAAI,OAAO,EAAE,SAAS;AAAA,EAAA;AAG3B,MAAA,OAAO,UAAU,YAAY;AACxB,WAAA,IAAI,MAAM,EAAE,WAAW;AAAA,EAAA;AAGhC,SAAO,IAAI,OAAO;AAAA,IAChB,MAAM,IAAI,OAAO,EAAE,SAAS;AAAA,IAC5B,SAAS,IAAI,OAAO,EAAE,YAAY;AAAA;AAAA,EAAA,CACnC;AACH,CAAC;AAED,MAAM,cAAc,IAAI,OAAO;AAAA,EAC7B,QAAQ,IAAI,SAAS,MAAM,CAAC,OAAO,QAAQ,OAAO,SAAS,UAAU,KAAK,CAAC,EAAE,SAAS;AAAA,EACtF,MAAM,IAAI,OAAO,EAAE,SAAS;AAAA,EAC5B,SAAS,IAAI,KAAK,CAAC,UAAU;AACvB,QAAA,OAAO,UAAU,UAAU;AACtB,aAAA,IAAI,OAAO,EAAE,SAAS;AAAA,IAAA;AAG3B,QAAA,MA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AA,YAAY,CAAC,QAAyC,WAAmB;AACzE,QAAA,MAAM,QAAQ,MAAM,GAAG;AACzB,aAAO,QAAQ,CAAC,UAAU,YAAY,OAAO,MAAM,CAAC;AAAA,IAAA,WAC3C,OAAO,QAAQ;AACxB,YAAM,YAAY,IAAI,OAAO,EAAE,QAAQ,OAAO,QAAQ;AAE/C,aAAA,OAAO,QAAQ,CAAC,UAAU;AAC/B,cAAM,YAAY,IAAI,UAAU,MAAM,MAAM;AAChC,oBAAA,OAAO,YAAY,SAAS,SAAS;AAAA,MAAA,CAClD;AAED,aAAO,OAAO,IAAI,UAAU,UAAU,UAAU,gBAAgB;AAAA,IAAA;AAAA,EAEpE;AAEO,SAAA;AAAA,IACL;AAAA,EACF;AACF;"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- const fp = require("lodash/fp");
3
- const getNumberOfDynamicZones = () => {
4
- const contentTypes = strapi.contentTypes;
5
- return fp.pipe(
6
- fp.map("attributes"),
7
- fp.flatMap(fp.values),
8
- fp.sumBy((item) => {
9
- if (item.type === "dynamiczone") {
10
- return 1;
11
- }
12
- return 0;
13
- })
14
- )(contentTypes);
15
- };
16
- module.exports = getNumberOfDynamicZones;
17
- //# sourceMappingURL=dynamic-zones.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dynamic-zones.js","sources":["../../../src/services/utils/dynamic-zones.ts"],"sourcesContent":["import { map, values, sumBy, pipe, flatMap } from 'lodash/fp';\nimport type { Schema, UID } from '@strapi/types';\n\nconst getNumberOfDynamicZones = () => {\n const contentTypes: Record<UID.ContentType, Schema.ContentType> = strapi.contentTypes;\n\n return pipe(\n map('attributes'),\n flatMap(values),\n sumBy((item) => {\n if (item.type === 'dynamiczone') {\n return 1;\n }\n return 0;\n })\n )(contentTypes);\n};\n\nexport default getNumberOfDynamicZones;\n"],"names":["pipe","map","flatMap","values","sumBy"],"mappings":";;AAGA,MAAM,0BAA0B,MAAM;AACpC,QAAM,eAA4D,OAAO;AAElE,SAAAA,GAAA;AAAA,IACLC,GAAAA,IAAI,YAAY;AAAA,IAChBC,GAAAA,QAAQC,GAAAA,MAAM;AAAA,IACdC,GAAA,MAAM,CAAC,SAAS;AACV,UAAA,KAAK,SAAS,eAAe;AACxB,eAAA;AAAA,MAAA;AAEF,aAAA;AAAA,IACR,CAAA;AAAA,IACD,YAAY;AAChB;;"}
@@ -1,18 +0,0 @@
1
- import { pipe, map, flatMap, values, sumBy } from "lodash/fp";
2
- const getNumberOfDynamicZones = () => {
3
- const contentTypes = strapi.contentTypes;
4
- return pipe(
5
- map("attributes"),
6
- flatMap(values),
7
- sumBy((item) => {
8
- if (item.type === "dynamiczone") {
9
- return 1;
10
- }
11
- return 0;
12
- })
13
- )(contentTypes);
14
- };
15
- export {
16
- getNumberOfDynamicZones as default
17
- };
18
- //# sourceMappingURL=dynamic-zones.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dynamic-zones.mjs","sources":["../../../src/services/utils/dynamic-zones.ts"],"sourcesContent":["import { map, values, sumBy, pipe, flatMap } from 'lodash/fp';\nimport type { Schema, UID } from '@strapi/types';\n\nconst getNumberOfDynamicZones = () => {\n const contentTypes: Record<UID.ContentType, Schema.ContentType> = strapi.contentTypes;\n\n return pipe(\n map('attributes'),\n flatMap(values),\n sumBy((item) => {\n if (item.type === 'dynamiczone') {\n return 1;\n }\n return 0;\n })\n )(contentTypes);\n};\n\nexport default getNumberOfDynamicZones;\n"],"names":[],"mappings":";AAGA,MAAM,0BAA0B,MAAM;AACpC,QAAM,eAA4D,OAAO;AAElE,SAAA;AAAA,IACL,IAAI,YAAY;AAAA,IAChB,QAAQ,MAAM;AAAA,IACd,MAAM,CAAC,SAAS;AACV,UAAA,KAAK,SAAS,eAAe;AACxB,eAAA;AAAA,MAAA;AAEF,aAAA;AAAA,IACR,CAAA;AAAA,IACD,YAAY;AAChB;"}