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

fvideen-gundb-sdk

v0.0.1

Published

FVI - GunDB SDK Client JS Library

Downloads

1

Readme

FVIdeen - GunDB SDK Client Library

Examples

Clone it

  • git clone <this-repo-url>
  • cd <repo-name>

Install

  • npm run install

Build

  • npm run build

Dev

  • npm run dev

Test

  • npm run test

How to use

  • Includes script into html page
    <script src="../dist/fvideen-gundb-sdk.js"></script>

OR

  • Includes require statament in node file
const { SdkClient } = require('fvideen-gundb-sdk')
  • Instantiate new SDK from static asset javascript sdk bundle

  <script type="text/javascript">
      const sdk = new window['fvideen-gundb-sdk'].SdkClient('fvideen.local.1', [avaliacao + '/gun'])
  </script>

OR

  • Instantiate class into node file
const sdk = new SdkClient(
  'db-namespace', 
  ['http://server-peer:1/gun', 'http://server-peer:2/gun', 'http://server-peer:3/gun']
  axios, // (Optional) Custom axiosInstance or SDK creates new one
  gun// (Optional) Custom IGunChainReference to wrapper SDK with db namespace, etc
  )
  • Retrieve a root node, gets new node and subscribe it
  <script type="text/javascript">
      sdk
        .node() // gets root node
        .get('styles/input/h1') // gets new node from root node
        .on((item, id) => { // subscribe on created/updated data in this new node
          if (!item) return
          console.log('#>>', id) // the new node key, e.g. 'styles/input/h1'
          console.log('#>>', item) // the item created/updated in this new node
        })
  </script>
  • Set and retrieve a root child node like an array list items
  <script type="text/javascript">
    // Id to todo, this should have unique identification for each todo into list
    const todoId = 1
    // Gets new root child node to todo node
    const todoNode = sdk.node().get(todoId) 
    // Put todo data
    todoNode.put({ id: todoId, title: 'Sync internet data for free to everbody =)' })
    // Gets new root child node to todo list
    const todoListNode = sdk.node().get('todos')

    // Adds todo node into todo array list node, this is a link ref only into graph
    todoNodeList.set(todoNode)

    // Maps all items into this list and subscribe each item into array list
    todoListNode
      .map() 
      .on((todo, id) => { 
        console.log('#>>', id) // internal id created from sdk to item into array list 
        console.log('#>>', todo) // todo item created/updated in this array list node of To Do's
      })
  </script>

Scripts

  • npm run build: Build library.
  • npm run dev: Run dev mode, waiting for changes to run lint and unit tests.
  • npm run test: Run mocha unit tests.
  • npm run compile: Clean temp files and e directories.
  • npm run coverage: Run unit tests and coverage with nyc.
  • npm run release: Init git flow release from next package version, patch, git flow.
  • npm run release:minor: Init git flow release from next package version, minor, git flow.
  • npm run release:major: Init git flow release from next package version, major, git flow.
  • npm run release:finish: Finish current releas, git flow.