@sap-ux/generator-adp 1.0.7 → 1.0.9
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/generators/add-annotations-to-odata/index.js +20 -15
- package/generators/add-component-usages/index.js +21 -16
- package/generators/add-new-model/index.js +29 -24
- package/generators/app/extension-project/index.js +9 -6
- package/generators/app/index.js +135 -129
- package/generators/app/layer.js +8 -5
- package/generators/app/questions/attributes.js +65 -60
- package/generators/app/questions/cf-services.js +52 -48
- package/generators/app/questions/configuration.js +129 -125
- package/generators/app/questions/helper/additional-messages.js +36 -29
- package/generators/app/questions/helper/choices.js +25 -16
- package/generators/app/questions/helper/conditions.js +23 -14
- package/generators/app/questions/helper/default-values.js +13 -8
- package/generators/app/questions/helper/message.js +11 -7
- package/generators/app/questions/helper/tooltip.js +7 -4
- package/generators/app/questions/helper/validators.js +39 -29
- package/generators/app/questions/key-user.js +45 -40
- package/generators/app/questions/target-env.js +27 -22
- package/generators/app/types.js +16 -13
- package/generators/base/questions/credentials.js +18 -15
- package/generators/base/sub-gen-auth-base.js +30 -24
- package/generators/base/sub-gen-base.js +17 -11
- package/generators/change-data-source/index.js +13 -8
- package/generators/telemetry/collector.js +10 -6
- package/generators/telemetry/events.js +5 -2
- package/generators/telemetry/index.js +18 -2
- package/generators/types.js +5 -2
- package/generators/utils/appWizardCache.js +13 -7
- package/generators/utils/deps.d.ts +6 -0
- package/generators/utils/deps.js +52 -10
- package/generators/utils/i18n.js +20 -12
- package/generators/utils/logger.js +7 -4
- package/generators/utils/opts.js +6 -3
- package/generators/utils/parse-json-input.js +9 -5
- package/generators/utils/steps.js +48 -37
- package/generators/utils/subgenHelpers.js +14 -9
- package/generators/utils/templates.d.ts +4 -0
- package/generators/utils/templates.js +13 -7
- package/generators/utils/type-guards.js +6 -2
- package/generators/utils/workspace.js +13 -7
- package/package.json +10 -11
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigPrompter = void 0;
|
|
4
|
+
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
5
|
+
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
6
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
7
|
+
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
8
|
+
const i18n_js_1 = require("../../utils/i18n.js");
|
|
9
|
+
const types_js_1 = require("../types.js");
|
|
10
|
+
const additional_messages_js_1 = require("./helper/additional-messages.js");
|
|
11
|
+
const choices_js_1 = require("./helper/choices.js");
|
|
12
|
+
const conditions_js_1 = require("./helper/conditions.js");
|
|
13
|
+
const message_js_1 = require("./helper/message.js");
|
|
14
|
+
const validators_js_1 = require("./helper/validators.js");
|
|
15
|
+
const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
16
|
+
const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
|
|
14
17
|
/**
|
|
15
18
|
* A stateful prompter class that creates configuration questions.
|
|
16
19
|
* It exposes a single public method {@link getPrompts} to retrieve the configuration questions.
|
|
17
20
|
*/
|
|
18
|
-
|
|
21
|
+
class ConfigPrompter {
|
|
19
22
|
systemLookup;
|
|
20
23
|
logger;
|
|
21
24
|
telemetryCollector;
|
|
@@ -181,7 +184,7 @@ export class ConfigPrompter {
|
|
|
181
184
|
this.systemLookup = systemLookup;
|
|
182
185
|
this.logger = logger;
|
|
183
186
|
this.telemetryCollector = telemetryCollector;
|
|
184
|
-
this.isCustomerBase = layer === FlexLayer.CUSTOMER_BASE;
|
|
187
|
+
this.isCustomerBase = layer === adp_tooling_1.FlexLayer.CUSTOMER_BASE;
|
|
185
188
|
}
|
|
186
189
|
/**
|
|
187
190
|
* Retrieves an array of configuration questions based on provided options.
|
|
@@ -192,19 +195,19 @@ export class ConfigPrompter {
|
|
|
192
195
|
*/
|
|
193
196
|
getPrompts(promptOptions) {
|
|
194
197
|
const keyedPrompts = {
|
|
195
|
-
[configPromptNames.system]: this.getSystemListPrompt(promptOptions?.[configPromptNames.system]),
|
|
196
|
-
[configPromptNames.systemValidationCli]: this.getSystemValidationPromptForCli(),
|
|
197
|
-
[configPromptNames.username]: this.getUsernamePrompt(promptOptions?.[configPromptNames.username]),
|
|
198
|
-
[configPromptNames.password]: this.getPasswordPrompt(promptOptions?.[configPromptNames.password]),
|
|
199
|
-
[configPromptNames.storeCredentials]: this.getStoreCredentialsPrompt(promptOptions?.[configPromptNames.storeCredentials]),
|
|
200
|
-
[configPromptNames.application]: this.getApplicationListPrompt(promptOptions?.[configPromptNames.application]),
|
|
201
|
-
[configPromptNames.appValidationCli]: this.getApplicationValidationPromptForCli(),
|
|
202
|
-
[configPromptNames.projectType]: this.getProjectTypeListPrompt(promptOptions?.[configPromptNames.projectType]),
|
|
203
|
-
[configPromptNames.projectTypeCli]: this.getProjectTypeListPromptForCli(),
|
|
204
|
-
[configPromptNames.projectTypeClassicLabel]: this.getProjectTypeClassicLabelPrompt(promptOptions?.[configPromptNames.projectTypeClassicLabel]),
|
|
205
|
-
[configPromptNames.fioriId]: this.getFioriIdPrompt(),
|
|
206
|
-
[configPromptNames.ach]: this.getAchPrompt(),
|
|
207
|
-
[configPromptNames.shouldCreateExtProject]: this.getShouldCreateExtProjectPrompt(promptOptions?.[configPromptNames.shouldCreateExtProject])
|
|
198
|
+
[types_js_1.configPromptNames.system]: this.getSystemListPrompt(promptOptions?.[types_js_1.configPromptNames.system]),
|
|
199
|
+
[types_js_1.configPromptNames.systemValidationCli]: this.getSystemValidationPromptForCli(),
|
|
200
|
+
[types_js_1.configPromptNames.username]: this.getUsernamePrompt(promptOptions?.[types_js_1.configPromptNames.username]),
|
|
201
|
+
[types_js_1.configPromptNames.password]: this.getPasswordPrompt(promptOptions?.[types_js_1.configPromptNames.password]),
|
|
202
|
+
[types_js_1.configPromptNames.storeCredentials]: this.getStoreCredentialsPrompt(promptOptions?.[types_js_1.configPromptNames.storeCredentials]),
|
|
203
|
+
[types_js_1.configPromptNames.application]: this.getApplicationListPrompt(promptOptions?.[types_js_1.configPromptNames.application]),
|
|
204
|
+
[types_js_1.configPromptNames.appValidationCli]: this.getApplicationValidationPromptForCli(),
|
|
205
|
+
[types_js_1.configPromptNames.projectType]: this.getProjectTypeListPrompt(promptOptions?.[types_js_1.configPromptNames.projectType]),
|
|
206
|
+
[types_js_1.configPromptNames.projectTypeCli]: this.getProjectTypeListPromptForCli(),
|
|
207
|
+
[types_js_1.configPromptNames.projectTypeClassicLabel]: this.getProjectTypeClassicLabelPrompt(promptOptions?.[types_js_1.configPromptNames.projectTypeClassicLabel]),
|
|
208
|
+
[types_js_1.configPromptNames.fioriId]: this.getFioriIdPrompt(),
|
|
209
|
+
[types_js_1.configPromptNames.ach]: this.getAchPrompt(),
|
|
210
|
+
[types_js_1.configPromptNames.shouldCreateExtProject]: this.getShouldCreateExtProjectPrompt(promptOptions?.[types_js_1.configPromptNames.shouldCreateExtProject])
|
|
208
211
|
};
|
|
209
212
|
const questions = Object.entries(keyedPrompts)
|
|
210
213
|
.filter(([promptName, _]) => {
|
|
@@ -223,21 +226,21 @@ export class ConfigPrompter {
|
|
|
223
226
|
getSystemListPrompt(_) {
|
|
224
227
|
return {
|
|
225
228
|
type: 'list',
|
|
226
|
-
name: configPromptNames.system,
|
|
227
|
-
message: t('prompts.systemLabel'),
|
|
229
|
+
name: types_js_1.configPromptNames.system,
|
|
230
|
+
message: (0, i18n_js_1.t)('prompts.systemLabel'),
|
|
228
231
|
choices: async () => {
|
|
229
232
|
const systems = await this.systemLookup.getSystems();
|
|
230
|
-
return getEndpointNames(systems);
|
|
233
|
+
return (0, adp_tooling_1.getEndpointNames)(systems);
|
|
231
234
|
},
|
|
232
235
|
guiOptions: {
|
|
233
236
|
mandatory: true,
|
|
234
237
|
breadcrumb: true,
|
|
235
|
-
hint: t('prompts.systemTooltip')
|
|
238
|
+
hint: (0, i18n_js_1.t)('prompts.systemTooltip')
|
|
236
239
|
},
|
|
237
240
|
default: '',
|
|
238
241
|
validate: async (value, answers) => await this.validateSystem(value, answers),
|
|
239
242
|
additionalMessages: () => {
|
|
240
|
-
this.systemAdditionalMessage = getSystemAdditionalMessages(this.flexUICapability, this.selectedProjectType);
|
|
243
|
+
this.systemAdditionalMessage = (0, additional_messages_js_1.getSystemAdditionalMessages)(this.flexUICapability, this.selectedProjectType);
|
|
241
244
|
return this.systemAdditionalMessage;
|
|
242
245
|
}
|
|
243
246
|
};
|
|
@@ -249,7 +252,7 @@ export class ConfigPrompter {
|
|
|
249
252
|
*/
|
|
250
253
|
getSystemValidationPromptForCli() {
|
|
251
254
|
return {
|
|
252
|
-
name: configPromptNames.systemValidationCli,
|
|
255
|
+
name: types_js_1.configPromptNames.systemValidationCli,
|
|
253
256
|
when: async (answers) => {
|
|
254
257
|
if (!answers.system) {
|
|
255
258
|
return false;
|
|
@@ -271,16 +274,16 @@ export class ConfigPrompter {
|
|
|
271
274
|
getUsernamePrompt(_) {
|
|
272
275
|
return {
|
|
273
276
|
type: 'input',
|
|
274
|
-
name: configPromptNames.username,
|
|
275
|
-
message: t('prompts.usernameLabel'),
|
|
277
|
+
name: types_js_1.configPromptNames.username,
|
|
278
|
+
message: (0, i18n_js_1.t)('prompts.usernameLabel'),
|
|
276
279
|
guiOptions: {
|
|
277
280
|
mandatory: true,
|
|
278
281
|
breadcrumb: true,
|
|
279
|
-
hint: t('prompts.usernameTooltip')
|
|
282
|
+
hint: (0, i18n_js_1.t)('prompts.usernameTooltip')
|
|
280
283
|
},
|
|
281
284
|
filter: (val) => val.trim(),
|
|
282
|
-
validate: (val) => validateEmptyString(val),
|
|
283
|
-
when: (answers) => showCredentialQuestion(answers, this.isAuthRequired)
|
|
285
|
+
validate: (val) => (0, project_input_validator_1.validateEmptyString)(val),
|
|
286
|
+
when: (answers) => (0, conditions_js_1.showCredentialQuestion)(answers, this.isAuthRequired)
|
|
284
287
|
};
|
|
285
288
|
}
|
|
286
289
|
/**
|
|
@@ -292,19 +295,19 @@ export class ConfigPrompter {
|
|
|
292
295
|
getPasswordPrompt(_) {
|
|
293
296
|
return {
|
|
294
297
|
type: 'password',
|
|
295
|
-
name: configPromptNames.password,
|
|
296
|
-
message: t('prompts.passwordLabel'),
|
|
298
|
+
name: types_js_1.configPromptNames.password,
|
|
299
|
+
message: (0, i18n_js_1.t)('prompts.passwordLabel'),
|
|
297
300
|
mask: '*',
|
|
298
301
|
guiOptions: {
|
|
299
302
|
type: 'login',
|
|
300
303
|
mandatory: true,
|
|
301
|
-
hint: t('prompts.passwordTooltip')
|
|
304
|
+
hint: (0, i18n_js_1.t)('prompts.passwordTooltip')
|
|
302
305
|
},
|
|
303
306
|
validate: async (value, answers) => await this.validatePassword(value, answers),
|
|
304
|
-
when: (answers) => showCredentialQuestion(answers, this.isAuthRequired),
|
|
307
|
+
when: (answers) => (0, conditions_js_1.showCredentialQuestion)(answers, this.isAuthRequired),
|
|
305
308
|
additionalMessages: () => {
|
|
306
309
|
if (!this.systemAdditionalMessage) {
|
|
307
|
-
this.systemAdditionalMessage = getSystemAdditionalMessages(this.flexUICapability, this.selectedProjectType);
|
|
310
|
+
this.systemAdditionalMessage = (0, additional_messages_js_1.getSystemAdditionalMessages)(this.flexUICapability, this.selectedProjectType);
|
|
308
311
|
return this.systemAdditionalMessage;
|
|
309
312
|
}
|
|
310
313
|
return undefined;
|
|
@@ -320,19 +323,19 @@ export class ConfigPrompter {
|
|
|
320
323
|
getStoreCredentialsPrompt(_) {
|
|
321
324
|
return {
|
|
322
325
|
type: 'confirm',
|
|
323
|
-
name: configPromptNames.storeCredentials,
|
|
324
|
-
message: t('prompts.storeCredentialsLabelBreadcrumb'),
|
|
326
|
+
name: types_js_1.configPromptNames.storeCredentials,
|
|
327
|
+
message: (0, i18n_js_1.t)('prompts.storeCredentialsLabelBreadcrumb'),
|
|
325
328
|
default: false,
|
|
326
329
|
guiOptions: {
|
|
327
|
-
breadcrumb: t('prompts.storeCredentialsLabelBreadcrumb'),
|
|
328
|
-
hint: t('prompts.storeCredentialsTooltip')
|
|
330
|
+
breadcrumb: (0, i18n_js_1.t)('prompts.storeCredentialsLabelBreadcrumb'),
|
|
331
|
+
hint: (0, i18n_js_1.t)('prompts.storeCredentialsTooltip')
|
|
329
332
|
},
|
|
330
|
-
when: (answers) => showStoreCredentialsQuestion(answers, this.isLoginSuccessful, this.isAuthRequired),
|
|
333
|
+
when: (answers) => (0, conditions_js_1.showStoreCredentialsQuestion)(answers, this.isLoginSuccessful, this.isAuthRequired),
|
|
331
334
|
additionalMessages: (input) => {
|
|
332
335
|
if (input === true) {
|
|
333
336
|
return {
|
|
334
|
-
message: t('warnings.passwordStoreWarning'),
|
|
335
|
-
severity: Severity.warning
|
|
337
|
+
message: (0, i18n_js_1.t)('warnings.passwordStoreWarning'),
|
|
338
|
+
severity: yeoman_ui_types_1.Severity.warning
|
|
336
339
|
};
|
|
337
340
|
}
|
|
338
341
|
}
|
|
@@ -347,18 +350,18 @@ export class ConfigPrompter {
|
|
|
347
350
|
getProjectTypeListPrompt(options) {
|
|
348
351
|
return {
|
|
349
352
|
type: 'list',
|
|
350
|
-
name: configPromptNames.projectType,
|
|
351
|
-
message: t('prompts.projectTypeListLabel'),
|
|
353
|
+
name: types_js_1.configPromptNames.projectType,
|
|
354
|
+
message: (0, i18n_js_1.t)('prompts.projectTypeListLabel'),
|
|
352
355
|
guiOptions: {
|
|
353
356
|
mandatory: true,
|
|
354
357
|
breadcrumb: true,
|
|
355
358
|
applyDefaultWhenDirty: true
|
|
356
359
|
},
|
|
357
|
-
choices: getProjectTypeChoices,
|
|
360
|
+
choices: choices_js_1.getProjectTypeChoices,
|
|
358
361
|
default: options?.default,
|
|
359
362
|
when: ({ application }) => this.shouldDisplayProjectTypePrompt(application),
|
|
360
363
|
validate: async (projectType, { application }) => this.validateProjectTypePrompt(projectType, application),
|
|
361
|
-
additionalMessages: (_, answers) => getAppAdditionalMessages(answers?.application, {
|
|
364
|
+
additionalMessages: (_, answers) => (0, additional_messages_js_1.getAppAdditionalMessages)(answers?.application, {
|
|
362
365
|
hasSyncViews: this.containsSyncViews,
|
|
363
366
|
isV4AppInternalMode: this.isV4AppInternalMode,
|
|
364
367
|
isSupported: this.isSupported && !this.isPartiallySupported,
|
|
@@ -375,7 +378,7 @@ export class ConfigPrompter {
|
|
|
375
378
|
*/
|
|
376
379
|
getProjectTypeListPromptForCli() {
|
|
377
380
|
return {
|
|
378
|
-
name: configPromptNames.projectTypeCli,
|
|
381
|
+
name: types_js_1.configPromptNames.projectTypeCli,
|
|
379
382
|
when: async ({ application, projectType }) => {
|
|
380
383
|
if (!application || !projectType) {
|
|
381
384
|
return false;
|
|
@@ -397,7 +400,7 @@ export class ConfigPrompter {
|
|
|
397
400
|
getProjectTypeClassicLabelPrompt(options) {
|
|
398
401
|
return {
|
|
399
402
|
type: 'input',
|
|
400
|
-
name: configPromptNames.projectTypeClassicLabel,
|
|
403
|
+
name: types_js_1.configPromptNames.projectTypeClassicLabel,
|
|
401
404
|
message: '',
|
|
402
405
|
guiOptions: {
|
|
403
406
|
type: 'label',
|
|
@@ -405,8 +408,8 @@ export class ConfigPrompter {
|
|
|
405
408
|
},
|
|
406
409
|
when: ({ application }) => !options?.hide && this.shouldDisplayProjectTypeClassicLabel(application),
|
|
407
410
|
additionalMessages: () => ({
|
|
408
|
-
message: t('prompts.projectTypeClassicLabel'),
|
|
409
|
-
severity: Severity.information
|
|
411
|
+
message: (0, i18n_js_1.t)('prompts.projectTypeClassicLabel'),
|
|
412
|
+
severity: yeoman_ui_types_1.Severity.information
|
|
410
413
|
})
|
|
411
414
|
};
|
|
412
415
|
}
|
|
@@ -419,15 +422,15 @@ export class ConfigPrompter {
|
|
|
419
422
|
getApplicationListPrompt(options) {
|
|
420
423
|
return {
|
|
421
424
|
type: 'list',
|
|
422
|
-
name: configPromptNames.application,
|
|
423
|
-
message: t('prompts.applicationListLabel'),
|
|
425
|
+
name: types_js_1.configPromptNames.application,
|
|
426
|
+
message: (0, i18n_js_1.t)('prompts.applicationListLabel'),
|
|
424
427
|
guiOptions: {
|
|
425
428
|
mandatory: true,
|
|
426
429
|
breadcrumb: true,
|
|
427
|
-
hint: t('prompts.applicationListTooltip'),
|
|
430
|
+
hint: (0, i18n_js_1.t)('prompts.applicationListTooltip'),
|
|
428
431
|
applyDefaultWhenDirty: true
|
|
429
432
|
},
|
|
430
|
-
choices: () => getApplicationChoices(this.targetApps),
|
|
433
|
+
choices: () => (0, choices_js_1.getApplicationChoices)(this.targetApps),
|
|
431
434
|
default: options?.default,
|
|
432
435
|
validate: (application) => {
|
|
433
436
|
if (this.shouldDisplayProjectTypePrompt(application)) {
|
|
@@ -435,17 +438,17 @@ export class ConfigPrompter {
|
|
|
435
438
|
return true;
|
|
436
439
|
}
|
|
437
440
|
if (this.isClassicAppOnMixedSystem(application)) {
|
|
438
|
-
this.selectedProjectType = AdaptationProjectType.ON_PREMISE;
|
|
441
|
+
this.selectedProjectType = axios_extension_1.AdaptationProjectType.ON_PREMISE;
|
|
439
442
|
}
|
|
440
443
|
return this.validateAppPrompt(application);
|
|
441
444
|
},
|
|
442
|
-
when: (answers) => showApplicationQuestion(answers, !!this.targetApps?.length, this.isAuthRequired, this.isLoginSuccessful),
|
|
445
|
+
when: (answers) => (0, conditions_js_1.showApplicationQuestion)(answers, !!this.targetApps?.length, this.isAuthRequired, this.isLoginSuccessful),
|
|
443
446
|
additionalMessages: (input) => {
|
|
444
447
|
const application = input;
|
|
445
448
|
if (this.shouldDisplayProjectTypePrompt(application)) {
|
|
446
449
|
return undefined;
|
|
447
450
|
}
|
|
448
|
-
return getAppAdditionalMessages(application, {
|
|
451
|
+
return (0, additional_messages_js_1.getAppAdditionalMessages)(application, {
|
|
449
452
|
hasSyncViews: this.containsSyncViews,
|
|
450
453
|
isV4AppInternalMode: this.isV4AppInternalMode,
|
|
451
454
|
isSupported: this.isSupported && !this.isPartiallySupported,
|
|
@@ -461,13 +464,13 @@ export class ConfigPrompter {
|
|
|
461
464
|
*/
|
|
462
465
|
getApplicationValidationPromptForCli() {
|
|
463
466
|
return {
|
|
464
|
-
name: configPromptNames.appValidationCli,
|
|
467
|
+
name: types_js_1.configPromptNames.appValidationCli,
|
|
465
468
|
when: async ({ application }) => {
|
|
466
469
|
if (!application || this.shouldDisplayProjectTypePrompt(application)) {
|
|
467
470
|
return false;
|
|
468
471
|
}
|
|
469
472
|
if (this.isClassicAppOnMixedSystem(application)) {
|
|
470
|
-
this.selectedProjectType = AdaptationProjectType.ON_PREMISE;
|
|
473
|
+
this.selectedProjectType = axios_extension_1.AdaptationProjectType.ON_PREMISE;
|
|
471
474
|
}
|
|
472
475
|
const result = await this.validateAppPrompt(application);
|
|
473
476
|
if (typeof result === 'string') {
|
|
@@ -487,13 +490,13 @@ export class ConfigPrompter {
|
|
|
487
490
|
return {
|
|
488
491
|
type: 'input',
|
|
489
492
|
name: 'fioriId',
|
|
490
|
-
message: t('prompts.fioriIdLabel'),
|
|
493
|
+
message: (0, i18n_js_1.t)('prompts.fioriIdLabel'),
|
|
491
494
|
guiOptions: {
|
|
492
|
-
hint: t('prompts.fioriIdHint'),
|
|
495
|
+
hint: (0, i18n_js_1.t)('prompts.fioriIdHint'),
|
|
493
496
|
breadcrumb: true
|
|
494
497
|
},
|
|
495
|
-
when: (answers) => showInternalQuestions(answers, this.isCustomerBase, this.isApplicationSupported),
|
|
496
|
-
default: () => getFioriId(this.appManifest),
|
|
498
|
+
when: (answers) => (0, conditions_js_1.showInternalQuestions)(answers, this.isCustomerBase, this.isApplicationSupported),
|
|
499
|
+
default: () => (0, adp_tooling_1.getFioriId)(this.appManifest),
|
|
497
500
|
store: false
|
|
498
501
|
};
|
|
499
502
|
}
|
|
@@ -507,15 +510,15 @@ export class ConfigPrompter {
|
|
|
507
510
|
return {
|
|
508
511
|
type: 'input',
|
|
509
512
|
name: 'ach',
|
|
510
|
-
message: t('prompts.achLabel'),
|
|
513
|
+
message: (0, i18n_js_1.t)('prompts.achLabel'),
|
|
511
514
|
guiOptions: {
|
|
512
|
-
hint: t('prompts.achHint'),
|
|
515
|
+
hint: (0, i18n_js_1.t)('prompts.achHint'),
|
|
513
516
|
breadcrumb: true,
|
|
514
517
|
mandatory: true
|
|
515
518
|
},
|
|
516
|
-
when: (answers) => showInternalQuestions(answers, this.isCustomerBase, this.isApplicationSupported),
|
|
517
|
-
default: () => getAch(this.appManifest),
|
|
518
|
-
validate: (value) => validateAch(value, this.isCustomerBase),
|
|
519
|
+
when: (answers) => (0, conditions_js_1.showInternalQuestions)(answers, this.isCustomerBase, this.isApplicationSupported),
|
|
520
|
+
default: () => (0, adp_tooling_1.getAch)(this.appManifest),
|
|
521
|
+
validate: (value) => (0, project_input_validator_1.validateAch)(value, this.isCustomerBase),
|
|
519
522
|
store: false
|
|
520
523
|
};
|
|
521
524
|
}
|
|
@@ -529,20 +532,20 @@ export class ConfigPrompter {
|
|
|
529
532
|
getShouldCreateExtProjectPrompt(options) {
|
|
530
533
|
return {
|
|
531
534
|
type: 'confirm',
|
|
532
|
-
name: configPromptNames.shouldCreateExtProject,
|
|
533
|
-
message: () => getExtProjectMessage(this.isApplicationSupported, this.containsSyncViews, this.appValidationErrorMessage),
|
|
535
|
+
name: types_js_1.configPromptNames.shouldCreateExtProject,
|
|
536
|
+
message: () => (0, message_js_1.getExtProjectMessage)(this.isApplicationSupported, this.containsSyncViews, this.appValidationErrorMessage),
|
|
534
537
|
default: false,
|
|
535
538
|
guiOptions: {
|
|
536
539
|
applyDefaultWhenDirty: true
|
|
537
540
|
},
|
|
538
|
-
when: (answers) => showExtensionProjectQuestion({
|
|
541
|
+
when: (answers) => (0, conditions_js_1.showExtensionProjectQuestion)({
|
|
539
542
|
projectType: this.selectedProjectType,
|
|
540
543
|
isApplicationSelected: !!answers.application,
|
|
541
544
|
isApplicationSupported: this.isApplicationSupported,
|
|
542
545
|
hasSyncViews: this.containsSyncViews,
|
|
543
546
|
flexUICapability: this.flexUICapability
|
|
544
547
|
}),
|
|
545
|
-
validate: (value) => validateExtensibilityExtension({
|
|
548
|
+
validate: (value) => (0, validators_js_1.validateExtensibilityExtension)({
|
|
546
549
|
value,
|
|
547
550
|
isApplicationSupported: this.isApplicationSupported,
|
|
548
551
|
hasSyncViews: this.containsSyncViews,
|
|
@@ -560,12 +563,12 @@ export class ConfigPrompter {
|
|
|
560
563
|
*/
|
|
561
564
|
async validateAppPrompt(app) {
|
|
562
565
|
if (!app) {
|
|
563
|
-
return t('error.selectCannotBeEmptyError', { value: 'Application' });
|
|
566
|
+
return (0, i18n_js_1.t)('error.selectCannotBeEmptyError', { value: 'Application' });
|
|
564
567
|
}
|
|
565
568
|
const validationResult = await this.validateAppData(app);
|
|
566
|
-
const isKnownUnsupported = validationResult === t('error.appDoesNotSupportManifest') ||
|
|
567
|
-
validationResult === t('error.appDoesNotSupportFlexibility');
|
|
568
|
-
if (isAppStudio() && isKnownUnsupported && this.selectedProjectType !== AdaptationProjectType.CLOUD_READY) {
|
|
569
|
+
const isKnownUnsupported = validationResult === (0, i18n_js_1.t)('error.appDoesNotSupportManifest') ||
|
|
570
|
+
validationResult === (0, i18n_js_1.t)('error.appDoesNotSupportFlexibility');
|
|
571
|
+
if ((0, btp_utils_1.isAppStudio)() && isKnownUnsupported && this.selectedProjectType !== axios_extension_1.AdaptationProjectType.CLOUD_READY) {
|
|
569
572
|
this.logger.error(validationResult);
|
|
570
573
|
this.appValidationErrorMessage = validationResult;
|
|
571
574
|
this.isApplicationSupported = false;
|
|
@@ -575,12 +578,12 @@ export class ConfigPrompter {
|
|
|
575
578
|
if (typeof validationResult === 'string') {
|
|
576
579
|
return validationResult;
|
|
577
580
|
}
|
|
578
|
-
if (this.selectedProjectType === AdaptationProjectType.CLOUD_READY) {
|
|
581
|
+
if (this.selectedProjectType === axios_extension_1.AdaptationProjectType.CLOUD_READY) {
|
|
579
582
|
try {
|
|
580
|
-
this.baseApplicationInbounds = await getBaseAppInbounds(app.id, this.provider);
|
|
583
|
+
this.baseApplicationInbounds = await (0, adp_tooling_1.getBaseAppInbounds)(app.id, this.provider);
|
|
581
584
|
}
|
|
582
585
|
catch (error) {
|
|
583
|
-
return t('error.fetchBaseInboundsFailed', { error: error.message });
|
|
586
|
+
return (0, i18n_js_1.t)('error.fetchBaseInboundsFailed', { error: error.message });
|
|
584
587
|
}
|
|
585
588
|
}
|
|
586
589
|
return true;
|
|
@@ -594,7 +597,7 @@ export class ConfigPrompter {
|
|
|
594
597
|
* @returns An error message if validation fails, or true if the system selection is valid.
|
|
595
598
|
*/
|
|
596
599
|
async validatePassword(password, answers) {
|
|
597
|
-
const validationResult = validateEmptyString(password);
|
|
600
|
+
const validationResult = (0, project_input_validator_1.validateEmptyString)(password);
|
|
598
601
|
if (typeof validationResult === 'string') {
|
|
599
602
|
return validationResult;
|
|
600
603
|
}
|
|
@@ -602,7 +605,7 @@ export class ConfigPrompter {
|
|
|
602
605
|
return true;
|
|
603
606
|
}
|
|
604
607
|
if (!answers.system || !answers.username) {
|
|
605
|
-
return t('error.pleaseProvideAllRequiredData');
|
|
608
|
+
return (0, i18n_js_1.t)('error.pleaseProvideAllRequiredData');
|
|
606
609
|
}
|
|
607
610
|
const options = {
|
|
608
611
|
system: answers.system,
|
|
@@ -611,13 +614,13 @@ export class ConfigPrompter {
|
|
|
611
614
|
password
|
|
612
615
|
};
|
|
613
616
|
try {
|
|
614
|
-
this.abapProvider = await getConfiguredProvider(options, this.logger);
|
|
617
|
+
this.abapProvider = await (0, adp_tooling_1.getConfiguredProvider)(options, this.logger);
|
|
615
618
|
const validationResult = await this.handleSystemDataValidation();
|
|
616
619
|
if (typeof validationResult === 'string') {
|
|
617
620
|
return validationResult;
|
|
618
621
|
}
|
|
619
622
|
this.telemetryCollector.startTiming('applicationListLoadingTime');
|
|
620
|
-
this.targetApps = await loadApps(this.abapProvider, this.isCustomerBase, this.supportedProject);
|
|
623
|
+
this.targetApps = await (0, adp_tooling_1.loadApps)(this.abapProvider, this.isCustomerBase, this.supportedProject);
|
|
621
624
|
this.telemetryCollector.setBatch({ numberOfApplications: this.targetApps.length });
|
|
622
625
|
this.telemetryCollector.endTiming('applicationListLoadingTime');
|
|
623
626
|
this.isLoginSuccessful = true;
|
|
@@ -637,7 +640,7 @@ export class ConfigPrompter {
|
|
|
637
640
|
* @returns An error message if validation fails, or true if the system selection is valid.
|
|
638
641
|
*/
|
|
639
642
|
async validateSystem(system, answers) {
|
|
640
|
-
const validationResult = validateEmptyString(system);
|
|
643
|
+
const validationResult = (0, project_input_validator_1.validateEmptyString)(system);
|
|
641
644
|
if (typeof validationResult === 'string') {
|
|
642
645
|
return validationResult;
|
|
643
646
|
}
|
|
@@ -653,7 +656,7 @@ export class ConfigPrompter {
|
|
|
653
656
|
this.selectedProjectType = undefined;
|
|
654
657
|
this.selectedSystemType = undefined;
|
|
655
658
|
this.supportedProject = undefined;
|
|
656
|
-
this.abapProvider = await getConfiguredProvider(options, this.logger);
|
|
659
|
+
this.abapProvider = await (0, adp_tooling_1.getConfiguredProvider)(options, this.logger);
|
|
657
660
|
this.isAuthRequired = await this.systemLookup.getSystemRequiresAuth(system);
|
|
658
661
|
if (this.isAuthRequired) {
|
|
659
662
|
return true;
|
|
@@ -663,7 +666,7 @@ export class ConfigPrompter {
|
|
|
663
666
|
return validationResult;
|
|
664
667
|
}
|
|
665
668
|
this.telemetryCollector.startTiming('applicationListLoadingTime');
|
|
666
|
-
this.targetApps = await loadApps(this.abapProvider, this.isCustomerBase, this.supportedProject);
|
|
669
|
+
this.targetApps = await (0, adp_tooling_1.loadApps)(this.abapProvider, this.isCustomerBase, this.supportedProject);
|
|
667
670
|
this.telemetryCollector.setBatch({ numberOfApplications: this.targetApps.length });
|
|
668
671
|
this.telemetryCollector.endTiming('applicationListLoadingTime');
|
|
669
672
|
return true;
|
|
@@ -682,8 +685,8 @@ export class ConfigPrompter {
|
|
|
682
685
|
try {
|
|
683
686
|
// Reset the flag when we are selecting a new application from the list.
|
|
684
687
|
this.isApplicationSupported = false;
|
|
685
|
-
const sourceManifest = new SourceManifest(this.abapProvider, app.id, this.logger);
|
|
686
|
-
const isSupported = await isAppSupported(this.abapProvider, app.id, this.logger);
|
|
688
|
+
const sourceManifest = new adp_tooling_1.SourceManifest(this.abapProvider, app.id, this.logger);
|
|
689
|
+
const isSupported = await (0, adp_tooling_1.isAppSupported)(this.abapProvider, app.id, this.logger);
|
|
687
690
|
if (isSupported) {
|
|
688
691
|
this.appManifest = await sourceManifest.getManifest();
|
|
689
692
|
this.validateManifest();
|
|
@@ -703,8 +706,8 @@ export class ConfigPrompter {
|
|
|
703
706
|
* @param {SourceApplication} application - The application data.
|
|
704
707
|
*/
|
|
705
708
|
evaluateAppSupport(application) {
|
|
706
|
-
const isFullSupport = !!this.systemVersion && !isFeatureSupportedVersion('1.96.0', this.systemVersion);
|
|
707
|
-
const isPartialSupport = !!this.systemVersion && isFullSupport && isFeatureSupportedVersion('1.90.0', this.systemVersion);
|
|
709
|
+
const isFullSupport = !!this.systemVersion && !(0, adp_tooling_1.isFeatureSupportedVersion)('1.96.0', this.systemVersion);
|
|
710
|
+
const isPartialSupport = !!this.systemVersion && isFullSupport && (0, adp_tooling_1.isFeatureSupportedVersion)('1.90.0', this.systemVersion);
|
|
708
711
|
this.setSupportFlags(application, isFullSupport, isPartialSupport);
|
|
709
712
|
}
|
|
710
713
|
/**
|
|
@@ -716,23 +719,23 @@ export class ConfigPrompter {
|
|
|
716
719
|
try {
|
|
717
720
|
// Do not include the ato settings retreival in the parallel calls because we need to first login
|
|
718
721
|
// before executing any other call. A provider works like this - with the first api call it authenticates the user.
|
|
719
|
-
this.selectedSystemType = (await this.provider.isAbapCloud()) ? SystemType.CLOUD_READY : SystemType.ON_PREM;
|
|
722
|
+
this.selectedSystemType = (await this.provider.isAbapCloud()) ? types_js_1.SystemType.CLOUD_READY : types_js_1.SystemType.ON_PREM;
|
|
720
723
|
const [supportedProject, flexUICapability] = await Promise.all([
|
|
721
|
-
getSupportedProject(this.abapProvider),
|
|
722
|
-
getFlexUICapability(this.abapProvider, this.isCustomerBase)
|
|
724
|
+
(0, adp_tooling_1.getSupportedProject)(this.abapProvider),
|
|
725
|
+
(0, adp_tooling_1.getFlexUICapability)(this.abapProvider, this.isCustomerBase)
|
|
723
726
|
]);
|
|
724
727
|
this.supportedProject = supportedProject;
|
|
725
728
|
this.flexUICapability = flexUICapability;
|
|
726
729
|
// Set selected project type based on the supported project.
|
|
727
|
-
if (this.supportedProject === SupportedProject.CLOUD_READY) {
|
|
728
|
-
this.selectedProjectType = AdaptationProjectType.CLOUD_READY;
|
|
730
|
+
if (this.supportedProject === adp_tooling_1.SupportedProject.CLOUD_READY) {
|
|
731
|
+
this.selectedProjectType = axios_extension_1.AdaptationProjectType.CLOUD_READY;
|
|
729
732
|
}
|
|
730
|
-
else if (this.supportedProject === SupportedProject.ON_PREM) {
|
|
731
|
-
this.selectedProjectType = AdaptationProjectType.ON_PREMISE;
|
|
733
|
+
else if (this.supportedProject === adp_tooling_1.SupportedProject.ON_PREM) {
|
|
734
|
+
this.selectedProjectType = axios_extension_1.AdaptationProjectType.ON_PREMISE;
|
|
732
735
|
}
|
|
733
|
-
else if (this.supportedProject === SupportedProject.CLOUD_READY_AND_ON_PREM &&
|
|
734
|
-
isInternalFeaturesSettingEnabled()) {
|
|
735
|
-
this.selectedProjectType = AdaptationProjectType.ON_PREMISE;
|
|
736
|
+
else if (this.supportedProject === adp_tooling_1.SupportedProject.CLOUD_READY_AND_ON_PREM &&
|
|
737
|
+
(0, feature_toggle_1.isInternalFeaturesSettingEnabled)()) {
|
|
738
|
+
this.selectedProjectType = axios_extension_1.AdaptationProjectType.ON_PREMISE;
|
|
736
739
|
}
|
|
737
740
|
}
|
|
738
741
|
catch (error) {
|
|
@@ -747,14 +750,14 @@ export class ConfigPrompter {
|
|
|
747
750
|
async loadUI5Versions() {
|
|
748
751
|
let version;
|
|
749
752
|
try {
|
|
750
|
-
version = await getSystemUI5Version(this.abapProvider, this.logger);
|
|
753
|
+
version = await (0, adp_tooling_1.getSystemUI5Version)(this.abapProvider, this.logger);
|
|
751
754
|
}
|
|
752
755
|
catch (error) {
|
|
753
756
|
this.logger.debug(`Could not fetch the system UI5 version: ${error.message}.`);
|
|
754
757
|
}
|
|
755
|
-
this.systemVersion = checkSystemVersionPattern(version);
|
|
756
|
-
this.publicVersions = await fetchPublicVersions(this.logger);
|
|
757
|
-
this.ui5Versions = await getRelevantVersions(version, this.isCustomerBase, this.publicVersions);
|
|
758
|
+
this.systemVersion = (0, adp_tooling_1.checkSystemVersionPattern)(version);
|
|
759
|
+
this.publicVersions = await (0, adp_tooling_1.fetchPublicVersions)(this.logger);
|
|
760
|
+
this.ui5Versions = await (0, adp_tooling_1.getRelevantVersions)(version, this.isCustomerBase, this.publicVersions);
|
|
758
761
|
}
|
|
759
762
|
/**
|
|
760
763
|
* Handles the fetching and validation of system data.
|
|
@@ -765,8 +768,8 @@ export class ConfigPrompter {
|
|
|
765
768
|
try {
|
|
766
769
|
await this.loadSystemData();
|
|
767
770
|
await this.loadUI5Versions();
|
|
768
|
-
if (!this.isCustomerBase && this.selectedProjectType === AdaptationProjectType.CLOUD_READY) {
|
|
769
|
-
return t('error.cloudSystemsForInternalUsers');
|
|
771
|
+
if (!this.isCustomerBase && this.selectedProjectType === axios_extension_1.AdaptationProjectType.CLOUD_READY) {
|
|
772
|
+
return (0, i18n_js_1.t)('error.cloudSystemsForInternalUsers');
|
|
770
773
|
}
|
|
771
774
|
return true;
|
|
772
775
|
}
|
|
@@ -782,13 +785,13 @@ export class ConfigPrompter {
|
|
|
782
785
|
*/
|
|
783
786
|
handleSystemError(error) {
|
|
784
787
|
this.logger.debug(`Failed to fetch system information. Reason: ${error.message}`);
|
|
785
|
-
if (isAxiosError(error)) {
|
|
788
|
+
if ((0, axios_extension_1.isAxiosError)(error)) {
|
|
786
789
|
if (error.response?.status === 401 || error.response?.status === 403) {
|
|
787
790
|
throw new Error(`Authentication error: ${error.message}`);
|
|
788
791
|
}
|
|
789
792
|
if (error.response?.status === 405 || error.response?.status === 404) {
|
|
790
793
|
// Handle the case where the API is not available and continue to standard onPremise flow
|
|
791
|
-
this.selectedProjectType = AdaptationProjectType.ON_PREMISE;
|
|
794
|
+
this.selectedProjectType = axios_extension_1.AdaptationProjectType.ON_PREMISE;
|
|
792
795
|
return;
|
|
793
796
|
}
|
|
794
797
|
throw error;
|
|
@@ -802,11 +805,11 @@ export class ConfigPrompter {
|
|
|
802
805
|
*/
|
|
803
806
|
validateManifest() {
|
|
804
807
|
if (!this.appManifest) {
|
|
805
|
-
throw new Error(t('error.manifestCouldNotBeValidated'));
|
|
808
|
+
throw new Error((0, i18n_js_1.t)('error.manifestCouldNotBeValidated'));
|
|
806
809
|
}
|
|
807
810
|
const ui5 = this.appManifest?.['sap.ui5'];
|
|
808
811
|
if (ui5?.flexEnabled === false) {
|
|
809
|
-
throw new Error(t('error.appDoesNotSupportFlexibility'));
|
|
812
|
+
throw new Error((0, i18n_js_1.t)('error.appDoesNotSupportFlexibility'));
|
|
810
813
|
}
|
|
811
814
|
}
|
|
812
815
|
/**
|
|
@@ -835,8 +838,8 @@ export class ConfigPrompter {
|
|
|
835
838
|
setSupportFlags(application, isFullSupport, isPartialSupport) {
|
|
836
839
|
this.isSupported = !(isFullSupport && application.fileType === 'appdescr_variant');
|
|
837
840
|
this.isPartiallySupported = isPartialSupport && application.fileType === 'appdescr_variant';
|
|
838
|
-
this.isV4AppInternalMode = isV4Application(this.appManifest) && !this.isCustomerBase;
|
|
839
|
-
this.containsSyncViews = isSyncLoadedView(this.appManifest?.['sap.ui5']);
|
|
841
|
+
this.isV4AppInternalMode = (0, adp_tooling_1.isV4Application)(this.appManifest) && !this.isCustomerBase;
|
|
842
|
+
this.containsSyncViews = (0, adp_tooling_1.isSyncLoadedView)(this.appManifest?.['sap.ui5']);
|
|
840
843
|
}
|
|
841
844
|
/**
|
|
842
845
|
* Checks if the application is a released app on a mixed system that requires
|
|
@@ -847,7 +850,7 @@ export class ConfigPrompter {
|
|
|
847
850
|
*/
|
|
848
851
|
isReleasedAppOnMixedSystem(application) {
|
|
849
852
|
return (application?.cloudDevAdaptationStatus === this.CLOUD_DEV_ADP_STATUS_RELEASED &&
|
|
850
|
-
this.supportedProject === SupportedProject.CLOUD_READY_AND_ON_PREM);
|
|
853
|
+
this.supportedProject === adp_tooling_1.SupportedProject.CLOUD_READY_AND_ON_PREM);
|
|
851
854
|
}
|
|
852
855
|
/**
|
|
853
856
|
* Checks if the application is a classic (non-released) app on a mixed system
|
|
@@ -857,7 +860,7 @@ export class ConfigPrompter {
|
|
|
857
860
|
* @returns {boolean} True if the application is classic on a mixed system.
|
|
858
861
|
*/
|
|
859
862
|
isClassicAppOnMixedSystem(application) {
|
|
860
|
-
return (this.supportedProject === SupportedProject.CLOUD_READY_AND_ON_PREM &&
|
|
863
|
+
return (this.supportedProject === adp_tooling_1.SupportedProject.CLOUD_READY_AND_ON_PREM &&
|
|
861
864
|
application?.cloudDevAdaptationStatus === '');
|
|
862
865
|
}
|
|
863
866
|
/**
|
|
@@ -868,7 +871,7 @@ export class ConfigPrompter {
|
|
|
868
871
|
* @returns {boolean} True if the project type must be displayed.
|
|
869
872
|
*/
|
|
870
873
|
shouldDisplayProjectTypePrompt(application) {
|
|
871
|
-
return !isInternalFeaturesSettingEnabled() && this.isReleasedAppOnMixedSystem(application);
|
|
874
|
+
return !(0, feature_toggle_1.isInternalFeaturesSettingEnabled)() && this.isReleasedAppOnMixedSystem(application);
|
|
872
875
|
}
|
|
873
876
|
/**
|
|
874
877
|
* Determines the project type classic label visibility. In case the user is external,
|
|
@@ -878,7 +881,8 @@ export class ConfigPrompter {
|
|
|
878
881
|
* @returns {boolean} True if the project type classic label must be displayed.
|
|
879
882
|
*/
|
|
880
883
|
shouldDisplayProjectTypeClassicLabel(application) {
|
|
881
|
-
return !isInternalFeaturesSettingEnabled() && this.isClassicAppOnMixedSystem(application);
|
|
884
|
+
return !(0, feature_toggle_1.isInternalFeaturesSettingEnabled)() && this.isClassicAppOnMixedSystem(application);
|
|
882
885
|
}
|
|
883
886
|
}
|
|
887
|
+
exports.ConfigPrompter = ConfigPrompter;
|
|
884
888
|
//# sourceMappingURL=configuration.js.map
|