@gitpod/gitpod-protocol 0.1.5-vn-integrate-gitpod-yml-tasks-into-jetbrainsa.5 → 0.1.5-vn-6525.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/data/gitpod-schema.json +28 -2
  2. package/lib/accounting-protocol.d.ts +10 -10
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +22 -31
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +4 -2
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js.map +1 -1
  9. package/lib/analytics.d.ts +4 -5
  10. package/lib/analytics.d.ts.map +1 -1
  11. package/lib/analytics.js.map +1 -1
  12. package/lib/auth.d.ts.map +1 -1
  13. package/lib/context-url.d.ts.map +1 -1
  14. package/lib/context-url.js +3 -3
  15. package/lib/context-url.js.map +1 -1
  16. package/lib/context-url.spec.d.ts.map +1 -1
  17. package/lib/context-url.spec.js +20 -5
  18. package/lib/context-url.spec.js.map +1 -1
  19. package/lib/email-protocol.d.ts +1 -1
  20. package/lib/email-protocol.d.ts.map +1 -1
  21. package/lib/email-protocol.js.map +1 -1
  22. package/lib/encryption/container-module.d.ts.map +1 -1
  23. package/lib/encryption/container-module.js +1 -1
  24. package/lib/encryption/container-module.js.map +1 -1
  25. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  26. package/lib/encryption/encryption-engine.js +7 -7
  27. package/lib/encryption/encryption-engine.js.map +1 -1
  28. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  29. package/lib/encryption/encryption-engine.spec.js +2 -3
  30. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  31. package/lib/encryption/encryption-service.d.ts.map +1 -1
  32. package/lib/encryption/encryption-service.js +1 -1
  33. package/lib/encryption/encryption-service.js.map +1 -1
  34. package/lib/encryption/key-provider.d.ts.map +1 -1
  35. package/lib/encryption/key-provider.js +7 -9
  36. package/lib/encryption/key-provider.js.map +1 -1
  37. package/lib/env.d.ts +1 -1
  38. package/lib/env.d.ts.map +1 -1
  39. package/lib/env.js +5 -5
  40. package/lib/env.js.map +1 -1
  41. package/lib/gitpod-file-parser.d.ts.map +1 -1
  42. package/lib/gitpod-file-parser.js +6 -6
  43. package/lib/gitpod-file-parser.js.map +1 -1
  44. package/lib/gitpod-file-parser.spec.js +42 -39
  45. package/lib/gitpod-file-parser.spec.js.map +1 -1
  46. package/lib/gitpod-service.d.ts +23 -26
  47. package/lib/gitpod-service.d.ts.map +1 -1
  48. package/lib/gitpod-service.js +32 -26
  49. package/lib/gitpod-service.js.map +1 -1
  50. package/lib/headless-workspace-log.d.ts +1 -0
  51. package/lib/headless-workspace-log.d.ts.map +1 -1
  52. package/lib/headless-workspace-log.js +2 -1
  53. package/lib/headless-workspace-log.js.map +1 -1
  54. package/lib/ide-frontend-service.d.ts +1 -1
  55. package/lib/ide-protocol.d.ts +6 -6
  56. package/lib/ide-protocol.d.ts.map +1 -1
  57. package/lib/index.d.ts +16 -16
  58. package/lib/installation-admin-protocol.d.ts +1 -1
  59. package/lib/installation-admin-protocol.d.ts.map +1 -1
  60. package/lib/installation-admin-protocol.js +2 -2
  61. package/lib/installation-admin-protocol.js.map +1 -1
  62. package/lib/license-protocol.d.ts.map +1 -1
  63. package/lib/license-protocol.js.map +1 -1
  64. package/lib/messaging/browser/connection.d.ts +1 -1
  65. package/lib/messaging/browser/connection.d.ts.map +1 -1
  66. package/lib/messaging/browser/connection.js +19 -19
  67. package/lib/messaging/browser/connection.js.map +1 -1
  68. package/lib/messaging/browser/window-connection.d.ts +4 -4
  69. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  70. package/lib/messaging/browser/window-connection.js +9 -6
  71. package/lib/messaging/browser/window-connection.js.map +1 -1
  72. package/lib/messaging/client-call-metrics.d.ts +2 -2
  73. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  74. package/lib/messaging/client-call-metrics.js +20 -20
  75. package/lib/messaging/client-call-metrics.js.map +1 -1
  76. package/lib/messaging/error.d.ts.map +1 -1
  77. package/lib/messaging/error.js.map +1 -1
  78. package/lib/messaging/handler.d.ts.map +1 -1
  79. package/lib/messaging/handler.js +1 -1
  80. package/lib/messaging/node/connection.js +8 -8
  81. package/lib/messaging/node/connection.js.map +1 -1
  82. package/lib/messaging/proxy-factory.d.ts +1 -1
  83. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  84. package/lib/messaging/proxy-factory.js +7 -9
  85. package/lib/messaging/proxy-factory.js.map +1 -1
  86. package/lib/payment-protocol.d.ts.map +1 -1
  87. package/lib/payment-protocol.js +1 -1
  88. package/lib/payment-protocol.js.map +1 -1
  89. package/lib/permission.d.ts +2 -2
  90. package/lib/permission.d.ts.map +1 -1
  91. package/lib/permission.js +12 -23
  92. package/lib/permission.js.map +1 -1
  93. package/lib/plans.d.ts +3 -3
  94. package/lib/plans.d.ts.map +1 -1
  95. package/lib/plans.js +206 -171
  96. package/lib/plans.js.map +1 -1
  97. package/lib/protocol.d.ts +53 -37
  98. package/lib/protocol.d.ts.map +1 -1
  99. package/lib/protocol.js +85 -86
  100. package/lib/protocol.js.map +1 -1
  101. package/lib/snapshot-url.spec.js.map +1 -1
  102. package/lib/team-subscription-protocol.d.ts +5 -3
  103. package/lib/team-subscription-protocol.d.ts.map +1 -1
  104. package/lib/team-subscription-protocol.js +4 -4
  105. package/lib/team-subscription-protocol.js.map +1 -1
  106. package/lib/teams-projects-protocol.d.ts +3 -3
  107. package/lib/teams-projects-protocol.d.ts.map +1 -1
  108. package/lib/teams-projects-protocol.js +1 -1
  109. package/lib/teams-projects-protocol.js.map +1 -1
  110. package/lib/typings/globals.d.ts +2 -2
  111. package/lib/typings/globals.d.ts.map +1 -1
  112. package/lib/util/analytics.d.ts.map +1 -1
  113. package/lib/util/analytics.js +12 -3
  114. package/lib/util/analytics.js.map +1 -1
  115. package/lib/util/async-iterator.d.ts.map +1 -1
  116. package/lib/util/async-iterator.js +3 -3
  117. package/lib/util/async-iterator.js.map +1 -1
  118. package/lib/util/cancelable.js.map +1 -1
  119. package/lib/util/date-time.js +6 -6
  120. package/lib/util/date-time.js.map +1 -1
  121. package/lib/util/deferred.js.map +1 -1
  122. package/lib/util/disposable.d.ts.map +1 -1
  123. package/lib/util/disposable.js +2 -2
  124. package/lib/util/disposable.js.map +1 -1
  125. package/lib/util/event.d.ts.map +1 -1
  126. package/lib/util/event.js +5 -3
  127. package/lib/util/event.js.map +1 -1
  128. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  129. package/lib/util/garbage-collected-cache.js +1 -1
  130. package/lib/util/garbage-collected-cache.js.map +1 -1
  131. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  132. package/lib/util/generate-workspace-id.js +435 -435
  133. package/lib/util/generate-workspace-id.js.map +1 -1
  134. package/lib/util/generate-workspace-id.spec.js +10 -6
  135. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  136. package/lib/util/gitpod-cookie.d.ts +1 -1
  137. package/lib/util/gitpod-cookie.d.ts.map +1 -1
  138. package/lib/util/gitpod-cookie.js +0 -3
  139. package/lib/util/gitpod-cookie.js.map +1 -1
  140. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  141. package/lib/util/gitpod-host-url.js +31 -29
  142. package/lib/util/gitpod-host-url.js.map +1 -1
  143. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  144. package/lib/util/gitpod-host-url.spec.js +15 -5
  145. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  146. package/lib/util/grpc.d.ts.map +1 -1
  147. package/lib/util/grpc.js.map +1 -1
  148. package/lib/util/jaeger-client-types.d.ts.map +1 -1
  149. package/lib/util/logging.d.ts +1 -1
  150. package/lib/util/logging.d.ts.map +1 -1
  151. package/lib/util/logging.js +22 -23
  152. package/lib/util/logging.js.map +1 -1
  153. package/lib/util/make-link.js +5 -5
  154. package/lib/util/make-link.js.map +1 -1
  155. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  156. package/lib/util/parse-workspace-id.js +1 -2
  157. package/lib/util/parse-workspace-id.js.map +1 -1
  158. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  159. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  160. package/lib/util/queue.spec.js +9 -6
  161. package/lib/util/queue.spec.js.map +1 -1
  162. package/lib/util/semaphore.d.ts.map +1 -1
  163. package/lib/util/semaphore.js.map +1 -1
  164. package/lib/util/skip-if.d.ts.map +1 -1
  165. package/lib/util/skip-if.js.map +1 -1
  166. package/lib/util/timeutil.d.ts.map +1 -1
  167. package/lib/util/timeutil.js +2 -2
  168. package/lib/util/timeutil.js.map +1 -1
  169. package/lib/util/timeutil.spec.d.ts.map +1 -1
  170. package/lib/util/timeutil.spec.js.map +1 -1
  171. package/lib/util/tracing.d.ts +6 -6
  172. package/lib/util/tracing.d.ts.map +1 -1
  173. package/lib/util/tracing.js +6 -6
  174. package/lib/util/tracing.js.map +1 -1
  175. package/lib/util/tracing.spec.js +3 -3
  176. package/lib/util/tracing.spec.js.map +1 -1
  177. package/lib/util/workspace-port-authentication.d.ts +7 -7
  178. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  179. package/lib/util/workspace-port-authentication.js +8 -11
  180. package/lib/util/workspace-port-authentication.js.map +1 -1
  181. package/lib/workspace-cluster.d.ts +1 -1
  182. package/lib/workspace-cluster.d.ts.map +1 -1
  183. package/lib/workspace-cluster.js +2 -4
  184. package/lib/workspace-cluster.js.map +1 -1
  185. package/lib/workspace-instance.d.ts +2 -2
  186. package/lib/workspace-instance.d.ts.map +1 -1
  187. package/lib/wsready.d.ts +1 -1
  188. package/lib/wsready.d.ts.map +1 -1
  189. package/lib/wsready.js +2 -2
  190. package/package.json +2 -2
  191. package/pkg-yarn.lock +2 -2
  192. package/provenance-bundle.jsonl +1 -1
  193. package/src/accounting-protocol.ts +53 -51
  194. package/src/admin-protocol.ts +25 -21
  195. package/src/analytics.ts +26 -28
  196. package/src/auth.ts +2 -2
  197. package/src/context-url.spec.ts +25 -11
  198. package/src/context-url.ts +80 -78
  199. package/src/email-protocol.ts +5 -6
  200. package/src/encryption/container-module.ts +2 -3
  201. package/src/encryption/encryption-engine.spec.ts +9 -8
  202. package/src/encryption/encryption-engine.ts +14 -14
  203. package/src/encryption/encryption-service.ts +4 -5
  204. package/src/encryption/key-provider.ts +16 -19
  205. package/src/env.ts +9 -9
  206. package/src/gitpod-file-parser.spec.ts +55 -61
  207. package/src/gitpod-file-parser.ts +16 -17
  208. package/src/gitpod-service.ts +130 -104
  209. package/src/headless-workspace-log.ts +6 -4
  210. package/src/ide-frontend-service.ts +2 -2
  211. package/src/ide-protocol.ts +8 -8
  212. package/src/index.ts +16 -16
  213. package/src/installation-admin-protocol.ts +9 -9
  214. package/src/license-protocol.ts +5 -6
  215. package/src/messaging/browser/connection.ts +45 -47
  216. package/src/messaging/browser/window-connection.ts +39 -29
  217. package/src/messaging/client-call-metrics.ts +70 -71
  218. package/src/messaging/error.ts +1 -3
  219. package/src/messaging/handler.ts +6 -6
  220. package/src/messaging/node/connection.ts +8 -8
  221. package/src/messaging/proxy-factory.ts +23 -30
  222. package/src/oss-allowlist.ts +3 -3
  223. package/src/payment-protocol.ts +2 -2
  224. package/src/permission.ts +20 -31
  225. package/src/plans.ts +236 -189
  226. package/src/protocol.ts +239 -239
  227. package/src/snapshot-url.spec.ts +9 -7
  228. package/src/team-subscription-protocol.ts +33 -23
  229. package/src/teams-projects-protocol.ts +8 -8
  230. package/src/typings/globals.ts +4 -4
  231. package/src/util/analytics.ts +46 -24
  232. package/src/util/async-iterator.ts +4 -5
  233. package/src/util/cancelable.ts +3 -3
  234. package/src/util/date-time.ts +8 -8
  235. package/src/util/deferred.ts +6 -6
  236. package/src/util/disposable.ts +3 -6
  237. package/src/util/event.ts +9 -11
  238. package/src/util/garbage-collected-cache.ts +3 -6
  239. package/src/util/generate-workspace-id.spec.ts +18 -15
  240. package/src/util/generate-workspace-id.ts +453 -453
  241. package/src/util/gitpod-cookie.ts +8 -9
  242. package/src/util/gitpod-host-url.spec.ts +40 -13
  243. package/src/util/gitpod-host-url.ts +37 -34
  244. package/src/util/grpc.ts +1 -1
  245. package/src/util/jaeger-client-types.ts +2 -2
  246. package/src/util/logging.ts +49 -39
  247. package/src/util/make-link.ts +6 -7
  248. package/src/util/parse-workspace-id.spec.ts +17 -8
  249. package/src/util/parse-workspace-id.ts +5 -6
  250. package/src/util/queue.spec.ts +27 -25
  251. package/src/util/repeat.ts +1 -1
  252. package/src/util/semaphore.ts +4 -6
  253. package/src/util/skip-if.ts +9 -6
  254. package/src/util/timeutil.spec.ts +14 -15
  255. package/src/util/timeutil.ts +15 -11
  256. package/src/util/tracing.spec.ts +28 -23
  257. package/src/util/tracing.ts +46 -41
  258. package/src/util/workspace-port-authentication.ts +10 -13
  259. package/src/workspace-cluster.ts +15 -12
  260. package/src/workspace-instance.ts +27 -23
  261. package/src/wsready.ts +3 -3
  262. package/data/builtin-theia-plugins.json +0 -372
  263. package/lib/theia-plugins.d.ts +0 -11
  264. package/lib/theia-plugins.d.ts.map +0 -1
  265. package/lib/theia-plugins.js +0 -8
  266. package/lib/theia-plugins.js.map +0 -1
  267. package/src/theia-plugins.ts +0 -11
package/src/protocol.ts CHANGED
@@ -7,26 +7,27 @@
7
7
  import { WorkspaceInstance, PortVisibility } from "./workspace-instance";
8
8
  import { RoleOrPermission } from "./permission";
9
9
  import { Project } from "./teams-projects-protocol";
10
+ import { createHash } from "crypto";
10
11
 
11
12
  export interface UserInfo {
12
- name?: string
13
+ name?: string;
13
14
  }
14
15
 
15
16
  export interface User {
16
17
  /** The user id */
17
- id: string
18
+ id: string;
18
19
 
19
20
  /** The timestamp when the user entry was created */
20
- creationDate: string
21
+ creationDate: string;
21
22
 
22
- avatarUrl?: string
23
+ avatarUrl?: string;
23
24
 
24
- name?: string
25
+ name?: string;
25
26
 
26
27
  /** Optional for backwards compatibility */
27
- fullName?: string
28
+ fullName?: string;
28
29
 
29
- identities: Identity[]
30
+ identities: Identity[];
30
31
 
31
32
  /**
32
33
  * Whether the user has been blocked to use our service, because of TOS violation for example.
@@ -48,29 +49,27 @@ export interface User {
48
49
 
49
50
  export namespace User {
50
51
  export function is(data: any): data is User {
51
- return data
52
- && data.hasOwnProperty('id')
53
- && data.hasOwnProperty('identities')
52
+ return data && data.hasOwnProperty("id") && data.hasOwnProperty("identities");
54
53
  }
55
54
  export function getIdentity(user: User, authProviderId: string): Identity | undefined {
56
- return user.identities.find(id => id.authProviderId === authProviderId);
55
+ return user.identities.find((id) => id.authProviderId === authProviderId);
57
56
  }
58
57
  export function censor(user: User): User {
59
58
  const res = { ...user };
60
- delete (res.additionalData);
61
- res.identities = res.identities.map(i => {
62
- delete (i.tokens);
59
+ delete res.additionalData;
60
+ res.identities = res.identities.map((i) => {
61
+ delete i.tokens;
63
62
 
64
63
  // The user field is not in the Identity shape, but actually exists on DBIdentity.
65
64
  // Trying to push this object out via JSON RPC will fail because of the cyclic nature
66
65
  // of this field.
67
- delete ((i as any).user);
66
+ delete (i as any).user;
68
67
  return i;
69
68
  });
70
69
  return res;
71
70
  }
72
71
  export function getPrimaryEmail(user: User): string {
73
- const identities = user.identities.filter(i => !!i.primaryEmail);
72
+ const identities = user.identities.filter((i) => !!i.primaryEmail);
74
73
  if (identities.length <= 0) {
75
74
  throw new Error(`No identity with primary email for user: ${user.id}!`);
76
75
  }
@@ -98,10 +97,10 @@ export interface AdditionalUserData {
98
97
  featurePreview?: boolean;
99
98
  ideSettings?: IDESettings;
100
99
  // key is the name of the news, string the iso date when it was seen
101
- whatsNewSeen?: { [key: string]: string }
100
+ whatsNewSeen?: { [key: string]: string };
102
101
  // key is the name of the OAuth client i.e. local app, string the iso date when it was approved
103
102
  // TODO(rl): provide a management UX to allow rescinding of approval
104
- oauthClientsApproved?: { [key: string]: string }
103
+ oauthClientsApproved?: { [key: string]: string };
105
104
  // to remember GH Orgs the user installed/updated the GH App for
106
105
  knownGitHubOrgs?: string[];
107
106
 
@@ -116,11 +115,11 @@ export interface EmailNotificationSettings {
116
115
  }
117
116
 
118
117
  export type IDESettings = {
119
- defaultIde?: string
120
- useDesktopIde?: boolean
121
- defaultDesktopIde?: string
122
- useLatestVersion?: boolean
123
- }
118
+ defaultIde?: string;
119
+ useDesktopIde?: boolean;
120
+ defaultDesktopIde?: string;
121
+ useLatestVersion?: boolean;
122
+ };
124
123
 
125
124
  export interface UserPlatform {
126
125
  uid: string;
@@ -152,8 +151,12 @@ export interface UserFeatureSettings {
152
151
  * The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
153
152
  * If they don't we'll break things during workspace startup.
154
153
  */
155
- export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
156
- export type NamedWorkspaceFeatureFlag = keyof (typeof WorkspaceFeatureFlags);
154
+ export const WorkspaceFeatureFlags = {
155
+ full_workspace_backup: undefined,
156
+ fixed_resources: undefined,
157
+ persistent_volume_claim: undefined,
158
+ };
159
+ export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
157
160
 
158
161
  export interface EnvVarWithValue {
159
162
  name: string;
@@ -166,7 +169,7 @@ export interface ProjectEnvVarWithValue extends EnvVarWithValue {
166
169
  censored: boolean;
167
170
  }
168
171
 
169
- export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, 'value'>;
172
+ export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, "value">;
170
173
 
171
174
  export interface UserEnvVarValue extends EnvVarWithValue {
172
175
  id?: string;
@@ -179,7 +182,6 @@ export interface UserEnvVar extends UserEnvVarValue {
179
182
  }
180
183
 
181
184
  export namespace UserEnvVar {
182
-
183
185
  // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
184
186
  export function normalizeRepoPattern(pattern: string) {
185
187
  return pattern.toLocaleLowerCase();
@@ -199,7 +201,7 @@ export namespace UserEnvVar {
199
201
  if (repoPattern == "*") {
200
202
  score += 1;
201
203
  }
202
- if (ownerPattern == '*') {
204
+ if (ownerPattern == "*") {
203
205
  score += 2;
204
206
  }
205
207
  if (ownerPattern == "#" || repoPattern == "#") {
@@ -210,20 +212,20 @@ export namespace UserEnvVar {
210
212
 
211
213
  // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
212
214
  export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
213
- let result = vars.filter(e => {
215
+ let result = vars.filter((e) => {
214
216
  const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
215
- if (ownerPattern !== '*' && ownerPattern !== '#' && (!!owner && ownerPattern !== owner.toLocaleLowerCase())) {
217
+ if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
216
218
  return false;
217
219
  }
218
- if (repoPattern !== '*' && repoPattern !== '#' && (!!repo && repoPattern !== repo.toLocaleLowerCase())) {
220
+ if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
219
221
  return false;
220
222
  }
221
223
  return true;
222
224
  });
223
225
 
224
226
  const resmap = new Map<string, T[]>();
225
- result.forEach(e => {
226
- const l = (resmap.get(e.name) || []);
227
+ result.forEach((e) => {
228
+ const l = resmap.get(e.name) || [];
227
229
  l.push(e);
228
230
  resmap.set(e.name, l);
229
231
  });
@@ -258,46 +260,45 @@ export namespace UserEnvVar {
258
260
 
259
261
  // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
260
262
  export function splitRepositoryPattern(repositoryPattern: string): string[] {
261
- const patterns = repositoryPattern.split('/');
262
- const repoPattern = patterns.slice(1).join('/')
263
+ const patterns = repositoryPattern.split("/");
264
+ const repoPattern = patterns.slice(1).join("/");
263
265
  const ownerPattern = patterns[0];
264
266
  return [ownerPattern, repoPattern];
265
267
  }
266
268
  }
267
269
 
268
270
  export interface GitpodToken {
269
-
270
271
  /** Hash value (SHA256) of the token (primary key). */
271
- tokenHash: string
272
+ tokenHash: string;
272
273
 
273
274
  /** Human readable name of the token */
274
- name?: string
275
+ name?: string;
275
276
 
276
277
  /** Token kind */
277
- type: GitpodTokenType
278
+ type: GitpodTokenType;
278
279
 
279
280
  /** The user the token belongs to. */
280
- user: User
281
+ user: User;
281
282
 
282
283
  /** Scopes (e.g. limition to read-only) */
283
- scopes: string[]
284
+ scopes: string[];
284
285
 
285
286
  /** Created timestamp */
286
- created: string
287
+ created: string;
287
288
 
288
289
  // token is deleted on the database and about to be collected by db-sync
289
- deleted?: boolean
290
+ deleted?: boolean;
290
291
  }
291
292
 
292
293
  export enum GitpodTokenType {
293
294
  API_AUTH_TOKEN = 0,
294
- MACHINE_AUTH_TOKEN = 1
295
+ MACHINE_AUTH_TOKEN = 1,
295
296
  }
296
297
 
297
298
  export interface OneTimeSecret {
298
- id: string
299
+ id: string;
299
300
 
300
- value: string
301
+ value: string;
301
302
 
302
303
  expirationTime: string;
303
304
 
@@ -329,13 +330,12 @@ export type IdentityLookup = Pick<Identity, "authProviderId" | "authId">;
329
330
 
330
331
  export namespace Identity {
331
332
  export function is(data: any): data is Identity {
332
- return data.hasOwnProperty('authProviderId')
333
- && data.hasOwnProperty('authId')
334
- && data.hasOwnProperty('authName')
333
+ return (
334
+ data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName")
335
+ );
335
336
  }
336
337
  export function equals(id1: IdentityLookup, id2: IdentityLookup) {
337
- return id1.authProviderId === id2.authProviderId
338
- && id1.authId === id2.authId
338
+ return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
339
339
  }
340
340
  }
341
341
 
@@ -399,7 +399,7 @@ export interface Snapshot {
399
399
  message?: string;
400
400
  }
401
401
 
402
- export type SnapshotState = 'pending' | 'available' | 'error';
402
+ export type SnapshotState = "pending" | "available" | "error";
403
403
 
404
404
  export interface LayoutData {
405
405
  workspaceId: string;
@@ -428,13 +428,13 @@ export interface Workspace {
428
428
  * The resolved, fix name of the workspace image. We only use this
429
429
  * to access the logs during an image build.
430
430
  */
431
- imageNameResolved?: string
431
+ imageNameResolved?: string;
432
432
 
433
433
  /**
434
434
  * The resolved/built fixed named of the base image. This field is only set if the workspace
435
435
  * already has its base image built.
436
436
  */
437
- baseImageNameResolved?: string
437
+ baseImageNameResolved?: string;
438
438
 
439
439
  shareable?: boolean;
440
440
  pinned?: boolean;
@@ -471,17 +471,16 @@ export type WorkspaceSoftDeletion = "user" | "gc";
471
471
  export type WorkspaceType = "regular" | "prebuild" | "probe";
472
472
 
473
473
  export namespace Workspace {
474
-
475
474
  export function getFullRepositoryName(ws: Workspace): string | undefined {
476
475
  if (CommitContext.is(ws.context)) {
477
- return ws.context.repository.owner + '/' + ws.context.repository.name
476
+ return ws.context.repository.owner + "/" + ws.context.repository.name;
478
477
  }
479
478
  return undefined;
480
479
  }
481
480
 
482
481
  export function getFullRepositoryUrl(ws: Workspace): string | undefined {
483
482
  if (CommitContext.is(ws.context)) {
484
- return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`
483
+ return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`;
485
484
  }
486
485
  return undefined;
487
486
  }
@@ -515,59 +514,36 @@ export namespace Workspace {
515
514
  }
516
515
  }
517
516
 
518
- export interface PreparePluginUploadParams {
519
- fullPluginName: string;
520
- }
521
-
522
- export interface ResolvePluginsParams {
523
- config?: WorkspaceConfig
524
- builtins?: ResolvedPlugins
525
- vsxRegistryUrl?: string
526
- }
527
-
528
- export interface InstallPluginsParams {
529
- pluginIds: string[]
530
- }
531
-
532
- export interface UninstallPluginParams {
533
- pluginId: string;
534
- }
535
-
536
517
  export interface GuessGitTokenScopesParams {
537
- host: string
538
- repoUrl: string
539
- gitCommand: string
540
- currentToken: GitToken
518
+ host: string;
519
+ repoUrl: string;
520
+ gitCommand: string;
521
+ currentToken: GitToken;
541
522
  }
542
523
 
543
524
  export interface GitToken {
544
- token: string
545
- user: string
546
- scopes: string[]
525
+ token: string;
526
+ user: string;
527
+ scopes: string[];
547
528
  }
548
529
 
549
530
  export interface GuessedGitTokenScopes {
550
- message?: string
551
- scopes?: string[]
531
+ message?: string;
532
+ scopes?: string[];
552
533
  }
553
534
 
554
- export type ResolvedPluginKind = 'user' | 'workspace' | 'builtin';
555
-
556
- export interface ResolvedPlugins {
557
- [pluginId: string]: ResolvedPlugin | undefined
535
+ export interface VSCodeConfig {
536
+ extensions?: string[];
558
537
  }
559
538
 
560
- export interface ResolvedPlugin {
561
- fullPluginName: string;
539
+ export interface RepositoryCloneInformation {
562
540
  url: string;
563
- kind: ResolvedPluginKind;
564
- }
565
-
566
- export interface VSCodeConfig {
567
- extensions?: string[];
541
+ checkoutLocation?: string;
568
542
  }
569
543
 
570
544
  export interface WorkspaceConfig {
545
+ mainConfiguration?: string;
546
+ additionalRepositories?: RepositoryCloneInformation[];
571
547
  image?: ImageConfig;
572
548
  ports?: PortConfig[];
573
549
  tasks?: TaskConfig[];
@@ -590,7 +566,7 @@ export interface WorkspaceConfig {
590
566
  * additional-content - config comes from additional content, usually provided through the project's configuration
591
567
  * default - our static catch-all default config
592
568
  */
593
- _origin?: 'repo' | 'project-db' | 'definitely-gp' | 'derived' | 'additional-content' | 'default';
569
+ _origin?: "repo" | "project-db" | "definitely-gp" | "derived" | "additional-content" | "default";
594
570
 
595
571
  /**
596
572
  * Set of automatically infered feature flags. That's not something the user can set, but
@@ -600,34 +576,33 @@ export interface WorkspaceConfig {
600
576
  }
601
577
 
602
578
  export interface GithubAppConfig {
603
- prebuilds?: GithubAppPrebuildConfig
579
+ prebuilds?: GithubAppPrebuildConfig;
604
580
  }
605
581
  export interface GithubAppPrebuildConfig {
606
- master?: boolean
607
- branches?: boolean
608
- pullRequests?: boolean
609
- pullRequestsFromForks?: boolean
610
- addCheck?: boolean | 'prevent-merge-on-error'
611
- addBadge?: boolean
612
- addLabel?: boolean | string
613
- addComment?: boolean
582
+ master?: boolean;
583
+ branches?: boolean;
584
+ pullRequests?: boolean;
585
+ pullRequestsFromForks?: boolean;
586
+ addCheck?: boolean | "prevent-merge-on-error";
587
+ addBadge?: boolean;
588
+ addLabel?: boolean | string;
589
+ addComment?: boolean;
614
590
  }
615
591
  export namespace GithubAppPrebuildConfig {
616
592
  export function is(obj: boolean | GithubAppPrebuildConfig): obj is GithubAppPrebuildConfig {
617
- return !(typeof obj === 'boolean');
593
+ return !(typeof obj === "boolean");
618
594
  }
619
595
  }
620
596
 
621
597
  export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
622
598
  export interface WorkspaceImageSourceDocker {
623
- dockerFilePath: string
624
- dockerFileHash: string
625
- dockerFileSource?: Commit
599
+ dockerFilePath: string;
600
+ dockerFileHash: string;
601
+ dockerFileSource?: Commit;
626
602
  }
627
603
  export namespace WorkspaceImageSourceDocker {
628
604
  export function is(obj: object): obj is WorkspaceImageSourceDocker {
629
- return 'dockerFileHash' in obj
630
- && 'dockerFilePath' in obj;
605
+ return "dockerFileHash" in obj && "dockerFilePath" in obj;
631
606
  }
632
607
  }
633
608
  export interface WorkspaceImageSourceReference {
@@ -636,21 +611,23 @@ export interface WorkspaceImageSourceReference {
636
611
  }
637
612
  export namespace WorkspaceImageSourceReference {
638
613
  export function is(obj: object): obj is WorkspaceImageSourceReference {
639
- return 'baseImageResolved' in obj;
614
+ return "baseImageResolved" in obj;
640
615
  }
641
616
  }
642
617
 
643
- export type PrebuiltWorkspaceState
618
+ export type PrebuiltWorkspaceState =
644
619
  // the prebuild is queued and may start at anytime
645
- = "queued"
620
+ | "queued"
646
621
  // the workspace prebuild is currently running (i.e. there's a workspace pod deployed)
647
622
  | "building"
648
- // the prebuild failed due to some issue with the system (e.g. missed a message, could not start workspace)
623
+ // the prebuild was aborted
649
624
  | "aborted"
650
625
  // the prebuild timed out
651
626
  | "timeout"
652
- // the prebuild has finished and a snapshot is available
653
- | "available";
627
+ // the prebuild has finished (even if a headless task failed) and a snapshot is available
628
+ | "available"
629
+ // the prebuild (headless workspace) failed due to some system error
630
+ | "failed";
654
631
 
655
632
  export interface PrebuiltWorkspace {
656
633
  id: string;
@@ -661,13 +638,14 @@ export interface PrebuiltWorkspace {
661
638
  buildWorkspaceId: string;
662
639
  creationTime: string;
663
640
  state: PrebuiltWorkspaceState;
641
+ statusVersion: number;
664
642
  error?: string;
665
643
  snapshot?: string;
666
644
  }
667
645
 
668
646
  export namespace PrebuiltWorkspace {
669
647
  export function isDone(pws: PrebuiltWorkspace) {
670
- return pws.state === "available" || pws.state === "timeout" || pws.state === 'aborted';
648
+ return pws.state === "available" || pws.state === "timeout" || pws.state === "aborted";
671
649
  }
672
650
 
673
651
  export function isAvailable(pws: PrebuiltWorkspace) {
@@ -686,18 +664,22 @@ export interface PrebuiltWorkspaceUpdatable {
686
664
  repo: string;
687
665
  isResolved: boolean;
688
666
  installationId: string;
667
+ /**
668
+ * the commitSHA of the commit that triggered the prebuild
669
+ */
670
+ commitSHA?: string;
689
671
  issue?: string;
690
672
  contextUrl?: string;
691
673
  }
692
674
 
693
675
  export interface WhitelistedRepository {
694
- url: string
695
- name: string
696
- description?: string
697
- avatar?: string
676
+ url: string;
677
+ name: string;
678
+ description?: string;
679
+ avatar?: string;
698
680
  }
699
681
 
700
- export type PortOnOpen = 'open-browser' | 'open-preview' | 'notify' | 'ignore';
682
+ export type PortOnOpen = "open-browser" | "open-preview" | "notify" | "ignore";
701
683
 
702
684
  export interface PortConfig {
703
685
  port: number;
@@ -708,7 +690,7 @@ export interface PortConfig {
708
690
  }
709
691
  export namespace PortConfig {
710
692
  export function is(config: any): config is PortConfig {
711
- return config && ('port' in config) && (typeof config.port === 'number');
693
+ return config && "port" in config && typeof config.port === "number";
712
694
  }
713
695
  }
714
696
 
@@ -718,7 +700,7 @@ export interface PortRangeConfig {
718
700
  }
719
701
  export namespace PortRangeConfig {
720
702
  export function is(config: any): config is PortRangeConfig {
721
- return config && ('port' in config) && (typeof config.port === 'string' || config.port instanceof String);
703
+ return config && "port" in config && (typeof config.port === "string" || config.port instanceof String);
722
704
  }
723
705
  }
724
706
 
@@ -729,32 +711,31 @@ export interface TaskConfig {
729
711
  prebuild?: string;
730
712
  command?: string;
731
713
  env?: { [env: string]: any };
732
- openIn?: 'bottom' | 'main' | 'left' | 'right';
733
- openMode?: 'split-top' | 'split-left' | 'split-right' | 'split-bottom' | 'tab-before' | 'tab-after';
714
+ openIn?: "bottom" | "main" | "left" | "right";
715
+ openMode?: "split-top" | "split-left" | "split-right" | "split-bottom" | "tab-before" | "tab-after";
734
716
  }
735
717
 
736
718
  export namespace TaskConfig {
737
719
  export function is(config: any): config is TaskConfig {
738
- return config
739
- && ('command' in config || 'init' in config || 'before' in config);
720
+ return config && ("command" in config || "init" in config || "before" in config);
740
721
  }
741
722
  }
742
723
 
743
724
  export namespace WorkspaceImageBuild {
744
- export type Phase = 'BaseImage' | 'GitpodLayer' | 'Error' | 'Done';
725
+ export type Phase = "BaseImage" | "GitpodLayer" | "Error" | "Done";
745
726
  export interface StateInfo {
746
- phase: Phase
747
- currentStep?: number
748
- maxSteps?: number
727
+ phase: Phase;
728
+ currentStep?: number;
729
+ maxSteps?: number;
749
730
  }
750
731
  export interface LogContent {
751
- text: string
752
- upToLine?: number
753
- isDiff?: boolean
732
+ text: string;
733
+ upToLine?: number;
734
+ isDiff?: boolean;
754
735
  }
755
736
  export type LogCallback = (info: StateInfo, content: LogContent | undefined) => void;
756
737
  export namespace LogLine {
757
- export const DELIMITER = '\r\n';
738
+ export const DELIMITER = "\r\n";
758
739
  export const DELIMITER_REGEX = /\r?\n/;
759
740
  }
760
741
  }
@@ -763,20 +744,18 @@ export type ImageConfig = ImageConfigString | ImageConfigFile;
763
744
  export type ImageConfigString = string;
764
745
  export namespace ImageConfigString {
765
746
  export function is(config: ImageConfig | undefined): config is ImageConfigString {
766
- return typeof config === 'string';
747
+ return typeof config === "string";
767
748
  }
768
-
769
749
  }
770
750
  export interface ImageConfigFile {
771
751
  // Path to the Dockerfile relative to repository root
772
- file: string,
752
+ file: string;
773
753
  // Path to the docker build context relative to repository root
774
- context?: string
754
+ context?: string;
775
755
  }
776
756
  export namespace ImageConfigFile {
777
757
  export function is(config: ImageConfig | undefined): config is ImageConfigFile {
778
- return typeof config === 'object'
779
- && 'file' in config;
758
+ return typeof config === "object" && "file" in config;
780
759
  }
781
760
  }
782
761
  export interface ExternalImageConfigFile extends ImageConfigFile {
@@ -784,9 +763,7 @@ export interface ExternalImageConfigFile extends ImageConfigFile {
784
763
  }
785
764
  export namespace ExternalImageConfigFile {
786
765
  export function is(config: any | undefined): config is ExternalImageConfigFile {
787
- return typeof config === 'object'
788
- && 'file' in config
789
- && 'externalSource' in config;
766
+ return typeof config === "object" && "file" in config && "externalSource" in config;
790
767
  }
791
768
  }
792
769
 
@@ -800,8 +777,7 @@ export interface WorkspaceContext {
800
777
 
801
778
  export namespace WorkspaceContext {
802
779
  export function is(context: any): context is WorkspaceContext {
803
- return context
804
- && 'title' in context;
780
+ return context && "title" in context;
805
781
  }
806
782
  }
807
783
 
@@ -810,22 +786,17 @@ export interface WithSnapshot {
810
786
  }
811
787
  export namespace WithSnapshot {
812
788
  export function is(context: any): context is WithSnapshot {
813
- return context
814
- && 'snapshotBucketId' in context;
789
+ return context && "snapshotBucketId" in context;
815
790
  }
816
791
  }
817
792
 
818
- export interface WithPrebuild {
819
- snapshotBucketId: string;
793
+ export interface WithPrebuild extends WithSnapshot {
820
794
  prebuildWorkspaceId: string;
821
795
  wasPrebuilt: true;
822
796
  }
823
797
  export namespace WithPrebuild {
824
798
  export function is(context: any): context is WithPrebuild {
825
- return context
826
- && 'snapshotBucketId' in context
827
- && 'prebuildWorkspaceId' in context
828
- && 'wasPrebuilt' in context;
799
+ return context && WithSnapshot.is(context) && "prebuildWorkspaceId" in context && "wasPrebuilt" in context;
829
800
  }
830
801
  }
831
802
 
@@ -839,16 +810,14 @@ export interface WithDefaultConfig {
839
810
 
840
811
  export namespace WithDefaultConfig {
841
812
  export function is(context: any): context is WithDefaultConfig {
842
- return context
843
- && 'withDefaultConfig' in context
844
- && context.withDefaultConfig;
813
+ return context && "withDefaultConfig" in context && context.withDefaultConfig;
845
814
  }
846
815
 
847
816
  export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
848
817
  return {
849
818
  ...ctx,
850
- withDefaultConfig: true
851
- }
819
+ withDefaultConfig: true,
820
+ };
852
821
  }
853
822
  }
854
823
 
@@ -858,23 +827,24 @@ export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
858
827
 
859
828
  export namespace SnapshotContext {
860
829
  export function is(context: any): context is SnapshotContext {
861
- return context
862
- && WithSnapshot.is(context)
863
- && 'snapshotId' in context;
830
+ return context && WithSnapshot.is(context) && "snapshotId" in context;
864
831
  }
865
832
  }
866
833
 
867
834
  export interface StartPrebuildContext extends WorkspaceContext {
868
835
  actual: WorkspaceContext;
869
836
  commitHistory?: string[];
837
+ additionalRepositoryCommitHistories?: {
838
+ cloneUrl: string;
839
+ commitHistory: string[];
840
+ }[];
870
841
  project?: Project;
871
842
  branch?: string;
872
843
  }
873
844
 
874
845
  export namespace StartPrebuildContext {
875
846
  export function is(context: any): context is StartPrebuildContext {
876
- return context
877
- && 'actual' in context;
847
+ return context && "actual" in context;
878
848
  }
879
849
  }
880
850
 
@@ -886,21 +856,18 @@ export interface PrebuiltWorkspaceContext extends WorkspaceContext {
886
856
 
887
857
  export namespace PrebuiltWorkspaceContext {
888
858
  export function is(context: any): context is PrebuiltWorkspaceContext {
889
- return context
890
- && 'originalContext' in context
891
- && 'prebuiltWorkspace' in context;
859
+ return context && "originalContext" in context && "prebuiltWorkspace" in context;
892
860
  }
893
861
  }
894
862
 
895
863
  export interface WithReferrerContext extends WorkspaceContext {
896
- referrer: string
897
- referrerIde?: string
864
+ referrer: string;
865
+ referrerIde?: string;
898
866
  }
899
867
 
900
868
  export namespace WithReferrerContext {
901
869
  export function is(context: any): context is WithReferrerContext {
902
- return context
903
- && 'referrer' in context;
870
+ return context && "referrer" in context;
904
871
  }
905
872
  }
906
873
 
@@ -910,21 +877,18 @@ export interface WithEnvvarsContext extends WorkspaceContext {
910
877
 
911
878
  export namespace WithEnvvarsContext {
912
879
  export function is(context: any): context is WithEnvvarsContext {
913
- return context
914
- && 'envvars' in context
880
+ return context && "envvars" in context;
915
881
  }
916
882
  }
917
883
 
918
884
  export interface WorkspaceProbeContext extends WorkspaceContext {
919
- responseURL: string
920
- responseToken: string
885
+ responseURL: string;
886
+ responseToken: string;
921
887
  }
922
888
 
923
889
  export namespace WorkspaceProbeContext {
924
890
  export function is(context: any): context is WorkspaceProbeContext {
925
- return context
926
- && 'responseURL' in context
927
- && 'responseToken' in context;
891
+ return context && "responseURL" in context && "responseToken" in context;
928
892
  }
929
893
  }
930
894
 
@@ -936,32 +900,30 @@ export namespace RefType {
936
900
  }
937
901
  // This fallback is meant to handle the cases where (for historic reasons) ref is present but refType is missing
938
902
  return commit.refType || "branch";
939
- }
903
+ };
940
904
  }
941
905
 
942
906
  export interface Commit {
943
- repository: Repository
944
- revision: string
907
+ repository: Repository;
908
+ revision: string;
945
909
 
946
910
  // Might contain either a branch or a tag (determined by refType)
947
- ref?: string
911
+ ref?: string;
948
912
 
949
913
  // refType is only set if ref is present (and not for old workspaces, before this feature was added)
950
- refType?: RefType
914
+ refType?: RefType;
951
915
  }
952
916
 
953
917
  export interface AdditionalContentContext extends WorkspaceContext {
954
-
955
918
  /**
956
919
  * utf-8 encoded contents that will be copied on top of the workspace's filesystem
957
920
  */
958
- additionalFiles: {[filePath: string]: string};
959
-
921
+ additionalFiles: { [filePath: string]: string };
960
922
  }
961
923
 
962
924
  export namespace AdditionalContentContext {
963
925
  export function is(ctx: any): ctx is AdditionalContentContext {
964
- return 'additionalFiles' in ctx;
926
+ return "additionalFiles" in ctx;
965
927
  }
966
928
 
967
929
  export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
@@ -969,16 +931,49 @@ export namespace AdditionalContentContext {
969
931
  }
970
932
  }
971
933
 
972
- export interface CommitContext extends WorkspaceContext, Commit {
934
+ export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
973
935
  /** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
974
- cloneUrl?: string
936
+ cloneUrl?: string;
937
+
938
+ /**
939
+ * The clone and checkout information for additional repositories in case of multi-repo projects.
940
+ */
941
+ additionalRepositoryCheckoutInfo?: GitCheckoutInfo[];
942
+ }
943
+
944
+ export namespace CommitContext {
945
+ /**
946
+ * Creates a hash for all the commits of the CommitContext and all sub-repo commit infos.
947
+ * The hash is max 255 chars long.
948
+ * @param commitContext
949
+ * @returns hash for commitcontext
950
+ */
951
+ export function computeHash(commitContext: CommitContext): string {
952
+ // for single commits we use the revision to be backward compatible.
953
+ if (
954
+ !commitContext.additionalRepositoryCheckoutInfo ||
955
+ commitContext.additionalRepositoryCheckoutInfo.length === 0
956
+ ) {
957
+ return commitContext.revision;
958
+ }
959
+ const hasher = createHash("sha256");
960
+ hasher.update(commitContext.revision);
961
+ for (const info of commitContext.additionalRepositoryCheckoutInfo) {
962
+ hasher.update(info.revision);
963
+ }
964
+ return hasher.digest("hex");
965
+ }
966
+ }
967
+
968
+ export interface GitCheckoutInfo extends Commit {
969
+ checkoutLocation?: string;
970
+ upstreamRemoteURI?: string;
971
+ localBranch?: string;
975
972
  }
976
973
 
977
974
  export namespace CommitContext {
978
975
  export function is(commit: any): commit is CommitContext {
979
- return WorkspaceContext.is(commit)
980
- && 'repository' in commit
981
- && 'revision' in commit
976
+ return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
982
977
  }
983
978
  }
984
979
 
@@ -986,17 +981,14 @@ export interface PullRequestContext extends CommitContext {
986
981
  nr: number;
987
982
  ref: string;
988
983
  base: {
989
- repository: Repository
990
- ref: string
991
- }
984
+ repository: Repository;
985
+ ref: string;
986
+ };
992
987
  }
993
988
 
994
989
  export namespace PullRequestContext {
995
990
  export function is(ctx: any): ctx is PullRequestContext {
996
- return CommitContext.is(ctx)
997
- && 'nr' in ctx
998
- && 'ref' in ctx
999
- && 'base' in ctx
991
+ return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
1000
992
  }
1001
993
  }
1002
994
 
@@ -1008,10 +1000,7 @@ export interface IssueContext extends CommitContext {
1008
1000
 
1009
1001
  export namespace IssueContext {
1010
1002
  export function is(ctx: any): ctx is IssueContext {
1011
- return CommitContext.is(ctx)
1012
- && 'nr' in ctx
1013
- && 'ref' in ctx
1014
- && 'localBranch' in ctx
1003
+ return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
1015
1004
  }
1016
1005
  }
1017
1006
 
@@ -1022,9 +1011,7 @@ export interface NavigatorContext extends CommitContext {
1022
1011
 
1023
1012
  export namespace NavigatorContext {
1024
1013
  export function is(ctx: any): ctx is NavigatorContext {
1025
- return CommitContext.is(ctx)
1026
- && 'path' in ctx
1027
- && 'isFile' in ctx
1014
+ return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
1028
1015
  }
1029
1016
  }
1030
1017
 
@@ -1033,6 +1020,8 @@ export interface Repository {
1033
1020
  owner: string;
1034
1021
  name: string;
1035
1022
  cloneUrl: string;
1023
+ /* Optional kind to differentiate between repositories of orgs/groups/projects and personal repos. */
1024
+ repoKind?: string;
1036
1025
  description?: string;
1037
1026
  avatarUrl?: string;
1038
1027
  webUrl?: string;
@@ -1041,8 +1030,8 @@ export interface Repository {
1041
1030
  private?: boolean;
1042
1031
  fork?: {
1043
1032
  // The direct parent of this fork
1044
- parent: Repository
1045
- }
1033
+ parent: Repository;
1034
+ };
1046
1035
  }
1047
1036
  export interface Branch {
1048
1037
  name: string;
@@ -1067,21 +1056,19 @@ export namespace Repository {
1067
1056
  export interface WorkspaceInstancePortsChangedEvent {
1068
1057
  type: "PortsChanged";
1069
1058
  instanceID: string;
1070
- portsOpened: number[]
1071
- portsClosed: number[]
1059
+ portsOpened: number[];
1060
+ portsClosed: number[];
1072
1061
  }
1073
1062
 
1074
1063
  export namespace WorkspaceInstancePortsChangedEvent {
1075
-
1076
1064
  export function is(data: any): data is WorkspaceInstancePortsChangedEvent {
1077
1065
  return data && data.type == "PortsChanged";
1078
1066
  }
1079
-
1080
1067
  }
1081
1068
 
1082
1069
  export interface WorkspaceInfo {
1083
- workspace: Workspace
1084
- latestInstance?: WorkspaceInstance
1070
+ workspace: Workspace;
1071
+ latestInstance?: WorkspaceInstance;
1085
1072
  }
1086
1073
 
1087
1074
  export namespace WorkspaceInfo {
@@ -1097,35 +1084,36 @@ export interface WorkspaceCreationResult {
1097
1084
  workspaceURL?: string;
1098
1085
  existingWorkspaces?: WorkspaceInfo[];
1099
1086
  runningWorkspacePrebuild?: {
1100
- prebuildID: string
1101
- workspaceID: string
1102
- instanceID: string
1103
- starting: RunningWorkspacePrebuildStarting
1104
- sameCluster: boolean
1105
- }
1087
+ prebuildID: string;
1088
+ workspaceID: string;
1089
+ instanceID: string;
1090
+ starting: RunningWorkspacePrebuildStarting;
1091
+ sameCluster: boolean;
1092
+ };
1106
1093
  runningPrebuildWorkspaceID?: string;
1107
1094
  }
1108
- export type RunningWorkspacePrebuildStarting = 'queued' | 'starting' | 'running';
1095
+ export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
1109
1096
 
1110
1097
  export enum CreateWorkspaceMode {
1111
1098
  // Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
1112
- Default = 'default',
1099
+ Default = "default",
1113
1100
  // ForceNew creates a new workspace irrespective of any running prebuilds. This mode is guaranteed to actually create a workspace - but may degrade user experience as currently runnig prebuilds are ignored.
1114
- ForceNew = 'force-new',
1101
+ ForceNew = "force-new",
1115
1102
  // UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
1116
- UsePrebuild = 'use-prebuild',
1103
+ UsePrebuild = "use-prebuild",
1117
1104
  // SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
1118
- SelectIfRunning = 'select-if-running',
1105
+ SelectIfRunning = "select-if-running",
1119
1106
  }
1120
1107
 
1121
1108
  export namespace WorkspaceCreationResult {
1122
1109
  export function is(data: any): data is WorkspaceCreationResult {
1123
- return data && (
1124
- 'createdWorkspaceId' in data
1125
- || 'existingWorkspaces' in data
1126
- || 'runningWorkspacePrebuild' in data
1127
- || 'runningPrebuildWorkspaceID' in data
1128
- )
1110
+ return (
1111
+ data &&
1112
+ ("createdWorkspaceId" in data ||
1113
+ "existingWorkspaces" in data ||
1114
+ "runningWorkspacePrebuild" in data ||
1115
+ "runningPrebuildWorkspaceID" in data)
1116
+ );
1129
1117
  }
1130
1118
  }
1131
1119
 
@@ -1159,6 +1147,12 @@ export interface AuthProviderInfo {
1159
1147
  readonly default: string[];
1160
1148
  readonly publicRepo: string[];
1161
1149
  readonly privateRepo: string[];
1150
+ };
1151
+ }
1152
+
1153
+ export namespace AuthProviderInfo {
1154
+ export function isGitHubEnterprise(info?: AuthProviderInfo): boolean {
1155
+ return !!info && info.authProviderType === "GitHub" && info.host !== "github.com";
1162
1156
  }
1163
1157
  }
1164
1158
 
@@ -1171,6 +1165,8 @@ export interface AuthProviderEntry {
1171
1165
  readonly status: AuthProviderEntry.Status;
1172
1166
 
1173
1167
  readonly oauth: OAuth2Config;
1168
+ /** A random string that is to change whenever oauth changes (enforced on DB level) */
1169
+ readonly oauthRevision?: string;
1174
1170
  }
1175
1171
 
1176
1172
  export interface OAuth2Config {
@@ -1183,23 +1179,27 @@ export interface OAuth2Config {
1183
1179
  readonly scopeSeparator?: string;
1184
1180
 
1185
1181
  readonly settingsUrl?: string;
1186
- readonly authorizationParams?: { [key: string]: string }
1182
+ readonly authorizationParams?: { [key: string]: string };
1187
1183
  readonly configURL?: string;
1188
1184
  }
1189
1185
 
1190
1186
  export namespace AuthProviderEntry {
1191
1187
  export type Type = "GitHub" | "GitLab" | string;
1192
1188
  export type Status = "pending" | "verified";
1193
- export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & { clientId?: string, clientSecret?: string };
1194
- export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> & Pick<OAuth2Config, "clientId" | "clientSecret">;
1189
+ export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & {
1190
+ clientId?: string;
1191
+ clientSecret?: string;
1192
+ };
1193
+ export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> &
1194
+ Pick<OAuth2Config, "clientId" | "clientSecret">;
1195
1195
  export function redact(entry: AuthProviderEntry): AuthProviderEntry {
1196
1196
  return {
1197
1197
  ...entry,
1198
1198
  oauth: {
1199
1199
  ...entry.oauth,
1200
- clientSecret: "redacted"
1201
- }
1202
- }
1200
+ clientSecret: "redacted",
1201
+ },
1202
+ };
1203
1203
  }
1204
1204
  }
1205
1205