@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,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const tooltip_1 = require("./helper/tooltip");
|
|
11
|
-
const additional_messages_1 = require("./helper/additional-messages");
|
|
12
|
-
const steps_1 = require("../../utils/steps");
|
|
13
|
-
const default_values_1 = require("./helper/default-values");
|
|
14
|
-
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
1
|
+
import { FlexLayer, validateUI5VersionExists } from '@sap-ux/adp-tooling';
|
|
2
|
+
import { validateEmptyString, validateNamespaceAdp, validateProjectFolder, validateProjectName } from '@sap-ux/project-input-validator';
|
|
3
|
+
import { t } from '../../utils/i18n.js';
|
|
4
|
+
import { attributePromptNames, SystemType } from '../types.js';
|
|
5
|
+
import { getProjectNameTooltip } from './helper/tooltip.js';
|
|
6
|
+
import { getVersionAdditionalMessages } from './helper/additional-messages.js';
|
|
7
|
+
import { updateWizardSteps, getDeployPage, updateFlpWizardSteps, getKeyUserImportPage } from '../../utils/steps.js';
|
|
8
|
+
import { getDefaultProjectName, getDefaultNamespace, getDefaultVersion } from './helper/default-values.js';
|
|
9
|
+
import { AdaptationProjectType } from '@sap-ux/axios-extension';
|
|
15
10
|
/**
|
|
16
11
|
* Returns all project attribute prompts, filtering based on promptOptions.
|
|
17
12
|
*
|
|
@@ -20,20 +15,20 @@ const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
|
20
15
|
* @param {AttributePromptOptions} [promptOptions] - Optional settings to control visibility and defaults.
|
|
21
16
|
* @returns {AttributesQuestion[]} An array of prompt objects for basic info input.
|
|
22
17
|
*/
|
|
23
|
-
function getPrompts(path, config, promptOptions) {
|
|
18
|
+
export function getPrompts(path, config, promptOptions) {
|
|
24
19
|
const { isVersionDetected, ui5Versions, systemType, projectType, layer, prompts, isCfEnv = false } = config;
|
|
25
|
-
const isCustomerBase = layer ===
|
|
20
|
+
const isCustomerBase = layer === FlexLayer.CUSTOMER_BASE;
|
|
26
21
|
const keyedPrompts = {
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[
|
|
22
|
+
[attributePromptNames.projectName]: getProjectNamePrompt(path, isCustomerBase, isCfEnv, promptOptions?.[attributePromptNames.projectName]),
|
|
23
|
+
[attributePromptNames.title]: getApplicationTitlePrompt(promptOptions?.[attributePromptNames.title]),
|
|
24
|
+
[attributePromptNames.namespace]: getNamespacePrompt(isCustomerBase, promptOptions?.[attributePromptNames.namespace]),
|
|
25
|
+
[attributePromptNames.targetFolder]: getTargetFolderPrompt(promptOptions?.[attributePromptNames.targetFolder]),
|
|
26
|
+
[attributePromptNames.ui5Version]: getUi5VersionPrompt(ui5Versions, isVersionDetected, systemType),
|
|
27
|
+
[attributePromptNames.ui5ValidationCli]: getUi5VersionValidationPromptForCli(),
|
|
28
|
+
[attributePromptNames.enableTypeScript]: getEnableTypeScriptPrompt(promptOptions?.[attributePromptNames.enableTypeScript]),
|
|
29
|
+
[attributePromptNames.addDeployConfig]: getAddDeployConfigPrompt(prompts, promptOptions?.[attributePromptNames.addDeployConfig]),
|
|
30
|
+
[attributePromptNames.addFlpConfig]: getFlpConfigPrompt(prompts, projectType, promptOptions?.[attributePromptNames.addFlpConfig], isCfEnv),
|
|
31
|
+
[attributePromptNames.importKeyUserChanges]: getImportKeyUserChangesPrompt(prompts, promptOptions?.[attributePromptNames.importKeyUserChanges])
|
|
37
32
|
};
|
|
38
33
|
const questions = Object.entries(keyedPrompts)
|
|
39
34
|
.filter(([promptName]) => {
|
|
@@ -55,15 +50,15 @@ function getPrompts(path, config, promptOptions) {
|
|
|
55
50
|
function getProjectNamePrompt(path, isCustomerBase, isCfEnv, _) {
|
|
56
51
|
return {
|
|
57
52
|
type: 'input',
|
|
58
|
-
name:
|
|
59
|
-
message:
|
|
60
|
-
default: (answers) =>
|
|
53
|
+
name: attributePromptNames.projectName,
|
|
54
|
+
message: t('prompts.projectNameLabel'),
|
|
55
|
+
default: (answers) => getDefaultProjectName(answers.targetFolder || path),
|
|
61
56
|
guiOptions: {
|
|
62
57
|
mandatory: true,
|
|
63
58
|
breadcrumb: true,
|
|
64
|
-
hint:
|
|
59
|
+
hint: getProjectNameTooltip(isCustomerBase)
|
|
65
60
|
},
|
|
66
|
-
validate: (value, answers) =>
|
|
61
|
+
validate: (value, answers) => validateProjectName(value, answers.targetFolder || path, isCustomerBase, isCfEnv),
|
|
67
62
|
store: false
|
|
68
63
|
};
|
|
69
64
|
}
|
|
@@ -76,15 +71,15 @@ function getProjectNamePrompt(path, isCustomerBase, isCfEnv, _) {
|
|
|
76
71
|
function getApplicationTitlePrompt(options) {
|
|
77
72
|
return {
|
|
78
73
|
type: 'input',
|
|
79
|
-
name:
|
|
80
|
-
message:
|
|
81
|
-
default: options?.default ??
|
|
74
|
+
name: attributePromptNames.title,
|
|
75
|
+
message: t('prompts.appTitleLabel'),
|
|
76
|
+
default: options?.default ?? t('prompts.appTitleDefault'),
|
|
82
77
|
guiOptions: {
|
|
83
78
|
mandatory: true,
|
|
84
79
|
breadcrumb: true,
|
|
85
|
-
hint:
|
|
80
|
+
hint: t('prompts.appTitleTooltip')
|
|
86
81
|
},
|
|
87
|
-
validate:
|
|
82
|
+
validate: validateEmptyString,
|
|
88
83
|
store: false
|
|
89
84
|
};
|
|
90
85
|
}
|
|
@@ -98,9 +93,9 @@ function getApplicationTitlePrompt(options) {
|
|
|
98
93
|
function getNamespacePrompt(isCustomerBase, options) {
|
|
99
94
|
const prompt = {
|
|
100
95
|
type: 'input',
|
|
101
|
-
name:
|
|
102
|
-
message:
|
|
103
|
-
default: (answers) => options?.default ??
|
|
96
|
+
name: attributePromptNames.namespace,
|
|
97
|
+
message: t('prompts.namespaceLabel'),
|
|
98
|
+
default: (answers) => options?.default ?? getDefaultNamespace(answers.projectName, isCustomerBase),
|
|
104
99
|
guiOptions: {
|
|
105
100
|
applyDefaultWhenDirty: true
|
|
106
101
|
},
|
|
@@ -113,7 +108,7 @@ function getNamespacePrompt(isCustomerBase, options) {
|
|
|
113
108
|
else {
|
|
114
109
|
prompt.guiOptions.mandatory = true;
|
|
115
110
|
prompt.guiOptions.breadcrumb = true;
|
|
116
|
-
prompt.validate = (value, answers) =>
|
|
111
|
+
prompt.validate = (value, answers) => validateNamespaceAdp(value, answers.projectName, isCustomerBase);
|
|
117
112
|
}
|
|
118
113
|
return prompt;
|
|
119
114
|
}
|
|
@@ -127,14 +122,14 @@ function getTargetFolderPrompt(options) {
|
|
|
127
122
|
return {
|
|
128
123
|
type: 'input',
|
|
129
124
|
name: 'targetFolder',
|
|
130
|
-
message:
|
|
125
|
+
message: t('prompts.projectFolderLabel'),
|
|
131
126
|
guiOptions: {
|
|
132
127
|
type: 'folder-browser',
|
|
133
128
|
applyDefaultWhenDirty: true,
|
|
134
129
|
mandatory: true,
|
|
135
|
-
breadcrumb:
|
|
130
|
+
breadcrumb: t('prompts.projectFolderPath')
|
|
136
131
|
},
|
|
137
|
-
validate: (value, answers) =>
|
|
132
|
+
validate: (value, answers) => validateProjectFolder(value, answers.projectName),
|
|
138
133
|
default: (answers) => answers.targetFolder || options?.default,
|
|
139
134
|
store: false
|
|
140
135
|
};
|
|
@@ -150,19 +145,19 @@ function getTargetFolderPrompt(options) {
|
|
|
150
145
|
function getUi5VersionPrompt(ui5Versions, isVersionDetected, systemType) {
|
|
151
146
|
return {
|
|
152
147
|
type: 'list',
|
|
153
|
-
name:
|
|
154
|
-
message:
|
|
155
|
-
when: systemType !==
|
|
148
|
+
name: attributePromptNames.ui5Version,
|
|
149
|
+
message: t('prompts.ui5VersionLabel'),
|
|
150
|
+
when: systemType !== SystemType.CLOUD_READY,
|
|
156
151
|
choices: ui5Versions,
|
|
157
152
|
guiOptions: {
|
|
158
153
|
applyDefaultWhenDirty: true,
|
|
159
|
-
hint:
|
|
154
|
+
hint: t('prompts.ui5VersionTooltip'),
|
|
160
155
|
breadcrumb: true,
|
|
161
156
|
mandatory: true
|
|
162
157
|
},
|
|
163
|
-
validate: async (version) => await
|
|
164
|
-
default: async () => await
|
|
165
|
-
additionalMessages: () =>
|
|
158
|
+
validate: async (version) => await validateUI5VersionExists(version),
|
|
159
|
+
default: async () => await getDefaultVersion(ui5Versions),
|
|
160
|
+
additionalMessages: () => getVersionAdditionalMessages(isVersionDetected)
|
|
166
161
|
};
|
|
167
162
|
}
|
|
168
163
|
/**
|
|
@@ -172,12 +167,12 @@ function getUi5VersionPrompt(ui5Versions, isVersionDetected, systemType) {
|
|
|
172
167
|
*/
|
|
173
168
|
function getUi5VersionValidationPromptForCli() {
|
|
174
169
|
return {
|
|
175
|
-
name:
|
|
170
|
+
name: attributePromptNames.ui5ValidationCli,
|
|
176
171
|
when: async (answers) => {
|
|
177
172
|
if (!answers.ui5Version) {
|
|
178
173
|
return false;
|
|
179
174
|
}
|
|
180
|
-
const result = await
|
|
175
|
+
const result = await validateUI5VersionExists(answers.ui5Version);
|
|
181
176
|
if (typeof result === 'string') {
|
|
182
177
|
throw new Error(result);
|
|
183
178
|
}
|
|
@@ -194,7 +189,7 @@ function getUi5VersionValidationPromptForCli() {
|
|
|
194
189
|
function getEnableTypeScriptPrompt(_) {
|
|
195
190
|
return {
|
|
196
191
|
type: 'confirm',
|
|
197
|
-
name:
|
|
192
|
+
name: attributePromptNames.enableTypeScript,
|
|
198
193
|
message: 'Enable TypeScript',
|
|
199
194
|
default: false,
|
|
200
195
|
guiOptions: {
|
|
@@ -209,17 +204,17 @@ function getEnableTypeScriptPrompt(_) {
|
|
|
209
204
|
* @param {AddDeployConfigPromptOptions} [_] - Optional prompt options to control visibility.
|
|
210
205
|
* @returns {AttributesQuestion} The prompt configuration for Add Deployment config confirmation.
|
|
211
206
|
*/
|
|
212
|
-
function getAddDeployConfigPrompt(prompts, _) {
|
|
207
|
+
export function getAddDeployConfigPrompt(prompts, _) {
|
|
213
208
|
return {
|
|
214
209
|
type: 'confirm',
|
|
215
|
-
name:
|
|
216
|
-
message:
|
|
210
|
+
name: attributePromptNames.addDeployConfig,
|
|
211
|
+
message: t('prompts.addDeployConfig'),
|
|
217
212
|
default: false,
|
|
218
213
|
guiOptions: {
|
|
219
214
|
breadcrumb: true
|
|
220
215
|
},
|
|
221
216
|
validate: (value) => {
|
|
222
|
-
|
|
217
|
+
updateWizardSteps(prompts, getDeployPage(), t('yuiNavSteps.projectAttributesName'), value);
|
|
223
218
|
return true;
|
|
224
219
|
}
|
|
225
220
|
};
|
|
@@ -233,18 +228,18 @@ function getAddDeployConfigPrompt(prompts, _) {
|
|
|
233
228
|
* @param {boolean} isCfEnv - Whether the project targets Cloud Foundry.
|
|
234
229
|
* @returns {AttributesQuestion} The prompt configuration for Add FLP config confirmation.
|
|
235
230
|
*/
|
|
236
|
-
function getFlpConfigPrompt(prompts, projectType, options, isCfEnv) {
|
|
231
|
+
export function getFlpConfigPrompt(prompts, projectType, options, isCfEnv) {
|
|
237
232
|
return {
|
|
238
233
|
type: 'confirm',
|
|
239
|
-
name:
|
|
240
|
-
message:
|
|
234
|
+
name: attributePromptNames.addFlpConfig,
|
|
235
|
+
message: t('prompts.addFlpConfig'),
|
|
241
236
|
default: false,
|
|
242
237
|
guiOptions: {
|
|
243
238
|
breadcrumb: true
|
|
244
239
|
},
|
|
245
|
-
when: () => isCfEnv || projectType ===
|
|
240
|
+
when: () => isCfEnv || projectType === AdaptationProjectType.CLOUD_READY,
|
|
246
241
|
validate: (value, answers) => {
|
|
247
|
-
|
|
242
|
+
updateFlpWizardSteps(!!options?.hasBaseAppInbounds, prompts, answers.projectName, value);
|
|
248
243
|
return true;
|
|
249
244
|
}
|
|
250
245
|
};
|
|
@@ -259,14 +254,14 @@ function getFlpConfigPrompt(prompts, projectType, options, isCfEnv) {
|
|
|
259
254
|
function getImportKeyUserChangesPrompt(prompts, options) {
|
|
260
255
|
return {
|
|
261
256
|
type: 'confirm',
|
|
262
|
-
name:
|
|
263
|
-
message:
|
|
257
|
+
name: attributePromptNames.importKeyUserChanges,
|
|
258
|
+
message: t('prompts.importKeyUserChangesLabel'),
|
|
264
259
|
default: options?.default ?? false,
|
|
265
260
|
guiOptions: {
|
|
266
261
|
breadcrumb: true
|
|
267
262
|
},
|
|
268
263
|
validate: (value) => {
|
|
269
|
-
|
|
264
|
+
updateWizardSteps(prompts, getKeyUserImportPage(), t('yuiNavSteps.projectAttributesName'), value);
|
|
270
265
|
return true;
|
|
271
266
|
}
|
|
272
267
|
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const validators_1 = require("./helper/validators");
|
|
8
|
-
const choices_1 = require("./helper/choices");
|
|
9
|
-
const conditions_1 = require("./helper/conditions");
|
|
1
|
+
import { cfServicesPromptNames, getModuleNames, getApprouterType, hasApprouter, isLoggedInCf, getMtaServices, getCfApps, downloadAppContent, validateSmartTemplateApplication, validateODataEndpoints, getBusinessServiceInfo, getOAuthPathsFromXsApp, getBackendUrlsFromServiceKeys } from '@sap-ux/adp-tooling';
|
|
2
|
+
import { validateEmptyString } from '@sap-ux/project-input-validator';
|
|
3
|
+
import { t } from '../../utils/i18n.js';
|
|
4
|
+
import { validateBusinessSolutionName } from './helper/validators.js';
|
|
5
|
+
import { getAppRouterChoices, getCFAppChoices } from './helper/choices.js';
|
|
6
|
+
import { shouldShowBaseAppPrompt, showBusinessSolutionNameQuestion } from './helper/conditions.js';
|
|
10
7
|
/**
|
|
11
8
|
* Prompter for CF services.
|
|
12
9
|
*/
|
|
13
|
-
class CFServicesPrompter {
|
|
10
|
+
export class CFServicesPrompter {
|
|
14
11
|
isInternalUsage;
|
|
15
12
|
logger;
|
|
16
13
|
/**
|
|
@@ -80,7 +77,7 @@ class CFServicesPrompter {
|
|
|
80
77
|
*/
|
|
81
78
|
get backendUrls() {
|
|
82
79
|
const serviceKeys = this.businessServiceInfo?.serviceKeys ?? [];
|
|
83
|
-
return
|
|
80
|
+
return getBackendUrlsFromServiceKeys(serviceKeys);
|
|
84
81
|
}
|
|
85
82
|
/**
|
|
86
83
|
* Returns the OAuth paths extracted from xs-app.json routes that have a source property.
|
|
@@ -91,7 +88,7 @@ class CFServicesPrompter {
|
|
|
91
88
|
if (!this.appContentEntries) {
|
|
92
89
|
return [];
|
|
93
90
|
}
|
|
94
|
-
return
|
|
91
|
+
return getOAuthPathsFromXsApp(this.appContentEntries);
|
|
95
92
|
}
|
|
96
93
|
/**
|
|
97
94
|
* Constructor for CFServicesPrompter.
|
|
@@ -115,13 +112,13 @@ class CFServicesPrompter {
|
|
|
115
112
|
*/
|
|
116
113
|
async getPrompts(mtaProjectPath, cfConfig, promptOptions) {
|
|
117
114
|
if (this.isCfLoggedIn) {
|
|
118
|
-
this.businessServices = await
|
|
115
|
+
this.businessServices = await getMtaServices(mtaProjectPath, this.logger);
|
|
119
116
|
}
|
|
120
117
|
const keyedPrompts = {
|
|
121
|
-
[
|
|
122
|
-
[
|
|
123
|
-
[
|
|
124
|
-
[
|
|
118
|
+
[cfServicesPromptNames.approuter]: this.getAppRouterPrompt(mtaProjectPath, cfConfig),
|
|
119
|
+
[cfServicesPromptNames.businessService]: this.getBusinessServicesPrompt(cfConfig),
|
|
120
|
+
[cfServicesPromptNames.businessSolutionName]: this.getBusinessSolutionNamePrompt(),
|
|
121
|
+
[cfServicesPromptNames.baseApp]: this.getBaseAppPrompt(cfConfig)
|
|
125
122
|
};
|
|
126
123
|
const questions = Object.entries(keyedPrompts)
|
|
127
124
|
.filter(([promptName]) => {
|
|
@@ -139,14 +136,14 @@ class CFServicesPrompter {
|
|
|
139
136
|
getBusinessSolutionNamePrompt() {
|
|
140
137
|
return {
|
|
141
138
|
type: 'input',
|
|
142
|
-
name:
|
|
143
|
-
message:
|
|
144
|
-
when: (answers) =>
|
|
145
|
-
validate: (value) =>
|
|
139
|
+
name: cfServicesPromptNames.businessSolutionName,
|
|
140
|
+
message: t('prompts.businessSolutionNameLabel'),
|
|
141
|
+
when: (answers) => showBusinessSolutionNameQuestion(answers, this.isCfLoggedIn, this.showSolutionNamePrompt, answers.businessService),
|
|
142
|
+
validate: (value) => validateBusinessSolutionName(value),
|
|
146
143
|
guiOptions: {
|
|
147
144
|
mandatory: true,
|
|
148
|
-
hint:
|
|
149
|
-
breadcrumb:
|
|
145
|
+
hint: t('prompts.businessSolutionNameTooltip'),
|
|
146
|
+
breadcrumb: t('prompts.businessSolutionBreadcrumb')
|
|
150
147
|
},
|
|
151
148
|
store: false
|
|
152
149
|
};
|
|
@@ -161,14 +158,14 @@ class CFServicesPrompter {
|
|
|
161
158
|
getAppRouterPrompt(mtaProjectPath, cfConfig) {
|
|
162
159
|
return {
|
|
163
160
|
type: 'list',
|
|
164
|
-
name:
|
|
165
|
-
message:
|
|
166
|
-
choices:
|
|
161
|
+
name: cfServicesPromptNames.approuter,
|
|
162
|
+
message: t('prompts.approuterLabel'),
|
|
163
|
+
choices: getAppRouterChoices(this.isInternalUsage),
|
|
167
164
|
when: () => {
|
|
168
|
-
const modules =
|
|
169
|
-
const hasRouter =
|
|
165
|
+
const modules = getModuleNames(mtaProjectPath);
|
|
166
|
+
const hasRouter = hasApprouter(modules);
|
|
170
167
|
if (hasRouter) {
|
|
171
|
-
this.approuter =
|
|
168
|
+
this.approuter = getApprouterType(mtaProjectPath);
|
|
172
169
|
}
|
|
173
170
|
if (this.isCfLoggedIn && !hasRouter) {
|
|
174
171
|
this.showSolutionNamePrompt = true;
|
|
@@ -179,18 +176,18 @@ class CFServicesPrompter {
|
|
|
179
176
|
}
|
|
180
177
|
},
|
|
181
178
|
validate: async (value) => {
|
|
182
|
-
this.isCfLoggedIn = await
|
|
179
|
+
this.isCfLoggedIn = await isLoggedInCf(cfConfig, this.logger);
|
|
183
180
|
if (!this.isCfLoggedIn) {
|
|
184
|
-
return
|
|
181
|
+
return t('error.cfNotLoggedIn');
|
|
185
182
|
}
|
|
186
|
-
const validationResult =
|
|
183
|
+
const validationResult = validateEmptyString(value);
|
|
187
184
|
if (typeof validationResult === 'string') {
|
|
188
185
|
return validationResult;
|
|
189
186
|
}
|
|
190
187
|
return true;
|
|
191
188
|
},
|
|
192
189
|
guiOptions: {
|
|
193
|
-
hint:
|
|
190
|
+
hint: t('prompts.approuterTooltip'),
|
|
194
191
|
breadcrumb: true
|
|
195
192
|
}
|
|
196
193
|
};
|
|
@@ -204,29 +201,29 @@ class CFServicesPrompter {
|
|
|
204
201
|
getBaseAppPrompt(cfConfig) {
|
|
205
202
|
return {
|
|
206
203
|
type: 'list',
|
|
207
|
-
name:
|
|
208
|
-
message:
|
|
209
|
-
choices: (_) =>
|
|
204
|
+
name: cfServicesPromptNames.baseApp,
|
|
205
|
+
message: t('prompts.baseAppLabel'),
|
|
206
|
+
choices: (_) => getCFAppChoices(this.apps),
|
|
210
207
|
validate: async (app) => {
|
|
211
208
|
if (!app) {
|
|
212
|
-
return
|
|
209
|
+
return t('error.baseAppHasToBeSelected');
|
|
213
210
|
}
|
|
214
211
|
try {
|
|
215
|
-
const { entries, serviceInstanceGuid, manifest } = await
|
|
212
|
+
const { entries, serviceInstanceGuid, manifest } = await downloadAppContent(cfConfig.space.GUID, app, this.logger);
|
|
216
213
|
this.appManifest = manifest;
|
|
217
214
|
this.html5RepoServiceInstanceGuid = serviceInstanceGuid;
|
|
218
215
|
this.appContentEntries = entries;
|
|
219
|
-
await
|
|
220
|
-
await
|
|
216
|
+
await validateSmartTemplateApplication(manifest);
|
|
217
|
+
await validateODataEndpoints(entries, this.businessServiceInfo.serviceKeys, this.logger);
|
|
221
218
|
}
|
|
222
219
|
catch (e) {
|
|
223
220
|
return e.message;
|
|
224
221
|
}
|
|
225
222
|
return true;
|
|
226
223
|
},
|
|
227
|
-
when: (answers) =>
|
|
224
|
+
when: (answers) => shouldShowBaseAppPrompt(answers, this.isCfLoggedIn, this.apps),
|
|
228
225
|
guiOptions: {
|
|
229
|
-
hint:
|
|
226
|
+
hint: t('prompts.baseAppTooltip'),
|
|
230
227
|
breadcrumb: true
|
|
231
228
|
}
|
|
232
229
|
};
|
|
@@ -240,25 +237,25 @@ class CFServicesPrompter {
|
|
|
240
237
|
getBusinessServicesPrompt(cfConfig) {
|
|
241
238
|
return {
|
|
242
239
|
type: 'list',
|
|
243
|
-
name:
|
|
244
|
-
message:
|
|
240
|
+
name: cfServicesPromptNames.businessService,
|
|
241
|
+
message: t('prompts.businessServiceLabel'),
|
|
245
242
|
choices: this.businessServices,
|
|
246
243
|
default: (_) => this.businessServices.length === 1 ? (this.businessServices[0] ?? '') : '',
|
|
247
244
|
when: (answers) => this.isCfLoggedIn && (this.approuter || answers.approuter),
|
|
248
245
|
validate: async (value) => {
|
|
249
|
-
const validationResult =
|
|
246
|
+
const validationResult = validateEmptyString(value);
|
|
250
247
|
if (typeof validationResult === 'string') {
|
|
251
|
-
return
|
|
248
|
+
return t('error.businessServiceHasToBeSelected');
|
|
252
249
|
}
|
|
253
250
|
try {
|
|
254
|
-
this.businessServiceInfo = await
|
|
251
|
+
this.businessServiceInfo = await getBusinessServiceInfo(value, cfConfig, this.logger);
|
|
255
252
|
if (this.businessServiceInfo === null) {
|
|
256
|
-
return
|
|
253
|
+
return t('error.businessServiceDoesNotExist');
|
|
257
254
|
}
|
|
258
|
-
this.apps = await
|
|
255
|
+
this.apps = await getCfApps(this.businessServiceInfo.serviceKeys, cfConfig, this.logger);
|
|
259
256
|
this.logger?.log(`Available applications: ${JSON.stringify(this.apps)}`);
|
|
260
257
|
if (this.apps.length === 0) {
|
|
261
|
-
return
|
|
258
|
+
return t('error.noAppsFoundForBusinessService');
|
|
262
259
|
}
|
|
263
260
|
}
|
|
264
261
|
catch (e) {
|
|
@@ -270,11 +267,10 @@ class CFServicesPrompter {
|
|
|
270
267
|
},
|
|
271
268
|
guiOptions: {
|
|
272
269
|
mandatory: true,
|
|
273
|
-
hint:
|
|
270
|
+
hint: t('prompts.businessServiceTooltip'),
|
|
274
271
|
breadcrumb: true
|
|
275
272
|
}
|
|
276
273
|
};
|
|
277
274
|
}
|
|
278
275
|
}
|
|
279
|
-
exports.CFServicesPrompter = CFServicesPrompter;
|
|
280
276
|
//# sourceMappingURL=cf-services.js.map
|
|
@@ -3,9 +3,9 @@ import { FlexLayer } from '@sap-ux/adp-tooling';
|
|
|
3
3
|
import { AdaptationProjectType, type AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
4
4
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
5
5
|
import type { Manifest, ManifestNamespace } from '@sap-ux/project-access';
|
|
6
|
-
import type { TelemetryCollector } from '../../telemetry';
|
|
7
|
-
import type { ConfigPromptOptions, ConfigQuestion } from '../types';
|
|
8
|
-
import { SystemType } from '../types';
|
|
6
|
+
import type { TelemetryCollector } from '../../telemetry/index.js';
|
|
7
|
+
import type { ConfigPromptOptions, ConfigQuestion } from '../types.js';
|
|
8
|
+
import { SystemType } from '../types.js';
|
|
9
9
|
/**
|
|
10
10
|
* A stateful prompter class that creates configuration questions.
|
|
11
11
|
* It exposes a single public method {@link getPrompts} to retrieve the configuration questions.
|