UNPKG

@furystack/core

Version:
28 lines 1.1 kB
import type { Constructable } from '@furystack/inject'; import type { PhysicalStore } from './models/physical-store.js'; /** * Manager class for store instances */ export declare class StoreManager implements AsyncDisposable { /** * Disposes the StoreManager and all store instances */ [Symbol.asyncDispose](): Promise<void>; private stores; /** * Returns a store model for a constructable object. * Throws error if no store is registered * @param model The Constructable object * @param primaryKey The Primary Key field * @throws if the Store is not registered * @returns a Store object */ getStoreFor<T, TPrimaryKey extends keyof T, TType extends PhysicalStore<T, TPrimaryKey>>(model: Constructable<T>, primaryKey: TPrimaryKey): TType; /** * Adds a store instance to the StoreManager class * @param store The store to add * @returns the StoreManager instance for chaining */ addStore<T, TPrimaryKey extends keyof T>(store: PhysicalStore<T, TPrimaryKey>): this; } //# sourceMappingURL=store-manager.d.ts.map