UNPKG

ravendb

Version:
52 lines 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetClusterTopologyCommand = exports.ClusterTopologyResponse = void 0; const RavenCommand_js_1 = require("../../Http/RavenCommand.js"); const ClusterTopology_js_1 = require("../../Http/ClusterTopology.js"); const ObjectUtil_js_1 = require("../../Utility/ObjectUtil.js"); class ClusterTopologyResponse { leader; nodeTag; serverRole; topology; etag; status; } exports.ClusterTopologyResponse = ClusterTopologyResponse; class GetClusterTopologyCommand extends RavenCommand_js_1.RavenCommand { _debugTag; constructor(debugTag) { super(); this._debugTag = debugTag; } createRequest(node) { let uri = node.url + "/cluster/topology"; if (this._debugTag) { uri += "?" + this._debugTag; } return { uri }; } async setResponseAsync(bodyStream, fromCache) { if (!bodyStream) { this._throwInvalidResponse(); } let body = null; const result = await this._pipeline() .collectBody(b => body = b) .parseJsonSync() .objectKeysTransform({ defaultTransform: ObjectUtil_js_1.ObjectUtil.camel, ignorePaths: [/topology\.(members|promotables|watchers|allNodes)\./i] }) .process(bodyStream); const clusterTpl = Object.assign(new ClusterTopology_js_1.ClusterTopology(), result.topology); this.result = Object.assign(result, { topology: clusterTpl }); this.result.status = new Map(Object.entries(this.result.status)); return body; } get isReadRequest() { return true; } } exports.GetClusterTopologyCommand = GetClusterTopologyCommand; //# sourceMappingURL=GetClusterTopologyCommand.js.map