diff --git a/node.js/cds-reflect.md b/node.js/cds-reflect.md index b364f571f..39e17831d 100644 --- a/node.js/cds-reflect.md +++ b/node.js/cds-reflect.md @@ -111,12 +111,12 @@ let m = cds.linked` entity Books {...} entity Authors {...} ` + // Function nature let { Books, Authors } = m.entities ('my.bookshop') - -// Object nature (uses the model's top-level namespace) -let { Books, Authors } = m.entities +// Object nature +let { 'my.bookshop.Books': Books, 'my.bookshop.Authors': Authors } = m.entities // Array nature for (let each of m.entities) console.log (each.name) diff --git a/node.js/fiori.md b/node.js/fiori.md index 4dbb46664..c4c1c4ece 100644 --- a/node.js/fiori.md +++ b/node.js/fiori.md @@ -10,15 +10,19 @@ See [Cookbook > Serving UIs > Draft Support](../advanced/fiori#draft-support) fo [[toc]] + + + + ## Draft Entities {#draft-support} Draft-enabled entities have corresponding CSN entities for drafts: @@ -135,6 +139,7 @@ srv.on('someAction', [ MyEntity, MyEntity.drafts ], /*...*/) ``` + ## Draft Locks 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' ::: + ## Draft Timeouts 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 ::: -## Bypassing Drafts -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. -To enable this feature, set this feature flag in your configuration: +## Bypassing Drafts {.deprecated} + +Use [Direct CRUD](#direct-crud) instead. + +Until the next major release (`cds10`), you can still activate the draft bypass without also allowing direct CRUD via cds.fiori.bypass_draft:true. -```json -{ - "cds": { - "fiori": { - "bypass_draft": true - } - } -} -``` -You can then create active instances directly: + +## Direct CRUD + +With cds.fiori.direct_crud:true, 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. + +That is, you can then create and modify active instances directly: ```http POST /Books { - "ID": 123, - "IsActiveEntity": true + "ID": 123 } ``` -You can modify them directly: - ```http -PATCH /Books(ID=123,IsActiveEntity=true) +PATCH /Books(ID=123) { "title": "How to be more active" } ``` -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 +For this, the default draft creation behavior by SAP Fiori Elements is redirected to a collection-bound action via annotation `@Common.DraftRoot.NewAction`. +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). + +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 same editable properties without creating drafts for each row. :::warning Additional entry point @@ -223,6 +228,7 @@ payloads rather than the complete business object. ::: + ## Programmatic APIs You can programmatically invoke draft actions with the following APIs: