@sap/cds 9.4.4 → 9.5.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 +81 -1
- package/_i18n/messages_en_US_saptrc.properties +1 -1
- package/common.cds +5 -2
- package/lib/compile/cds-compile.js +1 -0
- package/lib/compile/for/assert.js +64 -0
- package/lib/compile/for/flows.js +194 -58
- package/lib/compile/for/lean_drafts.js +75 -7
- package/lib/compile/parse.js +1 -1
- package/lib/compile/to/csn.js +6 -2
- package/lib/compile/to/edm.js +1 -1
- package/lib/compile/to/yaml.js +8 -1
- package/lib/dbs/cds-deploy.js +2 -2
- package/lib/env/cds-env.js +14 -4
- package/lib/env/defaults.js +6 -1
- package/lib/i18n/localize.js +1 -1
- package/lib/index.js +7 -7
- package/lib/req/event.js +4 -0
- package/lib/req/validate.js +4 -1
- package/lib/srv/cds.Service.js +2 -1
- package/lib/srv/middlewares/auth/ias-auth.js +5 -7
- package/lib/srv/middlewares/auth/index.js +1 -1
- package/lib/srv/protocols/index.js +7 -6
- package/lib/srv/srv-handlers.js +7 -0
- package/libx/_runtime/common/Service.js +5 -1
- package/libx/_runtime/common/constants/events.js +1 -0
- package/libx/_runtime/common/generic/assert.js +220 -0
- package/libx/_runtime/common/generic/flows.js +168 -108
- package/libx/_runtime/common/generic/input.js +6 -4
- package/libx/_runtime/common/utils/cqn.js +0 -24
- package/libx/_runtime/common/utils/normalizeTimestamp.js +2 -2
- package/libx/_runtime/common/utils/resolveView.js +8 -2
- package/libx/_runtime/common/utils/templateProcessor.js +10 -1
- package/libx/_runtime/common/utils/templateProcessorPathSerializer.js +21 -9
- package/libx/_runtime/fiori/lean-draft.js +511 -379
- package/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +39 -35
- package/libx/_runtime/messaging/enterprise-messaging.js +2 -2
- package/libx/_runtime/remote/Service.js +4 -5
- package/libx/_runtime/ucl/Service.js +111 -15
- package/libx/common/utils/streaming.js +1 -1
- package/libx/odata/middleware/batch.js +8 -6
- package/libx/odata/middleware/create.js +2 -2
- package/libx/odata/middleware/delete.js +2 -2
- package/libx/odata/middleware/metadata.js +18 -11
- package/libx/odata/middleware/read.js +2 -2
- package/libx/odata/middleware/service-document.js +1 -1
- package/libx/odata/middleware/update.js +1 -1
- package/libx/odata/parse/afterburner.js +46 -36
- package/libx/odata/parse/cqn2odata.js +2 -6
- package/libx/odata/parse/grammar.peggy +91 -13
- package/libx/odata/parse/parser.js +1 -1
- package/libx/odata/utils/index.js +2 -2
- package/libx/odata/utils/readAfterWrite.js +2 -0
- package/libx/queue/TaskRunner.js +26 -1
- package/libx/queue/index.js +11 -1
- package/package.json +1 -1
- package/srv/ucl-service.cds +2 -0
|
@@ -45,14 +45,23 @@ const _processComplex = (processFn, row, template, key, pathOptions) => {
|
|
|
45
45
|
if (rows.length === 0) return
|
|
46
46
|
const keyNames = pathOptions.includeKeyValues && _getTargetKeyNames(template.target)
|
|
47
47
|
|
|
48
|
+
let rowIndex = -1
|
|
48
49
|
for (const row of rows) {
|
|
50
|
+
rowIndex++
|
|
49
51
|
if (row == null) continue
|
|
50
52
|
const args = { processFn, data: row, template, isRoot: false, pathOptions }
|
|
51
53
|
|
|
52
54
|
let pathSegmentInfo
|
|
53
55
|
if (pathOptions.includeKeyValues) {
|
|
54
56
|
pathOptions.rowUUIDGenerator?.(keyNames, row, template)
|
|
55
|
-
pathSegmentInfo = {
|
|
57
|
+
pathSegmentInfo = {
|
|
58
|
+
key,
|
|
59
|
+
keyNames,
|
|
60
|
+
row,
|
|
61
|
+
rowIndex,
|
|
62
|
+
elements: template.target.elements,
|
|
63
|
+
draftKeys: pathOptions.draftKeys
|
|
64
|
+
}
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
if (pathOptions.pathSegmentsInfo) pathOptions.pathSegmentsInfo.push(pathSegmentInfo || key)
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
const
|
|
1
|
+
const segmentKeySerializer = pathSegmentInfo => {
|
|
2
2
|
const { key: tKey, row, elements, draftKeys } = pathSegmentInfo
|
|
3
3
|
let keyNames = pathSegmentInfo.keyNames
|
|
4
4
|
|
|
5
5
|
const keyValuePairs = keyNames
|
|
6
6
|
.map(key => {
|
|
7
|
-
|
|
7
|
+
const keyValue = row[key] ?? draftKeys?.[key]
|
|
8
|
+
if (keyValue == null) return
|
|
9
|
+
|
|
10
|
+
let formattedValue
|
|
8
11
|
|
|
9
12
|
switch (elements[key].type) {
|
|
10
13
|
case 'cds.String':
|
|
11
|
-
|
|
14
|
+
formattedValue = `'${keyValue}'`
|
|
15
|
+
break
|
|
16
|
+
|
|
17
|
+
case 'cds.Binary':
|
|
18
|
+
if (Buffer.isBuffer(keyValue)) formattedValue = keyValue.toString('base64')
|
|
19
|
+
formattedValue = `binary'${formattedValue}'`
|
|
12
20
|
break
|
|
13
21
|
|
|
14
22
|
default:
|
|
15
|
-
|
|
23
|
+
formattedValue = keyValue
|
|
16
24
|
break
|
|
17
25
|
}
|
|
18
26
|
|
|
19
|
-
|
|
20
|
-
if (keyValue == null) return
|
|
21
|
-
return `${key}=${quote}${keyValue}${quote}`
|
|
27
|
+
return `${key}=${formattedValue}`
|
|
22
28
|
})
|
|
23
29
|
.filter(c => c)
|
|
24
30
|
|
|
@@ -27,10 +33,16 @@ const segmentSerializer = pathSegmentInfo => {
|
|
|
27
33
|
return pathSegment
|
|
28
34
|
}
|
|
29
35
|
|
|
30
|
-
const
|
|
36
|
+
const segmentIndexSerializer = pathSegmentInfo => {
|
|
37
|
+
const { key: tKey, rowIndex } = pathSegmentInfo
|
|
38
|
+
return `${tKey}[${rowIndex}]`
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const templatePathSerializer = (elementName, pathSegmentsInfo, serializeWithIndices = false) => {
|
|
31
42
|
const pathSegments = pathSegmentsInfo.map(pathSegmentInfo => {
|
|
32
43
|
if (typeof pathSegmentInfo === 'string') return pathSegmentInfo
|
|
33
|
-
return
|
|
44
|
+
if (serializeWithIndices) return segmentIndexSerializer(pathSegmentInfo)
|
|
45
|
+
return segmentKeySerializer(pathSegmentInfo)
|
|
34
46
|
})
|
|
35
47
|
const path = `${pathSegments.join('/')}${pathSegments.length ? '/' : ''}${elementName}`
|
|
36
48
|
return path
|