@geodedb/client 1.0.0-alpha.11
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/LICENSE +201 -0
- package/README.md +594 -0
- package/dist/index.d.mts +2430 -0
- package/dist/index.d.ts +2430 -0
- package/dist/index.js +5202 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5101 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +80 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,2430 @@
|
|
|
1
|
+
import * as tls from 'node:tls';
|
|
2
|
+
import Decimal from 'decimal.js-light';
|
|
3
|
+
export { default as Decimal } from 'decimal.js-light';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Geode Client Configuration
|
|
7
|
+
*
|
|
8
|
+
* DSN parsing and configuration management.
|
|
9
|
+
*/
|
|
10
|
+
declare const DEFAULT_PORT = 3141;
|
|
11
|
+
declare const DEFAULT_PAGE_SIZE = 1000;
|
|
12
|
+
declare const DEFAULT_HELLO_NAME = "geode-nodejs";
|
|
13
|
+
declare const DEFAULT_HELLO_VERSION = "1.0.0";
|
|
14
|
+
declare const DEFAULT_CONFORMANCE = "min";
|
|
15
|
+
declare const MAX_QUERY_LENGTH: number;
|
|
16
|
+
declare const MAX_PAGE_SIZE = 100000;
|
|
17
|
+
/**
|
|
18
|
+
* Geode connection configuration.
|
|
19
|
+
*/
|
|
20
|
+
interface GeodeConfig {
|
|
21
|
+
/** Server hostname or IP address */
|
|
22
|
+
host: string;
|
|
23
|
+
/** Server port (default: 3141) */
|
|
24
|
+
port: number;
|
|
25
|
+
/** Number of rows per page (default: 1000) */
|
|
26
|
+
pageSize: number;
|
|
27
|
+
/** Client name sent in HELLO message */
|
|
28
|
+
helloName: string;
|
|
29
|
+
/** Client version sent in HELLO message */
|
|
30
|
+
helloVersion: string;
|
|
31
|
+
/** GQL conformance level (default: "min") */
|
|
32
|
+
conformance: string;
|
|
33
|
+
/** Username for authentication */
|
|
34
|
+
username?: string;
|
|
35
|
+
/** Password for authentication */
|
|
36
|
+
password?: string;
|
|
37
|
+
/** Path to CA certificate file */
|
|
38
|
+
tlsCA?: string;
|
|
39
|
+
/** CA certificate as PEM string */
|
|
40
|
+
tlsCACert?: string;
|
|
41
|
+
/** Path to client certificate file (for mTLS) */
|
|
42
|
+
tlsCert?: string;
|
|
43
|
+
/** Client certificate as PEM string (for mTLS) */
|
|
44
|
+
tlsCertPEM?: string;
|
|
45
|
+
/** Path to client private key file (for mTLS) */
|
|
46
|
+
tlsKey?: string;
|
|
47
|
+
/** Client private key as PEM string (for mTLS) */
|
|
48
|
+
tlsKeyPEM?: string;
|
|
49
|
+
/** Skip TLS verification (DEVELOPMENT ONLY, never use in production) */
|
|
50
|
+
insecureSkipVerify?: boolean;
|
|
51
|
+
/** SNI server name override */
|
|
52
|
+
serverName?: string;
|
|
53
|
+
/** Connection timeout in milliseconds (default: 30000) */
|
|
54
|
+
connectTimeout?: number;
|
|
55
|
+
/** Request timeout in milliseconds (default: 120000) */
|
|
56
|
+
requestTimeout?: number;
|
|
57
|
+
/** Keep-alive interval in milliseconds (default: 10000) */
|
|
58
|
+
keepAliveInterval?: number;
|
|
59
|
+
/** Maximum idle time in milliseconds (default: 30000) */
|
|
60
|
+
maxIdleTime?: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Connection pool configuration.
|
|
64
|
+
*/
|
|
65
|
+
interface PoolConfig extends GeodeConfig {
|
|
66
|
+
/** Minimum number of connections in pool (default: 2) */
|
|
67
|
+
minConnections?: number;
|
|
68
|
+
/** Maximum number of connections in pool (default: 10) */
|
|
69
|
+
maxConnections?: number;
|
|
70
|
+
/** Time to wait for connection in milliseconds (default: 30000) */
|
|
71
|
+
acquireTimeout?: number;
|
|
72
|
+
/** Idle connection lifetime in milliseconds (default: 60000) */
|
|
73
|
+
idleTimeout?: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create a default configuration.
|
|
77
|
+
*/
|
|
78
|
+
declare function defaultConfig(): GeodeConfig;
|
|
79
|
+
/**
|
|
80
|
+
* Parse a DSN (Data Source Name) string into configuration.
|
|
81
|
+
*
|
|
82
|
+
* Supported formats:
|
|
83
|
+
* - geode://host:port?options
|
|
84
|
+
* - geode://username:password@host:port?options
|
|
85
|
+
* - host:port?options
|
|
86
|
+
* - host:port
|
|
87
|
+
* - host (uses default port)
|
|
88
|
+
*
|
|
89
|
+
* Supported options:
|
|
90
|
+
* - page_size: Results page size (default: 1000)
|
|
91
|
+
* - hello_name: Client name (default: "geode-nodejs")
|
|
92
|
+
* - hello_ver: Client version (default: "1.0.0")
|
|
93
|
+
* - conformance: GQL conformance level (default: "min")
|
|
94
|
+
* - username/user: Authentication username
|
|
95
|
+
* - password/pass: Authentication password
|
|
96
|
+
* - ca: Path to CA certificate
|
|
97
|
+
* - cert: Path to client certificate (for mTLS)
|
|
98
|
+
* - key: Path to client key (for mTLS)
|
|
99
|
+
* - insecure: Skip TLS verification (testing only)
|
|
100
|
+
* - server_name: SNI server name
|
|
101
|
+
* - connect_timeout: Connection timeout in ms
|
|
102
|
+
* - request_timeout: Request timeout in ms
|
|
103
|
+
*
|
|
104
|
+
* Environment variables (used as defaults):
|
|
105
|
+
* - GEODE_HOST: Default host
|
|
106
|
+
* - GEODE_PORT: Default port
|
|
107
|
+
* - GEODE_TLS_CA: Default CA certificate path
|
|
108
|
+
* - GEODE_USERNAME: Default username
|
|
109
|
+
* - GEODE_PASSWORD: Default password
|
|
110
|
+
*/
|
|
111
|
+
declare function parseDSN(dsn: string): GeodeConfig;
|
|
112
|
+
/**
|
|
113
|
+
* Validate configuration.
|
|
114
|
+
*/
|
|
115
|
+
declare function validateConfig(cfg: GeodeConfig): void;
|
|
116
|
+
/**
|
|
117
|
+
* Get the server address in host:port format.
|
|
118
|
+
*/
|
|
119
|
+
declare function getAddress(cfg: GeodeConfig): string;
|
|
120
|
+
/**
|
|
121
|
+
* Clone configuration.
|
|
122
|
+
*/
|
|
123
|
+
declare function cloneConfig(cfg: GeodeConfig): GeodeConfig;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Geode Client Error Types
|
|
127
|
+
*
|
|
128
|
+
* Implements ISO/IEC 39075:2024 status codes for GQL error handling.
|
|
129
|
+
*/
|
|
130
|
+
declare const StatusClass: {
|
|
131
|
+
readonly SUCCESS: "00000";
|
|
132
|
+
readonly WARNING: "01000";
|
|
133
|
+
readonly NO_DATA: "02000";
|
|
134
|
+
readonly TRANSACTION_STATE: "25000";
|
|
135
|
+
readonly AUTH: "28000";
|
|
136
|
+
readonly SERIALIZATION: "40001";
|
|
137
|
+
readonly DEADLOCK: "40502";
|
|
138
|
+
readonly SYNTAX: "42000";
|
|
139
|
+
readonly CONSTRAINT: "23000";
|
|
140
|
+
readonly DUPLICATE: "42P07";
|
|
141
|
+
readonly INVALID_PARAM: "22023";
|
|
142
|
+
readonly SYSTEM: "58000";
|
|
143
|
+
};
|
|
144
|
+
type StatusClassType = (typeof StatusClass)[keyof typeof StatusClass];
|
|
145
|
+
/**
|
|
146
|
+
* Base interface for all Geode errors.
|
|
147
|
+
*/
|
|
148
|
+
interface GeodeError extends Error {
|
|
149
|
+
/** ISO/IEC 39075 status class */
|
|
150
|
+
readonly statusClass: StatusClassType;
|
|
151
|
+
/** Whether this error can be retried */
|
|
152
|
+
readonly isRetryable: boolean;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Error returned from the Geode server.
|
|
156
|
+
*/
|
|
157
|
+
declare class DriverError extends Error implements GeodeError {
|
|
158
|
+
readonly statusClass: StatusClassType;
|
|
159
|
+
readonly subclass: string;
|
|
160
|
+
readonly code: string;
|
|
161
|
+
readonly anchor?: string;
|
|
162
|
+
readonly additional: string[];
|
|
163
|
+
readonly findings: string[];
|
|
164
|
+
constructor(options: {
|
|
165
|
+
statusClass: StatusClassType;
|
|
166
|
+
subclass: string;
|
|
167
|
+
code: string;
|
|
168
|
+
message: string;
|
|
169
|
+
anchor?: string;
|
|
170
|
+
additional?: string[];
|
|
171
|
+
findings?: string[];
|
|
172
|
+
});
|
|
173
|
+
get isRetryable(): boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Transport layer error (QUIC/network failures).
|
|
177
|
+
*/
|
|
178
|
+
declare class TransportError extends Error implements GeodeError {
|
|
179
|
+
readonly statusClass: "58000";
|
|
180
|
+
readonly operation: string;
|
|
181
|
+
readonly address?: string;
|
|
182
|
+
readonly cause?: Error;
|
|
183
|
+
constructor(options: {
|
|
184
|
+
operation: string;
|
|
185
|
+
address?: string;
|
|
186
|
+
cause?: Error;
|
|
187
|
+
});
|
|
188
|
+
get isRetryable(): boolean;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Configuration/DSN parsing error.
|
|
192
|
+
*/
|
|
193
|
+
declare class ConfigError extends Error implements GeodeError {
|
|
194
|
+
readonly statusClass: "22023";
|
|
195
|
+
readonly field: string;
|
|
196
|
+
readonly value?: string;
|
|
197
|
+
constructor(options: {
|
|
198
|
+
field: string;
|
|
199
|
+
value?: string;
|
|
200
|
+
message: string;
|
|
201
|
+
});
|
|
202
|
+
get isRetryable(): boolean;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Security validation error (TLS, input validation).
|
|
206
|
+
*/
|
|
207
|
+
declare class SecurityError extends Error implements GeodeError {
|
|
208
|
+
readonly statusClass: "28000";
|
|
209
|
+
readonly type: 'tls' | 'input' | 'validation';
|
|
210
|
+
readonly cause?: Error;
|
|
211
|
+
constructor(options: {
|
|
212
|
+
type: 'tls' | 'input' | 'validation';
|
|
213
|
+
message: string;
|
|
214
|
+
cause?: Error;
|
|
215
|
+
});
|
|
216
|
+
get isRetryable(): boolean;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Connection state error.
|
|
220
|
+
*/
|
|
221
|
+
declare class StateError extends Error implements GeodeError {
|
|
222
|
+
readonly statusClass: "25000";
|
|
223
|
+
readonly currentState: ConnectionState;
|
|
224
|
+
readonly operation: string;
|
|
225
|
+
constructor(options: {
|
|
226
|
+
currentState: ConnectionState;
|
|
227
|
+
operation: string;
|
|
228
|
+
message?: string;
|
|
229
|
+
});
|
|
230
|
+
get isRetryable(): boolean;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Connection state enumeration.
|
|
234
|
+
*/
|
|
235
|
+
type ConnectionState = 'idle' | 'executing' | 'in_transaction' | 'fetching' | 'closed' | 'error';
|
|
236
|
+
declare const ErrClosed: Error;
|
|
237
|
+
declare const ErrQueryInProgress: Error;
|
|
238
|
+
declare const ErrTxInProgress: Error;
|
|
239
|
+
declare const ErrNoTx: Error;
|
|
240
|
+
declare const ErrTxDone: Error;
|
|
241
|
+
declare const ErrRowsClosed: Error;
|
|
242
|
+
declare const ErrBadConn: Error;
|
|
243
|
+
/**
|
|
244
|
+
* Type guard for DriverError.
|
|
245
|
+
*/
|
|
246
|
+
declare function isDriverError(err: unknown): err is DriverError;
|
|
247
|
+
/**
|
|
248
|
+
* Type guard for GeodeError.
|
|
249
|
+
*/
|
|
250
|
+
declare function isGeodeError(err: unknown): err is GeodeError;
|
|
251
|
+
/**
|
|
252
|
+
* Check if an error is retryable.
|
|
253
|
+
*/
|
|
254
|
+
declare function isRetryableError(err: unknown): boolean;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* QUIC Transport Layer
|
|
258
|
+
*
|
|
259
|
+
* Provides QUIC + TLS 1.3 transport for communication with Geode server.
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Transport interface for communication with Geode server.
|
|
264
|
+
*/
|
|
265
|
+
interface Transport {
|
|
266
|
+
/** Send a message to the server */
|
|
267
|
+
send(msg: Record<string, unknown>, signal?: AbortSignal): Promise<void>;
|
|
268
|
+
/** Receive a message from the server */
|
|
269
|
+
receive(signal?: AbortSignal): Promise<Buffer>;
|
|
270
|
+
/** Close the transport */
|
|
271
|
+
close(): Promise<void>;
|
|
272
|
+
/** Check if transport is closed */
|
|
273
|
+
isClosed(): boolean;
|
|
274
|
+
/** Get remote address */
|
|
275
|
+
getAddress(): string;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Build TLS configuration from GeodeConfig.
|
|
279
|
+
*/
|
|
280
|
+
declare function buildTLSConfig(cfg: GeodeConfig): Promise<tls.SecureContextOptions>;
|
|
281
|
+
/**
|
|
282
|
+
* Abstract base class for QUIC transports.
|
|
283
|
+
* Allows for different QUIC implementations.
|
|
284
|
+
*/
|
|
285
|
+
declare abstract class BaseTransport implements Transport {
|
|
286
|
+
protected _closed: boolean;
|
|
287
|
+
protected _address: string;
|
|
288
|
+
constructor(address: string);
|
|
289
|
+
abstract send(msg: Record<string, unknown>, signal?: AbortSignal): Promise<void>;
|
|
290
|
+
abstract receive(signal?: AbortSignal): Promise<Buffer>;
|
|
291
|
+
abstract close(): Promise<void>;
|
|
292
|
+
isClosed(): boolean;
|
|
293
|
+
getAddress(): string;
|
|
294
|
+
protected checkClosed(): void;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* QUIC transport using @matrixai/quic.
|
|
298
|
+
*
|
|
299
|
+
* This implementation uses the quiche QUIC library via native bindings.
|
|
300
|
+
*/
|
|
301
|
+
declare class MatrixQuicTransport extends BaseTransport {
|
|
302
|
+
private _client;
|
|
303
|
+
private _stream;
|
|
304
|
+
private _readBuffer;
|
|
305
|
+
private _lineBuffer;
|
|
306
|
+
private _pendingReads;
|
|
307
|
+
constructor(address: string);
|
|
308
|
+
/**
|
|
309
|
+
* Connect to the Geode server using QUIC.
|
|
310
|
+
*/
|
|
311
|
+
static connect(cfg: GeodeConfig): Promise<MatrixQuicTransport>;
|
|
312
|
+
/**
|
|
313
|
+
* Start reading from the stream in the background.
|
|
314
|
+
*/
|
|
315
|
+
private startReading;
|
|
316
|
+
/**
|
|
317
|
+
* Process received data, splitting by newlines.
|
|
318
|
+
*/
|
|
319
|
+
private processData;
|
|
320
|
+
send(msg: Record<string, unknown>, signal?: AbortSignal): Promise<void>;
|
|
321
|
+
receive(signal?: AbortSignal): Promise<Buffer>;
|
|
322
|
+
close(): Promise<void>;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Mock transport for testing purposes.
|
|
326
|
+
*
|
|
327
|
+
* This allows unit testing without a real QUIC connection.
|
|
328
|
+
*/
|
|
329
|
+
declare class MockTransport extends BaseTransport {
|
|
330
|
+
private _sendQueue;
|
|
331
|
+
private _receiveQueue;
|
|
332
|
+
private _pendingReads;
|
|
333
|
+
constructor(address?: string);
|
|
334
|
+
/**
|
|
335
|
+
* Queue a response to be returned by receive().
|
|
336
|
+
*/
|
|
337
|
+
queueResponse(response: Record<string, unknown>): void;
|
|
338
|
+
/**
|
|
339
|
+
* Get all sent messages.
|
|
340
|
+
*/
|
|
341
|
+
getSentMessages(): Record<string, unknown>[];
|
|
342
|
+
/**
|
|
343
|
+
* Clear sent messages.
|
|
344
|
+
*/
|
|
345
|
+
clearSentMessages(): void;
|
|
346
|
+
send(msg: Record<string, unknown>, signal?: AbortSignal): Promise<void>;
|
|
347
|
+
receive(signal?: AbortSignal): Promise<Buffer>;
|
|
348
|
+
close(): Promise<void>;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Create a transport for the given configuration.
|
|
352
|
+
*
|
|
353
|
+
* Uses MatrixQuicTransport by default.
|
|
354
|
+
*/
|
|
355
|
+
declare function createTransport(cfg: GeodeConfig): Promise<Transport>;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* GQL Type System
|
|
359
|
+
*
|
|
360
|
+
* Implements the GQL value type system for ISO/IEC 39075:2024 compliance.
|
|
361
|
+
*/
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* GQL value kind enumeration.
|
|
365
|
+
*/
|
|
366
|
+
type GQLValueKind = 'NULL' | 'BOOL' | 'INT' | 'FLOAT' | 'STRING' | 'DECIMAL' | 'BYTEA' | 'DATE' | 'TIME' | 'TIMETZ' | 'TIMESTAMP' | 'TIMESTAMPTZ' | 'INTERVAL' | 'JSON' | 'JSONB' | 'XML' | 'URL' | 'DOMAIN' | 'UUID' | 'ENUM' | 'BIT_STRING' | 'RANGE' | 'ARRAY' | 'OBJECT' | 'NODE' | 'EDGE' | 'PATH' | 'UNKNOWN';
|
|
367
|
+
/**
|
|
368
|
+
* GQL type enumeration for wire protocol.
|
|
369
|
+
*/
|
|
370
|
+
type GQLType = 'INT' | 'INTEGER' | 'BIGINT' | 'FLOAT' | 'DOUBLE' | 'REAL' | 'DECIMAL' | 'STRING' | 'VARCHAR' | 'TEXT' | 'BOOL' | 'BOOLEAN' | 'NULL' | 'LIST' | 'ARRAY' | 'MAP' | 'RECORD' | 'NODE' | 'EDGE' | 'RELATIONSHIP' | 'PATH' | 'BYTEA' | 'DATE' | 'TIME' | 'TIMETZ' | 'TIMESTAMP' | 'TIMESTAMPTZ' | 'INTERVAL' | 'JSON' | 'JSONB' | 'XML' | 'UUID' | 'URL' | 'DOMAIN' | 'ENUM' | 'BIT' | 'VARBIT' | 'UNKNOWN';
|
|
371
|
+
/**
|
|
372
|
+
* Range bounds for GQL range types.
|
|
373
|
+
*/
|
|
374
|
+
interface GQLRange<T = unknown> {
|
|
375
|
+
lower?: T;
|
|
376
|
+
upper?: T;
|
|
377
|
+
lowerInclusive: boolean;
|
|
378
|
+
upperInclusive: boolean;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Node structure from graph queries.
|
|
382
|
+
*/
|
|
383
|
+
interface GQLNode {
|
|
384
|
+
id: string | number;
|
|
385
|
+
labels: string[];
|
|
386
|
+
properties: Record<string, unknown>;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Edge structure from graph queries.
|
|
390
|
+
*/
|
|
391
|
+
interface GQLEdge {
|
|
392
|
+
id: string | number;
|
|
393
|
+
type: string;
|
|
394
|
+
startNode: string | number;
|
|
395
|
+
endNode: string | number;
|
|
396
|
+
properties: Record<string, unknown>;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Path structure from graph queries.
|
|
400
|
+
*/
|
|
401
|
+
interface GQLPath {
|
|
402
|
+
nodes: GQLNode[];
|
|
403
|
+
edges: GQLEdge[];
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* GQL Value wrapper for type-safe value handling.
|
|
407
|
+
*/
|
|
408
|
+
declare class GQLValue {
|
|
409
|
+
readonly kind: GQLValueKind;
|
|
410
|
+
private _intValue;
|
|
411
|
+
private _floatValue;
|
|
412
|
+
private _boolValue;
|
|
413
|
+
private _stringValue;
|
|
414
|
+
private _decimalValue?;
|
|
415
|
+
private _arrayValue;
|
|
416
|
+
private _objectValue;
|
|
417
|
+
private _bytesValue;
|
|
418
|
+
private _dateValue?;
|
|
419
|
+
private _rangeValue?;
|
|
420
|
+
private _nodeValue?;
|
|
421
|
+
private _edgeValue?;
|
|
422
|
+
private _pathValue?;
|
|
423
|
+
private _rawValue?;
|
|
424
|
+
private constructor();
|
|
425
|
+
static null(): GQLValue;
|
|
426
|
+
static bool(value: boolean): GQLValue;
|
|
427
|
+
static int(value: number | bigint): GQLValue;
|
|
428
|
+
static float(value: number): GQLValue;
|
|
429
|
+
static string(value: string): GQLValue;
|
|
430
|
+
static decimal(value: string | number | Decimal): GQLValue;
|
|
431
|
+
static array(values: GQLValue[]): GQLValue;
|
|
432
|
+
static object(values: Map<string, GQLValue> | Record<string, GQLValue>): GQLValue;
|
|
433
|
+
static bytes(value: Uint8Array | Buffer): GQLValue;
|
|
434
|
+
static date(value: Date): GQLValue;
|
|
435
|
+
static time(value: Date): GQLValue;
|
|
436
|
+
static timestamp(value: Date): GQLValue;
|
|
437
|
+
static uuid(value: string): GQLValue;
|
|
438
|
+
static json(value: unknown): GQLValue;
|
|
439
|
+
static node(value: GQLNode): GQLValue;
|
|
440
|
+
static edge(value: GQLEdge): GQLValue;
|
|
441
|
+
static path(value: GQLPath): GQLValue;
|
|
442
|
+
static range<T>(value: GQLRange<T>): GQLValue;
|
|
443
|
+
static unknown(value: unknown): GQLValue;
|
|
444
|
+
get isNull(): boolean;
|
|
445
|
+
get asBool(): boolean;
|
|
446
|
+
get asInt(): bigint;
|
|
447
|
+
get asNumber(): number;
|
|
448
|
+
get asFloat(): number;
|
|
449
|
+
get asString(): string;
|
|
450
|
+
get asDecimal(): Decimal;
|
|
451
|
+
get asArray(): GQLValue[];
|
|
452
|
+
get asObject(): Map<string, GQLValue>;
|
|
453
|
+
get asBytes(): Uint8Array;
|
|
454
|
+
get asDate(): Date;
|
|
455
|
+
get asNode(): GQLNode;
|
|
456
|
+
get asEdge(): GQLEdge;
|
|
457
|
+
get asPath(): GQLPath;
|
|
458
|
+
get asRange(): GQLRange;
|
|
459
|
+
get asJSON(): unknown;
|
|
460
|
+
get raw(): unknown;
|
|
461
|
+
toString(): string;
|
|
462
|
+
/**
|
|
463
|
+
* Convert to a plain JavaScript value.
|
|
464
|
+
*/
|
|
465
|
+
toJS(): unknown;
|
|
466
|
+
/**
|
|
467
|
+
* Convert to JSON-serializable format.
|
|
468
|
+
*/
|
|
469
|
+
toJSON(): unknown;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Parse a GQL type string to GQLValueKind.
|
|
473
|
+
*/
|
|
474
|
+
declare function parseGQLType(typeStr: string): GQLValueKind;
|
|
475
|
+
/**
|
|
476
|
+
* Convert a JSON value from the server to a GQLValue.
|
|
477
|
+
*/
|
|
478
|
+
declare function fromJSON(value: unknown, typeHint?: GQLValueKind): GQLValue;
|
|
479
|
+
/**
|
|
480
|
+
* Column definition from SCHEMA response.
|
|
481
|
+
*/
|
|
482
|
+
interface ColumnDef {
|
|
483
|
+
name: string;
|
|
484
|
+
type: GQLType;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Column metadata with parsed type.
|
|
488
|
+
*/
|
|
489
|
+
interface ColumnInfo {
|
|
490
|
+
name: string;
|
|
491
|
+
type: GQLType;
|
|
492
|
+
kind: GQLValueKind;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Query result row.
|
|
496
|
+
*/
|
|
497
|
+
type Row = Map<string, GQLValue>;
|
|
498
|
+
/**
|
|
499
|
+
* Convert raw row data to typed Row.
|
|
500
|
+
*/
|
|
501
|
+
declare function parseRow(raw: Record<string, unknown>, columns: ColumnInfo[]): Row;
|
|
502
|
+
/**
|
|
503
|
+
* Convert Row to plain object.
|
|
504
|
+
*/
|
|
505
|
+
declare function rowToObject(row: Row): Record<string, unknown>;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Query Result Handling
|
|
509
|
+
*
|
|
510
|
+
* Implements async iteration over query results with pagination.
|
|
511
|
+
*/
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Query result with async iteration support.
|
|
515
|
+
*/
|
|
516
|
+
declare class QueryResult implements AsyncIterable<Row> {
|
|
517
|
+
private _conn;
|
|
518
|
+
private _columns;
|
|
519
|
+
private _buffer;
|
|
520
|
+
private _final;
|
|
521
|
+
private _ordered;
|
|
522
|
+
private _orderKeys;
|
|
523
|
+
private _pageSize;
|
|
524
|
+
private _signal?;
|
|
525
|
+
private _closed;
|
|
526
|
+
private _bufferIndex;
|
|
527
|
+
private _rowCount;
|
|
528
|
+
constructor(conn: Connection, columns: ColumnInfo[], initialRows: Record<string, unknown>[], final: boolean, ordered: boolean, orderKeys: string[], pageSize: number, signal?: AbortSignal);
|
|
529
|
+
/**
|
|
530
|
+
* Get column definitions.
|
|
531
|
+
*/
|
|
532
|
+
get columns(): readonly ColumnInfo[];
|
|
533
|
+
/**
|
|
534
|
+
* Get column names.
|
|
535
|
+
*/
|
|
536
|
+
get columnNames(): string[];
|
|
537
|
+
/**
|
|
538
|
+
* Check if results are ordered.
|
|
539
|
+
*/
|
|
540
|
+
get ordered(): boolean;
|
|
541
|
+
/**
|
|
542
|
+
* Get order keys (if ordered).
|
|
543
|
+
*/
|
|
544
|
+
get orderKeys(): readonly string[];
|
|
545
|
+
/**
|
|
546
|
+
* Check if all results have been fetched.
|
|
547
|
+
*/
|
|
548
|
+
get complete(): boolean;
|
|
549
|
+
/**
|
|
550
|
+
* Check if result is closed.
|
|
551
|
+
*/
|
|
552
|
+
get isClosed(): boolean;
|
|
553
|
+
/**
|
|
554
|
+
* Get the number of rows returned so far.
|
|
555
|
+
*/
|
|
556
|
+
get rowCount(): number;
|
|
557
|
+
/**
|
|
558
|
+
* Async iterator implementation.
|
|
559
|
+
*/
|
|
560
|
+
[Symbol.asyncIterator](): AsyncIterator<Row>;
|
|
561
|
+
/**
|
|
562
|
+
* Get all remaining rows as an array.
|
|
563
|
+
*/
|
|
564
|
+
toArray(): Promise<Row[]>;
|
|
565
|
+
/**
|
|
566
|
+
* Get all remaining rows as plain objects.
|
|
567
|
+
*/
|
|
568
|
+
toObjects(): Promise<Record<string, unknown>[]>;
|
|
569
|
+
/**
|
|
570
|
+
* Get the first row (or null if empty).
|
|
571
|
+
*/
|
|
572
|
+
first(): Promise<Row | null>;
|
|
573
|
+
/**
|
|
574
|
+
* Get the first row as plain object (or null if empty).
|
|
575
|
+
*/
|
|
576
|
+
firstObject(): Promise<Record<string, unknown> | null>;
|
|
577
|
+
/**
|
|
578
|
+
* Apply a function to each row.
|
|
579
|
+
*/
|
|
580
|
+
forEach(fn: (row: Row, index: number) => void | Promise<void>): Promise<void>;
|
|
581
|
+
/**
|
|
582
|
+
* Map rows to a new array.
|
|
583
|
+
*/
|
|
584
|
+
map<T>(fn: (row: Row, index: number) => T | Promise<T>): Promise<T[]>;
|
|
585
|
+
/**
|
|
586
|
+
* Filter rows.
|
|
587
|
+
*/
|
|
588
|
+
filter(predicate: (row: Row, index: number) => boolean | Promise<boolean>): Promise<Row[]>;
|
|
589
|
+
/**
|
|
590
|
+
* Reduce rows to a single value.
|
|
591
|
+
*/
|
|
592
|
+
reduce<T>(fn: (acc: T, row: Row, index: number) => T | Promise<T>, initial: T): Promise<T>;
|
|
593
|
+
/**
|
|
594
|
+
* Close the result set.
|
|
595
|
+
*/
|
|
596
|
+
close(): void;
|
|
597
|
+
/**
|
|
598
|
+
* Internal close (called by connection).
|
|
599
|
+
*/
|
|
600
|
+
_close(): void;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Iterator for synchronous access to query results.
|
|
604
|
+
*
|
|
605
|
+
* This wraps the async iterator for cases where results are pre-fetched.
|
|
606
|
+
*/
|
|
607
|
+
declare class QueryResultIterator {
|
|
608
|
+
private _result;
|
|
609
|
+
private _iterator;
|
|
610
|
+
constructor(result: QueryResult);
|
|
611
|
+
/**
|
|
612
|
+
* Get the next row.
|
|
613
|
+
*/
|
|
614
|
+
next(): Promise<{
|
|
615
|
+
done: boolean;
|
|
616
|
+
value?: Row;
|
|
617
|
+
}>;
|
|
618
|
+
/**
|
|
619
|
+
* Close the iterator.
|
|
620
|
+
*/
|
|
621
|
+
close(): void;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Transaction Management
|
|
626
|
+
*
|
|
627
|
+
* Provides transaction and savepoint support.
|
|
628
|
+
*/
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Transaction represents an active database transaction.
|
|
632
|
+
*/
|
|
633
|
+
declare class Transaction {
|
|
634
|
+
private _conn;
|
|
635
|
+
private _done;
|
|
636
|
+
private _savepoints;
|
|
637
|
+
constructor(conn: Connection);
|
|
638
|
+
/**
|
|
639
|
+
* Check if transaction is complete (committed or rolled back).
|
|
640
|
+
*/
|
|
641
|
+
get isDone(): boolean;
|
|
642
|
+
/**
|
|
643
|
+
* Get the list of active savepoints.
|
|
644
|
+
*/
|
|
645
|
+
get savepoints(): readonly string[];
|
|
646
|
+
/**
|
|
647
|
+
* Execute a query within the transaction.
|
|
648
|
+
*/
|
|
649
|
+
query(query: string, options?: QueryOptions): Promise<QueryResult>;
|
|
650
|
+
/**
|
|
651
|
+
* Execute a query and return all rows.
|
|
652
|
+
*/
|
|
653
|
+
queryAll(query: string, options?: QueryOptions): Promise<Record<string, unknown>[]>;
|
|
654
|
+
/**
|
|
655
|
+
* Execute a statement that doesn't return rows.
|
|
656
|
+
*/
|
|
657
|
+
exec(query: string, options?: QueryOptions): Promise<void>;
|
|
658
|
+
/**
|
|
659
|
+
* Create a savepoint.
|
|
660
|
+
*/
|
|
661
|
+
savepoint(name: string, signal?: AbortSignal): Promise<void>;
|
|
662
|
+
/**
|
|
663
|
+
* Rollback to a savepoint.
|
|
664
|
+
*/
|
|
665
|
+
rollbackTo(name: string, signal?: AbortSignal): Promise<void>;
|
|
666
|
+
/**
|
|
667
|
+
* Release a savepoint.
|
|
668
|
+
*
|
|
669
|
+
* Note: Geode doesn't have explicit RELEASE SAVEPOINT, but we track it client-side.
|
|
670
|
+
*/
|
|
671
|
+
release(name: string): void;
|
|
672
|
+
/**
|
|
673
|
+
* Commit the transaction.
|
|
674
|
+
*/
|
|
675
|
+
commit(signal?: AbortSignal): Promise<void>;
|
|
676
|
+
/**
|
|
677
|
+
* Rollback the transaction.
|
|
678
|
+
*/
|
|
679
|
+
rollback(signal?: AbortSignal): Promise<void>;
|
|
680
|
+
/**
|
|
681
|
+
* Execute a function within the transaction with automatic commit/rollback.
|
|
682
|
+
*/
|
|
683
|
+
run<T>(fn: (tx: Transaction) => Promise<T>): Promise<T>;
|
|
684
|
+
/**
|
|
685
|
+
* Check if transaction is already done.
|
|
686
|
+
*/
|
|
687
|
+
private checkDone;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Execute a function within a new transaction.
|
|
691
|
+
*
|
|
692
|
+
* Automatically commits on success or rolls back on error.
|
|
693
|
+
*/
|
|
694
|
+
declare function withTransaction<T>(conn: Connection, fn: (tx: Transaction) => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Prepared Statements
|
|
698
|
+
*
|
|
699
|
+
* Support for parameterized query preparation and efficient repeated execution.
|
|
700
|
+
*/
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Parameter metadata extracted from a query.
|
|
704
|
+
*/
|
|
705
|
+
interface ParameterInfo {
|
|
706
|
+
/** Parameter name */
|
|
707
|
+
name: string;
|
|
708
|
+
/** Position in the query (1-indexed) */
|
|
709
|
+
position: number;
|
|
710
|
+
/** Whether this is a positional parameter (?) */
|
|
711
|
+
positional: boolean;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Prepared statement for efficient repeated execution.
|
|
715
|
+
*
|
|
716
|
+
* Prepared statements parse the query once and allow multiple executions
|
|
717
|
+
* with different parameter values.
|
|
718
|
+
*
|
|
719
|
+
* @example
|
|
720
|
+
* ```typescript
|
|
721
|
+
* const stmt = conn.prepare('MATCH (n:Person {name: $name}) RETURN n');
|
|
722
|
+
*
|
|
723
|
+
* // Execute with different parameters
|
|
724
|
+
* const result1 = await stmt.query({ name: 'Alice' });
|
|
725
|
+
* const result2 = await stmt.query({ name: 'Bob' });
|
|
726
|
+
*
|
|
727
|
+
* // Close when done
|
|
728
|
+
* stmt.close();
|
|
729
|
+
* ```
|
|
730
|
+
*/
|
|
731
|
+
declare class PreparedStatement {
|
|
732
|
+
private _conn;
|
|
733
|
+
private _query;
|
|
734
|
+
private _parameters;
|
|
735
|
+
private _closed;
|
|
736
|
+
/**
|
|
737
|
+
* Create a new prepared statement.
|
|
738
|
+
*
|
|
739
|
+
* @internal Use Connection.prepare() instead.
|
|
740
|
+
*/
|
|
741
|
+
constructor(conn: Connection, query: string);
|
|
742
|
+
/**
|
|
743
|
+
* Get the query text.
|
|
744
|
+
*/
|
|
745
|
+
get query(): string;
|
|
746
|
+
/**
|
|
747
|
+
* Get parameter information.
|
|
748
|
+
*/
|
|
749
|
+
get parameters(): ReadonlyArray<ParameterInfo>;
|
|
750
|
+
/**
|
|
751
|
+
* Get the number of parameters.
|
|
752
|
+
*/
|
|
753
|
+
get parameterCount(): number;
|
|
754
|
+
/**
|
|
755
|
+
* Get positional parameter count (number of ? placeholders).
|
|
756
|
+
*/
|
|
757
|
+
get positionalCount(): number;
|
|
758
|
+
/**
|
|
759
|
+
* Get named parameter names.
|
|
760
|
+
*/
|
|
761
|
+
get namedParameters(): string[];
|
|
762
|
+
/**
|
|
763
|
+
* Check if the statement is closed.
|
|
764
|
+
*/
|
|
765
|
+
get isClosed(): boolean;
|
|
766
|
+
/**
|
|
767
|
+
* Execute the prepared statement and return results.
|
|
768
|
+
*
|
|
769
|
+
* @param params - Parameter values (object for named, array for positional)
|
|
770
|
+
* @param options - Additional query options
|
|
771
|
+
* @returns Query result
|
|
772
|
+
*/
|
|
773
|
+
execute(params?: QueryParams | unknown[], options?: Omit<QueryOptions, 'params'>): Promise<QueryResult>;
|
|
774
|
+
/**
|
|
775
|
+
* Execute the prepared statement and return all rows.
|
|
776
|
+
*
|
|
777
|
+
* @param params - Parameter values
|
|
778
|
+
* @param options - Additional query options
|
|
779
|
+
* @returns Array of row objects
|
|
780
|
+
*/
|
|
781
|
+
executeAll(params?: QueryParams | unknown[], options?: Omit<QueryOptions, 'params'>): Promise<Record<string, unknown>[]>;
|
|
782
|
+
/**
|
|
783
|
+
* Execute the prepared statement without returning results.
|
|
784
|
+
*
|
|
785
|
+
* @param params - Parameter values
|
|
786
|
+
* @param options - Additional query options
|
|
787
|
+
*/
|
|
788
|
+
exec(params?: QueryParams | unknown[], options?: Omit<QueryOptions, 'params'>): Promise<void>;
|
|
789
|
+
/**
|
|
790
|
+
* Validate parameters without executing.
|
|
791
|
+
*
|
|
792
|
+
* @param params - Parameter values to validate
|
|
793
|
+
* @throws SecurityError if validation fails
|
|
794
|
+
*/
|
|
795
|
+
validate(params?: QueryParams | unknown[]): void;
|
|
796
|
+
/**
|
|
797
|
+
* Close the prepared statement.
|
|
798
|
+
*
|
|
799
|
+
* After closing, the statement cannot be executed.
|
|
800
|
+
*/
|
|
801
|
+
close(): void;
|
|
802
|
+
/**
|
|
803
|
+
* Resolve and validate parameters.
|
|
804
|
+
*/
|
|
805
|
+
private resolveParams;
|
|
806
|
+
/**
|
|
807
|
+
* Check if statement is closed.
|
|
808
|
+
*/
|
|
809
|
+
private checkClosed;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Extract parameter information from a query string.
|
|
813
|
+
*
|
|
814
|
+
* Supports both positional (?) and named ($name) parameters.
|
|
815
|
+
*/
|
|
816
|
+
declare function extractParameters(query: string): ParameterInfo[];
|
|
817
|
+
/**
|
|
818
|
+
* Create a prepared statement from a query string.
|
|
819
|
+
*
|
|
820
|
+
* @param conn - Connection to use
|
|
821
|
+
* @param query - Query text
|
|
822
|
+
* @returns Prepared statement
|
|
823
|
+
*/
|
|
824
|
+
declare function prepare(conn: Connection, query: string): PreparedStatement;
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Query Explain and Profile
|
|
828
|
+
*
|
|
829
|
+
* Support for query plan analysis and execution profiling.
|
|
830
|
+
*/
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* A single operation in a query plan.
|
|
834
|
+
*/
|
|
835
|
+
interface PlanOperation {
|
|
836
|
+
/** Operation type (e.g., 'NodeScan', 'Filter', 'Expand') */
|
|
837
|
+
type: string;
|
|
838
|
+
/** Optional operator name */
|
|
839
|
+
operator?: string;
|
|
840
|
+
/** Estimated cost */
|
|
841
|
+
cost?: number;
|
|
842
|
+
/** Estimated rows */
|
|
843
|
+
rows?: number;
|
|
844
|
+
/** Details about the operation */
|
|
845
|
+
details?: Record<string, unknown>;
|
|
846
|
+
/** Child operations */
|
|
847
|
+
children?: PlanOperation[];
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Query execution plan.
|
|
851
|
+
*/
|
|
852
|
+
interface QueryPlan {
|
|
853
|
+
/** Root operation */
|
|
854
|
+
root: PlanOperation;
|
|
855
|
+
/** Total estimated cost */
|
|
856
|
+
totalCost?: number;
|
|
857
|
+
/** Total estimated rows */
|
|
858
|
+
totalRows?: number;
|
|
859
|
+
/** Raw plan data from server */
|
|
860
|
+
raw: unknown;
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Timing information for profiled operations.
|
|
864
|
+
*/
|
|
865
|
+
interface OperationTiming {
|
|
866
|
+
/** Operation type */
|
|
867
|
+
type: string;
|
|
868
|
+
/** Wall clock time in milliseconds */
|
|
869
|
+
wallTimeMs: number;
|
|
870
|
+
/** CPU time in milliseconds */
|
|
871
|
+
cpuTimeMs?: number;
|
|
872
|
+
/** Actual rows produced */
|
|
873
|
+
rows?: number;
|
|
874
|
+
/** Number of database page hits */
|
|
875
|
+
pageHits?: number;
|
|
876
|
+
/** Number of database page faults */
|
|
877
|
+
pageFaults?: number;
|
|
878
|
+
/** Child operation timings */
|
|
879
|
+
children?: OperationTiming[];
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Query execution profile.
|
|
883
|
+
*/
|
|
884
|
+
interface QueryProfile {
|
|
885
|
+
/** Root operation timing */
|
|
886
|
+
root: OperationTiming;
|
|
887
|
+
/** Total execution time in milliseconds */
|
|
888
|
+
totalTimeMs: number;
|
|
889
|
+
/** Total rows processed */
|
|
890
|
+
totalRows?: number;
|
|
891
|
+
/** Planning time in milliseconds */
|
|
892
|
+
planningTimeMs?: number;
|
|
893
|
+
/** Execution time in milliseconds */
|
|
894
|
+
executionTimeMs?: number;
|
|
895
|
+
/** Memory used in bytes */
|
|
896
|
+
memoryBytes?: number;
|
|
897
|
+
/** Raw profile data from server */
|
|
898
|
+
raw: unknown;
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Options for explain/profile operations.
|
|
902
|
+
*/
|
|
903
|
+
interface ExplainOptions extends Omit<QueryOptions, 'pageSize'> {
|
|
904
|
+
/** Include verbose details */
|
|
905
|
+
verbose?: boolean;
|
|
906
|
+
/** Analyze query costs */
|
|
907
|
+
analyze?: boolean;
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Get the query execution plan without executing.
|
|
911
|
+
*
|
|
912
|
+
* @param conn - Connection to use
|
|
913
|
+
* @param query - Query to explain
|
|
914
|
+
* @param options - Options including parameters
|
|
915
|
+
* @returns Query execution plan
|
|
916
|
+
*
|
|
917
|
+
* @example
|
|
918
|
+
* ```typescript
|
|
919
|
+
* const plan = await explain(conn, 'MATCH (n:Person)-[:KNOWS]->(m) RETURN n, m');
|
|
920
|
+
* console.log('Plan:', plan.root.type);
|
|
921
|
+
* console.log('Estimated cost:', plan.totalCost);
|
|
922
|
+
* ```
|
|
923
|
+
*/
|
|
924
|
+
declare function explain(conn: Connection, query: string, options?: ExplainOptions): Promise<QueryPlan>;
|
|
925
|
+
/**
|
|
926
|
+
* Execute a query with profiling and return execution statistics.
|
|
927
|
+
*
|
|
928
|
+
* Unlike explain(), profile() actually executes the query and measures
|
|
929
|
+
* real performance metrics.
|
|
930
|
+
*
|
|
931
|
+
* @param conn - Connection to use
|
|
932
|
+
* @param query - Query to profile
|
|
933
|
+
* @param options - Options including parameters
|
|
934
|
+
* @returns Query execution profile
|
|
935
|
+
*
|
|
936
|
+
* @example
|
|
937
|
+
* ```typescript
|
|
938
|
+
* const profile = await profile(conn, 'MATCH (n:Person) RETURN count(n)');
|
|
939
|
+
* console.log('Execution time:', profile.totalTimeMs, 'ms');
|
|
940
|
+
* console.log('Rows processed:', profile.totalRows);
|
|
941
|
+
* ```
|
|
942
|
+
*/
|
|
943
|
+
declare function profile(conn: Connection, query: string, options?: ExplainOptions): Promise<QueryProfile>;
|
|
944
|
+
/**
|
|
945
|
+
* Format a query plan as a human-readable string.
|
|
946
|
+
*/
|
|
947
|
+
declare function formatPlan(plan: QueryPlan, indent?: number): string;
|
|
948
|
+
/**
|
|
949
|
+
* Format a query profile as a human-readable string.
|
|
950
|
+
*/
|
|
951
|
+
declare function formatProfile(prof: QueryProfile, indent?: number): string;
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* Batch Query Operations
|
|
955
|
+
*
|
|
956
|
+
* Support for executing multiple queries efficiently.
|
|
957
|
+
*/
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* A single query in a batch.
|
|
961
|
+
*/
|
|
962
|
+
interface BatchQuery {
|
|
963
|
+
/** Query text */
|
|
964
|
+
query: string;
|
|
965
|
+
/** Optional parameters */
|
|
966
|
+
params?: QueryParams;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Result of a batch query.
|
|
970
|
+
*/
|
|
971
|
+
interface BatchResult {
|
|
972
|
+
/** Index in the batch (0-based) */
|
|
973
|
+
index: number;
|
|
974
|
+
/** Query that was executed */
|
|
975
|
+
query: string;
|
|
976
|
+
/** Whether the query succeeded */
|
|
977
|
+
success: boolean;
|
|
978
|
+
/** Rows returned (if query was successful) */
|
|
979
|
+
rows?: Record<string, unknown>[];
|
|
980
|
+
/** Error (if query failed) */
|
|
981
|
+
error?: Error;
|
|
982
|
+
/** Execution time in milliseconds */
|
|
983
|
+
durationMs?: number;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Summary of batch execution.
|
|
987
|
+
*/
|
|
988
|
+
interface BatchSummary {
|
|
989
|
+
/** Total number of queries */
|
|
990
|
+
total: number;
|
|
991
|
+
/** Number of successful queries */
|
|
992
|
+
successful: number;
|
|
993
|
+
/** Number of failed queries */
|
|
994
|
+
failed: number;
|
|
995
|
+
/** Total execution time in milliseconds */
|
|
996
|
+
totalDurationMs: number;
|
|
997
|
+
/** Individual results */
|
|
998
|
+
results: BatchResult[];
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Options for batch execution.
|
|
1002
|
+
*/
|
|
1003
|
+
interface BatchOptions {
|
|
1004
|
+
/** Stop on first error (default: false) */
|
|
1005
|
+
stopOnError?: boolean;
|
|
1006
|
+
/** Maximum concurrent queries (default: 1 - sequential) */
|
|
1007
|
+
concurrency?: number;
|
|
1008
|
+
/** Abort signal for cancellation */
|
|
1009
|
+
signal?: AbortSignal;
|
|
1010
|
+
/** Page size for result fetching */
|
|
1011
|
+
pageSize?: number;
|
|
1012
|
+
/** Execute within a transaction (default: false) */
|
|
1013
|
+
transaction?: boolean;
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Execute multiple queries in a batch.
|
|
1017
|
+
*
|
|
1018
|
+
* By default, queries are executed sequentially and all results are collected.
|
|
1019
|
+
* Set stopOnError to true to abort on the first failure.
|
|
1020
|
+
*
|
|
1021
|
+
* @param conn - Connection to use
|
|
1022
|
+
* @param queries - Array of queries to execute
|
|
1023
|
+
* @param options - Batch execution options
|
|
1024
|
+
* @returns Batch execution summary
|
|
1025
|
+
*
|
|
1026
|
+
* @example
|
|
1027
|
+
* ```typescript
|
|
1028
|
+
* const summary = await batch(conn, [
|
|
1029
|
+
* { query: 'CREATE (a:Person {name: "Alice"})' },
|
|
1030
|
+
* { query: 'CREATE (b:Person {name: "Bob"})' },
|
|
1031
|
+
* { query: 'MATCH (n:Person) RETURN count(n) AS cnt' },
|
|
1032
|
+
* ]);
|
|
1033
|
+
*
|
|
1034
|
+
* console.log(`${summary.successful}/${summary.total} queries succeeded`);
|
|
1035
|
+
* ```
|
|
1036
|
+
*/
|
|
1037
|
+
declare function batch(conn: Connection, queries: BatchQuery[], options?: BatchOptions): Promise<BatchSummary>;
|
|
1038
|
+
/**
|
|
1039
|
+
* Execute multiple queries and return only successful results.
|
|
1040
|
+
*
|
|
1041
|
+
* Failed queries are silently ignored (but logged if a logger is provided).
|
|
1042
|
+
*
|
|
1043
|
+
* @param conn - Connection to use
|
|
1044
|
+
* @param queries - Array of queries to execute
|
|
1045
|
+
* @param options - Batch execution options
|
|
1046
|
+
* @returns Array of successful row results
|
|
1047
|
+
*/
|
|
1048
|
+
declare function batchAll(conn: Connection, queries: BatchQuery[], options?: BatchOptions): Promise<Record<string, unknown>[][]>;
|
|
1049
|
+
/**
|
|
1050
|
+
* Execute queries and return the first successful result.
|
|
1051
|
+
*
|
|
1052
|
+
* Useful for trying multiple query variants.
|
|
1053
|
+
*
|
|
1054
|
+
* @param conn - Connection to use
|
|
1055
|
+
* @param queries - Array of queries to try
|
|
1056
|
+
* @param options - Batch execution options
|
|
1057
|
+
* @returns First successful result or null
|
|
1058
|
+
*/
|
|
1059
|
+
declare function batchFirst(conn: Connection, queries: BatchQuery[], options?: Omit<BatchOptions, 'stopOnError'>): Promise<Record<string, unknown>[] | null>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Execute a query for each item in an array.
|
|
1062
|
+
*
|
|
1063
|
+
* @param conn - Connection to use
|
|
1064
|
+
* @param queryTemplate - Query with $item parameter placeholder
|
|
1065
|
+
* @param items - Array of items to substitute
|
|
1066
|
+
* @param options - Batch execution options
|
|
1067
|
+
* @returns Batch summary
|
|
1068
|
+
*
|
|
1069
|
+
* @example
|
|
1070
|
+
* ```typescript
|
|
1071
|
+
* const summary = await batchMap(
|
|
1072
|
+
* conn,
|
|
1073
|
+
* 'CREATE (n:Person {name: $name})',
|
|
1074
|
+
* [{ name: 'Alice' }, { name: 'Bob' }]
|
|
1075
|
+
* );
|
|
1076
|
+
* ```
|
|
1077
|
+
*/
|
|
1078
|
+
declare function batchMap(conn: Connection, queryTemplate: string, items: QueryParams[], options?: BatchOptions): Promise<BatchSummary>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Execute queries in parallel with limited concurrency.
|
|
1081
|
+
*
|
|
1082
|
+
* Unlike the sequential batch(), this executes multiple queries concurrently
|
|
1083
|
+
* up to the specified limit.
|
|
1084
|
+
*
|
|
1085
|
+
* Note: Results may be returned out of order.
|
|
1086
|
+
*
|
|
1087
|
+
* @param conn - Connection to use
|
|
1088
|
+
* @param queries - Array of queries to execute
|
|
1089
|
+
* @param options - Batch execution options with concurrency
|
|
1090
|
+
* @returns Batch summary (results in completion order)
|
|
1091
|
+
*/
|
|
1092
|
+
declare function batchParallel(conn: Connection, queries: BatchQuery[], options?: BatchOptions & {
|
|
1093
|
+
concurrency: number;
|
|
1094
|
+
}): Promise<BatchSummary>;
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Geode Connection
|
|
1098
|
+
*
|
|
1099
|
+
* Connection management and query execution.
|
|
1100
|
+
*/
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* Query parameters type.
|
|
1104
|
+
*/
|
|
1105
|
+
type QueryParams = Record<string, unknown>;
|
|
1106
|
+
/**
|
|
1107
|
+
* Query options.
|
|
1108
|
+
*/
|
|
1109
|
+
interface QueryOptions {
|
|
1110
|
+
/** Query parameters */
|
|
1111
|
+
params?: QueryParams;
|
|
1112
|
+
/** Abort signal for cancellation */
|
|
1113
|
+
signal?: AbortSignal;
|
|
1114
|
+
/** Page size for result pagination */
|
|
1115
|
+
pageSize?: number;
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Connection to a Geode database.
|
|
1119
|
+
*/
|
|
1120
|
+
declare class Connection {
|
|
1121
|
+
private _config;
|
|
1122
|
+
private _transport;
|
|
1123
|
+
private _state;
|
|
1124
|
+
private _inTransaction;
|
|
1125
|
+
private _activeResult;
|
|
1126
|
+
private _requestId;
|
|
1127
|
+
private constructor();
|
|
1128
|
+
/**
|
|
1129
|
+
* Create a new connection to the Geode server.
|
|
1130
|
+
*/
|
|
1131
|
+
static connect(config: GeodeConfig): Promise<Connection>;
|
|
1132
|
+
/**
|
|
1133
|
+
* Create a connection with a custom transport (for testing).
|
|
1134
|
+
*/
|
|
1135
|
+
static connectWithTransport(config: GeodeConfig, transport: Transport): Promise<Connection>;
|
|
1136
|
+
/**
|
|
1137
|
+
* Get connection configuration.
|
|
1138
|
+
*/
|
|
1139
|
+
get config(): Readonly<GeodeConfig>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Get current connection state.
|
|
1142
|
+
*/
|
|
1143
|
+
get state(): ConnectionState;
|
|
1144
|
+
/**
|
|
1145
|
+
* Check if connection is in a transaction.
|
|
1146
|
+
*/
|
|
1147
|
+
get inTransaction(): boolean;
|
|
1148
|
+
/**
|
|
1149
|
+
* Check if connection is closed.
|
|
1150
|
+
*/
|
|
1151
|
+
get isClosed(): boolean;
|
|
1152
|
+
/**
|
|
1153
|
+
* Perform the HELLO handshake.
|
|
1154
|
+
*
|
|
1155
|
+
* Note: The server may return an ERROR frame with "Authentication required"
|
|
1156
|
+
* even when no authentication is configured. This is a known server behavior
|
|
1157
|
+
* that should be treated as a successful connection (matching other clients).
|
|
1158
|
+
*/
|
|
1159
|
+
private hello;
|
|
1160
|
+
/**
|
|
1161
|
+
* Execute a query that returns rows.
|
|
1162
|
+
*/
|
|
1163
|
+
query(query: string, options?: QueryOptions): Promise<QueryResult>;
|
|
1164
|
+
/**
|
|
1165
|
+
* Execute a query and return all rows as an array.
|
|
1166
|
+
*/
|
|
1167
|
+
queryAll(query: string, options?: QueryOptions): Promise<Record<string, unknown>[]>;
|
|
1168
|
+
/**
|
|
1169
|
+
* Execute a query that doesn't return rows.
|
|
1170
|
+
*/
|
|
1171
|
+
exec(query: string, options?: QueryOptions): Promise<void>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Fetch the next page of results (internal).
|
|
1174
|
+
*/
|
|
1175
|
+
_fetchNextPage(pageSize: number, signal?: AbortSignal): Promise<{
|
|
1176
|
+
rows: Record<string, unknown>[];
|
|
1177
|
+
final: boolean;
|
|
1178
|
+
}>;
|
|
1179
|
+
private _tryReceiveInlineFrame;
|
|
1180
|
+
/**
|
|
1181
|
+
* Release active result (internal).
|
|
1182
|
+
*/
|
|
1183
|
+
_releaseResult(result: QueryResult): void;
|
|
1184
|
+
/**
|
|
1185
|
+
* Begin a transaction.
|
|
1186
|
+
*/
|
|
1187
|
+
begin(signal?: AbortSignal): Promise<Transaction>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Commit the current transaction (internal).
|
|
1190
|
+
*/
|
|
1191
|
+
_commit(signal?: AbortSignal): Promise<void>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Rollback the current transaction (internal).
|
|
1194
|
+
*/
|
|
1195
|
+
_rollback(signal?: AbortSignal): Promise<void>;
|
|
1196
|
+
/**
|
|
1197
|
+
* Create a savepoint (internal).
|
|
1198
|
+
*/
|
|
1199
|
+
_savepoint(name: string, signal?: AbortSignal): Promise<void>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Rollback to a savepoint (internal).
|
|
1202
|
+
*/
|
|
1203
|
+
_rollbackTo(name: string, signal?: AbortSignal): Promise<void>;
|
|
1204
|
+
/**
|
|
1205
|
+
* Ping the server to check connection health.
|
|
1206
|
+
*/
|
|
1207
|
+
ping(signal?: AbortSignal): Promise<void>;
|
|
1208
|
+
/**
|
|
1209
|
+
* Reset the connection session.
|
|
1210
|
+
*/
|
|
1211
|
+
reset(signal?: AbortSignal): Promise<void>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Close the connection.
|
|
1214
|
+
*/
|
|
1215
|
+
close(): Promise<void>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Create a prepared statement.
|
|
1218
|
+
*
|
|
1219
|
+
* @param query - Query text with parameters
|
|
1220
|
+
* @returns Prepared statement
|
|
1221
|
+
*/
|
|
1222
|
+
prepare(query: string): Promise<PreparedStatement>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Get the query execution plan without executing.
|
|
1225
|
+
*
|
|
1226
|
+
* @param query - Query to explain
|
|
1227
|
+
* @param options - Options including parameters
|
|
1228
|
+
* @returns Query execution plan
|
|
1229
|
+
*/
|
|
1230
|
+
explain(query: string, options?: ExplainOptions): Promise<QueryPlan>;
|
|
1231
|
+
/**
|
|
1232
|
+
* Execute a query with profiling.
|
|
1233
|
+
*
|
|
1234
|
+
* @param query - Query to profile
|
|
1235
|
+
* @param options - Options including parameters
|
|
1236
|
+
* @returns Query execution profile
|
|
1237
|
+
*/
|
|
1238
|
+
profile(query: string, options?: ExplainOptions): Promise<QueryProfile>;
|
|
1239
|
+
/**
|
|
1240
|
+
* Execute multiple queries in a batch.
|
|
1241
|
+
*
|
|
1242
|
+
* @param queries - Array of queries to execute
|
|
1243
|
+
* @param options - Batch execution options
|
|
1244
|
+
* @returns Batch execution summary
|
|
1245
|
+
*/
|
|
1246
|
+
batch(queries: BatchQuery[], options?: BatchOptions): Promise<BatchSummary>;
|
|
1247
|
+
/**
|
|
1248
|
+
* Check connection state before operation.
|
|
1249
|
+
*/
|
|
1250
|
+
private checkState;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* Authentication and Authorization Client
|
|
1255
|
+
*
|
|
1256
|
+
* Support for user management, role-based access control, and row-level security.
|
|
1257
|
+
*/
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* User information.
|
|
1261
|
+
*/
|
|
1262
|
+
interface User {
|
|
1263
|
+
/** Username */
|
|
1264
|
+
username: string;
|
|
1265
|
+
/** User roles */
|
|
1266
|
+
roles: string[];
|
|
1267
|
+
/** Whether the user is active */
|
|
1268
|
+
active: boolean;
|
|
1269
|
+
/** Creation timestamp */
|
|
1270
|
+
createdAt?: Date;
|
|
1271
|
+
/** Last login timestamp */
|
|
1272
|
+
lastLoginAt?: Date;
|
|
1273
|
+
/** User metadata */
|
|
1274
|
+
metadata?: Record<string, unknown>;
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Role information.
|
|
1278
|
+
*/
|
|
1279
|
+
interface Role {
|
|
1280
|
+
/** Role name */
|
|
1281
|
+
name: string;
|
|
1282
|
+
/** Role description */
|
|
1283
|
+
description?: string;
|
|
1284
|
+
/** Permissions granted to this role */
|
|
1285
|
+
permissions: Permission[];
|
|
1286
|
+
/** Whether the role is a system role */
|
|
1287
|
+
system?: boolean;
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Permission definition.
|
|
1291
|
+
*/
|
|
1292
|
+
interface Permission {
|
|
1293
|
+
/** Resource type (e.g., 'NODE', 'EDGE', 'GRAPH') */
|
|
1294
|
+
resource: string;
|
|
1295
|
+
/** Action allowed (e.g., 'READ', 'WRITE', 'DELETE') */
|
|
1296
|
+
action: string;
|
|
1297
|
+
/** Optional label filter */
|
|
1298
|
+
label?: string;
|
|
1299
|
+
/** Optional property filters */
|
|
1300
|
+
properties?: string[];
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Row-Level Security (RLS) policy.
|
|
1304
|
+
*/
|
|
1305
|
+
interface RLSPolicy {
|
|
1306
|
+
/** Policy name */
|
|
1307
|
+
name: string;
|
|
1308
|
+
/** Target label */
|
|
1309
|
+
label: string;
|
|
1310
|
+
/** Policy action ('READ', 'WRITE', 'ALL') */
|
|
1311
|
+
action: 'READ' | 'WRITE' | 'ALL';
|
|
1312
|
+
/** GQL predicate expression */
|
|
1313
|
+
predicate: string;
|
|
1314
|
+
/** Roles this policy applies to */
|
|
1315
|
+
roles?: string[];
|
|
1316
|
+
/** Whether the policy is enabled */
|
|
1317
|
+
enabled: boolean;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Options for creating a user.
|
|
1321
|
+
*/
|
|
1322
|
+
interface CreateUserOptions {
|
|
1323
|
+
/** Initial password */
|
|
1324
|
+
password: string;
|
|
1325
|
+
/** Roles to assign */
|
|
1326
|
+
roles?: string[];
|
|
1327
|
+
/** User metadata */
|
|
1328
|
+
metadata?: Record<string, unknown>;
|
|
1329
|
+
/** Whether to activate immediately */
|
|
1330
|
+
active?: boolean;
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Options for creating a role.
|
|
1334
|
+
*/
|
|
1335
|
+
interface CreateRoleOptions {
|
|
1336
|
+
/** Role description */
|
|
1337
|
+
description?: string;
|
|
1338
|
+
/** Initial permissions */
|
|
1339
|
+
permissions?: Permission[];
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Options for creating an RLS policy.
|
|
1343
|
+
*/
|
|
1344
|
+
interface CreateRLSPolicyOptions {
|
|
1345
|
+
/** Roles to apply policy to (empty = all roles) */
|
|
1346
|
+
roles?: string[];
|
|
1347
|
+
/** Whether to enable immediately */
|
|
1348
|
+
enabled?: boolean;
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Authentication and authorization client.
|
|
1352
|
+
*
|
|
1353
|
+
* Provides methods for managing users, roles, and row-level security policies.
|
|
1354
|
+
*
|
|
1355
|
+
* @example
|
|
1356
|
+
* ```typescript
|
|
1357
|
+
* const auth = new AuthClient(conn);
|
|
1358
|
+
*
|
|
1359
|
+
* // Create a user
|
|
1360
|
+
* await auth.createUser('alice', { password: 'secret123' });
|
|
1361
|
+
*
|
|
1362
|
+
* // Create a role
|
|
1363
|
+
* await auth.createRole('analyst', {
|
|
1364
|
+
* permissions: [{ resource: 'NODE', action: 'READ' }]
|
|
1365
|
+
* });
|
|
1366
|
+
*
|
|
1367
|
+
* // Assign role to user
|
|
1368
|
+
* await auth.assignRole('alice', 'analyst');
|
|
1369
|
+
* ```
|
|
1370
|
+
*/
|
|
1371
|
+
declare class AuthClient {
|
|
1372
|
+
private _conn;
|
|
1373
|
+
/**
|
|
1374
|
+
* Create a new auth client.
|
|
1375
|
+
*
|
|
1376
|
+
* @param conn - Connection to use
|
|
1377
|
+
*/
|
|
1378
|
+
constructor(conn: Connection);
|
|
1379
|
+
/**
|
|
1380
|
+
* Create a new user.
|
|
1381
|
+
*
|
|
1382
|
+
* @param username - Username for the new user
|
|
1383
|
+
* @param options - User creation options
|
|
1384
|
+
*/
|
|
1385
|
+
createUser(username: string, options: CreateUserOptions): Promise<void>;
|
|
1386
|
+
/**
|
|
1387
|
+
* Delete a user.
|
|
1388
|
+
*
|
|
1389
|
+
* @param username - Username to delete
|
|
1390
|
+
*/
|
|
1391
|
+
deleteUser(username: string): Promise<void>;
|
|
1392
|
+
/**
|
|
1393
|
+
* Get user information.
|
|
1394
|
+
*
|
|
1395
|
+
* @param username - Username to look up
|
|
1396
|
+
* @returns User information or null if not found
|
|
1397
|
+
*/
|
|
1398
|
+
getUser(username: string): Promise<User | null>;
|
|
1399
|
+
/**
|
|
1400
|
+
* List all users.
|
|
1401
|
+
*
|
|
1402
|
+
* @returns Array of users
|
|
1403
|
+
*/
|
|
1404
|
+
listUsers(): Promise<User[]>;
|
|
1405
|
+
/**
|
|
1406
|
+
* Change a user's password.
|
|
1407
|
+
*
|
|
1408
|
+
* @param username - Username
|
|
1409
|
+
* @param newPassword - New password
|
|
1410
|
+
*/
|
|
1411
|
+
changePassword(username: string, newPassword: string): Promise<void>;
|
|
1412
|
+
/**
|
|
1413
|
+
* Activate a user.
|
|
1414
|
+
*
|
|
1415
|
+
* @param username - Username to activate
|
|
1416
|
+
*/
|
|
1417
|
+
activateUser(username: string): Promise<void>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Deactivate a user.
|
|
1420
|
+
*
|
|
1421
|
+
* @param username - Username to deactivate
|
|
1422
|
+
*/
|
|
1423
|
+
deactivateUser(username: string): Promise<void>;
|
|
1424
|
+
/**
|
|
1425
|
+
* Create a new role.
|
|
1426
|
+
*
|
|
1427
|
+
* @param name - Role name
|
|
1428
|
+
* @param options - Role creation options
|
|
1429
|
+
*/
|
|
1430
|
+
createRole(name: string, options?: CreateRoleOptions): Promise<void>;
|
|
1431
|
+
/**
|
|
1432
|
+
* Delete a role.
|
|
1433
|
+
*
|
|
1434
|
+
* @param name - Role name to delete
|
|
1435
|
+
*/
|
|
1436
|
+
deleteRole(name: string): Promise<void>;
|
|
1437
|
+
/**
|
|
1438
|
+
* Get role information.
|
|
1439
|
+
*
|
|
1440
|
+
* @param name - Role name
|
|
1441
|
+
* @returns Role information or null if not found
|
|
1442
|
+
*/
|
|
1443
|
+
getRole(name: string): Promise<Role | null>;
|
|
1444
|
+
/**
|
|
1445
|
+
* List all roles.
|
|
1446
|
+
*
|
|
1447
|
+
* @returns Array of roles
|
|
1448
|
+
*/
|
|
1449
|
+
listRoles(): Promise<Role[]>;
|
|
1450
|
+
/**
|
|
1451
|
+
* Assign a role to a user.
|
|
1452
|
+
*
|
|
1453
|
+
* @param username - Username
|
|
1454
|
+
* @param roleName - Role to assign
|
|
1455
|
+
*/
|
|
1456
|
+
assignRole(username: string, roleName: string): Promise<void>;
|
|
1457
|
+
/**
|
|
1458
|
+
* Revoke a role from a user.
|
|
1459
|
+
*
|
|
1460
|
+
* @param username - Username
|
|
1461
|
+
* @param roleName - Role to revoke
|
|
1462
|
+
*/
|
|
1463
|
+
revokeRole(username: string, roleName: string): Promise<void>;
|
|
1464
|
+
/**
|
|
1465
|
+
* Grant a permission to a role.
|
|
1466
|
+
*
|
|
1467
|
+
* @param roleName - Role name
|
|
1468
|
+
* @param permission - Permission to grant
|
|
1469
|
+
*/
|
|
1470
|
+
grantPermission(roleName: string, permission: Permission): Promise<void>;
|
|
1471
|
+
/**
|
|
1472
|
+
* Revoke a permission from a role.
|
|
1473
|
+
*
|
|
1474
|
+
* @param roleName - Role name
|
|
1475
|
+
* @param permission - Permission to revoke
|
|
1476
|
+
*/
|
|
1477
|
+
revokePermission(roleName: string, permission: Permission): Promise<void>;
|
|
1478
|
+
/**
|
|
1479
|
+
* Create an RLS policy.
|
|
1480
|
+
*
|
|
1481
|
+
* @param name - Policy name
|
|
1482
|
+
* @param label - Target label
|
|
1483
|
+
* @param action - Policy action
|
|
1484
|
+
* @param predicate - GQL predicate expression
|
|
1485
|
+
* @param options - Additional options
|
|
1486
|
+
*/
|
|
1487
|
+
createRLSPolicy(name: string, label: string, action: 'READ' | 'WRITE' | 'ALL', predicate: string, options?: CreateRLSPolicyOptions): Promise<void>;
|
|
1488
|
+
/**
|
|
1489
|
+
* Delete an RLS policy.
|
|
1490
|
+
*
|
|
1491
|
+
* @param name - Policy name
|
|
1492
|
+
* @param label - Target label
|
|
1493
|
+
*/
|
|
1494
|
+
deleteRLSPolicy(name: string, label: string): Promise<void>;
|
|
1495
|
+
/**
|
|
1496
|
+
* Get RLS policy information.
|
|
1497
|
+
*
|
|
1498
|
+
* @param name - Policy name
|
|
1499
|
+
* @returns Policy information or null if not found
|
|
1500
|
+
*/
|
|
1501
|
+
getRLSPolicy(name: string): Promise<RLSPolicy | null>;
|
|
1502
|
+
/**
|
|
1503
|
+
* List all RLS policies.
|
|
1504
|
+
*
|
|
1505
|
+
* @param label - Optional label to filter by
|
|
1506
|
+
* @returns Array of policies
|
|
1507
|
+
*/
|
|
1508
|
+
listRLSPolicies(label?: string): Promise<RLSPolicy[]>;
|
|
1509
|
+
/**
|
|
1510
|
+
* Enable an RLS policy.
|
|
1511
|
+
*
|
|
1512
|
+
* @param name - Policy name
|
|
1513
|
+
* @param label - Target label
|
|
1514
|
+
*/
|
|
1515
|
+
enableRLSPolicy(name: string, label: string): Promise<void>;
|
|
1516
|
+
/**
|
|
1517
|
+
* Disable an RLS policy.
|
|
1518
|
+
*
|
|
1519
|
+
* @param name - Policy name
|
|
1520
|
+
* @param label - Target label
|
|
1521
|
+
*/
|
|
1522
|
+
disableRLSPolicy(name: string, label: string): Promise<void>;
|
|
1523
|
+
/**
|
|
1524
|
+
* Get the current session user.
|
|
1525
|
+
*
|
|
1526
|
+
* @returns Current username
|
|
1527
|
+
*/
|
|
1528
|
+
currentUser(): Promise<string>;
|
|
1529
|
+
/**
|
|
1530
|
+
* Get the current session roles.
|
|
1531
|
+
*
|
|
1532
|
+
* @returns Current roles
|
|
1533
|
+
*/
|
|
1534
|
+
currentRoles(): Promise<string[]>;
|
|
1535
|
+
/**
|
|
1536
|
+
* Check if the current session has a specific permission.
|
|
1537
|
+
*
|
|
1538
|
+
* @param resource - Resource type
|
|
1539
|
+
* @param action - Action to check
|
|
1540
|
+
* @param label - Optional label filter
|
|
1541
|
+
* @returns Whether permission is granted
|
|
1542
|
+
*/
|
|
1543
|
+
hasPermission(resource: string, action: string, label?: string): Promise<boolean>;
|
|
1544
|
+
private validateUsername;
|
|
1545
|
+
private validatePassword;
|
|
1546
|
+
private validateRoleName;
|
|
1547
|
+
private validatePolicyName;
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Create an auth client from a connection.
|
|
1551
|
+
*/
|
|
1552
|
+
declare function createAuthClient(conn: Connection): AuthClient;
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* Geode Client
|
|
1556
|
+
*
|
|
1557
|
+
* High-level client for interacting with Geode graph database.
|
|
1558
|
+
*/
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* Client configuration options.
|
|
1562
|
+
*/
|
|
1563
|
+
interface ClientOptions extends Partial<GeodeConfig> {
|
|
1564
|
+
/** Use connection pooling */
|
|
1565
|
+
pooling?: boolean;
|
|
1566
|
+
/** Pool-specific options */
|
|
1567
|
+
pool?: {
|
|
1568
|
+
min?: number;
|
|
1569
|
+
max?: number;
|
|
1570
|
+
acquireTimeout?: number;
|
|
1571
|
+
idleTimeout?: number;
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Geode Client - main entry point for database operations.
|
|
1576
|
+
*/
|
|
1577
|
+
declare class GeodeClient {
|
|
1578
|
+
private _config;
|
|
1579
|
+
private _pool?;
|
|
1580
|
+
private _connection?;
|
|
1581
|
+
private constructor();
|
|
1582
|
+
/**
|
|
1583
|
+
* Create a new client from a DSN string.
|
|
1584
|
+
*/
|
|
1585
|
+
static connect(dsn: string, options?: ClientOptions): Promise<GeodeClient>;
|
|
1586
|
+
/**
|
|
1587
|
+
* Create a new client from configuration.
|
|
1588
|
+
*/
|
|
1589
|
+
static connectWithConfig(config: GeodeConfig, options?: ClientOptions): Promise<GeodeClient>;
|
|
1590
|
+
/**
|
|
1591
|
+
* Get the client configuration.
|
|
1592
|
+
*/
|
|
1593
|
+
get config(): Readonly<GeodeConfig>;
|
|
1594
|
+
/**
|
|
1595
|
+
* Check if client is closed.
|
|
1596
|
+
*/
|
|
1597
|
+
get isClosed(): boolean;
|
|
1598
|
+
/**
|
|
1599
|
+
* Get pool statistics (if using pooling).
|
|
1600
|
+
*/
|
|
1601
|
+
get poolStats(): {
|
|
1602
|
+
total: number;
|
|
1603
|
+
available: number;
|
|
1604
|
+
inUse: number;
|
|
1605
|
+
waiting: number;
|
|
1606
|
+
} | null;
|
|
1607
|
+
/**
|
|
1608
|
+
* Execute a query and return results.
|
|
1609
|
+
*/
|
|
1610
|
+
query(query: string, options?: QueryOptions): Promise<QueryResult>;
|
|
1611
|
+
/**
|
|
1612
|
+
* Execute a query and return all rows as objects.
|
|
1613
|
+
*/
|
|
1614
|
+
queryAll(query: string, options?: QueryOptions): Promise<Record<string, unknown>[]>;
|
|
1615
|
+
/**
|
|
1616
|
+
* Execute a query and return the first row.
|
|
1617
|
+
*/
|
|
1618
|
+
queryFirst(query: string, options?: QueryOptions): Promise<Record<string, unknown> | null>;
|
|
1619
|
+
/**
|
|
1620
|
+
* Execute a query and return a scalar value.
|
|
1621
|
+
*/
|
|
1622
|
+
queryScalar<T = unknown>(query: string, column: string, options?: QueryOptions): Promise<T | null>;
|
|
1623
|
+
/**
|
|
1624
|
+
* Execute a statement that doesn't return rows.
|
|
1625
|
+
*/
|
|
1626
|
+
exec(query: string, options?: QueryOptions): Promise<void>;
|
|
1627
|
+
/**
|
|
1628
|
+
* Execute multiple statements.
|
|
1629
|
+
*/
|
|
1630
|
+
execBatch(queries: Array<{
|
|
1631
|
+
query: string;
|
|
1632
|
+
params?: QueryParams;
|
|
1633
|
+
}>): Promise<void>;
|
|
1634
|
+
/**
|
|
1635
|
+
* Execute a function within a transaction.
|
|
1636
|
+
*/
|
|
1637
|
+
withTransaction<T>(fn: (tx: Transaction) => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
1638
|
+
/**
|
|
1639
|
+
* Get a raw connection from the pool (or the single connection).
|
|
1640
|
+
*
|
|
1641
|
+
* The connection must be released after use.
|
|
1642
|
+
*/
|
|
1643
|
+
getConnection(signal?: AbortSignal): Promise<Connection>;
|
|
1644
|
+
/**
|
|
1645
|
+
* Release a connection back to the pool.
|
|
1646
|
+
*
|
|
1647
|
+
* Only needed when using getConnection() with pooling.
|
|
1648
|
+
*/
|
|
1649
|
+
releaseConnection(conn: Connection): Promise<void>;
|
|
1650
|
+
/**
|
|
1651
|
+
* Execute a function with a dedicated connection.
|
|
1652
|
+
*/
|
|
1653
|
+
withConnection<T>(fn: (conn: Connection) => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
1654
|
+
/**
|
|
1655
|
+
* Ping the server to check connectivity.
|
|
1656
|
+
*/
|
|
1657
|
+
ping(signal?: AbortSignal): Promise<void>;
|
|
1658
|
+
/**
|
|
1659
|
+
* Close the client and release all resources.
|
|
1660
|
+
*/
|
|
1661
|
+
close(): Promise<void>;
|
|
1662
|
+
/**
|
|
1663
|
+
* Create a node with labels and properties.
|
|
1664
|
+
*/
|
|
1665
|
+
createNode(labels: string | string[], properties?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1666
|
+
/**
|
|
1667
|
+
* Find nodes by label and optional property filter.
|
|
1668
|
+
*/
|
|
1669
|
+
findNodes(label: string, filter?: Record<string, unknown>, options?: {
|
|
1670
|
+
limit?: number;
|
|
1671
|
+
skip?: number;
|
|
1672
|
+
}): Promise<Record<string, unknown>[]>;
|
|
1673
|
+
/**
|
|
1674
|
+
* Find a single node by label and property.
|
|
1675
|
+
*/
|
|
1676
|
+
findNode(label: string, property: string, value: unknown): Promise<Record<string, unknown> | null>;
|
|
1677
|
+
/**
|
|
1678
|
+
* Create a relationship between two nodes.
|
|
1679
|
+
*/
|
|
1680
|
+
createRelationship(startLabel: string, startProp: string, startValue: unknown, type: string, endLabel: string, endProp: string, endValue: unknown, properties?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1681
|
+
/**
|
|
1682
|
+
* Delete a node by label and property.
|
|
1683
|
+
*/
|
|
1684
|
+
deleteNode(label: string, property: string, value: unknown): Promise<number>;
|
|
1685
|
+
/**
|
|
1686
|
+
* Update node properties.
|
|
1687
|
+
*/
|
|
1688
|
+
updateNode(label: string, matchProp: string, matchValue: unknown, updates: Record<string, unknown>): Promise<Record<string, unknown> | null>;
|
|
1689
|
+
/**
|
|
1690
|
+
* Count nodes by label.
|
|
1691
|
+
*/
|
|
1692
|
+
countNodes(label: string, filter?: Record<string, unknown>): Promise<number>;
|
|
1693
|
+
/**
|
|
1694
|
+
* Create a prepared statement.
|
|
1695
|
+
*
|
|
1696
|
+
* @param query - Query text with parameters
|
|
1697
|
+
* @returns Prepared statement
|
|
1698
|
+
*
|
|
1699
|
+
* @example
|
|
1700
|
+
* ```typescript
|
|
1701
|
+
* const stmt = client.prepare('MATCH (n:Person {name: $name}) RETURN n');
|
|
1702
|
+
* const result1 = await stmt.query({ name: 'Alice' });
|
|
1703
|
+
* const result2 = await stmt.query({ name: 'Bob' });
|
|
1704
|
+
* stmt.close();
|
|
1705
|
+
* ```
|
|
1706
|
+
*/
|
|
1707
|
+
prepare(query: string): Promise<PreparedStatement>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Get the query execution plan without executing.
|
|
1710
|
+
*
|
|
1711
|
+
* @param query - Query to explain
|
|
1712
|
+
* @param options - Options including parameters
|
|
1713
|
+
* @returns Query execution plan
|
|
1714
|
+
*
|
|
1715
|
+
* @example
|
|
1716
|
+
* ```typescript
|
|
1717
|
+
* const plan = await client.explain('MATCH (n:Person)-[:KNOWS]->(m) RETURN n, m');
|
|
1718
|
+
* console.log('Estimated cost:', plan.totalCost);
|
|
1719
|
+
* ```
|
|
1720
|
+
*/
|
|
1721
|
+
explain(query: string, options?: ExplainOptions): Promise<QueryPlan>;
|
|
1722
|
+
/**
|
|
1723
|
+
* Execute a query with profiling.
|
|
1724
|
+
*
|
|
1725
|
+
* @param query - Query to profile
|
|
1726
|
+
* @param options - Options including parameters
|
|
1727
|
+
* @returns Query execution profile
|
|
1728
|
+
*
|
|
1729
|
+
* @example
|
|
1730
|
+
* ```typescript
|
|
1731
|
+
* const profile = await client.profile('MATCH (n:Person) RETURN count(n)');
|
|
1732
|
+
* console.log('Execution time:', profile.totalTimeMs, 'ms');
|
|
1733
|
+
* ```
|
|
1734
|
+
*/
|
|
1735
|
+
profile(query: string, options?: ExplainOptions): Promise<QueryProfile>;
|
|
1736
|
+
/**
|
|
1737
|
+
* Execute multiple queries in a batch.
|
|
1738
|
+
*
|
|
1739
|
+
* @param queries - Array of queries to execute
|
|
1740
|
+
* @param options - Batch execution options
|
|
1741
|
+
* @returns Batch execution summary
|
|
1742
|
+
*
|
|
1743
|
+
* @example
|
|
1744
|
+
* ```typescript
|
|
1745
|
+
* const summary = await client.batch([
|
|
1746
|
+
* { query: 'CREATE (a:Person {name: "Alice"})' },
|
|
1747
|
+
* { query: 'CREATE (b:Person {name: "Bob"})' },
|
|
1748
|
+
* ]);
|
|
1749
|
+
* console.log(`${summary.successful}/${summary.total} succeeded`);
|
|
1750
|
+
* ```
|
|
1751
|
+
*/
|
|
1752
|
+
batch(queries: BatchQuery[], options?: BatchOptions): Promise<BatchSummary>;
|
|
1753
|
+
/**
|
|
1754
|
+
* Get an auth client for user and role management.
|
|
1755
|
+
*
|
|
1756
|
+
* @returns Auth client
|
|
1757
|
+
*
|
|
1758
|
+
* @example
|
|
1759
|
+
* ```typescript
|
|
1760
|
+
* const auth = await client.auth();
|
|
1761
|
+
* await auth.createUser('alice', { password: 'secret123' });
|
|
1762
|
+
* await auth.assignRole('alice', 'analyst');
|
|
1763
|
+
* ```
|
|
1764
|
+
*/
|
|
1765
|
+
auth(): Promise<AuthClient>;
|
|
1766
|
+
}
|
|
1767
|
+
/**
|
|
1768
|
+
* Create a Geode client from a DSN string.
|
|
1769
|
+
*
|
|
1770
|
+
* @example
|
|
1771
|
+
* ```typescript
|
|
1772
|
+
* const client = await createClient('geode://localhost:3141');
|
|
1773
|
+
* const rows = await client.queryAll('MATCH (n) RETURN n LIMIT 10');
|
|
1774
|
+
* await client.close();
|
|
1775
|
+
* ```
|
|
1776
|
+
*/
|
|
1777
|
+
declare function createClient(dsn: string, options?: ClientOptions): Promise<GeodeClient>;
|
|
1778
|
+
/**
|
|
1779
|
+
* Create a Geode client from configuration.
|
|
1780
|
+
*/
|
|
1781
|
+
declare function createClientWithConfig(config: GeodeConfig, options?: ClientOptions): Promise<GeodeClient>;
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* Connection Pool
|
|
1785
|
+
*
|
|
1786
|
+
* Manages a pool of connections for efficient resource utilization.
|
|
1787
|
+
*/
|
|
1788
|
+
|
|
1789
|
+
/**
|
|
1790
|
+
* Connection pool for managing multiple connections.
|
|
1791
|
+
*/
|
|
1792
|
+
declare class ConnectionPool {
|
|
1793
|
+
private _config;
|
|
1794
|
+
private _connections;
|
|
1795
|
+
private _waitQueue;
|
|
1796
|
+
private _closed;
|
|
1797
|
+
private _maintenanceInterval?;
|
|
1798
|
+
private _minConnections;
|
|
1799
|
+
private _maxConnections;
|
|
1800
|
+
private _acquireTimeout;
|
|
1801
|
+
private _idleTimeout;
|
|
1802
|
+
constructor(config: PoolConfig);
|
|
1803
|
+
/**
|
|
1804
|
+
* Create a new connection pool.
|
|
1805
|
+
*/
|
|
1806
|
+
static create(config: PoolConfig): Promise<ConnectionPool>;
|
|
1807
|
+
/**
|
|
1808
|
+
* Get pool statistics.
|
|
1809
|
+
*/
|
|
1810
|
+
get stats(): {
|
|
1811
|
+
total: number;
|
|
1812
|
+
available: number;
|
|
1813
|
+
inUse: number;
|
|
1814
|
+
waiting: number;
|
|
1815
|
+
};
|
|
1816
|
+
/**
|
|
1817
|
+
* Check if pool is closed.
|
|
1818
|
+
*/
|
|
1819
|
+
get isClosed(): boolean;
|
|
1820
|
+
/**
|
|
1821
|
+
* Acquire a connection from the pool.
|
|
1822
|
+
*/
|
|
1823
|
+
acquire(signal?: AbortSignal): Promise<Connection>;
|
|
1824
|
+
/**
|
|
1825
|
+
* Release a connection back to the pool.
|
|
1826
|
+
*/
|
|
1827
|
+
release(conn: Connection): Promise<void>;
|
|
1828
|
+
/**
|
|
1829
|
+
* Execute a function with a connection from the pool.
|
|
1830
|
+
*/
|
|
1831
|
+
withConnection<T>(fn: (conn: Connection) => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
1832
|
+
/**
|
|
1833
|
+
* Execute a query using a pooled connection.
|
|
1834
|
+
*/
|
|
1835
|
+
query(query: string, options?: QueryOptions): Promise<QueryResult>;
|
|
1836
|
+
/**
|
|
1837
|
+
* Execute a query and return all rows.
|
|
1838
|
+
*/
|
|
1839
|
+
queryAll(query: string, options?: QueryOptions): Promise<Record<string, unknown>[]>;
|
|
1840
|
+
/**
|
|
1841
|
+
* Execute a statement that doesn't return rows.
|
|
1842
|
+
*/
|
|
1843
|
+
exec(query: string, options?: QueryOptions): Promise<void>;
|
|
1844
|
+
/**
|
|
1845
|
+
* Execute a function within a transaction.
|
|
1846
|
+
*/
|
|
1847
|
+
withTransaction<T>(fn: (tx: Transaction) => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
1848
|
+
/**
|
|
1849
|
+
* Ping to verify pool health.
|
|
1850
|
+
*/
|
|
1851
|
+
ping(signal?: AbortSignal): Promise<void>;
|
|
1852
|
+
/**
|
|
1853
|
+
* Close the pool and all connections.
|
|
1854
|
+
*/
|
|
1855
|
+
close(): Promise<void>;
|
|
1856
|
+
/**
|
|
1857
|
+
* Add a new connection to the pool.
|
|
1858
|
+
*/
|
|
1859
|
+
private addConnection;
|
|
1860
|
+
/**
|
|
1861
|
+
* Remove a connection from the pool.
|
|
1862
|
+
*/
|
|
1863
|
+
private removeConnection;
|
|
1864
|
+
/**
|
|
1865
|
+
* Perform pool maintenance.
|
|
1866
|
+
*/
|
|
1867
|
+
private maintenance;
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
/**
|
|
1871
|
+
* Geode Wire Protocol
|
|
1872
|
+
*
|
|
1873
|
+
* JSON line protocol implementation for communication with Geode server.
|
|
1874
|
+
*/
|
|
1875
|
+
|
|
1876
|
+
declare const MsgType: {
|
|
1877
|
+
readonly HELLO: "HELLO";
|
|
1878
|
+
readonly RUN_GQL: "RUN_GQL";
|
|
1879
|
+
readonly PULL: "PULL";
|
|
1880
|
+
readonly BEGIN: "BEGIN";
|
|
1881
|
+
readonly COMMIT: "COMMIT";
|
|
1882
|
+
readonly ROLLBACK: "ROLLBACK";
|
|
1883
|
+
readonly SAVEPOINT: "SAVEPOINT";
|
|
1884
|
+
readonly ROLLBACK_TO: "ROLLBACK_TO";
|
|
1885
|
+
readonly PING: "PING";
|
|
1886
|
+
};
|
|
1887
|
+
type MsgType = (typeof MsgType)[keyof typeof MsgType];
|
|
1888
|
+
declare const RespType: {
|
|
1889
|
+
readonly HELLO: "HELLO";
|
|
1890
|
+
readonly SCHEMA: "SCHEMA";
|
|
1891
|
+
readonly BINDINGS: "BINDINGS";
|
|
1892
|
+
readonly ERROR: "ERROR";
|
|
1893
|
+
readonly EXPLAIN: "EXPLAIN";
|
|
1894
|
+
readonly PROFILE: "PROFILE";
|
|
1895
|
+
readonly RESULT: "RESULT";
|
|
1896
|
+
readonly STATUS: "STATUS";
|
|
1897
|
+
};
|
|
1898
|
+
type RespType = (typeof RespType)[keyof typeof RespType];
|
|
1899
|
+
/**
|
|
1900
|
+
* Additional diagnostic information from error frames.
|
|
1901
|
+
*/
|
|
1902
|
+
interface AdditionalInfo {
|
|
1903
|
+
code?: string;
|
|
1904
|
+
message?: string;
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* Frame result structure.
|
|
1908
|
+
*/
|
|
1909
|
+
interface FrameResult {
|
|
1910
|
+
type: RespType;
|
|
1911
|
+
columns?: ColumnDef[];
|
|
1912
|
+
rows?: Record<string, unknown>[];
|
|
1913
|
+
ordered?: boolean;
|
|
1914
|
+
order_keys?: string[];
|
|
1915
|
+
final?: boolean;
|
|
1916
|
+
code?: string;
|
|
1917
|
+
message?: string;
|
|
1918
|
+
anchor?: string;
|
|
1919
|
+
additional?: AdditionalInfo[];
|
|
1920
|
+
flagger_findings?: string[];
|
|
1921
|
+
json?: unknown;
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Wire protocol frame structure.
|
|
1925
|
+
*/
|
|
1926
|
+
interface Frame {
|
|
1927
|
+
status_class: string;
|
|
1928
|
+
status_subclass: string;
|
|
1929
|
+
result: FrameResult;
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Parse a JSON frame from raw bytes.
|
|
1933
|
+
*/
|
|
1934
|
+
declare function parseFrame(data: Buffer | string): Frame;
|
|
1935
|
+
/**
|
|
1936
|
+
* Check if a frame represents an error.
|
|
1937
|
+
*/
|
|
1938
|
+
declare function isErrorFrame(frame: Frame): boolean;
|
|
1939
|
+
/**
|
|
1940
|
+
* Check if a frame represents a schema.
|
|
1941
|
+
*/
|
|
1942
|
+
declare function isSchemaFrame(frame: Frame): boolean;
|
|
1943
|
+
/**
|
|
1944
|
+
* Check if a frame represents bindings (rows).
|
|
1945
|
+
*/
|
|
1946
|
+
declare function isBindingsFrame(frame: Frame): boolean;
|
|
1947
|
+
/**
|
|
1948
|
+
* Check if a frame is the final frame in a result set.
|
|
1949
|
+
*/
|
|
1950
|
+
declare function isFinalFrame(frame: Frame): boolean;
|
|
1951
|
+
/**
|
|
1952
|
+
* Convert an error frame to a DriverError.
|
|
1953
|
+
*/
|
|
1954
|
+
declare function frameToError(frame: Frame): DriverError;
|
|
1955
|
+
/**
|
|
1956
|
+
* Get column info from a schema frame.
|
|
1957
|
+
*/
|
|
1958
|
+
declare function getColumnsFromSchema(frame: Frame): ColumnInfo[];
|
|
1959
|
+
/**
|
|
1960
|
+
* Build a HELLO message.
|
|
1961
|
+
*/
|
|
1962
|
+
declare function buildHelloMessage(cfg: GeodeConfig): Record<string, unknown>;
|
|
1963
|
+
/**
|
|
1964
|
+
* Build a RUN_GQL message.
|
|
1965
|
+
*/
|
|
1966
|
+
declare function buildRunGQLMessage(query: string, params?: Record<string, unknown>): Record<string, unknown>;
|
|
1967
|
+
/**
|
|
1968
|
+
* Build a PULL message.
|
|
1969
|
+
*/
|
|
1970
|
+
declare function buildPullMessage(requestId: number, pageSize: number): Record<string, unknown>;
|
|
1971
|
+
/**
|
|
1972
|
+
* Build a BEGIN message.
|
|
1973
|
+
*/
|
|
1974
|
+
declare function buildBeginMessage(): Record<string, unknown>;
|
|
1975
|
+
/**
|
|
1976
|
+
* Build a COMMIT message.
|
|
1977
|
+
*/
|
|
1978
|
+
declare function buildCommitMessage(): Record<string, unknown>;
|
|
1979
|
+
/**
|
|
1980
|
+
* Build a ROLLBACK message.
|
|
1981
|
+
*/
|
|
1982
|
+
declare function buildRollbackMessage(): Record<string, unknown>;
|
|
1983
|
+
/**
|
|
1984
|
+
* Build a SAVEPOINT message.
|
|
1985
|
+
*/
|
|
1986
|
+
declare function buildSavepointMessage(name: string): Record<string, unknown>;
|
|
1987
|
+
/**
|
|
1988
|
+
* Build a ROLLBACK_TO message.
|
|
1989
|
+
*/
|
|
1990
|
+
declare function buildRollbackToMessage(name: string): Record<string, unknown>;
|
|
1991
|
+
/**
|
|
1992
|
+
* Build a PING message.
|
|
1993
|
+
*/
|
|
1994
|
+
declare function buildPingMessage(): Record<string, unknown>;
|
|
1995
|
+
/**
|
|
1996
|
+
* Serialize a message to JSON line format.
|
|
1997
|
+
*/
|
|
1998
|
+
declare function serializeMessage(msg: Record<string, unknown>): Buffer;
|
|
1999
|
+
/**
|
|
2000
|
+
* Rewrite positional placeholders (?) to named parameters ($p1, $p2, ...).
|
|
2001
|
+
*/
|
|
2002
|
+
declare function rewritePlaceholders(query: string, args: unknown[]): {
|
|
2003
|
+
query: string;
|
|
2004
|
+
params: Record<string, unknown>;
|
|
2005
|
+
};
|
|
2006
|
+
/**
|
|
2007
|
+
* Count the number of ? placeholders in a query.
|
|
2008
|
+
*/
|
|
2009
|
+
declare function countPlaceholders(query: string): number;
|
|
2010
|
+
/**
|
|
2011
|
+
* Merge named parameters with positional parameters.
|
|
2012
|
+
*/
|
|
2013
|
+
declare function mergeParams(positionalParams: Record<string, unknown>, namedParams?: Record<string, unknown>): Record<string, unknown>;
|
|
2014
|
+
|
|
2015
|
+
/**
|
|
2016
|
+
* Input Validation Module
|
|
2017
|
+
*
|
|
2018
|
+
* Security-focused validation for user inputs to prevent injection attacks.
|
|
2019
|
+
*/
|
|
2020
|
+
/**
|
|
2021
|
+
* Validate a GQL query string.
|
|
2022
|
+
*
|
|
2023
|
+
* @throws SecurityError if validation fails
|
|
2024
|
+
*/
|
|
2025
|
+
declare function validateQuery(query: string): void;
|
|
2026
|
+
/**
|
|
2027
|
+
* Validate a parameter name.
|
|
2028
|
+
*
|
|
2029
|
+
* @throws SecurityError if validation fails
|
|
2030
|
+
*/
|
|
2031
|
+
declare function validateParamName(name: string): void;
|
|
2032
|
+
/**
|
|
2033
|
+
* Validate a parameter value.
|
|
2034
|
+
*
|
|
2035
|
+
* @throws SecurityError if validation fails
|
|
2036
|
+
*/
|
|
2037
|
+
declare function validateParamValue(value: unknown): void;
|
|
2038
|
+
/**
|
|
2039
|
+
* Validate a hostname.
|
|
2040
|
+
*
|
|
2041
|
+
* @throws SecurityError if validation fails
|
|
2042
|
+
*/
|
|
2043
|
+
declare function validateHostname(hostname: string): void;
|
|
2044
|
+
/**
|
|
2045
|
+
* Validate a port number.
|
|
2046
|
+
*
|
|
2047
|
+
* @throws SecurityError if validation fails
|
|
2048
|
+
*/
|
|
2049
|
+
declare function validatePort(port: number): void;
|
|
2050
|
+
/**
|
|
2051
|
+
* Validate a page size.
|
|
2052
|
+
*
|
|
2053
|
+
* @throws SecurityError if validation fails
|
|
2054
|
+
*/
|
|
2055
|
+
declare function validatePageSize(pageSize: number): void;
|
|
2056
|
+
/**
|
|
2057
|
+
* Validate a savepoint name.
|
|
2058
|
+
*
|
|
2059
|
+
* @throws SecurityError if validation fails
|
|
2060
|
+
*/
|
|
2061
|
+
declare function validateSavepointName(name: string): void;
|
|
2062
|
+
/**
|
|
2063
|
+
* Sanitize a string for safe logging (remove sensitive data patterns).
|
|
2064
|
+
*/
|
|
2065
|
+
declare function sanitizeForLog(value: string): string;
|
|
2066
|
+
|
|
2067
|
+
/**
|
|
2068
|
+
* Query Builder
|
|
2069
|
+
*
|
|
2070
|
+
* Fluent API for building GQL queries programmatically.
|
|
2071
|
+
*/
|
|
2072
|
+
|
|
2073
|
+
/**
|
|
2074
|
+
* Edge direction for pattern matching.
|
|
2075
|
+
*/
|
|
2076
|
+
type EdgeDirection = 'outgoing' | 'incoming' | 'both';
|
|
2077
|
+
/**
|
|
2078
|
+
* Sort direction.
|
|
2079
|
+
*/
|
|
2080
|
+
type SortDirection = 'ASC' | 'DESC';
|
|
2081
|
+
/**
|
|
2082
|
+
* Predicate operator.
|
|
2083
|
+
*/
|
|
2084
|
+
type PredicateOp = '=' | '<>' | '!=' | '<' | '<=' | '>' | '>=' | 'IN' | 'NOT IN' | 'CONTAINS' | 'STARTS WITH' | 'ENDS WITH' | 'IS NULL' | 'IS NOT NULL';
|
|
2085
|
+
/**
|
|
2086
|
+
* Node pattern for MATCH clauses.
|
|
2087
|
+
*/
|
|
2088
|
+
interface NodePattern {
|
|
2089
|
+
variable?: string;
|
|
2090
|
+
labels?: string[];
|
|
2091
|
+
properties?: Record<string, unknown>;
|
|
2092
|
+
}
|
|
2093
|
+
/**
|
|
2094
|
+
* Edge pattern for MATCH clauses.
|
|
2095
|
+
*/
|
|
2096
|
+
interface EdgePattern {
|
|
2097
|
+
variable?: string;
|
|
2098
|
+
type?: string;
|
|
2099
|
+
direction: EdgeDirection;
|
|
2100
|
+
properties?: Record<string, unknown>;
|
|
2101
|
+
minHops?: number;
|
|
2102
|
+
maxHops?: number;
|
|
2103
|
+
}
|
|
2104
|
+
/**
|
|
2105
|
+
* Pattern element (node or edge).
|
|
2106
|
+
*/
|
|
2107
|
+
type PatternElement = {
|
|
2108
|
+
kind: 'node';
|
|
2109
|
+
pattern: NodePattern;
|
|
2110
|
+
} | {
|
|
2111
|
+
kind: 'edge';
|
|
2112
|
+
pattern: EdgePattern;
|
|
2113
|
+
};
|
|
2114
|
+
/**
|
|
2115
|
+
* Build a node pattern.
|
|
2116
|
+
*/
|
|
2117
|
+
declare class NodePatternBuilder {
|
|
2118
|
+
private _variable?;
|
|
2119
|
+
private _labels;
|
|
2120
|
+
private _properties;
|
|
2121
|
+
/**
|
|
2122
|
+
* Set the variable name.
|
|
2123
|
+
*/
|
|
2124
|
+
as(variable: string): this;
|
|
2125
|
+
/**
|
|
2126
|
+
* Add a label.
|
|
2127
|
+
*/
|
|
2128
|
+
label(label: string): this;
|
|
2129
|
+
/**
|
|
2130
|
+
* Add multiple labels.
|
|
2131
|
+
*/
|
|
2132
|
+
labels(...labels: string[]): this;
|
|
2133
|
+
/**
|
|
2134
|
+
* Set a property.
|
|
2135
|
+
*/
|
|
2136
|
+
prop(key: string, value: unknown): this;
|
|
2137
|
+
/**
|
|
2138
|
+
* Set multiple properties.
|
|
2139
|
+
*/
|
|
2140
|
+
props(properties: Record<string, unknown>): this;
|
|
2141
|
+
/**
|
|
2142
|
+
* Build the pattern.
|
|
2143
|
+
*/
|
|
2144
|
+
build(): NodePattern;
|
|
2145
|
+
/**
|
|
2146
|
+
* Convert to GQL string.
|
|
2147
|
+
*/
|
|
2148
|
+
toGQL(): string;
|
|
2149
|
+
}
|
|
2150
|
+
/**
|
|
2151
|
+
* Build an edge pattern.
|
|
2152
|
+
*/
|
|
2153
|
+
declare class EdgePatternBuilder {
|
|
2154
|
+
private _variable?;
|
|
2155
|
+
private _type?;
|
|
2156
|
+
private _direction;
|
|
2157
|
+
private _properties;
|
|
2158
|
+
private _minHops?;
|
|
2159
|
+
private _maxHops?;
|
|
2160
|
+
/**
|
|
2161
|
+
* Set the variable name.
|
|
2162
|
+
*/
|
|
2163
|
+
as(variable: string): this;
|
|
2164
|
+
/**
|
|
2165
|
+
* Set the relationship type.
|
|
2166
|
+
*/
|
|
2167
|
+
type(type: string): this;
|
|
2168
|
+
/**
|
|
2169
|
+
* Set outgoing direction.
|
|
2170
|
+
*/
|
|
2171
|
+
outgoing(): this;
|
|
2172
|
+
/**
|
|
2173
|
+
* Set incoming direction.
|
|
2174
|
+
*/
|
|
2175
|
+
incoming(): this;
|
|
2176
|
+
/**
|
|
2177
|
+
* Set bidirectional.
|
|
2178
|
+
*/
|
|
2179
|
+
both(): this;
|
|
2180
|
+
/**
|
|
2181
|
+
* Set direction.
|
|
2182
|
+
*/
|
|
2183
|
+
direction(dir: EdgeDirection): this;
|
|
2184
|
+
/**
|
|
2185
|
+
* Set a property.
|
|
2186
|
+
*/
|
|
2187
|
+
prop(key: string, value: unknown): this;
|
|
2188
|
+
/**
|
|
2189
|
+
* Set multiple properties.
|
|
2190
|
+
*/
|
|
2191
|
+
props(properties: Record<string, unknown>): this;
|
|
2192
|
+
/**
|
|
2193
|
+
* Set variable length path.
|
|
2194
|
+
*/
|
|
2195
|
+
hops(min?: number, max?: number): this;
|
|
2196
|
+
/**
|
|
2197
|
+
* Build the pattern.
|
|
2198
|
+
*/
|
|
2199
|
+
build(): EdgePattern;
|
|
2200
|
+
/**
|
|
2201
|
+
* Convert to GQL string.
|
|
2202
|
+
*/
|
|
2203
|
+
toGQL(): string;
|
|
2204
|
+
}
|
|
2205
|
+
/**
|
|
2206
|
+
* Build a path pattern.
|
|
2207
|
+
*/
|
|
2208
|
+
declare class PatternBuilder {
|
|
2209
|
+
private _elements;
|
|
2210
|
+
/**
|
|
2211
|
+
* Add a node to the pattern.
|
|
2212
|
+
*/
|
|
2213
|
+
node(builder?: (n: NodePatternBuilder) => void): this;
|
|
2214
|
+
/**
|
|
2215
|
+
* Add an outgoing edge to the pattern.
|
|
2216
|
+
*/
|
|
2217
|
+
outgoing(builder?: (e: EdgePatternBuilder) => void): this;
|
|
2218
|
+
/**
|
|
2219
|
+
* Add an incoming edge to the pattern.
|
|
2220
|
+
*/
|
|
2221
|
+
incoming(builder?: (e: EdgePatternBuilder) => void): this;
|
|
2222
|
+
/**
|
|
2223
|
+
* Add a bidirectional edge to the pattern.
|
|
2224
|
+
*/
|
|
2225
|
+
related(builder?: (e: EdgePatternBuilder) => void): this;
|
|
2226
|
+
/**
|
|
2227
|
+
* Convert to GQL string.
|
|
2228
|
+
*/
|
|
2229
|
+
toGQL(): string;
|
|
2230
|
+
}
|
|
2231
|
+
/**
|
|
2232
|
+
* Build a predicate for WHERE clauses.
|
|
2233
|
+
*/
|
|
2234
|
+
declare class PredicateBuilder {
|
|
2235
|
+
private _predicates;
|
|
2236
|
+
private _params;
|
|
2237
|
+
private _paramCounter;
|
|
2238
|
+
/**
|
|
2239
|
+
* Add a comparison predicate.
|
|
2240
|
+
*/
|
|
2241
|
+
compare(left: string, op: PredicateOp, right: unknown): this;
|
|
2242
|
+
/**
|
|
2243
|
+
* Add an equality predicate.
|
|
2244
|
+
*/
|
|
2245
|
+
eq(left: string, right: unknown): this;
|
|
2246
|
+
/**
|
|
2247
|
+
* Add a not-equal predicate.
|
|
2248
|
+
*/
|
|
2249
|
+
neq(left: string, right: unknown): this;
|
|
2250
|
+
/**
|
|
2251
|
+
* Add a less-than predicate.
|
|
2252
|
+
*/
|
|
2253
|
+
lt(left: string, right: unknown): this;
|
|
2254
|
+
/**
|
|
2255
|
+
* Add a less-than-or-equal predicate.
|
|
2256
|
+
*/
|
|
2257
|
+
lte(left: string, right: unknown): this;
|
|
2258
|
+
/**
|
|
2259
|
+
* Add a greater-than predicate.
|
|
2260
|
+
*/
|
|
2261
|
+
gt(left: string, right: unknown): this;
|
|
2262
|
+
/**
|
|
2263
|
+
* Add a greater-than-or-equal predicate.
|
|
2264
|
+
*/
|
|
2265
|
+
gte(left: string, right: unknown): this;
|
|
2266
|
+
/**
|
|
2267
|
+
* Add an IN predicate.
|
|
2268
|
+
*/
|
|
2269
|
+
in(left: string, values: unknown[]): this;
|
|
2270
|
+
/**
|
|
2271
|
+
* Add a NOT IN predicate.
|
|
2272
|
+
*/
|
|
2273
|
+
notIn(left: string, values: unknown[]): this;
|
|
2274
|
+
/**
|
|
2275
|
+
* Add a CONTAINS predicate.
|
|
2276
|
+
*/
|
|
2277
|
+
contains(left: string, value: string): this;
|
|
2278
|
+
/**
|
|
2279
|
+
* Add a STARTS WITH predicate.
|
|
2280
|
+
*/
|
|
2281
|
+
startsWith(left: string, value: string): this;
|
|
2282
|
+
/**
|
|
2283
|
+
* Add an ENDS WITH predicate.
|
|
2284
|
+
*/
|
|
2285
|
+
endsWith(left: string, value: string): this;
|
|
2286
|
+
/**
|
|
2287
|
+
* Add an IS NULL predicate.
|
|
2288
|
+
*/
|
|
2289
|
+
isNull(expr: string): this;
|
|
2290
|
+
/**
|
|
2291
|
+
* Add an IS NOT NULL predicate.
|
|
2292
|
+
*/
|
|
2293
|
+
isNotNull(expr: string): this;
|
|
2294
|
+
/**
|
|
2295
|
+
* Add a raw predicate expression.
|
|
2296
|
+
*/
|
|
2297
|
+
raw(expr: string, params?: QueryParams): this;
|
|
2298
|
+
/**
|
|
2299
|
+
* Combine predicates with AND.
|
|
2300
|
+
*/
|
|
2301
|
+
and(builder: PredicateBuilder): this;
|
|
2302
|
+
/**
|
|
2303
|
+
* Combine predicates with OR.
|
|
2304
|
+
*/
|
|
2305
|
+
or(builder: PredicateBuilder): this;
|
|
2306
|
+
/**
|
|
2307
|
+
* Build the predicate.
|
|
2308
|
+
*/
|
|
2309
|
+
build(): {
|
|
2310
|
+
predicate: string;
|
|
2311
|
+
params: QueryParams;
|
|
2312
|
+
};
|
|
2313
|
+
private nextParam;
|
|
2314
|
+
}
|
|
2315
|
+
/**
|
|
2316
|
+
* GQL Query Builder.
|
|
2317
|
+
*/
|
|
2318
|
+
declare class QueryBuilder {
|
|
2319
|
+
private _clauses;
|
|
2320
|
+
private _params;
|
|
2321
|
+
/**
|
|
2322
|
+
* Add a MATCH clause.
|
|
2323
|
+
*/
|
|
2324
|
+
match(pattern: string | PatternBuilder): this;
|
|
2325
|
+
/**
|
|
2326
|
+
* Add an OPTIONAL MATCH clause.
|
|
2327
|
+
*/
|
|
2328
|
+
optionalMatch(pattern: string | PatternBuilder): this;
|
|
2329
|
+
/**
|
|
2330
|
+
* Add a WHERE clause.
|
|
2331
|
+
*/
|
|
2332
|
+
where(predicate: string | PredicateBuilder, params?: QueryParams): this;
|
|
2333
|
+
/**
|
|
2334
|
+
* Add a WITH clause.
|
|
2335
|
+
*/
|
|
2336
|
+
with(...expressions: string[]): this;
|
|
2337
|
+
/**
|
|
2338
|
+
* Add a RETURN clause.
|
|
2339
|
+
*/
|
|
2340
|
+
return(...expressions: string[]): this;
|
|
2341
|
+
/**
|
|
2342
|
+
* Add RETURN DISTINCT.
|
|
2343
|
+
*/
|
|
2344
|
+
returnDistinct(...expressions: string[]): this;
|
|
2345
|
+
/**
|
|
2346
|
+
* Add an ORDER BY clause.
|
|
2347
|
+
*/
|
|
2348
|
+
orderBy(...expressions: Array<string | [string, SortDirection]>): this;
|
|
2349
|
+
/**
|
|
2350
|
+
* Add a SKIP clause.
|
|
2351
|
+
*/
|
|
2352
|
+
skip(count: number): this;
|
|
2353
|
+
/**
|
|
2354
|
+
* Add a LIMIT clause.
|
|
2355
|
+
*/
|
|
2356
|
+
limit(count: number): this;
|
|
2357
|
+
/**
|
|
2358
|
+
* Add a CREATE clause.
|
|
2359
|
+
*/
|
|
2360
|
+
create(pattern: string | PatternBuilder): this;
|
|
2361
|
+
/**
|
|
2362
|
+
* Add a MERGE clause.
|
|
2363
|
+
*/
|
|
2364
|
+
merge(pattern: string | PatternBuilder): this;
|
|
2365
|
+
/**
|
|
2366
|
+
* Add a DELETE clause.
|
|
2367
|
+
*/
|
|
2368
|
+
delete(...variables: string[]): this;
|
|
2369
|
+
/**
|
|
2370
|
+
* Add a DETACH DELETE clause.
|
|
2371
|
+
*/
|
|
2372
|
+
detachDelete(...variables: string[]): this;
|
|
2373
|
+
/**
|
|
2374
|
+
* Add a SET clause.
|
|
2375
|
+
*/
|
|
2376
|
+
set(...assignments: string[]): this;
|
|
2377
|
+
/**
|
|
2378
|
+
* Add a REMOVE clause.
|
|
2379
|
+
*/
|
|
2380
|
+
remove(...items: string[]): this;
|
|
2381
|
+
/**
|
|
2382
|
+
* Add raw clause.
|
|
2383
|
+
*/
|
|
2384
|
+
raw(clause: string, params?: QueryParams): this;
|
|
2385
|
+
/**
|
|
2386
|
+
* Add a parameter.
|
|
2387
|
+
*/
|
|
2388
|
+
param(name: string, value: unknown): this;
|
|
2389
|
+
/**
|
|
2390
|
+
* Add multiple parameters.
|
|
2391
|
+
*/
|
|
2392
|
+
params(params: QueryParams): this;
|
|
2393
|
+
/**
|
|
2394
|
+
* Build the query string.
|
|
2395
|
+
*/
|
|
2396
|
+
build(): {
|
|
2397
|
+
query: string;
|
|
2398
|
+
params: QueryParams;
|
|
2399
|
+
};
|
|
2400
|
+
/**
|
|
2401
|
+
* Get the query string.
|
|
2402
|
+
*/
|
|
2403
|
+
toGQL(): string;
|
|
2404
|
+
/**
|
|
2405
|
+
* Get the parameters.
|
|
2406
|
+
*/
|
|
2407
|
+
getParams(): QueryParams;
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Create a new QueryBuilder.
|
|
2411
|
+
*/
|
|
2412
|
+
declare function query(): QueryBuilder;
|
|
2413
|
+
/**
|
|
2414
|
+
* Create a new PatternBuilder.
|
|
2415
|
+
*/
|
|
2416
|
+
declare function pattern(): PatternBuilder;
|
|
2417
|
+
/**
|
|
2418
|
+
* Create a new PredicateBuilder.
|
|
2419
|
+
*/
|
|
2420
|
+
declare function predicate(): PredicateBuilder;
|
|
2421
|
+
/**
|
|
2422
|
+
* Create a new NodePatternBuilder.
|
|
2423
|
+
*/
|
|
2424
|
+
declare function node(): NodePatternBuilder;
|
|
2425
|
+
/**
|
|
2426
|
+
* Create a new EdgePatternBuilder.
|
|
2427
|
+
*/
|
|
2428
|
+
declare function edge(): EdgePatternBuilder;
|
|
2429
|
+
|
|
2430
|
+
export { type AdditionalInfo, AuthClient, BaseTransport, type BatchOptions, type BatchQuery, type BatchResult, type BatchSummary, type ClientOptions, type ColumnDef, type ColumnInfo, ConfigError, Connection, ConnectionPool, type ConnectionState, type CreateRLSPolicyOptions, type CreateRoleOptions, type CreateUserOptions, DEFAULT_CONFORMANCE, DEFAULT_HELLO_NAME, DEFAULT_HELLO_VERSION, DEFAULT_PAGE_SIZE, DEFAULT_PORT, DriverError, type EdgeDirection, type EdgePattern, EdgePatternBuilder, ErrBadConn, ErrClosed, ErrNoTx, ErrQueryInProgress, ErrRowsClosed, ErrTxDone, ErrTxInProgress, type ExplainOptions, type Frame, type FrameResult, type GQLEdge, type GQLNode, type GQLPath, type GQLRange, type GQLType, GQLValue, type GQLValueKind, GeodeClient, type GeodeConfig, type GeodeError, MAX_PAGE_SIZE, MAX_QUERY_LENGTH, MockTransport, MsgType, type NodePattern, NodePatternBuilder, type OperationTiming, type ParameterInfo, PatternBuilder, type PatternElement, type Permission, type PlanOperation, type PoolConfig, PredicateBuilder, type PredicateOp, PreparedStatement, QueryBuilder, type QueryOptions, type QueryParams, type QueryPlan, type QueryProfile, QueryResult, QueryResultIterator, MatrixQuicTransport as QuicheTransport, type RLSPolicy, RespType, type Role, type Row, SecurityError, type SortDirection, StateError, StatusClass, type StatusClassType, Transaction, type Transport, TransportError, type User, batch, batchAll, batchFirst, batchMap, batchParallel, buildBeginMessage, buildCommitMessage, buildHelloMessage, buildPingMessage, buildPullMessage, buildRollbackMessage, buildRollbackToMessage, buildRunGQLMessage, buildSavepointMessage, buildTLSConfig, cloneConfig, countPlaceholders, createAuthClient, createClient, createClientWithConfig, createTransport, defaultConfig, edge, explain, extractParameters, formatPlan, formatProfile, frameToError, fromJSON, getAddress, getColumnsFromSchema, isBindingsFrame, isDriverError, isErrorFrame, isFinalFrame, isGeodeError, isRetryableError, isSchemaFrame, mergeParams, node, parseDSN, parseFrame, parseGQLType, parseRow, pattern, predicate, prepare, profile, query, rewritePlaceholders, rowToObject, sanitizeForLog, serializeMessage, validateConfig, validateHostname, validatePageSize, validateParamName, validateParamValue, validatePort, validateQuery, validateSavepointName, withTransaction };
|