import { ApiReturn , BaseServiceType } from 'tsrpc-proto' ; import { ApiCall , ApiCallOptions } from '../base/ApiCall' ; import { InnerConnection } from './InnerConnection' ; export interface ApiCallInnerOptions < Req , ServiceType extends BaseServiceType > extends ApiCallOptions < Req , ServiceType > { conn : InnerConnection < ServiceType > ; } export class ApiCallInner < Req = any , Res = any , ServiceType extends BaseServiceType = any > extends ApiCall < Req , Res , ServiceType > { readonly conn ! : InnerConnection < ServiceType > ; constructor ( options ) { super ( options ) ; } protected async _sendReturn ( ret ) { if ( this . conn . return . type === 'raw' ) { if ( ret . isSucc ) { let resValidate = this . server . tsbuffer . validate ( ret . res , this . service . resSchemaId ) ; if ( ! resValidate . isSucc ) { return resValidate ; } } return this . conn . sendData ( ret ) ; } return super . _sendReturn ( ret ) ; } }