ts-ioc-container 31.1.4 → 31.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
- [Metadata](#metadata) `@inject`
|
|
30
30
|
- [Simple](#simple)
|
|
31
31
|
- [Proxy](#proxy)
|
|
32
|
-
- [Visibility](#visibility) `visible`
|
|
33
32
|
- [Provider](#provider) `@provider`
|
|
34
33
|
- [Singleton](#singleton) `singleton`
|
|
35
34
|
- [Arguments](#arguments) `args`
|
|
36
|
-
- [
|
|
35
|
+
- [Visibility](#visibility) `visible`
|
|
36
|
+
- [Registration](#registration) `@register(key('someKey'))`
|
|
37
37
|
- [Scope](#scope) `scope`
|
|
38
38
|
- [Alias](#alias) `alias`
|
|
39
39
|
- [Module](#module)
|
|
@@ -562,7 +562,7 @@ describe('Visibility', function () {
|
|
|
562
562
|
|
|
563
563
|
## Registration
|
|
564
564
|
Registration is provider factory which registers provider in container.
|
|
565
|
-
- `@
|
|
565
|
+
- `@register(key('logger'))`
|
|
566
566
|
- `Registration.fromClass(Logger).to('logger')`
|
|
567
567
|
- `Registration.fromClass(Logger)`
|
|
568
568
|
- `Registration.fromValue(Logger)`
|
|
@@ -617,7 +617,7 @@ describe('Registration module', function () {
|
|
|
617
617
|
|
|
618
618
|
### Scope
|
|
619
619
|
Sometimes you need to register provider only in scope which matches to certain condition and their sub scopes. Especially if you want to register dependency as singleton for some tags, for example `root`
|
|
620
|
-
- `@
|
|
620
|
+
- `@register(scope((container) => container.hasTag('root'))` - register provider only in root scope
|
|
621
621
|
- `Registration.fromClass(Logger).when((container) => container.hasTag('root'))`
|
|
622
622
|
|
|
623
623
|
```typescript
|
|
@@ -639,7 +639,7 @@ describe('ScopeProvider', function () {
|
|
|
639
639
|
|
|
640
640
|
### Alias
|
|
641
641
|
Alias is needed to group keys
|
|
642
|
-
- `@
|
|
642
|
+
- `@register(alias('logger'))` helper assigns `logger` alias to registration.
|
|
643
643
|
- `by.aliases((it) => it.has('logger') || it.has('a'))` resolves dependencies which have `logger` or `a` aliases
|
|
644
644
|
- `Registration.fromClass(Logger).addAliases('logger')`
|
|
645
645
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-ioc-container",
|
|
3
|
-
"version": "31.1.
|
|
3
|
+
"version": "31.1.6",
|
|
4
4
|
"description": "Typescript IoC container",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"ts-node": "^10.9.1",
|
|
60
60
|
"typescript": "5.4.3"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "4bc5328ab714c016de3392a095cf1dbbbf836e3a"
|
|
63
63
|
}
|