@sap/cds 5.8.0 → 5.8.3
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 +61 -4
- package/app/fiori/routes.js +3 -0
- package/bin/cds.js +7 -3
- package/bin/serve.js +2 -2
- package/lib/deploy.js +1 -1
- package/lib/log/format/kibana.js +3 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +1 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js +13 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ResourcePathParser.js +23 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriHelper.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/ResourceJsonDeserializer.js +5 -6
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ContextURLFactory.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ErrorJsonSerializer.js +2 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/UriHelper.js +4 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/stream.js +40 -5
- package/libx/_runtime/common/composition/index.js +1 -2
- package/libx/_runtime/common/composition/insert.js +3 -16
- package/libx/_runtime/common/composition/tree.js +1 -1
- package/libx/_runtime/common/error/frontend.js +2 -3
- package/libx/_runtime/common/i18n/index.js +2 -31
- package/libx/_runtime/common/utils/csn.js +15 -3
- package/libx/_runtime/common/utils/foreignKeyPropagations.js +9 -6
- package/libx/_runtime/common/utils/generateOnCond.js +5 -5
- package/libx/_runtime/common/utils/structured.js +10 -4
- package/libx/_runtime/db/expand/expandCQNToJoin.js +59 -20
- package/libx/_runtime/db/query/insert.js +1 -2
- package/libx/_runtime/db/sql-builder/SelectBuilder.js +7 -3
- package/libx/_runtime/db/utils/deep.js +10 -6
- package/libx/_runtime/fiori/generic/read.js +1 -3
- package/libx/_runtime/fiori/utils/handler.js +1 -11
- package/libx/_runtime/hana/conversion.js +2 -1
- package/libx/_runtime/hana/customBuilder/CustomSelectBuilder.js +1 -1
- package/libx/_runtime/hana/dynatrace.js +11 -5
- package/libx/_runtime/hana/execute.js +105 -8
- package/libx/_runtime/hana/search2cqn4sql.js +1 -4
- package/libx/_runtime/remote/utils/client.js +13 -4
- package/libx/_runtime/remote/utils/data.js +2 -1
- package/libx/gql/resolvers/crud/create.js +6 -1
- package/libx/gql/resolvers/crud/delete.js +6 -1
- package/libx/gql/resolvers/crud/read.js +6 -1
- package/libx/gql/resolvers/crud/update.js +11 -5
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const cds = require('../../../../lib')
|
|
2
|
+
|
|
1
3
|
const { ARGUMENT } = require('../../constants/adapter')
|
|
2
4
|
const { getArgumentByName, astToColumns, astToWhere, astToEntries } = require('../parse/ast2cqn')
|
|
3
5
|
const { entriesStructureToEntityStructure } = require('./utils')
|
|
@@ -5,16 +7,14 @@ const { entriesStructureToEntityStructure } = require('./utils')
|
|
|
5
7
|
module.exports = async (service, entityFQN, selection) => {
|
|
6
8
|
const filter = getArgumentByName(selection.arguments, ARGUMENT.FILTER)
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
const queryBeforeUpdate = service.read(entityFQN)
|
|
9
11
|
queryBeforeUpdate.columns(astToColumns(selection.selectionSet.selections))
|
|
10
12
|
|
|
11
13
|
if (filter) {
|
|
12
14
|
queryBeforeUpdate.where(astToWhere(filter))
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
let query = service.update(entityFQN)
|
|
17
|
+
const query = service.update(entityFQN)
|
|
18
18
|
|
|
19
19
|
if (filter) {
|
|
20
20
|
query.where(astToWhere(filter))
|
|
@@ -24,7 +24,13 @@ module.exports = async (service, entityFQN, selection) => {
|
|
|
24
24
|
const entries = entriesStructureToEntityStructure(service, entityFQN, astToEntries(input))
|
|
25
25
|
query.with(entries)
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
let resultBeforeUpdate
|
|
28
|
+
const result = await service.tx(async tx => {
|
|
29
|
+
cds.context = tx
|
|
30
|
+
// read needs to be done before the update, otherwise the where clause might become invalid (case that properties in where clause are updated by the mutation)
|
|
31
|
+
resultBeforeUpdate = await tx.run(queryBeforeUpdate)
|
|
32
|
+
return tx.run(query)
|
|
33
|
+
})
|
|
28
34
|
|
|
29
35
|
// Merge selected fields with updated data
|
|
30
36
|
return resultBeforeUpdate.map(original => ({ ...original, ...result }))
|