UNPKG

@fairmint/canton-node-sdk

Version:
39 lines 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ClientFactory = void 0; const errors_1 = require("./errors"); /** Factory for creating and managing API client instances */ class ClientFactory { /** * Register a client implementation for a specific API type */ static registerClient(apiType, clientClass) { this.clientRegistry.set(apiType, clientClass); } /** * Create a client for the specified API type */ static createClient(apiType, config) { const ClientClass = this.clientRegistry.get(apiType); if (!ClientClass) { throw new errors_1.ConfigurationError(`No client implementation registered for API type: ${apiType}. ` + `Available types: ${Array.from(this.clientRegistry.keys()).join(', ')}`); } return new ClientClass(config); } /** * Get all registered API types */ static getRegisteredApiTypes() { return Array.from(this.clientRegistry.keys()); } /** * Check if a client is registered for the given API type */ static hasClient(apiType) { return this.clientRegistry.has(apiType); } } exports.ClientFactory = ClientFactory; ClientFactory.clientRegistry = new Map(); //# sourceMappingURL=ClientFactory.js.map