falkordb 6.2.0 → 6.2.1
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/src/clients/client.d.ts +2 -0
- package/dist/src/clients/cluster.d.ts +3 -0
- package/dist/src/clients/cluster.js +4 -0
- package/dist/src/clients/nullClient.d.ts +2 -0
- package/dist/src/clients/nullClient.js +3 -0
- package/dist/src/clients/single.d.ts +1 -0
- package/dist/src/clients/single.js +3 -0
- package/dist/src/falkordb.d.ts +2 -2
- package/dist/src/falkordb.js +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { RedisCommandArgument } from "@redis/client/dist/lib/commands";
|
|
|
2
2
|
import { QueryOptions } from "../commands";
|
|
3
3
|
import { ConstraintType, EntityType } from "../graph";
|
|
4
4
|
import FalkorDB from "../falkordb";
|
|
5
|
+
import { SingleGraphConnection } from "./single";
|
|
5
6
|
export interface Client {
|
|
6
7
|
init(falkordb: FalkorDB): Promise<void>;
|
|
7
8
|
list(): Promise<Array<string>>;
|
|
@@ -23,4 +24,5 @@ export interface Client {
|
|
|
23
24
|
constraintCreate(graph: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Promise<void>;
|
|
24
25
|
constraintDrop(graph: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Promise<void>;
|
|
25
26
|
quit(): Promise<void>;
|
|
27
|
+
getConnection(): Promise<SingleGraphConnection>;
|
|
26
28
|
}
|
|
@@ -14,6 +14,9 @@ export type ClusterGraphConnection = RedisClusterType<{
|
|
|
14
14
|
export declare class Cluster implements Client {
|
|
15
15
|
#private;
|
|
16
16
|
constructor(client: SingleGraphConnection);
|
|
17
|
+
getConnection(): Promise<import("@redis/client").RedisClientType<{
|
|
18
|
+
falkordb: typeof commands;
|
|
19
|
+
}, RedisFunctions, RedisScripts>>;
|
|
17
20
|
init(falkordb: FalkorDB): Promise<void>;
|
|
18
21
|
query<T>(graph: string, query: RedisCommandArgument, options?: QueryOptions): Promise<{
|
|
19
22
|
headers: undefined;
|
|
@@ -20,6 +20,10 @@ class Cluster {
|
|
|
20
20
|
client.disconnect();
|
|
21
21
|
this.#client = (0, client_1.createCluster)(redisClusterOption);
|
|
22
22
|
}
|
|
23
|
+
async getConnection() {
|
|
24
|
+
const connection = this.#client.nodeClient(this.#client.getRandomNode());
|
|
25
|
+
return connection instanceof Promise ? await connection : connection;
|
|
26
|
+
}
|
|
23
27
|
async init(falkordb) {
|
|
24
28
|
await this.#client
|
|
25
29
|
.on('error', err => falkordb.emit('error', err)) // Forward errors
|
|
@@ -3,6 +3,7 @@ import { QueryOptions } from "../commands";
|
|
|
3
3
|
import FalkorDB from "../falkordb";
|
|
4
4
|
import { ConstraintType, EntityType } from "../graph";
|
|
5
5
|
import { Client } from "./client";
|
|
6
|
+
import { SingleGraphConnection } from "./single";
|
|
6
7
|
/**
|
|
7
8
|
* The `NullClient` class is a placeholder implementation of the `Client` interface.
|
|
8
9
|
*
|
|
@@ -15,6 +16,7 @@ import { Client } from "./client";
|
|
|
15
16
|
*
|
|
16
17
|
*/
|
|
17
18
|
export declare class NullClient implements Client {
|
|
19
|
+
getConnection(): Promise<SingleGraphConnection>;
|
|
18
20
|
init(falkordb: FalkorDB): Promise<void>;
|
|
19
21
|
list(): Promise<Array<string>>;
|
|
20
22
|
configGet(configKey: string): Promise<(string | number)[] | (string | number)[][]>;
|
|
@@ -47,4 +47,5 @@ export declare class Single implements Client {
|
|
|
47
47
|
constraintDrop(graph: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Promise<void>;
|
|
48
48
|
copy<T>(srcGraph: string, destGraph: string): Promise<"OK">;
|
|
49
49
|
quit(): Promise<void>;
|
|
50
|
+
getConnection(): Promise<SingleGraphConnection>;
|
|
50
51
|
}
|
package/dist/src/falkordb.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import Graph from './graph';
|
|
|
6
6
|
import commands from './commands';
|
|
7
7
|
import { RedisClusterOptions } from '@redis/client';
|
|
8
8
|
import { Options as PoolOptions } from 'generic-pool';
|
|
9
|
-
import {
|
|
9
|
+
import { SingleGraphConnection } from './clients/single';
|
|
10
10
|
type NetSocketOptions = Partial<net.SocketConnectOpts> & {
|
|
11
11
|
tls?: false;
|
|
12
12
|
};
|
|
@@ -85,7 +85,7 @@ export default class FalkorDB extends EventEmitter {
|
|
|
85
85
|
#private;
|
|
86
86
|
static connect(options?: FalkorDBOptions): Promise<FalkorDB>;
|
|
87
87
|
selectGraph(graphId: string): Graph;
|
|
88
|
-
get connection():
|
|
88
|
+
get connection(): Promise<SingleGraphConnection>;
|
|
89
89
|
list(): Promise<string[]>;
|
|
90
90
|
configGet(configKey: string): Promise<(string | number)[] | (string | number)[][]>;
|
|
91
91
|
configSet(configKey: string, value: number | string): Promise<void>;
|
package/dist/src/falkordb.js
CHANGED