falkordb 6.7.0 → 6.8.0
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/README.md +30 -5
- package/dist/src/falkordb.d.ts +10 -0
- package/dist/src/falkordb.js +12 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -32,12 +32,10 @@ npm install falkordb
|
|
|
32
32
|
import { FalkorDB } from 'falkordb';
|
|
33
33
|
|
|
34
34
|
const db = await FalkorDB.connect({
|
|
35
|
+
host: 'localhost',
|
|
36
|
+
port: 6379,
|
|
35
37
|
username: 'myUsername',
|
|
36
|
-
password: 'myPassword'
|
|
37
|
-
socket: {
|
|
38
|
-
host: 'localhost',
|
|
39
|
-
port: 6379
|
|
40
|
-
}
|
|
38
|
+
password: 'myPassword'
|
|
41
39
|
})
|
|
42
40
|
|
|
43
41
|
console.log('Connected to FalkorDB')
|
|
@@ -62,6 +60,33 @@ db.close()
|
|
|
62
60
|
|
|
63
61
|
To learn more about Cypher query language check: https://docs.falkordb.com/cypher/
|
|
64
62
|
|
|
63
|
+
### Connection Options
|
|
64
|
+
|
|
65
|
+
`host` and `port` are the shorthand for a plain TCP connection and default to `localhost:6379`.
|
|
66
|
+
You can also pass a connection URL:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const db = await FalkorDB.connect({ url: 'falkor://localhost:6379' })
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For anything beyond host and port — TLS, connection timeouts, keep-alive — use `socket`, which is
|
|
73
|
+
passed to the underlying [node-redis](https://github.com/redis/node-redis) client:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
const db = await FalkorDB.connect({
|
|
77
|
+
socket: {
|
|
78
|
+
host: 'localhost',
|
|
79
|
+
port: 6379,
|
|
80
|
+
tls: true,
|
|
81
|
+
connectTimeout: 5000
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`url` sets the connection address, so it overrides the top-level `host` and `port`. Other
|
|
87
|
+
`socket` settings such as TLS and timeouts still apply alongside it. When both are given,
|
|
88
|
+
`socket.host` and `socket.port` take precedence over the top-level `host` and `port`.
|
|
89
|
+
|
|
65
90
|
#### `.stubs()`
|
|
66
91
|
|
|
67
92
|
Lists the graphs that are currently offloaded to disk ("stubs"). `db.list()` already includes
|
package/dist/src/falkordb.d.ts
CHANGED
|
@@ -46,6 +46,16 @@ export interface FalkorDBOptions {
|
|
|
46
46
|
* Socket connection properties
|
|
47
47
|
*/
|
|
48
48
|
socket?: SocketOptions;
|
|
49
|
+
/**
|
|
50
|
+
* Server hostname, shorthand for `socket.host`.
|
|
51
|
+
* Ignored when `url` or `socket.host` is provided.
|
|
52
|
+
*/
|
|
53
|
+
host?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Server port, shorthand for `socket.port`.
|
|
56
|
+
* Ignored when `url` or `socket.port` is provided.
|
|
57
|
+
*/
|
|
58
|
+
port?: number;
|
|
49
59
|
/**
|
|
50
60
|
* ACL username ([see ACL guide](https://redis.io/topics/acl))
|
|
51
61
|
*/
|
package/dist/src/falkordb.js
CHANGED
|
@@ -21,7 +21,18 @@ async function clientFactory(client) {
|
|
|
21
21
|
class FalkorDB extends events_1.EventEmitter {
|
|
22
22
|
#client = new nullClient_1.NullClient();
|
|
23
23
|
static async connect(options) {
|
|
24
|
-
const
|
|
24
|
+
const { host, port, ...rest } = options ?? {};
|
|
25
|
+
const redisOption = rest;
|
|
26
|
+
// Support the top-level `host`/`port` shorthand used by the other FalkorDB
|
|
27
|
+
// clients by folding them into the socket options node-redis expects.
|
|
28
|
+
// Explicit `socket` values win, and `url` takes precedence over both.
|
|
29
|
+
if (!redisOption.url && (host !== undefined || port !== undefined)) {
|
|
30
|
+
redisOption.socket = {
|
|
31
|
+
...(host !== undefined && { host }),
|
|
32
|
+
...(port !== undefined && { port }),
|
|
33
|
+
...redisOption.socket,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
25
36
|
// If the URL is provided, and the protocol is `falkor` replaces it with `redis` for the underline redis client
|
|
26
37
|
// e.g. falkor://localhost:6379 -> redis://localhost:6379
|
|
27
38
|
if (redisOption.url && redisOption.url.startsWith('falkor')) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "falkordb",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.0",
|
|
4
4
|
"description": "A FalkorDB javascript library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"@tsconfig/node20": "^20.1.4",
|
|
40
40
|
"@types/jest": "^30.0.0",
|
|
41
41
|
"@types/lodash": "^4.17.13",
|
|
42
|
-
"@types/node": "^
|
|
42
|
+
"@types/node": "^26.2.0",
|
|
43
43
|
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
|
44
44
|
"@typescript-eslint/parser": "^8.18.2",
|
|
45
45
|
"eslint": "^10.0.1",
|
|
46
46
|
"gh-pages": "^6.2.0",
|
|
47
47
|
"jest": "^30.2.0",
|
|
48
|
-
"release-it": "^
|
|
48
|
+
"release-it": "^21.0.2",
|
|
49
49
|
"ts-jest": "^29.4.6",
|
|
50
50
|
"typescript": "^5.9.3"
|
|
51
51
|
},
|