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

fix(offline_first_with_rest): update http minimum dependency (#375) #376

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ class AdapterBuilder<_ClassAnnotation> extends BaseBuilder<_ClassAnnotation> {

@override
Map<String, List<String>> get buildExtensions => {
'.dart': [outputExtension]
'.dart': [outputExtension],
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ class AggregateBuilder implements Builder {

@override
final buildExtensions = const {
r'$lib$': [outputFileName]
r'$lib$': [outputFileName],
};
}
2 changes: 1 addition & 1 deletion packages/brick_build/lib/src/builders/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class BaseBuilder<_ClassAnnotation> implements Builder {

@override
Map<String, List<String>> get buildExtensions => {
'$aggregateExtension.dart': ['${BaseBuilder.aggregateExtension}$outputExtension']
'$aggregateExtension.dart': ['${BaseBuilder.aggregateExtension}$outputExtension'],
};

/// The cached file this will produce
Expand Down
2 changes: 1 addition & 1 deletion packages/brick_build/lib/src/utils/string_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _EscapedDartString {
'\f': r'\f', // 0C - form feed
'\r': r'\r', // 0D - carriage return
'\x7F': r'\x7F', // delete
r'\': r'\\' // backslash
r'\': r'\\', // backslash
};

static final _escapeMapRegexp = _escapeMap.keys.map(_getHexLiteral).join();
Expand Down
2 changes: 1 addition & 1 deletion packages/brick_core/test/query/where_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void main() {
'value': 1,
}
],
'required': false
'required': false,
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/brick_graphql/lib/src/graphql_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class GraphqlProvider extends Provider<GraphqlModel> {
resp.data?.values.first!,
provider: this,
repository: repository,
) as TModel
) as TModel,
];
}

return [
await adapter.fromGraphql(resp.data!, provider: this, repository: repository) as TModel
await adapter.fromGraphql(resp.data!, provider: this, repository: repository) as TModel,
];
}
return <TModel>[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Future<Map<String, dynamic>> _$DemoModelToGraphql(
'complex_field_name': instance.complexFieldName,
'last_name': instance.lastName,
'full_name': instance.name,
'simple_bool': instance.simpleBool == null ? null : (instance.simpleBool! ? 1 : 0)
'simple_bool': instance.simpleBool == null ? null : (instance.simpleBool! ? 1 : 0),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class DemoModelAssocWithSubfieldsAdapter extends GraphqlAdapter<DemoModelAssoc>
iterable: false,
subfields: {
'first': {'subfield1': {}},
'last': {}
'last': {},
},
type: String,
),
Expand Down
6 changes: 3 additions & 3 deletions packages/brick_graphql/test/graphql_provider_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void main() {
group('#get', () {
test('array', () async {
final provider = generateProvider([
{'full_name': 'Thomas'}
{'full_name': 'Thomas'},
]);

final m = await provider.get<DemoModel>();
Expand All @@ -73,7 +73,7 @@ void main() {

test('#subscribe', () async {
final payload = [
{'full_name': 'Guy'}
{'full_name': 'Guy'},
];
final provider = generateProvider(payload);

Expand All @@ -92,7 +92,7 @@ void main() {
final resp = await provider.upsert<DemoModel>(instance);

expect(resp?.data, {
'upsertPerson': [payload]
'upsertPerson': [payload],
});
expect(resp?.errors, isNull);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/brick_graphql/test/graphql_request_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void main() {
modelDictionary: provider.modelDictionary,
query: Query(
providerArgs: {
'context': {'SampleContextEntry': SampleContextEntry('myValue')}
'context': {'SampleContextEntry': SampleContextEntry('myValue')},
},
),
).request;
Expand Down Expand Up @@ -114,7 +114,7 @@ void main() {
variables: {'myVar': 1234},
);
expect(request.requestVariables, {
'vars': {'myVar': 1234}
'vars': {'myVar': 1234},
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class GraphqlDeserialize extends GraphqlSerdesGenerator

return [
if (config?.queryOperationTransformerName != null)
'@override\nfinal queryOperationTransformer = ${config!.queryOperationTransformerName};'
'@override\nfinal queryOperationTransformer = ${config!.queryOperationTransformerName};',
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ class GraphqlAnnotationFinder extends AnnotationFinder<Graphql> {
if (unconvertedMap == null) return {};
return {
for (final entry in unconvertedMap.entries)
entry.key!.toStringValue()!:
entry.value?.toStringValue() == null ? _convertMapToMap(entry.value!.toMapValue()!) : {}
entry.key!.toStringValue()!: entry.value?.toStringValue() == null
? _convertMapToMap(entry.value!.toMapValue()!)
: {},
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ToFromJson {
'subfield1': {},
'subfield2': {
'nestedSubfield': {},
}
},
},
)
final ToFromJsonAssoc assoc;
Expand Down
2 changes: 1 addition & 1 deletion packages/brick_offline_first/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
brick_sqlite: ">=3.0.0 <4.0.0"
collection: ">=1.15.0 <2.0.0"
dart_style: ">=2.0.0 <3.0.0"
http: ">=0.13.4 <2.0.0"
http: ">=1.0.0 <2.0.0"
logging: ">=1.0.0 <2.0.0"
meta: ">=1.3.0 <2.0.0"
path: ^1.8.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DemoModelMigration extends Migration {
foreignKeyColumn: 'f_Mounty_brick_id',
onDeleteCascade: true,
),
InsertColumn('name', Column.varchar, onTable: 'Horse')
InsertColumn('name', Column.varchar, onTable: 'Horse'),
],
down: const <MigrationCommand>[],
);
Expand Down Expand Up @@ -95,14 +95,14 @@ class TestRepository extends OfflineFirstWithTestRepository {
final Map<Type, TestAdapter<TestModel>> testMappings = {
Horse: HorseAdapter(),
MemoryDemoModel: MountyAdapter(),
Mounty: MountyAdapter()
Mounty: MountyAdapter(),
};
final testModelDictionary = TestModelDictionary(testMappings);

/// Sqlite mappings should only be used when initializing a [SqliteProvider]
final Map<Type, SqliteAdapter<SqliteModel>> sqliteMappings = {
Horse: HorseAdapter(),
MemoryDemoModel: MountyAdapter(),
Mounty: MountyAdapter()
Mounty: MountyAdapter(),
};
final sqliteModelDictionary = SqliteModelDictionary(sqliteMappings);
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Future<Map<String, dynamic>> _$HorseToTest(
instance.mounties
.map((s) => MountyAdapter().toTest(s, provider: provider, repository: repository))
.toList(),
)
),
};
}

Expand Down Expand Up @@ -88,7 +88,7 @@ class HorseAdapter extends OfflineFirstWithTestAdapter<Horse> {
columnName: 'mounties',
iterable: true,
type: Mounty,
)
),
};
@override
Future<int?> primaryKeyByUniqueColumns(Horse instance, DatabaseExecutor executor) async =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MountyAdapter extends OfflineFirstWithTestAdapter<Mounty> {
columnName: 'name',
iterable: false,
type: String,
)
),
};
@override
Future<int?> primaryKeyByUniqueColumns(Mounty instance, DatabaseExecutor executor) async =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TestProvider extends Provider<TestModel> {
methodsCalled.add('get');
final adapter = modelDictionary.adapterFor[T]!;
final data = [
{'name': 'SqliteName'}
{'name': 'SqliteName'},
];
final results = data
.map((e) => adapter.fromTest(e, provider: this, repository: repository))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ const List<MigrationCommand> _migration1up = [
InsertTable('Serdes'),
InsertTable('WithSerdes'),
InsertColumn('name', Column.varchar, onTable: 'Serdes'),
InsertColumn('serdes_member', Column.varchar, onTable: 'WithSerdes')
InsertColumn('serdes_member', Column.varchar, onTable: 'WithSerdes'),
];
const List<MigrationCommand> _migration1down = [
DropTable('Serdes'),
DropTable('WithSerdes'),
DropColumn('name', onTable: 'Serdes'),
DropColumn('serdes_member', onTable: 'WithSerdes')
DropColumn('serdes_member', onTable: 'WithSerdes'),
];

@Migratable(version: '1', up: _migration1up, down: _migration1down)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ abstract class OfflineFirstWithGraphqlRepository
upsert: upsert,
),
...?query.providerArgs['context'] as Map<String, ContextEntry>?,
}
},
},
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:convert';

import 'package:gql_exec/gql_exec.dart';
import 'package:gql_link/gql_link.dart';
import 'package:mockito/mockito.dart';
Expand All @@ -15,7 +16,7 @@ Link stubGraphqlLink(

if (wrapInTopLevelKeyAndArray) {
response = {
'result': [response]
'result': [response],
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void main() {
const response = Response(
data: <String, dynamic>{'firstName': 'Thomas'},
response: {
'body': <String, dynamic>{'firstName': 'Thomas'}
'body': <String, dynamic>{'firstName': 'Thomas'},
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DemoModelMigration extends Migration {
foreignKeyColumn: 'f_Mounty_brick_id',
onDeleteCascade: true,
),
InsertColumn('name', Column.varchar, onTable: 'Horse')
InsertColumn('name', Column.varchar, onTable: 'Horse'),
],
down: const <MigrationCommand>[],
);
Expand Down Expand Up @@ -84,14 +84,14 @@ class TestRepository extends OfflineFirstWithGraphqlRepository {
final Map<Type, GraphqlAdapter<GraphqlModel>> graphqlMappings = {
Horse: HorseAdapter(),
MemoryDemoModel: MountyAdapter(),
Mounty: MountyAdapter()
Mounty: MountyAdapter(),
};
final graphqlModelDictionary = GraphqlModelDictionary(graphqlMappings);

/// Sqlite mappings should only be used when initializing a [SqliteProvider]
final Map<Type, SqliteAdapter<SqliteModel>> sqliteMappings = {
Horse: HorseAdapter(),
MemoryDemoModel: MountyAdapter(),
Mounty: MountyAdapter()
Mounty: MountyAdapter(),
};
final sqliteModelDictionary = SqliteModelDictionary(sqliteMappings);
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Future<Map<String, dynamic>> _$HorseToGraphql(
instance.mounties
.map((s) => MountyAdapter().toGraphql(s, provider: provider, repository: repository))
.toList(),
)
),
};
}

Expand Down Expand Up @@ -139,7 +139,7 @@ class HorseAdapter extends OfflineFirstWithGraphqlAdapter<Horse> {
documentNodeName: 'mounties',
iterable: true,
type: Mounty,
)
),
};

@override
Expand All @@ -161,7 +161,7 @@ class HorseAdapter extends OfflineFirstWithGraphqlAdapter<Horse> {
columnName: 'mounties',
iterable: true,
type: Mounty,
)
),
};
@override
Future<int?> primaryKeyByUniqueColumns(Horse instance, DatabaseExecutor executor) async =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class MountyAdapter extends OfflineFirstWithGraphqlAdapter<Mounty> {
columnName: 'name',
iterable: false,
type: String,
)
),
};

@override
Expand All @@ -109,7 +109,7 @@ class MountyAdapter extends OfflineFirstWithGraphqlAdapter<Mounty> {
documentNodeName: 'name',
iterable: false,
type: String,
)
),
};
@override
Future<int?> primaryKeyByUniqueColumns(Mounty instance, DatabaseExecutor executor) async =>
Expand Down
3 changes: 3 additions & 0 deletions packages/brick_offline_first_with_rest/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## Unreleased

## 3.0.2

* Apply standardized lints
* Update minimum HTTP to 1.0.0

## 3.0.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ abstract class OfflineFirstWithRestRepository
// This header is removed by the [RestOfflineQueueClient]
if (headerValue != null) RestOfflineQueueClient.policyHeader: headerValue,
...?query.providerArgs['headers'] as Map<String, String>?,
}
},
},
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RestRequestSqliteCache extends RequestSqliteCache<http.Request> {
String attemptLogMessage(Map<String, dynamic> responseFromSqlite) {
final attemptMessage = [
responseFromSqlite[HTTP_JOBS_REQUEST_METHOD_COLUMN],
responseFromSqlite[HTTP_JOBS_URL_COLUMN]
responseFromSqlite[HTTP_JOBS_URL_COLUMN],
].join(' ');

return 'in $attemptMessage : $responseFromSqlite';
Expand Down
6 changes: 3 additions & 3 deletions packages/brick_offline_first_with_rest/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ 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.0.1
version: 3.0.2

environment:
sdk: ">=2.18.0 <4.0.0"

dependencies:
brick_core: ^1.1.1
brick_offline_first: ">=3.0.0 <4.0.0"
brick_rest: ">=3.0.0 <4.0.0"
brick_rest: ">=3.0.3 <4.0.0"
brick_sqlite: ">=3.0.0 <4.0.0"
collection: ">=1.15.0 <2.0.0"
dart_style: ">=2.0.0 <3.0.0"
http: ">=0.13.0 <2.0.0"
http: ">=1.0.0 <2.0.0"
logging: ">=1.0.0 <2.0.0"
meta: ">=1.3.0 <2.0.0"
path: ^1.8.0
Expand Down
Loading
Loading