@sap/cds-compiler 4.5.0 → 4.6.0
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 +43 -7
- package/bin/cdsc.js +13 -11
- package/doc/CHANGELOG_BETA.md +6 -0
- package/lib/api/main.js +256 -115
- package/lib/api/options.js +8 -0
- package/lib/base/message-registry.js +17 -4
- package/lib/base/messages.js +15 -3
- package/lib/base/model.js +1 -0
- package/lib/base/optionProcessorHelper.js +45 -176
- package/lib/checks/elements.js +32 -34
- package/lib/checks/enricher.js +39 -3
- package/lib/checks/validator.js +2 -3
- package/lib/compiler/assert-consistency.js +2 -1
- package/lib/compiler/builtins.js +20 -4
- package/lib/compiler/checks.js +30 -6
- package/lib/compiler/define.js +31 -9
- package/lib/compiler/resolve.js +26 -21
- package/lib/compiler/shared.js +19 -9
- package/lib/compiler/tweak-assocs.js +82 -107
- package/lib/compiler/utils.js +2 -1
- package/lib/edm/annotations/edmJson.js +23 -22
- package/lib/edm/annotations/genericTranslation.js +14 -4
- package/lib/edm/csn2edm.js +24 -10
- package/lib/edm/edmInboundChecks.js +1 -2
- package/lib/edm/edmPreprocessor.js +11 -9
- package/lib/edm/edmUtils.js +5 -2
- package/lib/gen/Dictionary.json +2 -0
- package/lib/gen/language.checksum +1 -1
- package/lib/gen/language.interp +4 -1
- package/lib/gen/language.tokens +1 -0
- package/lib/gen/languageParser.js +5253 -5214
- package/lib/json/to-csn.js +7 -1
- package/lib/language/antlrParser.js +19 -1
- package/lib/language/errorStrategy.js +21 -4
- package/lib/language/genericAntlrParser.js +9 -11
- package/lib/main.d.ts +28 -3
- package/lib/main.js +3 -0
- package/lib/model/csnRefs.js +4 -1
- package/lib/model/csnUtils.js +12 -7
- package/lib/optionProcessor.js +21 -19
- package/lib/render/manageConstraints.js +13 -29
- package/lib/render/toCdl.js +18 -15
- package/lib/render/toHdbcds.js +59 -28
- package/lib/render/toRename.js +6 -10
- package/lib/render/toSql.js +57 -82
- package/lib/render/utils/common.js +17 -0
- package/lib/transform/.eslintrc.json +9 -1
- package/lib/transform/addTenantFields.js +228 -0
- package/lib/transform/db/applyTransformations.js +27 -31
- package/lib/transform/db/assertUnique.js +4 -4
- package/lib/transform/db/cdsPersistence.js +1 -1
- package/lib/transform/db/flattening.js +68 -69
- package/lib/transform/db/temporal.js +1 -1
- package/lib/transform/draft/db.js +2 -16
- package/lib/transform/draft/odata.js +3 -3
- package/lib/transform/effective/associations.js +3 -5
- package/lib/transform/effective/main.js +6 -9
- package/lib/transform/forOdata.js +13 -9
- package/lib/transform/forRelationalDB.js +36 -17
- package/lib/transform/odata/toFinalBaseType.js +3 -3
- package/lib/transform/odata/typesExposure.js +14 -5
- package/lib/transform/transformUtils.js +47 -34
- package/lib/transform/translateAssocsToJoins.js +33 -8
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@ const { setProp, isDeprecatedEnabled, isBetaEnabled } = require('../base/model')
|
|
|
5
5
|
const {
|
|
6
6
|
forEachDefinition, forEachGeneric, forEachMemberRecursively,
|
|
7
7
|
isEdmPropertyRendered, getUtils, cloneCsnNonDict,
|
|
8
|
-
isBuiltinType, applyTransformations, cloneAnnotationValue, cardinality2str,
|
|
8
|
+
isBuiltinType, applyTransformations, cloneAnnotationValue, cardinality2str, isAnnotationExpression,
|
|
9
9
|
} = require('../model/csnUtils');
|
|
10
10
|
const edmUtils = require('./edmUtils.js');
|
|
11
11
|
const edmAnnoPreproc = require('./edmAnnoPreprocessor.js');
|
|
@@ -97,7 +97,7 @@ function initializeModel( csn, _options, messageFunctions, requestedServiceNames
|
|
|
97
97
|
*/
|
|
98
98
|
if (csn.meta && csn.meta.options && csn.meta.options.odataVersion === 'v4' && options.isV2()) {
|
|
99
99
|
// eslint-disable-next-line global-require
|
|
100
|
-
const { toFinalBaseType } = require('../transform/transformUtils').getTransformers(csn, options);
|
|
100
|
+
const { toFinalBaseType } = require('../transform/transformUtils').getTransformers(csn, options, messageFunctions);
|
|
101
101
|
expandCSNToFinalBaseType(csn, { toFinalBaseType }, csnUtils, serviceRootNames, options);
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -721,11 +721,11 @@ function initializeModel( csn, _options, messageFunctions, requestedServiceNames
|
|
|
721
721
|
// FK creation.
|
|
722
722
|
// The FK creation already propagates the annotations from the association
|
|
723
723
|
const elements = construct.items && construct.items.elements || construct.elements;
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
724
|
+
const assoc = elements[element['@odata.foreignKey4']];
|
|
725
|
+
if (assoc) {
|
|
726
|
+
Object.keys(assoc).filter(pn => pn[0] === '@' && !isAnnotationExpression(assoc[pn])).forEach((pn) => {
|
|
727
|
+
edmUtils.assignAnnotation(element, pn, assoc[pn]);
|
|
728
|
+
});
|
|
729
729
|
}
|
|
730
730
|
// and eventually remove some afterwards
|
|
731
731
|
if (options.isV2())
|
|
@@ -1074,8 +1074,10 @@ function initializeModel( csn, _options, messageFunctions, requestedServiceNames
|
|
|
1074
1074
|
|
|
1075
1075
|
function muteNavProp( elt, msg = 'std' ) {
|
|
1076
1076
|
edmUtils.assignAnnotation(elt, '@odata.navigable', false);
|
|
1077
|
-
|
|
1078
|
-
|
|
1077
|
+
if (elt._target['@cds.autoexpose'] !== false) {
|
|
1078
|
+
warning('odata-navigation', [ 'definitions', struct.name, 'elements', elt.name ],
|
|
1079
|
+
{ target: elt._target.name, service: globalSchemaPrefix, '#': msg });
|
|
1080
|
+
}
|
|
1079
1081
|
}
|
|
1080
1082
|
|
|
1081
1083
|
function createSchemaRefFor( targetSchemaName ) {
|
package/lib/edm/edmUtils.js
CHANGED
|
@@ -551,8 +551,11 @@ function mapCdsToEdmType( csn, messageFunctions, isV2 = false, isMediaType = fal
|
|
|
551
551
|
Edm.GeometryCollection
|
|
552
552
|
*/
|
|
553
553
|
}[cdsType];
|
|
554
|
-
if (!edmType)
|
|
555
|
-
error(
|
|
554
|
+
if (!edmType) {
|
|
555
|
+
error('ref-unsupported-type', location, { type: cdsType, '#': 'odata' });
|
|
556
|
+
edmType = 'Edm.PrimitiveType';
|
|
557
|
+
}
|
|
558
|
+
|
|
556
559
|
|
|
557
560
|
if (isV2) {
|
|
558
561
|
if (edmType === 'Edm.Date')
|
package/lib/gen/Dictionary.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
99b88c455f59a02a22d3d2ee662b8136
|