@things-factory/integration-notification 4.3.652 → 4.3.671

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": "4.3.652",
3
+ "version": "4.3.671",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -22,8 +22,8 @@
22
22
  "clean": "npm run clean:server"
23
23
  },
24
24
  "dependencies": {
25
- "@things-factory/integration-base": "^4.3.652",
26
- "@things-factory/notification": "^4.3.609"
25
+ "@things-factory/integration-base": "^4.3.671",
26
+ "@things-factory/notification": "^4.3.671"
27
27
  },
28
- "gitHead": "3aa7eb5c7879696cc724760bd04fc6e5cc30194f"
28
+ "gitHead": "ef524cb207378186ec71917d9a8546363d4300b2"
29
29
  }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("./task");
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/engine/index.ts"],"names":[],"mappings":";;AAAA,kBAAe"}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("./notification");
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/engine/task/index.ts"],"names":[],"mappings":";;AAAA,0BAAuB"}
@@ -1,108 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const typeorm_1 = require("typeorm");
4
- const vm2_1 = require("vm2");
5
- const shell_1 = require("@things-factory/shell");
6
- const auth_base_1 = require("@things-factory/auth-base");
7
- const integration_base_1 = require("@things-factory/integration-base");
8
- const notification_1 = require("@things-factory/notification");
9
- async function Notification(step, { logger, domain, data, variables }) {
10
- var { params: { level: type, receivers, title, image, url, body, push = false } } = step;
11
- if (!receivers || !title || !body) {
12
- throw Error(`receivers, title and body should be defined: receivers - '${receivers}', title - '${title}', body - '${body}'`);
13
- }
14
- const repository = (0, typeorm_1.getRepository)(auth_base_1.User);
15
- // TODO filter only users having current domain privilege
16
- receivers = (await Promise.all(receivers
17
- .split(',')
18
- .map(email => email.trim())
19
- .map(async (email) => {
20
- var receiver = await repository.findOne({ email });
21
- return receiver && receiver.id;
22
- }))).filter(receiver => !!receiver);
23
- const vm = new vm2_1.VM({
24
- sandbox: {
25
- data,
26
- variables
27
- }
28
- });
29
- body = vm.run('`' + body + '`');
30
- const timestamp = String(Date.now());
31
- if (push) {
32
- await (0, notification_1.notify)({
33
- receivers,
34
- privileges: undefined,
35
- tokens: undefined,
36
- topic: undefined,
37
- title,
38
- body,
39
- data: {
40
- url,
41
- timestamp
42
- },
43
- image,
44
- actions: undefined
45
- });
46
- }
47
- else {
48
- await shell_1.pubsub.publish('notification', {
49
- notification: {
50
- domain,
51
- type,
52
- subject: type || 'info',
53
- title,
54
- body,
55
- image,
56
- url,
57
- timestamp
58
- }
59
- });
60
- }
61
- return {
62
- data: true
63
- };
64
- }
65
- Notification.parameterSpec = [
66
- {
67
- type: 'select',
68
- name: 'level',
69
- label: 'level',
70
- property: {
71
- options: ['', 'info', 'warn', 'error']
72
- }
73
- },
74
- {
75
- type: 'string',
76
- name: 'receivers',
77
- label: 'receivers'
78
- },
79
- {
80
- type: 'string',
81
- name: 'title',
82
- label: 'title'
83
- },
84
- {
85
- type: 'string',
86
- name: 'image',
87
- label: 'image'
88
- },
89
- {
90
- type: 'string',
91
- name: 'url',
92
- label: 'url'
93
- },
94
- {
95
- type: 'textarea',
96
- name: 'body',
97
- label: 'message-body'
98
- },
99
- {
100
- type: 'checkbox',
101
- name: 'push',
102
- label: 'push-notification'
103
- }
104
- ];
105
- Notification.connectorFree = true;
106
- Notification.help = 'integration/task/notification';
107
- integration_base_1.TaskRegistry.registerTaskHandler('notification', Notification);
108
- //# sourceMappingURL=notification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../server/engine/task/notification.ts"],"names":[],"mappings":";;AAAA,qCAAuC;AACvC,6BAAwB;AACxB,iDAA8C;AAC9C,yDAAgD;AAChD,uEAA+D;AAC/D,+DAAqD;AAErD,KAAK,UAAU,YAAY,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;IACnE,IAAI,EACF,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,EAAE,EAC1E,GAAG,IAAI,CAAA;IAER,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE;QACjC,MAAM,KAAK,CACT,6DAA6D,SAAS,eAAe,KAAK,cAAc,IAAI,GAAG,CAChH,CAAA;KACF;IAED,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,gBAAI,CAAC,CAAA;IAEtC,yDAAyD;IACzD,SAAS,GAAG,CACV,MAAM,OAAO,CAAC,GAAG,CACf,SAAS;SACN,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC1B,GAAG,CAAC,KAAK,EAAC,KAAK,EAAC,EAAE;QACjB,IAAI,QAAQ,GAAS,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QACxD,OAAO,QAAQ,IAAI,QAAQ,CAAC,EAAE,CAAA;IAChC,CAAC,CAAC,CACL,CACF,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAEhC,MAAM,EAAE,GAAG,IAAI,QAAE,CAAC;QAChB,OAAO,EAAE;YACP,IAAI;YACJ,SAAS;SACV;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KAAK;KACb;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,cAAc;KACtB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,mBAAmB;KAC3B;CACF,CAAA;AAED,YAAY,CAAC,aAAa,GAAG,IAAI,CAAA;AACjC,YAAY,CAAC,IAAI,GAAG,+BAA+B,CAAA;AAEnD,+BAAY,CAAC,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA"}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("./engine");
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;AAAA,oBAAiB"}