@sap/cds-compiler 6.9.3 → 7.0.1
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 +76 -2
- package/bin/cdsc.js +4 -33
- package/doc/IncompatibleChanges_v7.md +639 -0
- package/lib/api/main.js +4 -56
- package/lib/api/options.js +5 -15
- package/lib/api/validate.js +1 -0
- package/lib/base/builtins.js +1 -2
- package/lib/base/csnRefs.js +2 -6
- package/lib/base/message-registry.js +82 -76
- package/lib/base/messages.js +8 -5
- package/lib/base/optionProcessor.js +2 -72
- package/lib/base/specialOptions.js +20 -17
- package/lib/checks/defaultValues.js +1 -39
- package/lib/checks/hasPersistedElements.js +19 -3
- package/lib/checks/parameters.js +0 -34
- package/lib/checks/selectItems.js +2 -38
- package/lib/checks/typeParameters.js +162 -0
- package/lib/checks/validator.js +5 -8
- package/lib/compiler/assert-consistency.js +19 -5
- package/lib/compiler/checks.js +47 -43
- package/lib/compiler/define.js +6 -6
- package/lib/compiler/extend.js +102 -111
- package/lib/compiler/generate.js +4 -8
- package/lib/compiler/populate.js +4 -7
- package/lib/compiler/propagator.js +9 -9
- package/lib/compiler/resolve.js +205 -7
- package/lib/compiler/shared.js +76 -82
- package/lib/compiler/tweak-assocs.js +102 -22
- package/lib/compiler/utils.js +57 -12
- package/lib/compiler/xpr-rewrite.js +2 -15
- package/lib/edm/annotations/edmJson.js +14 -10
- package/lib/edm/annotations/genericTranslation.js +3 -1
- package/lib/edm/annotations/preprocessAnnotations.js +9 -26
- package/lib/edm/csn2edm.js +27 -20
- package/lib/edm/edmUtils.js +25 -0
- package/lib/gen/CdlGrammar.checksum +1 -1
- package/lib/gen/CdlParser.js +2237 -2241
- package/lib/gen/Dictionary.json +17 -2
- package/lib/json/from-csn.js +67 -52
- package/lib/json/to-csn.js +28 -25
- package/lib/language/textUtils.js +0 -13
- package/lib/main.d.ts +22 -59
- package/lib/main.js +1 -1
- package/lib/model/csnUtils.js +9 -8
- package/lib/parsers/AstBuildingParser.js +45 -55
- package/lib/parsers/Lexer.js +2 -0
- package/lib/parsers/identifiers.js +0 -9
- package/lib/render/toCdl.js +41 -40
- package/lib/render/toSql.js +8 -1
- package/lib/render/utils/common.js +1 -1
- package/lib/render/utils/sql.js +2 -3
- package/lib/tool-lib/enrichCsn.js +1 -2
- package/lib/transform/db/applyTransformations.js +7 -5
- package/lib/transform/db/assertUnique.js +8 -51
- package/lib/transform/db/associations.js +1 -1
- package/lib/transform/db/cdsPersistence.js +1 -15
- package/lib/transform/db/expansion.js +9 -12
- package/lib/transform/db/flattening.js +1 -1
- package/lib/transform/db/groupByOrderBy.js +0 -16
- package/lib/transform/db/views.js +57 -161
- package/lib/transform/draft/db.js +2 -2
- package/lib/transform/forOdata.js +25 -14
- package/lib/transform/forRelationalDB.js +93 -301
- package/lib/transform/localized.js +33 -102
- package/lib/transform/odata/flattening.js +11 -2
- package/lib/transform/transformUtils.js +25 -3
- package/lib/transform/universalCsn/universalCsnEnricher.js +1 -2
- package/package.json +2 -2
- package/lib/render/toHdbcds.js +0 -1810
package/CHANGELOG.md
CHANGED
|
@@ -5,14 +5,88 @@
|
|
|
5
5
|
<!-- (no-duplicate-heading)-->
|
|
6
6
|
|
|
7
7
|
If you upgrade from a previous version, you might want to read in more detail about
|
|
8
|
-
incompatible [changes between
|
|
9
|
-
and [changes between
|
|
8
|
+
incompatible [changes between v6 and v7](./doc/IncompatibleChanges_v7.md)
|
|
9
|
+
and [changes between v5 and v6](./doc/IncompatibleChanges_v6.md).
|
|
10
10
|
|
|
11
11
|
Note: while we list new `beta` flags and their removal in this ChangeLog,
|
|
12
12
|
we might not list every change in its behavior here.
|
|
13
13
|
Productive code should never require a `beta` flag to be set, and
|
|
14
14
|
might use a deprecated flag only for a limited period of time.
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Version 7.0.1 - 2026-06-18
|
|
19
|
+
|
|
20
|
+
### ⚠ BREAKING CHANGES
|
|
21
|
+
|
|
22
|
+
- Node.js 22 is now the minimum required version.
|
|
23
|
+
- The deprecated backend "hdbcds" has been removed.
|
|
24
|
+
- **compiler:**
|
|
25
|
+
+ An `annotate` statement for assigning a security-relevant annotation (`@restrict`, `@requires`, `@ams.…`)
|
|
26
|
+
to a bound action (or element, …) of a non-existent definition now is an error (for security reasons that
|
|
27
|
+
has already been the case since compiler version 6.5.0).
|
|
28
|
+
+ The CSN representation for annotations with expression-like values has been changed: property `=` is no longer present,
|
|
29
|
+
unless the expression is a simple reference. An object as annotation value with a “primary expression property” like
|
|
30
|
+
`ref` or `xpr` is always interpreted as an expression. Before, it was only interpreted as expression if the object also
|
|
31
|
+
contained a property `=`. In order to avoid ambiguities, it is not allowed to provide structured annotation values that
|
|
32
|
+
could be confused with expressions.
|
|
33
|
+
+ Expression-like values that are not simple references are no longer allowed as comparator value for `... up to` when
|
|
34
|
+
extending array like annotation values. Simple references now are handled correctly.
|
|
35
|
+
+ `null` as annotation value is now propagated like any other value. Exceptions are `includes` with multiple structures/aspects:
|
|
36
|
+
value `null` from a later include does not overwrite a value from an earlier include (no change compared to previous releases).
|
|
37
|
+
+ The compiler now reports an error when multiple `extend ... with <aspect>` statements introduce the same element or action.
|
|
38
|
+
+ Providing a default for a structure with more than one elements now leads to an error.
|
|
39
|
+
+ Providing a default for an array now leads to an error.
|
|
40
|
+
+ The rules for the propagation of `key` in queries have been simplified: Keys are propagated, if no explicit key is set in
|
|
41
|
+
the query and all key elements of the primary base entity and of joined entities are selected.
|
|
42
|
+
+ No longer propagate the `key` property of the elements of structures which are included into a structured type.
|
|
43
|
+
+ It is no longer possible to extend built-in types by adding type properties.
|
|
44
|
+
+ Always propagate annotation with `elements` and `enum` expansion.
|
|
45
|
+
+ Ensure that recompiling a CSN of flavor `gensrc` / `xtended` does not change the element order.
|
|
46
|
+
+ Streamline and fix sloppy handling of optional semicolon.
|
|
47
|
+
+ Property `compilerVersion` has been removed from CSN meta (was introduced in 6.9.0). Keep using property `creator` instead.
|
|
48
|
+
+ The error `syntax-unsupported-masked` (for using the non-documented keyword or CSN property `masked`) is not configurable anymore.
|
|
49
|
+
+ The error `name-deprecated-$self` (for naming an entity `$self`) is not configurable anymore.
|
|
50
|
+
+ The error `syntax-unexpected-filter` (for providing a filter for the result of a function call) is not configurable anymore.
|
|
51
|
+
+ Deprecated flags `noPersistenceJournalForGeneratedEntities` and `noCompositionIncludes` have been removed.
|
|
52
|
+
+ Add stricter checks for associations (or compositions) which are defined like `assoc: Association to Target on assoc.back = $self`:
|
|
53
|
+
- only one bare `$self` comparison is allowed per `on` condition.
|
|
54
|
+
- the target of the backlink association `back` must be the enclosing artifact or one of its includes/query sources.
|
|
55
|
+
- all target elements which are referred to in the foreign keys or
|
|
56
|
+
on-condition of the backlink association `back` must be projected.
|
|
57
|
+
- **odata:** The (deprecated) property `EffectsType` has been removed from `Common.SideEffectsType` in a recent update of the OData vocabularies.
|
|
58
|
+
- **sql:**
|
|
59
|
+
+ For SQLite, type `cds.Decimal` is now mapped to `REAL_DECIMAL` with affinity "REAL".
|
|
60
|
+
To switch back to `DECIMAL` you can set the option `decimal_affinity` to `numeric`.
|
|
61
|
+
+ Obsolete option `fewerLocalizedViews` (introduced in cds-compiler v5) has been removed.
|
|
62
|
+
|
|
63
|
+
### Features
|
|
64
|
+
|
|
65
|
+
- **compiler:** Special property `$includeAfter` is put into a CSN of flavor `gensrc`/`xtended` to preserve the original
|
|
66
|
+
element order for entities and other structures with `includes` added via an `extend` statement.
|
|
67
|
+
- **sql:** Default values from structures with a single element are propagated to the flattened leaf element.
|
|
68
|
+
- **odata:** Default values from structures with a single element are propagated to the flattened leaf element.
|
|
69
|
+
|
|
70
|
+
### Bug Fixes
|
|
71
|
+
|
|
72
|
+
- **sql:**
|
|
73
|
+
+ An error is reported for subqueries that select only virtual elements. This avoids late errors during database deployment.
|
|
74
|
+
+ Parameter references in nested inlines are now handled correctly.
|
|
75
|
+
|
|
76
|
+
### Improvements
|
|
77
|
+
|
|
78
|
+
- **compiler:**
|
|
79
|
+
+ Messages reported by compiler backends for non-applied `annotate` statements now mention the original file location if that is unique.
|
|
80
|
+
+ The message IDs and texts for undefined references have been consolidated.
|
|
81
|
+
- **odata:**
|
|
82
|
+
+ Non-spec compliant simple identifiers in OData V2 now lead to a warning.
|
|
83
|
+
+ Avoid duplicate or incorrect warnings for value help shortcut.
|
|
84
|
+
- **sql:**
|
|
85
|
+
+ Performance of the SQL backend has been improved: wildcard `*` in views and projections is only expanded lazily.
|
|
86
|
+
+ No errors are reported anymore for non-persisted entities, as they are irrelevant for database deployment
|
|
87
|
+
(for the message IDs `type-missing-argument`, `type-unexpected-argument`, `ref-unsupported-type`, and `ref-unexpected-args`).
|
|
88
|
+
|
|
89
|
+
|
|
16
90
|
## Version 6.9.3 - 2026-06-17
|
|
17
91
|
|
|
18
92
|
### Bug Fixes
|
package/bin/cdsc.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
const compiler = require('../lib/compiler');
|
|
21
21
|
const main = require('../lib/main');
|
|
22
|
-
const { for_sql: forSql, for_hdi: forHdi
|
|
22
|
+
const { for_sql: forSql, for_hdi: forHdi } = require('../lib/api/main');
|
|
23
23
|
const { compactModel } = require('../lib/json/to-csn');
|
|
24
24
|
const { toRename: _toRename } = require('../lib/render/toRename');
|
|
25
25
|
const util = require('util');
|
|
@@ -179,9 +179,8 @@ function cdscMain() {
|
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const opt = cmdLine.options[to];
|
|
182
|
+
if (cmdLine.options.toSql) {
|
|
183
|
+
const opt = cmdLine.options.toSql;
|
|
185
184
|
// remap string values in options to boolean
|
|
186
185
|
if (opt.assertIntegrity &&
|
|
187
186
|
(opt.assertIntegrity === 'true' ||
|
|
@@ -225,11 +224,6 @@ function cdscMain() {
|
|
|
225
224
|
cmdLine.options.fallbackParser ??= 'auto!';
|
|
226
225
|
|
|
227
226
|
const commandOptions = cmdLine.options[cmdLine.command];
|
|
228
|
-
if (commandOptions?.transitiveLocalizedViews) {
|
|
229
|
-
cmdLine.options.fewerLocalizedViews = !commandOptions.transitiveLocalizedViews;
|
|
230
|
-
delete commandOptions.transitiveLocalizedViews;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
227
|
if (commandOptions?.noRenderCdlDefinitionNesting) {
|
|
234
228
|
commandOptions.renderCdlDefinitionNesting = false;
|
|
235
229
|
delete commandOptions.noRenderCdlDefinitionNesting;
|
|
@@ -260,7 +254,7 @@ function cdscMain() {
|
|
|
260
254
|
* @param {object} args
|
|
261
255
|
*/
|
|
262
256
|
function validateDirectBackendOption( command, options, args ) {
|
|
263
|
-
if (![ 'toCdl', 'toOdata', '
|
|
257
|
+
if (![ 'toCdl', 'toOdata', 'toCsn', 'toSql', 'forJava' ].includes(command)) {
|
|
264
258
|
displayUsage(`Option '--direct-backend' can't be used with command '${ command }'`,
|
|
265
259
|
optionProcessor.helpText, 2);
|
|
266
260
|
}
|
|
@@ -327,7 +321,6 @@ async function executeCommandLine( command, options, args ) {
|
|
|
327
321
|
const commands = {
|
|
328
322
|
toCdl,
|
|
329
323
|
toCsn,
|
|
330
|
-
toHana,
|
|
331
324
|
toOdata,
|
|
332
325
|
forJava,
|
|
333
326
|
toRename,
|
|
@@ -429,23 +422,6 @@ async function executeCommandLine( command, options, args ) {
|
|
|
429
422
|
return model;
|
|
430
423
|
}
|
|
431
424
|
|
|
432
|
-
// Execute the command line option '--to-hana' and display the results.
|
|
433
|
-
// Return the original model (for chaining)
|
|
434
|
-
function toHana( model ) {
|
|
435
|
-
const csn = options.directBackend ? model : compactModel(model, options);
|
|
436
|
-
|
|
437
|
-
if (options.csn) {
|
|
438
|
-
displayNamedCsn(forHdbcds(csn, options), 'hana_csn');
|
|
439
|
-
}
|
|
440
|
-
else {
|
|
441
|
-
const hanaResult = main.to.hdbcds(csn, options);
|
|
442
|
-
for (const name in hanaResult)
|
|
443
|
-
writeToFileOrDisplay(options.out, name, hanaResult[name]);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
return model;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
425
|
// Execute the command line option '--to-odata' and display the results.
|
|
450
426
|
// Return the original model (for chaining)
|
|
451
427
|
function toOdata( model ) {
|
|
@@ -695,11 +671,6 @@ async function executeCommandLine( command, options, args ) {
|
|
|
695
671
|
return;
|
|
696
672
|
fileName = fileName.replace(/[:/\\]/g, '_');
|
|
697
673
|
|
|
698
|
-
// replace all dots with underscore to get deployable .hdbcds sources
|
|
699
|
-
// (except the one before the file extension)
|
|
700
|
-
if (options.transformation === 'hdbcds')
|
|
701
|
-
fileName = fileName.replace(/\.(?=.*?\.)/g, '_');
|
|
702
|
-
|
|
703
674
|
if (typeof content !== 'string')
|
|
704
675
|
content = JSON.stringify(content, null, 2);
|
|
705
676
|
|