UNPKG

ravendb

Version:
55 lines 1.86 kB
import { throwError } from "../../../Exceptions/index.js"; import { RaftIdGenerator } from "../../../Utility/RaftIdGenerator.js"; import { RavenCommand } from "../../../Http/RavenCommand.js"; export class ConfigureTimeSeriesPolicyOperation { _collection; _config; constructor(collection, config) { this._collection = collection; this._config = config; } getCommand(conventions) { return new ConfigureTimeSeriesPolicyCommand(this._collection, this._config); } get resultType() { return "CommandResult"; } } class ConfigureTimeSeriesPolicyCommand extends RavenCommand { _configuration; _collection; constructor(collection, configuration) { super(); if (!configuration) { throwError("InvalidArgumentException", "Configuration cannot be null"); } if (!collection) { throwError("InvalidArgumentException", "Collection cannot be null"); } this._configuration = configuration; this._collection = collection; } get isReadRequest() { return false; } createRequest(node) { const uri = node.url + "/databases/" + node.database + "/admin/timeseries/policy?collection=" + this._urlEncode(this._collection); const body = this._serializer.serialize(this._configuration.serialize()); return { method: "PUT", uri, body, headers: this._headers().typeAppJson().build() }; } async setResponseAsync(bodyStream, fromCache) { if (!bodyStream) { this._throwInvalidResponse(); } return this._parseResponseDefaultAsync(bodyStream); } getRaftUniqueRequestId() { return RaftIdGenerator.newId(); } } //# sourceMappingURL=ConfigureTimeSeriesPolicyOperation.js.map