@@ -2,7 +2,6 @@ const { existsSync, readFileSync } = require('fs');
2
2
const { basename } = require ( 'path' ) ;
3
3
const cds = require ( "@sap/cds" ) ;
4
4
const LOG = cds . log ( 'notifications' ) ;
5
- const { executeHttpRequest } = require ( "@sap-cloud-sdk/http-client" ) ;
6
5
const { getDestination } = require ( "@sap-cloud-sdk/connectivity" ) ;
7
6
const PRIORITIES = [ "LOW" , "NEUTRAL" , "MEDIUM" , "HIGH" ] ;
8
7
@@ -23,12 +22,12 @@ const messages = {
23
22
} ;
24
23
25
24
function validateNotificationTypes ( notificationTypes ) {
26
- notificationTypes . forEach ( ( notificationType ) => {
25
+ for ( notificationType of notificationTypes ) {
27
26
if ( ! ( "NotificationTypeKey" in notificationType ) ) {
28
27
LOG . _warn && LOG . warn ( messages . INVALID_NOTIFICATION_TYPES ) ;
29
28
return false ;
30
29
}
31
- } ) ;
30
+ }
32
31
33
32
return true ;
34
33
}
@@ -128,22 +127,6 @@ function getNotificationTypesKeyWithPrefix(notificationTypeKey) {
128
127
return `${ prefix } /${ notificationTypeKey } ` ;
129
128
}
130
129
131
- async function executeRequest ( httpMethod , targetUrl , payload , notificationDestination , csrfHeaders ) {
132
- let response = { } ;
133
- try {
134
- response = await executeHttpRequest ( notificationDestination , {
135
- url : targetUrl ,
136
- method : httpMethod ,
137
- data : payload ,
138
- headers : csrfHeaders ,
139
- } ) ;
140
- } catch ( e ) {
141
- console . log ( e ) ;
142
- response = e . response . data ;
143
- }
144
- return response ;
145
- }
146
-
147
130
function buildDefaultNotification (
148
131
recipients ,
149
132
priority = "NEUTRAL" ,
@@ -255,6 +238,5 @@ module.exports = {
255
238
getNotificationDestination,
256
239
getPrefix,
257
240
getNotificationTypesKeyWithPrefix,
258
- executeRequest,
259
241
buildNotification
260
242
} ;
0 commit comments