New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

autobase-flow

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autobase-flow

A high-level Autobase wrapper with a dynamic operator pipeline.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Autobase Flow

Autobase Flow is a high-level wrapper for Autobase that integrates an operator pipeline for efficient update processing. This utility simplifies the creation and management of an Autobase instance while ensuring sequential operation execution.

Features

  • 🚀 Seamless Autobase Setup – Instantiates Autobase with optional key support.
  • 🔗 Operator Pipeline Integration – Supports functional pipelines for processing updates.
  • 📜 Multi-View Support – Manages single or multiple Autobase views with customizable encoding.
  • Efficient Update Handling – Uses an internal queue to ensure sequential writes and updates.

Installation

npm install autobase-flow

Usage

Creating an Autobase Instance

import { createAutobaseWithPipeline } from "autobase-flow";

const autobaseInstance = createAutobaseWithPipeline({
  getCorestore: () => myCorestoreInstance, // Function returning a Corestore
  key: "your-autobase-key", // Optional Z32-encoded string or Buffer
  view: { myView: "json" }, // Single view as an object
  autobaseEncoding: "json", // Default: "json"
  initialOperators: [op1, op2] // Optional array of operator functions
});

Multi-View Example

Autobase Flow supports multiple views, allowing you to define multiple perspectives on the data:

const autobaseInstance = createAutobaseWithPipeline({
  getCorestore: () => myCorestoreInstance,
  view: {
    mainView: "json",
    auditLog: "binary"
  }
});

API

createAutobaseWithPipeline(config)

Creates and returns an Autobase instance with pipeline utilities.

  • config.getCorestore (Function, required): Function returning a Corestore instance.
  • config.key (String | Buffer, optional): Z32-encoded key or Buffer for an existing Autobase.
  • config.view (String | Object | Array, required):
    • If a string, it represents a single view name (default encoding: "json").
    • If an object, it should map view names to their respective encodings.
    • If an array, it should be a list of { name, valueEncoding } objects.
  • config.autobaseEncoding (String, optional, default: "json"): Encoding format for Autobase logs.
  • config.initialOperators (Array of Functions, optional): Initial pipeline operators.
Returned Methods
const {
  autobase,    // The Autobase instance
  base,        // Alias for autobase
  update,      // Updates Autobase
  append,      // Appends data
  getKeys,     // Retrieves Autobase keys
  getView,     // Returns a single or multiple views
  get,         // Retrieves a value from a view
  addOperator, // Adds an operator to the pipeline
  removeOperator, // Removes an operator from the pipeline
  close        // Closes the Autobase instance
} = autobaseInstance;

Example

await autobaseInstance.append({ message: "Hello, Autobase!" });
await autobaseInstance.update();

const view = await autobaseInstance.getView();
console.log(await view.get(0)); // Output: { message: "Hello, Autobase!" }
Multi-View Retrieval
const auditLog = await autobaseInstance.getView("auditLog");
console.log(await auditLog.get(0)); // Output: Binary data for audit logs

License

MIT License © 2025


Keywords

FAQs

Package last updated on 06 Feb 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc