UNPKG

@ultipa-graph/ultipa-driver

Version:

NodeJS SDK for Ultipa GQL

63 lines (62 loc) 2.17 kB
/** * Shared context for all service classes. * Contains gRPC clients, managers, and configuration. */ import * as grpc from '@grpc/grpc-js'; import { GqldbConfig } from '../config'; import { SessionManager } from '../session'; import { TransactionManager } from '../transaction'; /** * Service client types for gRPC communication. */ export interface ServiceClients { sessionService: grpc.Client; queryService: grpc.Client; graphService: grpc.Client; transactionService: grpc.Client; dataService: grpc.Client; healthService: grpc.Client; adminService: grpc.Client; bulkImportService: grpc.Client; } /** * Service context holds shared dependencies for all service classes. */ export declare class ServiceContext { readonly config: GqldbConfig; readonly sessions: SessionManager; readonly txManager: TransactionManager; /** * Not readonly: the client rebuilds the underlying gRPC channels * on transport-level errors (UNAVAILABLE / connection reset) by * mutating this in place. See GqldbClient.forceReconnectAll. */ clients: ServiceClients; /** * Stable per-client logical session id sent as the * `x-ultipa-session-id` gRPC metadata header. Empty string omits the * header (legacy behavior). See TRANSACTIONS_DRIVER_GUIDE.md §2.1. */ readonly clientSessionId: string; constructor(config: GqldbConfig, sessions: SessionManager, txManager: TransactionManager, /** * Not readonly: the client rebuilds the underlying gRPC channels * on transport-level errors (UNAVAILABLE / connection reset) by * mutating this in place. See GqldbClient.forceReconnectAll. */ clients: ServiceClients, /** * Stable per-client logical session id sent as the * `x-ultipa-session-id` gRPC metadata header. Empty string omits the * header (legacy behavior). See TRANSACTIONS_DRIVER_GUIDE.md §2.1. */ clientSessionId?: string); /** * Get session metadata for authenticated requests. */ getSessionMetadata(): grpc.Metadata; /** * Update session activity timestamp. */ updateActivity(): void; }