rice-node-sdk 1.0.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.
@@ -0,0 +1,189 @@
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
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.StateClient = void 0;
37
+ const grpc = __importStar(require("@grpc/grpc-js"));
38
+ const protoLoader = __importStar(require("@grpc/proto-loader"));
39
+ const path = __importStar(require("path"));
40
+ // For library usage, we expect proto file to be in ./proto relative to built file
41
+ // But since we use protoLoader, we need the file present.
42
+ const PROTO_PATH = path.join(__dirname, "proto", "state.proto");
43
+ /**
44
+ * Client for interacting with State (AI Memory).
45
+ * Provides methods for managing conversational memory, drift, and skills.
46
+ */
47
+ class StateClient {
48
+ /**
49
+ * Creates an instance of StateClient.
50
+ * @param address - The address of the State service (e.g., "localhost:50051").
51
+ * @param token - Optional authorization token.
52
+ * @param runId - Unique identifier for the current run/session. Defaults to "default".
53
+ */
54
+ constructor(address = "localhost:50051", token, runId = "default") {
55
+ const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
56
+ keepCase: true,
57
+ longs: String,
58
+ enums: String,
59
+ defaults: true,
60
+ oneofs: true,
61
+ });
62
+ const protoDescriptor = grpc.loadPackageDefinition(packageDefinition);
63
+ // Internal usage: The proto package is still 'slate' for compatibility
64
+ const slate = protoDescriptor.slate;
65
+ this.client = new slate.Cortex(address, grpc.credentials.createInsecure());
66
+ this.metadata = new grpc.Metadata();
67
+ if (token) {
68
+ this.metadata.add("authorization", token);
69
+ }
70
+ this.runId = runId;
71
+ }
72
+ /**
73
+ * Sets the run ID for subsequent operations.
74
+ * @param runId - The new run ID to use.
75
+ */
76
+ setRunId(runId) {
77
+ this.runId = runId;
78
+ }
79
+ /**
80
+ * Focuses the state on a specific content or context.
81
+ * @param content - The content to focus on.
82
+ * @returns A promise that resolves to the ID of the focus operation.
83
+ */
84
+ focus(content) {
85
+ return new Promise((resolve, reject) => {
86
+ this.client.Focus({ content, run_id: this.runId }, this.metadata, (err, response) => {
87
+ if (err)
88
+ reject(err);
89
+ else
90
+ resolve(response.id);
91
+ });
92
+ });
93
+ }
94
+ /**
95
+ * Retrieves the current drift or context drift items.
96
+ * @returns A promise that resolves to an array of drift items.
97
+ */
98
+ drift() {
99
+ return new Promise((resolve, reject) => {
100
+ this.client.Drift({ run_id: this.runId }, this.metadata, (err, response) => {
101
+ if (err)
102
+ reject(err);
103
+ else
104
+ resolve(response.items || []);
105
+ });
106
+ });
107
+ }
108
+ /**
109
+ * Commits a trace of an interaction (input/outcome) to memory.
110
+ * @param input - The input or prompt.
111
+ * @param outcome - The result or response.
112
+ * @param options - Optional parameters including action, reasoning, and agent_id.
113
+ * @returns A promise that resolves to true if successful.
114
+ */
115
+ commit(input, outcome, options) {
116
+ return new Promise((resolve, reject) => {
117
+ const trace = {
118
+ input,
119
+ outcome,
120
+ reasoning: options?.reasoning || "Node Client",
121
+ action: options?.action || "Action",
122
+ agent_id: options?.agent_id || "node-user",
123
+ embedding: [], // Mock
124
+ run_id: this.runId,
125
+ };
126
+ this.client.Commit(trace, this.metadata, (err, response) => {
127
+ if (err)
128
+ reject(err);
129
+ else
130
+ resolve(response.success);
131
+ });
132
+ });
133
+ }
134
+ /**
135
+ * Recalls past memories relevant to a query.
136
+ * @param query - The query text to search for memories.
137
+ * @param limit - Maximum number of memories to retrieve. Defaults to 5.
138
+ * @returns A promise that resolves to an array of traces/memories.
139
+ */
140
+ reminisce(query, limit = 5) {
141
+ return new Promise((resolve, reject) => {
142
+ const req = {
143
+ embedding: [],
144
+ limit,
145
+ query_text: query,
146
+ run_id: this.runId,
147
+ };
148
+ this.client.Reminisce(req, this.metadata, (err, response) => {
149
+ if (err)
150
+ reject(err);
151
+ else
152
+ resolve(response.traces || []);
153
+ });
154
+ });
155
+ }
156
+ /**
157
+ * Triggers a specific skill or action.
158
+ * @param skillName - The name of the skill to trigger.
159
+ * @returns A promise that resolves to the result code (number).
160
+ */
161
+ trigger(skillName) {
162
+ return new Promise((resolve, reject) => {
163
+ const req = {
164
+ skill_name: skillName,
165
+ };
166
+ this.client.Trigger(req, this.metadata, (err, response) => {
167
+ if (err)
168
+ reject(err);
169
+ else
170
+ resolve(response.result);
171
+ });
172
+ });
173
+ }
174
+ /**
175
+ * Deletes the current run/session and its associated data.
176
+ * @returns A promise that resolves to true if successful.
177
+ */
178
+ deleteRun() {
179
+ return new Promise((resolve, reject) => {
180
+ this.client.DeleteRun({ run_id: this.runId }, this.metadata, (err, response) => {
181
+ if (err)
182
+ reject(err);
183
+ else
184
+ resolve(response.success);
185
+ });
186
+ });
187
+ }
188
+ }
189
+ exports.StateClient = StateClient;
@@ -0,0 +1,100 @@
1
+ syntax = "proto3";
2
+ package slate;
3
+
4
+ service Cortex {
5
+ // Flux
6
+ rpc Focus(FocusRequest) returns (FocusResponse);
7
+ rpc Drift(DriftRequest) returns (DriftResponse);
8
+
9
+ // Echoes
10
+ rpc Commit(Trace) returns (Ack);
11
+ rpc Reminisce(RecallRequest) returns (RecallResponse);
12
+
13
+ // Nexus
14
+ rpc Consult(QueryRequest) returns (KnowledgeResponse);
15
+
16
+ // Reflex
17
+ rpc Trigger(ReflexRequest) returns (ExecutionResult);
18
+
19
+ // Management
20
+ rpc DeleteRun(RunRequest) returns (Ack);
21
+ }
22
+
23
+ message FocusRequest {
24
+ string content = 1;
25
+ string run_id = 2;
26
+ }
27
+
28
+ message FocusResponse {
29
+ string id = 1;
30
+ }
31
+
32
+ message DriftRequest {
33
+ string run_id = 1;
34
+ }
35
+
36
+ message DriftResponse {
37
+ repeated FluxItem items = 1;
38
+ }
39
+
40
+ message FluxItem {
41
+ string id = 1;
42
+ string content = 2;
43
+ float relevance = 3;
44
+ }
45
+
46
+ message Trace {
47
+ string input = 1;
48
+ string reasoning = 2;
49
+ string action = 3;
50
+ string outcome = 4;
51
+ string agent_id = 5;
52
+ repeated float embedding = 6;
53
+ string run_id = 7;
54
+ }
55
+
56
+ message Ack {
57
+ bool success = 1;
58
+ }
59
+
60
+ message RecallRequest {
61
+ repeated float embedding = 1;
62
+ uint64 limit = 2;
63
+ string query_text = 3;
64
+ string filter = 4;
65
+ string run_id = 5;
66
+ }
67
+
68
+ message RecallResponse {
69
+ repeated Trace traces = 1;
70
+ }
71
+
72
+ message QueryRequest {
73
+ repeated float embedding = 1;
74
+ uint64 limit = 2;
75
+ string query_text = 3;
76
+ string filter = 4;
77
+ string run_id = 5;
78
+ }
79
+
80
+ message RunRequest {
81
+ string run_id = 1;
82
+ }
83
+
84
+ message KnowledgeResponse {
85
+ repeated Fact facts = 1;
86
+ }
87
+
88
+ message Fact {
89
+ string id = 1;
90
+ string content = 2;
91
+ string source = 3;
92
+ }
93
+
94
+ message ReflexRequest {
95
+ string skill_name = 1;
96
+ }
97
+
98
+ message ExecutionResult {
99
+ int32 result = 1;
100
+ }
@@ -0,0 +1,97 @@
1
+ import { execute } from "../tools/execute";
2
+ export declare const statetool: {
3
+ google: ({
4
+ name: string;
5
+ description: string;
6
+ parameters: {
7
+ type: string;
8
+ properties: {
9
+ content: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ query?: undefined;
14
+ };
15
+ required: string[];
16
+ };
17
+ } | {
18
+ name: string;
19
+ description: string;
20
+ parameters: {
21
+ type: string;
22
+ properties: {
23
+ query: {
24
+ type: string;
25
+ description: string;
26
+ };
27
+ content?: undefined;
28
+ };
29
+ required: string[];
30
+ };
31
+ })[];
32
+ openai: ({
33
+ type: string;
34
+ function: {
35
+ name: string;
36
+ description: string;
37
+ parameters: {
38
+ type: string;
39
+ properties: {
40
+ content: {
41
+ type: string;
42
+ description: string;
43
+ };
44
+ query?: undefined;
45
+ };
46
+ required: string[];
47
+ };
48
+ };
49
+ } | {
50
+ type: string;
51
+ function: {
52
+ name: string;
53
+ description: string;
54
+ parameters: {
55
+ type: string;
56
+ properties: {
57
+ query: {
58
+ type: string;
59
+ description: string;
60
+ };
61
+ content?: undefined;
62
+ };
63
+ required: string[];
64
+ };
65
+ };
66
+ })[];
67
+ anthropic: ({
68
+ name: string;
69
+ description: string;
70
+ input_schema: {
71
+ type: string;
72
+ properties: {
73
+ content: {
74
+ type: string;
75
+ description: string;
76
+ };
77
+ query?: undefined;
78
+ };
79
+ required: string[];
80
+ };
81
+ } | {
82
+ name: string;
83
+ description: string;
84
+ input_schema: {
85
+ type: string;
86
+ properties: {
87
+ query: {
88
+ type: string;
89
+ description: string;
90
+ };
91
+ content?: undefined;
92
+ };
93
+ required: string[];
94
+ };
95
+ })[];
96
+ execute: typeof execute;
97
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.statetool = void 0;
4
+ const google_1 = require("../tools/google");
5
+ const openai_1 = require("../tools/openai");
6
+ const anthropic_1 = require("../tools/anthropic");
7
+ const execute_1 = require("../tools/execute");
8
+ exports.statetool = {
9
+ google: google_1.state,
10
+ openai: openai_1.state,
11
+ anthropic: anthropic_1.state,
12
+ execute: execute_1.execute,
13
+ };
@@ -0,0 +1,133 @@
1
+ import { BitVector } from "../utils/BitVector";
2
+ import Long from "long";
3
+ export interface HealthInfo {
4
+ status: string;
5
+ version: string;
6
+ }
7
+ export interface InsertResult {
8
+ success: boolean;
9
+ nodeId: Long;
10
+ message: string;
11
+ aclGrants?: any;
12
+ aclUsers?: any[];
13
+ }
14
+ export interface SearchResultItem {
15
+ id: Long;
16
+ similarity: number;
17
+ metadata: any;
18
+ }
19
+ export interface MemoryEntry {
20
+ id: string;
21
+ sessionId: string;
22
+ agentId: string;
23
+ content: string;
24
+ timestamp: Long;
25
+ metadata: {
26
+ [key: string]: string;
27
+ };
28
+ expiresAt?: Long;
29
+ }
30
+ export declare abstract class BaseRiceDBClient {
31
+ protected host: string;
32
+ protected port: number;
33
+ protected connected: boolean;
34
+ constructor(host?: string, port?: number);
35
+ abstract connect(): Promise<boolean>;
36
+ abstract disconnect(): void;
37
+ abstract health(): Promise<HealthInfo>;
38
+ abstract login(username: string, password: string): Promise<string>;
39
+ abstract createUser(username: string, password: string, role?: string): Promise<Long>;
40
+ abstract deleteUser(username: string): Promise<boolean>;
41
+ abstract getUser(username: string): Promise<any>;
42
+ abstract listUsers(): Promise<any[]>;
43
+ abstract insert(nodeId: Long | number | string, text: string, metadata: any, userId?: Long | number | string, sessionId?: string, embedding?: number[]): Promise<InsertResult>;
44
+ abstract search(query: string, userId: Long | number | string, k?: number, sessionId?: string, filter?: {
45
+ [key: string]: any;
46
+ }, queryEmbedding?: number[]): Promise<SearchResultItem[]>;
47
+ abstract delete(nodeId: Long | number | string, sessionId?: string): Promise<boolean>;
48
+ abstract createSession(parentSessionId?: string): Promise<string>;
49
+ abstract snapshotSession(sessionId: string, path: string): Promise<boolean>;
50
+ abstract loadSession(path: string): Promise<string>;
51
+ abstract commitSession(sessionId: string, mergeStrategy?: string): Promise<boolean>;
52
+ abstract dropSession(sessionId: string): Promise<boolean>;
53
+ abstract writeMemory(address: BitVector, data: BitVector, userId?: Long | number | string): Promise<{
54
+ success: boolean;
55
+ message: string;
56
+ }>;
57
+ abstract readMemory(address: BitVector, userId?: Long | number | string): Promise<BitVector>;
58
+ abstract addMemory(sessionId: string, agentId: string, content: string, metadata?: {
59
+ [key: string]: string;
60
+ }, ttlSeconds?: number): Promise<{
61
+ success: boolean;
62
+ message: string;
63
+ entry: MemoryEntry;
64
+ }>;
65
+ abstract getMemory(sessionId: string, limit?: number, after?: number | Long, filter?: {
66
+ [key: string]: string;
67
+ }): Promise<MemoryEntry[]>;
68
+ abstract clearMemory(sessionId: string): Promise<{
69
+ success: boolean;
70
+ message: string;
71
+ }>;
72
+ abstract watchMemory(sessionId: string): AsyncIterable<any>;
73
+ /**
74
+ * Create a semantic link between two nodes.
75
+ * Alias for addEdge.
76
+ */
77
+ link(sourceId: Long | number | string, relation: string, targetId: Long | number | string, weight?: number): Promise<boolean>;
78
+ abstract addEdge(fromNode: Long | number | string, toNode: Long | number | string, relation: string, weight?: number): Promise<boolean>;
79
+ abstract getNeighbors(nodeId: Long | number | string, relation?: string): Promise<Long[]>;
80
+ abstract traverse(startNode: Long | number | string, maxDepth?: number): Promise<Long[]>;
81
+ abstract sampleGraph(limit?: number): Promise<any>;
82
+ abstract subscribe(filterType?: string, nodeId?: Long | number | string, queryText?: string, threshold?: number): AsyncIterable<any>;
83
+ abstract batchInsert(documents: any[], userId?: Long | number | string): Promise<{
84
+ count: number;
85
+ nodeIds: Long[];
86
+ }>;
87
+ /**
88
+ * High-performance bulk ingestion using batches and concurrency.
89
+ *
90
+ * @param documents List of documents to insert
91
+ * @param batchSize Number of documents per batch (default 500)
92
+ * @param concurrency Number of concurrent requests (default 4)
93
+ * @param userId User ID to own the documents
94
+ */
95
+ fastIngest(documents: any[], batchSize?: number, concurrency?: number, userId?: Long | number | string): Promise<{
96
+ totalInserted: number;
97
+ failedBatches: number;
98
+ errors: string[];
99
+ timeTaken: number;
100
+ throughput: number;
101
+ }>;
102
+ abstract grantPermission(nodeId: Long | number | string, userId: Long | number | string, permissions: {
103
+ read?: boolean;
104
+ write?: boolean;
105
+ delete?: boolean;
106
+ }): Promise<boolean>;
107
+ abstract revokePermission(nodeId: Long | number | string, userId: Long | number | string): Promise<boolean>;
108
+ abstract checkPermission(nodeId: Long | number | string, userId: Long | number | string, permissionType: string): Promise<boolean>;
109
+ abstract batchGrant(grants: Array<{
110
+ nodeId: Long | number | string;
111
+ userId: Long | number | string;
112
+ permissions: {
113
+ read?: boolean;
114
+ write?: boolean;
115
+ delete?: boolean;
116
+ };
117
+ }>): Promise<{
118
+ total: number;
119
+ successful: number;
120
+ failed: number;
121
+ results: any[];
122
+ errors: any[];
123
+ }>;
124
+ abstract insertWithAcl(nodeId: Long | number | string, text: string, metadata: any, userPermissions: Array<{
125
+ userId: Long | number | string;
126
+ permissions: {
127
+ read?: boolean;
128
+ write?: boolean;
129
+ delete?: boolean;
130
+ };
131
+ }>): Promise<InsertResult>;
132
+ protected toLong(val: Long | number | string): Long;
133
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BaseRiceDBClient = void 0;
7
+ const long_1 = __importDefault(require("long"));
8
+ class BaseRiceDBClient {
9
+ constructor(host = "localhost", port = 3000) {
10
+ this.connected = false;
11
+ this.host = host;
12
+ this.port = port;
13
+ }
14
+ // Graph
15
+ /**
16
+ * Create a semantic link between two nodes.
17
+ * Alias for addEdge.
18
+ */
19
+ async link(sourceId, relation, targetId, weight = 1.0) {
20
+ return this.addEdge(sourceId, targetId, relation, weight);
21
+ }
22
+ /**
23
+ * High-performance bulk ingestion using batches and concurrency.
24
+ *
25
+ * @param documents List of documents to insert
26
+ * @param batchSize Number of documents per batch (default 500)
27
+ * @param concurrency Number of concurrent requests (default 4)
28
+ * @param userId User ID to own the documents
29
+ */
30
+ async fastIngest(documents, batchSize = 500, concurrency = 4, userId) {
31
+ const startTime = Date.now();
32
+ let totalInserted = 0;
33
+ let failedBatches = 0;
34
+ const errors = [];
35
+ // Create chunks
36
+ const chunks = [];
37
+ for (let i = 0; i < documents.length; i += batchSize) {
38
+ chunks.push(documents.slice(i, i + batchSize));
39
+ }
40
+ // Process with concurrency
41
+ const queue = [...chunks];
42
+ const processChunk = async (chunk) => {
43
+ try {
44
+ const result = await this.batchInsert(chunk, userId);
45
+ totalInserted += result.count;
46
+ }
47
+ catch (e) {
48
+ failedBatches++;
49
+ if (errors.length < 10) {
50
+ errors.push(e.message || String(e));
51
+ }
52
+ }
53
+ };
54
+ const workers = Array(Math.min(concurrency, chunks.length))
55
+ .fill(null)
56
+ .map(async () => {
57
+ while (queue.length > 0) {
58
+ const chunk = queue.shift();
59
+ if (chunk) {
60
+ await processChunk(chunk);
61
+ }
62
+ }
63
+ });
64
+ await Promise.all(workers);
65
+ const endTime = Date.now();
66
+ const timeTaken = (endTime - startTime) / 1000;
67
+ const throughput = timeTaken > 0 ? totalInserted / timeTaken : 0;
68
+ return {
69
+ totalInserted,
70
+ failedBatches,
71
+ errors,
72
+ timeTaken,
73
+ throughput,
74
+ };
75
+ }
76
+ // Helper to convert inputs to Long
77
+ toLong(val) {
78
+ return long_1.default.fromValue(val);
79
+ }
80
+ }
81
+ exports.BaseRiceDBClient = BaseRiceDBClient;
@@ -0,0 +1,87 @@
1
+ import { BaseRiceDBClient, HealthInfo, InsertResult, SearchResultItem, MemoryEntry } from "./BaseClient";
2
+ import Long from "long";
3
+ import { BitVector } from "../utils/BitVector";
4
+ export declare class GrpcClient extends BaseRiceDBClient {
5
+ private client;
6
+ private token;
7
+ constructor(host?: string, port?: number, token?: string);
8
+ connect(): Promise<boolean>;
9
+ disconnect(): void;
10
+ private getMetadata;
11
+ private promisify;
12
+ health(): Promise<HealthInfo>;
13
+ login(username: string, password: string): Promise<string>;
14
+ createUser(username: string, password: string, role?: string): Promise<Long>;
15
+ deleteUser(username: string): Promise<boolean>;
16
+ getUser(username: string): Promise<any>;
17
+ listUsers(): Promise<any[]>;
18
+ insert(nodeId: Long | number | string, text: string, metadata: any, userId?: Long | number | string, sessionId?: string, embedding?: number[]): Promise<InsertResult>;
19
+ search(query: string, userId: Long | number | string, k?: number, sessionId?: string, filter?: {
20
+ [key: string]: any;
21
+ }, queryEmbedding?: number[]): Promise<SearchResultItem[]>;
22
+ delete(nodeId: Long | number | string, sessionId?: string): Promise<boolean>;
23
+ createSession(parentSessionId?: string): Promise<string>;
24
+ snapshotSession(sessionId: string, path: string): Promise<boolean>;
25
+ loadSession(path: string): Promise<string>;
26
+ commitSession(sessionId: string, mergeStrategy?: string): Promise<boolean>;
27
+ dropSession(sessionId: string): Promise<boolean>;
28
+ writeMemory(address: BitVector, data: BitVector, userId?: Long | number | string): Promise<{
29
+ success: boolean;
30
+ message: string;
31
+ }>;
32
+ readMemory(address: BitVector, userId?: Long | number | string): Promise<BitVector>;
33
+ addMemory(sessionId: string, agentId: string, content: string, metadata?: {
34
+ [key: string]: string;
35
+ }, ttlSeconds?: number): Promise<{
36
+ success: boolean;
37
+ message: string;
38
+ entry: MemoryEntry;
39
+ }>;
40
+ getMemory(sessionId: string, limit?: number, after?: number | Long, filter?: {
41
+ [key: string]: string;
42
+ }): Promise<MemoryEntry[]>;
43
+ clearMemory(sessionId: string): Promise<{
44
+ success: boolean;
45
+ message: string;
46
+ }>;
47
+ watchMemory(sessionId: string): AsyncIterable<any>;
48
+ addEdge(fromNode: Long | number | string, toNode: Long | number | string, relation: string, weight?: number): Promise<boolean>;
49
+ getNeighbors(nodeId: Long | number | string, relation?: string): Promise<Long[]>;
50
+ traverse(startNode: Long | number | string, maxDepth?: number): Promise<Long[]>;
51
+ sampleGraph(limit?: number): Promise<any>;
52
+ subscribe(filterType?: string, nodeId?: Long | number | string, queryText?: string, threshold?: number): AsyncIterable<any>;
53
+ batchInsert(documents: any[], userId?: Long | number | string): Promise<{
54
+ count: number;
55
+ nodeIds: Long[];
56
+ }>;
57
+ grantPermission(nodeId: Long | number | string, userId: Long | number | string, permissions: {
58
+ read?: boolean;
59
+ write?: boolean;
60
+ delete?: boolean;
61
+ }): Promise<boolean>;
62
+ revokePermission(nodeId: Long | number | string, userId: Long | number | string): Promise<boolean>;
63
+ checkPermission(nodeId: Long | number | string, userId: Long | number | string, permissionType: string): Promise<boolean>;
64
+ batchGrant(grants: Array<{
65
+ nodeId: Long | number | string;
66
+ userId: Long | number | string;
67
+ permissions: {
68
+ read?: boolean;
69
+ write?: boolean;
70
+ delete?: boolean;
71
+ };
72
+ }>): Promise<{
73
+ total: number;
74
+ successful: number;
75
+ failed: number;
76
+ results: any[];
77
+ errors: any[];
78
+ }>;
79
+ insertWithAcl(nodeId: Long | number | string, text: string, metadata: any, userPermissions: Array<{
80
+ userId: Long | number | string;
81
+ permissions: {
82
+ read?: boolean;
83
+ write?: boolean;
84
+ delete?: boolean;
85
+ };
86
+ }>): Promise<InsertResult>;
87
+ }