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
85 lines
3.0 KiB
JavaScript
85 lines
3.0 KiB
JavaScript
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
|
|
|
|
// The contract of the seat "mesh-provisioner", defined whole (seats/mesh-provisioner/seat.json): The provisioner (ADR 0349): which domain answers which kind of placeholder, what each module needs, what is applied where.
|
|
|
|
export const seat = "mesh-provisioner";
|
|
|
|
export const verbs = {
|
|
provisioning: "provisioning",
|
|
};
|
|
|
|
export const states = {
|
|
plans: "plans",
|
|
provisions: "provisions",
|
|
};
|
|
|
|
/** The key of one value of the state plans under the form "<node>.<module>". */
|
|
export function plansByNodeModuleKey(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 parsePlansByNodeModuleKey(_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 provisions under the form "<node>.<consumer>.<provision>". */
|
|
export function provisionsByNodeConsumerProvisionKey(node, consumer, provision) {
|
|
return node + "." + consumer + "." + provision;
|
|
}
|
|
|
|
/** The parts of a key of the form "<node>.<consumer>.<provision>", or undefined for a key of another form. */
|
|
export function parseProvisionsByNodeConsumerProvisionKey(_key) {
|
|
let _rest = _key;
|
|
const _at0 = _rest.indexOf(".");
|
|
if (_at0 <= 0) return undefined;
|
|
const node = _rest.slice(0, _at0);
|
|
_rest = _rest.slice(_at0 + 1);
|
|
const _at2 = _rest.indexOf(".");
|
|
if (_at2 <= 0) return undefined;
|
|
const consumer = _rest.slice(0, _at2);
|
|
_rest = _rest.slice(_at2 + 1);
|
|
if (_rest === "") return undefined;
|
|
const provision = _rest;
|
|
_rest = "";
|
|
if (_rest !== "") return undefined;
|
|
return { node, consumer, provision };
|
|
}
|
|
|
|
/** The key of one value of the state provisions under the form "<node>.<consumer>.<provision>.<local>". */
|
|
export function provisionsByNodeConsumerProvisionLocalKey(node, consumer, provision, local) {
|
|
return node + "." + consumer + "." + provision + "." + local;
|
|
}
|
|
|
|
/** The parts of a key of the form "<node>.<consumer>.<provision>.<local>", or undefined for a key of another form. */
|
|
export function parseProvisionsByNodeConsumerProvisionLocalKey(_key) {
|
|
let _rest = _key;
|
|
const _at0 = _rest.indexOf(".");
|
|
if (_at0 <= 0) return undefined;
|
|
const node = _rest.slice(0, _at0);
|
|
_rest = _rest.slice(_at0 + 1);
|
|
const _at2 = _rest.indexOf(".");
|
|
if (_at2 <= 0) return undefined;
|
|
const consumer = _rest.slice(0, _at2);
|
|
_rest = _rest.slice(_at2 + 1);
|
|
const _at4 = _rest.indexOf(".");
|
|
if (_at4 <= 0) return undefined;
|
|
const provision = _rest.slice(0, _at4);
|
|
_rest = _rest.slice(_at4 + 1);
|
|
if (_rest === "") return undefined;
|
|
const local = _rest;
|
|
_rest = "";
|
|
if (_rest !== "") return undefined;
|
|
return { node, consumer, provision, local };
|
|
}
|
|
|