@sap-ux/inquirer-common 0.6.13 → 0.6.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -4,5 +4,6 @@ export * from './prompts/helpers';
4
4
  export * from './error-handler/error-handler';
5
5
  export * from './prompts/cf-helper';
6
6
  export * from './telemetry/telemetry';
7
+ export * from './prompts/credentials';
7
8
  export { addi18nResourceBundle } from './i18n';
8
9
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ __exportStar(require("./prompts/helpers"), exports);
21
21
  __exportStar(require("./error-handler/error-handler"), exports);
22
22
  __exportStar(require("./prompts/cf-helper"), exports);
23
23
  __exportStar(require("./telemetry/telemetry"), exports);
24
+ __exportStar(require("./prompts/credentials"), exports);
24
25
  var i18n_1 = require("./i18n");
25
26
  Object.defineProperty(exports, "addi18nResourceBundle", { enumerable: true, get: function () { return i18n_1.addi18nResourceBundle; } });
26
27
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,14 @@
1
+ import type { YUIQuestion, ValidationLink } from '../types';
2
+ export type CredentialsAnswers = {
3
+ username: string;
4
+ password: string;
5
+ };
6
+ export type AdditionalValidation = (credentials: CredentialsAnswers) => Promise<ValidationLink | boolean | string>;
7
+ /**
8
+ * Prompts the user for credentials.
9
+ *
10
+ * @param {Function} additionalValidation - Optional callback function called in the validation phase of password prompt. Callback function should return a boolean or a message.
11
+ * @returns {Array} An array of prompts.
12
+ */
13
+ export declare function getCredentialsPrompts(additionalValidation?: AdditionalValidation): Promise<YUIQuestion<CredentialsAnswers>[]>;
14
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCredentialsPrompts = getCredentialsPrompts;
4
+ const i18n_1 = require("../i18n");
5
+ /**
6
+ * Prompts the user for credentials.
7
+ *
8
+ * @param {Function} additionalValidation - Optional callback function called in the validation phase of password prompt. Callback function should return a boolean or a message.
9
+ * @returns {Array} An array of prompts.
10
+ */
11
+ async function getCredentialsPrompts(additionalValidation) {
12
+ return [
13
+ {
14
+ type: 'input',
15
+ name: 'username',
16
+ message: (0, i18n_1.t)('prompts.username.message'),
17
+ guiOptions: {
18
+ mandatory: true
19
+ },
20
+ store: false,
21
+ validate: (value) => {
22
+ return value ? true : (0, i18n_1.t)('errors.cannotBeEmpty', { field: (0, i18n_1.t)('prompts.username.message') });
23
+ }
24
+ },
25
+ {
26
+ type: 'password',
27
+ guiType: 'login',
28
+ name: 'password',
29
+ message: (0, i18n_1.t)('prompts.password.message'),
30
+ mask: '*',
31
+ guiOptions: {
32
+ mandatory: true
33
+ },
34
+ store: false,
35
+ validate: async (value, answers) => {
36
+ if (!value) {
37
+ return (0, i18n_1.t)('errors.cannotBeEmpty', { field: (0, i18n_1.t)('prompts.password.message') });
38
+ }
39
+ if (!answers.username) {
40
+ return (0, i18n_1.t)('errors.cannotBeEmpty', { field: (0, i18n_1.t)('prompts.username.message') });
41
+ }
42
+ if (additionalValidation) {
43
+ return await additionalValidation({ username: answers.username, password: value });
44
+ }
45
+ return true;
46
+ }
47
+ }
48
+ ];
49
+ }
50
+ //# sourceMappingURL=credentials.js.map
@@ -1,4 +1,12 @@
1
1
  {
2
+ "prompts": {
3
+ "username": {
4
+ "message": "Username"
5
+ },
6
+ "password": {
7
+ "message": "Password"
8
+ }
9
+ },
2
10
  "ui5VersionLabels": {
3
11
  "maintained": "Maintained",
4
12
  "outOfMaintenance": "Out of maintenance",
@@ -37,7 +45,8 @@
37
45
  "systemConnectionValidationFailed": "A connection to the selected system could not be established.",
38
46
  "internalServerError": "Internal server error{{-errorMsg, addMsgWithColonFormatter}}",
39
47
  "badGateway": "Bad gateway{{- errorMsg, addMsgWithColonFormatter}}",
40
- "badRequest": "Bad request{{- errorMsg, addMsgWithColonFormatter}}"
48
+ "badRequest": "Bad request{{- errorMsg, addMsgWithColonFormatter}}",
49
+ "cannotBeEmpty": "{{- field}} cannot be empty."
41
50
  },
42
51
  "guidedAnswers": {
43
52
  "validationErrorHelpText": "Need help with this error?"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/inquirer-common",
3
3
  "description": "Commonly used shared functionality and types to support inquirer modules.",
4
- "version": "0.6.13",
4
+ "version": "0.6.15",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "@sap/cf-tools": "3.2.2",
23
- "axios": "1.7.4",
23
+ "axios": "1.7.9",
24
24
  "chalk": "4.1.2",
25
25
  "figures": "3.2.0",
26
26
  "fuzzy": "0.1.3",
@@ -30,9 +30,9 @@
30
30
  "semver": "7.5.4",
31
31
  "@sap-ux/btp-utils": "1.0.1",
32
32
  "@sap-ux/feature-toggle": "0.2.3",
33
- "@sap-ux/fiori-generator-shared": "0.7.26",
33
+ "@sap-ux/fiori-generator-shared": "0.7.28",
34
34
  "@sap-ux/guided-answers-helper": "0.2.1",
35
- "@sap-ux/telemetry": "0.5.58",
35
+ "@sap-ux/telemetry": "0.5.60",
36
36
  "@sap-ux/logger": "0.6.0",
37
37
  "@sap-ux/ui5-info": "0.8.3"
38
38
  },