1 | import { IntrospectionResult, Type } from '@nestjs/common';
|
2 | import { AbstractInstanceResolver } from './abstract-instance-resolver';
|
3 | import { NestContainer } from './container';
|
4 | import { Injector } from './injector';
|
5 | import { InstanceLinksHost } from './instance-links-host';
|
6 | import { ContextId } from './instance-wrapper';
|
7 | import { Module } from './module';
|
8 | export interface ModuleRefGetOrResolveOpts {
|
9 | |
10 |
|
11 |
|
12 |
|
13 | strict?: boolean;
|
14 | |
15 |
|
16 |
|
17 |
|
18 |
|
19 | each?: boolean;
|
20 | }
|
21 | export declare abstract class ModuleRef extends AbstractInstanceResolver {
|
22 | protected readonly container: NestContainer;
|
23 | protected readonly injector: Injector;
|
24 | private _instanceLinksHost;
|
25 | protected get instanceLinksHost(): InstanceLinksHost;
|
26 | constructor(container: NestContainer);
|
27 | /**
|
28 | * Retrieves an instance of either injectable or controller, otherwise, throws exception.
|
29 | * @returns {TResult}
|
30 | */
|
31 | abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): TResult;
|
32 | |
33 |
|
34 |
|
35 |
|
36 | abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
37 | |
38 |
|
39 |
|
40 |
|
41 | strict?: boolean;
|
42 |
|
43 | each?: undefined | false;
|
44 | }): TResult;
|
45 | |
46 |
|
47 |
|
48 |
|
49 | abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options: {
|
50 | |
51 |
|
52 |
|
53 |
|
54 | strict?: boolean;
|
55 |
|
56 | each: true;
|
57 | }): Array<TResult>;
|
58 | |
59 |
|
60 |
|
61 |
|
62 | abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, options?: ModuleRefGetOrResolveOpts): TResult | Array<TResult>;
|
63 | |
64 |
|
65 |
|
66 |
|
67 | abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): Promise<TResult>;
|
68 | |
69 |
|
70 |
|
71 |
|
72 | abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
73 | id: number;
|
74 | }): Promise<TResult>;
|
75 | |
76 |
|
77 |
|
78 |
|
79 | abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
80 | id: number;
|
81 | }, options?: {
|
82 | strict?: boolean;
|
83 | each?: undefined | false;
|
84 | }): Promise<TResult>;
|
85 | |
86 |
|
87 |
|
88 |
|
89 | abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
90 | id: number;
|
91 | }, options?: {
|
92 | strict?: boolean;
|
93 | each: true;
|
94 | }): Promise<Array<TResult>>;
|
95 | |
96 |
|
97 |
|
98 |
|
99 | abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
|
100 | id: number;
|
101 | }, options?: ModuleRefGetOrResolveOpts): Promise<TResult | Array<TResult>>;
|
102 | abstract create<T = any>(type: Type<T>, contextId?: ContextId): Promise<T>;
|
103 | introspect<T = any>(token: Type<T> | string | symbol): IntrospectionResult;
|
104 | registerRequestByContextId<T = any>(request: T, contextId: ContextId): void;
|
105 | protected instantiateClass<T = any>(type: Type<T>, moduleRef: Module, contextId?: ContextId): Promise<T>;
|
106 | }
|