falkordb 6.6.1 → 6.7.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 CHANGED
@@ -62,6 +62,23 @@ db.close()
62
62
 
63
63
  To learn more about Cypher query language check: https://docs.falkordb.com/cypher/
64
64
 
65
+ #### `.stubs()`
66
+
67
+ Lists the graphs that are currently offloaded to disk ("stubs"). `db.list()` already includes
68
+ offloaded graphs, so `stubs()` is how you tell which of the listed graphs are not loaded in memory.
69
+
70
+ `GRAPH.STUBS` is provided by the FalkorDB Enterprise graph-offloading module, so on deployments
71
+ without that module the call rejects with an "unknown command" error — treat that as
72
+ "offloading is not supported here".
73
+
74
+ On a cluster the replies of all master nodes are combined. If only some masters fail, the
75
+ partial result is returned and the failures are logged; the call rejects only when every
76
+ master fails.
77
+
78
+ ```typescript
79
+ const offloaded = await db.stubs();
80
+ ```
81
+
65
82
  #### `.close()`
66
83
 
67
84
  Forcibly close a client's connection to FalkorDB immediately. Calling `close` will not send further pending commands to the Redis server, or wait for or parse outstanding responses.
@@ -8,6 +8,14 @@ import { UdfListReply } from "../commands/UDF_LIST";
8
8
  export interface Client {
9
9
  init(falkordb: FalkorDB): Promise<void>;
10
10
  list(): Promise<Array<string>>;
11
+ /**
12
+ * Lists the graphs that are currently offloaded to disk ("stubs").
13
+ *
14
+ * `GRAPH.STUBS` is provided by the FalkorDB Enterprise graph-offloading
15
+ * module, so it rejects with an "unknown command" error on deployments where
16
+ * that module is not loaded.
17
+ */
18
+ stubs(): Promise<Array<string>>;
11
19
  configGet(configKey: string): Promise<(string | number)[] | (string | number)[][]>;
12
20
  configSet(configKey: string, value: number | string): Promise<void>;
13
21
  info(section?: string): Promise<(string | string[])[]>;
@@ -41,6 +41,7 @@ export declare class Cluster implements Client {
41
41
  delete(graph: string): Promise<void>;
42
42
  explain(graph: string, query: string): Promise<string[]>;
43
43
  list(): Promise<Array<string>>;
44
+ stubs(): Promise<Array<string>>;
44
45
  configGet(configKey: string): Promise<(string | number)[] | (string | number)[][]>;
45
46
  configSet(configKey: string, value: number | string): Promise<void>;
46
47
  info(section?: string): Promise<(string | string[])[]>;
@@ -59,6 +59,30 @@ class Cluster {
59
59
  }
60
60
  return result;
61
61
  }
62
+ async stubs() {
63
+ const replies = await Promise.allSettled(this.#client.masters.map(async (master) => {
64
+ return (await this.#client.nodeClient(master)).falkordb.stubs();
65
+ }));
66
+ const result = [];
67
+ const errors = [];
68
+ for (const reply of replies) {
69
+ if (reply.status === "fulfilled") {
70
+ result.push(...reply.value);
71
+ }
72
+ else {
73
+ errors.push(reply.reason);
74
+ }
75
+ }
76
+ // Only surface a failure when every master failed - e.g. when the
77
+ // graph-offloading module is missing cluster-wide ("unknown command").
78
+ if (errors.length > 0 && errors.length === replies.length) {
79
+ throw errors[0];
80
+ }
81
+ if (errors.length > 0) {
82
+ console.error("Some nodes failed to respond:", errors);
83
+ }
84
+ return result;
85
+ }
62
86
  async configGet(configKey) {
63
87
  return this.#client.falkordb.configGet(configKey);
64
88
  }
@@ -21,6 +21,7 @@ export declare class NullClient implements Client {
21
21
  getConnection(): Promise<SingleGraphConnection>;
22
22
  init(_falkordb: FalkorDB): Promise<void>;
23
23
  list(): Promise<Array<string>>;
24
+ stubs(): Promise<Array<string>>;
24
25
  configGet(_configKey: string): Promise<(string | number)[] | (string | number)[][]>;
25
26
  configSet(_configKey: string, _value: number | string): Promise<void>;
26
27
  info(_section?: string): Promise<(string | string[])[]>;
@@ -22,6 +22,9 @@ class NullClient {
22
22
  list() {
23
23
  throw new Error("Method not implemented.");
24
24
  }
25
+ stubs() {
26
+ throw new Error("Method not implemented.");
27
+ }
25
28
  configGet(_configKey) {
26
29
  throw new Error("Method not implemented.");
27
30
  }
@@ -35,6 +35,7 @@ export declare class Single implements Client {
35
35
  explain(graph: string, query: string): Promise<string[]>;
36
36
  profile<_T>(graph: string, query: string): Promise<string[]>;
37
37
  list(): Promise<string[]>;
38
+ stubs(): Promise<string[]>;
38
39
  configGet(configKey: string): Promise<(string | number)[] | (string | number)[][]>;
39
40
  configSet(configKey: string, value: number | string): Promise<void>;
40
41
  info(section?: string): Promise<(string | string[])[]>;
@@ -28,6 +28,9 @@ class Single {
28
28
  async list() {
29
29
  return this.client.falkordb.list();
30
30
  }
31
+ async stubs() {
32
+ return this.client.falkordb.stubs();
33
+ }
31
34
  async configGet(configKey) {
32
35
  return this.client.falkordb.configGet(configKey);
33
36
  }
@@ -0,0 +1,5 @@
1
+ import { CommandParser } from '@redis/client';
2
+ export declare const IS_READ_ONLY = true;
3
+ export declare function parseCommand(parser: CommandParser): void;
4
+ export declare function transformArguments(): Array<string>;
5
+ export declare function transformReply(reply: unknown): Array<string>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IS_READ_ONLY = void 0;
4
+ exports.parseCommand = parseCommand;
5
+ exports.transformArguments = transformArguments;
6
+ exports.transformReply = transformReply;
7
+ exports.IS_READ_ONLY = true;
8
+ function parseCommand(parser) {
9
+ parser.push('GRAPH.STUBS');
10
+ }
11
+ function transformArguments() {
12
+ return ['GRAPH.STUBS'];
13
+ }
14
+ function transformReply(reply) {
15
+ return reply;
16
+ }
@@ -8,6 +8,7 @@ import * as PROFILE from './PROFILE';
8
8
  import * as QUERY from './QUERY';
9
9
  import * as RO_QUERY from './RO_QUERY';
10
10
  import * as SLOWLOG from './SLOWLOG';
11
+ import * as STUBS from './STUBS';
11
12
  import * as CONSTRAINT_CREATE from './CONSTRAINT_CREATE';
12
13
  import * as CONSTRAINT_DROP from './CONSTRAINT_DROP';
13
14
  import * as COPY from './COPY';
@@ -40,6 +41,8 @@ declare const _default: {
40
41
  roQuery: typeof RO_QUERY;
41
42
  SLOWLOG: typeof SLOWLOG;
42
43
  slowLog: typeof SLOWLOG;
44
+ STUBS: typeof STUBS;
45
+ stubs: typeof STUBS;
43
46
  CONSTRAINT_CREATE: typeof CONSTRAINT_CREATE;
44
47
  constraintCreate: typeof CONSTRAINT_CREATE;
45
48
  CONSTRAINT_DROP: typeof CONSTRAINT_DROP;
@@ -11,6 +11,7 @@ const PROFILE = require("./PROFILE");
11
11
  const QUERY = require("./QUERY");
12
12
  const RO_QUERY = require("./RO_QUERY");
13
13
  const SLOWLOG = require("./SLOWLOG");
14
+ const STUBS = require("./STUBS");
14
15
  const CONSTRAINT_CREATE = require("./CONSTRAINT_CREATE");
15
16
  const CONSTRAINT_DROP = require("./CONSTRAINT_DROP");
16
17
  const COPY = require("./COPY");
@@ -42,6 +43,8 @@ exports.default = {
42
43
  roQuery: RO_QUERY,
43
44
  SLOWLOG,
44
45
  slowLog: SLOWLOG,
46
+ STUBS,
47
+ stubs: STUBS,
45
48
  CONSTRAINT_CREATE,
46
49
  constraintCreate: CONSTRAINT_CREATE,
47
50
  CONSTRAINT_DROP,
@@ -82,6 +82,15 @@ export default class FalkorDB extends EventEmitter {
82
82
  selectGraph(graphId: string): Graph;
83
83
  get connection(): Promise<SingleGraphConnection>;
84
84
  list(): Promise<string[]>;
85
+ /**
86
+ * Lists the graphs that are currently offloaded to disk ("stubs").
87
+ *
88
+ * `GRAPH.STUBS` is provided by the FalkorDB Enterprise graph-offloading
89
+ * module, so this rejects with an "unknown command" error on deployments
90
+ * where that module is not loaded. Callers that support both editions
91
+ * should treat such a rejection as "no offloading support".
92
+ */
93
+ stubs(): Promise<string[]>;
85
94
  configGet(configKey: string): Promise<(string | number)[] | (string | number)[][]>;
86
95
  configSet(configKey: string, value: number | string): Promise<void>;
87
96
  info(section?: string): Promise<(string | string[])[]>;
@@ -53,6 +53,17 @@ class FalkorDB extends events_1.EventEmitter {
53
53
  async list() {
54
54
  return this.#client.list();
55
55
  }
56
+ /**
57
+ * Lists the graphs that are currently offloaded to disk ("stubs").
58
+ *
59
+ * `GRAPH.STUBS` is provided by the FalkorDB Enterprise graph-offloading
60
+ * module, so this rejects with an "unknown command" error on deployments
61
+ * where that module is not loaded. Callers that support both editions
62
+ * should treat such a rejection as "no offloading support".
63
+ */
64
+ async stubs() {
65
+ return this.#client.stubs();
66
+ }
56
67
  async configGet(configKey) {
57
68
  return this.#client.configGet(configKey);
58
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "falkordb",
3
- "version": "6.6.1",
3
+ "version": "6.7.0",
4
4
  "description": "A FalkorDB javascript library",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -33,16 +33,16 @@
33
33
  "falkordb"
34
34
  ],
35
35
  "engines": {
36
- "node": ">=20.0.0"
36
+ "node": ">=22"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@tsconfig/node20": "^20.1.4",
40
- "@types/jest": "^29.5.14",
40
+ "@types/jest": "^30.0.0",
41
41
  "@types/lodash": "^4.17.13",
42
42
  "@types/node": "^25.0.2",
43
43
  "@typescript-eslint/eslint-plugin": "^8.18.2",
44
44
  "@typescript-eslint/parser": "^8.18.2",
45
- "eslint": "^9.17.0",
45
+ "eslint": "^10.0.1",
46
46
  "gh-pages": "^6.2.0",
47
47
  "jest": "^30.2.0",
48
48
  "release-it": "^19.0.3",