Skip to content

Commit 5ac231e

Browse files
committed
Merge branch 'supabase-integration' into table-problem
2 parents 0202b9e + 7d18f79 commit 5ac231e

28 files changed

Lines changed: 350 additions & 321 deletions

File tree

packages/brick_build/CHANGELOG.md

Lines changed: 63 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,166 +1,170 @@
11
## Unreleased
22

3-
* Apply standardized lints
4-
* `const`antize `AggregateBuilder`
3+
## 3.1.0
4+
5+
- Apply standardized lints
6+
- `const`antize `AggregateBuilder`
7+
- Update `analyzer` constraints to `>=6.0.0 <7.0.0`
8+
- Format CHANGELOG.md
59

610
## 3.0.1
711

8-
* Support Dart 3
12+
- Support Dart 3
913

1014
## 3.0.0
1115

12-
* Update `AggregateBuilder#requiredImports` docs
13-
* Remove unnecessary assignment in `BaseBuilder#replaceWithinFile`
14-
* Update minimum `analyzer` constraint to `5.0.0`
16+
- Update `AggregateBuilder#requiredImports` docs
17+
- Remove unnecessary assignment in `BaseBuilder#replaceWithinFile`
18+
- Update minimum `analyzer` constraint to `5.0.0`
1519

1620
## 2.1.2
1721

18-
* 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
22+
- 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
1923

2024
## 2.1.1
2125

22-
* Add `#hasEnumDeserializeFactory` and `#hasEnumSerializeMethod` to `SharedChecker`
26+
- Add `#hasEnumDeserializeFactory` and `#hasEnumSerializeMethod` to `SharedChecker`
2327

2428
## 2.1.0
2529

26-
* Upgrade analyzer to version 4
30+
- Upgrade analyzer to version 4
2731

2832
## 2.0.2
2933

30-
* Loosen dependency restrictions to major versions
31-
* Fix duplicate imports to `brick.g.dart` when class names start with the same prefix
34+
- Loosen dependency restrictions to major versions
35+
- Fix duplicate imports to `brick.g.dart` when class names start with the same prefix
3236

3337
## 2.0.1
3438

35-
* Add `fromJsonConstructor` and `toJsonMethod` to `SharedChecker`, supporting easy discovery of standard methods `factory fromJson` and `#toJson`.
39+
- Add `fromJsonConstructor` and `toJsonMethod` to `SharedChecker`, supporting easy discovery of standard methods `factory fromJson` and `#toJson`.
3640

3741
## 2.0.0
3842

39-
* **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.
40-
* **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`.
41-
* Fix adapters builder
42-
* Fix `brick.g.dart` imports
43+
- **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.
44+
- **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`.
45+
- Fix adapters builder
46+
- Fix `brick.g.dart` imports
4347

4448
## 2.0.0-rc.3
4549

46-
* Include `1.4.0+1` changes
50+
- Include `1.4.0+1` changes
4751

4852
## 2.0.0-rc.2
4953

50-
* Fix adapters builder
51-
* Fix `brick.g.dart` imports
54+
- Fix adapters builder
55+
- Fix `brick.g.dart` imports
5256

5357
## 2.0.0-rc.1
5458

55-
* **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.
56-
* **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`.
59+
- **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.
60+
- **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`.
5761

5862
## 1.4.0+1
5963

60-
* Fix field sorting and discovery error
64+
- Fix field sorting and discovery error
6165

6266
## 1.4.0
6367

64-
* Alphabetize methods (internal refactor)
65-
* Upgrade `analyzer` dependency to `3.2.0`
68+
- Alphabetize methods (internal refactor)
69+
- Upgrade `analyzer` dependency to `3.2.0`
6670

6771
## 1.3.0
6872

69-
* Upgrade `brick_core`
73+
- Upgrade `brick_core`
7074

7175
## 1.2.3
7276

73-
* Allow forced type nullability on `getAssociationMethod` for improved null safety on future internals.
77+
- Allow forced type nullability on `getAssociationMethod` for improved null safety on future internals.
7478

7579
## 1.2.2+1
7680

77-
* Access `checkForField` by default only when deserializing for fields instead of constructor overrides
81+
- Access `checkForField` by default only when deserializing for fields instead of constructor overrides
7882

7983
## 1.2.2
8084

81-
* Add `checkForField` method to enforce constructor preference over field definition for type inference in adapter generation.
85+
- Add `checkForField` method to enforce constructor preference over field definition for type inference in adapter generation.
8286

8387
## 1.2.1
8488

85-
* Remove `// ignore_for_file: prefer_null_aware_operators`
89+
- Remove `// ignore_for_file: prefer_null_aware_operators`
8690

8791
## 1.2.0+3
8892

89-
* 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`
90-
* Remove setting `repositoryHasBeenForceCast` in `SerdesGenerator#getAssociationMethod`
93+
- 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`
94+
- Remove setting `repositoryHasBeenForceCast` in `SerdesGenerator#getAssociationMethod`
9195

9296
## 1.2.0+2
9397

94-
* Remove `@visibleForOverriding` annotation from `SerdesGenerator#deserializeNullableClause`
98+
- Remove `@visibleForOverriding` annotation from `SerdesGenerator#deserializeNullableClause`
9599

96100
## 1.2.0
97101

98-
* Add Dart Lints
99-
* Improve null safe checking in example
100-
* 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`
101-
* Convert `SerdesGenerator.getAssociationMethod` to `SerdesGenerator#getAssociationMethod` to access `repositoryHasBeenForceCast`
102+
- Add Dart Lints
103+
- Improve null safe checking in example
104+
- 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`
105+
- Convert `SerdesGenerator.getAssociationMethod` to `SerdesGenerator#getAssociationMethod` to access `repositoryHasBeenForceCast`
102106

103107
## 1.1.0+3
104108

105-
* 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.
109+
- 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.
106110

107111
## 1.1.0+2
108112

109-
* Remove `part` and `export` directives during build
113+
- Remove `part` and `export` directives during build
110114

111115
## 1.1.0+1
112116

113-
* 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
117+
- 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
114118

115119
## 1.1.0
116120

117-
* **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.
121+
- **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.
118122

119123
## 1.0.0
120124

121-
* Null safety
125+
- Null safety
122126

123127
## 0.0.9
124128

125-
* If `fromGenerator` or `toGenerator` is declared, the field will be generated for deserializing and serializing adapters, respectively
126-
* Strictly assign analyzer ahead of nullability release versions
129+
- If `fromGenerator` or `toGenerator` is declared, the field will be generated for deserializing and serializing adapters, respectively
130+
- Strictly assign analyzer ahead of nullability release versions
127131

128132
## 0.0.8+2
129133

130-
* Override build methods
134+
- Override build methods
131135

132136
## 0.0.8+1
133137

134-
* Remove `getInheritedConcreteMap` from `fields_for_class.dart` as it's no longer used.
138+
- Remove `getInheritedConcreteMap` from `fields_for_class.dart` as it's no longer used.
135139

136140
## 0.0.8
137141

138-
* Add method `ignoreCoderForField` to `SerdesGenerator`. This doesn't change existing functionality; it only moves it to an overridable method.
142+
- Add method `ignoreCoderForField` to `SerdesGenerator`. This doesn't change existing functionality; it only moves it to an overridable method.
139143

140144
## 0.0.7
141145

142-
* Use assignable instead of super type comparison when checking for siblings to account for inherited classes (#55)
143-
* Add ability to overwrite the nullable check for deserializing members
146+
- Use assignable instead of super type comparison when checking for siblings to account for inherited classes (#55)
147+
- Add ability to overwrite the nullable check for deserializing members
144148

145149
## 0.0.6
146150

147-
* Rename `ProviderSerializable` to `ProviderSerializableGenerator` to be more explicit
148-
* Rename `SharedChecker#mapArgs` to `SharedChecker#typeArguments`
151+
- Rename `ProviderSerializable` to `ProviderSerializableGenerator` to be more explicit
152+
- Rename `SharedChecker#mapArgs` to `SharedChecker#typeArguments`
149153

150154
## 0.0.4
151155

152-
* Update for new [brick_core](https://github.com/GetDutchie/brick/tree/main/packages/brick_core) API on `Where`
153-
* Move shareable methods from `OfflineFirstSerdesGenerator` to `SerdesGenerator`
154-
* Constrain version of [brick_core](https://github.com/GetDutchie/brick/tree/main/packages/brick_core)
155-
* 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).
156-
* `testing.dart` is available for useful testing methods
157-
* This package is now a series of utilities and interfaces; it no longer produces generated code.
156+
- Update for new [brick_core](https://github.com/GetDutchie/brick/tree/main/packages/brick_core) API on `Where`
157+
- Move shareable methods from `OfflineFirstSerdesGenerator` to `SerdesGenerator`
158+
- Constrain version of [brick_core](https://github.com/GetDutchie/brick/tree/main/packages/brick_core)
159+
- 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).
160+
- `testing.dart` is available for useful testing methods
161+
- This package is now a series of utilities and interfaces; it no longer produces generated code.
158162

159163
## 0.0.3
160164

161-
* Use `ConnectOfflineFirstWithRest`
165+
- Use `ConnectOfflineFirstWithRest`
162166

163167
## 0.0.2
164168

165-
* Uses `getDisplayString` instead of deprecated `name`
166-
* Fix linter hints
169+
- Uses `getDisplayString` instead of deprecated `name`
170+
- Fix linter hints

packages/brick_build/example/file_serdes_generator.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import 'package:analyzer/dart/element/element.dart';
2-
import 'package:brick_core/core.dart' show Model;
31
import 'package:brick_build/generators.dart';
2+
import 'package:brick_core/core.dart' show Model;
3+
44
import 'file_fields.dart';
55

66
/// This would be in a separate package
@@ -14,8 +14,8 @@ abstract class FileSerdesGenerator<_Model extends FileModel> extends SerdesGener
1414
final String repositoryName;
1515

1616
FileSerdesGenerator(
17-
ClassElement element,
18-
FileFields fields, {
17+
super.element,
18+
super.fields, {
1919
required this.repositoryName,
20-
}) : super(element, fields);
20+
});
2121
}

packages/brick_build/example/file_serialize.dart

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import 'package:analyzer/dart/element/element.dart';
2-
import 'file_fields.dart';
31
import 'file_serdes_generator.dart';
42

53
/// Generate serialized code for each field to write to a file
64
class FileSerialize<_Model extends FileModel> extends FileSerdesGenerator<_Model> {
75
FileSerialize(
8-
ClassElement element,
9-
FileFields fields, {
10-
required String repositoryName,
11-
}) : super(element, fields, repositoryName: repositoryName);
6+
super.element,
7+
super.fields, {
8+
required super.repositoryName,
9+
});
1210

1311
@override
1412
final doesDeserialize = false;
@@ -31,7 +29,7 @@ class FileSerialize<_Model extends FileModel> extends FileSerdesGenerator<_Model
3129

3230
// Iterable<enum>
3331
if (argTypeChecker.isEnum) {
34-
return '$fieldValue?.map((e) => ${checker.argType.getDisplayString(withNullability: false)}.values.indexOf(e))';
32+
return '$fieldValue?.map((e) => ${checker.argType.getDisplayString().replaceAll('?', '')}.values.indexOf(e))';
3533
}
3634

3735
// Iterable<OfflineFirstModel>, Iterable<Future<OfflineFirstModel>>

packages/brick_build/lib/src/utils/shared_checker.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ class SharedChecker<_SiblingModel extends Model> {
181181
if (classElement.supertype?.typeArguments == null ||
182182
classElement.supertype!.typeArguments.isEmpty) {
183183
throw InvalidGenerationSourceError(
184-
'Type argument for ${targetType.getDisplayString(withNullability: true)} is undefined.',
184+
'Type argument for ${targetType.getDisplayString()} is undefined.',
185185
todo:
186-
'Define the type on class ${targetType.element}, e.g. `extends ${classElement.supertype!.getDisplayString(withNullability: false)}<int>`',
186+
'Define the type on class ${targetType.element}, e.g. `extends ${classElement.supertype!.getDisplayString().replaceAll('?', '')}<int>`',
187187
element: targetType.element,
188188
);
189189
}
@@ -222,7 +222,7 @@ class SharedChecker<_SiblingModel extends Model> {
222222
}
223223

224224
/// Print the `DartType` without nullability
225-
static String withoutNullability(DartType type) => type.getDisplayString(withNullability: false);
225+
static String withoutNullability(DartType type) => type.getDisplayString().replaceAll('?', '');
226226

227227
/// Destructs a type to determine the bottom type after going through Futures and Iterables.
228228
///

packages/brick_build/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_build
44
issue_tracker: https://github.com/GetDutchie/brick/issues
55
repository: https://github.com/GetDutchie/brick
66

7-
version: 3.0.1
7+
version: 3.1.0
88

99
environment:
1010
sdk: ">=2.18.0 <4.0.0"
1111

1212
dependencies:
13-
analyzer: ">=5.0.0 <6.0.0"
13+
analyzer: ">=6.0.0 <7.0.0"
1414
brick_core: ^1.1.1
1515
build: ^2.3.0
1616
dart_style: ">=2.0.0 <3.0.0"

0 commit comments

Comments
 (0)