@sap-ux/preview-middleware 0.23.16 → 0.23.18
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/cdm.js +3 -3
- package/dist/base/config.js +20 -20
- package/dist/base/flex.js +11 -11
- package/dist/base/flp.js +23 -23
- package/dist/base/remote-url.js +8 -8
- package/dist/client/adp/controllers/AddFragment.controller.js +2 -2
- package/dist/client/adp/controllers/AddFragment.controller.ts +2 -2
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +1 -1
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +1 -1
- package/dist/client/utils/version.js +2 -2
- package/dist/client/utils/version.ts +2 -2
- package/package.json +11 -11
package/dist/base/cdm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateCdm = generateCdm;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
/**
|
|
8
8
|
* Generates a CDM by embedding the provided app tiles into the FLP homepage.
|
|
@@ -11,7 +11,7 @@ const types_1 = require("../types");
|
|
|
11
11
|
* @returns The generated CDM configuration
|
|
12
12
|
*/
|
|
13
13
|
function generateCdm(apps = {}) {
|
|
14
|
-
const cdm = JSON.parse((0,
|
|
14
|
+
const cdm = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '../../templates/flp/cdm.base.json'), 'utf-8'));
|
|
15
15
|
// add apps
|
|
16
16
|
Object.keys(apps).forEach((id) => {
|
|
17
17
|
const appId = apps[id].additionalInformation.split('=')[1];
|
package/dist/base/config.js
CHANGED
|
@@ -13,10 +13,10 @@ exports.getPreviewPaths = getPreviewPaths;
|
|
|
13
13
|
exports.generatePreviewFiles = generatePreviewFiles;
|
|
14
14
|
const logger_1 = require("@sap-ux/logger");
|
|
15
15
|
const ejs_1 = require("ejs");
|
|
16
|
-
const
|
|
16
|
+
const node_path_1 = require("node:path");
|
|
17
17
|
const project_access_1 = require("@sap-ux/project-access");
|
|
18
18
|
const i18n_1 = require("@sap-ux/i18n");
|
|
19
|
-
const
|
|
19
|
+
const node_fs_1 = require("node:fs");
|
|
20
20
|
const test_1 = require("./test");
|
|
21
21
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
22
22
|
const mem_fs_1 = require("mem-fs");
|
|
@@ -26,8 +26,8 @@ const mem_fs_1 = require("mem-fs");
|
|
|
26
26
|
exports.PREVIEW_URL = {
|
|
27
27
|
client: {
|
|
28
28
|
path: '/preview/client',
|
|
29
|
-
getUrl: (basePath) =>
|
|
30
|
-
local: (0,
|
|
29
|
+
getUrl: (basePath) => node_path_1.posix.join(basePath, 'preview', 'client'),
|
|
30
|
+
local: (0, node_path_1.join)(__dirname, '../../dist/client'),
|
|
31
31
|
ns: 'open.ux.preview.client'
|
|
32
32
|
},
|
|
33
33
|
api: '/preview/api'
|
|
@@ -269,7 +269,7 @@ function createFlpTemplateConfig(config, manifest, resources = {}) {
|
|
|
269
269
|
const ui5Theme = config.theme ?? (supportedThemes.includes(exports.DEFAULT_THEME) ? exports.DEFAULT_THEME : supportedThemes[0]);
|
|
270
270
|
const id = manifest['sap.app']?.id ?? '';
|
|
271
271
|
const ns = id.replace(/\./g, '/');
|
|
272
|
-
const basePath =
|
|
272
|
+
const basePath = node_path_1.posix.relative(node_path_1.posix.dirname(config.path), '/') ?? '.';
|
|
273
273
|
return {
|
|
274
274
|
basePath: basePath,
|
|
275
275
|
apps: {},
|
|
@@ -301,8 +301,8 @@ function createTestTemplateConfig(config, id, theme) {
|
|
|
301
301
|
return {
|
|
302
302
|
id,
|
|
303
303
|
framework: config.framework,
|
|
304
|
-
basePath:
|
|
305
|
-
initPath:
|
|
304
|
+
basePath: node_path_1.posix.relative(node_path_1.posix.dirname(config.path), '/') ?? '.',
|
|
305
|
+
initPath: node_path_1.posix.relative(node_path_1.posix.dirname(config.path), config.init),
|
|
306
306
|
theme
|
|
307
307
|
};
|
|
308
308
|
}
|
|
@@ -335,7 +335,7 @@ function getPreviewPaths(config, logger = new logger_1.ToolsLogger()) {
|
|
|
335
335
|
}
|
|
336
336
|
return urls;
|
|
337
337
|
}
|
|
338
|
-
const TEMPLATE_PATH = (0,
|
|
338
|
+
const TEMPLATE_PATH = (0, node_path_1.join)(__dirname, '../../templates');
|
|
339
339
|
/**
|
|
340
340
|
* Generate test runners.
|
|
341
341
|
*
|
|
@@ -349,17 +349,17 @@ function generateTestRunners(configs, manifest, fs, webappPath, flpTemplConfig)
|
|
|
349
349
|
for (const test of configs ?? []) {
|
|
350
350
|
const testConfig = (0, test_1.mergeTestConfigDefaults)(test);
|
|
351
351
|
if (['QUnit', 'OPA5'].includes(test.framework)) {
|
|
352
|
-
const testTemplate = (0,
|
|
352
|
+
const testTemplate = (0, node_fs_1.readFileSync)((0, node_path_1.join)(TEMPLATE_PATH, 'test/qunit.ejs'), 'utf-8');
|
|
353
353
|
const testTemplateConfig = createTestTemplateConfig(testConfig, manifest['sap.app'].id, flpTemplConfig.ui5.theme);
|
|
354
|
-
fs.write((0,
|
|
354
|
+
fs.write((0, node_path_1.join)(webappPath, testConfig.path), (0, ejs_1.render)(testTemplate, testTemplateConfig));
|
|
355
355
|
}
|
|
356
356
|
else if (test.framework === 'Testsuite') {
|
|
357
|
-
const testTemplate = (0,
|
|
357
|
+
const testTemplate = (0, node_fs_1.readFileSync)((0, node_path_1.join)(TEMPLATE_PATH, 'test/testsuite.qunit.ejs'), 'utf-8');
|
|
358
358
|
const testTemplateConfig = {
|
|
359
359
|
basePath: flpTemplConfig.basePath,
|
|
360
360
|
initPath: testConfig.init
|
|
361
361
|
};
|
|
362
|
-
fs.write((0,
|
|
362
|
+
fs.write((0, node_path_1.join)(webappPath, testConfig.path), (0, ejs_1.render)(testTemplate, testTemplateConfig));
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
}
|
|
@@ -380,18 +380,18 @@ async function generatePreviewFiles(basePath, config, fs, logger = new logger_1.
|
|
|
380
380
|
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
381
381
|
}
|
|
382
382
|
// generate FLP configuration
|
|
383
|
-
const flpTemplate = (0,
|
|
383
|
+
const flpTemplate = (0, node_fs_1.readFileSync)((0, node_path_1.join)(TEMPLATE_PATH, 'flp/sandbox.ejs'), 'utf-8');
|
|
384
384
|
const flpConfig = getFlpConfigWithDefaults(config.flp);
|
|
385
385
|
const webappPath = await (0, project_access_1.getWebappPath)(basePath, fs);
|
|
386
386
|
let manifest;
|
|
387
|
-
if (fs.exists((0,
|
|
388
|
-
manifest = (await fs.readJSON((0,
|
|
387
|
+
if (fs.exists((0, node_path_1.join)(webappPath, 'manifest.json'))) {
|
|
388
|
+
manifest = (await fs.readJSON((0, node_path_1.join)(webappPath, 'manifest.json')));
|
|
389
389
|
}
|
|
390
390
|
let flpTemplConfig;
|
|
391
391
|
let flpPath;
|
|
392
392
|
if (manifest) {
|
|
393
393
|
flpTemplConfig = createFlpTemplateConfig(flpConfig, manifest);
|
|
394
|
-
flpPath = (0,
|
|
394
|
+
flpPath = (0, node_path_1.join)(webappPath, flpConfig.path);
|
|
395
395
|
await addApp(flpTemplConfig, manifest, {
|
|
396
396
|
target: flpTemplConfig.basePath,
|
|
397
397
|
local: '.',
|
|
@@ -401,14 +401,14 @@ async function generatePreviewFiles(basePath, config, fs, logger = new logger_1.
|
|
|
401
401
|
}
|
|
402
402
|
else {
|
|
403
403
|
flpTemplConfig = createFlpTemplateConfig(flpConfig, {});
|
|
404
|
-
flpPath = (0,
|
|
404
|
+
flpPath = (0, node_path_1.join)(basePath, flpConfig.path);
|
|
405
405
|
}
|
|
406
406
|
if (flpConfig.apps.length > 0) {
|
|
407
407
|
for (const app of flpConfig.apps) {
|
|
408
408
|
if (app.local) {
|
|
409
|
-
const appPath = await (0, project_access_1.getWebappPath)((0,
|
|
410
|
-
if (fs.exists((0,
|
|
411
|
-
const appManifest = (await fs.readJSON((0,
|
|
409
|
+
const appPath = await (0, project_access_1.getWebappPath)((0, node_path_1.join)(basePath, app.local), fs);
|
|
410
|
+
if (fs.exists((0, node_path_1.join)(appPath, 'manifest.json'))) {
|
|
411
|
+
const appManifest = (await fs.readJSON((0, node_path_1.join)(appPath, 'manifest.json')));
|
|
412
412
|
await addApp(flpTemplConfig, appManifest, app, logger);
|
|
413
413
|
}
|
|
414
414
|
else {
|
package/dist/base/flex.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.readChanges = readChanges;
|
|
4
4
|
exports.writeChange = writeChange;
|
|
5
5
|
exports.deleteChange = deleteChange;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
8
|
/**
|
|
9
9
|
* Read changes from the file system and return them.
|
|
10
10
|
*
|
|
@@ -17,7 +17,7 @@ async function readChanges(project, logger) {
|
|
|
17
17
|
const files = await project.byGlob('/**/changes/**/*.{change,variant,ctrl_variant,ctrl_variant_change,ctrl_variant_management_change}');
|
|
18
18
|
for (const file of files) {
|
|
19
19
|
try {
|
|
20
|
-
changes[`sap.ui.fl.${(0,
|
|
20
|
+
changes[`sap.ui.fl.${(0, node_path_1.parse)(file.getName()).name}`] = JSON.parse(await file.getString());
|
|
21
21
|
logger.debug(`Read change from ${file.getPath()}`);
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
@@ -42,7 +42,7 @@ function writeChange(data, webappPath, fs, logger) {
|
|
|
42
42
|
const fileType = data.fileType;
|
|
43
43
|
if (fileName && fileType) {
|
|
44
44
|
logger.debug(`Write change ${fileName}.${fileType}`);
|
|
45
|
-
const filePath = (0,
|
|
45
|
+
const filePath = (0, node_path_1.join)(webappPath, 'changes', fileName + '.' + fileType);
|
|
46
46
|
fs.writeJSON(filePath, data);
|
|
47
47
|
const message = `FILE_CREATED ${fileName}.${fileType}`;
|
|
48
48
|
return { success: true, message };
|
|
@@ -63,16 +63,16 @@ function writeChange(data, webappPath, fs, logger) {
|
|
|
63
63
|
function deleteChange(data, webappPath, logger) {
|
|
64
64
|
const fileName = data.fileName?.replace('sap.ui.fl.', '');
|
|
65
65
|
if (fileName) {
|
|
66
|
-
const path = (0,
|
|
67
|
-
if ((0,
|
|
66
|
+
const path = (0, node_path_1.join)(webappPath, 'changes');
|
|
67
|
+
if ((0, node_fs_1.existsSync)(path)) {
|
|
68
68
|
// Changes can be in subfolders of changes directory. For eg: New Annotation File Change
|
|
69
69
|
const files = [];
|
|
70
70
|
readDirectoriesRecursively(path, files);
|
|
71
71
|
const filePath = files.find((element) => element.includes(fileName));
|
|
72
72
|
if (filePath) {
|
|
73
|
-
const fileNameWithExt = filePath.split(
|
|
73
|
+
const fileNameWithExt = filePath.split(node_path_1.sep).pop();
|
|
74
74
|
logger.debug(`Write change ${fileNameWithExt}`);
|
|
75
|
-
(0,
|
|
75
|
+
(0, node_fs_1.unlinkSync)(filePath);
|
|
76
76
|
return { success: true, message: `FILE_DELETED ${fileNameWithExt}` };
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -86,10 +86,10 @@ function deleteChange(data, webappPath, logger) {
|
|
|
86
86
|
* @param files all files in the given folder and subfolders.
|
|
87
87
|
*/
|
|
88
88
|
function readDirectoriesRecursively(path, files = []) {
|
|
89
|
-
const items = (0,
|
|
89
|
+
const items = (0, node_fs_1.readdirSync)(path);
|
|
90
90
|
items.forEach((item) => {
|
|
91
|
-
const fullPath = (0,
|
|
92
|
-
const stats = (0,
|
|
91
|
+
const fullPath = (0, node_path_1.join)(path, item);
|
|
92
|
+
const stats = (0, node_fs_1.statSync)(fullPath);
|
|
93
93
|
if (stats.isDirectory()) {
|
|
94
94
|
readDirectoriesRecursively(fullPath, files);
|
|
95
95
|
}
|
package/dist/base/flp.js
CHANGED
|
@@ -39,7 +39,7 @@ const mem_fs_1 = require("mem-fs");
|
|
|
39
39
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
40
40
|
const ejs_1 = require("ejs");
|
|
41
41
|
const express_1 = require("express");
|
|
42
|
-
const
|
|
42
|
+
const node_path_1 = __importStar(require("node:path"));
|
|
43
43
|
const project_access_1 = require("@sap-ux/project-access");
|
|
44
44
|
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
45
45
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
@@ -48,7 +48,7 @@ const flex_1 = require("./flex");
|
|
|
48
48
|
const test_1 = require("./test");
|
|
49
49
|
const config_1 = require("./config");
|
|
50
50
|
const cdm_1 = require("./cdm");
|
|
51
|
-
const
|
|
51
|
+
const node_fs_1 = require("node:fs");
|
|
52
52
|
const cards_1 = require("./utils/cards");
|
|
53
53
|
const i18n_1 = require("@sap-ux/i18n");
|
|
54
54
|
const DEFAULT_LIVERELOAD_PORT = 35729;
|
|
@@ -267,11 +267,11 @@ class FlpSandbox {
|
|
|
267
267
|
if (scenario === 'ADAPTATION_PROJECT') {
|
|
268
268
|
templatePreviewUrl = templatePreviewUrl.replace('?', `?sap-ui-layer=${rta.layer}&`);
|
|
269
269
|
}
|
|
270
|
-
const template = (0,
|
|
270
|
+
const template = (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '../../templates/flp/editor.ejs'), 'utf-8');
|
|
271
271
|
const features = feature_toggle_1.FeatureToggleAccess.getAllFeatureToggles();
|
|
272
272
|
const envPort = process.env.FIORI_TOOLS_LIVERELOAD_PORT;
|
|
273
|
-
let livereloadPort = envPort ? parseInt(envPort, 10) : DEFAULT_LIVERELOAD_PORT;
|
|
274
|
-
livereloadPort = isNaN(livereloadPort) ? DEFAULT_LIVERELOAD_PORT : livereloadPort;
|
|
273
|
+
let livereloadPort = envPort ? Number.parseInt(envPort, 10) : DEFAULT_LIVERELOAD_PORT;
|
|
274
|
+
livereloadPort = Number.isNaN(livereloadPort) ? DEFAULT_LIVERELOAD_PORT : livereloadPort;
|
|
275
275
|
const envLivereloadUrl = (0, btp_utils_1.isAppStudio)() ? await (0, btp_utils_1.exposePort)(livereloadPort) : undefined;
|
|
276
276
|
const html = (0, ejs_1.render)(template, {
|
|
277
277
|
previewUrl: templatePreviewUrl,
|
|
@@ -297,7 +297,7 @@ class FlpSandbox {
|
|
|
297
297
|
async editorGetHandler(req, res, rta, previewUrl, editor) {
|
|
298
298
|
if (!req.query['fiori-tools-rta-mode']) {
|
|
299
299
|
// Redirect to the same URL but add the necessary parameter
|
|
300
|
-
const url = 'ui5-patched-router' in req ? (0,
|
|
300
|
+
const url = 'ui5-patched-router' in req ? (0, node_path_1.join)(req['ui5-patched-router']?.baseUrl ?? '', previewUrl) : previewUrl;
|
|
301
301
|
const params = structuredClone(req.query);
|
|
302
302
|
params['sap-ui-xx-viewCache'] = 'false';
|
|
303
303
|
params['fiori-tools-rta-mode'] = 'true';
|
|
@@ -315,7 +315,7 @@ class FlpSandbox {
|
|
|
315
315
|
* @param rta runtime authoring configuration
|
|
316
316
|
*/
|
|
317
317
|
addEditorRoutes(rta) {
|
|
318
|
-
const cpe = (0,
|
|
318
|
+
const cpe = (0, node_path_1.dirname)(require.resolve('@sap-ux/control-property-editor-sources'));
|
|
319
319
|
for (const editor of rta.endpoints) {
|
|
320
320
|
let previewUrl = editor.path.startsWith('/') ? editor.path : `/${editor.path}`;
|
|
321
321
|
if (editor.developerMode) {
|
|
@@ -324,7 +324,7 @@ class FlpSandbox {
|
|
|
324
324
|
this.router.get(editor.path, async (_req, res) => {
|
|
325
325
|
await this.editorGetHandlerDeveloperMode(res, rta, previewUrl);
|
|
326
326
|
});
|
|
327
|
-
let path = (0,
|
|
327
|
+
let path = (0, node_path_1.dirname)(editor.path);
|
|
328
328
|
if (!path.endsWith('/')) {
|
|
329
329
|
path = `${path}/`;
|
|
330
330
|
}
|
|
@@ -346,7 +346,7 @@ class FlpSandbox {
|
|
|
346
346
|
async flpGetHandler(req, res, next) {
|
|
347
347
|
// connect API (karma test runner) has no request query property
|
|
348
348
|
if ('query' in req && 'redirect' in res && !req.query['sap-ui-xx-viewCache']) {
|
|
349
|
-
const url = 'ui5-patched-router' in req ? (0,
|
|
349
|
+
const url = 'ui5-patched-router' in req ? (0, node_path_1.join)(req['ui5-patched-router']?.baseUrl ?? '', req.path) : req.path;
|
|
350
350
|
// Redirect to the same URL but add the necessary parameter
|
|
351
351
|
const params = structuredClone(req.query);
|
|
352
352
|
params['sap-ui-xx-viewCache'] = 'false';
|
|
@@ -435,7 +435,7 @@ class FlpSandbox {
|
|
|
435
435
|
this.logger.error('Could not get UI5 version of application. Using version: 1.130.0 as fallback.');
|
|
436
436
|
version = '1.130.0';
|
|
437
437
|
}
|
|
438
|
-
const [major, minor, patch] = version.split('.').map((versionPart) => parseInt(versionPart, 10));
|
|
438
|
+
const [major, minor, patch] = version.split('.').map((versionPart) => Number.parseInt(versionPart, 10));
|
|
439
439
|
const label = version.split(/-(.*)/s)?.[1];
|
|
440
440
|
if (this.flpConfig.enhancedHomePage &&
|
|
441
441
|
((major < 2 && minor < 123) || major >= 2 || label?.includes('legacy-free'))) {
|
|
@@ -459,7 +459,7 @@ class FlpSandbox {
|
|
|
459
459
|
this.logger.info(`Using sandbox template for UI5 version: ${ui5Version.major}.${ui5Version.minor}.${ui5Version.patch}${ui5Version.label ? `-${ui5Version.label}` : ''}.`);
|
|
460
460
|
const filePrefix = ui5Version.major > 1 || ui5Version.label?.includes('legacy-free') ? '2' : '';
|
|
461
461
|
const template = this.flpConfig.enhancedHomePage ? 'cdm' : 'sandbox';
|
|
462
|
-
return (0,
|
|
462
|
+
return (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, `../../templates/flp/${template}${filePrefix}.ejs`), 'utf-8');
|
|
463
463
|
}
|
|
464
464
|
/**
|
|
465
465
|
* For UI5 version 1.71 and below, the asyncHints.requests need to be removed from the template configuration
|
|
@@ -491,7 +491,7 @@ class FlpSandbox {
|
|
|
491
491
|
if (app.local) {
|
|
492
492
|
this.fs = this.fs ?? (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
493
493
|
const webappPath = await (0, project_access_1.getWebappPath)(app.local, this.fs);
|
|
494
|
-
manifest = JSON.parse((0,
|
|
494
|
+
manifest = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(webappPath, 'manifest.json'), 'utf-8'));
|
|
495
495
|
this.router.use(app.target, (0, express_1.static)(webappPath));
|
|
496
496
|
this.logger.info(`Serving additional application at ${app.target} from ${app.local}`);
|
|
497
497
|
}
|
|
@@ -659,7 +659,7 @@ class FlpSandbox {
|
|
|
659
659
|
this.logger.warn('Skip testsuite generation. No test frameworks configured.');
|
|
660
660
|
return;
|
|
661
661
|
}
|
|
662
|
-
const testsuite = (0,
|
|
662
|
+
const testsuite = (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '../../templates/test/testsuite.qunit.ejs'), 'utf-8');
|
|
663
663
|
const config = (0, test_1.mergeTestConfigDefaults)(testsuiteConfig);
|
|
664
664
|
this.logger.debug(`Add route for ${config.path}`);
|
|
665
665
|
this.router.get(config.path, async (_req, res) => {
|
|
@@ -675,9 +675,9 @@ class FlpSandbox {
|
|
|
675
675
|
continue;
|
|
676
676
|
}
|
|
677
677
|
const mergedConfig = (0, test_1.mergeTestConfigDefaults)(testConfig);
|
|
678
|
-
testPaths.push(
|
|
678
|
+
testPaths.push(node_path_1.posix.relative(node_path_1.posix.dirname(config.path), mergedConfig.path));
|
|
679
679
|
}
|
|
680
|
-
const initTemplate = (0,
|
|
680
|
+
const initTemplate = (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '../../templates/test/testsuite.qunit.js'), 'utf-8');
|
|
681
681
|
this.logger.debug(`Add route for ${config.init}`);
|
|
682
682
|
this.router.get(config.init, async (_req, res, next) => {
|
|
683
683
|
await this.testSuiteJsGetHandler(res, next, config, initTemplate, testPaths);
|
|
@@ -755,7 +755,7 @@ class FlpSandbox {
|
|
|
755
755
|
*/
|
|
756
756
|
addTestRoutes(configs, id) {
|
|
757
757
|
const ns = id.replace(/\./g, '/');
|
|
758
|
-
const htmlTemplate = (0,
|
|
758
|
+
const htmlTemplate = (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '../../templates/test/qunit.ejs'), 'utf-8');
|
|
759
759
|
for (const testConfig of configs) {
|
|
760
760
|
const config = (0, test_1.mergeTestConfigDefaults)(testConfig);
|
|
761
761
|
this.logger.debug(`Add route for ${config.path}`);
|
|
@@ -768,7 +768,7 @@ class FlpSandbox {
|
|
|
768
768
|
continue;
|
|
769
769
|
}
|
|
770
770
|
// add route for the init file
|
|
771
|
-
const initTemplate = (0,
|
|
771
|
+
const initTemplate = (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '../../templates/test/qunit.js'), 'utf-8');
|
|
772
772
|
this.logger.debug(`Add route for ${config.init}`);
|
|
773
773
|
this.router.get(config.init, async (_req, res, next) => {
|
|
774
774
|
await this.testRunnerJsGetHandler(res, next, config, initTemplate, ns);
|
|
@@ -786,9 +786,9 @@ class FlpSandbox {
|
|
|
786
786
|
try {
|
|
787
787
|
const { floorplan, localPath, fileName = project_access_1.FileName.Manifest, manifests } = req.body;
|
|
788
788
|
this.fs = this.fs ?? (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
789
|
-
const webappPath = await (0, project_access_1.getWebappPath)(
|
|
790
|
-
const fullPath = (0,
|
|
791
|
-
const filePath = fileName.endsWith('.json') ? (0,
|
|
789
|
+
const webappPath = await (0, project_access_1.getWebappPath)(node_path_1.default.resolve(), this.fs);
|
|
790
|
+
const fullPath = (0, node_path_1.join)(webappPath, localPath);
|
|
791
|
+
const filePath = fileName.endsWith('.json') ? (0, node_path_1.join)(fullPath, fileName) : `${(0, node_path_1.join)(fullPath, fileName)}.json`;
|
|
792
792
|
const integrationCard = (0, cards_1.getIntegrationCard)(manifests);
|
|
793
793
|
this.fs.write(filePath, JSON.stringify(integrationCard.manifest, null, 2));
|
|
794
794
|
const entitySet = integrationCard.entitySet;
|
|
@@ -804,7 +804,7 @@ class FlpSandbox {
|
|
|
804
804
|
]
|
|
805
805
|
}
|
|
806
806
|
};
|
|
807
|
-
const appAccess = await (0, project_access_1.createApplicationAccess)(
|
|
807
|
+
const appAccess = await (0, project_access_1.createApplicationAccess)(node_path_1.default.resolve(), this.fs);
|
|
808
808
|
await appAccess.updateManifestJSON(this.manifest, this.fs);
|
|
809
809
|
this.fs.commit(() => this.sendResponse(res, 'text/plain', 201, `Files were updated/created`));
|
|
810
810
|
}
|
|
@@ -839,9 +839,9 @@ class FlpSandbox {
|
|
|
839
839
|
async storeI18nKeysHandler(req, res) {
|
|
840
840
|
try {
|
|
841
841
|
this.fs = this.fs ?? (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
842
|
-
const webappPath = await (0, project_access_1.getWebappPath)(
|
|
842
|
+
const webappPath = await (0, project_access_1.getWebappPath)(node_path_1.default.resolve(), this.fs);
|
|
843
843
|
const i18nPath = this.manifest['sap.app'].i18n;
|
|
844
|
-
const filePath = i18nPath ? (0,
|
|
844
|
+
const filePath = i18nPath ? (0, node_path_1.join)(webappPath, i18nPath) : (0, node_path_1.join)(webappPath, 'i18n', 'i18n.properties');
|
|
845
845
|
const entries = req.body || [];
|
|
846
846
|
entries.forEach((entry) => {
|
|
847
847
|
if (entry.comment) {
|
package/dist/base/remote-url.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.isRemoteConnectionsEnabled = isRemoteConnectionsEnabled;
|
|
|
9
9
|
exports.getPortFromArgs = getPortFromArgs;
|
|
10
10
|
exports.getOpenPathFromArgs = getOpenPathFromArgs;
|
|
11
11
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
12
|
-
const
|
|
12
|
+
const node_os_1 = require("node:os");
|
|
13
13
|
const bas_sdk_1 = require("@sap/bas-sdk");
|
|
14
14
|
const qrcode_1 = __importDefault(require("qrcode"));
|
|
15
15
|
/**
|
|
@@ -119,7 +119,7 @@ function getIdeRemoteUrl(logger) {
|
|
|
119
119
|
* @returns The network IP address
|
|
120
120
|
*/
|
|
121
121
|
function getNetworkIP() {
|
|
122
|
-
const interfaces = (0,
|
|
122
|
+
const interfaces = (0, node_os_1.networkInterfaces)();
|
|
123
123
|
// Priority order: prefer non-internal IPv4 addresses
|
|
124
124
|
for (const interfaceName of Object.keys(interfaces)) {
|
|
125
125
|
const networkInterface = interfaces[interfaceName];
|
|
@@ -170,20 +170,20 @@ function getPortFromArgs() {
|
|
|
170
170
|
const portArg = process.argv[portIndex];
|
|
171
171
|
if (portArg.includes('=')) {
|
|
172
172
|
// --port=8080 format
|
|
173
|
-
const port = parseInt(portArg.split('=')[1], 10);
|
|
174
|
-
return isNaN(port) ? undefined : port;
|
|
173
|
+
const port = Number.parseInt(portArg.split('=')[1], 10);
|
|
174
|
+
return Number.isNaN(port) ? undefined : port;
|
|
175
175
|
}
|
|
176
176
|
else if (portIndex + 1 < process.argv.length) {
|
|
177
177
|
// --port 8080 format
|
|
178
|
-
const port = parseInt(process.argv[portIndex + 1], 10);
|
|
179
|
-
return isNaN(port) ? undefined : port;
|
|
178
|
+
const port = Number.parseInt(process.argv[portIndex + 1], 10);
|
|
179
|
+
return Number.isNaN(port) ? undefined : port;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
// Check environment variable
|
|
183
183
|
const envPort = process.env.PORT;
|
|
184
184
|
if (envPort) {
|
|
185
|
-
const port = parseInt(envPort, 10);
|
|
186
|
-
return isNaN(port) ? undefined : port;
|
|
185
|
+
const port = Number.parseInt(envPort, 10);
|
|
186
|
+
return Number.isNaN(port) ? undefined : port;
|
|
187
187
|
}
|
|
188
188
|
return undefined;
|
|
189
189
|
}
|
|
@@ -63,7 +63,7 @@ sap.ui.define([
|
|
|
63
63
|
this.model.setProperty('/selectedAggregation/value', selectedItemText);
|
|
64
64
|
let newSelectedControlChildren = Object.keys(ControlUtils.getControlAggregationByName(this.getRuntimeControl(), selectedItemText));
|
|
65
65
|
newSelectedControlChildren = newSelectedControlChildren.map(key => {
|
|
66
|
-
return parseInt(key, radix);
|
|
66
|
+
return Number.parseInt(key, radix);
|
|
67
67
|
});
|
|
68
68
|
this.specialIndexHandling(selectedItemText);
|
|
69
69
|
const updatedIndexArray = this.fillIndexArray(newSelectedControlChildren);
|
|
@@ -108,7 +108,7 @@ sap.ui.define([
|
|
|
108
108
|
const selectedControlName = controlMetadata.getName();
|
|
109
109
|
let selectedControlChildren = Object.keys(ControlUtils.getControlAggregationByName(this.getRuntimeControl(), defaultAggregation));
|
|
110
110
|
selectedControlChildren = selectedControlChildren.map(key => {
|
|
111
|
-
return parseInt(key, radix);
|
|
111
|
+
return Number.parseInt(key, radix);
|
|
112
112
|
});
|
|
113
113
|
this.model.setProperty('/selectedControlName', selectedControlName);
|
|
114
114
|
this.model.setProperty('/selectedAggregation', {});
|
|
@@ -119,7 +119,7 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
|
|
|
119
119
|
);
|
|
120
120
|
|
|
121
121
|
newSelectedControlChildren = newSelectedControlChildren.map((key) => {
|
|
122
|
-
return parseInt(key, radix);
|
|
122
|
+
return Number.parseInt(key, radix);
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
this.specialIndexHandling(selectedItemText);
|
|
@@ -185,7 +185,7 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
|
|
|
185
185
|
);
|
|
186
186
|
|
|
187
187
|
selectedControlChildren = selectedControlChildren.map((key) => {
|
|
188
|
-
return parseInt(key, radix);
|
|
188
|
+
return Number.parseInt(key, radix);
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
this.model.setProperty('/selectedControlName', selectedControlName);
|
|
@@ -92,7 +92,7 @@ sap.ui.define([
|
|
|
92
92
|
const selectedControlName = controlMetadata.getName();
|
|
93
93
|
let selectedControlChildren = Object.keys(ControlUtils.getControlAggregationByName(this.getRuntimeControl(), defaultAggregation));
|
|
94
94
|
selectedControlChildren = selectedControlChildren.map(key => {
|
|
95
|
-
return parseInt(key, radix);
|
|
95
|
+
return Number.parseInt(key, radix);
|
|
96
96
|
});
|
|
97
97
|
this.model.setProperty('/selectedControlName', selectedControlName);
|
|
98
98
|
const indexArray = this.fillIndexArray(selectedControlChildren);
|
|
@@ -151,7 +151,7 @@ export default class AddTableColumnFragments extends BaseDialog<AddTableColumnsF
|
|
|
151
151
|
);
|
|
152
152
|
|
|
153
153
|
selectedControlChildren = selectedControlChildren.map((key) => {
|
|
154
|
-
return parseInt(key, radix);
|
|
154
|
+
return Number.parseInt(key, radix);
|
|
155
155
|
});
|
|
156
156
|
|
|
157
157
|
this.model.setProperty('/selectedControlName', selectedControlName);
|
|
@@ -13,7 +13,7 @@ sap.ui.define([
|
|
|
13
13
|
minor: 71
|
|
14
14
|
};
|
|
15
15
|
function checkVersionInfo(versionInfo) {
|
|
16
|
-
if (isNaN(versionInfo.major) || isNaN(versionInfo.minor) || isNaN(versionInfo.patch ?? 0)) {
|
|
16
|
+
if (Number.isNaN(versionInfo.major) || Number.isNaN(versionInfo.minor) || Number.isNaN(versionInfo.patch ?? 0)) {
|
|
17
17
|
void sendInfoCenterMessage({
|
|
18
18
|
title: { key: 'FLP_UI_VERSION_RETRIEVAL_FAILURE_TITLE' },
|
|
19
19
|
description: { key: 'FLP_UI_INVALID_UI5_VERSION_DESCRIPTION' },
|
|
@@ -37,7 +37,7 @@ sap.ui.define([
|
|
|
37
37
|
type: MessageBarType.error
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
const [major, minor, patch] = version.split('.').map(versionPart => parseInt(versionPart, 10));
|
|
40
|
+
const [major, minor, patch] = version.split('.').map(versionPart => Number.parseInt(versionPart, 10));
|
|
41
41
|
const label = version.split(/-(.*)/s)?.[1];
|
|
42
42
|
return {
|
|
43
43
|
major,
|
|
@@ -31,7 +31,7 @@ export const minVersionInfo = {
|
|
|
31
31
|
* @throws Error if the version info is invalid
|
|
32
32
|
*/
|
|
33
33
|
function checkVersionInfo(versionInfo: Ui5VersionInfo): void {
|
|
34
|
-
if (isNaN(versionInfo.major) || isNaN(versionInfo.minor) || isNaN(versionInfo.patch ?? 0)) {
|
|
34
|
+
if (Number.isNaN(versionInfo.major) || Number.isNaN(versionInfo.minor) || Number.isNaN(versionInfo.patch ?? 0)) {
|
|
35
35
|
void sendInfoCenterMessage({
|
|
36
36
|
title: { key: 'FLP_UI_VERSION_RETRIEVAL_FAILURE_TITLE' },
|
|
37
37
|
description: { key: 'FLP_UI_INVALID_UI5_VERSION_DESCRIPTION' },
|
|
@@ -61,7 +61,7 @@ export async function getUi5Version(library: string = 'sap.ui.core'): Promise<Ui
|
|
|
61
61
|
type: MessageBarType.error
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
const [major, minor, patch] = version.split('.').map((versionPart) => parseInt(versionPart, 10));
|
|
64
|
+
const [major, minor, patch] = version.split('.').map((versionPart) => Number.parseInt(versionPart, 10));
|
|
65
65
|
const label = version.split(/-(.*)/s)?.[1];
|
|
66
66
|
|
|
67
67
|
return {
|
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.23.
|
|
12
|
+
"version": "0.23.18",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
28
|
"qrcode": "1.5.4",
|
|
29
29
|
"@sap/bas-sdk": "3.12.0",
|
|
30
|
-
"@sap-ux/adp-tooling": "0.15.
|
|
31
|
-
"@sap-ux/btp-utils": "1.1.
|
|
30
|
+
"@sap-ux/adp-tooling": "0.15.34",
|
|
31
|
+
"@sap-ux/btp-utils": "1.1.4",
|
|
32
32
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.7.0",
|
|
33
33
|
"@sap-ux/feature-toggle": "0.3.1",
|
|
34
34
|
"@sap-ux/logger": "0.7.0",
|
|
35
|
-
"@sap-ux/project-access": "1.32.
|
|
36
|
-
"@sap-ux/system-access": "0.6.
|
|
37
|
-
"@sap-ux/i18n": "0.3.
|
|
35
|
+
"@sap-ux/project-access": "1.32.3",
|
|
36
|
+
"@sap-ux/system-access": "0.6.19",
|
|
37
|
+
"@sap-ux/i18n": "0.3.4"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@sap-ux-private/playwright": "0.2.
|
|
40
|
+
"@sap-ux-private/playwright": "0.2.1",
|
|
41
41
|
"@types/connect": "^3.4.38",
|
|
42
42
|
"@types/qrcode": "1.5.5",
|
|
43
43
|
"@types/ejs": "3.1.2",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"nock": "13.4.0",
|
|
54
54
|
"npm-run-all2": "6.2.0",
|
|
55
55
|
"supertest": "7.1.4",
|
|
56
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.17.
|
|
57
|
-
"@sap-ux/axios-extension": "1.22.
|
|
58
|
-
"@sap-ux/store": "1.1.
|
|
59
|
-
"@sap-ux/ui5-info": "0.12.
|
|
56
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.17.2",
|
|
57
|
+
"@sap-ux/axios-extension": "1.22.10",
|
|
58
|
+
"@sap-ux/store": "1.1.5",
|
|
59
|
+
"@sap-ux/ui5-info": "0.12.4"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"express": "4"
|