@resolveio/server-lib 9.6.12 → 9.6.14

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.
@@ -389,6 +389,7 @@ var Collection = /** @class */ (function () {
389
389
  if (bypassLogs === void 0) { bypassLogs = false; }
390
390
  return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
391
391
  var docs, i, doc, versionDoc;
392
+ var _this = this;
392
393
  return __generator(this, function (_a) {
393
394
  switch (_a.label) {
394
395
  case 0:
@@ -420,6 +421,8 @@ var Collection = /** @class */ (function () {
420
421
  case 2:
421
422
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).deleteMany(filter, options).then(function (res) {
422
423
  if (res.result.ok) {
424
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
425
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'delete');
423
426
  resolve(res.deletedCount);
424
427
  }
425
428
  else {
@@ -463,6 +466,8 @@ var Collection = /** @class */ (function () {
463
466
  versionDoc['_id'] = { _id: doc['_id'], __v: doc['__v'] };
464
467
  index_1.ResolveIOServer.getMongoManager().collection(this.versionCollection).replaceOne({ _id: { _id: doc['_id'], __v: doc['__v'] } }, versionDoc, { upsert: true });
465
468
  }
469
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(this.collectionName);
470
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(this.collectionName, 'delete');
466
471
  resolve(1);
467
472
  }
468
473
  else {
@@ -475,6 +480,8 @@ var Collection = /** @class */ (function () {
475
480
  else {
476
481
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).deleteOne(filter, options).then(function (res) {
477
482
  if (res.result.ok) {
483
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
484
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'delete');
478
485
  resolve(res.deletedCount);
479
486
  }
480
487
  else {
@@ -677,6 +684,8 @@ var Collection = /** @class */ (function () {
677
684
  versionDoc['_id'] = { _id: doc['_id'], __v: doc['__v'] };
678
685
  index_1.ResolveIOServer.getMongoManager().collection(_this.versionCollection).replaceOne({ _id: { _id: doc['_id'], __v: doc['__v'] } }, versionDoc, { upsert: true });
679
686
  }
687
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
688
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'delete');
680
689
  resolve(doc);
681
690
  }
682
691
  else {
@@ -743,6 +752,8 @@ var Collection = /** @class */ (function () {
743
752
  versionDoc['_id'] = { _id: doc['_id'], __v: doc['__v'] };
744
753
  index_1.ResolveIOServer.getMongoManager().collection(_this.versionCollection).replaceOne({ _id: { _id: doc['_id'], __v: doc['__v'] } }, versionDoc, { upsert: true });
745
754
  }
755
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
756
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
746
757
  resolve(doc);
747
758
  }
748
759
  else {
@@ -826,6 +837,8 @@ var Collection = /** @class */ (function () {
826
837
  versionDoc['_id'] = { _id: doc['_id'], __v: doc['__v'] };
827
838
  index_1.ResolveIOServer.getMongoManager().collection(_this.versionCollection).replaceOne({ _id: { _id: doc['_id'], __v: doc['__v'] } }, versionDoc, { upsert: true });
828
839
  }
840
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
841
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
829
842
  resolve(doc);
830
843
  }
831
844
  else {
@@ -900,6 +913,8 @@ var Collection = /** @class */ (function () {
900
913
  if (validDocs.length) {
901
914
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).insertMany(validDocs, options).then(function (res) {
902
915
  if (res.result.ok) {
916
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
917
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'insert');
903
918
  resolve(validDocs);
904
919
  }
905
920
  else {
@@ -919,6 +934,7 @@ var Collection = /** @class */ (function () {
919
934
  if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
920
935
  return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
921
936
  var validation, isValid, date;
937
+ var _this = this;
922
938
  return __generator(this, function (_a) {
923
939
  if (!doc['_id']) {
924
940
  doc['_id'] = objectIdHexString();
@@ -957,6 +973,8 @@ var Collection = /** @class */ (function () {
957
973
  }
958
974
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).insertOne(doc, options).then(function (res) {
959
975
  if (res.result.ok) {
976
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
977
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'insert');
960
978
  resolve(doc);
961
979
  }
962
980
  else {
@@ -1043,6 +1061,8 @@ var Collection = /** @class */ (function () {
1043
1061
  }
1044
1062
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
1045
1063
  if (res.result.ok) {
1064
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1065
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
1046
1066
  resolve(res.result.nModified);
1047
1067
  }
1048
1068
  else {
@@ -1084,6 +1104,8 @@ var Collection = /** @class */ (function () {
1084
1104
  }
1085
1105
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, updatedDoc, options).then(function (res) {
1086
1106
  if (res.result.ok) {
1107
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1108
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
1087
1109
  resolve(res.result.nModified);
1088
1110
  }
1089
1111
  else {
@@ -1123,6 +1145,8 @@ var Collection = /** @class */ (function () {
1123
1145
  }
1124
1146
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
1125
1147
  if (res.result.ok) {
1148
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1149
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
1126
1150
  resolve(res.result.nModified);
1127
1151
  }
1128
1152
  else {
@@ -1184,12 +1208,16 @@ var Collection = /** @class */ (function () {
1184
1208
  route: ''
1185
1209
  });
1186
1210
  }
1211
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1212
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
1187
1213
  resolve(res.ok);
1188
1214
  }, function (err) { return reject(err); });
1189
1215
  }
1190
1216
  else {
1191
1217
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
1192
1218
  if (res.result.ok) {
1219
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1220
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
1193
1221
  resolve(res.result.nModified);
1194
1222
  }
1195
1223
  else {
@@ -1215,6 +1243,7 @@ var Collection = /** @class */ (function () {
1215
1243
  if (bypassVersions === void 0) { bypassVersions = false; }
1216
1244
  return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
1217
1245
  var date, validation, isValid, docs, i, doc, versionDoc;
1246
+ var _this = this;
1218
1247
  return __generator(this, function (_a) {
1219
1248
  switch (_a.label) {
1220
1249
  case 0:
@@ -1283,6 +1312,8 @@ var Collection = /** @class */ (function () {
1283
1312
  case 2:
1284
1313
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateMany(filter, update, options).then(function (res) {
1285
1314
  if (res.result.ok) {
1315
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1316
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
1286
1317
  resolve(res.result.nModified);
1287
1318
  }
1288
1319
  else {
@@ -1363,6 +1394,8 @@ var Collection = /** @class */ (function () {
1363
1394
  }
1364
1395
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
1365
1396
  if (res.result.ok) {
1397
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1398
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
1366
1399
  resolve(res.result.nModified);
1367
1400
  }
1368
1401
  else {
@@ -1410,6 +1443,8 @@ var Collection = /** @class */ (function () {
1410
1443
  }
1411
1444
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
1412
1445
  if (res.result.ok) {
1446
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1447
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
1413
1448
  resolve(res.result.nModified);
1414
1449
  }
1415
1450
  else {
@@ -1482,6 +1517,8 @@ var Collection = /** @class */ (function () {
1482
1517
  messageId: 0,
1483
1518
  route: ''
1484
1519
  });
1520
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1521
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
1485
1522
  resolve(res.ok);
1486
1523
  }
1487
1524
  else {
@@ -1492,6 +1529,8 @@ var Collection = /** @class */ (function () {
1492
1529
  else {
1493
1530
  index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
1494
1531
  if (res.result.ok) {
1532
+ index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
1533
+ index_1.ResolveIOServer.getMainServer().getSubscriptionManager().invalidatePubsCache(_this.collectionName, 'update');
1495
1534
  resolve(res.result.nModified);
1496
1535
  }
1497
1536
  else {