@configurator/ravendb
Version:
RavenDB client for Node.js
54 lines • 1.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RemoveTimeSeriesPolicyOperation = void 0;
const Exceptions_1 = require("../../../Exceptions");
const RaftIdGenerator_1 = require("../../../Utility/RaftIdGenerator");
const RavenCommand_1 = require("../../../Http/RavenCommand");
class RemoveTimeSeriesPolicyOperation {
constructor(collection, name) {
if (!collection) {
(0, Exceptions_1.throwError)("InvalidArgumentException", "Name cannot be null");
}
if (!name) {
(0, Exceptions_1.throwError)("InvalidArgumentException", "Collection cannot be null");
}
this._collection = collection;
this._name = name;
}
get resultType() {
return "CommandResult";
}
getCommand(conventions) {
return new RemoveTimeSeriesPolicyCommand(this._collection, this._name);
}
}
exports.RemoveTimeSeriesPolicyOperation = RemoveTimeSeriesPolicyOperation;
class RemoveTimeSeriesPolicyCommand extends RavenCommand_1.RavenCommand {
constructor(collection, name) {
super();
this._collection = collection;
this._name = name;
}
get isReadRequest() {
return false;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database
+ "/admin/timeseries/policy?collection=" + this._urlEncode(this._collection)
+ "&name=" + this._urlEncode(this._name);
return {
method: "DELETE",
uri
};
}
async setResponseAsync(bodyStream, fromCache) {
if (!bodyStream) {
this._throwInvalidResponse();
}
return this._parseResponseDefaultAsync(bodyStream);
}
getRaftUniqueRequestId() {
return RaftIdGenerator_1.RaftIdGenerator.newId();
}
}
//# sourceMappingURL=RemoveTimeSeriesPolicyOperation.js.map