@function proxyFunction

@param {object} call
@param {string} property

@returns {Promise}

@throws {Error}
337313
function proxyFunction (call, args) {
    // get clone of call and reset original
    call = resetCall(call)
    // require immutable core
    assert.ok(GLOBAL.immutableCore !== undefined, 'ImmutableAI configuration error: immutableCore required')
    // require call properties
    assert.ok(call.namespace !== undefined, 'ImmutableAI method call without namespace')
    assert.ok(call.module !== undefined, 'ImmutableAI method call without module name')
    assert.ok(call.method !== undefined, 'ImmutableAI method call without method name')
    // create method signature
    var signature = call.module+GLOBAL.localNamespaces[call.namespace]+'.'+call.method
    // get method - throws error if not found
    var method = GLOBAL.immutableCore.method(signature)
    // create empty object for args if not defined
    if (args === undefined) {
        args = {}
    }
    // set session for args
    args.session = call.session
    // call method with args and session
    return method(args)
}
677084
function prepareFunc(func, builder, basepath) { //Prepare an implied function for repeated use
  funcStringCache[func] = funcStringCache[func] || ('(function() { with (proxy(scope)) { return ('+func.toString()+')('+defaultScopeName+'); } })()');

  return function(scope) {
    var scope = scope || {};
    var builder = builder || stringBuilder;
    var proxy = jshtmlProxy(new builder(basepath));
    var ret = eval(funcStringCache[func]);
    if (ret && typeof(ret.then) === 'function') { //looks like a promise. Let's use it why don't we?
      ret.proxy = proxy;
      return ret;
    }
    return proxy.collect();
  }
}
1050473
function apply(api, _global) {
    var WS = _global.WebSocket;
    // On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener
    // On older Chrome, no need since EventTarget was already patched
    if (!_global.EventTarget) {
        patchEventTarget(_global, [WS.prototype]);
    }
    _global.WebSocket = function (x, y) {
        var socket = arguments.length > 1 ? new WS(x, y) : new WS(x);
        var proxySocket;
        var proxySocketProto;
        // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance
        var onmessageDesc = ObjectGetOwnPropertyDescriptor(socket, 'onmessage');
        if (onmessageDesc && onmessageDesc.configurable === false) {
            proxySocket = ObjectCreate(socket);
            // socket have own property descriptor 'onopen', 'onmessage', 'onclose', 'onerror'
            // but proxySocket not, so we will keep socket as prototype and pass it to
            // patchOnProperties method
            proxySocketProto = socket;
            [ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR, 'send', 'close'].forEach(function (propName) {
                proxySocket[propName] = function () {
                    var args = ArraySlice.call(arguments);
                    if (propName === ADD_EVENT_LISTENER_STR || propName === REMOVE_EVENT_LISTENER_STR) {
                        var eventName = args.length > 0 ? args[0] : undefined;
                        if (eventName) {
                            var propertySymbol = Zone.__symbol__('ON_PROPERTY' + eventName);
                            socket[propertySymbol] = proxySocket[propertySymbol];
                        }
                    }
                    return socket[propName].apply(socket, args);
                };
            });
        }
        else {
            // we can patch the real socket
            proxySocket = socket;
        }
        patchOnProperties(proxySocket, ['close', 'error', 'message', 'open'], proxySocketProto);
        return proxySocket;
    };
    var globalWebSocket = _global['WebSocket'];
    for (var prop in WS) {
        globalWebSocket[prop] = WS[prop];
    }
}
838648
function proxyMethod(method, source, destination) {
    var oldMethod = source[method];
    source[method] = function() {
        var args = Array.prototype.slice.call(arguments);
        destination[method].apply(destination, args);
        return oldMethod.apply(source, args);
    };
}
97227
function (object, property) {
        return utils.getProp(object, Array.prototype.slice.call(arguments, 1).join("."));
    }
1026193
def call(__self, __context, __obj, *args, **kwargs):
        """"""
        # the double prefixes are to avoid double keyword argument
        # errors when proxying the call.
        if not __self.is_safe_callable(__obj):
            raise SecurityError('%r is not safely callable' % (__obj,))
        return __context.call(__obj, *args, **kwargs)
1321962
function createWorkerProxy(workersOrFunctions, opt_options) {
    var options = {
      // Automatically call the callback after a call if the return value is not
      // undefined.
      autoCallback: false,
      // Catch errors and automatically respond with an error callback. Off by
      // default since it breaks standard behavior.
      catchErrors: false,
      // A list of functions that can be called. This list will be used to make
      // the proxy functions available when Proxy is not supported. Note that
      // this is generally not needed since the worker will also publish its
      // known functions.
      functionNames: [],
      // Call console.time and console.timeEnd for calls sent though the proxy.
      timeCalls: false
    };

    if (opt_options) {
      for (var key in opt_options) {
        if (!(key in options)) continue;
        options[key] = opt_options[key];
      }
    }
    Object.freeze(options);

    // Ensure that we have an array of workers (even if only using one worker).
    if (typeof Worker != 'undefined' && (workersOrFunctions instanceof Worker)) {
      workersOrFunctions = [workersOrFunctions];
    }

    if (Array.isArray(workersOrFunctions)) {
      return sendCallsToWorker(workersOrFunctions, options);
    } else {
      receiveCallsFromOwner(workersOrFunctions, options);
    }
  }
964855
function proxyReq (proxyObj, callback) {
  let proxyError = proxyObjErrors(proxyObj);
  if (proxyError) { return callback(new Error(proxyError)); }

  if (proxyObj.options.log) { logReqOpts(proxyObj.reqOpts); }

  // TESTING HELPER ONLY
  if (proxyObj.options.shortCircuit) { return callback(null, proxyObj); }

  // unless explicitly set, ignore encoding
  // THIS IS A HACK THAT MAY CAUSE ISSUES. I DON'T
  // KNOW OF AN IMMEDIATE WORKAROUND TO FIX IT.
  if (!proxyObj.options['accept-encoding']) {
    delete proxyObj.reqOpts.headers['accept-encoding'];
  }

  // Check for Form Post Parameters
  if (proxyObj.req.body && (proxyObj.reqOpts.method === 'POST' || proxyObj.reqOpts.method === 'PUT')) {
    proxyObj.reqOpts.form = proxyObj.req.body;
  }

  // make request
  request(proxyObj.reqOpts, function (error, response, body) {
    if (proxyObj.options.log) { logResponse(response, body); }

    // transfer result to resulting o
    proxyObj.res.set(helpers.defaultHeaders(proxyObj.options.response.headers, response ? response.headers : {}));

    proxyObj.result = {
      response : response,
      body     : body
    };

    return callback(error, proxyObj);
  });
}
1297000
def proxy(opts, functions=None, returners=None, whitelist=None, utils=None):
    '''
    
    '''
    ret = LazyLoader(
        _module_dirs(opts, 'proxy'),
        opts,
        tag='proxy',
        pack={'__salt__': functions, '__ret__': returners, '__utils__': utils},
    )

    ret.pack['__proxy__'] = ret

    return ret
554037
function proxy(options) {
  var proxy = null
    , isSSL = false
    ;

  if (options.protocol === 'https:') {
    isSSL = true;
  }

  // Test the proxy parameter first for priority
  if (proxyOptions) {
    proxy = proxyOptions;
  } else {
    // Test proxy by env
    if (proxyHttpEnv) {
      proxy = proxyHttpEnv;
    } else if (proxyHttpsEnv) {
      proxy = proxyHttpsEnv;
    }
  }

  if (!proxy) {
    return;
  }

  if (isSSL) {
    options.agent = new HttpsProxyAgent(proxy);
  } else {
    options.agent = new HttpProxyAgent(proxy);
  }
}
171536
function getProxy (select, property) {

    debug('property', property)

    // if property is then return a function that executes query calls
    // callbacks with result
    if (property === 'then') {
        // close where context
        closeWhereContext(select)
        // close order context
        closeOrderContext(select)
        // return function that will execute and return query
        return function (resolve, reject) {
            // debug query
            debug('then', select.query)
            // execute query
            return select.model.query(select.query).then(resolve).catch(err => {
                // call reject callback if set
                if (typeof reject === 'function') {
                    reject(err)
                }
                // otherwise return rejection
                else {
                    return Promise.reject(err)
                }
            })
        }
    }

    // if property is query then return function that executes query
    if (property === 'query') {
        // close where context
        closeWhereContext(select)
        // close order context
        closeOrderContext(select)
        // return function that will execute and return query
        return function (args) {
            // if args is set then merge args into query
            if (args) {
                _.merge(select.query, args)
            }
            // debug query
            debug('query', select.query)
            // execute query
            return select.model.query(select.query)
        }
    }

    // if property is views return function that gets names of views
    // then executes query
    if (property === 'view') {
        // close where context
        closeWhereContext(select)
        // close order context
        closeOrderContext(select)
        // return function that will execute and return query
        return function () {
            // names of views to apply
            var views
            // if first arg is array then use for views
            if (Array.isArray(arguments[0])) {
                views = arguments[0]
            }
            // otherwise copy arguments
            else {
                // create new array
                views = []
                // get number of arguments
                var length = arguments.length
                // copy view arguments
                for (var i=0; i < arguments.length; i++) {
                    views[i] = arguments[i]
                }
            }
            // add views to query
            select.query.view = views
            // debug query
            debug('query', select.query)
            // execute query
            return select.model.query(select.query)
        }
    }

    // add property to history
    select.history.push(property)

    /*
     * there are two primary selection contexts: where and by
     *
     * select by is more limited and only allows specifying a single column
     * to do a select where equals query on
     *
     * where context allows specifying multiple columns to match separated
     * by and with the full range of matching operators available.
     *
     * query modifiers can only be specified before any cotext is set - e.g.
     * one, all, current, allRevisions must be specified before by or where.
     *
     */

    // handle context specific logic
    if (!select.context) {
        // switch to by context
        if (property === 'by') {
            // set context
            select.context = 'by'
            // column name must follow by
            select.expectColumn = true
        }
        // switch to where context
        else if (property === 'where') {
            // set context
            select.context = 'where'
            // column name must follow where
            select.expectColumn = true
        }
        // switch to order context
        else if (property === 'order') {
            // set context
            select.context = 'order'
        }
        // set all flag on query
        else if (property === 'all') {
            select.query.all = true
        }
        // set allRevisions flag on query
        else if (property === 'allRevisions') {
            select.query.allRevisions = true
        }
        // set current flag on query
        else if (property === 'current') {
            select.query.current = true
        }
        // set limit: 1 on query
        else if (property === 'one') {
            select.query.limit = 1
        }
        // set required flag on query
        else if (property === 'required') {
            select.query.required = true
        }
        // set isCurrent flag on query
        else if (property === 'isCurrent') {
            select.query.isCurrent = true
        }
        // set resolve flag on query
        else if (property === 'resolve') {
            select.query.resolve = true
        }
        // set allow flag on query
        else if (property === 'allow') {
            select.query.allow = true
        }
        // set plain flag
        else if (property === 'plain') {
            select.query.plain = true
        }
        // invalid property
        else {
            throwInvalidProperty(property, select)
        }
    }
    else if (select.context === 'by') {
        // column is only allowed property after by
        var column = getColumn(property, select)
        // return function that will take select value and do query
        return function (val) {
            // if value is an array then always select all
            if (Array.isArray(val) && !select.query.one) {
                select.query.all = true
            }
            // otherwise if there is a single value and all is not specified
            // then limit query to a single (not-array) result
            else if (!select.query.all) {
                select.query.limit = 1
            }
            // set where clause for query
            select.query.where = {}
            select.query.where[column] = val
            // debug query
            debug('query', select.query)
            // execute query
            return select.model.query(select.query)
        }
    }
    else if (select.context === 'where') {
        // column must be first property in where clause
        if (select.expectColumn) {
            // property is an action isProperty
            if (property === 'isDeleted') {
                // isProperty takes place of column
                select.expectColumn = false
                // return function that captures value
                return function (value) {
                    // set isProperty as column for where query
                    select.contextData.column = property
                    select.contextData.operator = value
                    // add where clause to query
                    closeWhereContext(select)
                    // return proxy
                    return select.proxy
                }
            }
            else {
                // set column in context data
                select.contextData.column = getColumn(property, select)
            }
        }
        // otherwise look for operator
        else {
            // is is a noop
            if (property === 'is') {

            }
            // apply negation to where clause
            else if (property === 'not') {
                select.contextData.not = true
            }
            // property is valid match operator
            else if (matchOperators[property]) {
                select.contextData.operator = property
                // return function that captures value and then closes where
                return function (val) {
                    // capture value
                    select.contextData.value = val
                    // add where clause to query
                    closeWhereContext(select)
                    // return proxy
                    return select.proxy
                }
            }
            // property is null
            else if (property === 'null') {
                // set IS NULL operator
                select.contextData.operator = null
                // add where clause to query
                closeWhereContext(select)
            }
            // if doing and close current clause and start another
            else if (property === 'and') {
                // add where clause to query
                closeWhereContext(select)
                // next property should be column for new where clause
                select.expectColumn = true
            }
            // switch to order context
            else if (property === 'order') {
                // add where clause to query
                closeWhereContext(select)
                // set context
                select.context = 'order'
            }
            // switch to limit context - capture limit
            else if (property === 'limit') {
                // add where clause to query
                closeWhereContext(select)
                // set context
                select.context = 'limit'
                // return function that sets limit
                return function (val) {
                    // do not allow limit 1 after select.all
                    if (val === 1 && select.query.all) {
                        throwError('limit(1) not allowed with select.all', select)
                    }
                    // set limit
                    select.query.limit = val
                    // return proxy
                    return select.proxy
                }
            }
            else {
                throwInvalidProperty(property, select)
            }
        }
    }
    else if (select.context === 'order') {
        // by is a noop
        if (property === 'by') {
        }
        // switch to limit context - capture limit
        else if (property === 'limit') {
            // add context to query
            closeOrderContext(select)
            // set context
            select.context = 'limit'
            // return function that sets limit
            return function (val) {
                // do not allow limit 1 after select.all
                if (val === 1 && select.query.all) {
                    throwError('limit(1) not allowed with select.all', select)
                }
                // set limit
                select.query.limit = val
                // return proxy
                return select.proxy
            }
        }
        // direction asc|desc
        else if (property === 'asc' || property === 'desc') {
            // add direction to order context
            select.contextData.direction = property
            // add context to query
            closeOrderContext(select)
        }
        // if not keyword then expect column name
        else {
            // get column name
            var columnName = select.model.columnName(property)
            // throw error on invalid column name
            if (!columnName) {
                throwInvalidColumnName(columnName, select)
            }
            // if list of columns does not exist in context data create
            if (!select.contextData.columns) {
                select.contextData.columns = []
            }
            // add column to list of columns for order
            select.contextData.columns.push(columnName)
        }
    }
    else if (select.context === 'limit') {
        // capture offset
        if (property === 'offset') {
            // return function that sets offset
            return function (val) {
                // set offset
                select.query.offset = val
                // return proxy
                return select.proxy
            }
        }
        else {
            throwInvalidProperty(property, select)
        }
    }
    else {
        throwInvalidProperty(property, select)
    }

    // return proxy again for most cases
    return select.proxy
}
839984
function newHttpRequest (call) {
    // get clone of call and reset original
    call = resetCall(call)
    // require immutable core
    assert.ok(GLOBAL.immutableHttpClient !== undefined, 'ImmutableAI configuration error: immutableHttpClient required')
    // get method name
    var method = call.module
    // require valid function
    assert.ok(defined(httpMethods[method]) || method === 'request', `InnutableAI error: invalid method ${call.module} for ImmutableHttpClient`)
    // return function wrapper
    return (arg1, arg2, arg3) => {
        // if method is an http verb method then there are 3 args
        if (defined(httpMethods[method])) {
            // call http client method using local session if not passed
            return GLOBAL.immutableHttpClient[call.module](arg1, arg2, defined(arg3) ? arg3 : call.session)
        }
        // otherwise method is request with 2 args
        else {
            // call http client method using local session if not passed
            return GLOBAL.immutableHttpClient[call.module](arg1, defined(arg2) ? arg2 : call.session)
        }
    }
}
1006974
function createProxy(parentState, base, key) {
      if (isProxy(base)) throw new Error("Immer bug. Plz report.");
      var state = createState(parentState, base, key);
      var proxy = Array.isArray(base) ? Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);
      proxies.push(proxy);
      return proxy.proxy;
  }
189578
function (propertyName) {
      var value = this.client[propertyName];
      if (! _.isUndefined(this[propertyName])) {
        // pass, defer to resource manager prototype properties
      }
      else if (_.isFunction(value)) {
        // copy functions (including the error ctors) by direct reference
        this[propertyName] = value;
      }
      else if (_.contains(this.client.serviceCallParams, propertyName)) {
        // default service call params which are not function values are proxied
        // via getter functions
        this[propertyName] = function () { return this.client[propertyName]; };
      }
      // all other properties are assumed to be client configuration, and
      // should be accessed by referencing the ``client`` instance property.
    }
234113
function createProxyHandler (proxies, urlRoot) {
  if (!proxies.length) {
    const nullProxy = (request, response, next) => next()
    nullProxy.upgrade = () => {}
    return nullProxy
  }

  function createProxy (request, response, next) {
    const proxyRecord = proxies.find((p) => request.url.startsWith(p.path))
    if (proxyRecord) {
      log.debug(`proxying request - ${request.url} to ${proxyRecord.host}:${proxyRecord.port}`)
      request.url = request.url.replace(proxyRecord.path, proxyRecord.baseUrl)
      proxyRecord.proxy.web(request, response)
    } else {
      return next()
    }
  }

  createProxy.upgrade = function (request, socket, head) {
    // special-case karma's route to avoid upgrading it
    if (request.url.startsWith(urlRoot)) {
      log.debug(`NOT upgrading proxyWebSocketRequest ${request.url}`)
      return
    }

    const proxyRecord = proxies.find((p) => request.url.startsWith(p.path))
    if (proxyRecord) {
      log.debug(`upgrade proxyWebSocketRequest ${request.url} to ${proxyRecord.host}:${proxyRecord.port}`)
      request.url = request.url.replace(proxyRecord.path, proxyRecord.baseUrl)
      proxyRecord.proxy.ws(request, socket, head)
    }
  }

  return createProxy
}
583563
function() {

        /* Prepare our message */
        var message = { proxy: { proxy: clone, arguments: arguments }};

        /* Is this "new F()" or a normal call? */
        if (this instanceof Invocable) {
          message.newInstance = true;
          ProxyPromise.call(this, message, send);
          this.asProxy(true);
        } else {
          return new ProxyPromise(message, send);
        }
      }
1069692
function mixinProxying(agent, proxyOpts) {
  agent.proxy = proxyOpts;

  var orig = _.pick(agent, 'createConnection', 'addRequest');

  // Make the tcp or tls connection go to the proxy, ignoring the
  // destination host:port arguments.
  agent.createConnection = function(port, host, options) {
    return orig.createConnection.call(this,
                                      this.proxy.port, this.proxy.host, options);
  };

  // tell the proxy where we really want to go by fully-qualifying the path
  // part. Force a localAddress if one was configured
  agent.addRequest = function(req, host, port, localAddress) {
    req.path = this.proxy.innerProtocol + '//' + host + ':' + port + req.path;
    if (this.proxy.localAddress) {
      localAddress = this.proxy.localAddress;
    }
    return orig.addRequest.call(this, req, host, port, localAddress);
  };
}