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

@ovotech/castle

Package Overview
Dependencies
Maintainers
102
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ovotech/castle - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

4

dist/castle.d.ts
import { AvroProducerRecord } from '@ovotech/avro-kafkajs';
import { CastleConfig, Castle, CastleSender, CastleEachMessagePayload, CastleEachBatchPayload } from './types';
export declare const produce: <T>(config: Pick<AvroProducerRecord<T>, "topic" | "acks" | "timeout" | "compression" | "schema">) => CastleSender<T>;
export declare const eachMessage: <T, TContext extends object = {}>(config: (payload: CastleEachMessagePayload<T> & TContext) => Promise<void>) => (payload: CastleEachMessagePayload<T> & TContext) => Promise<void>;
export declare const eachBatch: <T, TContext extends object = {}>(config: (payload: CastleEachBatchPayload<T> & TContext) => Promise<void>) => (payload: CastleEachBatchPayload<T> & TContext) => Promise<void>;
export declare const consumeEachMessage: <T, TContext extends object = {}>(config: (payload: CastleEachMessagePayload<T> & TContext) => Promise<void>) => (payload: CastleEachMessagePayload<T> & TContext) => Promise<void>;
export declare const consumeEachBatch: <T, TContext extends object = {}>(config: (payload: CastleEachBatchPayload<T> & TContext) => Promise<void>) => (payload: CastleEachBatchPayload<T> & TContext) => Promise<void>;
export declare const createCastle: (config: CastleConfig) => Castle;

@@ -13,4 +13,4 @@ "use strict";

};
exports.eachMessage = (config) => config;
exports.eachBatch = (config) => config;
exports.consumeEachMessage = (config) => config;
exports.consumeEachBatch = (config) => config;
exports.createCastle = (config) => {

@@ -17,0 +17,0 @@ const schemaRegistry = new avro_kafkajs_1.SchemaRegistry(config.schemaRegistry);

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

export { createCastle, produce, eachMessage, eachBatch } from './castle';
export { createCastle, produce, consumeEachMessage, consumeEachBatch } from './castle';
export { CastleEachMessagePayload, CastleEachBatchPayload, Resolver, Middleware, CastleConsumerConfig, CastleConsumer, CastleConfig, Castle, } from './types';

@@ -6,3 +6,3 @@ "use strict";

exports.produce = castle_1.produce;
exports.eachMessage = castle_1.eachMessage;
exports.eachBatch = castle_1.eachBatch;
exports.consumeEachMessage = castle_1.consumeEachMessage;
exports.consumeEachBatch = castle_1.consumeEachBatch;
{
"name": "@ovotech/castle",
"version": "0.1.1",
"version": "0.1.2",
"main": "dist/index.js",

@@ -44,3 +44,3 @@ "types": "dist/index.d.ts",

},
"gitHead": "23fe38855c58dc0cdf1b02a1ec10f5ea0e023868"
"gitHead": "9a39f65b885af3195e2ef24f609e971ee4b0e9f5"
}

@@ -14,3 +14,3 @@ # Castle

```typescript
import { createCastle, produce, eachMessage } from '@ovotech/castle';
import { createCastle, produce, consumeEachMessage } from '@ovotech/castle';
import { Event, EventSchema } from './avro';

@@ -24,3 +24,3 @@

// With statically setting which types it will accept
const eachEvent = eachMessage<Event>(async ({ message }) => {
const eachEvent = consumeEachMessage<Event>(async ({ message }) => {
console.log(message.value);

@@ -52,3 +52,3 @@ });

```typescript
import { createCastle, produce, eachMessage, eachBatch } from '@ovotech/castle';
import { createCastle, produce, consumeEachMessage, consumeEachBatch } from '@ovotech/castle';
import {

@@ -69,3 +69,3 @@ StartEvent,

// Define a consumer as a pure function
const eachStartEvent = eachMessage<StartEvent>(async ({ message }) => {
const eachStartEvent = consumeEachMessage<StartEvent>(async ({ message }) => {
console.log(`Started Processing ${message.value.id}`);

@@ -75,3 +75,3 @@ });

// Define a batch consumer as a pure function
const eachBatchFeedbackEvent = eachBatch<FeedbackEvent>(async ({ batch, producer }) => {
const eachBatchFeedbackEvent = consumeEachBatch<FeedbackEvent>(async ({ batch, producer }) => {
console.log(`Feedback ${batch.messages.map(msg => `${msg.value.id}:${msg.value.status}`)}`);

@@ -83,3 +83,3 @@ console.log('Sending complete events');

// Define a parallel consumer as a pure function
const eachCompleteEvent = eachMessage<CompleteEvent>(async ({ message }) => {
const eachCompleteEvent = consumeEachMessage<CompleteEvent>(async ({ message }) => {
console.log(`Completed ${message.value.id}`);

@@ -138,3 +138,3 @@ });

```typescript
import { createCastle, produce, eachMessage } from '@ovotech/castle';
import { createCastle, produce, consumeEachMessage } from '@ovotech/castle';
import { StartEvent, StartEventSchema, CompleteEvent, CompleteEventSchema } from './avro';

@@ -152,3 +152,3 @@ import {

const eachStart = eachMessage<StartEvent, DbContext & LoggingContext>(
const eachStart = consumeEachMessage<StartEvent, DbContext & LoggingContext>(
async ({ message, db, logger, producer }) => {

@@ -162,5 +162,7 @@ logger.log('Started', message.value.id);

const eachComplete = eachMessage<CompleteEvent, LoggingContext>(async ({ message, logger }) => {
logger.log('Complete recieved for', message.value.id);
});
const eachComplete = consumeEachMessage<CompleteEvent, LoggingContext>(
async ({ message, logger }) => {
logger.log('Complete recieved for', message.value.id);
},
);

@@ -167,0 +169,0 @@ const main = async () => {

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