@travetto/di 2.0.3 → 2.1.2
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 +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ npm install @travetto/di
|
|
|
11
11
|
[Dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) is a framework primitive. When used in conjunction with automatic file scanning, it provides for handling of application dependency wiring. Due to the nature of [Typescript](https://typescriptlang.org) and type erasure of interfaces, dependency injection only supports `class`es as type signafiers. The primary goal of dependency injection is to allow for separation of concerns of object creation and it's usage.
|
|
12
12
|
|
|
13
13
|
## Declaration
|
|
14
|
-
The [@Injectable](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L30) and [@InjectableFactory](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L72) decorators provide the registration of dependencies. Dependency declaration revolves around exposing `class`es and subtypes thereof to provide necessary functionality. Additionally, the framework will utilize dependencies to satisfy contracts with various implementations (e.g. [MongoModelService](https://github.com/travetto/travetto/tree/main/module/model-mongo/src/service.ts#
|
|
14
|
+
The [@Injectable](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L30) and [@InjectableFactory](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L72) decorators provide the registration of dependencies. Dependency declaration revolves around exposing `class`es and subtypes thereof to provide necessary functionality. Additionally, the framework will utilize dependencies to satisfy contracts with various implementations (e.g. [MongoModelService](https://github.com/travetto/travetto/tree/main/module/model-mongo/src/service.ts#L44) provides itself as an injectable candidate for [ModelCrudSupport](https://github.com/travetto/travetto/tree/main/module/model/src/service/crud.ts).
|
|
15
15
|
|
|
16
16
|
**Code: Example Injectable**
|
|
17
17
|
```typescript
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/di",
|
|
3
3
|
"displayName": "Dependency Injection",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.2",
|
|
5
5
|
"description": "Dependency registration/management and injection support.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"ast-transformations",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"directory": "module/di"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@travetto/transformer": "^2.
|
|
33
|
-
"@travetto/registry": "^2.
|
|
32
|
+
"@travetto/transformer": "^2.1.2",
|
|
33
|
+
"@travetto/registry": "^2.1.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@travetto/config": "^2.
|
|
37
|
-
"@travetto/schema": "^2.
|
|
36
|
+
"@travetto/config": "^2.1.2",
|
|
37
|
+
"@travetto/schema": "^2.1.2"
|
|
38
38
|
},
|
|
39
39
|
"docDependencies": {
|
|
40
40
|
"@travetto/model-mongo": true,
|