@neo4j-nvl/base 0.3.5-a90af4f2 → 0.3.5-aa37c3bf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.mjs +1 -1
- package/dist/base.mjs.LICENSE.txt +11 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/modules/NvlController.d.ts +1 -1
- package/dist/types/modules/state.d.ts +2 -0
- package/dist/types/types/graph-element.d.ts +8 -2
- package/dist/types/utils/jsDriverResultTransformer.d.ts +32 -0
- package/dist/types/utils/jsDriverResultTransformer.test.d.ts +1 -0
- package/package.json +7 -3
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* The buffer module from node.js, for the browser.
|
|
3
|
+
*
|
|
4
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
9
|
+
|
|
1
10
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
2
11
|
|
|
12
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
13
|
+
|
|
3
14
|
/**
|
|
4
15
|
* @license
|
|
5
16
|
* Lodash <https://lodash.com/>
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { Node, PartialNode, PartialRelationship, Relationship } from './typ
|
|
|
7
7
|
import { CompatibilityError } from './utils/errors';
|
|
8
8
|
import type { Point } from './utils/geometry';
|
|
9
9
|
import type { HitTargetNode, HitTargetRelationship, HitTargets } from './utils/hittest';
|
|
10
|
+
import { nvlResultTransformer } from './utils/jsDriverResultTransformer';
|
|
10
11
|
/**
|
|
11
12
|
* Extends the MouseEvent interface with the {@link HitTargets} property.
|
|
12
13
|
* The result of a _.{@link NVL.getHits} call.
|
|
@@ -185,7 +186,7 @@ declare class NVL {
|
|
|
185
186
|
* the zoom level will be set to the closest valid zoom level,
|
|
186
187
|
* even if the given nodes do not fit the viewport yet.
|
|
187
188
|
*/
|
|
188
|
-
fit(nodeIds: string[], zoomOptions
|
|
189
|
+
fit(nodeIds: string[], zoomOptions?: NvlState['zoomOptions']): void;
|
|
189
190
|
/**
|
|
190
191
|
* Resets the zoom of the viewport back to the default zoom level of 0.75
|
|
191
192
|
*/
|
|
@@ -363,4 +364,4 @@ declare const colorMapperFunctions: {
|
|
|
363
364
|
};
|
|
364
365
|
export default NVL;
|
|
365
366
|
export type { NvlOptions, Renderer, Node, Relationship, PartialNode, PartialRelationship, Layout, LayoutOptions, ForceDirectedOptions, HierarchicalOptions, ExternalCallbacks, HitTargets, HitTargetNode, HitTargetRelationship, Point, NvlMouseEvent, ZoomOptions, StyledCaption, WebGLRendererType, CanvasRendererType };
|
|
366
|
-
export { NVL, colorMapperFunctions, CompatibilityError, ForceDirectedLayoutType, HierarchicalLayoutType, GridLayoutType, FreeLayoutType, d3ForceLayoutType, drawCircleBand };
|
|
367
|
+
export { NVL, colorMapperFunctions, CompatibilityError, ForceDirectedLayoutType, HierarchicalLayoutType, GridLayoutType, FreeLayoutType, d3ForceLayoutType, drawCircleBand, nvlResultTransformer };
|
|
@@ -96,7 +96,7 @@ export default class NvlController {
|
|
|
96
96
|
setZoomLevel(_newLevel: number): void;
|
|
97
97
|
setPanCoordinates(panX: number, panY: number): void;
|
|
98
98
|
setZoomAndPan(zoom: number, panX: number, panY: number): void;
|
|
99
|
-
fit(nodeIds: string[], zoomOptions
|
|
99
|
+
fit(nodeIds: string[], zoomOptions?: ZoomOptions): void;
|
|
100
100
|
resetZoom(): void;
|
|
101
101
|
setRenderer(renderer: string): void;
|
|
102
102
|
on(name: keyof ExternalCallbacks, callback: (args: unknown) => void): void;
|
|
@@ -196,6 +196,8 @@ export type ZoomOptions = {
|
|
|
196
196
|
minZoom?: number;
|
|
197
197
|
/** The maximum zoom value for the fit-to-zoom operation. */
|
|
198
198
|
maxZoom?: number;
|
|
199
|
+
/** If true, will not animate the zoom/pan transition. */
|
|
200
|
+
animated?: boolean;
|
|
199
201
|
};
|
|
200
202
|
export interface NvlState {
|
|
201
203
|
zoom: number;
|
|
@@ -65,9 +65,15 @@ interface Node extends GraphElement {
|
|
|
65
65
|
size?: number;
|
|
66
66
|
/** Whether or not the current node is pinned.*/
|
|
67
67
|
pinned?: boolean;
|
|
68
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* @ignore
|
|
70
|
+
* The x-coordinate for the position of the node.
|
|
71
|
+
*/
|
|
69
72
|
x?: number;
|
|
70
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* @ignore
|
|
75
|
+
* The y-coordinate for the position of the node.
|
|
76
|
+
*/
|
|
71
77
|
y?: number;
|
|
72
78
|
/** Whether or not the current node is activated.*/
|
|
73
79
|
activated?: boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Node as DriverNode, Relationship as DriverRelationship, Path, Record } from 'neo4j-driver';
|
|
2
|
+
export declare const recordMapper: (record: Record) => any[];
|
|
3
|
+
export declare const recordCollector: (graphElements: (DriverNode | DriverRelationship | Path)[][]) => {
|
|
4
|
+
recordObjectMap: Map<any, any>;
|
|
5
|
+
nodes: any[];
|
|
6
|
+
relationships: any[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Result transformer for the Neo4j JavaScript driver results to NVL graph elements.
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import neo4j from "neo4j-driver";
|
|
14
|
+
* import { nvlResultTransformer, NVL } from "@neo4j-nvl/base";
|
|
15
|
+
*
|
|
16
|
+
* const driver = neo4j.driver("{uri}", neo4j.auth.basic("{user}", "{password}"));
|
|
17
|
+
* const nvlGraph = await driver.executeQuery(
|
|
18
|
+
* "MATCH (a)-[r]-(b) RETURN a,r,b LIMIT 25",
|
|
19
|
+
* {},
|
|
20
|
+
* { resultTransformer: nvlResultTransformer }
|
|
21
|
+
* );
|
|
22
|
+
*
|
|
23
|
+
* const nvl = new NVL(document.getElementById('viz'), nvlGraph.nodes, nvlGraph.relationships);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see {@link https://neo4j.com/docs/api/javascript-driver/current/class/lib6/result-transformers.js~ResultTransformers.html|ResultTransformers on Neo4j JS Driver API Docs}
|
|
27
|
+
*/
|
|
28
|
+
export declare const nvlResultTransformer: import("neo4j-driver-core/types/result-transformers").ResultTransformer<{
|
|
29
|
+
recordObjectMap: Map<any, any>;
|
|
30
|
+
nodes: any[];
|
|
31
|
+
relationships: any[];
|
|
32
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/base",
|
|
3
|
-
"version": "0.3.5-
|
|
3
|
+
"version": "0.3.5-aa37c3bf",
|
|
4
4
|
"license": "SEE LICENSE IN 'LICENSE.txt'",
|
|
5
5
|
"homepage": "https://neo4j.com/docs/nvl/current/",
|
|
6
6
|
"description": "Base library for the Neo4j Visualization Library",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"postpack": "rm LICENSE.txt"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@neo4j-nvl/layout-workers": "0.3.5-
|
|
31
|
+
"@neo4j-nvl/layout-workers": "0.3.5-aa37c3bf",
|
|
32
32
|
"@segment/analytics-next": "^1.70.0",
|
|
33
33
|
"color-string": "^1.9.1",
|
|
34
34
|
"d3-force": "^3.0.0",
|
|
@@ -50,9 +50,13 @@
|
|
|
50
50
|
"@types/tinycolor2": "^1.4.6",
|
|
51
51
|
"babel-loader": "^8.2.5",
|
|
52
52
|
"copy-webpack-plugin": "^11.0.0",
|
|
53
|
+
"neo4j-driver": "^5.26.0",
|
|
53
54
|
"typedoc": "^0.23.15",
|
|
54
55
|
"webpack": "^5.75.0",
|
|
55
56
|
"webpack-cli": "^5.0.0"
|
|
56
57
|
},
|
|
57
|
-
"stableVersion": "0.3.5"
|
|
58
|
+
"stableVersion": "0.3.5",
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"neo4j-driver": "*"
|
|
61
|
+
}
|
|
58
62
|
}
|