diff --git a/packages/brick_build/CHANGELOG.md b/packages/brick_build/CHANGELOG.md index c0cc1801..5539723a 100644 --- a/packages/brick_build/CHANGELOG.md +++ b/packages/brick_build/CHANGELOG.md @@ -1,166 +1,170 @@ ## Unreleased -* Apply standardized lints -* `const`antize `AggregateBuilder` +## 3.1.0 + +- Apply standardized lints +- `const`antize `AggregateBuilder` +- Update `analyzer` constraints to `>=6.0.0 <7.0.0` +- Format CHANGELOG.md ## 3.0.1 -* Support Dart 3 +- Support Dart 3 ## 3.0.0 -* Update `AggregateBuilder#requiredImports` docs -* Remove unnecessary assignment in `BaseBuilder#replaceWithinFile` -* Update minimum `analyzer` constraint to `5.0.0` +- Update `AggregateBuilder#requiredImports` docs +- Remove unnecessary assignment in `BaseBuilder#replaceWithinFile` +- Update minimum `analyzer` constraint to `5.0.0` ## 2.1.2 -* Remove `// This file should NOT be version controlled and should not be manually edited.` from adapter generator and model dictionary generator. Both file types can be version controlled; `manually edited` is redundant givent the preceding `GENERATED CODE DO NOT EDIT` warning +- Remove `// This file should NOT be version controlled and should not be manually edited.` from adapter generator and model dictionary generator. Both file types can be version controlled; `manually edited` is redundant givent the preceding `GENERATED CODE DO NOT EDIT` warning ## 2.1.1 -* Add `#hasEnumDeserializeFactory` and `#hasEnumSerializeMethod` to `SharedChecker` +- Add `#hasEnumDeserializeFactory` and `#hasEnumSerializeMethod` to `SharedChecker` ## 2.1.0 -* Upgrade analyzer to version 4 +- Upgrade analyzer to version 4 ## 2.0.2 -* Loosen dependency restrictions to major versions -* Fix duplicate imports to `brick.g.dart` when class names start with the same prefix +- Loosen dependency restrictions to major versions +- Fix duplicate imports to `brick.g.dart` when class names start with the same prefix ## 2.0.1 -* Add `fromJsonConstructor` and `toJsonMethod` to `SharedChecker`, supporting easy discovery of standard methods `factory fromJson` and `#toJson`. +- Add `fromJsonConstructor` and `toJsonMethod` to `SharedChecker`, supporting easy discovery of standard methods `factory fromJson` and `#toJson`. ## 2.0.0 -* **BREAKING CHANGE** `brick.g.dart` and `adapters` are now saved to a `brick/` folder. This replaces the `app` folder. Please rename `app` to `brick` to safely migrate. -* **BREAKING CHANGE** models are now discovered by the `.model.dart` suffix. This permits models to be stored anywhere in a package. Please rename your `models/*.dart` files to `models/*.model.dart`. -* Fix adapters builder -* Fix `brick.g.dart` imports +- **BREAKING CHANGE** `brick.g.dart` and `adapters` are now saved to a `brick/` folder. This replaces the `app` folder. Please rename `app` to `brick` to safely migrate. +- **BREAKING CHANGE** models are now discovered by the `.model.dart` suffix. This permits models to be stored anywhere in a package. Please rename your `models/*.dart` files to `models/*.model.dart`. +- Fix adapters builder +- Fix `brick.g.dart` imports ## 2.0.0-rc.3 -* Include `1.4.0+1` changes +- Include `1.4.0+1` changes ## 2.0.0-rc.2 -* Fix adapters builder -* Fix `brick.g.dart` imports +- Fix adapters builder +- Fix `brick.g.dart` imports ## 2.0.0-rc.1 -* **BREAKING CHANGE** `brick.g.dart` and `adapters` are now saved to a `brick/` folder. This replaces the `app` folder. Please rename `app` to `brick` to safely migrate. -* **BREAKING CHANGE** models are now discovered by the `.model.dart` suffix. This permits models to be stored anywhere in a package. Please rename your `models/*.dart` files to `models/*.model.dart`. +- **BREAKING CHANGE** `brick.g.dart` and `adapters` are now saved to a `brick/` folder. This replaces the `app` folder. Please rename `app` to `brick` to safely migrate. +- **BREAKING CHANGE** models are now discovered by the `.model.dart` suffix. This permits models to be stored anywhere in a package. Please rename your `models/*.dart` files to `models/*.model.dart`. ## 1.4.0+1 -* Fix field sorting and discovery error +- Fix field sorting and discovery error ## 1.4.0 -* Alphabetize methods (internal refactor) -* Upgrade `analyzer` dependency to `3.2.0` +- Alphabetize methods (internal refactor) +- Upgrade `analyzer` dependency to `3.2.0` ## 1.3.0 -* Upgrade `brick_core` +- Upgrade `brick_core` ## 1.2.3 -* Allow forced type nullability on `getAssociationMethod` for improved null safety on future internals. +- Allow forced type nullability on `getAssociationMethod` for improved null safety on future internals. ## 1.2.2+1 -* Access `checkForField` by default only when deserializing for fields instead of constructor overrides +- Access `checkForField` by default only when deserializing for fields instead of constructor overrides ## 1.2.2 -* Add `checkForField` method to enforce constructor preference over field definition for type inference in adapter generation. +- Add `checkForField` method to enforce constructor preference over field definition for type inference in adapter generation. ## 1.2.1 -* Remove `// ignore_for_file: prefer_null_aware_operators` +- Remove `// ignore_for_file: prefer_null_aware_operators` ## 1.2.0+3 -* Remove `// ignore_for_file: unnecessary_non_null_assertion` and `// ignore_for_file: invalid_null_aware_operator` from all adapters and add `// ignore_for_file: prefer_null_aware_operators` -* Remove setting `repositoryHasBeenForceCast` in `SerdesGenerator#getAssociationMethod` +- Remove `// ignore_for_file: unnecessary_non_null_assertion` and `// ignore_for_file: invalid_null_aware_operator` from all adapters and add `// ignore_for_file: prefer_null_aware_operators` +- Remove setting `repositoryHasBeenForceCast` in `SerdesGenerator#getAssociationMethod` ## 1.2.0+2 -* Remove `@visibleForOverriding` annotation from `SerdesGenerator#deserializeNullableClause` +- Remove `@visibleForOverriding` annotation from `SerdesGenerator#deserializeNullableClause` ## 1.2.0 -* Add Dart Lints -* Improve null safe checking in example -* Add `repositoryHasBeenForceCast` to determine whether a repository needs to use the null operator `!`. Warnings clutter the console when running `flutter build` or `flutter test` and they cannot be disabled with `--no-sound-null-safety` -* Convert `SerdesGenerator.getAssociationMethod` to `SerdesGenerator#getAssociationMethod` to access `repositoryHasBeenForceCast` +- Add Dart Lints +- Improve null safe checking in example +- Add `repositoryHasBeenForceCast` to determine whether a repository needs to use the null operator `!`. Warnings clutter the console when running `flutter build` or `flutter test` and they cannot be disabled with `--no-sound-null-safety` +- Convert `SerdesGenerator.getAssociationMethod` to `SerdesGenerator#getAssociationMethod` to access `repositoryHasBeenForceCast` ## 1.1.0+3 -* Ignore `unnecessary_non_null_assertion` and `invalid_null_aware_operator` in adapter generated code. If a repository is forced to a non-null value (`repository!`) subsequent access of the repository must not have an operator (`repository.` instead of `repository?`). Brick determines properties on a per-member basis, requiring a break in architecture to resolve subsquent access. These are linter warnings, not errors, and therefore they're safe to ignore for adapters. +- Ignore `unnecessary_non_null_assertion` and `invalid_null_aware_operator` in adapter generated code. If a repository is forced to a non-null value (`repository!`) subsequent access of the repository must not have an operator (`repository.` instead of `repository?`). Brick determines properties on a per-member basis, requiring a break in architecture to resolve subsquent access. These are linter warnings, not errors, and therefore they're safe to ignore for adapters. ## 1.1.0+2 -* Remove `part` and `export` directives during build +- Remove `part` and `export` directives during build ## 1.1.0+1 -* Do not generate null-safe return values in adapters if the member cannot be null. For example, this would remove `data['name'] == null ? null :` in the REST adapter function of field that cannot be null in Dart >=2.12 +- Do not generate null-safe return values in adapters if the member cannot be null. For example, this would remove `data['name'] == null ? null :` in the REST adapter function of field that cannot be null in Dart >=2.12 ## 1.1.0 -* **BREAKING CHANGE** removing `testing.dart` in favor of new package `brick_build_test`. Please use `import 'package:brick_build_test/brick_build_test.dart'` instead. `source_gen_test` is not null safe, and testing shouldn't be in distributed packages anyway. +- **BREAKING CHANGE** removing `testing.dart` in favor of new package `brick_build_test`. Please use `import 'package:brick_build_test/brick_build_test.dart'` instead. `source_gen_test` is not null safe, and testing shouldn't be in distributed packages anyway. ## 1.0.0 -* Null safety +- Null safety ## 0.0.9 -* If `fromGenerator` or `toGenerator` is declared, the field will be generated for deserializing and serializing adapters, respectively -* Strictly assign analyzer ahead of nullability release versions +- If `fromGenerator` or `toGenerator` is declared, the field will be generated for deserializing and serializing adapters, respectively +- Strictly assign analyzer ahead of nullability release versions ## 0.0.8+2 -* Override build methods +- Override build methods ## 0.0.8+1 -* Remove `getInheritedConcreteMap` from `fields_for_class.dart` as it's no longer used. +- Remove `getInheritedConcreteMap` from `fields_for_class.dart` as it's no longer used. ## 0.0.8 -* Add method `ignoreCoderForField` to `SerdesGenerator`. This doesn't change existing functionality; it only moves it to an overridable method. +- Add method `ignoreCoderForField` to `SerdesGenerator`. This doesn't change existing functionality; it only moves it to an overridable method. ## 0.0.7 -* Use assignable instead of super type comparison when checking for siblings to account for inherited classes (#55) -* Add ability to overwrite the nullable check for deserializing members +- Use assignable instead of super type comparison when checking for siblings to account for inherited classes (#55) +- Add ability to overwrite the nullable check for deserializing members ## 0.0.6 -* Rename `ProviderSerializable` to `ProviderSerializableGenerator` to be more explicit -* Rename `SharedChecker#mapArgs` to `SharedChecker#typeArguments` +- Rename `ProviderSerializable` to `ProviderSerializableGenerator` to be more explicit +- Rename `SharedChecker#mapArgs` to `SharedChecker#typeArguments` ## 0.0.4 -* Update for new [brick_core](https://github.com/GetDutchie/brick/tree/main/packages/brick_core) API on `Where` -* Move shareable methods from `OfflineFirstSerdesGenerator` to `SerdesGenerator` -* Constrain version of [brick_core](https://github.com/GetDutchie/brick/tree/main/packages/brick_core) -* Split code to separate projects: `rest_serdes` to [brick_rest_generators](https://github.com/GetDutchie/brick/tree/main/packages/brick_rest_generators), `sqlite_serdes` and subsequent SQLite builders to [brick_sqlite_generators](https://github.com/GetDutchie/brick/tree/main/packages/brick_sqlite_generators), and all OfflineFirst-specific logic to [brick_offline_first_with_rest_build](https://github.com/GetDutchie/brick/tree/main/packages/brick_offline_first_with_rest). -* `testing.dart` is available for useful testing methods -* This package is now a series of utilities and interfaces; it no longer produces generated code. +- Update for new [brick_core](https://github.com/GetDutchie/brick/tree/main/packages/brick_core) API on `Where` +- Move shareable methods from `OfflineFirstSerdesGenerator` to `SerdesGenerator` +- Constrain version of [brick_core](https://github.com/GetDutchie/brick/tree/main/packages/brick_core) +- Split code to separate projects: `rest_serdes` to [brick_rest_generators](https://github.com/GetDutchie/brick/tree/main/packages/brick_rest_generators), `sqlite_serdes` and subsequent SQLite builders to [brick_sqlite_generators](https://github.com/GetDutchie/brick/tree/main/packages/brick_sqlite_generators), and all OfflineFirst-specific logic to [brick_offline_first_with_rest_build](https://github.com/GetDutchie/brick/tree/main/packages/brick_offline_first_with_rest). +- `testing.dart` is available for useful testing methods +- This package is now a series of utilities and interfaces; it no longer produces generated code. ## 0.0.3 -* Use `ConnectOfflineFirstWithRest` +- Use `ConnectOfflineFirstWithRest` ## 0.0.2 -* Uses `getDisplayString` instead of deprecated `name` -* Fix linter hints +- Uses `getDisplayString` instead of deprecated `name` +- Fix linter hints diff --git a/packages/brick_build/example/file_serdes_generator.dart b/packages/brick_build/example/file_serdes_generator.dart index 922f4ad6..dc371bcf 100644 --- a/packages/brick_build/example/file_serdes_generator.dart +++ b/packages/brick_build/example/file_serdes_generator.dart @@ -1,6 +1,6 @@ -import 'package:analyzer/dart/element/element.dart'; -import 'package:brick_core/core.dart' show Model; import 'package:brick_build/generators.dart'; +import 'package:brick_core/core.dart' show Model; + import 'file_fields.dart'; /// This would be in a separate package @@ -14,8 +14,8 @@ abstract class FileSerdesGenerator<_Model extends FileModel> extends SerdesGener final String repositoryName; FileSerdesGenerator( - ClassElement element, - FileFields fields, { + super.element, + super.fields, { required this.repositoryName, - }) : super(element, fields); + }); } diff --git a/packages/brick_build/example/file_serialize.dart b/packages/brick_build/example/file_serialize.dart index d3d61ef9..1a71216a 100644 --- a/packages/brick_build/example/file_serialize.dart +++ b/packages/brick_build/example/file_serialize.dart @@ -1,14 +1,12 @@ -import 'package:analyzer/dart/element/element.dart'; -import 'file_fields.dart'; import 'file_serdes_generator.dart'; /// Generate serialized code for each field to write to a file class FileSerialize<_Model extends FileModel> extends FileSerdesGenerator<_Model> { FileSerialize( - ClassElement element, - FileFields fields, { - required String repositoryName, - }) : super(element, fields, repositoryName: repositoryName); + super.element, + super.fields, { + required super.repositoryName, + }); @override final doesDeserialize = false; @@ -31,7 +29,7 @@ class FileSerialize<_Model extends FileModel> extends FileSerdesGenerator<_Model // Iterable if (argTypeChecker.isEnum) { - return '$fieldValue?.map((e) => ${checker.argType.getDisplayString(withNullability: false)}.values.indexOf(e))'; + return '$fieldValue?.map((e) => ${checker.argType.getDisplayString().replaceAll('?', '')}.values.indexOf(e))'; } // Iterable, Iterable> diff --git a/packages/brick_build/lib/src/utils/shared_checker.dart b/packages/brick_build/lib/src/utils/shared_checker.dart index 48cdf32c..f2077292 100644 --- a/packages/brick_build/lib/src/utils/shared_checker.dart +++ b/packages/brick_build/lib/src/utils/shared_checker.dart @@ -181,9 +181,9 @@ class SharedChecker<_SiblingModel extends Model> { if (classElement.supertype?.typeArguments == null || classElement.supertype!.typeArguments.isEmpty) { throw InvalidGenerationSourceError( - 'Type argument for ${targetType.getDisplayString(withNullability: true)} is undefined.', + 'Type argument for ${targetType.getDisplayString()} is undefined.', todo: - 'Define the type on class ${targetType.element}, e.g. `extends ${classElement.supertype!.getDisplayString(withNullability: false)}`', + 'Define the type on class ${targetType.element}, e.g. `extends ${classElement.supertype!.getDisplayString().replaceAll('?', '')}`', element: targetType.element, ); } @@ -222,7 +222,7 @@ class SharedChecker<_SiblingModel extends Model> { } /// Print the `DartType` without nullability - static String withoutNullability(DartType type) => type.getDisplayString(withNullability: false); + static String withoutNullability(DartType type) => type.getDisplayString().replaceAll('?', ''); /// Destructs a type to determine the bottom type after going through Futures and Iterables. /// diff --git a/packages/brick_build/pubspec.yaml b/packages/brick_build/pubspec.yaml index d8745151..55a35aec 100644 --- a/packages/brick_build/pubspec.yaml +++ b/packages/brick_build/pubspec.yaml @@ -4,13 +4,13 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_build issue_tracker: https://github.com/GetDutchie/brick/issues repository: https://github.com/GetDutchie/brick -version: 3.0.1 +version: 3.1.0 environment: sdk: ">=2.18.0 <4.0.0" dependencies: - analyzer: ">=5.0.0 <6.0.0" + analyzer: ">=6.0.0 <7.0.0" brick_core: ^1.1.1 build: ^2.3.0 dart_style: ">=2.0.0 <3.0.0" diff --git a/packages/brick_graphql_generators/CHANGELOG.md b/packages/brick_graphql_generators/CHANGELOG.md index 1cf0c019..998f706b 100644 --- a/packages/brick_graphql_generators/CHANGELOG.md +++ b/packages/brick_graphql_generators/CHANGELOG.md @@ -1,67 +1,72 @@ ## Unreleased +## 3.2.0 + +- Update `analyzer` constraints to `>=6.0.0 <7.0.0` +- Format CHANGELOG.md + ## 3.1.0 -* Apply standardized lints -* Upgrade minimum Dart to 2.18 +- Apply standardized lints +- Upgrade minimum Dart to 2.18 ## 3.0.1 -* Support Dart 3 +- Support Dart 3 ## 3.0.0 -* Update dependency import paths -* Update minimum `analyzer` constraint to `5.0.0` +- Update dependency import paths +- Update minimum `analyzer` constraint to `5.0.0` ## 2.0.1 -* Remove `FallThroughError` after Dart beta deprecation +- Remove `FallThroughError` after Dart beta deprecation ## 2.0.0 -* Breaking Change upgrade to support `brick_graphql` v2. Please [review the migration guide](https://github.com/GetDutchie/brick/blob/main/packages/brick_graphql/CHANGELOG.md#200). +- Breaking Change upgrade to support `brick_graphql` v2. Please [review the migration guide](https://github.com/GetDutchie/brick/blob/main/packages/brick_graphql/CHANGELOG.md#200). ## 1.4.0 -* Upgrade analyzer to version 4 +- Upgrade analyzer to version 4 ## 1.3.0 -* Generate `RuntimeGraphqlDefinitions#subfields` as `Map>` to support nested properties of JSON-encoded fields. +- Generate `RuntimeGraphqlDefinitions#subfields` as `Map>` to support nested properties of JSON-encoded fields. ## 1.2.2 -* Abstract the logic for `GraphqlSerialize#instanceFieldsAndMethods` to be populated by overrideable method `generateGraphqlDefinition` -* Remove ignored fields from `fieldsToGraphqlRuntimeDefinition` if they are `@Graphql(ignore:)` +- Abstract the logic for `GraphqlSerialize#instanceFieldsAndMethods` to be populated by overrideable method `generateGraphqlDefinition` +- Remove ignored fields from `fieldsToGraphqlRuntimeDefinition` if they are `@Graphql(ignore:)` ## 1.2.1 -* Generate `subfields` from the return type `toJson` methods -* Strip arg type arguments from `toJson` return types to maintain support for Dart <2.15 +- Generate `subfields` from the return type `toJson` methods +- Strip arg type arguments from `toJson` return types to maintain support for Dart <2.15 ## 1.2.0 -* Loosen dependency restrictions to major versions -* Support `fromJson` and `toJson` methods +- Loosen dependency restrictions to major versions +- Support `fromJson` and `toJson` methods ## 1.1.0 -* Stable release +- Stable release ## 1.0.3 -* Use `brick_json_generators` instead of `brick_rest_generators` +- Use `brick_json_generators` instead of `brick_rest_generators` ## 1.0.2 -* Upgrade Analyzer to 3.2.0 -* Revise `FieldRename` enum discovery to use Analyzer's new API +- Upgrade Analyzer to 3.2.0 +- Revise `FieldRename` enum discovery to use Analyzer's new API ## 1.0.1 -* Loosen restriction for `brick_build` +- Loosen restriction for `brick_build` ## 1.0.0+1 -* Use `brick_graphql` from pub +- Use `brick_graphql` from pub diff --git a/packages/brick_graphql_generators/lib/src/graphql_serialize.dart b/packages/brick_graphql_generators/lib/src/graphql_serialize.dart index 15abdefd..3ce1c22b 100644 --- a/packages/brick_graphql_generators/lib/src/graphql_serialize.dart +++ b/packages/brick_graphql_generators/lib/src/graphql_serialize.dart @@ -47,12 +47,13 @@ class GraphqlSerialize extends GraphqlSerdesGenerator with JsonSerialize=2.18.0 <4.0.0" dependencies: - analyzer: ">=5.0.0 <6.0.0" + analyzer: ">=6.0.0 <7.0.0" brick_build: ">=3.0.0 <4.0.0" brick_graphql: ">=3.0.0 <4.0.0" brick_json_generators: ">=3.0.0 <4.0.0" diff --git a/packages/brick_json_generators/CHANGELOG.md b/packages/brick_json_generators/CHANGELOG.md index c2af86e8..2bef8e04 100644 --- a/packages/brick_json_generators/CHANGELOG.md +++ b/packages/brick_json_generators/CHANGELOG.md @@ -1,42 +1,46 @@ ## Unreleased -* Apply standardized lints +## 3.1.0 + +- Apply standardized lints +- Update `analyzer` constraints to `>=6.0.0 <7.0.0` +- Format CHANGELOG.md ## 3.0.2 -* Ensure deserializing string-based enums iterate on an array of strings (#345) +- Ensure deserializing string-based enums iterate on an array of strings (#345) ## 3.0.1 -* Support Dart 3 +- Support Dart 3 ## 3.0.0 -* Update minimum `analyzer` constraint to `5.0.0` -* Use Dart 2.15's `.byName` accessor for iterable enum values +- Update minimum `analyzer` constraint to `5.0.0` +- Use Dart 2.15's `.byName` accessor for iterable enum values ## 1.1.1 -* Respect enum `from` constructors and `to` methods +- Respect enum `from` constructors and `to` methods ## 1.1.0 -* Upgrade analyzer to version 4 +- Upgrade analyzer to version 4 ## 1.0.3 -* Do not auto assign values for nullable iterables when deserializing +- Do not auto assign values for nullable iterables when deserializing ## 1.0.2 -* Loosen dependency restrictions to major versions -* Check for nullability before deserializing single associations +- Loosen dependency restrictions to major versions +- Check for nullability before deserializing single associations ## 1.0.1 -* If `.fromJson` is defined on a field's class, the field will be recognized in the adapter and `.fromJson` will be used when deserializing. -* If `#toJson` is defined on a field's class, the field will be recognized in the adapter and `#toJson` will be used when serializing. +- If `.fromJson` is defined on a field's class, the field will be recognized in the adapter and `.fromJson` will be used when deserializing. +- If `#toJson` is defined on a field's class, the field will be recognized in the adapter and `#toJson` will be used when serializing. ## 1.0.0 -* Separate `brick_json_generators` to its own package from `brick_rest_generators` +- Separate `brick_json_generators` to its own package from `brick_rest_generators` diff --git a/packages/brick_json_generators/lib/json_deserialize.dart b/packages/brick_json_generators/lib/json_deserialize.dart index 4bd95aab..f52b835c 100644 --- a/packages/brick_json_generators/lib/json_deserialize.dart +++ b/packages/brick_json_generators/lib/json_deserialize.dart @@ -94,7 +94,7 @@ mixin JsonDeserialize ${klass.displayName}.fromJson(d as ${parameterType.getDisplayString(withNullability: true)}) + (d) => ${klass.displayName}.fromJson(d as ${parameterType.getDisplayString()}) )$castIterable$defaultValue'''; } @@ -138,7 +138,7 @@ mixin JsonDeserialize=2.18.0 <4.0.0" dependencies: - analyzer: ">=5.0.0 <6.0.0" + analyzer: ">=6.0.0 <7.0.0" brick_core: ^1.1.1 brick_build: ">=3.0.0 <4.0.0" build: ">=2.0.0 <3.0.0" diff --git a/packages/brick_offline_first/test/offline_first/helpers/test_domain.dart b/packages/brick_offline_first/test/offline_first/helpers/test_domain.dart index 96f15bde..b078d7f4 100644 --- a/packages/brick_offline_first/test/offline_first/helpers/test_domain.dart +++ b/packages/brick_offline_first/test/offline_first/helpers/test_domain.dart @@ -4,8 +4,6 @@ import 'package:brick_core/core.dart'; import 'package:brick_offline_first/src/models/offline_first_model.dart'; import 'package:brick_offline_first/src/offline_first_adapter.dart'; import 'package:brick_offline_first/src/offline_first_repository.dart'; -import 'package:brick_sqlite/brick_sqlite.dart'; -import 'package:brick_sqlite/db.dart'; import 'package:brick_sqlite/memory_cache_provider.dart'; import '__mocks__.dart'; @@ -91,13 +89,11 @@ abstract class OfflineFirstWithTestRepository extends OfflineFirstRepository { OfflineFirstWithTestRepository({ required TestProvider testProvider, - required SqliteProvider sqliteProvider, + required super.sqliteProvider, required MemoryCacheProvider cacheProvider, - required Set migrations, + required super.migrations, }) : super( remoteProvider: testProvider, - sqliteProvider: sqliteProvider, memoryCacheProvider: cacheProvider, - migrations: migrations, ); } diff --git a/packages/brick_offline_first_build/CHANGELOG.md b/packages/brick_offline_first_build/CHANGELOG.md index 48142086..b80ffc55 100644 --- a/packages/brick_offline_first_build/CHANGELOG.md +++ b/packages/brick_offline_first_build/CHANGELOG.md @@ -1,56 +1,61 @@ ## Unreleased +## 3.2.0 + +- Update `analyzer` constraints to `>=6.0.0 <7.0.0` +- Format CHANGELOG.md + ## 3.1.0 -* Apply standardized lints -* Support using `OfflineFirstSerdes` as a unique field in SQLite +- Apply standardized lints +- Support using `OfflineFirstSerdes` as a unique field in SQLite ## 3.0.1 -* Support Dart 3 +- Support Dart 3 ## 3.0.0 -* Remove `brick_sqlite_abstract` -* Remove `brick_offline_first_abstract` -* Update imports from `_abstract` packages -* Support `applyToRemoteDeserialization` and `fieldsToOfflineFirstRuntimeDefinition` -* Update minimum `analyzer` constraint to `5.0.0` +- Remove `brick_sqlite_abstract` +- Remove `brick_offline_first_abstract` +- Update imports from `_abstract` packages +- Support `applyToRemoteDeserialization` and `fieldsToOfflineFirstRuntimeDefinition` +- Update minimum `analyzer` constraint to `5.0.0` ## 2.1.1 -* Respect enum `from` constructors and `to` methods +- Respect enum `from` constructors and `to` methods ## 2.1.0 -* Upgrade analyzer to version 4 +- Upgrade analyzer to version 4 ## 2.0.1 -* Import `DatabaseExecutor` from `sqflite_common` instead of `sqflite` to avoid the Flutter dependency -* Loosen dependency restrictions to major versions +- Import `DatabaseExecutor` from `sqflite_common` instead of `sqflite` to avoid the Flutter dependency +- Loosen dependency restrictions to major versions ## 2.0.0 -* Include release candidates of build dependencies +- Include release candidates of build dependencies ## 1.1.0 -* Upgrade `analyzer` dependency to `3.2.0` -* Bump `brick_rest_generators` and `brick_sqlite_generators` to `1.3.0` +- Upgrade `analyzer` dependency to `3.2.0` +- Bump `brick_rest_generators` and `brick_sqlite_generators` to `1.3.0` ## 1.0.1 -* Loosen pubspec restrictions +- Loosen pubspec restrictions ## 1.0.0+2 -* Permit v1 and v2 of `brick_offline_first_abstract` +- Permit v1 and v2 of `brick_offline_first_abstract` ## 1.0.0+1 -* Add JSON generators and `brick_rest_generators` dependency +- Add JSON generators and `brick_rest_generators` dependency ## 1.0.0 -* Initial +- Initial diff --git a/packages/brick_offline_first_build/lib/src/offline_first_json_generators.dart b/packages/brick_offline_first_build/lib/src/offline_first_json_generators.dart index 922f3844..49b575d3 100644 --- a/packages/brick_offline_first_build/lib/src/offline_first_json_generators.dart +++ b/packages/brick_offline_first_build/lib/src/offline_first_json_generators.dart @@ -198,8 +198,7 @@ mixin OfflineFirstJsonDeserialize ${SharedChecker.withoutNullability(checker.argType)}.$constructorName(c as $serializableType))$castIterable$defaultValue'; } diff --git a/packages/brick_offline_first_build/lib/src/offline_first_sqlite_generators.dart b/packages/brick_offline_first_build/lib/src/offline_first_sqlite_generators.dart index a3b7528c..17f4e257 100644 --- a/packages/brick_offline_first_build/lib/src/offline_first_sqlite_generators.dart +++ b/packages/brick_offline_first_build/lib/src/offline_first_sqlite_generators.dart @@ -91,8 +91,7 @@ class OfflineFirstSqliteDeserialize extends SqliteDeserialize { if (argTypeChecker.hasSerdes) { final doesHaveConstructor = hasConstructor(checker.argType); if (doesHaveConstructor) { - final serializableType = - argTypeChecker.superClassTypeArgs.last.getDisplayString(withNullability: true); + final serializableType = argTypeChecker.superClassTypeArgs.last.getDisplayString(); return ''' jsonDecode($fieldValue).map( (c) => $argType.$constructorName(c as $serializableType) @@ -106,8 +105,7 @@ class OfflineFirstSqliteDeserialize extends SqliteDeserialize { if ((checker as OfflineFirstChecker).hasSerdes) { final doesHaveConstructor = hasConstructor(field.type); if (doesHaveConstructor) { - final serializableType = - checker.superClassTypeArgs.last.getDisplayString(withNullability: true); + final serializableType = checker.superClassTypeArgs.last.getDisplayString(); return '${SharedChecker.withoutNullability(field.type)}.$constructorName($fieldValue as $serializableType)'; } } diff --git a/packages/brick_offline_first_build/pubspec.yaml b/packages/brick_offline_first_build/pubspec.yaml index ad196318..73445db4 100644 --- a/packages/brick_offline_first_build/pubspec.yaml +++ b/packages/brick_offline_first_build/pubspec.yaml @@ -4,13 +4,13 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_offline_f issue_tracker: https://github.com/GetDutchie/brick/issues repository: https://github.com/GetDutchie/brick -version: 3.1.0 +version: 3.2.0 environment: sdk: ">=2.18.0 <4.0.0" dependencies: - analyzer: ">=5.0.0 <6.0.0" + analyzer: ">=6.0.0 <7.0.0" brick_build: ">=3.0.0 <4.0.0" brick_core: ^1.1.1 brick_json_generators: ">=3.0.0 <4.0.0" diff --git a/packages/brick_offline_first_with_graphql_build/CHANGELOG.md b/packages/brick_offline_first_with_graphql_build/CHANGELOG.md index 705c98b1..a160555b 100644 --- a/packages/brick_offline_first_with_graphql_build/CHANGELOG.md +++ b/packages/brick_offline_first_with_graphql_build/CHANGELOG.md @@ -1,58 +1,63 @@ ## Unreleased +## 3.3.0 + +- Update `analyzer` constraints to `>=6.0.0 <7.0.0` +- Format CHANGELOG.md + ## 3.2.0 -* Apply standardized lints -* Upgrade minimum Dart to 2.18 +- Apply standardized lints +- Upgrade minimum Dart to 2.18 ## 3.1.0 -* _Soft breaking change_: Rename `build.yaml` builder keys from camelCase to snake_case (e.g. `brickAggregateBuilder` becomes `brick_aggregate_builder`). This shouldn't affect implementations because these builders do not support configuration, but some implementations may use `runs_before`. For these implementations, please rename all configured builders from this package. -* Update `build.yaml` to support Dart 3 (#343 #344) -* Add `brick_new_migration_builder` (separated from `brick_schema_builder`) +- _Soft breaking change_: Rename `build.yaml` builder keys from camelCase to snake_case (e.g. `brickAggregateBuilder` becomes `brick_aggregate_builder`). This shouldn't affect implementations because these builders do not support configuration, but some implementations may use `runs_before`. For these implementations, please rename all configured builders from this package. +- Update `build.yaml` to support Dart 3 (#343 #344) +- Add `brick_new_migration_builder` (separated from `brick_schema_builder`) ## 3.0.1 -* Support Dart 3 +- Support Dart 3 ## 3.0.0 -* Remove `brick_sqlite_abstract` dependency -* Remove `brick_offline_first_abstract` dependency -* Remove `brick_offline_first_with_graphql_abstract` dependency -* Update import paths +- Remove `brick_sqlite_abstract` dependency +- Remove `brick_offline_first_abstract` dependency +- Remove `brick_offline_first_with_graphql_abstract` dependency +- Update import paths ## 1.3.1 -* Merge `brickSchemaBuilder` into `brickNewMigrationBuilder` and rename to `brickSchemaBuilder` to ensure the schema is compiled before the migration. `runs_before` was not working, perhaps because of [the combination](https://github.com/dart-lang/build/blob/85900b19ee186d133b41e957fd60836282b45d7c/docs/builder_author_faq.md#why-cant-my-builder-resolve-code-output-by-another-builder) with `combining_builder` +- Merge `brickSchemaBuilder` into `brickNewMigrationBuilder` and rename to `brickSchemaBuilder` to ensure the schema is compiled before the migration. `runs_before` was not working, perhaps because of [the combination](https://github.com/dart-lang/build/blob/85900b19ee186d133b41e957fd60836282b45d7c/docs/builder_author_faq.md#why-cant-my-builder-resolve-code-output-by-another-builder) with `combining_builder` ## 1.3.0 -* Upgrade analyzer to version 4 -* Generate `RuntimeGraphqlDefinitions#subfields` as `Map>` to support nested properties of JSON-encoded fields. -* Apply `@OfflineFirst(where:)` params to GraphQL document configuration. Note that the current implementation ignores multiple `where` properties (`OfflineFirst(where: {'id': 'data["id"]', 'otherVar': 'data["otherVar"]'})`) and nested values (`OfflineFirst(where: {'id': 'data["subfield"]["id"]})`). -* Support `brick_graphql` v2 +- Upgrade analyzer to version 4 +- Generate `RuntimeGraphqlDefinitions#subfields` as `Map>` to support nested properties of JSON-encoded fields. +- Apply `@OfflineFirst(where:)` params to GraphQL document configuration. Note that the current implementation ignores multiple `where` properties (`OfflineFirst(where: {'id': 'data["id"]', 'otherVar': 'data["otherVar"]'})`) and nested values (`OfflineFirst(where: {'id': 'data["subfield"]["id"]})`). +- Support `brick_graphql` v2 ## 1.2.0+1 -* Fix migration and model discovery +- Fix migration and model discovery ## 1.2.0 -* Permit using `part` and `part of` files outside of models +- Permit using `part` and `part of` files outside of models ## 1.1.1 -* Loosen dependency restrictions to major versions +- Loosen dependency restrictions to major versions ## 1.1.0 -* Stable release +- Stable release ## 1.0.2 -* Enforce `brick_build` version `2.0.0-rc.2` +- Enforce `brick_build` version `2.0.0-rc.2` ## 1.0.1 -* Support `brick_offline_first_with_graphql_abstract` +- Support `brick_offline_first_with_graphql_abstract` diff --git a/packages/brick_offline_first_with_graphql_build/pubspec.yaml b/packages/brick_offline_first_with_graphql_build/pubspec.yaml index 0eeedc8e..7176e77b 100644 --- a/packages/brick_offline_first_with_graphql_build/pubspec.yaml +++ b/packages/brick_offline_first_with_graphql_build/pubspec.yaml @@ -4,13 +4,13 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_offline_f issue_tracker: https://github.com/GetDutchie/brick/issues repository: https://github.com/GetDutchie/brick -version: 3.2.0 +version: 3.3.0 environment: sdk: ">=2.18.0 <4.0.0" dependencies: - analyzer: ">=5.0.0 <6.0.0" + analyzer: ">=6.0.0 <7.0.0" brick_build: ">=3.0.0 <4.0.0" brick_graphql: ">=3.0.0 <4.0.0" brick_graphql_generators: ">=3.0.0 <4.0.0" diff --git a/packages/brick_offline_first_with_rest_build/CHANGELOG.md b/packages/brick_offline_first_with_rest_build/CHANGELOG.md index 7db22067..e39a73f8 100644 --- a/packages/brick_offline_first_with_rest_build/CHANGELOG.md +++ b/packages/brick_offline_first_with_rest_build/CHANGELOG.md @@ -1,97 +1,100 @@ ## Unreleased -* Apply standardized lints +## 3.2.0 + +- Apply standardized lints +- Update `analyzer` constraints to `>=6.0.0 <7.0.0` +- Format CHANGELOG.md ## 3.1.0 -* _Soft breaking change_: Rename `build.yaml` builder keys from camelCase to snake_case (e.g. `brickAggregateBuilder` becomes `brick_aggregate_builder`). This shouldn't affect implementations because these builders do not support configuration, but some implementations may use `runs_before`. For these implementations, please rename all configured builders from this package. -* Update `build.yaml` to support Dart 3 (#343 #344) -* Add `brick_new_migration_builder` (separated from `brick_schema_builder`) +- _Soft breaking change_: Rename `build.yaml` builder keys from camelCase to snake_case (e.g. `brickAggregateBuilder` becomes `brick_aggregate_builder`). This shouldn't affect implementations because these builders do not support configuration, but some implementations may use `runs_before`. For these implementations, please rename all configured builders from this package. +- Update `build.yaml` to support Dart 3 (#343 #344) +- Add `brick_new_migration_builder` (separated from `brick_schema_builder`) ## 3.0.1 -* Support Dart 3 +- Support Dart 3 ## 3.0.0 -* Remove `brick_sqlite_abstract`; import `brick_sqlite` directly -* Remove `brick_offline_first_abstract` depedency -* Remove `brick_offline_first_with_rest_abstract` depedency -* Update references to renamed v3 files like `brick_rest/brick_rest.dart` +- Remove `brick_sqlite_abstract`; import `brick_sqlite` directly +- Remove `brick_offline_first_abstract` depedency +- Remove `brick_offline_first_with_rest_abstract` depedency +- Update references to renamed v3 files like `brick_rest/brick_rest.dart` ## 2.1.1 -* Merge `brickSchemaBuilder` into `brickNewMigrationBuilder` and rename to `brickSchemaBuilder` to ensure the schema is compiled before the migration. `runs_before` was not working, perhaps because of [the combination](https://github.com/dart-lang/build/blob/85900b19ee186d133b41e957fd60836282b45d7c/docs/builder_author_faq.md#why-cant-my-builder-resolve-code-output-by-another-builder) with `combining_builder` +- Merge `brickSchemaBuilder` into `brickNewMigrationBuilder` and rename to `brickSchemaBuilder` to ensure the schema is compiled before the migration. `runs_before` was not working, perhaps because of [the combination](https://github.com/dart-lang/build/blob/85900b19ee186d133b41e957fd60836282b45d7c/docs/builder_author_faq.md#why-cant-my-builder-resolve-code-output-by-another-builder) with `combining_builder` ## 2.1.0 -* Upgrade analyzer to version 4 +- Upgrade analyzer to version 4 ## 2.0.1+1 -* Fix migration and model discovery +- Fix migration and model discovery ## 2.0.1 -* Permit using `part` and `part of` files outside of models +- Permit using `part` and `part of` files outside of models ## 2.0.0 -* Loosen dependency restrictions to major versions -* Update brick packages to 2.0.0 +- Loosen dependency restrictions to major versions +- Update brick packages to 2.0.0 ## 1.3.0 -* Upgrade `analyzer` dependency to `3.2.0` -* Bump `brick_rest_generators` and `brick_sqlite_generators` to `1.3.0` -* Bump `brick_offline_first_build` to `1.1.0` +- Upgrade `analyzer` dependency to `3.2.0` +- Bump `brick_rest_generators` and `brick_sqlite_generators` to `1.3.0` +- Bump `brick_offline_first_build` to `1.1.0` ## 1.2.0 -* Remove unnecessary import in `brick.g.dart` -* Upgrade `brick_build`, `brick_rest_generators`, `brick_sqlite_generators`, `brick_sqlite_abstract` +- Remove unnecessary import in `brick.g.dart` +- Upgrade `brick_build`, `brick_rest_generators`, `brick_sqlite_generators`, `brick_sqlite_abstract` ## 1.1.4 -* Always use `whereType` casts after awaiting `Future.wait()` in Rest deserializing adapters. -* Bump `brick_build` +- Always use `whereType` casts after awaiting `Future.wait()` in Rest deserializing adapters. +- Bump `brick_build` ## 1.1.3 -* Bump `brick_sqlite_generators` +- Bump `brick_sqlite_generators` ## 1.1.2 -* Prefer constructor field type (including nullability) over field definition for type inference in adapter generation. -* **BREAKING CHANGE**: Remove support for nullable futures as the outer-most type (eg brick now reads `Future?` as `Future`, but `List?>?` remains valid). -* Bump `brick_build` -* Bump `brick_rest_generators` +- Prefer constructor field type (including nullability) over field definition for type inference in adapter generation. +- **BREAKING CHANGE**: Remove support for nullable futures as the outer-most type (eg brick now reads `Future?` as `Future`, but `List?>?` remains valid). +- Bump `brick_build` +- Bump `brick_rest_generators` ## 1.1.1 -* Always cast when deserializing `OfflineFirstSerdes` from SQLite -* Always cast when deserializing `OfflineFirstSerdes` from REST -* Use null aware operators when deserializing `OfflineFirstSerdes` iterables from REST - +- Always cast when deserializing `OfflineFirstSerdes` from SQLite +- Always cast when deserializing `OfflineFirstSerdes` from REST +- Use null aware operators when deserializing `OfflineFirstSerdes` iterables from REST ## 1.1.0 -* Add Dart Lints -* Update to use new `brick_build` API for `getAssociationMethod` and `repositoryHasBeenForceCast` -* Fix Dart null safety complaints when accessing repository in a subsequent null or non null safe way after a force cast to non-null. +- Add Dart Lints +- Update to use new `brick_build` API for `getAssociationMethod` and `repositoryHasBeenForceCast` +- Fix Dart null safety complaints when accessing repository in a subsequent null or non null safe way after a force cast to non-null. ## 1.0.0+2 -* Fix null safety for one-to-one REST serializing associations (#186) +- Fix null safety for one-to-one REST serializing associations (#186) ## 1.0.0+1 -* Remove `source_gen_test` and `glob` dependencies +- Remove `source_gen_test` and `glob` dependencies ## 1.0.0 -* Null safety +- Null safety ## 0.0.1 -* Fix a a JSON encode error. `.map` returns a `MappedListIterable` which `jsonEncode` cannot parse. It can parse `List`. +- Fix a a JSON encode error. `.map` returns a `MappedListIterable` which `jsonEncode` cannot parse. It can parse `List`. diff --git a/packages/brick_offline_first_with_rest_build/pubspec.yaml b/packages/brick_offline_first_with_rest_build/pubspec.yaml index fc70629d..08395277 100644 --- a/packages/brick_offline_first_with_rest_build/pubspec.yaml +++ b/packages/brick_offline_first_with_rest_build/pubspec.yaml @@ -4,13 +4,13 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_offline_f issue_tracker: https://github.com/GetDutchie/brick/issues repository: https://github.com/GetDutchie/brick -version: 3.1.0 +version: 3.2.0 environment: sdk: ">=2.18.0 <4.0.0" dependencies: - analyzer: ">=5.0.0 <6.0.0" + analyzer: ">=6.0.0 <7.0.0" brick_build: ">=3.0.0 <4.0.0" brick_offline_first: ">=3.0.0 <4.0.0" brick_offline_first_build: ">=3.0.0 <4.0.0" diff --git a/packages/brick_rest_generators/CHANGELOG.md b/packages/brick_rest_generators/CHANGELOG.md index 3747afae..7b9d5f98 100644 --- a/packages/brick_rest_generators/CHANGELOG.md +++ b/packages/brick_rest_generators/CHANGELOG.md @@ -1,91 +1,96 @@ ## Unreleased +## 3.2.0 + +- Update `analyzer` constraints to `>=6.0.0 <7.0.0` +- Format CHANGELOG.md + ## 3.1.0 -* Apply standardized lints -* Upgrade minimum Dart to 2.18 +- Apply standardized lints +- Upgrade minimum Dart to 2.18 ## 3.0.1 -* Support Dart 3 +- Support Dart 3 ## 3.0.0 -* Update reference from `brick_rest/rest.dart` to `brick_rest/brick_rest.dart` -* Update minimum `analyzer` constraint to `5.0.0` -* Use Dart 2.15's `.byName` accessor for iterable enum values +- Update reference from `brick_rest/rest.dart` to `brick_rest/brick_rest.dart` +- Update minimum `analyzer` constraint to `5.0.0` +- Use Dart 2.15's `.byName` accessor for iterable enum values ## 2.1.1 -* Remove `FallThroughError` after Dart beta deprecation +- Remove `FallThroughError` after Dart beta deprecation ## 2.1.0 -* Loosen dependency restrictions to major versions -* Upgrade analyzer to version 4 +- Loosen dependency restrictions to major versions +- Upgrade analyzer to version 4 ## 2.0.0 -* Separate JSON generators to their own package in `brick_json_generators` +- Separate JSON generators to their own package in `brick_json_generators` ## 2.0.0-rc.2 -* Include `1.3.0` updates +- Include `1.3.0` updates ## 2.0.0-rc.1 -* Prepare for 2.0.0 launch +- Prepare for 2.0.0 launch ## 1.3.0+1 -* Fix FieldRename enums deserialization to use new Analyzer API +- Fix FieldRename enums deserialization to use new Analyzer API ## 1.3.0 -* Upgrade `analyzer` dependency to `3.2.0` +- Upgrade `analyzer` dependency to `3.2.0` ## 1.2.0 -* Separate logic into more agnostic classes `JsonSerdesGenerator`, `JsonDeserialize` and `JsonSerialize`. +- Separate logic into more agnostic classes `JsonSerdesGenerator`, `JsonDeserialize` and `JsonSerialize`. ## 1.1.0 -* Upgrade `brick_build` and `brick_core` +- Upgrade `brick_build` and `brick_core` ## 1.0.2 -* Prefer constructor field type (including nullability) over field definition for type inference in adapter generation. -* Bump `brick_build` +- Prefer constructor field type (including nullability) over field definition for type inference in adapter generation. +- Bump `brick_build` ## 1.0.1 -* Add Dart Lints -* Bump `brick_build` -* Always cast from list when deserializing siblings +- Add Dart Lints +- Bump `brick_build` +- Always cast from list when deserializing siblings ## 1.0.0+4 -* Fix deserialize and serialize `enumAsString` for non-nullable types (#183) +- Fix deserialize and serialize `enumAsString` for non-nullable types (#183) ## 1.0.0+3 -* Fix pubspec dependencies +- Fix pubspec dependencies ## 1.0.0+2 -* Fix nullable analyzer errors around DateTime and enum (de)serialization and association serialization +- Fix nullable analyzer errors around DateTime and enum (de)serialization and association serialization ## 1.0.0+1 -* Remove `source_gen_test` dependency +- Remove `source_gen_test` dependency ## 1.0.0 -* Null safety +- Null safety ## 0.0.1 -* Fix a a JSON encode error in REST serialization. `.map` returns a `MappedListIterable` which `jsonEncode` cannot parse. It can parse `List`. -* Fix REST's iterable enum serialization -* #58 fixes sibling serialization when null -* Dart style: prefer collection literals +- Fix a a JSON encode error in REST serialization. `.map` returns a `MappedListIterable` which `jsonEncode` cannot parse. It can parse `List`. +- Fix REST's iterable enum serialization +- #58 fixes sibling serialization when null +- Dart style: prefer collection literals diff --git a/packages/brick_rest_generators/pubspec.yaml b/packages/brick_rest_generators/pubspec.yaml index 095b7c8d..c24ebce7 100644 --- a/packages/brick_rest_generators/pubspec.yaml +++ b/packages/brick_rest_generators/pubspec.yaml @@ -4,13 +4,13 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_rest_gene issue_tracker: https://github.com/GetDutchie/brick/issues repository: https://github.com/GetDutchie/brick -version: 3.1.0 +version: 3.2.0 environment: sdk: ">=2.18.0 <4.0.0" dependencies: - analyzer: ">=5.0.0 <6.0.0" + analyzer: ">=6.0.0 <7.0.0" brick_build: ">=3.0.0 <4.0.0" brick_core: ^1.1.1 brick_json_generators: ">=3.0.0 <4.0.0" diff --git a/packages/brick_sqlite_generators/CHANGELOG.md b/packages/brick_sqlite_generators/CHANGELOG.md index 27f070ed..24c81a88 100644 --- a/packages/brick_sqlite_generators/CHANGELOG.md +++ b/packages/brick_sqlite_generators/CHANGELOG.md @@ -1,165 +1,170 @@ ## Unreleased +## 3.2.0 + +- Update `analyzer` constraints to `>=6.0.0 <7.0.0` +- Format CHANGELOG.md + ## 3.1.0 -* Apply standardized lints -* Upgrade minimum Dart to 2.18 -* Add `SqliteSerialize#uniqueValueForField` for advanced control of unique field genertion +- Apply standardized lints +- Upgrade minimum Dart to 2.18 +- Add `SqliteSerialize#uniqueValueForField` for advanced control of unique field genertion ## 3.0.2 -* Fix discovery path for injecting new migration `part` into schema from legacy `brick_sqlite_abstract` to `brick_sqlite/db` +- Fix discovery path for injecting new migration `part` into schema from legacy `brick_sqlite_abstract` to `brick_sqlite/db` ## 3.0.1 -* Support Dart 3 +- Support Dart 3 ## 3.0.0 -* Replace `brick_sqlite_abstract/db.dart` with `brick_sqlite/db.dart` -* Remove `brick_sqlite_abstract` dependency -* Update minimum `analyzer` constraint to `5.0.0` +- Replace `brick_sqlite_abstract/db.dart` with `brick_sqlite/db.dart` +- Remove `brick_sqlite_abstract` dependency +- Update minimum `analyzer` constraint to `5.0.0` ## 2.4.1 -* Update replacement RegEx for `migrations =` and `schema =` to account for whitespace and removed type names +- Update replacement RegEx for `migrations =` and `schema =` to account for whitespace and removed type names ## 2.2.0 -* If a field is annotated `@Sqlite(ignore: true)` do not create a column for it. +- If a field is annotated `@Sqlite(ignore: true)` do not create a column for it. ## 2.1.4 -* Remove `FallThroughError` after Dart beta deprecation +- Remove `FallThroughError` after Dart beta deprecation ## 2.1.3 -* Respect enum `fromSqlite` constructors and `toSqlite` methods +- Respect enum `fromSqlite` constructors and `toSqlite` methods ## 2.1.2 -* Upgrade analyzer to version 4 +- Upgrade analyzer to version 4 ## 2.1.1 -* Return `null` for nullable iterable fields instead of defaulting to an empty list or set +- Return `null` for nullable iterable fields instead of defaulting to an empty list or set ## 2.1.0 -* When updating associations from a parent, remove the association in the joins table but do not delete the instance. **This now applies to final fields as well**. (modifies addition from #119) -* Respect declared non-nullability for Dart-primitive `Set`s when serializing +- When updating associations from a parent, remove the association in the joins table but do not delete the instance. **This now applies to final fields as well**. (modifies addition from #119) +- Respect declared non-nullability for Dart-primitive `Set`s when serializing ## 2.0.3 -* Fix serializing iterable `toJson` classes to SQLite -* Fix migration generation for iterable `toJson` classes +- Fix serializing iterable `toJson` classes to SQLite +- Fix migration generation for iterable `toJson` classes ## 2.0.2 -* Loosen dependency restrictions to major versions -* Remove type from `Map` on `toJson` fields +- Loosen dependency restrictions to major versions +- Remove type from `Map` on `toJson` fields ## 2.0.1 -* If `.fromJson` is defined on a field's class, the field will be recognized in the adapter and `.fromJson` will be used when deserializing. -* If `#toJson` is defined on a field's class, the field will be recognized in the adapter and `#toJson` will be used when serializing. The column created to hold the field's value will be a varchar. +- If `.fromJson` is defined on a field's class, the field will be recognized in the adapter and `.fromJson` will be used when deserializing. +- If `#toJson` is defined on a field's class, the field will be recognized in the adapter and `#toJson` will be used when serializing. The column created to hold the field's value will be a varchar. ## 2.0.0 -* Use `brick_build`s new `manuallyUpsertBrickFile` method instead of `manuallyUpsertAppFile` +- Use `brick_build`s new `manuallyUpsertBrickFile` method instead of `manuallyUpsertAppFile` ## 2.0.0-rc.3 -* Include `1.3.0` changes +- Include `1.3.0` changes ## 2.0.0-rc.2 -* Use `brick_build`s new `manuallyUpsertBrickFile` method instead of `manuallyUpsertAppFile` +- Use `brick_build`s new `manuallyUpsertBrickFile` method instead of `manuallyUpsertAppFile` ## 2.0.0-rc.1 -* Expose `SqliteSerdesGenerator` in `generators.dart` -* Upgrade `analyzer` dependency to `3.2.0` -* Update enum discovery from `ConstantReader` to utilize new Analyzer methods (index instead of string) +- Expose `SqliteSerdesGenerator` in `generators.dart` +- Upgrade `analyzer` dependency to `3.2.0` +- Update enum discovery from `ConstantReader` to utilize new Analyzer methods (index instead of string) ## 1.3.0 -* Expose `SqliteSerdesGenerator` in `generators.dart` -* Upgrade `analyzer` dependency to `3.2.0` -* Update enum discovery from `ConstantReader` to utilize new Analyzer methods (index instead of string) +- Expose `SqliteSerdesGenerator` in `generators.dart` +- Upgrade `analyzer` dependency to `3.2.0` +- Update enum discovery from `ConstantReader` to utilize new Analyzer methods (index instead of string) ## 1.2.0 -* Supports `ignoreFrom`, `ignoreTo`, and `enumAsString` +- Supports `ignoreFrom`, `ignoreTo`, and `enumAsString` ## 1.1.4 -* Fix casting when deserializing enums. The analyzer does not alert for `cast` on a list that could contain nullable values; if the field type is non-nullable, null types must be removed before the cast. -* Remove unnecessary import in `schema.g.dart` +- Fix casting when deserializing enums. The analyzer does not alert for `cast` on a list that could contain nullable values; if the field type is non-nullable, null types must be removed before the cast. +- Remove unnecessary import in `schema.g.dart` ## 1.1.3 -* Bump `brick_build` -* Explicitely override `checkerForField` function in order to have SQLite maintain member field typing as it's source of truth over any constructor definitions +- Bump `brick_build` +- Explicitely override `checkerForField` function in order to have SQLite maintain member field typing as it's source of truth over any constructor definitions ## 1.1.2 -* Always cast when using `toList` and deserializing +- Always cast when using `toList` and deserializing ## 1.1.1+1 -* Fix adapter when deserializing single siblings +- Fix adapter when deserializing single siblings ## 1.1.1 -* Update to use new `brick_build` API for `getAssociationMethod` and `repositoryHasBeenForceCast` +- Update to use new `brick_build` API for `getAssociationMethod` and `repositoryHasBeenForceCast` ## 1.1.0+1 -* Apply `const` for individual migrations in `schema.g.dart` +- Apply `const` for individual migrations in `schema.g.dart` ## 1.1.0 -* Fix analyzer's nullable warning when serializing non-final iterables (#185) -* Expose `SqliteSchemaGenerator#schemaColumn` for calling super in sub classes -* Prepend `const` before `RuntimeSqliteColumnDefinition` -* Use `const` when declaring migrations at the top of `schema.g.dart` -* Add Dart Lints +- Fix analyzer's nullable warning when serializing non-final iterables (#185) +- Expose `SqliteSchemaGenerator#schemaColumn` for calling super in sub classes +- Prepend `const` before `RuntimeSqliteColumnDefinition` +- Use `const` when declaring migrations at the top of `schema.g.dart` +- Add Dart Lints ## 1.0.0+5 -* Fix nullable warning when serializing non-nullable maps (#187) +- Fix nullable warning when serializing non-nullable maps (#187) ## 1.0.0+4 -* Fix pubspec dependencies +- Fix pubspec dependencies ## 1.0.0+3 -* Fix deserialization for associations, enum, and DateTime in Dart >=2.12 -* Fix serialization for associations, afterSave, enum, core types, booleans, and DateTime in Dart >=2.12 +- Fix deserialization for associations, enum, and DateTime in Dart >=2.12 +- Fix serialization for associations, afterSave, enum, core types, booleans, and DateTime in Dart >=2.12 ## 1.0.0+2 -* Remove `source_gen_test` dependency +- Remove `source_gen_test` dependency ## 1.0.0+1 -* Loosen `brick_build` pubspec restriction +- Loosen `brick_build` pubspec restriction ## 1.0.0 -* Null safety +- Null safety ## 0.0.1 -* Fix sibling set serialization -* Do not create joins tables for ignored fields -* Type arguments are stripped from fields when building the `fieldsToSqliteColumns` definition (#31) -* Fixes a bug where sets were not serialized by SQLite -* Single siblings are upserted to SQLite as they're received; previously only iterable siblings were upserted -* Fix deserializing for null sibling arrays -* Booleans are serialized as 1s or 0s -* Foreign keys are no longer serialized in a JSON array and stored as a string -* Support `columnType` from SQLite annotations -* Reconcile changes for non-final associations (#112) +- Fix sibling set serialization +- Do not create joins tables for ignored fields +- Type arguments are stripped from fields when building the `fieldsToSqliteColumns` definition (#31) +- Fixes a bug where sets were not serialized by SQLite +- Single siblings are upserted to SQLite as they're received; previously only iterable siblings were upserted +- Fix deserializing for null sibling arrays +- Booleans are serialized as 1s or 0s +- Foreign keys are no longer serialized in a JSON array and stored as a string +- Support `columnType` from SQLite annotations +- Reconcile changes for non-final associations (#112) diff --git a/packages/brick_sqlite_generators/lib/src/sqlite_deserialize.dart b/packages/brick_sqlite_generators/lib/src/sqlite_deserialize.dart index 4d310a50..6d66c48f 100644 --- a/packages/brick_sqlite_generators/lib/src/sqlite_deserialize.dart +++ b/packages/brick_sqlite_generators/lib/src/sqlite_deserialize.dart @@ -137,7 +137,7 @@ class SqliteDeserialize<_Model extends SqliteModel> extends SqliteSerdesGenerato final discoveredByIndex = 'jsonDecode($fieldValue).map((d) => d as int > -1 ? ${SharedChecker.withoutNullability(argType)}.values[d] : null)'; final nullableSuffix = checker.isNullable ? '?' : ''; - return '$discoveredByIndex$nullableSuffix.whereType<${argType.getDisplayString(withNullability: true)}>()$castIterable'; + return '$discoveredByIndex$nullableSuffix.whereType<${argType.getDisplayString()}>()$castIterable'; } // Iterable @@ -152,7 +152,7 @@ class SqliteDeserialize<_Model extends SqliteModel> extends SqliteSerdesGenerato final nullableSuffix = checker.isNullable ? " ?? '[]'" : ''; return '''jsonDecode($fieldValue$nullableSuffix).map( - (d) => ${klass.displayName}.fromJson(d as ${parameterType.getDisplayString(withNullability: true)}) + (d) => ${klass.displayName}.fromJson(d as ${parameterType.getDisplayString()}) )$castIterable$defaultValue'''; } @@ -210,7 +210,7 @@ class SqliteDeserialize<_Model extends SqliteModel> extends SqliteSerdesGenerato } else if (checker.fromJsonConstructor != null) { final klass = checker.targetType.element as ClassElement; final parameterType = checker.fromJsonConstructor!.parameters.first.type; - return '${klass.displayName}.fromJson(jsonDecode($fieldValue as String) as ${parameterType.getDisplayString(withNullability: true)})'; + return '${klass.displayName}.fromJson(jsonDecode($fieldValue as String) as ${parameterType.getDisplayString()})'; } return null; diff --git a/packages/brick_sqlite_generators/lib/src/sqlite_schema/sqlite_schema_generator.dart b/packages/brick_sqlite_generators/lib/src/sqlite_schema/sqlite_schema_generator.dart index 93273d89..3a0d195d 100644 --- a/packages/brick_sqlite_generators/lib/src/sqlite_schema/sqlite_schema_generator.dart +++ b/packages/brick_sqlite_generators/lib/src/sqlite_schema/sqlite_schema_generator.dart @@ -91,7 +91,7 @@ class SqliteSchemaGenerator { required Sqlite foreignTableColumnDefinition, required SharedChecker checker, }) { - final foreignTableName = checker.unFuturedArgType.getDisplayString(withNullability: false); + final foreignTableName = checker.unFuturedArgType.getDisplayString().replaceAll('?', ''); return SchemaTable( InsertForeignKey.joinsTableName( @@ -236,12 +236,12 @@ class SqliteSchemaGenerator { } else if (checker.isSibling) { return SchemaColumn( InsertForeignKey.foreignKeyColumnName( - checker.unFuturedType.getDisplayString(withNullability: false), + checker.unFuturedType.getDisplayString().replaceAll('?', ''), column.name, ), Column.integer, isForeignKey: true, - foreignTableName: checker.unFuturedType.getDisplayString(withNullability: false), + foreignTableName: checker.unFuturedType.getDisplayString().replaceAll('?', ''), nullable: column.nullable, onDeleteCascade: column.onDeleteCascade, onDeleteSetDefault: column.onDeleteSetDefault, @@ -273,7 +273,7 @@ class SqliteSchemaGenerator { if (!column.ignore && column.index && !isIterableAssociation) { final name = checker.isSibling ? InsertForeignKey.foreignKeyColumnName( - checker.unFuturedType.getDisplayString(withNullability: false), + checker.unFuturedType.getDisplayString().replaceAll('?', ''), column.name, ) : column.name!; diff --git a/packages/brick_sqlite_generators/lib/src/sqlite_serdes_generator.dart b/packages/brick_sqlite_generators/lib/src/sqlite_serdes_generator.dart index 46a68533..861c7dd0 100644 --- a/packages/brick_sqlite_generators/lib/src/sqlite_serdes_generator.dart +++ b/packages/brick_sqlite_generators/lib/src/sqlite_serdes_generator.dart @@ -60,7 +60,7 @@ abstract class SqliteSerdesGenerator<_Model extends SqliteModel> String providerNameForField(annotatedName, {required checker}) { if (checker.isSibling) { return InsertForeignKey.foreignKeyColumnName( - checker.unFuturedType.getDisplayString(withNullability: false), + checker.unFuturedType.getDisplayString().replaceAll('?', ''), annotatedName, ); } diff --git a/packages/brick_sqlite_generators/lib/src/sqlite_serialize.dart b/packages/brick_sqlite_generators/lib/src/sqlite_serialize.dart index 57fcd0ec..cdaae343 100644 --- a/packages/brick_sqlite_generators/lib/src/sqlite_serialize.dart +++ b/packages/brick_sqlite_generators/lib/src/sqlite_serialize.dart @@ -266,7 +266,7 @@ class SqliteSerialize<_Model extends SqliteModel> extends SqliteSerdesGenerator< final joinsTable = InsertForeignKey.joinsTableName(annotation.name!, localTableName: fields.element.name); final joinsForeignColumn = InsertForeignKey.joinsTableForeignColumnName( - checker.unFuturedArgType.getDisplayString(withNullability: false), + checker.unFuturedArgType.getDisplayString().replaceAll('?', ''), ); final joinsLocalColumn = InsertForeignKey.joinsTableLocalColumnName(fields.element.name); @@ -320,12 +320,13 @@ class SqliteSerialize<_Model extends SqliteModel> extends SqliteSerdesGenerator< if (checker.toJsonMethod != null) { return checker.toJsonMethod!.returnType - .getDisplayString(withNullability: false) + .getDisplayString() + .replaceAll('?', '') .replaceAll(typeRemover, ''); } // remove arg types as they can't be declared in final fields - return type.getDisplayString(withNullability: false).replaceAll(typeRemover, ''); + return type.getDisplayString().replaceAll('?', '').replaceAll(typeRemover, ''); } String _boolForField(String fieldValue, bool nullable) { diff --git a/packages/brick_sqlite_generators/pubspec.yaml b/packages/brick_sqlite_generators/pubspec.yaml index 1d1b668f..f527b131 100644 --- a/packages/brick_sqlite_generators/pubspec.yaml +++ b/packages/brick_sqlite_generators/pubspec.yaml @@ -4,13 +4,13 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_sqlite_ge issue_tracker: https://github.com/GetDutchie/brick/issues repository: https://github.com/GetDutchie/brick -version: 3.1.0 +version: 3.2.0 environment: sdk: ">=2.18.0 <4.0.0" dependencies: - analyzer: ">=5.0.0 <6.0.0" + analyzer: ">=6.0.0 <7.0.0" brick_build: ">=3.0.0 <4.0.0" brick_sqlite: ">=3.0.0 <4.0.0" build: ">=2.0.0 <3.0.0"