UNPKG

@configurator/ravendb

Version:
54 lines 1.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PutConnectionStringCommand = exports.PutConnectionStringOperation = void 0; const RavenCommand_1 = require("../../../Http/RavenCommand"); const RaftIdGenerator_1 = require("../../../Utility/RaftIdGenerator"); const Exceptions_1 = require("../../../Exceptions"); class PutConnectionStringOperation { constructor(connectionString) { this._connectionString = connectionString; } getCommand(conventions) { return new PutConnectionStringCommand(this._connectionString); } get resultType() { return "CommandResult"; } } exports.PutConnectionStringOperation = PutConnectionStringOperation; class PutConnectionStringCommand extends RavenCommand_1.RavenCommand { constructor(connectionString) { super(); if (!connectionString) { (0, Exceptions_1.throwError)("InvalidArgumentException", "ConnectionString cannot be null"); } this._connectionString = connectionString; } get isReadRequest() { return false; } createRequest(node) { const uri = node.url + "/databases/" + node.database + "/admin/connection-strings"; const headers = this._headers() .typeAppJson() .build(); const body = this._serializer.serialize(this._connectionString); return { method: "PUT", uri, headers, body }; } async setResponseAsync(bodyStream, fromCache) { if (!bodyStream) { this._throwInvalidResponse(); } return this._parseResponseDefaultAsync(bodyStream); } getRaftUniqueRequestId() { return RaftIdGenerator_1.RaftIdGenerator.newId(); } } exports.PutConnectionStringCommand = PutConnectionStringCommand; //# sourceMappingURL=PutConnectionStringOperation.js.map