reveal-sdk-node
Version:
RevealBI Node.js SDK
77 lines (76 loc) • 2.66 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RVCsvDataSourceItem = void 0;
const RVResourceBasedDataSourceItem_1 = require("../AbstractClasses/RVResourceBasedDataSourceItem");
const RVCsvDataSource_1 = require("./RVCsvDataSource");
const RVDataSourceItem_1 = require("../AbstractClasses/RVDataSourceItem");
/**
* The data source item used to represent a dataset from a CSV file, it includes
* optional settings like the separator to use when parsing the data.
*/
class RVCsvDataSourceItem extends RVResourceBasedDataSourceItem_1.RVResourceBasedDataSourceItem {
/** @hidden */
constructor(arg) {
super(new RVCsvDataSource_1.RVCsvDataSource(), arg);
this._dateFormat = null;
this._encoding = null;
this._separator = null;
if (!(arg instanceof RVDataSourceItem_1.RVDataSourceItem)) {
var params = arg['Parameters'];
this._dateFormat = params["DateFormat"];
this._encoding = params["Encoding"];
this._separator = params["Separator"];
}
}
/** @hidden */
toJson() {
var json = super.toJson();
var props = json['Properties'];
props["DateFormat"] = this._dateFormat;
props["Encoding"] = this._encoding;
props["Separator"] = this._separator;
return json;
}
/**
* Optional date format to use when parsing/detecting date columns, if not specified Reveal
* will try to infer the date format to use for each column (if it detects the column
* is a date, date time or time column).
*/
get dateFormat() {
return this._dateFormat;
}
set dateFormat(value) {
this._dateFormat = value;
}
/**
* The encoding to use, if not specified Reveal will try to detect it automatically.
*/
get encoding() {
return this._encoding;
}
set encoding(value) {
this._encoding = value;
}
/**
* The separator to use, one of ',', ';', or 'TAB'. If not specified it will be detected automatically.
*/
get separator() {
return this._separator;
}
set separator(value) {
this._separator = value;
}
/** @hidden */
getType() {
return "RVCsvDataSourceItem";
}
/** @hidden */
_getWrapper() {
var wrapper = super._getWrapper();
wrapper.dateFormat(this.dateFormat);
wrapper.separator(this.separator);
wrapper.encoding(this.encoding);
return wrapper;
}
}
exports.RVCsvDataSourceItem = RVCsvDataSourceItem;