Skip to content

[0.2.0-alpha] - 2025-07-28

Choose a tag to compare

@KeterVM KeterVM released this 28 Jul 05:13
· 23 commits to main since this release

Added

  • defineContract helper function - New utility for defining contracts with better type inference
  • Comprehensive examples - Added multiple example files demonstrating different use cases:
    • examples/basic-usage.ts - Basic client usage with middleware
    • examples/adapter-usage.ts - HTTP adapter comparison and configuration
    • examples/interceptor-demo.ts - Axios interceptor demonstrations
    • examples/axios-interceptors.ts - Advanced interceptor patterns
    • examples/contract-definition-comparison.ts - Different contract definition approaches

Changed

  • BREAKING: Updated Zod dependency - Upgraded to Zod v4 with improved API and performance
  • Improved contract definition syntax - All examples now use defineContract() for better developer experience
  • Updated ESLint configuration - Migrated from .eslintrc.js to modern flat config format (eslint.config.js)
  • Optimized bundle size - Reduced package size by 94% (from ~500KB to ~30KB) by properly externalizing dependencies

Fixed

  • Bundle optimization - Zod is now correctly treated as external dependency instead of being bundled
  • Dependency management - Moved Zod from dependencies to peerDependencies for better version control
  • Type safety improvements - Enhanced type inference with defineContract helper

Technical Improvements

  • Updated all dependencies to latest versions
  • Enhanced test coverage - Added comprehensive middleware and adapter tests
  • Improved documentation - Updated README with consistent examples using defineContract
  • Better TypeScript support - Enhanced type definitions and inference

Migration Guide

Contract Definition

// Old way (still works but not recommended)
const contract = {
  getUser: { ... }
} as const satisfies Contract;

// New way (recommended)
import { defineContract } from 'zodsei';
const contract = defineContract({
  getUser: { ... }
});

Zod Schema Updates

// Old (deprecated in Zod v4)
z.string().uuid()
z.string().email()
z.string().datetime()

// New (Zod v4 recommended)
z.uuidv4()
z.email()
z.iso.datetime()