import type { AccessorCreator, InfiniteAccessorCreator, Model as OrigModel } from './createModel.js'; import type { NotifyDatabaseContext, Action as OrigAction, InfiniteAction as OrigInfiniteAction } from './types.js'; import type { AutoState, AutoModel as OrigAutoModel, AutoAction as OrigAutoAction, AutoInfiniteAction as OrigAutoInfiniteAction } from './createAutoModel.js'; type Action = OrigAction & { name: string; }; type InfiniteAction = OrigInfiniteAction & { name: string; }; type AutoAction = OrigAutoAction & { name: string; }; type AutoInfiniteAction = OrigAutoInfiniteAction & { name: string; }; type Model = Omit, 'defineAccessor' | 'defineInfiniteAccessor'> & { defineAccessor(action: Action): AccessorCreator; defineInfiniteAccessor(action: InfiniteAction): InfiniteAccessorCreator; }; type AutoModel = Omit & { defineAccessor(action: AutoAction): AccessorCreator; defineInfiniteAccessor(action: AutoInfiniteAction): InfiniteAccessorCreator; }; export interface Database { createModel(options: { name: string; initialState: S; }): Model; createAutoModel(options: { name: string; }): AutoModel; /** * We use server state key to register the callback. * One server state key can only register one callback. * * This method is not useful for general use case, feel free to ignore this method. */ subscribe(serverStateKey: object, cb: (ctx: NotifyDatabaseContext) => void): void; /** * This method is not useful for general use case, feel free to ignore this method. */ getModel(modelName: string): Model | AutoModel | undefined; } export declare function createDatabase(): Database; export {};