reveal-sdk-node
Version:
RevealBI Node.js SDK
73 lines (72 loc) • 2.56 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RVMongoDBDataSourceItem = void 0;
const RVDataSourceItem_1 = require("../AbstractClasses/RVDataSourceItem");
const RVMongoDBDataSource_1 = require("./RVMongoDBDataSource");
/** MongoDB data source item. */
class RVMongoDBDataSourceItem extends RVDataSourceItem_1.RVDataSourceItem {
/** @hidden */
constructor(arg) {
super(arg !== null && arg !== void 0 ? arg : new RVMongoDBDataSource_1.RVMongoDBDataSource());
this._collection = null;
// @if SERVER_SDK
this._customQuery = null;
// @endif
this._processDataOnServer = true;
if (!(arg instanceof RVMongoDBDataSource_1.RVMongoDBDataSource)) {
var props = arg.Properties;
this._collection = props['Table'];
// @if SERVER_SDK
this._customQuery = props['RPCustomQuery'];
// @endif
this._processDataOnServer = props["ServerAggregation"] === true;
}
}
/** @hidden */
toJson() {
var json = super.toJson();
var props = json['Properties'];
props['Table'] = this._collection;
// @if SERVER_SDK
props['RPCustomQuery'] = this._customQuery;
// @endif
props['ServerAggregation'] = this._processDataOnServer;
return json;
}
/** Collection name for accessing the documents */
get collection() {
return this._collection;
}
set collection(value) {
this._collection = value;
}
/** (Optional) Custom MongoDB query to use when getting data */
get customQuery() {
return this._customQuery;
}
set customQuery(value) {
this._customQuery = value;
}
/** Configures if the "Process Data on Server" option is turned on for this item, defaults to "true" */
get processDataOnServer() {
return this._processDataOnServer;
}
set processDataOnServer(value) {
this._processDataOnServer = value;
}
/** @hidden */
getType() {
return "RVMongoDBDataSourceItem";
}
/** @hidden */
_getWrapper() {
var wrapper = super._getWrapper();
wrapper.collection(this.collection);
// @if SERVER_SDK
wrapper.customQuery(this.customQuery);
// @endif
wrapper.processDataOnServer(this.processDataOnServer);
return wrapper;
}
}
exports.RVMongoDBDataSourceItem = RVMongoDBDataSourceItem;