@sap-ux/preview-middleware 0.8.3 → 0.8.5
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 +13 -1
- package/dist/base/flp.js +41 -2
- package/dist/base/index.d.ts +1 -1
- package/dist/base/index.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/ui5/middleware.js +1 -38
- package/package.json +4 -4
package/dist/base/flp.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ReaderCollection } from '@ui5/fs';
|
|
2
2
|
import type { Router } from 'express';
|
|
3
3
|
import type { App, FlpConfig, MiddlewareConfig, RtaConfig } from '../types';
|
|
4
|
-
import type { Logger } from '@sap-ux/logger';
|
|
4
|
+
import type { Logger, ToolsLogger } from '@sap-ux/logger';
|
|
5
5
|
import type { MiddlewareUtils } from '@ui5/server';
|
|
6
6
|
import type { Manifest, UI5FlexLayer } from '@sap-ux/project-access';
|
|
7
|
+
import { type AdpPreviewConfig } from '@sap-ux/adp-tooling';
|
|
7
8
|
/**
|
|
8
9
|
* Enhanced request handler that exposes a list of endpoints for the cds-plugin-ui5.
|
|
9
10
|
*/
|
|
@@ -17,6 +18,7 @@ export interface CustomConnector {
|
|
|
17
18
|
}
|
|
18
19
|
export interface FlexConnector {
|
|
19
20
|
connector: string;
|
|
21
|
+
layers: string[];
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Internal structure used to fill the sandbox.html template
|
|
@@ -115,4 +117,14 @@ export declare class FlpSandbox {
|
|
|
115
117
|
*/
|
|
116
118
|
addApp(manifest: Manifest, app: App): void;
|
|
117
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Initialize the preview for an adaptation project.
|
|
122
|
+
*
|
|
123
|
+
* @param rootProject reference to the project
|
|
124
|
+
* @param config configuration from the ui5.yaml
|
|
125
|
+
* @param flp FlpSandbox instance
|
|
126
|
+
* @param util middleware utilities provided by the UI5 CLI
|
|
127
|
+
* @param logger logger instance
|
|
128
|
+
*/
|
|
129
|
+
export declare function initAdp(rootProject: ReaderCollection, config: AdpPreviewConfig, flp: FlpSandbox, util: MiddlewareUtils, logger: ToolsLogger): Promise<void>;
|
|
118
130
|
//# sourceMappingURL=flp.d.ts.map
|
package/dist/base/flp.js
CHANGED
|
@@ -9,12 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.FlpSandbox = void 0;
|
|
12
|
+
exports.initAdp = exports.FlpSandbox = void 0;
|
|
13
13
|
const ejs_1 = require("ejs");
|
|
14
14
|
const fs_1 = require("fs");
|
|
15
15
|
const path_1 = require("path");
|
|
16
16
|
const express_1 = require("express");
|
|
17
17
|
const flex_1 = require("./flex");
|
|
18
|
+
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
18
19
|
const DEVELOPER_MODE_CONFIG = new Map([
|
|
19
20
|
// Run application in design time mode
|
|
20
21
|
// Adds bindingString to BindingInfo objects. Required to create and read PropertyBinding changes
|
|
@@ -282,7 +283,8 @@ class FlpSandbox {
|
|
|
282
283
|
custom: true
|
|
283
284
|
},
|
|
284
285
|
{
|
|
285
|
-
connector: 'LocalStorageConnector'
|
|
286
|
+
connector: 'LocalStorageConnector',
|
|
287
|
+
layers: ['CUSTOMER', 'USER']
|
|
286
288
|
}
|
|
287
289
|
];
|
|
288
290
|
}
|
|
@@ -334,4 +336,41 @@ function serializeDataAttributes(attributes, indent = '', prefix = 'data') {
|
|
|
334
336
|
function serializeUi5Configuration(config) {
|
|
335
337
|
return '\n' + serializeDataAttributes(config, ' ', 'data-sap-ui');
|
|
336
338
|
}
|
|
339
|
+
/**
|
|
340
|
+
* Initialize the preview for an adaptation project.
|
|
341
|
+
*
|
|
342
|
+
* @param rootProject reference to the project
|
|
343
|
+
* @param config configuration from the ui5.yaml
|
|
344
|
+
* @param flp FlpSandbox instance
|
|
345
|
+
* @param util middleware utilities provided by the UI5 CLI
|
|
346
|
+
* @param logger logger instance
|
|
347
|
+
*/
|
|
348
|
+
function initAdp(rootProject, config, flp, util, logger) {
|
|
349
|
+
var _a;
|
|
350
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
351
|
+
const appVariant = yield rootProject.byPath('/manifest.appdescr_variant');
|
|
352
|
+
if (appVariant) {
|
|
353
|
+
const adp = new adp_tooling_1.AdpPreview(config, rootProject, util, logger);
|
|
354
|
+
const variant = JSON.parse(yield appVariant.getString());
|
|
355
|
+
const layer = yield adp.init(variant);
|
|
356
|
+
if (flp.rta) {
|
|
357
|
+
flp.rta.layer = layer;
|
|
358
|
+
flp.rta.options = {
|
|
359
|
+
projectId: variant.id,
|
|
360
|
+
scenario: 'ADAPTATION_PROJECT'
|
|
361
|
+
};
|
|
362
|
+
for (const editor of flp.rta.editors) {
|
|
363
|
+
(_a = editor.pluginScript) !== null && _a !== void 0 ? _a : (editor.pluginScript = 'open/ux/preview/client/adp/init');
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
yield flp.init(adp.descriptor.manifest, adp.descriptor.name, adp.resources);
|
|
367
|
+
flp.router.use(adp.descriptor.url, adp.proxy.bind(adp));
|
|
368
|
+
adp.addApis(flp.router);
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
throw new Error('ADP configured but no manifest.appdescr_variant found.');
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
exports.initAdp = initAdp;
|
|
337
376
|
//# sourceMappingURL=flp.js.map
|
package/dist/base/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { FlpSandbox } from './flp';
|
|
1
|
+
export { FlpSandbox, initAdp } from './flp';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/base/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlpSandbox = void 0;
|
|
3
|
+
exports.initAdp = exports.FlpSandbox = void 0;
|
|
4
4
|
var flp_1 = require("./flp");
|
|
5
5
|
Object.defineProperty(exports, "FlpSandbox", { enumerable: true, get: function () { return flp_1.FlpSandbox; } });
|
|
6
|
+
Object.defineProperty(exports, "initAdp", { enumerable: true, get: function () { return flp_1.initAdp; } });
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,8 +14,9 @@ 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.FlpSandbox = void 0;
|
|
17
|
+
exports.initAdp = exports.FlpSandbox = void 0;
|
|
18
18
|
__exportStar(require("./ui5/middleware"), exports);
|
|
19
19
|
var base_1 = require("./base");
|
|
20
20
|
Object.defineProperty(exports, "FlpSandbox", { enumerable: true, get: function () { return base_1.FlpSandbox; } });
|
|
21
|
+
Object.defineProperty(exports, "initAdp", { enumerable: true, get: function () { return base_1.initAdp; } });
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/dist/ui5/middleware.js
CHANGED
|
@@ -11,43 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const logger_1 = require("@sap-ux/logger");
|
|
13
13
|
const flp_1 = require("../base/flp");
|
|
14
|
-
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
15
|
-
/**
|
|
16
|
-
* Initialize the preview for an adaptation project.
|
|
17
|
-
*
|
|
18
|
-
* @param rootProject reference to the project
|
|
19
|
-
* @param config configuration from the ui5.yaml
|
|
20
|
-
* @param flp FlpSandbox instance
|
|
21
|
-
* @param util middleware utilities provided by the UI5 CLI
|
|
22
|
-
* @param logger logger instance
|
|
23
|
-
*/
|
|
24
|
-
function initAdp(rootProject, config, flp, util, logger) {
|
|
25
|
-
var _a;
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const appVariant = yield rootProject.byPath('/manifest.appdescr_variant');
|
|
28
|
-
if (appVariant) {
|
|
29
|
-
const adp = new adp_tooling_1.AdpPreview(config, rootProject, util, logger);
|
|
30
|
-
const variant = JSON.parse(yield appVariant.getString());
|
|
31
|
-
const layer = yield adp.init(variant);
|
|
32
|
-
if (flp.rta) {
|
|
33
|
-
flp.rta.layer = layer;
|
|
34
|
-
flp.rta.options = {
|
|
35
|
-
projectId: variant.id,
|
|
36
|
-
scenario: 'ADAPTATION_PROJECT'
|
|
37
|
-
};
|
|
38
|
-
for (const editor of flp.rta.editors) {
|
|
39
|
-
(_a = editor.pluginScript) !== null && _a !== void 0 ? _a : (editor.pluginScript = 'open/ux/preview/client/adp/init');
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
yield flp.init(adp.descriptor.manifest, adp.descriptor.name, adp.resources);
|
|
43
|
-
flp.router.use(adp.descriptor.url, adp.proxy.bind(adp));
|
|
44
|
-
adp.addApis(flp.router);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
throw new Error('ADP configured but no manifest.appdescr_variant found.');
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
14
|
/**
|
|
52
15
|
* The developer mode is only supported for adaptation projects, therefore, notify the user if it is wrongly configured and then disable it.
|
|
53
16
|
*
|
|
@@ -85,7 +48,7 @@ function createRouter({ resources, options, middlewareUtil }, logger) {
|
|
|
85
48
|
// configure the FLP sandbox based on information from the manifest
|
|
86
49
|
const flp = new flp_1.FlpSandbox(config, resources.rootProject, middlewareUtil, logger);
|
|
87
50
|
if (config.adp) {
|
|
88
|
-
yield initAdp(resources.rootProject, config.adp, flp, middlewareUtil, logger);
|
|
51
|
+
yield (0, flp_1.initAdp)(resources.rootProject, config.adp, flp, middlewareUtil, logger);
|
|
89
52
|
}
|
|
90
53
|
else {
|
|
91
54
|
const manifest = yield resources.rootProject.byPath('/manifest.json');
|
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.8.
|
|
12
|
+
"version": "0.8.5",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"ejs": "3.1.9",
|
|
26
|
-
"@sap-ux/logger": "0.4.0",
|
|
27
26
|
"@sap-ux/adp-tooling": "0.5.2",
|
|
27
|
+
"@sap-ux/logger": "0.4.0",
|
|
28
28
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.2.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"nock": "13.2.1",
|
|
38
38
|
"supertest": "6.3.3",
|
|
39
39
|
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.5.1",
|
|
40
|
-
"@sap-ux/
|
|
41
|
-
"@sap-ux/
|
|
40
|
+
"@sap-ux/store": "0.4.0",
|
|
41
|
+
"@sap-ux/project-access": "1.14.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"express": "4"
|