@things-factory/integration-notification 7.0.1-rc.5 → 7.0.1-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/integration-notification",
|
|
3
|
-
"version": "7.0.1-rc.
|
|
3
|
+
"version": "7.0.1-rc.8",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
"clean": "npm run clean:server"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@things-factory/integration-base": "^7.0.1-rc.
|
|
27
|
-
"@things-factory/notification": "^7.0.1-rc.
|
|
26
|
+
"@things-factory/integration-base": "^7.0.1-rc.8",
|
|
27
|
+
"@things-factory/notification": "^7.0.1-rc.8",
|
|
28
|
+
"ses": "^1.5.0"
|
|
28
29
|
},
|
|
29
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "cf1d0f8f261c73eadecb517fc6c82e92e50d6caf"
|
|
30
31
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ILike } from 'typeorm'
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import 'ses'
|
|
4
3
|
import { User } from '@things-factory/auth-base'
|
|
5
4
|
import { TaskRegistry } from '@things-factory/integration-base'
|
|
6
5
|
import { notify } from '@things-factory/notification'
|
|
@@ -12,7 +11,9 @@ async function Notification(step, { logger, domain, user, data, variables }) {
|
|
|
12
11
|
} = step
|
|
13
12
|
|
|
14
13
|
if (!receivers || !title || !body) {
|
|
15
|
-
throw Error(
|
|
14
|
+
throw Error(
|
|
15
|
+
`receivers, title and body should be defined: receivers - '${receivers}', title - '${title}', body - '${body}'`
|
|
16
|
+
)
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const repository = getRepository(User)
|
|
@@ -30,16 +31,22 @@ async function Notification(step, { logger, domain, user, data, variables }) {
|
|
|
30
31
|
)
|
|
31
32
|
).filter(receiver => !!receiver)
|
|
32
33
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
34
|
+
const compartment = new Compartment({
|
|
35
|
+
domain,
|
|
36
|
+
user,
|
|
37
|
+
data,
|
|
38
|
+
variables,
|
|
39
|
+
console
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
let evalBody
|
|
43
|
+
try {
|
|
44
|
+
evalBody = compartment.evaluate('`' + body + '`')
|
|
45
|
+
} catch (err) {
|
|
46
|
+
throw new Error(`Failed to evaluate body: ${err.message}`)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
body = evalBody
|
|
43
50
|
const timestamp = String(Date.now())
|
|
44
51
|
|
|
45
52
|
if (push) {
|