raiton 6.8.8-beta.24 → 6.10.0-beta.28
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 +50 -0
- package/README.md +46 -1
- package/benchmarks/README.md +16 -0
- package/benchmarks/latest.json +172 -0
- package/benchmarks/latest.md +66 -0
- package/build/bin/index.mjs +33575 -21723
- 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/client.command.d.ts +7 -0
- package/build/types/commands/contract.command.d.ts +8 -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/generate.command.d.ts +7 -0
- package/build/types/commands/inspect.command.d.ts +7 -0
- package/build/types/commands/mcp.command.d.ts +11 -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/routes.command.d.ts +7 -0
- package/build/types/commands/start.command.d.ts +9 -0
- package/build/types/commands/why.command.d.ts +7 -0
- package/build/types/contracts/decorators.d.ts +41 -0
- package/build/types/contracts/errors.d.ts +42 -0
- package/build/types/contracts/index.d.ts +4 -0
- package/build/types/contracts/schema.d.ts +70 -0
- package/build/types/contracts/typebox.d.ts +81 -0
- package/build/types/core/application.d.ts +37 -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/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 +42 -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 +177 -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 +62 -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 +26 -0
- package/docs/generated/config-schema.json +150 -0
- package/docs/generated/manifest-schema.json +236 -0
- package/docs/generated/manifest.json +101 -0
- package/docs/llms-full.txt +1271 -0
- package/docs/llms.txt +46 -0
- package/docs/user-guide/README.md +18 -12
- package/docs/user-guide/cli.md +21 -0
- package/docs/user-guide/config.md +14 -0
- package/docs/user-guide/contracts.md +67 -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 +40 -7
- 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 +23 -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/client.command.ts +64 -0
- package/source/commands/contract.command.ts +104 -0
- package/source/commands/docs.command.ts +263 -0
- package/source/commands/doctor.command.ts +226 -0
- package/source/commands/generate.command.ts +58 -0
- package/source/commands/inspect.command.ts +108 -0
- package/source/commands/mcp.command.ts +258 -0
- package/source/commands/new.command.ts +135 -0
- package/source/commands/openapi.command.ts +95 -0
- package/source/commands/routes.command.ts +39 -0
- package/source/commands/why.command.ts +61 -0
- package/source/contracts/decorators.ts +151 -0
- package/source/contracts/errors.ts +76 -0
- package/source/contracts/index.ts +4 -0
- package/source/contracts/schema.ts +377 -0
- package/source/contracts/typebox.ts +193 -0
- package/source/core/application.ts +215 -73
- package/source/core/builder.ts +6 -2
- package/source/core/config/config.ts +144 -26
- package/source/core/config/define.ts +35 -8
- package/source/core/config/index.ts +2 -1
- package/source/core/config/schema.ts +263 -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 +91 -31
- 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/framework/artifacts.ts +92 -19
- 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 +159 -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 +131 -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 +705 -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 +52 -0
- package/source/manifest/manifest.ts +341 -0
- package/source/manifest/schema.ts +149 -0
- package/source/types/builder.ts +5 -0
- package/source/types/config.ts +64 -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,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
|
+
}
|
|
@@ -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;
|