import { Provider } from '@nestjs/common' ; import { ThrottlerModuleOptions } from './throttler-module-options.interface' ; import { ThrottlerStorage } from './throttler-storage.interface' ; import { THROTTLER_OPTIONS } from './throttler.constants' ; import { ThrottlerStorageService } from './throttler.service' ; export function createThrottlerProviders ( options ) { return [ { provide : THROTTLER_OPTIONS , useValue : options , } , ] ; } export const ThrottlerStorageProvider = { provide : ThrottlerStorage , useFactory : ( options ) => { return options . storage ? options . storage : new ThrottlerStorageService ( ) ; } , inject : [ THROTTLER_OPTIONS ] , } ; publicApi export const getOptionsToken = ( ) => THROTTLER_OPTIONS ; publicApi export const getStorageToken = ( ) => ThrottlerStorage ;