export type SpotifyQueryDecorated = any ; export function SpotifyDecorators ( client ) { return { SpotifyQuery ( query ) { return function ( target , propertyKey , descriptor ) { var originalMethod = descriptor . value ; descriptor . value = function ( variables ? ) : Promise < any > { return new Promise ( ( resolve , reject ) => { client . query ( query , null , null , variables ) . then ( ( executionResult ) => { if ( ! executionResult . errors ) { resolve ( originalMethod . call ( originalMethod , executionResult . data ) ) ; } else { reject ( executionResult . errors ) ; } } , reject ) . catch ( reject ) ; } ) ; } ; return descriptor ; } ; } } ; }