@ultipa-graph/ultipa-driver 6.2.3 → 6.2.5

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, 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, TransactionRow, DBType, InsertType, LabelInfo, NodeTypeInfo, EdgeTypeInfo, ConvPropertyDef, IndexProperty, IndexInfo, FulltextInfo, TaskInfo, ProcessInfo, GraphStats, AlgoInfo, AiReadResult } from './types';
9
+ import { GraphInfo, GraphType, EdgeIdMode, 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;
@@ -72,6 +72,10 @@ export declare class GqldbClient {
72
72
  private storedUsername;
73
73
  private storedPassword;
74
74
  private storedGraph;
75
+ private grpcHost;
76
+ private grpcCredentials;
77
+ private grpcChannelOptions;
78
+ private ctx;
75
79
  private sessionService;
76
80
  private queryService;
77
81
  private graphService;
@@ -95,9 +99,21 @@ export declare class GqldbClient {
95
99
  /** Authenticate the user and create a session */
96
100
  login(username: string, password: string): Promise<Session>;
97
101
  /**
98
- * Execute fn and auto-reconnect on UNAUTHENTICATED error.
99
- * If fn throws an UNAUTHENTICATED gRPC error and credentials are stored,
100
- * re-login and retry fn once.
102
+ * Rebuild every gRPC client used by this connection so the next call
103
+ * gets a fresh channel. Called by withAutoReconnect when a call
104
+ * fails with UNAVAILABLE / connection reset. Does NOT close old
105
+ * clients synchronously — in-flight calls hold them alive and gRPC
106
+ * closes them once those calls complete.
107
+ */
108
+ private forceReconnectAll;
109
+ /**
110
+ * Execute fn with two recovery behaviours:
111
+ * - UNAUTHENTICATED — if stored credentials are available, re-login
112
+ * and retry fn once.
113
+ * - UNAVAILABLE / connection reset — rebuild every gRPC client so
114
+ * the NEXT call gets a fresh channel. The current call is NOT
115
+ * retried; caller decides (write-side calls are often not
116
+ * idempotent).
101
117
  */
102
118
  private withAutoReconnect;
103
119
  /** Terminate the current session */
@@ -112,8 +128,15 @@ export declare class GqldbClient {
112
128
  explain(query: string, config?: QueryConfig): Promise<string>;
113
129
  /** Execute a query with profiling and return statistics */
114
130
  profile(query: string, config?: QueryConfig): Promise<string>;
115
- /** Create a new graph */
116
- createGraph(name: string, graphType?: GraphType, description?: string): Promise<void>;
131
+ /**
132
+ * Create a new graph.
133
+ *
134
+ * When `edgeId` is provided, the driver issues a follow-up
135
+ * `ALTER GRAPH <name> SET EDGE_ID ENABLED|DISABLED` via GQL after the
136
+ * gRPC create call. When `edgeId` is undefined, behavior is unchanged
137
+ * and no ALTER statement is sent.
138
+ */
139
+ createGraph(name: string, graphType?: GraphType, description?: string, edgeId?: EdgeIdMode): Promise<void>;
117
140
  /** Delete a graph */
118
141
  dropGraph(name: string, ifExists?: boolean): Promise<void>;
119
142
  /** Set the current graph for the session */
@@ -160,7 +183,7 @@ export declare class GqldbClient {
160
183
  insertEdgesBatchAuto(graphName: string, edges: EdgeData[], config?: InsertEdgesConfig): Promise<InsertEdgesResult>;
161
184
  /**
162
185
  * Delete nodes by id list. Emits
163
- * `MATCH (n) WHERE id(n) IN [...] DETACH DELETE n RETURN n`.
186
+ * `MATCH (n) WHERE n._id IN [...] DETACH DELETE n RETURN n`.
164
187
  *
165
188
  * Empty/null `nodeIds` short-circuits without contacting the server.
166
189
  *
@@ -179,9 +202,11 @@ export declare class GqldbClient {
179
202
  */
180
203
  deleteNodesByCondition(labels: string[] | undefined, where: string | undefined, limit?: number, config?: DeleteConfig): Promise<Response>;
181
204
  /**
182
- * Delete edges by id list. Emits 5-column GQL with `id(e)` so the
183
- * same emit works on graphs with or without EDGE_ID enabled, then
205
+ * Delete edges by id list. Emits 5-column GQL keyed on `e._id`, then
184
206
  * reshapes the response into a single "e" column holding GqldbEdge.
207
+ * Requires EDGE_ID ENABLED: on a disabled graph the server returns
208
+ * `[5017]` guiding the caller to `ALTER GRAPH <g> SET EDGE_ID ENABLED`
209
+ * (deletion does NOT fall back to the discouraged `internal_id(e)`).
185
210
  */
186
211
  deleteEdgesByIds(edgeIds: string[], config?: DeleteConfig): Promise<Response>;
187
212
  /**
@@ -308,7 +333,7 @@ export declare class GqldbClient {
308
333
  * Create a graph if it does not already exist.
309
334
  * Returns true if the graph was created, false if it already existed.
310
335
  */
311
- createGraphIfNotExist(name: string, graphType?: GraphType, description?: string): Promise<boolean>;
336
+ createGraphIfNotExist(name: string, graphType?: GraphType, description?: string, edgeId?: EdgeIdMode): Promise<boolean>;
312
337
  /** Check whether a graph with the given name exists */
313
338
  hasGraph(name: string): Promise<boolean>;
314
339
  /** Rename a graph */
@@ -461,7 +486,7 @@ export declare class GqldbClient {
461
486
  *
462
487
  * 2. `insertEdges(edges, config?)` — convenience GQL emitter
463
488
  * (added after 6.0.0). Per edge synthesizes
464
- * `MATCH (src WHERE id(src) = 'from'), (dst WHERE id(dst) = 'to') INSERT (src)-[e0:Label {...}]->(dst) RETURN e0`.
489
+ * `MATCH (src WHERE src._id = 'from'), (dst WHERE dst._id = 'to') INSERT (src)-[e0:Label {...}]->(dst) RETURN e0`.
465
490
  * Returns a merged `Response` with columns `e0, e1, ...`.
466
491
  */
467
492
  insertEdges(graphName: string, edges: EdgeData[], config?: InsertEdgesConfig): Promise<InsertEdgesResult>;