
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Leo Nodejs SDK
A Nodejs interface to interact with the Leo Platform
Quick Start Guide: https://github.com/LeoPlatform/Leo
Documentation: https://docs.leoplatform.io
npm install leo-sdk
To load data onto the bus on AWS, you need to have a valid leo_config.js file. If you don't have one already, the easiest way to create one is to create a quickstart project and let the system configure the AWS settings for you.
Note: If you're using the SDK within a microservice, we bootstrap the config for you, otherwise you'll have to specify the path to your leo_config.js.
Bash example:
export leo_config_bootstrap_path='/path/to/leo_config.js'
Javascript example:
process.env.leo_config_bootstrap_path = '/path/to/leo_config.js';
Next, you'll have to make sure your NODE_ENV matches the environment configured in leo_config.js.
Now you can write to the new Stream:
let leo = require("leo-sdk");
let botId = "producerBotId";
let queueName = "queueName";
let stream = leo.load(botId, queueName);
// Write 10 events to the leo bus
for (let i = 0; i < 10; i++) {
stream.write({
now: Date.now(),
index: i,
number: Math.round(Math.random() * 10000)
});
}
stream.end(err=>{
console.log("All done loading events", err);
});
Next in order to read from the stream
let leo = require("leo-sdk");
let botId = "offloadBotId";
let queueName = "queueName";
leo.offload({
id: botId,
queue: queueName,
each: (payload, meta, done) =>{
console.log(payload);
console.log(meta);
done(null, true); // Report this event was handled
}
}, (err)=>{
console.log("All done processing events", err);
});
You can also enrich from one queue to another
let leo = require("leo-sdk");
let botId = "enrichBotId";
let inQueueName = "queueName";
let outQueueName = "enrichedQueueName";
leo.enrich({
id: botId,
inQueue: inQueueName,
outQueue:outQueueName,
// optional batch parameter:
batch: 50, // batch every 50 records, or:
// optional batch as object with optional parameters:
batch: {
count: 50, // batch every 50 records, or:
bytes: 500, // batch every 500 bytes, or:
time: 1000, // batch every 1000 milliseconds (1 second)
},
each: (payload, meta, done) =>{
// Add new data to the event payload
done(null, Object.assign({
enriched: true,
numberTimes2: payload.number * 2,
enrichedNow: Date.now()
}, payload));
}
}, (err)=>{
console.log("All done processing events", err);
});
Want to hire an expert, or need technical support? Reach out to the Leo team: https://leoinsights.com/contact
FAQs
Load data onto the LEO Platform
We found that leo-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.