Registry / web-framework / seneca-basic

seneca-basic

JSON →
library1.0.0jsnpmunverified

seneca-basic is a foundational utility plugin for the Seneca.js microservices framework. It provides a small, essential set of action patterns for internal per-process communication, primarily through a 'notes' mechanism, allowing plugins to store and retrieve keyed values or lists. These patterns include `set`, `get`, `push`, `list`, and `pop` for `role:basic, note:true` actions. The package is often bundled by default within the main `seneca` module, simplifying its integration for most users. Its current stable version is 1.0.0, though the latest detailed release notes visible are from v0.5.0 in 2016, indicating a mature and stable, rather than rapidly evolving, project. Release cadence is infrequent, likely tied to Seneca's own maintenance cycles. Its key differentiator is its tightly integrated role within the Seneca ecosystem, providing a lightweight, built-in mechanism for internal plugin coordination without external dependencies.

web-frameworkworkflowdata
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.

Seneca.js, and by extension seneca-basic, primarily uses CommonJS `require` for module loading. Direct ESM `import` is not supported without a CommonJS wrapper or bundler.

const seneca = require('seneca')

The plugin is typically loaded via `seneca.use()` with a CommonJS `require`. Ensure 'basic' is disabled in `default_plugins` if you're loading it explicitly.

seneca.use(require('seneca-basic'))

To explicitly load `seneca-basic`, you must first disable the default inclusion of the 'basic' plugin when initializing Seneca.

const seneca = require('seneca')({ default_plugins: { 'basic': false } })

This quickstart initializes Seneca, explicitly loads the seneca-basic plugin, and demonstrates setting, getting, pushing, listing, and popping 'note' values.

const seneca = require('seneca')({ default_plugins: { 'basic': false } }) seneca.use(require('seneca-basic')) async function run() { // Set a note await seneca.act({ role: 'basic', note: true, cmd: 'set', key: 'myKey', value: 'Hello Seneca!' }) console.log('Note 'myKey' set.') // Get a note const resultGet = await seneca.act({ role: 'basic', note: true, cmd: 'get', key: 'myKey' }) console.log(`Retrieved 'myKey': ${resultGet.value}`) // Push to a list await seneca.act({ role: 'basic', note: true, cmd: 'push', key: 'myList', value: 10 }) await seneca.act({ role: 'basic', note: true, cmd: 'push', key: 'myList', value: 20 }) console.log('Pushed values to 'myList'.') // Get the list const resultList = await seneca.act({ role: 'basic', note: true, cmd: 'list', key: 'myList' }) console.log(`Retrieved 'myList': ${resultList.value}`) // Pop from the list const resultPop = await seneca.act({ role: 'basic', note: true, cmd: 'pop', key: 'myList' }) console.log(`Popped from 'myList': ${resultPop.value}`) const finalResultList = await seneca.act({ role: 'basic', note: true, cmd: 'list', key: 'myList' }) console.log(`'myList' after pop: ${finalResultList.value}`) await seneca.close() console.log('Seneca instance closed.') } run().catch(console.error)
Debug
Known footguns
breakingVersion 0.5.0 of seneca-basic dropped support for Node.js versions 0.10, 0.12, and 5. Ensure you are running Node.js 6 or higher for compatibility.
gotchaseneca-basic is typically included by default when you initialize a Seneca instance. If you intend to explicitly load it via `seneca.use(require('seneca-basic'))`, you must disable its default inclusion first, otherwise the plugin may be registered twice or behave unexpectedly.
gotchaThis package, like the core Seneca.js framework, is built with CommonJS modules in mind. Attempting to use ES module `import` syntax directly will result in errors in a standard Node.js environment without a transpiler or CommonJS wrapper.
gotchaThe package's primary purpose is for internal note-taking within a Seneca microservice process. It is not designed as a general-purpose key-value store or inter-process communication mechanism across different microservices or external applications.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources