Files
mesh-delivery/contracts/ts/seats/meshdelivery/src/index.ts
T

339 lines
9.3 KiB
TypeScript

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "mesh-delivery", defined whole (seats/mesh-delivery/seat.json): The delivery gate: reads and steers deliveries, merges and the checks that decide them; the merge is made on the operator's Approve once both checks passed.
export const seat = "mesh-delivery";
export const verbs = {
deliveries: "deliveries",
times: "times",
show: "show",
groups: "groups",
whatIf: "what-if",
checks: "checks",
table: "table",
stalled: "stalled",
recheck: "recheck",
release: "release",
stop: "stop",
close: "close",
retireHistory: "retire-history",
settle: "settle",
} as const;
export const states = {
source: "source",
merges: "merges",
asks: "asks",
owed: "owed",
turns: "turns",
} as const;
/** The key of one value of the state source under the form "main". */
export function sourceByMainKey(): string {
return "main";
}
/** The parts of a key of the form "main", or undefined for a key of another form. */
export function parseSourceByMainKey(_key: string): { } | undefined {
let _rest = _key;
if (!_rest.startsWith("main")) return undefined;
_rest = _rest.slice(4);
if (_rest !== "") return undefined;
return { };
}
/** The key of one value of the state merges under the form "<group>". */
export function mergesByGroupKey(group: string): string {
return group;
}
/** The parts of a key of the form "<group>", or undefined for a key of another form. */
export function parseMergesByGroupKey(_key: string): { group: string } | undefined {
let _rest = _key;
if (_rest === "") return undefined;
const group = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { group };
}
/** The key of one value of the state asks under the form "merge.<group>.<heads>". */
export function asksByMergeGroupHeadsKey(group: string, heads: string): string {
return "merge." + group + "." + heads;
}
/** The parts of a key of the form "merge.<group>.<heads>", or undefined for a key of another form. */
export function parseAsksByMergeGroupHeadsKey(_key: string): { group: string; heads: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("merge.")) return undefined;
_rest = _rest.slice(6);
const _at1 = _rest.indexOf(".");
if (_at1 <= 0) return undefined;
const group = _rest.slice(0, _at1);
_rest = _rest.slice(_at1 + 1);
if (_rest === "") return undefined;
const heads = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { group, heads };
}
/** The key of one value of the state owed under the form "<repository>.<number>.<head>.<act>". */
export function owedByRepositoryNumberHeadActKey(repository: string, number: string, head: string, act: string): string {
return repository + "." + number + "." + head + "." + act;
}
/** The parts of a key of the form "<repository>.<number>.<head>.<act>", or undefined for a key of another form. */
export function parseOwedByRepositoryNumberHeadActKey(_key: string): { repository: string; number: string; head: string; act: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const repository = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
const _at2 = _rest.indexOf(".");
if (_at2 <= 0) return undefined;
const number = _rest.slice(0, _at2);
_rest = _rest.slice(_at2 + 1);
const _at4 = _rest.indexOf(".");
if (_at4 <= 0) return undefined;
const head = _rest.slice(0, _at4);
_rest = _rest.slice(_at4 + 1);
if (_rest === "") return undefined;
const act = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { repository, number, head, act };
}
/** The key of one value of the state turns under the form "<repository>". */
export function turnsByRepositoryKey(repository: string): string {
return repository;
}
/** The parts of a key of the form "<repository>", or undefined for a key of another form. */
export function parseTurnsByRepositoryKey(_key: string): { repository: string } | undefined {
let _rest = _key;
if (_rest === "") return undefined;
const repository = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { repository };
}
/** is what deliveries takes. */
export interface DeliveriesInput {
/** "true": the final ones of the last thirty days too */
"all"?: "true" | "false";
/** a group's id (its branch name) */
"group"?: string;
/** owner/repository */
"repository"?: string;
/** one state, e.g. delivering or held */
"state"?: string;
}
/** is what deliveries answers. */
export type DeliveriesAnswer = Record<string, unknown>;
/** is what times takes. */
export interface TimesInput {
}
/** is what times answers. */
export type TimesAnswer = Record<string, unknown>;
/** is what show takes. */
export interface ShowInput {
/** a delivery's id, or a group's */
"id": string;
}
/** is what show answers. */
export type ShowAnswer = Record<string, unknown>;
/** is what groups takes. */
export interface GroupsInput {
/** "true": the groups that ended too */
"all"?: "true" | "false";
}
/** is what groups answers. */
export type GroupsAnswer = Record<string, unknown>;
/** is what what-if takes. */
export interface WhatIfInput {
}
/** is what what-if answers. */
export type WhatIfAnswer = Record<string, unknown>;
/** is what checks takes. */
export interface ChecksInput {
/** a commit's sha, or the start of one, instead of a pull request */
"commit"?: string;
/** a pull request's number: its head is read */
"number"?: string;
/** owner/repository */
"repository": string;
}
/** is what checks answers. */
export type ChecksAnswer = Record<string, unknown>;
/** is what table takes. */
export interface TableInput {
}
/** is what table answers. */
export type TableAnswer = Record<string, unknown>;
/** is what stalled takes. */
export interface StalledInput {
}
/** is what stalled answers. */
export type StalledAnswer = Record<string, unknown>;
/** is what recheck takes. */
export interface RecheckInput {
/** the delivery's id */
"id": string;
/** why, kept with the transition */
"why": string;
}
/** is what recheck answers. */
export type RecheckAnswer = Record<string, unknown>;
/** is what release takes. */
export interface ReleaseInput {
}
/** is what release answers. */
export type ReleaseAnswer = Record<string, unknown>;
/** is what stop takes. */
export interface StopInput {
}
/** is what stop answers. */
export type StopAnswer = Record<string, unknown>;
/** is what close takes. */
export interface CloseInput {
/** the delivery's id */
"id": string;
/** the condition it answers */
"why": string;
}
/** is what close answers. */
export type CloseAnswer = Record<string, unknown>;
/** is what retire-history takes. */
export interface RetireHistoryInput {
}
/** is what retire-history answers. */
export type RetireHistoryAnswer = Record<string, unknown>;
/** is what settle takes. */
export interface SettleInput {
/** the held deliveries' ids (owner/repository@commit) */
"ids": string[];
/** why they may be settled, shown to the operator */
"why": string;
}
/** is what settle answers. */
export type SettleAnswer = Record<string, unknown>;
/** is one value of the state source under the key main. */
export interface SourceByMainValue {
/** the group that moved it */
"group": string;
/** repository to the merged head, a full commit */
"heads": Record<string, string>;
/** the layout version */
"v"?: number;
}
export interface MergesByGroupValuePullsItem {
"commit"?: string;
"head": string;
"number": number;
"repository": string;
/** merging, merged or refused */
"state": string;
"words"?: string;
}
/** is one value of the state merges under the key <group>. */
export interface MergesByGroupValue {
/** <repository>@<number> to the approved head */
"approved"?: Record<string, string>;
/** the ask key */
"ask": string;
"group": string;
"pulls": MergesByGroupValuePullsItem[];
/** the layout version */
"v"?: number;
}
export interface AsksByMergeGroupHeadsValueHeadsItem {
/** the full commit */
"head": string;
"number": number;
/** <owner>/<name> */
"repository": string;
}
/** is one value of the state asks under the key merge.<group>.<heads>. */
export interface AsksByMergeGroupHeadsValue {
/** the operator-channel ask as raised */
"ask": unknown;
/** the number of times it was asked */
"asking"?: number;
"group": string;
"heads": AsksByMergeGroupHeadsValueHeadsItem[];
/** the layout version */
"v"?: number;
}
/** is one value of the state owed under the key <repository>.<number>.<head>.<act>. */
export interface OwedByRepositoryNumberHeadActValue {
/** status=<context>, view, note or comment.<seq> */
"act": string;
"context"?: string;
"ref"?: string;
"state"?: string;
"target"?: string;
"text"?: string;
/** the layout version */
"v"?: number;
}
export interface TurnsByRepositoryValueWaitingItem {
/** when (RFC 3339 time) */
"approved": string;
"ask"?: string;
"group": string;
"heads": string;
/** when (RFC 3339 time) */
"since": string;
"step"?: string;
"waits-for"?: string;
/** when (RFC 3339 time) */
"waits-since"?: string;
}
/** is one value of the state turns under the key <repository>. */
export interface TurnsByRepositoryValue {
"repository": string;
/** the layout version */
"v"?: number;
"waiting": TurnsByRepositoryValueWaitingItem[];
}