Written by seatgen at c62650e4 (GEN3) with mesh-sdk b19fc7fa (reader release): the seat mesh-grants new, every TypeScript contract as index.js with index.d.ts, events with subject and stream. mesh-watchdogs gains its family, which a definition with events needs. Written with the reader as it is: the field needs-approval (node-login-shell) and the section bodies (mesh-conditions) are unknown to it, so they were laid aside for the run; nothing generated carries either. Builds: design 47 G §339, §341, §261, §389 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
74 lines
2.4 KiB
JavaScript
74 lines
2.4 KiB
JavaScript
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
|
|
|
|
// The contract of the seat "mesh-node-enroller", defined whole (seats/mesh-node-enroller/seat.json): The seat that enrols a new machine on the operator's Approve and a one-time token (ADR 0587). Renamed from mesh-enrolment (ADR 0634 §9).
|
|
|
|
export const seat = "mesh-node-enroller";
|
|
|
|
export const verbs = {
|
|
issue: "issue",
|
|
redeem: "redeem",
|
|
confirm: "confirm",
|
|
revoke: "revoke",
|
|
tokens: "tokens",
|
|
again: "again",
|
|
};
|
|
|
|
export const events = {
|
|
enrolmentIssued: "enrolment-issued",
|
|
nodeEnrolled: "node-enrolled",
|
|
enrolmentRefused: "enrolment-refused",
|
|
enrolmentRevoked: "enrolment-revoked",
|
|
enrolmentExpired: "enrolment-expired",
|
|
};
|
|
|
|
export const family = { name: "mesh-node-enroller.events", maxAgeDays: 7 };
|
|
|
|
export const enrolmentIssuedSubject = "mesh.seat.mesh-node-enroller.event.enrolment-issued";
|
|
|
|
export const nodeEnrolledSubject = "mesh.seat.mesh-node-enroller.event.node-enrolled";
|
|
|
|
export const enrolmentRefusedSubject = "mesh.seat.mesh-node-enroller.event.enrolment-refused";
|
|
|
|
export const enrolmentRevokedSubject = "mesh.seat.mesh-node-enroller.event.enrolment-revoked";
|
|
|
|
export const enrolmentExpiredSubject = "mesh.seat.mesh-node-enroller.event.enrolment-expired";
|
|
|
|
export const states = {
|
|
enrolments: "enrolments",
|
|
};
|
|
|
|
/** The key of one value of the state enrolments under the form "node.<node>". */
|
|
export function enrolmentsByNodeNodeKey(node) {
|
|
return "node." + node;
|
|
}
|
|
|
|
/** The parts of a key of the form "node.<node>", or undefined for a key of another form. */
|
|
export function parseEnrolmentsByNodeNodeKey(_key) {
|
|
let _rest = _key;
|
|
if (!_rest.startsWith("node.")) return undefined;
|
|
_rest = _rest.slice(5);
|
|
if (_rest === "") return undefined;
|
|
const node = _rest;
|
|
_rest = "";
|
|
if (_rest !== "") return undefined;
|
|
return { node };
|
|
}
|
|
|
|
/** The key of one value of the state enrolments under the form "address.<address>". */
|
|
export function enrolmentsByAddressAddressKey(address) {
|
|
return "address." + address;
|
|
}
|
|
|
|
/** The parts of a key of the form "address.<address>", or undefined for a key of another form. */
|
|
export function parseEnrolmentsByAddressAddressKey(_key) {
|
|
let _rest = _key;
|
|
if (!_rest.startsWith("address.")) return undefined;
|
|
_rest = _rest.slice(8);
|
|
if (_rest === "") return undefined;
|
|
const address = _rest;
|
|
_rest = "";
|
|
if (_rest !== "") return undefined;
|
|
return { address };
|
|
}
|
|
|