/*
function dumpLoadOption that return a Promise object. This function will be called
if the "-l" option given in command line. Reading the json file, and doing some
checks. When done, simply calling storeJob function to add the json file content.
function dumpLoadOption() {
    let p = new Promise((resolve, reject) => {
        let file = jsonfile.readFileSync(program.dumpload);
        let fileContent = [];
        if (file.hasOwnProperty("rows") && file.rows instanceof Object && file) {
            if (!Array.isArray(file.rows))
                fileContent.push(file.rows);
            else
                fileContent = file.rows;
        }
        else if (Array.isArray(file))
            fileContent = file;
        else
            logger_1.logger.log('warn', `dump from JSON file failed, not a JSON format, please refer to the documentation`);
        if (fileContent.length > 0) {
            logger_1.logger.log('info', `Starting load dump file of ${program.dumpload}...`);
            storeJob(fileContent).on('storeDone', () => {
                logger_1.logger.log('success', `Load dumping from ${program.dumpload} file to ${nameDB} database succeed\n`);
                resolve();
            })
                .on('storeError', (err) => {
                logger_1.logger.log('error', `Load dumping from ${program.dumpload} failed \n ${err}`);
                reject();
            });
        }
        else {
            logger_1.logger.log('warn', `Empty file detected`);
            reject();
        }
    });
    return p;
}