@metacall/deploy
Version:
Tool for deploying into MetaCall FaaS platform.
60 lines (59 loc) • 1.96 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.consentSelection = exports.listSelection = exports.planSelection = exports.languageSelection = exports.fileSelection = exports.loginSelection = void 0;
const language_1 = require("@metacall/protocol/language");
const inquirer_1 = require("inquirer");
const loginSelection = (methods) => (0, inquirer_1.prompt)([
{
type: 'list',
name: 'method',
message: 'Select the login method',
choices: methods
}
]).then((res) => res.method);
exports.loginSelection = loginSelection;
const fileSelection = (message, files = []) => (0, inquirer_1.prompt)([
{
type: 'checkbox',
name: 'scripts',
message,
choices: files
}
]).then((res) => res.scripts);
exports.fileSelection = fileSelection;
const languageSelection = (languages = []) => (0, inquirer_1.prompt)([
{
type: 'checkbox',
name: 'langs',
message: 'Select languages to run on MetaCall',
choices: languages.map(lang => language_1.Languages[lang].displayName)
}
]).then((res) => res.langs.map(lang => language_1.DisplayNameToLanguageId[lang]));
exports.languageSelection = languageSelection;
const planSelection = (message, availablePlans) => (0, inquirer_1.prompt)([
{
type: 'list',
name: 'plan',
message,
choices: availablePlans
}
]).then((res) => res.plan);
exports.planSelection = planSelection;
const listSelection = (list, message) => (0, inquirer_1.prompt)([
{
type: 'list',
name: 'container',
message,
choices: list
}
]).then((res) => res.container);
exports.listSelection = listSelection;
const consentSelection = (message) => (0, inquirer_1.prompt)([
{
type: 'confirm',
name: 'consent',
message,
default: false
}
]).then((res) => res.consent);
exports.consentSelection = consentSelection;