From 2df29fc546d983ea95c8e2ff308d9bd70117d3dc Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 22 Jan 2026 12:09:40 +0800 Subject: [PATCH] Added the bounded integration --- .github/workflows/publish.yml | 12 ++- CHANGELOG.md | 74 +++++++++++++++++++ packages/raiser/CHANGELOG.md | 63 ---------------- packages/raiser/example/pubspec.yaml | 4 +- .../raiser/lib/src/events/raiser_event.dart | 5 +- packages/raiser/pubspec.yaml | 4 +- packages/raiser_annotation/CHANGELOG.md | 31 -------- packages/raiser_generator/CHANGELOG.md | 41 ---------- .../raiser_generator/example/pubspec.yaml | 4 +- pubspec.yaml | 9 +++ 10 files changed, 106 insertions(+), 141 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 packages/raiser/CHANGELOG.md delete mode 100644 packages/raiser_annotation/CHANGELOG.md delete mode 100644 packages/raiser_generator/CHANGELOG.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 68a7eac..0ef2b46 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,6 +17,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Dart uses: dart-lang/setup-dart@v1 @@ -46,5 +48,13 @@ jobs: mkdir -p "$HOME/.config/dart" printf '%s' "$PUB_CREDENTIALS" > "$HOME/.config/dart/pub-credentials.json" + - name: Copy root CHANGELOG into all packages + run: | + for dir in packages/*; do + if [ -d "$dir" ] && [ -f "$dir/pubspec.yaml" ]; then + cp CHANGELOG.md "$dir/CHANGELOG.md" + fi + done + - name: Publish packages - run: melos publish --no-dry-run --yes + run: melos publish --no-private --no-dry-run --yes diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..29c851e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,74 @@ +# Changelog + +All notable changes to this workspace will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this workspace adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +This is a lockstep workspace: all packages share the same version and release notes. + +## [Unreleased] + +### Changed + +- Updated dependencies to use latest versions: + - `zooper_flutter_core: ^2.0.0` + - `bounded: ^1.0.0` + +## [3.0.0] - 2026-01-10 + +### Changed + +- **BREAKING**: `RaiserEvent` is now a pure `abstract interface class` instead of a base class with implementation. + - **Note: Using `RaiserEvent` is completely optional - `EventBus` works with ANY type.** + - If you choose to use `RaiserEvent`, you must explicitly implement all three required properties: `id`, `occurredOn`, and `metadata`. + - No more automatic property initialization - implement the interface explicitly. + - This change allows events to use composition and multiple interfaces without inheritance constraints. +- `RaiserEvent` now implements `ZooperDomainEvent` from `zooper_flutter_core` package. +- Event IDs in `RaiserEvent` now use `EventId` type (ULID-based) instead of `String`. + - IDs are generated via `EventId.fromUlid()` for better uniqueness guarantees. + - Access raw string value via `event.id.value` when needed. +- Renamed `RaiserEvent.timestamp` property to `occurredOn` for clarity and DDD alignment. +- Removed `aggregateId` as a direct property from `RaiserEvent`. + - Store aggregate identifiers in the `metadata` map instead: `metadata: {'aggregateId': 'user-123'}`. + - Access via `event.metadata['aggregateId'] as String?`. +- Removed helper mixins and convenience extensions. +- Updated generator dependency constraints to `raiser: ^3.0.0` and `raiser_annotation: ^3.0.0`. + +### Important Note + +**`EventBus` is fully generic and does not require `RaiserEvent`.** You can publish and subscribe to any type. The `RaiserEvent` interface is purely optional for users who want standardized domain event metadata. + +## [2.0.1] - 2026-01-08 + +### Changed + +- Migrated generator implementation away from deprecated analyzer element APIs to remove deprecation warnings. + +## [2.0.0] - 2026-01-08 + +### Changed + +- **BREAKING**: Renamed `DomainEvent` to `RaiserEvent` to avoid naming conflicts with other packages. +- Updated documentation references from `DomainEvent` to `RaiserEvent`. +- Updated generator dependency constraints to `raiser: ^2.0.0` and `raiser_annotation: ^2.0.0`. + +## [1.0.0] - 2024-12-19 + +### Added + +- **EventBus** — Central dispatcher for publishing and routing domain events. +- **DomainEvent** — Base class with automatic ID generation, timestamps, and optional aggregate ID. +- **EventHandler** — Type-safe interface for class-based event handlers. +- **Subscription** — Handle for cancelling handler registrations. +- **Priority-based ordering** — Higher priority handlers execute first. +- **Error handling strategies**. +- **AggregateException** — Collects multiple handler errors when using `continueOnError`. +- **@RaiserHandler** annotation for marking event handler classes. +- **@RaiserMiddleware** annotation for marking middleware classes. +- Support for dependency injection through annotation metadata. +- **Two-phase builder system** (`raiser_collecting` → `raiser_aggregating`). +- **Automatic handler discovery** and **middleware discovery**. +- Generated registration functions (`initRaiser()`, `initRaiserWithFactories()`, and named bus variants). +- Dependency injection factory parameter generation. +- Priority support and type-safe code generation. diff --git a/packages/raiser/CHANGELOG.md b/packages/raiser/CHANGELOG.md deleted file mode 100644 index bd5fdfd..0000000 --- a/packages/raiser/CHANGELOG.md +++ /dev/null @@ -1,63 +0,0 @@ -# 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.1.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [3.0.0] - 2026-01-10 - -### Changed - -- **BREAKING**: `RaiserEvent` is now a pure `abstract interface class` instead of a base class with implementation - - **Note: Using `RaiserEvent` is completely optional - `EventBus` works with ANY type** - - If you choose to use `RaiserEvent`, you must explicitly implement all three required properties: `id`, `occurredOn`, and `metadata` - - No more automatic property initialization - implement the interface explicitly - - This change allows events to use composition and multiple interfaces without inheritance constraints -- `RaiserEvent` now implements `ZooperDomainEvent` from `zooper_flutter_core` package - - Added `zooper_flutter_core: ^1.0.2` as an optional dependency (only needed if you use `RaiserEvent`) - - Ensures consistency across domain events in the Zooper ecosystem -- Event IDs in `RaiserEvent` now use `EventId` type (ULID-based) instead of `String` - - IDs are generated via `EventId.fromUlid()` for better uniqueness guarantees - - Access raw string value via `event.id.value` when needed -- Renamed `RaiserEvent.timestamp` property to `occurredOn` for clarity and DDD alignment -- Removed `aggregateId` as a direct property from `RaiserEvent` - - Store aggregate identifiers in the `metadata` map instead: `metadata: {'aggregateId': 'user-123'}` - - Access via `event.metadata['aggregateId'] as String?` -- Removed all helper mixins and convenience extensions - - No more `StandardRaiserEvent` mixin - - No more extension methods for `aggregateId` or `timestamp` accessors - - Events implementing `RaiserEvent` must be implemented explicitly following the interface pattern - -### Important Note - -**`EventBus` is fully generic and does not require `RaiserEvent`!** You can publish and subscribe to any type. The `RaiserEvent` interface is purely optional for users who want standardized domain event metadata. - - -## [2.0.1] - 2026-01-08 - -### Changed - -- Migrated generator implementation away from deprecated analyzer element APIs to remove deprecation warnings. - -## [2.0.0] - 2026-01-08 - -### Changed - -- **BREAKING**: Renamed `DomainEvent` to `RaiserEvent` to avoid naming conflicts with other packages - -## [1.0.0] - 2024-12-19 - -### Added - -- **EventBus** — Central dispatcher for publishing and routing domain events -- **DomainEvent** — Base class with automatic ID generation, timestamps, and optional aggregate ID -- **EventHandler** — Type-safe interface for class-based event handlers -- **Subscription** — Handle for cancelling handler registrations -- **Priority-based ordering** — Higher priority handlers execute first -- **Error handling strategies** - - `ErrorStrategy.stop` — Halt on first error (default) - - `ErrorStrategy.continueOnError` — Collect errors, throw `AggregateException` - - `ErrorStrategy.swallow` — Silent failures with optional callback -- **AggregateException** — Collects multiple handler errors when using `continueOnError` -- Comprehensive examples demonstrating basic and advanced usage patterns diff --git a/packages/raiser/example/pubspec.yaml b/packages/raiser/example/pubspec.yaml index 2fcfa55..011f15b 100644 --- a/packages/raiser/example/pubspec.yaml +++ b/packages/raiser/example/pubspec.yaml @@ -7,7 +7,9 @@ environment: dependencies: - zooper_flutter_core: ^1.0.2 + bounded: ^1.0.0 + + zooper_flutter_core: ^2.0.0 raiser: path: ../ diff --git a/packages/raiser/lib/src/events/raiser_event.dart b/packages/raiser/lib/src/events/raiser_event.dart index 9c26e9a..a9cc7e5 100644 --- a/packages/raiser/lib/src/events/raiser_event.dart +++ b/packages/raiser/lib/src/events/raiser_event.dart @@ -1,7 +1,8 @@ +import 'package:bounded/bounded.dart'; import 'package:zooper_flutter_core/zooper_flutter_core.dart'; -/// A raiser event is a Zooper domain event with an [EventId] identifier. +/// A raiser event is a Bounded domain event with an [EventId] identifier. /// /// This type is intentionally an interface so applications are not forced to /// extend a specific base class (Dart supports only single inheritance). -abstract interface class RaiserEvent implements ZooperDomainEvent {} +abstract interface class RaiserEvent implements BoundedDomainEvent {} diff --git a/packages/raiser/pubspec.yaml b/packages/raiser/pubspec.yaml index f8167ee..e1421a1 100644 --- a/packages/raiser/pubspec.yaml +++ b/packages/raiser/pubspec.yaml @@ -17,7 +17,9 @@ topics: - pub-sub dependencies: - zooper_flutter_core: ^1.0.3 + zooper_flutter_core: ^2.0.0 + + bounded: ^1.0.0 dev_dependencies: lints: ^6.0.0 diff --git a/packages/raiser_annotation/CHANGELOG.md b/packages/raiser_annotation/CHANGELOG.md deleted file mode 100644 index bdba4a4..0000000 --- a/packages/raiser_annotation/CHANGELOG.md +++ /dev/null @@ -1,31 +0,0 @@ -# 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.1.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [2.0.1] - 2026-01-08 - -### Changed - -- Migrated generator implementation away from deprecated analyzer element APIs to remove deprecation warnings. - -## [2.0.0] - 2026-01-08 - -### Changed - -- Updated documentation references from `DomainEvent` to `RaiserEvent` (matches core library breaking change) - -## [1.0.0] - 2024-12-19 - -### Added - -- **@RaiserHandler** annotation for marking event handler classes - - `priority` parameter for controlling execution order - - `busName` parameter for routing handlers to named buses -- **@RaiserMiddleware** annotation for marking middleware classes - - `priority` parameter for controlling middleware order - - `busName` parameter for routing middleware to named buses -- Support for dependency injection through annotation metadata -- Documentation and examples for all annotations diff --git a/packages/raiser_generator/CHANGELOG.md b/packages/raiser_generator/CHANGELOG.md deleted file mode 100644 index a4e5a97..0000000 --- a/packages/raiser_generator/CHANGELOG.md +++ /dev/null @@ -1,41 +0,0 @@ -# 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.1.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [2.0.1] - 2026-01-08 - -### Changed - -- Migrated generator implementation away from deprecated analyzer element APIs to remove deprecation warnings. - -## [2.0.0] - 2026-01-08 - -### Changed - -- Updated documentation and examples from `DomainEvent` to `RaiserEvent` (matches core library breaking change) -- Updated dependency constraints to `raiser: ^2.0.0` and `raiser_annotation: ^2.0.0` - -## [1.0.0] - 2024-12-19 - -### Added - -- **Two-phase builder system** - - Phase 1: `raiser_collecting` — Discovers annotated handlers and middleware per file - - Phase 2: `raiser_aggregating` — Generates consolidated registration code -- **Automatic handler discovery** — Scans codebase for `@RaiserHandler` annotations -- **Automatic middleware discovery** — Scans codebase for `@RaiserMiddleware` annotations -- **Generated registration functions** - - `initRaiser()` — Registers all handlers without dependencies - - `initRaiserWithFactories()` — Registers handlers with dependency injection support - - Named bus functions — `initRaiser{BusName}()` for handlers on specific buses -- **Dependency injection support** - - Factory parameter generation for handlers with constructor dependencies - - Preserves constructor parameter names and types -- **Priority support** — Respects priority ordering from annotations -- **Type-safe code generation** — Generates strongly-typed registration code -- **Build configuration** — Excludes generated files (.g.dart, .freezed.dart, .gr.dart, .config.dart) -- Comprehensive examples demonstrating basic and advanced usage patterns -- Full test coverage for all generation scenarios diff --git a/packages/raiser_generator/example/pubspec.yaml b/packages/raiser_generator/example/pubspec.yaml index be8f633..991e02c 100644 --- a/packages/raiser_generator/example/pubspec.yaml +++ b/packages/raiser_generator/example/pubspec.yaml @@ -7,7 +7,9 @@ environment: dependencies: - zooper_flutter_core: ^1.0.2 + bounded: ^1.0.0 + + zooper_flutter_core: ^2.0.0 raiser: path: ../../raiser diff --git a/pubspec.yaml b/pubspec.yaml index 0d0337e..cdc8ce5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,6 +17,15 @@ melos: - packages/**/example scripts: + sync_changelog: + run: | + for dir in packages/*; do + if [ -d "$dir" ] && [ -f "$dir/pubspec.yaml" ]; then + cp CHANGELOG.md "$dir/CHANGELOG.md" + fi + done + description: Copy root CHANGELOG.md into each package. + analyze: run: dart analyze . description: Run static analysis in all packages.