UNPKG

ravendb

Version:
88 lines 3.27 kB
import { IncludeBuilderBase } from "./IncludeBuilderBase.js"; import { TypeUtil } from "../../../Utility/TypeUtil.js"; import { TimeValue } from "../../../Primitives/TimeValue.js"; import { TIME_SERIES } from "../../../Constants.js"; export class QueryIncludeBuilder extends IncludeBuilderBase { constructor(conventions) { super(conventions); } includeCounter(pathOrName, name) { if (TypeUtil.isUndefined(name)) { this._includeCounter("", pathOrName); } else { this._includeCounterWithAlias(pathOrName, name); } return this; } includeCounters(pathOrNames, names) { if (TypeUtil.isUndefined(names)) { this._includeCounters("", pathOrNames); } else { this._includeCounterWithAlias(pathOrNames, names); } return this; } includeAllCounters(path) { if (arguments.length === 1) { this._includeAllCountersWithAlias(path); } else { this._includeAllCounters(""); } return this; } includeDocuments(path) { this._includeDocuments(path); return this; } includeTimeSeries(nameOrPathOrNames, fromOrNameOrType, toOrFromOrTimeOrCount, to) { if (TypeUtil.isArray(nameOrPathOrNames)) { if (TypeUtil.isNumber(toOrFromOrTimeOrCount)) { this._includeArrayOfTimeSeriesByRangeTypeAndCount(nameOrPathOrNames, fromOrNameOrType, toOrFromOrTimeOrCount); } else { // names + time this._includeArrayOfTimeSeriesByRangeTypeAndTime(nameOrPathOrNames, fromOrNameOrType, toOrFromOrTimeOrCount); } } else if (toOrFromOrTimeOrCount instanceof TimeValue) { this._includeTimeSeriesByRangeTypeAndTime("", nameOrPathOrNames, fromOrNameOrType, toOrFromOrTimeOrCount); } else if (TypeUtil.isNumber(toOrFromOrTimeOrCount)) { this._includeTimeSeriesByRangeTypeAndCount("", nameOrPathOrNames, fromOrNameOrType, toOrFromOrTimeOrCount); } else if (TypeUtil.isString(fromOrNameOrType)) { this._withAlias(); this._includeTimeSeriesFromTo(nameOrPathOrNames, fromOrNameOrType, toOrFromOrTimeOrCount, to); } else { this._includeTimeSeriesFromTo("", nameOrPathOrNames, fromOrNameOrType, toOrFromOrTimeOrCount); } return this; } includeCompareExchangeValue(path) { this._includeCompareExchangeValue(path); return this; } includeAllTimeSeries(type, timeOrCount) { if (TypeUtil.isNumber(timeOrCount)) { this._includeTimeSeriesByRangeTypeAndCount("", TIME_SERIES.ALL, type, timeOrCount); } else { this._includeTimeSeriesByRangeTypeAndTime("", TIME_SERIES.ALL, type, timeOrCount); } return this; } includeRevisions(pathOrDate) { if (TypeUtil.isString(pathOrDate)) { this._withAlias(); this._includeRevisionsByChangeVectors(pathOrDate); } else { this._includeRevisionsBefore(pathOrDate); } return this; } } //# sourceMappingURL=QueryIncludeBuilder.js.map