export type CollectMiddlewaresResult = { web : any [ ] ; api : any [ ] ; } ; export const createMiddlewareCollecter = ( ) => { const webMiddlewares = [ ] ; const apiMiddlewares = [ ] ; const addWebMiddleware = ( input ) => { webMiddlewares . push ( input ) ; } ; const addAPIMiddleware = ( input ) => { apiMiddlewares . push ( input ) ; } ; const getMiddlewares = ( ) : CollectMiddlewaresResult => ( { web : webMiddlewares , api : apiMiddlewares , } ) ; return { getMiddlewares , addWebMiddleware , addAPIMiddleware , } ; } ; export type AttacherOptions = { addMiddleware : ( ... input : any [ ] ) => void ; } ; export type Attacher = ( options : AttacherOptions ) => void ; export const hook = ( attacher ) => attacher ;