http-request-manager 18.13.30 → 18.13.32

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.
@@ -5148,6 +5148,7 @@ class LocalStorageManagerService extends ComponentStore {
5148
5148
  ? data.localStores.find(item => item.id === foundStore.id)
5149
5149
  : data.sessionStores.find(item => item.id === foundStore.id);
5150
5150
  if (!found) {
5151
+ console.warn('[CacheDebug] store$: settings entry found but no data entry in localStores/sessionStores', { store, foundStoreId: foundStore.id, storageType: foundStore.options?.storage });
5151
5152
  this.deleteStore({ name: store });
5152
5153
  return;
5153
5154
  }
@@ -6200,7 +6201,6 @@ class QueryParamsTrackerService {
6200
6201
  constructor() {
6201
6202
  this.state = { paths: {} };
6202
6203
  this.stateRestored = false;
6203
- this.restoreInProgress = false;
6204
6204
  this.localStorageManager = inject(LocalStorageManagerService);
6205
6205
  }
6206
6206
  clearTracking(resetSessionInit = false) {
@@ -6452,10 +6452,10 @@ class QueryParamsTrackerService {
6452
6452
  return this.state.paths[pathKey];
6453
6453
  }
6454
6454
  ensureStateRestored() {
6455
- if (this.stateRestored || this.restoreInProgress) {
6455
+ if (this.stateRestored) {
6456
6456
  return;
6457
6457
  }
6458
- this.restoreInProgress = true;
6458
+ this.stateRestored = true;
6459
6459
  this.restoreState();
6460
6460
  }
6461
6461
  restoreState() {
@@ -6466,17 +6466,12 @@ class QueryParamsTrackerService {
6466
6466
  if (this.isTrackerState(storedState)) {
6467
6467
  this.state = QueryTrackerStateModel.adapt(storedState);
6468
6468
  this.cleanupExpiredEntries();
6469
+ return;
6469
6470
  }
6470
- else {
6471
- this.state = { paths: {} };
6472
- }
6473
- this.stateRestored = true;
6474
- this.restoreInProgress = false;
6471
+ this.state = { paths: {} };
6475
6472
  },
6476
6473
  error: () => {
6477
6474
  this.state = { paths: {} };
6478
- this.stateRestored = true;
6479
- this.restoreInProgress = false;
6480
6475
  }
6481
6476
  });
6482
6477
  }
@@ -7053,6 +7048,7 @@ class HTTPManagerStateService extends ComponentStore {
7053
7048
  }));
7054
7049
  }
7055
7050
  return this.localStorageManagerService.store$(this.databaseOptions.table).pipe(take(1), switchMap((storeData) => {
7051
+ console.log('[CacheDebug] storeData for table:', this.databaseOptions.table, { storeData, requestCache: storeData?.requestCache, expires: storeData?.expires });
7056
7052
  const forceRefresh = !!options?.forceRefresh;
7057
7053
  const storedSchemaSignature = this.getStoredSchemaSignature(storeData);
7058
7054
  const expires = storeData?.expires || 0;
@@ -7065,6 +7061,7 @@ class HTTPManagerStateService extends ComponentStore {
7065
7061
  }
7066
7062
  const expectedSchema = this.buildSchemaFromAdapter();
7067
7063
  const expectedSchemaSignature = this.buildSchemaSignature(expectedSchema);
7064
+ console.log('[CacheDebug] schema check:', { tableName: this.databaseOptions.table, storedSchemaSignature, expectedSchemaSignature, mismatch: storedSchemaSignature && storedSchemaSignature !== expectedSchemaSignature });
7068
7065
  if (storedSchemaSignature && storedSchemaSignature !== expectedSchemaSignature) {
7069
7066
  const tableDef = TableSchemaDef.adapt({ table: this.databaseOptions.table, schema: expectedSchema });
7070
7067
  return this.dbManagerService.clearTable(this.databaseOptions.table).pipe(switchMap(() => this.dbManagerService.createDatabaseTable(tableDef)), switchMap(() => fetchFromAPI()));
@@ -7076,6 +7073,7 @@ class HTTPManagerStateService extends ComponentStore {
7076
7073
  return this.dbManagerService.getTableRecords(this.databaseOptions.table).pipe(switchMap((dbData) => {
7077
7074
  if (Array.isArray(dbData) && dbData.length > 0) {
7078
7075
  this.setData$(dbData);
7076
+ this.saveRequestCacheMetadata(this.databaseOptions.table, 'GET', requestSignature, storedSchemaSignature ?? undefined, options);
7079
7077
  return of(dbData);
7080
7078
  }
7081
7079
  const currentStateData = this.get()?.data;
@@ -7606,7 +7604,7 @@ class HTTPManagerStateService extends ComponentStore {
7606
7604
  const schemaKeys = Object.keys(sampleData || {}).filter(key => sampleData[key] !== undefined);
7607
7605
  let schema = '++id';
7608
7606
  if (schemaKeys.length > 0) {
7609
- const otherKeys = schemaKeys.filter((k) => k !== 'id');
7607
+ const otherKeys = schemaKeys.filter((k) => k !== 'id').sort();
7610
7608
  if (otherKeys.length > 0) {
7611
7609
  schema += ', ' + otherKeys.join(', ');
7612
7610
  }
@@ -8227,7 +8225,9 @@ class HTTPManagerStateService extends ComponentStore {
8227
8225
  const normalized = this.trackerNormalizePath(path);
8228
8226
  const ignoreQueryParams = Array.isArray(options?.ignoreQueryParams) ? options.ignoreQueryParams : [];
8229
8227
  if (!normalized.hasQuery || ignoreQueryParams.length === 0) {
8230
- return !this.getRequestCacheMetadata(storeData, 'GET');
8228
+ const meta = this.getRequestCacheMetadata(storeData, 'GET');
8229
+ console.log('[CacheDebug] checkTrackerAllowsRequest: no query params path', { tableName, requestCacheMeta: meta, allowsRequest: !meta });
8230
+ return !meta;
8231
8231
  }
8232
8232
  const filtered = this.trackerFilterQuery(normalized.query, ignoreQueryParams);
8233
8233
  const keys = Object.keys(filtered);