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,42 @@
|
|
|
1
|
+
import type { QueueBackendInterface, QueueDequeueOptionsInterface, QueueMessageInterface } from "../../../types/index.ts";
|
|
2
|
+
export declare abstract class BaseQueueBackend implements QueueBackendInterface {
|
|
3
|
+
abstract readonly name: string;
|
|
4
|
+
protected connected: boolean;
|
|
5
|
+
get isConnected(): boolean;
|
|
6
|
+
abstract connect(): Promise<void>;
|
|
7
|
+
abstract disconnect(): Promise<void>;
|
|
8
|
+
abstract enqueue(queue: string, message: QueueMessageInterface): Promise<string>;
|
|
9
|
+
abstract dequeue(queue: string, options?: QueueDequeueOptionsInterface): Promise<QueueMessageInterface[]>;
|
|
10
|
+
abstract acknowledge(queue: string, receipt: any): Promise<void>;
|
|
11
|
+
abstract reject(queue: string, receipt: any, requeue?: boolean): Promise<void>;
|
|
12
|
+
abstract length(queue: string): Promise<number>;
|
|
13
|
+
abstract purge(queue: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function wait(milliseconds: number): Promise<void>;
|
|
16
|
+
interface MemoryReceipt {
|
|
17
|
+
queue: string;
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* In-process queue backend used by default when no external broker is
|
|
22
|
+
* configured. Supports blocking dequeue, visibility timeout and ack/nack.
|
|
23
|
+
*/
|
|
24
|
+
export declare class MemoryQueueBackend extends BaseQueueBackend {
|
|
25
|
+
readonly name = "memory";
|
|
26
|
+
private readonly queues;
|
|
27
|
+
private readonly visibilityMs;
|
|
28
|
+
constructor(options?: {
|
|
29
|
+
visibilityMs?: number;
|
|
30
|
+
});
|
|
31
|
+
connect(): Promise<void>;
|
|
32
|
+
disconnect(): Promise<void>;
|
|
33
|
+
enqueue(queue: string, message: QueueMessageInterface): Promise<string>;
|
|
34
|
+
dequeue(queue: string, options?: QueueDequeueOptionsInterface): Promise<QueueMessageInterface[]>;
|
|
35
|
+
acknowledge(_queue: string, receipt: MemoryReceipt): Promise<void>;
|
|
36
|
+
reject(queue: string, receipt: MemoryReceipt, requeue?: boolean): Promise<void>;
|
|
37
|
+
length(queue: string): Promise<number>;
|
|
38
|
+
purge(queue: string): Promise<void>;
|
|
39
|
+
private list;
|
|
40
|
+
private tryDequeue;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseQueueBackend } from "./backend.ts";
|
|
2
|
+
import type { QueueDequeueOptionsInterface, QueueMessageInterface } from "../../../types/index.ts";
|
|
3
|
+
export interface RabbitMqQueueBackendOptions {
|
|
4
|
+
url?: string;
|
|
5
|
+
connection?: any;
|
|
6
|
+
channel?: any;
|
|
7
|
+
exchange?: string;
|
|
8
|
+
persistent?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* RabbitMQ-backed queue using a single AMQP channel (`sendToQueue` to publish,
|
|
12
|
+
* `get` + manual ack/nack to consume).
|
|
13
|
+
*
|
|
14
|
+
* The `amqplib` package is imported lazily so the framework never requires it
|
|
15
|
+
* unless this backend is actually used:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {SchedulerManager, RabbitMqQueueBackend} from 'raiton/core';
|
|
19
|
+
* SchedulerManager.current.registerBackend('default', new RabbitMqQueueBackend({url: 'amqp://localhost'}))
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class RabbitMqQueueBackend extends BaseQueueBackend {
|
|
23
|
+
readonly name = "rabbitmq";
|
|
24
|
+
private connection;
|
|
25
|
+
private channel;
|
|
26
|
+
private readonly options;
|
|
27
|
+
constructor(options?: RabbitMqQueueBackendOptions);
|
|
28
|
+
connect(): Promise<void>;
|
|
29
|
+
disconnect(): Promise<void>;
|
|
30
|
+
enqueue(queue: string, message: QueueMessageInterface): Promise<string>;
|
|
31
|
+
dequeue(queue: string, options?: QueueDequeueOptionsInterface): Promise<QueueMessageInterface[]>;
|
|
32
|
+
acknowledge(_queue: string, receipt: any): Promise<void>;
|
|
33
|
+
reject(_queue: string, receipt: any, requeue?: boolean): Promise<void>;
|
|
34
|
+
length(queue: string): Promise<number>;
|
|
35
|
+
purge(queue: string): Promise<void>;
|
|
36
|
+
private ensureConnected;
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseQueueBackend } from "./backend.ts";
|
|
2
|
+
import type { QueueDequeueOptionsInterface, QueueMessageInterface } from "../../../types/index.ts";
|
|
3
|
+
export interface RedisQueueBackendOptions {
|
|
4
|
+
url?: string;
|
|
5
|
+
client?: any;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Redis-backed queue using a reliable list pattern (enqueue with `RPUSH`,
|
|
11
|
+
* dequeue atomically with `LMOVE` to a processing list, ack with `LREM`).
|
|
12
|
+
*
|
|
13
|
+
* The `redis` package is imported lazily so the framework never requires it
|
|
14
|
+
* unless this backend is actually used:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* import {SchedulerManager, RedisQueueBackend} from 'raiton/core';
|
|
18
|
+
* SchedulerManager.current.registerBackend('default', new RedisQueueBackend({url: 'redis://localhost:6379'}))
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class RedisQueueBackend extends BaseQueueBackend {
|
|
22
|
+
readonly name = "redis";
|
|
23
|
+
private client;
|
|
24
|
+
private readonly options;
|
|
25
|
+
private readonly prefix;
|
|
26
|
+
constructor(options?: RedisQueueBackendOptions);
|
|
27
|
+
connect(): Promise<void>;
|
|
28
|
+
disconnect(): Promise<void>;
|
|
29
|
+
enqueue(queue: string, message: QueueMessageInterface): Promise<string>;
|
|
30
|
+
dequeue(queue: string, options?: QueueDequeueOptionsInterface): Promise<QueueMessageInterface[]>;
|
|
31
|
+
acknowledge(queue: string, receipt: any): Promise<void>;
|
|
32
|
+
reject(queue: string, receipt: any, requeue?: boolean): Promise<void>;
|
|
33
|
+
length(queue: string): Promise<number>;
|
|
34
|
+
purge(queue: string): Promise<void>;
|
|
35
|
+
private key;
|
|
36
|
+
private processingKey;
|
|
37
|
+
private ensureConnected;
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ServerInterface, ServerOptionsInterface } from "../types/index.ts";
|
|
2
|
+
export declare class Server implements ServerInterface {
|
|
3
|
+
readonly options: ServerOptionsInterface;
|
|
4
|
+
protected static _instance?: Server;
|
|
5
|
+
static get instance(): Server | undefined;
|
|
6
|
+
static set instance(value: Server);
|
|
7
|
+
constructor(options: ServerOptionsInterface);
|
|
8
|
+
option<K extends keyof ServerOptionsInterface>(key: K): ServerOptionsInterface[K];
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function compileSocket(SocketClass: any): import("./metadata.ts").SocketRegistryEntryInterface;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConstructorType, SocketMetaInterface } from "../../types/index.ts";
|
|
2
|
+
import "reflect-metadata";
|
|
3
|
+
export interface SocketRegistryEntryInterface {
|
|
4
|
+
namespace: string;
|
|
5
|
+
construct: ConstructorType;
|
|
6
|
+
metadata: SocketMetaInterface;
|
|
7
|
+
}
|
|
8
|
+
export declare function getSocketMetadata(target: any): SocketMetaInterface;
|
|
9
|
+
export declare function registerSocket(construct: any): SocketRegistryEntryInterface;
|
|
10
|
+
export declare function unregisterSocket(constructOrNamespace: string | any): boolean;
|
|
11
|
+
export declare function getSocketRegistry(): Map<string, SocketRegistryEntryInterface>;
|
|
12
|
+
export declare function getSocketForNamespace(namespace: string): SocketRegistryEntryInterface | undefined;
|
|
13
|
+
export declare function findSocketForPath(pathname: string, prefix?: string): SocketRegistryEntryInterface | undefined;
|
|
14
|
+
export declare function clearSocketRegistry(): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BuilderInterface, RuntimeAdapterInterface, RuntimeServerInterface, ThreadInterface, ThreadOptionsInterface, ThreadSetupOptionsInterface, ThreadWaitCallable } from "../types/index.ts";
|
|
2
|
+
import { ApplicationInterface } from "../types/application.ts";
|
|
3
|
+
export declare class RaitonThread implements ThreadInterface {
|
|
4
|
+
readonly builder: BuilderInterface;
|
|
5
|
+
protected _options: ThreadOptionsInterface;
|
|
6
|
+
protected static instance: RaitonThread | null;
|
|
7
|
+
static get current(): RaitonThread | null;
|
|
8
|
+
static reset(): void;
|
|
9
|
+
application: ApplicationInterface | null;
|
|
10
|
+
runtime: RuntimeAdapterInterface | null;
|
|
11
|
+
runtimeServer: RuntimeServerInterface | null;
|
|
12
|
+
readonly appDir: string;
|
|
13
|
+
constructor(builder: BuilderInterface, _options?: ThreadOptionsInterface);
|
|
14
|
+
restart(): void;
|
|
15
|
+
stop(): Promise<void>;
|
|
16
|
+
sleep(milliseconds: number): Promise<unknown>;
|
|
17
|
+
wait(condition: ThreadWaitCallable): Promise<void>;
|
|
18
|
+
protected getNetworkIp(): string | null;
|
|
19
|
+
setup({ application, runtime }: ThreadSetupOptionsInterface): this;
|
|
20
|
+
run(): Promise<this>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type HmrChannel = 'hmr:di' | 'hmr:controller' | 'hmr:socket' | 'hmr:middleware' | 'hmr:hook' | 'hmr:mcp' | 'hmr:health-check' | 'hmr:scheduler';
|
|
2
|
+
export interface ArtifactClassification {
|
|
3
|
+
channel: HmrChannel;
|
|
4
|
+
artifactType: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const HMR_CHANNELS: Record<HmrChannel, readonly string[]>;
|
|
7
|
+
export declare class Artifacts {
|
|
8
|
+
static readonly types: Set<string>;
|
|
9
|
+
static readonly defaultTypes: string[];
|
|
10
|
+
static register(type: string): typeof Artifacts;
|
|
11
|
+
static registerMany(...types: string[]): typeof Artifacts;
|
|
12
|
+
static is(filename: string): boolean;
|
|
13
|
+
static classify(filename: string): ArtifactClassification | null;
|
|
14
|
+
static reload(modulo: any, filename?: string): void;
|
|
15
|
+
static reloadDi(modulo: any, filename?: string): void;
|
|
16
|
+
static reloadMiddleware(modulo: any, filename?: string): void;
|
|
17
|
+
static reloadHook(modulo: any, filename?: string): void;
|
|
18
|
+
static reloadMcp(modulo: any, filename?: string): void;
|
|
19
|
+
static reloadScheduler(modulo: any, filename?: string): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { RequestContext } from "../../core/context.ts";
|
|
2
|
+
import type { CacheEntry, CacheOptions, CacheStore } from "./types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Store en mémoire, à durée de vie bornée (TTL) et taille maximale bornée,
|
|
5
|
+
* utilisé par défaut pour la mise en cache des réponses de routes.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MemoryCacheStore implements CacheStore {
|
|
8
|
+
private entries;
|
|
9
|
+
private readonly maxSize;
|
|
10
|
+
constructor(maxSize?: number);
|
|
11
|
+
get<T = any>(key: string): CacheEntry<T> | undefined;
|
|
12
|
+
set<T = any>(key: string, entry: CacheEntry<T>, _ttl?: number): void;
|
|
13
|
+
has(key: string): boolean;
|
|
14
|
+
delete(key: string): boolean;
|
|
15
|
+
clear(): void;
|
|
16
|
+
size(): number;
|
|
17
|
+
private evictIfNeeded;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `CacheManager` configure le comportement global du cache de routes, à la
|
|
21
|
+
* manière des autres managers du framework.
|
|
22
|
+
*/
|
|
23
|
+
export declare class CacheManager {
|
|
24
|
+
private static _store;
|
|
25
|
+
private static _defaults;
|
|
26
|
+
private static readonly _routeVersions;
|
|
27
|
+
private static readonly _routeKeys;
|
|
28
|
+
static configure(options: Partial<CacheOptions>): void;
|
|
29
|
+
static getDefaults(): Partial<CacheOptions>;
|
|
30
|
+
static getStore(): CacheStore;
|
|
31
|
+
static setStore(store: CacheStore): void;
|
|
32
|
+
/**
|
|
33
|
+
* Version courante d'une route. La version est intégrée aux clés de cache
|
|
34
|
+
* afin qu'une invalidation HMR rende immédiatement les anciennes entrées
|
|
35
|
+
* inaccessibles, même si le handler est recompilé.
|
|
36
|
+
*/
|
|
37
|
+
static version(route: string): number;
|
|
38
|
+
static track(route: string, key: string): void;
|
|
39
|
+
static invalidateRoute(route: string): void;
|
|
40
|
+
static clear(): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Construit la clé de cache par défaut : méthode + route + paramètres d'URL.
|
|
44
|
+
*/
|
|
45
|
+
export declare function defaultCacheKey(context: RequestContext, route: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Résout les options effectives d'une route (défauts globaux + options locales).
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveCacheOptions(route: string, options?: CacheOptions): CacheOptions;
|
|
50
|
+
/**
|
|
51
|
+
* Calcule la clé de cache pour une requête donnée.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildCacheKey(context: RequestContext, route: string, options: CacheOptions): Promise<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Applique une réponse en cache au contexte (statut + en-têtes + corps).
|
|
56
|
+
*/
|
|
57
|
+
export declare function sendCachedEntry(context: RequestContext, entry: CacheEntry): void;
|
|
58
|
+
/**
|
|
59
|
+
* Mécanisme cœur du cache de routes, pensé pour être intégré au niveau du
|
|
60
|
+
* handler (dans `createHandler`). Il évite complètement d'exécuter le handler
|
|
61
|
+
* tant qu'une entrée fraîche existe pour la clé de requête.
|
|
62
|
+
*
|
|
63
|
+
* - `get` renvoie l'entrée fraîche si elle existe.
|
|
64
|
+
* - `set` stocke la réponse si elle est éligible (méthode + statut 2xx).
|
|
65
|
+
*/
|
|
66
|
+
export declare class RouteCache {
|
|
67
|
+
private readonly store;
|
|
68
|
+
private readonly route;
|
|
69
|
+
private readonly options;
|
|
70
|
+
private readonly version;
|
|
71
|
+
constructor(route: string, options?: CacheOptions);
|
|
72
|
+
get enabled(): boolean;
|
|
73
|
+
matchesMethod(method: string): boolean;
|
|
74
|
+
private scope;
|
|
75
|
+
key(context: RequestContext): Promise<string>;
|
|
76
|
+
get<T = any>(context: RequestContext, key?: string): Promise<CacheEntry<T> | undefined>;
|
|
77
|
+
set<T = any>(context: RequestContext, body: T, status?: number, headers?: Record<string, string>, key?: string): Promise<void>;
|
|
78
|
+
shouldCache(status: number): boolean;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Helper de contrôle-manipulation du cache-Control, valeur commode pour les
|
|
82
|
+
* routes qui ne veulent pas passer par le middleware ETag.
|
|
83
|
+
*/
|
|
84
|
+
export declare function cacheControl(context: RequestContext, value: string | number, publicAccess?: boolean): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import type { CacheOptions } from "./types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Décorateur de route : met en cache la réponse du handler pendant `ttl`.
|
|
5
|
+
*
|
|
6
|
+
* Contrairement aux ETag (validation), le cache évite complètement l'exécution
|
|
7
|
+
* du handler tant que l'entrée est fraîche.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* @Controllable("/products")
|
|
11
|
+
* class ProductController {
|
|
12
|
+
* @Get("/featured")
|
|
13
|
+
* @Cache({ ttl: 60_000, vary: ["accept-language"] })
|
|
14
|
+
* featured() {
|
|
15
|
+
* return this.products.findFeatured()
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export declare function Cache(options?: CacheOptions): (target: any, propertyKey?: string) => void;
|
|
20
|
+
export declare function getCacheMetadata(target: any, propertyKey: string): CacheOptions | undefined;
|
|
21
|
+
export declare function isCached(target: any, propertyKey: string): boolean;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { RequestContext } from "../../core/context.ts";
|
|
2
|
+
import type { ETagOptions, ETagResult } from "./types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* `Etagger` est le gestionnaire complet des ETag. Il est entièrement
|
|
5
|
+
* personnalisable par le développeur : algorithme de hachage, marqueur faible,
|
|
6
|
+
* en-tête, cache-control et prédicat d'exclusion.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const etagger = new Etagger({ weak: true, cacheControl: { maxAge: 300 } })
|
|
10
|
+
* const { tag, notModified } = await etagger.evaluate(context, body)
|
|
11
|
+
*/
|
|
12
|
+
export declare class Etagger {
|
|
13
|
+
private readonly enabled;
|
|
14
|
+
private readonly weak;
|
|
15
|
+
private readonly algorithm?;
|
|
16
|
+
private readonly cacheControl?;
|
|
17
|
+
private readonly headerName;
|
|
18
|
+
private readonly skip?;
|
|
19
|
+
constructor(options?: ETagOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Calcule la valeur d'ETag d'un corps de réponse sérialisé.
|
|
22
|
+
*/
|
|
23
|
+
generate(body: any): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Vérifie si la liste d'ETag envoyée par le client (en-tête `If-None-Match`)
|
|
26
|
+
* matche avec l'ETag calculé. Un `*` matche n'importe quelle ressource.
|
|
27
|
+
*/
|
|
28
|
+
matches(clientTags: string | null | undefined, tag: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Applique la politique de cache à en-têtes de réponse.
|
|
31
|
+
*/
|
|
32
|
+
applyCacheControl(context: RequestContext): void;
|
|
33
|
+
/**
|
|
34
|
+
* Évalue la requête condititionnelle complète. Si un ETag fort/faible est
|
|
35
|
+
* présent et que le client l'a déjà (via `If-None-Match`), la réponse est
|
|
36
|
+
* marquée `notModified` et doit être envoyée avec le statut `304`.
|
|
37
|
+
*/
|
|
38
|
+
evaluate(context: RequestContext, body: any): Promise<ETagResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Raccourci statique, construit une instance à la volée et évalue.
|
|
41
|
+
*/
|
|
42
|
+
static apply(context: RequestContext, body: any, options?: ETagOptions): Promise<ETagResult>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Instance singulière utilisée par défaut par le middleware `etag()`.
|
|
46
|
+
*/
|
|
47
|
+
export declare const defaultEtagger: Etagger;
|
|
48
|
+
/**
|
|
49
|
+
* Middleware ETag prêt à l'emploi. À brancher globalement ou par route :
|
|
50
|
+
*
|
|
51
|
+
* ```typescript
|
|
52
|
+
* app.use(etag({ weak: false, cacheControl: { maxAge: 300 } }))
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* Le middleware intercepte `context.reply.send`, calcule l'ETag du corps
|
|
56
|
+
* sérialisé, pose l'en-tête correspondant et répond `304 Not Modified` si le
|
|
57
|
+
* client déclare déjà posséder la représentation (`If-None-Match`).
|
|
58
|
+
*/
|
|
59
|
+
export declare function etag(options?: ETagOptions): ({ context, next }: {
|
|
60
|
+
context: RequestContext;
|
|
61
|
+
next: () => Promise<any>;
|
|
62
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { RequestContext } from "../../core/context.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Options de configuration du système de cache de routes et des ETag.
|
|
4
|
+
*/
|
|
5
|
+
export type CacheKeyCallable = (context: RequestContext, route?: string) => string | Promise<string>;
|
|
6
|
+
export interface ETagOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Active ou désactive la génération d'ETag. (défaut: `true`)
|
|
9
|
+
*/
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Marqueur d'ETag faible (`W/"..."`). Les ETag faibles permettent les réponses
|
|
13
|
+
* équivalentes mais pas identiques octet pour octet. (défaut: `false`)
|
|
14
|
+
*/
|
|
15
|
+
weak?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Fonction de hachage personnalisée. Reçoit le corps sérialisé et renvoie
|
|
18
|
+
* une chaîne qui servira de valeur d'ETag. (défaut: hachage FNV-1a interne)
|
|
19
|
+
*/
|
|
20
|
+
algorithm?: (body: string) => string | Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Ajoute automatiquement un en-tête `Cache-Control` adapté aux ETag.
|
|
23
|
+
* Peut être un booléen ou un objet de contrôle fin. (défaut: `false`)
|
|
24
|
+
*/
|
|
25
|
+
cacheControl?: boolean | {
|
|
26
|
+
maxAge?: number;
|
|
27
|
+
public?: boolean;
|
|
28
|
+
noCache?: boolean;
|
|
29
|
+
noStore?: boolean;
|
|
30
|
+
mustRevalidate?: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Nom de l'en-tête de réponse qui portera la valeur d'ETag. (défaut: `ETag`)
|
|
34
|
+
*/
|
|
35
|
+
headerName?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Prédicat permettant d'exclure certaines réponses ou requêtes de la
|
|
38
|
+
* génération d'ETag. Renvoie `true` pour sauter la génération.
|
|
39
|
+
*/
|
|
40
|
+
skip?: (context: RequestContext, body: any) => boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface ETagResult {
|
|
43
|
+
tag: string;
|
|
44
|
+
body: any;
|
|
45
|
+
notModified: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface CacheOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Durée de validité en millisecondes. (défaut: `60_000`)
|
|
50
|
+
*/
|
|
51
|
+
ttl?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Active ou désactive la mise en cache de la route. (défaut: `true`)
|
|
54
|
+
*/
|
|
55
|
+
enabled?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Nombre maximum d'entrées du cache en mémoire. (défaut: `1000`)
|
|
58
|
+
*/
|
|
59
|
+
maxEntries?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Fonction de calcul de la clé de cache. Reçoit le contexte de requête.
|
|
62
|
+
* (défaut: méthode + URL sans query)
|
|
63
|
+
*/
|
|
64
|
+
key?: CacheKeyCallable;
|
|
65
|
+
/**
|
|
66
|
+
* En-têtes de requête dont la valeur doit participer à la construction de
|
|
67
|
+
* la clé de cache (segmentation du cache par acceptation de contenu…).
|
|
68
|
+
*/
|
|
69
|
+
vary?: string[];
|
|
70
|
+
/**
|
|
71
|
+
* Ne met en cache que pour certaines méthodes HTTP. (défaut: `['GET', 'HEAD']`)
|
|
72
|
+
*/
|
|
73
|
+
methods?: string[];
|
|
74
|
+
}
|
|
75
|
+
export interface CacheEntry<T = any> {
|
|
76
|
+
body: T;
|
|
77
|
+
status: number;
|
|
78
|
+
headers: Record<string, string>;
|
|
79
|
+
expiresAt: number;
|
|
80
|
+
createdAt: number;
|
|
81
|
+
}
|
|
82
|
+
export interface CacheStore {
|
|
83
|
+
get<T = any>(key: string): CacheEntry<T> | undefined;
|
|
84
|
+
set<T = any>(key: string, entry: CacheEntry<T>, ttl?: number): void;
|
|
85
|
+
has(key: string): boolean;
|
|
86
|
+
delete(key: string): boolean;
|
|
87
|
+
clear(): void;
|
|
88
|
+
size(): number;
|
|
89
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const METADATA_KEYS: {
|
|
2
|
+
CONTROLLERS: symbol;
|
|
3
|
+
SOCKETS: symbol;
|
|
4
|
+
SOCKET_EVENTS: symbol;
|
|
5
|
+
ROUTE_PARAMETERS: symbol;
|
|
6
|
+
GRAFTS: symbol;
|
|
7
|
+
CONTAINER: symbol;
|
|
8
|
+
INJECT_PARAMETERS: symbol;
|
|
9
|
+
INJECT_PROPERTIES: symbol;
|
|
10
|
+
API_RESPONSES: symbol;
|
|
11
|
+
API_REQUEST_BODY: symbol;
|
|
12
|
+
API_PARAMETERS: symbol;
|
|
13
|
+
API_ENUMS: symbol;
|
|
14
|
+
API_TAGS: symbol;
|
|
15
|
+
API_OPERATION: symbol;
|
|
16
|
+
API_SECURITY: symbol;
|
|
17
|
+
API_PROPERTY: symbol;
|
|
18
|
+
ROUTE_INTERACTION: symbol;
|
|
19
|
+
CACHE: symbol;
|
|
20
|
+
HEALTH_CHECK: symbol;
|
|
21
|
+
MCP: symbol;
|
|
22
|
+
MCP_ELEMENTS: symbol;
|
|
23
|
+
MCP_ARGUMENTS: symbol;
|
|
24
|
+
SCHEDULER: symbol;
|
|
25
|
+
CONTRACT_INPUT: symbol;
|
|
26
|
+
CONTRACT_OUTPUT: symbol;
|
|
27
|
+
PUBLIC_EXPORT: symbol;
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
/**
|
|
3
|
+
* Response definition for OpenAPI
|
|
4
|
+
*/
|
|
5
|
+
export interface ApiResponseOptions {
|
|
6
|
+
/**
|
|
7
|
+
* HTTP status code
|
|
8
|
+
*/
|
|
9
|
+
status: number;
|
|
10
|
+
/**
|
|
11
|
+
* Description of the response
|
|
12
|
+
*/
|
|
13
|
+
description?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Type/schema of the response (optional)
|
|
16
|
+
*/
|
|
17
|
+
type?: any;
|
|
18
|
+
/**
|
|
19
|
+
* Whether this is the default response
|
|
20
|
+
*/
|
|
21
|
+
isArray?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Decorator to add API response metadata to a route handler
|
|
25
|
+
* @param options Response options (status, description, type, etc.)
|
|
26
|
+
*/
|
|
27
|
+
export declare function ApiResponse(options: ApiResponseOptions): (target: any, propertyKey: string | symbol) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Shorthand decorator for 200 OK response
|
|
30
|
+
* @param description Response description
|
|
31
|
+
* @param type Response type (optional)
|
|
32
|
+
* @param isArray Whether the response is an array (optional)
|
|
33
|
+
*/
|
|
34
|
+
export declare function ApiOkResponse(description?: string, type?: any, isArray?: boolean): (target: any, propertyKey: string | symbol) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Shorthand decorator for 201 Created response
|
|
37
|
+
* @param description Response description
|
|
38
|
+
* @param type Response type (optional)
|
|
39
|
+
* @param isArray Whether the response is an array (optional)
|
|
40
|
+
*/
|
|
41
|
+
export declare function ApiCreatedResponse(description?: string, type?: any, isArray?: boolean): (target: any, propertyKey: string | symbol) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Shorthand decorator for 400 Bad Request response
|
|
44
|
+
* @param description Response description
|
|
45
|
+
*/
|
|
46
|
+
export declare function ApiBadRequestResponse(description?: string): (target: any, propertyKey: string | symbol) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Shorthand decorator for 401 Unauthorized response
|
|
49
|
+
* @param description Response description
|
|
50
|
+
*/
|
|
51
|
+
export declare function ApiUnauthorizedResponse(description?: string): (target: any, propertyKey: string | symbol) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Shorthand decorator for 403 Forbidden response
|
|
54
|
+
* @param description Response description
|
|
55
|
+
*/
|
|
56
|
+
export declare function ApiForbiddenResponse(description?: string): (target: any, propertyKey: string | symbol) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Shorthand decorator for 404 Not Found response
|
|
59
|
+
* @param description Response description
|
|
60
|
+
*/
|
|
61
|
+
export declare function ApiNotFoundResponse(description?: string): (target: any, propertyKey: string | symbol) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Shorthand decorator for 500 Internal Server Error response
|
|
64
|
+
* @param description Response description
|
|
65
|
+
*/
|
|
66
|
+
export declare function ApiInternalServerErrorResponse(description?: string): (target: any, propertyKey: string | symbol) => void;
|