@zerodev/data-api-contract
v0.1.0
Published
Public runtime schemas and TypeScript types for the ZeroDev Data API
Readme
@zerodev/data-api-contract
Public runtime schemas and TypeScript types for the ZeroDev Data API.
The package is the source of truth for JSON exchanged between Data API clients and the server. The Data API uses the same Zod schemas for Fastify validation and response serialization that TypeScript clients can use for runtime validation and inferred types.
Scope
The package contains public request and response contracts. It does not contain Fastify route handlers, Zerion provider schemas, authentication, or OpenAPI generation.
The package is browser-safe and ships ESM, CommonJS, and declaration entrypoints.
pnpm add @zerodev/data-api-contract zodInside this workspace, build it before consuming it from another workspace package:
pnpm --filter @zerodev/data-api-contract buildExample
import {
type TransactionHistoryResponse,
TransactionHistoryResponseSchema,
} from '@zerodev/data-api-contract';
const value: unknown = await response.json();
const transactionHistory: TransactionHistoryResponse =
TransactionHistoryResponseSchema.parse(value);