UNPKG

@dipscope/type-manager

Version:

Transform JSON strings or plain objects into JS class instances.

125 lines 4.34 kB
import { Alias } from './alias'; import { InjectIndex } from './inject-index'; import { InjectOptions } from './inject-options'; import { InjectState } from './inject-state'; import { ResolvedInjectState } from './inject-states/resolved-inject-state'; import { UnresolvedInjectState } from './inject-states/unresolved-inject-state'; import { Metadata } from './metadata'; import { Optional } from './optional'; import { TypeArgument } from './type-argument'; import { TypeFn } from './type-fn'; import { TypeManager } from './type-manager'; import { TypeMetadata } from './type-metadata'; /** * Main class used to describe an injection. * * @type {InjectMetadata<TDeclaringObject, TObject>} */ export declare class InjectMetadata<TDeclaringObject, TObject> extends Metadata { /** * Type metadata to which inject metadata belongs to. * * @type {TypeMetadata<TDeclaringObject>} */ readonly declaringTypeMetadata: TypeMetadata<TDeclaringObject>; /** * Index of injection within a type constructor function. * * @type {InjectIndex} */ readonly injectIndex: InjectIndex; /** * Inject options. * * @type {InjectOptions<TObject>} */ private readonly injectOptions; /** * Type function defined using reflect metadata. * * @type {Optional<TypeFn<TObject>>} */ private readonly reflectTypeFn; /** * Current inject state. * * @type {InjectState<TDeclaringObject, TObject>} */ private currentInjectState; /** * Constructor. * * @param {TypeManager} typeManager Type manager. * @param {ReadonlyMap<Alias, TypeFn<any>>} typeFnMap Type function map for types with aliases. * @param {TypeMetadata<TDeclaringObject>} declaringTypeMetadata Type metadata to which inject metadata belongs to. * @param {InjectIndex} injectIndex Index of injection within a type constructor function. * @param {InjectOptions<TObject>} injectOptions Inject options. */ constructor(typeManager: TypeManager, typeFnMap: ReadonlyMap<Alias, TypeFn<any>>, declaringTypeMetadata: TypeMetadata<TDeclaringObject>, injectIndex: InjectIndex, injectOptions: InjectOptions<TObject>); /** * Gets inject state. * * @returns {InjectState<TDeclaringObject, TObject>} Inject state. */ get injectState(): InjectState<TDeclaringObject, TObject>; /** * Gets key. * * @returns {Optional<string>} Key or undefined. */ get key(): Optional<string>; /** * Gets type argument. * * @returns {TypeArgument<TObject>} Type argument. */ get typeArgument(): TypeArgument<TObject>; /** * Gets inject type metadata. * * @returns {TypeMetadata<TObject>} Type metadata. */ get typeMetadata(): TypeMetadata<TObject>; /** * Resolves inject state. * * Calling this method has side effects by recomputing injection state. If you need current * inject state then use provided getter for that. * * @returns {ResolvedInjectState<TDeclaringObject, TObject>} Resolved inject state. */ resolveInjectState(): ResolvedInjectState<TDeclaringObject, TObject>; /** * Unresolves inject state. * * Calling this method has side effects by resetting inject state. * * @returns {UnresolvedInjectState<TDeclaringObject, TObject>} Unresolved inject state. */ unresolveInjectState(): UnresolvedInjectState<TDeclaringObject, TObject>; /** * Configures key. * * @param {Optional<string>} key Key or undefined. * * @returns {this} Current instance of inject metadata. */ hasKey(key: Optional<string>): this; /** * Configures type argument. * * @param {Optional<TypeArgument<TObject>>} typeArgument Type argument or undefined. * * @returns {this} Current instance of inject metadata. */ hasTypeArgument(typeArgument: Optional<TypeArgument<TObject>>): this; /** * Configures inject metadata based on provided options. * * @param {InjectOptions<TObject>} injectOptions Inject options. * * @returns {this} Current instance of inject metadata. */ configure(injectOptions: InjectOptions<TObject>): this; } //# sourceMappingURL=inject-metadata.d.ts.map