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

@nqminds/verifiable-schemas-toolchain

v2.1.0-alpha.2

Published

A repo for the management and storage of Verifiable credentials

Downloads

187

Readme

vc-toolchain

A repo for the management and storage of Verifiable credentials

Commands Summary

new-schema <schema-name>

Create a new schema.

Bash:

node bin/cli.js new-schema  <schema-name>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');
schemaTools.newSchema(schema-name)

validate-schemas <yaml_filepath>

Validate (master).yaml schemas in the specified directory.

Bash:

node bin/cli.js validate-schemas <yaml_filepath>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');
schemaTools.validateSchemas(yaml_filepath)

parse-yaml-files <yaml_filepath> [options]

Parse (master).yaml files into corresponding schemas and examples.

Options:

  • --output <string>: Output directory (default: "output/")
  • --template <string>: Template name (default: "markdown")

Bash

node bin/cli.js parse-yaml-files <path_to_schemas_dir>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');
schemaTools.parseYamlFiles(path_to_output_dir, path_to_mdx_template_dir)

generate-docusaurus-files <yaml_filepath> <output_dir> <hedgedoc_server> [options]

Parse (master).yaml files into corresponding schemas and examples into a Docusaurus MDX format.

Options:

  • --relative-path <relative_path>: Relative path to files from root (if null will use yaml_filepath)
  • --add-form-link: Include a form link in the generated files (default: false)

Bash

node bin/cli.js generate-docusaurus-files <yaml_filepath> <output_dir> <hedgedoc_server>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');
schemaTools.generateDocusaurusFiles(yaml_filepath, output_dir, hedgedoc_server);

parse-yaml-to-table <yaml_filepath> [options]

Parse a YAML file or a JSON file and convert it to an HTML table in an MDX file or a Markdown table.

Options:

  • --output <string>: Output directory (default: "output/")
  • --html: Generate an HTML table in an MDX file
  • --md: Generate a markdown table
  • --columns <items>: Select the properties to keep
  • --content <string>: Add additional content to the MD file
  • --addCellLink: Make first cell a hyperlink, must provide a mainUrl as well (default: false)
  • --mainUrl <string>: Main URL to point to. Link will be formatted as mainUrl/first_cell_name

Bash

node bin/cli.js parse-yaml-to-table <yaml_filepath> --output <path_to_output_dir> --html --md --columns <items> --content <string> --addCellLink --mainUrl <string>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');
schemaTools.parseYamlToTable(yaml_filepath, path_to_output_dir, format, columns, content, addCellLink, mainUrl);

Example

# Input
$id: https://github.com/nqminds/TAIBOM/blob/main/packages/schemas/ai-system-checks.yaml
$schema: https://json-schema.org/draft/2019-09/schema
title: Taibom AI system checks
description: Declaration a snapshot of the trained system has been checked.
type: object
properties:
  systemId:
    type: string
    description: ID of the AI system snapshot
  systemName:
    type: string
    description: Name of the AI system snapshot
  systemVersion:
    type: string
    description: AI system version
  systemCheck:
    type: string
    description: System check which was performed
  dateTime:
    type: string
    format: datetime
    description: Date & time of check
required:
  - systemId
  - systemName
  - systemVersion
  - systemCheck
  - dateTime
examples:
  - systemId: SYSTEM_ID_1
    systemName: System 1
    systemVersion: 1.0.0
    systemCheck: Data poisioning
    dateTime: "2023-12-15T08:30:00.000Z"
;
# output
systemId    | systemName | systemVersion | systemCheck     | dateTime
:---------- | :--------- | :------------ | :-------------- | :-----------------------
SYSTEM_ID_1 | System 1   | 1.0.0         | Data poisioning | 2023-12-15T08:30:00.000Z

get-json-schema <schema_id> [options]

Get the location of a schema.

Options:

  • --schemas-store <string>: Base directory of where schemas are stored

Bash

node bin/cli.js get-json-schema <schema_id> --schemas-store <path_to_schemas_store>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');
schemaTools.getSchema(schema_id, path_to_schemas_store);

process-requirements <yamlFile> [options]

Process requirements from a specified YAML file.

Options:

  • --output-path <string>: Path to the specified output source directory
  • --file-name: Optional file name (default: false)

Bash

node bin/cli.js process-requirements <yamlFile> --output-path <path_to_output_dir> --file-name <optional_file_name>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');
schemaTools.processRequirements(yamlFile, path_to_output_dir, file_name);

get-schema-files <directoryPath> <fileType>

Retrieve a list of schema files.

Bash

node bin/cli.js get-schema-files <directoryPath> <fileType>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');
schemaTools.getSchemaFiles(directoryPath, fileType);

find-directory <srcDir> <tarDir>

Retrieve the path of a target directory.

Bash

node bin/cli.js find-directory <srcDir> <tarDir>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');

// example dir: /schemas/output/https:/github.com/nqminds/IoTSF/tree/main/packages/schemas/src/authentication-&-authorisation/v1.0.0/claims
const src = 'schemas/';
const tarDir = 'claims';
const myDir = schemaTools.findDirectory(srcDir, tarDir);

console.lg(myDir);

/schemas/output/https:/github.com/nqminds/IoTSF/tree/main/packages/schemas/src/authentication-&-authorisation/v1.0.0/claims

get-name-version <schemaID>

Retrieve name and version from schema ID.

Bash

node bin/cli.js get-name-version <schemaID>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');


// Example
const schemaId = 'https:/github.com/nqminds/IoTSF/tree/main/packages/schemas/src/authentication-&-authorisation.v1.0.0.schema.yaml'
const nameVersion = schemaTools.getNameAndVersion(schemaID);

nameVersion.name = 'authentication-&-authorisation'
nameVersion.version = 'v1.0.0'

parse-yaml-to-xlsx <yamlFilePath> <outputPath>

Convert schemas to XLSX.

Bash

node bin/cli.js parse-yaml-to-xlsx <yamlFilePath> <outputPath>

Java Script

const schemaTools = require('@nqminds/verifiable-schemas-toolchain');
schemaTools.parseYamlToXlsx(yamlFilePath, outputPath);