@geodedb/client 1.0.0-alpha.25 → 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/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
 
@@ -77,6 +78,18 @@ interface GeodeConfig {
77
78
  inlineTimeout?: number;
78
79
  /** Enable TLS for gRPC (default: true) */
79
80
  tls?: boolean;
81
+ /** Graph name for DSN graph binding. When set, the server binds the session to this graph. */
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;
80
93
  }
81
94
  /**
82
95
  * Connection pool configuration.
@@ -120,6 +133,9 @@ declare function defaultConfig(): GeodeConfig;
120
133
  * - server_name: SNI server name
121
134
  * - connect_timeout: Connection timeout in ms
122
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
123
139
  *
124
140
  * Environment variables (used as defaults):
125
141
  * - GEODE_HOST: Default host
@@ -127,6 +143,8 @@ declare function defaultConfig(): GeodeConfig;
127
143
  * - GEODE_TLS_CA: Default CA certificate path
128
144
  * - GEODE_USERNAME: Default username
129
145
  * - GEODE_PASSWORD: Default password
146
+ * - GEODE_TENANT: Default tenant identifier
147
+ * - GEODE_ROLE: Default FLE role
130
148
  * - GEODE_TRANSPORT: Default transport type (quic or grpc)
131
149
  */
132
150
  declare function parseDSN(dsn: string): GeodeConfig;
@@ -138,6 +156,13 @@ declare function validateConfig(cfg: GeodeConfig): void;
138
156
  * Get the server address in host:port format.
139
157
  */
140
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;
141
166
  /**
142
167
  * Clone configuration.
143
168
  */
@@ -273,6 +298,8 @@ declare class StateError extends Error implements GeodeError {
273
298
  * Connection state enumeration.
274
299
  */
275
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";
276
303
  declare const ERR_CLOSED_MESSAGE = "geode: connection closed";
277
304
  declare const ERR_QUERY_IN_PROGRESS_MESSAGE = "geode: query already in progress";
278
305
  declare const ERR_TX_IN_PROGRESS_MESSAGE = "geode: transaction already in progress";
@@ -280,6 +307,9 @@ declare const ERR_NO_TX_MESSAGE = "geode: no transaction in progress";
280
307
  declare const ERR_TX_DONE_MESSAGE = "geode: transaction already committed or rolled back";
281
308
  declare const ERR_ROWS_CLOSED_MESSAGE = "geode: rows closed";
282
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;
283
313
  declare function ErrClosed(): Error;
284
314
  declare function ErrQueryInProgress(): Error;
285
315
  declare function ErrTxInProgress(): Error;
@@ -287,6 +317,7 @@ declare function ErrNoTx(): Error;
287
317
  declare function ErrTxDone(): Error;
288
318
  declare function ErrRowsClosed(): Error;
289
319
  declare function ErrBadConn(): Error;
320
+ declare function ErrNoRows(): Error;
290
321
  /**
291
322
  * Check if an error is a specific sentinel error by message.
292
323
  */
@@ -303,279 +334,664 @@ declare function isGeodeError(err: unknown): err is GeodeError;
303
334
  * Check if an error is retryable.
304
335
  */
305
336
  declare function isRetryableError(err: unknown): boolean;
306
-
307
337
  /**
308
- * Geode Protobuf Wire Protocol
309
- *
310
- * Uses protobufjs for encoding/decoding protocol messages.
311
- * Wire format for QUIC: 4-byte Big Endian length prefix + protobuf message body.
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
+ * ============================================================================
312
415
  */
313
416
  interface HelloRequest {
314
417
  username: string;
315
418
  password: string;
316
- tenantId?: string;
419
+ tenantId?: string | undefined;
317
420
  clientName: string;
318
421
  clientVersion: string;
319
422
  wantedConformance: string;
423
+ graph?: string | undefined;
424
+ /** FLE role for field-level access control */
425
+ role?: string | undefined;
320
426
  }
427
+ declare const HelloRequest: MessageFns<HelloRequest>;
321
428
  interface HelloResponse {
322
429
  success: boolean;
323
430
  sessionId: string;
324
431
  errorMessage: string;
325
432
  capabilities: string[];
433
+ passwordResetRequired: boolean;
434
+ graph?: string | undefined;
326
435
  }
327
- interface Param {
328
- name: string;
329
- value: ProtoValue;
330
- }
436
+ declare const HelloResponse: MessageFns<HelloResponse>;
437
+ /**
438
+ * ============================================================================
439
+ * Query Execution (RUN_GQL + PULL)
440
+ * ============================================================================
441
+ */
331
442
  interface ExecuteRequest {
332
443
  sessionId: string;
333
444
  query: string;
334
445
  params: Param[];
335
446
  }
447
+ declare const ExecuteRequest: MessageFns<ExecuteRequest>;
448
+ interface Param {
449
+ name: string;
450
+ value?: Value | undefined;
451
+ }
452
+ declare const Param: MessageFns<Param>;
336
453
  interface PullRequest {
337
- requestId: bigint | number;
454
+ requestId: number;
338
455
  pageSize: number;
456
+ /** Required for gRPC; ignored for QUIC */
339
457
  sessionId: string;
340
458
  }
459
+ declare const PullRequest: MessageFns<PullRequest>;
341
460
  interface PullResponse {
342
- response?: ExecutionResponse;
461
+ response?: ExecutionResponse | undefined;
343
462
  }
463
+ declare const PullResponse: MessageFns<PullResponse>;
464
+ /**
465
+ * ============================================================================
466
+ * Execution Responses
467
+ * ============================================================================
468
+ */
344
469
  interface Status {
470
+ /** e.g., "00000" */
345
471
  statusClass: string;
346
472
  statusSubclass: string;
347
473
  additionalStatuses: string[];
348
474
  flaggerFindings: string[];
349
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>;
350
492
  interface ColumnDefinition {
351
493
  name: string;
352
494
  type: string;
353
495
  }
354
- interface SchemaDefinition {
355
- columns: ColumnDefinition[];
356
- }
357
- interface ProtoValue {
358
- nullVal?: NullValue;
359
- intVal?: IntValue;
360
- doubleVal?: DoubleValue;
361
- boolVal?: boolean;
362
- stringVal?: StringValue;
363
- decimalVal?: DecimalValue;
364
- bytesVal?: BytesValue;
365
- listVal?: ListValue;
366
- mapVal?: MapValue;
367
- nodeVal?: NodeValue;
368
- edgeVal?: EdgeValue;
369
- pathVal?: PathValue;
370
- extVal?: ExtendedValue;
496
+ declare const ColumnDefinition: MessageFns<ColumnDefinition>;
497
+ interface DataPage {
498
+ rows: Row$1[];
499
+ final: boolean;
500
+ ordered: boolean;
501
+ orderKeys: string[];
371
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>;
372
529
  interface NullValue {
373
530
  }
531
+ declare const NullValue: MessageFns<NullValue>;
374
532
  interface IntValue {
375
- value: bigint | number;
376
- kind: number;
533
+ value: number;
534
+ kind: IntKind;
377
535
  }
536
+ declare const IntValue: MessageFns<IntValue>;
378
537
  interface DoubleValue {
379
538
  value: number;
380
- kind: number;
539
+ kind: FloatKind;
381
540
  }
541
+ declare const DoubleValue: MessageFns<DoubleValue>;
382
542
  interface StringValue {
383
543
  value: string;
384
- kind: number;
544
+ kind: StringKind;
385
545
  }
546
+ declare const StringValue: MessageFns<StringValue>;
386
547
  interface DecimalValue {
548
+ /** i128 as decimal string */
387
549
  coeff: string;
388
550
  scale: number;
389
551
  origScale: number;
390
552
  origRepr: string;
391
553
  }
554
+ declare const DecimalValue: MessageFns<DecimalValue>;
392
555
  interface BytesValue {
393
556
  value: Uint8Array;
394
- kind: number;
557
+ kind: BytesKind;
395
558
  }
559
+ declare const BytesValue: MessageFns<BytesValue>;
396
560
  interface ListValue {
397
- values: ProtoValue[];
561
+ values: Value[];
398
562
  }
563
+ declare const ListValue: MessageFns<ListValue>;
399
564
  interface MapEntry {
400
565
  key: string;
401
- value: ProtoValue;
566
+ value?: Value | undefined;
402
567
  }
568
+ declare const MapEntry: MessageFns<MapEntry>;
403
569
  interface MapValue {
404
570
  entries: MapEntry[];
405
571
  }
572
+ declare const MapValue: MessageFns<MapValue>;
406
573
  interface NodeValue {
407
- id: bigint | number;
574
+ id: number;
408
575
  labels: string[];
409
576
  properties: MapEntry[];
410
577
  }
578
+ declare const NodeValue: MessageFns<NodeValue>;
411
579
  interface EdgeValue {
412
- id: bigint | number;
413
- fromId: bigint | number;
414
- toId: bigint | number;
580
+ id: number;
581
+ fromId: number;
582
+ toId: number;
415
583
  label: string;
416
584
  properties: MapEntry[];
417
585
  }
586
+ declare const EdgeValue: MessageFns<EdgeValue>;
418
587
  interface PathValue {
419
588
  nodes: NodeValue[];
420
589
  edges: EdgeValue[];
421
590
  }
591
+ declare const PathValue: MessageFns<PathValue>;
422
592
  interface ExtendedValue {
423
593
  typeName: string;
424
- text?: string;
425
- bytes?: Uint8Array;
426
- intVal?: bigint | number;
427
- doubleVal?: number;
428
- boolVal?: boolean;
429
- }
430
- interface Row$1 {
431
- values: ProtoValue[];
432
- }
433
- interface DataPage {
434
- rows: Row$1[];
435
- final: boolean;
436
- ordered: boolean;
437
- orderKeys: string[];
438
- }
439
- 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 {
440
602
  code: string;
441
603
  message: string;
604
+ /** "ERROR" */
442
605
  type: string;
443
606
  anchor: string;
444
607
  }
608
+ declare const Error$1: MessageFns<Error$1>;
445
609
  interface ExecutionMetrics {
446
- parseDurationNs: bigint | number;
447
- planDurationNs: bigint | number;
448
- executeDurationNs: bigint | number;
449
- totalDurationNs: bigint | number;
450
- }
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>;
451
623
  interface ExplainTotals {
452
- cost?: number;
453
- est_rows?: number;
624
+ estRows: number;
625
+ cost: number;
454
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>;
455
648
  interface ExplainPayload {
456
649
  schema: string;
457
- ops: unknown[];
458
- totals?: ExplainTotals;
459
- properties: unknown;
460
- calibration: unknown;
650
+ ops: ExplainOp[];
651
+ totals?: ExplainTotals | undefined;
652
+ properties?: ExplainProperties | undefined;
653
+ calibration?: ExplainCalibration | undefined;
461
654
  profileVersion: number;
462
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>;
463
700
  interface ProfileMemory {
464
- netBytes?: number | bigint;
465
- peakBytes?: number | bigint;
466
- totalAllocBytes?: number | bigint;
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;
467
730
  }
731
+ declare const ProfileSetOp: MessageFns<ProfileSetOp>;
468
732
  interface ProfilePayload {
469
733
  profileVersion: number;
470
- ops: unknown[];
471
- peakContributors: unknown[];
472
- totals: unknown;
473
- totalTimeNs: bigint | number;
474
- spills: unknown;
475
- memory?: ProfileMemory;
476
- plannerEstimates: unknown;
477
- memCurve: unknown[];
478
- setop: unknown;
479
- hashaggSpills: bigint | number;
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;
480
744
  hashaggSpillReason: string;
481
- committedTxns: bigint | number;
482
- graphStoreNodes: bigint | number;
483
- graphStoreEdges: bigint | number;
745
+ committedTxns: number;
746
+ graphStoreNodes: number;
747
+ graphStoreEdges: number;
484
748
  graphStoreDirty: boolean;
485
749
  flaggerFindings: string[];
486
750
  compact: boolean;
487
751
  }
752
+ declare const ProfilePayload: MessageFns<ProfilePayload>;
488
753
  interface Heartbeat {
489
754
  }
490
- interface ExecutionResponse {
491
- status?: Status;
492
- schema?: SchemaDefinition;
493
- page?: DataPage;
494
- error?: ProtoError;
495
- metrics?: ExecutionMetrics;
496
- explain?: ExplainPayload;
497
- profile?: ProfilePayload;
498
- heartbeat?: Heartbeat;
499
- }
755
+ declare const Heartbeat: MessageFns<Heartbeat>;
756
+ /**
757
+ * ============================================================================
758
+ * Utilities (PING)
759
+ * ============================================================================
760
+ */
500
761
  interface PingRequest {
501
762
  }
763
+ declare const PingRequest: MessageFns<PingRequest>;
502
764
  interface PingResponse {
503
765
  ok: boolean;
504
766
  }
767
+ declare const PingResponse: MessageFns<PingResponse>;
768
+ /**
769
+ * ============================================================================
770
+ * Transactions
771
+ * ============================================================================
772
+ */
505
773
  interface BeginRequest {
506
774
  readOnly: boolean;
775
+ /** Required for gRPC; ignored for QUIC */
507
776
  sessionId: string;
508
777
  }
778
+ declare const BeginRequest: MessageFns<BeginRequest>;
509
779
  interface BeginResponse {
510
780
  sessionId: string;
511
781
  txId: string;
512
782
  }
783
+ declare const BeginResponse: MessageFns<BeginResponse>;
513
784
  interface CommitRequest {
785
+ /** Required for gRPC; ignored for QUIC */
514
786
  sessionId: string;
515
787
  }
788
+ declare const CommitRequest: MessageFns<CommitRequest>;
516
789
  interface CommitResponse {
517
790
  success: boolean;
518
791
  }
792
+ declare const CommitResponse: MessageFns<CommitResponse>;
519
793
  interface RollbackRequest {
794
+ /** Required for gRPC; ignored for QUIC */
520
795
  sessionId: string;
521
796
  }
797
+ declare const RollbackRequest: MessageFns<RollbackRequest>;
522
798
  interface RollbackResponse {
523
799
  success: boolean;
524
800
  }
801
+ declare const RollbackResponse: MessageFns<RollbackResponse>;
525
802
  interface SavepointRequest {
526
803
  name: string;
804
+ /** Required for gRPC; ignored for QUIC */
527
805
  sessionId: string;
528
806
  }
807
+ declare const SavepointRequest: MessageFns<SavepointRequest>;
529
808
  interface SavepointResponse {
530
809
  success: boolean;
531
810
  }
811
+ declare const SavepointResponse: MessageFns<SavepointResponse>;
532
812
  interface RollbackToRequest {
533
813
  name: string;
814
+ /** Required for gRPC; ignored for QUIC */
534
815
  sessionId: string;
535
816
  }
817
+ declare const RollbackToRequest: MessageFns<RollbackToRequest>;
536
818
  interface RollbackToResponse {
537
819
  success: boolean;
538
820
  }
539
- interface QuicClientMessage {
540
- hello?: HelloRequest;
541
- execute?: ExecuteRequest;
542
- pull?: PullRequest;
543
- ping?: PingRequest;
544
- cdcDiag?: unknown;
545
- cdcCtrl?: unknown;
546
- begin?: BeginRequest;
547
- commit?: CommitRequest;
548
- rollback?: RollbackRequest;
549
- savepoint?: SavepointRequest;
550
- rollbackTo?: RollbackToRequest;
551
- backup?: unknown;
552
- restore?: unknown;
553
- uploadBackup?: unknown;
821
+ declare const RollbackToResponse: MessageFns<RollbackToResponse>;
822
+ /**
823
+ * ============================================================================
824
+ * CDC
825
+ * ============================================================================
826
+ */
827
+ interface CdcDiagnosticsRequest {
554
828
  }
555
- interface QuicServerMessage {
556
- hello?: HelloResponse;
557
- execute?: ExecutionResponse;
558
- pull?: PullResponse;
559
- ping?: PingResponse;
560
- cdcDiag?: unknown;
561
- cdcCtrl?: unknown;
562
- begin?: BeginResponse;
563
- commit?: CommitResponse;
564
- rollback?: RollbackResponse;
565
- savepoint?: SavepointResponse;
566
- rollbackTo?: RollbackToResponse;
567
- backup?: unknown;
568
- restore?: unknown;
569
- uploadBackup?: unknown;
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;
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;
570
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;
571
984
  /**
572
985
  * Initialize protobuf types synchronously.
573
- * Safe to call multiple times; only loads on first call.
574
- * Prefer ensureProtoInitialized() in async contexts to avoid blocking the event loop.
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.
575
989
  */
576
990
  declare function initProtoSync(): void;
577
991
  /**
578
992
  * Ensure proto is initialized.
993
+ *
994
+ * No-op: see {@link initProtoSync}. Retained for API stability.
579
995
  */
580
996
  declare function ensureProtoInitialized(): Promise<void>;
581
997
  /**
@@ -605,7 +1021,7 @@ declare function decodeLengthPrefix(data: Buffer): number;
605
1021
  /**
606
1022
  * Build a HelloRequest message.
607
1023
  */
608
- declare function buildHelloRequest(username: string, password: string, clientName: string, clientVersion: string, conformance: string, tenantId?: string): QuicClientMessage;
1024
+ declare function buildHelloRequest(username: string, password: string, clientName: string, clientVersion: string, conformance: string, tenantId?: string, graph?: string, role?: string): QuicClientMessage;
609
1025
  /**
610
1026
  * Build an ExecuteRequest message.
611
1027
  */
@@ -703,6 +1119,7 @@ declare class QuicTransport extends BaseTransport {
703
1119
  private _maxMessageSize;
704
1120
  private _maxBufferBytes;
705
1121
  private _pendingProtoReads;
1122
+ private _pendingResponses;
706
1123
  constructor(address: string, maxMessageSize?: number, maxBufferBytes?: number);
707
1124
  /**
708
1125
  * Connect to the Geode server using QUIC.
@@ -1129,10 +1546,18 @@ declare class Transaction {
1129
1546
  exec(query: string, options?: QueryOptions): Promise<void>;
1130
1547
  /**
1131
1548
  * Create a savepoint.
1549
+ *
1550
+ * Savepoints are only supported over the QUIC transport. Over gRPC this
1551
+ * rejects with a {@link DriverError} (statusClass `58000`) directing callers
1552
+ * to use `quic://`.
1132
1553
  */
1133
1554
  savepoint(name: string, signal?: AbortSignal): Promise<void>;
1134
1555
  /**
1135
1556
  * Rollback to a savepoint.
1557
+ *
1558
+ * Savepoints are only supported over the QUIC transport. Over gRPC this
1559
+ * rejects with a {@link DriverError} (statusClass `58000`) directing callers
1560
+ * to use `quic://`.
1136
1561
  */
1137
1562
  rollbackTo(name: string, signal?: AbortSignal): Promise<void>;
1138
1563
  /**
@@ -1621,6 +2046,11 @@ declare class Connection {
1621
2046
  query(query: string, options?: QueryOptions): Promise<QueryResult>;
1622
2047
  /** Execute a query and return all rows as an array. */
1623
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>>;
1624
2054
  /** Execute a query that doesn't return rows. */
1625
2055
  exec(query: string, options?: QueryOptions): Promise<void>;
1626
2056
  /** @internal Fetch the next page of results. Called by QueryResult. */
@@ -1630,6 +2060,8 @@ declare class Connection {
1630
2060
  }>;
1631
2061
  /** Try to receive an inline response with short timeout. */
1632
2062
  private _tryReceiveInline;
2063
+ /** Read inline execute responses until a page, error, heartbeat, or timeout arrives. */
2064
+ private _readInlineExecute;
1633
2065
  /** Drain remaining data pages until final=true to prevent query corruption (QUAL-T7). */
1634
2066
  private _drainRemainingPages;
1635
2067
  /** @internal Release the active result, returning the connection to idle. */
@@ -1666,6 +2098,7 @@ declare class Connection {
1666
2098
  private _receiveWithTimeout;
1667
2099
  /** Create a combined abort signal from requestTimeout and optional caller signal (CWE-703). */
1668
2100
  private _withRequestTimeout;
2101
+ private _closeOnTransportError;
1669
2102
  }
1670
2103
 
1671
2104
  /**
@@ -2204,6 +2637,7 @@ interface RateLimiterConfig {
2204
2637
  declare class ConnectionPool {
2205
2638
  private _config;
2206
2639
  private _connections;
2640
+ private _pendingConnections;
2207
2641
  private _waitQueue;
2208
2642
  private _closed;
2209
2643
  private _maintenanceInterval?;
@@ -2250,6 +2684,11 @@ declare class ConnectionPool {
2250
2684
  * Execute a query and return all rows.
2251
2685
  */
2252
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>>;
2253
2692
  /**
2254
2693
  * Execute a statement that doesn't return rows.
2255
2694
  */
@@ -2274,12 +2713,82 @@ declare class ConnectionPool {
2274
2713
  * Remove a connection from the pool.
2275
2714
  */
2276
2715
  private removeConnection;
2716
+ private fulfillWaiters;
2277
2717
  /**
2278
2718
  * Perform pool maintenance.
2279
2719
  */
2280
2720
  private maintenance;
2281
2721
  }
2282
2722
 
2723
+ /**
2724
+ * Client-level retry wrapper for transient errors.
2725
+ *
2726
+ * Mirrors the Go reference client's `RetryPolicy`/`Retry` (see
2727
+ * `geode-client-go/retry.go`): retries only when {@link isRetryableError}
2728
+ * returns true, with exponential backoff capped at `maxBackoffMs`.
2729
+ */
2730
+ /**
2731
+ * Configures retry behavior for transient errors.
2732
+ */
2733
+ interface RetryPolicy {
2734
+ /**
2735
+ * Maximum number of attempts including the initial call.
2736
+ * Values less than 1 are treated as 1.
2737
+ */
2738
+ maxAttempts: number;
2739
+ /** Delay in milliseconds before the first retry. */
2740
+ initialBackoffMs: number;
2741
+ /**
2742
+ * Maximum backoff in milliseconds. The exponential backoff is clamped to
2743
+ * this value.
2744
+ */
2745
+ maxBackoffMs: number;
2746
+ /** Exponential backoff multiplier applied on each retry. */
2747
+ multiplier: number;
2748
+ }
2749
+ /**
2750
+ * Returns a {@link RetryPolicy} with sensible defaults:
2751
+ * 3 max attempts, 1000ms initial backoff, 30000ms max backoff, 2.0 multiplier.
2752
+ */
2753
+ declare function defaultRetryPolicy(): RetryPolicy;
2754
+ /**
2755
+ * Executes `fn` up to `policy.maxAttempts` times, retrying only when
2756
+ * {@link isRetryableError} returns true for the rejection reason. Non-retryable
2757
+ * errors and non-Geode errors are propagated immediately without further
2758
+ * attempts. Between attempts the wrapper waits using exponential backoff
2759
+ * clamped to `policy.maxBackoffMs`.
2760
+ *
2761
+ * @param fn The operation to run. Re-invoked on each retry.
2762
+ * @param policy Optional retry policy. Defaults to {@link defaultRetryPolicy}.
2763
+ */
2764
+ declare function withRetry<T>(fn: () => Promise<T>, policy?: RetryPolicy): Promise<T>;
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
+
2283
2792
  /**
2284
2793
  * gRPC Transport Layer
2285
2794
  *
@@ -2820,4 +3329,97 @@ declare function node(): NodePatternBuilder;
2820
3329
  */
2821
3330
  declare function edge(): EdgePatternBuilder;
2822
3331
 
2823
- export { AuthClient, BaseTransport, type BatchOptions, type BatchQuery, type BatchResult, type BatchSummary, type BeginRequest, type BeginResponse, type ClientOptions, type ColumnDef, type ColumnDefinition, type ColumnInfo, type CommitRequest, type CommitResponse, ConfigError, Connection, ConnectionPool, type ConnectionState, type CreateRLSPolicyOptions, type CreateRoleOptions, type CreateUserOptions, DEFAULT_CONFORMANCE, DEFAULT_GRPC_PORT, DEFAULT_HELLO_NAME, DEFAULT_HELLO_VERSION, DEFAULT_PAGE_SIZE, DEFAULT_PORT, type DSNScheme, type DataPage, DriverError, ERR_BAD_CONN_MESSAGE, ERR_CLOSED_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, ErrNoTx, ErrQueryInProgress, ErrRowsClosed, ErrTxDone, ErrTxInProgress, type ExecuteRequest, type ExecutionResponse, type ExplainOptions, type GQLEdge, type GQLId, type GQLNode, type GQLPath, type GQLRange, type GQLType, GQLValue, type GQLValueKind, GeodeClient, type GeodeConfig, type GeodeError, GrpcTransport, type HelloRequest, type HelloResponse, MAX_PAGE_SIZE, MAX_QUERY_LENGTH, MockTransport, type NodePattern, NodePatternBuilder, type OperationTiming, type Param, type ParameterInfo, PatternBuilder, type PatternElement, type Permission, type PingRequest, type PingResponse, type PlanOperation, type PoolConfig, PredicateBuilder, type PredicateOp, PreparedStatement, type ProtoError, type Row$1 as ProtoRow, type ProtoValue, type PullRequest, type PullResponse, QueryBuilder, type QueryOptions, type QueryParams, type QueryPlan, type QueryProfile, QueryResult, QueryResultIterator, type QuicClientMessage, type QuicServerMessage, QuicTransport, QuicTransport as QuicheTransport, type RLSPolicy, type RawEdge, type Role, type RollbackRequest, type RollbackResponse, type Row, SUPPORTED_SCHEMES, type SchemaDefinition, SecurityError, type SortDirection, StateError, type Status, StatusClass, type StatusClassType, Transaction, type Transport, TransportError, type TransportType, type User, batch, batchAll, batchFirst, batchMap, batchParallel, buildBeginRequest, buildCommitRequest, buildExecuteRequest, buildHelloRequest, buildPingRequest, buildPullRequest, buildRollbackRequest, buildRollbackToRequest, buildSavepointRequest, buildTLSConfig, cloneConfig, createAuthClient, createClient, createClientWithConfig, createTransport, decodeLengthPrefix, decodeQuicServerMessage, defaultConfig, edge, encodeQuicClientMessage, encodeWithLengthPrefix, ensureProtoInitialized, explain, extractParameters, formatPlan, formatProfile, fromJSON, getAddress, getProtoPath, initProtoSync, isDriverError, isGeodeError, isRetryableError, isSentinelError, jsToProtoValue, node, parseDSN, parseGQLType, parseRow, pattern, predicate, prepare, profile, protoValueToJS, query, redactConfig, redactDSN, rowToObject, rowToRecord, sanitizeForLog, validateConfig, validateHostname, validatePageSize, validateParamName, validateParamValue, validatePort, validateQuery, validateSavepointName, withTransaction };
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 };