Registry / database / seneca-mem-store

seneca-mem-store

JSON →
library9.4.0jsnpmunverified

An in-memory data storage plugin for the Seneca.js microservices toolkit. It provides a non-persistent storage engine implementing the Seneca entity API for early development and unit testing. Version 9.4.0 is the current stable release, compatible with Seneca 3.x and 4.x. It is loaded by default and requires the seneca-entity and seneca-basic plugins. Differentiators include zero configuration, simple setup, and full support for the Seneca query specification (filtering, sorting, pagination). Ideal for prototyping and testing scenarios where data persistence is not needed.

npm install seneca-mem-store
INSTALL
IMPORT
SIG · SENECA-MEM-STORE
S
seneca-mem-store
databasejavascriptv9.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const Seneca = require('seneca'); const seneca = Seneca(); seneca.use('mem-store');
const Seneca = require('seneca-mem-store');
This is a plugin, not a standalone module.
TypeScript types
import Seneca from 'seneca'; const seneca = Seneca(); seneca.use('mem-store');
import senecaMemStore from 'seneca-mem-store';
TypeScript types are shipped, but usage is through Seneca instance.
Plugin registration
seneca.use('mem-store')
seneca.use(require('seneca-mem-store'))
The plugin is auto-loaded if you use seneca-entity; explicit use() is optional.

Demonstrates creating an entity, saving it to the in-memory store, and loading it back by id.

const Seneca = require('seneca'); const seneca = Seneca(); seneca.use('basic').use('entity'); // mem-store is loaded by default, no explicit use() needed. seneca.ready(() => { const apple = seneca.make$('fruit'); apple.name = 'Pink Lady'; apple.price = 0.99; apple.save$((err, saved) => { console.log('Saved with id:', saved.id); // load it back seneca.make$('fruit').load$({ id: saved.id }, (err2, loaded) => { console.log('Loaded:', loaded.name); }); }); });
Debug
Known issues
breakingIn version 9.x, the plugin is ESM-only. Any require() will fail on Node.js versions that don't support ESM fully.
fix
Use import syntax or upgrade to Node.js 14+ with --experimental-modules flag (deprecated) or use dynamic import.
affects: >=9.0.0
breakingSeneca 4.x version requires changes in plugin registration (use('mem-store') instead of older patterns).
fix
Ensure you are using Seneca 3.x or 4.x with compatible API.
affects: >=9.0.0 && <10.0.0
deprecatedThe older Seneca 2.x support was dropped after version 8.x.
fix
Upgrade to Seneca 3.x or higher.
affects: >=9.0.0
gotchaData does not persist between runs. Do not use for production data.
fix
Use a persistent store plugin like seneca-postgres-store for production.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'seneca-mem-store'
Trying to require the plugin directly as a standalone module.
fix
Install seneca and seneca-mem-store, then use seneca.use('mem-store').
TypeError: seneca.make$ is not a function
Missing the seneca-entity plugin.
fix
Add seneca.use('entity') after basic plugin.
Error: Plugin mem-store not found
mem-store not installed or not registered via use().
fix
Run npm install seneca-mem-store and add seneca.use('mem-store').
Upgrade
Version history
9.4.0latest on npm
Audit
Dependencies
senecarequiredCore Seneca framework required to use the plugin.
seneca-entityrequiredProvides the ActiveRecord-style data storage API that this plugin implements.
Agent activity
11 hits · last 30 days
node
8
Meta
1
Resources
seneca-mem-store — npm install seneca-mem-store · libregistry