http-request-manager 18.13.1 → 18.13.3

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.
@@ -876,13 +876,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
876
876
  }], ctorParameters: () => [] });
877
877
 
878
878
  class PathTrackerStateModel {
879
- constructor(baselineQuery, consumedValuesByKey = {}, watchExpiresAt) {
879
+ constructor(baselineQuery, consumedValuesByKey = {}, watchExpiresAt, trackedAt) {
880
880
  this.baselineQuery = baselineQuery;
881
881
  this.consumedValuesByKey = consumedValuesByKey;
882
882
  this.watchExpiresAt = watchExpiresAt;
883
+ this.trackedAt = trackedAt;
883
884
  }
884
885
  static adapt(item) {
885
- return new PathTrackerStateModel(item?.baselineQuery, item?.consumedValuesByKey, item?.watchExpiresAt);
886
+ return new PathTrackerStateModel(item?.baselineQuery, item?.consumedValuesByKey, item?.watchExpiresAt, item?.trackedAt);
886
887
  }
887
888
  }
888
889
 
@@ -905,6 +906,7 @@ const TRACKER_SESSION_INIT_KEY = 'query_params_tracker_initialized';
905
906
  const DEFAULT_TRACKER_OPTIONS = SettingOptions.adapt({
906
907
  storage: StorageType.GLOBAL,
907
908
  encrypted: false,
909
+ expiresIn: '1d',
908
910
  });
909
911
  class QueryParamsTrackerService {
910
912
  constructor() {
@@ -926,7 +928,12 @@ class QueryParamsTrackerService {
926
928
  return false;
927
929
  this.cleanupExpiredEntries();
928
930
  if (!normalized.hasQuery) {
929
- this.ensurePathState(normalized.pathKey);
931
+ const pathExists = !!this.state.paths[normalized.pathKey];
932
+ if (pathExists) {
933
+ return false;
934
+ }
935
+ const pathState = this.ensurePathState(normalized.pathKey);
936
+ pathState.trackedAt = Math.floor(Date.now() / 1000);
930
937
  this.persistState();
931
938
  return true;
932
939
  }
@@ -1119,7 +1126,8 @@ class QueryParamsTrackerService {
1119
1126
  }
1120
1127
  const hasBaseline = Boolean(pathState.baselineQuery && Object.keys(pathState.baselineQuery).length > 0);
1121
1128
  const hasTrackedValues = Object.keys(pathState.consumedValuesByKey).some((key) => (pathState.consumedValuesByKey[key] || []).length > 0);
1122
- if (!hasBaseline && !hasTrackedValues) {
1129
+ const isNoQueryTracked = Boolean(pathState.trackedAt);
1130
+ if (!hasBaseline && !hasTrackedValues && !isNoQueryTracked) {
1123
1131
  delete this.state.paths[pathKey];
1124
1132
  }
1125
1133
  });
@@ -1156,6 +1164,9 @@ class QueryParamsTrackerService {
1156
1164
  .pipe(take(1))
1157
1165
  .subscribe({
1158
1166
  next: (storedState) => {
1167
+ if (Object.keys(this.state.paths).length > 0) {
1168
+ return;
1169
+ }
1159
1170
  if (this.isTrackerState(storedState)) {
1160
1171
  this.state = QueryTrackerStateModel.adapt(storedState);
1161
1172
  this.cleanupExpiredEntries();
@@ -1164,7 +1175,9 @@ class QueryParamsTrackerService {
1164
1175
  this.state = { paths: {} };
1165
1176
  },
1166
1177
  error: () => {
1167
- this.state = { paths: {} };
1178
+ if (Object.keys(this.state.paths).length === 0) {
1179
+ this.state = { paths: {} };
1180
+ }
1168
1181
  }
1169
1182
  });
1170
1183
  }
@@ -2422,14 +2435,14 @@ class WebSocketManagerService {
2422
2435
  content
2423
2436
  };
2424
2437
  // DEBUG: Log the exact message being sent
2425
- console.log('🔍 [DEBUG] sendMessageInChannel:', {
2426
- channel,
2427
- channelType: typeof channel,
2428
- channelEmpty: channel === '' || channel === null || channel === undefined,
2429
- content,
2430
- fullMessage: message,
2431
- jsonString: JSON.stringify(message)
2432
- });
2438
+ // console.log('🔍 [DEBUG] sendMessageInChannel:', {
2439
+ // channel,
2440
+ // channelType: typeof channel,
2441
+ // channelEmpty: channel === '' || channel === null || channel === undefined,
2442
+ // content,
2443
+ // fullMessage: message,
2444
+ // jsonString: JSON.stringify(message)
2445
+ // });
2433
2446
  WebSocketManagerService.socket.send(JSON.stringify(message));
2434
2447
  console.log(`💬 Send message:`, content);
2435
2448
  }
@@ -7241,14 +7254,14 @@ class HTTPManagerStateService extends ComponentStore {
7241
7254
  return this.httpManagerService.getRequest(requestOptions, effectiveParams).pipe(map((apiData) => ({ data: apiData, fromCache: false })));
7242
7255
  })).pipe(tap((packet) => {
7243
7256
  const res = packet?.data;
7244
- console.log('[DEBUG] Streaming response received:', res);
7257
+ // console.log('[DEBUG] Streaming response received:', res)
7245
7258
  if (res && res.length > 0) {
7246
- console.log('[DEBUG] Updating state with streaming data:', res);
7259
+ // console.log('[DEBUG] Updating state with streaming data:', res)
7247
7260
  this.setData$(res);
7248
7261
  this.streamedResponse = res;
7249
7262
  }
7250
7263
  else {
7251
- console.log('[DEBUG] No streaming data or empty array:', res);
7264
+ // console.log('[DEBUG] No streaming data or empty array:', res)
7252
7265
  }
7253
7266
  // Reset pending once we have a response packet (cache or network)
7254
7267
  this.httpManagerService.isPending.next(false);
@@ -7258,33 +7271,33 @@ class HTTPManagerStateService extends ComponentStore {
7258
7271
  }
7259
7272
  return this.persistStreamDataToDb(packet?.data, options);
7260
7273
  }), map((res) => {
7261
- console.log('[DEBUG] Returning data to subscribers:', res);
7274
+ // console.log('[DEBUG] Returning data to subscribers:', res)
7262
7275
  return res;
7263
7276
  }), catchError((error) => {
7264
- console.error('[DEBUG] Streaming error:', error);
7277
+ // console.error('[DEBUG] Streaming error:', error)
7265
7278
  this.httpManagerService.isPending.next(false);
7266
7279
  return of([]);
7267
7280
  }));
7268
7281
  }
7269
7282
  return this.httpManagerService.getRequest(requestOptions, effectiveParams)
7270
7283
  .pipe(tap((res) => {
7271
- console.log('[DEBUG] Streaming response received:', res);
7284
+ // console.log('[DEBUG] Streaming response received:', res)
7272
7285
  // Always update state with streaming data
7273
7286
  if (res && res.length > 0) {
7274
- console.log('[DEBUG] Updating state with streaming data:', res);
7287
+ // console.log('[DEBUG] Updating state with streaming data:', res)
7275
7288
  this.setData$(res);
7276
7289
  this.streamedResponse = res;
7277
7290
  }
7278
7291
  else {
7279
- console.log('[DEBUG] No streaming data or empty array:', res);
7292
+ // console.log('[DEBUG] No streaming data or empty array:', res)
7280
7293
  }
7281
7294
  // Reset pending once we have a response packet
7282
7295
  this.httpManagerService.isPending.next(false);
7283
7296
  }), concatMap((res) => this.persistStreamDataToDb(res, options)), map((res) => {
7284
- console.log('[DEBUG] Returning data to subscribers:', res);
7297
+ // console.log('[DEBUG] Returning data to subscribers:', res)
7285
7298
  return res; // Return the data so subscribers can receive it
7286
7299
  }), catchError((error) => {
7287
- console.error('[DEBUG] Streaming error:', error);
7300
+ // console.error('[DEBUG] Streaming error:', error)
7288
7301
  this.httpManagerService.isPending.next(false);
7289
7302
  return of([]);
7290
7303
  }));
@@ -7649,15 +7662,15 @@ class HTTPManagerStateService extends ComponentStore {
7649
7662
  return;
7650
7663
  }
7651
7664
  // DEBUG: Log what we're sending
7652
- console.log('🔍 [DEBUG] sendWsCommunication called:', {
7653
- wsServer,
7654
- wsServerType: typeof wsServer,
7655
- wsServerEmpty: wsServer === '' || wsServer === null || wsServer === undefined,
7656
- method,
7657
- path,
7658
- user: this.apiOptions.ws.user,
7659
- fullPayload: { method, path, user: this.apiOptions.ws.user }
7660
- });
7665
+ // console.log('🔍 [DEBUG] sendWsCommunication called:', {
7666
+ // wsServer,
7667
+ // wsServerType: typeof wsServer,
7668
+ // wsServerEmpty: wsServer === '' || wsServer === null || wsServer === undefined,
7669
+ // method,
7670
+ // path,
7671
+ // user: this.apiOptions.ws.user,
7672
+ // fullPayload: { method, path, user: this.apiOptions.ws.user }
7673
+ // });
7661
7674
  this.httpManagerService.sendMessageInChannel(wsServer, { method, path, user: this.apiOptions.ws.user });
7662
7675
  }
7663
7676
  else {