@tsed/di 7.27.2 → 7.29.0

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.
@@ -52,6 +52,7 @@ export * from "./services/DILogger";
52
52
  export * from "./services/DITest";
53
53
  export * from "./services/InjectorService";
54
54
  export * from "./utils/asyncHookContext";
55
+ export * from "./utils/attachLogger";
55
56
  export * from "./utils/colors";
56
57
  export * from "./utils/createContainer";
57
58
  export * from "./utils/getConfiguration";
@@ -0,0 +1,3 @@
1
+ import type { Logger } from "@tsed/logger";
2
+ import { InjectorService } from "../services/InjectorService";
3
+ export declare function attachLogger(injector: InjectorService, $log: Logger): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/di",
3
- "version": "7.27.2",
3
+ "version": "7.29.0",
4
4
  "description": "DI module for Ts.ED Framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -25,17 +25,17 @@
25
25
  "tslib": "2.5.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@tsed/core": "7.27.2",
29
- "@tsed/eslint": "7.27.2",
28
+ "@tsed/core": "7.29.0",
29
+ "@tsed/eslint": "7.29.0",
30
30
  "@tsed/logger": ">=6.2.2",
31
- "@tsed/schema": "7.27.2",
32
- "@tsed/typescript": "7.27.2",
31
+ "@tsed/schema": "7.29.0",
32
+ "@tsed/typescript": "7.29.0",
33
33
  "eslint": "^8.12.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "@tsed/core": "^7.27.2",
36
+ "@tsed/core": "^7.29.0",
37
37
  "@tsed/logger": ">=6.2.2",
38
- "@tsed/schema": "^7.27.2"
38
+ "@tsed/schema": "^7.29.0"
39
39
  },
40
40
  "peerDependenciesMeta": {
41
41
  "@tsed/core": {
package/readme.md CHANGED
@@ -118,19 +118,25 @@ export class CalendarCtrl {
118
118
  Finally, we can load the injector and use:
119
119
 
120
120
  ```typescript
121
- import {InjectorService} from "@tsed/di";
121
+ import {InjectorService, attachLogger} from "@tsed/di";
122
+ import {$log} from "@tsed/logger";
122
123
  import {CalendarCtrl} from "./CalendarCtrl";
123
124
 
124
125
  async function bootstrap() {
125
126
  const injector = new InjectorService();
126
127
 
128
+ // configure the default logger
129
+ attachLogger(injector, $log);
130
+
127
131
  // Load all providers registered via @Injectable decorator
128
132
  await injector.load();
129
133
 
130
134
  const calendarController = injector.get<CalendarCtrl>();
131
-
132
135
  await calendarController.create(new Calendar());
133
136
 
137
+ // emit event to trigger actions for third parties modules
138
+ await injector.emit("$onReady");
139
+
134
140
  // And finally destroy injector and his instances (see injector hooks)
135
141
  await injector.destroy();
136
142
  }