Skip to content

Commit b5d8ccf

Browse files
committed
local interface
1 parent e066543 commit b5d8ccf

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

package.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,20 @@
1717
"scripts": {
1818
"lint": "npx eslint .",
1919
"test": "npx jest --silent"
20-
}
20+
},
21+
"cds": {
22+
"requires": {
23+
"kinds": {
24+
"notifications": {
25+
"[development]": {
26+
"kind": "alert-to-console"
27+
}
28+
},
29+
"alert-to-console": {
30+
"impl": "@cap-js/alert-notification/srv/log2console",
31+
"outbox": false
32+
}
33+
}
34+
}
35+
}
2136
}

srv/log2console.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const AlertNotificationService = require('./service')
2+
3+
module.exports = class Alert2Console extends AlertNotificationService {
4+
async init() {
5+
6+
// call AlertNotificationService's init
7+
await super.init()
8+
}
9+
}

srv/service.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,19 @@
22
* TODO: Add the entry point for the Plugin Service here.
33
* We will branch out for development and production profile here
44
*/
5+
6+
const cds = require('@sap/cds')
7+
const notifier = require("../lib/notifications");
8+
9+
// REVISIT: cds.OutboxService or technique to avoid extending OutboxService
10+
const OutboxService = require('@sap/cds/libx/_runtime/messaging/Outbox')
11+
12+
module.exports = class AlertNotificationService extends OutboxService {
13+
async init() {
14+
15+
// call OutboxService's init
16+
await super.init()
17+
18+
this.notify = notifier.postNotification
19+
}
20+
}

0 commit comments

Comments
 (0)