http-request-manager 18.5.9 → 18.5.11

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.
@@ -735,37 +735,22 @@ class ChannelInfo {
735
735
  }
736
736
  }
737
737
 
738
- var CommunicationType;
739
- (function (CommunicationType) {
740
- CommunicationType[CommunicationType["MESSAGE"] = 0] = "MESSAGE";
741
- CommunicationType[CommunicationType["ALERT"] = 1] = "ALERT";
742
- CommunicationType[CommunicationType["OTHER"] = 2] = "OTHER";
743
- })(CommunicationType || (CommunicationType = {}));
744
-
745
- class ChannelMessage {
746
- constructor(fromUser = null, toUser = null, content = null, issued = new Date(), type = CommunicationType.MESSAGE) {
747
- this.fromUser = fromUser;
748
- this.toUser = toUser;
738
+ class WSUser {
739
+ constructor(sessionId, content) {
740
+ this.sessionId = sessionId;
749
741
  this.content = content;
750
- this.issued = issued;
751
- this.type = type;
752
742
  }
753
743
  static adapt(item) {
754
- return new ChannelMessage(item?.fromUser, item?.toUser, item?.content, item?.issued, item?.type);
744
+ return new WSUser(item?.sessionId, item?.content);
755
745
  }
756
746
  }
757
747
 
758
- class UserMessage {
759
- constructor(fromUser, toUser, content, issued) {
760
- this.fromUser = fromUser;
761
- this.toUser = toUser;
762
- this.content = content;
763
- this.issued = issued;
764
- }
765
- static adapt(item) {
766
- return new UserMessage(item?.fromUser, item?.name?.toUser, item?.content, item?.name?.issued);
767
- }
768
- }
748
+ var CommunicationType;
749
+ (function (CommunicationType) {
750
+ CommunicationType[CommunicationType["MESSAGE"] = 0] = "MESSAGE";
751
+ CommunicationType[CommunicationType["ALERT"] = 1] = "ALERT";
752
+ CommunicationType[CommunicationType["OTHER"] = 2] = "OTHER";
753
+ })(CommunicationType || (CommunicationType = {}));
769
754
 
770
755
  class WebsocketService {
771
756
  constructor() {
@@ -889,7 +874,7 @@ class WebsocketService {
889
874
  sendMessageInChannel(channel, content) {
890
875
  if (this.socket?.readyState === WebSocket.OPEN) {
891
876
  this.socket.send(JSON.stringify({ type: 'stateMangerMessage', subscribedChannel: channel, content }));
892
- console.log(`💬 Send message: ${content}`);
877
+ console.log(`💬 Send message:`, content);
893
878
  }
894
879
  else {
895
880
  console.error('WebSocket is not open. Cannot send message.');
@@ -898,7 +883,7 @@ class WebsocketService {
898
883
  sendMessageToUser(user, content) {
899
884
  if (this.socket?.readyState === WebSocket.OPEN) {
900
885
  this.socket.send(JSON.stringify({ type: 'userMessage', subscribedChannel: user, content }));
901
- console.log(`💬 Send message: ${content}`);
886
+ console.log(`💬 Send message:`, content);
902
887
  }
903
888
  else {
904
889
  console.error('WebSocket is not open. Cannot send message.');
@@ -1841,16 +1826,6 @@ class WSOptions {
1841
1826
  }
1842
1827
  }
1843
1828
 
1844
- class WSUser {
1845
- constructor(id = '', adapter) {
1846
- this.id = id;
1847
- this.adapter = adapter;
1848
- }
1849
- static adapt(item) {
1850
- return new WSUser(item?.id, item?.adapter);
1851
- }
1852
- }
1853
-
1854
1829
  class ObjectMergerService {
1855
1830
  constructor(configOptions) {
1856
1831
  this.configOptions = configOptions;
@@ -2582,10 +2557,8 @@ class DbService extends Dexie {
2582
2557
  await this.dbReady;
2583
2558
  const safeTableName = this.cleanTableName(tableName);
2584
2559
  const safeSchema = schema.trim();
2585
- if (this.tableExists(safeTableName)) {
2586
- console.log(`Table ${safeTableName} already exists.`);
2560
+ if (this.tableExists(safeTableName))
2587
2561
  return;
2588
- }
2589
2562
  const currentSchema = this.getCurrentSchema();
2590
2563
  console.log('Current Schema before update:', currentSchema);
2591
2564
  currentSchema[safeTableName] = safeSchema;
@@ -2838,6 +2811,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
2838
2811
  }]
2839
2812
  }], ctorParameters: () => [] });
2840
2813
 
2814
+ class ChannelMessage {
2815
+ constructor(sessionId = '', content, message = '', users = [], issued = Math.floor(new Date().getTime() / 1000)) {
2816
+ this.sessionId = sessionId;
2817
+ this.content = content;
2818
+ this.message = message;
2819
+ this.users = users;
2820
+ this.issued = issued;
2821
+ }
2822
+ static adapt(item) {
2823
+ return new ChannelMessage(item?.sessionId, item?.content, item?.message, (item?.users) ? item?.users.map((userItem) => WSUser.adapt(userItem)) : [], item?.issued);
2824
+ }
2825
+ }
2826
+
2841
2827
  const API_OPTS = new InjectionToken('API_OPTS');
2842
2828
  const defaultState = {
2843
2829
  data: [],
@@ -2887,27 +2873,20 @@ class HTTPManagerStateService extends ComponentStore {
2887
2873
  // WebSocket
2888
2874
  this.initWS = this.effect((wsOptions$) => wsOptions$.pipe(tap((wsOptions) => {
2889
2875
  this.wsOptions = wsOptions;
2890
- if (wsOptions?.wsServer)
2891
- this.httpManagerService.connect(wsOptions, wsOptions.jwtToken);
2892
2876
  }), switchMap((wsOptions) => merge(this.httpManagerService.connectionStatus$.pipe(tap((isConnected) => {
2893
2877
  this.wsConnection = isConnected;
2894
- if (isConnected) {
2895
- console.log('🟢 WebSocket connection is open.');
2896
- }
2897
- else {
2898
- console.log('🔴 WebSocket connection is closed.');
2899
- }
2900
2878
  })), this.httpManagerService.messages$.pipe(tap((message) => {
2901
2879
  if (!message)
2902
2880
  return;
2903
- console.log('Received:', message.type);
2881
+ console.log('Received:', message);
2904
2882
  if (message.error === 'JWT_INVALID') {
2905
2883
  this.shouldRetry = false;
2906
2884
  this.httpManagerService.disconnect();
2907
2885
  }
2908
2886
  if (message.type === 'success') {
2909
2887
  if (message.data.sessionId !== this.user.value?.sessionId) {
2910
- this.user.next(message.data);
2888
+ const user = WSUser.adapt(message.data);
2889
+ this.user.next(user);
2911
2890
  }
2912
2891
  }
2913
2892
  switch (message.type) {
@@ -2923,7 +2902,7 @@ class HTTPManagerStateService extends ComponentStore {
2923
2902
  break;
2924
2903
  case 'stateMangerMessage':
2925
2904
  ;
2926
- if (message.data.sessionId !== this.user.value.sessionId) {
2905
+ if (message.data.sessionId !== this.user.value?.sessionId) {
2927
2906
  console.log('💬 Message:', message.data);
2928
2907
  this.userAction.next(message.data);
2929
2908
  this.fetchRecord(RequestOptions.adapt({ path: message.data.content.path }), message.data.content.method);
@@ -2955,9 +2934,9 @@ class HTTPManagerStateService extends ComponentStore {
2955
2934
  console.warn('Database storage requires dataType to be ARRAY');
2956
2935
  if (!this.apiOptions.adapter)
2957
2936
  console.warn('Database storage requires an adapter to define the data shape');
2958
- if (this.database && this.database?.table === '')
2937
+ if (this.databaseOptions && this.databaseOptions?.table === '')
2959
2938
  console.warn('Database storage requires a table name');
2960
- }), filter(() => this.dataType === DataType.ARRAY && !!this.apiOptions.adapter && !!this.database?.table), switchMap(() => {
2939
+ }), filter(() => this.dataType === DataType.ARRAY && !!this.apiOptions.adapter && !!this.databaseOptions?.table), switchMap(() => {
2961
2940
  const sampleData = this.apiOptions.adapter?.({}) || {};
2962
2941
  const schemaKeys = Object.keys(sampleData).filter(key => sampleData[key] !== undefined);
2963
2942
  let schema = '++id';
@@ -2968,7 +2947,7 @@ class HTTPManagerStateService extends ComponentStore {
2968
2947
  }
2969
2948
  }
2970
2949
  const tableDef = TableSchemaDef.adapt({
2971
- table: this.database?.table,
2950
+ table: this.databaseOptions?.table,
2972
2951
  schema: schema
2973
2952
  });
2974
2953
  return this.dbManagerService.createDatabaseTable(tableDef);
@@ -3054,11 +3033,11 @@ class HTTPManagerStateService extends ComponentStore {
3054
3033
  this.setData$({});
3055
3034
  }
3056
3035
  }), concatMap(() => {
3057
- if (this.hasDatabase && this.database?.table) {
3036
+ if (this.hasDatabase && this.databaseOptions?.table) {
3058
3037
  const currentData = this.get()?.data;
3059
3038
  const idsToDelete = Array.isArray(currentData) ? currentData.map((r) => r.id) : [];
3060
3039
  if (idsToDelete.length > 0) {
3061
- return this.dbManagerService.deleteTableRecords(this.database.table, idsToDelete);
3040
+ return this.dbManagerService.deleteTableRecords(this.databaseOptions.table, idsToDelete);
3062
3041
  }
3063
3042
  }
3064
3043
  return of(null);
@@ -3074,39 +3053,39 @@ class HTTPManagerStateService extends ComponentStore {
3074
3053
  data = (!data) ? (this.dataType === DataType.ARRAY) ? [] : {} : data;
3075
3054
  this.setData$(data);
3076
3055
  }), concatMap((data) => {
3077
- if (this.hasDatabase && this.database?.table && Array.isArray(data) && data.length > 0) {
3056
+ if (this.hasDatabase && this.databaseOptions?.table && Array.isArray(data) && data.length > 0) {
3078
3057
  this.localStorageManagerService.updateStore({
3079
- name: this.database.table,
3080
- data: { ...this.database, ...{ expires: this.utils.expires(this.database.expiresIn) } }
3058
+ name: this.databaseOptions.table,
3059
+ data: { ...this.databaseOptions, ...{ expires: this.utils.expires(this.databaseOptions.expiresIn) } }
3081
3060
  });
3082
- return this.dbManagerService.createTableRecords(this.database.table, data);
3061
+ return this.dbManagerService.createTableRecords(this.databaseOptions.table, data);
3083
3062
  }
3084
3063
  return of(data);
3085
3064
  }));
3086
3065
  };
3087
- if (this.hasDatabase && this.database?.table) {
3066
+ if (this.hasDatabase && this.databaseOptions?.table) {
3088
3067
  return this.dbManagerService.databaseExists().pipe(switchMap((dbExists) => {
3089
3068
  if (!dbExists) {
3090
3069
  const initObs = this.initDBStorageAsync();
3091
3070
  return initObs.pipe(switchMap(() => fetchFromAPI()));
3092
3071
  }
3093
- return this.dbManagerService.hasDatabaseTable(this.database.table).pipe(switchMap((tableExists) => {
3072
+ return this.dbManagerService.hasDatabaseTable(this.databaseOptions.table).pipe(switchMap((tableExists) => {
3094
3073
  if (!tableExists) {
3095
3074
  const initObs = this.initDBStorageAsync();
3096
3075
  return initObs.pipe(switchMap(() => fetchFromAPI()));
3097
3076
  }
3098
- return this.localStorageManagerService.store$(this.database.table).pipe(take(1), switchMap((storeData) => {
3077
+ return this.localStorageManagerService.store$(this.databaseOptions.table).pipe(take(1), switchMap((storeData) => {
3099
3078
  const expires = storeData?.expires || 0;
3100
3079
  const hasExpired = expires > 0 && this.utils.hasExpired(expires);
3101
3080
  if (hasExpired) {
3102
- return this.dbManagerService.clearTable(this.database.table).pipe(switchMap(() => fetchFromAPI()), tap(() => {
3081
+ return this.dbManagerService.clearTable(this.databaseOptions.table).pipe(switchMap(() => fetchFromAPI()), tap(() => {
3103
3082
  this.localStorageManagerService.updateStore({
3104
- name: this.database.table,
3105
- data: { ...this.database, ...{ expires: this.utils.expires(this.database.expiresIn) } }
3083
+ name: this.databaseOptions.table,
3084
+ data: { ...this.databaseOptions, ...{ expires: this.utils.expires(this.databaseOptions.expiresIn) } }
3106
3085
  });
3107
3086
  }));
3108
3087
  }
3109
- return this.dbManagerService.getTableRecords(this.database.table).pipe(switchMap((dbData) => {
3088
+ return this.dbManagerService.getTableRecords(this.databaseOptions.table).pipe(switchMap((dbData) => {
3110
3089
  if (Array.isArray(dbData) && dbData.length > 0) {
3111
3090
  this.setData$(dbData);
3112
3091
  return of(dbData);
@@ -3134,14 +3113,14 @@ class HTTPManagerStateService extends ComponentStore {
3134
3113
  if (method === 'CREATE')
3135
3114
  this.addData$(data);
3136
3115
  }), concatMap((data) => {
3137
- if (this.hasDatabase && this.database?.table) {
3116
+ if (this.hasDatabase && this.databaseOptions?.table) {
3138
3117
  const id = options.path?.length ? options.path[options.path.length - 1] : null;
3139
3118
  if (method === 'DELETE' && id)
3140
- return this.dbManagerService.deleteTableRecord(this.database.table, id);
3119
+ return this.dbManagerService.deleteTableRecord(this.databaseOptions.table, id);
3141
3120
  if (method === 'UPDATE' && data)
3142
- return this.dbManagerService.updateTableRecord(this.database.table, data);
3121
+ return this.dbManagerService.updateTableRecord(this.databaseOptions.table, data);
3143
3122
  if (method === 'CREATE' && data)
3144
- return this.dbManagerService.createTableRecord(this.database.table, data);
3123
+ return this.dbManagerService.createTableRecord(this.databaseOptions.table, data);
3145
3124
  }
3146
3125
  return of(data);
3147
3126
  }));
@@ -3157,8 +3136,8 @@ class HTTPManagerStateService extends ComponentStore {
3157
3136
  if (this.wsConnection)
3158
3137
  this.wsCommunication('CREATE', [...options?.path || [], data.id]);
3159
3138
  }), concatMap((data) => {
3160
- if (this.hasDatabase && this.database?.table && data?.id) {
3161
- return this.dbManagerService.createTableRecord(this.database.table, data);
3139
+ if (this.hasDatabase && this.databaseOptions?.table && data?.id) {
3140
+ return this.dbManagerService.createTableRecord(this.databaseOptions.table, data);
3162
3141
  }
3163
3142
  return of(data);
3164
3143
  }));
@@ -3174,8 +3153,8 @@ class HTTPManagerStateService extends ComponentStore {
3174
3153
  if (this.wsConnection)
3175
3154
  this.wsCommunication('UPDATE', [...options?.path || []]);
3176
3155
  }), concatMap((data) => {
3177
- if (this.hasDatabase && this.database?.table && data?.id) {
3178
- return this.dbManagerService.updateTableRecord(this.database.table, data);
3156
+ if (this.hasDatabase && this.databaseOptions?.table && data?.id) {
3157
+ return this.dbManagerService.updateTableRecord(this.databaseOptions.table, data);
3179
3158
  }
3180
3159
  return of(data);
3181
3160
  }));
@@ -3191,8 +3170,8 @@ class HTTPManagerStateService extends ComponentStore {
3191
3170
  if (this.wsConnection)
3192
3171
  this.wsCommunication('DELETE', [...options?.path || []]);
3193
3172
  }), concatMap((data) => {
3194
- if (this.hasDatabase && this.database?.table && data?.id) {
3195
- return this.dbManagerService.deleteTableRecord(this.database.table, data.id);
3173
+ if (this.hasDatabase && this.databaseOptions?.table && data?.id) {
3174
+ return this.dbManagerService.deleteTableRecord(this.databaseOptions.table, data.id);
3196
3175
  }
3197
3176
  return of(data);
3198
3177
  }));
@@ -3242,16 +3221,17 @@ class HTTPManagerStateService extends ComponentStore {
3242
3221
  }
3243
3222
  }));
3244
3223
  })));
3224
+ this.databaseOptions = database;
3245
3225
  this.maxRetries = this.apiOptions.ws?.retry?.times || 3;
3246
3226
  this.retryDelay = (this.apiOptions.ws?.retry?.delay && this.apiOptions.ws.retry.delay * 1000) || 5 * 1000;
3247
3227
  this.wsNextRetry = new BehaviorSubject(this.retryDelay);
3248
3228
  this.wsNextRetry$ = this.wsNextRetry.asObservable();
3249
3229
  this.setApiRequestOptions(apiOptions, dataType, database);
3250
3230
  this.status$ = this.setupConnectionStatus();
3251
- if (this.database && this.database.table) {
3231
+ if (this.databaseOptions && this.databaseOptions.table) {
3252
3232
  this.localStorageManagerService.createStore({
3253
- name: this.database.table,
3254
- data: { ...this.database, ...{ expires: this.utils.expires(this.database.expiresIn) } },
3233
+ name: this.databaseOptions.table,
3234
+ data: { ...this.databaseOptions, ...{ expires: this.utils.expires(this.databaseOptions.expiresIn) } },
3255
3235
  options: SettingOptions.adapt({
3256
3236
  storage: StorageType.GLOBAL,
3257
3237
  encrypted: false,
@@ -3262,16 +3242,32 @@ class HTTPManagerStateService extends ComponentStore {
3262
3242
  setApiRequestOptions(apiOptions, dataType, database) {
3263
3243
  this.apiOptions = ApiRequest.adapt(apiOptions);
3264
3244
  this.dataType = (dataType) ? dataType : DataType.ARRAY;
3265
- this.hasDatabase = (this.database?.table) ? true : false;
3266
- this.database = (this.hasDatabase) ? DatabaseStorage.adapt(database) : undefined;
3267
- if (this.database)
3245
+ // Only update database options if a database parameter is explicitly provided
3246
+ if (database !== undefined) {
3247
+ this.hasDatabase = (database?.table) ? true : false;
3248
+ this.databaseOptions = (this.hasDatabase) ? DatabaseStorage.adapt(database) : undefined;
3249
+ }
3250
+ // Update WebSocket retry settings when options change
3251
+ if (this.apiOptions.ws?.retry) {
3252
+ this.maxRetries = this.apiOptions.ws.retry.times || 3;
3253
+ this.retryDelay = (this.apiOptions.ws.retry.delay && this.apiOptions.ws.retry.delay * 1000) || 5 * 1000;
3254
+ this.wsNextRetry.next(this.retryDelay);
3255
+ }
3256
+ if (this.databaseOptions)
3268
3257
  this.initDBStorage();
3269
3258
  if (this.apiOptions.ws)
3270
3259
  this.initWS(this.apiOptions.ws);
3271
3260
  }
3272
3261
  // WebSocket
3273
3262
  setupConnectionStatus() {
3274
- return this.httpManagerService.connectionStatus$.pipe(distinctUntilChanged(), switchMap(status => {
3263
+ return this.httpManagerService.connectionStatus$.pipe(distinctUntilChanged(), tap(status => {
3264
+ if (status === true) {
3265
+ console.log('🟢 WebSocket connection is open.');
3266
+ }
3267
+ else {
3268
+ console.log('🔴 WebSocket connection is closed.');
3269
+ }
3270
+ }), switchMap(status => {
3275
3271
  if (status === true) {
3276
3272
  this.shouldRetry = true;
3277
3273
  this.wsRetryAttempts.next(0);
@@ -3286,7 +3282,9 @@ class HTTPManagerStateService extends ComponentStore {
3286
3282
  const attempt = i + 1;
3287
3283
  this.wsRetryAttempts.next(attempt);
3288
3284
  countdownEnder$.next();
3285
+ // Attempt connection on each retry
3289
3286
  if (this.apiOptions.ws?.wsServer) {
3287
+ console.log(`🔄 Retry attempt #${attempt}/${this.maxRetries}`);
3290
3288
  this.httpManagerService.connect(this.apiOptions.ws, this.apiOptions.ws.jwtToken || '');
3291
3289
  }
3292
3290
  if (attempt === this.maxRetries) {
@@ -3352,7 +3350,7 @@ class HTTPManagerStateService extends ComponentStore {
3352
3350
  console.warn('Database storage requires an adapter to define the data shape');
3353
3351
  return of(null);
3354
3352
  }
3355
- if (!this.database?.table) {
3353
+ if (!this.databaseOptions?.table) {
3356
3354
  console.warn('Database storage requires a table name');
3357
3355
  return of(null);
3358
3356
  }
@@ -3366,7 +3364,7 @@ class HTTPManagerStateService extends ComponentStore {
3366
3364
  }
3367
3365
  }
3368
3366
  const tableDef = TableSchemaDef.adapt({
3369
- table: this.database?.table,
3367
+ table: this.databaseOptions?.table,
3370
3368
  schema: schema
3371
3369
  });
3372
3370
  return this.dbManagerService.createDatabaseTable(tableDef);
@@ -3378,20 +3376,19 @@ class HTTPManagerStateService extends ComponentStore {
3378
3376
  this.httpManagerService.sendMessageInChannel(wsServer, { method, path, user: this.apiOptions.ws.user });
3379
3377
  }
3380
3378
  }
3381
- wsMessaging(message, channel) {
3379
+ wsMessaging(message, channels) {
3382
3380
  const user = this.user.value || this.user.value;
3383
3381
  const messageInfo = ChannelMessage.adapt({ ...message, fromUser: user });
3384
3382
  if (this.wsConnection && this.apiOptions.ws) {
3385
- const wsServer = (channel) ? channel : this.apiOptions.ws.id;
3386
- if (messageInfo.toUser === 'allChannels') {
3387
- this.httpManagerService.sendBroadcast(messageInfo);
3388
- }
3389
- else if (messageInfo.toUser === 'allInChannel') {
3390
- this.httpManagerService.sendMessageInChannel(wsServer, messageInfo);
3391
- }
3392
- else {
3393
- this.httpManagerService.sendMessageToUser(wsServer, messageInfo);
3394
- }
3383
+ const wsServer = (channels) ? channels : this.apiOptions.ws.id;
3384
+ debugger;
3385
+ // if(messageInfo.toUser === 'allChannels') {
3386
+ // this.httpManagerService.sendBroadcast(messageInfo)
3387
+ // } else if(messageInfo.toUser === 'allInChannel') {
3388
+ // this.httpManagerService.sendMessageInChannel(wsServer, messageInfo)
3389
+ // } else {
3390
+ // this.httpManagerService.sendMessageToUser(wsServer, messageInfo)
3391
+ // }
3395
3392
  }
3396
3393
  }
3397
3394
  // --------------------------------------------------------------------------------------------------
@@ -4100,8 +4097,8 @@ class StateRequestServiceDemo extends HTTPManagerStateService {
4100
4097
  jwtToken,
4101
4098
  user, // user object
4102
4099
  retry: RetryOptions.adapt({
4103
- times: 3,
4104
- delay: 10,
4100
+ times: 10,
4101
+ delay: 5,
4105
4102
  }),
4106
4103
  }
4107
4104
  });
@@ -4110,6 +4107,7 @@ class StateRequestServiceDemo extends HTTPManagerStateService {
4110
4107
  });
4111
4108
  }
4112
4109
  sendMessage(data) {
4110
+ debugger;
4113
4111
  console.log('sendMessage', data);
4114
4112
  this.wsMessaging(data);
4115
4113
  }
@@ -4182,6 +4180,7 @@ class StateDataRequestService extends HTTPManagerStateService {
4182
4180
  this.createRecord(newData, RequestOptions.adapt({ path: ['ai', 'tests'] }));
4183
4181
  }
4184
4182
  sendMessage(data) {
4183
+ debugger;
4185
4184
  console.log('sendMessage', data);
4186
4185
  this.wsMessaging(data);
4187
4186
  }
@@ -4246,11 +4245,11 @@ class WsDataControlComponent {
4246
4245
  this.stateDataRequestService.deleteData(lastRec);
4247
4246
  }
4248
4247
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsDataControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4249
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: WsDataControlComponent, selector: "app-ws-data-control", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user" }, ngImport: i0, template: "@if ((data$ | async); as data) {\n <div style=\"margin: 1rem;\">\n @if ((users$ |async); as users) {\n <div>\n @if (users.length > 0) {\n <h3 style=\"margin: 0;\">Connected Users</h3>\n } @else {\n <h3 style=\"margin: 0;\">No Users</h3>\n }\n <mat-chip-listbox>\n @for (user of users; track user) {\n <mat-chip-option [selected]=\"isUser(user, (user$ | async))\">\n {{ user.content.name }}\n </mat-chip-option>\n }\n </mat-chip-listbox>\n </div>\n }\n <div style=\"margin-top: 1rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n\n <div class=\"box\" style=\"margin-bottom: 1rem;\" *ngIf=\"(userAction$ | async) as userAction\">\n {{ userAction?.content.user.name }} has {{ userAction?.content.method }}\n </div>\n\n <h3 style=\"margin: 0;\">Data Actions</h3>\n <div style=\"display: flex; gap: 1rem; margin-bottom: 1rem;\">\n <button mat-stroked-button (click)=\"onGetData()\">Get Data</button>\n <div style=\"flex:1\"></div>\n <button mat-stroked-button color=\"accent\" (click)=\"onUpdateData(data)\">Update Data</button>\n <button mat-stroked-button color=\"warn\" (click)=\"onRemoveData(data)\">Remove Data</button>\n <button mat-stroked-button color=\"primary\" (click)=\"onAddData()\">Add Data</button>\n </div>\n @if (data.length > 0) {\n <div>\n <table mat-table [dataSource]=\"data\" style=\"border: 1px solid grey;\">\n <ng-container matColumnDef=\"id\">\n <th mat-header-cell *matHeaderCellDef> ID </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.id}} </td>\n </ng-container>\n <ng-container matColumnDef=\"spiffe\">\n <th mat-header-cell *matHeaderCellDef> Spiffe </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.spiffe}} </td>\n </ng-container>\n <ng-container matColumnDef=\"name\">\n <th mat-header-cell *matHeaderCellDef> Name </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.first_name}} {{element.last_name}}</td>\n </ng-container>\n <ng-container matColumnDef=\"email\">\n <th mat-header-cell *matHeaderCellDef> Email </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.email}} </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"['id', 'spiffe', 'name', 'email']\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: ['id', 'spiffe', 'name', 'email'];\"></tr>\n </table>\n <div style=\"border: 1px solid grey; padding: .5rem; border-top: none;\">\n <h3 style=\"margin: 0;\">Total Records {{ data.length }}</h3>\n </div>\n </div>\n } @else {\n <div style=\"margin-top: 1rem; font-style: italic;\">\n No Data Available\n </div>\n }\n </div>\n}\n\n", styles: [".box{padding:.5rem;border:1px solid rgb(174,174,13);background-color:#ececaf}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: i3$1.MatChipOption, selector: "mat-basic-chip-option, [mat-basic-chip-option], mat-chip-option, [mat-chip-option]", inputs: ["selectable", "selected"], outputs: ["selectionChange"] }, { kind: "component", type: i8.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i8.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i8.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i8.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i8.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i8.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i8.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i8.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i8.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i8.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i11.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
4248
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: WsDataControlComponent, selector: "app-ws-data-control", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user" }, ngImport: i0, template: "@if ((data$ | async); as data) {\n <div style=\"margin: 1rem;\">\n @if ((users$ |async); as users) {\n <div>\n @if (users.length > 0) {\n <h3 style=\"margin: 0;\">Connected Users</h3>\n } @else {\n <h3 style=\"margin: 0;\">No Users</h3>\n }\n <mat-chip-set>\n @for (user of users; track user) {\n <mat-chip\n [class.user-chip--primary]=\"isUser(user, (user$ | async))\"\n [style.color]=\"isUser(user, (user$ | async)) ? '#fff' : null\"\n [disableRipple]=\"true\"\n >\n {{ user.content.name }}\n </mat-chip>\n }\n </mat-chip-set>\n </div>\n }\n <div style=\"margin-top: 1rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n\n <div class=\"box\" style=\"margin-bottom: 1rem;\" *ngIf=\"(userAction$ | async) as userAction\">\n {{ userAction?.content.user.name }} has {{ userAction?.content.method }}\n </div>\n\n <h3 style=\"margin: 0;\">Data Actions</h3>\n <div style=\"display: flex; gap: 1rem; margin-bottom: 1rem;\">\n <button mat-stroked-button (click)=\"onGetData()\">Get Data</button>\n <div style=\"flex:1\"></div>\n <button mat-stroked-button color=\"accent\" (click)=\"onUpdateData(data)\">Update Data</button>\n <button mat-stroked-button color=\"warn\" (click)=\"onRemoveData(data)\">Remove Data</button>\n <button mat-stroked-button color=\"primary\" (click)=\"onAddData()\">Add Data</button>\n </div>\n @if (data.length > 0) {\n <div>\n <table mat-table [dataSource]=\"data\" style=\"border: 1px solid grey;\">\n <ng-container matColumnDef=\"id\">\n <th mat-header-cell *matHeaderCellDef> ID </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.id}} </td>\n </ng-container>\n <ng-container matColumnDef=\"spiffe\">\n <th mat-header-cell *matHeaderCellDef> Spiffe </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.spiffe}} </td>\n </ng-container>\n <ng-container matColumnDef=\"name\">\n <th mat-header-cell *matHeaderCellDef> Name </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.first_name}} {{element.last_name}}</td>\n </ng-container>\n <ng-container matColumnDef=\"email\">\n <th mat-header-cell *matHeaderCellDef> Email </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.email}} </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"['id', 'spiffe', 'name', 'email']\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: ['id', 'spiffe', 'name', 'email'];\"></tr>\n </table>\n <div style=\"border: 1px solid grey; padding: .5rem; border-top: none;\">\n <h3 style=\"margin: 0;\">Total Records {{ data.length }}</h3>\n </div>\n </div>\n } @else {\n <div style=\"margin-top: 1rem; font-style: italic;\">\n No Data Available\n </div>\n }\n </div>\n}\n\n", styles: [".user-chip--primary{background-color:var(--mdc-theme-primary, var(--md-sys-color-primary, #3f51b5))!important;color:#fff!important;--mdc-evolution-chip-container-color: var(--mdc-theme-primary, var(--md-sys-color-primary, #3f51b5));--mdc-evolution-chip-label-text-color: #fff}.user-chip--primary :is(.mdc-evolution-chip__text-label,.mdc-evolution-chip__action,.mdc-evolution-chip__cell,.mat-mdc-chip-action-label){color:#fff!important}.user-chip--primary,.user-chip--primary *{color:#fff!important}:host ::ng-deep .user-chip--primary{background-color:var(--mdc-theme-primary, var(--md-sys-color-primary, #3f51b5))!important;color:#fff!important;--mdc-evolution-chip-container-color: var(--mdc-theme-primary, var(--md-sys-color-primary, #3f51b5));--mdc-evolution-chip-label-text-color: #fff}:host ::ng-deep .user-chip--primary .mdc-evolution-chip__text-label,:host ::ng-deep .user-chip--primary .mdc-evolution-chip__action,:host ::ng-deep .user-chip--primary .mdc-evolution-chip__cell,:host ::ng-deep .user-chip--primary .mat-mdc-chip-action-label,:host ::ng-deep .user-chip--primary *{color:#fff!important}.box{padding:.5rem;border:1px solid rgb(174,174,13);background-color:#ececaf}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3$1.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["role", "id", "aria-label", "aria-description", "value", "color", "removable", "highlighted", "disableRipple", "disabled"], outputs: ["removed", "destroyed"], exportAs: ["matChip"] }, { kind: "component", type: i3$1.MatChipSet, selector: "mat-chip-set", inputs: ["disabled", "role", "tabIndex"] }, { kind: "component", type: i8.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i8.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i8.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i8.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i8.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i8.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i8.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i8.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i8.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i8.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i11.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
4250
4249
  }
4251
4250
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsDataControlComponent, decorators: [{
4252
4251
  type: Component,
4253
- args: [{ selector: 'app-ws-data-control', standalone: false, template: "@if ((data$ | async); as data) {\n <div style=\"margin: 1rem;\">\n @if ((users$ |async); as users) {\n <div>\n @if (users.length > 0) {\n <h3 style=\"margin: 0;\">Connected Users</h3>\n } @else {\n <h3 style=\"margin: 0;\">No Users</h3>\n }\n <mat-chip-listbox>\n @for (user of users; track user) {\n <mat-chip-option [selected]=\"isUser(user, (user$ | async))\">\n {{ user.content.name }}\n </mat-chip-option>\n }\n </mat-chip-listbox>\n </div>\n }\n <div style=\"margin-top: 1rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n\n <div class=\"box\" style=\"margin-bottom: 1rem;\" *ngIf=\"(userAction$ | async) as userAction\">\n {{ userAction?.content.user.name }} has {{ userAction?.content.method }}\n </div>\n\n <h3 style=\"margin: 0;\">Data Actions</h3>\n <div style=\"display: flex; gap: 1rem; margin-bottom: 1rem;\">\n <button mat-stroked-button (click)=\"onGetData()\">Get Data</button>\n <div style=\"flex:1\"></div>\n <button mat-stroked-button color=\"accent\" (click)=\"onUpdateData(data)\">Update Data</button>\n <button mat-stroked-button color=\"warn\" (click)=\"onRemoveData(data)\">Remove Data</button>\n <button mat-stroked-button color=\"primary\" (click)=\"onAddData()\">Add Data</button>\n </div>\n @if (data.length > 0) {\n <div>\n <table mat-table [dataSource]=\"data\" style=\"border: 1px solid grey;\">\n <ng-container matColumnDef=\"id\">\n <th mat-header-cell *matHeaderCellDef> ID </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.id}} </td>\n </ng-container>\n <ng-container matColumnDef=\"spiffe\">\n <th mat-header-cell *matHeaderCellDef> Spiffe </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.spiffe}} </td>\n </ng-container>\n <ng-container matColumnDef=\"name\">\n <th mat-header-cell *matHeaderCellDef> Name </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.first_name}} {{element.last_name}}</td>\n </ng-container>\n <ng-container matColumnDef=\"email\">\n <th mat-header-cell *matHeaderCellDef> Email </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.email}} </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"['id', 'spiffe', 'name', 'email']\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: ['id', 'spiffe', 'name', 'email'];\"></tr>\n </table>\n <div style=\"border: 1px solid grey; padding: .5rem; border-top: none;\">\n <h3 style=\"margin: 0;\">Total Records {{ data.length }}</h3>\n </div>\n </div>\n } @else {\n <div style=\"margin-top: 1rem; font-style: italic;\">\n No Data Available\n </div>\n }\n </div>\n}\n\n", styles: [".box{padding:.5rem;border:1px solid rgb(174,174,13);background-color:#ececaf}\n"] }]
4252
+ args: [{ selector: 'app-ws-data-control', standalone: false, template: "@if ((data$ | async); as data) {\n <div style=\"margin: 1rem;\">\n @if ((users$ |async); as users) {\n <div>\n @if (users.length > 0) {\n <h3 style=\"margin: 0;\">Connected Users</h3>\n } @else {\n <h3 style=\"margin: 0;\">No Users</h3>\n }\n <mat-chip-set>\n @for (user of users; track user) {\n <mat-chip\n [class.user-chip--primary]=\"isUser(user, (user$ | async))\"\n [style.color]=\"isUser(user, (user$ | async)) ? '#fff' : null\"\n [disableRipple]=\"true\"\n >\n {{ user.content.name }}\n </mat-chip>\n }\n </mat-chip-set>\n </div>\n }\n <div style=\"margin-top: 1rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n\n <div class=\"box\" style=\"margin-bottom: 1rem;\" *ngIf=\"(userAction$ | async) as userAction\">\n {{ userAction?.content.user.name }} has {{ userAction?.content.method }}\n </div>\n\n <h3 style=\"margin: 0;\">Data Actions</h3>\n <div style=\"display: flex; gap: 1rem; margin-bottom: 1rem;\">\n <button mat-stroked-button (click)=\"onGetData()\">Get Data</button>\n <div style=\"flex:1\"></div>\n <button mat-stroked-button color=\"accent\" (click)=\"onUpdateData(data)\">Update Data</button>\n <button mat-stroked-button color=\"warn\" (click)=\"onRemoveData(data)\">Remove Data</button>\n <button mat-stroked-button color=\"primary\" (click)=\"onAddData()\">Add Data</button>\n </div>\n @if (data.length > 0) {\n <div>\n <table mat-table [dataSource]=\"data\" style=\"border: 1px solid grey;\">\n <ng-container matColumnDef=\"id\">\n <th mat-header-cell *matHeaderCellDef> ID </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.id}} </td>\n </ng-container>\n <ng-container matColumnDef=\"spiffe\">\n <th mat-header-cell *matHeaderCellDef> Spiffe </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.spiffe}} </td>\n </ng-container>\n <ng-container matColumnDef=\"name\">\n <th mat-header-cell *matHeaderCellDef> Name </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.first_name}} {{element.last_name}}</td>\n </ng-container>\n <ng-container matColumnDef=\"email\">\n <th mat-header-cell *matHeaderCellDef> Email </th>\n <td mat-cell *matCellDef=\"let element\"> {{element.email}} </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"['id', 'spiffe', 'name', 'email']\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: ['id', 'spiffe', 'name', 'email'];\"></tr>\n </table>\n <div style=\"border: 1px solid grey; padding: .5rem; border-top: none;\">\n <h3 style=\"margin: 0;\">Total Records {{ data.length }}</h3>\n </div>\n </div>\n } @else {\n <div style=\"margin-top: 1rem; font-style: italic;\">\n No Data Available\n </div>\n }\n </div>\n}\n\n", styles: [".user-chip--primary{background-color:var(--mdc-theme-primary, var(--md-sys-color-primary, #3f51b5))!important;color:#fff!important;--mdc-evolution-chip-container-color: var(--mdc-theme-primary, var(--md-sys-color-primary, #3f51b5));--mdc-evolution-chip-label-text-color: #fff}.user-chip--primary :is(.mdc-evolution-chip__text-label,.mdc-evolution-chip__action,.mdc-evolution-chip__cell,.mat-mdc-chip-action-label){color:#fff!important}.user-chip--primary,.user-chip--primary *{color:#fff!important}:host ::ng-deep .user-chip--primary{background-color:var(--mdc-theme-primary, var(--md-sys-color-primary, #3f51b5))!important;color:#fff!important;--mdc-evolution-chip-container-color: var(--mdc-theme-primary, var(--md-sys-color-primary, #3f51b5));--mdc-evolution-chip-label-text-color: #fff}:host ::ng-deep .user-chip--primary .mdc-evolution-chip__text-label,:host ::ng-deep .user-chip--primary .mdc-evolution-chip__action,:host ::ng-deep .user-chip--primary .mdc-evolution-chip__cell,:host ::ng-deep .user-chip--primary .mat-mdc-chip-action-label,:host ::ng-deep .user-chip--primary *{color:#fff!important}.box{padding:.5rem;border:1px solid rgb(174,174,13);background-color:#ececaf}\n"] }]
4254
4253
  }], propDecorators: { server: [{
4255
4254
  type: Input
4256
4255
  }], wsServer: [{
@@ -4261,49 +4260,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
4261
4260
  type: Input
4262
4261
  }] } });
4263
4262
 
4264
- class WsNotificationsComponent {
4265
- constructor() { }
4266
- ngOnInit() {
4267
- }
4268
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsNotificationsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4269
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: WsNotificationsComponent, selector: "app-ws-notifications", ngImport: i0, template: "<p>\n ws-notifications works!\n</p>\n", styles: [""] }); }
4270
- }
4271
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsNotificationsComponent, decorators: [{
4272
- type: Component,
4273
- args: [{ selector: 'app-ws-notifications', standalone: false, template: "<p>\n ws-notifications works!\n</p>\n" }]
4274
- }], ctorParameters: () => [] });
4275
-
4276
- class WsAiMessagingComponent {
4277
- constructor() { }
4278
- ngOnInit() {
4279
- }
4280
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsAiMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4281
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: WsAiMessagingComponent, selector: "app-ws-ai-messaging", ngImport: i0, template: "<p>\n ws-ai-messaging works!\n</p>\n", styles: [""] }); }
4282
- }
4283
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsAiMessagingComponent, decorators: [{
4284
- type: Component,
4285
- args: [{ selector: 'app-ws-ai-messaging', standalone: false, template: "<p>\n ws-ai-messaging works!\n</p>\n" }]
4286
- }], ctorParameters: () => [] });
4287
-
4288
- class RequestManagerWsDemoComponent {
4263
+ class WsMessagingComponent {
4289
4264
  constructor() {
4290
- this.httpManagerService = inject(HTTPManagerService);
4291
- this.stateRequestServiceDemo = inject(StateRequestServiceDemo);
4292
4265
  this.fb = inject(FormBuilder);
4266
+ this.stateRequestServiceDemo = inject(StateRequestServiceDemo);
4293
4267
  this.user$ = this.stateRequestServiceDemo.user$;
4294
4268
  this.users$ = this.stateRequestServiceDemo.userList$;
4295
- this.attempts$ = this.stateRequestServiceDemo.attempts$;
4296
- this.nextRetry$ = this.stateRequestServiceDemo.nextRetry$;
4297
- this.connectionStatus$ = this.stateRequestServiceDemo.status$;
4269
+ this.data$ = this.stateRequestServiceDemo.data$;
4298
4270
  this.messages = this.fb.group({
4299
- toUser: this.fb.control(null, Validators.required),
4271
+ toUsers: this.fb.control(null, Validators.required),
4300
4272
  content: this.fb.control(null, Validators.required),
4301
4273
  });
4302
- this.data$ = this.stateRequestServiceDemo.data$;
4303
- this.isPending$ = this.stateRequestServiceDemo.isPending$;
4304
- this.fromMe = (user, fromUser) => {
4305
- return user === fromUser;
4306
- };
4307
4274
  this.communicationMessages$ = this.stateRequestServiceDemo.communicationMessages$;
4308
4275
  this.latestCommunicationMessages$ = this.stateRequestServiceDemo.latestCommunicationMessages$;
4309
4276
  this.chat$ = combineLatest([this.user$, this.communicationMessages$])
@@ -4342,27 +4309,33 @@ class RequestManagerWsDemoComponent {
4342
4309
  return { user: mainUser, messages };
4343
4310
  }));
4344
4311
  }
4345
- get toUser() {
4346
- return this.messages.get('toUser');
4312
+ get toUsers() {
4313
+ return this.messages.get('toUsers');
4347
4314
  }
4348
4315
  get content() {
4349
4316
  return this.messages.get('content');
4350
4317
  }
4351
4318
  get isValid() {
4352
- return this.toUser.valid;
4319
+ return this.toUsers.valid;
4353
4320
  }
4354
4321
  ngOnInit() {
4355
4322
  this.stateRequestServiceDemo.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
4323
+ // this.stateRequestServiceDemo.getData()
4356
4324
  }
4357
- onSendMessage() {
4325
+ onSendMessage(user) {
4358
4326
  this.messages.markAllAsTouched();
4359
4327
  if (this.messages.invalid)
4360
4328
  return;
4361
- const message = ChannelMessage.adapt(this.messages.value);
4329
+ const message = ChannelMessage.adapt({
4330
+ message: this.messages.value.content,
4331
+ ...user,
4332
+ users: this.toUsers.value,
4333
+ });
4362
4334
  this.stateRequestServiceDemo.sendMessage(message);
4363
4335
  this.content.reset();
4364
4336
  }
4365
4337
  onSendAlert() {
4338
+ debugger;
4366
4339
  this.messages.markAllAsTouched();
4367
4340
  if (this.messages.invalid)
4368
4341
  return;
@@ -4370,12 +4343,123 @@ class RequestManagerWsDemoComponent {
4370
4343
  this.stateRequestServiceDemo.sendMessage(message);
4371
4344
  this.content.reset();
4372
4345
  }
4346
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4347
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: WsMessagingComponent, selector: "app-ws-messaging", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user" }, ngImport: i0, template: "@if ((user$ | async); as user) {\n\n @if ((data$ | async); as data) {\n <div style=\"margin: 1rem; display: flex; gap: 1rem; flex-direction: column;\">\n @if ((user$ | async); as userInfo) {\n <div>\n @if ((users$ | async); as users) {\n <div>\n <div style=\"display: flex; gap: 1rem\">\n <div style=\"flex:1\" [formGroup]=\"messages\">\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Users</mat-label>\n <mat-select formControlName=\"toUsers\" multiple #userSelect>\n <mat-select-trigger>\n {{ (userSelect.value?.[0] === 'allChannels' ? 'All Users' : userSelect.value?.[0]?.content?.name) || '' }}\n @if ((userSelect.value?.length || 0) > 1) {\n <span class=\"example-additional-selection\">\n (+{{(userSelect.value?.length || 0) - 1}} {{userSelect.value?.length === 2 ? 'other' : 'others'}})\n </span>\n }\n </mat-select-trigger>\n <mat-option value=\"allChannels\">\n All Users\n </mat-option>\n @for (user of users; track user) {\n <mat-option [value]=\"user\">\n {{ user.content.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Send a Message</mat-label>\n <textarea\n matInput placeholder=\"Ex. It makes me feel...\"\n formControlName=\"content\"\n (keydown.enter)=\"onSendMessage(user); $event.preventDefault()\"\n [disabled]=\"!isValid\"\n ></textarea>\n </mat-form-field>\n </div>\n <div style=\"display:flex; gap: .5rem;\">\n <div style=\"flex:1\"></div>\n <button mat-stroked-button (click)=\"onSendAlert()\" color=\"warn\">\n Send Alert\n </button>\n <button mat-stroked-button (click)=\"onSendMessage(user)\">\n Send Message\n </button>\n </div>\n </div>\n </div>\n @if ((chat$ | async); as chat) {\n <div style=\"border: thin gray solid; padding: 1rem; margin-top: 1rem;\">\n <!-- <app-messenger-chat\n [user]=\"chat.user\"\n [messages]=\"chat.messages\"\n ></app-messenger-chat> -->\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n\n}\n", styles: [""], dependencies: [{ kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "component", type: i4.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i4.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
4348
+ }
4349
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, decorators: [{
4350
+ type: Component,
4351
+ args: [{ selector: 'app-ws-messaging', standalone: false, template: "@if ((user$ | async); as user) {\n\n @if ((data$ | async); as data) {\n <div style=\"margin: 1rem; display: flex; gap: 1rem; flex-direction: column;\">\n @if ((user$ | async); as userInfo) {\n <div>\n @if ((users$ | async); as users) {\n <div>\n <div style=\"display: flex; gap: 1rem\">\n <div style=\"flex:1\" [formGroup]=\"messages\">\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Users</mat-label>\n <mat-select formControlName=\"toUsers\" multiple #userSelect>\n <mat-select-trigger>\n {{ (userSelect.value?.[0] === 'allChannels' ? 'All Users' : userSelect.value?.[0]?.content?.name) || '' }}\n @if ((userSelect.value?.length || 0) > 1) {\n <span class=\"example-additional-selection\">\n (+{{(userSelect.value?.length || 0) - 1}} {{userSelect.value?.length === 2 ? 'other' : 'others'}})\n </span>\n }\n </mat-select-trigger>\n <mat-option value=\"allChannels\">\n All Users\n </mat-option>\n @for (user of users; track user) {\n <mat-option [value]=\"user\">\n {{ user.content.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Send a Message</mat-label>\n <textarea\n matInput placeholder=\"Ex. It makes me feel...\"\n formControlName=\"content\"\n (keydown.enter)=\"onSendMessage(user); $event.preventDefault()\"\n [disabled]=\"!isValid\"\n ></textarea>\n </mat-form-field>\n </div>\n <div style=\"display:flex; gap: .5rem;\">\n <div style=\"flex:1\"></div>\n <button mat-stroked-button (click)=\"onSendAlert()\" color=\"warn\">\n Send Alert\n </button>\n <button mat-stroked-button (click)=\"onSendMessage(user)\">\n Send Message\n </button>\n </div>\n </div>\n </div>\n @if ((chat$ | async); as chat) {\n <div style=\"border: thin gray solid; padding: 1rem; margin-top: 1rem;\">\n <!-- <app-messenger-chat\n [user]=\"chat.user\"\n [messages]=\"chat.messages\"\n ></app-messenger-chat> -->\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n\n}\n" }]
4352
+ }], propDecorators: { server: [{
4353
+ type: Input
4354
+ }], wsServer: [{
4355
+ type: Input
4356
+ }], jwtToken: [{
4357
+ type: Input
4358
+ }], user: [{
4359
+ type: Input
4360
+ }] } });
4361
+
4362
+ class WsNotificationsComponent {
4363
+ constructor() { }
4364
+ ngOnInit() {
4365
+ }
4366
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsNotificationsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4367
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: WsNotificationsComponent, selector: "app-ws-notifications", ngImport: i0, template: "<p>\n ws-notifications coming soon!\n</p>\n", styles: [""] }); }
4368
+ }
4369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsNotificationsComponent, decorators: [{
4370
+ type: Component,
4371
+ args: [{ selector: 'app-ws-notifications', standalone: false, template: "<p>\n ws-notifications coming soon!\n</p>\n" }]
4372
+ }], ctorParameters: () => [] });
4373
+
4374
+ class WsAiMessagingComponent {
4375
+ constructor() { }
4376
+ ngOnInit() {
4377
+ }
4378
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsAiMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4379
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: WsAiMessagingComponent, selector: "app-ws-ai-messaging", ngImport: i0, template: "<p>\n ws-ai-messaging coming soon!\n</p>\n", styles: [""] }); }
4380
+ }
4381
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsAiMessagingComponent, decorators: [{
4382
+ type: Component,
4383
+ args: [{ selector: 'app-ws-ai-messaging', standalone: false, template: "<p>\n ws-ai-messaging coming soon!\n</p>\n" }]
4384
+ }], ctorParameters: () => [] });
4385
+
4386
+ class RequestManagerWsDemoComponent {
4387
+ constructor() {
4388
+ this.httpManagerService = inject(HTTPManagerService);
4389
+ this.stateRequestServiceDemo = inject(StateRequestServiceDemo);
4390
+ this.fb = inject(FormBuilder);
4391
+ this.user$ = this.stateRequestServiceDemo.user$;
4392
+ // users$ = this.stateRequestServiceDemo.userList$
4393
+ this.attempts$ = this.stateRequestServiceDemo.attempts$;
4394
+ this.nextRetry$ = this.stateRequestServiceDemo.nextRetry$;
4395
+ this.connectionStatus$ = this.stateRequestServiceDemo.status$;
4396
+ // data$ = this.stateRequestServiceDemo.data$;
4397
+ this.isPending$ = this.stateRequestServiceDemo.isPending$;
4398
+ }
4399
+ // messages = this.fb.group<any>({
4400
+ // toUser: this.fb.control<string|null>(null, Validators.required),
4401
+ // content: this.fb.control<string|null>(null, Validators.required),
4402
+ // })
4403
+ // get toUser() {
4404
+ // return this.messages.get('toUser') as FormControl
4405
+ // }
4406
+ // get content() {
4407
+ // return this.messages.get('content') as FormControl
4408
+ // }
4409
+ // get isValid() {
4410
+ // return this.toUser.valid
4411
+ // }
4412
+ // fromMe = (user: string, fromUser: string) => {
4413
+ // return user === fromUser
4414
+ // }
4415
+ // communicationMessages$ = this.stateRequestServiceDemo.communicationMessages$
4416
+ // latestCommunicationMessages$ = this.stateRequestServiceDemo.latestCommunicationMessages$
4417
+ // chat$: Observable<{ user: any, messages: any[]}|any> = combineLatest([this.user$, this.communicationMessages$])
4418
+ // .pipe(
4419
+ // map(([user, messages]: any) => ({ user, messages })),
4420
+ // map(obj => {
4421
+ // if(!obj.user) return EMPTY
4422
+ // // const mainUser = UserName.adapt({
4423
+ // // id: obj.user.username,
4424
+ // // first: obj.user?.name?.first,
4425
+ // // last: obj.user?.name?.last,
4426
+ // // })
4427
+ // const mainUser = ''
4428
+ // const messages = obj.messages.map((item: any) => {
4429
+ // if(item.toUser === 'allChannels') {
4430
+ // // item.toUser = UserName.adapt({
4431
+ // // id: '',
4432
+ // // first: 'All Users',
4433
+ // // last: '',
4434
+ // // })
4435
+ // }
4436
+ // // return Message.adapt({
4437
+ // // fromUser: {
4438
+ // // id: item.fromUser.username,
4439
+ // // first: item.fromUser?.name?.first,
4440
+ // // last: item.fromUser?.name?.last,
4441
+ // // },
4442
+ // // toUser: {
4443
+ // // id: item.toUser.username,
4444
+ // // first: item.toUser?.name?.first,
4445
+ // // last: item.toUser?.name?.last,
4446
+ // // },
4447
+ // // content: item.content,
4448
+ // // date: item.issued,
4449
+ // // })
4450
+ // })
4451
+ // return { user: mainUser, messages }
4452
+ // })
4453
+ // );
4454
+ ngOnInit() {
4455
+ // this.stateRequestServiceDemo.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
4456
+ }
4373
4457
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RequestManagerWsDemoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4374
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: RequestManagerWsDemoComponent, selector: "app-request-manager-ws-demo", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user" }, ngImport: i0, template: "<div style=\"margin: 2rem;\">\n\n <h2 style=\"display: flex;\">\n <span style=\"flex:1\">HTTP Request State Manager - Websockets</span>\n @if ((connectionStatus$ | async); as connected) {\n <span>\n WS -\n <span style=\"color: green;\">Connected</span>\n </span>\n } @else {\n <span style=\"color: red;\">Disconnected {{ attempts$ | async }} - {{ nextRetry$ |async }}</span>\n }\n </h2>\n\n <div>\n\n @if ((user$ | async); as userInfo) {\n <div>\n <mat-toolbar>\n <div style=\"display: flex; flex:1\">\n <div style=\"flex:1\">{{ userInfo.content.name }}</div>\n <div>({{ userInfo.content.ldap }})</div>\n </div>\n </mat-toolbar>\n </div>\n }\n\n @if ((isPending$ | async)) {\n <div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n }\n\n <mat-tab-group animationDuration=\"0ms\">\n\n <mat-tab label=\"WS - Data Control\">\n <!-- DATA CONTROL -->\n <app-ws-data-control\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-data-control>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Messaging\">\n\n <!-- <app-ws-messaging\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-messaging> -->\n\n </mat-tab>\n\n <mat-tab label=\"WS - Notifications\" [disabled]=\"true\">\n <app-ws-notifications></app-ws-notifications>\n WS - Custom Messaging\n </mat-tab>\n\n <mat-tab label=\"WS - AI Messaging\" [disabled]=\"true\">\n <app-ws-ai-messaging></app-ws-ai-messaging>\n WS - AI Messaging\n </mat-tab>\n\n </mat-tab-group>\n</div>\n\n</div>\n\n", styles: [""], dependencies: [{ kind: "component", type: i1$3.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i1$3.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "component", type: i9.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i3$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: WsDataControlComponent, selector: "app-ws-data-control", inputs: ["server", "wsServer", "jwtToken", "user"] }, { kind: "component", type: WsNotificationsComponent, selector: "app-ws-notifications" }, { kind: "component", type: WsAiMessagingComponent, selector: "app-ws-ai-messaging" }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
4458
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: RequestManagerWsDemoComponent, selector: "app-request-manager-ws-demo", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user" }, ngImport: i0, template: "<div style=\"margin: 2rem;\">\n\n <h2 style=\"display: flex;\">\n <span style=\"flex:1\">HTTP Request State Manager - Websockets</span>\n @if ((connectionStatus$ | async); as connected) {\n <span>\n WS -\n <span style=\"color: green;\">Connected</span>\n </span>\n } @else {\n <span style=\"color: red;\">Disconnected {{ attempts$ | async }} - {{ nextRetry$ |async }}</span>\n }\n </h2>\n\n <div>\n\n @if ((user$ | async); as userInfo) {\n <div>\n <mat-toolbar>\n <div style=\"display: flex; flex:1\">\n <div style=\"flex:1\">{{ userInfo.content.name }}</div>\n <div>({{ userInfo.content.ldap }})</div>\n </div>\n </mat-toolbar>\n </div>\n }\n\n @if ((isPending$ | async)) {\n <div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n }\n\n <mat-tab-group animationDuration=\"0ms\">\n\n <mat-tab label=\"WS - Data Control\">\n <!-- DATA CONTROL -->\n <app-ws-data-control\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-data-control>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Messaging\">\n <!-- MESSAGING -->\n <app-ws-messaging\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-messaging>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Notifications\" [disabled]=\"true\">\n <!-- WS - Custom Messaging -->\n <app-ws-notifications></app-ws-notifications>\n </mat-tab>\n\n <mat-tab label=\"WS - AI Messaging\" [disabled]=\"true\">\n <!-- WS - AI Messaging -->\n <app-ws-ai-messaging></app-ws-ai-messaging>\n </mat-tab>\n\n </mat-tab-group>\n</div>\n\n</div>\n\n", styles: [""], dependencies: [{ kind: "component", type: i1$3.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i1$3.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "component", type: i9.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i3$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: WsDataControlComponent, selector: "app-ws-data-control", inputs: ["server", "wsServer", "jwtToken", "user"] }, { kind: "component", type: WsMessagingComponent, selector: "app-ws-messaging", inputs: ["server", "wsServer", "jwtToken", "user"] }, { kind: "component", type: WsNotificationsComponent, selector: "app-ws-notifications" }, { kind: "component", type: WsAiMessagingComponent, selector: "app-ws-ai-messaging" }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
4375
4459
  }
4376
4460
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RequestManagerWsDemoComponent, decorators: [{
4377
4461
  type: Component,
4378
- args: [{ selector: 'app-request-manager-ws-demo', standalone: false, template: "<div style=\"margin: 2rem;\">\n\n <h2 style=\"display: flex;\">\n <span style=\"flex:1\">HTTP Request State Manager - Websockets</span>\n @if ((connectionStatus$ | async); as connected) {\n <span>\n WS -\n <span style=\"color: green;\">Connected</span>\n </span>\n } @else {\n <span style=\"color: red;\">Disconnected {{ attempts$ | async }} - {{ nextRetry$ |async }}</span>\n }\n </h2>\n\n <div>\n\n @if ((user$ | async); as userInfo) {\n <div>\n <mat-toolbar>\n <div style=\"display: flex; flex:1\">\n <div style=\"flex:1\">{{ userInfo.content.name }}</div>\n <div>({{ userInfo.content.ldap }})</div>\n </div>\n </mat-toolbar>\n </div>\n }\n\n @if ((isPending$ | async)) {\n <div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n }\n\n <mat-tab-group animationDuration=\"0ms\">\n\n <mat-tab label=\"WS - Data Control\">\n <!-- DATA CONTROL -->\n <app-ws-data-control\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-data-control>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Messaging\">\n\n <!-- <app-ws-messaging\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-messaging> -->\n\n </mat-tab>\n\n <mat-tab label=\"WS - Notifications\" [disabled]=\"true\">\n <app-ws-notifications></app-ws-notifications>\n WS - Custom Messaging\n </mat-tab>\n\n <mat-tab label=\"WS - AI Messaging\" [disabled]=\"true\">\n <app-ws-ai-messaging></app-ws-ai-messaging>\n WS - AI Messaging\n </mat-tab>\n\n </mat-tab-group>\n</div>\n\n</div>\n\n" }]
4462
+ args: [{ selector: 'app-request-manager-ws-demo', standalone: false, template: "<div style=\"margin: 2rem;\">\n\n <h2 style=\"display: flex;\">\n <span style=\"flex:1\">HTTP Request State Manager - Websockets</span>\n @if ((connectionStatus$ | async); as connected) {\n <span>\n WS -\n <span style=\"color: green;\">Connected</span>\n </span>\n } @else {\n <span style=\"color: red;\">Disconnected {{ attempts$ | async }} - {{ nextRetry$ |async }}</span>\n }\n </h2>\n\n <div>\n\n @if ((user$ | async); as userInfo) {\n <div>\n <mat-toolbar>\n <div style=\"display: flex; flex:1\">\n <div style=\"flex:1\">{{ userInfo.content.name }}</div>\n <div>({{ userInfo.content.ldap }})</div>\n </div>\n </mat-toolbar>\n </div>\n }\n\n @if ((isPending$ | async)) {\n <div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n }\n\n <mat-tab-group animationDuration=\"0ms\">\n\n <mat-tab label=\"WS - Data Control\">\n <!-- DATA CONTROL -->\n <app-ws-data-control\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-data-control>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Messaging\">\n <!-- MESSAGING -->\n <app-ws-messaging\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-messaging>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Notifications\" [disabled]=\"true\">\n <!-- WS - Custom Messaging -->\n <app-ws-notifications></app-ws-notifications>\n </mat-tab>\n\n <mat-tab label=\"WS - AI Messaging\" [disabled]=\"true\">\n <!-- WS - AI Messaging -->\n <app-ws-ai-messaging></app-ws-ai-messaging>\n </mat-tab>\n\n </mat-tab-group>\n</div>\n\n</div>\n\n" }]
4379
4463
  }], propDecorators: { server: [{
4380
4464
  type: Input
4381
4465
  }], wsServer: [{
@@ -4804,100 +4888,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
4804
4888
  args: [{ selector: 'app-store-state-manager-demo', providers: [SettingsStateService], standalone: false, template: "<div style=\"margin: 2rem;\">\n\n <h2>\n <span>Store State Manager</span>\n <span style=\"margin-left: .5rem;\">\n <mat-icon color=\"accent\">fiber_new</mat-icon>\n </span>\n </h2>\n\n {{ dataState$ | async | json}}\n\n <div style=\"display: flex; gap:.5rem; margin-top: 1rem; margin-bottom: 1rem;\">\n <button mat-stroked-button (click)=\"onUpdateEnum_1()\">Update Start</button>\n <button mat-stroked-button (click)=\"onUpdateEnum_2()\">Update End</button>\n <button mat-stroked-button (click)=\"onGetEnum_1()\">Dump</button>\n </div>\n\n <div>\n <h3 style=\"margin: 0;\">Enum 1</h3>\n {{ dataEnum$ | async | json}}\n </div>\n\n</div>\n" }]
4805
4889
  }] });
4806
4890
 
4807
- class WsMessagingComponent {
4808
- constructor() {
4809
- this.fb = inject(FormBuilder);
4810
- this.stateRequestServiceDemo = inject(StateRequestServiceDemo);
4811
- this.user$ = this.stateRequestServiceDemo.user$;
4812
- this.users$ = this.stateRequestServiceDemo.userList$;
4813
- this.data$ = this.stateRequestServiceDemo.data$;
4814
- this.messages = this.fb.group({
4815
- toUser: this.fb.control(null, Validators.required),
4816
- content: this.fb.control(null, Validators.required),
4817
- });
4818
- this.communicationMessages$ = this.stateRequestServiceDemo.communicationMessages$;
4819
- this.latestCommunicationMessages$ = this.stateRequestServiceDemo.latestCommunicationMessages$;
4820
- this.chat$ = combineLatest([this.user$, this.communicationMessages$])
4821
- .pipe(map$1(([user, messages]) => ({ user, messages })), map$1(obj => {
4822
- if (!obj.user)
4823
- return EMPTY;
4824
- // const mainUser = UserName.adapt({
4825
- // id: obj.user.username,
4826
- // first: obj.user?.name?.first,
4827
- // last: obj.user?.name?.last,
4828
- // })
4829
- const mainUser = '';
4830
- const messages = obj.messages.map((item) => {
4831
- if (item.toUser === 'allChannels') {
4832
- // item.toUser = UserName.adapt({
4833
- // id: '',
4834
- // first: 'All Users',
4835
- // last: '',
4836
- // })
4837
- }
4838
- // return Message.adapt({
4839
- // fromUser: {
4840
- // id: item.fromUser.username,
4841
- // first: item.fromUser?.name?.first,
4842
- // last: item.fromUser?.name?.last,
4843
- // },
4844
- // toUser: {
4845
- // id: item.toUser.username,
4846
- // first: item.toUser?.name?.first,
4847
- // last: item.toUser?.name?.last,
4848
- // },
4849
- // content: item.content,
4850
- // date: item.issued,
4851
- // })
4852
- });
4853
- return { user: mainUser, messages };
4854
- }));
4855
- }
4856
- get toUser() {
4857
- return this.messages.get('toUser');
4858
- }
4859
- get content() {
4860
- return this.messages.get('content');
4861
- }
4862
- get isValid() {
4863
- return this.toUser.valid;
4864
- }
4865
- ngOnInit() {
4866
- this.stateRequestServiceDemo.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
4867
- // this.stateRequestServiceDemo.getData()
4868
- }
4869
- onSendMessage() {
4870
- this.messages.markAllAsTouched();
4871
- if (this.messages.invalid)
4872
- return;
4873
- const message = ChannelMessage.adapt(this.messages.value);
4874
- this.stateRequestServiceDemo.sendMessage(message);
4875
- this.content.reset();
4876
- }
4877
- onSendAlert() {
4878
- this.messages.markAllAsTouched();
4879
- if (this.messages.invalid)
4880
- return;
4881
- const message = ChannelMessage.adapt({ ...this.messages.value, type: CommunicationType.ALERT });
4882
- this.stateRequestServiceDemo.sendMessage(message);
4883
- this.content.reset();
4884
- }
4885
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4886
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: WsMessagingComponent, selector: "app-ws-messaging", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user" }, ngImport: i0, template: "@if ((data$ | async); as data) {\n <div style=\"margin: 1rem; display: flex; gap: 1rem; flex-direction: column;\">\n @if ((user$ | async); as userInfo) {\n <div>\n @if ((users$ | async); as users) {\n <div >\n <div style=\"display: flex; gap: 1rem\">\n <div style=\"flex:1\" [formGroup]=\"messages\">\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Users</mat-label>\n <mat-select formControlName=\"toUser\">\n <mat-option value=\"allChannels\" #selectedUser>\n All Users\n </mat-option>\n @for (user of users; track user) {\n <mat-option [value]=\"user\">\n {{ user.username }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Send a Message</mat-label>\n <textarea\n matInput placeholder=\"Ex. It makes me feel...\"\n formControlName=\"content\"\n (keydown.enter)=\"onSendMessage(); $event.preventDefault()\"\n [disabled]=\"!isValid\"\n ></textarea>\n </mat-form-field>\n </div>\n <div style=\"display:flex; gap: .5rem;\">\n <div style=\"flex:1\"></div>\n <button mat-stroked-button (click)=\"onSendMessage()\" color=\"warn\">\n Send Alert\n </button>\n <button mat-stroked-button (click)=\"onSendAlert()\">\n Send Message\n </button>\n </div>\n </div>\n </div>\n @if ((chat$ | async); as chat) {\n <div style=\"border: thin gray solid; padding: 1rem; margin-top: 1rem;\">\n <!-- <app-messenger-chat\n [user]=\"chat.user\"\n [messages]=\"chat.messages\"\n ></app-messenger-chat> -->\n </div>\n }\n </div>\n }\n </div>\n }\n</div>\n}\n", styles: [""], dependencies: [{ kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i2$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "component", type: i4.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
4887
- }
4888
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, decorators: [{
4889
- type: Component,
4890
- args: [{ selector: 'app-ws-messaging', standalone: false, template: "@if ((data$ | async); as data) {\n <div style=\"margin: 1rem; display: flex; gap: 1rem; flex-direction: column;\">\n @if ((user$ | async); as userInfo) {\n <div>\n @if ((users$ | async); as users) {\n <div >\n <div style=\"display: flex; gap: 1rem\">\n <div style=\"flex:1\" [formGroup]=\"messages\">\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Users</mat-label>\n <mat-select formControlName=\"toUser\">\n <mat-option value=\"allChannels\" #selectedUser>\n All Users\n </mat-option>\n @for (user of users; track user) {\n <mat-option [value]=\"user\">\n {{ user.username }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div style=\"display:flex\">\n <mat-form-field style=\"flex:1\" appearance=\"outline\">\n <mat-label>Send a Message</mat-label>\n <textarea\n matInput placeholder=\"Ex. It makes me feel...\"\n formControlName=\"content\"\n (keydown.enter)=\"onSendMessage(); $event.preventDefault()\"\n [disabled]=\"!isValid\"\n ></textarea>\n </mat-form-field>\n </div>\n <div style=\"display:flex; gap: .5rem;\">\n <div style=\"flex:1\"></div>\n <button mat-stroked-button (click)=\"onSendMessage()\" color=\"warn\">\n Send Alert\n </button>\n <button mat-stroked-button (click)=\"onSendAlert()\">\n Send Message\n </button>\n </div>\n </div>\n </div>\n @if ((chat$ | async); as chat) {\n <div style=\"border: thin gray solid; padding: 1rem; margin-top: 1rem;\">\n <!-- <app-messenger-chat\n [user]=\"chat.user\"\n [messages]=\"chat.messages\"\n ></app-messenger-chat> -->\n </div>\n }\n </div>\n }\n </div>\n }\n</div>\n}\n" }]
4891
- }], propDecorators: { server: [{
4892
- type: Input
4893
- }], wsServer: [{
4894
- type: Input
4895
- }], jwtToken: [{
4896
- type: Input
4897
- }], user: [{
4898
- type: Input
4899
- }] } });
4900
-
4901
4891
  // import { MessengerChatModule } from 'src/app/components/messenger-chat/messenger-chat.module';
4902
4892
  // import { StoreStateManagerModule } from "src/app/beta_components/store-state-manager/store-state-manager.module";
4903
4893
  class HttpRequestManagerModule {
@@ -6029,5 +6019,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
6029
6019
  * Generated bundle index. Do not edit.
6030
6020
  */
6031
6021
 
6032
- export { ApiRequest, AppService, AsymmetricalEncryptionService, CONFIG_SETTINGS_TOKEN, ChannelInfo, ChannelMessage, CommunicationType, ConfigHTTPOptions, ConfigOptions, DataType, DatabaseDataDemoComponent, DatabaseManagerService, DatabaseStorage, DbService, ErrorDisplaySettings, GlobalStoreOptions, HTTPManagerService, HTTPManagerSignalsService, HTTPManagerStateService, HeadersService, HttpRequestManagerModule, HttpRequestServicesDemoComponent, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsManagerService, PathQueryService, Random, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomSignature, RandomStr, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UserMessage, UtilsService, WSOptions, WSUser, WebsocketService, WithCredentialsInterceptor, countdown, delayedRetry, requestPolling, requestStreaming };
6022
+ export { ApiRequest, AppService, AsymmetricalEncryptionService, CONFIG_SETTINGS_TOKEN, ChannelInfo, CommunicationType, ConfigHTTPOptions, ConfigOptions, DataType, DatabaseDataDemoComponent, DatabaseManagerService, DatabaseStorage, DbService, ErrorDisplaySettings, GlobalStoreOptions, HTTPManagerService, HTTPManagerSignalsService, HTTPManagerStateService, HeadersService, HttpRequestManagerModule, HttpRequestServicesDemoComponent, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsManagerService, PathQueryService, Random, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomSignature, RandomStr, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UtilsService, WSOptions, WSUser, WebsocketService, WithCredentialsInterceptor, countdown, delayedRetry, requestPolling, requestStreaming };
6033
6023
  //# sourceMappingURL=http-request-manager.mjs.map