reveal-sdk-node
Version:
RevealBI Node.js SDK
104 lines (103 loc) • 4.41 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RVAzureCosmosDBDataSource = void 0;
const RVDashboardDataSource_1 = require("../AbstractClasses/RVDashboardDataSource");
const RVAzureCosmosDBConnectionMode_1 = require("./RVAzureCosmosDBConnectionMode");
/** Azure CosmosDB data source */
class RVAzureCosmosDBDataSource extends RVDashboardDataSource_1.RVDashboardDataSource {
constructor(json) {
var _a;
super(json);
this._accountEndpoint = null;
this._applicationRegion = null;
this._connectionMode = RVAzureCosmosDBConnectionMode_1.RVAzureCosmosDBConnectionMode.Gateway;
this._acceptAnyServerCertificate = false;
this._database = null;
this._processDataOnServerDefaultValue = false;
this._processDataOnServerReadOnly = false;
if (json) {
var props = json.Properties;
this._accountEndpoint = props['AccountEndpoint'];
this._applicationRegion = props['ApplicationRegion'];
this._connectionMode = props['ConnectionMode'] === 'Direct'
? RVAzureCosmosDBConnectionMode_1.RVAzureCosmosDBConnectionMode.Direct
: RVAzureCosmosDBConnectionMode_1.RVAzureCosmosDBConnectionMode.Gateway;
this._acceptAnyServerCertificate = (_a = props['AcceptAnyServerCertificate']) !== null && _a !== void 0 ? _a : false;
this._database = props['Database'];
this._processDataOnServerDefaultValue = props["ServerAggregationDefault"];
this._processDataOnServerReadOnly = props["ServerAggregationReadOnly"];
}
else {
this.processDataOnServerDefaultValue = true;
}
}
toJson() {
var json = super.toJson();
var props = json.Properties;
props['AccountEndpoint'] = this._accountEndpoint;
props['ApplicationRegion'] = this._applicationRegion;
props['ConnectionMode'] = this._connectionMode;
props['AcceptAnyServerCertificate'] = this._acceptAnyServerCertificate;
props['Database'] = this._database;
props["ServerAggregationDefault"] = this._processDataOnServerDefaultValue;
props["ServerAggregationReadOnly"] = this._processDataOnServerReadOnly;
return json;
}
getProviderKey() {
return 'AZURE_COSMOSDB';
}
/** Gets or sets the URI of the Azure CosmosDB account endpoint (e.g. https://myaccount.documents.azure.com:443/). */
get accountEndpoint() {
return this._accountEndpoint;
}
set accountEndpoint(value) {
this._accountEndpoint = value;
}
/** Gets or sets the preferred Azure region for read and write operations. Leave null to use the account default. */
get applicationRegion() {
return this._applicationRegion;
}
set applicationRegion(value) {
this._applicationRegion = value;
}
/** Gets or sets the connection mode used to communicate with the CosmosDB service. Defaults to Gateway. */
get connectionMode() {
return this._connectionMode;
}
set connectionMode(value) {
this._connectionMode = value;
}
/**
* When set to true, the HTTP client accepts any server certificate without validation.
* Useful in development or test environments with self-signed certificates. Do not use in production.
*/
get acceptAnyServerCertificate() {
return this._acceptAnyServerCertificate;
}
set acceptAnyServerCertificate(value) {
this._acceptAnyServerCertificate = value;
}
/** Gets or sets the name of the database to connect to. */
get database() {
return this._database;
}
set database(value) {
this._database = value;
}
get processDataOnServerDefaultValue() {
return this._processDataOnServerDefaultValue;
}
set processDataOnServerDefaultValue(value) {
this._processDataOnServerDefaultValue = value;
}
get processDataOnServerReadOnly() {
return this._processDataOnServerReadOnly;
}
set processDataOnServerReadOnly(value) {
this._processDataOnServerReadOnly = value;
}
getType() {
return "RVAzureCosmosDBDataSource";
}
}
exports.RVAzureCosmosDBDataSource = RVAzureCosmosDBDataSource;