@testsprite/testsprite-cli 0.16.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 +51 -147
- package/dist/commands/agent.d.ts +12 -4
- package/dist/commands/agent.js +48 -63
- package/dist/commands/auth.d.ts +6 -10
- package/dist/commands/auth.js +38 -54
- package/dist/commands/ci.d.ts +23 -100
- package/dist/commands/ci.js +293 -487
- 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 +129 -34
- package/dist/commands/init.d.ts +4 -45
- package/dist/commands/init.js +108 -66
- package/dist/commands/project-env.d.ts +62 -2
- package/dist/commands/project-env.js +388 -37
- package/dist/commands/project-sign-in.d.ts +0 -48
- package/dist/commands/project-sign-in.js +1 -229
- package/dist/commands/project.d.ts +15 -186
- package/dist/commands/project.js +89 -924
- 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 +28 -87
- package/dist/commands/test.d.ts +301 -1816
- package/dist/commands/test.js +1951 -13902
- package/dist/commands/testlist.d.ts +128 -5
- package/dist/commands/testlist.js +269 -339
- package/dist/commands/tunnel.d.ts +2 -2
- package/dist/commands/tunnel.js +23 -19
- package/dist/commands/usage.d.ts +12 -45
- package/dist/commands/usage.js +50 -131
- package/dist/index.js +182 -104
- 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 +9 -3
- package/dist/lib/conflict-reason.js +6 -3
- 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 +375 -747
- package/dist/lib/environment-tunnel.d.ts +16 -27
- package/dist/lib/environment-tunnel.js +161 -154
- 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 -289
- package/dist/lib/interrupt.d.ts +14 -8
- package/dist/lib/interrupt.js +28 -10
- package/dist/lib/junit-report.d.ts +57 -4
- package/dist/lib/junit-report.js +202 -32
- package/dist/lib/local-target.d.ts +3 -3
- package/dist/lib/local-target.js +3 -3
- package/dist/lib/output.d.ts +1 -40
- package/dist/lib/output.js +11 -49
- 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 +207 -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 +118 -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 +31 -11
- package/dist/lib/telemetry.js +37 -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 +2 -3
- package/skills/testsprite-ci.skill.md +48 -18
- package/skills/testsprite-onboard.skill.md +66 -151
- package/skills/testsprite-verify.codex.md +50 -52
- package/skills/testsprite-verify.skill.md +184 -351
- 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 -32
- package/dist/lib/deprecate.js +0 -39
- 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,81 +133,65 @@ 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()),
|
|
@@ -201,89 +200,28 @@ export const TRIGGER_RUN_RESPONSE_SCHEMA = v.looseObject({
|
|
|
201
200
|
skipDependencies: v.optional(v.boolean()),
|
|
202
201
|
});
|
|
203
202
|
// ---------------------------------------------------------------------------
|
|
204
|
-
// POST /tests/
|
|
203
|
+
// POST /tests/batch/run
|
|
205
204
|
// ---------------------------------------------------------------------------
|
|
206
|
-
/**
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
role: openWireLiteral(),
|
|
211
|
-
});
|
|
212
|
-
/** Mirrors `RerunClosure` (runs.types.ts): BE closure breakdown. */
|
|
213
|
-
const RERUN_CLOSURE_SCHEMA = v.looseObject({
|
|
214
|
-
members: v.array(RERUN_CLOSURE_MEMBER_SCHEMA),
|
|
215
|
-
addedProducers: v.array(v.string()),
|
|
216
|
-
addedTeardowns: v.array(v.string()),
|
|
217
|
-
clearedCaptured: v.number(),
|
|
218
|
-
});
|
|
219
|
-
/**
|
|
220
|
-
* Mirrors `RerunAdvisory` (runs.types.ts): a server-side note that a
|
|
221
|
-
* requested option was forwarded to the execution engine but is not yet
|
|
222
|
-
* honored there. Present only on a V3-routed rerun that explicitly opted
|
|
223
|
-
* out of auto-heal — absent everywhere else, so this schema is only ever
|
|
224
|
-
* used inside an `v.optional(v.array(...))` wrapper.
|
|
225
|
-
*/
|
|
226
|
-
const RERUN_ADVISORY_SCHEMA = v.looseObject({
|
|
227
|
-
feature: v.string(),
|
|
228
|
-
message: v.string(),
|
|
229
|
-
});
|
|
230
|
-
/** Mirrors `RerunResponse` (runs.types.ts): `POST /tests/{testId}/runs/rerun`. */
|
|
231
|
-
export const RERUN_RESPONSE_SCHEMA = v.looseObject({
|
|
232
|
-
runId: v.string(),
|
|
233
|
-
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()),
|
|
234
209
|
enqueuedAt: v.string(),
|
|
235
|
-
|
|
210
|
+
total: v.pipe(v.number(), v.integer(), v.minValue(0)),
|
|
236
211
|
autoHeal: v.boolean(),
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
// autoHeal:false opt-out (rule 3: optional, no default, so presence/absence
|
|
242
|
-
// survives validation byte-identically). Older backends that predate the
|
|
243
|
-
// field simply omit it — never fails validation.
|
|
244
|
-
advisories: v.optional(v.array(RERUN_ADVISORY_SCHEMA)),
|
|
245
|
-
// 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()),
|
|
246
216
|
dashboardUrl: v.optional(v.string()),
|
|
247
|
-
|
|
248
|
-
});
|
|
249
|
-
// ---------------------------------------------------------------------------
|
|
250
|
-
// POST /tests/batch/rerun
|
|
251
|
-
// ---------------------------------------------------------------------------
|
|
252
|
-
/** Mirrors `BatchRerunResponse` (runs.types.ts): `POST /tests/batch/rerun`. */
|
|
253
|
-
export const BATCH_RERUN_RESPONSE_SCHEMA = v.looseObject({
|
|
254
|
-
// Mirrors BatchRerunAccepted (runs.types.ts).
|
|
255
|
-
accepted: v.array(v.looseObject({ testId: v.string(), runId: v.string(), enqueuedAt: v.string() })),
|
|
256
|
-
// Mirrors BatchRerunDeferred (runs.types.ts).
|
|
257
|
-
deferred: v.array(v.looseObject({ testId: v.string(), reason: v.string() })),
|
|
258
|
-
// Mirrors BatchRerunConflict (runs.types.ts). `currentRunId` is optional,
|
|
259
|
-
// as in the two schemas below: a refusal only carries a run id when there
|
|
260
|
-
// is a run to point at.
|
|
261
|
-
conflicts: v.array(v.looseObject({
|
|
217
|
+
blocked: v.array(v.looseObject({
|
|
262
218
|
testId: v.string(),
|
|
263
|
-
|
|
264
|
-
reason: v.
|
|
219
|
+
resultId: v.string(),
|
|
220
|
+
reason: v.string(),
|
|
265
221
|
message: v.optional(v.string()),
|
|
266
222
|
})),
|
|
267
|
-
|
|
268
|
-
closure: v.looseObject({
|
|
269
|
-
byProject: v.array(v.looseObject({
|
|
270
|
-
projectId: v.string(),
|
|
271
|
-
testIds: v.array(v.string()),
|
|
272
|
-
addedProducers: v.array(v.string()),
|
|
273
|
-
addedTeardowns: v.array(v.string()),
|
|
274
|
-
clearedCaptured: v.number(),
|
|
275
|
-
})),
|
|
276
|
-
}),
|
|
277
|
-
// Optional on the wire for back-compat with older backends (D2-CLI).
|
|
278
|
-
notFound: v.optional(v.array(v.string())),
|
|
279
|
-
// Absent on every response except a V3-routed batch containing at least
|
|
280
|
-
// one FE test with an explicit autoHeal:false opt-out. Same resilience
|
|
281
|
-
// rule as RERUN_RESPONSE_SCHEMA.advisories above.
|
|
282
|
-
advisories: v.optional(v.array(RERUN_ADVISORY_SCHEMA)),
|
|
223
|
+
held: v.array(v.looseObject({ testId: v.string(), runId: v.string(), resultId: v.string() })),
|
|
283
224
|
});
|
|
284
|
-
// ---------------------------------------------------------------------------
|
|
285
|
-
// POST /tests/batch/run
|
|
286
|
-
// ---------------------------------------------------------------------------
|
|
287
225
|
/** Mirrors `BatchRunFreshResponse` (runs.types.ts): `POST /tests/batch/run`. */
|
|
288
226
|
export const BATCH_RUN_FRESH_RESPONSE_SCHEMA = v.looseObject({
|
|
289
227
|
// See TRIGGER_RUN_RESPONSE_SCHEMA; absence carries the same meaning.
|
|
@@ -292,14 +230,15 @@ export const BATCH_RUN_FRESH_RESPONSE_SCHEMA = v.looseObject({
|
|
|
292
230
|
// client-synthesized, tolerated as optional.
|
|
293
231
|
accepted: v.array(v.looseObject({
|
|
294
232
|
testId: v.string(),
|
|
295
|
-
|
|
233
|
+
resultId: v.string(),
|
|
296
234
|
enqueuedAt: v.string(),
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
executionId: v.optional(v.string()),
|
|
235
|
+
// Runs name their execution; an older backend omits it.
|
|
236
|
+
runId: v.optional(v.string()),
|
|
300
237
|
})),
|
|
301
238
|
conflicts: v.array(v.looseObject({
|
|
302
239
|
testId: v.string(),
|
|
240
|
+
currentResultId: v.optional(v.string()),
|
|
241
|
+
// The launch the in-flight result belongs to; an older backend omits it.
|
|
303
242
|
currentRunId: v.optional(v.string()),
|
|
304
243
|
reason: v.optional(v.string()),
|
|
305
244
|
message: v.optional(v.string()),
|
|
@@ -314,9 +253,8 @@ export const BATCH_RUN_FRESH_RESPONSE_SCHEMA = v.looseObject({
|
|
|
314
253
|
mayGenerate: v.boolean(),
|
|
315
254
|
})),
|
|
316
255
|
// Project-level closing link. Absent-key-preserving like `RUN_RESPONSE_SCHEMA`'s
|
|
317
|
-
// `dashboardUrl` (see the note there)
|
|
318
|
-
//
|
|
319
|
-
// `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".
|
|
320
258
|
dashboardUrl: v.nullish(v.string(), undefined),
|
|
321
259
|
// An exact echo confirms that the backend read the target URL override.
|
|
322
260
|
targetUrl: v.optional(v.string()),
|
|
@@ -325,16 +263,26 @@ export const BATCH_RUN_FRESH_RESPONSE_SCHEMA = v.looseObject({
|
|
|
325
263
|
admission: v.optional(v.picklist(['budget', 'all'])),
|
|
326
264
|
previewName: v.optional(v.string()),
|
|
327
265
|
skipDependencies: v.optional(v.boolean()),
|
|
266
|
+
tunnelClientId: v.optional(v.string()),
|
|
267
|
+
maxConcurrency: v.optional(v.number()),
|
|
328
268
|
});
|
|
329
269
|
/**
|
|
330
270
|
* `POST /api/cli/v1/testlist/{listId}/run`. Mirrors the batch-run-fresh shape so
|
|
331
|
-
* the `--wait`
|
|
332
|
-
* 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.
|
|
333
273
|
*/
|
|
334
274
|
export const TESTLIST_RUN_RESPONSE_SCHEMA = v.looseObject({
|
|
335
|
-
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
|
+
})),
|
|
336
282
|
conflicts: v.array(v.looseObject({
|
|
337
283
|
testId: v.string(),
|
|
284
|
+
currentResultId: v.optional(v.string()),
|
|
285
|
+
// The launch the in-flight result belongs to; an older backend omits it.
|
|
338
286
|
currentRunId: v.optional(v.string()),
|
|
339
287
|
reason: v.optional(v.string()),
|
|
340
288
|
message: v.optional(v.string()),
|
|
@@ -342,46 +290,7 @@ export const TESTLIST_RUN_RESPONSE_SCHEMA = v.looseObject({
|
|
|
342
290
|
deferred: v.array(v.looseObject({ testId: v.string() })),
|
|
343
291
|
notFound: v.optional(v.array(v.string())),
|
|
344
292
|
reason: v.optional(v.string()),
|
|
345
|
-
|
|
346
|
-
// ---------------------------------------------------------------------------
|
|
347
|
-
// GET /tests/{testId}/runs
|
|
348
|
-
// ---------------------------------------------------------------------------
|
|
349
|
-
/** Mirrors `RunHistoryItem` (runs.types.ts): one run-history row. */
|
|
350
|
-
const RUN_HISTORY_ITEM_SCHEMA = v.looseObject({
|
|
351
|
-
runId: v.string(),
|
|
352
|
-
status: openWireLiteral(),
|
|
353
|
-
source: openWireLiteral(),
|
|
354
|
-
isRerun: v.boolean(),
|
|
355
|
-
createdFrom: v.nullish(v.string(), null),
|
|
356
|
-
createdAt: v.string(),
|
|
357
|
-
startedAt: v.nullish(v.string(), null),
|
|
358
|
-
finishedAt: v.nullish(v.string(), null),
|
|
359
|
-
// Nullable on the wire (`RunHistoryRow.codeVersion` is `[string, 'null']`).
|
|
360
|
-
codeVersion: v.nullish(v.string(), null),
|
|
361
|
-
failureKind: v.nullish(v.string(), null),
|
|
362
|
-
// G1b fields: optional on the wire for back-compat with older backends.
|
|
363
|
-
targetUrl: v.optional(v.nullable(v.string())),
|
|
364
|
-
targetUrlSource: v.optional(v.nullable(openWireLiteral())),
|
|
365
|
-
// The run's environment — optional with no default.
|
|
366
|
-
environment: OPTIONAL_ENVIRONMENT_SCHEMA,
|
|
367
|
-
});
|
|
368
|
-
/** Mirrors `ListRunsResponse` (runs.types.ts): `GET /tests/{testId}/runs`. */
|
|
369
|
-
export const LIST_RUNS_RESPONSE_SCHEMA = v.looseObject({
|
|
370
|
-
runs: v.array(RUN_HISTORY_ITEM_SCHEMA),
|
|
371
|
-
nextCursor: v.nullish(v.string(), null),
|
|
372
|
-
// Mirrors RunHistoryMeta (runs.types.ts): every field optional, and the
|
|
373
|
-
// history command reads `resp.meta.note` / `resp.meta.portalUrl` directly,
|
|
374
|
-
// so the container itself stays required like the interface declares.
|
|
375
|
-
meta: v.looseObject({
|
|
376
|
-
testKind: v.optional(openWireLiteral()),
|
|
377
|
-
historyStartsAt: v.optional(v.string()),
|
|
378
|
-
note: v.optional(v.string()),
|
|
379
|
-
portalUrl: v.optional(v.string()),
|
|
380
|
-
tier: v.optional(v.string()),
|
|
381
|
-
retentionDays: v.optional(v.nullable(v.number())),
|
|
382
|
-
hiddenCount: v.optional(v.number()),
|
|
383
|
-
billingUrl: v.optional(v.string()),
|
|
384
|
-
}),
|
|
293
|
+
maxConcurrency: v.optional(v.number()),
|
|
385
294
|
});
|
|
386
295
|
/** Mirrors `CliOrgSummary` (lib/org-render.ts): one `Me.organizations[]` entry. */
|
|
387
296
|
const ORG_SUMMARY_SCHEMA = v.looseObject({
|
|
@@ -400,13 +309,12 @@ const ORG_BINDING_SCHEMA = v.looseObject({
|
|
|
400
309
|
export const ME_IDENTITY_SCHEMA = v.looseObject({
|
|
401
310
|
userId: v.optional(v.string()),
|
|
402
311
|
keyId: v.optional(v.string()),
|
|
403
|
-
v3Enabled: v.optional(v.boolean()),
|
|
404
312
|
organizations: v.optional(v.array(ORG_SUMMARY_SCHEMA)),
|
|
405
313
|
org: v.optional(ORG_BINDING_SCHEMA),
|
|
406
314
|
});
|
|
407
315
|
/**
|
|
408
316
|
* Mirrors `MeResponse` (commands/auth.ts): the full `GET /me` projection read
|
|
409
|
-
* by `auth
|
|
317
|
+
* by `auth status` (and, through it, `setup`).
|
|
410
318
|
*
|
|
411
319
|
* `scopes` is required and array-typed on purpose — this is the shape drift
|
|
412
320
|
* that actually bites today. `runWhoami` renders `m.scopes.join(', ')` and
|
|
@@ -415,12 +323,12 @@ export const ME_IDENTITY_SCHEMA = v.looseObject({
|
|
|
415
323
|
* of a typed envelope. Every `/me` fixture in the suite supplies it
|
|
416
324
|
* (`auth.test.ts`, `init.test.ts`, `usage.test.ts`, `cli.subprocess.test.ts`,
|
|
417
325
|
* `test/mock-backend/fixtures.ts`), so requiring it matches observed wire
|
|
418
|
-
* reality; `email` / `displayName`
|
|
326
|
+
* reality; `email` / `displayName` are the genuinely absent-safe
|
|
419
327
|
* ones and stay `v.optional` with no default (rule 3, optional branch).
|
|
420
328
|
*
|
|
421
|
-
* `
|
|
329
|
+
* `setup` calls this through `runWhoami` inside a try/catch that falls back to
|
|
422
330
|
* a placeholder identity, so a drifted `/me` degrades the setup summary
|
|
423
|
-
* instead of failing the whole `
|
|
331
|
+
* instead of failing the whole `setup`.
|
|
424
332
|
*/
|
|
425
333
|
export const ME_RESPONSE_SCHEMA = v.looseObject({
|
|
426
334
|
userId: v.string(),
|
|
@@ -429,29 +337,23 @@ export const ME_RESPONSE_SCHEMA = v.looseObject({
|
|
|
429
337
|
env: openWireLiteral(),
|
|
430
338
|
email: v.optional(v.string()),
|
|
431
339
|
displayName: v.optional(v.string()),
|
|
432
|
-
v3Enabled: v.optional(v.boolean()),
|
|
433
340
|
});
|
|
434
341
|
// ---------------------------------------------------------------------------
|
|
435
342
|
// GET /me (usage projection)
|
|
436
343
|
// ---------------------------------------------------------------------------
|
|
437
344
|
/**
|
|
438
|
-
* Mirrors `UsageResponse` (commands/usage.ts): the
|
|
345
|
+
* Mirrors `UsageResponse` (commands/usage.ts): the wallet projection the
|
|
439
346
|
* `usage` command reads off the same `GET /me` body.
|
|
440
347
|
*
|
|
441
348
|
* `renderUsage` prints `userId`/`keyId`/`env` unconditionally as its "identity
|
|
442
|
-
* block", so those three are required
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
* gated on `!== undefined`, so they stay optional with no default. `scopes`
|
|
446
|
-
* 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`.
|
|
447
352
|
*/
|
|
448
353
|
export const USAGE_RESPONSE_SCHEMA = v.looseObject({
|
|
449
354
|
userId: v.string(),
|
|
450
355
|
keyId: v.string(),
|
|
451
356
|
env: openWireLiteral(),
|
|
452
|
-
credits: v.optional(v.number()),
|
|
453
|
-
subPlan: v.optional(v.string()),
|
|
454
|
-
creditsPerRun: v.optional(v.number()),
|
|
455
357
|
});
|
|
456
358
|
// ---------------------------------------------------------------------------
|
|
457
359
|
// /tunnel facade
|
|
@@ -491,7 +393,7 @@ export const TUNNEL_LIST_RESPONSE_SCHEMA = v.looseObject({
|
|
|
491
393
|
/** Mirrors `ExecutionReport` — the server's report model, kept loose so new fields pass through. */
|
|
492
394
|
export const EXECUTION_REPORT_SCHEMA = v.looseObject({
|
|
493
395
|
projectId: v.string(),
|
|
494
|
-
|
|
396
|
+
runId: v.string(),
|
|
495
397
|
projectName: v.string(),
|
|
496
398
|
orgId: v.nullish(v.string(), null),
|
|
497
399
|
stats: v.looseObject({
|
|
@@ -523,4 +425,102 @@ export const EXECUTION_REPORT_RESPONSE_SCHEMA = v.looseObject({
|
|
|
523
425
|
report: v.optional(EXECUTION_REPORT_SCHEMA),
|
|
524
426
|
markdown: v.optional(v.string()),
|
|
525
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
|
+
});
|
|
526
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
|