http-request-manager 18.7.31 → 18.9.0
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
|
|
2
|
+
import { Observable, Subscription, BehaviorSubject, OperatorFunction } from 'rxjs';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken,
|
|
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
|
-
|
|
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
|
|
|
@@ -344,13 +348,21 @@ declare class DatabaseManagerService extends DbService {
|
|
|
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
|
-
|
|
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
|
|
|
@@ -399,6 +411,7 @@ declare class HTTPManagerStateService<T extends {
|
|
|
399
411
|
private maxRetries;
|
|
400
412
|
private retryDelay;
|
|
401
413
|
private shouldRetry;
|
|
414
|
+
private connectionStatusSubscription?;
|
|
402
415
|
private databaseOptions?;
|
|
403
416
|
private wsRetryAttempts;
|
|
404
417
|
wsRetryAttempts$: Observable<number>;
|
|
@@ -429,7 +442,7 @@ declare class HTTPManagerStateService<T extends {
|
|
|
429
442
|
latestCommunicationMessages$: Observable<any>;
|
|
430
443
|
private userAction;
|
|
431
444
|
userAction$: Observable<any>;
|
|
432
|
-
|
|
445
|
+
private static wsCommunicationQueue;
|
|
433
446
|
wsOptions: WSOptions;
|
|
434
447
|
connectionStatus$: Observable<boolean>;
|
|
435
448
|
constructor(apiOptions: ApiRequest, dataType: DataType | undefined, database?: DatabaseStorage | undefined);
|
|
@@ -447,12 +460,12 @@ declare class HTTPManagerStateService<T extends {
|
|
|
447
460
|
getBaseChannelName(channel: string): string;
|
|
448
461
|
setApiRequestOptions(apiOptions?: ApiRequest, dataType?: DataType, database?: DatabaseStorage): void;
|
|
449
462
|
private setupConnectionStatus;
|
|
450
|
-
readonly initWS: (observableOrValue: WSOptions | Observable<WSOptions>) =>
|
|
463
|
+
readonly initWS: (observableOrValue: WSOptions | Observable<WSOptions>) => Subscription;
|
|
451
464
|
appendMessages(message: any): void;
|
|
452
465
|
latestMessage(): void;
|
|
453
466
|
clearMessages(): void;
|
|
454
467
|
get ApiRequestOptions(): ApiRequest;
|
|
455
|
-
readonly initDBStorage: (observableOrValue?: void | Observable<void> | undefined) =>
|
|
468
|
+
readonly initDBStorage: (observableOrValue?: void | Observable<void> | undefined) => Subscription;
|
|
456
469
|
initializeState(data: any): void;
|
|
457
470
|
readonly data$: Observable<T | T[] | null>;
|
|
458
471
|
readonly selectRecord$: (id: number) => Observable<T | T[] | null>;
|
|
@@ -461,16 +474,20 @@ declare class HTTPManagerStateService<T extends {
|
|
|
461
474
|
private readonly addData$;
|
|
462
475
|
private readonly deleteData$;
|
|
463
476
|
private readonly updateData$;
|
|
464
|
-
readonly clearRecords: (observableOrValue?: void | Observable<void> | undefined) =>
|
|
465
|
-
readonly fetchRecords: (options?: RequestOptions) => ((observableOrValue?: any) =>
|
|
477
|
+
readonly clearRecords: (observableOrValue?: void | Observable<void> | undefined) => Subscription;
|
|
478
|
+
readonly fetchRecords: (options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
|
|
466
479
|
private initDBStorageAsync;
|
|
467
|
-
readonly fetchRecord: (options: RequestOptions, method: string) => ((observableOrValue?: any) =>
|
|
468
|
-
readonly createRecord: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) =>
|
|
469
|
-
readonly updateRecord: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) =>
|
|
470
|
-
readonly deleteRecord: (options?: RequestOptions) => ((observableOrValue?: any) =>
|
|
471
|
-
readonly createStream: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) =>
|
|
472
|
-
readonly fetchStream: (options?: RequestOptions) => ((observableOrValue?: any) =>
|
|
480
|
+
readonly fetchRecord: (options: RequestOptions, method: string) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
|
|
481
|
+
readonly createRecord: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
|
|
482
|
+
readonly updateRecord: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
|
|
483
|
+
readonly deleteRecord: (options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
|
|
484
|
+
readonly createStream: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
|
|
485
|
+
readonly fetchStream: (options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
|
|
473
486
|
private wsCommunication;
|
|
487
|
+
/**
|
|
488
|
+
* Actually send the WebSocket message (called when connected or from queue)
|
|
489
|
+
*/
|
|
490
|
+
private sendWsCommunication;
|
|
474
491
|
/**
|
|
475
492
|
* Send a message to channel(s)
|
|
476
493
|
* @param message - The message content
|
|
@@ -589,6 +606,11 @@ declare class WebsocketService {
|
|
|
589
606
|
* This uses the 'message' type which broadcasts to all subscribers in the channel
|
|
590
607
|
*/
|
|
591
608
|
sendChannelMessage(channel: string, content: any): void;
|
|
609
|
+
/**
|
|
610
|
+
* Send a message to multiple channels at once (batch)
|
|
611
|
+
* Sends the new batch format and falls back to legacy per-channel messages for compatibility
|
|
612
|
+
*/
|
|
613
|
+
sendChannelMessageToChannels(channels: string[], content: any): void;
|
|
592
614
|
sendMessageToUser(user: string, content: any): void;
|
|
593
615
|
getAllChannels(): void;
|
|
594
616
|
createChannel(channel: string): void;
|
|
@@ -626,6 +648,173 @@ declare class WebsocketService {
|
|
|
626
648
|
static ɵprov: i0.ɵɵInjectableDeclaration<WebsocketService>;
|
|
627
649
|
}
|
|
628
650
|
|
|
651
|
+
/**
|
|
652
|
+
* WebSocketManagerService - Singleton WebSocket connection manager
|
|
653
|
+
*
|
|
654
|
+
* This service ensures only ONE WebSocket connection exists across ALL instances
|
|
655
|
+
* of HTTPManagerStateService. It uses static properties to track connection state
|
|
656
|
+
* globally, preventing duplicate connections when multiple state services are created.
|
|
657
|
+
*
|
|
658
|
+
* Usage:
|
|
659
|
+
* - Inject into HTTPManagerService (or directly into state services)
|
|
660
|
+
* - Call connect() with WSOptions - only the first call establishes connection
|
|
661
|
+
* - Subsequent calls detect existing connection and skip reconnection
|
|
662
|
+
* - All instances share the same connectionStatus$ and messages$ observables
|
|
663
|
+
*/
|
|
664
|
+
declare class WebSocketManagerService {
|
|
665
|
+
private static socket;
|
|
666
|
+
private static isConnecting;
|
|
667
|
+
private static connectionInitialized;
|
|
668
|
+
private static lastOptions;
|
|
669
|
+
private static messages;
|
|
670
|
+
messages$: Observable<any>;
|
|
671
|
+
private static connectionStatus;
|
|
672
|
+
connectionStatus$: Observable<boolean>;
|
|
673
|
+
private static isSubscribed;
|
|
674
|
+
private static subscribedChannels;
|
|
675
|
+
subscribedChannels$: Observable<Set<string>>;
|
|
676
|
+
static getSubscribedChannels(): Set<string>;
|
|
677
|
+
static addSubscribedChannel(channelName: string): void;
|
|
678
|
+
private static onReconnect;
|
|
679
|
+
onReconnect$: Observable<void>;
|
|
680
|
+
private getSessionId;
|
|
681
|
+
/**
|
|
682
|
+
* Connect to WebSocket server
|
|
683
|
+
*
|
|
684
|
+
* IMPORTANT: Only the first call across ALL instances will establish a connection.
|
|
685
|
+
* Subsequent calls will detect the existing connection and return immediately.
|
|
686
|
+
*
|
|
687
|
+
* @param options - WebSocket configuration options
|
|
688
|
+
* @param jwtToken - Optional JWT token for authentication
|
|
689
|
+
*/
|
|
690
|
+
connect(options: WSOptions, jwtToken: string): void;
|
|
691
|
+
/**
|
|
692
|
+
* Disconnect from WebSocket server
|
|
693
|
+
*/
|
|
694
|
+
disconnect(): void;
|
|
695
|
+
private sendSubscribe;
|
|
696
|
+
/**
|
|
697
|
+
* Send subscribe with lastSeenId for message sync support
|
|
698
|
+
* @param channelName - Channel name to subscribe to
|
|
699
|
+
* @param user - User data
|
|
700
|
+
* @param lastSeenId - Last message ID seen (for replay)
|
|
701
|
+
*/
|
|
702
|
+
sendSubscribeWithLastSeen(channelName: string, user: any, lastSeenId: number): void;
|
|
703
|
+
/**
|
|
704
|
+
* Subscribe to a channel
|
|
705
|
+
* @param channelName - Channel name to subscribe to
|
|
706
|
+
*/
|
|
707
|
+
subscribeToChannel(channelName: string): void;
|
|
708
|
+
/**
|
|
709
|
+
* Subscribe to multiple channels
|
|
710
|
+
* @param channelNames - Array of channel names to subscribe to
|
|
711
|
+
*/
|
|
712
|
+
subscribeToChannels(channelNames: string[]): void;
|
|
713
|
+
/**
|
|
714
|
+
* Unsubscribe from a channel
|
|
715
|
+
* @param channel - Channel name to unsubscribe from
|
|
716
|
+
*/
|
|
717
|
+
unsubscribeFromChannel(channel: string): void;
|
|
718
|
+
/**
|
|
719
|
+
* Get currently subscribed channels
|
|
720
|
+
* @returns Set of subscribed channel names
|
|
721
|
+
*/
|
|
722
|
+
getSubscribedChannels(): Set<string>;
|
|
723
|
+
/**
|
|
724
|
+
* Generic send method for message tracking (acks, gap requests, etc.)
|
|
725
|
+
* @param message - Message object to send
|
|
726
|
+
*/
|
|
727
|
+
send(message: any): void;
|
|
728
|
+
/**
|
|
729
|
+
* Send broadcast message
|
|
730
|
+
* @param content - Message content to broadcast
|
|
731
|
+
*/
|
|
732
|
+
sendBroadcast(content: any): void;
|
|
733
|
+
/**
|
|
734
|
+
* Send message in channel (state manager message)
|
|
735
|
+
* @param channel - Channel name
|
|
736
|
+
* @param content - Message content
|
|
737
|
+
*/
|
|
738
|
+
sendMessageInChannel(channel: string, content: any): void;
|
|
739
|
+
/**
|
|
740
|
+
* Send channel message (broadcasts to all subscribers in the channel)
|
|
741
|
+
* @param channel - Channel name
|
|
742
|
+
* @param content - Message content
|
|
743
|
+
*/
|
|
744
|
+
sendChannelMessage(channel: string, content: any): void;
|
|
745
|
+
/**
|
|
746
|
+
* Send message to multiple channels at once (batch)
|
|
747
|
+
* @param channels - Array of channel names
|
|
748
|
+
* @param content - Message content
|
|
749
|
+
*/
|
|
750
|
+
sendChannelMessageToChannels(channels: string[], content: any): void;
|
|
751
|
+
/**
|
|
752
|
+
* Send message to specific user
|
|
753
|
+
* @param user - User identifier
|
|
754
|
+
* @param content - Message content
|
|
755
|
+
*/
|
|
756
|
+
sendMessageToUser(user: string, content: any): void;
|
|
757
|
+
/**
|
|
758
|
+
* Request list of all channels from server
|
|
759
|
+
*/
|
|
760
|
+
getAllChannels(): void;
|
|
761
|
+
/**
|
|
762
|
+
* Create a new channel on server
|
|
763
|
+
* @param channel - Channel name to create
|
|
764
|
+
*/
|
|
765
|
+
createChannel(channel: string): void;
|
|
766
|
+
/**
|
|
767
|
+
* Delete a channel from server
|
|
768
|
+
* @param channel - Channel name to delete
|
|
769
|
+
*/
|
|
770
|
+
deleteChannel(channel: string): void;
|
|
771
|
+
/**
|
|
772
|
+
* Get users in a specific channel
|
|
773
|
+
* @param channel - Channel name
|
|
774
|
+
*/
|
|
775
|
+
getUsersInChannel(channel: string): void;
|
|
776
|
+
/**
|
|
777
|
+
* Create a notification channel
|
|
778
|
+
* @param channel - Channel name (should include MES- prefix)
|
|
779
|
+
*/
|
|
780
|
+
createNotificationChannel(channel: string): void;
|
|
781
|
+
/**
|
|
782
|
+
* Get all notification channels (in-memory)
|
|
783
|
+
*/
|
|
784
|
+
getNotificationChannels(): void;
|
|
785
|
+
/**
|
|
786
|
+
* Get today's notification channels from database
|
|
787
|
+
*/
|
|
788
|
+
getTodaysNotificationChannels(): void;
|
|
789
|
+
/**
|
|
790
|
+
* Subscribe to a notification channel with optional date filters
|
|
791
|
+
* @param channel - Channel name
|
|
792
|
+
* @param options - Optional start/end epoch filters
|
|
793
|
+
* @param user - User information
|
|
794
|
+
*/
|
|
795
|
+
subscribeToNotificationChannel(channel: string, options?: {
|
|
796
|
+
startEpoch?: number;
|
|
797
|
+
endEpoch?: number;
|
|
798
|
+
}, user?: any): void;
|
|
799
|
+
/**
|
|
800
|
+
* Unsubscribe from a notification channel
|
|
801
|
+
* @param channel - Channel name
|
|
802
|
+
*/
|
|
803
|
+
unsubscribeFromNotificationChannel(channel: string): void;
|
|
804
|
+
/**
|
|
805
|
+
* Check if WebSocket connection is currently open
|
|
806
|
+
* @returns true if connected, false otherwise
|
|
807
|
+
*/
|
|
808
|
+
static isConnected(): boolean;
|
|
809
|
+
/**
|
|
810
|
+
* Check if connection has been initialized (attempted at least once)
|
|
811
|
+
* @returns true if connection was initialized, false otherwise
|
|
812
|
+
*/
|
|
813
|
+
static isInitialized(): boolean;
|
|
814
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WebSocketManagerService, never>;
|
|
815
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WebSocketManagerService>;
|
|
816
|
+
}
|
|
817
|
+
|
|
629
818
|
declare class RequestService extends WebsocketService {
|
|
630
819
|
private http;
|
|
631
820
|
private pathQueryService;
|
|
@@ -757,11 +946,173 @@ declare class ObjectMergerService {
|
|
|
757
946
|
static ɵprov: i0.ɵɵInjectableDeclaration<ObjectMergerService>;
|
|
758
947
|
}
|
|
759
948
|
|
|
949
|
+
/**
|
|
950
|
+
* Message Tracker Service - Guaranteed Message Delivery
|
|
951
|
+
*
|
|
952
|
+
* Tracks message IDs, detects gaps, manages acknowledgments, and handles sync.
|
|
953
|
+
* Ensures frontend clients never miss messages even during disconnections.
|
|
954
|
+
*
|
|
955
|
+
* Features:
|
|
956
|
+
* - Per-channel message sequence tracking
|
|
957
|
+
* - Automatic gap detection and recovery
|
|
958
|
+
* - Batch acknowledgments (configurable interval)
|
|
959
|
+
* - Reconnection sync with last-seen tracking
|
|
960
|
+
* - Gap threshold alerting (10 messages before UI notification)
|
|
961
|
+
*/
|
|
962
|
+
declare class MessageTrackerService implements OnDestroy {
|
|
963
|
+
private wsManager;
|
|
964
|
+
/** Batch acknowledgment interval in milliseconds */
|
|
965
|
+
private readonly BATCH_ACK_INTERVAL_MS;
|
|
966
|
+
/** Maximum gap before alerting UI */
|
|
967
|
+
private readonly GAP_THRESHOLD;
|
|
968
|
+
/** Maximum messages to store in pending acks before forcing batch */
|
|
969
|
+
private readonly MAX_PENDING_ACKS;
|
|
970
|
+
/**
|
|
971
|
+
* Track last seen message ID per channel
|
|
972
|
+
* Map<channelName, lastMessageId>
|
|
973
|
+
*/
|
|
974
|
+
private lastSeen;
|
|
975
|
+
/**
|
|
976
|
+
* Expected next message ID per channel (for gap detection)
|
|
977
|
+
* Map<channelName, nextExpectedId>
|
|
978
|
+
*/
|
|
979
|
+
private expectedSequence;
|
|
980
|
+
/**
|
|
981
|
+
* Pending acknowledgments per channel
|
|
982
|
+
* Map<channelName, Set<messageId>>
|
|
983
|
+
*/
|
|
984
|
+
private pendingAcks;
|
|
985
|
+
/**
|
|
986
|
+
* Gap count per channel (for threshold alerting)
|
|
987
|
+
* Map<channelName, gapCount>
|
|
988
|
+
*/
|
|
989
|
+
private gapCounts;
|
|
990
|
+
/**
|
|
991
|
+
* Replay mode tracking (per channel)
|
|
992
|
+
* Used to distinguish replay vs live messages
|
|
993
|
+
*/
|
|
994
|
+
private inReplayMode;
|
|
995
|
+
/**
|
|
996
|
+
* Gap retry count (for retry logic)
|
|
997
|
+
* Map<channel, retryCount>
|
|
998
|
+
*/
|
|
999
|
+
private gapRetryCount;
|
|
1000
|
+
/** Batch acknowledgment timer */
|
|
1001
|
+
private batchAckTimer;
|
|
1002
|
+
/** Subscription to WebSocket messages */
|
|
1003
|
+
private messagesSubscription;
|
|
1004
|
+
/**
|
|
1005
|
+
* Track channels we want to be subscribed to (survives disconnect/reconnect)
|
|
1006
|
+
* This is separate from WebSocketManagerService.subscribedChannels which tracks
|
|
1007
|
+
* actual active subscriptions
|
|
1008
|
+
*/
|
|
1009
|
+
private intendedChannels;
|
|
1010
|
+
/** Observable to emit processed messages to UI components */
|
|
1011
|
+
private messagesSubject;
|
|
1012
|
+
messages$: Observable<any>;
|
|
1013
|
+
constructor(wsManager: WebSocketManagerService);
|
|
1014
|
+
ngOnDestroy(): void;
|
|
1015
|
+
/**
|
|
1016
|
+
* Process incoming message
|
|
1017
|
+
* Tracks ID, detects gaps, queues acknowledgment
|
|
1018
|
+
*/
|
|
1019
|
+
private onMessage;
|
|
1020
|
+
/**
|
|
1021
|
+
* Track message ID and detect gaps
|
|
1022
|
+
*/
|
|
1023
|
+
private trackMessage;
|
|
1024
|
+
/**
|
|
1025
|
+
* Queue message for batch acknowledgment
|
|
1026
|
+
*/
|
|
1027
|
+
private queueAck;
|
|
1028
|
+
/**
|
|
1029
|
+
* Start batch acknowledgment timer
|
|
1030
|
+
*/
|
|
1031
|
+
private startBatchAckTimer;
|
|
1032
|
+
/**
|
|
1033
|
+
* Stop batch acknowledgment timer
|
|
1034
|
+
*/
|
|
1035
|
+
private stopBatchAckTimer;
|
|
1036
|
+
/**
|
|
1037
|
+
* Send batch acknowledgments for all channels with pending acks
|
|
1038
|
+
*/
|
|
1039
|
+
private sendAllBatchAcks;
|
|
1040
|
+
/**
|
|
1041
|
+
* Send batch acknowledgment for a specific channel
|
|
1042
|
+
*/
|
|
1043
|
+
private sendBatchAck;
|
|
1044
|
+
/**
|
|
1045
|
+
* Request missing messages from server
|
|
1046
|
+
*/
|
|
1047
|
+
private requestGapFill;
|
|
1048
|
+
/**
|
|
1049
|
+
* Handle gap threshold exceeded (optional: alert UI)
|
|
1050
|
+
*/
|
|
1051
|
+
private onGapThresholdExceeded;
|
|
1052
|
+
/**
|
|
1053
|
+
* Subscribe to channel with sync support
|
|
1054
|
+
* Automatically includes lastSeenId for replay
|
|
1055
|
+
*/
|
|
1056
|
+
subscribeToChannel(channel: string, userData?: any): void;
|
|
1057
|
+
/**
|
|
1058
|
+
* Re-subscribe to all previously subscribed channels after reconnect
|
|
1059
|
+
* Includes lastSeenId for each channel to trigger message replay
|
|
1060
|
+
*/
|
|
1061
|
+
private reSubscribeAllChannels;
|
|
1062
|
+
/**
|
|
1063
|
+
* Persist lastSeen to sessionStorage (survives page reload)
|
|
1064
|
+
*/
|
|
1065
|
+
private persistLastSeen;
|
|
1066
|
+
/**
|
|
1067
|
+
* Restore lastSeen from sessionStorage
|
|
1068
|
+
*/
|
|
1069
|
+
private restoreLastSeen;
|
|
1070
|
+
/**
|
|
1071
|
+
* Persist intendedChannels to sessionStorage
|
|
1072
|
+
*/
|
|
1073
|
+
private persistIntendedChannels;
|
|
1074
|
+
/**
|
|
1075
|
+
* Restore intendedChannels from sessionStorage
|
|
1076
|
+
*/
|
|
1077
|
+
private restoreIntendedChannels;
|
|
1078
|
+
/**
|
|
1079
|
+
* Get last seen message ID for a channel
|
|
1080
|
+
*/
|
|
1081
|
+
getLastSeenId(channel: string): number;
|
|
1082
|
+
/**
|
|
1083
|
+
* Get expected next message ID for a channel
|
|
1084
|
+
*/
|
|
1085
|
+
getExpectedNextId(channel: string): number;
|
|
1086
|
+
/**
|
|
1087
|
+
* Check if currently in replay mode for a channel
|
|
1088
|
+
*/
|
|
1089
|
+
isInReplayMode(channel: string): boolean;
|
|
1090
|
+
/**
|
|
1091
|
+
* Get gap count for a channel
|
|
1092
|
+
*/
|
|
1093
|
+
getGapCount(channel: string): number;
|
|
1094
|
+
/**
|
|
1095
|
+
* Get skipped IDs between expected and received (for detailed gap reporting)
|
|
1096
|
+
*/
|
|
1097
|
+
private getSkippedIds;
|
|
1098
|
+
/**
|
|
1099
|
+
* Clear all tracking state (useful for debugging or manual reset)
|
|
1100
|
+
*/
|
|
1101
|
+
clearState(): void;
|
|
1102
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageTrackerService, never>;
|
|
1103
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MessageTrackerService>;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
760
1106
|
declare class HTTPManagerService<T> extends RequestService {
|
|
761
1107
|
private configOptions?;
|
|
762
1108
|
toastMessage: ToastMessageDisplayService;
|
|
763
1109
|
ng_injector: Injector;
|
|
764
1110
|
objectMergerService: ObjectMergerService;
|
|
1111
|
+
wsManager: WebSocketManagerService;
|
|
1112
|
+
messageTracker: MessageTrackerService;
|
|
1113
|
+
connectionStatus$: Observable<boolean>;
|
|
1114
|
+
messages$: Observable<any>;
|
|
1115
|
+
subscribedChannels$: Observable<Set<string>>;
|
|
765
1116
|
private countdown;
|
|
766
1117
|
countdown$: Observable<number>;
|
|
767
1118
|
private error;
|
|
@@ -771,6 +1122,87 @@ declare class HTTPManagerService<T> extends RequestService {
|
|
|
771
1122
|
private polling$;
|
|
772
1123
|
config: ApiRequest;
|
|
773
1124
|
constructor(configOptions?: ConfigOptions | undefined);
|
|
1125
|
+
/**
|
|
1126
|
+
* Connect to WebSocket server
|
|
1127
|
+
* Only the first call across ALL instances will establish a connection
|
|
1128
|
+
*/
|
|
1129
|
+
connect(options: any, jwtToken: string): void;
|
|
1130
|
+
/**
|
|
1131
|
+
* Disconnect from WebSocket server
|
|
1132
|
+
*/
|
|
1133
|
+
disconnect(): void;
|
|
1134
|
+
/**
|
|
1135
|
+
* Subscribe to a channel
|
|
1136
|
+
*/
|
|
1137
|
+
subscribeToChannel(channel: string, userData?: any): void;
|
|
1138
|
+
/**
|
|
1139
|
+
* Subscribe to multiple channels
|
|
1140
|
+
*/
|
|
1141
|
+
subscribeToChannels(channels: string[], userData?: any): void;
|
|
1142
|
+
/**
|
|
1143
|
+
* Unsubscribe from a channel
|
|
1144
|
+
*/
|
|
1145
|
+
unsubscribeFromChannel(channel: string): void;
|
|
1146
|
+
/**
|
|
1147
|
+
* Get currently subscribed channels
|
|
1148
|
+
*/
|
|
1149
|
+
getSubscribedChannels(): Set<string>;
|
|
1150
|
+
/**
|
|
1151
|
+
* Send broadcast message
|
|
1152
|
+
*/
|
|
1153
|
+
sendBroadcast(content: any): void;
|
|
1154
|
+
/**
|
|
1155
|
+
* Send message in channel (state manager message)
|
|
1156
|
+
*/
|
|
1157
|
+
sendMessageInChannel(channel: string, content: any): void;
|
|
1158
|
+
/**
|
|
1159
|
+
* Send channel message
|
|
1160
|
+
*/
|
|
1161
|
+
sendChannelMessage(channel: string, content: any): void;
|
|
1162
|
+
/**
|
|
1163
|
+
* Send message to multiple channels
|
|
1164
|
+
*/
|
|
1165
|
+
sendChannelMessageToChannels(channels: string[], content: any): void;
|
|
1166
|
+
/**
|
|
1167
|
+
* Send message to user
|
|
1168
|
+
*/
|
|
1169
|
+
sendMessageToUser(user: string, content: any): void;
|
|
1170
|
+
/**
|
|
1171
|
+
* Get all channels
|
|
1172
|
+
*/
|
|
1173
|
+
getAllChannels(): void;
|
|
1174
|
+
/**
|
|
1175
|
+
* Create channel
|
|
1176
|
+
*/
|
|
1177
|
+
createChannel(channel: string): void;
|
|
1178
|
+
/**
|
|
1179
|
+
* Delete channel
|
|
1180
|
+
*/
|
|
1181
|
+
deleteChannel(channel: string): void;
|
|
1182
|
+
/**
|
|
1183
|
+
* Get users in channel
|
|
1184
|
+
*/
|
|
1185
|
+
getUsersInChannel(channel: string): void;
|
|
1186
|
+
/**
|
|
1187
|
+
* Create notification channel
|
|
1188
|
+
*/
|
|
1189
|
+
createNotificationChannel(channel: string): void;
|
|
1190
|
+
/**
|
|
1191
|
+
* Get notification channels
|
|
1192
|
+
*/
|
|
1193
|
+
getNotificationChannels(): void;
|
|
1194
|
+
/**
|
|
1195
|
+
* Get today's notification channels
|
|
1196
|
+
*/
|
|
1197
|
+
getTodaysNotificationChannels(): void;
|
|
1198
|
+
/**
|
|
1199
|
+
* Subscribe to notification channel
|
|
1200
|
+
*/
|
|
1201
|
+
subscribeToNotificationChannel(channel: string, options?: any, user?: any): void;
|
|
1202
|
+
/**
|
|
1203
|
+
* Unsubscribe from notification channel
|
|
1204
|
+
*/
|
|
1205
|
+
unsubscribeFromNotificationChannel(channel: string): void;
|
|
774
1206
|
getRequest<T>(options?: ApiRequest, params?: any[]): Observable<T>;
|
|
775
1207
|
postRequest<T extends {
|
|
776
1208
|
id?: number | string;
|
|
@@ -965,6 +1397,16 @@ declare class LocalStorageManagerService extends ComponentStore<State> implement
|
|
|
965
1397
|
private validStoreName;
|
|
966
1398
|
private hasGlobalStorage;
|
|
967
1399
|
ngOnDestroy(): void;
|
|
1400
|
+
/**
|
|
1401
|
+
* Clears all stored data from localStorage and sessionStorage
|
|
1402
|
+
* Use this method to recover from corrupted data errors
|
|
1403
|
+
*/
|
|
1404
|
+
clearAllStoredData(): void;
|
|
1405
|
+
/**
|
|
1406
|
+
* Checks if stored data appears to be corrupted
|
|
1407
|
+
* Returns true if data appears corrupted
|
|
1408
|
+
*/
|
|
1409
|
+
checkForCorruptedData(): boolean;
|
|
968
1410
|
static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageManagerService, [{ optional: true; }]>;
|
|
969
1411
|
static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageManagerService>;
|
|
970
1412
|
}
|
|
@@ -1171,7 +1613,6 @@ declare class HttpRequestServicesDemoComponent implements OnInit {
|
|
|
1171
1613
|
server: string;
|
|
1172
1614
|
user?: UserData;
|
|
1173
1615
|
path: string[];
|
|
1174
|
-
wsChannel: string;
|
|
1175
1616
|
adapter?: Function;
|
|
1176
1617
|
mapper?: Function;
|
|
1177
1618
|
requestTypes: ({
|
|
@@ -1199,7 +1640,7 @@ declare class HttpRequestServicesDemoComponent implements OnInit {
|
|
|
1199
1640
|
ngOnInit(): void;
|
|
1200
1641
|
onSelected(type: number): void;
|
|
1201
1642
|
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; }; "
|
|
1643
|
+
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
1644
|
}
|
|
1204
1645
|
|
|
1205
1646
|
interface ClientInfoInterface$1 {
|
|
@@ -1746,8 +2187,13 @@ declare class StateServiceDemo extends HTTPManagerStateService<any> {
|
|
|
1746
2187
|
constructor();
|
|
1747
2188
|
/**
|
|
1748
2189
|
* Initialize WebSocket connection with server configuration
|
|
2190
|
+
* @param server - Backend server URL
|
|
2191
|
+
* @param wsServer - WebSocket server URL
|
|
2192
|
+
* @param jwtToken - JWT authentication token
|
|
2193
|
+
* @param user - User information
|
|
2194
|
+
* @param path - Path for constructing channel name (e.g., ['ai','tests'])
|
|
1749
2195
|
*/
|
|
1750
|
-
updateConnection(server: string, wsServer: string, jwtToken: string, user: any): void;
|
|
2196
|
+
updateConnection(server: string, wsServer: string, jwtToken: string, user: any, path?: (string | number)[]): void;
|
|
1751
2197
|
/**
|
|
1752
2198
|
* Get all available channels
|
|
1753
2199
|
*/
|
|
@@ -1917,7 +2363,6 @@ declare class RequestManagerWsDemoComponent implements OnInit {
|
|
|
1917
2363
|
jwtToken: string;
|
|
1918
2364
|
user: any;
|
|
1919
2365
|
path: string[];
|
|
1920
|
-
wsChannel: string;
|
|
1921
2366
|
user$: rxjs.Observable<WSUser | null>;
|
|
1922
2367
|
attempts$: rxjs.Observable<number>;
|
|
1923
2368
|
nextRetry$: rxjs.Observable<number>;
|
|
@@ -1926,7 +2371,7 @@ declare class RequestManagerWsDemoComponent implements OnInit {
|
|
|
1926
2371
|
isPending$: rxjs.Observable<boolean>;
|
|
1927
2372
|
ngOnInit(): void;
|
|
1928
2373
|
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; };
|
|
2374
|
+
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
2375
|
}
|
|
1931
2376
|
|
|
1932
2377
|
declare class SettingsStateService extends StoreStateManagerService {
|
|
@@ -1994,9 +2439,9 @@ declare class DatabaseDataSource extends DataSource<TableRecord> {
|
|
|
1994
2439
|
declare class StateDataRequestService extends HTTPManagerStateService<any> {
|
|
1995
2440
|
attempts$: rxjs.Observable<number>;
|
|
1996
2441
|
nextRetry$: rxjs.Observable<number>;
|
|
1997
|
-
path: string[];
|
|
2442
|
+
path: (string | number)[];
|
|
1998
2443
|
constructor();
|
|
1999
|
-
updateConnection(server: string, wsServer: string, jwtToken: string, user: any, path?: string
|
|
2444
|
+
updateConnection(server: string, wsServer: string, jwtToken: string, user: any, path?: (string | number)[]): void;
|
|
2000
2445
|
addData(): void;
|
|
2001
2446
|
sendMessage(data: ChannelMessage): void;
|
|
2002
2447
|
getData(): void;
|
|
@@ -2011,8 +2456,7 @@ declare class WsDataControlComponent implements OnInit {
|
|
|
2011
2456
|
wsServer: string;
|
|
2012
2457
|
jwtToken: string;
|
|
2013
2458
|
user: any;
|
|
2014
|
-
path: string[];
|
|
2015
|
-
wsChannel: string;
|
|
2459
|
+
path: (string | number)[];
|
|
2016
2460
|
stateDataRequestService: StateDataRequestService;
|
|
2017
2461
|
user$: rxjs.Observable<http_request_manager.WSUser | null>;
|
|
2018
2462
|
users$: rxjs.Observable<any[]>;
|
|
@@ -2025,7 +2469,7 @@ declare class WsDataControlComponent implements OnInit {
|
|
|
2025
2469
|
onUpdateData(data: any[]): void;
|
|
2026
2470
|
onRemoveData(data: any): void;
|
|
2027
2471
|
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; };
|
|
2472
|
+
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
2473
|
}
|
|
2030
2474
|
|
|
2031
2475
|
declare class WsMessagingComponent implements OnInit, OnDestroy {
|
|
@@ -2033,6 +2477,7 @@ declare class WsMessagingComponent implements OnInit, OnDestroy {
|
|
|
2033
2477
|
wsServer: string;
|
|
2034
2478
|
jwtToken: string;
|
|
2035
2479
|
user: any;
|
|
2480
|
+
path: (string | number)[];
|
|
2036
2481
|
private destroy$;
|
|
2037
2482
|
fb: FormBuilder;
|
|
2038
2483
|
messageService: MessageServiceDemo;
|
|
@@ -2088,7 +2533,7 @@ declare class WsMessagingComponent implements OnInit, OnDestroy {
|
|
|
2088
2533
|
onChipClick(channel: string, subscribedChannels: string[]): void;
|
|
2089
2534
|
onSendMessage(user: WSUser): void;
|
|
2090
2535
|
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>;
|
|
2536
|
+
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
2537
|
}
|
|
2093
2538
|
|
|
2094
2539
|
declare class WsNotificationsComponent implements OnInit, OnDestroy {
|
|
@@ -2273,5 +2718,5 @@ declare class HttpRequestManagerModule {
|
|
|
2273
2718
|
static ɵinj: i0.ɵɵInjectorDeclaration<HttpRequestManagerModule>;
|
|
2274
2719
|
}
|
|
2275
2720
|
|
|
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 };
|
|
2721
|
+
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
2722
|
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 };
|