From f7d87a2002d3fb6fb7ccfa41eca7d32d3b4ff631 Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Fri, 10 Nov 2023 23:24:37 +0000 Subject: [PATCH] chore(release): publish packages - ferry_exec@0.4.0 --- CHANGELOG.md | 35 +++ packages/ferry/pubspec.yaml | 4 +- packages/ferry_cache/pubspec.yaml | 2 +- packages/ferry_exec/CHANGELOG.md | 6 + .../lib/src/json_operation_request.dart | 84 +++++++ packages/ferry_exec/pubspec.yaml | 4 +- packages/ferry_flutter/pubspec.yaml | 2 +- packages/ferry_generator/CHANGELOG.md | 2 +- .../lib/src/codegen/fragment_req.dart | 9 + .../lib/src/codegen/operation_req.dart | 9 + packages/ferry_generator/pubspec.yaml | 2 +- packages/ferry_test_graphql2/pubspec.yaml | 2 +- packages/ferry_test_graphql3/.gitignore | 9 + packages/ferry_test_graphql3/CHANGELOG.md | 222 ++++++++++++++++++ packages/ferry_test_graphql3/LICENSE | 21 ++ packages/ferry_test_graphql3/README.md | 1 + .../ferry_test_graphql3/analysis_options.yaml | 1 + packages/ferry_test_graphql3/build.yaml | 15 ++ packages/ferry_test_graphql3/lib/main.dart | 64 +++++ .../lib/queries/fragments.graphql | 22 ++ .../lib/queries/reviews.graphql | 7 + .../lib/schema/schema.graphql | 44 ++++ packages/ferry_test_graphql3/pubspec.yaml | 33 +++ 23 files changed, 591 insertions(+), 9 deletions(-) create mode 100644 packages/ferry_exec/lib/src/json_operation_request.dart create mode 100644 packages/ferry_test_graphql3/.gitignore create mode 100644 packages/ferry_test_graphql3/CHANGELOG.md create mode 100644 packages/ferry_test_graphql3/LICENSE create mode 100644 packages/ferry_test_graphql3/README.md create mode 100644 packages/ferry_test_graphql3/analysis_options.yaml create mode 100644 packages/ferry_test_graphql3/build.yaml create mode 100644 packages/ferry_test_graphql3/lib/main.dart create mode 100644 packages/ferry_test_graphql3/lib/queries/fragments.graphql create mode 100644 packages/ferry_test_graphql3/lib/queries/reviews.graphql create mode 100644 packages/ferry_test_graphql3/lib/schema/schema.graphql create mode 100644 packages/ferry_test_graphql3/pubspec.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index b80d3024..05484f53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,41 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 2023-11-10 + +### Changes + +--- + +Packages with breaking changes: + + - [`ferry_exec` - `v0.4.0`](#ferry_exec---v040) + +Packages with other changes: + + - [`ferry` - `v0.15.0-dev.4`](#ferry---v0150-dev4) + - [`ferry_test_graphql2` - `v0.2.4-dev.1`](#ferry_test_graphql2---v024-dev1) + - [`ferry_flutter` - `v0.8.1-dev.4`](#ferry_flutter---v081-dev4) + - [`ferry_cache` - `v0.7.1-dev.4`](#ferry_cache---v071-dev4) + - [`ferry_generator` - `v0.8.2-dev.2`](#ferry_generator---v082-dev2) + +Packages with dependency updates only: + +> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project. + + - `ferry` - `v0.15.0-dev.4` + - `ferry_test_graphql2` - `v0.2.4-dev.1` + - `ferry_flutter` - `v0.8.1-dev.4` + - `ferry_cache` - `v0.7.1-dev.4` + - `ferry_generator` - `v0.8.2-dev.2` + +--- + +#### `ferry_exec` - `v0.4.0` + + - **BREAKING** **FEAT**(ferry_exec): add `varToJson()` method to OperationRequest and FragmentRequest in order to make the cache work without casts to dynamic. + + ## 2023-08-13 ### Changes diff --git a/packages/ferry/pubspec.yaml b/packages/ferry/pubspec.yaml index 7d47df1d..a49fa02d 100644 --- a/packages/ferry/pubspec.yaml +++ b/packages/ferry/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://ferrygraphql.com/ description: Ferry is a simple, powerful GraphQL Client for Flutter and Dart. repository: https://github.com/gql-dart/ferry environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: gql: '>=0.14.0 <2.0.0' rxdart: ^0.27.1 @@ -14,7 +14,7 @@ dependencies: collection: ^1.15.0 hive: ^2.0.0 built_value: ^8.0.4 - ferry_exec: ^0.3.1 + ferry_exec: ^0.4.0 normalize: ^0.9.0-dev.2 ferry_cache: ^0.7.1-dev.3 dev_dependencies: diff --git a/packages/ferry_cache/pubspec.yaml b/packages/ferry_cache/pubspec.yaml index a33f2c68..865109f1 100644 --- a/packages/ferry_cache/pubspec.yaml +++ b/packages/ferry_cache/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/gql-dart/ferry environment: sdk: '>=2.12.0 <3.0.0' dependencies: - ferry_exec: ^0.3.1 + ferry_exec: ^0.4.0 meta: ^1.3.0 rxdart: ^0.27.1 normalize: ^0.9.0-dev.2 diff --git a/packages/ferry_exec/CHANGELOG.md b/packages/ferry_exec/CHANGELOG.md index 04d0f956..973457fc 100644 --- a/packages/ferry_exec/CHANGELOG.md +++ b/packages/ferry_exec/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.4.0 + +> Note: This release has breaking changes. + + - **BREAKING** **FEAT**(ferry_exec): add `varToJson()` method to OperationRequest and FragmentRequest in order to make the cache work without casts to dynamic. + ## 0.3.1 - Bump "ferry_exec" to `0.3.1`. diff --git a/packages/ferry_exec/lib/src/json_operation_request.dart b/packages/ferry_exec/lib/src/json_operation_request.dart new file mode 100644 index 00000000..fe1298fa --- /dev/null +++ b/packages/ferry_exec/lib/src/json_operation_request.dart @@ -0,0 +1,84 @@ +import 'package:collection/collection.dart'; +import 'package:ferry_exec/ferry_exec.dart'; +import 'package:gql_exec/gql_exec.dart'; + +/// A [OperationRequest] that parses the response into a [Map] +/// this is useful for when you don't have a generated class for the operation +/// or as an escape hatch for when you want to parse the response yourself. +class JsonOperationRequest implements OperationRequest, Map> { + @override + final FetchPolicy fetchPolicy; + + @override + final String? requestId; + + @override + final String? updateCacheHandlerKey; + + @override + final Map? updateCacheHandlerContext; + + @override + final bool executeOnListen; + + @override + final Map vars; + + @override + final Map? Function(Map?, Map?)? updateResult; + + @override + final Operation operation; + + @override + Request get execRequest => Request(operation: operation, variables: vars); + + JsonOperationRequest( + {required this.operation, + required this.fetchPolicy, + required this.requestId, + this.updateCacheHandlerKey, + this.updateCacheHandlerContext, + this.executeOnListen = true, + required this.vars, + this.updateResult, + this.optimisticResponse}); + + @override + Map parseData(Map json) => json; + + @override + final Map? optimisticResponse; + + @override + Map varsToJson() => vars; + + @override + bool operator ==(Object o) { + if (identical(this, o)) return true; + + return o is JsonOperationRequest && + o.operation == operation && + o.fetchPolicy == fetchPolicy && + o.requestId == requestId && + o.updateCacheHandlerKey == updateCacheHandlerKey && + o.updateCacheHandlerContext == updateCacheHandlerContext && + o.executeOnListen == executeOnListen && + const DeepCollectionEquality().equals(vars, o.vars) && + o.updateResult == updateResult && + o.optimisticResponse == optimisticResponse; + } + + @override + int get hashCode { + return operation.hashCode ^ + fetchPolicy.hashCode ^ + requestId.hashCode ^ + updateCacheHandlerKey.hashCode ^ + updateCacheHandlerContext.hashCode ^ + executeOnListen.hashCode ^ + const DeepCollectionEquality().hash(vars) ^ + updateResult.hashCode ^ + optimisticResponse.hashCode; + } +} diff --git a/packages/ferry_exec/pubspec.yaml b/packages/ferry_exec/pubspec.yaml index 3d9a0261..00b07313 100644 --- a/packages/ferry_exec/pubspec.yaml +++ b/packages/ferry_exec/pubspec.yaml @@ -1,10 +1,10 @@ name: ferry_exec -version: 0.3.1 +version: 0.4.0 homepage: https://ferrygraphql.com/ description: A strongly typed execution interface for GraphQL operations repository: https://github.com/gql-dart/ferry environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: gql: '>=0.14.0 <2.0.0' gql_exec: '>=0.4.0 <2.0.0' diff --git a/packages/ferry_flutter/pubspec.yaml b/packages/ferry_flutter/pubspec.yaml index 5284d8d2..763a5626 100644 --- a/packages/ferry_flutter/pubspec.yaml +++ b/packages/ferry_flutter/pubspec.yaml @@ -8,7 +8,7 @@ environment: dependencies: ferry: ^0.15.0-dev.3 gql_exec: '>=0.4.0 <2.0.0' - ferry_exec: ^0.3.1 + ferry_exec: ^0.4.0 flutter: sdk: flutter flutter_test: diff --git a/packages/ferry_generator/CHANGELOG.md b/packages/ferry_generator/CHANGELOG.md index 71ae40eb..45499a6b 100644 --- a/packages/ferry_generator/CHANGELOG.md +++ b/packages/ferry_generator/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.8.2-dev.1 - - **FEAT**(ferry_generator): add option to reuse data classes for fragments with a single inline fragment spread as selection (#530). + - **FEAT**(ferry_generator): experimental: add option to reuse data classes for fragments with a single inline fragment spread as selection (#530). ## 0.8.2-dev.0 diff --git a/packages/ferry_generator/lib/src/codegen/fragment_req.dart b/packages/ferry_generator/lib/src/codegen/fragment_req.dart index 70b5591a..f3812af3 100644 --- a/packages/ferry_generator/lib/src/codegen/fragment_req.dart +++ b/packages/ferry_generator/lib/src/codegen/fragment_req.dart @@ -76,6 +76,15 @@ Class _buildFragmentReqClass( ..lambda = true ..body = dataTypeRef.property('fromJson').call([refer('json')]).code, ), + Method( + (b) => b + ..annotations.add(refer('override')) + ..returns = refer('Map') + ..type = MethodType.getter + ..name = 'varsToJson' + ..lambda = true + ..body = refer('vars').property('toJson').call([]).code, + ), ], initializers: { 'document': refer('document', '#ast'), diff --git a/packages/ferry_generator/lib/src/codegen/operation_req.dart b/packages/ferry_generator/lib/src/codegen/operation_req.dart index e4e84642..5bc3c0a3 100644 --- a/packages/ferry_generator/lib/src/codegen/operation_req.dart +++ b/packages/ferry_generator/lib/src/codegen/operation_req.dart @@ -159,6 +159,15 @@ Class _buildOperationReqClass( ..lambda = true ..body = dataTypeRef.property('fromJson').call([refer('json')]).code, ), + Method( + (b) => b + ..annotations.add(refer('override')) + ..returns = refer('Map') + ..type = MethodType.getter + ..name = 'varsToJson' + ..lambda = true + ..body = (refer('vars').property('toJson').call([])).code, + ), ], initializers: { 'operation': refer('Operation', 'package:gql_exec/gql_exec.dart').call( diff --git a/packages/ferry_generator/pubspec.yaml b/packages/ferry_generator/pubspec.yaml index 2572ae43..fe8519ea 100644 --- a/packages/ferry_generator/pubspec.yaml +++ b/packages/ferry_generator/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: code_builder: ^4.3.0 build: ^2.0.0 path: ^1.8.0 - ferry_exec: ^0.3.1 + ferry_exec: ^0.4.0 yaml: ^3.1.0 dart_style: ^2.3.2 glob: ^2.0.1 diff --git a/packages/ferry_test_graphql2/pubspec.yaml b/packages/ferry_test_graphql2/pubspec.yaml index a76d9f3f..2297e159 100644 --- a/packages/ferry_test_graphql2/pubspec.yaml +++ b/packages/ferry_test_graphql2/pubspec.yaml @@ -9,7 +9,7 @@ dependencies: gql: '>=0.14.0 <2.0.0' gql_exec: '>=0.4.0 <2.0.0' gql_link: '>=0.5.0 <2.0.0' - ferry_exec: ^0.3.1 + ferry_exec: ^0.4.0 built_value: ^8.0.4 built_collection: ^5.0.0 gql_code_builder: ^0.8.0 diff --git a/packages/ferry_test_graphql3/.gitignore b/packages/ferry_test_graphql3/.gitignore new file mode 100644 index 00000000..d01c064a --- /dev/null +++ b/packages/ferry_test_graphql3/.gitignore @@ -0,0 +1,9 @@ +# Dart +.dart_tool +.packages +pubspec.lock + +# Documentation +doc/api + +build/ \ No newline at end of file diff --git a/packages/ferry_test_graphql3/CHANGELOG.md b/packages/ferry_test_graphql3/CHANGELOG.md new file mode 100644 index 00000000..87e50531 --- /dev/null +++ b/packages/ferry_test_graphql3/CHANGELOG.md @@ -0,0 +1,222 @@ +## 0.2.4-dev.0 + + - **FEAT**(ferry_generator): add option to reuse data classes for fragments with a single inline fragment spread as selection (#530). + +## 0.2.3 + + - Graduate package to a stable release. See pre-releases prior to this version for changelog entries. + +## 0.2.3-dev.0 + + - **REFACTOR**: fix dependencies. + - **REFACTOR**(ferry_exec): remove cyclic dependency ferry_exec <-> ferry_test_graphql. + - **FEAT**: support stable 1.0.0 versions of depenencies gql, gql_exec, gql_link (#521). + - **FEAT**(ferry_generator): when/maybeWhen extensions (#470). + +## 0.2.2 + + - Bump "ferry_test_graphql2" to `0.2.2`. + +## 0.2.1-dev.4 + + - **REFACTOR**: fix dependencies. + - **REFACTOR**(ferry_exec): remove cyclic dependency ferry_exec <-> ferry_test_graphql. + - **FEAT**: support stable 1.0.0 versions of depenencies gql, gql_exec, gql_link (#521). + - **FEAT**(ferry_generator): when/maybeWhen extensions (#470). + +## 0.2.1-dev.3 + + - **REFACTOR**: fix dependencies. + - **REFACTOR**(ferry_exec): remove cyclic dependency ferry_exec <-> ferry_test_graphql. + - **FEAT**(ferry_generator): when/maybeWhen extensions (#470). + - **DOCS**(website): improve custom scalars documention (#517). + +## 0.2.1-dev.2 + + - **REFACTOR**(ferry_exec): remove cyclic dependency ferry_exec <-> ferry_test_graphql. + - **FEAT**(ferry_generator): when/maybeWhen extensions (#470). + +## 0.2.1-dev.1 + + - **REFACTOR**: fix dependencies. + - **REFACTOR**(ferry_exec): remove cyclic dependency ferry_exec <-> ferry_test_graphql. + - **FEAT**(ferry_generator): when/maybeWhen extensions (#470). + +## 0.2.1-dev.0+2 + + - **DOCS**: add basic documentation for field policy (#494). + +## 0.2.1+1 + + - Update a dependency to the latest release. + +## 0.2.1 + + - Graduate package to a stable release. See pre-releases prior to this version for changelog entries. + +## 0.2.1-dev.2 + + - **REFACTOR**: fix dependencies. + +## 0.2.1-dev.1 + + - **REFACTOR**: fix dependencies. + - **REFACTOR**: remove cyclic dependency ferry_exec <-> ferry_test_graphql. + +## 0.2.1-dev.1 + + - **REFACTOR**: remove cyclic dependency ferry_exec <-> ferry_test_graphql. + +## 0.2.1-dev.0 + + - **FEAT**: when/maybeWhen extensions (#470). + +## 0.2.0 + + - Graduate package to a stable release. See pre-releases prior to this version for changelog entries. + +## 0.2.0-dev.0 + +> Note: This release has breaking changes. + + - **BREAKING** **FIX**: properly generate nullable types for nullable elements in Lists (#445). + +## 0.1.5 + + - Graduate package to a stable release. See pre-releases prior to this version for changelog entries. + +## 0.1.5-dev.6 + + - Update a dependency to the latest release. + +## 0.1.5-dev.5 + +> Note: This release has breaking changes. + + - **FIX**: call cache handlers for every response from DataSource.Link. + - **FIX**: disable test. + - **FEAT**: add IsolateClient (#405). + - **FEAT**: generate possibleTypesMap in ferry_generator (#371). + - **FEAT**: add Reviews subscription to test graphql. + - **BREAKING** **CHORE**: update gql_code_builder, gql_exec and vestigial analyzer pubspec entry. + +## 0.1.5-dev.4 + + - Update a dependency to the latest release. + +## 0.1.5-dev.3 + +> Note: This release has breaking changes. + + - **BREAKING** **CHORE**: update gql_code_builder, gql_exec and vestigial analyzer pubspec entry. + +## 0.1.5-dev.2 + + - **TEST**: add back test. + - **FIX**: call cache handlers for every response from DataSource.Link. + - **CHORE**: publish packages. + - **CHORE**: publish packages. + +## 0.1.5-dev.1 + + - **FIX**: disable test. + - **FEAT**: add Reviews subscription to test graphql. + - **CHORE**: publish packages. + - **CHORE**: publish packages. + - **CHORE**: restructure repo (#269). + +## 0.1.4-dev.8 + + - **DOCS**: remove stale code (#271). + +## 0.1.4-dev.7 + + - **FIX**: add dispose method to TypedLinks (#272). + +## 0.1.4-dev.6 + + - **FIX**: add missing dependencies (#268). + +## 0.1.4-dev.5 + + - **FIX**: add missing dependencies (#267). + +## 0.1.4-dev.4 + + - **FIX**: add missing override annotations (#261). + +## 0.1.4-dev.3 + + - **FEAT**: add github action for validating formatting (#260). + +## 0.1.4-dev.2 + + - **FEAT**: add extensions to response (#259). + +## 0.1.4-dev.1 + +> Note: This release has breaking changes. + + - **BREAKING** **FEAT**: build generated files to __generated__ subdirectory. + +## 0.1.4-dev.0+1 + + - **FIX**: move pedantic to dependency (#257). + +## 0.1.4 + + - **FEAT**: update dependences. + - **FEAT**: update dependences. + - **CHORE**: publish packages. + - **CHORE**: publish packages. + +## 0.1.3 + + - **FEAT**: update dependences. + - **CHORE**: publish packages. + - **CHORE**: publish packages. + - **CHORE**: publish packages. + - **CHORE**: publish packages. + +## 0.1.2 + + - **FEAT**: migrate to null safety. + - **FEAT**: migrate to null safety. + - **CHORE**: publish packages. + - **CHORE**: publish packages. + +## 0.1.1 + + - Graduate package to a stable release. See pre-releases prior to this version for changelog entries. + +## 0.1.1-0.1.nullsafety.1 + + - **FIX**: update build_runner. + +## 0.1.1-0.1.nullsafety.0 + + - **FEAT**: migrate to null safety. + - **CHORE**: bump versions to match melos style. + - **CHORE**: prepare changelogs for melos. + +## [0.1.0-nullsafety.1] + +- allow fragment names to be nullable + +## [0.1.0-nullsafety.0] + +- add initial null safety support + +## [0.0.3] + +- update hero fragment + +## [0.0.2] + +- update dependencies + +## [0.0.1] - 2020-08-23 + +### Added + +- package added diff --git a/packages/ferry_test_graphql3/LICENSE b/packages/ferry_test_graphql3/LICENSE new file mode 100644 index 00000000..f0f701a1 --- /dev/null +++ b/packages/ferry_test_graphql3/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Sat Mandir Khalsa + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/ferry_test_graphql3/README.md b/packages/ferry_test_graphql3/README.md new file mode 100644 index 00000000..fb2b8236 --- /dev/null +++ b/packages/ferry_test_graphql3/README.md @@ -0,0 +1 @@ +Example GraphQL Operations, used in Ferry tests \ No newline at end of file diff --git a/packages/ferry_test_graphql3/analysis_options.yaml b/packages/ferry_test_graphql3/analysis_options.yaml new file mode 100644 index 00000000..108d1058 --- /dev/null +++ b/packages/ferry_test_graphql3/analysis_options.yaml @@ -0,0 +1 @@ +include: package:pedantic/analysis_options.yaml diff --git a/packages/ferry_test_graphql3/build.yaml b/packages/ferry_test_graphql3/build.yaml new file mode 100644 index 00000000..13715e4d --- /dev/null +++ b/packages/ferry_test_graphql3/build.yaml @@ -0,0 +1,15 @@ +targets: + $default: + builders: + ferry_generator|graphql_builder: + enabled: true + options: + schema: ferry_test_graphql2|lib/schema/schema.graphql + + + ferry_generator|serializer_builder: + enabled: true + options: + schema: ferry_test_graphql2|lib/schema/schema.graphql + + diff --git a/packages/ferry_test_graphql3/lib/main.dart b/packages/ferry_test_graphql3/lib/main.dart new file mode 100644 index 00000000..977f47ce --- /dev/null +++ b/packages/ferry_test_graphql3/lib/main.dart @@ -0,0 +1,64 @@ + + +import 'dart:convert'; + +import 'package:ferry/ferry.dart'; +import 'package:ferry_cache/ferry_cache.dart'; +import 'package:ferry_test_graphql2/queries/__generated__/reviews.data.gql.dart'; +import 'package:ferry_test_graphql2/queries/__generated__/reviews.req.gql.dart'; +import 'package:ferry_test_graphql2/schema/__generated__/schema.schema.gql.dart'; +import 'package:gql_exec/gql_exec.dart'; + + +void main() async { + + + const responseJson = """ + { + "getExploreVideos": [ + { + "__typename": "PositionVideoViewType", + "id": "2", + "thumbnail": "https://img.youtube.com/vi/2/mqdefault.jpg", + "video": "https://www.youtube.com/watch?v=2", + "likeCount": 2, + "company": { + "__typename": "Company", + "id": "2", + "name": "Company 2" + }, + "position": { + "__typename": "Position", + "id": "1", + "title": "Position 1" + } + } + ] + } + """; + final client = Client( + link: Link.function((request, [forward]) => Stream.value(Response( + data: json.decode(responseJson), + response: json.decode(responseJson)))), + cache: Cache( + possibleTypes: possibleTypesMap + ), + ); + + final res = await client.request(GGetExploreVideosReq()).first; + + + + print(res.graphqlErrors); + print(res.linkException); + print(res.data?.toJson()); + + final scnd = res.data!.getExploreVideos![0]; + + print(scnd.G__typename); + print(scnd.runtimeType); + + print(scnd.toJson()); + + +} \ No newline at end of file diff --git a/packages/ferry_test_graphql3/lib/queries/fragments.graphql b/packages/ferry_test_graphql3/lib/queries/fragments.graphql new file mode 100644 index 00000000..e03c6a63 --- /dev/null +++ b/packages/ferry_test_graphql3/lib/queries/fragments.graphql @@ -0,0 +1,22 @@ + +fragment VideoViewFields on VideoInterface { + id + thumbnail + video + likeCount + company { + id + name + username + } +} + + +fragment VideoViewFragment on VideoInterface { + ...VideoViewFields + ... on PositionVideoViewType { + position { + title + } + } +} \ No newline at end of file diff --git a/packages/ferry_test_graphql3/lib/queries/reviews.graphql b/packages/ferry_test_graphql3/lib/queries/reviews.graphql new file mode 100644 index 00000000..1025c1c0 --- /dev/null +++ b/packages/ferry_test_graphql3/lib/queries/reviews.graphql @@ -0,0 +1,7 @@ +# import "./fragments.graphql" + +query GetExploreVideos { + getExploreVideos{ + ...VideoViewFragment + } +} \ No newline at end of file diff --git a/packages/ferry_test_graphql3/lib/schema/schema.graphql b/packages/ferry_test_graphql3/lib/schema/schema.graphql new file mode 100644 index 00000000..aa5d19b7 --- /dev/null +++ b/packages/ferry_test_graphql3/lib/schema/schema.graphql @@ -0,0 +1,44 @@ +schema { + query: Query +} + +interface VideoInterface { + id: ID! + thumbnail: String! + video: String! + likeCount: Int! + company: CompanyType! +} + +type CompanyType { + id: String + name: String + username: String + other: String +} + +type PositionType { + id: ID! + title: String + startDate: String + duration: Int +} + + +type PositionVideoViewType implements VideoInterface { + id: ID! + thumbnail: String! + video: String! + likeCount: Int! + company: CompanyType! + position: PositionType! +} + + +type Query { + getExploreVideos: [VideoInterface!]! +} + +enum A{ + a,b +} \ No newline at end of file diff --git a/packages/ferry_test_graphql3/pubspec.yaml b/packages/ferry_test_graphql3/pubspec.yaml new file mode 100644 index 00000000..b6909ea6 --- /dev/null +++ b/packages/ferry_test_graphql3/pubspec.yaml @@ -0,0 +1,33 @@ +name: ferry_test_graphql2 +version: 0.2.4-dev.0 +description: Example GraphQL Operations, used in Ferry tests +repository: https://github.com/gql-dart/ferry +environment: + sdk: '>=3.0.0 <4.0.0' +dependencies: + async: ^2.0.0 + gql: '>=0.14.0 <2.0.0' + gql_exec: '>=0.4.0 <2.0.0' + gql_link: '>=0.5.0 <2.0.0' + ferry_exec: ^0.3.1 + built_value: ^8.0.4 + built_collection: ^5.0.0 + gql_code_builder: + git: + url: https://github.com/fersonality/flutter_gql.git + path: codegen/gql_code_builder + ferry: + ferry_cache: +dev_dependencies: + test: ^1.16.8 + build_runner: ^2.0.2 + pedantic: ^1.11.0 + built_value_generator: ^8.1.1 + dart_style: ^2.3.2 + ferry_generator: + +dependency_overrides: + gql_code_builder: + git: + url: https://github.com/fersonality/flutter_gql.git + path: codegen/gql_code_builder