http-request-manager 18.13.9 → 18.13.12

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.
@@ -1159,6 +1159,12 @@ class QueryParamsTrackerService {
1159
1159
  sessionStorage.setItem(TRACKER_SESSION_INIT_KEY, '1');
1160
1160
  }
1161
1161
  restoreState() {
1162
+ const syncState = this.localStorageManager.getStoreSync(TRACKER_STORE_NAME);
1163
+ if (this.isTrackerState(syncState)) {
1164
+ this.state = QueryTrackerStateModel.adapt(syncState);
1165
+ this.cleanupExpiredEntries();
1166
+ return;
1167
+ }
1162
1168
  this.localStorageManager.store$(TRACKER_STORE_NAME)
1163
1169
  .pipe(take(1))
1164
1170
  .subscribe({
@@ -5429,6 +5435,34 @@ const storage = {
5429
5435
  settings: [],
5430
5436
  };
5431
5437
  class LocalStorageManagerService extends ComponentStore {
5438
+ getStoreSync(storeName) {
5439
+ storeName = storeName.toLowerCase();
5440
+ const data = this.get();
5441
+ const foundStore = data.settings.find(item => item.name === storeName);
5442
+ if (!foundStore) {
5443
+ return null;
5444
+ }
5445
+ const found = foundStore.options?.storage === StorageType.GLOBAL
5446
+ ? data.localStores.find(item => item.id === foundStore.id)
5447
+ : data.sessionStores.find(item => item.id === foundStore.id);
5448
+ if (!found || !this.app?.appID) {
5449
+ return null;
5450
+ }
5451
+ const options = SettingOptions.adapt(foundStore.options);
5452
+ let storageData = found.data;
5453
+ if (options.encrypted) {
5454
+ const decryptedData = this.encryption.decrypt(found.data, this.app.appID);
5455
+ if (decryptedData !== null) {
5456
+ storageData = decryptedData;
5457
+ }
5458
+ }
5459
+ try {
5460
+ return this.isString(storageData) ? JSON.parse(storageData) : storageData;
5461
+ }
5462
+ catch {
5463
+ return storageData;
5464
+ }
5465
+ }
5432
5466
  startTimer() {
5433
5467
  const timer$ = interval(1000 * 3).pipe(withLatestFrom(this.data$), map(([_, state]) => state), tap((state) => {
5434
5468
  const expired = this.expired(state) ? this.expired(state) : [];
@@ -6204,7 +6238,10 @@ class DbService extends Dexie {
6204
6238
  async createTable(tableName, schema) {
6205
6239
  if (!tableName || !schema)
6206
6240
  return;
6241
+ this.dbReady = this.dbReady.then(() => this._doCreateTable(tableName, schema));
6207
6242
  await this.dbReady;
6243
+ }
6244
+ async _doCreateTable(tableName, schema) {
6208
6245
  const safeTableName = this.cleanTableName(tableName);
6209
6246
  const safeSchema = schema.trim();
6210
6247
  const currentSchema = this.getCurrentSchema();
@@ -6220,9 +6257,8 @@ class DbService extends Dexie {
6220
6257
  this.close();
6221
6258
  }
6222
6259
  this.version(nextVersion).stores(currentSchema);
6223
- this.dbReady = this.open();
6224
6260
  try {
6225
- await this.dbReady;
6261
+ await this.open();
6226
6262
  const created = this.tables.some(t => t.name === safeTableName);
6227
6263
  if (!created) {
6228
6264
  console.error(`CRITICAL: Table ${safeTableName} was NOT created after upgrade! Tables found:`, this.tables.map(t => t.name));
@@ -6240,22 +6276,12 @@ class DbService extends Dexie {
6240
6276
  async DBOpened() {
6241
6277
  try {
6242
6278
  await this.dbReady;
6279
+ return this.isOpen();
6243
6280
  }
6244
6281
  catch (err) {
6245
6282
  console.error('DBOpened: init failed', err);
6246
6283
  return false;
6247
6284
  }
6248
- if (!this.isOpen()) {
6249
- try {
6250
- await this.open();
6251
- return true;
6252
- }
6253
- catch (err) {
6254
- console.error('DBOpened: open failed', err);
6255
- return false;
6256
- }
6257
- }
6258
- return true;
6259
6285
  }
6260
6286
  getCurrentSchema() {
6261
6287
  const schema = {};