@resolveio/server-lib 4.5.1 → 4.5.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.
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "4.5.1",
3
+ "version": "4.5.2-newrole",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {
package/server-app.js CHANGED
@@ -64,6 +64,7 @@ var ResolveIOMainServer = /** @class */ (function () {
64
64
  function ResolveIOMainServer(mainServer, serverConfig, clientDir) {
65
65
  this._msgQueue = [];
66
66
  this._msgQueueRunning = false;
67
+ console.log('Starting ResolveIO Server');
67
68
  this._resolveioServer = mainServer;
68
69
  this._serverConfig = serverConfig;
69
70
  this._clientDir = clientDir;
@@ -75,8 +76,10 @@ var ResolveIOMainServer = /** @class */ (function () {
75
76
  this._app.use(bodyParser.urlencoded({ limit: '5mb', extended: true }));
76
77
  // Set port
77
78
  this._port = process.env.PORT || serverConfig['PORT'];
79
+ console.log('Setup ports');
78
80
  // Create http server and websock server
79
81
  this.createServer();
82
+ console.log('Create server');
80
83
  // Set CORS
81
84
  this._app.use(function (req, res, next) {
82
85
  // Website you wish to allow to connect
@@ -93,9 +96,11 @@ var ResolveIOMainServer = /** @class */ (function () {
93
96
  // Pass to next layer of middleware
94
97
  next();
95
98
  });
99
+ console.log('Setup cors');
96
100
  // Set up http login route
97
101
  auth_1.setupAuthRoutes(this, this._app, serverConfig);
98
102
  health_1.setupHealthRoutes(this._app, serverConfig);
103
+ console.log('Setup express routes');
99
104
  }
100
105
  ResolveIOMainServer.prototype.getWS = function (id_ws) {
101
106
  var res = null;
@@ -140,6 +145,7 @@ var ResolveIOMainServer = /** @class */ (function () {
140
145
  var infoData, token;
141
146
  var _this = this;
142
147
  return __generator(this, function (_a) {
148
+ console.log('Verify Client', info, cb);
143
149
  infoData = info.req.headers['sec-websocket-protocol'].split(/,/);
144
150
  if (info.origin !== this._serverConfig['ROOT_URL'] && info.origin !== this._serverConfig['SEC_ROOT_URL'] && info.origin !== this._serverConfig['RESOLVEIO_URL'] && info.origin !== this._serverConfig['RESOLVEIO_SECONDARY_URL']) {
145
151
  cb(false, 401, 'Unauthorized');
@@ -208,12 +214,14 @@ var ResolveIOMainServer = /** @class */ (function () {
208
214
  __setOptions.apply(this, arguments);
209
215
  return this;
210
216
  };
217
+ console.log('Start Managers');
211
218
  // Start Managers
212
219
  this._subscriptionManager = new subscription_manager_1.SubscriptionManager(this, this._wss, this._serverConfig);
213
220
  this._methodManager = new method_manager_1.MethodManager(this, this._serverConfig, this._clientDir);
214
221
  this._supportManager = new support_manager_1.SupportManager(this, this._serverConfig, this._clientDir);
215
222
  this._cronManager = new cron_manager_1.CronManager(this);
216
223
  this._queueManager = new queue_method_manager_1.QueueMethodManager(this);
224
+ console.log('End Managers');
217
225
  this.listen();
218
226
  mongoose.set('useFindAndModify', false);
219
227
  // mongoose.set('useCreateIndexes', true);
@@ -240,6 +248,7 @@ var ResolveIOMainServer = /** @class */ (function () {
240
248
  ws['user_readonly'] = req.user_readonly;
241
249
  ws['id_socket'] = uuid();
242
250
  ws['retryCnt'] = 0;
251
+ console.log('Connection from: ' + req.user);
243
252
  // Use for keeping connection alive (ping/pong)
244
253
  ws['isAlive'] = true;
245
254
  ws.on('pong', function () {
@@ -257,6 +266,7 @@ var ResolveIOMainServer = /** @class */ (function () {
257
266
  var _a, _b, socketData, data, messageDate, messageId, type, subType, pub;
258
267
  var _this = this;
259
268
  return __generator(this, function (_c) {
269
+ console.log('Message from: ' + ws['user'], message);
260
270
  socketData = JSON.parse(message, common_1.dateReviver);
261
271
  data = common_2.deepCopy(socketData);
262
272
  if (data[0] === 'ping') {