UNPKG

editia-core

Version:

Core services and utilities for Editia applications - Authentication, Monetization, Video Generation Types, and Database Management

182 lines (139 loc) 5.25 kB
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ### Added - Initial package structure and configuration - TypeScript configuration with strict mode - Jest testing setup with coverage - ESLint and Prettier configuration - Comprehensive documentation ### Changed - N/A ### Deprecated - N/A ### Removed - N/A ### Fixed - N/A ### Security - N/A ## [1.0.0] - 2025-01-XX ### Added - **Authentication Service**: Unified Clerk + Supabase authentication - `ClerkAuthService` class with comprehensive user verification - JWT token validation and user lookup - Database user synchronization - Pro subscription access checking - User deletion functionality - **Express Middleware**: Ready-to-use authentication middleware - `authenticateUser` - Basic authentication for protected routes - `requireProAccess` - Pro subscription required middleware - `optionalAuth` - Optional authentication middleware - `createAuthMiddleware` - Factory function for custom middleware - **Logging System**: Unified logging across the package - `Logger` class with configurable log levels - Structured logging with timestamps and context - Child logger support for nested contexts - Global logger instance - **Type Definitions**: Comprehensive TypeScript types - Authentication types (`DatabaseUser`, `AuthResult`, `AuthErrorResponse`) - Configuration types (`AuthConfig`) - Database types (placeholder for Supabase integration) - Feature flags types (placeholder for Phase 2) - Usage tracking types (placeholder for Phase 2) - Subscription types (placeholder for Phase 2) - **Utility Functions**: Convenience functions for common operations - `getUserId()` - Extract database user ID from auth header - `verifyUser()` - Verify user authentication - `hasProAccess()` - Check Pro subscription access - `initializeEditiaCore()` - Package initialization - **Testing Infrastructure**: Comprehensive test setup - Unit tests for authentication service - Test utilities and mocks - Jest configuration with coverage - Test setup and teardown - **Documentation**: Complete documentation suite - README with installation and usage examples - API reference with TypeScript interfaces - Migration guide for existing applications - Database schema documentation - Configuration examples ### Technical Details #### Authentication Service Features - **JWT Validation**: Comprehensive JWT format and content validation - **Error Handling**: Standardized error responses with status codes and hints - **User Synchronization**: Automatic Clerk to Supabase user mapping - **Pro Access Control**: Subscription-based access control (placeholder for RevenueCat) - **Logging**: Detailed logging for debugging and monitoring #### Middleware Features - **Express Integration**: Seamless integration with Express.js applications - **Type Safety**: Full TypeScript support with extended Request types - **Flexible Options**: Multiple middleware types for different use cases - **Error Handling**: Proper error responses with appropriate HTTP status codes #### Development Experience - **TypeScript**: Full TypeScript support with strict mode - **Testing**: Jest-based testing with coverage requirements - **Linting**: ESLint configuration with TypeScript rules - **Formatting**: Prettier configuration for consistent code style - **Documentation**: JSDoc comments throughout the codebase ### Breaking Changes - None (initial release) ### Migration Guide - N/A (initial release) ### Dependencies - `@clerk/backend`: ^1.0.0 (Clerk authentication) - `@supabase/supabase-js`: ^2.38.0 (Supabase client) - `express`: ^4.18.0 (peer dependency for middleware) ### Development Dependencies - `typescript`: ^5.0.0 - `jest`: ^29.0.0 - `eslint`: ^8.0.0 - `prettier`: ^3.0.0 - `typedoc`: ^0.25.0 --- ## Version History ### Version 1.0.0 (Current) - **Status**: Initial Release - **Focus**: Authentication and basic infrastructure - **Target**: Production-ready authentication service ### Planned Versions #### Version 1.1.0 (Next) - **Focus**: Feature flags and usage tracking - **Features**: - Feature flags service - Usage tracking service - Database type generation #### Version 1.2.0 - **Focus**: Subscription management - **Features**: - RevenueCat integration - Subscription plan management - Billing integration #### Version 2.0.0 (Future) - **Focus**: Advanced features and performance - **Features**: - Advanced analytics - Performance monitoring - Plugin system - API versioning --- ## Contributing When contributing to this project, please follow the changelog format: ### Added - New features ### Changed - Changes in existing functionality ### Deprecated - Soon-to-be removed features ### Removed - Removed features ### Fixed - Bug fixes ### Security - Security-related changes ## Links - [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Semantic Versioning](https://semver.org/spec/v2.0.0.html) - [GitHub Repository](https://github.com/editia/core)