@resolveio/server-lib 5.1.1 → 5.1.2-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.
- package/collections/user.collection.js +39 -32
- package/fixtures/init.js +1 -1
- package/package.json +1 -1
- package/server-app.js +41 -30
|
@@ -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
|
-
|
|
74
|
-
type: String
|
|
75
|
-
optional: true
|
|
75
|
+
'roles.approvals.$.type': {
|
|
76
|
+
type: String
|
|
76
77
|
},
|
|
77
|
-
|
|
78
|
-
type:
|
|
79
|
-
blackbox: true,
|
|
80
|
-
optional: true
|
|
78
|
+
'roles.approvals.$.accounting_code': {
|
|
79
|
+
type: String
|
|
81
80
|
},
|
|
82
|
-
|
|
83
|
-
type: Array
|
|
84
|
-
optional: true
|
|
81
|
+
'roles.groups': {
|
|
82
|
+
type: Array
|
|
85
83
|
},
|
|
86
|
-
'
|
|
84
|
+
'roles.groups.$': {
|
|
87
85
|
type: Object
|
|
88
86
|
},
|
|
89
|
-
'
|
|
87
|
+
'roles.groups.$.name': {
|
|
90
88
|
type: String
|
|
91
89
|
},
|
|
92
|
-
'
|
|
93
|
-
type:
|
|
90
|
+
'roles.groups.$.views': {
|
|
91
|
+
type: Array
|
|
94
92
|
},
|
|
95
|
-
'
|
|
93
|
+
'roles.groups.$.views.$': {
|
|
96
94
|
type: String
|
|
97
95
|
},
|
|
98
|
-
'
|
|
99
|
-
type: String
|
|
96
|
+
'roles.groups.$.yard': {
|
|
97
|
+
type: String,
|
|
98
|
+
optional: true
|
|
99
|
+
},
|
|
100
|
+
'roles.notifications': {
|
|
101
|
+
type: Array
|
|
100
102
|
},
|
|
101
|
-
'
|
|
103
|
+
'roles.notifications.$': {
|
|
102
104
|
type: String
|
|
103
105
|
},
|
|
104
|
-
'
|
|
105
|
-
type:
|
|
106
|
+
'roles.miscs': {
|
|
107
|
+
type: Array
|
|
106
108
|
},
|
|
107
|
-
'
|
|
108
|
-
type:
|
|
109
|
-
optional: true
|
|
109
|
+
'roles.miscs.$': {
|
|
110
|
+
type: String
|
|
110
111
|
},
|
|
111
|
-
|
|
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;
|
package/package.json
CHANGED
package/server-app.js
CHANGED
|
@@ -281,46 +281,57 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
281
281
|
}, 10000);
|
|
282
282
|
// On data received (message)
|
|
283
283
|
ws.on('message', function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
284
|
-
var _a, _b, socketData, data, messageDate, messageId, type, subType, pub;
|
|
284
|
+
var _a, _b, parseErrorFound, socketData, data, messageDate, messageId, type, subType, pub;
|
|
285
285
|
var _this = this;
|
|
286
286
|
return __generator(this, function (_c) {
|
|
287
287
|
if (this.LOGGER === 'DEBUG') {
|
|
288
288
|
console.log('Message from: ' + ws['user'], message);
|
|
289
289
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
ws.send('pong', function (error) {
|
|
295
|
-
if (error) {
|
|
296
|
-
console.log('Error on WS: ', error);
|
|
297
|
-
_this.unsubscribeWS(ws);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
return [2 /*return*/];
|
|
290
|
+
parseErrorFound = false;
|
|
291
|
+
socketData = null;
|
|
292
|
+
try {
|
|
293
|
+
socketData = JSON.parse(message, common_1.dateReviver);
|
|
302
294
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (
|
|
311
|
-
(
|
|
295
|
+
catch (e) {
|
|
296
|
+
console.log('Error - JSON.parse', message);
|
|
297
|
+
this._methodManager.sendEmail('dev@resolveio.com', 'SERVER - JSON Parse Error - ' + this._serverConfig['CLIENT_NAME'], JSON.stringify([message, e]));
|
|
298
|
+
parseErrorFound = true;
|
|
299
|
+
}
|
|
300
|
+
if (!parseErrorFound) {
|
|
301
|
+
data = common_2.deepCopy(socketData);
|
|
302
|
+
if (data[0] === 'ping') {
|
|
303
|
+
if (ws && ws.readyState === ws.OPEN) {
|
|
304
|
+
ws.send('pong', function (error) {
|
|
305
|
+
if (error) {
|
|
306
|
+
console.log('Error on WS: ', error);
|
|
307
|
+
_this.unsubscribeWS(ws);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
return [2 /*return*/];
|
|
312
|
+
}
|
|
313
|
+
messageDate = data.shift();
|
|
314
|
+
messageId = data.shift();
|
|
315
|
+
type = data.shift();
|
|
316
|
+
if (type === 'subscription') {
|
|
317
|
+
subType = data.shift();
|
|
318
|
+
pub = data.shift();
|
|
319
|
+
// Subscribe
|
|
320
|
+
if (subType === 'sub') {
|
|
321
|
+
(_a = this._subscriptionManager).subscribe.apply(_a, [messageDate, ws, messageId, pub].concat(data));
|
|
322
|
+
}
|
|
323
|
+
// Unsubscribe
|
|
324
|
+
else {
|
|
325
|
+
(_b = this._subscriptionManager).unsubscribe.apply(_b, [messageDate, ws, messageId, pub].concat(data));
|
|
326
|
+
}
|
|
312
327
|
}
|
|
313
|
-
// Unsubscribe
|
|
314
328
|
else {
|
|
315
|
-
|
|
329
|
+
this._msgQueue.splice(0, 0, {
|
|
330
|
+
ws: ws,
|
|
331
|
+
data: socketData
|
|
332
|
+
});
|
|
316
333
|
}
|
|
317
334
|
}
|
|
318
|
-
else {
|
|
319
|
-
this._msgQueue.splice(0, 0, {
|
|
320
|
-
ws: ws,
|
|
321
|
-
data: socketData
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
335
|
return [2 /*return*/];
|
|
325
336
|
});
|
|
326
337
|
}); });
|