@configurator/ravendb
Version:
RavenDB client for Node.js
44 lines • 1.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetClusterTopologyCommand = exports.ClusterTopologyResponse = void 0;
const RavenCommand_1 = require("../../Http/RavenCommand");
const ClusterTopology_1 = require("../../Http/ClusterTopology");
class ClusterTopologyResponse {
}
exports.ClusterTopologyResponse = ClusterTopologyResponse;
class GetClusterTopologyCommand extends RavenCommand_1.RavenCommand {
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: "camel",
ignorePaths: [/topology\.(members|promotables|watchers|allNodes)\./i]
})
.process(bodyStream);
const clusterTpl = Object.assign(new ClusterTopology_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