reveal-sdk-node
Version:
RevealBI Node.js SDK
89 lines (88 loc) • 3.17 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RVElasticsearchDataSourceItem = void 0;
const RVDataSourceItem_1 = require("../AbstractClasses/RVDataSourceItem");
const RVElasticsearchDataSource_1 = require("./RVElasticsearchDataSource");
/** Elasticsearch data source item */
class RVElasticsearchDataSourceItem extends RVDataSourceItem_1.RVDataSourceItem {
/** @hidden */
constructor(arg) {
super(arg);
this._index = null;
this._fieldMultiValueLeniency = null;
// @if SERVER_SDK
this._customQuery = null;
this._customQueryParameters = null;
// @endif
this._processDataOnServer = true;
if (!(arg instanceof RVElasticsearchDataSource_1.RVElasticsearchDataSource)) {
let props = arg.Properties;
this._index = props["Table"];
this._fieldMultiValueLeniency = props["FieldMultiValueLeniency"];
// @if SERVER_SDK
this.deserializeCustomQuerySupport(arg, true);
// @endif
this._processDataOnServer = props["ServerAggregation"] === true;
}
}
/**
* The name of the Elasticsearch index to query.
*/
get index() {
return this._index;
}
set index(value) {
this._index = value;
}
/**
* (Optional) Controls behavior when SQL queries encounter fields with multiple values.
* If false, an error is returned for fields containing array values.
* If true, returns the first value from the array with no guarantee of consistent ordering.
* Defaults to `false`.
*/
get fieldMultiValueLeniency() {
return this._fieldMultiValueLeniency;
}
set fieldMultiValueLeniency(value) {
this._fieldMultiValueLeniency = value;
}
/**
* (Optional) Custom Elasticsearch SQL query to execute instead of using the default index query.
*/
get customQuery() {
return this._customQuery;
}
set customQuery(value) {
this._customQuery = value;
}
get customQueryParameters() {
return this._customQueryParameters;
}
set customQueryParameters(value) {
this._customQueryParameters = 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 */
toJson() {
let json = super.toJson();
let props = json['Properties'];
props["Table"] = this._index;
props["FieldMultiValueLeniency"] = this._fieldMultiValueLeniency;
// @if SERVER_SDK
this.serializeCustomQuerySupport(json, true);
// @endif
props['ServerAggregation'] = this._processDataOnServer;
return json;
}
/** @hidden */
getType() {
return "RVElasticsearchDataSourceItem";
}
}
exports.RVElasticsearchDataSourceItem = RVElasticsearchDataSourceItem;