@things-factory/notification 4.0.17 → 4.0.22
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/dist-server/entities/index.js +5 -0
- package/dist-server/entities/index.js.map +1 -0
- package/dist-server/graphql/index.js +30 -0
- package/dist-server/graphql/index.js.map +1 -0
- package/dist-server/graphql/resolvers/index.js +14 -0
- package/dist-server/graphql/resolvers/index.js.map +1 -0
- package/dist-server/graphql/resolvers/notification/directive-notification.js +26 -0
- package/dist-server/graphql/resolvers/notification/directive-notification.js.map +1 -0
- package/dist-server/graphql/resolvers/notification/index.js +10 -0
- package/dist-server/graphql/resolvers/notification/index.js.map +1 -0
- package/dist-server/graphql/resolvers/notification/subscribe-notification.js +30 -0
- package/dist-server/graphql/resolvers/notification/subscribe-notification.js.map +1 -0
- package/dist-server/graphql/types/index.js +14 -0
- package/dist-server/graphql/types/index.js.map +1 -0
- package/dist-server/graphql/types/notification/index.js +25 -0
- package/dist-server/graphql/types/notification/index.js.map +1 -0
- package/dist-server/graphql/types/notification/notification.js +21 -0
- package/dist-server/graphql/types/notification/notification.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/entities/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.schema = void 0;
|
|
23
|
+
const utils_1 = require("@things-factory/utils");
|
|
24
|
+
const resolvers = __importStar(require("./resolvers"));
|
|
25
|
+
const typeDefs = __importStar(require("./types"));
|
|
26
|
+
exports.schema = {
|
|
27
|
+
typeDefs,
|
|
28
|
+
resolvers: utils_1.deepMerge.apply(null, Object.values(resolvers))
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/graphql/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAiD;AAEjD,uDAAwC;AACxC,kDAAmC;AAEtB,QAAA,MAAM,GAAG;IACpB,QAAQ;IACR,SAAS,EAAE,iBAAS,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;CAC3D,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./notification"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/graphql/resolvers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.directiveNotification = void 0;
|
|
4
|
+
const debug = require('debug')('things-factory:notification:directive-notification');
|
|
5
|
+
exports.directiveNotification = {
|
|
6
|
+
async notification(next, root, args, context, info) {
|
|
7
|
+
var result = await next();
|
|
8
|
+
const { user, notify } = context.state;
|
|
9
|
+
if (!notify) {
|
|
10
|
+
debug('notify not set');
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
try {
|
|
14
|
+
await notify({
|
|
15
|
+
receivers: [user.id],
|
|
16
|
+
args
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
debug(err);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=directive-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directive-notification.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/notification/directive-notification.ts"],"names":[],"mappings":";;;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,oDAAoD,CAAC,CAAA;AAEvE,QAAA,qBAAqB,GAAG;IACnC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI;QAChD,IAAI,MAAM,GAAG,MAAM,IAAI,EAAE,CAAA;QAEzB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEtC,IAAI,CAAC,MAAM,EAAE;YACX,KAAK,CAAC,gBAAgB,CAAC,CAAA;SACxB;aAAM;YACL,IAAI;gBACF,MAAM,MAAM,CAAC;oBACX,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpB,IAAI;iBACL,CAAC,CAAA;aACH;YAAC,OAAO,GAAG,EAAE;gBACZ,KAAK,CAAC,GAAG,CAAC,CAAA;aACX;SACF;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationResolver = void 0;
|
|
4
|
+
const subscribe_notification_1 = require("./subscribe-notification");
|
|
5
|
+
const directive_notification_1 = require("./directive-notification");
|
|
6
|
+
exports.NotificationResolver = {
|
|
7
|
+
Subscription: Object.assign({}, subscribe_notification_1.subscribeNotification),
|
|
8
|
+
Directive: Object.assign({}, directive_notification_1.directiveNotification)
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/notification/index.ts"],"names":[],"mappings":";;;AAAA,qEAAgE;AAChE,qEAAgE;AAEnD,QAAA,oBAAoB,GAAG;IAClC,YAAY,oBACP,8CAAqB,CACzB;IAED,SAAS,oBACJ,8CAAqB,CACzB;CACF,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subscribeNotification = void 0;
|
|
4
|
+
const shell_1 = require("@things-factory/shell");
|
|
5
|
+
require("@things-factory/auth-base");
|
|
6
|
+
const graphql_subscriptions_1 = require("graphql-subscriptions");
|
|
7
|
+
const debug = require('debug')('things-factory:notification:subscribe-notification');
|
|
8
|
+
exports.subscribeNotification = {
|
|
9
|
+
notification: {
|
|
10
|
+
subscribe: graphql_subscriptions_1.withFilter(() => shell_1.pubsub.asyncIterator('notification'), (payload, variables, context, info) => {
|
|
11
|
+
/* normally, subscription context doesn't have domain */
|
|
12
|
+
const { domain, user } = context.state;
|
|
13
|
+
const { subjects = [] } = variables;
|
|
14
|
+
const { notification: { subject, domain: pdomain } } = payload;
|
|
15
|
+
const subdomain = pdomain === null || pdomain === void 0 ? void 0 : pdomain.subdomain;
|
|
16
|
+
if (subdomain) {
|
|
17
|
+
if (domain === null || domain === void 0 ? void 0 : domain.subdomain) {
|
|
18
|
+
if (subdomain !== domain.subdomain) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else if (!user.domains.find(d => d.subdomain === subdomain)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return !subject || subjects.indexOf(subject) !== -1;
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=subscribe-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-notification.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/notification/subscribe-notification.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAC9C,qCAAkC;AAClC,iEAAkD;AAElD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,oDAAoD,CAAC,CAAA;AAEvE,QAAA,qBAAqB,GAAG;IACnC,YAAY,EAAE;QACZ,SAAS,EAAE,kCAAU,CACnB,GAAG,EAAE,CAAC,cAAM,CAAC,aAAa,CAAC,cAAc,CAAC,EAC1C,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YACpC,wDAAwD;YACxD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;YAEtC,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,SAAS,CAAA;YACnC,MAAM,EACJ,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAC3C,GAAG,OAAO,CAAA;YAEX,MAAM,SAAS,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAA;YAEpC,IAAI,SAAS,EAAE;gBACb,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,EAAE;oBACrB,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,EAAE;wBAClC,OAAO,KAAK,CAAA;qBACb;iBACF;qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,EAAE;oBAC7D,OAAO,KAAK,CAAA;iBACb;aACF;YAED,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;QACrD,CAAC,CACF;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./notification"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/graphql/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.NotificationResolver = void 0;
|
|
17
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
18
|
+
__exportStar(require("./notification"), exports);
|
|
19
|
+
exports.NotificationResolver = graphql_tag_1.default `
|
|
20
|
+
extend type Subscription {
|
|
21
|
+
notification(subjects: [String]): Notification
|
|
22
|
+
}
|
|
23
|
+
directive @notification on FIELD_DEFINITION
|
|
24
|
+
`;
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/notification/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA6B;AAE7B,iDAA8B;AAEjB,QAAA,oBAAoB,GAAG,qBAAG,CAAA;;;;;CAKtC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Notification = void 0;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
exports.Notification = graphql_tag_1.default `
|
|
9
|
+
type Notification {
|
|
10
|
+
domain: Domain!
|
|
11
|
+
subject: String
|
|
12
|
+
type: String
|
|
13
|
+
title: String!
|
|
14
|
+
body: String!
|
|
15
|
+
url: String
|
|
16
|
+
image: String
|
|
17
|
+
property: Object
|
|
18
|
+
timestamp: String
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
//# sourceMappingURL=notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../../server/graphql/types/notification/notification.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,YAAY,GAAG,qBAAG,CAAA;;;;;;;;;;;;CAY9B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/notification",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.22",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"@material/mwc-button": "^0.25.3",
|
|
28
28
|
"@material/mwc-formfield": "^0.25.3",
|
|
29
29
|
"@material/mwc-switch": "^0.25.3",
|
|
30
|
-
"@things-factory/auth-base": "^4.0.
|
|
31
|
-
"@things-factory/i18n-base": "^4.0.
|
|
32
|
-
"@things-factory/layout-base": "^4.0.
|
|
33
|
-
"@things-factory/setting-base": "^4.0.
|
|
34
|
-
"@things-factory/shell": "^4.0.
|
|
30
|
+
"@things-factory/auth-base": "^4.0.22",
|
|
31
|
+
"@things-factory/i18n-base": "^4.0.22",
|
|
32
|
+
"@things-factory/layout-base": "^4.0.22",
|
|
33
|
+
"@things-factory/setting-base": "^4.0.22",
|
|
34
|
+
"@things-factory/shell": "^4.0.22",
|
|
35
35
|
"clipboard": "^2.0.6",
|
|
36
36
|
"firebase": "^8.0.1",
|
|
37
37
|
"firebase-admin": "^9.4.1"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "8267638c3bd77dfc8fa9629b490d681c6854e423"
|
|
40
40
|
}
|