@sap/cds-compiler 5.9.4 → 6.0.10
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 +104 -319
- package/README.md +1 -1
- package/bin/cds_update_identifiers.js +3 -5
- package/bin/cdsc.js +22 -8
- package/bin/cdshi.js +1 -1
- package/bin/cdsse.js +4 -4
- package/doc/CHANGELOG_BETA.md +11 -0
- package/doc/CHANGELOG_DEPRECATED.md +29 -0
- package/lib/api/main.js +8 -5
- package/lib/api/options.js +12 -10
- package/lib/base/builtins.js +1 -0
- package/lib/base/message-registry.js +190 -96
- package/lib/base/messages.js +29 -20
- package/lib/base/model.js +14 -24
- package/lib/checks/actionsFunctions.js +10 -20
- package/lib/checks/annotationsOData.js +1 -1
- package/lib/checks/elements.js +30 -10
- package/lib/checks/enums.js +31 -0
- package/lib/checks/foreignKeys.js +2 -2
- package/lib/checks/hasPersistedElements.js +5 -0
- package/lib/checks/invalidTarget.js +1 -1
- package/lib/checks/managedWithoutKeys.js +5 -4
- package/lib/checks/queryNoDbArtifacts.js +10 -8
- package/lib/checks/types.js +5 -5
- package/lib/checks/validator.js +6 -4
- package/lib/compiler/assert-consistency.js +12 -9
- package/lib/compiler/checks.js +18 -50
- package/lib/compiler/define.js +6 -6
- package/lib/compiler/extend.js +2 -1
- package/lib/compiler/generate.js +14 -17
- package/lib/compiler/populate.js +8 -31
- package/lib/compiler/propagator.js +21 -35
- package/lib/compiler/resolve.js +35 -22
- package/lib/compiler/shared.js +7 -1
- package/lib/compiler/tweak-assocs.js +1 -1
- package/lib/compiler/utils.js +1 -1
- package/lib/edm/annotations/edmJson.js +20 -15
- package/lib/edm/annotations/genericTranslation.js +7 -8
- package/lib/edm/csn2edm.js +46 -50
- package/lib/edm/edm.js +8 -7
- package/lib/edm/edmPreprocessor.js +33 -83
- package/lib/edm/edmUtils.js +2 -2
- package/lib/gen/BaseParser.js +55 -44
- package/lib/gen/CdlGrammar.checksum +1 -1
- package/lib/gen/CdlParser.js +1133 -1150
- package/lib/json/from-csn.js +70 -43
- package/lib/json/to-csn.js +6 -8
- package/lib/language/multiLineStringParser.js +3 -2
- package/lib/main.d.ts +58 -24
- package/lib/model/csnUtils.js +28 -39
- package/lib/model/xprAsTree.js +23 -9
- package/lib/modelCompare/compare.js +5 -4
- package/lib/optionProcessor.js +21 -17
- package/lib/parsers/AstBuildingParser.js +63 -11
- package/lib/parsers/XprTree.js +57 -3
- package/lib/parsers/identifiers.js +1 -1
- package/lib/parsers/index.js +0 -3
- package/lib/render/manageConstraints.js +25 -25
- package/lib/render/toCdl.js +173 -170
- package/lib/render/toHdbcds.js +126 -128
- package/lib/render/toRename.js +7 -7
- package/lib/render/toSql.js +128 -125
- package/lib/render/utils/common.js +47 -22
- package/lib/render/utils/delta.js +25 -25
- package/lib/render/utils/operators.js +2 -2
- package/lib/render/utils/pretty.js +5 -5
- package/lib/render/utils/sql.js +13 -13
- package/lib/render/utils/standardDatabaseFunctions.js +115 -103
- package/lib/render/utils/unique.js +4 -4
- package/lib/transform/db/applyTransformations.js +1 -1
- package/lib/transform/db/assertUnique.js +2 -2
- package/lib/transform/db/associations.js +6 -7
- package/lib/transform/db/assocsToQueries/utils.js +4 -5
- package/lib/transform/db/backlinks.js +12 -9
- package/lib/transform/db/cdsPersistence.js +8 -7
- package/lib/transform/db/constraints.js +13 -10
- package/lib/transform/db/expansion.js +7 -3
- package/lib/transform/db/flattening.js +4 -14
- package/lib/transform/db/processSqlServices.js +2 -1
- package/lib/transform/db/temporal.js +5 -7
- package/lib/transform/db/views.js +2 -4
- package/lib/transform/draft/db.js +8 -8
- package/lib/transform/draft/odata.js +10 -7
- package/lib/transform/forOdata.js +10 -5
- package/lib/transform/forRelationalDB.js +5 -75
- package/lib/transform/localized.js +1 -1
- package/lib/transform/odata/createForeignKeys.js +11 -10
- package/lib/transform/odata/flattening.js +8 -4
- package/lib/transform/odata/foreignKeyRefsInXprAnnos.js +96 -0
- package/lib/transform/odata/typesExposure.js +3 -3
- package/lib/transform/transformUtils.js +4 -8
- package/lib/transform/translateAssocsToJoins.js +14 -7
- package/lib/transform/universalCsn/universalCsnEnricher.js +10 -4
- package/lib/utils/objectUtils.js +0 -17
- package/package.json +10 -13
- package/share/messages/def-upcoming-virtual-change.md +1 -1
- package/LICENSE +0 -37
- package/bin/cds_remove_invalid_whitespace.js +0 -138
- package/doc/CHANGELOG_ARCHIVE.md +0 -3604
- package/lib/gen/genericAntlrParser.js +0 -3
- package/lib/gen/language.checksum +0 -1
- package/lib/gen/language.interp +0 -456
- package/lib/gen/language.tokens +0 -180
- package/lib/gen/languageLexer.interp +0 -439
- package/lib/gen/languageLexer.js +0 -1483
- package/lib/gen/languageLexer.tokens +0 -167
- package/lib/gen/languageParser.js +0 -24941
- package/lib/language/antlrParser.js +0 -205
- package/lib/language/errorStrategy.js +0 -646
- package/lib/language/genericAntlrParser.js +0 -1572
- package/lib/parsers/CdlGrammar.g4 +0 -2070
|
@@ -11,6 +11,35 @@ Note: `deprecated` features are listed in this ChangeLog just for information.
|
|
|
11
11
|
**When the `deprecated` option is set, the `beta` option is ignored,
|
|
12
12
|
and several new features are not available.**
|
|
13
13
|
|
|
14
|
+
## Version 6.0.8 - 2025-05-23
|
|
15
|
+
|
|
16
|
+
### Added `noQuasiVirtualAssocs`
|
|
17
|
+
|
|
18
|
+
If set, managed to-many associations will get foreign keys again.
|
|
19
|
+
In cds-compiler v6, managed to-many associations without explicit foreign keys
|
|
20
|
+
don't get `keys` anymore. This flag restores v5 behavior.
|
|
21
|
+
|
|
22
|
+
### Added `noCompositionIncludes`
|
|
23
|
+
|
|
24
|
+
If set, generated entities for composition-of-named-aspect will not
|
|
25
|
+
get an `includes` property.
|
|
26
|
+
|
|
27
|
+
### Added `noPersistenceJournalForGeneratedEntities`
|
|
28
|
+
|
|
29
|
+
If set, `@cds.persistence.journal` will _not_ be propagated to generated entities,
|
|
30
|
+
including generated `.texts` entities for localized entities, nor generated entities
|
|
31
|
+
for compositions-of-aspect.
|
|
32
|
+
|
|
33
|
+
In cds-compiler v6, this annotation is copied to `.texts` entities as well as
|
|
34
|
+
generated composition-of-aspect entities it by default.
|
|
35
|
+
|
|
36
|
+
### Removed `includesNonShadowedFirst`
|
|
37
|
+
|
|
38
|
+
### Removed `eagerPersistenceForGeneratedEntities`
|
|
39
|
+
|
|
40
|
+
### Removed `noKeyPropagationWithExpansions`
|
|
41
|
+
|
|
42
|
+
|
|
14
43
|
## Version 4.2.0 - 2023-08-29
|
|
15
44
|
|
|
16
45
|
### Added `noKeyPropagationWithExpansions`
|
package/lib/api/main.js
CHANGED
|
@@ -481,6 +481,9 @@ function sqlMigration( csn, options, messageFunctions, beforeImage ) {
|
|
|
481
481
|
messageFunctions.throwWithError();
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
+
if (!internalOptions.script && internalOptions.sqlDialect === 'hana')
|
|
485
|
+
messageFunctions.warning('api-invalid-combination', null, { '#': 'hana-migration', value: internalOptions.sqlDialect });
|
|
486
|
+
|
|
484
487
|
if (internalOptions.script && !internalOptions.severities?.['migration-unsupported-key-change']) {
|
|
485
488
|
internalOptions.severities = Object.assign({}, internalOptions.severities ?? {});
|
|
486
489
|
internalOptions.severities['migration-unsupported-key-change'] = 'Warning';
|
|
@@ -567,7 +570,7 @@ function sqlMigration( csn, options, messageFunctions, beforeImage ) {
|
|
|
567
570
|
const name = stack.pop();
|
|
568
571
|
const artifact = diff.definitions[name];
|
|
569
572
|
if (drops.creates[name] === undefined) {
|
|
570
|
-
if (artifact
|
|
573
|
+
if (csnUtils.hasPersistenceSkipAnnotation(artifact) && markedSkipByUs[name]) {
|
|
571
574
|
// Remove the skip so we render a CREATE VIEW
|
|
572
575
|
diff.definitions[name]['@cds.persistence.skip'] = false;
|
|
573
576
|
drops.creates[name] = `DROP VIEW ${ identifierUtils.renderArtifactName(name) };`;
|
|
@@ -752,8 +755,8 @@ function hdbcds( csn, options, messageFunctions ) {
|
|
|
752
755
|
messageFunctions.setOptions( internalOptions );
|
|
753
756
|
|
|
754
757
|
// Since v5, the HDBCDS backend is considered deprecated.
|
|
755
|
-
//
|
|
756
|
-
messageFunctions.
|
|
758
|
+
// Since v6, it is a configurable error.
|
|
759
|
+
messageFunctions.message('api-deprecated-hdbcds', null, null);
|
|
757
760
|
|
|
758
761
|
if (options.tenantDiscriminator) {
|
|
759
762
|
messageFunctions.error('api-invalid-option', null, {
|
|
@@ -816,7 +819,7 @@ function edmall( csn, options, messageFunctions ) {
|
|
|
816
819
|
const { error } = messageFunctions;
|
|
817
820
|
|
|
818
821
|
if (internalOptions.odataVersion === 'v2')
|
|
819
|
-
error(
|
|
822
|
+
error('api-invalid-option', null, { '#': 'odataV2json' });
|
|
820
823
|
|
|
821
824
|
const result = {};
|
|
822
825
|
let oDataCsn = csn;
|
|
@@ -966,7 +969,7 @@ function odataall( csn, options, messageFunctions ) {
|
|
|
966
969
|
const { error } = messageFunctions;
|
|
967
970
|
|
|
968
971
|
if (internalOptions.odataVersion === 'v2')
|
|
969
|
-
error(
|
|
972
|
+
error('api-invalid-option', null, { '#': 'odataV2json' });
|
|
970
973
|
|
|
971
974
|
let oDataCsn = csn;
|
|
972
975
|
if (isPreTransformed(csn, 'odata')) {
|
package/lib/api/options.js
CHANGED
|
@@ -20,7 +20,6 @@ const publicOptionsNewAPI = [
|
|
|
20
20
|
'defaultBinaryLength',
|
|
21
21
|
'defaultStringLength',
|
|
22
22
|
'csnFlavor',
|
|
23
|
-
'compositionIncludes',
|
|
24
23
|
// DB
|
|
25
24
|
'sqlDialect',
|
|
26
25
|
'sqlMapping',
|
|
@@ -35,6 +34,7 @@ const publicOptionsNewAPI = [
|
|
|
35
34
|
'withHanaAssociations',
|
|
36
35
|
'standardDatabaseFunctions',
|
|
37
36
|
'booleanEquality',
|
|
37
|
+
'dollarNowAsTimestamp',
|
|
38
38
|
// ODATA
|
|
39
39
|
'odataOpenapiHints',
|
|
40
40
|
'edm4OpenAPI',
|
|
@@ -86,7 +86,7 @@ const privateOptions = [
|
|
|
86
86
|
'internalMsg',
|
|
87
87
|
'disableHanaComments', // in case of issues with hana comment rendering
|
|
88
88
|
'tenantDiscriminator', // not published yet
|
|
89
|
-
'localizedWithoutCoalesce', // deprecated version of 'localizedLanguageFallback', TODO(
|
|
89
|
+
'localizedWithoutCoalesce', // deprecated version of 'localizedLanguageFallback', TODO(v7): Remove option
|
|
90
90
|
];
|
|
91
91
|
|
|
92
92
|
const overallOptions = publicOptionsNewAPI.concat(privateOptions);
|
|
@@ -156,7 +156,7 @@ function reclassifyErrorsForOpenApi( options ) {
|
|
|
156
156
|
// shallow clone, so that we can modify severities without changing the user's.
|
|
157
157
|
options.severities = Object.assign({}, options.severities ?? {});
|
|
158
158
|
|
|
159
|
-
options.severities['odata-
|
|
159
|
+
options.severities['odata-missing-key'] = 'Warning';
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -164,10 +164,9 @@ function reclassifyErrorsForOpenApi( options ) {
|
|
|
164
164
|
module.exports = {
|
|
165
165
|
to: {
|
|
166
166
|
cdl: (options) => {
|
|
167
|
-
// TODO(v6): Change defaults to 'true'
|
|
168
167
|
const defaultOptions = {
|
|
169
|
-
renderCdlDefinitionNesting:
|
|
170
|
-
renderCdlCommonNamespace:
|
|
168
|
+
renderCdlDefinitionNesting: true,
|
|
169
|
+
renderCdlCommonNamespace: true,
|
|
171
170
|
};
|
|
172
171
|
return translateOptions(options, defaultOptions, undefined, undefined, undefined, 'to.cdl');
|
|
173
172
|
},
|
|
@@ -176,8 +175,9 @@ module.exports = {
|
|
|
176
175
|
const defaultOptions = {
|
|
177
176
|
sqlMapping: 'plain',
|
|
178
177
|
sqlDialect: 'plain',
|
|
179
|
-
withHanaAssociations:
|
|
180
|
-
booleanEquality:
|
|
178
|
+
withHanaAssociations: false,
|
|
179
|
+
booleanEquality: true,
|
|
180
|
+
dollarNowAsTimestamp: false,
|
|
181
181
|
};
|
|
182
182
|
const processed = translateOptions(options, defaultOptions, hardOptions, undefined, [ 'sql-dialect-and-naming' ], 'to.sql');
|
|
183
183
|
|
|
@@ -189,8 +189,9 @@ module.exports = {
|
|
|
189
189
|
const defaultOptions = {
|
|
190
190
|
sqlMapping: 'plain',
|
|
191
191
|
sqlDialect: 'hana',
|
|
192
|
-
withHanaAssociations:
|
|
193
|
-
booleanEquality:
|
|
192
|
+
withHanaAssociations: false,
|
|
193
|
+
booleanEquality: true,
|
|
194
|
+
dollarNowAsTimestamp: false,
|
|
194
195
|
};
|
|
195
196
|
return translateOptions(options, defaultOptions, hardOptions, { sqlDialect: generateStringValidator([ 'hana' ]) }, undefined, 'to.hdi');
|
|
196
197
|
},
|
|
@@ -201,6 +202,7 @@ module.exports = {
|
|
|
201
202
|
sqlMapping: 'plain',
|
|
202
203
|
sqlDialect: 'hana',
|
|
203
204
|
booleanEquality: false,
|
|
205
|
+
dollarNowAsTimestamp: true, // Keep v5 behavior; backend is deprecated
|
|
204
206
|
};
|
|
205
207
|
return translateOptions(options, defaultOptions, hardOptions, { sqlDialect: generateStringValidator([ 'hana' ]) }, undefined, 'to.hdbcds');
|
|
206
208
|
},
|
package/lib/base/builtins.js
CHANGED
|
@@ -41,6 +41,7 @@ function isInReservedNamespace( absolute ) {
|
|
|
41
41
|
return absolute === 'cds' || absolute.startsWith( 'cds.' ) &&
|
|
42
42
|
!absolute.match( /^cds\.foundation(\.|$)/ ) &&
|
|
43
43
|
!absolute.match( /^cds\.outbox(\.|$)/ ) && // Requested by Node runtime
|
|
44
|
+
!absolute.match( /^cds\.core(\.|$)/ ) && // Requested by Node runtime
|
|
44
45
|
!absolute.match( /^cds\.xt(\.|$)/ ); // Requested by Mtx
|
|
45
46
|
}
|
|
46
47
|
|