falkordb 6.4.1 → 6.5.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/dist/index.d.ts +1 -1
- package/dist/src/clients/client.d.ts +5 -0
- package/dist/src/clients/cluster.d.ts +5 -0
- package/dist/src/clients/cluster.js +12 -0
- package/dist/src/clients/nullClient.d.ts +5 -0
- package/dist/src/clients/nullClient.js +12 -0
- package/dist/src/clients/single.d.ts +5 -0
- package/dist/src/clients/single.js +12 -0
- package/dist/src/commands/UDF_DELETE.d.ts +2 -0
- package/dist/src/commands/UDF_DELETE.js +6 -0
- package/dist/src/commands/UDF_FLUSH.d.ts +2 -0
- package/dist/src/commands/UDF_FLUSH.js +6 -0
- package/dist/src/commands/UDF_LIST.d.ts +5 -0
- package/dist/src/commands/UDF_LIST.js +15 -0
- package/dist/src/commands/UDF_LOAD.d.ts +2 -0
- package/dist/src/commands/UDF_LOAD.js +14 -0
- package/dist/src/commands/index.d.ts +13 -0
- package/dist/src/commands/index.js +12 -0
- package/dist/src/falkordb.d.ts +4 -0
- package/dist/src/falkordb.js +12 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ConstraintType, EntityType } from "../graph";
|
|
|
4
4
|
import FalkorDB from "../falkordb";
|
|
5
5
|
import { SingleGraphConnection } from "./single";
|
|
6
6
|
import { MemoryUsageOptions, MemoryUsageReply } from "../commands/MEMORY_USAGE";
|
|
7
|
+
import { UdfListReply } from "../commands/UDF_LIST";
|
|
7
8
|
export interface Client {
|
|
8
9
|
init(falkordb: FalkorDB): Promise<void>;
|
|
9
10
|
list(): Promise<Array<string>>;
|
|
@@ -25,6 +26,10 @@ export interface Client {
|
|
|
25
26
|
}[]>;
|
|
26
27
|
constraintCreate(graph: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Promise<void>;
|
|
27
28
|
constraintDrop(graph: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Promise<void>;
|
|
29
|
+
udfLoad(name: string, script: string | Function, replace?: boolean): Promise<string>;
|
|
30
|
+
udfList(lib?: string, withCode?: boolean): Promise<UdfListReply>;
|
|
31
|
+
udfFlush(): Promise<string>;
|
|
32
|
+
udfDelete(lib: string): Promise<string>;
|
|
28
33
|
/**
|
|
29
34
|
* @deprecated Use `disconnect` instead
|
|
30
35
|
*/
|
|
@@ -6,6 +6,7 @@ import { RedisClusterType } from "@redis/client";
|
|
|
6
6
|
import FalkorDB from "../falkordb";
|
|
7
7
|
import { SingleGraphConnection } from "./single";
|
|
8
8
|
import { MemoryUsageOptions, MemoryUsageReply } from "../commands/MEMORY_USAGE";
|
|
9
|
+
import { UdfListReply } from "../commands/UDF_LIST";
|
|
9
10
|
export type ClusterGraphConnection = RedisClusterType<{
|
|
10
11
|
falkordb: typeof commands;
|
|
11
12
|
}, RedisFunctions, RedisScripts>;
|
|
@@ -53,6 +54,10 @@ export declare class Cluster implements Client {
|
|
|
53
54
|
memoryUsage(graph: string, options?: MemoryUsageOptions): Promise<MemoryUsageReply>;
|
|
54
55
|
constraintCreate(graph: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Promise<void>;
|
|
55
56
|
constraintDrop(graph: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Promise<void>;
|
|
57
|
+
udfLoad(name: string, script: string | Function, replace?: boolean): Promise<string>;
|
|
58
|
+
udfList(lib?: string, withCode?: boolean): Promise<UdfListReply>;
|
|
59
|
+
udfFlush(): Promise<string>;
|
|
60
|
+
udfDelete(lib: string): Promise<string>;
|
|
56
61
|
profile<_T>(graph: string, query: string): Promise<string | number | (string | number | (string | number | (string | number | (string | number | (string | number | (string | number | (string | number | (string | number | (string | number | (string | number | (string | number | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined>;
|
|
57
62
|
quit(): Promise<void>;
|
|
58
63
|
disconnect(): Promise<void>;
|
|
@@ -86,6 +86,18 @@ class Cluster {
|
|
|
86
86
|
const reply = this.#client.falkordb.constraintDrop(graph, constraintType, entityType, label, ...properties);
|
|
87
87
|
return reply.then(() => { });
|
|
88
88
|
}
|
|
89
|
+
async udfLoad(name, script, replace = false) {
|
|
90
|
+
return this.#client.falkordb.udfLoad(name, script, replace);
|
|
91
|
+
}
|
|
92
|
+
async udfList(lib, withCode = false) {
|
|
93
|
+
return this.#client.falkordb.udfList(lib, withCode);
|
|
94
|
+
}
|
|
95
|
+
async udfFlush() {
|
|
96
|
+
return this.#client.falkordb.udfFlush();
|
|
97
|
+
}
|
|
98
|
+
async udfDelete(lib) {
|
|
99
|
+
return this.#client.falkordb.udfDelete(lib);
|
|
100
|
+
}
|
|
89
101
|
async profile(graph, query) {
|
|
90
102
|
return this.#client.falkordb.profile(graph, query);
|
|
91
103
|
}
|
|
@@ -5,6 +5,7 @@ import { ConstraintType, EntityType } from "../graph";
|
|
|
5
5
|
import { Client } from "./client";
|
|
6
6
|
import { SingleGraphConnection } from "./single";
|
|
7
7
|
import { MemoryUsageOptions, MemoryUsageReply } from "../commands/MEMORY_USAGE";
|
|
8
|
+
import { UdfListReply } from "../commands/UDF_LIST";
|
|
8
9
|
/**
|
|
9
10
|
* The `NullClient` class is a placeholder implementation of the `Client` interface.
|
|
10
11
|
*
|
|
@@ -38,6 +39,10 @@ export declare class NullClient implements Client {
|
|
|
38
39
|
memoryUsage(_graph: string, _options?: MemoryUsageOptions): Promise<MemoryUsageReply>;
|
|
39
40
|
constraintCreate(_graph: string, _constraintType: ConstraintType, _entityType: EntityType, _label: string, ..._properties: string[]): Promise<void>;
|
|
40
41
|
constraintDrop(_graph: string, _constraintType: ConstraintType, _entityType: EntityType, _label: string, ..._properties: string[]): Promise<void>;
|
|
42
|
+
udfLoad(_name: string, _script: string | Function, _replace?: boolean): Promise<string>;
|
|
43
|
+
udfList(_lib?: string, _withCode?: boolean): Promise<UdfListReply>;
|
|
44
|
+
udfFlush(): Promise<string>;
|
|
45
|
+
udfDelete(_lib: string): Promise<string>;
|
|
41
46
|
quit(): Promise<void>;
|
|
42
47
|
disconnect(): Promise<void>;
|
|
43
48
|
}
|
|
@@ -61,6 +61,18 @@ class NullClient {
|
|
|
61
61
|
constraintDrop(_graph, _constraintType, _entityType, _label, ..._properties) {
|
|
62
62
|
throw new Error("Method not implemented.");
|
|
63
63
|
}
|
|
64
|
+
udfLoad(_name, _script, _replace) {
|
|
65
|
+
throw new Error("Method not implemented.");
|
|
66
|
+
}
|
|
67
|
+
udfList(_lib, _withCode) {
|
|
68
|
+
throw new Error("Method not implemented.");
|
|
69
|
+
}
|
|
70
|
+
udfFlush() {
|
|
71
|
+
throw new Error("Method not implemented.");
|
|
72
|
+
}
|
|
73
|
+
udfDelete(_lib) {
|
|
74
|
+
throw new Error("Method not implemented.");
|
|
75
|
+
}
|
|
64
76
|
quit() {
|
|
65
77
|
throw new Error("Method not implemented.");
|
|
66
78
|
}
|
|
@@ -5,6 +5,7 @@ import commands, { QueryOptions } from "../commands";
|
|
|
5
5
|
import { RedisClientType } from "@redis/client";
|
|
6
6
|
import FalkorDB from "../falkordb";
|
|
7
7
|
import { MemoryUsageOptions, MemoryUsageReply } from "../commands/MEMORY_USAGE";
|
|
8
|
+
import { UdfListReply } from "../commands/UDF_LIST";
|
|
8
9
|
export type SingleGraphConnection = RedisClientType<{
|
|
9
10
|
falkordb: typeof commands;
|
|
10
11
|
}, RedisFunctions, RedisScripts>;
|
|
@@ -47,6 +48,10 @@ export declare class Single implements Client {
|
|
|
47
48
|
memoryUsage(graph: string, options?: MemoryUsageOptions): Promise<MemoryUsageReply>;
|
|
48
49
|
constraintCreate(graph: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Promise<void>;
|
|
49
50
|
constraintDrop(graph: string, constraintType: ConstraintType, entityType: EntityType, label: string, ...properties: string[]): Promise<void>;
|
|
51
|
+
udfLoad(name: string, script: string | Function, replace?: boolean): Promise<string>;
|
|
52
|
+
udfList(lib?: string, withCode?: boolean): Promise<UdfListReply>;
|
|
53
|
+
udfFlush(): Promise<string>;
|
|
54
|
+
udfDelete(lib: string): Promise<string>;
|
|
50
55
|
copy<_T>(srcGraph: string, destGraph: string): Promise<"OK">;
|
|
51
56
|
quit(): Promise<void>;
|
|
52
57
|
disconnect(): Promise<void>;
|
|
@@ -90,6 +90,18 @@ class Single {
|
|
|
90
90
|
const reply = this.client.falkordb.constraintDrop(graph, constraintType, entityType, label, ...properties);
|
|
91
91
|
return reply.then(() => { });
|
|
92
92
|
}
|
|
93
|
+
async udfLoad(name, script, replace = false) {
|
|
94
|
+
return this.client.falkordb.udfLoad(name, script, replace);
|
|
95
|
+
}
|
|
96
|
+
async udfList(lib, withCode = false) {
|
|
97
|
+
return this.client.falkordb.udfList(lib, withCode);
|
|
98
|
+
}
|
|
99
|
+
async udfFlush() {
|
|
100
|
+
return this.client.falkordb.udfFlush();
|
|
101
|
+
}
|
|
102
|
+
async udfDelete(lib) {
|
|
103
|
+
return this.client.falkordb.udfDelete(lib);
|
|
104
|
+
}
|
|
93
105
|
async copy(srcGraph, destGraph) {
|
|
94
106
|
return this.client.falkordb.copy(srcGraph, destGraph);
|
|
95
107
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const IS_READ_ONLY = true;
|
|
2
|
+
export type UdfLibraryEntry = [string, string[]] | [string, string[], string];
|
|
3
|
+
export type UdfListReply = UdfLibraryEntry[];
|
|
4
|
+
export declare function transformArguments(lib?: string, withCode?: boolean): Array<string>;
|
|
5
|
+
export declare function transformReply(): UdfListReply;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IS_READ_ONLY = void 0;
|
|
4
|
+
exports.transformArguments = transformArguments;
|
|
5
|
+
exports.IS_READ_ONLY = true;
|
|
6
|
+
function transformArguments(lib, withCode = false) {
|
|
7
|
+
const args = ['GRAPH.UDF', 'LIST'];
|
|
8
|
+
if (lib !== undefined) {
|
|
9
|
+
args.push(lib);
|
|
10
|
+
}
|
|
11
|
+
if (withCode) {
|
|
12
|
+
args.push('WITHCODE');
|
|
13
|
+
}
|
|
14
|
+
return args;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = transformArguments;
|
|
4
|
+
function transformArguments(name, script, replace = false) {
|
|
5
|
+
const args = ['GRAPH.UDF', 'LOAD'];
|
|
6
|
+
if (replace) {
|
|
7
|
+
args.push('REPLACE');
|
|
8
|
+
}
|
|
9
|
+
args.push(name);
|
|
10
|
+
// If script is a function, convert it to string
|
|
11
|
+
const scriptStr = typeof script === 'function' ? script.toString() : script;
|
|
12
|
+
args.push(scriptStr);
|
|
13
|
+
return args;
|
|
14
|
+
}
|
|
@@ -14,6 +14,10 @@ import * as COPY from './COPY';
|
|
|
14
14
|
import * as SENTINEL_MASTER from './SENTINEL_MASTER';
|
|
15
15
|
import * as SENTINEL_MASTERS from './SENTINEL_MASTERS';
|
|
16
16
|
import * as MEMORY_USAGE from './MEMORY_USAGE';
|
|
17
|
+
import * as UDF_LOAD from './UDF_LOAD';
|
|
18
|
+
import * as UDF_LIST from './UDF_LIST';
|
|
19
|
+
import * as UDF_FLUSH from './UDF_FLUSH';
|
|
20
|
+
import * as UDF_DELETE from './UDF_DELETE';
|
|
17
21
|
import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
18
22
|
declare const _default: {
|
|
19
23
|
CONFIG_GET: typeof CONFIG_GET;
|
|
@@ -48,6 +52,14 @@ declare const _default: {
|
|
|
48
52
|
sentinelMasters: typeof SENTINEL_MASTERS;
|
|
49
53
|
MEMORY_USAGE: typeof MEMORY_USAGE;
|
|
50
54
|
memoryUsage: typeof MEMORY_USAGE;
|
|
55
|
+
UDF_LOAD: typeof UDF_LOAD;
|
|
56
|
+
udfLoad: typeof UDF_LOAD;
|
|
57
|
+
UDF_LIST: typeof UDF_LIST;
|
|
58
|
+
udfList: typeof UDF_LIST;
|
|
59
|
+
UDF_FLUSH: typeof UDF_FLUSH;
|
|
60
|
+
udfFlush: typeof UDF_FLUSH;
|
|
61
|
+
UDF_DELETE: typeof UDF_DELETE;
|
|
62
|
+
udfDelete: typeof UDF_DELETE;
|
|
51
63
|
};
|
|
52
64
|
export default _default;
|
|
53
65
|
type QueryParam = null | string | number | boolean | QueryParams | Array<QueryParam>;
|
|
@@ -60,3 +72,4 @@ export interface QueryOptions {
|
|
|
60
72
|
}
|
|
61
73
|
export type QueryOptionsBackwardCompatible = QueryOptions | number;
|
|
62
74
|
export declare function pushQueryArguments(args: RedisCommandArguments, graph: RedisCommandArgument, query: RedisCommandArgument, options?: QueryOptionsBackwardCompatible, compact?: boolean): RedisCommandArguments;
|
|
75
|
+
export { UdfListReply, UdfLibraryEntry } from './UDF_LIST';
|
|
@@ -17,6 +17,10 @@ const COPY = require("./COPY");
|
|
|
17
17
|
const SENTINEL_MASTER = require("./SENTINEL_MASTER");
|
|
18
18
|
const SENTINEL_MASTERS = require("./SENTINEL_MASTERS");
|
|
19
19
|
const MEMORY_USAGE = require("./MEMORY_USAGE");
|
|
20
|
+
const UDF_LOAD = require("./UDF_LOAD");
|
|
21
|
+
const UDF_LIST = require("./UDF_LIST");
|
|
22
|
+
const UDF_FLUSH = require("./UDF_FLUSH");
|
|
23
|
+
const UDF_DELETE = require("./UDF_DELETE");
|
|
20
24
|
exports.default = {
|
|
21
25
|
CONFIG_GET,
|
|
22
26
|
configGet: CONFIG_GET,
|
|
@@ -50,6 +54,14 @@ exports.default = {
|
|
|
50
54
|
sentinelMasters: SENTINEL_MASTERS,
|
|
51
55
|
MEMORY_USAGE,
|
|
52
56
|
memoryUsage: MEMORY_USAGE,
|
|
57
|
+
UDF_LOAD,
|
|
58
|
+
udfLoad: UDF_LOAD,
|
|
59
|
+
UDF_LIST,
|
|
60
|
+
udfList: UDF_LIST,
|
|
61
|
+
UDF_FLUSH,
|
|
62
|
+
udfFlush: UDF_FLUSH,
|
|
63
|
+
UDF_DELETE,
|
|
64
|
+
udfDelete: UDF_DELETE,
|
|
53
65
|
};
|
|
54
66
|
function pushQueryArguments(args, graph, query, options, compact) {
|
|
55
67
|
args.push(graph);
|
package/dist/src/falkordb.d.ts
CHANGED
|
@@ -90,6 +90,10 @@ export default class FalkorDB extends EventEmitter {
|
|
|
90
90
|
configGet(configKey: string): Promise<(string | number)[] | (string | number)[][]>;
|
|
91
91
|
configSet(configKey: string, value: number | string): Promise<void>;
|
|
92
92
|
info(section?: string): Promise<(string | string[])[]>;
|
|
93
|
+
udfLoad(name: string, script: string | Function, replace?: boolean): Promise<string>;
|
|
94
|
+
udfList(lib?: string, withCode?: boolean): Promise<import("./commands").UdfListReply>;
|
|
95
|
+
udfFlush(): Promise<string>;
|
|
96
|
+
udfDelete(lib: string): Promise<string>;
|
|
93
97
|
/**
|
|
94
98
|
* Closes the client.
|
|
95
99
|
*/
|
package/dist/src/falkordb.js
CHANGED
|
@@ -66,6 +66,18 @@ class FalkorDB extends events_1.EventEmitter {
|
|
|
66
66
|
async info(section) {
|
|
67
67
|
return this.#client.info(section);
|
|
68
68
|
}
|
|
69
|
+
async udfLoad(name, script, replace = false) {
|
|
70
|
+
return this.#client.udfLoad(name, script, replace);
|
|
71
|
+
}
|
|
72
|
+
async udfList(lib, withCode = false) {
|
|
73
|
+
return this.#client.udfList(lib, withCode);
|
|
74
|
+
}
|
|
75
|
+
async udfFlush() {
|
|
76
|
+
return this.#client.udfFlush();
|
|
77
|
+
}
|
|
78
|
+
async udfDelete(lib) {
|
|
79
|
+
return this.#client.udfDelete(lib);
|
|
80
|
+
}
|
|
69
81
|
/**
|
|
70
82
|
* Closes the client.
|
|
71
83
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "falkordb",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "A FalkorDB javascript library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@tsconfig/node20": "^20.1.4",
|
|
40
40
|
"@types/jest": "^29.5.14",
|
|
41
41
|
"@types/lodash": "^4.17.13",
|
|
42
|
-
"@types/node": "^
|
|
42
|
+
"@types/node": "^25.0.2",
|
|
43
43
|
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
|
44
44
|
"@typescript-eslint/parser": "^8.18.2",
|
|
45
45
|
"eslint": "^9.17.0",
|