UNPKG

redis-smq

Version:

A simple high-performance Redis message queue for Node.js.

23 lines 889 B
import { redisKeys } from '../../../../common/redis-keys/redis-keys.js'; import { Configuration } from '../../../../config/index.js'; import { ExchangeInvalidTopicParamsError } from '../../errors/index.js'; export function _getTopicExchangeParams(topic) { const config = Configuration.getSetConfig(); const topicParams = typeof topic === 'string' ? { topic: topic, ns: config.namespace, } : topic; const vTopic = redisKeys.validateRedisKey(topicParams.topic); if (vTopic instanceof Error) return new ExchangeInvalidTopicParamsError(); const vNamespace = redisKeys.validateNamespace(topicParams.ns); if (vNamespace instanceof Error) return new ExchangeInvalidTopicParamsError(); return { topic: vTopic, ns: vNamespace, }; } //# sourceMappingURL=_get-topic-exchange-params.js.map