UNPKG

@viewdo/dxp-story-cli

Version:

DXP Story Management CLI

177 lines 7.52 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.OrganizationConfiguration = void 0; const class_transformer_1 = require("class-transformer"); const DataPoint_1 = require("./support/DataPoint"); const AssetDefinition_1 = require("../AssetDefinition"); const OrganizationEntity_1 = require("./support/OrganizationEntity"); const OrganizationService_1 = require("./support/OrganizationService"); const OrganizationSuppressionList_1 = require("./support/OrganizationSuppressionList"); const FlashboardConfiguration_1 = require("./FlashboardConfiguration"); /** * DXP ORGANIZATION CONFIG: * ----------------------------------------------------- * This file defines configurable organization settings hosted in the DXP platform. */ let OrganizationConfiguration = class OrganizationConfiguration { constructor() { /** * DXP model-type (read-only) */ this.kind = 'Organization'; /** * API version, model location (read-only) */ this.apiVersion = 'api.view.do/v1'; /** * These are extra data points that can live with the organization and be used across stories. * Note that they can differ by child entities. */ this.dataPoints = []; /** * Organizations can have sub-divisions that have alternative data-points. You can define child entities * here along with any data changes. */ this.entities = []; /** * These are the services configured for the organization. * The keys here are what you use in the story.actions configuration. */ this.services = []; /** * These are the services configured for the organization. These are read-only, as services must be * configured in the administration app. The keys here are what you use in the story.actions configuration. */ this.suppressionLists = []; this.scheduledDataSync = false; /** * These are secrets available to this organization. They can be used in Service configurations for example. */ this.secrets = []; /** * These are the flashboards configured for the organization. Note** the metric keys must be tied to an * existing story tied to the organization. */ this.flashboards = null; } /** @ignore */ get api_root() { return `/organizations/${this.from_key || this.key}`; } /** @ignore */ get local_root() { return this._local_root || `./organizations/${this.key}`; } /** @ignore */ set local_root(local_root) { this._local_root = local_root; } /** @ignore */ get assets_directory() { return `${this.local_root}/assets`; } /** @ignore */ get cdn_root() { return this.key; } getAssets(from_key, local_root) { this.from_key = from_key; if (local_root) this.local_root = local_root; return [ new AssetDefinition_1.AssetDefinition('scripts_html_file', 'Html Script File', `${this.local_root}/dashboard-scripts.html`, `${this.api_root}/script-file`, this.cdn_root), new AssetDefinition_1.AssetDefinition('flashboard_css_file', 'Flashboard CSS File', `${this.local_root}/flashboards.output.css`, `${this.api_root}/flashboard-css`, this.cdn_root, null, null, `${this.local_root}/flashboards.scss`) ]; } getExportPath() { return `${this.local_root}/organization-export.json`; } convertFromModel(organization) { Object.assign(this, organization); // organization.entities.forEach((e, i: number) => { // this.entities[i] = new OrganizationEntity(e) // }) // organization.dataPoints.forEach((e: DataPoint, i: number) => { // this.dataPoints[i] = new DataPoint(e) // }) return this; } }; exports.OrganizationConfiguration = OrganizationConfiguration; OrganizationConfiguration.file_name = 'organization-config'; __decorate([ (0, class_transformer_1.Expose)({ toPlainOnly: true }), __metadata("design:type", String) ], OrganizationConfiguration.prototype, "kind", void 0); __decorate([ (0, class_transformer_1.Expose)({ toPlainOnly: true }), __metadata("design:type", String) ], OrganizationConfiguration.prototype, "apiVersion", void 0); __decorate([ (0, class_transformer_1.Expose)(), __metadata("design:type", String) ], OrganizationConfiguration.prototype, "key", void 0); __decorate([ (0, class_transformer_1.Expose)(), __metadata("design:type", String) ], OrganizationConfiguration.prototype, "name", void 0); __decorate([ (0, class_transformer_1.Expose)(), __metadata("design:type", String) ], OrganizationConfiguration.prototype, "url", void 0); __decorate([ (0, class_transformer_1.Expose)(), (0, class_transformer_1.Type)(() => DataPoint_1.DataPoint), __metadata("design:type", Array) ], OrganizationConfiguration.prototype, "dataPoints", void 0); __decorate([ (0, class_transformer_1.Expose)(), (0, class_transformer_1.Type)(() => OrganizationEntity_1.OrganizationEntity), __metadata("design:type", Array) ], OrganizationConfiguration.prototype, "entities", void 0); __decorate([ (0, class_transformer_1.Expose)(), (0, class_transformer_1.Type)(() => OrganizationService_1.OrganizationService), __metadata("design:type", Array) ], OrganizationConfiguration.prototype, "services", void 0); __decorate([ (0, class_transformer_1.Expose)(), (0, class_transformer_1.Type)(() => OrganizationSuppressionList_1.OrganizationSuppressionList), __metadata("design:type", Array) ], OrganizationConfiguration.prototype, "suppressionLists", void 0); __decorate([ (0, class_transformer_1.Expose)(), __metadata("design:type", Boolean) ], OrganizationConfiguration.prototype, "scheduledDataSync", void 0); __decorate([ (0, class_transformer_1.Expose)(), __metadata("design:type", Array) ], OrganizationConfiguration.prototype, "secrets", void 0); __decorate([ (0, class_transformer_1.Expose)(), (0, class_transformer_1.Type)(() => FlashboardConfiguration_1.FlashboardConfiguration), __metadata("design:type", Array) ], OrganizationConfiguration.prototype, "flashboards", void 0); __decorate([ (0, class_transformer_1.Type)(() => Date), __metadata("design:type", Date /** @ignore */ ) ], OrganizationConfiguration.prototype, "updated", void 0); exports.OrganizationConfiguration = OrganizationConfiguration = __decorate([ (0, class_transformer_1.Exclude)() ], OrganizationConfiguration); //# sourceMappingURL=OrganizationConfiguration.js.map