Socket
Socket
Sign inDemoInstall

@halcyon-agile/node-event-sourcing

Package Overview
Dependencies
39
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.9 to 1.0.10

2

dist/Dto.d.ts

@@ -5,3 +5,3 @@ interface EventDto {

event: string;
payload: unknown;
payload: any;
}

@@ -8,0 +8,0 @@ interface EventHandlersClassType {

@@ -23,3 +23,3 @@ import DynamoDB from "aws-sdk/clients/dynamodb";

event: string;
payload: unknown;
payload: any;
};

@@ -26,0 +26,0 @@ };

"use strict";
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod };
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -12,37 +10,38 @@ const EventStore_1 = __importDefault(require("./EventStore"));

const kafka = new kafkajs_1.Kafka({
clientId: "my-app",
brokers,
clientId: "my-app",
brokers,
});
const producer = kafka.producer();
class Publisher {
async publishEvents(events) {
for (const event of events) {
await producer.send({
topic: event.event,
messages: [{ value: JSON.stringify(event) }],
});
async publishEvents(events) {
for (const event of events) {
await producer.send({
topic: event.event,
messages: [{ value: JSON.stringify(event) }],
});
}
}
}
async run() {
await producer.connect();
const exec = async () => {
const events = (await EventStore_1.default.getUnpublishedEvents()).Items;
console.log("Publishing Events ", events?.length);
try {
if (events?.length) {
await Promise.all([
EventStore_1.default.markEventsAsPublished(events),
this.publishEvents(events || []),
]);
}
} catch (error) {
console.error(error, "something went wrong marking event as published");
}
setTimeout(async () => {
async run() {
await producer.connect();
const exec = async () => {
const events = (await EventStore_1.default.getUnpublishedEvents()).Items;
console.log("Events ", events?.length);
try {
if (events?.length) {
await Promise.all([
EventStore_1.default.markEventsAsPublished(events),
this.publishEvents(events || []),
]);
}
}
catch (error) {
console.error(error, "something went wrong marking event as published");
}
setTimeout(async () => {
await exec();
}, 2000);
};
await exec();
}, 2000);
};
await exec();
}
}
}
exports.default = new Publisher();
{
"name": "@halcyon-agile/node-event-sourcing",
"version": "1.0.9",
"version": "1.0.10",
"description": "> Opinionated OOP based node.js event sourcing library inspired by laravel-event-sourcing",

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc