@gitpod/gitpod-protocol 0.1.5-mp-docs-wsp-phase.0 → 0.1.5-mp-fmt-protocol.0

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