File tree Expand file tree Collapse file tree 5 files changed +30
-8
lines changed Expand file tree Collapse file tree 5 files changed +30
-8
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 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" : {
46
47
}
47
48
}
48
49
}
49
- }
50
+ }
You can’t perform that action at this time.
0 commit comments