@sap-ux/odata-service-inquirer 2.5.6 → 2.5.7

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.
@@ -145,6 +145,10 @@ function getUserSystemNameQuestion(connectValidator, promptNamespace) {
145
145
  password: connectValidator.axiosConfig?.auth?.password,
146
146
  serviceKeys: connectValidator.serviceInfo,
147
147
  userDisplayName: connectValidator.connectedUserName,
148
+ systemType: (0, store_1.getBackendSystemType)({
149
+ serviceKeys: connectValidator.serviceInfo,
150
+ authenticationType: connectValidator.systemAuthType
151
+ }),
148
152
  refreshToken: connectValidator.refreshToken
149
153
  });
150
154
  utils_1.PromptState.odataService.connectedSystem.backendSystem = backendSystem;
@@ -1,6 +1,6 @@
1
1
  import type { Destination } from '@sap-ux/btp-utils';
2
2
  import type { OdataVersion } from '@sap-ux/odata-service-writer';
3
- import type { BackendSystem } from '@sap-ux/store';
3
+ import { type BackendSystemKey, type BackendSystem } from '@sap-ux/store';
4
4
  import type { ListChoiceOptions } from 'inquirer';
5
5
  import type { ConnectedSystem, DestinationFilters } from '../../../../types';
6
6
  import type { ConnectionValidator } from '../../../connectionValidator';
@@ -17,13 +17,13 @@ export type SystemSelectionAnswerType = {
17
17
  * Connects to the specified backend system and validates the connection.
18
18
  * Note this will return true in the case of basic auth validation failure to defer validation to the credentials prompt.
19
19
  *
20
- * @param backendSystem the backend system to connect to
20
+ * @param backendKey the key {url, client} of the backend system
21
21
  * @param connectionValidator the connection validator to use for the connection
22
22
  * @param requiredOdataVersion the required OData version for the service, this will be used to narrow the catalog service connections
23
23
  * @param cachedConnectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
24
24
  * @returns the validation result of the backend system connection
25
25
  */
26
- export declare function connectWithBackendSystem(backendSystem: BackendSystem, connectionValidator: ConnectionValidator, requiredOdataVersion?: OdataVersion, cachedConnectedSystem?: ConnectedSystem): Promise<ValidationResult>;
26
+ export declare function connectWithBackendSystem(backendKey: BackendSystemKey, connectionValidator: ConnectionValidator, requiredOdataVersion?: OdataVersion, cachedConnectedSystem?: ConnectedSystem): Promise<ValidationResult>;
27
27
  /**
28
28
  * Connects to the specified destination and validates the connection.
29
29
  * Note that a destination may be a system or a service connection.
@@ -23,16 +23,17 @@ exports.CfAbapEnvServiceChoice = 'cfAbapEnvService';
23
23
  * Connects to the specified backend system and validates the connection.
24
24
  * Note this will return true in the case of basic auth validation failure to defer validation to the credentials prompt.
25
25
  *
26
- * @param backendSystem the backend system to connect to
26
+ * @param backendKey the key {url, client} of the backend system
27
27
  * @param connectionValidator the connection validator to use for the connection
28
28
  * @param requiredOdataVersion the required OData version for the service, this will be used to narrow the catalog service connections
29
29
  * @param cachedConnectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
30
30
  * @returns the validation result of the backend system connection
31
31
  */
32
- async function connectWithBackendSystem(backendSystem, connectionValidator, requiredOdataVersion, cachedConnectedSystem) {
32
+ async function connectWithBackendSystem(backendKey, connectionValidator, requiredOdataVersion, cachedConnectedSystem) {
33
33
  // Create a new connection with the selected system
34
34
  utils_1.PromptState.resetConnectedSystem();
35
35
  let connectValResult = false;
36
+ const backendSystem = await new store_1.SystemService(logger_helper_1.default.logger).read(backendKey);
36
37
  if (backendSystem) {
37
38
  // Backend systems validation supports using a cached service provider to prevent re-authentication (e.g. re-opening a browser window)
38
39
  // In case the user has changed the URL, do not use the cached service provider.
@@ -62,7 +63,10 @@ async function connectWithBackendSystem(backendSystem, connectionValidator, requ
62
63
  if (errorType === inquirer_common_1.ERROR_TYPE.AUTH &&
63
64
  typeof backendSystem.username === 'string' &&
64
65
  typeof backendSystem.password === 'string') {
65
- logger_helper_1.default.logger.error((0, i18n_1.t)('errors.storedSystemConnectionError', { systemName: backendSystem.name, error: connectValResult }));
66
+ logger_helper_1.default.logger.error((0, i18n_1.t)('errors.storedSystemConnectionError', {
67
+ systemName: backendSystem.name,
68
+ error: connectValResult
69
+ }));
66
70
  return true;
67
71
  }
68
72
  }
@@ -112,14 +116,24 @@ async function connectWithDestination(destination, connectionValidator, required
112
116
  */
113
117
  function getBackendSystemDisplayName(system) {
114
118
  const userDisplayName = system.userDisplayName ? ` [${system.userDisplayName}]` : '';
115
- let systemTypeName = '';
116
- if (system.authenticationType === 'reentranceTicket') {
119
+ const systemTypeName = getBackendSystemTypeName(system.systemType);
120
+ return `${system.name}${systemTypeName}${userDisplayName}`;
121
+ }
122
+ /**
123
+ * Returns the formatted system type name for the given backend system.
124
+ *
125
+ * @param systemType the system type to get the name for
126
+ * @returns system type name formatted as a string, e.g. " (BTP)" or " (S4HC)".
127
+ */
128
+ function getBackendSystemTypeName(systemType) {
129
+ let systemTypeName = ''; // for on prem we do not show the system type
130
+ if (systemType === 'S4HC') {
117
131
  systemTypeName = ` (${(0, i18n_1.t)('texts.systemTypeS4HC')})`;
118
132
  }
119
- if (system.serviceKeys) {
133
+ else if (systemType === 'BTP') {
120
134
  systemTypeName = ` (${(0, i18n_1.t)('texts.systemTypeBTP')})`;
121
135
  }
122
- return `${system.name}${systemTypeName}${userDisplayName}`;
136
+ return systemTypeName;
123
137
  }
124
138
  /**
125
139
  * Matches the destination against the provided filters. Returns true if the destination matches any filters, false otherwise.
@@ -192,7 +206,7 @@ async function createSystemChoices(destinationFilters, includeCloudFoundryAbapEn
192
206
  }
193
207
  }
194
208
  else {
195
- const backendSystems = await new store_1.SystemService(logger_helper_1.default.logger).getAll();
209
+ const backendSystems = await new store_1.SystemService(logger_helper_1.default.logger).getAll({ includeSensitiveData: false });
196
210
  systemChoices = backendSystems.map((system) => {
197
211
  return {
198
212
  name: getBackendSystemDisplayName(system),
@@ -9,6 +9,7 @@ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
9
9
  const btp_utils_1 = require("@sap-ux/btp-utils");
10
10
  const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
11
11
  const inquirer_common_1 = require("@sap-ux/inquirer-common");
12
+ const store_1 = require("@sap-ux/store");
12
13
  const i18n_1 = require("../../../../i18n");
13
14
  const types_1 = require("../../../../types");
14
15
  const utils_1 = require("../../../../utils");
@@ -45,7 +46,8 @@ async function validateSystemSelection(systemSelection, connectionValidator, req
45
46
  }
46
47
  let connectValResult = false;
47
48
  if (systemSelection.type === 'backendSystem') {
48
- connectValResult = await (0, prompt_helpers_1.connectWithBackendSystem)(systemSelection.system, connectionValidator, requiredOdataVersion, cachedConnectedSystem);
49
+ const backendKey = store_1.BackendSystemKey.from(systemSelection.system);
50
+ connectValResult = await (0, prompt_helpers_1.connectWithBackendSystem)(backendKey, connectionValidator, requiredOdataVersion, cachedConnectedSystem);
49
51
  }
50
52
  else if (systemSelection.type === 'destination') {
51
53
  // Partial URL destinations will require additional service path prompt input, so we skip the connection validation here by returning true
@@ -17,7 +17,7 @@ const fs_1 = require("fs");
17
17
  * @returns true if the system name is already in use, otherwise false
18
18
  */
19
19
  async function isSystemNameInUse(systemName) {
20
- const backendSystems = await new store_1.SystemService(logger_helper_1.default.logger).getAll();
20
+ const backendSystems = await new store_1.SystemService(logger_helper_1.default.logger).getAll({ includeSensitiveData: false });
21
21
  return !!backendSystems.find((system) => system.name === systemName);
22
22
  }
23
23
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/odata-service-inquirer",
3
3
  "description": "Prompts module that can prompt users for inputs required for odata service writing",
4
- "version": "2.5.6",
4
+ "version": "2.5.7",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,15 +30,15 @@
30
30
  "os-name": "4.0.1",
31
31
  "@sap-ux/axios-extension": "1.22.3",
32
32
  "@sap-ux/btp-utils": "1.1.0",
33
- "@sap-ux/fiori-generator-shared": "0.12.10",
33
+ "@sap-ux/fiori-generator-shared": "0.12.11",
34
34
  "@sap-ux/guided-answers-helper": "0.3.0",
35
- "@sap-ux/telemetry": "0.6.4",
36
- "@sap-ux/inquirer-common": "0.7.15",
35
+ "@sap-ux/telemetry": "0.6.5",
36
+ "@sap-ux/inquirer-common": "0.7.16",
37
37
  "@sap-ux/logger": "0.7.0",
38
38
  "@sap-ux/nodejs-utils": "0.2.1",
39
39
  "@sap-ux/project-access": "1.30.3",
40
40
  "@sap-ux/project-input-validator": "0.6.5",
41
- "@sap-ux/store": "1.1.0"
41
+ "@sap-ux/store": "1.1.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@sap-ux/vocabularies-types": "0.13.0",
@@ -47,12 +47,12 @@
47
47
  "@types/inquirer": "8.2.6",
48
48
  "@types/lodash": "4.14.202",
49
49
  "jest-extended": "3.2.4",
50
- "@sap-ux/fiori-generator-shared": "0.12.10",
51
- "@sap-ux/fiori-elements-writer": "2.5.4",
52
- "@sap-ux/fiori-freestyle-writer": "2.4.15",
50
+ "@sap-ux/fiori-generator-shared": "0.12.11",
51
+ "@sap-ux/fiori-elements-writer": "2.5.5",
52
+ "@sap-ux/fiori-freestyle-writer": "2.4.16",
53
53
  "@sap-ux/feature-toggle": "0.3.0",
54
54
  "@sap-ux/odata-service-writer": "0.27.6",
55
- "@sap-ux/cap-config-writer": "0.10.11"
55
+ "@sap-ux/cap-config-writer": "0.10.12"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=20.x"