@sap/cds-compiler 3.3.2 → 3.4.2
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 +33 -0
- package/bin/cdsc.js +3 -1
- package/doc/CHANGELOG_BETA.md +17 -0
- package/lib/api/main.js +147 -18
- package/lib/api/validate.js +8 -3
- package/lib/base/dictionaries.js +6 -6
- package/lib/base/keywords.js +104 -0
- package/lib/base/message-registry.js +137 -68
- package/lib/base/messages.js +59 -48
- package/lib/base/model.js +1 -0
- package/lib/checks/actionsFunctions.js +1 -1
- package/lib/checks/cdsPersistence.js +1 -1
- package/lib/checks/checkForTypes.js +13 -8
- package/lib/checks/defaultValues.js +3 -1
- package/lib/checks/elements.js +1 -1
- package/lib/checks/parameters.js +4 -2
- package/lib/checks/queryNoDbArtifacts.js +1 -1
- package/lib/checks/sql-snippets.js +12 -10
- package/lib/checks/validator.js +14 -4
- package/lib/compiler/assert-consistency.js +8 -7
- package/lib/compiler/checks.js +30 -20
- package/lib/compiler/define.js +89 -25
- package/lib/compiler/extend.js +33 -28
- package/lib/compiler/finalize-parse-cdl.js +14 -9
- package/lib/compiler/populate.js +30 -8
- package/lib/compiler/propagator.js +23 -28
- package/lib/compiler/resolve.js +11 -5
- package/lib/compiler/shared.js +66 -48
- package/lib/compiler/tweak-assocs.js +2 -3
- package/lib/compiler/utils.js +11 -0
- package/lib/edm/annotations/genericTranslation.js +7 -4
- package/lib/edm/csn2edm.js +1 -1
- package/lib/gen/language.checksum +1 -1
- package/lib/gen/language.interp +1 -1
- package/lib/gen/languageParser.js +3565 -3544
- package/lib/json/csnVersion.js +13 -13
- package/lib/json/from-csn.js +140 -158
- package/lib/json/to-csn.js +23 -5
- package/lib/language/.eslintrc.json +4 -0
- package/lib/language/antlrParser.js +7 -10
- package/lib/language/docCommentParser.js +1 -2
- package/lib/language/errorStrategy.js +54 -27
- package/lib/language/genericAntlrParser.js +115 -84
- package/lib/language/language.g4 +29 -25
- package/lib/language/multiLineStringParser.js +75 -63
- package/lib/main.js +1 -0
- package/lib/model/csnRefs.js +4 -3
- package/lib/model/csnUtils.js +39 -7
- package/lib/model/sortViews.js +7 -3
- package/lib/modelCompare/compare.js +49 -15
- package/lib/modelCompare/filter.js +83 -0
- package/lib/optionProcessor.js +5 -1
- package/lib/render/manageConstraints.js +9 -5
- package/lib/render/toCdl.js +120 -62
- package/lib/render/toHdbcds.js +1 -1
- package/lib/render/toSql.js +6 -2
- package/lib/render/utils/common.js +7 -0
- package/lib/sql-identifier.js +7 -0
- package/lib/transform/db/assertUnique.js +27 -38
- package/lib/transform/db/expansion.js +11 -4
- package/lib/transform/db/temporal.js +3 -1
- package/lib/transform/db/transformExists.js +7 -1
- package/lib/transform/db/views.js +42 -13
- package/lib/transform/draft/db.js +2 -2
- package/lib/transform/forOdataNew.js +7 -3
- package/lib/transform/forRelationalDB.js +12 -6
- package/lib/transform/localized.js +1 -1
- package/lib/transform/odata/typesExposure.js +2 -1
- package/lib/transform/parseExpr.js +245 -0
- package/lib/transform/transformUtilsNew.js +23 -14
- package/lib/transform/translateAssocsToJoins.js +12 -12
- package/lib/transform/universalCsn/universalCsnEnricher.js +1 -0
- package/lib/utils/term.js +5 -5
- package/package.json +2 -2
- package/share/messages/message-explanations.json +1 -1
- package/share/messages/{syntax-expected-integer.md → syntax-expecting-integer.md} +1 -1
|
@@ -6,7 +6,6 @@ const oDataDictionary = require('../../gen/Dictionary.json');
|
|
|
6
6
|
const { forEachDefinition } = require('../../model/csnUtils');
|
|
7
7
|
const { forEach } = require("../../utils/objectUtils");
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
/*
|
|
11
10
|
OASIS: https://github.com/oasis-tcs/odata-vocabularies/tree/master/vocabularies
|
|
12
11
|
Aggregation (published)
|
|
@@ -562,6 +561,9 @@ function csn2annotationEdm(csn, serviceName, Edm = undefined, options=undefined,
|
|
|
562
561
|
alternativeEdmTargetName = serviceName + '.EntityContainer/' + alternativeEdmTargetName.substr(lastDotIndex + 1);
|
|
563
562
|
hasAlternativeCarrier = carrier.$hasEntitySet;
|
|
564
563
|
}
|
|
564
|
+
else if(carrier.kind === 'type') {
|
|
565
|
+
testToStandardEdmTarget = (x => x ? x.includes(carrier.elements ? 'ComplexType' : 'TypeDefinition') : true);
|
|
566
|
+
}
|
|
565
567
|
else if (carrier.kind === 'service') {
|
|
566
568
|
// if annotated object is a service, annotation goes to EntityContainer,
|
|
567
569
|
// except if AppliesTo contains Schema but not EntityContainer, then annotation goes to Schema
|
|
@@ -653,14 +655,15 @@ function csn2annotationEdm(csn, serviceName, Edm = undefined, options=undefined,
|
|
|
653
655
|
Insert $value into $edmJson with inner annotation as well.
|
|
654
656
|
*/
|
|
655
657
|
if(innerAnnotation) {
|
|
656
|
-
|
|
658
|
+
// != null => also != undefined
|
|
659
|
+
if(carrier[prefix] != null) {
|
|
657
660
|
const valPrefix = prefix + '.$value';
|
|
658
661
|
carrier[valPrefix] = carrier[prefix];
|
|
659
662
|
delete carrier[prefix];
|
|
660
663
|
rc = true;
|
|
661
664
|
}
|
|
662
665
|
const edmJsonPrefix = prefix + '.$edmJson';
|
|
663
|
-
if(carrier[edmJsonPrefix]) {
|
|
666
|
+
if(carrier[edmJsonPrefix] != null) {
|
|
664
667
|
const valPrefix = prefix + '.$value.$edmJson';
|
|
665
668
|
carrier[valPrefix] = carrier[edmJsonPrefix];
|
|
666
669
|
delete carrier[edmJsonPrefix];
|
|
@@ -908,7 +911,7 @@ function csn2annotationEdm(csn, serviceName, Edm = undefined, options=undefined,
|
|
|
908
911
|
oTarget.append(handleEdmJson(cAnnoValue['$edmJson'], context));
|
|
909
912
|
}
|
|
910
913
|
else if ( Object.keys(cAnnoValue).filter( x => x[0] !== '@' ).length === 0) {
|
|
911
|
-
// object consists only of properties starting with "@"
|
|
914
|
+
// object consists only of properties starting with "@", no $value
|
|
912
915
|
message(warning, context, 'nested annotations without corresponding base annotation');
|
|
913
916
|
}
|
|
914
917
|
else {
|
package/lib/edm/csn2edm.js
CHANGED
|
@@ -731,7 +731,7 @@ function csn2edmAll(_csn, _options, serviceNames=undefined) {
|
|
|
731
731
|
|
|
732
732
|
});
|
|
733
733
|
if(options.isV2()) {
|
|
734
|
-
if(streamProps.length > 1) {
|
|
734
|
+
if(streamProps.length > 1) { // TODO: why not mention 2.0 in text?
|
|
735
735
|
error(null, ['definitions', elementsCsn.name], { names: streamProps, version: '2.0', anno: '@Core.MediaType' },
|
|
736
736
|
`Expected only one element to be annotated with $(ANNO) for OData $(VERSION) but found $(NAMES)`);
|
|
737
737
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
5a5c0432924af9c8833ad5aa6b94724f
|