/** * @name sap/sap-client-manager * @description Creates and manages the SAP SDK client (`SapClient`) as a singleton with * connection, wallet, and program ID configuration. * * @flow * 1. `SapClientManager.getInstance()` returns the singleton manager. * 2. `initialize(config)` creates a `SapClient` from the SDK, loading a wallet when needed. * 3. If config hasn't changed, the existing client is reused. * 4. `createSapClient`, `getSapClient`, and `isSapClientInitialized` are convenience wrappers. * * @module sap/sap-client-manager */ import type { SapMcpConfig, SapPolicyEngine } from '../../core/src/types.js'; import type { SapClient } from '@oobe-protocol-labs/synapse-sap-sdk'; /** * @name SapClientManager * @description Singleton manager for the SAP SDK client with config-aware reinitialization. * * @method getInstance — Returns the singleton `SapClientManager` instance. * @method initialize — Creates or reuses the `SapClient` based on config changes. * @method getClient — Returns the initialized client (throws if not initialized). * @method getClientOrNull — Returns the initialized client or `null`. * @method reset — Resets the client and config (for testing). * * @usedBy `createSapClient`, `getSapClient`, `isSapClientInitialized`, `create-server.ts` */ export declare class SapClientManager { private static instance; private client; private config; private constructor(); /** * @name SapClientManager.isSameClientConfig * @description Compares connection and wallet fields that affect SapClient construction. * * @param current — Current stored config. * @param next — New config to compare against. * @returns `true` if the relevant config fields match, `false` otherwise. * * @internal */ private isSameClientConfig; /** * @name SapClientManager.getInstance * @description Returns the singleton `SapClientManager` instance, creating it if necessary. * * @returns The singleton `SapClientManager`. * * @usedBy `createSapClient`, `getSapClient`, `isSapClientInitialized`. */ static getInstance(): SapClientManager; /** * @name SapClientManager.initialize * @description Initializes the SAP client from config, reusing the existing client if config hasn't changed. * * @param config — SAP MCP configuration with RPC URL, program ID, mode, and wallet path. * @returns The initialized `SapClient` instance. * @throws `SapClientError` if client creation fails. * * @usedBy `createSapClient`, `create-server.ts:createSapMcpServer`. */ initialize(config: SapMcpConfig, policyEngine?: SapPolicyEngine): Promise; /** * @name SapClientManager.getClient * @description Returns the initialized SAP client. * * @returns The `SapClient` instance. * @throws `SapClientError` if the client has not been initialized. * * @usedBy `getSapClient`. */ getClient(): SapClient; /** * @name SapClientManager.getClientOrNull * @description Returns the initialized SAP client or `null` if not yet initialized. * * @returns The `SapClient` instance or `null`. * * @usedBy `isSapClientInitialized`. */ getClientOrNull(): SapClient | null; /** * @name SapClientManager.reset * @description Resets the client and config to `null` (for testing purposes). * * @usedBy Test setup and teardown. */ reset(): void; } /** * @name createSapClient * @description Creates or reuses the SAP client from the given configuration. * * @param config — SAP MCP configuration. * @returns The initialized `SapClient` instance. * @throws `SapClientError` if initialization fails. * * @usedBy `create-server.ts:createSapMcpServer`. */ export declare function createSapClient(config: SapMcpConfig, policyEngine?: SapPolicyEngine): Promise; /** * @name getSapClient * @description Returns the currently initialized SAP client. * * @returns The `SapClient` instance. * @throws `SapClientError` if the client has not been initialized. * * @usedBy Tool handlers across the SAP MCP runtime. */ export declare function getSapClient(): SapClient; /** * @name isSapClientInitialized * @description Checks whether the SAP client has been initialized. * * @returns `true` if the client is initialized, `false` otherwise. * * @usedBy Health checks and startup validation. */ export declare function isSapClientInitialized(): boolean; //# sourceMappingURL=sap-client-manager.d.ts.map