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

solarpunk-gsoc

v0.0.1

Published

Graffiti Several Owner Chunk implementation on Swarm network. This is only a clone, to be able to use NPM in swarm-decentralized-chat. Original repository: https://github.com/anythread/gsoc, created by Viktor Levente Tóth (@nugaon)

Downloads

114

Readme

GSOC

This library facilitates to use Graffiti Several Owner Chunks (GSOC) on Ethereum Swarm.

Leveraging its features, any data can be referenced to other related data without maintaing any external registry or running service.

** WARNING! This project is in the experimental phase! **

It is intended to be an upgraded version of the predecessor Graffiti Feed based zerodash library. Missing feature is the reading part though the communication is possible by running storer node and subscribe to incoming infromation signals.

Install

** NPM release will be available later, compile the project instead! **

npm install @anythread/gsoc --save

Usage

The library provides InformationSignal class that reads/writes GSOC according to the consensus and other configuration parameters.

The consensus consists of an arbitrary id and an assert function that validates the handled records in the GSOC address space.

const id = 'SampleDapp:v1'

export interface SampleDappRecord {
  /** text of the message */
  text: string
  /** creation time of the comment */
  timestamp: number
}

function assertRecord(value: unknown): asserts value is SampleDappRecord {
  if (
    value !== null &&
    typeof value === 'object' &&
    Object.keys(value).includes('text') &&
    Object.keys(value).includes('timestamp')
  ) {
    return
  }
  
  throw new Error('The given value is not a valid personal storage record')
}

With that, the rules have been created for kademlia information signaling on any data.

Information Signal

Information Signal class facilitates GSOC data reading based on the passed consensus rules.

import { InformationSignal } from '@anythread/gsoc'

beeUrl = 'http://localhost:1633' // Bee API URL to connect p2p storage network
postageBatchId = '0000000000000000000000000000000000000000000000000000000000000000' // for write operations, the Postage Batch ID must be set.
resourceId = 'demo' // any string/content hash that represents the resource to which the Personal Storage record will be associated.

// initialize object that will read and write the GSOC according to the passed consensus/configuration
informationSignal = new InformationSignal(beeUrl, {
  postageBatchId,
  consensus: {
    id,
    assertRecord,
  },
})

// it is also possible to mine the resourceId to the desired Bee node to ensure they will get the message as soon as possible on the forwarding Kademlia network
targetBeeOverlayAddress = 'b0baf37700000000000000000000000000000000000000000000000000000000'
{ resourceId } = informationSignal.mine(targetBeeOverlayAddress, 16)

// subscribe to incoming topics on the receiver node
// this will immediately invoge `onMessage` and `onError` function if the message arrives to the target neighborhood of the Kademlia network.
cancelSub = informationSignal.subscribe({onMessage: msg => console.log('my-life-event', msg), onError: console.log}, resourceId)

// write GSOC record that satisfies the message format with the `write` method.
uploadedSoc = await informationSignal.write({ text: 'Hello there!', timestamp: 1721989685349 }, resourceId)

Compilation

In order to compile code run

npm run compile

You can find the resulted code under the dist folder.

For types compilation, run

npm run compile:types

Testing

The testing needs running Bee client node for integration testing. You should set BEE_POSTAGE and BEE_POSTAGE_2 environment variable with valid Postage batch IDs.

In order to test on different node than http://localhost:1633 and http://localhost:11633, set BEE_API_URL and BEE_PEER_API_URL environment variable, respectively.

To run test execute

npm run test