@cap-js/audit-logging 0.4.0 → 0.5.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.5.0 - 2023-11-22
8
+
9
+ ### Added
10
+
11
+ - Common log entry fields `uuid`, `tenant`, `user` and `time` can be provided manually
12
+
7
13
  ## Version 0.4.0 - 2023-10-24
8
14
 
9
15
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/audit-logging",
3
- "version": "0.4.0",
3
+ "version": "0.5.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)",
package/srv/service.js CHANGED
@@ -8,8 +8,11 @@ module.exports = class AuditLogService extends Base {
8
8
 
9
9
  // add common audit log entry fields
10
10
  this.before('*', req => {
11
- const { tenant, user, timestamp: time } = cds.context
12
- Object.assign(req.data, { uuid: cds.utils.uuid(), tenant, user: user.id, time })
11
+ const { tenant, user, timestamp } = cds.context
12
+ req.data.uuid ??= cds.utils.uuid()
13
+ req.data.tenant ??= tenant
14
+ req.data.user ??= user.id
15
+ req.data.time ??= timestamp
13
16
  })
14
17
 
15
18
  // call OutboxService's init