File tree Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -2,4 +2,8 @@ schema: test_gql/schema.graphql
22documents : ' ./test_gql/**/*.graphql'
33generates :
44 output.dart :
5- - ./build/src/index.js
5+ config :
6+ artemisImportPath : package:your_project/your_artemis_generated/graphql_api.dart
7+ isNonNullSafety : true
8+ plugins :
9+ - ./build/src/index.js
Original file line number Diff line number Diff line change @@ -4,5 +4,6 @@ export type FlutterArtemisHooksPluginConfig = RawClientSideBasePluginConfig &
44 Config ;
55
66export type Config = {
7- isNonNullSafety ?: string ;
7+ artemisImportPath : string ;
8+ isNonNullSafety ?: boolean ;
89} ;
Original file line number Diff line number Diff line change @@ -15,19 +15,15 @@ export const plugin: PluginFunction<
1515> = (
1616 _schema : GraphQLSchema ,
1717 documents : Types . DocumentFile [ ] ,
18- _config : FlutterArtemisHooksPluginConfig
18+ config : FlutterArtemisHooksPluginConfig
1919) => {
20- console . log ( 'hige' ) ;
2120 const allAst = concatAST ( documents . map ( ( v ) => v . document ) ) ;
22-
23- console . log ( allAst . definitions . map ( ( d ) => d . kind ) ) ;
21+ const isNullSafety = ! config . isNonNullSafety ;
2422
2523 const allQueryies : OperationDefinitionNode [ ] = allAst . definitions . filter (
2624 ( d ) => d . kind === Kind . OPERATION_DEFINITION
2725 ) as OperationDefinitionNode [ ] ;
2826
29- console . log ( allQueryies ) ;
30-
3127 const queryBuilder = (
3228 queryName : string ,
3329 operationType : OperationTypeNode ,
@@ -59,20 +55,16 @@ ${queryName}$${operationStr}ReturnType use${queryName}Query<DataType>(BuildConte
5955}` ;
6056 } ;
6157
62- console . log ( allQueryies ) ;
63-
6458 return {
6559 content :
66- packagesImportStr (
67- 'package:pocket_musubi_native/service/graphql_client_service/generated/graphql_api.dart'
68- ) +
69- useQueryString ( true ) +
60+ packagesImportStr ( config . artemisImportPath ) +
61+ useQueryString ( isNullSafety ) +
7062 allQueryies . map ( ( q ) =>
7163 queryBuilder (
7264 q . name . value ,
7365 q . operation ,
7466 q . variableDefinitions ?. length > 0 ,
75- true
67+ isNullSafety
7668 )
7769 ) . join ( `
7870
You can’t perform that action at this time.
0 commit comments