     setupRelations: (links) ->
       for key, value of links
         [type, attribute] = key.split '.'
-        type = TYPES[type] || type
+        type = @types[type] || type
         @relations[type] ||= {}
-        @relations[type][attribute] = TYPES[value.type] || value.type
+        @relations[type][attribute] = @types[value.type] || value.type
 
     findRecord: (type, id) ->
       utils.find @records, (r) ->

      for name of data
        value = data[name]
        add = (d) =>
          type = TYPES[name] || name
          @remove type, d.id
          @records.push new Record(type: type, data: d)



module.exports = (utils) ->

  class Record
    constructor: (options) ->
      @type = options.type
      @data = options.data
      @types = options.types || {}

  class Store
    constructor: (options) ->
