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