@configurator/ravendb
Version:
RavenDB client for Node.js
50 lines • 1.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigureTimeSeriesOperation = void 0;
const Exceptions_1 = require("../../../Exceptions");
const RaftIdGenerator_1 = require("../../../Utility/RaftIdGenerator");
const RavenCommand_1 = require("../../../Http/RavenCommand");
class ConfigureTimeSeriesOperation {
constructor(configuration) {
if (!configuration) {
(0, Exceptions_1.throwError)("InvalidArgumentException", "Configuration cannot be null");
}
this._configuration = configuration;
}
get resultType() {
return "CommandResult";
}
getCommand(conventions) {
return new ConfigureTimeSeriesCommand(this._configuration);
}
}
exports.ConfigureTimeSeriesOperation = ConfigureTimeSeriesOperation;
class ConfigureTimeSeriesCommand extends RavenCommand_1.RavenCommand {
constructor(configuration) {
super();
this._configuration = configuration;
}
get isReadRequest() {
return false;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database + "/admin/timeseries/config";
const body = this._serializer.serialize(this._configuration.serialize());
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_1.RaftIdGenerator.newId();
}
}
//# sourceMappingURL=ConfigureTimeSeriesOperation.js.map