Skip to content

Commit ce11fc6

Browse files
committed
fully works
1 parent b2532ad commit ce11fc6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+527
-646
lines changed

__mocks__/neo4j-driver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const mockSession: jest.Mock<Partial<Neo4jType.Session>> = jest.fn().mock
2424
}));
2525

2626
export const mockDriver = jest.spyOn(Neo4j, 'driver').mockImplementation(() => ({
27-
session: mockSession as any
27+
session: mockSession as unknown as (...args: unknown[]) => Neo4jType.Session
2828
}) as Neo4jType.Driver);
2929

3030
export function clearAllMocks(): void {

__tests__/neovis.tests.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,10 @@ describe('Neovis', () => {
397397
container_id: container_id,
398398
labels: {
399399
[label1]: {
400-
400+
font: {
401+
size: intProperty,
402+
color: intProperty
403+
},
401404
}
402405
},
403406
initial_cypher: initial_cypher
@@ -423,7 +426,7 @@ describe('Neovis', () => {
423426
labels: {
424427
[label1]: {
425428
[NEOVIS_ADVANCED_CONFIG]: {
426-
'static': {
429+
static: {
427430
value: intPropertyValue
428431
}
429432
}

dist/neovis-without-dependencies.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/neovis-without-dependencies.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/neovis.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import type * as Neo4jTypes from 'neo4j-driver';
22
import { EventFunctionTypes, NeoVisEvents } from './events';
33
import type * as VisNetwork from 'vis-network';
44
import { Cypher, Edge, NEOVIS_DEFAULT_CONFIG, NeovisConfig, Node, NonFlatNeovisConfig, NumberOrInteger } from './types';
5-
export { NeoVisEvents } from './events';
5+
import { Font } from 'vis-network';
6+
export * from './events';
7+
export * from './types';
68
export declare class NeoVis {
79
#private;
810
/**
@@ -90,7 +92,7 @@ export interface OldLabelConfig {
9092
community?: string;
9193
sizeCypher?: string;
9294
image?: string;
93-
font?: any;
95+
font?: string | Font;
9496
title_properties?: string[];
9597
}
9698
/**

dist/neovis.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/neovis.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types.d.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,30 @@ import type * as VisNetwork from 'vis-network';
33
export declare const NEOVIS_DEFAULT_CONFIG: unique symbol;
44
export declare const NEOVIS_ADVANCED_CONFIG: unique symbol;
55
export declare type NumberOrInteger = number | Neo4jTypes.Integer;
6-
export declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
6+
export declare type RecursiveMapToDist<T, New> = T extends object ? RecursiveMapTo<T, New> : New;
77
/**
88
* Maps a type recursively and replace each non object type with the new type
99
* @param <T> type to map
1010
* @param <New> type to map to for each non object type
1111
*/
12-
export declare type RecursiveMapTo<T extends object, New> = {
13-
[P in keyof T]: T[P] extends object ? RecursiveMapTo<T[P], New> : New;
12+
export declare type RecursiveMapTo<T, New> = {
13+
[P in keyof T]: RecursiveMapToDist<T[P], New>;
1414
};
15+
export declare type RecursiveMapToFunctionDist<T, PARAM_TYPE> = T extends object ? ((param: PARAM_TYPE) => T) | (RecursiveMapToFunction<T, PARAM_TYPE>) : (param: PARAM_TYPE) => T;
1516
/**
1617
* Maps a type recursively and adds the ability for each object property to be a function that returns the same type
1718
* but replace each non object type with a function that returns the same type
1819
* @param <T> type to map
1920
* @param <PARAM_TYPE> type of parameter the functions get
2021
*/
21-
export declare type RecursiveMapToFunction<T extends object, PARAM_TYPE> = {
22-
[P in keyof T]: T[P] extends object ? ((param: PARAM_TYPE) => T[P]) | (RecursiveMapToFunction<T[P], PARAM_TYPE>) : (param: PARAM_TYPE) => T;
22+
export declare type RecursiveMapToFunction<T, PARAM_TYPE> = {
23+
[P in keyof T]: RecursiveMapToFunctionDist<T[P], PARAM_TYPE>;
2324
};
2425
/**
2526
* Cypher quarry
2627
*/
2728
export declare type Cypher = string;
28-
export interface NeoVisAdvanceConfig<VIS_TYPE extends object, NEO_TYPE> {
29+
export interface NeoVisAdvanceConfig<VIS_TYPE, NEO_TYPE> {
2930
/**
3031
* Static values that will the same for every node/relationship
3132
* */
@@ -36,10 +37,10 @@ export interface NeoVisAdvanceConfig<VIS_TYPE extends object, NEO_TYPE> {
3637
cypher?: RecursiveMapTo<VIS_TYPE, Cypher>;
3738
function?: RecursiveMapToFunction<VIS_TYPE, NEO_TYPE>;
3839
}
39-
export interface NonFlatNeoVisAdvanceConfig<VIS_TYPE extends object, NEO_TYPE> extends NeoVisAdvanceConfig<VIS_TYPE, NEO_TYPE> {
40+
export interface NonFlatNeoVisAdvanceConfig<VIS_TYPE, NEO_TYPE> extends NeoVisAdvanceConfig<VIS_TYPE, NEO_TYPE> {
4041
property?: RecursiveMapTo<VIS_TYPE, string>;
4142
}
42-
export declare type NeovisDataConfig<VIS_TYPE extends object, NEO_TYPE> = RecursiveMapTo<VIS_TYPE, string> & {
43+
export declare type NeovisDataConfig<VIS_TYPE, NEO_TYPE> = RecursiveMapTo<VIS_TYPE, string> & {
4344
[NEOVIS_ADVANCED_CONFIG]?: NeoVisAdvanceConfig<VIS_TYPE, NEO_TYPE>;
4445
};
4546
/**

docs/html/assets/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html><html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>EventController | neovis.js</title><meta name="description" content="Documentation for neovis.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">neovis.js</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">neovis.js</a></li><li><a href="EventController.html">EventController</a></li></ul><h1>Class EventController</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">EventController</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="EventController.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><a href="EventController.html#generateEvent" class="tsd-kind-icon">generate<wbr/>Event</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><a href="EventController.html#register" class="tsd-kind-icon">register</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"><a name="constructor" class="tsd-anchor"></a><h3>constructor</h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">new <wbr/>Event<wbr/>Controller<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="EventController.html" class="tsd-signature-type" data-tsd-kind="Class">EventController</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/thebestnom/neovis.js/blob/2890321/src/events.ts#L20">src/events.ts:20</a></li></ul></aside><h4 class="tsd-returns-title">Returns <a href="EventController.html" class="tsd-signature-type" data-tsd-kind="Class">EventController</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><a name="generateEvent" class="tsd-anchor"></a><h3>generate<wbr/>Event</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><li class="tsd-signature tsd-kind-icon">generate<wbr/>Event&lt;T&gt;<span class="tsd-signature-symbol">(</span>eventType<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span>, values<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/EventFunctionTypes.html" class="tsd-signature-type" data-tsd-kind="Interface">EventFunctionTypes</a><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">0</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/thebestnom/neovis.js/blob/2890321/src/events.ts#L47">src/events.ts:47</a></li></ul></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><h4>T<span class="tsd-signature-symbol">: </span><a href="../enums/NeoVisEvents.html" class="tsd-signature-type" data-tsd-kind="Enumeration">NeoVisEvents</a></h4></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>eventType: <span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
2+
<p>Type of the event generated</p>
3+
</div></div></li><li><h5>values: <span class="tsd-signature-type">Parameters</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/EventFunctionTypes.html" class="tsd-signature-type" data-tsd-kind="Interface">EventFunctionTypes</a><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">0</span><span class="tsd-signature-symbol">]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
4+
<p>Values associated to the event</p>
5+
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><a name="register" class="tsd-anchor"></a><h3>register</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><li class="tsd-signature tsd-kind-icon">register&lt;T&gt;<span class="tsd-signature-symbol">(</span>eventType<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span>, handler<span class="tsd-signature-symbol">: </span><a href="../interfaces/EventFunctionTypes.html" class="tsd-signature-type" data-tsd-kind="Interface">EventFunctionTypes</a><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/thebestnom/neovis.js/blob/2890321/src/events.ts#L34">src/events.ts:34</a></li></ul></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><h4>T<span class="tsd-signature-symbol">: </span><a href="../enums/NeoVisEvents.html" class="tsd-signature-type" data-tsd-kind="Enumeration">NeoVisEvents</a></h4></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>eventType: <span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
6+
<p>Type of the event to be handled</p>
7+
</div></div></li><li><h5>handler: <a href="../interfaces/EventFunctionTypes.html" class="tsd-signature-type" data-tsd-kind="Interface">EventFunctionTypes</a><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
8+
<p>Handler to manage the event</p>
9+
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="EventController.html" class="tsd-kind-icon">Event<wbr/>Controller</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="EventController.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><a href="EventController.html#generateEvent" class="tsd-kind-icon">generate<wbr/>Event</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><a href="EventController.html#register" class="tsd-kind-icon">register</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>

0 commit comments

Comments
 (0)