UNPKG

ravendb

Version:
68 lines 2.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ModifyConflictSolverOperation = 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 ModifyConflictSolverOperation { _database; _collectionByScript; _resolveToLatest; constructor(database, collectionByScript, resolveToLatest) { this._database = database; this._collectionByScript = collectionByScript; this._resolveToLatest = resolveToLatest; } get resultType() { return "CommandResult"; } getCommand(conventions) { return new ModifyConflictSolverCommand(conventions, this._database, this._collectionByScript, this._resolveToLatest); } } exports.ModifyConflictSolverOperation = ModifyConflictSolverOperation; class ModifyConflictSolverCommand extends RavenCommand_js_1.RavenCommand { _database; _conventions; _collectionByScript; _resolveToLatest; constructor(conventions, database, collectionByScript, resolveToLatest) { super(); if (!conventions) { (0, index_js_1.throwError)("InvalidArgumentException", "Conventions cannot be null"); } if (!database) { (0, index_js_1.throwError)("InvalidArgumentException", "Database cannot be null"); } this._database = database; this._conventions = conventions; this._collectionByScript = collectionByScript; this._resolveToLatest = resolveToLatest || false; } createRequest(node) { const uri = node.url + "/admin/replication/conflicts/solver?name=" + encodeURIComponent(this._database); const body = this._serializer.serialize({ ResolveToLatest: this._resolveToLatest, ResolveByCollection: this._collectionByScript }); return { uri, method: "POST", headers: this._headers().typeAppJson().build(), body }; } get isReadRequest() { return false; } async setResponseAsync(bodyStream, fromCache) { if (!bodyStream) { this._throwInvalidResponse(); } return this._parseResponseDefaultAsync(bodyStream); } getRaftUniqueRequestId() { return RaftIdGenerator_js_1.RaftIdGenerator.newId(); } } //# sourceMappingURL=ModifyConflictSolverOperation.js.map