@resolveio/server-lib 4.4.5-newrole → 4.4.6

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,6 +22,13 @@ 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
+ },
25
32
  attempts: {
26
33
  type: Number,
27
34
  optional: true
@@ -58,67 +65,53 @@ var schema = {
58
65
  type: String
59
66
  },
60
67
  roles: {
61
- type: Object
62
- },
63
- 'roles.super_admin': {
64
- type: Boolean
65
- },
66
- 'roles.approvals': {
67
68
  type: Array
68
69
  },
69
- 'roles.approvals.$': {
70
- type: Object
71
- },
72
- 'roles.approvals.$.name': {
70
+ 'roles.$': {
73
71
  type: String
74
72
  },
75
- 'roles.approvals.$.type': {
76
- type: String
73
+ phonenumber: {
74
+ type: String,
75
+ optional: true
77
76
  },
78
- 'roles.approvals.$.accounting_code': {
79
- type: String
77
+ other: {
78
+ type: Object,
79
+ blackbox: true,
80
+ optional: true
80
81
  },
81
- 'roles.groups': {
82
- type: Array
82
+ assets: {
83
+ type: Array,
84
+ optional: true
83
85
  },
84
- 'roles.groups.$': {
86
+ 'assets.$': {
85
87
  type: Object
86
88
  },
87
- 'roles.groups.$.name': {
89
+ 'assets.$.type': {
88
90
  type: String
89
91
  },
90
- 'roles.groups.$.views': {
91
- type: Array
92
- },
93
- 'roles.groups.$.views.$': {
92
+ 'assets.$.id_asset': {
94
93
  type: String
95
94
  },
96
- 'roles.groups.$.yard': {
97
- type: String,
98
- optional: true
95
+ 'assets.$.asset_number': {
96
+ type: String
99
97
  },
100
- 'roles.notifications': {
101
- type: Array
98
+ 'assets.$.ownership': {
99
+ type: String
102
100
  },
103
- 'roles.notifications.$': {
101
+ 'assets.$.ownership_driver': {
104
102
  type: String
105
103
  },
106
- 'roles.miscs': {
107
- type: Array
104
+ 'assets.$.date_start': {
105
+ type: Date
108
106
  },
109
- 'roles.miscs.$': {
110
- type: String
107
+ 'assets.$.date_end': {
108
+ type: Date,
109
+ optional: true
111
110
  },
112
- active: Boolean,
113
- phonenumber: {
111
+ id_function: {
114
112
  type: String,
115
113
  optional: true
116
114
  },
117
- other: {
118
- type: Object,
119
- optional: true,
120
- blackbox: true
121
- },
122
115
  customers: {
123
116
  type: Array,
124
117
  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 mongoose_1 = require("mongoose");
41
40
  var active_subscription_collection_1 = require("../collections/active-subscription.collection");
41
+ var mongoose_1 = require("mongoose");
42
42
  function loadServerInit() {
43
43
  return __awaiter(this, void 0, void 0, function () {
44
44
  var appVersion;
@@ -584,11 +584,12 @@ var SubscriptionManager = /** @class */ (function () {
584
584
  if (!(i >= 0)) return [3 /*break*/, 10];
585
585
  oplog = uniqueOplog_1[i];
586
586
  _loop_4 = function (j) {
587
- var _a, sub, _b;
588
- return __generator(this, function (_c) {
589
- switch (_c.label) {
587
+ var _a, _b, sub, _c;
588
+ return __generator(this, function (_d) {
589
+ switch (_d.label) {
590
590
  case 0:
591
591
  sub = that._subscriptions[j];
592
+ if (!(oplog.type === 'update')) return [3 /*break*/, 4];
592
593
  if (!sub.collections.includes(oplog.collection)) return [3 /*break*/, 3];
593
594
  if (sub.preSubscriptionData) {
594
595
  if (that._publications[sub.publication].fetchFunction(oplog.doc, sub.preSubscriptionData)) {
@@ -602,10 +603,10 @@ var SubscriptionManager = /** @class */ (function () {
602
603
  }
603
604
  }
604
605
  if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 2];
605
- _b = sub;
606
+ _c = sub;
606
607
  return [4 /*yield*/, that._publications[sub.publication].preFunction(sub.subscriptionData)];
607
608
  case 1:
608
- _b.preSubscriptionData = _c.sent();
609
+ _c.preSubscriptionData = _d.sent();
609
610
  if (that._publications[sub.publication].fetchFunction(oplog.doc, sub.preSubscriptionData)) {
610
611
  if (!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) {
611
612
  uniquePubs.push(sub);
@@ -637,8 +638,22 @@ var SubscriptionManager = /** @class */ (function () {
637
638
  }
638
639
  return [2 /*return*/, "break"];
639
640
  }
640
- _c.label = 3;
641
- case 3: return [2 /*return*/];
641
+ _d.label = 3;
642
+ case 3: return [3 /*break*/, 5];
643
+ case 4:
644
+ if (oplog.type === 'insert') {
645
+ if (sub.collections.includes(oplog.collection) && (that._publications[sub.publication].preFunction || !that._publications[sub.publication].fetchFunction || (_b = that._publications[sub.publication]).fetchFunction.apply(_b, [oplog.doc].concat(sub.subscriptionData)))) {
646
+ if (!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) {
647
+ uniquePubs.push(sub);
648
+ }
649
+ else {
650
+ uniqueOplog_1.splice(i, 1);
651
+ }
652
+ return [2 /*return*/, "break"];
653
+ }
654
+ }
655
+ _d.label = 5;
656
+ case 5: return [2 /*return*/];
642
657
  }
643
658
  });
644
659
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "4.4.5-newrole",
3
+ "version": "4.4.6",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {