emkore 0.3.3 copy "emkore: ^0.3.3" to clipboard
emkore: ^0.3.3 copied to clipboard

Clean Architecture core library for Dart with use cases, entities, validation, authorization, and interceptor pipelines.

CHANGELOG #

0.3.3 #

πŸš€ Perfect Pub.dev Score Achievement #

  • Official Lints Integration: Added lints: ^6.0.0 for pub.flutter-io.cn compliance
    • Replaced custom analysis rules with official Dart lints package
    • Ensures consistent code quality standards across Dart ecosystem
  • Static Analysis Perfection: Fixed all 6 remaining lint issues for 160/160 pub.flutter-io.cn score
    • Added curly braces to if statements in example repository (4 fixes)
    • Added missing @override annotation to apiDefinition property
    • Replaced .where().whereType() with .whereType() in JSON class for better performance
  • Zero Analysis Issues: All static analysis now passes with 0 warnings

πŸ”§ Code Quality #

  • Consistent Formatting: Applied dart format across all modified files
  • Production Standards: Code now meets official Dart style guidelines

0.3.2 #

πŸ› Bug Fixes #

  • Static Analysis: Fixed pub.flutter-io.cn static analysis issues for perfect 50/50 score
    • Added missing braces around if statement in AuthorizationInterceptor
    • Simplified documentation to avoid HTML angle bracket interpretation
    • Added missing documentation for Actor class properties
  • Documentation: Enhanced Actor class with property documentation

0.3.1 #

πŸš€ Pub.dev Score Improvements #

  • Comprehensive Example: Added example/example.dart demonstrating complete CRUD workflow
    • Real-world usage patterns with entities, use cases, and repositories
    • Complete error handling and validation demonstrations
    • Multitenancy and authorization examples
    • Money value objects and type-safe JSON handling
    • Working example that can be run with dart run example/example.dart
  • Optimized Package Description: Shortened description to meet pub.flutter-io.cn requirements (60-180 characters)
  • Fixed Import Paths: Corrected relative imports in e2e test after file reorganization

πŸ”§ Code Quality #

  • Clean Static Analysis: All analysis issues resolved
  • Proper Code Formatting: Applied consistent formatting across all files

0.3.0 #

πŸ—οΈ Major Architecture Refactoring #

  • Removed Repository Dependencies: Eliminated SQLite3 and HTTP dependencies to keep core library lightweight

    • Removed SqliteThreeRepository and all SQLite3-related code
    • Removed RestRepository and HTTP client functionality
    • Core library now focuses purely on architectural abstractions
    • BREAKING: Applications using these repositories must implement their own storage solutions
  • Unit of Work Enhancement: Moved UnitOfWork from mixin to dedicated type system

    • Relocated from lib/src/common/mixin/ to lib/src/common/type/unit_of_work.type.dart
    • Improved interfaces for better transaction management and repository access
    • Enhanced multitenancy support with per-tenant repository isolation

πŸš€ Enhanced Documentation & Developer Experience #

  • Comprehensive README: Complete rewrite with practical examples and architectural guidance

    • Added step-by-step tutorial with complete code examples
    • Enhanced project structure recommendations with naming conventions
    • Added JSON handling best practices and validation patterns
    • Included Unit of Work pattern examples and interceptor usage
  • Improved Documentation Structure: Reorganized all documentation

    • Moved CLAUDE.md to doc/development-guide.md with enhanced content
    • Renamed doc/PERMISSIONS.md to doc/permissions-guide.md for consistency
    • Added foundational concepts at beginning of README for better onboarding
  • Enhanced API Examples: All examples now demonstrate production patterns

    • Use case outputs return DTOs/JSON instead of entities
    • Proper JSON handling with type-safe helper methods
    • Complete validation examples with enum support
    • Unit of Work pattern as recommended architecture

πŸ”§ Code Quality & Best Practices #

  • JSON Type Safety: Eliminated all direct JSON casting in favor of helper methods

    • Fixed all examples to use json.getString(), json.getInt(), etc.
    • Added comprehensive JSON method documentation
    • Enhanced validation with proper enum handling
  • Naming Convention Standards: Established comprehensive naming guidelines

    • Use case names: snake_case for actions and resources
    • Resource names: Always singular (user, order, document)
    • Class naming patterns: [Action][Resource]Usecase, [Action][Resource]Interactor
    • File structure: repository/[resource]/[storage-type]/[resource].repository.dart
  • Example Implementation: Complete working example with in-memory repositories

    • Full CRUD operations with proper validation and error handling
    • Multitenancy demonstration with business ID isolation
    • E2E test coverage for all functionality
    • Unit of Work pattern implementation

πŸ› Bug Fixes & Improvements #

  • Export Completeness: Added missing exports for public API

    • Added CommonAction typedef and isCommonAction() function exports
    • Verified all public classes and interfaces are properly exported
  • Abstract Use Case Clarity: Enhanced documentation for inherited methods

    • Clarified that performExecute is inherited from base class
    • Removed redundant method declarations from use case interfaces
    • Added clear documentation about interceptor usage patterns

πŸ“š Documentation Enhancements #

  • Architecture Documentation: Added detailed naming conventions and project structure
    • Complete class naming patterns with examples
    • File organization best practices
    • Resource naming consistency (singular forms)
    • Snake_case conventions for use case names

0.2.5 #

πŸ”„ Architecture Changes #

  • Restored AuthorizationInterceptor: Moved authorization logic back from usecase to dedicated interceptor
    • Added new AuthorizationInterceptor class for comprehensive permission checking
    • Supports all constraint validation: scope, status, time, and resource restrictions
    • Integrates with InterceptorContext for access to actor permissions and usecase metadata
    • Provides better separation of concerns between business logic and authorization

πŸ”§ Technical Improvements #

  • Simplified Usecase Logic: Removed authorization complexity from abstract usecase implementation
  • Enhanced UnitOfWork: Updated unit of work interfaces with better tenant isolation support
  • Export Cleanup: Fixed incorrect export reference in main library file

πŸ› Bug Fixes #

  • Library Exports: Fixed undefined export reference for UnitOfWorkMixin in main library

0.2.4 #

πŸš€ Enhanced Features #

  • Enhanced Interceptor Context: Added comprehensive context information to interceptors

    • Added InterceptorContext class providing actor, usecase name, required permissions, and metadata
    • All interceptor methods now receive context: beforeExecute(), afterExecute(), and onError()
    • Added name property to Interceptor interface for better identification in logs
  • New Example Interceptors: Added production-ready interceptor implementations

    • AuditLogInterceptor: Comprehensive audit logging with timestamps and permissions
    • PerformanceInterceptor: Execution time tracking with configurable slow operation warnings
    • Updated LoggerInterceptor: Enhanced with actor information and usecase details

πŸ”§ Technical Improvements #

  • Consistent Output Formatting: All interceptors now prefix their output with [InterceptorName]
  • Extensible Metadata: Added metadata map to InterceptorContext for future extensibility
  • Performance Optimized: Context creation uses only data already available in usecase execution

πŸ› Breaking Changes #

  • Interceptor Interface Update: All interceptor methods now require InterceptorContext parameter
    • Migration: Update custom interceptors to include context parameter in all methods
    • Benefit: Rich context information for cross-cutting concerns like logging, metrics, and auditing

0.2.3 #

πŸ› Bug Fixes #

  • Boolean Validator: Fixed boolean validation to properly handle true/false values
  • ResourceScope Naming: Fixed naming consistency in ResourceScope enum values

0.2.2 #

πŸš€ Enhanced Features #

  • ValidatorBuilder: Replaced static Validators class with fluent ValidatorBuilder API
    • Chainable validation methods: string(), number(), list(), enumField(), dateTime(), money()
    • Convenience methods: email(), uuid(), entityId() with built-in patterns
    • Custom validation support with custom() method
    • Nested object validation with object() method
    • Automatic JSON Schema Generation: Extract schemas from validation rules for API documentation
    • Field-Specific Error Mapping: Enhanced error handling with field-to-error mapping for better UI integration

πŸ§ͺ Testing #

  • Comprehensive ValidatorBuilder Tests: Added extensive test coverage including field error mapping, schema generation, and nested validation
  • Production-Grade Error Handling: Tests verify proper error accumulation and field-specific error extraction

πŸ“š Documentation #

  • Complete Validation Guide: Added comprehensive documentation at doc/validation-guide.md
    • Basic usage patterns and API reference
    • Input class patterns with schema generation examples
    • Nested validation and UI integration patterns
    • Migration guide from old Validators class
    • Advanced patterns and best practices

πŸ”§ Breaking Changes #

  • Validators Class Removed: The static Validators class has been replaced with ValidatorBuilder
    • Migration: Replace Validators.method() calls with ValidatorBuilder().method().build()
    • Benefit: Better composition, field error mapping, and automatic schema generation

0.2.1 #

πŸš€ Enhanced Features #

  • Resource-Specific Permissions: Added resourceId constraint to ResourceConstraints for granting access to specific resource instances
    • Enable permissions like "update document doc_12345" or "delete post post_abc123"
    • Follows existing constraint patterns with exact string matching
    • Full JSON serialization/deserialization support

πŸ§ͺ Testing #

  • Comprehensive Test Coverage: Added tests for resourceId constraint validation including success and failure scenarios
  • Authorization Logic: Tests verify resourceId matching and mismatch behaviors

πŸ“š Documentation #

  • Updated Permission Documentation: Enhanced docs with resourceId examples and usage patterns
  • JSON Examples: Added resource-specific permission examples to documentation

0.2.0 #

πŸ—οΈ Breaking Changes #

  • Authorization Architecture Consolidation: Removed AuthorizationInterceptor class and moved all sophisticated authorization logic directly into Usecase class
    • All constraint validation (scope hierarchy, status filtering, time windows, business/team scoping) now happens automatically in use cases
    • Provides better integration with use-case-specific requiredPermissions
    • Eliminates architectural split-brain between interceptor and use case authorization
    • BREAKING: Applications using AuthorizationInterceptor directly must remove those references

πŸš€ Enhanced Features #

  • Consolidated Authorization: Single source of truth for all permission validation with full constraint support
  • Comprehensive Test Coverage: Added extensive tests for constraint validation including scope hierarchy, status filtering, and time-based access control

πŸ”§ Technical Improvements #

  • Simplified Architecture: Cleaner mental model with authorization happening in one place
  • Better Error Reporting: Enhanced AuthorizationException with detailed missing permission information
  • JSON Serialization: Fixed optional field handling in Permission and ResourceConstraints deserialization

0.1.1 #

πŸš€ Enhanced Features #

  • JSON Class Enhancement: Transformed JSON from simple type alias to comprehensive class with full Map interface
    • Added fromString() and fromBlob() static constructors with error handling
    • Added toJsonString() with pretty printing support
    • Added type-safe getters: getString(), getInt(), getDouble(), getBool(), getList<T>(), getJSON()
    • Added validation methods: hasKey(), isValid, isEmptyJSON
    • Added deep operations: deepCopy(), merge(), mergeDeep()

πŸ”§ Technical Improvements #

  • Code Quality: Replaced Flutter lints with appropriate Dart-only analysis rules
  • Architecture: Refactored JSON class to use MapMixin for proper Map interface implementation
  • Compatibility: Fixed all breaking changes across SystemFields mixin and API definitions
  • JSON Integration: Updated Permission and ResourceConstraints to use enhanced JSON class with type-safe getters

πŸ› Bug Fixes #

  • Fixed entity ID validation test to use proper 4-hex-character prefix format
  • Resolved type compatibility issues after JSON class enhancement

0.1.0 #

πŸš€ New Features #

  • Authorization System: Added comprehensive permission-based authorization framework
    • Added Permission class with resource/action-based access control
    • Added ResourceConstraints with scope, status, time, and businessId restrictions
    • Added AuthorizationInterceptor for use case-level access control
    • Added AuthorizationException for authorization failures
  • Enhanced Usecase Framework: Built-in authorization checking in all use cases
  • JSON Serialization: Full JSON serialization support for Permission and ResourceConstraints

πŸ§ͺ Testing #

  • Added comprehensive test suite covering all core functionality
  • Tests for Permission/ResourceConstraints serialization
  • Tests for Validators (required, email, length, UUID, entityId, etc.)
  • Tests for InMemoryRepository CRUD operations
  • Tests for Entity implementation and copy operations
  • Tests for Usecase authorization flow

πŸ› οΈ Improvements #

  • Updated Permission type system with JSON parsers
  • Removed wildcard support for permissions (more explicit control)
  • Enhanced validation framework

0.0.9 #

  • Turned SystemFields into a class (was a mixin).
  • Made execute/performExecute parameters named instead of positional.

0.0.8 #

  • Made Entity extendable.

0.0.7 #

  • Added DTO abstract class to lib/src/common/abstract.dto.dart.

0.0.6 #

  • Changed Entity to be asbtract interface class.

0.0.5 #

  • Added abstract base class Entity.
  • Added JSON type alias for Map<String, Object?> in lib/src/common/type/json.type.dart.
  • Updated CHANGELOG.md to reflect the new type alias addition.
0
likes
160
points
37
downloads

Publisher

verified publisheremko.dev

Weekly Downloads

Clean Architecture core library for Dart with use cases, entities, validation, authorization, and interceptor pipelines.

Homepage

Topics

#clean #architecture #core #emko #domain

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

meta, uuid

More

Packages that depend on emkore