@stately-cloud/schema
v0.13.0
Published
Schema language for StatelyDB
Downloads
227
Readme
StatelyDB Schema Language
This is a TypeScript domain-specific language (DSL) for generating Stately Schemas. You use schemas to define the shape of your data model in StatelyDB, including validation, types, and other database configuration such as key paths and indexes. It is meant to be used with the stately
CLI, e.g. stately schema put index.ts
.
How it's used
- Create a
package.json
and add a dependency on@stately-cloud/schema
(e.g.npm init
,npm i @stately-cloud/schema
) - Create a
tsconfig.json
for your schema. This is necessary to get good autocomplete in VSCode. - Create your schema files, each of which is a TypeScript (
.ts
) file. These import from@stately-cloud/schema
to get types and builder functions, and export their types. - Run
stately schema validate index.ts
to check your schema. - Run
stately schema put --schema-id 12345 --message "an update message" index.ts
to upload the schema to your store. - Run
stately schema generate --language typescript index.ts --out <output-dir>
to generate typed models for your schema.