UNPKG

reveal-sdk-node

Version:

RevealBI Node.js SDK

50 lines (49 loc) 2.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RVResourceBasedDataSourceItem = void 0; const RVDataSourceItem_1 = require("./RVDataSourceItem"); /** * The base abstract class representing a data source item getting data from a file (a resource). * This is the base class for CSV, Excel and JSON data source items. * It contains the reference to the resource item providing the file, for example a CSV file from a Web Resource URL * will be represented as a {@link RVCsvDataSourceItem} referencing a {@link RVWebResourceDataSourceItem} */ class RVResourceBasedDataSourceItem extends RVDataSourceItem_1.RVDataSourceItem { /** @hidden */ constructor(dataSource, arg) { var _a; super(arg instanceof RVDataSourceItem_1.RVDataSourceItem ? dataSource : arg); this._resourceItem = null; // note that the dataSource parameter, if the arg is a json, is discarded. It actually doesn't make sense to pass the dataSource, as it is expected to come in the json. But, language restrictions left us here. if (arg instanceof RVDataSourceItem_1.RVDataSourceItem) { this.resourceItem = arg; } else { this.resourceItem = (_a = RVDataSourceItem_1.RVDataSourceItem.dataSourceItemFactory) === null || _a === void 0 ? void 0 : _a.call(RVDataSourceItem_1.RVDataSourceItem, arg['ResourceItem']); } } /** @hidden */ toJson() { var json = super.toJson(); if (this._resourceItem) { json['ResourceItem'] = this._resourceItem.toJson(); } return json; } /** * The resource item used to get the data for the referenced file, must be an item from one of the resource providers: Sharepoint, Web Resource, REST API, etc. */ get resourceItem() { return this._resourceItem; } set resourceItem(value) { this._resourceItem = value; } /** * @hidden */ _getWrapper() { return super._getWrapper(true); } } exports.RVResourceBasedDataSourceItem = RVResourceBasedDataSourceItem;