
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
ask-lowdb-persistence-adapter
Advanced tools
An Alexa Skills Kit persistence adapter for lowdb.
For deployed Alexa Skills, you should use a proper persistence layer (for example Amazon S3 using the ask-sdk-s3-persistence-adapter), but for local development S3 can be awkward to use. Using lowdb is great because it saves the data locally making it easy to debug and work with.
Install adapter:
npm i ask-lowdb-persistence-adapter
Install peer dependencies:
npm i lowdb
Basic usage:
const LowdbPersistenceAdapter = require("ask-lowdb-persistence-adapter");
// ...
const options = {
// the name of the lowdb database, default value shown here
dbName: "persistenceAttributes.db.json",
// the name of the key to store persistence attributes under in the
// database, default value shown here
attributesKey: "persistenceAttributes",
};
Alexa.SkillBuilders.custom()
.withPersistenceAdapter(new LowdbPersistenceAdapter(options))
.addRequestHandlers(/* ... */)
.lambda();
Since the primary purpose of this adapter is for use locally when a proper persistence layer is unavailable, a nice pattern for creating your persistence adapter is to use a factory. For example, if one wanted to use S3 when it was available and lowdb otherwise, one could implement it like so:
const LowdbPersistenceAdapter = require("ask-lowdb-persistence-adapter");
const S3PersistenceAdapter = require("ask-sdk-s3-persistence-adapter")
.S3PersistenceAdapter;
class PersistenceAdapterFactory() {
constructor(s3BucketName) {
this.s3BucketName = s3BucketName;
}
createPersistenceAdapter() {
if (this.s3BucketName) {
return new S3PersistenceAdapter({
bucketName: this.s3BucketName
});
} else {
return new LowdbPersistenceAdapter();
}
}
}
// ...
const persistenceAdapterFactory = new PersistenceAdapterFactory(process.env.S3_PERSISTENCE_BUCKET);
Alexa.SkillBuilders.custom()
.withPersistenceAdapter(persistenceAdapterFactory.createPersistenceAdapter())
.addRequestHandlers(/* ... */)
.lambda();
FAQs
An Alexa Skills Kit persistence adapter for Lowdb
We found that ask-lowdb-persistence-adapter 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.