Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap/cds-compiler

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/cds-compiler - npm Package Compare versions

Comparing version 3.9.4 to 3.9.6

9

CHANGELOG.md

@@ -10,2 +10,11 @@ # ChangeLog for cds compiler and backends

## Version 3.9.6 - 2023-07-27
### Fixed
- to.edm(x): Revert change introduced with [3.9.0](#version-390---2023-04-20)
"Correct referential constraint calculation for `[0..1]` backlink associations".
- for.odata: Process shortcut annotations sequence independent.
## Version 3.9.4 - 2023-06-07

@@ -12,0 +21,0 @@

5

lib/edm/edm.js

@@ -1220,9 +1220,12 @@ 'use strict'

{
// flip the constrains if this is a $self partner
let _constraints = this._csn._constraints;
let [i,j] = [0,1];
if(this._csn._constraints._partnerCsn) {
_constraints = this._csn._constraints._partnerCsn._constraints;
[i,j] = [1,0];
}
_constraints.constraints && Object.values(_constraints.constraints).forEach(c =>
this.append(new ReferentialConstraint(this._v,
{ Property: c[0].join(options.pathDelimiter), ReferencedProperty: c[1].join(options.pathDelimiter) } ) )
{ Property: c[i].join(options.pathDelimiter), ReferencedProperty: c[j].join(options.pathDelimiter) } ) )
);

@@ -1229,0 +1232,0 @@ }

@@ -416,2 +416,8 @@ // Generic ANTLR parser class with AST-building functions

}
if (dup.$annotations) { // update deprecated $annotations for cds-lsp / annotation modeler
if (def.$annotations)
def.$annotations.push( ...dup.$annotations );
else
def.$annotations = dup.$annotations;
}
}

@@ -418,0 +424,0 @@ def.$duplicates = null;

53

lib/transform/forOdataNew.js

@@ -349,40 +349,37 @@ 'use strict';

}
});
// Special case: '@readonly' becomes a triplet of capability restrictions for entities,
// but '@Core.Immutable' for everything else.
if (!(node['@readonly'] && node['@insertonly'])) {
if (name === '@readonly' && node[name]) {
if (node.kind === 'entity' || node.kind === 'aspect') {
setAnnotation(node, '@Capabilities.DeleteRestrictions.Deletable', false);
setAnnotation(node, '@Capabilities.InsertRestrictions.Insertable', false);
setAnnotation(node, '@Capabilities.UpdateRestrictions.Updatable', false);
} else {
setAnnotation(node, '@Core.Computed', true);
}
if (!(node['@readonly'] && node['@insertonly'])) {
if (node['@readonly']) {
if (node.kind === 'entity' || node.kind === 'aspect') {
setAnnotation(node, '@Capabilities.DeleteRestrictions.Deletable', false);
setAnnotation(node, '@Capabilities.InsertRestrictions.Insertable', false);
setAnnotation(node, '@Capabilities.UpdateRestrictions.Updatable', false);
} else {
setAnnotation(node, '@Core.Computed', true);
}
}
// @insertonly is effective on entities/queries only
else if (name === '@insertonly' && node[name]) {
if (node.kind === 'entity' || node.kind === 'aspect') {
setAnnotation(node, '@Capabilities.DeleteRestrictions.Deletable', false);
setAnnotation(node, '@Capabilities.ReadRestrictions.Readable', false);
setAnnotation(node, '@Capabilities.UpdateRestrictions.Updatable', false);
}
}
if (node['@insertonly'] && (node.kind === 'entity' || node.kind === 'aspect')) {
setAnnotation(node, '@Capabilities.DeleteRestrictions.Deletable', false);
setAnnotation(node, '@Capabilities.ReadRestrictions.Readable', false);
setAnnotation(node, '@Capabilities.UpdateRestrictions.Updatable', false);
}
}
// Only on element level: translate @mandatory
if (name === '@mandatory' && node[name] &&
if (node['@mandatory'] &&
node.kind === undefined && node['@Common.FieldControl'] === undefined) {
setAnnotation(node, '@Common.FieldControl', { '#': 'Mandatory' });
}
setAnnotation(node, '@Common.FieldControl', { '#': 'Mandatory' });
}
if (name === '@assert.format' && node[name] !== null)
setAnnotation(node, '@Validation.Pattern', node['@assert.format']);
if (node['@assert.format'] != null)
setAnnotation(node, '@Validation.Pattern', node['@assert.format']);
if (name === '@assert.range' && node[name] !== null) {
if (Array.isArray(node['@assert.range']) && node['@assert.range'].length === 2) {
setAnnotation(node, '@Validation.Minimum', node['@assert.range'][0]);
setAnnotation(node, '@Validation.Maximum', node['@assert.range'][1]);
}
if (node['@assert.range'] != null) {
if (Array.isArray(node['@assert.range']) && node['@assert.range'].length === 2) {
setAnnotation(node, '@Validation.Minimum', node['@assert.range'][0]);
setAnnotation(node, '@Validation.Maximum', node['@assert.range'][1]);
}
});
}
}

@@ -389,0 +386,0 @@

{
"name": "@sap/cds-compiler",
"version": "3.9.4",
"version": "3.9.6",
"description": "CDS (Core Data Services) compiler and backends",

@@ -5,0 +5,0 @@ "homepage": "https://cap.cloud.sap/",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc