UNPKG

radius-read

Version:

Realtime Dashboard

66 lines 2.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RequestPoolService = void 0; /** * Request Pool Service */ class RequestPoolService { /** * Creates an instance of RequestPoolService. */ constructor() { } /** * Adds a request to the request pool. * @param request */ static add(request) { this.requestPool.push(request); } /** * Removes a request from the request pool by its ReqId. * @param reqId */ static remove(reqId) { this.requestPool = this.requestPool.filter((req) => { var _a, _b, _c; return ((_b = (_a = req.ReqId) === null || _a === void 0 ? void 0 : _a.toString()) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== ((_c = reqId === null || reqId === void 0 ? void 0 : reqId.toString()) === null || _c === void 0 ? void 0 : _c.toLowerCase()); }); } /** * Clears all requests from the request pool. */ static clear() { this.requestPool = []; } /** * Gets the current request pool. * @returns */ static getPool() { return this.requestPool; } /** * Is the request with the specified ReqId pending? * @param reqId * @returns */ static isRequestPending(reqId) { return this.requestPool.some((req) => { var _a, _b, _c; return ((_b = (_a = req.ReqId) === null || _a === void 0 ? void 0 : _a.toString()) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === ((_c = reqId === null || reqId === void 0 ? void 0 : reqId.toString()) === null || _c === void 0 ? void 0 : _c.toLowerCase()); }); } /** * Gets the request object from the pool by its ReqId. * @param reqId * @returns */ static getRequestObject(reqId) { return this.requestPool.find((req) => { var _a, _b, _c; return ((_b = (_a = req.ReqId) === null || _a === void 0 ? void 0 : _a.toString()) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === ((_c = reqId === null || reqId === void 0 ? void 0 : reqId.toString()) === null || _c === void 0 ? void 0 : _c.toLowerCase()); }); } } exports.RequestPoolService = RequestPoolService; /** * Request pool to manage pending requests. * @date Jun 26, 2025 02:20:24 PM * @author Biswaranjan Nayak * * @private * @type {any[]} */ RequestPoolService.requestPool = []; //# sourceMappingURL=request.pool.service.js.map