@cnc-tools/storm 0.0.0-stage → 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 +123 -4
- package/skills/overview.md +32 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The flag clients Testserver's flags datafile reads, in the order a container start sets them: `all`, the
|
|
3
|
+
* fallthrough every evaluation reaches, and the entity kinds `user`, `team` and `integration` (`FLAGS_CORE_CLIENTS`
|
|
4
|
+
* in vercel/api's `testserver/server/src/external/flags.ts`). A rule only tests whether an entity of its kind is in
|
|
5
|
+
* the evaluation context, so a value applies to every user, team or integration in the container.
|
|
6
|
+
*/
|
|
7
|
+
export const FEATURE_FLAG_CLIENTS = ["all", "user", "team", "integration"];
|
|
8
|
+
const CLIENT_LIST = FEATURE_FLAG_CLIENTS.map((client) => JSON.stringify(client)).join(", ");
|
|
9
|
+
/**
|
|
10
|
+
* Throws a `TypeError` naming the problem unless `flags` is `FeatureFlags`: an object whose keys are flag clients,
|
|
11
|
+
* each holding an object of non-empty flag names to JSON values. A client that is `undefined` counts as absent.
|
|
12
|
+
* Testserver would take an unknown client and ignore it, so it is refused here.
|
|
13
|
+
*/
|
|
14
|
+
export function checkFeatureFlags(flags) {
|
|
15
|
+
if (!isPlainObject(flags)) {
|
|
16
|
+
throw new TypeError(`featureFlags takes an object keyed by flag client (${CLIENT_LIST}), not ${describe(flags)}`);
|
|
17
|
+
}
|
|
18
|
+
for (const [client, map] of Object.entries(flags)) {
|
|
19
|
+
if (!isClient(client)) {
|
|
20
|
+
throw new TypeError(`featureFlags takes the flag clients ${CLIENT_LIST}; not ${JSON.stringify(client)}`);
|
|
21
|
+
}
|
|
22
|
+
if (map === undefined)
|
|
23
|
+
continue;
|
|
24
|
+
if (!isPlainObject(map)) {
|
|
25
|
+
throw new TypeError(`featureFlags.${client} takes an object of flag names to JSON values, not ${describe(map)}`);
|
|
26
|
+
}
|
|
27
|
+
for (const [name, value] of Object.entries(map)) {
|
|
28
|
+
if (name === "")
|
|
29
|
+
throw new TypeError(`featureFlags.${client} has an empty flag name`);
|
|
30
|
+
checkJson(value, `featureFlags.${client}[${JSON.stringify(name)}]`, new Set());
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* `flags` with its empty clients dropped and the rest in `FEATURE_FLAG_CLIENTS` order, each a copy, so changing
|
|
36
|
+
* the object given afterwards changes nothing. Takes flags `checkFeatureFlags` accepted.
|
|
37
|
+
*/
|
|
38
|
+
export function normalizeFeatureFlags(flags) {
|
|
39
|
+
const normalized = {};
|
|
40
|
+
for (const client of FEATURE_FLAG_CLIENTS) {
|
|
41
|
+
const map = flags[client];
|
|
42
|
+
if (map === undefined || Object.keys(map).length === 0)
|
|
43
|
+
continue;
|
|
44
|
+
normalized[client] = JSON.parse(JSON.stringify(map));
|
|
45
|
+
}
|
|
46
|
+
return normalized;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The canonical JSON of `flags`, normalized, with object keys sorted at every depth: two values that set the same
|
|
50
|
+
* flags give the same key, so `{}` and `{ all: {} }` do. Throws `checkFeatureFlags`' `TypeError` for flags that
|
|
51
|
+
* aren't `FeatureFlags`.
|
|
52
|
+
*/
|
|
53
|
+
export function featureFlagsKey(flags) {
|
|
54
|
+
checkFeatureFlags(flags);
|
|
55
|
+
return canonicalJson(normalizeFeatureFlags(flags));
|
|
56
|
+
}
|
|
57
|
+
function canonicalJson(value) {
|
|
58
|
+
if (Array.isArray(value))
|
|
59
|
+
return `[${value.map(canonicalJson).join(",")}]`;
|
|
60
|
+
if (value !== null && typeof value === "object") {
|
|
61
|
+
const entries = Object.entries(value).toSorted(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
62
|
+
return `{${entries.map(([key, each]) => `${JSON.stringify(key)}:${canonicalJson(each)}`).join(",")}}`;
|
|
63
|
+
}
|
|
64
|
+
return JSON.stringify(value);
|
|
65
|
+
}
|
|
66
|
+
function isClient(key) {
|
|
67
|
+
return FEATURE_FLAG_CLIENTS.includes(key);
|
|
68
|
+
}
|
|
69
|
+
/** An object made by a literal or `Object.create(null)`: not an array, a class instance, a `Map` or a `Date`. */
|
|
70
|
+
function isPlainObject(value) {
|
|
71
|
+
if (value === null || typeof value !== "object")
|
|
72
|
+
return false;
|
|
73
|
+
const prototype = Object.getPrototypeOf(value);
|
|
74
|
+
return prototype === Object.prototype || prototype === null;
|
|
75
|
+
}
|
|
76
|
+
/** Throws a `TypeError` naming `where` unless `value` is a JSON value, a number finite, with no cycle. */
|
|
77
|
+
function checkJson(value, where, seen) {
|
|
78
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
79
|
+
return;
|
|
80
|
+
if (typeof value === "number") {
|
|
81
|
+
if (Number.isFinite(value))
|
|
82
|
+
return;
|
|
83
|
+
throw new TypeError(`${where} is ${String(value)}, which isn't JSON`);
|
|
84
|
+
}
|
|
85
|
+
if (Array.isArray(value) || isPlainObject(value)) {
|
|
86
|
+
if (seen.has(value))
|
|
87
|
+
throw new TypeError(`${where} refers to itself, which isn't JSON`);
|
|
88
|
+
seen.add(value);
|
|
89
|
+
const entries = Array.isArray(value)
|
|
90
|
+
? value.map((each, index) => [`[${index}]`, each])
|
|
91
|
+
: Object.entries(value).map(([key, each]) => [`[${JSON.stringify(key)}]`, each]);
|
|
92
|
+
for (const [key, each] of entries)
|
|
93
|
+
checkJson(each, `${where}${key}`, seen);
|
|
94
|
+
seen.delete(value);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
throw new TypeError(`${where} is ${describe(value)}, which isn't JSON`);
|
|
98
|
+
}
|
|
99
|
+
function describe(value) {
|
|
100
|
+
if (value === null)
|
|
101
|
+
return "null";
|
|
102
|
+
if (Array.isArray(value))
|
|
103
|
+
return "an array";
|
|
104
|
+
if (typeof value === "object") {
|
|
105
|
+
const name = Object.getPrototypeOf(value)?.constructor
|
|
106
|
+
?.name;
|
|
107
|
+
return typeof name === "string" && name !== "" ? `a ${name}` : "an object";
|
|
108
|
+
}
|
|
109
|
+
if (typeof value === "string")
|
|
110
|
+
return JSON.stringify(value);
|
|
111
|
+
if (typeof value === "symbol" || typeof value === "function")
|
|
112
|
+
return `a ${typeof value}`;
|
|
113
|
+
if (typeof value === "bigint")
|
|
114
|
+
return "a bigint";
|
|
115
|
+
if (typeof value === "number" || typeof value === "boolean" || value === undefined)
|
|
116
|
+
return String(value);
|
|
117
|
+
return "a value";
|
|
118
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { RawTestserverAnswer, RawTestserverOutcome, RawTestserverRequest, TestserverFailure } from "../testserver/index.ts";
|
|
2
|
+
import type { FeatureFlagClient, FeatureFlagValue } from "./feature-flags.ts";
|
|
3
|
+
/** A container Testserver started, as `PUT /_/test` answers: its `id` (the test id) and its label. */
|
|
4
|
+
export interface ContainerInfo {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly name?: string;
|
|
7
|
+
}
|
|
8
|
+
/** One container start: the container `testId` selects, labeled with `name` and `meta`. */
|
|
9
|
+
export interface StartContainerRequest {
|
|
10
|
+
readonly testserverUrl: string;
|
|
11
|
+
readonly testId: string;
|
|
12
|
+
readonly name?: string;
|
|
13
|
+
readonly meta?: Readonly<Record<string, unknown>>;
|
|
14
|
+
}
|
|
15
|
+
export type StartContainerOutcome = {
|
|
16
|
+
readonly ok: true;
|
|
17
|
+
readonly info: ContainerInfo;
|
|
18
|
+
} | {
|
|
19
|
+
readonly ok: false;
|
|
20
|
+
readonly failure: TestserverFailure;
|
|
21
|
+
};
|
|
22
|
+
export type EndContainerOutcome = {
|
|
23
|
+
readonly ok: true;
|
|
24
|
+
} | {
|
|
25
|
+
readonly ok: false;
|
|
26
|
+
readonly failure: TestserverFailure;
|
|
27
|
+
};
|
|
28
|
+
/** The container `testId` selects on the Testserver sandbox at `testserverUrl`. */
|
|
29
|
+
export interface ContainerAddress {
|
|
30
|
+
readonly testserverUrl: string;
|
|
31
|
+
readonly testId: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* One record of a container log, as Testserver keeps it: one for each request or event a container's services
|
|
35
|
+
* logged. `id`, `timestamp`, `serviceId` and `message` are checked; anything else, such as `protocol`,
|
|
36
|
+
* `statusCode` or `stack`, passes through unchecked.
|
|
37
|
+
*/
|
|
38
|
+
export interface ContainerLogRecord {
|
|
39
|
+
/** Such as `L1001`, counting up within the container. */
|
|
40
|
+
readonly id: string;
|
|
41
|
+
/** An ISO 8601 time. */
|
|
42
|
+
readonly timestamp: string;
|
|
43
|
+
readonly serviceId: string;
|
|
44
|
+
readonly message: string;
|
|
45
|
+
readonly [key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
/** One service to start in the container `testId` selects: `serviceId`, one of Testserver's service ids. */
|
|
48
|
+
export interface WarmServiceRequest extends ContainerAddress {
|
|
49
|
+
readonly serviceId: string;
|
|
50
|
+
}
|
|
51
|
+
/** Whether a service answered its `readyz`, which Testserver answers only once the service has started. */
|
|
52
|
+
export type WarmServiceOutcome = {
|
|
53
|
+
readonly ok: true;
|
|
54
|
+
} | {
|
|
55
|
+
readonly ok: false;
|
|
56
|
+
readonly failure: TestserverFailure;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* One flag client's feature flags for the container `testId` selects: Testserver merges `flags` into the client's
|
|
60
|
+
* map and rewrites the flags datafile its services read once, when each starts.
|
|
61
|
+
*/
|
|
62
|
+
export interface SetFeatureFlagsRequest extends ContainerAddress {
|
|
63
|
+
readonly client: FeatureFlagClient;
|
|
64
|
+
readonly flags: Readonly<Record<string, FeatureFlagValue>>;
|
|
65
|
+
}
|
|
66
|
+
export type SetFeatureFlagsOutcome = {
|
|
67
|
+
readonly ok: true;
|
|
68
|
+
} | {
|
|
69
|
+
readonly ok: false;
|
|
70
|
+
readonly failure: TestserverFailure;
|
|
71
|
+
};
|
|
72
|
+
export type ReadLogOutcome = {
|
|
73
|
+
readonly ok: true;
|
|
74
|
+
readonly records: readonly ContainerLogRecord[];
|
|
75
|
+
} | {
|
|
76
|
+
readonly ok: false;
|
|
77
|
+
readonly failure: TestserverFailure;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* One API request to a container: a raw data-plane request, sent as given with the test id added, under the
|
|
81
|
+
* gateway's call timeout.
|
|
82
|
+
*/
|
|
83
|
+
export type ApiRequest = Omit<RawTestserverRequest, "timeoutMs">;
|
|
84
|
+
/** What Testserver answered an API request, whatever its status, the body read whole and decompressed. */
|
|
85
|
+
export type ApiAnswer = RawTestserverAnswer;
|
|
86
|
+
export type ApiRequestOutcome = RawTestserverOutcome;
|
|
87
|
+
/**
|
|
88
|
+
* Testserver's containers, one per test id. Ending is idempotent: ending a container that is gone succeeds. Any
|
|
89
|
+
* status answers an API request; what a status means is the caller's to decide. It never rejects: every failure
|
|
90
|
+
* is in the outcome.
|
|
91
|
+
*/
|
|
92
|
+
export interface ContainerGateway {
|
|
93
|
+
start(request: StartContainerRequest): Promise<StartContainerOutcome>;
|
|
94
|
+
end(request: ContainerAddress): Promise<EndContainerOutcome>;
|
|
95
|
+
/** Every record of the container's log Testserver keeps, finished or not, oldest first. */
|
|
96
|
+
readLog(request: ContainerAddress): Promise<ReadLogOutcome>;
|
|
97
|
+
sendApiRequest(request: ApiRequest): Promise<ApiRequestOutcome>;
|
|
98
|
+
/**
|
|
99
|
+
* Starts one of the container's services, if it hasn't started, by asking its `readyz`. It isn't an API request:
|
|
100
|
+
* nothing records it. A service that fails to start answers 500.
|
|
101
|
+
*/
|
|
102
|
+
warmService(request: WarmServiceRequest): Promise<WarmServiceOutcome>;
|
|
103
|
+
/**
|
|
104
|
+
* Merges one flag client's feature flags into the container's, which a service reads once, when it starts. A
|
|
105
|
+
* Testserver control-plane call, not an API request: nothing records it.
|
|
106
|
+
*/
|
|
107
|
+
setFeatureFlags(request: SetFeatureFlagsRequest): Promise<SetFeatureFlagsOutcome>;
|
|
108
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { type Container, type ContainerOptions, DEFAULT_START_TIMEOUT_MS, DEFAULT_TIMEOUT_MS, liveSdkContext, type SdkContext, type ServiceWarmup, type ServiceWarmupOutcome, START_ATTEMPTS, START_RETRY_DELAY_MS, startContainer, withContainer, } from "./container.ts";
|
|
2
|
+
export { checkFeatureFlags, FEATURE_FLAG_CLIENTS, type FeatureFlagClient, type FeatureFlags, featureFlagsKey, type FeatureFlagValue, normalizeFeatureFlags, } from "./feature-flags.ts";
|
|
3
|
+
export type { ContainerRequestBody, ContainerRequestInit } from "./api-request.ts";
|
|
4
|
+
export type { ApiAnswer, ApiRequest, ApiRequestOutcome, ContainerAddress, ContainerGateway, ContainerInfo, ContainerLogRecord, EndContainerOutcome, ReadLogOutcome, SetFeatureFlagsOutcome, SetFeatureFlagsRequest, StartContainerOutcome, StartContainerRequest, WarmServiceOutcome, WarmServiceRequest, } from "./gateways.ts";
|
|
5
|
+
export { liveContainerGateway, type LiveContainerOptions } from "./live/container-gateway.ts";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// The SDK's `container` module: starting and ending containers, with their feature flags, and the container handle
|
|
2
|
+
// that seeds them, sends API requests to them and reads their logs.
|
|
3
|
+
export { DEFAULT_START_TIMEOUT_MS, DEFAULT_TIMEOUT_MS, liveSdkContext, START_ATTEMPTS, START_RETRY_DELAY_MS, startContainer, withContainer, } from "./container.js";
|
|
4
|
+
export { checkFeatureFlags, FEATURE_FLAG_CLIENTS, featureFlagsKey, normalizeFeatureFlags, } from "./feature-flags.js";
|
|
5
|
+
export { liveContainerGateway } from "./live/container-gateway.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContainerGateway } from "../gateways.ts";
|
|
2
|
+
export interface LiveContainerOptions {
|
|
3
|
+
/**
|
|
4
|
+
* How long one call, response body included, may take: an end, a log read, an API request, a warmup or a flag
|
|
5
|
+
* client's feature flags.
|
|
6
|
+
*/
|
|
7
|
+
readonly timeoutMs: number;
|
|
8
|
+
/** How long one container start attempt, response body included, may take. */
|
|
9
|
+
readonly startTimeoutMs: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Containers over `fetch`: `PUT /_/test` (answering 201 with `{ id, name }`) starts one, `DELETE /_/test`
|
|
13
|
+
* (answering 204) ends one, `GET /_/log` reads its log, `GET /_/service/<id>/readyz` starts one of its services,
|
|
14
|
+
* `PATCH /_/external/flags/<client>` merges a flag client's feature flags into its flags datafile, and any other
|
|
15
|
+
* path is an API request to it, each with the `test-id` header.
|
|
16
|
+
*/
|
|
17
|
+
export declare function liveContainerGateway(options: LiveContainerOptions): ContainerGateway;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { BODY_EXCERPT_CHARS, requestTestserver, sendTestserverRequest } from "../../testserver/index.js";
|
|
3
|
+
const containerInfoSchema = z.object({ id: z.string(), name: z.string().optional() });
|
|
4
|
+
/** A container log as `GET /_/log` answers it: the checked fields typed, the rest passed through. */
|
|
5
|
+
const containerLogSchema = z.array(z.looseObject({ id: z.string(), timestamp: z.string(), serviceId: z.string(), message: z.string() }));
|
|
6
|
+
/**
|
|
7
|
+
* The container log's records, finished or not (`incomplete=true`), with Testserver's own services' left out (no
|
|
8
|
+
* `internal`) and no `after`, which Testserver answers with `[]` for a record it dropped. Testserver strips `/_/log`
|
|
9
|
+
* and routes what is left, here an empty path, to its logger's `GET /`.
|
|
10
|
+
*/
|
|
11
|
+
const LOG_PATH = "/_/log?incomplete=true";
|
|
12
|
+
/**
|
|
13
|
+
* Containers over `fetch`: `PUT /_/test` (answering 201 with `{ id, name }`) starts one, `DELETE /_/test`
|
|
14
|
+
* (answering 204) ends one, `GET /_/log` reads its log, `GET /_/service/<id>/readyz` starts one of its services,
|
|
15
|
+
* `PATCH /_/external/flags/<client>` merges a flag client's feature flags into its flags datafile, and any other
|
|
16
|
+
* path is an API request to it, each with the `test-id` header.
|
|
17
|
+
*/
|
|
18
|
+
export function liveContainerGateway(options) {
|
|
19
|
+
return {
|
|
20
|
+
start: (request) => start(options, request),
|
|
21
|
+
end: async (request) => {
|
|
22
|
+
const response = await requestTestserver({
|
|
23
|
+
...request,
|
|
24
|
+
method: "DELETE",
|
|
25
|
+
path: "/_/test",
|
|
26
|
+
timeoutMs: options.timeoutMs,
|
|
27
|
+
});
|
|
28
|
+
return response.ok ? { ok: true } : response;
|
|
29
|
+
},
|
|
30
|
+
readLog: async (request) => {
|
|
31
|
+
const response = await requestTestserver({
|
|
32
|
+
...request,
|
|
33
|
+
method: "GET",
|
|
34
|
+
path: LOG_PATH,
|
|
35
|
+
timeoutMs: options.timeoutMs,
|
|
36
|
+
});
|
|
37
|
+
if (!response.ok)
|
|
38
|
+
return response;
|
|
39
|
+
return parseLog(response.text);
|
|
40
|
+
},
|
|
41
|
+
sendApiRequest: (request) => sendTestserverRequest({ ...request, timeoutMs: options.timeoutMs }),
|
|
42
|
+
warmService: async ({ serviceId, ...address }) => {
|
|
43
|
+
// Testserver splits the path after `/_/service/` on `/` and starts the service the first part names, without
|
|
44
|
+
// decoding it, so the id goes in as it is; `container.warmup` refuses one that would change the path.
|
|
45
|
+
const response = await requestTestserver({
|
|
46
|
+
...address,
|
|
47
|
+
method: "GET",
|
|
48
|
+
path: `/_/service/${serviceId}/readyz`,
|
|
49
|
+
timeoutMs: options.timeoutMs,
|
|
50
|
+
});
|
|
51
|
+
return response.ok ? { ok: true } : response;
|
|
52
|
+
},
|
|
53
|
+
setFeatureFlags: async ({ client, flags, ...address }) => {
|
|
54
|
+
// Testserver answers with the client's merged map, which nothing reads.
|
|
55
|
+
const response = await requestTestserver({
|
|
56
|
+
...address,
|
|
57
|
+
method: "PATCH",
|
|
58
|
+
path: `/_/external/flags/${client}`,
|
|
59
|
+
body: flags,
|
|
60
|
+
timeoutMs: options.timeoutMs,
|
|
61
|
+
});
|
|
62
|
+
return response.ok ? { ok: true } : response;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async function start(options, request) {
|
|
67
|
+
const label = {
|
|
68
|
+
...(request.name === undefined ? {} : { name: request.name }),
|
|
69
|
+
...(request.meta === undefined ? {} : { meta: request.meta }),
|
|
70
|
+
};
|
|
71
|
+
const response = await requestTestserver({
|
|
72
|
+
testserverUrl: request.testserverUrl,
|
|
73
|
+
testId: request.testId,
|
|
74
|
+
method: "PUT",
|
|
75
|
+
path: "/_/test",
|
|
76
|
+
...(Object.keys(label).length === 0 ? {} : { body: label }),
|
|
77
|
+
timeoutMs: options.startTimeoutMs,
|
|
78
|
+
});
|
|
79
|
+
if (!response.ok)
|
|
80
|
+
return response;
|
|
81
|
+
let json;
|
|
82
|
+
try {
|
|
83
|
+
json = JSON.parse(response.text);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return {
|
|
87
|
+
ok: false,
|
|
88
|
+
failure: { kind: "malformed", detail: `not JSON: ${response.text.slice(0, BODY_EXCERPT_CHARS)}` },
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const info = containerInfoSchema.safeParse(json);
|
|
92
|
+
if (!info.success)
|
|
93
|
+
return { ok: false, failure: { kind: "malformed", detail: "no container id" } };
|
|
94
|
+
return { ok: true, info: { id: info.data.id, ...(info.data.name === undefined ? {} : { name: info.data.name }) } };
|
|
95
|
+
}
|
|
96
|
+
/** A container log answer's records. An ending container answers with an empty body. */
|
|
97
|
+
function parseLog(text) {
|
|
98
|
+
if (text === "")
|
|
99
|
+
return { ok: false, failure: { kind: "malformed", detail: "empty answer: the container is ending" } };
|
|
100
|
+
let json;
|
|
101
|
+
try {
|
|
102
|
+
json = JSON.parse(text);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return { ok: false, failure: { kind: "malformed", detail: `not JSON: ${text.slice(0, BODY_EXCERPT_CHARS)}` } };
|
|
106
|
+
}
|
|
107
|
+
const records = containerLogSchema.safeParse(json);
|
|
108
|
+
if (!records.success) {
|
|
109
|
+
const issue = records.error.issues[0];
|
|
110
|
+
const where = issue === undefined || issue.path.length === 0 ? "" : ` at ${issue.path.map(String).join(".")}`;
|
|
111
|
+
return { ok: false, failure: { kind: "malformed", detail: `not a container log${where}` } };
|
|
112
|
+
}
|
|
113
|
+
return { ok: true, records: records.data };
|
|
114
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import { type Clock, type TestserverFailure } from "../testserver/index.ts";
|
|
3
|
+
import { type AnyFactoryDefinition, type FactoryInput, type FactoryOutput } from "./definition.ts";
|
|
4
|
+
import type { FactoryGateway, FactoryOptions } from "./gateways.ts";
|
|
5
|
+
/**
|
|
6
|
+
* One factory call a container made, typed or untyped, for failure output. `input` is the data sent. A call whose
|
|
7
|
+
* input its definition rejected was never sent and has no record.
|
|
8
|
+
*/
|
|
9
|
+
export interface FactoryCall {
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly input: unknown;
|
|
12
|
+
readonly options?: FactoryOptions;
|
|
13
|
+
readonly outcome: {
|
|
14
|
+
readonly ok: true;
|
|
15
|
+
readonly response: unknown;
|
|
16
|
+
} | {
|
|
17
|
+
readonly ok: false;
|
|
18
|
+
readonly failure: TestserverFailure;
|
|
19
|
+
};
|
|
20
|
+
/** The SDK clock's reading when the call started, comparable with an API request's `startedAt`. */
|
|
21
|
+
readonly startedAt: number;
|
|
22
|
+
readonly durationMs: number;
|
|
23
|
+
}
|
|
24
|
+
/** What a factory call reaches the world through. */
|
|
25
|
+
export interface FactoryContext {
|
|
26
|
+
readonly factories: FactoryGateway;
|
|
27
|
+
readonly clock: Clock;
|
|
28
|
+
}
|
|
29
|
+
/** The container a factory call seeds, and what keeps its call records. */
|
|
30
|
+
export interface FactoryTarget {
|
|
31
|
+
readonly testserverUrl: string;
|
|
32
|
+
readonly testId: string;
|
|
33
|
+
/** Keeps the record of a call once it has ended, before the call resolves or rejects. */
|
|
34
|
+
readonly record: (call: FactoryCall) => void;
|
|
35
|
+
}
|
|
36
|
+
/** A factory definition rejected the data passed to it; nothing was sent. */
|
|
37
|
+
export declare class FactoryInputError extends Error {
|
|
38
|
+
readonly name = "FactoryInputError";
|
|
39
|
+
readonly path: string;
|
|
40
|
+
readonly issues: readonly z.core.$ZodIssue[];
|
|
41
|
+
constructor(path: string, message: string, issues?: readonly z.core.$ZodIssue[]);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A factory answered with a response its definition's output schema rejects: the definition has drifted from
|
|
45
|
+
* Testserver, or Testserver changed. The call record holds the response.
|
|
46
|
+
*/
|
|
47
|
+
export declare class FactoryOutputError extends Error {
|
|
48
|
+
readonly name = "FactoryOutputError";
|
|
49
|
+
readonly path: string;
|
|
50
|
+
readonly checkedAgainst: string;
|
|
51
|
+
readonly issues: readonly z.core.$ZodIssue[];
|
|
52
|
+
readonly response: unknown;
|
|
53
|
+
constructor(definition: AnyFactoryDefinition, issues: readonly z.core.$ZodIssue[], response: unknown);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Builds one entity through `definition`: checks `data` against its input schema, sends it, and returns the
|
|
57
|
+
* response parsed by its output schema. Throws a `FactoryInputError` before sending, a `TestserverCallError` when
|
|
58
|
+
* the call fails, and a `FactoryOutputError` when the response doesn't match the definition.
|
|
59
|
+
*/
|
|
60
|
+
export declare function buildFactory<D extends AnyFactoryDefinition>(context: FactoryContext, target: FactoryTarget, definition: D, data: FactoryInput<D>, options?: FactoryOptions): Promise<FactoryOutput<D>>;
|
|
61
|
+
/**
|
|
62
|
+
* Builds one entity through the factory at `path` (such as `tokens/tokens`) with no definition, returning the
|
|
63
|
+
* response unchecked: for reaching a factory before its definition exists. Throws a `FactoryInputError` for a
|
|
64
|
+
* malformed path and a `TestserverCallError` when the call fails.
|
|
65
|
+
*/
|
|
66
|
+
export declare function buildUntypedFactory(context: FactoryContext, target: FactoryTarget, path: string, data: unknown, options?: FactoryOptions): Promise<unknown>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { TestserverCallError } from "../testserver/index.js";
|
|
2
|
+
import { checkFactoryPath } from "./definition.js";
|
|
3
|
+
/** A factory definition rejected the data passed to it; nothing was sent. */
|
|
4
|
+
export class FactoryInputError extends Error {
|
|
5
|
+
name = "FactoryInputError";
|
|
6
|
+
path;
|
|
7
|
+
issues;
|
|
8
|
+
constructor(path, message, issues = []) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.path = path;
|
|
11
|
+
this.issues = issues;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A factory answered with a response its definition's output schema rejects: the definition has drifted from
|
|
16
|
+
* Testserver, or Testserver changed. The call record holds the response.
|
|
17
|
+
*/
|
|
18
|
+
export class FactoryOutputError extends Error {
|
|
19
|
+
name = "FactoryOutputError";
|
|
20
|
+
path;
|
|
21
|
+
checkedAgainst;
|
|
22
|
+
issues;
|
|
23
|
+
response;
|
|
24
|
+
constructor(definition, issues, response) {
|
|
25
|
+
super(`factory ${definition.path} answered with a response its definition, checked against vercel/api ${definition.checkedAgainst}, rejects${describeIssue(issues)}`);
|
|
26
|
+
this.path = definition.path;
|
|
27
|
+
this.checkedAgainst = definition.checkedAgainst;
|
|
28
|
+
this.issues = issues;
|
|
29
|
+
this.response = response;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Builds one entity through `definition`: checks `data` against its input schema, sends it, and returns the
|
|
34
|
+
* response parsed by its output schema. Throws a `FactoryInputError` before sending, a `TestserverCallError` when
|
|
35
|
+
* the call fails, and a `FactoryOutputError` when the response doesn't match the definition.
|
|
36
|
+
*/
|
|
37
|
+
export async function buildFactory(context, target, definition, data, options) {
|
|
38
|
+
const input = definition.input.safeParse(data);
|
|
39
|
+
if (!input.success) {
|
|
40
|
+
throw new FactoryInputError(definition.path, `factory ${definition.path} rejected its input${describeIssue(input.error.issues)}`, input.error.issues);
|
|
41
|
+
}
|
|
42
|
+
const response = await call(context, target, definition.path, input.data, options);
|
|
43
|
+
const output = definition.output.safeParse(response);
|
|
44
|
+
if (!output.success)
|
|
45
|
+
throw new FactoryOutputError(definition, output.error.issues, response);
|
|
46
|
+
return output.data;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Builds one entity through the factory at `path` (such as `tokens/tokens`) with no definition, returning the
|
|
50
|
+
* response unchecked: for reaching a factory before its definition exists. Throws a `FactoryInputError` for a
|
|
51
|
+
* malformed path and a `TestserverCallError` when the call fails.
|
|
52
|
+
*/
|
|
53
|
+
export async function buildUntypedFactory(context, target, path, data, options) {
|
|
54
|
+
const problem = checkFactoryPath(path);
|
|
55
|
+
if (problem !== undefined)
|
|
56
|
+
throw new FactoryInputError(path, problem);
|
|
57
|
+
return call(context, target, path, data, options);
|
|
58
|
+
}
|
|
59
|
+
async function call(context, target, path, data, options) {
|
|
60
|
+
const startedAt = context.clock.now();
|
|
61
|
+
const outcome = await context.factories.build({
|
|
62
|
+
testserverUrl: target.testserverUrl,
|
|
63
|
+
testId: target.testId,
|
|
64
|
+
path,
|
|
65
|
+
data,
|
|
66
|
+
...(options === undefined ? {} : { options }),
|
|
67
|
+
});
|
|
68
|
+
const durationMs = context.clock.now() - startedAt;
|
|
69
|
+
const record = (recorded) => {
|
|
70
|
+
target.record({
|
|
71
|
+
path,
|
|
72
|
+
input: data,
|
|
73
|
+
...(options === undefined ? {} : { options }),
|
|
74
|
+
outcome: recorded,
|
|
75
|
+
startedAt,
|
|
76
|
+
durationMs,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
if (!outcome.ok) {
|
|
80
|
+
record({ ok: false, failure: outcome.failure });
|
|
81
|
+
throw new TestserverCallError({
|
|
82
|
+
call: { method: "POST", path: `/_/factories/${path}` },
|
|
83
|
+
testId: target.testId,
|
|
84
|
+
testserverUrl: target.testserverUrl,
|
|
85
|
+
failure: outcome.failure,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
record({ ok: true, response: outcome.body });
|
|
89
|
+
return outcome.body;
|
|
90
|
+
}
|
|
91
|
+
/** `: <message>` for the first issue, with ` at <field>` when it has a path. */
|
|
92
|
+
function describeIssue(issues) {
|
|
93
|
+
const issue = issues[0];
|
|
94
|
+
if (issue === undefined)
|
|
95
|
+
return "";
|
|
96
|
+
const field = issue.path.length === 0 ? "" : ` at ${issue.path.map(String).join(".")}`;
|
|
97
|
+
return `${field}: ${issue.message}`;
|
|
98
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* storm's typed, schema-checked description of one factory.
|
|
4
|
+
*
|
|
5
|
+
* - `path` is the factory's path under `/_/factories/`, with `/` for nesting (`tokens/tokens`).
|
|
6
|
+
* - `checkedAgainst` is the `vercel/api` commit the schemas were checked against.
|
|
7
|
+
* - `input` is strict: an unknown field is rejected before anything is sent, because Testserver may ignore it.
|
|
8
|
+
* - `output` is loose: declared fields are checked and typed, and the rest pass through untyped.
|
|
9
|
+
*/
|
|
10
|
+
export interface FactoryDefinition<InputShape extends z.core.$ZodShape, OutputShape extends z.core.$ZodShape> {
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly checkedAgainst: string;
|
|
13
|
+
readonly input: z.ZodObject<InputShape, z.core.$strict>;
|
|
14
|
+
readonly output: z.ZodObject<OutputShape, z.core.$loose>;
|
|
15
|
+
}
|
|
16
|
+
/** Any factory definition. */
|
|
17
|
+
export type AnyFactoryDefinition = FactoryDefinition<z.core.$ZodShape, z.core.$ZodShape>;
|
|
18
|
+
/** What a definition's factory takes. */
|
|
19
|
+
export type FactoryInput<D extends AnyFactoryDefinition> = z.input<D["input"]>;
|
|
20
|
+
/** What a definition's factory returns, past its output schema. */
|
|
21
|
+
export type FactoryOutput<D extends AnyFactoryDefinition> = z.output<D["output"]>;
|
|
22
|
+
/**
|
|
23
|
+
* Why `path` is no factory path, or `undefined` when it is one or more `/`-separated names of letters, digits,
|
|
24
|
+
* `_` and `-`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function checkFactoryPath(path: string): string | undefined;
|
|
27
|
+
/** Declares a factory definition. */
|
|
28
|
+
export declare function defineFactory<InputShape extends z.core.$ZodShape, OutputShape extends z.core.$ZodShape>(definition: FactoryDefinition<InputShape, OutputShape>): FactoryDefinition<InputShape, OutputShape>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why `path` is no factory path, or `undefined` when it is one or more `/`-separated names of letters, digits,
|
|
3
|
+
* `_` and `-`.
|
|
4
|
+
*/
|
|
5
|
+
export function checkFactoryPath(path) {
|
|
6
|
+
return /^[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*$/.test(path)
|
|
7
|
+
? undefined
|
|
8
|
+
: `factory path ${JSON.stringify(path)} must be names of letters, digits, "_" and "-", separated by "/"`;
|
|
9
|
+
}
|
|
10
|
+
/** Declares a factory definition. */
|
|
11
|
+
export function defineFactory(definition) {
|
|
12
|
+
const problem = checkFactoryPath(definition.path);
|
|
13
|
+
if (problem !== undefined)
|
|
14
|
+
throw new TypeError(problem);
|
|
15
|
+
return definition;
|
|
16
|
+
}
|