Socket
Socket
Sign inDemoInstall

@sap/cds-compiler

Package Overview
Dependencies
3
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.50.6 to 1.50.8

7

CHANGELOG.md
# ChangeLog for cdx compiler and backends
<!-- markdownlint-disable MD024 -->
<!-- markdownlint-disable MD004 -->
<!-- (no-duplicate-heading)-->

@@ -9,2 +10,8 @@

## Version 1.50.8 - 2021-07-01
### Fixed
- to.hdi.migration: Don't generate `ALTER` for type change from association to composition or vice versa (if the rest stays the same), as the resulting SQL is identical.
## Version 1.50.6 - 2021-05-05

@@ -11,0 +18,0 @@

49

lib/modelCompare/compare.js

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

}
if (otherElement.type !== element.type || JSON.stringify(otherElement) !== JSON.stringify(element)) {
if (relevantTypeChange(element.type, otherElement.type) || typeParametersChanged(element, otherElement)) {
// Type or parameters, e.g. association target, changed.

@@ -142,2 +142,46 @@ changedElements[name] = changedElement(element, otherElement);

function relevantTypeChange(type, otherType) {
return otherType !== type && ![type, otherType].every(t => ['cds.Association', 'cds.Composition'].includes(t));
}
/**
* Returns whether two things are deeply equal.
* Function-type things are compared in terms of identity,
* object-type things in terms of deep equality of all of their properties,
* all other things in terms of strict equality (===).
*
* @param a {any} first thing
* @param b {any} second thing
* @param include {function} function of a key and a depth, returning true if and only if the given key at the given depth is to be included in comparison
* @param depth {number} the current depth in property hierarchy below each of the original arguments (positive, counting from 0; don't set)
* @returns {boolean}
*/
function deepEqual(a, b, include = () => true, depth = 0) {
function isObject(x) {
return x !== null && typeof x === 'object';
}
function samePropertyCount() {
return Object.keys(a).length === Object.keys(b).length;
}
function allPropertiesEqual() {
return Object.keys(a).reduce((prev, key) => prev && (!include(key, depth) || deepEqual(a[key], b[key], include, depth + 1)), true);
}
return isObject(a)
? isObject(b)
? samePropertyCount() && allPropertiesEqual()
: false
: a === b;
}
/**
* Returns whether any type parameters differ between two given elements. Ignores whether types themselves differ (`type` property).
* @param element {object} an element
* @param otherElement {object} another element
* @returns {boolean}
*/
function typeParametersChanged(element, otherElement) {
return !deepEqual(element, otherElement, (key, depth) => !(depth === 0 && key === 'type'));
}
function changedElement(element, otherElement) {

@@ -151,3 +195,4 @@ return {

module.exports = {
compareModels
compareModels,
deepEqual
};

2

package.json
{
"name": "@sap/cds-compiler",
"version": "1.50.6",
"version": "1.50.8",
"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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc