@sap/cds 5.8.3 → 5.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
  - The format is based on [Keep a Changelog](http://keepachangelog.com/).
5
5
  - This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## Version 5.8.4 - 2022-03-17
8
+
9
+ ### Fixed
10
+
11
+ - `UPDATE` singleton entity does not require to provide singleton keys in a payload
12
+ - CQN queries with operator expressions (`xpr`) in ON-conditions of unmanaged associations and compositions
13
+
7
14
  ## Version 5.8.3 - 2022-03-01
8
15
 
9
16
  ### Fixed
@@ -7,6 +7,7 @@ const replaceManagedData = require('../utils/dollar')
7
7
  const { deepCopyArray } = require('../utils/copy')
8
8
 
9
9
  const onlyKeysRemain = require('../utils/onlyKeysRemain')
10
+ const { getColumns } = require('../../cds-services/services/utils/columns')
10
11
 
11
12
  const _targetEntityDoesNotExist = async req => {
12
13
  const { query } = req
@@ -98,10 +99,11 @@ module.exports = cds.service.impl(function () {
98
99
  result = req.data
99
100
  }
100
101
 
101
- if (req.event === 'DELETE' && req.target._isSingleton) {
102
- if (!req.target['@odata.singleton.nullable']) req.reject(400, 'SINGLETON_NOT_NULLABLE')
103
-
104
- const singleton = await cds.tx(req).run(SELECT.one(req.target))
102
+ if (req.event in { DELETE: 1, UPDATE: 1 } && req.target && req.target._isSingleton) {
103
+ if (req.event === 'DELETE' && !req.target['@odata.singleton.nullable']) req.reject(400, 'SINGLETON_NOT_NULLABLE')
104
+ const keyColumns = getColumns(req.target, { onlyNames: true, keysOnly: true })
105
+ const selectSingleton = SELECT.one(req.target).columns(keyColumns)
106
+ const singleton = await cds.tx(req).run(selectSingleton)
105
107
  if (!singleton) req.reject(404)
106
108
  req.query.where(singleton)
107
109
  }
@@ -18,7 +18,7 @@ const _adaptRefs = (onCond, path, { select, join }) => {
18
18
 
19
19
  return _toRef(join, ref.slice(0))
20
20
  } else if (el.xpr) {
21
- el.xpr = el.xpr.map(_adaptEl)
21
+ return { xpr: el.xpr.map(_adaptEl) }
22
22
  }
23
23
 
24
24
  return el
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds",
3
- "version": "5.8.3",
3
+ "version": "5.8.4",
4
4
  "description": "SAP Cloud Application Programming Model - CDS for Node.js",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [