 fs       = require 'fs'
 _.mixin require('underscore.string').exports()
 _.mixin require('understream').exports()
+
+apply_shadow_props = (obj) ->
+  if obj._shadow? then  _.extend(obj, obj._shadow) else obj
 
 module.exports = (api_key, data_dir) ->
   throw new Error "Must provide api_key" unless api_key?


  sandbox.stub clever.Query.prototype, 'stream', () ->
    resource = _.strRightBack(@_url, '/')
    s = _(clever.db[resource]).stream().map (raw_json) ->
      Klass = clever[_(resource).chain().capitalize().rtrim('s').value()]
      return new Klass raw_json
    process.nextTick () -> s.run((err) ->)
    return s.stream()


      dotty.put prop_obj.data, k, v for k, v of obj
    return cb null, prop_obj.data

  clever
