@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,236 @@
|
|
|
1
|
+
import { brotliDecompressSync, gunzipSync, inflateSync } from "node:zlib";
|
|
2
|
+
/**
|
|
3
|
+
* The most bytes of a body a request record keeps, as sent and after decompressing; a bigger one is noted, not
|
|
4
|
+
* kept.
|
|
5
|
+
*/
|
|
6
|
+
export const RECORDED_BODY_CAP_BYTES = 256 * 1024;
|
|
7
|
+
/** A JSON body nested deeper than this many arrays and objects is noted, not kept. */
|
|
8
|
+
const RECORDED_BODY_MAX_DEPTH = 64;
|
|
9
|
+
/** What a body is recorded as in place of a token. */
|
|
10
|
+
export const REDACTED = "<token>";
|
|
11
|
+
/** Body fields whose string value is a token or a secret, replaced by `<token>` in a record. */
|
|
12
|
+
const TOKEN_FIELDS = new Set([
|
|
13
|
+
"token",
|
|
14
|
+
"bearerToken",
|
|
15
|
+
"accessToken",
|
|
16
|
+
"refreshToken",
|
|
17
|
+
"idToken",
|
|
18
|
+
"access_token",
|
|
19
|
+
"refresh_token",
|
|
20
|
+
"id_token",
|
|
21
|
+
"secretString",
|
|
22
|
+
"encryptedToken",
|
|
23
|
+
"clientSecret",
|
|
24
|
+
"client_secret",
|
|
25
|
+
"sysToken",
|
|
26
|
+
"deploymentSecret",
|
|
27
|
+
]);
|
|
28
|
+
/** Collects a body as it streams through, keeping at most `RECORDED_BODY_CAP_BYTES` of it. */
|
|
29
|
+
export class BodyCapture {
|
|
30
|
+
#chunks = [];
|
|
31
|
+
#bytes = 0;
|
|
32
|
+
push(chunk) {
|
|
33
|
+
this.#bytes += chunk.byteLength;
|
|
34
|
+
if (this.#bytes <= RECORDED_BODY_CAP_BYTES)
|
|
35
|
+
this.#chunks.push(chunk);
|
|
36
|
+
}
|
|
37
|
+
/** The whole body, decoded by `headers`; `undefined` when it was empty. */
|
|
38
|
+
complete(headers, bearer) {
|
|
39
|
+
return recordedBody(Buffer.concat(this.#chunks), this.#bytes, headers, bearer);
|
|
40
|
+
}
|
|
41
|
+
/** A body that broke off partway; `undefined` when none of it arrived. */
|
|
42
|
+
incomplete(headers) {
|
|
43
|
+
if (this.#bytes === 0)
|
|
44
|
+
return undefined;
|
|
45
|
+
return omitted("incomplete", this.#bytes, headers);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A request or response body as a record keeps it: decoded by `headers`, capped, and redacted with the request's own
|
|
50
|
+
* bearer token. The body was `bytes` bytes long, and `kept` holds all of it unless it was over
|
|
51
|
+
* `RECORDED_BODY_CAP_BYTES`, when it is ignored. `undefined` for an empty body. The proxy's `BodyCapture` and an API
|
|
52
|
+
* request's whole body both come through here.
|
|
53
|
+
*/
|
|
54
|
+
export function recordedBody(kept, bytes, headers, bearer) {
|
|
55
|
+
if (bytes === 0)
|
|
56
|
+
return undefined;
|
|
57
|
+
const raw = bytes > RECORDED_BODY_CAP_BYTES ? undefined : kept;
|
|
58
|
+
return redactBody(decodeBody(raw, bytes, headers), bearer);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The record of a body of `bytes` bytes sent with `headers`. `raw` is the body as sent, or `undefined` when it was
|
|
62
|
+
* over the cap. Decompresses gzip, deflate and br, then decodes by `content-type`.
|
|
63
|
+
*/
|
|
64
|
+
export function decodeBody(raw, bytes, headers) {
|
|
65
|
+
if (raw === undefined)
|
|
66
|
+
return omitted("too-large", bytes, headers);
|
|
67
|
+
const decompressed = decompress(raw, headerText(headers["content-encoding"]));
|
|
68
|
+
if (decompressed === "too-large" || decompressed === "undecodable")
|
|
69
|
+
return omitted(decompressed, bytes, headers);
|
|
70
|
+
const mediaType = (headerText(headers["content-type"]) ?? "").split(";")[0]?.trim().toLowerCase() ?? "";
|
|
71
|
+
const text = utf8(decompressed);
|
|
72
|
+
if (mediaType === "" || /(^|[/+])json$/.test(mediaType)) {
|
|
73
|
+
if (text === undefined)
|
|
74
|
+
return omitted("binary", bytes, headers);
|
|
75
|
+
let value;
|
|
76
|
+
try {
|
|
77
|
+
value = JSON.parse(text);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return mediaType === "" ? omitted("binary", bytes, headers) : { kind: "text", text };
|
|
81
|
+
}
|
|
82
|
+
if (nestsDeeperThan(value, RECORDED_BODY_MAX_DEPTH))
|
|
83
|
+
return omitted("too-deep", bytes, headers);
|
|
84
|
+
return { kind: "json", value };
|
|
85
|
+
}
|
|
86
|
+
if (mediaType === "application/x-www-form-urlencoded" && text !== undefined) {
|
|
87
|
+
return { kind: "form", fields: parseParams(new URLSearchParams(text)) };
|
|
88
|
+
}
|
|
89
|
+
if ((mediaType.startsWith("text/") || /(^|[/+])xml$/.test(mediaType)) && text !== undefined) {
|
|
90
|
+
return { kind: "text", text };
|
|
91
|
+
}
|
|
92
|
+
return omitted("binary", bytes, headers);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* `body` with every token field's string value, directly or inside arrays, replaced by `<token>`, and `bearer`, the
|
|
96
|
+
* request's own bearer token, replaced wherever it appears. An object under a token field is redacted like any
|
|
97
|
+
* other. Expects a body from `decodeBody`, whose JSON nesting is bounded; `recordedBody` composes the two.
|
|
98
|
+
*/
|
|
99
|
+
export function redactBody(body, bearer) {
|
|
100
|
+
const scrub = (text) => (bearer === undefined ? text : redactSecrets(text, [bearer]));
|
|
101
|
+
switch (body.kind) {
|
|
102
|
+
case "json":
|
|
103
|
+
return { kind: "json", value: redactValue(body.value, scrub) };
|
|
104
|
+
case "form":
|
|
105
|
+
return { kind: "form", fields: redactFields(body.fields, scrub) };
|
|
106
|
+
case "text":
|
|
107
|
+
return { kind: "text", text: scrub(body.text) };
|
|
108
|
+
case "omitted":
|
|
109
|
+
return body;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* `value` with every token field's string value, directly or inside arrays, replaced by `<token>`, as a JSON body's
|
|
114
|
+
* are in a record. An object under a token field is redacted like any other. For printing a value no record holds,
|
|
115
|
+
* such as a factory call's input or response.
|
|
116
|
+
*/
|
|
117
|
+
export function redactTokenFields(value) {
|
|
118
|
+
return redactValue(value, (text) => text);
|
|
119
|
+
}
|
|
120
|
+
/** `value` redacted; `token` says a string here is a token, as under a token field, directly or through arrays. */
|
|
121
|
+
function redactValue(value, scrub, token = false) {
|
|
122
|
+
if (typeof value === "string")
|
|
123
|
+
return token ? REDACTED : scrub(value);
|
|
124
|
+
if (Array.isArray(value))
|
|
125
|
+
return value.map((each) => redactValue(each, scrub, token));
|
|
126
|
+
if (typeof value === "object" && value !== null) {
|
|
127
|
+
const redacted = new Map();
|
|
128
|
+
for (const [key, each] of Object.entries(value))
|
|
129
|
+
redacted.set(key, redactValue(each, scrub, TOKEN_FIELDS.has(key)));
|
|
130
|
+
return Object.fromEntries(redacted);
|
|
131
|
+
}
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Every non-empty string under a token field in `value`, directly or inside arrays, as `redactBody` would replace
|
|
136
|
+
* it. An object under a token field is searched like any other. Looks no deeper than `RECORDED_BODY_MAX_DEPTH` levels.
|
|
137
|
+
*/
|
|
138
|
+
export function tokenSecrets(value) {
|
|
139
|
+
const secrets = new Set();
|
|
140
|
+
const visit = (each, token, depth) => {
|
|
141
|
+
if (typeof each === "string") {
|
|
142
|
+
if (token && each !== "")
|
|
143
|
+
secrets.add(each);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (depth > RECORDED_BODY_MAX_DEPTH)
|
|
147
|
+
return;
|
|
148
|
+
if (Array.isArray(each)) {
|
|
149
|
+
for (const item of each)
|
|
150
|
+
visit(item, token, depth + 1);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (typeof each === "object" && each !== null) {
|
|
154
|
+
for (const [key, item] of Object.entries(each))
|
|
155
|
+
visit(item, TOKEN_FIELDS.has(key), depth + 1);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
visit(value, false, 0);
|
|
159
|
+
return secrets;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* `text` with every one of `secrets` replaced by `<token>` wherever it appears, longest first, so a secret that holds
|
|
163
|
+
* another is replaced whole. An empty secret is skipped. A container's `redact` and the Vercel CLI driver's use it.
|
|
164
|
+
*/
|
|
165
|
+
export function redactSecrets(text, secrets) {
|
|
166
|
+
const ordered = [...secrets].filter((secret) => secret !== "").toSorted((a, b) => b.length - a.length);
|
|
167
|
+
return ordered.reduce((redacted, secret) => redacted.split(secret).join(REDACTED), text);
|
|
168
|
+
}
|
|
169
|
+
/** Whether `value` nests more than `limit` arrays and objects; looks no deeper than `limit + 1` levels. */
|
|
170
|
+
function nestsDeeperThan(value, limit) {
|
|
171
|
+
if (typeof value !== "object" || value === null)
|
|
172
|
+
return false;
|
|
173
|
+
if (limit === 0)
|
|
174
|
+
return true;
|
|
175
|
+
const children = Array.isArray(value) ? value : Object.values(value);
|
|
176
|
+
return children.some((each) => nestsDeeperThan(each, limit - 1));
|
|
177
|
+
}
|
|
178
|
+
function redactFields(fields, scrub) {
|
|
179
|
+
const redacted = new Map();
|
|
180
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
181
|
+
const each = (text) => (TOKEN_FIELDS.has(key) ? REDACTED : scrub(text));
|
|
182
|
+
redacted.set(key, typeof value === "string" ? each(value) : value.map(each));
|
|
183
|
+
}
|
|
184
|
+
return Object.fromEntries(redacted);
|
|
185
|
+
}
|
|
186
|
+
/** The bearer token in an `authorization` header, such as `Bearer abc`, or `undefined`. */
|
|
187
|
+
export function bearerToken(authorization) {
|
|
188
|
+
const match = /^\s*bearer\s+(\S+)\s*$/i.exec(authorization ?? "");
|
|
189
|
+
return match?.[1];
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Parsed search params; a key given more than once maps to every value, in order. Collects into a `Map` so a key
|
|
193
|
+
* such as `__proto__` becomes a plain own property.
|
|
194
|
+
*/
|
|
195
|
+
export function parseParams(params) {
|
|
196
|
+
const parsed = new Map();
|
|
197
|
+
for (const [key, value] of params) {
|
|
198
|
+
const existing = parsed.get(key);
|
|
199
|
+
parsed.set(key, existing === undefined ? value : [...(Array.isArray(existing) ? existing : [existing]), value]);
|
|
200
|
+
}
|
|
201
|
+
return Object.fromEntries(parsed);
|
|
202
|
+
}
|
|
203
|
+
function decompress(raw, encoding) {
|
|
204
|
+
const name = (encoding ?? "").trim().toLowerCase();
|
|
205
|
+
if (name === "" || name === "identity")
|
|
206
|
+
return raw;
|
|
207
|
+
const limit = { maxOutputLength: RECORDED_BODY_CAP_BYTES };
|
|
208
|
+
try {
|
|
209
|
+
if (name === "gzip" || name === "x-gzip")
|
|
210
|
+
return gunzipSync(raw, limit);
|
|
211
|
+
if (name === "deflate")
|
|
212
|
+
return inflateSync(raw, limit);
|
|
213
|
+
if (name === "br")
|
|
214
|
+
return brotliDecompressSync(raw, limit);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
return error.code === "ERR_BUFFER_TOO_LARGE" ? "too-large" : "undecodable";
|
|
218
|
+
}
|
|
219
|
+
return "undecodable";
|
|
220
|
+
}
|
|
221
|
+
function utf8(bytes) {
|
|
222
|
+
try {
|
|
223
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function omitted(reason, bytes, headers) {
|
|
230
|
+
const contentType = headerText(headers["content-type"]);
|
|
231
|
+
return { kind: "omitted", reason, bytes, ...(contentType === undefined ? {} : { contentType }) };
|
|
232
|
+
}
|
|
233
|
+
/** A header's value as one string, a repeated header's values joined with `, `. */
|
|
234
|
+
export function headerText(value) {
|
|
235
|
+
return typeof value === "string" || value === undefined ? value : value.join(", ");
|
|
236
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { bearerToken, BodyCapture, decodeBody, headerText, parseParams, RECORDED_BODY_CAP_BYTES, type RecordedBody, recordedBody, REDACTED, redactBody, redactSecrets, redactTokenFields, tokenSecrets, } from "./body.ts";
|
|
2
|
+
export { type ApiRequestRecord, incomingHeaders, type RequestOutcome, type RequestRecordFields, splitTarget, } from "./records.ts";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// The SDK's `records` module: how request records are kept, shared by the proxy's records and a container's API
|
|
2
|
+
// requests. Bodies are decoded, capped and redacted here, and the fields every record holds are defined here.
|
|
3
|
+
export { bearerToken, BodyCapture, decodeBody, headerText, parseParams, RECORDED_BODY_CAP_BYTES, recordedBody, REDACTED, redactBody, redactSecrets, redactTokenFields, tokenSecrets, } from "./body.js";
|
|
4
|
+
export { incomingHeaders, splitTarget, } from "./records.js";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { IncomingHttpHeaders } from "node:http";
|
|
2
|
+
import { type RecordedBody } from "./body.ts";
|
|
3
|
+
/**
|
|
4
|
+
* The fields every request record holds, the proxy's and an API request's, besides how it ended: what was sent,
|
|
5
|
+
* when, and what came back. No token reaches a record (`body.ts`).
|
|
6
|
+
*/
|
|
7
|
+
export type RequestRecordFields = {
|
|
8
|
+
readonly method: string;
|
|
9
|
+
/** The request target exactly as sent, such as `/v9/projects?teamId=t1`. */
|
|
10
|
+
readonly url: string;
|
|
11
|
+
readonly path: string;
|
|
12
|
+
/** The query, parsed; a key given more than once maps to every value, in order. */
|
|
13
|
+
readonly query: Readonly<Record<string, string | readonly string[]>>;
|
|
14
|
+
/** Whether the request carried an `authorization` header. Its value is never recorded. */
|
|
15
|
+
readonly authorization: boolean;
|
|
16
|
+
/** Absent for an empty body. */
|
|
17
|
+
readonly requestBody?: RecordedBody;
|
|
18
|
+
/** Absent for an empty body, or when no answer arrived. */
|
|
19
|
+
readonly responseBody?: RecordedBody;
|
|
20
|
+
/**
|
|
21
|
+
* The clock's reading when the request started: for an API request the SDK clock's when `fetch` was called,
|
|
22
|
+
* comparable with a factory call's `startedAt`; for a proxy record the proxy's clock's at its arrival.
|
|
23
|
+
*/
|
|
24
|
+
readonly startedAt: number;
|
|
25
|
+
/** From the request's start until its exchange ended. */
|
|
26
|
+
readonly durationMs: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* How a request ended: Testserver's status, with an error if the answer broke off or was refused, or why no answer
|
|
30
|
+
* arrived.
|
|
31
|
+
*/
|
|
32
|
+
export type RequestOutcome = {
|
|
33
|
+
readonly status: number;
|
|
34
|
+
/** Why the answer broke off after its status arrived, or why its status fails the call. */
|
|
35
|
+
readonly error?: string;
|
|
36
|
+
}
|
|
37
|
+
/** No answer arrived. */
|
|
38
|
+
| {
|
|
39
|
+
readonly error: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* One API request a container sent with `container.fetch`, recorded once its answer was read or the request
|
|
43
|
+
* failed. It holds a proxy record's fields but `userAgent` and `sessionId`, and is never open.
|
|
44
|
+
*/
|
|
45
|
+
export type ApiRequestRecord = RequestRecordFields & RequestOutcome;
|
|
46
|
+
/** The path and parsed query of a request target such as `/v2/user?teamId=t1`. */
|
|
47
|
+
export declare function splitTarget(target: string): Pick<RequestRecordFields, "path" | "query">;
|
|
48
|
+
/** `headers` as Node's `IncomingHttpHeaders`, names lowercased, a repeated header's values in an array. */
|
|
49
|
+
export declare function incomingHeaders(headers: Iterable<readonly [string, string]>): IncomingHttpHeaders;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { parseParams } from "./body.js";
|
|
2
|
+
/** The path and parsed query of a request target such as `/v2/user?teamId=t1`. */
|
|
3
|
+
export function splitTarget(target) {
|
|
4
|
+
const url = new URL(target, "http://record.invalid");
|
|
5
|
+
return { path: url.pathname, query: parseParams(url.searchParams) };
|
|
6
|
+
}
|
|
7
|
+
/** `headers` as Node's `IncomingHttpHeaders`, names lowercased, a repeated header's values in an array. */
|
|
8
|
+
export function incomingHeaders(headers) {
|
|
9
|
+
const collected = new Map();
|
|
10
|
+
for (const [name, value] of headers) {
|
|
11
|
+
const key = name.toLowerCase();
|
|
12
|
+
const existing = collected.get(key);
|
|
13
|
+
collected.set(key, existing === undefined ? value : [...(Array.isArray(existing) ? existing : [existing]), value]);
|
|
14
|
+
}
|
|
15
|
+
return Object.fromEntries(collected);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type Login, type LoginOptions, type LoginProjectOption, type LoginTeamOptions, type SeededProject, type SeedProjectFields, type SeededTeam, type SeededTeamlessUser, type SeededToken, type SeededUser, type SeedTeamMember, type SeedDefaultTeamFields, type SeedUserFields, type Seeder, seeder, type SeederOptions, type TeamPolicies, type TeamPolicy, type TeamRole, } from "./seed.ts";
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import type { Container } from "../container/index.ts";
|
|
2
|
+
import { factories, type FactoryInput, type FactoryOutput } from "../factories/index.ts";
|
|
3
|
+
/** A seeded user and the team it acts in by default: its `defaultTeamId` names `defaultTeam`, which it owns. */
|
|
4
|
+
export type SeededUser = FactoryOutput<typeof factories.users> & {
|
|
5
|
+
readonly defaultTeam: SeededTeam;
|
|
6
|
+
};
|
|
7
|
+
/** A teamless user: a seeded user on no team, with no `defaultTeamId`, as `seed.teamlessUser()` seeds it. */
|
|
8
|
+
export type SeededTeamlessUser = FactoryOutput<typeof factories.users>;
|
|
9
|
+
/** A team membership role, such as `OWNER`, `MEMBER` or `DEVELOPER`. */
|
|
10
|
+
export type TeamRole = NonNullable<FactoryInput<typeof factories.teams>["members"]>[number]["role"];
|
|
11
|
+
/**
|
|
12
|
+
* One member `seed.team` seeds besides its owner: a seeded user, its role (default `MEMBER`), and whether it is
|
|
13
|
+
* confirmed (default `true`, or `false` with an access request). A pending member (`confirmed: false`) has not joined
|
|
14
|
+
* yet. `accessRequest` makes it a member who requested access: `at` becomes its `accessRequestedAt`, and `joinedFrom`
|
|
15
|
+
* says where it requested from, such as `{ origin: "github", gitUserLogin }`. An access request with
|
|
16
|
+
* `confirmed: true` is a `TypeError`.
|
|
17
|
+
*/
|
|
18
|
+
export interface SeedTeamMember {
|
|
19
|
+
readonly user: {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
};
|
|
22
|
+
readonly role?: TeamRole;
|
|
23
|
+
readonly confirmed?: boolean;
|
|
24
|
+
readonly accessRequest?: {
|
|
25
|
+
readonly at: number;
|
|
26
|
+
readonly joinedFrom: {
|
|
27
|
+
readonly origin: string;
|
|
28
|
+
readonly gitUserLogin?: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** The fields `seed.user` and `seed.teamlessUser` set on a user. */
|
|
33
|
+
export interface SeedUserFields {
|
|
34
|
+
readonly username?: string;
|
|
35
|
+
readonly name?: string;
|
|
36
|
+
readonly email?: string;
|
|
37
|
+
}
|
|
38
|
+
/** A seeded team. */
|
|
39
|
+
export type SeededTeam = FactoryOutput<typeof factories.teams>;
|
|
40
|
+
/** A team env var policy's setting, as the `teams` factory takes it: `"default"`, `"on"` or `"off"`. */
|
|
41
|
+
export type TeamPolicy = NonNullable<FactoryInput<typeof factories.teams>["sensitiveEnvironmentVariablePolicy"]>;
|
|
42
|
+
/**
|
|
43
|
+
* A team's env var policies, each passed on to the `teams` factory only when given: the factory defaults
|
|
44
|
+
* `sensitiveEnvironmentVariablePolicy` to `"default"` and leaves `disjunctiveProductionSecretPolicy` unset.
|
|
45
|
+
*/
|
|
46
|
+
export interface TeamPolicies {
|
|
47
|
+
readonly sensitiveEnvironmentVariablePolicy?: TeamPolicy;
|
|
48
|
+
readonly disjunctiveProductionSecretPolicy?: TeamPolicy;
|
|
49
|
+
}
|
|
50
|
+
/** A user's default team, as `seed.user` and `seed.login` take it: its slug and its env var policies. */
|
|
51
|
+
export interface SeedDefaultTeamFields extends TeamPolicies {
|
|
52
|
+
readonly slug?: string;
|
|
53
|
+
}
|
|
54
|
+
/** A seeded project. */
|
|
55
|
+
export type SeededProject = FactoryOutput<typeof factories.projects>;
|
|
56
|
+
/** A seeded token. `secretString` authenticates as its user in the container that seeded it. */
|
|
57
|
+
export type SeededToken = FactoryOutput<typeof factories.tokens.tokens>;
|
|
58
|
+
/** One extra team `seed.login` seeds for the user. */
|
|
59
|
+
export interface LoginTeamOptions {
|
|
60
|
+
/** The start of its slug, `<prefix>-<8 hex>`; default `team`. */
|
|
61
|
+
readonly prefix?: string;
|
|
62
|
+
/** Makes it a SAML-enforced team. */
|
|
63
|
+
readonly saml?: boolean;
|
|
64
|
+
/** Gives the login's token a SAML scope for it, so the token reaches it. Needs `saml: true`. */
|
|
65
|
+
readonly samlScope?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/** The fields `seed.project` sets on a project besides the team that owns it. */
|
|
68
|
+
export interface SeedProjectFields {
|
|
69
|
+
readonly name?: string;
|
|
70
|
+
/** A framework slug such as `nextjs`, or `null` for "Other". */
|
|
71
|
+
readonly framework?: string | null;
|
|
72
|
+
readonly buildCommand?: string | null;
|
|
73
|
+
readonly rootDirectory?: string | null;
|
|
74
|
+
/**
|
|
75
|
+
* Links the project to a GitHub repository: `link: { type: "github", org, repo, repoId }`, with a random integer
|
|
76
|
+
* `repoId` when none is given. `GET /v9/projects?repoUrl=` finds the project by `org` and `repo`.
|
|
77
|
+
*/
|
|
78
|
+
readonly git?: {
|
|
79
|
+
readonly org: string;
|
|
80
|
+
readonly repo: string;
|
|
81
|
+
readonly repoId?: number;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** `seed.login`'s project option: `true`, or the fields `seed.project` takes besides its team. */
|
|
85
|
+
export type LoginProjectOption = true | SeedProjectFields;
|
|
86
|
+
/** What `seed.login` seeds besides the user, its default team and the token. */
|
|
87
|
+
export interface LoginOptions<Teams extends readonly LoginTeamOptions[] = readonly LoginTeamOptions[], Project extends LoginProjectOption | undefined = LoginProjectOption | undefined> {
|
|
88
|
+
/** A project the default team owns. */
|
|
89
|
+
readonly project?: Project;
|
|
90
|
+
/**
|
|
91
|
+
* `"team"`, the default, sets the token's `teamId` to the default team; `"user"` sets none. Either way the token
|
|
92
|
+
* keeps the user scope.
|
|
93
|
+
*/
|
|
94
|
+
readonly token?: "team" | "user";
|
|
95
|
+
/** Extra teams the user owns, in order. */
|
|
96
|
+
readonly teams?: Teams;
|
|
97
|
+
/**
|
|
98
|
+
* The default team's slug and env var policies, as `seed.user`'s `team` takes them. A fixed slug such as `vercel`
|
|
99
|
+
* may collide with one an earlier test in the same container seeded.
|
|
100
|
+
*/
|
|
101
|
+
readonly team?: SeedDefaultTeamFields;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A login: a seeded user, its default team, a token that acts as the user, the extra teams, one per entry of the
|
|
105
|
+
* `teams` option in order, and the project when the `project` option is set. It passes as it is to the Vercel CLI
|
|
106
|
+
* driver's `actAs`.
|
|
107
|
+
*/
|
|
108
|
+
export type Login<Teams extends readonly LoginTeamOptions[] = readonly LoginTeamOptions[], Project extends LoginProjectOption | undefined = LoginProjectOption | undefined> = {
|
|
109
|
+
readonly user: SeededUser;
|
|
110
|
+
/** The user's default team, `user.defaultTeam`. */
|
|
111
|
+
readonly team: SeededTeam;
|
|
112
|
+
readonly token: SeededToken;
|
|
113
|
+
readonly teams: {
|
|
114
|
+
readonly [K in keyof Teams]: SeededTeam;
|
|
115
|
+
};
|
|
116
|
+
} & ([Project] extends [undefined] ? {
|
|
117
|
+
readonly project?: undefined;
|
|
118
|
+
} : undefined extends Project ? {
|
|
119
|
+
readonly project?: SeededProject;
|
|
120
|
+
} : {
|
|
121
|
+
readonly project: SeededProject;
|
|
122
|
+
});
|
|
123
|
+
/**
|
|
124
|
+
* Seeds a container with users, teams, projects and tokens, one entity-level call each, encoding what Testserver
|
|
125
|
+
* needs of them: every team member is a seeded user with its own `createdAt`, which the API pages members by, a user
|
|
126
|
+
* names a team it belongs to as its default unless it is a teamless user, and a team has a slug for `--scope`. Every
|
|
127
|
+
* team it seeds is Pro (`billing: { plan: "pro", period: "monthly" }`, where the `teams` factory defaults to Hobby) and
|
|
128
|
+
* named for its slug. `seed.team` takes each member's role, pending members and access requests; `container.build`
|
|
129
|
+
* stays the way to seed a team on another plan or with an invoice recipient (`billing.email`), and anything else these
|
|
130
|
+
* calls don't cover.
|
|
131
|
+
*/
|
|
132
|
+
export interface Seeder {
|
|
133
|
+
/**
|
|
134
|
+
* Seeds a user and its default team: the team id is chosen first, so the user is built with `defaultTeamId`
|
|
135
|
+
* naming it, then the team with a `team-<8 hex>` slug, or `team.slug`, and the user as its one confirmed owner,
|
|
136
|
+
* joined (`created` and `createdAt`) at the seeder's `now()`. `team`'s env var policies are set on the default team
|
|
137
|
+
* when it is seeded, as `seed.team` sets them; a test that must seed env vars before a policy is on turns it on
|
|
138
|
+
* later through `PATCH /v2/teams/:teamId`.
|
|
139
|
+
*/
|
|
140
|
+
user(input?: SeedUserFields & {
|
|
141
|
+
readonly team?: SeedDefaultTeamFields;
|
|
142
|
+
}): Promise<SeededUser>;
|
|
143
|
+
/**
|
|
144
|
+
* Seeds a teamless user: the user alone, on no team, with no `defaultTeamId`, which the API's user type allows to
|
|
145
|
+
* be missing but not `null`.
|
|
146
|
+
*/
|
|
147
|
+
teamlessUser(input?: SeedUserFields): Promise<SeededTeamlessUser>;
|
|
148
|
+
/**
|
|
149
|
+
* Seeds a team with a `team-<8 hex>` slug, or `slug`, `owner` as its confirmed owner and each of `members` as a
|
|
150
|
+
* member, with its role (default `MEMBER`), confirmed unless it says otherwise or requested access (`SeedTeamMember`).
|
|
151
|
+
* The owner joined (`created` and `createdAt`) at the seeder's `now()`, and member `i` (from 0, in the order given)
|
|
152
|
+
* at `now() + i + 1`, so `GET /v2/teams/:teamId/members` pages through them in order. `saml: true` makes it a
|
|
153
|
+
* SAML-enforced team with an active `OktaSAML` connection, connected at the seeder's `now()`, which a token reaches
|
|
154
|
+
* only through a team scope for it. `sensitiveEnvironmentVariablePolicy` and `disjunctiveProductionSecretPolicy`
|
|
155
|
+
* (`"default"`, `"on"` or `"off"`) set the team's env var policies, and are passed on only when given: the factory
|
|
156
|
+
* defaults the first to `"default"` and leaves the second unset. A member with an access request and
|
|
157
|
+
* `confirmed: true` is a `TypeError`, thrown before anything is seeded.
|
|
158
|
+
*/
|
|
159
|
+
team(input: TeamPolicies & {
|
|
160
|
+
readonly owner: FactoryOutput<typeof factories.users>;
|
|
161
|
+
readonly members?: readonly SeedTeamMember[];
|
|
162
|
+
readonly slug?: string;
|
|
163
|
+
readonly saml?: boolean;
|
|
164
|
+
}): Promise<SeededTeam>;
|
|
165
|
+
/** Seeds a project owned by `team`, with the fields given. */
|
|
166
|
+
project(input: SeedProjectFields & {
|
|
167
|
+
readonly team: {
|
|
168
|
+
readonly id: string;
|
|
169
|
+
};
|
|
170
|
+
}): Promise<SeededProject>;
|
|
171
|
+
/**
|
|
172
|
+
* Seeds a token for `user`. With no options it has the factory's default user scope, which reaches every team
|
|
173
|
+
* the user belongs to that doesn't enforce SAML, and no `teamId`, like the token `vercel login` gives.
|
|
174
|
+
* - `team` sets its `teamId`, which changes no access.
|
|
175
|
+
* - `samlTeams` adds a team scope with `origin: "saml"` for each of those teams, on top of the user scope, so it
|
|
176
|
+
* reaches those SAML-enforced teams too.
|
|
177
|
+
* - `teams` replaces the user scope with a team scope (`origin: "manual"`) for each of those teams, so it reaches
|
|
178
|
+
* only them.
|
|
179
|
+
* - `project` makes it a project-scoped token for that project, which must belong to the user or a team the token
|
|
180
|
+
* names. `projectScope` says how far: `"account"`, what Testserver assumes when it is missing, keeps the
|
|
181
|
+
* account's other resources, and `"project-only"` denies team and user resources, so `GET /v2/user` answers 404.
|
|
182
|
+
*
|
|
183
|
+
* `teams` together with `samlTeams` is a `TypeError`, and so is `projectScope` without `project`, both thrown
|
|
184
|
+
* before anything is seeded.
|
|
185
|
+
*/
|
|
186
|
+
token(input: {
|
|
187
|
+
readonly user: {
|
|
188
|
+
readonly id: string;
|
|
189
|
+
};
|
|
190
|
+
readonly team?: {
|
|
191
|
+
readonly id: string;
|
|
192
|
+
};
|
|
193
|
+
readonly samlTeams?: readonly {
|
|
194
|
+
readonly id: string;
|
|
195
|
+
}[];
|
|
196
|
+
readonly teams?: readonly {
|
|
197
|
+
readonly id: string;
|
|
198
|
+
}[];
|
|
199
|
+
readonly project?: {
|
|
200
|
+
readonly id: string;
|
|
201
|
+
};
|
|
202
|
+
readonly projectScope?: "account" | "project-only";
|
|
203
|
+
}): Promise<SeededToken>;
|
|
204
|
+
/**
|
|
205
|
+
* Seeds a login through the other calls: a user and its default team as `user()` seeds them, with `team.slug` as the
|
|
206
|
+
* default team's slug when given, a project the default team owns, with its fields, when `project` is set, each of
|
|
207
|
+
* `teams` as a team the user owns with a `<prefix>-<8 hex>` slug, and then a token for the user with a SAML scope for
|
|
208
|
+
* each extra team with `samlScope`. `samlScope` without `saml: true` is a `TypeError`, thrown before anything is
|
|
209
|
+
* seeded.
|
|
210
|
+
*/
|
|
211
|
+
login<const Teams extends readonly LoginTeamOptions[] = readonly [], const Project extends LoginProjectOption | undefined = undefined>(options?: LoginOptions<Teams, Project>): Promise<Login<Teams, Project>>;
|
|
212
|
+
}
|
|
213
|
+
export interface SeederOptions {
|
|
214
|
+
/**
|
|
215
|
+
* Wall-clock time in milliseconds since the epoch, for a team member's `created` and `createdAt`, a token scope's
|
|
216
|
+
* `createdAt` and a SAML connection's `connectedAt`; default `Date.now`.
|
|
217
|
+
*/
|
|
218
|
+
readonly now?: () => number;
|
|
219
|
+
}
|
|
220
|
+
/** A `Seeder` over `container`. */
|
|
221
|
+
export declare function seeder(container: Container, options?: SeederOptions): Seeder;
|