http-request-manager 18.13.31 → 18.13.35
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.
|
@@ -5371,7 +5371,24 @@ class LocalStorageManagerService extends ComponentStore {
|
|
|
5371
5371
|
}
|
|
5372
5372
|
else {
|
|
5373
5373
|
console.warn('Failed to decrypt settings data');
|
|
5374
|
-
|
|
5374
|
+
try {
|
|
5375
|
+
const fallbackSettings = JSON.parse(str);
|
|
5376
|
+
if (Array.isArray(fallbackSettings)) {
|
|
5377
|
+
settings = fallbackSettings;
|
|
5378
|
+
const migratedSettings = this.encryption.encrypt(settings, this.app.appID);
|
|
5379
|
+
if (migratedSettings) {
|
|
5380
|
+
localStorage.setItem(this.storageSettingsName, migratedSettings);
|
|
5381
|
+
}
|
|
5382
|
+
console.warn('Recovered settings from plaintext storage and migrated to encrypted format');
|
|
5383
|
+
}
|
|
5384
|
+
else {
|
|
5385
|
+
settings = [];
|
|
5386
|
+
}
|
|
5387
|
+
}
|
|
5388
|
+
catch (error) {
|
|
5389
|
+
console.warn('Failed to parse settings fallback data:', error);
|
|
5390
|
+
settings = [];
|
|
5391
|
+
}
|
|
5375
5392
|
}
|
|
5376
5393
|
}
|
|
5377
5394
|
settings.forEach(store => {
|
|
@@ -7068,11 +7085,29 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
7068
7085
|
}
|
|
7069
7086
|
const trackerAllowsRequest = this.checkTrackerAllowsRequest(this.databaseOptions.table, this.resolvePath(effectiveParams), options, storeData);
|
|
7070
7087
|
if (trackerAllowsRequest) {
|
|
7088
|
+
const normalizedPath = this.trackerNormalizePath(this.resolvePath(effectiveParams));
|
|
7089
|
+
// Defensive fallback: if localStorage metadata was lost/corrupted, prefer DB cache
|
|
7090
|
+
// for non-query requests and re-hydrate requestCache metadata.
|
|
7091
|
+
if (!normalizedPath.hasQuery) {
|
|
7092
|
+
return this.dbManagerService.getTableRecords(this.databaseOptions.table).pipe(switchMap((dbData) => {
|
|
7093
|
+
if (Array.isArray(dbData) && dbData.length > 0) {
|
|
7094
|
+
this.setData$(dbData);
|
|
7095
|
+
this.saveRequestCacheMetadata(this.databaseOptions.table, 'GET', requestSignature, storedSchemaSignature ?? expectedSchemaSignature ?? undefined, options);
|
|
7096
|
+
return of(dbData);
|
|
7097
|
+
}
|
|
7098
|
+
return fetchFromAPI();
|
|
7099
|
+
}), catchError((error) => {
|
|
7100
|
+
const tableName = this.databaseOptions.table;
|
|
7101
|
+
console.warn('[DB STORAGE] fallback cache read failed, falling back to API:', { table: tableName, error });
|
|
7102
|
+
return fetchFromAPI();
|
|
7103
|
+
}));
|
|
7104
|
+
}
|
|
7071
7105
|
return fetchFromAPI();
|
|
7072
7106
|
}
|
|
7073
7107
|
return this.dbManagerService.getTableRecords(this.databaseOptions.table).pipe(switchMap((dbData) => {
|
|
7074
7108
|
if (Array.isArray(dbData) && dbData.length > 0) {
|
|
7075
7109
|
this.setData$(dbData);
|
|
7110
|
+
this.saveRequestCacheMetadata(this.databaseOptions.table, 'GET', requestSignature, storedSchemaSignature ?? expectedSchemaSignature ?? undefined, options);
|
|
7076
7111
|
return of(dbData);
|
|
7077
7112
|
}
|
|
7078
7113
|
const currentStateData = this.get()?.data;
|
|
@@ -7603,7 +7638,7 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
7603
7638
|
const schemaKeys = Object.keys(sampleData || {}).filter(key => sampleData[key] !== undefined);
|
|
7604
7639
|
let schema = '++id';
|
|
7605
7640
|
if (schemaKeys.length > 0) {
|
|
7606
|
-
const otherKeys = schemaKeys.filter((k) => k !== 'id');
|
|
7641
|
+
const otherKeys = schemaKeys.filter((k) => k !== 'id').sort();
|
|
7607
7642
|
if (otherKeys.length > 0) {
|
|
7608
7643
|
schema += ', ' + otherKeys.join(', ');
|
|
7609
7644
|
}
|