reveal-sdk-node
Version:
RevealBI Node.js SDK
77 lines (76 loc) • 2.35 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RVSqlBasedDataSourceItem = void 0;
const RVDataSourceItem_1 = require("./RVDataSourceItem");
const RVDashboardDataSource_1 = require("./RVDashboardDataSource");
/**
* The base item class used to represent a dataset from one of the supported database systems.
*/
class RVSqlBasedDataSourceItem extends RVDataSourceItem_1.RVDataSourceItem {
/** @hidden */
constructor(arg) {
super(arg);
this._database = null;
this._table = null;
// @if SERVER_SDK
this._customQuery = null;
if (!(arg instanceof RVDashboardDataSource_1.RVDashboardDataSource)) {
var props = arg['Properties'];
this._database = props['Database'];
this._table = props['Table'];
// @if SERVER_SDK
this._customQuery = arg['Parameters']['RPCustomQuery'];
// @endif
}
}
/** @hidden */
toJson() {
var json = super.toJson();
var props = json['Properties'];
props['Database'] = this._database;
props['Table'] = this._table;
// @if SERVER_SDK
json['Parameters']['RPCustomQuery'] = this._customQuery;
// @endif
return json;
}
/**
* Name of the database to connect to, optional as this value is usually specified in the data source object.
*/
get database() {
return this._database;
}
set database(value) {
this._database = value;
}
/**
* Name of the table (or view) to get data from
*/
get table() {
return this._table;
}
set table(value) {
this._table = value;
}
/**
* (Optional) Custom SQL query to use when getting data
*/
get customQuery() {
return this._customQuery;
}
set customQuery(value) {
this._customQuery = value;
}
// @endif
/** @hidden */
_getWrapper() {
let wrapper = super._getWrapper();
wrapper.database(this.database);
wrapper.table(this.table);
// @if SERVER_SDK
wrapper.customQuery(this.customQuery);
// @endif
return wrapper;
}
}
exports.RVSqlBasedDataSourceItem = RVSqlBasedDataSourceItem;