@sap/cds-compiler 5.9.10 → 5.9.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/CHANGELOG.md CHANGED
@@ -7,18 +7,36 @@
7
7
  Note: `beta` fixes, changes and features are usually not listed in this ChangeLog but [here](doc/CHANGELOG_BETA.md).
8
8
  The compiler behavior concerning `beta` features can change at any time without notice.
9
9
 
10
+ ## Verion 5.9.14 - 2025-12-03
11
+
12
+ ### Fixed
13
+
14
+ - to.sql|hdi: Don't add superfluous and sometimes wrong (SQLite) parentheses around `UNION`s
15
+
16
+ ## Version 5.9.12 - 2025-09-19
17
+
18
+ ### Fixed
19
+
20
+ - to.sql: Topological ordering of views did not always account for subqueries (fixes regression from v5.9.0)
21
+
10
22
  ## Version 5.9.10 - 2025-09-11
11
23
 
24
+ ### Fixed
25
+
12
26
  - parser: Keep parentheses around lists on the right side of an `in` operator.
13
27
  - compiler: For calculated elements using associations with filters and cardinality, CSN recompilation could
14
28
  fail for `gensrc` CSN, as happens for MTX.
15
29
 
16
30
  ## Version 5.9.8 - 2025-07-14
17
31
 
32
+ ### Fixed
33
+
18
34
  - compiler: Calculated elements can now have a localized type
19
35
 
20
36
  ## Version 5.9.6 - 2025-06-18
21
37
 
38
+ ### Fixed
39
+
22
40
  - to.sql: Fix error when calculated element refers to a localized element.
23
41
  - to.edm(x):
24
42
  + Fix errors for service entities containing multiple path steps (e.g. `Service.Prefix.MyEntity`).
@@ -26,6 +44,8 @@ The compiler behavior concerning `beta` features can change at any time without
26
44
 
27
45
  ## Version 5.9.4 - 2025-05-22
28
46
 
47
+ ### Fixed
48
+
29
49
  - to.edm(x): Parameters are marked optional unless explicitly marked as `not null`.
30
50
  Annotation `Core.OptionalParameter` will be added to optional parameters.
31
51
 
@@ -602,8 +602,7 @@ function forAllQueries( query, queryCallback, path ) {
602
602
  const expr = query[prop];
603
603
  if (expr && typeof expr === 'object') {
604
604
  if (Array.isArray(expr)) {
605
- for (let i = 0; i < expr.length; i++)
606
- forAllQueries(expr[i], queryCallback, [ ...path, prop, i ]);
605
+ traverseStructurizedExpression(expr, [ ...path, prop ]);
607
606
  }
608
607
  else {
609
608
  for (const argName of Object.keys( expr ))
@@ -611,6 +610,23 @@ function forAllQueries( query, queryCallback, path ) {
611
610
  }
612
611
  }
613
612
  }
613
+
614
+ /**
615
+ * Traverse the possibly structured xpr. A structured expression may contain arrays inside arrays
616
+ * to show precedence of operators.
617
+ *
618
+ * @param {any} xpr
619
+ * @param {CSN.Path} csnPath
620
+ */
621
+ function traverseStructurizedExpression( xpr, csnPath ) {
622
+ if (Array.isArray(xpr)) {
623
+ for (let i = 0; i < xpr.length; i++)
624
+ traverseStructurizedExpression(xpr[i], [ ...csnPath, i ]);
625
+ }
626
+ else {
627
+ forAllQueries(xpr, queryCallback, csnPath);
628
+ }
629
+ }
614
630
  }
615
631
 
616
632
  /**
@@ -1307,11 +1307,7 @@ function toSqlDdl( csn, options, messageFunctions ) {
1307
1307
 
1308
1308
  // Set operation may also have an ORDER BY and LIMIT/OFFSET (in contrast to the ones belonging to
1309
1309
  // each SELECT)
1310
- // If the whole SET has an ORDER BY/LIMIT, wrap the part before that in parentheses
1311
- // (otherwise some SQL implementations (e.g. sqlite) would interpret the ORDER BY/LIMIT as belonging
1312
- // to the last SET argument, not to the whole SET)
1313
1310
  if (query.SET.orderBy || query.SET.limit) {
1314
- result = `(${result})`;
1315
1311
  if (query.SET.orderBy) {
1316
1312
  const orderBy = query.SET.orderBy.map(entry => renderOrderByEntry(entry, env.withSubPath([ 'orderBy' ]))).join(', ');
1317
1313
  result += `\n${env.indent}ORDER BY ${orderBy}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-compiler",
3
- "version": "5.9.10",
3
+ "version": "5.9.14",
4
4
  "description": "CDS (Core Data Services) compiler and backends",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "author": "SAP SE (https://www.sap.com)",