1 |
|
2 |
|
3 |
|
4 | declare namespace FxOrmHook {
|
5 | interface HookActionNextFunction<TTHIS = FxOrmInstance.Instance> {
|
6 | (this: TTHIS, err?: Error|null): any
|
7 | }
|
8 |
|
9 | interface HookActionCallback<TTHIS = FxOrmInstance.Instance, TPAYLOAD = any> {
|
10 | (this: TTHIS, next?: HookActionNextFunction): any
|
11 | (this: TTHIS, arg1?: TPAYLOAD, next?: HookActionNextFunction): any
|
12 | }
|
13 |
|
14 | interface HookResultCallback<TTHIS = FxOrmInstance.Instance, TPAYLOAD = any> {
|
15 | (this: TTHIS, success?: boolean): any
|
16 | (this: TTHIS, arg1?: TPAYLOAD, success?: boolean): any
|
17 | }
|
18 |
|
19 | interface HookTrigger<CTX_SELF = FxOrmInstance.Instance, RESULT_TYPE = boolean>{
|
20 | (self: CTX_SELF, cur: FxOrmNS.Arraible<HookResultCallback>, _?: RESULT_TYPE, ...args: any): void
|
21 | }
|
22 |
|
23 | interface HookWait<CTX_SELF = FxOrmInstance.Instance, TNEXT_THIS=any>{
|
24 | (self: CTX_SELF, cur: FxOrmNS.Arraible<HookActionCallback | FxOrmNS.Arraible<HookActionCallback>>, next: FxOrmNS.GenericCallback<TNEXT_THIS>, opts?: Fibjs.AnyObject): void
|
25 | }
|
26 |
|
27 | interface HookPatchOptions {
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | oldhook?: 'prepend' | 'append' | 'initial' | 'overwrite' | undefined
|
35 | }
|
36 |
|
37 | interface HookChannel<FTYPE = Function> {
|
38 | (name: string, handler: FTYPE): HookChannelResults
|
39 | (handler: FTYPE): HookChannelResults
|
40 | (name?: string): HookChannelResults
|
41 | }
|
42 |
|
43 | type HookTuple<FTYPE = Function> = [FTYPE, (fn: FTYPE, ...args: any) => any]
|
44 |
|
45 | interface HookChannelResults<FTYPE = Function> extends HookTuple<FTYPE> {
|
46 | run: (...args: any) => any
|
47 | set: (fn: Function, ...args: any) => any
|
48 | }
|
49 | }
|