@justscale/core 0.1.0
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/LICENSE +21 -0
- package/README.md +261 -0
- package/bin/just.js +34 -0
- package/dist/app.d.ts +56 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +182 -0
- package/dist/app.js.map +1 -0
- package/dist/builder/build-context.d.ts +8 -0
- package/dist/builder/build-context.d.ts.map +1 -0
- package/dist/builder/build-context.js +4 -0
- package/dist/builder/build-context.js.map +1 -0
- package/dist/builder/builder.d.ts +60 -0
- package/dist/builder/builder.d.ts.map +1 -0
- package/dist/builder/builder.js +72 -0
- package/dist/builder/builder.js.map +1 -0
- package/dist/builder/create-builder.d.ts +36 -0
- package/dist/builder/create-builder.d.ts.map +1 -0
- package/dist/builder/create-builder.js +66 -0
- package/dist/builder/create-builder.js.map +1 -0
- package/dist/builder/execute.d.ts +37 -0
- package/dist/builder/execute.d.ts.map +1 -0
- package/dist/builder/execute.js +62 -0
- package/dist/builder/execute.js.map +1 -0
- package/dist/builder/feature-builder.d.ts +147 -0
- package/dist/builder/feature-builder.d.ts.map +1 -0
- package/dist/builder/feature-builder.js +138 -0
- package/dist/builder/feature-builder.js.map +1 -0
- package/dist/builder/index.d.ts +35 -0
- package/dist/builder/index.d.ts.map +1 -0
- package/dist/builder/index.js +37 -0
- package/dist/builder/index.js.map +1 -0
- package/dist/builder/plugin.d.ts +90 -0
- package/dist/builder/plugin.d.ts.map +1 -0
- package/dist/builder/plugin.js +101 -0
- package/dist/builder/plugin.js.map +1 -0
- package/dist/builder/plugins/query.d.ts +31 -0
- package/dist/builder/plugins/query.d.ts.map +1 -0
- package/dist/builder/plugins/query.js +42 -0
- package/dist/builder/plugins/query.js.map +1 -0
- package/dist/builder/plugins/validation.d.ts +12 -0
- package/dist/builder/plugins/validation.d.ts.map +1 -0
- package/dist/builder/plugins/validation.js +12 -0
- package/dist/builder/plugins/validation.js.map +1 -0
- package/dist/builder/sort.d.ts +27 -0
- package/dist/builder/sort.d.ts.map +1 -0
- package/dist/builder/sort.js +210 -0
- package/dist/builder/sort.js.map +1 -0
- package/dist/builder/stop.d.ts +24 -0
- package/dist/builder/stop.d.ts.map +1 -0
- package/dist/builder/stop.js +27 -0
- package/dist/builder/stop.js.map +1 -0
- package/dist/builder/test/permits-type-spike.d.ts +8 -0
- package/dist/builder/test/permits-type-spike.d.ts.map +1 -0
- package/dist/builder/test/permits-type-spike.js +117 -0
- package/dist/builder/test/permits-type-spike.js.map +1 -0
- package/dist/builder/types.d.ts +678 -0
- package/dist/builder/types.d.ts.map +1 -0
- package/dist/builder/types.js +98 -0
- package/dist/builder/types.js.map +1 -0
- package/dist/builder/validation.d.ts +101 -0
- package/dist/builder/validation.d.ts.map +1 -0
- package/dist/builder/validation.js +335 -0
- package/dist/builder/validation.js.map +1 -0
- package/dist/cli/adapter.d.ts +23 -0
- package/dist/cli/adapter.d.ts.map +1 -0
- package/dist/cli/adapter.js +26 -0
- package/dist/cli/adapter.js.map +1 -0
- package/dist/cli/args.d.ts +150 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +172 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/assemble.d.ts +20 -0
- package/dist/cli/assemble.d.ts.map +1 -0
- package/dist/cli/assemble.js +55 -0
- package/dist/cli/assemble.js.map +1 -0
- package/dist/cli/bin/main.d.ts +26 -0
- package/dist/cli/bin/main.d.ts.map +1 -0
- package/dist/cli/bin/main.js +475 -0
- package/dist/cli/bin/main.js.map +1 -0
- package/dist/cli/build/migrations-plugin.d.ts +21 -0
- package/dist/cli/build/migrations-plugin.d.ts.map +1 -0
- package/dist/cli/build/migrations-plugin.js +41 -0
- package/dist/cli/build/migrations-plugin.js.map +1 -0
- package/dist/cli/build/process-plugin.d.ts +29 -0
- package/dist/cli/build/process-plugin.d.ts.map +1 -0
- package/dist/cli/build/process-plugin.js +66 -0
- package/dist/cli/build/process-plugin.js.map +1 -0
- package/dist/cli/builder/create-cli-builder.d.ts +42 -0
- package/dist/cli/builder/create-cli-builder.d.ts.map +1 -0
- package/dist/cli/builder/create-cli-builder.js +104 -0
- package/dist/cli/builder/create-cli-builder.js.map +1 -0
- package/dist/cli/builder/index.d.ts +8 -0
- package/dist/cli/builder/index.d.ts.map +1 -0
- package/dist/cli/builder/index.js +7 -0
- package/dist/cli/builder/index.js.map +1 -0
- package/dist/cli/builder/types.d.ts +113 -0
- package/dist/cli/builder/types.d.ts.map +1 -0
- package/dist/cli/builder/types.js +7 -0
- package/dist/cli/builder/types.js.map +1 -0
- package/dist/cli/cluster.d.ts +8 -0
- package/dist/cli/cluster.d.ts.map +1 -0
- package/dist/cli/cluster.js +145 -0
- package/dist/cli/cluster.js.map +1 -0
- package/dist/cli/current-app.d.ts +36 -0
- package/dist/cli/current-app.d.ts.map +1 -0
- package/dist/cli/current-app.js +21 -0
- package/dist/cli/current-app.js.map +1 -0
- package/dist/cli/define-app.d.ts +35 -0
- package/dist/cli/define-app.d.ts.map +1 -0
- package/dist/cli/define-app.js +79 -0
- package/dist/cli/define-app.js.map +1 -0
- package/dist/cli/define-main.d.ts +33 -0
- package/dist/cli/define-main.d.ts.map +1 -0
- package/dist/cli/define-main.js +67 -0
- package/dist/cli/define-main.js.map +1 -0
- package/dist/cli/define-project.d.ts +93 -0
- package/dist/cli/define-project.d.ts.map +1 -0
- package/dist/cli/define-project.js +85 -0
- package/dist/cli/define-project.js.map +1 -0
- package/dist/cli/dev-server.d.ts +20 -0
- package/dist/cli/dev-server.d.ts.map +1 -0
- package/dist/cli/dev-server.js +131 -0
- package/dist/cli/dev-server.js.map +1 -0
- package/dist/cli/discovery.d.ts +29 -0
- package/dist/cli/discovery.d.ts.map +1 -0
- package/dist/cli/discovery.js +142 -0
- package/dist/cli/discovery.js.map +1 -0
- package/dist/cli/factory.d.ts +43 -0
- package/dist/cli/factory.d.ts.map +1 -0
- package/dist/cli/factory.js +52 -0
- package/dist/cli/factory.js.map +1 -0
- package/dist/cli/generators/ai.d.ts +3 -0
- package/dist/cli/generators/ai.d.ts.map +1 -0
- package/dist/cli/generators/ai.js +65 -0
- package/dist/cli/generators/ai.js.map +1 -0
- package/dist/cli/generators/ci.d.ts +5 -0
- package/dist/cli/generators/ci.d.ts.map +1 -0
- package/dist/cli/generators/ci.js +102 -0
- package/dist/cli/generators/ci.js.map +1 -0
- package/dist/cli/generators/detect.d.ts +15 -0
- package/dist/cli/generators/detect.d.ts.map +1 -0
- package/dist/cli/generators/detect.js +75 -0
- package/dist/cli/generators/detect.js.map +1 -0
- package/dist/cli/generators/ide.d.ts +3 -0
- package/dist/cli/generators/ide.d.ts.map +1 -0
- package/dist/cli/generators/ide.js +179 -0
- package/dist/cli/generators/ide.js.map +1 -0
- package/dist/cli/generators/index.d.ts +5 -0
- package/dist/cli/generators/index.d.ts.map +1 -0
- package/dist/cli/generators/index.js +5 -0
- package/dist/cli/generators/index.js.map +1 -0
- package/dist/cli/index.d.ts +81 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +88 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/io.d.ts +131 -0
- package/dist/cli/io.d.ts.map +1 -0
- package/dist/cli/io.js +373 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/mcp/server.d.ts +23 -0
- package/dist/cli/mcp/server.d.ts.map +1 -0
- package/dist/cli/mcp/server.js +148 -0
- package/dist/cli/mcp/server.js.map +1 -0
- package/dist/cli/parser.d.ts +106 -0
- package/dist/cli/parser.d.ts.map +1 -0
- package/dist/cli/parser.js +520 -0
- package/dist/cli/parser.js.map +1 -0
- package/dist/cli/runner.d.ts +75 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +422 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/cli/service.d.ts +61 -0
- package/dist/cli/service.d.ts.map +1 -0
- package/dist/cli/service.js +95 -0
- package/dist/cli/service.js.map +1 -0
- package/dist/cli/types.d.ts +47 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +20 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/wizard.d.ts +11 -0
- package/dist/cli/wizard.d.ts.map +1 -0
- package/dist/cli/wizard.js +2 -0
- package/dist/cli/wizard.js.map +1 -0
- package/dist/cli/workspace-controller.d.ts +36 -0
- package/dist/cli/workspace-controller.d.ts.map +1 -0
- package/dist/cli/workspace-controller.js +896 -0
- package/dist/cli/workspace-controller.js.map +1 -0
- package/dist/cluster/client.d.ts +101 -0
- package/dist/cluster/client.d.ts.map +1 -0
- package/dist/cluster/client.js +256 -0
- package/dist/cluster/client.js.map +1 -0
- package/dist/cluster/cluster.d.ts +82 -0
- package/dist/cluster/cluster.d.ts.map +1 -0
- package/dist/cluster/cluster.js +27 -0
- package/dist/cluster/cluster.js.map +1 -0
- package/dist/cluster/coordinator/cluster-node.model.d.ts +14 -0
- package/dist/cluster/coordinator/cluster-node.model.d.ts.map +1 -0
- package/dist/cluster/coordinator/cluster-node.model.js +15 -0
- package/dist/cluster/coordinator/cluster-node.model.js.map +1 -0
- package/dist/cluster/coordinator/cluster-signals.d.ts +45 -0
- package/dist/cluster/coordinator/cluster-signals.d.ts.map +1 -0
- package/dist/cluster/coordinator/cluster-signals.js +24 -0
- package/dist/cluster/coordinator/cluster-signals.js.map +1 -0
- package/dist/cluster/coordinator/coordinator.process.d.ts +21 -0
- package/dist/cluster/coordinator/coordinator.process.d.ts.map +1 -0
- package/dist/cluster/coordinator/coordinator.process.js +221 -0
- package/dist/cluster/coordinator/coordinator.process.js.map +1 -0
- package/dist/cluster/coordinator/index.d.ts +13 -0
- package/dist/cluster/coordinator/index.d.ts.map +1 -0
- package/dist/cluster/coordinator/index.js +13 -0
- package/dist/cluster/coordinator/index.js.map +1 -0
- package/dist/cluster/coordinator/node-lifecycle.d.ts +31 -0
- package/dist/cluster/coordinator/node-lifecycle.d.ts.map +1 -0
- package/dist/cluster/coordinator/node-lifecycle.js +178 -0
- package/dist/cluster/coordinator/node-lifecycle.js.map +1 -0
- package/dist/cluster/index.d.ts +45 -0
- package/dist/cluster/index.d.ts.map +1 -0
- package/dist/cluster/index.js +57 -0
- package/dist/cluster/index.js.map +1 -0
- package/dist/cluster/protocol.d.ts +204 -0
- package/dist/cluster/protocol.d.ts.map +1 -0
- package/dist/cluster/protocol.js +274 -0
- package/dist/cluster/protocol.js.map +1 -0
- package/dist/cluster/scheduled-task/builder.d.ts +24 -0
- package/dist/cluster/scheduled-task/builder.d.ts.map +1 -0
- package/dist/cluster/scheduled-task/builder.js +63 -0
- package/dist/cluster/scheduled-task/builder.js.map +1 -0
- package/dist/cluster/scheduled-task/factory.d.ts +76 -0
- package/dist/cluster/scheduled-task/factory.d.ts.map +1 -0
- package/dist/cluster/scheduled-task/factory.js +64 -0
- package/dist/cluster/scheduled-task/factory.js.map +1 -0
- package/dist/cluster/scheduled-task/index.d.ts +43 -0
- package/dist/cluster/scheduled-task/index.d.ts.map +1 -0
- package/dist/cluster/scheduled-task/index.js +45 -0
- package/dist/cluster/scheduled-task/index.js.map +1 -0
- package/dist/cluster/scheduled-task/transport.d.ts +12 -0
- package/dist/cluster/scheduled-task/transport.d.ts.map +1 -0
- package/dist/cluster/scheduled-task/transport.js +146 -0
- package/dist/cluster/scheduled-task/transport.js.map +1 -0
- package/dist/cluster/scheduled-task/types.d.ts +89 -0
- package/dist/cluster/scheduled-task/types.d.ts.map +1 -0
- package/dist/cluster/scheduled-task/types.js +7 -0
- package/dist/cluster/scheduled-task/types.js.map +1 -0
- package/dist/cluster/server.d.ts +87 -0
- package/dist/cluster/server.d.ts.map +1 -0
- package/dist/cluster/server.js +290 -0
- package/dist/cluster/server.js.map +1 -0
- package/dist/cluster/transport.d.ts +86 -0
- package/dist/cluster/transport.d.ts.map +1 -0
- package/dist/cluster/transport.js +138 -0
- package/dist/cluster/transport.js.map +1 -0
- package/dist/core/container-hooks.d.ts +22 -0
- package/dist/core/container-hooks.d.ts.map +1 -0
- package/dist/core/container-hooks.js +29 -0
- package/dist/core/container-hooks.js.map +1 -0
- package/dist/core/container-reflection.d.ts +71 -0
- package/dist/core/container-reflection.d.ts.map +1 -0
- package/dist/core/container-reflection.js +60 -0
- package/dist/core/container-reflection.js.map +1 -0
- package/dist/core/context.d.ts +146 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +155 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/contribution.d.ts +152 -0
- package/dist/core/contribution.d.ts.map +1 -0
- package/dist/core/contribution.js +213 -0
- package/dist/core/contribution.js.map +1 -0
- package/dist/core/controller.contextual.d.ts +193 -0
- package/dist/core/controller.contextual.d.ts.map +1 -0
- package/dist/core/controller.contextual.js +459 -0
- package/dist/core/controller.contextual.js.map +1 -0
- package/dist/core/controller.d.ts +510 -0
- package/dist/core/controller.d.ts.map +1 -0
- package/dist/core/controller.js +411 -0
- package/dist/core/controller.js.map +1 -0
- package/dist/core/controller.procedure.d.ts +147 -0
- package/dist/core/controller.procedure.d.ts.map +1 -0
- package/dist/core/controller.procedure.js +115 -0
- package/dist/core/controller.procedure.js.map +1 -0
- package/dist/core/disposable.d.ts +126 -0
- package/dist/core/disposable.d.ts.map +1 -0
- package/dist/core/disposable.js +179 -0
- package/dist/core/disposable.js.map +1 -0
- package/dist/core/hmr.d.ts +83 -0
- package/dist/core/hmr.d.ts.map +1 -0
- package/dist/core/hmr.js +211 -0
- package/dist/core/hmr.js.map +1 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +25 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/internal/routes.d.ts +26 -0
- package/dist/core/internal/routes.d.ts.map +1 -0
- package/dist/core/internal/routes.js +48 -0
- package/dist/core/internal/routes.js.map +1 -0
- package/dist/core/lifecycle-impl.d.ts +45 -0
- package/dist/core/lifecycle-impl.d.ts.map +1 -0
- package/dist/core/lifecycle-impl.js +102 -0
- package/dist/core/lifecycle-impl.js.map +1 -0
- package/dist/core/lifecycle.d.ts +86 -0
- package/dist/core/lifecycle.d.ts.map +1 -0
- package/dist/core/lifecycle.js +38 -0
- package/dist/core/lifecycle.js.map +1 -0
- package/dist/core/logger.d.ts +282 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +368 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/middleware.d.ts +108 -0
- package/dist/core/middleware.d.ts.map +1 -0
- package/dist/core/middleware.js +60 -0
- package/dist/core/middleware.js.map +1 -0
- package/dist/core/openapi-methods.d.ts +61 -0
- package/dist/core/openapi-methods.d.ts.map +1 -0
- package/dist/core/openapi-methods.js +53 -0
- package/dist/core/openapi-methods.js.map +1 -0
- package/dist/core/plugin.d.ts +209 -0
- package/dist/core/plugin.d.ts.map +1 -0
- package/dist/core/plugin.js +36 -0
- package/dist/core/plugin.js.map +1 -0
- package/dist/core/scope-bridge.d.ts +19 -0
- package/dist/core/scope-bridge.d.ts.map +1 -0
- package/dist/core/scope-bridge.js +34 -0
- package/dist/core/scope-bridge.js.map +1 -0
- package/dist/core/service.d.ts +429 -0
- package/dist/core/service.d.ts.map +1 -0
- package/dist/core/service.js +875 -0
- package/dist/core/service.js.map +1 -0
- package/dist/features/channel/backend.d.ts +98 -0
- package/dist/features/channel/backend.d.ts.map +1 -0
- package/dist/features/channel/backend.js +75 -0
- package/dist/features/channel/backend.js.map +1 -0
- package/dist/features/channel/channel.d.ts +18 -0
- package/dist/features/channel/channel.d.ts.map +1 -0
- package/dist/features/channel/channel.js +219 -0
- package/dist/features/channel/channel.js.map +1 -0
- package/dist/features/channel/channels.d.ts +87 -0
- package/dist/features/channel/channels.d.ts.map +1 -0
- package/dist/features/channel/channels.js +252 -0
- package/dist/features/channel/channels.js.map +1 -0
- package/dist/features/channel/feature.d.ts +40 -0
- package/dist/features/channel/feature.d.ts.map +1 -0
- package/dist/features/channel/feature.js +44 -0
- package/dist/features/channel/feature.js.map +1 -0
- package/dist/features/channel/index.d.ts +41 -0
- package/dist/features/channel/index.d.ts.map +1 -0
- package/dist/features/channel/index.js +41 -0
- package/dist/features/channel/index.js.map +1 -0
- package/dist/features/channel/types.d.ts +165 -0
- package/dist/features/channel/types.d.ts.map +1 -0
- package/dist/features/channel/types.js +10 -0
- package/dist/features/channel/types.js.map +1 -0
- package/dist/features/config/cli/config-controller.d.ts +77 -0
- package/dist/features/config/cli/config-controller.d.ts.map +1 -0
- package/dist/features/config/cli/config-controller.js +209 -0
- package/dist/features/config/cli/config-controller.js.map +1 -0
- package/dist/features/config/cli/index.d.ts +9 -0
- package/dist/features/config/cli/index.d.ts.map +1 -0
- package/dist/features/config/cli/index.js +9 -0
- package/dist/features/config/cli/index.js.map +1 -0
- package/dist/features/config/cli/profile-controller.d.ts +87 -0
- package/dist/features/config/cli/profile-controller.d.ts.map +1 -0
- package/dist/features/config/cli/profile-controller.js +223 -0
- package/dist/features/config/cli/profile-controller.js.map +1 -0
- package/dist/features/config/cli/utils.d.ts +14 -0
- package/dist/features/config/cli/utils.d.ts.map +1 -0
- package/dist/features/config/cli/utils.js +29 -0
- package/dist/features/config/cli/utils.js.map +1 -0
- package/dist/features/config/config-of.d.ts +36 -0
- package/dist/features/config/config-of.d.ts.map +1 -0
- package/dist/features/config/config-of.js +36 -0
- package/dist/features/config/config-of.js.map +1 -0
- package/dist/features/config/config-service.d.ts +54 -0
- package/dist/features/config/config-service.d.ts.map +1 -0
- package/dist/features/config/config-service.js +184 -0
- package/dist/features/config/config-service.js.map +1 -0
- package/dist/features/config/create-config.d.ts +21 -0
- package/dist/features/config/create-config.d.ts.map +1 -0
- package/dist/features/config/create-config.js +16 -0
- package/dist/features/config/create-config.js.map +1 -0
- package/dist/features/config/define-config-partial.d.ts +13 -0
- package/dist/features/config/define-config-partial.d.ts.map +1 -0
- package/dist/features/config/define-config-partial.js +19 -0
- package/dist/features/config/define-config-partial.js.map +1 -0
- package/dist/features/config/env-service.d.ts +54 -0
- package/dist/features/config/env-service.d.ts.map +1 -0
- package/dist/features/config/env-service.js +115 -0
- package/dist/features/config/env-service.js.map +1 -0
- package/dist/features/config/file-watcher.d.ts +13 -0
- package/dist/features/config/file-watcher.d.ts.map +1 -0
- package/dist/features/config/file-watcher.js +98 -0
- package/dist/features/config/file-watcher.js.map +1 -0
- package/dist/features/config/index.d.ts +21 -0
- package/dist/features/config/index.d.ts.map +1 -0
- package/dist/features/config/index.js +24 -0
- package/dist/features/config/index.js.map +1 -0
- package/dist/features/config/profile-service.d.ts +59 -0
- package/dist/features/config/profile-service.d.ts.map +1 -0
- package/dist/features/config/profile-service.js +114 -0
- package/dist/features/config/profile-service.js.map +1 -0
- package/dist/features/config/types.d.ts +38 -0
- package/dist/features/config/types.d.ts.map +1 -0
- package/dist/features/config/types.js +17 -0
- package/dist/features/config/types.js.map +1 -0
- package/dist/features/contract/contract.d.ts +264 -0
- package/dist/features/contract/contract.d.ts.map +1 -0
- package/dist/features/contract/contract.js +183 -0
- package/dist/features/contract/contract.js.map +1 -0
- package/dist/features/contract/index.d.ts +2 -0
- package/dist/features/contract/index.d.ts.map +1 -0
- package/dist/features/contract/index.js +2 -0
- package/dist/features/contract/index.js.map +1 -0
- package/dist/features/env/contribute.d.ts +70 -0
- package/dist/features/env/contribute.d.ts.map +1 -0
- package/dist/features/env/contribute.js +195 -0
- package/dist/features/env/contribute.js.map +1 -0
- package/dist/features/environment/create-environment.d.ts +58 -0
- package/dist/features/environment/create-environment.d.ts.map +1 -0
- package/dist/features/environment/create-environment.js +22 -0
- package/dist/features/environment/create-environment.js.map +1 -0
- package/dist/features/environment/index.d.ts +12 -0
- package/dist/features/environment/index.d.ts.map +1 -0
- package/dist/features/environment/index.js +10 -0
- package/dist/features/environment/index.js.map +1 -0
- package/dist/features/environment/load.d.ts +59 -0
- package/dist/features/environment/load.d.ts.map +1 -0
- package/dist/features/environment/load.js +117 -0
- package/dist/features/environment/load.js.map +1 -0
- package/dist/features/environment/types.d.ts +165 -0
- package/dist/features/environment/types.d.ts.map +1 -0
- package/dist/features/environment/types.js +18 -0
- package/dist/features/environment/types.js.map +1 -0
- package/dist/features/feature-flags/create-feature-flag-provider.d.ts +21 -0
- package/dist/features/feature-flags/create-feature-flag-provider.d.ts.map +1 -0
- package/dist/features/feature-flags/create-feature-flag-provider.js +16 -0
- package/dist/features/feature-flags/create-feature-flag-provider.js.map +1 -0
- package/dist/features/feature-flags/define-feature-flag-partial.d.ts +20 -0
- package/dist/features/feature-flags/define-feature-flag-partial.d.ts.map +1 -0
- package/dist/features/feature-flags/define-feature-flag-partial.js +26 -0
- package/dist/features/feature-flags/define-feature-flag-partial.js.map +1 -0
- package/dist/features/feature-flags/feature-flag-of.d.ts +16 -0
- package/dist/features/feature-flags/feature-flag-of.d.ts.map +1 -0
- package/dist/features/feature-flags/feature-flag-of.js +16 -0
- package/dist/features/feature-flags/feature-flag-of.js.map +1 -0
- package/dist/features/feature-flags/feature-flag-service.d.ts +22 -0
- package/dist/features/feature-flags/feature-flag-service.d.ts.map +1 -0
- package/dist/features/feature-flags/feature-flag-service.js +112 -0
- package/dist/features/feature-flags/feature-flag-service.js.map +1 -0
- package/dist/features/feature-flags/index.d.ts +15 -0
- package/dist/features/feature-flags/index.d.ts.map +1 -0
- package/dist/features/feature-flags/index.js +12 -0
- package/dist/features/feature-flags/index.js.map +1 -0
- package/dist/features/feature-flags/types.d.ts +30 -0
- package/dist/features/feature-flags/types.d.ts.map +1 -0
- package/dist/features/feature-flags/types.js +8 -0
- package/dist/features/feature-flags/types.js.map +1 -0
- package/dist/features/index.d.ts +6 -0
- package/dist/features/index.d.ts.map +1 -0
- package/dist/features/index.js +7 -0
- package/dist/features/index.js.map +1 -0
- package/dist/features/lock/index.d.ts +4 -0
- package/dist/features/lock/index.d.ts.map +1 -0
- package/dist/features/lock/index.js +4 -0
- package/dist/features/lock/index.js.map +1 -0
- package/dist/features/lock/lock-service.d.ts +74 -0
- package/dist/features/lock/lock-service.d.ts.map +1 -0
- package/dist/features/lock/lock-service.js +210 -0
- package/dist/features/lock/lock-service.js.map +1 -0
- package/dist/features/lock/memory.d.ts +60 -0
- package/dist/features/lock/memory.d.ts.map +1 -0
- package/dist/features/lock/memory.js +194 -0
- package/dist/features/lock/memory.js.map +1 -0
- package/dist/features/lock/types.d.ts +151 -0
- package/dist/features/lock/types.d.ts.map +1 -0
- package/dist/features/lock/types.js +17 -0
- package/dist/features/lock/types.js.map +1 -0
- package/dist/features/memory/index.d.ts +18 -0
- package/dist/features/memory/index.d.ts.map +1 -0
- package/dist/features/memory/index.js +18 -0
- package/dist/features/memory/index.js.map +1 -0
- package/dist/features/memory/lock-feature.d.ts +21 -0
- package/dist/features/memory/lock-feature.d.ts.map +1 -0
- package/dist/features/memory/lock-feature.js +24 -0
- package/dist/features/memory/lock-feature.js.map +1 -0
- package/dist/features/secrets/create-secret-provider.d.ts +31 -0
- package/dist/features/secrets/create-secret-provider.d.ts.map +1 -0
- package/dist/features/secrets/create-secret-provider.js +26 -0
- package/dist/features/secrets/create-secret-provider.js.map +1 -0
- package/dist/features/secrets/define-secret-partial.d.ts +16 -0
- package/dist/features/secrets/define-secret-partial.d.ts.map +1 -0
- package/dist/features/secrets/define-secret-partial.js +26 -0
- package/dist/features/secrets/define-secret-partial.js.map +1 -0
- package/dist/features/secrets/index.d.ts +17 -0
- package/dist/features/secrets/index.d.ts.map +1 -0
- package/dist/features/secrets/index.js +14 -0
- package/dist/features/secrets/index.js.map +1 -0
- package/dist/features/secrets/secret-of.d.ts +19 -0
- package/dist/features/secrets/secret-of.d.ts.map +1 -0
- package/dist/features/secrets/secret-of.js +21 -0
- package/dist/features/secrets/secret-of.js.map +1 -0
- package/dist/features/secrets/secret-service.d.ts +21 -0
- package/dist/features/secrets/secret-service.d.ts.map +1 -0
- package/dist/features/secrets/secret-service.js +28 -0
- package/dist/features/secrets/secret-service.js.map +1 -0
- package/dist/features/secrets/types.d.ts +30 -0
- package/dist/features/secrets/types.d.ts.map +1 -0
- package/dist/features/secrets/types.js +8 -0
- package/dist/features/secrets/types.js.map +1 -0
- package/dist/features/vault/env-var-vault.d.ts +24 -0
- package/dist/features/vault/env-var-vault.d.ts.map +1 -0
- package/dist/features/vault/env-var-vault.js +43 -0
- package/dist/features/vault/env-var-vault.js.map +1 -0
- package/dist/features/vault/hardcoded-vault.d.ts +34 -0
- package/dist/features/vault/hardcoded-vault.d.ts.map +1 -0
- package/dist/features/vault/hardcoded-vault.js +46 -0
- package/dist/features/vault/hardcoded-vault.js.map +1 -0
- package/dist/features/vault/hashicorp-vault.d.ts +32 -0
- package/dist/features/vault/hashicorp-vault.d.ts.map +1 -0
- package/dist/features/vault/hashicorp-vault.js +69 -0
- package/dist/features/vault/hashicorp-vault.js.map +1 -0
- package/dist/features/vault/index.d.ts +13 -0
- package/dist/features/vault/index.d.ts.map +1 -0
- package/dist/features/vault/index.js +12 -0
- package/dist/features/vault/index.js.map +1 -0
- package/dist/features/vault/kubernetes-vault.d.ts +27 -0
- package/dist/features/vault/kubernetes-vault.d.ts.map +1 -0
- package/dist/features/vault/kubernetes-vault.js +51 -0
- package/dist/features/vault/kubernetes-vault.js.map +1 -0
- package/dist/features/vault/types.d.ts +41 -0
- package/dist/features/vault/types.d.ts.map +1 -0
- package/dist/features/vault/types.js +21 -0
- package/dist/features/vault/types.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/justscale.d.ts +63 -0
- package/dist/justscale.d.ts.map +1 -0
- package/dist/justscale.js +501 -0
- package/dist/justscale.js.map +1 -0
- package/dist/kernel/adapter.d.ts +9 -0
- package/dist/kernel/adapter.d.ts.map +1 -0
- package/dist/kernel/adapter.js +2 -0
- package/dist/kernel/adapter.js.map +1 -0
- package/dist/kernel/kernel.d.ts +15 -0
- package/dist/kernel/kernel.d.ts.map +1 -0
- package/dist/kernel/kernel.js +134 -0
- package/dist/kernel/kernel.js.map +1 -0
- package/dist/models/access.d.ts +26 -0
- package/dist/models/access.d.ts.map +1 -0
- package/dist/models/access.js +126 -0
- package/dist/models/access.js.map +1 -0
- package/dist/models/apply-types-config.d.ts +52 -0
- package/dist/models/apply-types-config.d.ts.map +1 -0
- package/dist/models/apply-types-config.js +47 -0
- package/dist/models/apply-types-config.js.map +1 -0
- package/dist/models/define-model.d.ts +249 -0
- package/dist/models/define-model.d.ts.map +1 -0
- package/dist/models/define-model.js +388 -0
- package/dist/models/define-model.js.map +1 -0
- package/dist/models/field.d.ts +309 -0
- package/dist/models/field.d.ts.map +1 -0
- package/dist/models/field.js +312 -0
- package/dist/models/field.js.map +1 -0
- package/dist/models/in-memory/condition-evaluator.d.ts +53 -0
- package/dist/models/in-memory/condition-evaluator.d.ts.map +1 -0
- package/dist/models/in-memory/condition-evaluator.js +593 -0
- package/dist/models/in-memory/condition-evaluator.js.map +1 -0
- package/dist/models/in-memory/in-memory-model.d.ts +89 -0
- package/dist/models/in-memory/in-memory-model.d.ts.map +1 -0
- package/dist/models/in-memory/in-memory-model.js +101 -0
- package/dist/models/in-memory/in-memory-model.js.map +1 -0
- package/dist/models/in-memory/in-memory-repository.d.ts +208 -0
- package/dist/models/in-memory/in-memory-repository.d.ts.map +1 -0
- package/dist/models/in-memory/in-memory-repository.js +618 -0
- package/dist/models/in-memory/in-memory-repository.js.map +1 -0
- package/dist/models/in-memory/in-memory-scheduled-task.repository.d.ts +92 -0
- package/dist/models/in-memory/in-memory-scheduled-task.repository.d.ts.map +1 -0
- package/dist/models/in-memory/in-memory-scheduled-task.repository.js +395 -0
- package/dist/models/in-memory/in-memory-scheduled-task.repository.js.map +1 -0
- package/dist/models/in-memory/index.d.ts +35 -0
- package/dist/models/in-memory/index.d.ts.map +1 -0
- package/dist/models/in-memory/index.js +36 -0
- package/dist/models/in-memory/index.js.map +1 -0
- package/dist/models/index.d.ts +52 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +86 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/model-name-registry.d.ts +16 -0
- package/dist/models/model-name-registry.d.ts.map +1 -0
- package/dist/models/model-name-registry.js +19 -0
- package/dist/models/model-name-registry.js.map +1 -0
- package/dist/models/model.d.ts +15 -0
- package/dist/models/model.d.ts.map +1 -0
- package/dist/models/model.js +114 -0
- package/dist/models/model.js.map +1 -0
- package/dist/models/model.repository.d.ts +318 -0
- package/dist/models/model.repository.d.ts.map +1 -0
- package/dist/models/model.repository.js +146 -0
- package/dist/models/model.repository.js.map +1 -0
- package/dist/models/observable.d.ts +15 -0
- package/dist/models/observable.d.ts.map +1 -0
- package/dist/models/observable.js +64 -0
- package/dist/models/observable.js.map +1 -0
- package/dist/models/proxy.d.ts +5 -0
- package/dist/models/proxy.d.ts.map +1 -0
- package/dist/models/proxy.js +407 -0
- package/dist/models/proxy.js.map +1 -0
- package/dist/models/query.d.ts +574 -0
- package/dist/models/query.d.ts.map +1 -0
- package/dist/models/query.js +701 -0
- package/dist/models/query.js.map +1 -0
- package/dist/models/reference/reference.d.ts +229 -0
- package/dist/models/reference/reference.d.ts.map +1 -0
- package/dist/models/reference/reference.js +331 -0
- package/dist/models/reference/reference.js.map +1 -0
- package/dist/models/reference/transient-ref.d.ts +123 -0
- package/dist/models/reference/transient-ref.d.ts.map +1 -0
- package/dist/models/reference/transient-ref.js +152 -0
- package/dist/models/reference/transient-ref.js.map +1 -0
- package/dist/models/repository.d.ts +53 -0
- package/dist/models/repository.d.ts.map +1 -0
- package/dist/models/repository.js +37 -0
- package/dist/models/repository.js.map +1 -0
- package/dist/models/scheduled-task/index.d.ts +13 -0
- package/dist/models/scheduled-task/index.d.ts.map +1 -0
- package/dist/models/scheduled-task/index.js +12 -0
- package/dist/models/scheduled-task/index.js.map +1 -0
- package/dist/models/scheduled-task/scheduled-task.d.ts +73 -0
- package/dist/models/scheduled-task/scheduled-task.d.ts.map +1 -0
- package/dist/models/scheduled-task/scheduled-task.js +95 -0
- package/dist/models/scheduled-task/scheduled-task.js.map +1 -0
- package/dist/models/scheduled-task/scheduled-task.repository.d.ts +150 -0
- package/dist/models/scheduled-task/scheduled-task.repository.d.ts.map +1 -0
- package/dist/models/scheduled-task/scheduled-task.repository.js +40 -0
- package/dist/models/scheduled-task/scheduled-task.repository.js.map +1 -0
- package/dist/models/stream.d.ts +139 -0
- package/dist/models/stream.d.ts.map +1 -0
- package/dist/models/stream.js +153 -0
- package/dist/models/stream.js.map +1 -0
- package/dist/models/symbols.d.ts +73 -0
- package/dist/models/symbols.d.ts.map +1 -0
- package/dist/models/symbols.js +97 -0
- package/dist/models/symbols.js.map +1 -0
- package/dist/models/types.d.ts +291 -0
- package/dist/models/types.d.ts.map +1 -0
- package/dist/models/types.js +50 -0
- package/dist/models/types.js.map +1 -0
- package/dist/models/watch.d.ts +27 -0
- package/dist/models/watch.d.ts.map +1 -0
- package/dist/models/watch.js +124 -0
- package/dist/models/watch.js.map +1 -0
- package/dist/models/zod-ref.d.ts +46 -0
- package/dist/models/zod-ref.d.ts.map +1 -0
- package/dist/models/zod-ref.js +31 -0
- package/dist/models/zod-ref.js.map +1 -0
- package/dist/process/builtin-serializers.d.ts +19 -0
- package/dist/process/builtin-serializers.d.ts.map +1 -0
- package/dist/process/builtin-serializers.js +213 -0
- package/dist/process/builtin-serializers.js.map +1 -0
- package/dist/process/cluster-plugin.d.ts +129 -0
- package/dist/process/cluster-plugin.d.ts.map +1 -0
- package/dist/process/cluster-plugin.js +175 -0
- package/dist/process/cluster-plugin.js.map +1 -0
- package/dist/process/createProcess.d.ts +67 -0
- package/dist/process/createProcess.d.ts.map +1 -0
- package/dist/process/createProcess.js +111 -0
- package/dist/process/createProcess.js.map +1 -0
- package/dist/process/define-signals.d.ts +113 -0
- package/dist/process/define-signals.d.ts.map +1 -0
- package/dist/process/define-signals.js +222 -0
- package/dist/process/define-signals.js.map +1 -0
- package/dist/process/delay-controller.d.ts +35 -0
- package/dist/process/delay-controller.d.ts.map +1 -0
- package/dist/process/delay-controller.js +55 -0
- package/dist/process/delay-controller.js.map +1 -0
- package/dist/process/index.d.ts +38 -0
- package/dist/process/index.d.ts.map +1 -0
- package/dist/process/index.js +47 -0
- package/dist/process/index.js.map +1 -0
- package/dist/process/primitives.d.ts +393 -0
- package/dist/process/primitives.d.ts.map +1 -0
- package/dist/process/primitives.js +325 -0
- package/dist/process/primitives.js.map +1 -0
- package/dist/process/serialization.d.ts +58 -0
- package/dist/process/serialization.d.ts.map +1 -0
- package/dist/process/serialization.js +220 -0
- package/dist/process/serialization.js.map +1 -0
- package/dist/process/stream-utils.d.ts +123 -0
- package/dist/process/stream-utils.d.ts.map +1 -0
- package/dist/process/stream-utils.js +247 -0
- package/dist/process/stream-utils.js.map +1 -0
- package/dist/process/testing/clock.d.ts +115 -0
- package/dist/process/testing/clock.d.ts.map +1 -0
- package/dist/process/testing/clock.js +166 -0
- package/dist/process/testing/clock.js.map +1 -0
- package/dist/process/testing/index.d.ts +9 -0
- package/dist/process/testing/index.d.ts.map +1 -0
- package/dist/process/testing/index.js +9 -0
- package/dist/process/testing/index.js.map +1 -0
- package/dist/process/testing.d.ts +50 -0
- package/dist/process/testing.d.ts.map +1 -0
- package/dist/process/testing.js +59 -0
- package/dist/process/testing.js.map +1 -0
- package/dist/process/types.d.ts +540 -0
- package/dist/process/types.d.ts.map +1 -0
- package/dist/process/types.js +21 -0
- package/dist/process/types.js.map +1 -0
- package/dist/queue/index.d.ts +2 -0
- package/dist/queue/index.d.ts.map +1 -0
- package/dist/queue/index.js +2 -0
- package/dist/queue/index.js.map +1 -0
- package/dist/queue/queue.d.ts +34 -0
- package/dist/queue/queue.d.ts.map +1 -0
- package/dist/queue/queue.js +108 -0
- package/dist/queue/queue.js.map +1 -0
- package/dist/runtime/process/compiled.d.ts +56 -0
- package/dist/runtime/process/compiled.d.ts.map +1 -0
- package/dist/runtime/process/compiled.js +221 -0
- package/dist/runtime/process/compiled.js.map +1 -0
- package/dist/runtime/process/executor.d.ts +279 -0
- package/dist/runtime/process/executor.d.ts.map +1 -0
- package/dist/runtime/process/executor.js +1941 -0
- package/dist/runtime/process/executor.js.map +1 -0
- package/dist/runtime/process/factory.d.ts +72 -0
- package/dist/runtime/process/factory.d.ts.map +1 -0
- package/dist/runtime/process/factory.js +78 -0
- package/dist/runtime/process/factory.js.map +1 -0
- package/dist/runtime/process/freeze.d.ts +5 -0
- package/dist/runtime/process/freeze.d.ts.map +1 -0
- package/dist/runtime/process/freeze.js +94 -0
- package/dist/runtime/process/freeze.js.map +1 -0
- package/dist/runtime/process/scheduled-task-timer.d.ts +52 -0
- package/dist/runtime/process/scheduled-task-timer.d.ts.map +1 -0
- package/dist/runtime/process/scheduled-task-timer.js +104 -0
- package/dist/runtime/process/scheduled-task-timer.js.map +1 -0
- package/dist/runtime/process/signal-bus.d.ts +186 -0
- package/dist/runtime/process/signal-bus.d.ts.map +1 -0
- package/dist/runtime/process/signal-bus.js +256 -0
- package/dist/runtime/process/signal-bus.js.map +1 -0
- package/dist/runtime/process/state-serializer.d.ts +30 -0
- package/dist/runtime/process/state-serializer.d.ts.map +1 -0
- package/dist/runtime/process/state-serializer.js +244 -0
- package/dist/runtime/process/state-serializer.js.map +1 -0
- package/dist/runtime/process/storage.d.ts +96 -0
- package/dist/runtime/process/storage.d.ts.map +1 -0
- package/dist/runtime/process/storage.js +165 -0
- package/dist/runtime/process/storage.js.map +1 -0
- package/dist/runtime/process/timer-scheduler.d.ts +115 -0
- package/dist/runtime/process/timer-scheduler.d.ts.map +1 -0
- package/dist/runtime/process/timer-scheduler.js +192 -0
- package/dist/runtime/process/timer-scheduler.js.map +1 -0
- package/dist/runtime/process/trace.d.ts +17 -0
- package/dist/runtime/process/trace.d.ts.map +1 -0
- package/dist/runtime/process/trace.js +26 -0
- package/dist/runtime/process/trace.js.map +1 -0
- package/dist/runtime/protobuf/encoding/index.d.ts +26 -0
- package/dist/runtime/protobuf/encoding/index.d.ts.map +1 -0
- package/dist/runtime/protobuf/encoding/index.js +30 -0
- package/dist/runtime/protobuf/encoding/index.js.map +1 -0
- package/dist/runtime/protobuf/encoding/reader.d.ts +182 -0
- package/dist/runtime/protobuf/encoding/reader.d.ts.map +1 -0
- package/dist/runtime/protobuf/encoding/reader.js +353 -0
- package/dist/runtime/protobuf/encoding/reader.js.map +1 -0
- package/dist/runtime/protobuf/encoding/varint.d.ts +67 -0
- package/dist/runtime/protobuf/encoding/varint.d.ts.map +1 -0
- package/dist/runtime/protobuf/encoding/varint.js +117 -0
- package/dist/runtime/protobuf/encoding/varint.js.map +1 -0
- package/dist/runtime/protobuf/encoding/wire-types.d.ts +62 -0
- package/dist/runtime/protobuf/encoding/wire-types.d.ts.map +1 -0
- package/dist/runtime/protobuf/encoding/wire-types.js +103 -0
- package/dist/runtime/protobuf/encoding/wire-types.js.map +1 -0
- package/dist/runtime/protobuf/encoding/writer.d.ts +147 -0
- package/dist/runtime/protobuf/encoding/writer.d.ts.map +1 -0
- package/dist/runtime/protobuf/encoding/writer.js +214 -0
- package/dist/runtime/protobuf/encoding/writer.js.map +1 -0
- package/dist/runtime/protobuf/index.d.ts +3 -0
- package/dist/runtime/protobuf/index.d.ts.map +1 -0
- package/dist/runtime/protobuf/index.js +3 -0
- package/dist/runtime/protobuf/index.js.map +1 -0
- package/dist/runtime/protobuf/serialized.d.ts +48 -0
- package/dist/runtime/protobuf/serialized.d.ts.map +1 -0
- package/dist/runtime/protobuf/serialized.js +517 -0
- package/dist/runtime/protobuf/serialized.js.map +1 -0
- package/package.json +209 -0
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for the fluent builder API.
|
|
3
|
+
*/
|
|
4
|
+
import type { ServiceDef, Service, ServiceToken as CoreServiceToken } from '../core/service.js';
|
|
5
|
+
import { SERVICE_PROVIDES } from '../core/service.js';
|
|
6
|
+
import type { App } from '../app.js';
|
|
7
|
+
import type { ControllerDef } from '../core/controller.js';
|
|
8
|
+
import type { RepositoryToken, Repository } from '../models/repository.js';
|
|
9
|
+
import type { GuardDef, MiddlewareDef } from '../core/middleware.js';
|
|
10
|
+
import type { Stop } from './stop.js';
|
|
11
|
+
import type { TypedParams } from '../models/apply-types-config.js';
|
|
12
|
+
import type { ConfigComponent, ConfigPartial } from '../features/config/types.js';
|
|
13
|
+
import type { ConfigToken } from '../features/config/config-of.js';
|
|
14
|
+
import type { SecretComponent, SecretPartial } from '../features/secrets/types.js';
|
|
15
|
+
import type { SecretToken } from '../features/secrets/secret-of.js';
|
|
16
|
+
import type { FeatureFlagComponent, FeatureFlagPartial } from '../features/feature-flags/types.js';
|
|
17
|
+
import type { FeatureFlagToken } from '../features/feature-flags/feature-flag-of.js';
|
|
18
|
+
import type { Environment } from '../features/environment/types.js';
|
|
19
|
+
/**
|
|
20
|
+
* Brand for type-level token identification.
|
|
21
|
+
* Ensures Token<A> is not assignable to Token<B>.
|
|
22
|
+
*/
|
|
23
|
+
declare const TOKEN_BRAND: unique symbol;
|
|
24
|
+
/**
|
|
25
|
+
* A typed token for dependency injection.
|
|
26
|
+
*
|
|
27
|
+
* Tokens identify what a component provides or requires.
|
|
28
|
+
* They can be:
|
|
29
|
+
* - ServiceDef (created via defineService)
|
|
30
|
+
* - RepositoryToken (created via Repository.of or ModelRepository.of)
|
|
31
|
+
* - Class/AbstractClass
|
|
32
|
+
* - FeatureToken (created via createFeature)
|
|
33
|
+
*/
|
|
34
|
+
export type Token<T = unknown> = {
|
|
35
|
+
readonly [TOKEN_BRAND]?: T;
|
|
36
|
+
readonly description?: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Union of all valid token types in the system.
|
|
40
|
+
*/
|
|
41
|
+
export type AnyToken = CoreServiceToken | RepositoryToken<any> | FeatureToken<any, any>;
|
|
42
|
+
/** Symbol to identify feature tokens */
|
|
43
|
+
export declare const FEATURE_TOKEN: unique symbol;
|
|
44
|
+
/** Symbol for feature metadata */
|
|
45
|
+
export declare const FEATURE_META: unique symbol;
|
|
46
|
+
/**
|
|
47
|
+
* Metadata stored on a feature.
|
|
48
|
+
*/
|
|
49
|
+
export interface FeatureMetadata {
|
|
50
|
+
readonly name?: string;
|
|
51
|
+
readonly requires: AnyToken[];
|
|
52
|
+
readonly onStart?: StartHook;
|
|
53
|
+
readonly onStop?: StopHook;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Lifecycle hook called when cluster starts.
|
|
57
|
+
*/
|
|
58
|
+
export type StartHook = (ctx: {
|
|
59
|
+
resolve: <T>(token: Token<T>) => T;
|
|
60
|
+
}) => Promise<void> | void;
|
|
61
|
+
/**
|
|
62
|
+
* Lifecycle hook called when cluster stops.
|
|
63
|
+
*/
|
|
64
|
+
export type StopHook = () => Promise<void> | void;
|
|
65
|
+
export interface FeatureToken<TRequires extends AnyToken[] = [], TProvides extends AnyToken[] = []> {
|
|
66
|
+
(builder: Builder<TRequires>): Builder<[...TRequires, ...TProvides]>;
|
|
67
|
+
readonly [FEATURE_TOKEN]: true;
|
|
68
|
+
readonly [FEATURE_META]: FeatureMetadata;
|
|
69
|
+
}
|
|
70
|
+
/** Symbol to identify repository bindings */
|
|
71
|
+
export declare const REPO_BINDING: unique symbol;
|
|
72
|
+
/**
|
|
73
|
+
* A binding from a RepositoryToken to its implementation.
|
|
74
|
+
*/
|
|
75
|
+
export interface RepositoryBinding<T = unknown> {
|
|
76
|
+
readonly [REPO_BINDING]: true;
|
|
77
|
+
readonly token: RepositoryToken<T>;
|
|
78
|
+
readonly implementation: unknown;
|
|
79
|
+
}
|
|
80
|
+
/** Symbol to identify service bindings */
|
|
81
|
+
export declare const SERVICE_BINDING: unique symbol;
|
|
82
|
+
/**
|
|
83
|
+
* A binding from an abstract service token to its implementation.
|
|
84
|
+
* Used to bind abstract classes to concrete implementations.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* bindService(AbstractChannelBackend, MemoryChannelBackend)
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export interface ServiceBinding<T = unknown> {
|
|
92
|
+
readonly [SERVICE_BINDING]: true;
|
|
93
|
+
readonly token: CoreServiceToken<T>;
|
|
94
|
+
readonly implementation: CoreServiceToken<T>;
|
|
95
|
+
}
|
|
96
|
+
/** Symbol to identify instance bindings */
|
|
97
|
+
export declare const INSTANCE_BINDING: unique symbol;
|
|
98
|
+
/**
|
|
99
|
+
* A binding from an abstract service token to a concrete instance.
|
|
100
|
+
* Used to bind abstract classes to pre-created instances.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const taskRepo = new InMemoryScheduledTaskRepository()
|
|
105
|
+
* bindInstance(ScheduledTaskRepository, taskRepo)
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export interface InstanceBinding<T = unknown> {
|
|
109
|
+
readonly [INSTANCE_BINDING]: true;
|
|
110
|
+
readonly token: CoreServiceToken<T>;
|
|
111
|
+
readonly instance: T;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Check if value is an InstanceBinding.
|
|
115
|
+
*/
|
|
116
|
+
export declare function isInstanceBinding(value: unknown): value is InstanceBinding<any>;
|
|
117
|
+
/**
|
|
118
|
+
* A callback that extends the builder.
|
|
119
|
+
* Can declare requirements via its type signature.
|
|
120
|
+
*/
|
|
121
|
+
export type BuilderCallback<TRequires extends AnyToken[] = AnyToken[], TProvides extends AnyToken[] = AnyToken[]> = (builder: Builder<TRequires>) => Builder<[...TRequires, ...TProvides]>;
|
|
122
|
+
/**
|
|
123
|
+
* All component types that can be added to a builder.
|
|
124
|
+
*/
|
|
125
|
+
export type Component = ServiceDef<any, any> | Service<any, any> | ControllerDef<any> | RepositoryBinding<any> | ServiceBinding<any> | InstanceBinding<any> | FeatureToken<any, any> | BuilderCallback<any, any> | ConfigComponent | SecretComponent | FeatureFlagComponent | Environment | import('../justscale.js').BuiltApp<any, any> | Component[];
|
|
126
|
+
/**
|
|
127
|
+
* Check if value is a ServiceDef.
|
|
128
|
+
* Handles both defineService object-form and class-extends-function forms.
|
|
129
|
+
*/
|
|
130
|
+
export declare function isServiceDef(value: unknown): value is ServiceDef<any, any>;
|
|
131
|
+
/**
|
|
132
|
+
* Check if value is a ControllerDef.
|
|
133
|
+
*/
|
|
134
|
+
export declare function isControllerDef(value: unknown): value is ControllerDef<any>;
|
|
135
|
+
/**
|
|
136
|
+
* Check if value is a RepositoryBinding.
|
|
137
|
+
*/
|
|
138
|
+
export declare function isRepositoryBinding(value: unknown): value is RepositoryBinding<any>;
|
|
139
|
+
/**
|
|
140
|
+
* Check if value is a ServiceBinding.
|
|
141
|
+
*/
|
|
142
|
+
export declare function isServiceBinding(value: unknown): value is ServiceBinding<any>;
|
|
143
|
+
/**
|
|
144
|
+
* Check if value is a FeatureToken.
|
|
145
|
+
*/
|
|
146
|
+
export declare function isFeatureToken(value: unknown): value is FeatureToken<any, any>;
|
|
147
|
+
/**
|
|
148
|
+
* Check if value is a BuilderCallback (function but not feature).
|
|
149
|
+
*/
|
|
150
|
+
export declare function isBuilderCallback(value: unknown): value is BuilderCallback<any, any>;
|
|
151
|
+
/**
|
|
152
|
+
* Check if value is a component array.
|
|
153
|
+
*/
|
|
154
|
+
export declare function isComponentArray(value: unknown): value is Component[];
|
|
155
|
+
type ConstructorOf<T> = T extends InstanceType<infer C> ? C : never;
|
|
156
|
+
type IsClassInstance<T> = ConstructorOf<T> extends never ? false : true;
|
|
157
|
+
/** Extract SERVICE_PROVIDES tokens from a component. */
|
|
158
|
+
type ExtractServiceProvides<C> = C extends {
|
|
159
|
+
[SERVICE_PROVIDES]: infer TProvides extends CoreServiceToken[];
|
|
160
|
+
} ? TProvides : [];
|
|
161
|
+
/**
|
|
162
|
+
* Extract what tokens a component provides to the builder.
|
|
163
|
+
*
|
|
164
|
+
* For ServiceDefs: provides both the ServiceDef itself AND the class constructor
|
|
165
|
+
* if the instance type is a class instance. This allows services that create
|
|
166
|
+
* AbstractPostgresClient instances to satisfy dependencies on typeof AbstractPostgresClient.
|
|
167
|
+
*
|
|
168
|
+
* For services with `provides` option: also provides the tokens listed in SERVICE_PROVIDES.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* ProvidesOf<ServiceDef<AbstractPostgresClient, {...}>> // [ServiceDef, typeof AbstractPostgresClient]
|
|
173
|
+
* ProvidesOf<RepositoryBinding<User>> // [RepositoryToken<User>]
|
|
174
|
+
* ProvidesOf<FeatureToken<[], [A, B]>> // [A, B]
|
|
175
|
+
* ProvidesOf<Component[]> // flattened provides
|
|
176
|
+
* ProvidesOf<ServiceWithProvides> // [Service, ...provides tokens]
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
export type ProvidesOf<C> = C extends ServiceDef<infer T, any> ? IsClassInstance<T> extends true ? [C, ConstructorOf<T>, ...ExtractServiceProvides<C>] : [C, ...ExtractServiceProvides<C>] : C extends Service<any, any> ? [C, ...ExtractServiceProvides<C>] : C extends RepositoryBinding<infer T> ? [RepositoryToken<T>] : C extends ServiceBinding<infer T> ? [CoreServiceToken<T>] : C extends InstanceBinding<infer T> ? [CoreServiceToken<T>] : C extends FeatureToken<any, infer TProvides> ? TProvides : C extends (b: Builder<any>) => Builder<infer TNew> ? TNew extends [...any[], ...infer TProvides] ? TProvides : [] : C extends ControllerDef<any> ? [C] : C extends ConfigComponent<infer CP> ? ConfigTokensFor<CP> : C extends SecretComponent<infer SP> ? SecretTokensFor<SP> : C extends FeatureFlagComponent<infer FP> ? FeatureFlagTokensFor<FP> : C extends Environment<infer EnvS, infer EnvP> ? [...FlattenProvidesTuple<EnvS>, ...FlattenProvidesTuple<EnvP>] : C extends readonly (infer Item)[] ? FlattenProvides<Item> : [];
|
|
180
|
+
type ConfigTokensFor<P> = P extends readonly [infer H, ...infer Rest] ? H extends ConfigPartial<infer T> ? [ConfigToken<T>, ...ConfigTokensFor<Rest>] : ConfigTokensFor<Rest> : [];
|
|
181
|
+
type SecretTokensFor<P> = P extends readonly [infer H, ...infer Rest] ? H extends SecretPartial<infer T> ? [SecretToken<T>, ...SecretTokensFor<Rest>] : SecretTokensFor<Rest> : [];
|
|
182
|
+
type FeatureFlagTokensFor<P> = P extends readonly [infer H, ...infer Rest] ? H extends FeatureFlagPartial<infer T> ? [FeatureFlagToken<T>, ...FeatureFlagTokensFor<Rest>] : FeatureFlagTokensFor<Rest> : [];
|
|
183
|
+
/**
|
|
184
|
+
* Walk a tuple of Components and concat each element's ProvidesOf.
|
|
185
|
+
* Used by `Environment<S, P>` to surface the exact set of tokens an env's
|
|
186
|
+
* inner services and providers supply, so consumers downstream of
|
|
187
|
+
* `.add(env)` get the same compile-time DI check as without the env.
|
|
188
|
+
*/
|
|
189
|
+
type FlattenProvidesTuple<Items> = Items extends readonly [infer Head, ...infer Rest] ? [...Extract<ProvidesOf<Head>, readonly unknown[]>, ...FlattenProvidesTuple<Rest>] : [];
|
|
190
|
+
/**
|
|
191
|
+
* Flatten provides from array items.
|
|
192
|
+
* Uses NonRecursiveComponent to avoid infinite recursion.
|
|
193
|
+
*/
|
|
194
|
+
type NonRecursiveComponent = ServiceDef<any, any> | ControllerDef<any> | RepositoryBinding<any> | ServiceBinding<any> | InstanceBinding<any> | FeatureToken<any, any> | BuilderCallback<any, any>;
|
|
195
|
+
type FlattenProvides<T> = T extends NonRecursiveComponent ? ProvidesOf<T>[number] : never;
|
|
196
|
+
/**
|
|
197
|
+
* Extract the dep tokens from a deps record.
|
|
198
|
+
*/
|
|
199
|
+
type DepsToTokens<TDeps> = TDeps extends Record<string, infer V> ? V : never;
|
|
200
|
+
/**
|
|
201
|
+
* Extract transport requirements from a single route definition.
|
|
202
|
+
*
|
|
203
|
+
* A route factory (e.g., `Get()` from @justscale/http) stamps `__transportRequires`
|
|
204
|
+
* on its return type as a brand to declare what the transport needs (typically a
|
|
205
|
+
* Config partial). Routes that don't stamp this (any existing route at the time
|
|
206
|
+
* step 3 lands) yield `never` - RequiresOf is unchanged for them.
|
|
207
|
+
*
|
|
208
|
+
* The field exists at the type level only (no runtime data required for this
|
|
209
|
+
* compile-time check - runtime adapter install happens via build-phase ALS).
|
|
210
|
+
*/
|
|
211
|
+
type ExtractRouteTransportRequires<R> = R extends {
|
|
212
|
+
readonly __transportRequires: readonly (infer T)[];
|
|
213
|
+
} ? T : never;
|
|
214
|
+
/**
|
|
215
|
+
* Aggregate transport requirements across all routes in a controller's routes shape.
|
|
216
|
+
* Handles both record form (`{ list: Get(...) }`) and array form.
|
|
217
|
+
*/
|
|
218
|
+
type ControllerTransportRequires<TRoutes> = TRoutes extends readonly (infer Route)[] ? ExtractRouteTransportRequires<Route> : TRoutes extends Record<string, infer Route> ? ExtractRouteTransportRequires<Route> : never;
|
|
219
|
+
/**
|
|
220
|
+
* Extract the inject deps from a MiddlewareDef or GuardDef.
|
|
221
|
+
*
|
|
222
|
+
* Plain middleware/guard functions (not passed through `createMiddleware` /
|
|
223
|
+
* `createGuard`) carry no DI metadata - they yield `never`, matching the
|
|
224
|
+
* behavior of the existing transport-requires stamp. Only DI-aware
|
|
225
|
+
* middleware contributes to the controller's require set.
|
|
226
|
+
*/
|
|
227
|
+
export type ExtractStepDeps<Step> = Step extends MiddlewareDef<any, infer TDeps> ? DepsToTokens<TDeps> : Step extends GuardDef<infer TDeps> ? DepsToTokens<TDeps> : Step extends readonly GuardDef<infer TDeps>[] ? DepsToTokens<TDeps> : never;
|
|
228
|
+
/**
|
|
229
|
+
* Extract the "added" context type from a middleware value. Handles:
|
|
230
|
+
* - plain functions returning an object or Promise<object>
|
|
231
|
+
* - DI-aware MiddlewareDef (produces a middleware whose return is the added type)
|
|
232
|
+
*
|
|
233
|
+
* Returns `never` for values that don't match either shape - callers
|
|
234
|
+
* compose this with `TContext & ExtractAddedFromMiddleware<TMw>` so
|
|
235
|
+
* `never` neutralises via intersection with whatever context exists.
|
|
236
|
+
*/
|
|
237
|
+
export type ExtractAddedFromMiddleware<TMw> = TMw extends MiddlewareDef<infer TAdded, any> ? TAdded : TMw extends (...args: any[]) => infer R ? R extends Promise<infer A> ? A : R : never;
|
|
238
|
+
/**
|
|
239
|
+
* Extract the TRequirements type parameter from a RouteDef.
|
|
240
|
+
*
|
|
241
|
+
* The type parameter accumulates middleware/guard deps as `.use()` and
|
|
242
|
+
* `.guard()` calls are chained on a route builder. Here we pull it off
|
|
243
|
+
* the finalized `RouteDef<TPath, TReturns, TRequirements, TBody>`
|
|
244
|
+
* signature.
|
|
245
|
+
*/
|
|
246
|
+
type ExtractRouteRequirements<R> = R extends RouteDef<any, any, infer TReq, any> ? TReq : never;
|
|
247
|
+
/**
|
|
248
|
+
* Aggregate middleware/guard requirements across all routes in a
|
|
249
|
+
* controller's routes shape. Mirror of `ControllerTransportRequires`.
|
|
250
|
+
*/
|
|
251
|
+
type ControllerRouteRequirements<TRoutes> = TRoutes extends readonly (infer Route)[] ? ExtractRouteRequirements<Route> : TRoutes extends Record<string, infer Route> ? ExtractRouteRequirements<Route> : never;
|
|
252
|
+
/**
|
|
253
|
+
* Extract what tokens a component requires (direct dependencies).
|
|
254
|
+
*
|
|
255
|
+
* For controllers, this includes:
|
|
256
|
+
* - injected services (from `inject: { ... }`)
|
|
257
|
+
* - transport requirements from route factories (e.g., `Get()` implying
|
|
258
|
+
* an HTTP adapter token)
|
|
259
|
+
* - middleware/guard inject deps attached to routes via `.use()` / `.guard()`
|
|
260
|
+
*/
|
|
261
|
+
export type RequiresOf<C> = C extends ControllerDef<infer TDeps, infer TRoutes, any> ? (DepsToTokens<TDeps> | ControllerTransportRequires<TRoutes> | ControllerRouteRequirements<TRoutes>)[] : C extends ServiceDef<any, infer TDeps> ? DepsToTokens<TDeps>[] : C extends Service<any, infer TDeps> ? DepsToTokens<TDeps>[] : C extends FeatureToken<infer TRequires, any> ? TRequires : C extends (b: Builder<infer TReq>) => any ? TReq : [];
|
|
262
|
+
/**
|
|
263
|
+
* Recursively extract transitive requirements.
|
|
264
|
+
* If C requires S, and S is a ServiceDef that requires T, then C transitively requires T.
|
|
265
|
+
*
|
|
266
|
+
* For Repository ServiceDefs (where instance extends Repository<any>), we require BOTH
|
|
267
|
+
* the ServiceDef itself AND its transitive deps. This ensures repositories are explicitly registered.
|
|
268
|
+
*
|
|
269
|
+
* For other ServiceDefs (inline services), we only require transitive deps - they're
|
|
270
|
+
* auto-created by the container on demand.
|
|
271
|
+
*
|
|
272
|
+
* For class tokens and other non-ServiceDef requirements, we require them as-is.
|
|
273
|
+
*/
|
|
274
|
+
export type TransitiveRequiresOf<C> = RequiresOf<C> extends (infer Req)[] ? Req extends ServiceDef<infer TInstance, infer TDeps> ? TInstance extends Repository<any> ? Req | DepsToTokens<TDeps> : DepsToTokens<TDeps> : Req extends {
|
|
275
|
+
path: string;
|
|
276
|
+
deps: Record<string, any>;
|
|
277
|
+
} ? never : Req : never;
|
|
278
|
+
/**
|
|
279
|
+
* Check if token T is satisfied by token H (either same type or H provides T).
|
|
280
|
+
* Uses wrapper to avoid distribution over unions.
|
|
281
|
+
*/
|
|
282
|
+
type TokenSatisfies<T, H> = [
|
|
283
|
+
T
|
|
284
|
+
] extends [H] ? true : [H] extends [T] ? true : false;
|
|
285
|
+
/**
|
|
286
|
+
* Check if a token T is provided in the TProvided tuple.
|
|
287
|
+
* Returns true if any provided token satisfies the requirement.
|
|
288
|
+
*/
|
|
289
|
+
export type IsProvided<T, TProvided extends AnyToken[]> = TProvided extends [infer Head, ...infer Tail extends AnyToken[]] ? TokenSatisfies<T, Head> extends true ? true : IsProvided<T, Tail> : false;
|
|
290
|
+
/**
|
|
291
|
+
* Get the missing requirements from a list of requirements.
|
|
292
|
+
*/
|
|
293
|
+
type MissingRequirements<TRequired, TProvided extends AnyToken[]> = TRequired extends (infer Req)[] ? Req extends AnyToken ? IsProvided<Req, TProvided> extends true ? never : Req : never : never;
|
|
294
|
+
/**
|
|
295
|
+
* Error type shown when dependencies are missing.
|
|
296
|
+
* The error message includes which dependencies are missing.
|
|
297
|
+
*/
|
|
298
|
+
export interface MissingDepsError<_C, TMissing> {
|
|
299
|
+
readonly __brand: 'MissingDependencies';
|
|
300
|
+
readonly _missing: TMissing;
|
|
301
|
+
readonly _hint: 'Add the missing dependencies before this component';
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Type constraint that enforces dependencies are satisfied at compile time.
|
|
305
|
+
* Returns the component type C if all requirements are met,
|
|
306
|
+
* otherwise returns a MissingDepsError which won't accept the component.
|
|
307
|
+
*/
|
|
308
|
+
export type RequiresSatisfied<C, TProvided extends AnyToken[]> = MissingRequirements<TransitiveRequiresOf<C>[], TProvided> extends never ? C : MissingDepsError<C, MissingRequirements<TransitiveRequiresOf<C>[], TProvided>>;
|
|
309
|
+
/**
|
|
310
|
+
* Remove a token from a tuple.
|
|
311
|
+
* Used by .override() to remove the old token before adding the new one.
|
|
312
|
+
*/
|
|
313
|
+
export type RemoveFromTuple<T, Tuple extends any[]> = Tuple extends [infer H, ...infer Rest extends any[]] ? TokenSatisfies<T, H> extends true ? RemoveFromTuple<T, Rest> : [H, ...RemoveFromTuple<T, Rest>] : [];
|
|
314
|
+
/**
|
|
315
|
+
* Extract a built sub-app's TRequires tuple. Sub-apps carry their requires
|
|
316
|
+
* tuple in a phantom `__requires` field on `IBuiltApp<TProvided, TRequires>`;
|
|
317
|
+
* this utility pulls it back out so a parent builder can verify its own
|
|
318
|
+
* TProvided covers the sub-app's surface before accepting the `.add()`.
|
|
319
|
+
*
|
|
320
|
+
* Returns `never` for non-sub-app components - callers fall through to
|
|
321
|
+
* the regular `RequiresSatisfied` path in that case.
|
|
322
|
+
*/
|
|
323
|
+
type ExtractSubAppRequires<C> = C extends {
|
|
324
|
+
readonly __requires: infer R;
|
|
325
|
+
} ? R extends readonly AnyToken[] ? R : never : never;
|
|
326
|
+
/**
|
|
327
|
+
* Error shown when a sub-app is `.add()`-ed into a builder that doesn't
|
|
328
|
+
* provide all of the sub-app's declared `.requires(...)`. Distinct from
|
|
329
|
+
* `MissingDepsError` so the hint can point at the sub-app's surface.
|
|
330
|
+
*/
|
|
331
|
+
export interface MissingSubAppRequiresError<_C, TMissing> {
|
|
332
|
+
readonly __brand: 'MissingSubAppRequires';
|
|
333
|
+
readonly _missing: TMissing;
|
|
334
|
+
readonly _hint: 'This sub-app declared .requires() tokens not provided by the enclosing JustScale(). Add them before .add()-ing the sub-app.';
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* `.add()` gate used by the Builder. Branches on whether the added
|
|
338
|
+
* component is a built sub-app (carries `__requires`). Sub-apps check
|
|
339
|
+
* their TRequires against TProvided; everything else falls through to
|
|
340
|
+
* the regular component dep check.
|
|
341
|
+
*/
|
|
342
|
+
export type AddCheck<C, TProvided extends AnyToken[]> = ExtractSubAppRequires<C> extends infer SR ? [SR] extends [never] ? RequiresSatisfied<C, TProvided> : SR extends AnyToken[] ? MissingRequirements<SR, TProvided> extends never ? C : MissingSubAppRequiresError<C, MissingRequirements<SR, TProvided>> : RequiresSatisfied<C, TProvided> : RequiresSatisfied<C, TProvided>;
|
|
343
|
+
/**
|
|
344
|
+
* Error shown when a builder with unresolved `.requires()` tries to
|
|
345
|
+
* compile. Sub-apps can `.build()` on their own (for shipping as a unit),
|
|
346
|
+
* but must be composed into a parent to `.compile()` successfully.
|
|
347
|
+
*/
|
|
348
|
+
export interface CannotCompileSubAppError<TMissing> {
|
|
349
|
+
readonly __brand: 'CannotCompileSubApp';
|
|
350
|
+
readonly _missing: TMissing;
|
|
351
|
+
readonly _hint: 'This builder declared .requires(). .add() it into a parent JustScale() that provides the tokens, then compile the parent.';
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Gate used by `IBuiltApp.compile()`. Empty TRequires → real App type.
|
|
355
|
+
* Non-empty TRequires → branded error that the caller gets back when they
|
|
356
|
+
* try to use the compiled value, surfacing the misuse at its call site.
|
|
357
|
+
*/
|
|
358
|
+
export type CompileResult<TRequires extends AnyToken[], TApp> = TRequires extends readonly [] ? TApp : CannotCompileSubAppError<TRequires[number]>;
|
|
359
|
+
/**
|
|
360
|
+
* Fluent builder for creating clusters.
|
|
361
|
+
*
|
|
362
|
+
* Two phantom type parameters track the builder's state:
|
|
363
|
+
*
|
|
364
|
+
* - `TProvided` - tokens that have been added via `.add()` (and satisfy
|
|
365
|
+
* other components' `.inject` requirements).
|
|
366
|
+
* - `TRequires` - tokens declared via `.requires()` that the builder
|
|
367
|
+
* expects an enclosing scope to provide. Non-empty TRequires marks the
|
|
368
|
+
* builder as a *sub-app*: it cannot compile standalone; it must be
|
|
369
|
+
* `.add()`-ed into a parent `JustScale()` that covers the requires.
|
|
370
|
+
*
|
|
371
|
+
* @typeParam TProvided - Tuple of tokens that have been added
|
|
372
|
+
* @typeParam TRequires - Tuple of tokens declared via `.requires()`
|
|
373
|
+
*/
|
|
374
|
+
export interface Builder<TProvided extends AnyToken[] = [], TRequires extends AnyToken[] = []> {
|
|
375
|
+
/**
|
|
376
|
+
* Add a component to the builder.
|
|
377
|
+
*
|
|
378
|
+
* Components can be:
|
|
379
|
+
* - Services (defineService result)
|
|
380
|
+
* - Controllers (createController result)
|
|
381
|
+
* - Repository bindings (ModelRepository.of(X).bind(Y))
|
|
382
|
+
* - Features (createFeature result)
|
|
383
|
+
* - Callbacks ((b) => b.add(...))
|
|
384
|
+
* - Arrays of components
|
|
385
|
+
* - Sub-apps (another `JustScale()...build()` that used `.requires()`)
|
|
386
|
+
*
|
|
387
|
+
* Dependencies are checked at compile time. For normal components the
|
|
388
|
+
* check is "does TProvided satisfy this component's `.inject` deps?".
|
|
389
|
+
* For sub-apps the check is "does TProvided satisfy the sub-app's
|
|
390
|
+
* declared `.requires(...)`?". Both produce branded compile errors
|
|
391
|
+
* when unsatisfied.
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```typescript
|
|
395
|
+
* createClusterBuilder()
|
|
396
|
+
* .add(PgClient)
|
|
397
|
+
* .add(ModelRepository.of(User).bind(PgUser))
|
|
398
|
+
* .add(UserService)
|
|
399
|
+
* .add(AuthFeature)
|
|
400
|
+
* .build()
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
403
|
+
add<C extends Component>(component: AddCheck<C, TProvided>): Builder<[...TProvided, ...ProvidesOf<C>], TRequires>;
|
|
404
|
+
/**
|
|
405
|
+
* Append controller defs discovered at runtime (no compile-time dep checking).
|
|
406
|
+
*
|
|
407
|
+
* Intended for infrastructure (e.g. the `just` CLI runner) that needs to
|
|
408
|
+
* register controllers whose existence isn't known until install time -
|
|
409
|
+
* typically CLI controllers contributed by installed packages. Their deps
|
|
410
|
+
* resolve against the same container as the user's app, so injected
|
|
411
|
+
* repositories/services are shared.
|
|
412
|
+
*
|
|
413
|
+
* Prefer `.add()` for anything you type-check at authoring time.
|
|
414
|
+
*
|
|
415
|
+
* @internal
|
|
416
|
+
*/
|
|
417
|
+
addControllers(controllers: ReadonlyArray<import('../core/controller.js').ControllerDef<any>>): Builder<TProvided, TRequires>;
|
|
418
|
+
/**
|
|
419
|
+
* Override an existing token with a new implementation.
|
|
420
|
+
*
|
|
421
|
+
* This is useful for replacing built-in services (Logger, Lifecycle)
|
|
422
|
+
* or for testing purposes. The token must already be in TProvided.
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* ```typescript
|
|
426
|
+
* createClusterBuilder()
|
|
427
|
+
* .add(InMemoryProcessStorage)
|
|
428
|
+
* .override(Logger, CustomLogger) // Replace built-in Logger
|
|
429
|
+
* .build()
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
override<TToken extends TProvided[number], // Must exist in TProvided
|
|
433
|
+
TImpl extends AnyToken>(token: TToken, implementation: TImpl): Builder<[...RemoveFromTuple<TToken, TProvided>, TImpl], TRequires>;
|
|
434
|
+
/**
|
|
435
|
+
* Declare a token this builder needs from a parent scope.
|
|
436
|
+
*
|
|
437
|
+
* Adding `.requires(T)` turns this builder into a *sub-app*: the
|
|
438
|
+
* resulting TRequires tuple captures everything the builder expects
|
|
439
|
+
* the enclosing `JustScale()` to provide. Downstream `.add()`s see
|
|
440
|
+
* T in TProvided, so components that inject T type-check as usual.
|
|
441
|
+
* But `.compile()` on a builder with non-empty TRequires yields a
|
|
442
|
+
* branded error - the builder must be `.add()`-ed into a parent that
|
|
443
|
+
* covers the requires.
|
|
444
|
+
*
|
|
445
|
+
* At runtime, the parent resolves T and bridges it into the sub-app's
|
|
446
|
+
* container via `createScopedBridge`, so calls through T from inside
|
|
447
|
+
* the sub-app execute in the parent's async scope.
|
|
448
|
+
*
|
|
449
|
+
* The token type is captured as-is (not widened to the full
|
|
450
|
+
* `ServiceToken<T>` union) - so the parent's `IsProvided` check can
|
|
451
|
+
* match the exact shape the consumer passed, without having to
|
|
452
|
+
* satisfy every member of the ServiceToken union.
|
|
453
|
+
*
|
|
454
|
+
* @see CORE_PHILOSOPHY.md principle 9
|
|
455
|
+
*/
|
|
456
|
+
requires<T extends AnyToken>(token: T): Builder<[...TProvided, T], [...TRequires, T]>;
|
|
457
|
+
/**
|
|
458
|
+
* Build the cluster.
|
|
459
|
+
*
|
|
460
|
+
* Validates all dependencies are satisfied and creates the runnable
|
|
461
|
+
* cluster. The returned built value is typed with both TProvided and
|
|
462
|
+
* TRequires so downstream composers (parents `.add()`-ing this) can
|
|
463
|
+
* type-check that they cover the sub-app's requires.
|
|
464
|
+
*/
|
|
465
|
+
build(): import('../justscale.js').BuiltApp<TProvided, TRequires>;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Extract controller types from a tuple of tokens.
|
|
469
|
+
*/
|
|
470
|
+
export type ExtractControllers<TProvided extends AnyToken[]> = TProvided extends [infer Head, ...infer Tail extends AnyToken[]] ? Head extends import('../core/controller.js').ControllerDef<any> ? [Head, ...ExtractControllers<Tail>] : ExtractControllers<Tail> : [];
|
|
471
|
+
/**
|
|
472
|
+
* A built cluster ready to serve.
|
|
473
|
+
* @typeParam TProvided - Tuple of all tokens that were provided to the builder
|
|
474
|
+
*/
|
|
475
|
+
export interface BuiltCluster<TProvided extends AnyToken[] = AnyToken[]> {
|
|
476
|
+
/**
|
|
477
|
+
* Compile the cluster into an App instance.
|
|
478
|
+
* This creates the actual runtime with match() and execute() methods.
|
|
479
|
+
*/
|
|
480
|
+
compile(): App<ExtractControllers<TProvided>>;
|
|
481
|
+
/**
|
|
482
|
+
* The DI container for resolving services.
|
|
483
|
+
*/
|
|
484
|
+
readonly container: import('../core/service.js').Container;
|
|
485
|
+
/**
|
|
486
|
+
* Start serving on the specified protocols.
|
|
487
|
+
* Internally calls compile() if not already compiled.
|
|
488
|
+
*/
|
|
489
|
+
serve(options?: ServeOptions): Promise<void>;
|
|
490
|
+
/**
|
|
491
|
+
* Stop the cluster gracefully.
|
|
492
|
+
*/
|
|
493
|
+
stop(): Promise<void>;
|
|
494
|
+
/**
|
|
495
|
+
* Resolve a token from the container.
|
|
496
|
+
*/
|
|
497
|
+
resolve<T>(token: Token<T>): Promise<T>;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Re-exported from cluster/cluster.ts so IBuiltApp.serve(options?) has the
|
|
501
|
+
* same signature as BuiltApp.serve(options?). Single source of truth -
|
|
502
|
+
* previously these diverged and IBuiltApp silently disagreed with runtime.
|
|
503
|
+
*/
|
|
504
|
+
import type { ServeOptions } from '../cluster/cluster.js';
|
|
505
|
+
export type { ServeOptions };
|
|
506
|
+
/**
|
|
507
|
+
* Extract added context type from a middleware function.
|
|
508
|
+
*/
|
|
509
|
+
export type ExtractMiddlewareAdded<T> = T extends (ctx: any) => infer R ? R extends Promise<infer A> ? A : R : never;
|
|
510
|
+
/**
|
|
511
|
+
* Response entry in TReturns union.
|
|
512
|
+
* `TPermission` is the permission def type when declared via
|
|
513
|
+
* `.returns(status, schema, permission)`. Defaults to `unknown` for
|
|
514
|
+
* unpermissioned returns.
|
|
515
|
+
*/
|
|
516
|
+
export interface ResponseEntry<TStatus extends number, TBody, TPermission = unknown> {
|
|
517
|
+
status: TStatus;
|
|
518
|
+
body: TBody;
|
|
519
|
+
permission: TPermission;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Extract status codes from TReturns union.
|
|
523
|
+
*/
|
|
524
|
+
export type ExtractStatuses<T> = T extends ResponseEntry<infer S, any, any> ? S : never;
|
|
525
|
+
/**
|
|
526
|
+
* Extract body type for a specific status code.
|
|
527
|
+
*/
|
|
528
|
+
export type ExtractBodyForStatus<T, TStatus extends number> = T extends ResponseEntry<TStatus, infer B, any> ? B : never;
|
|
529
|
+
/**
|
|
530
|
+
* Shape of a permission def with a name discriminator - anything structural
|
|
531
|
+
* matching this can be used as a `.returns()` permission argument.
|
|
532
|
+
*/
|
|
533
|
+
export interface PermissionDefLike<TName extends string = string> {
|
|
534
|
+
readonly name: TName;
|
|
535
|
+
}
|
|
536
|
+
/** Extract the permission type from a single ResponseEntry. */
|
|
537
|
+
export type PermOf<E> = E extends ResponseEntry<any, any, infer P> ? P : never;
|
|
538
|
+
/** Extract the body type from a single ResponseEntry. */
|
|
539
|
+
export type BodyOf<E> = E extends ResponseEntry<any, infer B, any> ? B : never;
|
|
540
|
+
/** Extract the permission name from a PermissionDefLike. */
|
|
541
|
+
export type NameOf<P> = P extends PermissionDefLike<infer N> ? N : never;
|
|
542
|
+
/**
|
|
543
|
+
* Filter a ResponseEntry union down to entries that have a permission
|
|
544
|
+
* (i.e. TPermission extends PermissionDefLike).
|
|
545
|
+
*/
|
|
546
|
+
export type PermEntries<R> = R extends ResponseEntry<any, any, infer P> ? P extends PermissionDefLike<any> ? R : never : never;
|
|
547
|
+
/**
|
|
548
|
+
* Build a discriminated union variant `{ permission, json }` from a single entry.
|
|
549
|
+
* Uses single-infer helpers to avoid TypeScript's multi-infer-union quirk.
|
|
550
|
+
*/
|
|
551
|
+
export type ToPermissionVariant<E> = E extends any ? {
|
|
552
|
+
readonly permission: NameOf<PermOf<E>>;
|
|
553
|
+
json(data: BodyOf<E>): void;
|
|
554
|
+
} : never;
|
|
555
|
+
/** Build the full discriminated union for a permission-scoped res. */
|
|
556
|
+
export type PermissionVariants<R> = ToPermissionVariant<PermEntries<R>>;
|
|
557
|
+
/**
|
|
558
|
+
* A resolved execution step - fn is always a callable function.
|
|
559
|
+
* Used in CompiledRoute after GuardDef resolution.
|
|
560
|
+
*/
|
|
561
|
+
export interface Step {
|
|
562
|
+
type: 'use' | 'guard';
|
|
563
|
+
fn: (ctx: any) => any;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* An unresolved step - discriminated by type:
|
|
567
|
+
* - 'use': fn may be a MiddlewareDef (DI) or plain middleware function
|
|
568
|
+
* - 'guard': fn may be a GuardDef (DI), array of GuardDefs (OR semantics), or plain guard function
|
|
569
|
+
*
|
|
570
|
+
* Stored in RouteDef (builder output). Resolved to Step[] by createController.
|
|
571
|
+
*/
|
|
572
|
+
export type UnresolvedStep = {
|
|
573
|
+
type: 'use';
|
|
574
|
+
fn: ((ctx: any) => any) | MiddlewareDef;
|
|
575
|
+
} | {
|
|
576
|
+
type: 'guard';
|
|
577
|
+
fn: ((ctx: any) => any) | GuardDef<any> | readonly GuardDef<any>[];
|
|
578
|
+
};
|
|
579
|
+
/**
|
|
580
|
+
* Finalized route definition (builder output - steps are unresolved).
|
|
581
|
+
* GuardDefs in steps are resolved by createController via the DI container.
|
|
582
|
+
*/
|
|
583
|
+
export interface RouteDef<TPath extends string, TReturns, TRequirements, TBody = unknown> {
|
|
584
|
+
path: TPath;
|
|
585
|
+
steps: UnresolvedStep[];
|
|
586
|
+
responseSchemas: Map<number, import('zod').ZodType | null>;
|
|
587
|
+
handler: (ctx: any) => any;
|
|
588
|
+
/** Model types for path param → Reference transformation */
|
|
589
|
+
types?: Record<string, abstract new (...args: any[]) => any>;
|
|
590
|
+
/**
|
|
591
|
+
* Permission-scoped returns - declared via `.returns(status, schema, permission)`.
|
|
592
|
+
* Consumed by the `permissions` middleware to determine which permission the
|
|
593
|
+
* current caller matches (sets `res.permission`).
|
|
594
|
+
*/
|
|
595
|
+
permissionReturns?: ReadonlyArray<{
|
|
596
|
+
status: number;
|
|
597
|
+
schema: import('zod').ZodType | null;
|
|
598
|
+
permission: PermissionDefLike;
|
|
599
|
+
}>;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Base route builder interface.
|
|
603
|
+
*
|
|
604
|
+
* @typeParam TContext - Accumulated context from middleware
|
|
605
|
+
* @typeParam TReturns - Union of possible responses (ResponseEntry union)
|
|
606
|
+
* @typeParam TRequirements - Accumulated DI requirements from plugins
|
|
607
|
+
* @typeParam TPath - Route path literal for param extraction
|
|
608
|
+
* @typeParam TBody - Request body type (accumulated via body() calls)
|
|
609
|
+
*/
|
|
610
|
+
export interface RouteBuilder<TContext, TReturns, TRequirements, TPath extends string, TBody = unknown, THandlerReturn = void | Promise<void>> {
|
|
611
|
+
/**
|
|
612
|
+
* Add middleware that extends context.
|
|
613
|
+
* Cannot stop execution - always returns additions.
|
|
614
|
+
* Accepts either a plain function or a MiddlewareDef (with DI).
|
|
615
|
+
*
|
|
616
|
+
* When passed a DI-aware MiddlewareDef (built via `createMiddleware`),
|
|
617
|
+
* the middleware's `inject` deps are accumulated into TRequirements,
|
|
618
|
+
* which flows through to `RequiresOf<ControllerDef>` so that
|
|
619
|
+
* `.add(Controller)` type-checks at the builder level.
|
|
620
|
+
*/
|
|
621
|
+
use<TMw extends ((ctx: TContext) => object | Promise<object>) | MiddlewareDef<object, any>>(middleware: TMw): RouteBuilder<TContext & ExtractAddedFromMiddleware<TMw>, TReturns, TRequirements | ExtractStepDeps<TMw>, TPath, TBody, THandlerReturn>;
|
|
622
|
+
/**
|
|
623
|
+
* Add guard that can stop execution.
|
|
624
|
+
* Cannot add to context - only checks and potentially stops.
|
|
625
|
+
* Accepts a guard function, a GuardDef (with DI), or an array of GuardDefs (any match = allow).
|
|
626
|
+
*
|
|
627
|
+
* DI-aware GuardDefs contribute their inject deps to TRequirements
|
|
628
|
+
* (same treatment as `.use()` - see there for the rationale).
|
|
629
|
+
*/
|
|
630
|
+
guard<TG extends ((ctx: TContext & {
|
|
631
|
+
stop(): Stop;
|
|
632
|
+
}) => void | Stop | boolean | Promise<void | Stop | boolean>) | GuardDef | readonly GuardDef[]>(check: TG): RouteBuilder<TContext, TReturns, TRequirements | ExtractStepDeps<TG>, TPath, TBody, THandlerReturn>;
|
|
633
|
+
/**
|
|
634
|
+
* Apply a plugin that can chain multiple operations.
|
|
635
|
+
* Plugins can add use/guard/returns in any combination.
|
|
636
|
+
*/
|
|
637
|
+
apply<TCtxOut, TRetOut, TReqOut, TBodyOut = TBody>(plugin: BuilderPlugin<TContext, TCtxOut, TReturns, TRetOut, TRequirements, TReqOut, TPath, TBody, TBodyOut>): RouteBuilder<TCtxOut, TRetOut, TReqOut, TPath, TBodyOut, THandlerReturn>;
|
|
638
|
+
/**
|
|
639
|
+
* Declare a permission-scoped response.
|
|
640
|
+
*
|
|
641
|
+
* Multiple `.returns()` calls with the same status and different permissions
|
|
642
|
+
* build a discriminated union on `res.permission` - the handler branches via
|
|
643
|
+
* `switch(res.permission)` and TypeScript narrows `res.json()` per case.
|
|
644
|
+
*
|
|
645
|
+
* Requires `.use(permissions)` middleware (or equivalent) to set `res.permission`.
|
|
646
|
+
*/
|
|
647
|
+
returns<TStatus extends number, TSchema extends import('zod').ZodType, TPermission extends PermissionDefLike>(status: TStatus, schema: TSchema, permission: TPermission): RouteBuilder<TContext, TReturns | ResponseEntry<TStatus, import('zod').infer<TSchema>, TPermission>, TRequirements, TPath, TBody, THandlerReturn>;
|
|
648
|
+
/**
|
|
649
|
+
* Declare a possible response with schema.
|
|
650
|
+
*/
|
|
651
|
+
returns<TStatus extends number, TSchema extends import('zod').ZodType>(status: TStatus, schema: TSchema): RouteBuilder<TContext, TReturns | ResponseEntry<TStatus, import('zod').infer<TSchema>>, TRequirements, TPath, TBody, THandlerReturn>;
|
|
652
|
+
/**
|
|
653
|
+
* Declare a possible response without body.
|
|
654
|
+
*/
|
|
655
|
+
returns<TStatus extends number>(status: TStatus): RouteBuilder<TContext, TReturns | ResponseEntry<TStatus, void>, TRequirements, TPath, TBody, THandlerReturn>;
|
|
656
|
+
/**
|
|
657
|
+
* Declare model types for path params.
|
|
658
|
+
* Transforms matching params from `string` to `Reference<T>`.
|
|
659
|
+
*/
|
|
660
|
+
types<TTypes extends Record<string, abstract new (...args: any[]) => any>>(types: TTypes): RouteBuilder<Omit<TContext, 'params'> & {
|
|
661
|
+
params: TypedParams<TPath, TTypes>;
|
|
662
|
+
}, TReturns, TRequirements, TPath, TBody, THandlerReturn>;
|
|
663
|
+
/**
|
|
664
|
+
* Set final handler.
|
|
665
|
+
*/
|
|
666
|
+
handle(handler: (ctx: TContext) => THandlerReturn): RouteDef<TPath, TReturns, TRequirements, TBody>;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Forward declaration for BuilderPlugin.
|
|
670
|
+
* Full implementation with PLUGIN_SYMBOL, requirements, and resolve() in plugin.ts
|
|
671
|
+
*
|
|
672
|
+
* This minimal declaration is here to avoid circular dependencies between
|
|
673
|
+
* types.ts (RouteBuilder needs BuilderPlugin) and plugin.ts (BuilderPlugin needs RouteBuilder).
|
|
674
|
+
*/
|
|
675
|
+
export interface BuilderPlugin<TCtxIn, TCtxOut, TRetIn, TRetOut, TReqIn, TReqOut, TPath extends string, TBodyIn = unknown, TBodyOut = TBodyIn, THandlerReturn = void | Promise<void>> {
|
|
676
|
+
(builder: RouteBuilder<TCtxIn, TRetIn, TReqIn, TPath, TBodyIn, THandlerReturn>): RouteBuilder<TCtxOut, TRetOut, TReqOut, TPath, TBodyOut, THandlerReturn>;
|
|
677
|
+
}
|
|
678
|
+
//# sourceMappingURL=types.d.ts.map
|