@things-factory/notification 6.1.46 → 6.1.48

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.
Files changed (45) hide show
  1. package/dist-client/pages/noti-box/noti-box-list-page.d.ts +49 -0
  2. package/dist-client/pages/noti-box/noti-box-list-page.js +262 -0
  3. package/dist-client/pages/noti-box/noti-box-list-page.js.map +1 -0
  4. package/dist-client/pages/noti-rule/noti-rule-importer.d.ts +22 -0
  5. package/dist-client/pages/noti-rule/noti-rule-importer.js +100 -0
  6. package/dist-client/pages/noti-rule/noti-rule-importer.js.map +1 -0
  7. package/dist-client/pages/noti-rule/noti-rule-list-page.d.ts +62 -0
  8. package/dist-client/pages/noti-rule/noti-rule-list-page.js +380 -0
  9. package/dist-client/pages/noti-rule/noti-rule-list-page.js.map +1 -0
  10. package/dist-server/service/noti-box/index.js +9 -0
  11. package/dist-server/service/noti-box/index.js.map +1 -0
  12. package/dist-server/service/noti-box/noti-box-mutation.js +110 -0
  13. package/dist-server/service/noti-box/noti-box-mutation.js.map +1 -0
  14. package/dist-server/service/noti-box/noti-box-query.js +109 -0
  15. package/dist-server/service/noti-box/noti-box-query.js.map +1 -0
  16. package/dist-server/service/noti-box/noti-box-type.js +69 -0
  17. package/dist-server/service/noti-box/noti-box-type.js.map +1 -0
  18. package/dist-server/service/noti-box/noti-box.js +107 -0
  19. package/dist-server/service/noti-box/noti-box.js.map +1 -0
  20. package/dist-server/service/noti-rule/event-subscriber.js +21 -0
  21. package/dist-server/service/noti-rule/event-subscriber.js.map +1 -0
  22. package/dist-server/service/noti-rule/index.js +12 -0
  23. package/dist-server/service/noti-rule/index.js.map +1 -0
  24. package/dist-server/service/noti-rule/noti-rule-history.js +139 -0
  25. package/dist-server/service/noti-rule/noti-rule-history.js.map +1 -0
  26. package/dist-server/service/noti-rule/noti-rule-mutation.js +168 -0
  27. package/dist-server/service/noti-rule/noti-rule-mutation.js.map +1 -0
  28. package/dist-server/service/noti-rule/noti-rule-query.js +97 -0
  29. package/dist-server/service/noti-rule/noti-rule-query.js.map +1 -0
  30. package/dist-server/service/noti-rule/noti-rule-type.js +102 -0
  31. package/dist-server/service/noti-rule/noti-rule-type.js.map +1 -0
  32. package/dist-server/service/noti-rule/noti-rule.js +146 -0
  33. package/dist-server/service/noti-rule/noti-rule.js.map +1 -0
  34. package/dist-server/service/notification-old/directive-notification.js +59 -0
  35. package/dist-server/service/notification-old/directive-notification.js.map +1 -0
  36. package/dist-server/service/notification-old/index.js +14 -0
  37. package/dist-server/service/notification-old/index.js.map +1 -0
  38. package/dist-server/service/notification-old/notification-resolver.js +45 -0
  39. package/dist-server/service/notification-old/notification-resolver.js.map +1 -0
  40. package/dist-server/service/notification-old/notification.js +49 -0
  41. package/dist-server/service/notification-old/notification.js.map +1 -0
  42. package/dist-server/tsconfig.tsbuildinfo +1 -1
  43. package/package.json +8 -8
  44. package/dist-server/migrations/index.js +0 -12
  45. package/dist-server/migrations/index.js.map +0 -1
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.directives = exports.resolvers = exports.entities = exports.typeDefs = void 0;
4
+ const notification_resolver_1 = require("./notification-resolver");
5
+ const directive_notification_1 = require("./directive-notification");
6
+ exports.typeDefs = {
7
+ notificationDirectiveTypeDefs: directive_notification_1.notificationDirectiveTypeDefs
8
+ };
9
+ exports.entities = [];
10
+ exports.resolvers = [notification_resolver_1.NotificationResolver];
11
+ exports.directives = {
12
+ notification: directive_notification_1.directiveNotification
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/notification-old/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"]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationResolver = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const graphql_subscriptions_1 = require("graphql-subscriptions");
6
+ const type_graphql_1 = require("type-graphql");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const notification_1 = require("./notification");
9
+ let NotificationResolver = class NotificationResolver {
10
+ notification(payload, subject) {
11
+ return payload.notification;
12
+ }
13
+ };
14
+ tslib_1.__decorate([
15
+ (0, type_graphql_1.Subscription)({
16
+ subscribe: (0, graphql_subscriptions_1.withFilter)(() => shell_1.pubsub.asyncIterator('notification'), (payload, variables, context, info) => {
17
+ /* normally, subscription context doesn't have domain */
18
+ const { domain, user } = context.state;
19
+ const { subjects = [] } = variables;
20
+ const { notification: { subject, domain: pdomain } } = payload;
21
+ const subdomain = pdomain === null || pdomain === void 0 ? void 0 : pdomain.subdomain;
22
+ if (subdomain) {
23
+ if (domain === null || domain === void 0 ? void 0 : domain.subdomain) {
24
+ if (subdomain !== domain.subdomain) {
25
+ return false;
26
+ }
27
+ }
28
+ else if (!user.domains.find(d => d.subdomain === subdomain)) {
29
+ return false;
30
+ }
31
+ }
32
+ return !subject || subjects.indexOf(subject) !== -1;
33
+ })
34
+ }),
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)
40
+ ], NotificationResolver.prototype, "notification", null);
41
+ NotificationResolver = tslib_1.__decorate([
42
+ (0, type_graphql_1.Resolver)()
43
+ ], NotificationResolver);
44
+ exports.NotificationResolver = NotificationResolver;
45
+ //# sourceMappingURL=notification-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-resolver.js","sourceRoot":"","sources":["../../../server/service/notification-old/notification-resolver.ts"],"names":[],"mappings":";;;;AAAA,iEAAkD;AAClD,+CAAgE;AAEhE,iDAA8C;AAE9C,iDAA6C;AAGtC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IA6B/B,YAAY,CACF,OAAuC,EACQ,OAAiB;QAExE,OAAO,OAAO,CAAC,YAAY,CAAA;IAC7B,CAAC;CACF,CAAA;AAlCC;IAAC,IAAA,2BAAY,EAAC;QACZ,SAAS,EAAE,IAAA,kCAAU,EACnB,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,CAAC;IAEC,mBAAA,IAAA,mBAAI,GAAE,CAAA;IACN,mBAAA,IAAA,kBAAG,EAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;;;4CACrD,2BAAY;wDAEd;AAlCU,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"]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Notification = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ let Notification = class Notification {
8
+ };
9
+ tslib_1.__decorate([
10
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true }),
11
+ tslib_1.__metadata("design:type", shell_1.Domain)
12
+ ], Notification.prototype, "domain", void 0);
13
+ tslib_1.__decorate([
14
+ (0, type_graphql_1.Field)({ nullable: true }),
15
+ tslib_1.__metadata("design:type", String)
16
+ ], Notification.prototype, "subject", void 0);
17
+ tslib_1.__decorate([
18
+ (0, type_graphql_1.Field)({ nullable: true }),
19
+ tslib_1.__metadata("design:type", String)
20
+ ], Notification.prototype, "type", void 0);
21
+ tslib_1.__decorate([
22
+ (0, type_graphql_1.Field)(),
23
+ tslib_1.__metadata("design:type", String)
24
+ ], Notification.prototype, "title", void 0);
25
+ tslib_1.__decorate([
26
+ (0, type_graphql_1.Field)(),
27
+ tslib_1.__metadata("design:type", String)
28
+ ], Notification.prototype, "body", void 0);
29
+ tslib_1.__decorate([
30
+ (0, type_graphql_1.Field)({ nullable: true }),
31
+ tslib_1.__metadata("design:type", String)
32
+ ], Notification.prototype, "url", void 0);
33
+ tslib_1.__decorate([
34
+ (0, type_graphql_1.Field)({ nullable: true }),
35
+ tslib_1.__metadata("design:type", String)
36
+ ], Notification.prototype, "image", void 0);
37
+ tslib_1.__decorate([
38
+ (0, type_graphql_1.Field)(type => shell_1.ScalarAny, { nullable: true }),
39
+ tslib_1.__metadata("design:type", Object)
40
+ ], Notification.prototype, "property", void 0);
41
+ tslib_1.__decorate([
42
+ (0, type_graphql_1.Field)(type => shell_1.ScalarDate, { nullable: true }),
43
+ tslib_1.__metadata("design:type", Date)
44
+ ], Notification.prototype, "timestamp", void 0);
45
+ Notification = tslib_1.__decorate([
46
+ (0, type_graphql_1.ObjectType)()
47
+ ], Notification);
48
+ exports.Notification = Notification;
49
+ //# sourceMappingURL=notification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../server/service/notification-old/notification.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAChD,iDAAqE;AAG9D,IAAM,YAAY,GAAlB,MAAM,YAAY;CA2BxB,CAAA;AA1BC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjC,cAAM;4CAAA;AAEf;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACb;AAEb;IAAC,IAAA,oBAAK,GAAE;;2CACK;AAEb;IAAC,IAAA,oBAAK,GAAE;;0CACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACf;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAChC;AAEb;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACnC,IAAI;+CAAA;AA1BJ,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CA2BxB;AA3BY,oCAAY","sourcesContent":["import { ObjectType, Field } from 'type-graphql'\nimport { Domain, ScalarAny, ScalarDate } 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(type => ScalarDate, { nullable: true })\n timestamp: Date\n}\n"]}