@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,33 @@
|
|
|
1
|
+
import { type RunnerContext } from "./context.ts";
|
|
2
|
+
import type { RunnerProgress, RunnerStage } from "./events.ts";
|
|
3
|
+
import type { RunnerSnapshotEntry, SandboxAccess } from "./gateways.ts";
|
|
4
|
+
import type { PreparedRunner } from "./prepare.ts";
|
|
5
|
+
import type { RunnerSandboxScope } from "./scope.ts";
|
|
6
|
+
/** How long a build sandbox may live: 30 minutes. */
|
|
7
|
+
export declare const BUILD_SANDBOX_TIMEOUT_MS: number;
|
|
8
|
+
/** The label of the step between the toolchain and warm steps that commits the base's files. */
|
|
9
|
+
export declare const BASE_INDEX_LABEL = "Committing the base's files";
|
|
10
|
+
/** A runner snapshot a run built and the cache entry recorded for it. */
|
|
11
|
+
export interface BuiltSnapshot {
|
|
12
|
+
readonly entry: RunnerSnapshotEntry;
|
|
13
|
+
/** How long the build took, from its start to the cache entry. */
|
|
14
|
+
readonly ms: number;
|
|
15
|
+
readonly sizeBytes: number;
|
|
16
|
+
}
|
|
17
|
+
/** What a snapshot build needs to know: the prepared run, who it runs as, and why it builds. */
|
|
18
|
+
export interface BuildSnapshotRequest {
|
|
19
|
+
readonly prepared: PreparedRunner;
|
|
20
|
+
readonly access: SandboxAccess;
|
|
21
|
+
/** The local user, for the sandbox's `user` tag. */
|
|
22
|
+
readonly user: string;
|
|
23
|
+
readonly reason: "no-snapshot" | "rebuild";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Builds a runner snapshot of `prepared.base`. The build sandbox starts while the base's files are packed, and is
|
|
27
|
+
* deleted once saved; a build that fails leaves it to the scope to stop and delete. A cache entry that can't be
|
|
28
|
+
* written is reported, and the build still succeeds.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildSnapshot(context: Pick<RunnerContext, "checkout" | "runnerSnapshots" | "runnerSandboxes" | "clock">, request: BuildSnapshotRequest, control: {
|
|
31
|
+
readonly scope: RunnerSandboxScope;
|
|
32
|
+
readonly signal: AbortSignal;
|
|
33
|
+
}, progress: RunnerProgress): Promise<RunnerStage<BuiltSnapshot>>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Building a runner snapshot of a run's base: a build sandbox runs the toolchain steps, commits exactly the base's
|
|
2
|
+
// tracked files, runs the warm steps, and is saved as a snapshot, which the cache then records.
|
|
3
|
+
import { runnerTags } from "./context.js";
|
|
4
|
+
import { SNAPSHOT_EXPIRATION_MS } from "./snapshot-cache.js";
|
|
5
|
+
import { baseIndexScript, STAGED_FILES } from "./snapshot-key.js";
|
|
6
|
+
import { runStep, sandboxStop } from "./steps.js";
|
|
7
|
+
/** How long a build sandbox may live: 30 minutes. */
|
|
8
|
+
export const BUILD_SANDBOX_TIMEOUT_MS = 30 * 60_000;
|
|
9
|
+
/** The label of the step between the toolchain and warm steps that commits the base's files. */
|
|
10
|
+
export const BASE_INDEX_LABEL = "Committing the base's files";
|
|
11
|
+
/**
|
|
12
|
+
* Builds a runner snapshot of `prepared.base`. The build sandbox starts while the base's files are packed, and is
|
|
13
|
+
* deleted once saved; a build that fails leaves it to the scope to stop and delete. A cache entry that can't be
|
|
14
|
+
* written is reported, and the build still succeeds.
|
|
15
|
+
*/
|
|
16
|
+
export async function buildSnapshot(context, request, control, progress) {
|
|
17
|
+
const { prepared, access } = request;
|
|
18
|
+
const { recipe, repoRoot, base } = prepared;
|
|
19
|
+
const { scope, signal } = control;
|
|
20
|
+
const now = () => context.clock.now().getTime();
|
|
21
|
+
const startedAt = now();
|
|
22
|
+
await progress.emit({
|
|
23
|
+
kind: "snapshot-build-started",
|
|
24
|
+
base,
|
|
25
|
+
reason: request.reason,
|
|
26
|
+
summary: recipe.snapshot.summary ?? [...prepared.toolchains, ...prepared.warm].map(({ label }) => label).join(", "),
|
|
27
|
+
});
|
|
28
|
+
const [started, archive] = await Promise.all([
|
|
29
|
+
scope.startBuildSandbox(access, {
|
|
30
|
+
region: recipe.region,
|
|
31
|
+
runtime: recipe.runtime,
|
|
32
|
+
vcpus: recipe.snapshot.vcpus,
|
|
33
|
+
timeoutMs: BUILD_SANDBOX_TIMEOUT_MS,
|
|
34
|
+
tags: runnerTags(recipe.name, "snapshot-build", request.user),
|
|
35
|
+
}),
|
|
36
|
+
context.checkout.baseArchive({ repoRoot, base }),
|
|
37
|
+
]);
|
|
38
|
+
if (!started.ok)
|
|
39
|
+
return sandboxStop("start-build-sandbox", started.failure);
|
|
40
|
+
const sandbox = started.value;
|
|
41
|
+
await progress.emit({
|
|
42
|
+
kind: "sandbox-started",
|
|
43
|
+
role: "snapshot-build",
|
|
44
|
+
name: sandbox.name,
|
|
45
|
+
region: recipe.region,
|
|
46
|
+
vcpus: recipe.snapshot.vcpus,
|
|
47
|
+
ms: now() - startedAt,
|
|
48
|
+
});
|
|
49
|
+
if (!archive.ok)
|
|
50
|
+
return { kind: "failed", failure: { kind: "checkout-failed", failure: archive.failure } };
|
|
51
|
+
const staged = await context.runnerSandboxes.upload(sandbox, [
|
|
52
|
+
{ name: STAGED_FILES.baseTarball, content: archive.value.tarball },
|
|
53
|
+
{ name: STAGED_FILES.baseFileList, content: archive.value.fileList },
|
|
54
|
+
], signal);
|
|
55
|
+
if (!staged.ok)
|
|
56
|
+
return sandboxStop("upload", staged.failure);
|
|
57
|
+
const steps = [
|
|
58
|
+
...prepared.toolchains,
|
|
59
|
+
{ label: BASE_INDEX_LABEL, script: baseIndexScript(base, staged.value.directory) },
|
|
60
|
+
...prepared.warm,
|
|
61
|
+
];
|
|
62
|
+
await progress.emit({ kind: "output-started", section: "snapshot", sandbox: sandbox.name, region: recipe.region });
|
|
63
|
+
for (const step of steps) {
|
|
64
|
+
const ran = await runStep(context, { sandbox, phase: "snapshot", ...step }, progress, signal);
|
|
65
|
+
if (ran.kind === "succeeded")
|
|
66
|
+
continue;
|
|
67
|
+
const stop = ran.kind === "exited"
|
|
68
|
+
? {
|
|
69
|
+
kind: "failed",
|
|
70
|
+
failure: { kind: "snapshot-build-step-failed", label: step.label, exitCode: ran.exitCode, tail: ran.tail },
|
|
71
|
+
}
|
|
72
|
+
: sandboxStop("run-script", ran.failure);
|
|
73
|
+
await progress.emit({
|
|
74
|
+
kind: "output-ended",
|
|
75
|
+
section: "snapshot",
|
|
76
|
+
outcome: stop.kind === "aborted" ? "stopped" : "failed",
|
|
77
|
+
});
|
|
78
|
+
return stop;
|
|
79
|
+
}
|
|
80
|
+
await progress.emit({ kind: "output-ended", section: "snapshot", outcome: "finished" });
|
|
81
|
+
if (signal.aborted)
|
|
82
|
+
return { kind: "aborted" };
|
|
83
|
+
await progress.emit({ kind: "snapshot-saving" });
|
|
84
|
+
const saved = await scope.saveSnapshot(sandbox, { expirationMs: SNAPSHOT_EXPIRATION_MS });
|
|
85
|
+
if (!saved.ok)
|
|
86
|
+
return sandboxStop("save-snapshot", saved.failure);
|
|
87
|
+
const savedAt = context.clock.now();
|
|
88
|
+
const entry = {
|
|
89
|
+
teamId: access.teamId,
|
|
90
|
+
projectId: access.projectId,
|
|
91
|
+
region: recipe.region,
|
|
92
|
+
runtime: recipe.runtime,
|
|
93
|
+
recipeName: recipe.name,
|
|
94
|
+
snapshotKey: prepared.snapshotKey,
|
|
95
|
+
base,
|
|
96
|
+
snapshotId: saved.value.snapshotId,
|
|
97
|
+
createdAt: savedAt.toISOString(),
|
|
98
|
+
expiresAt: saved.value.expiresAt ?? new Date(savedAt.getTime() + SNAPSHOT_EXPIRATION_MS).toISOString(),
|
|
99
|
+
};
|
|
100
|
+
const written = await context.runnerSnapshots.writeEntry(entry);
|
|
101
|
+
if (!written.ok)
|
|
102
|
+
await progress.emit({ kind: "snapshot-entry-not-written", failure: written.failure });
|
|
103
|
+
const ms = now() - startedAt;
|
|
104
|
+
await progress.emit({
|
|
105
|
+
kind: "snapshot-built",
|
|
106
|
+
snapshotId: entry.snapshotId,
|
|
107
|
+
base,
|
|
108
|
+
ms,
|
|
109
|
+
sizeBytes: saved.value.sizeBytes,
|
|
110
|
+
});
|
|
111
|
+
return { kind: "ok", value: { entry, ms, sizeBytes: saved.value.sizeBytes } };
|
|
112
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Clock } from "../time/index.ts";
|
|
2
|
+
import type { CheckoutFailure, CheckoutGateway, RunnerSnapshotCacheFailure, RunnerSnapshotCacheGateway, RunnerSnapshotEntry } from "./gateways.ts";
|
|
3
|
+
import type { CheckedRecipe } from "./recipe.ts";
|
|
4
|
+
/** The subpath of storm's state directory that holds the runner snapshot cache. */
|
|
5
|
+
export declare const RUNNER_SNAPSHOTS_SUBPATH: readonly string[];
|
|
6
|
+
/** How long a runner snapshot lives after it is built: 7 days. The Sandbox API needs 0 or at least a day. */
|
|
7
|
+
export declare const SNAPSHOT_EXPIRATION_MS: number;
|
|
8
|
+
/** A run never picks a runner snapshot with this little left or less, 1 hour, so it can't expire before the start. */
|
|
9
|
+
export declare const SNAPSHOT_MIN_REMAINING_MS: number;
|
|
10
|
+
/**
|
|
11
|
+
* An entry's identity: the first 32 hex characters of sha256 over its team id, project id, region, runtime, recipe
|
|
12
|
+
* name, snapshot key and base, joined with NUL. Entries with one identity replace each other.
|
|
13
|
+
*/
|
|
14
|
+
export declare function snapshotEntryIdentity(entry: RunnerSnapshotEntry): string;
|
|
15
|
+
/** The name of the file that records `entry`: its identity and `.json`. */
|
|
16
|
+
export declare function snapshotEntryFileName(entry: RunnerSnapshotEntry): string;
|
|
17
|
+
/** Whether `entry`'s snapshot has expired at `now`. */
|
|
18
|
+
export declare function isExpiredEntry(entry: RunnerSnapshotEntry, now: Date): boolean;
|
|
19
|
+
/** Whether `entry`'s snapshot has more than `SNAPSHOT_MIN_REMAINING_MS` left at `now`. */
|
|
20
|
+
export declare function hasTimeLeft(entry: RunnerSnapshotEntry, now: Date): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* A cache entry a run may start from, before the team and project are known: its base's commit time, and the other
|
|
23
|
+
* candidates' bases that are ancestors of its base.
|
|
24
|
+
*/
|
|
25
|
+
export interface RunnerSnapshotCandidate {
|
|
26
|
+
readonly entry: RunnerSnapshotEntry;
|
|
27
|
+
/** When the base was committed, in milliseconds since the epoch. */
|
|
28
|
+
readonly commitTime: number;
|
|
29
|
+
/** The other candidates' bases that are strict ancestors of this one's. */
|
|
30
|
+
readonly ancestorBases: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Something the cache read noticed that the run reports and goes on from.
|
|
34
|
+
*
|
|
35
|
+
* - `cache-unreadable`: the cache couldn't be listed, so the run treats it as empty.
|
|
36
|
+
* - `expired-entry-not-removed`: an expired entry's file couldn't be removed.
|
|
37
|
+
* - `candidate-steps-failed`: a step function failed at a candidate's base, which disqualifies only that candidate.
|
|
38
|
+
* - `candidate-check-failed`: git couldn't check a candidate's base, which disqualifies it.
|
|
39
|
+
*/
|
|
40
|
+
export type SnapshotCacheNote = {
|
|
41
|
+
readonly kind: "cache-unreadable";
|
|
42
|
+
readonly failure: RunnerSnapshotCacheFailure;
|
|
43
|
+
} | {
|
|
44
|
+
readonly kind: "expired-entry-not-removed";
|
|
45
|
+
readonly entry: RunnerSnapshotEntry;
|
|
46
|
+
readonly failure: RunnerSnapshotCacheFailure;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: "candidate-steps-failed";
|
|
49
|
+
readonly base: string;
|
|
50
|
+
readonly path: readonly string[];
|
|
51
|
+
readonly problem: string;
|
|
52
|
+
} | {
|
|
53
|
+
readonly kind: "candidate-check-failed";
|
|
54
|
+
readonly base: string;
|
|
55
|
+
readonly failure: CheckoutFailure;
|
|
56
|
+
};
|
|
57
|
+
/** What the cache context needs: the checkout, the cache and the clock. */
|
|
58
|
+
export interface SnapshotCacheContext {
|
|
59
|
+
readonly checkout: CheckoutGateway;
|
|
60
|
+
readonly runnerSnapshots: RunnerSnapshotCacheGateway;
|
|
61
|
+
readonly clock: Clock;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Reads the cache for the runner snapshots a run of `recipe` may start from. It removes expired entries' files, and
|
|
65
|
+
* keeps the entries for the recipe's region, runtime and name with more than an hour left, whose base HEAD contains
|
|
66
|
+
* (a base missing from the clone doesn't), and whose snapshot key, recomputed at that entry's base, is the one
|
|
67
|
+
* recorded. A failure along the way is a note, never a refusal.
|
|
68
|
+
*/
|
|
69
|
+
export declare function findSnapshotCandidates(context: SnapshotCacheContext, request: {
|
|
70
|
+
readonly repoRoot: string;
|
|
71
|
+
readonly recipe: Pick<CheckedRecipe, "name" | "region" | "runtime" | "snapshot">;
|
|
72
|
+
}): Promise<{
|
|
73
|
+
readonly candidates: readonly RunnerSnapshotCandidate[];
|
|
74
|
+
readonly notes: readonly SnapshotCacheNote[];
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Picks the runner snapshot a run starts from, once the credential names its team and project: of the candidates
|
|
78
|
+
* for them, the one whose base is nearest HEAD, the one every other candidate's base is an ancestor of; when bases
|
|
79
|
+
* are on separate lines of history, the newest commit. `undefined` when none is for them.
|
|
80
|
+
*/
|
|
81
|
+
export declare function pickSnapshot(candidates: readonly RunnerSnapshotCandidate[], owner: {
|
|
82
|
+
readonly teamId: string;
|
|
83
|
+
readonly projectId: string;
|
|
84
|
+
}): RunnerSnapshotCandidate | undefined;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Which runner snapshots in the per-machine cache a run may start from, and which one it picks. The cache's
|
|
2
|
+
// files are the gateway's; their identity, expiry and the choice among them are here.
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { snapshotStepsAt } from "./snapshot-key.js";
|
|
5
|
+
/** The subpath of storm's state directory that holds the runner snapshot cache. */
|
|
6
|
+
export const RUNNER_SNAPSHOTS_SUBPATH = ["runner", "snapshots"];
|
|
7
|
+
/** How long a runner snapshot lives after it is built: 7 days. The Sandbox API needs 0 or at least a day. */
|
|
8
|
+
export const SNAPSHOT_EXPIRATION_MS = 7 * 24 * 60 * 60 * 1000;
|
|
9
|
+
/** A run never picks a runner snapshot with this little left or less, 1 hour, so it can't expire before the start. */
|
|
10
|
+
export const SNAPSHOT_MIN_REMAINING_MS = 60 * 60 * 1000;
|
|
11
|
+
/**
|
|
12
|
+
* An entry's identity: the first 32 hex characters of sha256 over its team id, project id, region, runtime, recipe
|
|
13
|
+
* name, snapshot key and base, joined with NUL. Entries with one identity replace each other.
|
|
14
|
+
*/
|
|
15
|
+
export function snapshotEntryIdentity(entry) {
|
|
16
|
+
return createHash("sha256")
|
|
17
|
+
.update([
|
|
18
|
+
entry.teamId,
|
|
19
|
+
entry.projectId,
|
|
20
|
+
entry.region,
|
|
21
|
+
entry.runtime,
|
|
22
|
+
entry.recipeName,
|
|
23
|
+
entry.snapshotKey,
|
|
24
|
+
entry.base,
|
|
25
|
+
].join("\0"))
|
|
26
|
+
.digest("hex")
|
|
27
|
+
.slice(0, 32);
|
|
28
|
+
}
|
|
29
|
+
/** The name of the file that records `entry`: its identity and `.json`. */
|
|
30
|
+
export function snapshotEntryFileName(entry) {
|
|
31
|
+
return `${snapshotEntryIdentity(entry)}.json`;
|
|
32
|
+
}
|
|
33
|
+
/** Whether `entry`'s snapshot has expired at `now`. */
|
|
34
|
+
export function isExpiredEntry(entry, now) {
|
|
35
|
+
return Date.parse(entry.expiresAt) <= now.getTime();
|
|
36
|
+
}
|
|
37
|
+
/** Whether `entry`'s snapshot has more than `SNAPSHOT_MIN_REMAINING_MS` left at `now`. */
|
|
38
|
+
export function hasTimeLeft(entry, now) {
|
|
39
|
+
return Date.parse(entry.expiresAt) - now.getTime() > SNAPSHOT_MIN_REMAINING_MS;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Reads the cache for the runner snapshots a run of `recipe` may start from. It removes expired entries' files, and
|
|
43
|
+
* keeps the entries for the recipe's region, runtime and name with more than an hour left, whose base HEAD contains
|
|
44
|
+
* (a base missing from the clone doesn't), and whose snapshot key, recomputed at that entry's base, is the one
|
|
45
|
+
* recorded. A failure along the way is a note, never a refusal.
|
|
46
|
+
*/
|
|
47
|
+
export async function findSnapshotCandidates(context, request) {
|
|
48
|
+
const { checkout, runnerSnapshots } = context;
|
|
49
|
+
const { repoRoot, recipe } = request;
|
|
50
|
+
const notes = [];
|
|
51
|
+
const listed = await runnerSnapshots.listEntries();
|
|
52
|
+
if (!listed.ok)
|
|
53
|
+
return { candidates: [], notes: [{ kind: "cache-unreadable", failure: listed.failure }] };
|
|
54
|
+
const now = context.clock.now();
|
|
55
|
+
const live = [];
|
|
56
|
+
for (const entry of listed.value.entries) {
|
|
57
|
+
if (isExpiredEntry(entry, now)) {
|
|
58
|
+
const removed = await runnerSnapshots.removeEntry(entry);
|
|
59
|
+
if (!removed.ok)
|
|
60
|
+
notes.push({ kind: "expired-entry-not-removed", entry, failure: removed.failure });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (entry.region === recipe.region &&
|
|
64
|
+
entry.runtime === recipe.runtime &&
|
|
65
|
+
entry.recipeName === recipe.name &&
|
|
66
|
+
hasTimeLeft(entry, now))
|
|
67
|
+
live.push(entry);
|
|
68
|
+
}
|
|
69
|
+
// Each base is checked once, whichever teams and projects its entries are for.
|
|
70
|
+
const keysByBase = new Map();
|
|
71
|
+
for (const base of new Set(live.map((entry) => entry.base))) {
|
|
72
|
+
const contained = await checkout.contains({ repoRoot, ancestor: base, descendant: "HEAD" });
|
|
73
|
+
if (!contained.ok) {
|
|
74
|
+
notes.push({ kind: "candidate-check-failed", base, failure: contained.failure });
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (!contained.value)
|
|
78
|
+
continue;
|
|
79
|
+
const steps = await snapshotStepsAt(checkout, { repoRoot, base, recipe });
|
|
80
|
+
if (!steps.ok) {
|
|
81
|
+
notes.push({ kind: "candidate-steps-failed", base, path: steps.path, problem: steps.problem });
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
keysByBase.set(base, steps.key);
|
|
85
|
+
}
|
|
86
|
+
const matching = live.filter((entry) => keysByBase.get(entry.base) === entry.snapshotKey);
|
|
87
|
+
const commitTimes = new Map();
|
|
88
|
+
for (const base of new Set(matching.map((entry) => entry.base))) {
|
|
89
|
+
const time = await checkout.commitTime({ repoRoot, commit: base });
|
|
90
|
+
if (time.ok)
|
|
91
|
+
commitTimes.set(base, time.value);
|
|
92
|
+
else
|
|
93
|
+
notes.push({ kind: "candidate-check-failed", base, failure: time.failure });
|
|
94
|
+
}
|
|
95
|
+
const bases = [...commitTimes.keys()];
|
|
96
|
+
const ancestors = new Map(bases.map((base) => [base, []]));
|
|
97
|
+
for (const ancestor of bases)
|
|
98
|
+
for (const descendant of bases) {
|
|
99
|
+
if (ancestor === descendant)
|
|
100
|
+
continue;
|
|
101
|
+
const contained = await checkout.contains({ repoRoot, ancestor, descendant });
|
|
102
|
+
if (!contained.ok)
|
|
103
|
+
notes.push({ kind: "candidate-check-failed", base: ancestor, failure: contained.failure });
|
|
104
|
+
else if (contained.value)
|
|
105
|
+
ancestors.get(descendant)?.push(ancestor);
|
|
106
|
+
}
|
|
107
|
+
const candidates = matching.flatMap((entry) => {
|
|
108
|
+
const commitTime = commitTimes.get(entry.base);
|
|
109
|
+
return commitTime === undefined
|
|
110
|
+
? []
|
|
111
|
+
: [{ entry, commitTime, ancestorBases: [...(ancestors.get(entry.base) ?? [])] }];
|
|
112
|
+
});
|
|
113
|
+
return { candidates, notes };
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Picks the runner snapshot a run starts from, once the credential names its team and project: of the candidates
|
|
117
|
+
* for them, the one whose base is nearest HEAD, the one every other candidate's base is an ancestor of; when bases
|
|
118
|
+
* are on separate lines of history, the newest commit. `undefined` when none is for them.
|
|
119
|
+
*/
|
|
120
|
+
export function pickSnapshot(candidates, owner) {
|
|
121
|
+
const owned = candidates
|
|
122
|
+
.filter(({ entry }) => entry.teamId === owner.teamId && entry.projectId === owner.projectId)
|
|
123
|
+
.toSorted((a, b) => b.commitTime - a.commitTime || Date.parse(b.entry.expiresAt) - Date.parse(a.entry.expiresAt));
|
|
124
|
+
const nearest = owned.find((candidate) => owned.every((other) => other.entry.base === candidate.entry.base || candidate.ancestorBases.includes(other.entry.base)));
|
|
125
|
+
return nearest ?? owned[0];
|
|
126
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CheckoutGateway } from "./gateways.ts";
|
|
2
|
+
import { type RunnerRecipe, type RunnerStep } from "./recipe.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Bump when a runner snapshot changes in a way its steps' text doesn't show (the scripts between the steps, what is
|
|
5
|
+
* uploaded, the build sandbox), so earlier snapshots stop matching.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SNAPSHOT_FORMAT = 1;
|
|
8
|
+
/** Where the repository lives in every runner and build sandbox. */
|
|
9
|
+
export declare const REMOTE_ROOT = "/vercel/sandbox";
|
|
10
|
+
/** The names of the files uploaded to a sandbox's staging directory. */
|
|
11
|
+
export declare const STAGED_FILES: {
|
|
12
|
+
readonly baseTarball: "base.tgz";
|
|
13
|
+
readonly baseFileList: "base-files";
|
|
14
|
+
readonly patch: "run.patch";
|
|
15
|
+
readonly untrackedTarball: "untracked.tgz";
|
|
16
|
+
readonly untrackedFileList: "untracked-files";
|
|
17
|
+
};
|
|
18
|
+
/** A bash script that stops at the first failure and runs in the repository's root. */
|
|
19
|
+
export declare function bashScript(lines: readonly string[]): string;
|
|
20
|
+
/**
|
|
21
|
+
* Extracts the base's files from `<staging>/base.tgz` and commits exactly its tracked files
|
|
22
|
+
* (`<staging>/base-files`), before the warm steps. `git add -A` would drop tracked files `.gitignore` matches.
|
|
23
|
+
*/
|
|
24
|
+
export declare function baseIndexScript(base: string, staging: string): string;
|
|
25
|
+
/** Applies and commits a run's patch and untracked files, uploaded to `staging`, in a runner sandbox. */
|
|
26
|
+
export declare function applyScript(staging: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* The snapshot key: sha256 hex over `format=<SNAPSHOT_FORMAT>`, each toolchain step's label and script, the
|
|
29
|
+
* base-index script with the placeholders `<base>` and `<staging>`, and each warm step's label and script, joined
|
|
30
|
+
* with NUL. The base isn't in the key: a cache entry records it beside the key.
|
|
31
|
+
*/
|
|
32
|
+
export declare function snapshotKey(steps: {
|
|
33
|
+
readonly toolchains: readonly RunnerStep[];
|
|
34
|
+
readonly warm: readonly RunnerStep[];
|
|
35
|
+
}): string;
|
|
36
|
+
/** A recipe's snapshot steps at one base and their key, or the step key whose function failed there and why. */
|
|
37
|
+
export type SnapshotStepsAt = {
|
|
38
|
+
readonly ok: true;
|
|
39
|
+
readonly toolchains: readonly RunnerStep[];
|
|
40
|
+
readonly warm: readonly RunnerStep[];
|
|
41
|
+
readonly key: string;
|
|
42
|
+
} | {
|
|
43
|
+
readonly ok: false;
|
|
44
|
+
readonly path: readonly string[];
|
|
45
|
+
readonly problem: string;
|
|
46
|
+
};
|
|
47
|
+
/** Evaluates `recipe`'s toolchain and warm steps at `base` and computes their snapshot key. */
|
|
48
|
+
export declare function snapshotStepsAt(checkout: CheckoutGateway, request: {
|
|
49
|
+
readonly repoRoot: string;
|
|
50
|
+
readonly base: string;
|
|
51
|
+
readonly recipe: Pick<RunnerRecipe, "snapshot">;
|
|
52
|
+
}): Promise<SnapshotStepsAt>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// What a runner snapshot is built from, and the scripts that commit a base in a build sandbox and a run's changes in
|
|
2
|
+
// a runner sandbox. The snapshot key hashes the steps' text, so editing a step means a new snapshot.
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { baseStepContext } from "./base.js";
|
|
5
|
+
import { resolveSteps } from "./recipe.js";
|
|
6
|
+
/**
|
|
7
|
+
* Bump when a runner snapshot changes in a way its steps' text doesn't show (the scripts between the steps, what is
|
|
8
|
+
* uploaded, the build sandbox), so earlier snapshots stop matching.
|
|
9
|
+
*/
|
|
10
|
+
export const SNAPSHOT_FORMAT = 1;
|
|
11
|
+
/** Where the repository lives in every runner and build sandbox. */
|
|
12
|
+
export const REMOTE_ROOT = "/vercel/sandbox";
|
|
13
|
+
/** The names of the files uploaded to a sandbox's staging directory. */
|
|
14
|
+
export const STAGED_FILES = {
|
|
15
|
+
baseTarball: "base.tgz",
|
|
16
|
+
baseFileList: "base-files",
|
|
17
|
+
patch: "run.patch",
|
|
18
|
+
untrackedTarball: "untracked.tgz",
|
|
19
|
+
untrackedFileList: "untracked-files",
|
|
20
|
+
};
|
|
21
|
+
/** The identity of the commits the scripts make, with no hook or signing in the way. */
|
|
22
|
+
const GIT_IDENTITY = "-c user.email=storm-runner@vercel.invalid -c user.name='storm runner' -c commit.gpgsign=false";
|
|
23
|
+
/** A bash script that stops at the first failure and runs in the repository's root. */
|
|
24
|
+
export function bashScript(lines) {
|
|
25
|
+
return ["set -euo pipefail", `cd ${REMOTE_ROOT}`, ...lines].join("\n");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Extracts the base's files from `<staging>/base.tgz` and commits exactly its tracked files
|
|
29
|
+
* (`<staging>/base-files`), before the warm steps. `git add -A` would drop tracked files `.gitignore` matches.
|
|
30
|
+
*/
|
|
31
|
+
export function baseIndexScript(base, staging) {
|
|
32
|
+
const tarball = `${staging}/${STAGED_FILES.baseTarball}`;
|
|
33
|
+
const fileList = `${staging}/${STAGED_FILES.baseFileList}`;
|
|
34
|
+
return bashScript([
|
|
35
|
+
`tar --warning=no-unknown-keyword -xzf ${tarball} -C ${REMOTE_ROOT}`,
|
|
36
|
+
`rm -f ${tarball}`,
|
|
37
|
+
"git -c init.defaultBranch=main init -q",
|
|
38
|
+
`git --literal-pathspecs add -f --pathspec-from-file=${fileList} --pathspec-file-nul`,
|
|
39
|
+
`rm -f ${fileList}`,
|
|
40
|
+
`git ${GIT_IDENTITY} commit -q --no-verify -m 'base ${base}'`,
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
/** Applies and commits a run's patch and untracked files, uploaded to `staging`, in a runner sandbox. */
|
|
44
|
+
export function applyScript(staging) {
|
|
45
|
+
const patch = `${staging}/${STAGED_FILES.patch}`;
|
|
46
|
+
const tarball = `${staging}/${STAGED_FILES.untrackedTarball}`;
|
|
47
|
+
const fileList = `${staging}/${STAGED_FILES.untrackedFileList}`;
|
|
48
|
+
return bashScript([
|
|
49
|
+
// A build may have rewritten tracked files with the same content.
|
|
50
|
+
"git update-index -q --refresh || true",
|
|
51
|
+
`if [ -s ${patch} ]; then git apply --index --binary ${patch}; fi`,
|
|
52
|
+
`if [ -s ${tarball} ]; then`,
|
|
53
|
+
` tar --warning=no-unknown-keyword -xzf ${tarball} -C ${REMOTE_ROOT}`,
|
|
54
|
+
` git --literal-pathspecs add -f --pathspec-from-file=${fileList} --pathspec-file-nul`,
|
|
55
|
+
"fi",
|
|
56
|
+
`git ${GIT_IDENTITY} commit -q --no-verify --allow-empty -m run`,
|
|
57
|
+
`rm -f ${patch} ${tarball} ${fileList}`,
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The snapshot key: sha256 hex over `format=<SNAPSHOT_FORMAT>`, each toolchain step's label and script, the
|
|
62
|
+
* base-index script with the placeholders `<base>` and `<staging>`, and each warm step's label and script, joined
|
|
63
|
+
* with NUL. The base isn't in the key: a cache entry records it beside the key.
|
|
64
|
+
*/
|
|
65
|
+
export function snapshotKey(steps) {
|
|
66
|
+
const text = (list) => list.flatMap(({ label, script }) => [label, script]);
|
|
67
|
+
return createHash("sha256")
|
|
68
|
+
.update([
|
|
69
|
+
`format=${SNAPSHOT_FORMAT}`,
|
|
70
|
+
...text(steps.toolchains),
|
|
71
|
+
baseIndexScript("<base>", "<staging>"),
|
|
72
|
+
...text(steps.warm),
|
|
73
|
+
].join("\0"))
|
|
74
|
+
.digest("hex");
|
|
75
|
+
}
|
|
76
|
+
/** Evaluates `recipe`'s toolchain and warm steps at `base` and computes their snapshot key. */
|
|
77
|
+
export async function snapshotStepsAt(checkout, request) {
|
|
78
|
+
const context = baseStepContext(checkout, request);
|
|
79
|
+
const toolchains = await resolveSteps(request.recipe.snapshot.toolchains, context);
|
|
80
|
+
if (!toolchains.ok)
|
|
81
|
+
return { ok: false, path: ["snapshot", "toolchains"], problem: toolchains.problem };
|
|
82
|
+
const warm = await resolveSteps(request.recipe.snapshot.warm, context);
|
|
83
|
+
if (!warm.ok)
|
|
84
|
+
return { ok: false, path: ["snapshot", "warm"], problem: warm.problem };
|
|
85
|
+
return {
|
|
86
|
+
ok: true,
|
|
87
|
+
toolchains: toolchains.steps,
|
|
88
|
+
warm: warm.steps,
|
|
89
|
+
key: snapshotKey({ toolchains: toolchains.steps, warm: warm.steps }),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Clock } from "../time/index.ts";
|
|
2
|
+
import { type RunnerFailure, type RunnerProgress, type RunnerSandboxCall, type RunnerStage, type RunnerStepPhase } from "./events.ts";
|
|
3
|
+
import type { RunnerSandbox, RunnerSandboxFailure, RunnerSandboxGateway, RunnerStartFailure } from "./gateways.ts";
|
|
4
|
+
/** Every step's environment: no Git hook, prompt or update check gets in the way. */
|
|
5
|
+
export declare const STEP_ENV: Readonly<Record<string, string>>;
|
|
6
|
+
/**
|
|
7
|
+
* How a step ended.
|
|
8
|
+
*
|
|
9
|
+
* - `succeeded`: it exited 0, after `ms`.
|
|
10
|
+
* - `exited`: it exited non-zero, or without an exit code (`exitCode` null); `tail` is its last output lines.
|
|
11
|
+
* - `sandbox-failed`: the Sandbox call failed or was aborted.
|
|
12
|
+
*/
|
|
13
|
+
export type StepOutcome = {
|
|
14
|
+
readonly kind: "succeeded";
|
|
15
|
+
readonly ms: number;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "exited";
|
|
18
|
+
readonly exitCode: number | null;
|
|
19
|
+
readonly tail: readonly string[];
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: "sandbox-failed";
|
|
22
|
+
readonly failure: RunnerSandboxFailure;
|
|
23
|
+
};
|
|
24
|
+
/** Runs `script` in `sandbox` with `STEP_ENV` as a step labeled `label`, reporting it under `phase`. */
|
|
25
|
+
export declare function runStep(context: {
|
|
26
|
+
readonly runnerSandboxes: RunnerSandboxGateway;
|
|
27
|
+
readonly clock: Clock;
|
|
28
|
+
}, request: {
|
|
29
|
+
readonly sandbox: RunnerSandbox;
|
|
30
|
+
readonly phase: RunnerStepPhase;
|
|
31
|
+
readonly label: string;
|
|
32
|
+
readonly script: string;
|
|
33
|
+
}, progress: RunnerProgress, signal: AbortSignal): Promise<StepOutcome>;
|
|
34
|
+
/** A Sandbox failure other than an abort, as the runner reports it. */
|
|
35
|
+
export declare function sandboxApiFailure(operation: RunnerSandboxCall, failure: Exclude<RunnerStartFailure, {
|
|
36
|
+
readonly kind: "aborted";
|
|
37
|
+
}>): RunnerFailure;
|
|
38
|
+
/** How a stage ends on a failed Sandbox call: a stop when the run's signal aborted it, a failure otherwise. */
|
|
39
|
+
export declare function sandboxStop(operation: RunnerSandboxCall, failure: RunnerStartFailure): Exclude<RunnerStage<never>, {
|
|
40
|
+
readonly kind: "ok";
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Running one step in a sandbox: its output streamed line by line to the run's progress, its last lines kept for the
|
|
2
|
+
// error when it fails, and how long it took.
|
|
3
|
+
import { progressQueue, } from "./events.js";
|
|
4
|
+
import { lineSplitter, outputTail, splitLines } from "./output.js";
|
|
5
|
+
/** Every step's environment: no Git hook, prompt or update check gets in the way. */
|
|
6
|
+
export const STEP_ENV = {
|
|
7
|
+
HUSKY: "0",
|
|
8
|
+
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0",
|
|
9
|
+
COREPACK_ENABLE_STRICT: "0",
|
|
10
|
+
npm_config_update_notifier: "false",
|
|
11
|
+
};
|
|
12
|
+
/** Runs `script` in `sandbox` with `STEP_ENV` as a step labeled `label`, reporting it under `phase`. */
|
|
13
|
+
export async function runStep(context, request, progress, signal) {
|
|
14
|
+
const { phase, label } = request;
|
|
15
|
+
const startedAt = context.clock.now().getTime();
|
|
16
|
+
await progress.emit({ kind: "step-started", phase, label });
|
|
17
|
+
const queue = progressQueue(progress);
|
|
18
|
+
const tail = outputTail();
|
|
19
|
+
const splitters = { stdout: lineSplitter(), stderr: lineSplitter() };
|
|
20
|
+
const emit = (stream, text) => {
|
|
21
|
+
for (const line of splitLines(text)) {
|
|
22
|
+
tail.add(line);
|
|
23
|
+
queue.add({ kind: "step-output", phase, stream, line });
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const ran = await context.runnerSandboxes.runScript(request.sandbox, { script: request.script, env: STEP_ENV }, ({ stream, data }) => emit(stream, splitters[stream].push(data)), signal);
|
|
27
|
+
emit("stdout", splitters.stdout.flush());
|
|
28
|
+
emit("stderr", splitters.stderr.flush());
|
|
29
|
+
await queue.flush();
|
|
30
|
+
if (!ran.ok)
|
|
31
|
+
return { kind: "sandbox-failed", failure: ran.failure };
|
|
32
|
+
if (ran.value.exitCode !== 0)
|
|
33
|
+
return { kind: "exited", exitCode: ran.value.exitCode, tail: tail.lines() };
|
|
34
|
+
const ms = context.clock.now().getTime() - startedAt;
|
|
35
|
+
await progress.emit({ kind: "step-finished", phase, label, ms });
|
|
36
|
+
return { kind: "succeeded", ms };
|
|
37
|
+
}
|
|
38
|
+
/** A Sandbox failure other than an abort, as the runner reports it. */
|
|
39
|
+
export function sandboxApiFailure(operation, failure) {
|
|
40
|
+
if (failure.kind === "snapshot-gone")
|
|
41
|
+
return { kind: "sandbox-api-failed", operation, status: 410, message: failure.message };
|
|
42
|
+
return { kind: "sandbox-api-failed", operation, status: failure.status ?? null, message: failure.message };
|
|
43
|
+
}
|
|
44
|
+
/** How a stage ends on a failed Sandbox call: a stop when the run's signal aborted it, a failure otherwise. */
|
|
45
|
+
export function sandboxStop(operation, failure) {
|
|
46
|
+
return failure.kind === "aborted"
|
|
47
|
+
? { kind: "aborted" }
|
|
48
|
+
: { kind: "failed", failure: sandboxApiFailure(operation, failure) };
|
|
49
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ApiRequestRecord, type RecordedBody, type RequestOutcome } from "../records/index.ts";
|
|
2
|
+
import { type TestserverFailure } from "../testserver/index.ts";
|
|
3
|
+
/**
|
|
4
|
+
* A request body `container.fetch` takes: one it can read whole at once, before it sends anything. A stream or an
|
|
5
|
+
* iterable could keep it reading past the caller's abort and the call timeout, so it takes neither.
|
|
6
|
+
*/
|
|
7
|
+
export type ContainerRequestBody = string | ArrayBuffer | NodeJS.ArrayBufferView | Blob | FormData | URLSearchParams;
|
|
8
|
+
/** `fetch`'s `init`, with only a body `container.fetch` can read whole. */
|
|
9
|
+
export type ContainerRequestInit = Omit<RequestInit, "body"> & {
|
|
10
|
+
readonly body?: ContainerRequestBody | null;
|
|
11
|
+
};
|
|
12
|
+
/** The record of an API request to `target` that started at `startedAt` and ended with `outcome`. */
|
|
13
|
+
export declare function apiRequestRecord(request: {
|
|
14
|
+
readonly method: string;
|
|
15
|
+
readonly target: string;
|
|
16
|
+
readonly authorization: boolean;
|
|
17
|
+
readonly requestBody: RecordedBody | undefined;
|
|
18
|
+
readonly responseBody?: RecordedBody | undefined;
|
|
19
|
+
readonly startedAt: number;
|
|
20
|
+
readonly durationMs: number;
|
|
21
|
+
readonly outcome: RequestOutcome;
|
|
22
|
+
}): ApiRequestRecord;
|
|
23
|
+
/** Whether an answer with `status` to a `method` request carries no body. */
|
|
24
|
+
export declare function hasNullBody(method: string, status: number): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The failure an answer with `status` is, when `fetch` refuses it: a 410 or 502 (the Testserver sandbox has expired
|
|
27
|
+
* or can't be reached) is an `http-error`, a status no `Response` can carry is `malformed`. `undefined` for any other.
|
|
28
|
+
* The body is redacted whole before it is cut, so no secret is cut in half and left partly readable.
|
|
29
|
+
*/
|
|
30
|
+
export declare function refusedAnswer(status: number, body: Uint8Array, redact: (text: string) => string): TestserverFailure | undefined;
|
|
31
|
+
/** Whether `body` is one `container.fetch` can read whole at once: absent, or a `ContainerRequestBody`. */
|
|
32
|
+
export declare function readableWhole(body: unknown): boolean;
|