Skip to content

Commit b696bd5

Browse files
authored
Node.js Dec 25 Updates (#2271)
1 parent cdafa84 commit b696bd5

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

node.js/cds-reflect.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ let m = cds.linked`
111111
entity Books {...}
112112
entity Authors {...}
113113
`
114+
114115
// Function nature
115116
let { Books, Authors } = m.entities ('my.bookshop')
116117
117-
118-
// Object nature (uses the model's top-level namespace)
119-
let { Books, Authors } = m.entities
118+
// Object nature
119+
let { 'my.bookshop.Books': Books, 'my.bookshop.Authors': Authors } = m.entities
120120
121121
// Array nature
122122
for (let each of m.entities) console.log (each.name)

node.js/fiori.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ See [Cookbook > Serving UIs > Draft Support](../advanced/fiori#draft-support) fo
1010
[[toc]]
1111

1212

13+
1314
<!--
1415
## Serving `$metadata` Requests
16+
-->
1517

1618

1719

20+
<!--
1821
## Serving `$batch` Requests
19-
2022
-->
2123

24+
25+
2226
## Draft Entities {#draft-support}
2327

2428
Draft-enabled entities have corresponding CSN entities for drafts:
@@ -135,6 +139,7 @@ srv.on('someAction', [ MyEntity, MyEntity.drafts ], /*...*/)
135139
```
136140

137141

142+
138143
## Draft Locks
139144

140145
To prevent inconsistency, the entities with draft are locked for modifications by other users. The lock is released when the draft is saved, canceled or a timeout is hit. The default timeout is 15 minutes. You can configure this timeout by the following application configuration property:
@@ -153,6 +158,7 @@ If the `draft_lock_timeout` has been reached, every user can delete other users'
153158
:::
154159

155160

161+
156162
## Draft Timeouts
157163

158164
Inactive drafts are deleted automatically after the default timeout of 30 days. You can configure or deactivate this timeout by the following configuration:
@@ -178,43 +184,42 @@ It can occur that inactive drafts are still in the database after the configured
178184
:::
179185

180186

181-
## Bypassing Drafts
182-
Creating or modifying active instances directly is possible without creating drafts. This comes in handy when technical services without a UI interact with each other.
183187

184-
To enable this feature, set this feature flag in your configuration:
188+
## Bypassing Drafts {.deprecated}
189+
190+
Use [Direct CRUD](#direct-crud) instead.
191+
192+
Until the next major release (`cds10`), you can still activate the draft bypass without also allowing direct CRUD via <Config>cds.fiori.bypass_draft:true</Config>.
185193

186-
```json
187-
{
188-
"cds": {
189-
"fiori": {
190-
"bypass_draft": true
191-
}
192-
}
193-
}
194-
```
195194

196-
You can then create active instances directly:
195+
196+
## Direct CRUD <Beta />
197+
198+
With <Config>cds.fiori.direct_crud:true</Config>, creating or modifying active instances directly is possible without creating drafts.
199+
This comes in handy when technical services without a UI interact with each other.
200+
201+
That is, you can then create and modify active instances directly:
197202

198203
```http
199204
POST /Books
200205
201206
{
202-
"ID": 123,
203-
"IsActiveEntity": true
207+
"ID": 123
204208
}
205209
```
206210

207-
You can modify them directly:
208-
209211
```http
210-
PATCH /Books(ID=123,IsActiveEntity=true)
212+
PATCH /Books(ID=123)
211213
212214
{
213215
"title": "How to be more active"
214216
}
215217
```
216218

217-
This feature is required to enable [SAP Fiori Elements Mass Edit](https://sapui5.hana.ondemand.com/sdk/#/topic/965ef5b2895641bc9b6cd44f1bd0eb4d.html), allowing users to change multiple objects with the
219+
For this, the default draft creation behavior by SAP Fiori Elements is redirected to a collection-bound action via annotation `@Common.DraftRoot.NewAction`.
220+
The thereby freed `POST` request to draft roots without specifying `IsActiveEntity` leads to the creation of an active instance (as it would without draft enablement).
221+
222+
The feature is required to enable [SAP Fiori Elements Mass Edit](https://sapui5.hana.ondemand.com/sdk/#/topic/965ef5b2895641bc9b6cd44f1bd0eb4d.html), allowing users to change multiple objects with the
218223
same editable properties without creating drafts for each row.
219224

220225
:::warning Additional entry point
@@ -223,6 +228,7 @@ payloads rather than the complete business object.
223228
:::
224229

225230

231+
226232
## Programmatic APIs <Beta />
227233

228234
You can programmatically invoke draft actions with the following APIs:

0 commit comments

Comments
 (0)