1 | import { Context } from './context';
|
2 | import { ResolutionSession } from './resolution-session';
|
3 | import { ValueOrPromise } from './value-promise';
|
4 |
|
5 |
|
6 |
|
7 | export type InvocationResult = any;
|
8 |
|
9 |
|
10 |
|
11 | export type InvocationArgs = any[];
|
12 |
|
13 |
|
14 |
|
15 | export interface InvocationSource<T = unknown> {
|
16 | |
17 |
|
18 |
|
19 | readonly type: string;
|
20 | |
21 |
|
22 |
|
23 | readonly value: T;
|
24 | }
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | export declare class InvocationContext extends Context {
|
31 | readonly target: object;
|
32 | readonly methodName: string;
|
33 | readonly args: InvocationArgs;
|
34 | readonly source?: InvocationSource<unknown> | undefined;
|
35 | |
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | constructor(parent: Context, target: object, methodName: string, args: InvocationArgs, source?: InvocationSource<unknown> | undefined);
|
44 | /**
|
45 | * The target class, such as `OrderController`
|
46 | */
|
47 | get targetClass(): Function;
|
48 | /**
|
49 | * The target name, such as `OrderController.prototype.cancelOrder`
|
50 | */
|
51 | get targetName(): string;
|
52 | /**
|
53 | * Description of the invocation
|
54 | */
|
55 | get description(): string;
|
56 | toString(): string;
|
57 | /**
|
58 | * Assert the method exists on the target. An error will be thrown if otherwise.
|
59 | * @param context - Invocation context
|
60 | */
|
61 | assertMethodExists(): Record<string, Function>;
|
62 | /**
|
63 | * Invoke the target method with the given context
|
64 | * @param context - Invocation context
|
65 | * @param options - Options for the invocation
|
66 | */
|
67 | invokeTargetMethod(options?: InvocationOptions): any;
|
68 | }
|
69 | /**
|
70 | * Options to control invocations
|
71 | */
|
72 | export type InvocationOptions = {
|
73 | |
74 |
|
75 |
|
76 | skipParameterInjection?: boolean;
|
77 | |
78 |
|
79 |
|
80 | skipInterceptors?: boolean;
|
81 | |
82 |
|
83 |
|
84 |
|
85 | source?: InvocationSource;
|
86 | |
87 |
|
88 |
|
89 | session?: ResolutionSession;
|
90 | };
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | export declare function invokeMethod(target: object, method: string, ctx: Context, nonInjectedArgs?: InvocationArgs, options?: InvocationOptions): ValueOrPromise<InvocationResult>;
|