@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,57 @@
|
|
|
1
|
+
// What a `storm.config.ts` holds at its top level: the settings `scope`, `project` and `runner`, each with its
|
|
2
|
+
// rule, and `resources`, whose sections the resource configs a caller passes in describe (`resource-config.ts`). Also
|
|
3
|
+
// the check vocabulary every rule shares: `Checked`, `ValueProblem` and how a problem names a value.
|
|
4
|
+
import { checkRecipe } from "../runner/index.js";
|
|
5
|
+
/** The config file's name. storm looks for it in the working directory and its parents. */
|
|
6
|
+
export const CONFIG_FILE_NAME = "storm.config.ts";
|
|
7
|
+
/** A check that failed with one problem about the value itself. */
|
|
8
|
+
export function wrongValue(problem) {
|
|
9
|
+
return { ok: false, problems: [{ path: [], problem }] };
|
|
10
|
+
}
|
|
11
|
+
/** A string with at least one character. */
|
|
12
|
+
export function checkNonEmptyString(value) {
|
|
13
|
+
return typeof value === "string" && value.length > 0
|
|
14
|
+
? { ok: true, value }
|
|
15
|
+
: wrongValue(`must be a non-empty string, not ${describeValue(value)}`);
|
|
16
|
+
}
|
|
17
|
+
/** `true` or `false`. */
|
|
18
|
+
export function checkBoolean(value) {
|
|
19
|
+
return typeof value === "boolean"
|
|
20
|
+
? { ok: true, value }
|
|
21
|
+
: wrongValue(`must be true or false, not ${describeValue(value)}`);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Each top-level setting's rule. Typed against `ConfigSettings`, so a key it gains or loses, or a value type that
|
|
25
|
+
* changes, fails to compile here until its rule follows. A runner recipe's problems name the key inside the recipe.
|
|
26
|
+
*/
|
|
27
|
+
const SETTING_CHECKS = {
|
|
28
|
+
scope: checkNonEmptyString,
|
|
29
|
+
project: checkNonEmptyString,
|
|
30
|
+
runner: checkRecipe,
|
|
31
|
+
};
|
|
32
|
+
/** Every top-level setting, in the order a config file's problems list them. */
|
|
33
|
+
export const CONFIG_SETTING_KEYS = ["scope", "project", "runner"];
|
|
34
|
+
/** Whether `key` is a top-level setting. */
|
|
35
|
+
export function isConfigSettingKey(key) {
|
|
36
|
+
return Object.hasOwn(SETTING_CHECKS, key);
|
|
37
|
+
}
|
|
38
|
+
/** Checks one top-level setting's value from the file. */
|
|
39
|
+
export function checkSettingValue(key, value) {
|
|
40
|
+
return SETTING_CHECKS[key](value);
|
|
41
|
+
}
|
|
42
|
+
/** A value as a problem names it: a string or number as written, otherwise its kind. */
|
|
43
|
+
export function describeValue(value) {
|
|
44
|
+
if (typeof value === "string")
|
|
45
|
+
return JSON.stringify(value);
|
|
46
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
47
|
+
return String(value);
|
|
48
|
+
if (value === null)
|
|
49
|
+
return "null";
|
|
50
|
+
if (value === undefined)
|
|
51
|
+
return "undefined";
|
|
52
|
+
if (typeof value === "function")
|
|
53
|
+
return "a function";
|
|
54
|
+
if (Array.isArray(value))
|
|
55
|
+
return "an array";
|
|
56
|
+
return typeof value === "object" ? "an object" : `a ${typeof value}`;
|
|
57
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AnyResourceConfig, type GivenResources } from "./resource-config.ts";
|
|
2
|
+
/** What `parseSetFlags` found: the values, or one problem for each `--set` it couldn't use. */
|
|
3
|
+
export type SetFlagsParse<Configs extends readonly AnyResourceConfig[]> = {
|
|
4
|
+
readonly ok: true;
|
|
5
|
+
readonly values: GivenResources<Configs>;
|
|
6
|
+
} | {
|
|
7
|
+
readonly ok: false;
|
|
8
|
+
readonly problems: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The options a command gives their own flags, by key path, such as `resources.<name>.<option>`, with each flag's
|
|
12
|
+
* spelling, such as `--<name>-<option>`. `--set` takes none of them: one option has one spelling on the command line.
|
|
13
|
+
*/
|
|
14
|
+
export interface OwnFlags {
|
|
15
|
+
readonly [keyPath: string]: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The key paths `--set` takes, such as `resources.<name>.<option>`, in config order, then option order: every option of
|
|
19
|
+
* `configs` but those in `ownFlags`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function setKeyPaths(configs: readonly AnyResourceConfig[], ownFlags?: OwnFlags): readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* Reads each `--set <key path>=<value>` in `texts` against `configs`. Each problem names the `--set` as given: one
|
|
24
|
+
* without `=`, a key path with its own flag in `ownFlags`, which it names, a key path `--set` doesn't take, a key path
|
|
25
|
+
* given twice, or a value its option's rule refuses.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseSetFlags<Configs extends readonly AnyResourceConfig[]>(texts: readonly string[], configs: Configs, ownFlags?: OwnFlags): SetFlagsParse<Configs>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// `--set <key path>=<value>`: a resource's option given on the command line by its key path in `storm.config.ts`,
|
|
2
|
+
// `resources.<name>.<option>`. Every option of every resource config passed in takes one, but an option the command
|
|
3
|
+
// gives its own flag (`OwnFlags`), which `--set` refuses by naming that flag. Each value is text, read by its option's
|
|
4
|
+
// rule (`readText`) and then checked by the rule, as a value from the file would be. The values come back by resource,
|
|
5
|
+
// then by option.
|
|
6
|
+
import { givenResourcesByName } from "./by-name.js";
|
|
7
|
+
import { optionKeyPath } from "./resource-config.js";
|
|
8
|
+
/**
|
|
9
|
+
* Each key path `--set` takes, with the option it names, in config order, then option order: every option of
|
|
10
|
+
* `configs` but those in `ownFlags`.
|
|
11
|
+
*/
|
|
12
|
+
function setTargets(configs, ownFlags) {
|
|
13
|
+
return configs.flatMap((config) => Object.entries(config.options).flatMap(([option, rule]) => {
|
|
14
|
+
const path = optionKeyPath(config.name, option);
|
|
15
|
+
return Object.hasOwn(ownFlags, path) ? [] : [[path, { resource: config.name, option, rule }]];
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The key paths `--set` takes, such as `resources.<name>.<option>`, in config order, then option order: every option of
|
|
20
|
+
* `configs` but those in `ownFlags`.
|
|
21
|
+
*/
|
|
22
|
+
export function setKeyPaths(configs, ownFlags = {}) {
|
|
23
|
+
return setTargets(configs, ownFlags).map(([path]) => path);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reads each `--set <key path>=<value>` in `texts` against `configs`. Each problem names the `--set` as given: one
|
|
27
|
+
* without `=`, a key path with its own flag in `ownFlags`, which it names, a key path `--set` doesn't take, a key path
|
|
28
|
+
* given twice, or a value its option's rule refuses.
|
|
29
|
+
*/
|
|
30
|
+
export function parseSetFlags(texts, configs, ownFlags = {}) {
|
|
31
|
+
const targets = setTargets(configs, ownFlags);
|
|
32
|
+
const byPath = new Map(targets);
|
|
33
|
+
const paths = targets.map(([path]) => path);
|
|
34
|
+
const values = {};
|
|
35
|
+
const seen = new Set();
|
|
36
|
+
const problems = [];
|
|
37
|
+
for (const text of texts) {
|
|
38
|
+
const equals = text.indexOf("=");
|
|
39
|
+
if (equals <= 0) {
|
|
40
|
+
problems.push(`--set ${text} must be <key path>=<value>${paths[0] === undefined ? "" : `, such as ${paths[0]}=<value>`}`);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const path = text.slice(0, equals);
|
|
44
|
+
const flag = Object.hasOwn(ownFlags, path) ? ownFlags[path] : undefined;
|
|
45
|
+
if (flag !== undefined) {
|
|
46
|
+
problems.push(`--set ${path} has its own flag; use ${flag}`);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const target = byPath.get(path);
|
|
50
|
+
if (target === undefined) {
|
|
51
|
+
problems.push(paths.length === 0
|
|
52
|
+
? `--set ${path} isn't a key path --set takes; it takes none`
|
|
53
|
+
: `--set ${path} isn't a key path --set takes; it takes ${paths.join(", ")}`);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (seen.has(path)) {
|
|
57
|
+
problems.push(`--set ${path} is given more than once`);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
seen.add(path);
|
|
61
|
+
const checked = target.rule.check(target.rule.readText(text.slice(equals + 1)));
|
|
62
|
+
if (!checked.ok) {
|
|
63
|
+
problems.push(...checked.problems.map(({ problem }) => `--set ${path} ${problem}`));
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
values[target.resource] = { ...values[target.resource], [target.option]: checked.value };
|
|
67
|
+
}
|
|
68
|
+
if (problems.length > 0)
|
|
69
|
+
return { ok: false, problems };
|
|
70
|
+
return { ok: true, values: givenResourcesByName(configs, values) };
|
|
71
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Refusable } from "@vercel/clinkr";
|
|
2
|
+
import { configErrors } from "./errors.ts";
|
|
3
|
+
import type { ConfigGateway } from "./gateways.ts";
|
|
4
|
+
import { type ConfigProblem, type ConfigValues } from "./load.ts";
|
|
5
|
+
import { type ResolvedSettings, type ResourceOptionProblem, type SettingFlags } from "./resolve.ts";
|
|
6
|
+
import type { AnyResourceConfig, GivenOptions, GivenResources, ResolvedResources } from "./resource-config.ts";
|
|
7
|
+
type InvalidConfig = ReturnType<typeof configErrors.invalidConfig>;
|
|
8
|
+
type InvalidResourceOptions = ReturnType<typeof configErrors.invalidResourceOptions>;
|
|
9
|
+
/**
|
|
10
|
+
* The config file a command's settings come from: its absolute path and checked values, or neither when none
|
|
11
|
+
* applies. `configs` are the resource configs it was checked against.
|
|
12
|
+
*/
|
|
13
|
+
export interface SettingsFile<Configs extends readonly AnyResourceConfig[]> {
|
|
14
|
+
readonly path: string | null;
|
|
15
|
+
readonly values: ConfigValues<Configs> | undefined;
|
|
16
|
+
readonly configs: Configs;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Loads and checks the config file from `cwd` against `configs`, refusing with `invalid_config` when it can't be used
|
|
20
|
+
* or any value in it is invalid.
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadSettingsFile<Configs extends readonly AnyResourceConfig[]>(gateway: ConfigGateway, cwd: string, configs: Configs): Promise<Refusable<SettingsFile<Configs>, InvalidConfig>>;
|
|
23
|
+
/** The top-level settings from `flags` over `file`. */
|
|
24
|
+
export declare function fileSettings(file: SettingsFile<readonly AnyResourceConfig[]>, flags: SettingFlags): ResolvedSettings;
|
|
25
|
+
/**
|
|
26
|
+
* What the file gives resource config `config`'s section, if anything: the file was checked against `config`, so its
|
|
27
|
+
* section holds `config`'s options. It throws when the file wasn't checked against `config`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function fileOptions<C extends AnyResourceConfig>(file: SettingsFile<readonly AnyResourceConfig[]>, config: C): GivenOptions<C> | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The resolved options of each resource the run holds, from the file and `sets`, refusing with
|
|
32
|
+
* `invalid_resource_options` when a held resource's merged options don't fit together or lack a required one.
|
|
33
|
+
*/
|
|
34
|
+
export declare function settleResourceOptions<Configs extends readonly AnyResourceConfig[]>(file: SettingsFile<Configs>, sets: GivenResources<Configs>): Refusable<{
|
|
35
|
+
readonly options: ResolvedResources<Configs>;
|
|
36
|
+
}, InvalidResourceOptions>;
|
|
37
|
+
/** The `invalid_config` error for the file at `file`. */
|
|
38
|
+
export declare function invalidConfig(file: string, problems: readonly ConfigProblem[]): InvalidConfig;
|
|
39
|
+
/** The `invalid_resource_options` error, each value as text. */
|
|
40
|
+
export declare function invalidResourceOptions(configFile: string | null, problems: readonly ResourceOptionProblem[]): InvalidResourceOptions;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// How a command that reads `storm.config.ts` settles its settings: find, load and check all of it against the
|
|
2
|
+
// resource configs it is handed, take each top-level setting from its flag or the file, and merge each held resource's
|
|
3
|
+
// options from its defaults, the file and the flags, refusing with `invalid_config` or `invalid_resource_options`.
|
|
4
|
+
import { refused } from "@vercel/clinkr";
|
|
5
|
+
import { givenOptionsOf } from "./by-name.js";
|
|
6
|
+
import { configErrors } from "./errors.js";
|
|
7
|
+
import { loadConfig } from "./load.js";
|
|
8
|
+
import { resolveResourceOptions, resolveSettings, } from "./resolve.js";
|
|
9
|
+
import { describeValue } from "./schema.js";
|
|
10
|
+
/**
|
|
11
|
+
* Loads and checks the config file from `cwd` against `configs`, refusing with `invalid_config` when it can't be used
|
|
12
|
+
* or any value in it is invalid.
|
|
13
|
+
*/
|
|
14
|
+
export async function loadSettingsFile(gateway, cwd, configs) {
|
|
15
|
+
const loaded = await loadConfig(gateway, cwd, configs);
|
|
16
|
+
if (loaded.kind === "invalid")
|
|
17
|
+
return refused(invalidConfig(loaded.path, loaded.problems));
|
|
18
|
+
return loaded.kind === "loaded"
|
|
19
|
+
? { ok: true, path: loaded.path, values: loaded.values, configs }
|
|
20
|
+
: { ok: true, path: null, values: undefined, configs };
|
|
21
|
+
}
|
|
22
|
+
/** The top-level settings from `flags` over `file`. */
|
|
23
|
+
export function fileSettings(file, flags) {
|
|
24
|
+
return resolveSettings(flags, file.values?.settings);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* What the file gives resource config `config`'s section, if anything: the file was checked against `config`, so its
|
|
28
|
+
* section holds `config`'s options. It throws when the file wasn't checked against `config`.
|
|
29
|
+
*/
|
|
30
|
+
export function fileOptions(file, config) {
|
|
31
|
+
if (!file.configs.includes(config))
|
|
32
|
+
throw new Error(`The config file wasn't checked against ${config.name}`);
|
|
33
|
+
const resources = file.values?.resources;
|
|
34
|
+
const given = resources?.[config.name];
|
|
35
|
+
return given === undefined ? undefined : givenOptionsOf(config, given);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The resolved options of each resource the run holds, from the file and `sets`, refusing with
|
|
39
|
+
* `invalid_resource_options` when a held resource's merged options don't fit together or lack a required one.
|
|
40
|
+
*/
|
|
41
|
+
export function settleResourceOptions(file, sets) {
|
|
42
|
+
const resolved = resolveResourceOptions(file.configs, file.values?.resources, sets);
|
|
43
|
+
if (!resolved.ok)
|
|
44
|
+
return refused(invalidResourceOptions(file.path, resolved.problems));
|
|
45
|
+
return { ok: true, options: resolved.value };
|
|
46
|
+
}
|
|
47
|
+
/** The `invalid_config` error for the file at `file`. */
|
|
48
|
+
export function invalidConfig(file, problems) {
|
|
49
|
+
return configErrors.invalidConfig({
|
|
50
|
+
file,
|
|
51
|
+
problems: problems.map(({ key, location, problem }) => ({
|
|
52
|
+
key,
|
|
53
|
+
location: location === null ? null : { line: location.line, column: location.column ?? null },
|
|
54
|
+
problem,
|
|
55
|
+
})),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/** The `invalid_resource_options` error, each value as text. */
|
|
59
|
+
export function invalidResourceOptions(configFile, problems) {
|
|
60
|
+
return configErrors.invalidResourceOptions({
|
|
61
|
+
configFile,
|
|
62
|
+
problems: problems.map(({ key, problem, values }) => ({
|
|
63
|
+
key,
|
|
64
|
+
problem,
|
|
65
|
+
values: values.map(({ key: valueKey, value, source }) => ({ key: valueKey, value: valueText(value), source })),
|
|
66
|
+
})),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** A value as an error's facts give it: a string as written, a number or boolean as its text, anything else by kind. */
|
|
70
|
+
function valueText(value) {
|
|
71
|
+
return typeof value === "string" ? value : describeValue(value);
|
|
72
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ConfigSettings } from "../config/index.ts";
|
|
2
|
+
import type { GitHubFixtureRepoResource } from "../resources/github/index.ts";
|
|
3
|
+
import type { TestserverPoolResource } from "../resources/testserver/index.ts";
|
|
4
|
+
export { pnpmToolchains } from "./toolchain.ts";
|
|
5
|
+
export type { RunnerRecipe, RunnerResources, RunnerStep, RunnerStepContext, RunnerSteps } from "../runner/index.ts";
|
|
6
|
+
/**
|
|
7
|
+
* The resources a run holds for its command, each made by its own factory. Without one, a run holds nothing beside
|
|
8
|
+
* its command. `storm vitest` and `storm exec` set any resource's option for one run, and gives the run that resource when the file
|
|
9
|
+
* has none: the Testserver pool resource's with its own flags (`--testserver-sandboxes`, `--testserver-build`,
|
|
10
|
+
* `--testserver-min-time-left`, `--testserver-ttl`, `--testserver-no-create`), any other's with
|
|
11
|
+
* `--set resources.<name>.<option>=<value>`.
|
|
12
|
+
*/
|
|
13
|
+
export interface StormResources {
|
|
14
|
+
/**
|
|
15
|
+
* The Testserver pool resource, from `testserverPool()` in `@cnc-tools/storm/testserver`. Its presence gives a run
|
|
16
|
+
* a Testserver side. `pool create` reads its `build` and `ttl` whether or not a run would.
|
|
17
|
+
*/
|
|
18
|
+
readonly testserverPool?: TestserverPoolResource;
|
|
19
|
+
/**
|
|
20
|
+
* The GitHub fixture repository resource, from `githubFixtureRepo()` in `@cnc-tools/storm/github`: one standing
|
|
21
|
+
* GitHub repository, a token for it and a run prefix, handed to the command, whose branches under the run prefix the
|
|
22
|
+
* run deletes once the command has stopped. Only a run, `vitest`'s or `exec`'s, reads it.
|
|
23
|
+
*/
|
|
24
|
+
readonly githubFixtureRepo?: GitHubFixtureRepoResource;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* What a `storm.config.ts` can give: the top-level settings, and the resources a run holds. A flag (`--scope`,
|
|
28
|
+
* `--project`, a `--testserver-*` flag, or `--set` for another resource's option) overrides the file, and the file overrides the built-in default.
|
|
29
|
+
* storm checks the whole file whenever a command loads it.
|
|
30
|
+
*/
|
|
31
|
+
export interface StormConfig extends ConfigSettings {
|
|
32
|
+
/**
|
|
33
|
+
* The resources a run holds. Without `resources.testserverPool`, and without a `--testserver-*` flag,
|
|
34
|
+
* a run holds no Testserver sandbox: it runs the command with a run payload that names none.
|
|
35
|
+
*/
|
|
36
|
+
readonly resources?: StormResources;
|
|
37
|
+
}
|
|
38
|
+
/** Types a `storm.config.ts`'s default export. It returns `config` as given. */
|
|
39
|
+
export declare function defineConfig(config: StormConfig): StormConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The config file's published surface, `@cnc-tools/storm/config`. A user's `storm.config.ts` imports it, so it
|
|
2
|
+
// imports nothing at run time but `toolchain.ts`, which imports nothing either: loading a config file pulls in no
|
|
3
|
+
// Clinkr, zod or CLI code. Everything it takes from the modules, the top-level settings, the runner recipe's types and
|
|
4
|
+
// each resource's factory type, is a type-only import, erased at run time.
|
|
5
|
+
export { pnpmToolchains } from "./toolchain.js";
|
|
6
|
+
/** Types a `storm.config.ts`'s default export. It returns `config` as given. */
|
|
7
|
+
export function defineConfig(config) {
|
|
8
|
+
return config;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RunnerStep, RunnerStepContext } from "../runner/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The runner snapshot's toolchain step for the root `package.json` at the base: `git` on `PATH`, a Node that meets
|
|
4
|
+
* `engines.node`'s minimum when the runtime's is older, and the `packageManager`'s pnpm through corepack. Shims and a
|
|
5
|
+
* downloaded Node go in `~/.local/bin`, which the login shell's `PATH` puts first. Give it as a recipe's
|
|
6
|
+
* `snapshot.toolchains`. It rejects when `packageManager` isn't `pnpm@<x.y.z>` or `engines.node` isn't `>=<x.y.z>`,
|
|
7
|
+
* which keeps a cached runner snapshot at that base from being used.
|
|
8
|
+
*/
|
|
9
|
+
export declare function pnpmToolchains({ readBaseFile }: RunnerStepContext): Promise<readonly RunnerStep[]>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// The toolchain steps a pnpm workspace's runner recipe can use, exported from `@cnc-tools/storm/config`. Like
|
|
2
|
+
// `define.ts`, it imports nothing at run time, so a config file that uses it loads no Clinkr, zod or CLI code.
|
|
3
|
+
/**
|
|
4
|
+
* The runner snapshot's toolchain step for the root `package.json` at the base: `git` on `PATH`, a Node that meets
|
|
5
|
+
* `engines.node`'s minimum when the runtime's is older, and the `packageManager`'s pnpm through corepack. Shims and a
|
|
6
|
+
* downloaded Node go in `~/.local/bin`, which the login shell's `PATH` puts first. Give it as a recipe's
|
|
7
|
+
* `snapshot.toolchains`. It rejects when `packageManager` isn't `pnpm@<x.y.z>` or `engines.node` isn't `>=<x.y.z>`,
|
|
8
|
+
* which keeps a cached runner snapshot at that base from being used.
|
|
9
|
+
*/
|
|
10
|
+
export async function pnpmToolchains({ readBaseFile }) {
|
|
11
|
+
const manifest = JSON.parse(await readBaseFile("package.json"));
|
|
12
|
+
return [{ label: "Installing the toolchains", script: toolchainScript(manifest) }];
|
|
13
|
+
}
|
|
14
|
+
function toolchainScript(manifest) {
|
|
15
|
+
const fields = typeof manifest === "object" && manifest !== null ? manifest : {};
|
|
16
|
+
const { packageManager, engines } = fields;
|
|
17
|
+
const pnpm = typeof packageManager === "string" ? /^pnpm@(\d+\.\d+\.\d+)/.exec(packageManager)?.[1] : undefined;
|
|
18
|
+
if (pnpm === undefined)
|
|
19
|
+
throw new Error(`package.json's packageManager isn't a pnpm version: ${String(packageManager)}`);
|
|
20
|
+
const engine = typeof engines === "object" && engines !== null ? engines["node"] : undefined;
|
|
21
|
+
const node = typeof engine === "string" ? /^>=\s*(\d+\.\d+\.\d+)$/.exec(engine)?.[1] : undefined;
|
|
22
|
+
if (node === undefined)
|
|
23
|
+
throw new Error("package.json's engines.node isn't a >= minimum");
|
|
24
|
+
return [
|
|
25
|
+
"set -euo pipefail",
|
|
26
|
+
'mkdir -p "$HOME/.local/bin"',
|
|
27
|
+
"command -v git >/dev/null || sudo dnf install -y -q git",
|
|
28
|
+
"git --version",
|
|
29
|
+
`if ! node -e 'const [a, b, c] = process.versions.node.split(".").map(Number); const [x, y, z] = "${node}".split(".").map(Number); process.exit(a !== x ? (a > x ? 0 : 1) : b !== y ? (b > y ? 0 : 1) : c >= z ? 0 : 1)'; then`,
|
|
30
|
+
' case "$(uname -m)" in aarch64) arch=arm64 ;; *) arch=x64 ;; esac',
|
|
31
|
+
` curl -fsSL "https://nodejs.org/dist/v${node}/node-v${node}-linux-$arch.tar.gz" | tar -xz -C "$HOME/.local"`,
|
|
32
|
+
` ln -sf "$HOME/.local/node-v${node}-linux-$arch/bin/"* "$HOME/.local/bin/"`,
|
|
33
|
+
"fi",
|
|
34
|
+
"hash -r",
|
|
35
|
+
"node --version",
|
|
36
|
+
'corepack enable --install-directory "$HOME/.local/bin" pnpm',
|
|
37
|
+
`corepack install -g pnpm@${pnpm}`,
|
|
38
|
+
"hash -r",
|
|
39
|
+
"pnpm --version",
|
|
40
|
+
].join("\n");
|
|
41
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type ConfigGateway } from "./config/index.ts";
|
|
2
|
+
import { type CredentialGateway, type GitHubActionsTokenGateway } from "./credential/index.ts";
|
|
3
|
+
import type { Presentation } from "./presentation.ts";
|
|
4
|
+
import { type RESOURCE_CONFIGS, type StormResourceGateways } from "./resources.ts";
|
|
5
|
+
import { type CommandGateway, type JobSummaryGateway, type ProgressTerminal, type RunDirectoryGateway } from "./core/index.ts";
|
|
6
|
+
import { type CheckoutGateway, type RunnerSandboxGateway, type RunnerSnapshotCacheGateway, type RunnerTerminal } from "./runner/index.ts";
|
|
7
|
+
import { type Clock, type Timer } from "./time/index.ts";
|
|
8
|
+
import { type VitestListGateway } from "./vitest/plan.ts";
|
|
9
|
+
/**
|
|
10
|
+
* The gateways and DI seams storm's commands reach the world through, beside the resources' own
|
|
11
|
+
* (`StormContext`).
|
|
12
|
+
*/
|
|
13
|
+
export interface StormCoreContext {
|
|
14
|
+
readonly credentials: CredentialGateway;
|
|
15
|
+
/** GitHub Actions' OIDC token issuer, for `--credential github-actions`. */
|
|
16
|
+
readonly githubActionsTokens: GitHubActionsTokenGateway;
|
|
17
|
+
readonly commands: CommandGateway;
|
|
18
|
+
readonly config: ConfigGateway;
|
|
19
|
+
/** The local Git checkout a runner run uploads from. */
|
|
20
|
+
readonly checkout: CheckoutGateway;
|
|
21
|
+
/** The per-machine runner snapshot cache. */
|
|
22
|
+
readonly runnerSnapshots: RunnerSnapshotCacheGateway;
|
|
23
|
+
/** Vercel Sandbox, where runner and build sandboxes run. */
|
|
24
|
+
readonly runnerSandboxes: RunnerSandboxGateway;
|
|
25
|
+
/** The terminal a remote command's output reaches. */
|
|
26
|
+
readonly runnerTerminal: RunnerTerminal;
|
|
27
|
+
/** Where each run writes its events, its steps' output, the command's output and its timeline. */
|
|
28
|
+
readonly runDirectories: RunDirectoryGateway;
|
|
29
|
+
/** The terminal a run's live view shows on, when its presentation is `live`. */
|
|
30
|
+
readonly progressTerminal: ProgressTerminal;
|
|
31
|
+
/** The GitHub Actions job summary a run appends its summary to, in a step that has one. */
|
|
32
|
+
readonly jobSummary: JobSummaryGateway;
|
|
33
|
+
/** vitest on this machine, which `storm vitest` finds and counts the tests with before a run starts. */
|
|
34
|
+
readonly vitestList: VitestListGateway;
|
|
35
|
+
readonly timer: Timer;
|
|
36
|
+
readonly clock: Clock;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The gateways and DI seams storm's commands reach the world through: the core's, and each resource's, which its
|
|
40
|
+
* kind declares. Tests build it over fakes.
|
|
41
|
+
*/
|
|
42
|
+
export type StormContext = StormCoreContext & StormResourceGateways;
|
|
43
|
+
/**
|
|
44
|
+
* Where a command records the status the process exits with, past Clinkr's: a Clinkr handler's result exits only
|
|
45
|
+
* 0 or 1, so a run, `exec`'s or `vitest`'s, records its command's code (or `128 + n` for a signal) here, and `bin/storm.ts` exits with
|
|
46
|
+
* it when it is set.
|
|
47
|
+
*/
|
|
48
|
+
export interface StormExit {
|
|
49
|
+
status: number | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The Clinkr application context (`app`) every command receives, the resources' own commands among them, which the
|
|
53
|
+
* registry checks it against (`RESOURCE_MOUNTS`).
|
|
54
|
+
*/
|
|
55
|
+
export interface StormApp {
|
|
56
|
+
readonly context: StormContext;
|
|
57
|
+
/** Every resource config, which a command checks `storm.config.ts` against. */
|
|
58
|
+
readonly resourceConfigs: typeof RESOURCE_CONFIGS;
|
|
59
|
+
/** The host's environment: the base of a run's command's environment. */
|
|
60
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
61
|
+
/** The host's working directory, where the search for `storm.config.ts` starts. */
|
|
62
|
+
readonly cwd: string;
|
|
63
|
+
/** storm's version, which a run prints first. */
|
|
64
|
+
readonly version: string;
|
|
65
|
+
/**
|
|
66
|
+
* The git commit storm was built from, as the version line shows it: 12 hex characters, `-dirty` appended when
|
|
67
|
+
* the tree had uncommitted changes. Null when unknown.
|
|
68
|
+
*/
|
|
69
|
+
readonly commit: string | null;
|
|
70
|
+
/** The local user name, which tags each sandbox a runner run starts. */
|
|
71
|
+
readonly user: string;
|
|
72
|
+
/** How a run's progress shows on stderr, resolved once from the host. */
|
|
73
|
+
readonly presentation: Presentation;
|
|
74
|
+
readonly exit: StormExit;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The live Context: `vercel` for credentials, and for `--credential github-actions` GitHub Actions' token request, read
|
|
78
|
+
* from `env`'s `ACTIONS_ID_TOKEN_REQUEST_*` at each request, with a 10-second timeout; a run's command spawned as a
|
|
79
|
+
* real process; `storm.config.ts` imported by Node; for a runner run, git and tar on the local checkout, the
|
|
80
|
+
* runner snapshot cache under `env`'s `XDG_STATE_HOME` or `HOME`, Vercel Sandbox through `@vercel/sandbox` (loaded
|
|
81
|
+
* only when a runner run first calls it) and this process's stdout and stderr; the run directories beside the runner
|
|
82
|
+
* snapshot cache; the live view on this process's stderr; the job summary `GITHUB_STEP_SUMMARY` names, if any;
|
|
83
|
+
* `vitest` found in `node_modules/.bin` and spawned as a real process; the system timer and clock; and each resource's own live gateways, which its folder builds from `env`. When `env` names
|
|
84
|
+
* no place for the state directory, every runner snapshot cache operation fails and says why, which a run treats as an
|
|
85
|
+
* empty cache, and so does opening a run directory, which a run goes on without.
|
|
86
|
+
*/
|
|
87
|
+
export declare function liveContext(options: {
|
|
88
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
89
|
+
}): StormContext;
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// The composition layer's wiring: the one place storm's live gateways are built. Each resource builds its own
|
|
2
|
+
// (`liveResourceGateways`, through the registry), so this file names no resource.
|
|
3
|
+
import { liveConfigGateway } from "./config/index.js";
|
|
4
|
+
import { liveCredentialGateway, liveGitHubActionsTokenGateway, } from "./credential/index.js";
|
|
5
|
+
import { liveResourceGateways } from "./resources.js";
|
|
6
|
+
import { liveCommandGateway, liveJobSummaryGateway, liveProgressTerminal, liveRunDirectoryGateway, resolveStateDirectory, RUNS_SUBPATH, stateDirectoryPattern, unavailableRunDirectoryGateway, } from "./core/index.js";
|
|
7
|
+
import { liveCheckoutGateway, liveRunnerSandboxGateway, liveRunnerSnapshotCacheGateway, liveRunnerTerminal, RUNNER_SNAPSHOTS_SUBPATH, unavailableRunnerSnapshotCacheGateway, } from "./runner/index.js";
|
|
8
|
+
import { systemClock, systemTimer } from "./time/index.js";
|
|
9
|
+
import { liveVitestListGateway } from "./vitest/plan.js";
|
|
10
|
+
/**
|
|
11
|
+
* The live Context: `vercel` for credentials, and for `--credential github-actions` GitHub Actions' token request, read
|
|
12
|
+
* from `env`'s `ACTIONS_ID_TOKEN_REQUEST_*` at each request, with a 10-second timeout; a run's command spawned as a
|
|
13
|
+
* real process; `storm.config.ts` imported by Node; for a runner run, git and tar on the local checkout, the
|
|
14
|
+
* runner snapshot cache under `env`'s `XDG_STATE_HOME` or `HOME`, Vercel Sandbox through `@vercel/sandbox` (loaded
|
|
15
|
+
* only when a runner run first calls it) and this process's stdout and stderr; the run directories beside the runner
|
|
16
|
+
* snapshot cache; the live view on this process's stderr; the job summary `GITHUB_STEP_SUMMARY` names, if any;
|
|
17
|
+
* `vitest` found in `node_modules/.bin` and spawned as a real process; the system timer and clock; and each resource's own live gateways, which its folder builds from `env`. When `env` names
|
|
18
|
+
* no place for the state directory, every runner snapshot cache operation fails and says why, which a run treats as an
|
|
19
|
+
* empty cache, and so does opening a run directory, which a run goes on without.
|
|
20
|
+
*/
|
|
21
|
+
export function liveContext(options) {
|
|
22
|
+
const snapshots = resolveStateDirectory(options.env, RUNNER_SNAPSHOTS_SUBPATH);
|
|
23
|
+
const runs = resolveStateDirectory(options.env, RUNS_SUBPATH);
|
|
24
|
+
return {
|
|
25
|
+
...liveResourceGateways({ env: options.env }),
|
|
26
|
+
credentials: liveCredentialGateway(),
|
|
27
|
+
githubActionsTokens: liveGitHubActionsTokenGateway({ env: options.env, timeoutMs: 10_000 }),
|
|
28
|
+
commands: liveCommandGateway(),
|
|
29
|
+
config: liveConfigGateway(),
|
|
30
|
+
checkout: liveCheckoutGateway(),
|
|
31
|
+
runnerSnapshots: snapshots.ok
|
|
32
|
+
? liveRunnerSnapshotCacheGateway({ directory: snapshots.directory })
|
|
33
|
+
: unavailableRunnerSnapshotCacheGateway(stateDirectoryPattern(RUNNER_SNAPSHOTS_SUBPATH), snapshots.reason),
|
|
34
|
+
runnerSandboxes: liveRunnerSandboxGateway(),
|
|
35
|
+
runnerTerminal: liveRunnerTerminal({ env: options.env }),
|
|
36
|
+
runDirectories: runs.ok
|
|
37
|
+
? liveRunDirectoryGateway({ directory: runs.directory })
|
|
38
|
+
: unavailableRunDirectoryGateway(stateDirectoryPattern(RUNS_SUBPATH), runs.reason),
|
|
39
|
+
progressTerminal: liveProgressTerminal(),
|
|
40
|
+
jobSummary: liveJobSummaryGateway({ path: options.env["GITHUB_STEP_SUMMARY"] }),
|
|
41
|
+
vitestList: liveVitestListGateway,
|
|
42
|
+
timer: systemTimer,
|
|
43
|
+
clock: systemClock,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { CommandError, DataErrorDefinition, Refusable, Row, SharedError, Warning } from "@vercel/clinkr";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import type { ResourceKind } from "./resource.ts";
|
|
4
|
+
/** Any named error a resource's command half defines, whatever its facts. */
|
|
5
|
+
export type AnyResourceError = SharedError<string, never[]>;
|
|
6
|
+
/**
|
|
7
|
+
* What settling a resource works from: its resolved options, the host's environment, and the config file that
|
|
8
|
+
* applied, which its errors name; null when none did.
|
|
9
|
+
*/
|
|
10
|
+
export interface ResourceSettleInput<Kind extends ResourceKind> {
|
|
11
|
+
readonly options: Kind["options"];
|
|
12
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
13
|
+
readonly configFile: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* What settling a resource answers: the secrets the run hides as `<token>` in what it prints and writes, such as a
|
|
17
|
+
* token the resource hands its command, and its part of the run request, the same in either kind of run. The run, not
|
|
18
|
+
* the resource, holds the credential choice: it settles one when some resource takes it
|
|
19
|
+
* (`CommandProvider.takesCredential`), and the core hands each resource the source it names.
|
|
20
|
+
*/
|
|
21
|
+
export interface ResourceSettlement<Kind extends ResourceKind> {
|
|
22
|
+
readonly secrets: readonly string[];
|
|
23
|
+
readonly request: Kind["request"];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* One resource's cleanup as outcomes report it, under `cleanup.resources.<name>`, and as the progress cleanup line
|
|
27
|
+
* counts it. `Cleanup` is what its release answers; `Facts` is what `schema` holds, as both its input and its output:
|
|
28
|
+
* its kind's `cleanup` and `cleanupFacts`.
|
|
29
|
+
*/
|
|
30
|
+
export interface ResourceCleanupReport<Cleanup, Facts> {
|
|
31
|
+
readonly schema: z.ZodType<Facts, Facts>;
|
|
32
|
+
/** The run's cleanup of this resource, as outcomes report it. */
|
|
33
|
+
facts(cleanup: Cleanup): Facts;
|
|
34
|
+
/** The rows an error lists for what the cleanup couldn't do; none when it did everything. */
|
|
35
|
+
rows(facts: Facts): readonly Row[];
|
|
36
|
+
/** The warnings a ran outcome gives for what the cleanup couldn't do. */
|
|
37
|
+
warnings(facts: Facts): readonly Warning[];
|
|
38
|
+
/** The progress cleanup line's words for `failures` things the cleanup couldn't do, such as `2 leases not released`. */
|
|
39
|
+
failuresText(failures: number): string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* What a `ran` outcome reports of one acquired resource, under `resources.<name>`: `schema` holds its kind's
|
|
43
|
+
* `ranFacts`, as both its input and its output; `facts` makes them from its facts and its request; `warnings` are the
|
|
44
|
+
* warnings a ran outcome gives for what acquiring it couldn't do; `rows` are the rows `storm runs show` lists for
|
|
45
|
+
* it, from the ran facts the run directory's `run.json` keeps: what the run used, and where to look at it.
|
|
46
|
+
*/
|
|
47
|
+
export interface ResourceRanReport<Kind extends ResourceKind> {
|
|
48
|
+
readonly schema: z.ZodType<Kind["ranFacts"], Kind["ranFacts"]>;
|
|
49
|
+
facts(facts: Kind["facts"], request: Kind["request"]): Kind["ranFacts"];
|
|
50
|
+
warnings(ran: Kind["ranFacts"]): readonly Warning[];
|
|
51
|
+
rows(ran: Kind["ranFacts"]): readonly Row[];
|
|
52
|
+
}
|
|
53
|
+
/** Named errors a resource's command half defines, by key. */
|
|
54
|
+
export interface ResourceErrors {
|
|
55
|
+
readonly [key: string]: AnyResourceError;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Any one refusal error's definition, whatever its data: what `defineRefusals` makes, with a schema, so the host can
|
|
59
|
+
* add the run's cleanup beside its data. `render` is a method, so a definition whose `render` takes its own schema's
|
|
60
|
+
* data fits: a method's parameter is checked both ways. The host calls it only with data its schema parsed.
|
|
61
|
+
*/
|
|
62
|
+
export type RefusalDefinition = Omit<DataErrorDefinition, "render"> & {
|
|
63
|
+
render(data: Readonly<Record<string, unknown>>): ReturnType<DataErrorDefinition["render"]>;
|
|
64
|
+
};
|
|
65
|
+
/** A resource's refusal errors, as definitions, by key. */
|
|
66
|
+
export interface RefusalDefinitions {
|
|
67
|
+
readonly [key: string]: RefusalDefinition;
|
|
68
|
+
}
|
|
69
|
+
/** The schema refusal definition `D` declares. */
|
|
70
|
+
export type RefusalSchemaOf<D> = D extends {
|
|
71
|
+
readonly schema: infer Schema extends z.ZodObject;
|
|
72
|
+
} ? Schema : never;
|
|
73
|
+
/**
|
|
74
|
+
* What a refusal ends a run with, of refusal definitions `R`: the key of one of them, and its data, without the run's
|
|
75
|
+
* cleanup, which the host adds. One union member per key, so `key` narrows `data`.
|
|
76
|
+
*/
|
|
77
|
+
export type RefusalFactOf<R> = {
|
|
78
|
+
readonly [Key in keyof R & string]: {
|
|
79
|
+
readonly key: Key;
|
|
80
|
+
readonly data: z.input<RefusalSchemaOf<R[Key]>>;
|
|
81
|
+
};
|
|
82
|
+
}[keyof R & string];
|
|
83
|
+
/** Any resource's refusal fact, whatever its definitions: what the host builds a refusal error from. */
|
|
84
|
+
export type RefusalFact = RefusalFactOf<RefusalDefinitions>;
|
|
85
|
+
/**
|
|
86
|
+
* A resource's refusal errors as definitions, each with a schema: `defineErrors`' input, which types each `render` by
|
|
87
|
+
* its schema. The host defines them, with the run's cleanup beside each one's data.
|
|
88
|
+
*/
|
|
89
|
+
export declare function defineRefusals<const Schemas extends Readonly<Record<string, z.ZodObject>>>(definitions: {
|
|
90
|
+
readonly [Key in keyof Schemas]: DataErrorDefinition<Schemas[Key]>;
|
|
91
|
+
}): {
|
|
92
|
+
readonly [Key in keyof Schemas]: DataErrorDefinition<Schemas[Key]>;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* The error a run ends with when a resource's prepare refused it, of kind `Kind`: none for a kind whose prepare never
|
|
96
|
+
* refuses (`prepareRefusal` is `never`), required for every other.
|
|
97
|
+
*/
|
|
98
|
+
export type UnpreparedErrorOf<Kind extends ResourceKind> = [Kind["prepareRefusal"]] extends [never] ? undefined : (refusal: Kind["prepareRefusal"]) => CommandError<Kind["reason"]>;
|
|
99
|
+
/**
|
|
100
|
+
* The command half of one resource, of kind `Kind`, whose refusal errors are `Refusals`. Every error a run ends with
|
|
101
|
+
* for it is one of `errors` or `refusalErrors`, which `exec` and `vitest` list, and its reason is one of the kind's
|
|
102
|
+
* (`Kind["reason"]`), which the run's own outcomes check both ways. It knows nothing of the run's cleanup: the host
|
|
103
|
+
* defines each refusal error with the run's cleanup beside its data.
|
|
104
|
+
*
|
|
105
|
+
* - `errors`: the errors that end a run before it holds anything: its settle's and its prepare's.
|
|
106
|
+
* - `refusalErrors`: the definitions of the errors its acquire's refusals end a run with (`defineRefusals`). The host
|
|
107
|
+
* defines each with the run's cleanup beside its data, and builds the one a refusal names.
|
|
108
|
+
* - `settle`: before the run starts, its resolved options and the host's environment as its part of the run request
|
|
109
|
+
* and its secrets (`ResourceSettlement`), or the error that refuses the run, such as a token missing from the host.
|
|
110
|
+
* - `takesCredential`: whether, with these options, it needs the run's credential: in a local run, the credential
|
|
111
|
+
* source `--credential` names.
|
|
112
|
+
* - `refusalFacts`: which of `refusalErrors` a run its acquire refused ends with, and its data.
|
|
113
|
+
* - `unpreparedError`: the error, one of `errors`, a run its prepare refused ends with; none for a kind whose prepare
|
|
114
|
+
* never refuses.
|
|
115
|
+
* - `canceledLines`: what a canceled run says it changed in this resource, from its canceled facts and its cleanup;
|
|
116
|
+
* each is undefined when the run didn't hold it.
|
|
117
|
+
*/
|
|
118
|
+
export interface CommandProvider<Kind extends ResourceKind, Refusals extends RefusalDefinitions = RefusalDefinitions> {
|
|
119
|
+
readonly errors: ResourceErrors;
|
|
120
|
+
readonly refusalErrors: Refusals;
|
|
121
|
+
settle(input: ResourceSettleInput<Kind>): Refusable<ResourceSettlement<Kind>, CommandError<Kind["reason"]>>;
|
|
122
|
+
takesCredential(options: Kind["options"]): boolean;
|
|
123
|
+
refusalFacts(refusal: Kind["refusal"]): RefusalFactOf<Refusals>;
|
|
124
|
+
readonly unpreparedError: UnpreparedErrorOf<Kind>;
|
|
125
|
+
canceledLines(facts: Kind["canceledFacts"] | undefined, cleanup: Kind["cleanup"] | undefined): readonly string[];
|
|
126
|
+
}
|