Skip to content

Commit

Permalink
fix: Non exist getAllMethodNames from metadataScanner
Browse files Browse the repository at this point in the history
  • Loading branch information
fjodor-rybakov committed Feb 28, 2023
1 parent f6203b1 commit 3705893
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/core/src/services/command-handler-finder.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export class CommandHandlerFinderService {
) {}

async searchHandler(instance: InstanceType<any>): Promise<string> {
const methodNames = new Set(
this.metadataScanner.getAllMethodNames(Object.getPrototypeOf(instance)),
);
const methodNames = new Set(this.getMethodsFromInstance(instance));

if (methodNames.size === 0)
throw new Error(
Expand Down Expand Up @@ -42,4 +40,17 @@ export class CommandHandlerFinderService {

return handlerData.methodName;
}

private getMethodsFromInstance(instance: InstanceType<any>) {
if (typeof this.metadataScanner.getAllMethodNames === 'function') {
return this.metadataScanner.getAllMethodNames(
Object.getPrototypeOf(instance),
);
}

// TODO: Remove later deprecated method
return this.metadataScanner.getAllFilteredMethodNames(
Object.getPrototypeOf(instance),
);
}
}

0 comments on commit 3705893

Please sign in to comment.