
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Leo Nodejs SDK
A Nodejs interface to interact with the Leo Platform
Documentation: https://docs.leoplatform.io
npm install leo-sdk --save
You can now configure a profile that will be used with your sdk similar to the way the AWS SDK works. To do this, you must execute a command line script and enter in your configuration settings.
Issue the following command from your project directory, you will be prompted for the values:
node node_modules/leo-sdk/generateProfile.js -r us-west-2 LeoSdkStack
This will create a file in your home directory ~/.leo/config.json
that contains your settings. You can setup multiple profiles just like you can do with the AWS SDK by specifying a different Stack.
Now you can write to the new Stream
var leo = require("leo-sdk");
var botId = "producerBotId";
var queueName = "queueName";
var 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
var leo = require("leo-sdk");
var botId = "offloadBotId";
var 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
var leo = require("leo-sdk");
var botId = "enrichBotId";
var inQueueName = "queueName";
var outQueueName = "enrichedQueueName";
leo.enrich({
id: botId,
inQueue: inQueueName,
outQueue:outQueueName,
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);
});
{
"LeoSdkStack": {
"region": "${Region}",
"kinesis": "${LeoKinesisStream}",
"s3": "${LeoS3}",
"firehose": "${LeoFirehoseStream}",
"resources": {
"LeoStream": "${LeoStream}",
"LeoCron": "${LeoCron}",
"LeoEvent": "${LeoEvent}",
"LeoSettings": "${LeoSettings}",
"LeoSystem": "${LeoSystem}",
"LeoS3": "${LeoS3}",
"LeoKinesisStream": "${LeoKinesisStream}",
"LeoFirehoseStream": "${LeoFirehoseStream}",
"Region": "${Region}"
}
}
}
FAQs
Load data onto the LEO Platform
The npm package leo-sdk receives a total of 655 weekly downloads. As such, leo-sdk popularity was classified as not popular.
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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.