UNPKG

@forzalabs/remora

Version:

A powerful CLI tool for seamless data translation.

29 lines (28 loc) 1.33 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Affirm_1 = __importDefault(require("../../core/Affirm")); class FileCompilerClass { constructor() { this.compileProducer = (producer, source) => { (0, Affirm_1.default)(producer, `Invalid producer`); (0, Affirm_1.default)(source, `Invalid source`); (0, Affirm_1.default)(producer.settings.fileKey, `Missing required file key in producer settings`); (0, Affirm_1.default)(producer.settings.fileType, `Missing required file type in producer settings`); (0, Affirm_1.default)(!producer.measures || producer.measures.length === 0, `Cannot use "measure" with a producer linked to a file (only dimensions are allowed).`); const columns = producer.dimensions.map(x => ({ aliasInProducer: x.alias, nameInProducer: x.name, consumerAlias: null, consumerKey: null, owner: producer.name, dimension: x })); return columns; }; } } const FileCompiler = new FileCompilerClass(); exports.default = FileCompiler;