0.6.0 • Published 2 years ago

@holochain/devhub-entities v0.6.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

npm.io

DevHub Entity Architecture

A Javascript library for deconstructing DevHub response payloads.

Overview

This package defines Entity models for the Holochain DevHub project using the @whi/entity-architect library.

Install

npm i @holochain/devhub-entities

Basic usage

Schema

const { Schema } = require('@holochain/devhub-entities');

const ID = Buffer.from("hCEkEvFsj08QdtgiUDBlEhwlcW5lsfqD4vKRcaGIirSBx0Wl7MVf", "base64");
const HEADER = Buffer.from("hCkkn_kIobHe9Zt4feh751we8mDGyJuBXR50X5LBqtcSuGLalIBa", "base64");
const ADDRESS = Buffer.from("hCEkU7zcM5NFGXIljSHjJS3mk62FfVRpniZQlg6f92zWHkOZpb2z", "base64");
const AUTHOR = Buffer.from("hCAkocJKdTlSkQFVmjPW_lA_A5kusNOORPrFYJqT8134Pag45Vjf", "base64");

Schema.deconstruct( "entity", {
    "id": ID,
    "header": HEADER,
    "address": ADDRESS,
    "type": {
        "name": "dna",
        "model": "info",
    },
    "content": dna_info
});
// Entity { ...dna_info }

Client

This client will automatically parse Essence packages and deconstruct Entity payloads using Schema.

const { Client } = require('@holochain/devhub-entities');

const client = new Client( cell_agent, {
    [dna_nickname]: dna_hash,
}, app_port );

let response = client.call( dna_nickname, zome_name, fn_name, args );

Contributing

See CONTRIBUTING.md

0.6.0

2 years ago

0.5.0

2 years ago

0.4.2

2 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago