@sap/cds 5.6.0 → 5.6.1
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 +10 -1
- package/lib/i18n/localize.js +2 -1
- package/libx/_runtime/cds-services/adapter/rest/utils/validation-checks.js +6 -2
- package/libx/_runtime/common/auth/strategies/utils/uaa.js +10 -3
- package/libx/_runtime/messaging/common-utils/AMQPClient.js +8 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,12 +4,21 @@
|
|
|
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.6.1 - 2021-11-02
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- UAA credentials lookup
|
|
12
|
+
- Revert return type validation for `cds.String` for compatibility with older `@sap/cds-mtx` versions
|
|
13
|
+
- Messaging: Ill-defined incoming AMQP messages will not crash the app
|
|
14
|
+
- `cds compile -l` does no longer crash if called without `--to` option
|
|
15
|
+
|
|
7
16
|
## Version 5.6.0 - 2021-10-29
|
|
8
17
|
|
|
9
18
|
### Added
|
|
10
19
|
|
|
11
20
|
- New REST protocol adapter (beta)
|
|
12
|
-
+ Makes use of the beta OData URL to CQN parser. Hence, almost all OData requests are supported (see limitations below).
|
|
21
|
+
+ Makes use of the beta OData URL to CQN parser. Hence, almost all OData requests are supported (see limitations below).
|
|
13
22
|
+ Activate via `cds.env.features.rest_new_adapter = true`
|
|
14
23
|
+ Out of scope (compared to OData protocol adapter):
|
|
15
24
|
+ OData query option `$apply`
|
package/lib/i18n/localize.js
CHANGED
|
@@ -35,7 +35,8 @@ function localize (model, /*with:*/ locale, aString) {
|
|
|
35
35
|
const TEXT_KEY_MARKER = 'i18n>'
|
|
36
36
|
const TEXT_KEYS = /"([^"{]+)?{b?i18n>([^"}]+)}([^"]+)?"/g
|
|
37
37
|
function localizeString (aString, bundle) {
|
|
38
|
-
if (!bundle) return aString
|
|
38
|
+
if (!bundle || !aString) return aString
|
|
39
|
+
if (typeof aString === 'object') aString = JSON.stringify(aString, null, 2)
|
|
39
40
|
// quick check for presence of any text key, to avoid expensive operation below
|
|
40
41
|
if (aString.indexOf(TEXT_KEY_MARKER) < 0) return aString
|
|
41
42
|
const isXml = aString.startsWith('<?xml')
|
|
@@ -106,10 +106,14 @@ const validateReturnType = (operation, data) => {
|
|
|
106
106
|
// Determine entity from bound or unbound action/function
|
|
107
107
|
const returnTypeCsnDefinition = returnType._type || returnType
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
// REVISIT: remove exception with cds^6
|
|
110
|
+
// mtx returns object instead of string (as in modell) -> skip validation
|
|
111
|
+
if (returnTypeCsnDefinition.type !== 'cds.String') {
|
|
112
|
+
checkResult = checkStatic(returnTypeCsnDefinition, data, true)
|
|
113
|
+
}
|
|
110
114
|
}
|
|
111
115
|
|
|
112
|
-
if (checkResult.length !== 0) {
|
|
116
|
+
if (checkResult && checkResult.length !== 0) {
|
|
113
117
|
throw _getTypeError(operation, returnType.type, checkResult)
|
|
114
118
|
}
|
|
115
119
|
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
const cds = require('../../../../cds')
|
|
2
2
|
|
|
3
3
|
const getCredentials = uaa => {
|
|
4
|
-
uaa =
|
|
4
|
+
uaa =
|
|
5
|
+
uaa && uaa.credentials
|
|
6
|
+
? uaa
|
|
7
|
+
: cds.env.requires.uaa && cds.env.requires.uaa.credentials
|
|
8
|
+
? cds.env.requires.uaa
|
|
9
|
+
: cds.env.requires.xsuaa && cds.env.requires.xsuaa.credentials
|
|
10
|
+
? cds.env.requires.xsuaa
|
|
11
|
+
: {}
|
|
5
12
|
|
|
6
|
-
if (!uaa.credentials)
|
|
13
|
+
if (!uaa.credentials)
|
|
7
14
|
throw Object.assign(new Error('No or malformed uaa credentials'), { credentials: uaa.credentials })
|
|
8
|
-
|
|
15
|
+
|
|
9
16
|
return uaa.credentials
|
|
10
17
|
}
|
|
11
18
|
|
|
@@ -18,9 +18,14 @@ const addDataListener = (client, queue, prefix, cb) =>
|
|
|
18
18
|
.receiver(queue)
|
|
19
19
|
.attach(source)
|
|
20
20
|
.on('data', async raw => {
|
|
21
|
-
const buffer = Buffer.concat(raw.payload.chunks)
|
|
22
|
-
const payload = _JSONorString(buffer.toString())
|
|
23
|
-
const topic =
|
|
21
|
+
const buffer = raw.payload && Buffer.concat(raw.payload.chunks)
|
|
22
|
+
const payload = buffer && _JSONorString(buffer.toString())
|
|
23
|
+
const topic =
|
|
24
|
+
raw.source &&
|
|
25
|
+
raw.source.properties &&
|
|
26
|
+
raw.source.properties.to &&
|
|
27
|
+
raw.source.properties.to.replace(/^topic:\/*/, '')
|
|
28
|
+
if (!topic) return raw.done()
|
|
24
29
|
await cb(topic, payload, null, { done: raw.done, failed: raw.failed })
|
|
25
30
|
})
|
|
26
31
|
.on('subscribed', () => {
|