Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 3x | import { InjectionToken } from '@angular/core';
import type { IReducerConfig } from '@app/client-util-ngrx';
import type { ActionReducer } from '@ngrx/store';
import type { WebSocketSubjectConfig } from 'rxjs/webSocket';
export interface IWebsocketRequestEvent {
event: string;
}
export interface IWebsocketResponseEvent<T = unknown> {
event: string;
data: T;
}
export type TDiagnosticData = Record<string, string | number>;
/** Diagnostics state model. */
export interface IDiagnosticsStateModel {
users: number;
events: Array<IWebsocketResponseEvent<TDiagnosticData[]>>;
staticData: TDiagnosticData[];
dynamicData: TDiagnosticData[];
}
/** Diagnostics state. */
export interface IDiagnosticsState {
diagnostics: IDiagnosticsStateModel;
}
export interface IWebsocketConfig extends WebSocketSubjectConfig<IWebsocketRequestEvent> {
url: string;
}
export type TWsConfigToken = InjectionToken<IWebsocketConfig>;
export const WS_CONFIG: TWsConfigToken = new InjectionToken<IWebsocketConfig>('WS_CONFIG');
/** Diagnostics reducer configuration. */
export const diagnosticsReducerConfig: IReducerConfig<keyof IDiagnosticsState, IDiagnosticsStateModel> = {
featureName: 'diagnostics',
token: new InjectionToken<ActionReducer<IDiagnosticsStateModel>>('diagnostics reducer'),
initialState: {
users: 0,
events: [],
dynamicData: [],
staticData: [],
},
};
|