@resolveio/server-lib 3.2.4-newrole → 3.2.5-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/managers/subscription.manager.js +25 -16
- package/package.json +1 -1
|
@@ -553,9 +553,9 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
553
553
|
if (noFetchFunction === void 0) { noFetchFunction = false; }
|
|
554
554
|
var that = this;
|
|
555
555
|
that._subscriptions.filter(function (a) { return a.collections.includes(collection); }).forEach(function (sub) { return __awaiter(_this, void 0, void 0, function () {
|
|
556
|
-
var _a, schemaErrors,
|
|
557
|
-
return __generator(this, function (
|
|
558
|
-
switch (
|
|
556
|
+
var _a, _b, schemaErrors, _c, _d;
|
|
557
|
+
return __generator(this, function (_e) {
|
|
558
|
+
switch (_e.label) {
|
|
559
559
|
case 0:
|
|
560
560
|
schemaErrors = null;
|
|
561
561
|
try {
|
|
@@ -567,21 +567,30 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
567
567
|
if (!schemaErrors) return [3 /*break*/, 2];
|
|
568
568
|
return [4 /*yield*/, index_1.ResolveIOServer.getMainDB().model(collection).findById(document['_id'])];
|
|
569
569
|
case 1:
|
|
570
|
-
document =
|
|
571
|
-
|
|
570
|
+
document = _e.sent();
|
|
571
|
+
_e.label = 2;
|
|
572
572
|
case 2:
|
|
573
|
-
if (!
|
|
574
|
-
if (
|
|
575
|
-
|
|
576
|
-
|
|
573
|
+
if (!sub.preSubscriptionData) return [3 /*break*/, 4];
|
|
574
|
+
if (!that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) return [3 /*break*/, 4];
|
|
575
|
+
that.sendPubData(sub);
|
|
576
|
+
_c = sub;
|
|
577
|
+
return [4 /*yield*/, (_a = that._publications[sub.publication]).preFunction.apply(_a, sub.subscriptionData)];
|
|
577
578
|
case 3:
|
|
578
|
-
|
|
579
|
+
_c.preSubscriptionData = _e.sent();
|
|
580
|
+
return [2 /*return*/];
|
|
581
|
+
case 4:
|
|
582
|
+
if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 7];
|
|
583
|
+
if (!!noFetchFunction) return [3 /*break*/, 6];
|
|
584
|
+
_d = sub;
|
|
585
|
+
return [4 /*yield*/, that._publications[sub.publication].preFunction(sub.subscriptionData)];
|
|
586
|
+
case 5:
|
|
587
|
+
_d.preSubscriptionData = _e.sent();
|
|
579
588
|
if (that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) {
|
|
580
589
|
that.sendPubData(sub);
|
|
581
590
|
}
|
|
582
|
-
|
|
583
|
-
case
|
|
584
|
-
case
|
|
591
|
+
_e.label = 6;
|
|
592
|
+
case 6: return [3 /*break*/, 8];
|
|
593
|
+
case 7:
|
|
585
594
|
if (that._publications[sub.publication].ws_specific) {
|
|
586
595
|
sub.clients.forEach(function (client) {
|
|
587
596
|
var _a;
|
|
@@ -608,7 +617,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
608
617
|
else {
|
|
609
618
|
if (that._publications[sub.publication].fetchFunction) {
|
|
610
619
|
if (!noFetchFunction) {
|
|
611
|
-
if ((
|
|
620
|
+
if ((_b = that._publications[sub.publication]).fetchFunction.apply(_b, [document].concat(sub.subscriptionData))) {
|
|
612
621
|
that.sendPubData(sub);
|
|
613
622
|
}
|
|
614
623
|
}
|
|
@@ -617,8 +626,8 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
617
626
|
that.sendPubData(sub);
|
|
618
627
|
}
|
|
619
628
|
}
|
|
620
|
-
|
|
621
|
-
case
|
|
629
|
+
_e.label = 8;
|
|
630
|
+
case 8: return [2 /*return*/];
|
|
622
631
|
}
|
|
623
632
|
});
|
|
624
633
|
}); });
|