UNPKG

redis-smq

Version:

A high-performance, reliable, and scalable message queue for Node.js.

20 lines 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._checkOperation = _checkOperation; const redis_smq_common_1 = require("redis-smq-common"); const index_js_1 = require("../types/index.js"); const _get_queue_state_js_1 = require("../../queue-state-manager/_/_get-queue-state.js"); const operation_registery_js_1 = require("../operation-registery.js"); function _checkOperation(client, queueParams, operation, cb) { (0, _get_queue_state_js_1._getQueueState)(client, queueParams, (err, queueState) => { var _a; if (err) return cb(err); if (!queueState) return cb(new redis_smq_common_1.CallbackEmptyReplyError()); const bitmask = (_a = operation_registery_js_1.operationRegistry[queueState.to]) !== null && _a !== void 0 ? _a : 0; const allowed = (bitmask & index_js_1.OperationBitmask[operation]) !== 0; cb(null, { allowed, currentQueueState: queueState.to }); }); } //# sourceMappingURL=_check-operation.js.map