@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.
Files changed (58) hide show
  1. package/generators/add-annotations-to-odata/index.d.ts +3 -3
  2. package/generators/add-annotations-to-odata/index.js +15 -19
  3. package/generators/add-component-usages/index.d.ts +3 -3
  4. package/generators/add-component-usages/index.js +16 -20
  5. package/generators/add-new-model/index.d.ts +3 -3
  6. package/generators/add-new-model/index.js +24 -28
  7. package/generators/app/extension-project/index.d.ts +1 -1
  8. package/generators/app/extension-project/index.js +6 -9
  9. package/generators/app/index.d.ts +1 -1
  10. package/generators/app/index.js +129 -135
  11. package/generators/app/layer.js +5 -7
  12. package/generators/app/questions/attributes.d.ts +2 -2
  13. package/generators/app/questions/attributes.js +60 -65
  14. package/generators/app/questions/cf-services.js +48 -52
  15. package/generators/app/questions/configuration.d.ts +3 -3
  16. package/generators/app/questions/configuration.js +125 -129
  17. package/generators/app/questions/helper/additional-messages.js +29 -36
  18. package/generators/app/questions/helper/choices.js +16 -25
  19. package/generators/app/questions/helper/conditions.js +14 -23
  20. package/generators/app/questions/helper/default-values.js +8 -13
  21. package/generators/app/questions/helper/message.js +7 -11
  22. package/generators/app/questions/helper/tooltip.js +4 -7
  23. package/generators/app/questions/helper/validators.js +29 -39
  24. package/generators/app/questions/key-user.d.ts +1 -1
  25. package/generators/app/questions/key-user.js +40 -45
  26. package/generators/app/questions/target-env.d.ts +2 -2
  27. package/generators/app/questions/target-env.js +22 -27
  28. package/generators/app/types.js +13 -16
  29. package/generators/base/questions/credentials.d.ts +1 -1
  30. package/generators/base/questions/credentials.js +15 -18
  31. package/generators/base/sub-gen-auth-base.d.ts +3 -3
  32. package/generators/base/sub-gen-auth-base.js +24 -30
  33. package/generators/base/sub-gen-base.d.ts +5 -6
  34. package/generators/base/sub-gen-base.js +11 -17
  35. package/generators/change-data-source/index.d.ts +3 -3
  36. package/generators/change-data-source/index.js +8 -12
  37. package/generators/telemetry/collector.d.ts +1 -1
  38. package/generators/telemetry/collector.js +6 -10
  39. package/generators/telemetry/events.js +2 -5
  40. package/generators/telemetry/index.d.ts +2 -2
  41. package/generators/telemetry/index.js +2 -18
  42. package/generators/types.js +2 -5
  43. package/generators/utils/appWizardCache.d.ts +1 -1
  44. package/generators/utils/appWizardCache.js +7 -13
  45. package/generators/utils/deps.js +10 -45
  46. package/generators/utils/i18n.js +13 -23
  47. package/generators/utils/logger.js +4 -7
  48. package/generators/utils/opts.js +3 -6
  49. package/generators/utils/parse-json-input.d.ts +1 -1
  50. package/generators/utils/parse-json-input.js +5 -9
  51. package/generators/utils/steps.d.ts +1 -1
  52. package/generators/utils/steps.js +37 -48
  53. package/generators/utils/subgenHelpers.js +9 -14
  54. package/generators/utils/templates.js +7 -8
  55. package/generators/utils/type-guards.d.ts +1 -1
  56. package/generators/utils/type-guards.js +2 -6
  57. package/generators/utils/workspace.js +7 -13
  58. package/package.json +19 -17
@@ -1,14 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeyUserImportPrompter = exports.DEFAULT_ADAPTATION_ID = void 0;
4
- exports.determineFlexVersion = determineFlexVersion;
5
- const axios_extension_1 = require("@sap-ux/axios-extension");
6
- const project_input_validator_1 = require("@sap-ux/project-input-validator");
7
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
8
- const i18n_1 = require("../../utils/i18n");
9
- const types_1 = require("../types");
10
- const choices_1 = require("./helper/choices");
11
- exports.DEFAULT_ADAPTATION_ID = 'DEFAULT';
1
+ import { isAxiosError } from '@sap-ux/axios-extension';
2
+ import { validateEmptyString } from '@sap-ux/project-input-validator';
3
+ import { getConfiguredProvider } from '@sap-ux/adp-tooling';
4
+ import { t } from '../../utils/i18n.js';
5
+ import { keyUserPromptNames } from '../types.js';
6
+ import { getAdaptationChoices, getKeyUserSystemChoices } from './helper/choices.js';
7
+ export const DEFAULT_ADAPTATION_ID = 'DEFAULT';
12
8
  const UNSUPPORTED_STATUS_CODES = new Set([400, 404, 405]);
13
9
  /**
14
10
  * Returns a user-friendly error message if the error is an axios error with a status code
@@ -19,7 +15,7 @@ const UNSUPPORTED_STATUS_CODES = new Set([400, 404, 405]);
19
15
  * @returns The user-friendly message or the original error message.
20
16
  */
21
17
  function getUnsupportedApiMessage(e, userMessage) {
22
- if ((0, axios_extension_1.isAxiosError)(e)) {
18
+ if (isAxiosError(e)) {
23
19
  const status = e.response?.status;
24
20
  if (status !== undefined && UNSUPPORTED_STATUS_CODES.has(status)) {
25
21
  return userMessage;
@@ -33,7 +29,7 @@ function getUnsupportedApiMessage(e, userMessage) {
33
29
  * @param {FlexVersion[]} flexVersions - The list of flex versions.
34
30
  * @returns {string} The flex version to be used.
35
31
  */
36
- function determineFlexVersion(flexVersions) {
32
+ export function determineFlexVersion(flexVersions) {
37
33
  if (!flexVersions?.length) {
38
34
  return '';
39
35
  }
@@ -45,7 +41,7 @@ function determineFlexVersion(flexVersions) {
45
41
  /**
46
42
  * Prompter class that guides the user through importing key-user changes.
47
43
  */
48
- class KeyUserImportPrompter {
44
+ export class KeyUserImportPrompter {
49
45
  systemLookup;
50
46
  componentId;
51
47
  defaultProvider;
@@ -104,10 +100,10 @@ class KeyUserImportPrompter {
104
100
  */
105
101
  getPrompts(promptOptions) {
106
102
  const keyedPrompts = {
107
- [types_1.keyUserPromptNames.keyUserSystem]: this.getSystemPrompt(promptOptions?.[types_1.keyUserPromptNames.keyUserSystem]),
108
- [types_1.keyUserPromptNames.keyUserUsername]: this.getUsernamePrompt(promptOptions?.[types_1.keyUserPromptNames.keyUserUsername]),
109
- [types_1.keyUserPromptNames.keyUserPassword]: this.getPasswordPrompt(promptOptions?.[types_1.keyUserPromptNames.keyUserPassword]),
110
- [types_1.keyUserPromptNames.keyUserAdaptation]: this.getAdaptationPrompt(promptOptions?.[types_1.keyUserPromptNames.keyUserAdaptation])
103
+ [keyUserPromptNames.keyUserSystem]: this.getSystemPrompt(promptOptions?.[keyUserPromptNames.keyUserSystem]),
104
+ [keyUserPromptNames.keyUserUsername]: this.getUsernamePrompt(promptOptions?.[keyUserPromptNames.keyUserUsername]),
105
+ [keyUserPromptNames.keyUserPassword]: this.getPasswordPrompt(promptOptions?.[keyUserPromptNames.keyUserPassword]),
106
+ [keyUserPromptNames.keyUserAdaptation]: this.getAdaptationPrompt(promptOptions?.[keyUserPromptNames.keyUserAdaptation])
111
107
  };
112
108
  const questions = Object.entries(keyedPrompts)
113
109
  .filter(([promptName, _]) => {
@@ -126,11 +122,11 @@ class KeyUserImportPrompter {
126
122
  getSystemPrompt(options) {
127
123
  return {
128
124
  type: 'list',
129
- name: types_1.keyUserPromptNames.keyUserSystem,
130
- message: (0, i18n_1.t)('prompts.systemLabel'),
125
+ name: keyUserPromptNames.keyUserSystem,
126
+ message: t('prompts.systemLabel'),
131
127
  choices: async () => {
132
128
  const systems = await this.systemLookup.getSystems();
133
- return (0, choices_1.getKeyUserSystemChoices)(systems, this.defaultSystem);
129
+ return getKeyUserSystemChoices(systems, this.defaultSystem);
134
130
  },
135
131
  guiOptions: {
136
132
  mandatory: true,
@@ -149,15 +145,15 @@ class KeyUserImportPrompter {
149
145
  getUsernamePrompt(options) {
150
146
  return {
151
147
  type: 'input',
152
- name: types_1.keyUserPromptNames.keyUserUsername,
153
- message: (0, i18n_1.t)('prompts.usernameLabel'),
148
+ name: keyUserPromptNames.keyUserUsername,
149
+ message: t('prompts.usernameLabel'),
154
150
  default: options?.default ?? '',
155
151
  filter: (val) => val.trim(),
156
152
  guiOptions: {
157
153
  mandatory: true
158
154
  },
159
155
  when: (answers) => !!answers.keyUserSystem && this.isAuthRequired,
160
- validate: (value) => (0, project_input_validator_1.validateEmptyString)(value)
156
+ validate: (value) => validateEmptyString(value)
161
157
  };
162
158
  }
163
159
  /**
@@ -169,8 +165,8 @@ class KeyUserImportPrompter {
169
165
  getPasswordPrompt(options) {
170
166
  return {
171
167
  type: 'password',
172
- name: types_1.keyUserPromptNames.keyUserPassword,
173
- message: (0, i18n_1.t)('prompts.passwordLabel'),
168
+ name: keyUserPromptNames.keyUserPassword,
169
+ message: t('prompts.passwordLabel'),
174
170
  mask: '*',
175
171
  default: options?.default ?? '',
176
172
  guiOptions: {
@@ -190,14 +186,14 @@ class KeyUserImportPrompter {
190
186
  getAdaptationPrompt(_) {
191
187
  return {
192
188
  type: 'list',
193
- name: types_1.keyUserPromptNames.keyUserAdaptation,
194
- message: (0, i18n_1.t)('prompts.keyUserAdaptationLabel'),
189
+ name: keyUserPromptNames.keyUserAdaptation,
190
+ message: t('prompts.keyUserAdaptationLabel'),
195
191
  guiOptions: {
196
192
  mandatory: true,
197
- breadcrumb: (0, i18n_1.t)('prompts.keyUserAdaptationBreadcrumb')
193
+ breadcrumb: t('prompts.keyUserAdaptationBreadcrumb')
198
194
  },
199
- choices: () => (0, choices_1.getAdaptationChoices)(this.adaptations),
200
- default: () => (0, choices_1.getAdaptationChoices)(this.adaptations)[0]?.name,
195
+ choices: () => getAdaptationChoices(this.adaptations),
196
+ default: () => getAdaptationChoices(this.adaptations)[0]?.name,
201
197
  validate: async (adaptation) => await this.validateKeyUserChanges(adaptation?.id),
202
198
  when: () => this.adaptations.length > 1
203
199
  };
@@ -216,7 +212,7 @@ class KeyUserImportPrompter {
216
212
  catch (e) {
217
213
  this.logger.error(`Error loading adaptations for component ${this.componentId}: ${e.message}`);
218
214
  this.logger.debug(e);
219
- throw new Error(getUnsupportedApiMessage(e, (0, i18n_1.t)('error.keyUserAdaptationsNotSupported')));
215
+ throw new Error(getUnsupportedApiMessage(e, t('error.keyUserAdaptationsNotSupported')));
220
216
  }
221
217
  }
222
218
  /**
@@ -232,7 +228,7 @@ class KeyUserImportPrompter {
232
228
  catch (e) {
233
229
  this.logger.error(`Error loading flex versions for component ${this.componentId}: ${e.message}`);
234
230
  this.logger.debug(e);
235
- throw new Error(getUnsupportedApiMessage(e, (0, i18n_1.t)('error.keyUserFlexVersionsNotSupported')));
231
+ throw new Error(getUnsupportedApiMessage(e, t('error.keyUserFlexVersionsNotSupported')));
236
232
  }
237
233
  }
238
234
  /**
@@ -256,10 +252,10 @@ class KeyUserImportPrompter {
256
252
  await this.loadFlexVersions();
257
253
  await this.loadAdaptations();
258
254
  if (!this.adaptations.length) {
259
- throw new Error((0, i18n_1.t)('error.keyUserNoAdaptations'));
255
+ throw new Error(t('error.keyUserNoAdaptations'));
260
256
  }
261
- if (this.adaptations.length === 1 && this.adaptations[0]?.id === exports.DEFAULT_ADAPTATION_ID) {
262
- return await this.validateKeyUserChanges(exports.DEFAULT_ADAPTATION_ID);
257
+ if (this.adaptations.length === 1 && this.adaptations[0]?.id === DEFAULT_ADAPTATION_ID) {
258
+ return await this.validateKeyUserChanges(DEFAULT_ADAPTATION_ID);
263
259
  }
264
260
  return true;
265
261
  }
@@ -271,7 +267,7 @@ class KeyUserImportPrompter {
271
267
  * @returns An error message if validation fails, or true if the system selection is valid.
272
268
  */
273
269
  async validateSystem(system, answers) {
274
- const validationResult = (0, project_input_validator_1.validateEmptyString)(system);
270
+ const validationResult = validateEmptyString(system);
275
271
  if (typeof validationResult === 'string') {
276
272
  return validationResult;
277
273
  }
@@ -290,7 +286,7 @@ class KeyUserImportPrompter {
290
286
  username: answers.keyUserUsername,
291
287
  password: answers.keyUserPassword
292
288
  };
293
- this.provider = await (0, adp_tooling_1.getConfiguredProvider)(options, this.logger);
289
+ this.provider = await getConfiguredProvider(options, this.logger);
294
290
  return await this.loadDataAndValidateKeyUserChanges();
295
291
  }
296
292
  }
@@ -307,7 +303,7 @@ class KeyUserImportPrompter {
307
303
  * @returns An error message if validation fails, or true if the password is valid.
308
304
  */
309
305
  async validatePassword(password, answers) {
310
- const validationResult = (0, project_input_validator_1.validateEmptyString)(password);
306
+ const validationResult = validateEmptyString(password);
311
307
  if (typeof validationResult === 'string') {
312
308
  return validationResult;
313
309
  }
@@ -319,7 +315,7 @@ class KeyUserImportPrompter {
319
315
  username: answers.keyUserUsername,
320
316
  password
321
317
  };
322
- this.provider = await (0, adp_tooling_1.getConfiguredProvider)(options, this.logger);
318
+ this.provider = await getConfiguredProvider(options, this.logger);
323
319
  return await this.loadDataAndValidateKeyUserChanges();
324
320
  }
325
321
  catch (e) {
@@ -342,20 +338,19 @@ class KeyUserImportPrompter {
342
338
  this.keyUserChanges = data?.contents ?? [];
343
339
  this.logger.debug(`Retrieved ${this.keyUserChanges.length} key-user change(s) for adaptation ${adaptationId}`);
344
340
  if (!this.keyUserChanges.length) {
345
- if (adaptationId === exports.DEFAULT_ADAPTATION_ID && this.adaptations.length === 1) {
346
- return (0, i18n_1.t)('error.keyUserNoChangesDefault');
341
+ if (adaptationId === DEFAULT_ADAPTATION_ID && this.adaptations.length === 1) {
342
+ return t('error.keyUserNoChangesDefault');
347
343
  }
348
344
  this.logger.warn(`No key-user changes found for adaptation: ${adaptationId}`);
349
- return (0, i18n_1.t)('error.keyUserNoChangesAdaptation', { adaptationId });
345
+ return t('error.keyUserNoChangesAdaptation', { adaptationId });
350
346
  }
351
347
  return true;
352
348
  }
353
349
  catch (e) {
354
350
  this.logger.error(`Error validating key-user changes for adaptation ${adaptationId}: ${e.message}`);
355
351
  this.logger.debug(e);
356
- return getUnsupportedApiMessage(e, (0, i18n_1.t)('error.keyUserNotSupported'));
352
+ return getUnsupportedApiMessage(e, t('error.keyUserNotSupported'));
357
353
  }
358
354
  }
359
355
  }
360
- exports.KeyUserImportPrompter = KeyUserImportPrompter;
361
356
  //# sourceMappingURL=key-user.js.map
@@ -2,8 +2,8 @@ import type { AppWizard } from '@sap-devx/yeoman-ui-types';
2
2
  import type { ToolsLogger } from '@sap-ux/logger';
3
3
  import type { CfConfig } from '@sap-ux/adp-tooling';
4
4
  import type { YUIQuestion } from '@sap-ux/inquirer-common';
5
- import { TargetEnv } from '../types';
6
- import type { ProjectLocationAnswers, TargetEnvQuestion } from '../types';
5
+ import { TargetEnv } from '../types.js';
6
+ import type { ProjectLocationAnswers, TargetEnvQuestion } from '../types.js';
7
7
  type EnvironmentChoice = {
8
8
  name: string;
9
9
  value: TargetEnv;
@@ -1,14 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTargetEnvPrompt = getTargetEnvPrompt;
4
- exports.getEnvironments = getEnvironments;
5
- exports.getProjectPathPrompt = getProjectPathPrompt;
6
- const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
7
- const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
8
- const i18n_1 = require("../../utils/i18n");
9
- const types_1 = require("../types");
10
- const additional_messages_1 = require("./helper/additional-messages");
11
- const validators_1 = require("./helper/validators");
1
+ import { MessageType } from '@sap-devx/yeoman-ui-types';
2
+ import { getDefaultTargetFolder } from '@sap-ux/fiori-generator-shared';
3
+ import { t } from '../../utils/i18n.js';
4
+ import { TargetEnv } from '../types.js';
5
+ import { getTargetEnvAdditionalMessages } from './helper/additional-messages.js';
6
+ import { validateEnvironment, validateProjectPath } from './helper/validators.js';
12
7
  /**
13
8
  * Returns the target environment prompt.
14
9
  *
@@ -18,20 +13,20 @@ const validators_1 = require("./helper/validators");
18
13
  * @param {CfConfig} cfConfig - The CF config service instance.
19
14
  * @returns {object[]} The target environment prompt.
20
15
  */
21
- function getTargetEnvPrompt(appWizard, isCfInstalled, isCFLoggedIn, cfConfig) {
16
+ export function getTargetEnvPrompt(appWizard, isCfInstalled, isCFLoggedIn, cfConfig) {
22
17
  return {
23
18
  type: 'list',
24
19
  name: 'targetEnv',
25
- message: (0, i18n_1.t)('prompts.targetEnvLabel'),
20
+ message: t('prompts.targetEnvLabel'),
26
21
  choices: () => getEnvironments(appWizard, isCfInstalled),
27
22
  default: () => getEnvironments(appWizard, isCfInstalled)[0]?.name,
28
23
  guiOptions: {
29
24
  mandatory: true,
30
- hint: (0, i18n_1.t)('prompts.targetEnvTooltip'),
31
- breadcrumb: (0, i18n_1.t)('prompts.targetEnvBreadcrumb')
25
+ hint: t('prompts.targetEnvTooltip'),
26
+ breadcrumb: t('prompts.targetEnvBreadcrumb')
32
27
  },
33
- validate: (value) => (0, validators_1.validateEnvironment)(value, isCFLoggedIn, cfConfig),
34
- additionalMessages: (value) => (0, additional_messages_1.getTargetEnvAdditionalMessages)(value, isCFLoggedIn, cfConfig)
28
+ validate: (value) => validateEnvironment(value, isCFLoggedIn, cfConfig),
29
+ additionalMessages: (value) => getTargetEnvAdditionalMessages(value, isCFLoggedIn, cfConfig)
35
30
  };
36
31
  }
37
32
  /**
@@ -41,13 +36,13 @@ function getTargetEnvPrompt(appWizard, isCfInstalled, isCFLoggedIn, cfConfig) {
41
36
  * @param {boolean} isCfInstalled - Whether Cloud Foundry is installed.
42
37
  * @returns {object[]} The environments.
43
38
  */
44
- function getEnvironments(appWizard, isCfInstalled) {
45
- const choices = [{ name: 'ABAP', value: types_1.TargetEnv.ABAP }];
39
+ export function getEnvironments(appWizard, isCfInstalled) {
40
+ const choices = [{ name: 'ABAP', value: TargetEnv.ABAP }];
46
41
  if (isCfInstalled) {
47
- choices.push({ name: 'SAP BTP, Cloud Foundry environment', value: types_1.TargetEnv.CF });
42
+ choices.push({ name: 'SAP BTP, Cloud Foundry environment', value: TargetEnv.CF });
48
43
  }
49
44
  else {
50
- appWizard.showInformation((0, i18n_1.t)('error.cfNotInstalled'), yeoman_ui_types_1.MessageType.prompt);
45
+ appWizard.showInformation(t('error.cfNotInstalled'), MessageType.prompt);
51
46
  }
52
47
  return choices;
53
48
  }
@@ -58,19 +53,19 @@ function getEnvironments(appWizard, isCfInstalled) {
58
53
  * @param {any} vscode - The VSCode instance.
59
54
  * @returns {YUIQuestion<ProjectLocationAnswers>[]} The project path prompt.
60
55
  */
61
- function getProjectPathPrompt(logger, vscode) {
56
+ export function getProjectPathPrompt(logger, vscode) {
62
57
  return {
63
58
  type: 'input',
64
59
  name: 'projectLocation',
65
60
  guiOptions: {
66
61
  type: 'folder-browser',
67
62
  mandatory: true,
68
- hint: (0, i18n_1.t)('prompts.projectLocationTooltip'),
69
- breadcrumb: (0, i18n_1.t)('prompts.projectLocationBreadcrumb')
63
+ hint: t('prompts.projectLocationTooltip'),
64
+ breadcrumb: t('prompts.projectLocationBreadcrumb')
70
65
  },
71
- message: (0, i18n_1.t)('prompts.projectLocationLabel'),
72
- validate: (value) => (0, validators_1.validateProjectPath)(value, logger),
73
- default: () => (0, fiori_generator_shared_1.getDefaultTargetFolder)(vscode),
66
+ message: t('prompts.projectLocationLabel'),
67
+ validate: (value) => validateProjectPath(value, logger),
68
+ default: () => getDefaultTargetFolder(vscode),
74
69
  store: false
75
70
  };
76
71
  }
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SystemType = exports.cfLoginPromptNames = exports.TargetEnv = exports.targetEnvPromptNames = exports.keyUserPromptNames = exports.attributePromptNames = exports.configPromptNames = void 0;
4
1
  /**
5
2
  * Enumeration of prompt names used in the configuration.
6
3
  */
7
- var configPromptNames;
4
+ export var configPromptNames;
8
5
  (function (configPromptNames) {
9
6
  configPromptNames["system"] = "system";
10
7
  configPromptNames["systemValidationCli"] = "systemValidationCli";
@@ -19,8 +16,8 @@ var configPromptNames;
19
16
  configPromptNames["fioriId"] = "fioriId";
20
17
  configPromptNames["ach"] = "ach";
21
18
  configPromptNames["shouldCreateExtProject"] = "shouldCreateExtProject";
22
- })(configPromptNames || (exports.configPromptNames = configPromptNames = {}));
23
- var attributePromptNames;
19
+ })(configPromptNames || (configPromptNames = {}));
20
+ export var attributePromptNames;
24
21
  (function (attributePromptNames) {
25
22
  attributePromptNames["projectName"] = "projectName";
26
23
  attributePromptNames["title"] = "title";
@@ -32,23 +29,23 @@ var attributePromptNames;
32
29
  attributePromptNames["addDeployConfig"] = "addDeployConfig";
33
30
  attributePromptNames["addFlpConfig"] = "addFlpConfig";
34
31
  attributePromptNames["importKeyUserChanges"] = "importKeyUserChanges";
35
- })(attributePromptNames || (exports.attributePromptNames = attributePromptNames = {}));
32
+ })(attributePromptNames || (attributePromptNames = {}));
36
33
  /**
37
34
  * Enumeration of prompt names used in the key-user import.
38
35
  */
39
- var keyUserPromptNames;
36
+ export var keyUserPromptNames;
40
37
  (function (keyUserPromptNames) {
41
38
  keyUserPromptNames["keyUserSystem"] = "keyUserSystem";
42
39
  keyUserPromptNames["keyUserUsername"] = "keyUserUsername";
43
40
  keyUserPromptNames["keyUserPassword"] = "keyUserPassword";
44
41
  keyUserPromptNames["keyUserAdaptation"] = "keyUserAdaptation";
45
- })(keyUserPromptNames || (exports.keyUserPromptNames = keyUserPromptNames = {}));
46
- var targetEnvPromptNames;
42
+ })(keyUserPromptNames || (keyUserPromptNames = {}));
43
+ export var targetEnvPromptNames;
47
44
  (function (targetEnvPromptNames) {
48
45
  targetEnvPromptNames["targetEnv"] = "targetEnv";
49
- })(targetEnvPromptNames || (exports.targetEnvPromptNames = targetEnvPromptNames = {}));
50
- exports.TargetEnv = { ABAP: 'ABAP', CF: 'CF' };
51
- var cfLoginPromptNames;
46
+ })(targetEnvPromptNames || (targetEnvPromptNames = {}));
47
+ export const TargetEnv = { ABAP: 'ABAP', CF: 'CF' };
48
+ export var cfLoginPromptNames;
52
49
  (function (cfLoginPromptNames) {
53
50
  cfLoginPromptNames["cfLoggedInMainMessage"] = "cfLoggedInMainMessage";
54
51
  cfLoginPromptNames["cfLoggedApiEndpointMessage"] = "cfLoggedApiEndpointMessage";
@@ -57,10 +54,10 @@ var cfLoginPromptNames;
57
54
  cfLoginPromptNames["cfLoggedInEndingMessage"] = "cfLoggedInEndingMessage";
58
55
  cfLoginPromptNames["cfExternalLogin"] = "cfExternalLogin";
59
56
  cfLoginPromptNames["cfExternalLoginSuccessMessage"] = "cfExternalLoginSuccessMessage";
60
- })(cfLoginPromptNames || (exports.cfLoginPromptNames = cfLoginPromptNames = {}));
61
- var SystemType;
57
+ })(cfLoginPromptNames || (cfLoginPromptNames = {}));
58
+ export var SystemType;
62
59
  (function (SystemType) {
63
60
  SystemType["CLOUD_READY"] = "cloudReady";
64
61
  SystemType["ON_PREM"] = "onPremise";
65
- })(SystemType || (exports.SystemType = SystemType = {}));
62
+ })(SystemType || (SystemType = {}));
66
63
  //# sourceMappingURL=types.js.map
@@ -1,7 +1,7 @@
1
1
  import type { ToolsLogger } from '@sap-ux/logger';
2
2
  import type { AbapTarget } from '@sap-ux/system-access';
3
3
  import type { YUIQuestion } from '@sap-ux/inquirer-common';
4
- import type { Credentials } from '../../types';
4
+ import type { Credentials } from '../../types.js';
5
5
  /**
6
6
  * Returns the username prompt.
7
7
  *
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCredentialsPrompts = getCredentialsPrompts;
4
- const btp_utils_1 = require("@sap-ux/btp-utils");
5
- const project_input_validator_1 = require("@sap-ux/project-input-validator");
6
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
7
- const i18n_1 = require("../../utils/i18n");
8
- const types_1 = require("../../app/types");
1
+ import { isAppStudio } from '@sap-ux/btp-utils';
2
+ import { validateEmptyString } from '@sap-ux/project-input-validator';
3
+ import { getConfiguredProvider } from '@sap-ux/adp-tooling';
4
+ import { t } from '../../utils/i18n.js';
5
+ import { configPromptNames } from '../../app/types.js';
9
6
  /**
10
7
  * Returns the username prompt.
11
8
  *
@@ -13,7 +10,7 @@ const types_1 = require("../../app/types");
13
10
  * @param {ToolsLogger} logger - The logger.
14
11
  * @returns {YUIQuestion<Credentials>[]} The username prompt.
15
12
  */
16
- function getCredentialsPrompts(abapTarget, logger) {
13
+ export function getCredentialsPrompts(abapTarget, logger) {
17
14
  return [getUsernamePrompt(), getPasswordPrompt(abapTarget, logger)];
18
15
  }
19
16
  /**
@@ -24,9 +21,9 @@ function getCredentialsPrompts(abapTarget, logger) {
24
21
  function getUsernamePrompt() {
25
22
  return {
26
23
  type: 'input',
27
- name: types_1.configPromptNames.username,
28
- message: (0, i18n_1.t)('prompts.usernameLabel'),
29
- validate: project_input_validator_1.validateEmptyString,
24
+ name: configPromptNames.username,
25
+ message: t('prompts.usernameLabel'),
26
+ validate: validateEmptyString,
30
27
  guiOptions: {
31
28
  mandatory: true
32
29
  }
@@ -40,23 +37,23 @@ function getUsernamePrompt() {
40
37
  * @returns {PasswordQuestion<Credentials>} The password prompt.
41
38
  */
42
39
  function getPasswordPrompt(abapTarget, logger) {
43
- const system = ((0, btp_utils_1.isAppStudio)() ? abapTarget.destination : abapTarget.url) ?? '';
40
+ const system = (isAppStudio() ? abapTarget.destination : abapTarget.url) ?? '';
44
41
  return {
45
42
  type: 'password',
46
- name: types_1.configPromptNames.password,
47
- message: (0, i18n_1.t)('prompts.passwordLabel'),
43
+ name: configPromptNames.password,
44
+ message: t('prompts.passwordLabel'),
48
45
  mask: '*',
49
46
  guiOptions: {
50
47
  mandatory: true,
51
48
  type: 'login'
52
49
  },
53
50
  validate: async (value, answers) => {
54
- const validationResult = (0, project_input_validator_1.validateEmptyString)(value);
51
+ const validationResult = validateEmptyString(value);
55
52
  if (typeof validationResult === 'string') {
56
53
  return validationResult;
57
54
  }
58
55
  if (!answers.username) {
59
- return (0, i18n_1.t)('error.pleaseProvideAllRequiredData');
56
+ return t('error.pleaseProvideAllRequiredData');
60
57
  }
61
58
  try {
62
59
  const credentials = {
@@ -84,7 +81,7 @@ function getPasswordPrompt(abapTarget, logger) {
84
81
  * an error.
85
82
  */
86
83
  async function assertAuthenticated(credentials, logger) {
87
- const abapProvider = await (0, adp_tooling_1.getConfiguredProvider)(credentials, logger);
84
+ const abapProvider = await getConfiguredProvider(credentials, logger);
88
85
  const layeredRepositoryService = abapProvider.getLayeredRepository();
89
86
  await layeredRepositoryService.getCsrfToken();
90
87
  }
@@ -2,9 +2,9 @@ import type { Manifest } from '@sap-ux/project-access';
2
2
  import { type AbapTarget } from '@sap-ux/system-access';
3
3
  import type { DescriptorVariant, IManifestService } from '@sap-ux/adp-tooling';
4
4
  import { SystemLookup } from '@sap-ux/adp-tooling';
5
- import SubGeneratorBase from './sub-gen-base';
6
- import type { GeneratorOpts } from '../utils/opts';
7
- import type { GeneratorTypes } from '../types';
5
+ import SubGeneratorBase from './sub-gen-base.js';
6
+ import type { GeneratorOpts } from '../utils/opts.js';
7
+ import type { GeneratorTypes } from '../types.js';
8
8
  /**
9
9
  * Base class for *sub* generators that need authentication handling.
10
10
  * Adds functionality on top of {@link SubGeneratorBase}.
@@ -1,22 +1,17 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const node_path_1 = __importDefault(require("node:path"));
7
- const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
8
- const btp_utils_1 = require("@sap-ux/btp-utils");
9
- const system_access_1 = require("@sap-ux/system-access");
10
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
11
- const i18n_1 = require("../utils/i18n");
12
- const sub_gen_base_1 = __importDefault(require("./sub-gen-base"));
13
- const credentials_1 = require("./questions/credentials");
14
- const steps_1 = require("../utils/steps");
1
+ import path from 'node:path';
2
+ import { Prompts } from '@sap-devx/yeoman-ui-types';
3
+ import { isAppStudio } from '@sap-ux/btp-utils';
4
+ import { createAbapServiceProvider } from '@sap-ux/system-access';
5
+ import { getVariant, getAdpConfig, ManifestService, ManifestServiceCF, SystemLookup, isCFEnvironment } from '@sap-ux/adp-tooling';
6
+ import { initI18n } from '../utils/i18n.js';
7
+ import SubGeneratorBase from './sub-gen-base.js';
8
+ import { getCredentialsPrompts } from './questions/credentials.js';
9
+ import { getSubGenAuthPages } from '../utils/steps.js';
15
10
  /**
16
11
  * Base class for *sub* generators that need authentication handling.
17
12
  * Adds functionality on top of {@link SubGeneratorBase}.
18
13
  */
19
- class SubGeneratorWithAuthBase extends sub_gen_base_1.default {
14
+ export default class SubGeneratorWithAuthBase extends SubGeneratorBase {
20
15
  /**
21
16
  * The ABAP target.
22
17
  */
@@ -77,21 +72,21 @@ class SubGeneratorWithAuthBase extends sub_gen_base_1.default {
77
72
  * Subclasses must call this to benefit from the built-in auth handling.
78
73
  */
79
74
  async onInit() {
80
- await (0, i18n_1.initI18n)();
81
- this.systemLookup = new adp_tooling_1.SystemLookup(this.logger);
82
- this.isCFProject = await (0, adp_tooling_1.isCFEnvironment)(this.projectPath);
75
+ await initI18n();
76
+ this.systemLookup = new SystemLookup(this.logger);
77
+ this.isCFProject = await isCFEnvironment(this.projectPath);
83
78
  if (this.isCFProject) {
84
79
  this.system = '';
85
80
  this.logger.log('CF project detected, will use build output for manifest');
86
- this._registerPrompts(new yeoman_ui_types_1.Prompts((0, steps_1.getSubGenAuthPages)(this.generatorType, this.system)));
81
+ this._registerPrompts(new Prompts(getSubGenAuthPages(this.generatorType, this.system)));
87
82
  this.prompts.splice(0, 1, []);
88
83
  return;
89
84
  }
90
- const adpConfig = await (0, adp_tooling_1.getAdpConfig)(this.projectPath, node_path_1.default.join(this.projectPath, 'ui5.yaml'));
85
+ const adpConfig = await getAdpConfig(this.projectPath, path.join(this.projectPath, 'ui5.yaml'));
91
86
  this.abapTarget = adpConfig.target;
92
- this.system = ((0, btp_utils_1.isAppStudio)() ? this.abapTarget.destination : this.abapTarget.url) ?? '';
87
+ this.system = (isAppStudio() ? this.abapTarget.destination : this.abapTarget.url) ?? '';
93
88
  this.logger.log(`Successfully retrieved abap target\n${JSON.stringify(this.abapTarget, null, 2)}`);
94
- this._registerPrompts(new yeoman_ui_types_1.Prompts((0, steps_1.getSubGenAuthPages)(this.generatorType, this.system)));
89
+ this._registerPrompts(new Prompts(getSubGenAuthPages(this.generatorType, this.system)));
95
90
  try {
96
91
  this.requiresAuth = await this.systemLookup.getSystemRequiresAuth(this.system);
97
92
  this.logger.log(`System ${this.system} requires authentication: ${this.requiresAuth}`);
@@ -112,20 +107,20 @@ class SubGeneratorWithAuthBase extends sub_gen_base_1.default {
112
107
  * @returns {Promise<Manifest>} The manifest.
113
108
  */
114
109
  async getManifest() {
115
- this.variant = await (0, adp_tooling_1.getVariant)(this.projectPath);
110
+ this.variant = await getVariant(this.projectPath);
116
111
  if (this.isCFProject) {
117
- this.manifestService = await adp_tooling_1.ManifestServiceCF.init(this.projectPath, this.logger);
112
+ this.manifestService = await ManifestServiceCF.init(this.projectPath, this.logger);
118
113
  }
119
114
  else {
120
115
  let requestOptions;
121
116
  if (this.requiresAuth) {
122
- const credentials = (await this.prompt((0, credentials_1.getCredentialsPrompts)(this.abapTarget, this.logger)));
117
+ const credentials = (await this.prompt(getCredentialsPrompts(this.abapTarget, this.logger)));
123
118
  requestOptions = { auth: { username: credentials.username, password: credentials.password } };
124
119
  }
125
- const yamlPath = node_path_1.default.join(this.projectPath, 'ui5.yaml');
126
- const { target, ignoreCertErrors = false } = await (0, adp_tooling_1.getAdpConfig)(this.projectPath, yamlPath);
127
- const provider = await (0, system_access_1.createAbapServiceProvider)(target, { ...requestOptions, ignoreCertErrors }, true, this.logger);
128
- this.manifestService = await adp_tooling_1.ManifestService.initMergedManifest(provider, this.projectPath, this.variant, this.logger);
120
+ const yamlPath = path.join(this.projectPath, 'ui5.yaml');
121
+ const { target, ignoreCertErrors = false } = await getAdpConfig(this.projectPath, yamlPath);
122
+ const provider = await createAbapServiceProvider(target, { ...requestOptions, ignoreCertErrors }, true, this.logger);
123
+ this.manifestService = await ManifestService.initMergedManifest(provider, this.projectPath, this.variant, this.logger);
129
124
  }
130
125
  const manifest = this.manifestService.getManifest();
131
126
  const oDataSources = this.manifestService.getManifestDataSources();
@@ -143,5 +138,4 @@ class SubGeneratorWithAuthBase extends sub_gen_base_1.default {
143
138
  return manifest;
144
139
  }
145
140
  }
146
- exports.default = SubGeneratorWithAuthBase;
147
141
  //# sourceMappingURL=sub-gen-auth-base.js.map
@@ -1,9 +1,8 @@
1
- import Generator = require('yeoman-generator');
2
- import type { Prompts } from '@sap-devx/yeoman-ui-types';
3
- import { AppWizard } from '@sap-devx/yeoman-ui-types';
1
+ import Generator from 'yeoman-generator';
2
+ import type { Prompts, AppWizard as AppWizardType } from '@sap-devx/yeoman-ui-types';
4
3
  import type { ToolsLogger } from '@sap-ux/logger';
5
- import type { GeneratorTypes } from '../types';
6
- import type { GeneratorOpts } from '../utils/opts';
4
+ import type { GeneratorTypes } from '../types.js';
5
+ import type { GeneratorOpts } from '../utils/opts.js';
7
6
  /**
8
7
  * Shared base class for all ADP generators.
9
8
  */
@@ -17,7 +16,7 @@ export default class SubGeneratorBase extends Generator {
17
16
  /**
18
17
  * Instance of the app wizard.
19
18
  */
20
- protected readonly appWizard: AppWizard;
19
+ protected readonly appWizard: AppWizardType;
21
20
  /**
22
21
  * The type of generator.
23
22
  */