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 4.2.2 to 4.2.4

6

CHANGELOG.md

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

## Version 4.2.4 - 2023-09-14
### Fixed
- OData: For compatibility with the Java runtime, don't prepend table aliases to column aliases unless necessary.
## Version 4.2.2 - 2023-08-31

@@ -12,0 +18,0 @@

1

lib/base/model.js

@@ -49,2 +49,3 @@ // module- and csn/XSN-independent definitions

noKeyPropagationWithExpansions: true,
ignoreSpecifiedQueryElements: true,
}

@@ -51,0 +52,0 @@

23

lib/transform/db/expansion.js

@@ -10,3 +10,3 @@ 'use strict';

} = require('../../model/csnUtils');
const { implicitAs, columnAlias } = require('../../model/csnRefs');
const { implicitAs, columnAlias, pathId } = require('../../model/csnRefs');
const { setProp } = require('../../base/model');

@@ -43,5 +43,6 @@ const { forEach } = require('../../utils/objectUtils');

// while the OData CSN is still official
const isComplexQuery = parent.from.join !== undefined;
if (!options.toOdata)
parent.columns = replaceStar(root, columns, parent.excluding, parent.from.join !== undefined);
parent.columns = expand(parent.columns, path.concat('columns'), true);
parent.columns = replaceStar(root, columns, parent.excluding, isComplexQuery);
parent.columns = expand(parent.columns, path.concat('columns'), true, isComplexQuery);
}

@@ -517,5 +518,6 @@ },

* @param {boolean} [withAlias=false] Whether to "expand" the (implicit) alias as well.
* @param {boolean} [isComplexQuery]
* @returns {Array} New array - with all structured things expanded
*/
function expand( thing, path, withAlias = false ) {
function expand( thing, path, withAlias = false, isComplexQuery = false ) {
const newThing = [];

@@ -527,3 +529,3 @@ for (let i = 0; i < thing.length; i++) {

if (_art && csnUtils.isStructured(_art))
newThing.push(...expandRef(_art, col, withAlias));
newThing.push(...expandRef(_art, col, withAlias, isComplexQuery));
else

@@ -603,5 +605,6 @@ newThing.push(col);

* @param {boolean} withAlias Whether to add an explicit flattened alias to the expanded columns/references.
* @param {boolean} [isComplexQuery]
* @returns {Array}
*/
function expandRef( art, root, withAlias ) {
function expandRef( art, root, withAlias, isComplexQuery ) {
return _expandStructCol(art, columnAlias(root), root.ref, ( currentRef, currentAlias) => {

@@ -621,3 +624,9 @@ const obj = { ...root, ref: currentRef };

if (typeof root.$env === 'string')
// The Java runtime, as of 2023-09-13, assumes that for _simple projections_, all references
// are relative to the query source. To avoid breaking that assumption unless necessary,
// we only add the table alias if:
// - it is a complex query with possibly multiple available table aliases, or
// - the transformation is not for OData (which is used by Java), or
// - the first path step has the same name as the table alias (only one, as otherwise the query would be complex)
if (typeof root.$env === 'string' && (isComplexQuery || options.transformation !== 'odata' || root.$env === pathId(obj.ref[0])))
obj.ref = [ root.$env, ...obj.ref ];

@@ -624,0 +633,0 @@

{
"name": "@sap/cds-compiler",
"version": "4.2.2",
"version": "4.2.4",
"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