All files / Cognigy-CLI/build/commands exportcsv.js

0% Statements 0/22
0% Branches 0/11
0% Functions 0/2
0% Lines 0/22

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                                                         
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.exportcsv = void 0;
const config_1 = __importDefault(require("../utils/config"));
const progressBar_1 = require("../utils/progressBar");
const flows_1 = require("../lib/flows");
const checks_1 = require("../utils/checks");
const stringUtils_1 = require("../utils/stringUtils");
const exportcsv = async ({ resourceType, resourceName, }) => {
    await (0, checks_1.checkProject)();
    await (0, checks_1.checkCreateDir)(config_1.default.agentDir);
    console.log(`Starting to export CSV from ${(0, stringUtils_1.upperFirst)(resourceType)} ${resourceName} ... \n`);
    (0, progressBar_1.startProgressBar)(100);
    switch (resourceType) {
        case 'flow':
            await (0, flows_1.exportFlowCSV)(resourceName, 100);
            break;
        default:
            console.log(`Resource type ${resourceType} can't be used for CSV export.`);
    }
    (0, progressBar_1.endProgressBar)();
    console.log(`\nWe've successfully exported the content of ${(0, stringUtils_1.upperFirst)(resourceType)} ${resourceName || ''} to CSV - Enjoy.`);
    return;
};
exports.exportcsv = exportcsv;