/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * Renderer-side aliases derived from the East `OntologyType` so the * renderer tracks any structural change to the source-of-truth type as a * compile error — adding a tag to `NodeKindType` / `LinkKindType` or a * field to a struct shows up here, not as a silent runtime drift. * * The flattened representation (`FlatNode` / `FlatLink`) strips the * `OptionType` / `VariantType` wrappers down to plain strings so the * React components can read them without ceremony. * * @packageDocumentation */ import type { ValueTypeOf } from '@elaraai/east'; import { NodeKindType as EastNodeKindType, LinkKindType as EastLinkKindType, OntologyType as EastOntologyType } from '@elaraai/e3-ui/internal'; /** JS string-union of every `NodeKindType` variant tag. */ export type OntologyNodeKind = ValueTypeOf['type']; /** JS string-union of every `LinkKindType` variant tag. */ export type OntologyLinkKind = ValueTypeOf['type']; /** JS-side shape of an `OntologyType` node carrier. */ export type OntologyNode = ValueTypeOf['nodes'][number]; /** JS-side shape of an `OntologyType` link carrier. */ export type OntologyLink = ValueTypeOf['links'][number]; /** JS-side shape of an `OntologyType` value. */ export type Ontology = ValueTypeOf; /** Flattened node — variant wrappers stripped to plain strings for the * layout + ReactFlow render path. `description` is `string | undefined` * (not optional) because `exactOptionalPropertyTypes` in tsconfig forbids * assigning `undefined` to an optional property. */ export interface FlatNode { id: string; name: string; description: string | undefined; nodeType: OntologyNodeKind; } /** Flattened link — kind unwrapped to a plain string. */ export interface FlatLink { id: string; source: string; target: string; linkType: OntologyLinkKind; } /** Strip the variant wrappers off an ontology value for layout / render. * Orphan links (source or target missing from the node set) are dropped. */ export declare function flattenOntology(ontology: Ontology): { nodes: FlatNode[]; links: FlatLink[]; }; /** * Default link kind for a `source → target` node-kind pair, or `null` if * no conventional relation exists. Typed as * `Record>` * — if `NodeKindType` or `LinkKindType` gains a tag, TS flags the missing * entries here. */ export declare const ValidLinks: Record>; /** All node kinds in display order. */ export declare const ALL_NODE_KINDS: OntologyNodeKind[]; //# sourceMappingURL=types.d.ts.map