import { type Infer, array, integer, min, object, record, string, } from "superstruct" const $Connection = object({ nodeKey: string(), weight: min(integer(), 0), }) type Connection = Infer const $Node = object({ key: string(), outs: record(string(), $Connection), }) type Node = Infer const $Entry = object({ name: string(), stages: array(string()), }) type Entry = Infer const $Graph = object({ nodes: record(string(), $Node), starts: array(string()), entries: record(string(), $Entry), }) type Graph = Infer const DEFAULT_NODE = { applicationSubmittedNode: { key: "Application submitted", outs: {}, }, acceptedNode: { key: "Accepted", outs: {}, }, rejectedNode: { key: "Rejected", outs: {}, }, } as const export { $Graph, DEFAULT_NODE } export type { Graph, Node, Entry, Connection }