UNPKG

liveperson-functions-cli

Version:
51 lines 2.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UndeployController = void 0; const undeploy_view_1 = require("../../view/undeploy.view"); const deployment_controller_1 = require("./deployment.controller"); const file_service_1 = require("../../service/file.service"); class UndeployController extends deployment_controller_1.DeploymentController { constructor({ undeployView = new undeploy_view_1.UndeployView(), fileService = new file_service_1.FileService(), } = {}) { super(fileService); this.undeployView = undeployView; } /** * Gather informations about the passed functions depending on the flags and * starts the undeploy process. * @param {IUndeployConfig} { lambdaFunctions, inputFlags } * @returns {Promise<void>} - deploy view, which runs the deploy requests * @memberof UndeployController */ async undeploy({ lambdaFunctions, inputFlags, }) { try { const functionsToUndeploy = await this.collectLambdaInformationForAllLambdas(lambdaFunctions); let confirmedFunctionsToUndeploy = []; if (inputFlags === null || inputFlags === void 0 ? void 0 : inputFlags.yes) { confirmedFunctionsToUndeploy = functionsToUndeploy; } else { const answer = await this.undeployView.askForConfirmation(functionsToUndeploy); confirmedFunctionsToUndeploy = functionsToUndeploy.filter((entry) => answer[entry.name]); /* istanbul ignore else */ if (confirmedFunctionsToUndeploy.length === 0) { return; } } await this.undeployView.showDeployments({ confirmedFunctionsToUndeploy, noWatch: inputFlags === null || inputFlags === void 0 ? void 0 : inputFlags['no-watch'], }); } catch (error) { const prettyError = { message: error.message || error.errorMsg, suggestions: ['Use "lpf undeploy --help" for more information'], ref: 'https://github.com/LivePersonInc/faas-cli#undeploy', }; this.undeployView.showErrorMessage(prettyError); throw new Error('exit'); } } } exports.UndeployController = UndeployController; //# sourceMappingURL=undeploy.controller.js.map