UNPKG

@configurator/ravendb

Version:
49 lines 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToggleServerWideTaskStateOperation = void 0; const Exceptions_1 = require("../../../Exceptions"); const RavenCommand_1 = require("../../../Http/RavenCommand"); const RaftIdGenerator_1 = require("../../../Utility/RaftIdGenerator"); class ToggleServerWideTaskStateOperation { constructor(name, type, disable) { if (!name) { (0, Exceptions_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_1.RavenCommand { constructor(name, type, disable) { super(); if (!name) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Name cannot be null"); } this._name = name; this._type = type; this._disable = disable; } get isReadRequest() { return false; } getRaftUniqueRequestId() { return RaftIdGenerator_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