Skip to content

Commit b7e388e

Browse files
committed
chore: updated zeus and cleanup unnecessary resolvers
1 parent b7f8f12 commit b7e388e

File tree

6 files changed

+2474
-2602
lines changed

6 files changed

+2474
-2602
lines changed

packages/cli/src/Editor.ts

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
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';
92
import { Config } from '@/Configuration/index.js';
103
import fetch from 'node-fetch';
114
import { COMMON_FILES } from '@/gshared/constants/index.js';
@@ -22,8 +15,8 @@ const jolt = () => {
2215
const token = Config.getTokenOptions('token');
2316
const headers: Record<string, string> = token
2417
? {
25-
Authorization: `Bearer ${token}`,
26-
}
18+
Authorization: `Bearer ${token}`,
19+
}
2720
: {};
2821
return Chain('https://api.staging.project.graphqleditor.com/graphql', {
2922
headers,
@@ -34,8 +27,8 @@ const joltSubscription = () => {
3427
const token = Config.getTokenOptions('token');
3528
const headers: Record<string, string> = token
3629
? {
37-
Authorization: `Bearer ${token}`,
38-
}
30+
Authorization: `Bearer ${token}`,
31+
}
3932
: {};
4033
return Subscription('https://api.staging.project.graphqleditor.com/graphql', {
4134
headers,
@@ -184,9 +177,14 @@ export class Editor {
184177
? (await fetch(libraryURL.getUrl!)).text()
185178
: new Promise<string>((resolve) => resolve('')),
186179
]);
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;
190188
};
191189

192190
public static getSchema = async (resolve: {
@@ -328,12 +326,6 @@ export class Editor {
328326
}),
329327
);
330328
};
331-
public static deployProjectToCloud = async (projectId: string) => {
332-
const response = await jolt()('mutation')({
333-
createCloudDeployment: [{ id: projectId }, true],
334-
});
335-
return response.createCloudDeployment;
336-
};
337329
public static getServerLessMongo = async (projectId: string) => {
338330
const checking = ora(
339331
'Checking if remote mongo serverless configuration exists',
@@ -351,31 +343,6 @@ export class Editor {
351343
else checking.fail();
352344
return result;
353345
};
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-
};
379346
public static publishIntegration = async (
380347
projectId: string,
381348
integration: ValueTypes['AddProjectInput'],
@@ -395,12 +362,6 @@ export class Editor {
395362
});
396363
return response.marketplace?.removeProject;
397364
};
398-
public static showDeploymentLogs = async (streamID: string) => {
399-
const response = await joltSubscription()('subscription')({
400-
watchLogs: [{ streamID }, true],
401-
});
402-
return response;
403-
};
404365
public static getDeviceCode = async () => {
405366
const response = await fetch(
406367
'https://auth.graphqleditor.com/oauth/device/code',
Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { Auth } from '@/Auth/index.js';
2-
import { CommandDeploy } from '@/commands/cloud/deploy.js';
3-
import { CommandDeployRemote } from '@/commands/cloud/deployFromRemote.js';
42
import { CommandInstall } from '@/commands/cloud/install.js';
53
import { CommandPull } from '@/commands/cloud/pull.js';
64
import { CommandPush } from '@/commands/cloud/push.js';
@@ -66,90 +64,6 @@ export default {
6664
argv as Pick<ConfigurationOptions, 'project' | 'namespace'>,
6765
);
6866
},
69-
)
70-
.command(
71-
'deploy:zip',
72-
'Deploy GraphQL backend to GraphQL Editor shared worker from remote zip',
73-
async (yargs) => {
74-
yargs.options({
75-
...confOptions({
76-
namespace: projectOptions.namespace,
77-
project: projectOptions.project,
78-
backendZip: {
79-
type: 'string',
80-
describe:
81-
'Paste your repo zip url, for github it will be https://github.com/account_name/repository/archive/refs/heads/main.zip',
82-
},
83-
}),
84-
env: {
85-
alias: 'e',
86-
array: true,
87-
coerce: (v: Array<string>) => {
88-
return v
89-
.map((e: string) => e.split('='))
90-
.map(([name, ...value]) => ({
91-
name,
92-
value: value.join('='),
93-
}));
94-
},
95-
describe:
96-
'Set environment variables for example "-e URL=$URL" or "-e URL=example.com"',
97-
},
98-
});
99-
},
100-
async (argv) => {
101-
await Auth.login().then(Config.setTokenOptions);
102-
await CommandDeployRemote(
103-
argv as Pick<
104-
ConfigurationOptions,
105-
'project' | 'namespace' | 'backendZip'
106-
> & {
107-
env?: ValueTypes['Secret'][];
108-
},
109-
);
110-
},
111-
)
112-
.command(
113-
'deploy',
114-
'Deploy GraphQL backend to GraphQL Editor shared worker from current repository',
115-
async (yargs) => {
116-
yargs.options({
117-
...confOptions({
118-
namespace: projectOptions.namespace,
119-
project: projectOptions.project,
120-
buildScript: {
121-
type: 'string',
122-
describe: 'Build script as in your package.json',
123-
default: 'build',
124-
},
125-
}),
126-
env: {
127-
alias: 'e',
128-
array: true,
129-
coerce: (v: Array<string>) => {
130-
return v
131-
.map((e: string) => e.split('='))
132-
.map(([name, ...value]) => ({
133-
name,
134-
value: value.join('='),
135-
}));
136-
},
137-
describe:
138-
'Set environment variables for example "-e URL=$URL" or "-e URL=example.com"',
139-
},
140-
});
141-
},
142-
async (argv) => {
143-
await Auth.login().then(Config.setTokenOptions);
144-
await CommandDeploy(
145-
argv as Pick<
146-
ConfigurationOptions,
147-
'project' | 'namespace' | 'backendZip' | 'buildScript'
148-
> & {
149-
env?: ValueTypes['Secret'][];
150-
},
151-
);
152-
},
15367
);
15468
},
15569
} as CommandModule;

packages/cli/src/commands/cloud/deploy.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.

packages/cli/src/commands/cloud/deployFromRemote.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)