UNPKG

1.36 kBTypeScriptView Raw
1import { IocContract, IocResolverLookupNode, IocResolverContract } from '../Contracts';
2/**
3 * Exposes the API to resolve and call bindings from the IoC container. The resolver
4 * internally caches the IoC container lookup nodes to boost performance.
5 */
6export declare class IocResolver implements IocResolverContract<any> {
7 private container;
8 private fallbackMethod?;
9 private rcNamespaceKey?;
10 private fallbackNamespace?;
11 private lookupCache;
12 /**
13 * The namespace that will be used as a prefix when resolving
14 * bindings
15 */
16 private prefixNamespace;
17 constructor(container: IocContract, fallbackMethod?: string | undefined, rcNamespaceKey?: string | undefined, fallbackNamespace?: string | undefined);
18 /**
19 * Returns the prefix namespace by giving preference to the
20 * `.adonisrc.json` file
21 */
22 private getPrefixNamespace;
23 /**
24 * Resolves the namespace and returns it's lookup node
25 */
26 resolve(namespace: string, prefixNamespace?: string | undefined): IocResolverLookupNode<string>;
27 /**
28 * Calls the namespace.method expression with any arguments that needs to
29 * be passed. Also supports type-hinting dependencies.
30 */
31 call(namespace: string | IocResolverLookupNode<string>, prefixNamespace?: string, args?: any[] | ((instance: any) => any[])): Promise<any>;
32}