File tree 8 files changed +21
-23
lines changed
grpc-example/services/movies
8 files changed +21
-23
lines changed Original file line number Diff line number Diff line change @@ -30,4 +30,3 @@ newrelic_agent.log
30
30
! .yarn /versions
31
31
.mise.toml
32
32
docker /supergraph.graphql
33
-
Original file line number Diff line number Diff line change 1
1
import { dirname , join } from 'path' ;
2
+ import { fileURLToPath } from 'url' ;
2
3
import { Opts } from '@e2e/opts' ;
3
4
import {
4
5
loadPackageDefinition ,
7
8
type ServiceClientConstructor ,
8
9
} from '@grpc/grpc-js' ;
9
10
import { load } from '@grpc/proto-loader' ;
10
- import { fileURLToPath } from 'url' ;
11
11
12
12
const opts = Opts ( process . argv ) ;
13
13
@@ -53,7 +53,7 @@ const Movies = [
53
53
] ;
54
54
55
55
async function startServer ( subscriptionInterval = 1000 , debug = false ) : Promise < Server > {
56
- const logger = debug ? ( ...args ) => console . log ( ...args ) : ( ) => { } ;
56
+ const logger = debug ? ( ...args ) => console . log ( ...args ) : ( ) => { } ;
57
57
const server = new Server ( ) ;
58
58
59
59
const packageDefinition = await load ( './service.proto' , {
Original file line number Diff line number Diff line change 1
1
import { GraphQLObjectType , GraphQLSchema , GraphQLString } from 'graphql' ;
2
- import { defineConfig as defineComposeConfig } from '@graphql-mesh/compose-cli' ;
3
2
import { defineConfig as defineGatewayConfig } from '@graphql-hive/gateway' ;
3
+ import { defineConfig as defineComposeConfig } from '@graphql-mesh/compose-cli' ;
4
4
5
5
// top level await
6
6
await Promise . resolve ( ) ;
Original file line number Diff line number Diff line change @@ -91,9 +91,8 @@ export const GrpcCredentialsSsl = new GraphQLInputObjectType({
91
91
privateKey : {
92
92
type : GraphQLString ,
93
93
} ,
94
- }
95
- } )
96
-
94
+ } ,
95
+ } ) ;
97
96
98
97
export const TransportOptions = new GraphQLInputObjectType ( {
99
98
name : 'TransportOptions' ,
@@ -109,9 +108,9 @@ export const TransportOptions = new GraphQLInputObjectType({
109
108
} ,
110
109
metaData : {
111
110
type : ObjMapScalar ,
112
- }
113
- }
114
- } )
111
+ } ,
112
+ } ,
113
+ } ) ;
115
114
116
115
export const transportDirective = new GraphQLDirective ( {
117
116
name : 'transport' ,
@@ -127,8 +126,8 @@ export const transportDirective = new GraphQLDirective({
127
126
} ,
128
127
options : {
129
128
type : TransportOptions ,
130
- }
129
+ } ,
131
130
} ,
132
131
isRepeatable : true ,
133
132
locations : [ DirectiveLocation . SCHEMA ] ,
134
- } )
133
+ } ) ;
Original file line number Diff line number Diff line change @@ -29,4 +29,3 @@ export function getGraphQLScalarForGrpc(scalarType: string): string {
29
29
}
30
30
return SCALARS . get ( scalarType ) ;
31
31
}
32
-
Original file line number Diff line number Diff line change 1
- import { existsSync } from "fs" ;
2
- import type { SchemaComposer } from "graphql-compose" ;
3
- import { isAbsolute , join } from "path" ;
4
- import type { INamespace , Root } from "protobufjs" ;
5
- import { getGraphQLScalarForGrpc , isGrpcScalar } from "./scalars.js" ;
1
+ import type { SchemaComposer } from 'graphql-compose' ;
6
2
import lodashHas from 'lodash.has' ;
3
+ import type { INamespace , Root } from 'protobufjs' ;
4
+ import { fs , path as pathModule } from '@graphql-mesh/cross-helpers' ;
5
+ import { getGraphQLScalarForGrpc , isGrpcScalar } from './scalars.js' ;
7
6
8
7
export function addIncludePathResolver ( root : Root , includePaths : string [ ] ) : void {
9
8
const originalResolvePath = root . resolvePath ;
10
9
root . resolvePath = ( origin : string , target : string ) => {
11
- if ( isAbsolute ( target ) ) {
10
+ if ( pathModule . isAbsolute ( target ) ) {
12
11
return target ;
13
12
}
14
13
for ( const directory of includePaths ) {
15
- const fullPath : string = join ( directory , target ) ;
16
- if ( existsSync ( fullPath ) ) {
14
+ const fullPath : string = pathModule . join ( directory , target ) ;
15
+ if ( fs . existsSync ( fullPath ) ) {
17
16
return fullPath ;
18
17
}
19
18
}
Original file line number Diff line number Diff line change @@ -27,7 +27,9 @@ describe.each<[string, string]>([
27
27
28
28
describe ( 'Invalid Scalars' , ( ) => {
29
29
test ( 'getGraphQLScalar should throw an error' , ( ) => {
30
- expect ( ( ) => getGraphQLScalarForGrpc ( 'randomType' ) ) . toThrow ( / C o u l d n o t f i n d G r a p h Q L S c a l a r f o r t y p e / ) ;
30
+ expect ( ( ) => getGraphQLScalarForGrpc ( 'randomType' ) ) . toThrow (
31
+ / C o u l d n o t f i n d G r a p h Q L S c a l a r f o r t y p e / ,
32
+ ) ;
31
33
} ) ;
32
34
test ( 'isScalarType should return false for none scalars' , ( ) => {
33
35
expect ( isGrpcScalar ( 'randomType' ) ) . toBe ( false ) ;
Original file line number Diff line number Diff line change
1
+ import type { GraphQLScalarType } from 'graphql' ;
1
2
import lodashGet from 'lodash.get' ;
2
3
import type { ResolverData } from '@graphql-mesh/string-interpolation' ;
3
4
import { stringInterpolator } from '@graphql-mesh/string-interpolation' ;
@@ -9,7 +10,6 @@ import type {
9
10
MetadataValue ,
10
11
} from '@grpc/grpc-js' ;
11
12
import { Metadata } from '@grpc/grpc-js' ;
12
- import type { GraphQLScalarType } from 'graphql' ;
13
13
14
14
function isBlob ( input : any ) : input is Blob {
15
15
return input != null && input . stream instanceof Function ;
You can’t perform that action at this time.
0 commit comments