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,45 @@
|
|
|
1
|
+
import { ApplicationConfigInterface, ApplicationInterface } from "../types/application.ts";
|
|
2
|
+
import { HttpMethod } from "../framework/enums/http-method.enum.ts";
|
|
3
|
+
import { RouteHandlerCallable } from "../types/index.ts";
|
|
4
|
+
import { Injection } from "./injection/index.ts";
|
|
5
|
+
import { HttpsConfigInterface } from "../framework/utilities/https.util.ts";
|
|
6
|
+
import { type DebugRuntimeState } from "../debug/runtime.ts";
|
|
7
|
+
export declare class Application implements ApplicationInterface {
|
|
8
|
+
readonly config: ApplicationConfigInterface;
|
|
9
|
+
private root;
|
|
10
|
+
private _resolvedHttps;
|
|
11
|
+
private readonly _observability;
|
|
12
|
+
private readonly _plugins;
|
|
13
|
+
private _debug?;
|
|
14
|
+
readonly version: string;
|
|
15
|
+
static get container(): typeof Injection;
|
|
16
|
+
constructor(config: ApplicationConfigInterface);
|
|
17
|
+
protected initialize(): this;
|
|
18
|
+
/**
|
|
19
|
+
* Development mode follows HMR, explicit `develop`, or NODE_ENV.
|
|
20
|
+
*/
|
|
21
|
+
get development(): boolean;
|
|
22
|
+
get hostname(): string;
|
|
23
|
+
get https(): HttpsConfigInterface | undefined;
|
|
24
|
+
setOption<K extends keyof ApplicationConfigInterface>(key: K, value: ApplicationConfigInterface[K]): this;
|
|
25
|
+
setOptions(options: ApplicationConfigInterface): this;
|
|
26
|
+
/**
|
|
27
|
+
* Attach a debug runtime after construction. Used by CLI tooling that
|
|
28
|
+
* boots the application without a socket and then enables the journal for
|
|
29
|
+
* in-process invocation and verification.
|
|
30
|
+
*/
|
|
31
|
+
adoptDebugRuntime(runtime: DebugRuntimeState): this;
|
|
32
|
+
register(plugin: any): this;
|
|
33
|
+
use(mw: any): this;
|
|
34
|
+
route(method: HttpMethod, path: string, handler: RouteHandlerCallable, version?: string): this;
|
|
35
|
+
get(path: string, handler: RouteHandlerCallable, version?: string): this;
|
|
36
|
+
post(path: string, handler: RouteHandlerCallable, version?: string): this;
|
|
37
|
+
patch(path: string, handler: RouteHandlerCallable, version?: string): this;
|
|
38
|
+
put(path: string, handler: RouteHandlerCallable, version?: string): this;
|
|
39
|
+
delete(path: string, handler: RouteHandlerCallable, version?: string): this;
|
|
40
|
+
options(path: string, handler: RouteHandlerCallable, version?: string): this;
|
|
41
|
+
head(path: string, handler: RouteHandlerCallable, version?: string): this;
|
|
42
|
+
trace(path: string, handler: RouteHandlerCallable, version?: string): this;
|
|
43
|
+
private parseRequestUrl;
|
|
44
|
+
handle(req: any, reply: any): Promise<any>;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./artifact.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function artifactRunner(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import fs, { WatchEventType } from "node:fs";
|
|
2
|
+
import type { BuilderConfigInterface, BuilderInterface, ThreadInterface } from "../types/index.ts";
|
|
3
|
+
import { HmrChannel } from "../framework/artifacts.ts";
|
|
4
|
+
export declare class RaitonBuilder implements BuilderInterface {
|
|
5
|
+
readonly workdir: string;
|
|
6
|
+
readonly options: BuilderConfigInterface;
|
|
7
|
+
protected _source: string | null;
|
|
8
|
+
protected _out: string | null;
|
|
9
|
+
protected _bootstrapper: string | null;
|
|
10
|
+
protected _bootstrapperFile: string | null;
|
|
11
|
+
protected _compiledVersionNumber: number;
|
|
12
|
+
protected _watcher?: fs.FSWatcher;
|
|
13
|
+
constructor(workdir: string, options?: BuilderConfigInterface);
|
|
14
|
+
get source(): string | null;
|
|
15
|
+
get out(): string | null;
|
|
16
|
+
get bootstrapper(): string | null;
|
|
17
|
+
get bootstrapperFile(): string | null;
|
|
18
|
+
get watcher(): fs.FSWatcher | undefined;
|
|
19
|
+
protected parse(filename: string, type?: WatchEventType): Promise<{
|
|
20
|
+
filename: string;
|
|
21
|
+
timestamp: number;
|
|
22
|
+
version: number;
|
|
23
|
+
type: WatchEventType | undefined;
|
|
24
|
+
channel: HmrChannel;
|
|
25
|
+
artifactType: string;
|
|
26
|
+
} | undefined>;
|
|
27
|
+
protected parsing(): Promise<this>;
|
|
28
|
+
protected watching(): this;
|
|
29
|
+
protected initialize(): Promise<this>;
|
|
30
|
+
prepare(): Promise<this>;
|
|
31
|
+
protected listenHmrDi(): void;
|
|
32
|
+
protected listenHmrController(): void;
|
|
33
|
+
protected listenHmrSocket(): void;
|
|
34
|
+
protected listenHmrMiddleware(): void;
|
|
35
|
+
protected listenHmrHook(): void;
|
|
36
|
+
protected listenHmrMcp(): void;
|
|
37
|
+
protected listenHmrScheduler(): void;
|
|
38
|
+
protected build(thread: ThreadInterface): Promise<this>;
|
|
39
|
+
protected typecheck(): Promise<this>;
|
|
40
|
+
protected compile(): Promise<this>;
|
|
41
|
+
boot(): Promise<any>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
export declare class RaitonCommand {
|
|
3
|
+
readonly cli: Command;
|
|
4
|
+
readonly workdir: string;
|
|
5
|
+
readonly appdir: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly description?: string;
|
|
8
|
+
readonly version: string;
|
|
9
|
+
readonly enabled: boolean;
|
|
10
|
+
constructor(cli: Command, workdir: string, appdir?: string);
|
|
11
|
+
construct(): void;
|
|
12
|
+
register(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { RaitonCommand } from "./command.ts";
|
|
3
|
+
export declare class RaitonCommands {
|
|
4
|
+
readonly cli: Command;
|
|
5
|
+
readonly appdir: string;
|
|
6
|
+
readonly workdir: string;
|
|
7
|
+
readonly stack: Set<RaitonCommand>;
|
|
8
|
+
constructor(cli: Command, appdir: string, workdir: string);
|
|
9
|
+
harvest(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ConfigurableInterface, ObservabilityConfigInterface } from "../../types/index.ts";
|
|
2
|
+
import { ConfigFieldError } from "./schema.ts";
|
|
3
|
+
export interface ConfigLoadOptions {
|
|
4
|
+
/** Reload even when a configuration is already cached. */
|
|
5
|
+
force?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class RaitonConfig {
|
|
8
|
+
static readonly current: Map<keyof ConfigurableInterface, ConfigurableInterface[keyof ConfigurableInterface]>;
|
|
9
|
+
/** Field-scoped validation errors from the last load. */
|
|
10
|
+
static errors: ConfigFieldError[];
|
|
11
|
+
/** Source file used by the last successful load. */
|
|
12
|
+
static source: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Documented loading order. TypeScript first so `raiton.config.ts` is the
|
|
15
|
+
* canonical file; JSON remains supported for tooling and generated projects.
|
|
16
|
+
*/
|
|
17
|
+
protected static _extensions: string[];
|
|
18
|
+
static get<K extends keyof ConfigurableInterface>(key: K): ConfigurableInterface[K] | undefined;
|
|
19
|
+
static defaultConfig: ConfigurableInterface;
|
|
20
|
+
static reset(): void;
|
|
21
|
+
static toObject(): ConfigurableInterface;
|
|
22
|
+
static assertValid(): void;
|
|
23
|
+
static getObservability(): Required<ObservabilityConfigInterface>;
|
|
24
|
+
static getShutdownTimeout(): number;
|
|
25
|
+
static shouldValidateResponses(isDevelopment: boolean): boolean;
|
|
26
|
+
static sync(workdir: string, options?: ConfigLoadOptions): Promise<Map<keyof ConfigurableInterface, ConfigurableInterface[keyof ConfigurableInterface]>>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConfigurableInterface } from "../../types/config.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Typed project configuration helper. It validates field types and ranges at
|
|
4
|
+
* definition time, before the application opens a listening port.
|
|
5
|
+
*/
|
|
6
|
+
export declare function defineConfig<T extends Partial<ConfigurableInterface> = Partial<ConfigurableInterface>>(config?: T): Promise<T & ConfigurableInterface>;
|
|
7
|
+
/** Synchronous variant for configuration files that cannot await. */
|
|
8
|
+
export declare function defineConfigSync<T extends Partial<ConfigurableInterface> = Partial<ConfigurableInterface>>(config?: T): T & ConfigurableInterface;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ConfigurableInterface } from "../../types/config.ts";
|
|
2
|
+
export interface ConfigFieldError {
|
|
3
|
+
field: string;
|
|
4
|
+
message: string;
|
|
5
|
+
expected?: string;
|
|
6
|
+
received?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ConfigValidationResult {
|
|
9
|
+
valid: boolean;
|
|
10
|
+
errors: ConfigFieldError[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Validate a project configuration loaded from `raiton.config.*`.
|
|
14
|
+
* Errors are field-scoped so startup can fail with actionable messages.
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateConfig(input: Partial<ConfigurableInterface> | any): ConfigValidationResult;
|
|
17
|
+
export declare class ConfigValidationError extends Error {
|
|
18
|
+
readonly errors: ConfigFieldError[];
|
|
19
|
+
constructor(errors: ConfigFieldError[]);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* JSON Schema published for editors (autocomplete) and external validators.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getConfigJsonSchema(): Record<string, any>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RuntimeRequestInterface, RuntimeReplyInterface } from '../types/index.ts';
|
|
2
|
+
export declare class RequestContext {
|
|
3
|
+
req: RuntimeRequestInterface;
|
|
4
|
+
reply: RuntimeReplyInterface;
|
|
5
|
+
state: Record<string, any>;
|
|
6
|
+
private decorations;
|
|
7
|
+
constructor(req: RuntimeRequestInterface, reply: RuntimeReplyInterface);
|
|
8
|
+
decorate<T = any>(key: string, value: T): void;
|
|
9
|
+
get<T = any>(key: string): T;
|
|
10
|
+
send(body: any): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BuilderHMRDeclarationInterface } from "../../types/index.ts";
|
|
2
|
+
import { type ArtifactClassification } from "../../framework/artifacts.ts";
|
|
3
|
+
export declare class ControllerBuilder {
|
|
4
|
+
static scan(workdir: string): Promise<any[]>;
|
|
5
|
+
static loadDiArtifact(filename: string, version?: number, timestamp?: number): Promise<void>;
|
|
6
|
+
static build<T>({ filename, version, timestamp }: BuilderHMRDeclarationInterface, classification?: ArtifactClassification | null): Promise<T | undefined>;
|
|
7
|
+
static recompile(modulo: any, filename: string): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
interface ArtifactKinds {
|
|
10
|
+
isController: boolean;
|
|
11
|
+
isSocket: boolean;
|
|
12
|
+
isMcp: boolean;
|
|
13
|
+
isScheduler: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Sélectionne la classe réellement décorée parmi les exports d'un fichier
|
|
17
|
+
* d'artefact.
|
|
18
|
+
*
|
|
19
|
+
* Les fichiers peuvent exporter leur artefact en `default` **ou** en export
|
|
20
|
+
* nommé (les exemples de la documentation Raiton utilisent `export class
|
|
21
|
+
* MathServer`). L'ancien `imported.default || imported` retombait sur l'objet
|
|
22
|
+
* namespace du module pour un export nommé : `compileMcp` enregistrait alors un
|
|
23
|
+
* serveur fantôme (nom et métadonnées vides) sur le même chemin HTTP.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveArtifact(imported: any, kinds: ArtifactKinds): any;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Route } from "../router/index.ts";
|
|
2
|
+
export declare class ControllerRouteTracker {
|
|
3
|
+
static getRoutes(controllerName: string): Route[];
|
|
4
|
+
static setRoutes(controllerName: string, routes: Route[]): void;
|
|
5
|
+
static removeRoutes(controllerName: string, router: {
|
|
6
|
+
remove(route: Route): void;
|
|
7
|
+
}): void;
|
|
8
|
+
static clear(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class RaitonDirectories {
|
|
2
|
+
static readonly index: string;
|
|
3
|
+
static readonly bootstrapFile = "main.ts";
|
|
4
|
+
static readonly compiledBootstrapFile = "main.mjs";
|
|
5
|
+
static caches(workdir: string): string;
|
|
6
|
+
static artifacts(workdir: string): string;
|
|
7
|
+
static server(workdir: string): string;
|
|
8
|
+
static root(workdir: string): string;
|
|
9
|
+
static app(): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GuardDeclaration } from "../types/index.ts";
|
|
2
|
+
export declare class RaitonGuards {
|
|
3
|
+
protected static _map: Map<string, GuardDeclaration>;
|
|
4
|
+
static set(name: string, guard: GuardDeclaration): typeof this;
|
|
5
|
+
static get(name: string): GuardDeclaration | undefined;
|
|
6
|
+
static remove(name: string): typeof this;
|
|
7
|
+
static removeAll(): typeof this;
|
|
8
|
+
static enabled(name: string): boolean;
|
|
9
|
+
static enable(name: string): typeof this;
|
|
10
|
+
static disable(name: string): typeof RaitonGuards;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './raiton.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function raiton<T>(input: T): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HookNameType, HookHandlerCallable } from '../types/index.ts';
|
|
2
|
+
export declare class HookStore {
|
|
3
|
+
private hooks;
|
|
4
|
+
add(name: HookNameType, handler: HookHandlerCallable): void;
|
|
5
|
+
remove(name: HookNameType, handler?: HookHandlerCallable): void;
|
|
6
|
+
replace(name: HookNameType, oldHandler: HookHandlerCallable, newHandler: HookHandlerCallable): void;
|
|
7
|
+
/**
|
|
8
|
+
* Remplace tous les handlers d'un hook. Utilisé par le HMR quand un
|
|
9
|
+
* artefact exporte une nouvelle version de `onRequest` / `onResponse`.
|
|
10
|
+
*/
|
|
11
|
+
replaceAll(name: HookNameType, handler: HookHandlerCallable): void;
|
|
12
|
+
has(name: HookNameType): boolean;
|
|
13
|
+
run(name: HookNameType, ctx: any): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./config/index.ts";
|
|
2
|
+
export * from "./process.util.ts";
|
|
3
|
+
export * from "./builder.ts";
|
|
4
|
+
export * from "./bytes.util.ts";
|
|
5
|
+
export * from "./commands.ts";
|
|
6
|
+
export * from "./command.ts";
|
|
7
|
+
export * from "./directories.ts";
|
|
8
|
+
export * from "./raiton.ts";
|
|
9
|
+
export * from "./thread.ts";
|
|
10
|
+
export * from "./application.ts";
|
|
11
|
+
export * from "./controller/index.ts";
|
|
12
|
+
export * from "./socket/index.ts";
|
|
13
|
+
export * from "./mcp/index.ts";
|
|
14
|
+
export * from "./scheduler/index.ts";
|
|
15
|
+
export * from "./plugins/index.ts";
|
|
16
|
+
export * from "./middleware/index.ts";
|
|
17
|
+
export * from "./router/index.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './injection.ts';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import type { ConstructorType, ContainerDefinitionInterface } from "../../types/index.ts";
|
|
3
|
+
import { LifetimeEnum } from "@protorians/core";
|
|
4
|
+
export declare class Injection {
|
|
5
|
+
protected static _classes: Map<string, ContainerDefinitionInterface>;
|
|
6
|
+
protected static _instances: Map<string, Map<any, any>>;
|
|
7
|
+
protected static _resolutionStack: Set<string>;
|
|
8
|
+
protected static _dependents: Map<string, Set<string>>;
|
|
9
|
+
protected static _artifactPaths: Map<string, string>;
|
|
10
|
+
protected static _normalizedNames: Map<string, string>;
|
|
11
|
+
protected static _parameterMetadata: WeakMap<Function, {
|
|
12
|
+
parameters: any[];
|
|
13
|
+
designParameters: any[];
|
|
14
|
+
}>;
|
|
15
|
+
static get classes(): Map<string, ContainerDefinitionInterface>;
|
|
16
|
+
static defaultScope: symbol;
|
|
17
|
+
static get instances(): Map<string, Map<any, any>>;
|
|
18
|
+
static has(name: string): boolean;
|
|
19
|
+
static clear(): void;
|
|
20
|
+
protected static normalizeName(name: string): string;
|
|
21
|
+
static registry(name: string, construct: ConstructorType, lifetime?: LifetimeEnum, scope?: Symbol): typeof this;
|
|
22
|
+
static updateConstruct(name: string, construct: ConstructorType): typeof this;
|
|
23
|
+
static invalidate(name: string): typeof this;
|
|
24
|
+
static invalidateCascade(name: string): typeof this;
|
|
25
|
+
static getDependents(name: string): string[];
|
|
26
|
+
static registerArtifactPath(name: string, path: string): typeof this;
|
|
27
|
+
static getArtifactPath(name: string): string | undefined;
|
|
28
|
+
/** Names registered for a given artifact file (used by HMR renames). */
|
|
29
|
+
static getArtifactNames(filename: string): string[];
|
|
30
|
+
static resolveArguments(definition: ContainerDefinitionInterface, scope?: any): any[];
|
|
31
|
+
protected static addDependent(dependencyName: string, dependentName: string): void;
|
|
32
|
+
static get<T>(name: string, scope?: Symbol): T | undefined;
|
|
33
|
+
protected static injectProperties(instance: any, definition: ContainerDefinitionInterface, scope?: any): void;
|
|
34
|
+
protected static triggerLifecycle(instance: any): void;
|
|
35
|
+
static shutdown(): Promise<void>;
|
|
36
|
+
static resolve<T>(construct: ConstructorType<T>): T;
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { McpServerMetaInterface, McpServerRegistrationInterface } from "../../types/index.ts";
|
|
2
|
+
import "reflect-metadata";
|
|
3
|
+
export declare function getMcpServerMetadata(target: any): McpServerMetaInterface;
|
|
4
|
+
export declare function registerMcpServer(construct: any): McpServerRegistrationInterface;
|
|
5
|
+
export declare function unregisterMcpServer(constructOrName: string | any): boolean;
|
|
6
|
+
export declare function getMcpServerRegistry(): Map<string, McpServerRegistrationInterface>;
|
|
7
|
+
export declare function getMcpServer(name: string): McpServerRegistrationInterface | undefined;
|
|
8
|
+
export declare function findMcpServerForPath(pathname: string, prefix?: string): McpServerRegistrationInterface | undefined;
|
|
9
|
+
export declare function clearMcpServerRegistry(): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Route } from "../router/index.ts";
|
|
2
|
+
export declare class McpRouteTracker {
|
|
3
|
+
static getRoutes(serverName: string): Route[];
|
|
4
|
+
static setRoutes(serverName: string, routes: Route[]): void;
|
|
5
|
+
static removeRoutes(serverName: string, router?: {
|
|
6
|
+
remove(route: Route): void;
|
|
7
|
+
}): void;
|
|
8
|
+
static clear(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MiddlewareType } from '../../types/index.ts';
|
|
2
|
+
export declare function middlewareCompose(middlewares: MiddlewareType[]): (request: any) => Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* Précompose la pile de middlewares en gardant le terminal (handler de route)
|
|
5
|
+
* en paramètre d'exécution. La pile n'est plus recopiée à chaque requête ;
|
|
6
|
+
* `MiddlewarePipeline` invalide le runner compilé à chaque mutation.
|
|
7
|
+
*/
|
|
8
|
+
export declare function middlewareComposeWithTerminal(middlewares: readonly MiddlewareType[]): (request: any, terminal: MiddlewareType) => Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MiddlewareType } from '../../types/index.ts';
|
|
2
|
+
export declare class MiddlewarePipeline {
|
|
3
|
+
private stack;
|
|
4
|
+
private compiled?;
|
|
5
|
+
private terminalRunner?;
|
|
6
|
+
private invalidate;
|
|
7
|
+
use(mw: MiddlewareType): this;
|
|
8
|
+
replace(name: string, mw: MiddlewareType): this;
|
|
9
|
+
remove(name: string): this;
|
|
10
|
+
clear(): this;
|
|
11
|
+
run(ctx: any, ...extra: MiddlewareType[]): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HookStore } from '../hooks.ts';
|
|
2
|
+
import { MiddlewarePipeline } from '../middleware/index.ts';
|
|
3
|
+
import { Route, Router } from '../router/index.ts';
|
|
4
|
+
export declare class PluginScope {
|
|
5
|
+
hooks: HookStore;
|
|
6
|
+
middleware: MiddlewarePipeline;
|
|
7
|
+
router: Router;
|
|
8
|
+
private parent?;
|
|
9
|
+
constructor(parent?: PluginScope);
|
|
10
|
+
addHook(name: any, fn: any): this;
|
|
11
|
+
use(mw: any): any;
|
|
12
|
+
route(method: any, path: string, handler: any, version?: string): Route;
|
|
13
|
+
get(path: string, handler: any, version?: string): Route;
|
|
14
|
+
register(plugin: any): this;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function until(condition: () => boolean | Promise<boolean>, interval?: number): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RaitonSignalMapInterface, ThreadInterface } from "../types/index.ts";
|
|
2
|
+
import { ISignalStack } from "@protorians/core";
|
|
3
|
+
export declare class Raiton {
|
|
4
|
+
protected static _thread: ThreadInterface | undefined;
|
|
5
|
+
static readonly signals: ISignalStack<RaitonSignalMapInterface>;
|
|
6
|
+
static title: string;
|
|
7
|
+
static identifier: string;
|
|
8
|
+
static get thread(): ThreadInterface | undefined;
|
|
9
|
+
static set thread(thread: ThreadInterface | undefined);
|
|
10
|
+
/**
|
|
11
|
+
* Reset the thread singleton. Used by tests and by CLI commands that run
|
|
12
|
+
* several introspections in the same process.
|
|
13
|
+
*/
|
|
14
|
+
static resetThread(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { MiddlewareCallable, ParamMetaInterface, RouteMetaInterface } from "../../types/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Récupère (une seule fois, à la compilation du handler) les métadonnées de
|
|
4
|
+
* paramètres d'une route.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getRouteParameters(instance: any, routeMeta: RouteMetaInterface): ParamMetaInterface[];
|
|
7
|
+
/**
|
|
8
|
+
* Collecte les arguments d'un handler à partir de métadonnées déjà résolues.
|
|
9
|
+
*
|
|
10
|
+
* Cette fonction ne fait aucune réflexion : elle est appelée à chaque requête
|
|
11
|
+
* avec le tableau figé au moment de la compilation du handler.
|
|
12
|
+
*/
|
|
13
|
+
export declare function collectArguments(params: readonly ParamMetaInterface[], ctx: any): any[];
|
|
14
|
+
/**
|
|
15
|
+
* Compatibilité : récupère les métadonnées puis collecte les arguments.
|
|
16
|
+
*/
|
|
17
|
+
export declare function collectRouteArguments(instance: any, routeMeta: RouteMetaInterface, ctx: any): any[];
|
|
18
|
+
/**
|
|
19
|
+
* Helper function for validating DTO arguments
|
|
20
|
+
* @param args
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateDtoArguments(args: any[]): Promise<void>;
|
|
23
|
+
export type ResponseValidator = (responses: any) => Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Compile le validateur de réponse d'une route : métadonnées, cible et mode
|
|
26
|
+
* tableau sont résolus une fois. Le validateur n'est créé par `createHandler`
|
|
27
|
+
* que si la validation est active (dev/HMR ou configuration explicite).
|
|
28
|
+
*/
|
|
29
|
+
export declare function createResponseValidator(instance: any, routeMeta: RouteMetaInterface): ResponseValidator;
|
|
30
|
+
/**
|
|
31
|
+
* Compatibilité : compile puis exécute le validateur de réponse.
|
|
32
|
+
*
|
|
33
|
+
* @deprecated Utilisez `createResponseValidator()` à la compilation du handler
|
|
34
|
+
* pour éviter de relire les métadonnées à chaque requête.
|
|
35
|
+
*/
|
|
36
|
+
export declare function validateResponse(responses: any, instance: any, routeMeta: RouteMetaInterface): Promise<void>;
|
|
37
|
+
export declare function runMiddlewares(middlewares: MiddlewareCallable[], ctx: any): Promise<void>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Route } from './route.ts';
|
|
2
|
+
export interface RouteResolution {
|
|
3
|
+
route: Route;
|
|
4
|
+
params: Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
interface TrieNode {
|
|
7
|
+
static: Map<string, TrieNode>;
|
|
8
|
+
param?: TrieNode;
|
|
9
|
+
routes: Route[];
|
|
10
|
+
}
|
|
11
|
+
interface RouteCandidate {
|
|
12
|
+
route: Route;
|
|
13
|
+
values: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Index de routes à coût prévisible.
|
|
17
|
+
*
|
|
18
|
+
* - Les routes statiques sont résolues par un `Map` (O(1)).
|
|
19
|
+
* - Les routes paramétriques utilisent un trie par segment (O(segments)).
|
|
20
|
+
* - Les motifs sont compilés par `Route` à l'enregistrement.
|
|
21
|
+
*
|
|
22
|
+
* Toutes les opérations (`add`, `remove`, `replace`, `clear`) maintiennent les
|
|
23
|
+
* trois index (toutes les routes, statiques, trie) de façon cohérente, ce qui
|
|
24
|
+
* rend le rechargement HMR sûr.
|
|
25
|
+
*/
|
|
26
|
+
export declare class RouteMatcher {
|
|
27
|
+
protected _routes: Map<string, Route>;
|
|
28
|
+
protected _static: Map<string, Route>;
|
|
29
|
+
protected _tries: Map<string, TrieNode>;
|
|
30
|
+
protected _order: number;
|
|
31
|
+
protected getKey(route: Route): string;
|
|
32
|
+
get routes(): Map<string, Route>;
|
|
33
|
+
add(route: Route): this;
|
|
34
|
+
has(route: Route): boolean;
|
|
35
|
+
find(route: Route): Route | undefined;
|
|
36
|
+
replace(route: Route): this;
|
|
37
|
+
upsert(route: Route): this;
|
|
38
|
+
remove(route: Route): this;
|
|
39
|
+
protected removeFromTrie(node: TrieNode, segments: readonly string[], index: number, route: Route): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Résout une requête sans muter la `Route` : les paramètres sont propres à
|
|
42
|
+
* l'appel et peuvent être conservés par le contexte de la requête.
|
|
43
|
+
*/
|
|
44
|
+
resolve(method: string, url: string): RouteResolution | null;
|
|
45
|
+
protected collect(node: TrieNode, segments: readonly string[], index: number, values: string[], candidates: RouteCandidate[]): void;
|
|
46
|
+
/** Compatibilité : renvoie la route sans exposer les paramètres. */
|
|
47
|
+
match(method: string, url: string): Route | null;
|
|
48
|
+
clear(): this;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { RouteDefinitionInterface } from '../../types/router.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Normalise un chemin de route : slash initial, pas de slashs doublés, pas de
|
|
4
|
+
* slash final (sauf pour la racine).
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeRoutePath(value: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Une route compilée une seule fois à l'enregistrement.
|
|
9
|
+
*
|
|
10
|
+
* Les motifs (`regex`, segments, noms de paramètres) sont calculés dans le
|
|
11
|
+
* constructeur : aucun travail de compilation n'est effectué pendant le
|
|
12
|
+
* traitement d'une requête. Les paramètres extraits sont renvoyés dans un objet
|
|
13
|
+
* neuf, jamais stockés sur l'instance partagée.
|
|
14
|
+
*/
|
|
15
|
+
export declare class Route {
|
|
16
|
+
method: string;
|
|
17
|
+
path: string;
|
|
18
|
+
version?: string;
|
|
19
|
+
handler: RouteDefinitionInterface['handler'];
|
|
20
|
+
/** Chemin complet normalisé (version incluse). */
|
|
21
|
+
readonly fullPath: string;
|
|
22
|
+
/** Segments du chemin complet, sans segment vide. */
|
|
23
|
+
readonly segments: readonly string[];
|
|
24
|
+
/** Noms des paramètres, dans l'ordre du chemin. */
|
|
25
|
+
readonly paramNames: readonly string[];
|
|
26
|
+
/** Vrai lorsqu'aucun segment paramétrique n'est présent. */
|
|
27
|
+
readonly isStatic: boolean;
|
|
28
|
+
/** Motif compilé pour les routes paramétriques. */
|
|
29
|
+
readonly pattern?: RegExp;
|
|
30
|
+
/** Ordre d'enregistrement (départage à spécificité égale). */
|
|
31
|
+
readonly order: number;
|
|
32
|
+
/**
|
|
33
|
+
* Conservé pour compatibilité : plus jamais muté par le matching.
|
|
34
|
+
* Utilisez `Router.resolve()` / `Route.extractParams()` pour obtenir les
|
|
35
|
+
* paramètres propres à une requête.
|
|
36
|
+
*/
|
|
37
|
+
parameters: Record<string, string>;
|
|
38
|
+
constructor(def: RouteDefinitionInterface, order?: number);
|
|
39
|
+
/** @deprecated Conservé pour compatibilité ; les noms sont précompilés. */
|
|
40
|
+
get params(): string[];
|
|
41
|
+
get name(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Compatibilité : renvoie une vue de la route portant les paramètres
|
|
44
|
+
* extraits. L'instance partagée n'est jamais mutée.
|
|
45
|
+
*/
|
|
46
|
+
extractParams(url: string): this;
|
|
47
|
+
/** Extrait les paramètres d'un chemin déjà normalisé. */
|
|
48
|
+
extractParamsFromPath(path: string): Record<string, string> | null;
|
|
49
|
+
/** Vrai si la route correspond au chemin, quelle que soit la méthode. */
|
|
50
|
+
matchesPath(url: string): boolean;
|
|
51
|
+
match(method: string, url: string): boolean;
|
|
52
|
+
}
|