ravendb
Version:
RavenDB client for Node.js
55 lines • 1.82 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToggleServerWideTaskStateOperation = 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 ToggleServerWideTaskStateOperation {
_name;
_type;
_disable;
constructor(name, type, disable) {
if (!name) {
(0, index_js_1.throwError)("InvalidArgumentException", "Name cannot be null");
}
this._name = name;
this._type = type;
this._disable = disable;
}
get resultType() {
return "CommandResult";
}
getCommand(conventions) {
return new ToggleServerWideTaskStateCommand(this._name, this._type, this._disable);
}
}
exports.ToggleServerWideTaskStateOperation = ToggleServerWideTaskStateOperation;
class ToggleServerWideTaskStateCommand extends RavenCommand_js_1.RavenCommand {
_name;
_type;
_disable;
constructor(name, type, disable) {
super();
if (!name) {
(0, index_js_1.throwError)("InvalidArgumentException", "Name cannot be null");
}
this._name = name;
this._type = type;
this._disable = disable;
}
get isReadRequest() {
return false;
}
getRaftUniqueRequestId() {
return RaftIdGenerator_js_1.RaftIdGenerator.newId();
}
createRequest(node) {
const uri = node.url + "/admin/configuration/server-wide/state?type="
+ this._type + "&name=" + this._urlEncode(this._name) + "&disable=" + this._disable;
return {
uri,
method: "POST"
};
}
}
//# sourceMappingURL=ToggleServerWideTaskStateOperation.js.map