@sap-ux/project-access 1.34.7 → 1.35.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -1
- package/dist/odata/index.d.ts +2 -0
- package/dist/odata/index.js +7 -0
- package/dist/odata/metadata.d.ts +25 -0
- package/dist/odata/metadata.js +88 -0
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export { addPackageDevDependency, clearCdsModuleCache, createApplicationAccess,
|
|
|
5
5
|
export { execNpmCommand } from './command/npm-command';
|
|
6
6
|
export * from './types';
|
|
7
7
|
export * from './library';
|
|
8
|
+
export { findRecursiveHierarchyKey, getTableCapabilitiesByEntitySet } from './odata';
|
|
8
9
|
export { hasDependency } from './project';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.hasUI5CliV3 = exports.getWebappPath = exports.getProjectType = exports.getProject = exports.getPathMappings = exports.getNodeModulesPath = exports.getMockDataPath = exports.getMockServerConfig = exports.getMtaPath = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getI18nBundles = exports.getI18nPropertiesPaths = exports.getSpecificationPath = exports.getSpecificationModuleFromCache = exports.getSpecification = exports.getCapI18nFolderNames = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapServiceName = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.getAppType = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.getAllUi5YamlFileNames = exports.findRootsForPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findCapProjectRoot = exports.findAllApps = exports.filterDataSourcesByType = exports.deleteCapApp = exports.createProjectAccess = exports.createApplicationAccess = exports.clearCdsModuleCache = exports.addPackageDevDependency = exports.normalizePath = exports.getFilePaths = exports.fioriToolsDirectory = exports.MinCdsVersion = exports.MinCdsPluginUi5Version = exports.FioriToolsSettings = exports.DirName = exports.FileName = void 0;
|
|
18
|
-
exports.hasDependency = exports.execNpmCommand = exports.getMainService = exports.processServices = exports.readFlexChanges = exports.checkCdsUi5PluginEnabled = exports.hasMinCdsVersion = exports.getWorkspaceInfo = exports.updatePackageScript = exports.toReferenceUri = exports.refreshSpecificationDistTags = exports.readUi5Yaml = exports.readCapServiceMetadataEdmx = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = void 0;
|
|
18
|
+
exports.hasDependency = exports.getTableCapabilitiesByEntitySet = exports.findRecursiveHierarchyKey = exports.execNpmCommand = exports.getMainService = exports.processServices = exports.readFlexChanges = exports.checkCdsUi5PluginEnabled = exports.hasMinCdsVersion = exports.getWorkspaceInfo = exports.updatePackageScript = exports.toReferenceUri = exports.refreshSpecificationDistTags = exports.readUi5Yaml = exports.readCapServiceMetadataEdmx = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = void 0;
|
|
19
19
|
var constants_1 = require("./constants");
|
|
20
20
|
Object.defineProperty(exports, "FileName", { enumerable: true, get: function () { return constants_1.FileName; } });
|
|
21
21
|
Object.defineProperty(exports, "DirName", { enumerable: true, get: function () { return constants_1.DirName; } });
|
|
@@ -89,6 +89,9 @@ var npm_command_1 = require("./command/npm-command");
|
|
|
89
89
|
Object.defineProperty(exports, "execNpmCommand", { enumerable: true, get: function () { return npm_command_1.execNpmCommand; } });
|
|
90
90
|
__exportStar(require("./types"), exports);
|
|
91
91
|
__exportStar(require("./library"), exports);
|
|
92
|
+
var odata_1 = require("./odata");
|
|
93
|
+
Object.defineProperty(exports, "findRecursiveHierarchyKey", { enumerable: true, get: function () { return odata_1.findRecursiveHierarchyKey; } });
|
|
94
|
+
Object.defineProperty(exports, "getTableCapabilitiesByEntitySet", { enumerable: true, get: function () { return odata_1.getTableCapabilitiesByEntitySet; } });
|
|
92
95
|
var project_2 = require("./project");
|
|
93
96
|
Object.defineProperty(exports, "hasDependency", { enumerable: true, get: function () { return project_2.hasDependency; } });
|
|
94
97
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTableCapabilitiesByEntitySet = exports.findRecursiveHierarchyKey = void 0;
|
|
4
|
+
var metadata_1 = require("./metadata");
|
|
5
|
+
Object.defineProperty(exports, "findRecursiveHierarchyKey", { enumerable: true, get: function () { return metadata_1.findRecursiveHierarchyKey; } });
|
|
6
|
+
Object.defineProperty(exports, "getTableCapabilitiesByEntitySet", { enumerable: true, get: function () { return metadata_1.getTableCapabilitiesByEntitySet; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { EntitySet } from '@sap-ux/vocabularies-types';
|
|
2
|
+
/**
|
|
3
|
+
* Finds the RecursiveHierarchy annotation key for the given entity set.
|
|
4
|
+
* This is a helper function that both existence check and qualifier extraction can use.
|
|
5
|
+
*
|
|
6
|
+
* @param entitySet The entity set to check for recursive hierarchy annotation.
|
|
7
|
+
* @returns The RecursiveHierarchy key if found, undefined otherwise.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findRecursiveHierarchyKey(entitySet: EntitySet): string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Determines table capabilities for a given entity set, analyzing its transformations and hierarchy.
|
|
12
|
+
*
|
|
13
|
+
* @param entitySet The entity set for which capabilities are being evaluated.
|
|
14
|
+
* @param requiredTransformations An optional array of required transformation names to be considered.
|
|
15
|
+
* @returns An object containing flags for aggregate transformations and recursive hierarchy specific to the entity set:
|
|
16
|
+
* - `hasAggregateTransformations`: Indicates if aggregate transformations are present in general.
|
|
17
|
+
* - `hasAggregateTransformationsForEntitySet`: Indicates if aggregate transformations are applicable to the specific entity set.
|
|
18
|
+
* - `hasRecursiveHierarchyForEntitySet`: Indicates if a recursive hierarchy is present for the specific entity set.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTableCapabilitiesByEntitySet(entitySet: EntitySet, requiredTransformations?: readonly string[]): {
|
|
21
|
+
hasAggregateTransformations: boolean;
|
|
22
|
+
hasAggregateTransformationsForEntitySet: boolean;
|
|
23
|
+
hasRecursiveHierarchyForEntitySet: boolean;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findRecursiveHierarchyKey = findRecursiveHierarchyKey;
|
|
4
|
+
exports.getTableCapabilitiesByEntitySet = getTableCapabilitiesByEntitySet;
|
|
5
|
+
/**
|
|
6
|
+
* Annotation pattern for RecursiveHierarchy.
|
|
7
|
+
*/
|
|
8
|
+
const RECURSIVE_HIERARCHY_ANNOTATION = 'RecursiveHierarchy';
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the given entity set has a Hierarchy.RecursiveHierarchy annotation.
|
|
11
|
+
*
|
|
12
|
+
* @param entitySet The entity set to check for recursive hierarchy annotation.
|
|
13
|
+
* @returns true if the entity set has Hierarchy.RecursiveHierarchy annotation, false otherwise.
|
|
14
|
+
*/
|
|
15
|
+
function hasRecursiveHierarchyForEntitySet(entitySet) {
|
|
16
|
+
return !!findRecursiveHierarchyKey(entitySet);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Finds the RecursiveHierarchy annotation key for the given entity set.
|
|
20
|
+
* This is a helper function that both existence check and qualifier extraction can use.
|
|
21
|
+
*
|
|
22
|
+
* @param entitySet The entity set to check for recursive hierarchy annotation.
|
|
23
|
+
* @returns The RecursiveHierarchy key if found, undefined otherwise.
|
|
24
|
+
*/
|
|
25
|
+
function findRecursiveHierarchyKey(entitySet) {
|
|
26
|
+
const hierarchyAnnotations = entitySet?.entityType?.annotations?.Hierarchy;
|
|
27
|
+
if (!hierarchyAnnotations) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
// First try exact match for the most common case
|
|
31
|
+
if (hierarchyAnnotations[RECURSIVE_HIERARCHY_ANNOTATION]) {
|
|
32
|
+
return RECURSIVE_HIERARCHY_ANNOTATION;
|
|
33
|
+
}
|
|
34
|
+
// Then check for qualified versions (RecursiveHierarchy#qualifier)
|
|
35
|
+
return Object.keys(hierarchyAnnotations).find((key) => key.startsWith(RECURSIVE_HIERARCHY_ANNOTATION));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Checks if the given entity set has aggregate transformations.
|
|
39
|
+
* Returns true if ANY transformations are present in either entity set or entity type annotations.
|
|
40
|
+
*
|
|
41
|
+
* @param entitySet The entity set to check for aggregate transformations.
|
|
42
|
+
* @returns true if the entity set has any aggregate transformations, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
function hasAggregateTransformations(entitySet) {
|
|
45
|
+
const transformations = entitySet.annotations?.Aggregation?.ApplySupported?.Transformations ||
|
|
46
|
+
entitySet.entityType?.annotations?.Aggregation?.ApplySupported?.Transformations;
|
|
47
|
+
return Array.isArray(transformations) && transformations.length > 0;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Checks if the given entity set has aggregate transformations.
|
|
51
|
+
* If specific transformations are provided, checks if ALL of those transformations are present.
|
|
52
|
+
* If no transformations are specified, returns true if ANY transformations are present.
|
|
53
|
+
*
|
|
54
|
+
* @param entitySet The entity set to check for aggregate transformations.
|
|
55
|
+
* @param requiredTransformations Optional array of specific transformations to check for. If not provided, checks for any transformations.
|
|
56
|
+
* @returns true if the entity set has the required transformations, false otherwise.
|
|
57
|
+
*/
|
|
58
|
+
function hasAggregateTransformationsForEntitySet(entitySet, requiredTransformations) {
|
|
59
|
+
const transformations = entitySet.annotations?.Aggregation?.ApplySupported?.Transformations ||
|
|
60
|
+
entitySet.entityType?.annotations?.Aggregation?.ApplySupported?.Transformations;
|
|
61
|
+
if (!Array.isArray(transformations)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
// If no specific transformations required, return true if any transformations exist
|
|
65
|
+
if (!requiredTransformations || requiredTransformations.length === 0) {
|
|
66
|
+
return transformations.length > 0;
|
|
67
|
+
}
|
|
68
|
+
// Check if all required transformations are present
|
|
69
|
+
return requiredTransformations.every((transformation) => transformations.includes(transformation));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Determines table capabilities for a given entity set, analyzing its transformations and hierarchy.
|
|
73
|
+
*
|
|
74
|
+
* @param entitySet The entity set for which capabilities are being evaluated.
|
|
75
|
+
* @param requiredTransformations An optional array of required transformation names to be considered.
|
|
76
|
+
* @returns An object containing flags for aggregate transformations and recursive hierarchy specific to the entity set:
|
|
77
|
+
* - `hasAggregateTransformations`: Indicates if aggregate transformations are present in general.
|
|
78
|
+
* - `hasAggregateTransformationsForEntitySet`: Indicates if aggregate transformations are applicable to the specific entity set.
|
|
79
|
+
* - `hasRecursiveHierarchyForEntitySet`: Indicates if a recursive hierarchy is present for the specific entity set.
|
|
80
|
+
*/
|
|
81
|
+
function getTableCapabilitiesByEntitySet(entitySet, requiredTransformations) {
|
|
82
|
+
return {
|
|
83
|
+
hasAggregateTransformations: hasAggregateTransformations(entitySet),
|
|
84
|
+
hasAggregateTransformationsForEntitySet: hasAggregateTransformationsForEntitySet(entitySet, requiredTransformations),
|
|
85
|
+
hasRecursiveHierarchyForEntitySet: hasRecursiveHierarchyForEntitySet(entitySet)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=metadata.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/project-access",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.0",
|
|
4
4
|
"description": "Library to access SAP Fiori tools projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@sap-ux/ui5-config": "0.29.15"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
+
"@sap-ux/vocabularies-types": "0.14.5",
|
|
36
37
|
"@types/mem-fs": "1.1.2",
|
|
37
38
|
"@types/mem-fs-editor": "7.0.1",
|
|
38
39
|
"@types/semver": "7.7.1",
|