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.
- package/CHANGELOG.md +67 -0
- package/README.md +65 -1
- package/benchmarks/README.md +31 -0
- package/benchmarks/ai-debug.json +145 -0
- package/benchmarks/ai-debug.md +64 -0
- package/benchmarks/latest.json +172 -0
- package/benchmarks/latest.md +66 -0
- package/build/bin/index.mjs +37621 -21866
- package/build/types/bin/bootstrapper.d.ts +2 -0
- package/build/types/bin/cli-output.d.ts +46 -0
- package/build/types/bin/cli-tools.d.ts +13 -0
- package/build/types/bin/cli.d.ts +3 -0
- package/build/types/bin/commands.registry.d.ts +4 -0
- package/build/types/bin/constants.d.ts +3 -0
- package/build/types/bin/file-utils.d.ts +21 -0
- package/build/types/bin/index.d.ts +2 -0
- package/build/types/bin/name-utils.d.ts +4 -0
- package/build/types/bin/project-utils.d.ts +12 -0
- package/build/types/commands/artifact.command.d.ts +7 -0
- package/build/types/commands/build.command.d.ts +8 -0
- package/build/types/commands/call.command.d.ts +10 -0
- package/build/types/commands/client.command.d.ts +7 -0
- package/build/types/commands/contract.command.d.ts +8 -0
- package/build/types/commands/debug.shared.d.ts +16 -0
- package/build/types/commands/develop.command.d.ts +9 -0
- package/build/types/commands/docs.command.d.ts +8 -0
- package/build/types/commands/doctor.command.d.ts +9 -0
- package/build/types/commands/explain.command.d.ts +8 -0
- package/build/types/commands/generate.command.d.ts +7 -0
- package/build/types/commands/inspect.command.d.ts +7 -0
- package/build/types/commands/mcp.command.d.ts +12 -0
- package/build/types/commands/new.command.d.ts +7 -0
- package/build/types/commands/openapi.command.d.ts +7 -0
- package/build/types/commands/requests.command.d.ts +8 -0
- package/build/types/commands/routes.command.d.ts +7 -0
- package/build/types/commands/start.command.d.ts +9 -0
- package/build/types/commands/verify.command.d.ts +8 -0
- package/build/types/commands/why.command.d.ts +7 -0
- package/build/types/contracts/decorators.d.ts +59 -0
- package/build/types/contracts/errors.d.ts +68 -0
- package/build/types/contracts/index.d.ts +4 -0
- package/build/types/contracts/schema.d.ts +83 -0
- package/build/types/contracts/typebox.d.ts +81 -0
- package/build/types/core/application.d.ts +45 -0
- package/build/types/core/artifacts/artifact.d.ts +3 -0
- package/build/types/core/artifacts/index.d.ts +1 -0
- package/build/types/core/artifacts/runner.d.ts +1 -0
- package/build/types/core/builder.d.ts +42 -0
- package/build/types/core/bytes.util.d.ts +3 -0
- package/build/types/core/command.d.ts +13 -0
- package/build/types/core/commands.d.ts +10 -0
- package/build/types/core/config/config.d.ts +27 -0
- package/build/types/core/config/define.d.ts +8 -0
- package/build/types/core/config/index.d.ts +3 -0
- package/build/types/core/config/schema.d.ts +24 -0
- package/build/types/core/context.d.ts +11 -0
- package/build/types/core/controller/builder.d.ts +26 -0
- package/build/types/core/controller/compiler.d.ts +2 -0
- package/build/types/core/controller/index.d.ts +4 -0
- package/build/types/core/controller/metadata.d.ts +3 -0
- package/build/types/core/controller/tracker.d.ts +9 -0
- package/build/types/core/directories.d.ts +10 -0
- package/build/types/core/guards.d.ts +11 -0
- package/build/types/core/helpers/index.d.ts +1 -0
- package/build/types/core/helpers/raiton.d.ts +1 -0
- package/build/types/core/hooks.d.ts +14 -0
- package/build/types/core/index.d.ts +17 -0
- package/build/types/core/injection/index.d.ts +1 -0
- package/build/types/core/injection/injection.d.ts +37 -0
- package/build/types/core/mcp/builder.d.ts +2 -0
- package/build/types/core/mcp/index.d.ts +3 -0
- package/build/types/core/mcp/metadata.d.ts +9 -0
- package/build/types/core/mcp/tracker.d.ts +9 -0
- package/build/types/core/middleware/compose.d.ts +8 -0
- package/build/types/core/middleware/index.d.ts +2 -0
- package/build/types/core/middleware/pipeline.d.ts +12 -0
- package/build/types/core/plugins/index.d.ts +2 -0
- package/build/types/core/plugins/plugin.d.ts +2 -0
- package/build/types/core/plugins/scope.d.ts +15 -0
- package/build/types/core/process.util.d.ts +1 -0
- package/build/types/core/raiton.d.ts +15 -0
- package/build/types/core/router/handler.d.ts +2 -0
- package/build/types/core/router/handler.utils.d.ts +37 -0
- package/build/types/core/router/index.d.ts +4 -0
- package/build/types/core/router/matcher.d.ts +50 -0
- package/build/types/core/router/route.d.ts +52 -0
- package/build/types/core/router/router.d.ts +23 -0
- package/build/types/core/scheduler/builder.d.ts +2 -0
- package/build/types/core/scheduler/cron.d.ts +32 -0
- package/build/types/core/scheduler/duration.d.ts +7 -0
- package/build/types/core/scheduler/index.d.ts +6 -0
- package/build/types/core/scheduler/manager.d.ts +47 -0
- package/build/types/core/scheduler/metadata.d.ts +8 -0
- package/build/types/core/scheduler/queue/backend.d.ts +42 -0
- package/build/types/core/scheduler/queue/index.d.ts +3 -0
- package/build/types/core/scheduler/queue/rabbitmq.backend.d.ts +37 -0
- package/build/types/core/scheduler/queue/redis.backend.d.ts +38 -0
- package/build/types/core/server.d.ts +9 -0
- package/build/types/core/socket/builder.d.ts +1 -0
- package/build/types/core/socket/index.d.ts +2 -0
- package/build/types/core/socket/metadata.d.ts +14 -0
- package/build/types/core/thread.d.ts +21 -0
- package/build/types/debug/cli.d.ts +33 -0
- package/build/types/debug/collector.d.ts +41 -0
- package/build/types/debug/collector.internal.d.ts +27 -0
- package/build/types/debug/config.d.ts +19 -0
- package/build/types/debug/examples.d.ts +43 -0
- package/build/types/debug/explain.d.ts +9 -0
- package/build/types/debug/index.d.ts +15 -0
- package/build/types/debug/invocation.d.ts +53 -0
- package/build/types/debug/journal.d.ts +49 -0
- package/build/types/debug/mcp-http.d.ts +17 -0
- package/build/types/debug/mcp.d.ts +14 -0
- package/build/types/debug/redaction.d.ts +48 -0
- package/build/types/debug/requests.d.ts +37 -0
- package/build/types/debug/runtime.d.ts +52 -0
- package/build/types/debug/session.d.ts +21 -0
- package/build/types/debug/source.d.ts +17 -0
- package/build/types/debug/surface.d.ts +10 -0
- package/build/types/debug/types.d.ts +271 -0
- package/build/types/debug/verify.d.ts +23 -0
- package/build/types/framework/artifacts.d.ts +20 -0
- package/build/types/framework/cache/cache.d.ts +84 -0
- package/build/types/framework/cache/cache.decorator.d.ts +21 -0
- package/build/types/framework/cache/etag.d.ts +62 -0
- package/build/types/framework/cache/index.d.ts +4 -0
- package/build/types/framework/cache/types.d.ts +89 -0
- package/build/types/framework/constants/decorators.constant.d.ts +28 -0
- package/build/types/framework/constants/index.d.ts +2 -0
- package/build/types/framework/constants/microservices.constant.d.ts +3 -0
- package/build/types/framework/controllers.d.ts +2 -0
- package/build/types/framework/data-transfer-object.d.ts +5 -0
- package/build/types/framework/decorators/access-guard.decorator.d.ts +1 -0
- package/build/types/framework/decorators/api-response.decorator.d.ts +66 -0
- package/build/types/framework/decorators/api.decorator.d.ts +160 -0
- package/build/types/framework/decorators/controllable.decorator.d.ts +3 -0
- package/build/types/framework/decorators/csrf-guard.decorator.d.ts +2 -0
- package/build/types/framework/decorators/csrf-token.decorator.d.ts +1 -0
- package/build/types/framework/decorators/guard.decorator.d.ts +2 -0
- package/build/types/framework/decorators/health-check.decorator.d.ts +17 -0
- package/build/types/framework/decorators/index.d.ts +15 -0
- package/build/types/framework/decorators/injection.decorator.d.ts +5 -0
- package/build/types/framework/decorators/mcp.decorator.d.ts +68 -0
- package/build/types/framework/decorators/middleware.decorator.d.ts +3 -0
- package/build/types/framework/decorators/parametrable.decorator.d.ts +9 -0
- package/build/types/framework/decorators/routable.decorator.d.ts +12 -0
- package/build/types/framework/decorators/route-interaction.decorator.d.ts +81 -0
- package/build/types/framework/decorators/scheduler.decorator.d.ts +54 -0
- package/build/types/framework/decorators/socket.decorator.d.ts +5 -0
- package/build/types/framework/encryption.d.ts +25 -0
- package/build/types/framework/enums/csrf.enum.d.ts +4 -0
- package/build/types/framework/enums/encrypted.enum.d.ts +20 -0
- package/build/types/framework/enums/event.message.enum.d.ts +4 -0
- package/build/types/framework/enums/http-method.enum.d.ts +10 -0
- package/build/types/framework/enums/http-parameters.enum.d.ts +11 -0
- package/build/types/framework/enums/http-status.enum.d.ts +64 -0
- package/build/types/framework/enums/index.d.ts +9 -0
- package/build/types/framework/enums/runtime.enum.d.ts +5 -0
- package/build/types/framework/enums/scheduler.enum.d.ts +21 -0
- package/build/types/framework/enums/timestamp.enum.d.ts +6 -0
- package/build/types/framework/env.d.ts +3 -0
- package/build/types/framework/errors/catalog.d.ts +57 -0
- package/build/types/framework/exceptions/http-exception.d.ts +18 -0
- package/build/types/framework/exceptions/index.d.ts +2 -0
- package/build/types/framework/exceptions/throwable.d.ts +76 -0
- package/build/types/framework/health-check.d.ts +42 -0
- package/build/types/framework/index.d.ts +20 -0
- package/build/types/framework/mcp/audit.d.ts +12 -0
- package/build/types/framework/mcp/conformance.d.ts +31 -0
- package/build/types/framework/mcp/handler.d.ts +11 -0
- package/build/types/framework/mcp/index.d.ts +5 -0
- package/build/types/framework/mcp/protocol.d.ts +17 -0
- package/build/types/framework/mcp/rate-limit.d.ts +10 -0
- package/build/types/framework/mcp/stdio.d.ts +40 -0
- package/build/types/framework/mcp/streamable-http.d.ts +17 -0
- package/build/types/framework/observability/index.d.ts +6 -0
- package/build/types/framework/observability/metrics.d.ts +23 -0
- package/build/types/framework/observability/plugin.d.ts +20 -0
- package/build/types/framework/observability/readiness.d.ts +9 -0
- package/build/types/framework/observability/request.d.ts +7 -0
- package/build/types/framework/observability/shutdown.d.ts +21 -0
- package/build/types/framework/observability/trace.d.ts +96 -0
- package/build/types/framework/parameter-bag.d.ts +14 -0
- package/build/types/framework/plugins/body-parser.plugin.d.ts +3 -0
- package/build/types/framework/plugins/dev.plugin.d.ts +12 -0
- package/build/types/framework/plugins/index.d.ts +5 -0
- package/build/types/framework/plugins/mcp.plugin.d.ts +15 -0
- package/build/types/framework/plugins/openapi.plugin.d.ts +58 -0
- package/build/types/framework/plugins/security/body-limit.d.ts +1 -0
- package/build/types/framework/plugins/security/cors.d.ts +10 -0
- package/build/types/framework/plugins/security/csrf.d.ts +2 -0
- package/build/types/framework/plugins/security/headers.d.ts +1 -0
- package/build/types/framework/plugins/security/index.d.ts +13 -0
- package/build/types/framework/plugins/security/method-guard.d.ts +1 -0
- package/build/types/framework/plugins/security/rate-limit.d.ts +5 -0
- package/build/types/framework/repositories.d.ts +5 -0
- package/build/types/framework/responses/error.d.ts +13 -0
- package/build/types/framework/responses/helpers.d.ts +7 -0
- package/build/types/framework/responses/http-throwable.d.ts +14 -0
- package/build/types/framework/responses/http.d.ts +13 -0
- package/build/types/framework/responses/index.d.ts +4 -0
- package/build/types/framework/runtime/bun/server.d.ts +2 -0
- package/build/types/framework/runtime/deno/server.d.ts +2 -0
- package/build/types/framework/runtime/index.d.ts +17 -0
- package/build/types/framework/runtime/node/reply.d.ts +12 -0
- package/build/types/framework/runtime/node/request.d.ts +33 -0
- package/build/types/framework/runtime/node/server.d.ts +2 -0
- package/build/types/framework/runtime/web/server.d.ts +1 -0
- package/build/types/framework/services.d.ts +5 -0
- package/build/types/framework/utilities/alias-path.util.d.ts +1 -0
- package/build/types/framework/utilities/artifact.util.d.ts +7 -0
- package/build/types/framework/utilities/callable.util.d.ts +1 -0
- package/build/types/framework/utilities/cookie.util.d.ts +1 -0
- package/build/types/framework/utilities/csrf.util.d.ts +26 -0
- package/build/types/framework/utilities/https.util.d.ts +49 -0
- package/build/types/framework/utilities/index.d.ts +12 -0
- package/build/types/framework/utilities/ip.util.d.ts +15 -0
- package/build/types/framework/utilities/json.util.d.ts +10 -0
- package/build/types/framework/utilities/openapi.utils.d.ts +7 -0
- package/build/types/framework/utilities/openapi.utils.impl.d.ts +18 -0
- package/build/types/framework/utilities/path.util.d.ts +3 -0
- package/build/types/framework/utilities/route-suggestion.util.d.ts +10 -0
- package/build/types/framework/utilities/url.util.d.ts +1 -0
- package/build/types/framework/utilities/utilities.util.d.ts +3 -0
- package/build/types/framework/utilities/validation.util.d.ts +8 -0
- package/build/types/framework/view-model.d.ts +4 -0
- package/build/types/generators/artifact.templates.d.ts +7 -0
- package/build/types/generators/index.d.ts +2 -0
- package/build/types/generators/project.templates.d.ts +21 -0
- package/build/types/manifest/client.d.ts +12 -0
- package/build/types/manifest/contract.d.ts +25 -0
- package/build/types/manifest/index.d.ts +5 -0
- package/build/types/manifest/introspect.d.ts +18 -0
- package/build/types/manifest/manifest.d.ts +18 -0
- package/build/types/manifest/schema.d.ts +241 -0
- package/build/types/requirements.d.ts +1 -0
- package/build/types/types/access-guards.d.ts +4 -0
- package/build/types/types/application.d.ts +32 -0
- package/build/types/types/artifact.d.ts +8 -0
- package/build/types/types/builder.d.ts +37 -0
- package/build/types/types/config.d.ts +112 -0
- package/build/types/types/controller.d.ts +27 -0
- package/build/types/types/contruct.d.ts +1 -0
- package/build/types/types/core.d.ts +11 -0
- package/build/types/types/csrf.d.ts +33 -0
- package/build/types/types/directory.d.ts +6 -0
- package/build/types/types/encryption.d.ts +14 -0
- package/build/types/types/generic.d.ts +2 -0
- package/build/types/types/guard.d.ts +9 -0
- package/build/types/types/http-responses.d.ts +7 -0
- package/build/types/types/index.d.ts +27 -0
- package/build/types/types/injection.d.ts +11 -0
- package/build/types/types/lifecycle.d.ts +9 -0
- package/build/types/types/mcp.d.ts +148 -0
- package/build/types/types/middleware.d.ts +12 -0
- package/build/types/types/parseable.d.ts +3 -0
- package/build/types/types/plugin.d.ts +6 -0
- package/build/types/types/raiton.d.ts +13 -0
- package/build/types/types/responses.d.ts +20 -0
- package/build/types/types/router.d.ts +13 -0
- package/build/types/types/runtime.d.ts +48 -0
- package/build/types/types/scheduler.d.ts +140 -0
- package/build/types/types/scheme.d.ts +125 -0
- package/build/types/types/server.d.ts +10 -0
- package/build/types/types/socket.d.ts +11 -0
- package/build/types/types/thread.d.ts +25 -0
- package/build/types/types/utilities.d.ts +4 -0
- package/build/types/types/values.d.ts +2 -0
- package/docs/AGENTS.md +55 -0
- package/docs/CLAUDE.md +55 -0
- package/docs/README.md +5 -0
- package/docs/contributors/cli/README.md +17 -3
- package/docs/contributors/cli/commands.md +28 -17
- package/docs/contributors/framework/plugins/openapi.md +12 -3
- package/docs/generated/cli/commands.md +31 -0
- package/docs/generated/config-schema.json +243 -0
- package/docs/generated/manifest-schema.json +312 -0
- package/docs/generated/manifest.json +118 -0
- package/docs/llms-full.txt +1450 -0
- package/docs/llms.txt +51 -0
- package/docs/user-guide/README.md +19 -12
- package/docs/user-guide/cli.md +26 -0
- package/docs/user-guide/config.md +32 -0
- package/docs/user-guide/contracts.md +67 -0
- package/docs/user-guide/debug.md +130 -0
- package/docs/user-guide/en/README.md +83 -0
- package/docs/user-guide/getting-started.md +13 -1
- package/docs/user-guide/mcp.md +45 -2
- package/docs/user-guide/observability.md +74 -0
- package/docs/user-guide/openapi/plugin.md +10 -0
- package/docs/user-guide/recipes/README.md +32 -0
- package/docs/user-guide/recipes/contracts.md +52 -0
- package/docs/user-guide/recipes/doctor.md +16 -0
- package/docs/user-guide/recipes/generate.md +28 -0
- package/docs/user-guide/recipes/manifest.md +17 -0
- package/docs/user-guide/recipes/mcp-stdio.md +35 -0
- package/docs/user-guide/recipes/new-project.md +34 -0
- package/docs/user-guide/recipes/observability.md +17 -0
- package/package.json +42 -7
- package/scripts/bench-ai-debug.ts +572 -0
- package/scripts/bench.ts +586 -0
- package/scripts/postinstall.mjs +15 -0
- package/source/bin/cli-output.ts +139 -0
- package/source/bin/commands.registry.ts +31 -3
- package/source/bin/file-utils.ts +95 -0
- package/source/bin/name-utils.ts +26 -0
- package/source/bin/project-utils.ts +78 -0
- package/source/commands/artifact.command.ts +30 -15
- package/source/commands/call.command.ts +247 -0
- package/source/commands/client.command.ts +64 -0
- package/source/commands/contract.command.ts +104 -0
- package/source/commands/debug.shared.ts +90 -0
- package/source/commands/docs.command.ts +269 -0
- package/source/commands/doctor.command.ts +226 -0
- package/source/commands/explain.command.ts +119 -0
- package/source/commands/generate.command.ts +58 -0
- package/source/commands/inspect.command.ts +108 -0
- package/source/commands/mcp.command.ts +322 -0
- package/source/commands/new.command.ts +135 -0
- package/source/commands/openapi.command.ts +95 -0
- package/source/commands/requests.command.ts +137 -0
- package/source/commands/routes.command.ts +39 -0
- package/source/commands/verify.command.ts +173 -0
- package/source/commands/why.command.ts +61 -0
- package/source/contracts/decorators.ts +216 -0
- package/source/contracts/errors.ts +135 -0
- package/source/contracts/index.ts +4 -0
- package/source/contracts/schema.ts +438 -0
- package/source/contracts/typebox.ts +193 -0
- package/source/core/application.ts +322 -72
- package/source/core/builder.ts +10 -2
- package/source/core/config/config.ts +155 -26
- package/source/core/config/define.ts +35 -8
- package/source/core/config/index.ts +2 -1
- package/source/core/config/schema.ts +406 -0
- package/source/core/controller/builder.ts +38 -13
- package/source/core/controller/compiler.ts +14 -7
- package/source/core/controller/metadata.ts +1 -1
- package/source/core/hooks.ts +13 -1
- package/source/core/injection/injection.ts +47 -9
- package/source/core/mcp/builder.ts +13 -2
- package/source/core/mcp/metadata.ts +2 -1
- package/source/core/middleware/compose.ts +48 -0
- package/source/core/middleware/pipeline.ts +69 -46
- package/source/core/raiton.ts +8 -0
- package/source/core/router/handler.ts +246 -37
- package/source/core/router/handler.utils.ts +107 -51
- package/source/core/router/matcher.ts +195 -24
- package/source/core/router/route.ts +100 -31
- package/source/core/router/router.ts +27 -2
- package/source/core/scheduler/metadata.ts +1 -1
- package/source/core/socket/metadata.ts +1 -1
- package/source/core/thread.ts +37 -2
- package/source/debug/cli.ts +206 -0
- package/source/debug/collector.internal.ts +27 -0
- package/source/debug/collector.ts +294 -0
- package/source/debug/config.ts +142 -0
- package/source/debug/examples.ts +188 -0
- package/source/debug/explain.ts +187 -0
- package/source/debug/index.ts +15 -0
- package/source/debug/invocation.ts +695 -0
- package/source/debug/journal.ts +249 -0
- package/source/debug/mcp-http.ts +145 -0
- package/source/debug/mcp.ts +410 -0
- package/source/debug/redaction.ts +225 -0
- package/source/debug/requests.ts +136 -0
- package/source/debug/runtime.ts +181 -0
- package/source/debug/session.ts +107 -0
- package/source/debug/source.ts +95 -0
- package/source/debug/surface.ts +375 -0
- package/source/debug/types.ts +311 -0
- package/source/debug/verify.ts +186 -0
- package/source/framework/artifacts.ts +47 -15
- package/source/framework/cache/cache.ts +48 -3
- package/source/framework/constants/decorators.constant.ts +5 -0
- package/source/framework/data-transfer-object.ts +4 -3
- package/source/framework/decorators/controllable.decorator.ts +3 -3
- package/source/framework/decorators/csrf-guard.decorator.ts +3 -2
- package/source/framework/decorators/csrf-token.decorator.ts +1 -1
- package/source/framework/decorators/guard.decorator.ts +3 -2
- package/source/framework/decorators/health-check.decorator.ts +1 -1
- package/source/framework/decorators/mcp.decorator.ts +38 -7
- package/source/framework/decorators/middleware.decorator.ts +2 -2
- package/source/framework/decorators/parametrable.decorator.ts +2 -1
- package/source/framework/decorators/routable.decorator.ts +3 -3
- package/source/framework/decorators/route-interaction.decorator.ts +2 -2
- package/source/framework/decorators/scheduler.decorator.ts +3 -3
- package/source/framework/decorators/socket.decorator.ts +3 -3
- package/source/framework/encryption.ts +46 -7
- package/source/framework/errors/catalog.ts +205 -0
- package/source/framework/exceptions/http-exception.ts +1 -1
- package/source/framework/health-check.ts +18 -0
- package/source/framework/index.ts +2 -0
- package/source/framework/mcp/audit.ts +57 -0
- package/source/framework/mcp/conformance.ts +195 -0
- package/source/framework/mcp/handler.ts +139 -9
- package/source/framework/mcp/index.ts +6 -1
- package/source/framework/mcp/protocol.ts +6 -0
- package/source/framework/mcp/rate-limit.ts +33 -0
- package/source/framework/mcp/stdio.ts +150 -0
- package/source/framework/mcp/streamable-http.ts +36 -5
- package/source/framework/observability/index.ts +6 -0
- package/source/framework/observability/metrics.ts +162 -0
- package/source/framework/observability/plugin.ts +151 -0
- package/source/framework/observability/readiness.ts +22 -0
- package/source/framework/observability/request.ts +31 -0
- package/source/framework/observability/shutdown.ts +68 -0
- package/source/framework/observability/trace.ts +241 -0
- package/source/framework/plugins/body-parser.plugin.ts +88 -85
- package/source/framework/plugins/dev.plugin.ts +227 -0
- package/source/framework/plugins/index.ts +2 -1
- package/source/framework/plugins/mcp.plugin.ts +14 -3
- package/source/framework/plugins/openapi.plugin.ts +56 -13
- package/source/framework/responses/helpers.ts +4 -4
- package/source/framework/responses/http-throwable.ts +1 -1
- package/source/framework/runtime/bun/server.ts +2 -1
- package/source/framework/runtime/deno/server.ts +2 -1
- package/source/framework/runtime/index.ts +45 -13
- package/source/framework/runtime/node/request.ts +59 -13
- package/source/framework/utilities/index.ts +3 -1
- package/source/framework/utilities/openapi.utils.impl.ts +733 -0
- package/source/framework/utilities/openapi.utils.ts +6 -636
- package/source/framework/utilities/route-suggestion.util.ts +59 -0
- package/source/framework/utilities/validation.util.ts +20 -0
- package/source/generators/artifact.templates.ts +230 -0
- package/source/generators/index.ts +2 -0
- package/source/generators/project.templates.ts +392 -0
- package/source/manifest/client.ts +299 -0
- package/source/manifest/contract.ts +138 -0
- package/source/manifest/index.ts +5 -0
- package/source/manifest/introspect.ts +57 -0
- package/source/manifest/manifest.ts +364 -0
- package/source/manifest/schema.ts +200 -0
- package/source/types/builder.ts +5 -0
- package/source/types/config.ts +120 -2
- package/source/types/mcp.ts +63 -1
- package/tsconfig.build.json +13 -0
- package/source/commands/grafts.command.ts +0 -27
- package/tests/artifact-resolution.test.ts +0 -60
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RouteHandlerCallable } from '../../types/index.ts';
|
|
2
|
+
import { HttpMethod } from "../../framework/enums/http-method.enum.ts";
|
|
3
|
+
import { Route } from './route.ts';
|
|
4
|
+
export declare class Router {
|
|
5
|
+
private matcher;
|
|
6
|
+
add(method: HttpMethod, path: string, handler: RouteHandlerCallable, version?: string): Route;
|
|
7
|
+
remove(route: Route): void;
|
|
8
|
+
replace(route: Route): Route;
|
|
9
|
+
/**
|
|
10
|
+
* Compatibilité : renvoie la `Route` correspondante. Les paramètres ne sont
|
|
11
|
+
* plus stockés sur l'instance ; utilisez `resolve()` pour les obtenir.
|
|
12
|
+
*/
|
|
13
|
+
match(method: string, url: string): Route | null;
|
|
14
|
+
/** Résout la route et les paramètres propres à cette requête. */
|
|
15
|
+
resolve(method: string, url: string): import("./matcher.ts").RouteResolution | null;
|
|
16
|
+
/**
|
|
17
|
+
* Return a route matching the URL regardless of method. Used to answer 405
|
|
18
|
+
* instead of 404 when the path exists.
|
|
19
|
+
*/
|
|
20
|
+
matchPath(url: string): Route | null;
|
|
21
|
+
reset(): void;
|
|
22
|
+
getRoutes(): Route[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure cron expression parser and next-run engine. No external dependency.
|
|
3
|
+
*
|
|
4
|
+
* Supports the classic 5-field (`minute hour day-of-month month day-of-week`)
|
|
5
|
+
* and extended 6-field (`second minute hour day-of-month month day-of-week`)
|
|
6
|
+
* formats, plus named values, lists, ranges, steps and the standard macros.
|
|
7
|
+
*
|
|
8
|
+
* Day-of-month / day-of-week follow Vixie-cron semantics: when both fields are
|
|
9
|
+
* restricted (not `*` / `?`), a day matches when *either* field matches.
|
|
10
|
+
*/
|
|
11
|
+
export interface CronFieldRange {
|
|
12
|
+
min: number;
|
|
13
|
+
max: number;
|
|
14
|
+
}
|
|
15
|
+
export interface CronScheduleInterface {
|
|
16
|
+
readonly expression: string;
|
|
17
|
+
readonly timezone?: string;
|
|
18
|
+
next(from?: Date): Date | null;
|
|
19
|
+
nextN(count: number, from?: Date): Date[];
|
|
20
|
+
matches(date: Date): boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function parseCron(expression: string, timezone?: string): CronScheduleInterface;
|
|
23
|
+
export declare class CronSchedule implements CronScheduleInterface {
|
|
24
|
+
readonly expression: string;
|
|
25
|
+
readonly timezone?: string;
|
|
26
|
+
private readonly fields;
|
|
27
|
+
constructor(expression: string, timezone?: string);
|
|
28
|
+
next(from?: Date): Date | null;
|
|
29
|
+
nextN(count: number, from?: Date): Date[];
|
|
30
|
+
matches(date: Date): boolean;
|
|
31
|
+
private parse;
|
|
32
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses human-readable durations into milliseconds.
|
|
3
|
+
*
|
|
4
|
+
* Accepts a bare number (already milliseconds) or a string made of one or more
|
|
5
|
+
* `<value><unit>` groups such as `"5s"`, `"1m30s"`, `"2 hours"` or `"500ms"`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseDuration(value: number | string): number;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { JobMetaInterface, QueueBackendInterface, SchedulerConfigInterface, SchedulerControlInterface, ScheduledJobInfoInterface, TaskInvocationInterface } from "../../types/index.ts";
|
|
2
|
+
export declare class SchedulerManager implements SchedulerControlInterface {
|
|
3
|
+
private static _instance;
|
|
4
|
+
private readonly _config;
|
|
5
|
+
private readonly _backends;
|
|
6
|
+
private readonly _queueBackends;
|
|
7
|
+
private readonly _jobs;
|
|
8
|
+
private readonly _timers;
|
|
9
|
+
private readonly _consumers;
|
|
10
|
+
private _defaultBackend;
|
|
11
|
+
private _running;
|
|
12
|
+
private _booted;
|
|
13
|
+
constructor();
|
|
14
|
+
static get current(): SchedulerManager;
|
|
15
|
+
get enabled(): boolean;
|
|
16
|
+
get running(): boolean;
|
|
17
|
+
configure(config: Partial<SchedulerConfigInterface>): this;
|
|
18
|
+
registerBackend(name: string, backend: QueueBackendInterface): this;
|
|
19
|
+
getBackend(queue?: string): QueueBackendInterface;
|
|
20
|
+
mapQueue(queue: string, backendName: string): this;
|
|
21
|
+
get backends(): Map<string, QueueBackendInterface>;
|
|
22
|
+
register(name: string, instance: any, jobs: JobMetaInterface[]): this;
|
|
23
|
+
start(): Promise<void>;
|
|
24
|
+
stop(): Promise<void>;
|
|
25
|
+
has(name: string): boolean;
|
|
26
|
+
getJob(name: string): ScheduledJobInfoInterface | undefined;
|
|
27
|
+
getJobs(): ScheduledJobInfoInterface[];
|
|
28
|
+
enqueue(name: string, payload?: any, options?: Partial<TaskInvocationInterface>): Promise<TaskInvocationInterface>;
|
|
29
|
+
dispatch(name: string, payload?: any, options?: Partial<TaskInvocationInterface>): Promise<any>;
|
|
30
|
+
trigger(name: string, payload?: any, options?: Partial<TaskInvocationInterface>): Promise<any>;
|
|
31
|
+
pause(name: string): void;
|
|
32
|
+
resume(name: string): void;
|
|
33
|
+
cancel(name: string): boolean;
|
|
34
|
+
private resolveOptions;
|
|
35
|
+
private startJob;
|
|
36
|
+
private armCron;
|
|
37
|
+
private armInterval;
|
|
38
|
+
private armTimeout;
|
|
39
|
+
private tick;
|
|
40
|
+
private dispatchNow;
|
|
41
|
+
private runOnce;
|
|
42
|
+
private consume;
|
|
43
|
+
private processMessage;
|
|
44
|
+
private buildContext;
|
|
45
|
+
private info;
|
|
46
|
+
private clearTimer;
|
|
47
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SchedulerMetaInterface, SchedulerRegistrationInterface } from "../../types/index.ts";
|
|
2
|
+
import "reflect-metadata";
|
|
3
|
+
export declare function getSchedulerMetadata(target: any): SchedulerMetaInterface;
|
|
4
|
+
export declare function registerScheduler(construct: any): SchedulerRegistrationInterface;
|
|
5
|
+
export declare function unregisterScheduler(constructOrName: string | any): boolean;
|
|
6
|
+
export declare function getSchedulerRegistry(): Map<string, SchedulerRegistrationInterface>;
|
|
7
|
+
export declare function getScheduler(name: string): SchedulerRegistrationInterface | undefined;
|
|
8
|
+
export declare function clearSchedulerRegistry(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { QueueBackendInterface, QueueDequeueOptionsInterface, QueueMessageInterface } from "../../../types/index.ts";
|
|
2
|
+
export declare abstract class BaseQueueBackend implements QueueBackendInterface {
|
|
3
|
+
abstract readonly name: string;
|
|
4
|
+
protected connected: boolean;
|
|
5
|
+
get isConnected(): boolean;
|
|
6
|
+
abstract connect(): Promise<void>;
|
|
7
|
+
abstract disconnect(): Promise<void>;
|
|
8
|
+
abstract enqueue(queue: string, message: QueueMessageInterface): Promise<string>;
|
|
9
|
+
abstract dequeue(queue: string, options?: QueueDequeueOptionsInterface): Promise<QueueMessageInterface[]>;
|
|
10
|
+
abstract acknowledge(queue: string, receipt: any): Promise<void>;
|
|
11
|
+
abstract reject(queue: string, receipt: any, requeue?: boolean): Promise<void>;
|
|
12
|
+
abstract length(queue: string): Promise<number>;
|
|
13
|
+
abstract purge(queue: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function wait(milliseconds: number): Promise<void>;
|
|
16
|
+
interface MemoryReceipt {
|
|
17
|
+
queue: string;
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* In-process queue backend used by default when no external broker is
|
|
22
|
+
* configured. Supports blocking dequeue, visibility timeout and ack/nack.
|
|
23
|
+
*/
|
|
24
|
+
export declare class MemoryQueueBackend extends BaseQueueBackend {
|
|
25
|
+
readonly name = "memory";
|
|
26
|
+
private readonly queues;
|
|
27
|
+
private readonly visibilityMs;
|
|
28
|
+
constructor(options?: {
|
|
29
|
+
visibilityMs?: number;
|
|
30
|
+
});
|
|
31
|
+
connect(): Promise<void>;
|
|
32
|
+
disconnect(): Promise<void>;
|
|
33
|
+
enqueue(queue: string, message: QueueMessageInterface): Promise<string>;
|
|
34
|
+
dequeue(queue: string, options?: QueueDequeueOptionsInterface): Promise<QueueMessageInterface[]>;
|
|
35
|
+
acknowledge(_queue: string, receipt: MemoryReceipt): Promise<void>;
|
|
36
|
+
reject(queue: string, receipt: MemoryReceipt, requeue?: boolean): Promise<void>;
|
|
37
|
+
length(queue: string): Promise<number>;
|
|
38
|
+
purge(queue: string): Promise<void>;
|
|
39
|
+
private list;
|
|
40
|
+
private tryDequeue;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseQueueBackend } from "./backend.ts";
|
|
2
|
+
import type { QueueDequeueOptionsInterface, QueueMessageInterface } from "../../../types/index.ts";
|
|
3
|
+
export interface RabbitMqQueueBackendOptions {
|
|
4
|
+
url?: string;
|
|
5
|
+
connection?: any;
|
|
6
|
+
channel?: any;
|
|
7
|
+
exchange?: string;
|
|
8
|
+
persistent?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* RabbitMQ-backed queue using a single AMQP channel (`sendToQueue` to publish,
|
|
12
|
+
* `get` + manual ack/nack to consume).
|
|
13
|
+
*
|
|
14
|
+
* The `amqplib` package is imported lazily so the framework never requires it
|
|
15
|
+
* unless this backend is actually used:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {SchedulerManager, RabbitMqQueueBackend} from 'raiton/core';
|
|
19
|
+
* SchedulerManager.current.registerBackend('default', new RabbitMqQueueBackend({url: 'amqp://localhost'}))
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class RabbitMqQueueBackend extends BaseQueueBackend {
|
|
23
|
+
readonly name = "rabbitmq";
|
|
24
|
+
private connection;
|
|
25
|
+
private channel;
|
|
26
|
+
private readonly options;
|
|
27
|
+
constructor(options?: RabbitMqQueueBackendOptions);
|
|
28
|
+
connect(): Promise<void>;
|
|
29
|
+
disconnect(): Promise<void>;
|
|
30
|
+
enqueue(queue: string, message: QueueMessageInterface): Promise<string>;
|
|
31
|
+
dequeue(queue: string, options?: QueueDequeueOptionsInterface): Promise<QueueMessageInterface[]>;
|
|
32
|
+
acknowledge(_queue: string, receipt: any): Promise<void>;
|
|
33
|
+
reject(_queue: string, receipt: any, requeue?: boolean): Promise<void>;
|
|
34
|
+
length(queue: string): Promise<number>;
|
|
35
|
+
purge(queue: string): Promise<void>;
|
|
36
|
+
private ensureConnected;
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseQueueBackend } from "./backend.ts";
|
|
2
|
+
import type { QueueDequeueOptionsInterface, QueueMessageInterface } from "../../../types/index.ts";
|
|
3
|
+
export interface RedisQueueBackendOptions {
|
|
4
|
+
url?: string;
|
|
5
|
+
client?: any;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Redis-backed queue using a reliable list pattern (enqueue with `RPUSH`,
|
|
11
|
+
* dequeue atomically with `LMOVE` to a processing list, ack with `LREM`).
|
|
12
|
+
*
|
|
13
|
+
* The `redis` package is imported lazily so the framework never requires it
|
|
14
|
+
* unless this backend is actually used:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* import {SchedulerManager, RedisQueueBackend} from 'raiton/core';
|
|
18
|
+
* SchedulerManager.current.registerBackend('default', new RedisQueueBackend({url: 'redis://localhost:6379'}))
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class RedisQueueBackend extends BaseQueueBackend {
|
|
22
|
+
readonly name = "redis";
|
|
23
|
+
private client;
|
|
24
|
+
private readonly options;
|
|
25
|
+
private readonly prefix;
|
|
26
|
+
constructor(options?: RedisQueueBackendOptions);
|
|
27
|
+
connect(): Promise<void>;
|
|
28
|
+
disconnect(): Promise<void>;
|
|
29
|
+
enqueue(queue: string, message: QueueMessageInterface): Promise<string>;
|
|
30
|
+
dequeue(queue: string, options?: QueueDequeueOptionsInterface): Promise<QueueMessageInterface[]>;
|
|
31
|
+
acknowledge(queue: string, receipt: any): Promise<void>;
|
|
32
|
+
reject(queue: string, receipt: any, requeue?: boolean): Promise<void>;
|
|
33
|
+
length(queue: string): Promise<number>;
|
|
34
|
+
purge(queue: string): Promise<void>;
|
|
35
|
+
private key;
|
|
36
|
+
private processingKey;
|
|
37
|
+
private ensureConnected;
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ServerInterface, ServerOptionsInterface } from "../types/index.ts";
|
|
2
|
+
export declare class Server implements ServerInterface {
|
|
3
|
+
readonly options: ServerOptionsInterface;
|
|
4
|
+
protected static _instance?: Server;
|
|
5
|
+
static get instance(): Server | undefined;
|
|
6
|
+
static set instance(value: Server);
|
|
7
|
+
constructor(options: ServerOptionsInterface);
|
|
8
|
+
option<K extends keyof ServerOptionsInterface>(key: K): ServerOptionsInterface[K];
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function compileSocket(SocketClass: any): import("./metadata.ts").SocketRegistryEntryInterface;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConstructorType, SocketMetaInterface } from "../../types/index.ts";
|
|
2
|
+
import "reflect-metadata";
|
|
3
|
+
export interface SocketRegistryEntryInterface {
|
|
4
|
+
namespace: string;
|
|
5
|
+
construct: ConstructorType;
|
|
6
|
+
metadata: SocketMetaInterface;
|
|
7
|
+
}
|
|
8
|
+
export declare function getSocketMetadata(target: any): SocketMetaInterface;
|
|
9
|
+
export declare function registerSocket(construct: any): SocketRegistryEntryInterface;
|
|
10
|
+
export declare function unregisterSocket(constructOrNamespace: string | any): boolean;
|
|
11
|
+
export declare function getSocketRegistry(): Map<string, SocketRegistryEntryInterface>;
|
|
12
|
+
export declare function getSocketForNamespace(namespace: string): SocketRegistryEntryInterface | undefined;
|
|
13
|
+
export declare function findSocketForPath(pathname: string, prefix?: string): SocketRegistryEntryInterface | undefined;
|
|
14
|
+
export declare function clearSocketRegistry(): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BuilderInterface, RuntimeAdapterInterface, RuntimeServerInterface, ThreadInterface, ThreadOptionsInterface, ThreadSetupOptionsInterface, ThreadWaitCallable } from "../types/index.ts";
|
|
2
|
+
import { ApplicationInterface } from "../types/application.ts";
|
|
3
|
+
export declare class RaitonThread implements ThreadInterface {
|
|
4
|
+
readonly builder: BuilderInterface;
|
|
5
|
+
protected _options: ThreadOptionsInterface;
|
|
6
|
+
protected static instance: RaitonThread | null;
|
|
7
|
+
static get current(): RaitonThread | null;
|
|
8
|
+
static reset(): void;
|
|
9
|
+
application: ApplicationInterface | null;
|
|
10
|
+
runtime: RuntimeAdapterInterface | null;
|
|
11
|
+
runtimeServer: RuntimeServerInterface | null;
|
|
12
|
+
readonly appDir: string;
|
|
13
|
+
constructor(builder: BuilderInterface, _options?: ThreadOptionsInterface);
|
|
14
|
+
restart(): void;
|
|
15
|
+
stop(): Promise<void>;
|
|
16
|
+
sleep(milliseconds: number): Promise<unknown>;
|
|
17
|
+
wait(condition: ThreadWaitCallable): Promise<void>;
|
|
18
|
+
protected getNetworkIp(): string | null;
|
|
19
|
+
setup({ application, runtime }: ThreadSetupOptionsInterface): this;
|
|
20
|
+
run(): Promise<this>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ApplicationInterface } from "../types/application.ts";
|
|
2
|
+
import type { ProjectManifest } from "../manifest/schema.ts";
|
|
3
|
+
import { type DebugRuntimeState } from "./runtime.ts";
|
|
4
|
+
import type { DebugInvocationRequest, DebugInvocationResult, DebugJournalEntry } from "./types.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Enable the journal on an application booted without a socket, so `raiton
|
|
7
|
+
* call` and `raiton verify` can capture the in-process exchange and `explain`
|
|
8
|
+
* can read it back later.
|
|
9
|
+
*/
|
|
10
|
+
export declare function enableCliDebug(application: ApplicationInterface, workdir: string): DebugRuntimeState;
|
|
11
|
+
export declare function baseUrlOf(application?: ApplicationInterface): string;
|
|
12
|
+
export interface RemoteDebugOptions {
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
token?: string;
|
|
15
|
+
timeoutMs?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface RemoteDebugResponse {
|
|
18
|
+
status: number;
|
|
19
|
+
body: any;
|
|
20
|
+
}
|
|
21
|
+
/** Call the HTTP debug surface of a running application. */
|
|
22
|
+
export declare function remoteDebug(options: RemoteDebugOptions, path: string, init?: {
|
|
23
|
+
method?: string;
|
|
24
|
+
body?: any;
|
|
25
|
+
}): Promise<RemoteDebugResponse>;
|
|
26
|
+
/** Probe whether a running application exposes the debug surface. */
|
|
27
|
+
export declare function probeDebug(options: RemoteDebugOptions): Promise<RemoteDebugResponse | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Convert an invocation result into a journal entry. Used when the request ran
|
|
30
|
+
* through the CLI's in-process application without an active collector.
|
|
31
|
+
*/
|
|
32
|
+
export declare function entryFromInvocation(manifest: ProjectManifest, spec: DebugInvocationRequest, result: DebugInvocationResult): DebugJournalEntry;
|
|
33
|
+
export declare function appendInvocationEntry(entry: DebugJournalEntry, workdir: string): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ContractIssue } from "../contracts/index.ts";
|
|
2
|
+
import { summarizeValue } from "./redaction.ts";
|
|
3
|
+
import type { DebugJournal } from "./journal.ts";
|
|
4
|
+
import type { DebugErrorLike } from "./collector.internal.ts";
|
|
5
|
+
import type { ResolvedDebugConfig } from "./types.ts";
|
|
6
|
+
import type { DebugJournalEntry, DebugRouteSource, DebugValidationIssue, DebugValidationSummary } from "./types.ts";
|
|
7
|
+
export interface DebugCollectorOptions {
|
|
8
|
+
config: ResolvedDebugConfig;
|
|
9
|
+
journal: DebugJournal;
|
|
10
|
+
buildId: string;
|
|
11
|
+
development: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Convert contract issues to the journal/explanation shape. */
|
|
14
|
+
export declare function toDebugIssues(issues: ContractIssue[] | undefined, redact?: string[]): DebugValidationIssue[];
|
|
15
|
+
/**
|
|
16
|
+
* Request-scoped collector.
|
|
17
|
+
*
|
|
18
|
+
* `start()` allocates one trace only when the journal is enabled. Disabled
|
|
19
|
+
* debug surfaces never call this class at all (see `runtime.ts`).
|
|
20
|
+
*/
|
|
21
|
+
export declare class DebugCollector {
|
|
22
|
+
buildId: string;
|
|
23
|
+
readonly config: ResolvedDebugConfig;
|
|
24
|
+
readonly journal: DebugJournal;
|
|
25
|
+
private readonly development;
|
|
26
|
+
constructor(options: DebugCollectorOptions);
|
|
27
|
+
get enabled(): boolean;
|
|
28
|
+
start(ctx: any): void;
|
|
29
|
+
step(ctx: any, step: string, result?: string, durationMs?: number, detail?: string): void;
|
|
30
|
+
markHandler(ctx: any, executed: boolean): void;
|
|
31
|
+
setSource(ctx: any, source: DebugRouteSource | undefined): void;
|
|
32
|
+
setValidation(ctx: any, summary: DebugValidationSummary | undefined): void;
|
|
33
|
+
setCache(ctx: any, hit: boolean): void;
|
|
34
|
+
setError(ctx: any, error: DebugErrorLike | undefined): void;
|
|
35
|
+
setResponseBody(ctx: any, body: any): void;
|
|
36
|
+
setStatus(ctx: any, status: number): void;
|
|
37
|
+
finish(ctx: any): DebugJournalEntry | undefined;
|
|
38
|
+
ack(ctx: any): void;
|
|
39
|
+
private state;
|
|
40
|
+
}
|
|
41
|
+
export { summarizeValue };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DebugRouteSource, DebugTimelineStep, DebugValidationSummary } from "./types.ts";
|
|
2
|
+
export interface DebugErrorLike {
|
|
3
|
+
code: string;
|
|
4
|
+
message: string;
|
|
5
|
+
statusCode?: number;
|
|
6
|
+
stack?: string[];
|
|
7
|
+
location?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Request-scoped capture state, attached to `ctx.state.debug`. */
|
|
10
|
+
export interface DebugTraceState {
|
|
11
|
+
startedAt: string;
|
|
12
|
+
startPerf: number;
|
|
13
|
+
requestId: string;
|
|
14
|
+
traceId: string;
|
|
15
|
+
method: string;
|
|
16
|
+
pathname: string;
|
|
17
|
+
timeline: DebugTimelineStep[];
|
|
18
|
+
handlerExecuted: boolean;
|
|
19
|
+
validation?: DebugValidationSummary;
|
|
20
|
+
error?: DebugErrorLike;
|
|
21
|
+
source?: DebugRouteSource;
|
|
22
|
+
cache?: {
|
|
23
|
+
hit: boolean;
|
|
24
|
+
};
|
|
25
|
+
responseBody?: any;
|
|
26
|
+
captured: boolean;
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ResolvedDebugConfig } from "./types.ts";
|
|
2
|
+
export declare function envFlag(name: string): boolean | undefined;
|
|
3
|
+
export interface ResolveDebugOptions {
|
|
4
|
+
development: boolean;
|
|
5
|
+
/** Project root, used to resolve source locations and session files. */
|
|
6
|
+
workdir?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the debug section against defaults and environment variables.
|
|
10
|
+
*
|
|
11
|
+
* Production safety: surfaces stay disabled unless `debug.enabled` (or
|
|
12
|
+
* `RAITON_DEBUG`) is explicitly enabled. Even when enabled, the HTTP surface
|
|
13
|
+
* defaults to a loopback-only binding and an optional token.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveDebugConfig(options: ResolveDebugOptions): ResolvedDebugConfig;
|
|
16
|
+
/** Constant-time string comparison for tokens. */
|
|
17
|
+
export declare function safeCompare(left: string, right: string): boolean;
|
|
18
|
+
/** Read a debug token from either documented header or a Bearer token. */
|
|
19
|
+
export declare function readDebugToken(headers: any): string | undefined;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example generation from published JSON schemas.
|
|
3
|
+
*
|
|
4
|
+
* Examples are deterministic: the same contract always produces the same
|
|
5
|
+
* example. They are used by the manifest, OpenAPI and `raiton verify`.
|
|
6
|
+
*/
|
|
7
|
+
export interface RouteExample {
|
|
8
|
+
name: string;
|
|
9
|
+
body?: any;
|
|
10
|
+
params?: Record<string, any>;
|
|
11
|
+
query?: Record<string, any>;
|
|
12
|
+
headers?: Record<string, any>;
|
|
13
|
+
expectedStatus?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Build the smallest valid value for a JSON schema. Optional object properties
|
|
17
|
+
* are omitted so examples stay readable and token-efficient.
|
|
18
|
+
*/
|
|
19
|
+
export declare function exampleForSchema(schema: any, depth?: number): any;
|
|
20
|
+
/** Generate the default example of a route from its published schemas. */
|
|
21
|
+
export declare function defaultExample(input: {
|
|
22
|
+
bodySchema?: any;
|
|
23
|
+
paramsSchema?: any;
|
|
24
|
+
querySchema?: any;
|
|
25
|
+
headersSchema?: any;
|
|
26
|
+
expectedStatus?: number;
|
|
27
|
+
}): RouteExample;
|
|
28
|
+
/**
|
|
29
|
+
* Complete a route example with values for every `:param` in the path. Values
|
|
30
|
+
* are inferred from the parameter contract when available, otherwise `1` is
|
|
31
|
+
* used (valid for strings and integers alike).
|
|
32
|
+
*/
|
|
33
|
+
export declare function fillPathParams(example: RouteExample, routePath: string, paramsSchema?: any): RouteExample;
|
|
34
|
+
export interface RouteErrorDocumentation {
|
|
35
|
+
code: string;
|
|
36
|
+
status: number;
|
|
37
|
+
description?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Documented error codes for a route, derived from its contracts. */
|
|
40
|
+
export declare function errorsForRoute(contract?: {
|
|
41
|
+
input?: any;
|
|
42
|
+
output?: any;
|
|
43
|
+
}): RouteErrorDocumentation[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DebugExplanation, DebugJournalEntry } from "./types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Reconstruct the timeline, root cause and next actions from a journal entry.
|
|
4
|
+
* Pure function: no I/O, no side effect.
|
|
5
|
+
*/
|
|
6
|
+
export declare function explainEntry(entry: DebugJournalEntry, options?: {
|
|
7
|
+
verbose?: boolean;
|
|
8
|
+
}): DebugExplanation;
|
|
9
|
+
export declare function explainHuman(explanation: DebugExplanation): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./types.ts";
|
|
2
|
+
export * from "./redaction.ts";
|
|
3
|
+
export * from "./config.ts";
|
|
4
|
+
export * from "./journal.ts";
|
|
5
|
+
export * from "./collector.ts";
|
|
6
|
+
export * from "./runtime.ts";
|
|
7
|
+
export * from "./examples.ts";
|
|
8
|
+
export * from "./invocation.ts";
|
|
9
|
+
export * from "./explain.ts";
|
|
10
|
+
export * from "./requests.ts";
|
|
11
|
+
export * from "./verify.ts";
|
|
12
|
+
export * from "./session.ts";
|
|
13
|
+
export * from "./mcp.ts";
|
|
14
|
+
export * from "./mcp-http.ts";
|
|
15
|
+
export * from "./surface.ts";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ApplicationInterface } from "../types/application.ts";
|
|
2
|
+
import type { ProjectManifest, ProjectRouteManifest } from "../manifest/schema.ts";
|
|
3
|
+
import type { ResolvedDebugConfig } from "./types.ts";
|
|
4
|
+
import type { DebugContractStatus, DebugInvocationRequest, DebugInvocationResult, DebugResolvedRequest } from "./types.ts";
|
|
5
|
+
import { DEFAULT_REDACT_KEYS } from "./redaction.ts";
|
|
6
|
+
import { exampleForSchema } from "./examples.ts";
|
|
7
|
+
import type { DebugJournalEntry, DebugReplayComparison } from "./types.ts";
|
|
8
|
+
export declare class DebugInvocationError extends Error {
|
|
9
|
+
readonly code: string;
|
|
10
|
+
readonly hint: string;
|
|
11
|
+
readonly location?: string;
|
|
12
|
+
readonly exitCode: number;
|
|
13
|
+
constructor(message: string, options?: {
|
|
14
|
+
code?: string;
|
|
15
|
+
hint?: string;
|
|
16
|
+
location?: string;
|
|
17
|
+
exitCode?: number;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export interface InvocationContext {
|
|
21
|
+
manifest: ProjectManifest;
|
|
22
|
+
application?: ApplicationInterface;
|
|
23
|
+
config?: ResolvedDebugConfig;
|
|
24
|
+
baseUrl?: string;
|
|
25
|
+
workdir?: string;
|
|
26
|
+
development?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface PreparedInvocation {
|
|
29
|
+
resolved: DebugResolvedRequest;
|
|
30
|
+
raw: {
|
|
31
|
+
headers: Record<string, string>;
|
|
32
|
+
query: Record<string, any>;
|
|
33
|
+
params: Record<string, any>;
|
|
34
|
+
body?: any;
|
|
35
|
+
};
|
|
36
|
+
route?: ProjectRouteManifest;
|
|
37
|
+
contract: DebugContractStatus;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve and validate an invocation without sending it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function prepareInvocation(context: InvocationContext, spec: DebugInvocationRequest): Promise<PreparedInvocation>;
|
|
43
|
+
/**
|
|
44
|
+
* Resolve, validate, send and normalize a route invocation. Input validation
|
|
45
|
+
* runs before any handler execution; an invalid payload is never sent.
|
|
46
|
+
*/
|
|
47
|
+
export declare function invokeRoute(context: InvocationContext, spec: DebugInvocationRequest): Promise<DebugInvocationResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Compare a replay with the original journal entry. Captured bodies may be
|
|
50
|
+
* absent in metadata mode, in which case the body comparison is `unknown`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function compareReplay(previous: DebugJournalEntry, result: DebugInvocationResult): DebugReplayComparison;
|
|
53
|
+
export { DEFAULT_REDACT_KEYS, exampleForSchema };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DebugJournalEntry, DebugJournalFilter } from "./types.ts";
|
|
2
|
+
export declare function estimateEntryBytes(entry: DebugJournalEntry): number;
|
|
3
|
+
export interface DebugJournalOptions {
|
|
4
|
+
capacity?: number;
|
|
5
|
+
ttlMs?: number;
|
|
6
|
+
maxTotalBytes?: number;
|
|
7
|
+
now?: () => number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Bounded in-memory request journal.
|
|
11
|
+
*
|
|
12
|
+
* - O(1) lookup by `requestId` through a Map.
|
|
13
|
+
* - The ring buffer evicts the oldest entry first; the memory footprint never
|
|
14
|
+
* grows with the total number of processed requests.
|
|
15
|
+
* - Entries are stored as references/scalars: serialization is deferred to the
|
|
16
|
+
* reader (`requests`, `explain`, HTTP and MCP tools).
|
|
17
|
+
*/
|
|
18
|
+
export declare class DebugJournal {
|
|
19
|
+
readonly capacity: number;
|
|
20
|
+
readonly ttlMs: number;
|
|
21
|
+
readonly maxTotalBytes: number;
|
|
22
|
+
private readonly now;
|
|
23
|
+
private readonly ring;
|
|
24
|
+
private readonly sizeRing;
|
|
25
|
+
private readonly index;
|
|
26
|
+
private head;
|
|
27
|
+
private count;
|
|
28
|
+
private bytes;
|
|
29
|
+
private dropped;
|
|
30
|
+
private nextPurge;
|
|
31
|
+
private buildId;
|
|
32
|
+
constructor(options?: DebugJournalOptions);
|
|
33
|
+
get size(): number;
|
|
34
|
+
get totalBytes(): number;
|
|
35
|
+
get evicted(): number;
|
|
36
|
+
/** Mark every retained entry from another build as stale (HMR). */
|
|
37
|
+
setBuildId(buildId: string): void;
|
|
38
|
+
push(entry: DebugJournalEntry, estimatedBytes?: number): void;
|
|
39
|
+
get(requestId: string): DebugJournalEntry | undefined;
|
|
40
|
+
last(): DebugJournalEntry | undefined;
|
|
41
|
+
recent(filter?: DebugJournalFilter): DebugJournalEntry[];
|
|
42
|
+
clear(): void;
|
|
43
|
+
private newest;
|
|
44
|
+
private evictOldest;
|
|
45
|
+
private remove;
|
|
46
|
+
private purgeExpired;
|
|
47
|
+
private rebuild;
|
|
48
|
+
}
|
|
49
|
+
export declare function matchStatus(status: number, filter: string): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { McpServerRegistrationInterface } from "../types/mcp.ts";
|
|
2
|
+
export interface DebugMcpHttpOptions {
|
|
3
|
+
hostname?: string;
|
|
4
|
+
port?: number;
|
|
5
|
+
token?: string;
|
|
6
|
+
scopes?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface DebugMcpHttpServer {
|
|
9
|
+
url: string;
|
|
10
|
+
close(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Standalone debug MCP HTTP server used by `raiton mcp debug --http`.
|
|
14
|
+
* The same handler as the application transport is used, so annotations,
|
|
15
|
+
* scopes, audit and error shapes are identical.
|
|
16
|
+
*/
|
|
17
|
+
export declare function serveDebugMcpHttp(entry: McpServerRegistrationInterface, options?: DebugMcpHttpOptions): Promise<DebugMcpHttpServer>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import type { McpServerRegistrationInterface } from "../types/mcp.ts";
|
|
3
|
+
import type { DebugDoctorReport, DebugJournalEntry } from "./types.ts";
|
|
4
|
+
export declare const DEBUG_MCP_SERVER_NAME = "raiton-debug";
|
|
5
|
+
/**
|
|
6
|
+
* Build (or reuse) the debug MCP server registration. Tools reuse the shared
|
|
7
|
+
* MCP handler, so audit, scopes, rate limiting, annotations and both transports
|
|
8
|
+
* behave exactly like application MCP servers.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createDebugMcpEntry(path?: string): McpServerRegistrationInterface;
|
|
11
|
+
export declare function debugMcpToolNames(): string[];
|
|
12
|
+
/** Shared diagnostic used by the `doctor.run` MCP tool and the HTTP surface. */
|
|
13
|
+
export declare function runDebugDoctor(): Promise<DebugDoctorReport>;
|
|
14
|
+
export type { DebugJournalEntry };
|