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

@message-queue-toolkit/core

Package Overview
Dependencies
Maintainers
3
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@message-queue-toolkit/core - npm Package Compare versions

Comparing version 3.7.0 to 4.0.0

4

dist/index.d.ts

@@ -1,6 +0,6 @@

export type { QueueConsumer, AsyncPublisher, SyncPublisher, TransactionObservabilityManager, Logger, SchemaMap, ExtraParams, } from './lib/types/MessageQueueTypes';
export type { QueueConsumer, AsyncPublisher, SyncPublisher, TransactionObservabilityManager, Logger, LogFn, SchemaMap, ExtraParams, } from './lib/types/MessageQueueTypes';
export { AbstractQueueService } from './lib/queues/AbstractQueueService';
export type { NewQueueOptions, ExistingQueueOptions, NewQueueOptionsMultiSchema, ExistingQueueOptionsMultiSchema, MonoSchemaQueueOptions, MultiSchemaConsumerOptions, QueueDependencies, QueueConsumerDependencies, Deserializer, CommonQueueLocator, DeletionConfig, MultiSchemaPublisherOptions, } from './lib/queues/AbstractQueueService';
export { isMessageError, MessageValidationError, MessageInvalidFormatError, } from './lib/errors/Errors';
export { HandlerContainer, MessageHandlerConfig, MessageHandlerConfigBuilder, BarrierCallbackMultiConsumers, } from './lib/queues/HandlerContainer';
export { HandlerContainer, MessageHandlerConfig, MessageHandlerConfigBuilder, BarrierCallbackMultiConsumers, BarrierResult, BarrierResultPositive, BarrierResultNegative, } from './lib/queues/HandlerContainer';
export type { HandlerContainerOptions, Handler } from './lib/queues/HandlerContainer';

@@ -7,0 +7,0 @@ export { MessageSchemaContainer } from './lib/queues/MessageSchemaContainer';

import type { Either } from '@lokalise/node-core';
import type { ZodSchema } from 'zod';
export type LogFormatter<MessagePayloadSchema> = (message: MessagePayloadSchema) => unknown;
export type BarrierCallbackMultiConsumers<MessagePayloadSchema extends object, ExecutionContext> = (message: MessagePayloadSchema, context: ExecutionContext) => Promise<boolean>;
export type BarrierResult<BarrierOutput> = BarrierResultPositive<BarrierOutput> | BarrierResultNegative;
export type BarrierResultPositive<BarrierOutput> = {
isPassing: true;
output: BarrierOutput;
};
export type BarrierResultNegative = {
isPassing: false;
output?: never;
};
export type BarrierCallbackMultiConsumers<MessagePayloadSchema extends object, ExecutionContext, BarrierOutput> = (message: MessagePayloadSchema, context: ExecutionContext) => Promise<BarrierResult<BarrierOutput>>;
export declare const defaultLogFormatter: <MessagePayloadSchema>(message: MessagePayloadSchema) => MessagePayloadSchema;
export type HandlerConfigOptions<MessagePayloadSchema extends object, ExecutionContext> = {
export type HandlerConfigOptions<MessagePayloadSchema extends object, ExecutionContext, BarrierOutput> = {
messageLogFormatter?: LogFormatter<MessagePayloadSchema>;
preHandlerBarrier?: BarrierCallbackMultiConsumers<MessagePayloadSchema, ExecutionContext>;
preHandlerBarrier?: BarrierCallbackMultiConsumers<MessagePayloadSchema, ExecutionContext, BarrierOutput>;
};
export declare class MessageHandlerConfig<const MessagePayloadSchema extends object, const ExecutionContext> {
export declare class MessageHandlerConfig<const MessagePayloadSchema extends object, const ExecutionContext, const BarrierOutput = unknown> {
readonly schema: ZodSchema<MessagePayloadSchema>;
readonly handler: Handler<MessagePayloadSchema, ExecutionContext>;
readonly handler: Handler<MessagePayloadSchema, ExecutionContext, BarrierOutput>;
readonly messageLogFormatter: LogFormatter<MessagePayloadSchema>;
readonly preHandlerBarrier?: BarrierCallbackMultiConsumers<MessagePayloadSchema, ExecutionContext>;
constructor(schema: ZodSchema<MessagePayloadSchema>, handler: Handler<MessagePayloadSchema, ExecutionContext>, options?: HandlerConfigOptions<MessagePayloadSchema, ExecutionContext>);
readonly preHandlerBarrier?: BarrierCallbackMultiConsumers<MessagePayloadSchema, ExecutionContext, BarrierOutput>;
constructor(schema: ZodSchema<MessagePayloadSchema>, handler: Handler<MessagePayloadSchema, ExecutionContext, BarrierOutput>, options?: HandlerConfigOptions<MessagePayloadSchema, ExecutionContext, BarrierOutput>);
}

@@ -20,8 +29,8 @@ export declare class MessageHandlerConfigBuilder<MessagePayloadSchemas extends object, ExecutionContext> {

constructor();
addConfig<MessagePayloadSchema extends MessagePayloadSchemas>(schema: ZodSchema<MessagePayloadSchema>, handler: Handler<MessagePayloadSchema, ExecutionContext>, options?: HandlerConfigOptions<MessagePayloadSchema, ExecutionContext>): this;
build(): MessageHandlerConfig<MessagePayloadSchemas, ExecutionContext>[];
addConfig<MessagePayloadSchema extends MessagePayloadSchemas, const BarrierOutput>(schema: ZodSchema<MessagePayloadSchema>, handler: Handler<MessagePayloadSchema, ExecutionContext, BarrierOutput>, options?: HandlerConfigOptions<MessagePayloadSchema, ExecutionContext, BarrierOutput>): this;
build(): MessageHandlerConfig<MessagePayloadSchemas, ExecutionContext, any>[];
}
export type Handler<MessagePayloadSchemas, ExecutionContext> = (message: MessagePayloadSchemas, context: ExecutionContext) => Promise<Either<'retryLater', 'success'>>;
export type Handler<MessagePayloadSchemas, ExecutionContext, BarrierOutput = undefined> = (message: MessagePayloadSchemas, context: ExecutionContext, barrierOutput: BarrierOutput) => Promise<Either<'retryLater', 'success'>>;
export type HandlerContainerOptions<MessagePayloadSchemas extends object, ExecutionContext> = {
messageHandlers: MessageHandlerConfig<MessagePayloadSchemas, ExecutionContext>[];
messageHandlers: MessageHandlerConfig<MessagePayloadSchemas, ExecutionContext, unknown>[];
messageTypeField: string;

@@ -33,4 +42,4 @@ };

constructor(options: HandlerContainerOptions<MessagePayloadSchemas, ExecutionContext>);
resolveHandler(messageType: string): MessageHandlerConfig<MessagePayloadSchemas, ExecutionContext>;
resolveHandler<BarrierResult>(messageType: string): MessageHandlerConfig<MessagePayloadSchemas, ExecutionContext, BarrierResult>;
private resolveHandlerMap;
}

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

class MessageHandlerConfigBuilder {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
configs;

@@ -26,4 +27,5 @@ constructor() {

addConfig(schema, handler, options) {
this.configs.push(new MessageHandlerConfig(schema,
// @ts-ignore
this.configs.push(new MessageHandlerConfig(schema, handler, options));
handler, options));
return this;

@@ -43,3 +45,2 @@ }

}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
resolveHandler(messageType) {

@@ -50,2 +51,3 @@ const handler = this.messageHandlers[messageType];

}
// @ts-ignore
return handler;

@@ -52,0 +54,0 @@ }

{
"name": "@message-queue-toolkit/core",
"version": "3.7.0",
"version": "4.0.0",
"private": false,

@@ -5,0 +5,0 @@ "license": "MIT",

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