zcatalyst-cli
Version:
Command Line Tool for CATALYST
30 lines (29 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSpinnerTxt = void 0;
const getSpinnerTxt = (type) => (deployDetails, status) => {
var _a, _b;
const logs = [];
const processError = (_a = deployDetails.logs) === null || _a === void 0 ? void 0 : _a.processing_errors;
const validationError = (_b = deployDetails.logs) === null || _b === void 0 ? void 0 : _b.validation_errors;
if (processError) {
if (typeof processError === 'string') {
logs.push(`Error Message: ${processError}`);
}
else {
logs.push(`Error while processing "${processError.component}"`, `Error Message: ${processError.error_message}`);
}
}
if (validationError) {
logs.push('Error while validating : ');
logs.push(...validationError);
}
if (type === 'codedeck') {
return ['Status >> ' + (status ? status : deployDetails.status), ...logs].join('\n' + ' '.repeat(status ? 2 : 4));
}
return [
`${type === 'bundle' ? 'Export' : 'Import'} Project "${deployDetails.project_details.project_name}" ${status ? status : deployDetails.status.toLowerCase()}`,
...logs
].join('\n' + ' '.repeat(status ? 2 : 4));
};
exports.getSpinnerTxt = getSpinnerTxt;