Files
mesh-contracts/ts/seats/meshconfig/index.js
T
jschoubben e529c372d0 C14: the generated Go and TypeScript of every seat follow the definitions
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
2026-11-11 10:45:30 +01:00

98 lines
3.2 KiB
JavaScript

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "mesh-config", defined whole (seats/mesh-config/seat.json): The mesh's config values: read and set one, and the renames still open. mesh-config's own events stay under its own subjects (ADR 0620 §2).
export const seat = "mesh-config";
export const verbs = {
config: "config",
renames: "renames",
};
export const holderEvents = {
configChanged: "config-changed",
renamed: "renamed",
retiring: "retiring",
retired: "retired",
};
export function configChangedHolderSubject(holder) {
return "mesh.mod." + holder + ".event.config-changed";
}
export function renamedHolderSubject(holder) {
return "mesh.stream." + holder + ".event.renamed";
}
export function retiringHolderSubject(holder) {
return "mesh.stream." + holder + ".event.retiring";
}
export function retiredHolderSubject(holder) {
return "mesh.stream." + holder + ".event.retired";
}
export const states = {
resolved: "resolved",
kept: "kept",
};
/** The key of one value of the state resolved under the form "<node>.<module>.<key>". */
export function resolvedByNodeModuleKeyKey(node, module, key) {
return node + "." + module + "." + key;
}
/** The parts of a key of the form "<node>.<module>.<key>", or undefined for a key of another form. */
export function parseResolvedByNodeModuleKeyKey(_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 module = _rest.slice(0, _at2);
_rest = _rest.slice(_at2 + 1);
if (_rest === "") return undefined;
const key = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, module, key };
}
/** The key of one value of the state kept under the form "<owner>.<repository>.<number>.<node>.<module>.<key>". */
export function keptByOwnerRepositoryNumberNodeModuleKeyKey(owner, repository, number, node, module, key) {
return owner + "." + repository + "." + number + "." + node + "." + module + "." + key;
}
/** The parts of a key of the form "<owner>.<repository>.<number>.<node>.<module>.<key>", or undefined for a key of another form. */
export function parseKeptByOwnerRepositoryNumberNodeModuleKeyKey(_key) {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const owner = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
const _at2 = _rest.indexOf(".");
if (_at2 <= 0) return undefined;
const repository = _rest.slice(0, _at2);
_rest = _rest.slice(_at2 + 1);
const _at4 = _rest.indexOf(".");
if (_at4 <= 0) return undefined;
const number = _rest.slice(0, _at4);
_rest = _rest.slice(_at4 + 1);
const _at6 = _rest.indexOf(".");
if (_at6 <= 0) return undefined;
const node = _rest.slice(0, _at6);
_rest = _rest.slice(_at6 + 1);
const _at8 = _rest.indexOf(".");
if (_at8 <= 0) return undefined;
const module = _rest.slice(0, _at8);
_rest = _rest.slice(_at8 + 1);
if (_rest === "") return undefined;
const key = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { owner, repository, number, node, module, key };
}