UNPKG

@configurator/ravendb

Version:
55 lines 2.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PutDatabaseSettingsOperation = void 0; const Exceptions_1 = require("../../../Exceptions"); const RavenCommand_1 = require("../../../Http/RavenCommand"); const RaftIdGenerator_1 = require("../../../Utility/RaftIdGenerator"); class PutDatabaseSettingsOperation { constructor(databaseName, configurationSettings) { if (!databaseName) { (0, Exceptions_1.throwError)("InvalidArgumentException", "DatabaseName cannot be null"); } this._databaseName = databaseName; if (!configurationSettings) { (0, Exceptions_1.throwError)("InvalidArgumentException", "ConfigurationSettings cannot be null"); } this._configurationSettings = configurationSettings; } get resultType() { return "CommandResult"; } getCommand(conventions) { return new PutDatabaseConfigurationSettingsCommand(this._configurationSettings, this._databaseName); } } exports.PutDatabaseSettingsOperation = PutDatabaseSettingsOperation; class PutDatabaseConfigurationSettingsCommand extends RavenCommand_1.RavenCommand { constructor(configurationSettings, databaseName) { super(); if (!databaseName) { (0, Exceptions_1.throwError)("InvalidArgumentException", "DatabaseName cannot be null"); } this._databaseName = databaseName; if (!configurationSettings) { (0, Exceptions_1.throwError)("InvalidArgumentException", "ConfigurationSettings cannot be null"); } this._configurationSettings = configurationSettings; } get isReadRequest() { return false; } getRaftUniqueRequestId() { return RaftIdGenerator_1.RaftIdGenerator.newId(); } createRequest(node) { const uri = node.url + "/databases/" + this._databaseName + "/admin/configuration/settings"; const body = this._serializer.serialize(this._configurationSettings); return { uri, method: "PUT", headers: this._headers().typeAppJson().build(), body }; } } //# sourceMappingURL=PutDatabaseSettingsOperation.js.map