UNPKG

reveal-sdk-node

Version:

RevealBI Node.js SDK

85 lines (84 loc) 4.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RVDateRange = exports.RVDateFilterType = exports.RVDateDashboardFilter = exports.RVPeriodType = exports.RVPeriodRelation = exports.RVDateRule = void 0; const RVDateRule_1 = require("./RVDateRule"); var RVDateRule_2 = require("./RVDateRule"); Object.defineProperty(exports, "RVDateRule", { enumerable: true, get: function () { return RVDateRule_2.RVDateRule; } }); var rvPeriodRelation_1 = require("./ts-sdk/rvPeriodRelation"); Object.defineProperty(exports, "RVPeriodRelation", { enumerable: true, get: function () { return rvPeriodRelation_1.RVPeriodRelation; } }); var rvPeriodType_1 = require("./ts-sdk/rvPeriodType"); Object.defineProperty(exports, "RVPeriodType", { enumerable: true, get: function () { return rvPeriodType_1.RVPeriodType; } }); class RVDateDashboardFilter { constructor(arg1, arg2, arg3) { this.filterType = RVDateFilterType.CustomRange; this.range = null; this.title = null; this.rule = null; // Case: new RVDateDashboardFilter(RVDateRule) if (arg1 instanceof RVDateRule_1.RVDateRule && arg2 === undefined) { this.filterType = RVDateFilterType.CustomRule; this.rule = arg1; } // Case: new RVDateDashboardFilter("My title", RVDateRule) else if (typeof arg1 === "string" && arg2 instanceof RVDateRule_1.RVDateRule) { this.title = arg1; this.filterType = RVDateFilterType.CustomRule; this.rule = arg2; } //Case: new RVDateDashboardFilter(title, RVDateFilterType, RVDateRange) else if (typeof arg1 === "string" && typeof arg2 === "number" && arg3 instanceof RVDateRange) { this.title = arg1; this.filterType = arg2; this.range = arg3; } // Case: new RVDateDashboardFilter("My title", RVDateFilterType) else if (typeof arg1 === "string" && typeof arg2 === "number") { this.title = arg1; this.filterType = arg2; } // Case: new RVDateDashboardFilter(RVDateFilterType.Range, new RVDateRange(...)) else if (typeof arg1 === "number" && arg2 instanceof RVDateRange) { this.filterType = arg1; this.range = arg2; } // Case: new RVDateDashboardFilter(RVDateFilterType) else if (typeof arg1 === "number" && arg2 === undefined) { this.filterType = arg1; } else { throw new Error("Invalid constructor arguments"); } } } exports.RVDateDashboardFilter = RVDateDashboardFilter; var RVDateFilterType; (function (RVDateFilterType) { RVDateFilterType[RVDateFilterType["AllTime"] = 0] = "AllTime"; RVDateFilterType[RVDateFilterType["CustomRange"] = 1] = "CustomRange"; RVDateFilterType[RVDateFilterType["LastWeek"] = 2] = "LastWeek"; RVDateFilterType[RVDateFilterType["LastMonth"] = 3] = "LastMonth"; RVDateFilterType[RVDateFilterType["LastYear"] = 4] = "LastYear"; RVDateFilterType[RVDateFilterType["YearToDate"] = 5] = "YearToDate"; RVDateFilterType[RVDateFilterType["QuarterToDate"] = 6] = "QuarterToDate"; RVDateFilterType[RVDateFilterType["MonthToDate"] = 7] = "MonthToDate"; RVDateFilterType[RVDateFilterType["Yesterday"] = 8] = "Yesterday"; RVDateFilterType[RVDateFilterType["Today"] = 9] = "Today"; RVDateFilterType[RVDateFilterType["ThisMonth"] = 10] = "ThisMonth"; RVDateFilterType[RVDateFilterType["ThisQuarter"] = 11] = "ThisQuarter"; RVDateFilterType[RVDateFilterType["ThisYear"] = 12] = "ThisYear"; RVDateFilterType[RVDateFilterType["PreviousMonth"] = 13] = "PreviousMonth"; RVDateFilterType[RVDateFilterType["PreviousQuarter"] = 14] = "PreviousQuarter"; RVDateFilterType[RVDateFilterType["PreviousYear"] = 15] = "PreviousYear"; RVDateFilterType[RVDateFilterType["NextMonth"] = 16] = "NextMonth"; RVDateFilterType[RVDateFilterType["NextQuarter"] = 17] = "NextQuarter"; RVDateFilterType[RVDateFilterType["NextYear"] = 18] = "NextYear"; RVDateFilterType[RVDateFilterType["TrailingTwelveMonths"] = 19] = "TrailingTwelveMonths"; RVDateFilterType[RVDateFilterType["CustomRule"] = 20] = "CustomRule"; })(RVDateFilterType = exports.RVDateFilterType || (exports.RVDateFilterType = {})); class RVDateRange { constructor(from, to) { this.from = from; this.to = to; } } exports.RVDateRange = RVDateRange;