orchestrator_core 0.5.2
orchestrator_core: ^0.5.2 copied to clipboard
Event-Driven Orchestrator architecture for Dart/Flutter. Separate UI state management from business logic execution with SignalBus and Dispatcher pattern.
0.5.2 - 2026-01-06 #
Added #
- Saga Pattern: New
SagaFlowclass for orchestrated workflows with rollback support.- Execute steps with
run(action, compensate). - LIFO rollback with
rollback(). - Clear compensations on success with
commit(). - Named sagas for debugging:
SagaFlow(name: 'TransferAsset'). - Integrated with
OrchestratorConfig.logger.
- Execute steps with
0.5.1 - 2025-12-30 #
Fixed #
- Re-publish with complete code generation annotations (
@TypedJob,@OrchestratorProvider). - All 105 tests passing.
0.5.0 - 2025-12-29 #
Added #
- Type Safety: All result events now include
jobTypefield for cross-feature event filtering.JobSuccessEvent,JobFailureEvent,JobCancelledEvent,JobTimeoutEvent,JobCacheHitEvent,JobPlaceholderEventall have optionaljobTypeparameter.- New helper method
isFromJobType<J>()on all result events for type-safe filtering. BaseExecutorautomatically tracks and emitsjobTypefor all events.
- TypedExecutor: New base class for type-safe executors with compile-time result type checking.
TypedExecutor<T, R>: Async executor with typedrun(T job)method returningFuture<R>.SyncTypedExecutor<T, R>: Sync executor withrunSync(T job)method returningR.
- Code Generation Annotations:
@TypedJob: Generate sealed job hierarchies from interface classes.@OrchestratorProvider: Generate Riverpod providers for orchestrators.
- Use Case: Passive handlers can now filter events by job type:
@override void onPassiveEvent(BaseEvent event) { if (event is JobSuccessEvent && event.isFromJobType<FetchUserJob>()) { // Handle only FetchUserJob success events } }
0.4.0 - 2025-12-29 #
Added #
- Testing Support:
BaseOrchestratornow accepts optionaldispatcherparameter for dependency injection.- Allows mocking
Dispatcherin tests to verify dispatch behavior. - Backward compatible: defaults to global
Dispatcher()singleton.
- Allows mocking
- Convenience: Added
SignalBus.listen()method as shorthand forstream.listen().
Changed #
BaseOrchestratorconstructor signature updated to accept optionalbusanddispatcherparameters.
0.3.3 - 2025-12-27 #
Changed #
- Exposed
Dispatcher.registeredExecutorsgetter for DevTools integration. - Exposed
OrchestratorConfig.cleanupServicegetter for DevTools integration.
0.3.2 - 2025-12-27 #
0.3.1 - 2025-12-27 #
Added #
- Resource Cleanup: Introduced
CleanupPolicyandCleanupServiceinterface. - Cache: Added LRU eviction and proactive expiration to
InMemoryCacheProvider. - Config: Added
cleanupPolicyconfiguration toOrchestratorConfig.
0.3.0 - 2025-12-26 #
Features: Extended Code Generation #
- New: Added annotations for enhanced code generation:
@Orchestrator&@OnEvent: For declarative event routing.@GenerateAsyncState: Automatically generatescopyWith,toLoading,toSuccess,when,maybeWhen.@GenerateJob: Simplifies job creation with auto-generated ID, timeout, and retry policy.@GenerateEvent: Reduces boilerplate for event classes.@NetworkJob: AddedgenerateSerializationflag.@ExecutorRegistry: For auto-registering executors.
0.2.0 - 2025-12-25 #
Added #
- New:
JobBuilder- Fluent API for configuring jobs with timeout, retry, cache, placeholder. - New:
JobResult- Sealed class for type-safe result handling withwhen/maybeWhenpattern matching. - New:
AsyncState- Common state pattern withAsyncStatusenum and state transitions. - New: Event extensions -
dataOrNull<T>(),dataOr<T>(),errorMessagehelpers. - New:
OrchestratorHelpersmixin -dispatchAll(),dispatchReplacingPrevious(), etc. - New:
NetworkJobRegistry.registerType<T>()for type-safe registration. - New:
CancellationTokenimprovements -removeListener(),clearListeners(), return unregister function. - New:
SignalBus.isDisposedgetter and saferdispose()handling. - New:
Dispatcher.resetForTesting()for test isolation. - New:
BaseExecutorhelpers -emitStep(),invalidatePrefix(),readCache(),writeCache().
Fixed #
generateJobId()now uses microseconds + cryptographic random for better uniqueness.JobProgressEvent.progressnow auto-clamps to 0.0-1.0 range.- Proper cleanup of
_busSubscriptionin all dispose methods. SignalBus.streamthrowsStateErrorif accessed after disposal.
Changed #
- All adapters now use
SignalBus.instancefor consistency.
0.1.0 - 2025-12-25 #
Features: Unified Data Flow & Caching #
- New: Unified Data Flow architecture supporting Placeholder -> Cache (SWR) -> Process -> Cache Write.
- New:
DataStrategyconfiguration for Jobs.placeholder: Emit temporary data immediately (Skeleton UI).cachePolicy: Configure caching behavior (TTL, Key, Revalidate, Force Refresh).
- New: 3 Ways of Cache Management:
- Config:
CachePolicy(forceRefresh: true)for Pull-to-Refresh. - Utility:
InvalidateCacheJobfor system-wide clearing (e.g. Logout). - Side-Effect: Methods
invalidateKey/invalidateMatchinginBaseExecutor.
- Config:
- New:
CacheProviderinterface with defaultInMemoryCacheProvider. - New: Events
JobPlaceholderEventandJobCacheHitEvent.
0.0.3 - 2024-12-24 #
Architecture (Scoped Bus) #
- New: Support Scoped Bus for isolated module communication.
- Create isolated bus:
SignalBus.scoped(). - Access global bus:
SignalBus.instance. - Inject bus into Orchestrator:
MyOrchestrator(bus: myScopedBus).
- Create isolated bus:
- Breaking Change:
BaseJobis no longerconst/@immutable.- Added
SignalBus? busfield toBaseJobfor explicit context tracking. - This allows Executors to automatically route events to the correct bus without hidden magic.
- Added
- Improved:
BaseExecutornow dynamically resolves the target bus based on the Job's context.
0.0.2 - 2024-12-24 #
Added #
- Safety: Smart Circuit Breaker (Loop Protection by Event Type)
- Prevent infinite loops by blocking specific looping events
- Default limit: 50 events/sec (configurable globally)
- New: Support per-type limit override via
OrchestratorConfig.setTypeLimit<T>(limit) - Self-healing every 1 second
- Safety: Type Safety Isolation (try-catch in event handlers)
- Safety / Casting:
JobSuccessEvent.dataAs<T>()for safe data casting - UI Helper:
BaseOrchestrator.isJobTypeRunning<T>()to prevent UI race conditions - Config: Added
OrchestratorConfig.maxEventsPerSecond
0.0.1 - 2024-12-24 #
Added #
- Initial release
BaseJobandBaseEventmodelsSignalBus- Singleton broadcast stream for event communicationDispatcher- Type-based job routing with O(1) lookupBaseExecutor- Abstract executor with error boundary, timeout, retry, cancellationBaseOrchestrator- State machine with Active/Passive event routingCancellationToken- Token-based task cancellationRetryPolicy- Configurable retry with exponential backoffOrchestratorLogger- Flexible logging system