@sap-ux/preview-middleware 0.16.133 → 0.16.136
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/config.d.ts +15 -20
- package/dist/base/flex.js +1 -2
- package/dist/base/flp.d.ts +1 -0
- package/dist/base/flp.js +3 -0
- package/dist/client/flp/WorkspaceConnector.js +1 -2
- package/dist/client/flp/WorkspaceConnector.ts +1 -2
- package/dist/client/flp/enableFakeConnector.js +1 -2
- package/dist/client/flp/enableFakeConnector.ts +1 -2
- package/dist/client/flp/init.js +1 -1
- package/dist/client/flp/init.ts +3 -1
- package/dist/client/flp/initRta.js +1 -1
- package/dist/client/flp/initRta.ts +1 -1
- package/dist/ui5/middleware.js +1 -0
- package/package.json +5 -5
package/dist/base/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToolsLogger, type Logger } from '@sap-ux/logger';
|
|
2
|
-
import type { App, FlpConfig, Intent, InternalTestConfig, MiddlewareConfig } from '../types';
|
|
2
|
+
import type { App, FlpConfig, Intent, InternalTestConfig, MiddlewareConfig, TestConfig } from '../types';
|
|
3
3
|
import { type Manifest, type UI5FlexLayer } from '@sap-ux/project-access';
|
|
4
4
|
import { type Editor } from 'mem-fs-editor';
|
|
5
5
|
import type { MergedAppDescriptor } from '@sap-ux/axios-extension';
|
|
@@ -13,6 +13,17 @@ export interface FlexConnector {
|
|
|
13
13
|
layers: string[];
|
|
14
14
|
url?: string;
|
|
15
15
|
}
|
|
16
|
+
type TestTemplateConfig = {
|
|
17
|
+
id: string;
|
|
18
|
+
framework: TestConfig['framework'];
|
|
19
|
+
basePath: string;
|
|
20
|
+
initPath: string;
|
|
21
|
+
theme: string;
|
|
22
|
+
};
|
|
23
|
+
export type PreviewUrls = {
|
|
24
|
+
path: string;
|
|
25
|
+
type: 'preview' | 'editor' | 'test';
|
|
26
|
+
};
|
|
16
27
|
/**
|
|
17
28
|
* Internal structure used to fill the sandbox.html template
|
|
18
29
|
*/
|
|
@@ -76,14 +87,7 @@ export declare const DEFAULT_INTENT: Readonly<Intent>;
|
|
|
76
87
|
* @param config partial configuration
|
|
77
88
|
* @returns a full configuration with default values
|
|
78
89
|
*/
|
|
79
|
-
export declare function getFlpConfigWithDefaults(config?: Partial<FlpConfig>):
|
|
80
|
-
path: string;
|
|
81
|
-
intent: Readonly<Intent>;
|
|
82
|
-
apps: App[];
|
|
83
|
-
libs: boolean | undefined;
|
|
84
|
-
theme: string | undefined;
|
|
85
|
-
init: string | undefined;
|
|
86
|
-
};
|
|
90
|
+
export declare function getFlpConfigWithDefaults(config?: Partial<FlpConfig>): FlpConfig;
|
|
87
91
|
/**
|
|
88
92
|
* The developer mode is only supported for adaptation projects, therefore, notify the user if it is wrongly configured and then disable it.
|
|
89
93
|
*
|
|
@@ -125,17 +129,7 @@ export declare function createFlpTemplateConfig(config: FlpConfig, manifest: Par
|
|
|
125
129
|
* @param theme theme to be used
|
|
126
130
|
* @returns configuration object for the test template
|
|
127
131
|
*/
|
|
128
|
-
export declare function createTestTemplateConfig(config: InternalTestConfig, id: string, theme: string):
|
|
129
|
-
id: string;
|
|
130
|
-
framework: "OPA5" | "QUnit" | "Testsuite";
|
|
131
|
-
basePath: string;
|
|
132
|
-
initPath: string;
|
|
133
|
-
theme: string;
|
|
134
|
-
};
|
|
135
|
-
export type PreviewUrls = {
|
|
136
|
-
path: string;
|
|
137
|
-
type: 'preview' | 'editor' | 'test';
|
|
138
|
-
};
|
|
132
|
+
export declare function createTestTemplateConfig(config: InternalTestConfig, id: string, theme: string): TestTemplateConfig;
|
|
139
133
|
/**
|
|
140
134
|
* Returns the preview paths.
|
|
141
135
|
*
|
|
@@ -154,4 +148,5 @@ export declare function getPreviewPaths(config: MiddlewareConfig, logger?: Tools
|
|
|
154
148
|
* @returns a mem-fs editor with the preview files
|
|
155
149
|
*/
|
|
156
150
|
export declare function generatePreviewFiles(basePath: string, config: MiddlewareConfig, fs?: Editor, logger?: ToolsLogger): Promise<Editor>;
|
|
151
|
+
export {};
|
|
157
152
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/base/flex.js
CHANGED
|
@@ -17,8 +17,7 @@ async function readChanges(project, logger) {
|
|
|
17
17
|
const files = await project.byGlob('/**/changes/*.*');
|
|
18
18
|
for (const file of files) {
|
|
19
19
|
try {
|
|
20
|
-
|
|
21
|
-
changes[`sap.ui.fl.${(0, path_1.parse)(file.getName()).name}`] = change;
|
|
20
|
+
changes[`sap.ui.fl.${(0, path_1.parse)(file.getName()).name}`] = JSON.parse(await file.getString());
|
|
22
21
|
logger.debug(`Read change from ${file.getPath()}`);
|
|
23
22
|
}
|
|
24
23
|
catch (error) {
|
package/dist/base/flp.d.ts
CHANGED
|
@@ -126,6 +126,7 @@ export declare class FlpSandbox {
|
|
|
126
126
|
* @param flp FlpSandbox instance
|
|
127
127
|
* @param util middleware utilities provided by the UI5 CLI
|
|
128
128
|
* @param logger logger instance
|
|
129
|
+
* @throws Error in case no manifest.appdescr_variant found
|
|
129
130
|
*/
|
|
130
131
|
export declare function initAdp(rootProject: ReaderCollection, config: AdpPreviewConfig, flp: FlpSandbox, util: MiddlewareUtils, logger: ToolsLogger): Promise<void>;
|
|
131
132
|
export {};
|
package/dist/base/flp.js
CHANGED
|
@@ -212,6 +212,7 @@ class FlpSandbox {
|
|
|
212
212
|
// add route for the sandbox.html
|
|
213
213
|
this.router.get(this.config.path, (async (_req, res, next) => {
|
|
214
214
|
// inform the user if a html file exists on the filesystem
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
215
216
|
const file = await this.project.byPath(this.config.path);
|
|
216
217
|
if (file) {
|
|
217
218
|
this.logger.info(`HTML file returned at ${this.config.path} is loaded from the file system.`);
|
|
@@ -401,6 +402,7 @@ class FlpSandbox {
|
|
|
401
402
|
// add route for the *.qunit.html
|
|
402
403
|
this.router.get(config.path, (async (_req, res, next) => {
|
|
403
404
|
this.logger.debug(`Serving test route: ${config.path}`);
|
|
405
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
404
406
|
const file = await this.project.byPath(config.path);
|
|
405
407
|
if (file) {
|
|
406
408
|
this.logger.warn(`HTML file returned at ${config.path} is loaded from the file system.`);
|
|
@@ -468,6 +470,7 @@ function serializeUi5Configuration(config) {
|
|
|
468
470
|
* @param flp FlpSandbox instance
|
|
469
471
|
* @param util middleware utilities provided by the UI5 CLI
|
|
470
472
|
* @param logger logger instance
|
|
473
|
+
* @throws Error in case no manifest.appdescr_variant found
|
|
471
474
|
*/
|
|
472
475
|
async function initAdp(rootProject, config, flp, util, logger) {
|
|
473
476
|
const appVariant = await rootProject.byPath('/manifest.appdescr_variant');
|
|
@@ -64,8 +64,7 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStor
|
|
|
64
64
|
'content-type': 'application/json'
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
-
|
|
68
|
-
return changes;
|
|
67
|
+
return await response.json();
|
|
69
68
|
}
|
|
70
69
|
},
|
|
71
70
|
loadFeatures: async function () {
|
|
@@ -62,8 +62,7 @@ const connector = merge({}, ObjectStorageConnector, {
|
|
|
62
62
|
'content-type': 'application/json'
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
|
|
66
|
-
return changes;
|
|
65
|
+
return (await response.json()) as unknown as FlexChange[];
|
|
67
66
|
}
|
|
68
67
|
} as typeof ObjectStorageConnector.storage,
|
|
69
68
|
loadFeatures: async function () {
|
|
@@ -55,8 +55,7 @@ sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "./comm
|
|
|
55
55
|
args[_key] = arguments[_key];
|
|
56
56
|
}
|
|
57
57
|
return LrepConnector.prototype.loadChanges.apply(lrep, args).then(res => {
|
|
58
|
-
|
|
59
|
-
res.changes.changes = flexChanges;
|
|
58
|
+
res.changes.changes = Object.values(changes);
|
|
60
59
|
return res;
|
|
61
60
|
});
|
|
62
61
|
}
|
|
@@ -74,8 +74,7 @@ export async function loadChanges(...args: []): Promise<LoadChangesResult> {
|
|
|
74
74
|
const changes = (await response.json()) as FetchedChanges;
|
|
75
75
|
|
|
76
76
|
return LrepConnector.prototype.loadChanges.apply(lrep, args).then((res: LoadChangesResult) => {
|
|
77
|
-
|
|
78
|
-
res.changes.changes = flexChanges;
|
|
77
|
+
res.changes.changes = Object.values(changes);
|
|
79
78
|
return res;
|
|
80
79
|
});
|
|
81
80
|
}
|
package/dist/client/flp/init.js
CHANGED
|
@@ -122,10 +122,10 @@ sap.ui.define([
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
async function resetAppState(container) {
|
|
125
|
-
const appStateService = await container.getServiceAsync('AppState');
|
|
126
125
|
const urlParams = new URLSearchParams(window.location.hash);
|
|
127
126
|
const appStateValue = urlParams.get('sap-iapp-state') ?? urlParams.get('/?sap-iapp-state');
|
|
128
127
|
if (appStateValue) {
|
|
128
|
+
const appStateService = await container.getServiceAsync('AppState');
|
|
129
129
|
appStateService.deleteAppState(appStateValue);
|
|
130
130
|
}
|
|
131
131
|
}
|
package/dist/client/flp/init.ts
CHANGED
|
@@ -165,10 +165,10 @@ function registerModules(dataFromAppIndex: AppIndexData) {
|
|
|
165
165
|
* @param container the UShell container
|
|
166
166
|
*/
|
|
167
167
|
export async function resetAppState(container: typeof sap.ushell.Container): Promise<void> {
|
|
168
|
-
const appStateService = await container.getServiceAsync<AppState>('AppState');
|
|
169
168
|
const urlParams = new URLSearchParams(window.location.hash);
|
|
170
169
|
const appStateValue = urlParams.get('sap-iapp-state') ?? urlParams.get('/?sap-iapp-state');
|
|
171
170
|
if (appStateValue) {
|
|
171
|
+
const appStateService = await container.getServiceAsync<AppState>('AppState');
|
|
172
172
|
appStateService.deleteAppState(appStateValue);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -346,6 +346,8 @@ export async function init({
|
|
|
346
346
|
: await container.createRendererInternal(undefined, true);
|
|
347
347
|
renderer.placeAt('content');
|
|
348
348
|
}
|
|
349
|
+
|
|
350
|
+
// eslint-disable-next-line fiori-custom/sap-no-dom-access,fiori-custom/sap-browser-api-warning
|
|
349
351
|
const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
|
|
350
352
|
if (bootstrapConfig) {
|
|
351
353
|
init({
|
|
@@ -151,7 +151,7 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/core/Control", "sap/ui/core/UIComp
|
|
|
151
151
|
* Initializes custom RuntimeAuthoring for UI5 Versions < 1.72 and start UI Adaptation.
|
|
152
152
|
* Ensures that the passed options are valid.
|
|
153
153
|
*
|
|
154
|
-
* @param {RTAOptions} options - Options
|
|
154
|
+
* @param {RTAOptions} options - Options that are passed to RuntimeAuthoring upon initialization.
|
|
155
155
|
* @param {RTAPlugin} loadPlugins - Script that needs to be executed after rta is initialized.
|
|
156
156
|
* @returns {Promise<void>} A promise that resolves when all the checks have passed and RuntimeAuthoring is started.
|
|
157
157
|
*/
|
|
@@ -164,7 +164,7 @@ function removeExtraBtnsFromToolbar(): void {
|
|
|
164
164
|
* Initializes custom RuntimeAuthoring for UI5 Versions < 1.72 and start UI Adaptation.
|
|
165
165
|
* Ensures that the passed options are valid.
|
|
166
166
|
*
|
|
167
|
-
* @param {RTAOptions} options - Options
|
|
167
|
+
* @param {RTAOptions} options - Options that are passed to RuntimeAuthoring upon initialization.
|
|
168
168
|
* @param {RTAPlugin} loadPlugins - Script that needs to be executed after rta is initialized.
|
|
169
169
|
* @returns {Promise<void>} A promise that resolves when all the checks have passed and RuntimeAuthoring is started.
|
|
170
170
|
*/
|
package/dist/ui5/middleware.js
CHANGED
|
@@ -24,6 +24,7 @@ async function createRouter({ resources, options, middlewareUtil }, logger) {
|
|
|
24
24
|
await (0, flp_1.initAdp)(resources.rootProject, config.adp, flp, middlewareUtil, logger);
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
27
28
|
const manifest = await resources.rootProject.byPath('/manifest.json');
|
|
28
29
|
if (manifest) {
|
|
29
30
|
await flp.init(JSON.parse(await manifest.getString()));
|
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.16.
|
|
12
|
+
"version": "0.16.136",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@sap-ux/logger": "0.6.0",
|
|
29
29
|
"@sap-ux/feature-toggle": "0.2.2",
|
|
30
30
|
"@sap-ux/btp-utils": "0.17.0",
|
|
31
|
-
"@sap-ux/adp-tooling": "0.12.
|
|
31
|
+
"@sap-ux/adp-tooling": "0.12.87",
|
|
32
32
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.28",
|
|
33
|
-
"@sap-ux/project-access": "1.28.
|
|
33
|
+
"@sap-ux/project-access": "1.28.8"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/ejs": "3.1.2",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"supertest": "6.3.3",
|
|
47
47
|
"@sap-ux-private/playwright": "0.1.0",
|
|
48
48
|
"dotenv": "16.3.1",
|
|
49
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.
|
|
50
|
-
"@sap-ux/store": "0.9.3",
|
|
49
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.39",
|
|
51
50
|
"@sap-ux/axios-extension": "1.17.4",
|
|
51
|
+
"@sap-ux/store": "0.9.3",
|
|
52
52
|
"@sap-ux/ui5-info": "0.8.3",
|
|
53
53
|
"@sap-ux/i18n": "0.2.0"
|
|
54
54
|
},
|