Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: publish packages and finish changelog documentation #511

Merged
merged 7 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/brick_build/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Unreleased

## 3.3.0

- Add documentation to increase pub.dev score
- Update minimum `brick_core` to `1.3.0`
- Update analysis to modern lints

## 3.2.1

Expand Down
4 changes: 2 additions & 2 deletions packages/brick_build/lib/src/builders/adapter_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:brick_build/src/utils/string_helpers.dart';
import 'package:build/build.dart';

/// Writes adapter code (model serialization/deserialization).
/// Outputs to brick/adapters/<MODEL>_adapter.g.dart
/// Outputs to brick/adapters/{MODEL}_adapter.g.dart
class AdapterBuilder<_ClassAnnotation> extends BaseBuilder<_ClassAnnotation> {
///
final AnnotationSuperGenerator generator;
Expand All @@ -12,7 +12,7 @@ class AdapterBuilder<_ClassAnnotation> extends BaseBuilder<_ClassAnnotation> {
final outputExtension = '.adapter_builder.dart';

/// Writes adapter code (model serialization/deserialization).
/// Outputs to brick/adapters/<MODEL>_adapter.g.dart
/// Outputs to brick/adapters/{MODEL}_adapter.g.dart
AdapterBuilder(this.generator);

@override
Expand Down
10 changes: 5 additions & 5 deletions packages/brick_build/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ 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.2.1
version: 3.3.0

environment:
sdk: ">=2.18.0 <4.0.0"

dependencies:
analyzer: ">=6.0.0 <7.0.0"
brick_core: ^1.1.1
brick_core: ^1.3.0
build: ^2.3.0
dart_style: ">=2.0.0 <3.0.0"
glob: ">=2.1.0 <3.0.0"
Expand All @@ -23,6 +23,6 @@ dependencies:
dev_dependencies:
brick_build_test:
path: ../brick_build_test
build_verify: ^2.0.0
lints: ^2.0.1
test: ^1.20.1
build_verify:
lints:
test:
10 changes: 10 additions & 0 deletions packages/brick_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
## Unreleased

## 1.3.0

- **DEPRECATION** `Query(providerArgs: {'limit':})` is now `Query(limit:)`
- **DEPRECATION** `Query(providerArgs: {'offset':})` is now `Query(offset:)`
- **DEPRECATION** `Query(providerArgs: {'orderBy':})` is now `Query(orderBy:)`. `orderBy` is now defined by a class that permits multiple commands. For example, `'orderBy': 'name ASC'` becomes `[OrderBy('name', ascending: true)]`.
- **DEPRECATION** `providerArgs` will be removed in the next major release
- `OrderBy` will support association ordering and multiple values
- `Query` is constructed with `const`
- `Query#offset` no longer requires companion `limit` parameter

## 1.2.1

- Add `FieldRename` to `FieldSerializable`
Expand Down
22 changes: 11 additions & 11 deletions packages/brick_core/lib/src/query/limit_by.dart
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
import 'dart:convert';

import 'package:brick_core/src/model.dart';
import 'package:brick_core/src/model_dictionary.dart';
import 'package:brick_core/src/provider.dart';
import 'package:brick_core/src/adapter.dart';

/// Construct directions for a provider to limit its results.
class LimitBy {
/// The ceiling for how many results can be returned for a [model].
/// The ceiling for how many results can be returned for [evaluatedField].
final int amount;

/// Some providers may support limiting based on a model retrieved by the query.
/// This [Model] should be accessible to the [Provider]'s [ModelDictionary].
final Type model;
/// This Dart field name should be accessible to the [Adapter]'s definitions
/// (e.g. a `RuntimeSqliteColumnDefinition` map).
final String evaluatedField;

/// Construct directions for a provider to limit its results.
const LimitBy(
this.amount, {
required this.model,
required this.evaluatedField,
});

/// Construct a [LimitBy] from a JSON map.
factory LimitBy.fromJson(Map<String, dynamic> json) => LimitBy(
json['amount'],
model: json['model'],
evaluatedField: json['evaluatedField'],
);

/// Serialize to JSON
Map<String, dynamic> toJson() => {
'amount': amount,
'model': model,
'evaluatedField': evaluatedField,
};

@override
String toString() => jsonEncode(toJson());

@override
bool operator ==(Object other) =>
identical(this, other) || other is LimitBy && amount == other.amount && model == other.model;
identical(this, other) ||
other is LimitBy && amount == other.amount && evaluatedField == other.evaluatedField;

@override
int get hashCode => amount.hashCode ^ model.hashCode;
int get hashCode => amount.hashCode ^ evaluatedField.hashCode;
}
29 changes: 14 additions & 15 deletions packages/brick_core/lib/src/query/order_by.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import 'package:brick_core/src/model.dart';
import 'package:brick_core/src/model_dictionary.dart';
import 'package:brick_core/src/provider.dart';
import 'package:meta/meta.dart';

/// Construct directions for a provider to sort its results.
@immutable
class OrderBy {
/// Defaults to `true`.
final bool ascending;
Expand All @@ -15,36 +11,39 @@ class OrderBy {
/// and the remote source's expected name.
final String evaluatedField;

/// Some providers may support ordering based on a model retrieved by the query.
/// This [Model] should be accessible to the [Provider]'s [ModelDictionary].
final Type? model;
/// The Dart name of the field of the association model
/// if the [evaluatedField] is an association.
///
/// If [evaluatedField] is not an association, this should be `null`.
final String? associationField;

/// Construct directions for a provider to sort its results.
const OrderBy(
this.evaluatedField, {
this.ascending = true,
this.model,
this.associationField,
});

/// Sort by [ascending] order (A-Z).
factory OrderBy.asc(String evaluatedField, {Type? model}) =>
OrderBy(evaluatedField, model: model);
factory OrderBy.asc(String evaluatedField, {String? associationField}) =>
OrderBy(evaluatedField, associationField: associationField);

/// Sort by descending order (Z-A).
factory OrderBy.desc(String evaluatedField, {Type? model}) =>
OrderBy(evaluatedField, ascending: false, model: model);
factory OrderBy.desc(String evaluatedField, {String? associationField}) =>
OrderBy(evaluatedField, ascending: false, associationField: associationField);

/// Construct an [OrderBy] from a JSON map.
factory OrderBy.fromJson(Map<String, dynamic> json) => OrderBy(
json['evaluatedField'],
ascending: json['ascending'],
associationField: json['associationField'],
);

/// Serialize to JSON
Map<String, dynamic> toJson() => {
'ascending': ascending,
if (associationField != null) 'associationField': associationField,
'evaluatedField': evaluatedField,
if (model != null) 'model': model?.toString(),
};

@override
Expand All @@ -56,8 +55,8 @@ class OrderBy {
other is OrderBy &&
evaluatedField == other.evaluatedField &&
ascending == other.ascending &&
model == other.model;
associationField == other.associationField;

@override
int get hashCode => evaluatedField.hashCode ^ ascending.hashCode ^ model.hashCode;
int get hashCode => evaluatedField.hashCode ^ ascending.hashCode ^ associationField.hashCode;
}
9 changes: 4 additions & 5 deletions packages/brick_core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_core
issue_tracker: https://github.com/GetDutchie/brick/issues
repository: https://github.com/GetDutchie/brick

version: 2.0.0
version: 1.3.0

environment:
sdk: ">=3.0.0 <4.0.0"
Expand All @@ -13,7 +13,6 @@ dependencies:
collection: ">=1.15.0 <2.0.0"

dev_dependencies:
dart_style: ">=2.0.0 <3.0.0"
lints: ">=4.0.0 <6.0.0"
mockito: ^5.0.0
test: ^1.16.5
lints:
mockito:
test:
16 changes: 6 additions & 10 deletions packages/brick_core/test/query/limit_by_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,22 @@ void main() {
group('LimitBy', () {
test('equality', () {
expect(
const LimitBy(2, model: num),
LimitBy.fromJson(const {'amount': 2, 'model': num}),
const LimitBy(2, evaluatedField: 'name'),
LimitBy.fromJson(const {'amount': 2, 'evaluatedField': 'name'}),
);
});

test('#toJson', () {
expect(
const LimitBy(2, model: int).toJson(),
{'amount': 2, 'model': int},
);
expect(
const LimitBy(2, model: String).toJson(),
{'amount': 2, 'model': String},
const LimitBy(2, evaluatedField: 'name').toJson(),
{'amount': 2, 'evaluatedField': 'name'},
);
});

test('.fromJson', () {
expect(
LimitBy.fromJson(const {'amount': 2, 'model': String}),
const LimitBy(2, model: String),
LimitBy.fromJson(const {'amount': 2, 'evaluatedField': 'longerName'}),
const LimitBy(2, evaluatedField: 'longerName'),
);
});
});
Expand Down
34 changes: 28 additions & 6 deletions packages/brick_core/test/query/order_by_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ void main() {
group('OrderBy', () {
test('equality', () {
expect(
const OrderBy('name'),
OrderBy.fromJson(const {'evaluatedField': 'name', 'ascending': true}),
const OrderBy('name', associationField: 'assoc'),
OrderBy.fromJson(
const {'evaluatedField': 'name', 'ascending': true, 'associationField': 'assoc'},
),
);
expect(
const OrderBy('name', ascending: false),
OrderBy.fromJson(const {'evaluatedField': 'name', 'ascending': false}),
const OrderBy('name', ascending: false, associationField: 'assoc'),
OrderBy.fromJson(
const {'evaluatedField': 'name', 'ascending': false, 'associationField': 'assoc'},
),
);
});

Expand All @@ -20,8 +24,8 @@ void main() {
{'evaluatedField': 'name', 'ascending': true},
);
expect(
const OrderBy('name', ascending: false).toJson(),
{'evaluatedField': 'name', 'ascending': false},
const OrderBy('name', ascending: false, associationField: 'assoc').toJson(),
{'evaluatedField': 'name', 'ascending': false, 'associationField': 'assoc'},
);
});

Expand All @@ -34,14 +38,26 @@ void main() {
const OrderBy('name', ascending: false).toString(),
'name DESC',
);
expect(
const OrderBy('name', ascending: false, associationField: 'assoc').toString(),
'name DESC',
);
});

test('.asc', () {
expect(OrderBy.asc('name'), const OrderBy('name'));
expect(
OrderBy.asc('name', associationField: 'assoc'),
const OrderBy('name', associationField: 'assoc'),
);
});

test('.desc', () {
expect(OrderBy.desc('name'), const OrderBy('name', ascending: false));
expect(
OrderBy.desc('name', associationField: 'assoc'),
const OrderBy('name', ascending: false, associationField: 'assoc'),
);
});

test('.fromJson', () {
Expand All @@ -53,6 +69,12 @@ void main() {
OrderBy.fromJson(const {'evaluatedField': 'name', 'ascending': false}),
const OrderBy('name', ascending: false),
);
expect(
OrderBy.fromJson(
const {'evaluatedField': 'name', 'ascending': false, 'associationField': 'assoc'},
),
const OrderBy('name', ascending: false, associationField: 'assoc'),
);
});
});
}
8 changes: 8 additions & 0 deletions packages/brick_graphql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## Unreleased

## 3.2.0

- **DEPRECATION** `Query(providerArgs: {'context':})` is now `Query(forProviders: [GraphqlProviderQuery(context:)])`
- **DEPRECATION** `Query(providerArgs: {'operation':})` is now `Query(forProviders: [GraphqlProviderQuery(operation:)])`
- New `GraphqlProviderQuery` adds GraphQL-specific support for the new `Query`.
- Upgrade `brick_core` to `1.3.0`
- Update analysis to modern lints

## 3.1.2

- Loosen constraints for `gql`, `gql_exec`, and `gql_link`
Expand Down
6 changes: 3 additions & 3 deletions packages/brick_graphql/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ dependencies:
meta: ">=1.3.0 <2.0.0"

dev_dependencies:
lints: ^2.0.1
mockito: ^5.0.0
test: ^1.16.5
lints:
mockito:
test:
5 changes: 5 additions & 0 deletions packages/brick_graphql_generators/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Unreleased

## 3.3.0

- Upgrade `brick_core` to `1.3.0`
- Update analysis to modern lints

## 3.2.1

- Use `renameField` from `brick_build`'s `AnnotationFinderWithFieldRename` mixin
Expand Down
4 changes: 2 additions & 2 deletions packages/brick_graphql_generators/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_graphql_g
issue_tracker: https://github.com/GetDutchie/brick/issues
repository: https://github.com/GetDutchie/brick

version: 3.2.1
version: 3.3.0

environment:
sdk: ">=2.18.0 <4.0.0"

dependencies:
analyzer: ">=6.0.0 <7.0.0"
brick_build: ">=3.2.0 <4.0.0"
brick_core: ">=1.2.1 <2.0.0"
brick_core: ">=1.3.0 <2.0.0"
brick_graphql: ">=3.0.0 <4.0.0"
brick_json_generators: ">=3.0.0 <4.0.0"
build: ">=2.0.0 <3.0.0"
Expand Down
2 changes: 2 additions & 0 deletions packages/brick_json_generators/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- (test) remove analysis options override for non-standard library prefixes
- Revert `.getDisplayString()` change due to Flutter 3.22 being restricted to analyzer <6.4.1. `meta` is pinned to `1.12` in this version of Flutter, and `analyzer >=6.5.0`, where the change was made, requires `meta >= 1.15`. This change will eventually be re-reverted.
- Upgrade `brick_core` to `1.3.0`
- Update analysis to modern lints

## 3.1.1

Expand Down
2 changes: 2 additions & 0 deletions packages/brick_offline_first/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 3.4.0

- Upgrade `brick_core` to `1.3.0`
- Update analysis to modern lints
- Change `OfflineFirstRepository#exists` behavior: the check against memory cache will only return `true` if results have been found, otherwise it will continue to the SQLite provider
- Forward errors from `OfflineFirstRepository#subscribe` streams to their callers (@sonbs21 #484)

Expand Down
Loading
Loading