1
1
"use strict" ;
2
2
const redis = require ( "redis" ) ,
3
+ // @ts -ignore
3
4
util = require ( "util" ) ,
4
5
ResultSet = require ( "./resultSet" ) ;
5
6
@@ -12,9 +13,9 @@ class Graph {
12
13
* See: node_redis for more options on createClient
13
14
*
14
15
* @param {string } graphId the graph id
15
- * @param {string | RedisClient } [host] Redis host or node_redis client
16
- * @param {string | int } [port] Redis port
17
- * @param {ClientOpts } [options] node_redis options
16
+ * @param {string | import('redis'). RedisClient } [host] Redis host or node_redis client
17
+ * @param {string | number } [port] Redis port (integer)
18
+ * @param {Object } [options] node_redis options
18
19
*/
19
20
constructor ( graphId , host , port , options ) {
20
21
this . _graphId = graphId ; // Graph ID
@@ -42,7 +43,7 @@ class Graph {
42
43
/**
43
44
* Auxiliary function to extract string(s) data from procedures such as:
44
45
* db.labels, db.propertyKeys and db.relationshipTypes
45
- * @param {ResultSet } resultSet - a procedure result set
46
+ * @param {import('./resultSet') } resultSet - a procedure result set
46
47
* @returns {string[] } strings array.
47
48
*/
48
49
_extractStrings ( resultSet ) {
@@ -55,7 +56,7 @@ class Graph {
55
56
56
57
/**
57
58
* Transforms a parameter value to string.
58
- * @param {object } paramValue
59
+ * @param {* } paramValue
59
60
* @returns {string } the string representation of paramValue.
60
61
*/
61
62
paramToString ( paramValue ) {
@@ -100,7 +101,7 @@ class Graph {
100
101
* @async
101
102
* @param {string } query Cypher query
102
103
* @param {Map } [params] Parameters map
103
- * @returns {ResultSet } a promise contains a result set
104
+ * @returns {Promise<import('./resultSet')> } a promise contains a result set
104
105
*/
105
106
async query ( query , params ) {
106
107
if ( params ) {
@@ -118,7 +119,7 @@ class Graph {
118
119
/**
119
120
* Deletes the entire graph
120
121
* @async
121
- * @returns {ResultSet } a promise contains the delete operation running time statistics
122
+ * @returns {Promise<import('./resultSet')> } a promise contains the delete operation running time statistics
122
123
*/
123
124
async deleteGraph ( ) {
124
125
var res = await this . _sendCommand ( "graph.DELETE" , [ this . _graphId ] ) ;
@@ -135,7 +136,7 @@ class Graph {
135
136
* @param {string } procedure Procedure to call
136
137
* @param {string[] } [args] Arguments to pass
137
138
* @param {string[] } [y] Yield outputs
138
- * @returns {ResultSet } a promise contains the procedure result set data
139
+ * @returns {Promise<import('./resultSet')> } a promise contains the procedure result set data
139
140
*/
140
141
callProcedure ( procedure , args = new Array ( ) , y = new Array ( ) ) {
141
142
let q = "CALL " + procedure + "(" + args . join ( "," ) + ")" + y . join ( " " ) ;
@@ -198,7 +199,7 @@ class Graph {
198
199
199
200
/**
200
201
* Retrieves label by ID.
201
- * @param {int } id internal ID of label.
202
+ * @param {number } id internal ID of label. (integer)
202
203
* @returns {string } String label.
203
204
*/
204
205
getLabel ( id ) {
@@ -208,8 +209,8 @@ class Graph {
208
209
/**
209
210
* Retrieve all the labels from the graph and returns the wanted label
210
211
* @async
211
- * @param {int } id internal ID of label.
212
- * @returns {string } String label.
212
+ * @param {number } id internal ID of label. (integer)
213
+ * @returns {Promise< string> } String label.
213
214
*/
214
215
async fetchAndGetLabel ( id ) {
215
216
await this . labels ( ) ;
@@ -218,8 +219,8 @@ class Graph {
218
219
219
220
/**
220
221
* Retrieves relationship type by ID.
221
- * @param {int } id internal ID of relationship type.
222
- * @return String relationship type.
222
+ * @param {number } id internal ID of relationship type. (integer)
223
+ * @returns { string } relationship type.
223
224
*/
224
225
getRelationship ( id ) {
225
226
return this . _relationshipTypes [ id ] ;
@@ -228,8 +229,8 @@ class Graph {
228
229
/**
229
230
* Retrieves al the relationships types from the graph, and returns the wanted type
230
231
* @async
231
- * @param {int } id internal ID of relationship type.
232
- * @returns {string } String relationship type.
232
+ * @param {number } id internal ID of relationship type. (integer)
233
+ * @returns {Promise< string> } String relationship type.
233
234
*/
234
235
async fetchAndGetRelationship ( id ) {
235
236
await this . relationshipTypes ( ) ;
@@ -238,7 +239,7 @@ class Graph {
238
239
239
240
/**
240
241
* Retrieves property name by ID.
241
- * @param {int } id internal ID of property.
242
+ * @param {number } id internal ID of property. (integer)
242
243
* @returns {string } String property.
243
244
*/
244
245
getProperty ( id ) {
@@ -247,9 +248,9 @@ class Graph {
247
248
248
249
/**
249
250
* Retrieves al the properties from the graph, and returns the wanted property
250
- * @async
251
- * @param {int } id internal ID of property.
252
- * @returns {string } String property.
251
+ * @asyncTODO
252
+ * @param {number } id internal ID of property. (integer)
253
+ * @returns {Promise< string> } String property.
253
254
*/
254
255
async fetchAndGetProperty ( id ) {
255
256
await this . propertyKeys ( ) ;
0 commit comments