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

@ovotech/avro-stream

Package Overview
Dependencies
Maintainers
78
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ovotech/avro-stream - npm Package Compare versions

Comparing version 1.0.0 to 1.0.3

coverage/clover.xml

4

dist/AvroDeserializer.js

@@ -19,3 +19,4 @@ "use strict";

const schema = await this.resolver.fromId(schemaId);
callback(undefined, avsc_1.Type.forSchema(schema).fromBuffer(buffer));
const transformedMessage = Object.assign({}, message, { schema, value: avsc_1.Type.forSchema(schema).fromBuffer(buffer) });
callback(undefined, transformedMessage);
}

@@ -28,1 +29,2 @@ catch (error) {

exports.AvroDeserializer = AvroDeserializer;
//# sourceMappingURL=AvroDeserializer.js.map
/// <reference types="node" />
import { Schema } from 'avsc';
import { ProduceRequest } from 'kafka-node';
import { Transform, TransformCallback } from 'stream';
import { SchemaResolver } from './types';
export interface AvroProduceRequest extends ProduceRequest {
schema: Schema;
messages: any[];
}
import { AvroProduceRequest, SchemaResolver } from './types';
export declare class AvroSerializer extends Transform {

@@ -11,0 +5,0 @@ private resolver;

@@ -24,1 +24,2 @@ "use strict";

exports.AvroSerializer = AvroSerializer;
//# sourceMappingURL=AvroSerializer.js.map
export { AvroDeserializer } from './AvroDeserializer';
export { AvroSerializer } from './AvroSerializer';
export { SchemaRegistryResolver } from './SchemaRegistryResolver';
export { SchemaResolver } from './types';
export { SchemaResolver, AvroMessage, AvroProduceRequest } from './types';
export { constructMessage, deconstructMessage } from './message';

@@ -12,1 +12,2 @@ "use strict";

exports.deconstructMessage = message_1.deconstructMessage;
//# sourceMappingURL=index.js.map
/// <reference types="node" />
export interface AvroMessage {
export interface AvroBuffer {
schemaId: number;
buffer: Buffer;
}
export declare const deconstructMessage: (buffer: Buffer) => AvroMessage;
export declare const constructMessage: ({ schemaId, buffer }: AvroMessage) => Buffer;
export declare const deconstructMessage: (buffer: Buffer) => AvroBuffer;
export declare const constructMessage: ({ schemaId, buffer }: AvroBuffer) => Buffer;

@@ -12,1 +12,2 @@ "use strict";

};
//# sourceMappingURL=message.js.map

@@ -20,1 +20,2 @@ "use strict";

exports.SchemaRegistryResolver = SchemaRegistryResolver;
//# sourceMappingURL=SchemaRegistryResolver.js.map
import { Schema } from 'avsc';
import { Message, ProduceRequest } from 'kafka-node';
export interface SchemaResolver {

@@ -6,1 +7,9 @@ toId(topic: string, schema: Schema): Promise<number>;

}
export interface AvroProduceRequest extends ProduceRequest {
schema: Schema;
messages: any[];
}
export interface AvroMessage extends Message {
schema: Schema;
value: any;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map
{
"name": "@ovotech/avro-stream",
"version": "1.0.0",
"description": "Serialize/deserialize kafka-node streams with avro data, using confluent schema-registry to hold the schemas",
"version": "1.0.3",
"main": "dist/index.js",

@@ -10,3 +11,3 @@ "source": "src/index.ts",

"dependencies": {
"@ovotech/schema-registry-api": "^1.0.1",
"@ovotech/schema-registry-api": "^1.0.3",
"avsc": "^5.4.7"

@@ -21,2 +22,5 @@ },

},
"peerDependencies": {
"kafka-node": "*"
},
"devDependencies": {

@@ -40,3 +44,3 @@ "@types/jest": "^23.3.10",

},
"gitHead": "d6589b417ab91967602f916d00597043802d715d"
"gitHead": "54ecb85f75519249bcfbbb6bb4cd12ad5ac9939b"
}

@@ -6,3 +6,3 @@ import { Type } from 'avsc';

import { SchemaRegistryResolver } from './SchemaRegistryResolver';
import { SchemaResolver } from './types';
import { AvroMessage, SchemaResolver } from './types';

@@ -25,3 +25,4 @@ export class AvroDeserializer extends Transform {

const schema = await this.resolver.fromId(schemaId);
callback(undefined, Type.forSchema(schema).fromBuffer(buffer));
const transformedMessage: AvroMessage = { ...message, schema, value: Type.forSchema(schema).fromBuffer(buffer) };
callback(undefined, transformedMessage);
} catch (error) {

@@ -28,0 +29,0 @@ callback(error);

@@ -1,13 +0,7 @@

import { Schema, Type } from 'avsc';
import { ProduceRequest } from 'kafka-node';
import { Type } from 'avsc';
import { Transform, TransformCallback } from 'stream';
import { constructMessage } from './message';
import { SchemaRegistryResolver } from './SchemaRegistryResolver';
import { SchemaResolver } from './types';
import { AvroProduceRequest, SchemaResolver } from './types';
export interface AvroProduceRequest extends ProduceRequest {
schema: Schema;
messages: any[];
}
export class AvroSerializer extends Transform {

@@ -14,0 +8,0 @@ private resolver: SchemaResolver;

export { AvroDeserializer } from './AvroDeserializer';
export { AvroSerializer } from './AvroSerializer';
export { SchemaRegistryResolver } from './SchemaRegistryResolver';
export { SchemaResolver } from './types';
export { SchemaResolver, AvroMessage, AvroProduceRequest } from './types';
export { constructMessage, deconstructMessage } from './message';

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

export interface AvroMessage {
export interface AvroBuffer {
schemaId: number;

@@ -6,7 +6,7 @@ buffer: Buffer;

export const deconstructMessage = (buffer: Buffer): AvroMessage => {
export const deconstructMessage = (buffer: Buffer): AvroBuffer => {
return { schemaId: buffer.readInt32BE(1), buffer: buffer.slice(5) };
};
export const constructMessage = ({ schemaId, buffer }: AvroMessage): Buffer => {
export const constructMessage = ({ schemaId, buffer }: AvroBuffer): Buffer => {
const prefix = Buffer.alloc(5);

@@ -13,0 +13,0 @@ prefix.writeUInt8(0, 0);

import { Schema } from 'avsc';
import { Message, ProduceRequest } from 'kafka-node';

@@ -7,1 +8,11 @@ export interface SchemaResolver {

}
export interface AvroProduceRequest extends ProduceRequest {
schema: Schema;
messages: any[];
}
export interface AvroMessage extends Message {
schema: Schema;
value: any;
}
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