data_shaft 3.0.0
data_shaft: ^3.0.0 copied to clipboard
High-level data layer for Clean Architecture with standardized Drivers, typed DataSources, and Repository mixins for caching, deduplication, and safe error handling.
3.0.0 #
⚠️ BREAKING CHANGES #
- Minimum SDK raised to Dart 3.13:
environment.sdkis now">=3.13.0 <4.0.0". cool_bedrockbumped to^3.0.0: the new major version of the underlying dependency.
Added #
- HEAD request support:
HeadParams,HeadCallmixin andDatasourceHeadRemotefor remote HEAD operations. RepositoryCallErrorObserver: newcallErrorObserverslot inRepositoryObserverInstancesto observe datasource call errors together with timing info (endTime,elapsed).- Error context:
UnControlRepositoryErrornow exposescauseandstackTrace;InadmissibleRepositoryErrorexposesstatusCodeandbody. Default mappers propagate this context automatically.
Fixed #
- Caching semantics clarified:
refreshCacheis now invoked on every outcome (success and failure) and acts as the extension point for custom caching policies. By default a failed call returnsnull, which clears the cache, so the next call always re-queries the datasource. Override it (e.g.datasourceResponse.toNullable() ?? cache) to keep the last valid value on failure. - No deadlock on deduplication: the dedup key is now always released when the underlying datasource call throws.
- Driver options forwarding:
encodinganddriverOptionsare now forwarded to the driver in all HTTP methods (GET, HEAD, POST, PUT, PATCH, DELETE). - Lazy error body: the
body()callback is only evaluated on error branches incheckInformation. pathModification: now replaces every occurrence of the token instead of only the first one.
Chore #
- Aligned with Dart 3.13 lints (coolint 3.0.0), removed redundant self imports, and improved README and API documentation.
2.0.0 #
⚠️ BREAKING CHANGES #
List<int>→Set<int>for status codes:inadmissibleStatusCodeandadmissibleStatusCodeinDatasourceRemoteand observer interfaces now returnSet<int>instead ofList<int>.- Impact: Existing observer implementations that use
List<int>as parameter types must update toSet<int>. - Reasoning:
Set<int>better represents unique status codes and eliminates unnecessaryList.from()allocations.
- Impact: Existing observer implementations that use
- Observer naming & timing: Repository observer methods deprecated
name→repositoryName,callableName→datasourceName;beforeCallnow receivesstartTime,afterCallreceivesendTimeandelapsed. @mustCallSuperremoved: Removed from all abstract interface methods (no effect on pure interfaces).
Added #
useHigherObserverflag inDatasourceObserverInstancesandRepositoryObserverInstancesto enable fallback chains.Set.unmodifiable()wrapping around status codes passed to observer methods (prevents mutation).reset()method on both observer registries for test isolation.
1.1.3 #
Added #
- Datasource Remote covariant in transform and checkInformation for improve modifications
1.1.0 #
⚠️ BREAKING CHANGES #
- Observer Hierarchy Refactor:
HttpDatasourceObservernow implementsSimpleDatasourceObserverinstead ofSimpleObserver.- Impact: It is no longer necessary to implement two observers if you want the same information in common methods such as onCreate and onDispose.
- Reasoning: This change enables
DatasourceObserverInstancesto use the HTTP observer as a fallback for basic lifecycle events, reducing boilerplate configuration for users.
Fix #
- Correct use of observer in
DatasourceRemote. The default debugPrint for datasource creation will no longer appear.
1.0.0 #
- Initial version.
Added #
- Datasource abstract
- Datasource callable abstract
- Datasource local abstract
- Datasource streamable abstract
- Datasource remote abstract
- Request response
- Request params
- Request mixin
- Datasource Delete Remote
- Datasource Get Remote
- Datasource Patch Remote
- Datasource Post Remote
- Datasource Put Remote
- Drivers
- Issues
- Datasource exception
- Repository errors
- Observer
- Observer singleton instance
- Repository observer
- Datasource observer
- Repository
- Repository
- Repository with datasource
- Safe repository
- Memory cache
- Deduplication
- Deduplication safe cache
- Memory repository helper
- Deduplication repository helper
- Safe caller repository helper
Chore #
- Test
- Documentation