@sap-ux/odata-service-inquirer 0.5.27 → 0.5.29

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.
Files changed (32) hide show
  1. package/dist/error-handler/error-handler.d.ts +2 -2
  2. package/dist/error-handler/error-handler.js +4 -4
  3. package/dist/index.d.ts +2 -12
  4. package/dist/index.js +3 -20
  5. package/dist/prompts/connectionValidator.d.ts +114 -27
  6. package/dist/prompts/connectionValidator.js +206 -34
  7. package/dist/prompts/datasources/sap-system/abap-on-btp/cf-helper.d.ts +9 -0
  8. package/dist/prompts/datasources/sap-system/abap-on-btp/cf-helper.js +55 -0
  9. package/dist/prompts/datasources/sap-system/abap-on-btp/questions.d.ts +34 -0
  10. package/dist/prompts/datasources/sap-system/abap-on-btp/questions.js +213 -0
  11. package/dist/prompts/datasources/sap-system/abap-on-prem/questions.d.ts +7 -16
  12. package/dist/prompts/datasources/sap-system/abap-on-prem/questions.js +16 -164
  13. package/dist/prompts/datasources/sap-system/new-system/questions.d.ts +36 -5
  14. package/dist/prompts/datasources/sap-system/new-system/questions.js +229 -37
  15. package/dist/prompts/datasources/sap-system/{abap-on-prem → new-system}/service-helper.d.ts +11 -1
  16. package/dist/prompts/datasources/sap-system/{abap-on-prem → new-system}/service-helper.js +30 -1
  17. package/dist/prompts/datasources/sap-system/new-system/types.d.ts +16 -0
  18. package/dist/prompts/datasources/sap-system/new-system/types.js +9 -0
  19. package/dist/prompts/datasources/sap-system/prompt-helpers.d.ts +3 -3
  20. package/dist/prompts/datasources/sap-system/prompt-helpers.js +4 -4
  21. package/dist/prompts/datasources/sap-system/validators.d.ts +10 -1
  22. package/dist/prompts/datasources/sap-system/validators.js +27 -2
  23. package/dist/prompts/datasources/service-url/questions.js +20 -8
  24. package/dist/prompts/datasources/service-url/validators.d.ts +4 -4
  25. package/dist/prompts/datasources/service-url/validators.js +4 -6
  26. package/dist/prompts/prompts.js +6 -9
  27. package/dist/translations/odata-service-inquirer.i18n.json +24 -4
  28. package/dist/types.d.ts +13 -3
  29. package/dist/types.js +5 -1
  30. package/dist/utils/index.d.ts +17 -0
  31. package/dist/utils/index.js +29 -1
  32. package/package.json +5 -4
@@ -15,10 +15,11 @@ const prompt_helpers_1 = require("./prompt-helpers");
15
15
  // Cert errors that may be ignored by prompt user
16
16
  const ignorableCertErrors = [error_handler_1.ERROR_TYPE.CERT_SELF_SIGNED, error_handler_1.ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN];
17
17
  /**
18
- * Class that validates the connection to a service url or catalog url.
19
- * This will determine if authentication is required and if the service/catalog is reachable, generating messages to guide the user.
20
- * It is optimized for re-validation of the same url, so that the validation is not repeated if not required.
21
- *
18
+ * Class that can be used to determine the connectivity using a service url, system url, or service info (UAA Key details) or reentrance ticket.
19
+ * This will determine if if the service/catalog is reachable, authentication is required and generates ting messages to guide the user.
20
+ * Certain types of certificate errors can be ignored if required. However, the end-user should be warned about the risks using a prompt message.
21
+ * Catalog requests may be made multiple times for the same url, but the underlying connectivity module (@sap-ux/axios-extension) will cache the results to avoid repeated network requests.
22
+ * The class also stores the current connection state, including the service provider, odata service, and catalog services.
22
23
  */
23
24
  class ConnectionValidator {
24
25
  validity = {};
@@ -31,6 +32,11 @@ class ConnectionValidator {
31
32
  _axiosConfig;
32
33
  _catalogV2;
33
34
  _catalogV4;
35
+ _systemAuthType;
36
+ _serviceInfo;
37
+ _connectedUserName;
38
+ _connectedSystemName;
39
+ _refreshToken;
34
40
  /**
35
41
  * Getter for the axios configuration.
36
42
  *
@@ -65,6 +71,83 @@ class ConnectionValidator {
65
71
  get serviceProvider() {
66
72
  return this._serviceProvider;
67
73
  }
74
+ /**
75
+ * The auth type used to create an authenticated connection to the system.
76
+ *
77
+ * @returns the system auth type
78
+ */
79
+ get systemAuthType() {
80
+ return this._systemAuthType;
81
+ }
82
+ /**
83
+ * The auth type used to create an authenticated connection to the system.
84
+ *
85
+ * @param value the system auth type
86
+ */
87
+ set systemAuthType(value) {
88
+ this._systemAuthType = value;
89
+ }
90
+ /**
91
+ * Get the validated url. This is the url that has been successfully validated (not necessarily connected). Use validity to check if the url is reachable.
92
+ *
93
+ * @returns the validated url
94
+ */
95
+ get validatedUrl() {
96
+ return this._validatedUrl;
97
+ }
98
+ /**
99
+ * Get the service info used to connect to the system.
100
+ *
101
+ * @returns the service info
102
+ */
103
+ get serviceInfo() {
104
+ return this._serviceInfo;
105
+ }
106
+ /**
107
+ * Set the service info used to connect to the system.
108
+ *
109
+ * @param serviceInfo the service info
110
+ */
111
+ set serviceInfo(serviceInfo) {
112
+ this._serviceInfo = serviceInfo;
113
+ }
114
+ /**
115
+ * Get the connected user name.
116
+ *
117
+ * @returns the connected user name
118
+ */
119
+ get connectedUserName() {
120
+ return this._connectedUserName;
121
+ }
122
+ /**
123
+ * Get the refresh token.
124
+ *
125
+ * @returns the refresh token
126
+ */
127
+ get refreshToken() {
128
+ return this._refreshToken;
129
+ }
130
+ /**
131
+ * Get the connected system name. If previously set this will be used, otherwise the name is determined
132
+ * by the system auth type, or the validated url.
133
+ *
134
+ * @returns the connected system name
135
+ */
136
+ get connectedSystemName() {
137
+ if (this._connectedSystemName) {
138
+ return this._connectedSystemName;
139
+ }
140
+ if (this.systemAuthType === 'serviceKey') {
141
+ return this.serviceInfo?.systemid;
142
+ }
143
+ return this.validatedUrl;
144
+ }
145
+ /**
146
+ *
147
+ */
148
+ set connectedSystemName(value) {
149
+ this._connectedSystemName = value;
150
+ }
68
151
  /**
69
152
  * Calls a given service or system url to test its reachability and authentication requirements.
70
153
  * If the url is a system url, it will attempt to use the catalog service to get the service info.
@@ -78,7 +161,7 @@ class ConnectionValidator {
78
161
  * @param options.odataVersion if specified will restrict catalog requests to only the specified odata version
79
162
  * @returns the status code or error returned by the connection attempt
80
163
  */
81
- async checkSapService(url, username, password, { ignoreCertError = false, isSystem = false, odataVersion } = {}) {
164
+ async checkSapServiceUrl(url, username, password, { ignoreCertError = false, isSystem = false, odataVersion } = {}) {
82
165
  const isBAS = (0, btp_utils_1.isAppStudio)();
83
166
  try {
84
167
  // Auto add trailing '/' to path
@@ -92,13 +175,12 @@ class ConnectionValidator {
92
175
  url.searchParams.append('saml2', 'disabled');
93
176
  }
94
177
  const axiosConfig = this.createAxiosConfig(url, ignoreCertError, username, password);
95
- // If system, use catalog service to get the services info
96
178
  if (isSystem) {
97
- await this.createSystemConnection(axiosConfig, odataVersion);
179
+ await this.createSystemConnection({ axiosConfig, url, odataVersion });
98
180
  }
99
181
  else {
100
182
  // Full service URL
101
- await this.createServiceConnection(axiosConfig, url.pathname);
183
+ await this.createOdataServiceConnection(axiosConfig, url.pathname);
102
184
  }
103
185
  this._validatedClient = url.searchParams.get(types_1.SAP_CLIENT_KEY) ?? undefined;
104
186
  return 200;
@@ -135,7 +217,8 @@ class ConnectionValidator {
135
217
  params: Object.fromEntries(url.searchParams),
136
218
  ignoreCertErrors: ignoreCertError,
137
219
  cookies: '',
138
- baseURL: url.origin
220
+ baseURL: url.origin,
221
+ url: url.pathname
139
222
  };
140
223
  if (username && password) {
141
224
  axiosConfig = Object.assign(axiosConfig, {
@@ -153,23 +236,45 @@ class ConnectionValidator {
153
236
  * @param axiosConfig the axios request configuration
154
237
  * @param servicePath the service path without the origin
155
238
  */
156
- async createServiceConnection(axiosConfig, servicePath) {
239
+ async createOdataServiceConnection(axiosConfig, servicePath) {
157
240
  this._axiosConfig = axiosConfig;
158
241
  this._serviceProvider = (0, axios_extension_1.create)(this._axiosConfig);
159
242
  this._odataService = this._serviceProvider.service(servicePath);
160
243
  logger_helper_1.default.attachAxiosLogger(this._serviceProvider.interceptors);
161
244
  await this._odataService.get('');
162
245
  }
246
+ resetConnectionState() {
247
+ this._serviceProvider = undefined;
248
+ this._odataService = undefined;
249
+ this._catalogV2 = undefined;
250
+ this._catalogV4 = undefined;
251
+ this._serviceInfo = undefined;
252
+ this._connectedUserName = undefined;
253
+ this._refreshToken = undefined;
254
+ this._connectedSystemName = undefined;
255
+ this.resetValidity();
256
+ }
163
257
  /**
164
- * Create the connection for a system url. The system url should be provided as a base url axios config property.
258
+ * Create the connection for a system url, the specified axios config or the specified service info.
165
259
  *
166
- * @param axiosConfig the axios request configuration
167
- * @param odataVersion the odata version to restrict the catalog requests if only a specific version is required
260
+ * @param connectConfig the connection configuration
261
+ * @param connectConfig.axiosConfig the axios request configuration
262
+ * @param connectConfig.url the system url
263
+ * @param connectConfig.serviceInfo the service info
264
+ * @param connectConfig.odataVersion the odata version to restrict the catalog requests if only a specific version is required
168
265
  */
169
- async createSystemConnection(axiosConfig, odataVersion) {
170
- this._axiosConfig = axiosConfig;
171
- this._serviceProvider = (0, axios_extension_1.createForAbap)(this._axiosConfig);
172
- logger_helper_1.default.attachAxiosLogger(this._serviceProvider.interceptors);
266
+ async createSystemConnection({ axiosConfig, url, serviceInfo, odataVersion }) {
267
+ this.resetConnectionState();
268
+ if (this.systemAuthType === 'reentranceTicket' || this.systemAuthType === 'serviceKey') {
269
+ this._serviceProvider = this.getAbapOnCloudServiceProvider(url, serviceInfo);
270
+ }
271
+ else if (axiosConfig) {
272
+ this._axiosConfig = axiosConfig;
273
+ this._serviceProvider = (0, axios_extension_1.createForAbap)(axiosConfig);
274
+ }
275
+ if (this._serviceProvider) {
276
+ logger_helper_1.default.attachAxiosLogger(this._serviceProvider.interceptors);
277
+ }
173
278
  if (!odataVersion || odataVersion === axios_extension_1.ODataVersion.v2) {
174
279
  this._catalogV2 = this._serviceProvider.catalog(axios_extension_1.ODataVersion.v2);
175
280
  }
@@ -177,7 +282,7 @@ class ConnectionValidator {
177
282
  this._catalogV4 = this._serviceProvider.catalog(axios_extension_1.ODataVersion.v4);
178
283
  }
179
284
  try {
180
- this._catalogV2 ? await this._catalogV2.listServices() : await this._catalogV4.listServices();
285
+ this._catalogV2 ? await this._catalogV2.listServices() : await this._catalogV4?.listServices();
181
286
  }
182
287
  catch (error) {
183
288
  // We will try the v4 catalog if v2 returns a 404
@@ -190,13 +295,74 @@ class ConnectionValidator {
190
295
  }
191
296
  }
192
297
  /**
193
- * Validates the service url format as well as its reachability.
298
+ * Callback for when the refresh token changes.
194
299
  *
195
- * @param serviceUrl the odata service url to validate
300
+ * @param refreshToken the new refresh token
301
+ */
302
+ async refreshTokenChangedCb(refreshToken) {
303
+ logger_helper_1.default.logger.debug(`ConnectionValidator.refreshTokenChangedCb()`);
304
+ this._refreshToken = refreshToken;
305
+ }
306
+ /**
307
+ * Get the service provider for the Abap on Cloud environment.
308
+ *
309
+ * @param url the system url
310
+ * @param serviceInfo the service info
311
+ * @returns the service provider
312
+ */
313
+ getAbapOnCloudServiceProvider(url, serviceInfo) {
314
+ if (this.systemAuthType === 'reentranceTicket' && url) {
315
+ return (0, axios_extension_1.createForAbapOnCloud)({
316
+ environment: axios_extension_1.AbapCloudEnvironment.EmbeddedSteampunk,
317
+ url: new URL(url.pathname, url.origin).toString()
318
+ });
319
+ }
320
+ if (this.systemAuthType === 'serviceKey' && serviceInfo) {
321
+ return (0, axios_extension_1.createForAbapOnCloud)({
322
+ environment: axios_extension_1.AbapCloudEnvironment.Standalone,
323
+ service: serviceInfo,
324
+ refreshTokenChangedCb: this.refreshTokenChangedCb.bind(this)
325
+ });
326
+ }
327
+ throw new Error('Invalid system auth type');
328
+ }
329
+ /**
330
+ * Validate the system connectivity with the specified service info (containing UAA details).
331
+ *
332
+ * @param serviceInfo the service info containing the UAA details
333
+ * @param odataVersion the odata version to restrict the catalog requests if only a specific version is required
334
+ * @returns true if the system is reachable, false if not, or an error message string
335
+ */
336
+ async validateServiceInfo(serviceInfo, odataVersion) {
337
+ if (!serviceInfo) {
338
+ return false;
339
+ }
340
+ try {
341
+ this.systemAuthType = 'serviceKey';
342
+ await this.createSystemConnection({ serviceInfo, odataVersion });
343
+ // Cache the user info
344
+ this._connectedUserName = await this.serviceProvider.user();
345
+ this._serviceInfo = serviceInfo;
346
+ this._validatedUrl = serviceInfo.url;
347
+ return this.getValidationResultFromStatusCode(200);
348
+ }
349
+ catch (error) {
350
+ logger_helper_1.default.logger.debug(`ConnectionValidator.validateServiceInfo() - error: ${error.message}`);
351
+ if (error?.isAxiosError) {
352
+ this.getValidationResultFromStatusCode(error?.response?.status || error?.code);
353
+ }
354
+ return prompt_helpers_1.errorHandler.getErrorMsg(error) ?? false;
355
+ }
356
+ }
357
+ /**
358
+ * Validates the system or service url format as well as its reachability.
359
+ *
360
+ * @param serviceUrl the url to validate, may be a system or service url.
361
+ * Note that if systemAuthType is specified, the url will be treated as a system url (only the origin will be considered)
196
362
  * @param options options for the connection validation
197
363
  * @param options.ignoreCertError ignore some certificate errors
198
- * @param options.forceReValidation force re-validation of the url even if the same url has been prevously validated
199
- * @param options.isSystem if true, the url will be treated as a system url rather than a service url
364
+ * @param options.forceReValidation force re-validation of the url
365
+ * @param options.isSystem if true, the url will be treated as a system url rather than a service url, this value is retained for subsequent calls
200
366
  * @param options.odataVersion if specified will restrict catalog requests to only the specified odata version
201
367
  * @returns true if the url is reachable, false if not, or an error message string
202
368
  */
@@ -214,7 +380,7 @@ class ConnectionValidator {
214
380
  return (0, i18n_1.t)('errors.invalidUrl');
215
381
  }
216
382
  // Ignore path if a system url
217
- const status = await this.checkSapService(url, undefined, undefined, {
383
+ const status = await this.checkSapServiceUrl(url, undefined, undefined, {
218
384
  ignoreCertError,
219
385
  isSystem,
220
386
  odataVersion
@@ -228,7 +394,7 @@ class ConnectionValidator {
228
394
  // More helpful context specific error
229
395
  if (error_handler_1.ErrorHandler.getErrorType(error) === error_handler_1.ERROR_TYPE.CONNECTION) {
230
396
  this.validity.reachable = false;
231
- return prompt_helpers_1.errorHandler.logErrorMsgs((0, i18n_1.t)('errors.systemOrserviceUrlNotFound', { url: serviceUrl }));
397
+ return prompt_helpers_1.errorHandler.logErrorMsgs((0, i18n_1.t)('errors.systemOrServiceUrlNotFound', { url: serviceUrl }));
232
398
  }
233
399
  this.resetValidity();
234
400
  const errorMsg = prompt_helpers_1.errorHandler.getErrorMsg(error);
@@ -236,11 +402,11 @@ class ConnectionValidator {
236
402
  }
237
403
  }
238
404
  /**
239
- * Translate the status code into a validation result.
405
+ * Converts the http status code into 'validty' and returns true if the status code indicates that the URL was reachable.
240
406
  * Sets the instance validity state based on the status code.
241
407
  *
242
408
  * @param status a http request status code used to determine the validation result
243
- * @returns true if the url is reachable, false if not, or an error message string
409
+ * @returns true, if the status code indicates the url is reachable, false if not, or an error message string
244
410
  */
245
411
  getValidationResultFromStatusCode(status) {
246
412
  if (status === 200) {
@@ -298,9 +464,9 @@ class ConnectionValidator {
298
464
  * Check whether basic auth is required for the given url, or for the previously validated url if none specified.
299
465
  * This will also set the validity state for the url. This will not validate the URL.
300
466
  *
301
- * @param urlString - the url to validate, if not provided the previously validated url will be used
302
- * @param client - optional, sap client code, if not provided the previously validated client will be used
303
- * @param ignoreCertError
467
+ * @param urlString the url to validate, if not provided the previously validated url will be used
468
+ * @param client optional, sap client code, if not provided the previously validated client will be used
469
+ * @param ignoreCertError ignore some certificate errors
304
470
  * @returns true if basic auth is required, false if not
305
471
  */
306
472
  async isAuthRequired(urlString = this._validatedUrl, client = this._validatedClient, ignoreCertError = false) {
@@ -319,8 +485,13 @@ class ConnectionValidator {
319
485
  if (client) {
320
486
  url.searchParams.append(types_1.SAP_CLIENT_KEY, client);
321
487
  }
322
- this.validity.authRequired = this.validity.reachable =
323
- error_handler_1.ErrorHandler.getErrorType(await this.checkSapService(url, undefined, undefined, { ignoreCertError })) === error_handler_1.ERROR_TYPE.AUTH;
488
+ const authError = error_handler_1.ErrorHandler.getErrorType(await this.checkSapServiceUrl(url, undefined, undefined, { ignoreCertError })) === error_handler_1.ERROR_TYPE.AUTH;
489
+ // Only if we get the specific auth error so we know that auth is required, otherwise we cannot determine so leave as undefined
490
+ if (authError) {
491
+ this.validity.authRequired = true;
492
+ this.validity.reachable = true;
493
+ }
494
+ // Returning undefined if we cannot determine if auth is required
324
495
  return this.validity.authRequired;
325
496
  }
326
497
  catch (error) {
@@ -329,7 +500,7 @@ class ConnectionValidator {
329
500
  }
330
501
  }
331
502
  /**
332
- * Test the connectivity with the specified service url using the provided credentials.
503
+ * Test the connectivity with the specified service url using the provided credentials (basic authentication).
333
504
  *
334
505
  * @param url the url to validate
335
506
  * @param username user name
@@ -341,7 +512,7 @@ class ConnectionValidator {
341
512
  * @param options.odataVersion if specified will restrict catalog requests to only the specified odata version
342
513
  * @returns true if the authentication is successful, false if not, or an error message string
343
514
  */
344
- async validateAuth(url, username, password, { ignoreCertError = false, isSystem = false, sapClient, odataVersion } = {}) {
515
+ async validateAuth(url, username, password, { ignoreCertError = false, sapClient, odataVersion, isSystem = false } = {}) {
345
516
  if (!url) {
346
517
  return false;
347
518
  }
@@ -350,7 +521,8 @@ class ConnectionValidator {
350
521
  if (sapClient) {
351
522
  urlObject.searchParams.append(types_1.SAP_CLIENT_KEY, sapClient);
352
523
  }
353
- const status = await this.checkSapService(urlObject, username, password, {
524
+ this.systemAuthType = 'basic';
525
+ const status = await this.checkSapServiceUrl(urlObject, username, password, {
354
526
  ignoreCertError,
355
527
  isSystem,
356
528
  odataVersion
@@ -0,0 +1,9 @@
1
+ import type { ServiceInstanceInfo } from '@sap/cf-tools';
2
+ import type { ListChoiceOptions } from 'inquirer';
3
+ /**
4
+ * Get the name sorted list of ABAP instance choices from an active CF login. If not logged in, an error message is logged.
5
+ *
6
+ * @returns The list of ABAP instance choices
7
+ */
8
+ export declare function getABAPInstanceChoices(): Promise<ListChoiceOptions<ServiceInstanceInfo>[]>;
9
+ //# sourceMappingURL=cf-helper.d.ts.map
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getABAPInstanceChoices = void 0;
4
+ const cf_tools_1 = require("@sap/cf-tools");
5
+ const error_handler_1 = require("../../../../error-handler/error-handler");
6
+ const i18n_1 = require("../../../../i18n");
7
+ const prompt_helpers_1 = require("../../../prompt-helpers");
8
+ const AbapEnvType = {
9
+ ABAP: 'abap',
10
+ ABAP_TRIAL: 'abap-trial',
11
+ ABAP_CANARY: 'abap-canary',
12
+ ABAP_OEM: 'abap-oem',
13
+ ABAP_OEM_CANARY: 'abap-oem-canary',
14
+ ABAP_HAAS: 'abap-haas',
15
+ ABAP_STAGING: 'abap-staging',
16
+ ABAP_INTERNAL_STAGING: 'abap-internal-staging',
17
+ DESTINATION: 'destination'
18
+ };
19
+ /**
20
+ * Get the name sorted list of ABAP instance choices from an active CF login. If not logged in, an error message is logged.
21
+ *
22
+ * @returns The list of ABAP instance choices
23
+ */
24
+ async function getABAPInstanceChoices() {
25
+ const choices = [];
26
+ try {
27
+ const filteredInstances = [
28
+ AbapEnvType.ABAP,
29
+ AbapEnvType.ABAP_TRIAL,
30
+ AbapEnvType.ABAP_CANARY,
31
+ AbapEnvType.ABAP_OEM,
32
+ AbapEnvType.ABAP_OEM_CANARY,
33
+ AbapEnvType.ABAP_HAAS,
34
+ AbapEnvType.ABAP_STAGING,
35
+ AbapEnvType.ABAP_INTERNAL_STAGING
36
+ ];
37
+ const serviceInstanceInfo = await (0, cf_tools_1.apiGetServicesInstancesFilteredByType)(filteredInstances);
38
+ if (serviceInstanceInfo.length > 0) {
39
+ serviceInstanceInfo.forEach((service) => {
40
+ choices.push({ name: service['label'], value: service });
41
+ });
42
+ }
43
+ else {
44
+ // No envs found
45
+ prompt_helpers_1.errorHandler.logErrorMsgs(error_handler_1.ERROR_TYPE.NO_ABAP_ENVS, (0, i18n_1.t)('errors.noAbapEnvsInCFSpace'));
46
+ }
47
+ }
48
+ catch (error) {
49
+ // Cannot connect to CF
50
+ prompt_helpers_1.errorHandler.logErrorMsgs(error_handler_1.ERROR_TYPE.NO_ABAP_ENVS, (0, i18n_1.t)('errors.abapEnvsCFDiscoveryFailed'));
51
+ }
52
+ return choices.sort((a, b) => (a.name ? a.name.localeCompare(b.name ?? '') : 0));
53
+ }
54
+ exports.getABAPInstanceChoices = getABAPInstanceChoices;
55
+ //# sourceMappingURL=cf-helper.js.map
@@ -0,0 +1,34 @@
1
+ import type { ServiceInstanceInfo } from '@sap/cf-tools';
2
+ import type { Question } from 'inquirer';
3
+ import { type OdataServiceAnswers, type OdataServicePromptOptions } from '../../../../types';
4
+ import { ConnectionValidator } from '../../../connectionValidator';
5
+ declare const systemUrlPromptName: "abapOnBtp:newSystemUrl";
6
+ declare const abapOnBtpPromptNames: {
7
+ readonly abapOnBtpAuthType: "abapOnBtpAuthType";
8
+ readonly serviceKey: "serviceKey";
9
+ readonly cloudFoundryAbapSystem: "cloudFoundryAbapSystem";
10
+ };
11
+ export type AbapOnBTPType = 'cloudFoundry' | 'serviceKey' | 'reentranceTicket';
12
+ interface AbapOnBtpAnswers extends Partial<OdataServiceAnswers> {
13
+ [abapOnBtpPromptNames.abapOnBtpAuthType]?: AbapOnBTPType;
14
+ [systemUrlPromptName]?: string;
15
+ [abapOnBtpPromptNames.serviceKey]?: string;
16
+ [abapOnBtpPromptNames.cloudFoundryAbapSystem]?: ServiceInstanceInfo;
17
+ }
18
+ /**
19
+ * Get the questions for the ABAP on BTP system. The questions will prompt the user for the system type (Cloud Foundry, Service Key, Re-entrance Ticket).
20
+ *
21
+ * @param promptOptions The prompt options which control the service selection and system name]
22
+ * @returns The list of questions for the ABAP on BTP system
23
+ */
24
+ export declare function getAbapOnBTPSystemQuestions(promptOptions?: OdataServicePromptOptions): Question<AbapOnBtpAnswers>[];
25
+ /**
26
+ * Get the Cloud Foundry Abap system discovery prompt. This prompt will list all available ABAP environments in the connected Cloud Foundry space.
27
+ * If the Cloud Foundry connection fails, a warning message will be displayed.
28
+ *
29
+ * @param connectionValidator The connection validator
30
+ * @returns The Cloud Foundry ABAP system discovery prompt
31
+ */
32
+ export declare function getCFDiscoverPrompts(connectionValidator: ConnectionValidator): Question[];
33
+ export {};
34
+ //# sourceMappingURL=questions.d.ts.map