import * as React from 'react'; export type Path = string; export type CallbackNames = string | string[]; export interface OfflineConfig { offline?: boolean; autoRecover?: boolean; excludes?: string[]; customizer?: (...args: any[]) => any; } export interface GetOptions { autoCreate?: boolean; defaultValue?: T; referenced?: boolean; resetField?: boolean; resetValue?: unknown; } export interface SetStateOptions { cancelUpdate?: boolean; callbacks?: CallbackNames; referenced?: boolean; } export interface ChangeEvent { actiontype: string; name: string; currentvalue: TCurrent; prevalue: TPrevious; otherprevalues?: TOther; currentstore: Record; } export interface InternalAction { type: string; name: string; data?: any; initdate?: any; inner?: symbol; cancelUpdate?: boolean; referenced?: boolean; } export interface DispatchAction { type: string; store?: Store; [key: string]: any; } export interface RefreshCacheEntry { _s: string; set: React.Dispatch>; } export interface OfflineInstance { dropInstance?(): Promise; setItem(key: string, value: any): Promise; getItem?(key: string): Promise; iterate?( iterator: (value: T, key: string, iterationNumber: number) => void, ): Promise; keys(): Promise; [key: string]: any; } export interface Store { offline: boolean; offlineInstance: OfflineInstance; offlineExcludes: string[]; dispatch?: (action: InternalAction) => Promise; inner: symbol; MODELS: Record>; REFRESH_CACHE: Record; REDUCER?: (action: InternalAction) => Promise; isDispatching: { dispatching: boolean; name: string | null; }; runtime_state: Record; dispatch_queue: Array<{ uid: string; action: InternalAction; }>; dispatchPromise: Promise | null; changeSubscribes: Record void>; observerSubscribes: Record void>>; debounceTimers: Map>; previousStateMap: Map; currentStateMap: Map; onChangeOtherProps: Record; [key: string]: any; } export type ModelSetter = ( value: T, options?: SetStateOptions, ) => Promise; export type ModelSelectorResult = [T, ModelSetter, () => T]; export interface EffectHelpers { state: TState; setState: ModelSetter; select: ( name: Path, options?: GetOptions, ) => ModelSelectorResult; reference: ( name: Path, options?: Omit, 'referenced'>, ) => ModelSelectorResult; getDispatch: ( action: DispatchAction, ) => (...args: TArgs) => TResult; offlineInstance: OfflineInstance; [key: string]: any; } export type ModelEffect< TState = any, TArgs extends unknown[] = any[], TResult = any, TExtra extends object = Record, > = (...args: [...TArgs, EffectHelpers & TExtra]) => TResult; export interface CallbackHelpers { info: any; select: ( name: Path, options?: GetOptions, ) => ModelSelectorResult; getDispatch: ( action: DispatchAction, ) => (...args: TArgs) => TResult; } export type ModelCallbacks = Record void>; export interface Model< TState = any, TEffects extends Record> = Record>, TCallbacks extends ModelCallbacks = ModelCallbacks, > { name: string; init?: TState | (() => TState); effects?: TEffects; callbacks?: TCallbacks; [key: string]: any; } export interface ProviderProps { isolated?: boolean; uniqueKey?: string | number; models?: Model[]; offlineConfig?: OfflineConfig; noCached?: boolean; children?: React.ReactNode; [key: string]: any; } export interface UseChangeOptions { store?: Store; others?: string[]; } export interface DynamicModule { default?: Model | Model[]; } export type DynamicModelResource = Model | Model[] | DynamicModule; export type DynamicModelsProp = | (() => DynamicModelResource | Promise) | Array>; export interface DynamicProps { models?: DynamicModelsProp; renderBefore?: () => void; component: () => Promise<{ default: React.ComponentType; }>; [key: string]: any; } export interface ConnectActionConfig { name: TName; action: DispatchAction; } export type ConnectedStateProps = Record< `${TModel}State`, TState > & Record<`set${TModel}`, ModelSetter>; export type ConnectedActionProps< TName extends string, TArgs extends unknown[] = any[], TResult = any, > = Record TResult>; declare const Provider: React.FC; export default Provider; export function connect< TModel extends string, TState = any, TActionName extends string = string, TArgs extends unknown[] = any[], TResult = any, P extends object = {}, >( model: TModel, action: ConnectActionConfig, ): ( Component: React.ComponentType< P & ConnectedStateProps & ConnectedActionProps >, ) => React.FC

; export function connect< TModel extends string, TState = any, P extends object = {}, >( model: TModel, ): ( Component: React.ComponentType

>, ) => React.FC

; export const Dynamic: React.FC; export function useAdd( name: Path, initdata: T | (() => T), once?: boolean, ): void; export function useDispatch( action: DispatchAction, ): (...args: TArgs) => TResult; export function useModel( name: Path, cancelUpdate?: boolean, store?: Store, options?: GetOptions, ): ModelSelectorResult; export function useChange( callback: (event: ChangeEvent) => void, dependencies?: React.DependencyList, options?: UseChangeOptions, ): void; export function useObserver( path: Path, callback: (...args: any[]) => void, dependencies?: React.DependencyList, store?: Store, ): void; export function useReference( name: Path, cancelUpdate?: boolean, options?: GetOptions & { store?: Store }, ): [T, ModelSetter]; export function useNearestStore(): Store | undefined; export function getStoreByUniqueKey( uniqueKey?: string | number | null, ): Store | undefined; export function checkPrefixRelation( prearray: string[], currentarray: string[], ): boolean; export function getPathArray(path: Path): string[]; export function clone(value: T, offline?: boolean): T; export function get( name: Path, store: Store, options?: GetOptions, ): ModelSelectorResult;