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