diff --git a/index.d.ts b/index.d.ts index 328664ea4..8a6112c99 100644 --- a/index.d.ts +++ b/index.d.ts @@ -45,6 +45,7 @@ import Transport, { RequestBody, RequestNDBody, Context, + MemoryCircuitBreakerOptions, } from './lib/Transport'; import { URL } from 'url'; import Connection, { AgentOptions, agentFn } from './lib/Connection'; @@ -137,10 +138,7 @@ interface ClientOptions { password?: string; }; disablePrototypePoisoningProtection?: boolean | 'proto' | 'constructor'; - memoryCircuitBreaker?: { - enabled: boolean; - maxPercentage: number; - }; + memoryCircuitBreaker?: MemoryCircuitBreakerOptions } declare class Client { diff --git a/lib/Transport.d.ts b/lib/Transport.d.ts index 026601b12..3b3c2f802 100644 --- a/lib/Transport.d.ts +++ b/lib/Transport.d.ts @@ -29,10 +29,10 @@ */ import { Readable as ReadableStream } from 'stream'; -import { ConnectionPool, CloudConnectionPool } from './pool'; import Connection from './Connection'; -import Serializer from './Serializer'; import * as errors from './errors'; +import { CloudConnectionPool, ConnectionPool } from './pool'; +import Serializer from './Serializer'; export type ApiError = | errors.ConfigurationError @@ -59,6 +59,11 @@ export interface generateRequestIdFn { (params: TransportRequestParams, options: TransportRequestOptions): any; } +export interface MemoryCircuitBreakerOptions { + enabled: boolean; + maxPercentage: number; +} + interface TransportOptions { emit: (event: string | symbol, ...args: any[]) => boolean; connectionPool: ConnectionPool | CloudConnectionPool; @@ -77,6 +82,7 @@ interface TransportOptions { generateRequestId?: generateRequestIdFn; name?: string; opaqueIdPrefix?: string; + memoryCircuitBreaker?: MemoryCircuitBreakerOptions; } export interface RequestEvent, TContext = Context> { @@ -172,6 +178,7 @@ export default class Transport { sniffInterval: number; sniffOnConnectionFault: boolean; opaqueIdPrefix: string | null; + memoryCircuitBreaker: MemoryCircuitBreakerOptions | undefined; sniffEndpoint: string; _sniffEnabled: boolean; _nextSniff: number;