http-request-manager 18.13.13 → 18.13.15

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.
@@ -923,6 +923,7 @@ class QueryParamsTrackerService {
923
923
  }
924
924
  checkRequestOptions(requestOptions = [], options = {}) {
925
925
  this.ensureStateRestored();
926
+ this.tryHydrateStateFromPersistedStore();
926
927
  const normalized = this.normalizeRequestOptions(requestOptions);
927
928
  if (!normalized.pathKey)
928
929
  return false;
@@ -944,6 +945,7 @@ class QueryParamsTrackerService {
944
945
  }
945
946
  matchesPath(requestOptions = [], expectedPathOptions = []) {
946
947
  this.ensureStateRestored();
948
+ this.tryHydrateStateFromPersistedStore();
947
949
  const requestPath = this.normalizeRequestOptions(requestOptions).pathKey;
948
950
  const expectedPath = this.normalizeRequestOptions(expectedPathOptions).pathKey;
949
951
  return Boolean(requestPath) && requestPath === expectedPath;
@@ -1055,13 +1057,31 @@ class QueryParamsTrackerService {
1055
1057
  }
1056
1058
  }
1057
1059
  normalizePath(pathSegments) {
1058
- return pathSegments
1060
+ const normalizedSegments = pathSegments
1061
+ .map((segment) => this.extractPathFromSegment(segment))
1062
+ .flatMap((segment) => segment.split('/'))
1059
1063
  .map((segment) => String(segment).trim())
1060
- .filter((segment) => segment.length > 0)
1061
- .join('/')
1062
- .replace(/([^:]\/+)\/+/g, '$1')
1063
- .replace(/^\//, '')
1064
- .replace(/\/$/, '');
1064
+ .filter((segment) => segment.length > 0);
1065
+ // Treat leading "rest" as transport/base-path noise for stable cache keys.
1066
+ if (normalizedSegments[0]?.toLowerCase() === 'rest') {
1067
+ normalizedSegments.shift();
1068
+ }
1069
+ return normalizedSegments.join('/');
1070
+ }
1071
+ extractPathFromSegment(segment) {
1072
+ const raw = String(segment).trim();
1073
+ if (!raw) {
1074
+ return '';
1075
+ }
1076
+ try {
1077
+ if (/^https?:\/\//i.test(raw)) {
1078
+ return new URL(raw).pathname;
1079
+ }
1080
+ }
1081
+ catch {
1082
+ return raw;
1083
+ }
1084
+ return raw;
1065
1085
  }
1066
1086
  normalizeParamKey(key) {
1067
1087
  return String(key).trim().toLowerCase();
@@ -1159,10 +1179,8 @@ class QueryParamsTrackerService {
1159
1179
  sessionStorage.setItem(TRACKER_SESSION_INIT_KEY, '1');
1160
1180
  }
1161
1181
  restoreState() {
1162
- const syncState = this.localStorageManager.getPersistedStoreSync(TRACKER_STORE_NAME);
1163
- if (this.isTrackerState(syncState)) {
1164
- this.state = QueryTrackerStateModel.adapt(syncState);
1165
- this.cleanupExpiredEntries();
1182
+ this.tryHydrateStateFromPersistedStore();
1183
+ if (Object.keys(this.state.paths).length > 0) {
1166
1184
  return;
1167
1185
  }
1168
1186
  this.localStorageManager.store$(TRACKER_STORE_NAME)
@@ -1186,6 +1204,17 @@ class QueryParamsTrackerService {
1186
1204
  }
1187
1205
  });
1188
1206
  }
1207
+ tryHydrateStateFromPersistedStore() {
1208
+ if (Object.keys(this.state.paths).length > 0) {
1209
+ return;
1210
+ }
1211
+ const syncState = this.localStorageManager.getPersistedStoreSync(TRACKER_STORE_NAME);
1212
+ if (!this.isTrackerState(syncState)) {
1213
+ return;
1214
+ }
1215
+ this.state = QueryTrackerStateModel.adapt(syncState);
1216
+ this.cleanupExpiredEntries();
1217
+ }
1189
1218
  persistState() {
1190
1219
  this.localStorageManager.storeExists$(TRACKER_STORE_NAME)
1191
1220
  .pipe(take(1))