Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## Version 1.1.2 - tbd

### Changed

- Removed alpha auto-detect kind `audit-log-to-als` to prevent failing lookup from now optional `VCAP_SERVICES`

## Version 1.1.1 - 2025-10-27

### Fixed
Expand Down
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,13 @@
"audit-log-to-console": {
"impl": "@cap-js/audit-logging/srv/log2console"
},
"audit-log-to-als": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should find a way to keep this

"impl": "@cap-js/audit-logging/srv/log2als"
},
"audit-log-to-restv2": {
"impl": "@cap-js/audit-logging/srv/log2restv2",
"vcap": {
"label": "auditlog"
}
"vcap": { "label": "auditlog" }
},
"audit-log-to-alsng": {
"impl": "@cap-js/audit-logging/srv/log2alsng"
"impl": "@cap-js/audit-logging/srv/log2alsng",
"vcap": { "tag": "auditlog-ng" }
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions srv/log2alsng.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ const AuditLogService = require('./service')
module.exports = class AuditLog2ALSNG extends AuditLogService {
constructor() {
super()
this._vcap = JSON.parse(process.env.VCAP_SERVICES || '{}')
this._userProvided = this._vcap['user-provided']?.find(obj => obj.tags.includes('auditlog-ng')) || {}
if (!this._userProvided.credentials) throw new Error('No credentials found for SAP Audit Log Service NG')
this._userProvided = cds.requires['audit-log']
if (!this._userProvided?.credentials) throw new Error('No credentials found for SAP Audit Log Service NG')
this._vcapApplication = JSON.parse(process.env.VCAP_APPLICATION || '{}')
}

Expand Down
6 changes: 2 additions & 4 deletions test/integration/ng.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
const cds = require('@sap/cds')

const { POST } = cds.test().in(__dirname)

cds.env.requires['audit-log'].kind = 'audit-log-to-alsng'
cds.env.requires['audit-log'].impl = '@cap-js/audit-logging/srv/log2alsng'
const VCAP_SERVICES = {
'user-provided': [
{
Expand All @@ -14,6 +10,8 @@ const VCAP_SERVICES = {
}
process.env.VCAP_SERVICES = JSON.stringify(VCAP_SERVICES)

const { POST } = cds.test(__dirname, '--with-mocks', '--profile', 'audit-log-to-alsng')

describe('Log to Audit Log Service NG ', () => {
if (!VCAP_SERVICES['user-provided'][0].credentials)
return test.skip('Skipping tests due to missing credentials', () => {})
Expand Down
2 changes: 1 addition & 1 deletion test/integration/oauth2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const log = cds.test.log()
cds.env.requires['audit-log'].credentials = process.env.ALS_CREDS_OAUTH2 && JSON.parse(process.env.ALS_CREDS_OAUTH2)

// stay in provider account (i.e., use "$PROVIDER" and avoid x-zid header when fetching oauth2 token)
cds.env.requires.auth.users.alice.tenant = cds.env.requires['audit-log'].credentials.uaa.tenantid
cds.env.requires.auth.users.alice.tenant = cds.env.requires['audit-log'].credentials?.uaa.tenantid

cds.env.log.levels['audit-log'] = 'debug'

Expand Down
7 changes: 6 additions & 1 deletion test/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
},
"cds": {
"requires": {
"audit-log": "audit-log-to-restv2"
"audit-log": "audit-log-to-restv2",
"[audit-log-to-alsng]": {
"audit-log": {
"kind": "audit-log-to-alsng"
}
}
}
}
}
2 changes: 1 addition & 1 deletion test/integration/premium.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const log = cds.test.log()
cds.env.requires['audit-log'].credentials = process.env.ALS_CREDS_PREMIUM && JSON.parse(process.env.ALS_CREDS_PREMIUM)

// stay in provider account (i.e., use "$PROVIDER" and avoid x-zid header when fetching oauth2 token)
cds.env.requires.auth.users.alice.tenant = cds.env.requires['audit-log'].credentials.uaa.tenantid
cds.env.requires.auth.users.alice.tenant = cds.env.requires['audit-log'].credentials?.uaa.tenantid

cds.env.log.levels['audit-log'] = 'debug'

Expand Down