http-request-manager 18.9.4 → 18.9.5

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.
package/README.md CHANGED
@@ -24,10 +24,24 @@ A comprehensive Angular library providing enterprise-grade HTTP request manageme
24
24
  - ✅ **Type-Safe** - Full TypeScript support with generics
25
25
  - ✅ **Offline-First** - Built-in IndexedDB caching
26
26
  - ✅ **Real-Time Ready** - Seamless WebSocket integration
27
- - ✅ **Secure** - Encryption support for sensitive data
27
+ - ✅ **Secure** - AES & RSA encryption support for sensitive data
28
28
  - ✅ **Scalable** - ComponentStore-based architecture
29
29
  - ✅ **Flexible** - Works with Observables or Signals
30
30
 
31
+ ### 🚀 Advanced Features
32
+
33
+ | Feature | Description | Learn More |
34
+ |---------|-------------|------------|
35
+ | **🔐 Enterprise Encryption** | AES symmetric + RSA asymmetric encryption | [`Encryption Utils`](./src/docs/UTILS_README.md#encryption) |
36
+ | **📡 Streaming Support** | NDJSON & Server-Sent Events (SSE) | [`HTTP Manager`](./src/docs/HTTP_MANAGER_README.md#streaming) |
37
+ | **📄 File Downloads** | Progress tracking for large files | [`HTTP Manager`](./src/docs/HTTP_MANAGER_README.md#file-downloads) |
38
+ | **📊 Pagination** | Built-in pagination with page tracking | [`HTTP State Manager`](./src/docs/HTTP_STATE_MANAGER_README.md#pagination) |
39
+ | **🔔 Smart Notifications** | Persistent notifications with DB storage | [`WebSocket Guide`](./src/docs/ADVANCED_WEBSOCKET.md#notifications) |
40
+ | **👥 Presence Tracking** | Real-time user presence by channel | [`WebSocket Guide`](./src/docs/ADVANCED_WEBSOCKET.md#presence) |
41
+ | **🔄 Message Replay** | Automatic message history on reconnect | [`WebSocket Guide`](./src/docs/ADVANCED_WEBSOCKET.md#message-replay) |
42
+ | **🏷️ Channel Architecture** | SYS-, PUB-, MES- channel prefixes | [`WebSocket Guide`](./src/docs/ADVANCED_WEBSOCKET.md#channels) |
43
+ | **🔌 Singleton WebSocket** | Single connection across ALL instances | [`WebSocket Guide`](./src/docs/ADVANCED_WEBSOCKET.md#singleton) |
44
+
31
45
  ## 📋 Table of Contents
32
46
 
33
47
  - [Quick Start](#-quick-start)
@@ -35,6 +49,7 @@ A comprehensive Angular library providing enterprise-grade HTTP request manageme
35
49
  - [Services Overview](#-services-overview)
36
50
  - [Architecture](./src/docs/ARCHITECTURE.md)
37
51
  - [Interceptors](./src/docs/INTERCEPTOR_README.md)
52
+ - [Advanced Features](#-advanced-features)
38
53
  - [Detailed Documentation](#-detailed-documentation)
39
54
  - [Demo Examples](#-demo-examples)
40
55
  - [Migration Guide](#-migration-guide)
@@ -216,14 +231,14 @@ export class AppModule { }
216
231
 
217
232
  | Service | Description | Use Case |
218
233
  |---------|-------------|----------|
219
- | [`HTTPManagerService`](./src/docs/HTTP_MANAGER_README.md) | Observable-based HTTP client | Simple API calls with loading states |
220
- | [`HTTPManagerSignalsService`](./src/docs/HTTP_SINGNALS_MANAGER_README.md) | Signal-based HTTP client | Modern reactive UI with Angular Signals |
221
- | [`HTTPManagerStateService`](./src/docs/HTTP_STATE_MANAGER_README.md) | ComponentStore with HTTP & WebSocket | CRUD operations with auto state sync |
222
- | [`WebSocketService`](./src/docs/WS_MANAGER_README.md) | WebSocket connection management | Real-time messaging and notifications |
223
- | [`LocalStorageManagerService`](./src/docs/LOCAL_STORAGE_README.md) | Secure local storage | User preferences, session data |
224
- | [`DatabaseManagerService`](./src/docs/DATABASE_README.md) | IndexedDB wrapper | Offline-first data access |
225
- | [`StoreStateManagerService`](./STORE_STATE_MANAGER_README.md) | Persistent ComponentStore | Application state persistence |
226
- | [`UtilsService`](./src/docs/UTILS_README.md) | Utility functions | JSON handling, encryption, headers, and conversions |
234
+ | [`HTTPManagerService`](./src/docs/HTTP_MANAGER_README.md) | Observable-based HTTP client with retry, polling, streaming | Simple API calls with loading states |
235
+ | [`HTTPManagerSignalsService`](./src/docs/HTTP_SINGNALS_MANAGER_README.md) | Signal-based HTTP client for modern reactive UI | Modern Angular with Signals |
236
+ | [`HTTPManagerStateService`](./src/docs/HTTP_STATE_MANAGER_README.md) | ComponentStore + HTTP + WebSocket + IndexedDB | CRUD with auto state sync & real-time |
237
+ | [`WebSocketManagerService`](./src/docs/WS_MANAGER_README.md) | Singleton WebSocket connection manager | Real-time messaging & notifications |
238
+ | [`LocalStorageManagerService`](./src/docs/LOCAL_STORAGE_README.md) | Secure local/session storage with encryption | User preferences, session data |
239
+ | [`DatabaseManagerService`](./src/docs/DATABASE_README.md) | IndexedDB wrapper via Dexie.js | Offline-first data access |
240
+ | [`StoreStateManagerService`](./src/docs/COMPLETE_API_REFERENCE.md#storestatemanagerservice) | Persistent ComponentStore with localStorage sync | Application state persistence |
241
+ | [`UtilsService`](./src/docs/UTILS_README.md) | Utilities: encryption, headers, merging, path/query | Helper functions |
227
242
 
228
243
  ### Common Use Cases
229
244
 
@@ -231,12 +246,16 @@ export class AppModule { }
231
246
  |----------|---------------|--------------|
232
247
  | Simple API calls | `HTTPManagerService` | Observables, retry, polling |
233
248
  | Modern reactive UI | `HTTPManagerSignalsService` | Angular Signals |
234
- | CRUD operations | `HTTPManagerStateService` | Auto state updates |
235
- | Real-time chat | `HTTPManagerStateService` + WebSocket | Messaging channels |
236
- | Persistent notifications | `HTTPManagerStateService` + WebSocket | Database-backed |
249
+ | CRUD operations | `HTTPManagerStateService` | Auto state updates, pagination |
250
+ | Real-time chat | `HTTPManagerStateService` + WebSocket | PUB- messaging channels |
251
+ | Persistent notifications | `HTTPManagerStateService` + WebSocket | MES- channels with DB storage |
252
+ | State synchronization | `HTTPManagerStateService` + WebSocket | SYS- private channels |
237
253
  | User preferences | `LocalStorageManagerService` | Encryption, expiration |
238
- | Offline-first | `DatabaseManagerService` | IndexedDB |
239
- | Large local datasets | `DatabaseManagerService` | Querying, indexing |
254
+ | Offline-first | `DatabaseManagerService` | IndexedDB caching, querying |
255
+ | Large local datasets | `DatabaseManagerService` | Bulk operations, indexing |
256
+ | Secure data storage | `LocalStorageManagerService` | AES encryption |
257
+ | File transfers | `HTTPManagerService` | Download progress tracking |
258
+ | Live data streams | `HTTPManagerService` | NDJSON, SSE streaming |
240
259
 
241
260
  ## 🏗️ Architecture
242
261
 
@@ -298,9 +317,12 @@ The library provides several HTTP interceptors that are automatically configured
298
317
 
299
318
  ### Available Interceptors
300
319
 
301
- - **RequestErrorInterceptor** - Handles 400/500 errors with toast notifications
302
- - **WithCredentialsInterceptor** - Adds `withCredentials: true` to requests
303
- - **RequestHeadersInterceptor** - Adds common headers (Content-Type, Accept-Language, Current-Date)
320
+ | Interceptor | Purpose | Automatically Applied |
321
+ |-------------|---------|----------------------|
322
+ | **RequestErrorInterceptor** | Handles 400/500 errors with toast notifications | ✅ Yes |
323
+ | **RequestHeadersInterceptor** | Adds Content-Type, Accept-Language, Current-Date | ✅ Yes |
324
+ | **CredentialsInterceptor** | Adds `withCredentials: true` for CORS | ✅ Yes |
325
+ | **ProxyDebuggerInterceptor** | Debug logging for development | ⚙️ Configurable |
304
326
 
305
327
  ### Manual Configuration
306
328
 
@@ -313,6 +335,22 @@ providers: [
313
335
  ]
314
336
  ```
315
337
 
338
+ ### Customization
339
+
340
+ Error handling can be customized with `ErrorSettings`:
341
+
342
+ ```typescript
343
+ import { ErrorSettings } from 'http-request-manager';
344
+
345
+ const customSettings: ErrorSettings = {
346
+ displayError: true,
347
+ displayWarning: true,
348
+ customHandler: (error) => {
349
+ // Custom error handling logic
350
+ }
351
+ };
352
+ ```
353
+
316
354
  ## 📚 Detailed Documentation
317
355
 
318
356
  For in-depth documentation on each service and component, refer to the following detailed guides:
@@ -327,7 +365,7 @@ For in-depth documentation on each service and component, refer to the following
327
365
  | 📖 [WebSocket Manager Service](./src/docs/WS_MANAGER_README.md) | WebSocket connection management with channel-based messaging and notifications |
328
366
  | 📖 [Local Storage Manager Service](./src/docs/LOCAL_STORAGE_README.md) | Secure local/session storage with encryption and expiration |
329
367
  | 📖 [Database Manager Service](./src/docs/DATABASE_README.md) | IndexedDB wrapper via Dexie.js with Observable API for offline-first apps |
330
- | 📖 [Store State Manager Service](./STORE_STATE_MANAGER_README.md) | Persistent ComponentStore synchronized with local/session storage |
368
+ | 📖 [Store State Manager Service](./src/docs/COMPLETE_API_REFERENCE.md#storestatemanagerservice) | Persistent ComponentStore synchronized with local/session storage |
331
369
  | 📖 [Utils Service](./src/docs/UTILS_README.md) | Utility functions for JSON handling, encryption, headers, and validation |
332
370
 
333
371
  ### Core Components
@@ -344,18 +382,57 @@ For in-depth documentation on each service and component, refer to the following
344
382
 
345
383
  ## 🎮 Demo Examples
346
384
 
347
- Comprehensive demo components showcase all library features:
385
+ Comprehensive demo components showcase all library features in action:
348
386
 
349
387
  ### Available Demos
350
388
 
351
389
  Located in [`src/lib/http-request-services-demo/`](src/lib/http-request-services-demo/):
352
390
 
353
- - **HttpRequestServicesDemoComponent** - Main demo component
354
- - **RequestManagerDemoComponent** - HTTP service demonstrations
355
- - **RequestManagerStateDemoComponent** - State management examples
356
- - **RequestManagerWsDemoComponent** - WebSocket functionality
357
- - **LocalStorageDemoComponent** - Local storage examples
358
- - **DatabaseDataDemoComponent** - IndexedDB operations
391
+ | Demo Component | Features Demonstrated |
392
+ |----------------|----------------------|
393
+ | **HttpRequestServicesDemoComponent** | Main demo hub with service selection |
394
+ | **RequestManagerDemoComponent** | HTTP CRUD, file downloads, streaming, polling, retry |
395
+ | **RequestManagerStateDemoComponent** | State management, pagination, WebSocket sync, IndexedDB caching |
396
+ | **RequestManagerWsDemoComponent** | Real-time chat, AI messaging, notifications, presence tracking |
397
+ | **LocalStorageDemoComponent** | Encrypted storage, expiration, reactive signals |
398
+ | **LocalStorageSignalsDemoComponent** | Signal-based localStorage API |
399
+ | **DatabaseDataDemoComponent** | IndexedDB CRUD, querying, bulk operations |
400
+ | **RequestSignalsManagerDemoComponent** | Signal-based HTTP with file downloads |
401
+ | **StoreStateManagerDemoComponent** | Persistent state with localStorage sync |
402
+
403
+ ### Demo Features
404
+
405
+ **HTTP Service Demos:**
406
+ - ✅ Basic CRUD operations
407
+ - ✅ File download with progress tracking
408
+ - ✅ Streaming responses (NDJSON, SSE)
409
+ - ✅ Polling with countdown timers
410
+ - ✅ Retry logic with custom delays
411
+ - ✅ Error handling with toast notifications
412
+
413
+ **State Management Demos:**
414
+ - ✅ ComponentStore integration
415
+ - ✅ Automatic state updates
416
+ - ✅ Pagination controls
417
+ - ✅ WebSocket real-time sync
418
+ - ✅ IndexedDB caching
419
+ - ✅ Database clear/refresh
420
+
421
+ **WebSocket Demos:**
422
+ - ✅ Channel-based messaging (PUB- channels)
423
+ - ✅ Private state sync (SYS- channels)
424
+ - ✅ Persistent notifications (MES- channels)
425
+ - ✅ User presence tracking
426
+ - ✅ Message history & replay
427
+ - ✅ AI chat integration
428
+ - ✅ Multi-room support
429
+
430
+ **Storage Demos:**
431
+ - ✅ Encrypted localStorage
432
+ - ✅ SessionStorage usage
433
+ - ✅ Expiration management
434
+ - ✅ Signal-based API
435
+ - ✅ Reactive updates
359
436
 
360
437
  ### Usage
361
438
 
@@ -369,6 +446,15 @@ Located in [`src/lib/http-request-services-demo/`](src/lib/http-request-services
369
446
  </app-http-request-services-demo>
370
447
  ```
371
448
 
449
+ ### Sample Models
450
+
451
+ Demo includes production-ready sample models:
452
+ - `User` - User data structures
453
+ - `ClientInfo` - Client details
454
+ - `SessionData` - Session management
455
+ - `AIMessage` - AI chat messages
456
+ - `Notification` - Notification structures
457
+
372
458
  ## 📖 Migration Guide
373
459
 
374
460
  ### From HttpClient to HTTPManagerService
@@ -434,18 +520,44 @@ isLoading$ = this.usersStore.isPending$;
434
520
 
435
521
  ### Core Models
436
522
 
437
- - **ApiRequest** - HTTP request configuration
438
- - **RetryOptions** - Retry behavior settings
439
- - **DataType** - Data structure type (ARRAY, OBJECT)
440
- - **DatabaseStorage** - IndexedDB configuration
441
- - **SettingOptions** - Storage settings
442
- - **WSOptions** - WebSocket configuration
523
+ All models follow the `<Name>Interface` + `<Name>Model` pattern with static `adapt()` methods.
524
+
525
+ | Model | Description | Documentation |
526
+ |-------|-------------|---------------|
527
+ | **ApiRequest** | HTTP request configuration | [`Models Guide`](./src/docs/MODELS_README.md#apirequest) |
528
+ | **RetryOptions** | Retry behavior settings | [`Models Guide`](./src/docs/MODELS_README.md#retryoptions) |
529
+ | **DataType** | Data structure type (ARRAY, OBJECT) | [`Models Guide`](./src/docs/MODELS_README.md#datatype) |
530
+ | **DatabaseStorage** | IndexedDB configuration | [`Models Guide`](./src/docs/MODELS_README.md#databasestorage) |
531
+ | **SettingOptions** | Storage settings | [`Models Guide`](./src/docs/MODELS_README.md#settingoptions) |
532
+ | **WSOptions** | WebSocket configuration | [`Models Guide`](./src/docs/MODELS_README.md#wsoptions) |
533
+ | **ConfigOptions** | Global library configuration | [`Models Guide`](./src/docs/MODELS_README.md#configoptions) |
534
+ | **StateStorageOptions** | Persistent state configuration | [`Models Guide`](./src/docs/MODELS_README.md#statestorageoptions) |
535
+ | **TableSchemaDef** | Database table schema | [`Models Guide`](./src/docs/MODELS_README.md#tableschemadef) |
536
+ | **ChannelMessage** | WebSocket message structure | [`Models Guide`](./src/docs/MODELS_README.md#channelmessage) |
537
+ | **WSUser** | WebSocket user info | [`Models Guide`](./src/docs/MODELS_README.md#wsuser) |
443
538
 
444
539
  ### Enums
445
540
 
446
- - **StreamType** - Streaming response types
447
- - **StorageType** - Storage scope (GLOBAL, SESSION)
448
- - **CommunicationType** - WebSocket message types
541
+ | Enum | Values | Description |
542
+ |------|--------|-------------|
543
+ | **DataType** | `ARRAY`, `OBJECT` | Response data structure |
544
+ | **StreamType** | `NDJSON`, `SSE` | Streaming response types |
545
+ | **StorageType** | `GLOBAL`, `SESSION` | Storage scope |
546
+ | **CommunicationType** | `subscribe`, `unsubscribe`, `message`, `notification`, etc. | WebSocket message types |
547
+ | **ChannelType** | `SYS`, `PUB`, `MES` | Channel prefixes |
548
+ | **ToastColors** | `SUCCESS`, `WARN`, `ERROR`, `INFO` | Toast notification colors |
549
+
550
+ ### Configuration Tokens
551
+
552
+ | Token | Type | Purpose |
553
+ |-------|------|---------|
554
+ | **CONFIG_SETTINGS_TOKEN** | `ConfigOptions` | Global library configuration |
555
+ | **APP_ID** | `string` | Application ID for encryption |
556
+
557
+ ### Complete API Documentation
558
+
559
+ For comprehensive API reference with all methods, parameters, and examples:
560
+ 📋 **[Complete API Reference](./src/docs/COMPLETE_API_REFERENCE.md)**
449
561
 
450
562
  ## 🤝 Contributing
451
563
 
@@ -6933,7 +6933,7 @@ class RequestManagerDemoComponent {
6933
6933
  this.requestParams.GET = reqParams.apiOptions;
6934
6934
  this.GET$ = EMPTY; //Cancels Previous
6935
6935
  this.GET_error$.next('');
6936
- this.GET$ = this.httpManagerService.getRequest(reqParams.apiOptions, reqParams.path)
6936
+ this.GET$ = this.httpManagerService.getRequest({ ...reqParams.apiOptions }, reqParams.path)
6937
6937
  .pipe(
6938
6938
  // tap((data) => console.log("API GET response", data)),
6939
6939
  catchError(error => {