Skip to content

Commit

Permalink
Merge pull request #14 from juancastillo0/dependency_analyzer6
Browse files Browse the repository at this point in the history
Update dependencies primarily for code generator and small linting fixes. Support analyzer 6.0
  • Loading branch information
juancastillo0 committed Oct 2, 2023
2 parents 3e7351f + 7d8213a commit 240576e
Show file tree
Hide file tree
Showing 92 changed files with 3,295 additions and 2,635 deletions.
11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_run_upgrade_all.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -707,13 +707,13 @@ If your prefer to read the documentation in a web page, you can [try the documen

The GraphQL language provides multiple types for representing your exposed API and the required data structures for the input values. In the following sections we explain their usage within Leto and, in general, for GraphQL. Each section contains a link to the official GraphQL specification for more information.

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Schema)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Schema)

## Scalars

The fundamental building-block in the type system. Standard `GraphQLScalarType`s: String, Int, Float, Boolean and ID types are already implemented and provided by Leto.

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Scalars)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Scalars)

Other scalar types are also provided:

Expand All @@ -732,7 +732,7 @@ To provide your own or support types from other packages you can use [Custom Sca

Enums are text values which are restricted to a set of predefined variants. Their behavior is similar to scalars and they don't have a nested fields.

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Enums)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Enums)

They require a unique name and a set of entries mapping their string representation to the Dart value obtained after parsing.

Expand Down Expand Up @@ -777,7 +777,7 @@ enum SignUpError {

GraphQL objects allow you to specify a type with a set of fields or properties. Objects can only be outputs in a resolver. Each field can be of any output type.

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Objects)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Objects)

The Query, Mutation and Subscription types in the schema are specified using GraphQL objects.

Expand Down Expand Up @@ -820,7 +820,7 @@ This would generate graphql_api.schema.dart

### Interfaces

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Interfaces)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Interfaces)

- inheritFrom

Expand All @@ -831,7 +831,7 @@ a super type, now the Object will implement the Interface passed as parameter.

Input types specify the structure of the values that inputs to resolvers should have. Scalars and Enums can be passed as input to resolvers. Wrapper types such as List and NonNull types of Scalars and Enums, also can be passed, however for more complex Objects with nested fields you will need to use `GraphQLInputObjectType`. Similar `GraphQLObjectType`, a `GraphQLInputObjectType` can have fields.

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Input-Objects)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Input-Objects)

// TODO: 1A customDeserialize with SerdeCtx deserializers

Expand Down Expand Up @@ -989,7 +989,7 @@ Similar to enums, Unions are restricted to a set of predefined variants, however

Per the GraphQL spec, Unions can't be (or be part of) Input types and their possible types is a non empty collection of unique `GraphQLObjectType`.

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Unions)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Unions)

To have the following GraphQL type definitions:

Expand Down Expand Up @@ -1118,7 +1118,7 @@ Wrapping types allow to modify the behavior of the inner (wrapped) type. The inn

`GraphQLNonNullType` allows you to represent a non-nullable or required value. By default, all GraphQL Types are nullable or optional, if you want to represent a required input or specify that a given output is always present (non-null), you want to use the `GraphQLNonNullType` wrapping type.

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Non-Null)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Non-Null)


In GraphQL this is represented using the `!` exclamation mark after a given type expression. In Dart you can use the `nonNull()` method present in each `GraphQLType`, which will return a non-nullable `GraphQLNonNullType` with it's inner type, the type from which `nonNull` was called. For example, `graphQLString.nonNull()` will be a `String!` in GraphQL.
Expand All @@ -1127,7 +1127,7 @@ In GraphQL this is represented using the `!` exclamation mark after a given type

`GraphQLListType` allows you to represent a collection of values.

[GraphQL Specification](http://spec.graphql.org/draft/#sec-List)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-List)

This values can be of any `GraphQLType` and List types can be Output or Input Types if the Wrapped type is an Output or Input type. For example, a List of Union types is an Output type while a List of Strings (scalar types) can be an Output or Input type. You can use the `<type>.list()` method present in each `GraphQLType` or the `listOf(<type>)` global utility function to create a `GraphQLListType`. For example, `graphQLString.list()` will be a `[String]` in GraphQL.

Expand Down Expand Up @@ -1564,7 +1564,7 @@ This is the base context associated with the request, contains the raw informati

## Schema Validation

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Type-System)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Type-System)

Implements the "Type Validation" sub-sections of the specification's "Type System" section.

Expand All @@ -1574,7 +1574,7 @@ This will be executed before stating a GraphQL server. Leto implements all of th

## Document Validation

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Validation)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Validation)

This will be executed before executing any request. Leto implements all of the Specification's document validation. The code for all rules can be found in the [validate](https://github.com/juancastillo0/leto/tree/main/leto_schema/lib/src/validate) folder in `package:leto_schema`.

Expand Down Expand Up @@ -1669,11 +1669,11 @@ class ConnectionArguments {

## `GraphQLResult`

[GraphQL Specification](http://spec.graphql.org/draft/#sec-Response)
[GraphQL Specification](https://spec.graphql.org/draft/#sec-Response)

The returned `GraphQLResult` is the output of the execution of a GraphQL request it contains the encountered `GraphQLError`s, the output `extensions` and the `data` payload. The `GraphQLResult.toJson` Map is used by `package:leto_shelf` when constructing an HTTP response's body.

- The `data` is a `Map<String, Object?>?` for Queries and Mutations or a `Stream<GraphQLResult>` for subscriptions. It has the payload returned by the resolvers during execution. Will be null if there was an error in validation or in the execution of a non-nullable root field. If there was an error in validation, the `data` property will not be set in the `GraphQLResult.toJson` Map following the [spec](http://spec.graphql.org/draft/#sec-Response).
- The `data` is a `Map<String, Object?>?` for Queries and Mutations or a `Stream<GraphQLResult>` for subscriptions. It has the payload returned by the resolvers during execution. Will be null if there was an error in validation or in the execution of a non-nullable root field. If there was an error in validation, the `data` property will not be set in the `GraphQLResult.toJson` Map following the [spec](https://spec.graphql.org/draft/#sec-Response).

- The `errors` contain the `GraphQLError`s encountered during validation or execution. If a resolver throws an error, it will appear in this error list. If the field's return type is nullable, a null value will be set as the output for that field. If the type is non-nullable the resolver will continue to throw an exception until a nullable field is reached or the root resolver is reached (in this case the `GraphQLResult.data` property will be null).

Expand Down Expand Up @@ -2058,7 +2058,7 @@ All extensions are implemented in this way, so you can look at the source code f

# Directives

For more information: [GraphQL specification](http://spec.graphql.org/draft/#sec-Type-System.Directives)
For more information: [GraphQL specification](https://spec.graphql.org/draft/#sec-Type-System.Directives)


[`GraphQLDirective`](https://github.com/juancastillo0/leto/blob/main/leto_schema/lib/src/directive.dart) allows you to provide more information about different elements of your schema and queries.
Expand Down
10 changes: 7 additions & 3 deletions chat_example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ linter:
unnecessary_this: false

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
language:
strict-casts: true
strict-inference: true
# strict-raw-types: true
exclude:
- /**.g.dart
- /**.gql.dart
- /**.freezed.dart
- /generated/**/*
- "server/lib/all_tables.sql.dart"
errors:
body_might_complete_normally_nullable: ignore
missing_return: error
unrelated_type_equality_checks: error
null_check_on_nullable_type_parameter: warning
Expand Down
2 changes: 1 addition & 1 deletion chat_example/lib/api/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Future<RootStore> initClient(PersistenceStore persistence) async {
serializer: const CacheRequestSerializer(),
initialPayload: <String, Object?>{
..._defaultHeaders(persistence.authStorage.getDeviceId()),
'refreshToken': authStore.state!.refreshToken,
'refreshToken': authStore.refreshToken,
},
);
ref.dispose();
Expand Down
1 change: 1 addition & 0 deletions chat_example/lib/auth/auth_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class AuthStore extends StateNotifier<GSTokenWithUserData?> {
bool get isAnonymous => state?.user.name == null;
GSTokenWithUser_user? get user => state?.user;
String? get authToken => state?.accessToken;
String? get refreshToken => state?.refreshToken;

Client get _client => _read(clientProvider);

Expand Down
42 changes: 21 additions & 21 deletions chat_example/lib/chat_rooms/chat_rooms_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,28 +111,28 @@ final deleteChatRoomUserHandler =
return;
}
final vars = response.operationRequest.vars;
if (false) {
// TODO: leave group
final rooms = proxy.readQuery(GgetRoomsReq()) ?? GgetRoomsData();
// if (false) {
// // TODO: leave group
// final rooms = proxy.readQuery(GgetRoomsReq()) ?? GgetRoomsData();

proxy.writeQuery(
GgetRoomsReq(),
rooms.rebuild(
(b) => b
..getChatRooms.removeWhere(
(r) => r.id == vars.chatId,
),
),
);
} else {
_updateRoomUsers(
proxy,
vars.chatId,
(p0) => p0.removeWhere(
(u) => u.userId == vars.userId,
),
);
}
// proxy.writeQuery(
// GgetRoomsReq(),
// rooms.rebuild(
// (b) => b
// ..getChatRooms.removeWhere(
// (r) => r.id == vars.chatId,
// ),
// ),
// );
// } else {
_updateRoomUsers(
proxy,
vars.chatId,
(p0) => p0.removeWhere(
(u) => u.userId == vars.userId,
),
);
// }
},
);

Expand Down
2 changes: 1 addition & 1 deletion chat_example/lib/events/events_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final apiEventStoreProvider = Provider((ref) {

class ApiEventStore {
final T Function<T>(ProviderListenable<T>) _read;
final Function(Function()) onDispose;
final void Function(void Function()) onDispose;

ApiEventStore(this._read, this.onDispose) {
final sub = _read(userEvents.stream).listen((resp) {
Expand Down

0 comments on commit 240576e

Please sign in to comment.