Skip to content

v1.1.4 - Comprehensive Enum Type System

Choose a tag to compare

@YosefHayim YosefHayim released this 12 Nov 14:37
· 502 commits to main since this release

🎯 Comprehensive Enum Type System

This release introduces a comprehensive type-safe enum system for eBay API types, significantly improving type safety and developer experience.

✨ Added

Native TypeScript Enums (33 total)

  • Core Business Enums:

    • MarketplaceId (41 values) - All eBay marketplace identifiers
    • Condition (17 values) - Item condition states
    • FormatType (2 values) - Listing formats (AUCTION, FIXED_PRICE)
    • OrderPaymentStatus (5 values) - Payment states
    • CampaignStatus (9 values) - Marketing campaign lifecycle
  • Policy & Fulfillment Enums:

    • RefundMethod, ReturnMethod, ReturnShippingCostPayer
    • ShippingCostType, ShippingOptionType, CategoryType
    • PaymentMethodType, DepositType
    • LineItemFulfillmentStatus, OfferStatus, ListingStatus, PublishStatus
  • Measurement Units:

    • TimeDurationUnit (9 values) - Time period units
    • WeightUnit (4 values) - Weight measurements
    • LengthUnit (4 values) - Length measurements
  • Localization:

    • LanguageCode (13 values) - ISO 639-1 codes
    • CurrencyCode (14 values) - ISO 4217 codes
  • Regulatory:

    • RegionType, ExtendedProducerResponsibilityEnum, ComplianceType

Type Safety Enhancements

  • Migrated 23 Zod schemas from string literals to z.nativeEnum() validation
  • Enhanced compile-time type safety across all API domains
  • Improved IDE auto-completion for eBay API values
  • Runtime validation with Zod native enum support

Testing

  • 86 new tests for enum structure and validation:
    • 49 enum structure tests
    • 37 schema validation tests
  • Total test count: 870 tests across 26 test files
  • Function coverage: 99%+
  • Line coverage: 85%+

Documentation

  • Added ENUMS_ANALYSIS.md cataloging 180+ eBay enum types
  • Updated CLAUDE.md with enum usage guidelines
  • Migration guide for future enum implementations
  • JSDoc documentation for all enums

πŸ”§ Changed

  • Updated Zod schemas to use native enum validation instead of string literals
  • Enhanced type safety in API request/response handling
  • Improved error messages with enum validation

πŸ“Š Impact

  • Type Safety: βœ… Compile-time validation for all enum values
  • Developer Experience: βœ… IDE auto-completion and inline documentation
  • Runtime Safety: βœ… Zod validation catches invalid values
  • Code Quality: βœ… Self-documenting code with descriptive enum names

πŸ’‘ Benefits

  • Catch invalid enum values at compile time
  • Better IDE support with auto-completion
  • Self-documenting code (no magic strings)
  • Runtime validation prevents API errors
  • Easier refactoring with type safety

πŸ“š Future Work

147+ specialized enums documented in ENUMS_ANALYSIS.md:

  • Marketing enums (35): AdGroupStatus, BiddingStrategy, etc.
  • Order management enums (20): RefundStatus, DisputeState, etc.
  • Communication enums (25): FeedbackRatingType, UserRole, etc.
  • And more...

πŸš€ Upgrade Notes

No breaking changes. All enum types are backward compatible with string literals.

Example usage:

import { MarketplaceId, Condition } from 'ebay-api-mcp-server';

// Type-safe enum usage
const marketplace = MarketplaceId.EBAY_US;  // Auto-completion!
const condition = Condition.NEW;

// Still works with strings (backward compatible)
const marketplace2 = 'EBAY_US';

Full Changelog: v1.1.3...v1.1.4