http-request-manager 18.7.5 → 18.7.6
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.
|
@@ -3002,15 +3002,15 @@ class ChannelMessage {
|
|
|
3002
3002
|
const API_OPTS = new InjectionToken('API_OPTS');
|
|
3003
3003
|
/**
|
|
3004
3004
|
* Channel type enum for different communication purposes
|
|
3005
|
-
* - STATE: Private channels for state synchronization
|
|
3006
|
-
* - MESSAGE:
|
|
3007
|
-
* - NOTIFICATION: Notification
|
|
3005
|
+
* - STATE: Private channels for state synchronization (SYS- prefix)
|
|
3006
|
+
* - MESSAGE: Public messaging/communication channels (PUB- prefix)
|
|
3007
|
+
* - NOTIFICATION: Notification channels with DB persistence (MES- prefix)
|
|
3008
3008
|
*/
|
|
3009
3009
|
var ChannelType;
|
|
3010
3010
|
(function (ChannelType) {
|
|
3011
3011
|
ChannelType["STATE"] = "SYS";
|
|
3012
|
-
ChannelType["MESSAGE"] = "
|
|
3013
|
-
ChannelType["NOTIFICATION"] = "
|
|
3012
|
+
ChannelType["MESSAGE"] = "PUB";
|
|
3013
|
+
ChannelType["NOTIFICATION"] = "MES";
|
|
3014
3014
|
})(ChannelType || (ChannelType = {}));
|
|
3015
3015
|
/**
|
|
3016
3016
|
* Utility function to create prefixed channel name
|
|
@@ -3867,10 +3867,10 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3867
3867
|
}
|
|
3868
3868
|
}
|
|
3869
3869
|
// --------------------------------------------------------------------------------------------------
|
|
3870
|
-
// NOTIFICATION CHANNELS (
|
|
3870
|
+
// NOTIFICATION CHANNELS (MES- prefix - managed automatically)
|
|
3871
3871
|
/**
|
|
3872
3872
|
* Create a notification channel on the server
|
|
3873
|
-
* @param channel - Base channel name (
|
|
3873
|
+
* @param channel - Base channel name (MES- prefix added automatically)
|
|
3874
3874
|
*/
|
|
3875
3875
|
createNotificationChannel(channel) {
|
|
3876
3876
|
if (this.wsConnection) {
|
|
@@ -3907,7 +3907,7 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3907
3907
|
}
|
|
3908
3908
|
/**
|
|
3909
3909
|
* Subscribe to a notification channel with optional date filters
|
|
3910
|
-
* @param channel - Base channel name (
|
|
3910
|
+
* @param channel - Base channel name (MES- prefix added automatically)
|
|
3911
3911
|
*/
|
|
3912
3912
|
subscribeToNotificationChannel(channel, options, user) {
|
|
3913
3913
|
if (this.wsConnection) {
|
|
@@ -3921,7 +3921,7 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3921
3921
|
}
|
|
3922
3922
|
/**
|
|
3923
3923
|
* Unsubscribe from a notification channel
|
|
3924
|
-
* @param channel - Base channel name (
|
|
3924
|
+
* @param channel - Base channel name (MES- prefix added automatically)
|
|
3925
3925
|
*/
|
|
3926
3926
|
unsubscribeFromNotificationChannel(channel) {
|
|
3927
3927
|
if (this.wsConnection) {
|
|
@@ -3935,7 +3935,7 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3935
3935
|
}
|
|
3936
3936
|
/**
|
|
3937
3937
|
* Send a notification to a channel
|
|
3938
|
-
* @param channel - Base channel name (
|
|
3938
|
+
* @param channel - Base channel name (MES- prefix added automatically)
|
|
3939
3939
|
*/
|
|
3940
3940
|
sendNotification(channel, content) {
|
|
3941
3941
|
if (this.wsConnection) {
|
|
@@ -4820,25 +4820,13 @@ class NotificationServiceDemo {
|
|
|
4820
4820
|
// Expose connection status from state service
|
|
4821
4821
|
this.connectionStatus$ = this.stateService.connectionStatus$;
|
|
4822
4822
|
}
|
|
4823
|
-
/**
|
|
4824
|
-
* Helper to ensure channel has MES- prefix
|
|
4825
|
-
*/
|
|
4826
|
-
toNotificationChannel(channel) {
|
|
4827
|
-
return channel.startsWith('MES-') ? channel : `MES-${channel}`;
|
|
4828
|
-
}
|
|
4829
|
-
/**
|
|
4830
|
-
* Helper to strip MES- prefix for display
|
|
4831
|
-
*/
|
|
4832
|
-
fromNotificationChannel(channel) {
|
|
4833
|
-
return channel.startsWith('MES-') ? channel.replace('MES-', '') : channel;
|
|
4834
|
-
}
|
|
4835
4823
|
/**
|
|
4836
4824
|
* Create a notification channel
|
|
4825
|
+
* NOTE: MES- prefix is added automatically by HTTPManagerStateService
|
|
4837
4826
|
*/
|
|
4838
4827
|
createNotificationChannel(channel) {
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
this.stateService.createNotificationChannel(notifyChannel);
|
|
4828
|
+
console.log('📢 createNotificationChannel:', channel);
|
|
4829
|
+
this.stateService.createNotificationChannel(channel);
|
|
4842
4830
|
}
|
|
4843
4831
|
/**
|
|
4844
4832
|
* Get all notification channels (in-memory)
|
|
@@ -4857,38 +4845,42 @@ class NotificationServiceDemo {
|
|
|
4857
4845
|
}
|
|
4858
4846
|
/**
|
|
4859
4847
|
* Subscribe to a notification channel with optional date filter
|
|
4860
|
-
*
|
|
4848
|
+
* NOTE: MES- prefix is added automatically by HTTPManagerStateService
|
|
4849
|
+
* @param channel Base channel name (without MES- prefix)
|
|
4861
4850
|
* @param options { startEpoch?, endEpoch? }
|
|
4862
4851
|
* @param user User info for subscription
|
|
4863
4852
|
*/
|
|
4864
4853
|
subscribeToNotificationChannel(channel, options, user) {
|
|
4865
|
-
|
|
4866
|
-
|
|
4854
|
+
// Add MES- prefix for local tracking (to match what state service sends)
|
|
4855
|
+
const prefixedChannel = channel.startsWith('MES-') ? channel : `MES-${channel}`;
|
|
4856
|
+
console.log('📢 subscribeToNotificationChannel:', prefixedChannel, options);
|
|
4867
4857
|
// Add to local subscribed channels immediately for UI feedback
|
|
4868
4858
|
const currentSubs = this.subscribedNotificationChannelsSubject.value;
|
|
4869
|
-
currentSubs.add(
|
|
4859
|
+
currentSubs.add(prefixedChannel);
|
|
4870
4860
|
this.subscribedNotificationChannelsSubject.next(new Set(currentSubs));
|
|
4871
|
-
// Send subscription request to server
|
|
4872
|
-
this.stateService.subscribeToNotificationChannel(
|
|
4861
|
+
// Send subscription request to server (state service adds MES- prefix)
|
|
4862
|
+
this.stateService.subscribeToNotificationChannel(channel, options, user);
|
|
4873
4863
|
}
|
|
4874
4864
|
/**
|
|
4875
4865
|
* Unsubscribe from a notification channel
|
|
4866
|
+
* NOTE: MES- prefix is added automatically by HTTPManagerStateService
|
|
4876
4867
|
*/
|
|
4877
4868
|
unsubscribeFromNotificationChannel(channel) {
|
|
4878
|
-
|
|
4879
|
-
|
|
4869
|
+
// Add MES- prefix for local tracking (to match what state service sends)
|
|
4870
|
+
const prefixedChannel = channel.startsWith('MES-') ? channel : `MES-${channel}`;
|
|
4871
|
+
console.log('📢 unsubscribeFromNotificationChannel:', prefixedChannel);
|
|
4880
4872
|
// Remove from local subscribed channels immediately for UI feedback
|
|
4881
4873
|
const currentSubs = this.subscribedNotificationChannelsSubject.value;
|
|
4882
|
-
currentSubs.delete(
|
|
4874
|
+
currentSubs.delete(prefixedChannel);
|
|
4883
4875
|
this.subscribedNotificationChannelsSubject.next(new Set(currentSubs));
|
|
4884
|
-
// Send unsubscription request to server
|
|
4885
|
-
this.stateService.unsubscribeFromNotificationChannel(
|
|
4876
|
+
// Send unsubscription request to server (state service adds MES- prefix)
|
|
4877
|
+
this.stateService.unsubscribeFromNotificationChannel(channel);
|
|
4886
4878
|
}
|
|
4887
4879
|
/**
|
|
4888
4880
|
* Send a notification to a channel
|
|
4881
|
+
* NOTE: MES- prefix is added automatically by HTTPManagerStateService
|
|
4889
4882
|
*/
|
|
4890
4883
|
sendNotification(channel, content, user) {
|
|
4891
|
-
const notifyChannel = this.toNotificationChannel(channel);
|
|
4892
4884
|
const notificationContent = {
|
|
4893
4885
|
sessionId: {
|
|
4894
4886
|
id: user?.id,
|
|
@@ -4898,8 +4890,9 @@ class NotificationServiceDemo {
|
|
|
4898
4890
|
},
|
|
4899
4891
|
...content
|
|
4900
4892
|
};
|
|
4901
|
-
console.log('📢 sendNotification:',
|
|
4902
|
-
|
|
4893
|
+
console.log('📢 sendNotification:', channel, notificationContent);
|
|
4894
|
+
// State service adds MES- prefix
|
|
4895
|
+
this.stateService.sendNotification(channel, notificationContent);
|
|
4903
4896
|
}
|
|
4904
4897
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NotificationServiceDemo, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4905
4898
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NotificationServiceDemo, providedIn: 'root' }); }
|
|
@@ -5108,12 +5101,6 @@ class WsMessagingComponent {
|
|
|
5108
5101
|
return { user: mainUser, messages };
|
|
5109
5102
|
}));
|
|
5110
5103
|
}
|
|
5111
|
-
/**
|
|
5112
|
-
* Helper to ensure channel has PUB- prefix for outgoing communication
|
|
5113
|
-
*/
|
|
5114
|
-
toPublicChannel(channel) {
|
|
5115
|
-
return channel.startsWith('PUB-') ? channel : `PUB-${channel}`;
|
|
5116
|
-
}
|
|
5117
5104
|
get selectedChannels() {
|
|
5118
5105
|
return this.messages.get('selectedChannels');
|
|
5119
5106
|
}
|
|
@@ -5145,35 +5132,36 @@ class WsMessagingComponent {
|
|
|
5145
5132
|
}
|
|
5146
5133
|
/**
|
|
5147
5134
|
* Create a new public channel without auto-subscribing
|
|
5148
|
-
*
|
|
5135
|
+
* NOTE: PUB- prefix is added by messageService.createChannel
|
|
5149
5136
|
*/
|
|
5150
5137
|
onCreateChannel() {
|
|
5151
5138
|
if (this.newChannelName.invalid)
|
|
5152
5139
|
return;
|
|
5153
5140
|
const channelName = this.newChannelName.value?.trim();
|
|
5154
5141
|
if (channelName) {
|
|
5155
|
-
//
|
|
5156
|
-
|
|
5157
|
-
this.messageService.createChannel(publicChannelName);
|
|
5142
|
+
// Pass base channel name - service adds PUB- prefix
|
|
5143
|
+
this.messageService.createChannel(channelName);
|
|
5158
5144
|
this.newChannelName.reset();
|
|
5159
5145
|
// Server will broadcast updated channel list to all clients automatically
|
|
5160
5146
|
}
|
|
5161
5147
|
}
|
|
5162
5148
|
/**
|
|
5163
5149
|
* Subscribe to a channel to receive messages
|
|
5164
|
-
*
|
|
5150
|
+
* NOTE: PUB- prefix is added by messageService.subscribeToChannel
|
|
5165
5151
|
*/
|
|
5166
5152
|
onSubscribeToChannel(channel) {
|
|
5167
|
-
|
|
5153
|
+
// Pass base channel name - service adds PUB- prefix
|
|
5154
|
+
this.messageService.subscribeToChannel(channel);
|
|
5168
5155
|
// Reset channel selection when subscriptions change
|
|
5169
5156
|
this.selectedChannels.reset([]);
|
|
5170
5157
|
}
|
|
5171
5158
|
/**
|
|
5172
5159
|
* Unsubscribe from a channel
|
|
5173
|
-
*
|
|
5160
|
+
* NOTE: PUB- prefix is added by messageService.unsubscribeFromChannel
|
|
5174
5161
|
*/
|
|
5175
5162
|
onUnsubscribeFromChannel(channel) {
|
|
5176
|
-
|
|
5163
|
+
// Pass base channel name - service adds PUB- prefix
|
|
5164
|
+
this.messageService.unsubscribeFromChannel(channel);
|
|
5177
5165
|
// Reset channel selection when subscriptions change
|
|
5178
5166
|
this.selectedChannels.reset([]);
|
|
5179
5167
|
}
|
|
@@ -5214,8 +5202,7 @@ class WsMessagingComponent {
|
|
|
5214
5202
|
const channelsToSend = this.selectedChannels.value;
|
|
5215
5203
|
if (channelsToSend.length === 0)
|
|
5216
5204
|
return;
|
|
5217
|
-
//
|
|
5218
|
-
const publicChannels = channelsToSend.map(ch => this.toPublicChannel(ch));
|
|
5205
|
+
// Pass base channel names - service adds PUB- prefix
|
|
5219
5206
|
const message = ChannelMessage.adapt({
|
|
5220
5207
|
sessionId: {
|
|
5221
5208
|
id: user.id,
|
|
@@ -5225,7 +5212,7 @@ class WsMessagingComponent {
|
|
|
5225
5212
|
},
|
|
5226
5213
|
content: { message: this.messages.value.content },
|
|
5227
5214
|
});
|
|
5228
|
-
this.messageService.sendMessage(message,
|
|
5215
|
+
this.messageService.sendMessage(message, channelsToSend);
|
|
5229
5216
|
this.content.reset();
|
|
5230
5217
|
}
|
|
5231
5218
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|