@message-queue-toolkit/core
Advanced tools
Comparing version
export type { QueueConsumer, AsyncPublisher, SyncPublisher, TransactionObservabilityManager, Logger, } from './lib/types/MessageQueueTypes'; | ||
export { AbstractQueueService } from './lib/queues/AbstractQueueService'; | ||
export type { QueueOptions, QueueDependencies, QueueConsumerDependencies, Deserializer, CommonQueueLocator, } from './lib/queues/AbstractQueueService'; | ||
export type { NewQueueOptions, ExistingQueueOptions, QueueDependencies, QueueConsumerDependencies, Deserializer, CommonQueueLocator, } from './lib/queues/AbstractQueueService'; | ||
export { isMessageError, MessageValidationError, MessageInvalidFormatError, } from './lib/errors/Errors'; | ||
export { objectToBuffer } from './lib/utils/queueUtils'; | ||
export { waitAndRetry } from './lib/utils/waitUtils'; |
@@ -14,14 +14,18 @@ import type { ErrorReporter, ErrorResolver, Either } from '@lokalise/node-core'; | ||
export type Deserializer<MessagePayloadType extends object, QueueEngineMessageType extends object> = (message: QueueEngineMessageType, type: ZodType<MessagePayloadType>, errorProcessor: ErrorResolver) => Either<MessageInvalidFormatError | MessageValidationError, MessagePayloadType>; | ||
export type QueueOptions<MessagePayloadType extends object, QueueConfiguration extends object, QueueLocatorType extends object> = { | ||
export type NewQueueOptions<MessagePayloadType extends object, CreationConfigType extends object> = { | ||
messageSchema: ZodSchema<MessagePayloadType>; | ||
messageTypeField: string; | ||
queueName: string; | ||
queueLocator?: QueueLocatorType; | ||
queueConfiguration?: QueueConfiguration; | ||
locatorConfig?: never; | ||
creationConfig: CreationConfigType; | ||
}; | ||
export type ExistingQueueOptions<MessagePayloadType extends object, QueueLocatorType extends object> = { | ||
messageSchema: ZodSchema<MessagePayloadType>; | ||
messageTypeField: string; | ||
locatorConfig: QueueLocatorType; | ||
creationConfig?: never; | ||
}; | ||
export type CommonQueueLocator = { | ||
queueName: string; | ||
}; | ||
export declare abstract class AbstractQueueService<MessagePayloadType extends object, DependenciesType extends QueueDependencies, QueueConfiguration extends object, QueueLocatorType extends object = CommonQueueLocator, OptionsType extends QueueOptions<MessagePayloadType, QueueConfiguration, QueueLocatorType> = QueueOptions<MessagePayloadType, QueueConfiguration, QueueLocatorType>> { | ||
protected readonly queueName: string; | ||
export declare abstract class AbstractQueueService<MessagePayloadType extends object, DependenciesType extends QueueDependencies, QueueConfiguration extends object, QueueLocatorType extends object = CommonQueueLocator, OptionsType extends NewQueueOptions<MessagePayloadType, QueueConfiguration> | ExistingQueueOptions<MessagePayloadType, QueueLocatorType> = NewQueueOptions<MessagePayloadType, QueueConfiguration> | ExistingQueueOptions<MessagePayloadType, QueueLocatorType>> { | ||
protected readonly errorReporter: ErrorReporter; | ||
@@ -31,7 +35,7 @@ protected readonly messageSchema: ZodSchema<MessagePayloadType>; | ||
protected readonly messageTypeField: string; | ||
protected readonly queueConfiguration?: QueueConfiguration; | ||
protected readonly queueLocator?: QueueLocatorType; | ||
constructor({ errorReporter, logger }: DependenciesType, { messageSchema, messageTypeField, queueName, queueConfiguration, queueLocator }: OptionsType); | ||
protected readonly creationConfig?: QueueConfiguration; | ||
protected readonly locatorConfig?: QueueLocatorType; | ||
constructor({ errorReporter, logger }: DependenciesType, { messageSchema, messageTypeField, creationConfig, locatorConfig }: OptionsType); | ||
protected handleError(err: unknown): void; | ||
abstract close(): Promise<unknown>; | ||
} |
@@ -7,3 +7,2 @@ "use strict"; | ||
class AbstractQueueService { | ||
queueName; | ||
errorReporter; | ||
@@ -13,12 +12,11 @@ messageSchema; | ||
messageTypeField; | ||
queueConfiguration; | ||
queueLocator; | ||
constructor({ errorReporter, logger }, { messageSchema, messageTypeField, queueName, queueConfiguration, queueLocator }) { | ||
creationConfig; | ||
locatorConfig; | ||
constructor({ errorReporter, logger }, { messageSchema, messageTypeField, creationConfig, locatorConfig }) { | ||
this.errorReporter = errorReporter; | ||
this.logger = logger; | ||
this.queueName = queueName; | ||
this.messageSchema = messageSchema; | ||
this.messageTypeField = messageTypeField; | ||
this.queueConfiguration = queueConfiguration; | ||
this.queueLocator = queueLocator; | ||
this.creationConfig = creationConfig; | ||
this.locatorConfig = locatorConfig; | ||
} | ||
@@ -25,0 +23,0 @@ handleError(err) { |
{ | ||
"name": "@message-queue-toolkit/core", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"private": false, | ||
@@ -36,4 +36,4 @@ "license": "MIT", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"prettier": "^2.8.8", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"prettier": "^3.0.0", | ||
"typescript": "^5.1.6" | ||
@@ -40,0 +40,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
14608
0.68%202
1%