mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-25 23:44:39 +03:00
19 lines
455 B
TypeScript
19 lines
455 B
TypeScript
|
import { Type } from '@nestjs/common'
|
||
|
import { ContextTransformer } from '../ContextTransformer'
|
||
|
import { addHandlerToStore } from './TelegramActionHandler'
|
||
|
|
||
|
export const PipeContext = <T>(transform: Type<ContextTransformer<T>>) => (
|
||
|
target: Object,
|
||
|
propertyKey: string,
|
||
|
parameterIndex: number,
|
||
|
) => {
|
||
|
addHandlerToStore(target, propertyKey, {
|
||
|
transformations: [
|
||
|
{
|
||
|
index: parameterIndex,
|
||
|
transform,
|
||
|
},
|
||
|
],
|
||
|
})
|
||
|
}
|