diff --git a/CHANGELOG.md b/CHANGELOG.md index 7651049..5cbc6ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). The format is based on [Keep a Changelog](http://keepachangelog.com/). +## Version 0.8.3 - 2024-11-28 + +### Fixed + +- Rewrite subselects to use path expressions on @cap-js databases + ## Version 0.8.2 - 2024-11-27 ### Fixed diff --git a/lib/utils.js b/lib/utils.js index d3b0df5..819676d 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -123,13 +123,13 @@ const _buildSubSelect = (model, { entity, relative, element, next }, row, previo let w = relative._relations[element.name].join(targetAlias, relativeAlias) - // REVISIT: rewrite to path expression, if alias for relative is already used in subselect to avoid sql error - if (previousCqn?._aliases.has(relativeAlias)) { + // rewrite to path expression on new databases + if (cds.env.requires.db.impl?.startsWith('@cap-js')) { let t - for (const a in entity.associations) if (entity.associations[a].target === relative.name) t = entity.associations[a] + for (const a in entity.associations) + if (a !== 'SiblingEntity' && entity.associations[a].target === relative.name) t = entity.associations[a] if (t && w[0]?.xpr) for (const ele of w[0].xpr) if (ele.ref?.[0] === relativeAlias) ele.ref.splice(0, 1, as, t.name) } - childCqn._aliases = new Set(previousCqn ? [...previousCqn._aliases.values(), as] : [as]) childCqn.where(w) diff --git a/package.json b/package.json index 4c552ce..c8cd434 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cap-js/audit-logging", - "version": "0.8.2", + "version": "0.8.3", "description": "CDS plugin providing integration to the SAP Audit Log service as well as out-of-the-box personal data-related audit logging based on annotations.", "repository": "cap-js/audit-logging", "author": "SAP SE (https://www.sap.com)",