Builds: design 47 G A-61 (§693, §683, §556, §73) Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
261 lines
8.4 KiB
JavaScript
261 lines
8.4 KiB
JavaScript
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
|
|
|
|
// The contract of the seat "mesh-wants", defined whole (seats/mesh-wants/seat.json): The seat that says what each node should run and whether each module's new builds wait for a person (ADR 0565, ADR 0539).
|
|
|
|
export const seat = "mesh-wants";
|
|
|
|
export const verbs = {
|
|
upgrade: "upgrade",
|
|
bus: "bus",
|
|
revision: "revision",
|
|
entry: "entry",
|
|
difference: "difference",
|
|
input: "input",
|
|
};
|
|
|
|
export const accepts = {
|
|
step: "step",
|
|
};
|
|
|
|
export const events = {
|
|
policyChanged: "policy-changed",
|
|
assignmentRevision: "assignment-revision",
|
|
difference: "difference",
|
|
wanted: "wanted",
|
|
waitHeld: "wait-held",
|
|
waitEnded: "wait-ended",
|
|
filling: "filling",
|
|
full: "full",
|
|
room: "room",
|
|
stepEnded: "step-ended",
|
|
versionDelivered: "version-delivered",
|
|
stepProgress: "step-progress",
|
|
};
|
|
|
|
export const family = { name: "mesh-wants.events", maxAgeDays: 7 };
|
|
|
|
export const policyChangedSubject = "mesh.seat.mesh-wants.event.policy-changed";
|
|
|
|
export const assignmentRevisionSubject = "mesh.seat.mesh-wants.event.assignment-revision";
|
|
|
|
export const differenceSubject = "mesh.seat.mesh-wants.event.difference";
|
|
|
|
export const wantedStream = "SEAT_mesh-wants_wanted";
|
|
|
|
export function wantedSubject(node, module) {
|
|
return "mesh.seat.mesh-wants.event.wanted." + node + "." + module;
|
|
}
|
|
|
|
export const wantedSubjectAll = "mesh.seat.mesh-wants.event.wanted.*.*";
|
|
|
|
export const waitHeldSubject = "mesh.seat.mesh-wants.event.wait-held";
|
|
|
|
export const waitEndedSubject = "mesh.seat.mesh-wants.event.wait-ended";
|
|
|
|
export const fillingSubject = "mesh.seat.mesh-wants.event.filling";
|
|
|
|
export const fullSubject = "mesh.seat.mesh-wants.event.full";
|
|
|
|
export const roomSubject = "mesh.seat.mesh-wants.event.room";
|
|
|
|
export const stepEndedStream = "SEAT_mesh-wants_step-ended";
|
|
|
|
export function stepEndedSubject(node) {
|
|
return "mesh.seat.mesh-wants.event.step-ended." + node;
|
|
}
|
|
|
|
export const stepEndedSubjectAll = "mesh.seat.mesh-wants.event.step-ended.*";
|
|
|
|
export const versionDeliveredStream = "SEAT_mesh-wants_version-delivered";
|
|
|
|
export const versionDeliveredSubject = "mesh.seat.mesh-wants.event.version-delivered";
|
|
|
|
export function stepProgressSubject(node) {
|
|
return "mesh.seat.mesh-wants.event.step-progress." + node;
|
|
}
|
|
|
|
export const stepProgressSubjectAll = "mesh.seat.mesh-wants.event.step-progress.*";
|
|
|
|
export const stepSubject = "mesh.seat.mesh-wants.accept.step";
|
|
|
|
export const states = {
|
|
wants: "wants",
|
|
differences: "differences",
|
|
compositions: "compositions",
|
|
assignmentRevisions: "assignment-revisions",
|
|
inputs: "inputs",
|
|
};
|
|
|
|
/** The key of one value of the state wants under the form "want.<node>.<module>". */
|
|
export function wantsByWantNodeModuleKey(node, module) {
|
|
return "want." + node + "." + module;
|
|
}
|
|
|
|
/** The parts of a key of the form "want.<node>.<module>", or undefined for a key of another form. */
|
|
export function parseWantsByWantNodeModuleKey(_key) {
|
|
let _rest = _key;
|
|
if (!_rest.startsWith("want.")) return undefined;
|
|
_rest = _rest.slice(5);
|
|
const _at1 = _rest.indexOf(".");
|
|
if (_at1 <= 0) return undefined;
|
|
const node = _rest.slice(0, _at1);
|
|
_rest = _rest.slice(_at1 + 1);
|
|
if (_rest === "") return undefined;
|
|
const module = _rest;
|
|
_rest = "";
|
|
if (_rest !== "") return undefined;
|
|
return { node, module };
|
|
}
|
|
|
|
/** The key of one value of the state wants under the form "want.<node>.node". */
|
|
export function wantsByWantNodeNodeKey(node) {
|
|
return "want." + node + ".node";
|
|
}
|
|
|
|
/** The parts of a key of the form "want.<node>.node", or undefined for a key of another form. */
|
|
export function parseWantsByWantNodeNodeKey(_key) {
|
|
let _rest = _key;
|
|
if (!_rest.startsWith("want.")) return undefined;
|
|
_rest = _rest.slice(5);
|
|
const _at1 = _rest.indexOf(".node");
|
|
if (_at1 <= 0) return undefined;
|
|
const node = _rest.slice(0, _at1);
|
|
_rest = _rest.slice(_at1 + 5);
|
|
if (_rest !== "") return undefined;
|
|
return { node };
|
|
}
|
|
|
|
/** The key of one value of the state wants under the form "held.<module>.<fingerprint>". */
|
|
export function wantsByHeldModuleFingerprintKey(module, fingerprint) {
|
|
return "held." + module + "." + fingerprint;
|
|
}
|
|
|
|
/** The parts of a key of the form "held.<module>.<fingerprint>", or undefined for a key of another form. */
|
|
export function parseWantsByHeldModuleFingerprintKey(_key) {
|
|
let _rest = _key;
|
|
if (!_rest.startsWith("held.")) return undefined;
|
|
_rest = _rest.slice(5);
|
|
const _at1 = _rest.indexOf(".");
|
|
if (_at1 <= 0) return undefined;
|
|
const module = _rest.slice(0, _at1);
|
|
_rest = _rest.slice(_at1 + 1);
|
|
if (_rest === "") return undefined;
|
|
const fingerprint = _rest;
|
|
_rest = "";
|
|
if (_rest !== "") return undefined;
|
|
return { module, fingerprint };
|
|
}
|
|
|
|
/** The key of one value of the state differences under the form "<node>.<module>". */
|
|
export function differencesByNodeModuleKey(node, module) {
|
|
return node + "." + module;
|
|
}
|
|
|
|
/** The parts of a key of the form "<node>.<module>", or undefined for a key of another form. */
|
|
export function parseDifferencesByNodeModuleKey(_key) {
|
|
let _rest = _key;
|
|
const _at0 = _rest.indexOf(".");
|
|
if (_at0 <= 0) return undefined;
|
|
const node = _rest.slice(0, _at0);
|
|
_rest = _rest.slice(_at0 + 1);
|
|
if (_rest === "") return undefined;
|
|
const module = _rest;
|
|
_rest = "";
|
|
if (_rest !== "") return undefined;
|
|
return { node, module };
|
|
}
|
|
|
|
/** The key of one value of the state compositions under the form "<group>.<heads>". */
|
|
export function compositionsByGroupHeadsKey(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 parseCompositionsByGroupHeadsKey(_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 assignment-revisions under the form "trunk.<revision>". */
|
|
export function assignmentRevisionsByTrunkRevisionKey(revision) {
|
|
return "trunk." + revision;
|
|
}
|
|
|
|
/** The parts of a key of the form "trunk.<revision>", or undefined for a key of another form. */
|
|
export function parseAssignmentRevisionsByTrunkRevisionKey(_key) {
|
|
let _rest = _key;
|
|
if (!_rest.startsWith("trunk.")) return undefined;
|
|
_rest = _rest.slice(6);
|
|
if (_rest === "") return undefined;
|
|
const revision = _rest;
|
|
_rest = "";
|
|
if (_rest !== "") return undefined;
|
|
return { revision };
|
|
}
|
|
|
|
/** The key of one value of the state assignment-revisions under the form "candidate.<group>.<heads>". */
|
|
export function assignmentRevisionsByCandidateGroupHeadsKey(group, heads) {
|
|
return "candidate." + group + "." + heads;
|
|
}
|
|
|
|
/** The parts of a key of the form "candidate.<group>.<heads>", or undefined for a key of another form. */
|
|
export function parseAssignmentRevisionsByCandidateGroupHeadsKey(_key) {
|
|
let _rest = _key;
|
|
if (!_rest.startsWith("candidate.")) return undefined;
|
|
_rest = _rest.slice(10);
|
|
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 assignment-revisions under the form "entry.<digest>". */
|
|
export function assignmentRevisionsByEntryDigestKey(digest) {
|
|
return "entry." + digest;
|
|
}
|
|
|
|
/** The parts of a key of the form "entry.<digest>", or undefined for a key of another form. */
|
|
export function parseAssignmentRevisionsByEntryDigestKey(_key) {
|
|
let _rest = _key;
|
|
if (!_rest.startsWith("entry.")) return undefined;
|
|
_rest = _rest.slice(6);
|
|
if (_rest === "") return undefined;
|
|
const digest = _rest;
|
|
_rest = "";
|
|
if (_rest !== "") return undefined;
|
|
return { digest };
|
|
}
|
|
|
|
/** The key of one value of the state inputs under the form "<time>.<digest>". */
|
|
export function inputsByTimeDigestKey(time, digest) {
|
|
return time + "." + digest;
|
|
}
|
|
|
|
/** The parts of a key of the form "<time>.<digest>", or undefined for a key of another form. */
|
|
export function parseInputsByTimeDigestKey(_key) {
|
|
let _rest = _key;
|
|
const _at0 = _rest.indexOf(".");
|
|
if (_at0 <= 0) return undefined;
|
|
const time = _rest.slice(0, _at0);
|
|
_rest = _rest.slice(_at0 + 1);
|
|
if (_rest === "") return undefined;
|
|
const digest = _rest;
|
|
_rest = "";
|
|
if (_rest !== "") return undefined;
|
|
return { time, digest };
|
|
}
|
|
|