File tree Expand file tree Collapse file tree 4 files changed +16
-33
lines changed Expand file tree Collapse file tree 4 files changed +16
-33
lines changed Original file line number Diff line number Diff line change
1
+ ## 1.2.0 (February 13, 2020)
2
+
3
+ * "Receive" trigger awaits the result of emit
4
+ * Update sailor version to 2.6.3
5
+ * Remove "q" dependency
6
+
1
7
## 1.1.2 (January 30, 2020)
2
8
3
9
* Update sailor version to 2.6.1
Original file line number Diff line number Diff line change 1
- const Q = require ( 'q' ) ;
2
-
3
- // eslint-disable-next-line func-names
4
- exports . process = function ( msg ) {
1
+ exports . process = async function receive ( msg ) {
5
2
const msgId = msg . id ;
6
3
this . logger . info ( 'Received new message:\n' , JSON . stringify ( msg ) ) ;
7
4
@@ -28,27 +25,8 @@ exports.process = function (msg) {
28
25
this . logger . info ( 'Updated body: \n' , JSON . stringify ( msg . body ) ) ;
29
26
}
30
27
31
- // eslint-disable-next-line consistent-this
32
- let self = this ;
33
-
34
- function emitData ( ) {
35
- self . logger . info ( 'Emitting data of message: ' , msgId ) ;
36
- self . emit ( 'data' , msg ) ;
37
- }
38
-
39
- function onError ( e ) {
40
- self . logger . info ( e ) ;
41
- self . emit ( 'error' , e ) ;
42
- }
43
-
44
- function onEnd ( ) {
45
- self . logger . info ( 'Finished processing message: ' , msgId ) ;
46
- self . emit ( 'end' ) ;
47
- }
48
-
49
- Q ( )
50
- . then ( emitData )
51
- . fail ( onError )
52
- . finally ( onEnd ) ;
28
+ this . logger . info ( 'Emitting data of message: ' , msgId ) ;
29
+ await this . emit ( 'data' , msg ) ;
30
+ this . logger . info ( 'Data emitted' ) ;
53
31
} ;
54
32
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " webhook" ,
3
- "version" : " 1.1.2 " ,
3
+ "version" : " 1.2.0 " ,
4
4
"description" : " elastic.io webhook component" ,
5
5
"scripts" : {
6
6
"pretest" : " eslint spec lib verifyCredentials.js --fix" ,
12
12
"author" : " elastic.io GmbH" ,
13
13
"license" : " Apache License 2.0" ,
14
14
"dependencies" : {
15
- "elasticio-sailor-nodejs" : " 2.6.1" ,
16
15
"elasticio-node" : " 0.0.8" ,
16
+ "elasticio-sailor-nodejs" : " 2.6.3" ,
17
17
"node-uuid" : " 1.4.8" ,
18
- "request" : " 2.83.x" ,
19
- "q" : " 1.5.1"
18
+ "request" : " 2.83.x"
20
19
},
21
20
"devDependencies" : {
22
21
"@elastic.io/component-logger" : " 0.0.1" ,
You can’t perform that action at this time.
0 commit comments