@sap-ux/generator-adp 0.1.0 → 0.1.3
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/app/index.d.ts +4 -4
- package/generators/app/index.js +22 -12
- package/generators/app/questions/configuration.d.ts +149 -15
- package/generators/app/questions/configuration.js +303 -42
- package/generators/app/questions/helper/additional-messages.d.ts +35 -0
- package/generators/app/questions/helper/additional-messages.js +89 -0
- package/generators/app/questions/helper/choices.d.ts +4 -4
- package/generators/app/questions/helper/choices.js +1 -1
- package/generators/app/questions/helper/conditions.d.ts +11 -17
- package/generators/app/questions/helper/conditions.js +15 -29
- package/generators/app/types.d.ts +8 -1
- package/generators/app/types.js +2 -0
- package/generators/translations/generator-adp.i18n.json +13 -2
- package/generators/utils/deps.d.ts +7 -0
- package/generators/utils/deps.js +12 -1
- package/package.json +2 -2
|
@@ -35,13 +35,13 @@ export default class extends Generator {
|
|
|
35
35
|
*/
|
|
36
36
|
private targetFolder;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* SystemLookup instance for managing system endpoints.
|
|
39
39
|
*/
|
|
40
|
-
private
|
|
40
|
+
private systemLookup;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Instance of the configuration prompter class.
|
|
43
43
|
*/
|
|
44
|
-
private
|
|
44
|
+
private prompter;
|
|
45
45
|
/**
|
|
46
46
|
* Creates an instance of the generator.
|
|
47
47
|
*
|
package/generators/app/index.js
CHANGED
|
@@ -7,14 +7,14 @@ const yeoman_generator_1 = __importDefault(require("yeoman-generator"));
|
|
|
7
7
|
const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
|
|
8
8
|
const logger_1 = require("@sap-ux/logger");
|
|
9
9
|
const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
10
|
-
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
11
10
|
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
11
|
+
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
12
12
|
const layer_1 = require("./layer");
|
|
13
13
|
const i18n_1 = require("../utils/i18n");
|
|
14
14
|
const telemetryEvents_1 = require("../telemetryEvents");
|
|
15
15
|
const logger_2 = __importDefault(require("../utils/logger"));
|
|
16
|
-
const deps_1 = require("../utils/deps");
|
|
17
16
|
const configuration_1 = require("./questions/configuration");
|
|
17
|
+
const deps_1 = require("../utils/deps");
|
|
18
18
|
const default_values_1 = require("./questions/helper/default-values");
|
|
19
19
|
/**
|
|
20
20
|
* Generator for creating an Adaptation Project.
|
|
@@ -51,13 +51,13 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
51
51
|
*/
|
|
52
52
|
targetFolder;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* SystemLookup instance for managing system endpoints.
|
|
55
55
|
*/
|
|
56
|
-
|
|
56
|
+
systemLookup;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Instance of the configuration prompter class.
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
prompter;
|
|
61
61
|
/**
|
|
62
62
|
* Creates an instance of the generator.
|
|
63
63
|
*
|
|
@@ -79,8 +79,7 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
79
79
|
const pages = [{ name: (0, i18n_1.t)('yuiNavSteps.configurationName'), description: (0, i18n_1.t)('yuiNavSteps.configurationDescr') }];
|
|
80
80
|
this.prompts.splice(0, 0, pages);
|
|
81
81
|
this.layer = await (0, layer_1.getFlexLayer)();
|
|
82
|
-
this.
|
|
83
|
-
this.abapProvider = new adp_tooling_1.AbapProvider(this.targetSystems, this.toolsLogger);
|
|
82
|
+
this.systemLookup = new adp_tooling_1.SystemLookup(this.toolsLogger);
|
|
84
83
|
await fiori_generator_shared_1.TelemetryHelper.initTelemetrySettings({
|
|
85
84
|
consumerModule: {
|
|
86
85
|
name: '@sap/generator-fiori:generator-adp',
|
|
@@ -91,8 +90,12 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
async prompting() {
|
|
94
|
-
|
|
95
|
-
const
|
|
93
|
+
this.prompter = new configuration_1.ConfigPrompter(this.systemLookup, this.layer, this.toolsLogger);
|
|
94
|
+
const isCLI = (0, fiori_generator_shared_1.getHostEnvironment)() === fiori_generator_shared_1.hostEnvironment.cli;
|
|
95
|
+
const configQuestions = this.prompter.getPrompts({
|
|
96
|
+
appValidationCli: { hide: !isCLI },
|
|
97
|
+
systemValidationCli: { hide: !isCLI }
|
|
98
|
+
});
|
|
96
99
|
this.configAnswers = await this.prompt(configQuestions);
|
|
97
100
|
this.logger.info(`System: ${this.configAnswers.system}`);
|
|
98
101
|
this.logger.info(`Application: ${JSON.stringify(this.configAnswers.application, null, 2)}`);
|
|
@@ -102,8 +105,15 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
102
105
|
const projectName = (0, default_values_1.getDefaultProjectName)(this.destinationPath());
|
|
103
106
|
const namespace = (0, default_values_1.generateValidNamespace)(projectName, this.layer);
|
|
104
107
|
this.targetFolder = this.destinationPath(projectName);
|
|
105
|
-
const
|
|
106
|
-
const config = await
|
|
108
|
+
const packageJson = (0, deps_1.getPackageInfo)();
|
|
109
|
+
const config = await (0, adp_tooling_1.getConfig)({
|
|
110
|
+
provider: this.prompter.provider,
|
|
111
|
+
configAnswers: this.configAnswers,
|
|
112
|
+
layer: this.layer,
|
|
113
|
+
defaults: { namespace },
|
|
114
|
+
packageJson,
|
|
115
|
+
logger: this.toolsLogger
|
|
116
|
+
});
|
|
107
117
|
await (0, adp_tooling_1.generate)(this.targetFolder, config, this.fs);
|
|
108
118
|
}
|
|
109
119
|
catch (e) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
1
|
import { FlexLayer } from '@sap-ux/adp-tooling';
|
|
3
|
-
import type {
|
|
2
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
|
+
import type { Manifest } from '@sap-ux/project-access';
|
|
4
|
+
import { type AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
5
|
+
import type { SystemLookup } from '@sap-ux/adp-tooling';
|
|
4
6
|
import type { ConfigPromptOptions, ConfigQuestion } from '../types';
|
|
5
7
|
/**
|
|
6
8
|
* A stateful prompter class that creates configuration questions.
|
|
@@ -8,26 +10,90 @@ import type { ConfigPromptOptions, ConfigQuestion } from '../types';
|
|
|
8
10
|
* It exposes a single public method {@link getPrompts} to retrieve the configuration questions.
|
|
9
11
|
*/
|
|
10
12
|
export declare class ConfigPrompter {
|
|
11
|
-
private readonly
|
|
12
|
-
private readonly targetSystems;
|
|
13
|
+
private readonly systemLookup;
|
|
13
14
|
private readonly logger;
|
|
14
|
-
/**
|
|
15
|
-
* Instance of target applications class for loading applications.
|
|
16
|
-
*/
|
|
17
|
-
private readonly targetApps;
|
|
18
15
|
/**
|
|
19
16
|
* Indicates if the current layer is based on a customer base.
|
|
20
17
|
*/
|
|
21
18
|
private readonly isCustomerBase;
|
|
19
|
+
/**
|
|
20
|
+
* Instance of AbapServiceProvider.
|
|
21
|
+
*/
|
|
22
|
+
private abapProvider;
|
|
23
|
+
/**
|
|
24
|
+
* Application manifest.
|
|
25
|
+
*/
|
|
26
|
+
private appManifest;
|
|
27
|
+
/**
|
|
28
|
+
* Loaded target applications for a system.
|
|
29
|
+
*/
|
|
30
|
+
private targetApps;
|
|
31
|
+
/**
|
|
32
|
+
* Flag indicating that system login is successful.
|
|
33
|
+
*/
|
|
34
|
+
private isLoginSuccessful;
|
|
35
|
+
/**
|
|
36
|
+
* Flag indicating that system requires authentication in BAS or it does not exist in VS Code.
|
|
37
|
+
*/
|
|
38
|
+
private isAuthRequired;
|
|
39
|
+
/**
|
|
40
|
+
* Cached UI flexibility information from the system.
|
|
41
|
+
*/
|
|
42
|
+
private flexUISystem;
|
|
43
|
+
/**
|
|
44
|
+
* Flag indicating if the project is a cloud project.
|
|
45
|
+
*/
|
|
46
|
+
private isCloudProject;
|
|
47
|
+
/**
|
|
48
|
+
* Flag indicating whether the selected application is supported.
|
|
49
|
+
*/
|
|
50
|
+
private isApplicationSupported;
|
|
51
|
+
/**
|
|
52
|
+
* Indicates whether views are loaded synchronously.
|
|
53
|
+
*/
|
|
54
|
+
private containsSyncViews;
|
|
55
|
+
/**
|
|
56
|
+
* Flag indicating if the application is an internal V4 application.
|
|
57
|
+
*/
|
|
58
|
+
private isV4AppInternalMode;
|
|
59
|
+
/**
|
|
60
|
+
* Flag indicating that full adaptation-over-adaptation is supported.
|
|
61
|
+
*/
|
|
62
|
+
private isSupported;
|
|
63
|
+
/**
|
|
64
|
+
* Flag indicating that only partial adaptation-over-adaptation is supported.
|
|
65
|
+
*/
|
|
66
|
+
private isPartiallySupported;
|
|
67
|
+
/**
|
|
68
|
+
* UI5 version manager for handling version-related validations.
|
|
69
|
+
*/
|
|
70
|
+
private readonly ui5Info;
|
|
71
|
+
/**
|
|
72
|
+
* Returns the configured abap provider instance.
|
|
73
|
+
*
|
|
74
|
+
* @returns Configured instance of AbapServiceProvider.
|
|
75
|
+
*/
|
|
76
|
+
get provider(): AbapServiceProvider;
|
|
77
|
+
/**
|
|
78
|
+
* Returns the loaded application manifest.
|
|
79
|
+
*
|
|
80
|
+
* @returns Application manifest.
|
|
81
|
+
*/
|
|
82
|
+
get manifest(): Manifest;
|
|
83
|
+
/**
|
|
84
|
+
* Indicates whether the application loads views synchronously.
|
|
85
|
+
*
|
|
86
|
+
* @returns {boolean} True if views are sync-loaded.
|
|
87
|
+
*/
|
|
88
|
+
get hasSyncViews(): boolean;
|
|
22
89
|
/**
|
|
23
90
|
* Creates an instance of ConfigPrompter.
|
|
24
91
|
*
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {TargetSystems} targetSystems - The target system class to retrieve system endpoints.
|
|
92
|
+
* @param {SystemLookup} systemLookup - The source system class to retrieve system endpoints.
|
|
27
93
|
* @param {FlexLayer} layer - The FlexLayer used to determine the base (customer or otherwise).
|
|
28
|
-
* @param {ToolsLogger} logger -
|
|
94
|
+
* @param {ToolsLogger} logger - Instance of the logger.
|
|
29
95
|
*/
|
|
30
|
-
constructor(
|
|
96
|
+
constructor(systemLookup: SystemLookup, layer: FlexLayer, logger: ToolsLogger);
|
|
31
97
|
/**
|
|
32
98
|
* Retrieves an array of configuration questions based on provided options.
|
|
33
99
|
* This is the only public method for retrieving prompts.
|
|
@@ -43,6 +109,12 @@ export declare class ConfigPrompter {
|
|
|
43
109
|
* @returns The system list prompt as a {@link ConfigQuestion}.
|
|
44
110
|
*/
|
|
45
111
|
private getSystemListPrompt;
|
|
112
|
+
/**
|
|
113
|
+
* Only used in the CLI context when prompt is of type `list` because the validation does not run on CLI for the system list prompt.
|
|
114
|
+
*
|
|
115
|
+
* @returns Dummy prompt that runs in the CLI only.
|
|
116
|
+
*/
|
|
117
|
+
private getSystemValidationPromptForCli;
|
|
46
118
|
/**
|
|
47
119
|
* Creates the username prompt configuration.
|
|
48
120
|
*
|
|
@@ -64,13 +136,21 @@ export declare class ConfigPrompter {
|
|
|
64
136
|
* @returns The application list prompt as a {@link ConfigQuestion}.
|
|
65
137
|
*/
|
|
66
138
|
private getApplicationListPrompt;
|
|
139
|
+
/**
|
|
140
|
+
* Only used in the CLI context when prompt is of type `list` because the validation does not run on CLI for the application list prompt.
|
|
141
|
+
*
|
|
142
|
+
* @returns Dummy prompt that runs in the CLI only.
|
|
143
|
+
*/
|
|
144
|
+
private getApplicationValidationPromptForCli;
|
|
67
145
|
/**
|
|
68
146
|
* Validates the selected application.
|
|
69
147
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
148
|
+
* Checks if the application is provided and then evaluates support based on its manifest.
|
|
149
|
+
*
|
|
150
|
+
* @param {SourceApplication} app - The selected application.
|
|
151
|
+
* @returns A promise that resolves to true if valid, or an error message string if validation fails.
|
|
72
152
|
*/
|
|
73
|
-
private
|
|
153
|
+
private validateAppPrompt;
|
|
74
154
|
/**
|
|
75
155
|
* Validates the password by setting up the provider and, if necessary,
|
|
76
156
|
* loading the available applications.
|
|
@@ -89,5 +169,59 @@ export declare class ConfigPrompter {
|
|
|
89
169
|
* @returns An error message if validation fails, or true if the system selection is valid.
|
|
90
170
|
*/
|
|
91
171
|
private validateSystem;
|
|
172
|
+
/**
|
|
173
|
+
* Validates the selected application to ensure it is supported.
|
|
174
|
+
*
|
|
175
|
+
* @param {Application} app - The application to validate.
|
|
176
|
+
* @returns {Promise<boolean | string>} True if the application is valid, otherwise an error message.
|
|
177
|
+
*/
|
|
178
|
+
private validateAppData;
|
|
179
|
+
/**
|
|
180
|
+
* Evaluate if the application version supports certain features.
|
|
181
|
+
*
|
|
182
|
+
* @param {Application} application - The application data.
|
|
183
|
+
*/
|
|
184
|
+
private evaluateAppSupport;
|
|
185
|
+
/**
|
|
186
|
+
* Fetches system data including cloud project and UI flexibility information.
|
|
187
|
+
*
|
|
188
|
+
* @returns A promise that resolves when system data is fetched.
|
|
189
|
+
*/
|
|
190
|
+
private getSystemData;
|
|
191
|
+
/**
|
|
192
|
+
* Handles the fetching and validation of system data.
|
|
193
|
+
*
|
|
194
|
+
* @returns {Promise<boolean | string>} True if successful, or an error message if an error occurs.
|
|
195
|
+
*/
|
|
196
|
+
private handleSystemDataValidation;
|
|
197
|
+
/**
|
|
198
|
+
* Validates the UI5 system version based on the provided value or fetches all relevant versions if no value is provided.
|
|
199
|
+
* Updates the internal state with the fetched versions and the detection status.
|
|
200
|
+
*
|
|
201
|
+
* @returns {Promise<void>} Resolves after checking system ui5 version.
|
|
202
|
+
*/
|
|
203
|
+
private validateSystemVersion;
|
|
204
|
+
/**
|
|
205
|
+
* Handles errors that occur while fetching system information, setting default values and rethrowing if necessary.
|
|
206
|
+
*
|
|
207
|
+
* @param {Error} error - The error encountered during the system info fetch.
|
|
208
|
+
*/
|
|
209
|
+
private handleSystemError;
|
|
210
|
+
/**
|
|
211
|
+
* Validates the selected application for adaptation projects, checking for specific support flags
|
|
212
|
+
* and validating the application manifest.
|
|
213
|
+
*
|
|
214
|
+
* @returns {void} Returns when validation is complete.
|
|
215
|
+
*/
|
|
216
|
+
private validateManifest;
|
|
217
|
+
/**
|
|
218
|
+
* Sets the support flags for given application.
|
|
219
|
+
*
|
|
220
|
+
* @param {SourceApplication} application - The application to validate.
|
|
221
|
+
* @param {boolean} isFullSupport - Flag to check for full AdpOverAdp support.
|
|
222
|
+
* @param {boolean} isPartialSupport - Flag to check for partial AdpOverAdp support.
|
|
223
|
+
* @returns {void} Returns when flags are set.
|
|
224
|
+
*/
|
|
225
|
+
private setSupportFlags;
|
|
92
226
|
}
|
|
93
227
|
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -1,43 +1,114 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConfigPrompter = void 0;
|
|
4
|
-
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
5
4
|
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
5
|
+
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
6
|
+
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
6
7
|
const i18n_1 = require("../../utils/i18n");
|
|
7
8
|
const types_1 = require("../types");
|
|
8
9
|
const choices_1 = require("./helper/choices");
|
|
9
10
|
const conditions_1 = require("./helper/conditions");
|
|
11
|
+
const additional_messages_1 = require("./helper/additional-messages");
|
|
10
12
|
/**
|
|
11
13
|
* A stateful prompter class that creates configuration questions.
|
|
12
14
|
* This class accepts the needed dependencies and keeps track of state (e.g. the ApplicationManager instance).
|
|
13
15
|
* It exposes a single public method {@link getPrompts} to retrieve the configuration questions.
|
|
14
16
|
*/
|
|
15
17
|
class ConfigPrompter {
|
|
16
|
-
|
|
17
|
-
targetSystems;
|
|
18
|
+
systemLookup;
|
|
18
19
|
logger;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* Indicates if the current layer is based on a customer base.
|
|
22
|
+
*/
|
|
23
|
+
isCustomerBase;
|
|
24
|
+
/**
|
|
25
|
+
* Instance of AbapServiceProvider.
|
|
26
|
+
*/
|
|
27
|
+
abapProvider;
|
|
28
|
+
/**
|
|
29
|
+
* Application manifest.
|
|
30
|
+
*/
|
|
31
|
+
appManifest;
|
|
32
|
+
/**
|
|
33
|
+
* Loaded target applications for a system.
|
|
21
34
|
*/
|
|
22
35
|
targetApps;
|
|
23
36
|
/**
|
|
24
|
-
*
|
|
37
|
+
* Flag indicating that system login is successful.
|
|
25
38
|
*/
|
|
26
|
-
|
|
39
|
+
isLoginSuccessful;
|
|
40
|
+
/**
|
|
41
|
+
* Flag indicating that system requires authentication in BAS or it does not exist in VS Code.
|
|
42
|
+
*/
|
|
43
|
+
isAuthRequired;
|
|
44
|
+
/**
|
|
45
|
+
* Cached UI flexibility information from the system.
|
|
46
|
+
*/
|
|
47
|
+
flexUISystem;
|
|
48
|
+
/**
|
|
49
|
+
* Flag indicating if the project is a cloud project.
|
|
50
|
+
*/
|
|
51
|
+
isCloudProject;
|
|
52
|
+
/**
|
|
53
|
+
* Flag indicating whether the selected application is supported.
|
|
54
|
+
*/
|
|
55
|
+
isApplicationSupported;
|
|
56
|
+
/**
|
|
57
|
+
* Indicates whether views are loaded synchronously.
|
|
58
|
+
*/
|
|
59
|
+
containsSyncViews = false;
|
|
60
|
+
/**
|
|
61
|
+
* Flag indicating if the application is an internal V4 application.
|
|
62
|
+
*/
|
|
63
|
+
isV4AppInternalMode = false;
|
|
64
|
+
/**
|
|
65
|
+
* Flag indicating that full adaptation-over-adaptation is supported.
|
|
66
|
+
*/
|
|
67
|
+
isSupported = false;
|
|
68
|
+
/**
|
|
69
|
+
* Flag indicating that only partial adaptation-over-adaptation is supported.
|
|
70
|
+
*/
|
|
71
|
+
isPartiallySupported = false;
|
|
72
|
+
/**
|
|
73
|
+
* UI5 version manager for handling version-related validations.
|
|
74
|
+
*/
|
|
75
|
+
ui5Info;
|
|
76
|
+
/**
|
|
77
|
+
* Returns the configured abap provider instance.
|
|
78
|
+
*
|
|
79
|
+
* @returns Configured instance of AbapServiceProvider.
|
|
80
|
+
*/
|
|
81
|
+
get provider() {
|
|
82
|
+
return this.abapProvider;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns the loaded application manifest.
|
|
86
|
+
*
|
|
87
|
+
* @returns Application manifest.
|
|
88
|
+
*/
|
|
89
|
+
get manifest() {
|
|
90
|
+
return this.manifest;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Indicates whether the application loads views synchronously.
|
|
94
|
+
*
|
|
95
|
+
* @returns {boolean} True if views are sync-loaded.
|
|
96
|
+
*/
|
|
97
|
+
get hasSyncViews() {
|
|
98
|
+
return this.containsSyncViews;
|
|
99
|
+
}
|
|
27
100
|
/**
|
|
28
101
|
* Creates an instance of ConfigPrompter.
|
|
29
102
|
*
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {TargetSystems} targetSystems - The target system class to retrieve system endpoints.
|
|
103
|
+
* @param {SystemLookup} systemLookup - The source system class to retrieve system endpoints.
|
|
32
104
|
* @param {FlexLayer} layer - The FlexLayer used to determine the base (customer or otherwise).
|
|
33
|
-
* @param {ToolsLogger} logger -
|
|
105
|
+
* @param {ToolsLogger} logger - Instance of the logger.
|
|
34
106
|
*/
|
|
35
|
-
constructor(
|
|
36
|
-
this.
|
|
37
|
-
this.targetSystems = targetSystems;
|
|
107
|
+
constructor(systemLookup, layer, logger) {
|
|
108
|
+
this.systemLookup = systemLookup;
|
|
38
109
|
this.logger = logger;
|
|
39
|
-
this.targetApps = new adp_tooling_1.TargetApplications(this.abapProvider, this.isCustomerBase, this.logger);
|
|
40
110
|
this.isCustomerBase = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
|
|
111
|
+
this.ui5Info = adp_tooling_1.UI5VersionInfo.getInstance(layer);
|
|
41
112
|
}
|
|
42
113
|
/**
|
|
43
114
|
* Retrieves an array of configuration questions based on provided options.
|
|
@@ -49,9 +120,11 @@ class ConfigPrompter {
|
|
|
49
120
|
getPrompts(promptOptions) {
|
|
50
121
|
const keyedPrompts = {
|
|
51
122
|
[types_1.configPromptNames.system]: this.getSystemListPrompt(promptOptions?.[types_1.configPromptNames.system]),
|
|
123
|
+
[types_1.configPromptNames.systemValidationCli]: this.getSystemValidationPromptForCli(),
|
|
52
124
|
[types_1.configPromptNames.username]: this.getUsernamePrompt(promptOptions?.[types_1.configPromptNames.username]),
|
|
53
125
|
[types_1.configPromptNames.password]: this.getPasswordPrompt(promptOptions?.[types_1.configPromptNames.password]),
|
|
54
|
-
[types_1.configPromptNames.application]: this.getApplicationListPrompt(promptOptions?.[types_1.configPromptNames.application])
|
|
126
|
+
[types_1.configPromptNames.application]: this.getApplicationListPrompt(promptOptions?.[types_1.configPromptNames.application]),
|
|
127
|
+
[types_1.configPromptNames.appValidationCli]: this.getApplicationValidationPromptForCli()
|
|
55
128
|
};
|
|
56
129
|
const questions = Object.entries(keyedPrompts)
|
|
57
130
|
.filter(([promptName, _]) => {
|
|
@@ -73,7 +146,7 @@ class ConfigPrompter {
|
|
|
73
146
|
name: types_1.configPromptNames.system,
|
|
74
147
|
message: (0, i18n_1.t)('prompts.systemLabel'),
|
|
75
148
|
choices: async () => {
|
|
76
|
-
const systems = await this.
|
|
149
|
+
const systems = await this.systemLookup.getSystems();
|
|
77
150
|
return (0, adp_tooling_1.getEndpointNames)(systems);
|
|
78
151
|
},
|
|
79
152
|
guiOptions: {
|
|
@@ -81,7 +154,29 @@ class ConfigPrompter {
|
|
|
81
154
|
breadcrumb: true,
|
|
82
155
|
hint: (0, i18n_1.t)('prompts.systemTooltip')
|
|
83
156
|
},
|
|
84
|
-
|
|
157
|
+
default: '',
|
|
158
|
+
validate: async (value, answers) => await this.validateSystem(value, answers),
|
|
159
|
+
additionalMessages: () => (0, additional_messages_1.getSystemAdditionalMessages)(this.flexUISystem, !!this.isCloudProject)
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Only used in the CLI context when prompt is of type `list` because the validation does not run on CLI for the system list prompt.
|
|
164
|
+
*
|
|
165
|
+
* @returns Dummy prompt that runs in the CLI only.
|
|
166
|
+
*/
|
|
167
|
+
getSystemValidationPromptForCli() {
|
|
168
|
+
return {
|
|
169
|
+
name: types_1.configPromptNames.systemValidationCli,
|
|
170
|
+
when: async (answers) => {
|
|
171
|
+
if (!answers.system) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
const result = await this.validateSystem(answers.system, answers);
|
|
175
|
+
if (typeof result === 'string') {
|
|
176
|
+
throw new Error(result);
|
|
177
|
+
}
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
85
180
|
};
|
|
86
181
|
}
|
|
87
182
|
/**
|
|
@@ -102,10 +197,7 @@ class ConfigPrompter {
|
|
|
102
197
|
},
|
|
103
198
|
filter: (val) => val.trim(),
|
|
104
199
|
validate: (val) => (0, project_input_validator_1.validateEmptyString)(val),
|
|
105
|
-
when:
|
|
106
|
-
const systemRequiresAuth = await this.targetSystems.getSystemRequiresAuth(answers.system);
|
|
107
|
-
return (0, conditions_1.showCredentialQuestion)(answers, systemRequiresAuth);
|
|
108
|
-
}
|
|
200
|
+
when: (answers) => (0, conditions_1.showCredentialQuestion)(answers, this.isAuthRequired)
|
|
109
201
|
};
|
|
110
202
|
}
|
|
111
203
|
/**
|
|
@@ -126,10 +218,7 @@ class ConfigPrompter {
|
|
|
126
218
|
hint: (0, i18n_1.t)('prompts.passwordTooltip')
|
|
127
219
|
},
|
|
128
220
|
validate: async (value, answers) => await this.validatePassword(value, answers),
|
|
129
|
-
when:
|
|
130
|
-
const systemRequiresAuth = await this.targetSystems.getSystemRequiresAuth(answers.system);
|
|
131
|
-
return (0, conditions_1.showCredentialQuestion)(answers, systemRequiresAuth);
|
|
132
|
-
}
|
|
221
|
+
when: (answers) => (0, conditions_1.showCredentialQuestion)(answers, this.isAuthRequired)
|
|
133
222
|
};
|
|
134
223
|
}
|
|
135
224
|
/**
|
|
@@ -149,29 +238,51 @@ class ConfigPrompter {
|
|
|
149
238
|
hint: (0, i18n_1.t)('prompts.applicationListTooltip'),
|
|
150
239
|
applyDefaultWhenDirty: true
|
|
151
240
|
},
|
|
152
|
-
choices:
|
|
153
|
-
const apps = await this.targetApps.getApps();
|
|
154
|
-
return (0, choices_1.getApplicationChoices)(apps);
|
|
155
|
-
},
|
|
241
|
+
choices: () => (0, choices_1.getApplicationChoices)(this.targetApps),
|
|
156
242
|
default: options?.default,
|
|
157
|
-
validate: (value) => this.
|
|
243
|
+
validate: async (value) => await this.validateAppPrompt(value),
|
|
244
|
+
when: (answers) => (0, conditions_1.showApplicationQuestion)(answers, !!this.targetApps?.length, this.isAuthRequired, this.isLoginSuccessful),
|
|
245
|
+
additionalMessages: (app) => (0, additional_messages_1.getAppAdditionalMessages)(app, {
|
|
246
|
+
hasSyncViews: this.containsSyncViews,
|
|
247
|
+
isV4AppInternalMode: this.isV4AppInternalMode,
|
|
248
|
+
isSupported: this.isSupported && !this.isPartiallySupported,
|
|
249
|
+
isPartiallySupported: this.isPartiallySupported
|
|
250
|
+
}, this.isApplicationSupported)
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Only used in the CLI context when prompt is of type `list` because the validation does not run on CLI for the application list prompt.
|
|
255
|
+
*
|
|
256
|
+
* @returns Dummy prompt that runs in the CLI only.
|
|
257
|
+
*/
|
|
258
|
+
getApplicationValidationPromptForCli() {
|
|
259
|
+
return {
|
|
260
|
+
name: types_1.configPromptNames.appValidationCli,
|
|
158
261
|
when: async (answers) => {
|
|
159
|
-
|
|
160
|
-
|
|
262
|
+
if (!answers.application) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
const result = await this.validateAppPrompt(answers.application);
|
|
266
|
+
if (typeof result === 'string') {
|
|
267
|
+
throw new Error(result);
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
161
270
|
}
|
|
162
271
|
};
|
|
163
272
|
}
|
|
164
273
|
/**
|
|
165
274
|
* Validates the selected application.
|
|
166
275
|
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
276
|
+
* Checks if the application is provided and then evaluates support based on its manifest.
|
|
277
|
+
*
|
|
278
|
+
* @param {SourceApplication} app - The selected application.
|
|
279
|
+
* @returns A promise that resolves to true if valid, or an error message string if validation fails.
|
|
169
280
|
*/
|
|
170
|
-
|
|
281
|
+
async validateAppPrompt(app) {
|
|
171
282
|
if (!app) {
|
|
172
283
|
return (0, i18n_1.t)('error.selectCannotBeEmptyError', { value: 'Application' });
|
|
173
284
|
}
|
|
174
|
-
return
|
|
285
|
+
return this.validateAppData(app);
|
|
175
286
|
}
|
|
176
287
|
/**
|
|
177
288
|
* Validates the password by setting up the provider and, if necessary,
|
|
@@ -186,12 +297,21 @@ class ConfigPrompter {
|
|
|
186
297
|
if (typeof validationResult === 'string') {
|
|
187
298
|
return validationResult;
|
|
188
299
|
}
|
|
300
|
+
const options = {
|
|
301
|
+
system: answers.system,
|
|
302
|
+
client: undefined,
|
|
303
|
+
username: answers.username,
|
|
304
|
+
password
|
|
305
|
+
};
|
|
189
306
|
try {
|
|
190
|
-
|
|
191
|
-
await this.
|
|
307
|
+
this.abapProvider = await (0, adp_tooling_1.getConfiguredProvider)(options, this.logger);
|
|
308
|
+
await this.getSystemData();
|
|
309
|
+
this.targetApps = await (0, adp_tooling_1.loadApps)(this.abapProvider, this.isCustomerBase);
|
|
310
|
+
this.isLoginSuccessful = true;
|
|
192
311
|
return true;
|
|
193
312
|
}
|
|
194
313
|
catch (e) {
|
|
314
|
+
this.isLoginSuccessful = false;
|
|
195
315
|
return e.message;
|
|
196
316
|
}
|
|
197
317
|
}
|
|
@@ -208,12 +328,22 @@ class ConfigPrompter {
|
|
|
208
328
|
if (typeof validationResult === 'string') {
|
|
209
329
|
return validationResult;
|
|
210
330
|
}
|
|
331
|
+
const options = {
|
|
332
|
+
system,
|
|
333
|
+
client: undefined,
|
|
334
|
+
username: answers.username,
|
|
335
|
+
password: answers.password
|
|
336
|
+
};
|
|
211
337
|
try {
|
|
212
|
-
this.targetApps
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (!
|
|
216
|
-
await this.
|
|
338
|
+
this.targetApps = [];
|
|
339
|
+
this.abapProvider = await (0, adp_tooling_1.getConfiguredProvider)(options, this.logger);
|
|
340
|
+
this.isAuthRequired = await this.systemLookup.getSystemRequiresAuth(system);
|
|
341
|
+
if (!this.isAuthRequired) {
|
|
342
|
+
const validationResult = await this.handleSystemDataValidation();
|
|
343
|
+
if (typeof validationResult === 'string') {
|
|
344
|
+
return validationResult;
|
|
345
|
+
}
|
|
346
|
+
this.targetApps = await (0, adp_tooling_1.loadApps)(this.abapProvider, this.isCustomerBase);
|
|
217
347
|
}
|
|
218
348
|
return true;
|
|
219
349
|
}
|
|
@@ -221,6 +351,137 @@ class ConfigPrompter {
|
|
|
221
351
|
return e.message;
|
|
222
352
|
}
|
|
223
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Validates the selected application to ensure it is supported.
|
|
356
|
+
*
|
|
357
|
+
* @param {Application} app - The application to validate.
|
|
358
|
+
* @returns {Promise<boolean | string>} True if the application is valid, otherwise an error message.
|
|
359
|
+
*/
|
|
360
|
+
async validateAppData(app) {
|
|
361
|
+
try {
|
|
362
|
+
const sourceManifest = new adp_tooling_1.SourceManifest(this.abapProvider, app.id, this.logger);
|
|
363
|
+
const isSupported = await (0, adp_tooling_1.isAppSupported)(this.abapProvider, app.id, this.logger);
|
|
364
|
+
if (isSupported) {
|
|
365
|
+
this.appManifest = await sourceManifest.getManifest();
|
|
366
|
+
this.validateManifest();
|
|
367
|
+
this.evaluateAppSupport(app);
|
|
368
|
+
}
|
|
369
|
+
this.isApplicationSupported = true;
|
|
370
|
+
}
|
|
371
|
+
catch (e) {
|
|
372
|
+
this.isApplicationSupported = false;
|
|
373
|
+
this.logger.debug(`Application failed validation. Reason: ${e.message}`);
|
|
374
|
+
return e.message;
|
|
375
|
+
}
|
|
376
|
+
return true;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Evaluate if the application version supports certain features.
|
|
380
|
+
*
|
|
381
|
+
* @param {Application} application - The application data.
|
|
382
|
+
*/
|
|
383
|
+
evaluateAppSupport(application) {
|
|
384
|
+
const systemVersion = this.ui5Info.systemVersion;
|
|
385
|
+
const isFullSupport = this.ui5Info.isVersionDetected && !(0, adp_tooling_1.isFeatureSupportedVersion)('1.96.0', systemVersion);
|
|
386
|
+
const isPartialSupport = this.ui5Info.isVersionDetected && isFullSupport && (0, adp_tooling_1.isFeatureSupportedVersion)('1.90.0', systemVersion);
|
|
387
|
+
this.setSupportFlags(application, isFullSupport, isPartialSupport);
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Fetches system data including cloud project and UI flexibility information.
|
|
391
|
+
*
|
|
392
|
+
* @returns A promise that resolves when system data is fetched.
|
|
393
|
+
*/
|
|
394
|
+
async getSystemData() {
|
|
395
|
+
try {
|
|
396
|
+
this.isCloudProject = await this.abapProvider.isAbapCloud();
|
|
397
|
+
this.flexUISystem = await (0, adp_tooling_1.getFlexUISupportedSystem)(this.abapProvider, this.isCustomerBase);
|
|
398
|
+
}
|
|
399
|
+
catch (e) {
|
|
400
|
+
this.handleSystemError(e);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Handles the fetching and validation of system data.
|
|
405
|
+
*
|
|
406
|
+
* @returns {Promise<boolean | string>} True if successful, or an error message if an error occurs.
|
|
407
|
+
*/
|
|
408
|
+
async handleSystemDataValidation() {
|
|
409
|
+
try {
|
|
410
|
+
await this.getSystemData();
|
|
411
|
+
await this.validateSystemVersion();
|
|
412
|
+
if (!this.isCustomerBase && this.isCloudProject) {
|
|
413
|
+
return (0, i18n_1.t)('error.cloudSystemsForInternalUsers');
|
|
414
|
+
}
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
catch (e) {
|
|
418
|
+
this.logger.debug(`Validating system failed. Reason: ${e.message}`);
|
|
419
|
+
return e.message;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Validates the UI5 system version based on the provided value or fetches all relevant versions if no value is provided.
|
|
424
|
+
* Updates the internal state with the fetched versions and the detection status.
|
|
425
|
+
*
|
|
426
|
+
* @returns {Promise<void>} Resolves after checking system ui5 version.
|
|
427
|
+
*/
|
|
428
|
+
async validateSystemVersion() {
|
|
429
|
+
try {
|
|
430
|
+
const version = await (0, adp_tooling_1.getSystemUI5Version)(this.abapProvider);
|
|
431
|
+
await this.ui5Info.getRelevantVersions(version);
|
|
432
|
+
}
|
|
433
|
+
catch (e) {
|
|
434
|
+
this.logger.debug(`Could not fetch system version: ${e.message}`);
|
|
435
|
+
await this.ui5Info.getRelevantVersions();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Handles errors that occur while fetching system information, setting default values and rethrowing if necessary.
|
|
440
|
+
*
|
|
441
|
+
* @param {Error} error - The error encountered during the system info fetch.
|
|
442
|
+
*/
|
|
443
|
+
handleSystemError(error) {
|
|
444
|
+
this.logger.debug(`Failed to fetch system information. Reason: ${error.message}`);
|
|
445
|
+
if ((0, axios_extension_1.isAxiosError)(error)) {
|
|
446
|
+
if (error.response?.status === 401 || error.response?.status === 403) {
|
|
447
|
+
throw new Error(`Authentication error: ${error.message}`);
|
|
448
|
+
}
|
|
449
|
+
if (error.response?.status === 405 || error.response?.status === 404) {
|
|
450
|
+
// Handle the case where the API is not available and continue to standard onPremise flow
|
|
451
|
+
this.isCloudProject = false;
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Validates the selected application for adaptation projects, checking for specific support flags
|
|
458
|
+
* and validating the application manifest.
|
|
459
|
+
*
|
|
460
|
+
* @returns {void} Returns when validation is complete.
|
|
461
|
+
*/
|
|
462
|
+
validateManifest() {
|
|
463
|
+
if (!this.appManifest) {
|
|
464
|
+
throw new Error((0, i18n_1.t)('error.manifestCouldNotBeValidated'));
|
|
465
|
+
}
|
|
466
|
+
const ui5 = this.appManifest?.['sap.ui5'];
|
|
467
|
+
if (ui5?.flexEnabled === false) {
|
|
468
|
+
throw new Error((0, i18n_1.t)('error.appDoesNotSupportAdaptation'));
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Sets the support flags for given application.
|
|
473
|
+
*
|
|
474
|
+
* @param {SourceApplication} application - The application to validate.
|
|
475
|
+
* @param {boolean} isFullSupport - Flag to check for full AdpOverAdp support.
|
|
476
|
+
* @param {boolean} isPartialSupport - Flag to check for partial AdpOverAdp support.
|
|
477
|
+
* @returns {void} Returns when flags are set.
|
|
478
|
+
*/
|
|
479
|
+
setSupportFlags(application, isFullSupport, isPartialSupport) {
|
|
480
|
+
this.isSupported = !(isFullSupport && application.fileType === 'appdescr_variant');
|
|
481
|
+
this.isPartiallySupported = isPartialSupport && application.fileType === 'appdescr_variant';
|
|
482
|
+
this.isV4AppInternalMode = (0, adp_tooling_1.isV4Application)(this.appManifest) && !this.isCustomerBase;
|
|
483
|
+
this.containsSyncViews = (0, adp_tooling_1.isSyncLoadedView)(this.appManifest?.['sap.ui5']);
|
|
484
|
+
}
|
|
224
485
|
}
|
|
225
486
|
exports.ConfigPrompter = ConfigPrompter;
|
|
226
487
|
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Severity } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
import type { FlexUISupportedSystem, SourceApplication } from '@sap-ux/adp-tooling';
|
|
3
|
+
interface SupportFlags {
|
|
4
|
+
hasSyncViews: boolean;
|
|
5
|
+
isV4AppInternalMode: boolean;
|
|
6
|
+
isSupported: boolean;
|
|
7
|
+
isPartiallySupported: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Evaluates a system's deployment and flexibility capabilities to generate relevant messages based on the system's characteristics.
|
|
11
|
+
*
|
|
12
|
+
* @param {FlexUISupportedSystem | undefined} flexUISystem - An optional object containing flags indicating if the system
|
|
13
|
+
* is on-premise and whether UI Flex is enabled.
|
|
14
|
+
* @param isCloudProject
|
|
15
|
+
* @returns {{message: string, severity: Severity} | undefined} An object containing a message and its severity level.
|
|
16
|
+
*/
|
|
17
|
+
export declare const getSystemAdditionalMessages: (flexUISystem: FlexUISupportedSystem | undefined, isCloudProject: boolean) => {
|
|
18
|
+
message: string;
|
|
19
|
+
severity: Severity;
|
|
20
|
+
} | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Provides an additional contextual message for the selected application, based on its compatibility,
|
|
23
|
+
* feature support, or sync-loading behavior.
|
|
24
|
+
*
|
|
25
|
+
* @param {SourceApplication} app - The selected application object.
|
|
26
|
+
* @param {SupportFlags} flags - Flags indicating support for sync views, Adp-over-Adp, and V4 internal apps.
|
|
27
|
+
* @param {boolean} isApplicationSupported - Indicates whether the application is supported at all.
|
|
28
|
+
* @returns {{ message: string; severity: Severity } | undefined} Message object or undefined if no message is applicable.
|
|
29
|
+
*/
|
|
30
|
+
export declare const getAppAdditionalMessages: (app: SourceApplication, { hasSyncViews, isSupported, isPartiallySupported, isV4AppInternalMode }: SupportFlags, isApplicationSupported: boolean) => {
|
|
31
|
+
message: string;
|
|
32
|
+
severity: Severity;
|
|
33
|
+
} | undefined;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=additional-messages.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAppAdditionalMessages = exports.getSystemAdditionalMessages = void 0;
|
|
4
|
+
const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
|
|
5
|
+
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
6
|
+
const i18n_1 = require("../../../utils/i18n");
|
|
7
|
+
/**
|
|
8
|
+
* Evaluates a system's deployment and flexibility capabilities to generate relevant messages based on the system's characteristics.
|
|
9
|
+
*
|
|
10
|
+
* @param {FlexUISupportedSystem | undefined} flexUISystem - An optional object containing flags indicating if the system
|
|
11
|
+
* is on-premise and whether UI Flex is enabled.
|
|
12
|
+
* @param isCloudProject
|
|
13
|
+
* @returns {{message: string, severity: Severity} | undefined} An object containing a message and its severity level.
|
|
14
|
+
*/
|
|
15
|
+
const getSystemAdditionalMessages = (flexUISystem, isCloudProject) => {
|
|
16
|
+
const isOnPremise = flexUISystem?.isOnPremise;
|
|
17
|
+
const isUIFlex = flexUISystem?.isUIFlex;
|
|
18
|
+
if (isCloudProject) {
|
|
19
|
+
return {
|
|
20
|
+
message: `${(0, i18n_1.t)('prompts.projectTypeLabel')}: ${axios_extension_1.AdaptationProjectType.CLOUD_READY}`,
|
|
21
|
+
severity: yeoman_ui_types_1.Severity.information
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if (!isOnPremise) {
|
|
25
|
+
if (!isUIFlex) {
|
|
26
|
+
return {
|
|
27
|
+
message: (0, i18n_1.t)('error.notDeployableNotFlexEnabledSystemError'),
|
|
28
|
+
severity: yeoman_ui_types_1.Severity.error
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return {
|
|
33
|
+
message: (0, i18n_1.t)('error.notDeployableSystemError'),
|
|
34
|
+
severity: yeoman_ui_types_1.Severity.error
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (isOnPremise && !isUIFlex) {
|
|
39
|
+
return {
|
|
40
|
+
message: (0, i18n_1.t)('error.notFlexEnabledError'),
|
|
41
|
+
severity: yeoman_ui_types_1.Severity.warning
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
message: `${(0, i18n_1.t)('prompts.projectTypeLabel')}: ${axios_extension_1.AdaptationProjectType.ON_PREMISE}`,
|
|
46
|
+
severity: yeoman_ui_types_1.Severity.information
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
exports.getSystemAdditionalMessages = getSystemAdditionalMessages;
|
|
50
|
+
/**
|
|
51
|
+
* Provides an additional contextual message for the selected application, based on its compatibility,
|
|
52
|
+
* feature support, or sync-loading behavior.
|
|
53
|
+
*
|
|
54
|
+
* @param {SourceApplication} app - The selected application object.
|
|
55
|
+
* @param {SupportFlags} flags - Flags indicating support for sync views, Adp-over-Adp, and V4 internal apps.
|
|
56
|
+
* @param {boolean} isApplicationSupported - Indicates whether the application is supported at all.
|
|
57
|
+
* @returns {{ message: string; severity: Severity } | undefined} Message object or undefined if no message is applicable.
|
|
58
|
+
*/
|
|
59
|
+
const getAppAdditionalMessages = (app, { hasSyncViews, isSupported, isPartiallySupported, isV4AppInternalMode }, isApplicationSupported) => {
|
|
60
|
+
if (!app) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
if (hasSyncViews && isApplicationSupported) {
|
|
64
|
+
return {
|
|
65
|
+
message: (0, i18n_1.t)('prompts.appInfoLabel'),
|
|
66
|
+
severity: yeoman_ui_types_1.Severity.information
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (!isSupported && !isPartiallySupported && isApplicationSupported) {
|
|
70
|
+
return {
|
|
71
|
+
message: (0, i18n_1.t)('prompts.notSupportedAdpOverAdpLabel'),
|
|
72
|
+
severity: yeoman_ui_types_1.Severity.warning
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (isPartiallySupported && isApplicationSupported) {
|
|
76
|
+
return {
|
|
77
|
+
message: (0, i18n_1.t)('prompts.isPartiallySupportedAdpOverAdpLabel'),
|
|
78
|
+
severity: yeoman_ui_types_1.Severity.warning
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (isV4AppInternalMode) {
|
|
82
|
+
return {
|
|
83
|
+
message: (0, i18n_1.t)('prompts.v4AppNotOfficialLabel'),
|
|
84
|
+
severity: yeoman_ui_types_1.Severity.warning
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
exports.getAppAdditionalMessages = getAppAdditionalMessages;
|
|
89
|
+
//# sourceMappingURL=additional-messages.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SourceApplication } from '@sap-ux/adp-tooling';
|
|
2
2
|
interface Choice {
|
|
3
3
|
name: string;
|
|
4
|
-
value:
|
|
4
|
+
value: SourceApplication;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Creates a list of choices from a list of applications, formatted for display or selection in a UI.
|
|
8
8
|
* Each choice consists of an application's title (or ID if no title), followed by its registration IDs and ACH, formatted for easy reading.
|
|
9
9
|
*
|
|
10
|
-
* @param {
|
|
10
|
+
* @param {SourceApplication[]} apps - An array of applications to be transformed into display choices.
|
|
11
11
|
* @returns {Choice[]} An array of objects each containing a value (the full application object) and a name (a formatted string).
|
|
12
12
|
*/
|
|
13
|
-
export declare const getApplicationChoices: (apps:
|
|
13
|
+
export declare const getApplicationChoices: (apps: SourceApplication[]) => Choice[];
|
|
14
14
|
export {};
|
|
15
15
|
//# sourceMappingURL=choices.d.ts.map
|
|
@@ -5,7 +5,7 @@ exports.getApplicationChoices = void 0;
|
|
|
5
5
|
* Creates a list of choices from a list of applications, formatted for display or selection in a UI.
|
|
6
6
|
* Each choice consists of an application's title (or ID if no title), followed by its registration IDs and ACH, formatted for easy reading.
|
|
7
7
|
*
|
|
8
|
-
* @param {
|
|
8
|
+
* @param {SourceApplication[]} apps - An array of applications to be transformed into display choices.
|
|
9
9
|
* @returns {Choice[]} An array of objects each containing a value (the full application object) and a name (a formatted string).
|
|
10
10
|
*/
|
|
11
11
|
const getApplicationChoices = (apps) => {
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import type { ConfigAnswers } from '@sap-ux/adp-tooling';
|
|
2
2
|
/**
|
|
3
|
-
* Determines if
|
|
4
|
-
*
|
|
3
|
+
* Determines if a credential question should be shown.
|
|
4
|
+
* In this simplified approach, we show credentials if a system is provided and the login was not successful.
|
|
5
5
|
*
|
|
6
6
|
* @param {ConfigAnswers} answers - User provided configuration details.
|
|
7
|
-
* @param {boolean}
|
|
8
|
-
* @returns {boolean
|
|
7
|
+
* @param {boolean} isAuthRequired - A flag indicating whether system authentication is needed.
|
|
8
|
+
* @returns {boolean} True if credentials should be requested.
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function showCredentialQuestion(answers: ConfigAnswers, isAuthRequired: boolean): boolean;
|
|
11
11
|
/**
|
|
12
|
-
* Determines if an application question
|
|
12
|
+
* Determines if an application question should be shown.
|
|
13
13
|
*
|
|
14
14
|
* @param {ConfigAnswers} answers - The user-provided answers containing application details.
|
|
15
|
-
* @param {boolean}
|
|
16
|
-
* @
|
|
15
|
+
* @param {boolean} appsLoaded - A flag indicating whether there are loaded apps.
|
|
16
|
+
* @param {boolean} isAuthRequired - A flag indicating whether system authentication is needed.
|
|
17
|
+
* @param {boolean} isLoginSuccessful - A flag indicating that system login was successful.
|
|
18
|
+
* @returns {boolean} True if the application question should be shown.
|
|
17
19
|
*/
|
|
18
|
-
export declare function showApplicationQuestion
|
|
19
|
-
/**
|
|
20
|
-
* Determines if a credential question will be shown based on the answers and specific conditions.
|
|
21
|
-
*
|
|
22
|
-
* @param {ConfigAnswers} answers - The user-provided answers containing application details.
|
|
23
|
-
* @param {boolean} systemRequiresAuth - A flag indicating if system requires authentication.
|
|
24
|
-
* @returns {boolean | undefined} True if a credential question will be shown, otherwise false or undefined.
|
|
25
|
-
*/
|
|
26
|
-
export declare function showCredentialQuestion(answers: ConfigAnswers, systemRequiresAuth: boolean): boolean;
|
|
20
|
+
export declare function showApplicationQuestion(answers: ConfigAnswers, appsLoaded: boolean, isAuthRequired: boolean, isLoginSuccessful: boolean): boolean;
|
|
27
21
|
//# sourceMappingURL=conditions.d.ts.map
|
|
@@ -1,43 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.showApplicationQuestion = exports.showCredentialQuestion = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* Determines if
|
|
6
|
-
*
|
|
5
|
+
* Determines if a credential question should be shown.
|
|
6
|
+
* In this simplified approach, we show credentials if a system is provided and the login was not successful.
|
|
7
7
|
*
|
|
8
8
|
* @param {ConfigAnswers} answers - User provided configuration details.
|
|
9
|
-
* @param {boolean}
|
|
10
|
-
* @returns {boolean
|
|
9
|
+
* @param {boolean} isAuthRequired - A flag indicating whether system authentication is needed.
|
|
10
|
+
* @returns {boolean} True if credentials should be requested.
|
|
11
11
|
*/
|
|
12
|
-
function
|
|
13
|
-
return !!answers.system &&
|
|
12
|
+
function showCredentialQuestion(answers, isAuthRequired) {
|
|
13
|
+
return !!answers.system && isAuthRequired;
|
|
14
14
|
}
|
|
15
|
-
exports.
|
|
15
|
+
exports.showCredentialQuestion = showCredentialQuestion;
|
|
16
16
|
/**
|
|
17
|
-
* Determines if an application question
|
|
17
|
+
* Determines if an application question should be shown.
|
|
18
18
|
*
|
|
19
19
|
* @param {ConfigAnswers} answers - The user-provided answers containing application details.
|
|
20
|
-
* @param {boolean}
|
|
21
|
-
* @
|
|
20
|
+
* @param {boolean} appsLoaded - A flag indicating whether there are loaded apps.
|
|
21
|
+
* @param {boolean} isAuthRequired - A flag indicating whether system authentication is needed.
|
|
22
|
+
* @param {boolean} isLoginSuccessful - A flag indicating that system login was successful.
|
|
23
|
+
* @returns {boolean} True if the application question should be shown.
|
|
22
24
|
*/
|
|
23
|
-
function showApplicationQuestion(answers,
|
|
24
|
-
return !!answers.system &&
|
|
25
|
+
function showApplicationQuestion(answers, appsLoaded, isAuthRequired, isLoginSuccessful) {
|
|
26
|
+
return !!answers.system && appsLoaded && (isAuthRequired ? isLoginSuccessful : true);
|
|
25
27
|
}
|
|
26
28
|
exports.showApplicationQuestion = showApplicationQuestion;
|
|
27
|
-
/**
|
|
28
|
-
* Determines if a credential question will be shown based on the answers and specific conditions.
|
|
29
|
-
*
|
|
30
|
-
* @param {ConfigAnswers} answers - The user-provided answers containing application details.
|
|
31
|
-
* @param {boolean} systemRequiresAuth - A flag indicating if system requires authentication.
|
|
32
|
-
* @returns {boolean | undefined} True if a credential question will be shown, otherwise false or undefined.
|
|
33
|
-
*/
|
|
34
|
-
function showCredentialQuestion(answers, systemRequiresAuth) {
|
|
35
|
-
if (answers.system) {
|
|
36
|
-
return systemRequiresAuth;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.showCredentialQuestion = showCredentialQuestion;
|
|
43
29
|
//# sourceMappingURL=conditions.js.map
|
|
@@ -30,9 +30,11 @@ export interface AdpGeneratorOptions extends Generator.GeneratorOptions {
|
|
|
30
30
|
*/
|
|
31
31
|
export declare enum configPromptNames {
|
|
32
32
|
system = "system",
|
|
33
|
+
systemValidationCli = "systemValidationCli",
|
|
33
34
|
username = "username",
|
|
34
35
|
password = "password",
|
|
35
|
-
application = "application"
|
|
36
|
+
application = "application",
|
|
37
|
+
appValidationCli = "appValidationCli"
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
38
40
|
* The question type specific to configuration prompts.
|
|
@@ -45,6 +47,9 @@ export interface SystemPromptOptions {
|
|
|
45
47
|
default?: string;
|
|
46
48
|
hide?: boolean;
|
|
47
49
|
}
|
|
50
|
+
export interface CliValidationPromptOptions {
|
|
51
|
+
hide?: boolean;
|
|
52
|
+
}
|
|
48
53
|
export interface UsernamePromptOptions {
|
|
49
54
|
hide?: boolean;
|
|
50
55
|
}
|
|
@@ -60,8 +65,10 @@ export interface ApplicationPromptOptions {
|
|
|
60
65
|
*/
|
|
61
66
|
export type ConfigPromptOptions = Partial<{
|
|
62
67
|
[configPromptNames.system]: SystemPromptOptions;
|
|
68
|
+
[configPromptNames.systemValidationCli]: CliValidationPromptOptions;
|
|
63
69
|
[configPromptNames.username]: UsernamePromptOptions;
|
|
64
70
|
[configPromptNames.password]: PasswordPromptOptions;
|
|
65
71
|
[configPromptNames.application]: ApplicationPromptOptions;
|
|
72
|
+
[configPromptNames.appValidationCli]: CliValidationPromptOptions;
|
|
66
73
|
}>;
|
|
67
74
|
//# sourceMappingURL=types.d.ts.map
|
package/generators/app/types.js
CHANGED
|
@@ -7,8 +7,10 @@ exports.configPromptNames = void 0;
|
|
|
7
7
|
var configPromptNames;
|
|
8
8
|
(function (configPromptNames) {
|
|
9
9
|
configPromptNames["system"] = "system";
|
|
10
|
+
configPromptNames["systemValidationCli"] = "systemValidationCli";
|
|
10
11
|
configPromptNames["username"] = "username";
|
|
11
12
|
configPromptNames["password"] = "password";
|
|
12
13
|
configPromptNames["application"] = "application";
|
|
14
|
+
configPromptNames["appValidationCli"] = "appValidationCli";
|
|
13
15
|
})(configPromptNames || (exports.configPromptNames = configPromptNames = {}));
|
|
14
16
|
//# sourceMappingURL=types.js.map
|
|
@@ -11,12 +11,23 @@
|
|
|
11
11
|
"passwordLabel": "Password",
|
|
12
12
|
"passwordTooltip": "Enter the password for the back-end system.",
|
|
13
13
|
"applicationListLabel": "Application",
|
|
14
|
-
"applicationListTooltip": "Select the application for which you want to create an app variant."
|
|
14
|
+
"applicationListTooltip": "Select the application for which you want to create an app variant.",
|
|
15
|
+
"projectTypeLabel": "Project Type",
|
|
16
|
+
"appInfoLabel": "Synchronous views are detected for this application. Therefore, the controller extensions are not supported. Controller extension functionality on these views will be disabled.",
|
|
17
|
+
"notSupportedAdpOverAdpLabel": "You have selected 'Adaptation Project' as the base. The selected system has a SAPUI5 version lower than 1.90. Therefore, it does not support 'Adaptation Project' as а base for a new adaptation project. You will be able to create such а project, but after deployment it will not work until the SAPUI5 version of the system is updated.",
|
|
18
|
+
"isPartiallySupportedAdpOverAdpLabel": "You have selected 'Adaptation Project' as the base. The selected system has a SAPUI5 version lower than 1.96 and in order for your adaptation project based on adaptation project to work after deployment, you will need to apply SAP Note 756 SP0 on your system.",
|
|
19
|
+
"v4AppNotOfficialLabel": "You have selected an app based on SAP Fiori elements for OData V4. Note the following important information when you create adaptation changes: https://wiki.wdf.sap.corp/wiki/display/fioritech/Adaptation+Project+Support"
|
|
15
20
|
},
|
|
16
21
|
"error": {
|
|
17
22
|
"selectCannotBeEmptyError": "{{value}} has to be selected.",
|
|
18
23
|
"writingPhase": "An error occurred in the writing phase of the adaptation project generation. To see the error, view the logs.",
|
|
19
24
|
"telemetry": "An error occurred when sending telemetry data: {{- error}}. To see the error, view the logs.",
|
|
20
|
-
"updatingApp": "An error occurred when creating a new adaptation project. To see the error, view the logs."
|
|
25
|
+
"updatingApp": "An error occurred when creating a new adaptation project. To see the error, view the logs.",
|
|
26
|
+
"cloudSystemsForInternalUsers": "You have selected a system that does not support On-Premise adaptation projects. Please select a supported system.",
|
|
27
|
+
"notDeployableNotFlexEnabledSystemError": "The system that you have selected is not an ABAP On-Premise system. Adaptation projects are only supported on those systems. Please choose an ABAP On-Premise system which supports flexibility and DTA_FOLDER deployment.",
|
|
28
|
+
"notDeployableSystemError": "The system that you have selected is not an ABAP On-Premise system which supports DTA_FOLDER deployment. Adaptation projects are only supported on those systems. Please choose an ABAP On-Premise system which supports DTA_FOLDER deployment.",
|
|
29
|
+
"notFlexEnabledError": "The system that you have selected is not an ABAP On-Premise system which supports flexibility. Adaptation projects are only supported on those systems. Please choose an ABAP On-Premise system which supports flexibility. If you continue, you will only be able to create an extension project.",
|
|
30
|
+
"manifestCouldNotBeValidated": "The manifest.json file of the selected application could not be validated. Please select a different application.",
|
|
31
|
+
"appDoesNotSupportAdaptation": "The application that you have selected does not support flexibility. Adaptation projects are only supported with those applications. Please choose an application which supports flexibility."
|
|
21
32
|
}
|
|
22
33
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import type { Package } from '@sap-ux/project-access';
|
|
2
|
+
/**
|
|
3
|
+
* Reads the package.json of the current package.
|
|
4
|
+
*
|
|
5
|
+
* @returns {Package} Package.json of the current package.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPackageInfo(): Package;
|
|
1
8
|
/**
|
|
2
9
|
* Installs dependencies in the project directory.
|
|
3
10
|
*
|
package/generators/utils/deps.js
CHANGED
|
@@ -23,9 +23,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.installDependencies = void 0;
|
|
26
|
+
exports.installDependencies = exports.getPackageInfo = void 0;
|
|
27
|
+
const path_1 = require("path");
|
|
27
28
|
const util = __importStar(require("util"));
|
|
29
|
+
const fs_1 = require("fs");
|
|
28
30
|
const child_process_1 = require("child_process");
|
|
31
|
+
/**
|
|
32
|
+
* Reads the package.json of the current package.
|
|
33
|
+
*
|
|
34
|
+
* @returns {Package} Package.json of the current package.
|
|
35
|
+
*/
|
|
36
|
+
function getPackageInfo() {
|
|
37
|
+
return JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../../package.json'), 'utf-8'));
|
|
38
|
+
}
|
|
39
|
+
exports.getPackageInfo = getPackageInfo;
|
|
29
40
|
/**
|
|
30
41
|
* Installs dependencies in the project directory.
|
|
31
42
|
*
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sap-ux/generator-adp",
|
|
3
3
|
"displayName": "SAPUI5 Adaptation Project",
|
|
4
4
|
"description": "Adaptation project allows you to create an app variant for an existing SAP Fiori elements-based or SAPUI5 freestyle application, without changing the original application.",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.3",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"i18next": "23.5.1",
|
|
30
30
|
"yeoman-generator": "5.10.0",
|
|
31
31
|
"uuid": "10.0.0",
|
|
32
|
-
"@sap-ux/adp-tooling": "0.13.
|
|
32
|
+
"@sap-ux/adp-tooling": "0.13.24",
|
|
33
33
|
"@sap-ux/axios-extension": "1.19.2",
|
|
34
34
|
"@sap-ux/btp-utils": "1.0.2",
|
|
35
35
|
"@sap-ux/feature-toggle": "0.2.3",
|