UNPKG

@voximplant/voxengine-ci

Version:

Manage Voximplant Platform `applications`, `rules` and `scenarios` from your own environment

44 lines (43 loc) 1.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VoxRuleMetadata = exports.VoxRule = void 0; class VoxRule { constructor(ruleInfo) { this.ruleName = ruleInfo.ruleName; // TODO: Nodejs mapper error (snake_case to camelCase) // @ts-expect-error: Nodejs mapper error (snake_case to camelCase) // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment this.scenarios = ruleInfo.scenarios.map(({ scenario_name }) => { if (scenario_name) { // eslint-disable-next-line @typescript-eslint/no-unsafe-return return scenario_name; } }); this.rulePattern = ruleInfo.rulePattern; } } exports.VoxRule = VoxRule; class VoxRuleMetadata { constructor(ruleInfo) { this.ruleName = ruleInfo.ruleName; this.ruleId = ruleInfo.ruleId; this.scenarios = ruleInfo.scenarios.map( // TODO: Nodejs mapper error (snake_case to camelCase) // @ts-expect-error: Nodejs mapper error (snake_case to camelCase) ({ scenario_name, scenario_id }) => { if (scenario_name && scenario_id) { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment return { scenarioName: scenario_name, scenarioId: scenario_id }; } }); if (this.scenarios[0] === undefined) { this.scenarios = ruleInfo.scenarios.map(({ scenarioName, scenarioId }) => { if (scenarioName && scenarioId) { return { scenarioName, scenarioId }; } }); } this.rulePattern = ruleInfo.rulePattern; } } exports.VoxRuleMetadata = VoxRuleMetadata;