packages/grpc-native-core/src/client.js
function Client(address, credentials, options) {
  var self = this;
  if (!options) {
    options = {};
  }

  // Resolve interceptor options and assign interceptors to each method
  if (Array.isArray(options.interceptor_providers) && Array.isArray(options.interceptors)) {
    throw new client_interceptors.InterceptorConfigurationError(
      'Both interceptors and interceptor_providers were passed as options ' +
      'to the client constructor. Only one of these is allowed.');
  }
  self.$interceptors = options.interceptors || [];
  self.$interceptor_providers = options.interceptor_providers || [];
  if (self.$method_definitions) {
    Object.keys(self.$method_definitions).forEach(method_name => {
      const method_definition = self.$method_definitions[method_name];
      self[method_name].interceptors = client_interceptors
        .resolveInterceptorProviders(self.$interceptor_providers, method_definition)
        .concat(self.$interceptors);
    });
  }

  this.$callInvocationTransformer = options.callInvocationTransformer;

  let channelOverride = options.channelOverride;
  let channelFactoryOverride = options.channelFactoryOverride;
  // Exclude channel options which have already been consumed
  const ignoredKeys = [
    'interceptors', 'interceptor_providers', 'channelOverride',
    'channelFactoryOverride', 'callInvocationTransformer'
  ];
  var channel_options = Object.getOwnPropertyNames(options)
    .reduce((acc, key) => {
      if (ignoredKeys.indexOf(key) === -1) {
        acc[key] = options[key];
      }
      return acc;
    }, {});
  /* Private fields use $ as a prefix instead of _ because it is an invalid
   * prefix of a method name */
  if (channelOverride) {
    this.$channel = options.channelOverride;
  } else {
    if (channelFactoryOverride) {
      this.$channel = channelFactoryOverride(address, credentials, channel_options);
    } else {
      this.$channel = new grpc.Channel(address, credentials, channel_options);
    }
  }
}
function Client(address, credentials, options) {
  var self = this;
  if (!options) {
    options = {};
  }

  // Resolve interceptor options and assign interceptors to each method
  if (Array.isArray(options.interceptor_providers) && Array.isArray(options.interceptors)) {
    throw new client_interceptors.InterceptorConfigurationError(
      'Both interceptors and interceptor_providers were passed as options ' +
      'to the client constructor. Only one of these is allowed.');
  }
  self.$interceptors = options.interceptors || [];
  self.$interceptor_providers = options.interceptor_providers || [];
  if (self.$method_definitions) {
    Object.keys(self.$method_definitions).forEach(method_name => {
      const method_definition = self.$method_definitions[method_name];
      self[method_name].interceptors = client_interceptors
        .resolveInterceptorProviders(self.$interceptor_providers, method_definition)
        .concat(self.$interceptors);
    });
  }

  this.$callInvocationTransformer = options.callInvocationTransformer;

  let channelOverride = options.channelOverride;
  let channelFactoryOverride = options.channelFactoryOverride;
  // Exclude channel options which have already been consumed
  const ignoredKeys = [
    'interceptors', 'interceptor_providers', 'channelOverride',
    'channelFactoryOverride', 'callInvocationTransformer'
  ];
  var channel_options = Object.getOwnPropertyNames(options)
    .reduce((acc, key) => {
      if (ignoredKeys.indexOf(key) === -1) {
        acc[key] = options[key];
      }
      return acc;
    }, {});
  /* Private fields use $ as a prefix instead of _ because it is an invalid
   * prefix of a method name */
  if (channelOverride) {
    this.$channel = options.channelOverride;
  } else {
    if (channelFactoryOverride) {
      this.$channel = channelFactoryOverride(address, credentials, channel_options);
    } else {
      this.$channel = new grpc.Channel(address, credentials, channel_options);
    }
  }
}
function Client ( address , credentials , options ) { var self = this ; if ( ! options ) { options = { } ; } // Resolve interceptor options and assign interceptors to each method if ( Array . isArray ( options . interceptor_providers ) && Array . isArray ( options . interceptors ) ) { throw new client_interceptors . InterceptorConfigurationError ( 'Both interceptors and interceptor_providers were passed as options ' + 'to the client constructor. Only one of these is allowed.' ) ; } self . $interceptors = options . interceptors || [ ] ; self . $interceptor_providers = options . interceptor_providers || [ ] ; if ( self . $method_definitions ) { Object . keys ( self . $method_definitions ) . forEach ( method_name => { const method_definition = self . $method_definitions [ method_name ] ; self [ method_name ] . interceptors = client_interceptors . resolveInterceptorProviders ( self . $interceptor_providers , method_definition ) . concat ( self . $interceptors ) ; } ) ; } this . $callInvocationTransformer = options . callInvocationTransformer ; let channelOverride = options . channelOverride ; let channelFactoryOverride = options . channelFactoryOverride ; // Exclude channel options which have already been consumed const ignoredKeys = [ 'interceptors' , 'interceptor_providers' , 'channelOverride' , 'channelFactoryOverride' , 'callInvocationTransformer' ] ; var channel_options = Object . getOwnPropertyNames ( options ) . reduce ( ( acc , key ) => { if ( ignoredKeys . indexOf ( key ) === - 1 ) { acc [ key ] = options [ key ] ; } return acc ; } , { } ) ; /* Private fields use $ as a prefix instead of _ because it is an invalid
   * prefix of a method name */ if ( channelOverride ) { this . $channel = options . channelOverride ; } else { if ( channelFactoryOverride ) { this . $channel = channelFactoryOverride ( address , credentials , channel_options ) ; } else { this . $channel = new grpc . Channel ( address , credentials , channel_options ) ; } } }
Options that can be set on a call.
@typedef {Object} grpc.Client~CallOptions
@property {grpc~Deadline} deadline The deadline for the entire call to
complete.
@property {string} host Server hostname to set on the call. Only meaningful
if different from the server address used to construct the client.
@property {grpc.Client~Call} parent Parent call. Used in servers when
making a call as part of the process of handling a call. Used to
propagate some information automatically, as specified by
propagate_flags.
@property {number} propagate_flags Indicates which properties of a parent
call should propagate to this call. Bitwise combination of flags in
{@link grpc.propagate}.
@property {grpc.credentials~CallCredentials} credentials The credentials that
should be used to make this particular call.
 
A generic gRPC client. Primarily useful as a base class for generated clients
@memberof grpc
@constructor
@param {string} address Server address to connect to
@param {grpc.credentials~ChannelCredentials} credentials Credentials to use
to connect to the server
@param {Object} options Options to apply to channel creation
Options that can be set on a call .