@sap-ux/inquirer-common 0.10.26 → 0.11.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.
@@ -13,14 +13,6 @@ export declare const transformationsRequiredForAnalyticalTable: readonly ["filte
13
13
  * @returns The entity set if found, undefined otherwise.
14
14
  */
15
15
  export declare function findEntitySetByName(metadata: ConvertedMetadata, entitySetName: string): EntitySet | undefined;
16
- /**
17
- * Checks if the given entity set has aggregate transformations.
18
- * Returns true if ANY transformations are present in either entity set or entity type annotations.
19
- *
20
- * @param entitySet The entity set to check for aggregate transformations.
21
- * @returns true if the entity set has any aggregate transformations, false otherwise.
22
- */
23
- export declare function hasAggregateTransformations(entitySet: EntitySet): boolean;
24
16
  /**
25
17
  * Returns only entity sets that have the `Aggregation.ApplySupported` annotation term with the `Transformations` property.
26
18
  * This can be found within the entity set annotations or the entity type annotations.
@@ -29,16 +21,6 @@ export declare function hasAggregateTransformations(entitySet: EntitySet): boole
29
21
  * @returns the filtered entity sets
30
22
  */
31
23
  export declare function filterAggregateTransformations(entitySets: EntitySet[]): EntitySet[];
32
- /**
33
- * Checks if the given entity set has aggregate transformations.
34
- * If specific transformations are provided, checks if ALL of those transformations are present.
35
- * If no transformations are specified, returns true if ANY transformations are present.
36
- *
37
- * @param entitySet The entity set to check for aggregate transformations.
38
- * @param requiredTransformations Optional array of specific transformations to check for. If not provided, checks for any transformations.
39
- * @returns true if the entity set has the required transformations, false otherwise.
40
- */
41
- export declare function hasAggregateTransformationsForEntitySet(entitySet: EntitySet, requiredTransformations?: readonly string[]): boolean;
42
24
  /**
43
25
  * Checks if the given entity set name has aggregate transformations in the metadata.
44
26
  * If specific transformations are provided, checks if ALL of those transformations are present.
@@ -50,13 +32,6 @@ export declare function hasAggregateTransformationsForEntitySet(entitySet: Entit
50
32
  * @returns true if the entity set has the required transformations, false otherwise.
51
33
  */
52
34
  export declare function hasAggregateTransformationsForEntity(metadata: ConvertedMetadata, entitySetName: string, requiredTransformations?: readonly string[]): boolean;
53
- /**
54
- * Checks if the given entity set has a Hierarchy.RecursiveHierarchy annotation.
55
- *
56
- * @param entitySet The entity set to check for recursive hierarchy annotation.
57
- * @returns true if the entity set has Hierarchy.RecursiveHierarchy annotation, false otherwise.
58
- */
59
- export declare function hasRecursiveHierarchyForEntitySet(entitySet: EntitySet): boolean;
60
35
  /**
61
36
  * Gets the qualifier from a Hierarchy.RecursiveHierarchy annotation for the given entity set.
62
37
  *
@@ -2,11 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformationsRequiredForAnalyticalTable = void 0;
4
4
  exports.findEntitySetByName = findEntitySetByName;
5
- exports.hasAggregateTransformations = hasAggregateTransformations;
6
5
  exports.filterAggregateTransformations = filterAggregateTransformations;
7
- exports.hasAggregateTransformationsForEntitySet = hasAggregateTransformationsForEntitySet;
8
6
  exports.hasAggregateTransformationsForEntity = hasAggregateTransformationsForEntity;
9
- exports.hasRecursiveHierarchyForEntitySet = hasRecursiveHierarchyForEntitySet;
10
7
  exports.getRecursiveHierarchyQualifierForEntitySet = getRecursiveHierarchyQualifierForEntitySet;
11
8
  exports.hasRecursiveHierarchyForEntity = hasRecursiveHierarchyForEntity;
12
9
  exports.getRecursiveHierarchyQualifier = getRecursiveHierarchyQualifier;
@@ -15,6 +12,7 @@ exports.convertEdmxToConvertedMetadata = convertEdmxToConvertedMetadata;
15
12
  const annotation_converter_1 = require("@sap-ux/annotation-converter");
16
13
  const edmx_parser_1 = require("@sap-ux/edmx-parser");
17
14
  const i18n_1 = require("../i18n");
15
+ const project_access_1 = require("@sap-ux/project-access");
18
16
  /**
19
17
  * Required transformations for analytical table support.
20
18
  * NOTE: This constant is primarily used by odata-service-inquirer but is exported
@@ -30,10 +28,6 @@ exports.transformationsRequiredForAnalyticalTable = [
30
28
  'aggregate',
31
29
  'concat'
32
30
  ];
33
- /**
34
- * Annotation pattern for RecursiveHierarchy.
35
- */
36
- const RECURSIVE_HIERARCHY_ANNOTATION = 'RecursiveHierarchy';
37
31
  /**
38
32
  * Finds an entity set by name in the metadata.
39
33
  *
@@ -44,18 +38,6 @@ const RECURSIVE_HIERARCHY_ANNOTATION = 'RecursiveHierarchy';
44
38
  function findEntitySetByName(metadata, entitySetName) {
45
39
  return metadata.entitySets.find((entitySet) => entitySet.name === entitySetName);
46
40
  }
47
- /**
48
- * Checks if the given entity set has aggregate transformations.
49
- * Returns true if ANY transformations are present in either entity set or entity type annotations.
50
- *
51
- * @param entitySet The entity set to check for aggregate transformations.
52
- * @returns true if the entity set has any aggregate transformations, false otherwise.
53
- */
54
- function hasAggregateTransformations(entitySet) {
55
- const transformations = entitySet.annotations?.Aggregation?.ApplySupported?.Transformations ||
56
- entitySet.entityType?.annotations?.Aggregation?.ApplySupported?.Transformations;
57
- return Array.isArray(transformations) && transformations.length > 0;
58
- }
59
41
  /**
60
42
  * Returns only entity sets that have the `Aggregation.ApplySupported` annotation term with the `Transformations` property.
61
43
  * This can be found within the entity set annotations or the entity type annotations.
@@ -64,29 +46,7 @@ function hasAggregateTransformations(entitySet) {
64
46
  * @returns the filtered entity sets
65
47
  */
66
48
  function filterAggregateTransformations(entitySets) {
67
- return entitySets.filter(hasAggregateTransformations);
68
- }
69
- /**
70
- * Checks if the given entity set has aggregate transformations.
71
- * If specific transformations are provided, checks if ALL of those transformations are present.
72
- * If no transformations are specified, returns true if ANY transformations are present.
73
- *
74
- * @param entitySet The entity set to check for aggregate transformations.
75
- * @param requiredTransformations Optional array of specific transformations to check for. If not provided, checks for any transformations.
76
- * @returns true if the entity set has the required transformations, false otherwise.
77
- */
78
- function hasAggregateTransformationsForEntitySet(entitySet, requiredTransformations) {
79
- const transformations = entitySet.annotations?.Aggregation?.ApplySupported?.Transformations ||
80
- entitySet.entityType?.annotations?.Aggregation?.ApplySupported?.Transformations;
81
- if (!Array.isArray(transformations)) {
82
- return false;
83
- }
84
- // If no specific transformations required, return true if any transformations exist
85
- if (!requiredTransformations || requiredTransformations.length === 0) {
86
- return transformations.length > 0;
87
- }
88
- // Check if all required transformations are present
89
- return requiredTransformations.every((transformation) => transformations.includes(transformation));
49
+ return entitySets.filter((entitySet) => (0, project_access_1.getTableCapabilitiesByEntitySet)(entitySet).hasAggregateTransformations);
90
50
  }
91
51
  /**
92
52
  * Checks if the given entity set name has aggregate transformations in the metadata.
@@ -103,35 +63,7 @@ function hasAggregateTransformationsForEntity(metadata, entitySetName, requiredT
103
63
  if (!entitySet) {
104
64
  return false;
105
65
  }
106
- return hasAggregateTransformationsForEntitySet(entitySet, requiredTransformations);
107
- }
108
- /**
109
- * Finds the RecursiveHierarchy annotation key for the given entity set.
110
- * This is a helper function that both existence check and qualifier extraction can use.
111
- *
112
- * @param entitySet The entity set to check for recursive hierarchy annotation.
113
- * @returns The RecursiveHierarchy key if found, undefined otherwise.
114
- */
115
- function findRecursiveHierarchyKey(entitySet) {
116
- const hierarchyAnnotations = entitySet?.entityType?.annotations?.Hierarchy;
117
- if (!hierarchyAnnotations) {
118
- return undefined;
119
- }
120
- // First try exact match for the most common case
121
- if (hierarchyAnnotations[RECURSIVE_HIERARCHY_ANNOTATION]) {
122
- return RECURSIVE_HIERARCHY_ANNOTATION;
123
- }
124
- // Then check for qualified versions (RecursiveHierarchy#qualifier)
125
- return Object.keys(hierarchyAnnotations).find((key) => key.startsWith(RECURSIVE_HIERARCHY_ANNOTATION));
126
- }
127
- /**
128
- * Checks if the given entity set has a Hierarchy.RecursiveHierarchy annotation.
129
- *
130
- * @param entitySet The entity set to check for recursive hierarchy annotation.
131
- * @returns true if the entity set has Hierarchy.RecursiveHierarchy annotation, false otherwise.
132
- */
133
- function hasRecursiveHierarchyForEntitySet(entitySet) {
134
- return !!findRecursiveHierarchyKey(entitySet);
66
+ return (0, project_access_1.getTableCapabilitiesByEntitySet)(entitySet, requiredTransformations).hasAggregateTransformationsForEntitySet;
135
67
  }
136
68
  /**
137
69
  * Gets the qualifier from a Hierarchy.RecursiveHierarchy annotation for the given entity set.
@@ -140,7 +72,7 @@ function hasRecursiveHierarchyForEntitySet(entitySet) {
140
72
  * @returns The qualifier string if found, undefined otherwise.
141
73
  */
142
74
  function getRecursiveHierarchyQualifierForEntitySet(entitySet) {
143
- return findRecursiveHierarchyKey(entitySet)?.split('#')[1];
75
+ return (0, project_access_1.findRecursiveHierarchyKey)(entitySet)?.split('#')[1];
144
76
  }
145
77
  /**
146
78
  * Checks if the given entity set name has a Hierarchy.RecursiveHierarchy annotation in the metadata.
@@ -154,7 +86,7 @@ function hasRecursiveHierarchyForEntity(metadata, entitySetName) {
154
86
  if (!entitySet) {
155
87
  return false;
156
88
  }
157
- return hasRecursiveHierarchyForEntitySet(entitySet);
89
+ return (0, project_access_1.getTableCapabilitiesByEntitySet)(entitySet).hasRecursiveHierarchyForEntitySet;
158
90
  }
159
91
  /**
160
92
  * Gets the qualifier from a Hierarchy.RecursiveHierarchy annotation for the given entity set.
@@ -180,8 +112,9 @@ function getRecursiveHierarchyQualifier(metadata, entitySetName) {
180
112
  * @returns True if AnalyticalTable should be used, false otherwise.
181
113
  */
182
114
  function shouldUseAnalyticalTable(entitySet, requireCompleteTransformations) {
115
+ const { hasAggregateTransformations, hasAggregateTransformationsForEntitySet } = (0, project_access_1.getTableCapabilitiesByEntitySet)(entitySet, exports.transformationsRequiredForAnalyticalTable);
183
116
  // No analytical data means no need for AnalyticalTable
184
- if (!hasAggregateTransformations(entitySet)) {
117
+ if (!hasAggregateTransformations) {
185
118
  return false;
186
119
  }
187
120
  // If complete transformations are not required, any analytical annotations are sufficient
@@ -189,7 +122,7 @@ function shouldUseAnalyticalTable(entitySet, requireCompleteTransformations) {
189
122
  return true;
190
123
  }
191
124
  // Require complete analytical transformations
192
- return hasAggregateTransformationsForEntitySet(entitySet, exports.transformationsRequiredForAnalyticalTable);
125
+ return hasAggregateTransformationsForEntitySet;
193
126
  }
194
127
  /**
195
128
  * Converts an EDMX string to a ConvertedMetadata object.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/inquirer-common",
3
3
  "description": "Commonly used shared functionality and types to support inquirer modules.",
4
- "version": "0.10.26",
4
+ "version": "0.11.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -32,11 +32,12 @@
32
32
  "semver": "7.7.3",
33
33
  "@sap-ux/btp-utils": "1.1.7",
34
34
  "@sap-ux/feature-toggle": "0.3.6",
35
- "@sap-ux/fiori-generator-shared": "0.13.66",
35
+ "@sap-ux/fiori-generator-shared": "0.13.67",
36
36
  "@sap-ux/guided-answers-helper": "0.4.2",
37
- "@sap-ux/telemetry": "0.6.67",
37
+ "@sap-ux/telemetry": "0.6.68",
38
38
  "@sap-ux/logger": "0.8.1",
39
- "@sap-ux/odata-service-writer": "0.29.14",
39
+ "@sap-ux/project-access": "1.35.0",
40
+ "@sap-ux/odata-service-writer": "0.29.15",
40
41
  "@sap-ux/ui5-info": "0.13.11"
41
42
  },
42
43
  "devDependencies": {