http-request-manager 18.16.24 → 18.16.26
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,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, APP_ID, Inject, InjectionToken, isDevMode, signal,
|
|
2
|
+
import { inject, Injectable, APP_ID, Inject, InjectionToken, isDevMode, signal, DestroyRef, computed, effect, Injector, Optional, EventEmitter, Input, Output, ViewEncapsulation, Component, NgModule, ViewChild } from '@angular/core';
|
|
3
3
|
import { ComponentStore } from '@ngrx/component-store';
|
|
4
4
|
import { map, catchError, filter, take, tap, finalize, takeWhile, retry, startWith, mergeMap, takeUntil, concatMap, toArray, withLatestFrom, switchMap, delay, scan, distinctUntilChanged } from 'rxjs/operators';
|
|
5
5
|
import { HttpClient, HttpHeaders, HttpEventType, HttpHeaderResponse, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
6
6
|
import * as CryptoJS from 'crypto-js';
|
|
7
7
|
import { from, BehaviorSubject, EMPTY, timer, throwError, defer, interval, Subject, of, merge, Subscription, take as take$1, firstValueFrom, catchError as catchError$1, map as map$1, tap as tap$1, switchMap as switchMap$1, startWith as startWith$1, distinctUntilChanged as distinctUntilChanged$1, combineLatest, filter as filter$1, takeUntil as takeUntil$1, ReplaySubject } from 'rxjs';
|
|
8
|
-
import { toObservable,
|
|
8
|
+
import { takeUntilDestroyed, toObservable, toSignal } from '@angular/core/rxjs-interop';
|
|
9
9
|
import { ToastMessageDisplayService, ToastDisplay, ToastColors, ToastMessageDisplayModule } from 'toast-message-display';
|
|
10
10
|
import Dexie from 'dexie';
|
|
11
11
|
import { Parser } from 'node-sql-parser/build/mysql';
|
|
@@ -2629,29 +2629,41 @@ class WebSocketSignalsManagerService {
|
|
|
2629
2629
|
static { this.connectionStatusSignal = signal(false); }
|
|
2630
2630
|
static { this.messagesSignal = signal(null); }
|
|
2631
2631
|
static { this.subscribedChannelsSignal = signal(new Set()); }
|
|
2632
|
+
static { this.isConnectingSignal = signal(false); }
|
|
2633
|
+
static { this.retryCountSignal = signal(0); }
|
|
2634
|
+
static { this.maxRetriesSignal = signal(0); }
|
|
2635
|
+
static { this.connectionErrorSignal = signal(null); }
|
|
2632
2636
|
constructor() {
|
|
2633
2637
|
this.wsManager = inject(WebSocketManagerService);
|
|
2638
|
+
this.destroyRef = inject(DestroyRef);
|
|
2634
2639
|
this.connectionStatus = WebSocketSignalsManagerService.connectionStatusSignal.asReadonly();
|
|
2635
|
-
this.connectionStatus$ = toObservable(WebSocketSignalsManagerService.connectionStatusSignal);
|
|
2636
2640
|
this.messages = WebSocketSignalsManagerService.messagesSignal.asReadonly();
|
|
2637
|
-
this.messages$ = toObservable(WebSocketSignalsManagerService.messagesSignal);
|
|
2638
2641
|
this.subscribedChannels = WebSocketSignalsManagerService.subscribedChannelsSignal.asReadonly();
|
|
2639
|
-
this.
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
});
|
|
2645
|
-
// Subscribe to WebSocket messages and update signals
|
|
2646
|
-
this.wsManager.messages$.subscribe(message => {
|
|
2642
|
+
this.isConnecting = WebSocketSignalsManagerService.isConnectingSignal.asReadonly();
|
|
2643
|
+
this.retryCount = WebSocketSignalsManagerService.retryCountSignal.asReadonly();
|
|
2644
|
+
this.maxRetries = WebSocketSignalsManagerService.maxRetriesSignal.asReadonly();
|
|
2645
|
+
this.connectionError = WebSocketSignalsManagerService.connectionErrorSignal.asReadonly();
|
|
2646
|
+
this.wsManager.messages$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(message => {
|
|
2647
2647
|
WebSocketSignalsManagerService.messagesSignal.set(message);
|
|
2648
2648
|
});
|
|
2649
|
-
this.wsManager.connectionStatus$.subscribe(status => {
|
|
2649
|
+
this.wsManager.connectionStatus$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(status => {
|
|
2650
2650
|
WebSocketSignalsManagerService.connectionStatusSignal.set(status);
|
|
2651
2651
|
});
|
|
2652
|
-
this.wsManager.subscribedChannels$.subscribe(channels => {
|
|
2652
|
+
this.wsManager.subscribedChannels$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(channels => {
|
|
2653
2653
|
WebSocketSignalsManagerService.subscribedChannelsSignal.set(channels);
|
|
2654
2654
|
});
|
|
2655
|
+
this.wsManager.isConnecting$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(status => {
|
|
2656
|
+
WebSocketSignalsManagerService.isConnectingSignal.set(status);
|
|
2657
|
+
});
|
|
2658
|
+
this.wsManager.retryCount$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(count => {
|
|
2659
|
+
WebSocketSignalsManagerService.retryCountSignal.set(count);
|
|
2660
|
+
});
|
|
2661
|
+
this.wsManager.maxRetries$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(max => {
|
|
2662
|
+
WebSocketSignalsManagerService.maxRetriesSignal.set(max);
|
|
2663
|
+
});
|
|
2664
|
+
this.wsManager.connectionError$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(err => {
|
|
2665
|
+
WebSocketSignalsManagerService.connectionErrorSignal.set(err);
|
|
2666
|
+
});
|
|
2655
2667
|
}
|
|
2656
2668
|
// Connection Management
|
|
2657
2669
|
connect(options, jwtToken) {
|
|
@@ -2731,12 +2743,140 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
2731
2743
|
}]
|
|
2732
2744
|
}], ctorParameters: () => [] });
|
|
2733
2745
|
|
|
2746
|
+
/**
|
|
2747
|
+
* ChannelPresenceSignalsService - Signal-based channel presence and metadata tracking.
|
|
2748
|
+
*
|
|
2749
|
+
* Tracks WebSocket messages, channel metadata, and user presence using pure signals.
|
|
2750
|
+
* No Observable bridges — consumers use `toObservable()` at the call site if needed.
|
|
2751
|
+
*/
|
|
2752
|
+
class ChannelPresenceSignalsService {
|
|
2753
|
+
constructor() {
|
|
2754
|
+
this.wsManager = inject(WebSocketSignalsManagerService);
|
|
2755
|
+
// Signal-based state
|
|
2756
|
+
this.messagesSignal = signal(null);
|
|
2757
|
+
this.messages = this.messagesSignal.asReadonly();
|
|
2758
|
+
this.channelMetadataSignal = signal(new Map());
|
|
2759
|
+
this.channelMetadata = this.channelMetadataSignal.asReadonly();
|
|
2760
|
+
this.usersInChannelsSignal = signal(new Map());
|
|
2761
|
+
this.usersInChannels = this.usersInChannelsSignal.asReadonly();
|
|
2762
|
+
// Computed signals for derived state
|
|
2763
|
+
this.messageCount = computed(() => {
|
|
2764
|
+
const metadata = this.channelMetadataSignal();
|
|
2765
|
+
let count = 0;
|
|
2766
|
+
metadata.forEach(data => count += data.count);
|
|
2767
|
+
return count;
|
|
2768
|
+
});
|
|
2769
|
+
this.activeChannels = computed(() => {
|
|
2770
|
+
return Array.from(this.channelMetadataSignal().keys());
|
|
2771
|
+
});
|
|
2772
|
+
// Track messages from WebSocket
|
|
2773
|
+
effect(() => {
|
|
2774
|
+
const message = this.wsManager.messages();
|
|
2775
|
+
if (message) {
|
|
2776
|
+
this.trackMessage(message);
|
|
2777
|
+
}
|
|
2778
|
+
});
|
|
2779
|
+
// Track connection status
|
|
2780
|
+
effect(() => {
|
|
2781
|
+
const connected = this.wsManager.connectionStatus();
|
|
2782
|
+
if (!connected) {
|
|
2783
|
+
this.onDisconnect();
|
|
2784
|
+
}
|
|
2785
|
+
});
|
|
2786
|
+
}
|
|
2787
|
+
trackMessage(message) {
|
|
2788
|
+
this.messagesSignal.set(message);
|
|
2789
|
+
if (message.channel) {
|
|
2790
|
+
this.updateChannelMetadata(message.channel, message);
|
|
2791
|
+
}
|
|
2792
|
+
if (message.user && message.channel) {
|
|
2793
|
+
this.updateUserPresence(message.channel, message.user);
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
updateChannelMetadata(channel, message) {
|
|
2797
|
+
this.channelMetadataSignal.update(metadata => {
|
|
2798
|
+
const updated = new Map(metadata);
|
|
2799
|
+
const current = updated.get(channel) || { count: 0, lastMessage: null, lastUpdated: 0 };
|
|
2800
|
+
updated.set(channel, {
|
|
2801
|
+
...current,
|
|
2802
|
+
count: current.count + 1,
|
|
2803
|
+
lastMessage: message,
|
|
2804
|
+
lastUpdated: Date.now()
|
|
2805
|
+
});
|
|
2806
|
+
return updated;
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
updateUserPresence(channel, user) {
|
|
2810
|
+
this.usersInChannelsSignal.update(users => {
|
|
2811
|
+
const updated = new Map(users);
|
|
2812
|
+
const channelUsers = new Set(updated.get(channel) || []);
|
|
2813
|
+
channelUsers.add(user);
|
|
2814
|
+
updated.set(channel, channelUsers);
|
|
2815
|
+
return updated;
|
|
2816
|
+
});
|
|
2817
|
+
}
|
|
2818
|
+
removeUserFromChannel(channel, user) {
|
|
2819
|
+
this.usersInChannelsSignal.update(users => {
|
|
2820
|
+
const updated = new Map(users);
|
|
2821
|
+
const channelUsers = updated.get(channel);
|
|
2822
|
+
if (channelUsers) {
|
|
2823
|
+
channelUsers.delete(user);
|
|
2824
|
+
updated.set(channel, channelUsers);
|
|
2825
|
+
}
|
|
2826
|
+
return updated;
|
|
2827
|
+
});
|
|
2828
|
+
}
|
|
2829
|
+
subscribeToChannel(channel) {
|
|
2830
|
+
this.wsManager.subscribeToChannel(channel);
|
|
2831
|
+
}
|
|
2832
|
+
unsubscribeFromChannel(channel) {
|
|
2833
|
+
this.wsManager.unsubscribeFromChannel(channel);
|
|
2834
|
+
this.removeUserFromChannel(channel, 'current-user');
|
|
2835
|
+
}
|
|
2836
|
+
// Selectors
|
|
2837
|
+
getMessageCount(channel) {
|
|
2838
|
+
const metadata = this.channelMetadataSignal();
|
|
2839
|
+
return metadata.get(channel)?.count || 0;
|
|
2840
|
+
}
|
|
2841
|
+
getLastMessage(channel) {
|
|
2842
|
+
const metadata = this.channelMetadataSignal();
|
|
2843
|
+
return metadata.get(channel)?.lastMessage || null;
|
|
2844
|
+
}
|
|
2845
|
+
getActiveChannels() {
|
|
2846
|
+
return Array.from(this.channelMetadataSignal().keys());
|
|
2847
|
+
}
|
|
2848
|
+
getUsersInChannel(channel) {
|
|
2849
|
+
const users = this.usersInChannelsSignal().get(channel);
|
|
2850
|
+
return users ? Array.from(users) : [];
|
|
2851
|
+
}
|
|
2852
|
+
onDisconnect() {
|
|
2853
|
+
this.messagesSignal.set(null);
|
|
2854
|
+
this.channelMetadataSignal.set(new Map());
|
|
2855
|
+
this.usersInChannelsSignal.set(new Map());
|
|
2856
|
+
}
|
|
2857
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ChannelPresenceSignalsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2858
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ChannelPresenceSignalsService, providedIn: 'root' }); }
|
|
2859
|
+
}
|
|
2860
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ChannelPresenceSignalsService, decorators: [{
|
|
2861
|
+
type: Injectable,
|
|
2862
|
+
args: [{
|
|
2863
|
+
providedIn: 'root',
|
|
2864
|
+
}]
|
|
2865
|
+
}], ctorParameters: () => [] });
|
|
2866
|
+
|
|
2867
|
+
/**
|
|
2868
|
+
* @deprecated Use `ChannelPresenceSignalsService` instead.
|
|
2869
|
+
* This file is kept for backwards compatibility only.
|
|
2870
|
+
*/
|
|
2734
2871
|
/**
|
|
2735
2872
|
* MessageTrackerSignalsService - Signal-based message tracking
|
|
2736
2873
|
*
|
|
2737
2874
|
* Tracks WebSocket messages, channel metadata, and user presence using signals.
|
|
2738
2875
|
* Provides real-time reactivity for message-driven applications.
|
|
2739
2876
|
*/
|
|
2877
|
+
/**
|
|
2878
|
+
* @deprecated Use `ChannelPresenceSignalsService` from `channel-presence-signals.service.ts` instead.
|
|
2879
|
+
*/
|
|
2740
2880
|
class MessageTrackerSignalsService {
|
|
2741
2881
|
constructor() {
|
|
2742
2882
|
this.wsManager = inject(WebSocketSignalsManagerService);
|
|
@@ -4301,6 +4441,7 @@ class RequestSignalsService extends WebsocketService {
|
|
|
4301
4441
|
this.headersService = inject(HeadersService);
|
|
4302
4442
|
this.isPending = signal(false);
|
|
4303
4443
|
this.progress = signal(0);
|
|
4444
|
+
this.streamProgress = signal(new StreamProgressModel());
|
|
4304
4445
|
this.isIdle = computed(() => !this.isPending());
|
|
4305
4446
|
}
|
|
4306
4447
|
// Implementation
|
|
@@ -4314,7 +4455,7 @@ class RequestSignalsService extends WebsocketService {
|
|
|
4314
4455
|
observe: 'events',
|
|
4315
4456
|
responseType: 'text',
|
|
4316
4457
|
reportProgress: true
|
|
4317
|
-
}).pipe(requestStreaming(StreamConfigModel.adapt({ streamType: options.streamType || StreamType.
|
|
4458
|
+
}).pipe(requestStreaming(StreamConfigModel.adapt({ streamType: options.streamType || StreamType.NDJSON, totalHeader: 'X-Total-Count' })), this.requestStreamingOperator(options), this.handleFinalize())
|
|
4318
4459
|
: this.http.get(urlPath, headers).pipe(this.request(options), this.handleFinalize());
|
|
4319
4460
|
}
|
|
4320
4461
|
// Implementation
|
|
@@ -4328,7 +4469,7 @@ class RequestSignalsService extends WebsocketService {
|
|
|
4328
4469
|
observe: 'events',
|
|
4329
4470
|
responseType: 'text',
|
|
4330
4471
|
reportProgress: true
|
|
4331
|
-
}).pipe(requestStreaming(StreamConfigModel.adapt({ streamType: options.streamType || StreamType.
|
|
4472
|
+
}).pipe(requestStreaming(StreamConfigModel.adapt({ streamType: options.streamType || StreamType.NDJSON, totalHeader: 'X-Total-Count' })), this.requestStreamingOperator(options), this.handleFinalize())
|
|
4332
4473
|
: this.http.post(urlPath, data, headers).pipe(this.request(options), this.handleFinalize());
|
|
4333
4474
|
}
|
|
4334
4475
|
updateRecordRequest(options, data) {
|
|
@@ -4372,6 +4513,7 @@ class RequestSignalsService extends WebsocketService {
|
|
|
4372
4513
|
return (source$) => {
|
|
4373
4514
|
return source$.pipe(tap(output => {
|
|
4374
4515
|
this.progress.set(output.progress.received);
|
|
4516
|
+
this.streamProgress.set({ ...output.progress, stage: 'streaming' });
|
|
4375
4517
|
}), map(output => {
|
|
4376
4518
|
const data = output.data;
|
|
4377
4519
|
if (!data || (Array.isArray(data) && data.length === 0)) {
|
|
@@ -4381,6 +4523,9 @@ class RequestSignalsService extends WebsocketService {
|
|
|
4381
4523
|
return data.map((item) => options.adapter(item));
|
|
4382
4524
|
}
|
|
4383
4525
|
return data;
|
|
4526
|
+
}), finalize(() => this.streamProgress.update(p => ({ ...p, stage: 'complete' }))), catchError(err => {
|
|
4527
|
+
this.streamProgress.update(p => ({ ...p, stage: 'error' }));
|
|
4528
|
+
return throwError(() => err);
|
|
4384
4529
|
}));
|
|
4385
4530
|
};
|
|
4386
4531
|
}
|
|
@@ -4404,9 +4549,10 @@ class RequestSignalsService extends WebsocketService {
|
|
|
4404
4549
|
case HttpEventType.Response:
|
|
4405
4550
|
try {
|
|
4406
4551
|
const fileNamePath = (options?.saveAs) ? options.saveAs : (options.path) ? options.path[options.path.length - 1] : [];
|
|
4407
|
-
const
|
|
4552
|
+
const fileContentHeader = options.fileContentHeader || 'Content-Disposition';
|
|
4553
|
+
const header_content = event.headers.get(fileContentHeader) || '';
|
|
4408
4554
|
const file = (header_content) ? header_content.split('=')[1].substring(0, header_content.split('=')[1].length) : '';
|
|
4409
|
-
const fileName =
|
|
4555
|
+
const fileName = file ? file : fileNamePath;
|
|
4410
4556
|
if (fileName === '') {
|
|
4411
4557
|
this.isPending.set(false);
|
|
4412
4558
|
throw new Error('Save File: (file name and extension) not found in Headers or Path');
|
|
@@ -4588,6 +4734,10 @@ class HTTPManagerSignalsService extends RequestSignalsService {
|
|
|
4588
4734
|
this.countdown = signal(0);
|
|
4589
4735
|
this.error = signal(false);
|
|
4590
4736
|
this.data = signal(null);
|
|
4737
|
+
this.isConnecting = toSignal(this.wsManager.isConnecting$, { initialValue: false });
|
|
4738
|
+
this.retryCount = toSignal(this.wsManager.retryCount$, { initialValue: 0 });
|
|
4739
|
+
this.maxRetries = toSignal(this.wsManager.maxRetries$, { initialValue: 0 });
|
|
4740
|
+
this.connectionError = toSignal(this.wsManager.connectionError$, { initialValue: null });
|
|
4591
4741
|
this.polling$ = new Subject();
|
|
4592
4742
|
this.config = ApiRequest.adapt();
|
|
4593
4743
|
this.config = configOptions
|
|
@@ -4727,6 +4877,7 @@ class HTTPManagerSignalsService extends RequestSignalsService {
|
|
|
4727
4877
|
getRequest(options, params) {
|
|
4728
4878
|
this.isPending.set(true);
|
|
4729
4879
|
this.data.set(null);
|
|
4880
|
+
this.streamProgress.set(new StreamProgressModel());
|
|
4730
4881
|
const updatedOptions = this.defineReqOptions(options, params);
|
|
4731
4882
|
const func = this.getRecordRequest;
|
|
4732
4883
|
const requests = this.createRequest(func, updatedOptions);
|
|
@@ -4798,6 +4949,7 @@ class HTTPManagerSignalsService extends RequestSignalsService {
|
|
|
4798
4949
|
}
|
|
4799
4950
|
downloadRequest(options, params, saveAs) {
|
|
4800
4951
|
this.isPending.set(true);
|
|
4952
|
+
this.streamProgress.set(new StreamProgressModel());
|
|
4801
4953
|
const updatedOptions = this.defineReqOptions(options, params);
|
|
4802
4954
|
const func = this.downloadFileRequest;
|
|
4803
4955
|
const requests = this.createRequest(func, updatedOptions);
|
|
@@ -4891,7 +5043,7 @@ class HTTPManagerSignalsService extends RequestSignalsService {
|
|
|
4891
5043
|
return { options: options, data: data };
|
|
4892
5044
|
}
|
|
4893
5045
|
handleError(error) {
|
|
4894
|
-
this.error.set(
|
|
5046
|
+
this.error.set(true);
|
|
4895
5047
|
return throwError(() => error);
|
|
4896
5048
|
}
|
|
4897
5049
|
handleErrorWithSnackBar(error, message) {
|
|
@@ -5536,6 +5688,18 @@ class LocalStorageManagerService extends ComponentStore {
|
|
|
5536
5688
|
}
|
|
5537
5689
|
}
|
|
5538
5690
|
settings.forEach(store => {
|
|
5691
|
+
// normalize expiresIn → expires so TTL is always a numeric timestamp
|
|
5692
|
+
if ((!store.options?.expires || store.options.expires === 0) && store.options?.expiresIn) {
|
|
5693
|
+
try {
|
|
5694
|
+
const computed = this.utils.expires(store.options.expiresIn);
|
|
5695
|
+
if (store.options)
|
|
5696
|
+
store.options.expires = computed || 0;
|
|
5697
|
+
}
|
|
5698
|
+
catch {
|
|
5699
|
+
if (store.options)
|
|
5700
|
+
store.options.expires = 0;
|
|
5701
|
+
}
|
|
5702
|
+
}
|
|
5539
5703
|
const expired = (store.options?.expires || 0) > 0 && this.utils.hasExpired(store.options?.expires || 0);
|
|
5540
5704
|
if (!expired) {
|
|
5541
5705
|
const hasStorage = this.hasGlobalStorage(store.options?.storage, store.id || '');
|
|
@@ -5708,7 +5872,7 @@ class LocalStorageSignalsManagerService {
|
|
|
5708
5872
|
this.storeExists = (store) => computed(() => !!this.state().settings.find(item => item.name === store));
|
|
5709
5873
|
this.store = (store) => computed(() => {
|
|
5710
5874
|
const data = this.state();
|
|
5711
|
-
const foundStore = data.settings.find(item => item.name === store);
|
|
5875
|
+
const foundStore = [...data.settings].reverse().find(item => item.name === store);
|
|
5712
5876
|
if (!foundStore)
|
|
5713
5877
|
return null;
|
|
5714
5878
|
const options = SettingOptions.adapt(foundStore.options);
|
|
@@ -5782,6 +5946,9 @@ class LocalStorageSignalsManagerService {
|
|
|
5782
5946
|
const settings = StorageOption.adapt(store);
|
|
5783
5947
|
settings.options = this.objectMergerService.mergeStorageOptions(settings.options);
|
|
5784
5948
|
store.name = this.validStoreName(store.name);
|
|
5949
|
+
if (!this.hasGlobalStorage(store.options?.storage, store.id)) {
|
|
5950
|
+
return state;
|
|
5951
|
+
}
|
|
5785
5952
|
const str = this.encryptionTest.isEncrypted(store.data) ? store.data : JSON.stringify(store.data);
|
|
5786
5953
|
const dataStr = this.isObjectOrArray(str) && store.options.encrypted
|
|
5787
5954
|
? this.encryption.encrypt(str, this.app.appID)
|
|
@@ -6443,16 +6610,19 @@ class DatabaseManagerService extends DbService {
|
|
|
6443
6610
|
}
|
|
6444
6611
|
updateTableRecord(table, record) {
|
|
6445
6612
|
const tableName = this.cleanTableName(table);
|
|
6613
|
+
console.log(`🔵 updateTableRecord: INPUT table='${table}' CLEANED='${tableName}'`);
|
|
6446
6614
|
return this.updateTableRecords(tableName, [record])
|
|
6447
6615
|
.pipe(map(item => item.length > 0 ? item[0] : null));
|
|
6448
6616
|
}
|
|
6449
6617
|
updateTableRecords(table, records) {
|
|
6450
6618
|
const tableName = this.cleanTableName(table);
|
|
6619
|
+
console.log(`🔵 updateTableRecords: INPUT table='${table}' CLEANED='${tableName}' recordCount=${records.length}`);
|
|
6451
6620
|
return this.getDatabaseTable(tableName).pipe(switchMap((tableData) => {
|
|
6452
6621
|
if (!tableData) {
|
|
6453
|
-
console.warn(
|
|
6622
|
+
console.warn(`❌ updateTableRecords: Table '${tableName}' not found`);
|
|
6454
6623
|
return EMPTY;
|
|
6455
6624
|
}
|
|
6625
|
+
console.log(`✅ updateTableRecords: Table '${tableName}' FOUND, executing bulkPut with ${records.length} records`);
|
|
6456
6626
|
const insertRecords = records.map((record) => {
|
|
6457
6627
|
const payload = { ...(record || {}) };
|
|
6458
6628
|
if (payload.id === undefined || payload.id === null || payload.id === '') {
|
|
@@ -6514,6 +6684,54 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
6514
6684
|
}]
|
|
6515
6685
|
}], ctorParameters: () => [] });
|
|
6516
6686
|
|
|
6687
|
+
class DatabaseManagerSignalsService {
|
|
6688
|
+
constructor() {
|
|
6689
|
+
this.dbManager = inject(DatabaseManagerService);
|
|
6690
|
+
this.isPendingSignal = signal(false);
|
|
6691
|
+
this.tablesSignal = signal([]);
|
|
6692
|
+
this.databaseReadySignal = signal(false);
|
|
6693
|
+
this.isPending = this.isPendingSignal.asReadonly();
|
|
6694
|
+
this.tables = this.tablesSignal.asReadonly();
|
|
6695
|
+
this.databaseReady = this.databaseReadySignal.asReadonly();
|
|
6696
|
+
}
|
|
6697
|
+
getDatabaseTables() {
|
|
6698
|
+
this.isPendingSignal.set(true);
|
|
6699
|
+
return this.dbManager.getDatabaseTables().pipe(tap((t) => this.tablesSignal.set(t)), finalize(() => this.isPendingSignal.set(false)));
|
|
6700
|
+
}
|
|
6701
|
+
databaseExists() {
|
|
6702
|
+
this.isPendingSignal.set(true);
|
|
6703
|
+
return this.dbManager.databaseExists().pipe(tap((exists) => this.databaseReadySignal.set(exists)), finalize(() => this.isPendingSignal.set(false)));
|
|
6704
|
+
}
|
|
6705
|
+
hasDatabaseTable(table) {
|
|
6706
|
+
this.isPendingSignal.set(true);
|
|
6707
|
+
return this.dbManager.hasDatabaseTable(table).pipe(finalize(() => this.isPendingSignal.set(false)));
|
|
6708
|
+
}
|
|
6709
|
+
getDatabaseTable(table) {
|
|
6710
|
+
this.isPendingSignal.set(true);
|
|
6711
|
+
return this.dbManager.getDatabaseTable(table).pipe(finalize(() => this.isPendingSignal.set(false)));
|
|
6712
|
+
}
|
|
6713
|
+
getDatabaseTableSchema(table) {
|
|
6714
|
+
this.isPendingSignal.set(true);
|
|
6715
|
+
return this.dbManager.getDatabaseTableSchema(table).pipe(finalize(() => this.isPendingSignal.set(false)));
|
|
6716
|
+
}
|
|
6717
|
+
createDatabaseTable(tableDef) {
|
|
6718
|
+
this.isPendingSignal.set(true);
|
|
6719
|
+
return this.dbManager.createDatabaseTable(tableDef).pipe(tap(() => this.getDatabaseTables().subscribe()), finalize(() => this.isPendingSignal.set(false)));
|
|
6720
|
+
}
|
|
6721
|
+
updateDatabaseTableSchema(tableDef) {
|
|
6722
|
+
this.isPendingSignal.set(true);
|
|
6723
|
+
return this.dbManager.updateDatabaseTableSchema(tableDef).pipe(finalize(() => this.isPendingSignal.set(false)));
|
|
6724
|
+
}
|
|
6725
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DatabaseManagerSignalsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6726
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DatabaseManagerSignalsService, providedIn: 'root' }); }
|
|
6727
|
+
}
|
|
6728
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DatabaseManagerSignalsService, decorators: [{
|
|
6729
|
+
type: Injectable,
|
|
6730
|
+
args: [{
|
|
6731
|
+
providedIn: 'root'
|
|
6732
|
+
}]
|
|
6733
|
+
}] });
|
|
6734
|
+
|
|
6517
6735
|
class ChannelMessage {
|
|
6518
6736
|
constructor(messageId, channel, isReplay, sessionId = null, content = null, timestamp) {
|
|
6519
6737
|
this.messageId = messageId;
|
|
@@ -7157,13 +7375,18 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
7157
7375
|
let adaptedData = this.applyAdapter(data);
|
|
7158
7376
|
adaptedData = (!adaptedData) ? (this.dataType === DataType.ARRAY) ? [] : {} : adaptedData;
|
|
7159
7377
|
const id = options.path?.length ? options.path[options.path.length - 1] : null;
|
|
7378
|
+
// For single-record operations (CREATE, UPDATE, DELETE), extract from array if needed
|
|
7379
|
+
let singleRecord = adaptedData;
|
|
7380
|
+
if (Array.isArray(adaptedData) && adaptedData.length > 0) {
|
|
7381
|
+
singleRecord = adaptedData[0];
|
|
7382
|
+
}
|
|
7160
7383
|
if (method === 'DELETE') {
|
|
7161
7384
|
console.log('🗑️ Deleting record with id:', id);
|
|
7162
7385
|
this.deleteData$({ id });
|
|
7163
7386
|
}
|
|
7164
7387
|
if (method === 'UPDATE') {
|
|
7165
|
-
console.log('✏️ Updating record:',
|
|
7166
|
-
this.updateData$(
|
|
7388
|
+
console.log('✏️ Updating record:', singleRecord);
|
|
7389
|
+
this.updateData$(singleRecord);
|
|
7167
7390
|
}
|
|
7168
7391
|
if (method === 'CREATE') {
|
|
7169
7392
|
console.log('➕ Adding record:', adaptedData);
|
|
@@ -7173,6 +7396,11 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
7173
7396
|
const adaptedData = this.applyAdapter(data);
|
|
7174
7397
|
const tableName = this.databaseOptions?.table;
|
|
7175
7398
|
const idFromPath = options.path?.length ? options.path[options.path.length - 1] : null;
|
|
7399
|
+
// For single-record operations, extract from array if needed
|
|
7400
|
+
let singleRecord = adaptedData;
|
|
7401
|
+
if (Array.isArray(adaptedData) && adaptedData.length > 0) {
|
|
7402
|
+
singleRecord = adaptedData[0];
|
|
7403
|
+
}
|
|
7176
7404
|
if (this.hasDatabase && tableName) {
|
|
7177
7405
|
switch (method) {
|
|
7178
7406
|
case 'DELETE':
|
|
@@ -7183,11 +7411,11 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
7183
7411
|
this.logger.warn('fetchRecord', 'DELETE method called but id is missing from path', { options });
|
|
7184
7412
|
break;
|
|
7185
7413
|
case 'UPDATE':
|
|
7186
|
-
if (
|
|
7187
|
-
this.logger.debug('fetchRecord', 'Updating database record', { table: tableName, id:
|
|
7188
|
-
return this.dbManagerService.updateTableRecord(tableName,
|
|
7414
|
+
if (singleRecord && singleRecord.id != null) {
|
|
7415
|
+
this.logger.debug('fetchRecord', 'Updating database record', { table: tableName, id: singleRecord.id, data: singleRecord });
|
|
7416
|
+
return this.dbManagerService.updateTableRecord(tableName, singleRecord);
|
|
7189
7417
|
}
|
|
7190
|
-
this.logger.warn('fetchRecord', 'UPDATE method called but
|
|
7418
|
+
this.logger.warn('fetchRecord', 'UPDATE method called but singleRecord or id is missing', { singleRecord, hasData: !!singleRecord, hasId: !!singleRecord?.id });
|
|
7191
7419
|
break;
|
|
7192
7420
|
case 'CREATE':
|
|
7193
7421
|
if (adaptedData && adaptedData.id != null && adaptedData.id !== '') {
|
|
@@ -7363,7 +7591,7 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
7363
7591
|
Object.keys(currentStateData).length > 0) {
|
|
7364
7592
|
return of({ data: currentStateData, fromCache: true });
|
|
7365
7593
|
}
|
|
7366
|
-
return
|
|
7594
|
+
return fetchStreamFromAPI();
|
|
7367
7595
|
}));
|
|
7368
7596
|
}
|
|
7369
7597
|
return fetchStreamFromAPI();
|
|
@@ -8036,6 +8264,7 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
8036
8264
|
data: { ...this.databaseOptions, expires: 0 }
|
|
8037
8265
|
});
|
|
8038
8266
|
this._requestCachePaths.delete(tableName);
|
|
8267
|
+
this.clearRequestCacheMetadata(tableName);
|
|
8039
8268
|
this.dbManagerService.clearTable(tableName).subscribe({
|
|
8040
8269
|
next: () => {
|
|
8041
8270
|
if (this.dataType === DataType.ARRAY) {
|
|
@@ -8188,6 +8417,7 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
8188
8417
|
const currentCache = storeData?.requestCache || {};
|
|
8189
8418
|
const currentEntry = currentCache[type] || {};
|
|
8190
8419
|
const currentQueryParams = { ...(currentEntry.queryParams || {}) };
|
|
8420
|
+
const currentQueryCombinations = [...(currentEntry.queryCombinations || [])];
|
|
8191
8421
|
const currentQueryParamsExpires = currentEntry.queryParamsExpires ?? null;
|
|
8192
8422
|
this.localStorageManagerService.updateStore({
|
|
8193
8423
|
name: tableName,
|
|
@@ -8201,6 +8431,7 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
8201
8431
|
savedAt: Date.now(),
|
|
8202
8432
|
path: this.resolvePath(options?.path),
|
|
8203
8433
|
headers: this.filterHeaders(options?.headers),
|
|
8434
|
+
queryCombinations: currentQueryCombinations,
|
|
8204
8435
|
queryParams: currentQueryParams,
|
|
8205
8436
|
queryParamsExpires: currentQueryParamsExpires,
|
|
8206
8437
|
}
|
|
@@ -8252,10 +8483,13 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
8252
8483
|
});
|
|
8253
8484
|
}
|
|
8254
8485
|
});
|
|
8486
|
+
const sortedKeys = Object.keys(query).sort();
|
|
8487
|
+
const queryString = sortedKeys.map((k) => `${k}=${query[k]}`).join('&');
|
|
8255
8488
|
return {
|
|
8256
8489
|
pathKey: this.trackerNormalizePathSegments(pathSegments),
|
|
8257
8490
|
query,
|
|
8258
|
-
|
|
8491
|
+
queryString,
|
|
8492
|
+
hasQuery: sortedKeys.length > 0,
|
|
8259
8493
|
};
|
|
8260
8494
|
}
|
|
8261
8495
|
trackerParsePathSegment(rawSegment) {
|
|
@@ -8352,27 +8586,57 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
8352
8586
|
}
|
|
8353
8587
|
const meta = this.getRequestCacheMetadata(storeData, type) || {};
|
|
8354
8588
|
const now = Math.floor(Date.now() / 1000);
|
|
8355
|
-
|
|
8589
|
+
// Build the combination string from the filtered query (deterministic because keys are sorted)
|
|
8590
|
+
const combinationString = keys.sort().map((k) => `${k}=${filtered[k]}`).join('&');
|
|
8591
|
+
// Legacy per-key queryParams for backward compatibility (read-only)
|
|
8592
|
+
const queryParams = { ...(meta.queryParams || {}) };
|
|
8356
8593
|
let queryParamsExpires = meta.queryParamsExpires ?? null;
|
|
8357
|
-
//
|
|
8358
|
-
|
|
8594
|
+
// New combination-based tracking
|
|
8595
|
+
let queryCombinations = [...(meta.queryCombinations || [])];
|
|
8596
|
+
// Reset combinations if the request path has changed (different endpoint)
|
|
8597
|
+
// Use trackerNormalizePath so inline query strings (e.g. 'items?a=1') are stripped
|
|
8598
|
+
// before comparing, matching the same normalization applied to the current request.
|
|
8599
|
+
const storedPathKey = meta.path
|
|
8600
|
+
? this.trackerNormalizePath(meta.path.filter((p) => typeof p === 'string' || typeof p === 'number').map(String)).pathKey
|
|
8601
|
+
: null;
|
|
8359
8602
|
if (storedPathKey && storedPathKey !== normalized.pathKey) {
|
|
8360
|
-
|
|
8603
|
+
queryCombinations = [];
|
|
8604
|
+
// Also clear legacy per-key tracking so old data from a different path doesn't block
|
|
8605
|
+
Object.keys(queryParams).forEach((k) => delete queryParams[k]);
|
|
8361
8606
|
queryParamsExpires = null;
|
|
8362
8607
|
}
|
|
8363
8608
|
if (queryParamsExpires !== null && queryParamsExpires <= now) {
|
|
8364
|
-
|
|
8609
|
+
queryCombinations = [];
|
|
8365
8610
|
queryParamsExpires = null;
|
|
8611
|
+
Object.keys(queryParams).forEach((k) => delete queryParams[k]);
|
|
8612
|
+
}
|
|
8613
|
+
// Determine if request is accepted (not yet tracked)
|
|
8614
|
+
// Use combination-based tracking when available; fall back to legacy per-key tracking
|
|
8615
|
+
let accepted;
|
|
8616
|
+
if (queryCombinations.length > 0) {
|
|
8617
|
+
accepted = !queryCombinations.includes(combinationString);
|
|
8618
|
+
}
|
|
8619
|
+
else if (Object.keys(queryParams).length > 0) {
|
|
8620
|
+
// Legacy per-key backward compatibility
|
|
8621
|
+
accepted = !keys.every((key) => {
|
|
8622
|
+
const consumed = queryParams[key] || [];
|
|
8623
|
+
return consumed.includes(filtered[key]);
|
|
8624
|
+
});
|
|
8625
|
+
}
|
|
8626
|
+
else {
|
|
8627
|
+
accepted = true;
|
|
8628
|
+
}
|
|
8629
|
+
if (accepted) {
|
|
8630
|
+
queryCombinations = [...queryCombinations, combinationString];
|
|
8631
|
+
// Also update legacy queryParams so existing consumers still work
|
|
8632
|
+
keys.forEach(key => {
|
|
8633
|
+
const value = filtered[key];
|
|
8634
|
+
const consumed = queryParams[key] || [];
|
|
8635
|
+
if (!consumed.includes(value)) {
|
|
8636
|
+
queryParams[key] = [...consumed, value];
|
|
8637
|
+
}
|
|
8638
|
+
});
|
|
8366
8639
|
}
|
|
8367
|
-
let accepted = false;
|
|
8368
|
-
keys.forEach(key => {
|
|
8369
|
-
const value = filtered[key];
|
|
8370
|
-
const consumed = queryParams[key] || [];
|
|
8371
|
-
if (!consumed.includes(value)) {
|
|
8372
|
-
queryParams[key] = [...consumed, value];
|
|
8373
|
-
accepted = true;
|
|
8374
|
-
}
|
|
8375
|
-
});
|
|
8376
8640
|
const newExpiry = this.trackerBuildExpiryEpoch(options?.queryParamsExpiresIn);
|
|
8377
8641
|
if (newExpiry !== null) {
|
|
8378
8642
|
queryParamsExpires = newExpiry;
|
|
@@ -8389,6 +8653,7 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
8389
8653
|
...currentCache,
|
|
8390
8654
|
[type]: {
|
|
8391
8655
|
...currentEntry,
|
|
8656
|
+
queryCombinations,
|
|
8392
8657
|
queryParams,
|
|
8393
8658
|
queryParamsExpires,
|
|
8394
8659
|
}
|
|
@@ -8412,6 +8677,214 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
8412
8677
|
args: ["dataType"]
|
|
8413
8678
|
}] }, { type: DatabaseStorage }] });
|
|
8414
8679
|
|
|
8680
|
+
class HTTPManagerStateSignalsService {
|
|
8681
|
+
constructor() {
|
|
8682
|
+
// --- Injected services ---
|
|
8683
|
+
this.httpManagerSignalsService = inject(HTTPManagerSignalsService);
|
|
8684
|
+
this.databaseManagerSignalsService = inject(DatabaseManagerSignalsService);
|
|
8685
|
+
this.localStorageSignalsManagerService = inject(LocalStorageSignalsManagerService);
|
|
8686
|
+
this.utils = inject(UtilsService);
|
|
8687
|
+
this.logger = inject(LoggerService);
|
|
8688
|
+
this.destroyRef = inject(DestroyRef);
|
|
8689
|
+
this.injector = inject(Injector);
|
|
8690
|
+
// --- Own state signals (private writable, public readonly) ---
|
|
8691
|
+
this.dataSignal = signal([]);
|
|
8692
|
+
this.dataObjectSignal = signal(null);
|
|
8693
|
+
this.operationSuccessSignal = signal(null);
|
|
8694
|
+
this.pageSignal = signal(0);
|
|
8695
|
+
this.totalPagesSignal = signal(0);
|
|
8696
|
+
this.percentageSignal = signal(0);
|
|
8697
|
+
this.streamedResponseSignal = signal([]);
|
|
8698
|
+
this.messagesSignal = signal([]);
|
|
8699
|
+
// --- Public readonly state ---
|
|
8700
|
+
this.data = this.dataSignal.asReadonly();
|
|
8701
|
+
this.dataObject = this.dataObjectSignal.asReadonly();
|
|
8702
|
+
this.operationSuccess = this.operationSuccessSignal.asReadonly();
|
|
8703
|
+
this.page = this.pageSignal.asReadonly();
|
|
8704
|
+
this.totalPages = this.totalPagesSignal.asReadonly();
|
|
8705
|
+
this.percentage = this.percentageSignal.asReadonly();
|
|
8706
|
+
this.streamedResponse = this.streamedResponseSignal.asReadonly();
|
|
8707
|
+
this.messages = this.messagesSignal.asReadonly();
|
|
8708
|
+
// --- Delegated signals from HTTPManagerSignalsService ---
|
|
8709
|
+
this.error = this.httpManagerSignalsService.error;
|
|
8710
|
+
this.isPending = this.httpManagerSignalsService.isPending;
|
|
8711
|
+
this.isConnecting = this.httpManagerSignalsService.isConnecting;
|
|
8712
|
+
this.retryCount = this.httpManagerSignalsService.retryCount;
|
|
8713
|
+
this.maxRetries = this.httpManagerSignalsService.maxRetries;
|
|
8714
|
+
this.connectionError = this.httpManagerSignalsService.connectionError;
|
|
8715
|
+
// Accumulate WS messages via effect instead of scan() operators
|
|
8716
|
+
effect(() => {
|
|
8717
|
+
const msg = this.httpManagerSignalsService.data();
|
|
8718
|
+
if (msg !== null && msg !== undefined) {
|
|
8719
|
+
this.messagesSignal.update(msgs => [...msgs, msg]);
|
|
8720
|
+
}
|
|
8721
|
+
}, { injector: this.injector });
|
|
8722
|
+
}
|
|
8723
|
+
// --- State setters ---
|
|
8724
|
+
setData(items) {
|
|
8725
|
+
this.dataSignal.set(items);
|
|
8726
|
+
}
|
|
8727
|
+
setDataObject(item) {
|
|
8728
|
+
this.dataObjectSignal.set(item);
|
|
8729
|
+
}
|
|
8730
|
+
setOperationSuccess(result) {
|
|
8731
|
+
this.operationSuccessSignal.set(result);
|
|
8732
|
+
}
|
|
8733
|
+
setPage(n) {
|
|
8734
|
+
this.pageSignal.set(n);
|
|
8735
|
+
}
|
|
8736
|
+
setTotalPages(n) {
|
|
8737
|
+
this.totalPagesSignal.set(n);
|
|
8738
|
+
}
|
|
8739
|
+
setPercentage(n) {
|
|
8740
|
+
this.percentageSignal.set(n);
|
|
8741
|
+
}
|
|
8742
|
+
appendStreamedItem(item) {
|
|
8743
|
+
this.streamedResponseSignal.update(items => [...items, item]);
|
|
8744
|
+
}
|
|
8745
|
+
clearStreamedResponse() {
|
|
8746
|
+
this.streamedResponseSignal.set([]);
|
|
8747
|
+
}
|
|
8748
|
+
clearMessages() {
|
|
8749
|
+
this.messagesSignal.set([]);
|
|
8750
|
+
}
|
|
8751
|
+
// --- HTTP methods delegated to HTTPManagerSignalsService ---
|
|
8752
|
+
getRequest(options, params) {
|
|
8753
|
+
return this.httpManagerSignalsService.getRequest(options, params);
|
|
8754
|
+
}
|
|
8755
|
+
postRequest(data, options, params) {
|
|
8756
|
+
return this.httpManagerSignalsService.postRequest(data, options, params);
|
|
8757
|
+
}
|
|
8758
|
+
putRequest(data, options, params) {
|
|
8759
|
+
return this.httpManagerSignalsService.putRequest(data, options, params);
|
|
8760
|
+
}
|
|
8761
|
+
deleteRequest(options, params) {
|
|
8762
|
+
return this.httpManagerSignalsService.deleteRequest(options, params);
|
|
8763
|
+
}
|
|
8764
|
+
downloadRequest(options, params, saveAs) {
|
|
8765
|
+
return this.httpManagerSignalsService.downloadRequest(options, params, saveAs);
|
|
8766
|
+
}
|
|
8767
|
+
uploadRequest(files, options, params) {
|
|
8768
|
+
return this.httpManagerSignalsService.uploadRequest(files, options, params);
|
|
8769
|
+
}
|
|
8770
|
+
getBatchRequests(requests, options) {
|
|
8771
|
+
return this.httpManagerSignalsService.getBatchRequests(requests, options);
|
|
8772
|
+
}
|
|
8773
|
+
getSequentialRequest(requests, options) {
|
|
8774
|
+
return this.httpManagerSignalsService.getSequentialRequest(requests, options);
|
|
8775
|
+
}
|
|
8776
|
+
getParallelRequest(requests, options) {
|
|
8777
|
+
return this.httpManagerSignalsService.getParallelRequest(requests, options);
|
|
8778
|
+
}
|
|
8779
|
+
// --- WS control methods delegated to HTTPManagerSignalsService ---
|
|
8780
|
+
connect(options, jwtToken) {
|
|
8781
|
+
this.httpManagerSignalsService.connect(options, jwtToken);
|
|
8782
|
+
}
|
|
8783
|
+
disconnect() {
|
|
8784
|
+
this.httpManagerSignalsService.disconnect();
|
|
8785
|
+
}
|
|
8786
|
+
subscribeToChannel(channel, userData) {
|
|
8787
|
+
this.httpManagerSignalsService.subscribeToChannel(channel, userData);
|
|
8788
|
+
}
|
|
8789
|
+
subscribeToChannels(channels, userData) {
|
|
8790
|
+
this.httpManagerSignalsService.subscribeToChannels(channels, userData);
|
|
8791
|
+
}
|
|
8792
|
+
unsubscribeFromChannel(channel) {
|
|
8793
|
+
this.httpManagerSignalsService.unsubscribeFromChannel(channel);
|
|
8794
|
+
}
|
|
8795
|
+
getSubscribedChannels() {
|
|
8796
|
+
return this.httpManagerSignalsService.getSubscribedChannels();
|
|
8797
|
+
}
|
|
8798
|
+
sendBroadcast(content) {
|
|
8799
|
+
this.httpManagerSignalsService.sendBroadcast(content);
|
|
8800
|
+
}
|
|
8801
|
+
sendMessageInChannel(channel, content) {
|
|
8802
|
+
this.httpManagerSignalsService.sendMessageInChannel(channel, content);
|
|
8803
|
+
}
|
|
8804
|
+
sendChannelMessage(channel, content) {
|
|
8805
|
+
this.httpManagerSignalsService.sendChannelMessage(channel, content);
|
|
8806
|
+
}
|
|
8807
|
+
sendChannelMessageToChannels(channels, content) {
|
|
8808
|
+
this.httpManagerSignalsService.sendChannelMessageToChannels(channels, content);
|
|
8809
|
+
}
|
|
8810
|
+
sendMessageToUser(user, content) {
|
|
8811
|
+
this.httpManagerSignalsService.sendMessageToUser(user, content);
|
|
8812
|
+
}
|
|
8813
|
+
getAllChannels() {
|
|
8814
|
+
this.httpManagerSignalsService.getAllChannels();
|
|
8815
|
+
}
|
|
8816
|
+
createChannel(channel) {
|
|
8817
|
+
this.httpManagerSignalsService.createChannel(channel);
|
|
8818
|
+
}
|
|
8819
|
+
deleteChannel(channel) {
|
|
8820
|
+
this.httpManagerSignalsService.deleteChannel(channel);
|
|
8821
|
+
}
|
|
8822
|
+
getUsersInChannel(channel) {
|
|
8823
|
+
this.httpManagerSignalsService.getUsersInChannel(channel);
|
|
8824
|
+
}
|
|
8825
|
+
createNotificationChannel(channel) {
|
|
8826
|
+
this.httpManagerSignalsService.createNotificationChannel(channel);
|
|
8827
|
+
}
|
|
8828
|
+
getNotificationChannels() {
|
|
8829
|
+
this.httpManagerSignalsService.getNotificationChannels();
|
|
8830
|
+
}
|
|
8831
|
+
getTodaysNotificationChannels() {
|
|
8832
|
+
this.httpManagerSignalsService.getTodaysNotificationChannels();
|
|
8833
|
+
}
|
|
8834
|
+
subscribeToNotificationChannel(channel, options, user) {
|
|
8835
|
+
this.httpManagerSignalsService.subscribeToNotificationChannel(channel, options, user);
|
|
8836
|
+
}
|
|
8837
|
+
unsubscribeFromNotificationChannel(channel) {
|
|
8838
|
+
this.httpManagerSignalsService.unsubscribeFromNotificationChannel(channel);
|
|
8839
|
+
}
|
|
8840
|
+
sendNotification(channel, content) {
|
|
8841
|
+
this.httpManagerSignalsService.sendNotification(channel, content);
|
|
8842
|
+
}
|
|
8843
|
+
// --- DB methods delegated to DatabaseManagerSignalsService ---
|
|
8844
|
+
getDatabaseTables() {
|
|
8845
|
+
return this.databaseManagerSignalsService.getDatabaseTables();
|
|
8846
|
+
}
|
|
8847
|
+
databaseExists() {
|
|
8848
|
+
return this.databaseManagerSignalsService.databaseExists();
|
|
8849
|
+
}
|
|
8850
|
+
hasDatabaseTable(table) {
|
|
8851
|
+
return this.databaseManagerSignalsService.hasDatabaseTable(table);
|
|
8852
|
+
}
|
|
8853
|
+
getDatabaseTable(table) {
|
|
8854
|
+
return this.databaseManagerSignalsService.getDatabaseTable(table);
|
|
8855
|
+
}
|
|
8856
|
+
getDatabaseTableSchema(table) {
|
|
8857
|
+
return this.databaseManagerSignalsService.getDatabaseTableSchema(table);
|
|
8858
|
+
}
|
|
8859
|
+
createDatabaseTable(tableDef) {
|
|
8860
|
+
return this.databaseManagerSignalsService.createDatabaseTable(tableDef);
|
|
8861
|
+
}
|
|
8862
|
+
updateDatabaseTableSchema(tableDef) {
|
|
8863
|
+
return this.databaseManagerSignalsService.updateDatabaseTableSchema(tableDef);
|
|
8864
|
+
}
|
|
8865
|
+
// --- localStorage methods delegated to LocalStorageSignalsManagerService ---
|
|
8866
|
+
createStore(store) {
|
|
8867
|
+
this.localStorageSignalsManagerService.createStore(store);
|
|
8868
|
+
}
|
|
8869
|
+
setStore(store) {
|
|
8870
|
+
this.localStorageSignalsManagerService.setStore(store);
|
|
8871
|
+
}
|
|
8872
|
+
updateStore(store) {
|
|
8873
|
+
this.localStorageSignalsManagerService.updateStore(store);
|
|
8874
|
+
}
|
|
8875
|
+
deleteStore(store) {
|
|
8876
|
+
this.localStorageSignalsManagerService.deleteStore(store);
|
|
8877
|
+
}
|
|
8878
|
+
getStore(storeName) {
|
|
8879
|
+
return this.localStorageSignalsManagerService.store(storeName);
|
|
8880
|
+
}
|
|
8881
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HTTPManagerStateSignalsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
8882
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HTTPManagerStateSignalsService }); }
|
|
8883
|
+
}
|
|
8884
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HTTPManagerStateSignalsService, decorators: [{
|
|
8885
|
+
type: Injectable
|
|
8886
|
+
}], ctorParameters: () => [] });
|
|
8887
|
+
|
|
8415
8888
|
class StateStorageOptions {
|
|
8416
8889
|
constructor(store, options, model) {
|
|
8417
8890
|
this.store = store;
|
|
@@ -8567,6 +9040,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
8567
9040
|
class StoreStateManagerSignalsService {
|
|
8568
9041
|
constructor() {
|
|
8569
9042
|
this.localStorageManagerService = inject(LocalStorageSignalsManagerService);
|
|
9043
|
+
this.injector = inject(Injector);
|
|
8570
9044
|
this.state = signal(null);
|
|
8571
9045
|
this.isRestoring = false;
|
|
8572
9046
|
this.settings = null;
|
|
@@ -8583,6 +9057,8 @@ class StoreStateManagerSignalsService {
|
|
|
8583
9057
|
});
|
|
8584
9058
|
}
|
|
8585
9059
|
init(options) {
|
|
9060
|
+
if (this.settings !== null)
|
|
9061
|
+
return;
|
|
8586
9062
|
this.settings = options;
|
|
8587
9063
|
const storeName = options.store ?? 'temp';
|
|
8588
9064
|
// Create store in localStorage
|
|
@@ -8600,7 +9076,7 @@ class StoreStateManagerSignalsService {
|
|
|
8600
9076
|
if (storeData && !this.isRestoring) {
|
|
8601
9077
|
this.state.set(storeData);
|
|
8602
9078
|
}
|
|
8603
|
-
});
|
|
9079
|
+
}, { injector: this.injector });
|
|
8604
9080
|
}
|
|
8605
9081
|
restoreState() {
|
|
8606
9082
|
if (!this.settings)
|
|
@@ -13772,5 +14248,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
13772
14248
|
* Generated bundle index. Do not edit.
|
|
13773
14249
|
*/
|
|
13774
14250
|
|
|
13775
|
-
export { ApiRequest, AppService, AsymmetricalEncryptionService, BatchOptions, BatchResult, CONFIG_SETTINGS_TOKEN, ChannelType, ConfigHTTPOptions, ConfigOptions, DataType, DatabaseDataDemoComponent, DatabaseManagerService, DatabaseStorage, DbService, DexieSqlService, ErrorDisplaySettings, ExecutionPlanType, GlobalStoreOptions, HTTPManagerService, HTTPManagerSignalsService, HTTPManagerStateService, HeadersService, HttpRequestManagerModule, HttpRequestServicesDemoComponent, InvalidFileInfoModel, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsDemoComponent, LocalStorageSignalsManagerService, LoggerService, NotificationMessage, OperationResultModel, ParsingResultModel, PathQueryService, PublicMessage, Random, RandomHSLColor, RandomHexColor, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomPaletteColor, RandomSignature, RandomStr, RandomVisibleColor, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, SqlParseError, SqlValidationError, StateMessage, StateOperationResult, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, StoreStateManagerSignalsService, StoreStateSignalsDemoComponent, StreamConfigModel, StreamEventMetadataModel, StreamEventModel, StreamOutputModel, StreamProgressModel, StreamType, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UploadDemoComponent, UploadValidationErrorModel, UserData, UtilsService, WSOptions, WebSocketMessageService, WithCredentialsInterceptor, calculateBatchProgress, countdown, createChannelName, delayedRetry, isErrorState, isPendingState, isSuccessState, requestPolling, requestStreaming, streamAI, streamAuto, streamEvents, streamJSON, streamNDJSON };
|
|
14251
|
+
export { ApiRequest, AppService, AsymmetricalEncryptionService, BatchOptions, BatchResult, CONFIG_SETTINGS_TOKEN, ChannelType, ConfigHTTPOptions, ConfigOptions, DataType, DatabaseDataDemoComponent, DatabaseManagerService, DatabaseManagerSignalsService, DatabaseStorage, DbService, DexieSqlService, ErrorDisplaySettings, ExecutionPlanType, GlobalStoreOptions, HTTPManagerService, HTTPManagerSignalsService, HTTPManagerStateService, HTTPManagerStateSignalsService, HeadersService, HttpRequestManagerModule, HttpRequestServicesDemoComponent, InvalidFileInfoModel, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsDemoComponent, LocalStorageSignalsManagerService, LoggerService, NotificationMessage, OperationResultModel, ParsingResultModel, PathQueryService, PublicMessage, Random, RandomHSLColor, RandomHexColor, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomPaletteColor, RandomSignature, RandomStr, RandomVisibleColor, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, SqlParseError, SqlValidationError, StateMessage, StateOperationResult, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, StoreStateManagerSignalsService, StoreStateSignalsDemoComponent, StreamConfigModel, StreamEventMetadataModel, StreamEventModel, StreamOutputModel, StreamProgressModel, StreamType, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UploadDemoComponent, UploadValidationErrorModel, UserData, UtilsService, WSOptions, WebSocketMessageService, WithCredentialsInterceptor, calculateBatchProgress, countdown, createChannelName, delayedRetry, isErrorState, isPendingState, isSuccessState, requestPolling, requestStreaming, streamAI, streamAuto, streamEvents, streamJSON, streamNDJSON };
|
|
13776
14252
|
//# sourceMappingURL=http-request-manager.mjs.map
|