Socket
Socket
Sign inDemoInstall

sequelize

Package Overview
Dependencies
Maintainers
8
Versions
622
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sequelize - npm Package Compare versions

Comparing version 6.20.0 to 6.20.1

6

lib/dialects/abstract/connection-manager.js

@@ -210,6 +210,10 @@ "use strict";

}
async releaseConnection(connection) {
releaseConnection(connection) {
this.pool.release(connection);
debug("connection released");
}
async destroyConnection(connection) {
await this.pool.destroy(connection);
debug(`connection ${connection.uuid} destroyed`);
}
async _connect(config) {

@@ -216,0 +220,0 @@ await this.sequelize.runHooks("beforeConnect", config);

19

lib/sequelize.js

@@ -315,3 +315,3 @@ "use strict";

if (!options.transaction) {
await this.connectionManager.releaseConnection(connection);
this.connectionManager.releaseConnection(connection);
}

@@ -501,18 +501,15 @@ }

return Sequelize._clsRun(async () => {
await transaction.prepareEnvironment(true);
let result;
try {
await transaction.prepareEnvironment();
const result = await autoCallback(transaction);
await transaction.commit();
return await result;
result = await autoCallback(transaction);
} catch (err) {
try {
if (!transaction.finished) {
await transaction.rollback();
} else {
await transaction.cleanup();
}
} catch (err0) {
await transaction.rollback();
} catch (ignore) {
}
throw err;
}
await transaction.commit();
return result;
});

@@ -519,0 +516,0 @@ }

@@ -44,6 +44,10 @@ "use strict";

try {
return await this.sequelize.getQueryInterface().commitTransaction(this, this.options);
await this.sequelize.getQueryInterface().commitTransaction(this, this.options);
this.cleanup();
} catch (e) {
console.warn(`Committing transaction ${this.id} failed with error ${JSON.stringify(e.message)}. We are killing its connection as it is now in an undetermined state.`);
await this.forceCleanup();
throw e;
} finally {
this.finished = "commit";
this.cleanup();
for (const hook of this._afterCommitHooks) {

@@ -62,12 +66,12 @@ await hook.apply(this, [this]);

try {
return await this.sequelize.getQueryInterface().rollbackTransaction(this, this.options);
} finally {
await this.sequelize.getQueryInterface().rollbackTransaction(this, this.options);
this.cleanup();
} catch (e) {
console.warn(`Rolling back transaction ${this.id} failed with error ${JSON.stringify(e.message)}. We are killing its connection as it is now in an undetermined state.`);
await this.forceCleanup();
throw e;
}
}
async prepareEnvironment(useCLS) {
async prepareEnvironment(useCLS = true) {
let connectionPromise;
if (useCLS === void 0) {
useCLS = true;
}
if (this.parent) {

@@ -116,9 +120,17 @@ connectionPromise = Promise.resolve(this.parent.connection);

cleanup() {
if (this.parent || this.connection.uuid === void 0)
if (this.parent || this.connection.uuid === void 0) {
return;
}
this._clearCls();
const res = this.sequelize.connectionManager.releaseConnection(this.connection);
this.sequelize.connectionManager.releaseConnection(this.connection);
this.connection.uuid = void 0;
return res;
}
async forceCleanup() {
if (this.parent || this.connection.uuid === void 0) {
return;
}
this._clearCls();
await this.sequelize.connectionManager.destroyConnection(this.connection);
this.connection.uuid = void 0;
}
_clearCls() {

@@ -125,0 +137,0 @@ const cls = this.sequelize.constructor._cls;

{
"name": "sequelize",
"description": "Sequelize is a promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Amazon Redshift and Snowflake’s Data Cloud. It features solid transaction support, relations, eager and lazy loading, read replication and more.",
"version": "6.20.0",
"version": "6.20.1",
"funding": [

@@ -6,0 +6,0 @@ {

@@ -31,5 +31,10 @@ export interface GetConnectionOptions {

/**
* Release a pooled connection so it can be utilized by other connection requests
* Release a pooled connection, so it can be utilized by other connection requests
*/
releaseConnection(conn: Connection): Promise<void>;
releaseConnection(conn: Connection): void;
/**
* Destroys a pooled connection and removes it from the pool.
*/
destroyConnection(conn: Connection): Promise<void>;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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