UNPKG

@configurator/ravendb

Version:
53 lines 1.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UpdateExternalReplicationCommand = exports.UpdateExternalReplicationOperation = void 0; const RavenCommand_1 = require("../../../Http/RavenCommand"); const RaftIdGenerator_1 = require("../../../Utility/RaftIdGenerator"); const Exceptions_1 = require("../../../Exceptions"); class UpdateExternalReplicationOperation { constructor(newWatcher) { if (!newWatcher) { (0, Exceptions_1.throwError)("InvalidArgumentException", "NewWatcher cannot be null"); } this._newWatcher = newWatcher; } getCommand(conventions) { return new UpdateExternalReplicationCommand(this._newWatcher); } get resultType() { return "CommandResult"; } } exports.UpdateExternalReplicationOperation = UpdateExternalReplicationOperation; class UpdateExternalReplicationCommand extends RavenCommand_1.RavenCommand { constructor(newWatcher) { super(); this._newWatcher = newWatcher; } createRequest(node) { const uri = node.url + "/databases/" + node.database + "/admin/tasks/external-replication"; const headers = this._headers() .typeAppJson().build(); const body = this._serializer.serialize({ watcher: this._newWatcher }); return { method: "POST", uri, headers, body }; } get isReadRequest() { return false; } async setResponseAsync(bodyStream, fromCache) { if (!bodyStream) { this._throwInvalidResponse(); } return this._parseResponseDefaultAsync(bodyStream); } getRaftUniqueRequestId() { return RaftIdGenerator_1.RaftIdGenerator.newId(); } } exports.UpdateExternalReplicationCommand = UpdateExternalReplicationCommand; //# sourceMappingURL=UpdateExternalReplicationOperation.js.map