/
triggers.js
63 lines (54 loc) · 1.46 KB
/
triggers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(function() {
module.exports = {
browser: {
},
cloud: {
"<keyOrRegExp>": {
before: { // will be awaited if asynchronous, user and request are frozen, data can be modified
put({user,data,request}) {
// if data is an object, it can be modified
return true; // return true to continue processing
},
remove({user,data,request}) {
return true; // return true to continue processing
}
},
after: { // will be awaited if asynchronous
put({user,data,request}) {
// might send e-mail
// call a webhook, etc.
},
remove({user,data,request}) {
}
}
},
"<className>@": {
before: { // will be awaited if asynchronous, user and request are frozen, data can be modified
put({user,object,request}) {
// can modify the object
return true; // return true to continue processing
},
update({user,object,property,value,oldValue,request}) {
return true;
},
remove({user,object,request}) {
return true;
}
},
after: { // will be awaited if asynchronous
put({user,object,request}) {
// might send e-mail
// call a webhook, etc.
},
update({user,object,property,value,oldValue,request}) {
},
remove({user,object,request}) {
}
}
}
},
worker: {
// not yet implemented
}
}
}).call(this);