@sap/cds 5.9.4 → 5.9.5
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,14 @@
|
|
|
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.9.5 - 2022-05-09
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- `HDB_TCP_KEEP_ALIVE_IDLE` config
|
|
12
|
+
- A combination of `!=` operator and `or` in `where` clauses of `@restrict` annotations or when adjusting `req.query` in custom handlers (OData services only)
|
|
13
|
+
- Programmatic calls to bound actions/functions do have keys in `req.data` again if compat flag `cds.env.features.keys_in_data_compat` is set
|
|
14
|
+
|
|
7
15
|
## Version 5.9.4 - 2022-05-02
|
|
8
16
|
|
|
9
17
|
### Fixed
|
|
@@ -62,6 +62,25 @@ const add_handler_for = (srv, def) => {
|
|
|
62
62
|
}
|
|
63
63
|
const {params} = target ? target.actions[event] : def
|
|
64
64
|
if (params) req.data = _named(args,params) || _positional(args,params)
|
|
65
|
+
|
|
66
|
+
// ensure legacy compat, keys in req.data
|
|
67
|
+
if(cds.env.features.keys_in_data_compat && target) {
|
|
68
|
+
// named/positional variant of keys
|
|
69
|
+
const named = req.params.length === 1 && typeof req.params[0] === 'object'
|
|
70
|
+
|
|
71
|
+
let pos = 0 //> counter for key in positional variant
|
|
72
|
+
for (const k in target.keys) {
|
|
73
|
+
if (req.data[k]) {
|
|
74
|
+
LOG._warn && LOG.warn(`
|
|
75
|
+
${target.name} has defined ${k} as key and action parameter.
|
|
76
|
+
Key will be used in req.data.
|
|
77
|
+
`)
|
|
78
|
+
}
|
|
79
|
+
req.data[k] = named ? req.params[0][k] : req.params[pos++]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
65
84
|
return this.send (req)
|
|
66
85
|
}
|
|
67
86
|
stub._is_stub = true
|
|
@@ -487,16 +487,16 @@ const _convertNotEqual = (container, partName = 'where') => {
|
|
|
487
487
|
const where = container[partName]
|
|
488
488
|
|
|
489
489
|
if (where) {
|
|
490
|
-
let
|
|
491
|
-
|
|
490
|
+
for (let index = 0; index < where.length; index++) {
|
|
491
|
+
const el = where[index]
|
|
492
492
|
if (el === '!=') {
|
|
493
493
|
const refIndex = _getRefIndex(where, index)
|
|
494
494
|
if (refIndex !== undefined) {
|
|
495
495
|
where[index - 1] = {
|
|
496
496
|
xpr: [where[index - 1], el, where[index + 1], 'or', where[refIndex], '=', { val: null }]
|
|
497
497
|
}
|
|
498
|
-
where
|
|
499
|
-
|
|
498
|
+
where.splice(index, 2)
|
|
499
|
+
--index
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
|
|
@@ -504,11 +504,6 @@ const _convertNotEqual = (container, partName = 'where') => {
|
|
|
504
504
|
if (el.SELECT) _convertNotEqual(el.SELECT, partName)
|
|
505
505
|
if (el.xpr) _convertNotEqual(el, 'xpr')
|
|
506
506
|
}
|
|
507
|
-
})
|
|
508
|
-
|
|
509
|
-
// delete undefined values
|
|
510
|
-
if (changed) {
|
|
511
|
-
container[partName] = where.filter(el => el)
|
|
512
507
|
}
|
|
513
508
|
}
|
|
514
509
|
|
|
@@ -37,7 +37,7 @@ function _connectHdb(creds, tenant) {
|
|
|
37
37
|
// tls keep alive
|
|
38
38
|
if (process.env.HDB_TCP_KEEP_ALIVE_IDLE) {
|
|
39
39
|
const num = Number(process.env.HDB_TCP_KEEP_ALIVE_IDLE)
|
|
40
|
-
creds.tcpKeepAliveIdle = Number.
|
|
40
|
+
creds.tcpKeepAliveIdle = Number.isNaN(num) ? false : num
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const hdbClient = this.createClient(creds)
|
|
@@ -41,7 +41,7 @@ const _buildPartialUrlFunctions = (url, data, params, kind = 'odata-v4') => {
|
|
|
41
41
|
const funcParams = []
|
|
42
42
|
const queryOptions = []
|
|
43
43
|
// REVISIT: take params from params after importer fix (the keys should not be part of params)
|
|
44
|
-
for (const param in data) {
|
|
44
|
+
for (const param in _extractParamsFromData(data, params)) {
|
|
45
45
|
if (kind === 'odata-v2') {
|
|
46
46
|
funcParams.push(`${param}=${_setCorrectValue(param, data, params, kind)}`)
|
|
47
47
|
} else {
|
|
@@ -54,7 +54,7 @@ const _buildPartialUrlFunctions = (url, data, params, kind = 'odata-v4') => {
|
|
|
54
54
|
: `${url}(${funcParams.join(',')})?${queryOptions.join('&')}`
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
const _extractParamsFromData = (data, params) => {
|
|
57
|
+
const _extractParamsFromData = (data, params = {}) => {
|
|
58
58
|
return Object.keys(data).reduce((res, el) => {
|
|
59
59
|
if (params[el]) Object.assign(res, { [el]: data[el] })
|
|
60
60
|
return res
|
|
@@ -118,7 +118,7 @@ const _handleV2BoundActionFunction = (srv, def, req, event, kind) => {
|
|
|
118
118
|
const params = []
|
|
119
119
|
const data = req.data
|
|
120
120
|
// REVISIT: take params from def.params, after importer fix (the keys should not be part of params)
|
|
121
|
-
for (const param in req.data) {
|
|
121
|
+
for (const param in _extractParamsFromData(req.data, def.params)) {
|
|
122
122
|
params.push(`${param}=${formatVal(data[param], param, { elements: def.params }, kind)}`)
|
|
123
123
|
}
|
|
124
124
|
const keys = _buildKeys(req, this.kind)
|