@things-factory/notification 5.0.7 → 6.0.0-alpha.0
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/client/viewparts/notification-sender.js +7 -5
- package/dist-server/controllers/fcm.js +3 -11
- package/dist-server/controllers/fcm.js.map +1 -1
- package/dist-server/controllers/index.js +2 -15
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/index.js +5 -18
- package/dist-server/index.js.map +1 -1
- package/dist-server/middlewares/index.js.map +1 -1
- package/dist-server/middlewares/notification-middleware.js.map +1 -1
- package/dist-server/migrations/index.js.map +1 -1
- package/dist-server/routers/notification-router.js +6 -19
- package/dist-server/routers/notification-router.js.map +1 -1
- package/dist-server/routes.js +3 -7
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/index.js +2 -15
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/notification/directive-notification.js +2 -4
- package/dist-server/service/notification/directive-notification.js.map +1 -1
- package/dist-server/service/notification/index.js.map +1 -1
- package/dist-server/service/notification/notification-resolver.js +9 -21
- package/dist-server/service/notification/notification-resolver.js.map +1 -1
- package/dist-server/service/notification/notification.js +20 -29
- package/dist-server/service/notification/notification.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +7 -7
- package/server/controllers/fcm.ts +2 -7
- package/server/routers/notification-router.ts +5 -3
- package/server/routes.ts +3 -8
- package/server/service/notification/notification-resolver.ts +4 -4
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@material/mwc-formfield'
|
|
2
|
+
import '@material/mwc-button'
|
|
3
|
+
import '@material/mwc-checkbox'
|
|
4
|
+
|
|
5
|
+
import { css, html, LitElement } from 'lit'
|
|
6
|
+
|
|
2
7
|
import { auth } from '@things-factory/auth-base'
|
|
3
8
|
import { i18next, localize } from '@things-factory/i18n-base'
|
|
4
9
|
import { ScrollbarStyles } from '@things-factory/styles'
|
|
5
|
-
import { notify as webpushNotify } from '../actions/notification-fcm'
|
|
6
10
|
|
|
7
|
-
import '
|
|
8
|
-
import '@material/mwc-button'
|
|
9
|
-
import '@material/mwc-checkbox'
|
|
11
|
+
import { notify as webpushNotify } from '../actions/notification-fcm'
|
|
10
12
|
|
|
11
13
|
export class NotificationSender extends localize(i18next)(LitElement) {
|
|
12
14
|
static get styles() {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.notify = exports.unregister = exports.register = exports.sendNotification = exports.getConfig = void 0;
|
|
7
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
8
6
|
const env_1 = require("@things-factory/env");
|
|
9
7
|
const admin = require('firebase-admin');
|
|
10
|
-
const debug = require('debug')('things-factory:notification:fcm');
|
|
11
8
|
const fcmconf = env_1.config.get('notification') || {};
|
|
12
9
|
const { fcm, vapidKey } = fcmconf;
|
|
13
10
|
const { serviceAccount, appConfig, serverKey } = fcm || {};
|
|
@@ -112,7 +109,6 @@ async function notify({ receivers, privileges, tokens, topic, title, body, data,
|
|
|
112
109
|
data,
|
|
113
110
|
tokens
|
|
114
111
|
});
|
|
115
|
-
debug('send-all', response);
|
|
116
112
|
}
|
|
117
113
|
else {
|
|
118
114
|
let token = tokens[0];
|
|
@@ -121,20 +117,16 @@ async function notify({ receivers, privileges, tokens, topic, title, body, data,
|
|
|
121
117
|
data,
|
|
122
118
|
token
|
|
123
119
|
});
|
|
124
|
-
debug('send', response);
|
|
125
120
|
}
|
|
126
121
|
}
|
|
127
122
|
if (topic) {
|
|
128
|
-
debug('send to topic', topic);
|
|
129
123
|
let response = await messaging.send({
|
|
130
124
|
notification,
|
|
131
125
|
data,
|
|
132
126
|
topic
|
|
133
127
|
});
|
|
134
|
-
debug('send-topic', response);
|
|
135
128
|
}
|
|
136
129
|
if (receivers && receivers instanceof Array) {
|
|
137
|
-
debug('send to receivers', receivers);
|
|
138
130
|
for (let receiver of receivers) {
|
|
139
131
|
var notification_key = await getDeviceGroup(receiver);
|
|
140
132
|
if (notification_key) {
|
|
@@ -162,7 +154,7 @@ async function postDeviceGroup(body) {
|
|
|
162
154
|
return notification_key;
|
|
163
155
|
}
|
|
164
156
|
else {
|
|
165
|
-
|
|
157
|
+
console.error('postDeviceGroup-notok', response.status, await response.text());
|
|
166
158
|
}
|
|
167
159
|
}
|
|
168
160
|
async function getDeviceGroup(notificationKeyName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fcm.js","sourceRoot":"","sources":["../../server/controllers/fcm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fcm.js","sourceRoot":"","sources":["../../server/controllers/fcm.ts"],"names":[],"mappings":";;;;AAAA,oEAA8B;AAE9B,6CAAoD;AAEpD,MAAM,KAAK,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAEvC,MAAM,OAAO,GAAG,YAAM,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAA;AAChD,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;AACjC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,EAAE,CAAA;AAC1D,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,QAAQ,IAAI,EAAE,CAAA;AAEzD,IAAI,cAAc,EAAE;IAClB,IAAI;QACF,KAAK,CAAC,aAAa,CAAC;YAClB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC;SAClD,CAAC,CAAA;QAEF,IAAI,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;KAClC;IA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ACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,OAAO,SAAS,EAAE;YACjC,UAAU,EAAE,SAAS,CAAC,iBAAiB;SACxC;KACF,CACF,CAAA;IAED,IAAI,QAAQ,CAAC,EAAE,EAAE;QACf,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAClD,OAAO,gBAAgB,CAAA;KACxB;AACH,CAAC","sourcesContent":["import fetch from 'node-fetch'\n\nimport { config, logger } from '@things-factory/env'\n\nconst admin = require('firebase-admin')\n\nconst fcmconf = config.get('notification') || {}\nconst { fcm, vapidKey } = fcmconf\nconst { serviceAccount, appConfig, serverKey } = fcm || {}\nconst { subject, publicKey, privateKey } = vapidKey || {}\n\nif (serviceAccount) {\n try {\n admin.initializeApp({\n credential: admin.credential.cert(serviceAccount)\n })\n\n var messaging = admin.messaging()\n } catch (err) {\n logger.error('incorrect notification configuration')\n logger.error(err)\n }\n}\n\nexport function getConfig() {\n return messaging\n ? {\n appConfig,\n vapidPublicKey: publicKey\n }\n : {}\n}\n\n/**\n * sendNotification\n *\n * @param receiver user.id who will receive notification\n * @param message message object to be sent\n */\nexport async function sendNotification({ receivers, message }) {\n if (!messaging) {\n return\n }\n\n notify({\n receivers,\n ...message\n })\n}\n\nexport async function register(user, { subscription }) {\n if (!messaging || !subscription || !user) {\n return false\n }\n\n try {\n var notification_key = await getDeviceGroup(user.id)\n\n if (!notification_key) {\n await postDeviceGroup({\n operation: 'create',\n notification_key_name: user.id,\n registration_ids: [subscription]\n })\n } else {\n await postDeviceGroup({\n operation: 'add',\n notification_key_name: user.id,\n notification_key,\n registration_ids: [subscription]\n })\n }\n\n return true\n } catch (err) {\n return\n }\n}\n\nexport async function unregister(user, { subscription }) {\n if (!messaging || !subscription || !user) {\n return false\n }\n\n try {\n var notification_key = await getDeviceGroup(user.id)\n\n if (notification_key) {\n await postDeviceGroup({\n operation: 'remove',\n notification_key_name: user.id,\n notification_key,\n registration_ids: [subscription]\n })\n }\n\n return true\n } catch (err) {\n return\n }\n}\n\nexport async function notify({ receivers, privileges, tokens, topic, title, body, data, image, actions }) {\n if (!messaging) {\n return\n }\n\n // Caution: non-string attributes are not allowed in FCM payload validation\n var notification = {\n title: title || '',\n body: body || '',\n image: image || ''\n }\n\n if (tokens && tokens instanceof Array && tokens.length > 0) {\n if (tokens.length > 1) {\n let response = await messaging.sendMulticast({\n notification,\n data,\n tokens\n })\n } else {\n let token = tokens[0]\n let response = await messaging.send({\n notification,\n data,\n token\n })\n }\n }\n\n if (topic) {\n let response = await messaging.send({\n notification,\n data,\n topic\n })\n }\n\n if (receivers && receivers instanceof Array) {\n for (let receiver of receivers) {\n var notification_key = await getDeviceGroup(receiver)\n\n if (notification_key) {\n await messaging.sendToDeviceGroup(notification_key, {\n notification,\n data\n })\n }\n }\n }\n}\n\nasync function postDeviceGroup(body) {\n var response = await fetch('https://fcm.googleapis.com/fcm/notification', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `key=${serverKey}`,\n project_id: appConfig.messagingSenderId\n },\n body: JSON.stringify(body)\n })\n\n if (response.ok) {\n const { notification_key } = await response.json()\n return notification_key\n } else {\n console.error('postDeviceGroup-notok', response.status, await response.text())\n }\n}\n\nasync function getDeviceGroup(notificationKeyName) {\n var response = await fetch(\n `https://fcm.googleapis.com/fcm/notification?notification_key_name=${notificationKeyName}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `key=${serverKey}`,\n project_id: appConfig.messagingSenderId\n }\n }\n )\n\n if (response.ok) {\n const { notification_key } = await response.json()\n return notification_key\n }\n}\n"]}
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./fcm"), exports);
|
|
18
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;AAAA,gDAAqB","sourcesContent":["export * from './fcm'"]}
|
package/dist-server/index.js
CHANGED
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./service"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./migrations"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./middlewares"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./controllers"), exports);
|
|
21
8
|
require("./routes");
|
|
22
9
|
//# sourceMappingURL=index.js.map
|
package/dist-server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,oDAAyB;AACzB,uDAA4B;AAC5B,wDAA6B;AAC7B,wDAA6B;AAE7B,oBAAiB","sourcesContent":["export * from './service'\nexport * from './migrations'\nexport * from './middlewares'\nexport * from './controllers'\n\nimport './routes'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAElE,SAAgB,eAAe,CAAC,GAAG;IACjC,GAAG,CAAC,GAAG,CAAC,gDAAsB,CAAC,CAAA;AACjC,CAAC;AAFD,0CAEC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAElE,SAAgB,eAAe,CAAC,GAAG;IACjC,GAAG,CAAC,GAAG,CAAC,gDAAsB,CAAC,CAAA;AACjC,CAAC;AAFD,0CAEC","sourcesContent":["import { notificationMiddleware } from './notification-middleware'\n\nexport function initMiddlewares(app) {\n app.use(notificationMiddleware)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-middleware.js","sourceRoot":"","sources":["../../server/middlewares/notification-middleware.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAG9C,4CAA2C;AAE3C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,qDAAqD,CAAC,CAAA;AAErF,SAAS,QAAQ,CAAC,OAAO;IACvB,OAAO,KAAK,WAAW,EACrB,SAAS,EACT,UAAU,EACV,MAAM,EACN,KAAK,EACL,OAAO,GAAG,MAAM,EAChB,KAAK,EACL,IAAI;IACJ,QAAQ;IACR,KAAK,EACL,GAAG,EACH,OAAO,EACP,SAAS,GAAG,IAAI,IAAI,EAAE,EACtB,IAAI,GAAG,YAAY,EACpB;QACC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEtC,IAAI;YACF,IAAI,IAAI,KAAK,YAAY,EAAE;gBACzB,2CAA2C;gBAE3C,MAAM,IAAA,YAAM,EAAC;oBACX,SAAS;oBACT,UAAU;oBACV,MAAM;oBACN,KAAK;oBACL,KAAK;oBACL,IAAI;oBACJ,IAAI,EAAE;wBACJ,GAAG;wBACH,SAAS;qBACV;oBACD,KAAK;oBACL,OAAO;iBACR,CAAC,CAAA;aACH;iBAAM;gBACL,8CAA8C;gBAC9C,2BAA2B;gBAC3B,MAAM,cAAM,CAAC,OAAO,CAAC,cAAc,EAAE;oBACnC,YAAY,EAAE;wBACZ,MAAM;wBACN,OAAO;wBACP,KAAK;wBACL,IAAI;wBACJ,KAAK;wBACL,GAAG;wBACH,SAAS;qBACV;iBACF,CAAC,CAAA;aACH;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,KAAK,CAAC,GAAG,CAAC,CAAA;SACX;IACH,CAAC,CAAA;AACH,CAAC;AAEM,KAAK,UAAU,sBAAsB,CAAC,OAAY,EAAE,IAAS;IAClE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE;QACzB,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;KACzC;IAED,MAAM,IAAI,EAAE,CAAA;AACd,CAAC;AAND,wDAMC"}
|
|
1
|
+
{"version":3,"file":"notification-middleware.js","sourceRoot":"","sources":["../../server/middlewares/notification-middleware.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAG9C,4CAA2C;AAE3C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,qDAAqD,CAAC,CAAA;AAErF,SAAS,QAAQ,CAAC,OAAO;IACvB,OAAO,KAAK,WAAW,EACrB,SAAS,EACT,UAAU,EACV,MAAM,EACN,KAAK,EACL,OAAO,GAAG,MAAM,EAChB,KAAK,EACL,IAAI;IACJ,QAAQ;IACR,KAAK,EACL,GAAG,EACH,OAAO,EACP,SAAS,GAAG,IAAI,IAAI,EAAE,EACtB,IAAI,GAAG,YAAY,EACpB;QACC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEtC,IAAI;YACF,IAAI,IAAI,KAAK,YAAY,EAAE;gBACzB,2CAA2C;gBAE3C,MAAM,IAAA,YAAM,EAAC;oBACX,SAAS;oBACT,UAAU;oBACV,MAAM;oBACN,KAAK;oBACL,KAAK;oBACL,IAAI;oBACJ,IAAI,EAAE;wBACJ,GAAG;wBACH,SAAS;qBACV;oBACD,KAAK;oBACL,OAAO;iBACR,CAAC,CAAA;aACH;iBAAM;gBACL,8CAA8C;gBAC9C,2BAA2B;gBAC3B,MAAM,cAAM,CAAC,OAAO,CAAC,cAAc,EAAE;oBACnC,YAAY,EAAE;wBACZ,MAAM;wBACN,OAAO;wBACP,KAAK;wBACL,IAAI;wBACJ,KAAK;wBACL,GAAG;wBACH,SAAS;qBACV;iBACF,CAAC,CAAA;aACH;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,KAAK,CAAC,GAAG,CAAC,CAAA;SACX;IACH,CAAC,CAAA;AACH,CAAC;AAEM,KAAK,UAAU,sBAAsB,CAAC,OAAY,EAAE,IAAS;IAClE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE;QACzB,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;KACzC;IAED,MAAM,IAAI,EAAE,CAAA;AACd,CAAC;AAND,wDAMC","sourcesContent":["import { pubsub } from '@things-factory/shell'\nimport { database } from 'firebase-admin'\n\nimport { notify } from '../controllers/fcm'\n\nconst debug = require('debug')('things-factory:notification:notification-middleware')\n\nfunction notifier(context) {\n return async function ({\n receivers,\n privileges,\n tokens,\n topic,\n subject = 'info',\n title,\n body,\n // data,\n image,\n url,\n actions,\n timestamp = new Date(),\n mode = 'background'\n }) {\n const { domain, user } = context.state\n\n try {\n if (mode === 'background') {\n /* for send webpush notification message */\n\n await notify({\n receivers,\n privileges,\n tokens,\n topic,\n title,\n body,\n data: {\n url,\n timestamp\n },\n image,\n actions\n })\n } else {\n /* for send publish notification to clients */\n // TODO CONFIRM data format\n await pubsub.publish('notification', {\n notification: {\n domain,\n subject,\n title,\n body,\n image,\n url,\n timestamp\n }\n })\n }\n } catch (err) {\n debug(err)\n }\n }\n}\n\nexport async function notificationMiddleware(context: any, next: any) {\n if (!context.state.notify) {\n context.state.notify = notifier(context)\n }\n\n await next()\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA","sourcesContent":["const glob = require('glob')\nconst path = require('path')\n\nexport var migrations = []\n\nglob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {\n if (file.indexOf('index.js') !== -1) return\n migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])\n})\n"]}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
3
|
exports.notificationRouter = void 0;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const koa_router_1 = tslib_1.__importDefault(require("koa-router"));
|
|
20
6
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
21
8
|
const fcm_1 = require("../controllers/fcm");
|
|
22
9
|
const debug = require('debug')('things-factory:notification:notification-router');
|
|
23
10
|
exports.notificationRouter = new koa_router_1.default({
|
|
@@ -42,15 +29,15 @@ exports.notificationRouter.post('/unregister', async (context, next) => {
|
|
|
42
29
|
});
|
|
43
30
|
exports.notificationRouter.post('/notify', async (context, next) => {
|
|
44
31
|
const { user, domain, notify } = context.state;
|
|
45
|
-
const repository = (0,
|
|
46
|
-
var _a = context.request.body, { receivers } = _a, options = __rest(_a, ["receivers"]);
|
|
32
|
+
const repository = (0, shell_1.getRepository)(auth_base_1.User);
|
|
33
|
+
var _a = context.request.body, { receivers } = _a, options = tslib_1.__rest(_a, ["receivers"]);
|
|
47
34
|
debug('post:/notify', receivers, receivers.split(','), options);
|
|
48
35
|
// TODO filter only users having current domain privilege
|
|
49
36
|
receivers = (await Promise.all(receivers
|
|
50
37
|
.split(',')
|
|
51
38
|
.map(email => email.trim())
|
|
52
39
|
.map(async (email) => {
|
|
53
|
-
var receiver = await repository.
|
|
40
|
+
var receiver = await repository.findOneBy({ email });
|
|
54
41
|
return receiver && receiver.id;
|
|
55
42
|
}))).filter(receiver => !!receiver);
|
|
56
43
|
debug('post:/notify', receivers, user.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-router.js","sourceRoot":"","sources":["../../server/routers/notification-router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notification-router.js","sourceRoot":"","sources":["../../server/routers/notification-router.ts"],"names":[],"mappings":";;;;AAAA,oEAA+B;AAE/B,yDAAgD;AAChD,iDAAqD;AAErD,4CAAoE;AAEpE,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,iDAAiD,CAAC,CAAA;AAEpE,QAAA,kBAAkB,GAAG,IAAI,oBAAM,CAAC;IAC3C,MAAM,EAAE,eAAe;CACxB,CAAC,CAAA;AAEF,0BAAkB,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACxD,MAAM,MAAM,GAAG,IAAA,eAAS,GAAE,CAAA;IAE1B,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;IACjC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAA;AACvB,CAAC,CAAC,CAAA;AAEF,0BAAkB,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAC3D,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC9B,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAA;IAChC,OAAO,CAAC,IAAI,GAAG,MAAM,IAAA,cAAQ,EAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACzC,OAAO,CAAC,MAAM,GAAG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C,CACL,CACF,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAEhC,KAAK,CAAC,cAAc,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;IAEzC,MAAM,MAAM,iBACV,SAAS,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,IACpD,OAAO,EACV,CAAA;IAEF,OAAO,CAAC,IAAI,GAAG;QACb,OAAO,EAAE,IAAI;KACd,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["import Router from 'koa-router'\n\nimport { User } from '@things-factory/auth-base'\nimport { getRepository } from '@things-factory/shell'\n\nimport { getConfig, register, unregister } from '../controllers/fcm'\n\nconst debug = require('debug')('things-factory:notification:notification-router')\n\nexport const notificationRouter = new Router({\n prefix: '/notification'\n})\n\nnotificationRouter.get('/config', async (context, next) => {\n const config = getConfig()\n\n context.type = 'application/json'\n context.body = config\n})\n\nnotificationRouter.post('/register', async (context, next) => {\n const { user } = context.state\n const { body } = context.request\n context.body = await register(user, body)\n context.status = 200\n})\n\nnotificationRouter.post('/unregister', async (context, next) => {\n const { user } = context.state\n const { body } = context.request\n context.body = await unregister(user, body)\n context.status = 200\n})\n\nnotificationRouter.post('/notify', async (context, next) => {\n const { user, domain, notify } = context.state\n const repository = getRepository(User)\n\n var { receivers, ...options } = context.request.body\n\n debug('post:/notify', receivers, receivers.split(','), options)\n\n // TODO filter only users having current domain privilege\n receivers = (\n await Promise.all(\n receivers\n .split(',')\n .map(email => email.trim())\n .map(async email => {\n var receiver: User = await repository.findOneBy({ email })\n return receiver && receiver.id\n })\n )\n ).filter(receiver => !!receiver)\n\n debug('post:/notify', receivers, user.id)\n\n await notify({\n receivers: receivers.length > 0 ? receivers : [user.id],\n ...options\n })\n\n context.body = {\n success: true\n }\n})\n"]}
|
package/dist-server/routes.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const notification_router_1 = require("./routers/notification-router");
|
|
4
|
-
|
|
5
|
-
process.on('bootstrap-module-global-
|
|
6
|
-
});
|
|
7
|
-
process.on('bootstrap-module-global-private-route', (app, globalPrivateRouter) => {
|
|
8
|
-
});
|
|
9
|
-
process.on('bootstrap-module-domain-public-route', (app, domainPublicRouter) => {
|
|
10
|
-
});
|
|
4
|
+
process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => { });
|
|
5
|
+
process.on('bootstrap-module-global-private-route', (app, globalPrivateRouter) => { });
|
|
6
|
+
process.on('bootstrap-module-domain-public-route', (app, domainPublicRouter) => { });
|
|
11
7
|
process.on('bootstrap-module-domain-private-route', (app, domainPrivateRouter) => {
|
|
12
8
|
domainPrivateRouter.use('', notification_router_1.notificationRouter.routes(), notification_router_1.notificationRouter.allowedMethods());
|
|
13
9
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAAA,uEAAkE;AAElE,
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAAA,uEAAkE;AAElE,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE,GAAE,CAAC,CAAC,CAAA;AAE1F,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE,GAAE,CAAC,CAAC,CAAA;AAE5F,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE,GAAE,CAAC,CAAC,CAAA;AAE1F,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF,mBAAmB,CAAC,GAAG,CAAC,EAAE,EAAE,wCAAkB,CAAC,MAAM,EAAE,EAAE,wCAAkB,CAAC,cAAc,EAAE,CAAC,CAAA;AAC/F,CAAC,CAAC,CAAA","sourcesContent":["import { notificationRouter } from './routers/notification-router'\n\nprocess.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {})\n\nprocess.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {})\n\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {})\n\nprocess.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {\n domainPrivateRouter.use('', notificationRouter.routes(), notificationRouter.allowedMethods())\n})\n"]}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
3
|
exports.schema = exports.entities = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
18
5
|
/* EXPORT ENTITY TYPES */
|
|
19
|
-
__exportStar(require("./notification/notification"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./notification/notification"), exports);
|
|
20
7
|
/* IMPORT ENTITIES AND RESOLVERS */
|
|
21
8
|
const notification_1 = require("./notification");
|
|
22
9
|
exports.entities = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,sEAA2C;AAE3C,mCAAmC;AACnC,iDAKuB;AAEV,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,uBAAoB;CACxB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,QAAQ,oBACH,uBAAoB,CACxB;IACD,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,wBAAqB;KACzB;IACD,UAAU,oBACL,yBAAsB,CAC1B;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './notification/notification'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport {\n entities as NotificationEntities,\n typeDefs as NotificationTypeDefs,\n resolvers as NotificationResolvers,\n directives as NotificationDirectives\n} from './notification'\n\nexport const entities = [\n /* ENTITIES */\n ...NotificationEntities\n]\n\nexport const schema = {\n typeDefs: {\n ...NotificationTypeDefs\n },\n resolverClasses: [\n /* RESOLVER CLASSES */\n ...NotificationResolvers\n ],\n directives: {\n ...NotificationDirectives\n }\n}\n"]}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.directiveNotification = exports.notificationDirectiveTypeDefs = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
7
5
|
const graphql_1 = require("graphql");
|
|
8
|
-
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
6
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
9
7
|
const utils_1 = require("@graphql-tools/utils");
|
|
10
8
|
const debug = require('debug')('things-factory:notification:directive-notification');
|
|
11
9
|
const DIRECTIVE = 'notification';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive-notification.js","sourceRoot":"","sources":["../../../server/service/notification/directive-notification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"directive-notification.js","sourceRoot":"","sources":["../../../server/service/notification/directive-notification.ts"],"names":[],"mappings":";;;;AAAA,qCAA6D;AAC7D,sEAA6B;AAE7B,gDAA0E;AAE1E,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,oDAAoD,CAAC,CAAA;AAEpF,MAAM,SAAS,GAAG,cAAc,CAAA;AAEnB,QAAA,6BAA6B,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;CAY/C,CAAA;AACM,MAAM,qBAAqB,GAAG,CAAC,MAAqB,EAAE,EAAE,CAC7D,IAAA,iBAAS,EAAC,MAAM,EAAE;IAChB,CAAC,kBAAU,CAAC,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;;QACtE,MAAM,qBAAqB,GAAG,MAAA,IAAA,oBAAY,EAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,0CAAG,CAAC,CAAC,CAAA;QAC/E,IAAI,qBAAqB,EAAE;YACzB,MAAM,EAAE,OAAO,GAAG,8BAAoB,EAAE,IAAI,EAAE,GAAG,WAAW,CAAA;YAE5D,IAAI,CAAC,IAAI,EAAE;gBACT,MAAM,IAAI,KAAK,CAAC,iFAAiF,SAAS,GAAG,CAAC,CAAA;aAC/G;YAED,MAAM,EACJ,SAAS,EACT,KAAK,EACL,OAAO,GAAG,MAAM,EAChB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,IAAI,GAAG,YAAY,EACpB,GAAG,qBAAqB,CAAA;YACzB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;YAE5B,WAAW,CAAC,OAAO,GAAG,KAAK,WAAW,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI;gBAC/D,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;gBAEpE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;gBAE9C,IAAI,CAAC,MAAM,EAAE;oBACX,KAAK,CAAC,gBAAgB,CAAC,CAAA;iBACxB;qBAAM;oBACL,IAAI;wBACF,MAAM,MAAM,CAAC;4BACX,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;4BACpB,qBAAqB;4BACrB,SAAS,EAAE,IAAI,IAAI,EAAE;yBACtB,CAAC,CAAA;qBACH;oBAAC,OAAO,GAAG,EAAE;wBACZ,KAAK,CAAC,GAAG,CAAC,CAAA;qBACX;iBACF;gBAED,OAAO,MAAM,CAAA;YACf,CAAC,CAAA;YAED,OAAO,WAAW,CAAA;SACnB;IACH,CAAC;CACF,CAAC,CAAA;AAhDS,QAAA,qBAAqB,yBAgD9B","sourcesContent":["import { defaultFieldResolver, GraphQLSchema } from 'graphql'\nimport gql from 'graphql-tag'\n\nimport { getDirective, MapperKind, mapSchema } from '@graphql-tools/utils'\n\nconst debug = require('debug')('things-factory:notification:directive-notification')\n\nconst DIRECTIVE = 'notification'\n\nexport const notificationDirectiveTypeDefs = gql`\n directive @notification(\n receivers: String\n topic: String\n subject: String # info\n title: String\n body: String\n image: String\n url: String\n # timestamp = String(Date.now())\n mode: String # background\n ) on FIELD_DEFINITION\n`\nexport const directiveNotification = (schema: GraphQLSchema) =>\n mapSchema(schema, {\n [MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName, typeName, schema) => {\n const notificationDirective = getDirective(schema, fieldConfig, DIRECTIVE)?.[0]\n if (notificationDirective) {\n const { resolve = defaultFieldResolver, args } = fieldConfig\n\n if (!args) {\n throw new Error(`Unexpected Error. args should be defined in @notification directive for field ${fieldName}.`)\n }\n\n const {\n receivers,\n topic,\n subject = 'info',\n title,\n body,\n image,\n url,\n mode = 'background'\n } = notificationDirective\n const timestamp = Date.now()\n\n fieldConfig.resolve = async function (source, args, context, info) {\n const result = await resolve.call(this, source, args, context, info)\n\n const { domain, user, notify } = context.state\n\n if (!notify) {\n debug('notify not set')\n } else {\n try {\n await notify({\n receivers: [user.id],\n notificationDirective,\n timestamp: new Date()\n })\n } catch (err) {\n debug(err)\n }\n }\n\n return result\n }\n\n return fieldConfig\n }\n }\n })\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/notification/index.ts"],"names":[],"mappings":";;;AAAA,mEAA8D;AAC9D,qEAA+F;AAElF,QAAA,QAAQ,GAAG;IACtB,6BAA6B,EAA7B,sDAA6B;CAC9B,CAAA;AACY,QAAA,QAAQ,GAAG,EAAE,CAAA;AACb,QAAA,SAAS,GAAG,CAAC,4CAAoB,CAAC,CAAA;AAClC,QAAA,UAAU,GAAG;IACxB,YAAY,EAAE,8CAAqB;CACpC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/notification/index.ts"],"names":[],"mappings":";;;AAAA,mEAA8D;AAC9D,qEAA+F;AAElF,QAAA,QAAQ,GAAG;IACtB,6BAA6B,EAA7B,sDAA6B;CAC9B,CAAA;AACY,QAAA,QAAQ,GAAG,EAAE,CAAA;AACb,QAAA,SAAS,GAAG,CAAC,4CAAoB,CAAC,CAAA;AAClC,QAAA,UAAU,GAAG;IACxB,YAAY,EAAE,8CAAqB;CACpC,CAAA","sourcesContent":["import { NotificationResolver } from './notification-resolver'\nimport { notificationDirectiveTypeDefs, directiveNotification } from './directive-notification'\n\nexport const typeDefs = {\n notificationDirectiveTypeDefs\n}\nexport const entities = []\nexport const resolvers = [NotificationResolver]\nexport const directives = {\n notification: directiveNotification\n}\n"]}
|
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.NotificationResolver = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_subscriptions_1 = require("graphql-subscriptions");
|
|
16
6
|
const type_graphql_1 = require("type-graphql");
|
|
17
7
|
const shell_1 = require("@things-factory/shell");
|
|
18
|
-
const graphql_subscriptions_1 = require("graphql-subscriptions");
|
|
19
8
|
const notification_1 = require("./notification");
|
|
20
|
-
const debug = require('debug')('things-factory:notification:notification-subscription');
|
|
21
9
|
let NotificationResolver = class NotificationResolver {
|
|
22
10
|
notification(payload, subject) {
|
|
23
11
|
return payload.notification;
|
|
24
12
|
}
|
|
25
13
|
};
|
|
26
|
-
__decorate([
|
|
14
|
+
tslib_1.__decorate([
|
|
27
15
|
(0, type_graphql_1.Subscription)({
|
|
28
16
|
subscribe: (0, graphql_subscriptions_1.withFilter)(() => shell_1.pubsub.asyncIterator('notification'), (payload, variables, context, info) => {
|
|
29
17
|
/* normally, subscription context doesn't have domain */
|
|
@@ -44,13 +32,13 @@ __decorate([
|
|
|
44
32
|
return !subject || subjects.indexOf(subject) !== -1;
|
|
45
33
|
})
|
|
46
34
|
}),
|
|
47
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
48
|
-
__param(1, (0, type_graphql_1.Arg)('subjects', type => [String], { nullable: true })),
|
|
49
|
-
__metadata("design:type", Function),
|
|
50
|
-
__metadata("design:paramtypes", [Object, Array]),
|
|
51
|
-
__metadata("design:returntype", notification_1.Notification)
|
|
35
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
36
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('subjects', type => [String], { nullable: true })),
|
|
37
|
+
tslib_1.__metadata("design:type", Function),
|
|
38
|
+
tslib_1.__metadata("design:paramtypes", [Object, Array]),
|
|
39
|
+
tslib_1.__metadata("design:returntype", notification_1.Notification)
|
|
52
40
|
], NotificationResolver.prototype, "notification", null);
|
|
53
|
-
NotificationResolver = __decorate([
|
|
41
|
+
NotificationResolver = tslib_1.__decorate([
|
|
54
42
|
(0, type_graphql_1.Resolver)()
|
|
55
43
|
], NotificationResolver);
|
|
56
44
|
exports.NotificationResolver = NotificationResolver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-resolver.js","sourceRoot":"","sources":["../../../server/service/notification/notification-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notification-resolver.js","sourceRoot":"","sources":["../../../server/service/notification/notification-resolver.ts"],"names":[],"mappings":";;;;AAAA,iEAAkD;AAClD,+CAAgE;AAEhE,iDAA8C;AAE9C,iDAA6C;AAG7C,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IA6B/B,YAAY,CACF,OAAuC,EACQ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,oBAAoB;IADhC,IAAA,uBAAQ,GAAE;GACE,oBAAoB,CAmChC;AAnCY,oDAAoB","sourcesContent":["import { withFilter } from 'graphql-subscriptions'\nimport { Arg, Resolver, Root, Subscription } from 'type-graphql'\n\nimport { pubsub } from '@things-factory/shell'\n\nimport { Notification } from './notification'\n\n@Resolver()\nexport class NotificationResolver {\n @Subscription({\n subscribe: withFilter(\n () => pubsub.asyncIterator('notification'),\n (payload, variables, context, info) => {\n /* normally, subscription context doesn't have domain */\n const { domain, user } = context.state\n\n const { subjects = [] } = variables\n const {\n notification: { subject, domain: pdomain }\n } = payload\n\n const subdomain = pdomain?.subdomain\n\n if (subdomain) {\n if (domain?.subdomain) {\n if (subdomain !== domain.subdomain) {\n return false\n }\n } else if (!user.domains.find(d => d.subdomain === subdomain)) {\n return false\n }\n }\n\n return !subject || subjects.indexOf(subject) !== -1\n }\n )\n })\n notification(\n @Root() payload: { notification: Notification },\n @Arg('subjects', type => [String], { nullable: true }) subject: string[]\n ): Notification {\n return payload.notification\n }\n}\n"]}
|
|
@@ -1,57 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var _a;
|
|
12
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
3
|
exports.Notification = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
14
5
|
const type_graphql_1 = require("type-graphql");
|
|
15
6
|
const shell_1 = require("@things-factory/shell");
|
|
16
7
|
let Notification = class Notification {
|
|
17
8
|
};
|
|
18
|
-
__decorate([
|
|
9
|
+
tslib_1.__decorate([
|
|
19
10
|
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true }),
|
|
20
|
-
__metadata("design:type",
|
|
11
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
21
12
|
], Notification.prototype, "domain", void 0);
|
|
22
|
-
__decorate([
|
|
13
|
+
tslib_1.__decorate([
|
|
23
14
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
24
|
-
__metadata("design:type", String)
|
|
15
|
+
tslib_1.__metadata("design:type", String)
|
|
25
16
|
], Notification.prototype, "subject", void 0);
|
|
26
|
-
__decorate([
|
|
17
|
+
tslib_1.__decorate([
|
|
27
18
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
28
|
-
__metadata("design:type", String)
|
|
19
|
+
tslib_1.__metadata("design:type", String)
|
|
29
20
|
], Notification.prototype, "type", void 0);
|
|
30
|
-
__decorate([
|
|
21
|
+
tslib_1.__decorate([
|
|
31
22
|
(0, type_graphql_1.Field)(),
|
|
32
|
-
__metadata("design:type", String)
|
|
23
|
+
tslib_1.__metadata("design:type", String)
|
|
33
24
|
], Notification.prototype, "title", void 0);
|
|
34
|
-
__decorate([
|
|
25
|
+
tslib_1.__decorate([
|
|
35
26
|
(0, type_graphql_1.Field)(),
|
|
36
|
-
__metadata("design:type", String)
|
|
27
|
+
tslib_1.__metadata("design:type", String)
|
|
37
28
|
], Notification.prototype, "body", void 0);
|
|
38
|
-
__decorate([
|
|
29
|
+
tslib_1.__decorate([
|
|
39
30
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
40
|
-
__metadata("design:type", String)
|
|
31
|
+
tslib_1.__metadata("design:type", String)
|
|
41
32
|
], Notification.prototype, "url", void 0);
|
|
42
|
-
__decorate([
|
|
33
|
+
tslib_1.__decorate([
|
|
43
34
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
44
|
-
__metadata("design:type", String)
|
|
35
|
+
tslib_1.__metadata("design:type", String)
|
|
45
36
|
], Notification.prototype, "image", void 0);
|
|
46
|
-
__decorate([
|
|
37
|
+
tslib_1.__decorate([
|
|
47
38
|
(0, type_graphql_1.Field)(type => shell_1.ScalarAny, { nullable: true }),
|
|
48
|
-
__metadata("design:type", Object)
|
|
39
|
+
tslib_1.__metadata("design:type", Object)
|
|
49
40
|
], Notification.prototype, "property", void 0);
|
|
50
|
-
__decorate([
|
|
41
|
+
tslib_1.__decorate([
|
|
51
42
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
52
|
-
__metadata("design:type", Date)
|
|
43
|
+
tslib_1.__metadata("design:type", Date)
|
|
53
44
|
], Notification.prototype, "timestamp", void 0);
|
|
54
|
-
Notification = __decorate([
|
|
45
|
+
Notification = tslib_1.__decorate([
|
|
55
46
|
(0, type_graphql_1.ObjectType)()
|
|
56
47
|
], Notification);
|
|
57
48
|
exports.Notification = Notification;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../server/service/notification/notification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../server/service/notification/notification.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAChD,iDAAyD;AAGzD,IAAa,YAAY,GAAzB,MAAa,YAAY;CA2BxB,CAAA;AAzBC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjC,cAAM;4CAAA;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACb;AAGb;IADC,IAAA,oBAAK,GAAE;;2CACK;AAGb;IADC,IAAA,oBAAK,GAAE;;0CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACf;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAGb;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAChC;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACf,IAAI;+CAAA;AA1BJ,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CA2BxB;AA3BY,oCAAY","sourcesContent":["import { ObjectType, Field } from 'type-graphql'\nimport { Domain, ScalarAny } from '@things-factory/shell'\n\n@ObjectType()\nexport class Notification {\n @Field(type => Domain, { nullable: true })\n domain?: Domain\n\n @Field({ nullable: true })\n subject?: string\n\n @Field({ nullable: true })\n type?: string\n\n @Field()\n title: string\n\n @Field()\n body: string\n\n @Field({ nullable: true })\n url: string\n\n @Field({ nullable: true })\n image: string\n\n @Field(type => ScalarAny, { nullable: true })\n property: any\n\n @Field({ nullable: true })\n timestamp: Date\n}\n"]}
|