@resolveio/server-lib 5.2.68 → 5.2.70-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/collections/user.collection.js +39 -32
- package/collections/user.collection.js.map +1 -1
- package/fixtures/init.js +1 -1
- package/fixtures/init.js.map +1 -1
- package/managers/method.manager.js +1 -1
- package/managers/method.manager.js.map +1 -1
- package/managers/subscription.manager.js +89 -66
- package/managers/subscription.manager.js.map +1 -1
- package/methods/accounts.js.map +1 -1
- package/methods/cron-jobs.js.map +1 -1
- package/package.json +1 -1
- package/server-app.js +3 -3
- package/server-app.js.map +1 -1
|
@@ -461,57 +461,66 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
461
461
|
});
|
|
462
462
|
oplog.on('insert', function (doc) {
|
|
463
463
|
var nsArray = doc.ns.split('.');
|
|
464
|
-
var
|
|
465
|
-
if (
|
|
466
|
-
collection
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
464
|
+
var database = nsArray[0];
|
|
465
|
+
if (_this.serverConfig['DATABASE'] === database) {
|
|
466
|
+
var collection = nsArray[1];
|
|
467
|
+
if (nsArray[2]) {
|
|
468
|
+
collection += '.' + nsArray[2];
|
|
469
|
+
}
|
|
470
|
+
if (collection === 'cron-jobs') {
|
|
471
|
+
_this._mainServer.getCronManager().checkCronJobsForUpdates();
|
|
472
|
+
}
|
|
473
|
+
else if (collection === 'queue-methods') {
|
|
474
|
+
_this._mainServer.getQueueManager().runMethodQueue();
|
|
475
|
+
}
|
|
476
|
+
else if (collection === 'queue-responses') {
|
|
477
|
+
_this._mainServer.getQueueManager().runMethodResponse();
|
|
478
|
+
}
|
|
479
|
+
else if (collection === 'support-tickets' && _this.serverConfig['ROOT_URL'] !== 'http://localhost:4200') {
|
|
480
|
+
_this._mainServer.getMethodManager().callMethodInternal('sendSupportTicketEmail', doc.o._id);
|
|
481
|
+
}
|
|
482
|
+
if (!collection.endsWith('.versions') && !collection.startsWith('system.')) {
|
|
483
|
+
_this._oplogQueue.push({
|
|
484
|
+
type: 'insert',
|
|
485
|
+
collection: collection,
|
|
486
|
+
doc: doc.o
|
|
487
|
+
});
|
|
488
|
+
}
|
|
486
489
|
}
|
|
487
490
|
});
|
|
488
491
|
oplog.on('update', function (doc) {
|
|
489
492
|
var nsArray = doc.ns.split('.');
|
|
490
|
-
var
|
|
491
|
-
if (
|
|
492
|
-
collection
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
493
|
+
var database = nsArray[0];
|
|
494
|
+
if (_this.serverConfig['DATABASE'] === database) {
|
|
495
|
+
var collection = nsArray[1];
|
|
496
|
+
if (nsArray[2]) {
|
|
497
|
+
collection += '.' + nsArray[2];
|
|
498
|
+
}
|
|
499
|
+
doc.o['_id'] = doc.o2['_id'];
|
|
500
|
+
if (collection === 'cron-jobs') {
|
|
501
|
+
_this._mainServer.getCronManager().checkCronJobsForUpdates();
|
|
502
|
+
}
|
|
503
|
+
if (!collection.endsWith('.versions') && !collection.startsWith('system.')) {
|
|
504
|
+
_this._oplogQueue.push({
|
|
505
|
+
type: 'update',
|
|
506
|
+
collection: collection,
|
|
507
|
+
doc: doc.o
|
|
508
|
+
});
|
|
509
|
+
}
|
|
504
510
|
}
|
|
505
511
|
});
|
|
506
512
|
oplog.on('delete', function (doc) {
|
|
507
513
|
var nsArray = doc.ns.split('.');
|
|
508
|
-
var
|
|
509
|
-
if (
|
|
510
|
-
collection
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
514
|
+
var database = nsArray[0];
|
|
515
|
+
if (_this.serverConfig['DATABASE'] === database) {
|
|
516
|
+
var collection = nsArray[1];
|
|
517
|
+
if (nsArray[2]) {
|
|
518
|
+
collection += '.' + nsArray[2];
|
|
519
|
+
}
|
|
520
|
+
that.resendPubsForDelete(collection);
|
|
521
|
+
if (collection === 'cron-jobs') {
|
|
522
|
+
_this._mainServer.getCronManager().checkCronJobsForUpdates();
|
|
523
|
+
}
|
|
515
524
|
}
|
|
516
525
|
});
|
|
517
526
|
oplog.on('error', function (error) {
|
|
@@ -545,33 +554,42 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
545
554
|
});
|
|
546
555
|
oplog.on('insert', function (doc) {
|
|
547
556
|
var nsArray = doc.ns.split('.');
|
|
548
|
-
var
|
|
549
|
-
if (
|
|
550
|
-
collection
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
557
|
+
var database = nsArray[0];
|
|
558
|
+
if (_this.serverConfig['DATABASE'] === database) {
|
|
559
|
+
var collection = nsArray[1];
|
|
560
|
+
if (nsArray[2]) {
|
|
561
|
+
collection += '.' + nsArray[2];
|
|
562
|
+
}
|
|
563
|
+
if (collection === 'support-tickets') {
|
|
564
|
+
that.checkSupportPubsForChanges(collection, doc.o);
|
|
565
|
+
}
|
|
554
566
|
}
|
|
555
567
|
});
|
|
556
568
|
oplog.on('update', function (doc) {
|
|
557
569
|
var nsArray = doc.ns.split('.');
|
|
558
|
-
var
|
|
559
|
-
if (
|
|
560
|
-
collection
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
570
|
+
var database = nsArray[0];
|
|
571
|
+
if (_this.serverConfig['DATABASE'] === database) {
|
|
572
|
+
var collection = nsArray[1];
|
|
573
|
+
if (nsArray[2]) {
|
|
574
|
+
collection += '.' + nsArray[2];
|
|
575
|
+
}
|
|
576
|
+
doc.o['_id'] = doc.o2['_id'];
|
|
577
|
+
if (collection === 'support-tickets') {
|
|
578
|
+
that.checkSupportPubsForChanges(collection, doc.o);
|
|
579
|
+
}
|
|
565
580
|
}
|
|
566
581
|
});
|
|
567
582
|
oplog.on('delete', function (doc) {
|
|
568
583
|
var nsArray = doc.ns.split('.');
|
|
569
|
-
var
|
|
570
|
-
if (
|
|
571
|
-
collection
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
584
|
+
var database = nsArray[0];
|
|
585
|
+
if (_this.serverConfig['DATABASE'] === database) {
|
|
586
|
+
var collection = nsArray[1];
|
|
587
|
+
if (nsArray[2]) {
|
|
588
|
+
collection += '.' + nsArray[2];
|
|
589
|
+
}
|
|
590
|
+
if (collection === 'support-tickets') {
|
|
591
|
+
that.resendPubsForDelete(collection);
|
|
592
|
+
}
|
|
575
593
|
}
|
|
576
594
|
});
|
|
577
595
|
oplog.on('error', function (error) {
|
|
@@ -644,10 +662,15 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
644
662
|
case 1:
|
|
645
663
|
docs = _a.sent();
|
|
646
664
|
needIds_1[collection].forEach(function (id_doc) {
|
|
647
|
-
if (uniqueOplog_1.filter(function (a) { return a.doc && a.doc._id === id_doc; })[0]
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
665
|
+
if (uniqueOplog_1.filter(function (a) { return a.doc && a.doc._id === id_doc; })[0]) {
|
|
666
|
+
if (docs.filter(function (a) { return a._id === id_doc; })[0]) {
|
|
667
|
+
uniqueOplog_1.filter(function (a) { return a.doc && a.doc._id === id_doc; }).forEach(function (op) {
|
|
668
|
+
op.doc = docs.filter(function (a) { return a._id === id_doc; })[0];
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
uniqueOplog_1.splice(uniqueOplog_1.findIndex(function (a) { return a.doc && a.doc._id === id_doc; })[0], 1);
|
|
673
|
+
}
|
|
651
674
|
}
|
|
652
675
|
else {
|
|
653
676
|
_this._mainServer.getMethodManager().sendEmail('dev@resolveio.com', 'SERVER - Oplog Doc Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'id_doc: ' + id_doc + ', UniqueOplogs: ' + JSON.stringify(uniqueOplog_1, null, 2));
|