UNPKG

ravendb

Version:
50 lines 1.59 kB
import { RavenCommand } from "../../../Http/RavenCommand.js"; import { throwError } from "../../../Exceptions/index.js"; export class RestoreBackupOperation { _restoreConfiguration; _nodeTag; constructor(restoreConfiguration, nodeTag) { this._restoreConfiguration = restoreConfiguration; this._nodeTag = nodeTag; } getCommand(conventions) { return new RestoreBackupCommand(this._restoreConfiguration, this._nodeTag); } get resultType() { return "OperationId"; } get nodeTag() { return this._nodeTag; } } class RestoreBackupCommand extends RavenCommand { _restoreConfiguration; constructor(restoreConfiguration, nodeTag) { super(); if (!restoreConfiguration) { throwError("InvalidArgumentException", "RestoreConfiguration cannot be null"); } this._restoreConfiguration = restoreConfiguration; this._selectedNodeTag = nodeTag; } get isReadRequest() { return false; } createRequest(node) { const uri = node.url + "/admin/restore/database"; const body = this._serializer.serialize(this._restoreConfiguration); return { uri, method: "POST", body, headers: this._headers().typeAppJson().build() }; } async setResponseAsync(bodyStream, fromCache) { if (!bodyStream) { this._throwInvalidResponse(); } return this._parseResponseDefaultAsync(bodyStream); } } //# sourceMappingURL=RestoreBackupOperation.js.map