@resolveio/server-lib 5.1.5 → 5.1.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;
@@ -675,19 +675,24 @@ var SubscriptionManager = /** @class */ (function () {
675
675
  };
676
676
  SubscriptionManager.prototype.resendPubsForDelete = function (collection) {
677
677
  return __awaiter(this, void 0, void 0, function () {
678
- var that, jj, subCopy, _loop_5, zz;
678
+ var that, subCopy, _loop_5, this_1, jj, _loop_6, zz;
679
+ var _this = this;
679
680
  return __generator(this, function (_a) {
680
681
  switch (_a.label) {
681
682
  case 0:
682
683
  that = this;
683
- for (jj = this._subCache.length - 1; jj >= 0; jj--) {
684
- if (this._subCache[jj].collection === collection) {
685
- this._nodeCache.del(this._subCache[jj].id);
686
- this._subCache.splice(jj, 1);
684
+ subCopy = common_1.deepCopy(that._subscriptions.filter(function (a) { return a.collections.includes(collection); }));
685
+ _loop_5 = function (jj) {
686
+ if (this_1._subCache[jj].collection === collection || subCopy.some(function (a) { return a.publication === _this._subCache[jj].publication; })) {
687
+ this_1._nodeCache.del(this_1._subCache[jj].id);
688
+ this_1._subCache.splice(jj, 1);
687
689
  }
690
+ };
691
+ this_1 = this;
692
+ for (jj = this._subCache.length - 1; jj >= 0; jj--) {
693
+ _loop_5(jj);
688
694
  }
689
- subCopy = common_1.deepCopy(that._subscriptions.filter(function (a) { return a.collections.includes(collection); }));
690
- _loop_5 = function (zz) {
695
+ _loop_6 = function (zz) {
691
696
  var sub;
692
697
  return __generator(this, function (_a) {
693
698
  switch (_a.label) {
@@ -742,7 +747,7 @@ var SubscriptionManager = /** @class */ (function () {
742
747
  _a.label = 1;
743
748
  case 1:
744
749
  if (!(zz >= 0)) return [3 /*break*/, 4];
745
- return [5 /*yield**/, _loop_5(zz)];
750
+ return [5 /*yield**/, _loop_6(zz)];
746
751
  case 2:
747
752
  _a.sent();
748
753
  _a.label = 3;
@@ -759,13 +764,13 @@ var SubscriptionManager = /** @class */ (function () {
759
764
  // Check to see if any pubs need to refetch due to Mongo operation
760
765
  SubscriptionManager.prototype.checkPubsForChanges = function (collection, document, type) {
761
766
  return __awaiter(this, void 0, void 0, function () {
762
- var that, subCopy, _loop_6, this_1, i;
767
+ var that, subCopy, _loop_7, this_2, i;
763
768
  return __generator(this, function (_a) {
764
769
  switch (_a.label) {
765
770
  case 0:
766
771
  that = this;
767
772
  subCopy = common_1.deepCopy(that._subscriptions.filter(function (a) { return a.collections.includes(collection); }));
768
- _loop_6 = function (i) {
773
+ _loop_7 = function (i) {
769
774
  var _a, _b, sub, removed, _c, _d, removed, removed, removed;
770
775
  return __generator(this, function (_e) {
771
776
  switch (_e.label) {
@@ -774,7 +779,7 @@ var SubscriptionManager = /** @class */ (function () {
774
779
  if (!sub.preSubscriptionData) return [3 /*break*/, 3];
775
780
  if (!that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) return [3 /*break*/, 3];
776
781
  removed = false;
777
- if (this_1._subCache.some(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })) {
782
+ if (this_2._subCache.some(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })) {
778
783
  if (!sub.clients.length) {
779
784
  if (that._subscriptions.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })) {
780
785
  that._subscriptions.splice(that._subscriptions.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
@@ -787,9 +792,9 @@ var SubscriptionManager = /** @class */ (function () {
787
792
  }).exec();
788
793
  removed = true;
789
794
  }
790
- 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);
791
- if (this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
792
- this_1._subCache.splice(this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
795
+ this_2._nodeCache.del(this_2._subCache.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })[0].id);
796
+ if (this_2._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
797
+ this_2._subCache.splice(this_2._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
793
798
  }
794
799
  }
795
800
  if (!!removed) return [3 /*break*/, 2];
@@ -808,7 +813,7 @@ var SubscriptionManager = /** @class */ (function () {
808
813
  _d.preSubscriptionData = _e.sent();
809
814
  if (that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) {
810
815
  removed = false;
811
- if (this_1._subCache.some(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })) {
816
+ if (this_2._subCache.some(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })) {
812
817
  if (!sub.clients.length) {
813
818
  that._subscriptions.splice(that._subscriptions.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
814
819
  active_subscription_collection_1.ActiveSubscriptions.deleteOne({
@@ -819,8 +824,8 @@ var SubscriptionManager = /** @class */ (function () {
819
824
  }).exec();
820
825
  removed = true;
821
826
  }
822
- 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);
823
- this_1._subCache.splice(this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
827
+ this_2._nodeCache.del(this_2._subCache.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })[0].id);
828
+ this_2._subCache.splice(this_2._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
824
829
  }
825
830
  if (!removed) {
826
831
  that.sendPubData(sub, type, collection);
@@ -853,7 +858,7 @@ var SubscriptionManager = /** @class */ (function () {
853
858
  if (that._publications[sub.publication].fetchFunction) {
854
859
  if ((_b = that._publications[sub.publication]).fetchFunction.apply(_b, [document].concat(sub.subscriptionData))) {
855
860
  removed = false;
856
- if (this_1._subCache.some(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })) {
861
+ if (this_2._subCache.some(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })) {
857
862
  if (!sub.clients.length) {
858
863
  if (that._subscriptions.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
859
864
  that._subscriptions.splice(that._subscriptions.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
@@ -866,9 +871,9 @@ var SubscriptionManager = /** @class */ (function () {
866
871
  }).exec();
867
872
  removed = true;
868
873
  }
869
- 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);
870
- if (this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
871
- this_1._subCache.splice(this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
874
+ this_2._nodeCache.del(this_2._subCache.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })[0].id);
875
+ if (this_2._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
876
+ this_2._subCache.splice(this_2._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
872
877
  }
873
878
  }
874
879
  if (!removed) {
@@ -879,7 +884,7 @@ var SubscriptionManager = /** @class */ (function () {
879
884
  }
880
885
  else {
881
886
  removed = false;
882
- if (this_1._subCache.some(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })) {
887
+ if (this_2._subCache.some(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })) {
883
888
  if (!sub.clients.length) {
884
889
  if (that._subscriptions.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
885
890
  that._subscriptions.splice(that._subscriptions.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
@@ -892,9 +897,9 @@ var SubscriptionManager = /** @class */ (function () {
892
897
  }).exec();
893
898
  removed = true;
894
899
  }
895
- 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);
896
- if (this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
897
- this_1._subCache.splice(this_1._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
900
+ this_2._nodeCache.del(this_2._subCache.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); })[0].id);
901
+ if (this_2._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }) >= 0) {
902
+ this_2._subCache.splice(this_2._subCache.findIndex(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }), 1);
898
903
  }
899
904
  }
900
905
  if (!removed) {
@@ -907,12 +912,12 @@ var SubscriptionManager = /** @class */ (function () {
907
912
  }
908
913
  });
909
914
  };
910
- this_1 = this;
915
+ this_2 = this;
911
916
  i = subCopy.length - 1;
912
917
  _a.label = 1;
913
918
  case 1:
914
919
  if (!(i >= 0)) return [3 /*break*/, 4];
915
- return [5 /*yield**/, _loop_6(i)];
920
+ return [5 /*yield**/, _loop_7(i)];
916
921
  case 2:
917
922
  _a.sent();
918
923
  _a.label = 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "5.1.5",
3
+ "version": "5.1.6-newrole",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {