 NTRU_def = process.env.NODE_TLS_REJECT_UNAUTHORIZED
+bound = Meteor.bindEnvironment (callback) -> return callback()
+
+events = Npm.require 'events'
 
 class Neo4jListener
   constructor: (listener, @_db) ->


    @__service = {}
    @listeners = {}
    @batchQueue = {}
    @batchResults = {}
    @ready = false


    check cypher, String
    check opts, Object
    check settings, Object
    check callback, Match.Optional Function

    # if type is 'cypher'
    #   request = 
    #     method: 'POST'
    #     to: @__service.cypher.endpoint
    #     body:
    #       query: cypher
    #       params: opts

    request = 
      method: 'POST'
      to: @__service.transaction.endpoint + '/commit'
      body:
        statements: [
          statement: cypher
          parameters: opts
          resultDataContents: resultDataContents
        ]

    unless callback
      return Meteor.wrapAsync((cb)=>
        cb null, new Neo4jCursor @__batch request, null, reactive
      )()
    else
      @__batch request, (error, data) ->
        callback null, new Neo4jCursor data
      , reactive
      return @

#   transaction: -> new Neo4jTransaction @

# class Neo4jTransaction
#   constructor: (_db) ->
#     request = 
#       method: 'POST'
#       to: _db.__service.transaction.endpoint
#       body:
#         statements: []
#     console.log _db.__batch request