@cnc-tools/storm 0.0.0 → 0.6.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/bin/node-version.js +24 -0
- package/bin/storm.js +16 -0
- package/dist/application.d.ts +13 -0
- package/dist/application.js +23 -0
- package/dist/bin/storm.d.ts +1 -0
- package/dist/bin/storm.js +45 -0
- package/dist/build-info.js +3 -0
- package/dist/closed-terminal.d.ts +7 -0
- package/dist/closed-terminal.js +18 -0
- package/dist/combine-errors.d.ts +11 -0
- package/dist/combine-errors.js +19 -0
- package/dist/commands/dashboard.d.ts +11 -0
- package/dist/commands/dashboard.js +18 -0
- package/dist/commands/exec/cleanup.d.ts +135 -0
- package/dist/commands/exec/cleanup.js +171 -0
- package/dist/commands/exec/command.d.ts +272 -0
- package/dist/commands/exec/command.js +23 -0
- package/dist/commands/exec/job-summary.d.ts +10 -0
- package/dist/commands/exec/job-summary.js +34 -0
- package/dist/commands/exec/live-view.d.ts +22 -0
- package/dist/commands/exec/live-view.js +395 -0
- package/dist/commands/exec/metadata.d.ts +66 -0
- package/dist/commands/exec/metadata.js +55 -0
- package/dist/commands/exec/mint-failed.d.ts +11 -0
- package/dist/commands/exec/mint-failed.js +33 -0
- package/dist/commands/exec/outcomes.d.ts +614 -0
- package/dist/commands/exec/outcomes.js +338 -0
- package/dist/commands/exec/progress.d.ts +44 -0
- package/dist/commands/exec/progress.js +277 -0
- package/dist/commands/exec/redaction.d.ts +15 -0
- package/dist/commands/exec/redaction.js +40 -0
- package/dist/commands/exec/run-collector.d.ts +30 -0
- package/dist/commands/exec/run-collector.js +73 -0
- package/dist/commands/exec/run-command.d.ts +221 -0
- package/dist/commands/exec/run-command.js +663 -0
- package/dist/commands/exec/run-metadata.d.ts +56 -0
- package/dist/commands/exec/run-metadata.js +58 -0
- package/dist/commands/exec/run-record.d.ts +170 -0
- package/dist/commands/exec/run-record.js +104 -0
- package/dist/commands/exec/tests-summary.d.ts +34 -0
- package/dist/commands/exec/tests-summary.js +141 -0
- package/dist/commands/exec/testserver-flags.d.ts +48 -0
- package/dist/commands/exec/testserver-flags.js +80 -0
- package/dist/commands/exec/text.d.ts +22 -0
- package/dist/commands/exec/text.js +74 -0
- package/dist/commands/exec/view.d.ts +35 -0
- package/dist/commands/exec/view.js +163 -0
- package/dist/commands/exec/waterfall.d.ts +25 -0
- package/dist/commands/exec/waterfall.js +108 -0
- package/dist/commands/exec/worker-chart.d.ts +79 -0
- package/dist/commands/exec/worker-chart.js +313 -0
- package/dist/commands/runs/facts.d.ts +150 -0
- package/dist/commands/runs/facts.js +292 -0
- package/dist/commands/runs/list/command.d.ts +86 -0
- package/dist/commands/runs/list/command.js +36 -0
- package/dist/commands/runs/list/metadata.d.ts +22 -0
- package/dist/commands/runs/list/metadata.js +19 -0
- package/dist/commands/runs/list/outcomes.d.ts +74 -0
- package/dist/commands/runs/list/outcomes.js +89 -0
- package/dist/commands/runs/logs/command.d.ts +72 -0
- package/dist/commands/runs/logs/command.js +51 -0
- package/dist/commands/runs/logs/metadata.d.ts +22 -0
- package/dist/commands/runs/logs/metadata.js +22 -0
- package/dist/commands/runs/logs/outcomes.d.ts +55 -0
- package/dist/commands/runs/logs/outcomes.js +80 -0
- package/dist/commands/runs/metadata.d.ts +3 -0
- package/dist/commands/runs/metadata.js +3 -0
- package/dist/commands/runs/past-run.d.ts +72 -0
- package/dist/commands/runs/past-run.js +99 -0
- package/dist/commands/runs/show/command.d.ts +176 -0
- package/dist/commands/runs/show/command.js +76 -0
- package/dist/commands/runs/show/metadata.d.ts +25 -0
- package/dist/commands/runs/show/metadata.js +22 -0
- package/dist/commands/runs/show/outcomes.d.ts +164 -0
- package/dist/commands/runs/show/outcomes.js +320 -0
- package/dist/commands/vitest/command.d.ts +299 -0
- package/dist/commands/vitest/command.js +138 -0
- package/dist/commands/vitest/metadata.d.ts +66 -0
- package/dist/commands/vitest/metadata.js +35 -0
- package/dist/commands/vitest/outcomes.d.ts +273 -0
- package/dist/commands/vitest/outcomes.js +77 -0
- package/dist/config/by-name.d.ts +24 -0
- package/dist/config/by-name.js +26 -0
- package/dist/config/errors.d.ts +58 -0
- package/dist/config/errors.js +101 -0
- package/dist/config/gateways.d.ts +32 -0
- package/dist/config/gateways.js +1 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.js +13 -0
- package/dist/config/live/config-gateway.d.ts +6 -0
- package/dist/config/live/config-gateway.js +71 -0
- package/dist/config/load.d.ts +54 -0
- package/dist/config/load.js +175 -0
- package/dist/config/resolve.d.ts +49 -0
- package/dist/config/resolve.js +94 -0
- package/dist/config/resource-config.d.ts +132 -0
- package/dist/config/resource-config.js +19 -0
- package/dist/config/schema.d.ts +64 -0
- package/dist/config/schema.js +57 -0
- package/dist/config/set.d.ts +27 -0
- package/dist/config/set.js +71 -0
- package/dist/config/settings-file.d.ts +41 -0
- package/dist/config/settings-file.js +72 -0
- package/dist/config-file/define.d.ts +39 -0
- package/dist/config-file/define.js +9 -0
- package/dist/config-file/toolchain.d.ts +9 -0
- package/dist/config-file/toolchain.js +41 -0
- package/dist/context.d.ts +89 -0
- package/dist/context.js +45 -0
- package/dist/core/command-provider.d.ts +126 -0
- package/dist/core/command-provider.js +13 -0
- package/dist/core/command-slots.d.ts +67 -0
- package/dist/core/command-slots.js +136 -0
- package/dist/core/events.d.ts +128 -0
- package/dist/core/events.js +15 -0
- package/dist/core/gateways.d.ts +249 -0
- package/dist/core/gateways.js +1 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.js +18 -0
- package/dist/core/keyed.d.ts +12 -0
- package/dist/core/keyed.js +24 -0
- package/dist/core/lane.d.ts +46 -0
- package/dist/core/lane.js +5 -0
- package/dist/core/limit.d.ts +9 -0
- package/dist/core/limit.js +29 -0
- package/dist/core/live/command-gateway.d.ts +11 -0
- package/dist/core/live/command-gateway.js +83 -0
- package/dist/core/live/job-summary-gateway.d.ts +5 -0
- package/dist/core/live/job-summary-gateway.js +20 -0
- package/dist/core/live/progress-terminal.d.ts +20 -0
- package/dist/core/live/progress-terminal.js +173 -0
- package/dist/core/live/run-directory-gateway.d.ts +24 -0
- package/dist/core/live/run-directory-gateway.js +437 -0
- package/dist/core/mint.d.ts +10 -0
- package/dist/core/mint.js +14 -0
- package/dist/core/payload.d.ts +26 -0
- package/dist/core/payload.js +33 -0
- package/dist/core/presentation.d.ts +87 -0
- package/dist/core/presentation.js +5 -0
- package/dist/core/presentations.d.ts +56 -0
- package/dist/core/presentations.js +66 -0
- package/dist/core/provider.d.ts +69 -0
- package/dist/core/provider.js +5 -0
- package/dist/core/resource.d.ts +262 -0
- package/dist/core/resource.js +6 -0
- package/dist/core/resources.d.ts +131 -0
- package/dist/core/resources.js +254 -0
- package/dist/core/run-directory.d.ts +69 -0
- package/dist/core/run-directory.js +94 -0
- package/dist/core/run-state.d.ts +152 -0
- package/dist/core/run-state.js +313 -0
- package/dist/core/run.d.ts +187 -0
- package/dist/core/run.js +321 -0
- package/dist/core/state-directory.d.ts +19 -0
- package/dist/core/state-directory.js +29 -0
- package/dist/core/timeline.d.ts +63 -0
- package/dist/core/timeline.js +97 -0
- package/dist/core/timing.d.ts +22 -0
- package/dist/core/timing.js +26 -0
- package/dist/credential/credential.d.ts +46 -0
- package/dist/credential/credential.js +80 -0
- package/dist/credential/diagnosis.d.ts +18 -0
- package/dist/credential/diagnosis.js +99 -0
- package/dist/credential/gateways.d.ts +109 -0
- package/dist/credential/gateways.js +1 -0
- package/dist/credential/index.d.ts +7 -0
- package/dist/credential/index.js +7 -0
- package/dist/credential/live/github-actions-token-gateway.d.ts +15 -0
- package/dist/credential/live/github-actions-token-gateway.js +43 -0
- package/dist/credential/live/github-actions-token-response.d.ts +19 -0
- package/dist/credential/live/github-actions-token-response.js +49 -0
- package/dist/credential/live/vercel-cli-gateway.d.ts +9 -0
- package/dist/credential/live/vercel-cli-gateway.js +64 -0
- package/dist/credential/live/vercel-output.d.ts +60 -0
- package/dist/credential/live/vercel-output.js +122 -0
- package/dist/credential/live/vercel-process.d.ts +14 -0
- package/dist/credential/live/vercel-process.js +3 -0
- package/dist/credential/settle.d.ts +31 -0
- package/dist/credential/settle.js +49 -0
- package/dist/credential/source.d.ts +110 -0
- package/dist/credential/source.js +114 -0
- package/dist/help-logo.d.ts +11 -0
- package/dist/help-logo.js +56 -0
- package/dist/presentation.d.ts +26 -0
- package/dist/presentation.js +21 -0
- package/dist/resources/github/cleanup.d.ts +23 -0
- package/dist/resources/github/cleanup.js +39 -0
- package/dist/resources/github/command.d.ts +74 -0
- package/dist/resources/github/command.js +117 -0
- package/dist/resources/github/config.d.ts +16 -0
- package/dist/resources/github/config.js +37 -0
- package/dist/resources/github/events.d.ts +26 -0
- package/dist/resources/github/events.js +2 -0
- package/dist/resources/github/fixture-repo.d.ts +69 -0
- package/dist/resources/github/fixture-repo.js +60 -0
- package/dist/resources/github/gateways.d.ts +62 -0
- package/dist/resources/github/gateways.js +1 -0
- package/dist/resources/github/index.d.ts +12 -0
- package/dist/resources/github/index.js +15 -0
- package/dist/resources/github/live/fixture-repo-gateway.d.ts +12 -0
- package/dist/resources/github/live/fixture-repo-gateway.js +92 -0
- package/dist/resources/github/live/gateways.d.ts +6 -0
- package/dist/resources/github/live/gateways.js +13 -0
- package/dist/resources/github/presentation.d.ts +13 -0
- package/dist/resources/github/presentation.js +43 -0
- package/dist/resources/github/provider.d.ts +66 -0
- package/dist/resources/github/provider.js +58 -0
- package/dist/resources/github/resource-provider.d.ts +6 -0
- package/dist/resources/github/resource-provider.js +20 -0
- package/dist/resources/github/resource.d.ts +33 -0
- package/dist/resources/github/resource.js +12 -0
- package/dist/resources/testserver/cleanup.d.ts +14 -0
- package/dist/resources/testserver/cleanup.js +22 -0
- package/dist/resources/testserver/command.d.ts +322 -0
- package/dist/resources/testserver/command.js +245 -0
- package/dist/resources/testserver/commands/app.d.ts +18 -0
- package/dist/resources/testserver/commands/app.js +3 -0
- package/dist/resources/testserver/commands/create/command.d.ts +136 -0
- package/dist/resources/testserver/commands/create/command.js +158 -0
- package/dist/resources/testserver/commands/create/metadata.d.ts +31 -0
- package/dist/resources/testserver/commands/create/metadata.js +45 -0
- package/dist/resources/testserver/commands/create/outcomes.d.ts +111 -0
- package/dist/resources/testserver/commands/create/outcomes.js +172 -0
- package/dist/resources/testserver/commands/list/command.d.ts +60 -0
- package/dist/resources/testserver/commands/list/command.js +56 -0
- package/dist/resources/testserver/commands/list/metadata.d.ts +9 -0
- package/dist/resources/testserver/commands/list/metadata.js +9 -0
- package/dist/resources/testserver/commands/list/outcomes.d.ts +54 -0
- package/dist/resources/testserver/commands/list/outcomes.js +152 -0
- package/dist/resources/testserver/config.d.ts +18 -0
- package/dist/resources/testserver/config.js +78 -0
- package/dist/resources/testserver/credential-facts.d.ts +80 -0
- package/dist/resources/testserver/credential-facts.js +83 -0
- package/dist/resources/testserver/events.d.ts +59 -0
- package/dist/resources/testserver/events.js +4 -0
- package/dist/resources/testserver/index.d.ts +16 -0
- package/dist/resources/testserver/index.js +24 -0
- package/dist/resources/testserver/lane.d.ts +28 -0
- package/dist/resources/testserver/lane.js +139 -0
- package/dist/resources/testserver/live/gateways.d.ts +6 -0
- package/dist/resources/testserver/live/gateways.js +26 -0
- package/dist/resources/testserver/options.d.ts +5 -0
- package/dist/resources/testserver/options.js +5 -0
- package/dist/resources/testserver/pool/channels.d.ts +80 -0
- package/dist/resources/testserver/pool/channels.js +48 -0
- package/dist/resources/testserver/pool/create.d.ts +48 -0
- package/dist/resources/testserver/pool/create.js +45 -0
- package/dist/resources/testserver/pool/directory.d.ts +4 -0
- package/dist/resources/testserver/pool/directory.js +5 -0
- package/dist/resources/testserver/pool/gateways.d.ts +190 -0
- package/dist/resources/testserver/pool/gateways.js +1 -0
- package/dist/resources/testserver/pool/host.d.ts +8 -0
- package/dist/resources/testserver/pool/host.js +21 -0
- package/dist/resources/testserver/pool/index.d.ts +9 -0
- package/dist/resources/testserver/pool/index.js +10 -0
- package/dist/resources/testserver/pool/inspect.d.ts +53 -0
- package/dist/resources/testserver/pool/inspect.js +45 -0
- package/dist/resources/testserver/pool/lease.d.ts +84 -0
- package/dist/resources/testserver/pool/lease.js +125 -0
- package/dist/resources/testserver/pool/live/pool-records.d.ts +17 -0
- package/dist/resources/testserver/pool/live/pool-records.js +70 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +12 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.js +435 -0
- package/dist/resources/testserver/pool/staleness.d.ts +16 -0
- package/dist/resources/testserver/pool/staleness.js +27 -0
- package/dist/resources/testserver/presentation.d.ts +9 -0
- package/dist/resources/testserver/presentation.js +217 -0
- package/dist/resources/testserver/provider.d.ts +177 -0
- package/dist/resources/testserver/provider.js +254 -0
- package/dist/resources/testserver/ran.d.ts +87 -0
- package/dist/resources/testserver/ran.js +140 -0
- package/dist/resources/testserver/resource-provider.d.ts +12 -0
- package/dist/resources/testserver/resource-provider.js +38 -0
- package/dist/resources/testserver/resource.d.ts +32 -0
- package/dist/resources/testserver/resource.js +10 -0
- package/dist/resources/testserver/run-sandbox.d.ts +13 -0
- package/dist/resources/testserver/run-sandbox.js +6 -0
- package/dist/resources/testserver/sandbox/channels.d.ts +12 -0
- package/dist/resources/testserver/sandbox/channels.js +21 -0
- package/dist/resources/testserver/sandbox/create-failure.d.ts +35 -0
- package/dist/resources/testserver/sandbox/create-failure.js +65 -0
- package/dist/resources/testserver/sandbox/create.d.ts +29 -0
- package/dist/resources/testserver/sandbox/create.js +37 -0
- package/dist/resources/testserver/sandbox/gateways.d.ts +150 -0
- package/dist/resources/testserver/sandbox/gateways.js +1 -0
- package/dist/resources/testserver/sandbox/index.d.ts +6 -0
- package/dist/resources/testserver/sandbox/index.js +7 -0
- package/dist/resources/testserver/sandbox/live/builds-response.d.ts +9 -0
- package/dist/resources/testserver/sandbox/live/builds-response.js +27 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.d.ts +17 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.js +133 -0
- package/dist/resources/testserver/sandbox/live/create-response.d.ts +35 -0
- package/dist/resources/testserver/sandbox/live/create-response.js +78 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.d.ts +24 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.js +45 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.d.ts +11 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.js +36 -0
- package/dist/resources/testserver/sandbox/live/sse.d.ts +12 -0
- package/dist/resources/testserver/sandbox/live/sse.js +32 -0
- package/dist/resources.d.ts +455 -0
- package/dist/resources.js +88 -0
- package/dist/runner/base.d.ts +40 -0
- package/dist/runner/base.js +52 -0
- package/dist/runner/context.d.ts +13 -0
- package/dist/runner/context.js +9 -0
- package/dist/runner/events.d.ts +179 -0
- package/dist/runner/events.js +16 -0
- package/dist/runner/gateways.d.ts +351 -0
- package/dist/runner/gateways.js +3 -0
- package/dist/runner/index.d.ts +19 -0
- package/dist/runner/index.js +18 -0
- package/dist/runner/live/checkout-gateway.d.ts +3 -0
- package/dist/runner/live/checkout-gateway.js +206 -0
- package/dist/runner/live/git-output.d.ts +14 -0
- package/dist/runner/live/git-output.js +32 -0
- package/dist/runner/live/sandbox-errors.d.ts +7 -0
- package/dist/runner/live/sandbox-errors.js +21 -0
- package/dist/runner/live/sandbox-gateway.d.ts +7 -0
- package/dist/runner/live/sandbox-gateway.js +427 -0
- package/dist/runner/live/snapshot-cache-gateway.d.ts +12 -0
- package/dist/runner/live/snapshot-cache-gateway.js +104 -0
- package/dist/runner/live/snapshot-records.d.ts +11 -0
- package/dist/runner/live/snapshot-records.js +57 -0
- package/dist/runner/live/terminal.d.ts +16 -0
- package/dist/runner/live/terminal.js +37 -0
- package/dist/runner/live/user.d.ts +2 -0
- package/dist/runner/live/user.js +11 -0
- package/dist/runner/output.d.ts +23 -0
- package/dist/runner/output.js +58 -0
- package/dist/runner/prepare.d.ts +67 -0
- package/dist/runner/prepare.js +59 -0
- package/dist/runner/ready.d.ts +68 -0
- package/dist/runner/ready.js +159 -0
- package/dist/runner/recipe.d.ts +126 -0
- package/dist/runner/recipe.js +302 -0
- package/dist/runner/remote-command.d.ts +77 -0
- package/dist/runner/remote-command.js +127 -0
- package/dist/runner/scope.d.ts +58 -0
- package/dist/runner/scope.js +117 -0
- package/dist/runner/snapshot-build.d.ts +33 -0
- package/dist/runner/snapshot-build.js +112 -0
- package/dist/runner/snapshot-cache.d.ts +84 -0
- package/dist/runner/snapshot-cache.js +126 -0
- package/dist/runner/snapshot-key.d.ts +52 -0
- package/dist/runner/snapshot-key.js +91 -0
- package/dist/runner/steps.d.ts +41 -0
- package/dist/runner/steps.js +49 -0
- package/dist/sdk/container/api-request.d.ts +32 -0
- package/dist/sdk/container/api-request.js +46 -0
- package/dist/sdk/container/container.d.ts +144 -0
- package/dist/sdk/container/container.js +346 -0
- package/dist/sdk/container/feature-flags.d.ts +37 -0
- package/dist/sdk/container/feature-flags.js +118 -0
- package/dist/sdk/container/gateways.d.ts +108 -0
- package/dist/sdk/container/gateways.js +1 -0
- package/dist/sdk/container/index.d.ts +5 -0
- package/dist/sdk/container/index.js +5 -0
- package/dist/sdk/container/live/container-gateway.d.ts +17 -0
- package/dist/sdk/container/live/container-gateway.js +114 -0
- package/dist/sdk/factories/build.d.ts +66 -0
- package/dist/sdk/factories/build.js +98 -0
- package/dist/sdk/factories/definition.d.ts +28 -0
- package/dist/sdk/factories/definition.js +16 -0
- package/dist/sdk/factories/definitions.d.ts +166 -0
- package/dist/sdk/factories/definitions.js +235 -0
- package/dist/sdk/factories/gateways.d.ts +25 -0
- package/dist/sdk/factories/gateways.js +1 -0
- package/dist/sdk/factories/index.d.ts +5 -0
- package/dist/sdk/factories/index.js +5 -0
- package/dist/sdk/factories/live/factory-gateway.d.ts +10 -0
- package/dist/sdk/factories/live/factory-gateway.js +29 -0
- package/dist/sdk/index.d.ts +7 -0
- package/dist/sdk/index.js +15 -0
- package/dist/sdk/payload/index.d.ts +2 -0
- package/dist/sdk/payload/index.js +4 -0
- package/dist/sdk/payload/payload.d.ts +47 -0
- package/dist/sdk/payload/payload.js +74 -0
- package/dist/sdk/payload/test-events.d.ts +102 -0
- package/dist/sdk/payload/test-events.js +59 -0
- package/dist/sdk/proxy/exchange.d.ts +58 -0
- package/dist/sdk/proxy/exchange.js +173 -0
- package/dist/sdk/proxy/faulted-exchange.d.ts +10 -0
- package/dist/sdk/proxy/faulted-exchange.js +106 -0
- package/dist/sdk/proxy/faults.d.ts +133 -0
- package/dist/sdk/proxy/faults.js +147 -0
- package/dist/sdk/proxy/index.d.ts +3 -0
- package/dist/sdk/proxy/index.js +3 -0
- package/dist/sdk/proxy/proxy.d.ts +93 -0
- package/dist/sdk/proxy/proxy.js +99 -0
- package/dist/sdk/proxy/records.d.ts +56 -0
- package/dist/sdk/proxy/records.js +56 -0
- package/dist/sdk/records/body.d.ts +89 -0
- package/dist/sdk/records/body.js +236 -0
- package/dist/sdk/records/index.d.ts +2 -0
- package/dist/sdk/records/index.js +4 -0
- package/dist/sdk/records/records.d.ts +49 -0
- package/dist/sdk/records/records.js +16 -0
- package/dist/sdk/seed/index.d.ts +1 -0
- package/dist/sdk/seed/index.js +3 -0
- package/dist/sdk/seed/seed.d.ts +221 -0
- package/dist/sdk/seed/seed.js +171 -0
- package/dist/sdk/testserver/clock.d.ts +8 -0
- package/dist/sdk/testserver/clock.js +10 -0
- package/dist/sdk/testserver/failure.d.ts +73 -0
- package/dist/sdk/testserver/failure.js +61 -0
- package/dist/sdk/testserver/index.d.ts +5 -0
- package/dist/sdk/testserver/index.js +8 -0
- package/dist/sdk/testserver/live/connect-failure.d.ts +7 -0
- package/dist/sdk/testserver/live/connect-failure.js +30 -0
- package/dist/sdk/testserver/live/request.d.ts +69 -0
- package/dist/sdk/testserver/live/request.js +89 -0
- package/dist/sdk/testserver/service-ids.d.ts +19 -0
- package/dist/sdk/testserver/service-ids.js +77 -0
- package/dist/sdk/testserver/test-id.d.ts +15 -0
- package/dist/sdk/testserver/test-id.js +28 -0
- package/dist/story/align.d.ts +37 -0
- package/dist/story/align.js +39 -0
- package/dist/story/artifact.d.ts +60 -0
- package/dist/story/artifact.js +93 -0
- package/dist/story/definition.d.ts +52 -0
- package/dist/story/definition.js +9 -0
- package/dist/story/diff.d.ts +9 -0
- package/dist/story/diff.js +97 -0
- package/dist/story/errors.d.ts +14 -0
- package/dist/story/errors.js +21 -0
- package/dist/story/gateways.d.ts +74 -0
- package/dist/story/gateways.js +3 -0
- package/dist/story/host.d.ts +27 -0
- package/dist/story/host.js +97 -0
- package/dist/story/index.d.ts +7 -0
- package/dist/story/index.js +9 -0
- package/dist/story/json.d.ts +16 -0
- package/dist/story/json.js +59 -0
- package/dist/story/live/artifact-gateway.d.ts +2 -0
- package/dist/story/live/artifact-gateway.js +82 -0
- package/dist/story/mode.d.ts +17 -0
- package/dist/story/mode.js +21 -0
- package/dist/story/orphans.d.ts +17 -0
- package/dist/story/orphans.js +15 -0
- package/dist/story/report.d.ts +30 -0
- package/dist/story/report.js +118 -0
- package/dist/story/run.d.ts +49 -0
- package/dist/story/run.js +160 -0
- package/dist/story/sequence.d.ts +30 -0
- package/dist/story/sequence.js +74 -0
- package/dist/story/settle.d.ts +94 -0
- package/dist/story/settle.js +70 -0
- package/dist/time/duration.d.ts +19 -0
- package/dist/time/duration.js +37 -0
- package/dist/time/index.d.ts +2 -0
- package/dist/time/index.js +4 -0
- package/dist/time/time.d.ts +15 -0
- package/dist/time/time.js +23 -0
- package/dist/vercel-cli/ansi.d.ts +13 -0
- package/dist/vercel-cli/ansi.js +32 -0
- package/dist/vercel-cli/arguments.d.ts +25 -0
- package/dist/vercel-cli/arguments.js +78 -0
- package/dist/vercel-cli/auth-config.d.ts +43 -0
- package/dist/vercel-cli/auth-config.js +36 -0
- package/dist/vercel-cli/clock.d.ts +9 -0
- package/dist/vercel-cli/clock.js +10 -0
- package/dist/vercel-cli/config-files.d.ts +24 -0
- package/dist/vercel-cli/config-files.js +40 -0
- package/dist/vercel-cli/context.d.ts +12 -0
- package/dist/vercel-cli/context.js +12 -0
- package/dist/vercel-cli/driver.d.ts +218 -0
- package/dist/vercel-cli/driver.js +364 -0
- package/dist/vercel-cli/entry.d.ts +8 -0
- package/dist/vercel-cli/entry.js +13 -0
- package/dist/vercel-cli/environment.d.ts +33 -0
- package/dist/vercel-cli/environment.js +72 -0
- package/dist/vercel-cli/errors.d.ts +8 -0
- package/dist/vercel-cli/errors.js +8 -0
- package/dist/vercel-cli/gateways.d.ts +103 -0
- package/dist/vercel-cli/gateways.js +4 -0
- package/dist/vercel-cli/index.d.ts +10 -0
- package/dist/vercel-cli/index.js +15 -0
- package/dist/vercel-cli/invocation.d.ts +234 -0
- package/dist/vercel-cli/invocation.js +397 -0
- package/dist/vercel-cli/keys.d.ts +14 -0
- package/dist/vercel-cli/keys.js +12 -0
- package/dist/vercel-cli/live/config-files.d.ts +28 -0
- package/dist/vercel-cli/live/config-files.js +66 -0
- package/dist/vercel-cli/live/process-gateway.d.ts +14 -0
- package/dist/vercel-cli/live/process-gateway.js +178 -0
- package/dist/vercel-cli/redaction.d.ts +13 -0
- package/dist/vercel-cli/redaction.js +22 -0
- package/dist/vercel-cli/report.d.ts +22 -0
- package/dist/vercel-cli/report.js +110 -0
- package/dist/vercel-cli/verbose.d.ts +7 -0
- package/dist/vercel-cli/verbose.js +24 -0
- package/dist/version.d.ts +20 -0
- package/dist/version.js +57 -0
- package/dist/vitest/config.d.ts +51 -0
- package/dist/vitest/config.js +61 -0
- package/dist/vitest/container-scope.d.ts +108 -0
- package/dist/vitest/container-scope.js +234 -0
- package/dist/vitest/diagnostics.d.ts +146 -0
- package/dist/vitest/diagnostics.js +306 -0
- package/dist/vitest/find-vitest.d.ts +7 -0
- package/dist/vitest/find-vitest.js +28 -0
- package/dist/vitest/fixtures.d.ts +64 -0
- package/dist/vitest/fixtures.js +172 -0
- package/dist/vitest/gateways.d.ts +78 -0
- package/dist/vitest/gateways.js +4 -0
- package/dist/vitest/index.d.ts +3 -0
- package/dist/vitest/index.js +9 -0
- package/dist/vitest/list-output.d.ts +3 -0
- package/dist/vitest/list-output.js +19 -0
- package/dist/vitest/live/list-gateway.d.ts +11 -0
- package/dist/vitest/live/list-gateway.js +107 -0
- package/dist/vitest/ownership.d.ts +29 -0
- package/dist/vitest/ownership.js +68 -0
- package/dist/vitest/plan.d.ts +66 -0
- package/dist/vitest/plan.js +104 -0
- package/dist/vitest/sandbox.d.ts +16 -0
- package/dist/vitest/sandbox.js +35 -0
- package/dist/vitest/test-events.d.ts +41 -0
- package/dist/vitest/test-events.js +92 -0
- package/dist/vitest/test-results.d.ts +84 -0
- package/dist/vitest/test-results.js +160 -0
- package/dist/vitest/types.d.ts +68 -0
- package/dist/vitest/types.js +4 -0
- package/package.json +119 -3
- package/skills/overview.md +33 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// How a run's views (`exec`'s and `vitest`'s) ask every resource how it shows, through each provider's presentation, in provider
|
|
2
|
+
// order: the presentation counterpart of `command-slots.ts`. `presentationSlotOf` binds one provider's presentation
|
|
3
|
+
// to its name, so each function below indexes the run's maps by that name and never relates a name to the kinds map.
|
|
4
|
+
/** `provider`'s presentation, bound to its name. */
|
|
5
|
+
function presentationSlotOf(provider) {
|
|
6
|
+
const { name, presentation } = provider;
|
|
7
|
+
const lane = presentation.lane;
|
|
8
|
+
const laneName = provider.run.lane;
|
|
9
|
+
return {
|
|
10
|
+
plain: (options) => {
|
|
11
|
+
const own = presentation.plain(options);
|
|
12
|
+
// Each union is distributed over every name, so its member whose `resource` is `name` carries this resource's
|
|
13
|
+
// event.
|
|
14
|
+
return (nested, now) => (nested.resource === name ? own(nested.event, now) : undefined);
|
|
15
|
+
},
|
|
16
|
+
notices: (nested, options) => (nested.resource === name ? presentation.notices(nested.event, options) : undefined),
|
|
17
|
+
releaseText: (holdings, tense) => Object.hasOwn(holdings, name) ? presentation.release(holdings[name], tense) : undefined,
|
|
18
|
+
stoppingText: (held) => (held.includes(name) ? presentation.release(undefined, "doing") : undefined),
|
|
19
|
+
lane: lane === undefined || laneName === undefined
|
|
20
|
+
? undefined
|
|
21
|
+
: {
|
|
22
|
+
lane: laneName,
|
|
23
|
+
label: lane.label,
|
|
24
|
+
steps: lane.steps,
|
|
25
|
+
lanesRow: (states, draw, run) => {
|
|
26
|
+
const state = states[name];
|
|
27
|
+
return { status: state?.status, ...lane.lanesRow(state, draw, run) };
|
|
28
|
+
},
|
|
29
|
+
localRow: (states, draw) => {
|
|
30
|
+
const state = states[name];
|
|
31
|
+
if (state === undefined)
|
|
32
|
+
return undefined;
|
|
33
|
+
const { text, below } = lane.localRow(state, draw);
|
|
34
|
+
return { span: state, text, below };
|
|
35
|
+
},
|
|
36
|
+
record: (states, draw) => {
|
|
37
|
+
const state = states[name];
|
|
38
|
+
return state === undefined ? undefined : { span: state, ...lane.record(state, draw) };
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Every one of `providers`' presentations, bound to their names, in order. */
|
|
44
|
+
export function resourcePresentations(providers) {
|
|
45
|
+
const slots = providers.map((provider) => presentationSlotOf(provider));
|
|
46
|
+
const first = (answers, what) => {
|
|
47
|
+
const found = answers.find((answer) => answer !== undefined);
|
|
48
|
+
if (found === undefined)
|
|
49
|
+
throw new Error(`No resource answered ${what}`);
|
|
50
|
+
return found;
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
plain: (options) => {
|
|
54
|
+
const renderers = slots.map((slot) => slot.plain(options));
|
|
55
|
+
return (event, now) => first(renderers.map((render) => render(event, now)), `${event.resource}'s event`);
|
|
56
|
+
},
|
|
57
|
+
notices: (event, options) => first(slots.map((slot) => slot.notices(event, options)), `${event.resource}'s event`),
|
|
58
|
+
releaseTexts: (holdings, tense) => present(slots.map((slot) => slot.releaseText(holdings, tense))),
|
|
59
|
+
stoppingTexts: (held) => present(slots.map((slot) => slot.stoppingText(held))),
|
|
60
|
+
lanes: slots.flatMap(({ lane }) => (lane === undefined ? [] : [lane])),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** The texts there are, in order. */
|
|
64
|
+
function present(texts) {
|
|
65
|
+
return texts.filter((text) => text !== undefined);
|
|
66
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { CommandMount } from "@vercel/clinkr";
|
|
2
|
+
import type { AnyResourceConfig, OptionsResolution } from "../config/index.ts";
|
|
3
|
+
import type { RunnerResources } from "../runner/index.ts";
|
|
4
|
+
import type { CommandProvider, ResourceCleanupReport, ResourceRanReport } from "./command-provider.ts";
|
|
5
|
+
import type { ResourceLane } from "./lane.ts";
|
|
6
|
+
import type { ResourcePresentation } from "./presentation.ts";
|
|
7
|
+
import type { KindAt, ResourceKind, RunProvider } from "./resource.ts";
|
|
8
|
+
/** What the host hands a resource to build its live gateways: the host's environment. */
|
|
9
|
+
export interface ResourceHost {
|
|
10
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
11
|
+
}
|
|
12
|
+
/** A resource config that fits resource `Name` of kind `Kind`: its name, and it resolves to the kind's options. */
|
|
13
|
+
export type FittingConfig<Name extends string, Kind extends ResourceKind> = AnyResourceConfig & {
|
|
14
|
+
readonly name: Name;
|
|
15
|
+
resolve(settings: never): OptionsResolution<Kind["options"], string>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A command tree a resource adds to the host's CLI, whose commands take app `App` (`CommandBuilder<App>`): Clinkr
|
|
19
|
+
* mounts the tree's directory at `mount.path` and hands each command the host's app. A tree that takes `App` is a tree
|
|
20
|
+
* of every app that is one, so the registry checks the host's app by typing the trees with it.
|
|
21
|
+
*/
|
|
22
|
+
export interface ResourceCommandTree<App> {
|
|
23
|
+
readonly mount: CommandMount;
|
|
24
|
+
/** For its type only: what the tree's commands take, as a parameter, so the tree is a tree of any app that is one. */
|
|
25
|
+
readonly takes?: (app: App) => void;
|
|
26
|
+
}
|
|
27
|
+
/** A resource's lane: none for a kind without one. */
|
|
28
|
+
type LaneOf<Name extends string, Kind extends ResourceKind> = [Kind["lane"]] extends [never] ? undefined : ResourceLane<Name, Kind>;
|
|
29
|
+
/** A resource's ran report: none for a kind that reports nothing in a `ran` outcome. */
|
|
30
|
+
type RanReportOf<Kind extends ResourceKind> = [Kind["ranFacts"]] extends [never] ? undefined : ResourceRanReport<Kind>;
|
|
31
|
+
/**
|
|
32
|
+
* The provider of resource `Name`, of kind `Kind`, whose command half is `Command`, with its own errors, and whose
|
|
33
|
+
* resource config is `Config`.
|
|
34
|
+
*
|
|
35
|
+
* - `run`: the run half.
|
|
36
|
+
* - `command`: the command half.
|
|
37
|
+
* - `config`: its section under `resources` in the config file.
|
|
38
|
+
* - `cleanup`: what outcomes report of its cleanup.
|
|
39
|
+
* - `ran`: what a `ran` outcome reports of it, under `resources.<name>`; none when its kind reports nothing.
|
|
40
|
+
* - `lane`: its lane; none when its kind has none.
|
|
41
|
+
* - `presentation`: how it shows in a run's progress.
|
|
42
|
+
* - `liveGateways`: its gateways, built live from the host.
|
|
43
|
+
* - `hostVariablesToDrop`: the host's variables the run's command must not see, such as stale ones that could point it
|
|
44
|
+
* at something else than the run payload names.
|
|
45
|
+
* - `runnerResources`: what a runner recipe's `vcpus` function sees of it, from its resolved options.
|
|
46
|
+
* - `commands`: the command tree it adds to the host's CLI, whose commands take app `App`; none for a resource that
|
|
47
|
+
* adds none.
|
|
48
|
+
*/
|
|
49
|
+
export interface Provider<Name extends string, Kind extends ResourceKind, Command extends CommandProvider<Kind>, Config extends FittingConfig<Name, Kind>, App = unknown> {
|
|
50
|
+
readonly name: Name;
|
|
51
|
+
readonly run: RunProvider<Name, Kind>;
|
|
52
|
+
readonly command: Command;
|
|
53
|
+
readonly config: Config;
|
|
54
|
+
readonly cleanup: ResourceCleanupReport<Kind["cleanup"], Kind["cleanupFacts"]>;
|
|
55
|
+
readonly ran: RanReportOf<Kind>;
|
|
56
|
+
readonly lane: LaneOf<Name, Kind>;
|
|
57
|
+
readonly presentation: ResourcePresentation<Kind>;
|
|
58
|
+
readonly liveGateways: (host: ResourceHost) => Kind["gateways"];
|
|
59
|
+
readonly hostVariablesToDrop?: readonly string[];
|
|
60
|
+
readonly runnerResources?: (options: Kind["options"]) => RunnerResources;
|
|
61
|
+
readonly commands?: ResourceCommandTree<App>;
|
|
62
|
+
}
|
|
63
|
+
/** Every provider of a registry, in order: one union member per resource, as `RunProviders` has. */
|
|
64
|
+
export type ProviderList<K> = readonly {
|
|
65
|
+
readonly [N in keyof K & string]: ProviderAt<K, N>;
|
|
66
|
+
}[keyof K & string][];
|
|
67
|
+
/** A provider of kinds map `K`, under name `N`, as the core's bindings take it. */
|
|
68
|
+
export type ProviderAt<K, N extends keyof K & string> = Provider<N, KindAt<K, N>, CommandProvider<KindAt<K, N>>, FittingConfig<N, KindAt<K, N>>, never>;
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// A resource's provider as one value: everything its folder hands the host. The folder exports one `Provider`, and
|
|
2
|
+
// only the registry (`src/resources.ts`) takes it; the host reaches the resource through nothing else. It holds the run
|
|
3
|
+
// half (`RunProvider`), the command half (`CommandProvider`), the resource config, the cleanup and ran reports, the
|
|
4
|
+
// lane, the presentation, the live gateways, and what the host does for it around a run. It names no resource.
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import type { CredentialSource, MintFailure, MintTarget } from "../credential/index.ts";
|
|
2
|
+
import type { Clock } from "../time/index.ts";
|
|
3
|
+
import type { Span } from "./run-state.ts";
|
|
4
|
+
/** What one resource's provider works with. A resource folder declares one of these. */
|
|
5
|
+
export interface ResourceKind {
|
|
6
|
+
/**
|
|
7
|
+
* Its resolved options: what its resource config (`config/`) resolves a held resource's section of
|
|
8
|
+
* `storm.config.ts` and its `--set` values to, which its command half settles into its request.
|
|
9
|
+
*/
|
|
10
|
+
readonly options: unknown;
|
|
11
|
+
/**
|
|
12
|
+
* The resource's part of the run request, under `request.resources.<name>`: the same in a local run and a runner run,
|
|
13
|
+
* since the run, not the resource, holds the credential choice (`LocalRunRequest.credential`).
|
|
14
|
+
*/
|
|
15
|
+
readonly request: unknown;
|
|
16
|
+
/** What acquiring it works from: its part of the run request when the run holds it (`RunProvider.requested`). */
|
|
17
|
+
readonly acquireRequest: unknown;
|
|
18
|
+
/**
|
|
19
|
+
* The gateways and seams it needs beyond the core's (`CoreContext`). The app's flat context must hold them; the
|
|
20
|
+
* registry checks it.
|
|
21
|
+
*/
|
|
22
|
+
readonly gateways: object;
|
|
23
|
+
/** What acquiring it hands the command, through the run payload. */
|
|
24
|
+
readonly connection: unknown;
|
|
25
|
+
/** One thing acquiring it holds, which the run releases however it ends. */
|
|
26
|
+
readonly owned: unknown;
|
|
27
|
+
/**
|
|
28
|
+
* What the run holds of it when cleanup starts (`RunProvider.holding`), from which its presentation names what
|
|
29
|
+
* releasing it does, such as how many leases. Plain JSON: it goes into the `cleanup-started` event, which the run
|
|
30
|
+
* directory keeps.
|
|
31
|
+
*/
|
|
32
|
+
readonly holding: unknown;
|
|
33
|
+
/** What acquiring it tells a `ran` outcome, under `resources.<name>`. */
|
|
34
|
+
readonly facts: unknown;
|
|
35
|
+
/** What a `canceled` outcome says of it, under `resources.<name>`, from how far acquiring it got. */
|
|
36
|
+
readonly canceledFacts: unknown;
|
|
37
|
+
/** Its refusals before the run holds anything: the run ends `resource-unprepared` with one; `never` for none. */
|
|
38
|
+
readonly prepareRefusal: unknown;
|
|
39
|
+
/** Its refusals while the run acquires: the run ends `resource-refused` with one. */
|
|
40
|
+
readonly refusal: unknown;
|
|
41
|
+
/** What releasing it did. */
|
|
42
|
+
readonly cleanup: unknown;
|
|
43
|
+
/** What outcomes report of its cleanup, under `cleanup.resources.<name>`: its cleanup report's facts. */
|
|
44
|
+
readonly cleanupFacts: unknown;
|
|
45
|
+
/**
|
|
46
|
+
* What a `ran` outcome reports of it, under `resources.<name>`: its ran report's facts, from its facts and its
|
|
47
|
+
* request; `never` for a resource that reports nothing there.
|
|
48
|
+
*/
|
|
49
|
+
readonly ranFacts: unknown;
|
|
50
|
+
/** The reasons of the errors its command half ends a run with: its settle's, its prepare's and its acquire's. */
|
|
51
|
+
readonly reason: string;
|
|
52
|
+
/** Its own run events, nested as `{ kind: "resource", resource: <name>, event }`; `never` for none. */
|
|
53
|
+
readonly event: unknown;
|
|
54
|
+
/**
|
|
55
|
+
* Its lane's name, which starts with a `lane-started` event and ends with a `lane-ended` event; `never` for a
|
|
56
|
+
* resource without a lane.
|
|
57
|
+
*/
|
|
58
|
+
readonly lane: string;
|
|
59
|
+
/** Its lane's state, which its lane (`ResourceLane`) applies its events to: a span; `never` without a lane. */
|
|
60
|
+
readonly laneState: Span;
|
|
61
|
+
/** The names of its lane's steps on the waterfall; `never` without a lane, or for a lane without steps. */
|
|
62
|
+
readonly laneStep: string;
|
|
63
|
+
/** Its entry under `resources.<name>` in the run payload. */
|
|
64
|
+
readonly payload: unknown;
|
|
65
|
+
}
|
|
66
|
+
/** The core's own seams, which every provider may use. */
|
|
67
|
+
export interface CoreContext {
|
|
68
|
+
readonly clock: Clock;
|
|
69
|
+
}
|
|
70
|
+
/** A provider's own progress: it emits only its own events, and the core nests them under its name. */
|
|
71
|
+
export interface ResourceProgress<Kind extends ResourceKind> {
|
|
72
|
+
emit(event: Kind["event"]): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
/** What a provider's acquire gets from the run. */
|
|
75
|
+
export interface ResourceAcquireInput<Kind extends ResourceKind, Ctx> {
|
|
76
|
+
readonly context: Ctx;
|
|
77
|
+
readonly request: Kind["acquireRequest"];
|
|
78
|
+
/**
|
|
79
|
+
* The user's signal combined with the run's internal abort, which another resource's refusal or, in a runner run, the
|
|
80
|
+
* runner lane's failure aborts. An acquire that sees it aborted stops as soon as it safely can.
|
|
81
|
+
*/
|
|
82
|
+
readonly signal: AbortSignal;
|
|
83
|
+
readonly progress: ResourceProgress<Kind>;
|
|
84
|
+
/**
|
|
85
|
+
* The ownership sink. The acquire pushes each thing it holds here before it awaits anything else, so the run releases
|
|
86
|
+
* it however the run ends, a throw included.
|
|
87
|
+
*/
|
|
88
|
+
readonly owned: Kind["owned"][];
|
|
89
|
+
/**
|
|
90
|
+
* The run's credential source, when it has one: in a runner run, the one mint it shares with the runner sandbox; in a
|
|
91
|
+
* local run, the source the run's credential choice names, which the core builds once and reports (`minting`,
|
|
92
|
+
* `minted`, `requesting-token`). Undefined in a local run that settled no choice, which it does only when no held
|
|
93
|
+
* resource takes the credential (`CommandProvider.takesCredential`).
|
|
94
|
+
*/
|
|
95
|
+
readonly credential: CredentialSource | undefined;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* How acquiring a resource ended: `acquired`, with what it hands the command and tells the outcome; `refused` with one
|
|
99
|
+
* of its refusals; `mint-failed`, when the run's mint for `target` failed and the resource had nothing to go on
|
|
100
|
+
* without it, which ends the run as the run's own `mint-failed`; or `canceled`, stopped by the signal, with what a
|
|
101
|
+
* canceled outcome says of it.
|
|
102
|
+
*/
|
|
103
|
+
export type ResourceAcquireOutcome<Kind extends ResourceKind> = {
|
|
104
|
+
readonly kind: "acquired";
|
|
105
|
+
readonly connection: Kind["connection"];
|
|
106
|
+
readonly facts: Kind["facts"];
|
|
107
|
+
} | {
|
|
108
|
+
readonly kind: "refused";
|
|
109
|
+
readonly refusal: Kind["refusal"];
|
|
110
|
+
} | {
|
|
111
|
+
readonly kind: "mint-failed";
|
|
112
|
+
readonly failure: MintFailure;
|
|
113
|
+
readonly target: MintTarget;
|
|
114
|
+
} | {
|
|
115
|
+
readonly kind: "canceled";
|
|
116
|
+
readonly facts: Kind["canceledFacts"];
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* The run half of one provider. It depends on its own name and kind only, never on the registry, so it can't see or
|
|
120
|
+
* emit another resource's events or read another resource's gateways. `Ctx` is the context it needs: the core's seams
|
|
121
|
+
* and its own gateways. The registry instantiates `Ctx` with the app's flat context, which checks that the context holds
|
|
122
|
+
* what the provider needs. Each operation is a function property, not a method, so its parameters are checked
|
|
123
|
+
* contravariantly: a method's would be checked both ways, and a context lacking the provider's gateways would pass.
|
|
124
|
+
*
|
|
125
|
+
* - `lane`: the run lane acquiring it reports, which starts with a `lane-started` event and ends with a `lane-ended`
|
|
126
|
+
* event; undefined for a kind without one, and required for every other (`LaneNameOf`).
|
|
127
|
+
* - `requested`: what acquiring it works from, given its part of the run request; undefined when the run doesn't hold
|
|
128
|
+
* it, though its request may still have `prepare` say something.
|
|
129
|
+
* - `prepare`: before the run acquires anything, given its part of the run request: what acquiring it needs, such as
|
|
130
|
+
* files it keeps, or a notice that the run goes without it. A refusal ends the run holding nothing.
|
|
131
|
+
* - `acquire`: acquires it, pushing what it holds onto `owned` as it goes, or refuses the run: with one of its own
|
|
132
|
+
* refusals, or `mint-failed` when the run's mint failed and it can't go on without it.
|
|
133
|
+
* - `ready`: once every resource is acquired and the runner, if any, is ready, just before the command starts: reports
|
|
134
|
+
* it ready, such as listing what it holds.
|
|
135
|
+
* - `holding`: what the run holds of it, from `owned`, as cleanup starts, which its presentation names what releasing it
|
|
136
|
+
* does from; undefined, or none, when there is nothing to name.
|
|
137
|
+
* - `release`: releases everything in `owned`, after the command has stopped and the runner's sandboxes are closed,
|
|
138
|
+
* and answers what that did; undefined when the run held nothing it reports.
|
|
139
|
+
* - `failures`: how many things `release` couldn't do, which the cleanup lane counts.
|
|
140
|
+
* - `payload`: its entry under `resources.<name>` in the run payload.
|
|
141
|
+
* - `canceledFacts`: what a canceled run says of it, when acquiring it didn't end `canceled` itself: from its facts
|
|
142
|
+
* once acquired, else from its request alone. None says nothing.
|
|
143
|
+
*/
|
|
144
|
+
export interface RunProvider<Name extends string, Kind extends ResourceKind, Ctx = CoreContext & Kind["gateways"]> {
|
|
145
|
+
readonly name: Name;
|
|
146
|
+
readonly lane: LaneNameOf<Kind>;
|
|
147
|
+
readonly requested: (request: Kind["request"]) => Kind["acquireRequest"] | undefined;
|
|
148
|
+
readonly prepare?: (context: Ctx, request: Kind["request"], progress: ResourceProgress<Kind>) => Promise<Kind["prepareRefusal"] | undefined>;
|
|
149
|
+
readonly acquire: (input: ResourceAcquireInput<Kind, Ctx>) => Promise<ResourceAcquireOutcome<Kind>>;
|
|
150
|
+
readonly ready?: (input: {
|
|
151
|
+
readonly connection: Kind["connection"];
|
|
152
|
+
readonly progress: ResourceProgress<Kind>;
|
|
153
|
+
}) => Promise<void>;
|
|
154
|
+
readonly holding?: (owned: readonly Kind["owned"][]) => Kind["holding"] | undefined;
|
|
155
|
+
readonly release: (context: Ctx, owned: readonly Kind["owned"][], progress: ResourceProgress<Kind>) => Promise<Kind["cleanup"] | undefined>;
|
|
156
|
+
readonly failures: (cleanup: Kind["cleanup"]) => number;
|
|
157
|
+
readonly payload: (connection: Kind["connection"]) => Kind["payload"];
|
|
158
|
+
readonly canceledFacts?: (request: Kind["acquireRequest"], facts: Kind["facts"] | undefined) => Kind["canceledFacts"];
|
|
159
|
+
}
|
|
160
|
+
/** The lane a run half of kind `Kind` names: undefined for a kind without one (`lane` is `never`). */
|
|
161
|
+
export type LaneNameOf<Kind extends ResourceKind> = [Kind["lane"]] extends [never] ? undefined : Kind["lane"];
|
|
162
|
+
/** The kind of resource `N` in kinds map `K`. */
|
|
163
|
+
export type KindAt<K, N extends keyof K> = Extract<K[N], ResourceKind>;
|
|
164
|
+
/** A kinds map with any resources: what code that needs no resource's own types takes, such as the run's state. */
|
|
165
|
+
export type AnyResources = {
|
|
166
|
+
readonly [name: string]: ResourceKind;
|
|
167
|
+
};
|
|
168
|
+
/** Every run half of a registry, in order, each taking the app's context `C`: one union member per resource. */
|
|
169
|
+
export type RunProviders<K, C> = readonly {
|
|
170
|
+
readonly [N in keyof K & string]: RunProvider<N, KindAt<K, N>, C>;
|
|
171
|
+
}[keyof K & string][];
|
|
172
|
+
/** The kind of provider `P`, from its run half. */
|
|
173
|
+
type KindOf<P> = P extends {
|
|
174
|
+
readonly run: RunProvider<string, infer Kind>;
|
|
175
|
+
} ? Kind : never;
|
|
176
|
+
/** The kinds map of a provider list, by each provider's name: the registry derives its kinds this way, never twice. */
|
|
177
|
+
export type KindsOf<L extends readonly {
|
|
178
|
+
readonly name: string;
|
|
179
|
+
}[]> = {
|
|
180
|
+
readonly [P in L[number] as P["name"]]: KindOf<P>;
|
|
181
|
+
};
|
|
182
|
+
/** The core's own lane: the runner sandbox, in a runner run. */
|
|
183
|
+
export type CoreLane = "runner";
|
|
184
|
+
/** A lane of a run: the runner's, or a resource's. */
|
|
185
|
+
export type RunLane<K> = CoreLane | KindAt<K, keyof K>["lane"];
|
|
186
|
+
/**
|
|
187
|
+
* Each resource's part of the run request, by name, the same in either kind of run: what the run's policy binds each
|
|
188
|
+
* provider to. A resource the run doesn't ask for is absent.
|
|
189
|
+
*/
|
|
190
|
+
export type ResourceRequests<K> = {
|
|
191
|
+
readonly [N in keyof K]?: KindAt<K, N>["request"];
|
|
192
|
+
};
|
|
193
|
+
/** What each acquired resource tells a `ran` outcome, by name. */
|
|
194
|
+
export type ResourceFacts<K> = {
|
|
195
|
+
readonly [N in keyof K]?: KindAt<K, N>["facts"];
|
|
196
|
+
};
|
|
197
|
+
/** Each held resource's resolved options, by name: what its command half settles. */
|
|
198
|
+
export type ResourceOptions<K> = {
|
|
199
|
+
readonly [N in keyof K]?: KindAt<K, N>["options"];
|
|
200
|
+
};
|
|
201
|
+
/** What outcomes report of each resource's cleanup, by name: the run cleanup's `resources`. */
|
|
202
|
+
export type ResourceCleanupFacts<K> = {
|
|
203
|
+
readonly [N in keyof K]?: KindAt<K, N>["cleanupFacts"];
|
|
204
|
+
};
|
|
205
|
+
/** What a `ran` outcome reports of each acquired resource that reports something, by name: `resources`. */
|
|
206
|
+
export type ResourceRanFacts<K> = {
|
|
207
|
+
readonly [N in keyof K]?: KindAt<K, N>["ranFacts"];
|
|
208
|
+
};
|
|
209
|
+
/** The reasons of every resource's errors. */
|
|
210
|
+
export type ResourceReason<K> = KindAt<K, keyof K>["reason"];
|
|
211
|
+
/** What a `canceled` outcome says of each resource the run asked for, by name. */
|
|
212
|
+
export type ResourceCanceledFacts<K> = {
|
|
213
|
+
readonly [N in keyof K]?: KindAt<K, N>["canceledFacts"];
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* What releasing each resource a run held did, by name. It names only the resources whose release reported
|
|
217
|
+
* something; `{}` means none did.
|
|
218
|
+
*/
|
|
219
|
+
export type ResourceCleanup<K> = {
|
|
220
|
+
readonly [N in keyof K]?: KindAt<K, N>["cleanup"];
|
|
221
|
+
};
|
|
222
|
+
/** What the run holds of each resource as cleanup starts, by name; a resource with nothing to name is absent. */
|
|
223
|
+
export type ResourceHoldings<K> = {
|
|
224
|
+
readonly [N in keyof K]?: KindAt<K, N>["holding"];
|
|
225
|
+
};
|
|
226
|
+
/** How many things releasing each resource the run held couldn't do, by name. */
|
|
227
|
+
export type ResourceFailures<K> = {
|
|
228
|
+
readonly [N in keyof K]?: number;
|
|
229
|
+
};
|
|
230
|
+
/** The run payload's `resources`: each acquired resource's entry, by name. */
|
|
231
|
+
export type ResourcePayloads<K> = {
|
|
232
|
+
readonly [N in keyof K]?: KindAt<K, N>["payload"];
|
|
233
|
+
};
|
|
234
|
+
/** A resource's own run event, nested with its name. One union member per resource, so `resource` narrows `event`. */
|
|
235
|
+
export type ResourceEvent<K> = {
|
|
236
|
+
readonly [N in keyof K & string]: {
|
|
237
|
+
readonly kind: "resource";
|
|
238
|
+
readonly resource: N;
|
|
239
|
+
readonly event: KindAt<K, N>["event"];
|
|
240
|
+
};
|
|
241
|
+
}[keyof K & string];
|
|
242
|
+
/** A resource's refusal while the run acquires, one union member per resource, so `resource` narrows `refusal`. */
|
|
243
|
+
export type ResourceRefusal<K> = {
|
|
244
|
+
readonly [N in keyof K & string]: {
|
|
245
|
+
readonly kind: "resource-refused";
|
|
246
|
+
readonly resource: N;
|
|
247
|
+
readonly refusal: KindAt<K, N>["refusal"];
|
|
248
|
+
};
|
|
249
|
+
}[keyof K & string];
|
|
250
|
+
/**
|
|
251
|
+
* A resource's refusal before the run holds anything, one union member per resource, so `resource` narrows `refusal`;
|
|
252
|
+
* a resource whose prepare never refuses has `refusal: never`. The run ends with it before it acquires, so it carries no
|
|
253
|
+
* cleanup.
|
|
254
|
+
*/
|
|
255
|
+
export type ResourceUnprepared<K> = {
|
|
256
|
+
readonly [N in keyof K & string]: {
|
|
257
|
+
readonly kind: "resource-unprepared";
|
|
258
|
+
readonly resource: N;
|
|
259
|
+
readonly refusal: KindAt<K, N>["prepareRefusal"];
|
|
260
|
+
};
|
|
261
|
+
}[keyof K & string];
|
|
262
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// The core's resource contract: what one resource declares (`ResourceKind`), the run half its provider implements
|
|
2
|
+
// (`RunProvider`), and the types a run builds over the registry's kinds `K`. It names no resource. Each resource's
|
|
3
|
+
// folder under `src/resources/` declares its kind and writes its provider against it; `src/resources.ts`, in the
|
|
4
|
+
// composition layer, lists the providers and derives `K` from that list. `core/keyed.ts` holds the only casts that
|
|
5
|
+
// relate a resource's name to `K`.
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { CredentialSource } from "../credential/index.ts";
|
|
2
|
+
import type { LaneOutcome, RunProgress } from "./events.ts";
|
|
3
|
+
import type { RunProviders, ResourceCanceledFacts, ResourceCleanup, ResourceFacts, ResourceFailures, ResourceHoldings, ResourcePayloads, ResourceRefusal, ResourceRequests, ResourceUnprepared, RunLane } from "./resource.ts";
|
|
4
|
+
import type { RunStopped } from "./run.ts";
|
|
5
|
+
/**
|
|
6
|
+
* How acquiring one resource ended, as the policy ranks it: its own outcome stays in its slot. `refused` carries the
|
|
7
|
+
* outcome it ends the run with: its own refusal, or the run's `mint-failed`.
|
|
8
|
+
*/
|
|
9
|
+
type SlotOutcome<K> = {
|
|
10
|
+
readonly kind: "acquired";
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: "refused";
|
|
13
|
+
readonly outcome: ResourceRefusal<K> | MintFailedStop;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: "canceled";
|
|
16
|
+
};
|
|
17
|
+
/** A local run's mint failing a resource that couldn't go on without it. */
|
|
18
|
+
type MintFailedStop = Extract<RunStopped<never>, {
|
|
19
|
+
readonly kind: "mint-failed";
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Settles one lane's task: reports how lane `lane` ended, by `outcomeOf` its value or as failed when it throws, and
|
|
23
|
+
* answers the value. A slot hands its provider's own acquire to it, so the lane ends as soon as the acquire does.
|
|
24
|
+
*/
|
|
25
|
+
type LaneSettle<K> = <V>(lane: RunLane<K> | undefined, task: Promise<V>, outcomeOf: (value: V) => LaneOutcome) => Promise<V>;
|
|
26
|
+
/**
|
|
27
|
+
* One provider, bound to one run: its part of the run request, what it owns, and how acquiring it ended. Everything
|
|
28
|
+
* it answers is keyed by its name.
|
|
29
|
+
*/
|
|
30
|
+
export interface ResourceSlot<K> {
|
|
31
|
+
readonly name: keyof K & string;
|
|
32
|
+
readonly lane: RunLane<K> | undefined;
|
|
33
|
+
/** Whether the run holds it: the run asked for it, and its provider's `requested` answered a request. */
|
|
34
|
+
readonly held: boolean;
|
|
35
|
+
prepare(progress: RunProgress<K>): Promise<ResourceUnprepared<K> | undefined>;
|
|
36
|
+
/** Reports its lane's start, when the run holds it and it has a lane, just before the run acquires it. */
|
|
37
|
+
startLane(progress: RunProgress<K>): Promise<void>;
|
|
38
|
+
/** Acquires it through `settle`, when the run holds it; undefined when it doesn't. */
|
|
39
|
+
acquire(input: {
|
|
40
|
+
readonly signal: AbortSignal;
|
|
41
|
+
readonly credential: CredentialSource | undefined;
|
|
42
|
+
readonly progress: RunProgress<K>;
|
|
43
|
+
readonly settle: LaneSettle<K>;
|
|
44
|
+
}): Promise<SlotOutcome<K> | undefined>;
|
|
45
|
+
/** Reports it ready, once acquired. */
|
|
46
|
+
ready(progress: RunProgress<K>): Promise<void>;
|
|
47
|
+
/** Its run payload entry, once acquired. */
|
|
48
|
+
payload(): ResourcePayloads<K>;
|
|
49
|
+
/** What it tells a `ran` outcome, once acquired. */
|
|
50
|
+
facts(): ResourceFacts<K>;
|
|
51
|
+
/** What a `canceled` outcome says of it, by how far acquiring it got; nothing when the run doesn't hold it. */
|
|
52
|
+
canceledFacts(): ResourceCanceledFacts<K>;
|
|
53
|
+
/** What the run holds of it, from what it owns, as its presentation names it once cleanup starts. */
|
|
54
|
+
holding(): ResourceHoldings<K>;
|
|
55
|
+
/** Releases what it owns, when the run holds it, and answers what that did. */
|
|
56
|
+
release(progress: RunProgress<K>): Promise<ResourceCleanup<K>>;
|
|
57
|
+
/** How many things releasing it couldn't do, from the run's `cleanup`. */
|
|
58
|
+
failures(cleanup: ResourceCleanup<K>): ResourceFailures<K>;
|
|
59
|
+
}
|
|
60
|
+
/** Each of `providers`, bound to this run, in order. */
|
|
61
|
+
export declare function resourceSlots<K, C>(providers: RunProviders<K, C>, context: C, requests: ResourceRequests<K>): readonly ResourceSlot<K>[];
|
|
62
|
+
/** The lanes of the resources the run holds, in provider order, which the `started` event reports. */
|
|
63
|
+
export declare function heldLanes<K>(slots: readonly ResourceSlot<K>[]): readonly RunLane<K>[];
|
|
64
|
+
/**
|
|
65
|
+
* Prepares each resource in order, before the run acquires anything: the first refusal ends the run, holding
|
|
66
|
+
* nothing.
|
|
67
|
+
*/
|
|
68
|
+
export declare function prepareResources<K>(slots: readonly ResourceSlot<K>[], progress: RunProgress<K>): Promise<ResourceUnprepared<K> | undefined>;
|
|
69
|
+
/**
|
|
70
|
+
* A lane a runner run readies beside its resources: the runner sandbox. `stopped` is the outcome its value ends the
|
|
71
|
+
* run with, which ranks above every resource's refusal; undefined when it doesn't end the run.
|
|
72
|
+
*/
|
|
73
|
+
export interface BesideLane<K, T> {
|
|
74
|
+
readonly lane: RunLane<K>;
|
|
75
|
+
readonly start: (signal: AbortSignal) => Promise<T>;
|
|
76
|
+
readonly outcomeOf: (value: T) => LaneOutcome;
|
|
77
|
+
readonly stopped: (value: T) => RunStopped<K> | undefined;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* How acquiring a run's resources ended: `stopped` with the outcome that ends the run before its command, or every
|
|
81
|
+
* resource the run asked for `acquired`, with the beside lane's value, if it had one.
|
|
82
|
+
*/
|
|
83
|
+
export type Acquisition<K, T> = {
|
|
84
|
+
readonly kind: "stopped";
|
|
85
|
+
readonly outcome: RunStopped<K>;
|
|
86
|
+
} | {
|
|
87
|
+
readonly kind: "acquired";
|
|
88
|
+
readonly beside: T | undefined;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Acquires every resource the run holds at once, in order, and in a runner run readies the runner lane (`beside`)
|
|
92
|
+
* beside them. Everything runs under one internal abort combined with the user's `signal`: a resource that refuses or
|
|
93
|
+
* throws, a lane that ends short of ready, or a lane whose end can't be reported aborts the rest, so all settle soon.
|
|
94
|
+
* It waits for all of them before it answers, so the run's cleanup sees everything they own. First each resource with a
|
|
95
|
+
* lane reports its lane's start, in order, so every acquire then starts at once, beside the beside lane; each of those
|
|
96
|
+
* lanes reports how it ended as it settles, a throw as failed.
|
|
97
|
+
*
|
|
98
|
+
* A throw rethrows, the beside lane's first, then the resources' in order. Otherwise the outcome ranks, the same in
|
|
99
|
+
* both kinds of run: the user's `signal` (`canceled`), then the beside lane's failure, then each resource's refusal in
|
|
100
|
+
* order (its own, or the run's `mint-failed` when the mint it needed failed), then a resource's cancellation. A refusal aborts the other resources, so one that stops on that abort answers
|
|
101
|
+
* `canceled`; ranking every refusal above every cancellation keeps the refusal that caused it.
|
|
102
|
+
*/
|
|
103
|
+
export declare function acquireResources<K, T>(slots: readonly ResourceSlot<K>[], input: {
|
|
104
|
+
readonly credential: CredentialSource | undefined;
|
|
105
|
+
readonly signal: AbortSignal;
|
|
106
|
+
readonly progress: RunProgress<K>;
|
|
107
|
+
readonly beside?: BesideLane<K, T>;
|
|
108
|
+
}): Promise<Acquisition<K, T>>;
|
|
109
|
+
/** The `canceled` stop of a run whose resources got as far as `slots` say. */
|
|
110
|
+
export declare function canceledHolding<K>(slots: readonly ResourceSlot<K>[]): Extract<RunStopped<K>, {
|
|
111
|
+
kind: "canceled";
|
|
112
|
+
}>;
|
|
113
|
+
/** Reports each acquired resource ready, in order, just before the command starts. */
|
|
114
|
+
export declare function readyResources<K>(slots: readonly ResourceSlot<K>[], progress: RunProgress<K>): Promise<void>;
|
|
115
|
+
/** The run payload's `resources`: each acquired resource's entry, under its name, in order. */
|
|
116
|
+
export declare function resourcesPayload<K>(slots: readonly ResourceSlot<K>[]): ResourcePayloads<K>;
|
|
117
|
+
/** What the acquired resources tell a `ran` outcome, under each one's name. */
|
|
118
|
+
export declare function resourcesFacts<K>(slots: readonly ResourceSlot<K>[]): ResourceFacts<K>;
|
|
119
|
+
/** The resources the run holds, in provider order, which the `started` event reports. */
|
|
120
|
+
export declare function heldResources<K>(slots: readonly ResourceSlot<K>[]): readonly (keyof K & string)[];
|
|
121
|
+
/** What the run holds of each resource, under its name, as cleanup starts. */
|
|
122
|
+
export declare function resourceHoldings<K>(slots: readonly ResourceSlot<K>[]): ResourceHoldings<K>;
|
|
123
|
+
/**
|
|
124
|
+
* Releases every resource the run holds, in reverse order, and answers what that did, keyed by resource name: only the
|
|
125
|
+
* resources whose release reported something. Each release runs even when one before it threw; the first throw is
|
|
126
|
+
* rethrown once all have run.
|
|
127
|
+
*/
|
|
128
|
+
export declare function releaseResources<K>(slots: readonly ResourceSlot<K>[], progress: RunProgress<K>): Promise<ResourceCleanup<K>>;
|
|
129
|
+
/** How many things releasing each resource in `cleanup` couldn't do, in the order the run released them. */
|
|
130
|
+
export declare function resourceFailures<K>(slots: readonly ResourceSlot<K>[], cleanup: ResourceCleanup<K>): ResourceFailures<K>;
|
|
131
|
+
export {};
|