1.0.6 • Published 6 months ago

@types/tedious-connection-pool v1.0.6

Weekly downloads
2,780
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/tedious-connection-pool

Summary

This package contains type definitions for tedious-connection-pool (https://github.com/tediousjs/tedious-connection-pool).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tedious-connection-pool.

index.d.ts

// Type definitions for tedious-connection-pool 1.0
// Project: https://github.com/tediousjs/tedious-connection-pool
// Definitions by: Cyprien Autexier <https://github.com/sandorfr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference types="node" />

import events = require('events');
import tedious = require('tedious');

declare namespace tcp {
    /**
     * Extends Tedious Connection with release function
     */
    class PooledConnection extends tedious.Connection {
        /**
         * If the connection is issued from a connection pool returns the connection to the pool.
         */
        release(): void;
    }

    /**
     * Provides a connection or an error
     * @param err error if any
     * @param connection issued from the pool
     */
    type ConnectionCallback = (err: Error, connection: PooledConnection) => void;

    /**
     *  Pool Configuration interface
     */
    interface PoolConfig {
        /**
         * Minimum concurrent connections
         */
        min?: number | undefined;

        /**
         * Maximum concurrent connections
         */
        max?: number | undefined;

        /**
         * Defines if logging is activated
         */
        log?: boolean | undefined;

        /**
         * Idle timeout
         */
        idleTimeout?: number | undefined;

        /**
         * Retry delay
         */
        retryDelay?: number | undefined;

        /**
         * Acquire timeout
         */
        acquireTimeout?: number | undefined;
    }
}

/**
 * Tedious Connection Pool Class
 */
declare class tcp extends events.EventEmitter {
    /**
     * Connection Pool constructor
     * @param poolConfig the pool configuration
     * @param connectionConfig the connection configuration
     */
    constructor(poolConfig: tcp.PoolConfig, connectionConfig: tedious.ConnectionConfig);

    /**
     * acquires a connection from the pool
     * @param callback invoked when the connection is retrieved and ready
     */
    acquire(callback: tcp.ConnectionCallback): void;

    /**
     * closes opened connections
     */
    drain(): void;
}

export = tcp;

Additional Details

Credits

These definitions were written by Cyprien Autexier.

1.0.6

6 months ago

1.0.5

7 months ago

1.0.4

8 months ago

1.0.3

3 years ago

1.0.2

5 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27-alpha

8 years ago

0.0.25-alpha

8 years ago

0.0.24-alpha

8 years ago

0.0.23-alpha

8 years ago

0.0.22-alpha

8 years ago

0.0.21-alpha

8 years ago

0.0.20-alpha

8 years ago

0.0.15-alpha

8 years ago

0.0.14-alpha

8 years ago