ravendb
Version:
RavenDB client for Node.js
54 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RestoreBackupOperation = void 0;
const RavenCommand_js_1 = require("../../../Http/RavenCommand.js");
const index_js_1 = require("../../../Exceptions/index.js");
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;
}
}
exports.RestoreBackupOperation = RestoreBackupOperation;
class RestoreBackupCommand extends RavenCommand_js_1.RavenCommand {
_restoreConfiguration;
constructor(restoreConfiguration, nodeTag) {
super();
if (!restoreConfiguration) {
(0, index_js_1.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