1
- import {
2
- Subscription ,
3
- Chain ,
4
- DeployCodeToCloudEnv ,
5
- DeployCodeToCloudURIKind ,
6
- GraphQLTypes ,
7
- ValueTypes ,
8
- } from '@/zeus/index.js' ;
1
+ import { Subscription , Chain , GraphQLTypes , ValueTypes } from '@/zeus/index.js' ;
9
2
import { Config } from '@/Configuration/index.js' ;
10
3
import fetch from 'node-fetch' ;
11
4
import { COMMON_FILES } from '@/gshared/constants/index.js' ;
@@ -22,8 +15,8 @@ const jolt = () => {
22
15
const token = Config . getTokenOptions ( 'token' ) ;
23
16
const headers : Record < string , string > = token
24
17
? {
25
- Authorization : `Bearer ${ token } ` ,
26
- }
18
+ Authorization : `Bearer ${ token } ` ,
19
+ }
27
20
: { } ;
28
21
return Chain ( 'https://api.staging.project.graphqleditor.com/graphql' , {
29
22
headers,
@@ -34,8 +27,8 @@ const joltSubscription = () => {
34
27
const token = Config . getTokenOptions ( 'token' ) ;
35
28
const headers : Record < string , string > = token
36
29
? {
37
- Authorization : `Bearer ${ token } ` ,
38
- }
30
+ Authorization : `Bearer ${ token } ` ,
31
+ }
39
32
: { } ;
40
33
return Subscription ( 'https://api.staging.project.graphqleditor.com/graphql' , {
41
34
headers,
@@ -184,9 +177,14 @@ export class Editor {
184
177
? ( await fetch ( libraryURL . getUrl ! ) ) . text ( )
185
178
: new Promise < string > ( ( resolve ) => resolve ( '' ) ) ,
186
179
] ) ;
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
180
+ const sdlMerge = mergeSDLs ( graphqlFile , libraryFile ) ;
181
+ if ( sdlMerge . __typename === 'error' )
182
+ throw new Error (
183
+ sdlMerge . errors
184
+ . map ( ( e ) => `Conflict on: ${ e . conflictingNode } .${ e . conflictingField } ` )
185
+ . join ( '\n' ) ,
186
+ ) ;
187
+ return sdlMerge . sdl ;
190
188
} ;
191
189
192
190
public static getSchema = async ( resolve : {
@@ -328,12 +326,6 @@ export class Editor {
328
326
} ) ,
329
327
) ;
330
328
} ;
331
- public static deployProjectToCloud = async ( projectId : string ) => {
332
- const response = await jolt ( ) ( 'mutation' ) ( {
333
- createCloudDeployment : [ { id : projectId } , true ] ,
334
- } ) ;
335
- return response . createCloudDeployment ;
336
- } ;
337
329
public static getServerLessMongo = async ( projectId : string ) => {
338
330
const checking = ora (
339
331
'Checking if remote mongo serverless configuration exists' ,
@@ -351,31 +343,6 @@ export class Editor {
351
343
else checking . fail ( ) ;
352
344
return result ;
353
345
} ;
354
- public static deployRepoToSharedWorker = async (
355
- projectId : string ,
356
- zipURI : string ,
357
- opts : Pick < ValueTypes [ 'DeployCodeToCloudInput' ] , 'node14Opts' | 'secrets' > ,
358
- ) => {
359
- const response = await jolt ( ) ( 'mutation' ) ( {
360
- deployCodeToCloud : [
361
- {
362
- id : projectId ,
363
- opts : {
364
- codeURI : zipURI ,
365
- env : DeployCodeToCloudEnv . NODE14 ,
366
- kind : DeployCodeToCloudURIKind . ZIP ,
367
- ...opts ,
368
- } ,
369
- } ,
370
- true ,
371
- ] ,
372
- } ) ;
373
- const deploymentId = response . deployCodeToCloud ;
374
- if ( ! deploymentId ) {
375
- throw new Error ( 'Cannot deploy project' ) ;
376
- }
377
- return deploymentId ;
378
- } ;
379
346
public static publishIntegration = async (
380
347
projectId : string ,
381
348
integration : ValueTypes [ 'AddProjectInput' ] ,
@@ -395,12 +362,6 @@ export class Editor {
395
362
} ) ;
396
363
return response . marketplace ?. removeProject ;
397
364
} ;
398
- public static showDeploymentLogs = async ( streamID : string ) => {
399
- const response = await joltSubscription ( ) ( 'subscription' ) ( {
400
- watchLogs : [ { streamID } , true ] ,
401
- } ) ;
402
- return response ;
403
- } ;
404
365
public static getDeviceCode = async ( ) => {
405
366
const response = await fetch (
406
367
'https://auth.graphqleditor.com/oauth/device/code' ,
0 commit comments