@resolveio/server-lib 22.0.22 → 22.0.24

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.
@@ -3036,7 +3036,7 @@ var SubscriptionManager = /** @class */ (function () {
3036
3036
  };
3037
3037
  SubscriptionManager.prototype.shouldInvalidateSubscription = function (sub, collection, type, documentId, document) {
3038
3038
  return __awaiter(this, void 0, void 0, function () {
3039
- var normalizedDocumentId, hasDependencyData, trackedIds, filters, filters_1, filters_1_1, filter, e_13_1;
3039
+ var normalizedDocumentId, trackedIds, filters, hasTrackedIds, hasFilters, hasDependencyData, filters_1, filters_1_1, filter, e_13_1;
3040
3040
  var e_13, _a;
3041
3041
  var _b, _c;
3042
3042
  return __generator(this, function (_d) {
@@ -3044,6 +3044,10 @@ var SubscriptionManager = /** @class */ (function () {
3044
3044
  case 0:
3045
3045
  this.ensureDependencyContainers(sub);
3046
3046
  normalizedDocumentId = this.normalizeDocumentId(documentId);
3047
+ trackedIds = sub.collectionDependencies.get(collection);
3048
+ filters = sub.collectionFilters.get(collection);
3049
+ hasTrackedIds = !!(trackedIds && trackedIds.size);
3050
+ hasFilters = !!(filters && filters.length);
3047
3051
  hasDependencyData = (((_b = sub.collectionDependencies.get(collection)) === null || _b === void 0 ? void 0 : _b.size) || 0) > 0 ||
3048
3052
  (((_c = sub.collectionFilters.get(collection)) === null || _c === void 0 ? void 0 : _c.length) || 0) > 0 ||
3049
3053
  sub.watchAllCollections.has(collection);
@@ -3063,16 +3067,32 @@ var SubscriptionManager = /** @class */ (function () {
3063
3067
  this.dependencyDebug('Invalidate due to watch-all collection', { publication: sub.publication, collection: collection, type: type });
3064
3068
  return [2 /*return*/, true];
3065
3069
  }
3066
- trackedIds = sub.collectionDependencies.get(collection);
3067
3070
  if (trackedIds && trackedIds.has(normalizedDocumentId)) {
3068
3071
  this.dependencyDebug('Invalidate due to tracked id', { publication: sub.publication, collection: collection, type: type, documentId: normalizedDocumentId });
3069
3072
  return [2 /*return*/, true];
3070
3073
  }
3071
3074
  if (type === 'delete') {
3075
+ if (hasFilters && !hasTrackedIds) {
3076
+ this.dependencyDebug('Invalidate delete due to filter-only dependency without tracked ids', {
3077
+ publication: sub.publication,
3078
+ collection: collection,
3079
+ type: type,
3080
+ documentId: normalizedDocumentId
3081
+ });
3082
+ return [2 /*return*/, true];
3083
+ }
3072
3084
  this.dependencyDebug('Skip invalidation on delete for unknown id', { publication: sub.publication, collection: collection, type: type, documentId: normalizedDocumentId });
3073
3085
  return [2 /*return*/, false];
3074
3086
  }
3075
- filters = sub.collectionFilters.get(collection);
3087
+ if (type === 'update' && hasFilters && !hasTrackedIds) {
3088
+ this.dependencyDebug('Invalidate update due to filter-only dependency without tracked ids', {
3089
+ publication: sub.publication,
3090
+ collection: collection,
3091
+ type: type,
3092
+ documentId: normalizedDocumentId
3093
+ });
3094
+ return [2 /*return*/, true];
3095
+ }
3076
3096
  if (!(filters && filters.length)) return [3 /*break*/, 8];
3077
3097
  _d.label = 1;
3078
3098
  case 1: