@resolveio/server-lib 1.0.0-rc9 → 1.0.1
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/http/auth.d.ts +1 -1
- package/http/auth.js +1 -1
- package/index.d.ts +5 -43
- package/index.js +60 -59
- package/managers/method.manager.d.ts +3 -2
- package/managers/method.manager.js +64 -20
- package/managers/queue-method.manager.js +14 -1
- package/managers/subscription.manager.js +3 -3
- package/managers/support.manager.d.ts +1 -1
- package/managers/support.manager.js +1 -1
- package/methods/aws.js +22 -0
- package/methods/counters.js +0 -297
- package/models/notification.model.d.ts +5 -0
- package/models/notification.model.js +2 -0
- package/package.json +2 -2
- package/server-app.d.ts +3 -2
- package/server-app.js +88 -6
package/http/auth.d.ts
CHANGED
package/http/auth.js
CHANGED
|
@@ -74,7 +74,7 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
|
|
|
74
74
|
var emailData_1 = {
|
|
75
75
|
userToChangePassword: user_1.fullname,
|
|
76
76
|
userWhoResetPassword: __1.ResolveIOServer.getClientName() + ' System',
|
|
77
|
-
url: serverConfig['ROOT_URL'] + '/forgot-password
|
|
77
|
+
url: serverConfig['ROOT_URL'] + '/forgot-password?' + encodeURIComponent(serverConfig['SERVER_URL']) + '&' + user_1.services.forgot_password
|
|
78
78
|
};
|
|
79
79
|
user_collection_1.Users.updateOne({ _id: user_1._id }, { $set: { services: user_1.services } }).exec(function (errUp, resUp) {
|
|
80
80
|
mainServer.getMethodManager().readFile('email-templates/forgot-password.html').then(function (html) {
|
package/index.d.ts
CHANGED
|
@@ -1,55 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ResolveIOMainServer from './server-app';
|
|
2
2
|
export declare class ResolveIOServer {
|
|
3
3
|
private static _serverConfig;
|
|
4
4
|
private static _mainDB;
|
|
5
5
|
private static _supportDB;
|
|
6
6
|
private static _mainServer;
|
|
7
7
|
private static _client;
|
|
8
|
-
|
|
8
|
+
private static _clientDir;
|
|
9
|
+
private static _dontRunSupport;
|
|
10
|
+
constructor(serverConfig: any, client: string, clientDir: any, _dontRunSupport?: any);
|
|
11
|
+
static connectAndRun(): Promise<{}>;
|
|
9
12
|
static getClientName(): string;
|
|
10
13
|
static getMainServer(): ResolveIOMainServer;
|
|
11
14
|
static getMainDB(): any;
|
|
12
15
|
static getSupportDB(): any;
|
|
13
16
|
}
|
|
14
|
-
export * from './collections/active-subscription.collection';
|
|
15
|
-
export * from './collections/app-status.collection';
|
|
16
|
-
export * from './collections/app-version.collection';
|
|
17
|
-
export * from './collections/counter.collection';
|
|
18
|
-
export * from './collections/cron-job-history.collection';
|
|
19
|
-
export * from './collections/cron-job.collection';
|
|
20
|
-
export * from './collections/file.collection';
|
|
21
|
-
export * from './collections/flag.collection';
|
|
22
|
-
export * from './collections/log.collection';
|
|
23
|
-
export * from './collections/logged-in-users.collection';
|
|
24
|
-
export * from './collections/method-call.collection';
|
|
25
|
-
export * from './collections/method-response.collection';
|
|
26
|
-
export * from './collections/queue-flag.collection';
|
|
27
|
-
export * from './collections/queue-method.collection';
|
|
28
|
-
export * from './collections/queue-response.collection';
|
|
29
|
-
export * from './collections/support-ticket.collection';
|
|
30
|
-
export * from './collections/user.collection';
|
|
31
|
-
export * from './managers/cron.manager';
|
|
32
|
-
export * from './managers/method.manager';
|
|
33
|
-
export * from './managers/queue-method.manager';
|
|
34
|
-
export * from './managers/subscription.manager';
|
|
35
|
-
export * from './managers/support.manager';
|
|
36
|
-
export * from './models/active-subscription.model';
|
|
37
|
-
export * from './models/app-status.model';
|
|
38
|
-
export * from './models/app-version.model';
|
|
39
|
-
export * from './models/collection-document.model';
|
|
40
|
-
export * from './models/counter.model';
|
|
41
|
-
export * from './models/cron-job.model';
|
|
42
|
-
export * from './models/dialog.model';
|
|
43
|
-
export * from './models/file.model';
|
|
44
|
-
export * from './models/flag.model';
|
|
45
|
-
export * from './models/log.model';
|
|
46
|
-
export * from './models/method.model';
|
|
47
|
-
export * from './models/pagination.model';
|
|
48
|
-
export * from './models/permission.model';
|
|
49
|
-
export * from './models/select-data-label.model';
|
|
50
|
-
export * from './models/server-response.model';
|
|
51
|
-
export * from './models/support-method.model';
|
|
52
|
-
export * from './models/support-ticket.model';
|
|
53
|
-
export * from './models/user.model';
|
|
54
|
-
export * from './util/common';
|
|
55
17
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -34,50 +34,73 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
34
34
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
function __export(m) {
|
|
38
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
39
|
-
}
|
|
40
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
38
|
var mongoose = require("mongoose");
|
|
42
|
-
var server_app_1 = require("./server-app");
|
|
43
39
|
var ResolveIOServer = /** @class */ (function () {
|
|
44
|
-
function ResolveIOServer(serverConfig, client) {
|
|
45
|
-
var _this = this;
|
|
40
|
+
function ResolveIOServer(serverConfig, client, clientDir, _dontRunSupport) {
|
|
46
41
|
ResolveIOServer._serverConfig = serverConfig;
|
|
47
42
|
ResolveIOServer._client = client;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
ResolveIOServer._clientDir = clientDir;
|
|
44
|
+
if (_dontRunSupport) {
|
|
45
|
+
ResolveIOServer._dontRunSupport = _dontRunSupport;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
ResolveIOServer.connectAndRun = function () {
|
|
49
|
+
var _this = this;
|
|
50
|
+
return new Promise(function (resolve, reject) {
|
|
51
|
+
if (ResolveIOServer._serverConfig['ROOT_URL'] !== 'http://localhost:4200' && !_this._dontRunSupport) {
|
|
52
|
+
mongoose.createConnection(ResolveIOServer._serverConfig['RESOLVEIO_SUPPORT_MONGO_URL'], { useNewUrlParser: true }).then(function (db) { return __awaiter(_this, void 0, void 0, function () {
|
|
53
|
+
var _this = this;
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
ResolveIOServer._supportDB = db;
|
|
56
|
+
mongoose.createConnection(ResolveIOServer._serverConfig['MONGO_URL'], { useNewUrlParser: true }).then(function (dbMain) { return __awaiter(_this, void 0, void 0, function () {
|
|
57
|
+
var serverApp;
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
switch (_a.label) {
|
|
60
|
+
case 0:
|
|
61
|
+
ResolveIOServer._mainDB = dbMain;
|
|
62
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('./server-app'); })];
|
|
63
|
+
case 1:
|
|
64
|
+
serverApp = (_a.sent()).default;
|
|
65
|
+
ResolveIOServer._mainServer = new serverApp(this, ResolveIOServer._serverConfig, this._clientDir);
|
|
66
|
+
resolve();
|
|
67
|
+
return [2 /*return*/];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}); }, function (err) {
|
|
71
|
+
process.exit();
|
|
72
|
+
reject();
|
|
58
73
|
});
|
|
59
|
-
|
|
60
|
-
process.exit();
|
|
74
|
+
return [2 /*return*/];
|
|
61
75
|
});
|
|
62
|
-
|
|
76
|
+
}); }, function (err) {
|
|
77
|
+
process.exit();
|
|
78
|
+
reject();
|
|
63
79
|
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
ResolveIOServer._supportDB = null;
|
|
83
|
+
mongoose.createConnection(ResolveIOServer._serverConfig['MONGO_URL'], { useNewUrlParser: true }).then(function (dbMain) { return __awaiter(_this, void 0, void 0, function () {
|
|
84
|
+
var serverApp;
|
|
85
|
+
return __generator(this, function (_a) {
|
|
86
|
+
switch (_a.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
ResolveIOServer._mainDB = dbMain;
|
|
89
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('./server-app'); })];
|
|
90
|
+
case 1:
|
|
91
|
+
serverApp = (_a.sent()).default;
|
|
92
|
+
ResolveIOServer._mainServer = new serverApp(this, ResolveIOServer._serverConfig, this._clientDir);
|
|
93
|
+
resolve();
|
|
94
|
+
return [2 /*return*/];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}); }, function (err) {
|
|
98
|
+
process.exit();
|
|
99
|
+
reject();
|
|
75
100
|
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
};
|
|
81
104
|
ResolveIOServer.getClientName = function () {
|
|
82
105
|
return this._client;
|
|
83
106
|
};
|
|
@@ -95,30 +118,8 @@ var ResolveIOServer = /** @class */ (function () {
|
|
|
95
118
|
ResolveIOServer._supportDB = null;
|
|
96
119
|
ResolveIOServer._mainServer = null;
|
|
97
120
|
ResolveIOServer._client = '';
|
|
121
|
+
ResolveIOServer._clientDir = '';
|
|
122
|
+
ResolveIOServer._dontRunSupport = false;
|
|
98
123
|
return ResolveIOServer;
|
|
99
124
|
}());
|
|
100
125
|
exports.ResolveIOServer = ResolveIOServer;
|
|
101
|
-
__export(require("./collections/active-subscription.collection"));
|
|
102
|
-
__export(require("./collections/app-status.collection"));
|
|
103
|
-
__export(require("./collections/app-version.collection"));
|
|
104
|
-
__export(require("./collections/counter.collection"));
|
|
105
|
-
__export(require("./collections/cron-job-history.collection"));
|
|
106
|
-
__export(require("./collections/cron-job.collection"));
|
|
107
|
-
__export(require("./collections/file.collection"));
|
|
108
|
-
__export(require("./collections/flag.collection"));
|
|
109
|
-
__export(require("./collections/log.collection"));
|
|
110
|
-
__export(require("./collections/logged-in-users.collection"));
|
|
111
|
-
__export(require("./collections/method-call.collection"));
|
|
112
|
-
__export(require("./collections/method-response.collection"));
|
|
113
|
-
__export(require("./collections/queue-flag.collection"));
|
|
114
|
-
__export(require("./collections/queue-method.collection"));
|
|
115
|
-
__export(require("./collections/queue-response.collection"));
|
|
116
|
-
__export(require("./collections/support-ticket.collection"));
|
|
117
|
-
__export(require("./collections/user.collection"));
|
|
118
|
-
__export(require("./managers/cron.manager"));
|
|
119
|
-
__export(require("./managers/method.manager"));
|
|
120
|
-
__export(require("./managers/queue-method.manager"));
|
|
121
|
-
__export(require("./managers/subscription.manager"));
|
|
122
|
-
__export(require("./managers/support.manager"));
|
|
123
|
-
__export(require("./models/pagination.model"));
|
|
124
|
-
__export(require("./util/common"));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MethodModel } from '../models/method.model';
|
|
2
2
|
import * as aws from 'aws-sdk';
|
|
3
3
|
import { QueueMethodModel } from '../models/queue-method.model';
|
|
4
|
-
import
|
|
4
|
+
import ResolveIOMainServer from '../server-app';
|
|
5
5
|
export declare class MethodManager {
|
|
6
6
|
private _mainServer;
|
|
7
7
|
_methods: MethodModel;
|
|
@@ -9,9 +9,10 @@ export declare class MethodManager {
|
|
|
9
9
|
private _imap;
|
|
10
10
|
private _aws;
|
|
11
11
|
private serverConfig;
|
|
12
|
+
private clientDir;
|
|
12
13
|
private _sendQueue;
|
|
13
14
|
private _runningQueue;
|
|
14
|
-
constructor(mainServer: any, serverConfig: any);
|
|
15
|
+
constructor(mainServer: any, serverConfig: any, clientDir: any);
|
|
15
16
|
getMainServer(): ResolveIOMainServer;
|
|
16
17
|
methods(method: MethodModel): void;
|
|
17
18
|
callMethodCron(method: string, ...methodData: any[]): void;
|
|
@@ -20,13 +20,14 @@ var mongoose_1 = require("mongoose");
|
|
|
20
20
|
var common_1 = require("../util/common");
|
|
21
21
|
var log_collection_1 = require("../collections/log.collection");
|
|
22
22
|
var MethodManager = /** @class */ (function () {
|
|
23
|
-
function MethodManager(mainServer, serverConfig) {
|
|
23
|
+
function MethodManager(mainServer, serverConfig, clientDir) {
|
|
24
24
|
var _this = this;
|
|
25
25
|
this._methods = {};
|
|
26
26
|
this._sendQueue = [];
|
|
27
27
|
this._runningQueue = false;
|
|
28
28
|
this._mainServer = mainServer;
|
|
29
29
|
this.serverConfig = serverConfig;
|
|
30
|
+
this.clientDir = clientDir;
|
|
30
31
|
// Fixtures
|
|
31
32
|
init_1.loadServerInit();
|
|
32
33
|
cron_jobs_1.loadServerCronJobs();
|
|
@@ -162,7 +163,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
162
163
|
_this._mainServer.unsubscribeWS(ws);
|
|
163
164
|
}
|
|
164
165
|
});
|
|
165
|
-
if (sendItem.method !== 'countQuery' && sendItem.method !== 'countCollectionWithQuery' && sendItem.method !== 'find' && sendItem.method !== 'findOne' && sendItem.method !== 'findWithOptions' && sendItem.method !== 'setWSAppVersion' && sendItem.method !== 'uploadFileAndSave') {
|
|
166
|
+
if (sendItem.method !== 'generatePDF' && sendItem.method !== 'getWOOfflineData' && sendItem.method !== 'countQuery' && sendItem.method !== 'countCollectionWithQuery' && sendItem.method !== 'find' && sendItem.method !== 'findOne' && sendItem.method !== 'findWithOptions' && sendItem.method !== 'setWSAppVersion' && sendItem.method !== 'uploadFileAndSave') {
|
|
166
167
|
if (common_1.getBinarySize(JSON.stringify(sendItem.methodData)) < 200000 && common_1.getBinarySize(JSON.stringify(sendItem.data)) < 200000) {
|
|
167
168
|
log_collection_1.Logs.create({
|
|
168
169
|
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
@@ -190,6 +191,19 @@ var MethodManager = /** @class */ (function () {
|
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
193
|
}
|
|
194
|
+
else {
|
|
195
|
+
log_collection_1.Logs.create({
|
|
196
|
+
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
197
|
+
date: new Date(),
|
|
198
|
+
type: 'client-response',
|
|
199
|
+
title: 'Client Response',
|
|
200
|
+
message: 'User: ' + ws['user'] + ', MessageId: ' + sendItem.data.messageId + ', Method: ' + sendItem.method,
|
|
201
|
+
payload: 'Too Big',
|
|
202
|
+
method: sendItem.method,
|
|
203
|
+
user: ws['user'],
|
|
204
|
+
messageId: sendItem.data.messageId
|
|
205
|
+
});
|
|
206
|
+
}
|
|
193
207
|
method_response_collection_1.MethodResponses.create({
|
|
194
208
|
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
195
209
|
__v: 0,
|
|
@@ -262,7 +276,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
262
276
|
}
|
|
263
277
|
}
|
|
264
278
|
}
|
|
265
|
-
(_a = that._methods[method].function).call.apply(_a, [Object.assign({}, that, { id_user: '', user: '', id_ws: '' })].concat(methodData));
|
|
279
|
+
(_a = that._methods[method].function).call.apply(_a, [Object.assign({}, that, MethodManager.prototype, { id_user: '', user: '', id_ws: '' })].concat(methodData));
|
|
266
280
|
};
|
|
267
281
|
MethodManager.prototype.callMethodQueue = function (update) {
|
|
268
282
|
// console.log('Call Method Queue', update);
|
|
@@ -330,7 +344,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
330
344
|
}
|
|
331
345
|
}
|
|
332
346
|
// console.log('Run Method', update.method);
|
|
333
|
-
(_a = that._methods[update.method].function).call.apply(_a, [Object.assign({}, that, { id_user: update.id_user, user: update.user, id_ws: update.id_ws })].concat(update.method_data)).then(function (res) {
|
|
347
|
+
(_a = that._methods[update.method].function).call.apply(_a, [Object.assign({}, that, MethodManager.prototype, { id_user: update.id_user, user: update.user, id_ws: update.id_ws })].concat(update.method_data)).then(function (res) {
|
|
334
348
|
var serverRes = {
|
|
335
349
|
messageId: update.messageId,
|
|
336
350
|
hasError: false,
|
|
@@ -414,7 +428,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
414
428
|
}
|
|
415
429
|
}
|
|
416
430
|
}
|
|
417
|
-
(_a = that._methods[method].function).call.apply(_a, [Object.assign({}, that, { id_user: ws['id_user'], user: ws['user'], id_ws: ws['id_socket'] })].concat(methodData)).then(function (res) {
|
|
431
|
+
(_a = that._methods[method].function).call.apply(_a, [Object.assign({}, that, MethodManager.prototype, { id_user: ws['id_user'], user: ws['user'], id_ws: ws['id_socket'] })].concat(methodData)).then(function (res) {
|
|
418
432
|
var serverRes = {
|
|
419
433
|
messageId: messageId,
|
|
420
434
|
hasError: false,
|
|
@@ -452,7 +466,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
452
466
|
return;
|
|
453
467
|
}
|
|
454
468
|
}
|
|
455
|
-
var promise = (_a = that._methods[method].function).call.apply(_a, [that].concat(methodData));
|
|
469
|
+
var promise = (_a = that._methods[method].function).call.apply(_a, [Object.assign({}, that, MethodManager.prototype)].concat(methodData));
|
|
456
470
|
if (methodData[methodData.length - 1] && typeof (methodData[methodData.length - 1]) === 'function') {
|
|
457
471
|
promise.then(function (res) { return methodData[methodData.length - 1](null, res); }, function (err) { return methodData[methodData.length - 1](err, null); });
|
|
458
472
|
}
|
|
@@ -485,27 +499,57 @@ var MethodManager = /** @class */ (function () {
|
|
|
485
499
|
return this._aws;
|
|
486
500
|
};
|
|
487
501
|
MethodManager.prototype.readFile = function (fileName) {
|
|
502
|
+
var _this = this;
|
|
488
503
|
return new Promise(function (resolve, reject) {
|
|
489
|
-
fs.
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
504
|
+
if (fs.existsSync(path.join(__dirname, ('../private/' + fileName)))) {
|
|
505
|
+
fs.readFile(path.join(__dirname, ('../private/' + fileName)), 'utf-8', function (err, res) {
|
|
506
|
+
if (err) {
|
|
507
|
+
reject(err);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
resolve(res);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
if (fs.existsSync(path.join(_this.clientDir, ('./private/' + fileName)))) {
|
|
516
|
+
fs.readFile(path.join(_this.clientDir, ('./private/' + fileName)), 'utf-8', function (err, res) {
|
|
517
|
+
if (err) {
|
|
518
|
+
reject(err);
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
resolve(res);
|
|
522
|
+
}
|
|
523
|
+
});
|
|
495
524
|
}
|
|
496
|
-
}
|
|
525
|
+
}
|
|
497
526
|
});
|
|
498
527
|
};
|
|
499
528
|
MethodManager.prototype.readImage = function (fileName) {
|
|
529
|
+
var _this = this;
|
|
500
530
|
return new Promise(function (resolve, reject) {
|
|
501
|
-
fs.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
531
|
+
if (fs.existsSync(path.join(__dirname, ('../private/' + fileName)))) {
|
|
532
|
+
fs.readFile(path.join(__dirname, ('../private/' + fileName)), 'base64', function (err, res) {
|
|
533
|
+
if (err) {
|
|
534
|
+
reject(err);
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
resolve(res);
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
if (fs.existsSync(path.join(_this.clientDir, ('./private/' + fileName)))) {
|
|
543
|
+
fs.readFile(path.join(_this.clientDir, ('./private/' + fileName)), 'base64', function (err, res) {
|
|
544
|
+
if (err) {
|
|
545
|
+
reject(err);
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
resolve(res);
|
|
549
|
+
}
|
|
550
|
+
});
|
|
507
551
|
}
|
|
508
|
-
}
|
|
552
|
+
}
|
|
509
553
|
});
|
|
510
554
|
};
|
|
511
555
|
return MethodManager;
|
|
@@ -63,7 +63,7 @@ var QueueMethodManager = /** @class */ (function () {
|
|
|
63
63
|
_this._mainServer.unsubscribeWS(ws);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
if (sendItem.method !== 'countQuery' && sendItem.method !== 'countCollectionWithQuery' && sendItem.method !== 'find' && sendItem.method !== 'findOne' && sendItem.method !== 'findWithOptions' && sendItem.method !== 'setWSAppVersion' && sendItem.method !== 'uploadFileAndSave') {
|
|
66
|
+
if (sendItem.method !== 'generatePDF' && sendItem.method !== 'getWOOfflineData' && sendItem.method !== 'countQuery' && sendItem.method !== 'countCollectionWithQuery' && sendItem.method !== 'find' && sendItem.method !== 'findOne' && sendItem.method !== 'findWithOptions' && sendItem.method !== 'setWSAppVersion' && sendItem.method !== 'uploadFileAndSave') {
|
|
67
67
|
if (common_1.getBinarySize(JSON.stringify(sendItem.methodData)) < 200000 && common_1.getBinarySize(JSON.stringify(sendItem.data)) < 200000) {
|
|
68
68
|
log_collection_1.Logs.create({
|
|
69
69
|
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
@@ -91,6 +91,19 @@ var QueueMethodManager = /** @class */ (function () {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
else {
|
|
95
|
+
log_collection_1.Logs.create({
|
|
96
|
+
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
97
|
+
date: new Date(),
|
|
98
|
+
type: 'client-response',
|
|
99
|
+
title: 'Client Response',
|
|
100
|
+
message: 'User: ' + ws['user'] + ', MessageId: ' + sendItem.messageId + ', Method: ' + sendItem.method,
|
|
101
|
+
payload: 'Too Big',
|
|
102
|
+
method: sendItem.method,
|
|
103
|
+
user: ws['user'],
|
|
104
|
+
messageId: sendItem.messageId
|
|
105
|
+
});
|
|
106
|
+
}
|
|
94
107
|
method_response_collection_1.MethodResponses.create({
|
|
95
108
|
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
96
109
|
__v: 0,
|
|
@@ -614,7 +614,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
614
614
|
return __generator(this, function (_c) {
|
|
615
615
|
that = this;
|
|
616
616
|
if (!that._publications[subscription.publication].ws_specific) { // Same pub for all users
|
|
617
|
-
(_a = that._publications[subscription.publication].function).call.apply(_a, [that].concat(subscription.subscriptionData)).then(function (res) {
|
|
617
|
+
(_a = that._publications[subscription.publication].function).call.apply(_a, [Object.assign({}, that, SubscriptionManager.prototype)].concat(subscription.subscriptionData)).then(function (res) {
|
|
618
618
|
var serverRes = {
|
|
619
619
|
messageId: messageId,
|
|
620
620
|
hasError: false,
|
|
@@ -631,7 +631,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
631
631
|
});
|
|
632
632
|
}
|
|
633
633
|
else { // Pub is different for each user (Look at users publication) [MUCH SLOWER, RE-RUNS FOR EACH USER]
|
|
634
|
-
(_b = that._publications[subscription.publication].function).call.apply(_b, [that, ws['id_user']].concat(subscription.subscriptionData)).then(function (res) {
|
|
634
|
+
(_b = that._publications[subscription.publication].function).call.apply(_b, [Object.assign({}, that, SubscriptionManager.prototype), ws['id_user']].concat(subscription.subscriptionData)).then(function (res) {
|
|
635
635
|
var serverRes = {
|
|
636
636
|
messageId: messageId,
|
|
637
637
|
hasError: false,
|
|
@@ -658,7 +658,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
658
658
|
var _this = this;
|
|
659
659
|
return __generator(this, function (_b) {
|
|
660
660
|
that = this;
|
|
661
|
-
(_a = that._publications[subscription.publication].function).call.apply(_a, [that].concat(subscription.subscriptionData)).then(function (res) {
|
|
661
|
+
(_a = that._publications[subscription.publication].function).call.apply(_a, [Object.assign({}, that, SubscriptionManager.prototype)].concat(subscription.subscriptionData)).then(function (res) {
|
|
662
662
|
subscription.clients.forEach(function (client) {
|
|
663
663
|
that._wss.clients.forEach(function (ws) {
|
|
664
664
|
if (ws['id_socket'] === client.id_socket) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SupportMethodModel } from '../models/support-method.model';
|
|
2
|
-
import
|
|
2
|
+
import ResolveIOMainServer from '../server-app';
|
|
3
3
|
export declare class SupportManager {
|
|
4
4
|
private _mainServer;
|
|
5
5
|
_supportMethods: SupportMethodModel;
|
|
@@ -164,7 +164,7 @@ var SupportManager = /** @class */ (function () {
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
(_a = that._supportMethods[supportMethod].function).call.apply(_a, [Object.assign({}, that, { id_user: ws['id_user'], user: ws['user'], id_ws: ws['id_socket'] })].concat(methodData)).then(function (res) {
|
|
167
|
+
(_a = that._supportMethods[supportMethod].function).call.apply(_a, [Object.assign({}, that, SupportManager.prototype, { id_user: ws['id_user'], user: ws['user'], id_ws: ws['id_socket'] })].concat(methodData)).then(function (res) {
|
|
168
168
|
var serverRes = {
|
|
169
169
|
messageId: messageId,
|
|
170
170
|
hasError: false,
|
package/methods/aws.js
CHANGED
|
@@ -39,6 +39,7 @@ var file_collection_1 = require("../collections/file.collection");
|
|
|
39
39
|
var mongoose_1 = require("mongoose");
|
|
40
40
|
var simpl_schema_1 = require("simpl-schema");
|
|
41
41
|
var index_1 = require("../index");
|
|
42
|
+
var request = require('request').defaults({ encoding: null });
|
|
42
43
|
var pdfCnt = 1000000;
|
|
43
44
|
function loadAWSMethods(methodManager) {
|
|
44
45
|
methodManager.methods({
|
|
@@ -276,6 +277,27 @@ function loadAWSMethods(methodManager) {
|
|
|
276
277
|
});
|
|
277
278
|
}
|
|
278
279
|
},
|
|
280
|
+
getDataURIfromURL: {
|
|
281
|
+
skipQueue: true,
|
|
282
|
+
check: new simpl_schema_1.default({
|
|
283
|
+
url: {
|
|
284
|
+
type: String
|
|
285
|
+
}
|
|
286
|
+
}),
|
|
287
|
+
function: function (url) {
|
|
288
|
+
return new Promise(function (resolve, reject) {
|
|
289
|
+
request.get(url, function (error, response, body) {
|
|
290
|
+
if (!error && response.statusCode === 200) {
|
|
291
|
+
var data = 'data:' + response.headers['content-type'] + ';base64,' + new Buffer(body).toString('base64');
|
|
292
|
+
resolve(data);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
reject(error);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
},
|
|
279
301
|
emailFile: {
|
|
280
302
|
skipQueue: true,
|
|
281
303
|
check: new simpl_schema_1.default({
|
package/methods/counters.js
CHANGED
|
@@ -91,303 +91,6 @@ function loadCounterMethods(methodManager) {
|
|
|
91
91
|
return __1.ResolveIOServer.getMainDB().model(collectionType).collection.countDocuments(query);
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
|
-
countQuery: {
|
|
95
|
-
skipQueue: true,
|
|
96
|
-
check: new simpl_schema_1.default({
|
|
97
|
-
collectionType: {
|
|
98
|
-
type: String
|
|
99
|
-
},
|
|
100
|
-
search: {
|
|
101
|
-
type: String,
|
|
102
|
-
optional: true
|
|
103
|
-
},
|
|
104
|
-
filters: simpl_schema_1.default.oneOf({
|
|
105
|
-
type: Array,
|
|
106
|
-
optional: true
|
|
107
|
-
}, {
|
|
108
|
-
type: Object,
|
|
109
|
-
blackbox: true,
|
|
110
|
-
optional: true
|
|
111
|
-
}),
|
|
112
|
-
'filters.$': {
|
|
113
|
-
type: Object,
|
|
114
|
-
optional: true,
|
|
115
|
-
blackbox: true
|
|
116
|
-
},
|
|
117
|
-
subType: {
|
|
118
|
-
type: String,
|
|
119
|
-
optional: true
|
|
120
|
-
}
|
|
121
|
-
}),
|
|
122
|
-
function: function (collectionType, search, filters) {
|
|
123
|
-
if (search === void 0) { search = ''; }
|
|
124
|
-
if (filters === void 0) { filters = []; }
|
|
125
|
-
var query = {};
|
|
126
|
-
if (!search && (!filters || !filters.length)) {
|
|
127
|
-
query = {};
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
if (filters && filters.length) {
|
|
131
|
-
query['$and'] = [];
|
|
132
|
-
filters.forEach(function (filter) {
|
|
133
|
-
var _a;
|
|
134
|
-
if (filters.filter(function (a) { return a.prop === 'job'; }).length) {
|
|
135
|
-
if (filters.filter(function (a) { return a.prop === 'job'; })[0].data) {
|
|
136
|
-
query['$and'].push({
|
|
137
|
-
$or: [
|
|
138
|
-
{ type: 'request' },
|
|
139
|
-
{ type: 'initIso' },
|
|
140
|
-
{ type: 'return' },
|
|
141
|
-
{ type: 'returnIso' },
|
|
142
|
-
{ type: 'transferOut' },
|
|
143
|
-
{ type: 'transferIn' }
|
|
144
|
-
]
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
query['$and'].push({
|
|
149
|
-
$or: [
|
|
150
|
-
{ type: 'Customer Pickup' },
|
|
151
|
-
{ type: 'Direct Sale' },
|
|
152
|
-
{ type: 'Third Party' },
|
|
153
|
-
{ type: 'Sale Return' },
|
|
154
|
-
{ type: 'transferYard' }
|
|
155
|
-
]
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
filters.splice(filters.map(function (a) { return a.prop; }).indexOf('job'), 1);
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
query['$and'].push((_a = {}, _a[filter['prop']] = filter['data'], _a));
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
if (search && collectionType === 'jobs') {
|
|
166
|
-
var searchRegEx = { '$regex': '.*' + (search || '') + '.*', '$options': 'i' };
|
|
167
|
-
if (query['$and']) {
|
|
168
|
-
query['$and'].push({
|
|
169
|
-
$or: [
|
|
170
|
-
{
|
|
171
|
-
status: searchRegEx
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
operator: searchRegEx
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
pumping_company: searchRegEx
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
afe: searchRegEx
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
po: searchRegEx
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
county: searchRegEx
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
state: searchRegEx
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
well: searchRegEx
|
|
193
|
-
}
|
|
194
|
-
]
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
query = {
|
|
199
|
-
$or: [
|
|
200
|
-
{
|
|
201
|
-
status: searchRegEx
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
operator: searchRegEx
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
pumping_company: searchRegEx
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
afe: searchRegEx
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
po: searchRegEx
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
county: searchRegEx
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
state: searchRegEx
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
well: searchRegEx
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
else if (search && collectionType === 'chemicals') {
|
|
229
|
-
var searchRegEx = { '$regex': '.*' + (search || '') + '.*', '$options': 'i' };
|
|
230
|
-
if (query['$and']) {
|
|
231
|
-
query['$and'].push({
|
|
232
|
-
$or: [
|
|
233
|
-
{
|
|
234
|
-
chemical_category: searchRegEx
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
container: searchRegEx
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
type: searchRegEx
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
description: searchRegEx
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
quantity_string: searchRegEx
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
unit: searchRegEx
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
min_stock_string: searchRegEx
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
max_stock_string: searchRegEx
|
|
256
|
-
}
|
|
257
|
-
]
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
query = {
|
|
262
|
-
$or: [
|
|
263
|
-
{
|
|
264
|
-
chemical_category: searchRegEx
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
container: searchRegEx
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
type: searchRegEx
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
description: searchRegEx
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
quantity_string: searchRegEx
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
unit: searchRegEx
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
min_stock_string: searchRegEx
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
max_stock_string: searchRegEx
|
|
286
|
-
}
|
|
287
|
-
]
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
else if (search && collectionType === 'bols') {
|
|
292
|
-
var searchRegEx = { '$regex': '.*' + (search || '') + '.*', '$options': 'i' };
|
|
293
|
-
if (query['$and']) {
|
|
294
|
-
query['$and'].push({
|
|
295
|
-
$or: [
|
|
296
|
-
{
|
|
297
|
-
date_string: searchRegEx
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
bol_string: searchRegEx
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
chemical: searchRegEx
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
locTo: searchRegEx
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
locFrom: searchRegEx
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
quantity_string: searchRegEx
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
file_status: searchRegEx
|
|
316
|
-
}
|
|
317
|
-
]
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
else {
|
|
321
|
-
query = {
|
|
322
|
-
$or: [
|
|
323
|
-
{
|
|
324
|
-
date_string: searchRegEx
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
bol_string: searchRegEx
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
chemical: searchRegEx
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
locTo: searchRegEx
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
locFrom: searchRegEx
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
quantity_string: searchRegEx
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
file_status: searchRegEx
|
|
343
|
-
}
|
|
344
|
-
]
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
else if (search && collectionType === 'isotanks') {
|
|
349
|
-
var searchRegEx = { '$regex': '.*' + (search || '') + '.*', '$options': 'i' };
|
|
350
|
-
if (query['$and']) {
|
|
351
|
-
query['$and'].push({
|
|
352
|
-
$or: [
|
|
353
|
-
{
|
|
354
|
-
tank_number: searchRegEx
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
quantity_string: searchRegEx
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
current_location: searchRegEx
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
current_chemical: searchRegEx
|
|
364
|
-
}
|
|
365
|
-
]
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
query = {
|
|
370
|
-
$or: [
|
|
371
|
-
{
|
|
372
|
-
tank_number: searchRegEx
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
quantity_string: searchRegEx
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
current_location: searchRegEx
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
current_chemical: searchRegEx
|
|
382
|
-
}
|
|
383
|
-
]
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return __1.ResolveIOServer.getMainDB().model(collectionType).collection.countDocuments(query);
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
94
|
countCollection: {
|
|
392
95
|
skipQueue: true,
|
|
393
96
|
check: new simpl_schema_1.default({
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@resolveio/server-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"package": "npm pack ./dist",
|
|
7
|
+
"package": "npm run build-prod && npm pack ./dist",
|
|
8
8
|
"start": "node_modules/.bin/forever -c node --max-old-space-size=800 index.js",
|
|
9
9
|
"server": "node_modules/gulp/bin/gulp.js mongo-start && node_modules/gulp/bin/gulp.js",
|
|
10
10
|
"postserver": "node_modules/gulp/bin/gulp.js mongo-stop",
|
package/server-app.d.ts
CHANGED
|
@@ -4,19 +4,20 @@ import { MethodManager } from './managers/method.manager';
|
|
|
4
4
|
import { SubscriptionManager } from './managers/subscription.manager';
|
|
5
5
|
import { SupportManager } from './managers/support.manager';
|
|
6
6
|
import { QueueMethodManager } from './managers/queue-method.manager';
|
|
7
|
-
export
|
|
7
|
+
export default class ResolveIOMainServer {
|
|
8
8
|
private _app;
|
|
9
9
|
private _server;
|
|
10
10
|
private _port;
|
|
11
11
|
private _wss;
|
|
12
12
|
private _serverConfig;
|
|
13
|
+
private _clientDir;
|
|
13
14
|
private _resolveioServer;
|
|
14
15
|
private _subscriptionManager;
|
|
15
16
|
private _methodManager;
|
|
16
17
|
private _queueManager;
|
|
17
18
|
private _cronManager;
|
|
18
19
|
private _supportManager;
|
|
19
|
-
constructor(mainServer: any, serverConfig: any);
|
|
20
|
+
constructor(mainServer: any, serverConfig: any, clientDir: any);
|
|
20
21
|
getWS(id_ws: string): any;
|
|
21
22
|
getWSList(): any[];
|
|
22
23
|
getCronManager(): CronManager;
|
package/server-app.js
CHANGED
|
@@ -59,9 +59,10 @@ var subscription_manager_1 = require("./managers/subscription.manager");
|
|
|
59
59
|
var support_manager_1 = require("./managers/support.manager");
|
|
60
60
|
var queue_method_manager_1 = require("./managers/queue-method.manager");
|
|
61
61
|
var ResolveIOMainServer = /** @class */ (function () {
|
|
62
|
-
function ResolveIOMainServer(mainServer, serverConfig) {
|
|
62
|
+
function ResolveIOMainServer(mainServer, serverConfig, clientDir) {
|
|
63
63
|
this._resolveioServer = mainServer;
|
|
64
64
|
this._serverConfig = serverConfig;
|
|
65
|
+
this._clientDir = clientDir;
|
|
65
66
|
// process.on('unhandledException').
|
|
66
67
|
// Start express app
|
|
67
68
|
this._app = express();
|
|
@@ -204,7 +205,7 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
204
205
|
};
|
|
205
206
|
// Start Managers
|
|
206
207
|
this._subscriptionManager = new subscription_manager_1.SubscriptionManager(this, this._wss, this._serverConfig);
|
|
207
|
-
this._methodManager = new method_manager_1.MethodManager(this, this._serverConfig);
|
|
208
|
+
this._methodManager = new method_manager_1.MethodManager(this, this._serverConfig, this._clientDir);
|
|
208
209
|
this._supportManager = new support_manager_1.SupportManager(this, this._serverConfig);
|
|
209
210
|
this._cronManager = new cron_manager_1.CronManager(this);
|
|
210
211
|
this._queueManager = new queue_method_manager_1.QueueMethodManager(this);
|
|
@@ -279,7 +280,7 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
279
280
|
ws.terminate();
|
|
280
281
|
}, 5000);
|
|
281
282
|
}
|
|
282
|
-
if (method !== 'countQuery' && method !== 'countCollectionWithQuery' && method !== 'find' && method !== 'findOne' && method !== 'findWithOptions' && method !== 'setWSAppVersion') {
|
|
283
|
+
if (method !== 'generatePDF' && method !== 'getWOOfflineData' && method !== 'countQuery' && method !== 'countCollectionWithQuery' && method !== 'find' && method !== 'findOne' && method !== 'findWithOptions' && method !== 'setWSAppVersion') {
|
|
283
284
|
if (common_1.getBinarySize(JSON.stringify(data)) < 200000) {
|
|
284
285
|
log_collection_1.Logs.create({
|
|
285
286
|
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
@@ -307,6 +308,19 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
307
308
|
});
|
|
308
309
|
}
|
|
309
310
|
}
|
|
311
|
+
else {
|
|
312
|
+
log_collection_1.Logs.create({
|
|
313
|
+
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
314
|
+
date: new Date(),
|
|
315
|
+
type: 'client-request',
|
|
316
|
+
title: 'Client Request - Method',
|
|
317
|
+
message: 'User: ' + ws['user'] + ', Type: ' + type + ', MessageId: ' + messageId + ', Method: ' + method,
|
|
318
|
+
payload: 'Too Big',
|
|
319
|
+
method: method,
|
|
320
|
+
user: ws['user'],
|
|
321
|
+
messageId: messageId
|
|
322
|
+
});
|
|
323
|
+
}
|
|
310
324
|
serverRes = {
|
|
311
325
|
messageId: messageId,
|
|
312
326
|
hasError: false,
|
|
@@ -382,7 +396,7 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
382
396
|
case 8:
|
|
383
397
|
if (type === 'methodRetry') {
|
|
384
398
|
method = data.shift();
|
|
385
|
-
if (method !== 'countQuery' && method !== 'countCollectionWithQuery' && method !== 'find' && method !== 'findOne' && method !== 'findWithOptions' && method !== 'setWSAppVersion') {
|
|
399
|
+
if (method !== 'generatePDF' && method !== 'getWOOfflineData' && method !== 'countQuery' && method !== 'countCollectionWithQuery' && method !== 'find' && method !== 'findOne' && method !== 'findWithOptions' && method !== 'setWSAppVersion') {
|
|
386
400
|
if (common_1.getBinarySize(JSON.stringify(data)) < 200000) {
|
|
387
401
|
log_collection_1.Logs.create({
|
|
388
402
|
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
@@ -410,6 +424,19 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
410
424
|
});
|
|
411
425
|
}
|
|
412
426
|
}
|
|
427
|
+
else {
|
|
428
|
+
log_collection_1.Logs.create({
|
|
429
|
+
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
430
|
+
date: new Date(),
|
|
431
|
+
type: 'client-request',
|
|
432
|
+
title: 'Client Request - Method Retry',
|
|
433
|
+
message: 'User: ' + ws['user'] + ', Type: ' + type + ', MessageId: ' + messageId + ', Method: ' + method,
|
|
434
|
+
payload: 'Too Big',
|
|
435
|
+
method: method,
|
|
436
|
+
user: ws['user'],
|
|
437
|
+
messageId: messageId
|
|
438
|
+
});
|
|
439
|
+
}
|
|
413
440
|
method_call_collection_1.MethodCalls.findOne({ $and: [
|
|
414
441
|
{ id_user: ws['id_user'] },
|
|
415
442
|
{ message_id: messageId },
|
|
@@ -450,7 +477,7 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
450
477
|
}
|
|
451
478
|
else if (type === 'methodResponse') {
|
|
452
479
|
method = data.shift();
|
|
453
|
-
if (method !== 'countQuery' && method !== 'countCollectionWithQuery' && method !== 'find' && method !== 'findOne' && method !== 'findWithOptions' && method !== 'setWSAppVersion') {
|
|
480
|
+
if (method !== 'generatePDF' && method !== 'getWOOfflineData' && method !== 'countQuery' && method !== 'countCollectionWithQuery' && method !== 'find' && method !== 'findOne' && method !== 'findWithOptions' && method !== 'setWSAppVersion') {
|
|
454
481
|
if (common_1.getBinarySize(JSON.stringify(data)) < 200000) {
|
|
455
482
|
log_collection_1.Logs.create({
|
|
456
483
|
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
@@ -478,6 +505,19 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
478
505
|
});
|
|
479
506
|
}
|
|
480
507
|
}
|
|
508
|
+
else {
|
|
509
|
+
log_collection_1.Logs.create({
|
|
510
|
+
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
511
|
+
date: new Date(),
|
|
512
|
+
type: 'client-request',
|
|
513
|
+
title: 'Client Request - Method Response',
|
|
514
|
+
message: 'User: ' + ws['user'] + ', Type: ' + type + ', MessageId: ' + messageId + ', Method: ' + method,
|
|
515
|
+
payload: 'Too Big',
|
|
516
|
+
method: method,
|
|
517
|
+
user: ws['user'],
|
|
518
|
+
messageId: messageId
|
|
519
|
+
});
|
|
520
|
+
}
|
|
481
521
|
method_response_collection_1.MethodResponses.findOne({ $and: [
|
|
482
522
|
{ id_user: ws['id_user'] },
|
|
483
523
|
{ message_id: messageId },
|
|
@@ -595,4 +635,46 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
595
635
|
};
|
|
596
636
|
return ResolveIOMainServer;
|
|
597
637
|
}());
|
|
598
|
-
exports.
|
|
638
|
+
exports.default = ResolveIOMainServer;
|
|
639
|
+
// export * from './collections/active-subscription.collection';
|
|
640
|
+
// export * from './collections/app-status.collection';
|
|
641
|
+
// export * from './collections/app-version.collection';
|
|
642
|
+
// export * from './collections/counter.collection';
|
|
643
|
+
// export * from './collections/cron-job-history.collection';
|
|
644
|
+
// export * from './collections/cron-job.collection';
|
|
645
|
+
// export * from './collections/file.collection';
|
|
646
|
+
// export * from './collections/flag.collection';
|
|
647
|
+
// export * from './collections/log.collection';
|
|
648
|
+
// export * from './collections/logged-in-users.collection';
|
|
649
|
+
// export * from './collections/method-call.collection';
|
|
650
|
+
// export * from './collections/method-response.collection';
|
|
651
|
+
// export * from './collections/queue-flag.collection';
|
|
652
|
+
// export * from './collections/queue-method.collection';
|
|
653
|
+
// export * from './collections/queue-response.collection';
|
|
654
|
+
// export * from './collections/support-ticket.collection';
|
|
655
|
+
// export * from './collections/user.collection';
|
|
656
|
+
// export * from './managers/cron.manager';
|
|
657
|
+
// export * from './managers/method.manager';
|
|
658
|
+
// export * from './managers/queue-method.manager';
|
|
659
|
+
// export * from './managers/subscription.manager';
|
|
660
|
+
// export * from './managers/support.manager';
|
|
661
|
+
// export * from './models/active-subscription.model';
|
|
662
|
+
// export * from './models/app-status.model';
|
|
663
|
+
// export * from './models/app-version.model';
|
|
664
|
+
// export * from './models/collection-document.model';
|
|
665
|
+
// export * from './models/counter.model';
|
|
666
|
+
// // export * from './models/cron-job-history.model';
|
|
667
|
+
// export * from './models/cron-job.model';
|
|
668
|
+
// export * from './models/dialog.model';
|
|
669
|
+
// export * from './models/file.model';
|
|
670
|
+
// export * from './models/flag.model';
|
|
671
|
+
// export * from './models/log.model';
|
|
672
|
+
// export * from './models/method.model';
|
|
673
|
+
// export * from './models/pagination.model';
|
|
674
|
+
// export * from './models/permission.model';
|
|
675
|
+
// export * from './models/select-data-label.model';
|
|
676
|
+
// export * from './models/server-response.model';
|
|
677
|
+
// export * from './models/support-method.model';
|
|
678
|
+
// export * from './models/support-ticket.model';
|
|
679
|
+
// export * from './models/user.model';
|
|
680
|
+
// export * from './util/common';
|