@boltz.one/contracts
v0.1.3
Published
Shared Zod schemas — single source of truth, gom theo domain (common, iam, registry, wallet, events, resources, actions, errors)
Downloads
837
Readme
@boltz.one/contracts
Single source of truth cho dữ liệu của nền tảng Boltz One: bộ Zod schema dùng
chung, tổ chức theo domain. Isomorphic (chạy cả server lẫn browser), chỉ phụ thuộc zod.
Cài đặt
bun add @boltz.one/contracts zodEntry points
| Import | Nội dung |
| --- | --- |
| @boltz.one/contracts | Tất cả (re-export mọi domain bên dưới) |
| @boltz.one/contracts/common | Primitives dùng chung (id, pagination, timestamp…) |
| @boltz.one/contracts/iam | Authorize (PARC), token exchange, simulation, ReBAC, control-plane CRUD, policy document schema |
| @boltz.one/contracts/registry | App registry |
| @boltz.one/contracts/wallet | Order, refund, ví |
| @boltz.one/contracts/events | Domain/integration events |
| @boltz.one/contracts/resources | Resource (SRN) |
| @boltz.one/contracts/actions | Action catalog |
| @boltz.one/contracts/errors | Domain error base |
Sử dụng
import { authorizeRequestSchema, type AuthorizeRequest } from '@boltz.one/contracts/iam';
const req: AuthorizeRequest = authorizeRequestSchema.parse(input); // validate + infer typePolicy document schema (nền cho engine ở @boltz.one/sdk-core/iam-policy) cũng nằm tại đây:
import { policyDocumentSchema, type PolicyDocument } from '@boltz.one/contracts/iam';Mọi schema vừa validate runtime (
.parse/.safeParse) vừa suy ra type quaz.infer, nên dùng làm contract chung giữa backend và frontend.
License
MIT
