@ultipa-graph/ultipa-driver 6.0.13 → 6.0.15

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/client.d.ts CHANGED
@@ -6,7 +6,7 @@ import { GqldbConfig } from './config';
6
6
  import { Response, InsertNodesResult, InsertEdgesResult, DeleteResult, ExportNodesResult, ExportEdgesResult, ExportConfig, ExportChunk } from './response';
7
7
  import { Session } from './session';
8
8
  import { Transaction } from './transaction';
9
- import { GraphInfo, GraphType, HealthStatus, CacheStats, CacheType, Statistics, CompactResult, ComputeTopologyResult, SystemMetrics, NodeData, EdgeData, BulkCreateNodesOptions, BulkCreateEdgesOptions, BulkImportOptions, BulkImportSession, CheckpointResult, EndBulkImportResult, AbortBulkImportResult, BulkImportStatus, TransactionInfo, DBType, InsertType, LabelInfo, NodeTypeInfo, EdgeTypeInfo, ConvPropertyDef, IndexProperty, IndexInfo, FulltextInfo, TaskInfo, ProcessInfo, GraphStats, AlgoInfo, AiReadResult } from './types';
9
+ import { GraphInfo, GraphType, HealthStatus, CacheStats, CacheType, Statistics, CompactResult, ComputeTopologyResult, SystemMetrics, NodeData, EdgeData, BulkCreateNodesOptions, BulkCreateEdgesOptions, BulkImportOptions, BulkImportSession, CheckpointResult, EndBulkImportResult, AbortBulkImportResult, BulkImportStatus, TransactionInfo, TransactionRow, DBType, InsertType, LabelInfo, NodeTypeInfo, EdgeTypeInfo, ConvPropertyDef, IndexProperty, IndexInfo, FulltextInfo, TaskInfo, ProcessInfo, GraphStats, AlgoInfo, AiReadResult } from './types';
10
10
  /** Configuration for a query */
11
11
  export interface QueryConfig {
12
12
  graphName?: string;
@@ -63,6 +63,13 @@ export declare class GqldbClient {
63
63
  private bulkImportService;
64
64
  /** Get session metadata for authenticated requests */
65
65
  private getSessionMetadata;
66
+ /**
67
+ * Stable per-client logical session id surfaced under the
68
+ * transaction-branch model. See TRANSACTIONS_DRIVER_GUIDE.md §2.0–2.1.
69
+ * Falls back to a UUID v4 hex generated at construction when
70
+ * `config.sessionId` is not set.
71
+ */
72
+ readonly clientSessionId: string;
66
73
  constructor(config: GqldbConfig);
67
74
  /** Close the client and all connections */
68
75
  close(): Promise<void>;
@@ -106,6 +113,28 @@ export declare class GqldbClient {
106
113
  listTransactions(): Promise<TransactionInfo[]>;
107
114
  /** Execute a function within a transaction */
108
115
  withTransaction<T>(graphName: string, fn: (txId: number) => Promise<T>, readOnly?: boolean): Promise<T>;
116
+ /**
117
+ * Return active transactions via the GQL admin DDL `SHOW TRANSACTIONS`.
118
+ * Each row mirrors the 5-column server-side schema:
119
+ * `transactionId / status / readOnly / startTime / sessionId`.
120
+ * `sessionId` is `''` unless the server has auto-derived one from peer
121
+ * info or the driver explicitly surfaces `x-ultipa-session-id` metadata.
122
+ *
123
+ * Distinct from `listTransactions()` which uses the legacy gRPC.
124
+ */
125
+ showTransactions(): Promise<TransactionRow[]>;
126
+ /**
127
+ * Roll back a single transaction by id via `KILL TRANSACTION '<id>'`.
128
+ * `transactionId` here is the **string** id surfaced by
129
+ * `showTransactions()` (e.g. `'tx_a396c531-...'`), distinct from the
130
+ * `number` id returned by `begin()`.
131
+ */
132
+ killTransaction(transactionId: string): Promise<Response>;
133
+ /**
134
+ * Roll back every active transaction via `RESET TRANSACTIONS`. Admin-only.
135
+ * Intended as an escape hatch when an orphan tx blocks new BEGINs.
136
+ */
137
+ resetTransactions(): Promise<Response>;
109
138
  /** Insert multiple nodes into a graph using gRPC bulk insert */
110
139
  insertNodesBatchAuto(graphName: string, nodes: NodeData[], config?: InsertNodesConfig): Promise<InsertNodesResult>;
111
140
  /** Insert multiple edges into a graph using gRPC bulk insert */
@@ -347,27 +376,44 @@ export declare class GqldbClient {
347
376
  /** Stop a running task by ID */
348
377
  stopTask(taskId: string, config?: QueryConfig): Promise<Response>;
349
378
  /**
350
- * Insert nodes using GQL INSERT syntax with RETURN clause.
351
- * GQL: INSERT (n0:Label {p1: v1}), (n1:Label {p2: v2}) RETURN n0, n1
352
- * When config.insertType is InsertType.Overwrite, uses INSERT OVERWRITE syntax.
353
- * If NodeData.id is set (non-empty), includes it as _id property in the GQL.
354
- * Returns the raw Response containing the inserted nodes in columns n0, n1, etc.
379
+ * Insert nodes backward-compatible overloaded entry point.
380
+ *
381
+ * Two call shapes are accepted; the runtime dispatches on the first
382
+ * argument's type:
355
383
  *
356
- * @param nodes Nodes to insert.
357
- * @param config Optional InsertConfig. Supports per-call graphName and insertType.
384
+ * 1. `insertNodes(graphName: string, nodes, config?)` original
385
+ * 6.0.0 signature, routes through the bulk-import gRPC path
386
+ * (`DataService.InsertNodes`). Returns `InsertNodesResult` with
387
+ * gRPC-level metadata. Preserves source compatibility for
388
+ * callers written against 6.0.0 (e.g. gqldb-manager).
389
+ *
390
+ * 2. `insertNodes(nodes, config?)` — convenience GQL emitter (added
391
+ * after 6.0.0). Synthesizes
392
+ * `INSERT (n0:Label {...}), (n1:Label {...}) RETURN n0, n1`,
393
+ * with `INSERT OVERWRITE` when `config.insertType` is
394
+ * `InsertType.Overwrite`. Returns the raw `Response`.
395
+ * `NodeData.id`, when set, is emitted as the `_id` property.
358
396
  */
397
+ insertNodes(graphName: string, nodes: NodeData[], config?: InsertNodesConfig): Promise<InsertNodesResult>;
359
398
  insertNodes(nodes: NodeData[], config?: InsertConfig): Promise<Response>;
360
399
  /**
361
- * Insert edges using GQL INSERT syntax with RETURN clause.
362
- * Each edge is inserted individually using MATCH + INSERT to resolve node IDs.
363
- * GQL: MATCH (src WHERE id(src) = 'from'), (dst WHERE id(dst) = 'to')
364
- * INSERT (src)-[e0:Label {p1: v1}]->(dst) RETURN e0
365
- * When config.insertType is InsertType.Overwrite, uses INSERT OVERWRITE syntax.
366
- * Returns a merged Response containing all inserted edges in columns e0, e1, etc.
400
+ * Insert edges backward-compatible overloaded entry point.
401
+ *
402
+ * Two call shapes are accepted; the runtime dispatches on the first
403
+ * argument's type:
404
+ *
405
+ * 1. `insertEdges(graphName: string, edges, config?)` original
406
+ * 6.0.0 signature, routes through the bulk-import gRPC path
407
+ * (`DataService.InsertEdges`). Returns `InsertEdgesResult` with
408
+ * gRPC-level metadata. Preserves source compatibility for
409
+ * 6.0.0 callers.
367
410
  *
368
- * @param edges Edges to insert.
369
- * @param config Optional InsertConfig. Supports per-call graphName and insertType.
411
+ * 2. `insertEdges(edges, config?)` convenience GQL emitter
412
+ * (added after 6.0.0). Per edge synthesizes
413
+ * `MATCH (src WHERE id(src) = 'from'), (dst WHERE id(dst) = 'to') INSERT (src)-[e0:Label {...}]->(dst) RETURN e0`.
414
+ * Returns a merged `Response` with columns `e0, e1, ...`.
370
415
  */
416
+ insertEdges(graphName: string, edges: EdgeData[], config?: InsertEdgesConfig): Promise<InsertEdgesResult>;
371
417
  insertEdges(edges: EdgeData[], config?: InsertConfig): Promise<Response>;
372
418
  /** Return currently running processes (queries) */
373
419
  top(config?: QueryConfig): Promise<ProcessInfo[]>;