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
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Single = void 0;
4
+ const READ_ONLY = { readOnly: true };
4
5
  class Single {
5
6
  client;
6
7
  constructor(client) {
@@ -9,66 +10,73 @@ class Single {
9
10
  init(_falkordb) {
10
11
  return Promise.resolve();
11
12
  }
12
- async query(graph, query, options, compact = true) {
13
- return await this.client.falkordb.query(graph, query, options, compact);
13
+ /**
14
+ * Runs a command against the underlying connection.
15
+ * Subclasses override it to add recovery, e.g. retrying on a new master.
16
+ */
17
+ run(fn, _options = {}) {
18
+ return fn(this.client);
14
19
  }
15
- async roQuery(graph, query, options, compact = true) {
16
- return await this.client.falkordb.roQuery(graph, query, options, compact);
20
+ async query(graph, query, options, compact = true, version) {
21
+ return await this.run((client) => client.falkordb.query(graph, query, options, compact, version));
22
+ }
23
+ async roQuery(graph, query, options, compact = true, version) {
24
+ return await this.run((client) => client.falkordb.roQuery(graph, query, options, compact, version), READ_ONLY);
17
25
  }
18
26
  async delete(graph) {
19
- const reply = this.client.falkordb.delete(graph);
27
+ const reply = this.run((client) => client.falkordb.delete(graph));
20
28
  return reply.then(() => { });
21
29
  }
22
30
  async explain(graph, query) {
23
- return this.client.falkordb.explain(graph, query);
31
+ return this.run((client) => client.falkordb.explain(graph, query), READ_ONLY);
24
32
  }
25
33
  async profile(graph, query) {
26
- return this.client.falkordb.profile(graph, query);
34
+ return this.run((client) => client.falkordb.profile(graph, query));
27
35
  }
28
36
  async list() {
29
- return this.client.falkordb.list();
37
+ return this.run((client) => client.falkordb.list(), READ_ONLY);
30
38
  }
31
39
  async stubs() {
32
- return this.client.falkordb.stubs();
40
+ return this.run((client) => client.falkordb.stubs());
33
41
  }
34
42
  async configGet(configKey) {
35
- return this.client.falkordb.configGet(configKey);
43
+ return this.run((client) => client.falkordb.configGet(configKey), READ_ONLY);
36
44
  }
37
45
  async configSet(configKey, value) {
38
- const reply = this.client.falkordb.configSet(configKey, value);
46
+ const reply = this.run((client) => client.falkordb.configSet(configKey, value));
39
47
  return reply.then(() => { });
40
48
  }
41
49
  async info(section) {
42
- return this.client.falkordb.info(section);
50
+ return this.run((client) => client.falkordb.info(section), READ_ONLY);
43
51
  }
44
52
  async slowLog(graph) {
45
- return this.client.falkordb.slowLog(graph);
53
+ return this.run((client) => client.falkordb.slowLog(graph), READ_ONLY);
46
54
  }
47
55
  async memoryUsage(graph, options) {
48
- return this.client.falkordb.memoryUsage(graph, options);
56
+ return this.run((client) => client.falkordb.memoryUsage(graph, options), READ_ONLY);
49
57
  }
50
58
  async constraintCreate(graph, constraintType, entityType, label, ...properties) {
51
- const reply = this.client.falkordb.constraintCreate(graph, constraintType, entityType, label, ...properties);
59
+ const reply = this.run((client) => client.falkordb.constraintCreate(graph, constraintType, entityType, label, ...properties));
52
60
  return reply.then(() => { });
53
61
  }
54
62
  async constraintDrop(graph, constraintType, entityType, label, ...properties) {
55
- const reply = this.client.falkordb.constraintDrop(graph, constraintType, entityType, label, ...properties);
63
+ const reply = this.run((client) => client.falkordb.constraintDrop(graph, constraintType, entityType, label, ...properties));
56
64
  return reply.then(() => { });
57
65
  }
58
66
  async udfLoad(name, script, replace = false) {
59
- return this.client.falkordb.udfLoad(name, script, replace);
67
+ return this.run((client) => client.falkordb.udfLoad(name, script, replace));
60
68
  }
61
69
  async udfList(lib, withCode = false) {
62
- return this.client.falkordb.udfList(lib, withCode);
70
+ return this.run((client) => client.falkordb.udfList(lib, withCode), READ_ONLY);
63
71
  }
64
72
  async udfFlush() {
65
- return this.client.falkordb.udfFlush();
73
+ return this.run((client) => client.falkordb.udfFlush());
66
74
  }
67
75
  async udfDelete(lib) {
68
- return this.client.falkordb.udfDelete(lib);
76
+ return this.run((client) => client.falkordb.udfDelete(lib));
69
77
  }
70
78
  async copy(srcGraph, destGraph) {
71
- return this.client.falkordb.copy(srcGraph, destGraph);
79
+ return this.run((client) => client.falkordb.copy(srcGraph, destGraph));
72
80
  }
73
81
  quit() {
74
82
  return this.disconnect();
@@ -1,10 +1,6 @@
1
1
  import { CommandParser } from '@redis/client';
2
+ import type { ConfigItem } from '../types';
2
3
  export declare const IS_READ_ONLY = true;
3
4
  export declare function parseCommand(parser: CommandParser, configKey: string): void;
4
5
  export declare function transformArguments(configKey: string): Array<string>;
5
- type ConfigItem = [
6
- configKey: string,
7
- value: number
8
- ];
9
6
  export declare function transformReply(reply: unknown): ConfigItem | Array<ConfigItem>;
10
- export {};
@@ -1,12 +1,6 @@
1
1
  import { CommandParser } from '@redis/client';
2
- export declare enum ConstraintType {
3
- MANDATORY = "MANDATORY",
4
- UNIQUE = "UNIQUE"
5
- }
6
- export declare enum EntityType {
7
- NODE = "NODE",
8
- RELATIONSHIP = "RELATIONSHIP"
9
- }
2
+ import { ConstraintType, EntityType } from '../enums';
3
+ export { ConstraintType, EntityType };
10
4
  export declare function parseCommand(parser: CommandParser, key: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): void;
11
5
  export declare function transformArguments(key: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Array<string>;
12
6
  export declare function transformReply(reply: unknown): 'PENDING';
@@ -4,16 +4,9 @@ exports.EntityType = exports.ConstraintType = void 0;
4
4
  exports.parseCommand = parseCommand;
5
5
  exports.transformArguments = transformArguments;
6
6
  exports.transformReply = transformReply;
7
- var ConstraintType;
8
- (function (ConstraintType) {
9
- ConstraintType["MANDATORY"] = "MANDATORY";
10
- ConstraintType["UNIQUE"] = "UNIQUE";
11
- })(ConstraintType || (exports.ConstraintType = ConstraintType = {}));
12
- var EntityType;
13
- (function (EntityType) {
14
- EntityType["NODE"] = "NODE";
15
- EntityType["RELATIONSHIP"] = "RELATIONSHIP";
16
- })(EntityType || (exports.EntityType = EntityType = {}));
7
+ const enums_1 = require("../enums");
8
+ Object.defineProperty(exports, "ConstraintType", { enumerable: true, get: function () { return enums_1.ConstraintType; } });
9
+ Object.defineProperty(exports, "EntityType", { enumerable: true, get: function () { return enums_1.EntityType; } });
17
10
  // GRAPH.CONSTRAINT CREATE key constraintType {NODE label | RELATIONSHIP reltype} PROPERTIES propCount prop [prop...]
18
11
  function parseCommand(parser, key, constraintType, entityType, label, ...properties) {
19
12
  parser.push('GRAPH.CONSTRAINT', 'CREATE', key, constraintType, entityType, label, 'PROPERTIES', properties.length.toString(), ...properties);
@@ -1,5 +1,5 @@
1
1
  import { CommandParser } from '@redis/client';
2
- import { ConstraintType, EntityType } from "./CONSTRAINT_CREATE";
2
+ import { ConstraintType, EntityType } from '../enums';
3
3
  export declare function parseCommand(parser: CommandParser, key: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): void;
4
4
  export declare function transformArguments(key: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Array<string>;
5
5
  export declare function transformReply(reply: unknown): 'OK';
@@ -1,8 +1,6 @@
1
1
  import { CommandParser } from '@redis/client';
2
- export interface MemoryUsageOptions {
3
- SAMPLES?: number;
4
- }
2
+ import type { MemoryUsageOptions, MemoryUsageReply } from '../types';
3
+ export type { MemoryUsageOptions, MemoryUsageReply };
5
4
  export declare function parseCommand(parser: CommandParser, key: string, options?: MemoryUsageOptions): void;
6
5
  export declare function transformArguments(key: string, options?: MemoryUsageOptions): Array<string>;
7
- export type MemoryUsageReply = Array<string | number | MemoryUsageReply>;
8
6
  export declare function transformReply(reply: unknown): MemoryUsageReply;
@@ -1,26 +1,7 @@
1
1
  import { RedisArgument, CommandParser } from '@redis/client';
2
- import { QueryOptionsBackwardCompatible } from '.';
2
+ import type { QueryOptionsBackwardCompatible, QueryRawReply, QueryReply } from '../types';
3
+ export type { QueryReply };
3
4
  export declare const FIRST_KEY_INDEX = 1;
4
- export declare function parseCommand(parser: CommandParser, graph: RedisArgument, query: RedisArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean): void;
5
- export declare function transformArguments(graph: RedisArgument, query: RedisArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean): Array<RedisArgument>;
6
- type Headers = Array<string>;
7
- type Data = Array<string | number | null | Data>;
8
- type Metadata = Array<string>;
9
- type QueryRawReply = [
10
- headers: Headers,
11
- data: Data,
12
- metadata: Metadata
13
- ] | [
14
- metadata: Metadata
15
- ];
16
- export type QueryReply = {
17
- headers: undefined;
18
- data: undefined;
19
- metadata: Metadata;
20
- } | {
21
- headers: Headers;
22
- data: Data;
23
- metadata: Metadata;
24
- };
5
+ export declare function parseCommand(parser: CommandParser, graph: RedisArgument, query: RedisArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean, version?: number): void;
6
+ export declare function transformArguments(graph: RedisArgument, query: RedisArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean, version?: number): Array<RedisArgument>;
25
7
  export declare function transformReply(reply: QueryRawReply): QueryReply;
26
- export {};
@@ -5,15 +5,25 @@ exports.parseCommand = parseCommand;
5
5
  exports.transformArguments = transformArguments;
6
6
  exports.transformReply = transformReply;
7
7
  const _1 = require(".");
8
+ const errors_1 = require("../errors");
8
9
  exports.FIRST_KEY_INDEX = 1;
9
- function parseCommand(parser, graph, query, options, compact) {
10
- const args = (0, _1.pushQueryArguments)(['GRAPH.QUERY'], graph, query, options, compact);
10
+ function parseCommand(parser, graph, query, options, compact, version) {
11
+ const args = (0, _1.pushQueryArguments)(['GRAPH.QUERY'], graph, query, options, compact, version);
11
12
  parser.push(...args);
12
13
  }
13
- function transformArguments(graph, query, options, compact) {
14
- return (0, _1.pushQueryArguments)(['GRAPH.QUERY'], graph, query, options, compact);
14
+ function transformArguments(graph, query, options, compact, version) {
15
+ return (0, _1.pushQueryArguments)(['GRAPH.QUERY'], graph, query, options, compact, version);
15
16
  }
16
17
  function transformReply(reply) {
18
+ // A query sent with a stale `version` is rejected with
19
+ // `[error "version mismatch", current version]` and not executed
20
+ const [first, second] = reply;
21
+ if (first instanceof Error) {
22
+ if (first.message === 'version mismatch') {
23
+ throw new errors_1.SchemaVersionMismatchError(second);
24
+ }
25
+ throw first;
26
+ }
17
27
  return reply.length === 1 ? {
18
28
  headers: undefined,
19
29
  data: undefined,
@@ -2,6 +2,6 @@ import { RedisArgument, CommandParser } from '@redis/client';
2
2
  import { QueryOptionsBackwardCompatible } from '.';
3
3
  export { FIRST_KEY_INDEX } from './QUERY';
4
4
  export declare const IS_READ_ONLY = true;
5
- export declare function parseCommand(parser: CommandParser, graph: RedisArgument, query: RedisArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean): void;
6
- export declare function transformArguments(graph: RedisArgument, query: RedisArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean): Array<RedisArgument>;
5
+ export declare function parseCommand(parser: CommandParser, graph: RedisArgument, query: RedisArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean, version?: number): void;
6
+ export declare function transformArguments(graph: RedisArgument, query: RedisArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean, version?: number): Array<RedisArgument>;
7
7
  export { transformReply } from './QUERY';
@@ -7,12 +7,12 @@ const _1 = require(".");
7
7
  var QUERY_1 = require("./QUERY");
8
8
  Object.defineProperty(exports, "FIRST_KEY_INDEX", { enumerable: true, get: function () { return QUERY_1.FIRST_KEY_INDEX; } });
9
9
  exports.IS_READ_ONLY = true;
10
- function parseCommand(parser, graph, query, options, compact) {
11
- const args = (0, _1.pushQueryArguments)(['GRAPH.RO_QUERY'], graph, query, options, compact);
10
+ function parseCommand(parser, graph, query, options, compact, version) {
11
+ const args = (0, _1.pushQueryArguments)(['GRAPH.RO_QUERY'], graph, query, options, compact, version);
12
12
  parser.push(...args);
13
13
  }
14
- function transformArguments(graph, query, options, compact) {
15
- return (0, _1.pushQueryArguments)(['GRAPH.RO_QUERY'], graph, query, options, compact);
14
+ function transformArguments(graph, query, options, compact, version) {
15
+ return (0, _1.pushQueryArguments)(['GRAPH.RO_QUERY'], graph, query, options, compact, version);
16
16
  }
17
17
  var QUERY_2 = require("./QUERY");
18
18
  Object.defineProperty(exports, "transformReply", { enumerable: true, get: function () { return QUERY_2.transformReply; } });
@@ -1,19 +1,7 @@
1
1
  import { CommandParser } from '@redis/client';
2
+ import type { SlowLogRawReply, SlowLogReply } from '../types';
2
3
  export declare const IS_READ_ONLY = true;
3
4
  export declare const FIRST_KEY_INDEX = 1;
4
5
  export declare function parseCommand(parser: CommandParser, key: string): void;
5
6
  export declare function transformArguments(key: string): string[];
6
- type SlowLogRawReply = Array<[
7
- timestamp: string,
8
- command: string,
9
- query: string,
10
- took: string
11
- ]>;
12
- type SlowLogReply = Array<{
13
- timestamp: Date;
14
- command: string;
15
- query: string;
16
- took: number;
17
- }>;
18
7
  export declare function transformReply(logs: SlowLogRawReply): SlowLogReply;
19
- export {};
@@ -1,7 +1,7 @@
1
1
  import { CommandParser } from '@redis/client';
2
2
  export declare const IS_READ_ONLY = true;
3
- export type UdfLibraryEntry = [string, string[]] | [string, string[], string];
4
- export type UdfListReply = UdfLibraryEntry[];
3
+ import type { UdfListReply } from '../types';
4
+ export type { UdfLibraryEntry, UdfListReply } from '../types';
5
5
  export declare function parseCommand(parser: CommandParser, lib?: string, withCode?: boolean): void;
6
6
  export declare function transformArguments(lib?: string, withCode?: boolean): Array<string>;
7
7
  export declare function transformReply(reply: unknown): UdfListReply;
@@ -20,6 +20,7 @@ import * as UDF_LIST from './UDF_LIST';
20
20
  import * as UDF_FLUSH from './UDF_FLUSH';
21
21
  import * as UDF_DELETE from './UDF_DELETE';
22
22
  import { RedisArgument } from '@redis/client';
23
+ import type { QueryOptionsBackwardCompatible } from '../types';
23
24
  declare const _default: {
24
25
  CONFIG_GET: typeof CONFIG_GET;
25
26
  configGet: typeof CONFIG_GET;
@@ -65,14 +66,6 @@ declare const _default: {
65
66
  udfDelete: typeof UDF_DELETE;
66
67
  };
67
68
  export default _default;
68
- type QueryParam = null | string | number | boolean | QueryParams | Array<QueryParam>;
69
- type QueryParams = {
70
- [key: string]: QueryParam;
71
- };
72
- export interface QueryOptions {
73
- params?: QueryParams;
74
- TIMEOUT?: number;
75
- }
76
- export type QueryOptionsBackwardCompatible = QueryOptions | number;
77
- export declare function pushQueryArguments(args: Array<RedisArgument>, graph: RedisArgument, query: RedisArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean): Array<RedisArgument>;
78
- export type { UdfListReply, UdfLibraryEntry } from './UDF_LIST';
69
+ export type { QueryOptions, QueryOptionsBackwardCompatible, QueryParam, QueryParams } from '../types';
70
+ export declare function pushQueryArguments(args: Array<RedisArgument>, graph: RedisArgument, query: RedisArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean, version?: number): Array<RedisArgument>;
71
+ export type { UdfListReply, UdfLibraryEntry } from '../types';
@@ -1,27 +1,60 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.pushQueryArguments = pushQueryArguments;
4
- const CONFIG_GET = require("./CONFIG_GET");
5
- const CONFIG_SET = require("./CONFIG_SET");
6
- const DELETE = require("./DELETE");
7
- const EXPLAIN = require("./EXPLAIN");
8
- const INFO = require("./INFO");
9
- const LIST = require("./LIST");
10
- const PROFILE = require("./PROFILE");
11
- const QUERY = require("./QUERY");
12
- const RO_QUERY = require("./RO_QUERY");
13
- const SLOWLOG = require("./SLOWLOG");
14
- const STUBS = require("./STUBS");
15
- const CONSTRAINT_CREATE = require("./CONSTRAINT_CREATE");
16
- const CONSTRAINT_DROP = require("./CONSTRAINT_DROP");
17
- const COPY = require("./COPY");
18
- const SENTINEL_MASTER = require("./SENTINEL_MASTER");
19
- const SENTINEL_MASTERS = require("./SENTINEL_MASTERS");
20
- const MEMORY_USAGE = require("./MEMORY_USAGE");
21
- const UDF_LOAD = require("./UDF_LOAD");
22
- const UDF_LIST = require("./UDF_LIST");
23
- const UDF_FLUSH = require("./UDF_FLUSH");
24
- const UDF_DELETE = require("./UDF_DELETE");
37
+ const CONFIG_GET = __importStar(require("./CONFIG_GET"));
38
+ const CONFIG_SET = __importStar(require("./CONFIG_SET"));
39
+ const DELETE = __importStar(require("./DELETE"));
40
+ const EXPLAIN = __importStar(require("./EXPLAIN"));
41
+ const INFO = __importStar(require("./INFO"));
42
+ const LIST = __importStar(require("./LIST"));
43
+ const PROFILE = __importStar(require("./PROFILE"));
44
+ const QUERY = __importStar(require("./QUERY"));
45
+ const RO_QUERY = __importStar(require("./RO_QUERY"));
46
+ const SLOWLOG = __importStar(require("./SLOWLOG"));
47
+ const STUBS = __importStar(require("./STUBS"));
48
+ const CONSTRAINT_CREATE = __importStar(require("./CONSTRAINT_CREATE"));
49
+ const CONSTRAINT_DROP = __importStar(require("./CONSTRAINT_DROP"));
50
+ const COPY = __importStar(require("./COPY"));
51
+ const SENTINEL_MASTER = __importStar(require("./SENTINEL_MASTER"));
52
+ const SENTINEL_MASTERS = __importStar(require("./SENTINEL_MASTERS"));
53
+ const MEMORY_USAGE = __importStar(require("./MEMORY_USAGE"));
54
+ const UDF_LOAD = __importStar(require("./UDF_LOAD"));
55
+ const UDF_LIST = __importStar(require("./UDF_LIST"));
56
+ const UDF_FLUSH = __importStar(require("./UDF_FLUSH"));
57
+ const UDF_DELETE = __importStar(require("./UDF_DELETE"));
25
58
  exports.default = {
26
59
  CONFIG_GET,
27
60
  configGet: CONFIG_GET,
@@ -66,7 +99,7 @@ exports.default = {
66
99
  UDF_DELETE,
67
100
  udfDelete: UDF_DELETE,
68
101
  };
69
- function pushQueryArguments(args, graph, query, options, compact) {
102
+ function pushQueryArguments(args, graph, query, options, compact, version) {
70
103
  args.push(graph);
71
104
  if (typeof options === 'number') {
72
105
  args.push(query);
@@ -80,6 +113,9 @@ function pushQueryArguments(args, graph, query, options, compact) {
80
113
  pushTimeout(args, options.TIMEOUT);
81
114
  }
82
115
  }
116
+ if (version !== undefined) {
117
+ args.push('version', version.toString());
118
+ }
83
119
  if (compact) {
84
120
  args.push('--compact');
85
121
  }
@@ -0,0 +1,4 @@
1
+ export declare enum ConstraintType {
2
+ MANDATORY = "MANDATORY",
3
+ UNIQUE = "UNIQUE"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConstraintType = void 0;
4
+ var ConstraintType;
5
+ (function (ConstraintType) {
6
+ ConstraintType["MANDATORY"] = "MANDATORY";
7
+ ConstraintType["UNIQUE"] = "UNIQUE";
8
+ })(ConstraintType || (exports.ConstraintType = ConstraintType = {}));
@@ -0,0 +1,4 @@
1
+ export declare enum EntityType {
2
+ NODE = "NODE",
3
+ RELATIONSHIP = "RELATIONSHIP"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityType = void 0;
4
+ var EntityType;
5
+ (function (EntityType) {
6
+ EntityType["NODE"] = "NODE";
7
+ EntityType["RELATIONSHIP"] = "RELATIONSHIP";
8
+ })(EntityType || (exports.EntityType = EntityType = {}));
@@ -0,0 +1,19 @@
1
+ export declare enum GraphValueTypes {
2
+ UNKNOWN = 0,
3
+ NULL = 1,
4
+ STRING = 2,
5
+ INTEGER = 3,
6
+ BOOLEAN = 4,
7
+ DOUBLE = 5,
8
+ ARRAY = 6,
9
+ EDGE = 7,
10
+ NODE = 8,
11
+ PATH = 9,
12
+ MAP = 10,
13
+ POINT = 11,
14
+ VECTORF32 = 12,
15
+ DATETIME = 13,
16
+ DATE = 14,
17
+ TIME = 15,
18
+ DURATION = 16
19
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GraphValueTypes = void 0;
4
+ // https://github.com/FalkorDB/FalkorDB/blob/master/src/resultset/formatters/resultset_formatter.h#L20
5
+ var GraphValueTypes;
6
+ (function (GraphValueTypes) {
7
+ GraphValueTypes[GraphValueTypes["UNKNOWN"] = 0] = "UNKNOWN";
8
+ GraphValueTypes[GraphValueTypes["NULL"] = 1] = "NULL";
9
+ GraphValueTypes[GraphValueTypes["STRING"] = 2] = "STRING";
10
+ GraphValueTypes[GraphValueTypes["INTEGER"] = 3] = "INTEGER";
11
+ GraphValueTypes[GraphValueTypes["BOOLEAN"] = 4] = "BOOLEAN";
12
+ GraphValueTypes[GraphValueTypes["DOUBLE"] = 5] = "DOUBLE";
13
+ GraphValueTypes[GraphValueTypes["ARRAY"] = 6] = "ARRAY";
14
+ GraphValueTypes[GraphValueTypes["EDGE"] = 7] = "EDGE";
15
+ GraphValueTypes[GraphValueTypes["NODE"] = 8] = "NODE";
16
+ GraphValueTypes[GraphValueTypes["PATH"] = 9] = "PATH";
17
+ GraphValueTypes[GraphValueTypes["MAP"] = 10] = "MAP";
18
+ GraphValueTypes[GraphValueTypes["POINT"] = 11] = "POINT";
19
+ GraphValueTypes[GraphValueTypes["VECTORF32"] = 12] = "VECTORF32";
20
+ GraphValueTypes[GraphValueTypes["DATETIME"] = 13] = "DATETIME";
21
+ GraphValueTypes[GraphValueTypes["DATE"] = 14] = "DATE";
22
+ GraphValueTypes[GraphValueTypes["TIME"] = 15] = "TIME";
23
+ GraphValueTypes[GraphValueTypes["DURATION"] = 16] = "DURATION";
24
+ })(GraphValueTypes || (exports.GraphValueTypes = GraphValueTypes = {}));
@@ -0,0 +1,3 @@
1
+ export * from './constraint-type';
2
+ export * from './entity-type';
3
+ export * from './graph-value-types';
@@ -0,0 +1,19 @@
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("./constraint-type"), exports);
18
+ __exportStar(require("./entity-type"), exports);
19
+ __exportStar(require("./graph-value-types"), exports);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The server rejected a query because the graph's schema (its labels,
3
+ * relationship types and property keys) no longer matches the version the
4
+ * client sent with it. The query was not executed.
5
+ */
6
+ export declare class SchemaVersionMismatchError extends Error {
7
+ /** The graph's current schema version. */
8
+ readonly version: number;
9
+ constructor(version: number);
10
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SchemaVersionMismatchError = void 0;
4
+ /**
5
+ * The server rejected a query because the graph's schema (its labels,
6
+ * relationship types and property keys) no longer matches the version the
7
+ * client sent with it. The query was not executed.
8
+ */
9
+ class SchemaVersionMismatchError extends Error {
10
+ /** The graph's current schema version. */
11
+ version;
12
+ constructor(version) {
13
+ super('version mismatch');
14
+ this.name = 'SchemaVersionMismatchError';
15
+ this.version = version;
16
+ }
17
+ }
18
+ exports.SchemaVersionMismatchError = SchemaVersionMismatchError;