qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eal...@apache.org
Subject [1/5] qpid-dispatch git commit: DISPATCH-221 - Check in hawtio plugin code
Date Mon, 22 Feb 2016 21:09:52 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master fc4f8e6d0 -> eb2e027a4


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/eb2e027a/console/hawtio/src/main/webapp/plugin/lib/rhea-min.js
----------------------------------------------------------------------
diff --git a/console/hawtio/src/main/webapp/plugin/lib/rhea-min.js b/console/hawtio/src/main/webapp/plugin/lib/rhea-min.js
new file mode 100644
index 0000000..f61579a
--- /dev/null
+++ b/console/hawtio/src/main/webapp/plugin/lib/rhea-min.js
@@ -0,0 +1,93 @@
+require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+(function (process,Buffer){
+"use strict";function get_socket_id(t){return t.get_id_string?t.get_id_string():t.localAddress+":"+t.localPort+" -> "+t.remoteAddress+":"+t.remotePort}function session_per_connection(t){var e=null;return{get_session:function(){return e||(e=t.create_session(),e.begin()),e}}}function restrict(t,e){if(t){var o,n=t;return function(i){return o!==i&&(n=t,o=i),n--?e(i):-1}}return e}function backoff(t,e){var o,n=t;return function(i){o!==i&&(n=t,o=i);var s=n,r=2*n;return n=e>r?r:e,s}}function get_connect_fn(t){if(void 0===t.transport||"tcp"===t.transport)return net.connect;if("tls"===t.transport||"ssl"===t.transport)return tls.connect;throw Error("Unrecognised transport: "+t.transport)}function connection_details(t){var e={};return e.connect=t.connect?t.connect:get_connect_fn(t),e.host=t.host?t.host:"localhost",e.port=t.port?t.port:5672,e.options=t,e}function delegate_to_session(t){Connection.prototype["on_"+t]=function(e){var o=this.remote_channel_map[e.channel];if(!o)throw Error(t+" receiv
 ed on invalid channel "+e.channel);o["on_"+t](e)}}var frames=require("./frames.js"),log=require("./log.js"),sasl=require("./sasl.js"),types=require("./types.js"),util=require("./util.js"),EndpointState=require("./endpoint.js"),Session=require("./session.js"),Transport=require("./transport.js"),net=require("net"),tls=require("tls"),EventEmitter=require("events").EventEmitter,AMQP_PROTOCOL_ID=0,TLS_PROTOCOL_ID=2,conn_counter=1,Connection=function(t,e){if(this.options={},t)for(var o in t)this.options[o]=t[o];if(this.container=e,this.options.id||(this.options.id="connection-"+conn_counter++),this.options.container_id||(this.options.container_id=e?e.id:util.generate_uuid()),!this.options.connection_details){var n=this;this.options.connection_details=function(){return connection_details(n.options)}}var i=this.get_option("reconnect",!0);if("boolean"==typeof i&&i){var s=this.get_option("initial_reconnect_delay",100),r=this.get_option("max_reconnect_delay",6e4);this.options.reconnect=restric
 t(this.get_option("reconnect_limit"),backoff(s,r))}else if("number"==typeof i){var c=this.options.reconnect;this.options.reconnect=restrict(this.get_option("reconnect_limit"),function(){return c})}this.registered=!1,this.state=new EndpointState,this.local_channel_map={},this.remote_channel_map={},this.local={},this.remote={},this.local.open=frames.open(this.options),this.local.close=frames.close({}),this.session_policy=session_per_connection(this),this.amqp_transport=new Transport(this.options.id,AMQP_PROTOCOL_ID,frames.TYPE_AMQP,this),this.sasl_transport=void 0,this.transport=this.amqp_transport,this.conn_established_counter=0,this.heartbeat_out=void 0,this.heartbeat_in=void 0,this.abort_idle=!1,this.socket_ready=!1,this.scheduled_reconnect=void 0};Connection.prototype=Object.create(EventEmitter.prototype),Connection.prototype.constructor=Connection,Connection.prototype.dispatch=function(t,e){return log.events("Connection got event: "+t),this.listeners(t).length?(EventEmitter.proto
 type.emit.apply(this,arguments),!0):this.container?this.container.dispatch.apply(this.container,arguments):void 0},Connection.prototype.reset=function(){this.abort_idle&&(this.abort_idle=!1,this.local.close.error=void 0,this.state=new EndpointState,this.state.open()),this.amqp_transport=new Transport(this.options.id,AMQP_PROTOCOL_ID,frames.TYPE_AMQP,this),this.sasl_transport=void 0,this.transport=this.amqp_transport,this.state.disconnected(),this.remote={},this.remote_channel_map={};for(var t in this.local_channel_map)this.local_channel_map[t].reset();this.socket_ready=!1},Connection.prototype.connect=function(){return this.is_server=!1,this._connect(this.options.connection_details(this.conn_established_counter)),this.open(),this},Connection.prototype.reconnect=function(){return this.scheduled_reconnect=void 0,log.reconnect("reconnecting..."),this.reset(),this._connect(this.options.connection_details(this.conn_established_counter)),process.nextTick(this._process.bind(this)),this},Co
 nnection.prototype._connect=function(t){return t.connect?this.init(t.connect(t.port,t.host,t.options,this.connected.bind(this))):this.init(get_connect_fn(t)(t.port,t.host,t.options,this.connected.bind(this))),this},Connection.prototype.accept=function(t){return this.is_server=!0,log.io("["+this.id+"] client accepted: "+get_socket_id(t)),this.socket_ready=!0,this.init(t)},Connection.prototype.init=function(t){if(this.socket=t,this.socket.on("data",this.input.bind(this)),this.socket.on("error",this.error.bind(this)),this.socket.on("end",this.eof.bind(this)),this.is_server){var e;this.container&&Object.getOwnPropertyNames(this.container.sasl_server_mechanisms).length&&(e=this.container.sasl_server_mechanisms),this.socket.encrypted&&this.socket.authorized&&this.get_option("enable_sasl_external",!1)&&(e=sasl.server_add_external(e?util.clone(e):{})),e&&(this.sasl_transport=new sasl.Server(this,e))}else{var o=this.get_option("sasl_mechanisms");if(!o){var n=this.get_option("username"),i=thi
 s.get_option("password");n&&(o=sasl.client_mechanisms(),i?o.enable_plain(n,i):o.enable_anonymous(n))}this.socket.encrypted&&this.options.cert&&this.get_option("enable_sasl_external",!1)&&(o||(o=sasl.client_mechanisms()),o.enable_external()),o&&(this.sasl_transport=new sasl.Client(this,o))}return this.transport=this.sasl_transport?this.sasl_transport:this.amqp_transport,this},Connection.prototype.attach_sender=function(t){return this.session_policy.get_session().attach_sender(t)},Connection.prototype.open_sender=Connection.prototype.attach_sender,Connection.prototype.attach_receiver=function(t){return this.session_policy.get_session().attach_receiver(t)},Connection.prototype.open_receiver=Connection.prototype.attach_receiver,Connection.prototype.get_option=function(t,e){return void 0!==this.options[t]?this.options[t]:this.container?this.container.get_option(t,e):e},Connection.prototype.connected=function(){this.socket_ready=!0,this.conn_established_counter++,log.io("["+this.options.i
 d+"] connected "+get_socket_id(this.socket)),this.output()},Connection.prototype.sasl_failed=function(t){this.transport_error={condition:"amqp:unauthorized-access",description:t},this._handle_error()},Connection.prototype._handle_error=function(){var t=this.get_error();return t?(this.dispatch("connection_error",this._context())||this.dispatch("connection_close",this._context())||console.log("error: "+JSON.stringify(t)),!0):!1},Connection.prototype.get_error=function(){return this.transport_error?this.transport_error:this.remote.close&&this.remote.close.error?this.remote.close.error:void 0},Connection.prototype.output=function(){this.socket&&this.socket_ready&&(this.heartbeat_out&&clearTimeout(this.heartbeat_out),this.transport.write(this.socket),(this.is_closed()&&this.state.has_settled()||this.abort_idle||this.transport_error)&&!this.transport.has_writes_pending()?this.socket.end():this.is_open()&&this.remote.open.idle_time_out&&(this.heartbeat_out=setTimeout(this._write_frame.bind
 (this),this.remote.open.idle_time_out/2)))},Connection.prototype.input=function(t){this.heartbeat_in&&clearTimeout(this.heartbeat_in),log.io("["+this.options.id+"] read "+t.length+" bytes");var e;this.previous_input?(e=Buffer.concat([this.previous_input,t],this.previous_input.length+t.length),this.previous_input=null):e=t;var o=this.transport.read(e,this);o<e.length&&(this.previous_input=e.slice(o)),this.local.open.idle_time_out&&(this.heartbeat_in=setTimeout(this.idle.bind(this),this.local.open.idle_time_out)),this.transport.has_writes_pending()&&this.output()},Connection.prototype.idle=function(){this.is_open()&&(this.abort_idle=!0,this.local.close.error={condition:"amqp:resource-limit-exceeded",description:"max idle time exceeded"},this.close())},Connection.prototype.error=function(t){console.log("["+this.options.id+"] error: "+t),this._disconnected()},Connection.prototype.eof=function(t){this._disconnected()},Connection.prototype._disconnected=function(){if(!this.is_closed()&&vo
 id 0==this.scheduled_reconnect&&(this.dispatch("disconnected",this._context())||console.log("["+this.options.id+"] disconnected"),!this.is_server&&!this.transport_error&&this.options.reconnect)){var t=this.options.reconnect(this.conn_established_counter);t>=0&&(log.reconnect("Scheduled reconnect in "+t+"ms"),this.scheduled_reconnect=setTimeout(this.reconnect.bind(this),t))}},Connection.prototype.open=function(){this.state.open()&&this._register()},Connection.prototype.close=function(){this.state.close()&&this._register()},Connection.prototype.is_open=function(){return this.state.is_open()},Connection.prototype.is_closed=function(){return this.state.is_closed()},Connection.prototype.create_session=function(){for(var t=0;this.local_channel_map[t];)t++;var e=new Session(this,t);return this.local_channel_map[t]=e,e},Connection.prototype.on_open=function(t){if(!this.state.remote_opened())throw Error("Open already received");this.remote.open=t.performative,this.open(),this.dispatch("conne
 ction_open",this._context())},Connection.prototype.on_close=function(t){if(!this.state.remote_closed())throw Error("Close already received");this.remote.close=t.performative,this.close(),this.remote.close.error?this._handle_error():this.dispatch("connection_close",this._context()),this.heartbeat_out&&clearTimeout(this.heartbeat_out)},Connection.prototype._register=function(){this.registered||(this.registered=!0,process.nextTick(this._process.bind(this)))},Connection.prototype._process=function(){this.registered=!1;do{this.state.need_open()&&this._write_open();for(var t in this.local_channel_map)this.local_channel_map[t]._process();this.state.need_close()&&this._write_close()}while(!this.state.has_settled())},Connection.prototype._write_frame=function(t,e,o){this.amqp_transport.encode(frames.amqp_frame(t,e,o)),this.output()},Connection.prototype._write_open=function(){this._write_frame(0,this.local.open.described())},Connection.prototype._write_close=function(){this._write_frame(0,th
 is.local.close.described())},Connection.prototype.on_begin=function(t){var e;if(null===t.performative.remote_channel||void 0===t.performative.remote_channel)e=this.create_session(),e.local.begin.remote_channel=t.channel;else if(e=this.local_channel_map[t.performative.remote_channel],!e)throw Error("Invalid value for remote channel "+t.performative.remote_channel);e.on_begin(t),this.remote_channel_map[t.channel]=e},Connection.prototype.get_peer_certificate=function(){return this.socket&&this.socket.getPeerCertificate?this.socket.getPeerCertificate():void 0},Connection.prototype._context=function(t){var e=t?t:{};return e.connection=this,this.container&&(e.container=this.container),e},delegate_to_session("end"),delegate_to_session("attach"),delegate_to_session("detach"),delegate_to_session("transfer"),delegate_to_session("disposition"),delegate_to_session("flow"),module.exports=Connection;
+}).call(this,require('_process'),require("buffer").Buffer)
+
+},{"./endpoint.js":2,"./frames.js":3,"./log.js":5,"./sasl.js":8,"./session.js":9,"./transport.js":11,"./types.js":12,"./util.js":13,"_process":24,"buffer":19,"events":23,"net":18,"tls":18}],2:[function(require,module,exports){
+"use strict";var EndpointState=function(){this.init()};EndpointState.prototype.init=function(){this.local_open=!1,this.remote_open=!1,this.open_requests=0,this.close_requests=0,this.initialised=!1},EndpointState.prototype.open=function(){return this.initialised=!0,this.local_open?!1:(this.local_open=!0,this.open_requests++,!0)},EndpointState.prototype.close=function(){return this.local_open?(this.local_open=!1,this.close_requests++,!0):!1},EndpointState.prototype.disconnected=function(){var t=this.local_open;this.init(),t?this.open():this.close()},EndpointState.prototype.remote_opened=function(t){return this.remote_open?!1:(this.remote_open=!0,!0)},EndpointState.prototype.remote_closed=function(t){return this.remote_open?(this.remote_open=!1,!0):!1},EndpointState.prototype.is_open=function(){return this.local_open&&this.remote_open},EndpointState.prototype.is_closed=function(){return this.initialised&&!this.local_open&&!this.remote_open},EndpointState.prototype.has_settled=function(
 ){return 0==this.open_requests&&0==this.close_requests},EndpointState.prototype.need_open=function(){return this.open_requests>0?(this.open_requests--,!0):!1},EndpointState.prototype.need_close=function(){return this.close_requests>0?(this.close_requests--,!0):!1},module.exports=EndpointState;
+},{}],3:[function(require,module,exports){
+"use strict";function define_frame(e,a){var t=types.define_composite(a);frames[a.name]=t.create,by_descriptor[Number(t.descriptor.numeric).toString(10)]=t,by_descriptor[t.descriptor.symbolic]=t}var types=require("./types.js"),frames={},by_descriptor={};frames.read_header=function(e){var a=4,t={},n=e.toString("ascii",0,a);if("AMQP"!==n)throw Error("Invalid protocol header for AMQP "+n);if(t.protocol_id=e.readUInt8(a++),t.major=e.readUInt8(a++),t.minor=e.readUInt8(a++),t.revision=e.readUInt8(a++),1!==t.major||0!==t.minor)throw Error("Unsupported AMQP version: "+JSON.stringify(t));return t},frames.write_header=function(e,a){var t=4;return e.write("AMQP",0,t,"ascii"),e.writeUInt8(a.protocol_id,t++),e.writeUInt8(a.major,t++),e.writeUInt8(a.minor,t++),e.writeUInt8(a.revision,t++),8},frames.TYPE_AMQP=0,frames.TYPE_SASL=1,frames.read_frame=function(e){var a=new types.Reader(e),t={};if(t.size=a.read_uint(4),a.remaining<t.size)return null;var n=a.read_uint(1);if(2>n)throw Error("Invalid data 
 offset, must be at least 2 was "+n);if(t.type=a.read_uint(1),t.type===frames.TYPE_AMQP)t.channel=a.read_uint(2);else{if(t.type!==frames.TYPE_SASL)throw Error("Unknown frame type "+t.type);a.skip(2)}if(n>1&&a.skip(4*n-8),a.remaining()){t.performative=a.read();var r=by_descriptor[t.performative.descriptor.value];r&&(t.performative=new r(t.performative.value)),a.remaining()&&(t.payload=a.read_bytes(a.remaining()))}return t},frames.write_frame=function(e){var a=new types.Writer;if(a.skip(4),a.write_uint(2,1),a.write_uint(e.type,1),e.type===frames.TYPE_AMQP)a.write_uint(e.channel,2);else{if(e.type!==frames.TYPE_SASL)throw Error("Unknown frame type "+e.type);a.write_uint(0,2)}e.performative&&(a.write(e.performative),e.payload&&a.write_bytes(e.payload));var t=a.toBuffer();return t.writeUInt32BE(t.length,0),t},frames.amqp_frame=function(e,a,t){return{channel:e||0,type:frames.TYPE_AMQP,performative:a,payload:t}},frames.sasl_frame=function(e){return{channel:0,type:frames.TYPE_SASL,performativ
 e:e}};var open={name:"open",code:16,fields:[{name:"container_id",type:"string",mandatory:!0},{name:"hostname",type:"string"},{name:"max_frame_size",type:"uint",default_value:4294967295},{name:"channel_max",type:"ushort",default_value:65535},{name:"idle_time_out",type:"uint"},{name:"outgoing_locales",type:"symbol",multiple:!0},{name:"incoming_locales",type:"symbol",multiple:!0},{name:"offered_capabilities",type:"symbol",multiple:!0},{name:"desired_capabilities",type:"symbol",multiple:!0},{name:"properties",type:"symbolic_map"}]},begin={name:"begin",code:17,fields:[{name:"remote_channel",type:"ushort"},{name:"next_outgoing_id",type:"uint",mandatory:!0},{name:"incoming_window",type:"uint",mandatory:!0},{name:"outgoing_window",type:"uint",mandatory:!0},{name:"handle_max",type:"uint",default_value:"4294967295"},{name:"offered_capabilities",type:"symbol",multiple:!0},{name:"desired_capabilities",type:"symbol",multiple:!0},{name:"properties",type:"symbolic_map"}]},attach={name:"attach",cod
 e:18,fields:[{name:"name",type:"string",mandatory:!0},{name:"handle",type:"uint",mandatory:!0},{name:"role",type:"boolean",mandatory:!0},{name:"snd_settle_mode",type:"ubyte",default_value:2},{name:"rcv_settle_mode",type:"ubyte",default_value:0},{name:"source",type:"*"},{name:"target",type:"*"},{name:"unsettled",type:"map"},{name:"incomplete_unsettled",type:"boolean",default_value:!1},{name:"initial_delivery_count",type:"uint"},{name:"max_message_size",type:"ulong"},{name:"offered_capabilities",type:"symbol",multiple:!0},{name:"desired_capabilities",type:"symbol",multiple:!0},{name:"properties",type:"symbolic_map"}]},flow={name:"flow",code:19,fields:[{name:"next_incoming_id",type:"uint"},{name:"incoming_window",type:"uint",mandatory:!0},{name:"next_outgoing_id",type:"uint",mandatory:!0},{name:"outgoing_window",type:"uint",mandatory:!0},{name:"handle",type:"uint"},{name:"delivery_count",type:"uint"},{name:"link_credit",type:"uint"},{name:"available",type:"uint"},{name:"drain",type:"bo
 olean",default_value:!1},{name:"echo",type:"boolean",default_value:!1},{name:"properties",type:"symbolic_map"}]},transfer={name:"transfer",code:20,fields:[{name:"handle",type:"uint",mandatory:!0},{name:"delivery_id",type:"uint"},{name:"delivery_tag",type:"binary"},{name:"message_format",type:"uint"},{name:"settled",type:"boolean"},{name:"more",type:"boolean",default_value:!1},{name:"rcv_settle_mode",type:"ubyte"},{name:"state",type:"delivery_state"},{name:"resume",type:"boolean",default_value:!1},{name:"aborted",type:"boolean",default_value:!1},{name:"batchable",type:"boolean",default_value:!1}]},disposition={name:"disposition",code:21,fields:[{name:"role",type:"boolean",mandatory:!0},{name:"first",type:"uint",mandatory:!0},{name:"last",type:"uint"},{name:"settled",type:"boolean",default_value:!1},{name:"state",type:"*"},{name:"batchable",type:"boolean",default_value:!1}]},detach={name:"detach",code:22,fields:[{name:"handle",type:"uint",mandatory:!0},{name:"closed",type:"boolean",de
 fault_value:!1},{name:"error",type:"error"}]},end={name:"end",code:23,fields:[{name:"error",type:"error"}]},close={name:"close",code:24,fields:[{name:"error",type:"error"}]};define_frame(frames.TYPE_AMQP,open),define_frame(frames.TYPE_AMQP,begin),define_frame(frames.TYPE_AMQP,attach),define_frame(frames.TYPE_AMQP,flow),define_frame(frames.TYPE_AMQP,transfer),define_frame(frames.TYPE_AMQP,disposition),define_frame(frames.TYPE_AMQP,detach),define_frame(frames.TYPE_AMQP,end),define_frame(frames.TYPE_AMQP,close);var sasl_mechanisms={name:"sasl_mechanisms",code:64,fields:[{name:"sasl_server_mechanisms",type:"symbol",multiple:!0,mandatory:!0}]},sasl_init={name:"sasl_init",code:65,fields:[{name:"mechanism",type:"symbol",mandatory:!0},{name:"initial_response",type:"binary"},{name:"hostname",type:"string"}]},sasl_challenge={name:"sasl_challenge",code:66,fields:[{name:"challenge",type:"binary",mandatory:!0}]},sasl_response={name:"sasl_response",code:67,fields:[{name:"response",type:"binary",m
 andatory:!0}]},sasl_outcome={name:"sasl_outcome",code:68,fields:[{name:"code",type:"ubyte",mandatory:!0},{name:"additional_data",type:"binary"}]};define_frame(frames.TYPE_SASL,sasl_mechanisms),define_frame(frames.TYPE_SASL,sasl_init),define_frame(frames.TYPE_SASL,sasl_challenge),define_frame(frames.TYPE_SASL,sasl_response),define_frame(frames.TYPE_SASL,sasl_outcome),module.exports=frames;
+},{"./types.js":12}],4:[function(require,module,exports){
+"use strict";function auto_settle(e){e.delivery.settled=!0}function auto_accept(e){e.delivery.update(!0,message.accepted().described())}function is_internal(e){switch(e){case"handle":case"role":case"initial_delivery_count":return!0;default:return!1}}var frames=require("./frames.js"),log=require("./log.js"),message=require("./message.js"),terminus=require("./terminus.js"),types=require("./types.js"),EndpointState=require("./endpoint.js"),FlowController=function(e){this.window=e};FlowController.prototype.update=function(e){var t=this.window-e.receiver.credit;e.receiver.flow(t)};var EventEmitter=require("events").EventEmitter,link=Object.create(EventEmitter.prototype);link.dispatch=function(e,t){log.events("Link got event: "+e),EventEmitter.prototype.emit.apply(this.observers,arguments),this.listeners(e).length?EventEmitter.prototype.emit.apply(this,arguments):this.session.dispatch.apply(this.session,arguments)},link.set_source=function(e){this.local.attach.source=terminus.source(e).de
 scribed()},link.set_target=function(e){this.local.attach.target=terminus.target(e).described()},link.attach=function(){this.state.open()&&this.connection._register()},link.open=link.attach,link.detach=function(){this.local.detach.closed=!1,this.state.close()&&this.connection._register()},link.close=function(){this.local.detach.closed=!0,this.state.close()&&this.connection._register()},link.is_open=function(){return this.session.is_open()&&this.state.is_open()},link.is_closed=function(){return this.session.is_closed()||this.state.is_closed()},link._process=function(){do this.state.need_open()&&this.session.output(this.local.attach.described()),this.issue_flow&&(this.session._write_flow(this),this.issue_flow=!1),this.state.need_close()&&this.session.output(this.local.detach.described());while(!this.state.has_settled())},link.on_attach=function(e){if(!this.state.remote_opened())throw Error("Attach already received");this.remote.handle||(this.remote.handle=e.handle),e.performative.sourc
 e=terminus.unwrap(e.performative.source),e.performative.target=terminus.unwrap(e.performative.target),this.remote.attach=e.performative,this.open(),this.dispatch(this.is_receiver()?"receiver_open":"sender_open",this._context())},link.on_detach=function(e){if(!this.state.remote_closed())throw Error("Detach already received");this.remote.detach=e.performative,this.close(),this.dispatch(this.local.attach.role?"receiver_close":"sender_close",this._context())},link.init=function(e,t,i,s,n){this.session=e,this.connection=e.connection,this.name=t,this.options=void 0===s?{}:s,this.state=new EndpointState,this.issue_flow=!1,this.local={handle:i},this.local.attach=frames.attach({handle:i,name:t,role:n});for(var o in this.local.attach)is_internal(o)||void 0===this.options[o]||(this.local.attach[o]=this.options[o]);this.local.detach=frames.detach({handle:i,closed:!0}),this.remote={handle:void 0},this.delivery_count=0,this.credit=0,this.observers=new EventEmitter},link.reset=function(){this.stat
 e.disconnected(),this.remote={handle:void 0},this.delivery_count=0,this.credit=0},link.has_credit=function(){return this.credit>0},link.is_receiver=function(){return this.local.attach.role},link._context=function(e){var t=e?e:{};return this.is_receiver()?t.receiver=this:t.sender=this,this.session._context(t)},link.get_option=function(e,t){return void 0!==this.options[e]?this.options[e]:this.session.get_option(e,t)};var Sender=function(e,t,i,s){this.init(e,t,i,s,!1),this.local.attach.initial_delivery_count=0,this.tag=0,this.get_option("autosettle",!0)&&this.observers.on("settled",auto_settle)};Sender.prototype=Object.create(link),Sender.prototype.constructor=Sender,Sender.prototype.next_tag=function(){return new String(this.tag++)},Sender.prototype.sendable=function(e){return this.credit&&this.session.outgoing.available()},Sender.prototype.on_flow=function(e){var t=e.performative;this.credit=t.delivery_count+t.link_credit-this.delivery_count,this.is_open()&&(this.dispatch("sender_flo
 w",this._context()),this.sendable()&&this.dispatch("sendable",this._context()))},Sender.prototype.on_transfer=function(e){throw Error("got transfer on sending link")},Sender.prototype.send=function(e,t){return this.session.send(this,t?t:this.next_tag(),message.encode(e),0)};var Receiver=function(e,t,i,s){this.init(e,t,i,s,!0),this.set_prefetch(this.get_option("prefetch",100)),this.get_option("autoaccept",!0)&&this.observers.on("message",auto_accept)};Receiver.prototype=Object.create(link),Receiver.prototype.constructor=Receiver,Receiver.prototype.on_flow=function(e){this.dispatch("receiver_flow",this._context())},Receiver.prototype.flow=function(e){e>0&&(this.credit+=e,this.issue_flow=!0,this.connection._register())},Receiver.prototype.set_prefetch=function(e){if(e>0){var t=new FlowController(e),i=t.update.bind(t);this.observers.on("message",i),this.observers.on("receiver_open",i)}},module.exports={Sender:Sender,Receiver:Receiver};
+},{"./endpoint.js":2,"./frames.js":3,"./log.js":5,"./message.js":6,"./terminus.js":10,"./types.js":12,"events":23}],5:[function(require,module,exports){
+"use strict";var debug=require("debug");module.exports={frames:debug("rhea:frames"),raw:debug("rhea:raw"),reconnect:debug("rhea:reconnect"),events:debug("rhea:events"),message:debug("rhea:message"),flow:debug("rhea:flow"),io:debug("rhea:io")};
+},{"debug":15}],6:[function(require,module,exports){
+"use strict";function define_section(e,n,t){n.descriptor=e,unwrappers[e.symbolic]=n,unwrappers[Number(e.numeric).toString(10)]=n,t&&wrappers.push(t)}function define_composite_section(e){var n=types.define_composite(e);message[e.name]=n.create,by_descriptor[Number(n.descriptor.numeric).toString(10)]=n,by_descriptor[n.descriptor.symbolic]=n;var t=function(t,o){t[e.name]=new n(o.value)},o=function(t,o){o[e.name]&&(o[e.name].described?t.push(o[e.name].described()):t.push(n.create(o[e.name]).described()))};define_section(n.descriptor,t,o)}function define_map_section(e){var n={numeric:e.code};n.symbolic="amqp:"+e.name.replace(/_/g,"-")+":map";var t=function(n,t){n[e.name]=types.unwrap(t)},o=function(t,o){o[e.name]&&t.push(types.described(types.wrap_ulong(n.numeric),types.wrap_map(o[e.name])))};define_section(n,t,o)}function define_outcome(e){var n=types.define_composite(e);n.composite_type=e.name,message[e.name]=n.create,outcomes[Number(n.descriptor.numeric).toString(10)]=n,outcomes[n.des
 criptor.symbolic]=n,message["is_"+e.name]=function(n){if(n&&n.descriptor){var t=outcomes[n.descriptor.value];if(t)return t.descriptor.numeric==e.code}return!1}}var log=require("./log.js"),types=require("./types.js"),by_descriptor={},unwrappers={},wrappers=[],message={};define_composite_section({name:"header",code:112,fields:[{name:"durable",type:"boolean",default_value:!1},{name:"priority",type:"ubyte",default_value:4},{name:"ttl",type:"uint"},{name:"first_acquirer",type:"boolean",default_value:!1},{name:"delivery_count",type:"uint",default_value:0}]}),define_map_section({name:"delivery_annotations",code:113}),define_map_section({name:"message_annotations",code:114}),define_composite_section({name:"properties",code:115,fields:[{name:"message_id",type:"message_id"},{name:"user_id",type:"binary"},{name:"to",type:"string"},{name:"subject",type:"string"},{name:"reply_to",type:"string"},{name:"correlation_id",type:"message_id"},{name:"content_type",type:"symbol"},{name:"content_encoding"
 ,type:"symbol"},{name:"absolute_expiry_time",type:"timestamp"},{name:"creation_time",type:"timestamp"},{name:"group_id",type:"string"},{name:"group_sequence",type:"uint"},{name:"reply_to_group_id",type:"string"}]}),define_map_section({name:"application_properties",code:116}),define_section({numeric:119,symbolic:"amqp:value:*"},function(e,n){e.body=types.unwrap(n)},function(e,n){e.push(types.described(types.wrap_ulong(119),types.wrap(n.body)))}),define_map_section({name:"footer",code:120}),message.encode=function(e){var n=[];wrappers.forEach(function(t){t(n,e)});for(var t=new types.Writer,o=0;o<n.length;o++)log.message("Encoding section "+(o+1)+" of "+n.length+": "+n[o]),t.write(n[o]);var i=t.toBuffer();return log.message("encoded "+i.length+" bytes"),i},message.decode=function(e){for(var n={},t=new types.Reader(e);t.remaining();){var o=t.read();if(log.message("decoding section: "+JSON.stringify(o)+" of type: "+JSON.stringify(o.descriptor)),o.descriptor){var i=unwrappers[o.descriptor
 .value];i?i(n,o):console.log("WARNING: did not recognise message section with descriptor "+o.descriptor)}else console.log("WARNING: expected described message section got "+JSON.stringify(o))}return n};var outcomes={};message.unwrap_outcome=function(e){if(e&&e.descriptor){var n=outcomes[e.descriptor.value];if(n)return new n(e)}return console.log("unrecognised outcome"),e},message.are_outcomes_equivalent=function(e,n){return void 0===e&&void 0===n?!0:void 0===e||void 0===n?!1:e.descriptor.value==n.descriptor.value&&JSON.stringify(e)==JSON.stringify(n)},define_outcome({name:"received",code:35,fields:[{name:"section-number",type:"uint",mandatory:!0},{name:"section-offset",type:"ulong",mandatory:!0}]}),define_outcome({name:"accepted",code:36,fields:[]}),define_outcome({name:"rejected",code:37,fields:[{name:"error",type:"error"}]}),define_outcome({name:"released",code:38,fields:[]}),define_outcome({name:"modified",code:39,fields:[{name:"delivery-failed",type:"boolean"},{name:"undeliverab
 le-here",type:"boolean"},{name:"message-annotations",type:"fields"}]}),module.exports=message;
+},{"./log.js":5,"./types.js":12}],7:[function(require,module,exports){
+"use strict";function match(e,t){return t?Array.isArray(t)?t.indexOf(e)>-1:e===t:!1}var url=require("url"),simple_id_generator={counter:1,next:function(){return this.counter++}},Client=function(e,t){var i=url.parse(t);this.connection=e.connect({host:i.hostname,port:i.port}),this.connection.on("message",this._response.bind(this)),this.connection.on("receiver_open",this._ready.bind(this)),this.sender=this.connection.attach_sender(i.path.substr(1)),this.receiver=this.connection.attach_receiver({source:{dynamic:!0}}),this.id_generator=simple_id_generator,this.pending=[],this.outstanding={}};Client.prototype._request=function(e,t,i,n){var s={properties:{}};s.properties.subject=t,s.body=i,s.properties.message_id=e,s.properties.reply_to=this.receiver.remote.attach.source.address,this.outstanding[e]=n,this.sender.send(s)},Client.prototype._response=function(e){var t=e.message.properties.correlation_id,i=this.outstanding[t];i?"ok"===e.message.properties.subject?i(e.message.body):i(void 0,{na
 me:e.message.properties.subject,description:e.message.body}):console.log("no request pending for "+t+", ignoring response")},Client.prototype._ready=function(e){this._process_pending()},Client.prototype._process_pending=function(){for(var e=0;e<this.pending.length;e++){var t=this.pending[e];this._request(t.id,t.name,t.args,t.callback)}this.pending=[]},Client.prototype.call=function(e,t,i){var n=this.id_generator.next();this.receiver.is_open()&&0===this.pending.length?this._request(n,e,t,i):this.pending.push({name:e,args:t,callback:i,id:n})},Client.prototype.close=function(){this.receiver.close(),this.sender.close(),this.connection.close()},Client.prototype.define=function(e){this[e]=function(t,i){this.call(e,t,i)}};var Cache=function(e,t){this.ttl=e,this.purged=t,this.entries={},this.timeout=void 0};Cache.prototype.clear=function(){this.timeout&&clearTimeout(this.timeout),this.entries={}},Cache.prototype.put=function(e,t){this.entries[e]={value:t,last_accessed:Date.now()},this.timeo
 ut||(this.timeout=setTimeout(this.purge.bind(this),this.ttl))},Cache.prototype.get=function(e){var t=this.entries[e];return t?(t.last_accessed=Date.now(),t.value):void 0},Cache.prototype.purge=function(){var e=Date.now(),t=[],i=0;for(var n in this.entries)e-this.entries[n].last_accessed>=this.ttl?t.push(n):i++;for(var s=0;s<t.length;s++){var o=this.entries[t[s]];delete this.entries[t[s]],this.purged(o.value)}i&&!this.timeout&&(this.timeout=setTimeout(this.purge.bind(this),this.ttl))};var LinkCache=function(e,t){this.factory=e,this.cache=new Cache(t,function(e){e.close()})};LinkCache.prototype.clear=function(){this.cache.clear()},LinkCache.prototype.get=function(e){var t=this.cache.get(e);return void 0===t&&(t=this.factory(e),this.cache.put(e,t)),t};var Server=function(e,t,i){this.options=i||{};var n=url.parse(t);this.connection=e.connect({host:n.hostname,port:n.port}),this.connection.on("connection_open",this._connection_open.bind(this)),this.connection.on("message",this._request.bi
 nd(this)),this.receiver=this.connection.attach_receiver(n.path.substr(1)),this.callbacks={},this._send=void 0,this._clear=void 0};Server.prototype._connection_open=function(e){if(match("ANONYMOUS-RELAY",this.connection.remote.open.offered_capabilities)){var t=this.connection.attach_sender({target:{}});this._send=function(e){t.send(e)}}else{var i=new LinkCache(this.connection.attach_sender.bind(this.connection),this.options.cache_ttl||6e4);this._send=function(e){var t=i.get(e.properties.to);t&&t.send(e)},this._clear=function(){i.clear()}}},Server.prototype._respond=function(e){var t=this;return function(i,n){n?(e.properties.subject=n.name||"error",e.body=n.description||n):(e.properties.subject="ok",e.body=i),t._send(e)}},Server.prototype._request=function(e){var t=e.message,i={properties:{}};i.properties.to=t.properties.reply_to,i.properties.correlation_id=t.properties.message_id;var n=this.callbacks[t.properties.subject];n?n(t.body,this._respond(i)):(i.properties.subject="bad-method
 ",i.body="Unrecognised method "+t.properties.subject,this._send(i))},Server.prototype.bind_sync=function(e,t){this.callbacks[t||e.name]=function(t,i){var n=e(t);i(n)}},Server.prototype.bind=function(e,t){this.callbacks[t||e.name]=e},Server.prototype.close=function(){this._clear&&this._clear(),this.receiver.close(),this.connection.close()},module.exports={server:function(e,t,i){return new Server(e,t,i)},client:function(e,t){return new Client(e,t)}};
+},{"url":29}],8:[function(require,module,exports){
+(function (Buffer){
+"use strict";function intersection(e,t){return e.filter(function(e){return t.indexOf(e)>=0})}function extract(e){for(var t=[],s=0,n=0;n<e.length;)0===e[n]?(n>s?t.push(e.toString("utf8",s,n)):t.push(null),s=++n):++n;return n>s?t.push(e.toString("utf8",s,n)):t.push(null),t}var frames=require("./frames.js"),log=require("./log.js"),Transport=require("./transport.js"),sasl_codes={OK:0,AUTH:1,SYS:2,SYS_PERM:3,SYS_TEMP:4},SASL_PROTOCOL_ID=3,PlainServer=function(e){this.callback=e,this.outcome=void 0,this.username=void 0};PlainServer.prototype.start=function(e){var t=extract(e);3!==t.length&&this.connection.sasl_failed("Unexpected response in PLAIN, got "+t.length+" fields, expected 3"),this.callback(t[1],t[2])?(this.outcome=!0,this.username=t[1]):this.outcome=!1};var PlainClient=function(e,t){this.username=e,this.password=t};PlainClient.prototype.start=function(){var e=new Buffer(1+this.username.length+1+this.password.length);return e.writeUInt8(0,0),e.write(this.username,1),e.writeUInt8(0
 ,1+this.username.length),e.write(this.password,1+this.username.length+1),e};var AnonymousServer=function(){this.outcome=void 0,this.username=void 0};AnonymousServer.prototype.start=function(e){this.outcome=!0,this.username=e?e.toString("utf8"):"anonymous"};var AnonymousClient=function(e){this.username=e?e:"anonymous"};AnonymousClient.prototype.start=function(){var e=new Buffer(1+this.username.length);return e.writeUInt8(0,0),e.write(this.username,1),e};var ExternalServer=function(){this.outcome=void 0,this.username=void 0};ExternalServer.prototype.start=function(e){this.outcome=!0};var ExternalClient=function(){this.username=void 0};ExternalClient.prototype.start=function(){return null};var SaslServer=function(e,t){this.connection=e,this.transport=new Transport(e.amqp_transport.identifier,SASL_PROTOCOL_ID,frames.TYPE_SASL,this),this.next=e.amqp_transport,this.mechanisms=t,this.mechanism=void 0,this.outcome=void 0,this.username=void 0;var s=Object.getOwnPropertyNames(t);this.transpor
 t.encode(frames.sasl_frame(frames.sasl_mechanisms({sasl_server_mechanisms:s}).described()))};SaslServer.prototype.do_step=function(e){void 0===this.mechanism.outcome?this.transport.encode(frames.sasl_frame(frames.sasl_challenge({challenge:e}).described())):(this.outcome=this.mechanism.outcome?sasl_codes.OK:sasl_codes.AUTH,this.transport.encode(frames.sasl_frame(frames.sasl_outcome({code:this.outcome}).described())),this.outcome===sasl_codes.OK&&(this.username=this.mechanism.username,this.transport.write_complete=!0,this.transport.read_complete=!0))},SaslServer.prototype.on_sasl_init=function(e){var t=this.mechanisms[e.performative.mechanism];if(t){this.mechanism=t();var s=this.mechanism.start(e.performative.initial_response);this.do_step(s)}else this.outcome=sasl_codes.AUTH,this.transport.encode(frames.sasl_frame(frames.sasl_outcome({code:this.outcome}).described()))},SaslServer.prototype.on_sasl_response=function(e){this.do_step(this.mechanism.step(e.performative.response))},SaslSe
 rver.prototype.has_writes_pending=function(){return this.transport.has_writes_pending()||this.next.has_writes_pending()},SaslServer.prototype.write=function(e){return this.transport.write_complete&&0===this.transport.pending.length?this.next.write(e):this.transport.write(e)},SaslServer.prototype.read=function(e){return this.transport.read_complete?this.next.read(e):this.transport.read(e)};var SaslClient=function(e,t){this.connection=e,this.transport=new Transport(e.amqp_transport.identifier,SASL_PROTOCOL_ID,frames.TYPE_SASL,this),this.next=e.amqp_transport,this.mechanisms=t,this.mechanism=void 0,this.mechanism_name=void 0,this.failed=!1};SaslClient.prototype.on_sasl_mechanisms=function(e){for(var t=0;void 0===this.mechanism&&t<e.performative.sasl_server_mechanisms.length;t++){var s=e.performative.sasl_server_mechanisms[t],n=this.mechanisms[s];n&&(this.mechanism=n(),this.mechanism_name=s)}if(this.mechanism){var r=this.mechanism.start();this.transport.encode(frames.sasl_frame(frames.s
 asl_init({mechanism:this.mechanism_name,initial_response:r}).described()))}else this.failed=!0,this.connection.sasl_failed("No suitable mechanism; server supports "+e.performative.sasl_server_mechanisms)},SaslClient.prototype.on_sasl_challenge=function(e){var t=this.mechanism.step(e.performative.challenge);this.transport.encode(frames.sasl_frame(frames.sasl_response({response:t}).described()))},SaslClient.prototype.on_sasl_outcome=function(e){switch(e.performative.code){case sasl_codes.OK:this.transport.read_complete=!0,this.transport.write_complete=!0;break;default:this.transport.write_complete=!0,this.connection.sasl_failed("Failed to authenticate: "+e.performative.code)}},SaslClient.prototype.has_writes_pending=function(){return this.transport.has_writes_pending()||this.next.has_writes_pending()},SaslClient.prototype.write=function(e){return this.transport.write_complete?this.next.write(e):this.transport.write(e)},SaslClient.prototype.read=function(e){return this.transport.read_c
 omplete?this.next.read(e):this.transport.read(e)};var default_server_mechanisms={enable_anonymous:function(){this.ANONYMOUS=function(){return new AnonymousServer}},enable_plain:function(e){this.PLAIN=function(){return new PlainServer(e)}}},default_client_mechanisms={enable_anonymous:function(e){this.ANONYMOUS=function(){return new AnonymousClient(e)}},enable_plain:function(e,t){this.PLAIN=function(){return new PlainClient(e,t)}},enable_external:function(){this.EXTERNAL=function(){return new ExternalClient}}};module.exports={Client:SaslClient,Server:SaslServer,server_mechanisms:function(){return Object.create(default_server_mechanisms)},client_mechanisms:function(){return Object.create(default_client_mechanisms)},server_add_external:function(e){return e.EXTERNAL=function(){return new ExternalServer},e}};
+}).call(this,require("buffer").Buffer)
+
+},{"./frames.js":3,"./log.js":5,"./transport.js":11,"buffer":19}],9:[function(require,module,exports){
+(function (Buffer){
+"use strict";function attach(e,t,i){var o=t?t:{};"string"==typeof t&&(o={},o[i]=t),o.name||(o.name=util.generate_uuid());var n=e(o.name,o);for(var s in{source:0,target:0})o[s]&&("string"==typeof o[s]&&(o[s]={address:o[s]}),n["set_"+s](o[s]));return n.attach(),n}var frames=require("./frames.js"),link=require("./link.js"),log=require("./log.js"),message=require("./message.js"),types=require("./types.js"),util=require("./util.js"),EndpointState=require("./endpoint.js"),EventEmitter=require("events").EventEmitter,CircularBuffer=function(e){this.capacity=e,this.size=0,this.head=0,this.tail=0,this.entries=[]};CircularBuffer.prototype.available=function(){return this.capacity-this.size},CircularBuffer.prototype.push=function(e){if(!(this.size<this.capacity))throw Error("circular buffer overflow: head="+this.head+" tail="+this.tail+" size="+this.size+" capacity="+this.capacity);this.entries[this.tail]=e,this.tail=(this.tail+1)%this.capacity,this.size++},CircularBuffer.prototype.pop_if=funct
 ion(e){for(var t=0;this.size&&e(this.entries[this.head]);)this.entries[this.head]=void 0,this.head=(this.head+1)%this.capacity,this.size--,t++;return t},CircularBuffer.prototype.by_id=function(e){if(this.size>0){var t=e-this.entries[this.head].id;if(t<this.size)return this.entries[(this.head+t)%this.capacity]}},CircularBuffer.prototype.get_head=function(e){return this.size>0?this.entries[this.head]:void 0};var Outgoing=function(){this.deliveries=new CircularBuffer(2048),this.updated=[],this.next_delivery_id=0,this.next_pending_delivery=0,this.next_transfer_id=0,this.window=types.MAX_UINT,this.remote_next_transfer_id=void 0,this.remote_window=void 0};Outgoing.prototype.available=function(){return this.deliveries.available()},Outgoing.prototype.send=function(e,t,i,o){var n={id:this.next_delivery_id++,tag:t,link:e,data:i,format:o?o:0,sent:!1,settled:!1,state:void 0,remote_settled:!1,remote_state:void 0};return this.deliveries.push(n),n},Outgoing.prototype.on_begin=function(e){this.remo
 te_window=e.incoming_window},Outgoing.prototype.on_flow=function(e){this.remote_next_transfer_id=e.next_incoming_id,this.remote_window=e.incoming_window},Outgoing.prototype.on_disposition=function(e){for(var t=e.last?e.last:e.first,i=e.first;t>=i;i++){var o=this.deliveries.by_id(i);if(o||console.log("Could not find delivery for "+i+" ["+JSON.stringify(e)+"]"),o&&!o.remote_settled){var n=!1;e.settled&&(o.remote_settled=e.settled,n=!0),e.state&&e.state!==o.remote_state&&(o.remote_state=e.state,n=!0),n&&this.updated.push(o)}}},Outgoing.prototype.transfer_window=function(){return this.remote_window?this.remote_window-(this.next_transfer_id-this.remote_next_transfer_id):void 0},Outgoing.prototype.process=function(){for(;this.next_pending_delivery<this.next_delivery_id;){var e=this.deliveries.by_id(this.next_pending_delivery);if(!e){console.log("ERROR: Next pending delivery not found: "+this.next_pending_delivery);break}if(!e.link.has_credit()){log.flow("Link has no credit");break}if(e.li
 nk.delivery_count++,e.transfers_required=1,!(this.transfer_window()>=e.transfers_required)){log.flow("Incoming window of peer preventing sending further transfers: remote_window="+this.remote_window+", remote_next_transfer_id="+this.remote_next_transfer_id+", next_transfer_id="+this.next_transfer_id);break}this.next_transfer_id+=e.transfers_required,this.window-=e.transfers_required,e.link.session.output(frames.transfer({handle:e.link.local.handle,message_format:e.format,delivery_id:e.id,delivery_tag:e.tag}).described(),e.data),e.link.credit--,this.next_pending_delivery++}for(var t=0;t<this.updated.length;t++){var e=this.updated[t];e.remote_state&&(e.remote_state=message.unwrap_outcome(e.remote_state),e.remote_state&&e.remote_state.constructor.composite_type&&e.link.dispatch(e.remote_state.constructor.composite_type,e.link._context({delivery:e}))),e.remote_settled&&e.link.dispatch("settled",e.link._context({delivery:e}))}this.updated=[],this.deliveries.pop_if(function(e){return e.se
 ttled&&e.remote_settled})};var Incoming=function(){this.deliveries=new CircularBuffer(2048),this.updated=[],this.next_transfer_id=0,this.next_delivery_id=void 0,this.window=2048,this.remote_next_transfer_id=void 0,this.remote_window=void 0};Incoming.prototype.update=function(e,t,i){e&&(e.settled=t,void 0!==i&&(e.state=i),e.remote_settled||this.updated.push(e),e.link.connection._register())},Incoming.prototype.on_transfer=function(e,t){if(this.next_transfer_id++,t.is_open()){void 0===this.next_delivery_id&&(this.next_delivery_id=e.performative.delivery_id);var i,o,n=this.deliveries.get_head();if(n&&n.incomplete){if(void 0!==e.performative.delivery_id&&this.next_delivery_id!=e.performative.delivery_id)throw Error("frame sequence error: delivery "+this.next_delivery_id+" not complete, got "+e.performative.delivery_id);i=n,o=Buffer.concat([i.data,e.payload],i.data.size()+e.payload.size())}else{if(this.next_delivery_id!==e.performative.delivery_id)throw Error("frame sequence error: expec
 ted "+this.next_delivery_id+", got "+e.performative.delivery_id);i={id:e.performative.delivery_id,tag:e.performative.delivery_tag,link:t,settled:!1,state:void 0,remote_settled:e.performative.settled,remote_state:void 0};var s=this;i.update=function(e,t){s.update(i,e,t)},this.deliveries.push(i),o=e.payload}i.incomplete=e.performative.more,i.incomplete?i.data=o:(t.credit--,t.delivery_count++,this.next_delivery_id++,t.dispatch("message",t._context({message:message.decode(o),delivery:i})))}},Incoming.prototype.process=function(){if(this.updated.length>0){for(var e,t,i,o=0;o<this.updated.length;o++){var n=this.updated[o];void 0===e&&(e=n,t=n,i=n.id),message.are_outcomes_equivalent(t.state,n.state)&&t.settled===n.settled&&i===n.id?(t.id!==n.id&&(t=n),i++):(e.link.session.output(frames.disposition({role:!0,first:e.id,last:t.id,state:e.state,settled:e.settled}).described()),e=n,t=n,i=n.id)}void 0!==e&&void 0!==t&&e.link.session.output(frames.disposition({role:!0,first:e.id,last:t.id,state:e
 .state,settled:e.settled}).described()),this.updated=[]}this.deliveries.pop_if(function(e){return e.settled})},Incoming.prototype.on_begin=function(e){this.remote_window=e.outgoing_window},Incoming.prototype.on_flow=function(e){this.remote_next_transfer_id=e.next_outgoing_id,this.remote_window=e.outgoing_window},Incoming.prototype.on_disposition=function(e){for(var t=e.last?e.last:e.first,i=e.first;t>=i;i++){var o=this.deliveries.by_id(i);if(o||console.log("Could not find delivery for "+i),o&&!o.remote_settled){var n=!1;e.settled&&(o.remote_settled=e.settled,n=!0),e.state&&e.state!==o.remote_state&&(o.remote_state=e.state,n=!0),n&&(console.log(o.link.connection.options.id+" added delivery to updated list following receipt of disposition for incoming deliveries"),this.updated.push(o))}}};var Session=function(e,t){this.connection=e,this.outgoing=new Outgoing,this.incoming=new Incoming,this.state=new EndpointState,this.local={channel:t,handles:{}},this.local.begin=frames.begin({next_ou
 tgoing_id:this.outgoing.next_transfer_id,incoming_window:this.incoming.window,outgoing_window:this.outgoing.window}),this.local.end=frames.end(),this.remote={handles:{}},this.links={},this.options={}};Session.prototype=Object.create(EventEmitter.prototype),Session.prototype.constructor=Session,Session.prototype.reset=function(){this.state.disconnected(),this.outgoing=new Outgoing,this.incoming=new Incoming,this.remote={handles:{}};for(var e in this.links)this.links[e].reset()},Session.prototype.dispatch=function(e,t){log.events("Session got event: "+e),this.listeners(e).length?EventEmitter.prototype.emit.apply(this,arguments):this.connection.dispatch.apply(this.connection,arguments)},Session.prototype.output=function(e,t){this.connection._write_frame(this.local.channel,e,t)},Session.prototype.create_sender=function(e,t){return this.create_link(e,link.Sender,t)},Session.prototype.create_receiver=function(e,t){return this.create_link(e,link.Receiver,t)},Session.prototype.get_option=fu
 nction(e,t){return void 0!==this.options[e]?this.options[e]:this.connection.get_option(e,t)},Session.prototype.attach_sender=function(e){return attach(this.create_sender.bind(this),e,"target")},Session.prototype.open_sender=Session.prototype.attach_sender,Session.prototype.attach_receiver=function(e){return attach(this.create_receiver.bind(this),e,"source")},Session.prototype.open_receiver=Session.prototype.attach_receiver,Session.prototype.create_link=function(e,t,i){for(var o=0;this.local.handles[o];)o++;var n=new t(this,e,o,i);return this.links[e]=n,this.local.handles[o]=n,n},Session.prototype.begin=function(){this.state.open()&&this.connection._register()},Session.prototype.open=Session.prototype.begin,Session.prototype.end=function(){this.state.close()&&this.connection._register()},Session.prototype.close=Session.prototype.end,Session.prototype.is_open=function(){return this.connection.is_open()&&this.state.is_open()},Session.prototype.is_closed=function(){return this.connectio
 n.is_closed()||this.state.is_closed()},Session.prototype._process=function(){do{this.state.need_open()&&this.output(this.local.begin.described()),this.outgoing.process(),this.incoming.process();for(var e in this.links)this.links[e]._process();this.state.need_close()&&this.output(this.local.end.described())}while(!this.state.has_settled())},Session.prototype.send=function(e,t,i,o){var n=this.outgoing.send(e,t,i,o);return this.connection._register(),n},Session.prototype._write_flow=function(e){var t={next_incoming_id:this.incoming.next_transfer_id,incoming_window:this.incoming.window,next_outgoing_id:this.outgoing.next_transfer_id,outgoing_window:this.outgoing.window};e&&(t.delivery_count=e.delivery_count,t.handle=e.local.handle,t.link_credit=e.credit),this.output(frames.flow(t).described())},Session.prototype.on_begin=function(e){if(!this.state.remote_opened())throw Error("Begin already received");this.remote.channel||(this.remote.channel=e.channel),this.remote.begin=e.performative,t
 his.outgoing.on_begin(e.performative),this.incoming.on_begin(e.performative),this.open(),this.dispatch("session_open",this._context())},Session.prototype.on_end=function(e){if(!this.state.remote_closed())throw Error("End already received");this.remote.end=e.performative,this.close(),this.dispatch("session_close",this._context())},Session.prototype.on_attach=function(e){var t=e.performative.name,i=this.links[t];i||(i=e.performative.role?this.create_sender(t):this.create_receiver(t)),this.remote.handles[e.performative.handle]=i,i.on_attach(e),i.remote.attach=e.performative},Session.prototype.on_disposition=function(e){e.performative.role?(log.events("Received disposition for outgoing transfers"),this.outgoing.on_disposition(e.performative)):(log.events("Received disposition for incoming transfers"),this.incoming.on_disposition(e.performative)),this.connection._register()},Session.prototype.on_flow=function(e){this.outgoing.on_flow(e.performative),this.incoming.on_flow(e.performative),
 void 0!==e.performative.handle&&this._get_link(e).on_flow(e),this.connection._register()},Session.prototype._context=function(e){var t=e?e:{};return t.session=this,this.connection._context(t)},Session.prototype._get_link=function(e){var t=e.performative.handle,i=this.remote.handles[t];if(!i)throw Error("Invalid handle "+t);return i},Session.prototype.on_detach=function(e){this._get_link(e).on_detach(e);var t=e.performative.handle,i=this.remote.handles[t];delete this.remote.handles[t],delete this.local.handles[i.local.handle],delete this.links[i.name]},Session.prototype.on_transfer=function(e){this.incoming.on_transfer(e,this._get_link(e))},module.exports=Session;
+}).call(this,require("buffer").Buffer)
+
+},{"./endpoint.js":2,"./frames.js":3,"./link.js":4,"./log.js":5,"./message.js":6,"./types.js":12,"./util.js":13,"buffer":19,"events":23}],10:[function(require,module,exports){
+"use strict";function define_terminus(e){var t=types.define_composite(e);terminus[e.name]=t.create,by_descriptor[Number(t.descriptor.numeric).toString(10)]=t,by_descriptor[t.descriptor.symbolic]=t}var types=require("./types.js"),terminus={},by_descriptor={};terminus.unwrap=function(e){if(e&&e.descriptor){var t=by_descriptor[e.descriptor.value];if(t)return new t(e.value);console.log("Unknown terminus: "+e.descriptor)}return null},define_terminus({name:"source",code:40,fields:[{name:"address",type:"string"},{name:"durable",type:"uint",default_value:0},{name:"expiry_policy",type:"symbol",default_value:"session-end"},{name:"timeout",type:"uint",default_value:0},{name:"dynamic",type:"boolean",default_value:!1},{name:"dynamic_node_properties",type:"symbolic_map"},{name:"distribution_mode",type:"symbol"},{name:"filter",type:"symbolic_map"},{name:"default_outcome",type:"*"},{name:"outcomes",type:"symbol",multiple:!0},{name:"capabilities",type:"symbol",multiple:!0}]}),define_terminus({name:"
 target",code:41,fields:[{name:"address",type:"string"},{name:"durable",type:"uint",default_value:0},{name:"expiry_policy",type:"symbol",default_value:"session-end"},{name:"timeout",type:"uint",default_value:0},{name:"dynamic",type:"boolean",default_value:!1},{name:"dynamic_node_properties",type:"symbolic_map"},{name:"capabilities",type:"symbol",multiple:!0}]}),module.exports=terminus;
+},{"./types.js":12}],11:[function(require,module,exports){
+(function (Buffer){
+"use strict";var frames=require("./frames.js"),log=require("./log.js"),Transport=function(e,i,r,t){this.identifier=e,this.protocol_id=i,this.frame_type=r,this.handler=t,this.pending=[],this.header_sent=void 0,this.header_received=void 0,this.write_complete=!1,this.read_complete=!1};Transport.prototype.has_writes_pending=function(){return this.pending.length>0},Transport.prototype.encode=function(e){var i=frames.write_frame(e);log.frames("["+this.identifier+"] PENDING: "+JSON.stringify(e)),this.pending.push(i)},Transport.prototype.write=function(e){if(!this.header_sent){var i=new Buffer(8),r={protocol_id:this.protocol_id,major:1,minor:0,revision:0};frames.write_header(i,r),e.write(i),this.header_sent=r}for(var t=0;t<this.pending.length;t++)e.write(this.pending[t]),log.raw("["+this.identifier+"] SENT: "+JSON.stringify(this.pending[t]));this.pending=[]},Transport.prototype.read=function(e){var i=0;if(!this.header_received){if(e.length<8)return i;if(this.header_received=frames.read_head
 er(e),log.frames("["+this.identifier+"] RECV: "+JSON.stringify(this.header_received)),this.header_received.protocol_id!==this.protocol_id)throw Error("Invalid AMQP protocol id "+this.header_received.protocol_id+" expecting: "+this.protocol_id);i=8}for(;i<e.length&&!this.read_complete;){var r=e.readUInt32BE(i);if(log.io("["+this.identifier+"] got frame of size "+r),e.length<i+r){log.io("["+this.identifier+"] incomplete frame; have only "+(e.length-i)+" of "+r);break}var t=frames.read_frame(e.slice(i,i+r));if(log.frames("["+this.identifier+"] RECV: "+JSON.stringify(t)),t.type!==this.frame_type)throw Error("Invalid frame type: "+t.type);i+=r,t.performative&&t.performative.dispatch(this.handler,t)}return i},module.exports=Transport;
+}).call(this,require("buffer").Buffer)
+
+},{"./frames.js":3,"./log.js":5,"buffer":19}],12:[function(require,module,exports){
+(function (Buffer){
+"use strict";function Typed(t,e){this.type=t,this.value=e}function hex(t){return Number(t).toString(16)}function define_type(t,e,r,i){var n,o=e>>>4;switch(n=4===o?function(){this.type=n,this.value=i}:14===o||15===o?function(t,e,r){this.type=n,this.value=t,this.array_constructor={typecode:e},r&&(this.array_constructor.descriptor=r)}:function(t){this.type=n,this.value=t},n.typecode=e,n.prototype=Object.create(Typed.prototype),n.toString=function(){return t+"#"+hex(e)},o){case 4:n.width=0,n.category="fixed";break;case 5:n.width=1,n.category="fixed";break;case 6:n.width=2,n.category="fixed";break;case 7:n.width=4,n.category="fixed";break;case 8:n.width=8,n.category="fixed";break;case 9:n.width=16,n.category="fixed";break;case 10:n.width=1,n.category="variable";break;case 11:n.width=4,n.category="variable";break;case 12:n.width=1,n.category="compound";break;case 13:n.width=4,n.category="compound";break;case 14:n.width=1,n.category="array";break;case 15:n.width=4,n.category="array"}if(r)f
 or(var s in r)n[s]=r[s];return types.by_code[n.typecode]=n,types[t]=n,n}function buffer_ops(t){return{read:function(e,r){return e["read"+t](r)},write:function(e,r,i){e["write"+t](r,i)}}}function write_ulong(t,e,r){if("number"==typeof e||e instanceof Number){var i=e/MAX_UINT,n=e%MAX_UINT;t.writeUInt32BE(i,r),t.writeUInt32BE(n,r+4)}else e.copy(t,r)}function read_ulong(t,e){var r=t.readUInt32BE(e),i=t.readUInt32BE(e+4);return 2097153>r?r*MAX_UINT+i:t.slice(e,e+8)}function write_long(t,e,r){if("number"==typeof e||e instanceof Number){var i=Math.abs(e),n=i/MAX_UINT,o=i%MAX_UINT;if(t.writeInt32BE(n,r),t.writeUInt32BE(o,r+4),0>e)for(var s=1,p=0;8>p;p++){var a=r+(7-p),e=(255^t[a])+s;t[a]=255&e,s=e>>8}}else e.copy(t,r)}function read_long(t,e){var r=t.readInt32BE(e),i=t.readUInt32BE(e+4);return 2097153>r&&r>-2097153?r*MAX_UINT+i:t.slice(e,e+8)}function is_one_of(t,e){for(var r=0;r<e.length;r++)if(t.type.typecode===e[r].typecode)return!0;return!1}function mapify(t){for(var e={},r=0;r+1<t.lengt
 h;)e[t[r++]]=t[r++];return e}function get_type(t){var e=types.by_code[t];if(!e)throw Error("Unrecognised typecode: "+hex(t));return e}function max(t,e){return t>e?t:e}function get_constructor(t){if("symbol"===t)return{typecode:types.Sym8.typecode};throw Error("TODO: Array of type "+t+" not yet supported")}function wrap_field(t,e){if(void 0!==e&&null!==e){if(Array.isArray(e)){if(!t.multiple)throw Error("Field "+t.name+" does not support multiple values, got "+JSON.stringify(e));var r=get_constructor(t.type);return types.wrap_array(e,r.typecode,r.descriptor)}if("*"===t.type)return e;var i=types["wrap_"+t.type];if(i)return i(e);throw Error("No wrapper for field "+t.name+" of type "+t.type)}if(t.mandatory)throw Error("Field "+t.name+" is mandatory");return new types.Null}function get_accessors(t,e){var r=function(){return"*"===e.type?this.value[t]:types.unwrap(this.value[t])},i=function(r){this.value[t]=wrap_field(e,r)};return{get:r,set:i,enumerable:!0,configurable:!1}}function add_type
 (t){var e=types.define_composite(t);types["wrap_"+t.name]=function(t){return e.create(t).described()},by_descriptor[Number(e.descriptor.numeric).toString(10)]=e,by_descriptor[e.descriptor.symbolic]=e}Typed.prototype.toString=function(){return this.value?this.value.toString():null},Typed.prototype.toLocaleString=function(){return this.value?this.value.toLocaleString():null},Typed.prototype.valueOf=function(){return this.value},Typed.prototype.toJSON=function(){return this.value&&this.value.toJSON?this.value.toJSON():this.value};var types={by_code:{}};Object.defineProperty(types,"MAX_UINT",{value:4294967295,writable:!1,configurable:!1}),Object.defineProperty(types,"MAX_USHORT",{value:65535,writable:!1,configurable:!1});var MAX_UINT=4294967296;define_type("Null",64,void 0,null),define_type("Boolean",86,buffer_ops("UInt8")),define_type("True",65,void 0,!0),define_type("False",66,void 0,!1),define_type("Ubyte",80,buffer_ops("UInt8")),define_type("Ushort",96,buffer_ops("UInt16BE")),define
 _type("Uint",112,buffer_ops("UInt32BE")),define_type("SmallUint",82,buffer_ops("UInt8")),define_type("Uint0",67,void 0,0),define_type("Ulong",128,{write:write_ulong,read:read_ulong}),define_type("SmallUlong",83,buffer_ops("UInt8")),define_type("Ulong0",68,void 0,0),define_type("Byte",81,buffer_ops("Int8")),define_type("Short",97,buffer_ops("Int16BE")),define_type("Int",113,buffer_ops("Int32BE")),define_type("SmallInt",84,buffer_ops("Int8")),define_type("Long",129,{write:write_long,read:read_long}),define_type("SmallLong",85,buffer_ops("Int8")),define_type("Float",114,buffer_ops("Float")),define_type("Double",130,buffer_ops("Double")),define_type("Decimal32",116),define_type("Decimal64",132),define_type("Decimal128",148),define_type("CharUTF32",115),define_type("Timestamp",131),define_type("Uuid",152),define_type("Vbin8",160),define_type("Vbin32",176),define_type("Str8",161,{encoding:"utf8"}),define_type("Str32",177,{encoding:"utf8"}),define_type("Sym8",163,{encoding:"ascii"}),define
 _type("Sym32",179,{encoding:"ascii"}),define_type("List0",69,void 0,[]),define_type("List8",192),define_type("List32",208),define_type("Map8",193),define_type("Map32",209),define_type("Array8",224),define_type("Array32",240),types.is_ulong=function(t){return is_one_of(t,[types.Ulong,types.Ulong0,types.SmallUlong])},types.is_string=function(t){return is_one_of(t,[types.Str8,types.Str32])},types.is_symbol=function(t){return is_one_of(t,[types.Sym8,types.Sym32])},types.is_list=function(t){return is_one_of(t,[types.List0,types.List8,types.List32])},types.is_map=function(t){return is_one_of(t,[types.Map8,types.Map32])},types.wrap_boolean=function(t){return new types.Boolean(t)},types.wrap_ulong=function(t){return 0===t?new types.Ulong0:t>255?new types.Ulong(t):new types.SmallUlong(t)},types.wrap_uint=function(t){return 0===t?new types.Uint0:t>255?new types.Uint(t):new types.SmallUint(t)},types.wrap_ushort=function(t){return new types.Ushort(t)},types.wrap_ubyte=function(t){return new typ
 es.Ubyte(t)},types.wrap_long=function(t){return t>127||-128>t?new types.Long(t):new types.SmallLong(t)},types.wrap_int=function(t){return t>127||-128>t?new types.Int(t):new types.SmallInt(t)},types.wrap_short=function(t){return new types.Short(t)},types.wrap_byte=function(t){return new types.Byte(t)},types.wrap_float=function(t){return new types.Float(t)},types.wrap_double=function(t){return new types.Double(t)},types.wrap_timestamp=function(t){return new types.Timestamp(t)},types.wrap_binary=function(t){return t.length>255?new types.Vbin32(t):new types.Vbin8(t)},types.wrap_string=function(t){return t.length>255?new types.Str32(t):new types.Str8(t)},types.wrap_symbol=function(t){return t.length>255?new types.Sym32(t):new types.Sym8(t)},types.wrap_list=function(t){if(0===t.length)return new types.List0;var e=t.map(types.wrap);return new types.List32(e)},types.wrap_map=function(t,e){var r=[];for(var i in t)r.push(e?e(i):types.wrap(i)),r.push(types.wrap(t[i]));return new types.Map32(r)
 },types.wrap_symbolic_map=function(t){return types.wrap_map(t,types.wrap_symbol)},types.wrap_array=function(t,e,r){if(e)return new types.Array32(t,e,r);throw Error("An array must specify a type for its elements")},types.wrap=function(t){var e=typeof t;if("string"===e)return types.wrap_string(t);if("boolean"==e)return t?new types.True:new types.False;if("number"==e||t instanceof Number){if(isNaN(t))throw Error("Cannot wrap NaN! "+t);return Math.floor(t)-t!==0?new types.Double(t):t>0?types.wrap_uint(t):types.wrap_int(t)}return t instanceof Date?void 0:t instanceof Typed?t:"undefined"==e||null===t?new types.Null:Array.isArray(t)?types.wrap_list(t):types.wrap_map(t)},types.wrap_described=function(t,e){var r=types.wrap(t);return e&&("string"==typeof e?r=types.described(types.wrap_string(e),r):("number"==typeof e||e instanceof Number)&&(r=types.described(types.wrap_ulong(e),r))),r},types.wrap_message_id=function(t){var e=typeof t;if("string"===e)return types.wrap_string(t);if("number"==e|
 |t instanceof Number)return types.wrap_ulong(t);throw Error("invalid message id:"+t)},types.wrap_delivery_state=function(t){return new Null};var by_descriptor={};types.unwrap=function(t,e){if(t instanceof Typed){if(t.descriptor){var r=by_descriptor[t.descriptor.value];if(r)return new r(t.value);if(e)return t}var i=types.unwrap(t.value,!0);return types.is_map(t)?mapify(i):i}return Array.isArray(t)?t.map(function(t){return types.unwrap(t,!0)}):t},types.described=function(t,e){var r=Object.create(e);return t.length?(r.descriptor=t.shift(),described(t,r)):(r.descriptor=t,r)},types.Reader=function(t){this.buffer=t,this.position=0},types.Reader.prototype.read_typecode=function(){return this.read_uint(1)},types.Reader.prototype.read_uint=function(t){var e=this.position;this.position+=t;var r=t>1?"readUInt"+8*t+"BE":"readUInt8";return this.buffer[r](e)},types.Reader.prototype.read_fixed_width=function(t){var e=this.position;return this.position+=t.width,t.read?t.read(this.buffer,e):this.buf
 fer.slice(e,this.position)},types.Reader.prototype.read_variable_width=function(t){var e=this.read_uint(t.width),r=this.read_bytes(e);return t.encoding?r.toString(t.encoding):r},types.Reader.prototype.read=function(){var t=this.read_constructor(),e=this.read_value(get_type(t.typecode));return t.descriptor?types.described(t.descriptor,e):e},types.Reader.prototype.read_constructor=function(){var t=this.read_typecode();if(0===t){var e=[];e.push(this.read());for(var r=this.read_constructor();r.descriptor;)e.push(r.descriptor),r=this.read_constructor();return{typecode:r.typecode,descriptor:1==e.length?e[0]:e}}return{typecode:t}},types.Reader.prototype.read_value=function(t){if(0===t.width)return new t;if("fixed"===t.category)return new t(this.read_fixed_width(t));if("variable"===t.category)return new t(this.read_variable_width(t));if("compound"===t.category)return this.read_compound(t);if("array"===t.category)return this.read_array(t);throw Error("Invalid category for type: "+t)},types.R
 eader.prototype.read_multiple=function(t,e){for(var r=e?e:this.read.bind(this),i=[];i.length<t;)i.push(r.apply(this));return i},types.Reader.prototype.read_size_count=function(t){return{size:this.read_uint(t),count:this.read_uint(t)}},types.Reader.prototype.read_compound=function(t){var e=this.read_size_count(t.width);return new t(this.read_multiple(e.count))},types.Reader.prototype.read_array=function(t){var e=this.read_size_count(t.width),r=this.read_constructor(),i=new t(this.read_multiple(e.count,this.read_value.bind(this,get_type(r.typecode))),r.typecode,r.descriptor);return i},types.Reader.prototype.toString=function(){var t="buffer@"+this.position;this.position&&(t+=": ");for(var e=this.position;e<this.buffer.length;e++)e>0&&(t+=","),t+="0x"+Number(this.buffer[e]).toString(16);return t},types.Reader.prototype.reset=function(){this.position=0},types.Reader.prototype.skip=function(t){this.position+=t},types.Reader.prototype.read_bytes=function(t){var e=this.position;return this
 .position+=t,this.buffer.slice(e,this.position)},types.Reader.prototype.remaining=function(){return this.buffer.length-this.position},types.Writer=function(t){this.buffer=t?t:new Buffer(1024),this.position=0},types.Writer.prototype.toBuffer=function(){return this.buffer.slice(0,this.position)},types.Writer.prototype.ensure=function(t){if(this.buffer.length<t){var e=new Buffer(max(2*this.buffer.length,t));this.buffer.copy(e),this.buffer=e}},types.Writer.prototype.write_typecode=function(t){this.write_uint(t,1)},types.Writer.prototype.write_uint=function(t,e){var r=this.position;this.ensure(this.position+e),this.position+=e;var i=e>1?"writeUInt"+8*e+"BE":"writeUInt8";if(!this.buffer[i])throw Error("Buffer doesn't define "+i);return this.buffer[i](t,r)},types.Writer.prototype.write_fixed_width=function(t,e){var r=this.position;if(this.ensure(this.position+t.width),this.position+=t.width,t.write)t.write(this.buffer,e,r);else{if(!e.copy)throw Error("Can't handle write for "+t);e.copy(thi
 s.buffer,r)}},types.Writer.prototype.write_variable_width=function(t,e){var r=t.encoding?new Buffer(e,t.encoding):new Buffer(e);this.write_uint(r.length,t.width),this.write_bytes(r)},types.Writer.prototype.write_bytes=function(t){var e=this.position;this.ensure(this.position+t.length),this.position+=t.length,t.copy(this.buffer,e)},types.Writer.prototype.write_constructor=function(t,e){e&&(this.write_typecode(0),this.write(e)),this.write_typecode(t)},types.Writer.prototype.write=function(t){if(!(t instanceof Typed))throw Error("Can't write "+JSON.stringify(t));this.write_constructor(t.type.typecode,t.descriptor),this.write_value(t.type,t.value,t.array_constructor)},types.Writer.prototype.write_value=function(t,e,r){if(0!==t.width)if("fixed"===t.category)this.write_fixed_width(t,e);else if("variable"===t.category)this.write_variable_width(t,e);else if("compound"===t.category)this.write_compound(t,e);else{if("array"!==t.category)throw Error("Invalid category "+t.category+" for type: "+
 t);this.write_array(t,e,r)}},types.Writer.prototype.backfill_size=function(t,e){var r=this.position-e;this.position=e,this.write_uint(r-t,t),this.position+=r-t},types.Writer.prototype.write_compound=function(t,e){var r=this.position;this.position+=t.width,this.write_uint(e.length,t.width);for(var i=0;i<e.length;i++)void 0===e[i]||null===e[i]?this.write(new types.Null):this.write(e[i]);this.backfill_size(t.width,r)},types.Writer.prototype.write_array=function(t,e,r){var i=this.position;this.position+=t.width,this.write_uint(e.length,t.width),this.write_constructor(r.typecode,r.descriptor);for(var t=get_type(r.typecode),n=0;n<e.length;n++)this.write_value(t,e[n]);this.backfill_size(t.width,i)},types.Writer.prototype.toString=function(){var t="buffer@"+this.position;this.position&&(t+=": ");for(var e=0;e<this.position;e++)e>0&&(t+=","),t+=("00"+Number(this.buffer[e]).toString(16)).slice(-2);return t},types.Writer.prototype.skip=function(t){this.ensure(this.position+t),this.position+=t}
 ,types.Writer.prototype.clear=function(){this.buffer.fill(0),this.position=0},types.Writer.prototype.remaining=function(){return this.buffer.length-this.position},types.define_composite=function(t){var e=function(t){this.value=t?t:[]};e.descriptor={numeric:t.code,symbolic:"amqp:"+t.name+":list"},e.prototype.dispatch=function(e,r){e["on_"+t.name](r)};for(var r=0;r<t.fields.length;r++){var i=t.fields[r];Object.defineProperty(e.prototype,i.name,get_accessors(r,i))}return e.toString=function(){return t.name+"#"+Number(t.code).toString(16)},e.prototype.toJSON=function(){var t={};for(var e in this)"value"!==e&&this[e]&&(t[e]=this[e]);return t},e.create=function(t){var r=new e;for(var i in t)r[i]=t[i];return r},e.prototype.described=function(t){return types.described(types.wrap_ulong(e.descriptor.numeric),types.wrap_list(this.value))},e},add_type({name:"error",code:29,fields:[{name:"condition",type:"symbol",mandatory:!0},{name:"description",type:"string"},{name:"info",type:"map"}]}),module
 .exports=types;
+}).call(this,require("buffer").Buffer)
+
+},{"buffer":19}],13:[function(require,module,exports){
+"use strict";var util={};util.generate_uuid=function(){var x="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(x){var t=16*Math.random()|0,r="x"==x?t:3&t|8;return r.toString(16)});return x},util.clone=function(x){for(var t=Object.create(x.prototype||{}),r=Object.getOwnPropertyNames(x),e=0;e<r.length;e++){var n=r[e];t[n]=x[n]}return t},module.exports=util;
+},{}],14:[function(require,module,exports){
+(function (Buffer){
+"use strict";function nulltransform(n){return n}function from_arraybuffer(n){return n instanceof ArrayBuffer?new Buffer(new Uint8Array(n)):new Buffer(n)}function to_typedarray(n){return new Uint8Array(n)}function wrap(n){var r=nulltransform,e=nulltransform;return n.binaryType&&(n.binaryType="arraybuffer",r=from_arraybuffer,e=to_typedarray),{end:function(){n.close()},write:function(r){n.send(e(r),{binary:!0})},on:function(e,t){"data"===e?n.onmessage=function(n){t(r(n.data))}:"end"===e?n.onclose=t:"error"===e?n.onerror=t:console.log("ERROR: Attempt to set unrecognised handler on websocket wrapper: "+e)},get_id_string:function(){return n.url}}}module.exports={connect:function(n){return function(r,e){return function(){return{connect:function(t,o,u,a){var f=new n(r,e);return f.onopen=a,wrap(f)}}}}},wrap:wrap};
+}).call(this,require("buffer").Buffer)
+
+},{"buffer":19}],15:[function(require,module,exports){
+function useColors(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function formatArgs(){var o=arguments,e=this.useColors;if(o[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+o[0]+(e?"%c ":" ")+"+"+exports.humanize(this.diff),!e)return o;var r="color: "+this.color;o=[o[0],r,"color: inherit"].concat(Array.prototype.slice.call(o,1));var t=0,s=0;return o[0].replace(/%[a-z%]/g,function(o){"%%"!==o&&(t++,"%c"===o&&(s=t))}),o.splice(s,0,r),o}function log(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(o){try{null==o?exports.storage.removeItem("debug"):exports.storage.debug=o}catch(e){}}function load(){var o;try{o=exports.storage.debug}catch(e){}return o}function localstorage(){try{return window.localStorage}catch(o){}}exports=module.exports=require("./deb
 ug"),exports.log=log,exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:localstorage(),exports.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],exports.formatters.j=function(o){return JSON.stringify(o)},exports.enable(load());
+},{"./debug":16}],16:[function(require,module,exports){
+function selectColor(){return exports.colors[prevColor++%exports.colors.length]}function debug(e){function r(){}function o(){var e=o,r=+new Date,s=r-(prevTime||r);e.diff=s,e.prev=prevTime,e.curr=r,prevTime=r,null==e.useColors&&(e.useColors=exports.useColors()),null==e.color&&e.useColors&&(e.color=selectColor());var t=Array.prototype.slice.call(arguments);t[0]=exports.coerce(t[0]),"string"!=typeof t[0]&&(t=["%o"].concat(t));var n=0;t[0]=t[0].replace(/%([a-z%])/g,function(r,o){if("%%"===r)return r;n++;var s=exports.formatters[o];if("function"==typeof s){var p=t[n];r=s.call(e,p),t.splice(n,1),n--}return r}),"function"==typeof exports.formatArgs&&(t=exports.formatArgs.apply(e,t));var p=o.log||exports.log||console.log.bind(console);p.apply(e,t)}r.enabled=!1,o.enabled=!0;var s=exports.enabled(e)?o:r;return s.namespace=e,s}function enable(e){exports.save(e);for(var r=(e||"").split(/[\s,]+/),o=r.length,s=0;o>s;s++)r[s]&&(e=r[s].replace(/\*/g,".*?"),"-"===e[0]?exports.skips.push(new RegExp("
 ^"+e.substr(1)+"$")):exports.names.push(new RegExp("^"+e+"$")))}function disable(){exports.enable("")}function enabled(e){var r,o;for(r=0,o=exports.skips.length;o>r;r++)if(exports.skips[r].test(e))return!1;for(r=0,o=exports.names.length;o>r;r++)if(exports.names[r].test(e))return!0;return!1}function coerce(e){return e instanceof Error?e.stack||e.message:e}exports=module.exports=debug,exports.coerce=coerce,exports.disable=disable,exports.enable=enable,exports.enabled=enabled,exports.humanize=require("ms"),exports.names=[],exports.skips=[],exports.formatters={};var prevColor=0,prevTime;
+},{"ms":17}],17:[function(require,module,exports){
+function parse(e){if(e=""+e,!(e.length>1e4)){var a=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(a){var r=parseFloat(a[1]),c=(a[2]||"ms").toLowerCase();switch(c){case"years":case"year":case"yrs":case"yr":case"y":return r*y;case"days":case"day":case"d":return r*d;case"hours":case"hour":case"hrs":case"hr":case"h":return r*h;case"minutes":case"minute":case"mins":case"min":case"m":return r*m;case"seconds":case"second":case"secs":case"sec":case"s":return r*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}}}function short(e){return e>=d?Math.round(e/d)+"d":e>=h?Math.round(e/h)+"h":e>=m?Math.round(e/m)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function long(e){return plural(e,d,"day")||plural(e,h,"hour")||plural(e,m,"minute")||plural(e,s,"second")||e+" ms"}function plural(s,e,a){return e>s?void 0:1.5*e>s?Math.floor(s/e)+" "+a:Math.ceil(s/e)+" "+a+"s"}var s=1e3,m=60*s,h=60*m,d=24*h
 ,y=365.25*d;module.exports=function(s,e){return e=e||{},"string"==typeof s?parse(s):e["long"]?long(s):short(s)};
+},{}],18:[function(require,module,exports){
+
+},{}],19:[function(require,module,exports){
+(function (global){
+"use strict";function typedArraySupport(){try{var t=new Uint8Array(1);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Buffer(t){return this instanceof Buffer?(Buffer.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof t?fromNumber(this,t):"string"==typeof t?fromString(this,t,arguments.length>1?arguments[1]:"utf8"):fromObject(this,t)):arguments.length>1?new Buffer(t,arguments[1]):new Buffer(t)}function fromNumber(t,e){if(t=allocate(t,0>e?0:0|checked(e)),!Buffer.TYPED_ARRAY_SUPPORT)for(var r=0;e>r;r++)t[r]=0;return t}function fromString(t,e,r){("string"!=typeof r||""===r)&&(r="utf8");var n=0|byteLength(e,r);return t=allocate(t,n),t.write(e,r),t}function fromObject(t,e){if(Buffer.isBuffer(e))return fromBuffer(t,e);if(isArray(e))return fromArray(t,e);if(null==e)throw new TypeError("must start with nu
 mber, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(e.buffer instanceof ArrayBuffer)return fromTypedArray(t,e);if(e instanceof ArrayBuffer)return fromArrayBuffer(t,e)}return e.length?fromArrayLike(t,e):fromJsonObject(t,e)}function fromBuffer(t,e){var r=0|checked(e.length);return t=allocate(t,r),e.copy(t,0,0,r),t}function fromArray(t,e){var r=0|checked(e.length);t=allocate(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function fromTypedArray(t,e){var r=0|checked(e.length);t=allocate(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function fromArrayBuffer(t,e){return e.byteLength,Buffer.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=Buffer.prototype):t=fromTypedArray(t,new Uint8Array(e)),t}function fromArrayLike(t,e){var r=0|checked(e.length);t=allocate(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function fromJsonObject(t,e){var r,n=0;"Buffer"===e.type&&isArray(e.data)&&(r=e.data,n=0|checked(r.length)),t=allocate(t,n);for(var f=0;n>f;f+=1)t[f]=255&r[f
 ];return t}function allocate(t,e){Buffer.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=Buffer.prototype):t.length=e;var r=0!==e&&e<=Buffer.poolSize>>>1;return r&&(t.parent=rootParent),t}function checked(t){if(t>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function SlowBuffer(t,e){if(!(this instanceof SlowBuffer))return new SlowBuffer(t,e);var r=new Buffer(t,e);return delete r.parent,r}function byteLength(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(t).length;default:if(n)return utf8ToBytes(t).length;e=(""+e).toLowerCase(),n=!0}}function slowToString(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t|
 |(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return hexSlice(this,e,r);case"utf8":case"utf-8":return utf8Slice(this,e,r);case"ascii":return asciiSlice(this,e,r);case"binary":return binarySlice(this,e,r);case"base64":return base64Slice(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function hexWrite(t,e,r,n){r=Number(r)||0;var f=t.length-r;n?(n=Number(n),n>f&&(n=f)):n=f;var i=e.length;if(i%2!==0)throw new Error("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;n>o;o++){var u=parseInt(e.substr(2*o,2),16);if(isNaN(u))throw new Error("Invalid hex string");t[r+o]=u}return o}function utf8Write(t,e,r,n){return blitBuffer(utf8ToBytes(e,t.length-r),t,r,n)}function asciiWrite(t,e,r,n){return blitBuffer(asciiToBytes(e),t,r,n)}function binaryWrite(t,e,r,n){return asciiWrite(t,e,r,n)}function base64Write(t,e,r,n){retur
 n blitBuffer(base64ToBytes(e),t,r,n)}function ucs2Write(t,e,r,n){return blitBuffer(utf16leToBytes(e,t.length-r),t,r,n)}function base64Slice(t,e,r){return 0===e&&r===t.length?base64.fromByteArray(t):base64.fromByteArray(t.slice(e,r))}function utf8Slice(t,e,r){r=Math.min(t.length,r);for(var n=[],f=e;r>f;){var i=t[f],o=null,u=i>239?4:i>223?3:i>191?2:1;if(r>=f+u){var s,h,a,c;switch(u){case 1:128>i&&(o=i);break;case 2:s=t[f+1],128===(192&s)&&(c=(31&i)<<6|63&s,c>127&&(o=c));break;case 3:s=t[f+1],h=t[f+2],128===(192&s)&&128===(192&h)&&(c=(15&i)<<12|(63&s)<<6|63&h,c>2047&&(55296>c||c>57343)&&(o=c));break;case 4:s=t[f+1],h=t[f+2],a=t[f+3],128===(192&s)&&128===(192&h)&&128===(192&a)&&(c=(15&i)<<18|(63&s)<<12|(63&h)<<6|63&a,c>65535&&1114112>c&&(o=c))}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),f+=u}return decodeCodePointsArray(n)}function decodeCodePointsArray(t){var e=t.length;if(MAX_ARGUMENTS_LENGTH>=e)return String.fromCharCode.apply(String
 ,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=MAX_ARGUMENTS_LENGTH));return r}function asciiSlice(t,e,r){var n="";r=Math.min(t.length,r);for(var f=e;r>f;f++)n+=String.fromCharCode(127&t[f]);return n}function binarySlice(t,e,r){var n="";r=Math.min(t.length,r);for(var f=e;r>f;f++)n+=String.fromCharCode(t[f]);return n}function hexSlice(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var f="",i=e;r>i;i++)f+=toHex(t[i]);return f}function utf16leSlice(t,e,r){for(var n=t.slice(e,r),f="",i=0;i<n.length;i+=2)f+=String.fromCharCode(n[i]+256*n[i+1]);return f}function checkOffset(t,e,r){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,e,r,n,f,i){if(!Buffer.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>f||i>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range")}function ob
 jectWriteUInt16(t,e,r,n){0>e&&(e=65535+e+1);for(var f=0,i=Math.min(t.length-r,2);i>f;f++)t[r+f]=(e&255<<8*(n?f:1-f))>>>8*(n?f:1-f)}function objectWriteUInt32(t,e,r,n){0>e&&(e=4294967295+e+1);for(var f=0,i=Math.min(t.length-r,4);i>f;f++)t[r+f]=e>>>8*(n?f:3-f)&255}function checkIEEE754(t,e,r,n,f,i){if(e>f||i>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function writeFloat(t,e,r,n,f){return f||checkIEEE754(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(t,e,r,n,23,4),r+4}function writeDouble(t,e,r,n,f){return f||checkIEEE754(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(t,e,r,n,52,8),r+8}function base64clean(t){if(t=stringtrim(t).replace(INVALID_BASE64_RE,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return 16>t?"0"+t.toString(
 16):t.toString(16)}function utf8ToBytes(t,e){e=e||1/0;for(var r,n=t.length,f=null,i=[],o=0;n>o;o++){if(r=t.charCodeAt(o),r>55295&&57344>r){if(!f){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}f=r;continue}if(56320>r){(e-=3)>-1&&i.push(239,191,189),f=r;continue}r=(f-55296<<10|r-56320)+65536}else f&&(e-=3)>-1&&i.push(239,191,189);if(f=null,128>r){if((e-=1)<0)break;i.push(r)}else if(2048>r){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function asciiToBytes(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e}function utf16leToBytes(t,e){for(var r,n,f,i=[],o=0;o<t.length&&!((e-=2)<0);o++)r=t.charCodeAt(o),n=r>>8,f=r%256,i.push(f),i.push(n);return i}function base64ToBytes(t){return base64.toByteArray(bas
 e64clean(t))}function blitBuffer(t,e,r,n){for(var f=0;n>f&&!(f+r>=e.length||f>=t.length);f++)e[f+r]=t[f];return f}var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.poolSize=8192;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:typedArraySupport(),Buffer.TYPED_ARRAY_SUPPORT?(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array):(Buffer.prototype.length=void 0,Buffer.prototype.parent=void 0),Buffer.isBuffer=function(t){return!(null==t||!t._isBuffer)},Buffer.compare=function(t,e){if(!Buffer.isBuffer(t)||!Buffer.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,f=0,i=Math.min(r,n);i>f&&t[f]===e[f];)++f;return f!==i&&(r=t[f],n=e[f]),n>r?-1:r>n?1:0},Buffer.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf
 8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(t,e){if(!isArray(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new Buffer(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;r++)e+=t[r].length;var n=new Buffer(e),f=0;for(r=0;r<t.length;r++){var i=t[r];i.copy(n,f),f+=i.length}return n},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?utf8Slice(this,0,t):slowToString.apply(this,arguments)},Buffer.prototype.equals=function(t){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:0===Buffer.compare(this,t)},Buffer.prototype.inspect=function(){var t="",e=exports.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t
 +">"},Buffer.prototype.compare=function(t){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:Buffer.compare(this,t)},Buffer.prototype.indexOf=function(t,e){function r(t,e,r){for(var n=-1,f=0;r+f<t.length;f++)if(t[r+f]===e[-1===n?0:f-n]){if(-1===n&&(n=f),f-n+1===e.length)return r+n}else n=-1;return-1}if(e>2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(Buffer.isBuffer(t))return r(this,t,e);if("number"==typeof t)return Buffer.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):r(this,[t],e);throw new TypeError("val must be string, number or Buffer")},Buffer.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite
 (e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var f=n;n=e,e=0|r,r=f}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return hexWrite(this,t,e,r);case"utf8":case"utf-8":return utf8Write(this,t,e,r);case"ascii":return asciiWrite(this,t,e,r);case"binary":return binaryWrite(this,t,e,r);case"base64":return base64Write(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),t>e&&(e=t);var n;if(Buffer.TYPED_ARRAY_SU
 PPORT)n=this.subarray(t,e),n.__proto__=Buffer.prototype;else{var f=e-t;n=new Buffer(f,void 0);for(var i=0;f>i;i++)n[i]=this[i+t]}return n.length&&(n.parent=this.parent||this),n},Buffer.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||checkOffset(t,e,this.length);for(var n=this[t],f=1,i=0;++i<e&&(f*=256);)n+=this[t+i]*f;return n},Buffer.prototype.readUIntBE=function(t,e,r){t=0|t,e=0|e,r||checkOffset(t,e,this.length);for(var n=this[t+--e],f=1;e>0&&(f*=256);)n+=this[t+--e]*f;return n},Buffer.prototype.readUInt8=function(t,e){return e||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function(t,e){return e||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function(t,e){return e||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function(t,e){return e||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUInt32BE=function(t,e){return e||checkOffset(t,
 4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||checkOffset(t,e,this.length);for(var n=this[t],f=1,i=0;++i<e&&(f*=256);)n+=this[t+i]*f;return f*=128,n>=f&&(n-=Math.pow(2,8*e)),n},Buffer.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||checkOffset(t,e,this.length);for(var n=e,f=1,i=this[t+--n];n>0&&(f*=256);)i+=this[t+--n]*f;return f*=128,i>=f&&(i-=Math.pow(2,8*e)),i},Buffer.prototype.readInt8=function(t,e){return e||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer.prototype.readInt16LE=function(t,e){e||checkOffset(t,2

<TRUNCATED>

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message