@sap/cds-compiler
Advanced tools
Comparing version 3.4.0 to 3.4.2
@@ -10,2 +10,13 @@ # ChangeLog for cds compiler and backends | ||
## Version 3.4.2 - 2022-11-11 | ||
### Fixed | ||
- Don't propagate `@cds.external` (The CDS Importer adds `@cds.external` for all | ||
imported definitions beginning with cds-dk@6.3.0, see CAP release log). | ||
- for.odata: Ignore all `@cds.external` definitions. | ||
- to.sql: For sql dialect `h2`, don't turn a Decimal with length 0 into a Decfloat. | ||
- Extending a projection with an aspect could result in incorrect auto-redirection. | ||
- Annotations of aspects were not properly propagated to projections under some order-specific circumstances. | ||
## Version 3.4.0 - 2022-10-26 | ||
@@ -15,3 +26,4 @@ | ||
- to.sql: Add support for sql dialect `h2`, which renders SQL for H2 2.x | ||
- to.sql: Add support for sql dialect `h2`, which renders SQL for H2 2.x. | ||
- Projections can now be extended by annotation-only aspects, e.g. `extend P with MyAspect;`. | ||
@@ -18,0 +30,0 @@ ### Fixed |
@@ -101,3 +101,3 @@ // Central registry for messages. | ||
'extend-repeated-intralayer': { severity: 'Warning' }, | ||
'extend-unrelated-layer': { severity: 'Warning' }, | ||
'extend-unrelated-layer': { severity: 'Info' }, | ||
@@ -104,0 +104,0 @@ 'ext-duplicate-extend-type': { severity: 'Error' }, |
@@ -623,11 +623,13 @@ // Extend, include, localized data and managed compositions | ||
if (!art._ancestors) | ||
setLink( art, '_ancestors', [] ); // recursive array of includes | ||
for (const ref of ext.includes) { | ||
const template = ref._artifact; | ||
// !template -> non-includable, e.g. scalar type, or cyclic | ||
if (template) { | ||
if (template._ancestors) | ||
art._ancestors.push( ...template._ancestors ); | ||
art._ancestors.push( template ); | ||
if (!art.query) { | ||
if (!art._ancestors) | ||
setLink( art, '_ancestors', [] ); // recursive array of includes | ||
for (const ref of ext.includes) { | ||
const template = ref._artifact; | ||
// !template -> non-includable, e.g. scalar type, or cyclic | ||
if (template) { | ||
if (template._ancestors) | ||
art._ancestors.push( ...template._ancestors ); | ||
art._ancestors.push( template ); | ||
} | ||
} | ||
@@ -1279,3 +1281,3 @@ } | ||
function copy(anno) { | ||
function copy( anno ) { | ||
if ( source[anno] && !target[anno] ) | ||
@@ -1282,0 +1284,0 @@ target[anno] = { ...source[anno], $inferred: 'parent-origin' }; |
@@ -36,2 +36,3 @@ // Propagate properties in XSN | ||
'@cds.autoexposed': never, // in case people set it themselves | ||
'@cds.external': never, | ||
'@cds.redirection.target': never, | ||
@@ -88,38 +89,30 @@ '@fiori.draft.enabled': onlyViaArtifact, | ||
// console.log('RUN:', art.name, art.elements ? Object.keys(art.elements) : 0) | ||
const chain = []; | ||
let target = art; | ||
let source = getOrigin( target ); | ||
while (source && checkAndSetStatus( source )) { | ||
chain.push({ target, source }); | ||
target = source; | ||
source = getOrigin( target ); | ||
} | ||
if (source) { // the source has fully propagated properties | ||
chain.push({ target, source }); | ||
} | ||
else if (target._main) { // source is element, which has not inherited props yet | ||
run( target._main ); // run on main artifact first | ||
} | ||
let targets = [ art ]; | ||
while (targets.length) { | ||
const news = []; | ||
for (const target of targets) { | ||
const origin = getOrigin( target ); | ||
if (origin) { | ||
chain.push( { target, source: origin } ); | ||
if (checkAndSetStatus( origin )) | ||
news.push( origin ); | ||
} | ||
// Even with a query source, go through `includes`. `source` is propagated first, i.e. wins. | ||
if (target.includes) { | ||
let targets = [ target ]; | ||
while (targets.length) { | ||
const news = []; | ||
for (const t of targets) { | ||
for (const ref of t.includes || []) { | ||
const s = ref._artifact; | ||
if (!s) // ref error | ||
continue; | ||
chain.push( { target: t, source: s } ); | ||
if (checkAndSetStatus( s )) | ||
news.push( s ); | ||
} | ||
for (const ref of target.includes || []) { | ||
const include = ref._artifact; | ||
if (!include) | ||
continue; | ||
chain.push( { target, source: include } ); | ||
if (checkAndSetStatus( include )) | ||
news.push( include ); | ||
} | ||
targets = news; | ||
} | ||
targets = news; | ||
} | ||
chain.reverse().forEach( step ); | ||
runMembers( art ); | ||
// console.log('DONE:', art.name, art.elements ? Object.keys(art.elements) : 0) | ||
// console.log('DONE:', art.name, art.elements ? Object.keys(art.elements) : 0); | ||
} | ||
@@ -126,0 +119,0 @@ |
@@ -112,3 +112,5 @@ 'use strict'; | ||
// @ts-ignore | ||
const isExternalServiceMember = (_art, name) => externalServices.includes(getServiceName(name)); | ||
const isExternalServiceMember = (art, name) => { | ||
return !!(externalServices.includes(getServiceName(name)) || (art && art['@cds.external'])) | ||
} | ||
@@ -167,6 +169,8 @@ if (options.csnFlavor === 'universal' && isBetaEnabled(options, 'enableUniversalCsn')) | ||
flattening.resolveTypeReferences(csn, options, resolved, '_', | ||
{ skip: [ 'action', 'aspect', 'event', 'function', 'type'], skipArtifact: isExternalServiceMember, skipStandard: { items: true } }); | ||
{ skip: [ 'action', 'aspect', 'event', 'function', 'type'], | ||
skipArtifact: isExternalServiceMember, skipStandard: { items: true } }); | ||
// No structured elements exists anymore | ||
flattening.flattenElements(csn, options, '_', error, | ||
{ skip: ['action', 'aspect', 'event', 'function', 'type'], skipArtifact: isExternalServiceMember, | ||
{ skip: ['action', 'aspect', 'event', 'function', 'type'], | ||
skipArtifact: isExternalServiceMember, | ||
skipStandard: { items: true }, // don't drill further into .items | ||
@@ -173,0 +177,0 @@ skipDict: { actions: true } }); // don't drill further into .actions -> bound actions, action-artifacts are handled by skip |
@@ -708,3 +708,3 @@ 'use strict'; | ||
if(options.sqlDialect === 'h2' && val === 'cds.Decimal' && !node.scale) { | ||
if(options.sqlDialect === 'h2' && val === 'cds.Decimal' && node.scale === undefined) { | ||
node[key] = 'cds.DecimalFloat'; // cds.Decimal and cds.Decimal(p) should map do DECFLOAT for h2 | ||
@@ -711,0 +711,0 @@ } |
@@ -31,2 +31,3 @@ 'use strict'; | ||
'@cds.autoexpose': onlyViaArtifact, | ||
'@cds.external': skip, | ||
'@fiori.draft.enabled': onlyViaArtifact, | ||
@@ -33,0 +34,0 @@ '@': nullStopsPropagation, |
{ | ||
"name": "@sap/cds-compiler", | ||
"version": "3.4.0", | ||
"version": "3.4.2", | ||
"description": "CDS (Core Data Services) compiler and backends", | ||
@@ -5,0 +5,0 @@ "homepage": "https://cap.cloud.sap/", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4166512
83135