-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathresolver.ts
More file actions
117 lines (113 loc) · 2.36 KB
/
resolver.ts
File metadata and controls
117 lines (113 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import {
login,
loginWithGoogle,
me,
signup,
updateUser,
users,
} from "./resolver_user";
import {
createRepo,
deletePod,
deleteRepo,
deleteCollaborator,
myRepos,
myCollabRepos,
getVisibility,
updateVisibility,
addCollaborator,
pod,
repo,
repos,
updatePod,
updateRepo,
} from "./resolver_repo";
import { listAllRuntimes } from "./resolver_runtime";
// chooes between docker and k8s spawners
import {
spawnRuntime as spawnRuntime_docker,
killRuntime as killRuntime_docker,
infoRuntime as infoRuntime_docker,
loopKillInactiveRoutes as loopKillInactiveRoutes_docker,
initRoutes as initRoutes_docker,
} from "./spawner-docker";
import {
spawnRuntime as spawnRuntime_k8s,
killRuntime as killRuntime_k8s,
infoRuntime as infoRuntime_k8s,
loopKillInactiveRoutes as loopKillInactiveRoutes_k8s,
initRoutes as initRoutes_k8s,
} from "./spawner-k8s";
import {
deleteGitHubAccessToken,
getGitHubAccessToken,
getMyGitHubRepos,
githubExport,
linkedGitHubRepo,
linkGitHubRepo,
setGitHubAccessToken,
unlinkGitHubRepo,
} from "./resolver_git";
export const resolvers = {
Query: {
hello: () => {
return "Hello world!";
},
users,
me,
repos,
myRepos,
repo,
pod,
listAllRuntimes,
getVisibility,
myCollabRepos,
...(process.env.RUNTIME_SPAWNER === "k8s"
? {
infoRuntime: infoRuntime_k8s,
}
: {
infoRuntime: infoRuntime_docker,
}),
// TODO this query is redundant, could just use /get/user
getGitHubAccessToken,
linkedGitHubRepo,
getMyGitHubRepos,
},
Mutation: {
signup,
updateUser,
login,
loginWithGoogle,
createRepo,
updateRepo,
deleteRepo,
clearUser: () => {},
updatePod,
deletePod,
addCollaborator,
updateVisibility,
deleteCollaborator,
...(process.env.RUNTIME_SPAWNER === "k8s"
? {
spawnRuntime: spawnRuntime_k8s,
killRuntime: killRuntime_k8s,
}
: {
spawnRuntime: spawnRuntime_docker,
killRuntime: killRuntime_docker,
}),
githubExport,
setGitHubAccessToken,
deleteGitHubAccessToken,
linkGitHubRepo,
unlinkGitHubRepo,
},
};
if (process.env.RUNTIME_SPAWNER !== "k8s") {
initRoutes_docker();
loopKillInactiveRoutes_docker();
} else {
initRoutes_k8s();
loopKillInactiveRoutes_k8s();
}