@gitpod/gitpod-protocol 0.1.5-svenefftinge-dashboard-invalid-2274.4 → 0.1.5-tar-telemetry-data-settings.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 (346) hide show
  1. package/data/builtin-theia-plugins.json +28 -18
  2. package/data/gitpod-schema.json +25 -24
  3. package/lib/accounting-protocol.d.ts +155 -0
  4. package/lib/accounting-protocol.d.ts.map +1 -0
  5. package/lib/accounting-protocol.js +109 -0
  6. package/lib/accounting-protocol.js.map +1 -0
  7. package/lib/admin-protocol.d.ts +32 -5
  8. package/lib/admin-protocol.d.ts.map +1 -1
  9. package/lib/admin-protocol.js +16 -1
  10. package/lib/admin-protocol.js.map +1 -1
  11. package/lib/analytics.d.ts +45 -0
  12. package/lib/analytics.d.ts.map +1 -0
  13. package/lib/analytics.js +10 -0
  14. package/lib/analytics.js.map +1 -0
  15. package/lib/auth.d.ts +25 -0
  16. package/lib/auth.d.ts.map +1 -0
  17. package/lib/auth.js +16 -0
  18. package/lib/auth.js.map +1 -0
  19. package/lib/context-url.d.ts +19 -0
  20. package/lib/context-url.d.ts.map +1 -0
  21. package/lib/context-url.js +51 -0
  22. package/lib/context-url.js.map +1 -0
  23. package/lib/context-url.spec.d.ts +12 -0
  24. package/lib/context-url.spec.d.ts.map +1 -0
  25. package/lib/context-url.spec.js +73 -0
  26. package/lib/context-url.spec.js.map +1 -0
  27. package/lib/email-protocol.d.ts +2 -3
  28. package/lib/email-protocol.d.ts.map +1 -1
  29. package/lib/email-protocol.js +5 -5
  30. package/lib/email-protocol.js.map +1 -1
  31. package/lib/encryption/container-module.d.ts +1 -1
  32. package/lib/encryption/container-module.js +6 -5
  33. package/lib/encryption/container-module.js.map +1 -1
  34. package/lib/encryption/encryption-engine.d.ts +1 -1
  35. package/lib/encryption/encryption-engine.js +20 -21
  36. package/lib/encryption/encryption-engine.js.map +1 -1
  37. package/lib/encryption/encryption-engine.spec.d.ts +1 -1
  38. package/lib/encryption/encryption-engine.spec.js +30 -37
  39. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  40. package/lib/encryption/encryption-service.d.ts +1 -1
  41. package/lib/encryption/encryption-service.js +30 -44
  42. package/lib/encryption/encryption-service.js.map +1 -1
  43. package/lib/encryption/key-provider.d.ts +1 -1
  44. package/lib/encryption/key-provider.js +26 -31
  45. package/lib/encryption/key-provider.js.map +1 -1
  46. package/lib/env.d.ts +2 -3
  47. package/lib/env.d.ts.map +1 -1
  48. package/lib/env.js +21 -22
  49. package/lib/env.js.map +1 -1
  50. package/lib/gitpod-file-parser.d.ts +1 -1
  51. package/lib/gitpod-file-parser.js +26 -42
  52. package/lib/gitpod-file-parser.js.map +1 -1
  53. package/lib/gitpod-file-parser.spec.d.ts +1 -1
  54. package/lib/gitpod-file-parser.spec.js +117 -117
  55. package/lib/gitpod-file-parser.spec.js.map +1 -1
  56. package/lib/gitpod-service.d.ts +156 -21
  57. package/lib/gitpod-service.d.ts.map +1 -1
  58. package/lib/gitpod-service.js +171 -257
  59. package/lib/gitpod-service.js.map +1 -1
  60. package/lib/headless-workspace-log.d.ts +9 -12
  61. package/lib/headless-workspace-log.d.ts.map +1 -1
  62. package/lib/headless-workspace-log.js +5 -8
  63. package/lib/headless-workspace-log.js.map +1 -1
  64. package/lib/ide-frontend-service.d.ts +5 -1
  65. package/lib/ide-frontend-service.d.ts.map +1 -1
  66. package/lib/ide-frontend-service.js +1 -1
  67. package/lib/ide-protocol.d.ts +101 -0
  68. package/lib/ide-protocol.d.ts.map +1 -0
  69. package/lib/{util/without.js → ide-protocol.js} +2 -2
  70. package/lib/ide-protocol.js.map +1 -0
  71. package/lib/index.d.ts +7 -1
  72. package/lib/index.d.ts.map +1 -1
  73. package/lib/index.js +8 -2
  74. package/lib/index.js.map +1 -1
  75. package/lib/installation-admin-protocol.d.ts +27 -0
  76. package/lib/installation-admin-protocol.d.ts.map +1 -0
  77. package/lib/installation-admin-protocol.js +30 -0
  78. package/lib/installation-admin-protocol.js.map +1 -0
  79. package/lib/license-protocol.d.ts +1 -1
  80. package/lib/license-protocol.js +1 -1
  81. package/lib/messaging/browser/connection.d.ts +5 -3
  82. package/lib/messaging/browser/connection.d.ts.map +1 -1
  83. package/lib/messaging/browser/connection.js +183 -33
  84. package/lib/messaging/browser/connection.js.map +1 -1
  85. package/lib/messaging/browser/window-connection.d.ts +1 -1
  86. package/lib/messaging/browser/window-connection.js +36 -56
  87. package/lib/messaging/browser/window-connection.js.map +1 -1
  88. package/lib/messaging/client-call-metrics.d.ts +35 -0
  89. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  90. package/lib/messaging/client-call-metrics.js +83 -0
  91. package/lib/messaging/client-call-metrics.js.map +1 -0
  92. package/lib/messaging/connection-error-handler.js +11 -23
  93. package/lib/messaging/connection-error-handler.js.map +1 -1
  94. package/lib/messaging/error.d.ts +7 -2
  95. package/lib/messaging/error.d.ts.map +1 -1
  96. package/lib/messaging/error.js +14 -4
  97. package/lib/messaging/error.js.map +1 -1
  98. package/lib/messaging/handler.d.ts +10 -0
  99. package/lib/messaging/handler.d.ts.map +1 -1
  100. package/lib/messaging/node/connection.d.ts +1 -17
  101. package/lib/messaging/node/connection.d.ts.map +1 -1
  102. package/lib/messaging/node/connection.js +23 -59
  103. package/lib/messaging/node/connection.js.map +1 -1
  104. package/lib/messaging/proxy-factory.d.ts +2 -0
  105. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  106. package/lib/messaging/proxy-factory.js +74 -159
  107. package/lib/messaging/proxy-factory.js.map +1 -1
  108. package/lib/oss-allowlist.d.ts +14 -0
  109. package/lib/oss-allowlist.d.ts.map +1 -0
  110. package/lib/oss-allowlist.js +8 -0
  111. package/lib/oss-allowlist.js.map +1 -0
  112. package/lib/payment-protocol.d.ts +18 -0
  113. package/lib/payment-protocol.d.ts.map +1 -0
  114. package/lib/payment-protocol.js +13 -0
  115. package/lib/payment-protocol.js.map +1 -0
  116. package/lib/permission.d.ts +7 -5
  117. package/lib/permission.d.ts.map +1 -1
  118. package/lib/permission.js +20 -19
  119. package/lib/permission.js.map +1 -1
  120. package/lib/plans.d.ts +210 -0
  121. package/lib/plans.d.ts.map +1 -0
  122. package/lib/plans.js +570 -0
  123. package/lib/plans.js.map +1 -0
  124. package/lib/protocol.d.ts +133 -59
  125. package/lib/protocol.d.ts.map +1 -1
  126. package/lib/protocol.js +129 -118
  127. package/lib/protocol.js.map +1 -1
  128. package/lib/snapshot-url.d.ts +14 -0
  129. package/lib/snapshot-url.d.ts.map +1 -0
  130. package/lib/snapshot-url.js +26 -0
  131. package/lib/snapshot-url.js.map +1 -0
  132. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +3 -4
  133. package/lib/snapshot-url.spec.d.ts.map +1 -0
  134. package/lib/snapshot-url.spec.js +41 -0
  135. package/lib/snapshot-url.spec.js.map +1 -0
  136. package/lib/team-subscription-protocol.d.ts +73 -0
  137. package/lib/team-subscription-protocol.d.ts.map +1 -0
  138. package/lib/team-subscription-protocol.js +63 -0
  139. package/lib/team-subscription-protocol.js.map +1 -0
  140. package/lib/teams-projects-protocol.d.ts +113 -0
  141. package/lib/teams-projects-protocol.d.ts.map +1 -0
  142. package/lib/teams-projects-protocol.js +30 -0
  143. package/lib/teams-projects-protocol.js.map +1 -0
  144. package/lib/theia-plugins.d.ts +1 -1
  145. package/lib/theia-plugins.js +1 -1
  146. package/lib/typings/globals.d.ts +1 -1
  147. package/lib/typings/globals.js +1 -1
  148. package/lib/util/analytics.d.ts +8 -0
  149. package/lib/util/analytics.d.ts.map +1 -0
  150. package/lib/util/analytics.js +79 -0
  151. package/lib/util/analytics.js.map +1 -0
  152. package/lib/util/async-iterator.d.ts +1 -1
  153. package/lib/util/async-iterator.js +56 -134
  154. package/lib/util/async-iterator.js.map +1 -1
  155. package/lib/util/cancelable.d.ts +1 -1
  156. package/lib/util/cancelable.js +18 -60
  157. package/lib/util/cancelable.js.map +1 -1
  158. package/lib/util/date-time.d.ts +1 -1
  159. package/lib/util/date-time.js +9 -9
  160. package/lib/util/date-time.js.map +1 -1
  161. package/lib/util/deep-partial.d.ts +1 -1
  162. package/lib/util/deep-partial.js +1 -1
  163. package/lib/util/deferred.d.ts +1 -1
  164. package/lib/util/deferred.js +11 -13
  165. package/lib/util/deferred.js.map +1 -1
  166. package/lib/util/disposable.js +26 -39
  167. package/lib/util/disposable.js.map +1 -1
  168. package/lib/util/event.js +58 -74
  169. package/lib/util/event.js.map +1 -1
  170. package/lib/util/garbage-collected-cache.d.ts +2 -1
  171. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  172. package/lib/util/garbage-collected-cache.js +27 -47
  173. package/lib/util/garbage-collected-cache.js.map +1 -1
  174. package/lib/util/generate-workspace-id.d.ts +4 -0
  175. package/lib/util/generate-workspace-id.d.ts.map +1 -0
  176. package/lib/util/generate-workspace-id.js +487 -0
  177. package/lib/util/generate-workspace-id.js.map +1 -0
  178. package/lib/util/generate-workspace-id.spec.d.ts +7 -0
  179. package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
  180. package/lib/util/generate-workspace-id.spec.js +87 -0
  181. package/lib/util/generate-workspace-id.spec.js.map +1 -0
  182. package/lib/util/gitpod-cookie.d.ts +20 -0
  183. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  184. package/lib/util/gitpod-cookie.js +44 -0
  185. package/lib/util/gitpod-cookie.js.map +1 -0
  186. package/lib/util/gitpod-host-url.d.ts +5 -3
  187. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  188. package/lib/util/gitpod-host-url.js +99 -92
  189. package/lib/util/gitpod-host-url.js.map +1 -1
  190. package/lib/util/gitpod-host-url.spec.d.ts +16 -0
  191. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -0
  192. package/lib/util/gitpod-host-url.spec.js +124 -0
  193. package/lib/util/gitpod-host-url.spec.js.map +1 -0
  194. package/lib/util/grpc.d.ts +15 -0
  195. package/lib/util/grpc.d.ts.map +1 -0
  196. package/lib/util/grpc.js +18 -0
  197. package/lib/util/grpc.js.map +1 -0
  198. package/lib/util/jaeger-client-types.d.ts +68 -0
  199. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  200. package/lib/util/jaeger-client-types.js +8 -0
  201. package/lib/util/jaeger-client-types.js.map +1 -0
  202. package/lib/util/logging.d.ts +57 -34
  203. package/lib/util/logging.d.ts.map +1 -1
  204. package/lib/util/logging.js +119 -111
  205. package/lib/util/logging.js.map +1 -1
  206. package/lib/util/make-link.d.ts +1 -1
  207. package/lib/util/make-link.js +3 -3
  208. package/lib/util/make-link.js.map +1 -1
  209. package/lib/util/parse-workspace-id.d.ts +14 -4
  210. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  211. package/lib/util/parse-workspace-id.js +39 -9
  212. package/lib/util/parse-workspace-id.js.map +1 -1
  213. package/lib/util/parse-workspace-id.spec.d.ts +9 -1
  214. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  215. package/lib/util/parse-workspace-id.spec.js +128 -48
  216. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  217. package/lib/util/queue.d.ts +1 -1
  218. package/lib/util/queue.js +17 -56
  219. package/lib/util/queue.js.map +1 -1
  220. package/lib/util/queue.spec.d.ts +1 -1
  221. package/lib/util/queue.spec.js +145 -289
  222. package/lib/util/queue.spec.js.map +1 -1
  223. package/lib/util/repeat.d.ts +15 -0
  224. package/lib/util/repeat.d.ts.map +1 -0
  225. package/lib/util/repeat.js +55 -0
  226. package/lib/util/repeat.js.map +1 -0
  227. package/lib/util/semaphore.d.ts +1 -1
  228. package/lib/util/semaphore.js +16 -47
  229. package/lib/util/semaphore.js.map +1 -1
  230. package/lib/util/skip-if.d.ts +1 -1
  231. package/lib/util/skip-if.js +7 -7
  232. package/lib/util/skip-if.js.map +1 -1
  233. package/lib/util/timeutil.d.ts +1 -1
  234. package/lib/util/timeutil.js +29 -17
  235. package/lib/util/timeutil.js.map +1 -1
  236. package/lib/util/timeutil.spec.d.ts +1 -1
  237. package/lib/util/timeutil.spec.js +22 -25
  238. package/lib/util/timeutil.spec.js.map +1 -1
  239. package/lib/util/tracing.d.ts +52 -6
  240. package/lib/util/tracing.d.ts.map +1 -1
  241. package/lib/util/tracing.js +197 -63
  242. package/lib/util/tracing.js.map +1 -1
  243. package/lib/util/tracing.spec.d.ts +7 -0
  244. package/lib/util/tracing.spec.d.ts.map +1 -0
  245. package/lib/util/tracing.spec.js +121 -0
  246. package/lib/util/tracing.spec.js.map +1 -0
  247. package/lib/util/workspace-port-authentication.d.ts +1 -1
  248. package/lib/util/workspace-port-authentication.js +4 -3
  249. package/lib/util/workspace-port-authentication.js.map +1 -1
  250. package/lib/workspace-cluster.d.ts +71 -0
  251. package/lib/workspace-cluster.d.ts.map +1 -0
  252. package/lib/workspace-cluster.js +16 -0
  253. package/lib/workspace-cluster.js.map +1 -0
  254. package/lib/workspace-instance.d.ts +27 -3
  255. package/lib/workspace-instance.d.ts.map +1 -1
  256. package/lib/workspace-instance.js +1 -1
  257. package/lib/wsready.d.ts +1 -1
  258. package/lib/wsready.js +2 -2
  259. package/package.json +33 -17
  260. package/pkg-yarn.lock +18 -9
  261. package/provenance-bundle.jsonl +2 -0
  262. package/src/accounting-protocol.ts +229 -0
  263. package/src/admin-protocol.ts +54 -6
  264. package/src/analytics.ts +54 -0
  265. package/src/auth.ts +27 -0
  266. package/src/context-url.spec.ts +39 -0
  267. package/src/context-url.ts +53 -0
  268. package/src/email-protocol.ts +3 -4
  269. package/src/encryption/container-module.ts +1 -1
  270. package/src/encryption/encryption-engine.spec.ts +1 -1
  271. package/src/encryption/encryption-engine.ts +1 -1
  272. package/src/encryption/encryption-service.ts +1 -1
  273. package/src/encryption/key-provider.ts +1 -1
  274. package/src/env.ts +11 -11
  275. package/src/gitpod-file-parser.spec.ts +1 -1
  276. package/src/gitpod-file-parser.ts +1 -1
  277. package/src/gitpod-service.ts +230 -40
  278. package/src/headless-workspace-log.ts +8 -12
  279. package/src/ide-frontend-service.ts +6 -2
  280. package/src/ide-protocol.ts +114 -0
  281. package/src/index.ts +8 -2
  282. package/src/installation-admin-protocol.ts +42 -0
  283. package/src/license-protocol.ts +1 -1
  284. package/src/messaging/browser/connection.ts +195 -14
  285. package/src/messaging/browser/window-connection.ts +1 -1
  286. package/src/messaging/client-call-metrics.ts +97 -0
  287. package/src/messaging/error.ts +19 -4
  288. package/src/messaging/handler.ts +12 -0
  289. package/src/messaging/node/connection.ts +21 -68
  290. package/src/messaging/proxy-factory.ts +14 -6
  291. package/src/oss-allowlist.ts +15 -0
  292. package/src/payment-protocol.ts +20 -0
  293. package/src/permission.ts +9 -8
  294. package/src/plans.ts +632 -0
  295. package/src/protocol.ts +222 -88
  296. package/src/snapshot-url.spec.ts +25 -0
  297. package/src/snapshot-url.ts +27 -0
  298. package/src/team-subscription-protocol.ts +113 -0
  299. package/src/teams-projects-protocol.ts +147 -0
  300. package/src/theia-plugins.ts +1 -1
  301. package/src/typings/globals.ts +1 -1
  302. package/src/util/analytics.ts +87 -0
  303. package/src/util/async-iterator.ts +1 -1
  304. package/src/util/cancelable.ts +1 -1
  305. package/src/util/date-time.ts +1 -1
  306. package/src/util/deep-partial.ts +1 -1
  307. package/src/util/deferred.ts +2 -2
  308. package/src/util/garbage-collected-cache.ts +10 -4
  309. package/src/util/generate-workspace-id.spec.ts +48 -0
  310. package/src/util/generate-workspace-id.ts +475 -0
  311. package/src/util/gitpod-cookie.ts +39 -0
  312. package/src/util/gitpod-host-url.spec.ts +49 -0
  313. package/src/util/gitpod-host-url.ts +36 -14
  314. package/src/util/grpc.ts +15 -0
  315. package/src/util/jaeger-client-types.ts +102 -0
  316. package/src/util/logging.ts +111 -39
  317. package/src/util/make-link.ts +1 -1
  318. package/src/util/parse-workspace-id.spec.ts +46 -5
  319. package/src/util/parse-workspace-id.ts +39 -8
  320. package/src/util/queue.spec.ts +2 -2
  321. package/src/util/queue.ts +1 -1
  322. package/src/util/repeat.ts +45 -0
  323. package/src/util/semaphore.ts +3 -3
  324. package/src/util/skip-if.ts +2 -2
  325. package/src/util/timeutil.spec.ts +1 -1
  326. package/src/util/timeutil.ts +5 -5
  327. package/src/util/tracing.spec.ts +83 -0
  328. package/src/util/tracing.ts +184 -19
  329. package/src/util/workspace-port-authentication.ts +1 -1
  330. package/src/workspace-cluster.ts +91 -0
  331. package/src/workspace-instance.ts +52 -14
  332. package/src/wsready.ts +2 -2
  333. package/lib/util/repeater.d.ts +0 -22
  334. package/lib/util/repeater.d.ts.map +0 -1
  335. package/lib/util/repeater.js +0 -118
  336. package/lib/util/repeater.js.map +0 -1
  337. package/lib/util/safe-promise.d.ts +0 -11
  338. package/lib/util/safe-promise.d.ts.map +0 -1
  339. package/lib/util/safe-promise.js +0 -34
  340. package/lib/util/safe-promise.js.map +0 -1
  341. package/lib/util/without.d.ts +0 -7
  342. package/lib/util/without.d.ts.map +0 -1
  343. package/lib/util/without.js.map +0 -1
  344. package/src/util/jaeger-client.d.ts +0 -105
  345. package/src/util/repeater.ts +0 -49
  346. package/src/util/safe-promise.ts +0 -26
package/src/protocol.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  /**
2
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
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,19 +28,12 @@ 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.
35
34
  */
36
35
  blocked?: boolean;
37
36
 
38
- /**
39
- * whether this user can run workspaces in privileged mode
40
- */
41
- privileged?: boolean;
42
-
43
37
  /** A map of random settings that alter the behaviour of Gitpod on a per-user basis */
44
38
  featureFlags?: UserFeatureSettings;
45
39
 
@@ -61,6 +55,20 @@ export namespace User {
61
55
  export function getIdentity(user: User, authProviderId: string): Identity | undefined {
62
56
  return user.identities.find(id => id.authProviderId === authProviderId);
63
57
  }
58
+ export function censor(user: User): User {
59
+ const res = { ...user };
60
+ delete (res.additionalData);
61
+ res.identities = res.identities.map(i => {
62
+ delete (i.tokens);
63
+
64
+ // The user field is not in the Identity shape, but actually exists on DBIdentity.
65
+ // Trying to push this object out via JSON RPC will fail because of the cyclic nature
66
+ // of this field.
67
+ delete ((i as any).user);
68
+ return i;
69
+ });
70
+ return res;
71
+ }
64
72
  export function getPrimaryEmail(user: User): string {
65
73
  const identities = user.identities.filter(i => !!i.primaryEmail);
66
74
  if (identities.length <= 0) {
@@ -89,14 +97,28 @@ export interface AdditionalUserData {
89
97
  emailNotificationSettings?: EmailNotificationSettings;
90
98
  featurePreview?: boolean;
91
99
  ideSettings?: IDESettings;
100
+ // key is the name of the news, string the iso date when it was seen
101
+ whatsNewSeen?: { [key: string]: string }
102
+ // key is the name of the OAuth client i.e. local app, string the iso date when it was approved
103
+ // TODO(rl): provide a management UX to allow rescinding of approval
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;
92
110
  }
93
111
 
94
112
  export interface EmailNotificationSettings {
95
- disallowTransactionalEmails?: boolean;
113
+ allowsChangelogMail?: boolean;
114
+ allowsDevXMail?: boolean;
115
+ allowsOnboardingMail?: boolean;
96
116
  }
97
117
 
98
118
  export type IDESettings = {
99
119
  defaultIde?: string
120
+ useDesktopIde?: boolean
121
+ defaultDesktopIde?: string
100
122
  }
101
123
 
102
124
  export interface UserPlatform {
@@ -118,14 +140,6 @@ export interface UserPlatform {
118
140
  }
119
141
 
120
142
  export interface UserFeatureSettings {
121
- /**
122
- * This field is used as marker to grant users a free trial for using private repositories,
123
- * independent of any subscription or Chargebee.
124
- * - it is set when the user uses their first private repo
125
- * - whether the trial is expired or not is juged by the UserService
126
- */
127
- privateRepoTrialStartDate?: string;
128
-
129
143
  /**
130
144
  * Permanent feature flags are added to each and every workspace instance
131
145
  * this user starts.
@@ -137,15 +151,26 @@ export interface UserFeatureSettings {
137
151
  * The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
138
152
  * If they don't we'll break things during workspace startup.
139
153
  */
140
- export const WorkspaceFeatureFlags = { "privileged": undefined, "registry_facade": undefined, "full_workspace_backup": undefined, "fixed_resources": undefined, "user_namespace": undefined };
154
+ export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
141
155
  export type NamedWorkspaceFeatureFlag = keyof (typeof WorkspaceFeatureFlags);
142
156
 
143
- export interface UserEnvVarValue {
144
- id?: string;
157
+ export interface EnvVarWithValue {
145
158
  name: string;
146
- repositoryPattern: string;
147
159
  value: string;
148
160
  }
161
+
162
+ export interface ProjectEnvVarWithValue extends EnvVarWithValue {
163
+ id: string;
164
+ projectId: string;
165
+ censored: boolean;
166
+ }
167
+
168
+ export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, 'value'>;
169
+
170
+ export interface UserEnvVarValue extends EnvVarWithValue {
171
+ id?: string;
172
+ repositoryPattern: string; // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
173
+ }
149
174
  export interface UserEnvVar extends UserEnvVarValue {
150
175
  id: string;
151
176
  userId: string;
@@ -154,10 +179,35 @@ export interface UserEnvVar extends UserEnvVarValue {
154
179
 
155
180
  export namespace UserEnvVar {
156
181
 
182
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
157
183
  export function normalizeRepoPattern(pattern: string) {
158
184
  return pattern.toLocaleLowerCase();
159
185
  }
160
186
 
187
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
188
+ export function score(value: UserEnvVarValue): number {
189
+ // We use a score to enforce precedence:
190
+ // value/value = 0
191
+ // value/* = 1
192
+ // */value = 2
193
+ // */* = 3
194
+ // #/# = 4 (used for env vars passed through the URL)
195
+ // the lower the score, the higher the precedence.
196
+ const [ownerPattern, repoPattern] = splitRepositoryPattern(value.repositoryPattern);
197
+ let score = 0;
198
+ if (repoPattern == "*") {
199
+ score += 1;
200
+ }
201
+ if (ownerPattern == '*') {
202
+ score += 2;
203
+ }
204
+ if (ownerPattern == "#" || repoPattern == "#") {
205
+ score = 4;
206
+ }
207
+ return score;
208
+ }
209
+
210
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
161
211
  export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
162
212
  let result = vars.filter(e => {
163
213
  const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
@@ -193,25 +243,7 @@ export namespace UserEnvVar {
193
243
  let minscore = 10;
194
244
  let bestCandidate: T | undefined;
195
245
  for (const e of candidates) {
196
- // We use a score to enforce precedence:
197
- // value/value = 0
198
- // value/* = 1
199
- // */value = 2
200
- // */* = 3
201
- // #/# = 4 (used for env vars passed through the URL)
202
- // the lower the score, the higher the precedence.
203
- const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
204
- let score = 0;
205
- if (repoPattern == "*") {
206
- score += 1;
207
- }
208
- if (ownerPattern == '*') {
209
- score += 2;
210
- }
211
- if (ownerPattern == "#" || repoPattern == "#") {
212
- score = 4;
213
- }
214
-
246
+ const score = UserEnvVar.score(e);
215
247
  if (!bestCandidate || score < minscore) {
216
248
  minscore = score;
217
249
  bestCandidate = e;
@@ -223,10 +255,11 @@ export namespace UserEnvVar {
223
255
  return result;
224
256
  }
225
257
 
226
- function splitRepositoryPattern(repositoryPattern: string): string[] {
258
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
259
+ export function splitRepositoryPattern(repositoryPattern: string): string[] {
227
260
  const patterns = repositoryPattern.split('/');
228
- const repoPattern = patterns.pop() || "";
229
- const ownerPattern = patterns.join('/');
261
+ const repoPattern = patterns.slice(1).join('/')
262
+ const ownerPattern = patterns[0];
230
263
  return [ownerPattern, repoPattern];
231
264
  }
232
265
  }
@@ -357,11 +390,16 @@ export interface PendingGithubEvent {
357
390
  export interface Snapshot {
358
391
  id: string;
359
392
  creationTime: string;
393
+ availableTime?: string;
360
394
  originalWorkspaceId: string;
361
395
  bucketId: string;
362
396
  layoutData?: string;
397
+ state: SnapshotState;
398
+ message?: string;
363
399
  }
364
400
 
401
+ export type SnapshotState = 'pending' | 'available' | 'error';
402
+
365
403
  export interface LayoutData {
366
404
  workspaceId: string;
367
405
  lastUpdatedTime: string;
@@ -374,6 +412,7 @@ export interface Workspace {
374
412
  contextURL: string;
375
413
  description: string;
376
414
  ownerId: string;
415
+ projectId?: string;
377
416
  context: WorkspaceContext;
378
417
  config: WorkspaceConfig;
379
418
 
@@ -482,6 +521,7 @@ export interface PreparePluginUploadParams {
482
521
  export interface ResolvePluginsParams {
483
522
  config?: WorkspaceConfig
484
523
  builtins?: ResolvedPlugins
524
+ vsxRegistryUrl?: string
485
525
  }
486
526
 
487
527
  export interface InstallPluginsParams {
@@ -492,6 +532,24 @@ export interface UninstallPluginParams {
492
532
  pluginId: string;
493
533
  }
494
534
 
535
+ export interface GuessGitTokenScopesParams {
536
+ host: string
537
+ repoUrl: string
538
+ gitCommand: string
539
+ currentToken: GitToken
540
+ }
541
+
542
+ export interface GitToken {
543
+ token: string
544
+ user: string
545
+ scopes: string[]
546
+ }
547
+
548
+ export interface GuessedGitTokenScopes {
549
+ message?: string
550
+ scopes?: string[]
551
+ }
552
+
495
553
  export type ResolvedPluginKind = 'user' | 'workspace' | 'builtin';
496
554
 
497
555
  export interface ResolvedPlugins {
@@ -517,16 +575,21 @@ export interface WorkspaceConfig {
517
575
  gitConfig?: { [config: string]: string };
518
576
  github?: GithubAppConfig;
519
577
  vscode?: VSCodeConfig;
520
-
578
+
579
+ /** deprecated. Enabled by default **/
580
+ experimentalNetwork?: boolean;
581
+
521
582
  /**
522
583
  * Where the config object originates from.
523
- *
584
+ *
524
585
  * repo - from the repository
586
+ * project-db - from the "Project" stored in the database
525
587
  * definitly-gp - from github.com/gitpod-io/definitely-gp
526
588
  * derived - computed based on analyzing the repository
589
+ * additional-content - config comes from additional content, usually provided through the project's configuration
527
590
  * default - our static catch-all default config
528
591
  */
529
- _origin?: 'repo' | 'definitely-gp' | 'derived' | 'default';
592
+ _origin?: 'repo' | 'project-db' | 'definitely-gp' | 'derived' | 'additional-content' | 'default';
530
593
 
531
594
  /**
532
595
  * Set of automatically infered feature flags. That's not something the user can set, but
@@ -543,7 +606,7 @@ export interface GithubAppPrebuildConfig {
543
606
  branches?: boolean
544
607
  pullRequests?: boolean
545
608
  pullRequestsFromForks?: boolean
546
- addCheck?: boolean
609
+ addCheck?: boolean | 'prevent-merge-on-error'
547
610
  addBadge?: boolean
548
611
  addLabel?: boolean | string
549
612
  addComment?: boolean
@@ -556,16 +619,13 @@ export namespace GithubAppPrebuildConfig {
556
619
 
557
620
  export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
558
621
  export interface WorkspaceImageSourceDocker {
559
- // TODO: clean this up. We should have the commit and an ImageSource in here, not duplicate the whole thing again.
560
- // We have a ton of those objects in the database, thus cleaning this up means lengthy DB migrations. Yuck.
561
- dockerFileHash: string
562
- dockerFileSource: Commit
563
622
  dockerFilePath: string
623
+ dockerFileHash: string
624
+ dockerFileSource?: Commit
564
625
  }
565
626
  export namespace WorkspaceImageSourceDocker {
566
627
  export function is(obj: object): obj is WorkspaceImageSourceDocker {
567
628
  return 'dockerFileHash' in obj
568
- && 'dockerFileSource' in obj
569
629
  && 'dockerFilePath' in obj;
570
630
  }
571
631
  }
@@ -594,6 +654,8 @@ export type PrebuiltWorkspaceState
594
654
  export interface PrebuiltWorkspace {
595
655
  id: string;
596
656
  cloneURL: string;
657
+ branch?: string;
658
+ projectId?: string;
597
659
  commit: string;
598
660
  buildWorkspaceId: string;
599
661
  creationTime: string;
@@ -604,7 +666,7 @@ export interface PrebuiltWorkspace {
604
666
 
605
667
  export namespace PrebuiltWorkspace {
606
668
  export function isDone(pws: PrebuiltWorkspace) {
607
- return pws.state === "available" || pws.state === "timeout" || pws.state === 'aborted';
669
+ return pws.state === "available" || pws.state === "timeout" || pws.state === 'aborted';
608
670
  }
609
671
 
610
672
  export function isAvailable(pws: PrebuiltWorkspace) {
@@ -640,6 +702,8 @@ export interface PortConfig {
640
702
  port: number;
641
703
  onOpen?: PortOnOpen;
642
704
  visibility?: PortVisibility;
705
+ description?: string;
706
+ name?: string;
643
707
  }
644
708
  export namespace PortConfig {
645
709
  export function is(config: any): config is PortConfig {
@@ -663,7 +727,7 @@ export interface TaskConfig {
663
727
  init?: string;
664
728
  prebuild?: string;
665
729
  command?: string;
666
- env?: { [env: string]: string };
730
+ env?: { [env: string]: any };
667
731
  openIn?: 'bottom' | 'main' | 'left' | 'right';
668
732
  openMode?: 'split-top' | 'split-left' | 'split-right' | 'split-bottom' | 'tab-before' | 'tab-after';
669
733
  }
@@ -727,8 +791,10 @@ export namespace ExternalImageConfigFile {
727
791
 
728
792
  export interface WorkspaceContext {
729
793
  title: string;
794
+ /** 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. */
730
795
  normalizedContextURL?: string;
731
796
  forceCreateNewWorkspace?: boolean;
797
+ forceImageBuild?: boolean;
732
798
  }
733
799
 
734
800
  export namespace WorkspaceContext {
@@ -762,6 +828,29 @@ export namespace WithPrebuild {
762
828
  }
763
829
  }
764
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
+
765
854
  export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
766
855
  snapshotId: string;
767
856
  }
@@ -776,6 +865,9 @@ export namespace SnapshotContext {
776
865
 
777
866
  export interface StartPrebuildContext extends WorkspaceContext {
778
867
  actual: WorkspaceContext;
868
+ commitHistory?: string[];
869
+ project?: Project;
870
+ branch?: string;
779
871
  }
780
872
 
781
873
  export namespace StartPrebuildContext {
@@ -799,8 +891,20 @@ export namespace PrebuiltWorkspaceContext {
799
891
  }
800
892
  }
801
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
+
802
906
  export interface WithEnvvarsContext extends WorkspaceContext {
803
- envvars: UserEnvVarValue[];
907
+ envvars: EnvVarWithValue[];
804
908
  }
805
909
 
806
910
  export namespace WithEnvvarsContext {
@@ -845,6 +949,25 @@ export interface Commit {
845
949
  refType?: RefType
846
950
  }
847
951
 
952
+ export interface AdditionalContentContext extends WorkspaceContext {
953
+
954
+ /**
955
+ * utf-8 encoded contents that will be copied on top of the workspace's filesystem
956
+ */
957
+ additionalFiles: {[filePath: string]: string};
958
+
959
+ }
960
+
961
+ export namespace AdditionalContentContext {
962
+ export function is(ctx: any): ctx is AdditionalContentContext {
963
+ return 'additionalFiles' in ctx;
964
+ }
965
+
966
+ export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
967
+ return is(ctx) && ImageConfigFile.is(config.image) && !!ctx.additionalFiles[config.image.file];
968
+ }
969
+ }
970
+
848
971
  export interface CommitContext extends WorkspaceContext, Commit {
849
972
  /** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
850
973
  cloneUrl?: string
@@ -920,6 +1043,19 @@ export interface Repository {
920
1043
  parent: Repository
921
1044
  }
922
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
+ }
923
1059
 
924
1060
  export namespace Repository {
925
1061
  export function fullRepoName(repo: Repository): string {
@@ -947,6 +1083,12 @@ export interface WorkspaceInfo {
947
1083
  latestInstance?: WorkspaceInstance
948
1084
  }
949
1085
 
1086
+ export namespace WorkspaceInfo {
1087
+ export function lastActiveISODate(info: WorkspaceInfo): string {
1088
+ return info.latestInstance?.creationTime || info.workspace.creationTime;
1089
+ }
1090
+ }
1091
+
950
1092
  export type RunningWorkspaceInfo = WorkspaceInfo & { latestInstance: WorkspaceInstance };
951
1093
 
952
1094
  export interface WorkspaceCreationResult {
@@ -956,6 +1098,7 @@ export interface WorkspaceCreationResult {
956
1098
  runningWorkspacePrebuild?: {
957
1099
  prebuildID: string
958
1100
  workspaceID: string
1101
+ instanceID: string
959
1102
  starting: RunningWorkspacePrebuildStarting
960
1103
  sameCluster: boolean
961
1104
  }
@@ -1046,40 +1189,16 @@ export interface OAuth2Config {
1046
1189
  export namespace AuthProviderEntry {
1047
1190
  export type Type = "GitHub" | "GitLab" | string;
1048
1191
  export type Status = "pending" | "verified";
1049
- export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type">;
1192
+ export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & { clientId?: string, clientSecret?: string };
1050
1193
  export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> & Pick<OAuth2Config, "clientId" | "clientSecret">;
1051
- }
1052
-
1053
- export interface Branding {
1054
- readonly name: string;
1055
- readonly favicon?: string;
1056
- /** Either including domain OR absolute path (interpreted relative to host URL) */
1057
- readonly logo: string;
1058
- readonly startupLogo: string;
1059
- readonly showProductivityTips: boolean;
1060
- readonly redirectUrlIfNotAuthenticated?: string;
1061
- readonly redirectUrlAfterLogout?: string;
1062
- readonly homepage: string;
1063
- readonly ide?: {
1064
- readonly logo: string;
1065
- readonly showReleaseNotes: boolean;
1066
- readonly helpMenu: Branding.Link[];
1067
- }
1068
- readonly links: {
1069
- readonly header: Branding.Link[];
1070
- readonly footer: Branding.Link[];
1071
- readonly social: Branding.SocialLink[];
1072
- readonly legal: Branding.Link[];
1073
- }
1074
- }
1075
- export namespace Branding {
1076
- export interface Link {
1077
- readonly name: string;
1078
- readonly url: string;
1079
- }
1080
- export interface SocialLink {
1081
- readonly type: string;
1082
- readonly url: string;
1194
+ export function redact(entry: AuthProviderEntry): AuthProviderEntry {
1195
+ return {
1196
+ ...entry,
1197
+ oauth: {
1198
+ ...entry.oauth,
1199
+ clientSecret: "redacted"
1200
+ }
1201
+ }
1083
1202
  }
1084
1203
  }
1085
1204
 
@@ -1108,3 +1227,18 @@ export namespace TheiaPlugin {
1108
1227
  CheckinFailed = "checkin-failed",
1109
1228
  }
1110
1229
  }
1230
+
1231
+ export interface TermsAcceptanceEntry {
1232
+ readonly userId: string;
1233
+ readonly termsRevision: string;
1234
+ readonly acceptionTime: string;
1235
+ }
1236
+
1237
+ export interface Terms {
1238
+ readonly revision: string;
1239
+ readonly activeSince: string;
1240
+ readonly adminOnlyTerms: boolean;
1241
+ readonly updateMessage: string;
1242
+ readonly content: string;
1243
+ readonly formElements?: object;
1244
+ }
@@ -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
+ }