extends true ? unknown : A extends object ? A : unknown : unknown;
type InferPluginContribution = P extends ClientPlugin ? InferRoutes> & ActionsOf : unknown;
type CombinedClientContributions = UnionToIntersection<{ [K in keyof Plugins]: InferPluginContribution }[number]>;
/**
* The extra fields a plugin contributes to one model (`M`) via `schema`. Widened
* `any` and non-object declarations contribute nothing, so the folded type never
* collapses into an open index signature.
*/
type ModelFieldsOf = P extends {
schema?: infer S;
} ? IsAny extends true ? Record : FieldsOf> : Record;
/** Intersection of every registered plugin's contributions to one model. */
type PluginModelFields = UnionToIntersection<{ [K in keyof Plugins]: ModelFieldsOf }[number]>;
/** A consumer's `TFields` widened with all plugin-contributed `user` fields. */
type InferUserFields = User & PluginModelFields;
/** The value each store in a registration record holds. */
type StoreValues = { [K in keyof S]: S[K] extends DataStore ? StoreState : never };
/**
* The store values one plugin registers. Widened `any` registers nothing, so
* the merged map never collapses into an open index signature.
*/
type StoresOfPlugin = P extends {
stores?: infer S;
} ? IsAny extends true ? Record : S extends ((ctx: never) => infer R) ? R extends PluginStores ? StoreValues : Record : Record : Record;
/** Every registered plugin's store values, merged. */
type PluginStoresOf = UnionToIntersection<{ [K in keyof Plugins]: StoresOfPlugin }[number]>;
/** The stores the core owns. Session carries the plugin-enriched user shape. */
type CoreStores = {
session: SessionState>>;
};
/** Every store on a client, as the values they hold. */
type StoresOf = CoreStores & PluginStoresOf;
//#endregion
export { CombinedClientContributions, CoreStores, InferPluginContribution, InferUserFields, StoreValues, StoresOf };