New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fraight/transaction-tools

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fraight/transaction-tools - npm Package Compare versions

Comparing version

to
1.2.7

28

context/worker.js

@@ -5,3 +5,2 @@ const Context = require('./context');

class WorkerContext extends Context {
constructor(config) {

@@ -13,14 +12,21 @@ super(config);

static factory({ db, queue }) {
queue.processWithTransaction = function(config) {
const { name, concurrency, handler, transactionSettings} = config
const shimmedHandler = function(job) {
queue.processWithTransaction = function processWithTransaction(config) {
const { name, concurrency, handler, transactionSettings } = config;
const shimmedHandler = function shimmedHandler(job) {
const context = new WorkerContext({ job });
return db.transaction(transactionSettings, async t => {
Sequelize.cls.set('context', context);
await handler.call(this, job);
})
}
return new Promise(async (resolve, reject) => {
try {
await db.transaction(transactionSettings, async (t) => {
Sequelize.cls.set('context', context);
const jobResult = await handler.call(this, job);
resolve(jobResult);
});
} catch (e) {
reject(e);
}
});
};
const processArgs = [name, concurrency, shimmedHandler].filter(v => !!v);
queue.process(...processArgs)
}
queue.process(...processArgs);
};
}

@@ -27,0 +33,0 @@ }

{
"name": "@fraight/transaction-tools",
"version": "1.2.6",
"version": "1.2.7",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",