Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc0899e
commit 4bfb521
Showing
4 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
## [1.0.0] - 2 February 2020 | ||
## [1.1.0] - 24 February 2021 | ||
- New: `CornerstoneException`, a common exception model to make repository layer even more decoupled. | ||
- Update: Bump `json_serialization` dependency to `^3.1.1` | ||
|
||
## [1.0.0] - 2 February 2021 | ||
- **Breaking:** `CornerstonePersistentRepositoryMixin`'s `loadData()` is now removed. You just need to add dependency of `convertToSnapshot` to persistent repository with `CornerstonePersistentRepositoryMixin`. The mixin now handles loading data, and assigning it to `repo.snapshot` (Means less code to write!). The snapshot is now named `snapshot`, and declared in the mixin (you can override it). If you want to use other names for snapshot, you need to override `load`. You can override `snapshot` if you want to assign default value to it (See `auto_persistent_people_repository.dart` in example). | ||
- First stable release of cornerstone! From now on, breaking changes will only introduced with new major version. | ||
|
||
## [0.1.2] - 20 January 2020 | ||
## [0.1.2] - 20 January 2021 | ||
- Revert: `LocallyPersistentRepository` is now an abstract class again. In dart, you can use an abstract class as a mixin, but you can't have your classes extends from a mixin. You can always implements a mixin, but it will lose some built-in implementation code (In this case, e.g. `storageName`). So by making it an abstract class again, it will give you more flexibility with nothing to give up. Therefore this revert will not breaking anything. _(In case you are wondering, This is not the case with `CornerstonePersistentRepositoryMixin`. If I make it an abstract and extends from `LocallyPersistentRepository`, then it can no longer be used as a mixin.)_ | ||
- Documentation: `MultipleGetterPersisitentRepository` should be written as `CornerstonePersistentRepositoryMixin` on `ConvertToSnapshot`'s dartdoc. | ||
|
||
## [0.1.1] - 20 January 2020 | ||
## [0.1.1] - 20 January 2021 | ||
- **Breaking**: `LocallyPersistentRepository` is now a mixin. | ||
- New: `CornerstonePersistentRepositoryMixin` (was `HivePersistentRepositoryMixin` for a moment in 0.1.0) to easily add persistence functionality to your repos. Made possible using `Hive`. | ||
- New: `Hive` as a dependency for `CornerstonePersistentRepositoryMixin`. | ||
- New: `ConvertExceptionToFailure`. A mockable & reusable exception -> failure converter. This way if you have a lot of functions in a repo, doesn't need to keep testing each function for its error handling. | ||
- New: `CornerstoneSnapshot`. You can use it as base class for your repositories. It have built-in convenience like timestamp. | ||
- New: Example project has been updated to also includes `CornerstonePersistentRepositoryMixin` usage. | ||
|
||
## [0.0.2] - 13 January 2020 | ||
## [0.0.2] - 13 January 2021 | ||
- More consistency: Call in `UseCase` now accepts `Param param` instead of `Params params`. | ||
- More flexibility: UseCase is now declared as `UseCase<F, Type, Param>`. This way, you can pick any `Failure` entity you want. You can always pass the provided `Failure` for convenience. | ||
|
||
## [0.0.1] - 13 January 2020 | ||
## [0.0.1] - 13 January 2021 | ||
- Initial release of Cornerstone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:meta/meta.dart'; | ||
|
||
/// An exception to encapsulate other exceptions from data source layer or below | ||
/// to make repository layer even more decoupled. The fields of this class is | ||
/// identical to Failure for easier conversion in the repository. | ||
class CornerstoneException<T> extends Equatable implements Exception { | ||
/// Name of the error. You can put anything here, but make sure to be as | ||
/// consistent as possible to make it easier to maintain. | ||
final String name; | ||
|
||
/// You can put anything here | ||
final T details; | ||
|
||
const CornerstoneException({@required this.name, this.details}); | ||
|
||
@override | ||
List<Object> get props => [name, details]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:cornerstone/src/core/cornerstone_exception.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
test('CornerstoneException props', () { | ||
final f = CornerstoneException<Map<String, dynamic>>( | ||
name: 'TEST_ERROR', | ||
details: <String, dynamic>{'message': 'Lorem ipsum'}, | ||
); | ||
expect(f.props, [ | ||
'TEST_ERROR', | ||
<String, dynamic>{'message': 'Lorem ipsum'}, | ||
]); | ||
}); | ||
} |