@geodedb/client 1.0.0-alpha.25 → 1.0.2
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 +64 -2
- package/dist/index.js +249 -73
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/proto/geode.proto +3 -0
package/dist/index.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ interface GeodeConfig {
|
|
|
77
77
|
inlineTimeout?: number;
|
|
78
78
|
/** Enable TLS for gRPC (default: true) */
|
|
79
79
|
tls?: boolean;
|
|
80
|
+
/** Graph name for DSN graph binding. When set, the server binds the session to this graph. */
|
|
81
|
+
graph?: string;
|
|
80
82
|
}
|
|
81
83
|
/**
|
|
82
84
|
* Connection pool configuration.
|
|
@@ -317,12 +319,15 @@ interface HelloRequest {
|
|
|
317
319
|
clientName: string;
|
|
318
320
|
clientVersion: string;
|
|
319
321
|
wantedConformance: string;
|
|
322
|
+
graph?: string;
|
|
320
323
|
}
|
|
321
324
|
interface HelloResponse {
|
|
322
325
|
success: boolean;
|
|
323
326
|
sessionId: string;
|
|
324
327
|
errorMessage: string;
|
|
325
328
|
capabilities: string[];
|
|
329
|
+
passwordResetRequired?: boolean;
|
|
330
|
+
graph?: string;
|
|
326
331
|
}
|
|
327
332
|
interface Param {
|
|
328
333
|
name: string;
|
|
@@ -605,7 +610,7 @@ declare function decodeLengthPrefix(data: Buffer): number;
|
|
|
605
610
|
/**
|
|
606
611
|
* Build a HelloRequest message.
|
|
607
612
|
*/
|
|
608
|
-
declare function buildHelloRequest(username: string, password: string, clientName: string, clientVersion: string, conformance: string, tenantId?: string): QuicClientMessage;
|
|
613
|
+
declare function buildHelloRequest(username: string, password: string, clientName: string, clientVersion: string, conformance: string, tenantId?: string, graph?: string): QuicClientMessage;
|
|
609
614
|
/**
|
|
610
615
|
* Build an ExecuteRequest message.
|
|
611
616
|
*/
|
|
@@ -703,6 +708,7 @@ declare class QuicTransport extends BaseTransport {
|
|
|
703
708
|
private _maxMessageSize;
|
|
704
709
|
private _maxBufferBytes;
|
|
705
710
|
private _pendingProtoReads;
|
|
711
|
+
private _pendingResponses;
|
|
706
712
|
constructor(address: string, maxMessageSize?: number, maxBufferBytes?: number);
|
|
707
713
|
/**
|
|
708
714
|
* Connect to the Geode server using QUIC.
|
|
@@ -1129,10 +1135,18 @@ declare class Transaction {
|
|
|
1129
1135
|
exec(query: string, options?: QueryOptions): Promise<void>;
|
|
1130
1136
|
/**
|
|
1131
1137
|
* Create a savepoint.
|
|
1138
|
+
*
|
|
1139
|
+
* Savepoints are only supported over the QUIC transport. Over gRPC this
|
|
1140
|
+
* rejects with a {@link DriverError} (statusClass `58000`) directing callers
|
|
1141
|
+
* to use `quic://`.
|
|
1132
1142
|
*/
|
|
1133
1143
|
savepoint(name: string, signal?: AbortSignal): Promise<void>;
|
|
1134
1144
|
/**
|
|
1135
1145
|
* Rollback to a savepoint.
|
|
1146
|
+
*
|
|
1147
|
+
* Savepoints are only supported over the QUIC transport. Over gRPC this
|
|
1148
|
+
* rejects with a {@link DriverError} (statusClass `58000`) directing callers
|
|
1149
|
+
* to use `quic://`.
|
|
1136
1150
|
*/
|
|
1137
1151
|
rollbackTo(name: string, signal?: AbortSignal): Promise<void>;
|
|
1138
1152
|
/**
|
|
@@ -1630,6 +1644,8 @@ declare class Connection {
|
|
|
1630
1644
|
}>;
|
|
1631
1645
|
/** Try to receive an inline response with short timeout. */
|
|
1632
1646
|
private _tryReceiveInline;
|
|
1647
|
+
/** Read inline execute responses until a page, error, heartbeat, or timeout arrives. */
|
|
1648
|
+
private _readInlineExecute;
|
|
1633
1649
|
/** Drain remaining data pages until final=true to prevent query corruption (QUAL-T7). */
|
|
1634
1650
|
private _drainRemainingPages;
|
|
1635
1651
|
/** @internal Release the active result, returning the connection to idle. */
|
|
@@ -1666,6 +1682,7 @@ declare class Connection {
|
|
|
1666
1682
|
private _receiveWithTimeout;
|
|
1667
1683
|
/** Create a combined abort signal from requestTimeout and optional caller signal (CWE-703). */
|
|
1668
1684
|
private _withRequestTimeout;
|
|
1685
|
+
private _closeOnTransportError;
|
|
1669
1686
|
}
|
|
1670
1687
|
|
|
1671
1688
|
/**
|
|
@@ -2204,6 +2221,7 @@ interface RateLimiterConfig {
|
|
|
2204
2221
|
declare class ConnectionPool {
|
|
2205
2222
|
private _config;
|
|
2206
2223
|
private _connections;
|
|
2224
|
+
private _pendingConnections;
|
|
2207
2225
|
private _waitQueue;
|
|
2208
2226
|
private _closed;
|
|
2209
2227
|
private _maintenanceInterval?;
|
|
@@ -2274,12 +2292,56 @@ declare class ConnectionPool {
|
|
|
2274
2292
|
* Remove a connection from the pool.
|
|
2275
2293
|
*/
|
|
2276
2294
|
private removeConnection;
|
|
2295
|
+
private fulfillWaiters;
|
|
2277
2296
|
/**
|
|
2278
2297
|
* Perform pool maintenance.
|
|
2279
2298
|
*/
|
|
2280
2299
|
private maintenance;
|
|
2281
2300
|
}
|
|
2282
2301
|
|
|
2302
|
+
/**
|
|
2303
|
+
* Client-level retry wrapper for transient errors.
|
|
2304
|
+
*
|
|
2305
|
+
* Mirrors the Go reference client's `RetryPolicy`/`Retry` (see
|
|
2306
|
+
* `geode-client-go/retry.go`): retries only when {@link isRetryableError}
|
|
2307
|
+
* returns true, with exponential backoff capped at `maxBackoffMs`.
|
|
2308
|
+
*/
|
|
2309
|
+
/**
|
|
2310
|
+
* Configures retry behavior for transient errors.
|
|
2311
|
+
*/
|
|
2312
|
+
interface RetryPolicy {
|
|
2313
|
+
/**
|
|
2314
|
+
* Maximum number of attempts including the initial call.
|
|
2315
|
+
* Values less than 1 are treated as 1.
|
|
2316
|
+
*/
|
|
2317
|
+
maxAttempts: number;
|
|
2318
|
+
/** Delay in milliseconds before the first retry. */
|
|
2319
|
+
initialBackoffMs: number;
|
|
2320
|
+
/**
|
|
2321
|
+
* Maximum backoff in milliseconds. The exponential backoff is clamped to
|
|
2322
|
+
* this value.
|
|
2323
|
+
*/
|
|
2324
|
+
maxBackoffMs: number;
|
|
2325
|
+
/** Exponential backoff multiplier applied on each retry. */
|
|
2326
|
+
multiplier: number;
|
|
2327
|
+
}
|
|
2328
|
+
/**
|
|
2329
|
+
* Returns a {@link RetryPolicy} with sensible defaults:
|
|
2330
|
+
* 3 max attempts, 1000ms initial backoff, 30000ms max backoff, 2.0 multiplier.
|
|
2331
|
+
*/
|
|
2332
|
+
declare function defaultRetryPolicy(): RetryPolicy;
|
|
2333
|
+
/**
|
|
2334
|
+
* Executes `fn` up to `policy.maxAttempts` times, retrying only when
|
|
2335
|
+
* {@link isRetryableError} returns true for the rejection reason. Non-retryable
|
|
2336
|
+
* errors and non-Geode errors are propagated immediately without further
|
|
2337
|
+
* attempts. Between attempts the wrapper waits using exponential backoff
|
|
2338
|
+
* clamped to `policy.maxBackoffMs`.
|
|
2339
|
+
*
|
|
2340
|
+
* @param fn The operation to run. Re-invoked on each retry.
|
|
2341
|
+
* @param policy Optional retry policy. Defaults to {@link defaultRetryPolicy}.
|
|
2342
|
+
*/
|
|
2343
|
+
declare function withRetry<T>(fn: () => Promise<T>, policy?: RetryPolicy): Promise<T>;
|
|
2344
|
+
|
|
2283
2345
|
/**
|
|
2284
2346
|
* gRPC Transport Layer
|
|
2285
2347
|
*
|
|
@@ -2820,4 +2882,4 @@ declare function node(): NodePatternBuilder;
|
|
|
2820
2882
|
*/
|
|
2821
2883
|
declare function edge(): EdgePatternBuilder;
|
|
2822
2884
|
|
|
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 };
|
|
2885
|
+
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 RetryPolicy, 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, defaultRetryPolicy, 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, withRetry, withTransaction };
|