lib/resource-linker.js
function fetchExternals(request, body) {

    var includes = parseIncludes(request);
    var user = request.user;
    var requestsByType = groupIncludes(includes, body);

    return when.all(_.map(requestsByType, function(requestData, ancestorType) {
        var ids = _.uniq(requestData.ids);
        return fetchAncestor(ancestorType, ids, _.compact(_.map(requestData.includes, function(i) { return _.rest(i).join("."); })).join(","), request)
          .then(function(response){
            return response;
          })
          .then(function(data) {
            _.each(requestData.includes, function(split) {
              mergeAncestorData(body, split, ancestorType, data);
            });
          })
          .catch(function(err) { console.trace(err.stack || err); });
      })).then(function() {
        return body;
      });
  }
function fetchExternals(request, body) {

    var includes = parseIncludes(request);
    var user = request.user;
    var requestsByType = groupIncludes(includes, body);

    return when.all(_.map(requestsByType, function(requestData, ancestorType) {
        var ids = _.uniq(requestData.ids);
        return fetchAncestor(ancestorType, ids, _.compact(_.map(requestData.includes, function(i) { return _.rest(i).join("."); })).join(","), request)
          .then(function(response){
            return response;
          })
          .then(function(data) {
            _.each(requestData.includes, function(split) {
              mergeAncestorData(body, split, ancestorType, data);
            });
          })
          .catch(function(err) { console.trace(err.stack || err); });
      })).then(function() {
        return body;
      });
  }
function fetchExternals ( request , body ) { var includes = parseIncludes ( request ) ; var user = request . user ; var requestsByType = groupIncludes ( includes , body ) ; return when . all ( _ . map ( requestsByType , function ( requestData , ancestorType ) { var ids = _ . uniq ( requestData . ids ) ; return fetchAncestor ( ancestorType , ids , _ . compact ( _ . map ( requestData . includes , function ( i ) { return _ . rest ( i ) . join ( "." ) ; } ) ) . join ( "," ) , request ) . then ( function ( response ) { return response ; } ) . then ( function ( data ) { _ . each ( requestData . includes , function ( split ) { mergeAncestorData ( body , split , ancestorType , data ) ; } ) ; } ) . catch ( function ( err ) { console . trace ( err . stack || err ) ; } ) ; } ) ) . then ( function ( ) { return body ; } ) ; }
Reads the resource object and attaches data via external http calls
the properties marked as "external".

@param {Object} The http request object.
@param {Object} The body data from the response.
@api private
Reads the resource object and attaches data via external http calls the properties marked as external .