API reference
@searsuite/sear-foundation-di
Editor-scoped dependency injection with explicit ownership and borrowed instances.
7 exportsderived from source
- classContainersource ↗
-
class ContainerDependency container.
Composition roots create and own explicit instances. Stateful runtimes must never share a process-wide container because resetting or rebinding one runtime would otherwise affect every other live runtime.
constructorconstructor Container(): Containerpropertytypes readonly types: Map<any, any>Registered dependency tokens owned by this container.
methodaddDependency addDependency(parent: symbol, dependency: string | symbol): voidAdds the dependency.
parent: symboldependency: string | symbol
methodcreateLazy createLazy<T>(identifier: string): (): TCreates the lazy.
identifier: string
methoddestroy destroy(): voidmethoddispose dispose(): voidmethodgetDependency getDependency(): voidReturns the dependency.
methodgetDependencyGraphText getDependencyGraphText(): voidReturns the dependency graph text.
methodhasBinding hasBinding(identifier: string | symbol): booleanReturns whether this container has an explicit local binding for an identifier.
identifier: string | symbol
methodhasSingleton hasSingleton(identifier: string | symbol): booleanReturns whether a singleton has already been materialized for an identifier.
identifier: string | symbol
methodregister register<T>(identifier: Identifier<T>, clazz: Constructor<T>, scope?: Scope): voidRegisters the value.
identifier: Identifier<T>clazz: Constructor<T>scope: Scope
methodregisterBorrowedInstance registerBorrowedInstance<T>(identifier: Identifier<T>, instance: T): voidBinds a parent-owned instance without acquiring its teardown responsibility.
identifier: Identifier<T>instance: T
methodregisterFactory registerFactory<T>(identifier: Identifier<T>, factory: FactoryFunction<T>, scope?: Scope): voidRegisters the factory.
identifier: Identifier<T>factory: FactoryFunction<T>scope: Scope
methodregisterInstance registerInstance<T>(identifier: Identifier<T>, instance: T): voidRegisters the instance.
identifier: Identifier<T>instance: T
methodregisterTypes registerTypes(module: symbol, types: { }): voidRegisters the types.
module: symboltypes: { }
methodreset reset(): voidReleases created resources and removes every registration from this container.
methodresolve resolve<T>(identifier: string | symbol): TResolves a dependency from this container and its parent scope.
identifier: string | symbol
- variableINJECT_METADATA_KEYsource ↗
-
INJECT_METADATA_KEY: typeof INJECT_METADATA_KEYMetadata key storing constructor parameter injection tokens.
- variableINJECTABLE_METADATA_KEYsource ↗
-
INJECTABLE_METADATA_KEY: typeof INJECTABLE_METADATA_KEYMetadata key that marks a class as resolvable by the DI container.
- functionInjectsource ↗
-
Inject(identifier: unknown): ParameterDecoratorRecords the DI token that should satisfy one constructor parameter.
ReturnsParameter decorator used on constructor arguments.
identifier: unknownToken registered in the DI container.
- functionInjectablesource ↗
-
Injectable(): ClassDecoratorMarks a class as injectable by the DI container.
ReturnsClass decorator that records injectable metadata.
No public exports match that search.