@cap-js/audit-logging 0.6.0 → 0.7.0

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 CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/).
6
6
 
7
+ ## Version 0.7.0 - tbd
8
+
9
+ ### Added
10
+
11
+ - Automatically promote entities that are associated with data subjects
12
+
7
13
  ## Version 0.6.0 - 2024-02-05
8
14
 
9
15
  ### Added
package/cds-plugin.js CHANGED
@@ -19,6 +19,20 @@ cds.on('served', services => {
19
19
  for (const entity of service.entities) if (hasPersonalData(entity)) relevantEntities.push(entity)
20
20
  if (!relevantEntities.length) continue
21
21
 
22
+ // automatically promote entities that are associated with data subjects
23
+ for (const entity of relevantEntities) {
24
+ if (entity['@PersonalData.EntitySemantics'] !== 'DataSubject') continue
25
+ for (const e of service.entities) {
26
+ for (const k in e.associations) {
27
+ if (e.associations[k].target === entity.name && k !== 'SiblingEntity') {
28
+ e['@PersonalData.EntitySemantics'] ??= 'Other'
29
+ e.associations[k]['@PersonalData.FieldSemantics'] ??= 'DataSubjectID'
30
+ if (!relevantEntities.includes(e)) relevantEntities.push(e)
31
+ }
32
+ }
33
+ }
34
+ }
35
+
22
36
  for (const entity of relevantEntities) {
23
37
  /*
24
38
  * data access
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/audit-logging",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "CDS plugin providing integration to the SAP Audit Log service as well as out-of-the-box personal data-related audit logging based on annotations.",
5
5
  "repository": "cap-js/audit-logging",
6
6
  "author": "SAP SE (https://www.sap.com)",