Files
mesh-delivery/contracts/ts/seats/meshdeliverychecker/index.js
T

139 lines
4.5 KiB
JavaScript

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "mesh-delivery-checker", defined whole (seats/mesh-delivery-checker/seat.json): The merge check's tries: start one, read one, end one. The seat says each check's end as checked and what the checker owes the forge as owed; the checker's other events stay under its own subjects (ADR 0620 §2).
export const seat = "mesh-delivery-checker";
export const verbs = {
try: "try",
tryRead: "try-read",
tryEnd: "try-end",
input: "input",
};
export const events = {
checked: "checked",
owed: "owed",
};
export const family = { name: "mesh-delivery-checker.events", maxAgeDays: 7 };
export const checkedSubject = "mesh.seat.mesh-delivery-checker.event.checked";
export const owedStream = "SEAT_mesh-delivery-checker_owed";
export function owedSubject(repository, number) {
return "mesh.seat.mesh-delivery-checker.event.owed." + repository + "." + number;
}
export const owedSubjectAll = "mesh.seat.mesh-delivery-checker.event.owed.*.*";
export const holderEvents = {
verdict: "verdict",
previewWritten: "preview.written",
};
export function verdictHolderSubject(holder) {
return "mesh.stream." + holder + ".event.verdict";
}
export function previewWrittenHolderSubject(holder) {
return "mesh.stream." + holder + ".event.preview.written";
}
export const states = {
verdicts: "verdicts",
kept: "kept",
owed: "owed",
previews: "previews",
};
/** The key of one value of the state verdicts under the form "<group>.<heads>". */
export function verdictsByGroupHeadsKey(group, heads) {
return group + "." + heads;
}
/** The parts of a key of the form "<group>.<heads>", or undefined for a key of another form. */
export function parseVerdictsByGroupHeadsKey(_key) {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const group = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const heads = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { group, heads };
}
/** The key of one value of the state kept under the form "<level>.<digest>". */
export function keptByLevelDigestKey(level, digest) {
return level + "." + digest;
}
/** The parts of a key of the form "<level>.<digest>", or undefined for a key of another form. */
export function parseKeptByLevelDigestKey(_key) {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const level = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const digest = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { level, digest };
}
/** The key of one value of the state owed under the form "<repository>.<number>.<head>.<act>". */
export function owedByRepositoryNumberHeadActKey(repository, number, head, act) {
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) {
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 previews under the form "<repository>.<head>.<trunk>". */
export function previewsByRepositoryHeadTrunkKey(repository, head, trunk) {
return repository + "." + head + "." + trunk;
}
/** The parts of a key of the form "<repository>.<head>.<trunk>", or undefined for a key of another form. */
export function parsePreviewsByRepositoryHeadTrunkKey(_key) {
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 head = _rest.slice(0, _at2);
_rest = _rest.slice(_at2 + 1);
if (_rest === "") return undefined;
const trunk = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { repository, head, trunk };
}