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

@51nodes/decentralized-schema-registry

v0.1.1

Published

Library for DID based schema registry CRUD operations

Downloads

7

Readme

Schema Registry DID CRUD v0.01

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Build library

  1. npm install
  2. npm run test
  3. npm run build

Run unit tests

  1. npm run test

Import library in your code

  • npm install @51nodes/decentralized-schema-registry
import {initLibrary, registerSchema, getSchema, SchemaType, Network} from '@51nodes/decentralized-schema-registry'

// required configuration for the library
const configObject: ConfigObject = {
  publicIpfsConfig: {
    nodeUrl:'<ipfs node url>' // e.g. 'https://ipfs.infura.io:5001/api/v0',
    enablePin: true // the given node should support pinning (otherweise an error will be shown)
  },
  evanRuntimeConfig: {
    accountMap: {
      '<evan account Id>':'<evan private key>'
      /** WARNING: The provided evan account and private key are published on gitHub and only for example purposes,
          therefore do not use this private key in your configuration and on any network.
          Creating an evan account can be done using the evan.network dashboard
          https://dashboard.evan.network/#/dashboard.vue.evan/onboarding.vue.evan/sign-up 
          e.g. '0x8370F91b6Cdf7A15a7C48593c8Cba98C55B25e25':'50a635f2797d04e93c3c5d799099e42dbf116dcc04867ad6fbce83f1ec4cdfce'
      */
    },
    ipfs: { host: 'ipfs.evan.network', port: '443', protocol: 'https' }, // or another evan.network ipfs provider
    web3Provider: 'wss://core.evan.network/ws', // or another evan.network web3 provider
    enablePin: true // Require to have EVE balance, monthly payment (otherweise it will not be pinned, and no error will be shown)
  }
}

// a valid json schema to register
const validJsonSchema = `{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "http://example.com/product.schema.json",
    "title": "Item",
    "description": "A product from Acme's catalog",
    "type": "object",
    "properties": {
      "productId": {
        "description": "The unique identifier for a product",
        "type": "integer"
      },
      "productName": {
        "description": "Name of the product",
        "type": "string"
      },
    },
    "required": [ "productId", "productName" ]
  }`

// Functions

function initLibrary(configObject: ConfigObject);
// e.g. initLibrary(configObject);

async function registerSchema(schemaAsString: string, schemaType: SchemaType, network: Network);
//e.g. await registerSchema(validJsonSchema, SchemaType.JsonSchema, Network PublicIpfs);

async function getSchema(did: string);
//e.g. await getSchema('did:schema:public-ipfs:json-schema:QmY8GAAJoffVZBH1JYvta2LRZxsPaUYVQ1FGTaxwK3vV7n')

// utils function
function validateSchemaDid(did: string): boolean;
function parseSchemaDid(did: string): SchemaDid;
function stringifySchemaDid(schemaDidObject: SchemaDid): string;