UNPKG

@ultipa-graph/ultipa-driver

Version:

NodeJS SDK for Ultipa GQL

47 lines (46 loc) 1.49 kB
/** * Session management for GQLDB Node.js driver. */ /** Represents an authenticated session */ export interface Session { id: number; serverVersion: string; roles: string[]; defaultGraph: string; createdAt: number; lastActivity: number; isCluster?: boolean; clusterId?: string; partitionCount?: number; } /** Manages sessions for the client */ export declare class SessionManager { private session; private _defaultGraph; /** Create a new session */ login(sessionId: number, serverVersion: string, roles: string[], defaultGraph: string, clusterInfo?: { isCluster?: boolean; clusterId?: string; partitionCount?: number; }): Session; /** Clear the current session */ logout(): void; /** Get the current session */ getSession(): Session | null; /** Get the current session ID */ getSessionId(): number; /** Check if there is an active session */ isLoggedIn(): boolean; /** Update the last activity time */ updateActivity(): void; /** Set the default graph for the session */ setDefaultGraph(graph: string): void; /** Get the default graph for the session */ getDefaultGraph(): string; /** Check if the session has a specific role */ hasRole(role: string): boolean; /** Get how long the session has been idle in milliseconds */ idleDuration(): number; /** Get how long the session has been active in milliseconds */ age(): number; }