@sap-ux/project-access 1.35.20 → 1.36.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,10 +1,10 @@
|
|
|
1
1
|
export { FileName, DirName, FioriToolsSettings, MinCdsPluginUi5Version, MinCdsVersion, fioriToolsDirectory } from './constants';
|
|
2
|
-
export { getFilePaths } from './file';
|
|
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 } 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 } from './project';
|
|
5
5
|
export { execNpmCommand } from './command/npm-command';
|
|
6
6
|
export * from './types';
|
|
7
|
-
export
|
|
7
|
+
export { checkDependencies, getReuseLibs } from './library';
|
|
8
8
|
export { findRecursiveHierarchyKey, getTableCapabilitiesByEntitySet } from './odata';
|
|
9
9
|
export { hasDependency } from './project';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.hasDependency = exports.getTableCapabilitiesByEntitySet = exports.findRecursiveHierarchyKey = exports.execNpmCommand = 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 = void 0;
|
|
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;
|
|
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; } });
|
|
@@ -25,6 +25,7 @@ Object.defineProperty(exports, "MinCdsVersion", { enumerable: true, get: functio
|
|
|
25
25
|
Object.defineProperty(exports, "fioriToolsDirectory", { enumerable: true, get: function () { return constants_1.fioriToolsDirectory; } });
|
|
26
26
|
var file_1 = require("./file");
|
|
27
27
|
Object.defineProperty(exports, "getFilePaths", { enumerable: true, get: function () { return file_1.getFilePaths; } });
|
|
28
|
+
Object.defineProperty(exports, "findFilesByExtension", { enumerable: true, get: function () { return file_1.findFilesByExtension; } });
|
|
28
29
|
var path_1 = require("./path");
|
|
29
30
|
Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return path_1.normalizePath; } });
|
|
30
31
|
var project_1 = require("./project");
|
|
@@ -86,10 +87,13 @@ Object.defineProperty(exports, "readFlexChanges", { enumerable: true, get: funct
|
|
|
86
87
|
Object.defineProperty(exports, "processServices", { enumerable: true, get: function () { return project_1.processServices; } });
|
|
87
88
|
Object.defineProperty(exports, "getMainService", { enumerable: true, get: function () { return project_1.getMainService; } });
|
|
88
89
|
Object.defineProperty(exports, "getGlobalCdsHomePath", { enumerable: true, get: function () { return project_1.getGlobalCdsHomePath; } });
|
|
90
|
+
Object.defineProperty(exports, "isUI5IdUnique", { enumerable: true, get: function () { return project_1.isUI5IdUnique; } });
|
|
89
91
|
var npm_command_1 = require("./command/npm-command");
|
|
90
92
|
Object.defineProperty(exports, "execNpmCommand", { enumerable: true, get: function () { return npm_command_1.execNpmCommand; } });
|
|
91
93
|
__exportStar(require("./types"), exports);
|
|
92
|
-
|
|
94
|
+
var library_1 = require("./library");
|
|
95
|
+
Object.defineProperty(exports, "checkDependencies", { enumerable: true, get: function () { return library_1.checkDependencies; } });
|
|
96
|
+
Object.defineProperty(exports, "getReuseLibs", { enumerable: true, get: function () { return library_1.getReuseLibs; } });
|
|
93
97
|
var odata_1 = require("./odata");
|
|
94
98
|
Object.defineProperty(exports, "findRecursiveHierarchyKey", { enumerable: true, get: function () { return odata_1.findRecursiveHierarchyKey; } });
|
|
95
99
|
Object.defineProperty(exports, "getTableCapabilitiesByEntitySet", { enumerable: true, get: function () { return odata_1.getTableCapabilitiesByEntitySet; } });
|
package/dist/project/index.d.ts
CHANGED
|
@@ -11,4 +11,5 @@ export { createApplicationAccess, createProjectAccess } from './access';
|
|
|
11
11
|
export { updatePackageScript, hasUI5CliV3 } from './script';
|
|
12
12
|
export { getSpecification, getSpecificationModuleFromCache, getSpecificationPath, refreshSpecificationDistTags } from './specification';
|
|
13
13
|
export { readFlexChanges } from './flex-changes';
|
|
14
|
+
export { isUI5IdUnique } from './ui5-xml-id-validator';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/project/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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.readFlexChanges = exports.refreshSpecificationDistTags = exports.getSpecificationPath = exports.getSpecificationModuleFromCache = exports.getSpecification = exports.hasUI5CliV3 = exports.updatePackageScript = exports.createProjectAccess = exports.createApplicationAccess = 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;
|
|
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; } });
|
|
@@ -74,4 +74,6 @@ Object.defineProperty(exports, "getSpecificationPath", { enumerable: true, get:
|
|
|
74
74
|
Object.defineProperty(exports, "refreshSpecificationDistTags", { enumerable: true, get: function () { return specification_1.refreshSpecificationDistTags; } });
|
|
75
75
|
var flex_changes_1 = require("./flex-changes");
|
|
76
76
|
Object.defineProperty(exports, "readFlexChanges", { enumerable: true, get: function () { return flex_changes_1.readFlexChanges; } });
|
|
77
|
+
var ui5_xml_id_validator_1 = require("./ui5-xml-id-validator");
|
|
78
|
+
Object.defineProperty(exports, "isUI5IdUnique", { enumerable: true, get: function () { return ui5_xml_id_validator_1.isUI5IdUnique; } });
|
|
77
79
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a UI5 control ID is unique across XML files (fragments and views).
|
|
3
|
+
*
|
|
4
|
+
* @param id - ID to check
|
|
5
|
+
* @param files - Array of XML file contents to check
|
|
6
|
+
* @returns true if the id is unique (available), false if it already exists
|
|
7
|
+
*/
|
|
8
|
+
export declare function isUI5IdUnique(id: string, files: string[]): boolean;
|
|
9
|
+
//# sourceMappingURL=ui5-xml-id-validator.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isUI5IdUnique = isUI5IdUnique;
|
|
4
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
5
|
+
/**
|
|
6
|
+
* Recursively checks if an object (parsed XML) contains an element with the specified id attribute.
|
|
7
|
+
*
|
|
8
|
+
* @param obj - parsed XML object to search in
|
|
9
|
+
* @param id - id to search for
|
|
10
|
+
* @param attrPrefix - attribute prefix used by the parser (default: '@_')
|
|
11
|
+
* @returns true if an element with the id is found
|
|
12
|
+
*/
|
|
13
|
+
function hasElementWithId(obj, id, attrPrefix = '@_') {
|
|
14
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const objRecord = obj;
|
|
18
|
+
const idAttr = `${attrPrefix}id`;
|
|
19
|
+
// Check if this element has the id attribute
|
|
20
|
+
if (objRecord[idAttr] === id) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
for (const key in objRecord) {
|
|
24
|
+
if (key.startsWith(attrPrefix)) {
|
|
25
|
+
continue; // Skip attributes
|
|
26
|
+
}
|
|
27
|
+
if (checkIdInValue(objRecord[key], id, attrPrefix)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Checks if a value (object or array) contains an element with the specified id.
|
|
35
|
+
*
|
|
36
|
+
* @param value - value to check (can be array or object)
|
|
37
|
+
* @param id - id to search for
|
|
38
|
+
* @param attrPrefix - attribute prefix used by the parser
|
|
39
|
+
* @returns true if id is found in the value
|
|
40
|
+
*/
|
|
41
|
+
function checkIdInValue(value, id, attrPrefix) {
|
|
42
|
+
if (Array.isArray(value)) {
|
|
43
|
+
return value.some((item) => hasElementWithId(item, id, attrPrefix));
|
|
44
|
+
}
|
|
45
|
+
if (typeof value === 'object' && value !== null) {
|
|
46
|
+
return hasElementWithId(value, id, attrPrefix);
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Checks if an element with the specified id is available (does not exist) in the XML content.
|
|
52
|
+
*
|
|
53
|
+
* @param id - id to check for availability
|
|
54
|
+
* @param xmlContent - XML content as string
|
|
55
|
+
* @returns true if the id is available (not found), false if it exists
|
|
56
|
+
*/
|
|
57
|
+
function checkElementIdAvailable(id, xmlContent) {
|
|
58
|
+
const parser = new fast_xml_parser_1.XMLParser({
|
|
59
|
+
ignoreAttributes: false,
|
|
60
|
+
attributeNamePrefix: '@_',
|
|
61
|
+
parseAttributeValue: false
|
|
62
|
+
});
|
|
63
|
+
try {
|
|
64
|
+
const xmlDocument = parser.parse(xmlContent);
|
|
65
|
+
return xmlDocument ? !hasElementWithId(xmlDocument, id) : true;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Parse error = no valid document = no element with id
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Checks if a UI5 control ID is unique across XML files (fragments and views).
|
|
74
|
+
*
|
|
75
|
+
* @param id - ID to check
|
|
76
|
+
* @param files - Array of XML file contents to check
|
|
77
|
+
* @returns true if the id is unique (available), false if it already exists
|
|
78
|
+
*/
|
|
79
|
+
function isUI5IdUnique(id, files) {
|
|
80
|
+
return files.every((content) => content === '' || checkElementIdAvailable(id, content));
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=ui5-xml-id-validator.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.36.0",
|
|
4
4
|
"description": "Library to access SAP Fiori tools projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@types/mem-fs": "1.1.2",
|
|
38
38
|
"@types/mem-fs-editor": "7.0.1",
|
|
39
39
|
"@types/semver": "7.7.1",
|
|
40
|
-
"@ui5/manifest": "1.
|
|
40
|
+
"@ui5/manifest": "1.85.0",
|
|
41
41
|
"vscode-uri": "3.1.0",
|
|
42
42
|
"@sap-ux/logger": "0.8.5"
|
|
43
43
|
},
|