import { GraphQLResolveInfo } from 'graphql' ; /**
 * Class-based resolver context
 */ export class ResolverContext < TSource = undefined , TContext = any > { public $env : IArguments ; public get $source ( ) : TSource { return this . $env [ 0 ] ; } public get $context ( ) : TContext { return this . $env [ 1 ] ; } public get $info ( ) : GraphQLResolveInfo { return this . $env [ 2 ] ; } constructor ( _base , _context ? , _info ? ) { this . $env = arguments ; } } param fieldName export function source ( fieldName ? ) { return function ( prototype , propertyKey ) { const get = function ( this ) { return this . $source [ fieldName || propertyKey ] ; } ; const set = function ( this , value ) { this . $source [ fieldName || propertyKey ] = value ; } ; Object . defineProperty ( prototype , propertyKey , { get , set } ) ; } ; } param fieldName export function lazy ( fieldName ? ) { return function ( prototype , propertyKey ) { const get = function ( this ) { if ( ! this . $__fetcher__ ) { this . $__fetcher__ = this . $fetch ( ) ; } return this . $__fetcher__ . then ( ( remoteSource ) => remoteSource [ fieldName || propertyKey ] ) ; } ; Object . defineProperty ( prototype , propertyKey , { get } ) ; } ; }