UNPKG

ravendb

Version:
54 lines 1.74 kB
import { RavenCommand } from "../../../Http/RavenCommand.js"; import { RaftIdGenerator } from "../../../Utility/RaftIdGenerator.js"; import { throwError } from "../../../Exceptions/index.js"; export class ConfigureRevisionsOperation { _configuration; get resultType() { return "CommandResult"; } constructor(configuration) { if (!configuration) { throwError("InvalidArgumentException", "Configuration cannot be null"); } this._configuration = configuration; } getCommand(conventions) { return new ConfigureRevisionsCommand(this._configuration); } } export class ConfigureRevisionsCommand extends RavenCommand { _configuration; constructor(configuration) { super(); this._configuration = configuration; } get isReadRequest() { return false; } createRequest(node) { const uri = node.url + "/databases/" + node.database + "/admin/revisions/config"; const body = JSON.stringify(this._configuration.toRemoteFieldNames(), null, 0); return { uri, method: "POST", body }; } async setResponseAsync(bodyStream, fromCache) { if (!bodyStream) { this._throwInvalidResponse(); } let body = null; const results = await this._defaultPipeline(_ => body = _) .process(bodyStream); this.result = Object.assign(new ConfigureRevisionsOperationResult(), results); return body; } getRaftUniqueRequestId() { return RaftIdGenerator.newId(); } } export class ConfigureRevisionsOperationResult { raftCommandIndex; } //# sourceMappingURL=ConfigureRevisionsOperation.js.map