@sap-ux/adp-tooling 0.18.66 → 0.18.68
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.
|
@@ -22,11 +22,12 @@ export declare function getBackendUrlsFromServiceKeys(serviceKeys: ServiceKeys[]
|
|
|
22
22
|
*
|
|
23
23
|
* @param {ServiceKeys[]} serviceKeys - The service keys containing endpoints with destinations.
|
|
24
24
|
* @param {string} basePath - Path to the .adp/reuse folder containing xs-app.json files.
|
|
25
|
-
* @returns {Array<{ url: string; paths: string[] }>} Array of URL-to-paths mappings.
|
|
25
|
+
* @returns {Array<{ url: string; paths: string[]; pathRewrite?: string }>} Array of URL-to-paths mappings with optional pathRewrite.
|
|
26
26
|
*/
|
|
27
27
|
export declare function getBackendUrlsWithPaths(serviceKeys: ServiceKeys[], basePath: string): Array<{
|
|
28
28
|
url: string;
|
|
29
29
|
paths: string[];
|
|
30
|
+
pathRewrite?: string;
|
|
30
31
|
}>;
|
|
31
32
|
/**
|
|
32
33
|
* Extract endpoint destinations from service keys.
|
package/dist/cf/app/discovery.js
CHANGED
|
@@ -91,13 +91,15 @@ function cleanRoutePath(source) {
|
|
|
91
91
|
while (path.includes('//')) {
|
|
92
92
|
path = path.replaceAll('//', '/');
|
|
93
93
|
}
|
|
94
|
+
// Remove trailing slash to ensure proper path matching
|
|
95
|
+
path = path.replace(/\/$/, '');
|
|
94
96
|
return path;
|
|
95
97
|
}
|
|
96
98
|
/**
|
|
97
|
-
* Process a route and
|
|
99
|
+
* Process a route and extract path and pathRewrite from source and target.
|
|
98
100
|
*
|
|
99
|
-
* @param {
|
|
100
|
-
* @param {Map<string, Set<string
|
|
101
|
+
* @param {XsAppRoute} route - The route object from xs-app.json.
|
|
102
|
+
* @param {Map<string, { paths: Set<string>; pathRewrite?: string }>} destinationToPaths - Map to store destination info.
|
|
101
103
|
*/
|
|
102
104
|
function processRouteForDestination(route, destinationToPaths) {
|
|
103
105
|
const destination = route.destination;
|
|
@@ -108,16 +110,24 @@ function processRouteForDestination(route, destinationToPaths) {
|
|
|
108
110
|
const path = cleanRoutePath(route.source);
|
|
109
111
|
if (path) {
|
|
110
112
|
if (!destinationToPaths.has(destination)) {
|
|
111
|
-
destinationToPaths.set(destination, new Set());
|
|
113
|
+
destinationToPaths.set(destination, { paths: new Set() });
|
|
114
|
+
}
|
|
115
|
+
const destInfo = destinationToPaths.get(destination);
|
|
116
|
+
destInfo.paths.add(path);
|
|
117
|
+
// Extract pathRewrite from target if available
|
|
118
|
+
if (route.target && typeof route.target === 'string') {
|
|
119
|
+
const pathRewrite = cleanRoutePath(route.target);
|
|
120
|
+
if (pathRewrite && !destInfo.pathRewrite) {
|
|
121
|
+
destInfo.pathRewrite = pathRewrite;
|
|
122
|
+
}
|
|
112
123
|
}
|
|
113
|
-
destinationToPaths.get(destination).add(path);
|
|
114
124
|
}
|
|
115
125
|
}
|
|
116
126
|
/**
|
|
117
|
-
* Extract destination to paths mapping from xs-app.json routes.
|
|
127
|
+
* Extract destination to paths mapping from xs-app.json routes with pathRewrite info.
|
|
118
128
|
*
|
|
119
129
|
* @param {string} xsAppPath - Path to xs-app.json file.
|
|
120
|
-
* @returns {Map<string, Set<string
|
|
130
|
+
* @returns {Map<string, { paths: Set<string>; pathRewrite?: string }>} Map of destination names to path info.
|
|
121
131
|
*/
|
|
122
132
|
function extractDestinationToPathsMap(xsAppPath) {
|
|
123
133
|
const destinationToPaths = new Map();
|
|
@@ -141,7 +151,7 @@ function extractDestinationToPathsMap(xsAppPath) {
|
|
|
141
151
|
*
|
|
142
152
|
* @param {ServiceKeys[]} serviceKeys - The service keys containing endpoints with destinations.
|
|
143
153
|
* @param {string} basePath - Path to the .adp/reuse folder containing xs-app.json files.
|
|
144
|
-
* @returns {Array<{ url: string; paths: string[] }>} Array of URL-to-paths mappings.
|
|
154
|
+
* @returns {Array<{ url: string; paths: string[]; pathRewrite?: string }>} Array of URL-to-paths mappings with optional pathRewrite.
|
|
145
155
|
*/
|
|
146
156
|
function getBackendUrlsWithPaths(serviceKeys, basePath) {
|
|
147
157
|
const destinationToUrl = extractDestinationToUrlMap(serviceKeys);
|
|
@@ -159,13 +169,17 @@ function getBackendUrlsWithPaths(serviceKeys, basePath) {
|
|
|
159
169
|
}
|
|
160
170
|
const destinationToPaths = extractDestinationToPathsMap(xsAppPath);
|
|
161
171
|
const result = [];
|
|
162
|
-
for (const [destination,
|
|
172
|
+
for (const [destination, pathInfo] of destinationToPaths.entries()) {
|
|
163
173
|
const url = destinationToUrl.get(destination);
|
|
164
174
|
if (url) {
|
|
165
|
-
|
|
175
|
+
const entry = {
|
|
166
176
|
url,
|
|
167
|
-
paths: Array.from(paths)
|
|
168
|
-
}
|
|
177
|
+
paths: Array.from(pathInfo.paths)
|
|
178
|
+
};
|
|
179
|
+
if (pathInfo.pathRewrite) {
|
|
180
|
+
entry.pathRewrite = pathInfo.pathRewrite;
|
|
181
|
+
}
|
|
182
|
+
result.push(entry);
|
|
169
183
|
}
|
|
170
184
|
}
|
|
171
185
|
return result;
|
package/dist/types.d.ts
CHANGED
|
@@ -751,7 +751,10 @@ export interface InboundChange {
|
|
|
751
751
|
*/
|
|
752
752
|
export interface XsAppRoute {
|
|
753
753
|
source: string;
|
|
754
|
+
target?: string;
|
|
755
|
+
destination?: string;
|
|
754
756
|
endpoint?: string;
|
|
757
|
+
service?: string;
|
|
755
758
|
[key: string]: unknown;
|
|
756
759
|
}
|
|
757
760
|
export interface XsApp {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.18.
|
|
12
|
+
"version": "0.18.68",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"@sap-ux/axios-extension": "1.25.14",
|
|
40
40
|
"@sap-ux/btp-utils": "1.1.9",
|
|
41
41
|
"@sap-ux/i18n": "0.3.7",
|
|
42
|
-
"@sap-ux/inquirer-common": "0.11.
|
|
42
|
+
"@sap-ux/inquirer-common": "0.11.9",
|
|
43
43
|
"@sap-ux/logger": "0.8.1",
|
|
44
|
-
"@sap-ux/nodejs-utils": "0.2.
|
|
45
|
-
"@sap-ux/odata-service-writer": "0.29.
|
|
46
|
-
"@sap-ux/project-access": "1.35.
|
|
47
|
-
"@sap-ux/project-input-validator": "0.6.
|
|
44
|
+
"@sap-ux/nodejs-utils": "0.2.16",
|
|
45
|
+
"@sap-ux/odata-service-writer": "0.29.21",
|
|
46
|
+
"@sap-ux/project-access": "1.35.6",
|
|
47
|
+
"@sap-ux/project-input-validator": "0.6.58",
|
|
48
48
|
"@sap-ux/store": "1.5.6",
|
|
49
49
|
"@sap-ux/system-access": "0.6.54",
|
|
50
|
-
"@sap-ux/ui5-config": "0.29.
|
|
51
|
-
"@sap-ux/ui5-info": "0.13.
|
|
50
|
+
"@sap-ux/ui5-config": "0.29.18",
|
|
51
|
+
"@sap-ux/ui5-info": "0.13.13"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/adm-zip": "0.5.5",
|