How to give TypeORM Datasource from middleware to Nestjs

I have a middleware that create a connection from TypeORM to the database wanted, at each request to the api.

I would like to link the created Datasource connexion to Nestjs and use the Datasource from the Nestjs injections like :

@InjectDatasource()

The only things I could have done was to pass the TypeORM Datasource has a part of request so the controllers could use it.

Is there a way to do it from the Nestjs injection directly ? It would be better and easier for the developpers.

Thanks in advance.