@sap-ux/fiori-app-sub-generator 0.7.2 → 0.7.4

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.
@@ -178,6 +178,7 @@ class FioriAppGenerator extends yeoman_generator_1.default {
178
178
  projectName: this.state.project?.name,
179
179
  targetFolder: this.state.project?.targetFolder,
180
180
  service: this.state.service,
181
+ entityRelatedConfig: this.state.entityRelatedConfig,
181
182
  floorplan: this.state.floorplan,
182
183
  promptSettings: generatorOptions.promptSettings?.['@sap/generator-fiori'],
183
184
  promptExtension: generatorOptions.extensions
@@ -1,5 +1,5 @@
1
1
  import type { Logger } from '@sap-ux/logger';
2
- import { type CapService, type ConnectedSystem, type OdataServicePromptOptions, OdataVersion } from '@sap-ux/odata-service-inquirer';
2
+ import { type CapService, type ConnectedSystem, type OdataServicePromptOptions, OdataVersion, type EntityRelatedAnswers } from '@sap-ux/odata-service-inquirer';
3
3
  import type { UI5ApplicationAnswers, UI5ApplicationPromptOptions } from '@sap-ux/ui5-application-inquirer';
4
4
  import type { Question } from 'inquirer';
5
5
  import type { Adapter } from 'yeoman-environment';
@@ -16,6 +16,7 @@ type PromptUI5AppAnswersOptions = {
16
16
  projectName?: Project['name'];
17
17
  targetFolder?: Project['targetFolder'];
18
18
  service: Partial<Service>;
19
+ entityRelatedConfig?: Partial<EntityRelatedAnswers>;
19
20
  promptSettings?: UI5ApplicationPromptOptions;
20
21
  floorplan: Floorplan;
21
22
  promptExtension?: UI5ApplicationPromptOptions;
@@ -31,11 +32,12 @@ type PromptUI5AppAnswersOptions = {
31
32
  * @param param0.promptSettings
32
33
  * @param param0.floorplan
33
34
  * @param param0.promptExtension
35
+ * @param param0.entityRelatedConfig
34
36
  * @param yeomanUiStepConfig
35
37
  * @param adapter
36
38
  * @returns
37
39
  */
38
- export declare function promptUI5ApplicationAnswers({ service, projectName, targetFolder, promptSettings, floorplan, promptExtension }: PromptUI5AppAnswersOptions, yeomanUiStepConfig: YeomanUiStepConfig[], adapter: Adapter): Promise<{
40
+ export declare function promptUI5ApplicationAnswers({ service, projectName, targetFolder, promptSettings, floorplan, promptExtension, entityRelatedConfig }: PromptUI5AppAnswersOptions, yeomanUiStepConfig: YeomanUiStepConfig[], adapter: Adapter): Promise<{
39
41
  ui5AppAnswers: UI5ApplicationAnswers;
40
42
  localUI5Version: string | undefined;
41
43
  }>;
@@ -49,21 +51,26 @@ export declare function promptUI5ApplicationAnswers({ service, projectName, targ
49
51
  * @returns {Promise<Service>}
50
52
  */
51
53
  export declare function promptOdataServiceAnswers(options: OdataServiceInquirerOptions, logger: Logger, adapter: Adapter, connectedSystem?: ConnectedSystem): Promise<Service>;
54
+ export type Ui5PromptOptions = PromptUI5AppAnswersOptions & {
55
+ appGenStepConfigList: YeomanUiStepConfig[];
56
+ };
52
57
  /**
53
58
  * Creates the `UIApplicationPromptOptions`.
54
59
  * Note that setting 'default', the default prompt value or function, or 'hide', whether the prompt should be shown,
55
60
  * to `undefined` should mean that the setting is ignored by the prompt.
56
61
  *
57
- * @param service
58
- * @param appGenStepConfigList
59
- * @param floorplan
60
- * @param projectName
61
- * @param targetFolder
62
- * @param promptSettings
63
- * @param extensions
62
+ * @param {object} ui5PromptOptions - Options for configuring the UI5 application prompt.
63
+ * @param {Partial<Service>} ui5PromptOptions.service - The service configuration.
64
+ * @param {YeomanUiStepConfig[]} ui5PromptOptions.appGenStepConfigList - The list of Yeoman UI step configurations.
65
+ * @param {Floorplan} ui5PromptOptions.floorplan - The selected floorplan type.
66
+ * @param {string} [ui5PromptOptions.projectName] - The name of the project.
67
+ * @param {string} [ui5PromptOptions.targetFolder] - The target folder for the project.
68
+ * @param {UI5ApplicationPromptOptions} [ui5PromptOptions.promptSettings] - Additional prompt settings.
69
+ * @param {UI5ApplicationPromptOptions} [ui5PromptOptions.promptExtension] - Extension prompt settings.
70
+ * @param {Partial<EntityRelatedAnswers>} [ui5PromptOptions.entityRelatedConfig] - Entity-related configuration.
64
71
  * @returns {Promise<UI5ApplicationPromptOptions>} prompt options that may be used to configure UI5 application prompting
65
72
  */
66
- export declare function createUI5ApplicationPromptOptions(service: Partial<Readonly<Service>>, appGenStepConfigList: YeomanUiStepConfig[], floorplan: Floorplan, projectName?: Project['name'], targetFolder?: Project['targetFolder'], promptSettings?: UI5ApplicationPromptOptions, extensions?: UI5ApplicationPromptOptions): Promise<UI5ApplicationPromptOptions>;
73
+ export declare function createUI5ApplicationPromptOptions(ui5PromptOptions: Ui5PromptOptions): Promise<UI5ApplicationPromptOptions>;
67
74
  /**
68
75
  * Convienience type for the options of the `createOdataServicePromptOptions` function.
69
76
  */
@@ -67,11 +67,12 @@ exports.getViewQuestion = getViewQuestion;
67
67
  * @param param0.promptSettings
68
68
  * @param param0.floorplan
69
69
  * @param param0.promptExtension
70
+ * @param param0.entityRelatedConfig
70
71
  * @param yeomanUiStepConfig
71
72
  * @param adapter
72
73
  * @returns
73
74
  */
74
- async function promptUI5ApplicationAnswers({ service, projectName, targetFolder, promptSettings, floorplan, promptExtension }, yeomanUiStepConfig, adapter) {
75
+ async function promptUI5ApplicationAnswers({ service, projectName, targetFolder, promptSettings, floorplan, promptExtension, entityRelatedConfig }, yeomanUiStepConfig, adapter) {
75
76
  let inquirerAdapter;
76
77
  // type `any` will be replaced when we can import ESM modules
77
78
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -82,7 +83,16 @@ async function promptUI5ApplicationAnswers({ service, projectName, targetFolder,
82
83
  else {
83
84
  inquirerAdapter = adapter;
84
85
  }
85
- const promptOptions = await createUI5ApplicationPromptOptions(service, yeomanUiStepConfig, floorplan, projectName, targetFolder, promptSettings, promptExtension);
86
+ const promptOptions = await createUI5ApplicationPromptOptions({
87
+ service,
88
+ appGenStepConfigList: yeomanUiStepConfig,
89
+ floorplan,
90
+ projectName,
91
+ targetFolder,
92
+ promptSettings,
93
+ promptExtension,
94
+ entityRelatedConfig
95
+ });
86
96
  const ui5AppAnswers = await (0, ui5_application_inquirer_1.prompt)(inquirerAdapter, promptOptions, service.capService?.cdsUi5PluginInfo, (0, fiori_generator_shared_1.getHostEnvironment)() !== fiori_generator_shared_1.hostEnvironment.cli);
87
97
  // Get the (latest) version available from npm, instead of UI5 versions service in case of unpublished versions
88
98
  const localUI5Version = (await (0, ui5_info_1.getUI5Versions)({
@@ -136,21 +146,24 @@ async function promptOdataServiceAnswers(options, logger, adapter, connectedSyst
136
146
  * Note that setting 'default', the default prompt value or function, or 'hide', whether the prompt should be shown,
137
147
  * to `undefined` should mean that the setting is ignored by the prompt.
138
148
  *
139
- * @param service
140
- * @param appGenStepConfigList
141
- * @param floorplan
142
- * @param projectName
143
- * @param targetFolder
144
- * @param promptSettings
145
- * @param extensions
149
+ * @param {object} ui5PromptOptions - Options for configuring the UI5 application prompt.
150
+ * @param {Partial<Service>} ui5PromptOptions.service - The service configuration.
151
+ * @param {YeomanUiStepConfig[]} ui5PromptOptions.appGenStepConfigList - The list of Yeoman UI step configurations.
152
+ * @param {Floorplan} ui5PromptOptions.floorplan - The selected floorplan type.
153
+ * @param {string} [ui5PromptOptions.projectName] - The name of the project.
154
+ * @param {string} [ui5PromptOptions.targetFolder] - The target folder for the project.
155
+ * @param {UI5ApplicationPromptOptions} [ui5PromptOptions.promptSettings] - Additional prompt settings.
156
+ * @param {UI5ApplicationPromptOptions} [ui5PromptOptions.promptExtension] - Extension prompt settings.
157
+ * @param {Partial<EntityRelatedAnswers>} [ui5PromptOptions.entityRelatedConfig] - Entity-related configuration.
146
158
  * @returns {Promise<UI5ApplicationPromptOptions>} prompt options that may be used to configure UI5 application prompting
147
159
  */
148
- async function createUI5ApplicationPromptOptions(service, appGenStepConfigList, floorplan, projectName, targetFolder, promptSettings, extensions) {
160
+ async function createUI5ApplicationPromptOptions(ui5PromptOptions) {
161
+ const { service, appGenStepConfigList, floorplan, projectName, targetFolder, promptSettings, promptExtension: extensions, entityRelatedConfig } = ui5PromptOptions;
149
162
  // prompt settings may be additionally provided e.g. set by adaptors
150
163
  const ui5VersionPromptOptions = {
151
164
  hide: promptSettings?.[ui5_application_inquirer_1.promptNames.ui5Version]?.hide ?? false,
152
165
  minUI5Version: promptSettings?.[ui5_application_inquirer_1.promptNames.ui5Version]?.minUI5Version ??
153
- (0, utils_1.getMinSupportedUI5Version)(service.version ?? odata_service_inquirer_1.OdataVersion.v2, floorplan),
166
+ (0, utils_1.getMinSupportedUI5Version)(service.version ?? odata_service_inquirer_1.OdataVersion.v2, floorplan, entityRelatedConfig),
154
167
  includeSeparators: (0, fiori_generator_shared_1.getHostEnvironment)() !== fiori_generator_shared_1.hostEnvironment.cli,
155
168
  useAutocomplete: (0, fiori_generator_shared_1.getHostEnvironment)() === fiori_generator_shared_1.hostEnvironment.cli
156
169
  };
@@ -49,6 +49,7 @@ export declare const generatorName = "SAP Fiori Application Generator";
49
49
  export declare const FPM_DEFAULT_PAGE_NAME = "Main";
50
50
  export declare const minSupportedUi5Version = "1.65.0";
51
51
  export declare const minSupportedUi5VersionV4 = "1.84.0";
52
+ export declare const minUi5VersionForPageBuildingBlock = "1.136.0";
52
53
  export declare const defaultNavActionTile = "tile";
53
54
  export declare const defaultNavActionDisplay = "display";
54
55
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Features = exports.defaultNavActionDisplay = exports.defaultNavActionTile = exports.minSupportedUi5VersionV4 = exports.minSupportedUi5Version = exports.FPM_DEFAULT_PAGE_NAME = exports.generatorName = exports.MAIN_MODEL_NAME = exports.MAIN_DATASOURCE_NAME = exports.DEFAULT_SERVICE_PATH = exports.DEFAULT_CAP_HOST = exports.DEFAULT_HOST = exports.FIORI_STEPS = exports.STEP_FLP_CONFIG = exports.STEP_DEPLOY_CONFIG = exports.STEP_PROJECT_ATTRIBUTES = exports.STEP_ENTITY = exports.STEP_DATASOURCE_AND_SERVICE = exports.STEP_FLOORPLAN = exports.API_HUB_TYPE = exports.API_HUB_API_KEY = exports.SAP_CLIENT_KEY = exports.UI5_VERSION_PROPS = exports.PLATFORMS = exports.LEGACY_CAP_TYPE_JAVA = exports.LEGACY_CAP_TYPE_NODE = void 0;
3
+ exports.Features = exports.defaultNavActionDisplay = exports.defaultNavActionTile = exports.minUi5VersionForPageBuildingBlock = exports.minSupportedUi5VersionV4 = exports.minSupportedUi5Version = exports.FPM_DEFAULT_PAGE_NAME = exports.generatorName = exports.MAIN_MODEL_NAME = exports.MAIN_DATASOURCE_NAME = exports.DEFAULT_SERVICE_PATH = exports.DEFAULT_CAP_HOST = exports.DEFAULT_HOST = exports.FIORI_STEPS = exports.STEP_FLP_CONFIG = exports.STEP_DEPLOY_CONFIG = exports.STEP_PROJECT_ATTRIBUTES = exports.STEP_ENTITY = exports.STEP_DATASOURCE_AND_SERVICE = exports.STEP_FLOORPLAN = exports.API_HUB_TYPE = exports.API_HUB_API_KEY = exports.SAP_CLIENT_KEY = exports.UI5_VERSION_PROPS = exports.PLATFORMS = exports.LEGACY_CAP_TYPE_JAVA = exports.LEGACY_CAP_TYPE_NODE = void 0;
4
4
  const i18n_1 = require("../utils/i18n");
5
5
  exports.LEGACY_CAP_TYPE_NODE = 'capNode';
6
6
  exports.LEGACY_CAP_TYPE_JAVA = 'capJava';
@@ -86,6 +86,8 @@ exports.FPM_DEFAULT_PAGE_NAME = 'Main';
86
86
  // App gen specific (not writer specific) supported UI5 versions
87
87
  exports.minSupportedUi5Version = '1.65.0';
88
88
  exports.minSupportedUi5VersionV4 = '1.84.0';
89
+ // The minimum UI5 version required for page building block feature
90
+ exports.minUi5VersionForPageBuildingBlock = '1.136.0';
89
91
  exports.defaultNavActionTile = 'tile';
90
92
  exports.defaultNavActionDisplay = 'display';
91
93
  /**
@@ -1,7 +1,7 @@
1
1
  import type { Annotations, ServiceProvider } from '@sap-ux/axios-extension';
2
2
  import type { CapRuntime, CapService } from '@sap-ux/cap-config-writer';
3
3
  import type { Logger } from '@sap-ux/logger';
4
- import { DatasourceType, OdataVersion, type ConnectedSystem } from '@sap-ux/odata-service-inquirer';
4
+ import { DatasourceType, OdataVersion, type ConnectedSystem, type EntityRelatedAnswers } from '@sap-ux/odata-service-inquirer';
5
5
  import type { CdsAnnotationsInfo, EdmxAnnotationsInfo } from '@sap-ux/odata-service-writer';
6
6
  import type { CapProjectType, CdsUi5PluginInfo, CdsVersionInfo } from '@sap-ux/project-access';
7
7
  import type { Editor } from 'mem-fs-editor';
@@ -41,13 +41,15 @@ export declare function buildSapClientParam(sapClient: string): string;
41
41
  */
42
42
  export declare function getRequiredOdataVersion(floorplan: Floorplan): OdataVersion | undefined;
43
43
  /**
44
- * Gets the min supported version of UI5 for the floorplan and odata version specified.
44
+ * Gets the minimum supported UI5 version for the specified OData version, floorplan, and entity configuration.
45
+ * For FPM floorplans with page building blocks, enforces a minimum version of 1.136.0.
45
46
  *
46
- * @param version - odata version
47
- * @param floorplan - floorplan value
48
- * @returns min supported version
47
+ * @param version - The OData version.
48
+ * @param floorplan - The floorplan type.
49
+ * @param entityRelatedConfig - entity related configuration.
50
+ * @returns The minimum supported UI5 version as a string.
49
51
  */
50
- export declare function getMinSupportedUI5Version(version: OdataVersion, floorplan: Floorplan): string;
52
+ export declare function getMinSupportedUI5Version(version: OdataVersion, floorplan: Floorplan, entityRelatedConfig?: Partial<EntityRelatedAnswers>): string;
51
53
  /**
52
54
  * Generates a v4 uuid. While not strictly necessary to wrap uuid it means we can enforce
53
55
  * additional options or change implementation easily in future.
@@ -26,6 +26,7 @@ const odata_service_inquirer_1 = require("@sap-ux/odata-service-inquirer");
26
26
  const project_access_1 = require("@sap-ux/project-access");
27
27
  const path_1 = require("path");
28
28
  const uuid_1 = require("uuid");
29
+ const types_1 = require("../types");
29
30
  const constants_1 = require("../types/constants");
30
31
  const external_1 = require("../types/external");
31
32
  const i18n_1 = require("./i18n");
@@ -78,13 +79,18 @@ function getRequiredOdataVersion(floorplan) {
78
79
  return supportedVers.length === 1 ? supportedVers[0] : undefined;
79
80
  }
80
81
  /**
81
- * Gets the min supported version of UI5 for the floorplan and odata version specified.
82
+ * Gets the minimum supported UI5 version for the specified OData version, floorplan, and entity configuration.
83
+ * For FPM floorplans with page building blocks, enforces a minimum version of 1.136.0.
82
84
  *
83
- * @param version - odata version
84
- * @param floorplan - floorplan value
85
- * @returns min supported version
85
+ * @param version - The OData version.
86
+ * @param floorplan - The floorplan type.
87
+ * @param entityRelatedConfig - entity related configuration.
88
+ * @returns The minimum supported UI5 version as a string.
86
89
  */
87
- function getMinSupportedUI5Version(version, floorplan) {
90
+ function getMinSupportedUI5Version(version, floorplan, entityRelatedConfig) {
91
+ if (floorplan === types_1.FloorplanFE.FE_FPM && entityRelatedConfig?.addPageBuildingBlock) {
92
+ return types_1.minUi5VersionForPageBuildingBlock;
93
+ }
88
94
  let minUI5Version;
89
95
  if (floorplan && floorplan !== external_1.FloorplanFF.FF_SIMPLE) {
90
96
  const templateType = external_1.FloorplanAttributes[floorplan].templateType;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-app-sub-generator",
3
3
  "description": "A yeoman (sub) generator that can generate Fiori applications. Not for standalone use.",
4
- "version": "0.7.2",
4
+ "version": "0.7.4",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -39,7 +39,7 @@
39
39
  "@sap-ux/fiori-generator-shared": "0.13.10",
40
40
  "@sap-ux/fiori-tools-settings": "0.2.0",
41
41
  "@sap-ux/launch-config": "0.10.19",
42
- "@sap-ux/odata-service-inquirer": "2.6.1",
42
+ "@sap-ux/odata-service-inquirer": "2.7.1",
43
43
  "@sap-ux/odata-service-writer": "0.27.17",
44
44
  "@sap-ux/project-access": "1.30.12",
45
45
  "@sap-ux/store": "1.1.3",
@@ -62,8 +62,8 @@
62
62
  "mock-spawn": "0.2.6",
63
63
  "rimraf": "5.0.5",
64
64
  "yeoman-test": "6.3.0",
65
- "@sap-ux/deploy-config-sub-generator": "0.3.61",
66
- "@sap-ux/flp-config-sub-generator": "0.3.17",
65
+ "@sap-ux/deploy-config-sub-generator": "0.4.0",
66
+ "@sap-ux/flp-config-sub-generator": "0.3.18",
67
67
  "@sap-ux/inquirer-common": "0.7.36",
68
68
  "@sap-ux/jest-file-matchers": "0.2.4",
69
69
  "@sap-ux/logger": "0.7.0"