Socket
Socket
Sign inDemoInstall

@sap/cds-compiler

Package Overview
Dependencies
Maintainers
1
Versions
106
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 2.2.4 to 2.2.6

19

CHANGELOG.md

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

## Version 2.2.6 - 2021-05-12
### Fixed
- to.edmx(x):
+ The reverted change "`array of` elements are now allowed for OData V2, too." introduced with v2.2.0 has caused
regressions in various scenarios that used OData V4 processed CSN for OData V2 EDMX rendering. Therefore
the error has been lowered to a 'odata-spec-violation-array-of' warning.
+ The fix 'Render constraints only if all principal keys are used in association' introduced with v2.2.2 has
caused regressions in mocking scenarios. With option `--odata-v2-partial-constr` partial constraint generation
can be reactivated. A 'odata-spec-violation-constraints' warning is raised.
## Version 2.2.4 - 2021-05-06

@@ -67,2 +79,9 @@

### 2.2.6 Addendum to Changed
- to.edm(x): Revert 2.1.0 change: "`array of` elements are now allowed for OData V2, too."
OData V2 does not allow elements to be typed with `Collection()`. Any `many`
predicate in element definitions is rejected. The only two positions where the `many` predicate
is allowed are `association to many` and `returns many`.
## Version 2.1.6 - 2021-04-14

@@ -69,0 +88,0 @@

1

lib/api/options.js

@@ -30,2 +30,3 @@ 'use strict';

'odataXServiceRefs',
'odataV2PartialConstr',
'service',

@@ -32,0 +33,0 @@ 'serviceNames',

@@ -22,2 +22,4 @@ 'use strict';

options.odataForeignKeys = options.toOdata.odataForeignKeys;
if(options.toOdata.odataV2PartialConstr)
options.odataV2PartialConstr = options.toOdata.odataV2PartialConstr;
// global flag that indicates wether or not FKs shall be rendered in general

@@ -283,3 +285,3 @@ // V2/V4 flat: yes

function finalizeReferentialConstraints(assocCsn, options)
function finalizeReferentialConstraints(assocCsn, options, warning)
{

@@ -351,3 +353,9 @@ if(!assocCsn._constraints)

if(options.isV2() && intersect(renderedKeys, remainingPrincipalRefs).length !== renderedKeys.length)
assocCsn._constraints.constraints = {};
if(options.odataV2PartialConstr) {
warning('odata-spec-violation-constraints', ['definitions', assocCsn._parent.name, 'elements', assocCsn.name],
'Partial referential constraints (not spec compliant) produced based on user setting');
}
else {
assocCsn._constraints.constraints = {};
}
}

@@ -383,4 +391,11 @@ }

const renderedKeys = Object.values(assocCsn._target.$keys).filter(isConstraintCandidate).map(v=>v.name);
if(options.isV2() && intersect(renderedKeys, remainingPrincipalRefs).length !== renderedKeys.length)
assocCsn._constraints.constraints = {};
if(options.isV2() && intersect(renderedKeys, remainingPrincipalRefs).length !== renderedKeys.length) {
if(options.odataV2PartialConstr) {
warning('odata-spec-violation-constraints', ['definitions', assocCsn._parent.name, 'elements', assocCsn.name],
'Partial referential constraints (not spec compliant) produced based on user setting');
}
else {
assocCsn._constraints.constraints = {};
}
}
}

@@ -387,0 +402,0 @@ }

11

lib/optionProcessor.js

@@ -174,2 +174,3 @@ 'use strict';

.option(' --odata-foreign-keys')
.option(' --odata-v2-partial-constr')
.option('-c, --csn')

@@ -197,6 +198,8 @@ .option('-f, --odata-format <format>', ['flat', 'structured'])

structured : (V4 only) Render structured metadata
--odata-containment Generate Containment Navigation Properties for compositions (V4 only)
--odata-proxies Generate Proxies for out-of-service navigation targets (V4 only).
--odata-x-service-refs Generate schema references (V4 only).
--odata-foreign-keys Render foreign keys in structured format (V4 only)
--odata-containment Generate Containment Navigation Properties for compositions (V4 only)
--odata-proxies Generate Proxies for out-of-service navigation targets (V4 only).
--odata-x-service-refs Generate schema references (V4 only).
--odata-foreign-keys Render foreign keys in structured format (V4 only)
--odata-v2-partial-constr Render referential constraints also for partial principal key tuple
(Not spec compliant and V2 only)
-n, --names <style> Annotate artifacts and elements with "@cds.persistence.name", which is

@@ -203,0 +206,0 @@ the corresponding database name (see "--names" for "toHana or "toSql")

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

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

Sorry, the diff of this file is too big to display

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