v0.0.12: Type consistency and configuration improvements

Type System Enhancements:
- Introduced PayloadID helper type (string | number) for flexible ID handling
- Created shared types module (src/types/index.ts) for better type consistency
- Exported PayloadID and FeatureFlag types from main index for user access
- Fixed runtime issues with different Payload ID configurations

Configuration Improvements:
- Made API request limits configurable via maxFlags prop (default 100, max 1000)
- Added configurable collection slug support for custom collection names
- Enhanced URL construction to use config.routes.admin for proper path handling
- Improved server-side pagination with query parameter support

Code Quality:
- Centralized type definitions for better maintainability
- Enhanced type safety across client and server components
- Improved prop interfaces with better documentation
- Fixed potential number parsing edge cases with parseFloat

Developer Experience:
- Users can now configure collection slug, API limits, and admin paths
- Better TypeScript support with exported shared types
- Consistent handling of both string and numeric IDs
- More flexible plugin configuration options

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-03 17:36:53 +02:00
parent 0a39d0631c
commit 0c7c864248
5 changed files with 54 additions and 50 deletions

24
src/types/index.ts Normal file
View File

@@ -0,0 +1,24 @@
// Shared types for the feature flags plugin
// Helper type for flexible ID handling - supports both string and number IDs
// This allows the plugin to work with different Payload ID configurations
export type PayloadID = string | number
// Common interface for feature flags used across the plugin
export interface FeatureFlag {
id: PayloadID
name: string
description?: string
enabled: boolean
rolloutPercentage?: number
variants?: Array<{
name: string
weight: number
metadata?: any
}>
environment?: 'development' | 'staging' | 'production'
tags?: Array<{ tag: string }>
metadata?: any
createdAt: string
updatedAt: string
}