http-request-manager 18.7.21 → 18.7.24

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.
Files changed (198) hide show
  1. package/fesm2022/http-request-manager.mjs +7633 -0
  2. package/fesm2022/http-request-manager.mjs.map +1 -0
  3. package/http-request-manager-18.7.24.tgz +0 -0
  4. package/package.json +16 -5
  5. package/types/http-request-manager.d.ts +2277 -0
  6. package/ARCHITECTURE.md +0 -483
  7. package/DATABASE_README.md +0 -1176
  8. package/HTTP_MANAGER_README.md +0 -579
  9. package/HTTP_SINGNALS_MANAGER_README.md +0 -654
  10. package/HTTP_STATE_MANAGER_README.md +0 -948
  11. package/INTERCEPTOR_README.md +0 -549
  12. package/LOCAL_STORAGE_README.md +0 -1056
  13. package/STORE_STATE_MANAGER_README.md +0 -1322
  14. package/UTILS_README.md +0 -1186
  15. package/WS_MANAGER_README.md +0 -613
  16. package/ng-package.json +0 -8
  17. package/src/lib/http-request-manager.module.ts +0 -132
  18. package/src/lib/http-request-services-demo/database-data-demo/database-data-demo.component.html +0 -65
  19. package/src/lib/http-request-services-demo/database-data-demo/database-data-demo.component.scss +0 -0
  20. package/src/lib/http-request-services-demo/database-data-demo/database-data-demo.component.ts +0 -224
  21. package/src/lib/http-request-services-demo/http-request-services-demo.component.html +0 -114
  22. package/src/lib/http-request-services-demo/http-request-services-demo.component.scss +0 -6
  23. package/src/lib/http-request-services-demo/http-request-services-demo.component.ts +0 -52
  24. package/src/lib/http-request-services-demo/local-storage-demo/local-storage-demo.component.html +0 -195
  25. package/src/lib/http-request-services-demo/local-storage-demo/local-storage-demo.component.scss +0 -17
  26. package/src/lib/http-request-services-demo/local-storage-demo/local-storage-demo.component.ts +0 -206
  27. package/src/lib/http-request-services-demo/local-storage-signals-demo/local-storage-signals-demo.component.html +0 -200
  28. package/src/lib/http-request-services-demo/local-storage-signals-demo/local-storage-signals-demo.component.scss +0 -17
  29. package/src/lib/http-request-services-demo/local-storage-signals-demo/local-storage-signals-demo.component.ts +0 -212
  30. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/download-file/download-file.component.html +0 -53
  31. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/download-file/download-file.component.scss +0 -60
  32. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/download-file/download-file.component.ts +0 -72
  33. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/file-download.module.ts +0 -28
  34. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/file-downloader.component.html +0 -10
  35. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/file-downloader.component.scss +0 -29
  36. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/file-downloader.component.ts +0 -100
  37. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/models/download-labels-model.ts +0 -22
  38. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/spinner/spinner.component.html +0 -8
  39. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/spinner/spinner.component.scss +0 -19
  40. package/src/lib/http-request-services-demo/request-manager-demo/file-downloader/spinner/spinner.component.ts +0 -26
  41. package/src/lib/http-request-services-demo/request-manager-demo/models/app-session.model.ts +0 -30
  42. package/src/lib/http-request-services-demo/request-manager-demo/models/app.model.ts +0 -19
  43. package/src/lib/http-request-services-demo/request-manager-demo/models/get-sample.model.ts +0 -25
  44. package/src/lib/http-request-services-demo/request-manager-demo/models/sample-ai-prompt.ts +0 -19
  45. package/src/lib/http-request-services-demo/request-manager-demo/models/sample-client-details.ts +0 -24
  46. package/src/lib/http-request-services-demo/request-manager-demo/models/sample-client-info.ts +0 -30
  47. package/src/lib/http-request-services-demo/request-manager-demo/models/sample-client.model.ts +0 -49
  48. package/src/lib/http-request-services-demo/request-manager-demo/models/sample-mapper-client-info.ts +0 -33
  49. package/src/lib/http-request-services-demo/request-manager-demo/request-manager-demo.component.html +0 -392
  50. package/src/lib/http-request-services-demo/request-manager-demo/request-manager-demo.component.scss +0 -24
  51. package/src/lib/http-request-services-demo/request-manager-demo/request-manager-demo.component.ts +0 -461
  52. package/src/lib/http-request-services-demo/request-manager-state-demo/request-manager-state-demo.component.html +0 -393
  53. package/src/lib/http-request-services-demo/request-manager-state-demo/request-manager-state-demo.component.scss +0 -24
  54. package/src/lib/http-request-services-demo/request-manager-state-demo/request-manager-state-demo.component.ts +0 -421
  55. package/src/lib/http-request-services-demo/request-manager-state-demo/services/state-manager-demo.service.ts +0 -87
  56. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/services/state-data-request.service.ts +0 -120
  57. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-ai-messaging/ws-ai-messaging.component.css +0 -0
  58. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-ai-messaging/ws-ai-messaging.component.html +0 -3
  59. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-ai-messaging/ws-ai-messaging.component.ts +0 -16
  60. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-chats/ws-chats.component.css +0 -0
  61. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-chats/ws-chats.component.html +0 -3
  62. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-chats/ws-chats.component.ts +0 -16
  63. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-data-control/ws-data-control.component.css +0 -31
  64. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-data-control/ws-data-control.component.html +0 -72
  65. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-data-control/ws-data-control.component.scss +0 -41
  66. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-data-control/ws-data-control.component.spec.ts +0 -205
  67. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-data-control/ws-data-control.component.ts +0 -77
  68. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-messaging/ws-messaging.component.css +0 -11
  69. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-messaging/ws-messaging.component.html +0 -96
  70. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-messaging/ws-messaging.component.spec.ts +0 -31
  71. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-messaging/ws-messaging.component.ts +0 -229
  72. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-notifications/ws-notifications.component.css +0 -30
  73. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-notifications/ws-notifications.component.html +0 -172
  74. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-notifications/ws-notifications.component.spec.ts +0 -31
  75. package/src/lib/http-request-services-demo/request-manager-ws-demo/components/ws-notifications/ws-notifications.component.ts +0 -239
  76. package/src/lib/http-request-services-demo/request-manager-ws-demo/models/oidc-client.model.ts +0 -31
  77. package/src/lib/http-request-services-demo/request-manager-ws-demo/models/user-data.model.ts +0 -32
  78. package/src/lib/http-request-services-demo/request-manager-ws-demo/request-manager-ws-demo.component.css +0 -0
  79. package/src/lib/http-request-services-demo/request-manager-ws-demo/request-manager-ws-demo.component.html +0 -84
  80. package/src/lib/http-request-services-demo/request-manager-ws-demo/request-manager-ws-demo.component.ts +0 -41
  81. package/src/lib/http-request-services-demo/request-manager-ws-demo/services/index.ts +0 -3
  82. package/src/lib/http-request-services-demo/request-manager-ws-demo/services/message-service-demo.service.ts +0 -83
  83. package/src/lib/http-request-services-demo/request-manager-ws-demo/services/notification-service-demo.service.ts +0 -147
  84. package/src/lib/http-request-services-demo/request-manager-ws-demo/services/state-service-demo.service.ts +0 -158
  85. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/download-file/download-file.component.html +0 -53
  86. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/download-file/download-file.component.scss +0 -60
  87. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/download-file/download-file.component.ts +0 -72
  88. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/file-download.module.ts +0 -28
  89. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/file-downloader.component.html +0 -10
  90. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/file-downloader.component.scss +0 -29
  91. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/file-downloader.component.ts +0 -100
  92. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/models/download-labels-model.ts +0 -22
  93. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/spinner/spinner.component.html +0 -8
  94. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/spinner/spinner.component.scss +0 -19
  95. package/src/lib/http-request-services-demo/request-signals-manager-demo/file-downloader/spinner/spinner.component.ts +0 -26
  96. package/src/lib/http-request-services-demo/request-signals-manager-demo/models/app-session.model.ts +0 -30
  97. package/src/lib/http-request-services-demo/request-signals-manager-demo/models/app.model.ts +0 -19
  98. package/src/lib/http-request-services-demo/request-signals-manager-demo/models/get-sample.model.ts +0 -25
  99. package/src/lib/http-request-services-demo/request-signals-manager-demo/models/sample-ai-prompt.ts +0 -19
  100. package/src/lib/http-request-services-demo/request-signals-manager-demo/models/sample-client-details.ts +0 -24
  101. package/src/lib/http-request-services-demo/request-signals-manager-demo/models/sample-client-info.ts +0 -30
  102. package/src/lib/http-request-services-demo/request-signals-manager-demo/models/sample-client.model.ts +0 -49
  103. package/src/lib/http-request-services-demo/request-signals-manager-demo/models/sample-mapper-client-info.ts +0 -33
  104. package/src/lib/http-request-services-demo/request-signals-manager-demo/request-signals-manager-demo.component.html +0 -380
  105. package/src/lib/http-request-services-demo/request-signals-manager-demo/request-signals-manager-demo.component.scss +0 -24
  106. package/src/lib/http-request-services-demo/request-signals-manager-demo/request-signals-manager-demo.component.ts +0 -410
  107. package/src/lib/http-request-services-demo/store-state-manager-demo/models/settings.model.ts +0 -28
  108. package/src/lib/http-request-services-demo/store-state-manager-demo/services/settings-state.service.ts +0 -48
  109. package/src/lib/http-request-services-demo/store-state-manager-demo/store-state-manager-demo.component.css +0 -0
  110. package/src/lib/http-request-services-demo/store-state-manager-demo/store-state-manager-demo.component.html +0 -23
  111. package/src/lib/http-request-services-demo/store-state-manager-demo/store-state-manager-demo.component.ts +0 -36
  112. package/src/lib/index.ts +0 -3
  113. package/src/lib/interceptors/credentials.interceptor.ts +0 -16
  114. package/src/lib/interceptors/index.ts +0 -6
  115. package/src/lib/interceptors/models/error-settings.model.ts +0 -22
  116. package/src/lib/interceptors/models/index.ts +0 -2
  117. package/src/lib/interceptors/proxy-debugger.interceptor.ts +0 -46
  118. package/src/lib/interceptors/request-error.interceptor.ts +0 -65
  119. package/src/lib/interceptors/request-header.interceptor.ts +0 -53
  120. package/src/lib/models/config-http-options.model.ts +0 -42
  121. package/src/lib/models/config-local-storage-options.model.ts +0 -27
  122. package/src/lib/models/config-options.model.ts +0 -27
  123. package/src/lib/models/config-token.model.ts +0 -9
  124. package/src/lib/models/data-type.enum.ts +0 -5
  125. package/src/lib/models/database-storage.model.ts +0 -24
  126. package/src/lib/models/index.ts +0 -12
  127. package/src/lib/models/retry-options.model.ts +0 -22
  128. package/src/lib/services/database-manager-service/database.manager.service.ts +0 -262
  129. package/src/lib/services/database-manager-service/db.storage.service.ts +0 -207
  130. package/src/lib/services/database-manager-service/index.ts +0 -4
  131. package/src/lib/services/database-manager-service/models/index.ts +0 -2
  132. package/src/lib/services/database-manager-service/models/table-schema.ts +0 -33
  133. package/src/lib/services/index.ts +0 -12
  134. package/src/lib/services/local-storage-manager-service/index.ts +0 -4
  135. package/src/lib/services/local-storage-manager-service/local-storage-manager.service.spec.ts +0 -71
  136. package/src/lib/services/local-storage-manager-service/local-storage-manager.service.ts +0 -426
  137. package/src/lib/services/local-storage-manager-service/local-storage-signals-manager.service.spec.ts +0 -67
  138. package/src/lib/services/local-storage-manager-service/local-storage-signals-manager.service.ts +0 -345
  139. package/src/lib/services/local-storage-manager-service/models/global-store-options.model.ts +0 -30
  140. package/src/lib/services/local-storage-manager-service/models/index.ts +0 -6
  141. package/src/lib/services/local-storage-manager-service/models/setting-options.model.ts +0 -35
  142. package/src/lib/services/local-storage-manager-service/models/storage-data.model.ts +0 -24
  143. package/src/lib/services/local-storage-manager-service/models/storage-option.model.ts +0 -32
  144. package/src/lib/services/local-storage-manager-service/models/storage-type.enum.ts +0 -5
  145. package/src/lib/services/request-manager-services/README.md +0 -268
  146. package/src/lib/services/request-manager-services/http-manager-signals.service.ts +0 -246
  147. package/src/lib/services/request-manager-services/http-manager.service.spec.ts +0 -232
  148. package/src/lib/services/request-manager-services/http-manager.service.ts +0 -274
  149. package/src/lib/services/request-manager-services/index.ts +0 -8
  150. package/src/lib/services/request-manager-services/request-signals.service.ts +0 -214
  151. package/src/lib/services/request-manager-services/request.service.ts +0 -309
  152. package/src/lib/services/request-manager-services/rxjs-operators/countdown.ts +0 -17
  153. package/src/lib/services/request-manager-services/rxjs-operators/delay-retry.ts +0 -16
  154. package/src/lib/services/request-manager-services/rxjs-operators/index.ts +0 -4
  155. package/src/lib/services/request-manager-services/rxjs-operators/request-polling.ts +0 -35
  156. package/src/lib/services/request-manager-services/rxjs-operators/request-streaming.ts +0 -436
  157. package/src/lib/services/request-manager-state-service/http-manager-state.store.ts +0 -1321
  158. package/src/lib/services/request-manager-state-service/index.ts +0 -3
  159. package/src/lib/services/request-manager-state-service/models/api-request.model.ts +0 -61
  160. package/src/lib/services/request-manager-state-service/models/index.ts +0 -6
  161. package/src/lib/services/request-manager-state-service/models/request-options.model.ts +0 -22
  162. package/src/lib/services/request-manager-state-service/models/stream-type.enum.ts +0 -13
  163. package/src/lib/services/request-manager-state-service/models/ws-options.model.ts +0 -39
  164. package/src/lib/services/store-state-manager-service/index.ts +0 -3
  165. package/src/lib/services/store-state-manager-service/models/index.ts +0 -2
  166. package/src/lib/services/store-state-manager-service/models/state-storage-options.model.ts +0 -24
  167. package/src/lib/services/store-state-manager-service/store-state-manager.service.ts +0 -88
  168. package/src/lib/services/utils/app.service.spec.ts +0 -25
  169. package/src/lib/services/utils/app.service.ts +0 -21
  170. package/src/lib/services/utils/encryption/README.md +0 -79
  171. package/src/lib/services/utils/encryption/asymmetrical-encryption.service.ts +0 -282
  172. package/src/lib/services/utils/encryption/encryption-test.service.ts +0 -39
  173. package/src/lib/services/utils/encryption/index.ts +0 -5
  174. package/src/lib/services/utils/encryption/random.ts +0 -81
  175. package/src/lib/services/utils/encryption/symmetrical-encryption.service.ts +0 -93
  176. package/src/lib/services/utils/headers.service.spec.ts +0 -80
  177. package/src/lib/services/utils/headers.service.ts +0 -18
  178. package/src/lib/services/utils/index.ts +0 -7
  179. package/src/lib/services/utils/object-merger.service.spec.ts +0 -18
  180. package/src/lib/services/utils/object-merger.service.ts +0 -78
  181. package/src/lib/services/utils/path-query.service.spec.ts +0 -117
  182. package/src/lib/services/utils/path-query.service.ts +0 -69
  183. package/src/lib/services/utils/random-color.utils.ts +0 -83
  184. package/src/lib/services/utils/utils.service.spec.ts +0 -165
  185. package/src/lib/services/utils/utils.service.ts +0 -192
  186. package/src/lib/services/ws-manager-service/index.ts +0 -4
  187. package/src/lib/services/ws-manager-service/models/channel-info.model.ts +0 -24
  188. package/src/lib/services/ws-manager-service/models/channel-message-data.model.ts +0 -24
  189. package/src/lib/services/ws-manager-service/models/channel-message.model.ts +0 -24
  190. package/src/lib/services/ws-manager-service/models/communication-type.enum.ts +0 -5
  191. package/src/lib/services/ws-manager-service/models/index.ts +0 -5
  192. package/src/lib/services/ws-manager-service/models/ws-user.model.ts +0 -38
  193. package/src/lib/services/ws-manager-service/services/index.ts +0 -3
  194. package/src/lib/services/ws-manager-service/services/websocket.service.ts +0 -392
  195. package/src/public-api.ts +0 -14
  196. package/tsconfig.lib.json +0 -32
  197. package/tsconfig.lib.prod.json +0 -10
  198. package/tsconfig.spec.json +0 -14
@@ -1,239 +0,0 @@
1
- import { Component, inject, Input, OnInit, OnDestroy } from '@angular/core';
2
- import { NotificationServiceDemo } from '../../services/notification-service-demo.service';
3
- import { StateServiceDemo } from '../../services/state-service-demo.service';
4
- import { FormBuilder, FormControl, Validators } from '@angular/forms';
5
- import { Subject, takeUntil, filter, startWith, distinctUntilChanged, map, tap, combineLatest } from 'rxjs';
6
-
7
- @Component({
8
- selector: 'app-ws-notifications',
9
- templateUrl: './ws-notifications.component.html',
10
- styleUrls: ['./ws-notifications.component.css'],
11
- standalone: false
12
- })
13
- export class WsNotificationsComponent implements OnInit, OnDestroy {
14
-
15
- @Input() server!: string;
16
- @Input() wsServer!: string;
17
- @Input() jwtToken!: string;
18
- @Input() user!: any;
19
-
20
- private destroy$ = new Subject<void>();
21
-
22
- fb = inject(FormBuilder);
23
- notificationService = inject(NotificationServiceDemo);
24
- stateService = inject(StateServiceDemo);
25
-
26
- // Combine in-memory channels and today's DB channels, dedupe and strip prefix for display
27
- todaysNotificationChannels$ = combineLatest([
28
- this.notificationService.notificationChannels$.pipe(startWith([] as string[])),
29
- this.notificationService.todaysNotificationChannels$.pipe(startWith([] as string[]))
30
- ]).pipe(
31
- tap(([inMemory, fromDb]) => console.log('📢 In-memory channels:', inMemory, 'DB channels:', fromDb)),
32
- map(([inMemory, fromDb]) => {
33
- // Merge both sources and dedupe
34
- const allChannels = [...(inMemory || []), ...(fromDb || [])];
35
- const uniqueChannels = [...new Set(allChannels)]
36
- .filter(channel => channel.startsWith('MES-'))
37
- .map(channel => channel.replace('MES-', ''));
38
- return uniqueChannels.sort();
39
- }),
40
- tap(channels => console.log('📢 Combined channels for display:', channels)),
41
- distinctUntilChanged((prev, curr) => prev.length === curr.length && prev.every((v, i) => v === curr[i]))
42
- );
43
-
44
- // Track subscribed notification channels, strip prefix for display
45
- subscribedNotificationChannels$ = this.notificationService.subscribedNotificationChannels$.pipe(
46
- map(set => Array.from(set)
47
- .filter(channel => channel.startsWith('MES-'))
48
- .map(channel => channel.replace('MES-', ''))
49
- ),
50
- startWith([] as string[]),
51
- distinctUntilChanged((prev, curr) => prev.length === curr.length && prev.every((v, i) => v === curr[i]))
52
- );
53
-
54
- // Notification messages
55
- notificationMessages$ = this.notificationService.notificationMessages$;
56
-
57
- connectionStatus$ = this.stateService.connectionStatus$;
58
-
59
- /**
60
- * Helper to ensure channel has MES- prefix for outgoing communication
61
- */
62
- private toNotificationChannel(channel: string): string {
63
- return channel.startsWith('MES-') ? channel : `MES-${channel}`;
64
- }
65
-
66
- // Form for creating new notification channels
67
- newChannelName = this.fb.control<string>('', [Validators.required, Validators.minLength(2)]);
68
-
69
- // Channel connection selection
70
- selectedConnectionChannel = this.fb.control<string | null>(null);
71
- connectedChannel: string | null = null;
72
-
73
- // Table columns for notifications display
74
- displayedColumns: string[] = ['date', 'user', 'message'];
75
-
76
- // Form for date filter when subscribing
77
- dateFilter = this.fb.group({
78
- startDate: this.fb.control<Date | null>(null),
79
- endDate: this.fb.control<Date | null>(null),
80
- });
81
-
82
- // Form for sending notifications
83
- notificationForm = this.fb.group({
84
- content: this.fb.control<string | null>(null, Validators.required),
85
- });
86
-
87
- get content() {
88
- return this.notificationForm.get('content') as FormControl;
89
- }
90
-
91
- /**
92
- * Check if currently connected to a channel
93
- */
94
- isChannelConnected(subscribedChannels: string[]): boolean {
95
- return this.connectedChannel !== null && subscribedChannels.includes(this.connectedChannel);
96
- }
97
-
98
- /**
99
- * Connect to the selected channel
100
- */
101
- onConnectToChannel() {
102
- const channel = this.selectedConnectionChannel.value;
103
- if (!channel) return;
104
-
105
- this.connectedChannel = channel;
106
- this.onSubscribeToChannel(channel);
107
- }
108
-
109
- /**
110
- * Disconnect from the current channel
111
- */
112
- onDisconnectFromChannel() {
113
- if (this.connectedChannel) {
114
- this.onUnsubscribeFromChannel(this.connectedChannel);
115
- this.connectedChannel = null;
116
- }
117
- }
118
-
119
- ngOnInit() {
120
- // Request today's notification channels when connection is established
121
- this.connectionStatus$.pipe(
122
- filter(isConnected => isConnected),
123
- takeUntil(this.destroy$)
124
- ).subscribe(() => {
125
- // Request the list of today's notification channels from database
126
- this.notificationService.getTodaysNotificationChannels();
127
- });
128
- }
129
-
130
- ngOnDestroy() {
131
- this.destroy$.next();
132
- this.destroy$.complete();
133
- }
134
-
135
- /**
136
- * Create a new notification channel
137
- */
138
- onCreateChannel() {
139
- if (this.newChannelName.invalid) return;
140
-
141
- const channelName = this.newChannelName.value?.trim();
142
- if (channelName) {
143
- this.notificationService.createNotificationChannel(channelName);
144
- this.newChannelName.reset();
145
- }
146
- }
147
-
148
- /**
149
- * Define and load previous channels
150
- */
151
- onDefinePreviousChannels() {
152
- this.notificationService.definePreviousNotificationChannels();
153
- }
154
-
155
- /**
156
- * Subscribe to a notification channel with optional date filter
157
- */
158
- onSubscribeToChannel(channel: string) {
159
- const startDate = this.dateFilter.get('startDate')?.value as Date | null;
160
- const endDate = this.dateFilter.get('endDate')?.value as Date | null;
161
-
162
- const options: { startEpoch?: number; endEpoch?: number } = {};
163
-
164
- if (startDate) {
165
- // Set to start of day
166
- const startOfDay = new Date(startDate);
167
- startOfDay.setHours(0, 0, 0, 0);
168
- options.startEpoch = Math.floor(startOfDay.getTime() / 1000);
169
- }
170
- if (endDate) {
171
- // Set to end of day
172
- const endOfDay = new Date(endDate);
173
- endOfDay.setHours(23, 59, 59, 999);
174
- options.endEpoch = Math.floor(endOfDay.getTime() / 1000);
175
- }
176
-
177
- this.notificationService.subscribeToNotificationChannel(channel, options, this.user);
178
- }
179
-
180
- /**
181
- * Unsubscribe from a notification channel
182
- */
183
- onUnsubscribeFromChannel(channel: string) {
184
- this.notificationService.unsubscribeFromNotificationChannel(channel);
185
- }
186
-
187
- /**
188
- * Check if currently subscribed to a channel
189
- */
190
- isSubscribed(channel: string, subscribedChannels: string[]): boolean {
191
- return subscribedChannels.includes(channel);
192
- }
193
-
194
- /**
195
- * Handle chip click - toggle subscription state
196
- */
197
- onChipClick(channel: string, subscribedChannels: string[]) {
198
- const isCurrentlySubscribed = this.isSubscribed(channel, subscribedChannels);
199
- if (isCurrentlySubscribed) {
200
- this.onUnsubscribeFromChannel(channel);
201
- } else {
202
- this.onSubscribeToChannel(channel);
203
- }
204
- }
205
-
206
- /**
207
- * Send a notification
208
- */
209
- onSendNotification() {
210
- this.notificationForm.markAllAsTouched();
211
-
212
- if (this.notificationForm.invalid) return;
213
-
214
- const channel = this.connectedChannel;
215
- if (!channel) return;
216
-
217
- const messageContent = {
218
- message: this.content.value
219
- };
220
-
221
- this.notificationService.sendNotification(channel, messageContent, this.user);
222
- this.content.reset();
223
- }
224
-
225
- /**
226
- * Format epoch timestamp to readable date/time
227
- */
228
- formatTimestamp(epoch: number): string {
229
- return new Date(epoch * 1000).toLocaleString();
230
- }
231
-
232
- /**
233
- * Get today's date in YYYY-MM-DD format for date input default
234
- */
235
- getTodayDate(): string {
236
- return new Date().toISOString().split('T')[0];
237
- }
238
-
239
- }
@@ -1,31 +0,0 @@
1
- export interface OIDCClientInterface {
2
- spiffe: string
3
- id: number
4
- first_name: string
5
- last_name: string
6
- email: string
7
- }
8
-
9
- export class OIDCClient implements OIDCClientInterface {
10
-
11
- constructor(
12
- public spiffe: string = '',
13
- public id: number = 0,
14
- public first_name: string = '',
15
- public last_name: string = '',
16
- public email: string = '',
17
- ) {}
18
-
19
- static adapt(item?: any): OIDCClient {
20
-
21
- return new OIDCClient(
22
- item?.spiffe,
23
- item?.id,
24
- item?.first_name,
25
- item?.last_name,
26
- item?.email,
27
- )
28
-
29
- }
30
-
31
- }
@@ -1,32 +0,0 @@
1
- import { RandomPaletteColor } from "../../../services"
2
-
3
- export interface UserDataInterface {
4
- ldap: string
5
- name: string
6
- email: string
7
- color: string
8
- }
9
-
10
- export class UserData implements UserDataInterface {
11
-
12
- constructor(
13
- public ldap = '',
14
- public name = '',
15
- public email = '',
16
- public color = RandomPaletteColor(),
17
- ) {}
18
-
19
- static adapt(item?: any): UserData {
20
-
21
- const userName = `${item?.first_name} ${item?.last_name}`
22
-
23
- return new UserData(
24
- item?.ldap,
25
- userName,
26
- item?.email,
27
- item?.color,
28
- )
29
-
30
- }
31
-
32
- }
@@ -1,84 +0,0 @@
1
- <div style="margin: 2rem;">
2
-
3
- <h2 style="display: flex;">
4
- <span style="flex:1">HTTP Request State Manager - Websockets</span>
5
- @if ((connectionStatus$ | async); as connected) {
6
- <span>
7
- WS -
8
- <span style="color: green;">Connected</span>
9
- </span>
10
- } @else {
11
- <span style="color: red;">Disconnected {{ attempts$ | async }} - {{ nextRetry$ |async }}</span>
12
- }
13
- </h2>
14
-
15
- <div>
16
-
17
- @if ((user$ | async); as userInfo) {
18
- <div>
19
- <mat-toolbar>
20
- <div style="display: flex; flex:1">
21
- <div style="flex:1">{{ userInfo.name }}</div>
22
- <div>({{ userInfo.ldap }})</div>
23
- </div>
24
- </mat-toolbar>
25
- </div>
26
- }
27
-
28
- @if ((isPending$ | async)) {
29
- <div>
30
- <mat-progress-bar mode="indeterminate"></mat-progress-bar>
31
- </div>
32
- }
33
-
34
- <mat-tab-group animationDuration="0ms" [selectedIndex]="1">
35
-
36
- <mat-tab label="WS - Data Control">
37
- <!-- DATA CONTROL -->
38
- <app-ws-data-control
39
- [server]="server"
40
- [wsServer]="wsServer"
41
- [jwtToken]="jwtToken"
42
- [user]="user"
43
- [path]="path"
44
- [wsChannel]="wsChannel"
45
- ></app-ws-data-control>
46
-
47
- </mat-tab>
48
-
49
- <mat-tab label="WS - Messaging">
50
- <!-- MESSAGING -->
51
- <app-ws-messaging
52
- [server]="server"
53
- [wsServer]="wsServer"
54
- [jwtToken]="jwtToken"
55
- [user]="user"
56
- ></app-ws-messaging>
57
-
58
- </mat-tab>
59
-
60
- <mat-tab label="WS - Notifications">
61
- <!-- WS - Notifications -->
62
- <app-ws-notifications
63
- [server]="server"
64
- [wsServer]="wsServer"
65
- [jwtToken]="jwtToken"
66
- [user]="user"
67
- ></app-ws-notifications>
68
- </mat-tab>
69
-
70
- <mat-tab label="WS - Chats" [disabled]="true">
71
- <!-- WS - Chats -->
72
- <app-ws-chats></app-ws-chats>
73
- </mat-tab>
74
-
75
- <mat-tab label="WS - AI Messaging" [disabled]="true">
76
- <!-- WS - AI Messaging -->
77
- <app-ws-ai-messaging></app-ws-ai-messaging>
78
- </mat-tab>
79
-
80
- </mat-tab-group>
81
- </div>
82
-
83
- </div>
84
-
@@ -1,41 +0,0 @@
1
- import { Component, inject, OnInit, Input } from '@angular/core';
2
- import { FormBuilder } from '@angular/forms';
3
-
4
- import { HTTPManagerService } from '../../services';
5
- import { StateServiceDemo } from './services';
6
-
7
- @Component({
8
- selector: 'app-request-manager-ws-demo',
9
- templateUrl: './request-manager-ws-demo.component.html',
10
- styleUrls: ['./request-manager-ws-demo.component.css'],
11
- standalone: false
12
- })
13
- export class RequestManagerWsDemoComponent implements OnInit {
14
-
15
- httpManagerService = inject(HTTPManagerService)
16
- stateService = inject(StateServiceDemo)
17
-
18
- fb = inject(FormBuilder)
19
-
20
- @Input() server!: string;
21
- @Input() wsServer!: string;
22
- @Input() jwtToken!: string;
23
- @Input() user!: any;
24
- @Input() path: string[] = ['ai','tests'];
25
- @Input() wsChannel: string = '';
26
-
27
- user$ = this.stateService.user$
28
-
29
- attempts$ = this.stateService.wsRetryAttempts$
30
- nextRetry$ = this.stateService.wsNextRetry$
31
-
32
- connectionStatus$ = this.stateService.connectionStatus$
33
-
34
- data$ = this.stateService.data$;
35
- isPending$ = this.stateService.isPending$;
36
-
37
- ngOnInit() {
38
- this.stateService.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
39
- }
40
-
41
- }
@@ -1,3 +0,0 @@
1
- export { StateServiceDemo } from './state-service-demo.service';
2
- export { MessageServiceDemo } from './message-service-demo.service';
3
- export { NotificationServiceDemo, NotificationMessage } from './notification-service-demo.service';
@@ -1,83 +0,0 @@
1
- import { Injectable, inject } from '@angular/core';
2
- import { ChannelMessage } from '../../../services/ws-manager-service/models/channel-message.model';
3
- import { StateServiceDemo } from './state-service-demo.service';
4
-
5
- /**
6
- * MessageServiceDemo - Channel messaging service (PUB- prefix channels)
7
- *
8
- * Handles:
9
- * - Sending messages to channels
10
- * - Channel subscription for messaging
11
- * - Real-time message broadcast
12
- */
13
- @Injectable({
14
- providedIn: 'root'
15
- })
16
- export class MessageServiceDemo {
17
-
18
- private stateService = inject(StateServiceDemo);
19
-
20
- // Expose observables from state service
21
- channels$ = this.stateService.channels$;
22
- subscribedChannels$ = this.stateService.subscribedChannels$;
23
- communicationMessages$ = this.stateService.communicationMessages$;
24
- latestCommunicationMessages$ = this.stateService.latestCommunicationMessages$;
25
- connectionStatus$ = this.stateService.connectionStatus$;
26
- user$ = this.stateService.user$;
27
- data$ = this.stateService.data$;
28
-
29
- /**
30
- * Helper to ensure channel has PUB- prefix
31
- */
32
- private toPublicChannel(channel: string): string {
33
- return channel.startsWith('PUB-') ? channel : `PUB-${channel}`;
34
- }
35
-
36
- /**
37
- * Helper to strip PUB- prefix for display
38
- */
39
- private fromPublicChannel(channel: string): string {
40
- return channel.startsWith('PUB-') ? channel.replace('PUB-', '') : channel;
41
- }
42
-
43
- /**
44
- * Create a new public channel
45
- */
46
- createChannel(channel: string) {
47
- const publicChannel = this.toPublicChannel(channel);
48
- this.stateService.createChannel(publicChannel);
49
- }
50
-
51
- /**
52
- * Get all available channels
53
- */
54
- getAllChannels() {
55
- this.stateService.getAllChannels();
56
- }
57
-
58
- /**
59
- * Subscribe to a channel to receive messages
60
- */
61
- subscribeToChannel(channel: string) {
62
- const publicChannel = this.toPublicChannel(channel);
63
- this.stateService.subscribeToChannel(publicChannel);
64
- }
65
-
66
- /**
67
- * Unsubscribe from a channel
68
- */
69
- unsubscribeFromChannel(channel: string) {
70
- const publicChannel = this.toPublicChannel(channel);
71
- this.stateService.unsubscribeFromChannel(publicChannel);
72
- }
73
-
74
- /**
75
- * Send a message to one or more channels
76
- */
77
- sendMessage(data: ChannelMessage, channels?: string[]) {
78
- const publicChannels = channels?.map(ch => this.toPublicChannel(ch));
79
- console.log('sendMessage', data, 'to channels:', publicChannels);
80
- this.stateService.wsMessaging(data, publicChannels);
81
- }
82
-
83
- }
@@ -1,147 +0,0 @@
1
- import { Injectable, inject } from '@angular/core';
2
- import { BehaviorSubject } from 'rxjs';
3
- import { StateServiceDemo } from './state-service-demo.service';
4
-
5
- /**
6
- * Notification message interface
7
- */
8
- export interface NotificationMessage {
9
- id: number;
10
- channel: string;
11
- created: number; // epoch seconds
12
- user_name: string;
13
- sessionId: any;
14
- content: any;
15
- }
16
-
17
- /**
18
- * NotificationServiceDemo - Notification channel service (MES- prefix channels)
19
- *
20
- * Handles:
21
- * - Creating notification channels
22
- * - Subscribing to notifications with date filters
23
- * - Sending notifications (persisted to database)
24
- * - Receiving real-time and historical notifications
25
- */
26
- @Injectable({
27
- providedIn: 'root'
28
- })
29
- export class NotificationServiceDemo {
30
-
31
- private stateService = inject(StateServiceDemo);
32
-
33
- // Notification channels from state service (in-memory - contains MES- channels from server)
34
- notificationChannels$ = this.stateService.notificationChannels$;
35
-
36
- // Today's notification channels from database (channels with data for today)
37
- todaysNotificationChannels$ = this.stateService.todaysNotificationChannels$;
38
-
39
- private subscribedNotificationChannelsSubject = new BehaviorSubject<Set<string>>(new Set());
40
- subscribedNotificationChannels$ = this.subscribedNotificationChannelsSubject.asObservable();
41
-
42
- // Notification messages from state service
43
- notificationMessages$ = this.stateService.notificationMessages$;
44
-
45
- // Latest notification from state service
46
- latestNotification$ = this.stateService.latestNotification$;
47
-
48
- // Expose connection status from state service
49
- connectionStatus$ = this.stateService.connectionStatus$;
50
-
51
- /**
52
- * Create a notification channel
53
- * NOTE: MES- prefix is added automatically by HTTPManagerStateService
54
- */
55
- createNotificationChannel(channel: string) {
56
- console.log('📢 createNotificationChannel:', channel);
57
- this.stateService.createNotificationChannel(channel);
58
- }
59
-
60
- /**
61
- * Get all notification channels (in-memory)
62
- */
63
- getNotificationChannels() {
64
- console.log('📢 getNotificationChannels');
65
- this.stateService.getNotificationChannels();
66
- }
67
-
68
- /**
69
- * Get today's notification channels from database
70
- * Returns unique channels that have notifications posted today
71
- */
72
- getTodaysNotificationChannels() {
73
- console.log('📢 getTodaysNotificationChannels (from DB)');
74
- this.stateService.getTodaysNotificationChannels();
75
- }
76
-
77
- /**
78
- * Define and load previous day's notification channels from database
79
- * Creates channels in memory and broadcasts updated list
80
- */
81
- definePreviousNotificationChannels() {
82
- console.log('📢 definePreviousNotificationChannels');
83
- this.stateService.definePreviousNotificationChannels();
84
- }
85
-
86
- /**
87
- * Subscribe to a notification channel with optional date filter
88
- * NOTE: MES- prefix is added automatically by HTTPManagerStateService
89
- * @param channel Base channel name (without MES- prefix)
90
- * @param options { startEpoch?, endEpoch? }
91
- * @param user User info for subscription
92
- */
93
- subscribeToNotificationChannel(channel: string, options?: { startEpoch?: number; endEpoch?: number }, user?: any) {
94
- // Add MES- prefix for local tracking (to match what state service sends)
95
- const prefixedChannel = channel.startsWith('MES-') ? channel : `MES-${channel}`;
96
- console.log('📢 subscribeToNotificationChannel:', prefixedChannel, options);
97
-
98
- // Add to local subscribed channels immediately for UI feedback
99
- const currentSubs = this.subscribedNotificationChannelsSubject.value;
100
- currentSubs.add(prefixedChannel);
101
- this.subscribedNotificationChannelsSubject.next(new Set(currentSubs));
102
-
103
- // Send subscription request to server (state service adds MES- prefix)
104
- this.stateService.subscribeToNotificationChannel(channel, options, user);
105
- }
106
-
107
- /**
108
- * Unsubscribe from a notification channel
109
- * NOTE: MES- prefix is added automatically by HTTPManagerStateService
110
- */
111
- unsubscribeFromNotificationChannel(channel: string) {
112
- // Add MES- prefix for local tracking (to match what state service sends)
113
- const prefixedChannel = channel.startsWith('MES-') ? channel : `MES-${channel}`;
114
- console.log('📢 unsubscribeFromNotificationChannel:', prefixedChannel);
115
-
116
- // Remove from local subscribed channels immediately for UI feedback
117
- const currentSubs = this.subscribedNotificationChannelsSubject.value;
118
- currentSubs.delete(prefixedChannel);
119
- this.subscribedNotificationChannelsSubject.next(new Set(currentSubs));
120
-
121
- // Send unsubscription request to server (state service adds MES- prefix)
122
- this.stateService.unsubscribeFromNotificationChannel(channel);
123
- }
124
-
125
- /**
126
- * Send a notification to a channel
127
- * NOTE: MES- prefix is added automatically by HTTPManagerStateService
128
- */
129
- sendNotification(channel: string, content: any, user?: any) {
130
- const notificationContent = {
131
- sessionId: {
132
- id: user?.id,
133
- ldap: user?.ldap,
134
- name: user?.name,
135
- email: user?.email,
136
- color: user?.color,
137
- },
138
- ...content
139
- };
140
-
141
- console.log('📢 sendNotification:', channel, notificationContent);
142
-
143
- // State service adds MES- prefix
144
- this.stateService.sendNotification(channel, notificationContent);
145
- }
146
-
147
- }