refactor(form): model links as fields (#36129)

This commit is contained in:
Aiden Cline 2026-07-10 00:22:01 -05:00 committed by GitHub
commit a6449cb45c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 2409 additions and 1430 deletions

View file

@ -10,7 +10,12 @@ function ok<T>(data: T) {
}
function form(id: string, sessionID: string): FormInfo {
return { id, sessionID, title: "Input requested", mode: "form", fields: [] }
return {
id,
sessionID,
title: "Input requested",
fields: [{ key: "authorization", type: "external", url: "https://example.com/form" }],
}
}
function formCreated(info: FormInfo): V2Event {

View file

@ -838,13 +838,18 @@ const scenarios: Scenario[] = [
.at((ctx) => ({
path: route("/api/session/{sessionID}/form", { sessionID: ctx.state.id }),
headers: ctx.headers(),
body: { mode: "url", url: "https://example.com/form" },
body: {
title: "External form",
fields: [{ key: "authorization", type: "external", url: "https://example.com/form" }],
},
}))
.json(200, (body) => {
object(body)
object(body.data)
check(typeof body.data.id === "string", "form create should return an ID")
check(body.data.mode === "url", "form create should preserve URL mode")
array(body.data.fields)
object(body.data.fields[0])
check(body.data.fields[0].type === "external", "form create should preserve the external field")
}),
http.protected
.get("/api/session/{sessionID}/form/{formID}", "v2.session.form.get")