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

@bluexlab/kafka-ts

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bluexlab/kafka-ts - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

9

dist/index.d.ts

@@ -1,2 +0,2 @@

import { EachMessagePayload } from 'kafkajs';
import { EachMessagePayload, KafkaMessage } from 'kafkajs';

@@ -35,2 +35,7 @@ interface MessageProcessorType {

export { type MessageProcessorType, NotificationConsumer, NotificationProducer };
interface NotificationDefinition<T> {
fromJSON(data: Record<string, any>): T;
}
declare const parseNotification: <T>(message: KafkaMessage, notificationDefinition: NotificationDefinition<T>) => T;
export { type MessageProcessorType, NotificationConsumer, NotificationProducer, parseNotification };

@@ -12,2 +12,13 @@ // src/consumer.ts

import snakeCase from "lodash/snakeCase";
var toCamelCase = (obj) => {
if (isArray(obj)) {
return obj.map((v) => toCamelCase(v));
}
if (isPlainObject(obj)) {
return transform(obj, (result, value, key) => {
result[camelCase(key)] = toCamelCase(value);
});
}
return obj;
};

@@ -18,2 +29,10 @@ // src/common.ts

var consumerGroupId = process.env.NOTIFICATION_CONSUMER_GROUP_ID;
var parseNotification = (message, notificationDefinition) => {
if (!message.value) throw new Error(`Message is empty ${message.key}`);
const rawContent = message.value.toString();
const jsonObj = JSON.parse(rawContent);
const keyConverted = toCamelCase(jsonObj);
const notification = notificationDefinition.fromJSON(keyConverted);
return notification;
};

@@ -128,3 +147,4 @@ // src/consumer.ts

NotificationConsumer,
NotificationProducer
NotificationProducer,
parseNotification
};
{
"name": "@bluexlab/kafka-ts",
"type": "module",
"version": "1.0.1",
"version": "1.0.2",
"description": "The kafka producer and consumer client",

@@ -6,0 +6,0 @@ "exports": {

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