From 3bfb8f1e39011e2f48039b2c534f0fe936b67759 Mon Sep 17 00:00:00 2001 From: Weyoss Date: Fri, 29 Mar 2024 19:44:51 +0300 Subject: [PATCH] refactor: shorten imports --- src/lib/consumer-groups/consumer-groups.ts | 2 +- .../consumer-heartbeat/consumer-heartbeat.ts | 2 +- .../consumer-heartbeat/event-bus-publisher.ts | 2 +- src/lib/consumer/consumer/event-bus-publisher.ts | 2 +- .../message-handler-runner/event-bus-publisher.ts | 2 +- .../message-handler-runner/message-handler-runner.ts | 2 +- .../consume-message/event-bus-publisher.ts | 2 +- .../dequeue-message/dequeue-message.ts | 2 +- .../dequeue-message/event-bus-publisher.ts | 2 +- .../message-handler/even-bus-publisher.ts | 2 +- src/lib/consumer/types/config.ts | 12 ------------ src/lib/consumer/types/index.ts | 1 - src/lib/consumer/workers/worker.ts | 2 +- .../_/_get-exchange-direct-transferable.ts | 2 +- .../exchange/exchange-fan-out/exchange-fan-out.ts | 4 ++-- src/lib/exchange/exchange-topic/exchange-topic.ts | 2 +- src/lib/producer/event-bus-publisher.ts | 2 +- src/lib/queue/queue.ts | 2 +- tests/common/event-bus-redis.ts | 2 +- tests/common/schedule-worker.ts | 2 +- tests/tests/consuming-messages/test00010.test.ts | 2 +- tests/tests/workers/test00001.test.ts | 2 +- tests/tests/workers/test00002.test.ts | 2 +- tests/tests/workers/test00003.test.ts | 2 +- 24 files changed, 23 insertions(+), 36 deletions(-) delete mode 100644 src/lib/consumer/types/config.ts diff --git a/src/lib/consumer-groups/consumer-groups.ts b/src/lib/consumer-groups/consumer-groups.ts index e75b8a5c..45992bf1 100644 --- a/src/lib/consumer-groups/consumer-groups.ts +++ b/src/lib/consumer-groups/consumer-groups.ts @@ -18,7 +18,7 @@ import { import { TRedisSMQEvent } from '../../common/index.js'; import { RedisClientInstance } from '../../common/redis-client/redis-client-instance.js'; import { Configuration } from '../../config/index.js'; -import { EventBusRedisInstance } from '../event-bus/event-bus-redis-instance.js'; +import { EventBusRedisInstance } from '../event-bus/index.js'; import { IQueueParams } from '../queue/index.js'; import { _parseQueueParams } from '../queue/_/_parse-queue-params.js'; import { _deleteConsumerGroup } from './_/_delete-consumer-group.js'; diff --git a/src/lib/consumer/consumer-heartbeat/consumer-heartbeat.ts b/src/lib/consumer/consumer-heartbeat/consumer-heartbeat.ts index 7728733e..e479f709 100644 --- a/src/lib/consumer/consumer-heartbeat/consumer-heartbeat.ts +++ b/src/lib/consumer/consumer-heartbeat/consumer-heartbeat.ts @@ -22,7 +22,7 @@ import { import { TConsumerHeartbeatEvent } from '../../../common/index.js'; import { RedisClientFactory } from '../../../common/redis-client/redis-client-factory.js'; import { redisKeys } from '../../../common/redis-keys/redis-keys.js'; -import { Configuration } from '../../../config/configuration.js'; +import { Configuration } from '../../../config/index.js'; import { EventBusRedisFactory } from '../../event-bus/event-bus-redis-factory.js'; import { Consumer } from '../consumer/consumer.js'; import { IConsumerHeartbeat } from '../types/index.js'; diff --git a/src/lib/consumer/consumer-heartbeat/event-bus-publisher.ts b/src/lib/consumer/consumer-heartbeat/event-bus-publisher.ts index 21a56374..a36206b7 100644 --- a/src/lib/consumer/consumer-heartbeat/event-bus-publisher.ts +++ b/src/lib/consumer/consumer-heartbeat/event-bus-publisher.ts @@ -8,7 +8,7 @@ */ import { ILogger } from 'redis-smq-common'; -import { TConsumerHeartbeatEvent } from '../../../common/types/event.js'; +import { TConsumerHeartbeatEvent } from '../../../common/index.js'; import { EventBusRedisFactory } from '../../event-bus/event-bus-redis-factory.js'; import { ConsumerHeartbeat } from './consumer-heartbeat.js'; diff --git a/src/lib/consumer/consumer/event-bus-publisher.ts b/src/lib/consumer/consumer/event-bus-publisher.ts index 72459117..805f1e93 100644 --- a/src/lib/consumer/consumer/event-bus-publisher.ts +++ b/src/lib/consumer/consumer/event-bus-publisher.ts @@ -8,7 +8,7 @@ */ import { ILogger } from 'redis-smq-common'; -import { TConsumerEvent } from '../../../common/types/event.js'; +import { TConsumerEvent } from '../../../common/index.js'; import { EventBusRedisFactory } from '../../event-bus/event-bus-redis-factory.js'; import { Consumer } from './consumer.js'; diff --git a/src/lib/consumer/message-handler-runner/event-bus-publisher.ts b/src/lib/consumer/message-handler-runner/event-bus-publisher.ts index 9b05ed1f..d4f59b13 100644 --- a/src/lib/consumer/message-handler-runner/event-bus-publisher.ts +++ b/src/lib/consumer/message-handler-runner/event-bus-publisher.ts @@ -8,7 +8,7 @@ */ import { ILogger } from 'redis-smq-common'; -import { TConsumerMessageHandlerRunnerEvent } from '../../../common/types/event.js'; +import { TConsumerMessageHandlerRunnerEvent } from '../../../common/index.js'; import { EventBusRedisFactory } from '../../event-bus/event-bus-redis-factory.js'; import { MessageHandlerRunner } from './message-handler-runner.js'; diff --git a/src/lib/consumer/message-handler-runner/message-handler-runner.ts b/src/lib/consumer/message-handler-runner/message-handler-runner.ts index 6c05cf9a..d6ee0397 100644 --- a/src/lib/consumer/message-handler-runner/message-handler-runner.ts +++ b/src/lib/consumer/message-handler-runner/message-handler-runner.ts @@ -9,7 +9,7 @@ import { async, ICallback, ILogger, Runnable } from 'redis-smq-common'; import { TConsumerMessageHandlerRunnerEvent } from '../../../common/index.js'; -import { Configuration } from '../../../config/configuration.js'; +import { Configuration } from '../../../config/index.js'; import { IQueueParsedParams } from '../../queue/index.js'; import { Consumer } from '../consumer/consumer.js'; import { ConsumerMessageHandlerAlreadyExistsError } from '../errors/index.js'; diff --git a/src/lib/consumer/message-handler/consume-message/event-bus-publisher.ts b/src/lib/consumer/message-handler/consume-message/event-bus-publisher.ts index 24d61a60..03d024be 100644 --- a/src/lib/consumer/message-handler/consume-message/event-bus-publisher.ts +++ b/src/lib/consumer/message-handler/consume-message/event-bus-publisher.ts @@ -8,7 +8,7 @@ */ import { ILogger } from 'redis-smq-common'; -import { TConsumerConsumeMessageEvent } from '../../../../common/types/event.js'; +import { TConsumerConsumeMessageEvent } from '../../../../common/index.js'; import { EventBusRedisFactory } from '../../../event-bus/event-bus-redis-factory.js'; import { ConsumeMessage } from './consume-message.js'; diff --git a/src/lib/consumer/message-handler/dequeue-message/dequeue-message.ts b/src/lib/consumer/message-handler/dequeue-message/dequeue-message.ts index 365c7371..21af42c9 100644 --- a/src/lib/consumer/message-handler/dequeue-message/dequeue-message.ts +++ b/src/lib/consumer/message-handler/dequeue-message/dequeue-message.ts @@ -22,7 +22,7 @@ import { TConsumerDequeueMessageEvent } from '../../../../common/index.js'; import { RedisClientInstance } from '../../../../common/redis-client/redis-client-instance.js'; import { ELuaScriptName } from '../../../../common/redis-client/scripts/scripts.js'; import { redisKeys } from '../../../../common/redis-keys/redis-keys.js'; -import { Configuration } from '../../../../config/configuration.js'; +import { Configuration } from '../../../../config/index.js'; import { _saveConsumerGroup } from '../../../consumer-groups/_/_save-consumer-group.js'; import { EventBusRedisFactory } from '../../../event-bus/event-bus-redis-factory.js'; import { _hasRateLimitExceeded } from '../../../queue-rate-limit/_/_has-rate-limit-exceeded.js'; diff --git a/src/lib/consumer/message-handler/dequeue-message/event-bus-publisher.ts b/src/lib/consumer/message-handler/dequeue-message/event-bus-publisher.ts index 7a41904c..037e742b 100644 --- a/src/lib/consumer/message-handler/dequeue-message/event-bus-publisher.ts +++ b/src/lib/consumer/message-handler/dequeue-message/event-bus-publisher.ts @@ -8,7 +8,7 @@ */ import { ILogger } from 'redis-smq-common'; -import { TConsumerDequeueMessageEvent } from '../../../../common/types/event.js'; +import { TConsumerDequeueMessageEvent } from '../../../../common/index.js'; import { EventBusRedisFactory } from '../../../event-bus/event-bus-redis-factory.js'; import { DequeueMessage } from './dequeue-message.js'; diff --git a/src/lib/consumer/message-handler/message-handler/even-bus-publisher.ts b/src/lib/consumer/message-handler/message-handler/even-bus-publisher.ts index 84726aba..7d56bc4d 100644 --- a/src/lib/consumer/message-handler/message-handler/even-bus-publisher.ts +++ b/src/lib/consumer/message-handler/message-handler/even-bus-publisher.ts @@ -8,7 +8,7 @@ */ import { ILogger } from 'redis-smq-common'; -import { TConsumerMessageHandlerEvent } from '../../../../common/types/event.js'; +import { TConsumerMessageHandlerEvent } from '../../../../common/index.js'; import { EventBusRedisFactory } from '../../../event-bus/event-bus-redis-factory.js'; import { MessageHandler } from './message-handler.js'; diff --git a/src/lib/consumer/types/config.ts b/src/lib/consumer/types/config.ts deleted file mode 100644 index ef28911e..00000000 --- a/src/lib/consumer/types/config.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) - * Weyoss - * https://github.com/weyoss - * - * This source code is licensed under the MIT license found in the LICENSE file - * in the root directory of this source tree. - */ - -export interface IConsumerConfig { - enableMultiplexing?: boolean; -} diff --git a/src/lib/consumer/types/index.ts b/src/lib/consumer/types/index.ts index 657c81fb..63b20378 100644 --- a/src/lib/consumer/types/index.ts +++ b/src/lib/consumer/types/index.ts @@ -10,4 +10,3 @@ export * from './message-handler.js'; export * from './consumer-heartbeat.js'; export * from './consume-message.js'; -export * from './config.js'; diff --git a/src/lib/consumer/workers/worker.ts b/src/lib/consumer/workers/worker.ts index 62512337..89f07851 100644 --- a/src/lib/consumer/workers/worker.ts +++ b/src/lib/consumer/workers/worker.ts @@ -9,7 +9,7 @@ import { ICallback, ILogger, logger, Runnable, Timer } from 'redis-smq-common'; import { RedisClientInstance } from '../../../common/redis-client/redis-client-instance.js'; -import { IRedisSMQConfigRequired } from '../../../config/types/config.js'; +import { IRedisSMQConfigRequired } from '../../../config/index.js'; export abstract class Worker extends Runnable> { protected redisClient; diff --git a/src/lib/exchange/exchange-direct/_/_get-exchange-direct-transferable.ts b/src/lib/exchange/exchange-direct/_/_get-exchange-direct-transferable.ts index 75e653fd..3eda8968 100644 --- a/src/lib/exchange/exchange-direct/_/_get-exchange-direct-transferable.ts +++ b/src/lib/exchange/exchange-direct/_/_get-exchange-direct-transferable.ts @@ -8,7 +8,7 @@ */ import { v4 } from 'uuid'; -import { IQueueParams } from '../../../queue/types/queue.js'; +import { IQueueParams } from '../../../queue/index.js'; import { EExchangeType, TExchangeDirectTransferable, diff --git a/src/lib/exchange/exchange-fan-out/exchange-fan-out.ts b/src/lib/exchange/exchange-fan-out/exchange-fan-out.ts index 574e6d84..5795ec6e 100644 --- a/src/lib/exchange/exchange-fan-out/exchange-fan-out.ts +++ b/src/lib/exchange/exchange-fan-out/exchange-fan-out.ts @@ -16,8 +16,8 @@ import { IQueueParams, IQueueProperties, } from '../../queue/index.js'; -import { ExchangeFanOutError } from '../errors/exchange-fan-out.error.js'; -import { ExchangeError } from '../errors/exchange.error.js'; +import { ExchangeFanOutError } from '../errors/index.js'; +import { ExchangeError } from '../errors/index.js'; import { ExchangeAbstract } from '../exchange-abstract.js'; import { _getFanOutExchangeQueues } from './_/_get-fan-out-exchange-queues.js'; import { _getQueueFanOutExchange } from './_/_get-queue-fan-out-exchange.js'; diff --git a/src/lib/exchange/exchange-topic/exchange-topic.ts b/src/lib/exchange/exchange-topic/exchange-topic.ts index a9ef699a..8b266319 100644 --- a/src/lib/exchange/exchange-topic/exchange-topic.ts +++ b/src/lib/exchange/exchange-topic/exchange-topic.ts @@ -8,7 +8,7 @@ */ import { CallbackEmptyReplyError, ICallback } from 'redis-smq-common'; -import { IQueueParams } from '../../queue/types/queue.js'; +import { IQueueParams } from '../../queue/index.js'; import { ExchangeAbstract } from '../exchange-abstract.js'; import { ITopicParams } from '../types/exchange.js'; import { _getTopicExchangeParams } from './_/_get-topic-exchange-params.js'; diff --git a/src/lib/producer/event-bus-publisher.ts b/src/lib/producer/event-bus-publisher.ts index a078b984..fc44c382 100644 --- a/src/lib/producer/event-bus-publisher.ts +++ b/src/lib/producer/event-bus-publisher.ts @@ -8,7 +8,7 @@ */ import { ILogger } from 'redis-smq-common'; -import { TProducerEvent } from '../../common/types/event.js'; +import { TProducerEvent } from '../../common/index.js'; import { EventBusRedisFactory } from '../event-bus/event-bus-redis-factory.js'; import { Producer } from './producer.js'; diff --git a/src/lib/queue/queue.ts b/src/lib/queue/queue.ts index dca28553..36e122e6 100644 --- a/src/lib/queue/queue.ts +++ b/src/lib/queue/queue.ts @@ -17,7 +17,7 @@ import { RedisClientInstance } from '../../common/redis-client/redis-client-inst import { ELuaScriptName } from '../../common/redis-client/scripts/scripts.js'; import { redisKeys } from '../../common/redis-keys/redis-keys.js'; import { Configuration } from '../../config/index.js'; -import { EventBusRedisInstance } from '../event-bus/event-bus-redis-instance.js'; +import { EventBusRedisInstance } from '../event-bus/index.js'; import { _deleteQueue } from './_/_delete-queue.js'; import { _getQueueProperties } from './_/_get-queue-properties.js'; import { _getQueues } from './_/_get-queues.js'; diff --git a/tests/common/event-bus-redis.ts b/tests/common/event-bus-redis.ts index fe16a6b7..cc40e758 100644 --- a/tests/common/event-bus-redis.ts +++ b/tests/common/event-bus-redis.ts @@ -8,7 +8,7 @@ */ import bluebird from 'bluebird'; -import { EventBusRedisInstance } from '../../src/lib/event-bus/event-bus-redis-instance.js'; +import { EventBusRedisInstance } from '../../src/lib/index.js'; const eventBus = bluebird.promisifyAll(new EventBusRedisInstance()); diff --git a/tests/common/schedule-worker.ts b/tests/common/schedule-worker.ts index e1ebbfcb..c497b63f 100644 --- a/tests/common/schedule-worker.ts +++ b/tests/common/schedule-worker.ts @@ -9,7 +9,7 @@ import bluebird from 'bluebird'; import { Runnable } from 'redis-smq-common'; -import { Configuration } from '../../src/config/configuration.js'; +import { Configuration } from '../../src/config/index.js'; import PublishScheduledWorker from '../../src/lib/consumer/workers/publish-scheduled.worker.js'; let scheduleWorker: Runnable> | null = null; diff --git a/tests/tests/consuming-messages/test00010.test.ts b/tests/tests/consuming-messages/test00010.test.ts index b47062a8..a68b4c1b 100644 --- a/tests/tests/consuming-messages/test00010.test.ts +++ b/tests/tests/consuming-messages/test00010.test.ts @@ -9,7 +9,7 @@ import { test, jest } from '@jest/globals'; import { ICallback } from 'redis-smq-common'; -import { IMessageTransferable } from '../../../src/lib/message/types/message.js'; +import { IMessageTransferable } from '../../../src/lib/index.js'; import { getConsumer } from '../../common/consumer.js'; import { untilMessageAcknowledged } from '../../common/events.js'; import { diff --git a/tests/tests/workers/test00001.test.ts b/tests/tests/workers/test00001.test.ts index de0f4a9e..306db12e 100644 --- a/tests/tests/workers/test00001.test.ts +++ b/tests/tests/workers/test00001.test.ts @@ -9,7 +9,7 @@ import { test, expect, jest } from '@jest/globals'; import bluebird from 'bluebird'; -import { Configuration } from '../../../src/config/configuration.js'; +import { Configuration } from '../../../src/config/index.js'; import { IMessageParams, IMessageTransferable, diff --git a/tests/tests/workers/test00002.test.ts b/tests/tests/workers/test00002.test.ts index 3c94fcfb..237983ac 100644 --- a/tests/tests/workers/test00002.test.ts +++ b/tests/tests/workers/test00002.test.ts @@ -9,7 +9,7 @@ import { test, expect, jest } from '@jest/globals'; import bluebird from 'bluebird'; -import { Configuration } from '../../../src/config/configuration.js'; +import { Configuration } from '../../../src/config/index.js'; import { IMessageParams, IMessageTransferable, diff --git a/tests/tests/workers/test00003.test.ts b/tests/tests/workers/test00003.test.ts index 8a2fa5bd..dbc01ed1 100644 --- a/tests/tests/workers/test00003.test.ts +++ b/tests/tests/workers/test00003.test.ts @@ -9,7 +9,7 @@ import { test, expect } from '@jest/globals'; import bluebird from 'bluebird'; -import { Configuration } from '../../../src/config/configuration.js'; +import { Configuration } from '../../../src/config/index.js'; import RequeueUnacknowledgedWorker from '../../../src/lib/consumer/workers/requeue-unacknowledged.worker.js'; import WatchConsumersWorker from '../../../src/lib/consumer/workers/watch-consumers.worker.js'; import {