UNPKG

ravendb

Version:
58 lines 2.1 kB
import { throwError } from "../../../Exceptions/index.js"; import { RaftIdGenerator } from "../../../Utility/RaftIdGenerator.js"; import { StringUtil } from "../../../Utility/StringUtil.js"; import { RavenCommand } from "../../../Http/RavenCommand.js"; export class ConfigureTimeSeriesValueNamesOperation { _parameters; constructor(parameters) { if (!parameters) { throwError("InvalidArgumentException", "Parameters cannot be null"); } this._parameters = parameters; if (StringUtil.isNullOrEmpty(parameters.collection)) { throwError("InvalidArgumentException", "Collection cannot be null or empty"); } if (StringUtil.isNullOrEmpty(parameters.timeSeries)) { throwError("InvalidArgumentException", "TimeSeries cannot be null or empty"); } if (!parameters.valueNames || !parameters.valueNames.length) { throwError("InvalidArgumentException", "ValueNames cannot be null or empty"); } } get resultType() { return "CommandResult"; } getCommand(conventions) { return new ConfigureTimeSeriesValueNamesCommand(this._parameters); } } class ConfigureTimeSeriesValueNamesCommand extends RavenCommand { _parameters; constructor(parameters) { super(); this._parameters = parameters; } get isReadRequest() { return false; } createRequest(node) { const uri = node.url + "/databases/" + node.database + "/timeseries/names/config"; const body = this._serializer.serialize(this._parameters); return { uri, method: "POST", headers: this._headers().typeAppJson().build(), body }; } async setResponseAsync(bodyStream, fromCache) { if (!bodyStream) { this._throwInvalidResponse(); } return this._parseResponseDefaultAsync(bodyStream); } getRaftUniqueRequestId() { return RaftIdGenerator.newId(); } } //# sourceMappingURL=ConfigureTimeSeriesValueNamesOperation.js.map