UNPKG

rbt_mssql-pool-party

Version:

Extension of mssql that provides management of multiple connection pools, dsns, retries, and more

24 lines (22 loc) 1.01 kB
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });exports["default"] = defaultConnectionPoolFactory;var _mssql = _interopRequireDefault(require("mssql")); function defaultConnectionPoolFactory(dsn) { var connection = new _mssql["default"].ConnectionPool(dsn); // we don't want an 'Uncaught, unspecified "error" event.' exception // so we have a dummy listener here. connection.on('error', function () {}); return connection.connect(). then( // a pool is an object that has dsn and connection properties function () {return { connection: connection, dsn: dsn };}, // even if we fail to connect, we still want to create the pool, so we // can attempt to heal it later on function (err) {return { connection: connection, dsn: dsn, error: err };}); }module.exports = exports.default; //# sourceMappingURL=default-connection-pool-factory.js.map