0.3.1 • Published 2 years ago
@glazed/datamodel v0.3.1
Glaze DataModel
Aliases for Ceramic stream references
Documentation
Installation
npm install @glazed/datamodel
Example
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)
License
Dual licensed under MIT and Apache 2
0.3.1
2 years ago
0.3.0
2 years ago
0.3.0-rc.1
2 years ago
0.3.0-rc.0
2 years ago
0.3.0-alpha.3
2 years ago
0.3.0-alpha.2
2 years ago
0.3.0-alpha.0
2 years ago
0.3.0-alpha.1
2 years ago
0.2.0
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.0
3 years ago