/** * Instance management service. * * Aggregates instance management operations across multiple config sources. * * @module config/instance-manager */ import type { ConfigSource, InstanceInfo, CreateInstanceOptions, ResolveConfigOptions, NormalizedConfig } from './types.js'; /** * Service for managing B2C instances across multiple config sources. * * This class aggregates instance management operations from all sources * that implement the optional instance management methods. * * @example * ```typescript * import { InstanceManager, DwJsonSource } from '@salesforce/b2c-tooling-sdk/config'; * * const manager = new InstanceManager([new DwJsonSource()]); * * // List all instances * const instances = manager.listAllInstances(); * * // Create a new instance * manager.createInstance({ * name: 'staging', * config: { hostname: 'staging.example.com' }, * setActive: true, * }); * ``` */ export declare class InstanceManager { private readonly sources; constructor(sources: ConfigSource[]); /** * List instances from all sources that implement listInstances(). * * @param options - Resolution options * @returns Array of all instances from all sources */ listAllInstances(options?: ResolveConfigOptions): Promise; /** * Get sources that can create instances. * * @returns Array of sources with createInstance() method */ getInstanceSources(): ConfigSource[]; /** * Get sources that can store a specific credential field. * * @param field - The credential field to check * @returns Array of sources that can store the field */ getCredentialSources(field: keyof NormalizedConfig): ConfigSource[]; /** * Create an instance in the specified source (or default to first instance source). * * @param options - Instance creation options * @param targetSource - Source name to use (optional, defaults to first available) * @throws Error if no instance sources available or specified source not found */ createInstance(options: CreateInstanceOptions & ResolveConfigOptions, targetSource?: string): Promise; /** * Remove an instance from the source that contains it. * * @param name - Instance name to remove * @param options - Resolution options * @throws Error if instance not found in any source */ removeInstance(name: string, options?: ResolveConfigOptions): Promise; /** * Set an instance as active in the source that contains it. * * @param name - Instance name to set as active * @param options - Resolution options * @throws Error if instance not found in any source */ setActiveInstance(name: string, options?: ResolveConfigOptions): Promise; /** * Store a credential for an instance in the specified source. * * @param instanceName - Instance name * @param field - Config field to store * @param value - Value to store * @param targetSource - Source name to use (optional) * @param options - Resolution options * @throws Error if no credential sources support the field */ storeCredential(instanceName: string, field: keyof NormalizedConfig, value: string, targetSource?: string, options?: ResolveConfigOptions): Promise; } /** * Create an InstanceManager with the given sources. * * @param sources - Config sources to use * @returns InstanceManager instance */ export declare function createInstanceManager(sources: ConfigSource[]): InstanceManager;