import { type Anvil, type CreateAnvilOptions } from "../anvil/createAnvil.js"; /** * A pool of anvil instances. */ export type Pool = { /** * The number of instances in the pool. */ readonly size: number; /** * Returns an iterator of all instances in the pool. */ instances: () => IterableIterator<[TKey, Promise]>; /** * Returns true if the pool contains an instance with the given id. * * @param id The id of the instance. * @returns True if the pool contains an instance with the given id. */ has: (id: TKey) => boolean; /** * Returns the instance with the given id or undefined if it doesn't exist. * * @param id The id of the instance. * @returns The instance with the given id or undefined if it doesn't exist. */ get: (id: TKey) => Promise | undefined; /** * Starts an instance with the given id. * * @param id The id of the instance. * @param options The options to pass to the instance. * @returns A promise that resolves to the instance. * @throws If an instance with the given id already exists. * @throws If the instance limit has been reached. */ start: (id: TKey, options?: CreateAnvilOptions) => Promise; /** * Stops the instance with the given id. * * @param id The id of the instance. * @returns A promise that resolves when the instance has stopped. * @throws If the instance didn't stop gracefully. */ stop: (id: TKey) => Promise; /** * Stops all instances in the pool. * * @returns A promise that resolves when all instances have stopped. * @throws If any instance didn't stop gracefully. */ empty: () => Promise; }; export type CreatePoolOptions = { /** * Limits the number of instances that can be created. */ instanceLimit?: number | undefined; /** * Automatically find a free port if none was given. * * @defaultValue true */ autoPort?: boolean | undefined; }; /** * Creates pool of anvil instances. */ export declare function createPool({ instanceLimit, autoPort, }?: CreatePoolOptions): Pool; //# sourceMappingURL=createPool.d.ts.map