@cap-js/ord 1.3.12 → 1.3.14

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/lib/constants.js CHANGED
@@ -14,7 +14,7 @@ const BLOCKED_SERVICE_NAME = Object.freeze({
14
14
 
15
15
  const ORD_ACCESS_STRATEGY = Object.freeze({
16
16
  Open: "open",
17
- Basic: "sap.businesshub:basic-auth:v1",
17
+ Basic: "basic-auth",
18
18
  });
19
19
 
20
20
  const AUTH_TYPE_ORD_ACCESS_STRATEGY_MAP = Object.freeze({
@@ -60,7 +60,7 @@ const LEVEL = Object.freeze({
60
60
  subEntity: "sub-entity",
61
61
  });
62
62
 
63
- const OPEN_RESOURCE_DISCOVERY_VERSION = "1.9";
63
+ const OPEN_RESOURCE_DISCOVERY_VERSION = "1.12";
64
64
 
65
65
  const ORD_EXTENSIONS_PREFIX = "@ORD.Extensions.";
66
66
 
package/lib/interopCsn.js CHANGED
@@ -4,6 +4,7 @@ const localize = require("@sap/cds/lib/i18n/localize");
4
4
  function interopCSN(csn) {
5
5
  if (typeof csn != "object" || csn === null) return csn; // handle non-object inputs early
6
6
  add_i18n_texts(csn);
7
+ remove_localized_assoc(csn);
7
8
  map_annotations(csn);
8
9
  add_meta_info(csn);
9
10
  return csn;
@@ -61,6 +62,30 @@ function add_i18n_texts(csn) {
61
62
  }
62
63
  }
63
64
 
65
+ //
66
+ // remove association "localized" for localized texts
67
+ //
68
+ // The "localized" association for localized elements contains a reference to $user.locale
69
+ // and is specific to the CAP. It needs to be removed from the interop CSN.
70
+ //
71
+ function remove_localized_assoc(csn) {
72
+ // how to detect "localized" association?
73
+ // - name is "localized"
74
+ // - type is "cds.Association"
75
+ // - target name is source name + ".texts"
76
+ // - there is an ON condition
77
+ for (let n1 in csn.definitions) {
78
+ let def = csn.definitions[n1];
79
+ if (def.kind === "entity")
80
+ for (let n2 in def.elements) {
81
+ let el = def.elements[n2];
82
+ if (n2 === "localized" && el.type === "cds.Association" && el.target === `${n1}.texts` && el.on) {
83
+ delete def.elements[n2];
84
+ }
85
+ }
86
+ }
87
+ }
88
+
64
89
  //
65
90
  // annotation mapping/replacement
66
91
  //
@@ -103,6 +128,8 @@ function add_meta_info(csn) {
103
128
  csn["csnInteropEffective"] = "1.0";
104
129
  csn.meta ??= {};
105
130
  csn.meta.flavor = "effective";
131
+ // Remove compiler creator information – not relevant for ORD interop and leaks build details
132
+ if (csn.meta.creator) delete csn.meta.creator;
106
133
 
107
134
  let services = Object.entries(csn.definitions).filter(([, def]) => def.kind === "service");
108
135
  if (services.length === 1) {
@@ -3,8 +3,7 @@ const { ord, getMetadata, defaults, authentication, Logger } = require("./index.
3
3
 
4
4
  class OpenResourceDiscoveryService extends cds.ApplicationService {
5
5
  init() {
6
- const logger = Logger.Logger;
7
- cds.app.get(`${this.path}`, cds.middlewares.before, (_, res) => {
6
+ cds.app.get(`${this.path}`, (_, res) => {
8
7
  return res.status(200).send(defaults.baseTemplate);
9
8
  });
10
9
 
@@ -23,7 +22,7 @@ class OpenResourceDiscoveryService extends cds.ApplicationService {
23
22
  const { contentType, response } = await getMetadata(req.url);
24
23
  return res.status(200).contentType(contentType).send(response);
25
24
  } catch (error) {
26
- logger.error(error, "Error while processing the resource definition document");
25
+ Logger.error(error, "Error while processing the resource definition document");
27
26
  return res.status(500).send(error.message);
28
27
  }
29
28
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/ord",
3
- "version": "1.3.12",
3
+ "version": "1.3.14",
4
4
  "description": "CAP Plugin for generating ORD document.",
5
5
  "repository": "cap-js/ord",
6
6
  "author": "SAP SE (https://www.sap.com)",
@@ -8,7 +8,8 @@
8
8
  "license": "Apache-2.0",
9
9
  "workspaces": [
10
10
  "xmpl",
11
- "xmpl_java"
11
+ "xmpl_java",
12
+ "__tests__/integration-test-app"
12
13
  ],
13
14
  "main": "cds-plugin.js",
14
15
  "files": [
@@ -20,13 +21,15 @@
20
21
  "scripts": {
21
22
  "lint": "npx eslint .",
22
23
  "test": "jest --ci --collectCoverage",
24
+ "test:integration": "jest __tests__/integration.test.js --testTimeout=30000 --testPathIgnorePatterns=/node_modules/ --forceExit",
23
25
  "update-snapshot": "jest --ci --updateSnapshot",
24
26
  "cds:version": "cds v -i"
25
27
  },
26
28
  "devDependencies": {
27
29
  "eslint": "^9.2.0",
28
30
  "jest": "^30.0.0",
29
- "prettier": "3.6.2"
31
+ "prettier": "3.6.2",
32
+ "supertest": "^7.0.0"
30
33
  },
31
34
  "peerDependencies": {
32
35
  "@sap/cds": ">=8.9.4",
@@ -35,10 +38,13 @@
35
38
  "dependencies": {
36
39
  "@cap-js/asyncapi": "^1.0.3",
37
40
  "@cap-js/openapi": "^1.2.1",
38
- "bcryptjs": "3.0.2",
41
+ "bcryptjs": "3.0.3",
39
42
  "cli-progress": "^3.12.0",
40
43
  "lodash": "^4.17.21"
41
44
  },
45
+ "engines": {
46
+ "node": ">=18 <23"
47
+ },
42
48
  "cds": {
43
49
  "requires": {
44
50
  "SAP ORD Service": {