moost 0.3.23 → 0.3.24

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.
package/dist/index.d.ts CHANGED
@@ -1,38 +1,116 @@
1
- import * as _prostojs_mate from '@prostojs/mate';
2
- import { TMateParamMeta, Mate } from '@prostojs/mate';
1
+ import { useEventLogger } from '@wooksjs/event-core';
2
+ export { EventLogger, THook, useEventContext, useEventLogger } from '@wooksjs/event-core';
3
3
  import { TProvideRegistry, Infact, TProvideFn } from '@prostojs/infact';
4
4
  export { TProvideRegistry, createProvideRegistry } from '@prostojs/infact';
5
5
  import { TConsoleBase } from '@prostojs/logger';
6
- import { useEventLogger } from '@wooksjs/event-core';
7
- export { EventLogger, THook, useEventContext, useEventLogger } from '@wooksjs/event-core';
6
+ import * as _prostojs_mate from '@prostojs/mate';
7
+ import { TMateParamMeta, Mate } from '@prostojs/mate';
8
8
 
9
9
  type TAny = any;
10
- type TAnyFn = {
11
- (...a: TAny[]): unknown;
12
- };
10
+ type TAnyFn = (...a: TAny[]) => unknown;
13
11
  type TObject = object;
14
12
  type TFunction = Function;
15
13
  type TClassConstructor<T = unknown> = new (...args: TAny[]) => T;
16
14
  interface TEmpty {
17
15
  }
18
16
 
19
- declare function getInstanceOwnMethods<T = TAny>(instance: T): (keyof T)[];
17
+ declare function Circular<T = unknown>(resolver: () => TClassConstructor<T>): ParameterDecorator;
18
+
19
+ /**
20
+ * ## Label
21
+ * ### @Decorator
22
+ * _Common purpose decorator that may be used by various adapters for various purposes_
23
+ *
24
+ * Stores Label metadata
25
+ */
26
+ declare function Label(value: string): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
27
+ /**
28
+ * ## Description
29
+ * ### @Decorator
30
+ * _Common purpose decorator that may be used by various adapters for various purposes_
31
+ *
32
+ * Stores Description metadata
33
+ */
34
+ declare function Description(value: string): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
35
+ /**
36
+ * ## Value
37
+ * ### @Decorator
38
+ * _Common purpose decorator that may be used by various adapters for various purposes_
39
+ *
40
+ * Stores Value metadata
41
+ */
42
+ declare function Value(value: unknown): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
43
+ /**
44
+ * ## Id
45
+ * ### @Decorator
46
+ * _Common purpose decorator that may be used by various adapters for various purposes_
47
+ *
48
+ * Stores Id metadata
49
+ */
50
+ declare function Id(value: string): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
51
+ /**
52
+ * ## Optional
53
+ * ### @Decorator
54
+ * _Common purpose decorator that may be used by various adapters for various purposes_
55
+ *
56
+ * Stores Optional metadata
57
+ */
58
+ declare function Optional(): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
59
+ /**
60
+ * ## Required
61
+ * ### @Decorator
62
+ * _Common purpose decorator that may be used by various adapters for various purposes_
63
+ *
64
+ * Stores Required metadata
65
+ */
66
+ declare function Required(): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
67
+
68
+ /**
69
+ * ## Controller
70
+ * ### @Decorator
71
+ * Set Class as a Controller
72
+ * @param prefix - define the prefix for all the paths of this controller
73
+ */
74
+ declare function Controller(prefix?: string): ClassDecorator;
75
+ /**
76
+ * ## ImportController
77
+ * ### @Decorator
78
+ * Attach sub-controller
79
+ * @param controller - target controller (instance) to import
80
+ * @param provide - provide registry for the target controller
81
+ */
82
+ declare function ImportController(controller: TFunction | TObject, provide?: TProvideRegistry): ClassDecorator;
83
+ /**
84
+ * ## ImportController
85
+ * ### @Decorator
86
+ * Attach sub-controller
87
+ * @param prefix - redefine the prefix for all the paths of this controller
88
+ * @param controller - point to a controller (instance) to import
89
+ * @param provide - provide registry for the target controller
90
+ */
91
+ declare function ImportController(prefix: string, controller: TFunction | TObject, provide?: TProvideRegistry): ClassDecorator;
92
+
93
+ /**
94
+ * ## Inherit
95
+ * ### @Decorator
96
+ * Inherit metadata from super class
97
+ * @returns
98
+ */
99
+ declare const Inherit: () => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
20
100
 
21
101
  interface TClassFunction<T extends TAnyFn = TAnyFn> {
22
102
  handler: T;
23
103
  }
24
- interface TClassFunctionConstructor<T extends TAnyFn = TAnyFn> {
25
- new (...a: TAny[]): TClassFunction<T>;
26
- }
104
+ type TClassFunctionConstructor<T extends TAnyFn = TAnyFn> = new (...a: TAny[]) => TClassFunction<T>;
27
105
  type TCallableClassFunction<T extends TAnyFn = TAnyFn> = T | TClassFunctionConstructor;
28
106
 
29
107
  type TInterceptorBefore = (reply: (response: TAny) => void) => void | Promise<void>;
30
108
  type TInterceptorAfter = (response: TAny, reply: (response: TAny) => void) => void | Promise<void>;
31
109
  type TInterceptorOnError = (error: Error, reply: (response: TAny) => void) => void | Promise<void>;
32
- type TInterceptorFn = {
110
+ interface TInterceptorFn {
33
111
  (before: (fn: TInterceptorBefore) => void, after: (fn: TInterceptorAfter) => void, onError: (fn: TInterceptorOnError) => void): unknown | Promise<unknown>;
34
112
  priority?: TInterceptorPriority;
35
- };
113
+ }
36
114
  declare enum TInterceptorPriority {
37
115
  BEFORE_ALL = 0,
38
116
  BEFORE_GUARD = 1,
@@ -54,6 +132,12 @@ declare function Intercept(handler: TCallableClassFunction<TInterceptorFn>, prio
54
132
 
55
133
  type TDecoratorLevel = 'CLASS' | 'METHOD' | 'PROP' | 'PARAM';
56
134
 
135
+ declare function getMoostInfact(): Infact<TMoostMetadata<TEmpty>, TMoostMetadata<TEmpty>, TMoostParamsMetadata, TCustom>;
136
+ interface TCustom {
137
+ pipes?: TPipeData[];
138
+ }
139
+ declare function getNewMoostInfact(): Infact<TMoostMetadata<TEmpty>, TMoostMetadata<TEmpty>, TMoostParamsMetadata, TCustom>;
140
+
57
141
  interface TPipeMetas<T extends TObject = TEmpty> {
58
142
  classMeta?: TMoostMetadata & T;
59
143
  methodMeta?: TMoostMetadata & T;
@@ -65,10 +149,10 @@ interface TPipeMetas<T extends TObject = TEmpty> {
65
149
  index?: number;
66
150
  key: string | symbol;
67
151
  }
68
- type TPipeFn<T extends TObject = TEmpty> = {
152
+ interface TPipeFn<T extends TObject = TEmpty> {
69
153
  (value: unknown, metas: TPipeMetas<T>, level: TDecoratorLevel): unknown | Promise<unknown>;
70
154
  priority?: TPipePriority;
71
- };
155
+ }
72
156
  declare enum TPipePriority {
73
157
  BEFORE_RESOLVE = 0,
74
158
  RESOLVE = 1,
@@ -88,22 +172,22 @@ interface TPipeData {
88
172
  declare const resolvePipe: TPipeFn<TEmpty>;
89
173
 
90
174
  interface TMoostMetadata<H extends TObject = TEmpty> extends TCommonMetaFields, TCommonMoostMeta {
91
- requiredProps?: (string | symbol)[];
175
+ requiredProps?: Array<string | symbol>;
92
176
  controller?: {
93
177
  prefix?: string;
94
178
  };
95
- importController?: {
179
+ importController?: Array<{
96
180
  prefix?: string;
97
181
  typeResolver?: TClassConstructor | (() => TClassConstructor | TObject | Promise<TClassConstructor | TObject>);
98
182
  provide?: TProvideRegistry;
99
- }[];
100
- properties?: (string | symbol)[];
183
+ }>;
184
+ properties?: Array<string | symbol>;
101
185
  injectable?: true | TInjectableScope;
102
186
  interceptors?: TInterceptorData[];
103
- handlers?: TMoostHandler<H>[];
187
+ handlers?: Array<TMoostHandler<H>>;
104
188
  returnType?: TFunction;
105
189
  provide?: TProvideRegistry;
106
- params: (TMateParamMeta & TMoostParamsMetadata)[];
190
+ params: Array<TMateParamMeta & TMoostParamsMetadata>;
107
191
  }
108
192
  interface TMoostParamsMetadata extends TCommonMetaFields, TCommonMoostMeta {
109
193
  circular?: () => TAny;
@@ -122,9 +206,9 @@ interface TInterceptorData {
122
206
  priority: TInterceptorPriority;
123
207
  }
124
208
  declare function getMoostMate<Class extends TObject = TEmpty, Prop extends TObject = TEmpty, Param extends TObject = TEmpty>(): Mate<TMoostMetadata<TEmpty> & Class & {
125
- params: (Param & TMateParamMeta)[];
209
+ params: Array<Param & TMateParamMeta>;
126
210
  }, TMoostMetadata<TEmpty> & Prop & {
127
- params: (Param & TMateParamMeta)[];
211
+ params: Array<Param & TMateParamMeta>;
128
212
  }>;
129
213
  interface TCommonMetaFields {
130
214
  id?: string;
@@ -141,11 +225,43 @@ interface TCommonMoostMeta {
141
225
  type?: TFunction;
142
226
  }
143
227
 
144
- declare function getMoostInfact(): Infact<TMoostMetadata<TEmpty>, TMoostMetadata<TEmpty>, TMoostParamsMetadata, TCustom>;
145
- interface TCustom {
146
- pipes?: TPipeData[];
147
- }
148
- declare function getNewMoostInfact(): Infact<TMoostMetadata<TEmpty>, TMoostMetadata<TEmpty>, TMoostParamsMetadata, TCustom>;
228
+ /**
229
+ * ## Injectable
230
+ * ### @Decorator
231
+ * Mark the Class as Injectable to enable it to be used in dependency injection
232
+ * @param scope - Scope for injection ("FOR_EVENT" | "SINGLETON" | true)
233
+ * FOR_EVENT - will create a new instance for each incoming request
234
+ * SINGLETON | true - will create a new instance only once
235
+ * @param label - field label
236
+ */
237
+ declare function Injectable(scope?: true | TInjectableScope): ClassDecorator;
238
+
239
+ /**
240
+ * ## Pipe
241
+ * ### @Decorator
242
+ * Attach pipe
243
+ * @param handler pipe handler
244
+ * @param priority pipe priority
245
+ * @returns
246
+ */
247
+ declare function Pipe(handler: TPipeFn, priority?: TPipePriority): ClassDecorator & MethodDecorator & ParameterDecorator;
248
+
249
+ /**
250
+ * ## Provide
251
+ * ### @Decorator
252
+ * Defines provide registry for class (and all the children)
253
+ * @param type - string or class constructor
254
+ * @param fn - factory function for provided value
255
+ */
256
+ declare function Provide(type: string | TClassConstructor, fn: TProvideFn): ClassDecorator;
257
+ /**
258
+ * ## Inject
259
+ * ### @Decorator
260
+ * Defines a key from provide registry to inject value
261
+ * (For optional values use with @Optional())
262
+ * @param type - string or class constructor
263
+ */
264
+ declare function Inject(type: string | TClassConstructor): ParameterDecorator;
149
265
 
150
266
  /**
151
267
  * Hook to the Response Status
@@ -191,128 +307,6 @@ declare function ConstFactory<T>(factory: () => T | Promise<T>, label?: string):
191
307
  */
192
308
  declare function InjectEventLogger(topic?: string): ParameterDecorator & PropertyDecorator;
193
309
 
194
- /**
195
- * ## Controller
196
- * ### @Decorator
197
- * Set Class as a Controller
198
- * @param prefix - define the prefix for all the paths of this controller
199
- */
200
- declare function Controller(prefix?: string): ClassDecorator;
201
- /**
202
- * ## ImportController
203
- * ### @Decorator
204
- * Attach sub-controller
205
- * @param controller - target controller (instance) to import
206
- * @param provide - provide registry for the target controller
207
- */
208
- declare function ImportController(controller: TFunction | TObject, provide?: TProvideRegistry): ClassDecorator;
209
- /**
210
- * ## ImportController
211
- * ### @Decorator
212
- * Attach sub-controller
213
- * @param prefix - redefine the prefix for all the paths of this controller
214
- * @param controller - point to a controller (instance) to import
215
- * @param provide - provide registry for the target controller
216
- */
217
- declare function ImportController(prefix: string, controller: TFunction | TObject, provide?: TProvideRegistry): ClassDecorator;
218
-
219
- /**
220
- * ## Injectable
221
- * ### @Decorator
222
- * Mark the Class as Injectable to enable it to be used in dependency injection
223
- * @param scope - Scope for injection ("FOR_EVENT" | "SINGLETON" | true)
224
- * FOR_EVENT - will create a new instance for each incoming request
225
- * SINGLETON | true - will create a new instance only once
226
- * @param label - field label
227
- */
228
- declare function Injectable(scope?: true | TInjectableScope): ClassDecorator;
229
-
230
- declare function Circular<T = unknown>(resolver: () => TClassConstructor<T>): ParameterDecorator;
231
-
232
- /**
233
- * ## Provide
234
- * ### @Decorator
235
- * Defines provide registry for class (and all the children)
236
- * @param type - string or class constructor
237
- * @param fn - factory function for provided value
238
- */
239
- declare function Provide(type: string | TClassConstructor, fn: TProvideFn): ClassDecorator;
240
- /**
241
- * ## Inject
242
- * ### @Decorator
243
- * Defines a key from provide registry to inject value
244
- * (For optional values use with @Optional())
245
- * @param type - string or class constructor
246
- */
247
- declare function Inject(type: string | TClassConstructor): ParameterDecorator;
248
-
249
- /**
250
- * ## Label
251
- * ### @Decorator
252
- * _Common purpose decorator that may be used by various adapters for various purposes_
253
- *
254
- * Stores Label metadata
255
- */
256
- declare function Label(value: string): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
257
- /**
258
- * ## Description
259
- * ### @Decorator
260
- * _Common purpose decorator that may be used by various adapters for various purposes_
261
- *
262
- * Stores Description metadata
263
- */
264
- declare function Description(value: string): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
265
- /**
266
- * ## Value
267
- * ### @Decorator
268
- * _Common purpose decorator that may be used by various adapters for various purposes_
269
- *
270
- * Stores Value metadata
271
- */
272
- declare function Value(value: unknown): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
273
- /**
274
- * ## Id
275
- * ### @Decorator
276
- * _Common purpose decorator that may be used by various adapters for various purposes_
277
- *
278
- * Stores Id metadata
279
- */
280
- declare function Id(value: string): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
281
- /**
282
- * ## Optional
283
- * ### @Decorator
284
- * _Common purpose decorator that may be used by various adapters for various purposes_
285
- *
286
- * Stores Optional metadata
287
- */
288
- declare function Optional(): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
289
- /**
290
- * ## Required
291
- * ### @Decorator
292
- * _Common purpose decorator that may be used by various adapters for various purposes_
293
- *
294
- * Stores Required metadata
295
- */
296
- declare function Required(): MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
297
-
298
- /**
299
- * ## Inherit
300
- * ### @Decorator
301
- * Inherit metadata from super class
302
- * @returns
303
- */
304
- declare const Inherit: () => MethodDecorator & ClassDecorator & ParameterDecorator & PropertyDecorator;
305
-
306
- /**
307
- * ## Pipe
308
- * ### @Decorator
309
- * Attach pipe
310
- * @param handler pipe handler
311
- * @param priority pipe priority
312
- * @returns
313
- */
314
- declare function Pipe(handler: TPipeFn, priority?: TPipePriority): ClassDecorator & MethodDecorator & ParameterDecorator;
315
-
316
310
  declare class InterceptorHandler {
317
311
  protected handlers: TInterceptorFn[];
318
312
  constructor(handlers: TInterceptorFn[]);
@@ -327,6 +321,36 @@ declare class InterceptorHandler {
327
321
  fireAfter(response: unknown): Promise<unknown>;
328
322
  }
329
323
 
324
+ interface TMoostEventHandlerHookOptions<T> {
325
+ restoreCtx: () => void;
326
+ scopeId: string;
327
+ logger: ReturnType<typeof useEventLogger>;
328
+ unscope: () => void;
329
+ instance?: T;
330
+ method?: keyof T;
331
+ getResponse: () => unknown;
332
+ reply: (r: unknown) => void;
333
+ }
334
+ interface TMoostEventHandlerOptions<T> {
335
+ contextType?: string | string[];
336
+ loggerTitle: string;
337
+ getIterceptorHandler: () => Promise<InterceptorHandler> | InterceptorHandler | undefined;
338
+ getControllerInstance: () => Promise<T> | T | undefined;
339
+ controllerMethod?: keyof T;
340
+ callControllerMethod?: (args: unknown[]) => unknown;
341
+ resolveArgs?: () => Promise<unknown[]> | unknown[];
342
+ logErrors?: boolean;
343
+ manualUnscope?: boolean;
344
+ hooks?: {
345
+ init?: (opts: TMoostEventHandlerHookOptions<T>) => unknown;
346
+ end?: (opts: TMoostEventHandlerHookOptions<T>) => unknown;
347
+ };
348
+ }
349
+ declare function registerEventScope(scopeId: string): () => void;
350
+ declare function defineMoostEventHandler<T>(options: TMoostEventHandlerOptions<T>): () => Promise<unknown>;
351
+
352
+ declare function getInstanceOwnMethods<T = TAny>(instance: T): Array<keyof T>;
353
+
330
354
  interface TControllerOverview {
331
355
  meta: TMoostMetadata;
332
356
  computedPrefix: string;
@@ -339,10 +363,10 @@ interface THandlerOverview {
339
363
  type: string;
340
364
  method: string;
341
365
  handler: TMoostHandler<TEmpty>;
342
- registeredAs: {
366
+ registeredAs: Array<{
343
367
  path: string;
344
368
  args: string[];
345
- }[];
369
+ }>;
346
370
  }
347
371
 
348
372
  interface TMoostOptions {
@@ -407,10 +431,10 @@ declare class Moost {
407
431
  protected logger: TConsoleBase;
408
432
  protected pipes: TPipeData[];
409
433
  protected interceptors: TInterceptorData[];
410
- protected adapters: TMoostAdapter<TAny>[];
434
+ protected adapters: Array<TMoostAdapter<TAny>>;
411
435
  protected controllersOverview: TControllerOverview[];
412
436
  protected provide: TProvideRegistry;
413
- protected unregisteredControllers: (TObject | TFunction | [string, TObject | TFunction])[];
437
+ protected unregisteredControllers: Array<TObject | TFunction | [string, TObject | TFunction]>;
414
438
  constructor(options?: TMoostOptions | undefined);
415
439
  /**
416
440
  * ### getLogger
@@ -433,7 +457,7 @@ declare class Moost {
433
457
  init(): Promise<void>;
434
458
  protected bindControllers(): Promise<void>;
435
459
  protected bindController(controller: TFunction | TObject, provide: TProvideRegistry, globalPrefix: string, replaceOwnPrefix?: string): Promise<void>;
436
- applyGlobalPipes(...items: (TPipeFn | TPipeData)[]): this;
460
+ applyGlobalPipes(...items: Array<TPipeFn | TPipeData>): this;
437
461
  protected globalInterceptorHandler?: () => Promise<InterceptorHandler>;
438
462
  /**
439
463
  * Provides InterceptorHandler with global interceptors and pipes.
@@ -442,7 +466,7 @@ declare class Moost {
442
466
  * @returns IterceptorHandler
443
467
  */
444
468
  getGlobalInterceptorHandler(): Promise<InterceptorHandler>;
445
- applyGlobalInterceptors(...items: (TInterceptorData['handler'] | TInterceptorData)[]): this;
469
+ applyGlobalInterceptors(...items: Array<TInterceptorData['handler'] | TInterceptorData>): this;
446
470
  /**
447
471
  * Register new entried to provide as dependency injections
448
472
  * @param provide - Provide Registry (use createProvideRegistry from '\@prostojs/infact')
@@ -454,21 +478,21 @@ declare class Moost {
454
478
  * @param controllers - list of target controllers (instances)
455
479
  * @returns
456
480
  */
457
- registerControllers(...controllers: (TObject | TFunction | [string, TObject | TFunction])[]): this;
481
+ registerControllers(...controllers: Array<TObject | TFunction | [string, TObject | TFunction]>): this;
458
482
  }
459
483
  interface TMoostAdapterOptions<H, T> {
460
484
  prefix: string;
461
485
  fakeInstance: T;
462
486
  getInstance: () => Promise<T>;
463
487
  method: keyof T;
464
- handlers: TMoostHandler<H>[];
488
+ handlers: Array<TMoostHandler<H>>;
465
489
  getIterceptorHandler: () => Promise<InterceptorHandler>;
466
490
  resolveArgs: () => Promise<unknown[]>;
467
491
  logHandler: (eventName: string) => void;
468
492
  register: (handler: TMoostHandler<TEmpty>, path: string, args: string[]) => void;
469
493
  }
470
494
  interface TMoostAdapter<H> {
471
- bindHandler<T extends TObject = TObject>(options: TMoostAdapterOptions<H, T>): void | Promise<void>;
495
+ bindHandler: <T extends TObject = TObject>(options: TMoostAdapterOptions<H, T>) => void | Promise<void>;
472
496
  onInit?: (moost: Moost) => void | Promise<void>;
473
497
  getProvideRegistry?: () => TProvideRegistry;
474
498
  }
@@ -477,7 +501,7 @@ declare function setControllerContext<T>(controller: T, method: keyof T): void;
477
501
  declare function useControllerContext<T extends object>(): {
478
502
  instantiate: <T_1>(c: TClassConstructor<T_1>) => Promise<T_1>;
479
503
  getController: () => T;
480
- getMethod: () => keyof T;
504
+ getMethod: () => string | undefined;
481
505
  getControllerMeta: () => (TMoostMetadata<TEmpty> & TEmpty & {
482
506
  params: (TEmpty & _prostojs_mate.TMateParamMeta)[];
483
507
  }) | undefined;
@@ -496,34 +520,6 @@ declare function useControllerContext<T extends object>(): {
496
520
  } & _prostojs_mate.TMateClassMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty> & _prostojs_mate.TMatePropMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty>) | undefined;
497
521
  };
498
522
 
499
- interface TMoostEventHandlerHookOptions<T> {
500
- restoreCtx: () => void;
501
- scopeId: string;
502
- logger: ReturnType<typeof useEventLogger>;
503
- unscope: () => void;
504
- instance?: T;
505
- method?: keyof T;
506
- getResponse: () => unknown;
507
- reply: (r: unknown) => void;
508
- }
509
- interface TMoostEventHandlerOptions<T> {
510
- contextType?: string | string[];
511
- loggerTitle: string;
512
- getIterceptorHandler: () => Promise<InterceptorHandler> | InterceptorHandler | undefined;
513
- getControllerInstance: () => Promise<T> | T | undefined;
514
- controllerMethod?: keyof T;
515
- callControllerMethod?: (args: unknown[]) => unknown;
516
- resolveArgs?: () => Promise<unknown[]> | unknown[];
517
- logErrors?: boolean;
518
- manualUnscope?: boolean;
519
- hooks?: {
520
- init?: (opts: TMoostEventHandlerHookOptions<T>) => unknown;
521
- end?: (opts: TMoostEventHandlerHookOptions<T>) => unknown;
522
- };
523
- }
524
- declare function registerEventScope(scopeId: string): () => void;
525
- declare function defineMoostEventHandler<T>(options: TMoostEventHandlerOptions<T>): () => Promise<unknown>;
526
-
527
523
  /**
528
524
  * ### Define Interceptor Function
529
525
  *