File tree Expand file tree Collapse file tree 5 files changed +33
-11
lines changed Expand file tree Collapse file tree 5 files changed +33
-11
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ yarn-debug.log*
6
6
yarn-error.log *
7
7
lerna-debug.log *
8
8
.pnpm-debug.log *
9
+ package-lock.json
9
10
10
11
# Diagnostic reports (https://nodejs.org/api/report.html)
11
12
report. [0-9 ]* . [0-9 ]* . [0-9 ]* . [0-9 ]* .json
Original file line number Diff line number Diff line change
1
+ {
2
+ "tabWidth": 2,
3
+ "useTabs": false,
4
+ "printWidth": 150
5
+ }
Original file line number Diff line number Diff line change 1
1
const cds = require ( "@sap/cds" ) ;
2
2
const { validateNotificationTypes, readFile } = require ( "./lib/utils" ) ;
3
- const { createNotificationTypesMap, processNotificationTypes } = require ( "./lib/notificationTypes" ) ;
3
+ const { createNotificationTypesMap } = require ( "./lib/notificationTypes" ) ;
4
4
const { setGlobalLogLevel } = require ( "@sap-cloud-sdk/util" ) ;
5
5
6
6
cds . once ( "served" , async ( ) => {
7
7
setGlobalLogLevel ( "error" ) ;
8
8
const profiles = cds . env . profiles ?? [ ] ;
9
- const production = profiles . includes ( ' production' ) ;
9
+ const production = profiles . includes ( " production" ) ;
10
10
11
11
// read notification types
12
12
const notificationTypes = readFile ( cds . env . requires ?. notifications ?. types ) ;
13
13
14
- if ( validateNotificationTypes ( notificationTypes ) ) {
15
- if ( production ) {
16
- await processNotificationTypes ( notificationTypes ) ;
17
- } else {
14
+ if ( validateNotificationTypes ( notificationTypes ) ) {
15
+ if ( ! production ) {
18
16
const notificationTypesMap = createNotificationTypesMap ( notificationTypes , true ) ;
19
- cds . notifications = { local : { types : notificationTypesMap } } ;
17
+ cds . notifications = { local : { types : notificationTypesMap } } ;
20
18
}
21
19
}
22
20
} ) ;
Original file line number Diff line number Diff line change
1
+ const cds = require ( "@sap/cds" ) ;
2
+ const { validateNotificationTypes, readFile } = require ( "./utils" ) ;
3
+ const { createNotificationTypesMap, processNotificationTypes } = require ( "./notificationTypes" ) ;
4
+ const { setGlobalLogLevel } = require ( "@sap-cloud-sdk/util" ) ;
5
+
6
+ async function deployNotificationTypes ( ) {
7
+ setGlobalLogLevel ( "error" ) ;
8
+
9
+ // read notification types
10
+ const notificationTypes = readFile ( cds . env . requires ?. notifications ?. types ) ;
11
+
12
+ if ( validateNotificationTypes ( notificationTypes ) ) {
13
+ await processNotificationTypes ( notificationTypes ) ;
14
+ }
15
+ }
16
+
17
+ deployNotificationTypes ( ) ;
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " @cap-js/alert-notification " ,
2
+ "name" : " @cap-js/notifications " ,
3
3
"version" : " 0.0.1" ,
4
4
"description" : " CDS plugin providing integration to the SAP BTP Alert Notification Service." ,
5
- "repository" : " cap-js/alert-notification " ,
5
+ "repository" : " cap-js/notifications " ,
6
6
"author" : " SAP SE (https://www.sap.com)" ,
7
7
"homepage" : " https://cap.cloud.sap/" ,
8
8
"license" : " SEE LICENSE IN LICENSE" ,
15
15
"@sap-cloud-sdk/connectivity" : " 3.5.0" ,
16
16
"@sap-cloud-sdk/http-client" : " 3.5.0" ,
17
17
"@sap-cloud-sdk/util" : " 3.5.0" ,
18
+ "@sap/cds" : " >=7" ,
18
19
"lodash" : " 4.17.21"
19
20
},
20
21
"devDependencies" : {
36
37
}
37
38
},
38
39
"notify-to-console" : {
39
- "impl" : " @cap-js/alert-notification /srv/notifyToConsole" ,
40
+ "impl" : " @cap-js/notifications /srv/notifyToConsole" ,
40
41
"outbox" : false
41
42
},
42
43
"notify-to-rest" : {
43
- "impl" : " @cap-js/alert-notification /srv/notifyToRest" ,
44
+ "impl" : " @cap-js/notifications /srv/notifyToRest" ,
44
45
"outbox" : true
45
46
}
46
47
}
You can’t perform that action at this time.
0 commit comments