Process refs

@param {Vue} instance
@return {Array}
186600
function processRefs (instance) {
  return Object.keys(instance.$refs)
    .filter(key => instance.$refs[key])
    .map(key => getCustomRefDetails(instance, key, instance.$refs[key]))
}
696924
function getPageClonePutOperations(pageData, locals) {
  return bluebird.all(_.reduce(pageData, (promises, pageValue, pageKey) => {
    if (typeof pageValue === 'string' && getComponentName(pageValue)) {
      // for all strings that are component references
      promises.push(components.get(pageValue, locals)
        // only follow the paths of instance references.  Don't clone default components
        .then(refData => composer.resolveComponentReferences(refData, locals, isInstanceReferenceObject))
        .then(resolvedData => {
          // for each instance reference within resolved data
          _.each(references.listDeepObjects(resolvedData, isInstanceReferenceObject), obj => {
            obj._ref = renameReferenceUniquely(obj._ref);
          });

          // rename reference in pageData
          const ref = renameReferenceUniquely(pageValue);

          pageData[pageKey] = ref;

          // put new data using cascading PUT at place that page now points
          return dbOps.getPutOperations(components.cmptPut, ref, resolvedData, locals);
        }));
    } else {
      // for all object-like things (i.e., objects and arrays)
      promises = promises.concat(getPageClonePutOperations(pageValue, locals));
    }
    return promises;
  }, [])).then(_.flatten); // only one level of flattening needed
}
1008197
function instanceRender (schema, opts) {
  if (_.isString(schema)) {
    schema = JSON.parse(schema)
  }

  if (!_.isPlainObject(schema)) {
    throw new Error('Must be plain object')
  }

  // find entry points
  var rootPath = walkBFS.call(this, schema, (v, k, p) => {
    if (k === '__schema') {
      return p
    }
  })

  if (!rootPath) {
    throw new Error('Cannot find "__schema" object')
  }

  var root = _.get(schema, rootPath)
  var graphRoot = getGraphRoot.call(this, root)
  var q = graphRoot.q
  var types = graphRoot.types

  // walk the graph & build up nodes & edges
  var current
  var entities = {}

  while (q.length) {
    current = q.shift()

    // if item has already been processed
    if (entities[current]) {
      continue
    }

    // process item
    q = q.concat(processType.call(this, current, entities, types))
  }

  // process all the enum fields
  var enums = this.theme.enums.hide
    ? []
    : _.chain(types)
        .filter(type => {
          return type.kind === 'ENUM' && !_.startsWith(type.name, '__')
        })
        .map(processEnumType.bind(this))
        .value()

  // process all the input fields
  var inputs = this.theme.inputs.hide
    ? []
    : _.chain(types)
        .filter(type => {
          return type.kind === 'INPUT_OBJECT' && !_.startsWith(type.name, '__')
        })
        .map(processInputType.bind(this))
        .value()

  var interfaces = _.filter(entities, {
    isInterfaceType: true
  })

  var unions = _.filter(entities, {
    isUnionType: true
  })

  var objects = _.filter(entities, {
    isInterfaceType: false,
    isUnionType: false
  })

  // build the dot
  var dotfile =
    'digraph erd {\n' +
    'graph [\n' +
    '  rankdir = "LR"\n' +
    '];\n' +
    'node [\n' +
    '  fontsize = "16"\n' +
    '  shape = "plaintext"\n' +
    '];\n' +
    'edge [\n' +
    '];\n'

  dotfile += graph.call(this, objects, this.theme.types)
  dotfile += graph.call(this, enums, this.theme.enums)
  dotfile += graph.call(this, interfaces, this.theme.interfaces)
  dotfile += graph.call(this, inputs, this.theme.inputs)
  dotfile += graph.call(this, unions, this.theme.unions)

  dotfile += '\n\n'

  // key by to prevent need to search by name
  var processedTypes = _.keyBy(
    _.union(objects, enums, interfaces, inputs, unions),
    'name'
  )

  dotfile += _.reduce(
    processedTypes,
    (result, processedType) => {
      if (!processedType.isEnumType) {
        _.each(processedType.fields, field => {
          var fieldType = processedTypes[field.type]
          if (
            fieldType &&
            isEnabled.call(this, fieldType) &&
            (this.theme.edgesToSelf || processedType.name !== fieldType.name)
          ) {
            result.push(
              createEdge.call(this, {
                from: {
                  typeName: getTypeDisplayName(processedType.name),
                  fieldName: field.name
                },
                to: {
                  typeName: getTypeDisplayName(fieldType.name)
                },
                color: getColor.call(this, field)
              })
            )
          }
          if (!this.theme.field.noargs && field.args && field.args.length) {
            _.each(field.args, arg => {
              var argType = processedTypes[arg.type]
              if (
                argType &&
                isEnabled.call(this, argType) &&
                (this.theme.edgesToSelf || argType.name !== processedType.name)
              ) {
                result.push(
                  createEdge.call(this, {
                    from: {
                      typeName: getTypeDisplayName(argType.name)
                    },
                    to: {
                      typeName: getTypeDisplayName(processedType.name),
                      fieldName: this.theme.anchor.input ? field.name : null
                    },
                    label: this.theme.edgeLabels.input,
                    color: this.theme.inputs.hide
                      ? getColor.call(this, argType)
                      : this.theme.inputs.color,
                    weight: 1000
                  })
                )
              }
            })
          }
        })
        _.each(processedType.possibleTypes, possibleTypeName => {
          var possibleType = _.find(entities, { name: possibleTypeName })
          if (
            possibleType &&
            isEnabled.call(this, possibleType) &&
            (this.theme.edgesToSelf || processedType.name !== possibleType.name)
          ) {
            result.push(
              createEdge.call(this, {
                from: {
                  typeName: getTypeDisplayName(processedType.name)
                },
                to: {
                  typeName: getTypeDisplayName(possibleType.name)
                },
                label: processedType.isUnionType
                  ? this.theme.edgeLabels.union
                  : this.theme.edgeLabels.interface,
                color: getColor.call(this, possibleType)
              })
            )
          }
        })
      }
      return result
    },
    []
  ).join('\n')

  dotfile += '\n\n'

  dotfile += '\n}'

  return dotfile
}
657654
function findReferences(schema) {
  if (schema.$ref) {
    return [schema.$ref];
  }

  let references = [];

  if (schema.allOf) {
    references = references.concat(...schema.allOf.map(findReferences));
  }

  if (schema.anyOf) {
    references = references.concat(...schema.anyOf.map(findReferences));
  }

  if (schema.oneOf) {
    references = references.concat(...schema.oneOf.map(findReferences));
  }

  if (schema.not) {
    references = references.concat(...findReferences(schema.not));
  }

  // Array

  if (schema.items) {
    if (Array.isArray(schema.items)) {
      references = references.concat(...schema.items.map(findReferences));
    } else {
      references = references.concat(findReferences(schema.items));
    }
  }

  if (schema.additionalItems && typeof schema.additionalItems === 'object') {
    references = references.concat(findReferences(schema.additionalItems));
  }

  // Object

  if (schema.properties) {
    Object.keys(schema.properties).forEach((key) => {
      references = references.concat(findReferences(schema.properties[key]));
    });
  }

  if (schema.patternProperties) {
    Object.keys(schema.patternProperties).forEach((key) => {
      references = references.concat(findReferences(schema.patternProperties[key]));
    });
  }

  if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {
    references = references.concat(findReferences(schema.additionalProperties));
  }

  return references;
}
942601
function(instance, handle) {
        if (!handle) return angular.noop;

        instance.$$mdHandle = handle;
        instances.push(instance);
        resolveWhen();

        return deregister;

        /**
         * Remove registration for an instance
         */
        function deregister() {
          var index = instances.indexOf(instance);
          if (index !== -1) {
            instances.splice(index, 1);
          }
        }

        /**
         * Resolve any pending promises for this instance
         */
        function resolveWhen() {
          var dfd = pendings[handle];
          if (dfd) {
            dfd.forEach(function (promise) {
              promise.resolve(instance);
            });
            delete pendings[handle];
          }
        }
      }
96076
function (_ref, path, fileName) 
    {
        var h = require("./helpers.js").apply(this, arguments);
        var obj = h.toObj();
        var props = [];
        for (var prop in obj)
            props.push(h.t.objectProperty(h.t.stringLiteral(prop.substr(prop.startsWith(".") ? 1 : 0)), obj[prop]));
        props.push(h.t.objectProperty(h.t.stringLiteral("file"), h.t.stringLiteral(fileName)));

            
        var parent = path.findParent((path) => path.isProgram());
        if (parent) parent.unshiftContainer('body', h.t.ifStatement(h.t.identifier("module.hot"), h.t.expressionStatement( h.t.callExpression(h.t.identifier("module.hot.accept"), [])) )); 

        //return h.t.callExpression(h.t.memberExpression(obj["ui"], h.t.identifier("renderApp")), [ h.t.objectExpression(props) ]);
        
        return h.t.callExpression(h.t.memberExpression(h.t.callExpression(h.t.identifier("require"), [ h.t.stringLiteral("@appfibre/jst")]), h.t.identifier("app")), [h.t.objectExpression(props)]);
    }
445967
function _flatten(_ref) {
  var _ref2 = _toArray(_ref);

  var first = _ref2[0];

  var rest = _ref2.slice(1);

  if (first === undefined) {
    return [];
  } else if (!Array.isArray(first)) {
    return [first].concat(_toConsumableArray(_flatten(rest)));
  } else {
    return [].concat(_toConsumableArray(_flatten(first)), _toConsumableArray(_flatten(rest)));
  }
}
217414
function findRefObject (ref, components) {
  const [ typeAndName, jsonSelector ] = typeNamePath(ref)

  const [ , refObj ] = findComponent(
    typeAndName,
    components,
    jsonSelector
  )

  if (!refObj) {
    return findRefObjectsByWildcard(typeAndName, components)
  }

  return refObj
}
874342
function createGetter(_ref) {
        var key = _ref.key,
            namespace = _ref.namespace,
            normalizedMappings = _ref.normalizedMappings,
            vmIdentifierKey = _ref.vmIdentifierKey,
            instanceIdentifierKey = _ref.instanceIdentifierKey,
            stateKey = _ref.stateKey;

        return function () {
            var _this = this;

            // find the state object
            var state = namespace ? resolveObjectPath(this.$store.state, namespace, '/') : this.$store.state;

            // find our container of instances
            var instancesContainer = resolveObjectPath(state, stateKey, '.');

            // find our instance within it
            var instance = instancesContainer.find(function (obj) {
                return obj[instanceIdentifierKey] === _this[vmIdentifierKey];
            });

            // and if all goes well, resolve the piece of state we're looking for
            if (instance) {
                return typeof normalizedMappings[key] === 'function' ? normalizedMappings[key](instance) : resolveObjectPath(instance, normalizedMappings[key]);
            }
        };
    }
510568
function(ref) {
        if (ref.category !== "objectref" || !ref.path || !ref.path.length || !ref.path.join) {
            return null;
        }
        return ref.path.join(".");
    }
736881
function byIdRef(id, ref) {
      var cmp = this.byId(id).lookupReferenceHolder(false).lookupReference(ref);
      if (!cmp) {
        throw new Error('Component not found for container id: ' + id + ', reference: ' + ref);
      }
      return cmp;
    }
257555
public function ref($ref1)
    {
        list($ref, $rest) = explode('/', $ref1, 2);

        if (!isset($this->_references[$ref])) {
            /** @type Field_Base $e */
            $e = $this->hasElement($ref);
            if ($e && $e->hasMethod('ref')) {
                return $e->ref();
            } else {
                throw $this->exception('Reference is not defined')
                    ->addMoreInfo('model', $this)
                    ->addMoreInfo('ref', $ref);
            }
        }

        $class = $this->_references[$ref];
        if (is_array($class)) { // hasMany
            if ($rest) {
                throw $this->exception('Cannot traverse multiple references');
            }
            $m = $this->_ref(
                $class[0],
                $class[1] && $class[1] != UNDEFINED ? $class[1] : $this->table.'_id',
                $class[2] && $class[2] != UNDEFINED ? $this[$class[2]] : $this->id
            );
        } else { // hasOne
            $id = $this->get($ref);
            /** @type Model $m */
            $m = $this->_ref(
                $class,
                null,
                $id
            );
            if ($id) {
                $this->hook('beforeRefLoad', array($m, $id));
                $m->load($id);
            }
        }
        if ($rest) {
            $m = $m->ref($rest);
        }

        return $m;
    }
1206619
function isRefObject (thing) {
  if (thing && typeof thing === 'object' && !Array.isArray(thing)) {
    const keys = Object.keys(thing)
    return keys.length === 1 && keys[0] === '$ref' && typeof thing.$ref === 'string'
  }
  return false
}
579204
function (schema, refResolver) {

                logger.debug("Creating reader for schema", schema);

                if (!refResolver) {
                    refResolver = new AmdResolver({path: "", altSeparator: "\\.", synchronous: true}).resolver;
                }

                this.smd = schema;

                //finds all $ref instances and replaces with the actual object
                //similar to dojox.json.ref.resolveJson, but doesn't get hung up on circular references
                //TODO: should we assume all schemas have been resolved prior, and remove this step?
                function resolveRef(subobj, parent, parentKey) {
                    if (!subobj.resolved) {
                        Object.keys(subobj).forEach(function (key) {
                            var Ref, value = subobj[key];
                            if (key === "$ref") {
                                logger.debug("Resolving $ref: " + value);
                                Ref = refResolver(value);
                                value = typeof Ref === 'function' ? new Ref() : Ref;
                                if (!util.isUndefined(value) && !value.resolved) {
                                    subobj.resolved = true;
                                    resolveRef(value, subobj, key);
                                }
                                parent[parentKey] = value;
                            } else if (typeof value === "object") {
                                resolveRef(value, subobj, key);
                            }
                        });
                    }
                }

                function getExtendedProperties(obj, props) {
                    var parent = (obj && obj["extends"]), propsObj = [], items = [], itemProps;

                    if (typeof parent !== "undefined") {

                        items = util.isArray(parent) ? parent : [parent]; //can be multiple-inheritance

                        items.forEach(function (item) {
                            itemProps = item.properties || {};
                            Object.keys(itemProps).forEach(function (key) {
                                var value = item.properties[key];
                                if (key !== "__parent") {
                                    propsObj.push({
                                        parentId: item.id,
                                        key: key,
                                        value: value
                                    });
                                }
                            });

                        }, this); // jshint ignore:line

                        props.push(propsObj);
                        props = getExtendedProperties(parent, props);
                    }

                    return props;

                }

                //looks in JSONSchema objects for "extends" and copies properties to children
            function resolveExtensions(schema) {

                var xprops, props;

                xprops = getExtendedProperties(schema, []);

                //unwind the property stack so that the earliest gets inheritance link
                schema.properties = schema.properties || {};
                function copyprop(item) { //util to get around jslint complaints about doing this directly in loop
                    schema.properties[item.key] = item.val;
                }

                while (xprops.length > 0) {
                    props = xprops.pop();
                    props.forEach(copyprop);
                }
            }

            // mix-in parameters for extended schemas
            function resolveExtendedParameters(obj) {

                // assume all references are resolved, just copy parameters down the
                // inheritence chain. If I am derived check base first.
                if (obj["extends"]) {
                    resolveExtendedParameters(obj["extends"]);
                    obj.parameters = obj.parameters || [];
                    obj.parameters = obj.parameters.concat(obj["extends"].parameters);
                }
            }

            //copies properties from parent as defaults, as well as extensions for params
            function resolveProperties(schema) {

                logger.debug("Resolving sub-properties for " + schema.id);

                // resolve inherited global parameters
                resolveExtendedParameters(schema);

                Object.keys(schema.services || {}).forEach(function (key) {
                    var value = schema.services[key];
                    //value.target = value.target ? schema.target + value.target : schema.target; //TODO: should this build concat paths? that is currently handled in getServiceUrl function
                    value.returns = value.returns || schema.returns;
                    value.transport = value.transport || schema.transport;
                    value.contentType = value.contentType || schema.contentType;
                    value.envelope = value.envelope || schema.envelope || "URL";
                    value.description = value.description || "";

                    if (value.returns) {
                        resolveExtensions(value.returns);
                    }

                    if (value.parameters) {
                        value.parameters.forEach(function (item) {
                            item.envelope = item.envelope || value.envelope;
                            item.description = item.description || "";
                        });
                    }


                    var ext = value["extends"];

                    if (ext) {

                        //resolution hasn't been completed or extends object isn't proper JSONSchema
                        if (!ext.id) {
                            throw new Error("Parent schema for method [" + key + "] in schema " + schema.id + " is invalid.");
                        }

                        //TODO: resolveExtensions for params object properties? not really needed yet (the name is fine for now...)
                        if (!value.parameters) {
                            value.parameters = ext.parameters;
                        } else {
                            value.parameters = value.parameters.concat(ext.parameters);
                        }
                    }
                });

                if (!schema.tag) {
                    schema.tag = {};
                }
                schema.tag.resolved = true;
                schema.resolvedProperties = true;
            }

            //if a schema has already been resolved, don't do it again - we can get into endless recursion
            if (!schema.resolved) {
                resolveRef(schema, null, null);
                schema.resolved = true;
            }

            //only resolve these once, or else our concats will be a problem
            if (!schema.resolvedProperties) {
                resolveProperties(schema);
            }

            var hash = {};

            //index params array by name for lookup
            hash.parameters = {};
            this.getMethodNames().forEach(function (methodName) {
                var service = this.smd.services[methodName];
                if (service.parameters) {
                    service.parameters.forEach(function (parameter) {
                        hash[methodName + "-" + parameter.name] = parameter;
                    });
                }
            }, this);

            this.findParameter = function (methodName, parameterName) {
                return hash[methodName + "-" + parameterName];
            };

        }
1137539
function (vnode, callback) {
    const { isArray } = utils
    if (isArray(vnode)) {
      if (process.env.NODE_ENV === 'development') {
        console.warn(
          '[vue-render] the ref passed to animation.transitionOnce is a array.'
        )
      }
      vnode = vnode[0]
    }
    let direction = 'ltr'
    if (vnode && vnode === 'viewport') {
      direction = getComputedStyle(document.documentElement)['direction']
    }
    else if (vnode) {
      const el = vnode instanceof HTMLElement ? vnode : vnode.$el
      direction = getComputedStyle(el)['direction']
    }
    callback && callback(direction)
    return direction
  }
268568
function (elbName, cb) {
      query(elbName, function (err, data) {
        if (err) return cb(err);
        var result = [];
        data.Instances.map(function (item) { result.push(item.InstanceId); });
        cb(undefined, result);
      });
    }
477416
def resolve_ref(cls, domain, env, fromdocname, builder, typ, target, node,
                    contnode):
        
        # indexes appear to be automatically generated at doc DOMAIN-NAME
        todocname = "bb-%s" % target

        node = nodes.reference('', '', internal=True)
        node['refuri'] = builder.get_relative_uri(fromdocname, todocname)
        node['reftitle'] = cls.localname
        node.append(nodes.emphasis(cls.localname, cls.localname))
        return node