Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function processOutboundQ( args ) {
fedx.send.apply( this, args );
}
function processInboundQ( msg ) {
fedx.onFederatedMsg.call( this, msg );
}
postal.addWireTap( function( data, envelope ) {
if ( fedx.canSendRemote( envelope.channel, envelope.topic ) ) {
fedx.sendMessage( envelope );
}
} );
postal.subscribe( {
channel: postal.configuration.SYSTEM_CHANNEL,
topic: "instanceId.changed",
callback: function() {
state._ready = true;
while ( state._signalQueue.length ) {
processSignalQ( state._signalQueue.shift() );
}
while ( state._outboundQueue.length ) {
processOutboundQ( state._outboundQueue.shift() );
}
while ( state._inboundQueue.length ) {
processInboundQ( state._inboundQueue.shift() );
}
}
} );
if ( postal.instanceId() !== undefined ) {
}).withConstraint(function(d, e){
return d.channel !== "postal.federation" && d.channel !== postal.configuration.SYSTEM_CHANNEL;
});
topic : topic,
callback : function(data, env) {
env = _.clone(env);
env.originId = postal.instanceId;
self.clients[id].send(_.extend({
envelope: env
}, self.getFedxWrapper("message")));
}
});
}
}
}, postal.fedx);
postal.subscribe({
channel : postal.configuration.SYSTEM_CHANNEL,
topic : "subscription.created",
callback : function(data, env) {
postal.fedx.addToManifest(data.channel, data.topic);
var payload = _.extend({
envelope: {
channel : "postal.federation",
topic : "remote.subscription.created",
originId : postal.instanceId,
knownIds : postal.fedx.knownIds,
data : { channel: data.channel, topic: data.topic }
}
}, postal.fedx.getFedxWrapper("subscription.created"));
postal.fedx.send(payload);
}
}).withConstraint(function(d, e){
return d.channel !== "postal.federation" && d.channel !== postal.configuration.SYSTEM_CHANNEL;