@acmekit/framework 2.13.1

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 (362) hide show
  1. package/README.md +0 -0
  2. package/dist/acmekit-app-loader.d.ts +70 -0
  3. package/dist/acmekit-app-loader.d.ts.map +1 -0
  4. package/dist/acmekit-app-loader.js +256 -0
  5. package/dist/acmekit-app-loader.js.map +1 -0
  6. package/dist/build-tools/compiler.d.ts +64 -0
  7. package/dist/build-tools/compiler.d.ts.map +1 -0
  8. package/dist/build-tools/compiler.js +423 -0
  9. package/dist/build-tools/compiler.js.map +1 -0
  10. package/dist/build-tools/index.d.ts +2 -0
  11. package/dist/build-tools/index.d.ts.map +1 -0
  12. package/dist/build-tools/index.js +18 -0
  13. package/dist/build-tools/index.js.map +1 -0
  14. package/dist/config/config.d.ts +39 -0
  15. package/dist/config/config.d.ts.map +1 -0
  16. package/dist/config/config.js +155 -0
  17. package/dist/config/config.js.map +1 -0
  18. package/dist/config/index.d.ts +5 -0
  19. package/dist/config/index.d.ts.map +1 -0
  20. package/dist/config/index.js +21 -0
  21. package/dist/config/index.js.map +1 -0
  22. package/dist/config/loader.d.ts +15 -0
  23. package/dist/config/loader.d.ts.map +1 -0
  24. package/dist/config/loader.js +39 -0
  25. package/dist/config/loader.js.map +1 -0
  26. package/dist/config/types.d.ts +2 -0
  27. package/dist/config/types.d.ts.map +1 -0
  28. package/dist/config/types.js +3 -0
  29. package/dist/config/types.js.map +1 -0
  30. package/dist/container.d.ts +3 -0
  31. package/dist/container.d.ts.map +1 -0
  32. package/dist/container.js +21 -0
  33. package/dist/container.js.map +1 -0
  34. package/dist/database/index.d.ts +3 -0
  35. package/dist/database/index.d.ts.map +1 -0
  36. package/dist/database/index.js +19 -0
  37. package/dist/database/index.js.map +1 -0
  38. package/dist/database/pg-connection-loader.d.ts +6 -0
  39. package/dist/database/pg-connection-loader.d.ts.map +1 -0
  40. package/dist/database/pg-connection-loader.js +68 -0
  41. package/dist/database/pg-connection-loader.js.map +1 -0
  42. package/dist/deps/awilix.d.ts +2 -0
  43. package/dist/deps/awilix.d.ts.map +1 -0
  44. package/dist/deps/awilix.js +18 -0
  45. package/dist/deps/awilix.js.map +1 -0
  46. package/dist/deps/mikro-orm-cli.d.ts +2 -0
  47. package/dist/deps/mikro-orm-cli.d.ts.map +1 -0
  48. package/dist/deps/mikro-orm-cli.js +18 -0
  49. package/dist/deps/mikro-orm-cli.js.map +1 -0
  50. package/dist/deps/mikro-orm-core.d.ts +2 -0
  51. package/dist/deps/mikro-orm-core.d.ts.map +1 -0
  52. package/dist/deps/mikro-orm-core.js +18 -0
  53. package/dist/deps/mikro-orm-core.js.map +1 -0
  54. package/dist/deps/mikro-orm-knex.d.ts +2 -0
  55. package/dist/deps/mikro-orm-knex.d.ts.map +1 -0
  56. package/dist/deps/mikro-orm-knex.js +18 -0
  57. package/dist/deps/mikro-orm-knex.js.map +1 -0
  58. package/dist/deps/mikro-orm-migrations.d.ts +2 -0
  59. package/dist/deps/mikro-orm-migrations.d.ts.map +1 -0
  60. package/dist/deps/mikro-orm-migrations.js +18 -0
  61. package/dist/deps/mikro-orm-migrations.js.map +1 -0
  62. package/dist/deps/mikro-orm-postgresql.d.ts +2 -0
  63. package/dist/deps/mikro-orm-postgresql.d.ts.map +1 -0
  64. package/dist/deps/mikro-orm-postgresql.js +18 -0
  65. package/dist/deps/mikro-orm-postgresql.js.map +1 -0
  66. package/dist/deps/opentelemetry-api.d.ts +2 -0
  67. package/dist/deps/opentelemetry-api.d.ts.map +1 -0
  68. package/dist/deps/opentelemetry-api.js +18 -0
  69. package/dist/deps/opentelemetry-api.js.map +1 -0
  70. package/dist/deps/opentelemetry-instrumentation-pg.d.ts +2 -0
  71. package/dist/deps/opentelemetry-instrumentation-pg.d.ts.map +1 -0
  72. package/dist/deps/opentelemetry-instrumentation-pg.js +18 -0
  73. package/dist/deps/opentelemetry-instrumentation-pg.js.map +1 -0
  74. package/dist/deps/opentelemetry-resources.d.ts +2 -0
  75. package/dist/deps/opentelemetry-resources.d.ts.map +1 -0
  76. package/dist/deps/opentelemetry-resources.js +18 -0
  77. package/dist/deps/opentelemetry-resources.js.map +1 -0
  78. package/dist/deps/opentelemetry-sdk-node.d.ts +2 -0
  79. package/dist/deps/opentelemetry-sdk-node.d.ts.map +1 -0
  80. package/dist/deps/opentelemetry-sdk-node.js +18 -0
  81. package/dist/deps/opentelemetry-sdk-node.js.map +1 -0
  82. package/dist/deps/opentelemetry-sdk-trace-node.d.ts +2 -0
  83. package/dist/deps/opentelemetry-sdk-trace-node.d.ts.map +1 -0
  84. package/dist/deps/opentelemetry-sdk-trace-node.js +18 -0
  85. package/dist/deps/opentelemetry-sdk-trace-node.js.map +1 -0
  86. package/dist/deps/pg.d.ts +2 -0
  87. package/dist/deps/pg.d.ts.map +1 -0
  88. package/dist/deps/pg.js +18 -0
  89. package/dist/deps/pg.js.map +1 -0
  90. package/dist/deps/zod.d.ts +2 -0
  91. package/dist/deps/zod.d.ts.map +1 -0
  92. package/dist/deps/zod.js +18 -0
  93. package/dist/deps/zod.js.map +1 -0
  94. package/dist/feature-flags/feature-flag-loader.d.ts +7 -0
  95. package/dist/feature-flags/feature-flag-loader.d.ts.map +1 -0
  96. package/dist/feature-flags/feature-flag-loader.js +34 -0
  97. package/dist/feature-flags/feature-flag-loader.js.map +1 -0
  98. package/dist/feature-flags/flag-router.d.ts +32 -0
  99. package/dist/feature-flags/flag-router.d.ts.map +1 -0
  100. package/dist/feature-flags/flag-router.js +67 -0
  101. package/dist/feature-flags/flag-router.js.map +1 -0
  102. package/dist/feature-flags/index.d.ts +5 -0
  103. package/dist/feature-flags/index.d.ts.map +1 -0
  104. package/dist/feature-flags/index.js +21 -0
  105. package/dist/feature-flags/index.js.map +1 -0
  106. package/dist/feature-flags/types.d.ts +31 -0
  107. package/dist/feature-flags/types.d.ts.map +1 -0
  108. package/dist/feature-flags/types.js +3 -0
  109. package/dist/feature-flags/types.js.map +1 -0
  110. package/dist/http/express-loader.d.ts +10 -0
  111. package/dist/http/express-loader.d.ts.map +1 -0
  112. package/dist/http/express-loader.js +130 -0
  113. package/dist/http/express-loader.js.map +1 -0
  114. package/dist/http/index.d.ts +15 -0
  115. package/dist/http/index.d.ts.map +1 -0
  116. package/dist/http/index.js +31 -0
  117. package/dist/http/index.js.map +1 -0
  118. package/dist/http/middleware-file-loader.d.ts +33 -0
  119. package/dist/http/middleware-file-loader.d.ts.map +1 -0
  120. package/dist/http/middleware-file-loader.js +186 -0
  121. package/dist/http/middleware-file-loader.js.map +1 -0
  122. package/dist/http/middlewares/apply-default-filters.d.ts +3 -0
  123. package/dist/http/middlewares/apply-default-filters.d.ts.map +1 -0
  124. package/dist/http/middlewares/apply-default-filters.js +32 -0
  125. package/dist/http/middlewares/apply-default-filters.js.map +1 -0
  126. package/dist/http/middlewares/apply-locale.d.ts +12 -0
  127. package/dist/http/middlewares/apply-locale.d.ts.map +1 -0
  128. package/dist/http/middlewares/apply-locale.js +31 -0
  129. package/dist/http/middlewares/apply-locale.js.map +1 -0
  130. package/dist/http/middlewares/apply-params-as-filters.d.ts +5 -0
  131. package/dist/http/middlewares/apply-params-as-filters.d.ts.map +1 -0
  132. package/dist/http/middlewares/apply-params-as-filters.js +14 -0
  133. package/dist/http/middlewares/apply-params-as-filters.js.map +1 -0
  134. package/dist/http/middlewares/authenticate-middleware.d.ts +14 -0
  135. package/dist/http/middlewares/authenticate-middleware.d.ts.map +1 -0
  136. package/dist/http/middlewares/authenticate-middleware.js +142 -0
  137. package/dist/http/middlewares/authenticate-middleware.js.map +1 -0
  138. package/dist/http/middlewares/bodyparser.d.ts +13 -0
  139. package/dist/http/middlewares/bodyparser.d.ts.map +1 -0
  140. package/dist/http/middlewares/bodyparser.js +62 -0
  141. package/dist/http/middlewares/bodyparser.js.map +1 -0
  142. package/dist/http/middlewares/check-permissions.d.ts +15 -0
  143. package/dist/http/middlewares/check-permissions.d.ts.map +1 -0
  144. package/dist/http/middlewares/check-permissions.js +54 -0
  145. package/dist/http/middlewares/check-permissions.js.map +1 -0
  146. package/dist/http/middlewares/clear-filters-by-key.d.ts +3 -0
  147. package/dist/http/middlewares/clear-filters-by-key.d.ts.map +1 -0
  148. package/dist/http/middlewares/clear-filters-by-key.js +12 -0
  149. package/dist/http/middlewares/clear-filters-by-key.js.map +1 -0
  150. package/dist/http/middlewares/ensure-publishable-api-key.d.ts +3 -0
  151. package/dist/http/middlewares/ensure-publishable-api-key.d.ts.map +1 -0
  152. package/dist/http/middlewares/ensure-publishable-api-key.js +58 -0
  153. package/dist/http/middlewares/ensure-publishable-api-key.js.map +1 -0
  154. package/dist/http/middlewares/error-handler.d.ts +21 -0
  155. package/dist/http/middlewares/error-handler.d.ts.map +1 -0
  156. package/dist/http/middlewares/error-handler.js +107 -0
  157. package/dist/http/middlewares/error-handler.js.map +1 -0
  158. package/dist/http/middlewares/exception-formatter.d.ts +9 -0
  159. package/dist/http/middlewares/exception-formatter.d.ts.map +1 -0
  160. package/dist/http/middlewares/exception-formatter.js +36 -0
  161. package/dist/http/middlewares/exception-formatter.js.map +1 -0
  162. package/dist/http/middlewares/index.d.ts +10 -0
  163. package/dist/http/middlewares/index.d.ts.map +1 -0
  164. package/dist/http/middlewares/index.js +26 -0
  165. package/dist/http/middlewares/index.js.map +1 -0
  166. package/dist/http/middlewares/set-context.d.ts +3 -0
  167. package/dist/http/middlewares/set-context.d.ts.map +1 -0
  168. package/dist/http/middlewares/set-context.js +18 -0
  169. package/dist/http/middlewares/set-context.js.map +1 -0
  170. package/dist/http/router.d.ts +36 -0
  171. package/dist/http/router.d.ts.map +1 -0
  172. package/dist/http/router.js +317 -0
  173. package/dist/http/router.js.map +1 -0
  174. package/dist/http/routes-finder.d.ts +22 -0
  175. package/dist/http/routes-finder.d.ts.map +1 -0
  176. package/dist/http/routes-finder.js +68 -0
  177. package/dist/http/routes-finder.js.map +1 -0
  178. package/dist/http/routes-loader.d.ts +39 -0
  179. package/dist/http/routes-loader.d.ts.map +1 -0
  180. package/dist/http/routes-loader.js +232 -0
  181. package/dist/http/routes-loader.js.map +1 -0
  182. package/dist/http/routes-sorter.d.ts +105 -0
  183. package/dist/http/routes-sorter.d.ts.map +1 -0
  184. package/dist/http/routes-sorter.js +146 -0
  185. package/dist/http/routes-sorter.js.map +1 -0
  186. package/dist/http/types.d.ts +191 -0
  187. package/dist/http/types.d.ts.map +1 -0
  188. package/dist/http/types.js +16 -0
  189. package/dist/http/types.js.map +1 -0
  190. package/dist/http/utils/define-middlewares.d.ts +22 -0
  191. package/dist/http/utils/define-middlewares.d.ts.map +1 -0
  192. package/dist/http/utils/define-middlewares.js +27 -0
  193. package/dist/http/utils/define-middlewares.js.map +1 -0
  194. package/dist/http/utils/field-filtering/field-parser.d.ts +32 -0
  195. package/dist/http/utils/field-filtering/field-parser.d.ts.map +1 -0
  196. package/dist/http/utils/field-filtering/field-parser.js +87 -0
  197. package/dist/http/utils/field-filtering/field-parser.js.map +1 -0
  198. package/dist/http/utils/field-filtering/field-validator.d.ts +24 -0
  199. package/dist/http/utils/field-filtering/field-validator.d.ts.map +1 -0
  200. package/dist/http/utils/field-filtering/field-validator.js +67 -0
  201. package/dist/http/utils/field-filtering/field-validator.js.map +1 -0
  202. package/dist/http/utils/field-filtering/index.d.ts +33 -0
  203. package/dist/http/utils/field-filtering/index.d.ts.map +1 -0
  204. package/dist/http/utils/field-filtering/index.js +9 -0
  205. package/dist/http/utils/field-filtering/index.js.map +1 -0
  206. package/dist/http/utils/get-query-config.d.ts +50 -0
  207. package/dist/http/utils/get-query-config.d.ts.map +1 -0
  208. package/dist/http/utils/get-query-config.js +109 -0
  209. package/dist/http/utils/get-query-config.js.map +1 -0
  210. package/dist/http/utils/http-compression.d.ts +5 -0
  211. package/dist/http/utils/http-compression.d.ts.map +1 -0
  212. package/dist/http/utils/http-compression.js +33 -0
  213. package/dist/http/utils/http-compression.js.map +1 -0
  214. package/dist/http/utils/maybe-apply-link-filter.d.ts +8 -0
  215. package/dist/http/utils/maybe-apply-link-filter.d.ts.map +1 -0
  216. package/dist/http/utils/maybe-apply-link-filter.js +68 -0
  217. package/dist/http/utils/maybe-apply-link-filter.js.map +1 -0
  218. package/dist/http/utils/policies/rbac-field-filter.d.ts +19 -0
  219. package/dist/http/utils/policies/rbac-field-filter.d.ts.map +1 -0
  220. package/dist/http/utils/policies/rbac-field-filter.js +348 -0
  221. package/dist/http/utils/policies/rbac-field-filter.js.map +1 -0
  222. package/dist/http/utils/refetch-entities.d.ts +21 -0
  223. package/dist/http/utils/refetch-entities.d.ts.map +1 -0
  224. package/dist/http/utils/refetch-entities.js +42 -0
  225. package/dist/http/utils/refetch-entities.js.map +1 -0
  226. package/dist/http/utils/restricted-fields.d.ts +6 -0
  227. package/dist/http/utils/restricted-fields.d.ts.map +1 -0
  228. package/dist/http/utils/restricted-fields.js +30 -0
  229. package/dist/http/utils/restricted-fields.js.map +1 -0
  230. package/dist/http/utils/unless-path.d.ts +9 -0
  231. package/dist/http/utils/unless-path.d.ts.map +1 -0
  232. package/dist/http/utils/unless-path.js +19 -0
  233. package/dist/http/utils/unless-path.js.map +1 -0
  234. package/dist/http/utils/validate-body.d.ts +5 -0
  235. package/dist/http/utils/validate-body.d.ts.map +1 -0
  236. package/dist/http/utils/validate-body.js +23 -0
  237. package/dist/http/utils/validate-body.js.map +1 -0
  238. package/dist/http/utils/validate-query.d.ts +6 -0
  239. package/dist/http/utils/validate-query.d.ts.map +1 -0
  240. package/dist/http/utils/validate-query.js +84 -0
  241. package/dist/http/utils/validate-query.js.map +1 -0
  242. package/dist/http/utils/wrap-handler.d.ts +3 -0
  243. package/dist/http/utils/wrap-handler.d.ts.map +1 -0
  244. package/dist/http/utils/wrap-handler.js +26 -0
  245. package/dist/http/utils/wrap-handler.js.map +1 -0
  246. package/dist/index.d.ts +18 -0
  247. package/dist/index.d.ts.map +1 -0
  248. package/dist/index.js +36 -0
  249. package/dist/index.js.map +1 -0
  250. package/dist/jobs/index.d.ts +2 -0
  251. package/dist/jobs/index.d.ts.map +1 -0
  252. package/dist/jobs/index.js +18 -0
  253. package/dist/jobs/index.js.map +1 -0
  254. package/dist/jobs/job-loader.d.ts +44 -0
  255. package/dist/jobs/job-loader.d.ts.map +1 -0
  256. package/dist/jobs/job-loader.js +91 -0
  257. package/dist/jobs/job-loader.js.map +1 -0
  258. package/dist/links/index.d.ts +2 -0
  259. package/dist/links/index.d.ts.map +1 -0
  260. package/dist/links/index.js +18 -0
  261. package/dist/links/index.js.map +1 -0
  262. package/dist/links/link-loader.d.ts +11 -0
  263. package/dist/links/link-loader.d.ts.map +1 -0
  264. package/dist/links/link-loader.js +76 -0
  265. package/dist/links/link-loader.js.map +1 -0
  266. package/dist/logger/index.d.ts +3 -0
  267. package/dist/logger/index.d.ts.map +1 -0
  268. package/dist/logger/index.js +9 -0
  269. package/dist/logger/index.js.map +1 -0
  270. package/dist/migrations/index.d.ts +3 -0
  271. package/dist/migrations/index.d.ts.map +1 -0
  272. package/dist/migrations/index.js +19 -0
  273. package/dist/migrations/index.js.map +1 -0
  274. package/dist/migrations/migrator.d.ts +38 -0
  275. package/dist/migrations/migrator.d.ts.map +1 -0
  276. package/dist/migrations/migrator.js +146 -0
  277. package/dist/migrations/migrator.js.map +1 -0
  278. package/dist/migrations/run-migration-scripts.d.ts +17 -0
  279. package/dist/migrations/run-migration-scripts.d.ts.map +1 -0
  280. package/dist/migrations/run-migration-scripts.js +97 -0
  281. package/dist/migrations/run-migration-scripts.js.map +1 -0
  282. package/dist/mikro-orm-cli/bin.d.ts +14 -0
  283. package/dist/mikro-orm-cli/bin.d.ts.map +1 -0
  284. package/dist/mikro-orm-cli/bin.js +54 -0
  285. package/dist/mikro-orm-cli/bin.js.map +1 -0
  286. package/dist/modules-sdk/index.d.ts +2 -0
  287. package/dist/modules-sdk/index.d.ts.map +1 -0
  288. package/dist/modules-sdk/index.js +18 -0
  289. package/dist/modules-sdk/index.js.map +1 -0
  290. package/dist/orchestration/index.d.ts +2 -0
  291. package/dist/orchestration/index.d.ts.map +1 -0
  292. package/dist/orchestration/index.js +18 -0
  293. package/dist/orchestration/index.js.map +1 -0
  294. package/dist/policies/has-permission.d.ts +33 -0
  295. package/dist/policies/has-permission.d.ts.map +1 -0
  296. package/dist/policies/has-permission.js +110 -0
  297. package/dist/policies/has-permission.js.map +1 -0
  298. package/dist/policies/index.d.ts +3 -0
  299. package/dist/policies/index.d.ts.map +1 -0
  300. package/dist/policies/index.js +19 -0
  301. package/dist/policies/index.js.map +1 -0
  302. package/dist/policies/policy-loader.d.ts +6 -0
  303. package/dist/policies/policy-loader.d.ts.map +1 -0
  304. package/dist/policies/policy-loader.js +17 -0
  305. package/dist/policies/policy-loader.js.map +1 -0
  306. package/dist/subscribers/index.d.ts +3 -0
  307. package/dist/subscribers/index.d.ts.map +1 -0
  308. package/dist/subscribers/index.js +19 -0
  309. package/dist/subscribers/index.js.map +1 -0
  310. package/dist/subscribers/subscriber-loader.d.ts +20 -0
  311. package/dist/subscribers/subscriber-loader.d.ts.map +1 -0
  312. package/dist/subscribers/subscriber-loader.js +156 -0
  313. package/dist/subscribers/subscriber-loader.js.map +1 -0
  314. package/dist/subscribers/types.d.ts +15 -0
  315. package/dist/subscribers/types.d.ts.map +1 -0
  316. package/dist/subscribers/types.js +3 -0
  317. package/dist/subscribers/types.js.map +1 -0
  318. package/dist/telemetry/index.d.ts +50 -0
  319. package/dist/telemetry/index.d.ts.map +1 -0
  320. package/dist/telemetry/index.js +81 -0
  321. package/dist/telemetry/index.js.map +1 -0
  322. package/dist/types/container.d.ts +68 -0
  323. package/dist/types/container.d.ts.map +1 -0
  324. package/dist/types/container.js +3 -0
  325. package/dist/types/container.js.map +1 -0
  326. package/dist/types/index.d.ts +6 -0
  327. package/dist/types/index.d.ts.map +1 -0
  328. package/dist/types/index.js +19 -0
  329. package/dist/types/index.js.map +1 -0
  330. package/dist/utils/index.d.ts +5 -0
  331. package/dist/utils/index.d.ts.map +1 -0
  332. package/dist/utils/index.js +21 -0
  333. package/dist/utils/index.js.map +1 -0
  334. package/dist/utils/resource-loader.d.ts +28 -0
  335. package/dist/utils/resource-loader.d.ts.map +1 -0
  336. package/dist/utils/resource-loader.js +78 -0
  337. package/dist/utils/resource-loader.js.map +1 -0
  338. package/dist/workflows/index.d.ts +3 -0
  339. package/dist/workflows/index.d.ts.map +1 -0
  340. package/dist/workflows/index.js +19 -0
  341. package/dist/workflows/index.js.map +1 -0
  342. package/dist/workflows/workflow-loader.d.ts +13 -0
  343. package/dist/workflows/workflow-loader.d.ts.map +1 -0
  344. package/dist/workflows/workflow-loader.js +36 -0
  345. package/dist/workflows/workflow-loader.js.map +1 -0
  346. package/dist/workflows-sdk/composer.d.ts +2 -0
  347. package/dist/workflows-sdk/composer.d.ts.map +1 -0
  348. package/dist/workflows-sdk/composer.js +18 -0
  349. package/dist/workflows-sdk/composer.js.map +1 -0
  350. package/dist/workflows-sdk/index.d.ts +3 -0
  351. package/dist/workflows-sdk/index.d.ts.map +1 -0
  352. package/dist/workflows-sdk/index.js +19 -0
  353. package/dist/workflows-sdk/index.js.map +1 -0
  354. package/dist/zod/index.d.ts +2 -0
  355. package/dist/zod/index.d.ts.map +1 -0
  356. package/dist/zod/index.js +18 -0
  357. package/dist/zod/index.js.map +1 -0
  358. package/dist/zod/zod-helpers.d.ts +3 -0
  359. package/dist/zod/zod-helpers.d.ts.map +1 -0
  360. package/dist/zod/zod-helpers.js +95 -0
  361. package/dist/zod/zod-helpers.js.map +1 -0
  362. package/package.json +121 -0
@@ -0,0 +1,15 @@
1
+ import "../types/container";
2
+ export * from "./express-loader";
3
+ export * from "./router";
4
+ export * from "./types";
5
+ export * from "./middlewares";
6
+ export * from "./utils/http-compression";
7
+ export * from "./utils/validate-body";
8
+ export * from "./utils/validate-query";
9
+ export * from "./utils/get-query-config";
10
+ export * from "./utils/define-middlewares";
11
+ export * from "./utils/maybe-apply-link-filter";
12
+ export * from "./utils/refetch-entities";
13
+ export * from "./utils/unless-path";
14
+ export * from "./utils/restricted-fields";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAE3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ require("../types/container");
18
+ __exportStar(require("./express-loader"), exports);
19
+ __exportStar(require("./router"), exports);
20
+ __exportStar(require("./types"), exports);
21
+ __exportStar(require("./middlewares"), exports);
22
+ __exportStar(require("./utils/http-compression"), exports);
23
+ __exportStar(require("./utils/validate-body"), exports);
24
+ __exportStar(require("./utils/validate-query"), exports);
25
+ __exportStar(require("./utils/get-query-config"), exports);
26
+ __exportStar(require("./utils/define-middlewares"), exports);
27
+ __exportStar(require("./utils/maybe-apply-link-filter"), exports);
28
+ __exportStar(require("./utils/refetch-entities"), exports);
29
+ __exportStar(require("./utils/unless-path"), exports);
30
+ __exportStar(require("./utils/restricted-fields"), exports);
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8BAA2B;AAE3B,mDAAgC;AAChC,2CAAwB;AACxB,0CAAuB;AACvB,gDAA6B;AAC7B,2DAAwC;AACxC,wDAAqC;AACrC,yDAAsC;AACtC,2DAAwC;AACxC,6DAA0C;AAC1C,kEAA+C;AAC/C,2DAAwC;AACxC,sDAAmC;AACnC,4DAAyC"}
@@ -0,0 +1,33 @@
1
+ import { type AdditionalDataValidatorRoute, type BodyParserConfigRoute, type AcmeKitErrorHandlerFunction, type MiddlewareDescriptor } from "./types";
2
+ /**
3
+ * Exposes the API to scan a directory and load the `middleware.ts` file. This file contains
4
+ * the configuration for certain global middlewares and core routes validators. Also, it may
5
+ * contain custom middlewares.
6
+ */
7
+ export declare class MiddlewareFileLoader {
8
+ #private;
9
+ /**
10
+ * Scans a given directory for the "middleware.ts" or "middleware.js" files and
11
+ * imports them for reading the registered middleware and configuration for
12
+ * existing routes/middleware.
13
+ */
14
+ scanDir(sourceDir: string): Promise<void>;
15
+ /**
16
+ * Returns the globally registered error handler (if any)
17
+ */
18
+ getErrorHandler(): AcmeKitErrorHandlerFunction | undefined;
19
+ /**
20
+ * Returns a collection of registered middleware
21
+ */
22
+ getMiddlewares(): MiddlewareDescriptor[];
23
+ /**
24
+ * Returns routes that have bodyparser config on them
25
+ */
26
+ getBodyParserConfigRoutes(): BodyParserConfigRoute[];
27
+ /**
28
+ * Returns routes that have additional validator configured
29
+ * on them
30
+ */
31
+ getAdditionalDataValidatorRoutes(): AdditionalDataValidatorRoute[];
32
+ }
33
+ //# sourceMappingURL=middleware-file-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware-file-loader.d.ts","sourceRoot":"","sources":["../../src/http/middleware-file-loader.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAE1B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EAE1B,MAAM,SAAS,CAAA;AAOhB;;;;GAIG;AACH,qBAAa,oBAAoB;;IAgJ/B;;;;OAIG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM;IAa/B;;OAEG;IACH,eAAe;IAIf;;OAEG;IACH,cAAc;IAId;;OAEG;IACH,yBAAyB;IAIzB;;;OAGG;IACH,gCAAgC;CAGjC"}
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _MiddlewareFileLoader_instances, _MiddlewareFileLoader_errorHandler, _MiddlewareFileLoader_middleware, _MiddlewareFileLoader_additionalDataValidatorRoutes, _MiddlewareFileLoader_bodyParserConfigRoutes, _MiddlewareFileLoader_processMiddlewareFile;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.MiddlewareFileLoader = void 0;
16
+ const zod_1 = require("@acmekit/deps/zod");
17
+ const utils_1 = require("@acmekit/utils");
18
+ const path_1 = require("path");
19
+ const logger_1 = require("../logger");
20
+ const types_1 = require("./types");
21
+ /**
22
+ * File name that is used to indicate that the file is a middleware file
23
+ */
24
+ const MIDDLEWARE_FILE_NAME = "middlewares";
25
+ /**
26
+ * Exposes the API to scan a directory and load the `middleware.ts` file. This file contains
27
+ * the configuration for certain global middlewares and core routes validators. Also, it may
28
+ * contain custom middlewares.
29
+ */
30
+ class MiddlewareFileLoader {
31
+ constructor() {
32
+ _MiddlewareFileLoader_instances.add(this);
33
+ /**
34
+ * Global error handler exported from the middleware file loader
35
+ */
36
+ _MiddlewareFileLoader_errorHandler.set(this, void 0);
37
+ /**
38
+ * Middleware collected manually or by scanning directories
39
+ */
40
+ _MiddlewareFileLoader_middleware.set(this, []
41
+ /**
42
+ * Route matchers on which a custom additional data validator is
43
+ * defined
44
+ */
45
+ );
46
+ /**
47
+ * Route matchers on which a custom additional data validator is
48
+ * defined
49
+ */
50
+ _MiddlewareFileLoader_additionalDataValidatorRoutes.set(this, []
51
+ /**
52
+ * Route matchers on which a custom body parser config is used
53
+ */
54
+ );
55
+ /**
56
+ * Route matchers on which a custom body parser config is used
57
+ */
58
+ _MiddlewareFileLoader_bodyParserConfigRoutes.set(this, []
59
+ /**
60
+ * Processes the middleware file and returns the middleware and the
61
+ * routes config exported by it.
62
+ */
63
+ );
64
+ }
65
+ /**
66
+ * Scans a given directory for the "middleware.ts" or "middleware.js" files and
67
+ * imports them for reading the registered middleware and configuration for
68
+ * existing routes/middleware.
69
+ */
70
+ async scanDir(sourceDir) {
71
+ const fs = new utils_1.FileSystem(sourceDir);
72
+ if (await fs.exists(`${MIDDLEWARE_FILE_NAME}.ts`)) {
73
+ await __classPrivateFieldGet(this, _MiddlewareFileLoader_instances, "m", _MiddlewareFileLoader_processMiddlewareFile).call(this, (0, path_1.join)(sourceDir, `${MIDDLEWARE_FILE_NAME}.ts`));
74
+ }
75
+ else if (await fs.exists(`${MIDDLEWARE_FILE_NAME}.js`)) {
76
+ await __classPrivateFieldGet(this, _MiddlewareFileLoader_instances, "m", _MiddlewareFileLoader_processMiddlewareFile).call(this, (0, path_1.join)(sourceDir, `${MIDDLEWARE_FILE_NAME}.js`));
77
+ }
78
+ }
79
+ /**
80
+ * Returns the globally registered error handler (if any)
81
+ */
82
+ getErrorHandler() {
83
+ return __classPrivateFieldGet(this, _MiddlewareFileLoader_errorHandler, "f");
84
+ }
85
+ /**
86
+ * Returns a collection of registered middleware
87
+ */
88
+ getMiddlewares() {
89
+ return __classPrivateFieldGet(this, _MiddlewareFileLoader_middleware, "f");
90
+ }
91
+ /**
92
+ * Returns routes that have bodyparser config on them
93
+ */
94
+ getBodyParserConfigRoutes() {
95
+ return __classPrivateFieldGet(this, _MiddlewareFileLoader_bodyParserConfigRoutes, "f");
96
+ }
97
+ /**
98
+ * Returns routes that have additional validator configured
99
+ * on them
100
+ */
101
+ getAdditionalDataValidatorRoutes() {
102
+ return __classPrivateFieldGet(this, _MiddlewareFileLoader_additionalDataValidatorRoutes, "f");
103
+ }
104
+ }
105
+ exports.MiddlewareFileLoader = MiddlewareFileLoader;
106
+ _MiddlewareFileLoader_errorHandler = new WeakMap(), _MiddlewareFileLoader_middleware = new WeakMap(), _MiddlewareFileLoader_additionalDataValidatorRoutes = new WeakMap(), _MiddlewareFileLoader_bodyParserConfigRoutes = new WeakMap(), _MiddlewareFileLoader_instances = new WeakSet(), _MiddlewareFileLoader_processMiddlewareFile =
107
+ /**
108
+ * Processes the middleware file and returns the middleware and the
109
+ * routes config exported by it.
110
+ */
111
+ async function _MiddlewareFileLoader_processMiddlewareFile(absolutePath) {
112
+ const middlewareExports = await (0, utils_1.dynamicImport)(absolutePath);
113
+ if ((0, utils_1.isFileSkipped)(middlewareExports)) {
114
+ return;
115
+ }
116
+ const middlewareConfig = middlewareExports.default;
117
+ if (!middlewareConfig) {
118
+ logger_1.logger.warn(`No middleware configuration found in ${absolutePath}. Skipping middleware configuration.`);
119
+ return;
120
+ }
121
+ const routes = middlewareConfig.routes;
122
+ if (!routes || !Array.isArray(routes)) {
123
+ logger_1.logger.warn(`Invalid default export found in ${absolutePath}. Make sure to use "defineMiddlewares" function and export its output.`);
124
+ return;
125
+ }
126
+ const result = routes.reduce((result, route) => {
127
+ if (!route.matcher) {
128
+ throw new Error(`Middleware is missing a \`matcher\` field. The 'matcher' field is required when applying middleware. ${JSON.stringify(route, null, 2)}`);
129
+ }
130
+ const matcher = String(route.matcher);
131
+ if (route.bodyParser !== undefined) {
132
+ let methods = route.methods || [...types_1.HTTP_METHODS];
133
+ if (methods.includes("ALL")) {
134
+ methods = [...types_1.HTTP_METHODS];
135
+ }
136
+ logger_1.logger.debug(`using custom bodyparser config on matcher ${methods}:${route.matcher}`);
137
+ result.bodyParserConfigRoutes.push({
138
+ matcher: matcher,
139
+ methods,
140
+ config: route.bodyParser,
141
+ });
142
+ }
143
+ if (route.additionalDataValidator !== undefined) {
144
+ let methods = route.methods || [...types_1.HTTP_METHODS];
145
+ if (methods.includes("ALL")) {
146
+ methods = [...types_1.HTTP_METHODS];
147
+ }
148
+ logger_1.logger.debug(`assigning additionalData validator on matcher ${methods}:${route.matcher}`);
149
+ result.additionalDataValidatorRoutes.push({
150
+ matcher: matcher,
151
+ methods,
152
+ schema: route.additionalDataValidator,
153
+ validator: zod_1.z.object(route.additionalDataValidator).nullish(),
154
+ });
155
+ }
156
+ if (route.middlewares || route.policies) {
157
+ const middlewares = route.middlewares ?? [];
158
+ if (route.policies && !route.middlewares?.length) {
159
+ middlewares.push((_, __, next) => {
160
+ next();
161
+ });
162
+ }
163
+ middlewares.forEach((middleware) => {
164
+ result.middleware.push({
165
+ handler: middleware,
166
+ matcher: matcher,
167
+ methods: route.methods,
168
+ policies: route.policies,
169
+ });
170
+ });
171
+ }
172
+ return result;
173
+ }, {
174
+ bodyParserConfigRoutes: [],
175
+ additionalDataValidatorRoutes: [],
176
+ middleware: [],
177
+ });
178
+ const errorHandler = middlewareConfig.errorHandler;
179
+ if (errorHandler) {
180
+ __classPrivateFieldSet(this, _MiddlewareFileLoader_errorHandler, errorHandler, "f");
181
+ }
182
+ __classPrivateFieldSet(this, _MiddlewareFileLoader_middleware, __classPrivateFieldGet(this, _MiddlewareFileLoader_middleware, "f").concat(result.middleware), "f");
183
+ __classPrivateFieldSet(this, _MiddlewareFileLoader_bodyParserConfigRoutes, __classPrivateFieldGet(this, _MiddlewareFileLoader_bodyParserConfigRoutes, "f").concat(result.bodyParserConfigRoutes), "f");
184
+ __classPrivateFieldSet(this, _MiddlewareFileLoader_additionalDataValidatorRoutes, __classPrivateFieldGet(this, _MiddlewareFileLoader_additionalDataValidatorRoutes, "f").concat(result.additionalDataValidatorRoutes), "f");
185
+ };
186
+ //# sourceMappingURL=middleware-file-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware-file-loader.js","sourceRoot":"","sources":["../../src/http/middleware-file-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAqC;AACrC,0CAAyE;AACzE,+BAA2B;AAE3B,sCAAkC;AAClC,mCAOgB;AAEhB;;GAEG;AACH,MAAM,oBAAoB,GAAG,aAAa,CAAA;AAE1C;;;;GAIG;AACH,MAAa,oBAAoB;IAAjC;;QACE;;WAEG;QACH,qDAA2C;QAE3C;;WAEG;QACH,2CAAsC,EAAE;QAExC;;;WAGG;UALqC;QAExC;;;WAGG;QACH,8DAAiE,EAAE;QAEnE;;WAEG;UAJgE;QAEnE;;WAEG;QACH,uDAAmD,EAAE;QAErD;;;WAGG;UALkD;IA0KvD,CAAC;IA9CC;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,SAAiB;QAC7B,MAAM,EAAE,GAAG,IAAI,kBAAU,CAAC,SAAS,CAAC,CAAA;QACpC,IAAI,MAAM,EAAE,CAAC,MAAM,CAAC,GAAG,oBAAoB,KAAK,CAAC,EAAE,CAAC;YAClD,MAAM,uBAAA,IAAI,oFA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wB,CAAC,MAAM,CAChE,MAAM,CAAC,sBAAsB,CAC9B,MAAA,CAAA;IACD,uBAAA,IAAI,uDACF,uBAAA,IAAI,2DAA+B,CAAC,MAAM,CACxC,MAAM,CAAC,6BAA6B,CACrC,MAAA,CAAA;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AcmeKitNextFunction, AcmeKitRequest, AcmeKitResponse } from "../types";
2
+ export declare function applyDefaultFilters<TFilter extends object>(filtersToApply: TFilter): (req: AcmeKitRequest, _: AcmeKitResponse, next: AcmeKitNextFunction) => Promise<void>;
3
+ //# sourceMappingURL=apply-default-filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-default-filters.d.ts","sourceRoot":"","sources":["../../../src/http/middlewares/apply-default-filters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,eAAe,EAChB,MAAM,UAAU,CAAA;AAEjB,wBAAgB,mBAAmB,CAAC,OAAO,SAAS,MAAM,EACxD,cAAc,EAAE,OAAO,IAGrB,KAAK,cAAc,EACnB,GAAG,eAAe,EAClB,MAAM,mBAAmB,mBA4B5B"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyDefaultFilters = applyDefaultFilters;
4
+ const utils_1 = require("@acmekit/utils");
5
+ function applyDefaultFilters(filtersToApply) {
6
+ return async function defaultFiltersMiddleware(req, _, next) {
7
+ for (const [filter, filterValue] of Object.entries(filtersToApply)) {
8
+ let valueToApply = filterValue;
9
+ // If certain manipulations need to be done on a middleware level, we can provide a simple
10
+ // function that mutates the data based on any custom requirement
11
+ if (typeof filterValue === "function") {
12
+ // pass the actual filterable fields so that the function can mutate the original object.
13
+ // Currently we only need it to delete filter keys from the request filter object, but this could
14
+ // be used for other purposes. If we can't find other purposes, we can refactor to accept an array
15
+ // of strings to delete after filters have been applied.
16
+ valueToApply = filterValue(req.filterableFields, req.queryConfig.fields);
17
+ }
18
+ // If the value to apply is an object, we add it to any existing filters thats already applied
19
+ if ((0, utils_1.isObject)(valueToApply)) {
20
+ req.filterableFields[filter] = {
21
+ ...(req.filterableFields[filter] || {}),
22
+ ...valueToApply,
23
+ };
24
+ }
25
+ else if ((0, utils_1.isPresent)(valueToApply)) {
26
+ req.filterableFields[filter] = valueToApply;
27
+ }
28
+ }
29
+ return next();
30
+ };
31
+ }
32
+ //# sourceMappingURL=apply-default-filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-default-filters.js","sourceRoot":"","sources":["../../../src/http/middlewares/apply-default-filters.ts"],"names":[],"mappings":";;AAOA,kDAkCC;AAzCD,0CAAoD;AAOpD,SAAgB,mBAAmB,CACjC,cAAuB;IAEvB,OAAO,KAAK,UAAU,wBAAwB,CAC5C,GAAmB,EACnB,CAAkB,EAClB,IAAyB;QAEzB,KAAK,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;YACnE,IAAI,YAAY,GAAG,WAAW,CAAA;YAE9B,0FAA0F;YAC1F,iEAAiE;YACjE,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,CAAC;gBACtC,yFAAyF;gBACzF,iGAAiG;gBACjG,kGAAkG;gBAClG,wDAAwD;gBACxD,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,gBAAgB,EAAE,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;YAC1E,CAAC;YAED,8FAA8F;YAC9F,IAAI,IAAA,gBAAQ,EAAC,YAAY,CAAC,EAAE,CAAC;gBAC3B,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG;oBAC7B,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;oBACvC,GAAG,YAAY;iBAChB,CAAA;YACH,CAAC;iBAAM,IAAI,IAAA,iBAAS,EAAC,YAAY,CAAC,EAAE,CAAC;gBACnC,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,YAAY,CAAA;YAC7C,CAAC;QACH,CAAC;QAED,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { AcmeKitNextFunction, AcmeKitRequest, AcmeKitResponse } from "../types";
2
+ /**
3
+ * Middleware that resolves the locale for the current request.
4
+ *
5
+ * Resolution order:
6
+ * 1. Query parameter `?locale=en-US`
7
+ * 2. x-acmekit-locale header
8
+ *
9
+ * The resolved locale is set on `req.locale`.
10
+ */
11
+ export declare function applyLocale(req: AcmeKitRequest, _: AcmeKitResponse, next: AcmeKitNextFunction): Promise<void>;
12
+ //# sourceMappingURL=apply-locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-locale.d.ts","sourceRoot":"","sources":["../../../src/http/middlewares/apply-locale.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,eAAe,EAChB,MAAM,UAAU,CAAA;AAIjB;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,cAAc,EACnB,CAAC,EAAE,eAAe,EAClB,IAAI,EAAE,mBAAmB,iBAkB1B"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyLocale = applyLocale;
4
+ const utils_1 = require("@acmekit/utils");
5
+ const CONTENT_LANGUAGE_HEADER = "x-acmekit-locale";
6
+ /**
7
+ * Middleware that resolves the locale for the current request.
8
+ *
9
+ * Resolution order:
10
+ * 1. Query parameter `?locale=en-US`
11
+ * 2. x-acmekit-locale header
12
+ *
13
+ * The resolved locale is set on `req.locale`.
14
+ */
15
+ async function applyLocale(req, _, next) {
16
+ // 1. Check query parameter
17
+ const queryLocale = req.query.locale;
18
+ if (queryLocale) {
19
+ req.locale = (0, utils_1.normalizeLocale)(queryLocale);
20
+ delete req.query.locale;
21
+ return next();
22
+ }
23
+ // 2. Check x-acmekit-locale header
24
+ const headerLocale = req.get(CONTENT_LANGUAGE_HEADER);
25
+ if (headerLocale) {
26
+ req.locale = (0, utils_1.normalizeLocale)(headerLocale);
27
+ return next();
28
+ }
29
+ return next();
30
+ }
31
+ //# sourceMappingURL=apply-locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-locale.js","sourceRoot":"","sources":["../../../src/http/middlewares/apply-locale.ts"],"names":[],"mappings":";;AAkBA,kCAqBC;AAvCD,0CAAgD;AAOhD,MAAM,uBAAuB,GAAG,kBAAkB,CAAA;AAElD;;;;;;;;GAQG;AACI,KAAK,UAAU,WAAW,CAC/B,GAAmB,EACnB,CAAkB,EAClB,IAAyB;IAEzB,2BAA2B;IAC3B,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,MAA4B,CAAA;IAC1D,IAAI,WAAW,EAAE,CAAC;QAChB,GAAG,CAAC,MAAM,GAAG,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAA;QACzC,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,CAAA;QACvB,OAAO,IAAI,EAAE,CAAA;IACf,CAAC;IAED,mCAAmC;IACnC,MAAM,YAAY,GAAG,GAAG,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IACrD,IAAI,YAAY,EAAE,CAAC;QACjB,GAAG,CAAC,MAAM,GAAG,IAAA,uBAAe,EAAC,YAAY,CAAC,CAAA;QAC1C,OAAO,IAAI,EAAE,CAAA;IACf,CAAC;IAED,OAAO,IAAI,EAAE,CAAA;AACf,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { AcmeKitNextFunction, AcmeKitRequest, AcmeKitResponse } from "../types";
2
+ export declare function applyParamsAsFilters(mappings: {
3
+ [param: string]: string;
4
+ }): (req: AcmeKitRequest, _: AcmeKitResponse, next: AcmeKitNextFunction) => Promise<void>;
5
+ //# sourceMappingURL=apply-params-as-filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-params-as-filters.d.ts","sourceRoot":"","sources":["../../../src/http/middlewares/apply-params-as-filters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,eAAe,EAChB,MAAM,UAAU,CAAA;AAEjB,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,IAEtE,KAAK,cAAc,EACnB,GAAG,eAAe,EAClB,MAAM,mBAAmB,mBAU5B"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyParamsAsFilters = applyParamsAsFilters;
4
+ function applyParamsAsFilters(mappings) {
5
+ return async function paramsAsFiltersMiddleware(req, _, next) {
6
+ for (const [param, paramValue] of Object.entries(req.params)) {
7
+ if (mappings[param]) {
8
+ req.filterableFields[mappings[param]] = paramValue;
9
+ }
10
+ }
11
+ return next();
12
+ };
13
+ }
14
+ //# sourceMappingURL=apply-params-as-filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-params-as-filters.js","sourceRoot":"","sources":["../../../src/http/middlewares/apply-params-as-filters.ts"],"names":[],"mappings":";;AAMA,oDAcC;AAdD,SAAgB,oBAAoB,CAAC,QAAqC;IACxE,OAAO,KAAK,UAAU,yBAAyB,CAC7C,GAAmB,EACnB,CAAkB,EAClB,IAAyB;QAEzB,KAAK,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7D,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpB,GAAG,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,CAAA;YACpD,CAAC;QACH,CAAC;QAED,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { RequestHandler } from "express";
2
+ import type { Secret, SignOptions, VerifyOptions } from "jsonwebtoken";
3
+ import { AuthContext } from "../types";
4
+ declare const SESSION_AUTH = "session";
5
+ declare const BEARER_AUTH = "bearer";
6
+ declare const API_KEY_AUTH = "api-key";
7
+ export type AuthType = typeof SESSION_AUTH | typeof BEARER_AUTH | typeof API_KEY_AUTH;
8
+ export declare const authenticate: (actorType: string | string[], authType: AuthType | AuthType[], options?: {
9
+ allowUnauthenticated?: boolean;
10
+ allowUnregistered?: boolean;
11
+ }) => RequestHandler;
12
+ export declare const getAuthContextFromJwtToken: (authHeader: string | undefined, jwtSecret: Secret, authTypes: AuthType[], actorTypes: string[], jwtPublicKey?: Secret, jwtOptions?: VerifyOptions | SignOptions) => AuthContext | null;
13
+ export {};
14
+ //# sourceMappingURL=authenticate-middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticate-middleware.d.ts","sourceRoot":"","sources":["../../../src/http/middlewares/authenticate-middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,KAAK,EAEV,MAAM,EACN,WAAW,EACX,aAAa,EACd,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,WAAW,EAIZ,MAAM,UAAU,CAAA;AAEjB,QAAA,MAAM,YAAY,YAAY,CAAA;AAC9B,QAAA,MAAM,WAAW,WAAW,CAAA;AAC5B,QAAA,MAAM,YAAY,YAAY,CAAA;AAK9B,MAAM,MAAM,QAAQ,GAChB,OAAO,YAAY,GACnB,OAAO,WAAW,GAClB,OAAO,YAAY,CAAA;AAMvB,eAAO,MAAM,YAAY,GACvB,WAAW,MAAM,GAAG,MAAM,EAAE,EAC5B,UAAU,QAAQ,GAAG,QAAQ,EAAE,EAC/B,UAAS;IAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAO,KAC5E,cA+EF,CAAA;AAgED,eAAO,MAAM,0BAA0B,GACrC,YAAY,MAAM,GAAG,SAAS,EAC9B,WAAW,MAAM,EACjB,WAAW,QAAQ,EAAE,EACrB,YAAY,MAAM,EAAE,EACpB,eAAe,MAAM,EACrB,aAAa,aAAa,GAAG,WAAW,KACvC,WAAW,GAAG,IA0ChB,CAAA"}
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAuthContextFromJwtToken = exports.authenticate = void 0;
4
+ const utils_1 = require("@acmekit/utils");
5
+ const jsonwebtoken_1 = require("jsonwebtoken");
6
+ const SESSION_AUTH = "session";
7
+ const BEARER_AUTH = "bearer";
8
+ const API_KEY_AUTH = "api-key";
9
+ // This is the only hard-coded actor type, as API keys have special handling for now. We could also generalize API keys to carry the actor type with them.
10
+ const ADMIN_ACTOR_TYPE = "user";
11
+ const authenticate = (actorType, authType, options = {}) => {
12
+ const authenticateMiddleware = async (req, res, next) => {
13
+ const authTypes = Array.isArray(authType) ? authType : [authType];
14
+ const actorTypes = Array.isArray(actorType) ? actorType : [actorType];
15
+ const req_ = req;
16
+ // We only allow authenticating using a secret API key on the admin
17
+ const isExclusivelyUser = actorTypes.length === 1 && actorTypes[0] === ADMIN_ACTOR_TYPE;
18
+ if (authTypes.includes(API_KEY_AUTH) && isExclusivelyUser) {
19
+ const apiKey = await getApiKeyInfo(req);
20
+ if (apiKey) {
21
+ req_.auth_context = {
22
+ actor_id: apiKey.id,
23
+ actor_type: "api-key",
24
+ auth_identity_id: "",
25
+ app_metadata: {},
26
+ user_metadata: {},
27
+ };
28
+ return next();
29
+ }
30
+ }
31
+ // We try to extract the auth context either from the session or from a JWT token
32
+ let authContext = getAuthContextFromSession(req.session, authTypes, actorTypes);
33
+ if (!authContext) {
34
+ const { projectConfig: { http }, } = req.scope.resolve(utils_1.ContainerRegistrationKeys.CONFIG_MODULE);
35
+ authContext = (0, exports.getAuthContextFromJwtToken)(req.headers.authorization, http.jwtSecret, authTypes, actorTypes, http.jwtPublicKey, http.jwtVerifyOptions ?? http.jwtOptions);
36
+ }
37
+ // If the entity is authenticated, and it is a registered actor we can continue
38
+ if (authContext?.actor_id) {
39
+ req_.auth_context = authContext;
40
+ return next();
41
+ }
42
+ // If the entity is authenticated, but there is no registered actor yet, we can continue (eg. in the case of a user invite) if allow unregistered is set
43
+ // We also don't want to allow creating eg. a customer with a token created for a `user` provider.
44
+ if (authContext?.auth_identity_id &&
45
+ options.allowUnregistered &&
46
+ isActorTypePermitted(actorTypes, authContext.actor_type)) {
47
+ req_.auth_context = authContext;
48
+ return next();
49
+ }
50
+ // If we allow unauthenticated requests (i.e public endpoints), just continue
51
+ if (options.allowUnauthenticated) {
52
+ return next();
53
+ }
54
+ res.status(401).json({ message: "Unauthorized" });
55
+ };
56
+ return authenticateMiddleware;
57
+ };
58
+ exports.authenticate = authenticate;
59
+ const getApiKeyInfo = async (req) => {
60
+ const authHeader = req.headers.authorization;
61
+ if (!authHeader) {
62
+ return null;
63
+ }
64
+ const [tokenType, token] = authHeader.split(" ");
65
+ if (tokenType.toLowerCase() !== "basic" || !token) {
66
+ return null;
67
+ }
68
+ // The token could have been base64 encoded, we want to decode it first.
69
+ let normalizedToken = token;
70
+ if (!token.startsWith("sk_")) {
71
+ normalizedToken = Buffer.from(token, "base64").toString("utf-8");
72
+ }
73
+ // Basic auth is defined as a username:password set, and since the token is set to the username we need to trim the colon
74
+ if (normalizedToken.endsWith(":")) {
75
+ normalizedToken = normalizedToken.slice(0, -1);
76
+ }
77
+ // Secret tokens start with 'sk_', and if it doesn't it could be a user JWT or a malformed token
78
+ if (!normalizedToken.startsWith("sk_")) {
79
+ return null;
80
+ }
81
+ const apiKeyModule = req.scope.resolve(utils_1.Modules.API_KEY);
82
+ try {
83
+ const apiKey = await apiKeyModule.authenticate(normalizedToken);
84
+ if (!apiKey) {
85
+ return null;
86
+ }
87
+ return apiKey;
88
+ }
89
+ catch (error) {
90
+ console.error(error);
91
+ return null;
92
+ }
93
+ };
94
+ const getAuthContextFromSession = (session = {}, authTypes, actorTypes) => {
95
+ if (!authTypes.includes(SESSION_AUTH)) {
96
+ return null;
97
+ }
98
+ if (session.auth_context &&
99
+ isActorTypePermitted(actorTypes, session.auth_context?.actor_type)) {
100
+ return session.auth_context;
101
+ }
102
+ return null;
103
+ };
104
+ const getAuthContextFromJwtToken = (authHeader, jwtSecret, authTypes, actorTypes, jwtPublicKey, jwtOptions) => {
105
+ if (!authTypes.includes(BEARER_AUTH)) {
106
+ return null;
107
+ }
108
+ if (!authHeader) {
109
+ return null;
110
+ }
111
+ const re = /(\S+)\s+(\S+)/;
112
+ const matches = authHeader.match(re);
113
+ // TODO: figure out how to obtain token (and store correct data in token)
114
+ if (matches) {
115
+ const tokenType = matches[1];
116
+ const token = matches[2];
117
+ if (tokenType.toLowerCase() === BEARER_AUTH) {
118
+ // get config jwt secret
119
+ // verify token and set authUser
120
+ try {
121
+ const options = { ...jwtOptions };
122
+ if (!options.algorithms && options.algorithm) {
123
+ options.algorithms = [options.algorithm];
124
+ delete options.algorithm;
125
+ }
126
+ const verified = (0, jsonwebtoken_1.verify)(token, jwtPublicKey ?? jwtSecret, options);
127
+ if (isActorTypePermitted(actorTypes, verified.actor_type)) {
128
+ return verified;
129
+ }
130
+ }
131
+ catch (err) {
132
+ return null;
133
+ }
134
+ }
135
+ }
136
+ return null;
137
+ };
138
+ exports.getAuthContextFromJwtToken = getAuthContextFromJwtToken;
139
+ const isActorTypePermitted = (actorTypes, currentActorType) => {
140
+ return actorTypes.includes("*") || actorTypes.includes(currentActorType);
141
+ };
142
+ //# sourceMappingURL=authenticate-middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticate-middleware.js","sourceRoot":"","sources":["../../../src/http/middlewares/authenticate-middleware.ts"],"names":[],"mappings":";;;AACA,0CAAmE;AAQnE,+CAAqC;AASrC,MAAM,YAAY,GAAG,SAAS,CAAA;AAC9B,MAAM,WAAW,GAAG,QAAQ,CAAA;AAC5B,M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AAA;gBACf,IAAI,oBAAoB,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC1D,OAAO,QAAuB,CAAA;gBAChC,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,IAAI,CAAA;YACb,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAjDY,QAAA,0BAA0B,8BAiDtC;AAED,MAAM,oBAAoB,GAAG,CAC3B,UAA6B,EAC7B,gBAAwB,EACxB,EAAE;IACF,OAAO,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;AAC1E,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { RequestHandler } from "express";
2
+ import type { MiddlewareFunction, BodyParserConfigRoute } from "../types";
3
+ import type { RoutesFinder } from "../routes-finder";
4
+ /**
5
+ * Creates the bodyparser middlewares stack that creates custom bodyparsers
6
+ * during an HTTP request based upon the defined config. The bodyparser
7
+ * instances are cached for re-use.
8
+ */
9
+ export declare function createBodyParserMiddlewaresStack(route: string, routesFinder: RoutesFinder<BodyParserConfigRoute>, tracer?: (handler: RequestHandler | MiddlewareFunction, route: {
10
+ route: string;
11
+ method?: string;
12
+ }) => RequestHandler | MiddlewareFunction): RequestHandler[];
13
+ //# sourceMappingURL=bodyparser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bodyparser.d.ts","sourceRoot":"","sources":["../../../src/http/middlewares/bodyparser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,cAAc,EAAoB,MAAM,SAAS,CAAA;AAE9E,OAAO,KAAK,EAKV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AA+BpD;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,YAAY,CAAC,qBAAqB,CAAC,EACjD,MAAM,CAAC,EAAE,CACP,OAAO,EAAE,cAAc,GAAG,kBAAkB,EAC5C,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KACtC,cAAc,GAAG,kBAAkB,GACvC,cAAc,EAAE,CAwClB"}