@testsprite/testsprite-cli 0.15.0 → 0.17.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/README.md +53 -141
- package/dist/commands/agent.d.ts +12 -4
- package/dist/commands/agent.js +55 -65
- package/dist/commands/auth.d.ts +6 -10
- package/dist/commands/auth.js +44 -56
- package/dist/commands/ci.d.ts +23 -100
- package/dist/commands/ci.js +297 -489
- package/dist/commands/completion.js +2 -1
- package/dist/commands/conversation.d.ts +27 -0
- package/dist/commands/conversation.js +702 -0
- package/dist/commands/doctor.d.ts +5 -1
- package/dist/commands/doctor.js +130 -34
- package/dist/commands/init.d.ts +4 -45
- package/dist/commands/init.js +116 -68
- package/dist/commands/project-env.d.ts +62 -2
- package/dist/commands/project-env.js +426 -53
- package/dist/commands/project-sign-in.d.ts +0 -48
- package/dist/commands/project-sign-in.js +1 -224
- package/dist/commands/project.d.ts +15 -186
- package/dist/commands/project.js +93 -921
- package/dist/commands/result.d.ts +10 -0
- package/dist/commands/result.js +215 -0
- package/dist/commands/schedule.d.ts +0 -29
- package/dist/commands/schedule.js +47 -97
- package/dist/commands/test.d.ts +315 -1824
- package/dist/commands/test.js +1962 -13733
- package/dist/commands/testlist.d.ts +128 -5
- package/dist/commands/testlist.js +269 -329
- package/dist/commands/tunnel.d.ts +2 -2
- package/dist/commands/tunnel.js +43 -41
- package/dist/commands/usage.d.ts +12 -45
- package/dist/commands/usage.js +51 -131
- package/dist/index.js +189 -108
- package/dist/lib/agent-detect.js +9 -5
- package/dist/lib/agent-targets.d.ts +21 -2
- package/dist/lib/agent-targets.js +88 -11
- package/dist/lib/args.d.ts +13 -0
- package/dist/lib/args.js +49 -0
- package/dist/lib/basic-auth.d.ts +3 -0
- package/dist/lib/basic-auth.js +15 -0
- package/dist/lib/billing-refusal.js +4 -3
- package/dist/lib/ci-linkage.d.ts +4 -82
- package/dist/lib/ci-linkage.js +4 -157
- package/dist/lib/ci-run.js +1 -1
- package/dist/lib/client-factory.d.ts +10 -2
- package/dist/lib/client-factory.js +38 -26
- package/dist/lib/commit-signal.d.ts +65 -0
- package/dist/lib/commit-signal.js +305 -0
- package/dist/lib/concurrency-limiter.d.ts +6 -0
- package/dist/lib/concurrency-limiter.js +29 -0
- package/dist/lib/config.js +10 -5
- package/dist/lib/conflict-reason.d.ts +31 -4
- package/dist/lib/conflict-reason.js +38 -4
- package/dist/lib/conversation/answers.d.ts +9 -0
- package/dist/lib/conversation/answers.js +49 -0
- package/dist/lib/conversation/api.d.ts +71 -0
- package/dist/lib/conversation/api.js +150 -0
- package/dist/lib/conversation/change.d.ts +31 -0
- package/dist/lib/conversation/change.js +124 -0
- package/dist/lib/conversation/context.d.ts +19 -0
- package/dist/lib/conversation/context.js +70 -0
- package/dist/lib/conversation/environment.d.ts +15 -0
- package/dist/lib/conversation/environment.js +33 -0
- package/dist/lib/conversation/follow.d.ts +24 -0
- package/dist/lib/conversation/follow.js +42 -0
- package/dist/lib/conversation/render.d.ts +33 -0
- package/dist/lib/conversation/render.js +315 -0
- package/dist/lib/conversation/title.d.ts +2 -0
- package/dist/lib/conversation/title.js +18 -0
- package/dist/lib/conversation/types.d.ts +156 -0
- package/dist/lib/conversation/types.js +6 -0
- package/dist/lib/credentials.js +67 -11
- package/dist/lib/cron.d.ts +1 -1
- package/dist/lib/cron.js +2 -2
- package/dist/lib/dispatch-stop.d.ts +20 -0
- package/dist/lib/dispatch-stop.js +30 -0
- package/dist/lib/download.d.ts +71 -0
- package/dist/lib/download.js +274 -0
- package/dist/lib/dry-run/fetch.d.ts +10 -0
- package/dist/lib/dry-run/fetch.js +20 -0
- package/dist/lib/dry-run/samples.d.ts +6 -34
- package/dist/lib/dry-run/samples.js +389 -751
- package/dist/lib/environment-tunnel.d.ts +16 -26
- package/dist/lib/environment-tunnel.js +161 -157
- package/dist/lib/errors.d.ts +20 -4
- package/dist/lib/errors.js +36 -16
- package/dist/lib/facade.d.ts +7 -29
- package/dist/lib/facade.js +7 -36
- package/dist/lib/failing-fe-resolver.d.ts +13 -58
- package/dist/lib/failing-fe-resolver.js +47 -132
- package/dist/lib/first-suite-hint.d.ts +16 -22
- package/dist/lib/first-suite-hint.js +38 -47
- package/dist/lib/gh-output.d.ts +76 -21
- package/dist/lib/gh-output.js +171 -90
- package/dist/lib/git-utils.d.ts +56 -0
- package/dist/lib/git-utils.js +212 -0
- package/dist/lib/github-context.d.ts +2 -0
- package/dist/lib/github-context.js +40 -8
- package/dist/lib/history-retention.d.ts +6 -2
- package/dist/lib/history-retention.js +10 -7
- package/dist/lib/http.d.ts +58 -134
- package/dist/lib/http.js +352 -271
- package/dist/lib/interrupt.d.ts +14 -8
- package/dist/lib/interrupt.js +28 -10
- package/dist/lib/junit-report.d.ts +60 -4
- package/dist/lib/junit-report.js +209 -32
- package/dist/lib/local-target.d.ts +3 -3
- package/dist/lib/local-target.js +3 -3
- package/dist/lib/output.d.ts +0 -29
- package/dist/lib/output.js +10 -33
- package/dist/lib/pagination.d.ts +2 -5
- package/dist/lib/pagination.js +2 -5
- package/dist/lib/presigned-url.d.ts +22 -0
- package/dist/lib/presigned-url.js +90 -0
- package/dist/lib/prompt.js +36 -2
- package/dist/lib/proxy.js +2 -1
- package/dist/lib/redact.d.ts +2 -2
- package/dist/lib/redact.js +3 -4
- package/dist/lib/removed-commands.d.ts +18 -0
- package/dist/lib/removed-commands.js +154 -0
- package/dist/lib/render-error.d.ts +31 -6
- package/dist/lib/render-error.js +88 -25
- package/dist/lib/response-schemas.d.ts +38 -30
- package/dist/lib/response-schemas.js +210 -207
- package/dist/lib/result/api.d.ts +24 -0
- package/dist/lib/result/api.js +28 -0
- package/dist/lib/result/evidence.d.ts +71 -0
- package/dist/lib/result/evidence.js +420 -0
- package/dist/lib/result/render.d.ts +20 -0
- package/dist/lib/result/render.js +194 -0
- package/dist/lib/result/types.d.ts +122 -0
- package/dist/lib/result/types.js +19 -0
- package/dist/lib/run-output.d.ts +275 -0
- package/dist/lib/run-output.js +227 -0
- package/dist/lib/run-render.d.ts +101 -0
- package/dist/lib/run-render.js +183 -0
- package/dist/lib/run-wait.d.ts +192 -0
- package/dist/lib/run-wait.js +452 -0
- package/dist/lib/runs.types.d.ts +134 -367
- package/dist/lib/runs.types.js +0 -14
- package/dist/lib/secret-file.d.ts +1 -1
- package/dist/lib/secret-file.js +11 -2
- package/dist/lib/skill-nudge.d.ts +7 -27
- package/dist/lib/skill-nudge.js +9 -37
- package/dist/lib/target-path.d.ts +15 -0
- package/dist/lib/target-path.js +35 -0
- package/dist/lib/target-url-advisory.d.ts +19 -0
- package/dist/lib/target-url-advisory.js +31 -0
- package/dist/lib/target-url-preflight.d.ts +9 -0
- package/dist/lib/target-url-preflight.js +214 -106
- package/dist/lib/target-url.d.ts +1 -1
- package/dist/lib/target-url.js +6 -16
- package/dist/lib/telemetry.d.ts +32 -12
- package/dist/lib/telemetry.js +39 -8
- package/dist/lib/terminal-text.d.ts +41 -0
- package/dist/lib/terminal-text.js +127 -0
- package/dist/lib/testlist.types.d.ts +16 -8
- package/dist/lib/testlist.types.js +1 -1
- package/dist/lib/text-equality.d.ts +2 -0
- package/dist/lib/text-equality.js +5 -0
- package/dist/lib/text-file.d.ts +16 -0
- package/dist/lib/text-file.js +41 -0
- package/dist/lib/text-table.d.ts +46 -0
- package/dist/lib/text-table.js +72 -4
- package/dist/lib/ticker.d.ts +9 -2
- package/dist/lib/ticker.js +16 -3
- package/dist/lib/transport-failure.d.ts +22 -0
- package/dist/lib/transport-failure.js +126 -0
- package/dist/lib/tunnel-session.d.ts +7 -1
- package/dist/lib/tunnel-session.js +22 -9
- package/dist/lib/update-check.js +3 -2
- package/dist/lib/url-template.d.ts +43 -0
- package/dist/lib/url-template.js +151 -0
- package/dist/lib/validate.d.ts +0 -64
- package/dist/lib/validate.js +2 -131
- package/dist/lib/version-notice.js +4 -3
- package/dist/lib/wait-exit.d.ts +37 -2
- package/dist/lib/wait-exit.js +88 -30
- package/dist/lib/workspace-status.js +10 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -4
- package/skills/testsprite-ci.skill.md +48 -18
- package/skills/testsprite-onboard.skill.md +66 -151
- package/skills/testsprite-verify.codex.md +54 -56
- package/skills/testsprite-verify.skill.md +194 -358
- package/dist/lib/browser.d.ts +0 -6
- package/dist/lib/browser.js +0 -54
- package/dist/lib/bundle.d.ts +0 -234
- package/dist/lib/bundle.js +0 -781
- package/dist/lib/deprecate.d.ts +0 -10
- package/dist/lib/deprecate.js +0 -13
- package/dist/lib/flaky.d.ts +0 -91
- package/dist/lib/flaky.js +0 -71
- package/dist/lib/plan-poll.d.ts +0 -171
- package/dist/lib/plan-poll.js +0 -441
- package/dist/lib/plans.types.d.ts +0 -130
- package/dist/lib/plans.types.js +0 -31
- package/dist/lib/poll.d.ts +0 -100
- package/dist/lib/poll.js +0 -290
- package/dist/lib/rate-throttle.d.ts +0 -49
- package/dist/lib/rate-throttle.js +0 -75
- package/dist/lib/run-progress.d.ts +0 -41
- package/dist/lib/run-progress.js +0 -56
- package/dist/lib/v3-advisory.d.ts +0 -55
- package/dist/lib/v3-advisory.js +0 -74
- package/schemas/plan.schema.json +0 -61
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* runtime validation, so a drifted or partial server response surfaced as
|
|
6
6
|
* `undefined` output or an opaque TypeError deep inside a command. These
|
|
7
7
|
* schemas are wired (opt-in, via `RequestOptions.schema`) into the typed
|
|
8
|
-
* HttpClient helpers
|
|
9
|
-
*
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
12
|
-
* `get`/`post`/`put`/`patch`/`delete` caller stays
|
|
8
|
+
* HttpClient helpers (the run, test-list, tunnel and execution-report calls), and —
|
|
9
|
+
* for the account surfaces below — the `client.get` call sites that own a
|
|
10
|
+
* `/me` or usage read, plus the `client.get` call sites that
|
|
11
|
+
* own the `project get` / `project list` reads. Every other generic
|
|
12
|
+
* `get`/`post`/`put`/`patch`/`delete` caller stays
|
|
13
|
+
* schema-free and opt-in.
|
|
13
14
|
*
|
|
14
15
|
* Resilience rules (additive server changes must never hard-fail the CLI):
|
|
15
16
|
*
|
|
@@ -22,12 +23,12 @@
|
|
|
22
23
|
* the poll continues; renderers print the raw value), so a new server enum
|
|
23
24
|
* member must degrade gracefully, never reject the whole response.
|
|
24
25
|
* 3. REQUIRED-nullable interface fields use `v.nullish(inner, null)`: the wire
|
|
25
|
-
* may omit a nullable field entirely (real fixture evidence:
|
|
26
|
-
*
|
|
26
|
+
* may omit a nullable field entirely (real fixture evidence: poll bodies
|
|
27
|
+
* that omit `error`), and
|
|
27
28
|
* every consumer already null-checks these, so absence normalizes to
|
|
28
29
|
* `null` instead of failing. OPTIONAL interface fields (`?`) use
|
|
29
30
|
* `v.optional` with NO default so presence/absence semantics that commands
|
|
30
|
-
* branch on (e.g. `
|
|
31
|
+
* branch on (e.g. `RunResponse.runId`) survive
|
|
31
32
|
* validation byte-identically.
|
|
32
33
|
*
|
|
33
34
|
* Each schema is annotated `v.GenericSchema<unknown, T>` against the
|
|
@@ -45,6 +46,30 @@ import * as v from 'valibot';
|
|
|
45
46
|
function openWireLiteral() {
|
|
46
47
|
return v.custom(value => typeof value === 'string');
|
|
47
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* GET /projects/{id} and the rows of GET /projects. Optional fields stay
|
|
51
|
+
* absent when omitted. The renderer-consumed environment fields are typed so
|
|
52
|
+
* a drifted value cannot throw in the text renderer.
|
|
53
|
+
*/
|
|
54
|
+
export const CLI_PROJECT_SCHEMA = v.looseObject({
|
|
55
|
+
id: v.string(),
|
|
56
|
+
name: v.string(),
|
|
57
|
+
type: openWireLiteral(),
|
|
58
|
+
createdFrom: openWireLiteral(),
|
|
59
|
+
createdAt: v.string(),
|
|
60
|
+
updatedAt: v.string(),
|
|
61
|
+
orgId: v.optional(v.string()),
|
|
62
|
+
orgName: v.optional(v.string()),
|
|
63
|
+
defaultEnvironment: v.optional(v.nullable(v.string())),
|
|
64
|
+
environmentCount: v.optional(v.number()),
|
|
65
|
+
instruction: v.optional(v.nullable(v.string())),
|
|
66
|
+
testIdAttributes: v.optional(v.nullable(v.array(v.string()))),
|
|
67
|
+
});
|
|
68
|
+
/** GET /projects page; an omitted `nextToken` normalizes to the terminal `null` cursor. */
|
|
69
|
+
export const CLI_PROJECT_LIST_SCHEMA = v.looseObject({
|
|
70
|
+
items: v.array(CLI_PROJECT_SCHEMA),
|
|
71
|
+
nextToken: v.nullish(v.string(), null),
|
|
72
|
+
});
|
|
48
73
|
/**
|
|
49
74
|
* Mirrors `RunEnvironmentRef` (runs.types.ts): the environment a run resolved to.
|
|
50
75
|
* Optional + nullable everywhere it appears: absent on an older backend, `null`
|
|
@@ -67,27 +92,17 @@ const RUN_STEP_SUMMARY_SCHEMA = v.looseObject({
|
|
|
67
92
|
passedCount: v.number(),
|
|
68
93
|
failedCount: v.number(),
|
|
69
94
|
});
|
|
70
|
-
/** Mirrors `RunStepDto` (runs.types.ts): one `?includeSteps=true` step row. */
|
|
71
|
-
const RUN_STEP_DTO_SCHEMA = v.looseObject({
|
|
72
|
-
stepIndex: v.string(),
|
|
73
|
-
type: openWireLiteral(),
|
|
74
|
-
action: v.string(),
|
|
75
|
-
status: v.nullish(openWireLiteral(), null),
|
|
76
|
-
description: v.nullish(v.string(), null),
|
|
77
|
-
error: v.nullish(v.string(), null),
|
|
78
|
-
screenshotUrl: v.nullish(v.string(), null),
|
|
79
|
-
htmlSnapshotUrl: v.nullish(v.string(), null),
|
|
80
|
-
createdAt: v.string(),
|
|
81
|
-
});
|
|
82
95
|
/** Mirrors `RunResponse` (runs.types.ts): `GET /api/cli/v1/runs/{runId}`. */
|
|
83
96
|
export const RUN_RESPONSE_SCHEMA = v.looseObject({
|
|
84
|
-
|
|
97
|
+
resultId: v.string(),
|
|
85
98
|
testId: v.string(),
|
|
86
99
|
// The test's human title (for CI output). Absent on older servers; the type
|
|
87
100
|
// keeps it optional and renderers fall back to `testId`.
|
|
88
101
|
testTitle: v.nullish(v.string(), null),
|
|
89
102
|
projectId: v.string(),
|
|
90
103
|
userId: v.string(),
|
|
104
|
+
// The launch this result belongs to; an older backend omits it.
|
|
105
|
+
runId: v.optional(v.string()),
|
|
91
106
|
status: openWireLiteral(),
|
|
92
107
|
source: v.string(),
|
|
93
108
|
createdAt: v.string(),
|
|
@@ -118,170 +133,95 @@ export const RUN_RESPONSE_SCHEMA = v.looseObject({
|
|
|
118
133
|
caveat: v.nullish(v.string()),
|
|
119
134
|
})),
|
|
120
135
|
retryAfterSeconds: v.optional(v.number()),
|
|
121
|
-
// Portal link
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
// — the CLI computes its own legacy V2-shaped link. **Present + string** —
|
|
125
|
-
// the backend built a correct link (it alone knows which store answered
|
|
126
|
-
// and this environment's portal origin) — use it verbatim. **Present +
|
|
127
|
-
// `null`** — the backend deliberately has no correct link to offer (e.g. a
|
|
128
|
-
// V3-native entity with no DynamoDB mirror row for the client's V2-shaped
|
|
129
|
-
// guess to land on) — suppress the link entirely; a client-side guess here
|
|
130
|
-
// would be exactly the dead link the server declined to emit. The backend
|
|
131
|
-
// always includes the key going forward (typed `string | null`, never
|
|
132
|
-
// omitted when it has an opinion) — an earlier revision of this comment
|
|
133
|
-
// described the backend as omitting the key on "no correct link", which
|
|
134
|
-
// was the actual production defect this contract closes: the client's
|
|
135
|
-
// absent-branch fallback was firing on real V3-native no-link responses
|
|
136
|
-
// and printing the dead legacy URL this whole feature exists to remove.
|
|
136
|
+
// Portal link, server-built only (the CLI never builds one): a string is
|
|
137
|
+
// used verbatim; `null` means the backend has no correct link to offer and
|
|
138
|
+
// is rendered like an absent key.
|
|
137
139
|
//
|
|
138
|
-
// The `undefined` default (NOT `null`, unlike every field above) is
|
|
139
|
-
//
|
|
140
|
+
// The `undefined` default (NOT `null`, unlike every field above) is
|
|
141
|
+
// load-bearing: valibot applies a default only when the key is absent, and
|
|
140
142
|
// skips the assignment entirely when that default is `undefined` — so an
|
|
141
|
-
// omitted field stays an ABSENT key
|
|
142
|
-
//
|
|
143
|
-
// `resolveDashboardUrl` helper) reads to decide "old backend, compute the
|
|
144
|
-
// link myself". Aligning this with the `nullish(..., null)` fields above
|
|
145
|
-
// would materialize the key on every response and silently kill that
|
|
146
|
-
// fallback. A wire `null` is preserved as null here (nullable passes it
|
|
147
|
-
// through untouched) and normalized at the consumer, not in the schema.
|
|
143
|
+
// omitted field stays an ABSENT key and `--output json` passes it through
|
|
144
|
+
// unchanged instead of materializing `"dashboardUrl": null` on every run.
|
|
148
145
|
// Locked by tests in response-schemas.test.ts.
|
|
149
146
|
dashboardUrl: v.nullish(v.string(), undefined),
|
|
150
147
|
// Same absent-key-preserving contract as `dashboardUrl` (see the note above):
|
|
151
|
-
// the run-scoped execution-result link is
|
|
152
|
-
//
|
|
148
|
+
// the run-scoped execution-result link is absent when the server has none,
|
|
149
|
+
// and never materialized as null.
|
|
153
150
|
executionUrl: v.nullish(v.string(), undefined),
|
|
154
|
-
// Absence means "steps not requested" and drives command branching, so no
|
|
155
|
-
// default is applied (rule 3, optional branch).
|
|
156
|
-
steps: v.optional(v.nullable(v.array(RUN_STEP_DTO_SCHEMA))),
|
|
157
151
|
});
|
|
158
152
|
// ---------------------------------------------------------------------------
|
|
159
153
|
// POST /runs/{runId}/cancel
|
|
160
154
|
// ---------------------------------------------------------------------------
|
|
161
|
-
/** Mirrors `CancelRunRefund` (runs.types.ts): optional
|
|
155
|
+
/** Mirrors `CancelRunRefund` (runs.types.ts): optional per-result refund outcome. */
|
|
162
156
|
const CANCEL_RUN_REFUND_SCHEMA = v.looseObject({
|
|
163
157
|
status: openWireLiteral(),
|
|
164
158
|
amount: v.optional(v.number()),
|
|
165
159
|
});
|
|
166
160
|
/** Mirrors `CancelRunResponse` (runs.types.ts): the run envelope plus cancel metadata. */
|
|
167
|
-
export const CANCEL_RUN_RESPONSE_SCHEMA = v.
|
|
168
|
-
|
|
169
|
-
v.
|
|
161
|
+
export const CANCEL_RUN_RESPONSE_SCHEMA = v.looseObject({
|
|
162
|
+
runId: v.string(),
|
|
163
|
+
alreadyCancelled: v.boolean(),
|
|
164
|
+
alreadyFinished: v.boolean(),
|
|
165
|
+
results: v.array(v.looseObject({
|
|
166
|
+
resultId: v.string(),
|
|
167
|
+
runId: v.nullable(v.string()),
|
|
168
|
+
testId: v.nullable(v.string()),
|
|
169
|
+
title: v.string(),
|
|
170
|
+
status: openWireLiteral(),
|
|
170
171
|
alreadyCancelled: v.boolean(),
|
|
171
|
-
|
|
172
|
-
// default: absence must stay absent so JSON output passes through unchanged.
|
|
172
|
+
alreadyFinished: v.boolean(),
|
|
173
173
|
refund: v.optional(CANCEL_RUN_REFUND_SCHEMA),
|
|
174
|
-
}),
|
|
175
|
-
|
|
174
|
+
})),
|
|
175
|
+
});
|
|
176
176
|
// ---------------------------------------------------------------------------
|
|
177
177
|
// POST /tests/{testId}/runs
|
|
178
178
|
// ---------------------------------------------------------------------------
|
|
179
179
|
/** Mirrors `TriggerRunResponse` (runs.types.ts): `POST /tests/{testId}/runs`. */
|
|
180
180
|
export const TRIGGER_RUN_RESPONSE_SCHEMA = v.looseObject({
|
|
181
|
-
|
|
181
|
+
resultId: v.string(),
|
|
182
182
|
status: openWireLiteral(),
|
|
183
|
+
// The launch this result belongs to; an older backend omits it.
|
|
184
|
+
runId: v.optional(v.string()),
|
|
183
185
|
enqueuedAt: v.string(),
|
|
184
186
|
codeVersion: v.string(),
|
|
185
187
|
targetUrl: v.string(),
|
|
186
|
-
// Optional with NO default (rule 3)
|
|
187
|
-
//
|
|
188
|
-
// stripped what we sent", which is precisely what the opt-out advisory
|
|
189
|
-
// keys on. Defaulting it to `false` would make an old backend look like
|
|
190
|
-
// it had honoured `--no-auto-heal`.
|
|
188
|
+
// Optional with NO default (rule 3): `undefined` means this backend
|
|
189
|
+
// predates the field; the CLI reports the server's decision as given.
|
|
191
190
|
autoHeal: v.optional(v.boolean()),
|
|
192
191
|
// The run's environment — optional with no default (rule 3, optional branch).
|
|
193
192
|
environment: OPTIONAL_ENVIRONMENT_SCHEMA,
|
|
194
193
|
// Server-built portal links (backend ≥ the run-links change). Optional
|
|
195
|
-
// with no default (rule 3): an older backend omits them, and a
|
|
194
|
+
// with no default (rule 3): an older backend omits them, and a run
|
|
196
195
|
// the server could not link stays ABSENT — the renderer prints a
|
|
197
196
|
// `dashboard` line only when the key is present.
|
|
198
197
|
dashboardUrl: v.optional(v.string()),
|
|
199
198
|
executionUrl: v.optional(v.string()),
|
|
199
|
+
// Present-or-omitted echo of the request's `skipDependencies: true`; no default.
|
|
200
|
+
skipDependencies: v.optional(v.boolean()),
|
|
200
201
|
});
|
|
201
202
|
// ---------------------------------------------------------------------------
|
|
202
|
-
// POST /tests/
|
|
203
|
+
// POST /tests/batch/run
|
|
203
204
|
// ---------------------------------------------------------------------------
|
|
204
|
-
/**
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
role: openWireLiteral(),
|
|
209
|
-
});
|
|
210
|
-
/** Mirrors `RerunClosure` (runs.types.ts): BE closure breakdown. */
|
|
211
|
-
const RERUN_CLOSURE_SCHEMA = v.looseObject({
|
|
212
|
-
members: v.array(RERUN_CLOSURE_MEMBER_SCHEMA),
|
|
213
|
-
addedProducers: v.array(v.string()),
|
|
214
|
-
addedTeardowns: v.array(v.string()),
|
|
215
|
-
clearedCaptured: v.number(),
|
|
216
|
-
});
|
|
217
|
-
/**
|
|
218
|
-
* Mirrors `RerunAdvisory` (runs.types.ts): a server-side note that a
|
|
219
|
-
* requested option was forwarded to the execution engine but is not yet
|
|
220
|
-
* honored there. Present only on a V3-routed rerun that explicitly opted
|
|
221
|
-
* out of auto-heal — absent everywhere else, so this schema is only ever
|
|
222
|
-
* used inside an `v.optional(v.array(...))` wrapper.
|
|
223
|
-
*/
|
|
224
|
-
const RERUN_ADVISORY_SCHEMA = v.looseObject({
|
|
225
|
-
feature: v.string(),
|
|
226
|
-
message: v.string(),
|
|
227
|
-
});
|
|
228
|
-
/** Mirrors `RerunResponse` (runs.types.ts): `POST /tests/{testId}/runs/rerun`. */
|
|
229
|
-
export const RERUN_RESPONSE_SCHEMA = v.looseObject({
|
|
230
|
-
runId: v.string(),
|
|
231
|
-
status: openWireLiteral(),
|
|
205
|
+
/** Modern project launch; never accept a legacy batch envelope. */
|
|
206
|
+
export const PROJECT_RUN_RESPONSE_SCHEMA = v.looseObject({
|
|
207
|
+
runId: v.pipe(v.string(), v.nonEmpty()),
|
|
208
|
+
projectId: v.pipe(v.string(), v.nonEmpty()),
|
|
232
209
|
enqueuedAt: v.string(),
|
|
233
|
-
|
|
210
|
+
total: v.pipe(v.number(), v.integer(), v.minValue(0)),
|
|
234
211
|
autoHeal: v.boolean(),
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
// autoHeal:false opt-out (rule 3: optional, no default, so presence/absence
|
|
240
|
-
// survives validation byte-identically). Older backends that predate the
|
|
241
|
-
// field simply omit it — never fails validation.
|
|
242
|
-
advisories: v.optional(v.array(RERUN_ADVISORY_SCHEMA)),
|
|
243
|
-
// Same present-or-absent portal links as TRIGGER_RUN_RESPONSE_SCHEMA.
|
|
212
|
+
maxConcurrency: v.optional(v.number()),
|
|
213
|
+
environment: v.nullable(v.looseObject({ id: v.nullable(v.string()), name: v.nullable(v.string()) })),
|
|
214
|
+
targetUrl: v.nullable(v.string()),
|
|
215
|
+
tunnelClientId: v.optional(v.string()),
|
|
244
216
|
dashboardUrl: v.optional(v.string()),
|
|
245
|
-
|
|
246
|
-
});
|
|
247
|
-
// ---------------------------------------------------------------------------
|
|
248
|
-
// POST /tests/batch/rerun
|
|
249
|
-
// ---------------------------------------------------------------------------
|
|
250
|
-
/** Mirrors `BatchRerunResponse` (runs.types.ts): `POST /tests/batch/rerun`. */
|
|
251
|
-
export const BATCH_RERUN_RESPONSE_SCHEMA = v.looseObject({
|
|
252
|
-
// Mirrors BatchRerunAccepted (runs.types.ts).
|
|
253
|
-
accepted: v.array(v.looseObject({ testId: v.string(), runId: v.string(), enqueuedAt: v.string() })),
|
|
254
|
-
// Mirrors BatchRerunDeferred (runs.types.ts).
|
|
255
|
-
deferred: v.array(v.looseObject({ testId: v.string(), reason: v.string() })),
|
|
256
|
-
// Mirrors BatchRerunConflict (runs.types.ts). `currentRunId` is optional,
|
|
257
|
-
// as in the two schemas below: a refusal only carries a run id when there
|
|
258
|
-
// is a run to point at.
|
|
259
|
-
conflicts: v.array(v.looseObject({
|
|
217
|
+
blocked: v.array(v.looseObject({
|
|
260
218
|
testId: v.string(),
|
|
261
|
-
|
|
262
|
-
reason: v.
|
|
219
|
+
resultId: v.string(),
|
|
220
|
+
reason: v.string(),
|
|
263
221
|
message: v.optional(v.string()),
|
|
264
222
|
})),
|
|
265
|
-
|
|
266
|
-
closure: v.looseObject({
|
|
267
|
-
byProject: v.array(v.looseObject({
|
|
268
|
-
projectId: v.string(),
|
|
269
|
-
testIds: v.array(v.string()),
|
|
270
|
-
addedProducers: v.array(v.string()),
|
|
271
|
-
addedTeardowns: v.array(v.string()),
|
|
272
|
-
clearedCaptured: v.number(),
|
|
273
|
-
})),
|
|
274
|
-
}),
|
|
275
|
-
// Optional on the wire for back-compat with older backends (D2-CLI).
|
|
276
|
-
notFound: v.optional(v.array(v.string())),
|
|
277
|
-
// Absent on every response except a V3-routed batch containing at least
|
|
278
|
-
// one FE test with an explicit autoHeal:false opt-out. Same resilience
|
|
279
|
-
// rule as RERUN_RESPONSE_SCHEMA.advisories above.
|
|
280
|
-
advisories: v.optional(v.array(RERUN_ADVISORY_SCHEMA)),
|
|
223
|
+
held: v.array(v.looseObject({ testId: v.string(), runId: v.string(), resultId: v.string() })),
|
|
281
224
|
});
|
|
282
|
-
// ---------------------------------------------------------------------------
|
|
283
|
-
// POST /tests/batch/run
|
|
284
|
-
// ---------------------------------------------------------------------------
|
|
285
225
|
/** Mirrors `BatchRunFreshResponse` (runs.types.ts): `POST /tests/batch/run`. */
|
|
286
226
|
export const BATCH_RUN_FRESH_RESPONSE_SCHEMA = v.looseObject({
|
|
287
227
|
// See TRIGGER_RUN_RESPONSE_SCHEMA; absence carries the same meaning.
|
|
@@ -290,14 +230,15 @@ export const BATCH_RUN_FRESH_RESPONSE_SCHEMA = v.looseObject({
|
|
|
290
230
|
// client-synthesized, tolerated as optional.
|
|
291
231
|
accepted: v.array(v.looseObject({
|
|
292
232
|
testId: v.string(),
|
|
293
|
-
|
|
233
|
+
resultId: v.string(),
|
|
294
234
|
enqueuedAt: v.string(),
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
executionId: v.optional(v.string()),
|
|
235
|
+
// Runs name their execution; an older backend omits it.
|
|
236
|
+
runId: v.optional(v.string()),
|
|
298
237
|
})),
|
|
299
238
|
conflicts: v.array(v.looseObject({
|
|
300
239
|
testId: v.string(),
|
|
240
|
+
currentResultId: v.optional(v.string()),
|
|
241
|
+
// The launch the in-flight result belongs to; an older backend omits it.
|
|
301
242
|
currentRunId: v.optional(v.string()),
|
|
302
243
|
reason: v.optional(v.string()),
|
|
303
244
|
message: v.optional(v.string()),
|
|
@@ -312,9 +253,8 @@ export const BATCH_RUN_FRESH_RESPONSE_SCHEMA = v.looseObject({
|
|
|
312
253
|
mayGenerate: v.boolean(),
|
|
313
254
|
})),
|
|
314
255
|
// Project-level closing link. Absent-key-preserving like `RUN_RESPONSE_SCHEMA`'s
|
|
315
|
-
// `dashboardUrl` (see the note there)
|
|
316
|
-
//
|
|
317
|
-
// `null` passes through as a present key meaning "no correct page".
|
|
256
|
+
// `dashboardUrl` (see the note there); `null` passes through as a present
|
|
257
|
+
// key meaning "no correct page".
|
|
318
258
|
dashboardUrl: v.nullish(v.string(), undefined),
|
|
319
259
|
// An exact echo confirms that the backend read the target URL override.
|
|
320
260
|
targetUrl: v.optional(v.string()),
|
|
@@ -322,16 +262,27 @@ export const BATCH_RUN_FRESH_RESPONSE_SCHEMA = v.looseObject({
|
|
|
322
262
|
// echo was served by a backend that cut the batch / ran a plain override.
|
|
323
263
|
admission: v.optional(v.picklist(['budget', 'all'])),
|
|
324
264
|
previewName: v.optional(v.string()),
|
|
265
|
+
skipDependencies: v.optional(v.boolean()),
|
|
266
|
+
tunnelClientId: v.optional(v.string()),
|
|
267
|
+
maxConcurrency: v.optional(v.number()),
|
|
325
268
|
});
|
|
326
269
|
/**
|
|
327
270
|
* `POST /api/cli/v1/testlist/{listId}/run`. Mirrors the batch-run-fresh shape so
|
|
328
|
-
* the `--wait`
|
|
329
|
-
* carry the in-flight `
|
|
271
|
+
* the `--wait` path uses whole-execution result listings; `conflicts[]` additionally
|
|
272
|
+
* carry the in-flight `currentResultId`, and `reason` marks a nothing-dispatched run.
|
|
330
273
|
*/
|
|
331
274
|
export const TESTLIST_RUN_RESPONSE_SCHEMA = v.looseObject({
|
|
332
|
-
accepted: v.array(v.looseObject({
|
|
275
|
+
accepted: v.array(v.looseObject({
|
|
276
|
+
testId: v.string(),
|
|
277
|
+
resultId: v.string(),
|
|
278
|
+
// The launch the result belongs to; an older backend omits it.
|
|
279
|
+
runId: v.optional(v.string()),
|
|
280
|
+
enqueuedAt: v.string(),
|
|
281
|
+
})),
|
|
333
282
|
conflicts: v.array(v.looseObject({
|
|
334
283
|
testId: v.string(),
|
|
284
|
+
currentResultId: v.optional(v.string()),
|
|
285
|
+
// The launch the in-flight result belongs to; an older backend omits it.
|
|
335
286
|
currentRunId: v.optional(v.string()),
|
|
336
287
|
reason: v.optional(v.string()),
|
|
337
288
|
message: v.optional(v.string()),
|
|
@@ -339,46 +290,7 @@ export const TESTLIST_RUN_RESPONSE_SCHEMA = v.looseObject({
|
|
|
339
290
|
deferred: v.array(v.looseObject({ testId: v.string() })),
|
|
340
291
|
notFound: v.optional(v.array(v.string())),
|
|
341
292
|
reason: v.optional(v.string()),
|
|
342
|
-
|
|
343
|
-
// ---------------------------------------------------------------------------
|
|
344
|
-
// GET /tests/{testId}/runs
|
|
345
|
-
// ---------------------------------------------------------------------------
|
|
346
|
-
/** Mirrors `RunHistoryItem` (runs.types.ts): one run-history row. */
|
|
347
|
-
const RUN_HISTORY_ITEM_SCHEMA = v.looseObject({
|
|
348
|
-
runId: v.string(),
|
|
349
|
-
status: openWireLiteral(),
|
|
350
|
-
source: openWireLiteral(),
|
|
351
|
-
isRerun: v.boolean(),
|
|
352
|
-
createdFrom: v.nullish(v.string(), null),
|
|
353
|
-
createdAt: v.string(),
|
|
354
|
-
startedAt: v.nullish(v.string(), null),
|
|
355
|
-
finishedAt: v.nullish(v.string(), null),
|
|
356
|
-
// Nullable on the wire (`RunHistoryRow.codeVersion` is `[string, 'null']`).
|
|
357
|
-
codeVersion: v.nullish(v.string(), null),
|
|
358
|
-
failureKind: v.nullish(v.string(), null),
|
|
359
|
-
// G1b fields: optional on the wire for back-compat with older backends.
|
|
360
|
-
targetUrl: v.optional(v.nullable(v.string())),
|
|
361
|
-
targetUrlSource: v.optional(v.nullable(openWireLiteral())),
|
|
362
|
-
// The run's environment — optional with no default.
|
|
363
|
-
environment: OPTIONAL_ENVIRONMENT_SCHEMA,
|
|
364
|
-
});
|
|
365
|
-
/** Mirrors `ListRunsResponse` (runs.types.ts): `GET /tests/{testId}/runs`. */
|
|
366
|
-
export const LIST_RUNS_RESPONSE_SCHEMA = v.looseObject({
|
|
367
|
-
runs: v.array(RUN_HISTORY_ITEM_SCHEMA),
|
|
368
|
-
nextCursor: v.nullish(v.string(), null),
|
|
369
|
-
// Mirrors RunHistoryMeta (runs.types.ts): every field optional, and the
|
|
370
|
-
// history command reads `resp.meta.note` / `resp.meta.portalUrl` directly,
|
|
371
|
-
// so the container itself stays required like the interface declares.
|
|
372
|
-
meta: v.looseObject({
|
|
373
|
-
testKind: v.optional(openWireLiteral()),
|
|
374
|
-
historyStartsAt: v.optional(v.string()),
|
|
375
|
-
note: v.optional(v.string()),
|
|
376
|
-
portalUrl: v.optional(v.string()),
|
|
377
|
-
tier: v.optional(v.string()),
|
|
378
|
-
retentionDays: v.optional(v.nullable(v.number())),
|
|
379
|
-
hiddenCount: v.optional(v.number()),
|
|
380
|
-
billingUrl: v.optional(v.string()),
|
|
381
|
-
}),
|
|
293
|
+
maxConcurrency: v.optional(v.number()),
|
|
382
294
|
});
|
|
383
295
|
/** Mirrors `CliOrgSummary` (lib/org-render.ts): one `Me.organizations[]` entry. */
|
|
384
296
|
const ORG_SUMMARY_SCHEMA = v.looseObject({
|
|
@@ -397,13 +309,12 @@ const ORG_BINDING_SCHEMA = v.looseObject({
|
|
|
397
309
|
export const ME_IDENTITY_SCHEMA = v.looseObject({
|
|
398
310
|
userId: v.optional(v.string()),
|
|
399
311
|
keyId: v.optional(v.string()),
|
|
400
|
-
v3Enabled: v.optional(v.boolean()),
|
|
401
312
|
organizations: v.optional(v.array(ORG_SUMMARY_SCHEMA)),
|
|
402
313
|
org: v.optional(ORG_BINDING_SCHEMA),
|
|
403
314
|
});
|
|
404
315
|
/**
|
|
405
316
|
* Mirrors `MeResponse` (commands/auth.ts): the full `GET /me` projection read
|
|
406
|
-
* by `auth
|
|
317
|
+
* by `auth status` (and, through it, `setup`).
|
|
407
318
|
*
|
|
408
319
|
* `scopes` is required and array-typed on purpose — this is the shape drift
|
|
409
320
|
* that actually bites today. `runWhoami` renders `m.scopes.join(', ')` and
|
|
@@ -412,12 +323,12 @@ export const ME_IDENTITY_SCHEMA = v.looseObject({
|
|
|
412
323
|
* of a typed envelope. Every `/me` fixture in the suite supplies it
|
|
413
324
|
* (`auth.test.ts`, `init.test.ts`, `usage.test.ts`, `cli.subprocess.test.ts`,
|
|
414
325
|
* `test/mock-backend/fixtures.ts`), so requiring it matches observed wire
|
|
415
|
-
* reality; `email` / `displayName`
|
|
326
|
+
* reality; `email` / `displayName` are the genuinely absent-safe
|
|
416
327
|
* ones and stay `v.optional` with no default (rule 3, optional branch).
|
|
417
328
|
*
|
|
418
|
-
* `
|
|
329
|
+
* `setup` calls this through `runWhoami` inside a try/catch that falls back to
|
|
419
330
|
* a placeholder identity, so a drifted `/me` degrades the setup summary
|
|
420
|
-
* instead of failing the whole `
|
|
331
|
+
* instead of failing the whole `setup`.
|
|
421
332
|
*/
|
|
422
333
|
export const ME_RESPONSE_SCHEMA = v.looseObject({
|
|
423
334
|
userId: v.string(),
|
|
@@ -426,29 +337,23 @@ export const ME_RESPONSE_SCHEMA = v.looseObject({
|
|
|
426
337
|
env: openWireLiteral(),
|
|
427
338
|
email: v.optional(v.string()),
|
|
428
339
|
displayName: v.optional(v.string()),
|
|
429
|
-
v3Enabled: v.optional(v.boolean()),
|
|
430
340
|
});
|
|
431
341
|
// ---------------------------------------------------------------------------
|
|
432
342
|
// GET /me (usage projection)
|
|
433
343
|
// ---------------------------------------------------------------------------
|
|
434
344
|
/**
|
|
435
|
-
* Mirrors `UsageResponse` (commands/usage.ts): the
|
|
345
|
+
* Mirrors `UsageResponse` (commands/usage.ts): the wallet projection the
|
|
436
346
|
* `usage` command reads off the same `GET /me` body.
|
|
437
347
|
*
|
|
438
348
|
* `renderUsage` prints `userId`/`keyId`/`env` unconditionally as its "identity
|
|
439
|
-
* block", so those three are required
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
* gated on `!== undefined`, so they stay optional with no default. `scopes`
|
|
443
|
-
* rides along as an unknown extra key and is preserved by `looseObject`.
|
|
349
|
+
* block", so those three are required. `activeOrg`, `organizations` and `org`
|
|
350
|
+
* are best-effort enrichments every renderer branch gates on `!== undefined`,
|
|
351
|
+
* and ride along (with `scopes`) as extra keys preserved by `looseObject`.
|
|
444
352
|
*/
|
|
445
353
|
export const USAGE_RESPONSE_SCHEMA = v.looseObject({
|
|
446
354
|
userId: v.string(),
|
|
447
355
|
keyId: v.string(),
|
|
448
356
|
env: openWireLiteral(),
|
|
449
|
-
credits: v.optional(v.number()),
|
|
450
|
-
subPlan: v.optional(v.string()),
|
|
451
|
-
creditsPerRun: v.optional(v.number()),
|
|
452
357
|
});
|
|
453
358
|
// ---------------------------------------------------------------------------
|
|
454
359
|
// /tunnel facade
|
|
@@ -488,7 +393,7 @@ export const TUNNEL_LIST_RESPONSE_SCHEMA = v.looseObject({
|
|
|
488
393
|
/** Mirrors `ExecutionReport` — the server's report model, kept loose so new fields pass through. */
|
|
489
394
|
export const EXECUTION_REPORT_SCHEMA = v.looseObject({
|
|
490
395
|
projectId: v.string(),
|
|
491
|
-
|
|
396
|
+
runId: v.string(),
|
|
492
397
|
projectName: v.string(),
|
|
493
398
|
orgId: v.nullish(v.string(), null),
|
|
494
399
|
stats: v.looseObject({
|
|
@@ -520,4 +425,102 @@ export const EXECUTION_REPORT_RESPONSE_SCHEMA = v.looseObject({
|
|
|
520
425
|
report: v.optional(EXECUTION_REPORT_SCHEMA),
|
|
521
426
|
markdown: v.optional(v.string()),
|
|
522
427
|
});
|
|
428
|
+
// ---------------------------------------------------------------------------
|
|
429
|
+
// GET /results, GET /results/{resultId}
|
|
430
|
+
// ---------------------------------------------------------------------------
|
|
431
|
+
/** Mirrors `ResultLine` (result/types.ts): one row of `GET /results`. */
|
|
432
|
+
const RESULT_LINE_SCHEMA = v.looseObject({
|
|
433
|
+
resultId: v.string(),
|
|
434
|
+
runId: v.nullish(v.string(), null),
|
|
435
|
+
caseKey: v.nullish(v.string(), null),
|
|
436
|
+
title: v.string(),
|
|
437
|
+
testStatus: v.string(),
|
|
438
|
+
processStatus: v.nullish(v.string(), null),
|
|
439
|
+
error: v.nullish(v.string(), null),
|
|
440
|
+
blockedReason: v.nullish(v.string(), null),
|
|
441
|
+
environmentName: v.nullish(v.string(), null),
|
|
442
|
+
created: v.string(),
|
|
443
|
+
// No default: an older backend does not send it.
|
|
444
|
+
modified: v.optional(v.string()),
|
|
445
|
+
});
|
|
446
|
+
/** A field read as null when absent, null, or of a shape this CLI cannot read. */
|
|
447
|
+
function lenient(schema) {
|
|
448
|
+
return v.fallback(v.nullish(schema, null), null);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Mirrors `ResultRun` (result/types.ts): the run a run's listing is of. Only
|
|
452
|
+
* what a wait needs is required, so drift in any other field cannot stop one.
|
|
453
|
+
*/
|
|
454
|
+
const RESULT_RUN_SCHEMA = v.looseObject({
|
|
455
|
+
runId: v.string(),
|
|
456
|
+
status: openWireLiteral(),
|
|
457
|
+
projectId: lenient(v.string()),
|
|
458
|
+
cancelled: lenient(v.boolean()),
|
|
459
|
+
created: lenient(v.string()),
|
|
460
|
+
modified: lenient(v.string()),
|
|
461
|
+
targetUrl: lenient(v.string()),
|
|
462
|
+
dashboardUrl: lenient(v.string()),
|
|
463
|
+
});
|
|
464
|
+
/** Mirrors `ResultList` (result/types.ts): `GET /results?run=…` or `?test=…`. */
|
|
465
|
+
export const RESULT_LIST_SCHEMA = v.looseObject({
|
|
466
|
+
// A run's listing only, and absent from an older backend. No default: the
|
|
467
|
+
// waiter on a run tells an older backend by its absence. A run without a
|
|
468
|
+
// readable runId and status reads as null, so a read that does not use it
|
|
469
|
+
// still works and the waiter can refuse it in its own words.
|
|
470
|
+
run: v.optional(v.fallback(v.nullable(RESULT_RUN_SCHEMA), null)),
|
|
471
|
+
results: v.array(RESULT_LINE_SCHEMA),
|
|
472
|
+
// Only a test's history carries these two. No default: a run's listing must
|
|
473
|
+
// not gain keys the server never sent.
|
|
474
|
+
hiddenRunCount: v.optional(v.number()),
|
|
475
|
+
retentionDays: v.optional(v.nullable(v.number())),
|
|
476
|
+
});
|
|
477
|
+
/** Mirrors `ResultStep` (result/types.ts): a step of a result or of its sign-in run. */
|
|
478
|
+
const RESULT_STEP_SCHEMA = v.looseObject({
|
|
479
|
+
stepIndex: v.nullish(v.string(), null),
|
|
480
|
+
type: v.nullish(v.string(), null),
|
|
481
|
+
action: v.nullish(v.string(), null),
|
|
482
|
+
description: v.nullish(v.string(), null),
|
|
483
|
+
status: v.nullish(openWireLiteral(), null),
|
|
484
|
+
selector: v.nullish(v.string(), null),
|
|
485
|
+
url: v.nullish(v.string(), null),
|
|
486
|
+
healed: v.boolean(),
|
|
487
|
+
screenshotSignedUrl: v.nullish(v.string(), null),
|
|
488
|
+
htmlSignedUrl: v.nullish(v.string(), null),
|
|
489
|
+
});
|
|
490
|
+
/** Mirrors `ResultSignIn` (result/types.ts): the sign-in run behind a blocked result. */
|
|
491
|
+
const RESULT_SIGN_IN_SCHEMA = v.looseObject({
|
|
492
|
+
id: v.string(),
|
|
493
|
+
status: v.nullish(v.string(), null),
|
|
494
|
+
videoUrl: v.nullish(v.string(), null),
|
|
495
|
+
finalUrl: v.nullish(v.string(), null),
|
|
496
|
+
stepCount: v.nullish(v.number(), null),
|
|
497
|
+
error: v.nullish(v.string(), null),
|
|
498
|
+
steps: v.array(RESULT_STEP_SCHEMA),
|
|
499
|
+
});
|
|
500
|
+
/** Mirrors `ResultDetail` (result/types.ts): `GET /results/{resultId}`. */
|
|
501
|
+
export const RESULT_DETAIL_SCHEMA = v.looseObject({
|
|
502
|
+
resultId: v.string(),
|
|
503
|
+
runId: v.nullish(v.string(), null),
|
|
504
|
+
caseKey: v.nullish(v.string(), null),
|
|
505
|
+
caseHash: v.nullish(v.string(), null),
|
|
506
|
+
title: v.string(),
|
|
507
|
+
type: v.string(),
|
|
508
|
+
testStatus: v.string(),
|
|
509
|
+
processStatus: v.nullish(v.string(), null),
|
|
510
|
+
processErrorMessage: v.nullish(v.string(), null),
|
|
511
|
+
error: v.nullish(v.string(), null),
|
|
512
|
+
cause: v.nullish(v.string(), null),
|
|
513
|
+
fix: v.nullish(v.string(), null),
|
|
514
|
+
blockedReason: v.nullish(v.string(), null),
|
|
515
|
+
// No default: an older backend sends neither, and JSON prints what was sent.
|
|
516
|
+
trace: v.optional(v.nullable(v.string())),
|
|
517
|
+
apiOutput: v.optional(v.nullable(v.string())),
|
|
518
|
+
videoUrl: v.nullish(v.string(), null),
|
|
519
|
+
envId: v.nullish(v.string(), null),
|
|
520
|
+
created: v.string(),
|
|
521
|
+
modified: v.string(),
|
|
522
|
+
failedStep: v.nullish(RESULT_STEP_SCHEMA, null),
|
|
523
|
+
steps: v.array(RESULT_STEP_SCHEMA),
|
|
524
|
+
signIn: v.nullish(RESULT_SIGN_IN_SCHEMA, null),
|
|
525
|
+
});
|
|
523
526
|
//# sourceMappingURL=response-schemas.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HttpClient } from '../http.js';
|
|
2
|
+
import type { ResultDetail, ResultList } from './types.js';
|
|
3
|
+
export interface ResultApi {
|
|
4
|
+
/**
|
|
5
|
+
* The results of one run. Without `statuses` the server returns every result
|
|
6
|
+
* but the cancelled ones; pass `ALL_RESULT_STATUSES` to get those too.
|
|
7
|
+
* `retry: false` makes one attempt, with no retry and no `Retry-After` wait.
|
|
8
|
+
*/
|
|
9
|
+
listByRun(runId: string, statuses?: readonly string[], opts?: {
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
retry?: boolean;
|
|
12
|
+
}): Promise<ResultList>;
|
|
13
|
+
/** One test's results across runs, newest first; the server returns 20 unless `limit` says otherwise. */
|
|
14
|
+
listByTest(testId: string, opts?: {
|
|
15
|
+
statuses?: readonly string[];
|
|
16
|
+
env?: string;
|
|
17
|
+
limit?: number;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}): Promise<ResultList>;
|
|
20
|
+
get(resultId: string, opts?: {
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
}): Promise<ResultDetail>;
|
|
23
|
+
}
|
|
24
|
+
export declare function resultApi(client: HttpClient): ResultApi;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RESULT_DETAIL_SCHEMA, RESULT_LIST_SCHEMA } from '../response-schemas.js';
|
|
2
|
+
/** The `status` filter as the server reads it; an empty list filters nothing. */
|
|
3
|
+
const statusParam = (statuses) => statuses?.length ? statuses.join(',') : undefined;
|
|
4
|
+
export function resultApi(client) {
|
|
5
|
+
return {
|
|
6
|
+
listByRun: (runId, statuses, opts = {}) => client.get('/results', {
|
|
7
|
+
query: { run: runId, status: statusParam(statuses) },
|
|
8
|
+
schema: RESULT_LIST_SCHEMA,
|
|
9
|
+
signal: opts.signal,
|
|
10
|
+
retry: opts.retry,
|
|
11
|
+
}),
|
|
12
|
+
listByTest: (testId, opts = {}) => client.get('/results', {
|
|
13
|
+
query: {
|
|
14
|
+
test: testId,
|
|
15
|
+
status: statusParam(opts.statuses),
|
|
16
|
+
environment: opts.env,
|
|
17
|
+
limit: opts.limit,
|
|
18
|
+
},
|
|
19
|
+
schema: RESULT_LIST_SCHEMA,
|
|
20
|
+
signal: opts.signal,
|
|
21
|
+
}),
|
|
22
|
+
get: (resultId, opts = {}) => client.get(`/results/${encodeURIComponent(resultId)}`, {
|
|
23
|
+
schema: RESULT_DETAIL_SCHEMA,
|
|
24
|
+
signal: opts.signal,
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=api.js.map
|