fastevent 2.1.2 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,49 @@
1
- type FastListenerExecutor = (listeners: FastListenerMeta[], message: FastEventMessage, args: FastEventListenerArgs, execute: (listener: FastEventListener, message: FastEventMessage, args: FastEventListenerArgs, catchErrors?: boolean) => Promise<any> | any) => Promise<any[]> | any[];
1
+ type FastListenerExecutor = (listeners: FastListenerMeta[], message: TypedFastEventMessage, args: FastEventListenerArgs, execute: (listener: TypedFastEventListener, message: TypedFastEventMessage, args: FastEventListenerArgs, catchErrors?: boolean) => Promise<any> | any) => Promise<any[]> | any[];
2
2
 
3
- type FastListenerPipe = (listener: FastEventListener) => FastEventListener;
3
+ type FastListenerPipe = (listener: TypedFastEventListener) => TypedFastEventListener;
4
4
 
5
- interface FaseEventMessageExtends {
6
- }
7
5
  interface FastEventMeta {
8
6
  }
9
- type FastEventMessage<Events extends Record<string, any> = Record<string, any>, M = any> = ({
7
+ interface FastEventMessageExtends {
8
+ }
9
+ type FastEventMessage<P = any, M extends Record<string, any> = Record<string, any>, T extends string = string> = {
10
+ type: T;
11
+ payload: P;
12
+ meta?: M & Partial<FastEventMeta>;
13
+ } & FastEventMessageExtends;
14
+ type TypedFastEventMessage<Events extends Record<string, any> = Record<string, any>, M = any> = ({
10
15
  [K in keyof Events]: {
11
16
  type: Exclude<K, number | symbol>;
12
17
  payload: Events[K];
13
18
  meta: FastEventMeta & M & Record<string, any>;
14
19
  };
15
- }[Exclude<keyof Events, number | symbol>]) & FaseEventMessageExtends;
20
+ }[Exclude<keyof Events, number | symbol>]) & FastEventMessageExtends;
21
+ type TypedFastEventMessageOptional<Events extends Record<string, any> = Record<string, any>, M = any> = ({
22
+ [K in keyof Events]: {
23
+ type: Exclude<K, number | symbol>;
24
+ payload: Events[K];
25
+ meta?: DeepPartial<FastEventMeta & M & Record<string, any>>;
26
+ };
27
+ }[Exclude<keyof Events, number | symbol>]) & FastEventMessageExtends;
16
28
  type FastEventEmitMessage<Events extends Record<string, any> = Record<string, any>, M = any> = ({
17
29
  [K in keyof Events]: {
18
30
  type: Exclude<K, number | symbol>;
19
31
  payload?: Events[K];
20
- meta?: Partial<FastEventMeta> & M & Record<string, any>;
32
+ meta?: DeepPartial<FastEventMeta & M & Record<string, any>>;
21
33
  };
22
- }[Exclude<keyof Events, number | symbol>]) & FaseEventMessageExtends;
23
- type FastEventListener<T extends string = string, P = any, M = any, C = any> = (this: C, message: FastEventMessage<{
34
+ }[Exclude<keyof Events, number | symbol>]) & FastEventMessageExtends;
35
+ type TypedFastEventListener<T extends string = string, P = any, M = any, C = any> = (this: C, message: TypedFastEventMessage<{
24
36
  [K in T]: P;
25
37
  }, M>, args: FastEventListenerArgs<M>) => any | Promise<any>;
26
- type FastEventAnyListener<Events extends Record<string, any> = Record<string, any>, Meta = never, Context = any> = (this: Context, message: FastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => any | Promise<any>;
38
+ type TypedFastEventAnyListener<Events extends Record<string, any> = Record<string, any>, Meta = never, Context = any> = (this: Context, message: TypedFastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => any | Promise<any>;
39
+ type FastEventListeners<Events extends Record<string, any> = Record<string, any>, M = any, C = any> = ({
40
+ [K in keyof Events]: TypedFastEventListener<Exclude<K, number | symbol>, Events[K], M, C>;
41
+ });
42
+ type FastEventListener<P = any, M extends Record<string, any> = Record<string, any>, T extends string = string> = (message: FastEventMessage<P, M, T>, args: FastEventListenerArgs<M>) => any | Promise<any>;
27
43
  /**
28
44
  * [监听器函数引用,需要执行多少次,实际执行的次数(用于负载均衡时记录)]
29
45
  */
30
- type FastListenerMeta = [FastEventListener<any, any>, number, number];
46
+ type FastListenerMeta = [TypedFastEventListener<any, any>, number, number];
31
47
  type FastListenerNode = {
32
48
  __listeners: FastListenerMeta[];
33
49
  } & {
@@ -63,7 +79,7 @@ type FastEventSubscriber = {
63
79
  * scope.off(subscriber.listener) // 生效
64
80
  *
65
81
  */
66
- listener: FastEventListener<any, any, any>;
82
+ listener: TypedFastEventListener<any, any, any>;
67
83
  };
68
84
  type FastListeners = FastListenerNode;
69
85
  type FastEventOptions<Meta = Record<string, any>, Context = never> = {
@@ -73,17 +89,17 @@ type FastEventOptions<Meta = Record<string, any>, Context = never> = {
73
89
  context: Context;
74
90
  ignoreErrors: boolean;
75
91
  meta: Meta;
76
- onAddListener?: (type: string, listener: FastEventListener, options: FastEventListenOptions<Record<string, any>, Meta>) => boolean | FastEventSubscriber | void;
77
- onRemoveListener?: (type: string, listener: FastEventListener) => void;
92
+ onAddListener?: (type: string, listener: TypedFastEventListener, options: FastEventListenOptions<Record<string, any>, Meta>) => boolean | FastEventSubscriber | void;
93
+ onRemoveListener?: (type: string, listener: TypedFastEventListener) => void;
78
94
  onClearListeners?: () => void;
79
- onListenerError?: ((error: Error, listener: FastEventListener, message: FastEventMessage<any, Meta>, args: FastEventListenerArgs<Meta> | undefined) => void);
80
- onBeforeExecuteListener?: (message: FastEventMessage<any, Meta>, args: FastEventListenerArgs<Meta>) => boolean | void | any[];
81
- onAfterExecuteListener?: (message: FastEventMessage<any, Meta>, returns: any[], listeners: FastListenerNode[]) => void;
95
+ onListenerError?: ((error: Error, listener: TypedFastEventListener, message: TypedFastEventMessage<any, Meta>, args: FastEventListenerArgs<Meta> | undefined) => void);
96
+ onBeforeExecuteListener?: (message: TypedFastEventMessage<any, Meta>, args: FastEventListenerArgs<Meta>) => boolean | void | any[];
97
+ onAfterExecuteListener?: (message: TypedFastEventMessage<any, Meta>, returns: any[], listeners: FastListenerNode[]) => void;
82
98
  /**
83
99
  * 全局执行器
84
100
  */
85
101
  executor?: FastListenerExecutor;
86
- onMessage?: FastEventListener;
102
+ onMessage?: TypedFastEventListener;
87
103
  expandEmitResults?: boolean;
88
104
  };
89
105
  interface FastEvents {
@@ -95,13 +111,13 @@ type ScopeEvents<T extends Record<string, any>, Prefix extends string> = PickSco
95
111
  type FastEventListenOptions<Events extends Record<string, any> = Record<string, any>, Meta = any> = {
96
112
  count?: number;
97
113
  prepend?: boolean;
98
- filter?: (message: FastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => boolean;
99
- off?: (message: FastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => boolean;
114
+ filter?: (message: TypedFastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => boolean;
115
+ off?: (message: TypedFastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => boolean;
100
116
  pipes?: FastListenerPipe[];
101
117
  };
102
118
  type FastEventListenerArgs<M = Record<string, any>> = {
103
119
  retain?: boolean;
104
- meta?: Partial<M> & Record<string, any>;
120
+ meta?: DeepPartial<M> & Record<string, any>;
105
121
  abortSignal?: AbortSignal;
106
122
  /**
107
123
  *
@@ -114,7 +130,7 @@ type FastEventListenerArgs<M = Record<string, any>> = {
114
130
  /**
115
131
  * 当emit参数解析完成后的回调,用于修改emit参数
116
132
  */
117
- parseArgs?: (message: FastEventMessage, args: FastEventListenerArgs) => void;
133
+ parseArgs?: (message: TypedFastEventMessage, args: FastEventListenerArgs) => void;
118
134
  };
119
135
  type Merge<T extends object, U extends object> = {
120
136
  [K in keyof T | keyof U]: K extends keyof U ? U[K] : K extends keyof T ? T[K] : never;
@@ -265,11 +281,11 @@ type FastEventScopeOptions<Meta = Record<string, any>, Context = never> = {
265
281
  meta: FastEventScopeMeta & FastEventMeta & Meta;
266
282
  context: Context;
267
283
  executor?: FastListenerExecutor;
268
- onMessage?: FastEventListener;
284
+ onMessage?: TypedFastEventListener;
269
285
  };
270
- type FastEventScopeMeta = {
286
+ interface FastEventScopeMeta {
271
287
  scope: string;
272
- };
288
+ }
273
289
  declare class FastEventScope<Events extends Record<string, any> = Record<string, any>, Meta extends Record<string, any> = Record<string, any>, Context = never, Types extends keyof Events = keyof Events, FinalMeta extends Record<string, any> = FastEventMeta & FastEventScopeMeta & Meta> {
274
290
  __FastEventScope__: boolean;
275
291
  private _options;
@@ -277,6 +293,9 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
277
293
  events: Events;
278
294
  meta: FinalMeta;
279
295
  context: Fallback<Context, typeof this>;
296
+ message: TypedFastEventMessageOptional<Events, FinalMeta>;
297
+ listeners: FastEventListeners<Events, FinalMeta>;
298
+ anyListener: TypedFastEventAnyListener<Events, FinalMeta, Fallback<Context, typeof this>>;
280
299
  };
281
300
  prefix: string;
282
301
  emitter: FastEvent<Events>;
@@ -306,20 +325,20 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
306
325
  on<T extends Types = Types>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
307
326
  on<T extends string>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
308
327
  on(type: '**', options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
309
- on<T extends Types = Types>(type: T, listener: FastEventListener<Exclude<T, number | symbol>, Events[T], FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
310
- on<T extends string>(type: T, listener: FastEventListener<string, any, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
311
- on(type: '**', listener: FastEventAnyListener<Events, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
328
+ on<T extends Types = Types>(type: T, listener: TypedFastEventListener<Exclude<T, number | symbol>, Events[T], FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
329
+ on<T extends string>(type: T, listener: TypedFastEventListener<string, any, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
330
+ on(type: '**', listener: TypedFastEventAnyListener<Events, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
312
331
  once<T extends Types = Types>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
313
332
  once<T extends string>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
314
- once<T extends Types = Types>(type: T, listener: FastEventListener<Exclude<T, number | symbol>, Events[T], FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
315
- once<T extends string>(type: T, listener: FastEventListener<string, any, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
333
+ once<T extends Types = Types>(type: T, listener: TypedFastEventListener<Exclude<T, number | symbol>, Events[T], FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
334
+ once<T extends string>(type: T, listener: TypedFastEventListener<string, any, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
316
335
  onAny(options?: Pick<FastEventListenOptions, 'prepend'>): FastEventSubscriber;
317
- onAny<P = any>(listener: FastEventAnyListener<{
336
+ onAny<P = any>(listener: TypedFastEventAnyListener<{
318
337
  [K: string]: P;
319
338
  }, FinalMeta, Fallback<Context, typeof this>>, options?: Pick<FastEventListenOptions, 'prepend'>): FastEventSubscriber;
320
- off(listener: FastEventListener<any, any, any>): void;
321
- off(type: string, listener: FastEventListener<any, any, any>): void;
322
- off(type: Types, listener: FastEventListener<any, any, any>): void;
339
+ off(listener: TypedFastEventListener<any, any, any>): void;
340
+ off(type: string, listener: TypedFastEventListener<any, any, any>): void;
341
+ off(type: Types, listener: TypedFastEventListener<any, any, any>): void;
323
342
  off(type: string): void;
324
343
  off(type: Types): void;
325
344
  offAll(): void;
@@ -334,14 +353,14 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
334
353
  }, FinalMeta>, options?: FastEventListenerArgs<FinalMeta>): R[];
335
354
  emitAsync<R = any>(type: string, payload?: any, options?: FastEventListenerArgs<FinalMeta>): Promise<[R | Error][]>;
336
355
  emitAsync<R = any>(type: Types, payload?: Events[Types], options?: FastEventListenerArgs<FinalMeta>): Promise<[R | Error][]>;
337
- emitAsync<R = any>(message: FastEventMessage<Events, FinalMeta>, options?: FastEventListenerArgs<FinalMeta>): Promise<[R | Error][]>;
338
- waitFor<T extends Types>(type: T, timeout?: number): Promise<FastEventMessage<{
356
+ emitAsync<R = any>(message: TypedFastEventMessage<Events, FinalMeta>, options?: FastEventListenerArgs<FinalMeta>): Promise<[R | Error][]>;
357
+ waitFor<T extends Types>(type: T, timeout?: number): Promise<TypedFastEventMessage<{
339
358
  [key in T]: Events[T];
340
359
  }, FinalMeta>>;
341
- waitFor(type: string, timeout?: number): Promise<FastEventMessage<{
360
+ waitFor(type: string, timeout?: number): Promise<TypedFastEventMessage<{
342
361
  [key: string]: any;
343
362
  }, FinalMeta>>;
344
- waitFor<P = any>(type: string, timeout?: number): Promise<FastEventMessage<{
363
+ waitFor<P = any>(type: string, timeout?: number): Promise<TypedFastEventMessage<{
345
364
  [key: string]: P;
346
365
  }, FinalMeta>>;
347
366
  /**
@@ -382,7 +401,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
382
401
  * 当on/once/onAny未指定监听器时,此为默认监听器
383
402
  * @param message
384
403
  */
385
- onMessage(message: FastEventMessage<Events, FinalMeta>, args: FastEventListenerArgs<FinalMeta>): void;
404
+ onMessage(message: TypedFastEventMessage<Events, FinalMeta>, args: FastEventListenerArgs<FinalMeta>): void;
386
405
  }
387
406
 
388
407
  /**
@@ -410,6 +429,9 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
410
429
  events: AllEvents;
411
430
  meta: Expand<FastEventMeta & Meta & Record<string, any>>;
412
431
  context: Expand<Fallback<Context, typeof this>>;
432
+ message: TypedFastEventMessageOptional<AllEvents, Expand<FastEventMeta & Meta & Record<string, any>>>;
433
+ listeners: FastEventListeners<AllEvents, Expand<FastEventMeta & Meta & Record<string, any>>>;
434
+ anyListener: TypedFastEventAnyListener<AllEvents, Expand<FastEventMeta & Meta & Record<string, any>>, Expand<Fallback<Context, typeof this>>>;
413
435
  };
414
436
  /**
415
437
  * 创建FastEvent实例
@@ -495,9 +517,9 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
495
517
  on<T extends Types = Types>(type: T, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
496
518
  on<T extends string>(type: T, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
497
519
  on(type: '**', options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
498
- on<T extends Types = Types>(type: T, listener: FastEventListener<Exclude<T, number | symbol>, AllEvents[T], Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
499
- on<T extends string>(type: T, listener: FastEventAnyListener<AllEvents, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
500
- on(type: '**', listener: FastEventAnyListener<Record<string, any>, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
520
+ on<T extends Types = Types>(type: T, listener: TypedFastEventListener<Exclude<T, number | symbol>, AllEvents[T], Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
521
+ on<T extends string>(type: T, listener: TypedFastEventAnyListener<AllEvents, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
522
+ on(type: '**', listener: TypedFastEventAnyListener<Record<string, any>, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
501
523
  /**
502
524
  * 注册一次性事件监听器
503
525
  * @param type - 事件类型,支持与on方法相同的格式:
@@ -521,8 +543,8 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
521
543
  */
522
544
  once<T extends Types = Types>(type: T, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
523
545
  once<T extends string>(type: T, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
524
- once<T extends Types = Types>(type: T, listener: FastEventListener<Exclude<T, number | symbol>, AllEvents[T], Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
525
- once<T extends string>(type: T, listener: FastEventAnyListener<AllEvents, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
546
+ once<T extends Types = Types>(type: T, listener: TypedFastEventListener<Exclude<T, number | symbol>, AllEvents[T], Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
547
+ once<T extends string>(type: T, listener: TypedFastEventAnyListener<AllEvents, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
526
548
  /**
527
549
  * 注册一个监听器,用于监听所有事件
528
550
  * @param listener 事件监听器函数,可以接收任意类型的事件数据
@@ -538,7 +560,7 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
538
560
  * ```listener: FastEventAnyListener<AllEvents, Meta, Fallback<Context, typeof this>>): FastEventSubscriber
539
561
  */
540
562
  onAny(options?: Omit<FastEventListenOptions<AllEvents, Meta>, 'count'>): FastEventSubscriber;
541
- onAny<P = any>(listener: FastEventAnyListener<Record<string, P>, Meta, Fallback<Context, typeof this>>, options?: Omit<FastEventListenOptions<AllEvents, Meta>, 'count'>): FastEventSubscriber;
563
+ onAny<P = any>(listener: TypedFastEventAnyListener<Record<string, P>, Meta, Fallback<Context, typeof this>>, options?: Omit<FastEventListenOptions<AllEvents, Meta>, 'count'>): FastEventSubscriber;
542
564
  /**
543
565
  *
544
566
  * 当调用on/once/onAny时如果没有指定监听器,则调用此方法
@@ -546,10 +568,10 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
546
568
  * 此方法供子类继承
547
569
  *
548
570
  */
549
- onMessage(message: FastEventMessage<AllEvents, Meta>, args: FastEventListenerArgs<Meta>): void;
550
- off(listener: FastEventListener<any, any, any>): void;
551
- off(type: string, listener: FastEventListener<any, any, any>): void;
552
- off(type: Types, listener: FastEventListener<any, any, any>): void;
571
+ onMessage(message: TypedFastEventMessage<AllEvents, Meta>, args: FastEventListenerArgs<Meta>): void;
572
+ off(listener: TypedFastEventListener<any, any, any>): void;
573
+ off(type: string, listener: TypedFastEventListener<any, any, any>): void;
574
+ off(type: Types, listener: TypedFastEventListener<any, any, any>): void;
553
575
  off(type: string): void;
554
576
  off(type: Types): void;
555
577
  /**
@@ -791,11 +813,11 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
791
813
  * console.log('服务器就绪');
792
814
  * ```
793
815
  */
794
- waitFor<T extends Types>(type: T, timeout?: number): Promise<FastEventMessage<{
816
+ waitFor<T extends Types>(type: T, timeout?: number): Promise<TypedFastEventMessage<{
795
817
  [key in T]: AllEvents[T];
796
818
  }, Meta>>;
797
- waitFor(type: string, timeout?: number): Promise<FastEventMessage<AllEvents, Meta>>;
798
- waitFor<P = any>(type: string, timeout?: number): Promise<FastEventMessage<{
819
+ waitFor(type: string, timeout?: number): Promise<TypedFastEventMessage<AllEvents, Meta>>;
820
+ waitFor<P = any>(type: string, timeout?: number): Promise<TypedFastEventMessage<{
799
821
  [key: string]: P;
800
822
  }, Meta>>;
801
823
  /**
@@ -1020,4 +1042,4 @@ declare const FastEventDirectives: {
1020
1042
  clearRetain: symbol;
1021
1043
  };
1022
1044
 
1023
- export { AbortError, BroadcastEvent, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, type FaseEventMessageExtends, FastEvent, type FastEventAnyListener, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventMessage, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, NamespaceDelimiter, NodeDataEvent, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, UnboundError, type Unique, __FastEventScope__, __FastEvent__ };
1045
+ export { AbortError, BroadcastEvent, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, FastEvent, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, NamespaceDelimiter, NodeDataEvent, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Unique, __FastEventScope__, __FastEvent__ };
@@ -1,33 +1,49 @@
1
- type FastListenerExecutor = (listeners: FastListenerMeta[], message: FastEventMessage, args: FastEventListenerArgs, execute: (listener: FastEventListener, message: FastEventMessage, args: FastEventListenerArgs, catchErrors?: boolean) => Promise<any> | any) => Promise<any[]> | any[];
1
+ type FastListenerExecutor = (listeners: FastListenerMeta[], message: TypedFastEventMessage, args: FastEventListenerArgs, execute: (listener: TypedFastEventListener, message: TypedFastEventMessage, args: FastEventListenerArgs, catchErrors?: boolean) => Promise<any> | any) => Promise<any[]> | any[];
2
2
 
3
- type FastListenerPipe = (listener: FastEventListener) => FastEventListener;
3
+ type FastListenerPipe = (listener: TypedFastEventListener) => TypedFastEventListener;
4
4
 
5
- interface FaseEventMessageExtends {
6
- }
7
5
  interface FastEventMeta {
8
6
  }
9
- type FastEventMessage<Events extends Record<string, any> = Record<string, any>, M = any> = ({
7
+ interface FastEventMessageExtends {
8
+ }
9
+ type FastEventMessage<P = any, M extends Record<string, any> = Record<string, any>, T extends string = string> = {
10
+ type: T;
11
+ payload: P;
12
+ meta?: M & Partial<FastEventMeta>;
13
+ } & FastEventMessageExtends;
14
+ type TypedFastEventMessage<Events extends Record<string, any> = Record<string, any>, M = any> = ({
10
15
  [K in keyof Events]: {
11
16
  type: Exclude<K, number | symbol>;
12
17
  payload: Events[K];
13
18
  meta: FastEventMeta & M & Record<string, any>;
14
19
  };
15
- }[Exclude<keyof Events, number | symbol>]) & FaseEventMessageExtends;
20
+ }[Exclude<keyof Events, number | symbol>]) & FastEventMessageExtends;
21
+ type TypedFastEventMessageOptional<Events extends Record<string, any> = Record<string, any>, M = any> = ({
22
+ [K in keyof Events]: {
23
+ type: Exclude<K, number | symbol>;
24
+ payload: Events[K];
25
+ meta?: DeepPartial<FastEventMeta & M & Record<string, any>>;
26
+ };
27
+ }[Exclude<keyof Events, number | symbol>]) & FastEventMessageExtends;
16
28
  type FastEventEmitMessage<Events extends Record<string, any> = Record<string, any>, M = any> = ({
17
29
  [K in keyof Events]: {
18
30
  type: Exclude<K, number | symbol>;
19
31
  payload?: Events[K];
20
- meta?: Partial<FastEventMeta> & M & Record<string, any>;
32
+ meta?: DeepPartial<FastEventMeta & M & Record<string, any>>;
21
33
  };
22
- }[Exclude<keyof Events, number | symbol>]) & FaseEventMessageExtends;
23
- type FastEventListener<T extends string = string, P = any, M = any, C = any> = (this: C, message: FastEventMessage<{
34
+ }[Exclude<keyof Events, number | symbol>]) & FastEventMessageExtends;
35
+ type TypedFastEventListener<T extends string = string, P = any, M = any, C = any> = (this: C, message: TypedFastEventMessage<{
24
36
  [K in T]: P;
25
37
  }, M>, args: FastEventListenerArgs<M>) => any | Promise<any>;
26
- type FastEventAnyListener<Events extends Record<string, any> = Record<string, any>, Meta = never, Context = any> = (this: Context, message: FastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => any | Promise<any>;
38
+ type TypedFastEventAnyListener<Events extends Record<string, any> = Record<string, any>, Meta = never, Context = any> = (this: Context, message: TypedFastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => any | Promise<any>;
39
+ type FastEventListeners<Events extends Record<string, any> = Record<string, any>, M = any, C = any> = ({
40
+ [K in keyof Events]: TypedFastEventListener<Exclude<K, number | symbol>, Events[K], M, C>;
41
+ });
42
+ type FastEventListener<P = any, M extends Record<string, any> = Record<string, any>, T extends string = string> = (message: FastEventMessage<P, M, T>, args: FastEventListenerArgs<M>) => any | Promise<any>;
27
43
  /**
28
44
  * [监听器函数引用,需要执行多少次,实际执行的次数(用于负载均衡时记录)]
29
45
  */
30
- type FastListenerMeta = [FastEventListener<any, any>, number, number];
46
+ type FastListenerMeta = [TypedFastEventListener<any, any>, number, number];
31
47
  type FastListenerNode = {
32
48
  __listeners: FastListenerMeta[];
33
49
  } & {
@@ -63,7 +79,7 @@ type FastEventSubscriber = {
63
79
  * scope.off(subscriber.listener) // 生效
64
80
  *
65
81
  */
66
- listener: FastEventListener<any, any, any>;
82
+ listener: TypedFastEventListener<any, any, any>;
67
83
  };
68
84
  type FastListeners = FastListenerNode;
69
85
  type FastEventOptions<Meta = Record<string, any>, Context = never> = {
@@ -73,17 +89,17 @@ type FastEventOptions<Meta = Record<string, any>, Context = never> = {
73
89
  context: Context;
74
90
  ignoreErrors: boolean;
75
91
  meta: Meta;
76
- onAddListener?: (type: string, listener: FastEventListener, options: FastEventListenOptions<Record<string, any>, Meta>) => boolean | FastEventSubscriber | void;
77
- onRemoveListener?: (type: string, listener: FastEventListener) => void;
92
+ onAddListener?: (type: string, listener: TypedFastEventListener, options: FastEventListenOptions<Record<string, any>, Meta>) => boolean | FastEventSubscriber | void;
93
+ onRemoveListener?: (type: string, listener: TypedFastEventListener) => void;
78
94
  onClearListeners?: () => void;
79
- onListenerError?: ((error: Error, listener: FastEventListener, message: FastEventMessage<any, Meta>, args: FastEventListenerArgs<Meta> | undefined) => void);
80
- onBeforeExecuteListener?: (message: FastEventMessage<any, Meta>, args: FastEventListenerArgs<Meta>) => boolean | void | any[];
81
- onAfterExecuteListener?: (message: FastEventMessage<any, Meta>, returns: any[], listeners: FastListenerNode[]) => void;
95
+ onListenerError?: ((error: Error, listener: TypedFastEventListener, message: TypedFastEventMessage<any, Meta>, args: FastEventListenerArgs<Meta> | undefined) => void);
96
+ onBeforeExecuteListener?: (message: TypedFastEventMessage<any, Meta>, args: FastEventListenerArgs<Meta>) => boolean | void | any[];
97
+ onAfterExecuteListener?: (message: TypedFastEventMessage<any, Meta>, returns: any[], listeners: FastListenerNode[]) => void;
82
98
  /**
83
99
  * 全局执行器
84
100
  */
85
101
  executor?: FastListenerExecutor;
86
- onMessage?: FastEventListener;
102
+ onMessage?: TypedFastEventListener;
87
103
  expandEmitResults?: boolean;
88
104
  };
89
105
  interface FastEvents {
@@ -95,13 +111,13 @@ type ScopeEvents<T extends Record<string, any>, Prefix extends string> = PickSco
95
111
  type FastEventListenOptions<Events extends Record<string, any> = Record<string, any>, Meta = any> = {
96
112
  count?: number;
97
113
  prepend?: boolean;
98
- filter?: (message: FastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => boolean;
99
- off?: (message: FastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => boolean;
114
+ filter?: (message: TypedFastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => boolean;
115
+ off?: (message: TypedFastEventMessage<Events, Meta>, args: FastEventListenerArgs<Meta>) => boolean;
100
116
  pipes?: FastListenerPipe[];
101
117
  };
102
118
  type FastEventListenerArgs<M = Record<string, any>> = {
103
119
  retain?: boolean;
104
- meta?: Partial<M> & Record<string, any>;
120
+ meta?: DeepPartial<M> & Record<string, any>;
105
121
  abortSignal?: AbortSignal;
106
122
  /**
107
123
  *
@@ -114,7 +130,7 @@ type FastEventListenerArgs<M = Record<string, any>> = {
114
130
  /**
115
131
  * 当emit参数解析完成后的回调,用于修改emit参数
116
132
  */
117
- parseArgs?: (message: FastEventMessage, args: FastEventListenerArgs) => void;
133
+ parseArgs?: (message: TypedFastEventMessage, args: FastEventListenerArgs) => void;
118
134
  };
119
135
  type Merge<T extends object, U extends object> = {
120
136
  [K in keyof T | keyof U]: K extends keyof U ? U[K] : K extends keyof T ? T[K] : never;
@@ -265,11 +281,11 @@ type FastEventScopeOptions<Meta = Record<string, any>, Context = never> = {
265
281
  meta: FastEventScopeMeta & FastEventMeta & Meta;
266
282
  context: Context;
267
283
  executor?: FastListenerExecutor;
268
- onMessage?: FastEventListener;
284
+ onMessage?: TypedFastEventListener;
269
285
  };
270
- type FastEventScopeMeta = {
286
+ interface FastEventScopeMeta {
271
287
  scope: string;
272
- };
288
+ }
273
289
  declare class FastEventScope<Events extends Record<string, any> = Record<string, any>, Meta extends Record<string, any> = Record<string, any>, Context = never, Types extends keyof Events = keyof Events, FinalMeta extends Record<string, any> = FastEventMeta & FastEventScopeMeta & Meta> {
274
290
  __FastEventScope__: boolean;
275
291
  private _options;
@@ -277,6 +293,9 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
277
293
  events: Events;
278
294
  meta: FinalMeta;
279
295
  context: Fallback<Context, typeof this>;
296
+ message: TypedFastEventMessageOptional<Events, FinalMeta>;
297
+ listeners: FastEventListeners<Events, FinalMeta>;
298
+ anyListener: TypedFastEventAnyListener<Events, FinalMeta, Fallback<Context, typeof this>>;
280
299
  };
281
300
  prefix: string;
282
301
  emitter: FastEvent<Events>;
@@ -306,20 +325,20 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
306
325
  on<T extends Types = Types>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
307
326
  on<T extends string>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
308
327
  on(type: '**', options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
309
- on<T extends Types = Types>(type: T, listener: FastEventListener<Exclude<T, number | symbol>, Events[T], FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
310
- on<T extends string>(type: T, listener: FastEventListener<string, any, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
311
- on(type: '**', listener: FastEventAnyListener<Events, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
328
+ on<T extends Types = Types>(type: T, listener: TypedFastEventListener<Exclude<T, number | symbol>, Events[T], FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
329
+ on<T extends string>(type: T, listener: TypedFastEventListener<string, any, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
330
+ on(type: '**', listener: TypedFastEventAnyListener<Events, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
312
331
  once<T extends Types = Types>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
313
332
  once<T extends string>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
314
- once<T extends Types = Types>(type: T, listener: FastEventListener<Exclude<T, number | symbol>, Events[T], FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
315
- once<T extends string>(type: T, listener: FastEventListener<string, any, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
333
+ once<T extends Types = Types>(type: T, listener: TypedFastEventListener<Exclude<T, number | symbol>, Events[T], FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
334
+ once<T extends string>(type: T, listener: TypedFastEventListener<string, any, FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
316
335
  onAny(options?: Pick<FastEventListenOptions, 'prepend'>): FastEventSubscriber;
317
- onAny<P = any>(listener: FastEventAnyListener<{
336
+ onAny<P = any>(listener: TypedFastEventAnyListener<{
318
337
  [K: string]: P;
319
338
  }, FinalMeta, Fallback<Context, typeof this>>, options?: Pick<FastEventListenOptions, 'prepend'>): FastEventSubscriber;
320
- off(listener: FastEventListener<any, any, any>): void;
321
- off(type: string, listener: FastEventListener<any, any, any>): void;
322
- off(type: Types, listener: FastEventListener<any, any, any>): void;
339
+ off(listener: TypedFastEventListener<any, any, any>): void;
340
+ off(type: string, listener: TypedFastEventListener<any, any, any>): void;
341
+ off(type: Types, listener: TypedFastEventListener<any, any, any>): void;
323
342
  off(type: string): void;
324
343
  off(type: Types): void;
325
344
  offAll(): void;
@@ -334,14 +353,14 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
334
353
  }, FinalMeta>, options?: FastEventListenerArgs<FinalMeta>): R[];
335
354
  emitAsync<R = any>(type: string, payload?: any, options?: FastEventListenerArgs<FinalMeta>): Promise<[R | Error][]>;
336
355
  emitAsync<R = any>(type: Types, payload?: Events[Types], options?: FastEventListenerArgs<FinalMeta>): Promise<[R | Error][]>;
337
- emitAsync<R = any>(message: FastEventMessage<Events, FinalMeta>, options?: FastEventListenerArgs<FinalMeta>): Promise<[R | Error][]>;
338
- waitFor<T extends Types>(type: T, timeout?: number): Promise<FastEventMessage<{
356
+ emitAsync<R = any>(message: TypedFastEventMessage<Events, FinalMeta>, options?: FastEventListenerArgs<FinalMeta>): Promise<[R | Error][]>;
357
+ waitFor<T extends Types>(type: T, timeout?: number): Promise<TypedFastEventMessage<{
339
358
  [key in T]: Events[T];
340
359
  }, FinalMeta>>;
341
- waitFor(type: string, timeout?: number): Promise<FastEventMessage<{
360
+ waitFor(type: string, timeout?: number): Promise<TypedFastEventMessage<{
342
361
  [key: string]: any;
343
362
  }, FinalMeta>>;
344
- waitFor<P = any>(type: string, timeout?: number): Promise<FastEventMessage<{
363
+ waitFor<P = any>(type: string, timeout?: number): Promise<TypedFastEventMessage<{
345
364
  [key: string]: P;
346
365
  }, FinalMeta>>;
347
366
  /**
@@ -382,7 +401,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
382
401
  * 当on/once/onAny未指定监听器时,此为默认监听器
383
402
  * @param message
384
403
  */
385
- onMessage(message: FastEventMessage<Events, FinalMeta>, args: FastEventListenerArgs<FinalMeta>): void;
404
+ onMessage(message: TypedFastEventMessage<Events, FinalMeta>, args: FastEventListenerArgs<FinalMeta>): void;
386
405
  }
387
406
 
388
407
  /**
@@ -410,6 +429,9 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
410
429
  events: AllEvents;
411
430
  meta: Expand<FastEventMeta & Meta & Record<string, any>>;
412
431
  context: Expand<Fallback<Context, typeof this>>;
432
+ message: TypedFastEventMessageOptional<AllEvents, Expand<FastEventMeta & Meta & Record<string, any>>>;
433
+ listeners: FastEventListeners<AllEvents, Expand<FastEventMeta & Meta & Record<string, any>>>;
434
+ anyListener: TypedFastEventAnyListener<AllEvents, Expand<FastEventMeta & Meta & Record<string, any>>, Expand<Fallback<Context, typeof this>>>;
413
435
  };
414
436
  /**
415
437
  * 创建FastEvent实例
@@ -495,9 +517,9 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
495
517
  on<T extends Types = Types>(type: T, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
496
518
  on<T extends string>(type: T, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
497
519
  on(type: '**', options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
498
- on<T extends Types = Types>(type: T, listener: FastEventListener<Exclude<T, number | symbol>, AllEvents[T], Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
499
- on<T extends string>(type: T, listener: FastEventAnyListener<AllEvents, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
500
- on(type: '**', listener: FastEventAnyListener<Record<string, any>, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
520
+ on<T extends Types = Types>(type: T, listener: TypedFastEventListener<Exclude<T, number | symbol>, AllEvents[T], Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
521
+ on<T extends string>(type: T, listener: TypedFastEventAnyListener<AllEvents, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
522
+ on(type: '**', listener: TypedFastEventAnyListener<Record<string, any>, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
501
523
  /**
502
524
  * 注册一次性事件监听器
503
525
  * @param type - 事件类型,支持与on方法相同的格式:
@@ -521,8 +543,8 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
521
543
  */
522
544
  once<T extends Types = Types>(type: T, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
523
545
  once<T extends string>(type: T, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
524
- once<T extends Types = Types>(type: T, listener: FastEventListener<Exclude<T, number | symbol>, AllEvents[T], Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
525
- once<T extends string>(type: T, listener: FastEventAnyListener<AllEvents, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
546
+ once<T extends Types = Types>(type: T, listener: TypedFastEventListener<Exclude<T, number | symbol>, AllEvents[T], Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
547
+ once<T extends string>(type: T, listener: TypedFastEventAnyListener<AllEvents, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions<AllEvents, Meta>): FastEventSubscriber;
526
548
  /**
527
549
  * 注册一个监听器,用于监听所有事件
528
550
  * @param listener 事件监听器函数,可以接收任意类型的事件数据
@@ -538,7 +560,7 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
538
560
  * ```listener: FastEventAnyListener<AllEvents, Meta, Fallback<Context, typeof this>>): FastEventSubscriber
539
561
  */
540
562
  onAny(options?: Omit<FastEventListenOptions<AllEvents, Meta>, 'count'>): FastEventSubscriber;
541
- onAny<P = any>(listener: FastEventAnyListener<Record<string, P>, Meta, Fallback<Context, typeof this>>, options?: Omit<FastEventListenOptions<AllEvents, Meta>, 'count'>): FastEventSubscriber;
563
+ onAny<P = any>(listener: TypedFastEventAnyListener<Record<string, P>, Meta, Fallback<Context, typeof this>>, options?: Omit<FastEventListenOptions<AllEvents, Meta>, 'count'>): FastEventSubscriber;
542
564
  /**
543
565
  *
544
566
  * 当调用on/once/onAny时如果没有指定监听器,则调用此方法
@@ -546,10 +568,10 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
546
568
  * 此方法供子类继承
547
569
  *
548
570
  */
549
- onMessage(message: FastEventMessage<AllEvents, Meta>, args: FastEventListenerArgs<Meta>): void;
550
- off(listener: FastEventListener<any, any, any>): void;
551
- off(type: string, listener: FastEventListener<any, any, any>): void;
552
- off(type: Types, listener: FastEventListener<any, any, any>): void;
571
+ onMessage(message: TypedFastEventMessage<AllEvents, Meta>, args: FastEventListenerArgs<Meta>): void;
572
+ off(listener: TypedFastEventListener<any, any, any>): void;
573
+ off(type: string, listener: TypedFastEventListener<any, any, any>): void;
574
+ off(type: Types, listener: TypedFastEventListener<any, any, any>): void;
553
575
  off(type: string): void;
554
576
  off(type: Types): void;
555
577
  /**
@@ -791,11 +813,11 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
791
813
  * console.log('服务器就绪');
792
814
  * ```
793
815
  */
794
- waitFor<T extends Types>(type: T, timeout?: number): Promise<FastEventMessage<{
816
+ waitFor<T extends Types>(type: T, timeout?: number): Promise<TypedFastEventMessage<{
795
817
  [key in T]: AllEvents[T];
796
818
  }, Meta>>;
797
- waitFor(type: string, timeout?: number): Promise<FastEventMessage<AllEvents, Meta>>;
798
- waitFor<P = any>(type: string, timeout?: number): Promise<FastEventMessage<{
819
+ waitFor(type: string, timeout?: number): Promise<TypedFastEventMessage<AllEvents, Meta>>;
820
+ waitFor<P = any>(type: string, timeout?: number): Promise<TypedFastEventMessage<{
799
821
  [key: string]: P;
800
822
  }, Meta>>;
801
823
  /**
@@ -1020,4 +1042,4 @@ declare const FastEventDirectives: {
1020
1042
  clearRetain: symbol;
1021
1043
  };
1022
1044
 
1023
- export { AbortError, BroadcastEvent, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, type FaseEventMessageExtends, FastEvent, type FastEventAnyListener, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventMessage, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, NamespaceDelimiter, NodeDataEvent, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, UnboundError, type Unique, __FastEventScope__, __FastEvent__ };
1045
+ export { AbortError, BroadcastEvent, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, FastEvent, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, NamespaceDelimiter, NodeDataEvent, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Unique, __FastEventScope__, __FastEvent__ };