ryuu
Version:
Domo App Dev Studio CLI, The main tool used to create, edit, and publish app designs to Domo
46 lines • 1.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var login_1 = require("../util/login");
var design = require("../util/design");
var log_1 = require("../util/log");
var inquirer = require("inquirer");
module.exports = function (program) {
program
.command('undelete [id]')
.description('undelete a soft-deleted design')
.action(function (arg) {
var designId = design.getDesignId(arg, program.opts().manifest);
inquirer
.prompt([
{
type: 'confirm',
message: "Are you sure you want to undelete design with id: \n ".concat(designId, "\n ?"),
name: 'undelete',
default: true,
},
])
.then(function (answers) { return handleUserResponse(answers, designId); });
});
};
var handleUserResponse = function (answer, designId) {
if (answer.undelete) {
new login_1.Login()
.getClient()
.then(function (client) {
client
.unDeleteDesign(designId)
.then(function () { return log_1.log.ok('Undeleted design ' + designId); })
.catch(function () {
return log_1.log.fail('Unable to undelete design ' +
designId +
'. That id does not exist or you are not authorized to undelete it.');
})
.finally(process.exit);
})
.catch(log_1.log.notAuthenticated);
}
else {
log_1.log.fail('Undelete command aborted');
}
};
//# sourceMappingURL=undelete.js.map