@resolveio/server-lib 5.2.5 → 5.2.6-newrole

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.
@@ -22,13 +22,6 @@ var schema = {
22
22
  type: Date,
23
23
  optional: true
24
24
  },
25
- readonly: {
26
- type: Boolean,
27
- optional: true
28
- },
29
- active: {
30
- type: Boolean
31
- },
32
25
  attempts: {
33
26
  type: Number,
34
27
  optional: true
@@ -65,53 +58,67 @@ var schema = {
65
58
  type: String
66
59
  },
67
60
  roles: {
61
+ type: Object
62
+ },
63
+ 'roles.super_admin': {
64
+ type: Boolean
65
+ },
66
+ 'roles.approvals': {
68
67
  type: Array
69
68
  },
70
- 'roles.$': {
69
+ 'roles.approvals.$': {
70
+ type: Object
71
+ },
72
+ 'roles.approvals.$.name': {
71
73
  type: String
72
74
  },
73
- phonenumber: {
74
- type: String,
75
- optional: true
75
+ 'roles.approvals.$.type': {
76
+ type: String
76
77
  },
77
- other: {
78
- type: Object,
79
- blackbox: true,
80
- optional: true
78
+ 'roles.approvals.$.accounting_code': {
79
+ type: String
81
80
  },
82
- assets: {
83
- type: Array,
84
- optional: true
81
+ 'roles.groups': {
82
+ type: Array
85
83
  },
86
- 'assets.$': {
84
+ 'roles.groups.$': {
87
85
  type: Object
88
86
  },
89
- 'assets.$.type': {
87
+ 'roles.groups.$.name': {
90
88
  type: String
91
89
  },
92
- 'assets.$.id_asset': {
93
- type: String
90
+ 'roles.groups.$.views': {
91
+ type: Array
94
92
  },
95
- 'assets.$.asset_number': {
93
+ 'roles.groups.$.views.$': {
96
94
  type: String
97
95
  },
98
- 'assets.$.ownership': {
99
- type: String
96
+ 'roles.groups.$.yard': {
97
+ type: String,
98
+ optional: true
99
+ },
100
+ 'roles.notifications': {
101
+ type: Array
100
102
  },
101
- 'assets.$.ownership_driver': {
103
+ 'roles.notifications.$': {
102
104
  type: String
103
105
  },
104
- 'assets.$.date_start': {
105
- type: Date
106
+ 'roles.miscs': {
107
+ type: Array
106
108
  },
107
- 'assets.$.date_end': {
108
- type: Date,
109
- optional: true
109
+ 'roles.miscs.$': {
110
+ type: String
110
111
  },
111
- id_function: {
112
+ active: Boolean,
113
+ phonenumber: {
112
114
  type: String,
113
115
  optional: true
114
116
  },
117
+ other: {
118
+ type: Object,
119
+ optional: true,
120
+ blackbox: true
121
+ },
115
122
  customers: {
116
123
  type: Array,
117
124
  optional: true,
package/fixtures/init.js CHANGED
@@ -37,8 +37,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  var app_version_collection_1 = require("../collections/app-version.collection");
39
39
  var logged_in_users_collection_1 = require("../collections/logged-in-users.collection");
40
- var active_subscription_collection_1 = require("../collections/active-subscription.collection");
41
40
  var mongoose_1 = require("mongoose");
41
+ var active_subscription_collection_1 = require("../collections/active-subscription.collection");
42
42
  function loadServerInit() {
43
43
  return __awaiter(this, void 0, void 0, function () {
44
44
  var appVersion;
@@ -588,12 +588,12 @@ var SubscriptionManager = /** @class */ (function () {
588
588
  if (!(i >= 0)) return [3 /*break*/, 10];
589
589
  oplog = uniqueOplog_1[i];
590
590
  _loop_4 = function (j) {
591
- var _a, sub, _b;
592
- return __generator(this, function (_c) {
593
- switch (_c.label) {
591
+ var _a, sub;
592
+ return __generator(this, function (_b) {
593
+ switch (_b.label) {
594
594
  case 0:
595
595
  sub = that._subscriptions[j];
596
- if (!sub.collections.includes(oplog.collection)) return [3 /*break*/, 17];
596
+ if (!sub.collections.includes(oplog.collection)) return [3 /*break*/, 16];
597
597
  if (!sub.preSubscriptionData) return [3 /*break*/, 5];
598
598
  if (!that._publications[sub.publication].fetchFunction(oplog.doc, sub.preSubscriptionData)) return [3 /*break*/, 5];
599
599
  if (!!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) return [3 /*break*/, 4];
@@ -606,21 +606,21 @@ var SubscriptionManager = /** @class */ (function () {
606
606
  ]
607
607
  }).exec()];
608
608
  case 1:
609
- _c.sent();
609
+ _b.sent();
610
610
  return [3 /*break*/, 3];
611
611
  case 2:
612
612
  sub['oplog'] = oplog;
613
613
  uniquePubs.push(sub);
614
- _c.label = 3;
614
+ _b.label = 3;
615
615
  case 3:
616
616
  if (this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
617
617
  this_1._nodeCache.del(this_1._subCache.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })[0].id);
618
618
  this_1._subCache.splice(this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
619
619
  }
620
- _c.label = 4;
620
+ _b.label = 4;
621
621
  case 4: return [2 /*return*/, "continue"];
622
622
  case 5:
623
- if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 10];
623
+ if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 9];
624
624
  if (!!sub.clients.length) return [3 /*break*/, 7];
625
625
  that._subscriptions.splice(j, 1);
626
626
  return [4 /*yield*/, active_subscription_collection_1.ActiveSubscriptions.deleteOne({
@@ -630,30 +630,24 @@ var SubscriptionManager = /** @class */ (function () {
630
630
  ]
631
631
  }).exec()];
632
632
  case 6:
633
- _c.sent();
633
+ _b.sent();
634
634
  if (this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
635
635
  this_1._nodeCache.del(this_1._subCache.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })[0].id);
636
636
  this_1._subCache.splice(this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
637
637
  }
638
- return [3 /*break*/, 9];
638
+ return [3 /*break*/, 8];
639
639
  case 7:
640
- _b = sub;
641
- return [4 /*yield*/, that._publications[sub.publication].preFunction(sub.subscriptionData)];
642
- case 8:
643
- _b.preSubscriptionData = _c.sent();
644
- if (that._publications[sub.publication].fetchFunction(oplog.doc, sub.preSubscriptionData)) {
645
- if (!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) {
646
- sub['oplog'] = oplog;
647
- uniquePubs.push(sub);
648
- }
640
+ if (!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) {
641
+ sub['oplog'] = oplog;
642
+ uniquePubs.push(sub);
649
643
  }
650
- _c.label = 9;
651
- case 9: return [3 /*break*/, 17];
652
- case 10:
653
- if (!that._publications[sub.publication].fetchFunction) return [3 /*break*/, 14];
654
- if (!(_a = that._publications[sub.publication]).fetchFunction.apply(_a, [oplog.doc].concat(sub.subscriptionData))) return [3 /*break*/, 13];
655
- if (!!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) return [3 /*break*/, 13];
656
- if (!!sub.clients.length) return [3 /*break*/, 12];
644
+ _b.label = 8;
645
+ case 8: return [3 /*break*/, 16];
646
+ case 9:
647
+ if (!that._publications[sub.publication].fetchFunction) return [3 /*break*/, 13];
648
+ if (!(_a = that._publications[sub.publication]).fetchFunction.apply(_a, [oplog.doc].concat(sub.subscriptionData))) return [3 /*break*/, 12];
649
+ if (!!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) return [3 /*break*/, 12];
650
+ if (!!sub.clients.length) return [3 /*break*/, 11];
657
651
  that._subscriptions.splice(j, 1);
658
652
  return [4 /*yield*/, active_subscription_collection_1.ActiveSubscriptions.deleteOne({
659
653
  $and: [
@@ -661,21 +655,21 @@ var SubscriptionManager = /** @class */ (function () {
661
655
  { subData: JSON.stringify(sub.subscriptionData) }
662
656
  ]
663
657
  }).exec()];
664
- case 11:
665
- _c.sent();
658
+ case 10:
659
+ _b.sent();
666
660
  if (this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
667
661
  this_1._nodeCache.del(this_1._subCache.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })[0].id);
668
662
  this_1._subCache.splice(this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
669
663
  }
670
- return [3 /*break*/, 13];
671
- case 12:
664
+ return [3 /*break*/, 12];
665
+ case 11:
672
666
  sub['oplog'] = oplog;
673
667
  uniquePubs.push(sub);
674
- _c.label = 13;
675
- case 13: return [3 /*break*/, 17];
676
- case 14:
677
- if (!!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) return [3 /*break*/, 17];
678
- if (!!sub.clients.length) return [3 /*break*/, 16];
668
+ _b.label = 12;
669
+ case 12: return [3 /*break*/, 16];
670
+ case 13:
671
+ if (!!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) return [3 /*break*/, 16];
672
+ if (!!sub.clients.length) return [3 /*break*/, 15];
679
673
  that._subscriptions.splice(j, 1);
680
674
  return [4 /*yield*/, active_subscription_collection_1.ActiveSubscriptions.deleteOne({
681
675
  $and: [
@@ -683,18 +677,18 @@ var SubscriptionManager = /** @class */ (function () {
683
677
  { subData: JSON.stringify(sub.subscriptionData) }
684
678
  ]
685
679
  }).exec()];
686
- case 15:
687
- _c.sent();
680
+ case 14:
681
+ _b.sent();
688
682
  if (this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
689
683
  this_1._nodeCache.del(this_1._subCache.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })[0].id);
690
684
  this_1._subCache.splice(this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
691
685
  }
692
- return [3 /*break*/, 17];
693
- case 16:
686
+ return [3 /*break*/, 16];
687
+ case 15:
694
688
  sub['oplog'] = oplog;
695
689
  uniquePubs.push(sub);
696
- _c.label = 17;
697
- case 17: return [2 /*return*/];
690
+ _b.label = 16;
691
+ case 16: return [2 /*return*/];
698
692
  }
699
693
  });
700
694
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "5.2.5",
3
+ "version": "5.2.6-newrole",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {