# @glazed/datamodel

> Aliases for Ceramic stream references

Latest version **0.3.1** (published 2022-06-21) · (Apache-2.0 OR MIT) license · 0 weekly downloads

## Install

```sh
npm install @glazed/datamodel
pnpm add @glazed/datamodel
yarn add @glazed/datamodel
bun add @glazed/datamodel
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2022-06-21 |
| First published | 2021-08-02 |
| Weekly downloads | 0 |
| License | (Apache-2.0 OR MIT) |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.14 |
| Dependencies | 1 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 124 |
| Author | 3Box Labs |
| Maintainers | zachferland, paul_lecam |
| Keywords | ceramic, glaze |

## Links

- npm: https://www.npmjs.com/package/@glazed/datamodel
- Repository: https://github.com/ceramicstudio/js-glaze
- Homepage: https://github.com/ceramicstudio/js-glaze#readme
- Issues: https://github.com/ceramicstudio/js-glaze/issues
- npm.io page: https://npm.io/package/@glazed/datamodel

## Dependencies (1)

- [@glazed/tile-loader](https://npm.io/package/@glazed/tile-loader.md) ^0.2.1

## Recent versions

- 0.3.1 (latest) — 2022-06-21
- 0.3.0-rc.1 (next) — 2022-04-19
- 0.3.0 — 2022-04-19
- 0.3.0-rc.0 — 2022-04-01
- 0.3.0-alpha.3 — 2022-03-25
- 0.3.0-alpha.2 — 2022-02-09
- 0.3.0-alpha.1 — 2022-01-18
- 0.3.0-alpha.0 — 2022-01-18
- 0.2.0 — 2021-10-29
- 0.1.2 — 2021-08-26
- 0.1.1 — 2021-08-26
- 0.1.0 — 2021-08-02

## README

# Glaze DataModel

Aliases for Ceramic stream references

## [Documentation](https://developers.ceramic.network/tools/glaze/datamodel/)

## Installation

```sh
npm install @glazed/datamodel
```

## Example

```ts
import { CeramicClient } from '@ceramicnetwork/http-client'
import { DataModel } from '@glazed/datamodel'

// The model aliases associate human-readable names to Ceramic stream IDs or URLs
const modelAliases = {
  schemas: {
    BlogPost: 'ceramic://<schema URL>',
  },
  definitions: {},
  tiles: {
    examplePost: '<stream ID>',
  },
}

const ceramic = new CeramicClient()
const model = new DataModel({ ceramic, model: modelAliases })

// The model exposes simple APIs over the provided model aliases
const blogPostSchemaURL = model.getSchemaURL('BlogPost')

// Individual tiles defined in the model aliases can be loaded using the alias
const examplePost = await model.loadTile('examplePost')

// New tiles can be created using the defined schema aliases
const newPost = await model.createTile('BlogPost', { title: 'new post', text: 'Hello world' })
```

## Maintainers

- Paul Le Cam ([@paullecam](http://github.com/paullecam))

## License

Dual licensed under MIT and Apache 2

---
_Source: https://npm.io/package/@glazed/datamodel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
