ravendb
Version:
RavenDB client for Node.js
52 lines • 1.86 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DisableIndexCommand = exports.DisableIndexOperation = void 0;
const index_js_1 = require("../../../Exceptions/index.js");
const RavenCommand_js_1 = require("../../../Http/RavenCommand.js");
const RaftIdGenerator_js_1 = require("../../../Utility/RaftIdGenerator.js");
class DisableIndexOperation {
_indexName;
_clusterWide;
constructor(indexName, clusterWide = false) {
if (!indexName) {
(0, index_js_1.throwError)("InvalidArgumentException", "IndexName cannot be null");
}
this._indexName = indexName;
this._clusterWide = clusterWide;
}
getCommand(conventions) {
return new DisableIndexCommand(this._indexName, this._clusterWide);
}
get resultType() {
return "CommandResult";
}
}
exports.DisableIndexOperation = DisableIndexOperation;
class DisableIndexCommand extends RavenCommand_js_1.RavenCommand {
get isReadRequest() {
return false;
}
_indexName;
_clusterWide;
constructor(indexName, clusterWide) {
super();
if (!indexName) {
(0, index_js_1.throwError)("InvalidArgumentException", "IndexName cannot be null");
}
this._responseType = "Empty";
this._indexName = indexName;
this._clusterWide = clusterWide;
}
createRequest(node) {
const uri = node.url
+ "/databases/" + node.database
+ "/admin/indexes/disable?name=" + encodeURIComponent(this._indexName)
+ "&clusterWide=" + this._clusterWide;
return { method: "POST", uri };
}
getRaftUniqueRequestId() {
return RaftIdGenerator_js_1.RaftIdGenerator.newId();
}
}
exports.DisableIndexCommand = DisableIndexCommand;
//# sourceMappingURL=DisableIndexOperation.js.map