npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bamboo-wasm

v0.3.0

Published

** Note this readme does not reflect the state of the code. The code is nowhere near having all this working **

Downloads

4

Readme

bamboo-wasm

** Note this readme does not reflect the state of the code. The code is nowhere near having all this working **

** All that "works" at the moment is that you can publish a message **

bamboo compiled to wasm from rust

The goal of this module is to allow you to publish new entries or add valid exisiting entries to a bamboo Log.

Conceptually, a Log is a collection of Entries published by a single author. Bamboo supports partial replication. Partial replication means a Log may not contain all Entries ever published by an author.

This module has no opinions about where you store the log. You could use leveldb or sqlite or IndexedDB if this is used in the browser. You could also just store entries in an object or array if you want to store in memory. When constructing a Log you must provide a store object that implements some required methods (see below.)

Note that a Log does not store the payload, it only stores the hash the of the payload in the entry. This module has no opinions about where you store the payload. Ideally you'll want to be able to access payloads by their hash.

Example

Publish a new entry.

  import { Log, MemoryStore } from 'bamboo-wasm';

  const { public, secret } = // Get a keypair from somewhere.
  const store = new MemoryStore()

  const log = new Log({store, public, secret})

  const myMessage =  // what type here, need to see what wasm bindgen provides 

  log.publish(myMessage)
    .then(({payloadHash}) => {
      console.log(`Published payload successfully, payload had hash: ${payloadHash}`)
      
      // Here you would want to store the payload too. 
    })
    .catch(() => {})

Add existing entries that have already been published. Typically you'd do this when you've replicated messages from another author.

  import { Log, MemoryStore } from 'bamboo-wasm';

  const { public } = // Get the public key of this `Log` 
  const store = new MemoryStore()

  const log = new Log({store, public})

  const messages = [..] // what type here, need to see what wasm bindgen provides 

  log.add(messages)
    .then(() => {
      console.log(`Added messages successfully`)
    })
    .catch(() => {})

Api

The store object: You need to provide a store object that is an abstraction over an asynchronous datastore.

{
  // Must return a Promise of an Integer
  getLastSeq: function(){
  
  },

  // Must return a Promise of Uint8Array
  getEntry: function(sequenceNumber){
  
  },

  // `entry` is a Uint8Array  
  // `sequenceNumber` is an Integer
  // Must return a Promise of `null`.
  addEntry: function(entry, sequenceNumber){
  
  },
}

🛠️ Build with wasm-pack build

wasm-pack build

🔬 Test in Headless Browsers with wasm-pack test

wasm-pack test --headless --firefox

🎁 Publish to NPM with wasm-pack publish

wasm-pack publish

🔋 Batteries Included