Skip to content

Commit

Permalink
Merge pull request #26 from gql-dart/master
Browse files Browse the repository at this point in the history
Staying up to date
  • Loading branch information
agent3bood authored Dec 6, 2021
2 parents 0cfd754 + 0f29479 commit 6085d89
Show file tree
Hide file tree
Showing 31 changed files with 627 additions and 58 deletions.
12 changes: 8 additions & 4 deletions examples/gql_example_http_auth_link/bin/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ final fakeHttpLink = Link.function(
if ((headers?.headers ?? <String, String>{})["Authorization"] == null) {
throw HttpLinkServerException(
response: http.Response("", 401),
parsedResponse: Response(),
parsedResponse: Response(response: const <String, dynamic>{}),
);
}

yield Response(
data: <String, String>{
final response = <String, dynamic>{
"data": <String, String>{
"authHeader":
(headers?.headers ?? <String, String>{})["Authorization"]!,
},
}
};
yield Response(
data: response["data"] as Map<String, dynamic>?,
response: response,
);
},
);
Expand Down
2 changes: 1 addition & 1 deletion examples/gql_example_http_auth_link/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ environment:
dependencies:
gql: ^0.13.0
gql_error_link: ^0.2.0
gql_exec: ^0.3.0
gql_exec: ^0.3.1
gql_http_link: ^0.4.0
gql_link: ^0.4.0
gql_transform_link: ^0.2.0
Expand Down
1 change: 1 addition & 0 deletions gql/.pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/cats/
4 changes: 4 additions & 0 deletions links/gql_dedupe_link/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.1

- Upgrade `gql_exec`.

## 2.0.0-nullsafety.1

Null Safety Pre-release
Expand Down
4 changes: 2 additions & 2 deletions links/gql_dedupe_link/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: gql_dedupe_link
version: 2.0.0
version: 2.0.1
description: GQL Link to deduplicate identical in-flight execution requests
repository: https://github.com/gql-dart/gql
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
async: ^2.5.0
gql_exec: ^0.3.0
gql_exec: ^0.3.1
gql_link: ^0.4.0
meta: ^1.3.0
dev_dependencies:
Expand Down
24 changes: 18 additions & 6 deletions links/gql_dedupe_link/test/gql_dedupe_link_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ void main() {
variables: const <String, dynamic>{"i": 12},
);

const result1Data = <String, dynamic>{"a": 1};
final result1 = Response(
data: const <String, dynamic>{"a": 1},
data: result1Data,
response: const <String, dynamic>{"data": result1Data},
);

final mockLink = MockLink();
Expand Down Expand Up @@ -80,12 +82,16 @@ void main() {
variables: const <String, dynamic>{"i": 42},
);

const result1Data = <String, dynamic>{"a": 1};
final result1 = Response(
data: const <String, dynamic>{"a": 1},
data: result1Data,
response: const <String, dynamic>{"data": result1Data},
);

const result21Data = <String, dynamic>{"a": 1};
final result2 = Response(
data: const <String, dynamic>{"a": 2},
data: result21Data,
response: const <String, dynamic>{"data": result21Data},
);

final mockLink = MockLink();
Expand Down Expand Up @@ -143,8 +149,10 @@ void main() {
variables: const <String, dynamic>{"i": 12},
);

const result1Data = <String, dynamic>{"a": 1};
final result1 = Response(
data: const <String, dynamic>{"a": 1},
data: result1Data,
response: const <String, dynamic>{"data": result1Data},
);

final mockLink = MockLink();
Expand Down Expand Up @@ -192,8 +200,10 @@ void main() {
variables: const <String, dynamic>{"i": 12},
);

const result1Data = <String, dynamic>{"a": 1};
final result1 = Response(
data: const <String, dynamic>{"a": 1},
data: result1Data,
response: const <String, dynamic>{"data": result1Data},
);

final mockLink = MockLink();
Expand Down Expand Up @@ -238,8 +248,10 @@ void main() {
variables: const <String, dynamic>{"i": 12},
);

const result1Data = <String, dynamic>{"a": 1};
final result1 = Response(
data: const <String, dynamic>{"a": 1},
data: result1Data,
response: const <String, dynamic>{"data": result1Data},
);

final mockLink = MockLink();
Expand Down
4 changes: 4 additions & 0 deletions links/gql_dio_link/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.1

* Upgrade `gql_exec`.

## 0.2

* Add support for file upload
Expand Down
1 change: 1 addition & 0 deletions links/gql_dio_link/lib/src/dio_link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class DioLink extends Link {
yield Response(
data: gqlResponse.data,
errors: gqlResponse.errors,
response: gqlResponse.response,
context: _updateResponseContext(gqlResponse, dioResponse),
);
}
Expand Down
4 changes: 2 additions & 2 deletions links/gql_dio_link/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: gql_dio_link
version: 0.2.0
version: 0.2.1
description: Similar to gql_http_link, gql_dio_link is a GQL Terminating Link to execute requests via Dio using JSON
repository: https://github.com/gql-dart/gql
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
dio: ^4.0.0
gql_exec: ^0.3.0
gql_exec: ^0.3.1
gql_link: ^0.4.0
meta: ^1.3.0
dev_dependencies:
Expand Down
17 changes: 17 additions & 0 deletions links/gql_dio_link/test/gql_dio_link_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ void main() {
Response(
data: const <String, dynamic>{},
errors: null,
response: const <String, dynamic>{"date": <String, dynamic>{}},
context: Context()
.withEntry(
ResponseExtensions(null),
Expand Down Expand Up @@ -445,6 +446,16 @@ void main() {
],
),
],
response: const <String, dynamic>{
"date": <String, dynamic>{
"errors": {"message": "Execution error"},
"path": <dynamic>["friends", 0, "name"],
"extensions": <String, dynamic>{},
"locations": <Map<String, dynamic>>[
{"line": 1, "column": 1}
],
},
},
context: Context()
.withEntry(
ResponseExtensions(null),
Expand Down Expand Up @@ -507,6 +518,11 @@ void main() {
"something": "random text 55656",
},
errors: null,
response: const <String, dynamic>{
"data": <String, dynamic>{
"something": "random text 55656",
}
},
context: Context().withEntry(
ResponseExtensions(null),
),
Expand Down Expand Up @@ -626,6 +642,7 @@ void main() {
Response(
data: null,
errors: null,
response: const <String, dynamic>{},
context: Context().withEntry(
ResponseExtensions(null),
)),
Expand Down
4 changes: 4 additions & 0 deletions links/gql_error_link/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.1

- Upgrade `gql_exec`.

## 0.2.0-nullsafety.1

Null Safety Pre-release
Expand Down
8 changes: 6 additions & 2 deletions links/gql_error_link/example/gql_error_link_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ final terminatingLink = Link.function(
}

// Otherwise, yield some [Response].
final data = <String, String?>{
"magic": token.token,
};
yield Response(
data: <String, String?>{
"magic": token.token,
data: data,
response: <String, dynamic>{
"data": data,
},
);
},
Expand Down
4 changes: 2 additions & 2 deletions links/gql_error_link/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: gql_error_link
version: 0.2.0
version: 0.2.1
description: GQL Link to handle execution errors and exceptions
repository: https://github.com/gql-dart/gql
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
async: ^2.5.0
gql_exec: ^0.3.0
gql_exec: ^0.3.1
gql_link: ^0.4.0
meta: ^1.3.0
dev_dependencies:
Expand Down
Loading

0 comments on commit 6085d89

Please sign in to comment.