// Code generated by seatgen from the seat definitions; DO NOT EDIT. // The contract of the seat "mesh-module-assigner", defined whole (seats/mesh-module-assigner/seat.json): The seat that places modules on nodes (ADR 0567): the state of assignments and the proposals that change it. export const seat = "mesh-module-assigner"; export const verbs = { assignments: "assignments", proposals: "proposals", propose: "propose", withdraw: "withdraw", again: "again", }; export const events = { assignmentsProposed: "assignments-proposed", assignmentsWithdrawn: "assignments-withdrawn", assignmentsJudged: "assignments-judged", assignmentsChanged: "assignments-changed", }; export const family = { name: "mesh-module-assigner.events", maxAgeDays: 7 }; export const assignmentsProposedSubject = "mesh.seat.mesh-module-assigner.event.assignments-proposed"; export const assignmentsWithdrawnSubject = "mesh.seat.mesh-module-assigner.event.assignments-withdrawn"; export const assignmentsJudgedSubject = "mesh.seat.mesh-module-assigner.event.assignments-judged"; export const assignmentsChangedSubject = "mesh.seat.mesh-module-assigner.event.assignments-changed"; export const states = { assignments: "assignments", proposals: "proposals", candidates: "candidates", pulses: "pulses", seatHolders: "seat-holders", }; /** The key of one value of the state assignments under the form ".node". */ export function assignmentsByNodeNodeKey(node) { return node + ".node"; } /** The parts of a key of the form ".node", or undefined for a key of another form. */ export function parseAssignmentsByNodeNodeKey(_key) { let _rest = _key; const _at0 = _rest.indexOf(".node"); if (_at0 <= 0) return undefined; const node = _rest.slice(0, _at0); _rest = _rest.slice(_at0 + 5); if (_rest !== "") return undefined; return { node }; } /** The key of one value of the state assignments under the form ".". */ export function assignmentsByNodeModuleKey(node, module) { return node + "." + module; } /** The parts of a key of the form ".", or undefined for a key of another form. */ export function parseAssignmentsByNodeModuleKey(_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 proposals under the form "". */ export function proposalsByProposalKey(proposal) { return proposal; } /** The parts of a key of the form "", or undefined for a key of another form. */ export function parseProposalsByProposalKey(_key) { let _rest = _key; if (_rest === "") return undefined; const proposal = _rest; _rest = ""; if (_rest !== "") return undefined; return { proposal }; } /** The key of one value of the state candidates under the form ".". */ export function candidatesByProposalNodeKey(proposal, node) { return proposal + "." + node; } /** The parts of a key of the form ".", or undefined for a key of another form. */ export function parseCandidatesByProposalNodeKey(_key) { let _rest = _key; const _at0 = _rest.indexOf("."); if (_at0 <= 0) return undefined; const proposal = _rest.slice(0, _at0); _rest = _rest.slice(_at0 + 1); if (_rest === "") return undefined; const node = _rest; _rest = ""; if (_rest !== "") return undefined; return { proposal, node }; } /** The key of one value of the state pulses under the form "answer..". */ export function pulsesByAnswerProposalNodeKey(proposal, node) { return "answer." + proposal + "." + node; } /** The parts of a key of the form "answer..", or undefined for a key of another form. */ export function parsePulsesByAnswerProposalNodeKey(_key) { let _rest = _key; if (!_rest.startsWith("answer.")) return undefined; _rest = _rest.slice(7); const _at1 = _rest.indexOf("."); if (_at1 <= 0) return undefined; const proposal = _rest.slice(0, _at1); _rest = _rest.slice(_at1 + 1); if (_rest === "") return undefined; const node = _rest; _rest = ""; if (_rest !== "") return undefined; return { proposal, node }; } /** The key of one value of the state pulses under the form "ask.". */ export function pulsesByAskProposalKey(proposal) { return "ask." + proposal; } /** The parts of a key of the form "ask.", or undefined for a key of another form. */ export function parsePulsesByAskProposalKey(_key) { let _rest = _key; if (!_rest.startsWith("ask.")) return undefined; _rest = _rest.slice(4); if (_rest === "") return undefined; const proposal = _rest; _rest = ""; if (_rest !== "") return undefined; return { proposal }; } /** The key of one value of the state seat-holders under the form "". */ export function seatHoldersBySeatKey(seat) { return seat; } /** The parts of a key of the form "", or undefined for a key of another form. */ export function parseSeatHoldersBySeatKey(_key) { let _rest = _key; if (_rest === "") return undefined; const seat = _rest; _rest = ""; if (_rest !== "") return undefined; return { seat }; } /** The key of one value of the state seat-holders under the form ".". */ export function seatHoldersBySeatNodeKey(seat, node) { return seat + "." + node; } /** The parts of a key of the form ".", or undefined for a key of another form. */ export function parseSeatHoldersBySeatNodeKey(_key) { let _rest = _key; const _at0 = _rest.indexOf("."); if (_at0 <= 0) return undefined; const seat = _rest.slice(0, _at0); _rest = _rest.slice(_at0 + 1); if (_rest === "") return undefined; const node = _rest; _rest = ""; if (_rest !== "") return undefined; return { seat, node }; }