@gitpod/gitpod-protocol 0.1.5-me-version.1 → 0.1.5-me-image.2

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 (284) hide show
  1. package/data/gitpod-schema.json +23 -4
  2. package/lib/accounting-protocol.d.ts +3 -6
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +10 -16
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +19 -4
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +2 -13
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +44 -0
  11. package/lib/analytics.d.ts.map +1 -0
  12. package/lib/analytics.js +10 -0
  13. package/lib/analytics.js.map +1 -0
  14. package/lib/context-url.d.ts +31 -0
  15. package/lib/context-url.d.ts.map +1 -0
  16. package/lib/context-url.js +102 -0
  17. package/lib/context-url.js.map +1 -0
  18. package/lib/{util/context-url.spec.d.ts → context-url.spec.d.ts} +4 -0
  19. package/lib/context-url.spec.d.ts.map +1 -0
  20. package/lib/context-url.spec.js +94 -0
  21. package/lib/context-url.spec.js.map +1 -0
  22. package/lib/email-protocol.d.ts +1 -2
  23. package/lib/email-protocol.d.ts.map +1 -1
  24. package/lib/email-protocol.js +4 -4
  25. package/lib/email-protocol.js.map +1 -1
  26. package/lib/encryption/container-module.js +4 -4
  27. package/lib/encryption/container-module.js.map +1 -1
  28. package/lib/encryption/encryption-engine.js +19 -20
  29. package/lib/encryption/encryption-engine.js.map +1 -1
  30. package/lib/encryption/encryption-engine.spec.js +29 -36
  31. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  32. package/lib/encryption/encryption-service.js +29 -43
  33. package/lib/encryption/encryption-service.js.map +1 -1
  34. package/lib/encryption/key-provider.js +25 -30
  35. package/lib/encryption/key-provider.js.map +1 -1
  36. package/lib/env.d.ts +1 -2
  37. package/lib/env.d.ts.map +1 -1
  38. package/lib/env.js +20 -21
  39. package/lib/env.js.map +1 -1
  40. package/lib/gitpod-file-parser.js +25 -41
  41. package/lib/gitpod-file-parser.js.map +1 -1
  42. package/lib/gitpod-file-parser.spec.js +116 -116
  43. package/lib/gitpod-file-parser.spec.js.map +1 -1
  44. package/lib/gitpod-service.d.ts +108 -10
  45. package/lib/gitpod-service.d.ts.map +1 -1
  46. package/lib/gitpod-service.js +152 -295
  47. package/lib/gitpod-service.js.map +1 -1
  48. package/lib/headless-workspace-log.d.ts +8 -11
  49. package/lib/headless-workspace-log.d.ts.map +1 -1
  50. package/lib/headless-workspace-log.js +4 -7
  51. package/lib/headless-workspace-log.js.map +1 -1
  52. package/lib/ide-protocol.d.ts +105 -0
  53. package/lib/ide-protocol.d.ts.map +1 -0
  54. package/lib/ide-protocol.js +8 -0
  55. package/lib/ide-protocol.js.map +1 -0
  56. package/lib/index.d.ts +5 -0
  57. package/lib/index.d.ts.map +1 -1
  58. package/lib/index.js +5 -0
  59. package/lib/index.js.map +1 -1
  60. package/lib/installation-admin-protocol.d.ts +27 -0
  61. package/lib/installation-admin-protocol.d.ts.map +1 -0
  62. package/lib/installation-admin-protocol.js +30 -0
  63. package/lib/installation-admin-protocol.js.map +1 -0
  64. package/lib/messaging/browser/connection.d.ts +3 -3
  65. package/lib/messaging/browser/connection.d.ts.map +1 -1
  66. package/lib/messaging/browser/connection.js +172 -35
  67. package/lib/messaging/browser/connection.js.map +1 -1
  68. package/lib/messaging/browser/window-connection.js +35 -55
  69. package/lib/messaging/browser/window-connection.js.map +1 -1
  70. package/lib/messaging/client-call-metrics.d.ts +35 -0
  71. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  72. package/lib/messaging/client-call-metrics.js +83 -0
  73. package/lib/messaging/client-call-metrics.js.map +1 -0
  74. package/lib/messaging/error.d.ts +3 -1
  75. package/lib/messaging/error.d.ts.map +1 -1
  76. package/lib/messaging/error.js +6 -2
  77. package/lib/messaging/error.js.map +1 -1
  78. package/lib/messaging/handler.d.ts +10 -0
  79. package/lib/messaging/handler.d.ts.map +1 -1
  80. package/lib/messaging/node/connection.d.ts +1 -17
  81. package/lib/messaging/node/connection.d.ts.map +1 -1
  82. package/lib/messaging/node/connection.js +23 -59
  83. package/lib/messaging/node/connection.js.map +1 -1
  84. package/lib/messaging/proxy-factory.d.ts +2 -0
  85. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  86. package/lib/messaging/proxy-factory.js +74 -159
  87. package/lib/messaging/proxy-factory.js.map +1 -1
  88. package/lib/oss-allowlist.d.ts +14 -0
  89. package/lib/oss-allowlist.d.ts.map +1 -0
  90. package/lib/oss-allowlist.js +8 -0
  91. package/lib/oss-allowlist.js.map +1 -0
  92. package/lib/permission.d.ts +7 -2
  93. package/lib/permission.d.ts.map +1 -1
  94. package/lib/permission.js +34 -15
  95. package/lib/permission.js.map +1 -1
  96. package/lib/plans.d.ts +1 -1
  97. package/lib/plans.d.ts.map +1 -1
  98. package/lib/plans.js +38 -57
  99. package/lib/plans.js.map +1 -1
  100. package/lib/protocol.d.ts +72 -87
  101. package/lib/protocol.d.ts.map +1 -1
  102. package/lib/protocol.js +70 -115
  103. package/lib/protocol.js.map +1 -1
  104. package/lib/snapshot-url.d.ts +14 -0
  105. package/lib/snapshot-url.d.ts.map +1 -0
  106. package/lib/snapshot-url.js +26 -0
  107. package/lib/snapshot-url.js.map +1 -0
  108. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
  109. package/lib/snapshot-url.spec.d.ts.map +1 -0
  110. package/lib/snapshot-url.spec.js +41 -0
  111. package/lib/snapshot-url.spec.js.map +1 -0
  112. package/lib/team-subscription-protocol.d.ts +3 -3
  113. package/lib/team-subscription-protocol.d.ts.map +1 -1
  114. package/lib/team-subscription-protocol.js +15 -12
  115. package/lib/team-subscription-protocol.js.map +1 -1
  116. package/lib/teams-projects-protocol.d.ts +113 -0
  117. package/lib/teams-projects-protocol.d.ts.map +1 -0
  118. package/lib/teams-projects-protocol.js +30 -0
  119. package/lib/teams-projects-protocol.js.map +1 -0
  120. package/lib/util/analytics.d.ts +1 -26
  121. package/lib/util/analytics.d.ts.map +1 -1
  122. package/lib/util/analytics.js +36 -28
  123. package/lib/util/analytics.js.map +1 -1
  124. package/lib/util/async-iterator.js +55 -133
  125. package/lib/util/async-iterator.js.map +1 -1
  126. package/lib/util/cancelable.js +17 -59
  127. package/lib/util/cancelable.js.map +1 -1
  128. package/lib/util/date-time.js +8 -8
  129. package/lib/util/date-time.js.map +1 -1
  130. package/lib/util/deferred.js +10 -12
  131. package/lib/util/deferred.js.map +1 -1
  132. package/lib/util/disposable.js +26 -39
  133. package/lib/util/disposable.js.map +1 -1
  134. package/lib/util/event.js +58 -74
  135. package/lib/util/event.js.map +1 -1
  136. package/lib/util/garbage-collected-cache.d.ts +1 -0
  137. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  138. package/lib/util/garbage-collected-cache.js +26 -46
  139. package/lib/util/garbage-collected-cache.js.map +1 -1
  140. package/lib/util/generate-workspace-id.d.ts +1 -1
  141. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  142. package/lib/util/generate-workspace-id.js +30 -68
  143. package/lib/util/generate-workspace-id.js.map +1 -1
  144. package/lib/util/generate-workspace-id.spec.js +57 -78
  145. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  146. package/lib/util/gitpod-cookie.d.ts +20 -0
  147. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  148. package/lib/util/gitpod-cookie.js +44 -0
  149. package/lib/util/gitpod-cookie.js.map +1 -0
  150. package/lib/util/gitpod-host-url.d.ts +1 -1
  151. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  152. package/lib/util/gitpod-host-url.js +93 -103
  153. package/lib/util/gitpod-host-url.js.map +1 -1
  154. package/lib/util/gitpod-host-url.spec.js +87 -135
  155. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  156. package/lib/util/grpc.d.ts +15 -0
  157. package/lib/util/grpc.d.ts.map +1 -0
  158. package/lib/util/grpc.js +18 -0
  159. package/lib/util/grpc.js.map +1 -0
  160. package/lib/util/jaeger-client-types.d.ts +68 -0
  161. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  162. package/lib/util/{without.js → jaeger-client-types.js} +1 -1
  163. package/lib/util/jaeger-client-types.js.map +1 -0
  164. package/lib/util/logging.d.ts +49 -33
  165. package/lib/util/logging.d.ts.map +1 -1
  166. package/lib/util/logging.js +107 -110
  167. package/lib/util/logging.js.map +1 -1
  168. package/lib/util/make-link.js +2 -2
  169. package/lib/util/make-link.js.map +1 -1
  170. package/lib/util/parse-workspace-id.d.ts +10 -0
  171. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  172. package/lib/util/parse-workspace-id.js +31 -7
  173. package/lib/util/parse-workspace-id.js.map +1 -1
  174. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  175. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  176. package/lib/util/parse-workspace-id.spec.js +123 -84
  177. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  178. package/lib/util/queue.js +16 -55
  179. package/lib/util/queue.js.map +1 -1
  180. package/lib/util/queue.spec.js +144 -288
  181. package/lib/util/queue.spec.js.map +1 -1
  182. package/lib/util/repeat.d.ts +15 -0
  183. package/lib/util/repeat.d.ts.map +1 -0
  184. package/lib/util/repeat.js +55 -0
  185. package/lib/util/repeat.js.map +1 -0
  186. package/lib/util/semaphore.js +15 -46
  187. package/lib/util/semaphore.js.map +1 -1
  188. package/lib/util/skip-if.js +6 -6
  189. package/lib/util/skip-if.js.map +1 -1
  190. package/lib/util/timeutil.js +16 -16
  191. package/lib/util/timeutil.js.map +1 -1
  192. package/lib/util/timeutil.spec.js +21 -24
  193. package/lib/util/timeutil.spec.js.map +1 -1
  194. package/lib/util/tracing.d.ts +51 -5
  195. package/lib/util/tracing.d.ts.map +1 -1
  196. package/lib/util/tracing.js +197 -62
  197. package/lib/util/tracing.js.map +1 -1
  198. package/lib/util/tracing.spec.d.ts +7 -0
  199. package/lib/util/tracing.spec.d.ts.map +1 -0
  200. package/lib/util/tracing.spec.js +121 -0
  201. package/lib/util/tracing.spec.js.map +1 -0
  202. package/lib/util/workspace-port-authentication.js +2 -2
  203. package/lib/util/workspace-port-authentication.js.map +1 -1
  204. package/lib/workspace-cluster.d.ts +15 -4
  205. package/lib/workspace-cluster.d.ts.map +1 -1
  206. package/lib/workspace-cluster.js +21 -4
  207. package/lib/workspace-cluster.js.map +1 -1
  208. package/lib/workspace-instance.d.ts +24 -2
  209. package/lib/workspace-instance.d.ts.map +1 -1
  210. package/lib/wsready.js +1 -1
  211. package/package.json +24 -13
  212. package/pkg-yarn.lock +14 -7
  213. package/provenance-bundle.jsonl +2 -0
  214. package/src/accounting-protocol.ts +4 -10
  215. package/src/admin-protocol.ts +25 -7
  216. package/src/analytics.ts +52 -0
  217. package/src/context-url.spec.ts +53 -0
  218. package/src/context-url.ts +107 -0
  219. package/src/email-protocol.ts +2 -3
  220. package/src/env.ts +10 -10
  221. package/src/gitpod-service.ts +133 -22
  222. package/src/headless-workspace-log.ts +7 -11
  223. package/src/ide-frontend-service.ts +1 -1
  224. package/src/ide-protocol.ts +119 -0
  225. package/src/index.ts +5 -0
  226. package/src/installation-admin-protocol.ts +42 -0
  227. package/src/messaging/browser/connection.ts +176 -10
  228. package/src/messaging/client-call-metrics.ts +97 -0
  229. package/src/messaging/error.ts +8 -2
  230. package/src/messaging/handler.ts +12 -0
  231. package/src/messaging/node/connection.ts +21 -68
  232. package/src/messaging/proxy-factory.ts +13 -5
  233. package/src/oss-allowlist.ts +15 -0
  234. package/src/permission.ts +22 -4
  235. package/src/protocol.ts +105 -99
  236. package/src/snapshot-url.spec.ts +25 -0
  237. package/src/snapshot-url.ts +27 -0
  238. package/src/team-subscription-protocol.ts +6 -4
  239. package/src/teams-projects-protocol.ts +147 -0
  240. package/src/util/analytics.ts +17 -30
  241. package/src/util/garbage-collected-cache.ts +7 -1
  242. package/src/util/generate-workspace-id.spec.ts +17 -0
  243. package/src/util/generate-workspace-id.ts +21 -2
  244. package/src/util/gitpod-cookie.ts +39 -0
  245. package/src/util/gitpod-host-url.ts +11 -11
  246. package/src/util/grpc.ts +15 -0
  247. package/src/util/jaeger-client-types.ts +102 -0
  248. package/src/util/logging.ts +102 -38
  249. package/src/util/parse-workspace-id.spec.ts +21 -1
  250. package/src/util/parse-workspace-id.ts +32 -6
  251. package/src/util/repeat.ts +45 -0
  252. package/src/util/tracing.spec.ts +83 -0
  253. package/src/util/tracing.ts +183 -17
  254. package/src/workspace-cluster.ts +19 -5
  255. package/src/workspace-instance.ts +38 -6
  256. package/src/wsready.ts +1 -1
  257. package/lib/messaging/connection-error-handler.d.ts +0 -27
  258. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  259. package/lib/messaging/connection-error-handler.js +0 -46
  260. package/lib/messaging/connection-error-handler.js.map +0 -1
  261. package/lib/util/context-url.d.ts +0 -13
  262. package/lib/util/context-url.d.ts.map +0 -1
  263. package/lib/util/context-url.js +0 -26
  264. package/lib/util/context-url.js.map +0 -1
  265. package/lib/util/context-url.spec.d.ts.map +0 -1
  266. package/lib/util/context-url.spec.js +0 -52
  267. package/lib/util/context-url.spec.js.map +0 -1
  268. package/lib/util/repeater.d.ts +0 -22
  269. package/lib/util/repeater.d.ts.map +0 -1
  270. package/lib/util/repeater.js +0 -118
  271. package/lib/util/repeater.js.map +0 -1
  272. package/lib/util/safe-promise.d.ts +0 -11
  273. package/lib/util/safe-promise.d.ts.map +0 -1
  274. package/lib/util/safe-promise.js +0 -34
  275. package/lib/util/safe-promise.js.map +0 -1
  276. package/lib/util/without.d.ts +0 -7
  277. package/lib/util/without.d.ts.map +0 -1
  278. package/lib/util/without.js.map +0 -1
  279. package/src/messaging/connection-error-handler.ts +0 -62
  280. package/src/util/context-url.spec.ts +0 -25
  281. package/src/util/context-url.ts +0 -23
  282. package/src/util/jaeger-client.d.ts +0 -105
  283. package/src/util/repeater.ts +0 -49
  284. package/src/util/safe-promise.ts +0 -26
package/src/protocol.ts CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  import { WorkspaceInstance, PortVisibility } from "./workspace-instance";
8
8
  import { RoleOrPermission } from "./permission";
9
+ import { Project } from "./teams-projects-protocol";
9
10
 
10
11
  export interface UserInfo {
11
12
  name?: string
@@ -27,8 +28,6 @@ export interface User {
27
28
 
28
29
  identities: Identity[]
29
30
 
30
- allowsMarketingCommunication: boolean;
31
-
32
31
  /**
33
32
  * Whether the user has been blocked to use our service, because of TOS violation for example.
34
33
  * Optional for backwards compatibility.
@@ -103,14 +102,24 @@ export interface AdditionalUserData {
103
102
  // key is the name of the OAuth client i.e. local app, string the iso date when it was approved
104
103
  // TODO(rl): provide a management UX to allow rescinding of approval
105
104
  oauthClientsApproved?: { [key: string]: string }
105
+ // to remember GH Orgs the user installed/updated the GH App for
106
+ knownGitHubOrgs?: string[];
107
+
108
+ // Git clone URL pointing to the user's dotfile repo
109
+ dotfileRepo?: string;
106
110
  }
107
111
 
108
112
  export interface EmailNotificationSettings {
109
- disallowTransactionalEmails?: boolean;
113
+ allowsChangelogMail?: boolean;
114
+ allowsDevXMail?: boolean;
115
+ allowsOnboardingMail?: boolean;
110
116
  }
111
117
 
112
118
  export type IDESettings = {
113
119
  defaultIde?: string
120
+ useDesktopIde?: boolean
121
+ defaultDesktopIde?: string
122
+ useLatestVersion?: boolean
114
123
  }
115
124
 
116
125
  export interface UserPlatform {
@@ -132,14 +141,6 @@ export interface UserPlatform {
132
141
  }
133
142
 
134
143
  export interface UserFeatureSettings {
135
- /**
136
- * This field is used as marker to grant users a free trial for using private repositories,
137
- * independent of any subscription or Chargebee.
138
- * - it is set when the user uses their first private repo
139
- * - whether the trial is expired or not is juged by the UserService
140
- */
141
- privateRepoTrialStartDate?: string;
142
-
143
144
  /**
144
145
  * Permanent feature flags are added to each and every workspace instance
145
146
  * this user starts.
@@ -154,12 +155,23 @@ export interface UserFeatureSettings {
154
155
  export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
155
156
  export type NamedWorkspaceFeatureFlag = keyof (typeof WorkspaceFeatureFlags);
156
157
 
157
- export interface UserEnvVarValue {
158
- id?: string;
158
+ export interface EnvVarWithValue {
159
159
  name: string;
160
- repositoryPattern: string;
161
160
  value: string;
162
161
  }
162
+
163
+ export interface ProjectEnvVarWithValue extends EnvVarWithValue {
164
+ id: string;
165
+ projectId: string;
166
+ censored: boolean;
167
+ }
168
+
169
+ export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, 'value'>;
170
+
171
+ export interface UserEnvVarValue extends EnvVarWithValue {
172
+ id?: string;
173
+ repositoryPattern: string; // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
174
+ }
163
175
  export interface UserEnvVar extends UserEnvVarValue {
164
176
  id: string;
165
177
  userId: string;
@@ -168,10 +180,12 @@ export interface UserEnvVar extends UserEnvVarValue {
168
180
 
169
181
  export namespace UserEnvVar {
170
182
 
183
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
171
184
  export function normalizeRepoPattern(pattern: string) {
172
185
  return pattern.toLocaleLowerCase();
173
186
  }
174
187
 
188
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
175
189
  export function score(value: UserEnvVarValue): number {
176
190
  // We use a score to enforce precedence:
177
191
  // value/value = 0
@@ -194,6 +208,7 @@ export namespace UserEnvVar {
194
208
  return score;
195
209
  }
196
210
 
211
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
197
212
  export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
198
213
  let result = vars.filter(e => {
199
214
  const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
@@ -241,10 +256,11 @@ export namespace UserEnvVar {
241
256
  return result;
242
257
  }
243
258
 
259
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
244
260
  export function splitRepositoryPattern(repositoryPattern: string): string[] {
245
261
  const patterns = repositoryPattern.split('/');
246
- const repoPattern = patterns.pop() || "";
247
- const ownerPattern = patterns.join('/');
262
+ const repoPattern = patterns.slice(1).join('/')
263
+ const ownerPattern = patterns[0];
248
264
  return [ownerPattern, repoPattern];
249
265
  }
250
266
  }
@@ -375,11 +391,16 @@ export interface PendingGithubEvent {
375
391
  export interface Snapshot {
376
392
  id: string;
377
393
  creationTime: string;
394
+ availableTime?: string;
378
395
  originalWorkspaceId: string;
379
396
  bucketId: string;
380
397
  layoutData?: string;
398
+ state: SnapshotState;
399
+ message?: string;
381
400
  }
382
401
 
402
+ export type SnapshotState = 'pending' | 'available' | 'error';
403
+
383
404
  export interface LayoutData {
384
405
  workspaceId: string;
385
406
  lastUpdatedTime: string;
@@ -392,6 +413,7 @@ export interface Workspace {
392
413
  contextURL: string;
393
414
  description: string;
394
415
  ownerId: string;
416
+ projectId?: string;
395
417
  context: WorkspaceContext;
396
418
  config: WorkspaceConfig;
397
419
 
@@ -555,16 +577,20 @@ export interface WorkspaceConfig {
555
577
  github?: GithubAppConfig;
556
578
  vscode?: VSCodeConfig;
557
579
 
580
+ /** deprecated. Enabled by default **/
581
+ experimentalNetwork?: boolean;
582
+
558
583
  /**
559
584
  * Where the config object originates from.
560
585
  *
561
586
  * repo - from the repository
587
+ * project-db - from the "Project" stored in the database
562
588
  * definitly-gp - from github.com/gitpod-io/definitely-gp
563
589
  * derived - computed based on analyzing the repository
564
590
  * additional-content - config comes from additional content, usually provided through the project's configuration
565
591
  * default - our static catch-all default config
566
592
  */
567
- _origin?: 'repo' | 'definitely-gp' | 'derived' | 'additional-content' | 'default';
593
+ _origin?: 'repo' | 'project-db' | 'definitely-gp' | 'derived' | 'additional-content' | 'default';
568
594
 
569
595
  /**
570
596
  * Set of automatically infered feature flags. That's not something the user can set, but
@@ -581,7 +607,7 @@ export interface GithubAppPrebuildConfig {
581
607
  branches?: boolean
582
608
  pullRequests?: boolean
583
609
  pullRequestsFromForks?: boolean
584
- addCheck?: boolean
610
+ addCheck?: boolean | 'prevent-merge-on-error'
585
611
  addBadge?: boolean
586
612
  addLabel?: boolean | string
587
613
  addComment?: boolean
@@ -629,6 +655,8 @@ export type PrebuiltWorkspaceState
629
655
  export interface PrebuiltWorkspace {
630
656
  id: string;
631
657
  cloneURL: string;
658
+ branch?: string;
659
+ projectId?: string;
632
660
  commit: string;
633
661
  buildWorkspaceId: string;
634
662
  creationTime: string;
@@ -675,6 +703,8 @@ export interface PortConfig {
675
703
  port: number;
676
704
  onOpen?: PortOnOpen;
677
705
  visibility?: PortVisibility;
706
+ description?: string;
707
+ name?: string;
678
708
  }
679
709
  export namespace PortConfig {
680
710
  export function is(config: any): config is PortConfig {
@@ -698,7 +728,7 @@ export interface TaskConfig {
698
728
  init?: string;
699
729
  prebuild?: string;
700
730
  command?: string;
701
- env?: { [env: string]: string };
731
+ env?: { [env: string]: any };
702
732
  openIn?: 'bottom' | 'main' | 'left' | 'right';
703
733
  openMode?: 'split-top' | 'split-left' | 'split-right' | 'split-bottom' | 'tab-before' | 'tab-after';
704
734
  }
@@ -762,6 +792,7 @@ export namespace ExternalImageConfigFile {
762
792
 
763
793
  export interface WorkspaceContext {
764
794
  title: string;
795
+ /** This contains the URL portion of the contextURL (which might contain other modifiers as well). It's optional because it's not set for older workspaces. */
765
796
  normalizedContextURL?: string;
766
797
  forceCreateNewWorkspace?: boolean;
767
798
  forceImageBuild?: boolean;
@@ -784,20 +815,42 @@ export namespace WithSnapshot {
784
815
  }
785
816
  }
786
817
 
787
- export interface WithPrebuild {
788
- snapshotBucketId: string;
818
+ export interface WithPrebuild extends WithSnapshot {
789
819
  prebuildWorkspaceId: string;
790
820
  wasPrebuilt: true;
791
821
  }
792
822
  export namespace WithPrebuild {
793
823
  export function is(context: any): context is WithPrebuild {
794
824
  return context
795
- && 'snapshotBucketId' in context
825
+ && WithSnapshot.is(context)
796
826
  && 'prebuildWorkspaceId' in context
797
827
  && 'wasPrebuilt' in context;
798
828
  }
799
829
  }
800
830
 
831
+ /**
832
+ * WithDefaultConfig contexts disable the download of the gitpod.yml from the repository
833
+ * and fall back to the built-in configuration.
834
+ */
835
+ export interface WithDefaultConfig {
836
+ withDefaultConfig: true;
837
+ }
838
+
839
+ export namespace WithDefaultConfig {
840
+ export function is(context: any): context is WithDefaultConfig {
841
+ return context
842
+ && 'withDefaultConfig' in context
843
+ && context.withDefaultConfig;
844
+ }
845
+
846
+ export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
847
+ return {
848
+ ...ctx,
849
+ withDefaultConfig: true
850
+ }
851
+ }
852
+ }
853
+
801
854
  export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
802
855
  snapshotId: string;
803
856
  }
@@ -813,6 +866,8 @@ export namespace SnapshotContext {
813
866
  export interface StartPrebuildContext extends WorkspaceContext {
814
867
  actual: WorkspaceContext;
815
868
  commitHistory?: string[];
869
+ project?: Project;
870
+ branch?: string;
816
871
  }
817
872
 
818
873
  export namespace StartPrebuildContext {
@@ -836,8 +891,20 @@ export namespace PrebuiltWorkspaceContext {
836
891
  }
837
892
  }
838
893
 
894
+ export interface WithReferrerContext extends WorkspaceContext {
895
+ referrer: string
896
+ referrerIde?: string
897
+ }
898
+
899
+ export namespace WithReferrerContext {
900
+ export function is(context: any): context is WithReferrerContext {
901
+ return context
902
+ && 'referrer' in context;
903
+ }
904
+ }
905
+
839
906
  export interface WithEnvvarsContext extends WorkspaceContext {
840
- envvars: UserEnvVarValue[];
907
+ envvars: EnvVarWithValue[];
841
908
  }
842
909
 
843
910
  export namespace WithEnvvarsContext {
@@ -882,7 +949,7 @@ export interface Commit {
882
949
  refType?: RefType
883
950
  }
884
951
 
885
- export interface AdditionalContentContext {
952
+ export interface AdditionalContentContext extends WorkspaceContext {
886
953
 
887
954
  /**
888
955
  * utf-8 encoded contents that will be copied on top of the workspace's filesystem
@@ -976,6 +1043,19 @@ export interface Repository {
976
1043
  parent: Repository
977
1044
  }
978
1045
  }
1046
+ export interface Branch {
1047
+ name: string;
1048
+ commit: CommitInfo;
1049
+ htmlUrl: string;
1050
+ }
1051
+
1052
+ export interface CommitInfo {
1053
+ author: string;
1054
+ sha: string;
1055
+ commitMessage: string;
1056
+ authorAvatarUrl?: string;
1057
+ authorDate?: string;
1058
+ }
979
1059
 
980
1060
  export namespace Repository {
981
1061
  export function fullRepoName(repo: Repository): string {
@@ -1018,6 +1098,7 @@ export interface WorkspaceCreationResult {
1018
1098
  runningWorkspacePrebuild?: {
1019
1099
  prebuildID: string
1020
1100
  workspaceID: string
1101
+ instanceID: string
1021
1102
  starting: RunningWorkspacePrebuildStarting
1022
1103
  sameCluster: boolean
1023
1104
  }
@@ -1121,39 +1202,6 @@ export namespace AuthProviderEntry {
1121
1202
  }
1122
1203
  }
1123
1204
 
1124
- export interface Branding {
1125
- readonly name: string;
1126
- readonly favicon?: string;
1127
- /** Either including domain OR absolute path (interpreted relative to host URL) */
1128
- readonly logo: string;
1129
- readonly startupLogo: string;
1130
- readonly showProductivityTips: boolean;
1131
- readonly redirectUrlIfNotAuthenticated?: string;
1132
- readonly redirectUrlAfterLogout?: string;
1133
- readonly homepage: string;
1134
- readonly ide?: {
1135
- readonly logo: string;
1136
- readonly showReleaseNotes: boolean;
1137
- readonly helpMenu: Branding.Link[];
1138
- }
1139
- readonly links: {
1140
- readonly header: Branding.Link[];
1141
- readonly footer: Branding.Link[];
1142
- readonly social: Branding.SocialLink[];
1143
- readonly legal: Branding.Link[];
1144
- }
1145
- }
1146
- export namespace Branding {
1147
- export interface Link {
1148
- readonly name: string;
1149
- readonly url: string;
1150
- }
1151
- export interface SocialLink {
1152
- readonly type: string;
1153
- readonly url: string;
1154
- }
1155
- }
1156
-
1157
1205
  export interface Configuration {
1158
1206
  readonly daysBeforeGarbageCollection: number;
1159
1207
  readonly garbageCollectionStartDate: number;
@@ -1194,45 +1242,3 @@ export interface Terms {
1194
1242
  readonly content: string;
1195
1243
  readonly formElements?: object;
1196
1244
  }
1197
-
1198
- export interface Project {
1199
- id: string;
1200
- cloneUrl: string;
1201
- teamId: string;
1202
- appInstallationId: string;
1203
- creationTime: string;
1204
- /** This is a flag that triggers the HARD DELETION of this entity */
1205
- deleted?: boolean;
1206
- }
1207
-
1208
- export interface Team {
1209
- id: string;
1210
- name: string;
1211
- slug: string;
1212
- creationTime: string;
1213
- /** This is a flag that triggers the HARD DELETION of this entity */
1214
- deleted?: boolean;
1215
- }
1216
-
1217
- export type TeamMemberRole = "owner" | "member";
1218
-
1219
- export interface TeamMemberInfo {
1220
- userId: string;
1221
- fullName?: string;
1222
- primaryEmail?: string;
1223
- avatarUrl?: string;
1224
- role: TeamMemberRole;
1225
- memberSince: string;
1226
- }
1227
-
1228
- export interface TeamMembershipInvite {
1229
- id: string;
1230
- teamId: string;
1231
- role: TeamMemberRole;
1232
- creationTime: string;
1233
- invalidationTime: string;
1234
- invitedEmail?: string;
1235
-
1236
- /** This is a flag that triggers the HARD DELETION of this entity */
1237
- deleted?: boolean;
1238
- }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+
7
+ import { suite, test } from "mocha-typescript"
8
+ import * as chai from "chai"
9
+ import { SnapshotUrl } from ".";
10
+
11
+ const expect = chai.expect
12
+
13
+ @suite class TestSnapshotUrlParser {
14
+
15
+ @test public testPositive() {
16
+ const actual = SnapshotUrl.parse("workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar@gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd");
17
+
18
+ expect(actual).to.deep.equal(<SnapshotUrl>{
19
+ bucketId: "gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd",
20
+ filename: "3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
21
+ fullPath: "workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
22
+ });
23
+ }
24
+ }
25
+ module.exports = new TestSnapshotUrlParser() // Only to circumvent no usage warning :-/
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+
7
+ export interface SnapshotUrl {
8
+ bucketId: string;
9
+ fullPath: string;
10
+ filename: string;
11
+ }
12
+ export namespace SnapshotUrl {
13
+ export function parse(url: string): SnapshotUrl {
14
+ const parts = url.split("@");
15
+ if (parts.length !== 2) {
16
+ throw new Error(`cannot parse snapshot URL: ${url}`);
17
+ }
18
+ const [fullPath, bucketId] = parts;
19
+
20
+ const pathParts = fullPath.split("/");
21
+ if (pathParts.length < 1) {
22
+ throw new Error(`cannot parse snapshot URL: ${url}`);
23
+ }
24
+ const filename = pathParts[pathParts.length - 1];
25
+ return { bucketId, fullPath, filename };
26
+ }
27
+ }
@@ -4,8 +4,7 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- import { Without } from "./util/without";
8
- import uuidv4 = require("uuid/v4");
7
+ import { v4 as uuidv4 } from 'uuid';
9
8
  import { Subscription } from "./accounting-protocol";
10
9
 
11
10
  export interface TeamSubscription {
@@ -22,7 +21,7 @@ export interface TeamSubscription {
22
21
  }
23
22
 
24
23
  export namespace TeamSubscription {
25
- export const create = (ts: Without<TeamSubscription, 'id'>): TeamSubscription => {
24
+ export const create = (ts: Omit<TeamSubscription, 'id'>): TeamSubscription => {
26
25
  const withId = ts as TeamSubscription;
27
26
  withId.id = uuidv4();
28
27
  return withId;
@@ -49,7 +48,7 @@ export type TeamSubscriptionSlotAssigned = TeamSubscriptionSlot & TeamSubscripti
49
48
  export type TeamSubscriptionSlotState = 'unassigned' | 'assigned' | 'deactivated' | 'cancelled';
50
49
 
51
50
  export namespace TeamSubscriptionSlot {
52
- export const create = (ts: Without<TeamSubscriptionSlot, 'id'>): TeamSubscriptionSlot => {
51
+ export const create = (ts: Omit<TeamSubscriptionSlot, 'id'>): TeamSubscriptionSlot => {
53
52
  const withId = ts as TeamSubscriptionSlot;
54
53
  withId.id = uuidv4();
55
54
  return withId;
@@ -83,6 +82,9 @@ export namespace TeamSubscriptionSlot {
83
82
  }
84
83
 
85
84
  }
85
+ export const isActive = (slot: TeamSubscriptionSlot): boolean => {
86
+ return !slot.cancellationDate;
87
+ }
86
88
  }
87
89
 
88
90
  /**
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+
7
+ import { PrebuiltWorkspaceState } from "./protocol";
8
+ import { v4 as uuidv4 } from 'uuid';
9
+ import { DeepPartial } from "./util/deep-partial";
10
+
11
+ export interface ProjectConfig {
12
+ '.gitpod.yml': string;
13
+ }
14
+
15
+ export interface ProjectSettings {
16
+ useIncrementalPrebuilds?: boolean;
17
+ }
18
+
19
+ export interface Project {
20
+ id: string;
21
+ name: string;
22
+ slug?: string;
23
+ cloneUrl: string;
24
+ teamId?: string;
25
+ userId?: string;
26
+ appInstallationId: string;
27
+ config?: ProjectConfig;
28
+ settings?: ProjectSettings;
29
+ creationTime: string;
30
+ /** This is a flag that triggers the HARD DELETION of this entity */
31
+ deleted?: boolean;
32
+ markedDeleted?: boolean;
33
+ }
34
+
35
+ export namespace Project {
36
+ export const create = (project: Omit<Project, 'id' | 'creationTime'>): Project => {
37
+ return {
38
+ ...project,
39
+ id: uuidv4(),
40
+ creationTime: new Date().toISOString()
41
+ };
42
+ }
43
+
44
+ export interface Overview {
45
+ branches: BranchDetails[];
46
+ }
47
+
48
+ export namespace Overview {
49
+ export function is(data?: any): data is Project.Overview {
50
+ return Array.isArray(data?.branches);
51
+ }
52
+ }
53
+
54
+ export interface BranchDetails {
55
+ name: string;
56
+ url: string;
57
+ isDefault: boolean;
58
+
59
+ // Latest commit
60
+ changeTitle: string;
61
+ changeDate?: string;
62
+ changeAuthor?: string;
63
+ changeAuthorAvatar?: string;
64
+ changePR?: string;
65
+ changeUrl?: string;
66
+ changeHash: string;
67
+ }
68
+ }
69
+
70
+ export type PartialProject = DeepPartial<Project> & Pick<Project, 'id'>;
71
+
72
+ export interface PrebuildWithStatus {
73
+ info: PrebuildInfo;
74
+ status: PrebuiltWorkspaceState;
75
+ error?: string;
76
+ }
77
+
78
+ export interface PrebuildInfo {
79
+ id: string;
80
+ buildWorkspaceId: string;
81
+ basedOnPrebuildId?: string;
82
+
83
+ teamId?: string;
84
+ userId?: string;
85
+
86
+ projectId: string;
87
+ projectName: string;
88
+
89
+ cloneUrl: string;
90
+ branch: string;
91
+
92
+ startedAt: string;
93
+ startedBy: string;
94
+ startedByAvatar?: string;
95
+
96
+ changeTitle: string;
97
+ changeDate: string;
98
+ changeAuthor: string;
99
+ changeAuthorAvatar?: string;
100
+ changePR?: string;
101
+ changeUrl?: string;
102
+ changeHash: string;
103
+ }
104
+ export namespace PrebuildInfo {
105
+ export function is(data?: any): data is PrebuildInfo {
106
+ return typeof data === "object" && ["id", "buildWorkspaceId", "projectId", "branch"].every(p => p in data);
107
+ }
108
+ }
109
+
110
+ export interface StartPrebuildResult {
111
+ prebuildId: string;
112
+ wsid: string;
113
+ done: boolean;
114
+ }
115
+
116
+ export interface Team {
117
+ id: string;
118
+ name: string;
119
+ slug: string;
120
+ creationTime: string;
121
+ markedDeleted?: boolean;
122
+ /** This is a flag that triggers the HARD DELETION of this entity */
123
+ deleted?: boolean;
124
+ }
125
+
126
+ export type TeamMemberRole = "owner" | "member";
127
+
128
+ export interface TeamMemberInfo {
129
+ userId: string;
130
+ fullName?: string;
131
+ primaryEmail?: string;
132
+ avatarUrl?: string;
133
+ role: TeamMemberRole;
134
+ memberSince: string;
135
+ }
136
+
137
+ export interface TeamMembershipInvite {
138
+ id: string;
139
+ teamId: string;
140
+ role: TeamMemberRole;
141
+ creationTime: string;
142
+ invalidationTime: string;
143
+ invitedEmail?: string;
144
+
145
+ /** This is a flag that triggers the HARD DELETION of this entity */
146
+ deleted?: boolean;
147
+ }