http-request-manager 22.0.3 → 22.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,15 +25,51 @@ This README is the main documentation hub for the library. Detailed service guid
25
25
  | **🗄️ Database Queries** | MySQL-syntax SQL queries on IndexedDB — the recommended way to query data | [`DexieSqlService`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/SQL_DIXIE_README.md) | Uses the same service |
26
26
  | **⚡ Utility Functions** | JSON handling, encryption, headers, validation, logging | [`UtilsService`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/UTILS_README.md), [`Encryption`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/ENCRYPTION_README.md), [`Logger`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/LOGGER_README.md) | Uses the same utility layer |
27
27
  | **🔧 Utility Services** | Headers, path/query, merging, base request classes | [`Utility Services`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/UTILS_SERVICES_README.md) | Internal and helper services |
28
+ | **🖥️ Node.js WS Server** | Companion [`ws-request-manager`](https://www.npmjs.com/package/ws-request-manager) Node.js package — pluggable auth, IP rate limiting, channels, heartbeat, message replay | [`WebSocket Server Guide`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/WS_SERVER_README.md) | Same protocol on both sides |
28
29
 
29
30
  ### Key Benefits
30
31
 
31
32
  - ✅ **Type-Safe** - Full TypeScript support with generics
32
33
  - ✅ **Offline-First** - Built-in IndexedDB caching
33
- - ✅ **Real-Time Ready** - Seamless WebSocket integration
34
+ - ✅ **Real-Time Ready** - Seamless WebSocket integration with companion Node.js server
34
35
  - ✅ **Secure** - AES & RSA encryption support for sensitive data
35
36
  - ✅ **Scalable** - ComponentStore-based architecture
36
37
  - ✅ **Flexible** - Works with Observables or Signals
38
+ - ✅ **Pluggable Auth on Server** - You control auth (API key, JWT, cookie, BFF session) and rate limits on the Node.js side
39
+
40
+ ### 🖥️ Server-Side Companion — `ws-request-manager`
41
+
42
+ The frontend `http-request-manager` speaks the full WebSocket protocol implemented by the Node.js package [`ws-request-manager`](https://www.npmjs.com/package/ws-request-manager). The server package is **deliberately thin** — it does **not** implement any auth strategy. Instead, you provide a `WsAuthFn` (an async function) and the library calls it on every WebSocket upgrade.
43
+
44
+ **Quick start:**
45
+
46
+ ```javascript
47
+ // server.js
48
+ const express = require('express');
49
+ const http = require('http');
50
+ const { register, registerServer, destroy, noAuth } = require('ws-request-manager');
51
+
52
+ const app = express();
53
+ app.use(express.json());
54
+
55
+ async function start() {
56
+ await register(app, noAuth); // mounts /ws/channels, /ws/connections, /ws/broadcast
57
+ const server = http.createServer(app);
58
+ await registerServer(server, noAuth); // attaches WS upgrade handler at /ws
59
+ server.listen(3000);
60
+ process.on('SIGTERM', async () => { await destroy(); server.close(); });
61
+ }
62
+ start();
63
+ ```
64
+
65
+ Swap `noAuth` for a custom `WsAuthFn` to gate access. Common patterns:
66
+
67
+ - `createApiKeyAuth(process.env.STATIC_API_KEY)` — static API key
68
+ - `createJwtAuth(process.env.JWT_SECRET_KEY)` — JWT (re-use your HTTP API's secret)
69
+ - `createCookieAuth(validateSession)` — BFF session cookie
70
+ - `createRateLimitedAuth(authFn, { maxFailures: 10, blockDurationMs: 300_000 })` — IP-based rate limiting wrapper
71
+
72
+ 👉 **Full guide:** [`WS_SERVER_README.md`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/WS_SERVER_README.md) — covers configuration (env vars), auth patterns, rate limiting, full message protocol reference, HTTP REST routes, and the end-to-end BFF setup.
37
73
 
38
74
  Note on clearing persisted data:
39
75
 
@@ -72,6 +108,7 @@ See the full SQL syntax reference: [`DexieSqlService Guide`](https://github.com/
72
108
  | **🏷️ Channel Architecture** | SYS-, PUB-, MES- channel prefixes | [`WebSocket Guide`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/ADVANCED_WEBSOCKET.md#channels) |
73
109
  | **🔌 Singleton WebSocket** | Single connection across ALL instances | [`WebSocket Guide`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/ADVANCED_WEBSOCKET.md#singleton) |
74
110
  | **✨ Unified Message Service** | Type-safe WebSocket messaging with auto prefixes | [`WebSocket Message Service`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/WEBSOCKET_MESSAGE_SERVICE.md) |
111
+ | **🖥️ Node.js WS Server** | Companion `ws-request-manager` package for Node.js — pluggable auth, rate limiting, channels, heartbeat | [`WebSocket Server Guide`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/WS_SERVER_README.md) ([npm](https://www.npmjs.com/package/ws-request-manager)) |
75
112
  | **🚀 Batch Requests** | Execute multiple HTTP requests with sequential/parallel modes | [`Batch Request Guide`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/BATCH_REQUEST_README.md) |
76
113
  | **📝 Message Tracking** | Guaranteed delivery with gap detection | [`Message Tracker`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/MESSAGE_TRACKER_README.md) |
77
114
  | **🔍 Debug Logging** | Context-aware logging with dev/prod modes | [`Logger Service`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/LOGGER_README.md) |
@@ -348,7 +385,22 @@ export class AppModule { }
348
385
  | [`LocalStorageSignalsManagerService`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/LOCAL_STORAGE_SIGNALS_README.md) | Signal-based local/session storage | Reactive persisted UI state |
349
386
  | [`StoreStateManagerSignalsService`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/STORE_STATE_SIGNALS_README.md) | Signal-based persistent state service | App state persistence with computed derivations |
350
387
  | [`WebSocketSignalsManagerService`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/WEBSOCKET_SIGNALS_README.md) | Signal-based WebSocket manager | Signal-driven real-time dashboards and messaging |
351
- | [`MessageTrackerSignalsService`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/MESSAGE_TRACKER_SIGNALS_README.md) | Signal-based channel/message tracking | Presence, counters, last-message views |
388
+ | [`MessageTrackerSignalsService`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/MESSAGE_TRACKER_SIGNALS_README.md) | Signal-based channel/message tracking (deprecated — use `ChannelPresenceSignalsService`) | Presence, counters, last-message views |
389
+ | [`ChannelPresenceSignalsService`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/CHANNEL_PRESENCE_SIGNALS_README.md) | Signal-based channel presence and metadata tracking | ✅ Recommended replacement for `MessageTrackerSignalsService` |
390
+
391
+ ### Message Display System
392
+
393
+ | Service | Description | Use Case |
394
+ |---------|-------------|----------|
395
+ | [`MessageDisplayRouterService`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/MESSAGE_DISPLAY_README.md) | Rule-based message routing to display strategies | Routing messages to snackbar, dialog, or custom displays |
396
+ | [`SnackbarStrategy`](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/MESSAGE_DISPLAY_README.md) | Default toast notification display strategy | Showing toast messages via `ToastMessageDisplayService` |
397
+
398
+ ### Base Request Services (Internal)
399
+
400
+ | Service | Description | Use Case |
401
+ |---------|-------------|----------|
402
+ | `RequestService` | Base HTTP request class with `BehaviorSubject` state | Internal — extended by `HTTPManagerService` |
403
+ | `RequestSignalsService` | Base HTTP request class with Angular Signals | Internal — extended by `HTTPManagerSignalsService` |
352
404
 
353
405
  ### Shared Utilities
354
406
 
@@ -397,7 +449,21 @@ All detailed service guides live in `src/docs/`. Use this README as the entry po
397
449
  | Overview | [Signal Services Overview](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/SIGNAL_SERVICES_README.md) |
398
450
  | HTTP | [HTTP Manager Signals](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/HTTP_SIGNALS_MANAGER_README.md) |
399
451
  | State | [Store State Signals](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/STORE_STATE_SIGNALS_README.md) |
400
- | Real-Time | [WebSocket Signals](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/WEBSOCKET_SIGNALS_README.md) and [Message Tracker Signals](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/MESSAGE_TRACKER_SIGNALS_README.md) |
452
+ | Real-Time | [WebSocket Signals](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/WEBSOCKET_SIGNALS_README.md) and [Channel Presence Signals](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/CHANNEL_PRESENCE_SIGNALS_README.md) |
453
+ | Message Tracking | [Message Tracker Signals](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/MESSAGE_TRACKER_SIGNALS_README.md) (deprecated — use Channel Presence Signals) |
454
+
455
+ ### Cross-Cutting
456
+
457
+ | Category | Documentation |
458
+ |----------|---------------|
459
+ | Message Display | [Message Display System](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/MESSAGE_DISPLAY_README.md) |
460
+ | Interceptors | [HTTP Interceptors](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/INTERCEPTOR_README.md) |
461
+ | Models | [Models Reference](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/MODELS_README.md) |
462
+ | Batch Requests | [Batch Request Guide](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/BATCH_REQUEST_README.md) |
463
+ | File Uploads | [Upload Request Guide](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/UPLOAD_REQUEST_README.md) |
464
+ | Encryption | [Encryption Utils](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/ENCRYPTION_README.md) |
465
+ | Logger | [Logger Service](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/LOGGER_README.md) |
466
+ | SQL Queries | [DexieSqlService Guide](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/SQL_DIXIE_README.md) |
401
467
  | Persistence | [Local Storage Signals](https://github.com/micheleboni/npm-angular/tree/main/projects/http-request-manager/src/docs/LOCAL_STORAGE_SIGNALS_README.md) |
402
468
 
403
469
  ## 🏗️ Architecture
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "http-request-manager",
3
- "version": "22.0.3",
3
+ "version": "22.0.6",
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",
Binary file