@resolveio/server-lib 4.3.11 → 4.3.12
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/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(id_methodLatency: string, 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
|
}
|
|
@@ -416,8 +416,8 @@ var MethodManager = /** @class */ (function () {
|
|
|
416
416
|
};
|
|
417
417
|
// Call/run method (Emit on Socket)
|
|
418
418
|
MethodManager.prototype.callMethod = function (id_methodLatency, ws, messageDate, messageId, method) {
|
|
419
|
-
var _this = this;
|
|
420
419
|
var _a;
|
|
420
|
+
var _this = this;
|
|
421
421
|
var methodData = [];
|
|
422
422
|
for (var _i = 5; _i < arguments.length; _i++) {
|
|
423
423
|
methodData[_i - 5] = arguments[_i];
|
|
@@ -137,7 +137,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
137
137
|
subscriptionData[_i - 4] = 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:
|
|
@@ -203,10 +204,10 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
203
204
|
// Send pub data to client who just subscribed only, don't want to send to existing clients since nothing has changed
|
|
204
205
|
that.sendPubDataOnce(ws, messageId, sub, 'newSub', that.getPublicationCollections(publication)[0]);
|
|
205
206
|
if (!(that._publications[sub.publication].preFunction && !sub.preSubscriptionData)) return [3 /*break*/, 3];
|
|
206
|
-
|
|
207
|
-
return [4 /*yield*/, (
|
|
207
|
+
_a = sub;
|
|
208
|
+
return [4 /*yield*/, (_b = that._publications[sub.publication]).preFunction.apply(_b, sub.subscriptionData)];
|
|
208
209
|
case 2:
|
|
209
|
-
|
|
210
|
+
_a.preSubscriptionData = _c.sent();
|
|
210
211
|
_c.label = 3;
|
|
211
212
|
case 3:
|
|
212
213
|
newActiveSub = new active_subscription_collection_1.ActiveSubscriptions({
|
|
@@ -582,7 +583,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
582
583
|
if (!(i >= 0)) return [3 /*break*/, 10];
|
|
583
584
|
oplog = uniqueOplog_1[i];
|
|
584
585
|
_loop_4 = function (j) {
|
|
585
|
-
var
|
|
586
|
+
var sub, _a;
|
|
587
|
+
var _b;
|
|
586
588
|
return __generator(this, function (_c) {
|
|
587
589
|
switch (_c.label) {
|
|
588
590
|
case 0:
|
|
@@ -600,11 +602,11 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
600
602
|
}
|
|
601
603
|
}
|
|
602
604
|
if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 2];
|
|
603
|
-
|
|
605
|
+
_a = sub;
|
|
604
606
|
return [4 /*yield*/, that._publications[sub.publication].preFunction(sub.subscriptionData)];
|
|
605
607
|
case 1:
|
|
606
|
-
|
|
607
|
-
if (that._publications[sub.publication].fetchFunction(
|
|
608
|
+
_a.preSubscriptionData = _c.sent();
|
|
609
|
+
if (that._publications[sub.publication].fetchFunction(oplog.doc, sub.preSubscriptionData)) {
|
|
608
610
|
if (!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) {
|
|
609
611
|
uniquePubs.push(sub);
|
|
610
612
|
}
|
|
@@ -616,7 +618,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
616
618
|
return [3 /*break*/, 3];
|
|
617
619
|
case 2:
|
|
618
620
|
if (that._publications[sub.publication].fetchFunction) {
|
|
619
|
-
if ((
|
|
621
|
+
if ((_b = that._publications[sub.publication]).fetchFunction.apply(_b, [oplog.doc].concat(sub.subscriptionData))) {
|
|
620
622
|
if (!uniquePubs.filter(function (a) { return a.publication === sub.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(sub.subscriptionData); }).length) {
|
|
621
623
|
uniquePubs.push(sub);
|
|
622
624
|
}
|
|
@@ -694,7 +696,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
694
696
|
case 0:
|
|
695
697
|
that = this;
|
|
696
698
|
_loop_5 = function (i) {
|
|
697
|
-
var
|
|
699
|
+
var sub, _a, _b;
|
|
700
|
+
var _c, _d;
|
|
698
701
|
return __generator(this, function (_e) {
|
|
699
702
|
switch (_e.label) {
|
|
700
703
|
case 0:
|
|
@@ -702,17 +705,17 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
702
705
|
if (!sub.preSubscriptionData) return [3 /*break*/, 2];
|
|
703
706
|
if (!that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) return [3 /*break*/, 2];
|
|
704
707
|
that.sendPubData(sub, type, collection);
|
|
705
|
-
|
|
706
|
-
return [4 /*yield*/, (
|
|
708
|
+
_a = sub;
|
|
709
|
+
return [4 /*yield*/, (_c = that._publications[sub.publication]).preFunction.apply(_c, sub.subscriptionData)];
|
|
707
710
|
case 1:
|
|
708
|
-
|
|
711
|
+
_a.preSubscriptionData = _e.sent();
|
|
709
712
|
return [2 /*return*/, "continue"];
|
|
710
713
|
case 2:
|
|
711
714
|
if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 4];
|
|
712
|
-
|
|
715
|
+
_b = sub;
|
|
713
716
|
return [4 /*yield*/, that._publications[sub.publication].preFunction(sub.subscriptionData)];
|
|
714
717
|
case 3:
|
|
715
|
-
|
|
718
|
+
_b.preSubscriptionData = _e.sent();
|
|
716
719
|
if (that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) {
|
|
717
720
|
that.sendPubData(sub, type, collection);
|
|
718
721
|
}
|
|
@@ -741,7 +744,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
741
744
|
}
|
|
742
745
|
else {
|
|
743
746
|
if (that._publications[sub.publication].fetchFunction) {
|
|
744
|
-
if ((
|
|
747
|
+
if ((_d = that._publications[sub.publication]).fetchFunction.apply(_d, [document].concat(sub.subscriptionData))) {
|
|
745
748
|
that.sendPubData(sub, type, collection);
|
|
746
749
|
}
|
|
747
750
|
// else
|
|
@@ -775,7 +778,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
775
778
|
var _this = this;
|
|
776
779
|
var that = this;
|
|
777
780
|
that._subscriptions.filter(function (a) { return a.collections.includes(collection); }).forEach(function (sub) { return __awaiter(_this, void 0, void 0, function () {
|
|
778
|
-
var
|
|
781
|
+
var schemaErrors, _a, _b;
|
|
782
|
+
var _c, _d, _e;
|
|
779
783
|
return __generator(this, function (_f) {
|
|
780
784
|
switch (_f.label) {
|
|
781
785
|
case 0:
|
|
@@ -795,17 +799,17 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
795
799
|
if (!sub.preSubscriptionData) return [3 /*break*/, 4];
|
|
796
800
|
if (!that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) return [3 /*break*/, 4];
|
|
797
801
|
that.sendPubData(sub, 'support', collection);
|
|
798
|
-
|
|
799
|
-
return [4 /*yield*/, (
|
|
802
|
+
_a = sub;
|
|
803
|
+
return [4 /*yield*/, (_c = that._publications[sub.publication]).preFunction.apply(_c, sub.subscriptionData)];
|
|
800
804
|
case 3:
|
|
801
|
-
|
|
805
|
+
_a.preSubscriptionData = _f.sent();
|
|
802
806
|
return [2 /*return*/];
|
|
803
807
|
case 4:
|
|
804
808
|
if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 6];
|
|
805
|
-
|
|
806
|
-
return [4 /*yield*/, (
|
|
809
|
+
_b = sub;
|
|
810
|
+
return [4 /*yield*/, (_d = that._publications[sub.publication]).preFunction.apply(_d, sub.subscriptionData)];
|
|
807
811
|
case 5:
|
|
808
|
-
|
|
812
|
+
_b.preSubscriptionData = _f.sent();
|
|
809
813
|
if (that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) {
|
|
810
814
|
that.sendPubData(sub, 'support', collection);
|
|
811
815
|
}
|
|
@@ -834,7 +838,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
834
838
|
}
|
|
835
839
|
else {
|
|
836
840
|
if (that._publications[sub.publication].fetchFunction) {
|
|
837
|
-
if ((
|
|
841
|
+
if ((_e = that._publications[sub.publication]).fetchFunction.apply(_e, [document].concat(sub.subscriptionData))) {
|
|
838
842
|
that.sendPubData(sub, 'support', collection);
|
|
839
843
|
}
|
|
840
844
|
}
|
|
@@ -851,7 +855,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
851
855
|
// Fetch pub once, send to all clients linked to this pub
|
|
852
856
|
SubscriptionManager.prototype.sendPubDataOnce = function (ws, messageId, subscription, type, collection) {
|
|
853
857
|
return __awaiter(this, void 0, void 0, function () {
|
|
854
|
-
var
|
|
858
|
+
var that;
|
|
859
|
+
var _a, _b;
|
|
855
860
|
var _this = this;
|
|
856
861
|
return __generator(this, function (_c) {
|
|
857
862
|
that = this;
|
|
@@ -903,7 +908,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
903
908
|
// Fetch pub once, send to all clients linked to this pub
|
|
904
909
|
SubscriptionManager.prototype.sendPubData = function (subscription, type, collection) {
|
|
905
910
|
return __awaiter(this, void 0, void 0, function () {
|
|
906
|
-
var
|
|
911
|
+
var that;
|
|
912
|
+
var _a;
|
|
907
913
|
var _this = this;
|
|
908
914
|
return __generator(this, function (_b) {
|
|
909
915
|
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
|
@@ -254,7 +254,8 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
254
254
|
}, 10000);
|
|
255
255
|
// On data received (message)
|
|
256
256
|
ws.on('message', function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
257
|
-
var
|
|
257
|
+
var socketData, data, messageDate, messageId, type, subType, pub;
|
|
258
|
+
var _a, _b;
|
|
258
259
|
var _this = this;
|
|
259
260
|
return __generator(this, function (_c) {
|
|
260
261
|
socketData = JSON.parse(message, common_1.dateReviver);
|
|
@@ -329,7 +330,8 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
329
330
|
if (!!this._msgQueueRunning) return [3 /*break*/, 5];
|
|
330
331
|
this._msgQueueRunning = true;
|
|
331
332
|
_loop_1 = function (i) {
|
|
332
|
-
var
|
|
333
|
+
var msg, data, ws, messageDate, messageId, type, method, methodLatency, serverRes, query, methodCall, supportMethod, serverRes;
|
|
334
|
+
var _a, _b;
|
|
333
335
|
return __generator(this, function (_c) {
|
|
334
336
|
switch (_c.label) {
|
|
335
337
|
case 0:
|