declare namespace interfaces { type BindingScope = "Singleton" | "Transient" | "Request"; type BindingType = "ConstantValue" | "Constructor" | "DynamicValue" | "Factory" | "Function" | "Instance" | "Invalid" | "Provider"; type TargetType = "ConstructorArgument" | "ClassProperty" | "Variable"; interface BindingScopeEnum { Request: interfaces.BindingScope; Singleton: interfaces.BindingScope; Transient: interfaces.BindingScope; } interface BindingTypeEnum { ConstantValue: interfaces.BindingType; Constructor: interfaces.BindingType; DynamicValue: interfaces.BindingType; Factory: interfaces.BindingType; Function: interfaces.BindingType; Instance: interfaces.BindingType; Invalid: interfaces.BindingType; Provider: interfaces.BindingType; } interface TargetTypeEnum { ConstructorArgument: interfaces.TargetType; ClassProperty: interfaces.TargetType; Variable: interfaces.TargetType; } interface Newable { new (...args: any[]): T; } interface Abstract { prototype: T; } type ServiceIdentifier = (string | symbol | Newable | Abstract); interface Clonable { clone(): T; } interface Binding extends Clonable> { id: number; moduleId: string; activated: boolean; serviceIdentifier: ServiceIdentifier; constraint: ConstraintFunction; dynamicValue: ((context: interfaces.Context) => T) | null; scope: BindingScope; type: BindingType; implementationType: Newable | null; factory: FactoryCreator | null; provider: ProviderCreator | null; onActivation: ((context: interfaces.Context, injectable: T) => T) | null; cache: T | null; } type Factory = (...args: any[]) => (((...args: any[]) => T) | T); type FactoryCreator = (context: Context) => Factory; type Provider = (...args: any[]) => (((...args: any[]) => Promise) | Promise); type ProviderCreator = (context: Context) => Provider; interface NextArgs { avoidConstraints: boolean; contextInterceptor: ((contexts: Context) => Context); isMultiInject: boolean; targetType: TargetType; serviceIdentifier: interfaces.ServiceIdentifier; key?: string | number | symbol; value?: any; } type Next = (args: NextArgs) => (any | any[]); type Middleware = (next: Next) => Next; type ContextInterceptor = (context: interfaces.Context) => interfaces.Context; interface Context { id: number; container: Container; plan: Plan; currentRequest: Request; addPlan(plan: Plan): void; setCurrentRequest(request: Request): void; } interface ReflectResult { [key: string]: Metadata[]; } interface Metadata { key: string | number | symbol; value: any; } interface Plan { parentContext: Context; rootRequest: Request; } interface QueryableString { startsWith(searchString: string): boolean; endsWith(searchString: string): boolean; contains(searchString: string): boolean; equals(compareString: string): boolean; value(): string; } type ResolveRequestHandler = (request: interfaces.Request) => any; type RequestScope = Map | null; interface Request { id: number; serviceIdentifier: ServiceIdentifier; parentContext: Context; parentRequest: Request | null; childRequests: Request[]; target: Target; bindings: Binding[]; requestScope: RequestScope; addChildRequest(serviceIdentifier: ServiceIdentifier, bindings: (Binding | Binding[]), target: Target): Request; } interface Target { id: number; serviceIdentifier: ServiceIdentifier; type: TargetType; name: QueryableString; metadata: Metadata[]; getNamedTag(): interfaces.Metadata | null; getCustomTags(): interfaces.Metadata[] | null; hasTag(key: string | number | symbol): boolean; isArray(): boolean; matchesArray(name: interfaces.ServiceIdentifier): boolean; isNamed(): boolean; isTagged(): boolean; isOptional(): boolean; matchesNamedTag(name: string): boolean; matchesTag(key: string | number | symbol): (value: any) => boolean; } interface ContainerOptions { autoBindInjectable?: boolean; defaultScope?: BindingScope; skipBaseClassChecks?: boolean; } interface Container { id: number; parent: Container | null; options: ContainerOptions; bind(serviceIdentifier: ServiceIdentifier): BindingToSyntax; rebind(serviceIdentifier: interfaces.ServiceIdentifier): interfaces.BindingToSyntax; unbind(serviceIdentifier: ServiceIdentifier): void; unbindAll(): void; isBound(serviceIdentifier: ServiceIdentifier): boolean; isBoundNamed(serviceIdentifier: ServiceIdentifier, named: string | number | symbol): boolean; isBoundTagged(serviceIdentifier: ServiceIdentifier, key: string | number | symbol, value: any): boolean; get(serviceIdentifier: ServiceIdentifier): T; getNamed(serviceIdentifier: ServiceIdentifier, named: string | number | symbol): T; getTagged(serviceIdentifier: ServiceIdentifier, key: string | number | symbol, value: any): T; getAll(serviceIdentifier: ServiceIdentifier): T[]; resolve(constructorFunction: interfaces.Newable): T; load(...modules: ContainerModule[]): void; loadAsync(...modules: AsyncContainerModule[]): Promise; unload(...modules: ContainerModule[]): void; applyCustomMetadataReader(metadataReader: MetadataReader): void; applyMiddleware(...middleware: Middleware[]): void; snapshot(): void; restore(): void; createChild(): Container; } type Bind = (serviceIdentifier: ServiceIdentifier) => BindingToSyntax; type Rebind = (serviceIdentifier: ServiceIdentifier) => BindingToSyntax; type Unbind = (serviceIdentifier: ServiceIdentifier) => void; type IsBound = (serviceIdentifier: ServiceIdentifier) => boolean; interface ContainerModule { id: number; registry: ContainerModuleCallBack; } interface AsyncContainerModule { id: number; registry: AsyncContainerModuleCallBack; } type ContainerModuleCallBack = (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => void; type AsyncContainerModuleCallBack = (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => Promise; interface ContainerSnapshot { bindings: Lookup>; middleware: Next | null; } interface Lookup extends Clonable> { add(serviceIdentifier: ServiceIdentifier, value: T): void; getMap(): Map, T[]>; get(serviceIdentifier: ServiceIdentifier): T[]; remove(serviceIdentifier: interfaces.ServiceIdentifier): void; removeByCondition(condition: (item: T) => boolean): void; hasKey(serviceIdentifier: ServiceIdentifier): boolean; clone(): Lookup; traverse(func: (key: interfaces.ServiceIdentifier, value: T[]) => void): void; } interface BindingOnSyntax { onActivation(fn: (context: Context, injectable: T) => T): BindingWhenSyntax; } interface BindingWhenSyntax { when(constraint: (request: Request) => boolean): BindingOnSyntax; whenTargetNamed(name: string | number | symbol): BindingOnSyntax; whenTargetIsDefault(): BindingOnSyntax; whenTargetTagged(tag: string | number | symbol, value: any): BindingOnSyntax; whenInjectedInto(parent: (Function | string)): BindingOnSyntax; whenParentNamed(name: string | number | symbol): BindingOnSyntax; whenParentTagged(tag: string | number | symbol, value: any): BindingOnSyntax; whenAnyAncestorIs(ancestor: (Function | string)): BindingOnSyntax; whenNoAncestorIs(ancestor: (Function | string)): BindingOnSyntax; whenAnyAncestorNamed(name: string | number | symbol): BindingOnSyntax; whenAnyAncestorTagged(tag: string | number | symbol, value: any): BindingOnSyntax; whenNoAncestorNamed(name: string | number | symbol): BindingOnSyntax; whenNoAncestorTagged(tag: string | number | symbol, value: any): BindingOnSyntax; whenAnyAncestorMatches(constraint: (request: Request) => boolean): BindingOnSyntax; whenNoAncestorMatches(constraint: (request: Request) => boolean): BindingOnSyntax; } interface BindingWhenOnSyntax extends BindingWhenSyntax, BindingOnSyntax { } interface BindingInSyntax { inSingletonScope(): BindingWhenOnSyntax; inTransientScope(): BindingWhenOnSyntax; inRequestScope(): BindingWhenOnSyntax; } interface BindingInWhenOnSyntax extends BindingInSyntax, BindingWhenOnSyntax { } interface BindingToSyntax { to(constructor: { new (...args: any[]): T; }): BindingInWhenOnSyntax; toSelf(): BindingInWhenOnSyntax; toConstantValue(value: T): BindingWhenOnSyntax; toDynamicValue(func: (context: Context) => T): BindingInWhenOnSyntax; toConstructor(constructor: Newable): BindingWhenOnSyntax; toFactory(factory: FactoryCreator): BindingWhenOnSyntax; toFunction(func: T): BindingWhenOnSyntax; toAutoFactory(serviceIdentifier: ServiceIdentifier): BindingWhenOnSyntax; toProvider(provider: ProviderCreator): BindingWhenOnSyntax; toService(service: ServiceIdentifier): void; } interface ConstraintFunction extends Function { metaData?: Metadata; (request: Request | null): boolean; } interface MetadataReader { getConstructorMetadata(constructorFunc: Function): ConstructorMetadata; getPropertiesMetadata(constructorFunc: Function): MetadataMap; } interface MetadataMap { [propertyNameOrArgumentIndex: string]: Metadata[]; } interface ConstructorMetadata { compilerGeneratedMetadata: Function[] | undefined; userGeneratedMetadata: MetadataMap; } } export { interfaces };