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

@cap-js-community/event-queue

Package Overview
Dependencies
Maintainers
7
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cap-js-community/event-queue - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

4

package.json
{
"name": "@cap-js-community/event-queue",
"version": "1.3.1",
"version": "1.3.2",
"description": "An event queue that enables secure transactional processing of asynchronous and periodic events, featuring instant event processing with Redis Pub/Sub and load distribution across all application instances.",

@@ -47,3 +47,3 @@ "main": "src/index.js",

"verror": "1.10.1",
"yaml": "2.3.4"
"yaml": "2.4.0"
},

@@ -50,0 +50,0 @@ "devDependencies": {

@@ -87,17 +87,15 @@ "use strict";

const logger = cds.log(COMPONENT);
config.checkRedisEnabled();
cds.on("connect", (service) => {
if (service.name === "db") {
config.processEventsAfterPublish && dbHandler.registerEventQueueDbHandler(service);
config.cleanupLocksAndEventsForDev && registerCleanupForDevDb().catch(() => {});
registerEventProcessors();
}
});
config.fileContent = await readConfigFromFile(config.configFilePath);
config.checkRedisEnabled();
if (config.processEventsAfterPublish) {
cds.on("connect", (service) => {
if (service.name === "db") {
dbHandler.registerEventQueueDbHandler(service);
config.cleanupLocksAndEventsForDev && registerCleanupForDevDb().catch(() => {});
}
});
}
!config.skipCsnCheck && (await csnCheck());
monkeyPatchCAPOutbox();
registerEventProcessors();
registerCdsShutdown();

@@ -104,0 +102,0 @@ logger.info("event queue initialized", {

@@ -71,11 +71,19 @@ "use strict";

const _mapToEventAndPublish = async (context, name, msg) => {
const _mapToEventAndPublish = async (context, name, req) => {
let startAfter;
for (const header in req.headers ?? {}) {
if (header.toLocaleLowerCase() === "x-eventqueue-startafter") {
startAfter = req.headers[header];
delete req.headers[header];
break;
}
}
const event = {
contextUser: context.user.id,
...(msg._fromSend || (msg.reply && { _fromSend: true })), // send or emit
...(msg.inbound && { inbound: msg.inbound }),
...(msg.event && { event: msg.event }),
...(msg.data && { data: msg.data }),
...(msg.headers && { headers: msg.headers }),
...(msg.query && { query: msg.query }),
...(req._fromSend || (req.reply && { _fromSend: true })), // send or emit
...(req.inbound && { inbound: req.inbound }),
...(req.event && { event: req.event }),
...(req.data && { data: req.data }),
...(req.headers && { headers: req.headers }),
...(req.query && { query: req.query }),
};

@@ -87,2 +95,3 @@

payload: JSON.stringify(event),
...(startAfter && { startAfter }),
});

@@ -89,0 +98,0 @@ };

@@ -60,2 +60,9 @@ "use strict";

contextTx.context.user = user;
try {
contextTx.set?.({
"$user.id": user.id,
});
} catch {
/* empty */
}
await fn(contextTx, ...parameters);

@@ -62,0 +69,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