@resolveio/server-lib 4.0.11-newrole → 4.0.11
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 +32 -39
- package/fixtures/init.js +1 -1
- package/index.d.ts +1 -1
- package/managers/method.manager.d.ts +3 -3
- package/managers/method.manager.js +1 -1
- package/managers/subscription.manager.js +26 -21
- package/managers/support.manager.d.ts +2 -2
- package/managers/support.manager.js +1 -1
- package/package.json +1 -1
- package/server-app.js +4 -2
|
@@ -21,6 +21,13 @@ var schema = {
|
|
|
21
21
|
type: Date,
|
|
22
22
|
optional: true
|
|
23
23
|
},
|
|
24
|
+
readonly: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
optional: true
|
|
27
|
+
},
|
|
28
|
+
active: {
|
|
29
|
+
type: Boolean
|
|
30
|
+
},
|
|
24
31
|
attempts: {
|
|
25
32
|
type: Number,
|
|
26
33
|
optional: true
|
|
@@ -57,67 +64,53 @@ var schema = {
|
|
|
57
64
|
type: String
|
|
58
65
|
},
|
|
59
66
|
roles: {
|
|
60
|
-
type: Object
|
|
61
|
-
},
|
|
62
|
-
'roles.super_admin': {
|
|
63
|
-
type: Boolean
|
|
64
|
-
},
|
|
65
|
-
'roles.approvals': {
|
|
66
67
|
type: Array
|
|
67
68
|
},
|
|
68
|
-
'roles
|
|
69
|
-
type: Object
|
|
70
|
-
},
|
|
71
|
-
'roles.approvals.$.name': {
|
|
69
|
+
'roles.$': {
|
|
72
70
|
type: String
|
|
73
71
|
},
|
|
74
|
-
|
|
75
|
-
type: String
|
|
72
|
+
phonenumber: {
|
|
73
|
+
type: String,
|
|
74
|
+
optional: true
|
|
76
75
|
},
|
|
77
|
-
|
|
78
|
-
type:
|
|
76
|
+
other: {
|
|
77
|
+
type: Object,
|
|
78
|
+
blackbox: true,
|
|
79
|
+
optional: true
|
|
79
80
|
},
|
|
80
|
-
|
|
81
|
-
type: Array
|
|
81
|
+
assets: {
|
|
82
|
+
type: Array,
|
|
83
|
+
optional: true
|
|
82
84
|
},
|
|
83
|
-
'
|
|
85
|
+
'assets.$': {
|
|
84
86
|
type: Object
|
|
85
87
|
},
|
|
86
|
-
'
|
|
88
|
+
'assets.$.type': {
|
|
87
89
|
type: String
|
|
88
90
|
},
|
|
89
|
-
'
|
|
90
|
-
type: Array
|
|
91
|
-
},
|
|
92
|
-
'roles.groups.$.views.$': {
|
|
91
|
+
'assets.$.id_asset': {
|
|
93
92
|
type: String
|
|
94
93
|
},
|
|
95
|
-
'
|
|
96
|
-
type: String
|
|
97
|
-
optional: true
|
|
94
|
+
'assets.$.asset_number': {
|
|
95
|
+
type: String
|
|
98
96
|
},
|
|
99
|
-
'
|
|
100
|
-
type:
|
|
97
|
+
'assets.$.ownership': {
|
|
98
|
+
type: String
|
|
101
99
|
},
|
|
102
|
-
'
|
|
100
|
+
'assets.$.ownership_driver': {
|
|
103
101
|
type: String
|
|
104
102
|
},
|
|
105
|
-
'
|
|
106
|
-
type:
|
|
103
|
+
'assets.$.date_start': {
|
|
104
|
+
type: Date
|
|
107
105
|
},
|
|
108
|
-
'
|
|
109
|
-
type:
|
|
106
|
+
'assets.$.date_end': {
|
|
107
|
+
type: Date,
|
|
108
|
+
optional: true
|
|
110
109
|
},
|
|
111
|
-
|
|
112
|
-
phonenumber: {
|
|
110
|
+
id_function: {
|
|
113
111
|
type: String,
|
|
114
112
|
optional: true
|
|
115
113
|
},
|
|
116
|
-
other: {
|
|
117
|
-
type: Object,
|
|
118
|
-
optional: true,
|
|
119
|
-
blackbox: true
|
|
120
|
-
},
|
|
121
114
|
customers: {
|
|
122
115
|
type: Array,
|
|
123
116
|
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;
|
package/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class ResolveIOServer {
|
|
|
8
8
|
private static _clientDir;
|
|
9
9
|
private static _dontRunSupport;
|
|
10
10
|
constructor(serverConfig: any, client: string, clientDir: any, _dontRunSupport?: any);
|
|
11
|
-
static connectAndRun(): Promise<
|
|
11
|
+
static connectAndRun(): Promise<unknown>;
|
|
12
12
|
static getClientName(): string;
|
|
13
13
|
static getMainServer(): ResolveIOMainServer;
|
|
14
14
|
static getMainDB(): any;
|
|
@@ -16,13 +16,13 @@ export declare class MethodManager {
|
|
|
16
16
|
getMainServer(): ResolveIOMainServer;
|
|
17
17
|
methods(method: MethodModel): void;
|
|
18
18
|
callMethodCron(method: string, ...methodData: any[]): void;
|
|
19
|
-
callMethodQueue(update: QueueMethodModel): Promise<
|
|
19
|
+
callMethodQueue(update: QueueMethodModel): Promise<unknown>;
|
|
20
20
|
callMethod(ws: WebSocket, messageDate: Date, messageId: number, method: string, ...methodData: any[]): void;
|
|
21
21
|
callMethodInternal(method: any, ...methodData: any[]): Promise<any>;
|
|
22
22
|
callSupportMethodInternal(supportMethod: any, ...methodData: any[]): Promise<any>;
|
|
23
23
|
private sendWS;
|
|
24
24
|
sendEmail(sendTo: string, subject: string, text?: string, html?: string, attachments?: any[], send_from?: string): void;
|
|
25
25
|
getAWS(): aws.S3;
|
|
26
|
-
readFile(fileName: any): Promise<
|
|
27
|
-
readImage(fileName: any): Promise<
|
|
26
|
+
readFile(fileName: any): Promise<unknown>;
|
|
27
|
+
readImage(fileName: any): Promise<unknown>;
|
|
28
28
|
}
|
|
@@ -361,8 +361,8 @@ var MethodManager = /** @class */ (function () {
|
|
|
361
361
|
};
|
|
362
362
|
// Call/run method (Emit on Socket)
|
|
363
363
|
MethodManager.prototype.callMethod = function (ws, messageDate, messageId, method) {
|
|
364
|
-
var _this = this;
|
|
365
364
|
var _a;
|
|
365
|
+
var _this = this;
|
|
366
366
|
var methodData = [];
|
|
367
367
|
for (var _i = 4; _i < arguments.length; _i++) {
|
|
368
368
|
methodData[_i - 4] = arguments[_i];
|
|
@@ -137,7 +137,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
137
137
|
subscriptionData[_i - 3] = arguments[_i];
|
|
138
138
|
}
|
|
139
139
|
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
-
var
|
|
140
|
+
var that, pub, valObj, valKeys, rootKeys, i, sub, _a, newActiveSub, begDate, endDate, billUser;
|
|
141
|
+
var _b;
|
|
141
142
|
return __generator(this, function (_c) {
|
|
142
143
|
switch (_c.label) {
|
|
143
144
|
case 0:
|
|
@@ -202,10 +203,10 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
202
203
|
// Send pub data to client who just subscribed only, don't want to send to existing clients since nothing has changed
|
|
203
204
|
that.sendPubDataOnce(ws, messageId, sub);
|
|
204
205
|
if (!(that._publications[sub.publication].preFunction && !sub.preSubscriptionData)) return [3 /*break*/, 3];
|
|
205
|
-
|
|
206
|
-
return [4 /*yield*/, (
|
|
206
|
+
_a = sub;
|
|
207
|
+
return [4 /*yield*/, (_b = that._publications[sub.publication]).preFunction.apply(_b, sub.subscriptionData)];
|
|
207
208
|
case 2:
|
|
208
|
-
|
|
209
|
+
_a.preSubscriptionData = _c.sent();
|
|
209
210
|
_c.label = 3;
|
|
210
211
|
case 3:
|
|
211
212
|
newActiveSub = new active_subscription_collection_1.ActiveSubscriptions({
|
|
@@ -553,7 +554,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
553
554
|
if (noFetchFunction === void 0) { noFetchFunction = false; }
|
|
554
555
|
var that = this;
|
|
555
556
|
that._subscriptions.filter(function (a) { return a.collections.includes(collection); }).forEach(function (sub) { return __awaiter(_this, void 0, void 0, function () {
|
|
556
|
-
var
|
|
557
|
+
var schemaErrors, _a, _b;
|
|
558
|
+
var _c, _d;
|
|
557
559
|
return __generator(this, function (_e) {
|
|
558
560
|
switch (_e.label) {
|
|
559
561
|
case 0:
|
|
@@ -573,18 +575,18 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
573
575
|
if (!sub.preSubscriptionData) return [3 /*break*/, 4];
|
|
574
576
|
if (!that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) return [3 /*break*/, 4];
|
|
575
577
|
that.sendPubData(sub);
|
|
576
|
-
|
|
577
|
-
return [4 /*yield*/, (
|
|
578
|
+
_a = sub;
|
|
579
|
+
return [4 /*yield*/, (_c = that._publications[sub.publication]).preFunction.apply(_c, sub.subscriptionData)];
|
|
578
580
|
case 3:
|
|
579
|
-
|
|
581
|
+
_a.preSubscriptionData = _e.sent();
|
|
580
582
|
return [2 /*return*/];
|
|
581
583
|
case 4:
|
|
582
584
|
if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 7];
|
|
583
585
|
if (!!noFetchFunction) return [3 /*break*/, 6];
|
|
584
|
-
|
|
586
|
+
_b = sub;
|
|
585
587
|
return [4 /*yield*/, that._publications[sub.publication].preFunction(sub.subscriptionData)];
|
|
586
588
|
case 5:
|
|
587
|
-
|
|
589
|
+
_b.preSubscriptionData = _e.sent();
|
|
588
590
|
if (that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) {
|
|
589
591
|
that.sendPubData(sub);
|
|
590
592
|
}
|
|
@@ -617,7 +619,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
617
619
|
else {
|
|
618
620
|
if (that._publications[sub.publication].fetchFunction) {
|
|
619
621
|
if (!noFetchFunction) {
|
|
620
|
-
if ((
|
|
622
|
+
if ((_d = that._publications[sub.publication]).fetchFunction.apply(_d, [document].concat(sub.subscriptionData))) {
|
|
621
623
|
that.sendPubData(sub);
|
|
622
624
|
}
|
|
623
625
|
}
|
|
@@ -636,7 +638,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
636
638
|
var _this = this;
|
|
637
639
|
var that = this;
|
|
638
640
|
that._subscriptions.filter(function (a) { return a.collections.includes(collection); }).forEach(function (sub) { return __awaiter(_this, void 0, void 0, function () {
|
|
639
|
-
var
|
|
641
|
+
var schemaErrors, _a, _b;
|
|
642
|
+
var _c, _d, _e;
|
|
640
643
|
return __generator(this, function (_f) {
|
|
641
644
|
switch (_f.label) {
|
|
642
645
|
case 0:
|
|
@@ -656,17 +659,17 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
656
659
|
if (!sub.preSubscriptionData) return [3 /*break*/, 4];
|
|
657
660
|
if (!that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) return [3 /*break*/, 4];
|
|
658
661
|
that.sendPubData(sub);
|
|
659
|
-
|
|
660
|
-
return [4 /*yield*/, (
|
|
662
|
+
_a = sub;
|
|
663
|
+
return [4 /*yield*/, (_c = that._publications[sub.publication]).preFunction.apply(_c, sub.subscriptionData)];
|
|
661
664
|
case 3:
|
|
662
|
-
|
|
665
|
+
_a.preSubscriptionData = _f.sent();
|
|
663
666
|
return [2 /*return*/];
|
|
664
667
|
case 4:
|
|
665
668
|
if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 6];
|
|
666
|
-
|
|
667
|
-
return [4 /*yield*/, (
|
|
669
|
+
_b = sub;
|
|
670
|
+
return [4 /*yield*/, (_d = that._publications[sub.publication]).preFunction.apply(_d, sub.subscriptionData)];
|
|
668
671
|
case 5:
|
|
669
|
-
|
|
672
|
+
_b.preSubscriptionData = _f.sent();
|
|
670
673
|
if (that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) {
|
|
671
674
|
that.sendPubData(sub);
|
|
672
675
|
}
|
|
@@ -695,7 +698,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
695
698
|
}
|
|
696
699
|
else {
|
|
697
700
|
if (that._publications[sub.publication].fetchFunction) {
|
|
698
|
-
if ((
|
|
701
|
+
if ((_e = that._publications[sub.publication]).fetchFunction.apply(_e, [document].concat(sub.subscriptionData))) {
|
|
699
702
|
that.sendPubData(sub);
|
|
700
703
|
}
|
|
701
704
|
}
|
|
@@ -712,7 +715,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
712
715
|
// Fetch pub once, send to all clients linked to this pub
|
|
713
716
|
SubscriptionManager.prototype.sendPubDataOnce = function (ws, messageId, subscription) {
|
|
714
717
|
return __awaiter(this, void 0, void 0, function () {
|
|
715
|
-
var
|
|
718
|
+
var that;
|
|
719
|
+
var _a, _b;
|
|
716
720
|
var _this = this;
|
|
717
721
|
return __generator(this, function (_c) {
|
|
718
722
|
that = this;
|
|
@@ -757,7 +761,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
757
761
|
// Fetch pub once, send to all clients linked to this pub
|
|
758
762
|
SubscriptionManager.prototype.sendPubData = function (subscription) {
|
|
759
763
|
return __awaiter(this, void 0, void 0, function () {
|
|
760
|
-
var
|
|
764
|
+
var that;
|
|
765
|
+
var _a;
|
|
761
766
|
var _this = this;
|
|
762
767
|
return __generator(this, function (_b) {
|
|
763
768
|
that = this;
|
|
@@ -17,6 +17,6 @@ export declare class SupportManager {
|
|
|
17
17
|
callMethodInternal(method: any, ...methodData: any[]): Promise<any>;
|
|
18
18
|
private sendWS;
|
|
19
19
|
sendEmail(sendTo: string, subject: string, text?: string, html?: string, attachments?: any[], from?: string): void;
|
|
20
|
-
readFile(fileName: any): Promise<
|
|
21
|
-
readImage(fileName: any): Promise<
|
|
20
|
+
readFile(fileName: any): Promise<unknown>;
|
|
21
|
+
readImage(fileName: any): Promise<unknown>;
|
|
22
22
|
}
|
|
@@ -102,8 +102,8 @@ var SupportManager = /** @class */ (function () {
|
|
|
102
102
|
};
|
|
103
103
|
// Call/run method (Emit on Socket)
|
|
104
104
|
SupportManager.prototype.callSupportMethod = function (ws, messageId, supportMethod) {
|
|
105
|
-
var _this = this;
|
|
106
105
|
var _a;
|
|
106
|
+
var _this = this;
|
|
107
107
|
var methodData = [];
|
|
108
108
|
for (var _i = 3; _i < arguments.length; _i++) {
|
|
109
109
|
methodData[_i - 3] = arguments[_i];
|
package/package.json
CHANGED
package/server-app.js
CHANGED
|
@@ -253,7 +253,8 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
253
253
|
}, 10000);
|
|
254
254
|
// On data received (message)
|
|
255
255
|
ws.on('message', function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
256
|
-
var
|
|
256
|
+
var socketData, data, messageDate, messageId, type, subType, pub;
|
|
257
|
+
var _a, _b;
|
|
257
258
|
var _this = this;
|
|
258
259
|
return __generator(this, function (_c) {
|
|
259
260
|
socketData = JSON.parse(message, common_1.dateReviver);
|
|
@@ -328,7 +329,8 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
328
329
|
if (!!this._msgQueueRunning) return [3 /*break*/, 5];
|
|
329
330
|
this._msgQueueRunning = true;
|
|
330
331
|
_loop_1 = function (i) {
|
|
331
|
-
var
|
|
332
|
+
var msg, data, ws, messageDate, messageId, type, method, serverRes, query, methodCall, supportMethod, serverRes;
|
|
333
|
+
var _a, _b;
|
|
332
334
|
return __generator(this, function (_c) {
|
|
333
335
|
switch (_c.label) {
|
|
334
336
|
case 0:
|