import { AsyncModel, Model } from "./models"; import { AsyncStore, Store } from "./stores"; class ModelStoreRegistry { private readonly stores: Record | AsyncStore> = {}; private readonly models: Record = {}; public registerStore(storeId: string, store: Store | AsyncStore) { this.stores[storeId] = store; } public getStore(storeId: string): Store | AsyncStore { return this.stores[storeId]; } public registerModel(model: T) { this.models[model.id] = model; } public getModel(modelId: string): typeof Model | typeof AsyncModel { return this.models[modelId]; } public allStores(): Record | AsyncStore> { return this.stores; } } export type { ModelStoreRegistry }; export default new ModelStoreRegistry();