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 3.5.2 to 3.5.4

8

CHANGELOG.md

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

## Version 3.5.4 - 2023-01-10
### Fixed
- Allow window functions also with a deprecated flag being set.
- to.edm(x): Fix program abort due to malformed error location in EDM annotation preprocessing.
- to.sql/hdi/hdbcds: The option `pre2134ReferentialConstraintNames` can be used to omit the referential constraint identifier prefix "c__".
## Version 3.5.2 - 2022-12-20

@@ -12,0 +20,0 @@

1

lib/api/options.js

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

'variableReplacements',
'pre2134ReferentialConstraintNames',
// ODATA

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

55

lib/base/model.js

@@ -40,2 +40,26 @@ 'use strict';

const availableDeprecatedFlags = {
// the old ones starting with _, : false
autoCorrectOrderBySourceRefs: true,
eagerPersistenceForGeneratedEntities: true,
}
const oldDeprecatedFlags_v2 = [
'createLocalizedViews',
'downgradableErrors',
'generatedEntityNameWithUnderscore',
'longAutoexposed',
'noElementsExpansion',
'noInheritedAutoexposeViaComposition',
'noScopedRedirections',
'oldVirtualNotNullPropagation',
'parensAsStrings',
'projectionAsQuery',
'redirectInSubQueries',
'renderVirtualElements',
'shortAutoexposed',
'unmanagedUpInComponent',
'v1KeysForTemporal',
];
/**

@@ -63,4 +87,8 @@ * Test for early-adaptor feature, stored in option `beta`(new-style) / `betaMode`(old-style)

* With that, the value of `deprecated` is a dictionary of feature=>Boolean.
* If no `feature` is provided, checks if any deprecated option is set.
*
* If no `feature` is provided, checks if any deprecated option is set
* which is not mentioned in availableDeprecatedFlags with value true.
* Useful for newer functionality which might not work with some
* deprecated feature turned on.
*
* Please do not move this function to the "option processor" code.

@@ -74,26 +102,9 @@ *

const { deprecated } = options;
if (!feature)
return !!deprecated;
if (!feature) {
return !!deprecated && Object.keys( deprecated )
.some( d => !availableDeprecatedFlags[d] );
}
return deprecated && typeof deprecated === 'object' && deprecated[feature];
}
const oldDeprecatedFlags_v2 = [
'createLocalizedViews',
'downgradableErrors',
'generatedEntityNameWithUnderscore',
'longAutoexposed',
'noElementsExpansion',
'noInheritedAutoexposeViaComposition',
'noScopedRedirections',
'oldVirtualNotNullPropagation',
'parensAsStrings',
'projectionAsQuery',
'redirectInSubQueries',
'renderVirtualElements',
'shortAutoexposed',
'unmanagedUpInComponent',
'v1KeysForTemporal',
];
/**

@@ -100,0 +111,0 @@ * In cds-compiler v3, we removed old v2 deprecated flags. That can lead to silent

@@ -42,3 +42,2 @@ // Compiler phase "resolve": resolve all references

const {
isDeprecatedEnabled,
forEachDefinition,

@@ -84,3 +83,3 @@ forEachMember,

function resolve( model ) {
const { options } = model;
// const { options } = model;
// Get shared functionality and the message function:

@@ -1333,7 +1332,2 @@ const {

}
if (expr.suffix && isDeprecatedEnabled( options )) {
const { location } = expr.suffix[0] || expr;
error( null, [ location, user ], { prop: 'deprecated' },
'Window functions are not supported if $(PROP) options are set' );
}
if (expr.suffix)

@@ -1340,0 +1334,0 @@ expr.suffix.forEach( s => s && resolveExpr( s, expected, user, extDict ) );

'use strict';
const { makeMessageFunction } = require('../../base/messages.js');
const { forEachDefinition } = require('../../model/csnUtils.js');
const { forEachDefinition, forEachGeneric } = require('../../model/csnUtils.js');

@@ -69,5 +69,5 @@

});
artifact.actions && Object.values(artifact.actions).forEach(action => {
forEachGeneric(artifact, 'actions', (action, actionName) => {
action.params && Object.entries(action.params).forEach(([paramName, param]) => {
handleAnnotations(paramName, param, [ ...location, 'actions', action, 'params', paramName ]);
handleAnnotations(paramName, param, [ ...location, 'actions', actionName, 'params', paramName ]);
});

@@ -74,0 +74,0 @@ });

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

.option(' --assert-integrity-type <type>', ['RT', 'DB'], { ignoreCase: true })
.option(' --pre2134ReferentialConstraintNames')
.option(' --disable-hana-comments')

@@ -205,2 +206,3 @@ .help(`

DB : Create database constraints for associations
--pre2134ReferentialConstraintNames Do not prefix the constraint identifier with "c__"
--disable-hana-comments Disable rendering of doc comments as SAP HANA comments.

@@ -285,2 +287,3 @@ `);

.option(' --constraints-in-create-table')
.option(' --pre2134ReferentialConstraintNames')
.option(' --disable-hana-comments')

@@ -335,2 +338,3 @@ .help(`

"ALTER TABLE ADD CONSTRAINT" statements
--pre2134ReferentialConstraintNames Do not prefix the constraint identifier with "c__"
--disable-hana-comments Disable rendering of doc comments as SAP HANA comments.

@@ -337,0 +341,0 @@ `);

@@ -68,4 +68,3 @@ // Render functions for toSql.js

// constraint enforcement / validation not supported by postgres
// Does not include HDBCDS.
if (options.toSql && sqlDialect !== 'sqlite' && sqlDialect !== 'postgres') {
if (options.transformation === 'hdbcds' || (options.toSql && sqlDialect !== 'sqlite' && sqlDialect !== 'postgres')) {
result += `${indent}${!constraint.validated ? 'NOT ' : ''}VALIDATED\n`;

@@ -72,0 +71,0 @@ result += `${indent}${!constraint.enforced ? 'NOT ' : ''}ENFORCED\n`;

@@ -518,5 +518,7 @@ 'use strict';

onDeleteRemark = `Up_ link for Composition "${$foreignKeyConstraint.upLinkFor}" implies existential dependency`;
// constraint identifier usually start with `c__` to avoid name clashes
let identifier = options.pre2134ReferentialConstraintNames ? '' : 'c__';
identifier += `${getResultingName(csn, options.sqlMapping, artifactName)}_${$foreignKeyConstraint.sourceAssociation}`;
referentialConstraints[`${getResultingName(csn, 'quoted', artifactName)}_${$foreignKeyConstraint.sourceAssociation}`] = {
// constraint identifier start with `c__` to avoid name clashes
identifier: `c__${getResultingName(csn, options.sqlMapping, artifactName)}_${$foreignKeyConstraint.sourceAssociation}`,
identifier,
foreignKey: dependentKey,

@@ -523,0 +525,0 @@ parentKey,

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