@strapi/core 0.0.0-next.f09127d8df0234ad0b771b931b044b7c2e09c686 → 0.0.0-next.f09bff0783c6e3dfd3c34ed73b6f1a47de7b8d80

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 (686) hide show
  1. package/dist/configuration/index.d.ts.map +1 -1
  2. package/dist/index.js +10110 -27
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +10088 -29
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/middlewares/body.d.ts.map +1 -1
  7. package/dist/migrations/database/5.0.0-discard-drafts.d.ts +2 -2
  8. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -1
  9. package/dist/migrations/draft-publish.d.ts +1 -1
  10. package/dist/migrations/draft-publish.d.ts.map +1 -1
  11. package/dist/services/document-service/components.d.ts.map +1 -1
  12. package/dist/services/document-service/draft-and-publish.d.ts +1 -1
  13. package/dist/services/document-service/draft-and-publish.d.ts.map +1 -1
  14. package/dist/services/document-service/events.d.ts +1 -1
  15. package/dist/services/document-service/events.d.ts.map +1 -1
  16. package/dist/services/document-service/repository.d.ts.map +1 -1
  17. package/dist/services/document-service/transform/id-map.d.ts +1 -1
  18. package/dist/services/document-service/transform/id-map.d.ts.map +1 -1
  19. package/dist/services/document-service/transform/id-transform.d.ts +1 -1
  20. package/dist/services/document-service/transform/id-transform.d.ts.map +1 -1
  21. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts +1 -1
  22. package/dist/services/document-service/transform/relations/extract/data-ids.d.ts.map +1 -1
  23. package/dist/services/document-service/transform/relations/utils/dp.d.ts +1 -1
  24. package/dist/services/document-service/transform/relations/utils/dp.d.ts.map +1 -1
  25. package/dist/services/document-service/transform/relations/utils/i18n.d.ts +1 -1
  26. package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -1
  27. package/dist/services/document-service/utils/bidirectional-relations.d.ts +95 -0
  28. package/dist/services/document-service/utils/bidirectional-relations.d.ts.map +1 -0
  29. package/dist/services/document-service/utils/populate.d.ts +1 -1
  30. package/dist/services/document-service/utils/populate.d.ts.map +1 -1
  31. package/dist/services/document-service/utils/unidirectional-relations.d.ts +1 -1
  32. package/dist/services/document-service/utils/unidirectional-relations.d.ts.map +1 -1
  33. package/dist/services/entity-validator/index.d.ts +1 -1
  34. package/dist/services/entity-validator/index.d.ts.map +1 -1
  35. package/dist/services/metrics/middleware.d.ts.map +1 -1
  36. package/dist/services/metrics/rate-limiter.d.ts.map +1 -1
  37. package/dist/utils/update-notifier/index.d.ts.map +1 -1
  38. package/package.json +25 -26
  39. package/dist/Strapi.js +0 -437
  40. package/dist/Strapi.js.map +0 -1
  41. package/dist/Strapi.mjs +0 -416
  42. package/dist/Strapi.mjs.map +0 -1
  43. package/dist/compile.js +0 -18
  44. package/dist/compile.js.map +0 -1
  45. package/dist/compile.mjs +0 -17
  46. package/dist/compile.mjs.map +0 -1
  47. package/dist/configuration/config-loader.js +0 -105
  48. package/dist/configuration/config-loader.js.map +0 -1
  49. package/dist/configuration/config-loader.mjs +0 -103
  50. package/dist/configuration/config-loader.mjs.map +0 -1
  51. package/dist/configuration/get-dirs.js +0 -31
  52. package/dist/configuration/get-dirs.js.map +0 -1
  53. package/dist/configuration/get-dirs.mjs +0 -31
  54. package/dist/configuration/get-dirs.mjs.map +0 -1
  55. package/dist/configuration/index.js +0 -85
  56. package/dist/configuration/index.js.map +0 -1
  57. package/dist/configuration/index.mjs +0 -80
  58. package/dist/configuration/index.mjs.map +0 -1
  59. package/dist/configuration/urls.js +0 -68
  60. package/dist/configuration/urls.js.map +0 -1
  61. package/dist/configuration/urls.mjs +0 -66
  62. package/dist/configuration/urls.mjs.map +0 -1
  63. package/dist/container.js +0 -30
  64. package/dist/container.js.map +0 -1
  65. package/dist/container.mjs +0 -30
  66. package/dist/container.mjs.map +0 -1
  67. package/dist/core-api/controller/collection-type.js +0 -84
  68. package/dist/core-api/controller/collection-type.js.map +0 -1
  69. package/dist/core-api/controller/collection-type.mjs +0 -84
  70. package/dist/core-api/controller/collection-type.mjs.map +0 -1
  71. package/dist/core-api/controller/index.js +0 -52
  72. package/dist/core-api/controller/index.js.map +0 -1
  73. package/dist/core-api/controller/index.mjs +0 -52
  74. package/dist/core-api/controller/index.mjs.map +0 -1
  75. package/dist/core-api/controller/single-type.js +0 -46
  76. package/dist/core-api/controller/single-type.js.map +0 -1
  77. package/dist/core-api/controller/single-type.mjs +0 -46
  78. package/dist/core-api/controller/single-type.mjs.map +0 -1
  79. package/dist/core-api/controller/transform.js +0 -76
  80. package/dist/core-api/controller/transform.js.map +0 -1
  81. package/dist/core-api/controller/transform.mjs +0 -76
  82. package/dist/core-api/controller/transform.mjs.map +0 -1
  83. package/dist/core-api/routes/index.js +0 -67
  84. package/dist/core-api/routes/index.js.map +0 -1
  85. package/dist/core-api/routes/index.mjs +0 -67
  86. package/dist/core-api/routes/index.mjs.map +0 -1
  87. package/dist/core-api/service/collection-type.js +0 -67
  88. package/dist/core-api/service/collection-type.js.map +0 -1
  89. package/dist/core-api/service/collection-type.mjs +0 -67
  90. package/dist/core-api/service/collection-type.mjs.map +0 -1
  91. package/dist/core-api/service/core-service.js +0 -12
  92. package/dist/core-api/service/core-service.js.map +0 -1
  93. package/dist/core-api/service/core-service.mjs +0 -12
  94. package/dist/core-api/service/core-service.mjs.map +0 -1
  95. package/dist/core-api/service/index.js +0 -16
  96. package/dist/core-api/service/index.js.map +0 -1
  97. package/dist/core-api/service/index.mjs +0 -16
  98. package/dist/core-api/service/index.mjs.map +0 -1
  99. package/dist/core-api/service/pagination.js +0 -52
  100. package/dist/core-api/service/pagination.js.map +0 -1
  101. package/dist/core-api/service/pagination.mjs +0 -52
  102. package/dist/core-api/service/pagination.mjs.map +0 -1
  103. package/dist/core-api/service/single-type.js +0 -45
  104. package/dist/core-api/service/single-type.js.map +0 -1
  105. package/dist/core-api/service/single-type.mjs +0 -45
  106. package/dist/core-api/service/single-type.mjs.map +0 -1
  107. package/dist/domain/content-type/index.js +0 -111
  108. package/dist/domain/content-type/index.js.map +0 -1
  109. package/dist/domain/content-type/index.mjs +0 -109
  110. package/dist/domain/content-type/index.mjs.map +0 -1
  111. package/dist/domain/content-type/validator.js +0 -77
  112. package/dist/domain/content-type/validator.js.map +0 -1
  113. package/dist/domain/content-type/validator.mjs +0 -75
  114. package/dist/domain/content-type/validator.mjs.map +0 -1
  115. package/dist/domain/module/index.js +0 -107
  116. package/dist/domain/module/index.js.map +0 -1
  117. package/dist/domain/module/index.mjs +0 -105
  118. package/dist/domain/module/index.mjs.map +0 -1
  119. package/dist/domain/module/validation.js +0 -25
  120. package/dist/domain/module/validation.js.map +0 -1
  121. package/dist/domain/module/validation.mjs +0 -25
  122. package/dist/domain/module/validation.mjs.map +0 -1
  123. package/dist/ee/index.js +0 -158
  124. package/dist/ee/index.js.map +0 -1
  125. package/dist/ee/index.mjs +0 -159
  126. package/dist/ee/index.mjs.map +0 -1
  127. package/dist/ee/license.js +0 -91
  128. package/dist/ee/license.js.map +0 -1
  129. package/dist/ee/license.mjs +0 -88
  130. package/dist/ee/license.mjs.map +0 -1
  131. package/dist/factories.js +0 -80
  132. package/dist/factories.js.map +0 -1
  133. package/dist/factories.mjs +0 -80
  134. package/dist/factories.mjs.map +0 -1
  135. package/dist/loaders/admin.js +0 -26
  136. package/dist/loaders/admin.js.map +0 -1
  137. package/dist/loaders/admin.mjs +0 -25
  138. package/dist/loaders/admin.mjs.map +0 -1
  139. package/dist/loaders/apis.js +0 -137
  140. package/dist/loaders/apis.js.map +0 -1
  141. package/dist/loaders/apis.mjs +0 -135
  142. package/dist/loaders/apis.mjs.map +0 -1
  143. package/dist/loaders/components.js +0 -38
  144. package/dist/loaders/components.js.map +0 -1
  145. package/dist/loaders/components.mjs +0 -37
  146. package/dist/loaders/components.mjs.map +0 -1
  147. package/dist/loaders/index.js +0 -24
  148. package/dist/loaders/index.js.map +0 -1
  149. package/dist/loaders/index.mjs +0 -24
  150. package/dist/loaders/index.mjs.map +0 -1
  151. package/dist/loaders/middlewares.js +0 -31
  152. package/dist/loaders/middlewares.js.map +0 -1
  153. package/dist/loaders/middlewares.mjs +0 -30
  154. package/dist/loaders/middlewares.mjs.map +0 -1
  155. package/dist/loaders/plugins/get-enabled-plugins.js +0 -141
  156. package/dist/loaders/plugins/get-enabled-plugins.js.map +0 -1
  157. package/dist/loaders/plugins/get-enabled-plugins.mjs +0 -117
  158. package/dist/loaders/plugins/get-enabled-plugins.mjs.map +0 -1
  159. package/dist/loaders/plugins/get-user-plugins-config.js +0 -27
  160. package/dist/loaders/plugins/get-user-plugins-config.js.map +0 -1
  161. package/dist/loaders/plugins/get-user-plugins-config.mjs +0 -25
  162. package/dist/loaders/plugins/get-user-plugins-config.mjs.map +0 -1
  163. package/dist/loaders/plugins/index.js +0 -144
  164. package/dist/loaders/plugins/index.js.map +0 -1
  165. package/dist/loaders/plugins/index.mjs +0 -125
  166. package/dist/loaders/plugins/index.mjs.map +0 -1
  167. package/dist/loaders/policies.js +0 -25
  168. package/dist/loaders/policies.js.map +0 -1
  169. package/dist/loaders/policies.mjs +0 -24
  170. package/dist/loaders/policies.mjs.map +0 -1
  171. package/dist/loaders/sanitizers.js +0 -6
  172. package/dist/loaders/sanitizers.js.map +0 -1
  173. package/dist/loaders/sanitizers.mjs +0 -7
  174. package/dist/loaders/sanitizers.mjs.map +0 -1
  175. package/dist/loaders/src-index.js +0 -33
  176. package/dist/loaders/src-index.js.map +0 -1
  177. package/dist/loaders/src-index.mjs +0 -34
  178. package/dist/loaders/src-index.mjs.map +0 -1
  179. package/dist/loaders/validators.js +0 -6
  180. package/dist/loaders/validators.js.map +0 -1
  181. package/dist/loaders/validators.mjs +0 -7
  182. package/dist/loaders/validators.mjs.map +0 -1
  183. package/dist/middlewares/body.js +0 -65
  184. package/dist/middlewares/body.js.map +0 -1
  185. package/dist/middlewares/body.mjs +0 -61
  186. package/dist/middlewares/body.mjs.map +0 -1
  187. package/dist/middlewares/compression.js +0 -8
  188. package/dist/middlewares/compression.js.map +0 -1
  189. package/dist/middlewares/compression.mjs +0 -6
  190. package/dist/middlewares/compression.mjs.map +0 -1
  191. package/dist/middlewares/cors.js +0 -53
  192. package/dist/middlewares/cors.js.map +0 -1
  193. package/dist/middlewares/cors.mjs +0 -51
  194. package/dist/middlewares/cors.mjs.map +0 -1
  195. package/dist/middlewares/errors.js +0 -33
  196. package/dist/middlewares/errors.js.map +0 -1
  197. package/dist/middlewares/errors.mjs +0 -33
  198. package/dist/middlewares/errors.mjs.map +0 -1
  199. package/dist/middlewares/favicon.js +0 -22
  200. package/dist/middlewares/favicon.js.map +0 -1
  201. package/dist/middlewares/favicon.mjs +0 -20
  202. package/dist/middlewares/favicon.mjs.map +0 -1
  203. package/dist/middlewares/index.js +0 -34
  204. package/dist/middlewares/index.js.map +0 -1
  205. package/dist/middlewares/index.mjs +0 -34
  206. package/dist/middlewares/index.mjs.map +0 -1
  207. package/dist/middlewares/ip.js +0 -8
  208. package/dist/middlewares/ip.js.map +0 -1
  209. package/dist/middlewares/ip.mjs +0 -6
  210. package/dist/middlewares/ip.mjs.map +0 -1
  211. package/dist/middlewares/logger.js +0 -12
  212. package/dist/middlewares/logger.js.map +0 -1
  213. package/dist/middlewares/logger.mjs +0 -12
  214. package/dist/middlewares/logger.mjs.map +0 -1
  215. package/dist/middlewares/powered-by.js +0 -14
  216. package/dist/middlewares/powered-by.js.map +0 -1
  217. package/dist/middlewares/powered-by.mjs +0 -14
  218. package/dist/middlewares/powered-by.mjs.map +0 -1
  219. package/dist/middlewares/public.js +0 -34
  220. package/dist/middlewares/public.js.map +0 -1
  221. package/dist/middlewares/public.mjs +0 -32
  222. package/dist/middlewares/public.mjs.map +0 -1
  223. package/dist/middlewares/query.js +0 -40
  224. package/dist/middlewares/query.js.map +0 -1
  225. package/dist/middlewares/query.mjs +0 -38
  226. package/dist/middlewares/query.mjs.map +0 -1
  227. package/dist/middlewares/response-time.js +0 -12
  228. package/dist/middlewares/response-time.js.map +0 -1
  229. package/dist/middlewares/response-time.mjs +0 -12
  230. package/dist/middlewares/response-time.mjs.map +0 -1
  231. package/dist/middlewares/responses.js +0 -15
  232. package/dist/middlewares/responses.js.map +0 -1
  233. package/dist/middlewares/responses.mjs +0 -15
  234. package/dist/middlewares/responses.mjs.map +0 -1
  235. package/dist/middlewares/security.js +0 -78
  236. package/dist/middlewares/security.js.map +0 -1
  237. package/dist/middlewares/security.mjs +0 -76
  238. package/dist/middlewares/security.mjs.map +0 -1
  239. package/dist/middlewares/session.js +0 -30
  240. package/dist/middlewares/session.js.map +0 -1
  241. package/dist/middlewares/session.mjs +0 -28
  242. package/dist/middlewares/session.mjs.map +0 -1
  243. package/dist/migrations/database/5.0.0-discard-drafts.js +0 -106
  244. package/dist/migrations/database/5.0.0-discard-drafts.js.map +0 -1
  245. package/dist/migrations/database/5.0.0-discard-drafts.mjs +0 -106
  246. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +0 -1
  247. package/dist/migrations/draft-publish.js +0 -42
  248. package/dist/migrations/draft-publish.js.map +0 -1
  249. package/dist/migrations/draft-publish.mjs +0 -42
  250. package/dist/migrations/draft-publish.mjs.map +0 -1
  251. package/dist/migrations/i18n.js +0 -54
  252. package/dist/migrations/i18n.js.map +0 -1
  253. package/dist/migrations/i18n.mjs +0 -54
  254. package/dist/migrations/i18n.mjs.map +0 -1
  255. package/dist/migrations/index.js +0 -15
  256. package/dist/migrations/index.js.map +0 -1
  257. package/dist/migrations/index.mjs +0 -15
  258. package/dist/migrations/index.mjs.map +0 -1
  259. package/dist/providers/admin.js +0 -20
  260. package/dist/providers/admin.js.map +0 -1
  261. package/dist/providers/admin.mjs +0 -21
  262. package/dist/providers/admin.mjs.map +0 -1
  263. package/dist/providers/coreStore.js +0 -11
  264. package/dist/providers/coreStore.js.map +0 -1
  265. package/dist/providers/coreStore.mjs +0 -12
  266. package/dist/providers/coreStore.mjs.map +0 -1
  267. package/dist/providers/cron.js +0 -20
  268. package/dist/providers/cron.js.map +0 -1
  269. package/dist/providers/cron.mjs +0 -21
  270. package/dist/providers/cron.mjs.map +0 -1
  271. package/dist/providers/index.js +0 -11
  272. package/dist/providers/index.js.map +0 -1
  273. package/dist/providers/index.mjs +0 -11
  274. package/dist/providers/index.mjs.map +0 -1
  275. package/dist/providers/provider.js +0 -5
  276. package/dist/providers/provider.js.map +0 -1
  277. package/dist/providers/provider.mjs +0 -5
  278. package/dist/providers/provider.mjs.map +0 -1
  279. package/dist/providers/registries.js +0 -35
  280. package/dist/providers/registries.js.map +0 -1
  281. package/dist/providers/registries.mjs +0 -36
  282. package/dist/providers/registries.mjs.map +0 -1
  283. package/dist/providers/telemetry.js +0 -19
  284. package/dist/providers/telemetry.js.map +0 -1
  285. package/dist/providers/telemetry.mjs +0 -20
  286. package/dist/providers/telemetry.mjs.map +0 -1
  287. package/dist/providers/webhooks.js +0 -30
  288. package/dist/providers/webhooks.js.map +0 -1
  289. package/dist/providers/webhooks.mjs +0 -31
  290. package/dist/providers/webhooks.mjs.map +0 -1
  291. package/dist/registries/apis.js +0 -23
  292. package/dist/registries/apis.js.map +0 -1
  293. package/dist/registries/apis.mjs +0 -24
  294. package/dist/registries/apis.mjs.map +0 -1
  295. package/dist/registries/components.js +0 -45
  296. package/dist/registries/components.js.map +0 -1
  297. package/dist/registries/components.mjs +0 -46
  298. package/dist/registries/components.mjs.map +0 -1
  299. package/dist/registries/content-types.js +0 -70
  300. package/dist/registries/content-types.js.map +0 -1
  301. package/dist/registries/content-types.mjs +0 -71
  302. package/dist/registries/content-types.mjs.map +0 -1
  303. package/dist/registries/controllers.js +0 -80
  304. package/dist/registries/controllers.js.map +0 -1
  305. package/dist/registries/controllers.mjs +0 -81
  306. package/dist/registries/controllers.mjs.map +0 -1
  307. package/dist/registries/custom-fields.js +0 -71
  308. package/dist/registries/custom-fields.js.map +0 -1
  309. package/dist/registries/custom-fields.mjs +0 -72
  310. package/dist/registries/custom-fields.mjs.map +0 -1
  311. package/dist/registries/hooks.js +0 -58
  312. package/dist/registries/hooks.js.map +0 -1
  313. package/dist/registries/hooks.mjs +0 -59
  314. package/dist/registries/hooks.mjs.map +0 -1
  315. package/dist/registries/middlewares.js +0 -60
  316. package/dist/registries/middlewares.js.map +0 -1
  317. package/dist/registries/middlewares.mjs +0 -61
  318. package/dist/registries/middlewares.mjs.map +0 -1
  319. package/dist/registries/models.js +0 -16
  320. package/dist/registries/models.js.map +0 -1
  321. package/dist/registries/models.mjs +0 -16
  322. package/dist/registries/models.mjs.map +0 -1
  323. package/dist/registries/modules.js +0 -39
  324. package/dist/registries/modules.js.map +0 -1
  325. package/dist/registries/modules.mjs +0 -40
  326. package/dist/registries/modules.mjs.map +0 -1
  327. package/dist/registries/namespace.js +0 -27
  328. package/dist/registries/namespace.js.map +0 -1
  329. package/dist/registries/namespace.mjs +0 -27
  330. package/dist/registries/namespace.mjs.map +0 -1
  331. package/dist/registries/plugins.js +0 -23
  332. package/dist/registries/plugins.js.map +0 -1
  333. package/dist/registries/plugins.mjs +0 -24
  334. package/dist/registries/plugins.mjs.map +0 -1
  335. package/dist/registries/policies.js +0 -108
  336. package/dist/registries/policies.js.map +0 -1
  337. package/dist/registries/policies.mjs +0 -109
  338. package/dist/registries/policies.mjs.map +0 -1
  339. package/dist/registries/sanitizers.js +0 -25
  340. package/dist/registries/sanitizers.js.map +0 -1
  341. package/dist/registries/sanitizers.mjs +0 -24
  342. package/dist/registries/sanitizers.mjs.map +0 -1
  343. package/dist/registries/services.js +0 -80
  344. package/dist/registries/services.js.map +0 -1
  345. package/dist/registries/services.mjs +0 -81
  346. package/dist/registries/services.mjs.map +0 -1
  347. package/dist/registries/validators.js +0 -25
  348. package/dist/registries/validators.js.map +0 -1
  349. package/dist/registries/validators.mjs +0 -24
  350. package/dist/registries/validators.mjs.map +0 -1
  351. package/dist/services/auth/index.js +0 -81
  352. package/dist/services/auth/index.js.map +0 -1
  353. package/dist/services/auth/index.mjs +0 -80
  354. package/dist/services/auth/index.mjs.map +0 -1
  355. package/dist/services/config.js +0 -47
  356. package/dist/services/config.js.map +0 -1
  357. package/dist/services/config.mjs +0 -47
  358. package/dist/services/config.mjs.map +0 -1
  359. package/dist/services/content-api/index.js +0 -85
  360. package/dist/services/content-api/index.js.map +0 -1
  361. package/dist/services/content-api/index.mjs +0 -84
  362. package/dist/services/content-api/index.mjs.map +0 -1
  363. package/dist/services/content-api/permissions/engine.js +0 -7
  364. package/dist/services/content-api/permissions/engine.js.map +0 -1
  365. package/dist/services/content-api/permissions/engine.mjs +0 -6
  366. package/dist/services/content-api/permissions/engine.mjs.map +0 -1
  367. package/dist/services/content-api/permissions/index.js +0 -87
  368. package/dist/services/content-api/permissions/index.js.map +0 -1
  369. package/dist/services/content-api/permissions/index.mjs +0 -86
  370. package/dist/services/content-api/permissions/index.mjs.map +0 -1
  371. package/dist/services/content-api/permissions/providers/action.js +0 -16
  372. package/dist/services/content-api/permissions/providers/action.js.map +0 -1
  373. package/dist/services/content-api/permissions/providers/action.mjs +0 -17
  374. package/dist/services/content-api/permissions/providers/action.mjs.map +0 -1
  375. package/dist/services/content-api/permissions/providers/condition.js +0 -16
  376. package/dist/services/content-api/permissions/providers/condition.js.map +0 -1
  377. package/dist/services/content-api/permissions/providers/condition.mjs +0 -17
  378. package/dist/services/content-api/permissions/providers/condition.mjs.map +0 -1
  379. package/dist/services/core-store.js +0 -107
  380. package/dist/services/core-store.js.map +0 -1
  381. package/dist/services/core-store.mjs +0 -107
  382. package/dist/services/core-store.mjs.map +0 -1
  383. package/dist/services/cron.js +0 -67
  384. package/dist/services/cron.js.map +0 -1
  385. package/dist/services/cron.mjs +0 -68
  386. package/dist/services/cron.mjs.map +0 -1
  387. package/dist/services/custom-fields.js +0 -10
  388. package/dist/services/custom-fields.js.map +0 -1
  389. package/dist/services/custom-fields.mjs +0 -11
  390. package/dist/services/custom-fields.mjs.map +0 -1
  391. package/dist/services/document-service/attributes/index.js +0 -22
  392. package/dist/services/document-service/attributes/index.js.map +0 -1
  393. package/dist/services/document-service/attributes/index.mjs +0 -22
  394. package/dist/services/document-service/attributes/index.mjs.map +0 -1
  395. package/dist/services/document-service/attributes/transforms.js +0 -20
  396. package/dist/services/document-service/attributes/transforms.js.map +0 -1
  397. package/dist/services/document-service/attributes/transforms.mjs +0 -19
  398. package/dist/services/document-service/attributes/transforms.mjs.map +0 -1
  399. package/dist/services/document-service/common.js +0 -7
  400. package/dist/services/document-service/common.js.map +0 -1
  401. package/dist/services/document-service/common.mjs +0 -7
  402. package/dist/services/document-service/common.mjs.map +0 -1
  403. package/dist/services/document-service/components.js +0 -288
  404. package/dist/services/document-service/components.js.map +0 -1
  405. package/dist/services/document-service/components.mjs +0 -286
  406. package/dist/services/document-service/components.mjs.map +0 -1
  407. package/dist/services/document-service/draft-and-publish.js +0 -69
  408. package/dist/services/document-service/draft-and-publish.js.map +0 -1
  409. package/dist/services/document-service/draft-and-publish.mjs +0 -69
  410. package/dist/services/document-service/draft-and-publish.mjs.map +0 -1
  411. package/dist/services/document-service/entries.js +0 -95
  412. package/dist/services/document-service/entries.js.map +0 -1
  413. package/dist/services/document-service/entries.mjs +0 -95
  414. package/dist/services/document-service/entries.mjs.map +0 -1
  415. package/dist/services/document-service/events.js +0 -47
  416. package/dist/services/document-service/events.js.map +0 -1
  417. package/dist/services/document-service/events.mjs +0 -47
  418. package/dist/services/document-service/events.mjs.map +0 -1
  419. package/dist/services/document-service/index.js +0 -36
  420. package/dist/services/document-service/index.js.map +0 -1
  421. package/dist/services/document-service/index.mjs +0 -36
  422. package/dist/services/document-service/index.mjs.map +0 -1
  423. package/dist/services/document-service/internationalization.js +0 -63
  424. package/dist/services/document-service/internationalization.js.map +0 -1
  425. package/dist/services/document-service/internationalization.mjs +0 -63
  426. package/dist/services/document-service/internationalization.mjs.map +0 -1
  427. package/dist/services/document-service/middlewares/errors.js +0 -25
  428. package/dist/services/document-service/middlewares/errors.js.map +0 -1
  429. package/dist/services/document-service/middlewares/errors.mjs +0 -25
  430. package/dist/services/document-service/middlewares/errors.mjs.map +0 -1
  431. package/dist/services/document-service/middlewares/middleware-manager.js +0 -49
  432. package/dist/services/document-service/middlewares/middleware-manager.js.map +0 -1
  433. package/dist/services/document-service/middlewares/middleware-manager.mjs +0 -49
  434. package/dist/services/document-service/middlewares/middleware-manager.mjs.map +0 -1
  435. package/dist/services/document-service/params.js +0 -8
  436. package/dist/services/document-service/params.js.map +0 -1
  437. package/dist/services/document-service/params.mjs +0 -8
  438. package/dist/services/document-service/params.mjs.map +0 -1
  439. package/dist/services/document-service/repository.js +0 -332
  440. package/dist/services/document-service/repository.js.map +0 -1
  441. package/dist/services/document-service/repository.mjs +0 -332
  442. package/dist/services/document-service/repository.mjs.map +0 -1
  443. package/dist/services/document-service/transform/data.js +0 -15
  444. package/dist/services/document-service/transform/data.js.map +0 -1
  445. package/dist/services/document-service/transform/data.mjs +0 -15
  446. package/dist/services/document-service/transform/data.mjs.map +0 -1
  447. package/dist/services/document-service/transform/fields.js +0 -24
  448. package/dist/services/document-service/transform/fields.js.map +0 -1
  449. package/dist/services/document-service/transform/fields.mjs +0 -24
  450. package/dist/services/document-service/transform/fields.mjs.map +0 -1
  451. package/dist/services/document-service/transform/id-map.js +0 -85
  452. package/dist/services/document-service/transform/id-map.js.map +0 -1
  453. package/dist/services/document-service/transform/id-map.mjs +0 -85
  454. package/dist/services/document-service/transform/id-map.mjs.map +0 -1
  455. package/dist/services/document-service/transform/id-transform.js +0 -33
  456. package/dist/services/document-service/transform/id-transform.js.map +0 -1
  457. package/dist/services/document-service/transform/id-transform.mjs +0 -33
  458. package/dist/services/document-service/transform/id-transform.mjs.map +0 -1
  459. package/dist/services/document-service/transform/populate.js +0 -21
  460. package/dist/services/document-service/transform/populate.js.map +0 -1
  461. package/dist/services/document-service/transform/populate.mjs +0 -21
  462. package/dist/services/document-service/transform/populate.mjs.map +0 -1
  463. package/dist/services/document-service/transform/query.js +0 -9
  464. package/dist/services/document-service/transform/query.js.map +0 -1
  465. package/dist/services/document-service/transform/query.mjs +0 -9
  466. package/dist/services/document-service/transform/query.mjs.map +0 -1
  467. package/dist/services/document-service/transform/relations/extract/data-ids.js +0 -64
  468. package/dist/services/document-service/transform/relations/extract/data-ids.js.map +0 -1
  469. package/dist/services/document-service/transform/relations/extract/data-ids.mjs +0 -64
  470. package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +0 -1
  471. package/dist/services/document-service/transform/relations/transform/data-ids.js +0 -85
  472. package/dist/services/document-service/transform/relations/transform/data-ids.js.map +0 -1
  473. package/dist/services/document-service/transform/relations/transform/data-ids.mjs +0 -85
  474. package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +0 -1
  475. package/dist/services/document-service/transform/relations/transform/default-locale.js +0 -32
  476. package/dist/services/document-service/transform/relations/transform/default-locale.js.map +0 -1
  477. package/dist/services/document-service/transform/relations/transform/default-locale.mjs +0 -32
  478. package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +0 -1
  479. package/dist/services/document-service/transform/relations/utils/dp.js +0 -30
  480. package/dist/services/document-service/transform/relations/utils/dp.js.map +0 -1
  481. package/dist/services/document-service/transform/relations/utils/dp.mjs +0 -30
  482. package/dist/services/document-service/transform/relations/utils/dp.mjs.map +0 -1
  483. package/dist/services/document-service/transform/relations/utils/i18n.js +0 -25
  484. package/dist/services/document-service/transform/relations/utils/i18n.js.map +0 -1
  485. package/dist/services/document-service/transform/relations/utils/i18n.mjs +0 -25
  486. package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +0 -1
  487. package/dist/services/document-service/transform/relations/utils/map-relation.js +0 -84
  488. package/dist/services/document-service/transform/relations/utils/map-relation.js.map +0 -1
  489. package/dist/services/document-service/transform/relations/utils/map-relation.mjs +0 -84
  490. package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +0 -1
  491. package/dist/services/document-service/utils/populate.js +0 -47
  492. package/dist/services/document-service/utils/populate.js.map +0 -1
  493. package/dist/services/document-service/utils/populate.mjs +0 -47
  494. package/dist/services/document-service/utils/populate.mjs.map +0 -1
  495. package/dist/services/document-service/utils/unidirectional-relations.js +0 -68
  496. package/dist/services/document-service/utils/unidirectional-relations.js.map +0 -1
  497. package/dist/services/document-service/utils/unidirectional-relations.mjs +0 -68
  498. package/dist/services/document-service/utils/unidirectional-relations.mjs.map +0 -1
  499. package/dist/services/entity-service/index.js +0 -169
  500. package/dist/services/entity-service/index.js.map +0 -1
  501. package/dist/services/entity-service/index.mjs +0 -167
  502. package/dist/services/entity-service/index.mjs.map +0 -1
  503. package/dist/services/entity-validator/blocks-validator.js +0 -128
  504. package/dist/services/entity-validator/blocks-validator.js.map +0 -1
  505. package/dist/services/entity-validator/blocks-validator.mjs +0 -128
  506. package/dist/services/entity-validator/blocks-validator.mjs.map +0 -1
  507. package/dist/services/entity-validator/index.js +0 -389
  508. package/dist/services/entity-validator/index.js.map +0 -1
  509. package/dist/services/entity-validator/index.mjs +0 -388
  510. package/dist/services/entity-validator/index.mjs.map +0 -1
  511. package/dist/services/entity-validator/validators.js +0 -241
  512. package/dist/services/entity-validator/validators.js.map +0 -1
  513. package/dist/services/entity-validator/validators.mjs +0 -239
  514. package/dist/services/entity-validator/validators.mjs.map +0 -1
  515. package/dist/services/errors.js +0 -76
  516. package/dist/services/errors.js.map +0 -1
  517. package/dist/services/errors.mjs +0 -74
  518. package/dist/services/errors.mjs.map +0 -1
  519. package/dist/services/event-hub.js +0 -72
  520. package/dist/services/event-hub.js.map +0 -1
  521. package/dist/services/event-hub.mjs +0 -73
  522. package/dist/services/event-hub.mjs.map +0 -1
  523. package/dist/services/features.js +0 -17
  524. package/dist/services/features.js.map +0 -1
  525. package/dist/services/features.mjs +0 -17
  526. package/dist/services/features.mjs.map +0 -1
  527. package/dist/services/fs.js +0 -51
  528. package/dist/services/fs.js.map +0 -1
  529. package/dist/services/fs.mjs +0 -49
  530. package/dist/services/fs.mjs.map +0 -1
  531. package/dist/services/metrics/admin-user-hash.js +0 -14
  532. package/dist/services/metrics/admin-user-hash.js.map +0 -1
  533. package/dist/services/metrics/admin-user-hash.mjs +0 -12
  534. package/dist/services/metrics/admin-user-hash.mjs.map +0 -1
  535. package/dist/services/metrics/index.js +0 -44
  536. package/dist/services/metrics/index.js.map +0 -1
  537. package/dist/services/metrics/index.mjs +0 -45
  538. package/dist/services/metrics/index.mjs.map +0 -1
  539. package/dist/services/metrics/is-truthy.js +0 -9
  540. package/dist/services/metrics/is-truthy.js.map +0 -1
  541. package/dist/services/metrics/is-truthy.mjs +0 -8
  542. package/dist/services/metrics/is-truthy.mjs.map +0 -1
  543. package/dist/services/metrics/middleware.js +0 -25
  544. package/dist/services/metrics/middleware.js.map +0 -1
  545. package/dist/services/metrics/middleware.mjs +0 -26
  546. package/dist/services/metrics/middleware.mjs.map +0 -1
  547. package/dist/services/metrics/rate-limiter.js +0 -21
  548. package/dist/services/metrics/rate-limiter.js.map +0 -1
  549. package/dist/services/metrics/rate-limiter.mjs +0 -22
  550. package/dist/services/metrics/rate-limiter.mjs.map +0 -1
  551. package/dist/services/metrics/sender.js +0 -76
  552. package/dist/services/metrics/sender.js.map +0 -1
  553. package/dist/services/metrics/sender.mjs +0 -70
  554. package/dist/services/metrics/sender.mjs.map +0 -1
  555. package/dist/services/query-params.js +0 -12
  556. package/dist/services/query-params.js.map +0 -1
  557. package/dist/services/query-params.mjs +0 -13
  558. package/dist/services/query-params.mjs.map +0 -1
  559. package/dist/services/reloader.js +0 -36
  560. package/dist/services/reloader.js.map +0 -1
  561. package/dist/services/reloader.mjs +0 -36
  562. package/dist/services/reloader.mjs.map +0 -1
  563. package/dist/services/request-context.js +0 -13
  564. package/dist/services/request-context.js.map +0 -1
  565. package/dist/services/request-context.mjs +0 -14
  566. package/dist/services/request-context.mjs.map +0 -1
  567. package/dist/services/server/admin-api.js +0 -13
  568. package/dist/services/server/admin-api.js.map +0 -1
  569. package/dist/services/server/admin-api.mjs +0 -13
  570. package/dist/services/server/admin-api.mjs.map +0 -1
  571. package/dist/services/server/api.js +0 -30
  572. package/dist/services/server/api.js.map +0 -1
  573. package/dist/services/server/api.mjs +0 -28
  574. package/dist/services/server/api.mjs.map +0 -1
  575. package/dist/services/server/compose-endpoint.js +0 -117
  576. package/dist/services/server/compose-endpoint.js.map +0 -1
  577. package/dist/services/server/compose-endpoint.mjs +0 -116
  578. package/dist/services/server/compose-endpoint.mjs.map +0 -1
  579. package/dist/services/server/content-api.js +0 -12
  580. package/dist/services/server/content-api.js.map +0 -1
  581. package/dist/services/server/content-api.mjs +0 -12
  582. package/dist/services/server/content-api.mjs.map +0 -1
  583. package/dist/services/server/http-server.js +0 -50
  584. package/dist/services/server/http-server.js.map +0 -1
  585. package/dist/services/server/http-server.mjs +0 -48
  586. package/dist/services/server/http-server.mjs.map +0 -1
  587. package/dist/services/server/index.js +0 -87
  588. package/dist/services/server/index.js.map +0 -1
  589. package/dist/services/server/index.mjs +0 -85
  590. package/dist/services/server/index.mjs.map +0 -1
  591. package/dist/services/server/koa.js +0 -52
  592. package/dist/services/server/koa.js.map +0 -1
  593. package/dist/services/server/koa.mjs +0 -48
  594. package/dist/services/server/koa.mjs.map +0 -1
  595. package/dist/services/server/middleware.js +0 -92
  596. package/dist/services/server/middleware.js.map +0 -1
  597. package/dist/services/server/middleware.mjs +0 -90
  598. package/dist/services/server/middleware.mjs.map +0 -1
  599. package/dist/services/server/policy.js +0 -20
  600. package/dist/services/server/policy.js.map +0 -1
  601. package/dist/services/server/policy.mjs +0 -20
  602. package/dist/services/server/policy.mjs.map +0 -1
  603. package/dist/services/server/register-middlewares.js +0 -72
  604. package/dist/services/server/register-middlewares.js.map +0 -1
  605. package/dist/services/server/register-middlewares.mjs +0 -73
  606. package/dist/services/server/register-middlewares.mjs.map +0 -1
  607. package/dist/services/server/register-routes.js +0 -76
  608. package/dist/services/server/register-routes.js.map +0 -1
  609. package/dist/services/server/register-routes.mjs +0 -75
  610. package/dist/services/server/register-routes.mjs.map +0 -1
  611. package/dist/services/server/routing.js +0 -91
  612. package/dist/services/server/routing.js.map +0 -1
  613. package/dist/services/server/routing.mjs +0 -89
  614. package/dist/services/server/routing.mjs.map +0 -1
  615. package/dist/services/utils/dynamic-zones.js +0 -17
  616. package/dist/services/utils/dynamic-zones.js.map +0 -1
  617. package/dist/services/utils/dynamic-zones.mjs +0 -18
  618. package/dist/services/utils/dynamic-zones.mjs.map +0 -1
  619. package/dist/services/webhook-runner.js +0 -133
  620. package/dist/services/webhook-runner.js.map +0 -1
  621. package/dist/services/webhook-runner.mjs +0 -131
  622. package/dist/services/webhook-runner.mjs.map +0 -1
  623. package/dist/services/webhook-store.js +0 -110
  624. package/dist/services/webhook-store.js.map +0 -1
  625. package/dist/services/webhook-store.mjs +0 -110
  626. package/dist/services/webhook-store.mjs.map +0 -1
  627. package/dist/services/worker-queue.js +0 -56
  628. package/dist/services/worker-queue.js.map +0 -1
  629. package/dist/services/worker-queue.mjs +0 -55
  630. package/dist/services/worker-queue.mjs.map +0 -1
  631. package/dist/utils/convert-custom-field-type.js +0 -24
  632. package/dist/utils/convert-custom-field-type.js.map +0 -1
  633. package/dist/utils/convert-custom-field-type.mjs +0 -24
  634. package/dist/utils/convert-custom-field-type.mjs.map +0 -1
  635. package/dist/utils/cron.js +0 -38
  636. package/dist/utils/cron.js.map +0 -1
  637. package/dist/utils/cron.mjs +0 -38
  638. package/dist/utils/cron.mjs.map +0 -1
  639. package/dist/utils/fetch.js +0 -21
  640. package/dist/utils/fetch.js.map +0 -1
  641. package/dist/utils/fetch.mjs +0 -21
  642. package/dist/utils/fetch.mjs.map +0 -1
  643. package/dist/utils/filepath-to-prop-path.js +0 -33
  644. package/dist/utils/filepath-to-prop-path.js.map +0 -1
  645. package/dist/utils/filepath-to-prop-path.mjs +0 -30
  646. package/dist/utils/filepath-to-prop-path.mjs.map +0 -1
  647. package/dist/utils/is-initialized.js +0 -16
  648. package/dist/utils/is-initialized.js.map +0 -1
  649. package/dist/utils/is-initialized.mjs +0 -16
  650. package/dist/utils/is-initialized.mjs.map +0 -1
  651. package/dist/utils/lifecycles.js +0 -9
  652. package/dist/utils/lifecycles.js.map +0 -1
  653. package/dist/utils/lifecycles.mjs +0 -9
  654. package/dist/utils/lifecycles.mjs.map +0 -1
  655. package/dist/utils/load-config-file.js +0 -45
  656. package/dist/utils/load-config-file.js.map +0 -1
  657. package/dist/utils/load-config-file.mjs +0 -42
  658. package/dist/utils/load-config-file.mjs.map +0 -1
  659. package/dist/utils/load-files.js +0 -38
  660. package/dist/utils/load-files.js.map +0 -1
  661. package/dist/utils/load-files.mjs +0 -34
  662. package/dist/utils/load-files.mjs.map +0 -1
  663. package/dist/utils/open-browser.js +0 -11
  664. package/dist/utils/open-browser.js.map +0 -1
  665. package/dist/utils/open-browser.mjs +0 -9
  666. package/dist/utils/open-browser.mjs.map +0 -1
  667. package/dist/utils/resolve-working-dirs.js +0 -13
  668. package/dist/utils/resolve-working-dirs.js.map +0 -1
  669. package/dist/utils/resolve-working-dirs.mjs +0 -11
  670. package/dist/utils/resolve-working-dirs.mjs.map +0 -1
  671. package/dist/utils/signals.js +0 -17
  672. package/dist/utils/signals.js.map +0 -1
  673. package/dist/utils/signals.mjs +0 -17
  674. package/dist/utils/signals.mjs.map +0 -1
  675. package/dist/utils/startup-logger.js +0 -86
  676. package/dist/utils/startup-logger.js.map +0 -1
  677. package/dist/utils/startup-logger.mjs +0 -82
  678. package/dist/utils/startup-logger.mjs.map +0 -1
  679. package/dist/utils/transform-content-types-to-models.js +0 -288
  680. package/dist/utils/transform-content-types-to-models.js.map +0 -1
  681. package/dist/utils/transform-content-types-to-models.mjs +0 -285
  682. package/dist/utils/transform-content-types-to-models.mjs.map +0 -1
  683. package/dist/utils/update-notifier/index.js +0 -85
  684. package/dist/utils/update-notifier/index.js.map +0 -1
  685. package/dist/utils/update-notifier/index.mjs +0 -78
  686. package/dist/utils/update-notifier/index.mjs.map +0 -1
@@ -1,144 +0,0 @@
1
- "use strict";
2
- const path = require("path");
3
- const fse = require("fs-extra");
4
- const fp = require("lodash/fp");
5
- const resolve = require("resolve.exports");
6
- const strapiUtils = require("@strapi/utils");
7
- const loadConfigFile = require("../../utils/load-config-file.js");
8
- const loadFiles = require("../../utils/load-files.js");
9
- const getEnabledPlugins = require("./get-enabled-plugins.js");
10
- const getUserPluginsConfig = require("./get-user-plugins-config.js");
11
- const index = require("../../domain/content-type/index.js");
12
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
13
- function _interopNamespace(e) {
14
- if (e && e.__esModule) return e;
15
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
16
- if (e) {
17
- for (const k in e) {
18
- if (k !== "default") {
19
- const d = Object.getOwnPropertyDescriptor(e, k);
20
- Object.defineProperty(n, k, d.get ? d : {
21
- enumerable: true,
22
- get: () => e[k]
23
- });
24
- }
25
- }
26
- }
27
- n.default = e;
28
- return Object.freeze(n);
29
- }
30
- const fse__default = /* @__PURE__ */ _interopDefault(fse);
31
- const resolve__namespace = /* @__PURE__ */ _interopNamespace(resolve);
32
- const defaultPlugin = {
33
- bootstrap() {
34
- },
35
- destroy() {
36
- },
37
- register() {
38
- },
39
- config: {
40
- default: {},
41
- validator() {
42
- }
43
- },
44
- routes: [],
45
- controllers: {},
46
- services: {},
47
- policies: {},
48
- middlewares: {},
49
- contentTypes: {}
50
- };
51
- const applyUserExtension = async (plugins) => {
52
- const extensionsDir = strapi.dirs.dist.extensions;
53
- if (!await fse__default.default.pathExists(extensionsDir)) {
54
- return;
55
- }
56
- const extendedSchemas = await loadFiles.loadFiles(extensionsDir, "**/content-types/**/schema.json");
57
- const strapiServers = await loadFiles.loadFiles(extensionsDir, "**/strapi-server.js");
58
- for (const pluginName of Object.keys(plugins)) {
59
- const plugin = plugins[pluginName];
60
- for (const ctName of Object.keys(plugin.contentTypes)) {
61
- const extendedSchema = fp.get([pluginName, "content-types", ctName, "schema"], extendedSchemas);
62
- if (extendedSchema) {
63
- plugin.contentTypes[ctName].schema = {
64
- ...plugin.contentTypes[ctName].schema,
65
- ...extendedSchema
66
- };
67
- }
68
- }
69
- const strapiServer = fp.get([pluginName, "strapi-server"], strapiServers);
70
- if (strapiServer) {
71
- plugins[pluginName] = await strapiServer(plugin);
72
- }
73
- }
74
- };
75
- const applyUserConfig = async (plugins) => {
76
- const userPluginsConfig = await getUserPluginsConfig.getUserPluginsConfig();
77
- for (const pluginName of Object.keys(plugins)) {
78
- const plugin = plugins[pluginName];
79
- const userPluginConfig = fp.getOr({}, `${pluginName}.config`, userPluginsConfig);
80
- const defaultConfig = typeof plugin.config.default === "function" ? plugin.config.default({ env: strapiUtils.env }) : plugin.config.default;
81
- const config = fp.defaultsDeep(defaultConfig, userPluginConfig);
82
- try {
83
- plugin.config.validator(config);
84
- } catch (e) {
85
- if (e instanceof Error) {
86
- throw new Error(`Error regarding ${pluginName} config: ${e.message}`);
87
- }
88
- throw e;
89
- }
90
- plugin.config = config;
91
- }
92
- };
93
- async function loadPlugins(strapi2) {
94
- const plugins = {};
95
- const enabledPlugins = await getEnabledPlugins.getEnabledPlugins(strapi2);
96
- strapi2.config.set("enabledPlugins", enabledPlugins);
97
- for (const pluginName of Object.keys(enabledPlugins)) {
98
- const enabledPlugin = enabledPlugins[pluginName];
99
- let serverEntrypointPath;
100
- let resolvedExport = "./strapi-server.js";
101
- try {
102
- resolvedExport = (resolve__namespace.exports(enabledPlugin.packageInfo, "strapi-server", {
103
- require: true
104
- }) ?? "./strapi-server.js").toString();
105
- } catch (e) {
106
- }
107
- try {
108
- serverEntrypointPath = path.join(enabledPlugin.pathToPlugin, resolvedExport);
109
- } catch (e) {
110
- throw new Error(
111
- `Error loading the plugin ${pluginName} because ${pluginName} is not installed. Please either install the plugin or remove it's configuration.`
112
- );
113
- }
114
- if (!await fse__default.default.pathExists(serverEntrypointPath)) {
115
- continue;
116
- }
117
- const pluginServer = loadConfigFile.loadConfigFile(serverEntrypointPath);
118
- plugins[pluginName] = {
119
- ...defaultPlugin,
120
- ...pluginServer,
121
- contentTypes: formatContentTypes(pluginName, pluginServer.contentTypes ?? {}),
122
- config: fp.defaults(defaultPlugin.config, pluginServer.config),
123
- routes: pluginServer.routes ?? defaultPlugin.routes
124
- };
125
- }
126
- await applyUserConfig(plugins);
127
- await applyUserExtension(plugins);
128
- for (const pluginName of Object.keys(plugins)) {
129
- strapi2.get("plugins").add(pluginName, plugins[pluginName]);
130
- }
131
- }
132
- const formatContentTypes = (pluginName, contentTypes) => {
133
- Object.values(contentTypes).forEach((definition) => {
134
- const { schema } = definition;
135
- Object.assign(schema, {
136
- plugin: pluginName,
137
- collectionName: schema.collectionName || `${pluginName}_${schema.info.singularName}`.toLowerCase(),
138
- globalId: index.getGlobalId(schema, pluginName)
139
- });
140
- });
141
- return contentTypes;
142
- };
143
- module.exports = loadPlugins;
144
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/loaders/plugins/index.ts"],"sourcesContent":["import { join } from 'path';\nimport fse from 'fs-extra';\nimport { defaultsDeep, defaults, getOr, get } from 'lodash/fp';\nimport * as resolve from 'resolve.exports';\n\nimport { env } from '@strapi/utils';\nimport type { Core, Plugin, Struct } from '@strapi/types';\nimport { loadConfigFile } from '../../utils/load-config-file';\nimport { loadFiles } from '../../utils/load-files';\nimport { getEnabledPlugins } from './get-enabled-plugins';\nimport { getUserPluginsConfig } from './get-user-plugins-config';\nimport { getGlobalId } from '../../domain/content-type';\n\ninterface Plugins {\n [key: string]: Plugin.LoadedPlugin;\n}\n\nconst defaultPlugin = {\n bootstrap() {},\n destroy() {},\n register() {},\n config: {\n default: {},\n validator() {},\n },\n routes: [],\n controllers: {},\n services: {},\n policies: {},\n middlewares: {},\n contentTypes: {},\n};\n\nconst applyUserExtension = async (plugins: Plugins) => {\n const extensionsDir = strapi.dirs.dist.extensions;\n if (!(await fse.pathExists(extensionsDir))) {\n return;\n }\n\n const extendedSchemas = await loadFiles(extensionsDir, '**/content-types/**/schema.json');\n const strapiServers = await loadFiles(extensionsDir, '**/strapi-server.js');\n\n for (const pluginName of Object.keys(plugins)) {\n const plugin = plugins[pluginName];\n // first: load json schema\n for (const ctName of Object.keys(plugin.contentTypes)) {\n const extendedSchema = get([pluginName, 'content-types', ctName, 'schema'], extendedSchemas);\n if (extendedSchema) {\n plugin.contentTypes[ctName].schema = {\n ...plugin.contentTypes[ctName].schema,\n ...extendedSchema,\n };\n }\n }\n // second: execute strapi-server extension\n const strapiServer = get([pluginName, 'strapi-server'], strapiServers);\n if (strapiServer) {\n plugins[pluginName] = await strapiServer(plugin);\n }\n }\n};\n\nconst applyUserConfig = async (plugins: Plugins) => {\n const userPluginsConfig = await getUserPluginsConfig();\n\n for (const pluginName of Object.keys(plugins)) {\n const plugin = plugins[pluginName];\n const userPluginConfig = getOr({}, `${pluginName}.config`, userPluginsConfig);\n const defaultConfig =\n typeof plugin.config.default === 'function'\n ? plugin.config.default({ env })\n : plugin.config.default;\n\n const config = defaultsDeep(defaultConfig, userPluginConfig);\n try {\n plugin.config.validator(config);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`Error regarding ${pluginName} config: ${e.message}`);\n }\n\n throw e;\n }\n plugin.config = config;\n }\n};\n\nexport default async function loadPlugins(strapi: Core.Strapi) {\n const plugins: Plugins = {};\n\n const enabledPlugins = await getEnabledPlugins(strapi);\n\n strapi.config.set('enabledPlugins', enabledPlugins);\n\n for (const pluginName of Object.keys(enabledPlugins)) {\n const enabledPlugin = enabledPlugins[pluginName];\n\n let serverEntrypointPath;\n let resolvedExport = './strapi-server.js';\n\n try {\n resolvedExport = (\n resolve.exports(enabledPlugin.packageInfo, 'strapi-server', {\n require: true,\n }) ?? './strapi-server.js'\n ).toString();\n } catch (e) {\n // no export map or missing strapi-server export => fallback to default\n }\n\n try {\n serverEntrypointPath = join(enabledPlugin.pathToPlugin, resolvedExport);\n } catch (e) {\n throw new Error(\n `Error loading the plugin ${pluginName} because ${pluginName} is not installed. Please either install the plugin or remove it's configuration.`\n );\n }\n\n // only load plugins with a server entrypoint\n if (!(await fse.pathExists(serverEntrypointPath))) {\n continue;\n }\n\n const pluginServer = loadConfigFile(serverEntrypointPath);\n plugins[pluginName] = {\n ...defaultPlugin,\n ...pluginServer,\n contentTypes: formatContentTypes(pluginName, pluginServer.contentTypes ?? {}),\n config: defaults(defaultPlugin.config, pluginServer.config),\n routes: pluginServer.routes ?? defaultPlugin.routes,\n };\n }\n\n // TODO: validate plugin format\n await applyUserConfig(plugins);\n await applyUserExtension(plugins);\n\n for (const pluginName of Object.keys(plugins)) {\n strapi.get('plugins').add(pluginName, plugins[pluginName]);\n }\n}\n\nconst formatContentTypes = (\n pluginName: string,\n contentTypes: Record<string, { schema: Struct.ContentTypeSchema }>\n) => {\n Object.values(contentTypes).forEach((definition) => {\n const { schema } = definition;\n\n Object.assign(schema, {\n plugin: pluginName,\n collectionName:\n schema.collectionName || `${pluginName}_${schema.info.singularName}`.toLowerCase(),\n globalId: getGlobalId(schema, pluginName),\n });\n });\n\n return contentTypes;\n};\n"],"names":["fse","loadFiles","get","getUserPluginsConfig","getOr","env","defaultsDeep","strapi","getEnabledPlugins","resolve","join","loadConfigFile","defaults","getGlobalId"],"mappings":"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"}
@@ -1,125 +0,0 @@
1
- import { join } from "path";
2
- import fse from "fs-extra";
3
- import { defaults, get, getOr, defaultsDeep } from "lodash/fp";
4
- import * as resolve from "resolve.exports";
5
- import { env } from "@strapi/utils";
6
- import { loadConfigFile } from "../../utils/load-config-file.mjs";
7
- import { loadFiles } from "../../utils/load-files.mjs";
8
- import { getEnabledPlugins } from "./get-enabled-plugins.mjs";
9
- import { getUserPluginsConfig } from "./get-user-plugins-config.mjs";
10
- import { getGlobalId } from "../../domain/content-type/index.mjs";
11
- const defaultPlugin = {
12
- bootstrap() {
13
- },
14
- destroy() {
15
- },
16
- register() {
17
- },
18
- config: {
19
- default: {},
20
- validator() {
21
- }
22
- },
23
- routes: [],
24
- controllers: {},
25
- services: {},
26
- policies: {},
27
- middlewares: {},
28
- contentTypes: {}
29
- };
30
- const applyUserExtension = async (plugins) => {
31
- const extensionsDir = strapi.dirs.dist.extensions;
32
- if (!await fse.pathExists(extensionsDir)) {
33
- return;
34
- }
35
- const extendedSchemas = await loadFiles(extensionsDir, "**/content-types/**/schema.json");
36
- const strapiServers = await loadFiles(extensionsDir, "**/strapi-server.js");
37
- for (const pluginName of Object.keys(plugins)) {
38
- const plugin = plugins[pluginName];
39
- for (const ctName of Object.keys(plugin.contentTypes)) {
40
- const extendedSchema = get([pluginName, "content-types", ctName, "schema"], extendedSchemas);
41
- if (extendedSchema) {
42
- plugin.contentTypes[ctName].schema = {
43
- ...plugin.contentTypes[ctName].schema,
44
- ...extendedSchema
45
- };
46
- }
47
- }
48
- const strapiServer = get([pluginName, "strapi-server"], strapiServers);
49
- if (strapiServer) {
50
- plugins[pluginName] = await strapiServer(plugin);
51
- }
52
- }
53
- };
54
- const applyUserConfig = async (plugins) => {
55
- const userPluginsConfig = await getUserPluginsConfig();
56
- for (const pluginName of Object.keys(plugins)) {
57
- const plugin = plugins[pluginName];
58
- const userPluginConfig = getOr({}, `${pluginName}.config`, userPluginsConfig);
59
- const defaultConfig = typeof plugin.config.default === "function" ? plugin.config.default({ env }) : plugin.config.default;
60
- const config = defaultsDeep(defaultConfig, userPluginConfig);
61
- try {
62
- plugin.config.validator(config);
63
- } catch (e) {
64
- if (e instanceof Error) {
65
- throw new Error(`Error regarding ${pluginName} config: ${e.message}`);
66
- }
67
- throw e;
68
- }
69
- plugin.config = config;
70
- }
71
- };
72
- async function loadPlugins(strapi2) {
73
- const plugins = {};
74
- const enabledPlugins = await getEnabledPlugins(strapi2);
75
- strapi2.config.set("enabledPlugins", enabledPlugins);
76
- for (const pluginName of Object.keys(enabledPlugins)) {
77
- const enabledPlugin = enabledPlugins[pluginName];
78
- let serverEntrypointPath;
79
- let resolvedExport = "./strapi-server.js";
80
- try {
81
- resolvedExport = (resolve.exports(enabledPlugin.packageInfo, "strapi-server", {
82
- require: true
83
- }) ?? "./strapi-server.js").toString();
84
- } catch (e) {
85
- }
86
- try {
87
- serverEntrypointPath = join(enabledPlugin.pathToPlugin, resolvedExport);
88
- } catch (e) {
89
- throw new Error(
90
- `Error loading the plugin ${pluginName} because ${pluginName} is not installed. Please either install the plugin or remove it's configuration.`
91
- );
92
- }
93
- if (!await fse.pathExists(serverEntrypointPath)) {
94
- continue;
95
- }
96
- const pluginServer = loadConfigFile(serverEntrypointPath);
97
- plugins[pluginName] = {
98
- ...defaultPlugin,
99
- ...pluginServer,
100
- contentTypes: formatContentTypes(pluginName, pluginServer.contentTypes ?? {}),
101
- config: defaults(defaultPlugin.config, pluginServer.config),
102
- routes: pluginServer.routes ?? defaultPlugin.routes
103
- };
104
- }
105
- await applyUserConfig(plugins);
106
- await applyUserExtension(plugins);
107
- for (const pluginName of Object.keys(plugins)) {
108
- strapi2.get("plugins").add(pluginName, plugins[pluginName]);
109
- }
110
- }
111
- const formatContentTypes = (pluginName, contentTypes) => {
112
- Object.values(contentTypes).forEach((definition) => {
113
- const { schema } = definition;
114
- Object.assign(schema, {
115
- plugin: pluginName,
116
- collectionName: schema.collectionName || `${pluginName}_${schema.info.singularName}`.toLowerCase(),
117
- globalId: getGlobalId(schema, pluginName)
118
- });
119
- });
120
- return contentTypes;
121
- };
122
- export {
123
- loadPlugins as default
124
- };
125
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/loaders/plugins/index.ts"],"sourcesContent":["import { join } from 'path';\nimport fse from 'fs-extra';\nimport { defaultsDeep, defaults, getOr, get } from 'lodash/fp';\nimport * as resolve from 'resolve.exports';\n\nimport { env } from '@strapi/utils';\nimport type { Core, Plugin, Struct } from '@strapi/types';\nimport { loadConfigFile } from '../../utils/load-config-file';\nimport { loadFiles } from '../../utils/load-files';\nimport { getEnabledPlugins } from './get-enabled-plugins';\nimport { getUserPluginsConfig } from './get-user-plugins-config';\nimport { getGlobalId } from '../../domain/content-type';\n\ninterface Plugins {\n [key: string]: Plugin.LoadedPlugin;\n}\n\nconst defaultPlugin = {\n bootstrap() {},\n destroy() {},\n register() {},\n config: {\n default: {},\n validator() {},\n },\n routes: [],\n controllers: {},\n services: {},\n policies: {},\n middlewares: {},\n contentTypes: {},\n};\n\nconst applyUserExtension = async (plugins: Plugins) => {\n const extensionsDir = strapi.dirs.dist.extensions;\n if (!(await fse.pathExists(extensionsDir))) {\n return;\n }\n\n const extendedSchemas = await loadFiles(extensionsDir, '**/content-types/**/schema.json');\n const strapiServers = await loadFiles(extensionsDir, '**/strapi-server.js');\n\n for (const pluginName of Object.keys(plugins)) {\n const plugin = plugins[pluginName];\n // first: load json schema\n for (const ctName of Object.keys(plugin.contentTypes)) {\n const extendedSchema = get([pluginName, 'content-types', ctName, 'schema'], extendedSchemas);\n if (extendedSchema) {\n plugin.contentTypes[ctName].schema = {\n ...plugin.contentTypes[ctName].schema,\n ...extendedSchema,\n };\n }\n }\n // second: execute strapi-server extension\n const strapiServer = get([pluginName, 'strapi-server'], strapiServers);\n if (strapiServer) {\n plugins[pluginName] = await strapiServer(plugin);\n }\n }\n};\n\nconst applyUserConfig = async (plugins: Plugins) => {\n const userPluginsConfig = await getUserPluginsConfig();\n\n for (const pluginName of Object.keys(plugins)) {\n const plugin = plugins[pluginName];\n const userPluginConfig = getOr({}, `${pluginName}.config`, userPluginsConfig);\n const defaultConfig =\n typeof plugin.config.default === 'function'\n ? plugin.config.default({ env })\n : plugin.config.default;\n\n const config = defaultsDeep(defaultConfig, userPluginConfig);\n try {\n plugin.config.validator(config);\n } catch (e) {\n if (e instanceof Error) {\n throw new Error(`Error regarding ${pluginName} config: ${e.message}`);\n }\n\n throw e;\n }\n plugin.config = config;\n }\n};\n\nexport default async function loadPlugins(strapi: Core.Strapi) {\n const plugins: Plugins = {};\n\n const enabledPlugins = await getEnabledPlugins(strapi);\n\n strapi.config.set('enabledPlugins', enabledPlugins);\n\n for (const pluginName of Object.keys(enabledPlugins)) {\n const enabledPlugin = enabledPlugins[pluginName];\n\n let serverEntrypointPath;\n let resolvedExport = './strapi-server.js';\n\n try {\n resolvedExport = (\n resolve.exports(enabledPlugin.packageInfo, 'strapi-server', {\n require: true,\n }) ?? './strapi-server.js'\n ).toString();\n } catch (e) {\n // no export map or missing strapi-server export => fallback to default\n }\n\n try {\n serverEntrypointPath = join(enabledPlugin.pathToPlugin, resolvedExport);\n } catch (e) {\n throw new Error(\n `Error loading the plugin ${pluginName} because ${pluginName} is not installed. Please either install the plugin or remove it's configuration.`\n );\n }\n\n // only load plugins with a server entrypoint\n if (!(await fse.pathExists(serverEntrypointPath))) {\n continue;\n }\n\n const pluginServer = loadConfigFile(serverEntrypointPath);\n plugins[pluginName] = {\n ...defaultPlugin,\n ...pluginServer,\n contentTypes: formatContentTypes(pluginName, pluginServer.contentTypes ?? {}),\n config: defaults(defaultPlugin.config, pluginServer.config),\n routes: pluginServer.routes ?? defaultPlugin.routes,\n };\n }\n\n // TODO: validate plugin format\n await applyUserConfig(plugins);\n await applyUserExtension(plugins);\n\n for (const pluginName of Object.keys(plugins)) {\n strapi.get('plugins').add(pluginName, plugins[pluginName]);\n }\n}\n\nconst formatContentTypes = (\n pluginName: string,\n contentTypes: Record<string, { schema: Struct.ContentTypeSchema }>\n) => {\n Object.values(contentTypes).forEach((definition) => {\n const { schema } = definition;\n\n Object.assign(schema, {\n plugin: pluginName,\n collectionName:\n schema.collectionName || `${pluginName}_${schema.info.singularName}`.toLowerCase(),\n globalId: getGlobalId(schema, pluginName),\n });\n });\n\n return contentTypes;\n};\n"],"names":["strapi"],"mappings":";;;;;;;;;;AAiBA,MAAM,gBAAgB;AAAA,EACpB,YAAY;AAAA,EAAC;AAAA,EACb,UAAU;AAAA,EAAC;AAAA,EACX,WAAW;AAAA,EAAC;AAAA,EACZ,QAAQ;AAAA,IACN,SAAS,CAAC;AAAA,IACV,YAAY;AAAA,IAAA;AAAA,EACd;AAAA,EACA,QAAQ,CAAC;AAAA,EACT,aAAa,CAAC;AAAA,EACd,UAAU,CAAC;AAAA,EACX,UAAU,CAAC;AAAA,EACX,aAAa,CAAC;AAAA,EACd,cAAc,CAAA;AAChB;AAEA,MAAM,qBAAqB,OAAO,YAAqB;AAC/C,QAAA,gBAAgB,OAAO,KAAK,KAAK;AACvC,MAAI,CAAE,MAAM,IAAI,WAAW,aAAa,GAAI;AAC1C;AAAA,EAAA;AAGF,QAAM,kBAAkB,MAAM,UAAU,eAAe,iCAAiC;AACxF,QAAM,gBAAgB,MAAM,UAAU,eAAe,qBAAqB;AAE1E,aAAW,cAAc,OAAO,KAAK,OAAO,GAAG;AACvC,UAAA,SAAS,QAAQ,UAAU;AAEjC,eAAW,UAAU,OAAO,KAAK,OAAO,YAAY,GAAG;AAC/C,YAAA,iBAAiB,IAAI,CAAC,YAAY,iBAAiB,QAAQ,QAAQ,GAAG,eAAe;AAC3F,UAAI,gBAAgB;AACX,eAAA,aAAa,MAAM,EAAE,SAAS;AAAA,UACnC,GAAG,OAAO,aAAa,MAAM,EAAE;AAAA,UAC/B,GAAG;AAAA,QACL;AAAA,MAAA;AAAA,IACF;AAGF,UAAM,eAAe,IAAI,CAAC,YAAY,eAAe,GAAG,aAAa;AACrE,QAAI,cAAc;AAChB,cAAQ,UAAU,IAAI,MAAM,aAAa,MAAM;AAAA,IAAA;AAAA,EACjD;AAEJ;AAEA,MAAM,kBAAkB,OAAO,YAAqB;AAC5C,QAAA,oBAAoB,MAAM,qBAAqB;AAErD,aAAW,cAAc,OAAO,KAAK,OAAO,GAAG;AACvC,UAAA,SAAS,QAAQ,UAAU;AACjC,UAAM,mBAAmB,MAAM,IAAI,GAAG,UAAU,WAAW,iBAAiB;AAC5E,UAAM,gBACJ,OAAO,OAAO,OAAO,YAAY,aAC7B,OAAO,OAAO,QAAQ,EAAE,IAAA,CAAK,IAC7B,OAAO,OAAO;AAEd,UAAA,SAAS,aAAa,eAAe,gBAAgB;AACvD,QAAA;AACK,aAAA,OAAO,UAAU,MAAM;AAAA,aACvB,GAAG;AACV,UAAI,aAAa,OAAO;AACtB,cAAM,IAAI,MAAM,mBAAmB,UAAU,YAAY,EAAE,OAAO,EAAE;AAAA,MAAA;AAGhE,YAAA;AAAA,IAAA;AAER,WAAO,SAAS;AAAA,EAAA;AAEpB;AAEA,eAA8B,YAAYA,SAAqB;AAC7D,QAAM,UAAmB,CAAC;AAEpB,QAAA,iBAAiB,MAAM,kBAAkBA,OAAM;AAErDA,UAAO,OAAO,IAAI,kBAAkB,cAAc;AAElD,aAAW,cAAc,OAAO,KAAK,cAAc,GAAG;AAC9C,UAAA,gBAAgB,eAAe,UAAU;AAE3C,QAAA;AACJ,QAAI,iBAAiB;AAEjB,QAAA;AACF,wBACE,QAAQ,QAAQ,cAAc,aAAa,iBAAiB;AAAA,QAC1D,SAAS;AAAA,MAAA,CACV,KAAK,sBACN,SAAS;AAAA,aACJ,GAAG;AAAA,IAAA;AAIR,QAAA;AACqB,6BAAA,KAAK,cAAc,cAAc,cAAc;AAAA,aAC/D,GAAG;AACV,YAAM,IAAI;AAAA,QACR,4BAA4B,UAAU,YAAY,UAAU;AAAA,MAC9D;AAAA,IAAA;AAIF,QAAI,CAAE,MAAM,IAAI,WAAW,oBAAoB,GAAI;AACjD;AAAA,IAAA;AAGI,UAAA,eAAe,eAAe,oBAAoB;AACxD,YAAQ,UAAU,IAAI;AAAA,MACpB,GAAG;AAAA,MACH,GAAG;AAAA,MACH,cAAc,mBAAmB,YAAY,aAAa,gBAAgB,CAAA,CAAE;AAAA,MAC5E,QAAQ,SAAS,cAAc,QAAQ,aAAa,MAAM;AAAA,MAC1D,QAAQ,aAAa,UAAU,cAAc;AAAA,IAC/C;AAAA,EAAA;AAIF,QAAM,gBAAgB,OAAO;AAC7B,QAAM,mBAAmB,OAAO;AAEhC,aAAW,cAAc,OAAO,KAAK,OAAO,GAAG;AAC7CA,YAAO,IAAI,SAAS,EAAE,IAAI,YAAY,QAAQ,UAAU,CAAC;AAAA,EAAA;AAE7D;AAEA,MAAM,qBAAqB,CACzB,YACA,iBACG;AACH,SAAO,OAAO,YAAY,EAAE,QAAQ,CAAC,eAAe;AAC5C,UAAA,EAAE,WAAW;AAEnB,WAAO,OAAO,QAAQ;AAAA,MACpB,QAAQ;AAAA,MACR,gBACE,OAAO,kBAAkB,GAAG,UAAU,IAAI,OAAO,KAAK,YAAY,GAAG,YAAY;AAAA,MACnF,UAAU,YAAY,QAAQ,UAAU;AAAA,IAAA,CACzC;AAAA,EAAA,CACF;AAEM,SAAA;AACT;"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- const path = require("path");
3
- const fse = require("fs-extra");
4
- const strapiUtils = require("@strapi/utils");
5
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
6
- const fse__default = /* @__PURE__ */ _interopDefault(fse);
7
- async function loadPolicies(strapi) {
8
- const dir = strapi.dirs.dist.policies;
9
- if (!await fse__default.default.pathExists(dir)) {
10
- return;
11
- }
12
- const policies = {};
13
- const paths = await fse__default.default.readdir(dir, { withFileTypes: true });
14
- for (const fd of paths) {
15
- const { name } = fd;
16
- const fullPath = path.join(dir, name);
17
- if (fd.isFile() && path.extname(name) === ".js") {
18
- const key = path.basename(name, ".js");
19
- policies[key] = strapiUtils.importDefault(fullPath);
20
- }
21
- }
22
- strapi.get("policies").add(`global::`, policies);
23
- }
24
- module.exports = loadPolicies;
25
- //# sourceMappingURL=policies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policies.js","sources":["../../src/loaders/policies.ts"],"sourcesContent":["import { join, extname, basename } from 'path';\nimport fse from 'fs-extra';\nimport { importDefault } from '@strapi/utils';\n\nimport type { Core } from '@strapi/types';\n\n// TODO:: allow folders with index.js inside for bigger policies\nexport default async function loadPolicies(strapi: Core.Strapi) {\n const dir = strapi.dirs.dist.policies;\n\n if (!(await fse.pathExists(dir))) {\n return;\n }\n\n const policies: Record<string, Core.Policy> = {};\n const paths = await fse.readdir(dir, { withFileTypes: true });\n\n for (const fd of paths) {\n const { name } = fd;\n const fullPath = join(dir, name);\n\n if (fd.isFile() && extname(name) === '.js') {\n const key = basename(name, '.js');\n policies[key] = importDefault(fullPath);\n }\n }\n\n strapi.get('policies').add(`global::`, policies);\n}\n"],"names":["fse","join","extname","basename","importDefault"],"mappings":";;;;;;AAOA,eAA8B,aAAa,QAAqB;AACxD,QAAA,MAAM,OAAO,KAAK,KAAK;AAE7B,MAAI,CAAE,MAAMA,aAAAA,QAAI,WAAW,GAAG,GAAI;AAChC;AAAA,EAAA;AAGF,QAAM,WAAwC,CAAC;AACzC,QAAA,QAAQ,MAAMA,qBAAI,QAAQ,KAAK,EAAE,eAAe,MAAM;AAE5D,aAAW,MAAM,OAAO;AAChB,UAAA,EAAE,SAAS;AACX,UAAA,WAAWC,KAAAA,KAAK,KAAK,IAAI;AAE/B,QAAI,GAAG,OAAO,KAAKC,KAAQ,QAAA,IAAI,MAAM,OAAO;AACpC,YAAA,MAAMC,KAAAA,SAAS,MAAM,KAAK;AACvB,eAAA,GAAG,IAAIC,YAAA,cAAc,QAAQ;AAAA,IAAA;AAAA,EACxC;AAGF,SAAO,IAAI,UAAU,EAAE,IAAI,YAAY,QAAQ;AACjD;;"}
@@ -1,24 +0,0 @@
1
- import { join, extname, basename } from "path";
2
- import fse from "fs-extra";
3
- import { importDefault } from "@strapi/utils";
4
- async function loadPolicies(strapi) {
5
- const dir = strapi.dirs.dist.policies;
6
- if (!await fse.pathExists(dir)) {
7
- return;
8
- }
9
- const policies = {};
10
- const paths = await fse.readdir(dir, { withFileTypes: true });
11
- for (const fd of paths) {
12
- const { name } = fd;
13
- const fullPath = join(dir, name);
14
- if (fd.isFile() && extname(name) === ".js") {
15
- const key = basename(name, ".js");
16
- policies[key] = importDefault(fullPath);
17
- }
18
- }
19
- strapi.get("policies").add(`global::`, policies);
20
- }
21
- export {
22
- loadPolicies as default
23
- };
24
- //# sourceMappingURL=policies.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policies.mjs","sources":["../../src/loaders/policies.ts"],"sourcesContent":["import { join, extname, basename } from 'path';\nimport fse from 'fs-extra';\nimport { importDefault } from '@strapi/utils';\n\nimport type { Core } from '@strapi/types';\n\n// TODO:: allow folders with index.js inside for bigger policies\nexport default async function loadPolicies(strapi: Core.Strapi) {\n const dir = strapi.dirs.dist.policies;\n\n if (!(await fse.pathExists(dir))) {\n return;\n }\n\n const policies: Record<string, Core.Policy> = {};\n const paths = await fse.readdir(dir, { withFileTypes: true });\n\n for (const fd of paths) {\n const { name } = fd;\n const fullPath = join(dir, name);\n\n if (fd.isFile() && extname(name) === '.js') {\n const key = basename(name, '.js');\n policies[key] = importDefault(fullPath);\n }\n }\n\n strapi.get('policies').add(`global::`, policies);\n}\n"],"names":[],"mappings":";;;AAOA,eAA8B,aAAa,QAAqB;AACxD,QAAA,MAAM,OAAO,KAAK,KAAK;AAE7B,MAAI,CAAE,MAAM,IAAI,WAAW,GAAG,GAAI;AAChC;AAAA,EAAA;AAGF,QAAM,WAAwC,CAAC;AACzC,QAAA,QAAQ,MAAM,IAAI,QAAQ,KAAK,EAAE,eAAe,MAAM;AAE5D,aAAW,MAAM,OAAO;AAChB,UAAA,EAAE,SAAS;AACX,UAAA,WAAW,KAAK,KAAK,IAAI;AAE/B,QAAI,GAAG,OAAO,KAAK,QAAQ,IAAI,MAAM,OAAO;AACpC,YAAA,MAAM,SAAS,MAAM,KAAK;AACvB,eAAA,GAAG,IAAI,cAAc,QAAQ;AAAA,IAAA;AAAA,EACxC;AAGF,SAAO,IAAI,UAAU,EAAE,IAAI,YAAY,QAAQ;AACjD;"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- const loadSanitizers = (strapi) => {
3
- strapi.get("sanitizers").set("content-api", { input: [], output: [], query: [] });
4
- };
5
- module.exports = loadSanitizers;
6
- //# sourceMappingURL=sanitizers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sanitizers.js","sources":["../../src/loaders/sanitizers.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nexport default (strapi: Core.Strapi) => {\n strapi.get('sanitizers').set('content-api', { input: [], output: [], query: [] });\n};\n"],"names":[],"mappings":";AAEA,MAAe,iBAAA,CAAC,WAAwB;AACtC,SAAO,IAAI,YAAY,EAAE,IAAI,eAAe,EAAE,OAAO,CAAA,GAAI,QAAQ,CAAA,GAAI,OAAO,IAAI;AAClF;;"}
@@ -1,7 +0,0 @@
1
- const loadSanitizers = (strapi) => {
2
- strapi.get("sanitizers").set("content-api", { input: [], output: [], query: [] });
3
- };
4
- export {
5
- loadSanitizers as default
6
- };
7
- //# sourceMappingURL=sanitizers.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sanitizers.mjs","sources":["../../src/loaders/sanitizers.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nexport default (strapi: Core.Strapi) => {\n strapi.get('sanitizers').set('content-api', { input: [], output: [], query: [] });\n};\n"],"names":[],"mappings":"AAEA,MAAe,iBAAA,CAAC,WAAwB;AACtC,SAAO,IAAI,YAAY,EAAE,IAAI,eAAe,EAAE,OAAO,CAAA,GAAI,QAAQ,CAAA,GAAI,OAAO,IAAI;AAClF;"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- const path = require("path");
3
- const fs = require("fs");
4
- const strapiUtils = require("@strapi/utils");
5
- const srcSchema = strapiUtils.yup.object().shape({
6
- bootstrap: strapiUtils.yup.mixed().isFunction(),
7
- register: strapiUtils.yup.mixed().isFunction(),
8
- destroy: strapiUtils.yup.mixed().isFunction()
9
- }).noUnknown();
10
- const validateSrcIndex = (srcIndex) => {
11
- return srcSchema.validateSync(srcIndex, { strict: true, abortEarly: false });
12
- };
13
- const loadSrcIndex = (strapi) => {
14
- if (!fs.existsSync(strapi.dirs.dist.src)) {
15
- return;
16
- }
17
- const pathToSrcIndex = path.resolve(strapi.dirs.dist.src, "index.js");
18
- if (!fs.existsSync(pathToSrcIndex) || fs.statSync(pathToSrcIndex).isDirectory()) {
19
- return {};
20
- }
21
- const srcIndex = strapiUtils.importDefault(pathToSrcIndex);
22
- try {
23
- validateSrcIndex(srcIndex);
24
- } catch (e) {
25
- if (e instanceof strapiUtils.yup.ValidationError) {
26
- strapi.stopWithError({ message: `Invalid file \`./src/index.js\`: ${e.message}` });
27
- }
28
- throw e;
29
- }
30
- strapi.app = srcIndex;
31
- };
32
- module.exports = loadSrcIndex;
33
- //# sourceMappingURL=src-index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-index.js","sources":["../../src/loaders/src-index.ts"],"sourcesContent":["import { resolve } from 'path';\nimport { statSync, existsSync } from 'fs';\nimport { yup, importDefault } from '@strapi/utils';\n\nimport type { Core } from '@strapi/types';\n\nconst srcSchema = yup\n .object()\n .shape({\n bootstrap: yup.mixed().isFunction(),\n register: yup.mixed().isFunction(),\n destroy: yup.mixed().isFunction(),\n })\n .noUnknown();\n\nconst validateSrcIndex = (srcIndex: unknown) => {\n return srcSchema.validateSync(srcIndex, { strict: true, abortEarly: false });\n};\n\nexport default (strapi: Core.Strapi) => {\n if (!existsSync(strapi.dirs.dist.src)) {\n return;\n }\n\n const pathToSrcIndex = resolve(strapi.dirs.dist.src, 'index.js');\n if (!existsSync(pathToSrcIndex) || statSync(pathToSrcIndex).isDirectory()) {\n return {};\n }\n\n const srcIndex = importDefault(pathToSrcIndex);\n\n try {\n validateSrcIndex(srcIndex);\n } catch (e) {\n if (e instanceof yup.ValidationError) {\n strapi.stopWithError({ message: `Invalid file \\`./src/index.js\\`: ${e.message}` });\n }\n\n throw e;\n }\n\n strapi.app = srcIndex;\n};\n"],"names":["yup","existsSync","resolve","statSync","importDefault"],"mappings":";;;;AAMA,MAAM,YAAYA,YAAA,IACf,OAAO,EACP,MAAM;AAAA,EACL,WAAWA,YAAA,IAAI,MAAM,EAAE,WAAW;AAAA,EAClC,UAAUA,YAAA,IAAI,MAAM,EAAE,WAAW;AAAA,EACjC,SAASA,YAAAA,IAAI,MAAM,EAAE,WAAW;AAClC,CAAC,EACA,UAAU;AAEb,MAAM,mBAAmB,CAAC,aAAsB;AACvC,SAAA,UAAU,aAAa,UAAU,EAAE,QAAQ,MAAM,YAAY,OAAO;AAC7E;AAEA,MAAe,eAAA,CAAC,WAAwB;AACtC,MAAI,CAACC,GAAW,WAAA,OAAO,KAAK,KAAK,GAAG,GAAG;AACrC;AAAA,EAAA;AAGF,QAAM,iBAAiBC,KAAAA,QAAQ,OAAO,KAAK,KAAK,KAAK,UAAU;AAC3D,MAAA,CAACD,cAAW,cAAc,KAAKE,YAAS,cAAc,EAAE,eAAe;AACzE,WAAO,CAAC;AAAA,EAAA;AAGJ,QAAA,WAAWC,0BAAc,cAAc;AAEzC,MAAA;AACF,qBAAiB,QAAQ;AAAA,WAClB,GAAG;AACN,QAAA,aAAaJ,gBAAI,iBAAiB;AACpC,aAAO,cAAc,EAAE,SAAS,oCAAoC,EAAE,OAAO,IAAI;AAAA,IAAA;AAG7E,UAAA;AAAA,EAAA;AAGR,SAAO,MAAM;AACf;;"}
@@ -1,34 +0,0 @@
1
- import { resolve } from "path";
2
- import { existsSync, statSync } from "fs";
3
- import { yup, importDefault } from "@strapi/utils";
4
- const srcSchema = yup.object().shape({
5
- bootstrap: yup.mixed().isFunction(),
6
- register: yup.mixed().isFunction(),
7
- destroy: yup.mixed().isFunction()
8
- }).noUnknown();
9
- const validateSrcIndex = (srcIndex) => {
10
- return srcSchema.validateSync(srcIndex, { strict: true, abortEarly: false });
11
- };
12
- const loadSrcIndex = (strapi) => {
13
- if (!existsSync(strapi.dirs.dist.src)) {
14
- return;
15
- }
16
- const pathToSrcIndex = resolve(strapi.dirs.dist.src, "index.js");
17
- if (!existsSync(pathToSrcIndex) || statSync(pathToSrcIndex).isDirectory()) {
18
- return {};
19
- }
20
- const srcIndex = importDefault(pathToSrcIndex);
21
- try {
22
- validateSrcIndex(srcIndex);
23
- } catch (e) {
24
- if (e instanceof yup.ValidationError) {
25
- strapi.stopWithError({ message: `Invalid file \`./src/index.js\`: ${e.message}` });
26
- }
27
- throw e;
28
- }
29
- strapi.app = srcIndex;
30
- };
31
- export {
32
- loadSrcIndex as default
33
- };
34
- //# sourceMappingURL=src-index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-index.mjs","sources":["../../src/loaders/src-index.ts"],"sourcesContent":["import { resolve } from 'path';\nimport { statSync, existsSync } from 'fs';\nimport { yup, importDefault } from '@strapi/utils';\n\nimport type { Core } from '@strapi/types';\n\nconst srcSchema = yup\n .object()\n .shape({\n bootstrap: yup.mixed().isFunction(),\n register: yup.mixed().isFunction(),\n destroy: yup.mixed().isFunction(),\n })\n .noUnknown();\n\nconst validateSrcIndex = (srcIndex: unknown) => {\n return srcSchema.validateSync(srcIndex, { strict: true, abortEarly: false });\n};\n\nexport default (strapi: Core.Strapi) => {\n if (!existsSync(strapi.dirs.dist.src)) {\n return;\n }\n\n const pathToSrcIndex = resolve(strapi.dirs.dist.src, 'index.js');\n if (!existsSync(pathToSrcIndex) || statSync(pathToSrcIndex).isDirectory()) {\n return {};\n }\n\n const srcIndex = importDefault(pathToSrcIndex);\n\n try {\n validateSrcIndex(srcIndex);\n } catch (e) {\n if (e instanceof yup.ValidationError) {\n strapi.stopWithError({ message: `Invalid file \\`./src/index.js\\`: ${e.message}` });\n }\n\n throw e;\n }\n\n strapi.app = srcIndex;\n};\n"],"names":[],"mappings":";;;AAMA,MAAM,YAAY,IACf,OAAO,EACP,MAAM;AAAA,EACL,WAAW,IAAI,MAAM,EAAE,WAAW;AAAA,EAClC,UAAU,IAAI,MAAM,EAAE,WAAW;AAAA,EACjC,SAAS,IAAI,MAAM,EAAE,WAAW;AAClC,CAAC,EACA,UAAU;AAEb,MAAM,mBAAmB,CAAC,aAAsB;AACvC,SAAA,UAAU,aAAa,UAAU,EAAE,QAAQ,MAAM,YAAY,OAAO;AAC7E;AAEA,MAAe,eAAA,CAAC,WAAwB;AACtC,MAAI,CAAC,WAAW,OAAO,KAAK,KAAK,GAAG,GAAG;AACrC;AAAA,EAAA;AAGF,QAAM,iBAAiB,QAAQ,OAAO,KAAK,KAAK,KAAK,UAAU;AAC3D,MAAA,CAAC,WAAW,cAAc,KAAK,SAAS,cAAc,EAAE,eAAe;AACzE,WAAO,CAAC;AAAA,EAAA;AAGJ,QAAA,WAAW,cAAc,cAAc;AAEzC,MAAA;AACF,qBAAiB,QAAQ;AAAA,WAClB,GAAG;AACN,QAAA,aAAa,IAAI,iBAAiB;AACpC,aAAO,cAAc,EAAE,SAAS,oCAAoC,EAAE,OAAO,IAAI;AAAA,IAAA;AAG7E,UAAA;AAAA,EAAA;AAGR,SAAO,MAAM;AACf;"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- const loadValidators = (strapi) => {
3
- strapi.get("validators").set("content-api", { input: [], query: [] });
4
- };
5
- module.exports = loadValidators;
6
- //# sourceMappingURL=validators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validators.js","sources":["../../src/loaders/validators.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nexport default (strapi: Core.Strapi) => {\n strapi.get('validators').set('content-api', { input: [], query: [] });\n};\n"],"names":[],"mappings":";AAEA,MAAe,iBAAA,CAAC,WAAwB;AACtC,SAAO,IAAI,YAAY,EAAE,IAAI,eAAe,EAAE,OAAO,CAAI,GAAA,OAAO,CAAA,GAAI;AACtE;;"}
@@ -1,7 +0,0 @@
1
- const loadValidators = (strapi) => {
2
- strapi.get("validators").set("content-api", { input: [], query: [] });
3
- };
4
- export {
5
- loadValidators as default
6
- };
7
- //# sourceMappingURL=validators.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validators.mjs","sources":["../../src/loaders/validators.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nexport default (strapi: Core.Strapi) => {\n strapi.get('validators').set('content-api', { input: [], query: [] });\n};\n"],"names":[],"mappings":"AAEA,MAAe,iBAAA,CAAC,WAAwB;AACtC,SAAO,IAAI,YAAY,EAAE,IAAI,eAAe,EAAE,OAAO,CAAI,GAAA,OAAO,CAAA,GAAI;AACtE;"}
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fse = require("fs-extra");
4
- const fp = require("lodash/fp");
5
- const body = require("koa-body");
6
- const mime = require("mime-types");
7
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
8
- const fse__default = /* @__PURE__ */ _interopDefault(fse);
9
- const body__default = /* @__PURE__ */ _interopDefault(body);
10
- const mime__default = /* @__PURE__ */ _interopDefault(mime);
11
- const defaults = {
12
- multipart: true,
13
- patchKoa: true
14
- };
15
- function ensureFileMimeType(file) {
16
- if (!file.type) {
17
- file.type = mime__default.default.lookup(file.name) || "application/octet-stream";
18
- }
19
- }
20
- function getFiles(ctx) {
21
- return ctx?.request?.files?.files;
22
- }
23
- const bodyMiddleware = (config, { strapi }) => {
24
- const bodyConfig = fp.defaultsDeep(defaults, config);
25
- let gqlEndpoint;
26
- if (strapi.plugin("graphql")) {
27
- const { config: gqlConfig } = strapi.plugin("graphql");
28
- gqlEndpoint = gqlConfig("endpoint");
29
- }
30
- return async (ctx, next) => {
31
- if (gqlEndpoint && ctx.url === gqlEndpoint) {
32
- await next();
33
- } else {
34
- try {
35
- await body__default.default(bodyConfig)(ctx, async () => {
36
- });
37
- const files2 = getFiles(ctx);
38
- if (files2) {
39
- if (Array.isArray(files2)) {
40
- files2.forEach(ensureFileMimeType);
41
- } else {
42
- ensureFileMimeType(files2);
43
- }
44
- }
45
- await next();
46
- } catch (error) {
47
- if (error instanceof Error && error.message && error.message.includes("maxFileSize exceeded")) {
48
- return ctx.payloadTooLarge("FileTooBig");
49
- }
50
- throw error;
51
- }
52
- }
53
- const files = getFiles(ctx);
54
- if (files) {
55
- if (Array.isArray(files)) {
56
- Promise.all(files.map((file) => fse__default.default.remove(file.filepath)));
57
- } else if (files && files.filepath) {
58
- fse__default.default.remove(files.filepath);
59
- }
60
- delete ctx.request.files;
61
- }
62
- };
63
- };
64
- exports.body = bodyMiddleware;
65
- //# sourceMappingURL=body.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"body.js","sources":["../../src/middlewares/body.ts"],"sourcesContent":["import fse from 'fs-extra';\nimport { defaultsDeep } from 'lodash/fp';\nimport body, { KoaBodyMiddlewareOptions } from 'koa-body';\nimport mime from 'mime-types';\nimport type Koa from 'koa';\nimport type { Core } from '@strapi/types';\n\nexport type Config = KoaBodyMiddlewareOptions;\n\nconst defaults = {\n multipart: true,\n patchKoa: true,\n};\n\nfunction ensureFileMimeType(file: any): void {\n if (!file.type) {\n file.type = mime.lookup(file.name) || 'application/octet-stream';\n }\n}\n\nfunction getFiles(ctx: Koa.Context) {\n return ctx?.request?.files?.files;\n}\n\nconst bodyMiddleware: Core.MiddlewareFactory<Config> = (config, { strapi }) => {\n const bodyConfig: Config = defaultsDeep(defaults, config);\n\n let gqlEndpoint: string | undefined;\n if (strapi.plugin('graphql')) {\n const { config: gqlConfig } = strapi.plugin('graphql');\n gqlEndpoint = gqlConfig('endpoint');\n }\n\n return async (ctx, next) => {\n // TODO: find a better way later\n if (gqlEndpoint && ctx.url === gqlEndpoint) {\n await next();\n } else {\n try {\n await body(bodyConfig)(ctx, async () => {});\n\n const files = getFiles(ctx);\n\n /**\n * in case the mime-type wasn't sent, Strapi tries to guess it\n * from the file extension, to avoid a corrupt database state\n */\n if (files) {\n if (Array.isArray(files)) {\n files.forEach(ensureFileMimeType);\n } else {\n ensureFileMimeType(files);\n }\n }\n\n await next();\n } catch (error) {\n if (\n error instanceof Error &&\n error.message &&\n error.message.includes('maxFileSize exceeded')\n ) {\n return ctx.payloadTooLarge('FileTooBig');\n }\n\n throw error;\n }\n }\n\n const files = getFiles(ctx);\n\n // clean any file that was uploaded\n if (files) {\n if (Array.isArray(files)) {\n // not awaiting to not slow the request\n Promise.all(files.map((file) => fse.remove(file.filepath)));\n } else if (files && files.filepath) {\n // not awaiting to not slow the request\n fse.remove(files.filepath);\n }\n delete ctx.request.files;\n }\n };\n};\n\nexport { bodyMiddleware as body };\n"],"names":["mime","defaultsDeep","body","files","fse"],"mappings":";;;;;;;;;;AASA,MAAM,WAAW;AAAA,EACf,WAAW;AAAA,EACX,UAAU;AACZ;AAEA,SAAS,mBAAmB,MAAiB;AACvC,MAAA,CAAC,KAAK,MAAM;AACd,SAAK,OAAOA,cAAA,QAAK,OAAO,KAAK,IAAI,KAAK;AAAA,EAAA;AAE1C;AAEA,SAAS,SAAS,KAAkB;AAC3B,SAAA,KAAK,SAAS,OAAO;AAC9B;AAEA,MAAM,iBAAiD,CAAC,QAAQ,EAAE,aAAa;AACvE,QAAA,aAAqBC,GAAAA,aAAa,UAAU,MAAM;AAEpD,MAAA;AACA,MAAA,OAAO,OAAO,SAAS,GAAG;AAC5B,UAAM,EAAE,QAAQ,UAAA,IAAc,OAAO,OAAO,SAAS;AACrD,kBAAc,UAAU,UAAU;AAAA,EAAA;AAG7B,SAAA,OAAO,KAAK,SAAS;AAEtB,QAAA,eAAe,IAAI,QAAQ,aAAa;AAC1C,YAAM,KAAK;AAAA,IAAA,OACN;AACD,UAAA;AACF,cAAMC,sBAAK,UAAU,EAAE,KAAK,YAAY;AAAA,QAAA,CAAE;AAEpCC,cAAAA,SAAQ,SAAS,GAAG;AAM1B,YAAIA,QAAO;AACL,cAAA,MAAM,QAAQA,MAAK,GAAG;AACxBA,mBAAM,QAAQ,kBAAkB;AAAA,UAAA,OAC3B;AACL,+BAAmBA,MAAK;AAAA,UAAA;AAAA,QAC1B;AAGF,cAAM,KAAK;AAAA,eACJ,OAAO;AAEZ,YAAA,iBAAiB,SACjB,MAAM,WACN,MAAM,QAAQ,SAAS,sBAAsB,GAC7C;AACO,iBAAA,IAAI,gBAAgB,YAAY;AAAA,QAAA;AAGnC,cAAA;AAAA,MAAA;AAAA,IACR;AAGI,UAAA,QAAQ,SAAS,GAAG;AAG1B,QAAI,OAAO;AACL,UAAA,MAAM,QAAQ,KAAK,GAAG;AAEhB,gBAAA,IAAI,MAAM,IAAI,CAAC,SAASC,qBAAI,OAAO,KAAK,QAAQ,CAAC,CAAC;AAAA,MAAA,WACjD,SAAS,MAAM,UAAU;AAE9BA,6BAAA,OAAO,MAAM,QAAQ;AAAA,MAAA;AAE3B,aAAO,IAAI,QAAQ;AAAA,IAAA;AAAA,EAEvB;AACF;;"}
@@ -1,61 +0,0 @@
1
- import fse from "fs-extra";
2
- import { defaultsDeep } from "lodash/fp";
3
- import body from "koa-body";
4
- import mime from "mime-types";
5
- const defaults = {
6
- multipart: true,
7
- patchKoa: true
8
- };
9
- function ensureFileMimeType(file) {
10
- if (!file.type) {
11
- file.type = mime.lookup(file.name) || "application/octet-stream";
12
- }
13
- }
14
- function getFiles(ctx) {
15
- return ctx?.request?.files?.files;
16
- }
17
- const bodyMiddleware = (config, { strapi }) => {
18
- const bodyConfig = defaultsDeep(defaults, config);
19
- let gqlEndpoint;
20
- if (strapi.plugin("graphql")) {
21
- const { config: gqlConfig } = strapi.plugin("graphql");
22
- gqlEndpoint = gqlConfig("endpoint");
23
- }
24
- return async (ctx, next) => {
25
- if (gqlEndpoint && ctx.url === gqlEndpoint) {
26
- await next();
27
- } else {
28
- try {
29
- await body(bodyConfig)(ctx, async () => {
30
- });
31
- const files2 = getFiles(ctx);
32
- if (files2) {
33
- if (Array.isArray(files2)) {
34
- files2.forEach(ensureFileMimeType);
35
- } else {
36
- ensureFileMimeType(files2);
37
- }
38
- }
39
- await next();
40
- } catch (error) {
41
- if (error instanceof Error && error.message && error.message.includes("maxFileSize exceeded")) {
42
- return ctx.payloadTooLarge("FileTooBig");
43
- }
44
- throw error;
45
- }
46
- }
47
- const files = getFiles(ctx);
48
- if (files) {
49
- if (Array.isArray(files)) {
50
- Promise.all(files.map((file) => fse.remove(file.filepath)));
51
- } else if (files && files.filepath) {
52
- fse.remove(files.filepath);
53
- }
54
- delete ctx.request.files;
55
- }
56
- };
57
- };
58
- export {
59
- bodyMiddleware as body
60
- };
61
- //# sourceMappingURL=body.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"body.mjs","sources":["../../src/middlewares/body.ts"],"sourcesContent":["import fse from 'fs-extra';\nimport { defaultsDeep } from 'lodash/fp';\nimport body, { KoaBodyMiddlewareOptions } from 'koa-body';\nimport mime from 'mime-types';\nimport type Koa from 'koa';\nimport type { Core } from '@strapi/types';\n\nexport type Config = KoaBodyMiddlewareOptions;\n\nconst defaults = {\n multipart: true,\n patchKoa: true,\n};\n\nfunction ensureFileMimeType(file: any): void {\n if (!file.type) {\n file.type = mime.lookup(file.name) || 'application/octet-stream';\n }\n}\n\nfunction getFiles(ctx: Koa.Context) {\n return ctx?.request?.files?.files;\n}\n\nconst bodyMiddleware: Core.MiddlewareFactory<Config> = (config, { strapi }) => {\n const bodyConfig: Config = defaultsDeep(defaults, config);\n\n let gqlEndpoint: string | undefined;\n if (strapi.plugin('graphql')) {\n const { config: gqlConfig } = strapi.plugin('graphql');\n gqlEndpoint = gqlConfig('endpoint');\n }\n\n return async (ctx, next) => {\n // TODO: find a better way later\n if (gqlEndpoint && ctx.url === gqlEndpoint) {\n await next();\n } else {\n try {\n await body(bodyConfig)(ctx, async () => {});\n\n const files = getFiles(ctx);\n\n /**\n * in case the mime-type wasn't sent, Strapi tries to guess it\n * from the file extension, to avoid a corrupt database state\n */\n if (files) {\n if (Array.isArray(files)) {\n files.forEach(ensureFileMimeType);\n } else {\n ensureFileMimeType(files);\n }\n }\n\n await next();\n } catch (error) {\n if (\n error instanceof Error &&\n error.message &&\n error.message.includes('maxFileSize exceeded')\n ) {\n return ctx.payloadTooLarge('FileTooBig');\n }\n\n throw error;\n }\n }\n\n const files = getFiles(ctx);\n\n // clean any file that was uploaded\n if (files) {\n if (Array.isArray(files)) {\n // not awaiting to not slow the request\n Promise.all(files.map((file) => fse.remove(file.filepath)));\n } else if (files && files.filepath) {\n // not awaiting to not slow the request\n fse.remove(files.filepath);\n }\n delete ctx.request.files;\n }\n };\n};\n\nexport { bodyMiddleware as body };\n"],"names":["files"],"mappings":";;;;AASA,MAAM,WAAW;AAAA,EACf,WAAW;AAAA,EACX,UAAU;AACZ;AAEA,SAAS,mBAAmB,MAAiB;AACvC,MAAA,CAAC,KAAK,MAAM;AACd,SAAK,OAAO,KAAK,OAAO,KAAK,IAAI,KAAK;AAAA,EAAA;AAE1C;AAEA,SAAS,SAAS,KAAkB;AAC3B,SAAA,KAAK,SAAS,OAAO;AAC9B;AAEA,MAAM,iBAAiD,CAAC,QAAQ,EAAE,aAAa;AACvE,QAAA,aAAqB,aAAa,UAAU,MAAM;AAEpD,MAAA;AACA,MAAA,OAAO,OAAO,SAAS,GAAG;AAC5B,UAAM,EAAE,QAAQ,UAAA,IAAc,OAAO,OAAO,SAAS;AACrD,kBAAc,UAAU,UAAU;AAAA,EAAA;AAG7B,SAAA,OAAO,KAAK,SAAS;AAEtB,QAAA,eAAe,IAAI,QAAQ,aAAa;AAC1C,YAAM,KAAK;AAAA,IAAA,OACN;AACD,UAAA;AACF,cAAM,KAAK,UAAU,EAAE,KAAK,YAAY;AAAA,QAAA,CAAE;AAEpCA,cAAAA,SAAQ,SAAS,GAAG;AAM1B,YAAIA,QAAO;AACL,cAAA,MAAM,QAAQA,MAAK,GAAG;AACxBA,mBAAM,QAAQ,kBAAkB;AAAA,UAAA,OAC3B;AACL,+BAAmBA,MAAK;AAAA,UAAA;AAAA,QAC1B;AAGF,cAAM,KAAK;AAAA,eACJ,OAAO;AAEZ,YAAA,iBAAiB,SACjB,MAAM,WACN,MAAM,QAAQ,SAAS,sBAAsB,GAC7C;AACO,iBAAA,IAAI,gBAAgB,YAAY;AAAA,QAAA;AAGnC,cAAA;AAAA,MAAA;AAAA,IACR;AAGI,UAAA,QAAQ,SAAS,GAAG;AAG1B,QAAI,OAAO;AACL,UAAA,MAAM,QAAQ,KAAK,GAAG;AAEhB,gBAAA,IAAI,MAAM,IAAI,CAAC,SAAS,IAAI,OAAO,KAAK,QAAQ,CAAC,CAAC;AAAA,MAAA,WACjD,SAAS,MAAM,UAAU;AAE9B,YAAA,OAAO,MAAM,QAAQ;AAAA,MAAA;AAE3B,aAAO,IAAI,QAAQ;AAAA,IAAA;AAAA,EAEvB;AACF;"}