@cnc-tools/storm 0.9.1 → 0.11.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/storm.js +11 -2
- package/dist/application.d.ts +5 -5
- package/dist/application.js +11 -9
- package/dist/bin/storm.js +32 -20
- package/dist/build-info.js +1 -1
- package/dist/chunks/chunk-3ZZVZPMG.js +10 -0
- package/dist/chunks/{chunk-WV6WQFC6.js → chunk-4EU4AH7E.js} +150 -26
- package/dist/chunks/chunk-4PRAB24Y.js +4400 -0
- package/dist/chunks/chunk-AMTYHUYB.js +257 -0
- package/dist/chunks/chunk-ETCZ6WP7.js +431 -0
- package/dist/chunks/chunk-FVMQKYTT.js +10 -0
- package/dist/chunks/chunk-GRMD7G4J.js +1267 -0
- package/dist/chunks/chunk-ICB4BZJX.js +22 -0
- package/dist/chunks/chunk-KR7WIYLG.js +2184 -0
- package/dist/chunks/chunk-L4ZPMSKQ.js +808 -0
- package/dist/chunks/chunk-NPPJ57W7.js +569 -0
- package/dist/chunks/chunk-O4BUT7BE.js +3361 -0
- package/dist/chunks/chunk-OJOKQRM6.js +1457 -0
- package/dist/chunks/chunk-SLNKW4ZM.js +40 -0
- package/dist/chunks/chunk-TRFEAYNC.js +1952 -0
- package/dist/chunks/chunk-VZZTHCBW.js +93 -0
- package/dist/chunks/chunk-WNIQA5J6.js +19 -0
- package/dist/chunks/chunk-WSIF7SR6.js +10 -0
- package/dist/chunks/{live-app-X3PW2W42.js → live-app-LOGYUBKB.js} +73 -20
- package/dist/command-tree.d.ts +3 -0
- package/dist/command-tree.js +3 -0
- package/dist/commands/dashboard.d.ts +1 -1
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/exec/cleanup.d.ts +28 -44
- package/dist/commands/exec/cleanup.js +25 -55
- package/dist/commands/exec/command.d.ts +73 -545
- package/dist/commands/exec/command.js +65 -25
- package/dist/commands/exec/job-summary.d.ts +2 -2
- package/dist/commands/exec/job-summary.js +3 -3
- package/dist/commands/exec/live-view.d.ts +9 -9
- package/dist/commands/exec/live-view.js +49 -42
- package/dist/commands/exec/metadata.d.ts +0 -65
- package/dist/commands/exec/metadata.js +2 -61
- package/dist/commands/exec/mint-failed.d.ts +1 -1
- package/dist/commands/exec/mint-failed.js +8 -8
- package/dist/commands/exec/outcomes.d.ts +63 -468
- package/dist/commands/exec/outcomes.js +47 -75
- package/dist/commands/exec/plan-run.d.ts +148 -0
- package/dist/commands/exec/plan-run.js +121 -0
- package/dist/commands/exec/progress.d.ts +26 -16
- package/dist/commands/exec/progress.js +63 -42
- package/dist/commands/exec/redaction.d.ts +3 -3
- package/dist/commands/exec/redaction.js +4 -4
- package/dist/commands/exec/resource-flags.d.ts +50 -0
- package/dist/commands/exec/resource-flags.js +125 -0
- package/dist/commands/exec/resource-refusals.d.ts +64 -0
- package/dist/commands/exec/resource-refusals.js +58 -0
- package/dist/commands/exec/run-command.d.ts +87 -167
- package/dist/commands/exec/run-command.js +296 -418
- package/dist/commands/exec/run-metadata.d.ts +20 -43
- package/dist/commands/exec/run-metadata.js +18 -37
- package/dist/commands/exec/test-plan.d.ts +11 -0
- package/dist/commands/exec/test-plan.js +39 -0
- package/dist/commands/exec/tests-summary.d.ts +5 -5
- package/dist/commands/exec/tests-summary.js +2 -2
- package/dist/commands/exec/text.d.ts +8 -2
- package/dist/commands/exec/text.js +8 -0
- package/dist/commands/exec/view.d.ts +5 -7
- package/dist/commands/exec/view.js +22 -14
- package/dist/commands/exec/waterfall.d.ts +4 -9
- package/dist/commands/exec/waterfall.js +22 -26
- package/dist/commands/exec/worker-chart.d.ts +1 -1
- package/dist/commands/ext/metadata.d.ts +4 -0
- package/dist/commands/ext/metadata.js +8 -0
- package/dist/commands/runs/facts.d.ts +11 -6
- package/dist/commands/runs/facts.js +27 -15
- package/dist/commands/runs/list/command.d.ts +15 -8
- package/dist/commands/runs/list/command.js +39 -32
- package/dist/commands/runs/list/metadata.d.ts +16 -14
- package/dist/commands/runs/list/metadata.js +17 -15
- package/dist/commands/runs/list/outcomes.d.ts +6 -2
- package/dist/commands/runs/logs/command.d.ts +3 -4
- package/dist/commands/runs/logs/command.js +46 -41
- package/dist/commands/runs/logs/metadata.d.ts +17 -15
- package/dist/commands/runs/logs/metadata.js +20 -18
- package/dist/commands/runs/past-run.d.ts +3 -33
- package/dist/commands/runs/past-run.js +3 -52
- package/dist/commands/runs/show/command.d.ts +57 -42
- package/dist/commands/runs/show/command.js +93 -82
- package/dist/commands/runs/show/metadata.d.ts +20 -18
- package/dist/commands/runs/show/metadata.js +20 -18
- package/dist/commands/runs/show/outcomes.d.ts +27 -19
- package/dist/commands/runs/show/outcomes.js +8 -6
- package/dist/commands/vitest/command.d.ts +95 -560
- package/dist/commands/vitest/command.js +84 -100
- package/dist/commands/vitest/metadata.d.ts +0 -65
- package/dist/commands/vitest/metadata.js +2 -41
- package/dist/commands/vitest/outcomes.d.ts +44 -274
- package/dist/commands/vitest/outcomes.js +7 -14
- package/dist/config/credential-resolver.d.ts +134 -0
- package/dist/config/credential-resolver.js +70 -0
- package/dist/{credential/settle.d.ts → config/credential-settle.d.ts} +1 -2
- package/dist/config/errors.d.ts +1 -1
- package/dist/config/errors.js +5 -5
- package/dist/config/index.d.ts +7 -6
- package/dist/config/index.js +13 -9
- package/dist/config/load.d.ts +16 -13
- package/dist/config/load.js +55 -40
- package/dist/config/recipe-run.d.ts +26 -0
- package/dist/config/recipe-run.js +27 -0
- package/dist/config/resolve.d.ts +103 -15
- package/dist/config/resolve.js +137 -47
- package/dist/config/resolver.d.ts +40 -0
- package/dist/config/resolver.js +31 -0
- package/dist/config/schema.d.ts +13 -17
- package/dist/config/schema.js +14 -35
- package/dist/config/settings-file.d.ts +28 -16
- package/dist/config/settings-file.js +39 -24
- package/dist/config/typed-options.d.ts +21 -0
- package/dist/config/typed-options.js +28 -0
- package/dist/config-file/define.d.ts +33 -31
- package/dist/config-file/define.js +14 -4
- package/dist/config-file/toolchain.d.ts +1 -1
- package/dist/context.d.ts +60 -29
- package/dist/context.js +32 -13
- package/dist/core/before-run.d.ts +38 -0
- package/dist/core/before-run.js +44 -0
- package/dist/core/definition-lookup.d.ts +22 -0
- package/dist/core/definition-lookup.js +34 -0
- package/dist/core/events.d.ts +59 -64
- package/dist/core/gateways.d.ts +23 -164
- package/dist/core/index.d.ts +14 -15
- package/dist/core/index.js +13 -11
- package/dist/core/launcher-supplies.d.ts +11 -0
- package/dist/core/launcher-supplies.js +28 -0
- package/dist/core/live/terminal-command-gateway.d.ts +8 -0
- package/dist/core/live/terminal-command-gateway.js +49 -0
- package/dist/core/payload.d.ts +13 -14
- package/dist/core/payload.js +9 -8
- package/dist/core/presentations.d.ts +38 -37
- package/dist/core/presentations.js +48 -56
- package/dist/core/reports.d.ts +5 -0
- package/dist/core/reports.js +13 -0
- package/dist/core/resource-registry.d.ts +38 -0
- package/dist/core/resource-registry.js +30 -0
- package/dist/core/resource-reports.d.ts +69 -0
- package/dist/core/resource-reports.js +67 -0
- package/dist/core/resource.d.ts +135 -243
- package/dist/core/resource.js +7 -5
- package/dist/core/resources-of.d.ts +16 -0
- package/dist/core/resources-of.js +8 -0
- package/dist/core/resources.d.ts +97 -84
- package/dist/core/resources.js +166 -165
- package/dist/core/run-state.d.ts +30 -42
- package/dist/core/run-state.js +56 -60
- package/dist/core/run.d.ts +83 -90
- package/dist/core/run.js +109 -155
- package/dist/core/state-directory.js +4 -3
- package/dist/core/timeline.d.ts +42 -24
- package/dist/core/timeline.js +46 -27
- package/dist/core/timing.d.ts +3 -3
- package/dist/core/timing.js +1 -1
- package/dist/credential/events.d.ts +20 -0
- package/dist/credential/events.js +4 -0
- package/dist/credential/gateways.d.ts +1 -80
- package/dist/credential/index.d.ts +4 -5
- package/dist/credential/index.js +8 -5
- package/dist/credential/live/github-actions-token-response.js +1 -1
- package/dist/credential/live/vercel-cli-gateway.d.ts +2 -1
- package/dist/credential/live/vercel-cli-gateway.js +1 -1
- package/dist/credential/live/vercel-output.d.ts +1 -1
- package/dist/credential/source.d.ts +44 -75
- package/dist/credential/source.js +33 -28
- package/dist/credential/target.d.ts +1 -1
- package/dist/extension-commands.d.ts +20 -0
- package/dist/extension-commands.js +27 -0
- package/dist/extensions/github/definition.d.ts +26 -0
- package/dist/extensions/github/definition.js +29 -0
- package/dist/extensions/github/extension.d.ts +18 -0
- package/dist/extensions/github/extension.js +6 -0
- package/dist/{resources → extensions}/github/fixture-repo.d.ts +11 -8
- package/dist/{resources → extensions}/github/fixture-repo.js +8 -4
- package/dist/extensions/github/index.d.ts +13 -0
- package/dist/extensions/github/index.js +17 -0
- package/dist/extensions/github/lifecycle.d.ts +30 -0
- package/dist/extensions/github/lifecycle.js +69 -0
- package/dist/extensions/github/live/world.d.ts +6 -0
- package/dist/extensions/github/live/world.js +16 -0
- package/dist/extensions/github/options.d.ts +36 -0
- package/dist/extensions/github/options.js +36 -0
- package/dist/extensions/github/refusals.d.ts +32 -0
- package/dist/extensions/github/refusals.js +43 -0
- package/dist/extensions/github/release.d.ts +17 -0
- package/dist/extensions/github/release.js +34 -0
- package/dist/extensions/github/resource.d.ts +36 -0
- package/dist/extensions/github/resource.js +21 -0
- package/dist/extensions/github/run/payload.d.ts +27 -0
- package/dist/extensions/github/run/payload.js +42 -0
- package/dist/extensions/github/world.d.ts +15 -0
- package/dist/extensions/github/world.js +3 -0
- package/dist/extensions/story/command-tree.d.ts +6 -0
- package/dist/extensions/story/command-tree.js +21 -0
- package/dist/extensions/story/commands/app.d.ts +23 -0
- package/dist/extensions/story/commands/app.js +5 -0
- package/dist/extensions/story/commands/run/command.d.ts +211 -0
- package/dist/extensions/story/commands/run/command.js +259 -0
- package/dist/extensions/story/commands/run/metadata.d.ts +4 -0
- package/dist/extensions/story/commands/run/metadata.js +8 -0
- package/dist/extensions/story/commands/run/outcomes.d.ts +101 -0
- package/dist/extensions/story/commands/run/outcomes.js +73 -0
- package/dist/extensions/story/commands/tree.d.ts +2 -0
- package/dist/extensions/story/commands/tree.js +6 -0
- package/dist/extensions/story/extension.d.ts +2 -0
- package/dist/extensions/story/extension.js +8 -0
- package/dist/extensions/testserver/canceled.d.ts +7 -0
- package/dist/extensions/testserver/canceled.js +27 -0
- package/dist/extensions/testserver/command-tree.d.ts +6 -0
- package/dist/extensions/testserver/command-tree.js +20 -0
- package/dist/extensions/testserver/commands/app.d.ts +22 -0
- package/dist/extensions/testserver/commands/app.js +5 -0
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/command.d.ts +277 -237
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/command.js +112 -141
- package/dist/extensions/testserver/commands/pool/create/metadata.d.ts +33 -0
- package/dist/extensions/testserver/commands/pool/create/metadata.js +55 -0
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/outcomes.d.ts +132 -112
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/outcomes.js +6 -24
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/command.d.ts +3 -4
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/command.js +34 -28
- package/dist/extensions/testserver/commands/pool/list/metadata.d.ts +11 -0
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/metadata.js +7 -5
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/outcomes.js +1 -1
- package/dist/extensions/testserver/commands/pool/metadata.d.ts +3 -0
- package/dist/extensions/testserver/commands/pool/metadata.js +7 -0
- package/dist/extensions/testserver/commands/tree.d.ts +2 -0
- package/dist/extensions/testserver/commands/tree.js +6 -0
- package/dist/{resources → extensions}/testserver/credential-facts.d.ts +6 -40
- package/dist/{resources → extensions}/testserver/credential-facts.js +13 -35
- package/dist/extensions/testserver/definition.d.ts +57 -0
- package/dist/extensions/testserver/definition.js +71 -0
- package/dist/{resources → extensions}/testserver/events.d.ts +5 -4
- package/dist/extensions/testserver/events.js +4 -0
- package/dist/extensions/testserver/extension.d.ts +46 -0
- package/dist/extensions/testserver/extension.js +68 -0
- package/dist/extensions/testserver/index.d.ts +20 -0
- package/dist/extensions/testserver/index.js +31 -0
- package/dist/extensions/testserver/lifecycle.d.ts +24 -0
- package/dist/extensions/testserver/lifecycle.js +116 -0
- package/dist/{core → extensions/testserver}/limit.js +1 -0
- package/dist/extensions/testserver/live/world.d.ts +8 -0
- package/dist/extensions/testserver/live/world.js +38 -0
- package/dist/{resources/testserver/sandbox → extensions/testserver/options}/channels.d.ts +1 -1
- package/dist/extensions/testserver/options/index.d.ts +5 -0
- package/dist/extensions/testserver/options/index.js +11 -0
- package/dist/extensions/testserver/options/rules.d.ts +69 -0
- package/dist/extensions/testserver/options/rules.js +92 -0
- package/dist/extensions/testserver/options/sandboxes.d.ts +29 -0
- package/dist/extensions/testserver/options/sandboxes.js +33 -0
- package/dist/extensions/testserver/options/ttl.d.ts +23 -0
- package/dist/extensions/testserver/options/ttl.js +42 -0
- package/dist/{resources → extensions}/testserver/pool/channels.d.ts +3 -3
- package/dist/{resources → extensions}/testserver/pool/channels.js +2 -2
- package/dist/{resources → extensions}/testserver/pool/create.d.ts +1 -2
- package/dist/{resources → extensions}/testserver/pool/create.js +2 -1
- package/dist/{resources → extensions}/testserver/pool/index.d.ts +0 -1
- package/dist/{resources → extensions}/testserver/pool/index.js +2 -3
- package/dist/{resources → extensions}/testserver/pool/inspect.d.ts +1 -1
- package/dist/{resources → extensions}/testserver/pool/lease.d.ts +1 -1
- package/dist/extensions/testserver/pool/live/pool-store-gateway.d.ts +12 -0
- package/dist/{resources → extensions}/testserver/pool/live/pool-store-gateway.js +4 -4
- package/dist/{resources → extensions}/testserver/pool/pull-request.d.ts +8 -5
- package/dist/{resources → extensions}/testserver/pool/pull-request.js +2 -2
- package/dist/extensions/testserver/pr-build-facts.d.ts +156 -0
- package/dist/extensions/testserver/pr-build-facts.js +309 -0
- package/dist/extensions/testserver/presentation.d.ts +11 -0
- package/dist/{resources → extensions}/testserver/presentation.js +35 -56
- package/dist/{resources/testserver/lane.d.ts → extensions/testserver/progress.d.ts} +10 -6
- package/dist/{resources/testserver/lane.js → extensions/testserver/progress.js} +21 -16
- package/dist/extensions/testserver/provision.d.ts +160 -0
- package/dist/{resources/testserver/provider.js → extensions/testserver/provision.js} +80 -108
- package/dist/{resources → extensions}/testserver/pull-request/gateways.d.ts +1 -1
- package/dist/extensions/testserver/pull-request/gateways.js +5 -0
- package/dist/{resources → extensions}/testserver/pull-request/index.js +2 -2
- package/dist/{resources → extensions}/testserver/pull-request/live/github-token-gateway.d.ts +4 -4
- package/dist/{resources → extensions}/testserver/pull-request/live/github-token-gateway.js +4 -4
- package/dist/extensions/testserver/refusals.d.ts +72 -0
- package/dist/extensions/testserver/refusals.js +117 -0
- package/dist/extensions/testserver/release.d.ts +14 -0
- package/dist/extensions/testserver/release.js +26 -0
- package/dist/extensions/testserver/resource.d.ts +57 -0
- package/dist/extensions/testserver/resource.js +19 -0
- package/dist/extensions/testserver/result.d.ts +55 -0
- package/dist/extensions/testserver/result.js +98 -0
- package/dist/extensions/testserver/run/connection.d.ts +21 -0
- package/dist/extensions/testserver/run/connection.js +39 -0
- package/dist/extensions/testserver/run-sandbox.d.ts +16 -0
- package/dist/extensions/testserver/run-sandbox.js +11 -0
- package/dist/{resources → extensions}/testserver/sandbox/create.d.ts +1 -11
- package/dist/{resources → extensions}/testserver/sandbox/create.js +0 -15
- package/dist/{resources → extensions}/testserver/sandbox/gateways.d.ts +1 -1
- package/dist/{resources → extensions}/testserver/sandbox/index.d.ts +1 -3
- package/dist/extensions/testserver/sandbox/index.js +6 -0
- package/dist/extensions/testserver/testserver-sdk.d.ts +1 -0
- package/dist/extensions/testserver/testserver-sdk.js +4 -0
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/arguments.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/context.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/driver.d.ts +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/gateways.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/index.js +4 -4
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/invocation.d.ts +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/invocation.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/redaction.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/report.d.ts +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/report.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/verbose.js +1 -1
- package/dist/extensions/testserver/vitest/config.d.ts +30 -0
- package/dist/extensions/testserver/vitest/config.js +41 -0
- package/dist/{vitest → extensions/testserver/vitest}/container-scope.d.ts +25 -14
- package/dist/{vitest → extensions/testserver/vitest}/container-scope.js +55 -17
- package/dist/extensions/testserver/vitest/container-start.d.ts +19 -0
- package/dist/extensions/testserver/vitest/container-start.js +31 -0
- package/dist/{vitest → extensions/testserver/vitest}/diagnostics.d.ts +66 -29
- package/dist/{vitest → extensions/testserver/vitest}/diagnostics.js +146 -50
- package/dist/{vitest → extensions/testserver/vitest}/fixtures.d.ts +7 -5
- package/dist/{vitest → extensions/testserver/vitest}/fixtures.js +69 -26
- package/dist/extensions/testserver/vitest/index.d.ts +3 -0
- package/dist/extensions/testserver/vitest/index.js +10 -0
- package/dist/extensions/testserver/vitest/sandbox.d.ts +25 -0
- package/dist/extensions/testserver/vitest/sandbox.js +43 -0
- package/dist/{vitest → extensions/testserver/vitest}/types.d.ts +1 -1
- package/dist/extensions/testserver/world.d.ts +25 -0
- package/dist/extensions/testserver/world.js +4 -0
- package/dist/extensions.d.ts +144 -0
- package/dist/extensions.js +41 -0
- package/dist/forward-sigterm.d.ts +8 -0
- package/dist/forward-sigterm.js +18 -0
- package/dist/help-logo.js +5 -5
- package/dist/launch.js +46 -0
- package/dist/launcher-resolvers/index.d.ts +2 -0
- package/dist/launcher-resolvers/index.js +8 -0
- package/dist/launcher-resolvers/local-services.d.ts +57 -0
- package/dist/launcher-resolvers/local-services.js +7 -0
- package/dist/live-app.js +12 -7
- package/dist/local-services.d.ts +19 -0
- package/dist/local-services.js +37 -0
- package/dist/presentation.js +2 -2
- package/dist/run-directory/gateways.d.ts +167 -0
- package/dist/run-directory/gateways.js +2 -0
- package/dist/run-directory/index.d.ts +8 -0
- package/dist/run-directory/index.js +13 -0
- package/dist/run-directory/plan.d.ts +35 -0
- package/dist/run-directory/plan.js +24 -0
- package/dist/run-directory/reader.d.ts +70 -0
- package/dist/run-directory/reader.js +51 -0
- package/dist/run-directory/recording.d.ts +92 -0
- package/dist/run-directory/recording.js +85 -0
- package/dist/run-directory/run-collector.d.ts +36 -0
- package/dist/{commands/exec → run-directory}/run-collector.js +10 -12
- package/dist/{core → run-directory}/run-directory.d.ts +13 -14
- package/dist/{core → run-directory}/run-directory.js +11 -11
- package/dist/{commands/exec → run-directory}/run-record.d.ts +92 -61
- package/dist/run-directory/run-record.js +209 -0
- package/dist/run-directory/timeline-facts.d.ts +53 -0
- package/dist/run-directory/timeline-facts.js +76 -0
- package/dist/runner/base.js +1 -1
- package/dist/runner/context.js +1 -1
- package/dist/runner/events.d.ts +6 -5
- package/dist/runner/events.js +1 -1
- package/dist/runner/gateways.d.ts +11 -11
- package/dist/runner/gateways.js +1 -1
- package/dist/runner/index.d.ts +13 -17
- package/dist/runner/index.js +10 -14
- package/dist/runner/live/sandbox-gateway.js +4 -4
- package/dist/runner/live/terminal.d.ts +1 -1
- package/dist/runner/live/terminal.js +1 -1
- package/dist/runner/prepare.d.ts +40 -17
- package/dist/runner/prepare.js +17 -11
- package/dist/runner/ready.js +2 -2
- package/dist/runner/recipe.d.ts +38 -20
- package/dist/runner/recipe.js +31 -17
- package/dist/runner/{remote-command.d.ts → sandboxed-command.d.ts} +18 -19
- package/dist/runner/{remote-command.js → sandboxed-command.js} +21 -22
- package/dist/runner/scope.d.ts +21 -14
- package/dist/runner/scope.js +12 -10
- package/dist/runner/secrets.js +1 -1
- package/dist/runner/session.d.ts +100 -0
- package/dist/runner/session.js +109 -0
- package/dist/runner/snapshot-key.d.ts +1 -1
- package/dist/runner/snapshot-key.js +4 -4
- package/dist/runner/snapshot-save.d.ts +3 -2
- package/dist/runner/snapshot-save.js +8 -7
- package/dist/sdk/extension/ci.d.ts +2 -0
- package/dist/sdk/extension/ci.js +6 -0
- package/dist/sdk/extension/commands.d.ts +69 -0
- package/dist/sdk/extension/commands.js +31 -0
- package/dist/{credential/diagnosis.d.ts → sdk/extension/credential-diagnosis.d.ts} +1 -7
- package/dist/{credential/diagnosis.js → sdk/extension/credential-diagnosis.js} +2 -11
- package/dist/sdk/extension/credential-source.d.ts +132 -0
- package/dist/sdk/extension/credential-source.js +5 -0
- package/dist/{credential → sdk/extension}/credential.d.ts +8 -7
- package/dist/{credential → sdk/extension}/credential.js +9 -6
- package/dist/sdk/extension/index.d.ts +16 -0
- package/dist/sdk/extension/index.js +40 -0
- package/dist/sdk/extension/launcher-supplies.d.ts +24 -0
- package/dist/sdk/extension/launcher-supplies.js +3 -0
- package/dist/sdk/extension/lifecycle.d.ts +212 -0
- package/dist/sdk/extension/lifecycle.js +9 -0
- package/dist/sdk/extension/presentation.d.ts +31 -0
- package/dist/sdk/extension/presentation.js +7 -0
- package/dist/sdk/extension/progress.d.ts +75 -0
- package/dist/sdk/extension/progress.js +8 -0
- package/dist/sdk/extension/reports.d.ts +15 -0
- package/dist/sdk/extension/reports.js +5 -0
- package/dist/sdk/extension/resource-definition.d.ts +204 -0
- package/dist/sdk/extension/resource-definition.js +24 -0
- package/dist/sdk/extension/resource-factory.d.ts +10 -0
- package/dist/sdk/extension/resource-factory.js +15 -0
- package/dist/sdk/extension/resource.d.ts +60 -0
- package/dist/sdk/extension/resource.js +42 -0
- package/dist/sdk/extension/rules.d.ts +16 -0
- package/dist/sdk/extension/rules.js +30 -0
- package/dist/sdk/extension/span.d.ts +8 -0
- package/dist/sdk/extension/span.js +4 -0
- package/dist/sdk/extension/time.d.ts +11 -0
- package/dist/sdk/extension/time.js +4 -0
- package/dist/sdk/extension/token-request-facts.d.ts +39 -0
- package/dist/sdk/extension/token-request-facts.js +35 -0
- package/dist/sdk/index.d.ts +4 -7
- package/dist/sdk/index.js +7 -15
- package/dist/sdk/run/contract.d.ts +32 -0
- package/dist/sdk/run/contract.js +12 -0
- package/dist/sdk/run/launcher.d.ts +5 -0
- package/dist/sdk/run/launcher.js +6 -0
- package/dist/sdk/run/payload.d.ts +58 -0
- package/dist/sdk/run/payload.js +73 -0
- package/dist/sdk/run/present.d.ts +11 -0
- package/dist/sdk/run/present.js +4 -0
- package/dist/sdk/run/redact.d.ts +5 -0
- package/dist/sdk/run/redact.js +12 -0
- package/dist/story/align.d.ts +1 -1
- package/dist/story/align.js +1 -1
- package/dist/story/command-line.d.ts +6 -16
- package/dist/story/command-line.js +11 -23
- package/dist/story/errors.d.ts +1 -1
- package/dist/story/errors.js +1 -1
- package/dist/story/host.d.ts +1 -1
- package/dist/story/host.js +2 -2
- package/dist/story/index.d.ts +2 -2
- package/dist/story/index.js +4 -3
- package/dist/story/launch.d.ts +70 -0
- package/dist/story/launch.js +77 -0
- package/dist/story/report.d.ts +2 -2
- package/dist/story/report.js +3 -4
- package/dist/story/settle.d.ts +7 -7
- package/dist/story/settle.js +5 -5
- package/dist/story/start.d.ts +2 -2
- package/dist/time/duration.js +2 -2
- package/dist/time/index.js +2 -1
- package/dist/time/time.d.ts +2 -11
- package/dist/time/time.js +2 -2
- package/dist/{sdk → vendor/testserver-sdk}/container/api-request.d.ts +14 -2
- package/dist/vendor/testserver-sdk/container/api-request.js +68 -0
- package/dist/vendor/testserver-sdk/container/container.d.ts +199 -0
- package/dist/vendor/testserver-sdk/container/container.js +458 -0
- package/dist/vendor/testserver-sdk/container/external.d.ts +111 -0
- package/dist/vendor/testserver-sdk/container/external.js +76 -0
- package/dist/vendor/testserver-sdk/container/gateways.d.ts +156 -0
- package/dist/{sdk → vendor/testserver-sdk}/container/index.d.ts +2 -1
- package/dist/{sdk → vendor/testserver-sdk}/container/index.js +2 -1
- package/dist/vendor/testserver-sdk/container/live/container-gateway.d.ts +22 -0
- package/dist/vendor/testserver-sdk/container/live/container-gateway.js +165 -0
- package/dist/vendor/testserver-sdk/container/recorder.d.ts +69 -0
- package/dist/vendor/testserver-sdk/container/recorder.js +121 -0
- package/dist/{sdk → vendor/testserver-sdk}/factories/build.d.ts +33 -12
- package/dist/{sdk → vendor/testserver-sdk}/factories/build.js +36 -14
- package/dist/vendor/testserver-sdk/factories/definition.d.ts +39 -0
- package/dist/{sdk → vendor/testserver-sdk}/factories/definition.js +1 -1
- package/dist/{sdk → vendor/testserver-sdk}/factories/definitions.d.ts +7 -4
- package/dist/{sdk → vendor/testserver-sdk}/factories/definitions.js +10 -0
- package/dist/vendor/testserver-sdk/factories/gateways.d.ts +31 -0
- package/dist/vendor/testserver-sdk/factories/index.d.ts +4 -0
- package/dist/{sdk → vendor/testserver-sdk}/factories/index.js +3 -3
- package/dist/vendor/testserver-sdk/index.d.ts +6 -0
- package/dist/vendor/testserver-sdk/index.js +11 -0
- package/dist/{sdk → vendor/testserver-sdk}/proxy/exchange.d.ts +2 -1
- package/dist/{sdk → vendor/testserver-sdk}/proxy/exchange.js +8 -4
- package/dist/{sdk → vendor/testserver-sdk}/proxy/faulted-exchange.js +7 -2
- package/dist/{sdk → vendor/testserver-sdk}/proxy/faults.d.ts +2 -1
- package/dist/{sdk → vendor/testserver-sdk}/proxy/records.d.ts +10 -1
- package/dist/{sdk → vendor/testserver-sdk}/proxy/records.js +13 -0
- package/dist/{sdk → vendor/testserver-sdk}/records/index.d.ts +1 -1
- package/dist/{sdk → vendor/testserver-sdk}/records/records.d.ts +17 -1
- package/dist/vendor/testserver-sdk/testserver/external-ids.d.ts +38 -0
- package/dist/vendor/testserver-sdk/testserver/external-ids.js +46 -0
- package/dist/vendor/testserver-sdk/testserver/failure.d.ts +102 -0
- package/dist/vendor/testserver-sdk/testserver/failure.js +109 -0
- package/dist/vendor/testserver-sdk/testserver/index.d.ts +7 -0
- package/dist/vendor/testserver-sdk/testserver/index.js +11 -0
- package/dist/{sdk → vendor/testserver-sdk}/testserver/live/request.d.ts +8 -10
- package/dist/{sdk → vendor/testserver-sdk}/testserver/live/request.js +8 -6
- package/dist/vendor/testserver-sdk/testserver/routes.d.ts +60 -0
- package/dist/vendor/testserver-sdk/testserver/routes.js +84 -0
- package/dist/vendor/testserver-sdk/testserver/service-ids.d.ts +31 -0
- package/dist/{sdk → vendor/testserver-sdk}/testserver/service-ids.js +27 -4
- package/dist/vitest/config.d.ts +2 -28
- package/dist/vitest/config.js +6 -36
- package/dist/vitest/gateways.js +1 -1
- package/dist/vitest/index.d.ts +2 -3
- package/dist/vitest/index.js +5 -9
- package/dist/vitest/plan.d.ts +1 -16
- package/dist/vitest/plan.js +4 -36
- package/dist/vitest/test-events.d.ts +1 -18
- package/dist/vitest/test-events.js +2 -31
- package/package.json +52 -23
- package/skills/overview.md +12 -9
- package/skills/read-run-output.md +26 -3
- package/skills/testserver-builds.md +8 -8
- package/dist/chunks/chunk-5CQCRX2L.js +0 -5768
- package/dist/chunks/chunk-5U5Q6VZR.js +0 -556
- package/dist/chunks/chunk-7O6UN63H.js +0 -63
- package/dist/chunks/chunk-NX55IJ5S.js +0 -1842
- package/dist/chunks/chunk-OCZJE5XV.js +0 -910
- package/dist/chunks/chunk-RRQ2ZGSE.js +0 -1512
- package/dist/chunks/chunk-S5NAIZYS.js +0 -13
- package/dist/chunks/chunk-UHO5OCEX.js +0 -360
- package/dist/chunks/chunk-WBIHJM7D.js +0 -188
- package/dist/combine-errors.d.ts +0 -11
- package/dist/combine-errors.js +0 -19
- package/dist/commands/exec/run-collector.d.ts +0 -30
- package/dist/commands/exec/run-record.js +0 -152
- package/dist/commands/exec/testserver-flags.d.ts +0 -48
- package/dist/commands/exec/testserver-flags.js +0 -80
- package/dist/config/by-name.d.ts +0 -24
- package/dist/config/by-name.js +0 -26
- package/dist/config/resource-config.d.ts +0 -132
- package/dist/config/resource-config.js +0 -19
- package/dist/config/set.d.ts +0 -27
- package/dist/config/set.js +0 -71
- package/dist/core/command-provider.d.ts +0 -126
- package/dist/core/command-provider.js +0 -13
- package/dist/core/command-slots.d.ts +0 -73
- package/dist/core/command-slots.js +0 -140
- package/dist/core/keyed.d.ts +0 -12
- package/dist/core/keyed.js +0 -24
- package/dist/core/lane.d.ts +0 -46
- package/dist/core/lane.js +0 -5
- package/dist/core/mint.d.ts +0 -10
- package/dist/core/mint.js +0 -14
- package/dist/core/presentation.d.ts +0 -87
- package/dist/core/presentation.js +0 -5
- package/dist/core/provider.d.ts +0 -79
- package/dist/core/provider.js +0 -5
- package/dist/resource-commands.d.ts +0 -13
- package/dist/resource-commands.js +0 -22
- package/dist/resources/github/cleanup.d.ts +0 -23
- package/dist/resources/github/cleanup.js +0 -39
- package/dist/resources/github/command.d.ts +0 -126
- package/dist/resources/github/command.js +0 -117
- package/dist/resources/github/config.d.ts +0 -16
- package/dist/resources/github/config.js +0 -37
- package/dist/resources/github/events.d.ts +0 -26
- package/dist/resources/github/events.js +0 -2
- package/dist/resources/github/index.d.ts +0 -12
- package/dist/resources/github/index.js +0 -15
- package/dist/resources/github/live/gateways.d.ts +0 -6
- package/dist/resources/github/live/gateways.js +0 -13
- package/dist/resources/github/presentation.d.ts +0 -13
- package/dist/resources/github/presentation.js +0 -43
- package/dist/resources/github/provider.d.ts +0 -66
- package/dist/resources/github/provider.js +0 -58
- package/dist/resources/github/resource-provider.d.ts +0 -6
- package/dist/resources/github/resource-provider.js +0 -20
- package/dist/resources/github/resource.d.ts +0 -33
- package/dist/resources/github/resource.js +0 -12
- package/dist/resources/testserver/cleanup.d.ts +0 -14
- package/dist/resources/testserver/cleanup.js +0 -22
- package/dist/resources/testserver/command-tree.d.ts +0 -4
- package/dist/resources/testserver/command-tree.js +0 -12
- package/dist/resources/testserver/command.d.ts +0 -520
- package/dist/resources/testserver/command.js +0 -252
- package/dist/resources/testserver/commands/app.d.ts +0 -18
- package/dist/resources/testserver/commands/app.js +0 -3
- package/dist/resources/testserver/commands/create/metadata.d.ts +0 -31
- package/dist/resources/testserver/commands/create/metadata.js +0 -53
- package/dist/resources/testserver/commands/list/metadata.d.ts +0 -9
- package/dist/resources/testserver/config.d.ts +0 -18
- package/dist/resources/testserver/config.js +0 -88
- package/dist/resources/testserver/events.js +0 -4
- package/dist/resources/testserver/index.d.ts +0 -16
- package/dist/resources/testserver/index.js +0 -25
- package/dist/resources/testserver/live/gateways.d.ts +0 -8
- package/dist/resources/testserver/live/gateways.js +0 -39
- package/dist/resources/testserver/options.d.ts +0 -5
- package/dist/resources/testserver/options.js +0 -5
- package/dist/resources/testserver/pool/directory.d.ts +0 -4
- package/dist/resources/testserver/pool/directory.js +0 -5
- package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +0 -12
- package/dist/resources/testserver/pr-build-facts.d.ts +0 -130
- package/dist/resources/testserver/pr-build-facts.js +0 -261
- package/dist/resources/testserver/presentation.d.ts +0 -9
- package/dist/resources/testserver/provider.d.ts +0 -187
- package/dist/resources/testserver/pull-request/gateways.js +0 -5
- package/dist/resources/testserver/ran.d.ts +0 -92
- package/dist/resources/testserver/ran.js +0 -156
- package/dist/resources/testserver/resource-provider.d.ts +0 -12
- package/dist/resources/testserver/resource-provider.js +0 -32
- package/dist/resources/testserver/resource.d.ts +0 -36
- package/dist/resources/testserver/resource.js +0 -10
- package/dist/resources/testserver/run-sandbox.d.ts +0 -13
- package/dist/resources/testserver/run-sandbox.js +0 -6
- package/dist/resources/testserver/sandbox/index.js +0 -8
- package/dist/resources.d.ts +0 -702
- package/dist/resources.js +0 -83
- package/dist/sdk/container/api-request.js +0 -46
- package/dist/sdk/container/container.d.ts +0 -144
- package/dist/sdk/container/container.js +0 -346
- package/dist/sdk/container/gateways.d.ts +0 -108
- package/dist/sdk/container/live/container-gateway.d.ts +0 -17
- package/dist/sdk/container/live/container-gateway.js +0 -114
- package/dist/sdk/factories/definition.d.ts +0 -28
- package/dist/sdk/factories/gateways.d.ts +0 -25
- package/dist/sdk/factories/index.d.ts +0 -5
- package/dist/sdk/factories/live/factory-gateway.d.ts +0 -10
- package/dist/sdk/factories/live/factory-gateway.js +0 -29
- package/dist/sdk/host.d.ts +0 -2
- package/dist/sdk/host.js +0 -7
- package/dist/sdk/payload/index.d.ts +0 -2
- package/dist/sdk/payload/index.js +0 -4
- package/dist/sdk/payload/payload.d.ts +0 -47
- package/dist/sdk/payload/payload.js +0 -74
- package/dist/sdk/testserver/failure.d.ts +0 -73
- package/dist/sdk/testserver/failure.js +0 -61
- package/dist/sdk/testserver/index.d.ts +0 -5
- package/dist/sdk/testserver/index.js +0 -8
- package/dist/sdk/testserver/service-ids.d.ts +0 -19
- package/dist/story/mode.d.ts +0 -17
- package/dist/story/mode.js +0 -21
- package/dist/vitest/sandbox.d.ts +0 -22
- package/dist/vitest/sandbox.js +0 -41
- /package/dist/{credential/settle.js → config/credential-settle.js} +0 -0
- /package/dist/{resources → extensions}/github/gateways.d.ts +0 -0
- /package/dist/{resources → extensions}/github/gateways.js +0 -0
- /package/dist/{resources → extensions}/github/live/fixture-repo-gateway.d.ts +0 -0
- /package/dist/{resources → extensions}/github/live/fixture-repo-gateway.js +0 -0
- /package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/outcomes.d.ts +0 -0
- /package/dist/{core → extensions/testserver}/limit.d.ts +0 -0
- /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/build-reference.d.ts +0 -0
- /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/build-reference.js +0 -0
- /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/channels.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/gateways.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pool/gateways.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/host.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pool/host.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/inspect.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/lease.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/live/pool-records.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pool/live/pool-records.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/staleness.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pool/staleness.js +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/index.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/github-rest.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/github-rest.js +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/pull-request-gateway.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/pull-request-gateway.js +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/testserver-workflow-gateway.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/testserver-workflow-gateway.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/create-failure.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/create-failure.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/gateways.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/builds-response.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/builds-response.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/control-plane-gateway.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/control-plane-gateway.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/create-response.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/create-response.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/fetch-failure.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/fetch-failure.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/health-check-gateway.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/health-check-gateway.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/sse.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/sse.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/ansi.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/ansi.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/arguments.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/auth-config.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/auth-config.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/clock.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/clock.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/config-files.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/config-files.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/context.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/driver.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/entry.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/entry.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/environment.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/environment.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/errors.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/errors.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/gateways.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/index.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/keys.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/keys.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/config-files.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/config-files.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/process-gateway.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/process-gateway.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/redaction.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/verbose.d.ts +0 -0
- /package/dist/{vitest → extensions/testserver/vitest}/types.js +0 -0
- /package/dist/{core → run-directory}/live/run-directory-gateway.d.ts +0 -0
- /package/dist/{core → run-directory}/live/run-directory-gateway.js +0 -0
- /package/dist/sdk/{payload → run}/test-events.d.ts +0 -0
- /package/dist/sdk/{payload → run}/test-events.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/container/feature-flags.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/container/feature-flags.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/container/gateways.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/factories/gateways.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/faulted-exchange.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/faults.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/index.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/index.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/proxy.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/proxy.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/records/body.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/records/body.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/records/index.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/records/records.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/seed/index.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/seed/index.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/seed/seed.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/seed/seed.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/clock.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/clock.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/live/connect-failure.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/live/connect-failure.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/test-id.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/test-id.js +0 -0
package/dist/resources.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// The registry, in the composition layer: the one file that takes every resource's provider value. It lists the resources' provider
|
|
2
|
-
// values in order (`PROVIDERS`), derives the kinds map `Resources` from that list, and builds everything else the host
|
|
3
|
-
// needs from it: the run halves, the resource lanes and configs, the resource reports, the run's cleanup, the command
|
|
4
|
-
// halves and their errors, and the resources' live gateways. The resources' command trees, which help needs without
|
|
5
|
-
// the rest, are in `src/resource-commands.ts`. It fixes the core's generic types and functions for
|
|
6
|
-
// `Resources`, so commands never spell the generic. A resource folder is reached only through its provider value, and
|
|
7
|
-
// only this file takes one (`src/resource-commands.ts` takes only each resource's `command-tree.ts`); `.oxlintrc.json`
|
|
8
|
-
// enforces it.
|
|
9
|
-
import { combineErrors } from "./combine-errors.js";
|
|
10
|
-
import { runCleanupOf } from "./commands/exec/cleanup.js";
|
|
11
|
-
import { applyRunEvent, bindCommands, resourcePresentations, resourceReports, timeline, } from "./core/index.js";
|
|
12
|
-
import { githubFixtureRepoProvider } from "./resources/github/index.js";
|
|
13
|
-
import { testserverPoolProvider } from "./resources/testserver/index.js";
|
|
14
|
-
/**
|
|
15
|
-
* Every resource's provider, in the one order everything about the resources follows: the order a run prepares and
|
|
16
|
-
* starts acquiring them, their refusals rank in, the run payload's `resources`, the waterfall's resource rows, the
|
|
17
|
-
* resource configs (the order `--set` lists its key paths in and a config file's problems name the resources in), the
|
|
18
|
-
* cleanup rows and warnings, and the errors `--json-schema` lists. A run releases them in reverse. Adding a resource
|
|
19
|
-
* adds its provider here and its factory's type to `StormResources` (`config-file/define.ts`).
|
|
20
|
-
*/
|
|
21
|
-
export const PROVIDERS = [githubFixtureRepoProvider, testserverPoolProvider];
|
|
22
|
-
/** The provider list, checked against the derived kinds: a provider whose parts don't line up fails here. */
|
|
23
|
-
const PROVIDER_LIST = PROVIDERS;
|
|
24
|
-
/**
|
|
25
|
-
* The run halves, checked against the app's context: a provider whose kind doesn't line up, or whose gateways
|
|
26
|
-
* `StormContext` lacks, fails here.
|
|
27
|
-
*/
|
|
28
|
-
export const RESOURCES = PROVIDERS.map(({ run }) => run);
|
|
29
|
-
/**
|
|
30
|
-
* The resource lanes, in the order the waterfall shows their rows, after the mint's and before the runner's. Each
|
|
31
|
-
* applies its resource's own events to its lane state (`applyStormRunEvent`).
|
|
32
|
-
*/
|
|
33
|
-
export const RESOURCE_LANES = PROVIDERS.flatMap(({ lane }) => lane === undefined ? [] : [lane]);
|
|
34
|
-
/** The resource configs, in provider order. */
|
|
35
|
-
export const RESOURCE_CONFIGS = PROVIDERS.map(({ config }) => config);
|
|
36
|
-
/** Every resource's reports: its cleanup and what a ran outcome says of it, and what the host does for it. */
|
|
37
|
-
export const RESOURCE_REPORTS = resourceReports(PROVIDER_LIST);
|
|
38
|
-
/** How every resource shows in a run's progress: its own events' lines, and its lane's rows and label. */
|
|
39
|
-
export const RESOURCE_PRESENTATIONS = resourcePresentations(PROVIDER_LIST);
|
|
40
|
-
/** The run's cleanup, as every outcome after the run starts acquiring reports it: the runner's and each resource's. */
|
|
41
|
-
export const RUN_CLEANUP = runCleanupOf(RESOURCE_REPORTS);
|
|
42
|
-
/**
|
|
43
|
-
* The errors every resource's acquire's refusals end a run with, defined from their definitions, in provider order,
|
|
44
|
-
* each with the run's cleanup beside its own data.
|
|
45
|
-
*/
|
|
46
|
-
const REFUSALS = RUN_CLEANUP.withCleanup(combineErrors(PROVIDERS.map(({ command }) => command.refusalErrors)));
|
|
47
|
-
/**
|
|
48
|
-
* Every error a resource's command half defines, which `exec` and `vitest` list: the errors that end a run before it
|
|
49
|
-
* holds anything, in provider order, then the refusal errors, in provider order, each carrying the run's cleanup.
|
|
50
|
-
*/
|
|
51
|
-
export const RESOURCE_ERRORS = combineErrors([
|
|
52
|
-
combineErrors(PROVIDERS.map(({ command }) => command.errors)),
|
|
53
|
-
REFUSALS.errors,
|
|
54
|
-
]);
|
|
55
|
-
const BOUND = bindCommands(PROVIDER_LIST);
|
|
56
|
-
/**
|
|
57
|
-
* Every resource's command half, bound to its name: what `exec` and `vitest` settle and report through, and
|
|
58
|
-
* `refusedError`, the error a run a resource refused ends with: the refusal error its facts name, built with the run's
|
|
59
|
-
* cleanup.
|
|
60
|
-
*/
|
|
61
|
-
export const RESOURCE_COMMANDS = {
|
|
62
|
-
...BOUND,
|
|
63
|
-
refusedError: (outcome, cleanup) => REFUSALS.build(BOUND.refusalFacts(outcome), cleanup),
|
|
64
|
-
};
|
|
65
|
-
/** Every resource's live gateways, built from `host`, as one context. */
|
|
66
|
-
export function liveResourceGateways(host) {
|
|
67
|
-
let gateways = {};
|
|
68
|
-
for (const provider of PROVIDERS)
|
|
69
|
-
gateways = { ...gateways, ...provider.liveGateways(host) };
|
|
70
|
-
// Each provider adds its own gateways, so the object holds every one.
|
|
71
|
-
return gateways;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* The run's state after `timed`, through the registry's resource lanes. A run's final state is
|
|
75
|
-
* `events.reduce(applyStormRunEvent, EMPTY_RUN_STATE)`.
|
|
76
|
-
*/
|
|
77
|
-
export function applyStormRunEvent(state, timed) {
|
|
78
|
-
return applyRunEvent(RESOURCE_LANES, state, timed);
|
|
79
|
-
}
|
|
80
|
-
/** A run's waterfall, from its final state, with each resource lane's row. */
|
|
81
|
-
export function stormTimeline(state) {
|
|
82
|
-
return timeline(RESOURCE_LANES, state);
|
|
83
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { splitTarget } from "../records/index.js";
|
|
2
|
-
import { BODY_EXCERPT_CHARS } from "../testserver/index.js";
|
|
3
|
-
/** Statuses whose answer has no body, so a `Response` can't be built with one. */
|
|
4
|
-
const NULL_BODY_STATUSES = new Set([101, 103, 204, 205, 304]);
|
|
5
|
-
/** The record of an API request to `target` that started at `startedAt` and ended with `outcome`. */
|
|
6
|
-
export function apiRequestRecord(request) {
|
|
7
|
-
return {
|
|
8
|
-
method: request.method,
|
|
9
|
-
url: request.target,
|
|
10
|
-
...splitTarget(request.target),
|
|
11
|
-
authorization: request.authorization,
|
|
12
|
-
...(request.requestBody === undefined ? {} : { requestBody: request.requestBody }),
|
|
13
|
-
...(request.responseBody === undefined ? {} : { responseBody: request.responseBody }),
|
|
14
|
-
startedAt: request.startedAt,
|
|
15
|
-
durationMs: request.durationMs,
|
|
16
|
-
...request.outcome,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
/** Whether an answer with `status` to a `method` request carries no body. */
|
|
20
|
-
export function hasNullBody(method, status) {
|
|
21
|
-
return method === "HEAD" || NULL_BODY_STATUSES.has(status);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The failure an answer with `status` is, when `fetch` refuses it: a 410 or 502 (the Testserver sandbox has expired
|
|
25
|
-
* or can't be reached) is an `http-error`, a status no `Response` can carry is `malformed`. `undefined` for any other.
|
|
26
|
-
* The body is redacted whole before it is cut, so no secret is cut in half and left partly readable.
|
|
27
|
-
*/
|
|
28
|
-
export function refusedAnswer(status, body, redact) {
|
|
29
|
-
if (status === 410 || status === 502) {
|
|
30
|
-
return { kind: "http-error", status, body: redact(new TextDecoder().decode(body)).slice(0, BODY_EXCERPT_CHARS) };
|
|
31
|
-
}
|
|
32
|
-
if (status < 200 || status > 599)
|
|
33
|
-
return { kind: "malformed", detail: `status ${status}` };
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
/** Whether `body` is one `container.fetch` can read whole at once: absent, or a `ContainerRequestBody`. */
|
|
37
|
-
export function readableWhole(body) {
|
|
38
|
-
return (body === undefined ||
|
|
39
|
-
body === null ||
|
|
40
|
-
typeof body === "string" ||
|
|
41
|
-
body instanceof ArrayBuffer ||
|
|
42
|
-
ArrayBuffer.isView(body) ||
|
|
43
|
-
body instanceof Blob ||
|
|
44
|
-
body instanceof FormData ||
|
|
45
|
-
body instanceof URLSearchParams);
|
|
46
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { type AnyFactoryDefinition, type FactoryCall, type FactoryGateway, type FactoryInput, type FactoryOptions, type FactoryOutput } from "../factories/index.ts";
|
|
2
|
-
import { type ApiRequestRecord } from "../records/index.ts";
|
|
3
|
-
import { type Clock, type TestserverServiceId } from "../testserver/index.ts";
|
|
4
|
-
import { type ContainerRequestInit } from "./api-request.ts";
|
|
5
|
-
import { type FeatureFlags } from "./feature-flags.ts";
|
|
6
|
-
import type { ContainerGateway, ContainerInfo, ContainerLogRecord } from "./gateways.ts";
|
|
7
|
-
/** The gateways and seams the SDK reaches Testserver through. Tests build it over fakes. */
|
|
8
|
-
export interface SdkContext {
|
|
9
|
-
readonly containers: ContainerGateway;
|
|
10
|
-
readonly factories: FactoryGateway;
|
|
11
|
-
readonly clock: Clock;
|
|
12
|
-
}
|
|
13
|
-
/** How long a data-plane call may take by default: the allowance vercel-internal gives infrastructure calls. */
|
|
14
|
-
export declare const DEFAULT_TIMEOUT_MS = 45000;
|
|
15
|
-
/**
|
|
16
|
-
* How long one container start attempt may take by default. Two attempts at 45s would outlast a 60s test timeout on
|
|
17
|
-
* a hung start.
|
|
18
|
-
*/
|
|
19
|
-
export declare const DEFAULT_START_TIMEOUT_MS = 15000;
|
|
20
|
-
/** How many times a container start is attempted, as in vercel-internal's harness. */
|
|
21
|
-
export declare const START_ATTEMPTS = 2;
|
|
22
|
-
/** How long a container start waits before its next attempt. */
|
|
23
|
-
export declare const START_RETRY_DELAY_MS = 250;
|
|
24
|
-
/**
|
|
25
|
-
* The live Context: Testserver over `fetch`, each call under `timeoutMs` (default 45s) but each container start
|
|
26
|
-
* attempt under `startTimeoutMs` (default 15s), and the system clock.
|
|
27
|
-
*/
|
|
28
|
-
export declare function liveSdkContext(options?: {
|
|
29
|
-
readonly timeoutMs?: number;
|
|
30
|
-
readonly startTimeoutMs?: number;
|
|
31
|
-
}): SdkContext;
|
|
32
|
-
/** Which container to start, and where. */
|
|
33
|
-
export interface ContainerOptions {
|
|
34
|
-
/**
|
|
35
|
-
* The Testserver URL of a Testserver sandbox the run holds, such as
|
|
36
|
-
* `readRunPayload().resources.testserverPool?.sandboxes[0]?.url`.
|
|
37
|
-
*/
|
|
38
|
-
readonly testserverUrl: string;
|
|
39
|
-
/** The test id; by default a fresh one (`ts-` and 16 hex characters). At most 49 characters. */
|
|
40
|
-
readonly testId?: string;
|
|
41
|
-
/** A label Testserver shows for the container. */
|
|
42
|
-
readonly name?: string;
|
|
43
|
-
readonly meta?: Readonly<Record<string, unknown>>;
|
|
44
|
-
/**
|
|
45
|
-
* The feature flags the container's services read, by flag client, such as
|
|
46
|
-
* `{ all: { "env-var-config-secret-ui": true } }`; by default none. Set once the container has started and before
|
|
47
|
-
* it is returned, because each service reads them once, when it starts: no way to change them afterwards could
|
|
48
|
-
* know whether a service had already started.
|
|
49
|
-
*/
|
|
50
|
-
readonly featureFlags?: FeatureFlags;
|
|
51
|
-
}
|
|
52
|
-
/** How one service answered a warmup: started, or why not, in `error`, redacted with the container's `redact`. */
|
|
53
|
-
export type ServiceWarmupOutcome = {
|
|
54
|
-
readonly serviceId: TestserverServiceId;
|
|
55
|
-
readonly ok: true;
|
|
56
|
-
readonly ms: number;
|
|
57
|
-
} | {
|
|
58
|
-
readonly serviceId: TestserverServiceId;
|
|
59
|
-
readonly ok: false;
|
|
60
|
-
readonly ms: number;
|
|
61
|
-
readonly error: string;
|
|
62
|
-
};
|
|
63
|
-
/** One `container.warmup` call: when it started on the SDK clock, how long it took, and how each service answered. */
|
|
64
|
-
export interface ServiceWarmup {
|
|
65
|
-
readonly startedAt: number;
|
|
66
|
-
readonly ms: number;
|
|
67
|
-
/** One per distinct service id, in the order first given. */
|
|
68
|
-
readonly services: readonly ServiceWarmupOutcome[];
|
|
69
|
-
}
|
|
70
|
-
/** A running container: the isolated state for one test, or one test file's tests, and the factories that seed it. */
|
|
71
|
-
export interface Container {
|
|
72
|
-
readonly testId: string;
|
|
73
|
-
readonly testserverUrl: string;
|
|
74
|
-
readonly info: ContainerInfo;
|
|
75
|
-
/** The feature flags it was started with, normalized: empty clients dropped, the rest in flag client order. */
|
|
76
|
-
readonly featureFlags: FeatureFlags;
|
|
77
|
-
/** Every factory call made so far, in order. */
|
|
78
|
-
readonly factoryCalls: readonly FactoryCall[];
|
|
79
|
-
/** Every API request `fetch` sent so far, failed ones included, in the order they ended. */
|
|
80
|
-
readonly apiRequests: readonly ApiRequestRecord[];
|
|
81
|
-
/** Every `warmup` with at least one service id, in the order they ended. */
|
|
82
|
-
readonly warmups: readonly ServiceWarmup[];
|
|
83
|
-
/** Seeds one entity through a factory definition (see `buildFactory`). */
|
|
84
|
-
build<D extends AnyFactoryDefinition>(definition: D, data: FactoryInput<D>, options?: FactoryOptions): Promise<FactoryOutput<D>>;
|
|
85
|
-
/** Seeds one entity through the factory at `path`, unchecked (see `buildUntypedFactory`). */
|
|
86
|
-
buildUntyped(path: string, data: unknown, options?: FactoryOptions): Promise<unknown>;
|
|
87
|
-
/**
|
|
88
|
-
* Sends one API request straight to the container's Testserver with its test id added, and nothing else: send
|
|
89
|
-
* `authorization` yourself. `path` starts with `/`; any other, a `test-id` header of the caller's, or a body that
|
|
90
|
-
* is a stream or an iterable, is a `TypeError`. Reads the whole answer, within the call timeout, and returns it
|
|
91
|
-
* whatever its status, but a 410 or 502 (the Testserver sandbox has expired or can't be reached) throws a
|
|
92
|
-
* `TestserverCallError`, its body excerpt redacted with `redact`, as does a timeout or a failed connection. An abort through `init.signal` rejects with the signal's reason. Each request is
|
|
93
|
-
* recorded in `apiRequests` before `fetch` resolves or rejects.
|
|
94
|
-
*/
|
|
95
|
-
fetch(path: string, init?: ContainerRequestInit): Promise<Response>;
|
|
96
|
-
/**
|
|
97
|
-
* Starts the container's services `serviceIds` names, each by asking its `readyz` (`GET /_/service/<id>/readyz`),
|
|
98
|
-
* all at once, and resolves once each has answered, with how each did. Testserver starts a service on its first
|
|
99
|
-
* request otherwise, so warming the services a test will use moves their start ahead of it. A service that fails or
|
|
100
|
-
* doesn't answer within the call timeout is reported, not thrown: it starts on first use as before. Repeated ids
|
|
101
|
-
* are warmed once. An empty list sends nothing and records nothing; any other is recorded in `warmups` before it
|
|
102
|
-
* resolves. An id that is empty or holds `/`, `?`, `#`, `%`, `\` or whitespace, which Testserver couldn't route, is
|
|
103
|
-
* a `TypeError`, before anything is sent. Not an API request: it isn't recorded in `apiRequests`.
|
|
104
|
-
*/
|
|
105
|
-
warmup(serviceIds: readonly TestserverServiceId[]): Promise<ServiceWarmup>;
|
|
106
|
-
/**
|
|
107
|
-
* Reads the container log: every record Testserver keeps for the container, finished or not, oldest first.
|
|
108
|
-
* Testserver keeps only the last 2,000, and none once the container has ended. A failed read throws a
|
|
109
|
-
* `TestserverCallError`.
|
|
110
|
-
*/
|
|
111
|
-
log(): Promise<readonly ContainerLogRecord[]>;
|
|
112
|
-
/**
|
|
113
|
-
* `text` with every token secret the container has seen replaced by `<token>`: each string under a token field in
|
|
114
|
-
* its factory calls' inputs and responses, and each bearer token its API requests sent. For printing what
|
|
115
|
-
* Testserver logged.
|
|
116
|
-
*/
|
|
117
|
-
redact(text: string): string;
|
|
118
|
-
/** Ends the container. Calling it again after it succeeded does nothing. */
|
|
119
|
-
end(): Promise<void>;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Starts a container and returns its handle; the caller ends it. Throws a `TestIdError` for a bad `testId` and a
|
|
123
|
-
* `TypeError` for `featureFlags` that aren't `FeatureFlags` before sending anything, and a `TestserverCallError` when
|
|
124
|
-
* the start fails.
|
|
125
|
-
*
|
|
126
|
-
* A start that may have reached Testserver and failed is followed by an attempt to end the container. When that end
|
|
127
|
-
* fails too, throws an `AggregateError` holding both call errors, the start's first and as its `cause`, and tries no
|
|
128
|
-
* more. Otherwise a start that timed out, couldn't connect, broke off, or got a 5xx other than 502 is tried once
|
|
129
|
-
* more after 250ms, under a fresh test id. The caller's `testId` is tried again only after a failed connection:
|
|
130
|
-
* ending a container retires its test id, and Testserver refuses every later request for a retired one. A start that
|
|
131
|
-
* fails every attempt throws the last attempt's `TestserverCallError`, carrying the attempts.
|
|
132
|
-
*
|
|
133
|
-
* Once a start succeeds, sets `featureFlags` before returning, one `PATCH /_/external/flags/<client>` for each
|
|
134
|
-
* client that has a flag, one after another, in `FEATURE_FLAG_CLIENTS` order, so they are in place before any
|
|
135
|
-
* service starts. A call that fails ends the container and throws its `TestserverCallError`, with no retry; when the
|
|
136
|
-
* end fails too, throws an `AggregateError` holding both, the feature flags' error first and as its `cause`.
|
|
137
|
-
*/
|
|
138
|
-
export declare function startContainer(options: ContainerOptions, context?: SdkContext): Promise<Container>;
|
|
139
|
-
/**
|
|
140
|
-
* Starts a container (retrying a failed start as `startContainer` does), runs `body` with it, and ends it however
|
|
141
|
-
* `body` finishes. Returns what `body` returns, and rethrows what it throws. When `body` throws and ending fails too, throws an `AggregateError` holding both, the
|
|
142
|
-
* body's error first and as its `cause`.
|
|
143
|
-
*/
|
|
144
|
-
export declare function withContainer<T>(options: ContainerOptions, body: (container: Container) => Promise<T>, context?: SdkContext): Promise<T>;
|
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
import { buildFactory, buildUntypedFactory, liveFactoryGateway, } from "../factories/index.js";
|
|
2
|
-
import { bearerToken, incomingHeaders, recordedBody, redactSecrets, tokenSecrets, } from "../records/index.js";
|
|
3
|
-
import { checkTestId, describeFailure, generateTestId, systemClock, TEST_ID_HEADER, TestserverCallError, testserverEndpoint, } from "../testserver/index.js";
|
|
4
|
-
import { apiRequestRecord, hasNullBody, readableWhole, refusedAnswer, } from "./api-request.js";
|
|
5
|
-
import { checkFeatureFlags, FEATURE_FLAG_CLIENTS, normalizeFeatureFlags } from "./feature-flags.js";
|
|
6
|
-
import { liveContainerGateway } from "./live/container-gateway.js";
|
|
7
|
-
/** How long a data-plane call may take by default: the allowance vercel-internal gives infrastructure calls. */
|
|
8
|
-
export const DEFAULT_TIMEOUT_MS = 45_000;
|
|
9
|
-
/**
|
|
10
|
-
* How long one container start attempt may take by default. Two attempts at 45s would outlast a 60s test timeout on
|
|
11
|
-
* a hung start.
|
|
12
|
-
*/
|
|
13
|
-
export const DEFAULT_START_TIMEOUT_MS = 15_000;
|
|
14
|
-
/** How many times a container start is attempted, as in vercel-internal's harness. */
|
|
15
|
-
export const START_ATTEMPTS = 2;
|
|
16
|
-
/** How long a container start waits before its next attempt. */
|
|
17
|
-
export const START_RETRY_DELAY_MS = 250;
|
|
18
|
-
/**
|
|
19
|
-
* The live Context: Testserver over `fetch`, each call under `timeoutMs` (default 45s) but each container start
|
|
20
|
-
* attempt under `startTimeoutMs` (default 15s), and the system clock.
|
|
21
|
-
*/
|
|
22
|
-
export function liveSdkContext(options = {}) {
|
|
23
|
-
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
24
|
-
const startTimeoutMs = options.startTimeoutMs ?? DEFAULT_START_TIMEOUT_MS;
|
|
25
|
-
return {
|
|
26
|
-
containers: liveContainerGateway({ timeoutMs, startTimeoutMs }),
|
|
27
|
-
factories: liveFactoryGateway({ timeoutMs }),
|
|
28
|
-
clock: systemClock,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Starts a container and returns its handle; the caller ends it. Throws a `TestIdError` for a bad `testId` and a
|
|
33
|
-
* `TypeError` for `featureFlags` that aren't `FeatureFlags` before sending anything, and a `TestserverCallError` when
|
|
34
|
-
* the start fails.
|
|
35
|
-
*
|
|
36
|
-
* A start that may have reached Testserver and failed is followed by an attempt to end the container. When that end
|
|
37
|
-
* fails too, throws an `AggregateError` holding both call errors, the start's first and as its `cause`, and tries no
|
|
38
|
-
* more. Otherwise a start that timed out, couldn't connect, broke off, or got a 5xx other than 502 is tried once
|
|
39
|
-
* more after 250ms, under a fresh test id. The caller's `testId` is tried again only after a failed connection:
|
|
40
|
-
* ending a container retires its test id, and Testserver refuses every later request for a retired one. A start that
|
|
41
|
-
* fails every attempt throws the last attempt's `TestserverCallError`, carrying the attempts.
|
|
42
|
-
*
|
|
43
|
-
* Once a start succeeds, sets `featureFlags` before returning, one `PATCH /_/external/flags/<client>` for each
|
|
44
|
-
* client that has a flag, one after another, in `FEATURE_FLAG_CLIENTS` order, so they are in place before any
|
|
45
|
-
* service starts. A call that fails ends the container and throws its `TestserverCallError`, with no retry; when the
|
|
46
|
-
* end fails too, throws an `AggregateError` holding both, the feature flags' error first and as its `cause`.
|
|
47
|
-
*/
|
|
48
|
-
export async function startContainer(options, context = liveSdkContext()) {
|
|
49
|
-
if (options.testId !== undefined)
|
|
50
|
-
checkTestId(options.testId);
|
|
51
|
-
if (options.featureFlags !== undefined)
|
|
52
|
-
checkFeatureFlags(options.featureFlags);
|
|
53
|
-
const featureFlags = normalizeFeatureFlags(options.featureFlags ?? {});
|
|
54
|
-
const { testserverUrl } = options;
|
|
55
|
-
const firstStartedAt = context.clock.now();
|
|
56
|
-
let first;
|
|
57
|
-
for (let attempt = 1;; attempt += 1) {
|
|
58
|
-
const testId = options.testId ?? generateTestId();
|
|
59
|
-
const started = await context.containers.start({
|
|
60
|
-
testserverUrl,
|
|
61
|
-
testId,
|
|
62
|
-
...(options.name === undefined ? {} : { name: options.name }),
|
|
63
|
-
...(options.meta === undefined ? {} : { meta: options.meta }),
|
|
64
|
-
});
|
|
65
|
-
if (started.ok) {
|
|
66
|
-
await setFeatureFlags(context, { testserverUrl, testId }, featureFlags);
|
|
67
|
-
return new RunningContainer(context, testserverUrl, testId, started.info, featureFlags);
|
|
68
|
-
}
|
|
69
|
-
first ??= started.failure;
|
|
70
|
-
const startError = new TestserverCallError({
|
|
71
|
-
call: { method: "PUT", path: "/_/test" },
|
|
72
|
-
testId,
|
|
73
|
-
testserverUrl,
|
|
74
|
-
failure: started.failure,
|
|
75
|
-
...(attempt === 1
|
|
76
|
-
? {}
|
|
77
|
-
: { attempts: { count: attempt, elapsedMs: context.clock.now() - firstStartedAt, first } }),
|
|
78
|
-
});
|
|
79
|
-
// A start that never connected reached nothing, so there is nothing to end and its test id is not retired.
|
|
80
|
-
const reached = started.failure.kind !== "connect-failed";
|
|
81
|
-
if (reached) {
|
|
82
|
-
const ended = await context.containers.end({ testserverUrl, testId });
|
|
83
|
-
if (!ended.ok) {
|
|
84
|
-
const endError = new TestserverCallError({
|
|
85
|
-
call: { method: "DELETE", path: "/_/test" },
|
|
86
|
-
testId,
|
|
87
|
-
testserverUrl,
|
|
88
|
-
failure: ended.failure,
|
|
89
|
-
});
|
|
90
|
-
throw new AggregateError([startError, endError], `${startError.message}; ending container ${testId} after the failed start also failed: ${endError.message}`, { cause: startError });
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
const retired = reached && options.testId !== undefined;
|
|
94
|
-
if (attempt >= START_ATTEMPTS || retired || !retriesStart(started.failure))
|
|
95
|
-
throw startError;
|
|
96
|
-
await context.clock.sleep(START_RETRY_DELAY_MS);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Sets each client's feature flags in a container just started, one after another. A call that fails ends the
|
|
101
|
-
* container and throws, as `startContainer` documents.
|
|
102
|
-
*/
|
|
103
|
-
async function setFeatureFlags(context, address, featureFlags) {
|
|
104
|
-
for (const client of FEATURE_FLAG_CLIENTS) {
|
|
105
|
-
const flags = featureFlags[client];
|
|
106
|
-
if (flags === undefined)
|
|
107
|
-
continue;
|
|
108
|
-
const set = await context.containers.setFeatureFlags({ ...address, client, flags });
|
|
109
|
-
if (set.ok)
|
|
110
|
-
continue;
|
|
111
|
-
const flagsError = new TestserverCallError({
|
|
112
|
-
call: { method: "PATCH", path: `/_/external/flags/${client}` },
|
|
113
|
-
...address,
|
|
114
|
-
failure: set.failure,
|
|
115
|
-
});
|
|
116
|
-
const ended = await context.containers.end(address);
|
|
117
|
-
if (!ended.ok) {
|
|
118
|
-
const endError = new TestserverCallError({
|
|
119
|
-
call: { method: "DELETE", path: "/_/test" },
|
|
120
|
-
...address,
|
|
121
|
-
failure: ended.failure,
|
|
122
|
-
});
|
|
123
|
-
throw new AggregateError([flagsError, endError], `${flagsError.message}; ending container ${address.testId} after its feature flags failed also failed: ${endError.message}`, { cause: flagsError });
|
|
124
|
-
}
|
|
125
|
-
throw flagsError;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Whether a failed start is worth another attempt: no answer, a failed or dropped connection, or a 5xx other than
|
|
130
|
-
* 502. A 4xx (a 410 included), a 502 (the Testserver sandbox has expired or can't be reached) or an answer that
|
|
131
|
-
* can't be read won't change.
|
|
132
|
-
*/
|
|
133
|
-
function retriesStart(failure) {
|
|
134
|
-
switch (failure.kind) {
|
|
135
|
-
case "timeout":
|
|
136
|
-
case "connect-failed":
|
|
137
|
-
case "dropped":
|
|
138
|
-
return true;
|
|
139
|
-
case "http-error":
|
|
140
|
-
return failure.status >= 500 && failure.status !== 502;
|
|
141
|
-
case "malformed":
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Starts a container (retrying a failed start as `startContainer` does), runs `body` with it, and ends it however
|
|
147
|
-
* `body` finishes. Returns what `body` returns, and rethrows what it throws. When `body` throws and ending fails too, throws an `AggregateError` holding both, the
|
|
148
|
-
* body's error first and as its `cause`.
|
|
149
|
-
*/
|
|
150
|
-
export async function withContainer(options, body, context) {
|
|
151
|
-
const container = await startContainer(options, context);
|
|
152
|
-
let result;
|
|
153
|
-
try {
|
|
154
|
-
result = await body(container);
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
try {
|
|
158
|
-
await container.end();
|
|
159
|
-
}
|
|
160
|
-
catch (endError) {
|
|
161
|
-
// oxlint-disable-next-line eslint/preserve-caught-error -- the body's error is the documented `cause`; `endError` is in `errors`.
|
|
162
|
-
throw new AggregateError([error, endError], `${messageOf(error)}; ending container ${container.testId} also failed: ${messageOf(endError)}`, { cause: error });
|
|
163
|
-
}
|
|
164
|
-
throw error;
|
|
165
|
-
}
|
|
166
|
-
await container.end();
|
|
167
|
-
return result;
|
|
168
|
-
}
|
|
169
|
-
class RunningContainer {
|
|
170
|
-
#context;
|
|
171
|
-
#factoryCalls = [];
|
|
172
|
-
#apiRequests = [];
|
|
173
|
-
#warmups = [];
|
|
174
|
-
/** Every token secret the container has seen, collected as each factory call and API request is recorded. */
|
|
175
|
-
#secrets = new Set();
|
|
176
|
-
#ended = false;
|
|
177
|
-
testserverUrl;
|
|
178
|
-
testId;
|
|
179
|
-
info;
|
|
180
|
-
featureFlags;
|
|
181
|
-
constructor(context, testserverUrl, testId, info, featureFlags) {
|
|
182
|
-
this.#context = context;
|
|
183
|
-
this.testserverUrl = testserverUrl;
|
|
184
|
-
this.testId = testId;
|
|
185
|
-
this.info = info;
|
|
186
|
-
this.featureFlags = featureFlags;
|
|
187
|
-
}
|
|
188
|
-
get factoryCalls() {
|
|
189
|
-
return [...this.#factoryCalls];
|
|
190
|
-
}
|
|
191
|
-
get apiRequests() {
|
|
192
|
-
return [...this.#apiRequests];
|
|
193
|
-
}
|
|
194
|
-
get warmups() {
|
|
195
|
-
return [...this.#warmups];
|
|
196
|
-
}
|
|
197
|
-
async build(definition, data, options) {
|
|
198
|
-
this.#assertRunning();
|
|
199
|
-
return buildFactory(this.#context, this.#target(), definition, data, options);
|
|
200
|
-
}
|
|
201
|
-
async buildUntyped(path, data, options) {
|
|
202
|
-
this.#assertRunning();
|
|
203
|
-
return buildUntypedFactory(this.#context, this.#target(), path, data, options);
|
|
204
|
-
}
|
|
205
|
-
async fetch(path, init) {
|
|
206
|
-
this.#assertRunning();
|
|
207
|
-
if (!path.startsWith("/")) {
|
|
208
|
-
throw new TypeError(`container.fetch takes a path under the Testserver URL, starting with "/", not ${JSON.stringify(path)}`);
|
|
209
|
-
}
|
|
210
|
-
if (new Headers(init?.headers).has(TEST_ID_HEADER)) {
|
|
211
|
-
throw new TypeError(`container.fetch adds the ${TEST_ID_HEADER} header itself; don't send one of your own`);
|
|
212
|
-
}
|
|
213
|
-
if (!readableWhole(init?.body)) {
|
|
214
|
-
throw new TypeError("container.fetch reads a body whole before sending it: pass a string, ArrayBuffer, typed array, Blob, FormData or URLSearchParams, not a stream or an iterable");
|
|
215
|
-
}
|
|
216
|
-
const { clock, containers } = this.#context;
|
|
217
|
-
const startedAt = clock.now();
|
|
218
|
-
// A `Request` reads every body type `ContainerRequestBody` holds, and fills in its content-type. Each is already in
|
|
219
|
-
// memory or a `Blob`, so reading it can't outlast an abort or the call timeout.
|
|
220
|
-
const request = new Request(testserverEndpoint(this.testserverUrl, path), init);
|
|
221
|
-
const body = new Uint8Array(await request.arrayBuffer());
|
|
222
|
-
const headers = [...request.headers];
|
|
223
|
-
const authorization = request.headers.get("authorization");
|
|
224
|
-
const bearer = bearerToken(authorization ?? undefined);
|
|
225
|
-
if (bearer !== undefined && bearer !== "")
|
|
226
|
-
this.#secrets.add(bearer);
|
|
227
|
-
const requestBody = recordedBody(body, body.byteLength, incomingHeaders(headers), bearer);
|
|
228
|
-
const signal = init?.signal ?? undefined;
|
|
229
|
-
const sent = await containers.sendApiRequest({
|
|
230
|
-
testserverUrl: this.testserverUrl,
|
|
231
|
-
testId: this.testId,
|
|
232
|
-
method: request.method,
|
|
233
|
-
path,
|
|
234
|
-
headers,
|
|
235
|
-
...(body.byteLength === 0 ? {} : { body }),
|
|
236
|
-
...(signal === undefined ? {} : { signal }),
|
|
237
|
-
});
|
|
238
|
-
const call = { method: request.method, path };
|
|
239
|
-
const record = (outcome, responseBody) => {
|
|
240
|
-
this.#apiRequests.push(apiRequestRecord({
|
|
241
|
-
method: request.method,
|
|
242
|
-
target: path,
|
|
243
|
-
authorization: authorization !== null,
|
|
244
|
-
requestBody,
|
|
245
|
-
responseBody,
|
|
246
|
-
startedAt,
|
|
247
|
-
durationMs: clock.now() - startedAt,
|
|
248
|
-
outcome,
|
|
249
|
-
}));
|
|
250
|
-
};
|
|
251
|
-
if (!sent.ok) {
|
|
252
|
-
if ("aborted" in sent) {
|
|
253
|
-
record({ error: "aborted" });
|
|
254
|
-
throw signal?.reason ?? new Error(`${call.method} ${path} was aborted`);
|
|
255
|
-
}
|
|
256
|
-
record({ error: describeFailure(sent.failure) });
|
|
257
|
-
throw this.#callError(call, sent.failure);
|
|
258
|
-
}
|
|
259
|
-
const { answer } = sent;
|
|
260
|
-
const responseBody = recordedBody(answer.body, answer.body.byteLength, incomingHeaders(answer.headers), bearer);
|
|
261
|
-
const refused = refusedAnswer(answer.status, answer.body, (text) => this.redact(text));
|
|
262
|
-
if (refused !== undefined) {
|
|
263
|
-
record({ status: answer.status, error: describeFailure(refused) }, responseBody);
|
|
264
|
-
throw this.#callError(call, refused);
|
|
265
|
-
}
|
|
266
|
-
record({ status: answer.status }, responseBody);
|
|
267
|
-
return new Response(hasNullBody(request.method, answer.status) ? null : new Uint8Array(answer.body), {
|
|
268
|
-
status: answer.status,
|
|
269
|
-
statusText: answer.statusText,
|
|
270
|
-
headers: answer.headers.map(([name, value]) => [name, value]),
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
async warmup(serviceIds) {
|
|
274
|
-
this.#assertRunning();
|
|
275
|
-
for (const serviceId of serviceIds)
|
|
276
|
-
checkServiceId(serviceId);
|
|
277
|
-
const { clock, containers } = this.#context;
|
|
278
|
-
const startedAt = clock.now();
|
|
279
|
-
const unique = [...new Set(serviceIds)];
|
|
280
|
-
if (unique.length === 0)
|
|
281
|
-
return { startedAt, ms: 0, services: [] };
|
|
282
|
-
const services = await Promise.all(unique.map(async (serviceId) => {
|
|
283
|
-
const from = clock.now();
|
|
284
|
-
const outcome = await containers.warmService({
|
|
285
|
-
testserverUrl: this.testserverUrl,
|
|
286
|
-
testId: this.testId,
|
|
287
|
-
serviceId,
|
|
288
|
-
});
|
|
289
|
-
const ms = clock.now() - from;
|
|
290
|
-
return outcome.ok
|
|
291
|
-
? { serviceId, ok: true, ms }
|
|
292
|
-
: { serviceId, ok: false, ms, error: this.redact(describeFailure(outcome.failure)) };
|
|
293
|
-
}));
|
|
294
|
-
const warmup = { startedAt, ms: clock.now() - startedAt, services };
|
|
295
|
-
this.#warmups.push(warmup);
|
|
296
|
-
return warmup;
|
|
297
|
-
}
|
|
298
|
-
async log() {
|
|
299
|
-
this.#assertRunning();
|
|
300
|
-
const read = await this.#context.containers.readLog({ testserverUrl: this.testserverUrl, testId: this.testId });
|
|
301
|
-
if (!read.ok)
|
|
302
|
-
throw this.#callError({ method: "GET", path: "/_/log" }, read.failure);
|
|
303
|
-
return read.records;
|
|
304
|
-
}
|
|
305
|
-
redact(text) {
|
|
306
|
-
return redactSecrets(text, this.#secrets);
|
|
307
|
-
}
|
|
308
|
-
async end() {
|
|
309
|
-
if (this.#ended)
|
|
310
|
-
return;
|
|
311
|
-
const outcome = await this.#context.containers.end({ testserverUrl: this.testserverUrl, testId: this.testId });
|
|
312
|
-
if (!outcome.ok)
|
|
313
|
-
throw this.#callError({ method: "DELETE", path: "/_/test" }, outcome.failure);
|
|
314
|
-
this.#ended = true;
|
|
315
|
-
}
|
|
316
|
-
#target() {
|
|
317
|
-
return { testserverUrl: this.testserverUrl, testId: this.testId, record: (call) => this.#recordFactoryCall(call) };
|
|
318
|
-
}
|
|
319
|
-
/** Keeps a factory call's record, and every token secret in its input, options and response. */
|
|
320
|
-
#recordFactoryCall(call) {
|
|
321
|
-
this.#factoryCalls.push(call);
|
|
322
|
-
const seen = [call.input, call.options, call.outcome.ok ? call.outcome.response : undefined];
|
|
323
|
-
for (const value of seen)
|
|
324
|
-
for (const secret of tokenSecrets(value))
|
|
325
|
-
this.#secrets.add(secret);
|
|
326
|
-
}
|
|
327
|
-
#callError(call, failure) {
|
|
328
|
-
return new TestserverCallError({ call, testId: this.testId, testserverUrl: this.testserverUrl, failure });
|
|
329
|
-
}
|
|
330
|
-
#assertRunning() {
|
|
331
|
-
if (this.#ended)
|
|
332
|
-
throw new Error(`container ${this.testId} has ended`);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
/** Characters that would change the path `/_/service/<id>/readyz` routes on: Testserver doesn't decode it. */
|
|
336
|
-
const UNROUTABLE_SERVICE_ID = /[/?#%\\\s]/;
|
|
337
|
-
/** Throws a `TypeError` for a service id Testserver couldn't route under `/_/service/<id>/`. */
|
|
338
|
-
function checkServiceId(serviceId) {
|
|
339
|
-
if (serviceId === "" || UNROUTABLE_SERVICE_ID.test(serviceId)) {
|
|
340
|
-
throw new TypeError(`container.warmup takes Testserver service ids, such as "api-user", that it can route under /_/service/<id>/; ` +
|
|
341
|
-
`not ${JSON.stringify(serviceId)}`);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
function messageOf(error) {
|
|
345
|
-
return error instanceof Error ? error.message : String(error);
|
|
346
|
-
}
|