@geodedb/client 1.0.0-alpha.2 → 1.0.0-alpha.21

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/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@geodedb/client",
3
- "version": "1.0.0-alpha.2",
4
- "description": "Node.js client library for Geode graph database (QUIC + TLS 1.3)",
3
+ "version": "1.0.0-alpha.21",
4
+ "description": "Node.js client library for Geode graph database (QUIC/gRPC + TLS 1.3)",
5
+ "type": "module",
5
6
  "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
+ "module": "dist/index.js",
7
8
  "types": "dist/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
10
11
  "types": "./dist/index.d.ts",
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.js"
12
+ "import": "./dist/index.js"
13
13
  }
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
+ "proto",
17
18
  "README.md",
18
19
  "LICENSE"
19
20
  ],
@@ -46,7 +47,7 @@
46
47
  "license": "Apache-2.0",
47
48
  "repository": {
48
49
  "type": "git",
49
- "url": "https://gitlab.com/devnw/geode/geode-client-nodejs"
50
+ "url": "git+https://gitlab.com/devnw/geode/geode-client-nodejs.git"
50
51
  },
51
52
  "homepage": "https://gitlab.com/devnw/geode",
52
53
  "bugs": {
@@ -60,21 +61,25 @@
60
61
  "registry": "https://registry.npmjs.org/"
61
62
  },
62
63
  "dependencies": {
64
+ "@grpc/grpc-js": "^1.12.0",
65
+ "@grpc/proto-loader": "^0.7.15",
63
66
  "@matrixai/quic": "^2.0.9",
64
- "decimal.js-light": "^2.5.1"
67
+ "decimal.js-light": "^2.5.1",
68
+ "protobufjs": "^7.4.0"
65
69
  },
66
70
  "devDependencies": {
67
71
  "@types/node": "^20.11.0",
68
- "@typescript-eslint/eslint-plugin": "^7.0.0",
69
- "@typescript-eslint/parser": "^7.0.0",
70
- "@vitest/coverage-v8": "^2.0.0",
71
- "eslint": "^8.56.0",
72
+ "@typescript-eslint/eslint-plugin": "^8.54.0",
73
+ "@typescript-eslint/parser": "^8.54.0",
74
+ "@vitest/coverage-v8": "^4.0.18",
75
+ "eslint": "^9.39.2",
72
76
  "eslint-config-prettier": "^9.1.0",
73
77
  "fast-check": "^4.5.3",
74
78
  "prettier": "^3.2.0",
75
- "testcontainers": "^10.6.0",
79
+ "testcontainers": "^11.11.0",
76
80
  "tsup": "^8.0.0",
77
81
  "typescript": "^5.3.0",
78
- "vitest": "^2.0.0"
82
+ "typescript-eslint": "^8.54.0",
83
+ "vitest": "^4.0.18"
79
84
  }
80
85
  }
@@ -0,0 +1,577 @@
1
+ syntax = "proto3";
2
+ package geode;
3
+
4
+ option go_package = "geodedb.com/geode/proto";
5
+
6
+ // GeodeService provides gRPC access to the Geode database.
7
+ service GeodeService {
8
+ rpc Handshake(HelloRequest) returns (HelloResponse);
9
+ rpc Execute(ExecuteRequest) returns (stream ExecutionResponse);
10
+ rpc Ping(PingRequest) returns (PingResponse);
11
+ rpc Begin(BeginRequest) returns (BeginResponse);
12
+ rpc Commit(CommitRequest) returns (CommitResponse);
13
+ rpc Rollback(RollbackRequest) returns (RollbackResponse);
14
+ rpc GetCdcDiagnostics(CdcDiagnosticsRequest) returns (CdcDiagnosticsResponse);
15
+ rpc ControlCdc(CdcControlRequest) returns (CdcControlResponse);
16
+ }
17
+
18
+ // ============================================================================
19
+ // Transport Wrappers (QUIC framing)
20
+ // ============================================================================
21
+ message ClientPacket {
22
+ oneof msg {
23
+ QuicClientMessage quic = 1;
24
+ }
25
+ }
26
+
27
+ message ServerPacket {
28
+ oneof msg {
29
+ QuicServerMessage quic = 1;
30
+ }
31
+ }
32
+
33
+ // ============================================================================
34
+ // QUIC Messages
35
+ // ============================================================================
36
+ message QuicClientMessage {
37
+ oneof msg {
38
+ HelloRequest hello = 1;
39
+ ExecuteRequest execute = 2;
40
+ PullRequest pull = 3;
41
+ PingRequest ping = 4;
42
+ CdcDiagnosticsRequest cdc_diag = 5;
43
+ CdcControlRequest cdc_ctrl = 6;
44
+ BeginRequest begin = 7;
45
+ CommitRequest commit = 8;
46
+ RollbackRequest rollback = 9;
47
+ SavepointRequest savepoint = 10;
48
+ RollbackToRequest rollback_to = 11;
49
+ BackupRequest backup = 12;
50
+ RestoreRequest restore = 13;
51
+ UploadBackupRequest upload_backup = 14;
52
+ }
53
+ }
54
+
55
+ message QuicServerMessage {
56
+ oneof msg {
57
+ HelloResponse hello = 1;
58
+ ExecutionResponse execute = 2;
59
+ PullResponse pull = 3;
60
+ PingResponse ping = 4;
61
+ CdcDiagnosticsResponse cdc_diag = 5;
62
+ CdcControlResponse cdc_ctrl = 6;
63
+ BeginResponse begin = 7;
64
+ CommitResponse commit = 8;
65
+ RollbackResponse rollback = 9;
66
+ SavepointResponse savepoint = 10;
67
+ RollbackToResponse rollback_to = 11;
68
+ BackupResponse backup = 12;
69
+ RestoreResponse restore = 13;
70
+ UploadBackupResponse upload_backup = 14;
71
+ }
72
+ }
73
+
74
+ // ============================================================================
75
+ // Authentication (HELLO)
76
+ // ============================================================================
77
+ message HelloRequest {
78
+ string username = 1;
79
+ string password = 2;
80
+ optional string tenant_id = 3;
81
+ string client_name = 4;
82
+ string client_version = 5;
83
+ string wanted_conformance = 6;
84
+ }
85
+
86
+ message HelloResponse {
87
+ bool success = 1;
88
+ string session_id = 2;
89
+ string error_message = 3;
90
+ repeated string capabilities = 4;
91
+ }
92
+
93
+ // ============================================================================
94
+ // Query Execution (RUN_GQL + PULL)
95
+ // ============================================================================
96
+ message ExecuteRequest {
97
+ string session_id = 1;
98
+ string query = 2;
99
+ repeated Param params = 3;
100
+ }
101
+
102
+ message Param {
103
+ string name = 1;
104
+ Value value = 2;
105
+ }
106
+
107
+ message PullRequest {
108
+ uint64 request_id = 1;
109
+ uint32 page_size = 2;
110
+ string session_id = 3; // Required for gRPC; ignored for QUIC
111
+ }
112
+
113
+ message PullResponse {
114
+ ExecutionResponse response = 1;
115
+ }
116
+
117
+ // ============================================================================
118
+ // Execution Responses
119
+ // ============================================================================
120
+ message Status {
121
+ string status_class = 1; // e.g., "00000"
122
+ string status_subclass = 2;
123
+ repeated string additional_statuses = 3;
124
+ repeated string flagger_findings = 4;
125
+ }
126
+
127
+ message ExecutionResponse {
128
+ Status status = 1;
129
+ oneof payload {
130
+ SchemaDefinition schema = 2;
131
+ DataPage page = 3;
132
+ Error error = 4;
133
+ ExecutionMetrics metrics = 5;
134
+ ExplainPayload explain = 6;
135
+ ProfilePayload profile = 7;
136
+ Heartbeat heartbeat = 8;
137
+ }
138
+ }
139
+
140
+ message SchemaDefinition {
141
+ repeated ColumnDefinition columns = 1;
142
+ }
143
+
144
+ message ColumnDefinition {
145
+ string name = 1;
146
+ string type = 2;
147
+ }
148
+
149
+ message DataPage {
150
+ repeated Row rows = 1;
151
+ bool final = 2;
152
+ bool ordered = 3;
153
+ repeated string order_keys = 4;
154
+ }
155
+
156
+ message Row {
157
+ repeated Value values = 1;
158
+ }
159
+
160
+ // ----------------------------------------------------------------------------
161
+ // Value Encoding
162
+ // ----------------------------------------------------------------------------
163
+ message Value {
164
+ oneof kind {
165
+ NullValue null_val = 1;
166
+ IntValue int_val = 2;
167
+ DoubleValue double_val = 3;
168
+ bool bool_val = 4;
169
+ StringValue string_val = 5;
170
+ DecimalValue decimal_val = 6;
171
+ BytesValue bytes_val = 7;
172
+ ListValue list_val = 8;
173
+ MapValue map_val = 9;
174
+ NodeValue node_val = 10;
175
+ EdgeValue edge_val = 11;
176
+ PathValue path_val = 12;
177
+ ExtendedValue ext_val = 13;
178
+ }
179
+ }
180
+
181
+ message NullValue {}
182
+
183
+ enum IntKind {
184
+ INT_KIND_UNSPECIFIED = 0;
185
+ INT = 1;
186
+ SMALLINT = 2;
187
+ BIGINT = 3;
188
+ }
189
+
190
+ message IntValue {
191
+ int64 value = 1;
192
+ IntKind kind = 2;
193
+ }
194
+
195
+ enum FloatKind {
196
+ FLOAT_KIND_UNSPECIFIED = 0;
197
+ DOUBLE = 1;
198
+ REAL = 2;
199
+ }
200
+
201
+ message DoubleValue {
202
+ double value = 1;
203
+ FloatKind kind = 2;
204
+ }
205
+
206
+ enum StringKind {
207
+ STRING_KIND_UNSPECIFIED = 0;
208
+ STRING = 1;
209
+ CHAR = 2;
210
+ VARCHAR = 3;
211
+ TEXT = 4;
212
+ }
213
+
214
+ message StringValue {
215
+ string value = 1;
216
+ StringKind kind = 2;
217
+ }
218
+
219
+ message DecimalValue {
220
+ string coeff = 1; // i128 as decimal string
221
+ uint32 scale = 2;
222
+ uint32 orig_scale = 3;
223
+ string orig_repr = 4;
224
+ }
225
+
226
+ enum BytesKind {
227
+ BYTES_KIND_UNSPECIFIED = 0;
228
+ BYTEA = 1;
229
+ RAW = 2;
230
+ }
231
+
232
+ message BytesValue {
233
+ bytes value = 1;
234
+ BytesKind kind = 2;
235
+ }
236
+
237
+ message ListValue {
238
+ repeated Value values = 1;
239
+ }
240
+
241
+ message MapEntry {
242
+ string key = 1;
243
+ Value value = 2;
244
+ }
245
+
246
+ message MapValue {
247
+ repeated MapEntry entries = 1;
248
+ }
249
+
250
+ message NodeValue {
251
+ uint64 id = 1;
252
+ repeated string labels = 2;
253
+ repeated MapEntry properties = 3;
254
+ }
255
+
256
+ message EdgeValue {
257
+ uint64 id = 1;
258
+ uint64 from_id = 2;
259
+ uint64 to_id = 3;
260
+ string label = 4;
261
+ repeated MapEntry properties = 5;
262
+ }
263
+
264
+ message PathValue {
265
+ repeated NodeValue nodes = 1;
266
+ repeated EdgeValue edges = 2;
267
+ }
268
+
269
+ message ExtendedValue {
270
+ string type_name = 1;
271
+ oneof data {
272
+ string text = 2;
273
+ bytes bytes = 3;
274
+ int64 int_val = 4;
275
+ double double_val = 5;
276
+ bool bool_val = 6;
277
+ }
278
+ }
279
+
280
+ message Error {
281
+ string code = 1;
282
+ string message = 2;
283
+ string type = 3; // "ERROR"
284
+ string anchor = 4;
285
+ }
286
+
287
+ message ExecutionMetrics {
288
+ int64 parse_duration_ns = 1;
289
+ int64 plan_duration_ns = 2;
290
+ int64 execute_duration_ns = 3;
291
+ int64 total_duration_ns = 4;
292
+ }
293
+
294
+ message ExplainOp {
295
+ uint32 idx = 1;
296
+ string kind = 2;
297
+ int64 est_rows = 3;
298
+ int64 cost = 4;
299
+ }
300
+
301
+ message ExplainTotals {
302
+ int64 est_rows = 1;
303
+ int64 cost = 2;
304
+ }
305
+
306
+ message ExplainProperties {
307
+ bool ordered = 1;
308
+ uint64 limit = 2;
309
+ uint64 offset = 3;
310
+ bool distinct = 4;
311
+ string union_mode = 5;
312
+ uint32 union_part_count = 6;
313
+ }
314
+
315
+ message ExplainCalibrationEntry {
316
+ uint32 idx = 1;
317
+ double est_rows = 2;
318
+ double actual_rows = 3;
319
+ }
320
+
321
+ message ExplainCalibration {
322
+ double mape = 1;
323
+ repeated ExplainCalibrationEntry entries = 2;
324
+ }
325
+
326
+ message ExplainPayload {
327
+ string schema = 1;
328
+ repeated ExplainOp ops = 2;
329
+ ExplainTotals totals = 3;
330
+ ExplainProperties properties = 4;
331
+ ExplainCalibration calibration = 5;
332
+ uint32 profile_version = 6;
333
+ }
334
+
335
+ message ProfileOp {
336
+ string op = 1;
337
+ string phase = 2;
338
+ uint32 id = 3;
339
+ uint32 op_index = 4;
340
+ uint64 input_rows = 5;
341
+ uint64 rows = 6;
342
+ uint64 time_ns = 7;
343
+ uint64 cpu_time_ns = 8;
344
+ uint64 bytes_out = 9;
345
+ uint64 bytes_alloc = 10;
346
+ uint64 estimate_bytes = 11;
347
+ uint64 estimate_vs_actual = 12;
348
+ uint64 percent_peak = 13;
349
+ uint64 percent_net = 14;
350
+ uint64 cumulative_time_ns = 15;
351
+ uint64 freed_bytes = 16;
352
+ uint64 net_after_op = 17;
353
+ uint64 error_bytes = 18;
354
+ uint64 error_abs_pct = 19;
355
+ string index_name = 20;
356
+ double selectivity_est = 21;
357
+ }
358
+
359
+ message ProfilePeakContributor {
360
+ string op = 1;
361
+ uint64 bytes_alloc = 2;
362
+ }
363
+
364
+ message ProfileTotals {
365
+ uint64 time_ns = 1;
366
+ uint64 peak_bytes = 2;
367
+ }
368
+
369
+ message ProfileSpills {
370
+ uint64 sort_spills = 1;
371
+ uint64 distinct_spills = 2;
372
+ uint64 union_spills = 3;
373
+ string spill_reason = 4;
374
+ uint64 peak_bytes_at_spill = 5;
375
+ uint32 first_spill_op_index = 6;
376
+ }
377
+
378
+ message ProfileMemory {
379
+ uint64 net_bytes = 1;
380
+ uint64 peak_bytes = 2;
381
+ uint64 total_alloc_bytes = 3;
382
+ }
383
+
384
+ message ProfilePlannerEstimates {
385
+ uint64 sum_estimate_bytes = 1;
386
+ uint64 sum_actual_bytes = 2;
387
+ uint32 count_estimated_ops = 3;
388
+ double min_error_abs_pct = 4;
389
+ double max_error_abs_pct = 5;
390
+ double mean_error_abs_pct = 6;
391
+ double median_error_abs_pct = 7;
392
+ double stddev_error_abs_pct = 8;
393
+ double adjusted_estimate_factor = 9;
394
+ }
395
+
396
+ message ProfileMemCurvePoint {
397
+ uint32 op_index = 1;
398
+ uint64 net_after_op = 2;
399
+ }
400
+
401
+ message ProfileSetOp {
402
+ string type = 1;
403
+ string mode = 2;
404
+ uint64 input_rows = 3;
405
+ uint64 output_rows = 4;
406
+ uint64 hash_dedup_size = 5;
407
+ uint64 distinct_fill_pct = 6;
408
+ }
409
+
410
+ message ProfilePayload {
411
+ uint32 profile_version = 1;
412
+ repeated ProfileOp ops = 2;
413
+ repeated ProfilePeakContributor peak_contributors = 3;
414
+ ProfileTotals totals = 4;
415
+ uint64 total_time_ns = 5;
416
+ ProfileSpills spills = 6;
417
+ ProfileMemory memory = 7;
418
+ ProfilePlannerEstimates planner_estimates = 8;
419
+ repeated ProfileMemCurvePoint mem_curve = 9;
420
+ ProfileSetOp setop = 10;
421
+ uint64 hashagg_spills = 11;
422
+ string hashagg_spill_reason = 12;
423
+ uint64 committed_txns = 13;
424
+ uint64 graph_store_nodes = 14;
425
+ uint64 graph_store_edges = 15;
426
+ bool graph_store_dirty = 16;
427
+ repeated string flagger_findings = 17;
428
+ bool compact = 18;
429
+ }
430
+
431
+ message Heartbeat {}
432
+
433
+ // ============================================================================
434
+ // Utilities (PING)
435
+ // ============================================================================
436
+ message PingRequest {}
437
+ message PingResponse {
438
+ bool ok = 1;
439
+ }
440
+
441
+ // ============================================================================
442
+ // Transactions
443
+ // ============================================================================
444
+ message BeginRequest {
445
+ bool read_only = 1;
446
+ string session_id = 2; // Required for gRPC; ignored for QUIC
447
+ }
448
+ message BeginResponse {
449
+ string session_id = 1;
450
+ string tx_id = 2;
451
+ }
452
+ message CommitRequest {
453
+ string session_id = 1; // Required for gRPC; ignored for QUIC
454
+ }
455
+ message CommitResponse {
456
+ bool success = 1;
457
+ }
458
+ message RollbackRequest {
459
+ string session_id = 1; // Required for gRPC; ignored for QUIC
460
+ }
461
+ message RollbackResponse {
462
+ bool success = 1;
463
+ }
464
+ message SavepointRequest {
465
+ string name = 1;
466
+ string session_id = 2; // Required for gRPC; ignored for QUIC
467
+ }
468
+ message SavepointResponse {
469
+ bool success = 1;
470
+ }
471
+ message RollbackToRequest {
472
+ string name = 1;
473
+ string session_id = 2; // Required for gRPC; ignored for QUIC
474
+ }
475
+ message RollbackToResponse {
476
+ bool success = 1;
477
+ }
478
+
479
+ // ============================================================================
480
+ // CDC
481
+ // ============================================================================
482
+ message CdcDiagnosticsRequest {}
483
+ message CdcDiagnosticsConfig {
484
+ bool enabled = 1;
485
+ uint64 malformed_snapshot_interval = 2;
486
+ uint32 malformed_hash_retain = 3;
487
+ double malformed_warn_pct = 4;
488
+ double malformed_abort_pct = 5;
489
+ uint32 flush_interval_ms = 6;
490
+ uint32 batch_size = 7;
491
+ uint64 pending_backpressure_watermark = 8;
492
+ }
493
+
494
+ message CdcDiagnosticsEngine {
495
+ bool is_running = 1;
496
+ int64 last_flush_ms = 2;
497
+ uint64 peak_buffer = 3;
498
+ uint64 current_buffer = 4;
499
+ uint32 dynamic_batch_size = 5;
500
+ uint32 batch_adjustments = 6;
501
+ }
502
+
503
+ message CdcMalformedSnapshot {
504
+ uint64 count = 1;
505
+ int64 ts_ms = 2;
506
+ }
507
+
508
+ message CdcMalformedHash {
509
+ uint64 count = 1;
510
+ uint64 hash = 2;
511
+ int64 ts_ms = 3;
512
+ string prefix_hex = 4;
513
+ }
514
+
515
+ message CdcDiagnosticsResponse {
516
+ uint64 malformed_change_records = 1;
517
+ uint64 total_change_attempts = 2;
518
+ double malformed_ratio = 3;
519
+ bool guardrail_warn_triggered = 4;
520
+ bool guardrail_abort_triggered = 5;
521
+ int64 first_warn_ts_ms = 6;
522
+ int64 first_abort_ts_ms = 7;
523
+ uint64 guardrail_epoch = 8;
524
+ int64 uptime_ms = 9;
525
+ bool backpressure = 10;
526
+ CdcDiagnosticsConfig config = 11;
527
+ CdcDiagnosticsEngine engine = 12;
528
+ repeated CdcMalformedSnapshot malformed_snapshots = 13;
529
+ repeated CdcMalformedHash malformed_hashes = 14;
530
+ string version = 15;
531
+ int64 timestamp_ms = 16;
532
+ }
533
+ message CdcControlRequest {
534
+ string action = 1;
535
+ }
536
+ message CdcControlResponse {
537
+ bool success = 1;
538
+ string status = 2;
539
+ uint64 guardrail_epoch = 3;
540
+ }
541
+
542
+ // ============================================================================
543
+ // Backup / Restore
544
+ // ============================================================================
545
+ message BackupRequest {
546
+ string backup_type = 1; // "full"
547
+ bool compress = 3;
548
+ }
549
+ message BackupResponse {
550
+ bool success = 1;
551
+ string message = 2;
552
+ string backup_id = 3;
553
+ string backup_type = 4;
554
+ uint64 size_bytes = 5;
555
+ string compression = 6;
556
+ string checksum = 7;
557
+ }
558
+ message RestoreRequest {
559
+ string target_time = 1;
560
+ bool confirm = 2;
561
+ }
562
+ message RestoreResponse {
563
+ bool success = 1;
564
+ string message = 2;
565
+ string restore_dir = 3;
566
+ string target_time = 4;
567
+ uint64 restore_timestamp = 5;
568
+ }
569
+ message UploadBackupRequest {
570
+ uint64 size_bytes = 1;
571
+ string checksum = 2;
572
+ }
573
+ message UploadBackupResponse {
574
+ bool success = 1;
575
+ string message = 2;
576
+ string upload_path = 3;
577
+ }