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

harcon-amqp

Package Overview
Dependencies
Maintainers
1
Versions
197
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

harcon-amqp - npm Package Compare versions

Comparing version 8.9.14 to 9.0.0

66

lib/AmqpBarrel.js

@@ -33,2 +33,4 @@ let _ = require('isa.js')

if (!self.ins[division])
self.ins[division] = {}
self.ins[division][entityName] = { socket: socket, timestamp: Date.now() }

@@ -108,2 +110,7 @@

if (!self._divisionsManaged[division])
self._divisionsManaged[division] = []
if (!self._divisionsManaged[division].includes( entityName ))
self._divisionsManaged[division].push( entityName )
return self.innerCreateIn( division, entityName, self.nodeID, async function ( message ) {

@@ -144,2 +151,3 @@ try {

self.messages = {}
self._divisionsManaged = {}
self.outs = {}

@@ -301,2 +309,4 @@ self.ins = {}

if (self._offline) return 'ok'
try {

@@ -342,3 +352,3 @@ let divisions = Object.keys(self.ins)

amqpbarrel.connect = function ( ) {
amqpbarrel.connect = async function ( ) {
let self = this

@@ -350,8 +360,11 @@

self.ctx.on('error', () => {
self._offline = true
self.reconnect().catch( () => { } )
} )
self.ctx.on('close', () => {
self._offline = true
self.reconnect().catch( () => { } )
} )
self.ctx.on('ready', async function () {
self._offline = false
self.logger.harconlog( null, 'AMQP connection is made.', self.connectURL, 'warn' )

@@ -371,25 +384,23 @@ await self.setupDivisions( )

amqpbarrel.reconnect = function ( ) {
amqpbarrel.reconnect = async function ( ) {
let self = this
return new Promise( async (resolve, reject) => {
if (self.finalised) return resolve('ok')
if (self.finalised) return 'ok'
try {
await Proback.timeout( self.reconnectionTimeout )
self.logger.harconlog( null, 'Reconnecting...', self.connectURL, 'warn' )
try {
await Proback.timeout( self.reconnectionTimeout )
self.logger.harconlog( null, 'Reconnecting...', self.connectURL, 'warn' )
await self.connect()
await self.connect()
self.logger.harconlog( null, 'Reconnected.', self.connectURL, 'warn' )
self.logger.harconlog( null, 'Reconnected.', self.connectURL, 'warn' )
resolve('ok')
} catch (err) {
self.reconnectionTimeout = self.reconnectionTimeout + 250
if ( self.reconnectionTimeout > self.reconnectionMaxTimeout )
self.reconnectionTimeout = self.reconnectionMaxTimeout
return 'ok'
} catch (err) {
self.reconnectionTimeout = self.reconnectionTimeout + 250
if ( self.reconnectionTimeout > self.reconnectionMaxTimeout )
self.reconnectionTimeout = self.reconnectionMaxTimeout
reject(err)
}
} )
throw err
}
}

@@ -400,9 +411,22 @@

for ( let division of Object.keys(self.ins) ) {
if (self._offline) return 'ok'
try {
if (self.outs)
for ( let div in self.outs)
self.outs[div].close()
if (self.ins)
for ( let div in self.ins)
for ( let entity in self.ins[div])
self.ins[div][entity].socket.close()
} catch ( err ) { }
self.outs = {}
self.ins = {}
for ( let division in self._divisionsManaged ) {
await self.createDivisionIn( division, true )
for ( let entity of Object.keys(self.ins[division]) )
await self.createOut( division )
for ( let entity of self._divisionsManaged[division] )
await self.createEntityIn( division, entity, true )
}
for ( let division of Object.keys(self.outs) )
await self.createOut( division )

@@ -409,0 +433,0 @@ return 'ok'

{
"name": "harcon-amqp",
"version": "8.9.14",
"version": "9.0.0",
"description": "AMQP plugin for the harcon messaging/service bus of node-based enterprise entities.",

@@ -26,7 +26,8 @@ "keywords": [

"dependencies": {
"amqplib": "^0.5.3",
"clerobee": "^0.9.8",
"harcon": "^8.9.12",
"harcon": "^9.0.1",
"isa.js": "^2.2.3",
"proback.js": "^2.1.8",
"rabbit.js.ng": "^0.5.0"
"rabbit.js.ng": "^0.5.1"
},

@@ -33,0 +34,0 @@ "devDependencies": {

@@ -54,6 +54,6 @@ const assert = require('assert')

await inflicter.inflicterEntity.addict( null, 'peter', 'greet.*', function (greetings1, greetings2) {
await inflicter.inflicterEntity.deploy( null, 'peter', 'greet.*', function (greetings1, greetings2) {
return Proback.quicker('Hi there!')
} )
await inflicter.inflicterEntity.addict( null, 'walter', 'greet.*', function (greetings1, greetings2) {
await inflicter.inflicterEntity.deploy( null, 'walter', 'greet.*', function (greetings1, greetings2) {
return Proback.quicker('My pleasure!')

@@ -83,3 +83,3 @@ } )

it('Send for divisions...', async function () {
let res = await inflicter.ignite( clerobee.generate(), null, '', 'Inflicter.divisions')
let res = await inflicter.request( clerobee.generate(), null, '', 'Inflicter.divisions')
expect( res.sort() ).to.eql( [ 'HarconSys', 'HarconSys.click', 'HarconSys.maison.cache' ] )

@@ -94,3 +94,3 @@ })

it('Walter check', async function () {
let res = await inflicter.ignite( clerobee.generate(), null, '', 'greet.hello', 'Bonjour!', 'Salut!')
let res = await inflicter.request( clerobee.generate(), null, '', 'greet.hello', 'Bonjour!', 'Salut!')
expect( res ).to.eql( [ 'Hi there!', 'My pleasure!' ] )

@@ -102,3 +102,3 @@ })

it('Alize dormir', async function () {
let res = await inflicter.ignite( clerobee.generate(), null, '', 'Alizee.dormir' )
let res = await inflicter.request( clerobee.generate(), null, '', 'Alizee.dormir' )
expect(res).to.eql( 'Non, non, non!' )

@@ -108,3 +108,3 @@ })

this.timeout(5000)
let res = await inflicter.ignite( clerobee.generate(), null, '', 'Alizee.flegme' )
let res = await inflicter.request( clerobee.generate(), null, '', 'Alizee.flegme' )
expect(res).to.eql( 'Quoi?' )

@@ -115,3 +115,3 @@ })

try {
await inflicter.ignite( clerobee.generate(), null, '', 'Alizee.superFlegme' )
await inflicter.request( clerobee.generate(), null, '', 'Alizee.superFlegme' )
assert.fail( 'Should not be here...' )

@@ -124,7 +124,7 @@ } catch (err) { expect(err).to.be.an.instanceof( Error ) }

it('multilevel domains', async function () {
let res = await inflicter.ignite( clerobee.generate(), null, 'HarconSys.maison.cache', 'Margot.alors' )
let res = await inflicter.request( clerobee.generate(), null, 'HarconSys.maison.cache', 'Margot.alors' )
expect(res).to.eql( 'Oui?' )
})
it('multilevel contextes', async function () {
let res = await inflicter.ignite( clerobee.generate(), null, 'HarconSys.maison.cache', 'paresseux.fille.alors' )
let res = await inflicter.request( clerobee.generate(), null, 'HarconSys.maison.cache', 'paresseux.fille.alors' )
expect(res).to.eql( 'Oui?' )

@@ -137,3 +137,3 @@ })

try {
await inflicter.ignite( clerobee.generate(), null, '', 'Bandit.delay' )
await inflicter.request( clerobee.generate(), null, '', 'Bandit.delay' )
assert.fail( 'Should not be here...' )

@@ -146,6 +146,6 @@ } catch (err) { expect(err).to.be.an.instanceof( Error ) }

let Lina = inflicter.barrel.firestarter('Lina').object
await inflicter.ignite( clerobee.generate(), null, '', 'Marie.notify', 'data', '', 'Lina.marieChanged')
await inflicter.request( clerobee.generate(), null, '', 'Marie.notify', 'data', '', 'Lina.marieChanged')
await Proback.timeout( 250 )
await inflicter.ignite( clerobee.generate(), null, '', 'Marie.simple', 'Bonjour', 'Salut' )
await inflicter.request( clerobee.generate(), null, '', 'Marie.simple', 'Bonjour', 'Salut' )

@@ -162,3 +162,3 @@ await Proback.timeout( 250 )

try {
let res = await inflicter.ignite( '0', null, '', 'Charlotte.access')
let res = await inflicter.request( '0', null, '', 'Charlotte.access')
should.exist(res)

@@ -170,3 +170,3 @@ expect( res ).to.include( 'D\'accord?' )

try {
let res = await inflicter.ignite( '0', null, '', 'Charlotte-Unique.access')
let res = await inflicter.request( '0', null, '', 'Charlotte-Unique.access')
should.exist(res)

@@ -181,4 +181,4 @@ expect( res ).to.include( 'D\'accord?' )

try {
let res = await inflicter.ignite( '0', null, '', 'Marie.simple', 'whatsup?', 'how do you do?')
let res2 = await inflicter.ignite( '0', null, '', 'greet.simple', 'whatsup?', 'how do you do?')
let res = await inflicter.request( '0', null, '', 'Marie.simple', 'whatsup?', 'how do you do?')
let res2 = await inflicter.request( '0', null, '', 'greet.simple', 'whatsup?', 'how do you do?')
console.log( '.>??????>>..', res, res2 )

@@ -190,3 +190,3 @@ } catch (err) { console.error(err) }

try {
let res = await inflicter.simpleIgnite( 'Marion.force' )
let res = await inflicter.simpleRequest( 'Marion.force' )
should.exist(res)

@@ -202,3 +202,3 @@ expect( res[0] ).to.eql( [ 'Hi there!', 'My pleasure!' ] )

try {
let res = await inflicter.ignite( '0', null, '', 'Marie.simple', 'whatsup?', 'how do you do?')
let res = await inflicter.request( '0', null, '', 'Marie.simple', 'whatsup?', 'how do you do?')
should.exist(res)

@@ -210,3 +210,3 @@ expect( res ).to.include( 'Bonjour!' )

try {
let res = await inflicter.ignite( '0', null, '', 'greet.simple', 'whatsup?', 'how do you do?')
let res = await inflicter.request( '0', null, '', 'greet.simple', 'whatsup?', 'how do you do?')
should.exist(res)

@@ -221,3 +221,3 @@

try {
let res = await inflicter.ignite( '0', null, '', 'morning.wakeup')
let res = await inflicter.request( '0', null, '', 'morning.wakeup')
expect(res).to.eql( [ 'Hi there!', 'My pleasure!' ] )

@@ -228,3 +228,3 @@ } catch (err) { console.error(err) }

try {
let res = await inflicter.ignite( '0', null, '', 'morning.dormir')
let res = await inflicter.request( '0', null, '', 'morning.dormir')
expect(res).to.eql( [ 'Non, non, non!', 'Non, Mais non!' ] )

@@ -235,3 +235,3 @@ } catch (err) { console.error(err) }

try {
let res = await inflicter.ignite( '0', null, '', 'morning.girls.dormir')
let res = await inflicter.request( '0', null, '', 'morning.girls.dormir')
expect(res).to.eql( [ 'Non, non, non!', 'Non, Mais non!' ] )

@@ -242,3 +242,3 @@ } catch (err) { console.error(err) }

try {
await inflicter.ignite( '0', null, '', 'cave.echo')
await inflicter.request( '0', null, '', 'cave.echo')
} catch (err) {

@@ -251,3 +251,3 @@ expect(err).to.be.an.instanceof( Error )

try {
await inflicter.simpleIgnite( 'Alizee.flegme')
await inflicter.simpleRequest( 'Alizee.flegme')
} catch (err) {

@@ -259,3 +259,3 @@ expect(err).to.be.an.instanceof( Error )

try {
let res = await inflicter.ignite( '0', null, harconName + '.click', 'greet.simple', 'Hi', 'Ca vas?' )
let res = await inflicter.request( '0', null, harconName + '.click', 'greet.simple', 'Hi', 'Ca vas?' )
should.exist(res)

@@ -271,3 +271,3 @@

try {
let res = await inflicter.ignite( '0', null, harconName + '.click', 'greet.simple', 'Hi', 'Ca vas?')
let res = await inflicter.request( '0', null, harconName + '.click', 'greet.simple', 'Hi', 'Ca vas?')

@@ -284,3 +284,3 @@ should.exist(res)

try {
let res = await inflicter.simpleIgnite( 'Domina.force')
let res = await inflicter.simpleRequest( 'Domina.force')
should.exist(res)

@@ -295,3 +295,3 @@

try {
let res = await inflicter.ignite( '0', null, harconName + '.click', 'greet.simple', 'Hi', 'Ca vas?')
let res = await inflicter.request( '0', null, harconName + '.click', 'greet.simple', 'Hi', 'Ca vas?')
should.exist(res)

@@ -314,3 +314,3 @@ expect( res ).to.not.include( 'Pas du tout!' )

await Proback.timeout( 8000 )
let res = await inflicter.ignite( '0', null, '', 'Lina.flying')
let res = await inflicter.request( '0', null, '', 'Lina.flying')
expect( res ).to.eql( 'Flying in the clouds...' )

@@ -317,0 +317,0 @@ } catch (err) { assert.fail( 'Should not be here...' ) }

@@ -65,3 +65,3 @@ const assert = require('assert')

it('Phil dormir', async function () {
let res = await inflicter2.ignite( clerobee.generate(), null, '', 'Phil.dormir' )
let res = await inflicter2.request( clerobee.generate(), null, '', 'Phil.dormir' )
expect( res ).to.eql( 'Oui!' )

@@ -68,0 +68,0 @@ })

@@ -54,6 +54,6 @@ const assert = require('assert')

await inflicter.inflicterEntity.addict( null, 'peter', 'greet.*', function (greetings1, greetings2) {
await inflicter.inflicterEntity.deploy( null, 'peter', 'greet.*', function (greetings1, greetings2) {
return Proback.quicker('Hi there!')
} )
await inflicter.inflicterEntity.addict( null, 'walter', 'greet.*', function (greetings1, greetings2) {
await inflicter.inflicterEntity.deploy( null, 'walter', 'greet.*', function (greetings1, greetings2) {
return Proback.quicker('My pleasure!')

@@ -83,3 +83,3 @@ } )

it('Send for divisions...', async function () {
let res = await inflicter.ignite( clerobee.generate(), null, '', 'Inflicter.divisions')
let res = await inflicter.request( clerobee.generate(), null, '', 'Inflicter.divisions')
expect( res.sort() ).to.eql( [ 'HarconSys', 'HarconSys.click', 'HarconSys.maison.cache' ] )

@@ -94,3 +94,3 @@ })

it('Walter check', async function () {
let res = await inflicter.ignite( clerobee.generate(), null, '', 'greet.hello', 'Bonjour!', 'Salut!')
let res = await inflicter.request( clerobee.generate(), null, '', 'greet.hello', 'Bonjour!', 'Salut!')
expect( res ).to.eql( [ 'Hi there!', 'My pleasure!' ] )

@@ -108,3 +108,3 @@ })

let res = await inflicter.ignite( clerobee.generate(), null, '', 'Alizee.dormir' )
let res = await inflicter.request( clerobee.generate(), null, '', 'Alizee.dormir' )
expect(res).to.eql( 'Non, non, non!' )

@@ -111,0 +111,0 @@ })

@@ -8,6 +8,6 @@ module.exports = {

},
echo: async function ( message, terms, ignite ) {
echo: async function ( message, terms ) {
return message
},
dormir: async function ( terms, ignite ) {
dormir: async function ( terms ) {
let self = this

@@ -14,0 +14,0 @@ setTimeout( async () => { console.log( '>>>>>>>>>', JSON.stringify( await self.harconEntities() ) ) }, 3000 )

@@ -7,8 +7,8 @@ module.exports = {

},
echo: async function ( message, terms, ignite ) {
echo: async function ( message, terms ) {
return message
},
dormir: async function ( terms, ignite ) {
return await ignite( 'Chris.dormir' )
dormir: async function ( terms ) {
return terms.request( 'Chris.dormir' )
}
}
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