import { WindowHapiEventCommandData, WindowHapiEventCommandNames, WindowHapiEventCommandStatus } from "../common/events/EventCommand/types"; import { WindowHapiEventAddEventListenerOptions, WindowHapiEventCommand, WindowHapiEventCommandCallbackHandler, WindowHapiEventListener, WindowHapiEventMediatorGetInstancesHandler, WindowHapiEventMediatorInstances, WindowHapiEventStrategy } from "../common/events/types"; import { WindowHapiClassInterface, WindowHapiModuleWithConstructorArgs } from "./window"; import { WindowHapiSubmoduleName } from "../common/enums"; import { WindowHapiInstance } from "./instances.types"; export type WindowHapiEventBatchStats = { totalBatched: number; totalBatches: number; totalEventsInBatches: number; }; export type WindowHapiEventFactory = WindowHapiModuleWithConstructorArgs<{ findEventsPendingResolveOrReject: (events: WindowHapiEventCommand[], id: string) => WindowHapiEventCommand | undefined; findOrCreate: (events: WindowHapiEventCommand[], name: WindowHapiEventCommandNames, value: WindowHapiEventCommandData, instances: WindowHapiEventMediatorInstances, id?: string, status?: WindowHapiEventCommandStatus, createdAt?: string, updatedAt?: string) => WindowHapiEventCommand; create: (name: WindowHapiEventCommandNames, data: WindowHapiEventCommandData, getInstances: WindowHapiEventMediatorGetInstancesHandler, id?: string, status?: WindowHapiEventCommandStatus, createdAt?: string, updatedAt?: string) => WindowHapiEventCommand; }, { readonly getInstances: WindowHapiEventMediatorGetInstancesHandler; }>; export type WindowHapiEventMediatorCreateAndDispatchHandler = (name: WindowHapiEventCommandNames, data?: WindowHapiEventCommandData, id?: string, status?: WindowHapiEventCommandStatus, getInstances?: WindowHapiEventMediatorGetInstancesHandler, batched?: boolean) => Promise; export type WindowHapiEventMediator = WindowHapiModuleWithConstructorArgs<{ createAndDispatch: WindowHapiEventMediatorCreateAndDispatchHandler; createAndDispatchDebounced: (leading: boolean) => WindowHapiEventMediatorCreateAndDispatchHandler; removeListener: (name: WindowHapiEventCommandNames) => void; onMessageReceived: (eventCommand: WindowHapiEventCommand) => Promise; onMessage: (messageEvent: MessageEvent) => Promise; runCallbacks: (eventCommand: WindowHapiEventCommand) => void; onRequestFullfilledOrTimedOut: (resolve: any, reject: any, request: WindowHapiEventCommand) => void; dispatchEvent: (eventCommand: WindowHapiEventCommand, batched?: boolean) => Promise; retryEvent: (eventCommand: WindowHapiEventCommand) => Promise; acknowledgeEvent: (event: WindowHapiEventCommand) => void; rejectEvent: (event: WindowHapiEventCommand) => Promise; resolveEvent: (event: WindowHapiEventCommand) => Promise; removeMessageEventListener: (_window: Window) => void; addMessageEventListener: (_window: Window) => void; getEventListener: (name: WindowHapiEventCommandNames, id?: string) => WindowHapiEventListener | undefined; getEventListenerById: (id: string, customPredicate?: (listener: WindowHapiEventListener) => boolean) => WindowHapiEventListener | undefined; createListener: (name: WindowHapiEventCommandNames, callback: WindowHapiEventCommandCallbackHandler | undefined, id?: string, parentListenerId?: string, options?: WindowHapiEventAddEventListenerOptions) => WindowHapiEventListener; addEventListenerToEventStorage: (listener: WindowHapiEventListener) => void; addEventListener: (name: WindowHapiEventCommandNames, callback: WindowHapiEventCommandCallbackHandler, id?: string, parentListenerId?: string, options?: WindowHapiEventAddEventListenerOptions) => WindowHapiEventListener; removeEventListener: (eventId: string) => void; isCountingEnabled: boolean; dispatchCount: Map; receiveCount: Map; isBatchingEnabled: boolean; batchStats: Map; getBatchStats: () => Map; flushBatch: (eventName: WindowHapiEventCommandNames) => Promise; }, { readonly getInstances: WindowHapiEventMediatorGetInstancesHandler; readonly eventStorage: WindowHapiEventStorage; readonly eventFactory: WindowHapiEventFactory; readonly eventStateStrategy?: WindowHapiEventStrategy; readonly eventRoutingStrategy?: WindowHapiEventStrategy; readonly eventDOMStrategy?: WindowHapiEventStrategy; readonly eventConfigStrategy?: WindowHapiEventStrategy; readonly eventAppStrategy?: WindowHapiEventStrategy; readonly eventApiStrategy?: WindowHapiEventStrategy; readonly eventServiceStrategy?: WindowHapiEventStrategy; readonly eventQAStrategy?: WindowHapiEventStrategy; readonly onReceive?: (eventCommand: WindowHapiEventCommand | undefined) => void; readonly onDispatch?: (eventCommand: WindowHapiEventCommand | undefined) => void; }>; export type WindowHapiEventStorageRemoveHandler = (id: string) => void; export type WindowHapiEventStorageClearHandler = () => void; export type WindowHapiEventStorage = WindowHapiModuleWithConstructorArgs<{ cache: (WindowHapiEventCommand | WindowHapiEventListener)[]; listeners: WindowHapiEventListener[]; getFullfilledRequest: (eventCommandId: string) => WindowHapiEventCommand; replaceById: (eventCommand: WindowHapiEventCommand) => void; getEventById: (eventCommandId: string) => WindowHapiEventCommand | WindowHapiEventListener | undefined; add: (eventCommand: WindowHapiEventCommand | WindowHapiEventListener) => void; remove: WindowHapiEventStorageRemoveHandler; removeByName: (name: string) => void; getEventsByName: (name: string) => (WindowHapiEventCommand | WindowHapiEventListener)[]; }, { readonly getInstances: WindowHapiEventMediatorGetInstancesHandler; readonly onAdd?: (eventCommand: WindowHapiEventCommand | WindowHapiEventListener) => void; }>; export type WindowHapiEventStateStrategy = { subscriptions: Map>; isPathSubscribed: (instanceName: string, stateModuleName: string, key: string) => boolean; onHydrateState: (event: WindowHapiEventCommand) => void; onStateSubscribe: (event: WindowHapiEventCommand) => void; }; export type WindowHapiEvents = WindowHapiModuleWithConstructorArgs<{ hasAddedWindowMessageEvent: boolean; addInternalEventListeners: () => void; removeInternalEventListeners: () => void; eventFactory: WindowHapiEventFactory; eventMediator: WindowHapiEventMediator; eventStorage: WindowHapiEventStorage; eventRoutingStrategy: WindowHapiEventStrategy; eventAppStrategy: WindowHapiEventStrategy; eventApiStrategy: WindowHapiEventStrategy; eventStateStrategy: WindowHapiEventStrategy & WindowHapiEventStateStrategy; eventServiceStrategy: WindowHapiEventStrategy; eventQAStrategy: WindowHapiEventStrategy; eventDOMStrategy: WindowHapiEventStrategy; eventConfigStrategy: WindowHapiEventStrategy; getInstances: () => { source: WindowHapiInstance; targets: WindowHapiInstance[]; }; handleEventWithDataRequest: (event: WindowHapiEventCommand, coreModuleName: WindowHapiSubmoduleName) => Promise; }, { readonly core: WindowHapiClassInterface; }>; //# sourceMappingURL=events.types.d.ts.map