@@ -10,6 +10,7 @@ import { Config } from '@/Configuration/index.js';
10
10
import fetch from 'node-fetch' ;
11
11
import { COMMON_FILES } from '@/gshared/constants/index.js' ;
12
12
import ora from 'ora' ;
13
+ import { mergeSDLs } from 'graphql-js-tree' ;
13
14
14
15
export interface FileArray {
15
16
name : string ;
@@ -21,8 +22,8 @@ const jolt = () => {
21
22
const token = Config . getTokenOptions ( 'token' ) ;
22
23
const headers : Record < string , string > = token
23
24
? {
24
- Authorization : `Bearer ${ token } ` ,
25
- }
25
+ Authorization : `Bearer ${ token } ` ,
26
+ }
26
27
: { } ;
27
28
return Chain ( 'https://api.staging.project.graphqleditor.com/graphql' , {
28
29
headers,
@@ -33,8 +34,8 @@ const joltSubscription = () => {
33
34
const token = Config . getTokenOptions ( 'token' ) ;
34
35
const headers : Record < string , string > = token
35
36
? {
36
- Authorization : `Bearer ${ token } ` ,
37
- }
37
+ Authorization : `Bearer ${ token } ` ,
38
+ }
38
39
: { } ;
39
40
return Subscription ( 'https://api.staging.project.graphqleditor.com/graphql' , {
40
41
headers,
@@ -183,7 +184,9 @@ export class Editor {
183
184
? ( await fetch ( libraryURL . getUrl ! ) ) . text ( )
184
185
: new Promise < string > ( ( resolve ) => resolve ( '' ) ) ,
185
186
] ) ;
186
- return [ libraryFile , graphqlFile ] . join ( '\n\n' ) ;
187
+ const sdlMerge = mergeSDLs ( graphqlFile , libraryFile )
188
+ if ( sdlMerge . __typename === 'error' ) throw new Error ( sdlMerge . errors . map ( e => `Conflict on: ${ e . conflictingNode } .${ e . conflictingField } ` ) . join ( "\n" ) )
189
+ return sdlMerge . sdl
187
190
} ;
188
191
189
192
public static getSchema = async ( resolve : {
0 commit comments