@sap-ux/preview-middleware 0.3.8 → 0.4.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/base/flp.d.ts +8 -1
- package/dist/base/flp.js +6 -6
- package/dist/types/index.d.ts +1 -1
- package/dist/ui5/middleware.js +2 -0
- package/package.json +3 -3
package/dist/base/flp.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { ReaderCollection } from '@ui5/fs';
|
|
2
|
+
import type { Router } from 'express';
|
|
2
3
|
import type { App, FlpConfig } from '../types';
|
|
3
4
|
import type { Logger } from '@sap-ux/logger';
|
|
4
5
|
import type { MiddlewareUtils } from '@ui5/server';
|
|
5
6
|
import type { Manifest, UI5FlexLayer } from '@sap-ux/project-access';
|
|
7
|
+
/**
|
|
8
|
+
* Enhanced request handler that exposes a list of endpoints for the cds-plugin-ui5.
|
|
9
|
+
*/
|
|
10
|
+
export type EnhancedRouter = Router & {
|
|
11
|
+
getAppPages?: () => string[];
|
|
12
|
+
};
|
|
6
13
|
/**
|
|
7
14
|
* Internal structure used to fill the sandbox.html template
|
|
8
15
|
*/
|
|
@@ -40,7 +47,7 @@ export declare class FlpSandbox {
|
|
|
40
47
|
private readonly logger;
|
|
41
48
|
protected templateConfig: TemplateConfig;
|
|
42
49
|
readonly config: FlpConfig;
|
|
43
|
-
readonly router:
|
|
50
|
+
readonly router: EnhancedRouter;
|
|
44
51
|
/**
|
|
45
52
|
* Constructor setting defaults and keeping reference to workspace resources.
|
|
46
53
|
*
|
package/dist/base/flp.js
CHANGED
|
@@ -186,12 +186,12 @@ class FlpSandbox {
|
|
|
186
186
|
});
|
|
187
187
|
const api = '/preview/api/changes';
|
|
188
188
|
this.router.use(api, (0, express_1.json)());
|
|
189
|
-
this.router.get(api, (_req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
this.router.get(api, ((_req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
190
190
|
res.status(200)
|
|
191
191
|
.contentType('application/json')
|
|
192
192
|
.send(yield (0, flex_1.readChanges)(this.project, this.logger));
|
|
193
|
-
}));
|
|
194
|
-
this.router.post(api, (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
})));
|
|
194
|
+
this.router.post(api, ((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
195
195
|
try {
|
|
196
196
|
const { success, message } = (0, flex_1.writeChange)(req.body, this.utils.getProject().getSourcePath(), this.logger);
|
|
197
197
|
if (success) {
|
|
@@ -204,8 +204,8 @@ class FlpSandbox {
|
|
|
204
204
|
catch (error) {
|
|
205
205
|
res.status(500).send(error.message);
|
|
206
206
|
}
|
|
207
|
-
}));
|
|
208
|
-
this.router.delete(api, (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
207
|
+
})));
|
|
208
|
+
this.router.delete(api, ((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
209
209
|
try {
|
|
210
210
|
const { success, message } = (0, flex_1.deleteChange)(req.body, this.utils.getProject().getSourcePath(), this.logger);
|
|
211
211
|
if (success) {
|
|
@@ -218,7 +218,7 @@ class FlpSandbox {
|
|
|
218
218
|
catch (error) {
|
|
219
219
|
res.status(500).send(error.message);
|
|
220
220
|
}
|
|
221
|
-
}));
|
|
221
|
+
})));
|
|
222
222
|
return [
|
|
223
223
|
{
|
|
224
224
|
applyConnector: workspaceConnectorPath,
|
package/dist/types/index.d.ts
CHANGED
package/dist/ui5/middleware.js
CHANGED
|
@@ -65,6 +65,8 @@ function createRouter({ resources, options, middlewareUtil }, logger) {
|
|
|
65
65
|
throw new Error('No manifest.json found.');
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
// add exposed endpoints for cds-plugin-ui5
|
|
69
|
+
flp.router.getAppPages = () => [`${flp.config.path}#${flp.config.intent.object}-${flp.config.intent.action}`];
|
|
68
70
|
return flp.router;
|
|
69
71
|
});
|
|
70
72
|
}
|
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%3Apreview-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.
|
|
12
|
+
"version": "0.4.0",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"ejs": "3.1.7",
|
|
26
26
|
"@sap-ux/logger": "0.3.7",
|
|
27
|
-
"@sap-ux/adp-tooling": "0.1.
|
|
27
|
+
"@sap-ux/adp-tooling": "0.1.6"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/ejs": "3.1.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"express": "4.18.2",
|
|
35
35
|
"nock": "13.2.1",
|
|
36
36
|
"supertest": "6.3.2",
|
|
37
|
-
"@sap-ux/project-access": "1.
|
|
37
|
+
"@sap-ux/project-access": "1.13.1",
|
|
38
38
|
"@sap-ux/store": "0.3.12"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|