Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rhea

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rhea - npm Package Compare versions

Comparing version 0.2.10 to 0.2.11

.eslintrc

24

lib/connection.js

@@ -102,12 +102,14 @@ /*

var aliases = ['container_id',
'hostname',
'max_frame_size',
'channel_max',
'idle_time_out',
'outgoing_locales',
'incoming_locales',
'offered_capabilities',
'desired_capabilities',
'properties'];
var aliases = [
'container_id',
'hostname',
'max_frame_size',
'channel_max',
'idle_time_out',
'outgoing_locales',
'incoming_locales',
'offered_capabilities',
'desired_capabilities',
'properties'
];

@@ -283,5 +285,7 @@ function remote_property_shortcut(name) {

var password = this.get_option('password');
var token = this.get_option('token');
if (username) {
mechanisms = sasl.client_mechanisms();
if (password) mechanisms.enable_plain(username, password);
else if (token) mechanisms.enable_xoauth2(username, token);
else mechanisms.enable_anonymous(username);

@@ -288,0 +292,0 @@ }

@@ -97,3 +97,4 @@ /*

Container.prototype.message = require('./message.js');
Container.prototype.sasl = sasl;
module.exports = new Container();

@@ -135,120 +135,129 @@ /*

var open = {name: 'open',
code: 0x10,
fields: [
{name:'container_id', type:'string', mandatory:true},
{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:true},
{name:'incoming_locales', type:'symbol', multiple:true},
{name:'offered_capabilities', type:'symbol', multiple:true},
{name:'desired_capabilities', type:'symbol', multiple:true},
{name:'properties', type:'symbolic_map'}
]
};
var open = {
name: 'open',
code: 0x10,
fields: [
{name: 'container_id', type: 'string', mandatory: true},
{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: true},
{name: 'incoming_locales', type: 'symbol', multiple: true},
{name: 'offered_capabilities', type: 'symbol', multiple: true},
{name: 'desired_capabilities', type: 'symbol', multiple: true},
{name: 'properties', type: 'symbolic_map'}
]
};
var begin = {name:'begin',
code:0x11,
fields:[
{name:'remote_channel', type:'ushort'},
{name:'next_outgoing_id', type:'uint', mandatory:true},
{name:'incoming_window', type:'uint', mandatory:true},
{name:'outgoing_window', type:'uint', mandatory:true},
{name:'handle_max', type:'uint', default_value:'4294967295'},
{name:'offered_capabilities', type:'symbol', multiple:true},
{name:'desired_capabilities', type:'symbol', multiple:true},
{name:'properties', type:'symbolic_map'}
]
};
var begin = {
name: 'begin',
code: 0x11,
fields:[
{name: 'remote_channel', type: 'ushort'},
{name: 'next_outgoing_id', type: 'uint', mandatory: true},
{name: 'incoming_window', type: 'uint', mandatory: true},
{name: 'outgoing_window', type: 'uint', mandatory: true},
{name: 'handle_max', type: 'uint', default_value: '4294967295'},
{name: 'offered_capabilities', type: 'symbol', multiple: true},
{name: 'desired_capabilities', type: 'symbol', multiple: true},
{name: 'properties', type: 'symbolic_map'}
]
};
var attach = {name:'attach',
code:0x12,
fields:[
{name:'name', type:'string', mandatory:true},
{name:'handle', type:'uint', mandatory:true},
{name:'role', type:'boolean', mandatory:true},
{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:false},
{name:'initial_delivery_count', type:'uint'},
{name:'max_message_size', type:'ulong'},
{name:'offered_capabilities', type:'symbol', multiple:true},
{name:'desired_capabilities', type:'symbol', multiple:true},
{name:'properties', type:'symbolic_map'}
]
};
var attach = {
name: 'attach',
code: 0x12,
fields:[
{name: 'name', type: 'string', mandatory: true},
{name: 'handle', type: 'uint', mandatory: true},
{name: 'role', type: 'boolean', mandatory: true},
{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: false},
{name: 'initial_delivery_count', type: 'uint'},
{name: 'max_message_size', type: 'ulong'},
{name: 'offered_capabilities', type: 'symbol', multiple: true},
{name: 'desired_capabilities', type: 'symbol', multiple: true},
{name: 'properties', type: 'symbolic_map'}
]
};
var flow = {name:'flow',
code:0x13,
fields:[
{name:'next_incoming_id', type:'uint'},
{name:'incoming_window', type:'uint', mandatory:true},
{name:'next_outgoing_id', type:'uint', mandatory:true},
{name:'outgoing_window', type:'uint', mandatory:true},
{name:'handle', type:'uint'},
{name:'delivery_count', type:'uint'},
{name:'link_credit', type:'uint'},
{name:'available', type:'uint'},
{name:'drain', type:'boolean', default_value:false},
{name:'echo', type:'boolean', default_value:false},
{name:'properties', type:'symbolic_map'}
]
};
var flow = {
name: 'flow',
code: 0x13,
fields:[
{name: 'next_incoming_id', type: 'uint'},
{name: 'incoming_window', type: 'uint', mandatory: true},
{name: 'next_outgoing_id', type: 'uint', mandatory: true},
{name: 'outgoing_window', type: 'uint', mandatory: true},
{name: 'handle', type: 'uint'},
{name: 'delivery_count', type: 'uint'},
{name: 'link_credit', type: 'uint'},
{name: 'available', type: 'uint'},
{name: 'drain', type: 'boolean', default_value: false},
{name: 'echo', type: 'boolean', default_value: false},
{name: 'properties', type: 'symbolic_map'}
]
};
var transfer = {name:'transfer',
code:0x14,
fields:[
{name:'handle', type:'uint', mandatory:true},
{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:false},
{name:'rcv_settle_mode', type:'ubyte'},
{name:'state', type:'delivery_state'},
{name:'resume', type:'boolean', default_value:false},
{name:'aborted', type:'boolean', default_value:false},
{name:'batchable', type:'boolean', default_value:false}
]
};
var transfer = {
name: 'transfer',
code: 0x14,
fields:[
{name: 'handle', type: 'uint', mandatory: true},
{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: false},
{name: 'rcv_settle_mode', type: 'ubyte'},
{name: 'state', type: 'delivery_state'},
{name: 'resume', type: 'boolean', default_value: false},
{name: 'aborted', type: 'boolean', default_value: false},
{name: 'batchable', type: 'boolean', default_value: false}
]
};
var disposition = {name:'disposition',
code:0x15,
fields:[
{name:'role', type:'boolean', mandatory:true},
{name:'first', type:'uint', mandatory:true},
{name:'last', type:'uint'},
{name:'settled', type:'boolean', default_value:false},
{name:'state', type:'*'},
{name:'batchable', type:'boolean', default_value:false}
]
};
var disposition = {
name: 'disposition',
code: 0x15,
fields:[
{name: 'role', type: 'boolean', mandatory: true},
{name: 'first', type: 'uint', mandatory: true},
{name: 'last', type: 'uint'},
{name: 'settled', type: 'boolean', default_value: false},
{name: 'state', type: '*'},
{name: 'batchable', type: 'boolean', default_value: false}
]
};
var detach = {name: 'detach',
code: 0x16,
fields: [
{name:'handle', type:'uint', mandatory:true},
{name:'closed', type:'boolean', default_value:false},
{name:'error', type:'error'}
]
};
var detach = {
name: 'detach',
code: 0x16,
fields: [
{name: 'handle', type: 'uint', mandatory: true},
{name: 'closed', type: 'boolean', default_value: false},
{name: 'error', type: 'error'}
]
};
var end = {name: 'end',
code: 0x17,
fields: [
{name:'error', type:'error'}
]
};
var end = {
name: 'end',
code: 0x17,
fields: [
{name: 'error', type: 'error'}
]
};
var close = {name: 'close',
code: 0x18,
fields: [
{name:'error', type:'error'}
]
};
var close = {
name: 'close',
code: 0x18,
fields: [
{name: 'error', type: 'error'}
]
};

@@ -265,29 +274,44 @@ define_frame(frames.TYPE_AMQP, open);

var sasl_mechanisms = {name:'sasl_mechanisms', code:0x40,
fields: [
{name:'sasl_server_mechanisms', type:'symbol', multiple:true, mandatory:true}
]};
var sasl_mechanisms = {
name: 'sasl_mechanisms',
code: 0x40,
fields: [
{name: 'sasl_server_mechanisms', type: 'symbol', multiple: true, mandatory: true}
]
};
var sasl_init = {name:'sasl_init', code:0x41,
fields: [
{name:'mechanism', type:'symbol', mandatory:true},
{name:'initial_response', type:'binary'},
{name:'hostname', type:'string'}
]};
var sasl_init = {
name: 'sasl_init',
code: 0x41,
fields: [
{name: 'mechanism', type: 'symbol', mandatory: true},
{name: 'initial_response', type: 'binary'},
{name: 'hostname', type: 'string'}
]
};
var sasl_challenge = {name:'sasl_challenge', code:0x42,
fields: [
{name:'challenge', type:'binary', mandatory:true}
]};
var sasl_challenge = {
name: 'sasl_challenge',
code: 0x42,
fields: [
{name: 'challenge', type: 'binary', mandatory: true}
]
};
var sasl_response = {name:'sasl_response', code:0x43,
fields: [
{name:'response', type:'binary', mandatory:true}
]};
var sasl_response = {
name: 'sasl_response',
code: 0x43,
fields: [
{name: 'response', type: 'binary', mandatory: true}
]
};
var sasl_outcome = {name:'sasl_outcome', code:0x44,
fields: [
{name:'code', type:'ubyte', mandatory:true},
{name:'additional_data', type:'binary'}
]};
var sasl_outcome = {
name: 'sasl_outcome',
code: 0x44,
fields: [
{name: 'code', type: 'ubyte', mandatory: true},
{name: 'additional_data', type: 'binary'}
]
};

@@ -294,0 +318,0 @@ define_frame(frames.TYPE_SASL, sasl_mechanisms);

@@ -169,10 +169,12 @@ /*

var aliases = ['snd_settle_mode',
'rcv_settle_mode',
'source',
'target',
'max_message_size',
'offered_capabilities',
'desired_capabilities',
'properties'];
var aliases = [
'snd_settle_mode',
'rcv_settle_mode',
'source',
'target',
'max_message_size',
'offered_capabilities',
'desired_capabilities',
'properties'
];

@@ -298,4 +300,5 @@ function remote_property_shortcut(name) {

Sender.prototype.send = function (msg, tag) {
var delivery = this.session.send(this, tag ? tag : this.next_tag(), message.encode(msg), 0);
Sender.prototype.send = function (msg, tag, format) {
var payload = format === undefined ? message.encode(msg) : msg;
var delivery = this.session.send(this, tag ? tag : this.next_tag(), payload, format);
if (this.local.attach.snd_settle_mode === 1) {

@@ -302,0 +305,0 @@ delivery.settled = true;

@@ -73,45 +73,61 @@ /*

function Section(typecode, content) {
function Section(typecode, content, multiple) {
this.typecode = typecode;
this.content = content;
this.multiple = multiple;
}
Section.prototype.described = function () {
return types.described(types.wrap_ulong(this.typecode), types.wrap(this.content));
Section.prototype.described = function (item) {
return types.described(types.wrap_ulong(this.typecode), types.wrap(item || this.content));
};
define_composite_section({name:'header',
code:0x70,
fields:[
{name:'durable', type:'boolean', default_value:false},
{name:'priority', type:'ubyte', default_value:4},
{name:'ttl', type:'uint'},
{name:'first_acquirer', type:'boolean', default_value:false},
{name:'delivery_count', type:'uint', default_value:0}
]
});
define_composite_section({
name:'header',
code:0x70,
fields:[
{name:'durable', type:'boolean', default_value:false},
{name:'priority', type:'ubyte', default_value:4},
{name:'ttl', type:'uint'},
{name:'first_acquirer', type:'boolean', default_value:false},
{name:'delivery_count', type:'uint', default_value:0}
]
});
define_map_section({name:'delivery_annotations', code:0x71});
define_map_section({name:'message_annotations', code:0x72});
define_composite_section({name:'properties',
code:0x73,
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_composite_section({
name:'properties',
code:0x73,
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:0x74});
define_section({numeric:0x75, symbolic:'amqp:data:binary'}, function (msg, section) { msg.body = new Section(0x75, types.unwrap(section)); });
define_section({numeric:0x76, symbolic:'amqp:amqp-sequence:list'}, function (msg, section) { msg.body = new Section(0x76, types.unwrap(section)); });
function unwrap_body_section (msg, section, typecode) {
if (msg.body === undefined) {
msg.body = new Section(typecode, types.unwrap(section));
} else if (msg.body.constructor === Section && msg.body.typecode === typecode) {
if (msg.body.multiple) {
msg.body.content.push(types.unwrap(section));
} else {
msg.body.multiple = true;
msg.body.content = [msg.body.content, types.unwrap(section)];
}
}
}
define_section({numeric:0x75, symbolic:'amqp:data:binary'}, function (msg, section) { unwrap_body_section(msg, section, 0x75); });
define_section({numeric:0x76, symbolic:'amqp:amqp-sequence:list'}, function (msg, section) { unwrap_body_section(msg, section, 0x76); });
define_section({numeric:0x77, symbolic:'amqp:value:*'}, function (msg, section) { msg.body = types.unwrap(section); });

@@ -124,3 +140,9 @@

if (msg.body && msg.body.constructor === Section) {
sections.push(msg.body.described());
if (msg.body.multiple) {
msg.body.content.forEach(function (s) {
sections.push(msg.body.described(s));
});
} else {
sections.push(msg.body.described());
}
} else {

@@ -141,2 +163,10 @@ sections.push(types.described(types.wrap_ulong(0x77), types.wrap(msg.body)));

message.data_sections = function (data_elements) {
return new Section(0x75, data_elements, true);
};
message.sequence_sections = function (lists) {
return new Section(0x76, lists, true);
};
function copy(src, tgt) {

@@ -246,11 +276,14 @@ for (var k in src) {

define_outcome({name:'received', code:0x23,
fields:[
{name:'section_number', type:'uint', mandatory:true},
{name:'section_offset', type:'ulong', mandatory:true}
]});
define_outcome({
name:'received',
code:0x23,
fields:[
{name:'section_number', type:'uint', mandatory:true},
{name:'section_offset', type:'ulong', mandatory:true}
]});
define_outcome({name:'accepted', code:0x24, fields:[]});
define_outcome({name:'rejected', code:0x25, fields:[{name:'error', type:'error'}]});
define_outcome({name:'released', code:0x26, fields:[]});
define_outcome({name:'modified',
define_outcome({
name:'modified',
code:0x27,

@@ -257,0 +290,0 @@ fields:[

@@ -125,2 +125,27 @@ /*

var XOAuth2Client = function(username, token) {
this.username = username;
this.token = token;
};
XOAuth2Client.prototype.start = function() {
var response = new Buffer(this.username.length + this.token.length + 5 + 12 + 3);
var count = 0;
response.write('user=', count);
count += 5;
response.write(this.username, count);
count += this.username.length;
response.writeUInt8(1, count);
count += 1;
response.write('auth=Bearer ', count);
count += 12;
response.write(this.token, count);
count += this.token.length;
response.writeUInt8(1, count);
count += 1;
response.writeUInt8(1, count);
count += 1;
return response;
};
/**

@@ -313,2 +338,11 @@ * The mechanisms argument is a map of mechanism names to factory

this['EXTERNAL'] = function() { return new ExternalClient(); };
},
enable_xoauth2: function (username, token) {
if (username && token) {
this['XOAUTH2'] = function() { return new XOAuth2Client(username, token); };
} else if (token === undefined) {
throw Error('token must be specified');
} else if (username === undefined) {
throw Error('username must be specified');
}
}

@@ -315,0 +349,0 @@ };

@@ -146,12 +146,14 @@ /*

}
var d = {'id':this.next_delivery_id++,
'tag':tag,
'link':sender,
'data': fragments,
'format':format ? format : 0,
'sent': false,
'settled': false,
'state': undefined,
'remote_settled': false,
'remote_state': undefined};
var d = {
'id':this.next_delivery_id++,
'tag':tag,
'link':sender,
'data': fragments,
'format':format ? format : 0,
'sent': false,
'settled': false,
'state': undefined,
'remote_settled': false,
'remote_state': undefined
};
var self = this;

@@ -234,3 +236,3 @@ d.update = function (settled, state) {

log.flow('Incoming window of peer preventing sending further transfers: remote_window=%d, remote_next_transfer_id=%d, next_transfer_id=%d',
this.remote_window, this.remote_next_transfer_id, this.next_transfer_id);
this.remote_window, this.remote_next_transfer_id, this.next_transfer_id);
break;

@@ -307,8 +309,9 @@ }

current = {'id':frame.performative.delivery_id,
'tag':frame.performative.delivery_tag,
'link':receiver,
'settled': false,
'state': undefined,
'remote_settled': frame.performative.settled === undefined ? false : frame.performative.settled,
'remote_state': frame.performative.state};
'tag':frame.performative.delivery_tag,
'format':frame.performative.message_format,
'link':receiver,
'settled': false,
'state': undefined,
'remote_settled': frame.performative.settled === undefined ? false : frame.performative.settled,
'remote_state': frame.performative.state};
var self = this;

@@ -346,3 +349,4 @@ current.update = function (settled, state) {

this.next_delivery_id++;
receiver.dispatch('message', receiver._context({'message':message.decode(data), 'delivery':current}));
var msgctxt = current.format === 0 ? {'message':message.decode(data), 'delivery':current} : {'message':data, 'delivery':current, 'format':current.format};
receiver.dispatch('message', receiver._context(msgctxt));
}

@@ -565,6 +569,6 @@ }

var fields = {'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
};
'incoming_window':this.incoming.window,
'next_outgoing_id':this.outgoing.next_transfer_id,
'outgoing_window':this.outgoing.window
};
this.incoming.max_transfer_id = fields.next_incoming_id + fields.incoming_window;

@@ -571,0 +575,0 @@ if (link) {

@@ -42,34 +42,34 @@ /*

define_terminus(
{name:'source',
code:0x28,
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:false},
{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:true},
{name:'capabilities', type:'symbol', multiple:true}
]
});
define_terminus({
name: 'source',
code: 0x28,
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: false},
{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: true},
{name: 'capabilities', type: 'symbol', multiple: true}
]
});
define_terminus(
{name:'target',
code:0x29,
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:false},
{name:'dynamic_node_properties', type:'symbolic_map'},
{name:'capabilities', type:'symbol', multiple:true}
]
});
define_terminus({
name: 'target',
code: 0x29,
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: false},
{name: 'dynamic_node_properties', type: 'symbolic_map'},
{name: 'capabilities', type: 'symbol', multiple: true}
]
});
module.exports = terminus;

@@ -947,11 +947,12 @@ /*

add_type({name: 'error',
code: 0x1d,
fields: [
{name:'condition', type:'symbol', mandatory:true},
{name:'description', type:'string'},
{name:'info', type:'map'}
]
});
add_type({
name: 'error',
code: 0x1d,
fields: [
{name:'condition', type:'symbol', mandatory:true},
{name:'description', type:'string'},
{name:'info', type:'map'}
]
});
module.exports = types;

@@ -77,4 +77,4 @@ /*

return field !== undefined && field !== null;
}
};
module.exports = util;
{
"name" : "rhea",
"version": "0.2.10",
"name": "rhea",
"version": "0.2.11",
"description": "reactive AMQP 1.0 library",
"homepage": "http://github.com/grs/rhea",
"homepage": "http://github.com/amqp/rhea",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "http://github.com/grs/rhea"
"url": "http://github.com/amqp/rhea"
},

@@ -15,8 +15,8 @@ "dependencies": {

"devDependencies": {
"eslint":"",
"mocha":"^3.0.0",
"browserify":"",
"browserify": "",
"eslint": "",
"istanbul": "",
"minimist":"",
"uglify-js":""
"minimist": "",
"mocha": "^3.0.0",
"uglify-js": ""
},

@@ -29,6 +29,11 @@ "scripts": {

"run-examples": "mocha examples/test_examples.js",
"uglify": "uglifyjs --source-map --output dist/rhea.min.js dist/rhea.js"
"uglify": "uglifyjs --source-map --output dist/rhea.min.js dist/rhea.js",
"prepublish": "npm run test",
"pretest": "npm run lint"
},
"keywords": ["amqp","messaging"],
"main" : "./lib/container.js"
"keywords": [
"amqp",
"messaging"
],
"main": "./lib/container.js"
}

@@ -1,2 +0,2 @@

[![Build Status](https://travis-ci.org/grs/rhea.svg?branch=master)](https://travis-ci.org/grs/rhea)
[![Build Status](https://travis-ci.org/amqp/rhea.svg?branch=master)](https://travis-ci.org/amqp/rhea)

@@ -3,0 +3,0 @@ # rhea

@@ -61,2 +61,17 @@ /*

}));
it('sends and receives body as two data sections', transfer_test({body:amqp_message.data_sections([new Buffer('hello'), new Buffer('world!')])}, function(message) {
assert.equal(message.body.typecode, 0x75);
assert.equal(message.body.multiple, true);
assert.equal(message.body.content.length, 2);
assert.equal(message.body.content[0].toString(), 'hello');
assert.equal(message.body.content[1].toString(), 'world!');
}));
it('sends and receives body as multiple data sections', transfer_test({body:amqp_message.data_sections([new Buffer('farewell'), new Buffer('cruel'), new Buffer('world!')])}, function(message) {
assert.equal(message.body.typecode, 0x75);
assert.equal(message.body.multiple, true);
assert.equal(message.body.content.length, 3);
assert.equal(message.body.content[0].toString(), 'farewell');
assert.equal(message.body.content[1].toString(), 'cruel');
assert.equal(message.body.content[2].toString(), 'world!');
}));
it('sends and receives body as sequence section', transfer_test({body:amqp_message.sequence_section(['hello', 1, 'world!'])}, function(message) {

@@ -68,2 +83,19 @@ assert.equal(message.body.typecode, 0x76);

}));
it('sends and receives body as multiple sequence sections', transfer_test({body:amqp_message.sequence_sections([['hello', 1, 'world!'], ['foo', 'bar', 1234, 5678], ['pi', 3.14]])}, function(message) {
assert.equal(message.body.typecode, 0x76);
assert.equal(message.body.multiple, true);
assert.equal(message.body.content.length, 3);
assert.equal(message.body.content[0].length, 3);
assert.equal(message.body.content[0][0], 'hello');
assert.equal(message.body.content[0][1], 1);
assert.equal(message.body.content[0][2], 'world!');
assert.equal(message.body.content[1].length, 4);
assert.equal(message.body.content[1][0], 'foo');
assert.equal(message.body.content[1][1], 'bar');
assert.equal(message.body.content[1][2], 1234);
assert.equal(message.body.content[1][3], 5678);
assert.equal(message.body.content[2].length, 2);
assert.equal(message.body.content[2][0], 'pi');
assert.equal(message.body.content[2][1], 3.14);
}));
it('sends and receives subject', transfer_test({subject:'my-subject'}, function(message) {

@@ -281,2 +313,11 @@ assert.equal(message.subject, 'my-subject');

}));
it('sends and receives message in custom format', function (done) {
var message = new Buffer('hello world!');
container.on('message', function(context) {
assert.equal(context.format, 1111);
assert.equal(context.message.toString(), message.toString());
done();
});
sender.send(message, undefined, 1111);
});
});

@@ -283,0 +324,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc