UNPKG

@sap-ux/system-access

Version:

Reusable module allowing to access systems using the store or prompts.

68 lines 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.inquirer = exports.questions = void 0; const store_1 = require("@sap-ux/store"); const fs_1 = require("fs"); const authType = { type: 'autocomplete', name: 'authType', message: 'Type of authentication:', choices: [ { title: 'Basic authentication', value: store_1.AuthenticationType.Basic }, { title: 'SAP reentrance tickets', value: store_1.AuthenticationType.ReentranceTicket } ] }; const username = { type: 'text', name: 'username', message: 'Username:' }; const password = { type: 'password', name: 'password', message: 'Password:' }; const serviceKeysPath = { type: 'text', name: 'path', message: 'Please provide the service keys as file:', validate: (input) => (0, fs_1.existsSync)(input) }; const storeCredentials = { type: 'confirm', name: 'store', message: 'Do you want to store your credentials in the secure storage?', initial: true }; const systemName = { type: 'text', name: 'name', message: 'System name:', validate: (input) => !!input }; /** * Export map of questions for usage with the prompts modules */ exports.questions = { authType, username, password, serviceKeysPath, storeCredentials, systemName }; /** * Generate a map of questions for usages with inquirer (e.g. in yeoman) */ exports.inquirer = {}; for (const key in exports.questions) { const question = exports.questions[key]; exports.inquirer[key] = { type: question.type === 'text' ? 'input' : question.type, name: question.name, message: question.message, validate: question.validate, default: question.initial }; } //# sourceMappingURL=prompts.js.map