pool.d.ts 1008 B

12345678910111213141516171819202122232425262728
  1. import Client from './client'
  2. import TPoolStats from './pool-stats'
  3. import { URL } from 'url'
  4. import Dispatcher from "./dispatcher";
  5. export default Pool
  6. declare class Pool extends Dispatcher {
  7. constructor(url: string | URL, options?: Pool.Options)
  8. /** `true` after `pool.close()` has been called. */
  9. closed: boolean;
  10. /** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
  11. destroyed: boolean;
  12. /** Aggregate stats for a Pool. */
  13. readonly stats: TPoolStats;
  14. }
  15. declare namespace Pool {
  16. export type PoolStats = TPoolStats;
  17. export interface Options extends Client.Options {
  18. /** Default: `(origin, opts) => new Client(origin, opts)`. */
  19. factory?(origin: URL, opts: object): Dispatcher;
  20. /** The max number of clients to create. `null` if no limit. Default `null`. */
  21. connections?: number | null;
  22. interceptors?: { Pool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options["interceptors"]
  23. }
  24. }