UNPKG

redis-smq

Version:

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

26 lines 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._getTopicExchangeParams = _getTopicExchangeParams; const redis_keys_js_1 = require("../../../../common/redis-keys/redis-keys.js"); const index_js_1 = require("../../../../config/index.js"); const index_js_2 = require("../../errors/index.js"); function _getTopicExchangeParams(topic) { const config = index_js_1.Configuration.getSetConfig(); const topicParams = typeof topic === 'string' ? { topic: topic, ns: config.namespace, } : topic; const vTopic = redis_keys_js_1.redisKeys.validateRedisKey(topicParams.topic); if (vTopic instanceof Error) return new index_js_2.ExchangeInvalidTopicParamsError(); const vNamespace = redis_keys_js_1.redisKeys.validateNamespace(topicParams.ns); if (vNamespace instanceof Error) return new index_js_2.ExchangeInvalidTopicParamsError(); return { topic: vTopic, ns: vNamespace, }; } //# sourceMappingURL=_get-topic-exchange-params.js.map