title: How to get method and its metadata from NestJS provider?
body: <p>I'm making a <code>NestJS</code> wrapper for <code>Typegoose</code> because the existing one is complete deprecated and has one critical drawback that I want to fix in my implementation.</p>
  <p>Problem: there is <code>@EventTrackerFor(schema: AnyClass)</code> that takes <code>Typegoose class</code>. It's implemented like this:</p>
  <pre class="lang-js prettyprint-override"><code>export const EventTrackerFor = (schema: AnyClass) =&gt;
      applyDecorators(Injectable, SetMetadata('tracker-for', schema.name));
  </code></pre>
  <p>Also, there are <code>@Pre(eventName: PreEvents)</code> and <code>Post(eventName: PostEvents)</code> decorators:</p>
  <pre class="lang-js prettyprint-override"><code>export const Post = (eventName: PreEvents) =&gt; SetMetadata('post', eventName);
  export const Pre = (eventName: PostEvents) =&gt; SetMetadata('pre', eventName);
  </code></pre>
  <p>And as a result, library user will do it like that:</p>
  <pre class="lang-js prettyprint-override"><code>@EventTrackerFor(User)
  class UserEventTracker {
      constructor(private readonly anyService: AnyService) {}
  
      @Pre(PreEvents.SAVE)
      @Post(PostEvents.SAVE)
      logOnAndAfterCreate() {
          console.log('user created')
      }
  }
  
  // ------------------------ Any module
  @Module({ 
      imports: [MyModule.forFeature([ {schema: User} ])],
      providers: [UserEventTracker]
  })
  class AnyModule {}
  </code></pre>
  <p>I need to get value from <code>@EventTrackerFor</code> somehow and methods of the provider, which are decorated with <code>@Pre()</code> and <code>@Post</code> decorators, including values that passed inside them.</p>
  <p>I was looking for a clue in different packages like <code>@nestjs/bull</code>, which has similar logics inside, but they have so much code, so I could not understand how do they do it.</p>
  <p>Project repository: <a href="https://github.com/GrapeoffJS/kindagoose" rel="nofollow noreferrer">https://github.com/GrapeoffJS/kindagoose</a></p>