/// import { IDisposable } from '@stoplight/lifecycle'; import { Dictionary, IDiagnostic } from '@stoplight/types'; import { IFSTreeItem } from '../backends/filesystem'; import { INotifier } from '../notifier'; import { ITraceData } from '../types'; import { IGraphDom, IGraphPatch, IGraphPatchResult, INodeFinder, JsonPatch, SourceNodeProp } from './dom/types'; import { IBaseNode, ISourceNodeInstance, IVirtualNodeInstance, NodeInstance, NodeWithOptionalId } from './nodes/types'; export interface IGraph extends IDisposable, INodeFinder, IPatchableGraph, IHydratable { readonly dom: IGraphDom; readonly nodeValues: NodeInstance[]; readonly sourceNodes: ISourceNodeInstance[]; readonly virtualNodes: IVirtualNodeInstance[]; readonly rootNodes: ISourceNodeInstance[]; readonly notifier: INotifier; processIndexedTree: (tree: IFSTreeItem[], parentId: string) => void; printTree: () => string; } export interface IPatchableGraph { applyPatch: (patch: IGraphPatch) => IGraphPatchResult; addNode: (props: NodeType, trace?: ITraceData) => NodeInstance; indexNode: (props: NodeType, trace?: ITraceData) => NodeInstance; setSourceNodeDiagnostics: (id: string, source: string, value: IDiagnostic[], trace?: ITraceData) => void; setSourceNodeProp: (id: string, prop: SourceNodeProp, value: unknown, trace?: ITraceData) => void; patchSourceNodeProp: (id: string, prop: SourceNodeProp, patch: JsonPatch, trace?: ITraceData) => void; moveNode: (id: string, newParentId?: string | null, newPath?: string, trace?: ITraceData) => void; removeNode: (id: string, trace?: ITraceData) => void; reportError: (nodeId: string, err: NodeJS.ErrnoException, trace?: ITraceData) => void; } export interface IHydratable { dehydrate: () => D; } export interface IDehydratedGraph { nodes: Dictionary; } export declare type IdGeneratorWrapper = (node: NodeWithOptionalId) => string; export declare type IdGenerator = (node: NodeWithOptionalId, uri: string) => string;