Definitions of types within the Block Protocol Type System
npm install @blockprotocol/type-systemThis package provides TypeScript typings and implementations for the Block Protocol Type-System. It defines the foundational types and validation mechanisms for working with typed data in the HASH ecosystem. See the RFC for more details.
The Block Protocol Type System defines a structured approach to typing data. It enables:
- Clear definition of data schemas
- Validation of data against schemas
- Composition of schemas through references
- Tracking of type metadata and provenance
The type system is built around several key components:
1. Core Types
- Data Types - Primitive types like strings, numbers, booleans, arrays, and objects
- Property Types - Reusable definitions of properties with their own schema
- Entity Types - Definitions of entities with their property and relationship requirements
2. Metadata and Provenance
- Type record management with temporal versioning
- Ownership tracking (local vs. remote types)
- Provenance information (creation, modification, origin)
Ensure you've installed the dependencies required for the type-system Rust crate, outlined in the respective README.
Run:
- yarn
- yarn build
If you've successfully built, you can run the tests with:
- yarn test