falkordb 6.7.0 → 6.9.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.
Files changed (73) hide show
  1. package/README.md +30 -5
  2. package/dist/index.d.ts +3 -2
  3. package/dist/index.js +8 -5
  4. package/dist/src/clients/client.d.ts +5 -13
  5. package/dist/src/clients/cluster.d.ts +7 -12
  6. package/dist/src/clients/cluster.js +38 -5
  7. package/dist/src/clients/nullClient.d.ts +3 -11
  8. package/dist/src/clients/sentinel.d.ts +31 -0
  9. package/dist/src/clients/sentinel.js +179 -24
  10. package/dist/src/clients/single.d.ts +16 -12
  11. package/dist/src/clients/single.js +29 -21
  12. package/dist/src/commands/CONFIG_GET.d.ts +1 -5
  13. package/dist/src/commands/CONSTRAINT_CREATE.d.ts +2 -8
  14. package/dist/src/commands/CONSTRAINT_CREATE.js +3 -10
  15. package/dist/src/commands/CONSTRAINT_DROP.d.ts +1 -1
  16. package/dist/src/commands/MEMORY_USAGE.d.ts +2 -4
  17. package/dist/src/commands/QUERY.d.ts +4 -23
  18. package/dist/src/commands/QUERY.js +14 -4
  19. package/dist/src/commands/RO_QUERY.d.ts +2 -2
  20. package/dist/src/commands/RO_QUERY.js +4 -4
  21. package/dist/src/commands/SLOWLOG.d.ts +1 -13
  22. package/dist/src/commands/UDF_LIST.d.ts +2 -2
  23. package/dist/src/commands/index.d.ts +4 -11
  24. package/dist/src/commands/index.js +58 -22
  25. package/dist/src/enums/constraint-type.d.ts +4 -0
  26. package/dist/src/enums/constraint-type.js +8 -0
  27. package/dist/src/enums/entity-type.d.ts +4 -0
  28. package/dist/src/enums/entity-type.js +8 -0
  29. package/dist/src/enums/graph-value-types.d.ts +19 -0
  30. package/dist/src/enums/graph-value-types.js +24 -0
  31. package/dist/src/enums/index.d.ts +3 -0
  32. package/dist/src/enums/index.js +19 -0
  33. package/dist/src/errors.d.ts +10 -0
  34. package/dist/src/errors.js +18 -0
  35. package/dist/src/falkordb.d.ts +13 -78
  36. package/dist/src/falkordb.js +142 -8
  37. package/dist/src/graph.d.ts +27 -15
  38. package/dist/src/graph.js +90 -52
  39. package/dist/src/types/cluster-graph-connection.d.ts +5 -0
  40. package/dist/src/types/cluster-graph-connection.js +2 -0
  41. package/dist/src/types/config-item.d.ts +4 -0
  42. package/dist/src/types/config-item.js +2 -0
  43. package/dist/src/types/falkordb-options.d.ts +65 -0
  44. package/dist/src/types/falkordb-options.js +2 -0
  45. package/dist/src/types/graph-metadata.d.ts +5 -0
  46. package/dist/src/types/graph-metadata.js +2 -0
  47. package/dist/src/types/graph-raw-value.d.ts +29 -0
  48. package/dist/src/types/graph-raw-value.js +2 -0
  49. package/dist/src/types/graph-value.d.ts +29 -0
  50. package/dist/src/types/graph-value.js +2 -0
  51. package/dist/src/types/index.d.ts +16 -0
  52. package/dist/src/types/index.js +32 -0
  53. package/dist/src/types/memory-usage.d.ts +4 -0
  54. package/dist/src/types/memory-usage.js +2 -0
  55. package/dist/src/types/net-socket-options.d.ts +4 -0
  56. package/dist/src/types/net-socket-options.js +2 -0
  57. package/dist/src/types/query-options.d.ts +9 -0
  58. package/dist/src/types/query-options.js +2 -0
  59. package/dist/src/types/query-reply.d.ts +20 -0
  60. package/dist/src/types/query-reply.js +2 -0
  61. package/dist/src/types/single-graph-connection.d.ts +5 -0
  62. package/dist/src/types/single-graph-connection.js +2 -0
  63. package/dist/src/types/slow-log.d.ts +12 -0
  64. package/dist/src/types/slow-log.js +2 -0
  65. package/dist/src/types/socket-options.d.ts +40 -0
  66. package/dist/src/types/socket-options.js +2 -0
  67. package/dist/src/types/tls-socket-options.d.ts +4 -0
  68. package/dist/src/types/tls-socket-options.js +2 -0
  69. package/dist/src/types/typed-redis-client-options.d.ts +9 -0
  70. package/dist/src/types/typed-redis-client-options.js +2 -0
  71. package/dist/src/types/udf-list.d.ts +2 -0
  72. package/dist/src/types/udf-list.js +2 -0
  73. package/package.json +9 -8
@@ -0,0 +1,65 @@
1
+ import type { SocketOptions } from './socket-options';
2
+ export interface FalkorDBOptions {
3
+ /**
4
+ * `falkor[s]://[[username][:password]@][host][:port][/db-number]`
5
+ */
6
+ url?: string;
7
+ /**
8
+ * Socket connection properties
9
+ */
10
+ socket?: SocketOptions;
11
+ /**
12
+ * Server hostname, shorthand for `socket.host`.
13
+ * Ignored when `url` or `socket.host` is provided.
14
+ */
15
+ host?: string;
16
+ /**
17
+ * Server port, shorthand for `socket.port`.
18
+ * Ignored when `url` or `socket.port` is provided.
19
+ */
20
+ port?: number;
21
+ /**
22
+ * Sentinel only. Resend write commands to the new master when the
23
+ * connection is lost while waiting for their reply, e.g. during a master
24
+ * hand-over. The old master may have already run them, so a write can be
25
+ * applied twice. Read-only commands, and commands the server certainly did
26
+ * not run (such as ones rejected with `READONLY`), are always resent.
27
+ * @default false
28
+ */
29
+ retryWritesOnConnectionLoss?: boolean;
30
+ /**
31
+ * ACL username ([see ACL guide](https://redis.io/topics/acl))
32
+ */
33
+ username?: string;
34
+ /**
35
+ * ACL password or the old "--requirepass" password
36
+ */
37
+ password?: string;
38
+ /**
39
+ * Client name ([see `CLIENT SETNAME`](https://redis.io/commands/client-setname))
40
+ */
41
+ name?: string;
42
+ /**
43
+ * Connect in [`READONLY`](https://redis.io/commands/readonly) mode
44
+ */
45
+ readonly?: boolean;
46
+ /**
47
+ * Send `PING` command at interval (in ms).
48
+ * Useful with Redis deployments that do not use TCP Keep-Alive.
49
+ */
50
+ pingInterval?: number;
51
+ /**
52
+ * If set to true, disables sending client identifier (user-agent like message) to the redis server
53
+ */
54
+ disableClientInfo?: boolean;
55
+ /**
56
+ * Tag to append to library name that is sent to the Redis server
57
+ */
58
+ clientInfoTag?: string;
59
+ /**
60
+ * RESP protocol version. Only RESP 2 is supported: under RESP 3 node-redis rewrites
61
+ * module map replies into objects, which does not match the reply shapes this client
62
+ * parses and publishes types for. Passing anything else throws.
63
+ */
64
+ RESP?: 2;
65
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface GraphMetadata {
2
+ labels: Array<string>;
3
+ relationshipTypes: Array<string>;
4
+ propertyKeys: Array<string>;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ import type { GraphValueTypes } from '../enums';
2
+ export type GraphEntityRawProperties = Array<[id: number, ...value: GraphRawValue]>;
3
+ export type GraphEdgeRawValue = [
4
+ GraphValueTypes.EDGE,
5
+ [
6
+ id: number,
7
+ relationshipTypeId: number,
8
+ sourceId: number,
9
+ destinationId: number,
10
+ properties: GraphEntityRawProperties
11
+ ]
12
+ ];
13
+ export type GraphNodeRawValue = [
14
+ GraphValueTypes.NODE,
15
+ [
16
+ id: number,
17
+ labelIds: Array<number>,
18
+ properties: GraphEntityRawProperties
19
+ ]
20
+ ];
21
+ export type GraphPathRawValue = [
22
+ GraphValueTypes.PATH,
23
+ [
24
+ nodes: [GraphValueTypes.ARRAY, Array<GraphNodeRawValue>],
25
+ edges: [GraphValueTypes.ARRAY, Array<GraphEdgeRawValue>]
26
+ ]
27
+ ];
28
+ export type GraphMapRawValue = [GraphValueTypes.MAP, Array<string | GraphRawValue>];
29
+ export type GraphRawValue = [GraphValueTypes.NULL, null] | [GraphValueTypes.STRING, string] | [GraphValueTypes.INTEGER, number] | [GraphValueTypes.BOOLEAN, string] | [GraphValueTypes.DOUBLE, string] | [GraphValueTypes.ARRAY, Array<GraphRawValue>] | GraphEdgeRawValue | GraphNodeRawValue | GraphPathRawValue | GraphMapRawValue | [GraphValueTypes.POINT, [latitude: string, longitude: string]] | [GraphValueTypes.VECTORF32, number[]] | [GraphValueTypes.DATETIME, number] | [GraphValueTypes.DATE, number] | [GraphValueTypes.TIME, number] | [GraphValueTypes.DURATION, number];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ import type { Temporal } from '@js-temporal/polyfill';
2
+ import type { QueryReply } from './query-reply';
3
+ export type GraphEntityProperties = Record<string, GraphValue>;
4
+ export interface GraphEdge {
5
+ id: number;
6
+ relationshipType: string;
7
+ sourceId: number;
8
+ destinationId: number;
9
+ properties: GraphEntityProperties;
10
+ }
11
+ export interface GraphNode {
12
+ id: number;
13
+ labels: Array<string>;
14
+ properties: GraphEntityProperties;
15
+ }
16
+ export interface GraphPath {
17
+ nodes: Array<GraphNode>;
18
+ edges: Array<GraphEdge>;
19
+ }
20
+ export type GraphMap = {
21
+ [key: string]: GraphValue;
22
+ };
23
+ export type GraphValue = null | string | number | boolean | Array<GraphValue> | GraphEdge | GraphNode | GraphPath | GraphMap | {
24
+ latitude: string;
25
+ longitude: string;
26
+ } | number[] | Temporal.PlainDateTime | Temporal.PlainDate | Temporal.PlainTime | Temporal.Duration;
27
+ export type GraphReply<T> = Omit<QueryReply, "headers" | "data"> & {
28
+ data?: Array<T>;
29
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ export * from './cluster-graph-connection';
2
+ export * from './config-item';
3
+ export * from './falkordb-options';
4
+ export * from './graph-metadata';
5
+ export * from './graph-raw-value';
6
+ export * from './graph-value';
7
+ export * from './memory-usage';
8
+ export * from './net-socket-options';
9
+ export * from './query-options';
10
+ export * from './query-reply';
11
+ export * from './single-graph-connection';
12
+ export * from './slow-log';
13
+ export * from './socket-options';
14
+ export * from './tls-socket-options';
15
+ export * from './typed-redis-client-options';
16
+ export * from './udf-list';
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./cluster-graph-connection"), exports);
18
+ __exportStar(require("./config-item"), exports);
19
+ __exportStar(require("./falkordb-options"), exports);
20
+ __exportStar(require("./graph-metadata"), exports);
21
+ __exportStar(require("./graph-raw-value"), exports);
22
+ __exportStar(require("./graph-value"), exports);
23
+ __exportStar(require("./memory-usage"), exports);
24
+ __exportStar(require("./net-socket-options"), exports);
25
+ __exportStar(require("./query-options"), exports);
26
+ __exportStar(require("./query-reply"), exports);
27
+ __exportStar(require("./single-graph-connection"), exports);
28
+ __exportStar(require("./slow-log"), exports);
29
+ __exportStar(require("./socket-options"), exports);
30
+ __exportStar(require("./tls-socket-options"), exports);
31
+ __exportStar(require("./typed-redis-client-options"), exports);
32
+ __exportStar(require("./udf-list"), exports);
@@ -0,0 +1,4 @@
1
+ export interface MemoryUsageOptions {
2
+ SAMPLES?: number;
3
+ }
4
+ export type MemoryUsageReply = Array<string | number | MemoryUsageReply>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type * as net from 'net';
2
+ export type NetSocketOptions = Partial<net.SocketConnectOpts> & {
3
+ tls?: false;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export type QueryParam = null | string | number | boolean | QueryParams | Array<QueryParam>;
2
+ export type QueryParams = {
3
+ [key: string]: QueryParam;
4
+ };
5
+ export interface QueryOptions {
6
+ params?: QueryParams;
7
+ TIMEOUT?: number;
8
+ }
9
+ export type QueryOptionsBackwardCompatible = QueryOptions | number;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ type Headers = Array<string>;
2
+ type Data = Array<string | number | null | Data>;
3
+ type Metadata = Array<string>;
4
+ export type QueryRawReply = [
5
+ headers: Headers,
6
+ data: Data,
7
+ metadata: Metadata
8
+ ] | [
9
+ metadata: Metadata
10
+ ];
11
+ export type QueryReply = {
12
+ headers: undefined;
13
+ data: undefined;
14
+ metadata: Metadata;
15
+ } | {
16
+ headers: Headers;
17
+ data: Data;
18
+ metadata: Metadata;
19
+ };
20
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import type { RedisClientType, RedisFunctions, RedisScripts } from '@redis/client';
2
+ import type commands from '../commands';
3
+ export type SingleGraphConnection = RedisClientType<{
4
+ falkordb: typeof commands;
5
+ }, RedisFunctions, RedisScripts, 2>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ export type SlowLogRawReply = Array<[
2
+ timestamp: string,
3
+ command: string,
4
+ query: string,
5
+ took: string
6
+ ]>;
7
+ export type SlowLogReply = Array<{
8
+ timestamp: Date;
9
+ command: string;
10
+ query: string;
11
+ took: number;
12
+ }>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,40 @@
1
+ import type { NetSocketOptions } from './net-socket-options';
2
+ import type { TlsSocketOptions } from './tls-socket-options';
3
+ export interface SocketCommonOptions {
4
+ /**
5
+ * Connection Timeout (in milliseconds)
6
+ */
7
+ connectTimeout?: number;
8
+ /**
9
+ * Toggle [`Nagle's algorithm`](https://nodejs.org/api/net.html#net_socket_setnodelay_nodelay)
10
+ */
11
+ noDelay?: boolean;
12
+ /**
13
+ * Toggle [`keep-alive`](https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay)
14
+ */
15
+ keepAlive?: number | false;
16
+ /**
17
+ * When the socket closes unexpectedly (without calling `.close()`), the client uses `reconnectStrategy` to decide what to do:
18
+ * 1. `false` -> do not reconnect, close the client and flush the command queue.
19
+ * 2. `number` -> wait for `X` milliseconds before reconnecting.
20
+ * 3. `(retries, cause) => false | number | Error` -> `number` is the same as configuring a `number` directly, `Error` is the same as `false`, but with a custom error.
21
+ *
22
+ * By default the initial connection is retried 3 times before `FalkorDB.connect()` rejects.
23
+ * After that, reconnects back off exponentially up to 2 seconds between attempts, with no
24
+ * limit on the number of attempts. A socket timeout (see `socketTimeout`) is never retried:
25
+ * the client closes instead.
26
+ */
27
+ reconnectStrategy?: false | number | ((retries: number, cause: Error) => false | Error | number);
28
+ /**
29
+ * Timeout (in milliseconds) after which an idle socket is closed. `undefined` means no timeout.
30
+ * With the default `reconnectStrategy` a timed-out client is not reconnected.
31
+ */
32
+ socketTimeout?: number;
33
+ /**
34
+ * Whether to use TLS for this socket connection.
35
+ * When `true`, TLS-specific options from {@link TlsSocketOptions} are expected;
36
+ * when `false` or omitted, {@link NetSocketOptions} are used.
37
+ */
38
+ tls?: boolean;
39
+ }
40
+ export type SocketOptions = SocketCommonOptions & (NetSocketOptions | TlsSocketOptions);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type * as tls from 'tls';
2
+ export interface TlsSocketOptions extends tls.ConnectionOptions {
3
+ tls: true;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import type { RedisClientOptions, RedisFunctions, RedisScripts } from 'redis';
2
+ import type { RedisClusterOptions } from '@redis/client';
3
+ import type commands from '../commands';
4
+ export type TypedRedisClientOptions = RedisClientOptions<{
5
+ falkordb: typeof commands;
6
+ }, RedisFunctions, RedisScripts, 2>;
7
+ export type TypedRedisClusterClientOptions = RedisClusterOptions<{
8
+ falkordb: typeof commands;
9
+ }, RedisFunctions, RedisScripts, 2>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export type UdfLibraryEntry = [string, string[]] | [string, string[], string];
2
+ export type UdfListReply = UdfLibraryEntry[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "falkordb",
3
- "version": "6.7.0",
3
+ "version": "6.9.0",
4
4
  "description": "A FalkorDB javascript library",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -39,22 +39,23 @@
39
39
  "@tsconfig/node20": "^20.1.4",
40
40
  "@types/jest": "^30.0.0",
41
41
  "@types/lodash": "^4.17.13",
42
- "@types/node": "^25.0.2",
43
- "@typescript-eslint/eslint-plugin": "^8.18.2",
44
- "@typescript-eslint/parser": "^8.18.2",
42
+ "@types/node": "^26.2.0",
43
+ "@typescript-eslint/eslint-plugin": "^8.70.0",
44
+ "@typescript-eslint/parser": "^8.70.0",
45
+ "@typescript/native": "npm:typescript@^7.0.2",
45
46
  "eslint": "^10.0.1",
46
47
  "gh-pages": "^6.2.0",
47
48
  "jest": "^30.2.0",
48
- "release-it": "^19.0.3",
49
+ "release-it": "^21.0.2",
49
50
  "ts-jest": "^29.4.6",
50
- "typescript": "^5.9.3"
51
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
51
52
  },
52
53
  "dependencies": {
53
54
  "@js-temporal/polyfill": "^0.5.1",
54
- "@redis/client": "^5.10.0",
55
+ "@redis/client": "^6.2.1",
55
56
  "cluster-key-slot": "1.1.2",
56
57
  "generic-pool": "^3.9.0",
57
58
  "lodash": "^4.17.21",
58
- "redis": "^5.10.0"
59
+ "redis": "^6.2.0"
59
60
  }
60
61
  }