@sap-ux/odata-service-inquirer 2.6.1 → 2.7.0

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
@@ -18,7 +18,7 @@ import { type EntityPromptOptions, type OdataServiceAnswers, type OdataServicePr
18
18
  * @param enableGuidedAnswers - if true, the prompts will use guided answers to help users with validation errors
19
19
  * @param telemetryClient - the telemetry client to use for sending telemetry data
20
20
  * @param isYUI - if true, the prompt is being called from the Yeoman UI extension host
21
- * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
21
+ * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket connection types
22
22
  * @returns the prompts used to provide input for odata service generation and a reference to the answers object which will be populated with the user's responses once `inquirer.prompt` returns
23
23
  */
24
24
  declare function getPrompts(promptOptions?: OdataServicePromptOptions, logger?: Logger, enableGuidedAnswers?: boolean, telemetryClient?: ToolsSuiteTelemetryClient, isYUI?: boolean, connectedSystem?: ConnectedSystem): Promise<{
@@ -59,7 +59,7 @@ declare function getEntityRelatedPrompts(metadata: string, templateType: Templat
59
59
  * @param enableGuidedAnswers - if true, the prompts will use guided answers to help users with validation errors
60
60
  * @param telemetryClient - the telemetry client to use for sending telemetry data
61
61
  * @param isYUI - if true, the prompt is being called from the Yeoman UI extension host
62
- * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
62
+ * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket connection types
63
63
  * @returns the prompt answers
64
64
  */
65
65
  declare function prompt(adapter: InquirerAdapter, promptOptions?: OdataServicePromptOptions, logger?: Logger, enableGuidedAnswers?: boolean, telemetryClient?: ToolsSuiteTelemetryClient, isYUI?: boolean, connectedSystem?: ConnectedSystem): Promise<OdataServiceAnswers>;
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ const utils_1 = require("./utils");
31
31
  * @param enableGuidedAnswers - if true, the prompts will use guided answers to help users with validation errors
32
32
  * @param telemetryClient - the telemetry client to use for sending telemetry data
33
33
  * @param isYUI - if true, the prompt is being called from the Yeoman UI extension host
34
- * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
34
+ * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket connection types
35
35
  * @returns the prompts used to provide input for odata service generation and a reference to the answers object which will be populated with the user's responses once `inquirer.prompt` returns
36
36
  */
37
37
  async function getPrompts(promptOptions, logger, enableGuidedAnswers = false, telemetryClient, isYUI = false, connectedSystem) {
@@ -98,7 +98,7 @@ function getEntityRelatedPrompts(metadata, templateType, isCapService = false, p
98
98
  * @param enableGuidedAnswers - if true, the prompts will use guided answers to help users with validation errors
99
99
  * @param telemetryClient - the telemetry client to use for sending telemetry data
100
100
  * @param isYUI - if true, the prompt is being called from the Yeoman UI extension host
101
- * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
101
+ * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket connection types
102
102
  * @returns the prompt answers
103
103
  */
104
104
  async function prompt(adapter, promptOptions, logger, enableGuidedAnswers, telemetryClient, isYUI = false, connectedSystem) {
@@ -392,7 +392,8 @@ class ConnectionValidator {
392
392
  async createSystemConnection({ axiosConfig, url, serviceInfo, destination, odataVersion, refreshToken }) {
393
393
  this.resetConnectionState();
394
394
  this.resetValidity();
395
- if (this.systemAuthType === 'reentranceTicket' || this.systemAuthType === 'serviceKey') {
395
+ // Handle existing stored service keys for backward compatibility
396
+ if (this.systemAuthType === 'reentranceTicket' || serviceInfo) {
396
397
  this._serviceProvider = this.getAbapOnCloudServiceProvider(url, serviceInfo, refreshToken);
397
398
  }
398
399
  else if (destination) {
@@ -507,6 +508,7 @@ class ConnectionValidator {
507
508
  url: new URL(url.pathname, url.origin).toString()
508
509
  });
509
510
  }
511
+ // Remains for existing stored service keys (backward compatibility)
510
512
  if (this.systemAuthType === 'serviceKey' && serviceInfo) {
511
513
  return (0, axios_extension_1.createForAbapOnCloud)({
512
514
  environment: axios_extension_1.AbapCloudEnvironment.Standalone,
@@ -537,6 +539,7 @@ class ConnectionValidator {
537
539
  return this.getValidationResultFromStatusCode(200);
538
540
  }
539
541
  try {
542
+ // Remains for backwards compatibility with existing systems
540
543
  this.systemAuthType = 'serviceKey';
541
544
  await this.createSystemConnection({ serviceInfo, odataVersion, refreshToken });
542
545
  // Cache the user info
@@ -7,21 +7,19 @@ import { type ServiceAnswer } from '../service-selection';
7
7
  declare const systemUrlPromptName: "abapOnBtp:newSystemUrl";
8
8
  declare const abapOnBtpPromptNames: {
9
9
  readonly abapOnBtpAuthType: "abapOnBtpAuthType";
10
- readonly serviceKey: "serviceKey";
11
10
  readonly cloudFoundryAbapSystem: "cloudFoundryAbapSystem";
12
11
  };
13
- export type AbapOnBTPType = 'cloudFoundry' | 'serviceKey' | 'reentranceTicket';
12
+ export type AbapOnBTPType = 'cloudFoundry' | 'reentranceTicket';
14
13
  interface AbapOnBtpAnswers extends Partial<OdataServiceAnswers> {
15
14
  [abapOnBtpPromptNames.abapOnBtpAuthType]?: AbapOnBTPType;
16
15
  [systemUrlPromptName]?: string;
17
- [abapOnBtpPromptNames.serviceKey]?: string;
18
16
  [abapOnBtpPromptNames.cloudFoundryAbapSystem]?: ServiceInstanceInfo;
19
17
  }
20
18
  /**
21
- * Get the questions for the ABAP on BTP system within the VSCode platform. The questions will prompt the user for the system type (Cloud Foundry, Service Key, Re-entrance Ticket).
19
+ * Get the questions for the ABAP on BTP system within the VSCode platform. The questions will prompt the user for the system type (Cloud Foundry, Re-entrance Ticket).
22
20
  *
23
21
  * @param promptOptions The prompt options which control the service selection and system name]
24
- * @param cachedConnectedSystem if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
22
+ * @param cachedConnectedSystem if available passing an already connected system connection will prevent re-authentication for re-entrance ticket connection types
25
23
  * @returns The list of questions for the ABAP on BTP system
26
24
  */
27
25
  export declare function getAbapOnBTPSystemQuestions(promptOptions?: OdataServicePromptOptions, cachedConnectedSystem?: ConnectedSystem): Question<AbapOnBtpAnswers & ServiceAnswer>[];
@@ -32,7 +30,7 @@ export declare function getAbapOnBTPSystemQuestions(promptOptions?: OdataService
32
30
  * @param connectionValidator The connection validator
33
31
  * @param promptNamespace
34
32
  * @param requiredOdataVersion
35
- * @param cachedConnectedSystem if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
33
+ * @param cachedConnectedSystem if available passing an already connected system connection will prevent re-authentication for re-entrance ticket connection types
36
34
  * @returns The Cloud Foundry ABAP system discovery prompt
37
35
  */
38
36
  export declare function getCFDiscoverPrompts(connectionValidator: ConnectionValidator, promptNamespace?: string, requiredOdataVersion?: OdataVersion, cachedConnectedSystem?: ConnectedSystem): Question[];
@@ -18,20 +18,18 @@ const types_1 = require("../new-system/types");
18
18
  const service_selection_1 = require("../service-selection");
19
19
  const shared_prompts_1 = require("../shared-prompts/shared-prompts");
20
20
  const prompt_helpers_2 = require("../system-selection/prompt-helpers");
21
- const validators_1 = require("../validators");
22
21
  const abapOnBtpPromptNamespace = 'abapOnBtp';
23
22
  const systemUrlPromptName = `${abapOnBtpPromptNamespace}:${types_1.newSystemPromptNames.newSystemUrl}`;
24
23
  const cliCfAbapServicePromptName = 'cliCfAbapService';
25
24
  const abapOnBtpPromptNames = {
26
25
  'abapOnBtpAuthType': 'abapOnBtpAuthType',
27
- 'serviceKey': 'serviceKey',
28
26
  'cloudFoundryAbapSystem': 'cloudFoundryAbapSystem'
29
27
  };
30
28
  /**
31
- * Get the questions for the ABAP on BTP system within the VSCode platform. The questions will prompt the user for the system type (Cloud Foundry, Service Key, Re-entrance Ticket).
29
+ * Get the questions for the ABAP on BTP system within the VSCode platform. The questions will prompt the user for the system type (Cloud Foundry, Re-entrance Ticket).
32
30
  *
33
31
  * @param promptOptions The prompt options which control the service selection and system name]
34
- * @param cachedConnectedSystem if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
32
+ * @param cachedConnectedSystem if available passing an already connected system connection will prevent re-authentication for re-entrance ticket connection types
35
33
  * @returns The list of questions for the ABAP on BTP system
36
34
  */
37
35
  function getAbapOnBTPSystemQuestions(promptOptions, cachedConnectedSystem) {
@@ -43,7 +41,6 @@ function getAbapOnBTPSystemQuestions(promptOptions, cachedConnectedSystem) {
43
41
  name: abapOnBtpPromptNames.abapOnBtpAuthType,
44
42
  choices: [
45
43
  { name: (0, i18n_1.t)('prompts.abapOnBTPType.choiceCloudFoundry'), value: 'cloudFoundry' },
46
- { name: (0, i18n_1.t)('prompts.abapOnBTPType.choiceServiceKey'), value: 'serviceKey' },
47
44
  { name: (0, i18n_1.t)('prompts.abapOnBTPType.choiceReentranceTicket'), value: 'reentranceTicket' }
48
45
  ],
49
46
  message: (0, i18n_1.t)('prompts.abapOnBTPType.message'),
@@ -63,8 +60,6 @@ function getAbapOnBTPSystemQuestions(promptOptions, cachedConnectedSystem) {
63
60
  }
64
61
  return false;
65
62
  })[0]);
66
- // Service Key file prompt
67
- questions.push((0, inquirer_common_1.withCondition)([getServiceKeyPrompt(connectValidator, cachedConnectedSystem)], (answers) => answers?.abapOnBtpAuthType === 'serviceKey')[0]);
68
63
  questions.push(...(0, inquirer_common_1.withCondition)([...getCFDiscoverPrompts(connectValidator, undefined, undefined, cachedConnectedSystem)], (answers) => answers?.abapOnBtpAuthType === 'cloudFoundry'));
69
64
  // New system store name propmt
70
65
  if (promptOptions?.userSystemName?.hide !== true) {
@@ -78,8 +73,8 @@ function getAbapOnBTPSystemQuestions(promptOptions, cachedConnectedSystem) {
78
73
  return questions;
79
74
  }
80
75
  /**
81
- * Validate the service info (returned from cf-tools APIs) for an ABAP on BTP system. This function will validate the service key file, or on BAS will create a new destination,
82
- * and validate the connection to the ABAP system. Updates the prompt state with the connected system to be later used for catalog service selection.
76
+ * Validate the service info (returned from cf-tools APIs) for an ABAP on BTP system. This function will validate the connection to the ABAP system and on BAS will create a new destination.
77
+ * Updates the prompt state with the connected system to be later used for catalog service selection.
83
78
  *
84
79
  * @param abapService the abap service as provided by CF tools {@link ServiceInstanceInfo}
85
80
  * @param connectionValidator connection validator instance
@@ -152,7 +147,7 @@ async function validateCFServiceInfo(abapService, connectionValidator, requiredO
152
147
  * @param connectionValidator The connection validator
153
148
  * @param promptNamespace
154
149
  * @param requiredOdataVersion
155
- * @param cachedConnectedSystem if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
150
+ * @param cachedConnectedSystem if available passing an already connected system connection will prevent re-authentication for re-entrance ticket connection types
156
151
  * @returns The Cloud Foundry ABAP system discovery prompt
157
152
  */
158
153
  function getCFDiscoverPrompts(connectionValidator, promptNamespace, requiredOdataVersion, cachedConnectedSystem) {
@@ -207,46 +202,4 @@ function getCFDiscoverPrompts(connectionValidator, promptNamespace, requiredOdat
207
202
  }
208
203
  return questions;
209
204
  }
210
- /**
211
- * Get the service key prompt for the ABAP on BTP system. This prompt will allow the user to select a service key file from the file system.
212
- *
213
- * @param connectionValidator a connection validator instance
214
- * @param cachedConnectedSystem if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
215
- * @returns The service key prompt
216
- */
217
- function getServiceKeyPrompt(connectionValidator, cachedConnectedSystem) {
218
- const question = {
219
- type: 'input',
220
- name: abapOnBtpPromptNames.serviceKey,
221
- message: (0, i18n_1.t)('prompts.serviceKey.message'),
222
- guiType: 'file-browser',
223
- guiOptions: {
224
- hint: (0, i18n_1.t)('prompts.serviceKey.hint'),
225
- mandatory: true
226
- },
227
- validate: async (keyPath) => {
228
- utils_1.PromptState.resetConnectedSystem();
229
- const serviceKeyValResult = (0, validators_1.validateServiceKey)(keyPath);
230
- if (typeof serviceKeyValResult === 'string' || typeof serviceKeyValResult === 'boolean') {
231
- return serviceKeyValResult;
232
- }
233
- // Backend systems validation supports using a cached connections from a previous step execution to prevent re-authentication (e.g. re-opening a browser window)
234
- // In case the user has changed the URL, do not use the cached connection.
235
- if (cachedConnectedSystem &&
236
- cachedConnectedSystem.backendSystem?.url === serviceKeyValResult.url &&
237
- JSON.stringify(cachedConnectedSystem.backendSystem.serviceKeys.uaa) ===
238
- JSON.stringify(serviceKeyValResult.uaa)) {
239
- connectionValidator.setConnectedSystem(cachedConnectedSystem);
240
- }
241
- const connectValResult = await connectionValidator.validateServiceInfo(serviceKeyValResult);
242
- if (connectValResult === true && connectionValidator.serviceProvider) {
243
- utils_1.PromptState.odataService.connectedSystem = {
244
- serviceProvider: (0, utils_1.removeCircularFromServiceProvider)(connectionValidator.serviceProvider)
245
- };
246
- }
247
- return connectValResult;
248
- }
249
- };
250
- return question;
251
- }
252
205
  //# sourceMappingURL=questions.js.map
@@ -49,6 +49,7 @@ async function connectWithBackendSystem(backendKey, connectionValidator, require
49
49
  });
50
50
  }
51
51
  else if (backendSystem.serviceKeys) {
52
+ // Handle existing stored service keys for backward compatibility
52
53
  connectValResult = await connectionValidator.validateServiceInfo(backendSystem.serviceKeys, (0, utils_1.convertODataVersionType)(requiredOdataVersion), backendSystem.refreshToken);
53
54
  }
54
55
  else if (backendSystem.authenticationType === 'basic' || !backendSystem.authenticationType) {
@@ -3,7 +3,7 @@ import { type ConnectedSystem, type OdataServicePromptOptions, type OdataService
3
3
  * Get the prompts for the OData service inquirer.
4
4
  *
5
5
  * @param promptOptions - options that can control some of the prompt behavior. See {@link OdataServicePromptOptions} for details
6
- * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
6
+ * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket connection types
7
7
  * @returns the prompts used to provide input for OData service generation
8
8
  */
9
9
  export declare function getQuestions(promptOptions?: OdataServicePromptOptions, connectedSystem?: ConnectedSystem): Promise<OdataServiceQuestion[]>;
@@ -13,7 +13,7 @@ const prompt_helpers_1 = require("./prompt-helpers");
13
13
  * Get the prompts for the OData service inquirer.
14
14
  *
15
15
  * @param promptOptions - options that can control some of the prompt behavior. See {@link OdataServicePromptOptions} for details
16
- * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket and service keys connection types
16
+ * @param connectedSystem - if available passing an already connected system connection will prevent re-authentication for re-entrance ticket connection types
17
17
  * @returns the prompts used to provide input for OData service generation
18
18
  */
19
19
  async function getQuestions(promptOptions, connectedSystem) {
@@ -110,15 +110,8 @@
110
110
  "abapOnBTPType": {
111
111
  "message": "ABAP environment definition source",
112
112
  "choiceReentranceTicket": "Use Reentrance Ticket",
113
- "choiceServiceKey": "Upload a Service Key File",
114
113
  "choiceCloudFoundry": "Discover a Cloud Foundry Service"
115
114
  },
116
- "serviceKey": {
117
- "message": "Service Key File Path",
118
- "hint": "Select a local file that defines the service connection for an ABAP Environment on SAP Business Technology Platform.",
119
- "incompleteServiceKeyInfo": "The service keys file does not contain the required information. Check the file is valid and try again.",
120
- "unparseableServiceKey": "The service keys file does not contain a valid JSON format. Check the formatting and try again."
121
- },
122
115
  "cloudFoundryAbapSystem": {
123
116
  "message": "ABAP environment",
124
117
  "hint": "Enter the name of the Cloud Foundry service that contains the ABAP Environment instance."
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.6.1",
4
+ "version": "2.7.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",