1- import { isSchema , Kind , visit , type ExecutionResult , type GraphQLSchema } from 'graphql' ;
2- import type { HiveClient , HivePluginOptions } from '@graphql-hive/core' ;
3- import { createHive } from '@graphql-hive/yoga' ;
1+ import { Kind , visit , type ExecutionResult , type GraphQLSchema } from 'graphql' ;
2+ import { createHive , type HiveClient , type HivePluginOptions } from '@graphql-hive/core' ;
43import { process } from '@graphql-mesh/cross-helpers' ;
54import { stringInterpolator } from '@graphql-mesh/string-interpolation' ;
65import type { MeshTransform , MeshTransformOptions , YamlConfig } from '@graphql-mesh/types' ;
@@ -16,7 +15,7 @@ export default class HiveTransform implements MeshTransform {
1615 private hiveClient : HiveClient ;
1716 private logger : MeshTransformOptions < YamlConfig . HivePlugin > [ 'logger' ] ;
1817 private schema : GraphQLSchema ;
19- constructor ( { config, pubsub , logger } : MeshTransformOptions < YamlConfig . HivePlugin > ) {
18+ constructor ( { config, logger } : MeshTransformOptions < YamlConfig . HivePlugin > ) {
2019 this . logger = logger ;
2120 const enabled =
2221 // eslint-disable-next-line no-new-func
@@ -77,26 +76,8 @@ export default class HiveTransform implements MeshTransform {
7776 agent,
7877 usage,
7978 reporting,
80- autoDispose : false ,
8179 selfHosting : config . selfHosting ,
8280 } ) ;
83- const id = pubsub . subscribe ( 'destroy' , ( ) => {
84- try {
85- mapMaybePromise (
86- this . hiveClient . dispose ( ) ,
87- ( ) => {
88- pubsub . unsubscribe ( id ) ;
89- } ,
90- e => {
91- logger . error ( `Hive client failed to dispose` , e ) ;
92- pubsub . unsubscribe ( id ) ;
93- } ,
94- ) ;
95- } catch ( e ) {
96- logger . error ( `Failed to dispose hive client` , e ) ;
97- pubsub . unsubscribe ( id ) ;
98- }
99- } ) ;
10081 }
10182
10283 transformSchema ( schema : GraphQLSchema ) {
0 commit comments