import { Transport } from './transport' ; import WriteApi from './WriteApi' ; /**
 * Option for the communication with InfluxDB server.
 */ export interface ConnectionOptions { /** base URL */ url : string ; /** authentication token */ token ? : string ; defaultValue timeout ? : number ; /**
     * TransportOptions supply extra options for the transport layer, they differ between node.js and browser/deno.
     * Node.js transport accepts options specified in  https or
     *  https . For example, an `agent` property can be set to
     *  https ,  https * property can disable TLS server certificate verification. Additionally,
     *  https property can be also specified
     * in order to follow redirects in node.js.
     *  https is used under the hood in browser/deno.
     * For example,
     *  https property can be set to 'error' to abort request if a redirect occurs.
      transportOptions ? : { [ key ] : any ; } ; /**
     * Default HTTP headers to send with every request.
     */ headers ? : Record < string , string > ; /**
     * Full HTTP web proxy URL including schema, for example http://your-proxy:8080.
     */ proxyUrl ? : string ; } /** default connection options */ export const DEFAULT_ConnectionOptions = { timeout : 10000 , } ; /**
 * Options that configure strategy for retrying failed requests.
 */ export interface RetryDelayStrategyOptions { /** add `random(retryJitter)` milliseconds delay when retrying HTTP calls */ retryJitter : number ; /** minimum delay when retrying write (milliseconds) */ minRetryDelay : number ; /** maximum delay when retrying write (milliseconds) */ maxRetryDelay : number ; /** base for the exponential retry delay */ exponentialBase : number ; /**
     * randomRetry indicates whether the next retry delay is deterministic (false) or random (true).
     * The deterministic delay starts with `minRetryDelay * exponentialBase` and it is multiplied
     * by `exponentialBase` until it exceeds `maxRetryDelay`.
     * When random is `true`, the next delay is computed as a random number between next retry attempt (upper)
     * and the lower number in the deterministic sequence. `random(retryJitter)` is added to every returned value.
     */ randomRetry : boolean ; } /**
 * Options that configure strategy for retrying failed InfluxDB write operations.
 */ export interface WriteRetryOptions extends RetryDelayStrategyOptions { param this param error param lines param attempts returns writeFailed ( this , error , lines , attempts ) : Promise < void > | void ; param this param lines writeSuccess ( this , lines ) : void ; /** max number of retries when write fails */ maxRetries : number ; /** max time (millis) that can be spent with retries */ maxRetryTime : number ; /** the maximum size of retry-buffer (in lines) */ maxBufferLines : number ; } /**
 * Options used by  WriteApi .
  export interface WriteOptions extends WriteRetryOptions { /** max number of records to send in a batch   */ batchSize : number ; /** delay between data flushes in milliseconds, at most `batch size` records are sent during flush  */ flushInterval : number ; /** default tags, unescaped */ defaultTags ? : Record < string , string > ; /** HTTP headers that will be sent with every write request */ headers ? : { [ key ] : string ; } ; /** When specified, write bodies larger than the threshold are gzipped  */ gzipThreshold ? : number ; } /** default RetryDelayStrategyOptions */ export const DEFAULT_RetryDelayStrategyOptions = { retryJitter : 200 , minRetryDelay : 5000 , maxRetryDelay : 125000 , exponentialBase : 5 , randomRetry : true , } ; /** default writeOptions */ export const DEFAULT_WriteOptions = { batchSize : 1000 , flushInterval : 60000 , writeFailed : function ( ) { } , writeSuccess : function ( ) { } , maxRetries : 5 , maxRetryTime : 180000 , maxBufferLines : 32000 , retryJitter : 200 , minRetryDelay : 5000 , maxRetryDelay : 125000 , exponentialBase : 2 , gzipThreshold : 1000 , randomRetry : true , } ; /**
 * Options used by  InfluxDB .
  export interface ClientOptions extends ConnectionOptions { /** supplies and overrides default writing options */ writeOptions ? : Partial < WriteOptions > ; /** specifies custom transport */ transport ? : Transport ; } /**
 * Timestamp precision used in write operations.
 * See  https export type WritePrecisionType = 'ns' | 'us' | 'ms' | 's' ;