Files
mesh-contracts/operator-and-conversation/ts/seats/operatorchannel/index.js
T
jschoubben 9db2e1d08c contracts-every-ask-offered: the seat operator-channel loses held-back and ask-again
Builds: design 47 H §764 (The operator channel's limit), H-A-57
2026-11-20 02:30:03 +01:00

84 lines
2.1 KiB
JavaScript

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "operator-channel", defined whole (seats/operator-channel/seat.json): Asking a person and answering on a channel (ADR 0259): held by the router, the messenger module, whose manifest declares the seat; written from that seat entry (design 26).
export const seat = "operator-channel";
export const verbs = {
open: "open",
history: "history",
notify: "notify",
tell: "tell",
asks: "asks",
};
export const accepts = {
ask: "ask",
cancel: "cancel",
condition: "condition",
};
export const events = {
decided: "decided",
};
export const family = { name: "operator-channel.decided", maxAgeDays: 7 };
export function decidedSubject(caller) {
return "mesh.seat.operator-channel.event.decided." + caller;
}
export function askSubject(caller) {
return "mesh.seat.operator-channel.accept.ask." + caller;
}
export function cancelSubject(caller) {
return "mesh.seat.operator-channel.accept.cancel." + caller;
}
export function conditionSubject(caller) {
return "mesh.seat.operator-channel.accept.condition." + caller;
}
export const holderEvents = {
refused: "refused",
offered: "offered",
closed: "closed",
};
export function refusedHolderSubject(holder) {
return "mesh.mod." + holder + ".event.refused";
}
export function offeredHolderSubject(holder) {
return "mesh.stream." + holder + ".event.offered";
}
export function closedHolderSubject(holder) {
return "mesh.stream." + holder + ".event.closed";
}
export const states = {
asks: "asks",
};
/** The key of one value of the state asks under the form "<asker>.<id>". */
export function asksByAskerIDKey(asker, id) {
return asker + "." + id;
}
/** The parts of a key of the form "<asker>.<id>", or undefined for a key of another form. */
export function parseAsksByAskerIDKey(_key) {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const asker = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const id = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { asker, id };
}