
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
stellar-integration
Advanced tools
You need to have a config.json configuration file in your project root folder.
Here is the default configuration:
{
"rabbitmq": "amqp://localhost"
}
const stellar = require('stellar-integration')
// listen to port 1234
const PORT = 1234
// code
stellar.listen(PORT)
const redirect = stellar.redirect
const parallel = stellar.parallel
const rpc = stellar.rpc
const push = stellar.push
const peek = stellar.peek
const pop = stellar.pop
const pipeline = stellar.pipeline
let router1 = stellar.router()
let router2 = stellar.router('/prefix')
Simple body writer:
router.get('/hello')
.then(function(req, res) {
res.body = "Hello world"
this.next(res) // Continue the pipeline
})
// Available router methods: get,post,put,delete,when
You can push and peek/pop requests through the pipeline
router.get('/hello')
.then(function(req, res) {
res.body = "Hello world"
this.next(res) // Continue the pipeline
})
.then(push())
.then(function(req, res) {
res.body = 'RANDOM'
this.next(res)
})
.then(pop()) // body is now "Hello World"
router.get('/google')
.then(redirect('https://google.com'))
// GET request to post
router.when('/get-to-post/:id', 'GET')
.then(redirect('https://requestb.in/1glh67p1', function(req) {
req.method = 'POST'
req.body = {
id: req.params.id,
filter: req.query.filter || 'default'
}
}))
// error if one parallel endpoint fails
router.get('/parallel')
.then(
parallel()
.with(redirect(ENDPOINT_1))
.with(redirect(ENDPOINT_2), {default: {hello: "ko"}})// default return value
.with(redirect(ENDPOINT_3), {default: {hello: "ko"}, timeout: 1}) // default value and timeout (ms)
.aggregate(function(results, res) {
res.body = [{aggregate: results.map((r) => r.body)}]
this.next(res)
})
)
// do not break the pipeline if an error occurs
router.get('/parallel')
.then(
parallel()
.with(redirect(ENDPOINT_1))
.with(redirect(ENDPOINT_2), {default: {hello: "ko"}})// default return value
.with(redirect(ENDPOINT_3), {default: {hello: "ko"}, timeout: 1}) // default value and timeout (ms)
.aggregate(function(results, res) {
res.body = [{aggregate: results.map((r) => r.body)}]
this.next(res)
}, {exitOnError: false})
)
router.post('/rpc')
.then(rpc("users.createUser"))
// Example with get request
router.get('/rpc')
// Transform request, create our user
.then(function(req, res) {
res.body = {
name: req.query.name || "toto"
}
this.next(res)
})
// rpc to (users).createUser({name: 'toto'})
.then(rpc("users.createUser"))
// with timeout (in ms)
router.get('/rpc-timeout')
// Transform request, create our user
.then(function(req, res) {
res.body = {
name: req.query.name || "toto"
}
this.next(res)
})
// rpc to (users).createUser({name: 'toto'})
.then(rpc("users.createUser", {timeout: 100}))
Here is an example of the users service handling the rpc calls:
let events = require('stellar-integration').events
let listen = events.listen('users', 100) // Handle at max 100 rpc calls at once
listen('createUser', (user, callback) => {
let user = {name: user.name, id: Math.random().toString()}
callback(user)
})
router.post('/event')
.then(event("users.notify"))
// Example with get request
router.get('/event')
// Transform request, create our user
.then(function(req, res) {
res.body = {
name: req.query.name || "toto"
}
this.next(res)
})
// rpc to (users).createUser({name: 'toto'})
.then(event("users.notify"))
Here is an example of the users service handling the event calls:
let events = require('stellar-integration').events
let listen = events.listen('users', 100) // Handle at max 100 events at once
listen('notify', (user, callback) => {
console.log('Notifying user', user)
callback() // so the event queue knows we are done processing the event
})
You can use the pipeline dsl to create pipelines:
let myPipeline = pipeline()
.then(function(req,res) {
res.body = 'Hello'
this.next(res)
})
.then(function(req,res) {
res.body = req.body + ' World'
this.next(res)
})
.build()
router.get('/hey')
.then(myPipeline)
You can use the clause and split dsl to create splits:
let clause = stellar.clause
let myPipeline = pineline()
.then(function(req,res) {
res.body = 'Hello'
this.next(res)
})
.split([
clause(function(req) {return req.body == 'Hello'}, function(req, res) {
res.body += ' world'
this.next(res)
}),
clause(function(req) {return req.body != 'Hello'}, function(req, res) {
res.body = 'This should not happen...'
this.stop(res)
})
])
.build()
router.get('/split')
.then(myPipeline)
WIP Available plugins:
FAQs
GamesLabs Stellar integration module
The npm package stellar-integration receives a total of 6 weekly downloads. As such, stellar-integration popularity was classified as not popular.
We found that stellar-integration demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.