Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pg-promise

Package Overview
Dependencies
Maintainers
1
Versions
630
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-promise - npm Package Compare versions

Comparing version 10.8.7 to 10.9.0

44

lib/database-pool.js

@@ -24,2 +24,20 @@ /*

/**
* Global instance of the database pool repository.
*
* @return {{dbMap: {}, dbs: []}}
*/
static get instance() {
const s = Symbol.for(`pgPromise`);
let scope = global[s];
if (!scope) {
scope = {
dbMap: {}, // map of used database context keys (connection + dc)
dbs: [] // all database objects
};
global[s] = scope;
}
return scope;
}
/**
* @method DatabasePool.register

@@ -37,4 +55,5 @@ * @static

npm.utils.addReadProp(db, `$cnKey`, cnKey, true);
if (cnKey in DatabasePool.dbMap) {
DatabasePool.dbMap[cnKey]++;
const {dbMap, dbs} = DatabasePool.instance;
if (cnKey in dbMap) {
dbMap[cnKey]++;
/* istanbul ignore if */

@@ -45,5 +64,5 @@ if (!db.$config.options.noWarnings) {

} else {
DatabasePool.dbMap[cnKey] = 1;
dbMap[cnKey] = 1;
}
DatabasePool.dbs.push(db);
dbs.push(db);
}

@@ -58,4 +77,5 @@

const cnKey = db.$cnKey;
if (!--DatabasePool.dbMap[cnKey]) {
delete DatabasePool.dbMap[cnKey];
const {dbMap} = DatabasePool.instance;
if (!--dbMap[cnKey]) {
delete dbMap[cnKey];
}

@@ -69,7 +89,8 @@ }

static shutDown() {
DatabasePool.dbs.forEach(db => {
const {instance} = DatabasePool;
instance.dbs.forEach(db => {
db.$destroy();
});
DatabasePool.dbs.length = 0;
DatabasePool.dbMap = {};
instance.dbs.length = 0;
instance.dbMap = {};
}

@@ -99,7 +120,2 @@

/////////////////////
// Static Properties:
DatabasePool.dbMap = {}; // map of used database context keys (connection + dc)
DatabasePool.dbs = []; // all database objects
module.exports = {DatabasePool};
{
"name": "pg-promise",
"version": "10.8.7",
"version": "10.9.0",
"description": "PostgreSQL interface for Node.js",

@@ -49,6 +49,6 @@ "main": "lib/index.js",

"devDependencies": {
"@types/node": "14.14.20",
"@types/node": "14.14.21",
"bluebird": "3.7.2",
"coveralls": "3.1.0",
"eslint": "7.17.0",
"eslint": "7.18.0",
"istanbul": "0.4.5",

@@ -55,0 +55,0 @@ "jasmine-node": "3.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc