@sap-ux/fiori-generator-shared 0.13.21 → 0.13.23

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.
@@ -116,7 +116,7 @@ class LogWrapper {
116
116
  }
117
117
  LogWrapper._logLevel = logLevel === 'off' || !logLevel ? 'info' : logLevel;
118
118
  }
119
- LogWrapper._vscodeLogger?.debug((0, i18n_1.t)('debug.loggingConfigured', { logLevel: LogWrapper._logLevel }));
119
+ LogWrapper._vscodeLogger?.debug((0, i18n_1.t)('logMessages.debug.loggingConfigured', { logLevel: LogWrapper._logLevel }));
120
120
  }
121
121
  static logAtLevel = (level, message, ...args) => {
122
122
  if (typeof message === 'object') {
@@ -134,7 +134,7 @@ class LogWrapper {
134
134
  }
135
135
  }
136
136
  else {
137
- exports.DefaultLogger.error((0, i18n_1.t)('error.logWrapperNotInitialised'));
137
+ exports.DefaultLogger.error((0, i18n_1.t)('logMessages.error.logWrapperNotInitialised'));
138
138
  }
139
139
  };
140
140
  /**
@@ -19,7 +19,7 @@ function buildStartNoFLPCommand(localOnly, searchParams) {
19
19
  const searchParamString = searchParams?.toString();
20
20
  const searchParam = searchParamString ? `?${searchParamString}` : '';
21
21
  if (localOnly) {
22
- return `echo \\"${(0, i18n_1.t)('info.mockOnlyWarning')}\\"`;
22
+ return `echo \\"${(0, i18n_1.t)('logMessages.info.mockOnlyWarning')}\\"`;
23
23
  }
24
24
  return `fiori run --open "/index.html${searchParam}"`;
25
25
  }
@@ -50,7 +50,7 @@ function buildParams(searchParams, flpAppId) {
50
50
  */
51
51
  function buildStartCommand(localOnly, params, startFile) {
52
52
  if (localOnly) {
53
- return `echo \\"${(0, i18n_1.t)('info.mockOnlyWarning')}\\"`;
53
+ return `echo \\"${(0, i18n_1.t)('logMessages.info.mockOnlyWarning')}\\"`;
54
54
  }
55
55
  return `fiori run --open "${startFile ?? constants_1.SCRIPT_FLP_SANDBOX}${params}"`;
56
56
  }
@@ -112,7 +112,7 @@ function getPackageScripts({ localOnly, addMock = true, addTest = false, flpAppI
112
112
  scripts['int-test'] = 'fiori run --config ./ui5-mock.yaml --open "/test/integration/opaTests.qunit.html"';
113
113
  }
114
114
  scripts['start-variants-management'] = localOnly
115
- ? `echo \\"${(0, i18n_1.t)('info.mockOnlyWarning')}\\"`
115
+ ? `echo \\"${(0, i18n_1.t)('logMessages.info.mockOnlyWarning')}\\"`
116
116
  : getVariantPreviewAppScript(!supportVirtualEndpoints, flpAppId);
117
117
  return scripts;
118
118
  }
@@ -1,18 +1,18 @@
1
+ import type { BackendSystem } from '@sap-ux/store';
1
2
  /**
2
- * Relevant values for display extended system properties to the UI
3
+ * Creates and returns a display name for the system, appending the system type and user display name if available.
4
+ *
5
+ * @param system the backend system to create a display name for
6
+ * @returns the display name for the system
3
7
  */
4
- export declare enum Suffix {
5
- S4HC = "S4HC",
6
- BTP = "BTP"
7
- }
8
+ export declare function getBackendSystemDisplayName(system: BackendSystem): string;
8
9
  /**
9
10
  * Get the system display name.
10
11
  *
11
12
  * @param systemName - system name
12
13
  * @param displayUsername - display username
13
- * @param isBtp - is BTP
14
- * @param isS4HC - is S/4 Hana Cloud
14
+ * @param systemType - 'ABAPCloud' or undefined
15
15
  * @returns system display name
16
16
  */
17
- export declare function getSystemDisplayName(systemName: string, displayUsername?: string, isBtp?: boolean, isS4HC?: boolean): string;
17
+ export declare function getSystemDisplayName(systemName: string, displayUsername?: string, systemType?: string): string;
18
18
  //# sourceMappingURL=system-utils.d.ts.map
@@ -1,56 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Suffix = void 0;
3
+ exports.getBackendSystemDisplayName = getBackendSystemDisplayName;
4
4
  exports.getSystemDisplayName = getSystemDisplayName;
5
+ const i18n_1 = require("./i18n");
5
6
  /**
6
- * Relevant values for display extended system properties to the UI
7
- */
8
- var Suffix;
9
- (function (Suffix) {
10
- Suffix["S4HC"] = "S4HC";
11
- Suffix["BTP"] = "BTP";
12
- })(Suffix || (exports.Suffix = Suffix = {}));
13
- /**
14
- * Escape any special RegExp character that we want to use literally.
15
- *
16
- * @param str string input
17
- * @returns string a cleansed version of the input
18
- */
19
- function escapeRegExp(str) {
20
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
21
- }
22
- /**
23
- * Trim, cleanse and return a system name appended with the appropriate suffix i.e. BTP | S4HC.
7
+ * Creates and returns a display name for the system, appending the system type and user display name if available.
24
8
  *
25
- * @param systemName name of the system
26
- * @param suffix the appropriate suffix appended, BTP | S4HC
27
- * @returns string return an escaped string, appended with the appropriate suffix
9
+ * @param system the backend system to create a display name for
10
+ * @returns the display name for the system
28
11
  */
29
- function addSuffix(systemName, suffix) {
30
- const suffixStr = ` (${suffix})`;
31
- return RegExp(`${escapeRegExp(suffixStr)}$`).exec(systemName.trim()) ? systemName : `${systemName} (${suffix})`;
12
+ function getBackendSystemDisplayName(system) {
13
+ const systemTypeName = getSystemDisplayName(system.name, system.userDisplayName, system.systemType);
14
+ return systemTypeName;
32
15
  }
33
16
  /**
34
17
  * Get the system display name.
35
18
  *
36
19
  * @param systemName - system name
37
20
  * @param displayUsername - display username
38
- * @param isBtp - is BTP
39
- * @param isS4HC - is S/4 Hana Cloud
21
+ * @param systemType - 'ABAPCloud' or undefined
40
22
  * @returns system display name
41
23
  */
42
- function getSystemDisplayName(systemName, displayUsername, isBtp = false, isS4HC = false) {
24
+ function getSystemDisplayName(systemName, displayUsername, systemType) {
43
25
  const userDisplayName = displayUsername ? ` [${displayUsername}]` : '';
44
- let systemDisplayName;
45
- if (isBtp) {
46
- systemDisplayName = addSuffix(systemName, Suffix.BTP);
47
- }
48
- else if (isS4HC) {
49
- systemDisplayName = addSuffix(systemName, Suffix.S4HC);
50
- }
51
- else {
52
- systemDisplayName = systemName;
26
+ return `${systemName}${getSystemTypeLabel(systemType)}${userDisplayName}`;
27
+ }
28
+ /**
29
+ * Returns the formatted system type name for the given backend system.
30
+ *
31
+ * @param systemType the system type to get the parenthesised name for
32
+ * @returns system type name formatted as a string, e.g. " (ABAP Cloud)".
33
+ */
34
+ function getSystemTypeLabel(systemType) {
35
+ let systemTypeName = ''; // for on prem we do not show the system type
36
+ const abapCloudLabel = ` (${(0, i18n_1.t)('texts.systemTypeLabel.abapCloud')})`;
37
+ // Legacy store system types will now display as ABAP Cloud
38
+ if (systemType === 'ABAPCloud' || systemType === 'S4HC' || systemType === 'BTP') {
39
+ systemTypeName = abapCloudLabel;
53
40
  }
54
- return `${systemDisplayName}${userDisplayName}`;
41
+ return systemTypeName;
55
42
  }
56
43
  //# sourceMappingURL=system-utils.js.map
@@ -1,14 +1,21 @@
1
1
  {
2
- "info": {
3
- "mockOnlyWarning": "This application was generated with a local metadata file and does not reference a live server. Please add the required server configuration or start this application with mock data using the target: `npm run start-mock`."
4
- },
5
- "error": {
6
- "logWrapperNotInitialised": "`LogWrapper` is not initialised."
7
- },
8
- "debug": {
9
- "loggingConfigured": "Logging has been configured at log level: {{logLevel}}."
2
+ "logMessages": {
3
+ "info": {
4
+ "mockOnlyWarning": "This application was generated with a local metadata file and does not reference a live server. Please add the required server configuration or start this application with mock data using the target: `npm run start-mock`."
5
+ },
6
+ "error": {
7
+ "logWrapperNotInitialised": "`LogWrapper` is not initialised."
8
+ },
9
+ "debug": {
10
+ "loggingConfigured": "Logging has been configured at log level: {{logLevel}}."
11
+ }
10
12
  },
11
13
  "telemetry": {
12
14
  "unknownOs": "Unknown"
15
+ },
16
+ "texts": {
17
+ "systemTypeLabel": {
18
+ "abapCloud": "ABAP Cloud"
19
+ }
13
20
  }
14
21
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-generator-shared",
3
3
  "description": "Commonly used shared functionality and types to support the fiori generator.",
4
- "version": "0.13.21",
4
+ "version": "0.13.23",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -25,8 +25,8 @@
25
25
  "os-name": "4.0.1",
26
26
  "semver": "7.5.4",
27
27
  "@sap-ux/btp-utils": "1.1.4",
28
- "@sap-ux/project-access": "1.32.3",
29
- "@sap-ux/telemetry": "0.6.27"
28
+ "@sap-ux/project-access": "1.32.4",
29
+ "@sap-ux/telemetry": "0.6.29"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/mem-fs-editor": "7.0.1",
@@ -34,8 +34,9 @@
34
34
  "@types/semver": "7.5.2",
35
35
  "@types/vscode": "1.73.1",
36
36
  "@types/yeoman-environment": "2.10.11",
37
- "@sap-ux/axios-extension": "1.22.10",
38
- "@sap-ux/logger": "0.7.0"
37
+ "@sap-ux/axios-extension": "1.23.0",
38
+ "@sap-ux/logger": "0.7.0",
39
+ "@sap-ux/store": "1.2.0"
39
40
  },
40
41
  "engines": {
41
42
  "node": ">=20.x"