ravendb
Version:
RavenDB client for Node.js
22 lines • 1.1 kB
JavaScript
import { TimeSeriesPolicy } from "./TimeSeriesPolicy.js";
import { TimeValue } from "../../../Primitives/TimeValue.js";
import { throwError } from "../../../Exceptions/index.js";
export class RawTimeSeriesPolicy extends TimeSeriesPolicy {
static POLICY_STRING = "rawpolicy"; // must be lower case
static DEFAULT_POLICY = new RawTimeSeriesPolicy();
constructor(retentionTime) {
if (retentionTime && retentionTime.compareTo(TimeValue.ZERO) <= 0) {
throwError("InvalidArgumentException", "Retention time must be greater than zero.");
}
super(RawTimeSeriesPolicy.POLICY_STRING, TimeValue.MAX_VALUE, retentionTime || TimeValue.MAX_VALUE);
this.aggregationTime = null; // hack - we need to class super here
}
static parse(policy) {
const result = new RawTimeSeriesPolicy();
result.name = policy.Name;
result.aggregationTime = TimeValue.parse(policy.AggregationTime);
result.retentionTime = TimeValue.parse(policy.RetentionTime);
return result;
}
}
//# sourceMappingURL=RawTimeSeriesPolicy.js.map