http-request-manager 18.13.14 → 18.13.16
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.
|
@@ -1057,13 +1057,31 @@ class QueryParamsTrackerService {
|
|
|
1057
1057
|
}
|
|
1058
1058
|
}
|
|
1059
1059
|
normalizePath(pathSegments) {
|
|
1060
|
-
|
|
1060
|
+
const normalizedSegments = pathSegments
|
|
1061
|
+
.map((segment) => this.extractPathFromSegment(segment))
|
|
1062
|
+
.flatMap((segment) => segment.split('/'))
|
|
1061
1063
|
.map((segment) => String(segment).trim())
|
|
1062
|
-
.filter((segment) => segment.length > 0)
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
.
|
|
1066
|
-
|
|
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;
|
|
1067
1085
|
}
|
|
1068
1086
|
normalizeParamKey(key) {
|
|
1069
1087
|
return String(key).trim().toLowerCase();
|
|
@@ -1191,12 +1209,49 @@ class QueryParamsTrackerService {
|
|
|
1191
1209
|
return;
|
|
1192
1210
|
}
|
|
1193
1211
|
const syncState = this.localStorageManager.getPersistedStoreSync(TRACKER_STORE_NAME);
|
|
1194
|
-
if (
|
|
1212
|
+
if (this.isTrackerState(syncState)) {
|
|
1213
|
+
this.state = QueryTrackerStateModel.adapt(syncState);
|
|
1214
|
+
this.cleanupExpiredEntries();
|
|
1195
1215
|
return;
|
|
1196
1216
|
}
|
|
1197
|
-
|
|
1217
|
+
const fallbackState = this.getTrackerStateFromRawStorage();
|
|
1218
|
+
if (!this.isTrackerState(fallbackState)) {
|
|
1219
|
+
return;
|
|
1220
|
+
}
|
|
1221
|
+
this.state = QueryTrackerStateModel.adapt(fallbackState);
|
|
1198
1222
|
this.cleanupExpiredEntries();
|
|
1199
1223
|
}
|
|
1224
|
+
getTrackerStateFromRawStorage() {
|
|
1225
|
+
const rawSources = [
|
|
1226
|
+
this.safeParseRawStorage(localStorage.getItem('storage')),
|
|
1227
|
+
this.safeParseRawStorage(sessionStorage.getItem('storage')),
|
|
1228
|
+
];
|
|
1229
|
+
for (const source of rawSources) {
|
|
1230
|
+
if (!Array.isArray(source)) {
|
|
1231
|
+
continue;
|
|
1232
|
+
}
|
|
1233
|
+
for (const entry of source) {
|
|
1234
|
+
if (this.isTrackerState(entry?.data)) {
|
|
1235
|
+
return entry.data;
|
|
1236
|
+
}
|
|
1237
|
+
if (this.isTrackerState(entry)) {
|
|
1238
|
+
return entry;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
return null;
|
|
1243
|
+
}
|
|
1244
|
+
safeParseRawStorage(value) {
|
|
1245
|
+
if (!value) {
|
|
1246
|
+
return null;
|
|
1247
|
+
}
|
|
1248
|
+
try {
|
|
1249
|
+
return JSON.parse(value);
|
|
1250
|
+
}
|
|
1251
|
+
catch {
|
|
1252
|
+
return null;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1200
1255
|
persistState() {
|
|
1201
1256
|
this.localStorageManager.storeExists$(TRACKER_STORE_NAME)
|
|
1202
1257
|
.pipe(take(1))
|