@sap-ux/inquirer-common 0.2.0 → 0.2.2

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
@@ -1,3 +1,4 @@
1
1
  export * from './prompts/utility';
2
2
  export * from './types';
3
+ export * from './prompts/helpers';
3
4
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./prompts/utility"), exports);
18
18
  __exportStar(require("./types"), exports);
19
+ __exportStar(require("./prompts/helpers"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ import type { PromptSeverityMessage, YUIQuestion } from '../types';
2
+ /**
3
+ * Extends an additionalMessages function.
4
+ *
5
+ * @param question - the question to which the validate function will be applied
6
+ * @param addMsgFunc - the additional messages function which will be applied to the question
7
+ * @returns the extended additional messages function
8
+ */
9
+ export declare function extendAdditionalMessages(question: YUIQuestion, addMsgFunc: PromptSeverityMessage): PromptSeverityMessage;
10
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extendAdditionalMessages = void 0;
4
+ /**
5
+ * Extends an additionalMessages function.
6
+ *
7
+ * @param question - the question to which the validate function will be applied
8
+ * @param addMsgFunc - the additional messages function which will be applied to the question
9
+ * @returns the extended additional messages function
10
+ */
11
+ function extendAdditionalMessages(question, addMsgFunc) {
12
+ const addMsgs = question.additionalMessages;
13
+ return (value, previousAnswers) => {
14
+ const extMsg = addMsgFunc(value, previousAnswers);
15
+ if (extMsg) {
16
+ return extMsg; // Extended prompt message is returned first
17
+ }
18
+ // Defer to the original function if a valid message was not returned from the extended version
19
+ return typeof addMsgs === 'function' ? addMsgs(value, previousAnswers) : undefined;
20
+ };
21
+ }
22
+ exports.extendAdditionalMessages = extendAdditionalMessages;
23
+ //# sourceMappingURL=helpers.js.map
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.2.0",
4
+ "version": "0.2.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -23,7 +23,7 @@
23
23
  "i18next": "23.5.1",
24
24
  "chalk": "4.1.2",
25
25
  "figures": "3.2.0",
26
- "@sap-ux/ui5-info": "0.3.2"
26
+ "@sap-ux/ui5-info": "0.3.3"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@sap-devx/yeoman-ui-types": "1.14.4",