import { ServiceNowInstance } from "../../sn/ServiceNowInstance.js"; import { ServiceNowRequest } from "./ServiceNowRequest.js"; /** * Singleton registry of authenticated ServiceNowRequest instances keyed by instance alias. * Ensures all components sharing the same alias reuse the same HTTP session. */ export declare class SessionManager { private static _instance; private _sessions; private _authPromises; private _logger; private constructor(); static getInstance(): SessionManager; /** @internal Visible for testing only — not exported from index.ts */ static resetInstance(): void; /** * Get or create a ServiceNowRequest for this instance. * Keyed by alias (falls back to host). */ getRequest(instance: ServiceNowInstance): ServiceNowRequest; /** * True when the cached request was built for exactly this instance. * * Answers "leave the cache alone" whenever identity cannot be established on * either side — a request built without an instance, or a caller passing a * duck-typed instance that predates getInstanceId(). Evicting on unknown * identity would throw away a good session and force a fresh login on every * single lookup, which is a worse failure than the one being guarded against. */ private isBoundTo; /** * Get or create a ServiceNowRequest and ensure it is authenticated. * Uses an in-flight promise guard to prevent duplicate concurrent auth calls. */ getAuthenticatedRequest(instance: ServiceNowInstance): Promise; /** * Remove cached session for a given alias. */ clearSession(alias: string): void; /** * Remove all cached sessions. */ clearAll(): void; /** * Check if a session exists for a given alias. */ hasSession(alias: string): boolean; private getKey; }