ravendb
Version:
RavenDB client for Node.js
54 lines • 1.69 kB
JavaScript
import { throwError } from "../../../Exceptions/index.js";
import { RaftIdGenerator } from "../../../Utility/RaftIdGenerator.js";
import { RavenCommand } from "../../../Http/RavenCommand.js";
export class RemoveTimeSeriesPolicyOperation {
_collection;
_name;
constructor(collection, name) {
if (!collection) {
throwError("InvalidArgumentException", "Name cannot be null");
}
if (!name) {
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);
}
}
class RemoveTimeSeriesPolicyCommand extends RavenCommand {
_collection;
_name;
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.newId();
}
}
//# sourceMappingURL=RemoveTimeSeriesPolicyOperation.js.map