@resolveio/server-lib 22.2.57 → 22.3.1

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.
@@ -2130,7 +2130,7 @@ var SubscriptionManager = /** @class */ (function () {
2130
2130
  case 0:
2131
2131
  sawChangeEvent_1 = true;
2132
2132
  this._oplogRetryCount = 0;
2133
- if (!doc.ns) return [3 /*break*/, 14];
2133
+ if (!doc.ns) return [3 /*break*/, 15];
2134
2134
  if (this._enableDebug) {
2135
2135
  console.log(new Date(), 'Oplog Hit', doc.ns);
2136
2136
  }
@@ -2145,47 +2145,49 @@ var SubscriptionManager = /** @class */ (function () {
2145
2145
  else {
2146
2146
  this._debugOplogCollections.find(function (a) { return a.collection === doc.ns.coll && a.type === doc.operationType; }).hits += 1;
2147
2147
  }
2148
- if (!collection) return [3 /*break*/, 10];
2148
+ if (!collection) return [3 /*break*/, 11];
2149
2149
  this._debugOplogHits += 1;
2150
2150
  fullDocument = doc['fullDocument'];
2151
2151
  docId = doc.documentKey && doc.documentKey['_id'] !== undefined ? doc.documentKey['_id'] : (fullDocument && fullDocument['_id'] !== undefined ? fullDocument['_id'] : null);
2152
- if (!(doc.operationType === 'insert')) return [3 /*break*/, 5];
2153
- if (!(collection === 'support-tickets')) return [3 /*break*/, 2];
2154
- if (!(this.serverConfig['ROOT_URL'] === 'https://resolveio.com')) return [3 /*break*/, 2];
2155
- resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager().callMethod.call(resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager(), 'sendSupportTicketEmail', doc.documentKey['_id']);
2156
- return [4 /*yield*/, this.invalidatePubsCache(collection, 'insert', docId, fullDocument)];
2152
+ if (!(doc.operationType === 'insert')) return [3 /*break*/, 6];
2153
+ if (!(collection === 'support-tickets')) return [3 /*break*/, 3];
2154
+ if (!(this.serverConfig['ROOT_URL'] === 'https://resolveio.com')) return [3 /*break*/, 3];
2155
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager().callMethod.call(resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager(), 'sendSupportTicketEmail', doc.documentKey['_id'])];
2157
2156
  case 1:
2158
2157
  _a.sent();
2159
- _a.label = 2;
2160
- case 2:
2161
- if (!(collection !== 'method-responses')) return [3 /*break*/, 4];
2162
2158
  return [4 /*yield*/, this.invalidatePubsCache(collection, 'insert', docId, fullDocument)];
2159
+ case 2:
2160
+ _a.sent();
2161
+ _a.label = 3;
2163
2162
  case 3:
2163
+ if (!(collection !== 'method-responses')) return [3 /*break*/, 5];
2164
+ return [4 /*yield*/, this.invalidatePubsCache(collection, 'insert', docId, fullDocument)];
2165
+ case 4:
2164
2166
  _a.sent();
2165
- _a.label = 4;
2166
- case 4: return [3 /*break*/, 10];
2167
- case 5:
2168
- if (!(doc.operationType === 'update' || doc.operationType === 'replace')) return [3 /*break*/, 8];
2169
- if (!(collection !== 'method-responses')) return [3 /*break*/, 7];
2170
- return [4 /*yield*/, this.invalidatePubsCache(collection, 'update', docId, fullDocument)];
2167
+ _a.label = 5;
2168
+ case 5: return [3 /*break*/, 11];
2171
2169
  case 6:
2170
+ if (!(doc.operationType === 'update' || doc.operationType === 'replace')) return [3 /*break*/, 9];
2171
+ if (!(collection !== 'method-responses')) return [3 /*break*/, 8];
2172
+ return [4 /*yield*/, this.invalidatePubsCache(collection, 'update', docId, fullDocument)];
2173
+ case 7:
2172
2174
  _a.sent();
2173
- _a.label = 7;
2174
- case 7: return [3 /*break*/, 10];
2175
- case 8:
2176
- if (!(doc.operationType === 'delete')) return [3 /*break*/, 10];
2177
- if (!(collection !== 'method-responses')) return [3 /*break*/, 10];
2178
- return [4 /*yield*/, this.invalidatePubsCache(collection, 'delete', docId)];
2175
+ _a.label = 8;
2176
+ case 8: return [3 /*break*/, 11];
2179
2177
  case 9:
2180
- _a.sent();
2181
- _a.label = 10;
2178
+ if (!(doc.operationType === 'delete')) return [3 /*break*/, 11];
2179
+ if (!(collection !== 'method-responses')) return [3 /*break*/, 11];
2180
+ return [4 /*yield*/, this.invalidatePubsCache(collection, 'delete', docId)];
2182
2181
  case 10:
2183
- if (!(collection === 'flags')) return [3 /*break*/, 13];
2184
- return [4 /*yield*/, flag_collection_1.Flags.findOne({ type: 'Enable Debug' })];
2182
+ _a.sent();
2183
+ _a.label = 11;
2185
2184
  case 11:
2185
+ if (!(collection === 'flags')) return [3 /*break*/, 14];
2186
+ return [4 /*yield*/, flag_collection_1.Flags.findOne({ type: 'Enable Debug' })];
2187
+ case 12:
2186
2188
  flag = _a.sent();
2187
2189
  return [4 /*yield*/, flag_collection_1.Flags.findOne({ type: 'Enable Dependency Debug' })];
2188
- case 12:
2190
+ case 13:
2189
2191
  dependencyFlag = _a.sent();
2190
2192
  if (flag && flag.value) {
2191
2193
  this._enableDebug = true;
@@ -2199,14 +2201,14 @@ var SubscriptionManager = /** @class */ (function () {
2199
2201
  else {
2200
2202
  this._enableDependencyDebug = process.env.ENABLE_DEPENDENCY_DEBUG === 'true';
2201
2203
  }
2202
- _a.label = 13;
2203
- case 13:
2204
+ _a.label = 14;
2205
+ case 14:
2204
2206
  lastResumeToken_1 = doc._id;
2205
2207
  this.queueResumeTokenSave(lastResumeToken_1);
2206
2208
  if ((!process.env.NODE_APP_INSTANCE || process.env.NODE_APP_INSTANCE === '0') && (process.env.IS_WORKERS_ENABLED === 'false' || (process.env.IS_WORKER_INSTANCE === 'true' && process.env.WORKER_INDEX === '0'))) {
2207
2209
  }
2208
- _a.label = 14;
2209
- case 14: return [2 /*return*/];
2210
+ _a.label = 15;
2211
+ case 15: return [2 /*return*/];
2210
2212
  }
2211
2213
  });
2212
2214
  }); });
@@ -2516,10 +2518,12 @@ var SubscriptionManager = /** @class */ (function () {
2516
2518
  monitor = this._monitorManagerFunction.startMonitorFunction('User Specific Publication', sub.publication, '', '', sub.subscriptionData);
2517
2519
  _d.label = 1;
2518
2520
  case 1:
2519
- _d.trys.push([1, 3, 5, 7]);
2520
- resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager().callMethod.call(resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager(), 'insertSubscriptionLog', type, sub.publication, collection, JSON.stringify(sub.subscriptionData));
2521
- return [4 /*yield*/, this.runPublicationExecution(sub, ws['id_user'])];
2521
+ _d.trys.push([1, 4, 6, 8]);
2522
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager().callMethod.call(resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager(), 'insertSubscriptionLog', type, sub.publication, collection, JSON.stringify(sub.subscriptionData))];
2522
2523
  case 2:
2524
+ _d.sent();
2525
+ return [4 /*yield*/, this.runPublicationExecution(sub, ws['id_user'])];
2526
+ case 3:
2523
2527
  execution = _d.sent();
2524
2528
  res = execution.result;
2525
2529
  dependencySnapshot = execution.snapshot;
@@ -2550,8 +2554,8 @@ var SubscriptionManager = /** @class */ (function () {
2550
2554
  type: type,
2551
2555
  subscriptionData: sub.subscriptionData
2552
2556
  });
2553
- return [3 /*break*/, 7];
2554
- case 3:
2557
+ return [3 /*break*/, 8];
2558
+ case 4:
2555
2559
  err_1 = _d.sent();
2556
2560
  _a = (0, error_tracking_1.ensureErrorWithCorrelation)(err_1), normalizedError = _a.error, correlationId = _a.correlationId;
2557
2561
  serverRes = {
@@ -2590,14 +2594,14 @@ var SubscriptionManager = /** @class */ (function () {
2590
2594
  },
2591
2595
  correlationId: correlationId
2592
2596
  })];
2593
- case 4:
2597
+ case 5:
2594
2598
  _d.sent();
2595
- return [3 /*break*/, 7];
2596
- case 5: return [4 /*yield*/, this._monitorManagerFunction.finishMonitorFunction(monitor)];
2597
- case 6:
2599
+ return [3 /*break*/, 8];
2600
+ case 6: return [4 /*yield*/, this._monitorManagerFunction.finishMonitorFunction(monitor)];
2601
+ case 7:
2598
2602
  _d.sent();
2599
2603
  return [7 /*endfinally*/];
2600
- case 7: return [2 /*return*/];
2604
+ case 8: return [2 /*return*/];
2601
2605
  }
2602
2606
  });
2603
2607
  });
@@ -2660,12 +2664,14 @@ var SubscriptionManager = /** @class */ (function () {
2660
2664
  dependencySnapshot = void 0;
2661
2665
  _m.label = 2;
2662
2666
  case 2:
2663
- _m.trys.push([2, 4, 6, 8]);
2664
- if (sub.publication !== 'superadminAPM' && sub.publication !== 'loggedInUsers') {
2665
- resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager().callMethod.call(resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager(), 'insertSubscriptionLog', type, sub.publication, collection, JSON.stringify(sub.subscriptionData));
2666
- }
2667
- return [4 /*yield*/, this.runPublicationExecution(sub)];
2667
+ _m.trys.push([2, 6, 8, 10]);
2668
+ if (!(sub.publication !== 'superadminAPM' && sub.publication !== 'loggedInUsers')) return [3 /*break*/, 4];
2669
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager().callMethod.call(resolveio_server_app_1.ResolveIOServer.getMainServer().getMethodManager(), 'insertSubscriptionLog', type, sub.publication, collection, JSON.stringify(sub.subscriptionData))];
2668
2670
  case 3:
2671
+ _m.sent();
2672
+ _m.label = 4;
2673
+ case 4: return [4 /*yield*/, this.runPublicationExecution(sub)];
2674
+ case 5:
2669
2675
  execution = _m.sent();
2670
2676
  res = execution.result;
2671
2677
  dependencySnapshot = execution.snapshot;
@@ -2824,8 +2830,8 @@ var SubscriptionManager = /** @class */ (function () {
2824
2830
  sub.cacheId = 0;
2825
2831
  }
2826
2832
  }
2827
- return [3 /*break*/, 8];
2828
- case 4:
2833
+ return [3 /*break*/, 10];
2834
+ case 6:
2829
2835
  err_2 = _m.sent();
2830
2836
  _c = (0, error_tracking_1.ensureErrorWithCorrelation)(err_2), normalizedError = _c.error, correlationId = _c.correlationId;
2831
2837
  try {
@@ -2878,14 +2884,14 @@ var SubscriptionManager = /** @class */ (function () {
2878
2884
  },
2879
2885
  correlationId: correlationId
2880
2886
  })];
2881
- case 5:
2882
- _m.sent();
2883
- return [3 /*break*/, 8];
2884
- case 6: return [4 /*yield*/, this._monitorManagerFunction.finishMonitorFunction(monitor)];
2885
2887
  case 7:
2888
+ _m.sent();
2889
+ return [3 /*break*/, 10];
2890
+ case 8: return [4 /*yield*/, this._monitorManagerFunction.finishMonitorFunction(monitor)];
2891
+ case 9:
2886
2892
  _m.sent();
2887
2893
  return [7 /*endfinally*/];
2888
- case 8: return [2 /*return*/];
2894
+ case 10: return [2 /*return*/];
2889
2895
  }
2890
2896
  });
2891
2897
  });