import { EncryptionLevel, Node, Relationship, TrustStrategy } from "neo4j-driver/types/v1"; import * as vis from "vis"; export interface DataMap { nodes?: vis.DataSet; edges?: vis.DataSet; } export interface NeoVisConfig { container_id: string; server_url: string; server_user: string; server_password: string; initial_cypher: string; node?: NodeProp; relationship?: RelationshipProp; visOptions?: vis.Options; encrypted?: boolean | EncryptionLevel; trust?: TrustStrategy; } export interface NodeProp { size?: any; community?: any; caption?: any; sizeCypher?: string; } export interface RelationshipProp { thickness?: any; caption?: any; } export interface VisualisationStrategy { NodeStrategy: { [dbProps: string]: StylingStrategy[]; }; EdgeStrategy: { [dbProps: string]: StylingStrategy[]; }; } export interface StylingStrategy { infoName: string; htmlStyling?: HTMLStyling; htmlSuffix?: string | StylingProcess; } export interface HTMLStyling { htmlTag: string; htmlAttr: { [attr: string]: string | StylingProcess; }; htmlContent?: StylingProcess; } export declare type StylingProcess = (dbProp: string) => string; export default class NeoVis { private _config; private _encrypted; private _trust; private _driver; private _query; private _nodes; private _edges; private _data; private _network; private _container; private _events; private _strategy; /** * * @constructor * @param {object} config - configures the visualization and Neo4j server connection * { * container: * server_url: * server_password?: * server_username?: * labels: * * } * */ constructor(config: NeoVisConfig); _addNode(node: vis.Node): void; _addEdge(edge: vis.Edge): void; /** * Build node object for vis from a neo4j Node * FIXME: use config * FIXME: move to private api * @param {Node} n * @returns {vis.Node} */ buildNodeVisObject(n: Node): vis.Node; /** * Set the formatter for the node tooltip * @param formatter */ setStrategy(vs: VisualisationStrategy): void; /** * Build edge object for vis from a neo4j Relationship * @param {Relationship} r * @returns {vis.Edge} */ buildEdgeVisObject(r: Relationship): vis.Edge; /** * Render nodes to canvas */ render(): void; /** * Clear the data for the visualization */ clearNetwork(): void; /** * Register an event on the network * @param {string} eventType Event type to be handled * @param {Function} handler Handler to manage the event */ registerOnEvent(eventType: string, handler: (args: any[]) => void): void; /** * Reset the config object and reload data * @param {NeoVisConfig} config */ reinit(config: NeoVisConfig): void; /** * Fetch live data form the server and reload the visualization */ reload(): void; /** * Stabilize the visuzliation */ stabilize(): void; /** * Execute an arbitrary Cypher query and re-render the visualization * @param {string} query */ renderWithCypher(query: string): void; /** * Focus on certain node via cypher search * @param {string} nodePK primary key of the model or search attribute * @param {string} nodePKVal search value * @param {object} options https://visjs.org/docs/network/ */ focusOnNode(nodePK: string, nodePKVal: string, options: object): void; /** * Generate HTML description tooltip using strategies * @param neoNodeProps */ private formatNodes; /** * Generate HTML description tooltip using strategies * @param neoEdgeProps */ private formatEdges; /** * Get property value from a Neo4J entity * @param properties properties * @param key key */ private getProperty; } export { NeoVis };