Files
mesh-contracts/ts/src/mesh-broker.ts
T

272 lines
7.7 KiB
TypeScript

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "mesh-broker", defined whole (seats/mesh-broker/seat.json): The mesh's bus, and the bus state modules ask of it in requires (design 25 § 12). create, apply, recreate and drop are granted to the bus module's own credential alone.
export const seat = "mesh-broker";
export const verbs = {
list: "list",
show: "show",
check: "check",
orphans: "orphans",
create: "create",
apply: "apply",
recreate: "recreate",
drop: "drop",
} as const;
export const events = {
created: "created",
refused: "refused",
drifted: "drifted",
driftCleared: "drift-cleared",
full: "full",
fullCleared: "full-cleared",
orphaned: "orphaned",
recreated: "recreated",
dropped: "dropped",
} as const;
export const family = { name: "mesh-broker.events", maxAgeDays: 7 } as const;
export const createdSubject = "mesh.seat.mesh-broker.event.created";
export const refusedSubject = "mesh.seat.mesh-broker.event.refused";
export const driftedSubject = "mesh.seat.mesh-broker.event.drifted";
export const driftClearedSubject = "mesh.seat.mesh-broker.event.drift-cleared";
export const fullSubject = "mesh.seat.mesh-broker.event.full";
export const fullClearedSubject = "mesh.seat.mesh-broker.event.full-cleared";
export const orphanedSubject = "mesh.seat.mesh-broker.event.orphaned";
export const recreatedSubject = "mesh.seat.mesh-broker.event.recreated";
export const droppedSubject = "mesh.seat.mesh-broker.event.dropped";
/** the binding a module receives in its membership for one entry (ADR 0595 §1, §7) */
export interface Binding {
/** the entry's name on the bus */
"bus-name": string;
/** how the bus keeps it */
"storage-type": string;
/** its subjects, for a stream */
"subjects"?: string[];
/** its template */
"template"?: string;
}
/** one piece of bus state as a manifest asks it */
export interface Entry {
/** its own configuration, where no template fits */
"configuration"?: Record<string, unknown>;
/** its local name in the module's manifest */
"local-name": string;
/** the module asking it */
"module": string;
/** the template's options the module set, within their bounds */
"options"?: Record<string, unknown>;
/** how the bus keeps it */
"storage-type": "stream" | "key-value" | "object-store" | "ledger";
/** its template; empty for a configuration of its own */
"template"?: "state" | "events" | "work-queue" | "log" | "objects" | "ledger" | "";
}
export interface Fill {
/** bytes held */
"bytes": number;
/** its cap in bytes */
"cap": number;
/** messages, keys or objects held */
"count": number;
}
/** one entry as the bus holds it */
export interface Held {
/** its name on the bus, <module>_<local name> */
"bus-name": string;
/** its own configuration, where no template fits */
"configuration"?: Record<string, unknown>;
"fill"?: Fill;
/** its local name in the module's manifest */
"local-name": string;
/** the module asking it */
"module": string;
/** the template's options the module set, within their bounds */
"options"?: Record<string, unknown>;
/** the settings the bus holds */
"settings"?: Record<string, unknown>;
/** the entry's state: held as asked, refused, waiting to be made, drifted from what is asked, full, or orphaned (no manifest asks it) */
"state"?: "held" | "refused" | "waiting" | "drifted" | "full" | "orphaned";
/** how the bus keeps it */
"storage-type": "stream" | "key-value" | "object-store" | "ledger";
/** its template; empty for a configuration of its own */
"template"?: "state" | "events" | "work-queue" | "log" | "objects" | "ledger" | "";
/** why it is in its state, in plain words; empty when held as asked */
"why"?: string;
}
export interface Named {
/** the entry's local name */
"local-name": string;
/** the module */
"module": string;
}
/** the body of every event of the seat */
export interface Said {
/** the settings asked */
"asked"?: Record<string, unknown>;
"binding"?: Binding;
/** its name on the bus */
"bus-name": string;
/** its own configuration, where no template fits */
"configuration"?: Record<string, unknown>;
"fill"?: Fill;
/** the settings held */
"held"?: Record<string, unknown>;
/** its local name in the module's manifest */
"local-name": string;
/** the module asking it */
"module": string;
/** the template's options the module set, within their bounds */
"options"?: Record<string, unknown>;
/** the indexer's revision of the verdict the bus module acted on (ADR 0622 §2), so a reader orders what it hears */
"revision"?: number;
/** the stream snapshot taken before a recreate or drop */
"snapshot"?: string;
/** how the bus keeps it */
"storage-type"?: "stream" | "key-value" | "object-store" | "ledger";
/** its template; empty for a configuration of its own */
"template"?: "state" | "events" | "work-queue" | "log" | "objects" | "ledger" | "";
/** why: a refusal's cause, a drift's difference, a drop's or recreate's reason */
"why"?: string;
}
export interface Warranted {
/** the entry's local name */
"local-name": string;
/** the module */
"module": string;
/** the operator's warrant, as the operator channel decided it (ADR 0259 §6) */
"warrant": string;
/** why, kept in the record */
"why": string;
}
/** is what list takes. */
export interface ListInput {
/** one module (optional) */
"module"?: string;
}
/** is what list answers. */
export interface ListAnswer {
/** every entry */
"entries": Held[];
}
/** is what show takes. */
export type ShowInput = Named;
/** is what show answers. */
export type ShowAnswer = Held;
/** is what check takes. */
export interface CheckInput {
/** one module (optional) */
"module"?: string;
}
export interface CheckAnswerDifferencesItem {
/** asked */
"asked"?: Record<string, unknown>;
/** the difference only grows: apply may act on it */
"grows"?: boolean;
/** held */
"held"?: Record<string, unknown>;
/** the entry */
"local-name": string;
/** the module */
"module": string;
}
/** is what check answers. */
export interface CheckAnswer {
/** every difference */
"differences": CheckAnswerDifferencesItem[];
}
/** is what orphans takes. */
export interface OrphansInput {
}
/** is what orphans answers. */
export interface OrphansAnswer {
/** every orphan */
"entries": Held[];
}
/** is what create takes. */
export type CreateInput = Entry;
/** is what create answers. */
export type CreateAnswer = Held;
/** is what apply takes. */
export type ApplyInput = Named;
/** is what apply answers. */
export type ApplyAnswer = Held;
/** is what recreate takes. */
export type RecreateInput = Warranted;
/** is what recreate answers. */
export type RecreateAnswer = Held;
/** is what drop takes. */
export type DropInput = Warranted;
/** is what drop answers. */
export interface DropAnswer {
/** it is gone */
"dropped": boolean;
/** the snapshot taken first */
"snapshot"?: string;
}
/** is the body of the event created. */
export type CreatedEvent = Said;
/** is the body of the event refused. */
export type RefusedEvent = Said;
/** is the body of the event drifted. */
export type DriftedEvent = Said;
/** is the body of the event drift-cleared. */
export type DriftClearedEvent = Said;
/** is the body of the event full. */
export type FullEvent = Said;
/** is the body of the event full-cleared. */
export type FullClearedEvent = Said;
/** is the body of the event orphaned. */
export type OrphanedEvent = Said;
/** is the body of the event recreated. */
export type RecreatedEvent = Said;
/** is the body of the event dropped. */
export type DroppedEvent = Said;
/** is the form of the provision bus-state. */
export type BusStateForm = Binding;