web: templates gallery and template detail (P4)
This commit is contained in:
@@ -43,6 +43,20 @@ export class PipelinesRepository {
|
||||
return response.detail;
|
||||
}
|
||||
|
||||
async listTemplates() {
|
||||
return (await this.#client.call({ type: Protocol.LIST_TEMPLATES })).templates ?? [];
|
||||
}
|
||||
|
||||
async validate(source) {
|
||||
const response = await this.#client.call({ type: Protocol.VALIDATE, source });
|
||||
// A server error envelope already rejects inside client.call, so a reply
|
||||
// here is `validated`; a missing graph is still an unusable definition.
|
||||
if (!response.graph) {
|
||||
throw new ProtocolError("The server returned no graph.");
|
||||
}
|
||||
return response.graph;
|
||||
}
|
||||
|
||||
async listRuns() {
|
||||
const response = await this.#client.call({ type: Protocol.LIST_RUNS });
|
||||
return { runs: response.runs ?? [], usage: response.usage ?? null };
|
||||
|
||||
Reference in New Issue
Block a user