http-request-manager 18.7.31 → 18.9.1

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.
@@ -1,7 +1,7 @@
1
1
  import * as rxjs from 'rxjs';
2
- import { Observable, BehaviorSubject, OperatorFunction, Subscription } from 'rxjs';
2
+ import { Observable, Subscription, BehaviorSubject, OperatorFunction } from 'rxjs';
3
3
  import * as i0 from '@angular/core';
4
- import { InjectionToken, Injector, OnDestroy, OnInit, EventEmitter, ModuleWithProviders } from '@angular/core';
4
+ import { InjectionToken, OnDestroy, Injector, OnInit, EventEmitter, ModuleWithProviders } from '@angular/core';
5
5
  import { ComponentStore } from '@ngrx/component-store';
6
6
  import { HttpClient, HttpHeaders, HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http';
7
7
  import * as i16 from 'toast-message-display';
@@ -127,7 +127,7 @@ declare class SymmetricalEncryptionService {
127
127
  constructor();
128
128
  generateCipherKey(): string;
129
129
  encrypt(str: any, key?: string): string | undefined;
130
- decrypt(str: string, key?: string): string | undefined;
130
+ decrypt(str: string, key?: string): string | null | undefined;
131
131
  createSignature(url: string, len?: number): string;
132
132
  normalizeURL(url: string): string;
133
133
  generateSignature(url: string): string;
@@ -159,6 +159,7 @@ interface WSOptionsInterface {
159
159
  jwtToken: string;
160
160
  permissions?: string[];
161
161
  channels?: string[];
162
+ wsUpdateChannels?: string[];
162
163
  user?: any;
163
164
  retry?: RetryOptions;
164
165
  }
@@ -168,9 +169,10 @@ declare class WSOptions implements WSOptionsInterface {
168
169
  jwtToken: string;
169
170
  permissions?: string[] | undefined;
170
171
  channels?: string[] | undefined;
172
+ wsUpdateChannels?: string[] | undefined;
171
173
  user?: any;
172
174
  retry?: RetryOptions | undefined;
173
- constructor(id?: string, wsServer?: string, jwtToken?: string, permissions?: string[] | undefined, channels?: string[] | undefined, user?: any, retry?: RetryOptions | undefined);
175
+ constructor(id?: string, wsServer?: string, jwtToken?: string, permissions?: string[] | undefined, channels?: string[] | undefined, wsUpdateChannels?: string[] | undefined, user?: any, retry?: RetryOptions | undefined);
174
176
  static adapt(item?: any): WSOptions;
175
177
  }
176
178
 
@@ -202,6 +204,7 @@ interface ApiRequestInterface {
202
204
  saveAs?: string;
203
205
  fileContentHeader?: string;
204
206
  ws?: WSOptions;
207
+ env?: string;
205
208
  }
206
209
  declare class ApiRequest implements ApiRequestInterface {
207
210
  server: string;
@@ -217,7 +220,8 @@ declare class ApiRequest implements ApiRequestInterface {
217
220
  saveAs?: string | undefined;
218
221
  fileContentHeader?: string | undefined;
219
222
  ws?: WSOptions | undefined;
220
- constructor(server?: string, path?: any[] | undefined, headers?: any, adapter?: any, mapper?: any, polling?: number | undefined, retry?: RetryOptions | undefined, stream?: boolean | undefined, streamType?: StreamType | undefined, displayError?: boolean | undefined, saveAs?: string | undefined, fileContentHeader?: string | undefined, ws?: WSOptions | undefined);
223
+ env?: string | undefined;
224
+ constructor(server?: string, path?: any[] | undefined, headers?: any, adapter?: any, mapper?: any, polling?: number | undefined, retry?: RetryOptions | undefined, stream?: boolean | undefined, streamType?: StreamType | undefined, displayError?: boolean | undefined, saveAs?: string | undefined, fileContentHeader?: string | undefined, ws?: WSOptions | undefined, env?: string | undefined);
221
225
  static adapt(item?: any): ApiRequest;
222
226
  }
223
227
 
@@ -338,19 +342,27 @@ declare class DatabaseManagerService extends DbService {
338
342
  }[]>;
339
343
  deleteTableRecord<T>(table: string, id: number): Observable<number | null>;
340
344
  deleteTableRecords(table: string, ids: number[]): Observable<number[]>;
341
- clearTable(table: string): Observable<unknown>;
345
+ clearTable(table: string): Observable<never[]>;
342
346
  static ɵfac: i0.ɵɵFactoryDeclaration<DatabaseManagerService, never>;
343
347
  static ɵprov: i0.ɵɵInjectableDeclaration<DatabaseManagerService>;
344
348
  }
345
349
 
346
350
  interface ChannelMessageInterface {
351
+ messageId?: number;
352
+ channel?: string;
353
+ isReplay?: boolean;
347
354
  sessionId: any;
348
355
  content: any;
356
+ timestamp?: string;
349
357
  }
350
358
  declare class ChannelMessage implements ChannelMessageInterface {
359
+ messageId?: number | undefined;
360
+ channel?: string | undefined;
361
+ isReplay?: boolean | undefined;
351
362
  sessionId: any;
352
363
  content: any;
353
- constructor(sessionId?: any, content?: any);
364
+ timestamp?: string | undefined;
365
+ constructor(messageId?: number | undefined, channel?: string | undefined, isReplay?: boolean | undefined, sessionId?: any, content?: any, timestamp?: string | undefined);
354
366
  static adapt(item?: any): ChannelMessage;
355
367
  }
356
368
 
@@ -381,7 +393,6 @@ declare class HTTPManagerStateService<T extends {
381
393
  }> extends ComponentStore<APIStateManagerData<T>> {
382
394
  private apiOptions;
383
395
  private dataType;
384
- private database?;
385
396
  httpManagerService: HTTPManagerService<any>;
386
397
  dbManagerService: DatabaseManagerService;
387
398
  localStorageManagerService: LocalStorageManagerService;
@@ -399,6 +410,7 @@ declare class HTTPManagerStateService<T extends {
399
410
  private maxRetries;
400
411
  private retryDelay;
401
412
  private shouldRetry;
413
+ private connectionStatusSubscription?;
402
414
  private databaseOptions?;
403
415
  private wsRetryAttempts;
404
416
  wsRetryAttempts$: Observable<number>;
@@ -429,10 +441,10 @@ declare class HTTPManagerStateService<T extends {
429
441
  latestCommunicationMessages$: Observable<any>;
430
442
  private userAction;
431
443
  userAction$: Observable<any>;
432
- wsConnection: boolean;
444
+ private static wsCommunicationQueue;
433
445
  wsOptions: WSOptions;
434
446
  connectionStatus$: Observable<boolean>;
435
- constructor(apiOptions: ApiRequest, dataType: DataType | undefined, database?: DatabaseStorage | undefined);
447
+ constructor(apiOptions: ApiRequest, dataType: DataType | undefined, database?: DatabaseStorage);
436
448
  /**
437
449
  * Add appropriate prefix to a channel name if not already present
438
450
  */
@@ -447,12 +459,12 @@ declare class HTTPManagerStateService<T extends {
447
459
  getBaseChannelName(channel: string): string;
448
460
  setApiRequestOptions(apiOptions?: ApiRequest, dataType?: DataType, database?: DatabaseStorage): void;
449
461
  private setupConnectionStatus;
450
- readonly initWS: (observableOrValue: WSOptions | Observable<WSOptions>) => rxjs.Subscription;
462
+ readonly initWS: (observableOrValue: WSOptions | Observable<WSOptions>) => Subscription;
451
463
  appendMessages(message: any): void;
452
464
  latestMessage(): void;
453
465
  clearMessages(): void;
454
466
  get ApiRequestOptions(): ApiRequest;
455
- readonly initDBStorage: (observableOrValue?: void | Observable<void> | undefined) => rxjs.Subscription;
467
+ readonly initDBStorage: (observableOrValue?: void | Observable<void> | undefined) => Subscription;
456
468
  initializeState(data: any): void;
457
469
  readonly data$: Observable<T | T[] | null>;
458
470
  readonly selectRecord$: (id: number) => Observable<T | T[] | null>;
@@ -461,16 +473,20 @@ declare class HTTPManagerStateService<T extends {
461
473
  private readonly addData$;
462
474
  private readonly deleteData$;
463
475
  private readonly updateData$;
464
- readonly clearRecords: (observableOrValue?: void | Observable<void> | undefined) => rxjs.Subscription;
465
- readonly fetchRecords: (options?: RequestOptions) => ((observableOrValue?: any) => rxjs.Subscription) | ((observableOrValue: any) => rxjs.Subscription);
476
+ readonly clearRecords: (observableOrValue?: void | Observable<void> | undefined) => Subscription;
477
+ readonly fetchRecords: (options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
466
478
  private initDBStorageAsync;
467
- readonly fetchRecord: (options: RequestOptions, method: string) => ((observableOrValue?: any) => rxjs.Subscription) | ((observableOrValue: any) => rxjs.Subscription);
468
- readonly createRecord: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => rxjs.Subscription) | ((observableOrValue: any) => rxjs.Subscription);
469
- readonly updateRecord: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => rxjs.Subscription) | ((observableOrValue: any) => rxjs.Subscription);
470
- readonly deleteRecord: (options?: RequestOptions) => ((observableOrValue?: any) => rxjs.Subscription) | ((observableOrValue: any) => rxjs.Subscription);
471
- readonly createStream: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => rxjs.Subscription) | ((observableOrValue: any) => rxjs.Subscription);
472
- readonly fetchStream: (options?: RequestOptions) => ((observableOrValue?: any) => rxjs.Subscription) | ((observableOrValue: any) => rxjs.Subscription);
479
+ readonly fetchRecord: (options: RequestOptions, method: string) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
480
+ readonly createRecord: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
481
+ readonly updateRecord: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
482
+ readonly deleteRecord: (options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
483
+ readonly createStream: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
484
+ readonly fetchStream: (options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
473
485
  private wsCommunication;
486
+ /**
487
+ * Actually send the WebSocket message (called when connected or from queue)
488
+ */
489
+ private sendWsCommunication;
474
490
  /**
475
491
  * Send a message to channel(s)
476
492
  * @param message - The message content
@@ -557,6 +573,12 @@ declare class HTTPManagerStateService<T extends {
557
573
  * @param channel - Base channel name (MES- prefix added automatically)
558
574
  */
559
575
  sendNotification(channel: string, content: any): void;
576
+ /**
577
+ * Clear/flush all records from the database table
578
+ * Does not clear localStorage metadata (expires info)
579
+ * Does not re-fetch from API - leaves state empty for manual refresh
580
+ */
581
+ clearDatabase(): void;
560
582
  private isEmpty;
561
583
  private updateRequestOptions;
562
584
  static ɵfac: i0.ɵɵFactoryDeclaration<HTTPManagerStateService<any>, never>;
@@ -589,6 +611,11 @@ declare class WebsocketService {
589
611
  * This uses the 'message' type which broadcasts to all subscribers in the channel
590
612
  */
591
613
  sendChannelMessage(channel: string, content: any): void;
614
+ /**
615
+ * Send a message to multiple channels at once (batch)
616
+ * Sends the new batch format and falls back to legacy per-channel messages for compatibility
617
+ */
618
+ sendChannelMessageToChannels(channels: string[], content: any): void;
592
619
  sendMessageToUser(user: string, content: any): void;
593
620
  getAllChannels(): void;
594
621
  createChannel(channel: string): void;
@@ -626,6 +653,173 @@ declare class WebsocketService {
626
653
  static ɵprov: i0.ɵɵInjectableDeclaration<WebsocketService>;
627
654
  }
628
655
 
656
+ /**
657
+ * WebSocketManagerService - Singleton WebSocket connection manager
658
+ *
659
+ * This service ensures only ONE WebSocket connection exists across ALL instances
660
+ * of HTTPManagerStateService. It uses static properties to track connection state
661
+ * globally, preventing duplicate connections when multiple state services are created.
662
+ *
663
+ * Usage:
664
+ * - Inject into HTTPManagerService (or directly into state services)
665
+ * - Call connect() with WSOptions - only the first call establishes connection
666
+ * - Subsequent calls detect existing connection and skip reconnection
667
+ * - All instances share the same connectionStatus$ and messages$ observables
668
+ */
669
+ declare class WebSocketManagerService {
670
+ private static socket;
671
+ private static isConnecting;
672
+ private static connectionInitialized;
673
+ private static lastOptions;
674
+ private static messages;
675
+ messages$: Observable<any>;
676
+ private static connectionStatus;
677
+ connectionStatus$: Observable<boolean>;
678
+ private static isSubscribed;
679
+ private static subscribedChannels;
680
+ subscribedChannels$: Observable<Set<string>>;
681
+ static getSubscribedChannels(): Set<string>;
682
+ static addSubscribedChannel(channelName: string): void;
683
+ private static onReconnect;
684
+ onReconnect$: Observable<void>;
685
+ private getSessionId;
686
+ /**
687
+ * Connect to WebSocket server
688
+ *
689
+ * IMPORTANT: Only the first call across ALL instances will establish a connection.
690
+ * Subsequent calls will detect the existing connection and return immediately.
691
+ *
692
+ * @param options - WebSocket configuration options
693
+ * @param jwtToken - Optional JWT token for authentication
694
+ */
695
+ connect(options: WSOptions, jwtToken: string): void;
696
+ /**
697
+ * Disconnect from WebSocket server
698
+ */
699
+ disconnect(): void;
700
+ private sendSubscribe;
701
+ /**
702
+ * Send subscribe with lastSeenId for message sync support
703
+ * @param channelName - Channel name to subscribe to
704
+ * @param user - User data
705
+ * @param lastSeenId - Last message ID seen (for replay)
706
+ */
707
+ sendSubscribeWithLastSeen(channelName: string, user: any, lastSeenId: number): void;
708
+ /**
709
+ * Subscribe to a channel
710
+ * @param channelName - Channel name to subscribe to
711
+ */
712
+ subscribeToChannel(channelName: string): void;
713
+ /**
714
+ * Subscribe to multiple channels
715
+ * @param channelNames - Array of channel names to subscribe to
716
+ */
717
+ subscribeToChannels(channelNames: string[]): void;
718
+ /**
719
+ * Unsubscribe from a channel
720
+ * @param channel - Channel name to unsubscribe from
721
+ */
722
+ unsubscribeFromChannel(channel: string): void;
723
+ /**
724
+ * Get currently subscribed channels
725
+ * @returns Set of subscribed channel names
726
+ */
727
+ getSubscribedChannels(): Set<string>;
728
+ /**
729
+ * Generic send method for message tracking (acks, gap requests, etc.)
730
+ * @param message - Message object to send
731
+ */
732
+ send(message: any): void;
733
+ /**
734
+ * Send broadcast message
735
+ * @param content - Message content to broadcast
736
+ */
737
+ sendBroadcast(content: any): void;
738
+ /**
739
+ * Send message in channel (state manager message)
740
+ * @param channel - Channel name
741
+ * @param content - Message content
742
+ */
743
+ sendMessageInChannel(channel: string, content: any): void;
744
+ /**
745
+ * Send channel message (broadcasts to all subscribers in the channel)
746
+ * @param channel - Channel name
747
+ * @param content - Message content
748
+ */
749
+ sendChannelMessage(channel: string, content: any): void;
750
+ /**
751
+ * Send message to multiple channels at once (batch)
752
+ * @param channels - Array of channel names
753
+ * @param content - Message content
754
+ */
755
+ sendChannelMessageToChannels(channels: string[], content: any): void;
756
+ /**
757
+ * Send message to specific user
758
+ * @param user - User identifier
759
+ * @param content - Message content
760
+ */
761
+ sendMessageToUser(user: string, content: any): void;
762
+ /**
763
+ * Request list of all channels from server
764
+ */
765
+ getAllChannels(): void;
766
+ /**
767
+ * Create a new channel on server
768
+ * @param channel - Channel name to create
769
+ */
770
+ createChannel(channel: string): void;
771
+ /**
772
+ * Delete a channel from server
773
+ * @param channel - Channel name to delete
774
+ */
775
+ deleteChannel(channel: string): void;
776
+ /**
777
+ * Get users in a specific channel
778
+ * @param channel - Channel name
779
+ */
780
+ getUsersInChannel(channel: string): void;
781
+ /**
782
+ * Create a notification channel
783
+ * @param channel - Channel name (should include MES- prefix)
784
+ */
785
+ createNotificationChannel(channel: string): void;
786
+ /**
787
+ * Get all notification channels (in-memory)
788
+ */
789
+ getNotificationChannels(): void;
790
+ /**
791
+ * Get today's notification channels from database
792
+ */
793
+ getTodaysNotificationChannels(): void;
794
+ /**
795
+ * Subscribe to a notification channel with optional date filters
796
+ * @param channel - Channel name
797
+ * @param options - Optional start/end epoch filters
798
+ * @param user - User information
799
+ */
800
+ subscribeToNotificationChannel(channel: string, options?: {
801
+ startEpoch?: number;
802
+ endEpoch?: number;
803
+ }, user?: any): void;
804
+ /**
805
+ * Unsubscribe from a notification channel
806
+ * @param channel - Channel name
807
+ */
808
+ unsubscribeFromNotificationChannel(channel: string): void;
809
+ /**
810
+ * Check if WebSocket connection is currently open
811
+ * @returns true if connected, false otherwise
812
+ */
813
+ static isConnected(): boolean;
814
+ /**
815
+ * Check if connection has been initialized (attempted at least once)
816
+ * @returns true if connection was initialized, false otherwise
817
+ */
818
+ static isInitialized(): boolean;
819
+ static ɵfac: i0.ɵɵFactoryDeclaration<WebSocketManagerService, never>;
820
+ static ɵprov: i0.ɵɵInjectableDeclaration<WebSocketManagerService>;
821
+ }
822
+
629
823
  declare class RequestService extends WebsocketService {
630
824
  private http;
631
825
  private pathQueryService;
@@ -757,11 +951,173 @@ declare class ObjectMergerService {
757
951
  static ɵprov: i0.ɵɵInjectableDeclaration<ObjectMergerService>;
758
952
  }
759
953
 
954
+ /**
955
+ * Message Tracker Service - Guaranteed Message Delivery
956
+ *
957
+ * Tracks message IDs, detects gaps, manages acknowledgments, and handles sync.
958
+ * Ensures frontend clients never miss messages even during disconnections.
959
+ *
960
+ * Features:
961
+ * - Per-channel message sequence tracking
962
+ * - Automatic gap detection and recovery
963
+ * - Batch acknowledgments (configurable interval)
964
+ * - Reconnection sync with last-seen tracking
965
+ * - Gap threshold alerting (10 messages before UI notification)
966
+ */
967
+ declare class MessageTrackerService implements OnDestroy {
968
+ private wsManager;
969
+ /** Batch acknowledgment interval in milliseconds */
970
+ private readonly BATCH_ACK_INTERVAL_MS;
971
+ /** Maximum gap before alerting UI */
972
+ private readonly GAP_THRESHOLD;
973
+ /** Maximum messages to store in pending acks before forcing batch */
974
+ private readonly MAX_PENDING_ACKS;
975
+ /**
976
+ * Track last seen message ID per channel
977
+ * Map<channelName, lastMessageId>
978
+ */
979
+ private lastSeen;
980
+ /**
981
+ * Expected next message ID per channel (for gap detection)
982
+ * Map<channelName, nextExpectedId>
983
+ */
984
+ private expectedSequence;
985
+ /**
986
+ * Pending acknowledgments per channel
987
+ * Map<channelName, Set<messageId>>
988
+ */
989
+ private pendingAcks;
990
+ /**
991
+ * Gap count per channel (for threshold alerting)
992
+ * Map<channelName, gapCount>
993
+ */
994
+ private gapCounts;
995
+ /**
996
+ * Replay mode tracking (per channel)
997
+ * Used to distinguish replay vs live messages
998
+ */
999
+ private inReplayMode;
1000
+ /**
1001
+ * Gap retry count (for retry logic)
1002
+ * Map<channel, retryCount>
1003
+ */
1004
+ private gapRetryCount;
1005
+ /** Batch acknowledgment timer */
1006
+ private batchAckTimer;
1007
+ /** Subscription to WebSocket messages */
1008
+ private messagesSubscription;
1009
+ /**
1010
+ * Track channels we want to be subscribed to (survives disconnect/reconnect)
1011
+ * This is separate from WebSocketManagerService.subscribedChannels which tracks
1012
+ * actual active subscriptions
1013
+ */
1014
+ private intendedChannels;
1015
+ /** Observable to emit processed messages to UI components */
1016
+ private messagesSubject;
1017
+ messages$: Observable<any>;
1018
+ constructor(wsManager: WebSocketManagerService);
1019
+ ngOnDestroy(): void;
1020
+ /**
1021
+ * Process incoming message
1022
+ * Tracks ID, detects gaps, queues acknowledgment
1023
+ */
1024
+ private onMessage;
1025
+ /**
1026
+ * Track message ID and detect gaps
1027
+ */
1028
+ private trackMessage;
1029
+ /**
1030
+ * Queue message for batch acknowledgment
1031
+ */
1032
+ private queueAck;
1033
+ /**
1034
+ * Start batch acknowledgment timer
1035
+ */
1036
+ private startBatchAckTimer;
1037
+ /**
1038
+ * Stop batch acknowledgment timer
1039
+ */
1040
+ private stopBatchAckTimer;
1041
+ /**
1042
+ * Send batch acknowledgments for all channels with pending acks
1043
+ */
1044
+ private sendAllBatchAcks;
1045
+ /**
1046
+ * Send batch acknowledgment for a specific channel
1047
+ */
1048
+ private sendBatchAck;
1049
+ /**
1050
+ * Request missing messages from server
1051
+ */
1052
+ private requestGapFill;
1053
+ /**
1054
+ * Handle gap threshold exceeded (optional: alert UI)
1055
+ */
1056
+ private onGapThresholdExceeded;
1057
+ /**
1058
+ * Subscribe to channel with sync support
1059
+ * Automatically includes lastSeenId for replay
1060
+ */
1061
+ subscribeToChannel(channel: string, userData?: any): void;
1062
+ /**
1063
+ * Re-subscribe to all previously subscribed channels after reconnect
1064
+ * Includes lastSeenId for each channel to trigger message replay
1065
+ */
1066
+ private reSubscribeAllChannels;
1067
+ /**
1068
+ * Persist lastSeen to sessionStorage (survives page reload)
1069
+ */
1070
+ private persistLastSeen;
1071
+ /**
1072
+ * Restore lastSeen from sessionStorage
1073
+ */
1074
+ private restoreLastSeen;
1075
+ /**
1076
+ * Persist intendedChannels to sessionStorage
1077
+ */
1078
+ private persistIntendedChannels;
1079
+ /**
1080
+ * Restore intendedChannels from sessionStorage
1081
+ */
1082
+ private restoreIntendedChannels;
1083
+ /**
1084
+ * Get last seen message ID for a channel
1085
+ */
1086
+ getLastSeenId(channel: string): number;
1087
+ /**
1088
+ * Get expected next message ID for a channel
1089
+ */
1090
+ getExpectedNextId(channel: string): number;
1091
+ /**
1092
+ * Check if currently in replay mode for a channel
1093
+ */
1094
+ isInReplayMode(channel: string): boolean;
1095
+ /**
1096
+ * Get gap count for a channel
1097
+ */
1098
+ getGapCount(channel: string): number;
1099
+ /**
1100
+ * Get skipped IDs between expected and received (for detailed gap reporting)
1101
+ */
1102
+ private getSkippedIds;
1103
+ /**
1104
+ * Clear all tracking state (useful for debugging or manual reset)
1105
+ */
1106
+ clearState(): void;
1107
+ static ɵfac: i0.ɵɵFactoryDeclaration<MessageTrackerService, never>;
1108
+ static ɵprov: i0.ɵɵInjectableDeclaration<MessageTrackerService>;
1109
+ }
1110
+
760
1111
  declare class HTTPManagerService<T> extends RequestService {
761
1112
  private configOptions?;
762
1113
  toastMessage: ToastMessageDisplayService;
763
1114
  ng_injector: Injector;
764
1115
  objectMergerService: ObjectMergerService;
1116
+ wsManager: WebSocketManagerService;
1117
+ messageTracker: MessageTrackerService;
1118
+ connectionStatus$: Observable<boolean>;
1119
+ messages$: Observable<any>;
1120
+ subscribedChannels$: Observable<Set<string>>;
765
1121
  private countdown;
766
1122
  countdown$: Observable<number>;
767
1123
  private error;
@@ -771,6 +1127,87 @@ declare class HTTPManagerService<T> extends RequestService {
771
1127
  private polling$;
772
1128
  config: ApiRequest;
773
1129
  constructor(configOptions?: ConfigOptions | undefined);
1130
+ /**
1131
+ * Connect to WebSocket server
1132
+ * Only the first call across ALL instances will establish a connection
1133
+ */
1134
+ connect(options: any, jwtToken: string): void;
1135
+ /**
1136
+ * Disconnect from WebSocket server
1137
+ */
1138
+ disconnect(): void;
1139
+ /**
1140
+ * Subscribe to a channel
1141
+ */
1142
+ subscribeToChannel(channel: string, userData?: any): void;
1143
+ /**
1144
+ * Subscribe to multiple channels
1145
+ */
1146
+ subscribeToChannels(channels: string[], userData?: any): void;
1147
+ /**
1148
+ * Unsubscribe from a channel
1149
+ */
1150
+ unsubscribeFromChannel(channel: string): void;
1151
+ /**
1152
+ * Get currently subscribed channels
1153
+ */
1154
+ getSubscribedChannels(): Set<string>;
1155
+ /**
1156
+ * Send broadcast message
1157
+ */
1158
+ sendBroadcast(content: any): void;
1159
+ /**
1160
+ * Send message in channel (state manager message)
1161
+ */
1162
+ sendMessageInChannel(channel: string, content: any): void;
1163
+ /**
1164
+ * Send channel message
1165
+ */
1166
+ sendChannelMessage(channel: string, content: any): void;
1167
+ /**
1168
+ * Send message to multiple channels
1169
+ */
1170
+ sendChannelMessageToChannels(channels: string[], content: any): void;
1171
+ /**
1172
+ * Send message to user
1173
+ */
1174
+ sendMessageToUser(user: string, content: any): void;
1175
+ /**
1176
+ * Get all channels
1177
+ */
1178
+ getAllChannels(): void;
1179
+ /**
1180
+ * Create channel
1181
+ */
1182
+ createChannel(channel: string): void;
1183
+ /**
1184
+ * Delete channel
1185
+ */
1186
+ deleteChannel(channel: string): void;
1187
+ /**
1188
+ * Get users in channel
1189
+ */
1190
+ getUsersInChannel(channel: string): void;
1191
+ /**
1192
+ * Create notification channel
1193
+ */
1194
+ createNotificationChannel(channel: string): void;
1195
+ /**
1196
+ * Get notification channels
1197
+ */
1198
+ getNotificationChannels(): void;
1199
+ /**
1200
+ * Get today's notification channels
1201
+ */
1202
+ getTodaysNotificationChannels(): void;
1203
+ /**
1204
+ * Subscribe to notification channel
1205
+ */
1206
+ subscribeToNotificationChannel(channel: string, options?: any, user?: any): void;
1207
+ /**
1208
+ * Unsubscribe from notification channel
1209
+ */
1210
+ unsubscribeFromNotificationChannel(channel: string): void;
774
1211
  getRequest<T>(options?: ApiRequest, params?: any[]): Observable<T>;
775
1212
  postRequest<T extends {
776
1213
  id?: number | string;
@@ -965,6 +1402,16 @@ declare class LocalStorageManagerService extends ComponentStore<State> implement
965
1402
  private validStoreName;
966
1403
  private hasGlobalStorage;
967
1404
  ngOnDestroy(): void;
1405
+ /**
1406
+ * Clears all stored data from localStorage and sessionStorage
1407
+ * Use this method to recover from corrupted data errors
1408
+ */
1409
+ clearAllStoredData(): void;
1410
+ /**
1411
+ * Checks if stored data appears to be corrupted
1412
+ * Returns true if data appears corrupted
1413
+ */
1414
+ checkForCorruptedData(): boolean;
968
1415
  static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageManagerService, [{ optional: true; }]>;
969
1416
  static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageManagerService>;
970
1417
  }
@@ -1171,7 +1618,6 @@ declare class HttpRequestServicesDemoComponent implements OnInit {
1171
1618
  server: string;
1172
1619
  user?: UserData;
1173
1620
  path: string[];
1174
- wsChannel: string;
1175
1621
  adapter?: Function;
1176
1622
  mapper?: Function;
1177
1623
  requestTypes: ({
@@ -1199,7 +1645,7 @@ declare class HttpRequestServicesDemoComponent implements OnInit {
1199
1645
  ngOnInit(): void;
1200
1646
  onSelected(type: number): void;
1201
1647
  static ɵfac: i0.ɵɵFactoryDeclaration<HttpRequestServicesDemoComponent, never>;
1202
- static ɵcmp: i0.ɵɵComponentDeclaration<HttpRequestServicesDemoComponent, "app-http-request-services-demo", never, { "wsServer": { "alias": "wsServer"; "required": false; }; "jwtToken": { "alias": "jwtToken"; "required": false; }; "server": { "alias": "server"; "required": false; }; "user": { "alias": "user"; "required": false; }; "path": { "alias": "path"; "required": false; }; "wsChannel": { "alias": "wsChannel"; "required": false; }; "adapter": { "alias": "adapter"; "required": false; }; "mapper": { "alias": "mapper"; "required": false; }; }, {}, never, never, false, never>;
1648
+ static ɵcmp: i0.ɵɵComponentDeclaration<HttpRequestServicesDemoComponent, "app-http-request-services-demo", never, { "wsServer": { "alias": "wsServer"; "required": false; }; "jwtToken": { "alias": "jwtToken"; "required": false; }; "server": { "alias": "server"; "required": false; }; "user": { "alias": "user"; "required": false; }; "path": { "alias": "path"; "required": false; }; "adapter": { "alias": "adapter"; "required": false; }; "mapper": { "alias": "mapper"; "required": false; }; }, {}, never, never, false, never>;
1203
1649
  }
1204
1650
 
1205
1651
  interface ClientInfoInterface$1 {
@@ -1746,8 +2192,13 @@ declare class StateServiceDemo extends HTTPManagerStateService<any> {
1746
2192
  constructor();
1747
2193
  /**
1748
2194
  * Initialize WebSocket connection with server configuration
2195
+ * @param server - Backend server URL
2196
+ * @param wsServer - WebSocket server URL
2197
+ * @param jwtToken - JWT authentication token
2198
+ * @param user - User information
2199
+ * @param path - Path for constructing channel name (e.g., ['ai','tests'])
1749
2200
  */
1750
- updateConnection(server: string, wsServer: string, jwtToken: string, user: any): void;
2201
+ updateConnection(server: string, wsServer: string, jwtToken: string, user: any, path?: (string | number)[]): void;
1751
2202
  /**
1752
2203
  * Get all available channels
1753
2204
  */
@@ -1917,7 +2368,6 @@ declare class RequestManagerWsDemoComponent implements OnInit {
1917
2368
  jwtToken: string;
1918
2369
  user: any;
1919
2370
  path: string[];
1920
- wsChannel: string;
1921
2371
  user$: rxjs.Observable<WSUser | null>;
1922
2372
  attempts$: rxjs.Observable<number>;
1923
2373
  nextRetry$: rxjs.Observable<number>;
@@ -1926,7 +2376,7 @@ declare class RequestManagerWsDemoComponent implements OnInit {
1926
2376
  isPending$: rxjs.Observable<boolean>;
1927
2377
  ngOnInit(): void;
1928
2378
  static ɵfac: i0.ɵɵFactoryDeclaration<RequestManagerWsDemoComponent, never>;
1929
- static ɵcmp: i0.ɵɵComponentDeclaration<RequestManagerWsDemoComponent, "app-request-manager-ws-demo", never, { "server": { "alias": "server"; "required": false; }; "wsServer": { "alias": "wsServer"; "required": false; }; "jwtToken": { "alias": "jwtToken"; "required": false; }; "user": { "alias": "user"; "required": false; }; "path": { "alias": "path"; "required": false; }; "wsChannel": { "alias": "wsChannel"; "required": false; }; }, {}, never, never, false, never>;
2379
+ static ɵcmp: i0.ɵɵComponentDeclaration<RequestManagerWsDemoComponent, "app-request-manager-ws-demo", never, { "server": { "alias": "server"; "required": false; }; "wsServer": { "alias": "wsServer"; "required": false; }; "jwtToken": { "alias": "jwtToken"; "required": false; }; "user": { "alias": "user"; "required": false; }; "path": { "alias": "path"; "required": false; }; }, {}, never, never, false, never>;
1930
2380
  }
1931
2381
 
1932
2382
  declare class SettingsStateService extends StoreStateManagerService {
@@ -1994,9 +2444,9 @@ declare class DatabaseDataSource extends DataSource<TableRecord> {
1994
2444
  declare class StateDataRequestService extends HTTPManagerStateService<any> {
1995
2445
  attempts$: rxjs.Observable<number>;
1996
2446
  nextRetry$: rxjs.Observable<number>;
1997
- path: string[];
2447
+ path: (string | number)[];
1998
2448
  constructor();
1999
- updateConnection(server: string, wsServer: string, jwtToken: string, user: any, path?: string[], wsChannel?: string): void;
2449
+ updateConnection(server: string, wsServer: string, jwtToken: string, user: any, path?: (string | number)[]): void;
2000
2450
  addData(): void;
2001
2451
  sendMessage(data: ChannelMessage): void;
2002
2452
  getData(): void;
@@ -2011,8 +2461,7 @@ declare class WsDataControlComponent implements OnInit {
2011
2461
  wsServer: string;
2012
2462
  jwtToken: string;
2013
2463
  user: any;
2014
- path: string[];
2015
- wsChannel: string;
2464
+ path: (string | number)[];
2016
2465
  stateDataRequestService: StateDataRequestService;
2017
2466
  user$: rxjs.Observable<http_request_manager.WSUser | null>;
2018
2467
  users$: rxjs.Observable<any[]>;
@@ -2025,7 +2474,7 @@ declare class WsDataControlComponent implements OnInit {
2025
2474
  onUpdateData(data: any[]): void;
2026
2475
  onRemoveData(data: any): void;
2027
2476
  static ɵfac: i0.ɵɵFactoryDeclaration<WsDataControlComponent, never>;
2028
- static ɵcmp: i0.ɵɵComponentDeclaration<WsDataControlComponent, "app-ws-data-control", never, { "server": { "alias": "server"; "required": false; }; "wsServer": { "alias": "wsServer"; "required": false; }; "jwtToken": { "alias": "jwtToken"; "required": false; }; "user": { "alias": "user"; "required": false; }; "path": { "alias": "path"; "required": false; }; "wsChannel": { "alias": "wsChannel"; "required": false; }; }, {}, never, never, false, never>;
2477
+ static ɵcmp: i0.ɵɵComponentDeclaration<WsDataControlComponent, "app-ws-data-control", never, { "server": { "alias": "server"; "required": false; }; "wsServer": { "alias": "wsServer"; "required": false; }; "jwtToken": { "alias": "jwtToken"; "required": false; }; "user": { "alias": "user"; "required": false; }; "path": { "alias": "path"; "required": false; }; }, {}, never, never, false, never>;
2029
2478
  }
2030
2479
 
2031
2480
  declare class WsMessagingComponent implements OnInit, OnDestroy {
@@ -2033,6 +2482,7 @@ declare class WsMessagingComponent implements OnInit, OnDestroy {
2033
2482
  wsServer: string;
2034
2483
  jwtToken: string;
2035
2484
  user: any;
2485
+ path: (string | number)[];
2036
2486
  private destroy$;
2037
2487
  fb: FormBuilder;
2038
2488
  messageService: MessageServiceDemo;
@@ -2088,7 +2538,7 @@ declare class WsMessagingComponent implements OnInit, OnDestroy {
2088
2538
  onChipClick(channel: string, subscribedChannels: string[]): void;
2089
2539
  onSendMessage(user: WSUser): void;
2090
2540
  static ɵfac: i0.ɵɵFactoryDeclaration<WsMessagingComponent, never>;
2091
- static ɵcmp: i0.ɵɵComponentDeclaration<WsMessagingComponent, "app-ws-messaging", never, { "server": { "alias": "server"; "required": false; }; "wsServer": { "alias": "wsServer"; "required": false; }; "jwtToken": { "alias": "jwtToken"; "required": false; }; "user": { "alias": "user"; "required": false; }; }, {}, never, never, false, never>;
2541
+ static ɵcmp: i0.ɵɵComponentDeclaration<WsMessagingComponent, "app-ws-messaging", never, { "server": { "alias": "server"; "required": false; }; "wsServer": { "alias": "wsServer"; "required": false; }; "jwtToken": { "alias": "jwtToken"; "required": false; }; "user": { "alias": "user"; "required": false; }; "path": { "alias": "path"; "required": false; }; }, {}, never, never, false, never>;
2092
2542
  }
2093
2543
 
2094
2544
  declare class WsNotificationsComponent implements OnInit, OnDestroy {
@@ -2273,5 +2723,5 @@ declare class HttpRequestManagerModule {
2273
2723
  static ɵinj: i0.ɵɵInjectorDeclaration<HttpRequestManagerModule>;
2274
2724
  }
2275
2725
 
2276
- export { ApiRequest, AppService, AsymmetricalEncryptionService, CONFIG_SETTINGS_TOKEN, ChannelInfo, ChannelType, CommunicationType, ConfigHTTPOptions, ConfigOptions, DataType, DatabaseDataDemoComponent, DatabaseManagerService, DatabaseStorage, DbService, ErrorDisplaySettings, GlobalStoreOptions, HTTPManagerService, HTTPManagerSignalsService, HTTPManagerStateService, HeadersService, HttpRequestManagerModule, HttpRequestServicesDemoComponent, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsManagerService, PathQueryService, Random, RandomHSLColor, RandomHexColor, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomPaletteColor, RandomSignature, RandomStr, RandomVisibleColor, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, StreamType, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UserData, UtilsService, WSOptions, WSUser, WebsocketService, WithCredentialsInterceptor, countdown, createChannelName, delayedRetry, requestPolling, requestStreaming, streamAI, streamAuto, streamEvents, streamJSON, streamNDJSON };
2726
+ export { ApiRequest, AppService, AsymmetricalEncryptionService, CONFIG_SETTINGS_TOKEN, ChannelInfo, ChannelType, CommunicationType, ConfigHTTPOptions, ConfigOptions, DataType, DatabaseDataDemoComponent, DatabaseManagerService, DatabaseStorage, DbService, ErrorDisplaySettings, GlobalStoreOptions, HTTPManagerService, HTTPManagerSignalsService, HTTPManagerStateService, HeadersService, HttpRequestManagerModule, HttpRequestServicesDemoComponent, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsManagerService, PathQueryService, Random, RandomHSLColor, RandomHexColor, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomPaletteColor, RandomSignature, RandomStr, RandomVisibleColor, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, StreamType, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UserData, UtilsService, WSOptions, WSUser, WebSocketManagerService, WebsocketService, WithCredentialsInterceptor, countdown, createChannelName, delayedRetry, requestPolling, requestStreaming, streamAI, streamAuto, streamEvents, streamJSON, streamNDJSON };
2277
2727
  export type { APIStateManagerData, ApiRequestInterface, ChannelInfoInterface, ConfigHTTPOptionsInterface, ConfigOptionsInterface, DatabaseStorageInterface, ErrorDisplaySettingsInterface, GlobalStoreOptionsInterface, LocalStorageOptionsInterface, ParsingResult, RequestOptionsInterface, RetryOptionsInterface, SettingOptionsInterface, State, StateStorageOptionsInterface, StateStoreManagerData, StorageDataInterface, StorageOptionInterface, StreamConfig, StreamEvent, TableRecord, TableSchemaDefInterface, UserDataInterface, WSOptionsInterface, WSUserInterface };