@neoimpulse/cap-js-notifications 1.0.4 → 1.0.6
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/package.json +1 -1
- package/srv/notifyToConsole.js +4 -4
- package/srv/notifyToRest.js +5 -4
package/package.json
CHANGED
package/srv/notifyToConsole.js
CHANGED
|
@@ -11,14 +11,14 @@ module.exports = class NotifyToConsole extends cds.Service {
|
|
|
11
11
|
|
|
12
12
|
this.on(eventsToListen, req => {
|
|
13
13
|
LOG._debug && LOG.debug('Handling notification event:', req.event)
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const message = data.message
|
|
14
|
+
const type = req.event
|
|
15
|
+
let message = req.data
|
|
17
16
|
message.type = type
|
|
17
|
+
message = buildNotification(message);
|
|
18
18
|
console.log (
|
|
19
19
|
'\n---------------------------------------------------------------\n' +
|
|
20
20
|
'Notification:', req.event,
|
|
21
|
-
|
|
21
|
+
message,
|
|
22
22
|
'\n---------------------------------------------------------------\n',
|
|
23
23
|
)
|
|
24
24
|
|
package/srv/notifyToRest.js
CHANGED
|
@@ -16,10 +16,11 @@ module.exports = exports = class NotifyToRest extends cds.Service {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
async postNotification(req) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const message = data.message
|
|
19
|
+
const type = req.event
|
|
20
|
+
let message = req.data
|
|
22
21
|
message.type = type
|
|
22
|
+
message = buildNotification(message);
|
|
23
|
+
|
|
23
24
|
const notificationDestination = await getNotificationDestination();
|
|
24
25
|
const csrfHeaders = await buildHeadersForDestination(notificationDestination, {
|
|
25
26
|
url: NOTIFICATIONS_API_ENDPOINT,
|
|
@@ -27,7 +28,7 @@ module.exports = exports = class NotifyToRest extends cds.Service {
|
|
|
27
28
|
|
|
28
29
|
try {
|
|
29
30
|
LOG._info && LOG.info(
|
|
30
|
-
`Sending notification of key: ${
|
|
31
|
+
`Sending notification of key: ${message.NotificationTypeKey} and version: ${message.NotificationTypeVersion}`
|
|
31
32
|
);
|
|
32
33
|
await executeHttpRequest(notificationDestination, {
|
|
33
34
|
url: `${NOTIFICATIONS_API_ENDPOINT}/Notifications`,
|