ravendb
Version:
RavenDB client for Node.js
68 lines • 2.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigureRevisionsForConflictsResult = exports.ConfigureRevisionsForConflictsOperation = 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 ConfigureRevisionsForConflictsOperation {
_database;
_configuration;
constructor(database, configuration) {
this._database = database;
if (!configuration) {
(0, index_js_1.throwError)("InvalidArgumentException", "Configuration cannot be null");
}
this._configuration = configuration;
}
get resultType() {
return "CommandResult";
}
getCommand(conventions) {
return new ConfigureRevisionsForConflictsCommand(conventions, this._database, this._configuration);
}
}
exports.ConfigureRevisionsForConflictsOperation = ConfigureRevisionsForConflictsOperation;
class ConfigureRevisionsForConflictsCommand extends RavenCommand_js_1.RavenCommand {
_conventions;
_databaseName;
_configuration;
constructor(conventions, database, configuration) {
super();
if (!conventions) {
(0, index_js_1.throwError)("InvalidArgumentException", "Conventions cannot be null");
}
this._conventions = conventions;
if (!database) {
(0, index_js_1.throwError)("InvalidArgumentException", "Database cannot be null");
}
this._databaseName = database;
this._configuration = configuration;
}
createRequest(node) {
const uri = node.url + "/databases/" + this._databaseName + "/admin/revisions/conflicts/config";
const body = this._serializer.serialize(this._configuration);
return {
uri,
method: "POST",
headers: this._headers().typeAppJson().build(),
body
};
}
async setResponseAsync(bodyStream, fromCache) {
if (!bodyStream) {
this._throwInvalidResponse();
}
return this._parseResponseDefaultAsync(bodyStream);
}
get isReadRequest() {
return false;
}
getRaftUniqueRequestId() {
return RaftIdGenerator_js_1.RaftIdGenerator.newId();
}
}
class ConfigureRevisionsForConflictsResult {
raftCommandIndex;
}
exports.ConfigureRevisionsForConflictsResult = ConfigureRevisionsForConflictsResult;
//# sourceMappingURL=ConfigureRevisionsForConflictsOperation.js.map