@resolveio/server-lib 5.2.37 → 5.2.38-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,
@@ -368,31 +368,28 @@ var SubscriptionManager = /** @class */ (function () {
368
368
  return [2 /*return*/];
369
369
  case 1:
370
370
  sub = that._subscriptions.filter(function (a) { return a.publication === publication && JSON.stringify(a.subscriptionData) === JSON.stringify(subscriptionData); })[0];
371
- if (!sub) return [3 /*break*/, 5];
371
+ if (!sub) return [3 /*break*/, 3];
372
372
  for (i = sub.clients.length - 1; i >= 0; i--) {
373
373
  if (sub.clients[i].id_user === ws['id_user'] && sub.clients[i].messageId === messageId && sub.clients[i].id_socket === ws['id_socket']) {
374
374
  sub.clients.splice(i, 1);
375
375
  }
376
376
  }
377
- if (!!sub.clients.length) return [3 /*break*/, 2];
378
- return [3 /*break*/, 4];
379
- case 2: return [4 /*yield*/, active_subscription_collection_1.ActiveSubscriptions.findOne({
380
- $and: [
381
- { publication: publication },
382
- { subData: JSON.stringify(subscriptionData) }
383
- ]
384
- })];
385
- case 3:
377
+ return [4 /*yield*/, active_subscription_collection_1.ActiveSubscriptions.findOne({
378
+ $and: [
379
+ { publication: publication },
380
+ { subData: JSON.stringify(subscriptionData) }
381
+ ]
382
+ })];
383
+ case 2:
386
384
  activeSub = _a.sent();
387
385
  if (activeSub) {
388
386
  active_subscription_collection_1.ActiveSubscriptions.updateOne({ _id: activeSub._id }, { $set: { clients: sub.clients } }).exec();
389
387
  }
390
- _a.label = 4;
391
- case 4: return [3 /*break*/, 6];
392
- case 5:
388
+ return [3 /*break*/, 4];
389
+ case 3:
393
390
  console.log('Did not sub on unsubscribe');
394
- _a.label = 6;
395
- case 6: return [2 /*return*/];
391
+ _a.label = 4;
392
+ case 4: return [2 /*return*/];
396
393
  }
397
394
  });
398
395
  });
@@ -422,9 +419,6 @@ var SubscriptionManager = /** @class */ (function () {
422
419
  sub.clients.splice(j, 1);
423
420
  }
424
421
  }
425
- if (!sub.clients.length) {
426
- // that._subscriptions.splice(that._subscriptions.findIndex(a => a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData)), 1);
427
- }
428
422
  }
429
423
  return [4 /*yield*/, active_subscription_collection_1.ActiveSubscriptions.find({ 'clients.id_socket': ws['id_socket'] })];
430
424
  case 2:
@@ -435,17 +429,12 @@ var SubscriptionManager = /** @class */ (function () {
435
429
  sub.clients.splice(j, 1);
436
430
  }
437
431
  }
438
- if (!sub.clients.length) {
439
- // ActiveSubscriptions.deleteOne({_id: sub._id}).exec();
440
- }
441
- else {
442
- for (var j = sub.clients.length - 1; j >= 0; j--) {
443
- if (sub.clients[j].id_socket === ws['id_socket']) {
444
- sub.clients.splice(j, 1);
445
- }
432
+ for (var j = sub.clients.length - 1; j >= 0; j--) {
433
+ if (sub.clients[j].id_socket === ws['id_socket']) {
434
+ sub.clients.splice(j, 1);
446
435
  }
447
- active_subscription_collection_1.ActiveSubscriptions.updateOne({ _id: sub._id }, { $set: { clients: sub.clients } }).exec();
448
436
  }
437
+ active_subscription_collection_1.ActiveSubscriptions.updateOne({ _id: sub._id }, { $set: { clients: sub.clients } }).exec();
449
438
  });
450
439
  ws.terminate();
451
440
  return [2 /*return*/];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "5.2.37",
3
+ "version": "5.2.38-newrole",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {