@sap-ux/app-config-writer 0.4.36 → 0.4.37
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 +1 -1
- package/dist/index.js +2 -1
- package/dist/prompt/index.d.ts +1 -1
- package/dist/prompt/index.js +2 -1
- package/dist/prompt/navigation-config.d.ts +12 -0
- package/dist/prompt/navigation-config.js +17 -4
- package/dist/translations/navigation-config.json +2 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/navigation.d.ts +2 -0
- package/dist/types/navigation.js +3 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getSmartLinksTargetFromPrompt, promptInboundNavigationConfig } from './prompt';
|
|
1
|
+
export { getSmartLinksTargetFromPrompt, promptInboundNavigationConfig, validateText } from './prompt';
|
|
2
2
|
export { generateSmartLinksConfig } from './smartlinks-config';
|
|
3
3
|
export { generateInboundNavigationConfig } from './navigation-config';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateInboundNavigationConfig = exports.generateSmartLinksConfig = exports.promptInboundNavigationConfig = exports.getSmartLinksTargetFromPrompt = void 0;
|
|
3
|
+
exports.generateInboundNavigationConfig = exports.generateSmartLinksConfig = exports.validateText = exports.promptInboundNavigationConfig = exports.getSmartLinksTargetFromPrompt = void 0;
|
|
4
4
|
var prompt_1 = require("./prompt");
|
|
5
5
|
Object.defineProperty(exports, "getSmartLinksTargetFromPrompt", { enumerable: true, get: function () { return prompt_1.getSmartLinksTargetFromPrompt; } });
|
|
6
6
|
Object.defineProperty(exports, "promptInboundNavigationConfig", { enumerable: true, get: function () { return prompt_1.promptInboundNavigationConfig; } });
|
|
7
|
+
Object.defineProperty(exports, "validateText", { enumerable: true, get: function () { return prompt_1.validateText; } });
|
|
7
8
|
var smartlinks_config_1 = require("./smartlinks-config");
|
|
8
9
|
Object.defineProperty(exports, "generateSmartLinksConfig", { enumerable: true, get: function () { return smartlinks_config_1.generateSmartLinksConfig; } });
|
|
9
10
|
var navigation_config_1 = require("./navigation-config");
|
package/dist/prompt/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { getSmartLinksTargetFromPrompt, promptUserPass } from './smartlinks-config';
|
|
2
|
-
export { promptInboundNavigationConfig } from './navigation-config';
|
|
2
|
+
export { promptInboundNavigationConfig, validateText } from './navigation-config';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/prompt/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptInboundNavigationConfig = exports.promptUserPass = exports.getSmartLinksTargetFromPrompt = void 0;
|
|
3
|
+
exports.validateText = exports.promptInboundNavigationConfig = exports.promptUserPass = exports.getSmartLinksTargetFromPrompt = void 0;
|
|
4
4
|
var smartlinks_config_1 = require("./smartlinks-config");
|
|
5
5
|
Object.defineProperty(exports, "getSmartLinksTargetFromPrompt", { enumerable: true, get: function () { return smartlinks_config_1.getSmartLinksTargetFromPrompt; } });
|
|
6
6
|
Object.defineProperty(exports, "promptUserPass", { enumerable: true, get: function () { return smartlinks_config_1.promptUserPass; } });
|
|
7
7
|
var navigation_config_1 = require("./navigation-config");
|
|
8
8
|
Object.defineProperty(exports, "promptInboundNavigationConfig", { enumerable: true, get: function () { return navigation_config_1.promptInboundNavigationConfig; } });
|
|
9
|
+
Object.defineProperty(exports, "validateText", { enumerable: true, get: function () { return navigation_config_1.validateText; } });
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
2
2
|
import type { Editor } from 'mem-fs-editor';
|
|
3
|
+
import type { AllowedCharacters } from '../types/';
|
|
3
4
|
/**
|
|
4
5
|
* Prompt for inbound navigation configuration values.
|
|
5
6
|
*
|
|
@@ -10,4 +11,15 @@ export declare function promptInboundNavigationConfig(basePath: string): Promise
|
|
|
10
11
|
config: ManifestNamespace.Inbound[string] | undefined;
|
|
11
12
|
fs: Editor;
|
|
12
13
|
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Validates that text input does not have zero length and optionally is less than the specified maximum length.
|
|
16
|
+
* Returns an end user message if validation fails.
|
|
17
|
+
*
|
|
18
|
+
* @param input the text input to validate
|
|
19
|
+
* @param inputName the name of the input as seen by the user
|
|
20
|
+
* @param maxLength optional, the maximum length of text to allow
|
|
21
|
+
* @param allowedCharacters optional, define a list of special characters that should be allowed in the input field
|
|
22
|
+
* @returns true, if all validation checks pass or a message explaining the validation failure
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateText(input: string, inputName: string, maxLength?: number, allowedCharacters?: AllowedCharacters[]): boolean | string;
|
|
13
25
|
//# sourceMappingURL=navigation-config.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptInboundNavigationConfig = void 0;
|
|
3
|
+
exports.validateText = exports.promptInboundNavigationConfig = void 0;
|
|
4
4
|
const prompts_1 = require("prompts");
|
|
5
5
|
const i18n_1 = require("../i18n");
|
|
6
6
|
const mem_fs_1 = require("mem-fs");
|
|
@@ -39,9 +39,10 @@ exports.promptInboundNavigationConfig = promptInboundNavigationConfig;
|
|
|
39
39
|
* @param input the text input to validate
|
|
40
40
|
* @param inputName the name of the input as seen by the user
|
|
41
41
|
* @param maxLength optional, the maximum length of text to allow
|
|
42
|
+
* @param allowedCharacters optional, define a list of special characters that should be allowed in the input field
|
|
42
43
|
* @returns true, if all validation checks pass or a message explaining the validation failure
|
|
43
44
|
*/
|
|
44
|
-
function validateText(input, inputName, maxLength = 0) {
|
|
45
|
+
function validateText(input, inputName, maxLength = 0, allowedCharacters) {
|
|
45
46
|
if (input?.trim().length === 0) {
|
|
46
47
|
return (0, i18n_1.t)('prompt.validationWarning.inputRequired', {
|
|
47
48
|
inputName,
|
|
@@ -51,8 +52,20 @@ function validateText(input, inputName, maxLength = 0) {
|
|
|
51
52
|
if (maxLength && input.length > maxLength) {
|
|
52
53
|
return (0, i18n_1.t)('prompt.validationWarning.maxLength', { maxLength, ns: i18n_1.NAV_CONFIG_NS });
|
|
53
54
|
}
|
|
55
|
+
// Asterisks is supported for the semantic object and action field but not the inbound title
|
|
56
|
+
if (allowedCharacters) {
|
|
57
|
+
const escapedChars = allowedCharacters.map((char) => `\\${char}`).join('');
|
|
58
|
+
const regex = new RegExp(`^[a-zA-Z0-9${escapedChars}]+$`);
|
|
59
|
+
if (!regex.test(input)) {
|
|
60
|
+
return (0, i18n_1.t)('prompt.validationWarning.supportedFormats', {
|
|
61
|
+
ns: i18n_1.NAV_CONFIG_NS,
|
|
62
|
+
allowedCharacters: allowedCharacters.join('')
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
54
66
|
return true;
|
|
55
67
|
}
|
|
68
|
+
exports.validateText = validateText;
|
|
56
69
|
/**
|
|
57
70
|
* Get the prompts for inbound navigation configuration.
|
|
58
71
|
*
|
|
@@ -69,14 +82,14 @@ function getPrompts(inboundKeys) {
|
|
|
69
82
|
type: 'text',
|
|
70
83
|
message: semanticObjectInputMsg,
|
|
71
84
|
format: (val) => val?.trim(),
|
|
72
|
-
validate: (val) => validateText(val, semanticObjectInputMsg, 30)
|
|
85
|
+
validate: (val) => validateText(val, semanticObjectInputMsg, 30, ['_'])
|
|
73
86
|
},
|
|
74
87
|
{
|
|
75
88
|
name: 'action',
|
|
76
89
|
type: 'text',
|
|
77
90
|
message: actionInputMsg,
|
|
78
91
|
format: (val) => val?.trim(),
|
|
79
|
-
validate: (val) => validateText(val, actionInputMsg, 60)
|
|
92
|
+
validate: (val) => validateText(val, actionInputMsg, 60, ['_'])
|
|
80
93
|
},
|
|
81
94
|
{
|
|
82
95
|
type: (prev, values) => inboundKeys.indexOf(`${values.semanticObject}-${values.action}`) > -1 ? 'confirm' : false,
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
"prompt": {
|
|
8
8
|
"validationWarning": {
|
|
9
9
|
"inputRequired": "{{inputName}} input is required",
|
|
10
|
-
"maxLength": "Maximum length: {{maxLength}} characters"
|
|
10
|
+
"maxLength": "Maximum length: {{maxLength}} characters",
|
|
11
|
+
"supportedFormats": "Only alphanumeric and '{{allowedCharacters}}' characters are allowed"
|
|
11
12
|
},
|
|
12
13
|
"message": {
|
|
13
14
|
"semanticObject": "Semantic Object",
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./smartLinks"), exports);
|
|
18
|
+
__exportStar(require("./navigation"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/app-config-writer",
|
|
3
3
|
"description": "Add or update configuration for SAP Fiori tools application",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.37",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"mem-fs": "2.1.0",
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
28
|
"prompts": "2.4.2",
|
|
29
|
+
"@sap-ux/project-access": "1.27.5",
|
|
29
30
|
"@sap-ux/axios-extension": "1.16.6",
|
|
31
|
+
"@sap-ux/store": "0.9.1",
|
|
30
32
|
"@sap-ux/btp-utils": "0.15.2",
|
|
31
33
|
"@sap-ux/logger": "0.6.0",
|
|
32
|
-
"@sap-ux/project-access": "1.27.5",
|
|
33
|
-
"@sap-ux/store": "0.9.1",
|
|
34
34
|
"@sap-ux/ui5-config": "0.25.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|