import type { Axis, DerivationLoop, MathType, ReasonEdge, ReasonLayer, ReasonNode, Substrate, SubstrateNode, } from "#types/reason.node.types"; import type { Dimension, Lens, MathDomain, Mode, Model, PatternType, ReasonMaps, Representation, UniversalAxis, } from "#types/reason.concept.types"; import type { FailureShape, Invariant, Technique, TestSurface } from "#types/reason.surface.types"; import type { CheckFacet } from "#types/check.types"; import type { DanglingField } from "#types/field.types"; import type { Logger } from "#types/ontology.types"; import type { UnreadKey } from "#types/record.types"; export interface ReasonData { layers: ReasonLayer[]; mathTypes: MathType[]; axes: Axis[]; nodes: ReasonNode[]; substrate: Substrate; derivationLoop: DerivationLoop; edges: ReasonEdge[]; dimensions: Dimension[]; lenses: Lens[]; modes: Mode[]; representations: Representation[]; mathDomains: MathDomain[]; patternTypes: PatternType[]; models: Model[]; universalAxes: UniversalAxis[]; testSurfaces: TestSurface[]; techniques: Technique[]; invariants: Invariant[]; failureShapes: FailureShape[]; maps: ReasonMaps; } export type CollectionKind = | "axis" | "dimension" | "failure-shape" | "invariant" | "layer" | "lens" | "loop" | "math-domain" | "math-type" | "mode" | "model" | "node" | "pattern-type" | "representation" | "substrate-node" | "technique" | "test-surface" | "universal-axis"; export interface ReasonResolution { kind: CollectionKind; record: unknown; } export interface ReasonOntologyIssues { duplicateIds: string[]; danglingConcepts: { node: string; concept: string }[]; danglingFields: DanglingField[]; emptyFields: { kind: string; id: string; field: string }[]; danglingTransitions: { from: string; to: string; reason: string }[]; danglingEdgeSources: string[]; collidingSurfaceCells: { cell: string; surfaces: string[] }[]; answerShapeMismatches: { node: string; answerShape: string; allowed: string }[]; unresolvedModelSteps: { model: string; step: string; stepKind: string }[]; total: number; } export interface ConceptIndexes { dimension: Map; lens: Map; mode: Map; representation: Map; } export interface ReasonIndexes { node: Map; axis: Map; layer: Map; mathType: Map; concepts: ConceptIndexes; mathDomain: Map; patternType: Map; model: Map; universalAxis: Map; substrateNode: Map; testSurface: Map; technique: Map; invariant: Map; failureShape: Map; } export interface ReasonOntologyOptions { logger?: Logger | undefined; data?: ReasonData; } export interface ReasonOntology { checkOf: (kind: string, id: string) => CheckFacet | null; layers: () => ReasonLayer[]; mathTypes: () => MathType[]; mathType: (id: string) => MathType | null; axes: () => Axis[]; axis: (id: string) => Axis | null; nodes: (axis?: string) => ReasonNode[]; node: (id: string) => ReasonNode | null; substrate: () => Substrate; derivationLoop: () => DerivationLoop; edges: () => ReasonEdge[]; dimensions: () => Dimension[]; lenses: () => Lens[]; modes: () => Mode[]; representations: () => Representation[]; mathDomains: () => MathDomain[]; patternTypes: () => PatternType[]; models: () => Model[]; universalAxes: () => UniversalAxis[]; testSurfaces: () => TestSurface[]; techniques: () => Technique[]; invariants: () => Invariant[]; failureShapes: () => FailureShape[]; uncoveredCells: () => { dimension: string; lens: string }[]; maps: () => ReasonMaps; conceptOf: (nodeId: string) => ReasonResolution | null; ids: () => string[]; kindMembers: () => ReadonlyMap>; resolve: (id: string) => ReasonResolution | null; unreadKeys: () => UnreadKey[]; validateReasonOntology: () => ReasonOntologyIssues; }