@neoimpulse/cap-js-notifications 1.0.1 → 1.0.3
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/lib/utils.js +2 -2
- package/package.json +2 -2
- package/srv/notifyToConsole.js +2 -2
- package/srv/notifyToRest.js +2 -2
package/lib/utils.js
CHANGED
|
@@ -199,9 +199,9 @@ function buildNotification(notificationData) {
|
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
if (notificationData
|
|
202
|
+
if (notificationData) {
|
|
203
203
|
if (!validateCustomNotifyParameters(
|
|
204
|
-
notificationData.
|
|
204
|
+
notificationData.NotificationTypeKey,
|
|
205
205
|
notificationData.recipients,
|
|
206
206
|
notificationData.properties,
|
|
207
207
|
notificationData.navigation,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neoimpulse/cap-js-notifications",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A CDS plugin to provide an easy action for the notification service",
|
|
5
5
|
"main": "cds-plugin.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"keywords": [
|
|
14
14
|
"cds",
|
|
15
15
|
"cap",
|
|
16
|
-
"
|
|
16
|
+
"notifications",
|
|
17
17
|
"plugin"
|
|
18
18
|
],
|
|
19
19
|
"author": "Neoimpulse GmbH",
|
package/srv/notifyToConsole.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const cds = require("@sap/cds");
|
|
2
2
|
const LOG = cds.log('notifications');
|
|
3
|
-
const { readFile } = require("../lib/utils");
|
|
3
|
+
const { readFile, buildNotification } = require("../lib/utils");
|
|
4
4
|
|
|
5
5
|
module.exports = class NotifyToConsole extends cds.Service {
|
|
6
6
|
async init() {
|
|
@@ -15,7 +15,7 @@ module.exports = class NotifyToConsole extends cds.Service {
|
|
|
15
15
|
console.log (
|
|
16
16
|
'\n---------------------------------------------------------------\n' +
|
|
17
17
|
'Notification:', req.event,
|
|
18
|
-
|
|
18
|
+
buildNotification(notification),
|
|
19
19
|
'\n---------------------------------------------------------------\n',
|
|
20
20
|
)
|
|
21
21
|
|
package/srv/notifyToRest.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { buildHeadersForDestination } = require("@sap-cloud-sdk/connectivity");
|
|
2
2
|
const { executeHttpRequest } = require("@sap-cloud-sdk/http-client");
|
|
3
|
-
const { getNotificationDestination, readFile } = require("../lib/utils");
|
|
3
|
+
const { getNotificationDestination, readFile, buildNotification } = require("../lib/utils");
|
|
4
4
|
const cds = require("@sap/cds");
|
|
5
5
|
const LOG = cds.log('notifications');
|
|
6
6
|
const NOTIFICATIONS_API_ENDPOINT = "v2/Notification.svc";
|
|
@@ -28,7 +28,7 @@ module.exports = exports = class NotifyToRest extends cds.Service {
|
|
|
28
28
|
await executeHttpRequest(notificationDestination, {
|
|
29
29
|
url: `${NOTIFICATIONS_API_ENDPOINT}/Notifications`,
|
|
30
30
|
method: "post",
|
|
31
|
-
data: notificationData,
|
|
31
|
+
data: buildNotification(notificationData),
|
|
32
32
|
headers: csrfHeaders,
|
|
33
33
|
});
|
|
34
34
|
} catch (err) {
|