import { Observable , Subscription } from 'rxjs' ; import { Store } from 'vuex' ; import { XBus } from '../plugins/x-bus.types' ; import { RootStoreStateAndGetters , RootXStoreState } from '../store' ; import { FeatureLocation , QueryFeature } from '../types/origin' ; import { Dictionary , FirstParameter , MaybeArray , MonadicFunction , NiladicFunction , PropsWithType } from '../utils' ; import { XModuleName } from '../x-modules/x-modules.types' ; import { XEvent , XEventPayload } from './events.types' ; param PayloadType public export type Wire < PayloadType > = ( observable : Observable < WirePayload < PayloadType > > , store : Store < RootXStoreState > , on : XBus [ 'on' ] ) => Subscription ; public export interface WireMetadata { /** The  QueryFeature that originated the event.  feature ? : QueryFeature ; /** The id of the component origin. */ id ? : string ; /** The  FeatureLocation from where the event has been emitted.  location ? : FeatureLocation ; /** The  XModule name that emitted the event or `null` if it has been emitted from an
     * unknown module.  moduleName : XModuleName | null ; /** The old value of a watched selector triggering an emitter.  */ oldValue ? : unknown ; /** The DOM element that triggered the event emission. */ target ? : HTMLElement ; } /**
 * The wire payload includes the payload of the event, and a  WireMetadata object to add
 * more information to the event.
 *
 *  param PayloadType public export interface WirePayload < PayloadType > { /** The payload of the event, which must be of type  XEventPayload .  eventPayload : PayloadType ; /** An object containing information about the emission of the event. */ metadata : WireMetadata ; } /**
 * Type not safe which allows the access to the State, the Getters, the payload and metadata of
 * a  XStoreModule .
 *
 *  public export type PayloadFactoryData < Payload > = RootStoreStateAndGetters & { eventPayload : Payload ; metadata : WireMetadata ; } ; param Event public export type WireForEvent < Event extends XEvent > = Wire < XEventPayload < Event > > ; public export type AnyWire = Wire < any > ; public export type Wiring = { [ E in XEvent ] : Dictionary < WireForEvent < E > > ; } ; param Payload public export interface WireParams < Payload > extends WirePayload < Payload > { store : Store < RootXStoreState > ; } public export type TimeSelector = ( storeModule : Store < RootXStoreState > ) => number ; public export interface TimedWireOperatorOptions { /** Events that will prevent the next planned execution of the wire to be executed. */ cancelOn ? : MaybeArray < XEvent > ; /** Events that will make the next planned execution happen immediately. */ forceOn ? : MaybeArray < XEvent > ; } public export interface WireService < SomeService > { param method returns < SomeMethod extends PropsWithType < SomeService , MonadicFunction > > ( method ) : Wire < FirstParameter < SomeService [ SomeMethod ] > > ; param method param payload returns < SomeMethod extends PropsWithType < SomeService , MonadicFunction > > ( method , payload ) : AnyWire ; } public export interface WireServiceWithoutPayload < SomeService > { param method returns < SomeMethod extends PropsWithType < SomeService , NiladicFunction > > ( method ) : AnyWire ; }