import type { Provider , Container } from '@tinkoff/dippy' ; import { DI_TOKEN } from '@tinkoff/dippy' ; import type { Command } from '../typings/commands' ; import { COMMAND_EXECUTION_TOKEN } from '../di/tokens' ; export const createCommand = ( command ) : Command => { return { name : command . name , providers : [ { provide : COMMAND_EXECUTION_TOKEN , useFactory : ( { di } ) => { return command . command ( di ) ; } , deps : { di : DI_TOKEN , } , } , ... ( command . providers ?? [ ] ) , ] , } ; } ;