File tree Expand file tree Collapse file tree 2 files changed +27
-15
lines changed Expand file tree Collapse file tree 2 files changed +27
-15
lines changed Original file line number Diff line number Diff line change
1
+ import { Webhooks , MemoryStorageProvider } from '../src/index'
2
+
3
+ ; ( async ( ) => {
4
+ try {
5
+ let wh = new Webhooks ( )
6
+ await wh . add ( {
7
+ url : 'https://localhost/urmom' ,
8
+ events : [
9
+ 'user.create' ,
10
+ 'user.update' ,
11
+ 'ur.mom'
12
+ ]
13
+ } )
14
+ const all = await wh . getAll ( )
15
+ console . log ( 'All >>> ' , all )
16
+ const byEvent = await wh . getByEvents ( 'ur.mom' )
17
+ console . log ( 'By Event >>> ' , byEvent )
18
+ } catch ( e ) {
19
+ console . log ( e )
20
+ }
21
+ } ) ( )
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ interface IWebhookObject {
28
28
modified : string
29
29
}
30
30
31
- class Webhooks {
31
+ export class Webhooks {
32
32
private config : IConfig
33
33
private db : IStorageProvider
34
34
@@ -89,7 +89,7 @@ class Webhooks {
89
89
}
90
90
}
91
91
92
- class MemoryStorageProvider {
92
+ export class MemoryStorageProvider {
93
93
db : IWebhookObject [ ]
94
94
95
95
constructor ( ) {
@@ -125,16 +125,7 @@ class MemoryStorageProvider {
125
125
}
126
126
}
127
127
128
- ; ( async ( ) => {
129
- try {
130
- let wh = new Webhooks ( )
131
- await wh . add ( {
132
- url : 'https://localhost/urmom' ,
133
- events : [ 'sup' ]
134
- } )
135
- const all = await wh . getAll ( )
136
- console . log ( all )
137
- } catch ( e ) {
138
- console . log ( e )
139
- }
140
- } ) ( )
128
+ export default {
129
+ Webhooks,
130
+ MemoryStorageProvider
131
+ }
You can’t perform that action at this time.
0 commit comments