@typescript-eda/domain
Version:
Core domain primitives for event-driven architecture
32 lines • 1.1 kB
TypeScript
/**
* @fileoverview This file defines the Ports class, a singleton for managing port implementations.
* @author rydnr
* @module domain/ports
*/
import { Port } from './port';
/**
* A singleton class for managing port implementations.
*/
export declare class Ports {
private static readonly ports;
/**
* Retrieves the implementation of a port.
* @template T The type of the port.
* @param {new (...args: unknown[]) => T} port The port to retrieve.
* @returns {T} The implementation of the port.
* @throws {Error} If the port is not found.
*/
static get<T extends Port>(port: new (...args: unknown[]) => T): T;
/**
* Sets the implementation of a port.
* @template T The type of the port.
* @param {new (...args: unknown[]) => T} port The port to set.
* @param {T} implementation The implementation of the port.
*/
static set<T extends Port>(port: new (...args: unknown[]) => T, implementation: T): void;
/**
* Clears all port implementations.
*/
static clear(): void;
}
//# sourceMappingURL=ports.d.ts.map