@sap/cds 5.9.2 → 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 +44 -0
- package/lib/compile/for/drafts.js +1 -1
- package/lib/index.js +1 -1
- package/lib/serve/Service-methods.js +47 -1
- package/libx/_runtime/auth/index.js +16 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/BatchRequestListBuilder.js +3 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/stream.js +1 -3
- package/libx/_runtime/common/aspects/utils.js +8 -2
- package/libx/_runtime/common/composition/data.js +22 -13
- package/libx/_runtime/common/composition/delete.js +14 -12
- package/libx/_runtime/common/generic/auth/expand.js +1 -0
- package/libx/_runtime/common/generic/input.js +1 -0
- package/libx/_runtime/common/generic/put.js +1 -0
- package/libx/_runtime/common/utils/cqn.js +5 -10
- package/libx/_runtime/common/utils/cqn2cqn4sql.js +39 -75
- package/libx/_runtime/common/utils/foreignKeyPropagations.js +28 -8
- package/libx/_runtime/common/utils/path.js +3 -3
- package/libx/_runtime/common/utils/require.js +2 -1
- package/libx/_runtime/common/utils/resolveView.js +3 -0
- package/libx/_runtime/common/utils/structured.js +6 -1
- package/libx/_runtime/db/Service.js +10 -0
- package/libx/_runtime/db/expand/expand-v2.js +13 -5
- package/libx/_runtime/db/expand/expandCQNToJoin.js +56 -26
- package/libx/_runtime/db/utils/generateAliases.js +9 -0
- package/libx/_runtime/extensibility/uiflex/handler/transformWRITE.js +1 -0
- package/libx/_runtime/fiori/generic/read.js +83 -31
- package/libx/_runtime/fiori/generic/readOverDraft.js +22 -13
- package/libx/_runtime/fiori/utils/handler.js +3 -0
- package/libx/_runtime/fiori/utils/where.js +38 -25
- package/libx/_runtime/hana/driver.js +1 -1
- package/libx/_runtime/hana/search2cqn4sql.js +4 -1
- package/libx/_runtime/remote/Service.js +3 -3
- package/libx/_runtime/sqlite/convertAssocToOneManaged.js +19 -12
- package/package.json +1 -1
|
@@ -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)
|
|
@@ -17,29 +17,36 @@ const _getConvertibleEntries = req => {
|
|
|
17
17
|
return [...orders, ...groups, ...filters, ...havings]
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!req.target || !req.target.elements) return
|
|
20
|
+
const _convert = (refEntries, req) => {
|
|
21
|
+
for (const refEntry of refEntries) {
|
|
22
|
+
if (refEntry.xpr) {
|
|
23
|
+
_convert(refEntry.xpr, req)
|
|
24
|
+
continue
|
|
25
|
+
}
|
|
29
26
|
|
|
30
|
-
for (const refEntry of _getConvertibleEntries(req)) {
|
|
31
27
|
if (!refEntry.ref || refEntry.ref.length < 2) {
|
|
32
28
|
// only check refs in format {ref: ['assoc', 'id']}
|
|
33
29
|
continue
|
|
34
30
|
}
|
|
35
|
-
|
|
36
31
|
const element = req.target.elements[refEntry.ref[0]]
|
|
37
32
|
if (!element || !element.is2one) return
|
|
38
|
-
|
|
39
33
|
_convertRefForAssocToOneManaged(element, refEntry)
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
36
|
|
|
37
|
+
// REVISIT once sql can handle structured keys properly, this handler should not be required anymore
|
|
38
|
+
const _handler = function (req) {
|
|
39
|
+
// do simple checks upfront and exit early
|
|
40
|
+
if (!(req.query && req.query.SELECT) || typeof req.query === 'string') return
|
|
41
|
+
if (!req.query.SELECT.orderBy && !req.query.SELECT.groupBy && !req.query.SELECT.where && !req.query.SELECT.having) {
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!req.target || !req.target.elements) return
|
|
46
|
+
|
|
47
|
+
_convert(_getConvertibleEntries(req), req)
|
|
48
|
+
}
|
|
49
|
+
|
|
43
50
|
_handler._initial = true
|
|
44
51
|
|
|
45
52
|
module.exports = _handler
|