1 |
|
2 | import { IDiagnostic } from '@stoplight/types';
|
3 | import { IFSTreeItem } from '../backends/filesystem';
|
4 | import { INotifier } from '../notifier/types';
|
5 | import { ITraceData } from '../types';
|
6 | import { IGraphDom, IGraphPatch, JsonPatch, SourceNodeProp } from './dom';
|
7 | import { INodeTree, NodeInstance, NodeWithOptionalId } from './nodes';
|
8 | import { IDehydratedGraph, IdGenerator, IdGeneratorWrapper, IGraph, IPatchableGraph } from './types';
|
9 | export interface IGraphProps {
|
10 | id: string;
|
11 | idGenerator?: IdGenerator;
|
12 | notifier: INotifier;
|
13 | }
|
14 | export declare function createGraph(props: IGraphProps): Graph;
|
15 | declare class Graph implements IGraph {
|
16 | id: string;
|
17 | dom: IGraphDom;
|
18 | private _idGenerator;
|
19 | notifier: INotifier;
|
20 | constructor(props: IGraphProps);
|
21 | get nodeValues(): NodeInstance[];
|
22 | get sourceNodes(): import("./nodes").ISourceNodeInstance<Object>[];
|
23 | get virtualNodes(): import("./nodes").IVirtualNodeInstance[];
|
24 | get rootNodes(): import("./nodes").ISourceNodeInstance<Object>[];
|
25 | getNodeById: (id: string) => NodeInstance;
|
26 | getNodeByUri: (uri: string) => NodeInstance;
|
27 | getNodesByType: (type: string) => NodeInstance[];
|
28 | applyPatch(patch: IGraphPatch): import("./dom").IGraphPatchResult<import("./dom").GraphOperationResult<import("./dom").GraphOperation<D>>>;
|
29 | addNode(node: NodeWithOptionalId, trace?: ITraceData, indexOnly?: boolean): NodeInstance;
|
30 | indexNode(node: NodeWithOptionalId, trace?: ITraceData): NodeInstance;
|
31 | processIndexedTree: (tree: IFSTreeItem[], parentId: string) => void;
|
32 | setSourceNodeDiagnostics(id: string, source: string, diagnostics: IDiagnostic[], trace?: ITraceData): void;
|
33 | setSourceNodeProp(id: string, prop: SourceNodeProp, value: unknown, trace?: ITraceData): void;
|
34 | reportError(nodeId: string, error: NodeJS.ErrnoException, trace?: ITraceData): void;
|
35 | patchSourceNodeProp(id: string, prop: SourceNodeProp, value: JsonPatch, trace?: ITraceData): void;
|
36 | moveNode(id: string, newParentId?: string | null, newPath?: string, trace?: ITraceData): void;
|
37 | removeNode(id: string, trace?: ITraceData): void;
|
38 | printTree(): string;
|
39 | dehydrate(): IDehydratedGraph;
|
40 | dispose(): void;
|
41 | private getNodeByPathWithParent;
|
42 | }
|
43 | export declare const addNodeTree: ((helpers: Pick<IPatchableGraph, "addNode">, tree: INodeTree[], parentId?: string | undefined) => void) & import("mobx").IAction;
|
44 | export declare const defaultIdGenerator: IdGeneratorWrapper;
|
45 | export declare function generateNodeId(node: NodeWithOptionalId, idGenerator: IdGenerator, nodeFinder: Pick<IGraph, 'getNodeById'>): string;
|
46 | export {};
|