@wabot-dev/framework 0.7.2 → 0.7.3
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.
|
@@ -53,6 +53,7 @@ function runChatControllers(controllers) {
|
|
|
53
53
|
}
|
|
54
54
|
for (const channelMetadata of chatControllerMetadata.channels) {
|
|
55
55
|
const channelContainer = container.createChildContainer();
|
|
56
|
+
channelContainer.register(Container, { useValue: channelContainer });
|
|
56
57
|
if (channelMetadata.channelConfig) {
|
|
57
58
|
channelContainer.register(channelMetadata.channelConfig.constructor, {
|
|
58
59
|
useValue: channelMetadata.channelConfig,
|
|
@@ -11,6 +11,7 @@ import { EXPRESS_REQ, EXPRESS_RES } from './injection-tokens.js';
|
|
|
11
11
|
import { RestControllerMetadataStore } from './metadata/RestControllerMetadataStore.js';
|
|
12
12
|
import { RestRequest } from './RestRequest.js';
|
|
13
13
|
import { IncomingMessage } from 'http';
|
|
14
|
+
import { Container } from '../../core/injection/Container.js';
|
|
14
15
|
|
|
15
16
|
function buildRequest(req) {
|
|
16
17
|
return Object.assign({}, req.body, req.query, req.params);
|
|
@@ -38,6 +39,7 @@ function runRestControllers(controllers) {
|
|
|
38
39
|
}
|
|
39
40
|
expressApp[method](route, ...rawMiddlewares, async (req, res) => {
|
|
40
41
|
const requestContainer = container.createChildContainer();
|
|
42
|
+
requestContainer.register(Container, { useValue: requestContainer });
|
|
41
43
|
requestContainer.register(EXPRESS_REQ, { useValue: req });
|
|
42
44
|
requestContainer.register(EXPRESS_RES, { useValue: req });
|
|
43
45
|
try {
|
|
@@ -8,6 +8,7 @@ import { Socket } from 'socket.io';
|
|
|
8
8
|
import '../socket/SocketServerConfig.js';
|
|
9
9
|
import { SocketServerProvider } from '../socket/SocketServerProvider.js';
|
|
10
10
|
import { SocketControllerMetadataStore } from './metadata/SocketControllerMetadataStore.js';
|
|
11
|
+
import { Container } from '../../core/injection/Container.js';
|
|
11
12
|
|
|
12
13
|
function runSocketControllers(controllers) {
|
|
13
14
|
const logger = new Logger('wabot:socket');
|
|
@@ -21,6 +22,7 @@ function runSocketControllers(controllers) {
|
|
|
21
22
|
const namespaceServer = socketServer.of(namespace);
|
|
22
23
|
namespaceServer.use(async (socket, next) => {
|
|
23
24
|
const connectionContainer = container.createChildContainer();
|
|
25
|
+
connectionContainer.register(Container, { useValue: connectionContainer });
|
|
24
26
|
try {
|
|
25
27
|
const middlewares = controllerInfo.handShakeMiddlewares?.map((x) => connectionContainer.resolve(x.middlewareConstructor)) ?? [];
|
|
26
28
|
for (const middleware of middlewares) {
|