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
113
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 5.5.0 to 5.5.2

lib/checks/cdsMap.js

4

lib/checks/validator.js

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

// both
const checkCdsMap = require('./cdsMap');
const { validateOnCondition, validateMixinOnCondition } = require('./onConditions');

@@ -84,2 +85,3 @@ const validateForeignKeys = require('./foreignKeys');

const forRelationalDBCsnValidators = [
checkCdsMap,
existsMustEndInAssoc,

@@ -123,3 +125,3 @@ forbidAssocInExists,

const forOdataCsnValidators = [ nonexpandableStructuredInExpression ];
const forOdataCsnValidators = [ checkCdsMap, nonexpandableStructuredInExpression ];

@@ -126,0 +128,0 @@ const forOdataQueryValidators = [];

@@ -920,2 +920,3 @@ // Compiler phase 1 = "define": transform dictionary of AST-like XSNs into XSN

// no semantic loc (wouldn't be available for expand/inline anyway)
// TODO: why here and not in parser?
error( 'syntax-duplicate-wildcard', [ col.location, null ], {

@@ -922,0 +923,0 @@ '#': (wildcard.location.col ? 'col' : 'std'),

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

const { ModelError } = require('../base/error');
const { setHidden } = require('../utils/objectUtils');
const { setHidden, hasNonEnumerable } = require('../utils/objectUtils');
const { isAnnotationExpression } = require('../base/builtins');

@@ -114,6 +114,2 @@

function hasNonEnumerable( object, property ) {
return Object.prototype.hasOwnProperty.call( object, property ) &&
!Object.prototype.propertyIsEnumerable.call( object, property );
}

@@ -120,0 +116,0 @@ /**

@@ -74,7 +74,10 @@ 'use strict';

expectingArray() {
const savedState = this.s;
this.s = this.errorState;
let array = this.expectingArray_();
this.s = savedState;
// compatibility: replace true+false by Boolean - TODO: delete
if (array.includes( 'true' ))
array = [ 'Boolean', ...array.filter( n => n !== 'true' && n !== 'false' ) ];
return array.map( antlrName )
return array.map( tok => this.antlrName( tok ) )
.sort( (a, b) => (tokenPrecedence(a) < tokenPrecedence(b) ? -1 : 1) );

@@ -87,3 +90,3 @@ }

const err = this.error( 'syntax-unexpected-token', token,
{ offending: antlrName( token ), expecting } );
{ offending: this.antlrName( token ), expecting } );
// No 'unwanted' variant, no 'syntax-missing-token'

@@ -323,6 +326,2 @@ err.expectedTokens = expecting;

inExpandInline() { // not as <cond>
this.dynamic_.inSelectItem = 'nested';
}
/**

@@ -361,5 +360,8 @@ * `;` between statements is optional only after a `}` (ex braces of structure

return false;
if (this.tokens[this.tokenIdx + 1]?.type === ',')
arrayAnno[0] = false;
arrayAnno[0] = this.tokens[this.tokenIdx + 1]?.keyword;
}
else if (arg === 'bracket') {
// closing bracket not allowed if last `...` in array is with `up to
return typeof this.dynamic_.arrayAnno[0] !== 'string';
}
else { // orNotEmpty

@@ -795,2 +797,3 @@ return this.dynamic_.arrayAnno || this.lb().type !== '{';

// TODO: can we remove `;`/EOF from the expected-set for `annotate Foo with ⎀`?
checkWith( keyword ) {

@@ -800,8 +803,11 @@ if (this.lb() !== keyword)

const tok = this.la();
if (this.docCommentIndex < tok.location.tokenIndex &&
this.docCommentIndex > this.lb().location.tokenIndex)
const docTokenIndex = this.docCommentIndex &&
this.docComments[this.docCommentIndex - 1].location.tokenIndex;
if (docTokenIndex < tok.location.tokenIndex &&
docTokenIndex > this.lb().location.tokenIndex)
return;
const expecting = this.expectingArray(); // TODO: filter
// filter out what comes after current rule (no generic way necessary):
const expecting = this.expectingArray().filter( t => t !== '<EOF>' && t !== '\'}\'' );
const msg = this.warning( 'syntax-unexpected-semicolon', tok,
{ offending: antlrName( tok ), expecting, keyword: 'with' },
{ offending: this.antlrName( tok ), expecting, keyword: 'with' },
// eslint-disable-next-line @stylistic/js/max-len

@@ -850,10 +856,11 @@ 'Unexpected $(OFFENDING), expecting $(EXPECTING) - ignored previous $(KEYWORD)' );

reportExpandInline( column, isInline ) {
// called before matching `{`
const { name } = column;
if (column.value && !column.value.path) {
const token = this.la();
// improve error location when using "inline" `.{…}` after ref (arguments and
// filters not covered, not worth the effort); after an expression where
// the last token is an identifier, not the `.` is wrong, but the `{`:
// if (isInline && !name && this._input.LT(-1).type >= this.constructor.Identifier)
// token = this._input.LT(2); -- TODO: still valid?
const token = (isInline && this.tokens[this.tokenIdx - 2].type !== 'Id')
? this.lb()
: this.la();
this.error( 'syntax-unexpected-nested-proj', token,

@@ -1297,2 +1304,13 @@ { code: isInline ? '.{ ‹inline› }' : '{ ‹expand› }' },

}
// For compatibility with ANTLR-based parser:
antlrName( type ) {
if (typeof type !== 'string') {
type = (!type.parsedAs && this.keywords[type.keyword ?? ''] != null ||
type.parsedAs === 'keyword') && type.keyword || type.type;
}
if (/^[A-Z]+/.test( type ))// eslint-disable-next-line no-nested-ternary
return (type === 'Id') ? 'Identifier' : (type === 'EOF') ? '<EOF>' : type;
return (/^[a-z]+/.test( type )) ? type.toUpperCase() : `'${ type }'`;
}
}

@@ -1320,11 +1338,2 @@

// For compatibility with ANTLR-based parser:
function antlrName( type ) {
if (typeof type !== 'string')
type = (!type.parsedAs || type.parsedAs === 'keyword') && type.keyword || type.type;
if (/^[A-Z]+/.test( type ))// eslint-disable-next-line no-nested-ternary
return (type === 'Id') ? 'Identifier' : (type === 'EOF') ? '<EOF>' : type;
return (/^[a-z]+/.test( type )) ? type.toUpperCase() : `'${ type }'`;
}
// Used for sorting in messages (TODO: make it part of messages.js?)

@@ -1331,0 +1340,0 @@ const token1sort = {

@@ -86,2 +86,14 @@ 'use strict';

/**
* Check if the given object has the property as non-enumerable
*
* @param {Object} object
* @param {string} propertyName
* @returns {boolean}
*/
function hasNonEnumerable( object, propertyName ) {
return Object.prototype.hasOwnProperty.call( object, propertyName ) &&
!Object.prototype.propertyIsEnumerable.call( object, propertyName );
}
module.exports = {

@@ -94,2 +106,3 @@ copyPropIfExist,

setHidden,
hasNonEnumerable,
};
{
"name": "@sap/cds-compiler",
"version": "5.5.0",
"version": "5.5.2",
"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

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

Sorry, the diff of this file is not supported yet

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