diff --git a/.circleci/config.yml b/.circleci/config.yml index ef33b03140..1e27994ebf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,7 +45,7 @@ jobs: # generate types - - run: ./node_modules/.bin/tsc + - run: npm run types # run tests! - run: sudo npm install -g istanbul codecov @@ -73,7 +73,7 @@ jobs: git config user.name "ci-build" - run: name: Create docs with jsdoc - command: jsdoc ./src -r -d ./docs -R ./README.md + command: npm run docs - run: name: Deploy docs to gh-pages branch command: gh-pages --dist ./docs --branch master --dest ./docs --message "[skip ci] Updates" diff --git a/docs/Edge.html b/docs/Edge.html index f46a99082e..6e8e605fb3 100644 --- a/docs/Edge.html +++ b/docs/Edge.html @@ -215,7 +215,7 @@
Parameters:
Source:
@@ -321,7 +321,7 @@
Parameters:
-int +number @@ -331,7 +331,7 @@
Parameters:
- + (integer) @@ -372,7 +372,7 @@
Parameters:
Source:
@@ -456,7 +456,7 @@

toStringSource:
@@ -512,13 +512,13 @@
Returns:

- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/docs/Graph.html b/docs/Graph.html index 365f5936b5..d266e66d3d 100644 --- a/docs/Graph.html +++ b/docs/Graph.html @@ -132,7 +132,7 @@
Parameters:
string | -RedisClient +redis.RedisClient @@ -152,7 +152,7 @@
Parameters:
- Redis host or node_redis client + Redis host or node_redis client TODO RedisClient @@ -168,7 +168,7 @@
Parameters:
string | -int +number @@ -188,7 +188,7 @@
Parameters:
- Redis port + Redis port (integer) @@ -201,7 +201,7 @@
Parameters:
-ClientOpts +Object @@ -262,7 +262,7 @@
Parameters:
Source:
@@ -420,7 +420,7 @@
Parameters:
Source:
@@ -579,7 +579,7 @@
Parameters:
Source:
@@ -637,7 +637,7 @@
Returns:
-

callProcedure(procedure, argsopt, yopt) → {ResultSet}

+

callProcedure(procedure, argsopt, yopt) → {Promise.<ResultSet>}

@@ -814,7 +814,7 @@
Parameters:
Source:
@@ -854,7 +854,7 @@
Returns:
-ResultSet +Promise.<ResultSet>
@@ -924,7 +924,7 @@

closeSource:
@@ -960,7 +960,7 @@

close(async) deleteGraph() → {ResultSet}

+

(async) deleteGraph() → {Promise.<ResultSet>}

@@ -1012,7 +1012,7 @@

(async) de
Source:
@@ -1052,7 +1052,7 @@

Returns:
-ResultSet +Promise.<ResultSet>
@@ -1070,7 +1070,7 @@
Returns:
-

(async) fetchAndGetLabel(id) → {string}

+

(async) fetchAndGetLabel(id) → {Promise.<string>}

@@ -1120,7 +1120,7 @@
Parameters:
-int +number @@ -1130,7 +1130,7 @@
Parameters:
- internal ID of label. + internal ID of label. (integer) @@ -1171,7 +1171,7 @@
Parameters:
Source:
@@ -1211,7 +1211,7 @@
Returns:
-string +Promise.<string>
@@ -1229,7 +1229,7 @@
Returns:
-

(async) fetchAndGetProperty(id) → {string}

+

(async) fetchAndGetProperty(id) → {Promise.<string>}

@@ -1279,7 +1279,7 @@
Parameters:
-int +number @@ -1289,7 +1289,7 @@
Parameters:
- internal ID of property. + internal ID of property. (integer) @@ -1330,7 +1330,7 @@
Parameters:
Source:
@@ -1370,7 +1370,7 @@
Returns:
-string +Promise.<string>
@@ -1388,7 +1388,7 @@
Returns:
-

(async) fetchAndGetRelationship(id) → {string}

+

(async) fetchAndGetRelationship(id) → {Promise.<string>}

@@ -1438,7 +1438,7 @@
Parameters:
-int +number @@ -1448,7 +1448,7 @@
Parameters:
- internal ID of relationship type. + internal ID of relationship type. (integer) @@ -1489,7 +1489,7 @@
Parameters:
Source:
@@ -1529,7 +1529,7 @@
Returns:
-string +Promise.<string>
@@ -1597,7 +1597,7 @@
Parameters:
-int +number @@ -1607,7 +1607,7 @@
Parameters:
- internal ID of label. + internal ID of label. (integer) @@ -1648,7 +1648,7 @@
Parameters:
Source:
@@ -1756,7 +1756,7 @@
Parameters:
-int +number @@ -1766,7 +1766,7 @@
Parameters:
- internal ID of property. + internal ID of property. (integer) @@ -1807,7 +1807,7 @@
Parameters:
Source:
@@ -1865,7 +1865,7 @@
Returns:
-

getRelationship(id)

+

getRelationship(id) → {string}

@@ -1915,7 +1915,7 @@
Parameters:
-int +number @@ -1925,7 +1925,7 @@
Parameters:
- internal ID of relationship type. + internal ID of relationship type. (integer) @@ -1966,7 +1966,7 @@
Parameters:
Source:
@@ -1995,11 +1995,23 @@
Returns:
- String relationship type. + relationship type.
+
+
+ Type +
+
+ +string + + +
+
+ @@ -2064,7 +2076,7 @@

(async) labels<
Source:
@@ -2150,7 +2162,7 @@

Parameters:
-object +* @@ -2201,7 +2213,7 @@
Parameters:
Source:
@@ -2311,7 +2323,7 @@

(async) p
Source:
@@ -2347,7 +2359,7 @@

(async) p -

(async) query(query, paramsopt) → {ResultSet}

+

(async) query(query, paramsopt) → {Promise.<ResultSet>}

@@ -2491,7 +2503,7 @@
Parameters:
Source:
@@ -2531,7 +2543,7 @@
Returns:
-ResultSet +Promise.<ResultSet>
@@ -2601,7 +2613,7 @@

(async) Source:
@@ -2647,13 +2659,13 @@

(async)
- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:04 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:32 GMT-0500 (Eastern Standard Time)
diff --git a/docs/Node.html b/docs/Node.html index 90aad1a7b2..1cc650b7c8 100644 --- a/docs/Node.html +++ b/docs/Node.html @@ -30,7 +30,7 @@

Class: Node

Node(label, properties)

-
A node within the garph.
+
A node within the graph.
@@ -169,7 +169,7 @@
Parameters:
Source:
@@ -275,7 +275,7 @@
Parameters:
-int +number @@ -285,7 +285,7 @@
Parameters:
- + (integer) @@ -326,7 +326,7 @@
Parameters:
Source:
@@ -410,7 +410,7 @@

toStringSource:
@@ -478,13 +478,13 @@
Returns:

- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:04 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:32 GMT-0500 (Eastern Standard Time)
diff --git a/docs/Path.html b/docs/Path.html index c50919ae2c..438067e17c 100644 --- a/docs/Path.html +++ b/docs/Path.html @@ -161,7 +161,7 @@
Parameters:
Source:
@@ -255,7 +255,7 @@

edgeCountSource:
@@ -317,7 +317,7 @@

EdgesSource:
@@ -379,7 +379,7 @@

firstNodeSource:
@@ -441,7 +441,7 @@

lastNodeSource:
@@ -503,7 +503,7 @@

nodeCountSource:
@@ -565,7 +565,7 @@

NodesSource:
@@ -643,7 +643,7 @@
Parameters:
-int +number @@ -653,7 +653,7 @@
Parameters:
- + (integer) @@ -694,7 +694,7 @@
Parameters:
Source:
@@ -802,7 +802,7 @@
Parameters:
-int +number @@ -812,7 +812,7 @@
Parameters:
- + (integer) @@ -853,7 +853,7 @@
Parameters:
Source:
@@ -963,7 +963,7 @@

toStringSource:
@@ -1031,13 +1031,13 @@
Returns:

- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:04 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:32 GMT-0500 (Eastern Standard Time)
diff --git a/docs/README b/docs/README deleted file mode 100644 index 8d1c8b69c3..0000000000 --- a/docs/README +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/Record.html b/docs/Record.html index 37df2efa8f..08c7a354e1 100644 --- a/docs/Record.html +++ b/docs/Record.html @@ -169,7 +169,7 @@
Parameters:
Source:
@@ -326,7 +326,7 @@
Parameters:
Source:
@@ -437,7 +437,7 @@
Parameters:
string | -int +number @@ -447,7 +447,7 @@
Parameters:
- + (integer) @@ -488,7 +488,7 @@
Parameters:
Source:
@@ -599,7 +599,7 @@
Parameters:
string | -int +number @@ -609,7 +609,7 @@
Parameters:
- + (integer) @@ -650,7 +650,7 @@
Parameters:
Source:
@@ -756,7 +756,7 @@

keysSource:
@@ -814,7 +814,7 @@
Returns:
-

size() → {int}

+

size() → {number}

@@ -862,7 +862,7 @@

sizeSource:
@@ -891,7 +891,7 @@
Returns:
- The amount of values in the record. + The amount of values in the record. (integer)
@@ -902,7 +902,7 @@
Returns:
-int +number
@@ -968,7 +968,7 @@

valuesSource:
@@ -1036,13 +1036,13 @@
Returns:

- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:04 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:32 GMT-0500 (Eastern Standard Time)
diff --git a/docs/ResultSet.html b/docs/ResultSet.html index 8ca5c05c06..167be55761 100644 --- a/docs/ResultSet.html +++ b/docs/ResultSet.html @@ -146,7 +146,7 @@
Parameters:
Source:
@@ -250,7 +250,7 @@

getHeaderSource:
@@ -356,7 +356,7 @@

getStati
Source:
@@ -462,7 +462,7 @@

hasNextSource:
@@ -568,7 +568,7 @@

nextSource:
@@ -626,7 +626,7 @@
Returns:
-

(async) parseArray(rawArray) → {Array.<object>}

+

(async) parseArray(rawArray) → {Promise.<Array.<object>>}

@@ -727,7 +727,7 @@
Parameters:
Source:
@@ -767,7 +767,7 @@
Returns:
-Array.<object> +Promise.<Array.<object>>
@@ -785,7 +785,7 @@
Returns:
-

(async) parseEdge(cell) → {Edge}

+

(async) parseEdge(cell) → {Promise.<Edge>}

@@ -886,7 +886,7 @@
Parameters:
Source:
@@ -926,7 +926,7 @@
Returns:
-Edge +Promise.<Edge>
@@ -944,7 +944,7 @@
Returns:
-

(async) parseEntityProperties(props) → {Map}

+

(async) parseEntityProperties(props) → {Promise.<object>}

@@ -1045,7 +1045,7 @@
Parameters:
Source:
@@ -1085,7 +1085,7 @@
Returns:
-Map +Promise.<object>
@@ -1206,7 +1206,7 @@
Parameters:
Source:
@@ -1242,7 +1242,7 @@
Parameters:
-

(async) parseMap(rawMap) → {Map}

+

(async) parseMap(rawMap) → {Promise.<object>}

@@ -1343,7 +1343,7 @@
Parameters:
Source:
@@ -1383,7 +1383,7 @@
Returns:
-Map +Promise.<object>
@@ -1401,7 +1401,7 @@
Returns:
-

(async) parseNode(cell) → {Node}

+

(async) parseNode(cell) → {Promise.<Node>}

@@ -1502,7 +1502,7 @@
Parameters:
Source:
@@ -1542,7 +1542,7 @@
Returns:
-Node +Promise.<Node>
@@ -1560,7 +1560,7 @@
Returns:
-

(async) parsePath(rawPath) → {Path}

+

(async) parsePath(rawPath) → {Promise.<Path>}

@@ -1661,7 +1661,7 @@
Parameters:
Source:
@@ -1701,7 +1701,7 @@
Returns:
-Path +Promise.<Path>
@@ -1821,7 +1821,7 @@
Parameters:
Source:
@@ -1959,7 +1959,7 @@
Parameters:
Source:
@@ -2096,7 +2096,7 @@
Parameters:
Source:
@@ -2132,7 +2132,7 @@
Parameters:
-

(async) parseScalar(cell) → {object}

+

(async) parseScalar(cell) → {Promise.<object>}

@@ -2233,7 +2233,7 @@
Parameters:
Source:
@@ -2273,7 +2273,7 @@
Returns:
-object +Promise.<object>
@@ -2291,7 +2291,7 @@
Returns:
-

size() → {int}

+

size() → {number}

@@ -2339,7 +2339,7 @@

sizeSource:
@@ -2368,7 +2368,7 @@
Returns:
- Result set size. + Result set size. (integer)
@@ -2379,7 +2379,7 @@
Returns:
-int +number
@@ -2407,13 +2407,13 @@
Returns:

- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:04 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:32 GMT-0500 (Eastern Standard Time)
diff --git a/docs/Statistics.html b/docs/Statistics.html index ae667f3674..7e45f3d0a0 100644 --- a/docs/Statistics.html +++ b/docs/Statistics.html @@ -142,7 +142,7 @@
Parameters:
Source:
@@ -246,7 +246,7 @@

cached
Source:
@@ -304,325 +304,7 @@

Returns:
-

getFloatValue(label) → {float}

- - - - - - -
- Returns the float value of a requested label. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -Label - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- The actual value if exists, 0 otherwise. -
- - - -
-
- Type -
-
- -float - - -
-
- - - - - - - - - - - - - -

getIntValue(label) → {int}

- - - - - - -
- Returns the integer value of a requested label. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -Label - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- The actual value if exists, 0 otherwise. -
- - - -
-
- Type -
-
- -int - - -
-
- - - - - - - - - - - - - -

getStatistics() → {Statistics}

+

getStatistics() → {Object.<string, string>}

@@ -674,7 +356,7 @@

getStati
Source:
@@ -714,7 +396,7 @@

Returns:
-Statistics +Object.<string, string>
@@ -732,144 +414,7 @@
Returns:
-

getStringValue(label)

- - - - - - -
- Returns a statistics value according to the statistics label. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
label - - -Label - - - - Statistics label.
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

indicesCreated() → {int}

+

indicesCreated() → {number}

@@ -917,7 +462,7 @@

indices
Source:
@@ -946,7 +491,7 @@

Returns:
- The amount of indices created by the query. + The amount of indices created by the query. (integer)
@@ -957,7 +502,7 @@
Returns:
-int +number
@@ -975,7 +520,7 @@
Returns:
-

indicesDeleted() → {int}

+

indicesDeleted() → {number}

@@ -1023,7 +568,7 @@

indices
Source:
@@ -1052,7 +597,7 @@

Returns:
- The amount of indices deleted by the query. + The amount of indices deleted by the query. (integer)
@@ -1063,7 +608,7 @@
Returns:
-int +number
@@ -1081,7 +626,7 @@
Returns:
-

labelsAdded() → {int}

+

labelsAdded() → {number}

@@ -1129,7 +674,7 @@

labelsAdde
Source:
@@ -1158,7 +703,7 @@

Returns:
- The amount of labels created by the query. + The amount of labels created by the query. (integer)
@@ -1169,7 +714,7 @@
Returns:
-int +number
@@ -1187,7 +732,7 @@
Returns:
-

nodesCreated() → {int}

+

nodesCreated() → {number}

@@ -1235,7 +780,7 @@

nodesCrea
Source:
@@ -1264,7 +809,7 @@

Returns:
- The amount of nodes created by th query. + The amount of nodes created by th query. (integer)
@@ -1275,7 +820,7 @@
Returns:
-int +number
@@ -1293,7 +838,7 @@
Returns:
-

nodesDeleted() → {int}

+

nodesDeleted() → {number}

@@ -1341,7 +886,7 @@

nodesDele
Source:
@@ -1370,7 +915,7 @@

Returns:
- The amount of nodes deleted by the query. + The amount of nodes deleted by the query. (integer)
@@ -1381,7 +926,7 @@
Returns:
-int +number
@@ -1399,7 +944,7 @@
Returns:
-

propertiesSet() → {int}

+

propertiesSet() → {number}

@@ -1447,7 +992,7 @@

properti
Source:
@@ -1476,7 +1021,7 @@

Returns:
- The amount of properties set by the query. + The amount of properties set by the query. (integer)
@@ -1487,7 +1032,7 @@
Returns:
-int +number
@@ -1505,7 +1050,7 @@
Returns:
-

queryExecutionTime() → {float}

+

queryExecutionTime() → {number}

@@ -1553,7 +1098,7 @@

que
Source:
@@ -1593,7 +1138,7 @@

Returns:
-float +number
@@ -1611,7 +1156,7 @@
Returns:
-

relationshipsCreated() → {int}

+

relationshipsCreated() → {number}

@@ -1659,7 +1204,7 @@

r
Source:
@@ -1688,7 +1233,7 @@

Returns:
- The amount of relationships created by the query. + The amount of relationships created by the query. (integer)
@@ -1699,7 +1244,7 @@
Returns:
-int +number
@@ -1717,7 +1262,7 @@
Returns:
-

relationshipsDeleted() → {int}

+

relationshipsDeleted() → {number}

@@ -1765,7 +1310,7 @@

r
Source:
@@ -1794,7 +1339,7 @@

Returns:
- The amount of relationships deleted by the query. + The amount of relationships deleted by the query. (integer)
@@ -1805,7 +1350,7 @@
Returns:
-int +number
@@ -1833,13 +1378,13 @@
Returns:

- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:04 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:32 GMT-0500 (Eastern Standard Time)
diff --git a/docs/edge.js.html b/docs/edge.js.html index 3be52dd1d1..4394deccf3 100644 --- a/docs/edge.js.html +++ b/docs/edge.js.html @@ -27,13 +27,17 @@

Source: edge.js

"use strict";
+
+/**
+ * @typedef {import('./node')} Node
+ */
+
 /**
  * An edge connecting two nodes.
  */
 class Edge {
     /**
      * Builds an Edge object.
-     * @constructor
      * @param {Node} srcNode - Source node of the edge.
      * @param {string} relation - Relationship type of the edge.
      * @param {Node} destNode - Destination node of the edge.
@@ -49,7 +53,7 @@ 

Source: edge.js

/** * Sets the edge ID. - * @param {int} id + * @param {number} id (integer) */ setId(id) { this.id = id; @@ -74,13 +78,13 @@

Source: edge.js


- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/docs/global.html b/docs/global.html index a955408722..510847a8d9 100644 --- a/docs/global.html +++ b/docs/global.html @@ -98,7 +98,7 @@

Members

-

Label

+

(readonly) Label :string

@@ -109,6 +109,555 @@

LabelType:

+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(constant) ResultSetColumnTypes :number

+ + + + + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
COLUMN_UNKNOWN + + +number + + + +
COLUMN_SCALAR + + +number + + + +
COLUMN_NODE + + +number + + + +
COLUMN_RELATION + + +number + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(constant) ResultSetValueTypes :number

+ + + + + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
VALUE_UNKNOWN + + +number + + + +
VALUE_NULL + + +number + + + +
VALUE_STRING + + +number + + + +
VALUE_INTEGER + + +number + + + +
VALUE_BOOLEAN + + +number + + + +
VALUE_DOUBLE + + +number + + + +
VALUE_ARRAY + + +number + + + +
VALUE_EDGE + + +number + + + +
VALUE_NODE + + +number + + + +
VALUE_PATH + + +number + + + +
VALUE_MAP + + +number + + + +
@@ -142,7 +691,7 @@

LabelSource:
@@ -176,13 +725,13 @@

Label
- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/docs/graph.js.html b/docs/graph.js.html index f2eaa07f98..83d7b10544 100644 --- a/docs/graph.js.html +++ b/docs/graph.js.html @@ -27,7 +27,9 @@

Source: graph.js

"use strict";
+
 const redis = require("redis"),
+	// @ts-ignore
 	util = require("util"),
 	ResultSet = require("./resultSet");
 
@@ -40,9 +42,9 @@ 

Source: graph.js

* See: node_redis for more options on createClient * * @param {string} graphId the graph id - * @param {string | RedisClient} [host] Redis host or node_redis client - * @param {string | int} [port] Redis port - * @param {ClientOpts} [options] node_redis options + * @param {string | redis.RedisClient} [host] Redis host or node_redis client TODO RedisClient + * @param {string | number} [port] Redis port (integer) + * @param {Object} [options] node_redis options */ constructor(graphId, host, port, options) { this._graphId = graphId; // Graph ID @@ -83,7 +85,7 @@

Source: graph.js

/** * Transforms a parameter value to string. - * @param {object} paramValue + * @param {*} paramValue * @returns {string} the string representation of paramValue. */ paramToString(paramValue) { @@ -128,7 +130,7 @@

Source: graph.js

* @async * @param {string} query Cypher query * @param {Map} [params] Parameters map - * @returns {ResultSet} a promise contains a result set + * @returns {Promise<ResultSet>} a promise contains a result set */ async query(query, params) { if (params) { @@ -146,7 +148,7 @@

Source: graph.js

/** * Deletes the entire graph * @async - * @returns {ResultSet} a promise contains the delete operation running time statistics + * @returns {Promise<ResultSet>} a promise contains the delete operation running time statistics */ async deleteGraph() { var res = await this._sendCommand("graph.DELETE", [this._graphId]); @@ -163,7 +165,7 @@

Source: graph.js

* @param {string} procedure Procedure to call * @param {string[]} [args] Arguments to pass * @param {string[]} [y] Yield outputs - * @returns {ResultSet} a promise contains the procedure result set data + * @returns {Promise<ResultSet>} a promise contains the procedure result set data */ callProcedure(procedure, args = new Array(), y = new Array()) { let q = "CALL " + procedure + "(" + args.join(",") + ")" + y.join(" "); @@ -226,7 +228,7 @@

Source: graph.js

/** * Retrieves label by ID. - * @param {int} id internal ID of label. + * @param {number} id internal ID of label. (integer) * @returns {string} String label. */ getLabel(id) { @@ -236,8 +238,8 @@

Source: graph.js

/** * Retrieve all the labels from the graph and returns the wanted label * @async - * @param {int} id internal ID of label. - * @returns {string} String label. + * @param {number} id internal ID of label. (integer) + * @returns {Promise<string>} String label. */ async fetchAndGetLabel(id) { await this.labels(); @@ -246,8 +248,8 @@

Source: graph.js

/** * Retrieves relationship type by ID. - * @param {int} id internal ID of relationship type. - * @return String relationship type. + * @param {number} id internal ID of relationship type. (integer) + * @returns {string} relationship type. */ getRelationship(id) { return this._relationshipTypes[id]; @@ -256,8 +258,8 @@

Source: graph.js

/** * Retrieves al the relationships types from the graph, and returns the wanted type * @async - * @param {int} id internal ID of relationship type. - * @returns {string} String relationship type. + * @param {number} id internal ID of relationship type. (integer) + * @returns {Promise<string>} String relationship type. */ async fetchAndGetRelationship(id) { await this.relationshipTypes(); @@ -266,7 +268,7 @@

Source: graph.js

/** * Retrieves property name by ID. - * @param {int} id internal ID of property. + * @param {number} id internal ID of property. (integer) * @returns {string} String property. */ getProperty(id) { @@ -275,9 +277,9 @@

Source: graph.js

/** * Retrieves al the properties from the graph, and returns the wanted property - * @async - * @param {int} id internal ID of property. - * @returns {string} String property. + * @asyncTODO + * @param {number} id internal ID of property. (integer) + * @returns {Promise<string>} String property. */ async fetchAndGetProperty(id) { await this.propertyKeys(); @@ -296,13 +298,13 @@

Source: graph.js


- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/docs/index.html b/docs/index.html index c51eb37e60..45c451b13a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -119,13 +119,13 @@

License


- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/docs/label.js.html b/docs/label.js.html index 1a677128b1..4c5405dba8 100644 --- a/docs/label.js.html +++ b/docs/label.js.html @@ -27,8 +27,11 @@

Source: label.js

"use strict";
+
 /**
  * Different Statistics labels
+ * @readonly
+ * @enum {string}
  */
 var Label = Object.freeze({
 	LABELS_ADDED: "Labels added",
@@ -54,13 +57,13 @@ 

Source: label.js


- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/docs/node.js.html b/docs/node.js.html index 3beeb1d796..5beb75c29c 100644 --- a/docs/node.js.html +++ b/docs/node.js.html @@ -27,13 +27,14 @@

Source: node.js

"use strict";
+
 /**
- * A node within the garph.
+ * A node within the graph.
  */
 class Node {
     /**
      * Builds a node object.
-     * @constructor
+	 *
      * @param {string} label - node label.
      * @param {Map} properties - properties map.
      */
@@ -45,7 +46,7 @@ 

Source: node.js

/** * Sets the node id. - * @param {int} id + * @param {number} id (integer) */ setId(id) { this.id = id; @@ -70,13 +71,13 @@

Source: node.js


- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/docs/path.js.html b/docs/path.js.html index 03d7bbd318..e12949658f 100644 --- a/docs/path.js.html +++ b/docs/path.js.html @@ -27,9 +27,17 @@

Source: path.js

"use strict";
+
+/**
+ * @typedef {import('./node')} Node
+ */
+
+/**
+ * @typedef {import('./edge')} Edge
+ */
+
 class Path {
     /**
-     * @constructor
      * @param {Node[]} nodes - path's node list.
      * @param {Edge[]} edges - path's edge list.
      */
@@ -56,7 +64,7 @@ 

Source: path.js

/** * Returns a node in a given index. - * @param {int} index + * @param {number} index (integer) * @returns {Node} node in the given index. */ getNode(index) { @@ -65,7 +73,7 @@

Source: path.js

/** * Returns an edge in a given index. - * @param {int} index + * @param {number} index (integer) * @returns {Edge} edge in a given index. */ getEdge(index) { @@ -90,7 +98,7 @@

Source: path.js

/** * Returns the amount of nodes in th path. - * @returns {int} amount of nodes. + * @returns {number} amount of nodes. (integer) */ get nodeCount() { return this.nodes.length; @@ -98,7 +106,7 @@

Source: path.js

/** * Returns the amount of edges in the path. - * @returns {int} amount of edges. + * @returns {number} amount of edges. (integer) */ get edgeCount() { return this.edges.length; @@ -124,13 +132,13 @@

Source: path.js


- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/docs/record.js.html b/docs/record.js.html index b5f168fecf..94d02e2a17 100644 --- a/docs/record.js.html +++ b/docs/record.js.html @@ -27,13 +27,14 @@

Source: record.js

"use strict";
+
 /**
  * Hold a query record
  */
 class Record {
     /**
      * Builds a Record object
-     * @constructor
+	 *
      * @param {string[]} header 
      * @param {object[]} values 
      */
@@ -44,7 +45,7 @@ 

Source: record.js

/** * Returns a value of the given schema key or in the given position. - * @param {string | int} key + * @param {string | number} key (integer) * @returns {object} Requested value. */ get(key) { @@ -57,7 +58,7 @@

Source: record.js

/** * Returns a string representation for the value of the given schema key or in the given position. - * @param {string | int} key + * @param {string | number} key (integer) * @returns {string} Requested string representation of the value. */ getString(key) { @@ -98,7 +99,7 @@

Source: record.js

} /** - * @returns {int} The amount of values in the record. + * @returns {number} The amount of values in the record. (integer) */ size() { return this._header.length; @@ -116,13 +117,13 @@

Source: record.js


- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/docs/resultSet.js.html b/docs/resultSet.js.html index 8772a3729e..6f85663082 100644 --- a/docs/resultSet.js.html +++ b/docs/resultSet.js.html @@ -27,6 +27,11 @@

Source: resultSet.js

"use strict";
+
+/**
+ * @typedef {import('./graph')} Graph
+ */
+
 const Statistics = require("./statistics"),
 	Record = require("./record"),
 	Node = require("./node"),
@@ -34,6 +39,10 @@ 

Source: resultSet.js

Path = require("./path"), ReplyError = require("redis").ReplyError; +/** + * @enum {number} + * @readonly + */ const ResultSetColumnTypes = { COLUMN_UNKNOWN: 0, COLUMN_SCALAR: 1, @@ -41,6 +50,10 @@

Source: resultSet.js

COLUMN_RELATION: 3, }; +/** + * @enum {number} + * @readonly + */ const ResultSetValueTypes = { VALUE_UNKNOWN: 0, VALUE_NULL: 1, @@ -61,7 +74,7 @@

Source: resultSet.js

class ResultSet { /** * Builds an empty ResultSet object. - * @constructor + * * @param {Graph} graph */ constructor(graph) { @@ -160,7 +173,7 @@

Source: resultSet.js

* Parse raw entity properties representation into a Map * @async * @param {object[]} props raw properties representation - * @returns {Map} Map with the parsed properties. + * @returns {Promise<object>} Map with the parsed properties. */ async parseEntityProperties(props) { // [[name, value, value type] X N] @@ -191,7 +204,7 @@

Source: resultSet.js

* Parse raw node representation into a Node object. * @async * @param {object[]} cell raw node representation. - * @returns {Node} Node object. + * @returns {Promise<Node>} Node object. */ async parseNode(cell) { // Node ID (integer), @@ -221,7 +234,7 @@

Source: resultSet.js

* Parse a raw edge representation into an Edge object. * @async * @param {object[]} cell raw edge representation - * @returns {Edge} Edge object. + * @returns {Promise<Edge>} Edge object. */ async parseEdge(cell) { // Edge ID (integer), @@ -256,7 +269,7 @@

Source: resultSet.js

* Parse and in-place replace raw array into an array of values or objects. * @async * @param {object[]} rawArray raw array representation - * @returns {object[]} Parsed array. + * @returns {Promise<object[]>} Parsed array. */ async parseArray(rawArray) { for (var i = 0; i < rawArray.length; i++) { @@ -269,7 +282,7 @@

Source: resultSet.js

* Parse a raw path representation into Path object. * @async * @param {object[]} rawPath raw path representation - * @returns {Path} Path object. + * @returns {Promise<Path>} Path object. */ async parsePath(rawPath) { let nodes = await this.parseScalar(rawPath[0]); @@ -281,7 +294,7 @@

Source: resultSet.js

* Parse a raw map representation into Map object. * @async * @param {object[]} rawMap raw map representation - * @returns {Map} Map object. + * @returns {Promise<object>} Map object. */ async parseMap(rawMap) { let m = {}; @@ -297,7 +310,7 @@

Source: resultSet.js

* Parse a raw value into its actual value. * @async * @param {object[]} cell raw value representation - * @returns {object} Actual value - scalar, array, Node, Edge, Path + * @returns {Promise<object>} Actual value - scalar, array, Node, Edge, Path */ async parseScalar(cell) { let scalar_type = cell[0]; @@ -377,7 +390,7 @@

Source: resultSet.js

} /** - * @returns {int} Result set size. + * @returns {number} Result set size. (integer) */ size() { return this._resultsCount; @@ -395,13 +408,13 @@

Source: resultSet.js


- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/docs/statistics.js.html b/docs/statistics.js.html index 607db84675..11397568f6 100644 --- a/docs/statistics.js.html +++ b/docs/statistics.js.html @@ -27,6 +27,7 @@

Source: statistics.js

"use strict";
+
 const Label = require("./label");
 
 class Statistics {
@@ -41,7 +42,7 @@ 

Source: statistics.js

/** * Returns a statistics value according to the statistics label. - * @param {Label} label - Statistics label. + * @param {import('./label')} label - Statistics label. */ getStringValue(label) { return this.getStatistics()[label]; @@ -49,7 +50,7 @@

Source: statistics.js

/** * Return the query statistics - * @return {Statistics} statistics object + * @return {Object<string, string>} statistics object */ getStatistics() { if (!this._statistics) { @@ -64,8 +65,8 @@

Source: statistics.js

/** * Returns the integer value of a requested label. - * @param {Label} label - * @returns {int} The actual value if exists, 0 otherwise. + * @param {import('./label')} label + * @returns {number} The actual value if exists, 0 otherwise. (integer) */ getIntValue(label) { let value = this.getStringValue(label); @@ -74,8 +75,8 @@

Source: statistics.js

/** * Returns the float value of a requested label. - * @param {Label} label - * @returns {float} The actual value if exists, 0 otherwise. + * @param {import('./label')} label + * @returns {number} The actual value if exists, 0 otherwise. */ getFloatValue(label) { let value = this.getStringValue(label); @@ -83,56 +84,56 @@

Source: statistics.js

} /** - * @returns {int} The amount of nodes created by th query. + * @returns {number} The amount of nodes created by th query. (integer) */ nodesCreated() { return this.getIntValue(Label.NODES_CREATED); } /** - * @returns {int} The amount of nodes deleted by the query. + * @returns {number} The amount of nodes deleted by the query. (integer) */ nodesDeleted() { return this.getIntValue(Label.NODES_DELETED); } /** - * @returns {int} The amount of labels created by the query. + * @returns {number} The amount of labels created by the query. (integer) */ labelsAdded() { return this.getIntValue(Label.LABELS_ADDED); } /** - * @returns {int} The amount of relationships deleted by the query. + * @returns {number} The amount of relationships deleted by the query. (integer) */ relationshipsDeleted() { return this.getIntValue(Label.RELATIONSHIPS_DELETED); } /** - * @returns {int} The amount of relationships created by the query. + * @returns {number} The amount of relationships created by the query. (integer) */ relationshipsCreated() { return this.getIntValue(Label.RELATIONSHIPS_CREATED); } /** - * @returns {int} The amount of properties set by the query. + * @returns {number} The amount of properties set by the query. (integer) */ propertiesSet() { return this.getIntValue(Label.PROPERTIES_SET); } /** - * @returns {int} The amount of indices created by the query. + * @returns {number} The amount of indices created by the query. (integer) */ indicesCreated() { return this.getIntValue(Label.INDICES_CREATED); } /** - * @returns {int} The amount of indices deleted by the query. + * @returns {number} The amount of indices deleted by the query. (integer) */ indicesDeleted() { return this.getIntValue(Label.INDICES_DELETED); @@ -146,7 +147,7 @@

Source: statistics.js

} /** - * @returns {float} The query execution time in ms. + * @returns {number} The query execution time in ms. */ queryExecutionTime() { return this.getFloatValue(Label.QUERY_INTERNAL_EXECUTION_TIME); @@ -164,13 +165,13 @@

Source: statistics.js


- Documentation generated by JSDoc 3.6.6 on Mon Jan 25 2021 06:48:03 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 3.6.6 on Wed Feb 17 2021 14:48:31 GMT-0500 (Eastern Standard Time)
diff --git a/examples/package.json b/examples/package.json index e4bcb55f1c..c531f6ad11 100644 --- a/examples/package.json +++ b/examples/package.json @@ -11,5 +11,8 @@ "dependencies": { "redisgraph.js": "../" }, - "main": "redisGraphExample.js" + "main": "redisGraphExample.js", + "devDependencies": { + "@types/node": "^14.14.28" + } } diff --git a/examples/redisGraphExample.ts b/examples/redisGraphExample.ts new file mode 100644 index 0000000000..afc973c8b4 --- /dev/null +++ b/examples/redisGraphExample.ts @@ -0,0 +1,45 @@ +const RedisGraph = require("redisgraph.js").Graph; + +let graph = new RedisGraph("social"); + +try { + (async () => { + await graph.query("CREATE (:person{name:'roi',age:32})"); + await graph.query("CREATE (:person{name:'amit',age:30})"); + await graph.query( + "MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)" + ); + + // Match query. + let res = await graph.query( + "MATCH (a:person)-[:knows]->(:person) RETURN a.name" + ); + while (res.hasNext()) { + let record = res.next(); + console.log(record.get("a.name")); + } + console.log(res.getStatistics().queryExecutionTime()); + + // Match with parameters. + let param = { age: 30 }; + res = await graph.query("MATCH (a {age: $age}) return a.name", param); + while (res.hasNext()) { + let record = res.next(); + console.log(record.get("a.name")); + } + + // Named paths matching. + res = await graph.query( + "MATCH p = (a:person)-[:knows]->(:person) RETURN p" + ); + while (res.hasNext()) { + let record = res.next(); + // See path.js for more path API. + console.log(record.get("p").nodeCount); + } + graph.deleteGraph(); + graph.close(); + })(); +} catch (err) { + console.log(err); +} diff --git a/jsdoc.conf.json b/jsdoc.conf.json new file mode 100644 index 0000000000..a073de315c --- /dev/null +++ b/jsdoc.conf.json @@ -0,0 +1,6 @@ +{ + "plugins": ["jsdoc-ts-utils"], + "tsUtils": { + "typeScriptUtilityTypes": false + } +} diff --git a/package.json b/package.json index e001e8a86b..4383b11a90 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,14 @@ "redis": "^3.0.2" }, "devDependencies": { + "jsdoc-ts-utils": "^1.1.2", "mocha": "^7.0.1", "typescript": "^4.1.5" }, "scripts": { - "test": "mocha --exit" + "test": "mocha --exit", + "types": "tsc", + "docs": "jsdoc -c jsdoc.conf.json ./src -r -d ./docs -R ./README.md" }, "main": "index.js", "types": "./types" diff --git a/src/edge.js b/src/edge.js index da769ffc72..4d950b62d6 100644 --- a/src/edge.js +++ b/src/edge.js @@ -1,14 +1,18 @@ "use strict"; -/* + +/** + * @typedef {import('./node')} Node + */ + +/** * An edge connecting two nodes. */ class Edge { /** * Builds an Edge object. - * @constructor - * @param {import('./node')} srcNode - Source node of the edge. + * @param {Node} srcNode - Source node of the edge. * @param {string} relation - Relationship type of the edge. - * @param {import('./node')} destNode - Destination node of the edge. + * @param {Node} destNode - Destination node of the edge. * @param {Map} properties - Properties map of the edge. */ constructor(srcNode, relation, destNode, properties) { diff --git a/src/graph.js b/src/graph.js index 929bf84c24..b9c1c4b23f 100644 --- a/src/graph.js +++ b/src/graph.js @@ -1,4 +1,5 @@ "use strict"; + const redis = require("redis"), // @ts-ignore util = require("util"), @@ -13,7 +14,7 @@ class Graph { * See: node_redis for more options on createClient * * @param {string} graphId the graph id - * @param {string | import('redis').RedisClient} [host] Redis host or node_redis client + * @param {string | redis.RedisClient} [host] Redis host or node_redis client * @param {string | number} [port] Redis port (integer) * @param {Object} [options] node_redis options */ @@ -43,7 +44,7 @@ class Graph { /** * Auxiliary function to extract string(s) data from procedures such as: * db.labels, db.propertyKeys and db.relationshipTypes - * @param {import('./resultSet')} resultSet - a procedure result set + * @param {ResultSet} resultSet - a procedure result set * @returns {string[]} strings array. */ _extractStrings(resultSet) { @@ -101,7 +102,7 @@ class Graph { * @async * @param {string} query Cypher query * @param {Map} [params] Parameters map - * @returns {Promise} a promise contains a result set + * @returns {Promise} a promise contains a result set */ async query(query, params) { if (params) { @@ -119,7 +120,7 @@ class Graph { /** * Deletes the entire graph * @async - * @returns {Promise} a promise contains the delete operation running time statistics + * @returns {Promise} a promise contains the delete operation running time statistics */ async deleteGraph() { var res = await this._sendCommand("graph.DELETE", [this._graphId]); @@ -136,7 +137,7 @@ class Graph { * @param {string} procedure Procedure to call * @param {string[]} [args] Arguments to pass * @param {string[]} [y] Yield outputs - * @returns {Promise} a promise contains the procedure result set data + * @returns {Promise} a promise contains the procedure result set data */ callProcedure(procedure, args = new Array(), y = new Array()) { let q = "CALL " + procedure + "(" + args.join(",") + ")" + y.join(" "); diff --git a/src/label.js b/src/label.js index fc8d32cd04..547115621c 100644 --- a/src/label.js +++ b/src/label.js @@ -1,4 +1,5 @@ "use strict"; + /** * Different Statistics labels * @readonly diff --git a/src/node.js b/src/node.js index ef17945d13..2541d5ce2b 100644 --- a/src/node.js +++ b/src/node.js @@ -1,11 +1,12 @@ "use strict"; + /** - * A node within the garph. + * A node within the graph. */ class Node { /** * Builds a node object. - * @constructor + * * @param {string} label - node label. * @param {Map} properties - properties map. */ diff --git a/src/path.js b/src/path.js index 7a7bfc36ef..23ca0894c3 100644 --- a/src/path.js +++ b/src/path.js @@ -1,9 +1,17 @@ "use strict"; + +/** + * @typedef {import('./node')} Node + */ + +/** + * @typedef {import('./edge')} Edge + */ + class Path { /** - * @constructor - * @param {import('./node')[]} nodes - path's node list. - * @param {import('./edge')[]} edges - path's edge list. + * @param {Node[]} nodes - path's node list. + * @param {Edge[]} edges - path's edge list. */ constructor(nodes, edges) { this.nodes = nodes; @@ -12,7 +20,7 @@ class Path { /** * Returns the path's nodes as list. - * @returns {import('./node')[]} path's nodes. + * @returns {Node[]} path's nodes. */ get Nodes() { return this.nodes; @@ -20,7 +28,7 @@ class Path { /** * Returns the path's edges as list. - * @returns {import('./edge')[]} paths' edges. + * @returns {Edge[]} paths' edges. */ get Edges() { return this.edges; @@ -29,7 +37,7 @@ class Path { /** * Returns a node in a given index. * @param {number} index (integer) - * @returns {import('./node')} node in the given index. + * @returns {Node} node in the given index. */ getNode(index) { return this.nodes[index]; @@ -38,7 +46,7 @@ class Path { /** * Returns an edge in a given index. * @param {number} index (integer) - * @returns {import('./edge')} edge in a given index. + * @returns {Edge} edge in a given index. */ getEdge(index) { return this.edges[index]; @@ -46,7 +54,7 @@ class Path { /** * Returns the path's first node. - * @returns {import('./node')} first node. + * @returns {Node} first node. */ get firstNode() { return this.nodes[0]; @@ -54,7 +62,7 @@ class Path { /** * Returns the last node of the path. - * @returns {import('./node')} last node. + * @returns {Node} last node. */ get lastNode() { return this.nodes[this.nodes.length - 1]; diff --git a/src/record.js b/src/record.js index d0d5b3da1b..8be18bd7bd 100644 --- a/src/record.js +++ b/src/record.js @@ -1,11 +1,12 @@ "use strict"; + /** * Hold a query record */ class Record { /** * Builds a Record object - * @constructor + * * @param {string[]} header * @param {object[]} values */ diff --git a/src/resultSet.js b/src/resultSet.js index d4a830eb64..7cc108f74c 100644 --- a/src/resultSet.js +++ b/src/resultSet.js @@ -1,4 +1,9 @@ "use strict"; + +/** + * @typedef {import('./graph')} Graph + */ + const Statistics = require("./statistics"), Record = require("./record"), Node = require("./node"), @@ -41,8 +46,8 @@ const ResultSetValueTypes = { class ResultSet { /** * Builds an empty ResultSet object. - * @constructor - * @param {import('./graph')} graph + * + * @param {Graph} graph */ constructor(graph) { this._graph = graph; //_graph is graph api @@ -171,7 +176,7 @@ class ResultSet { * Parse raw node representation into a Node object. * @async * @param {object[]} cell raw node representation. - * @returns {Promise} Node object. + * @returns {Promise} Node object. */ async parseNode(cell) { // Node ID (integer), @@ -201,7 +206,7 @@ class ResultSet { * Parse a raw edge representation into an Edge object. * @async * @param {object[]} cell raw edge representation - * @returns {Promise} Edge object. + * @returns {Promise} Edge object. */ async parseEdge(cell) { // Edge ID (integer), @@ -249,7 +254,7 @@ class ResultSet { * Parse a raw path representation into Path object. * @async * @param {object[]} rawPath raw path representation - * @returns {Promise} Path object. + * @returns {Promise} Path object. */ async parsePath(rawPath) { let nodes = await this.parseScalar(rawPath[0]); diff --git a/src/statistics.js b/src/statistics.js index 891b5685ec..4c89758c49 100644 --- a/src/statistics.js +++ b/src/statistics.js @@ -1,4 +1,5 @@ "use strict"; + const Label = require("./label"); class Statistics { diff --git a/types/src/edge.d.ts b/types/src/edge.d.ts index 56086f9d0f..2333d68c99 100644 --- a/types/src/edge.d.ts +++ b/types/src/edge.d.ts @@ -1,14 +1,19 @@ export = Edge; +/** + * @typedef {import('./node')} Node + */ +/** + * An edge connecting two nodes. + */ declare class Edge { /** * Builds an Edge object. - * @constructor - * @param {import('./node')} srcNode - Source node of the edge. + * @param {Node} srcNode - Source node of the edge. * @param {string} relation - Relationship type of the edge. - * @param {import('./node')} destNode - Destination node of the edge. + * @param {Node} destNode - Destination node of the edge. * @param {Map} properties - Properties map of the edge. */ - constructor(srcNode: import('./node'), relation: string, destNode: import('./node'), properties: Map); + constructor(srcNode: Node, relation: string, destNode: Node, properties: Map); id: number; relation: string; srcNode: import("./node"); @@ -24,3 +29,7 @@ declare class Edge { */ toString(): string; } +declare namespace Edge { + export { Node }; +} +type Node = import("./node"); diff --git a/types/src/graph.d.ts b/types/src/graph.d.ts index c152c00a2b..63ae5bce8b 100644 --- a/types/src/graph.d.ts +++ b/types/src/graph.d.ts @@ -8,11 +8,11 @@ declare class Graph { * See: node_redis for more options on createClient * * @param {string} graphId the graph id - * @param {string | import('redis').RedisClient} [host] Redis host or node_redis client + * @param {string | redis.RedisClient} [host] Redis host or node_redis client * @param {string | number} [port] Redis port (integer) * @param {Object} [options] node_redis options */ - constructor(graphId: string, host?: string | import('redis').RedisClient, port?: string | number, options?: any); + constructor(graphId: string, host?: string | any, port?: string | number, options?: any); _graphId: string; _labels: any[]; _relationshipTypes: any[]; @@ -29,10 +29,10 @@ declare class Graph { /** * Auxiliary function to extract string(s) data from procedures such as: * db.labels, db.propertyKeys and db.relationshipTypes - * @param {import('./resultSet')} resultSet - a procedure result set + * @param {ResultSet} resultSet - a procedure result set * @returns {string[]} strings array. */ - _extractStrings(resultSet: import('./resultSet')): string[]; + _extractStrings(resultSet: ResultSet): string[]; /** * Transforms a parameter value to string. * @param {*} paramValue @@ -50,23 +50,23 @@ declare class Graph { * @async * @param {string} query Cypher query * @param {Map} [params] Parameters map - * @returns {Promise} a promise contains a result set + * @returns {Promise} a promise contains a result set */ - query(query: string, params?: Map): Promise; + query(query: string, params?: Map): Promise; /** * Deletes the entire graph * @async - * @returns {Promise} a promise contains the delete operation running time statistics + * @returns {Promise} a promise contains the delete operation running time statistics */ - deleteGraph(): Promise; + deleteGraph(): Promise; /** * Calls procedure * @param {string} procedure Procedure to call * @param {string[]} [args] Arguments to pass * @param {string[]} [y] Yield outputs - * @returns {Promise} a promise contains the procedure result set data + * @returns {Promise} a promise contains the procedure result set data */ - callProcedure(procedure: string, args?: string[], y?: string[]): Promise; + callProcedure(procedure: string, args?: string[], y?: string[]): Promise; /** * Retrieves all labels in graph. * @async @@ -122,3 +122,4 @@ declare class Graph { */ fetchAndGetProperty(id: number): Promise; } +import ResultSet = require("./resultSet"); diff --git a/types/src/node.d.ts b/types/src/node.d.ts index 4115aae93a..354d540b68 100644 --- a/types/src/node.d.ts +++ b/types/src/node.d.ts @@ -1,11 +1,11 @@ export = Node; /** - * A node within the garph. + * A node within the graph. */ declare class Node { /** * Builds a node object. - * @constructor + * * @param {string} label - node label. * @param {Map} properties - properties map. */ diff --git a/types/src/path.d.ts b/types/src/path.d.ts index 0c54fcb982..57178effc0 100644 --- a/types/src/path.d.ts +++ b/types/src/path.d.ts @@ -1,43 +1,48 @@ export = Path; +/** + * @typedef {import('./node')} Node + */ +/** + * @typedef {import('./edge')} Edge + */ declare class Path { /** - * @constructor - * @param {import('./node')[]} nodes - path's node list. - * @param {import('./edge')[]} edges - path's edge list. + * @param {Node[]} nodes - path's node list. + * @param {Edge[]} edges - path's edge list. */ - constructor(nodes: import('./node')[], edges: import('./edge')[]); + constructor(nodes: Node[], edges: Edge[]); nodes: import("./node")[]; edges: import("./edge")[]; /** * Returns the path's nodes as list. - * @returns {import('./node')[]} path's nodes. + * @returns {Node[]} path's nodes. */ get Nodes(): import("./node")[]; /** * Returns the path's edges as list. - * @returns {import('./edge')[]} paths' edges. + * @returns {Edge[]} paths' edges. */ get Edges(): import("./edge")[]; /** * Returns a node in a given index. * @param {number} index (integer) - * @returns {import('./node')} node in the given index. + * @returns {Node} node in the given index. */ - getNode(index: number): import('./node'); + getNode(index: number): Node; /** * Returns an edge in a given index. * @param {number} index (integer) - * @returns {import('./edge')} edge in a given index. + * @returns {Edge} edge in a given index. */ - getEdge(index: number): import('./edge'); + getEdge(index: number): Edge; /** * Returns the path's first node. - * @returns {import('./node')} first node. + * @returns {Node} first node. */ get firstNode(): import("./node"); /** * Returns the last node of the path. - * @returns {import('./node')} last node. + * @returns {Node} last node. */ get lastNode(): import("./node"); /** @@ -56,3 +61,8 @@ declare class Path { */ toString(): string; } +declare namespace Path { + export { Node, Edge }; +} +type Node = import("./node"); +type Edge = import("./edge"); diff --git a/types/src/record.d.ts b/types/src/record.d.ts index 5ac08e3bcd..ed716c5604 100644 --- a/types/src/record.d.ts +++ b/types/src/record.d.ts @@ -5,7 +5,7 @@ export = Record; declare class Record { /** * Builds a Record object - * @constructor + * * @param {string[]} header * @param {object[]} values */ diff --git a/types/src/resultSet.d.ts b/types/src/resultSet.d.ts index d9f0434e4c..c61954fd1e 100644 --- a/types/src/resultSet.d.ts +++ b/types/src/resultSet.d.ts @@ -5,10 +5,10 @@ export = ResultSet; declare class ResultSet { /** * Builds an empty ResultSet object. - * @constructor - * @param {import('./graph')} graph + * + * @param {Graph} graph */ - constructor(graph: import('./graph')); + constructor(graph: Graph); _graph: import("./graph"); _position: number; _resultsCount: number; @@ -20,7 +20,7 @@ declare class ResultSet { * @param {object[]} resp - raw response representation - the raw representation of response is at most 3 lists of objects. * The last list is the statistics list. */ - parseResponse(resp: object[]): Promise; + parseResponse(resp: object[]): Promise; _statistics: Statistics; /** * Parse a raw response body into header an records. @@ -54,16 +54,16 @@ declare class ResultSet { * Parse raw node representation into a Node object. * @async * @param {object[]} cell raw node representation. - * @returns {Promise} Node object. + * @returns {Promise} Node object. */ - parseNode(cell: object[]): Promise; + parseNode(cell: object[]): Promise; /** * Parse a raw edge representation into an Edge object. * @async * @param {object[]} cell raw edge representation - * @returns {Promise} Edge object. + * @returns {Promise} Edge object. */ - parseEdge(cell: object[]): Promise; + parseEdge(cell: object[]): Promise; /** * Parse and in-place replace raw array into an array of values or objects. * @async @@ -75,9 +75,9 @@ declare class ResultSet { * Parse a raw path representation into Path object. * @async * @param {object[]} rawPath raw path representation - * @returns {Promise} Path object. + * @returns {Promise} Path object. */ - parsePath(rawPath: object[]): Promise; + parsePath(rawPath: object[]): Promise; /** * Parse a raw map representation into Map object. * @async @@ -113,5 +113,12 @@ declare class ResultSet { */ size(): number; } +declare namespace ResultSet { + export { Graph }; +} import Statistics = require("./statistics"); +import Node = require("./node"); +import Edge = require("./edge"); +import Path = require("./path"); import Record = require("./record"); +type Graph = import("./graph");