import { PlatformError } from '../../../common/src/errors'; import { ProviderType } from '../../../common/src/api/provider'; /** * Error thrown when attempting to use a provider that is not registered. * @example * ```typescript * throw new ProviderNotRegisteredError('dock', 'my-dock-id'); * // Error: Dock Provider. Dock Provider with id my-dock-id is not currently registered. * ``` */ export declare class ProviderNotRegisteredError extends PlatformError { constructor(providerType: ProviderType, id?: string); } /** * Error thrown when attempting to register a provider that is already registered. * Call `deregister` before registering again. * @example * ```typescript * throw new ProviderAlreadyRegisteredError('home', 'my-home-id'); * // Error: Home Provider. Home Provider with id my-home-id is already registered. * ``` */ export declare class ProviderAlreadyRegisteredError extends PlatformError { constructor(providerType: ProviderType, id?: string); } /** * Error thrown when failing to retrieve a provider by ID. * Typically thrown by `getProviderOrFail` when the requested provider does not exist. * @example * ```typescript * throw new FailedToGetProviderError('storefront', 'unknown-id'); * // Error: Failed to get Storefront Provider. Storefront Provider with id unknown-id is not currently registered. * ``` */ export declare class FailedToGetProviderError extends PlatformError { constructor(providerType: ProviderType, id?: string); } /** * Utility class for managing providers. */ export declare class ProvidersMap { private readonly providersMap; private readonly providerType; constructor(providerType: ProviderType); /** * Asserts that a provider is not already registered. * @param provider The provider to check. * @throws ProviderAlreadyRegisteredError if the provider already exists. */ assertNotAlreadyRegistered(id: string): void; /** * Asserts that a provider is registered. * @param provider The provider to check. * @throws ProviderAlreadyRegisteredError if the provider already exists. */ assertRegistered(id: string): void; /** * Gets a provider by id. * @param id The id of the provider to get. * @returns The provider if it exists, otherwise undefined. */ getProvider(id: string): T | undefined; /** * Checks if a provider exists. * @param id The id of the provider to check. * @returns True if the provider exists, otherwise false. */ hasProvider(id: string): boolean; /** * Sets a provider. * @param provider The provider to set. */ setProvider(provider: T): void; /** * Deletes a provider. * @param id The id of the provider to delete. */ deleteProvider(id: string): void; /** * Gets a provider by id or throws an error if it does not exist. * @param id The id of the provider to get. * @returns The provider if it exists. * @throws An error if the provider does not exist. * @see {@link ProviderNotRegisteredError} */ getProviderOrFail(id: string): T; clearProviders(): void; }