@sap-ux/odata-service-inquirer 0.5.36 → 0.5.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.
@@ -75,6 +75,12 @@ export declare class ConnectionValidator {
75
75
  * @returns the validated url
76
76
  */
77
77
  get validatedUrl(): string | undefined;
78
+ /**
79
+ * Get the validated client code. This is the client code that has been successfully validated by a request.
80
+ *
81
+ * @returns the validated client code
82
+ */
83
+ get validatedClient(): string | undefined;
78
84
  /**
79
85
  * Get the service info used to connect to the system.
80
86
  *
@@ -95,6 +95,14 @@ class ConnectionValidator {
95
95
  get validatedUrl() {
96
96
  return this._validatedUrl;
97
97
  }
98
+ /**
99
+ * Get the validated client code. This is the client code that has been successfully validated by a request.
100
+ *
101
+ * @returns the validated client code
102
+ */
103
+ get validatedClient() {
104
+ return this._validatedClient;
105
+ }
98
106
  /**
99
107
  * Get the service info used to connect to the system.
100
108
  *
@@ -252,7 +260,6 @@ class ConnectionValidator {
252
260
  this._connectedUserName = undefined;
253
261
  this._refreshToken = undefined;
254
262
  this._connectedSystemName = undefined;
255
- this.resetValidity();
256
263
  }
257
264
  /**
258
265
  * Create the connection for a system url, the specified axios config or the specified service info.
@@ -132,7 +132,7 @@ function getUserSystemNameQuestion(connectValidator, promptNamespace) {
132
132
  default: async () => {
133
133
  const systemName = connectValidator.connectedSystemName;
134
134
  if (systemName && !userModifiedSystemName) {
135
- defaultSystemName = await (0, prompt_helpers_1.suggestSystemName)(systemName, connectValidator.axiosConfig?.params?.sapClient);
135
+ defaultSystemName = await (0, prompt_helpers_1.suggestSystemName)(systemName, connectValidator.validatedClient);
136
136
  return defaultSystemName;
137
137
  }
138
138
  return defaultSystemName;
@@ -158,7 +158,7 @@ function getUserSystemNameQuestion(connectValidator, promptNamespace) {
158
158
  authenticationType: systemAuthTypeToAuthenticationType(connectValidator.systemAuthType),
159
159
  name: systemName,
160
160
  url: connectValidator.validatedUrl,
161
- client: connectValidator.axiosConfig?.params?.[types_1.SAP_CLIENT_KEY],
161
+ client: connectValidator.validatedClient,
162
162
  username: connectValidator.axiosConfig?.auth?.username,
163
163
  password: connectValidator.axiosConfig?.auth?.password,
164
164
  serviceKeys: connectValidator.serviceInfo,
@@ -199,8 +199,9 @@ exports.getSelectedServiceLabel = getSelectedServiceLabel;
199
199
  */
200
200
  function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptions) {
201
201
  let serviceChoices = [];
202
- // Prevent re-requesting services repeatedly by only requesting them once and when the system is changed
202
+ // Prevent re-requesting services repeatedly by only requesting them once and when the system or client is changed
203
203
  let previousSystemUrl;
204
+ let previousClient;
204
205
  let previousService;
205
206
  const requiredOdataVersion = promptOptions?.serviceSelection?.requiredOdataVersion;
206
207
  const newSystemServiceQuestion = {
@@ -215,7 +216,9 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
215
216
  },
216
217
  source: (prevAnswers, input) => (0, inquirer_common_1.searchChoices)(input, serviceChoices),
217
218
  choices: async () => {
218
- if (serviceChoices.length === 0 || previousSystemUrl !== connectValidator.validatedUrl) {
219
+ if (serviceChoices.length === 0 ||
220
+ previousSystemUrl !== connectValidator.validatedUrl ||
221
+ previousClient !== connectValidator.validatedClient) {
219
222
  let catalogs = [];
220
223
  if (requiredOdataVersion && connectValidator.catalogs[requiredOdataVersion]) {
221
224
  catalogs.push(connectValidator.catalogs[requiredOdataVersion]);
@@ -224,6 +227,7 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
224
227
  catalogs = Object.values(connectValidator.catalogs).filter((cat) => cat !== undefined);
225
228
  }
226
229
  previousSystemUrl = connectValidator.validatedUrl;
230
+ previousClient = connectValidator.validatedClient;
227
231
  serviceChoices = await (0, service_helper_1.getServiceChoices)(catalogs);
228
232
  }
229
233
  return serviceChoices;
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": "0.5.36",
4
+ "version": "0.5.37",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",