Add TreeModel and HasSubtree implementation
This commit is contained in:
@@ -12,12 +12,11 @@ import {
|
||||
Awaitable,
|
||||
collect,
|
||||
Collection,
|
||||
ErrorWithContext,
|
||||
globalRegistry,
|
||||
hasOwnProperty,
|
||||
logIfDebugging,
|
||||
withErrorContext,
|
||||
} from '../util'
|
||||
import {ErrorWithContext, withErrorContext} from '../util/error/ErrorWithContext'
|
||||
import {Factory} from './factory/Factory'
|
||||
import {DuplicateFactoryKeyError} from './error/DuplicateFactoryKeyError'
|
||||
import {ClosureFactory} from './factory/ClosureFactory'
|
||||
@@ -529,7 +528,7 @@ export class Container {
|
||||
return realized
|
||||
}
|
||||
}, {
|
||||
makeStack: Container.makeStack,
|
||||
makeStack: Container.makeStack.map(x => typeof x === 'string' ? x : (x?.name || 'unknown')).toArray(),
|
||||
})
|
||||
|
||||
if ( result ) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'reflect-metadata'
|
||||
import {collect, Collection, logIfDebugging} from '../../util'
|
||||
import {collect, Collection} from '../../util'
|
||||
import {logIfDebugging} from '../../util/support/debug'
|
||||
import {
|
||||
DependencyKey,
|
||||
DependencyRequirement,
|
||||
@@ -100,9 +101,7 @@ export const Inject = (key?: DependencyKey, { debug = false } = {}): PropertyDec
|
||||
}
|
||||
}
|
||||
|
||||
if ( debug ) {
|
||||
logIfDebugging('extollo.di.decoration', '[DEBUG] @Inject() - key:', key, 'property:', property, 'target:', target, 'target constructor:', target?.constructor, 'type:', type)
|
||||
}
|
||||
logIfDebugging('extollo.di.decoration', '[DEBUG] @Inject() - key:', key, 'property:', property, 'target:', target, 'target constructor:', target?.constructor, 'type:', type)
|
||||
|
||||
Reflect.defineMetadata(DEPENDENCY_KEYS_PROPERTY_METADATA_KEY, propertyMetadata, target?.constructor || target)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {DependencyKey} from '../types'
|
||||
import {ErrorWithContext} from '../../util'
|
||||
import {ErrorWithContext} from '../../util/error/ErrorWithContext'
|
||||
|
||||
/**
|
||||
* Error thrown when a dependency key that has not been registered is passed to a resolver.
|
||||
|
||||
@@ -51,6 +51,6 @@ export abstract class AbstractFactory<T> {
|
||||
return this.token
|
||||
}
|
||||
|
||||
return this.token.name ?? '(unknown token)'
|
||||
return this.token?.name ?? '(unknown token)'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
Instantiable,
|
||||
PropertyDependency,
|
||||
} from '../types'
|
||||
import {Collection} from '../../util'
|
||||
import {Collection, logIfDebugging} from '../../util'
|
||||
import 'reflect-metadata'
|
||||
|
||||
/**
|
||||
@@ -58,6 +58,7 @@ export class Factory<T> extends AbstractFactory<T> {
|
||||
|
||||
do {
|
||||
const loadedMeta = Reflect.getMetadata(DEPENDENCY_KEYS_PROPERTY_METADATA_KEY, currentToken)
|
||||
logIfDebugging('extollo.di.injection', 'Factory.getInjectedProperties() target:', currentToken, 'loaded:', loadedMeta)
|
||||
if ( loadedMeta ) {
|
||||
meta.concat(loadedMeta)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user