fn() =>
@definy.read-branch-snapshot(
project: "host-release",
branch: "main",
then: fn(commit$0, commits$1) =>
match $0 {
#none(_) =>
@html-ui.text-response(status: 404, text: "host-release main was not found"),
#some(found$2) =>
match @definy.snapshot-part-find(commits: [$2], name: "host-release.host-script", index: 0) {
#none(_) =>
@html-ui.text-response(status: 404, text: "host-release.host-script was not found"),
#some(part$3) =>
@definy.read-part-contents(
parts: [$3.part],
then: fn(parts$4) =>
match @core.list-get(list: $4, index: 0) {
#none(_) =>
@html-ui.text-response(status: 500, text: "host-release.host-script could not be read"),
#some(resolved$5) =>
match $5.content {
#none(_) =>
@html-ui.text-response(status: 500, text: "host-release.host-script could not be read"),
#some(content$6) =>
match $6.expression {
#none(_) =>
@html-ui.text-response(status: 500, text: "host-release.host-script has no expression"),
#some(expression$7) =>
match $7 {
#string(text$8) =>
#done<@definy.service-io>(#respond({
status: 200,
headers: [
{name: "content-type", value: "text/javascript; charset=utf-8"},
{name: "cache-control", value: "no-store"},
{name: "x-definy-release", value: $2.event_hash}
],
body: #text<@definy.http-body>($8)
})),
_ =>
@html-ui.text-response(status: 500, text: "host-release.host-script is not a string")
}
}
}
}
)
}
}
)