Skip to content

Commit

Permalink
update telegraf dev version to 4.16 (#1173)
Browse files Browse the repository at this point in the history
* docs: update deprecated `hookPath` to `path`

* chore(deps): update `telegraf` to `4.16`

* chore(utils): check `descriptor` is undefined
  • Loading branch information
xTCry committed Feb 27, 2024
1 parent 5f6d1d8 commit 2db96e0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 41 deletions.
2 changes: 1 addition & 1 deletion docs/getting-updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TelegrafModule.forRootAsync({
launchOptions: {
webhook: {
domain: 'domain.tld',
hookPath: '/secret-path',
path: '/secret-path',
}
}
}),
Expand Down
20 changes: 13 additions & 7 deletions lib/utils/create-listener-decorator.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import { ListenerMetadata } from '../interfaces';

export function createListenerDecorator<
TComposer extends Composer<never>,
TMethod extends OnlyFunctionPropertyNames<TComposer> = OnlyFunctionPropertyNames<TComposer>,
TMethod extends
OnlyFunctionPropertyNames<TComposer> = OnlyFunctionPropertyNames<TComposer>,
>(method: TMethod) {
return (...args: ComposerMethodArgs<TComposer, TMethod>): MethodDecorator => {
return (
_target: any,
target: object,
_key?: string | symbol,
descriptor?: TypedPropertyDescriptor<any>,
) => {
Expand All @@ -20,11 +21,16 @@ export function createListenerDecorator<
} as ListenerMetadata,
];

const previousValue =
Reflect.getMetadata(LISTENERS_METADATA, descriptor.value) || [];
const value = [...previousValue, ...metadata];
Reflect.defineMetadata(LISTENERS_METADATA, value, descriptor.value);
return descriptor;
if (descriptor) {
const previousValue =
Reflect.getMetadata(LISTENERS_METADATA, descriptor.value) || [];
const value = [...previousValue, ...metadata];
Reflect.defineMetadata(LISTENERS_METADATA, value, descriptor.value);
return descriptor;
}

Reflect.defineMetadata(LISTENERS_METADATA, metadata, target);
return target;
};
};
}
63 changes: 31 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"lint-staged": "13.2.3",
"prettier": "3.0.0",
"reflect-metadata": "0.1.13",
"telegraf": "4.12.2",
"telegraf": "^4.16.0",
"typedoc": "0.24.8",
"typescript": "4.8.2",
"vitepress": "^1.0.0-beta.6"
Expand Down

0 comments on commit 2db96e0

Please sign in to comment.