Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
336f5b9
:arrow_up: upgraded dependencies other than `go_router`
sarbagyastha Oct 20, 2022
5d2c31b
:arrow_up: upgraded dependencies
sarbagyastha Oct 21, 2022
c320dd4
:truck: moved things in places
sarbagyastha Oct 30, 2022
bb7753d
:sparkles: created `clean_framework_firestore`
sarbagyastha Oct 30, 2022
da74aec
:fire: removed `clean_framework_core`
sarbagyastha Oct 30, 2022
5f89450
:sparkles: created `clean_framework_graphql`
sarbagyastha Oct 30, 2022
fddfaea
:arrow_down: removed dependencies on graphql and firestore
sarbagyastha Oct 30, 2022
264963c
:rotating_light: made analyzer happy to some extent
sarbagyastha Oct 30, 2022
53aaef0
:sparkles: created `clean_framework_rest`
sarbagyastha Oct 30, 2022
5210ed7
:rotating_light: fixed error due to stronger lint
sarbagyastha Oct 30, 2022
fc31a11
:recycle: minor refactor
sarbagyastha Oct 30, 2022
3082503
:bug: fixed tests
sarbagyastha Oct 30, 2022
b89c331
:rotating_light: made analyzer happy
sarbagyastha Oct 30, 2022
6abf1a1
:rotating_light: made analyzer happy
sarbagyastha Oct 30, 2022
cb672f0
:rotating_light: made analyzer happy
sarbagyastha Oct 30, 2022
2d48d0f
:bug: fixed issue with analysis options
sarbagyastha Oct 30, 2022
df7318c
:wrench: configured melos
sarbagyastha Oct 30, 2022
65c403a
:truck: moved network logger to utilities
sarbagyastha Oct 30, 2022
7da9c39
:truck: moved test helpers to `clean_framework_test` package
sarbagyastha Oct 30, 2022
4052a50
:bug: fixed failing tests
sarbagyastha Oct 30, 2022
3a793e7
:fire: removed pubspec overrides from remote repo
sarbagyastha Oct 30, 2022
125d343
:recycle: removed print
sarbagyastha Oct 30, 2022
d0cb853
:art: updated deserializer to take any object as input
sarbagyastha Oct 30, 2022
6bf9943
:sparkles: added `Deserializer.map`
sarbagyastha Oct 31, 2022
f8bc522
:sparkles: added `deserialize` extension to Map<String, dynamic>
sarbagyastha Oct 31, 2022
0d9fdc8
:art: formatted
sarbagyastha Oct 31, 2022
b5905aa
chore(release): publish packages
sarbagyastha Oct 31, 2022
a4c172e
:bookmark: updated version for release
sarbagyastha Oct 31, 2022
3f38eb0
:green_heart: fixed coverage report generation
sarbagyastha Oct 31, 2022
5b53f62
:green_heart: verify pub score
sarbagyastha Oct 31, 2022
a9024ad
:truck: moved tests to routing to own package
sarbagyastha Oct 31, 2022
8009b0b
:green_heart: named ci steps
sarbagyastha Oct 31, 2022
21dbb62
:page_facing_up: updated license and symlinked it to all packages
sarbagyastha Oct 31, 2022
0799201
:page_facing_up: updated license and symlinked it to all packages
sarbagyastha Oct 31, 2022
b0ad9a6
:page_facing_up: updated license and symlinked it to all packages
sarbagyastha Oct 31, 2022
5fbee2a
:page_facing_up: updated license and symlinked it to all packages
sarbagyastha Oct 31, 2022
25b4727
:page_facing_up: updated license and readme
sarbagyastha Oct 31, 2022
28e4c54
:bookmark: prepare for stable release of v1.5.0
sarbagyastha Nov 1, 2022
e17adfc
:rotating_light: fixed usage of deprecated method from riverpod
sarbagyastha Nov 1, 2022
81709d6
:green_heart: commented pub score verification
sarbagyastha Nov 1, 2022
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
Prev Previous commit
Next Next commit
✨ created clean_framework_rest
  • Loading branch information
sarbagyastha committed Oct 30, 2022
commit 53aaef0382129c94fae64d7493b22b2bd57f6263
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:clean_framework/clean_framework_defaults.dart';
import 'package:clean_framework/clean_framework_providers.dart';
import 'package:clean_framework_example/features/random_cat/domain/random_cat_use_case.dart';
import 'package:clean_framework_example/providers.dart';
import 'package:clean_framework_rest/clean_framework_rest.dart';

class RandomCatGateway extends RestGateway<RandomCatGatewayOutput,
RandomCatRequest, RandomCatSuccessInput> {
Expand Down
6 changes: 2 additions & 4 deletions packages/clean_framework/example/lib/providers.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import 'package:clean_framework/clean_framework.dart';
import 'package:clean_framework/clean_framework_defaults.dart'
hide FeatureState;
import 'package:clean_framework/clean_framework_providers.dart';

import 'package:clean_framework_example/features/last_login/domain/last_login_entity.dart';
import 'package:clean_framework_example/features/last_login/domain/last_login_use_case.dart';
import 'package:clean_framework_example/features/last_login/external_interface/last_login_date_gateway.dart';
import 'package:clean_framework_firestore/clean_framework_firestore.dart';
import 'package:clean_framework_graphql/clean_framework_graphql.dart';
import 'package:flutter/cupertino.dart';
import 'package:clean_framework_rest/clean_framework_rest.dart';
import 'package:flutter/foundation.dart';

import 'features/country/domain/country_entity.dart';
import 'features/country/domain/country_use_case.dart';
Expand Down
2 changes: 2 additions & 0 deletions packages/clean_framework/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ dependencies:
path: ../../clean_framework_graphql
clean_framework_firestore:
path: ../../clean_framework_firestore
clean_framework_rest:
path: ../../clean_framework_rest

intl: ^0.17.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:clean_framework/clean_framework.dart';
import 'package:clean_framework/clean_framework_defaults.dart';
import 'package:clean_framework/clean_framework_providers.dart';
import 'package:clean_framework_example/features/random_cat/domain/random_cat_entity.dart';
import 'package:clean_framework_example/providers.dart';
import 'package:clean_framework_rest/clean_framework_rest.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
Expand Down
3 changes: 0 additions & 3 deletions packages/clean_framework/lib/clean_framework_defaults.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ library clean_framework_defaults;

export 'package:clean_framework/src/defaults/feature_provider/json_feature_provider.dart';
export 'package:clean_framework/src/defaults/feature_state/feature_state.dart';
export 'package:clean_framework/src/defaults/network_service.dart';
export 'package:clean_framework/src/defaults/providers/rest/rest.dart';
export 'package:clean_framework/src/defaults/providers/rest/src/rest_service.dart';
52 changes: 0 additions & 52 deletions packages/clean_framework/lib/src/defaults/network_service.dart

This file was deleted.

1 change: 0 additions & 1 deletion packages/clean_framework/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies:
either_dart: ^0.2.0
equatable: ^2.0.5
flutter_riverpod: ^2.0.2
http: ^0.13.5
meta: '>=1.8.0 <1.9.0'
path: '>=1.8.2 <1.9.0'
riverpod: ^2.0.2
Expand Down
20 changes: 0 additions & 20 deletions packages/clean_framework/test/defaults/network_service_test.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export 'src/graphql_external_interface.dart';
export 'src/graphql_fetch_policy.dart';
export 'src/graphql_gateway.dart';
export 'src/graphql_logger.dart';
export 'src/graphql_method.dart';
export 'src/graphql_requests.dart';
export 'src/graphql_responses.dart';
export 'src/graphql_service.dart';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:clean_framework/src/defaults/network_service.dart';
import 'package:clean_framework/src/providers/external_interface.dart';
import 'package:clean_framework/src/providers/gateway.dart';

import 'graphql_method.dart';
import 'graphql_requests.dart';
import 'graphql_responses.dart';
import 'graphql_service.dart';
Expand Down
8 changes: 8 additions & 0 deletions packages/clean_framework_graphql/lib/src/graphql_method.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// The types of GraphQL operations.
enum GraphQLMethod {
/// Query
query,

/// Mutation
mutation,
}
33 changes: 20 additions & 13 deletions packages/clean_framework_graphql/lib/src/graphql_service.dart
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import 'dart:async';

import 'package:clean_framework/clean_framework_defaults.dart';
import 'package:gql/ast.dart';
import 'package:graphql/client.dart';

import 'graphql_error_policy.dart';
import 'graphql_fetch_policy.dart';
import 'graphql_logger.dart';
import 'graphql_method.dart';

class GraphQLService extends NetworkService {
class GraphQLService {
GraphQLService({
required String endpoint,
required this.endpoint,
this.headers = const {},
this.timeout,
GraphQLToken? token,
Map<String, String> headers = const {},
GraphQLPersistence persistence = const GraphQLPersistence(),
DefaultPolicies? defaultPolicies,
this.timeout,
}) : super(baseUrl: endpoint, headers: headers) {
}) {
final link = _createLink(token: token);

_createClient(
Expand All @@ -26,15 +26,23 @@ class GraphQLService extends NetworkService {
);
}

final Completer<GraphQLClient> _clientCompleter = Completer();
/// The GraphQL endpoint.
final String endpoint;

/// The global headers to be sent with the request.
final Map<String, String> headers;

final Duration? timeout;

final Completer<GraphQLClient> _clientCompleter = Completer();
GraphQLClient? _graphQLClient;

GraphQLService.withClient({
required GraphQLClient client,
this.timeout,
}) : _graphQLClient = client,
super(baseUrl: '', headers: const {});
}) : endpoint = '',
headers = const {},
_graphQLClient = client;

Future<GraphQLClient> get _client async {
if (_graphQLClient == null) {
Expand Down Expand Up @@ -98,8 +106,7 @@ class GraphQLService extends NetworkService {
}

Link _createLink({required GraphQLToken? token}) {
final _headers = headers ?? {};
final httpLink = HttpLink(baseUrl, defaultHeaders: _headers);
final httpLink = HttpLink(endpoint, defaultHeaders: headers);

Link _link;
if (token == null) {
Expand All @@ -115,12 +122,12 @@ class GraphQLService extends NetworkService {
// Attach GraphQL Logger only in debug mode
assert(() {
final loggerLink = GraphQLLoggerLink(
endpoint: baseUrl,
endpoint: endpoint,
getHeaders: () async {
// coverage:ignore-start
return {
if (token != null) token.key: await token.builder() ?? '',
..._headers,
...headers,
};
// coverage:ignore-end
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:clean_framework/clean_framework_defaults.dart';
import 'package:clean_framework/clean_framework_providers.dart';
import 'package:clean_framework/clean_framework_tests.dart';
import 'package:clean_framework_graphql/clean_framework_graphql.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:clean_framework/clean_framework_defaults.dart';
import 'package:clean_framework_graphql/clean_framework_graphql.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:graphql/client.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export 'src/rest_external_interface.dart';
export 'src/rest_gateway.dart';
export 'src/rest_method.dart';
export 'src/rest_requests.dart';
export 'src/rest_responses.dart';
export 'src/rest_service.dart';
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'dart:typed_data';

import 'package:clean_framework/src/defaults/providers/rest/src/rest_requests.dart';
import 'package:clean_framework/src/defaults/providers/rest/src/rest_responses.dart';
import 'package:clean_framework/src/defaults/providers/rest/src/rest_service.dart';
import 'package:clean_framework/src/providers/external_interface.dart';
import 'package:clean_framework/src/providers/gateway.dart';
import 'package:cross_file/cross_file.dart';

import '../../../../utilities/file.dart';
import 'rest_requests.dart';
import 'rest_responses.dart';
import 'rest_service.dart';

class RestExternalInterface
extends ExternalInterface<RestRequest, RestSuccessResponse> {
Expand Down Expand Up @@ -61,7 +61,7 @@ class RestExternalInterface
);
on<BinaryDataSrcRestRequest>(
(request, send) async {
final binaryData = File(request.src).readAsBytesSync();
final binaryData = await XFile(request.src).readAsBytes();
final data = await _restService.binaryRequest(
method: request.method,
path: request.path,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:clean_framework/clean_framework_providers.dart';
import 'package:clean_framework/src/app_providers_container.dart';
import 'package:clean_framework/src/defaults/providers/rest/src/rest_requests.dart';
import 'package:clean_framework/src/defaults/providers/rest/src/rest_responses.dart';

import 'rest_requests.dart';
import 'rest_responses.dart';

abstract class RestGateway<O extends Output, R extends RestRequest,
S extends SuccessInput> extends Gateway<O, R, RestSuccessResponse, S> {
Expand Down
25 changes: 25 additions & 0 deletions packages/clean_framework_rest/lib/src/rest_method.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// coverage:ignore-start
/// The types of HTTP methods.
enum RestMethod {
// coverage:ignore-end
/// GET
get('GET'),

/// POST
post('POST'),

/// PUT
put('PUT'),

/// DELETE
delete('DELETE'),

/// PATCH
patch('PATCH');

/// Default constructor.
const RestMethod(this.value);

/// The HTTP method name.
final String value;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'dart:typed_data';

import 'package:clean_framework/clean_framework_defaults.dart';
import 'package:clean_framework/src/providers/gateway.dart';
import 'package:clean_framework/src/defaults/network_service.dart';
import 'package:meta/meta.dart';

import 'rest_method.dart';

abstract class RestRequest extends Request {
RestRequest(this.method);

Expand Down
Loading