@sap-ux/generator-adp 0.3.46 → 0.3.47

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.
@@ -0,0 +1,28 @@
1
+ import SubGeneratorWithAuthBase from '../base/sub-gen-auth-base';
2
+ import type { GeneratorOpts } from '../utils/opts';
3
+ /**
4
+ * Generator for adding annotations to OData services.
5
+ */
6
+ declare class AddAnnotationsToDataGenerator extends SubGeneratorWithAuthBase {
7
+ /**
8
+ * The answers from the prompts.
9
+ */
10
+ private answers;
11
+ /**
12
+ * The data sources from the manifest.
13
+ */
14
+ private dataSources;
15
+ /**
16
+ * Creates an instance of the generator.
17
+ *
18
+ * @param {string | string[]} args - The arguments passed to the generator.
19
+ * @param {GeneratorOpts} opts - The options for the generator.
20
+ */
21
+ constructor(args: string | string[], opts: GeneratorOpts);
22
+ initializing(): Promise<void>;
23
+ prompting(): Promise<void>;
24
+ writing(): Promise<void>;
25
+ end(): void;
26
+ }
27
+ export = AddAnnotationsToDataGenerator;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
6
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
7
+ const odata_service_writer_1 = require("@sap-ux/odata-service-writer");
8
+ const i18n_1 = require("../utils/i18n");
9
+ const types_1 = require("../types");
10
+ const sub_gen_auth_base_1 = __importDefault(require("../base/sub-gen-auth-base"));
11
+ /**
12
+ * Generator for adding annotations to OData services.
13
+ */
14
+ class AddAnnotationsToDataGenerator extends sub_gen_auth_base_1.default {
15
+ /**
16
+ * The answers from the prompts.
17
+ */
18
+ answers;
19
+ /**
20
+ * The data sources from the manifest.
21
+ */
22
+ dataSources;
23
+ /**
24
+ * Creates an instance of the generator.
25
+ *
26
+ * @param {string | string[]} args - The arguments passed to the generator.
27
+ * @param {GeneratorOpts} opts - The options for the generator.
28
+ */
29
+ constructor(args, opts) {
30
+ super(args, opts, types_1.GeneratorTypes.ADD_ANNOTATIONS_TO_DATA);
31
+ }
32
+ async initializing() {
33
+ await this.onInit();
34
+ }
35
+ async prompting() {
36
+ try {
37
+ const manifest = await this.getManifest();
38
+ this.dataSources = manifest?.['sap.app']?.dataSources ?? {};
39
+ this.answers = await this.prompt((0, adp_tooling_1.getPromptsForAddAnnotationsToOData)(this.projectPath, this.dataSources));
40
+ this.logger.log(`Current OData services\n${JSON.stringify(this.answers, null, 2)}`);
41
+ }
42
+ catch (e) {
43
+ await this.handleRuntimeCrash(e.message);
44
+ }
45
+ }
46
+ async writing() {
47
+ const changeData = {
48
+ variant: this.variant,
49
+ isCommand: true,
50
+ annotation: {
51
+ dataSource: this.answers.id,
52
+ filePath: this.answers.filePath,
53
+ serviceUrl: this.dataSources?.[this.answers.id]?.uri
54
+ }
55
+ };
56
+ if (!this.answers.filePath) {
57
+ const metadata = await this.manifestService.getDataSourceMetadata(this.answers.id);
58
+ changeData.annotation.namespaces = (0, odata_service_writer_1.getAnnotationNamespaces)({ metadata });
59
+ }
60
+ await (0, adp_tooling_1.generateChange)(this.projectPath, "appdescr_app_addAnnotationsToOData" /* ChangeType.ADD_ANNOTATIONS_TO_ODATA */, changeData, this.fs);
61
+ this.logger.log('Change written to changes folder');
62
+ if (this.answers.fileSelectOption === 2 /* AnnotationFileSelectType.NewEmptyFile */) {
63
+ this.appWizard.showInformation((0, i18n_1.t)('prompts.emptyAnnotationFile'), yeoman_ui_types_1.MessageType.notification);
64
+ }
65
+ }
66
+ end() {
67
+ this.logger.log('Successfully created annotation file!');
68
+ }
69
+ }
70
+ module.exports = AddAnnotationsToDataGenerator;
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,38 @@
1
+ import type { GeneratorOpts } from '../utils/opts';
2
+ import SubGeneratorBase from '../base/sub-gen-base';
3
+ /**
4
+ * Generator for adding component usages to a project.
5
+ */
6
+ declare class AddComponentUsagesGenerator extends SubGeneratorBase {
7
+ /**
8
+ * The answers from the prompts.
9
+ */
10
+ private answers;
11
+ /**
12
+ * The variant.
13
+ */
14
+ private variant;
15
+ /**
16
+ * The project path.
17
+ */
18
+ private readonly projectPath;
19
+ /**
20
+ * Creates an instance of the generator.
21
+ *
22
+ * @param {string | string[]} args - The arguments passed to the generator.
23
+ * @param {GeneratorOpts} opts - The options for the generator.
24
+ */
25
+ constructor(args: string | string[], opts: GeneratorOpts);
26
+ initializing(): Promise<void>;
27
+ prompting(): Promise<void>;
28
+ writing(): Promise<void>;
29
+ end(): void;
30
+ /**
31
+ * Creates the component usage data.
32
+ *
33
+ * @returns {ComponentUsagesData} The component usage data.
34
+ */
35
+ private _createComponentUsageData;
36
+ }
37
+ export = AddComponentUsagesGenerator;
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
6
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
7
+ const types_1 = require("../types");
8
+ const i18n_1 = require("../utils/i18n");
9
+ const sub_gen_base_1 = __importDefault(require("../base/sub-gen-base"));
10
+ /**
11
+ * Generator for adding component usages to a project.
12
+ */
13
+ class AddComponentUsagesGenerator extends sub_gen_base_1.default {
14
+ /**
15
+ * The answers from the prompts.
16
+ */
17
+ answers;
18
+ /**
19
+ * The variant.
20
+ */
21
+ variant;
22
+ /**
23
+ * The project path.
24
+ */
25
+ projectPath;
26
+ /**
27
+ * Creates an instance of the generator.
28
+ *
29
+ * @param {string | string[]} args - The arguments passed to the generator.
30
+ * @param {GeneratorOpts} opts - The options for the generator.
31
+ */
32
+ constructor(args, opts) {
33
+ super(args, opts, types_1.GeneratorTypes.ADD_COMPONENT_USAGES);
34
+ if (opts.data) {
35
+ this.projectPath = opts.data.path;
36
+ }
37
+ }
38
+ async initializing() {
39
+ await (0, i18n_1.initI18n)();
40
+ try {
41
+ this._registerPrompts(new yeoman_ui_types_1.Prompts([
42
+ {
43
+ name: (0, i18n_1.t)('yuiNavSteps.addComponentUsagesName'),
44
+ description: (0, i18n_1.t)('yuiNavSteps.addComponentUsagesDescr')
45
+ }
46
+ ]));
47
+ this.variant = await (0, adp_tooling_1.getVariant)(this.projectPath);
48
+ }
49
+ catch (e) {
50
+ this.appWizard.showError(e.message, yeoman_ui_types_1.MessageType.notification);
51
+ this.validationError = e;
52
+ this.logger.error(e);
53
+ }
54
+ }
55
+ async prompting() {
56
+ if (this.validationError) {
57
+ await this.handleRuntimeCrash(this.validationError.message);
58
+ return;
59
+ }
60
+ this.answers = await this.prompt((0, adp_tooling_1.getPromptsForAddComponentUsages)(this.projectPath, this.variant.layer));
61
+ this.logger.log(`Current answers\n${JSON.stringify(this.answers, null, 2)}`);
62
+ }
63
+ async writing() {
64
+ await (0, adp_tooling_1.generateChange)(this.projectPath, "appdescr_ui5_addComponentUsages" /* ChangeType.ADD_COMPONENT_USAGES */, this._createComponentUsageData(), this.fs);
65
+ this.logger.log(`Changes written to changes folder`);
66
+ }
67
+ end() {
68
+ this.logger.log('Successfully created change!');
69
+ }
70
+ /**
71
+ * Creates the component usage data.
72
+ *
73
+ * @returns {ComponentUsagesData} The component usage data.
74
+ */
75
+ _createComponentUsageData() {
76
+ const { usageId, data, settings, isLazy, name, shouldAddLibrary } = this.answers;
77
+ return {
78
+ variant: this.variant,
79
+ component: {
80
+ data,
81
+ usageId,
82
+ settings,
83
+ isLazy,
84
+ name
85
+ },
86
+ ...(shouldAddLibrary && {
87
+ library: {
88
+ reference: this.answers.library,
89
+ referenceIsLazy: this.answers.libraryIsLazy
90
+ }
91
+ })
92
+ };
93
+ }
94
+ }
95
+ module.exports = AddComponentUsagesGenerator;
96
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,38 @@
1
+ import type { GeneratorOpts } from '../utils/opts';
2
+ import SubGeneratorBase from '../base/sub-gen-base';
3
+ /**
4
+ * Generator for adding a new model to an OData service.
5
+ */
6
+ declare class AddNewModelGenerator extends SubGeneratorBase {
7
+ /**
8
+ * The answers from the prompts.
9
+ */
10
+ private answers;
11
+ /**
12
+ * The variant.
13
+ */
14
+ private variant;
15
+ /**
16
+ * The project path.
17
+ */
18
+ private readonly projectPath;
19
+ /**
20
+ * Creates an instance of the generator.
21
+ *
22
+ * @param {string | string[]} args - The arguments passed to the generator.
23
+ * @param {GeneratorOpts} opts - The options for the generator.
24
+ */
25
+ constructor(args: string | string[], opts: GeneratorOpts);
26
+ initializing(): Promise<void>;
27
+ prompting(): Promise<void>;
28
+ writing(): Promise<void>;
29
+ end(): void;
30
+ /**
31
+ * Creates the new model data.
32
+ *
33
+ * @returns {NewModelData} The new model data.
34
+ */
35
+ private _createNewModelData;
36
+ }
37
+ export = AddNewModelGenerator;
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
6
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
7
+ const types_1 = require("../types");
8
+ const i18n_1 = require("../utils/i18n");
9
+ const sub_gen_base_1 = __importDefault(require("../base/sub-gen-base"));
10
+ /**
11
+ * Generator for adding a new model to an OData service.
12
+ */
13
+ class AddNewModelGenerator extends sub_gen_base_1.default {
14
+ /**
15
+ * The answers from the prompts.
16
+ */
17
+ answers;
18
+ /**
19
+ * The variant.
20
+ */
21
+ variant;
22
+ /**
23
+ * The project path.
24
+ */
25
+ projectPath;
26
+ /**
27
+ * Creates an instance of the generator.
28
+ *
29
+ * @param {string | string[]} args - The arguments passed to the generator.
30
+ * @param {GeneratorOpts} opts - The options for the generator.
31
+ */
32
+ constructor(args, opts) {
33
+ super(args, opts, types_1.GeneratorTypes.ADD_NEW_MODEL);
34
+ if (opts.data) {
35
+ this.projectPath = opts.data.path;
36
+ }
37
+ }
38
+ async initializing() {
39
+ await (0, i18n_1.initI18n)();
40
+ try {
41
+ this._registerPrompts(new yeoman_ui_types_1.Prompts([
42
+ { name: (0, i18n_1.t)('yuiNavSteps.addNewModelName'), description: (0, i18n_1.t)('yuiNavSteps.addNewModelDescr') }
43
+ ]));
44
+ this.variant = await (0, adp_tooling_1.getVariant)(this.projectPath);
45
+ }
46
+ catch (e) {
47
+ this.appWizard.showError(e.message, yeoman_ui_types_1.MessageType.notification);
48
+ this.validationError = e;
49
+ this.logger.error(e);
50
+ }
51
+ }
52
+ async prompting() {
53
+ if (this.validationError) {
54
+ await this.handleRuntimeCrash(this.validationError.message);
55
+ return;
56
+ }
57
+ this.answers = await this.prompt((0, adp_tooling_1.getPromptsForNewModel)(this.projectPath, this.variant.layer));
58
+ this.logger.log(`Current answers\n${JSON.stringify(this.answers, null, 2)}`);
59
+ }
60
+ async writing() {
61
+ await (0, adp_tooling_1.generateChange)(this.projectPath, "appdescr_ui5_addNewModel" /* ChangeType.ADD_NEW_MODEL */, this._createNewModelData(), this.fs);
62
+ this.logger.log('Change written to changes folder');
63
+ }
64
+ end() {
65
+ this.logger.log('Successfully created change!');
66
+ }
67
+ /**
68
+ * Creates the new model data.
69
+ *
70
+ * @returns {NewModelData} The new model data.
71
+ */
72
+ _createNewModelData() {
73
+ const { name, uri, modelName, version, modelSettings, addAnnotationMode } = this.answers;
74
+ return {
75
+ variant: this.variant,
76
+ service: {
77
+ name,
78
+ uri,
79
+ modelName,
80
+ version,
81
+ modelSettings
82
+ },
83
+ ...(addAnnotationMode && {
84
+ annotation: {
85
+ dataSourceName: this.answers.dataSourceName,
86
+ dataSourceURI: this.answers.dataSourceURI,
87
+ settings: this.answers.annotationSettings
88
+ }
89
+ })
90
+ };
91
+ }
92
+ }
93
+ module.exports = AddNewModelGenerator;
94
+ //# sourceMappingURL=index.js.map
@@ -25,6 +25,7 @@ const appWizardCache_1 = require("../utils/appWizardCache");
25
25
  const default_values_1 = require("./questions/helper/default-values");
26
26
  const steps_1 = require("../utils/steps");
27
27
  const workspace_1 = require("../utils/workspace");
28
+ const generatorTitle = 'Adaptation Project';
28
29
  /**
29
30
  * Generator for creating an Adaptation Project.
30
31
  *
@@ -117,7 +118,7 @@ class default_1 extends yeoman_generator_1.default {
117
118
  this.env.lookup({
118
119
  packagePatterns: ['@sap/generator-fiori', '@sap-ux/adp-flp-config-sub-generator']
119
120
  });
120
- (0, opts_1.setHeaderTitle)(opts, this.logger);
121
+ (0, opts_1.setHeaderTitle)(opts, this.logger, generatorTitle);
121
122
  (0, appWizardCache_1.initCache)(this.logger, this.appWizard);
122
123
  this.prompts = new yeoman_ui_types_1.Prompts([]);
123
124
  this.setPromptsCallback = (fn) => {
@@ -0,0 +1,13 @@
1
+ import type { ToolsLogger } from '@sap-ux/logger';
2
+ import type { AbapTarget } from '@sap-ux/system-access';
3
+ import type { YUIQuestion } from '@sap-ux/inquirer-common';
4
+ import type { Credentials } from '../../types';
5
+ /**
6
+ * Returns the username prompt.
7
+ *
8
+ * @param {AbapTarget} abapTarget - The ABAP target.
9
+ * @param {ToolsLogger} logger - The logger.
10
+ * @returns {YUIQuestion<Credentials>[]} The username prompt.
11
+ */
12
+ export declare function getCredentialsPrompts(abapTarget: AbapTarget, logger: ToolsLogger): YUIQuestion<Credentials>[];
13
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1,78 @@
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");
9
+ /**
10
+ * Returns the username prompt.
11
+ *
12
+ * @param {AbapTarget} abapTarget - The ABAP target.
13
+ * @param {ToolsLogger} logger - The logger.
14
+ * @returns {YUIQuestion<Credentials>[]} The username prompt.
15
+ */
16
+ function getCredentialsPrompts(abapTarget, logger) {
17
+ return [getUsernamePrompt(), getPasswordPrompt(abapTarget, logger)];
18
+ }
19
+ /**
20
+ * Returns the username prompt.
21
+ *
22
+ * @returns {InputQuestion<Credentials>} The username prompt.
23
+ */
24
+ function getUsernamePrompt() {
25
+ return {
26
+ type: 'input',
27
+ name: types_1.configPromptNames.username,
28
+ message: (0, i18n_1.t)('prompts.usernameLabel'),
29
+ validate: project_input_validator_1.validateEmptyString,
30
+ guiOptions: {
31
+ mandatory: true
32
+ }
33
+ };
34
+ }
35
+ /**
36
+ * Returns the password prompt.
37
+ *
38
+ * @param {AbapTarget} abapTarget - The ABAP target.
39
+ * @param {ToolsLogger} logger - The logger.
40
+ * @returns {PasswordQuestion<Credentials>} The password prompt.
41
+ */
42
+ function getPasswordPrompt(abapTarget, logger) {
43
+ const system = ((0, btp_utils_1.isAppStudio)() ? abapTarget.destination : abapTarget.url) ?? '';
44
+ return {
45
+ type: 'password',
46
+ name: types_1.configPromptNames.password,
47
+ message: (0, i18n_1.t)('prompts.passwordLabel'),
48
+ mask: '*',
49
+ guiOptions: {
50
+ mandatory: true,
51
+ type: 'login'
52
+ },
53
+ validate: async (value, answers) => {
54
+ const validationResult = (0, project_input_validator_1.validateEmptyString)(value);
55
+ if (typeof validationResult === 'string') {
56
+ return validationResult;
57
+ }
58
+ if (!answers.username) {
59
+ return (0, i18n_1.t)('error.pleaseProvideAllRequiredData');
60
+ }
61
+ try {
62
+ const options = {
63
+ system,
64
+ client: abapTarget.client ?? '',
65
+ username: answers.username,
66
+ password: value
67
+ };
68
+ const abapProvider = await (0, adp_tooling_1.getConfiguredProvider)(options, logger);
69
+ await (0, adp_tooling_1.getSystemUI5Version)(abapProvider);
70
+ return true;
71
+ }
72
+ catch (e) {
73
+ return e.response ? `Login failed: ${e.response.status} ${e.response.statusText}` : 'Login failed.';
74
+ }
75
+ }
76
+ };
77
+ }
78
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1,70 @@
1
+ import type { Manifest } from '@sap-ux/project-access';
2
+ import { type AbapTarget } from '@sap-ux/system-access';
3
+ import type { DescriptorVariant } from '@sap-ux/adp-tooling';
4
+ import { ManifestService, 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';
8
+ /**
9
+ * Base class for *sub* generators that need authentication handling.
10
+ * Adds functionality on top of {@link SubGeneratorBase}.
11
+ */
12
+ export default class SubGeneratorWithAuthBase extends SubGeneratorBase {
13
+ /**
14
+ * The ABAP target.
15
+ */
16
+ protected abapTarget: AbapTarget;
17
+ /**
18
+ * The project data.
19
+ */
20
+ protected system: string;
21
+ /**
22
+ * The project path.
23
+ */
24
+ protected readonly projectPath: string;
25
+ /**
26
+ * The type of generator.
27
+ */
28
+ protected readonly generatorType: GeneratorTypes;
29
+ /**
30
+ * The manifest service.
31
+ */
32
+ manifestService: ManifestService;
33
+ /**
34
+ * Whether the generator requires authentication.
35
+ */
36
+ protected requiresAuth: boolean;
37
+ /**
38
+ * The descriptor variant.
39
+ */
40
+ protected variant: DescriptorVariant;
41
+ /**
42
+ * The system lookup instance.
43
+ */
44
+ protected systemLookup: SystemLookup;
45
+ /**
46
+ * The VSCode instance.
47
+ */
48
+ private readonly vscode;
49
+ /**
50
+ * Creates an instance of the generator.
51
+ *
52
+ * @param {string | string[]} args - The arguments passed to the generator.
53
+ * @param {Generator.GeneratorOptions} opts - The options for the generator.
54
+ * @param {GeneratorTypes} type - The type of generator.
55
+ */
56
+ constructor(args: string | string[], opts: GeneratorOpts, type: GeneratorTypes);
57
+ /**
58
+ * Executes logic that should happen during Yeoman's `initializing` phase.
59
+ * Subclasses must call this to benefit from the built-in auth handling.
60
+ */
61
+ protected onInit(): Promise<void>;
62
+ /**
63
+ * Retrieves and parses the manifest (app descriptor) of the current project.
64
+ * Requests credentials when required by the destination system.
65
+ *
66
+ * @returns {Promise<Manifest>} The manifest.
67
+ */
68
+ protected getManifest(): Promise<Manifest>;
69
+ }
70
+ //# sourceMappingURL=sub-gen-auth-base.d.ts.map
@@ -0,0 +1,144 @@
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 path_1 = __importDefault(require("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");
15
+ /**
16
+ * Base class for *sub* generators that need authentication handling.
17
+ * Adds functionality on top of {@link SubGeneratorBase}.
18
+ */
19
+ class SubGeneratorWithAuthBase extends sub_gen_base_1.default {
20
+ /**
21
+ * The ABAP target.
22
+ */
23
+ abapTarget;
24
+ /**
25
+ * The project data.
26
+ */
27
+ system;
28
+ /**
29
+ * The project path.
30
+ */
31
+ projectPath;
32
+ /**
33
+ * The type of generator.
34
+ */
35
+ generatorType;
36
+ /**
37
+ * The manifest service.
38
+ */
39
+ manifestService;
40
+ /**
41
+ * Whether the generator requires authentication.
42
+ */
43
+ requiresAuth = false;
44
+ /**
45
+ * The descriptor variant.
46
+ */
47
+ variant;
48
+ /**
49
+ * The system lookup instance.
50
+ */
51
+ systemLookup;
52
+ /**
53
+ * The VSCode instance.
54
+ */
55
+ vscode;
56
+ /**
57
+ * Creates an instance of the generator.
58
+ *
59
+ * @param {string | string[]} args - The arguments passed to the generator.
60
+ * @param {Generator.GeneratorOptions} opts - The options for the generator.
61
+ * @param {GeneratorTypes} type - The type of generator.
62
+ */
63
+ constructor(args, opts, type) {
64
+ super(args, opts, type);
65
+ this.generatorType = type;
66
+ try {
67
+ if (opts.data) {
68
+ this.projectPath = opts.data.path;
69
+ }
70
+ this.vscode = opts.vscode;
71
+ }
72
+ catch (e) {
73
+ this.validationError = e;
74
+ }
75
+ }
76
+ /**
77
+ * Executes logic that should happen during Yeoman's `initializing` phase.
78
+ * Subclasses must call this to benefit from the built-in auth handling.
79
+ */
80
+ async onInit() {
81
+ await (0, i18n_1.initI18n)();
82
+ if (this.validationError) {
83
+ this._registerPrompts(new yeoman_ui_types_1.Prompts((0, steps_1.getSubGenErrorPage)(this.generatorType)));
84
+ }
85
+ else {
86
+ this._registerPrompts(new yeoman_ui_types_1.Prompts((0, steps_1.getSubGenAuthPages)(this.generatorType, this.system)));
87
+ }
88
+ this.systemLookup = new adp_tooling_1.SystemLookup(this.logger);
89
+ const adpConfig = await (0, adp_tooling_1.getAdpConfig)(this.projectPath, path_1.default.join(this.projectPath, 'ui5.yaml'));
90
+ this.abapTarget = adpConfig.target;
91
+ this.system = ((0, btp_utils_1.isAppStudio)() ? this.abapTarget.destination : this.abapTarget.url) ?? '';
92
+ this.logger.log(`Successfully retrieved abap target\n${JSON.stringify(this.abapTarget, null, 2)}`);
93
+ if (this.validationError) {
94
+ this.appWizard.showError(this.validationError.message, yeoman_ui_types_1.MessageType.notification);
95
+ await this.handleRuntimeCrash(this.validationError.message);
96
+ return;
97
+ }
98
+ try {
99
+ this.requiresAuth = await this.systemLookup.getSystemRequiresAuth(this.system);
100
+ this.logger.log(`System ${this.system} requires authentication: ${this.requiresAuth}`);
101
+ if (!this.requiresAuth) {
102
+ // Remove the credential page when authentication is not required
103
+ this.prompts.splice(0, 1, []);
104
+ }
105
+ }
106
+ catch (error) {
107
+ await this.handleRuntimeCrash(error.message);
108
+ }
109
+ }
110
+ /**
111
+ * Retrieves and parses the manifest (app descriptor) of the current project.
112
+ * Requests credentials when required by the destination system.
113
+ *
114
+ * @returns {Promise<Manifest>} The manifest.
115
+ */
116
+ async getManifest() {
117
+ let requestOptions;
118
+ if (this.requiresAuth) {
119
+ const credentials = (await this.prompt((0, credentials_1.getCredentialsPrompts)(this.abapTarget, this.logger)));
120
+ requestOptions = { auth: { username: credentials.username, password: credentials.password } };
121
+ }
122
+ this.variant = await (0, adp_tooling_1.getVariant)(this.projectPath);
123
+ const yamlPath = path_1.default.join(this.projectPath, 'ui5.yaml');
124
+ const { target, ignoreCertErrors = false } = await (0, adp_tooling_1.getAdpConfig)(this.projectPath, yamlPath);
125
+ const provider = await (0, system_access_1.createAbapServiceProvider)(target, { ...requestOptions, ignoreCertErrors }, true, this.logger);
126
+ this.manifestService = await adp_tooling_1.ManifestService.initMergedManifest(provider, this.projectPath, this.variant, this.logger);
127
+ const manifest = this.manifestService.getManifest();
128
+ const oDataSources = this.manifestService.getManifestDataSources();
129
+ this.logger.log(`OData sources from manifest\n${JSON.stringify(oDataSources, null, 2)}`);
130
+ const oDataTargetSources = Object.entries(oDataSources ?? {})
131
+ .filter((source) => source[1]?.type === 'OData')
132
+ .map((source) => {
133
+ return {
134
+ dataSourceName: source[0],
135
+ uri: source[1]?.uri,
136
+ annotations: source[1]?.settings?.annotations ?? []
137
+ };
138
+ });
139
+ this.logger.log(`OData target sources\n${JSON.stringify(oDataTargetSources, null, 2)}`);
140
+ return manifest;
141
+ }
142
+ }
143
+ exports.default = SubGeneratorWithAuthBase;
144
+ //# sourceMappingURL=sub-gen-auth-base.js.map
@@ -0,0 +1,67 @@
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';
4
+ import type { ToolsLogger } from '@sap-ux/logger';
5
+ import type { GeneratorTypes } from '../types';
6
+ import type { GeneratorOpts } from '../utils/opts';
7
+ /**
8
+ * Shared base class for all ADP generators.
9
+ */
10
+ export default class SubGeneratorBase extends Generator {
11
+ setPromptsCallback: (fn: any) => void;
12
+ prompts: Prompts;
13
+ /**
14
+ * Instance of the logger.
15
+ */
16
+ logger: ToolsLogger;
17
+ /**
18
+ * Instance of the app wizard.
19
+ */
20
+ protected readonly appWizard: AppWizard;
21
+ /**
22
+ * The type of generator.
23
+ */
24
+ protected readonly type: GeneratorTypes;
25
+ /**
26
+ * Captures validation errors occurring during construction so they can be surfaced later.
27
+ */
28
+ protected validationError: Error | undefined;
29
+ /**
30
+ * Stores a callback provided by Yeoman-UI when the <Prompts> instance is not
31
+ * yet created. This ensures the callback is attached once the prompts are
32
+ * available (e.g. after async i18n or system look-ups).
33
+ */
34
+ private pendingPromptsCallback?;
35
+ /**
36
+ * Creates an instance of the generator.
37
+ *
38
+ * @param {string | string[]} args - The arguments passed to the generator.
39
+ * @param {Generator.GeneratorOptions} opts - The options for the generator.
40
+ * @param {GeneratorTypes} type - The type of generator.
41
+ */
42
+ constructor(args: string | string[], opts: GeneratorOpts, type: GeneratorTypes);
43
+ /**
44
+ * Helper to create/update the prompts instance. Any pending Yeoman-UI
45
+ * callback that arrived before prompts existed will automatically be
46
+ * attached.
47
+ *
48
+ * @param {Prompts} prompts The newly created Prompts instance.
49
+ */
50
+ protected _registerPrompts(prompts: Prompts): void;
51
+ /**
52
+ * Centralized error handler that ensures resources are cleaned up and a helpful
53
+ * error prompt is shown to the user.
54
+ *
55
+ * @param {string} errorMessage - Human-readable error message.
56
+ * @returns {Promise<void>} A promise that resolves when the error is handled.
57
+ */
58
+ protected handleRuntimeCrash(errorMessage: string): Promise<void>;
59
+ /**
60
+ * Builds a Yeoman question that simply displays the error message and blocks the wizard.
61
+ *
62
+ * @param {string} errorMessage - Human-readable error message.
63
+ * @returns {YUIQuestion<InputQuestion>} The Yeoman question that displays the error message.
64
+ */
65
+ private _getErrorMessagePrompt;
66
+ }
67
+ //# sourceMappingURL=sub-gen-base.d.ts.map
@@ -0,0 +1,104 @@
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 Generator = require("yeoman-generator");
7
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
8
+ const i18n_1 = require("../utils/i18n");
9
+ const opts_1 = require("../utils/opts");
10
+ const logger_1 = __importDefault(require("../utils/logger"));
11
+ /**
12
+ * Shared base class for all ADP generators.
13
+ */
14
+ class SubGeneratorBase extends Generator {
15
+ setPromptsCallback;
16
+ prompts;
17
+ /**
18
+ * Instance of the logger.
19
+ */
20
+ logger;
21
+ /**
22
+ * Instance of the app wizard.
23
+ */
24
+ appWizard;
25
+ /**
26
+ * The type of generator.
27
+ */
28
+ type;
29
+ /**
30
+ * Captures validation errors occurring during construction so they can be surfaced later.
31
+ */
32
+ validationError;
33
+ /**
34
+ * Stores a callback provided by Yeoman-UI when the <Prompts> instance is not
35
+ * yet created. This ensures the callback is attached once the prompts are
36
+ * available (e.g. after async i18n or system look-ups).
37
+ */
38
+ pendingPromptsCallback;
39
+ /**
40
+ * Creates an instance of the generator.
41
+ *
42
+ * @param {string | string[]} args - The arguments passed to the generator.
43
+ * @param {Generator.GeneratorOptions} opts - The options for the generator.
44
+ * @param {GeneratorTypes} type - The type of generator.
45
+ */
46
+ constructor(args, opts, type) {
47
+ super(args, opts);
48
+ this.type = type;
49
+ this.appWizard = opts.appWizard ?? yeoman_ui_types_1.AppWizard.create(opts);
50
+ logger_1.default.configureLogging(this.options.logger, this.rootGeneratorName(), this.log, this.options.vscode, this.options.logLevel, this.options.logWrapper);
51
+ this.logger = logger_1.default.logger;
52
+ (0, opts_1.setHeaderTitle)(opts, this.logger, this.type);
53
+ this.setPromptsCallback = (fn) => {
54
+ // Persist callback so we can attach it once prompts are created
55
+ this.pendingPromptsCallback = fn;
56
+ if (this.prompts) {
57
+ this.prompts.setCallback(fn);
58
+ }
59
+ };
60
+ }
61
+ /**
62
+ * Helper to create/update the prompts instance. Any pending Yeoman-UI
63
+ * callback that arrived before prompts existed will automatically be
64
+ * attached.
65
+ *
66
+ * @param {Prompts} prompts The newly created Prompts instance.
67
+ */
68
+ _registerPrompts(prompts) {
69
+ this.prompts = prompts;
70
+ if (this.pendingPromptsCallback) {
71
+ this.prompts.setCallback(this.pendingPromptsCallback);
72
+ }
73
+ }
74
+ /**
75
+ * Centralized error handler that ensures resources are cleaned up and a helpful
76
+ * error prompt is shown to the user.
77
+ *
78
+ * @param {string} errorMessage - Human-readable error message.
79
+ * @returns {Promise<void>} A promise that resolves when the error is handled.
80
+ */
81
+ async handleRuntimeCrash(errorMessage) {
82
+ await this.prompt([this._getErrorMessagePrompt(errorMessage)]);
83
+ }
84
+ /**
85
+ * Builds a Yeoman question that simply displays the error message and blocks the wizard.
86
+ *
87
+ * @param {string} errorMessage - Human-readable error message.
88
+ * @returns {YUIQuestion<InputQuestion>} The Yeoman question that displays the error message.
89
+ */
90
+ _getErrorMessagePrompt(errorMessage) {
91
+ return {
92
+ type: 'input',
93
+ name: 'errorMessagePrompt',
94
+ message: (0, i18n_1.t)('error.backendCommunicationError'),
95
+ guiOptions: {
96
+ type: 'label',
97
+ hint: errorMessage
98
+ },
99
+ validate: () => false // Always keep the wizard on this page
100
+ };
101
+ }
102
+ }
103
+ exports.default = SubGeneratorBase;
104
+ //# sourceMappingURL=sub-gen-base.js.map
@@ -0,0 +1,28 @@
1
+ import type { GeneratorOpts } from '../utils/opts';
2
+ import SubGeneratorWithAuthBase from '../base/sub-gen-auth-base';
3
+ /**
4
+ * Generator for changing the data source of an OData service.
5
+ */
6
+ declare class OdataServiceGenerator extends SubGeneratorWithAuthBase {
7
+ /**
8
+ * The answers for the generator.
9
+ */
10
+ private answers;
11
+ /**
12
+ * The data sources from the manifest.
13
+ */
14
+ private dataSources;
15
+ /**
16
+ * Constructor for the OdataServiceGenerator.
17
+ *
18
+ * @param {string | string[]} args - The arguments for the generator.
19
+ * @param {GeneratorOpts} opts - The options for the generator.
20
+ */
21
+ constructor(args: string | string[], opts: GeneratorOpts);
22
+ initializing(): Promise<void>;
23
+ prompting(): Promise<void>;
24
+ writing(): Promise<void>;
25
+ end(): void;
26
+ }
27
+ export = OdataServiceGenerator;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
6
+ const types_1 = require("../types");
7
+ const sub_gen_auth_base_1 = __importDefault(require("../base/sub-gen-auth-base"));
8
+ /**
9
+ * Generator for changing the data source of an OData service.
10
+ */
11
+ class OdataServiceGenerator extends sub_gen_auth_base_1.default {
12
+ /**
13
+ * The answers for the generator.
14
+ */
15
+ answers;
16
+ /**
17
+ * The data sources from the manifest.
18
+ */
19
+ dataSources;
20
+ /**
21
+ * Constructor for the OdataServiceGenerator.
22
+ *
23
+ * @param {string | string[]} args - The arguments for the generator.
24
+ * @param {GeneratorOpts} opts - The options for the generator.
25
+ */
26
+ constructor(args, opts) {
27
+ super(args, opts, types_1.GeneratorTypes.CHANGE_DATA_SOURCE);
28
+ }
29
+ async initializing() {
30
+ await this.onInit();
31
+ }
32
+ async prompting() {
33
+ try {
34
+ const manifest = await this.getManifest();
35
+ this.dataSources = manifest?.['sap.app']?.dataSources ?? {};
36
+ this.answers = await this.prompt((0, adp_tooling_1.getPromptsForChangeDataSource)(this.dataSources));
37
+ this.logger.log(`Current OData services\n${JSON.stringify(this.answers, null, 2)}`);
38
+ }
39
+ catch (error) {
40
+ await this.handleRuntimeCrash(error.message);
41
+ }
42
+ }
43
+ async writing() {
44
+ await (0, adp_tooling_1.generateChange)(this.projectPath, "appdescr_app_changeDataSource" /* ChangeType.CHANGE_DATA_SOURCE */, {
45
+ variant: this.variant,
46
+ dataSources: this.dataSources,
47
+ service: this.answers
48
+ }, this.fs);
49
+ this.logger.log('Change written to changes folder');
50
+ }
51
+ end() {
52
+ this.logger.log('Successfully created OData Change!');
53
+ }
54
+ }
55
+ module.exports = OdataServiceGenerator;
56
+ //# sourceMappingURL=index.js.map
@@ -7,7 +7,15 @@
7
7
  "flpConfigName": "SAP Fiori Launchpad Configuration",
8
8
  "tileSettingsName": "SAP Fiori Launchpad Configuration - Tile Settings for {{- projectName}}",
9
9
  "deployConfigName": "Deployment Configuration",
10
- "deployConfigDescr": "Configure deployment settings."
10
+ "deployConfigDescr": "Configure deployment settings.",
11
+ "addComponentUsagesName": "Add SAPUI5 Component Usages",
12
+ "addComponentUsagesDescr": "Select SAPUI5 component usages.",
13
+ "addNewModelName": "Add OData Service and SAPUI5 Model",
14
+ "addNewModelDescr": "Select an OData service and SAPUI5 model.",
15
+ "addLocalAnnotationFileName": "Add Local Annotation File",
16
+ "addLocalAnnotationFileDescr": "Select an OData service and annotation XML file.",
17
+ "replaceODataServiceName": "Replace OData Service",
18
+ "replaceODataServiceDescr": "Select an OData service and new OData URI."
11
19
  },
12
20
  "prompts": {
13
21
  "systemLabel": "System",
@@ -47,7 +55,8 @@
47
55
  "projectNameValidationErrorExt": "The name must only contain Latin alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",
48
56
  "projectNameLengthErrorInt": "The name cannot start with the word 'customer', contain more than 61 characters, or end with the word 'component'.",
49
57
  "projectNameValidationErrorInt": "The name must only contain Latin alphanumeric characters and it must have at least two parts. Every part must start with a letter and the different parts must be separated by a period.",
50
- "projectNotInWorkspace": "The project: '{{- path}}' is not in the workspace. Some adaptation project tools may not work. What do you want to do?"
58
+ "projectNotInWorkspace": "The project: '{{- path}}' is not in the workspace. Some adaptation project tools may not work. What do you want to do?",
59
+ "emptyAnnotationFile": "An empty annotation file will be created in the webapp/changes/annotations folder of your project."
51
60
  },
52
61
  "error": {
53
62
  "selectCannotBeEmptyError": "The {{value}} has to be selected.",
@@ -65,7 +74,9 @@
65
74
  "creatingExtensionProjectError": "Creating the extension project failed. To see the error, view the logs.",
66
75
  "appParameterMissing": "Could not create an extension project because the application parameters are missing. Please select a different application.",
67
76
  "destinationInfoMissing": "Could not create an extension project because the destination info is missing. Please select a different system.",
68
- "systemNotFound": "System not found or not supported: {{system}}. Please check the system exists.",
69
- "applicationNotFound": "Application not found or not supported: {{appName}}. Please check the application exists."
77
+ "systemNotFound": "System could not be found or is not supported: {{system}}. Please check the system exists.",
78
+ "applicationNotFound": "The application could not be found or is not supported: {{appName}}. Please check the application exists.",
79
+ "backendCommunicationError": "An error occurred when communicating with the back end. Please try again later.",
80
+ "pleaseProvideAllRequiredData": "Please provide the required data and try again."
70
81
  }
71
82
  }
@@ -0,0 +1,11 @@
1
+ export declare enum GeneratorTypes {
2
+ ADD_ANNOTATIONS_TO_DATA = "Add Local Annotation File",
3
+ ADD_COMPONENT_USAGES = "Add SAPUI5 Component Usages",
4
+ ADD_NEW_MODEL = "Add OData Service And SAPUI5 Model",
5
+ CHANGE_DATA_SOURCE = "Replace OData Service"
6
+ }
7
+ export interface Credentials {
8
+ username: string;
9
+ password: string;
10
+ }
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeneratorTypes = void 0;
4
+ var GeneratorTypes;
5
+ (function (GeneratorTypes) {
6
+ GeneratorTypes["ADD_ANNOTATIONS_TO_DATA"] = "Add Local Annotation File";
7
+ GeneratorTypes["ADD_COMPONENT_USAGES"] = "Add SAPUI5 Component Usages";
8
+ GeneratorTypes["ADD_NEW_MODEL"] = "Add OData Service And SAPUI5 Model";
9
+ GeneratorTypes["CHANGE_DATA_SOURCE"] = "Replace OData Service";
10
+ })(GeneratorTypes || (exports.GeneratorTypes = GeneratorTypes = {}));
11
+ //# sourceMappingURL=types.js.map
@@ -1,11 +1,19 @@
1
+ import type { AppWizard } from '@sap-devx/yeoman-ui-types';
1
2
  import type { ToolsLogger } from '@sap-ux/logger';
2
- import type { AdpGeneratorOptions } from '../app/types';
3
+ export interface GeneratorOpts {
4
+ appWizard?: AppWizard;
5
+ vscode?: any;
6
+ data?: {
7
+ path: string;
8
+ };
9
+ }
3
10
  /**
4
- * Sets the header title in the AppWizard UI, if the `setHeaderTitle` method is available.
5
- * This helps users identify the generator and its version in the Yeoman UI interface.
11
+ * Sets a custom header title in the AppWizard UI, if the `setHeaderTitle` method is available.
12
+ * This allows generators to specify their own display name while keeping the version information.
6
13
  *
7
- * @param {AdpGeneratorOptions} opts - The generator options, potentially including the AppWizard instance.
8
- * @param {IChildLogger} logger - Logger instance used for logging any errors that occur during execution.
14
+ * @param {GeneratorOpts} opts - The generator options, potentially including the AppWizard instance.
15
+ * @param {ToolsLogger} logger - Logger instance used for logging any errors that occur during execution.
16
+ * @param {string} customTitle - Optional custom title to display instead of the package name.
9
17
  */
10
- export declare function setHeaderTitle(opts: AdpGeneratorOptions, logger: ToolsLogger): void;
18
+ export declare function setHeaderTitle(opts: GeneratorOpts, logger: ToolsLogger, customTitle?: string): void;
11
19
  //# sourceMappingURL=opts.d.ts.map
@@ -3,18 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setHeaderTitle = setHeaderTitle;
4
4
  const deps_1 = require("./deps");
5
5
  /**
6
- * Sets the header title in the AppWizard UI, if the `setHeaderTitle` method is available.
7
- * This helps users identify the generator and its version in the Yeoman UI interface.
6
+ * Sets a custom header title in the AppWizard UI, if the `setHeaderTitle` method is available.
7
+ * This allows generators to specify their own display name while keeping the version information.
8
8
  *
9
- * @param {AdpGeneratorOptions} opts - The generator options, potentially including the AppWizard instance.
10
- * @param {IChildLogger} logger - Logger instance used for logging any errors that occur during execution.
9
+ * @param {GeneratorOpts} opts - The generator options, potentially including the AppWizard instance.
10
+ * @param {ToolsLogger} logger - Logger instance used for logging any errors that occur during execution.
11
+ * @param {string} customTitle - Optional custom title to display instead of the package name.
11
12
  */
12
- function setHeaderTitle(opts, logger) {
13
+ function setHeaderTitle(opts, logger, customTitle) {
13
14
  try {
14
15
  if (typeof opts?.appWizard?.setHeaderTitle === 'function') {
15
16
  const { name = '', version = '', displayName = '' } = (0, deps_1.getPackageInfo)();
16
17
  if (name && version) {
17
- opts.appWizard.setHeaderTitle(displayName || name, `${name}@${version}`);
18
+ const headerTitle = customTitle ?? (displayName || name);
19
+ opts.appWizard.setHeaderTitle(headerTitle, `${name}@${version}`);
18
20
  }
19
21
  }
20
22
  }
@@ -1,4 +1,5 @@
1
1
  import type { Prompts as YeomanUiSteps, IPrompt } from '@sap-devx/yeoman-ui-types';
2
+ import { GeneratorTypes } from '../types';
2
3
  /**
3
4
  * Returns the list of base wizard pages used in the Adaptation Project.
4
5
  *
@@ -44,4 +45,22 @@ export declare function getDeployPage(): IPrompt;
44
45
  * @param {boolean} [shouldAdd] - Whether to add (`true`) or remove (`false`) the step.
45
46
  */
46
47
  export declare function updateWizardSteps(prompts: YeomanUiSteps, step: IPrompt, insertAfter?: string, shouldAdd?: boolean): void;
48
+ /**
49
+ * Returns the error page for the given sub generator type.
50
+ *
51
+ * @param {GeneratorTypes} subGenType - The type of sub generator.
52
+ * @returns {IPrompt[]} The error page for the given sub generator type.
53
+ */
54
+ export declare function getSubGenErrorPage(subGenType: GeneratorTypes): IPrompt[];
55
+ /**
56
+ * Returns the wizard pages for sub-generators that may trigger an ABAP login step.
57
+ *
58
+ * Depending on the destination system's authentication requirements, a
59
+ * credentials page can be shown before the business-specific page.
60
+ *
61
+ * @param {GeneratorTypes} type - The sub-generator type requesting pages.
62
+ * @param {string} destination - ID of the destination system (used only for UI text).
63
+ * @returns {IPrompt[]} The page definitions consumed by Yeoman-UI <Prompts>.
64
+ */
65
+ export declare function getSubGenAuthPages(type: GeneratorTypes, destination: string): IPrompt[];
47
66
  //# sourceMappingURL=steps.d.ts.map
@@ -5,7 +5,10 @@ exports.getFlpPages = getFlpPages;
5
5
  exports.updateFlpWizardSteps = updateFlpWizardSteps;
6
6
  exports.getDeployPage = getDeployPage;
7
7
  exports.updateWizardSteps = updateWizardSteps;
8
+ exports.getSubGenErrorPage = getSubGenErrorPage;
9
+ exports.getSubGenAuthPages = getSubGenAuthPages;
8
10
  const i18n_1 = require("./i18n");
11
+ const types_1 = require("../types");
9
12
  /**
10
13
  * Returns the list of base wizard pages used in the Adaptation Project.
11
14
  *
@@ -108,4 +111,56 @@ function updateWizardSteps(prompts, step, insertAfter = '', shouldAdd = true) {
108
111
  prompts.splice(existingIdx, 1, []);
109
112
  }
110
113
  }
114
+ /**
115
+ * Returns the error page for the given sub generator type.
116
+ *
117
+ * @param {GeneratorTypes} subGenType - The type of sub generator.
118
+ * @returns {IPrompt[]} The error page for the given sub generator type.
119
+ */
120
+ function getSubGenErrorPage(subGenType) {
121
+ switch (subGenType) {
122
+ case types_1.GeneratorTypes.ADD_ANNOTATIONS_TO_DATA:
123
+ return [{ name: (0, i18n_1.t)('yuiNavSteps.addLocalAnnotationFileName'), description: '' }];
124
+ case types_1.GeneratorTypes.CHANGE_DATA_SOURCE:
125
+ return [{ name: (0, i18n_1.t)('yuiNavSteps.replaceODataServiceName'), description: '' }];
126
+ default:
127
+ return [];
128
+ }
129
+ }
130
+ /**
131
+ * Returns the wizard pages for sub-generators that may trigger an ABAP login step.
132
+ *
133
+ * Depending on the destination system's authentication requirements, a
134
+ * credentials page can be shown before the business-specific page.
135
+ *
136
+ * @param {GeneratorTypes} type - The sub-generator type requesting pages.
137
+ * @param {string} destination - ID of the destination system (used only for UI text).
138
+ * @returns {IPrompt[]} The page definitions consumed by Yeoman-UI <Prompts>.
139
+ */
140
+ function getSubGenAuthPages(type, destination) {
141
+ const getCredentialsPageProps = (nameBase) => ({
142
+ name: `${nameBase} - Credentials`,
143
+ description: `Enter credentials for your adaptation project's system (${destination})`
144
+ });
145
+ switch (type) {
146
+ case types_1.GeneratorTypes.ADD_ANNOTATIONS_TO_DATA:
147
+ return [
148
+ getCredentialsPageProps((0, i18n_1.t)('yuiNavSteps.addLocalAnnotationFileName')),
149
+ {
150
+ name: (0, i18n_1.t)('yuiNavSteps.addLocalAnnotationFileName'),
151
+ description: (0, i18n_1.t)('yuiNavSteps.addLocalAnnotationFileDescr')
152
+ }
153
+ ];
154
+ case types_1.GeneratorTypes.CHANGE_DATA_SOURCE:
155
+ return [
156
+ getCredentialsPageProps((0, i18n_1.t)('yuiNavSteps.replaceODataServiceName')),
157
+ {
158
+ name: (0, i18n_1.t)('yuiNavSteps.replaceODataServiceName'),
159
+ description: (0, i18n_1.t)('yuiNavSteps.replaceODataServiceDescr')
160
+ }
161
+ ];
162
+ default:
163
+ return [];
164
+ }
165
+ }
111
166
  //# sourceMappingURL=steps.js.map
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "displayName": "SAPUI5 Adaptation Project",
4
4
  "homepage": "https://help.sap.com/viewer/584e0bcbfd4a4aff91c815cefa0bce2d/Cloud/en-US/ada9567b767941aba8d49fdb4fdedea7.html",
5
5
  "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.",
6
- "version": "0.3.46",
6
+ "version": "0.3.47",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,7 +30,7 @@
30
30
  "i18next": "25.3.0",
31
31
  "yeoman-generator": "5.10.0",
32
32
  "uuid": "10.0.0",
33
- "@sap-ux/adp-tooling": "0.15.0",
33
+ "@sap-ux/adp-tooling": "0.15.1",
34
34
  "@sap-ux/axios-extension": "1.22.3",
35
35
  "@sap-ux/btp-utils": "1.1.0",
36
36
  "@sap-ux/feature-toggle": "0.3.0",
@@ -41,7 +41,8 @@
41
41
  "@sap-ux/system-access": "0.6.10",
42
42
  "@sap-ux/project-input-validator": "0.6.12",
43
43
  "@sap-ux/fiori-generator-shared": "0.13.2",
44
- "@sap-ux/adp-flp-config-sub-generator": "0.1.45"
44
+ "@sap-ux/adp-flp-config-sub-generator": "0.1.46",
45
+ "@sap-ux/odata-service-writer": "0.27.12"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@jest/types": "29.6.3",