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