http-request-manager 18.10.0 → 18.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "http-request-manager",
3
- "version": "18.10.0",
3
+ "version": "18.10.1",
4
4
  "homepage": "https://wavecoders.ca",
5
5
  "author": "Mike Bonifacio <wavecoders@gmail.com> (http://wavecoders@gmail.com/)",
6
6
  "description": "This is an Angular Module containing Components/Services using Material",
@@ -12,7 +12,6 @@ import { TranslateService } from '@ngx-translate/core';
12
12
  import * as _angular_forms from '@angular/forms';
13
13
  import { FormArray, FormBuilder, FormControl } from '@angular/forms';
14
14
  import { DataSource } from '@angular/cdk/collections';
15
- import * as http_request_manager from 'http-request-manager';
16
15
  import * as i4 from '@angular/common';
17
16
  import * as i7 from '@angular/material/button';
18
17
  import * as i20 from '@angular/material/tabs';
@@ -225,17 +224,6 @@ declare class ApiRequest implements ApiRequestInterface {
225
224
  static adapt(item?: any): ApiRequest;
226
225
  }
227
226
 
228
- interface ChannelInfoInterface {
229
- name: string;
230
- canSubscribe: boolean;
231
- }
232
- declare class ChannelInfo implements ChannelInfoInterface {
233
- name: string;
234
- canSubscribe: boolean;
235
- constructor(name?: string, canSubscribe?: boolean);
236
- static adapt(item?: any): ChannelInfo;
237
- }
238
-
239
227
  interface WSUserInterface {
240
228
  id: string;
241
229
  ldap?: string;
@@ -252,10 +240,96 @@ declare class WSUser implements WSUserInterface {
252
240
  static adapt(item?: any): WSUser;
253
241
  }
254
242
 
255
- declare enum CommunicationType {
256
- MESSAGE = 0,
257
- ALERT = 1,
258
- OTHER = 2
243
+ interface StateMessageInterface {
244
+ sessionId: {
245
+ id: string;
246
+ ldap?: string;
247
+ name?: string;
248
+ email?: string;
249
+ };
250
+ content: any;
251
+ }
252
+ declare class StateMessage implements StateMessageInterface {
253
+ sessionId: {
254
+ id: string;
255
+ ldap?: string;
256
+ name?: string;
257
+ email?: string;
258
+ };
259
+ content: any;
260
+ constructor(sessionId?: {
261
+ id: string;
262
+ ldap?: string;
263
+ name?: string;
264
+ email?: string;
265
+ }, content?: any);
266
+ static adapt(item?: any): StateMessage;
267
+ }
268
+
269
+ interface PublicMessageInterface {
270
+ sessionId: {
271
+ id: string;
272
+ ldap?: string;
273
+ name?: string;
274
+ email?: string;
275
+ };
276
+ content: {
277
+ message: string;
278
+ [key: string]: any;
279
+ };
280
+ }
281
+ declare class PublicMessage implements PublicMessageInterface {
282
+ sessionId: {
283
+ id: string;
284
+ ldap?: string;
285
+ name?: string;
286
+ email?: string;
287
+ };
288
+ content: {
289
+ message: string;
290
+ [key: string]: any;
291
+ };
292
+ constructor(sessionId?: {
293
+ id: string;
294
+ ldap?: string;
295
+ name?: string;
296
+ email?: string;
297
+ }, content?: {
298
+ message: string;
299
+ [key: string]: any;
300
+ });
301
+ static adapt(item?: any): PublicMessage;
302
+ }
303
+
304
+ interface NotificationMessageInterface {
305
+ sessionId: {
306
+ id: string;
307
+ ldap?: string;
308
+ name?: string;
309
+ email?: string;
310
+ color?: string;
311
+ };
312
+ message: string;
313
+ [key: string]: any;
314
+ }
315
+ declare class NotificationMessage implements NotificationMessageInterface {
316
+ sessionId: {
317
+ id: string;
318
+ ldap?: string;
319
+ name?: string;
320
+ email?: string;
321
+ color?: string;
322
+ };
323
+ message: string;
324
+ [key: string]: any;
325
+ constructor(sessionId?: {
326
+ id: string;
327
+ ldap?: string;
328
+ name?: string;
329
+ email?: string;
330
+ color?: string;
331
+ }, message?: string, additionalProperties?: any);
332
+ static adapt(item?: any): NotificationMessage;
259
333
  }
260
334
 
261
335
  interface DatabaseStorageInterface {
@@ -366,6 +440,53 @@ declare class ChannelMessage implements ChannelMessageInterface {
366
440
  static adapt(item?: any): ChannelMessage;
367
441
  }
368
442
 
443
+ /**
444
+ * LoggerService for http-request-manager library
445
+ *
446
+ * Automatically enables debug logging in development mode,
447
+ * disables it in production mode.
448
+ *
449
+ * Usage:
450
+ * ```typescript
451
+ * constructor(private logger: LoggerService) {}
452
+ *
453
+ * this.logger.debug('WebSocket', 'Connected successfully');
454
+ * this.logger.info('HTTP', 'Request completed', { status: 200 });
455
+ * this.logger.warn('State', 'Cache miss for key', { key: 'user' });
456
+ * this.logger.error('Database', 'Connection failed', error);
457
+ * ```
458
+ */
459
+ declare class LoggerService {
460
+ private debugMode;
461
+ constructor();
462
+ /**
463
+ * Debug level logging - only shown in development mode
464
+ * Use for: Detailed diagnostic information, state changes, connection events
465
+ */
466
+ debug(context: string, message: string, data?: any): void;
467
+ /**
468
+ * Info level logging - only shown in development mode
469
+ * Use for: Important operational messages, successful operations
470
+ */
471
+ info(context: string, message: string, data?: any): void;
472
+ /**
473
+ * Warning level logging - always shown
474
+ * Use for: Potential issues, deprecated usage, recoverable errors
475
+ */
476
+ warn(context: string, message: string, data?: any): void;
477
+ /**
478
+ * Error level logging - always shown
479
+ * Use for: Actual errors, failures, exceptions
480
+ */
481
+ error(context: string, message: string, data?: any): void;
482
+ /**
483
+ * Check if debug mode is enabled (development mode)
484
+ */
485
+ isDebugEnabled(): boolean;
486
+ static ɵfac: i0.ɵɵFactoryDeclaration<LoggerService, never>;
487
+ static ɵprov: i0.ɵɵInjectableDeclaration<LoggerService>;
488
+ }
489
+
369
490
  /**
370
491
  * Channel type enum for different communication purposes
371
492
  * - STATE: Private channels for state synchronization (SYS- prefix)
@@ -397,6 +518,7 @@ declare class HTTPManagerStateService<T extends {
397
518
  dbManagerService: DatabaseManagerService;
398
519
  localStorageManagerService: LocalStorageManagerService;
399
520
  utils: UtilsService;
521
+ logger: LoggerService;
400
522
  error$: Observable<boolean>;
401
523
  isPending$: Observable<boolean>;
402
524
  private page;
@@ -587,6 +709,7 @@ declare class HTTPManagerStateService<T extends {
587
709
  }
588
710
 
589
711
  declare class WebsocketService {
712
+ private logger;
590
713
  private socket;
591
714
  private messages;
592
715
  messages$: Observable<any>;
@@ -630,25 +753,12 @@ declare class WebsocketService {
630
753
  * Get all notification channels (in-memory)
631
754
  */
632
755
  getNotificationChannels(): void;
633
- /**
634
- * Get today's notification channels from database
635
- * Returns unique channels that have notifications posted today
636
- */
637
756
  getTodaysNotificationChannels(): void;
638
- /**
639
- * Subscribe to a notification channel with optional date filters
640
- */
641
757
  subscribeToNotificationChannel(channel: string, options?: {
642
758
  startEpoch?: number;
643
759
  endEpoch?: number;
644
760
  }, user?: any): void;
645
- /**
646
- * Unsubscribe from a notification channel
647
- */
648
761
  unsubscribeFromNotificationChannel(channel: string): void;
649
- /**
650
- * Send a notification to a channel
651
- */
652
762
  sendNotification(channel: string, content: any): void;
653
763
  static ɵfac: i0.ɵɵFactoryDeclaration<WebsocketService, never>;
654
764
  static ɵprov: i0.ɵɵInjectableDeclaration<WebsocketService>;
@@ -827,6 +937,62 @@ declare class WebSocketManagerService {
827
937
  static ɵprov: i0.ɵɵInjectableDeclaration<WebSocketManagerService>;
828
938
  }
829
939
 
940
+ /**
941
+ * WebSocketMessageService - Unified service for sending WebSocket messages
942
+ *
943
+ * Provides type-safe methods for sending messages with automatic prefix management.
944
+ * Supports three message types: State (SYS-), Public (PUB-), and Notification (MES-).
945
+ *
946
+ * Features:
947
+ * - Type-safe message models
948
+ * - Automatic prefix management
949
+ * - Runtime validation
950
+ * - Boolean return values for success/failure
951
+ * - Silent failure with console errors
952
+ */
953
+ declare class WebSocketMessageService {
954
+ private wsManagerService;
955
+ private logger;
956
+ /**
957
+ * Send state message (SYS- prefix)
958
+ * Used for CRUD operations and state synchronization
959
+ *
960
+ * @param path - Path array (e.g., ['ai', 'tests'])
961
+ * @param payload - StateMessage with sessionId and content
962
+ * @returns true if sent successfully, false otherwise
963
+ */
964
+ sendStateMessage(path: (string | number)[], payload: StateMessage): boolean;
965
+ /**
966
+ * Send public message (PUB- prefix)
967
+ * Used for chat, broadcast, general messaging
968
+ *
969
+ * @param channel - Channel name (without prefix)
970
+ * @param payload - PublicMessage with sessionId and content.message
971
+ * @returns true if sent successfully, false otherwise
972
+ */
973
+ sendPublicMessage(channel: string, payload: PublicMessage): boolean;
974
+ /**
975
+ * Send notification (MES- prefix)
976
+ * Used for persistent notifications with history
977
+ *
978
+ * @param channel - Channel name (without prefix)
979
+ * @param payload - NotificationMessage with sessionId and message
980
+ * @returns true if sent successfully, false otherwise
981
+ */
982
+ sendNotification(channel: string, payload: NotificationMessage): boolean;
983
+ /**
984
+ * Send to custom channel (no prefix)
985
+ * User provides full channel name
986
+ *
987
+ * @param channel - Full channel name
988
+ * @param payload - Any message payload
989
+ * @returns true if sent successfully, false otherwise
990
+ */
991
+ sendToCustomChannel(channel: string, payload: any): boolean;
992
+ static ɵfac: i0.ɵɵFactoryDeclaration<WebSocketMessageService, never>;
993
+ static ɵprov: i0.ɵɵInjectableDeclaration<WebSocketMessageService>;
994
+ }
995
+
830
996
  declare class RequestService extends WebsocketService {
831
997
  private http;
832
998
  private pathQueryService;
@@ -2431,7 +2597,7 @@ declare class MessageServiceDemo {
2431
2597
  communicationMessages$: rxjs.Observable<any[]>;
2432
2598
  latestCommunicationMessages$: rxjs.Observable<any>;
2433
2599
  connectionStatus$: rxjs.Observable<boolean>;
2434
- user$: rxjs.Observable<http_request_manager.WSUser | null>;
2600
+ user$: rxjs.Observable<WSUser | null>;
2435
2601
  data$: rxjs.Observable<any>;
2436
2602
  /**
2437
2603
  * Helper to ensure channel has PUB- prefix
@@ -2631,7 +2797,7 @@ declare class WsDataControlComponent implements OnInit {
2631
2797
  user: any;
2632
2798
  path: (string | number)[];
2633
2799
  stateDataRequestService: StateDataRequestService;
2634
- user$: rxjs.Observable<http_request_manager.WSUser | null>;
2800
+ user$: rxjs.Observable<WSUser | null>;
2635
2801
  users$: rxjs.Observable<any[]>;
2636
2802
  userAction$: rxjs.Observable<any>;
2637
2803
  data$: rxjs.Observable<any>;
@@ -2645,6 +2811,143 @@ declare class WsDataControlComponent implements OnInit {
2645
2811
  static ɵcmp: i0.ɵɵComponentDeclaration<WsDataControlComponent, "app-ws-data-control", never, { "server": { "alias": "server"; "required": false; }; "wsServer": { "alias": "wsServer"; "required": false; }; "jwtToken": { "alias": "jwtToken"; "required": false; }; "user": { "alias": "user"; "required": false; }; "path": { "alias": "path"; "required": false; }; }, {}, never, never, false, never>;
2646
2812
  }
2647
2813
 
2814
+ interface SlideInterface {
2815
+ title: string;
2816
+ message: string;
2817
+ image?: string;
2818
+ icon?: string;
2819
+ }
2820
+ declare class Slide implements SlideInterface {
2821
+ title: string;
2822
+ message: string;
2823
+ image?: string | undefined;
2824
+ icon?: string | undefined;
2825
+ constructor(title?: string, message?: string, image?: string | undefined, icon?: string | undefined);
2826
+ static adapt(item?: any): Slide;
2827
+ }
2828
+
2829
+ interface ActionInterface {
2830
+ label: string;
2831
+ action: 'close' | 'navigate' | 'callback' | 'custom';
2832
+ target?: string;
2833
+ callback?: string;
2834
+ primary?: boolean;
2835
+ }
2836
+ declare class Action implements ActionInterface {
2837
+ label: string;
2838
+ action: 'close' | 'navigate' | 'callback' | 'custom';
2839
+ target?: string | undefined;
2840
+ callback?: string | undefined;
2841
+ primary?: boolean | undefined;
2842
+ constructor(label?: string, action?: 'close' | 'navigate' | 'callback' | 'custom', target?: string | undefined, callback?: string | undefined, primary?: boolean | undefined);
2843
+ static adapt(item?: any): Action;
2844
+ }
2845
+
2846
+ type DisplayType = 'snackbar' | 'dialog' | 'carousel' | 'banner' | 'inline';
2847
+ interface DisplayConfigInterface {
2848
+ type: DisplayType;
2849
+ supportsMarkdown?: boolean;
2850
+ stackable?: boolean;
2851
+ queueBehavior?: 'replace' | 'queue' | 'ignore';
2852
+ autoDismiss?: number;
2853
+ width?: string;
2854
+ height?: string;
2855
+ }
2856
+ declare class DisplayConfig implements DisplayConfigInterface {
2857
+ type: DisplayType;
2858
+ supportsMarkdown?: boolean | undefined;
2859
+ stackable?: boolean | undefined;
2860
+ queueBehavior?: ("replace" | "queue" | "ignore") | undefined;
2861
+ autoDismiss?: number | undefined;
2862
+ width?: string | undefined;
2863
+ height?: string | undefined;
2864
+ constructor(type?: DisplayType, supportsMarkdown?: boolean | undefined, stackable?: boolean | undefined, queueBehavior?: ("replace" | "queue" | "ignore") | undefined, autoDismiss?: number | undefined, width?: string | undefined, height?: string | undefined);
2865
+ static adapt(item?: any): DisplayConfig;
2866
+ }
2867
+
2868
+ interface MessageContentInterface {
2869
+ displayConfig?: DisplayConfig;
2870
+ title?: string;
2871
+ message: string;
2872
+ slides?: Slide[];
2873
+ image?: string;
2874
+ images?: string[];
2875
+ actions?: Action[];
2876
+ messageType?: string;
2877
+ icon?: string;
2878
+ data?: any;
2879
+ }
2880
+ declare class MessageContent implements MessageContentInterface {
2881
+ displayConfig?: DisplayConfig | undefined;
2882
+ title?: string | undefined;
2883
+ message: string;
2884
+ slides?: Slide[] | undefined;
2885
+ image?: string | undefined;
2886
+ images?: string[] | undefined;
2887
+ actions?: Action[] | undefined;
2888
+ messageType?: string | undefined;
2889
+ icon?: string | undefined;
2890
+ data?: any;
2891
+ constructor(displayConfig?: DisplayConfig | undefined, title?: string | undefined, message?: string, slides?: Slide[] | undefined, image?: string | undefined, images?: string[] | undefined, actions?: Action[] | undefined, messageType?: string | undefined, icon?: string | undefined, data?: any);
2892
+ static adapt(item?: any): MessageContent;
2893
+ }
2894
+ interface CommunicationMessageInterface {
2895
+ type: string;
2896
+ messageId?: number;
2897
+ channel?: string;
2898
+ sessionId?: {
2899
+ id: string;
2900
+ };
2901
+ timestamp?: string;
2902
+ content: MessageContent;
2903
+ }
2904
+ declare class CommunicationMessage implements CommunicationMessageInterface {
2905
+ type: string;
2906
+ messageId?: number | undefined;
2907
+ channel?: string | undefined;
2908
+ sessionId?: {
2909
+ id: string;
2910
+ } | undefined;
2911
+ timestamp?: string | undefined;
2912
+ content: MessageContent;
2913
+ constructor(type?: string, messageId?: number | undefined, channel?: string | undefined, sessionId?: {
2914
+ id: string;
2915
+ } | undefined, timestamp?: string | undefined, content?: MessageContent);
2916
+ static adapt(item?: any): CommunicationMessage;
2917
+ }
2918
+
2919
+ interface IDisplayStrategy {
2920
+ name: string;
2921
+ canHandle(message: CommunicationMessage): boolean;
2922
+ display(message: CommunicationMessage, config: DisplayConfig): void;
2923
+ }
2924
+
2925
+ interface DisplayRuleInterface {
2926
+ id: string;
2927
+ name?: string;
2928
+ match: (message: CommunicationMessage) => boolean;
2929
+ display: DisplayConfig;
2930
+ }
2931
+ declare class DisplayRule implements DisplayRuleInterface {
2932
+ id: string;
2933
+ name?: string | undefined;
2934
+ match: (message: CommunicationMessage) => boolean;
2935
+ display: DisplayConfig;
2936
+ constructor(id?: string, name?: string | undefined, match?: (message: CommunicationMessage) => boolean, display?: DisplayConfig);
2937
+ static adapt(item?: any): DisplayRule;
2938
+ }
2939
+
2940
+ declare class MessageDisplayRouterService {
2941
+ private snackbarStrategy;
2942
+ private strategies;
2943
+ private rules;
2944
+ display(message: CommunicationMessage): void;
2945
+ registerStrategies(strategies: IDisplayStrategy[]): void;
2946
+ setRules(rules: DisplayRule[]): void;
2947
+ static ɵfac: i0.ɵɵFactoryDeclaration<MessageDisplayRouterService, never>;
2948
+ static ɵprov: i0.ɵɵInjectableDeclaration<MessageDisplayRouterService>;
2949
+ }
2950
+
2648
2951
  declare class WsMessagingComponent implements OnInit, OnDestroy {
2649
2952
  server: string;
2650
2953
  wsServer: string;
@@ -2655,7 +2958,7 @@ declare class WsMessagingComponent implements OnInit, OnDestroy {
2655
2958
  fb: FormBuilder;
2656
2959
  messageService: MessageServiceDemo;
2657
2960
  stateService: StateServiceDemo;
2658
- toastService: ToastMessageDisplayService;
2961
+ messageDisplayService: MessageDisplayRouterService;
2659
2962
  channels$: Observable<string[]>;
2660
2963
  subscribedChannels$: Observable<string[]>;
2661
2964
  user$: Observable<WSUser | null>;
@@ -2887,5 +3190,5 @@ declare class HttpRequestManagerModule {
2887
3190
  static ɵinj: i0.ɵɵInjectorDeclaration<HttpRequestManagerModule>;
2888
3191
  }
2889
3192
 
2890
- export { ApiRequest, AppService, AsymmetricalEncryptionService, CONFIG_SETTINGS_TOKEN, ChannelInfo, ChannelType, CommunicationType, ConfigHTTPOptions, ConfigOptions, DataType, DatabaseDataDemoComponent, DatabaseManagerService, DatabaseStorage, DbService, ErrorDisplaySettings, GlobalStoreOptions, HTTPManagerService, HTTPManagerSignalsService, HTTPManagerStateService, HeadersService, HttpRequestManagerModule, HttpRequestServicesDemoComponent, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsManagerService, PathQueryService, Random, RandomHSLColor, RandomHexColor, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomPaletteColor, RandomSignature, RandomStr, RandomVisibleColor, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, StreamType, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UserData, UtilsService, WSOptions, WSUser, WebSocketManagerService, WebsocketService, WithCredentialsInterceptor, countdown, createChannelName, delayedRetry, requestPolling, requestStreaming, streamAI, streamAuto, streamEvents, streamJSON, streamNDJSON };
2891
- export type { APIStateManagerData, ApiRequestInterface, ChannelInfoInterface, ConfigHTTPOptionsInterface, ConfigOptionsInterface, DatabaseStorageInterface, ErrorDisplaySettingsInterface, GlobalStoreOptionsInterface, LocalStorageOptionsInterface, ParsingResult, RequestOptionsInterface, RetryOptionsInterface, SettingOptionsInterface, State, StateStorageOptionsInterface, StateStoreManagerData, StorageDataInterface, StorageOptionInterface, StreamConfig, StreamEvent, TableRecord, TableSchemaDefInterface, UserDataInterface, WSOptionsInterface, WSUserInterface };
3193
+ export { ApiRequest, AppService, AsymmetricalEncryptionService, CONFIG_SETTINGS_TOKEN, ChannelType, ConfigHTTPOptions, ConfigOptions, DataType, DatabaseDataDemoComponent, DatabaseManagerService, DatabaseStorage, DbService, ErrorDisplaySettings, GlobalStoreOptions, HTTPManagerService, HTTPManagerSignalsService, HTTPManagerStateService, HeadersService, HttpRequestManagerModule, HttpRequestServicesDemoComponent, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsManagerService, LoggerService, NotificationMessage, PathQueryService, PublicMessage, Random, RandomHSLColor, RandomHexColor, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomPaletteColor, RandomSignature, RandomStr, RandomVisibleColor, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, StateMessage, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, StreamType, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UserData, UtilsService, WSOptions, WebSocketMessageService, WithCredentialsInterceptor, countdown, createChannelName, delayedRetry, requestPolling, requestStreaming, streamAI, streamAuto, streamEvents, streamJSON, streamNDJSON };
3194
+ export type { APIStateManagerData, ApiRequestInterface, ConfigHTTPOptionsInterface, ConfigOptionsInterface, DatabaseStorageInterface, ErrorDisplaySettingsInterface, GlobalStoreOptionsInterface, LocalStorageOptionsInterface, NotificationMessageInterface, ParsingResult, PublicMessageInterface, RequestOptionsInterface, RetryOptionsInterface, SettingOptionsInterface, State, StateMessageInterface, StateStorageOptionsInterface, StateStoreManagerData, StorageDataInterface, StorageOptionInterface, StreamConfig, StreamEvent, TableRecord, TableSchemaDefInterface, UserDataInterface, WSOptionsInterface };
Binary file