http-request-manager 18.13.16 → 18.13.17

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.
@@ -1276,7 +1276,23 @@ class QueryParamsTrackerService {
1276
1276
  }, {}));
1277
1277
  }
1278
1278
  isTrackerState(value) {
1279
- return this.isPlainObject(value) && this.isPlainObject(value.paths);
1279
+ if (!this.isPlainObject(value) || !this.isPlainObject(value.paths)) {
1280
+ return false;
1281
+ }
1282
+ return Object.keys(value.paths).every((pathKey) => this.isTrackerPathState(value.paths[pathKey]));
1283
+ }
1284
+ isTrackerPathState(value) {
1285
+ if (!this.isPlainObject(value)) {
1286
+ return false;
1287
+ }
1288
+ const hasValidConsumedValues = typeof value.consumedValuesByKey === 'undefined' || this.isPlainObject(value.consumedValuesByKey);
1289
+ const hasValidTrackedAt = typeof value.trackedAt === 'undefined' || typeof value.trackedAt === 'number';
1290
+ const hasValidWatchExpiresAt = typeof value.watchExpiresAt === 'undefined' || typeof value.watchExpiresAt === 'number';
1291
+ const hasValidBaselineQuery = typeof value.baselineQuery === 'undefined' || this.isPlainObject(value.baselineQuery);
1292
+ const hasTrackerMarkers = this.isPlainObject(value.consumedValuesByKey) ||
1293
+ typeof value.trackedAt === 'number' ||
1294
+ this.isPlainObject(value.baselineQuery);
1295
+ return hasValidConsumedValues && hasValidTrackedAt && hasValidWatchExpiresAt && hasValidBaselineQuery && hasTrackerMarkers;
1280
1296
  }
1281
1297
  isPlainObject(value) {
1282
1298
  return Object.prototype.toString.call(value) === '[object Object]';