@sap-ux/project-access 1.36.4 → 1.38.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 CHANGED
@@ -1,7 +1,8 @@
1
1
  export { FileName, DirName, FioriToolsSettings, MinCdsPluginUi5Version, MinCdsVersion, fioriToolsDirectory } from './constants';
2
2
  export { getFilePaths, findFilesByExtension } from './file';
3
3
  export { normalizePath } from './path';
4
- export { addPackageDevDependency, clearCdsModuleCache, createApplicationAccess, createProjectAccess, deleteCapApp, filterDataSourcesByType, findAllApps, findCapProjectRoot, findCapProjects, findFioriArtifacts, findProjectRoot, findRootsForPath, getAllUi5YamlFileNames, getAppRootFromWebappPath, getAppProgrammingLanguage, getAppType, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapServiceName, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getCapI18nFolderNames, getSpecification, getSpecificationModuleFromCache, getSpecificationPath, getI18nPropertiesPaths, getI18nBundles, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getMtaPath, getMockServerConfig, getMockDataPath, getNodeModulesPath, getPathMappings, type PathMappings, getProject, getProjectType, getWebappPath, hasUI5CliV3, isCapProject, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, refreshSpecificationDistTags, toReferenceUri, updatePackageScript, getWorkspaceInfo, hasMinCdsVersion, checkCdsUi5PluginEnabled, readFlexChanges, processServices, getMainService, getGlobalCdsHomePath, isUI5IdUnique } from './project';
4
+ export { addPackageDevDependency, clearCdsModuleCache, createApplicationAccess, createProjectAccess, deleteCapApp, filterDataSourcesByType, findAllApps, findCapProjectRoot, findCapProjects, findFioriArtifacts, findProjectRoot, findRootsForPath, getAllUi5YamlFileNames, getAppRootFromWebappPath, getAppProgrammingLanguage, getAppType, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapServiceName, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getCapI18nFolderNames, getSpecification, getSpecificationModuleFromCache, getSpecificationPath, getI18nPropertiesPaths, getI18nBundles, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getMtaPath, getMockServerConfig, getMockDataPath, getNodeModulesPath, getPathMappings, type PathMappings, getProject, getProjectType, getWebappPath, hasUI5CliV3, isCapProject, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, refreshSpecificationDistTags, toReferenceUri, updatePackageScript, getWorkspaceInfo, hasMinCdsVersion, checkCdsUi5PluginEnabled, readFlexChanges, processServices, getMainService, getGlobalCdsHomePath, isUI5IdUnique, getUsedEntitiesFromManifest } from './project';
5
+ export type { UsedEntity } from './project';
5
6
  export { execNpmCommand } from './command/npm-command';
6
7
  export * from './types';
7
8
  export { checkDependencies, getReuseLibs } from './library';
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.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.findFilesByExtension = exports.getFilePaths = exports.fioriToolsDirectory = exports.MinCdsVersion = exports.MinCdsPluginUi5Version = exports.FioriToolsSettings = exports.DirName = exports.FileName = void 0;
18
- exports.hasDependency = exports.getTableCapabilitiesByEntitySet = exports.findRecursiveHierarchyKey = exports.getReuseLibs = exports.checkDependencies = exports.execNpmCommand = exports.isUI5IdUnique = exports.getGlobalCdsHomePath = 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 = exports.hasUI5CliV3 = void 0;
18
+ exports.hasDependency = exports.getTableCapabilitiesByEntitySet = exports.findRecursiveHierarchyKey = exports.getReuseLibs = exports.checkDependencies = exports.execNpmCommand = exports.getUsedEntitiesFromManifest = exports.isUI5IdUnique = exports.getGlobalCdsHomePath = 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 = exports.hasUI5CliV3 = 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; } });
@@ -88,6 +88,7 @@ Object.defineProperty(exports, "processServices", { enumerable: true, get: funct
88
88
  Object.defineProperty(exports, "getMainService", { enumerable: true, get: function () { return project_1.getMainService; } });
89
89
  Object.defineProperty(exports, "getGlobalCdsHomePath", { enumerable: true, get: function () { return project_1.getGlobalCdsHomePath; } });
90
90
  Object.defineProperty(exports, "isUI5IdUnique", { enumerable: true, get: function () { return project_1.isUI5IdUnique; } });
91
+ Object.defineProperty(exports, "getUsedEntitiesFromManifest", { enumerable: true, get: function () { return project_1.getUsedEntitiesFromManifest; } });
91
92
  var npm_command_1 = require("./command/npm-command");
92
93
  Object.defineProperty(exports, "execNpmCommand", { enumerable: true, get: function () { return npm_command_1.execNpmCommand; } });
93
94
  __exportStar(require("./types"), exports);
@@ -1,5 +1,6 @@
1
1
  export { clearCdsModuleCache, deleteCapApp, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapProjectType, getCapServiceName, getCdsFiles, getCdsRoots, getCdsServices, isCapProject, isCapJavaProject, isCapNodeJsProject, readCapServiceMetadataEdmx, toReferenceUri, getWorkspaceInfo, hasMinCdsVersion, checkCdsUi5PluginEnabled, processServices, getGlobalCdsHomePath } from './cap';
2
- export { filterDataSourcesByType, getMainService } from './service';
2
+ export { filterDataSourcesByType, getMainService, getUsedEntitiesFromManifest } from './service';
3
+ export type { UsedEntity } from './service';
3
4
  export { addPackageDevDependency, getNodeModulesPath, hasDependency } from './dependencies';
4
5
  export { getCapI18nFolderNames, getI18nPropertiesPaths, getI18nBundles } from './i18n';
5
6
  export { getAppProgrammingLanguage, getAppType, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getProject, getProjectType } from './info';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMtaPath = exports.getPathMappings = exports.getMockDataPath = exports.getMockServerConfig = exports.getAllUi5YamlFileNames = exports.readUi5Yaml = exports.getWebappPath = exports.findRootsForPath = exports.findCapProjectRoot = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getProjectType = exports.getProject = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getAppType = exports.getAppProgrammingLanguage = exports.getI18nBundles = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.hasDependency = exports.getNodeModulesPath = exports.addPackageDevDependency = exports.getMainService = exports.filterDataSourcesByType = exports.getGlobalCdsHomePath = exports.processServices = exports.checkCdsUi5PluginEnabled = exports.hasMinCdsVersion = exports.getWorkspaceInfo = exports.toReferenceUri = exports.readCapServiceMetadataEdmx = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapServiceName = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.deleteCapApp = exports.clearCdsModuleCache = void 0;
4
- exports.isUI5IdUnique = exports.readFlexChanges = exports.refreshSpecificationDistTags = exports.getSpecificationPath = exports.getSpecificationModuleFromCache = exports.getSpecification = exports.hasUI5CliV3 = exports.updatePackageScript = exports.createProjectAccess = exports.createApplicationAccess = void 0;
3
+ exports.getPathMappings = exports.getMockDataPath = exports.getMockServerConfig = exports.getAllUi5YamlFileNames = exports.readUi5Yaml = exports.getWebappPath = exports.findRootsForPath = exports.findCapProjectRoot = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getProjectType = exports.getProject = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getAppType = exports.getAppProgrammingLanguage = exports.getI18nBundles = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.hasDependency = exports.getNodeModulesPath = exports.addPackageDevDependency = exports.getUsedEntitiesFromManifest = exports.getMainService = exports.filterDataSourcesByType = exports.getGlobalCdsHomePath = exports.processServices = exports.checkCdsUi5PluginEnabled = exports.hasMinCdsVersion = exports.getWorkspaceInfo = exports.toReferenceUri = exports.readCapServiceMetadataEdmx = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapServiceName = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.deleteCapApp = exports.clearCdsModuleCache = void 0;
4
+ exports.isUI5IdUnique = exports.readFlexChanges = exports.refreshSpecificationDistTags = exports.getSpecificationPath = exports.getSpecificationModuleFromCache = exports.getSpecification = exports.hasUI5CliV3 = exports.updatePackageScript = exports.createProjectAccess = exports.createApplicationAccess = exports.getMtaPath = void 0;
5
5
  var cap_1 = require("./cap");
6
6
  Object.defineProperty(exports, "clearCdsModuleCache", { enumerable: true, get: function () { return cap_1.clearCdsModuleCache; } });
7
7
  Object.defineProperty(exports, "deleteCapApp", { enumerable: true, get: function () { return cap_1.deleteCapApp; } });
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "getGlobalCdsHomePath", { enumerable: true, get:
26
26
  var service_1 = require("./service");
27
27
  Object.defineProperty(exports, "filterDataSourcesByType", { enumerable: true, get: function () { return service_1.filterDataSourcesByType; } });
28
28
  Object.defineProperty(exports, "getMainService", { enumerable: true, get: function () { return service_1.getMainService; } });
29
+ Object.defineProperty(exports, "getUsedEntitiesFromManifest", { enumerable: true, get: function () { return service_1.getUsedEntitiesFromManifest; } });
29
30
  var dependencies_1 = require("./dependencies");
30
31
  Object.defineProperty(exports, "addPackageDevDependency", { enumerable: true, get: function () { return dependencies_1.addPackageDevDependency; } });
31
32
  Object.defineProperty(exports, "getNodeModulesPath", { enumerable: true, get: function () { return dependencies_1.getNodeModulesPath; } });
@@ -1,5 +1,9 @@
1
1
  import type { Manifest, ManifestNamespace, ServiceSpecification } from '../types';
2
2
  import type { Editor } from 'mem-fs-editor';
3
+ export interface UsedEntity {
4
+ service: string;
5
+ entity: string;
6
+ }
3
7
  /**
4
8
  * Get the main service name from the manifest.
5
9
  * LROP: by definition the service name can be read from the UI5 model with "" as name.
@@ -28,4 +32,12 @@ export declare function getServicesAndAnnotations(manifestPath: string, manifest
28
32
  * @returns {Record<string, ManifestNamespace.DataSource>} Data source IDs.
29
33
  */
30
34
  export declare function filterDataSourcesByType(dataSources: Record<string, ManifestNamespace.DataSource>, type: string): Record<string, ManifestNamespace.DataSource>;
35
+ /**
36
+ * Find used service entities by analyzing manifest.json
37
+ * Currently we do not return entities for Fiori element V2 apps and entities for Fiori Elements V4 apps that use contextPath instead of entitySet
38
+ *
39
+ * @param manifest - parsed manifest.json
40
+ * @returns - array of used entities, each with service URI and entity name
41
+ */
42
+ export declare function getUsedEntitiesFromManifest(manifest: Manifest): UsedEntity[];
31
43
  //# sourceMappingURL=service.d.ts.map
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMainService = getMainService;
4
4
  exports.getServicesAndAnnotations = getServicesAndAnnotations;
5
5
  exports.filterDataSourcesByType = filterDataSourcesByType;
6
+ exports.getUsedEntitiesFromManifest = getUsedEntitiesFromManifest;
6
7
  const node_path_1 = require("node:path");
7
8
  const file_1 = require("../file");
8
9
  /**
@@ -85,4 +86,69 @@ function getServiceSpecification(webappFolder, name, dataSources) {
85
86
  function filterDataSourcesByType(dataSources, type) {
86
87
  return Object.fromEntries(Object.entries(dataSources).filter(([, data]) => data.type === type));
87
88
  }
89
+ /**
90
+ * Extracts view paths from target settings if present.
91
+ *
92
+ * @param settings - target settings object
93
+ * @returns - array of view path entries, or empty array if not present
94
+ */
95
+ function getViewPaths(settings) {
96
+ if ('views' in settings &&
97
+ settings.views &&
98
+ typeof settings.views === 'object' &&
99
+ 'paths' in settings.views &&
100
+ Array.isArray(settings.views.paths)) {
101
+ return settings.views.paths;
102
+ }
103
+ return [];
104
+ }
105
+ /**
106
+ * Find used service entities by analyzing manifest.json
107
+ * Currently we do not return entities for Fiori element V2 apps and entities for Fiori Elements V4 apps that use contextPath instead of entitySet
108
+ *
109
+ * @param manifest - parsed manifest.json
110
+ * @returns - array of used entities, each with service URI and entity name
111
+ */
112
+ function getUsedEntitiesFromManifest(manifest) {
113
+ const targets = manifest['sap.ui5']?.routing?.targets;
114
+ if (!targets || typeof targets !== 'object') {
115
+ return [];
116
+ }
117
+ const mainService = getMainService(manifest) ?? '';
118
+ const mainServiceUri = manifest['sap.app']?.dataSources?.[mainService]?.uri ?? '';
119
+ const seen = new Set();
120
+ const usedEntities = [];
121
+ const addEntity = (entitySet) => {
122
+ if (typeof entitySet !== 'string') {
123
+ return;
124
+ }
125
+ const key = `${mainServiceUri}${entitySet}`;
126
+ if (!seen.has(key)) {
127
+ seen.add(key);
128
+ usedEntities.push({ service: mainServiceUri, entity: entitySet });
129
+ }
130
+ };
131
+ for (const targetName in targets) {
132
+ const target = targets[targetName];
133
+ // Resolve settings object with multiple safe checks
134
+ const settings = target.options && typeof target.options === 'object' && 'settings' in target.options
135
+ ? target.options.settings
136
+ : undefined;
137
+ if (!settings || typeof settings !== 'object') {
138
+ continue;
139
+ }
140
+ // Resolve entitySet from page
141
+ if ('entitySet' in settings) {
142
+ addEntity(settings.entitySet);
143
+ }
144
+ // Resolve entitySet from page views
145
+ const viewPaths = getViewPaths(settings);
146
+ for (const path of viewPaths) {
147
+ if (path && typeof path === 'object' && 'entitySet' in path) {
148
+ addEntity(path.entitySet);
149
+ }
150
+ }
151
+ }
152
+ return usedEntities;
153
+ }
88
154
  //# sourceMappingURL=service.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-access",
3
- "version": "1.36.4",
3
+ "version": "1.38.0",
4
4
  "description": "Library to access SAP Fiori tools projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "!dist/**/*.map"
21
21
  ],
22
22
  "engines": {
23
- "node": ">=20.x"
23
+ "node": ">=22.x"
24
24
  },
25
25
  "dependencies": {
26
26
  "fast-xml-parser": "5.8.0",
@@ -29,8 +29,8 @@
29
29
  "mem-fs": "2.1.0",
30
30
  "mem-fs-editor": "9.4.0",
31
31
  "semver": "7.7.4",
32
- "@sap-ux/i18n": "0.3.11",
33
- "@sap-ux/ui5-config": "0.30.4"
32
+ "@sap-ux/i18n": "0.4.0",
33
+ "@sap-ux/ui5-config": "0.31.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@sap-ux/vocabularies-types": "0.15.0",
@@ -39,7 +39,7 @@
39
39
  "@types/semver": "7.7.1",
40
40
  "@ui5/manifest": "1.85.0",
41
41
  "vscode-uri": "3.1.0",
42
- "@sap-ux/logger": "0.8.5"
42
+ "@sap-ux/logger": "0.9.0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsc --build",