zazoomauro / node-dependency-injection

The NodeDependencyInjection component allows you to standarize and centralize the way objects are constructed in your application.
https://github.com/zazoomauro/node-dependency-injection/wiki
MIT License
276 stars 34 forks source link

findTaggedServiceIds return empty #197

Closed DiV666 closed 1 year ago

DiV666 commented 1 year ago

Hi,

I have added a tag in a container.register like this:

container
        .register('Scaffolding.User.UserUpdate', UserUpdate)
        .addArgument(new Reference('Shared.BunyanLogger'))
        .addArgument(new Reference('Scaffolding.User.UserMongoRepository'))
        .addArgument(new Reference('Shared.EventBus'))
        .addTag('domainEventSubscriber');

But the findTaggedServiceIds method always return an empty iterator:

const subscriberDefinitions = container.findTaggedServiceIds('domainEventSubscriber');
console.log(subscriberDefinitions);  // => GeneratorFunctionPrototype [Generator] {}

version 3.0.5 I am doing something wrong?

zazoomauro commented 1 year ago

@DiV666 Can you try to compile the container before executing findTaggedServiceIds?

DiV666 commented 1 year ago

yes, even running compile before, returns an empty iterator

zazoomauro commented 1 year ago

Is returning a Generator not an array. Try to iterate it with a for… You will find all your services