@cnc-tools/storm 0.10.0 → 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/dist/bin/storm.js +17 -9
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-YF3ICDBY.js → chunk-3ZZVZPMG.js} +1 -1
- package/dist/chunks/{chunk-JQ2HK4RN.js → chunk-4EU4AH7E.js} +141 -6
- package/dist/chunks/{chunk-ZJ2USLAT.js → chunk-4PRAB24Y.js} +2 -22
- package/dist/chunks/chunk-AMTYHUYB.js +257 -0
- package/dist/chunks/{chunk-WF4KJ7YG.js → chunk-ETCZ6WP7.js} +1 -1
- package/dist/chunks/chunk-FVMQKYTT.js +10 -0
- package/dist/chunks/{chunk-XHJGHJBW.js → chunk-GRMD7G4J.js} +33 -275
- package/dist/chunks/chunk-ICB4BZJX.js +22 -0
- package/dist/chunks/{chunk-AGWW3HDT.js → chunk-KR7WIYLG.js} +1826 -2201
- package/dist/chunks/{chunk-OVXD7GES.js → chunk-L4ZPMSKQ.js} +4 -37
- package/dist/chunks/chunk-NPPJ57W7.js +569 -0
- package/dist/chunks/{chunk-VJQLMGOH.js → chunk-O4BUT7BE.js} +361 -1716
- package/dist/chunks/chunk-OJOKQRM6.js +1457 -0
- package/dist/chunks/chunk-SLNKW4ZM.js +40 -0
- package/dist/chunks/{chunk-AKKNF3WZ.js → chunk-TRFEAYNC.js} +277 -348
- 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-RIJM3QFD.js → live-app-LOGYUBKB.js} +52 -7
- package/dist/commands/exec/cleanup.d.ts +3 -3
- package/dist/commands/exec/cleanup.js +6 -2
- package/dist/commands/exec/command.d.ts +3 -3
- package/dist/commands/exec/command.js +17 -10
- package/dist/commands/exec/job-summary.d.ts +1 -1
- package/dist/commands/exec/job-summary.js +1 -1
- package/dist/commands/exec/live-view.js +5 -5
- package/dist/commands/exec/mint-failed.js +1 -1
- package/dist/commands/exec/outcomes.d.ts +2 -2
- package/dist/commands/exec/outcomes.js +7 -8
- package/dist/commands/exec/plan-run.d.ts +3 -5
- package/dist/commands/exec/progress.d.ts +3 -3
- package/dist/commands/exec/progress.js +6 -6
- package/dist/commands/exec/resource-refusals.d.ts +1 -1
- package/dist/commands/exec/resource-refusals.js +1 -1
- package/dist/commands/exec/run-command.d.ts +14 -9
- package/dist/commands/exec/run-command.js +91 -202
- package/dist/commands/exec/run-metadata.d.ts +2 -2
- package/dist/commands/exec/run-metadata.js +3 -3
- package/dist/commands/exec/test-plan.d.ts +1 -35
- package/dist/commands/exec/test-plan.js +4 -24
- package/dist/commands/exec/view.js +3 -3
- package/dist/commands/exec/waterfall.d.ts +3 -1
- package/dist/commands/exec/waterfall.js +18 -1
- package/dist/commands/runs/facts.d.ts +2 -1
- package/dist/commands/runs/facts.js +1 -1
- package/dist/commands/runs/list/command.js +10 -9
- package/dist/commands/runs/logs/command.js +14 -12
- package/dist/commands/runs/past-run.d.ts +3 -27
- package/dist/commands/runs/past-run.js +3 -37
- package/dist/commands/runs/show/command.js +24 -21
- package/dist/commands/runs/show/outcomes.js +2 -2
- package/dist/commands/vitest/command.d.ts +3 -3
- package/dist/commands/vitest/command.js +24 -17
- package/dist/commands/vitest/outcomes.d.ts +1 -1
- package/dist/commands/vitest/outcomes.js +1 -1
- package/dist/config/credential-resolver.d.ts +6 -3
- package/dist/config/credential-resolver.js +6 -5
- package/dist/context.d.ts +27 -9
- package/dist/context.js +19 -8
- package/dist/core/before-run.d.ts +5 -4
- package/dist/core/before-run.js +6 -6
- package/dist/core/definition-lookup.d.ts +22 -0
- package/dist/core/definition-lookup.js +34 -0
- package/dist/core/events.d.ts +5 -19
- package/dist/core/gateways.d.ts +22 -162
- package/dist/core/index.d.ts +10 -11
- package/dist/core/index.js +9 -11
- package/dist/core/launcher-supplies.js +2 -2
- package/dist/core/live/terminal-command-gateway.d.ts +8 -0
- package/dist/core/live/terminal-command-gateway.js +49 -0
- package/dist/core/presentations.d.ts +4 -3
- package/dist/core/presentations.js +4 -5
- package/dist/core/resource-registry.d.ts +35 -51
- package/dist/core/resource-registry.js +27 -54
- package/dist/core/resource-reports.d.ts +37 -4
- package/dist/core/resource-reports.js +34 -5
- package/dist/core/resources.d.ts +4 -3
- package/dist/core/resources.js +2 -4
- package/dist/core/run-state.d.ts +1 -1
- package/dist/core/run-state.js +1 -1
- package/dist/core/run.d.ts +19 -37
- package/dist/core/run.js +59 -114
- package/dist/core/timeline.js +2 -1
- package/dist/credential/events.d.ts +20 -0
- package/dist/credential/events.js +4 -0
- package/dist/credential/index.d.ts +2 -1
- package/dist/credential/index.js +6 -5
- package/dist/credential/source.d.ts +38 -26
- package/dist/credential/source.js +25 -34
- package/dist/extension-commands.d.ts +12 -6
- package/dist/extension-commands.js +18 -11
- 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/command-tree.d.ts +1 -1
- package/dist/extensions/testserver/command-tree.js +0 -1
- package/dist/extensions/testserver/commands/pool/create/command.js +14 -8
- package/dist/extensions/testserver/commands/pool/list/command.js +8 -4
- package/dist/extensions/testserver/vitest/config.d.ts +7 -5
- package/dist/extensions/testserver/vitest/config.js +7 -5
- package/dist/extensions/testserver/vitest/fixtures.d.ts +2 -0
- package/dist/extensions/testserver/vitest/fixtures.js +36 -5
- package/dist/extensions.d.ts +12 -21
- package/dist/extensions.js +22 -34
- package/dist/forward-sigterm.d.ts +8 -0
- package/dist/forward-sigterm.js +18 -0
- package/dist/launcher-resolvers/index.d.ts +1 -0
- package/dist/launcher-resolvers/index.js +2 -1
- package/dist/launcher-resolvers/local-services.d.ts +57 -0
- package/dist/launcher-resolvers/local-services.js +7 -0
- package/dist/live-app.js +2 -1
- package/dist/local-services.d.ts +19 -0
- package/dist/local-services.js +37 -0
- 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/{commands/exec → run-directory}/run-collector.d.ts +9 -8
- package/dist/{commands/exec → run-directory}/run-collector.js +8 -10
- package/dist/{core → run-directory}/run-directory.d.ts +3 -3
- package/dist/{core → run-directory}/run-directory.js +2 -2
- package/dist/{commands/exec → run-directory}/run-record.d.ts +29 -7
- package/dist/{commands/exec → run-directory}/run-record.js +79 -5
- package/dist/{commands/exec → run-directory}/timeline-facts.d.ts +4 -8
- package/dist/{commands/exec → run-directory}/timeline-facts.js +8 -24
- package/dist/runner/events.d.ts +6 -5
- package/dist/runner/index.d.ts +13 -17
- package/dist/runner/index.js +10 -14
- package/dist/runner/prepare.d.ts +28 -6
- package/dist/runner/prepare.js +15 -9
- package/dist/runner/recipe.d.ts +14 -0
- package/dist/runner/recipe.js +12 -0
- package/dist/runner/scope.d.ts +18 -11
- package/dist/runner/scope.js +12 -10
- package/dist/runner/session.d.ts +100 -0
- package/dist/runner/session.js +109 -0
- package/dist/runner/snapshot-save.d.ts +3 -2
- package/dist/runner/snapshot-save.js +6 -5
- package/dist/sdk/extension/ci.d.ts +2 -0
- package/dist/sdk/extension/ci.js +6 -0
- package/dist/sdk/extension/commands.d.ts +11 -13
- package/dist/sdk/extension/commands.js +5 -5
- package/dist/sdk/extension/index.d.ts +1 -0
- package/dist/sdk/extension/index.js +1 -0
- package/dist/sdk/extension/lifecycle.d.ts +4 -3
- package/dist/sdk/extension/progress.js +2 -2
- package/dist/sdk/extension/resource.js +1 -1
- 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/vendor/testserver-sdk/container/container.d.ts +11 -6
- package/dist/vendor/testserver-sdk/container/container.js +38 -16
- package/dist/vendor/testserver-sdk/testserver/failure.d.ts +4 -3
- package/dist/vendor/testserver-sdk/testserver/failure.js +4 -3
- package/package.json +1 -1
- package/skills/overview.md +3 -0
- package/skills/read-run-output.md +2 -2
- package/dist/chunks/chunk-H2VCSNVU.js +0 -351
- package/dist/chunks/chunk-J6ZNYUDV.js +0 -21
- package/dist/core/mint.d.ts +0 -10
- package/dist/core/mint.js +0 -14
- package/dist/story/mode.d.ts +0 -17
- package/dist/story/mode.js +0 -21
- /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
|
@@ -1,235 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
function optionKeyPath(key, option) {
|
|
7
|
-
return ["resources", key, option].join(".");
|
|
8
|
-
}
|
|
9
|
-
function resourceCall(name) {
|
|
10
|
-
return `${name}({ \u2026 })`;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// src/sdk/extension/credential.ts
|
|
14
|
-
import { inspect } from "node:util";
|
|
15
|
-
var RENDERED = "[credential]";
|
|
16
|
-
var Credential = class {
|
|
17
|
-
#token;
|
|
18
|
-
#claims;
|
|
19
|
-
constructor(token) {
|
|
20
|
-
this.#token = token;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* The token itself, for the request header of the service a resource calls with it and the runner's live Sandbox
|
|
24
|
-
* gateway (which hands it to `@vercel/sandbox`) only.
|
|
25
|
-
*/
|
|
26
|
-
reveal() {
|
|
27
|
-
return this.#token;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* The team and project the token was minted for, from its `owner_id` and `project_id` JWT claims, decoded once.
|
|
31
|
-
* `undefined` when the token isn't a JWT or lacks either claim. The token itself never leaves the credential.
|
|
32
|
-
*/
|
|
33
|
-
vercelProject() {
|
|
34
|
-
const { owner_id: teamId, project_id: projectId } = this.#decoded() ?? {};
|
|
35
|
-
if (!isFilled(teamId) || !isFilled(projectId)) return void 0;
|
|
36
|
-
return { teamId, projectId };
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The `aud` and `repository` claims of a GitHub Actions OIDC token, which a service's trust rules match on.
|
|
40
|
-
* `undefined` when the token isn't a JWT or lacks either claim as a non-empty string. The token itself never
|
|
41
|
-
* leaves the credential.
|
|
42
|
-
*/
|
|
43
|
-
githubActionsClaims() {
|
|
44
|
-
const { aud, repository } = this.#decoded() ?? {};
|
|
45
|
-
if (!isFilled(aud) || !isFilled(repository)) return void 0;
|
|
46
|
-
return { aud, repository };
|
|
47
|
-
}
|
|
48
|
-
/** The token's JWT claims, decoded once; `undefined` when it isn't a JWT with an object payload. */
|
|
49
|
-
#decoded() {
|
|
50
|
-
if (this.#claims === void 0) this.#claims = decodeClaims(this.#token) ?? null;
|
|
51
|
-
return this.#claims ?? void 0;
|
|
52
|
-
}
|
|
53
|
-
toString() {
|
|
54
|
-
return RENDERED;
|
|
55
|
-
}
|
|
56
|
-
toJSON() {
|
|
57
|
-
return RENDERED;
|
|
58
|
-
}
|
|
59
|
-
[inspect.custom]() {
|
|
60
|
-
return RENDERED;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
function decodeClaims(token) {
|
|
64
|
-
const parts = token.split(".");
|
|
65
|
-
const payload = parts[1];
|
|
66
|
-
if (parts.length !== 3 || payload === void 0 || payload === "") return void 0;
|
|
67
|
-
let claims;
|
|
68
|
-
try {
|
|
69
|
-
claims = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
70
|
-
} catch {
|
|
71
|
-
return void 0;
|
|
72
|
-
}
|
|
73
|
-
if (typeof claims !== "object" || claims === null || Array.isArray(claims)) return void 0;
|
|
74
|
-
return claims;
|
|
75
|
-
}
|
|
76
|
-
function isFilled(value) {
|
|
77
|
-
return typeof value === "string" && value !== "";
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// src/sdk/extension/credential-diagnosis.ts
|
|
81
|
-
function describeMintFailure(failure, target) {
|
|
82
|
-
const loginStep = `\`vercel login\` with an account on the \`${target.team}\` team`;
|
|
83
|
-
const networkFix = "Check your network connection and any VPN or proxy, then retry.";
|
|
84
|
-
switch (failure.kind) {
|
|
85
|
-
case "vercel-not-found":
|
|
86
|
-
return {
|
|
87
|
-
cause: "`vercel` is not on PATH",
|
|
88
|
-
fix: `Install it with \`npm i -g vercel@latest\`, run ${loginStep}, then retry.`
|
|
89
|
-
};
|
|
90
|
-
case "timeout":
|
|
91
|
-
return {
|
|
92
|
-
cause: failure.step.command === "project token" ? `\`vercel project token\` timed out after ${failure.seconds}s` : `${whoamiCheck(failure.step.mintSaid)} timed out after ${failure.seconds}s`,
|
|
93
|
-
fix: networkFix
|
|
94
|
-
};
|
|
95
|
-
case "unreachable":
|
|
96
|
-
return {
|
|
97
|
-
cause: failure.step.command === "project token" ? `\`vercel project token\` couldn't reach Vercel: ${failure.said}` : `${whoamiCheck(failure.step.mintSaid)} couldn't reach Vercel: ${failure.said}`,
|
|
98
|
-
fix: networkFix
|
|
99
|
-
};
|
|
100
|
-
case "outdated-cli":
|
|
101
|
-
return {
|
|
102
|
-
cause: `\`vercel\` on PATH is older than 53.3.0, the first with \`project token --format=json\`: ${failure.said}`,
|
|
103
|
-
fix: "Upgrade it with `npm i -g vercel@latest`, then retry."
|
|
104
|
-
};
|
|
105
|
-
case "project-not-found":
|
|
106
|
-
return {
|
|
107
|
-
cause: `\`vercel\` found no project \`${target.project}\` on team \`${target.team}\`: ${failure.said}`,
|
|
108
|
-
fix: `Check the project name in \`--project\` or \`storm.config.ts\` (\`project\`) for team \`${target.team}\`, then retry.`
|
|
109
|
-
};
|
|
110
|
-
case "unrecognized":
|
|
111
|
-
return {
|
|
112
|
-
cause: `\`vercel project token\` failed: ${failure.said}`,
|
|
113
|
-
fix: "Retry. If it fails the same way again, act on what `vercel` said."
|
|
114
|
-
};
|
|
115
|
-
case "login-lapsed":
|
|
116
|
-
return {
|
|
117
|
-
cause: `the saved \`vercel login\` is missing, expired or invalid (\`vercel whoami\`: ${failure.whoamiSaid}). \`vercel project token\` said: ${failure.said}`,
|
|
118
|
-
fix: `Run ${loginStep}, then retry.`
|
|
119
|
-
};
|
|
120
|
-
case "no-team-access": {
|
|
121
|
-
const user = failure.user ?? "the logged-in account";
|
|
122
|
-
const works = failure.user === void 0 ? "`vercel whoami` works" : `\`vercel whoami\` works, as ${failure.user}`;
|
|
123
|
-
return {
|
|
124
|
-
cause: `${failure.said} (${works})`,
|
|
125
|
-
fix: `Check the team name in \`--scope\` or \`storm.config.ts\` (\`scope\`). Then ask an owner of the \`${target.team}\` team to add ${user}; if ${user} is already a member, run \`vercel login\` again, then retry.`
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function whoamiCheck(mintSaid) {
|
|
131
|
-
return `\`vercel project token\` failed: ${mintSaid}. \`vercel whoami\`, run to check the login,`;
|
|
132
|
-
}
|
|
133
|
-
function describeTokenRequestFailure(failure) {
|
|
134
|
-
if (failure.kind === "variables-missing")
|
|
135
|
-
return {
|
|
136
|
-
cause: `${variablesText(failure.missing)} ${failure.missing.length === 1 ? "isn't" : "aren't"} set; GitHub Actions sets them only in a job with \`id-token: write\``,
|
|
137
|
-
fix: "Add `permissions: id-token: write` to the job, then rerun it."
|
|
138
|
-
};
|
|
139
|
-
const { last, attempts } = failure;
|
|
140
|
-
const tries = attempts === 1 ? "" : ` (${attempts} attempts)`;
|
|
141
|
-
const fix = "Rerun the job. If the request fails again, act on what GitHub answered.";
|
|
142
|
-
switch (last.kind) {
|
|
143
|
-
case "unreachable":
|
|
144
|
-
return { cause: `the token request couldn't reach GitHub${tries}: ${last.said}`, fix };
|
|
145
|
-
case "timeout":
|
|
146
|
-
return { cause: `GitHub didn't answer the token request within ${last.seconds}s${tries}`, fix };
|
|
147
|
-
case "http-error":
|
|
148
|
-
return { cause: `GitHub answered the token request with HTTP ${last.status}${tries}: ${last.said}`, fix };
|
|
149
|
-
case "bad-response":
|
|
150
|
-
return { cause: `GitHub's answer to the token request held no token: ${last.said}`, fix };
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function describeCredentialFailure(failure) {
|
|
154
|
-
return failure.source === "mint" ? describeMintFailure(failure.failure, failure.target) : describeTokenRequestFailure(failure.failure);
|
|
155
|
-
}
|
|
156
|
-
function variablesText(missing) {
|
|
157
|
-
return missing.map((name) => `\`${name}\``).join(" and ");
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// src/sdk/extension/token-request-facts.ts
|
|
161
|
-
import { z } from "zod";
|
|
162
|
-
var tokenRequestFailureShape = {
|
|
163
|
-
/** Why it failed: the job's variables are missing, or the request failed. */
|
|
164
|
-
cause: z.enum(["variables-missing", "request-failed"]),
|
|
165
|
-
/** The variables that aren't set, under variables-missing; null otherwise. */
|
|
166
|
-
missing: z.array(z.enum(["ACTIONS_ID_TOKEN_REQUEST_URL", "ACTIONS_ID_TOKEN_REQUEST_TOKEN"])).nullable(),
|
|
167
|
-
/** The HTTP status GitHub answered the last attempt with; null when it answered none, or 2xx without a token. */
|
|
168
|
-
status: z.number().nullable(),
|
|
169
|
-
/** What GitHub or the connection said to the last attempt, at most 200 characters; null when nothing. */
|
|
170
|
-
said: z.string().nullable(),
|
|
171
|
-
/** The cause, for a person. */
|
|
172
|
-
detail: z.string(),
|
|
173
|
-
/** The one fix. */
|
|
174
|
-
fix: z.string()
|
|
175
|
-
};
|
|
176
|
-
function tokenRequestFailureFacts(failure) {
|
|
177
|
-
const { cause: detail, fix } = describeTokenRequestFailure(failure);
|
|
178
|
-
if (failure.kind === "variables-missing")
|
|
179
|
-
return { cause: failure.kind, missing: [...failure.missing], status: null, said: null, detail, fix };
|
|
180
|
-
const { last } = failure;
|
|
181
|
-
return {
|
|
182
|
-
cause: failure.kind,
|
|
183
|
-
missing: null,
|
|
184
|
-
status: last.kind === "http-error" ? last.status : null,
|
|
185
|
-
said: "said" in last ? last.said : null,
|
|
186
|
-
detail,
|
|
187
|
-
fix
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// src/sdk/extension/resource.ts
|
|
192
|
-
function defineResource(spec) {
|
|
193
|
-
const { name, flagPrefix, options, check: check2, payload, world, lifecycle, progress } = spec;
|
|
194
|
-
if (payload.name !== name) throw new Error(`The resource ${name}'s payload contract is ${payload.name}'s`);
|
|
195
|
-
const definition = {
|
|
196
|
-
name,
|
|
197
|
-
flagPrefix,
|
|
198
|
-
options,
|
|
199
|
-
check: check2 ?? (() => []),
|
|
200
|
-
payload,
|
|
201
|
-
world,
|
|
202
|
-
lifecycle,
|
|
203
|
-
...progress === void 0 ? {} : { progress }
|
|
204
|
-
};
|
|
205
|
-
return definition;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// src/sdk/extension/resource-factory.ts
|
|
209
|
-
function resourceFactory(definition) {
|
|
210
|
-
const make = (given = {}) => ({
|
|
211
|
-
name: definition.name,
|
|
212
|
-
options: { ...given }
|
|
213
|
-
});
|
|
214
|
-
return Object.assign(make, { definition });
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// src/sdk/extension/rules.ts
|
|
218
|
-
import { z as z2 } from "zod";
|
|
219
|
-
function describeValue(value) {
|
|
220
|
-
if (typeof value === "string") return JSON.stringify(value);
|
|
221
|
-
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
222
|
-
if (value === null) return "null";
|
|
223
|
-
if (value === void 0) return "undefined";
|
|
224
|
-
if (typeof value === "function") return "a function";
|
|
225
|
-
if (Array.isArray(value)) return "an array";
|
|
226
|
-
return typeof value === "object" ? "an object" : `a ${typeof value}`;
|
|
227
|
-
}
|
|
228
|
-
function mustBe(rule) {
|
|
229
|
-
return { error: (issue) => `must be ${rule}, not ${describeValue(issue.input)}` };
|
|
230
|
-
}
|
|
231
|
-
var nonEmptyString = z2.string(mustBe("a non-empty string")).min(1, mustBe("a non-empty string"));
|
|
232
|
-
var booleanOption = z2.boolean(mustBe("true or false"));
|
|
1
|
+
import {
|
|
2
|
+
booleanOption,
|
|
3
|
+
mustBe,
|
|
4
|
+
nonEmptyString
|
|
5
|
+
} from "./chunk-AMTYHUYB.js";
|
|
233
6
|
|
|
234
7
|
// src/extensions/testserver/options/channels.ts
|
|
235
8
|
var BUILD_CHANNELS = ["stable", "latest_main"];
|
|
@@ -344,19 +117,19 @@ function minTimeLeftMinutes(options) {
|
|
|
344
117
|
}
|
|
345
118
|
|
|
346
119
|
// src/extensions/testserver/options/rules.ts
|
|
347
|
-
import { z
|
|
120
|
+
import { z } from "zod";
|
|
348
121
|
var SANDBOX_COUNT = `a whole number from ${MIN_SANDBOXES} to ${MAX_SANDBOXES}`;
|
|
349
|
-
var sandboxCount =
|
|
122
|
+
var sandboxCount = z.number(mustBe(SANDBOX_COUNT)).int(mustBe(SANDBOX_COUNT)).min(MIN_SANDBOXES, mustBe(SANDBOX_COUNT)).max(MAX_SANDBOXES, mustBe(SANDBOX_COUNT));
|
|
350
123
|
var build = nonEmptyString.transform((value, context) => {
|
|
351
124
|
const parsed = parseBuildReference(value);
|
|
352
125
|
if (parsed.ok) return buildReferenceText(parsed.reference);
|
|
353
126
|
context.issues.push({ code: "custom", message: parsed.problem, input: value });
|
|
354
|
-
return
|
|
127
|
+
return z.NEVER;
|
|
355
128
|
});
|
|
356
129
|
var DURATION = "a whole number of minutes or hours, such as 30m or 2h";
|
|
357
|
-
var duration =
|
|
130
|
+
var duration = z.string(mustBe(DURATION)).refine((value) => parseDuration(value) !== void 0, mustBe(DURATION));
|
|
358
131
|
var TTL = "a whole number of minutes or hours from 10m to 5h";
|
|
359
|
-
var ttl =
|
|
132
|
+
var ttl = z.string(mustBe(TTL)).refine((value) => parseTtl(value) !== void 0, mustBe(TTL));
|
|
360
133
|
var testserverPoolRules = {
|
|
361
134
|
/**
|
|
362
135
|
* How many Testserver sandboxes a run gets: 1 to 32; by default 1, or with `storm vitest` one per 4 test files
|
|
@@ -473,13 +246,13 @@ function createFailureText(facts) {
|
|
|
473
246
|
}
|
|
474
247
|
|
|
475
248
|
// src/extensions/testserver/sandbox/live/builds-response.ts
|
|
476
|
-
import { z as
|
|
477
|
-
var wireBuildSchema =
|
|
478
|
-
bundleName:
|
|
479
|
-
commitSha:
|
|
480
|
-
createdAt:
|
|
249
|
+
import { z as z2 } from "zod";
|
|
250
|
+
var wireBuildSchema = z2.object({
|
|
251
|
+
bundleName: z2.string().min(1),
|
|
252
|
+
commitSha: z2.string().optional(),
|
|
253
|
+
createdAt: z2.string().optional()
|
|
481
254
|
});
|
|
482
|
-
var buildsSchema =
|
|
255
|
+
var buildsSchema = z2.object({ stable: wireBuildSchema.nullable(), main: z2.array(wireBuildSchema) });
|
|
483
256
|
function parseBuilds(json) {
|
|
484
257
|
const parsed = buildsSchema.safeParse(json);
|
|
485
258
|
if (!parsed.success) {
|
|
@@ -1049,27 +822,27 @@ import { hostname as osHostname } from "node:os";
|
|
|
1049
822
|
import { basename, dirname, join } from "node:path";
|
|
1050
823
|
|
|
1051
824
|
// src/extensions/testserver/pool/live/pool-records.ts
|
|
1052
|
-
import { z as
|
|
1053
|
-
var isoTime =
|
|
1054
|
-
var entrySchema =
|
|
1055
|
-
version:
|
|
1056
|
-
testserverUrl:
|
|
1057
|
-
logViewerUrl:
|
|
825
|
+
import { z as z3 } from "zod";
|
|
826
|
+
var isoTime = z3.string().refine((value) => !Number.isNaN(Date.parse(value)), { message: "not a time" });
|
|
827
|
+
var entrySchema = z3.object({
|
|
828
|
+
version: z3.literal(1),
|
|
829
|
+
testserverUrl: z3.string().min(1),
|
|
830
|
+
logViewerUrl: z3.string().min(1),
|
|
1058
831
|
createdAt: isoTime,
|
|
1059
|
-
ttlMinutes:
|
|
1060
|
-
requestedBuild:
|
|
1061
|
-
resolvedBuild:
|
|
1062
|
-
headSha:
|
|
832
|
+
ttlMinutes: z3.number().int().positive(),
|
|
833
|
+
requestedBuild: z3.string().min(1),
|
|
834
|
+
resolvedBuild: z3.string().min(1),
|
|
835
|
+
headSha: z3.string().regex(/^[0-9a-f]{40}$/).optional()
|
|
1063
836
|
});
|
|
1064
|
-
var leaseSchema =
|
|
1065
|
-
version:
|
|
1066
|
-
pid:
|
|
1067
|
-
hostname:
|
|
837
|
+
var leaseSchema = z3.object({
|
|
838
|
+
version: z3.literal(1),
|
|
839
|
+
pid: z3.number().int().positive(),
|
|
840
|
+
hostname: z3.string(),
|
|
1068
841
|
startedAt: isoTime
|
|
1069
842
|
});
|
|
1070
|
-
var channelsSchema =
|
|
1071
|
-
version:
|
|
1072
|
-
channels:
|
|
843
|
+
var channelsSchema = z3.object({
|
|
844
|
+
version: z3.literal(1),
|
|
845
|
+
channels: z3.record(z3.string(), z3.object({ build: z3.string().min(1), learnedAt: isoTime }))
|
|
1073
846
|
});
|
|
1074
847
|
function parseEntry(text) {
|
|
1075
848
|
const parsed = parseVersioned(text, entrySchema);
|
|
@@ -1464,21 +1237,6 @@ function failureAt(path, error) {
|
|
|
1464
1237
|
}
|
|
1465
1238
|
|
|
1466
1239
|
export {
|
|
1467
|
-
Credential,
|
|
1468
|
-
describeMintFailure,
|
|
1469
|
-
describeCredentialFailure,
|
|
1470
|
-
tokenRequestFailureShape,
|
|
1471
|
-
tokenRequestFailureFacts,
|
|
1472
|
-
defineResource,
|
|
1473
|
-
NOT_COUNTED,
|
|
1474
|
-
defaultResourceKey,
|
|
1475
|
-
optionKeyPath,
|
|
1476
|
-
resourceCall,
|
|
1477
|
-
resourceFactory,
|
|
1478
|
-
describeValue,
|
|
1479
|
-
mustBe,
|
|
1480
|
-
nonEmptyString,
|
|
1481
|
-
booleanOption,
|
|
1482
1240
|
TESTSERVER_REPO,
|
|
1483
1241
|
parseBuildReference,
|
|
1484
1242
|
shortSha,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mount
|
|
3
|
+
} from "./chunk-4PRAB24Y.js";
|
|
4
|
+
|
|
5
|
+
// src/sdk/extension/commands.ts
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
function defineExtensionCommands(definition) {
|
|
8
|
+
const { description, tree, directory, app } = definition;
|
|
9
|
+
return {
|
|
10
|
+
description,
|
|
11
|
+
directory,
|
|
12
|
+
mount: ({ path, root }) => mount(tree.directory(join(root, directory)), { path, description, app })
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function defineExtension(extension) {
|
|
16
|
+
return extension;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
defineExtensionCommands,
|
|
21
|
+
defineExtension
|
|
22
|
+
};
|