import { AdvancedOptions } from 'type-graphql/dist/decorators/types' ; import { BaseEntity } from 'typeorm' ; type EntityReturner = ( ) => typeof BaseEntity ; export const mapping = new Map < EntityReturner , { [ key ] : { getValEntity : EntityReturner ; otherSideKey : string ; options : AdvancedOptions ; } ; } > ( ) ; export const RelationalPagination = ( getKeyEntity , getValEntity , otherSideKey , options = { } ) : PropertyDecorator => ( _ , pk ) => { const propKey = String ( pk ) ; if ( ! mapping . has ( getKeyEntity ) ) mapping . set ( getKeyEntity , { } ) ; const allRelations = mapping . get ( getKeyEntity ) ; allRelations [ propKey ] = { getValEntity , otherSideKey , options } ; } ;