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

@whi/entity-architect

v0.6.2

Published

A Javascript library for deconstructing DNA responses according to the Entity specification

Downloads

17

Readme

Entity Architect (for Holochain)

A Javascript library for deconstructing DNA responses according to the Entity specification.

Overview

This module is intended to help transform DNA responses and reduce data clutter. It is designed to integrate directly after a zome call and seamlessly restructure the contents to more GUI friendly formats.

This is achieved by using Object.definePropterty to hide tracking values such as Entry/Action hashes. It keeps the contextual information available, but out of the way.

Features

  • Modular architecture definitions for supporting multi-DNA GUIs
  • Automatically wrap an Entity's HoloHash properties using @whi/holo-hash
  • Detailed error classes for unexpected input

Install

npm i @whi/entity-architect

Basic usage

const { Architecture, EntityType } = require('@whi/entity-architect');

const SomeType = new EntityType("some_type", content => {
    content.published_at = new Date( content.published_at );
    content.last_updated = new Date( content.last_updated );
});


const schema = new Architecture([ SomeType ]);

schema.deconstruct( "entity", {
    "id": Uint8Array [
        132,  41,  36,  18, 241, 108, 143,  79,
         16, 118, 216,  34,  80,  48, 101,  18,
         28,  37, 113, 110, 101, 177, 250, 131,
        226, 242, 145, 113, 161, 136, 138, 180,
        129, 199,  69, 165, 236, 197,  95
    ],
    "action": Uint8Array [
        132,  41,  36, 159, 249,   8, 161, 177,
        222, 245, 155, 120, 125, 232, 123, 231,
         92,  30, 242,  96, 198, 200, 155, 129,
         93,  30, 116,  95, 146, 193, 170, 215,
         18, 184,  98, 218, 148, 128,  90
    ],
    "address": Uint8Array [
        132,  33,  36,  83, 188, 220,  51, 147,
         69,  25, 114,  37, 141,  33, 227,  37,
         45, 230, 147, 173, 133, 125,  84, 105,
        158,  38,  80, 150,  14, 159, 247, 108,
        214,  30,  67, 153, 165, 189, 179
    ],
    "type": "some_type",
    "content": {
        "published_at": 1624661323383,
        "last_updated": 1624661325451,
        "author": Uint8Array [
            132,  32,  36, 161, 194,  74, 117,  57,  82,
            145,   1,  85, 154,  51, 214, 254,  80,  63,
              3, 153,  46, 176, 211, 142,  68, 250, 197,
             96, 154, 147, 243,  93, 248,  61, 168,  56,
            229,  88, 223
        ],
    }
});
// {
//     [$id]: ActionHash("uhCkkEvFsj08QdtgiUDBlEhwlcW5lsfqD4vKRcaGIirSBx0Wl7MVf"),
//     [$action]: ActionHash("uhCkkn_kIobHe9Zt4feh751we8mDGyJuBXR50X5LBqtcSuGLalIBa"),
//     [$address]: EntryHash("uhCEkU7zcM5NFGXIljSHjJS3mk62FfVRpniZQlg6f92zWHkOZpb2z"),
//     [$type]: "some_type",
//
//     "published_at": Date(1624661325451),
//     "last_updated": Date(1624661325451),
//     "author": AgentPubKey("uhCAkocJKdTlSkQFVmjPW_lA_A5kusNOORPrFYJqT8134Pag45Vjf"),
// }

API Reference

See docs/API.md

Contributing

See CONTRIBUTING.md