@sap-ux/preview-middleware 0.17.14 → 0.17.16

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.js CHANGED
@@ -238,8 +238,8 @@ class FlpSandbox {
238
238
  this.router.use(config_1.PREVIEW_URL.client.path, (0, express_1.static)(config_1.PREVIEW_URL.client.local));
239
239
  // add route for the sandbox html
240
240
  this.router.get(this.config.path, (async (req, res, next) => {
241
- // karma (connect API) has no request query property
242
- if (req.query && !req.query['sap-ui-xx-viewCache']) {
241
+ // connect API (karma test runner) has no request query property
242
+ if ('query' in req && 'redirect' in res && !req.query['sap-ui-xx-viewCache']) {
243
243
  // Redirect to the same URL but add the necessary parameter
244
244
  const params = structuredClone(req.query);
245
245
  params['sap-ui-xx-viewCache'] = 'false';
@@ -255,7 +255,11 @@ class FlpSandbox {
255
255
  next();
256
256
  }
257
257
  else {
258
- const ui5Version = await this.getUi5Version(req.protocol, req.headers.host, req['ui5-patched-router']?.baseUrl);
258
+ const ui5Version = await this.getUi5Version(
259
+ //use protocol from request header referer as fallback for connect API (karma test runner)
260
+ 'protocol' in req
261
+ ? req.protocol
262
+ : req.headers.referer?.substring(0, req.headers.referer.indexOf(':')) ?? 'http', req.headers.host, 'ui5-patched-router' in req ? req['ui5-patched-router']?.baseUrl : undefined);
259
263
  const html = (0, ejs_1.render)(this.getSandboxTemplate(ui5Version.major), this.templateConfig);
260
264
  this.sendResponse(res, 'text/html', 200, html);
261
265
  }
@@ -424,7 +428,7 @@ class FlpSandbox {
424
428
  const initTemplate = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../../templates/test/testsuite.qunit.js'), 'utf-8');
425
429
  const config = (0, test_1.mergeTestConfigDefaults)(testsuiteConfig);
426
430
  this.logger.debug(`Add route for ${config.path}`);
427
- this.router.get(config.path, (async (_req, res) => {
431
+ this.router.get(config.path, (async (_req, res, _next) => {
428
432
  this.logger.debug(`Serving test route: ${config.path}`);
429
433
  const templateConfig = {
430
434
  basePath: this.templateConfig.basePath,
@@ -37,8 +37,8 @@ sap.ui.define([
37
37
  const version = await getUi5Version();
38
38
  if (isLowerThanMinimalUi5Version(version, {
39
39
  major: 1,
40
- minor: 132,
41
- patch: 0
40
+ minor: 108,
41
+ patch: 27
42
42
  })) {
43
43
  this.isApplicable = false;
44
44
  return;
@@ -90,7 +90,7 @@ sap.ui.define([
90
90
  const annotationFileNameWithoutExtension = `annotation_${ timestamp }`;
91
91
  const annotationFileName = `${ annotationFileNameWithoutExtension }.xml`;
92
92
  const annotationNameSpace = this.context.flexSettings.layer === 'CUSTOMER_BASE' ? `customer.annotation.${ annotationFileNameWithoutExtension }` : `annotation.${ annotationFileNameWithoutExtension }`;
93
- const content = {
93
+ const parameters = {
94
94
  dataSourceId: dataSourceId,
95
95
  annotations: [annotationNameSpace],
96
96
  annotationsInsertPosition: 'END',
@@ -105,11 +105,10 @@ sap.ui.define([
105
105
  changeType: 'appdescr_app_addAnnotationsToOData',
106
106
  generator: this.context.flexSettings.generator,
107
107
  reference: this.context.flexSettings.projectId,
108
- fileName: `id_${ timestamp }_addAnnotationsToOData`,
109
- content: content,
108
+ parameters,
110
109
  serviceUrl: dataSource.serviceUrl
111
110
  };
112
- const command = await CommandFactory.getCommandFor(this.context.view, 'annotation', modifiedValue, null, this.context.flexSettings);
111
+ const command = await CommandFactory.getCommandFor(this.context.view, 'appDescriptor', modifiedValue, null, this.context.flexSettings);
113
112
  return [command];
114
113
  }
115
114
  }
@@ -40,7 +40,7 @@ export class AddNewAnnotationFile
40
40
 
41
41
  async initialize(): Promise<void> {
42
42
  const version = await getUi5Version();
43
- if (isLowerThanMinimalUi5Version(version, { major: 1, minor: 132, patch: 0 })) {
43
+ if (isLowerThanMinimalUi5Version(version, { major: 1, minor: 108, patch: 27 })) {
44
44
  this.isApplicable = false;
45
45
  return;
46
46
  }
@@ -104,7 +104,7 @@ export class AddNewAnnotationFile
104
104
  this.context.flexSettings.layer === 'CUSTOMER_BASE'
105
105
  ? `customer.annotation.${annotationFileNameWithoutExtension}`
106
106
  : `annotation.${annotationFileNameWithoutExtension}`;
107
- const content = {
107
+ const parameters = {
108
108
  dataSourceId: dataSourceId,
109
109
  annotations: [annotationNameSpace],
110
110
  annotationsInsertPosition: 'END',
@@ -119,13 +119,12 @@ export class AddNewAnnotationFile
119
119
  changeType: 'appdescr_app_addAnnotationsToOData',
120
120
  generator: this.context.flexSettings.generator,
121
121
  reference: this.context.flexSettings.projectId,
122
- fileName: `id_${timestamp}_addAnnotationsToOData`,
123
- content: content,
122
+ parameters,
124
123
  serviceUrl: dataSource.serviceUrl
125
124
  };
126
125
  const command = await CommandFactory.getCommandFor<FlexCommand>(
127
126
  this.context.view,
128
- 'annotation',
127
+ 'appDescriptor',
129
128
  modifiedValue,
130
129
  null,
131
130
  this.context.flexSettings
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.17.14",
12
+ "version": "0.17.16",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -29,10 +29,12 @@
29
29
  "@sap-ux/feature-toggle": "0.2.3",
30
30
  "@sap-ux/btp-utils": "1.0.0",
31
31
  "@sap-ux/adp-tooling": "0.12.121",
32
- "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.33",
32
+ "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.34",
33
33
  "@sap-ux/project-access": "1.29.4"
34
34
  },
35
35
  "devDependencies": {
36
+ "connect": "^3.7.0",
37
+ "@types/connect": "^3.4.38",
36
38
  "@types/ejs": "3.1.2",
37
39
  "@types/express": "4.17.21",
38
40
  "@types/prompts": "2.4.4",
@@ -46,7 +48,7 @@
46
48
  "supertest": "6.3.3",
47
49
  "@sap-ux-private/playwright": "0.1.0",
48
50
  "dotenv": "16.3.1",
49
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.56",
51
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.57",
50
52
  "@sap-ux/axios-extension": "1.18.4",
51
53
  "@sap-ux/store": "1.0.0",
52
54
  "@sap-ux/ui5-info": "0.8.3",