index.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { DataSet } from "vis-data";
  2. import { Node as VisNode, Edge as VisEdge } from "vis-network";
  3. import { Node as Neo4jNode, Relationship as Neo4jRelationship } from "neo4j-driver";
  4. export const NEOVIS_DEFAULT_CONFIG: unique symbol;
  5. export interface ILabelConfig {
  6. caption?: string;
  7. size?: string;
  8. community?: string;
  9. sizeCypher?: string;
  10. image?: string;
  11. }
  12. export interface IRelationshipConfig {
  13. thickness?: string;
  14. caption?: boolean | string;
  15. }
  16. export interface INeovisConfig {
  17. container_id: string;
  18. server_url: string;
  19. server_user: string;
  20. server_password: string;
  21. labels?: {
  22. [label: string]: ILabelConfig,
  23. [NEOVIS_DEFAULT_CONFIG]?: IRelationshipConfig
  24. };
  25. relationships?: {
  26. [relationship: string]: IRelationshipConfig,
  27. [NEOVIS_DEFAULT_CONFIG]?: IRelationshipConfig
  28. };
  29. arrows?: boolean;
  30. hierarchical?: boolean;
  31. hierarchical_sort_method?: "hubsize" | "directed";
  32. initial_cypher?: string;
  33. console_debug?: boolean;
  34. encrypted?: "ENCRYPTION_OFF" | "ENCRYPTION_ON";
  35. trust?: "TRUST_ALL_CERTIFICATES" | "TRUST_SYSTEM_CA_SIGNED_CERTIFICATES";
  36. }
  37. export interface INode extends VisNode {
  38. raw: Neo4jNode
  39. }
  40. export interface IEdge extends VisEdge {
  41. raw: Neo4jRelationship
  42. }
  43. declare class Neovis {
  44. constructor(config: INeovisConfig);
  45. get nodes(): DataSet<INode>;
  46. get edges(): DataSet<IEdge>;
  47. render(): void;
  48. clearNetwork(): void;
  49. registerOnEvent(eventType: string, handler: (event: any) => void): void;
  50. reinit(config: INeovisConfig): void;
  51. reload(): void;
  52. stabilize(): void;
  53. renderWithCypher(query: string): void;
  54. updateWithCypher(query: string): void;
  55. }
  56. export default Neovis;