import type { ActionNamesFor, ExtractActionPayload, ExtractActions, ExtractMutationPayload, ExtractMutations, ExtractPayload, MutationNamesFor, StoreModuleStateAndGetters } from '../store/store.types'; import type { PropsWithType } from '../utils/types'; import type { XModuleName, XModulesTree } from '../x-modules/x-modules.types'; import type { AnyWire, TimedWireOperatorOptions, Wire, WireMetadata } from './wiring.types'; /** * Function type which receives the State and the Getters of the namespace {@link XStoreModule} * to retrieve the time from there. * * @param ModuleName - The {@link XModuleName} of the module to create a * {@link StoreModuleStateAndGetters}. * * @public */ export type NamespacedTimeSelector = (storeModule: StoreModuleStateAndGetters) => number; /** * Function type which receives the wire to modify and the {@link NamespacedTimeSelector} to * retrieve the time from the {@link XStoreModule}. * * @param ModuleName - The {@link XModuleName} of the module to create a namespaced * {@link NamespacedTimeSelector}. * @param Wire - The wire which will be piped with a timing operator. * @param timeInMs - Function that receives the state and the getters of the given module * {@link XStoreModule} to retrieve the time. * @param options - Options to configure events that should make the planned wire execution happen * immediately or be aborted. * * @public */ export type NamespacedTimeWireOperator = (wire: Wire, timeInMs: NamespacedTimeSelector, options?: TimedWireOperatorOptions) => Wire; /** * Namespaced payload to commit a mutation. Either a function that receives the * {@link StoreModuleStateAndGetters | module state and getters} and returns the payload for * the mutation, or a static action payload. * * @param ModuleName - The {@link XModuleName | module name}. * @param MutationName - The namespaced mutation name to extract the payload. * * @public */ export type NamespacedWireCommitPayload> = ExtractMutationPayload | ((wiringData: NamespacedWiringData) => ExtractMutationPayload); /** * Namespaced type for the {@link (wireCommit:1)} which creates a wire with its payload * associated. Possible ways for creating a wire that commits a mutation. * If a payload is passed, then the observable payload can be ignored, so the wire is * applicable to any event. * If no payload is passed, then the wire is only applicable to events with the same payload * type than the mutation. * * @param ModuleName - The {@link XModuleName | module name}. * * @public */ export interface NamespacedWireCommit { >(mutation: MutationName): Wire>; >(mutation: MutationName, payload: NamespacedWireCommitPayload): AnyWire; } /** * Namespaced type for the {@link (wireCommitWithoutPayload:1)} which creates a wire without * payload associated. * * @param MutationName - The namespaced mutation name to extract the payload. * * @public */ export type NamespacedWireCommitWithoutPayload = , () => any>>(mutation: MutationName) => AnyWire; /** * Namespaced payload to dispatch an action. Either a function that receives the * {@link StoreModuleStateAndGetters | module state and getters} and returns the payload for * the action, or a static action payload. * * @param ModuleName - The {@link XModuleName | module name}. * @param ActionName - The namespaced action name to extract the payload. * * @public */ export type NamespacedWireDispatchPayload> = ExtractActionPayload | ((wiringData: NamespacedWiringData) => ExtractActionPayload); /** * Namespaced type for the {@link (wireDispatch:1)} which creates a wire with its payload * associated. Possible ways for creating a wire that dispatches an action. * If a payload is passed, then the observable payload can be ignored, so the wire is * applicable to any event. * If no payload is passed, then the wire is only applicable to events with the same payload * type than the action. * * @param ModuleName - The {@link XModuleName | module name}. * * @public */ export interface NamespacedWireDispatch { >(action: ActionName): Wire>; >(action: ActionName, payload: NamespacedWireDispatchPayload): AnyWire; } /** * Namespaced type for the {@link (wireDispatchWithoutPayload:1)} which creates a wire without * payload associated. * * @param ActionName - The namespaced action name to extract the payload. * * @public */ export type NamespacedWireDispatchWithoutPayload = , () => any>>(action: ActionName) => AnyWire; /** * Namespaced type safe which allows the access to the State, the Getters, the payload and metadata * of a {@link XStoreModule}. * * @public */ export type NamespacedWiringData = StoreModuleStateAndGetters & { eventPayload: ExtractPayload; metadata: WireMetadata; }; //# sourceMappingURL=namespaced-wiring.types.d.ts.map