@sap-ux/project-access 1.32.7 → 1.32.9
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/README.md +3 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -3
- package/dist/project/access.js +64 -0
- package/dist/project/cap.js +3 -4
- package/dist/types/access/index.d.ts +24 -1
- package/dist/types/webapp/index.d.ts +4 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
[](https://github.com/SAP/open-ux-tools/blob/main/packages/project-access/CHANGELOG.md) [](https://github.com/SAP/open-ux-tools/tree/main/packages/project-access)
|
|
2
|
+
|
|
3
|
+
# [`@sap-ux/project-access`](https://github.com/SAP/open-ux-tools/tree/main/packages/project-access)
|
|
2
4
|
|
|
3
5
|
Library that offers functions to find, read, and retrieve project information and artifacts.
|
|
4
6
|
|
package/dist/constants.d.ts
CHANGED
|
@@ -61,5 +61,6 @@ export declare const fioriToolsDirectory: string;
|
|
|
61
61
|
* Directory where modules are cached
|
|
62
62
|
*/
|
|
63
63
|
export declare const moduleCacheRoot: string;
|
|
64
|
-
export declare const
|
|
64
|
+
export declare const MinCdsPluginUi5Version = "0.13.0";
|
|
65
|
+
export declare const MinCdsVersion = "6.8.2";
|
|
65
66
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MinCdsVersion = exports.MinCdsPluginUi5Version = exports.moduleCacheRoot = exports.fioriToolsDirectory = exports.SchemaName = exports.FioriToolsSettings = exports.DirName = exports.FileName = void 0;
|
|
4
4
|
const node_os_1 = require("node:os");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
exports.FileName = {
|
|
@@ -66,5 +66,6 @@ exports.fioriToolsDirectory = (0, node_path_1.join)((0, node_os_1.homedir)(), ex
|
|
|
66
66
|
* Directory where modules are cached
|
|
67
67
|
*/
|
|
68
68
|
exports.moduleCacheRoot = (0, node_path_1.join)(exports.fioriToolsDirectory, exports.DirName.ModuleCache);
|
|
69
|
-
exports.
|
|
69
|
+
exports.MinCdsPluginUi5Version = '0.13.0';
|
|
70
|
+
exports.MinCdsVersion = '6.8.2';
|
|
70
71
|
//# sourceMappingURL=constants.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { FileName, DirName, FioriToolsSettings,
|
|
1
|
+
export { FileName, DirName, FioriToolsSettings, MinCdsPluginUi5Version, MinCdsVersion } from './constants';
|
|
2
2
|
export { getFilePaths } from './file';
|
|
3
3
|
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, getSpecificationPath, getI18nPropertiesPaths, getI18nBundles, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getMtaPath, getMockServerConfig, getMockDataPath, getNodeModulesPath, getProject, getProjectType, getWebappPath, hasUI5CliV3, isCapProject, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml, refreshSpecificationDistTags, toReferenceUri, updatePackageScript, getWorkspaceInfo, hasMinCdsVersion, checkCdsUi5PluginEnabled, readFlexChanges } from './project';
|
|
4
4
|
export { execNpmCommand } from './command/npm-command';
|
package/dist/index.js
CHANGED
|
@@ -14,13 +14,14 @@ 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.execNpmCommand = exports.readFlexChanges = exports.checkCdsUi5PluginEnabled = exports.hasMinCdsVersion = exports.getWorkspaceInfo = exports.updatePackageScript = exports.toReferenceUri = exports.refreshSpecificationDistTags = exports.readUi5Yaml = void 0;
|
|
17
|
+
exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.hasUI5CliV3 = exports.getWebappPath = exports.getProjectType = exports.getProject = exports.getNodeModulesPath = exports.getMockDataPath = exports.getMockServerConfig = exports.getMtaPath = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getI18nBundles = exports.getI18nPropertiesPaths = exports.getSpecificationPath = 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.getFilePaths = exports.MinCdsVersion = exports.MinCdsPluginUi5Version = exports.FioriToolsSettings = exports.DirName = exports.FileName = void 0;
|
|
18
|
+
exports.hasDependency = exports.execNpmCommand = exports.readFlexChanges = exports.checkCdsUi5PluginEnabled = exports.hasMinCdsVersion = exports.getWorkspaceInfo = exports.updatePackageScript = exports.toReferenceUri = exports.refreshSpecificationDistTags = exports.readUi5Yaml = exports.readCapServiceMetadataEdmx = 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; } });
|
|
22
22
|
Object.defineProperty(exports, "FioriToolsSettings", { enumerable: true, get: function () { return constants_1.FioriToolsSettings; } });
|
|
23
|
-
Object.defineProperty(exports, "
|
|
23
|
+
Object.defineProperty(exports, "MinCdsPluginUi5Version", { enumerable: true, get: function () { return constants_1.MinCdsPluginUi5Version; } });
|
|
24
|
+
Object.defineProperty(exports, "MinCdsVersion", { enumerable: true, get: function () { return constants_1.MinCdsVersion; } });
|
|
24
25
|
var file_1 = require("./file");
|
|
25
26
|
Object.defineProperty(exports, "getFilePaths", { enumerable: true, get: function () { return file_1.getFilePaths; } });
|
|
26
27
|
var project_1 = require("./project");
|
package/dist/project/access.js
CHANGED
|
@@ -9,6 +9,8 @@ const search_1 = require("./search");
|
|
|
9
9
|
const file_1 = require("../file");
|
|
10
10
|
const constants_1 = require("../constants");
|
|
11
11
|
const specification_1 = require("./specification");
|
|
12
|
+
const flex_changes_1 = require("./flex-changes");
|
|
13
|
+
const cap_1 = require("./cap");
|
|
12
14
|
/**
|
|
13
15
|
*
|
|
14
16
|
*/
|
|
@@ -163,6 +165,68 @@ class ApplicationAccessImp {
|
|
|
163
165
|
async updateManifestJSON(manifest, memFs) {
|
|
164
166
|
await (0, file_1.updateManifestJSON)(this.app.manifest, manifest, memFs ?? this.options?.fs);
|
|
165
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Reads and returns the parsed `manifest.json` file for the application.
|
|
170
|
+
*
|
|
171
|
+
* @param memFs - optional mem-fs-editor instance
|
|
172
|
+
* @returns A promise resolving to the parsed `manifest.json` content.
|
|
173
|
+
*/
|
|
174
|
+
async readManifest(memFs) {
|
|
175
|
+
return (0, file_1.readJSON)(this.app.manifest, memFs ?? this.options?.fs);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Reads and returns all Flex Changes (`*.change` files) associated with the application.
|
|
179
|
+
*
|
|
180
|
+
* @param memFs - optional mem-fs-editor instance
|
|
181
|
+
* @returns A promise that resolves to an array of flex change files.
|
|
182
|
+
*/
|
|
183
|
+
async readFlexChanges(memFs) {
|
|
184
|
+
return (0, flex_changes_1.readFlexChanges)(this.app.changes, memFs ?? this.options?.fs);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Reads and returns all annotation files associated with the application's main service.
|
|
188
|
+
*
|
|
189
|
+
* @param memFs - optional mem-fs-editor instance
|
|
190
|
+
* @returns A promise resolving to an array of annotation file descriptors.
|
|
191
|
+
*/
|
|
192
|
+
async readAnnotationFiles(memFs) {
|
|
193
|
+
const annotationData = [];
|
|
194
|
+
const mainServiceName = this.app.mainService ?? 'mainService';
|
|
195
|
+
const mainService = this.app?.services?.[mainServiceName];
|
|
196
|
+
if (!mainService) {
|
|
197
|
+
return [];
|
|
198
|
+
}
|
|
199
|
+
if (mainService.uri && (this.projectType === 'CAPJava' || this.projectType === 'CAPNodejs')) {
|
|
200
|
+
const serviceUri = mainService?.uri ?? '';
|
|
201
|
+
if (serviceUri) {
|
|
202
|
+
const edmx = await (0, cap_1.readCapServiceMetadataEdmx)(this.root, serviceUri);
|
|
203
|
+
annotationData.push({
|
|
204
|
+
fileContent: edmx,
|
|
205
|
+
dataSourceUri: serviceUri
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
if (mainService.local) {
|
|
211
|
+
const serviceFile = await (0, file_1.readFile)(mainService.local, memFs ?? this.options?.fs);
|
|
212
|
+
annotationData.push({
|
|
213
|
+
dataSourceUri: mainService.local,
|
|
214
|
+
fileContent: serviceFile.toString()
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const { annotations = [] } = mainService;
|
|
218
|
+
for (const annotation of annotations) {
|
|
219
|
+
if (annotation.local) {
|
|
220
|
+
const annotationFile = await (0, file_1.readFile)(annotation.local, memFs ?? this.options?.fs);
|
|
221
|
+
annotationData.push({
|
|
222
|
+
dataSourceUri: annotation.local,
|
|
223
|
+
fileContent: annotationFile.toString()
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return annotationData;
|
|
229
|
+
}
|
|
166
230
|
/**
|
|
167
231
|
* Project structure.
|
|
168
232
|
*
|
package/dist/project/cap.js
CHANGED
|
@@ -750,7 +750,7 @@ async function checkCdsUi5PluginEnabled(basePath, fs, moreInfo, cdsVersionInfo)
|
|
|
750
750
|
// If it does, it uses that version information to determine if it satisfies the minimum CDS version required.
|
|
751
751
|
// If 'cdsVersionInfo' is not available or does not contain version information,it falls back to check the version specified in the package.json file.
|
|
752
752
|
hasMinCdsVersion: cdsVersionInfo?.version
|
|
753
|
-
? (0, semver_1.satisfies)(cdsVersionInfo?.version, `>=${constants_1.
|
|
753
|
+
? (0, semver_1.satisfies)(cdsVersionInfo?.version, `>=${constants_1.MinCdsVersion}`)
|
|
754
754
|
: satisfiesMinCdsVersion(packageJson),
|
|
755
755
|
isWorkspaceEnabled: workspaceEnabled,
|
|
756
756
|
hasCdsUi5Plugin: (0, dependencies_1.hasDependency)(packageJson, 'cds-plugin-ui5'),
|
|
@@ -798,8 +798,7 @@ function getWorkspacePackages(packageJson) {
|
|
|
798
798
|
* @returns - true: cds version satisfies the min cds version; false: cds version does not satisfy min cds version
|
|
799
799
|
*/
|
|
800
800
|
function satisfiesMinCdsVersion(packageJson) {
|
|
801
|
-
return
|
|
802
|
-
(0, semver_1.satisfies)(constants_1.MinCdsVersionUi5Plugin, packageJson.dependencies?.['@sap/cds'] ?? '0.0.0'));
|
|
801
|
+
return hasMinCdsVersion(packageJson) || (0, semver_1.satisfies)(constants_1.MinCdsVersion, packageJson.dependencies?.['@sap/cds'] ?? '0.0.0');
|
|
803
802
|
}
|
|
804
803
|
/**
|
|
805
804
|
* Check if package.json has dependency to the minimum min version of @sap/cds,
|
|
@@ -809,6 +808,6 @@ function satisfiesMinCdsVersion(packageJson) {
|
|
|
809
808
|
* @returns - true: min cds version is present; false: cds version needs update
|
|
810
809
|
*/
|
|
811
810
|
function hasMinCdsVersion(packageJson) {
|
|
812
|
-
return (0, semver_1.gte)((0, semver_1.coerce)(packageJson.dependencies?.['@sap/cds']) ?? '0.0.0', constants_1.
|
|
811
|
+
return (0, semver_1.gte)((0, semver_1.coerce)(packageJson.dependencies?.['@sap/cds']) ?? '0.0.0', constants_1.MinCdsVersion);
|
|
813
812
|
}
|
|
814
813
|
//# sourceMappingURL=cap.js.map
|
|
@@ -4,7 +4,7 @@ import type { I18nBundles } from '../i18n';
|
|
|
4
4
|
import type { ApplicationStructure, I18nPropertiesPaths, Project, ProjectType } from '../info';
|
|
5
5
|
import type { Editor } from 'mem-fs-editor';
|
|
6
6
|
import type { Package } from '../package';
|
|
7
|
-
import type { Manifest } from '../webapp';
|
|
7
|
+
import type { AnnotationFile, Manifest } from '../webapp';
|
|
8
8
|
interface BaseAccess {
|
|
9
9
|
readonly project: Project;
|
|
10
10
|
readonly root: string;
|
|
@@ -117,6 +117,29 @@ export interface ApplicationAccess extends BaseAccess {
|
|
|
117
117
|
* @param memFs - optional mem-fs-editor instance
|
|
118
118
|
*/
|
|
119
119
|
updateManifestJSON(manifest: Manifest, memFs?: Editor): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Reads and returns the parsed `manifest.json` file for the application.
|
|
122
|
+
*
|
|
123
|
+
* @param memFs - optional mem-fs-editor instance
|
|
124
|
+
* @returns A promise resolving to the parsed `manifest.json` content.
|
|
125
|
+
*/
|
|
126
|
+
readManifest(memFs?: Editor): Promise<Manifest>;
|
|
127
|
+
/**
|
|
128
|
+
* Reads and returns all Flex Changes (`*.change` files) associated with the application.
|
|
129
|
+
*
|
|
130
|
+
* @param memFs - optional mem-fs-editor instance
|
|
131
|
+
* @returns A promise that resolves to an array of flex change files.
|
|
132
|
+
*/
|
|
133
|
+
readFlexChanges(memFs?: Editor): Promise<{
|
|
134
|
+
[key: string]: string;
|
|
135
|
+
}>;
|
|
136
|
+
/**
|
|
137
|
+
* Reads and returns all annotation files associated with the application's main service.
|
|
138
|
+
*
|
|
139
|
+
* @param memFs - optional mem-fs-editor instance
|
|
140
|
+
* @returns A promise resolving to an array of annotation file descriptors.
|
|
141
|
+
*/
|
|
142
|
+
readAnnotationFiles(memFs?: Editor): Promise<AnnotationFile[]>;
|
|
120
143
|
}
|
|
121
144
|
export interface ProjectAccessOptions {
|
|
122
145
|
logger?: Logger;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type * as ManifestNamespace from '@ui5/manifest/types/manifest';
|
|
2
2
|
export { ManifestNamespace };
|
|
3
3
|
export type Manifest = ManifestNamespace.SAPJSONSchemaForWebApplicationManifestFile;
|
|
4
|
+
export interface AnnotationFile {
|
|
5
|
+
dataSourceUri: string;
|
|
6
|
+
fileContent: string;
|
|
7
|
+
}
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/project-access",
|
|
3
|
-
"version": "1.32.
|
|
3
|
+
"version": "1.32.9",
|
|
4
4
|
"description": "Library to access SAP Fiori tools projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"mem-fs": "2.1.0",
|
|
30
30
|
"mem-fs-editor": "9.4.0",
|
|
31
31
|
"semver": "7.5.4",
|
|
32
|
-
"@sap-ux/i18n": "0.3.
|
|
33
|
-
"@sap-ux/ui5-config": "0.29.
|
|
32
|
+
"@sap-ux/i18n": "0.3.5",
|
|
33
|
+
"@sap-ux/ui5-config": "0.29.9"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/mem-fs": "1.1.2",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@types/semver": "7.5.2",
|
|
39
39
|
"@ui5/manifest": "1.76.0",
|
|
40
40
|
"vscode-uri": "3.0.7",
|
|
41
|
-
"@sap-ux/logger": "0.7.
|
|
41
|
+
"@sap-ux/logger": "0.7.1"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsc --build",
|