http-request-manager 18.5.8 → 18.5.10
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.
|
@@ -4,7 +4,7 @@ import { ComponentStore } from '@ngrx/component-store';
|
|
|
4
4
|
import { map, catchError, filter, finalize, takeWhile, retry, startWith, tap, mergeMap, takeUntil, withLatestFrom, switchMap, delay, concatMap, take, scan, distinctUntilChanged } from 'rxjs/operators';
|
|
5
5
|
import { HttpClient, HttpHeaders, HttpEventType, HttpHeaderResponse, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
6
6
|
import * as CryptoJS from 'crypto-js';
|
|
7
|
-
import { from, BehaviorSubject, EMPTY, throwError, defer, interval, timer, Subject, merge, of, Subscription, take as take$1, catchError as catchError$1,
|
|
7
|
+
import { from, BehaviorSubject, EMPTY, throwError, defer, interval, timer, Subject, merge, of, Subscription, take as take$1, catchError as catchError$1, switchMap as switchMap$1, map as map$1, startWith as startWith$1, combineLatest, tap as tap$1, ReplaySubject } from 'rxjs';
|
|
8
8
|
import { ToastMessageDisplayService, ToastDisplay, ToastColors, ToastMessageDisplayModule } from 'toast-message-display';
|
|
9
9
|
import Dexie from 'dexie';
|
|
10
10
|
import * as i1 from '@ngx-translate/core';
|
|
@@ -16,7 +16,7 @@ import { FormBuilder, Validators, FormsModule, ReactiveFormsModule } from '@angu
|
|
|
16
16
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
17
17
|
import * as i2$1 from '@angular/material/button';
|
|
18
18
|
import { MatButtonModule } from '@angular/material/button';
|
|
19
|
-
import * as
|
|
19
|
+
import * as i3$1 from '@angular/material/chips';
|
|
20
20
|
import { MatChipsModule } from '@angular/material/chips';
|
|
21
21
|
import * as i11 from '@angular/material/divider';
|
|
22
22
|
import { MatDividerModule } from '@angular/material/divider';
|
|
@@ -35,7 +35,7 @@ import * as i10$1 from '@angular/material/slide-toggle';
|
|
|
35
35
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
36
36
|
import * as i6 from '@angular/material/menu';
|
|
37
37
|
import { MatMenuModule } from '@angular/material/menu';
|
|
38
|
-
import * as i3$
|
|
38
|
+
import * as i3$2 from '@angular/material/toolbar';
|
|
39
39
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
40
40
|
import * as i8 from '@angular/material/table';
|
|
41
41
|
import { MatTableModule } from '@angular/material/table';
|
|
@@ -735,37 +735,22 @@ class ChannelInfo {
|
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
737
|
|
|
738
|
-
|
|
739
|
-
(
|
|
740
|
-
|
|
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
|
|
744
|
+
return new WSUser(item?.sessionId, item?.content);
|
|
755
745
|
}
|
|
756
746
|
}
|
|
757
747
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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);
|
|
@@ -3264,6 +3243,12 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3264
3243
|
this.dataType = (dataType) ? dataType : DataType.ARRAY;
|
|
3265
3244
|
this.hasDatabase = (this.database?.table) ? true : false;
|
|
3266
3245
|
this.database = (this.hasDatabase) ? DatabaseStorage.adapt(database) : undefined;
|
|
3246
|
+
// Update WebSocket retry settings when options change
|
|
3247
|
+
if (this.apiOptions.ws?.retry) {
|
|
3248
|
+
this.maxRetries = this.apiOptions.ws.retry.times || 3;
|
|
3249
|
+
this.retryDelay = (this.apiOptions.ws.retry.delay && this.apiOptions.ws.retry.delay * 1000) || 5 * 1000;
|
|
3250
|
+
this.wsNextRetry.next(this.retryDelay);
|
|
3251
|
+
}
|
|
3267
3252
|
if (this.database)
|
|
3268
3253
|
this.initDBStorage();
|
|
3269
3254
|
if (this.apiOptions.ws)
|
|
@@ -3271,7 +3256,14 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3271
3256
|
}
|
|
3272
3257
|
// WebSocket
|
|
3273
3258
|
setupConnectionStatus() {
|
|
3274
|
-
return this.httpManagerService.connectionStatus$.pipe(distinctUntilChanged(),
|
|
3259
|
+
return this.httpManagerService.connectionStatus$.pipe(distinctUntilChanged(), tap(status => {
|
|
3260
|
+
if (status === true) {
|
|
3261
|
+
console.log('🟢 WebSocket connection is open.');
|
|
3262
|
+
}
|
|
3263
|
+
else {
|
|
3264
|
+
console.log('🔴 WebSocket connection is closed.');
|
|
3265
|
+
}
|
|
3266
|
+
}), switchMap(status => {
|
|
3275
3267
|
if (status === true) {
|
|
3276
3268
|
this.shouldRetry = true;
|
|
3277
3269
|
this.wsRetryAttempts.next(0);
|
|
@@ -3286,7 +3278,9 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3286
3278
|
const attempt = i + 1;
|
|
3287
3279
|
this.wsRetryAttempts.next(attempt);
|
|
3288
3280
|
countdownEnder$.next();
|
|
3281
|
+
// Attempt connection on each retry
|
|
3289
3282
|
if (this.apiOptions.ws?.wsServer) {
|
|
3283
|
+
console.log(`🔄 Retry attempt #${attempt}/${this.maxRetries}`);
|
|
3290
3284
|
this.httpManagerService.connect(this.apiOptions.ws, this.apiOptions.ws.jwtToken || '');
|
|
3291
3285
|
}
|
|
3292
3286
|
if (attempt === this.maxRetries) {
|
|
@@ -3378,20 +3372,19 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3378
3372
|
this.httpManagerService.sendMessageInChannel(wsServer, { method, path, user: this.apiOptions.ws.user });
|
|
3379
3373
|
}
|
|
3380
3374
|
}
|
|
3381
|
-
wsMessaging(message,
|
|
3375
|
+
wsMessaging(message, channels) {
|
|
3382
3376
|
const user = this.user.value || this.user.value;
|
|
3383
3377
|
const messageInfo = ChannelMessage.adapt({ ...message, fromUser: user });
|
|
3384
3378
|
if (this.wsConnection && this.apiOptions.ws) {
|
|
3385
|
-
const wsServer = (
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
else if
|
|
3390
|
-
|
|
3391
|
-
}
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
}
|
|
3379
|
+
const wsServer = (channels) ? channels : this.apiOptions.ws.id;
|
|
3380
|
+
debugger;
|
|
3381
|
+
// if(messageInfo.toUser === 'allChannels') {
|
|
3382
|
+
// this.httpManagerService.sendBroadcast(messageInfo)
|
|
3383
|
+
// } else if(messageInfo.toUser === 'allInChannel') {
|
|
3384
|
+
// this.httpManagerService.sendMessageInChannel(wsServer, messageInfo)
|
|
3385
|
+
// } else {
|
|
3386
|
+
// this.httpManagerService.sendMessageToUser(wsServer, messageInfo)
|
|
3387
|
+
// }
|
|
3395
3388
|
}
|
|
3396
3389
|
}
|
|
3397
3390
|
// --------------------------------------------------------------------------------------------------
|
|
@@ -4100,8 +4093,8 @@ class StateRequestServiceDemo extends HTTPManagerStateService {
|
|
|
4100
4093
|
jwtToken,
|
|
4101
4094
|
user, // user object
|
|
4102
4095
|
retry: RetryOptions.adapt({
|
|
4103
|
-
times:
|
|
4104
|
-
delay:
|
|
4096
|
+
times: 10,
|
|
4097
|
+
delay: 5,
|
|
4105
4098
|
}),
|
|
4106
4099
|
}
|
|
4107
4100
|
});
|
|
@@ -4110,6 +4103,7 @@ class StateRequestServiceDemo extends HTTPManagerStateService {
|
|
|
4110
4103
|
});
|
|
4111
4104
|
}
|
|
4112
4105
|
sendMessage(data) {
|
|
4106
|
+
debugger;
|
|
4113
4107
|
console.log('sendMessage', data);
|
|
4114
4108
|
this.wsMessaging(data);
|
|
4115
4109
|
}
|
|
@@ -4182,6 +4176,7 @@ class StateDataRequestService extends HTTPManagerStateService {
|
|
|
4182
4176
|
this.createRecord(newData, RequestOptions.adapt({ path: ['ai', 'tests'] }));
|
|
4183
4177
|
}
|
|
4184
4178
|
sendMessage(data) {
|
|
4179
|
+
debugger;
|
|
4185
4180
|
console.log('sendMessage', data);
|
|
4186
4181
|
this.wsMessaging(data);
|
|
4187
4182
|
}
|
|
@@ -4213,6 +4208,8 @@ class WsDataControlComponent {
|
|
|
4213
4208
|
this.stateDataRequestService = inject(StateDataRequestService);
|
|
4214
4209
|
this.user$ = this.stateDataRequestService.user$;
|
|
4215
4210
|
this.users$ = this.stateDataRequestService.userList$;
|
|
4211
|
+
this.userAction$ = this.stateDataRequestService.userAction$
|
|
4212
|
+
.pipe(switchMap$1((action) => timer(3 * 1000).pipe(map$1(() => null), startWith$1(action))));
|
|
4216
4213
|
this.data$ = this.stateDataRequestService.data$;
|
|
4217
4214
|
this.isUser = (user, userItem) => {
|
|
4218
4215
|
return user.sessionId === userItem.sessionId;
|
|
@@ -4244,11 +4241,11 @@ class WsDataControlComponent {
|
|
|
4244
4241
|
this.stateDataRequestService.deleteData(lastRec);
|
|
4245
4242
|
}
|
|
4246
4243
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsDataControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4247
|
-
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-
|
|
4244
|
+
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" }] }); }
|
|
4248
4245
|
}
|
|
4249
4246
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsDataControlComponent, decorators: [{
|
|
4250
4247
|
type: Component,
|
|
4251
|
-
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-
|
|
4248
|
+
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"] }]
|
|
4252
4249
|
}], propDecorators: { server: [{
|
|
4253
4250
|
type: Input
|
|
4254
4251
|
}], wsServer: [{
|
|
@@ -4259,49 +4256,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
4259
4256
|
type: Input
|
|
4260
4257
|
}] } });
|
|
4261
4258
|
|
|
4262
|
-
class
|
|
4263
|
-
constructor() { }
|
|
4264
|
-
ngOnInit() {
|
|
4265
|
-
}
|
|
4266
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsNotificationsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4267
|
-
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: [""] }); }
|
|
4268
|
-
}
|
|
4269
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsNotificationsComponent, decorators: [{
|
|
4270
|
-
type: Component,
|
|
4271
|
-
args: [{ selector: 'app-ws-notifications', standalone: false, template: "<p>\n ws-notifications works!\n</p>\n" }]
|
|
4272
|
-
}], ctorParameters: () => [] });
|
|
4273
|
-
|
|
4274
|
-
class WsAiMessagingComponent {
|
|
4275
|
-
constructor() { }
|
|
4276
|
-
ngOnInit() {
|
|
4277
|
-
}
|
|
4278
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsAiMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4279
|
-
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: [""] }); }
|
|
4280
|
-
}
|
|
4281
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsAiMessagingComponent, decorators: [{
|
|
4282
|
-
type: Component,
|
|
4283
|
-
args: [{ selector: 'app-ws-ai-messaging', standalone: false, template: "<p>\n ws-ai-messaging works!\n</p>\n" }]
|
|
4284
|
-
}], ctorParameters: () => [] });
|
|
4285
|
-
|
|
4286
|
-
class RequestManagerWsDemoComponent {
|
|
4259
|
+
class WsMessagingComponent {
|
|
4287
4260
|
constructor() {
|
|
4288
|
-
this.httpManagerService = inject(HTTPManagerService);
|
|
4289
|
-
this.stateRequestServiceDemo = inject(StateRequestServiceDemo);
|
|
4290
4261
|
this.fb = inject(FormBuilder);
|
|
4262
|
+
this.stateRequestServiceDemo = inject(StateRequestServiceDemo);
|
|
4291
4263
|
this.user$ = this.stateRequestServiceDemo.user$;
|
|
4292
4264
|
this.users$ = this.stateRequestServiceDemo.userList$;
|
|
4293
|
-
this.
|
|
4294
|
-
this.nextRetry$ = this.stateRequestServiceDemo.nextRetry$;
|
|
4295
|
-
this.connectionStatus$ = this.stateRequestServiceDemo.status$;
|
|
4265
|
+
this.data$ = this.stateRequestServiceDemo.data$;
|
|
4296
4266
|
this.messages = this.fb.group({
|
|
4297
|
-
|
|
4267
|
+
toUsers: this.fb.control(null, Validators.required),
|
|
4298
4268
|
content: this.fb.control(null, Validators.required),
|
|
4299
4269
|
});
|
|
4300
|
-
this.data$ = this.stateRequestServiceDemo.data$;
|
|
4301
|
-
this.isPending$ = this.stateRequestServiceDemo.isPending$;
|
|
4302
|
-
this.fromMe = (user, fromUser) => {
|
|
4303
|
-
return user === fromUser;
|
|
4304
|
-
};
|
|
4305
4270
|
this.communicationMessages$ = this.stateRequestServiceDemo.communicationMessages$;
|
|
4306
4271
|
this.latestCommunicationMessages$ = this.stateRequestServiceDemo.latestCommunicationMessages$;
|
|
4307
4272
|
this.chat$ = combineLatest([this.user$, this.communicationMessages$])
|
|
@@ -4340,27 +4305,33 @@ class RequestManagerWsDemoComponent {
|
|
|
4340
4305
|
return { user: mainUser, messages };
|
|
4341
4306
|
}));
|
|
4342
4307
|
}
|
|
4343
|
-
get
|
|
4344
|
-
return this.messages.get('
|
|
4308
|
+
get toUsers() {
|
|
4309
|
+
return this.messages.get('toUsers');
|
|
4345
4310
|
}
|
|
4346
4311
|
get content() {
|
|
4347
4312
|
return this.messages.get('content');
|
|
4348
4313
|
}
|
|
4349
4314
|
get isValid() {
|
|
4350
|
-
return this.
|
|
4315
|
+
return this.toUsers.valid;
|
|
4351
4316
|
}
|
|
4352
4317
|
ngOnInit() {
|
|
4353
4318
|
this.stateRequestServiceDemo.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
|
|
4319
|
+
// this.stateRequestServiceDemo.getData()
|
|
4354
4320
|
}
|
|
4355
|
-
onSendMessage() {
|
|
4321
|
+
onSendMessage(user) {
|
|
4356
4322
|
this.messages.markAllAsTouched();
|
|
4357
4323
|
if (this.messages.invalid)
|
|
4358
4324
|
return;
|
|
4359
|
-
const message = ChannelMessage.adapt(
|
|
4325
|
+
const message = ChannelMessage.adapt({
|
|
4326
|
+
message: this.messages.value.content,
|
|
4327
|
+
...user,
|
|
4328
|
+
users: this.toUsers.value,
|
|
4329
|
+
});
|
|
4360
4330
|
this.stateRequestServiceDemo.sendMessage(message);
|
|
4361
4331
|
this.content.reset();
|
|
4362
4332
|
}
|
|
4363
4333
|
onSendAlert() {
|
|
4334
|
+
debugger;
|
|
4364
4335
|
this.messages.markAllAsTouched();
|
|
4365
4336
|
if (this.messages.invalid)
|
|
4366
4337
|
return;
|
|
@@ -4368,12 +4339,123 @@ class RequestManagerWsDemoComponent {
|
|
|
4368
4339
|
this.stateRequestServiceDemo.sendMessage(message);
|
|
4369
4340
|
this.content.reset();
|
|
4370
4341
|
}
|
|
4342
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4343
|
+
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" }] }); }
|
|
4344
|
+
}
|
|
4345
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, decorators: [{
|
|
4346
|
+
type: Component,
|
|
4347
|
+
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" }]
|
|
4348
|
+
}], propDecorators: { server: [{
|
|
4349
|
+
type: Input
|
|
4350
|
+
}], wsServer: [{
|
|
4351
|
+
type: Input
|
|
4352
|
+
}], jwtToken: [{
|
|
4353
|
+
type: Input
|
|
4354
|
+
}], user: [{
|
|
4355
|
+
type: Input
|
|
4356
|
+
}] } });
|
|
4357
|
+
|
|
4358
|
+
class WsNotificationsComponent {
|
|
4359
|
+
constructor() { }
|
|
4360
|
+
ngOnInit() {
|
|
4361
|
+
}
|
|
4362
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsNotificationsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4363
|
+
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: [""] }); }
|
|
4364
|
+
}
|
|
4365
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsNotificationsComponent, decorators: [{
|
|
4366
|
+
type: Component,
|
|
4367
|
+
args: [{ selector: 'app-ws-notifications', standalone: false, template: "<p>\n ws-notifications coming soon!\n</p>\n" }]
|
|
4368
|
+
}], ctorParameters: () => [] });
|
|
4369
|
+
|
|
4370
|
+
class WsAiMessagingComponent {
|
|
4371
|
+
constructor() { }
|
|
4372
|
+
ngOnInit() {
|
|
4373
|
+
}
|
|
4374
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsAiMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4375
|
+
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: [""] }); }
|
|
4376
|
+
}
|
|
4377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsAiMessagingComponent, decorators: [{
|
|
4378
|
+
type: Component,
|
|
4379
|
+
args: [{ selector: 'app-ws-ai-messaging', standalone: false, template: "<p>\n ws-ai-messaging coming soon!\n</p>\n" }]
|
|
4380
|
+
}], ctorParameters: () => [] });
|
|
4381
|
+
|
|
4382
|
+
class RequestManagerWsDemoComponent {
|
|
4383
|
+
constructor() {
|
|
4384
|
+
this.httpManagerService = inject(HTTPManagerService);
|
|
4385
|
+
this.stateRequestServiceDemo = inject(StateRequestServiceDemo);
|
|
4386
|
+
this.fb = inject(FormBuilder);
|
|
4387
|
+
this.user$ = this.stateRequestServiceDemo.user$;
|
|
4388
|
+
// users$ = this.stateRequestServiceDemo.userList$
|
|
4389
|
+
this.attempts$ = this.stateRequestServiceDemo.attempts$;
|
|
4390
|
+
this.nextRetry$ = this.stateRequestServiceDemo.nextRetry$;
|
|
4391
|
+
this.connectionStatus$ = this.stateRequestServiceDemo.status$;
|
|
4392
|
+
// data$ = this.stateRequestServiceDemo.data$;
|
|
4393
|
+
this.isPending$ = this.stateRequestServiceDemo.isPending$;
|
|
4394
|
+
}
|
|
4395
|
+
// messages = this.fb.group<any>({
|
|
4396
|
+
// toUser: this.fb.control<string|null>(null, Validators.required),
|
|
4397
|
+
// content: this.fb.control<string|null>(null, Validators.required),
|
|
4398
|
+
// })
|
|
4399
|
+
// get toUser() {
|
|
4400
|
+
// return this.messages.get('toUser') as FormControl
|
|
4401
|
+
// }
|
|
4402
|
+
// get content() {
|
|
4403
|
+
// return this.messages.get('content') as FormControl
|
|
4404
|
+
// }
|
|
4405
|
+
// get isValid() {
|
|
4406
|
+
// return this.toUser.valid
|
|
4407
|
+
// }
|
|
4408
|
+
// fromMe = (user: string, fromUser: string) => {
|
|
4409
|
+
// return user === fromUser
|
|
4410
|
+
// }
|
|
4411
|
+
// communicationMessages$ = this.stateRequestServiceDemo.communicationMessages$
|
|
4412
|
+
// latestCommunicationMessages$ = this.stateRequestServiceDemo.latestCommunicationMessages$
|
|
4413
|
+
// chat$: Observable<{ user: any, messages: any[]}|any> = combineLatest([this.user$, this.communicationMessages$])
|
|
4414
|
+
// .pipe(
|
|
4415
|
+
// map(([user, messages]: any) => ({ user, messages })),
|
|
4416
|
+
// map(obj => {
|
|
4417
|
+
// if(!obj.user) return EMPTY
|
|
4418
|
+
// // const mainUser = UserName.adapt({
|
|
4419
|
+
// // id: obj.user.username,
|
|
4420
|
+
// // first: obj.user?.name?.first,
|
|
4421
|
+
// // last: obj.user?.name?.last,
|
|
4422
|
+
// // })
|
|
4423
|
+
// const mainUser = ''
|
|
4424
|
+
// const messages = obj.messages.map((item: any) => {
|
|
4425
|
+
// if(item.toUser === 'allChannels') {
|
|
4426
|
+
// // item.toUser = UserName.adapt({
|
|
4427
|
+
// // id: '',
|
|
4428
|
+
// // first: 'All Users',
|
|
4429
|
+
// // last: '',
|
|
4430
|
+
// // })
|
|
4431
|
+
// }
|
|
4432
|
+
// // return Message.adapt({
|
|
4433
|
+
// // fromUser: {
|
|
4434
|
+
// // id: item.fromUser.username,
|
|
4435
|
+
// // first: item.fromUser?.name?.first,
|
|
4436
|
+
// // last: item.fromUser?.name?.last,
|
|
4437
|
+
// // },
|
|
4438
|
+
// // toUser: {
|
|
4439
|
+
// // id: item.toUser.username,
|
|
4440
|
+
// // first: item.toUser?.name?.first,
|
|
4441
|
+
// // last: item.toUser?.name?.last,
|
|
4442
|
+
// // },
|
|
4443
|
+
// // content: item.content,
|
|
4444
|
+
// // date: item.issued,
|
|
4445
|
+
// // })
|
|
4446
|
+
// })
|
|
4447
|
+
// return { user: mainUser, messages }
|
|
4448
|
+
// })
|
|
4449
|
+
// );
|
|
4450
|
+
ngOnInit() {
|
|
4451
|
+
// this.stateRequestServiceDemo.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
|
|
4452
|
+
}
|
|
4371
4453
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RequestManagerWsDemoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4372
|
-
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
|
|
4454
|
+
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" }] }); }
|
|
4373
4455
|
}
|
|
4374
4456
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RequestManagerWsDemoComponent, decorators: [{
|
|
4375
4457
|
type: Component,
|
|
4376
|
-
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
|
|
4458
|
+
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" }]
|
|
4377
4459
|
}], propDecorators: { server: [{
|
|
4378
4460
|
type: Input
|
|
4379
4461
|
}], wsServer: [{
|
|
@@ -4802,100 +4884,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
4802
4884
|
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" }]
|
|
4803
4885
|
}] });
|
|
4804
4886
|
|
|
4805
|
-
class WsMessagingComponent {
|
|
4806
|
-
constructor() {
|
|
4807
|
-
this.fb = inject(FormBuilder);
|
|
4808
|
-
this.stateRequestServiceDemo = inject(StateRequestServiceDemo);
|
|
4809
|
-
this.user$ = this.stateRequestServiceDemo.user$;
|
|
4810
|
-
this.users$ = this.stateRequestServiceDemo.userList$;
|
|
4811
|
-
this.data$ = this.stateRequestServiceDemo.data$;
|
|
4812
|
-
this.messages = this.fb.group({
|
|
4813
|
-
toUser: this.fb.control(null, Validators.required),
|
|
4814
|
-
content: this.fb.control(null, Validators.required),
|
|
4815
|
-
});
|
|
4816
|
-
this.communicationMessages$ = this.stateRequestServiceDemo.communicationMessages$;
|
|
4817
|
-
this.latestCommunicationMessages$ = this.stateRequestServiceDemo.latestCommunicationMessages$;
|
|
4818
|
-
this.chat$ = combineLatest([this.user$, this.communicationMessages$])
|
|
4819
|
-
.pipe(map$1(([user, messages]) => ({ user, messages })), map$1(obj => {
|
|
4820
|
-
if (!obj.user)
|
|
4821
|
-
return EMPTY;
|
|
4822
|
-
// const mainUser = UserName.adapt({
|
|
4823
|
-
// id: obj.user.username,
|
|
4824
|
-
// first: obj.user?.name?.first,
|
|
4825
|
-
// last: obj.user?.name?.last,
|
|
4826
|
-
// })
|
|
4827
|
-
const mainUser = '';
|
|
4828
|
-
const messages = obj.messages.map((item) => {
|
|
4829
|
-
if (item.toUser === 'allChannels') {
|
|
4830
|
-
// item.toUser = UserName.adapt({
|
|
4831
|
-
// id: '',
|
|
4832
|
-
// first: 'All Users',
|
|
4833
|
-
// last: '',
|
|
4834
|
-
// })
|
|
4835
|
-
}
|
|
4836
|
-
// return Message.adapt({
|
|
4837
|
-
// fromUser: {
|
|
4838
|
-
// id: item.fromUser.username,
|
|
4839
|
-
// first: item.fromUser?.name?.first,
|
|
4840
|
-
// last: item.fromUser?.name?.last,
|
|
4841
|
-
// },
|
|
4842
|
-
// toUser: {
|
|
4843
|
-
// id: item.toUser.username,
|
|
4844
|
-
// first: item.toUser?.name?.first,
|
|
4845
|
-
// last: item.toUser?.name?.last,
|
|
4846
|
-
// },
|
|
4847
|
-
// content: item.content,
|
|
4848
|
-
// date: item.issued,
|
|
4849
|
-
// })
|
|
4850
|
-
});
|
|
4851
|
-
return { user: mainUser, messages };
|
|
4852
|
-
}));
|
|
4853
|
-
}
|
|
4854
|
-
get toUser() {
|
|
4855
|
-
return this.messages.get('toUser');
|
|
4856
|
-
}
|
|
4857
|
-
get content() {
|
|
4858
|
-
return this.messages.get('content');
|
|
4859
|
-
}
|
|
4860
|
-
get isValid() {
|
|
4861
|
-
return this.toUser.valid;
|
|
4862
|
-
}
|
|
4863
|
-
ngOnInit() {
|
|
4864
|
-
this.stateRequestServiceDemo.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
|
|
4865
|
-
// this.stateRequestServiceDemo.getData()
|
|
4866
|
-
}
|
|
4867
|
-
onSendMessage() {
|
|
4868
|
-
this.messages.markAllAsTouched();
|
|
4869
|
-
if (this.messages.invalid)
|
|
4870
|
-
return;
|
|
4871
|
-
const message = ChannelMessage.adapt(this.messages.value);
|
|
4872
|
-
this.stateRequestServiceDemo.sendMessage(message);
|
|
4873
|
-
this.content.reset();
|
|
4874
|
-
}
|
|
4875
|
-
onSendAlert() {
|
|
4876
|
-
this.messages.markAllAsTouched();
|
|
4877
|
-
if (this.messages.invalid)
|
|
4878
|
-
return;
|
|
4879
|
-
const message = ChannelMessage.adapt({ ...this.messages.value, type: CommunicationType.ALERT });
|
|
4880
|
-
this.stateRequestServiceDemo.sendMessage(message);
|
|
4881
|
-
this.content.reset();
|
|
4882
|
-
}
|
|
4883
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4884
|
-
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" }] }); }
|
|
4885
|
-
}
|
|
4886
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: WsMessagingComponent, decorators: [{
|
|
4887
|
-
type: Component,
|
|
4888
|
-
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" }]
|
|
4889
|
-
}], propDecorators: { server: [{
|
|
4890
|
-
type: Input
|
|
4891
|
-
}], wsServer: [{
|
|
4892
|
-
type: Input
|
|
4893
|
-
}], jwtToken: [{
|
|
4894
|
-
type: Input
|
|
4895
|
-
}], user: [{
|
|
4896
|
-
type: Input
|
|
4897
|
-
}] } });
|
|
4898
|
-
|
|
4899
4887
|
// import { MessengerChatModule } from 'src/app/components/messenger-chat/messenger-chat.module';
|
|
4900
4888
|
// import { StoreStateManagerModule } from "src/app/beta_components/store-state-manager/store-state-manager.module";
|
|
4901
4889
|
class HttpRequestManagerModule {
|
|
@@ -5997,7 +5985,7 @@ class HttpRequestServicesDemoComponent {
|
|
|
5997
5985
|
this.selectedService = this.requestTypes[type].value;
|
|
5998
5986
|
}
|
|
5999
5987
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HttpRequestServicesDemoComponent, deps: [{ token: CONFIG_SETTINGS_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6000
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: HttpRequestServicesDemoComponent, selector: "app-http-request-services-demo", inputs: { wsServer: "wsServer", jwtToken: "jwtToken", server: "server", user: "user", adapter: "adapter", mapper: "mapper" }, ngImport: i0, template: "<mat-toolbar style=\"display:flex\">\n <div>Http Request Manager Services</div>\n <div style=\"flex:1\"></div>\n <button mat-stroked-button [matMenuTriggerFor]=\"menu\">Services</button>\n <mat-menu #menu=\"matMenu\">\n @for (type of requestTypes; track type; let i = $index) {\n @if (type?.divider) {\n <div\n style=\"margin-top: .5rem; margin-bottom: .5rem;\"\n >\n <mat-divider></mat-divider>\n </div>\n }\n <button\n mat-menu-item\n (click)=\"onSelected(i)\"\n [disabled]=\"type.disabled\"\n >\n {{ type.name }}\n </button>\n }\n\n </mat-menu>\n</mat-toolbar>\n\n<span>\n @switch (selectedService) {\n @case ('http_service') {\n <p>\n <ng-container *ngTemplateOutlet=\"HTTP_OPTIONS\"></ng-container>\n <app-request-manager-demo\n [server]=\"server\"\n [adapter]=\"adapter\"\n [mapper]=\"mapper\"\n ></app-request-manager-demo>\n </p>\n }\n <!-- <p *ngSwitchCase=\"'http_signals_service'\">\n <ng-container *ngTemplateOutlet=\"HTTP_OPTIONS\"></ng-container>\n <app-request-signals-manager-demo></app-request-signals-manager-demo>\n </p> -->\n @case ('http_state_service') {\n <p>\n <ng-container *ngTemplateOutlet=\"HTTP_OPTIONS\"></ng-container>\n <app-request-manager-state-demo\n [server]=\"server\"\n [adapter]=\"adapter\"\n [mapper]=\"mapper\"\n ></app-request-manager-state-demo>\n </p>\n }\n @case ('http_state_service_ws') {\n <p>\n <ng-container *ngTemplateOutlet=\"HTTP_OPTIONS\"></ng-container>\n <app-request-manager-ws-demo\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-request-manager-ws-demo>\n </p>\n }\n @case ('database_service') {\n <p>\n <app-database-data-demo></app-database-data-demo>\n </p>\n }\n @case ('local_storage_service') {\n <p>\n <ng-container *ngTemplateOutlet=\"LOCAL_OPTIONS\"></ng-container>\n <app-local-storage-demo></app-local-storage-demo>\n </p>\n }\n <!-- <p *ngSwitchCase=\"'local_storage_signals_service'\">\n <ng-container *ngTemplateOutlet=\"LOCAL_OPTIONS\"></ng-container>\n <app-local-storage-signals-demo></app-local-storage-signals-demo>\n</p> -->\n@case ('store_state_manager') {\n <p>\n <ng-container *ngTemplateOutlet=\"LOCAL_OPTIONS\"></ng-container>\n <app-store-state-manager-demo></app-store-state-manager-demo>\n </p>\n}\n@default {\n <p>\n Other\n </p>\n}\n}\n</span>\n\n<ng-template #HTTP_OPTIONS>\n @if (injectionOptions?.httpRequestOptions) {\n <div class=\"box\">\n <h3 style=\"font-weight: bold;\">Injection Token Detected - HTTP Options</h3>\n {{ injectionOptions?.httpRequestOptions| json }}\n </div>\n }\n</ng-template>\n\n<ng-template #LOCAL_OPTIONS>\n @if (injectionOptions?.LocalStorageOptions) {\n <ng-container class=\"box\">\n <div class=\"box\">\n <h3 style=\"font-weight: bold;\">Injection Token Detected - LocalStorage Options</h3>\n {{ injectionOptions?.LocalStorageOptions| json }}\n </div>\n </ng-container>\n }\n</ng-template>\n\n\n", styles: [".box{padding:1rem;background-color:#f5f5f5;border:thin gray solid;margin-top:1rem}\n"], dependencies: [{ kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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: i6.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: i11.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i3$
|
|
5988
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: HttpRequestServicesDemoComponent, selector: "app-http-request-services-demo", inputs: { wsServer: "wsServer", jwtToken: "jwtToken", server: "server", user: "user", adapter: "adapter", mapper: "mapper" }, ngImport: i0, template: "<mat-toolbar style=\"display:flex\">\n <div>Http Request Manager Services</div>\n <div style=\"flex:1\"></div>\n <button mat-stroked-button [matMenuTriggerFor]=\"menu\">Services</button>\n <mat-menu #menu=\"matMenu\">\n @for (type of requestTypes; track type; let i = $index) {\n @if (type?.divider) {\n <div\n style=\"margin-top: .5rem; margin-bottom: .5rem;\"\n >\n <mat-divider></mat-divider>\n </div>\n }\n <button\n mat-menu-item\n (click)=\"onSelected(i)\"\n [disabled]=\"type.disabled\"\n >\n {{ type.name }}\n </button>\n }\n\n </mat-menu>\n</mat-toolbar>\n\n<span>\n @switch (selectedService) {\n @case ('http_service') {\n <p>\n <ng-container *ngTemplateOutlet=\"HTTP_OPTIONS\"></ng-container>\n <app-request-manager-demo\n [server]=\"server\"\n [adapter]=\"adapter\"\n [mapper]=\"mapper\"\n ></app-request-manager-demo>\n </p>\n }\n <!-- <p *ngSwitchCase=\"'http_signals_service'\">\n <ng-container *ngTemplateOutlet=\"HTTP_OPTIONS\"></ng-container>\n <app-request-signals-manager-demo></app-request-signals-manager-demo>\n </p> -->\n @case ('http_state_service') {\n <p>\n <ng-container *ngTemplateOutlet=\"HTTP_OPTIONS\"></ng-container>\n <app-request-manager-state-demo\n [server]=\"server\"\n [adapter]=\"adapter\"\n [mapper]=\"mapper\"\n ></app-request-manager-state-demo>\n </p>\n }\n @case ('http_state_service_ws') {\n <p>\n <ng-container *ngTemplateOutlet=\"HTTP_OPTIONS\"></ng-container>\n <app-request-manager-ws-demo\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-request-manager-ws-demo>\n </p>\n }\n @case ('database_service') {\n <p>\n <app-database-data-demo></app-database-data-demo>\n </p>\n }\n @case ('local_storage_service') {\n <p>\n <ng-container *ngTemplateOutlet=\"LOCAL_OPTIONS\"></ng-container>\n <app-local-storage-demo></app-local-storage-demo>\n </p>\n }\n <!-- <p *ngSwitchCase=\"'local_storage_signals_service'\">\n <ng-container *ngTemplateOutlet=\"LOCAL_OPTIONS\"></ng-container>\n <app-local-storage-signals-demo></app-local-storage-signals-demo>\n</p> -->\n@case ('store_state_manager') {\n <p>\n <ng-container *ngTemplateOutlet=\"LOCAL_OPTIONS\"></ng-container>\n <app-store-state-manager-demo></app-store-state-manager-demo>\n </p>\n}\n@default {\n <p>\n Other\n </p>\n}\n}\n</span>\n\n<ng-template #HTTP_OPTIONS>\n @if (injectionOptions?.httpRequestOptions) {\n <div class=\"box\">\n <h3 style=\"font-weight: bold;\">Injection Token Detected - HTTP Options</h3>\n {{ injectionOptions?.httpRequestOptions| json }}\n </div>\n }\n</ng-template>\n\n<ng-template #LOCAL_OPTIONS>\n @if (injectionOptions?.LocalStorageOptions) {\n <ng-container class=\"box\">\n <div class=\"box\">\n <h3 style=\"font-weight: bold;\">Injection Token Detected - LocalStorage Options</h3>\n {{ injectionOptions?.LocalStorageOptions| json }}\n </div>\n </ng-container>\n }\n</ng-template>\n\n\n", styles: [".box{padding:1rem;background-color:#f5f5f5;border:thin gray solid;margin-top:1rem}\n"], dependencies: [{ kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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: i6.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i6.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i6.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: i11.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i3$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: RequestManagerStateDemoComponent, selector: "app-request-manager-state-demo", inputs: ["server", "adapter", "mapper"] }, { kind: "component", type: RequestManagerDemoComponent, selector: "app-request-manager-demo", inputs: ["server", "adapter", "mapper"] }, { kind: "component", type: LocalStorageDemoComponent, selector: "app-local-storage-demo" }, { kind: "component", type: RequestManagerWsDemoComponent, selector: "app-request-manager-ws-demo", inputs: ["server", "wsServer", "jwtToken", "user"] }, { kind: "component", type: StoreStateManagerDemoComponent, selector: "app-store-state-manager-demo" }, { kind: "component", type: DatabaseDataDemoComponent, selector: "app-database-data-demo" }, { kind: "pipe", type: i1$1.JsonPipe, name: "json" }] }); }
|
|
6001
5989
|
}
|
|
6002
5990
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HttpRequestServicesDemoComponent, decorators: [{
|
|
6003
5991
|
type: Component,
|
|
@@ -6027,5 +6015,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
6027
6015
|
* Generated bundle index. Do not edit.
|
|
6028
6016
|
*/
|
|
6029
6017
|
|
|
6030
|
-
export { ApiRequest, AppService, AsymmetricalEncryptionService, CONFIG_SETTINGS_TOKEN, ChannelInfo,
|
|
6018
|
+
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 };
|
|
6031
6019
|
//# sourceMappingURL=http-request-manager.mjs.map
|