UNPKG

ravendb

Version:
50 lines 1.63 kB
import { throwError } from "../../Exceptions/index.js"; import { RavenCommand } from "../../Http/RavenCommand.js"; export class CompactDatabaseOperation { _compactSettings; constructor(compactSettings) { if (!compactSettings) { throwError("InvalidArgumentException", "CompactSettings cannot be null"); } this._compactSettings = compactSettings; } getCommand(conventions) { return new CompactDatabaseCommand(conventions, this._compactSettings); } get resultType() { return "OperationId"; } } export class CompactDatabaseCommand extends RavenCommand { _compactSettings; constructor(conventions, compactSettings) { super(); if (!conventions) { throwError("InvalidArgumentException", "Conventions cannot be null"); } if (!compactSettings) { throwError("InvalidArgumentException", "CompactSettings cannot be null"); } this._compactSettings = compactSettings; } createRequest(node) { const uri = node.url + "/admin/compact"; const body = this._serializer.serialize(this._compactSettings); return { method: "POST", body, uri, headers: this._headers().typeAppJson().build() }; } async setResponseAsync(bodyStream, fromCache) { if (!bodyStream) { this._throwInvalidResponse(); } return this._parseResponseDefaultAsync(bodyStream); } get isReadRequest() { return false; } } //# sourceMappingURL=CompactDatabaseOperation.js.map