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 🙏

© 2026 – Pkg Stats / Ryan Hefner

og-one-in-sdk

v1.0.11

Published

Based on the OG One In token, render HTML based on permissions of the user. The result will be sorted and filtered according to role groups and user groups (i.e. filtered HTML).

Downloads

0

Readme

OG ONE IN SDK

Based on the OG One In token, render HTML based on permissions of the user. The result will be sorted and filtered according to role groups and user groups (i.e. filtered HTML).

Usage

The OG ONE IN SDK is simply a package that accepts HTML data as an input. In return, you will receive...

  • filtered data based on user and permissions

Install

    npm i og-one-in-sdk

Examples:

Initialize (INIT):

import { RoleBasedHtml } from "og-one-in-sdk";
const roleBasedHtml = new RoleBasedHtml();

steps

step 1: Assign a data-id to an html element tag

To filter based on user groups or role groups, add data-id=[RESOURCE_NAME] to any div or HTML element

EXAMPLE

<div class="container" data-id="resource1">
  <h1>this is section 1</h1>
</div>
<div class="container" data-id="resource2">
  <h1>this is section 2</h1>
</div>

step 2: use filter to render role base frontend view

Pass the compiled HTML and Og-One-In Token to the filter method

const filterHtml = await roleBasedHtml.filter(page, token);

Note:

  • To render the filter view, use the filter response and assign it to the wrapper
  • To render the view, convert the response HTML string to HTML

Demo snippet (REACT)

import { RoleBasedHtml } from "og-one-in-sdk";
import React, { useState, useEffect } from "react";
import ReactHtmlParser from "react-html-parser";

const roleBasedHtml = new RoleBasedHtml();
function App() {
  const [html, setHtml] = useState();

  const token =
    "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2MDQwN2QyNGJjN2QyNDAwMDFjMTZjZDYiLCJiaWQiOiI1Iiwic3ZjIjoiMSIsInRybSI6IjEiLCJyb2xlcyI6WyJzZXJ2aWNlQWRtaW4iLCJBbGwgQWRtaW4gUm9sZSJdLCJyb2xlQ29sbGVjdGlvbnMiOltdLCJyb2xlc1Jlc291cmNlc1Blcm1pc3Npb25zIjpbeyJSb2xlTmFtZSI6InNlcnZpY2VBZG1pbiIsIlJlc291cmNlUGVybWlzc2lvbnMiOltdfSx7IlJvbGVOYW1lIjoiQWxsIEFkbWluIFJvbGUiLCJSZXNvdXJjZVBlcm1pc3Npb25zIjpbeyJSZXNvdXJjZU5hbWUiOiJBbGwgQWRtaW4gUmVzb3VyY2VzIiwiQ2FuUmVhZCI6dHJ1ZSwiQ2FuQ3JlYXRlIjpmYWxzZSwiQ2FuVXBkYXRlIjpmYWxzZSwiQ2FuRGVsZXRlIjpmYWxzZX1dfV0sImlzcyI6Imh0dHBzOi8vc2VydmljZXMub2dzdGFjay5jb20vb25laW4vYXV0aCIsImp0aSI6IjgxNDI1YTBjLTU1YjUtNGI4NS1iMDllLTBjMDVhYmJmMThkMiIsImV4cCI6MTY0MTQ3MTYyNCwiaWF0IjoxNjQxNDY0NDI0fQ.1O-kEuPbLB_qYG-UkBj2V84rhtfO9pSf6ehU6ETFKfs";

  const stringhtml = `
  <div class="role1" data-id="resource1">
  <h1>this is section 1 for role 1</h1>
  </div>
  
  <div class="role2" data-id="all-admin-resources">
  <h1>this is section 2 for role 2</h1>
  </div>

  <div class="role3" data-id="resource2">
  <h1>this is section 3 for role 3</h1>
  </div>`;

  const fnfilterHtml = async () => {
    const filterHtml = await roleBasedHtml.filter(stringhtml, token);
    return filterHtml;
  };

  useEffect(() => {
    fnfilterHtml().then((data) => {
      setHtml(data);
    });
  }, []);

  return <div className="App">{ReactHtmlParser(html)}</div>;
}

export default App;