@sap-ux/odata-service-inquirer 2.9.13 → 2.10.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.
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.showCollabDraftWarning = showCollabDraftWarning;
7
- const annotation_converter_1 = require("@sap-ux/annotation-converter");
8
- const edmx_parser_1 = require("@sap-ux/edmx-parser");
9
7
  const entity_helper_1 = require("../../edmx/entity-helper");
10
8
  const logger_helper_1 = __importDefault(require("../../logger-helper"));
11
9
  const i18n_1 = require("../../../i18n");
10
+ const annotation_converter_1 = require("@sap-ux/annotation-converter");
11
+ const edmx_parser_1 = require("@sap-ux/edmx-parser");
12
12
  /**
13
13
  * If any of the draft root annotated entity sets have the share action property, then collaborative draft is enabled.
14
14
  *
@@ -181,40 +181,6 @@ function filterDraftEnabledEntities(entitySets) {
181
181
  return !!entitySetTypeProperties.find((property) => property.name === 'HasDraftEntity');
182
182
  });
183
183
  }
184
- /**
185
- * Determines if AnalyticalTable should be used based on entity annotations and service type.
186
- *
187
- * AnalyticalTable is used when entity has hierarchical and analytical data together with complete transformations,
188
- * for CAP services with analytical data, or for non-CAP services with complete analytical transformations.
189
- *
190
- * @param entitySet The entity set to check for annotations.
191
- * @param isCapService Whether the service is a CAP service (affects analytical requirements).
192
- * @returns True if AnalyticalTable should be used, false otherwise.
193
- */
194
- function shouldUseAnalyticalTable(entitySet, isCapService) {
195
- // Evaluate annotations once to avoid multiple iterations
196
- const hasAnalytical = (0, inquirer_common_1.hasAggregateTransformations)(entitySet);
197
- const hasHierarchy = (0, inquirer_common_1.hasRecursiveHierarchyForEntitySet)(entitySet);
198
- // No analytical data means no need for AnalyticalTable
199
- if (!hasAnalytical) {
200
- return false;
201
- }
202
- // If entity has both analytical and hierarchical data, check requirements based on service type
203
- if (hasHierarchy) {
204
- // For CAP services, any analytical annotations are sufficient even with hierarchy
205
- if (isCapService) {
206
- return true;
207
- }
208
- // For non-CAP services, require complete analytical transformations
209
- return (0, inquirer_common_1.hasAggregateTransformationsForEntitySet)(entitySet, inquirer_common_1.transformationsRequiredForAnalyticalTable);
210
- }
211
- // For CAP services, analytical annotations are sufficient
212
- if (isCapService) {
213
- return true;
214
- }
215
- // For non-CAP services, require complete analytical transformations
216
- return (0, inquirer_common_1.hasAggregateTransformationsForEntitySet)(entitySet, inquirer_common_1.transformationsRequiredForAnalyticalTable);
217
- }
218
184
  /**
219
185
  * Get the default table type based on the template type and entity capabilities.
220
186
  *
@@ -235,13 +201,18 @@ function getDefaultTableType(templateType, metadata, odataVersion, isCapService,
235
201
  // Handle OData v4 specific logic
236
202
  if (odataVersion === odata_service_writer_1.OdataVersion.v4 && entitySet) {
237
203
  const canUseAnalytical = templateType === 'lrop' || templateType === 'worklist' || templateType === 'alp';
238
- const hasAnalyticalCapabilities = shouldUseAnalyticalTable(entitySet, isCapService);
239
204
  const hasHierarchy = (0, inquirer_common_1.hasRecursiveHierarchyForEntitySet)(entitySet);
240
- // Check for analytical data requirements
241
- if (canUseAnalytical && hasAnalyticalCapabilities) {
242
- return 'AnalyticalTable';
205
+ const hasAnalyticalData = (0, inquirer_common_1.hasAggregateTransformations)(entitySet);
206
+ // Check for analytical capabilities first (highest priority)
207
+ if (canUseAnalytical && hasAnalyticalData) {
208
+ // For CAP services, any analytical data is sufficient
209
+ // For non-CAP services, require complete transformations
210
+ const hasAnalyticalCapabilities = (0, inquirer_common_1.shouldUseAnalyticalTable)(entitySet, !isCapService);
211
+ if (hasAnalyticalCapabilities) {
212
+ return 'AnalyticalTable';
213
+ }
243
214
  }
244
- // Check for hierarchical data requirements
215
+ // Check for hierarchical data only (no analytical data or analytical requirements not met)
245
216
  if ((templateType === 'lrop' || templateType === 'worklist') && hasHierarchy) {
246
217
  return 'TreeTable';
247
218
  }
@@ -200,9 +200,9 @@ function getTableLayoutQuestions(templateType, odataVersion, isCapService, metad
200
200
  }
201
201
  const tableLayoutQuestions = [];
202
202
  if (templateType === 'lrop' || templateType === 'worklist' || templateType === 'alp') {
203
- // Variables to manage analytical table defaults across prompts
204
- let setAnalyticalTableDefault = false;
203
+ // Variables to track selected entity and default table type
205
204
  let selectedEntity;
205
+ let defaultTableType;
206
206
  tableLayoutQuestions.push({
207
207
  when: (prevAnswers) => !!prevAnswers.mainEntity,
208
208
  type: 'list',
@@ -218,24 +218,30 @@ function getTableLayoutQuestions(templateType, odataVersion, isCapService, metad
218
218
  const currentEntity = prevAnswers?.mainEntity;
219
219
  // Only re-evaluate if entity has changed or no previous selection exists
220
220
  if (currentEntity?.entitySetName !== selectedEntity?.entitySetName || !prevAnswers?.tableType) {
221
- const defaultTableType = (0, entity_helper_1.getDefaultTableType)(templateType, metadata, odataVersion, isCapService, currentEntity?.entitySetName);
221
+ defaultTableType = (0, entity_helper_1.getDefaultTableType)(templateType, metadata, odataVersion, isCapService, currentEntity?.entitySetName);
222
222
  // Update tracking variables
223
223
  selectedEntity = currentEntity;
224
- setAnalyticalTableDefault = defaultTableType === 'AnalyticalTable';
225
224
  return defaultTableType;
226
225
  }
227
226
  // Entity hasn't changed and user has a selection - preserve their choice
228
- // Reset the analytical table default flag since this is user's choice, not system default
229
- setAnalyticalTableDefault = false;
227
+ // Reset the default table type since this is user's choice, not system default
228
+ defaultTableType = undefined;
230
229
  return prevAnswers.tableType;
231
230
  },
232
231
  additionalMessages: () => {
233
- if (setAnalyticalTableDefault) {
232
+ if (defaultTableType === 'AnalyticalTable') {
234
233
  return {
235
234
  message: (0, i18n_1.t)('prompts.tableType.analyticalTableDefault'),
236
235
  severity: yeoman_ui_types_1.Severity.information
237
236
  };
238
237
  }
238
+ else if (defaultTableType === 'TreeTable') {
239
+ return {
240
+ message: (0, i18n_1.t)('prompts.tableType.treeTableDefault'),
241
+ severity: yeoman_ui_types_1.Severity.information
242
+ };
243
+ }
244
+ return undefined;
239
245
  }
240
246
  });
241
247
  tableLayoutQuestions.push({
@@ -160,7 +160,8 @@
160
160
  "choiceAnalytical": "Analytical",
161
161
  "choiceResponsive": "Responsive",
162
162
  "choiceTree": "Tree",
163
- "analyticalTableDefault": "The 'Analytical' table type is chosen by default because the selected entity supports it."
163
+ "analyticalTableDefault": "The 'Analytical' table type is chosen by default because the selected entity supports it.",
164
+ "treeTableDefault": "The 'Tree' table type is chosen by default because the selected entity supports it."
164
165
  },
165
166
  "hierarchyQualifier": {
166
167
  "message": "Hierarchy Qualifier",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/odata-service-inquirer",
3
3
  "description": "Prompts module that can prompt users for inputs required for odata service writing",
4
- "version": "2.9.13",
4
+ "version": "2.10.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -31,15 +31,15 @@
31
31
  "os-name": "4.0.1",
32
32
  "@sap-ux/axios-extension": "1.24.1",
33
33
  "@sap-ux/btp-utils": "1.1.4",
34
- "@sap-ux/fiori-generator-shared": "0.13.30",
34
+ "@sap-ux/fiori-generator-shared": "0.13.31",
35
35
  "@sap-ux/guided-answers-helper": "0.4.0",
36
- "@sap-ux/telemetry": "0.6.35",
37
- "@sap-ux/inquirer-common": "0.8.9",
36
+ "@sap-ux/telemetry": "0.6.36",
37
+ "@sap-ux/inquirer-common": "0.9.0",
38
38
  "@sap-ux/logger": "0.7.0",
39
39
  "@sap-ux/nodejs-utils": "0.2.7",
40
40
  "@sap-ux/project-access": "1.32.7",
41
41
  "@sap-ux/project-input-validator": "0.6.29",
42
- "@sap-ux/store": "1.3.1"
42
+ "@sap-ux/store": "1.3.2"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@sap-ux/vocabularies-types": "0.13.0",
@@ -48,12 +48,12 @@
48
48
  "@types/inquirer": "8.2.6",
49
49
  "@types/lodash": "4.14.202",
50
50
  "jest-extended": "6.0.0",
51
- "@sap-ux/fiori-generator-shared": "0.13.30",
52
- "@sap-ux/fiori-elements-writer": "2.7.33",
53
- "@sap-ux/fiori-freestyle-writer": "2.4.58",
51
+ "@sap-ux/fiori-generator-shared": "0.13.31",
52
+ "@sap-ux/fiori-elements-writer": "2.7.34",
53
+ "@sap-ux/fiori-freestyle-writer": "2.4.59",
54
54
  "@sap-ux/feature-toggle": "0.3.3",
55
55
  "@sap-ux/odata-service-writer": "0.27.28",
56
- "@sap-ux/cap-config-writer": "0.12.21"
56
+ "@sap-ux/cap-config-writer": "0.12.22"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">=20.x"