@cnc-tools/storm 0.0.0 → 0.5.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/run/cleanup.d.ts +135 -0
- package/dist/commands/run/cleanup.js +171 -0
- package/dist/commands/run/command.d.ts +327 -0
- package/dist/commands/run/command.js +620 -0
- package/dist/commands/run/job-summary.d.ts +6 -0
- package/dist/commands/run/job-summary.js +31 -0
- package/dist/commands/run/live-view.d.ts +22 -0
- package/dist/commands/run/live-view.js +395 -0
- package/dist/commands/run/metadata.d.ts +47 -0
- package/dist/commands/run/metadata.js +83 -0
- package/dist/commands/run/mint-failed.d.ts +11 -0
- package/dist/commands/run/mint-failed.js +33 -0
- package/dist/commands/run/outcomes.d.ts +307 -0
- package/dist/commands/run/outcomes.js +332 -0
- package/dist/commands/run/progress.d.ts +44 -0
- package/dist/commands/run/progress.js +277 -0
- package/dist/commands/run/redaction.d.ts +15 -0
- package/dist/commands/run/redaction.js +40 -0
- package/dist/commands/run/run-collector.d.ts +30 -0
- package/dist/commands/run/run-collector.js +73 -0
- package/dist/commands/run/run-record.d.ts +144 -0
- package/dist/commands/run/run-record.js +96 -0
- package/dist/commands/run/tests-summary.d.ts +34 -0
- package/dist/commands/run/tests-summary.js +141 -0
- package/dist/commands/run/text.d.ts +22 -0
- package/dist/commands/run/text.js +74 -0
- package/dist/commands/run/view.d.ts +35 -0
- package/dist/commands/run/view.js +163 -0
- package/dist/commands/run/waterfall.d.ts +25 -0
- package/dist/commands/run/waterfall.js +108 -0
- package/dist/commands/run/worker-chart.d.ts +79 -0
- package/dist/commands/run/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 +77 -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 +317 -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 +9 -0
- package/dist/config/index.js +12 -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 +16 -0
- package/dist/config/set.js +55 -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 +37 -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 +86 -0
- package/dist/context.js +43 -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 +77 -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 +452 -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/fixtures.d.ts +64 -0
- package/dist/vitest/fixtures.js +172 -0
- package/dist/vitest/gateways.d.ts +47 -0
- package/dist/vitest/gateways.js +3 -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 +7 -0
- package/dist/vitest/live/list-gateway.js +60 -0
- package/dist/vitest/ownership.d.ts +29 -0
- package/dist/vitest/ownership.js +68 -0
- package/dist/vitest/plan.d.ts +33 -0
- package/dist/vitest/plan.js +73 -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 +32 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { randomBytes, randomInt } from "node:crypto";
|
|
2
|
+
import { factories } from "../factories/index.js";
|
|
3
|
+
/** The billing every seeded team gets. */
|
|
4
|
+
const PRO_BILLING = { plan: "pro", period: "monthly" };
|
|
5
|
+
/** A `Seeder` over `container`. */
|
|
6
|
+
export function seeder(container, options = {}) {
|
|
7
|
+
const now = options.now ?? Date.now;
|
|
8
|
+
const seed = {
|
|
9
|
+
async user(input = {}) {
|
|
10
|
+
const teamId = `team_${hex(12)}`;
|
|
11
|
+
const seeded = await container.build(factories.users, { ...userFields(input), defaultTeamId: teamId });
|
|
12
|
+
const slug = input.team?.slug ?? teamSlug("team");
|
|
13
|
+
const defaultTeam = await container.build(factories.teams, {
|
|
14
|
+
id: teamId,
|
|
15
|
+
slug,
|
|
16
|
+
name: slug,
|
|
17
|
+
creatorId: seeded.id,
|
|
18
|
+
members: [{ uid: seeded.id, role: "OWNER", confirmed: true, ...joinedAt(now()) }],
|
|
19
|
+
billing: PRO_BILLING,
|
|
20
|
+
...teamPolicies(input.team ?? {}),
|
|
21
|
+
});
|
|
22
|
+
return { ...seeded, defaultTeam };
|
|
23
|
+
},
|
|
24
|
+
teamlessUser: (input = {}) => container.build(factories.users, userFields(input)),
|
|
25
|
+
team({ owner, members = [], slug = teamSlug("team"), saml = false, ...policies }) {
|
|
26
|
+
for (const [index, member] of members.entries()) {
|
|
27
|
+
if (member.accessRequest !== undefined && member.confirmed === true) {
|
|
28
|
+
throw new TypeError(`seed.team: members[${index}] has an access request, so it is pending; leave out confirmed: true`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const start = now();
|
|
32
|
+
return container.build(factories.teams, {
|
|
33
|
+
slug,
|
|
34
|
+
name: slug,
|
|
35
|
+
creatorId: owner.id,
|
|
36
|
+
members: [
|
|
37
|
+
{ uid: owner.id, role: "OWNER", confirmed: true, ...joinedAt(start) },
|
|
38
|
+
...members.map((member, index) => ({
|
|
39
|
+
uid: member.user.id,
|
|
40
|
+
role: member.role ?? "MEMBER",
|
|
41
|
+
confirmed: member.confirmed ?? member.accessRequest === undefined,
|
|
42
|
+
...joinedAt(start + index + 1),
|
|
43
|
+
...(member.accessRequest === undefined
|
|
44
|
+
? {}
|
|
45
|
+
: { accessRequestedAt: member.accessRequest.at, joinedFrom: { ...member.accessRequest.joinedFrom } }),
|
|
46
|
+
})),
|
|
47
|
+
],
|
|
48
|
+
billing: PRO_BILLING,
|
|
49
|
+
...(saml ? { saml: enforcedSaml(now()) } : {}),
|
|
50
|
+
...teamPolicies(policies),
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
project({ team, name, framework, buildCommand, rootDirectory, git }) {
|
|
54
|
+
return container.build(factories.projects, {
|
|
55
|
+
accountId: team.id,
|
|
56
|
+
...(name === undefined ? {} : { name }),
|
|
57
|
+
...(framework === undefined ? {} : { framework }),
|
|
58
|
+
...(buildCommand === undefined ? {} : { buildCommand }),
|
|
59
|
+
...(rootDirectory === undefined ? {} : { rootDirectory }),
|
|
60
|
+
...(git === undefined
|
|
61
|
+
? {}
|
|
62
|
+
: {
|
|
63
|
+
link: {
|
|
64
|
+
type: "github",
|
|
65
|
+
org: git.org,
|
|
66
|
+
repo: git.repo,
|
|
67
|
+
repoId: git.repoId ?? randomInt(1, 2 ** 31),
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
token({ user, team, samlTeams, teams, project, projectScope }) {
|
|
73
|
+
if (teams !== undefined && samlTeams !== undefined) {
|
|
74
|
+
throw new TypeError("seed.token: teams replaces the user scope and samlTeams adds to it; pass one, not both");
|
|
75
|
+
}
|
|
76
|
+
if (projectScope !== undefined && project === undefined) {
|
|
77
|
+
throw new TypeError("seed.token: projectScope needs project, the project the token is scoped to");
|
|
78
|
+
}
|
|
79
|
+
const createdAt = now();
|
|
80
|
+
const teamScope = (origin) => (each) => ({
|
|
81
|
+
type: "team",
|
|
82
|
+
teamId: each.id,
|
|
83
|
+
origin,
|
|
84
|
+
createdAt,
|
|
85
|
+
});
|
|
86
|
+
const scopes = teams !== undefined
|
|
87
|
+
? teams.map(teamScope("manual"))
|
|
88
|
+
: samlTeams !== undefined && samlTeams.length > 0
|
|
89
|
+
? [{ type: "user", origin: USER_SCOPE_ORIGIN, createdAt }, ...samlTeams.map(teamScope("saml"))]
|
|
90
|
+
: undefined;
|
|
91
|
+
return container.build(factories.tokens.tokens, {
|
|
92
|
+
uid: user.id,
|
|
93
|
+
...(team === undefined ? {} : { teamId: team.id }),
|
|
94
|
+
...(scopes === undefined ? {} : { scopes }),
|
|
95
|
+
...(project === undefined ? {} : { projectId: project.id }),
|
|
96
|
+
...(projectScope === undefined ? {} : { projectScope }),
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
async login(loginOptions = {}) {
|
|
100
|
+
const extra = loginOptions.teams ?? [];
|
|
101
|
+
for (const [index, each] of extra.entries()) {
|
|
102
|
+
if (each.samlScope === true && each.saml !== true) {
|
|
103
|
+
throw new TypeError(`seed.login: teams[${index}] asks for samlScope without saml: true`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const user = await seed.user(loginOptions.team === undefined ? {} : { team: loginOptions.team });
|
|
107
|
+
const teams = [];
|
|
108
|
+
for (const each of extra) {
|
|
109
|
+
teams.push(await seed.team({
|
|
110
|
+
owner: user,
|
|
111
|
+
slug: teamSlug(each.prefix ?? "team"),
|
|
112
|
+
...(each.saml === true ? { saml: true } : {}),
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
const project = loginOptions.project === undefined
|
|
116
|
+
? undefined
|
|
117
|
+
: await seed.project({
|
|
118
|
+
...(loginOptions.project === true ? {} : loginOptions.project),
|
|
119
|
+
team: user.defaultTeam,
|
|
120
|
+
});
|
|
121
|
+
const samlTeams = teams.filter((_, index) => extra[index]?.samlScope === true);
|
|
122
|
+
const token = await seed.token({
|
|
123
|
+
user,
|
|
124
|
+
...((loginOptions.token ?? "team") === "team" ? { team: user.defaultTeam } : {}),
|
|
125
|
+
...(samlTeams.length === 0 ? {} : { samlTeams }),
|
|
126
|
+
});
|
|
127
|
+
const login = { user, team: user.defaultTeam, token, teams, ...(project === undefined ? {} : { project }) };
|
|
128
|
+
// The tuple and the project's presence follow the options, which the code above honors entry by entry.
|
|
129
|
+
return login;
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
return seed;
|
|
133
|
+
}
|
|
134
|
+
/** The `users` factory input for `fields`, leaving out each one not given. */
|
|
135
|
+
/** The env var policies of `policies` that are given, for the `teams` factory's input. */
|
|
136
|
+
function teamPolicies(policies) {
|
|
137
|
+
const { sensitiveEnvironmentVariablePolicy, disjunctiveProductionSecretPolicy } = policies;
|
|
138
|
+
return {
|
|
139
|
+
...(sensitiveEnvironmentVariablePolicy === undefined ? {} : { sensitiveEnvironmentVariablePolicy }),
|
|
140
|
+
...(disjunctiveProductionSecretPolicy === undefined ? {} : { disjunctiveProductionSecretPolicy }),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function userFields(fields) {
|
|
144
|
+
return {
|
|
145
|
+
...(fields.username === undefined ? {} : { username: fields.username }),
|
|
146
|
+
...(fields.name === undefined ? {} : { name: fields.name }),
|
|
147
|
+
...(fields.email === undefined ? {} : { email: fields.email }),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* When a member joined, as both fields the `teams` factory's default member has. `GET /v2/teams/:teamId/members`
|
|
152
|
+
* pages by `createdAt`, so each member of a team gets its own.
|
|
153
|
+
*/
|
|
154
|
+
function joinedAt(time) {
|
|
155
|
+
return { created: time, createdAt: time };
|
|
156
|
+
}
|
|
157
|
+
/** The `origin` of the user scope the `tokens/tokens` factory gives a token by default. */
|
|
158
|
+
const USER_SCOPE_ORIGIN = "email";
|
|
159
|
+
/** The SAML configuration of a SAML-enforced team: enforced, with an active Okta connection. */
|
|
160
|
+
function enforcedSaml(connectedAt) {
|
|
161
|
+
return {
|
|
162
|
+
enforced: true,
|
|
163
|
+
connection: { id: `scim_${hex(12)}`, type: "OktaSAML", state: "active", connectedAt },
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function teamSlug(prefix) {
|
|
167
|
+
return `${prefix}-${hex(4)}`;
|
|
168
|
+
}
|
|
169
|
+
function hex(bytes) {
|
|
170
|
+
return randomBytes(bytes).toString("hex");
|
|
171
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Tells monotonic time, in milliseconds from an arbitrary origin, and waits. */
|
|
2
|
+
export interface Clock {
|
|
3
|
+
now(): number;
|
|
4
|
+
/** Resolves once `ms` milliseconds have passed. */
|
|
5
|
+
sleep(ms: number): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/** The system's monotonic clock (`performance.now()`), sleeping on a real timer. */
|
|
8
|
+
export declare const systemClock: Clock;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Time as a DI seam, not a gateway: the SDK reads a monotonic clock to time calls, and sleeps between a container
|
|
2
|
+
// start's attempts. Only `systemClock` touches real time; tests pass one driven by hand.
|
|
3
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
4
|
+
/** The system's monotonic clock (`performance.now()`), sleeping on a real timer. */
|
|
5
|
+
export const systemClock = {
|
|
6
|
+
now: () => performance.now(),
|
|
7
|
+
sleep: async (ms) => {
|
|
8
|
+
await delay(ms);
|
|
9
|
+
},
|
|
10
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** One Testserver data-plane call, as an error names it. */
|
|
2
|
+
export interface TestserverCall {
|
|
3
|
+
readonly method: string;
|
|
4
|
+
readonly path: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* How many characters of an answer's body a failure keeps: an `http-error`'s `body`, or what a `malformed` failure
|
|
8
|
+
* quotes of an answer that isn't JSON.
|
|
9
|
+
*/
|
|
10
|
+
export declare const BODY_EXCERPT_CHARS = 200;
|
|
11
|
+
/**
|
|
12
|
+
* Why a Testserver data-plane call failed.
|
|
13
|
+
*
|
|
14
|
+
* - `timeout`: no complete answer within `seconds`. Testserver hangs on some inputs instead of failing.
|
|
15
|
+
* - `connect-failed`: the request never reached Testserver (`code` is the network error's, such as `ECONNREFUSED`).
|
|
16
|
+
* - `dropped`: the connection failed after the request was sent.
|
|
17
|
+
* - `http-error`: a status other than 2xx (redirects are not followed); `body` is the first `BODY_EXCERPT_CHARS`
|
|
18
|
+
* characters of the response.
|
|
19
|
+
* - `malformed`: a 2xx with a body the SDK couldn't read.
|
|
20
|
+
*/
|
|
21
|
+
export type TestserverFailure = {
|
|
22
|
+
readonly kind: "timeout";
|
|
23
|
+
readonly seconds: number;
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: "connect-failed";
|
|
26
|
+
readonly code: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: "dropped";
|
|
29
|
+
readonly message: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: "http-error";
|
|
32
|
+
readonly status: number;
|
|
33
|
+
readonly body: string;
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: "malformed";
|
|
36
|
+
readonly detail: string;
|
|
37
|
+
};
|
|
38
|
+
/** A short phrase for `failure`, such as `no answer within 45s` or `HTTP 404: ...`. */
|
|
39
|
+
export declare function describeFailure(failure: TestserverFailure): string;
|
|
40
|
+
/**
|
|
41
|
+
* Matches the message of a `TestserverCallError` whose call's connection failed: its `failure` is `dropped` or
|
|
42
|
+
* `connect-failed`, so the call broke off or never reached Testserver, and the same call may work on a new
|
|
43
|
+
* connection. It matches no other failure kind, and not a call whose last attempt failed otherwise after an earlier
|
|
44
|
+
* attempt's connection failed. It also matches the `AggregateError` a failed start throws when ending the container
|
|
45
|
+
* fails too, whose message starts with the start's. For a test runner's retry condition, such as vitest's
|
|
46
|
+
* `retry.condition`, which a config file can only give as a RegExp.
|
|
47
|
+
*/
|
|
48
|
+
export declare const TESTSERVER_CONNECTION_FAILURE: RegExp;
|
|
49
|
+
/** The attempts a call that is retried made before it failed: how many, how long they took, and why the first failed. */
|
|
50
|
+
export interface TestserverCallAttempts {
|
|
51
|
+
readonly count: number;
|
|
52
|
+
readonly elapsedMs: number;
|
|
53
|
+
readonly first: TestserverFailure;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A Testserver data-plane call failed. It names the call, the test id and the Testserver URL. A call tried more than
|
|
57
|
+
* once (a container start) carries its `attempts`, and its `failure` is the last attempt's.
|
|
58
|
+
*/
|
|
59
|
+
export declare class TestserverCallError extends Error {
|
|
60
|
+
readonly name = "TestserverCallError";
|
|
61
|
+
readonly call: TestserverCall;
|
|
62
|
+
readonly testId: string;
|
|
63
|
+
readonly testserverUrl: string;
|
|
64
|
+
readonly failure: TestserverFailure;
|
|
65
|
+
readonly attempts?: TestserverCallAttempts;
|
|
66
|
+
constructor(details: {
|
|
67
|
+
readonly call: TestserverCall;
|
|
68
|
+
readonly testId: string;
|
|
69
|
+
readonly testserverUrl: string;
|
|
70
|
+
readonly failure: TestserverFailure;
|
|
71
|
+
readonly attempts?: TestserverCallAttempts;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many characters of an answer's body a failure keeps: an `http-error`'s `body`, or what a `malformed` failure
|
|
3
|
+
* quotes of an answer that isn't JSON.
|
|
4
|
+
*/
|
|
5
|
+
export const BODY_EXCERPT_CHARS = 200;
|
|
6
|
+
/** How `describeFailure` starts a `connect-failed` failure. */
|
|
7
|
+
const CONNECT_FAILED_PHRASE = "could not connect";
|
|
8
|
+
/** How `describeFailure` starts a `dropped` failure. */
|
|
9
|
+
const DROPPED_PHRASE = "the connection failed";
|
|
10
|
+
/** A short phrase for `failure`, such as `no answer within 45s` or `HTTP 404: ...`. */
|
|
11
|
+
export function describeFailure(failure) {
|
|
12
|
+
switch (failure.kind) {
|
|
13
|
+
case "timeout":
|
|
14
|
+
return `no answer within ${failure.seconds}s`;
|
|
15
|
+
case "connect-failed":
|
|
16
|
+
return `${CONNECT_FAILED_PHRASE} (${failure.code})`;
|
|
17
|
+
case "dropped":
|
|
18
|
+
return `${DROPPED_PHRASE}: ${failure.message}`;
|
|
19
|
+
case "http-error":
|
|
20
|
+
return failure.body === "" ? `HTTP ${failure.status}` : `HTTP ${failure.status}: ${failure.body}`;
|
|
21
|
+
case "malformed":
|
|
22
|
+
return `unreadable response: ${failure.detail}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Matches the message of a `TestserverCallError` whose call's connection failed: its `failure` is `dropped` or
|
|
27
|
+
* `connect-failed`, so the call broke off or never reached Testserver, and the same call may work on a new
|
|
28
|
+
* connection. It matches no other failure kind, and not a call whose last attempt failed otherwise after an earlier
|
|
29
|
+
* attempt's connection failed. It also matches the `AggregateError` a failed start throws when ending the container
|
|
30
|
+
* fails too, whose message starts with the start's. For a test runner's retry condition, such as vitest's
|
|
31
|
+
* `retry.condition`, which a config file can only give as a RegExp.
|
|
32
|
+
*/
|
|
33
|
+
export const TESTSERVER_CONNECTION_FAILURE = new RegExp(` for test id \\S+ on \\S+ failed: (?:${DROPPED_PHRASE}: |${CONNECT_FAILED_PHRASE} \\()`);
|
|
34
|
+
/**
|
|
35
|
+
* A Testserver data-plane call failed. It names the call, the test id and the Testserver URL. A call tried more than
|
|
36
|
+
* once (a container start) carries its `attempts`, and its `failure` is the last attempt's.
|
|
37
|
+
*/
|
|
38
|
+
export class TestserverCallError extends Error {
|
|
39
|
+
name = "TestserverCallError";
|
|
40
|
+
call;
|
|
41
|
+
testId;
|
|
42
|
+
testserverUrl;
|
|
43
|
+
failure;
|
|
44
|
+
attempts;
|
|
45
|
+
constructor(details) {
|
|
46
|
+
super(`${details.call.method} ${details.call.path} for test id ${details.testId} on ${details.testserverUrl} failed: ${describeFailure(details.failure)}${describeAttempts(details.attempts)}`);
|
|
47
|
+
this.call = details.call;
|
|
48
|
+
this.testId = details.testId;
|
|
49
|
+
this.testserverUrl = details.testserverUrl;
|
|
50
|
+
this.failure = details.failure;
|
|
51
|
+
if (details.attempts !== undefined)
|
|
52
|
+
this.attempts = details.attempts;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** ` (2 attempts in 15.3s; the first failed: HTTP 503)`, or nothing for a call tried once. */
|
|
56
|
+
function describeAttempts(attempts) {
|
|
57
|
+
if (attempts === undefined || attempts.count < 2)
|
|
58
|
+
return "";
|
|
59
|
+
const seconds = (attempts.elapsedMs / 1000).toFixed(1);
|
|
60
|
+
return ` (${attempts.count} attempts in ${seconds}s; the first failed: ${describeFailure(attempts.first)})`;
|
|
61
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { type Clock, systemClock } from "./clock.ts";
|
|
2
|
+
export { BODY_EXCERPT_CHARS, describeFailure, type TestserverCall, type TestserverCallAttempts, TestserverCallError, type TestserverFailure, TESTSERVER_CONNECTION_FAILURE, } from "./failure.ts";
|
|
3
|
+
export { type RawTestserverAnswer, type RawTestserverOutcome, type RawTestserverRequest, requestTestserver, sendTestserverRequest, type TestserverRequest, type TestserverResponse, testserverEndpoint, } from "./live/request.ts";
|
|
4
|
+
export { type KnownTestserverServiceId, SERVICE_IDS_CHECKED_AGAINST, TESTSERVER_SERVICE_IDS, type TestserverServiceId, } from "./service-ids.ts";
|
|
5
|
+
export { checkTestId, generateTestId, MAX_TEST_ID_LENGTH, TEST_ID_HEADER, TestIdError } from "./test-id.ts";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The SDK's `testserver` module: Testserver's data-plane contract that the other SDK modules share. Test ids, the
|
|
2
|
+
// failure vocabulary of a data-plane call, the clock seam, the live request mechanism beneath the live gateways, and
|
|
3
|
+
// the ids of the services Testserver runs in each container.
|
|
4
|
+
export { systemClock } from "./clock.js";
|
|
5
|
+
export { BODY_EXCERPT_CHARS, describeFailure, TestserverCallError, TESTSERVER_CONNECTION_FAILURE, } from "./failure.js";
|
|
6
|
+
export { requestTestserver, sendTestserverRequest, testserverEndpoint, } from "./live/request.js";
|
|
7
|
+
export { SERVICE_IDS_CHECKED_AGAINST, TESTSERVER_SERVICE_IDS, } from "./service-ids.js";
|
|
8
|
+
export { checkTestId, generateTestId, MAX_TEST_ID_LENGTH, TEST_ID_HEADER, TestIdError } from "./test-id.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The code of a `fetch` failure that happened before connecting: a `TypeError` whose `cause.code` is in the
|
|
3
|
+
* set above. `undefined` for any other error, which may have come after the server got the request.
|
|
4
|
+
*/
|
|
5
|
+
export declare function connectFailureCode(error: unknown): string | undefined;
|
|
6
|
+
/** `error`'s message, with its cause's when it has one. */
|
|
7
|
+
export declare function errorMessage(error: unknown): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The undici `cause.code` values of a `fetch` that never established a connection, so the request never
|
|
3
|
+
* reached the server. The set is vercel-internal's (`create-testserver.mjs`), as in the CLI's sandbox module.
|
|
4
|
+
*/
|
|
5
|
+
const CONNECT_FAILURE_CODES = new Set([
|
|
6
|
+
"ENOTFOUND",
|
|
7
|
+
"EAI_AGAIN",
|
|
8
|
+
"ECONNREFUSED",
|
|
9
|
+
"ENETUNREACH",
|
|
10
|
+
"EHOSTUNREACH",
|
|
11
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
12
|
+
]);
|
|
13
|
+
/**
|
|
14
|
+
* The code of a `fetch` failure that happened before connecting: a `TypeError` whose `cause.code` is in the
|
|
15
|
+
* set above. `undefined` for any other error, which may have come after the server got the request.
|
|
16
|
+
*/
|
|
17
|
+
export function connectFailureCode(error) {
|
|
18
|
+
if (!(error instanceof TypeError))
|
|
19
|
+
return undefined;
|
|
20
|
+
const cause = error.cause;
|
|
21
|
+
const code = typeof cause === "object" && cause !== null ? cause.code : undefined;
|
|
22
|
+
return typeof code === "string" && CONNECT_FAILURE_CODES.has(code) ? code : undefined;
|
|
23
|
+
}
|
|
24
|
+
/** `error`'s message, with its cause's when it has one. */
|
|
25
|
+
export function errorMessage(error) {
|
|
26
|
+
if (!(error instanceof Error))
|
|
27
|
+
return String(error);
|
|
28
|
+
const cause = error.cause;
|
|
29
|
+
return cause instanceof Error && cause.message !== "" ? `${error.message}: ${cause.message}` : error.message;
|
|
30
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type TestserverFailure } from "../failure.ts";
|
|
2
|
+
/** One data-plane request: `method` `path` under the Testserver URL, carrying the test id. */
|
|
3
|
+
export interface TestserverRequest {
|
|
4
|
+
readonly testserverUrl: string;
|
|
5
|
+
readonly testId: string;
|
|
6
|
+
readonly method: string;
|
|
7
|
+
/** The path under the Testserver URL, starting with `/`. */
|
|
8
|
+
readonly path: string;
|
|
9
|
+
/** Sent as JSON when present. */
|
|
10
|
+
readonly body?: unknown;
|
|
11
|
+
/** How long the whole call, response body included, may take. */
|
|
12
|
+
readonly timeoutMs: number;
|
|
13
|
+
}
|
|
14
|
+
export type TestserverResponse = {
|
|
15
|
+
readonly ok: true;
|
|
16
|
+
readonly text: string;
|
|
17
|
+
} | {
|
|
18
|
+
readonly ok: false;
|
|
19
|
+
readonly failure: TestserverFailure;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Sends one data-plane request as `sendTestserverRequest` does, its body as JSON, and reads the answer as text. Any
|
|
23
|
+
* status but a 2xx is an `http-error`. No credential: Testserver's data plane checks none. Never rejects.
|
|
24
|
+
*/
|
|
25
|
+
export declare function requestTestserver(request: TestserverRequest): Promise<TestserverResponse>;
|
|
26
|
+
/** `path` under `testserverUrl`, keeping any path the Testserver URL has. */
|
|
27
|
+
export declare function testserverEndpoint(testserverUrl: string, path: string): string;
|
|
28
|
+
/** One data-plane request sent as given: its headers and bytes pass through, with the test id added. */
|
|
29
|
+
export interface RawTestserverRequest {
|
|
30
|
+
readonly testserverUrl: string;
|
|
31
|
+
readonly testId: string;
|
|
32
|
+
readonly method: string;
|
|
33
|
+
/** The path under the Testserver URL, starting with `/`, with any query. */
|
|
34
|
+
readonly path: string;
|
|
35
|
+
readonly headers: readonly (readonly [string, string])[];
|
|
36
|
+
readonly body?: Uint8Array;
|
|
37
|
+
/** The caller's signal, which aborts the request when it aborts. */
|
|
38
|
+
readonly signal?: AbortSignal;
|
|
39
|
+
/** How long the whole call, response body included, may take. */
|
|
40
|
+
readonly timeoutMs: number;
|
|
41
|
+
}
|
|
42
|
+
/** What Testserver answered, whatever its status, the body read whole. */
|
|
43
|
+
export interface RawTestserverAnswer {
|
|
44
|
+
readonly status: number;
|
|
45
|
+
readonly statusText: string;
|
|
46
|
+
/**
|
|
47
|
+
* The answer's headers, less `content-encoding` and `content-length`: `fetch` has already decompressed the body,
|
|
48
|
+
* so they no longer describe it.
|
|
49
|
+
*/
|
|
50
|
+
readonly headers: readonly (readonly [string, string])[];
|
|
51
|
+
readonly body: Uint8Array;
|
|
52
|
+
}
|
|
53
|
+
export type RawTestserverOutcome = {
|
|
54
|
+
readonly ok: true;
|
|
55
|
+
readonly answer: RawTestserverAnswer;
|
|
56
|
+
} | {
|
|
57
|
+
readonly ok: false;
|
|
58
|
+
readonly failure: TestserverFailure;
|
|
59
|
+
}
|
|
60
|
+
/** The caller's signal aborted the request. */
|
|
61
|
+
| {
|
|
62
|
+
readonly ok: false;
|
|
63
|
+
readonly aborted: true;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Sends one data-plane request over `fetch` as given, with the `test-id` header, following no redirect, under a
|
|
67
|
+
* timeout covering the response body, and reads the whole answer whatever its status. Never rejects.
|
|
68
|
+
*/
|
|
69
|
+
export declare function sendTestserverRequest(request: RawTestserverRequest): Promise<RawTestserverOutcome>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { BODY_EXCERPT_CHARS } from "../failure.js";
|
|
2
|
+
import { TEST_ID_HEADER } from "../test-id.js";
|
|
3
|
+
import { connectFailureCode, errorMessage } from "./connect-failure.js";
|
|
4
|
+
/**
|
|
5
|
+
* Sends one data-plane request as `sendTestserverRequest` does, its body as JSON, and reads the answer as text. Any
|
|
6
|
+
* status but a 2xx is an `http-error`. No credential: Testserver's data plane checks none. Never rejects.
|
|
7
|
+
*/
|
|
8
|
+
export async function requestTestserver(request) {
|
|
9
|
+
const sent = await sendTestserverRequest({
|
|
10
|
+
testserverUrl: request.testserverUrl,
|
|
11
|
+
testId: request.testId,
|
|
12
|
+
method: request.method,
|
|
13
|
+
path: request.path,
|
|
14
|
+
headers: request.body === undefined ? [] : [["content-type", "application/json"]],
|
|
15
|
+
...(request.body === undefined ? {} : { body: new TextEncoder().encode(JSON.stringify(request.body)) }),
|
|
16
|
+
timeoutMs: request.timeoutMs,
|
|
17
|
+
});
|
|
18
|
+
if (!sent.ok) {
|
|
19
|
+
if ("aborted" in sent)
|
|
20
|
+
throw new Error("requestTestserver passes no signal, so nothing can abort its request");
|
|
21
|
+
return sent;
|
|
22
|
+
}
|
|
23
|
+
const { status, body } = sent.answer;
|
|
24
|
+
const text = new TextDecoder().decode(body);
|
|
25
|
+
if (status < 200 || status > 299) {
|
|
26
|
+
return { ok: false, failure: { kind: "http-error", status, body: text.slice(0, BODY_EXCERPT_CHARS) } };
|
|
27
|
+
}
|
|
28
|
+
return { ok: true, text };
|
|
29
|
+
}
|
|
30
|
+
/** `path` under `testserverUrl`, keeping any path the Testserver URL has. */
|
|
31
|
+
export function testserverEndpoint(testserverUrl, path) {
|
|
32
|
+
return `${testserverUrl.replace(/\/+$/, "")}${path}`;
|
|
33
|
+
}
|
|
34
|
+
/** Headers that describe the body as sent, which `fetch`'s decompression leaves wrong. */
|
|
35
|
+
const ENCODING_HEADERS = new Set(["content-encoding", "content-length"]);
|
|
36
|
+
/**
|
|
37
|
+
* Sends one data-plane request over `fetch` as given, with the `test-id` header, following no redirect, under a
|
|
38
|
+
* timeout covering the response body, and reads the whole answer whatever its status. Never rejects.
|
|
39
|
+
*/
|
|
40
|
+
export async function sendTestserverRequest(request) {
|
|
41
|
+
const timeout = AbortSignal.timeout(request.timeoutMs);
|
|
42
|
+
const signal = request.signal === undefined ? timeout : AbortSignal.any([timeout, request.signal]);
|
|
43
|
+
/** Why the request stopped, when a signal stopped it: the caller's abort, or the timeout. */
|
|
44
|
+
const stopped = () => {
|
|
45
|
+
if (request.signal?.aborted === true)
|
|
46
|
+
return { ok: false, aborted: true };
|
|
47
|
+
if (timeout.aborted)
|
|
48
|
+
return { ok: false, failure: { kind: "timeout", seconds: request.timeoutMs / 1000 } };
|
|
49
|
+
return undefined;
|
|
50
|
+
};
|
|
51
|
+
const headers = new Headers(request.headers.map(([name, value]) => [name, value]));
|
|
52
|
+
headers.set(TEST_ID_HEADER, request.testId);
|
|
53
|
+
let response;
|
|
54
|
+
try {
|
|
55
|
+
response = await fetch(testserverEndpoint(request.testserverUrl, request.path), {
|
|
56
|
+
method: request.method,
|
|
57
|
+
headers,
|
|
58
|
+
...(request.body === undefined ? {} : { body: request.body }),
|
|
59
|
+
redirect: "manual",
|
|
60
|
+
signal,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const outcome = stopped();
|
|
65
|
+
if (outcome !== undefined)
|
|
66
|
+
return outcome;
|
|
67
|
+
const code = connectFailureCode(error);
|
|
68
|
+
return {
|
|
69
|
+
ok: false,
|
|
70
|
+
failure: code === undefined ? { kind: "dropped", message: errorMessage(error) } : { kind: "connect-failed", code },
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
let body;
|
|
74
|
+
try {
|
|
75
|
+
body = new Uint8Array(await response.arrayBuffer());
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return stopped() ?? { ok: false, failure: { kind: "dropped", message: errorMessage(error) } };
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
ok: true,
|
|
82
|
+
answer: {
|
|
83
|
+
status: response.status,
|
|
84
|
+
statusText: response.statusText,
|
|
85
|
+
headers: [...response.headers].filter(([name]) => !ENCODING_HEADERS.has(name)),
|
|
86
|
+
body,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vercel/api commit `TESTSERVER_SERVICE_IDS` was checked against (`testserver/server/src/service-ids.ts`).
|
|
3
|
+
*/
|
|
4
|
+
export declare const SERVICE_IDS_CHECKED_AGAINST = "1b73b91b807";
|
|
5
|
+
/**
|
|
6
|
+
* The services Testserver runs in each container, in its own order. Testserver starts `@testserver/factories` and
|
|
7
|
+
* its common dependencies with the container, and each of these on first use, as its own child process; warming a
|
|
8
|
+
* container asks each listed service's `readyz` to start it sooner. `@apps/www-avatar` is skipped when Testserver
|
|
9
|
+
* bundles its dist, and can't be warmed: Testserver routes `/_/service/<id>/` by splitting the path on `/`
|
|
10
|
+
* without decoding it.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TESTSERVER_SERVICE_IDS: readonly ["api-access-groups", "api-ai-gateway", "api-analytics", "api-billing", "api-budgets", "api-builds", "api-bulk-redirects", "api-checks", "api-connect", "api-connex", "api-dashboard", "api-deployment-events", "api-deployments", "api-domains", "api-domains-records", "api-drains", "api-edge-config", "api-environment", "api-events", "api-feature-flags", "api-git-providers", "api-incoming", "api-integrations", "api-invoices", "api-keys", "api-kms", "api-login-oauth2", "api-microfrontends", "api-notifications", "api-observability", "api-plan", "api-project-members", "api-project-routes", "api-projects", "api-sandboxes", "api-security", "api-team-members", "api-recents", "api-speed-insights", "api-storage", "api-stripe-events", "api-teams", "api-upload", "api-usage", "api-usage-metrics", "api-user", "api-user-tokens", "api-vade", "api-vcr", "api-web-analytics", "now-files", "now-registration", "api-webhooks", "billing-invoices", "billing-sources", "now-alias", "now-aliases", "now-file-tree", "now-list", "now-rm", "subscriber-marketplace-billing", "subscriber-page-integrity", "subscriber-user-events", "@apps/www-avatar"];
|
|
13
|
+
/** A service id in `TESTSERVER_SERVICE_IDS`. */
|
|
14
|
+
export type KnownTestserverServiceId = (typeof TESTSERVER_SERVICE_IDS)[number];
|
|
15
|
+
/**
|
|
16
|
+
* A Testserver service id: a known one, which editors complete, or any other string, for a service Testserver added
|
|
17
|
+
* after `TESTSERVER_SERVICE_IDS` was last checked.
|
|
18
|
+
*/
|
|
19
|
+
export type TestserverServiceId = KnownTestserverServiceId | (string & {});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vercel/api commit `TESTSERVER_SERVICE_IDS` was checked against (`testserver/server/src/service-ids.ts`).
|
|
3
|
+
*/
|
|
4
|
+
export const SERVICE_IDS_CHECKED_AGAINST = "1b73b91b807";
|
|
5
|
+
/**
|
|
6
|
+
* The services Testserver runs in each container, in its own order. Testserver starts `@testserver/factories` and
|
|
7
|
+
* its common dependencies with the container, and each of these on first use, as its own child process; warming a
|
|
8
|
+
* container asks each listed service's `readyz` to start it sooner. `@apps/www-avatar` is skipped when Testserver
|
|
9
|
+
* bundles its dist, and can't be warmed: Testserver routes `/_/service/<id>/` by splitting the path on `/`
|
|
10
|
+
* without decoding it.
|
|
11
|
+
*/
|
|
12
|
+
export const TESTSERVER_SERVICE_IDS = [
|
|
13
|
+
"api-access-groups",
|
|
14
|
+
"api-ai-gateway",
|
|
15
|
+
"api-analytics",
|
|
16
|
+
"api-billing",
|
|
17
|
+
"api-budgets",
|
|
18
|
+
"api-builds",
|
|
19
|
+
"api-bulk-redirects",
|
|
20
|
+
"api-checks",
|
|
21
|
+
"api-connect",
|
|
22
|
+
"api-connex",
|
|
23
|
+
"api-dashboard",
|
|
24
|
+
"api-deployment-events",
|
|
25
|
+
"api-deployments",
|
|
26
|
+
"api-domains",
|
|
27
|
+
"api-domains-records",
|
|
28
|
+
"api-drains",
|
|
29
|
+
"api-edge-config",
|
|
30
|
+
"api-environment",
|
|
31
|
+
"api-events",
|
|
32
|
+
"api-feature-flags",
|
|
33
|
+
"api-git-providers",
|
|
34
|
+
"api-incoming",
|
|
35
|
+
"api-integrations",
|
|
36
|
+
"api-invoices",
|
|
37
|
+
"api-keys",
|
|
38
|
+
"api-kms",
|
|
39
|
+
"api-login-oauth2",
|
|
40
|
+
"api-microfrontends",
|
|
41
|
+
"api-notifications",
|
|
42
|
+
"api-observability",
|
|
43
|
+
"api-plan",
|
|
44
|
+
"api-project-members",
|
|
45
|
+
"api-project-routes",
|
|
46
|
+
"api-projects",
|
|
47
|
+
"api-sandboxes",
|
|
48
|
+
"api-security",
|
|
49
|
+
"api-team-members",
|
|
50
|
+
"api-recents",
|
|
51
|
+
"api-speed-insights",
|
|
52
|
+
"api-storage",
|
|
53
|
+
"api-stripe-events",
|
|
54
|
+
"api-teams",
|
|
55
|
+
"api-upload",
|
|
56
|
+
"api-usage",
|
|
57
|
+
"api-usage-metrics",
|
|
58
|
+
"api-user",
|
|
59
|
+
"api-user-tokens",
|
|
60
|
+
"api-vade",
|
|
61
|
+
"api-vcr",
|
|
62
|
+
"api-web-analytics",
|
|
63
|
+
"now-files",
|
|
64
|
+
"now-registration",
|
|
65
|
+
"api-webhooks",
|
|
66
|
+
"billing-invoices",
|
|
67
|
+
"billing-sources",
|
|
68
|
+
"now-alias",
|
|
69
|
+
"now-aliases",
|
|
70
|
+
"now-file-tree",
|
|
71
|
+
"now-list",
|
|
72
|
+
"now-rm",
|
|
73
|
+
"subscriber-marketplace-billing",
|
|
74
|
+
"subscriber-page-integrity",
|
|
75
|
+
"subscriber-user-events",
|
|
76
|
+
"@apps/www-avatar",
|
|
77
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** The header Testserver reads a request's test id from. */
|
|
2
|
+
export declare const TEST_ID_HEADER = "test-id";
|
|
3
|
+
/**
|
|
4
|
+
* The longest test id the SDK sends. Testserver never answers `PUT /_/test` for a test id of 50 characters or
|
|
5
|
+
* more (observed 2026-10-29; the cause is unknown), so the SDK refuses one before sending anything.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MAX_TEST_ID_LENGTH = 49;
|
|
8
|
+
/** A caller-supplied test id was empty, too long, or held a character outside `A-Z a-z 0-9 . _ -`. */
|
|
9
|
+
export declare class TestIdError extends Error {
|
|
10
|
+
readonly name = "TestIdError";
|
|
11
|
+
}
|
|
12
|
+
/** A fresh test id: `ts-` and 16 lowercase hex characters, 19 characters in all. */
|
|
13
|
+
export declare function generateTestId(): string;
|
|
14
|
+
/** Throws a `TestIdError` unless `testId` is 1 to 49 characters of `A-Z a-z 0-9 . _ -`. */
|
|
15
|
+
export declare function checkTestId(testId: string): void;
|