Skip to content

Commit 730c8d2

Browse files
Merge branch 'main' into rjegl01/secReview
2 parents 68a8382 + b735ff2 commit 730c8d2

File tree

10 files changed

+175
-62
lines changed

10 files changed

+175
-62
lines changed
Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1+
const { base, themeConfig: { sidebar }} = global.VITEPRESS_CONFIG.site
12
import { join } from 'node:path'
2-
import { ContentData, DefaultTheme, SiteConfig} from 'vitepress'
3-
type SBItem = DefaultTheme.SidebarItem
4-
5-
// @ts-ignore
6-
const site = (global.VITEPRESS_CONFIG as SiteConfig<DefaultTheme.Config>).site
7-
const sidebar = site.themeConfig.sidebar! as SBItem[]
3+
import { ContentData, DefaultTheme } from 'vitepress'
84

95
type ContentDataCustom = ContentData & {
106
title?:string
117
}
128

9+
type SBItem = DefaultTheme.SidebarItem
10+
1311
export default (pages:ContentDataCustom[], basePath:string):ContentDataCustom[] => {
1412
let items = findInItems(basePath, sidebar) || []
1513
items = items.map(item => { return { ...item, link: item.link?.replace(/\.md$/, '') }})
16-
const itemLinks = items.map(item => join(site.base, item.link||''))
14+
const itemLinks = items.map(item => join(base, item.link||''))
1715

1816
return pages
1917
.map(p => {
2018
const res = { ...p } // do not mutate original data
2119
res.url = res.url?.replaceAll('@external/', '')?.replace(/\/index$/, '/') || ''
22-
res.url = join(site.base, res.url)
20+
res.url = join(base, res.url)
2321
return res
2422
})
2523
.filter(p => {
@@ -40,20 +38,11 @@ export default (pages:ContentDataCustom[], basePath:string):ContentDataCustom[]
4038
}))
4139
}
4240

43-
import {inspect} from 'node:util'
44-
inspect.defaultOptions.depth = 111
45-
46-
function findInItems(url:string, items:SBItem[]=[], all:SBItem[]=[]) : SBItem[] {
41+
function findInItems(url:string, items:SBItem[]=[]):SBItem[]|undefined {
42+
let res = items.find(item => item.link?.includes(url))
43+
if (res) return res.items
4744
for (const item of items) {
48-
if (item.link?.includes(url)) {
49-
// console.log(url, item.link)
50-
all.push(item)
51-
}
52-
if (item.items) {
53-
// console.log('>>', item.link || item.text)
54-
findInItems(url, item.items, all)
55-
}
56-
45+
const result = findInItems(url, item.items)
46+
if (result) return result
5747
}
58-
return all
5948
}

guides/databases/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ The illustration below shows what happens automatically under the hood:
2525
> [!tip] Following the Calesi Pattern
2626
> The implementations of the CAP database layers follow the design principles of CAP-level Service Integration:
2727
> - Database Services are CAP services themselves, which...
28-
> - allows applications to extend them using standard CAP APIs
2928
> - provide database-agnostic interfaces to applications
3029
> - provide mocks for local development out of the box
30+
> - can be extended through event handlers, as any other CAP service
3131
3232
> [!tip] Promoting Fast Inner-Loop Development
3333
> Through the ability to easily swap production-grade databases like SAP HANA with SQLite or H2 in-memory databases during development, without any changes to CDS models nor implementations, we greatly promote inner-loop development with fast turnaround cycles, as well as speeding up test pipelines and minimize TCD.

guides/databases/initial-data.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You can also specify other folders by providing the `--out` option, e.g.:
4141
cds add data -o test/data
4242
```
4343

44-
44+
Each file contains a CSV header line reflecting the structure of the entity to which it corresponds.
4545

4646
## Editing `.csv` Files
4747

@@ -68,7 +68,7 @@ cds add data --records 10
6868
```
6969

7070
> [!tip] AI-Generated Data
71-
> For more realistic domain-specific data, you can use AI tools, like CoPilot in VS Code, to assist you in that. This works particularly well for small to medium-sized datasets. Even more as CDS models provide easy to reason domain models, combined with strong typing information that AIs can leverage to generate fitting data samples.
71+
> For more realistic domain-specific data, you can use AI tools, like CoPilot in VS Code, to assist you in that. This works particularly well for small to medium-sized datasets. Moreover, CDS models provide domain models that are easy to reason about, with strong typing information, meaning that AIs can generate better fitting data samples.
7272
7373

7474

@@ -78,7 +78,7 @@ Common rules apply to text content in `.csv` files, like:
7878
| ------------------------------------------------------------ | --------------------------- |
7979
| If texts contain commas, or line breaks, or trailing whitespaces | -> enclose in double quotes |
8080
| If texts contain double quotes | -> escape by doubling them |
81-
| Numeric content shall be treated as texts | -> enclose in double quotes |
81+
| Numeric content should be treated as texts | -> enclose in double quotes |
8282

8383

8484

@@ -158,13 +158,13 @@ myproject/
158158

159159
All `db/data/*.csv` and `srv/data/*.csv` files are automatically loaded, because they are located in a `data` folder next to `.cds` model sources.
160160

161-
Additionally, this _in-the-neighborhood-of-models_ technique enables reuse packages, which's main purpose is to provide initial data. Such packages get installed via `npm` or `mvn`, and hence their content will reside under `node_modules` folders, or Maven `target` folders. As long as they also provide models through `.cds` sources, their data will be found and loaded.
161+
This is especially useful for remote service definitions imported with `cds import` (by default into `srv/external/`) so that data for such services can also be served when mocking.
162162

163163

164164

165165
## From Reuse Packages
166166

167-
The [_in-the-neighborhood-of-models_](#next-to-cds-files) technique enables reuse packages, which's main purpose is to provide initial data.
167+
The [_in-the-neighborhood-of-models_](#next-to-cds-files) technique enables reuse packages whose main purpose is to provide initial data.
168168

169169
Find an example for such a content reuse package at [*@capire/common*](https://github.com/capire/common) which showcases how one could provide ISO reuse data for `Countries`, `Currencies` and `Languages` code lists, as defined in [`@sap/cds/common`](../../cds/common). It essentially consists of these files as content:
170170

guides/deploy/index.data.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { basename } from 'node:path'
22
import { createContentLoader } from 'vitepress'
33
import filter from '../../.vitepress/theme/components/indexFilter.ts'
44

5-
export default createContentLoader([`**/guides/deploy/*.md`, `**/guides/multitenancy/*.md`], {
5+
const basePath = basename(__dirname)
6+
7+
export default createContentLoader([`**/${basePath}/*.md`, `**/guides/multitenancy/*.md`], {
68
transform(rawData) {
7-
return filter(rawData, `/guides/`)
9+
return filter(rawData, `/${basePath}/`)
810
}
911
})

guides/security/_menu.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

2-
# [Security Overview](overview)
3-
# [Authentication](authentication)
4-
# [CAP Users](cap-users)
5-
# [CAP Authorization](authorization)
6-
# [Remote Authentication](remote-authentication)
7-
# [Data Privacy Overview](data-privacy)
2+
# [Concepts & Architecture](overview)
3+
# [CAP-level Authentication](authentication)
4+
## [CAP Users](cap-users)
5+
## [Remote Authentication](remote-authentication)
6+
# [CAP-level Authorization](authorization)
7+
# [Data Protection](data-protection)
8+
# [Data Privacy](data-privacy)
89
# [Annotating Personal Data](dpp-annotations)
910
# [Automatic Audit Logging](dpp-audit-logging)
1011
# [Personal Data Management](dpp-pdm)
1112
<!-- ## [Data Retention Management](dpp-drm) -->
12-
# [Product Security Overview](data-protection)
1313
# [Product Security Standard](../../../guides/security/product-standards) <!-- INTERNAL -->

java/cds-data.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,52 @@ Note, that the propagated annotation `@cds.java.name` creates attribute and meth
668668
This feature requires version 8.2.0 of the [CDS Command Line Interface](../tools/cds-cli).
669669
:::
670670

671+
#### Excluding Elements
672+
673+
You can exclude elements from accessor interfaces with the annotation `@cds.java.ignore`.
674+
675+
For example, you can exclude an element from the entity like this:
676+
677+
```cds
678+
namespace my.bookshop;
679+
680+
entity Books {
681+
key ID : Integer;
682+
title : localized String;
683+
stock : Integer;
684+
@cds.java.ignore
685+
ignored : String;
686+
}
687+
```
688+
689+
This provides an interface that has no methods for the attribute `ignored`.
690+
691+
On the service level, you can exclude elements from projections as well as operations and their arguments like this:
692+
693+
```cds
694+
service CatalogService {
695+
entity Books as
696+
projection on my.Books {
697+
ID,
698+
@cds.java.ignore title,
699+
stock,
700+
ignored
701+
}
702+
actions {
703+
@cds.java.ignore action act(@cds.java.ignore arg: String);
704+
function func(arg: String, @cds.java.ignore ignored: String) returns String;
705+
}
706+
}
707+
```
708+
709+
This annotation propagates across projections and they also omit the ignored elements. This can be overridden with the following annotation:
710+
711+
```cds
712+
annotate Books:ignored with @cds.java.ignore: false;
713+
```
714+
715+
If you want to exclude a set of entities, prefer [filters](/java/developing-applications/building#filter-for-cds-entities) for the code generator.
716+
671717
#### Entity Inheritance in Java
672718

673719
In CDS models it is allowed to extend a definition (for example, of an entity) with one or more named [aspects](../cds/cdl#aspects). The aspect allows to define elements or annotations that are common to all extending definitions in one place.

java/index.data.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { basename } from 'node:path'
22
import { createContentLoader } from 'vitepress'
33
import filter from '../.vitepress/theme/components/indexFilter.ts'
44

5-
export default createContentLoader([`**/java/*.md`, `**/java/**/index.md`], {
5+
const basePath = basename(__dirname)
6+
7+
export default createContentLoader([`**/${basePath}/*.md`, `**/${basePath}/**/index.md`], {
68
transform(rawData) {
7-
return filter(rawData, `/java/`)
9+
return filter(rawData, `/${basePath}/`)
810
}
911
})

menu.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
## [Domain Modeling](guides/domain/_menu.md)
1414
## [Services & APIs](guides/services/_menu.md)
1515
## [Serving UIs](guides/uis/_menu.md)
16-
## [Protocols](guides/protocols/_menu.md)
17-
## [Querying](guides/querying/_menu.md) <!-- UNRELEASED -->
1816
## [Databases](guides/databases/_menu.md)
17+
## [Querying](guides/querying/_menu.md) <!-- UNRELEASED -->
18+
## [Protocols](guides/protocols/_menu.md)
19+
## [Integration](guides/integration/_menu.md)
1920
## [Data Federation](guides/federation/_menu.md) <!-- UNRELEASED -->
20-
## [Service Integration](guides/integration/_menu.md)
2121
## [Events & Messaging](guides/events/_menu.md)
2222
## [Security & Data Privacy](guides/security/_menu.md)
2323
## [Extensibility](guides/extensibility/_menu.md)

node.js/fiori.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ The `NEW` event is triggered when the user created a new draft.
6767
As a result `MyEntity.drafts` is created in the database.
6868
You can modify the initial draft data in a `before` handler.
6969

70+
:::warning Known Limitation
71+
With the [`hdb` SAP HANA driver](https://www.npmjs.com/package/hdb), trying to `INSERT` draft entities with fields that use the [`LargeBinary` type](../cds/types#core-built-in-types) will cause a deadlock.
72+
The known workaround is to [configure your CAP app](../guides/databases/hana#setup-configuration) to use the [`hana-client` SAP HANA driver](https://www.npmjs.com/package/@sap/hana-client) instead.
73+
:::
7074

7175
### `EDIT`
7276

0 commit comments

Comments
 (0)