Questions tagged [inversifyjs]

InversifyJS is a lightweight IoC container written in TypeScript.

InversifyJS is a lightweight pico inversion of control (IoC) container for TypeScript and JavaScript apps. A pico IoC container uses a class constructor to identify and inject its dependencies.

InversifyJS is easy to integrate with the majority of existing JavaScript frameworks and encourage the usage of the best OOP and IoC practices.

You can learn more about InversifyJS at http://inversify.io/

197 questions
1
vote
1 answer

inversify-restify-utils an empty context and a body in the controller

I try to get working inversify-restify-utils but I faced with a problem. Request context and body variable are empty. My controller: @Controller('/users') @injectable() export class UsersController implements interfaces.Controller { @Post('/') …
Alex Po
  • 1,837
  • 1
  • 24
  • 28
1
vote
0 answers

Testing Inversify w/ Mocha causes strange error ERROR_MSGS.NULL_ARGUMENT

I'm getting the following error when I try to test my code with Mocha/Chai. Has anyone else seen this error? /Users/me/Sites/my_project/node_modules/inversify/lib/container/lookup.js:13 throw new Error(ERROR_MSGS.NULL_ARGUMENT); …
1
vote
1 answer

InversifyJS : Error when retrieving object from container

I am using InversifyJS to setup some kind-of dynamic binding and running it on NodeJS. The problem I have is that I get errors, but without messages and only a stacktrace. The Main class export class Main { public static getCalculator(config:…
Jacks
  • 587
  • 5
  • 28
1
vote
1 answer

InversifyJs error only in IE

I'm using Typescript with webpack to create a web application. Recently I switched do inversifyJs DI library. Only on IE (11) I'm getting an error: Missing required @injectable annotation in: MyClassName The class is annotated, it does not extend…
Patman
  • 185
  • 1
  • 13
1
vote
1 answer

TypeScript InversifyJS: asynchronous binding

I'm facing this kind of problem: I'm creating Event Manager with ability to handle several concrete providers, and I'm struggling with dependency injection issue here. I'm using: Typescript@2.0.10, node@7.0.0, inversify@2.0.1,…
1
vote
3 answers

Using inversify-express-utils, how can i integrate websockets?

We try to connect to extend our typescript application based on inversify-express-utils with websockets, but no luck so far: import 'reflect-metadata'; import {interfaces, InversifyExpressServer, TYPE} from 'inversify-express-utils'; import { Kernel…
D. Kellenberger
  • 237
  • 5
  • 13
0
votes
0 answers

Issue with rebind & unbind inversify container with jest unit testing in nuxt bridge

I am having an inversify container in nuxt bridge project. the container has some dep which needs to import nuxt config (to load some global variables). I mocked that dependcy that I need to test after it. then rebinded it from the original…
Mohamed Mostafa
  • 520
  • 2
  • 10
0
votes
0 answers

how to create unit tests for a graphl resolver mocking the controller without using class

I'm trying to create an api using dependency inversion concepts with inversify. In case I have a graphl resolver that uses a controller that comes from the inversify container, but when writing tests with jest I can't mock this controller, can…
0
votes
1 answer

How to mock data when testing with vitest and Dependency Injection

I'm trying to write tests for a class that uses dependency injection (DI) and I'm using the vitest testing framework. The class I want to test is CastVoteCommandHandler, which has a dependency on a VoteRepository. I want to mock the VoteRepository…
IvonaK
  • 119
  • 10
0
votes
0 answers

rtk query acting one step behind in setting the states

im using dependency injection in my next.js project by the aidf of inversify librarby this is the rtk api import { ErrorResponseDto, IResponseDto } from "@/domain/dto"; import baseApi from "../baseApi"; import { SuccessLoginResponseDto } from…
0
votes
0 answers

Typeorm + inversify for custom repositories

What would be the best way to inject custom repositories from typeorm using inversify. So far I came with 2 approaches: Given a service that consumes a Repository: @injectable() export class EntityService { private readonly _repo:…
Rwanou
  • 431
  • 5
  • 24
0
votes
1 answer

Cannot read properties of undefined (reading '_userService') when using inversifyJS inject

I'am trying to implement a DI but seems that I'm missing some concepts of Inversify. Do I need to implement the "get" method for "user.controller" and "bind" it to the routes function? Complete code repo Error when I try to GET /users: TypeError:…
0
votes
0 answers

how to pass in parameters for private property from constructor - factory

I am looking at inversify example, I have question about the Warrior.rank property, assume in a world without DI, I also have another private property called Warrior.salary which can be assigned by Warrior constructor parameter. In the example, even…
Zhongmin
  • 1,684
  • 1
  • 16
  • 33
0
votes
0 answers

Issue initializing auth0 with Typescript and Inversify

I have a backend project running on AWS Lambda with Node.js and TypeScript. I am using serverless framework - more specifically serverless-bundle with inversify The problem is auth0 does not initializes with inversify. This was a not a problem…
codeinprogress
  • 3,193
  • 7
  • 43
  • 69
0
votes
0 answers

Inversify-Express-Utils Decorator @requestBody not working

Trying to validate the request through the DTO by calling the @requestBody annotation at the controller route. Controller Method - @httpPost('/login') public async login(@request() req: Request, @response() res: Response, @requestBody() body:…