raiton 6.8.9-beta.25 → 6.11.0-beta.29

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 (439) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +65 -1
  3. package/benchmarks/README.md +31 -0
  4. package/benchmarks/ai-debug.json +145 -0
  5. package/benchmarks/ai-debug.md +64 -0
  6. package/benchmarks/latest.json +172 -0
  7. package/benchmarks/latest.md +66 -0
  8. package/build/bin/index.mjs +37621 -21866
  9. package/build/types/bin/bootstrapper.d.ts +2 -0
  10. package/build/types/bin/cli-output.d.ts +46 -0
  11. package/build/types/bin/cli-tools.d.ts +13 -0
  12. package/build/types/bin/cli.d.ts +3 -0
  13. package/build/types/bin/commands.registry.d.ts +4 -0
  14. package/build/types/bin/constants.d.ts +3 -0
  15. package/build/types/bin/file-utils.d.ts +21 -0
  16. package/build/types/bin/index.d.ts +2 -0
  17. package/build/types/bin/name-utils.d.ts +4 -0
  18. package/build/types/bin/project-utils.d.ts +12 -0
  19. package/build/types/commands/artifact.command.d.ts +7 -0
  20. package/build/types/commands/build.command.d.ts +8 -0
  21. package/build/types/commands/call.command.d.ts +10 -0
  22. package/build/types/commands/client.command.d.ts +7 -0
  23. package/build/types/commands/contract.command.d.ts +8 -0
  24. package/build/types/commands/debug.shared.d.ts +16 -0
  25. package/build/types/commands/develop.command.d.ts +9 -0
  26. package/build/types/commands/docs.command.d.ts +8 -0
  27. package/build/types/commands/doctor.command.d.ts +9 -0
  28. package/build/types/commands/explain.command.d.ts +8 -0
  29. package/build/types/commands/generate.command.d.ts +7 -0
  30. package/build/types/commands/inspect.command.d.ts +7 -0
  31. package/build/types/commands/mcp.command.d.ts +12 -0
  32. package/build/types/commands/new.command.d.ts +7 -0
  33. package/build/types/commands/openapi.command.d.ts +7 -0
  34. package/build/types/commands/requests.command.d.ts +8 -0
  35. package/build/types/commands/routes.command.d.ts +7 -0
  36. package/build/types/commands/start.command.d.ts +9 -0
  37. package/build/types/commands/verify.command.d.ts +8 -0
  38. package/build/types/commands/why.command.d.ts +7 -0
  39. package/build/types/contracts/decorators.d.ts +59 -0
  40. package/build/types/contracts/errors.d.ts +68 -0
  41. package/build/types/contracts/index.d.ts +4 -0
  42. package/build/types/contracts/schema.d.ts +83 -0
  43. package/build/types/contracts/typebox.d.ts +81 -0
  44. package/build/types/core/application.d.ts +45 -0
  45. package/build/types/core/artifacts/artifact.d.ts +3 -0
  46. package/build/types/core/artifacts/index.d.ts +1 -0
  47. package/build/types/core/artifacts/runner.d.ts +1 -0
  48. package/build/types/core/builder.d.ts +42 -0
  49. package/build/types/core/bytes.util.d.ts +3 -0
  50. package/build/types/core/command.d.ts +13 -0
  51. package/build/types/core/commands.d.ts +10 -0
  52. package/build/types/core/config/config.d.ts +27 -0
  53. package/build/types/core/config/define.d.ts +8 -0
  54. package/build/types/core/config/index.d.ts +3 -0
  55. package/build/types/core/config/schema.d.ts +24 -0
  56. package/build/types/core/context.d.ts +11 -0
  57. package/build/types/core/controller/builder.d.ts +26 -0
  58. package/build/types/core/controller/compiler.d.ts +2 -0
  59. package/build/types/core/controller/index.d.ts +4 -0
  60. package/build/types/core/controller/metadata.d.ts +3 -0
  61. package/build/types/core/controller/tracker.d.ts +9 -0
  62. package/build/types/core/directories.d.ts +10 -0
  63. package/build/types/core/guards.d.ts +11 -0
  64. package/build/types/core/helpers/index.d.ts +1 -0
  65. package/build/types/core/helpers/raiton.d.ts +1 -0
  66. package/build/types/core/hooks.d.ts +14 -0
  67. package/build/types/core/index.d.ts +17 -0
  68. package/build/types/core/injection/index.d.ts +1 -0
  69. package/build/types/core/injection/injection.d.ts +37 -0
  70. package/build/types/core/mcp/builder.d.ts +2 -0
  71. package/build/types/core/mcp/index.d.ts +3 -0
  72. package/build/types/core/mcp/metadata.d.ts +9 -0
  73. package/build/types/core/mcp/tracker.d.ts +9 -0
  74. package/build/types/core/middleware/compose.d.ts +8 -0
  75. package/build/types/core/middleware/index.d.ts +2 -0
  76. package/build/types/core/middleware/pipeline.d.ts +12 -0
  77. package/build/types/core/plugins/index.d.ts +2 -0
  78. package/build/types/core/plugins/plugin.d.ts +2 -0
  79. package/build/types/core/plugins/scope.d.ts +15 -0
  80. package/build/types/core/process.util.d.ts +1 -0
  81. package/build/types/core/raiton.d.ts +15 -0
  82. package/build/types/core/router/handler.d.ts +2 -0
  83. package/build/types/core/router/handler.utils.d.ts +37 -0
  84. package/build/types/core/router/index.d.ts +4 -0
  85. package/build/types/core/router/matcher.d.ts +50 -0
  86. package/build/types/core/router/route.d.ts +52 -0
  87. package/build/types/core/router/router.d.ts +23 -0
  88. package/build/types/core/scheduler/builder.d.ts +2 -0
  89. package/build/types/core/scheduler/cron.d.ts +32 -0
  90. package/build/types/core/scheduler/duration.d.ts +7 -0
  91. package/build/types/core/scheduler/index.d.ts +6 -0
  92. package/build/types/core/scheduler/manager.d.ts +47 -0
  93. package/build/types/core/scheduler/metadata.d.ts +8 -0
  94. package/build/types/core/scheduler/queue/backend.d.ts +42 -0
  95. package/build/types/core/scheduler/queue/index.d.ts +3 -0
  96. package/build/types/core/scheduler/queue/rabbitmq.backend.d.ts +37 -0
  97. package/build/types/core/scheduler/queue/redis.backend.d.ts +38 -0
  98. package/build/types/core/server.d.ts +9 -0
  99. package/build/types/core/socket/builder.d.ts +1 -0
  100. package/build/types/core/socket/index.d.ts +2 -0
  101. package/build/types/core/socket/metadata.d.ts +14 -0
  102. package/build/types/core/thread.d.ts +21 -0
  103. package/build/types/debug/cli.d.ts +33 -0
  104. package/build/types/debug/collector.d.ts +41 -0
  105. package/build/types/debug/collector.internal.d.ts +27 -0
  106. package/build/types/debug/config.d.ts +19 -0
  107. package/build/types/debug/examples.d.ts +43 -0
  108. package/build/types/debug/explain.d.ts +9 -0
  109. package/build/types/debug/index.d.ts +15 -0
  110. package/build/types/debug/invocation.d.ts +53 -0
  111. package/build/types/debug/journal.d.ts +49 -0
  112. package/build/types/debug/mcp-http.d.ts +17 -0
  113. package/build/types/debug/mcp.d.ts +14 -0
  114. package/build/types/debug/redaction.d.ts +48 -0
  115. package/build/types/debug/requests.d.ts +37 -0
  116. package/build/types/debug/runtime.d.ts +52 -0
  117. package/build/types/debug/session.d.ts +21 -0
  118. package/build/types/debug/source.d.ts +17 -0
  119. package/build/types/debug/surface.d.ts +10 -0
  120. package/build/types/debug/types.d.ts +271 -0
  121. package/build/types/debug/verify.d.ts +23 -0
  122. package/build/types/framework/artifacts.d.ts +20 -0
  123. package/build/types/framework/cache/cache.d.ts +84 -0
  124. package/build/types/framework/cache/cache.decorator.d.ts +21 -0
  125. package/build/types/framework/cache/etag.d.ts +62 -0
  126. package/build/types/framework/cache/index.d.ts +4 -0
  127. package/build/types/framework/cache/types.d.ts +89 -0
  128. package/build/types/framework/constants/decorators.constant.d.ts +28 -0
  129. package/build/types/framework/constants/index.d.ts +2 -0
  130. package/build/types/framework/constants/microservices.constant.d.ts +3 -0
  131. package/build/types/framework/controllers.d.ts +2 -0
  132. package/build/types/framework/data-transfer-object.d.ts +5 -0
  133. package/build/types/framework/decorators/access-guard.decorator.d.ts +1 -0
  134. package/build/types/framework/decorators/api-response.decorator.d.ts +66 -0
  135. package/build/types/framework/decorators/api.decorator.d.ts +160 -0
  136. package/build/types/framework/decorators/controllable.decorator.d.ts +3 -0
  137. package/build/types/framework/decorators/csrf-guard.decorator.d.ts +2 -0
  138. package/build/types/framework/decorators/csrf-token.decorator.d.ts +1 -0
  139. package/build/types/framework/decorators/guard.decorator.d.ts +2 -0
  140. package/build/types/framework/decorators/health-check.decorator.d.ts +17 -0
  141. package/build/types/framework/decorators/index.d.ts +15 -0
  142. package/build/types/framework/decorators/injection.decorator.d.ts +5 -0
  143. package/build/types/framework/decorators/mcp.decorator.d.ts +68 -0
  144. package/build/types/framework/decorators/middleware.decorator.d.ts +3 -0
  145. package/build/types/framework/decorators/parametrable.decorator.d.ts +9 -0
  146. package/build/types/framework/decorators/routable.decorator.d.ts +12 -0
  147. package/build/types/framework/decorators/route-interaction.decorator.d.ts +81 -0
  148. package/build/types/framework/decorators/scheduler.decorator.d.ts +54 -0
  149. package/build/types/framework/decorators/socket.decorator.d.ts +5 -0
  150. package/build/types/framework/encryption.d.ts +25 -0
  151. package/build/types/framework/enums/csrf.enum.d.ts +4 -0
  152. package/build/types/framework/enums/encrypted.enum.d.ts +20 -0
  153. package/build/types/framework/enums/event.message.enum.d.ts +4 -0
  154. package/build/types/framework/enums/http-method.enum.d.ts +10 -0
  155. package/build/types/framework/enums/http-parameters.enum.d.ts +11 -0
  156. package/build/types/framework/enums/http-status.enum.d.ts +64 -0
  157. package/build/types/framework/enums/index.d.ts +9 -0
  158. package/build/types/framework/enums/runtime.enum.d.ts +5 -0
  159. package/build/types/framework/enums/scheduler.enum.d.ts +21 -0
  160. package/build/types/framework/enums/timestamp.enum.d.ts +6 -0
  161. package/build/types/framework/env.d.ts +3 -0
  162. package/build/types/framework/errors/catalog.d.ts +57 -0
  163. package/build/types/framework/exceptions/http-exception.d.ts +18 -0
  164. package/build/types/framework/exceptions/index.d.ts +2 -0
  165. package/build/types/framework/exceptions/throwable.d.ts +76 -0
  166. package/build/types/framework/health-check.d.ts +42 -0
  167. package/build/types/framework/index.d.ts +20 -0
  168. package/build/types/framework/mcp/audit.d.ts +12 -0
  169. package/build/types/framework/mcp/conformance.d.ts +31 -0
  170. package/build/types/framework/mcp/handler.d.ts +11 -0
  171. package/build/types/framework/mcp/index.d.ts +5 -0
  172. package/build/types/framework/mcp/protocol.d.ts +17 -0
  173. package/build/types/framework/mcp/rate-limit.d.ts +10 -0
  174. package/build/types/framework/mcp/stdio.d.ts +40 -0
  175. package/build/types/framework/mcp/streamable-http.d.ts +17 -0
  176. package/build/types/framework/observability/index.d.ts +6 -0
  177. package/build/types/framework/observability/metrics.d.ts +23 -0
  178. package/build/types/framework/observability/plugin.d.ts +20 -0
  179. package/build/types/framework/observability/readiness.d.ts +9 -0
  180. package/build/types/framework/observability/request.d.ts +7 -0
  181. package/build/types/framework/observability/shutdown.d.ts +21 -0
  182. package/build/types/framework/observability/trace.d.ts +96 -0
  183. package/build/types/framework/parameter-bag.d.ts +14 -0
  184. package/build/types/framework/plugins/body-parser.plugin.d.ts +3 -0
  185. package/build/types/framework/plugins/dev.plugin.d.ts +12 -0
  186. package/build/types/framework/plugins/index.d.ts +5 -0
  187. package/build/types/framework/plugins/mcp.plugin.d.ts +15 -0
  188. package/build/types/framework/plugins/openapi.plugin.d.ts +58 -0
  189. package/build/types/framework/plugins/security/body-limit.d.ts +1 -0
  190. package/build/types/framework/plugins/security/cors.d.ts +10 -0
  191. package/build/types/framework/plugins/security/csrf.d.ts +2 -0
  192. package/build/types/framework/plugins/security/headers.d.ts +1 -0
  193. package/build/types/framework/plugins/security/index.d.ts +13 -0
  194. package/build/types/framework/plugins/security/method-guard.d.ts +1 -0
  195. package/build/types/framework/plugins/security/rate-limit.d.ts +5 -0
  196. package/build/types/framework/repositories.d.ts +5 -0
  197. package/build/types/framework/responses/error.d.ts +13 -0
  198. package/build/types/framework/responses/helpers.d.ts +7 -0
  199. package/build/types/framework/responses/http-throwable.d.ts +14 -0
  200. package/build/types/framework/responses/http.d.ts +13 -0
  201. package/build/types/framework/responses/index.d.ts +4 -0
  202. package/build/types/framework/runtime/bun/server.d.ts +2 -0
  203. package/build/types/framework/runtime/deno/server.d.ts +2 -0
  204. package/build/types/framework/runtime/index.d.ts +17 -0
  205. package/build/types/framework/runtime/node/reply.d.ts +12 -0
  206. package/build/types/framework/runtime/node/request.d.ts +33 -0
  207. package/build/types/framework/runtime/node/server.d.ts +2 -0
  208. package/build/types/framework/runtime/web/server.d.ts +1 -0
  209. package/build/types/framework/services.d.ts +5 -0
  210. package/build/types/framework/utilities/alias-path.util.d.ts +1 -0
  211. package/build/types/framework/utilities/artifact.util.d.ts +7 -0
  212. package/build/types/framework/utilities/callable.util.d.ts +1 -0
  213. package/build/types/framework/utilities/cookie.util.d.ts +1 -0
  214. package/build/types/framework/utilities/csrf.util.d.ts +26 -0
  215. package/build/types/framework/utilities/https.util.d.ts +49 -0
  216. package/build/types/framework/utilities/index.d.ts +12 -0
  217. package/build/types/framework/utilities/ip.util.d.ts +15 -0
  218. package/build/types/framework/utilities/json.util.d.ts +10 -0
  219. package/build/types/framework/utilities/openapi.utils.d.ts +7 -0
  220. package/build/types/framework/utilities/openapi.utils.impl.d.ts +18 -0
  221. package/build/types/framework/utilities/path.util.d.ts +3 -0
  222. package/build/types/framework/utilities/route-suggestion.util.d.ts +10 -0
  223. package/build/types/framework/utilities/url.util.d.ts +1 -0
  224. package/build/types/framework/utilities/utilities.util.d.ts +3 -0
  225. package/build/types/framework/utilities/validation.util.d.ts +8 -0
  226. package/build/types/framework/view-model.d.ts +4 -0
  227. package/build/types/generators/artifact.templates.d.ts +7 -0
  228. package/build/types/generators/index.d.ts +2 -0
  229. package/build/types/generators/project.templates.d.ts +21 -0
  230. package/build/types/manifest/client.d.ts +12 -0
  231. package/build/types/manifest/contract.d.ts +25 -0
  232. package/build/types/manifest/index.d.ts +5 -0
  233. package/build/types/manifest/introspect.d.ts +18 -0
  234. package/build/types/manifest/manifest.d.ts +18 -0
  235. package/build/types/manifest/schema.d.ts +241 -0
  236. package/build/types/requirements.d.ts +1 -0
  237. package/build/types/types/access-guards.d.ts +4 -0
  238. package/build/types/types/application.d.ts +32 -0
  239. package/build/types/types/artifact.d.ts +8 -0
  240. package/build/types/types/builder.d.ts +37 -0
  241. package/build/types/types/config.d.ts +112 -0
  242. package/build/types/types/controller.d.ts +27 -0
  243. package/build/types/types/contruct.d.ts +1 -0
  244. package/build/types/types/core.d.ts +11 -0
  245. package/build/types/types/csrf.d.ts +33 -0
  246. package/build/types/types/directory.d.ts +6 -0
  247. package/build/types/types/encryption.d.ts +14 -0
  248. package/build/types/types/generic.d.ts +2 -0
  249. package/build/types/types/guard.d.ts +9 -0
  250. package/build/types/types/http-responses.d.ts +7 -0
  251. package/build/types/types/index.d.ts +27 -0
  252. package/build/types/types/injection.d.ts +11 -0
  253. package/build/types/types/lifecycle.d.ts +9 -0
  254. package/build/types/types/mcp.d.ts +148 -0
  255. package/build/types/types/middleware.d.ts +12 -0
  256. package/build/types/types/parseable.d.ts +3 -0
  257. package/build/types/types/plugin.d.ts +6 -0
  258. package/build/types/types/raiton.d.ts +13 -0
  259. package/build/types/types/responses.d.ts +20 -0
  260. package/build/types/types/router.d.ts +13 -0
  261. package/build/types/types/runtime.d.ts +48 -0
  262. package/build/types/types/scheduler.d.ts +140 -0
  263. package/build/types/types/scheme.d.ts +125 -0
  264. package/build/types/types/server.d.ts +10 -0
  265. package/build/types/types/socket.d.ts +11 -0
  266. package/build/types/types/thread.d.ts +25 -0
  267. package/build/types/types/utilities.d.ts +4 -0
  268. package/build/types/types/values.d.ts +2 -0
  269. package/docs/AGENTS.md +55 -0
  270. package/docs/CLAUDE.md +55 -0
  271. package/docs/README.md +5 -0
  272. package/docs/contributors/cli/README.md +17 -3
  273. package/docs/contributors/cli/commands.md +28 -17
  274. package/docs/contributors/framework/plugins/openapi.md +12 -3
  275. package/docs/generated/cli/commands.md +31 -0
  276. package/docs/generated/config-schema.json +243 -0
  277. package/docs/generated/manifest-schema.json +312 -0
  278. package/docs/generated/manifest.json +118 -0
  279. package/docs/llms-full.txt +1450 -0
  280. package/docs/llms.txt +51 -0
  281. package/docs/user-guide/README.md +19 -12
  282. package/docs/user-guide/cli.md +26 -0
  283. package/docs/user-guide/config.md +32 -0
  284. package/docs/user-guide/contracts.md +67 -0
  285. package/docs/user-guide/debug.md +130 -0
  286. package/docs/user-guide/en/README.md +83 -0
  287. package/docs/user-guide/getting-started.md +13 -1
  288. package/docs/user-guide/mcp.md +45 -2
  289. package/docs/user-guide/observability.md +74 -0
  290. package/docs/user-guide/openapi/plugin.md +10 -0
  291. package/docs/user-guide/recipes/README.md +32 -0
  292. package/docs/user-guide/recipes/contracts.md +52 -0
  293. package/docs/user-guide/recipes/doctor.md +16 -0
  294. package/docs/user-guide/recipes/generate.md +28 -0
  295. package/docs/user-guide/recipes/manifest.md +17 -0
  296. package/docs/user-guide/recipes/mcp-stdio.md +35 -0
  297. package/docs/user-guide/recipes/new-project.md +34 -0
  298. package/docs/user-guide/recipes/observability.md +17 -0
  299. package/package.json +42 -7
  300. package/scripts/bench-ai-debug.ts +572 -0
  301. package/scripts/bench.ts +586 -0
  302. package/scripts/postinstall.mjs +15 -0
  303. package/source/bin/cli-output.ts +139 -0
  304. package/source/bin/commands.registry.ts +31 -3
  305. package/source/bin/file-utils.ts +95 -0
  306. package/source/bin/name-utils.ts +26 -0
  307. package/source/bin/project-utils.ts +78 -0
  308. package/source/commands/artifact.command.ts +30 -15
  309. package/source/commands/call.command.ts +247 -0
  310. package/source/commands/client.command.ts +64 -0
  311. package/source/commands/contract.command.ts +104 -0
  312. package/source/commands/debug.shared.ts +90 -0
  313. package/source/commands/docs.command.ts +269 -0
  314. package/source/commands/doctor.command.ts +226 -0
  315. package/source/commands/explain.command.ts +119 -0
  316. package/source/commands/generate.command.ts +58 -0
  317. package/source/commands/inspect.command.ts +108 -0
  318. package/source/commands/mcp.command.ts +322 -0
  319. package/source/commands/new.command.ts +135 -0
  320. package/source/commands/openapi.command.ts +95 -0
  321. package/source/commands/requests.command.ts +137 -0
  322. package/source/commands/routes.command.ts +39 -0
  323. package/source/commands/verify.command.ts +173 -0
  324. package/source/commands/why.command.ts +61 -0
  325. package/source/contracts/decorators.ts +216 -0
  326. package/source/contracts/errors.ts +135 -0
  327. package/source/contracts/index.ts +4 -0
  328. package/source/contracts/schema.ts +438 -0
  329. package/source/contracts/typebox.ts +193 -0
  330. package/source/core/application.ts +322 -72
  331. package/source/core/builder.ts +10 -2
  332. package/source/core/config/config.ts +155 -26
  333. package/source/core/config/define.ts +35 -8
  334. package/source/core/config/index.ts +2 -1
  335. package/source/core/config/schema.ts +406 -0
  336. package/source/core/controller/builder.ts +38 -13
  337. package/source/core/controller/compiler.ts +14 -7
  338. package/source/core/controller/metadata.ts +1 -1
  339. package/source/core/hooks.ts +13 -1
  340. package/source/core/injection/injection.ts +47 -9
  341. package/source/core/mcp/builder.ts +13 -2
  342. package/source/core/mcp/metadata.ts +2 -1
  343. package/source/core/middleware/compose.ts +48 -0
  344. package/source/core/middleware/pipeline.ts +69 -46
  345. package/source/core/raiton.ts +8 -0
  346. package/source/core/router/handler.ts +246 -37
  347. package/source/core/router/handler.utils.ts +107 -51
  348. package/source/core/router/matcher.ts +195 -24
  349. package/source/core/router/route.ts +100 -31
  350. package/source/core/router/router.ts +27 -2
  351. package/source/core/scheduler/metadata.ts +1 -1
  352. package/source/core/socket/metadata.ts +1 -1
  353. package/source/core/thread.ts +37 -2
  354. package/source/debug/cli.ts +206 -0
  355. package/source/debug/collector.internal.ts +27 -0
  356. package/source/debug/collector.ts +294 -0
  357. package/source/debug/config.ts +142 -0
  358. package/source/debug/examples.ts +188 -0
  359. package/source/debug/explain.ts +187 -0
  360. package/source/debug/index.ts +15 -0
  361. package/source/debug/invocation.ts +695 -0
  362. package/source/debug/journal.ts +249 -0
  363. package/source/debug/mcp-http.ts +145 -0
  364. package/source/debug/mcp.ts +410 -0
  365. package/source/debug/redaction.ts +225 -0
  366. package/source/debug/requests.ts +136 -0
  367. package/source/debug/runtime.ts +181 -0
  368. package/source/debug/session.ts +107 -0
  369. package/source/debug/source.ts +95 -0
  370. package/source/debug/surface.ts +375 -0
  371. package/source/debug/types.ts +311 -0
  372. package/source/debug/verify.ts +186 -0
  373. package/source/framework/artifacts.ts +47 -15
  374. package/source/framework/cache/cache.ts +48 -3
  375. package/source/framework/constants/decorators.constant.ts +5 -0
  376. package/source/framework/data-transfer-object.ts +4 -3
  377. package/source/framework/decorators/controllable.decorator.ts +3 -3
  378. package/source/framework/decorators/csrf-guard.decorator.ts +3 -2
  379. package/source/framework/decorators/csrf-token.decorator.ts +1 -1
  380. package/source/framework/decorators/guard.decorator.ts +3 -2
  381. package/source/framework/decorators/health-check.decorator.ts +1 -1
  382. package/source/framework/decorators/mcp.decorator.ts +38 -7
  383. package/source/framework/decorators/middleware.decorator.ts +2 -2
  384. package/source/framework/decorators/parametrable.decorator.ts +2 -1
  385. package/source/framework/decorators/routable.decorator.ts +3 -3
  386. package/source/framework/decorators/route-interaction.decorator.ts +2 -2
  387. package/source/framework/decorators/scheduler.decorator.ts +3 -3
  388. package/source/framework/decorators/socket.decorator.ts +3 -3
  389. package/source/framework/encryption.ts +46 -7
  390. package/source/framework/errors/catalog.ts +205 -0
  391. package/source/framework/exceptions/http-exception.ts +1 -1
  392. package/source/framework/health-check.ts +18 -0
  393. package/source/framework/index.ts +2 -0
  394. package/source/framework/mcp/audit.ts +57 -0
  395. package/source/framework/mcp/conformance.ts +195 -0
  396. package/source/framework/mcp/handler.ts +139 -9
  397. package/source/framework/mcp/index.ts +6 -1
  398. package/source/framework/mcp/protocol.ts +6 -0
  399. package/source/framework/mcp/rate-limit.ts +33 -0
  400. package/source/framework/mcp/stdio.ts +150 -0
  401. package/source/framework/mcp/streamable-http.ts +36 -5
  402. package/source/framework/observability/index.ts +6 -0
  403. package/source/framework/observability/metrics.ts +162 -0
  404. package/source/framework/observability/plugin.ts +151 -0
  405. package/source/framework/observability/readiness.ts +22 -0
  406. package/source/framework/observability/request.ts +31 -0
  407. package/source/framework/observability/shutdown.ts +68 -0
  408. package/source/framework/observability/trace.ts +241 -0
  409. package/source/framework/plugins/body-parser.plugin.ts +88 -85
  410. package/source/framework/plugins/dev.plugin.ts +227 -0
  411. package/source/framework/plugins/index.ts +2 -1
  412. package/source/framework/plugins/mcp.plugin.ts +14 -3
  413. package/source/framework/plugins/openapi.plugin.ts +56 -13
  414. package/source/framework/responses/helpers.ts +4 -4
  415. package/source/framework/responses/http-throwable.ts +1 -1
  416. package/source/framework/runtime/bun/server.ts +2 -1
  417. package/source/framework/runtime/deno/server.ts +2 -1
  418. package/source/framework/runtime/index.ts +45 -13
  419. package/source/framework/runtime/node/request.ts +59 -13
  420. package/source/framework/utilities/index.ts +3 -1
  421. package/source/framework/utilities/openapi.utils.impl.ts +733 -0
  422. package/source/framework/utilities/openapi.utils.ts +6 -636
  423. package/source/framework/utilities/route-suggestion.util.ts +59 -0
  424. package/source/framework/utilities/validation.util.ts +20 -0
  425. package/source/generators/artifact.templates.ts +230 -0
  426. package/source/generators/index.ts +2 -0
  427. package/source/generators/project.templates.ts +392 -0
  428. package/source/manifest/client.ts +299 -0
  429. package/source/manifest/contract.ts +138 -0
  430. package/source/manifest/index.ts +5 -0
  431. package/source/manifest/introspect.ts +57 -0
  432. package/source/manifest/manifest.ts +364 -0
  433. package/source/manifest/schema.ts +200 -0
  434. package/source/types/builder.ts +5 -0
  435. package/source/types/config.ts +120 -2
  436. package/source/types/mcp.ts +63 -1
  437. package/tsconfig.build.json +13 -0
  438. package/source/commands/grafts.command.ts +0 -27
  439. package/tests/artifact-resolution.test.ts +0 -60
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Secret redaction and bounded capture helpers.
3
+ *
4
+ * These helpers are dependency-free and safe to import from the error
5
+ * catalogue, the request journal and the CLI: they never throw on circular
6
+ * structures and never mutate their input.
7
+ */
8
+ export declare const REDACTED = "***";
9
+ /** Header and body keys masked by default. Extend with `debug.journal.redact`. */
10
+ export declare const DEFAULT_REDACT_KEYS: readonly string[];
11
+ export interface RedactOptions {
12
+ keys?: readonly string[];
13
+ /** Maximum depth explored. @default 8 */
14
+ depth?: number;
15
+ /** Maximum items per array. @default 100 */
16
+ maxItems?: number;
17
+ }
18
+ /**
19
+ * Build a case-insensitive, normalised set from the built-in list and any
20
+ * project-specific keys.
21
+ */
22
+ export declare function redactionKeys(extra?: readonly string[]): Set<string>;
23
+ export declare function isSensitiveKey(key: string, keys: Set<string>): boolean;
24
+ /**
25
+ * Deep-clone a value while masking sensitive keys. The returned value is safe
26
+ * to serialize or store in the journal.
27
+ */
28
+ export declare function redactValue<T = any>(value: T, options?: RedactOptions): T;
29
+ /**
30
+ * Convert any header container (Headers, Map, plain object) to a redacted
31
+ * plain object.
32
+ */
33
+ export declare function redactHeaders(headers: any, extraKeys?: readonly string[]): Record<string, string>;
34
+ /** Normalise a header container to a plain, lower-cased object. */
35
+ export declare function headersToObject(headers: any): Record<string, string>;
36
+ export declare function safeStringify(value: unknown): string;
37
+ /**
38
+ * Bound a captured body. The value is serialized once; oversized payloads are
39
+ * replaced by an explicit marker and a bounded preview. The request itself is
40
+ * never affected.
41
+ */
42
+ export declare function truncateValue(value: any, maxBytes: number): any;
43
+ export declare function byteLength(value: string): number;
44
+ /**
45
+ * One-line summary of a received value, safely bounded. Sensitive field paths
46
+ * are masked by the caller (see `describeIssue`).
47
+ */
48
+ export declare function summarizeValue(value: any, maxLength?: number): string;
@@ -0,0 +1,37 @@
1
+ import { matchStatus } from "./journal.ts";
2
+ import type { DebugJournalEntry, DebugRequestsList } from "./types.ts";
3
+ export interface ListRequestsOptions {
4
+ since?: string | number;
5
+ status?: string;
6
+ route?: string;
7
+ limit?: number;
8
+ includeBodies?: boolean;
9
+ workdir?: string;
10
+ }
11
+ /** Parse `5m`, `30s`, `2h`, `1000ms` or a number of milliseconds. */
12
+ export declare function parseSince(value?: string | number): number | undefined;
13
+ export interface RequestLookup {
14
+ entry: DebugJournalEntry;
15
+ origin: "journal" | "session";
16
+ }
17
+ /**
18
+ * Find a request by id in the in-memory journal, then in the bounded CLI
19
+ * session file. Returns `undefined` when neither contains it.
20
+ */
21
+ export declare function findRequest(requestId: string, workdir?: string): RequestLookup | undefined;
22
+ export declare function lastRequest(workdir?: string): RequestLookup | undefined;
23
+ /**
24
+ * List retained requests, most recent first. Bodies are omitted by default so
25
+ * the output stays token-efficient.
26
+ */
27
+ export declare function listRequests(options?: ListRequestsOptions): DebugRequestsList;
28
+ /** Used by the HTTP surface when `includeBodies` is requested. */
29
+ export declare function listRequestsWithBodies(options?: ListRequestsOptions): DebugRequestsList & {
30
+ entries: DebugJournalEntry[];
31
+ };
32
+ export { matchStatus };
33
+ /**
34
+ * Resolve the invocation path for a captured entry. Metadata capture omits
35
+ * params, so the concrete path is the only replayable form in that mode.
36
+ */
37
+ export declare function replayPath(entry: DebugJournalEntry): string;
@@ -0,0 +1,52 @@
1
+ import type { ApplicationInterface } from "../types/application.ts";
2
+ import type { ProjectManifest } from "../manifest/schema.ts";
3
+ import { DebugCollector } from "./collector.ts";
4
+ import { DebugJournal } from "./journal.ts";
5
+ import type { DebugLogLine, ResolvedDebugConfig } from "./types.ts";
6
+ export interface DebugLogBuffer {
7
+ record(level: string, message: string): void;
8
+ tail(limit?: number): DebugLogLine[];
9
+ clear(): void;
10
+ }
11
+ export interface DebugRuntimeState {
12
+ config: ResolvedDebugConfig;
13
+ journal?: DebugJournal;
14
+ collector?: DebugCollector;
15
+ buildId: string;
16
+ development: boolean;
17
+ workdir: string;
18
+ application?: ApplicationInterface;
19
+ logs: DebugLogBuffer;
20
+ }
21
+ export interface ConfigureDebugOptions {
22
+ config: ResolvedDebugConfig;
23
+ development: boolean;
24
+ workdir?: string;
25
+ application?: ApplicationInterface;
26
+ buildId?: string;
27
+ }
28
+ /**
29
+ * Configure the process-wide debug runtime. The journal survives HMR reloads
30
+ * (it lives on `globalThis`) while a new build id marks older entries stale.
31
+ */
32
+ export declare function configureDebug(options: ConfigureDebugOptions): DebugRuntimeState;
33
+ export declare function getDebugRuntime(): DebugRuntimeState | undefined;
34
+ export declare function getDebugCollector(): DebugCollector | undefined;
35
+ export declare function getDebugJournal(): DebugJournal | undefined;
36
+ export declare function isDebugJournalEnabled(): boolean;
37
+ export declare function resetDebugRuntime(): void;
38
+ /**
39
+ * Mark every retained entry as stale after a hot reload. The journal survives,
40
+ * but old entries are never mixed with the new build without a marker.
41
+ */
42
+ export declare function rotateDebugBuild(): void;
43
+ export declare function recordDebugLog(level: string, message: string): void;
44
+ export interface DebugContextOptions {
45
+ workdir?: string;
46
+ application?: ApplicationInterface;
47
+ }
48
+ export declare function setDebugContext(options: DebugContextOptions): void;
49
+ /** Load the live project manifest, using the existing cache when possible. */
50
+ export declare function loadDebugManifest(refresh?: boolean): Promise<ProjectManifest>;
51
+ /** Resolve the session-journal file used to bridge short-lived CLI processes. */
52
+ export declare function sessionJournalFile(workdir?: string): string;
@@ -0,0 +1,21 @@
1
+ import { DebugJournal } from "./journal.ts";
2
+ import type { DebugJournalEntry } from "./types.ts";
3
+ interface DebugSessionFile {
4
+ schemaVersion: string;
5
+ updatedAt: string;
6
+ entries: DebugJournalEntry[];
7
+ }
8
+ /**
9
+ * Read the bounded CLI session journal.
10
+ *
11
+ * The in-memory journal remains the runtime source of truth; this file only
12
+ * bridges two short-lived CLI processes (`raiton call` then `raiton explain`)
13
+ * when no running application is targeted. It is bounded, expires after 15
14
+ * minutes and is never written on a request hot path.
15
+ */
16
+ export declare function readSessionFile(workdir?: string): DebugSessionFile;
17
+ export declare function readSessionEntries(workdir?: string): DebugJournalEntry[];
18
+ export declare function loadSessionJournal(workdir?: string): DebugJournal;
19
+ export declare function appendSessionEntry(entry: DebugJournalEntry, workdir?: string): void;
20
+ export declare function clearSessionJournal(workdir?: string): void;
21
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { DebugRouteSource } from "./types.ts";
2
+ export declare function relativePath(workdir: string, filename: string): string;
3
+ /** Relativize a `file:line` location captured by a decorator. */
4
+ export declare function relativeLocation(location: string | undefined, workdir?: string): string | undefined;
5
+ /** Clear cached line numbers after an HMR reload. */
6
+ export declare function invalidateSourceCache(): void;
7
+ /**
8
+ * Resolve the source location of a compiled route. Called once per handler
9
+ * compilation, never on the request hot path.
10
+ */
11
+ export declare function resolveRouteSource(controllerClass: any, controllerMeta: any, routeMeta: any, workdir?: string): DebugRouteSource;
12
+ /**
13
+ * Extract the first application frame from a stack trace. Used only in
14
+ * development to point at the throwing line.
15
+ */
16
+ export declare function firstUserFrame(stack?: string): string | undefined;
17
+ export declare function stackLines(error: any, limit?: number): string[] | undefined;
@@ -0,0 +1,10 @@
1
+ import type { PluginInterface } from "../types/plugin.ts";
2
+ import { type DebugRuntimeState } from "./runtime.ts";
3
+ /**
4
+ * Mount the HTTP debug surface and the debug MCP transport.
5
+ *
6
+ * All handlers are marked internal so they never appear in the public manifest
7
+ * inventory. The plugin is only registered when debug is enabled.
8
+ */
9
+ export declare function debugPlugin(runtime: DebugRuntimeState): PluginInterface;
10
+ export declare function debugSurfaceEnabled(): boolean;
@@ -0,0 +1,271 @@
1
+ import type { DebugCaptureMode, DebugConfigInterface, DebugJournalConfigInterface } from "../types/config.ts";
2
+ /** Version of every debug artefact (journal, invocation, explanation, report). */
3
+ export declare const DEBUG_SCHEMA_VERSION = "1.0.0";
4
+ export declare const SUPPORTED_DEBUG_SCHEMA_VERSIONS: Set<string>;
5
+ export declare function isSupportedDebugSchemaVersion(version: unknown): boolean;
6
+ export declare class DebugSchemaVersionError extends Error {
7
+ readonly version: unknown;
8
+ constructor(version: unknown);
9
+ readonly code: string;
10
+ }
11
+ export type DebugCapture = DebugCaptureMode;
12
+ export interface ResolvedDebugJournalConfig {
13
+ enabled: boolean;
14
+ capacity: number;
15
+ maxBodyBytes: number;
16
+ capture: DebugCapture;
17
+ ttlMs: number;
18
+ sampleRate: number;
19
+ redact: string[];
20
+ /** Hard budget for the whole journal, in bytes. @default 8388608 */
21
+ maxTotalBytes: number;
22
+ }
23
+ export interface ResolvedDebugHttpConfig {
24
+ enabled: boolean;
25
+ basePath: string;
26
+ loopbackOnly: boolean;
27
+ tokenEnv: string;
28
+ token?: string;
29
+ }
30
+ export interface ResolvedDebugMcpConfig {
31
+ enabled: boolean;
32
+ path: string;
33
+ }
34
+ export interface ResolvedDebugConfig {
35
+ enabled: boolean;
36
+ journal: ResolvedDebugJournalConfig;
37
+ http: ResolvedDebugHttpConfig;
38
+ mcp: ResolvedDebugMcpConfig;
39
+ replay: {
40
+ allowUnsafeMethods: boolean;
41
+ };
42
+ development: boolean;
43
+ raw: DebugConfigInterface;
44
+ }
45
+ export interface DebugRouteSource {
46
+ file: string;
47
+ line: number;
48
+ controller: string;
49
+ handler: string;
50
+ decorator?: string;
51
+ }
52
+ export interface DebugTimelineStep {
53
+ step: string;
54
+ durationMs?: number;
55
+ result?: string;
56
+ detail?: string;
57
+ }
58
+ export interface DebugValidationIssue {
59
+ path: string;
60
+ code: string;
61
+ message: string;
62
+ expected?: string;
63
+ received?: string;
64
+ location?: string;
65
+ }
66
+ export interface DebugValidationSummary {
67
+ ok: boolean;
68
+ absent?: boolean;
69
+ issues: DebugValidationIssue[];
70
+ }
71
+ export interface DebugJournalRequest {
72
+ method: string;
73
+ route: string;
74
+ pattern: string;
75
+ path: string;
76
+ query?: Record<string, any>;
77
+ params?: Record<string, any>;
78
+ headers?: Record<string, string>;
79
+ body?: any;
80
+ }
81
+ export interface DebugJournalResponse {
82
+ status: number;
83
+ durationMs: number;
84
+ body?: any;
85
+ }
86
+ export interface DebugJournalError {
87
+ code: string;
88
+ message: string;
89
+ statusCode?: number;
90
+ stack?: string[];
91
+ location?: string;
92
+ }
93
+ export interface DebugRelease {
94
+ hmr: boolean;
95
+ buildId: string;
96
+ }
97
+ export interface DebugJournalEntry {
98
+ schemaVersion: string;
99
+ requestId: string;
100
+ traceId: string;
101
+ startedAt: string;
102
+ request: DebugJournalRequest;
103
+ response: DebugJournalResponse;
104
+ source?: DebugRouteSource;
105
+ timeline: DebugTimelineStep[];
106
+ validation?: DebugValidationSummary;
107
+ error?: DebugJournalError;
108
+ cache?: {
109
+ hit: boolean;
110
+ };
111
+ release: DebugRelease;
112
+ replayedFrom?: string;
113
+ stale?: boolean;
114
+ }
115
+ export interface DebugJournalFilter {
116
+ sinceMs?: number;
117
+ status?: string;
118
+ route?: string;
119
+ limit?: number;
120
+ includeBodies?: boolean;
121
+ }
122
+ export interface DebugRequestsList {
123
+ schemaVersion: string;
124
+ count: number;
125
+ capacity: number;
126
+ enabled: boolean;
127
+ requests: Array<{
128
+ requestId: string;
129
+ traceId: string;
130
+ startedAt: string;
131
+ method: string;
132
+ route: string;
133
+ status: number;
134
+ durationMs: number;
135
+ stale?: boolean;
136
+ }>;
137
+ }
138
+ export interface DebugInvocationRequest {
139
+ method: string;
140
+ path: string;
141
+ params?: Record<string, any>;
142
+ query?: Record<string, any>;
143
+ headers?: Record<string, any>;
144
+ body?: any;
145
+ example?: string;
146
+ dryRun?: boolean;
147
+ validate?: boolean;
148
+ timeoutMs?: number;
149
+ baseUrl?: string;
150
+ failOn?: string[];
151
+ replayedFrom?: string;
152
+ }
153
+ export interface DebugResolvedRequest {
154
+ method: string;
155
+ path: string;
156
+ url: string;
157
+ params: Record<string, any>;
158
+ query: Record<string, any>;
159
+ headers: Record<string, string>;
160
+ body?: any;
161
+ }
162
+ export interface DebugContractStatus {
163
+ input: "valid" | "invalid" | "absent" | "skipped";
164
+ output: "valid" | "invalid" | "absent" | "unknown";
165
+ issues: DebugValidationIssue[];
166
+ /** Route label used to attribute output contract violations. */
167
+ route?: string;
168
+ }
169
+ export interface DebugInvocationResult {
170
+ schemaVersion: string;
171
+ request: {
172
+ method: string;
173
+ path: string;
174
+ url?: string;
175
+ headers: Record<string, string>;
176
+ query?: Record<string, any>;
177
+ params?: Record<string, any>;
178
+ body?: any;
179
+ dryRun?: boolean;
180
+ };
181
+ response: {
182
+ status: number;
183
+ durationMs: number;
184
+ requestId: string;
185
+ traceId: string;
186
+ body?: any;
187
+ };
188
+ contract: DebugContractStatus;
189
+ nextActions: string[];
190
+ replayedFrom?: string;
191
+ comparison?: DebugReplayComparison;
192
+ }
193
+ export interface DebugReplayComparison {
194
+ status: "same" | "changed";
195
+ body: "same" | "changed" | "unknown";
196
+ previousStatus: number;
197
+ currentStatus: number;
198
+ differences: string[];
199
+ }
200
+ export interface DebugExplanation {
201
+ schemaVersion: string;
202
+ requestId: string;
203
+ request: {
204
+ method: string;
205
+ route: string;
206
+ status: number;
207
+ durationMs: number;
208
+ startedAt: string;
209
+ };
210
+ source?: DebugRouteSource;
211
+ timeline: DebugTimelineStep[];
212
+ diagnosis: {
213
+ code: string;
214
+ rootCause: string;
215
+ issues: DebugValidationIssue[];
216
+ hint: string;
217
+ /** Development-only launch site. */
218
+ location?: string;
219
+ /** Development-only stack lines. */
220
+ stack?: string[];
221
+ };
222
+ nextActions: string[];
223
+ stale?: boolean;
224
+ request_verbose?: DebugJournalRequest;
225
+ response_verbose?: DebugJournalResponse;
226
+ }
227
+ export interface DebugVerificationResult {
228
+ method: string;
229
+ path: string;
230
+ status?: number;
231
+ expectedStatus?: number;
232
+ contract: "valid" | "invalid" | "absent" | "skipped";
233
+ passed: boolean;
234
+ skipped?: boolean;
235
+ reason?: string;
236
+ issue?: string;
237
+ field?: string;
238
+ expected?: string;
239
+ actual?: string;
240
+ source?: string;
241
+ requestId?: string;
242
+ }
243
+ export interface DebugVerificationReport {
244
+ schemaVersion: string;
245
+ summary: {
246
+ routes: number;
247
+ passed: number;
248
+ failed: number;
249
+ skipped: number;
250
+ durationMs: number;
251
+ };
252
+ results: DebugVerificationResult[];
253
+ }
254
+ export interface DebugDoctorCheck {
255
+ name: string;
256
+ passed: boolean;
257
+ detail?: string;
258
+ hint?: string;
259
+ }
260
+ export interface DebugDoctorReport {
261
+ schemaVersion: string;
262
+ passed: boolean;
263
+ checks: DebugDoctorCheck[];
264
+ }
265
+ export interface DebugLogLine {
266
+ at: string;
267
+ level: string;
268
+ message: string;
269
+ }
270
+ /** Loose config accepted by `defineConfig`; kept for editor completion. */
271
+ export type { DebugConfigInterface, DebugJournalConfigInterface };
@@ -0,0 +1,23 @@
1
+ import type { ProjectManifest } from "../manifest/schema.ts";
2
+ import type { ApplicationInterface } from "../types/application.ts";
3
+ import type { ResolvedDebugConfig } from "./types.ts";
4
+ import type { DebugVerificationReport } from "./types.ts";
5
+ export interface VerifyOptions {
6
+ manifest: ProjectManifest;
7
+ application?: ApplicationInterface;
8
+ baseUrl?: string;
9
+ config?: ResolvedDebugConfig;
10
+ route?: string;
11
+ allowUnsafe?: boolean;
12
+ failOn?: string[];
13
+ timeoutMs?: number;
14
+ workdir?: string;
15
+ headers?: Record<string, string>;
16
+ }
17
+ /**
18
+ * Call every route with its documented example, validate the status and output
19
+ * contract, and return a per-route report. Non-idempotent methods are skipped
20
+ * unless explicitly allowed.
21
+ */
22
+ export declare function verifyManifest(options: VerifyOptions): Promise<DebugVerificationReport>;
23
+ export declare function verifyHuman(report: DebugVerificationReport): string;
@@ -0,0 +1,20 @@
1
+ export type HmrChannel = 'hmr:di' | 'hmr:controller' | 'hmr:socket' | 'hmr:middleware' | 'hmr:hook' | 'hmr:mcp' | 'hmr:health-check' | 'hmr:scheduler';
2
+ export interface ArtifactClassification {
3
+ channel: HmrChannel;
4
+ artifactType: string;
5
+ }
6
+ export declare const HMR_CHANNELS: Record<HmrChannel, readonly string[]>;
7
+ export declare class Artifacts {
8
+ static readonly types: Set<string>;
9
+ static readonly defaultTypes: string[];
10
+ static register(type: string): typeof Artifacts;
11
+ static registerMany(...types: string[]): typeof Artifacts;
12
+ static is(filename: string): boolean;
13
+ static classify(filename: string): ArtifactClassification | null;
14
+ static reload(modulo: any, filename?: string): void;
15
+ static reloadDi(modulo: any, filename?: string): void;
16
+ static reloadMiddleware(modulo: any, filename?: string): void;
17
+ static reloadHook(modulo: any, filename?: string): void;
18
+ static reloadMcp(modulo: any, filename?: string): void;
19
+ static reloadScheduler(modulo: any, filename?: string): void;
20
+ }
@@ -0,0 +1,84 @@
1
+ import type { RequestContext } from "../../core/context.ts";
2
+ import type { CacheEntry, CacheOptions, CacheStore } from "./types.ts";
3
+ /**
4
+ * Store en mémoire, à durée de vie bornée (TTL) et taille maximale bornée,
5
+ * utilisé par défaut pour la mise en cache des réponses de routes.
6
+ */
7
+ export declare class MemoryCacheStore implements CacheStore {
8
+ private entries;
9
+ private readonly maxSize;
10
+ constructor(maxSize?: number);
11
+ get<T = any>(key: string): CacheEntry<T> | undefined;
12
+ set<T = any>(key: string, entry: CacheEntry<T>, _ttl?: number): void;
13
+ has(key: string): boolean;
14
+ delete(key: string): boolean;
15
+ clear(): void;
16
+ size(): number;
17
+ private evictIfNeeded;
18
+ }
19
+ /**
20
+ * `CacheManager` configure le comportement global du cache de routes, à la
21
+ * manière des autres managers du framework.
22
+ */
23
+ export declare class CacheManager {
24
+ private static _store;
25
+ private static _defaults;
26
+ private static readonly _routeVersions;
27
+ private static readonly _routeKeys;
28
+ static configure(options: Partial<CacheOptions>): void;
29
+ static getDefaults(): Partial<CacheOptions>;
30
+ static getStore(): CacheStore;
31
+ static setStore(store: CacheStore): void;
32
+ /**
33
+ * Version courante d'une route. La version est intégrée aux clés de cache
34
+ * afin qu'une invalidation HMR rende immédiatement les anciennes entrées
35
+ * inaccessibles, même si le handler est recompilé.
36
+ */
37
+ static version(route: string): number;
38
+ static track(route: string, key: string): void;
39
+ static invalidateRoute(route: string): void;
40
+ static clear(): void;
41
+ }
42
+ /**
43
+ * Construit la clé de cache par défaut : méthode + route + paramètres d'URL.
44
+ */
45
+ export declare function defaultCacheKey(context: RequestContext, route: string): string;
46
+ /**
47
+ * Résout les options effectives d'une route (défauts globaux + options locales).
48
+ */
49
+ export declare function resolveCacheOptions(route: string, options?: CacheOptions): CacheOptions;
50
+ /**
51
+ * Calcule la clé de cache pour une requête donnée.
52
+ */
53
+ export declare function buildCacheKey(context: RequestContext, route: string, options: CacheOptions): Promise<string>;
54
+ /**
55
+ * Applique une réponse en cache au contexte (statut + en-têtes + corps).
56
+ */
57
+ export declare function sendCachedEntry(context: RequestContext, entry: CacheEntry): void;
58
+ /**
59
+ * Mécanisme cœur du cache de routes, pensé pour être intégré au niveau du
60
+ * handler (dans `createHandler`). Il évite complètement d'exécuter le handler
61
+ * tant qu'une entrée fraîche existe pour la clé de requête.
62
+ *
63
+ * - `get` renvoie l'entrée fraîche si elle existe.
64
+ * - `set` stocke la réponse si elle est éligible (méthode + statut 2xx).
65
+ */
66
+ export declare class RouteCache {
67
+ private readonly store;
68
+ private readonly route;
69
+ private readonly options;
70
+ private readonly version;
71
+ constructor(route: string, options?: CacheOptions);
72
+ get enabled(): boolean;
73
+ matchesMethod(method: string): boolean;
74
+ private scope;
75
+ key(context: RequestContext): Promise<string>;
76
+ get<T = any>(context: RequestContext, key?: string): Promise<CacheEntry<T> | undefined>;
77
+ set<T = any>(context: RequestContext, body: T, status?: number, headers?: Record<string, string>, key?: string): Promise<void>;
78
+ shouldCache(status: number): boolean;
79
+ }
80
+ /**
81
+ * Helper de contrôle-manipulation du cache-Control, valeur commode pour les
82
+ * routes qui ne veulent pas passer par le middleware ETag.
83
+ */
84
+ export declare function cacheControl(context: RequestContext, value: string | number, publicAccess?: boolean): void;
@@ -0,0 +1,21 @@
1
+ import "reflect-metadata";
2
+ import type { CacheOptions } from "./types.ts";
3
+ /**
4
+ * Décorateur de route : met en cache la réponse du handler pendant `ttl`.
5
+ *
6
+ * Contrairement aux ETag (validation), le cache évite complètement l'exécution
7
+ * du handler tant que l'entrée est fraîche.
8
+ *
9
+ * @example
10
+ * @Controllable("/products")
11
+ * class ProductController {
12
+ * @Get("/featured")
13
+ * @Cache({ ttl: 60_000, vary: ["accept-language"] })
14
+ * featured() {
15
+ * return this.products.findFeatured()
16
+ * }
17
+ * }
18
+ */
19
+ export declare function Cache(options?: CacheOptions): (target: any, propertyKey?: string) => void;
20
+ export declare function getCacheMetadata(target: any, propertyKey: string): CacheOptions | undefined;
21
+ export declare function isCached(target: any, propertyKey: string): boolean;
@@ -0,0 +1,62 @@
1
+ import type { RequestContext } from "../../core/context.ts";
2
+ import type { ETagOptions, ETagResult } from "./types.ts";
3
+ /**
4
+ * `Etagger` est le gestionnaire complet des ETag. Il est entièrement
5
+ * personnalisable par le développeur : algorithme de hachage, marqueur faible,
6
+ * en-tête, cache-control et prédicat d'exclusion.
7
+ *
8
+ * @example
9
+ * const etagger = new Etagger({ weak: true, cacheControl: { maxAge: 300 } })
10
+ * const { tag, notModified } = await etagger.evaluate(context, body)
11
+ */
12
+ export declare class Etagger {
13
+ private readonly enabled;
14
+ private readonly weak;
15
+ private readonly algorithm?;
16
+ private readonly cacheControl?;
17
+ private readonly headerName;
18
+ private readonly skip?;
19
+ constructor(options?: ETagOptions);
20
+ /**
21
+ * Calcule la valeur d'ETag d'un corps de réponse sérialisé.
22
+ */
23
+ generate(body: any): Promise<string>;
24
+ /**
25
+ * Vérifie si la liste d'ETag envoyée par le client (en-tête `If-None-Match`)
26
+ * matche avec l'ETag calculé. Un `*` matche n'importe quelle ressource.
27
+ */
28
+ matches(clientTags: string | null | undefined, tag: string): boolean;
29
+ /**
30
+ * Applique la politique de cache à en-têtes de réponse.
31
+ */
32
+ applyCacheControl(context: RequestContext): void;
33
+ /**
34
+ * Évalue la requête condititionnelle complète. Si un ETag fort/faible est
35
+ * présent et que le client l'a déjà (via `If-None-Match`), la réponse est
36
+ * marquée `notModified` et doit être envoyée avec le statut `304`.
37
+ */
38
+ evaluate(context: RequestContext, body: any): Promise<ETagResult>;
39
+ /**
40
+ * Raccourci statique, construit une instance à la volée et évalue.
41
+ */
42
+ static apply(context: RequestContext, body: any, options?: ETagOptions): Promise<ETagResult>;
43
+ }
44
+ /**
45
+ * Instance singulière utilisée par défaut par le middleware `etag()`.
46
+ */
47
+ export declare const defaultEtagger: Etagger;
48
+ /**
49
+ * Middleware ETag prêt à l'emploi. À brancher globalement ou par route :
50
+ *
51
+ * ```typescript
52
+ * app.use(etag({ weak: false, cacheControl: { maxAge: 300 } }))
53
+ * ```
54
+ *
55
+ * Le middleware intercepte `context.reply.send`, calcule l'ETag du corps
56
+ * sérialisé, pose l'en-tête correspondant et répond `304 Not Modified` si le
57
+ * client déclare déjà posséder la représentation (`If-None-Match`).
58
+ */
59
+ export declare function etag(options?: ETagOptions): ({ context, next }: {
60
+ context: RequestContext;
61
+ next: () => Promise<any>;
62
+ }) => Promise<void>;
@@ -0,0 +1,4 @@
1
+ export * from "./types.ts";
2
+ export * from "./etag.ts";
3
+ export * from "./cache.ts";
4
+ export * from "./cache.decorator.ts";