import { keycloak, server } from "../const/config"; import { RTMT, RTMTWS, ThemeManager } from "@mancala/core"; import { HttpServiceImpl } from "../service/HttpService"; import { GameStore, GameStoreImpl } from "../store/GameStore"; import { AuthService } from "../auth/AuthService"; import { LocalStorage } from "../storage"; import { Storage } from '@mancala/core' export type Context = { rtmt: RTMT; authService: AuthService; themeManager: ThemeManager; gameStore: GameStore; storage: Storage; }; export const initContext = (): Context => { const rtmt = new RTMTWS(); const httpService = new HttpServiceImpl(server.serverAdress); const authService = new AuthService({ keycloakUrl: keycloak.url, realm: keycloak.realm, clientId: keycloak.clientId }); const gameStore = new GameStoreImpl({ httpService }); const storage = new LocalStorage(); const themeManager = new ThemeManager(storage); return { rtmt: rtmt, authService, themeManager, gameStore, storage }; };