@geodedb/client 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/index.d.ts +670 -130
- package/dist/index.js +7882 -129
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
- package/proto/geode.proto +7 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as tls from 'node:tls';
|
|
2
|
+
import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
|
|
2
3
|
import { Decimal } from 'decimal.js-light';
|
|
3
4
|
export { default as Decimal } from 'decimal.js-light';
|
|
4
5
|
|
|
@@ -79,6 +80,16 @@ interface GeodeConfig {
|
|
|
79
80
|
tls?: boolean;
|
|
80
81
|
/** Graph name for DSN graph binding. When set, the server binds the session to this graph. */
|
|
81
82
|
graph?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Tenant identifier sent in the HELLO handshake (proto field 3). Required for
|
|
85
|
+
* multi-tenant deployments so the server scopes the session to this tenant.
|
|
86
|
+
*/
|
|
87
|
+
tenant?: string;
|
|
88
|
+
/**
|
|
89
|
+
* FLE role sent in the HELLO handshake (proto field 8). Selects the
|
|
90
|
+
* field-level-encryption role for the session when set.
|
|
91
|
+
*/
|
|
92
|
+
role?: string;
|
|
82
93
|
}
|
|
83
94
|
/**
|
|
84
95
|
* Connection pool configuration.
|
|
@@ -122,6 +133,9 @@ declare function defaultConfig(): GeodeConfig;
|
|
|
122
133
|
* - server_name: SNI server name
|
|
123
134
|
* - connect_timeout: Connection timeout in ms
|
|
124
135
|
* - request_timeout: Request timeout in ms
|
|
136
|
+
* - graph: Graph to bind the session to
|
|
137
|
+
* - tenant/tenant_id: Tenant identifier for multi-tenant deployments
|
|
138
|
+
* - role: FLE role for field-level access control
|
|
125
139
|
*
|
|
126
140
|
* Environment variables (used as defaults):
|
|
127
141
|
* - GEODE_HOST: Default host
|
|
@@ -129,6 +143,8 @@ declare function defaultConfig(): GeodeConfig;
|
|
|
129
143
|
* - GEODE_TLS_CA: Default CA certificate path
|
|
130
144
|
* - GEODE_USERNAME: Default username
|
|
131
145
|
* - GEODE_PASSWORD: Default password
|
|
146
|
+
* - GEODE_TENANT: Default tenant identifier
|
|
147
|
+
* - GEODE_ROLE: Default FLE role
|
|
132
148
|
* - GEODE_TRANSPORT: Default transport type (quic or grpc)
|
|
133
149
|
*/
|
|
134
150
|
declare function parseDSN(dsn: string): GeodeConfig;
|
|
@@ -140,6 +156,13 @@ declare function validateConfig(cfg: GeodeConfig): void;
|
|
|
140
156
|
* Get the server address in host:port format.
|
|
141
157
|
*/
|
|
142
158
|
declare function getAddress(cfg: GeodeConfig): string;
|
|
159
|
+
/**
|
|
160
|
+
* Serialise a GeodeConfig back to a DSN string. Inverse of parseDSN: only
|
|
161
|
+
* non-default values are emitted as query parameters to keep the DSN minimal.
|
|
162
|
+
* Credentials go in the userinfo segment when both username and password are
|
|
163
|
+
* present; a lone username uses userinfo, a lone password uses a `pass` param.
|
|
164
|
+
*/
|
|
165
|
+
declare function formatDSN(cfg: GeodeConfig): string;
|
|
143
166
|
/**
|
|
144
167
|
* Clone configuration.
|
|
145
168
|
*/
|
|
@@ -275,6 +298,8 @@ declare class StateError extends Error implements GeodeError {
|
|
|
275
298
|
* Connection state enumeration.
|
|
276
299
|
*/
|
|
277
300
|
type ConnectionState = 'idle' | 'executing' | 'in_transaction' | 'fetching' | 'closed' | 'error';
|
|
301
|
+
declare const ERR_INVALID_IDENT_MESSAGE = "geode: identifier contains forbidden characters";
|
|
302
|
+
declare const ERR_INVALID_STRING_MESSAGE = "geode: string literal contains forbidden characters";
|
|
278
303
|
declare const ERR_CLOSED_MESSAGE = "geode: connection closed";
|
|
279
304
|
declare const ERR_QUERY_IN_PROGRESS_MESSAGE = "geode: query already in progress";
|
|
280
305
|
declare const ERR_TX_IN_PROGRESS_MESSAGE = "geode: transaction already in progress";
|
|
@@ -282,6 +307,9 @@ declare const ERR_NO_TX_MESSAGE = "geode: no transaction in progress";
|
|
|
282
307
|
declare const ERR_TX_DONE_MESSAGE = "geode: transaction already committed or rolled back";
|
|
283
308
|
declare const ERR_ROWS_CLOSED_MESSAGE = "geode: rows closed";
|
|
284
309
|
declare const ERR_BAD_CONN_MESSAGE = "geode: bad connection";
|
|
310
|
+
declare const ERR_NO_ROWS_MESSAGE = "geode: no rows in result set";
|
|
311
|
+
declare function ErrInvalidIdent(): Error;
|
|
312
|
+
declare function ErrInvalidString(): Error;
|
|
285
313
|
declare function ErrClosed(): Error;
|
|
286
314
|
declare function ErrQueryInProgress(): Error;
|
|
287
315
|
declare function ErrTxInProgress(): Error;
|
|
@@ -289,6 +317,7 @@ declare function ErrNoTx(): Error;
|
|
|
289
317
|
declare function ErrTxDone(): Error;
|
|
290
318
|
declare function ErrRowsClosed(): Error;
|
|
291
319
|
declare function ErrBadConn(): Error;
|
|
320
|
+
declare function ErrNoRows(): Error;
|
|
292
321
|
/**
|
|
293
322
|
* Check if an error is a specific sentinel error by message.
|
|
294
323
|
*/
|
|
@@ -305,282 +334,664 @@ declare function isGeodeError(err: unknown): err is GeodeError;
|
|
|
305
334
|
* Check if an error is retryable.
|
|
306
335
|
*/
|
|
307
336
|
declare function isRetryableError(err: unknown): boolean;
|
|
308
|
-
|
|
309
337
|
/**
|
|
310
|
-
* Geode
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
|
|
338
|
+
* Reports whether `err` is a Geode authentication/authorization failure
|
|
339
|
+
* (GQL status class 28000 or the Geode-specific 08P01 password-reset
|
|
340
|
+
* extension). Returns false for null and for non-driver errors.
|
|
341
|
+
*/
|
|
342
|
+
declare function isAuthError(err: unknown): boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Reports whether `err` is a GQL parse/syntax error (status class 42000).
|
|
345
|
+
* Returns false for null and for non-driver errors.
|
|
346
|
+
*/
|
|
347
|
+
declare function isSyntaxError(err: unknown): boolean;
|
|
348
|
+
|
|
349
|
+
declare enum IntKind {
|
|
350
|
+
INT_KIND_UNSPECIFIED = 0,
|
|
351
|
+
INT = 1,
|
|
352
|
+
SMALLINT = 2,
|
|
353
|
+
BIGINT = 3
|
|
354
|
+
}
|
|
355
|
+
declare enum FloatKind {
|
|
356
|
+
FLOAT_KIND_UNSPECIFIED = 0,
|
|
357
|
+
DOUBLE = 1,
|
|
358
|
+
REAL = 2
|
|
359
|
+
}
|
|
360
|
+
declare enum StringKind {
|
|
361
|
+
STRING_KIND_UNSPECIFIED = 0,
|
|
362
|
+
STRING = 1,
|
|
363
|
+
CHAR = 2,
|
|
364
|
+
VARCHAR = 3,
|
|
365
|
+
TEXT = 4
|
|
366
|
+
}
|
|
367
|
+
declare enum BytesKind {
|
|
368
|
+
BYTES_KIND_UNSPECIFIED = 0,
|
|
369
|
+
BYTEA = 1,
|
|
370
|
+
RAW = 2
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* ============================================================================
|
|
374
|
+
* QUIC Messages
|
|
375
|
+
* ============================================================================
|
|
376
|
+
*/
|
|
377
|
+
interface QuicClientMessage {
|
|
378
|
+
hello?: HelloRequest | undefined;
|
|
379
|
+
execute?: ExecuteRequest | undefined;
|
|
380
|
+
pull?: PullRequest | undefined;
|
|
381
|
+
ping?: PingRequest | undefined;
|
|
382
|
+
cdcDiag?: CdcDiagnosticsRequest | undefined;
|
|
383
|
+
cdcCtrl?: CdcControlRequest | undefined;
|
|
384
|
+
begin?: BeginRequest | undefined;
|
|
385
|
+
commit?: CommitRequest | undefined;
|
|
386
|
+
rollback?: RollbackRequest | undefined;
|
|
387
|
+
savepoint?: SavepointRequest | undefined;
|
|
388
|
+
rollbackTo?: RollbackToRequest | undefined;
|
|
389
|
+
backup?: BackupRequest | undefined;
|
|
390
|
+
restore?: RestoreRequest | undefined;
|
|
391
|
+
uploadBackup?: UploadBackupRequest | undefined;
|
|
392
|
+
}
|
|
393
|
+
declare const QuicClientMessage: MessageFns<QuicClientMessage>;
|
|
394
|
+
interface QuicServerMessage {
|
|
395
|
+
hello?: HelloResponse | undefined;
|
|
396
|
+
execute?: ExecutionResponse | undefined;
|
|
397
|
+
pull?: PullResponse | undefined;
|
|
398
|
+
ping?: PingResponse | undefined;
|
|
399
|
+
cdcDiag?: CdcDiagnosticsResponse | undefined;
|
|
400
|
+
cdcCtrl?: CdcControlResponse | undefined;
|
|
401
|
+
begin?: BeginResponse | undefined;
|
|
402
|
+
commit?: CommitResponse | undefined;
|
|
403
|
+
rollback?: RollbackResponse | undefined;
|
|
404
|
+
savepoint?: SavepointResponse | undefined;
|
|
405
|
+
rollbackTo?: RollbackToResponse | undefined;
|
|
406
|
+
backup?: BackupResponse | undefined;
|
|
407
|
+
restore?: RestoreResponse | undefined;
|
|
408
|
+
uploadBackup?: UploadBackupResponse | undefined;
|
|
409
|
+
}
|
|
410
|
+
declare const QuicServerMessage: MessageFns<QuicServerMessage>;
|
|
411
|
+
/**
|
|
412
|
+
* ============================================================================
|
|
413
|
+
* Authentication (HELLO)
|
|
414
|
+
* ============================================================================
|
|
314
415
|
*/
|
|
315
416
|
interface HelloRequest {
|
|
316
417
|
username: string;
|
|
317
418
|
password: string;
|
|
318
|
-
tenantId?: string;
|
|
419
|
+
tenantId?: string | undefined;
|
|
319
420
|
clientName: string;
|
|
320
421
|
clientVersion: string;
|
|
321
422
|
wantedConformance: string;
|
|
322
|
-
graph?: string;
|
|
423
|
+
graph?: string | undefined;
|
|
424
|
+
/** FLE role for field-level access control */
|
|
425
|
+
role?: string | undefined;
|
|
323
426
|
}
|
|
427
|
+
declare const HelloRequest: MessageFns<HelloRequest>;
|
|
324
428
|
interface HelloResponse {
|
|
325
429
|
success: boolean;
|
|
326
430
|
sessionId: string;
|
|
327
431
|
errorMessage: string;
|
|
328
432
|
capabilities: string[];
|
|
329
|
-
passwordResetRequired
|
|
330
|
-
graph?: string;
|
|
331
|
-
}
|
|
332
|
-
interface Param {
|
|
333
|
-
name: string;
|
|
334
|
-
value: ProtoValue;
|
|
433
|
+
passwordResetRequired: boolean;
|
|
434
|
+
graph?: string | undefined;
|
|
335
435
|
}
|
|
436
|
+
declare const HelloResponse: MessageFns<HelloResponse>;
|
|
437
|
+
/**
|
|
438
|
+
* ============================================================================
|
|
439
|
+
* Query Execution (RUN_GQL + PULL)
|
|
440
|
+
* ============================================================================
|
|
441
|
+
*/
|
|
336
442
|
interface ExecuteRequest {
|
|
337
443
|
sessionId: string;
|
|
338
444
|
query: string;
|
|
339
445
|
params: Param[];
|
|
340
446
|
}
|
|
447
|
+
declare const ExecuteRequest: MessageFns<ExecuteRequest>;
|
|
448
|
+
interface Param {
|
|
449
|
+
name: string;
|
|
450
|
+
value?: Value | undefined;
|
|
451
|
+
}
|
|
452
|
+
declare const Param: MessageFns<Param>;
|
|
341
453
|
interface PullRequest {
|
|
342
|
-
requestId:
|
|
454
|
+
requestId: number;
|
|
343
455
|
pageSize: number;
|
|
456
|
+
/** Required for gRPC; ignored for QUIC */
|
|
344
457
|
sessionId: string;
|
|
345
458
|
}
|
|
459
|
+
declare const PullRequest: MessageFns<PullRequest>;
|
|
346
460
|
interface PullResponse {
|
|
347
|
-
response?: ExecutionResponse;
|
|
461
|
+
response?: ExecutionResponse | undefined;
|
|
348
462
|
}
|
|
463
|
+
declare const PullResponse: MessageFns<PullResponse>;
|
|
464
|
+
/**
|
|
465
|
+
* ============================================================================
|
|
466
|
+
* Execution Responses
|
|
467
|
+
* ============================================================================
|
|
468
|
+
*/
|
|
349
469
|
interface Status {
|
|
470
|
+
/** e.g., "00000" */
|
|
350
471
|
statusClass: string;
|
|
351
472
|
statusSubclass: string;
|
|
352
473
|
additionalStatuses: string[];
|
|
353
474
|
flaggerFindings: string[];
|
|
354
475
|
}
|
|
476
|
+
declare const Status: MessageFns<Status>;
|
|
477
|
+
interface ExecutionResponse {
|
|
478
|
+
status?: Status | undefined;
|
|
479
|
+
schema?: SchemaDefinition | undefined;
|
|
480
|
+
page?: DataPage | undefined;
|
|
481
|
+
error?: Error$1 | undefined;
|
|
482
|
+
metrics?: ExecutionMetrics | undefined;
|
|
483
|
+
explain?: ExplainPayload | undefined;
|
|
484
|
+
profile?: ProfilePayload | undefined;
|
|
485
|
+
heartbeat?: Heartbeat | undefined;
|
|
486
|
+
}
|
|
487
|
+
declare const ExecutionResponse: MessageFns<ExecutionResponse>;
|
|
488
|
+
interface SchemaDefinition {
|
|
489
|
+
columns: ColumnDefinition[];
|
|
490
|
+
}
|
|
491
|
+
declare const SchemaDefinition: MessageFns<SchemaDefinition>;
|
|
355
492
|
interface ColumnDefinition {
|
|
356
493
|
name: string;
|
|
357
494
|
type: string;
|
|
358
495
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
doubleVal?: DoubleValue;
|
|
366
|
-
boolVal?: boolean;
|
|
367
|
-
stringVal?: StringValue;
|
|
368
|
-
decimalVal?: DecimalValue;
|
|
369
|
-
bytesVal?: BytesValue;
|
|
370
|
-
listVal?: ListValue;
|
|
371
|
-
mapVal?: MapValue;
|
|
372
|
-
nodeVal?: NodeValue;
|
|
373
|
-
edgeVal?: EdgeValue;
|
|
374
|
-
pathVal?: PathValue;
|
|
375
|
-
extVal?: ExtendedValue;
|
|
496
|
+
declare const ColumnDefinition: MessageFns<ColumnDefinition>;
|
|
497
|
+
interface DataPage {
|
|
498
|
+
rows: Row$1[];
|
|
499
|
+
final: boolean;
|
|
500
|
+
ordered: boolean;
|
|
501
|
+
orderKeys: string[];
|
|
376
502
|
}
|
|
503
|
+
declare const DataPage: MessageFns<DataPage>;
|
|
504
|
+
interface Row$1 {
|
|
505
|
+
values: Value[];
|
|
506
|
+
}
|
|
507
|
+
declare const Row$1: MessageFns<Row$1>;
|
|
508
|
+
/**
|
|
509
|
+
* ----------------------------------------------------------------------------
|
|
510
|
+
* Value Encoding
|
|
511
|
+
* ----------------------------------------------------------------------------
|
|
512
|
+
*/
|
|
513
|
+
interface Value {
|
|
514
|
+
nullVal?: NullValue | undefined;
|
|
515
|
+
intVal?: IntValue | undefined;
|
|
516
|
+
doubleVal?: DoubleValue | undefined;
|
|
517
|
+
boolVal?: boolean | undefined;
|
|
518
|
+
stringVal?: StringValue | undefined;
|
|
519
|
+
decimalVal?: DecimalValue | undefined;
|
|
520
|
+
bytesVal?: BytesValue | undefined;
|
|
521
|
+
listVal?: ListValue | undefined;
|
|
522
|
+
mapVal?: MapValue | undefined;
|
|
523
|
+
nodeVal?: NodeValue | undefined;
|
|
524
|
+
edgeVal?: EdgeValue | undefined;
|
|
525
|
+
pathVal?: PathValue | undefined;
|
|
526
|
+
extVal?: ExtendedValue | undefined;
|
|
527
|
+
}
|
|
528
|
+
declare const Value: MessageFns<Value>;
|
|
377
529
|
interface NullValue {
|
|
378
530
|
}
|
|
531
|
+
declare const NullValue: MessageFns<NullValue>;
|
|
379
532
|
interface IntValue {
|
|
380
|
-
value:
|
|
381
|
-
kind:
|
|
533
|
+
value: number;
|
|
534
|
+
kind: IntKind;
|
|
382
535
|
}
|
|
536
|
+
declare const IntValue: MessageFns<IntValue>;
|
|
383
537
|
interface DoubleValue {
|
|
384
538
|
value: number;
|
|
385
|
-
kind:
|
|
539
|
+
kind: FloatKind;
|
|
386
540
|
}
|
|
541
|
+
declare const DoubleValue: MessageFns<DoubleValue>;
|
|
387
542
|
interface StringValue {
|
|
388
543
|
value: string;
|
|
389
|
-
kind:
|
|
544
|
+
kind: StringKind;
|
|
390
545
|
}
|
|
546
|
+
declare const StringValue: MessageFns<StringValue>;
|
|
391
547
|
interface DecimalValue {
|
|
548
|
+
/** i128 as decimal string */
|
|
392
549
|
coeff: string;
|
|
393
550
|
scale: number;
|
|
394
551
|
origScale: number;
|
|
395
552
|
origRepr: string;
|
|
396
553
|
}
|
|
554
|
+
declare const DecimalValue: MessageFns<DecimalValue>;
|
|
397
555
|
interface BytesValue {
|
|
398
556
|
value: Uint8Array;
|
|
399
|
-
kind:
|
|
557
|
+
kind: BytesKind;
|
|
400
558
|
}
|
|
559
|
+
declare const BytesValue: MessageFns<BytesValue>;
|
|
401
560
|
interface ListValue {
|
|
402
|
-
values:
|
|
561
|
+
values: Value[];
|
|
403
562
|
}
|
|
563
|
+
declare const ListValue: MessageFns<ListValue>;
|
|
404
564
|
interface MapEntry {
|
|
405
565
|
key: string;
|
|
406
|
-
value
|
|
566
|
+
value?: Value | undefined;
|
|
407
567
|
}
|
|
568
|
+
declare const MapEntry: MessageFns<MapEntry>;
|
|
408
569
|
interface MapValue {
|
|
409
570
|
entries: MapEntry[];
|
|
410
571
|
}
|
|
572
|
+
declare const MapValue: MessageFns<MapValue>;
|
|
411
573
|
interface NodeValue {
|
|
412
|
-
id:
|
|
574
|
+
id: number;
|
|
413
575
|
labels: string[];
|
|
414
576
|
properties: MapEntry[];
|
|
415
577
|
}
|
|
578
|
+
declare const NodeValue: MessageFns<NodeValue>;
|
|
416
579
|
interface EdgeValue {
|
|
417
|
-
id:
|
|
418
|
-
fromId:
|
|
419
|
-
toId:
|
|
580
|
+
id: number;
|
|
581
|
+
fromId: number;
|
|
582
|
+
toId: number;
|
|
420
583
|
label: string;
|
|
421
584
|
properties: MapEntry[];
|
|
422
585
|
}
|
|
586
|
+
declare const EdgeValue: MessageFns<EdgeValue>;
|
|
423
587
|
interface PathValue {
|
|
424
588
|
nodes: NodeValue[];
|
|
425
589
|
edges: EdgeValue[];
|
|
426
590
|
}
|
|
591
|
+
declare const PathValue: MessageFns<PathValue>;
|
|
427
592
|
interface ExtendedValue {
|
|
428
593
|
typeName: string;
|
|
429
|
-
text?: string;
|
|
430
|
-
bytes?: Uint8Array;
|
|
431
|
-
intVal?:
|
|
432
|
-
doubleVal?: number;
|
|
433
|
-
boolVal?: boolean;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
interface DataPage {
|
|
439
|
-
rows: Row$1[];
|
|
440
|
-
final: boolean;
|
|
441
|
-
ordered: boolean;
|
|
442
|
-
orderKeys: string[];
|
|
443
|
-
}
|
|
444
|
-
interface ProtoError {
|
|
594
|
+
text?: string | undefined;
|
|
595
|
+
bytes?: Uint8Array | undefined;
|
|
596
|
+
intVal?: number | undefined;
|
|
597
|
+
doubleVal?: number | undefined;
|
|
598
|
+
boolVal?: boolean | undefined;
|
|
599
|
+
}
|
|
600
|
+
declare const ExtendedValue: MessageFns<ExtendedValue>;
|
|
601
|
+
interface Error$1 {
|
|
445
602
|
code: string;
|
|
446
603
|
message: string;
|
|
604
|
+
/** "ERROR" */
|
|
447
605
|
type: string;
|
|
448
606
|
anchor: string;
|
|
449
607
|
}
|
|
608
|
+
declare const Error$1: MessageFns<Error$1>;
|
|
450
609
|
interface ExecutionMetrics {
|
|
451
|
-
parseDurationNs:
|
|
452
|
-
planDurationNs:
|
|
453
|
-
executeDurationNs:
|
|
454
|
-
totalDurationNs:
|
|
455
|
-
}
|
|
610
|
+
parseDurationNs: number;
|
|
611
|
+
planDurationNs: number;
|
|
612
|
+
executeDurationNs: number;
|
|
613
|
+
totalDurationNs: number;
|
|
614
|
+
}
|
|
615
|
+
declare const ExecutionMetrics: MessageFns<ExecutionMetrics>;
|
|
616
|
+
interface ExplainOp {
|
|
617
|
+
idx: number;
|
|
618
|
+
kind: string;
|
|
619
|
+
estRows: number;
|
|
620
|
+
cost: number;
|
|
621
|
+
}
|
|
622
|
+
declare const ExplainOp: MessageFns<ExplainOp>;
|
|
456
623
|
interface ExplainTotals {
|
|
457
|
-
|
|
458
|
-
|
|
624
|
+
estRows: number;
|
|
625
|
+
cost: number;
|
|
459
626
|
}
|
|
627
|
+
declare const ExplainTotals: MessageFns<ExplainTotals>;
|
|
628
|
+
interface ExplainProperties {
|
|
629
|
+
ordered: boolean;
|
|
630
|
+
limit: number;
|
|
631
|
+
offset: number;
|
|
632
|
+
distinct: boolean;
|
|
633
|
+
unionMode: string;
|
|
634
|
+
unionPartCount: number;
|
|
635
|
+
}
|
|
636
|
+
declare const ExplainProperties: MessageFns<ExplainProperties>;
|
|
637
|
+
interface ExplainCalibrationEntry {
|
|
638
|
+
idx: number;
|
|
639
|
+
estRows: number;
|
|
640
|
+
actualRows: number;
|
|
641
|
+
}
|
|
642
|
+
declare const ExplainCalibrationEntry: MessageFns<ExplainCalibrationEntry>;
|
|
643
|
+
interface ExplainCalibration {
|
|
644
|
+
mape: number;
|
|
645
|
+
entries: ExplainCalibrationEntry[];
|
|
646
|
+
}
|
|
647
|
+
declare const ExplainCalibration: MessageFns<ExplainCalibration>;
|
|
460
648
|
interface ExplainPayload {
|
|
461
649
|
schema: string;
|
|
462
|
-
ops:
|
|
463
|
-
totals?: ExplainTotals;
|
|
464
|
-
properties
|
|
465
|
-
calibration
|
|
650
|
+
ops: ExplainOp[];
|
|
651
|
+
totals?: ExplainTotals | undefined;
|
|
652
|
+
properties?: ExplainProperties | undefined;
|
|
653
|
+
calibration?: ExplainCalibration | undefined;
|
|
466
654
|
profileVersion: number;
|
|
467
655
|
}
|
|
656
|
+
declare const ExplainPayload: MessageFns<ExplainPayload>;
|
|
657
|
+
interface ProfileOp {
|
|
658
|
+
op: string;
|
|
659
|
+
phase: string;
|
|
660
|
+
id: number;
|
|
661
|
+
opIndex: number;
|
|
662
|
+
inputRows: number;
|
|
663
|
+
rows: number;
|
|
664
|
+
timeNs: number;
|
|
665
|
+
cpuTimeNs: number;
|
|
666
|
+
bytesOut: number;
|
|
667
|
+
bytesAlloc: number;
|
|
668
|
+
estimateBytes: number;
|
|
669
|
+
estimateVsActual: number;
|
|
670
|
+
percentPeak: number;
|
|
671
|
+
percentNet: number;
|
|
672
|
+
cumulativeTimeNs: number;
|
|
673
|
+
freedBytes: number;
|
|
674
|
+
netAfterOp: number;
|
|
675
|
+
errorBytes: number;
|
|
676
|
+
errorAbsPct: number;
|
|
677
|
+
indexName: string;
|
|
678
|
+
selectivityEst: number;
|
|
679
|
+
}
|
|
680
|
+
declare const ProfileOp: MessageFns<ProfileOp>;
|
|
681
|
+
interface ProfilePeakContributor {
|
|
682
|
+
op: string;
|
|
683
|
+
bytesAlloc: number;
|
|
684
|
+
}
|
|
685
|
+
declare const ProfilePeakContributor: MessageFns<ProfilePeakContributor>;
|
|
686
|
+
interface ProfileTotals {
|
|
687
|
+
timeNs: number;
|
|
688
|
+
peakBytes: number;
|
|
689
|
+
}
|
|
690
|
+
declare const ProfileTotals: MessageFns<ProfileTotals>;
|
|
691
|
+
interface ProfileSpills {
|
|
692
|
+
sortSpills: number;
|
|
693
|
+
distinctSpills: number;
|
|
694
|
+
unionSpills: number;
|
|
695
|
+
spillReason: string;
|
|
696
|
+
peakBytesAtSpill: number;
|
|
697
|
+
firstSpillOpIndex: number;
|
|
698
|
+
}
|
|
699
|
+
declare const ProfileSpills: MessageFns<ProfileSpills>;
|
|
468
700
|
interface ProfileMemory {
|
|
469
|
-
netBytes
|
|
470
|
-
peakBytes
|
|
471
|
-
totalAllocBytes
|
|
701
|
+
netBytes: number;
|
|
702
|
+
peakBytes: number;
|
|
703
|
+
totalAllocBytes: number;
|
|
704
|
+
}
|
|
705
|
+
declare const ProfileMemory: MessageFns<ProfileMemory>;
|
|
706
|
+
interface ProfilePlannerEstimates {
|
|
707
|
+
sumEstimateBytes: number;
|
|
708
|
+
sumActualBytes: number;
|
|
709
|
+
countEstimatedOps: number;
|
|
710
|
+
minErrorAbsPct: number;
|
|
711
|
+
maxErrorAbsPct: number;
|
|
712
|
+
meanErrorAbsPct: number;
|
|
713
|
+
medianErrorAbsPct: number;
|
|
714
|
+
stddevErrorAbsPct: number;
|
|
715
|
+
adjustedEstimateFactor: number;
|
|
716
|
+
}
|
|
717
|
+
declare const ProfilePlannerEstimates: MessageFns<ProfilePlannerEstimates>;
|
|
718
|
+
interface ProfileMemCurvePoint {
|
|
719
|
+
opIndex: number;
|
|
720
|
+
netAfterOp: number;
|
|
721
|
+
}
|
|
722
|
+
declare const ProfileMemCurvePoint: MessageFns<ProfileMemCurvePoint>;
|
|
723
|
+
interface ProfileSetOp {
|
|
724
|
+
type: string;
|
|
725
|
+
mode: string;
|
|
726
|
+
inputRows: number;
|
|
727
|
+
outputRows: number;
|
|
728
|
+
hashDedupSize: number;
|
|
729
|
+
distinctFillPct: number;
|
|
472
730
|
}
|
|
731
|
+
declare const ProfileSetOp: MessageFns<ProfileSetOp>;
|
|
473
732
|
interface ProfilePayload {
|
|
474
733
|
profileVersion: number;
|
|
475
|
-
ops:
|
|
476
|
-
peakContributors:
|
|
477
|
-
totals
|
|
478
|
-
totalTimeNs:
|
|
479
|
-
spills
|
|
480
|
-
memory?: ProfileMemory;
|
|
481
|
-
plannerEstimates
|
|
482
|
-
memCurve:
|
|
483
|
-
setop
|
|
484
|
-
hashaggSpills:
|
|
734
|
+
ops: ProfileOp[];
|
|
735
|
+
peakContributors: ProfilePeakContributor[];
|
|
736
|
+
totals?: ProfileTotals | undefined;
|
|
737
|
+
totalTimeNs: number;
|
|
738
|
+
spills?: ProfileSpills | undefined;
|
|
739
|
+
memory?: ProfileMemory | undefined;
|
|
740
|
+
plannerEstimates?: ProfilePlannerEstimates | undefined;
|
|
741
|
+
memCurve: ProfileMemCurvePoint[];
|
|
742
|
+
setop?: ProfileSetOp | undefined;
|
|
743
|
+
hashaggSpills: number;
|
|
485
744
|
hashaggSpillReason: string;
|
|
486
|
-
committedTxns:
|
|
487
|
-
graphStoreNodes:
|
|
488
|
-
graphStoreEdges:
|
|
745
|
+
committedTxns: number;
|
|
746
|
+
graphStoreNodes: number;
|
|
747
|
+
graphStoreEdges: number;
|
|
489
748
|
graphStoreDirty: boolean;
|
|
490
749
|
flaggerFindings: string[];
|
|
491
750
|
compact: boolean;
|
|
492
751
|
}
|
|
752
|
+
declare const ProfilePayload: MessageFns<ProfilePayload>;
|
|
493
753
|
interface Heartbeat {
|
|
494
754
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
explain?: ExplainPayload;
|
|
502
|
-
profile?: ProfilePayload;
|
|
503
|
-
heartbeat?: Heartbeat;
|
|
504
|
-
}
|
|
755
|
+
declare const Heartbeat: MessageFns<Heartbeat>;
|
|
756
|
+
/**
|
|
757
|
+
* ============================================================================
|
|
758
|
+
* Utilities (PING)
|
|
759
|
+
* ============================================================================
|
|
760
|
+
*/
|
|
505
761
|
interface PingRequest {
|
|
506
762
|
}
|
|
763
|
+
declare const PingRequest: MessageFns<PingRequest>;
|
|
507
764
|
interface PingResponse {
|
|
508
765
|
ok: boolean;
|
|
509
766
|
}
|
|
767
|
+
declare const PingResponse: MessageFns<PingResponse>;
|
|
768
|
+
/**
|
|
769
|
+
* ============================================================================
|
|
770
|
+
* Transactions
|
|
771
|
+
* ============================================================================
|
|
772
|
+
*/
|
|
510
773
|
interface BeginRequest {
|
|
511
774
|
readOnly: boolean;
|
|
775
|
+
/** Required for gRPC; ignored for QUIC */
|
|
512
776
|
sessionId: string;
|
|
513
777
|
}
|
|
778
|
+
declare const BeginRequest: MessageFns<BeginRequest>;
|
|
514
779
|
interface BeginResponse {
|
|
515
780
|
sessionId: string;
|
|
516
781
|
txId: string;
|
|
517
782
|
}
|
|
783
|
+
declare const BeginResponse: MessageFns<BeginResponse>;
|
|
518
784
|
interface CommitRequest {
|
|
785
|
+
/** Required for gRPC; ignored for QUIC */
|
|
519
786
|
sessionId: string;
|
|
520
787
|
}
|
|
788
|
+
declare const CommitRequest: MessageFns<CommitRequest>;
|
|
521
789
|
interface CommitResponse {
|
|
522
790
|
success: boolean;
|
|
523
791
|
}
|
|
792
|
+
declare const CommitResponse: MessageFns<CommitResponse>;
|
|
524
793
|
interface RollbackRequest {
|
|
794
|
+
/** Required for gRPC; ignored for QUIC */
|
|
525
795
|
sessionId: string;
|
|
526
796
|
}
|
|
797
|
+
declare const RollbackRequest: MessageFns<RollbackRequest>;
|
|
527
798
|
interface RollbackResponse {
|
|
528
799
|
success: boolean;
|
|
529
800
|
}
|
|
801
|
+
declare const RollbackResponse: MessageFns<RollbackResponse>;
|
|
530
802
|
interface SavepointRequest {
|
|
531
803
|
name: string;
|
|
804
|
+
/** Required for gRPC; ignored for QUIC */
|
|
532
805
|
sessionId: string;
|
|
533
806
|
}
|
|
807
|
+
declare const SavepointRequest: MessageFns<SavepointRequest>;
|
|
534
808
|
interface SavepointResponse {
|
|
535
809
|
success: boolean;
|
|
536
810
|
}
|
|
811
|
+
declare const SavepointResponse: MessageFns<SavepointResponse>;
|
|
537
812
|
interface RollbackToRequest {
|
|
538
813
|
name: string;
|
|
814
|
+
/** Required for gRPC; ignored for QUIC */
|
|
539
815
|
sessionId: string;
|
|
540
816
|
}
|
|
817
|
+
declare const RollbackToRequest: MessageFns<RollbackToRequest>;
|
|
541
818
|
interface RollbackToResponse {
|
|
542
819
|
success: boolean;
|
|
543
820
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
begin?: BeginRequest;
|
|
552
|
-
commit?: CommitRequest;
|
|
553
|
-
rollback?: RollbackRequest;
|
|
554
|
-
savepoint?: SavepointRequest;
|
|
555
|
-
rollbackTo?: RollbackToRequest;
|
|
556
|
-
backup?: unknown;
|
|
557
|
-
restore?: unknown;
|
|
558
|
-
uploadBackup?: unknown;
|
|
821
|
+
declare const RollbackToResponse: MessageFns<RollbackToResponse>;
|
|
822
|
+
/**
|
|
823
|
+
* ============================================================================
|
|
824
|
+
* CDC
|
|
825
|
+
* ============================================================================
|
|
826
|
+
*/
|
|
827
|
+
interface CdcDiagnosticsRequest {
|
|
559
828
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
829
|
+
declare const CdcDiagnosticsRequest: MessageFns<CdcDiagnosticsRequest>;
|
|
830
|
+
interface CdcDiagnosticsConfig {
|
|
831
|
+
enabled: boolean;
|
|
832
|
+
malformedSnapshotInterval: number;
|
|
833
|
+
malformedHashRetain: number;
|
|
834
|
+
malformedWarnPct: number;
|
|
835
|
+
malformedAbortPct: number;
|
|
836
|
+
flushIntervalMs: number;
|
|
837
|
+
batchSize: number;
|
|
838
|
+
pendingBackpressureWatermark: number;
|
|
839
|
+
}
|
|
840
|
+
declare const CdcDiagnosticsConfig: MessageFns<CdcDiagnosticsConfig>;
|
|
841
|
+
interface CdcDiagnosticsEngine {
|
|
842
|
+
isRunning: boolean;
|
|
843
|
+
lastFlushMs: number;
|
|
844
|
+
peakBuffer: number;
|
|
845
|
+
currentBuffer: number;
|
|
846
|
+
dynamicBatchSize: number;
|
|
847
|
+
batchAdjustments: number;
|
|
848
|
+
}
|
|
849
|
+
declare const CdcDiagnosticsEngine: MessageFns<CdcDiagnosticsEngine>;
|
|
850
|
+
interface CdcMalformedSnapshot {
|
|
851
|
+
count: number;
|
|
852
|
+
tsMs: number;
|
|
853
|
+
}
|
|
854
|
+
declare const CdcMalformedSnapshot: MessageFns<CdcMalformedSnapshot>;
|
|
855
|
+
interface CdcMalformedHash {
|
|
856
|
+
count: number;
|
|
857
|
+
hash: number;
|
|
858
|
+
tsMs: number;
|
|
859
|
+
prefixHex: string;
|
|
860
|
+
}
|
|
861
|
+
declare const CdcMalformedHash: MessageFns<CdcMalformedHash>;
|
|
862
|
+
interface CdcDiagnosticsResponse {
|
|
863
|
+
malformedChangeRecords: number;
|
|
864
|
+
totalChangeAttempts: number;
|
|
865
|
+
malformedRatio: number;
|
|
866
|
+
guardrailWarnTriggered: boolean;
|
|
867
|
+
guardrailAbortTriggered: boolean;
|
|
868
|
+
firstWarnTsMs: number;
|
|
869
|
+
firstAbortTsMs: number;
|
|
870
|
+
guardrailEpoch: number;
|
|
871
|
+
uptimeMs: number;
|
|
872
|
+
backpressure: boolean;
|
|
873
|
+
config?: CdcDiagnosticsConfig | undefined;
|
|
874
|
+
engine?: CdcDiagnosticsEngine | undefined;
|
|
875
|
+
malformedSnapshots: CdcMalformedSnapshot[];
|
|
876
|
+
malformedHashes: CdcMalformedHash[];
|
|
877
|
+
version: string;
|
|
878
|
+
timestampMs: number;
|
|
879
|
+
}
|
|
880
|
+
declare const CdcDiagnosticsResponse: MessageFns<CdcDiagnosticsResponse>;
|
|
881
|
+
interface CdcControlRequest {
|
|
882
|
+
action: string;
|
|
883
|
+
}
|
|
884
|
+
declare const CdcControlRequest: MessageFns<CdcControlRequest>;
|
|
885
|
+
interface CdcControlResponse {
|
|
886
|
+
success: boolean;
|
|
887
|
+
status: string;
|
|
888
|
+
guardrailEpoch: number;
|
|
575
889
|
}
|
|
890
|
+
declare const CdcControlResponse: MessageFns<CdcControlResponse>;
|
|
891
|
+
/**
|
|
892
|
+
* ============================================================================
|
|
893
|
+
* Backup / Restore
|
|
894
|
+
* ============================================================================
|
|
895
|
+
*/
|
|
896
|
+
interface BackupRequest {
|
|
897
|
+
/** "full" */
|
|
898
|
+
backupType: string;
|
|
899
|
+
sessionId: string;
|
|
900
|
+
compress: boolean;
|
|
901
|
+
}
|
|
902
|
+
declare const BackupRequest: MessageFns<BackupRequest>;
|
|
903
|
+
interface BackupResponse {
|
|
904
|
+
success: boolean;
|
|
905
|
+
message: string;
|
|
906
|
+
backupId: string;
|
|
907
|
+
backupType: string;
|
|
908
|
+
sizeBytes: number;
|
|
909
|
+
compression: string;
|
|
910
|
+
checksum: string;
|
|
911
|
+
}
|
|
912
|
+
declare const BackupResponse: MessageFns<BackupResponse>;
|
|
913
|
+
interface RestoreRequest {
|
|
914
|
+
targetTime: string;
|
|
915
|
+
confirm: boolean;
|
|
916
|
+
sessionId: string;
|
|
917
|
+
}
|
|
918
|
+
declare const RestoreRequest: MessageFns<RestoreRequest>;
|
|
919
|
+
interface RestoreResponse {
|
|
920
|
+
success: boolean;
|
|
921
|
+
message: string;
|
|
922
|
+
restoreDir: string;
|
|
923
|
+
targetTime: string;
|
|
924
|
+
restoreTimestamp: number;
|
|
925
|
+
}
|
|
926
|
+
declare const RestoreResponse: MessageFns<RestoreResponse>;
|
|
927
|
+
interface UploadBackupRequest {
|
|
928
|
+
sizeBytes: number;
|
|
929
|
+
checksum: string;
|
|
930
|
+
sessionId: string;
|
|
931
|
+
/**
|
|
932
|
+
* GAP-0880: full backup artifact bytes (GEOB header + payload). Required;
|
|
933
|
+
* metadata-only uploads are rejected by the server.
|
|
934
|
+
*/
|
|
935
|
+
payload: Uint8Array;
|
|
936
|
+
}
|
|
937
|
+
declare const UploadBackupRequest: MessageFns<UploadBackupRequest>;
|
|
938
|
+
interface UploadBackupResponse {
|
|
939
|
+
success: boolean;
|
|
940
|
+
message: string;
|
|
941
|
+
uploadPath: string;
|
|
942
|
+
}
|
|
943
|
+
declare const UploadBackupResponse: MessageFns<UploadBackupResponse>;
|
|
944
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
945
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
946
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
947
|
+
} : Partial<T>;
|
|
948
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
949
|
+
type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
950
|
+
[K in keyof P]: Exact<P[K], I[K]>;
|
|
951
|
+
} & {
|
|
952
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
953
|
+
};
|
|
954
|
+
interface MessageFns<T> {
|
|
955
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
956
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
957
|
+
fromJSON(object: any): T;
|
|
958
|
+
toJSON(message: T): unknown;
|
|
959
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
960
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Geode Protobuf Wire Protocol
|
|
965
|
+
*
|
|
966
|
+
* Encoding/decoding of protocol messages using the protoc + ts-proto generated
|
|
967
|
+
* bindings (src/generated/geode.ts), which are produced from the canonical
|
|
968
|
+
* geode server proto. This eliminates proto drift: there are no longer any
|
|
969
|
+
* hand-written message interfaces, and the proto is no longer parsed at runtime
|
|
970
|
+
* via protobufjs.
|
|
971
|
+
*
|
|
972
|
+
* Wire format for QUIC: 4-byte Big Endian length prefix + protobuf message body.
|
|
973
|
+
*
|
|
974
|
+
* The public API (the build/encode/decode/value-conversion helpers and the
|
|
975
|
+
* exported types) is preserved exactly. Legacy type names that differ from the
|
|
976
|
+
* proto message names are aliased: the proto `Value` message is exported as
|
|
977
|
+
* `ProtoValue`, and the proto `Error` message as `ProtoError`.
|
|
978
|
+
*/
|
|
979
|
+
|
|
980
|
+
/** A protobuf `Value` message (alias preserved for API stability). */
|
|
981
|
+
type ProtoValue = Value;
|
|
982
|
+
/** A protobuf `Error` message (alias preserved for API stability). */
|
|
983
|
+
type ProtoError = Error$1;
|
|
576
984
|
/**
|
|
577
985
|
* Initialize protobuf types synchronously.
|
|
578
|
-
*
|
|
579
|
-
*
|
|
986
|
+
*
|
|
987
|
+
* No-op: bindings are generated at build time (protoc + ts-proto) and statically
|
|
988
|
+
* imported, so no runtime initialization is required. Retained for API stability.
|
|
580
989
|
*/
|
|
581
990
|
declare function initProtoSync(): void;
|
|
582
991
|
/**
|
|
583
992
|
* Ensure proto is initialized.
|
|
993
|
+
*
|
|
994
|
+
* No-op: see {@link initProtoSync}. Retained for API stability.
|
|
584
995
|
*/
|
|
585
996
|
declare function ensureProtoInitialized(): Promise<void>;
|
|
586
997
|
/**
|
|
@@ -610,7 +1021,7 @@ declare function decodeLengthPrefix(data: Buffer): number;
|
|
|
610
1021
|
/**
|
|
611
1022
|
* Build a HelloRequest message.
|
|
612
1023
|
*/
|
|
613
|
-
declare function buildHelloRequest(username: string, password: string, clientName: string, clientVersion: string, conformance: string, tenantId?: string, graph?: string): QuicClientMessage;
|
|
1024
|
+
declare function buildHelloRequest(username: string, password: string, clientName: string, clientVersion: string, conformance: string, tenantId?: string, graph?: string, role?: string): QuicClientMessage;
|
|
614
1025
|
/**
|
|
615
1026
|
* Build an ExecuteRequest message.
|
|
616
1027
|
*/
|
|
@@ -1635,6 +2046,11 @@ declare class Connection {
|
|
|
1635
2046
|
query(query: string, options?: QueryOptions): Promise<QueryResult>;
|
|
1636
2047
|
/** Execute a query and return all rows as an array. */
|
|
1637
2048
|
queryAll(query: string, options?: QueryOptions): Promise<Record<string, unknown>[]>;
|
|
2049
|
+
/**
|
|
2050
|
+
* Execute a query and return exactly the first row. Throws ErrNoRows when
|
|
2051
|
+
* the result set is empty, mirroring database/sql's ErrNoRows.
|
|
2052
|
+
*/
|
|
2053
|
+
queryRow(query: string, options?: QueryOptions): Promise<Record<string, unknown>>;
|
|
1638
2054
|
/** Execute a query that doesn't return rows. */
|
|
1639
2055
|
exec(query: string, options?: QueryOptions): Promise<void>;
|
|
1640
2056
|
/** @internal Fetch the next page of results. Called by QueryResult. */
|
|
@@ -2268,6 +2684,11 @@ declare class ConnectionPool {
|
|
|
2268
2684
|
* Execute a query and return all rows.
|
|
2269
2685
|
*/
|
|
2270
2686
|
queryAll(query: string, options?: QueryOptions): Promise<Record<string, unknown>[]>;
|
|
2687
|
+
/**
|
|
2688
|
+
* Execute a query using a pooled connection and return the first row.
|
|
2689
|
+
* Throws ErrNoRows when the result set is empty.
|
|
2690
|
+
*/
|
|
2691
|
+
queryRow(query: string, options?: QueryOptions): Promise<Record<string, unknown>>;
|
|
2271
2692
|
/**
|
|
2272
2693
|
* Execute a statement that doesn't return rows.
|
|
2273
2694
|
*/
|
|
@@ -2342,6 +2763,32 @@ declare function defaultRetryPolicy(): RetryPolicy;
|
|
|
2342
2763
|
*/
|
|
2343
2764
|
declare function withRetry<T>(fn: () => Promise<T>, policy?: RetryPolicy): Promise<T>;
|
|
2344
2765
|
|
|
2766
|
+
/**
|
|
2767
|
+
* GQL Quoting Helpers
|
|
2768
|
+
*
|
|
2769
|
+
* Ports geode-client-go quote.go: safe inlining of identifiers, string
|
|
2770
|
+
* literals, and graph names into GQL admin statements.
|
|
2771
|
+
*/
|
|
2772
|
+
/**
|
|
2773
|
+
* Return `name` stripped of any character that is not alphanumeric, underscore,
|
|
2774
|
+
* or hyphen, so it can be inlined safely into a USE GRAPH statement.
|
|
2775
|
+
*/
|
|
2776
|
+
declare function sanitizeGraphName(name: string): string;
|
|
2777
|
+
/**
|
|
2778
|
+
* Validate and return `name` in a form safe to inline into a GQL admin
|
|
2779
|
+
* statement that takes an identifier. Valid identifiers consist of letters,
|
|
2780
|
+
* digits, underscore, and hyphen, and must not start with a hyphen. Digits are
|
|
2781
|
+
* permitted at any position. Throws ErrInvalidIdent for empty or invalid input.
|
|
2782
|
+
*/
|
|
2783
|
+
declare function quoteIdent(name: string): string;
|
|
2784
|
+
/**
|
|
2785
|
+
* Return `s` wrapped in GQL single quotes with backslashes and single quotes
|
|
2786
|
+
* escaped. ASCII control characters (< 0x20 or 0x7F) are rejected with
|
|
2787
|
+
* ErrInvalidString. Escape order: backslash first (\ -> \\), then single
|
|
2788
|
+
* quotes (' -> '').
|
|
2789
|
+
*/
|
|
2790
|
+
declare function quoteString(s: string): string;
|
|
2791
|
+
|
|
2345
2792
|
/**
|
|
2346
2793
|
* gRPC Transport Layer
|
|
2347
2794
|
*
|
|
@@ -2882,4 +3329,97 @@ declare function node(): NodePatternBuilder;
|
|
|
2882
3329
|
*/
|
|
2883
3330
|
declare function edge(): EdgePatternBuilder;
|
|
2884
3331
|
|
|
2885
|
-
|
|
3332
|
+
/**
|
|
3333
|
+
* Schema Loading
|
|
3334
|
+
*
|
|
3335
|
+
* Ports geode-client-go schema.go: read .gql files from a directory and turn
|
|
3336
|
+
* them into Statements suitable for batchExec / pipelineExec.
|
|
3337
|
+
*/
|
|
3338
|
+
/** A GQL query paired with optional bound parameters. */
|
|
3339
|
+
interface Statement {
|
|
3340
|
+
query: string;
|
|
3341
|
+
params?: Record<string, unknown>;
|
|
3342
|
+
}
|
|
3343
|
+
/**
|
|
3344
|
+
* Read all direct-child `.gql` files from `dir` and return Statements.
|
|
3345
|
+
*
|
|
3346
|
+
* Subdirectories are not traversed. Lines are split into statements at
|
|
3347
|
+
* semicolons after stripping blank lines, line comments (`//` and `--`), and
|
|
3348
|
+
* lines that do not start with a recognised GQL keyword.
|
|
3349
|
+
*/
|
|
3350
|
+
declare function parseSchemaFS(dir: string): Promise<Statement[]>;
|
|
3351
|
+
|
|
3352
|
+
/**
|
|
3353
|
+
* Pipeline / Batch Execution (GAP-0900)
|
|
3354
|
+
*
|
|
3355
|
+
* Ports geode-client-go batch.go PipelineExec/BatchExec:
|
|
3356
|
+
* - batchExec runs all statements inside one transaction, with retry.
|
|
3357
|
+
* - pipelineExec splits into chunks and runs up to maxWorkers concurrently;
|
|
3358
|
+
* the first error stops launching new chunks while in-flight chunks finish.
|
|
3359
|
+
*/
|
|
3360
|
+
|
|
3361
|
+
/** Default number of statements per chunk in pipelineExec. */
|
|
3362
|
+
declare const DEFAULT_CHUNK_SIZE = 100;
|
|
3363
|
+
/** Default maximum number of concurrent chunk workers in pipelineExec. */
|
|
3364
|
+
declare const DEFAULT_MAX_WORKERS = 8;
|
|
3365
|
+
/** Minimal transaction surface pipelineExec needs. */
|
|
3366
|
+
interface PipelineTx {
|
|
3367
|
+
exec(query: string, options?: {
|
|
3368
|
+
params?: Record<string, unknown>;
|
|
3369
|
+
}): Promise<void>;
|
|
3370
|
+
}
|
|
3371
|
+
/** Minimal pool surface pipelineExec needs (ConnectionPool satisfies this). */
|
|
3372
|
+
interface PipelineExecutor {
|
|
3373
|
+
withTransaction<T>(fn: (tx: PipelineTx) => Promise<T>): Promise<T>;
|
|
3374
|
+
}
|
|
3375
|
+
/**
|
|
3376
|
+
* Execute `stmts` inside a single transaction with automatic retry on
|
|
3377
|
+
* retryable errors. An empty list is a no-op.
|
|
3378
|
+
*/
|
|
3379
|
+
declare function batchExec(pool: PipelineExecutor, stmts: Statement[]): Promise<void>;
|
|
3380
|
+
/**
|
|
3381
|
+
* Execute `stmts` in parallel chunks. Splits into chunks of `chunkSize` and
|
|
3382
|
+
* runs up to `maxWorkers` chunks concurrently; each chunk runs through
|
|
3383
|
+
* batchExec. Returns the first error encountered; once an error occurs no new
|
|
3384
|
+
* chunks are launched but in-flight chunks complete.
|
|
3385
|
+
*/
|
|
3386
|
+
declare function pipelineExec(pool: PipelineExecutor, stmts: Statement[], opts?: {
|
|
3387
|
+
chunkSize?: number;
|
|
3388
|
+
maxWorkers?: number;
|
|
3389
|
+
signal?: AbortSignal;
|
|
3390
|
+
}): Promise<void>;
|
|
3391
|
+
|
|
3392
|
+
/**
|
|
3393
|
+
* Field-Level Encryption (FLE)
|
|
3394
|
+
*
|
|
3395
|
+
* Ports geode-client-go crypto/cipher.go using node:crypto:
|
|
3396
|
+
* - AES-256-GCM authenticated encryption (random 12-byte nonce, prepended).
|
|
3397
|
+
* - HKDF-SHA256 derives separate encryption and HMAC keys from a >= 32-byte
|
|
3398
|
+
* master key.
|
|
3399
|
+
* - HMAC-SHA256 hex digest for deterministic searchable encryption.
|
|
3400
|
+
*/
|
|
3401
|
+
/** Holds derived encryption and HMAC keys for field-level encryption. */
|
|
3402
|
+
declare class GeodeCipher {
|
|
3403
|
+
private readonly encKey;
|
|
3404
|
+
private readonly hmacKey;
|
|
3405
|
+
/** @internal Use createCipher(). */
|
|
3406
|
+
constructor(masterKey: Uint8Array);
|
|
3407
|
+
/** Encrypt with AES-256-GCM, prepending a random nonce. */
|
|
3408
|
+
encrypt(plaintext: Uint8Array): Buffer;
|
|
3409
|
+
/** Decrypt a ciphertext produced by encrypt(). Throws on short input or auth failure. */
|
|
3410
|
+
decrypt(ciphertext: Uint8Array): Buffer;
|
|
3411
|
+
/** Encrypt a string, returning a base64-encoded result. */
|
|
3412
|
+
encryptString(plaintext: string): string;
|
|
3413
|
+
/** Base64-decode and decrypt, returning the original string. */
|
|
3414
|
+
decryptString(encoded: string): string;
|
|
3415
|
+
/**
|
|
3416
|
+
* Compute HMAC-SHA256 of `data` using the derived HMAC key, returning a
|
|
3417
|
+
* 64-char lowercase hex digest. Deterministic; use for equality lookups on
|
|
3418
|
+
* encrypted fields.
|
|
3419
|
+
*/
|
|
3420
|
+
hmacHex(data: string): string;
|
|
3421
|
+
}
|
|
3422
|
+
/** Create a GeodeCipher from a master key (>= 32 bytes). */
|
|
3423
|
+
declare function createCipher(masterKey: Uint8Array): GeodeCipher;
|
|
3424
|
+
|
|
3425
|
+
export { AuthClient, BaseTransport, type BatchOptions, type BatchQuery, type BatchResult, type BatchSummary, BeginRequest, BeginResponse, type ClientOptions, type ColumnDef, ColumnDefinition, type ColumnInfo, CommitRequest, CommitResponse, ConfigError, Connection, ConnectionPool, type ConnectionState, type CreateRLSPolicyOptions, type CreateRoleOptions, type CreateUserOptions, DEFAULT_CHUNK_SIZE, DEFAULT_CONFORMANCE, DEFAULT_GRPC_PORT, DEFAULT_HELLO_NAME, DEFAULT_HELLO_VERSION, DEFAULT_MAX_WORKERS, DEFAULT_PAGE_SIZE, DEFAULT_PORT, type DSNScheme, DataPage, DriverError, ERR_BAD_CONN_MESSAGE, ERR_CLOSED_MESSAGE, ERR_INVALID_IDENT_MESSAGE, ERR_INVALID_STRING_MESSAGE, ERR_NO_ROWS_MESSAGE, ERR_NO_TX_MESSAGE, ERR_QUERY_IN_PROGRESS_MESSAGE, ERR_ROWS_CLOSED_MESSAGE, ERR_TX_DONE_MESSAGE, ERR_TX_IN_PROGRESS_MESSAGE, type EdgeDirection, type EdgePattern, EdgePatternBuilder, ErrBadConn, ErrClosed, ErrInvalidIdent, ErrInvalidString, ErrNoRows, ErrNoTx, ErrQueryInProgress, ErrRowsClosed, ErrTxDone, ErrTxInProgress, ExecuteRequest, ExecutionResponse, type ExplainOptions, type GQLEdge, type GQLId, type GQLNode, type GQLPath, type GQLRange, type GQLType, GQLValue, type GQLValueKind, GeodeCipher, GeodeClient, type GeodeConfig, type GeodeError, GrpcTransport, HelloRequest, HelloResponse, MAX_PAGE_SIZE, MAX_QUERY_LENGTH, MockTransport, type NodePattern, NodePatternBuilder, type OperationTiming, Param, type ParameterInfo, PatternBuilder, type PatternElement, type Permission, PingRequest, PingResponse, type PipelineExecutor, type PipelineTx, type PlanOperation, type PoolConfig, PredicateBuilder, type PredicateOp, PreparedStatement, type ProtoError, Row$1 as ProtoRow, type ProtoValue, PullRequest, PullResponse, QueryBuilder, type QueryOptions, type QueryParams, type QueryPlan, type QueryProfile, QueryResult, QueryResultIterator, QuicClientMessage, QuicServerMessage, QuicTransport, QuicTransport as QuicheTransport, type RLSPolicy, type RawEdge, type RetryPolicy, type Role, RollbackRequest, RollbackResponse, type Row, SUPPORTED_SCHEMES, SchemaDefinition, SecurityError, type SortDirection, StateError, type Statement, Status, StatusClass, type StatusClassType, Transaction, type Transport, TransportError, type TransportType, type User, batch, batchAll, batchExec, batchFirst, batchMap, batchParallel, buildBeginRequest, buildCommitRequest, buildExecuteRequest, buildHelloRequest, buildPingRequest, buildPullRequest, buildRollbackRequest, buildRollbackToRequest, buildSavepointRequest, buildTLSConfig, cloneConfig, createAuthClient, createCipher, createClient, createClientWithConfig, createTransport, decodeLengthPrefix, decodeQuicServerMessage, defaultConfig, defaultRetryPolicy, edge, encodeQuicClientMessage, encodeWithLengthPrefix, ensureProtoInitialized, explain, extractParameters, formatDSN, formatPlan, formatProfile, fromJSON, getAddress, getProtoPath, initProtoSync, isAuthError, isDriverError, isGeodeError, isRetryableError, isSentinelError, isSyntaxError, jsToProtoValue, node, parseDSN, parseGQLType, parseRow, parseSchemaFS, pattern, pipelineExec, predicate, prepare, profile, protoValueToJS, query, quoteIdent, quoteString, redactConfig, redactDSN, rowToObject, rowToRecord, sanitizeForLog, sanitizeGraphName, validateConfig, validateHostname, validatePageSize, validateParamName, validateParamValue, validatePort, validateQuery, validateSavepointName, withRetry, withTransaction };
|