@gitpod/gitpod-protocol 0.1.5-wth-test.41 → 0.1.5-wv-add-image-builds-to-dashboard.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 (431) hide show
  1. package/data/gitpod-schema.json +150 -8
  2. package/lib/accounting-protocol.d.ts +19 -11
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +35 -33
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +29 -1
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +1 -1
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +5 -6
  11. package/lib/analytics.d.ts.map +1 -1
  12. package/lib/analytics.js +1 -1
  13. package/lib/analytics.js.map +1 -1
  14. package/lib/attribution.d.ts +24 -0
  15. package/lib/attribution.d.ts.map +1 -0
  16. package/lib/attribution.js +54 -0
  17. package/lib/attribution.js.map +1 -0
  18. package/lib/auth.d.ts +1 -1
  19. package/lib/auth.d.ts.map +1 -1
  20. package/lib/auth.js +1 -1
  21. package/lib/billing-mode.d.ts +45 -0
  22. package/lib/billing-mode.d.ts.map +1 -0
  23. package/lib/billing-mode.js +44 -0
  24. package/lib/billing-mode.js.map +1 -0
  25. package/lib/blocked-repositories-protocol.d.ts +13 -0
  26. package/lib/blocked-repositories-protocol.d.ts.map +1 -0
  27. package/lib/blocked-repositories-protocol.js +8 -0
  28. package/lib/blocked-repositories-protocol.js.map +1 -0
  29. package/lib/context-url.d.ts +19 -7
  30. package/lib/context-url.d.ts.map +1 -1
  31. package/lib/context-url.js +60 -9
  32. package/lib/context-url.js.map +1 -1
  33. package/lib/context-url.spec.d.ts +3 -3
  34. package/lib/context-url.spec.d.ts.map +1 -1
  35. package/lib/context-url.spec.js +20 -12
  36. package/lib/context-url.spec.js.map +1 -1
  37. package/lib/encryption/container-module.d.ts +1 -1
  38. package/lib/encryption/container-module.d.ts.map +1 -1
  39. package/lib/encryption/container-module.js +2 -2
  40. package/lib/encryption/container-module.js.map +1 -1
  41. package/lib/encryption/encryption-engine.d.ts +1 -1
  42. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  43. package/lib/encryption/encryption-engine.js +10 -10
  44. package/lib/encryption/encryption-engine.js.map +1 -1
  45. package/lib/encryption/encryption-engine.spec.d.ts +1 -1
  46. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  47. package/lib/encryption/encryption-engine.spec.js +3 -4
  48. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  49. package/lib/encryption/encryption-service.d.ts +1 -1
  50. package/lib/encryption/encryption-service.d.ts.map +1 -1
  51. package/lib/encryption/encryption-service.js +2 -2
  52. package/lib/encryption/encryption-service.js.map +1 -1
  53. package/lib/encryption/key-provider.d.ts +1 -1
  54. package/lib/encryption/key-provider.d.ts.map +1 -1
  55. package/lib/encryption/key-provider.js +8 -10
  56. package/lib/encryption/key-provider.js.map +1 -1
  57. package/lib/env.d.ts +1 -6
  58. package/lib/env.d.ts.map +1 -1
  59. package/lib/env.js +2 -21
  60. package/lib/env.js.map +1 -1
  61. package/lib/experiments/always-default.d.ts +8 -0
  62. package/lib/experiments/always-default.d.ts.map +1 -0
  63. package/lib/experiments/always-default.js +20 -0
  64. package/lib/experiments/always-default.js.map +1 -0
  65. package/lib/experiments/configcat-server.d.ts +10 -0
  66. package/lib/experiments/configcat-server.d.ts.map +1 -0
  67. package/lib/experiments/configcat-server.js +37 -0
  68. package/lib/experiments/configcat-server.js.map +1 -0
  69. package/lib/experiments/configcat.d.ts +21 -0
  70. package/lib/experiments/configcat.d.ts.map +1 -0
  71. package/lib/experiments/configcat.js +51 -0
  72. package/lib/experiments/configcat.js.map +1 -0
  73. package/lib/experiments/types.d.ts +22 -0
  74. package/lib/experiments/types.d.ts.map +1 -0
  75. package/lib/experiments/types.js +10 -0
  76. package/lib/experiments/types.js.map +1 -0
  77. package/lib/gitpod-file-parser.d.ts +1 -1
  78. package/lib/gitpod-file-parser.d.ts.map +1 -1
  79. package/lib/gitpod-file-parser.js +7 -7
  80. package/lib/gitpod-file-parser.js.map +1 -1
  81. package/lib/gitpod-file-parser.spec.d.ts +1 -1
  82. package/lib/gitpod-file-parser.spec.js +43 -40
  83. package/lib/gitpod-file-parser.spec.js.map +1 -1
  84. package/lib/gitpod-service.d.ts +93 -48
  85. package/lib/gitpod-service.d.ts.map +1 -1
  86. package/lib/gitpod-service.js +57 -36
  87. package/lib/gitpod-service.js.map +1 -1
  88. package/lib/headless-workspace-log.d.ts +2 -1
  89. package/lib/headless-workspace-log.d.ts.map +1 -1
  90. package/lib/headless-workspace-log.js +3 -2
  91. package/lib/headless-workspace-log.js.map +1 -1
  92. package/lib/ide-frontend-service.d.ts +2 -2
  93. package/lib/ide-frontend-service.js +1 -1
  94. package/lib/ide-protocol.d.ts +126 -0
  95. package/lib/ide-protocol.d.ts.map +1 -0
  96. package/lib/ide-protocol.js +18 -0
  97. package/lib/ide-protocol.js.map +1 -0
  98. package/lib/index.d.ts +17 -15
  99. package/lib/index.d.ts.map +1 -1
  100. package/lib/index.js +4 -2
  101. package/lib/index.js.map +1 -1
  102. package/lib/installation-admin-protocol.d.ts +30 -0
  103. package/lib/installation-admin-protocol.d.ts.map +1 -0
  104. package/lib/installation-admin-protocol.js +31 -0
  105. package/lib/installation-admin-protocol.js.map +1 -0
  106. package/lib/license-protocol.d.ts +8 -1
  107. package/lib/license-protocol.d.ts.map +1 -1
  108. package/lib/license-protocol.js +1 -1
  109. package/lib/license-protocol.js.map +1 -1
  110. package/lib/messaging/browser/connection.d.ts +1 -1
  111. package/lib/messaging/browser/connection.d.ts.map +1 -1
  112. package/lib/messaging/browser/connection.js +19 -19
  113. package/lib/messaging/browser/connection.js.map +1 -1
  114. package/lib/messaging/browser/window-connection.d.ts +5 -5
  115. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  116. package/lib/messaging/browser/window-connection.js +10 -7
  117. package/lib/messaging/browser/window-connection.js.map +1 -1
  118. package/lib/messaging/client-call-metrics.d.ts +5 -19
  119. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  120. package/lib/messaging/client-call-metrics.js +35 -23
  121. package/lib/messaging/client-call-metrics.js.map +1 -1
  122. package/lib/messaging/error.d.ts +11 -2
  123. package/lib/messaging/error.d.ts.map +1 -1
  124. package/lib/messaging/error.js +22 -4
  125. package/lib/messaging/error.js.map +1 -1
  126. package/lib/messaging/handler.d.ts.map +1 -1
  127. package/lib/messaging/handler.js +1 -1
  128. package/lib/messaging/node/connection.d.ts +1 -17
  129. package/lib/messaging/node/connection.d.ts.map +1 -1
  130. package/lib/messaging/node/connection.js +23 -59
  131. package/lib/messaging/node/connection.js.map +1 -1
  132. package/lib/messaging/proxy-factory.d.ts +1 -1
  133. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  134. package/lib/messaging/proxy-factory.js +7 -9
  135. package/lib/messaging/proxy-factory.js.map +1 -1
  136. package/lib/oss-allowlist.d.ts +14 -0
  137. package/lib/oss-allowlist.d.ts.map +1 -0
  138. package/lib/oss-allowlist.js +8 -0
  139. package/lib/oss-allowlist.js.map +1 -0
  140. package/lib/payment-protocol.d.ts +1 -1
  141. package/lib/payment-protocol.d.ts.map +1 -1
  142. package/lib/payment-protocol.js +2 -2
  143. package/lib/payment-protocol.js.map +1 -1
  144. package/lib/permission.d.ts +10 -4
  145. package/lib/permission.d.ts.map +1 -1
  146. package/lib/permission.js +35 -26
  147. package/lib/permission.js.map +1 -1
  148. package/lib/plans.d.ts +5 -4
  149. package/lib/plans.d.ts.map +1 -1
  150. package/lib/plans.js +211 -172
  151. package/lib/plans.js.map +1 -1
  152. package/lib/protocol.d.ts +192 -99
  153. package/lib/protocol.d.ts.map +1 -1
  154. package/lib/protocol.js +293 -105
  155. package/lib/protocol.js.map +1 -1
  156. package/lib/protocol.spec.d.ts +7 -0
  157. package/lib/protocol.spec.d.ts.map +1 -0
  158. package/lib/protocol.spec.js +127 -0
  159. package/lib/protocol.spec.js.map +1 -0
  160. package/lib/snapshot-url.d.ts +1 -1
  161. package/lib/snapshot-url.js +1 -1
  162. package/lib/snapshot-url.spec.d.ts +1 -1
  163. package/lib/snapshot-url.spec.js +1 -1
  164. package/lib/snapshot-url.spec.js.map +1 -1
  165. package/lib/team-subscription-protocol.d.ts +23 -4
  166. package/lib/team-subscription-protocol.d.ts.map +1 -1
  167. package/lib/team-subscription-protocol.js +21 -6
  168. package/lib/team-subscription-protocol.js.map +1 -1
  169. package/lib/teams-projects-protocol.d.ts +35 -5
  170. package/lib/teams-projects-protocol.d.ts.map +1 -1
  171. package/lib/teams-projects-protocol.js +9 -2
  172. package/lib/teams-projects-protocol.js.map +1 -1
  173. package/lib/typings/globals.d.ts +3 -3
  174. package/lib/typings/globals.d.ts.map +1 -1
  175. package/lib/typings/globals.js +1 -1
  176. package/lib/usage.d.ts +73 -0
  177. package/lib/usage.d.ts.map +1 -0
  178. package/lib/usage.js +20 -0
  179. package/lib/usage.js.map +1 -0
  180. package/lib/util/analytics.d.ts +1 -1
  181. package/lib/util/analytics.d.ts.map +1 -1
  182. package/lib/util/analytics.js +13 -4
  183. package/lib/util/analytics.js.map +1 -1
  184. package/lib/util/async-iterator.d.ts +1 -1
  185. package/lib/util/async-iterator.d.ts.map +1 -1
  186. package/lib/util/async-iterator.js +4 -4
  187. package/lib/util/async-iterator.js.map +1 -1
  188. package/lib/util/cancelable.d.ts +1 -1
  189. package/lib/util/cancelable.js +1 -1
  190. package/lib/util/cancelable.js.map +1 -1
  191. package/lib/util/date-time.d.ts +1 -1
  192. package/lib/util/date-time.js +7 -7
  193. package/lib/util/date-time.js.map +1 -1
  194. package/lib/util/debug-app.d.ts +25 -0
  195. package/lib/util/debug-app.d.ts.map +1 -0
  196. package/lib/util/debug-app.js +100 -0
  197. package/lib/util/debug-app.js.map +1 -0
  198. package/lib/util/deep-partial.d.ts +1 -1
  199. package/lib/util/deep-partial.js +1 -1
  200. package/lib/util/deferred.d.ts +1 -1
  201. package/lib/util/deferred.js +1 -1
  202. package/lib/util/deferred.js.map +1 -1
  203. package/lib/util/disposable.d.ts.map +1 -1
  204. package/lib/util/disposable.js +2 -2
  205. package/lib/util/disposable.js.map +1 -1
  206. package/lib/util/event.d.ts.map +1 -1
  207. package/lib/util/event.js +5 -3
  208. package/lib/util/event.js.map +1 -1
  209. package/lib/util/garbage-collected-cache.d.ts +2 -1
  210. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  211. package/lib/util/garbage-collected-cache.js +12 -3
  212. package/lib/util/garbage-collected-cache.js.map +1 -1
  213. package/lib/util/generate-workspace-id.d.ts +6 -1
  214. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  215. package/lib/util/generate-workspace-id.js +461 -440
  216. package/lib/util/generate-workspace-id.js.map +1 -1
  217. package/lib/util/generate-workspace-id.spec.d.ts +1 -1
  218. package/lib/util/generate-workspace-id.spec.js +37 -2
  219. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  220. package/lib/util/gitpod-cookie.d.ts +2 -2
  221. package/lib/util/gitpod-cookie.d.ts.map +1 -1
  222. package/lib/util/gitpod-cookie.js +1 -4
  223. package/lib/util/gitpod-cookie.js.map +1 -1
  224. package/lib/util/gitpod-host-url.d.ts +6 -2
  225. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  226. package/lib/util/gitpod-host-url.js +61 -37
  227. package/lib/util/gitpod-host-url.js.map +1 -1
  228. package/lib/util/gitpod-host-url.spec.d.ts +1 -1
  229. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  230. package/lib/util/gitpod-host-url.spec.js +16 -6
  231. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  232. package/lib/util/grpc.d.ts +21 -1
  233. package/lib/util/grpc.d.ts.map +1 -1
  234. package/lib/util/grpc.js +74 -2
  235. package/lib/util/grpc.js.map +1 -1
  236. package/lib/util/jaeger-client-types.d.ts +68 -0
  237. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  238. package/lib/{theia-plugins.js → util/jaeger-client-types.js} +2 -2
  239. package/lib/util/jaeger-client-types.js.map +1 -0
  240. package/lib/util/logging.d.ts +2 -2
  241. package/lib/util/logging.d.ts.map +1 -1
  242. package/lib/util/logging.js +32 -26
  243. package/lib/util/logging.js.map +1 -1
  244. package/lib/util/logging.spec.d.ts +7 -0
  245. package/lib/util/logging.spec.d.ts.map +1 -0
  246. package/lib/util/logging.spec.js +52 -0
  247. package/lib/util/logging.spec.js.map +1 -0
  248. package/lib/util/make-link.d.ts +1 -1
  249. package/lib/util/make-link.js +6 -6
  250. package/lib/util/make-link.js.map +1 -1
  251. package/lib/util/nice-grpc.d.ts +9 -0
  252. package/lib/util/nice-grpc.d.ts.map +1 -0
  253. package/lib/util/nice-grpc.js +121 -0
  254. package/lib/util/nice-grpc.js.map +1 -0
  255. package/lib/util/parse-workspace-id.d.ts +1 -1
  256. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  257. package/lib/util/parse-workspace-id.js +3 -4
  258. package/lib/util/parse-workspace-id.js.map +1 -1
  259. package/lib/util/parse-workspace-id.spec.d.ts +1 -1
  260. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  261. package/lib/util/parse-workspace-id.spec.js +1 -1
  262. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  263. package/lib/util/queue.d.ts +1 -1
  264. package/lib/util/queue.js +1 -1
  265. package/lib/util/queue.spec.d.ts +1 -1
  266. package/lib/util/queue.spec.js +10 -7
  267. package/lib/util/queue.spec.js.map +1 -1
  268. package/lib/util/repeat.d.ts +15 -0
  269. package/lib/util/repeat.d.ts.map +1 -0
  270. package/lib/util/repeat.js +55 -0
  271. package/lib/util/repeat.js.map +1 -0
  272. package/lib/util/semaphore.d.ts +1 -1
  273. package/lib/util/semaphore.d.ts.map +1 -1
  274. package/lib/util/semaphore.js +1 -1
  275. package/lib/util/semaphore.js.map +1 -1
  276. package/lib/util/skip-if.d.ts +1 -1
  277. package/lib/util/skip-if.d.ts.map +1 -1
  278. package/lib/util/skip-if.js +1 -1
  279. package/lib/util/skip-if.js.map +1 -1
  280. package/lib/util/timeutil.d.ts +3 -1
  281. package/lib/util/timeutil.d.ts.map +1 -1
  282. package/lib/util/timeutil.js +16 -4
  283. package/lib/util/timeutil.js.map +1 -1
  284. package/lib/util/timeutil.spec.d.ts +3 -1
  285. package/lib/util/timeutil.spec.d.ts.map +1 -1
  286. package/lib/util/timeutil.spec.js +35 -1
  287. package/lib/util/timeutil.spec.js.map +1 -1
  288. package/lib/util/tracing.d.ts +53 -7
  289. package/lib/util/tracing.d.ts.map +1 -1
  290. package/lib/util/tracing.js +157 -20
  291. package/lib/util/tracing.js.map +1 -1
  292. package/lib/util/tracing.spec.d.ts +7 -0
  293. package/lib/util/tracing.spec.d.ts.map +1 -0
  294. package/lib/util/tracing.spec.js +121 -0
  295. package/lib/util/tracing.spec.js.map +1 -0
  296. package/lib/util/workspace-port-authentication.d.ts +8 -8
  297. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  298. package/lib/util/workspace-port-authentication.js +9 -12
  299. package/lib/util/workspace-port-authentication.js.map +1 -1
  300. package/lib/webhook-event.d.ts +44 -0
  301. package/lib/webhook-event.d.ts.map +1 -0
  302. package/lib/webhook-event.js +8 -0
  303. package/lib/webhook-event.js.map +1 -0
  304. package/lib/workspace-class.d.ts +14 -0
  305. package/lib/workspace-class.d.ts.map +1 -0
  306. package/lib/workspace-class.js +8 -0
  307. package/lib/workspace-class.js.map +1 -0
  308. package/lib/workspace-cluster.d.ts +19 -18
  309. package/lib/workspace-cluster.d.ts.map +1 -1
  310. package/lib/workspace-cluster.js +17 -2
  311. package/lib/workspace-cluster.js.map +1 -1
  312. package/lib/workspace-instance.d.ts +41 -4
  313. package/lib/workspace-instance.d.ts.map +1 -1
  314. package/lib/workspace-instance.js +1 -1
  315. package/lib/wsready.d.ts +8 -2
  316. package/lib/wsready.d.ts.map +1 -1
  317. package/lib/wsready.js +3 -3
  318. package/package.json +18 -8
  319. package/pkg-yarn.lock +11 -6
  320. package/provenance-bundle.jsonl +2 -0
  321. package/src/accounting-protocol.ts +67 -52
  322. package/src/admin-protocol.ts +59 -19
  323. package/src/analytics.ts +27 -29
  324. package/src/attribution.ts +63 -0
  325. package/src/auth.ts +3 -3
  326. package/src/billing-mode.ts +84 -0
  327. package/src/blocked-repositories-protocol.ts +13 -0
  328. package/src/context-url.spec.ts +25 -15
  329. package/src/context-url.ts +93 -37
  330. package/src/encryption/container-module.ts +3 -4
  331. package/src/encryption/encryption-engine.spec.ts +10 -9
  332. package/src/encryption/encryption-engine.ts +21 -17
  333. package/src/encryption/encryption-service.ts +5 -6
  334. package/src/encryption/key-provider.ts +17 -20
  335. package/src/env.ts +2 -25
  336. package/src/experiments/always-default.ts +24 -0
  337. package/src/experiments/configcat-server.ts +42 -0
  338. package/src/experiments/configcat.ts +56 -0
  339. package/src/experiments/types.ts +34 -0
  340. package/src/gitpod-file-parser.spec.ts +56 -62
  341. package/src/gitpod-file-parser.ts +17 -18
  342. package/src/gitpod-service.ts +241 -134
  343. package/src/headless-workspace-log.ts +7 -5
  344. package/src/ide-frontend-service.ts +3 -3
  345. package/src/ide-protocol.ts +147 -0
  346. package/src/index.ts +17 -15
  347. package/src/installation-admin-protocol.ts +45 -0
  348. package/src/license-protocol.ts +13 -7
  349. package/src/messaging/browser/connection.ts +45 -47
  350. package/src/messaging/browser/window-connection.ts +40 -30
  351. package/src/messaging/client-call-metrics.ts +79 -82
  352. package/src/messaging/error.ts +33 -8
  353. package/src/messaging/handler.ts +6 -6
  354. package/src/messaging/node/connection.ts +23 -70
  355. package/src/messaging/proxy-factory.ts +23 -30
  356. package/src/oss-allowlist.ts +15 -0
  357. package/src/payment-protocol.ts +3 -3
  358. package/src/permission.ts +41 -33
  359. package/src/plans.ts +241 -190
  360. package/src/protocol.spec.ts +97 -0
  361. package/src/protocol.ts +557 -297
  362. package/src/snapshot-url.spec.ts +10 -8
  363. package/src/snapshot-url.ts +1 -1
  364. package/src/team-subscription-protocol.ts +60 -23
  365. package/src/teams-projects-protocol.ts +51 -12
  366. package/src/typings/globals.ts +5 -5
  367. package/src/usage.ts +85 -0
  368. package/src/util/analytics.ts +47 -25
  369. package/src/util/async-iterator.ts +5 -6
  370. package/src/util/cancelable.ts +4 -4
  371. package/src/util/date-time.ts +9 -9
  372. package/src/util/debug-app.ts +81 -0
  373. package/src/util/deep-partial.ts +1 -1
  374. package/src/util/deferred.ts +7 -7
  375. package/src/util/disposable.ts +3 -6
  376. package/src/util/event.ts +9 -11
  377. package/src/util/garbage-collected-cache.ts +15 -7
  378. package/src/util/generate-workspace-id.spec.ts +35 -8
  379. package/src/util/generate-workspace-id.ts +465 -441
  380. package/src/util/gitpod-cookie.ts +9 -10
  381. package/src/util/gitpod-host-url.spec.ts +41 -14
  382. package/src/util/gitpod-host-url.ts +70 -42
  383. package/src/util/grpc.ts +94 -2
  384. package/src/util/jaeger-client-types.ts +102 -0
  385. package/src/util/logging.spec.ts +23 -0
  386. package/src/util/logging.ts +61 -43
  387. package/src/util/make-link.ts +7 -8
  388. package/src/util/nice-grpc.ts +96 -0
  389. package/src/util/parse-workspace-id.spec.ts +18 -9
  390. package/src/util/parse-workspace-id.ts +7 -8
  391. package/src/util/queue.spec.ts +28 -26
  392. package/src/util/queue.ts +1 -1
  393. package/src/util/repeat.ts +45 -0
  394. package/src/util/semaphore.ts +5 -7
  395. package/src/util/skip-if.ts +10 -7
  396. package/src/util/timeutil.spec.ts +41 -15
  397. package/src/util/timeutil.ts +28 -12
  398. package/src/util/tracing.spec.ts +88 -0
  399. package/src/util/tracing.ts +201 -32
  400. package/src/util/workspace-port-authentication.ts +11 -14
  401. package/src/webhook-event.ts +55 -0
  402. package/src/workspace-class.ts +14 -0
  403. package/src/workspace-cluster.ts +35 -21
  404. package/src/workspace-instance.ts +83 -21
  405. package/src/wsready.ts +11 -4
  406. package/data/builtin-theia-plugins.json +0 -372
  407. package/lib/email-protocol.d.ts +0 -49
  408. package/lib/email-protocol.d.ts.map +0 -1
  409. package/lib/email-protocol.js +0 -28
  410. package/lib/email-protocol.js.map +0 -1
  411. package/lib/messaging/connection-error-handler.d.ts +0 -27
  412. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  413. package/lib/messaging/connection-error-handler.js +0 -34
  414. package/lib/messaging/connection-error-handler.js.map +0 -1
  415. package/lib/theia-plugins.d.ts +0 -11
  416. package/lib/theia-plugins.d.ts.map +0 -1
  417. package/lib/theia-plugins.js.map +0 -1
  418. package/lib/util/repeater.d.ts +0 -22
  419. package/lib/util/repeater.d.ts.map +0 -1
  420. package/lib/util/repeater.js +0 -65
  421. package/lib/util/repeater.js.map +0 -1
  422. package/lib/util/safe-promise.d.ts +0 -11
  423. package/lib/util/safe-promise.d.ts.map +0 -1
  424. package/lib/util/safe-promise.js +0 -31
  425. package/lib/util/safe-promise.js.map +0 -1
  426. package/src/email-protocol.ts +0 -66
  427. package/src/messaging/connection-error-handler.ts +0 -62
  428. package/src/theia-plugins.ts +0 -11
  429. package/src/util/jaeger-client.d.ts +0 -105
  430. package/src/util/repeater.ts +0 -49
  431. package/src/util/safe-promise.ts +0 -26
package/src/protocol.ts CHANGED
@@ -1,32 +1,33 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
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
9
  import { Project } from "./teams-projects-protocol";
10
+ import { createHash } from "crypto";
10
11
 
11
12
  export interface UserInfo {
12
- name?: string
13
+ name?: string;
13
14
  }
14
15
 
15
16
  export interface User {
16
17
  /** The user id */
17
- id: string
18
+ id: string;
18
19
 
19
20
  /** The timestamp when the user entry was created */
20
- creationDate: string
21
+ creationDate: string;
21
22
 
22
- avatarUrl?: string
23
+ avatarUrl?: string;
23
24
 
24
- name?: string
25
+ name?: string;
25
26
 
26
27
  /** Optional for backwards compatibility */
27
- fullName?: string
28
+ fullName?: string;
28
29
 
29
- identities: Identity[]
30
+ identities: Identity[];
30
31
 
31
32
  /**
32
33
  * Whether the user has been blocked to use our service, because of TOS violation for example.
@@ -44,38 +45,54 @@ export interface User {
44
45
  markedDeleted?: boolean;
45
46
 
46
47
  additionalData?: AdditionalUserData;
48
+
49
+ // Identifies an explicit team or user ID to which all the user's workspace usage should be attributed to (e.g. for billing purposes)
50
+ usageAttributionId?: string;
51
+
52
+ // The last time this user got verified somehow. The user is not verified if this is empty.
53
+ lastVerificationTime?: string;
54
+
55
+ // The phone number used for the last phone verification.
56
+ verificationPhoneNumber?: string;
47
57
  }
48
58
 
49
59
  export namespace User {
50
60
  export function is(data: any): data is User {
51
- return data
52
- && data.hasOwnProperty('id')
53
- && data.hasOwnProperty('identities')
61
+ return data && data.hasOwnProperty("id") && data.hasOwnProperty("identities");
54
62
  }
55
63
  export function getIdentity(user: User, authProviderId: string): Identity | undefined {
56
- return user.identities.find(id => id.authProviderId === authProviderId);
64
+ return user.identities.find((id) => id.authProviderId === authProviderId);
57
65
  }
58
66
  export function censor(user: User): User {
59
67
  const res = { ...user };
60
- delete (res.additionalData);
61
- res.identities = res.identities.map(i => {
62
- delete (i.tokens);
68
+ delete res.additionalData;
69
+ res.identities = res.identities.map((i) => {
70
+ delete i.tokens;
63
71
 
64
72
  // The user field is not in the Identity shape, but actually exists on DBIdentity.
65
73
  // Trying to push this object out via JSON RPC will fail because of the cyclic nature
66
74
  // of this field.
67
- delete ((i as any).user);
75
+ delete (i as any).user;
68
76
  return i;
69
77
  });
70
78
  return res;
71
79
  }
72
- export function getPrimaryEmail(user: User): string {
73
- const identities = user.identities.filter(i => !!i.primaryEmail);
80
+
81
+ /**
82
+ * Returns the stored email or if it doesn't exist returns the primaryEmail of the first identity this user signed up with.
83
+ * @param user
84
+ * @returns A primaryEmail, or undefined if there is none.
85
+ */
86
+ export function getPrimaryEmail(user: User): string | undefined {
87
+ if (user.additionalData?.profile?.emailAddress) {
88
+ return user.additionalData?.profile?.emailAddress;
89
+ }
90
+ const identities = user.identities.filter((i) => !!i.primaryEmail);
74
91
  if (identities.length <= 0) {
75
- throw new Error(`No identity with primary email for user: ${user.id}!`);
92
+ return undefined;
76
93
  }
77
94
 
78
- return identities[0].primaryEmail!;
95
+ return identities[0].primaryEmail || undefined;
79
96
  }
80
97
  export function getName(user: User): string | undefined {
81
98
  const name = user.fullName || user.name;
@@ -90,6 +107,91 @@ export namespace User {
90
107
  }
91
108
  return undefined;
92
109
  }
110
+
111
+ export function hasPreferredIde(user: User) {
112
+ return (
113
+ typeof user?.additionalData?.ideSettings?.defaultIde !== "undefined" ||
114
+ typeof user?.additionalData?.ideSettings?.useLatestVersion !== "undefined"
115
+ );
116
+ }
117
+
118
+ export function isOnboardingUser(user: User) {
119
+ return !hasPreferredIde(user);
120
+ }
121
+
122
+ export function migrationIDESettings(user: User) {
123
+ if (
124
+ !user?.additionalData?.ideSettings ||
125
+ Object.keys(user.additionalData.ideSettings).length === 0 ||
126
+ user.additionalData.ideSettings.settingVersion === "2.0"
127
+ ) {
128
+ return;
129
+ }
130
+ const newIDESettings: IDESettings = {
131
+ settingVersion: "2.0",
132
+ };
133
+ const ideSettings = user.additionalData.ideSettings;
134
+ if (ideSettings.useDesktopIde) {
135
+ if (ideSettings.defaultDesktopIde === "code-desktop") {
136
+ newIDESettings.defaultIde = "code-desktop";
137
+ } else if (ideSettings.defaultDesktopIde === "code-desktop-insiders") {
138
+ newIDESettings.defaultIde = "code-desktop";
139
+ newIDESettings.useLatestVersion = true;
140
+ } else {
141
+ newIDESettings.defaultIde = ideSettings.defaultDesktopIde;
142
+ newIDESettings.useLatestVersion = ideSettings.useLatestVersion;
143
+ }
144
+ } else {
145
+ const useLatest = ideSettings.defaultIde === "code-latest";
146
+ newIDESettings.defaultIde = "code";
147
+ newIDESettings.useLatestVersion = useLatest;
148
+ }
149
+ user.additionalData.ideSettings = newIDESettings;
150
+ }
151
+
152
+ export function getProfile(user: User): Profile {
153
+ return {
154
+ name: User.getName(user!) || "",
155
+ email: User.getPrimaryEmail(user!) || "",
156
+ company: user?.additionalData?.profile?.companyName,
157
+ avatarURL: user?.avatarUrl,
158
+ };
159
+ }
160
+
161
+ export function setProfile(user: User, profile: Profile): User {
162
+ user.fullName = profile.name;
163
+ user.avatarUrl = profile.avatarURL;
164
+
165
+ if (!user.additionalData) {
166
+ user.additionalData = {};
167
+ }
168
+ if (!user.additionalData.profile) {
169
+ user.additionalData.profile = {};
170
+ }
171
+ user.additionalData.profile.emailAddress = profile.email;
172
+ user.additionalData.profile.companyName = profile.company;
173
+ user.additionalData.profile.lastUpdatedDetailsNudge = new Date().toISOString();
174
+
175
+ return user;
176
+ }
177
+
178
+ // The actual Profile of a User
179
+ export interface Profile {
180
+ name: string;
181
+ email: string;
182
+ company?: string;
183
+ avatarURL?: string;
184
+ }
185
+ export namespace Profile {
186
+ export function hasChanges(before: Profile, after: Profile) {
187
+ return (
188
+ before.name !== after.name ||
189
+ before.email !== after.email ||
190
+ before.company !== after.company ||
191
+ before.avatarURL !== after.avatarURL
192
+ );
193
+ }
194
+ }
93
195
  }
94
196
 
95
197
  export interface AdditionalUserData {
@@ -98,12 +200,42 @@ export interface AdditionalUserData {
98
200
  featurePreview?: boolean;
99
201
  ideSettings?: IDESettings;
100
202
  // key is the name of the news, string the iso date when it was seen
101
- whatsNewSeen?: { [key: string]: string }
203
+ whatsNewSeen?: { [key: string]: string };
102
204
  // key is the name of the OAuth client i.e. local app, string the iso date when it was approved
103
205
  // TODO(rl): provide a management UX to allow rescinding of approval
104
- oauthClientsApproved?: { [key: string]: string }
206
+ oauthClientsApproved?: { [key: string]: string };
105
207
  // to remember GH Orgs the user installed/updated the GH App for
106
208
  knownGitHubOrgs?: string[];
209
+ // Git clone URL pointing to the user's dotfile repo
210
+ dotfileRepo?: string;
211
+ // preferred workspace classes
212
+ workspaceClasses?: WorkspaceClasses;
213
+ // additional user profile data
214
+ profile?: ProfileDetails;
215
+ }
216
+ export namespace AdditionalUserData {
217
+ export function set(user: User, partialData: Partial<AdditionalUserData>): User {
218
+ if (!user.additionalData) {
219
+ user.additionalData = {
220
+ ...partialData,
221
+ };
222
+ } else {
223
+ user.additionalData = {
224
+ ...user.additionalData,
225
+ ...partialData,
226
+ };
227
+ }
228
+ return user;
229
+ }
230
+ }
231
+ // The format in which we store User Profiles in
232
+ export interface ProfileDetails {
233
+ // when was the last time the user updated their profile information or has been nudged to do so.
234
+ lastUpdatedDetailsNudge?: string;
235
+ // the user's company name
236
+ companyName?: string;
237
+ // the user's email
238
+ emailAddress?: string;
107
239
  }
108
240
 
109
241
  export interface EmailNotificationSettings {
@@ -113,9 +245,18 @@ export interface EmailNotificationSettings {
113
245
  }
114
246
 
115
247
  export type IDESettings = {
116
- defaultIde?: string
117
- useDesktopIde?: boolean
118
- defaultDesktopIde?: string
248
+ settingVersion?: string;
249
+ defaultIde?: string;
250
+ // DEPRECATED: Use defaultIde after `settingVersion: 2.0`, no more specialify desktop or browser.
251
+ useDesktopIde?: boolean;
252
+ // DEPRECATED: Same with useDesktopIde.
253
+ defaultDesktopIde?: string;
254
+ useLatestVersion?: boolean;
255
+ };
256
+
257
+ export interface WorkspaceClasses {
258
+ regular?: string;
259
+ prebuild?: string;
119
260
  }
120
261
 
121
262
  export interface UserPlatform {
@@ -144,19 +285,43 @@ export interface UserFeatureSettings {
144
285
  permanentWSFeatureFlags?: NamedWorkspaceFeatureFlag[];
145
286
  }
146
287
 
288
+ export type BillingTier = "paid" | "free";
289
+
147
290
  /**
148
291
  * The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
149
292
  * If they don't we'll break things during workspace startup.
150
293
  */
151
- export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
152
- export type NamedWorkspaceFeatureFlag = keyof (typeof WorkspaceFeatureFlags);
294
+ export const WorkspaceFeatureFlags = {
295
+ full_workspace_backup: undefined,
296
+ workspace_class_limiting: undefined,
297
+ workspace_connection_limiting: undefined,
298
+ workspace_psi: undefined,
299
+ };
300
+ export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
301
+ export namespace NamedWorkspaceFeatureFlag {
302
+ export const WORKSPACE_PERSISTED_FEATTURE_FLAGS: NamedWorkspaceFeatureFlag[] = ["full_workspace_backup"];
303
+ export function isWorkspacePersisted(ff: NamedWorkspaceFeatureFlag): boolean {
304
+ return WORKSPACE_PERSISTED_FEATTURE_FLAGS.includes(ff);
305
+ }
306
+ }
153
307
 
154
- export interface UserEnvVarValue {
155
- id?: string;
308
+ export interface EnvVarWithValue {
156
309
  name: string;
157
- repositoryPattern: string;
158
310
  value: string;
159
311
  }
312
+
313
+ export interface ProjectEnvVarWithValue extends EnvVarWithValue {
314
+ id: string;
315
+ projectId: string;
316
+ censored: boolean;
317
+ }
318
+
319
+ export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, "value">;
320
+
321
+ export interface UserEnvVarValue extends EnvVarWithValue {
322
+ id?: string;
323
+ repositoryPattern: string; // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
324
+ }
160
325
  export interface UserEnvVar extends UserEnvVarValue {
161
326
  id: string;
162
327
  userId: string;
@@ -164,11 +329,51 @@ export interface UserEnvVar extends UserEnvVarValue {
164
329
  }
165
330
 
166
331
  export namespace UserEnvVar {
332
+ /**
333
+ * @param variable
334
+ * @returns Either a string containing an error message or undefined.
335
+ */
336
+ export function validate(variable: UserEnvVarValue): string | undefined {
337
+ const name = variable.name;
338
+ const pattern = variable.repositoryPattern;
339
+ if (name.trim() === "") {
340
+ return "Name must not be empty.";
341
+ }
342
+ if (name.length > 255) {
343
+ return "Name too long. Maximum name length is 255 characters.";
344
+ }
345
+ if (!/^[a-zA-Z_]+[a-zA-Z0-9_]*$/.test(name)) {
346
+ return "Name must match /^[a-zA-Z_]+[a-zA-Z0-9_]*$/.";
347
+ }
348
+ if (variable.value.trim() === "") {
349
+ return "Value must not be empty.";
350
+ }
351
+ if (variable.value.length > 32767) {
352
+ return "Value too long. Maximum value length is 32767 characters.";
353
+ }
354
+ if (pattern.trim() === "") {
355
+ return "Scope must not be empty.";
356
+ }
357
+ const split = pattern.split("/");
358
+ if (split.length < 2) {
359
+ return "A scope must use the form 'organization/repo'.";
360
+ }
361
+ for (const name of split) {
362
+ if (name !== "*") {
363
+ if (!/^[a-zA-Z0-9_\-.\*]+$/.test(name)) {
364
+ return "Invalid scope segment. Only ASCII characters, numbers, -, _, . or * are allowed.";
365
+ }
366
+ }
367
+ }
368
+ return undefined;
369
+ }
167
370
 
371
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
168
372
  export function normalizeRepoPattern(pattern: string) {
169
373
  return pattern.toLocaleLowerCase();
170
374
  }
171
375
 
376
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
172
377
  export function score(value: UserEnvVarValue): number {
173
378
  // We use a score to enforce precedence:
174
379
  // value/value = 0
@@ -182,7 +387,7 @@ export namespace UserEnvVar {
182
387
  if (repoPattern == "*") {
183
388
  score += 1;
184
389
  }
185
- if (ownerPattern == '*') {
390
+ if (ownerPattern == "*") {
186
391
  score += 2;
187
392
  }
188
393
  if (ownerPattern == "#" || repoPattern == "#") {
@@ -191,21 +396,22 @@ export namespace UserEnvVar {
191
396
  return score;
192
397
  }
193
398
 
399
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
194
400
  export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
195
- let result = vars.filter(e => {
401
+ let result = vars.filter((e) => {
196
402
  const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
197
- if (ownerPattern !== '*' && ownerPattern !== '#' && (!!owner && ownerPattern !== owner.toLocaleLowerCase())) {
403
+ if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
198
404
  return false;
199
405
  }
200
- if (repoPattern !== '*' && repoPattern !== '#' && (!!repo && repoPattern !== repo.toLocaleLowerCase())) {
406
+ if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
201
407
  return false;
202
408
  }
203
409
  return true;
204
410
  });
205
411
 
206
412
  const resmap = new Map<string, T[]>();
207
- result.forEach(e => {
208
- const l = (resmap.get(e.name) || []);
413
+ result.forEach((e) => {
414
+ const l = resmap.get(e.name) || [];
209
415
  l.push(e);
210
416
  resmap.set(e.name, l);
211
417
  });
@@ -238,47 +444,109 @@ export namespace UserEnvVar {
238
444
  return result;
239
445
  }
240
446
 
447
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
241
448
  export function splitRepositoryPattern(repositoryPattern: string): string[] {
242
- const patterns = repositoryPattern.split('/');
243
- const repoPattern = patterns.pop() || "";
244
- const ownerPattern = patterns.join('/');
449
+ const patterns = repositoryPattern.split("/");
450
+ const repoPattern = patterns.slice(1).join("/");
451
+ const ownerPattern = patterns[0];
245
452
  return [ownerPattern, repoPattern];
246
453
  }
247
454
  }
248
455
 
249
- export interface GitpodToken {
456
+ export interface SSHPublicKeyValue {
457
+ name: string;
458
+ key: string;
459
+ }
460
+ export interface UserSSHPublicKey extends SSHPublicKeyValue {
461
+ id: string;
462
+ key: string;
463
+ userId: string;
464
+ fingerprint: string;
465
+ creationTime: string;
466
+ lastUsedTime?: string;
467
+ }
250
468
 
469
+ export type UserSSHPublicKeyValue = Omit<UserSSHPublicKey, "userId">;
470
+
471
+ export namespace SSHPublicKeyValue {
472
+ export function validate(value: SSHPublicKeyValue): string | undefined {
473
+ if (value.name.length === 0) {
474
+ return "Title must not be empty.";
475
+ }
476
+ if (value.name.length > 255) {
477
+ return "Title too long. Maximum value length is 255 characters.";
478
+ }
479
+ if (value.key.length === 0) {
480
+ return "Key must not be empty.";
481
+ }
482
+ try {
483
+ getData(value);
484
+ } catch (e) {
485
+ return "Key is invalid. You must supply a key in OpenSSH public key format.";
486
+ }
487
+ return;
488
+ }
489
+
490
+ export function getData(value: SSHPublicKeyValue) {
491
+ // Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'.
492
+ const regex =
493
+ /^(?<type>ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-ed25519|sk-ecdsa-sha2-nistp256@openssh\.com|sk-ssh-ed25519@openssh\.com) (?<key>.*?)( (?<email>.*?))?$/;
494
+ const resultGroup = regex.exec(value.key.trim());
495
+ if (!resultGroup) {
496
+ throw new Error("Key is invalid.");
497
+ }
498
+ return {
499
+ type: resultGroup.groups?.["type"] as string,
500
+ key: resultGroup.groups?.["key"] as string,
501
+ email: resultGroup.groups?.["email"] || undefined,
502
+ };
503
+ }
504
+
505
+ export function getFingerprint(value: SSHPublicKeyValue) {
506
+ const data = getData(value);
507
+ let buf = Buffer.from(data.key, "base64");
508
+ // gitlab style
509
+ // const hash = createHash("md5").update(buf).digest("hex");
510
+ // github style
511
+ const hash = createHash("sha256").update(buf).digest("base64");
512
+ return hash;
513
+ }
514
+
515
+ export const MAXIMUM_KEY_LENGTH = 5;
516
+ }
517
+
518
+ export interface GitpodToken {
251
519
  /** Hash value (SHA256) of the token (primary key). */
252
- tokenHash: string
520
+ tokenHash: string;
253
521
 
254
522
  /** Human readable name of the token */
255
- name?: string
523
+ name?: string;
256
524
 
257
525
  /** Token kind */
258
- type: GitpodTokenType
526
+ type: GitpodTokenType;
259
527
 
260
528
  /** The user the token belongs to. */
261
- user: User
529
+ user: User;
262
530
 
263
531
  /** Scopes (e.g. limition to read-only) */
264
- scopes: string[]
532
+ scopes: string[];
265
533
 
266
534
  /** Created timestamp */
267
- created: string
535
+ created: string;
268
536
 
269
537
  // token is deleted on the database and about to be collected by db-sync
270
- deleted?: boolean
538
+ deleted?: boolean;
271
539
  }
272
540
 
273
541
  export enum GitpodTokenType {
274
542
  API_AUTH_TOKEN = 0,
275
- MACHINE_AUTH_TOKEN = 1
543
+ MACHINE_AUTH_TOKEN = 1,
276
544
  }
277
545
 
278
546
  export interface OneTimeSecret {
279
- id: string
547
+ id: string;
280
548
 
281
- value: string
549
+ value: string;
282
550
 
283
551
  expirationTime: string;
284
552
 
@@ -310,13 +578,12 @@ export type IdentityLookup = Pick<Identity, "authProviderId" | "authId">;
310
578
 
311
579
  export namespace Identity {
312
580
  export function is(data: any): data is Identity {
313
- return data.hasOwnProperty('authProviderId')
314
- && data.hasOwnProperty('authId')
315
- && data.hasOwnProperty('authName')
581
+ return (
582
+ data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName")
583
+ );
316
584
  }
317
585
  export function equals(id1: IdentityLookup, id2: IdentityLookup) {
318
- return id1.authProviderId === id2.authProviderId
319
- && id1.authId === id2.authId
586
+ return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
320
587
  }
321
588
  }
322
589
 
@@ -367,6 +634,7 @@ export interface PendingGithubEvent {
367
634
  creationDate: Date;
368
635
  type: string;
369
636
  event: string;
637
+ deleted: boolean;
370
638
  }
371
639
 
372
640
  export interface Snapshot {
@@ -375,18 +643,11 @@ export interface Snapshot {
375
643
  availableTime?: string;
376
644
  originalWorkspaceId: string;
377
645
  bucketId: string;
378
- layoutData?: string;
379
646
  state: SnapshotState;
380
647
  message?: string;
381
648
  }
382
649
 
383
- export type SnapshotState = 'pending' | 'available' | 'error';
384
-
385
- export interface LayoutData {
386
- workspaceId: string;
387
- lastUpdatedTime: string;
388
- layoutData: string;
389
- }
650
+ export type SnapshotState = "pending" | "available" | "error";
390
651
 
391
652
  export interface Workspace {
392
653
  id: string;
@@ -409,13 +670,13 @@ export interface Workspace {
409
670
  * The resolved, fix name of the workspace image. We only use this
410
671
  * to access the logs during an image build.
411
672
  */
412
- imageNameResolved?: string
673
+ imageNameResolved?: string;
413
674
 
414
675
  /**
415
676
  * The resolved/built fixed named of the base image. This field is only set if the workspace
416
677
  * already has its base image built.
417
678
  */
418
- baseImageNameResolved?: string
679
+ baseImageNameResolved?: string;
419
680
 
420
681
  shareable?: boolean;
421
682
  pinned?: boolean;
@@ -449,20 +710,19 @@ export interface Workspace {
449
710
 
450
711
  export type WorkspaceSoftDeletion = "user" | "gc";
451
712
 
452
- export type WorkspaceType = "regular" | "prebuild" | "probe";
713
+ export type WorkspaceType = "regular" | "prebuild";
453
714
 
454
715
  export namespace Workspace {
455
-
456
716
  export function getFullRepositoryName(ws: Workspace): string | undefined {
457
717
  if (CommitContext.is(ws.context)) {
458
- return ws.context.repository.owner + '/' + ws.context.repository.name
718
+ return ws.context.repository.owner + "/" + ws.context.repository.name;
459
719
  }
460
720
  return undefined;
461
721
  }
462
722
 
463
723
  export function getFullRepositoryUrl(ws: Workspace): string | undefined {
464
724
  if (CommitContext.is(ws.context)) {
465
- return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`
725
+ return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`;
466
726
  }
467
727
  return undefined;
468
728
  }
@@ -496,59 +756,60 @@ export namespace Workspace {
496
756
  }
497
757
  }
498
758
 
499
- export interface PreparePluginUploadParams {
500
- fullPluginName: string;
501
- }
502
-
503
- export interface ResolvePluginsParams {
504
- config?: WorkspaceConfig
505
- builtins?: ResolvedPlugins
506
- vsxRegistryUrl?: string
507
- }
508
-
509
- export interface InstallPluginsParams {
510
- pluginIds: string[]
511
- }
512
-
513
- export interface UninstallPluginParams {
514
- pluginId: string;
515
- }
516
-
517
759
  export interface GuessGitTokenScopesParams {
518
- host: string
519
- repoUrl: string
520
- gitCommand: string
521
- currentToken: GitToken
760
+ host: string;
761
+ repoUrl: string;
762
+ gitCommand: string;
763
+ currentToken: GitToken;
522
764
  }
523
765
 
524
766
  export interface GitToken {
525
- token: string
526
- user: string
527
- scopes: string[]
767
+ token: string;
768
+ user: string;
769
+ scopes: string[];
528
770
  }
529
771
 
530
772
  export interface GuessedGitTokenScopes {
531
- message?: string
532
- scopes?: string[]
773
+ message?: string;
774
+ scopes?: string[];
533
775
  }
534
776
 
535
- export type ResolvedPluginKind = 'user' | 'workspace' | 'builtin';
777
+ export interface VSCodeConfig {
778
+ extensions?: string[];
779
+ }
536
780
 
537
- export interface ResolvedPlugins {
538
- [pluginId: string]: ResolvedPlugin | undefined
781
+ export interface JetBrainsConfig {
782
+ intellij?: JetBrainsProductConfig;
783
+ goland?: JetBrainsProductConfig;
784
+ pycharm?: JetBrainsProductConfig;
785
+ phpstorm?: JetBrainsProductConfig;
786
+ rubymine?: JetBrainsProductConfig;
787
+ webstorm?: JetBrainsProductConfig;
788
+ rider?: JetBrainsProductConfig;
789
+ clion?: JetBrainsProductConfig;
790
+ }
791
+ export interface JetBrainsProductConfig {
792
+ prebuilds?: JetBrainsPrebuilds;
793
+ vmoptions?: string;
794
+ }
795
+ export interface JetBrainsPrebuilds {
796
+ version?: "stable" | "latest" | "both";
539
797
  }
540
798
 
541
- export interface ResolvedPlugin {
542
- fullPluginName: string;
799
+ export interface RepositoryCloneInformation {
543
800
  url: string;
544
- kind: ResolvedPluginKind;
801
+ checkoutLocation?: string;
545
802
  }
546
803
 
547
- export interface VSCodeConfig {
548
- extensions?: string[];
804
+ export interface CoreDumpConfig {
805
+ enabled?: boolean;
806
+ softLimit?: number;
807
+ hardLimit?: number;
549
808
  }
550
809
 
551
810
  export interface WorkspaceConfig {
811
+ mainConfiguration?: string;
812
+ additionalRepositories?: RepositoryCloneInformation[];
552
813
  image?: ImageConfig;
553
814
  ports?: PortConfig[];
554
815
  tasks?: TaskConfig[];
@@ -557,21 +818,22 @@ export interface WorkspaceConfig {
557
818
  gitConfig?: { [config: string]: string };
558
819
  github?: GithubAppConfig;
559
820
  vscode?: VSCodeConfig;
821
+ jetbrains?: JetBrainsConfig;
822
+ coreDump?: CoreDumpConfig;
560
823
 
561
- /** tailscale demo */
824
+ /** deprecated. Enabled by default **/
562
825
  experimentalNetwork?: boolean;
563
826
 
564
827
  /**
565
828
  * Where the config object originates from.
566
829
  *
567
830
  * repo - from the repository
568
- * project-db - from the "Project" stored in the database
569
831
  * definitly-gp - from github.com/gitpod-io/definitely-gp
570
832
  * derived - computed based on analyzing the repository
571
833
  * additional-content - config comes from additional content, usually provided through the project's configuration
572
834
  * default - our static catch-all default config
573
835
  */
574
- _origin?: 'repo' | 'project-db' | 'definitely-gp' | 'derived' | 'additional-content' | 'default';
836
+ _origin?: "repo" | "definitely-gp" | "derived" | "additional-content" | "default";
575
837
 
576
838
  /**
577
839
  * Set of automatically infered feature flags. That's not something the user can set, but
@@ -581,34 +843,33 @@ export interface WorkspaceConfig {
581
843
  }
582
844
 
583
845
  export interface GithubAppConfig {
584
- prebuilds?: GithubAppPrebuildConfig
846
+ prebuilds?: GithubAppPrebuildConfig;
585
847
  }
586
848
  export interface GithubAppPrebuildConfig {
587
- master?: boolean
588
- branches?: boolean
589
- pullRequests?: boolean
590
- pullRequestsFromForks?: boolean
591
- addCheck?: boolean
592
- addBadge?: boolean
593
- addLabel?: boolean | string
594
- addComment?: boolean
849
+ master?: boolean;
850
+ branches?: boolean;
851
+ pullRequests?: boolean;
852
+ pullRequestsFromForks?: boolean;
853
+ addCheck?: boolean | "prevent-merge-on-error";
854
+ addBadge?: boolean;
855
+ addLabel?: boolean | string;
856
+ addComment?: boolean;
595
857
  }
596
858
  export namespace GithubAppPrebuildConfig {
597
859
  export function is(obj: boolean | GithubAppPrebuildConfig): obj is GithubAppPrebuildConfig {
598
- return !(typeof obj === 'boolean');
860
+ return !(typeof obj === "boolean");
599
861
  }
600
862
  }
601
863
 
602
864
  export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
603
865
  export interface WorkspaceImageSourceDocker {
604
- dockerFilePath: string
605
- dockerFileHash: string
606
- dockerFileSource?: Commit
866
+ dockerFilePath: string;
867
+ dockerFileHash: string;
868
+ dockerFileSource?: Commit;
607
869
  }
608
870
  export namespace WorkspaceImageSourceDocker {
609
871
  export function is(obj: object): obj is WorkspaceImageSourceDocker {
610
- return 'dockerFileHash' in obj
611
- && 'dockerFilePath' in obj;
872
+ return "dockerFileHash" in obj && "dockerFilePath" in obj;
612
873
  }
613
874
  }
614
875
  export interface WorkspaceImageSourceReference {
@@ -617,21 +878,23 @@ export interface WorkspaceImageSourceReference {
617
878
  }
618
879
  export namespace WorkspaceImageSourceReference {
619
880
  export function is(obj: object): obj is WorkspaceImageSourceReference {
620
- return 'baseImageResolved' in obj;
881
+ return "baseImageResolved" in obj;
621
882
  }
622
883
  }
623
884
 
624
- export type PrebuiltWorkspaceState
885
+ export type PrebuiltWorkspaceState =
625
886
  // the prebuild is queued and may start at anytime
626
- = "queued"
887
+ | "queued"
627
888
  // the workspace prebuild is currently running (i.e. there's a workspace pod deployed)
628
889
  | "building"
629
- // the prebuild failed due to some issue with the system (e.g. missed a message, could not start workspace)
890
+ // the prebuild was aborted
630
891
  | "aborted"
631
892
  // the prebuild timed out
632
893
  | "timeout"
633
- // the prebuild has finished and a snapshot is available
634
- | "available";
894
+ // the prebuild has finished (even if a headless task failed) and a snapshot is available
895
+ | "available"
896
+ // the prebuild (headless workspace) failed due to some system error
897
+ | "failed";
635
898
 
636
899
  export interface PrebuiltWorkspace {
637
900
  id: string;
@@ -642,13 +905,16 @@ export interface PrebuiltWorkspace {
642
905
  buildWorkspaceId: string;
643
906
  creationTime: string;
644
907
  state: PrebuiltWorkspaceState;
908
+ statusVersion: number;
645
909
  error?: string;
646
910
  snapshot?: string;
647
911
  }
648
912
 
649
913
  export namespace PrebuiltWorkspace {
650
914
  export function isDone(pws: PrebuiltWorkspace) {
651
- return pws.state === "available" || pws.state === "timeout" || pws.state === 'aborted';
915
+ return (
916
+ pws.state === "available" || pws.state === "timeout" || pws.state === "aborted" || pws.state === "failed"
917
+ );
652
918
  }
653
919
 
654
920
  export function isAvailable(pws: PrebuiltWorkspace) {
@@ -667,27 +933,33 @@ export interface PrebuiltWorkspaceUpdatable {
667
933
  repo: string;
668
934
  isResolved: boolean;
669
935
  installationId: string;
936
+ /**
937
+ * the commitSHA of the commit that triggered the prebuild
938
+ */
939
+ commitSHA?: string;
670
940
  issue?: string;
671
941
  contextUrl?: string;
672
942
  }
673
943
 
674
944
  export interface WhitelistedRepository {
675
- url: string
676
- name: string
677
- description?: string
678
- avatar?: string
945
+ url: string;
946
+ name: string;
947
+ description?: string;
948
+ avatar?: string;
679
949
  }
680
950
 
681
- export type PortOnOpen = 'open-browser' | 'open-preview' | 'notify' | 'ignore';
951
+ export type PortOnOpen = "open-browser" | "open-preview" | "notify" | "ignore";
682
952
 
683
953
  export interface PortConfig {
684
954
  port: number;
685
955
  onOpen?: PortOnOpen;
686
956
  visibility?: PortVisibility;
957
+ description?: string;
958
+ name?: string;
687
959
  }
688
960
  export namespace PortConfig {
689
961
  export function is(config: any): config is PortConfig {
690
- return config && ('port' in config) && (typeof config.port === 'number');
962
+ return config && "port" in config && typeof config.port === "number";
691
963
  }
692
964
  }
693
965
 
@@ -697,7 +969,7 @@ export interface PortRangeConfig {
697
969
  }
698
970
  export namespace PortRangeConfig {
699
971
  export function is(config: any): config is PortRangeConfig {
700
- return config && ('port' in config) && (typeof config.port === 'string' || config.port instanceof String);
972
+ return config && "port" in config && (typeof config.port === "string" || config.port instanceof String);
701
973
  }
702
974
  }
703
975
 
@@ -708,32 +980,31 @@ export interface TaskConfig {
708
980
  prebuild?: string;
709
981
  command?: string;
710
982
  env?: { [env: string]: any };
711
- openIn?: 'bottom' | 'main' | 'left' | 'right';
712
- openMode?: 'split-top' | 'split-left' | 'split-right' | 'split-bottom' | 'tab-before' | 'tab-after';
983
+ openIn?: "bottom" | "main" | "left" | "right";
984
+ openMode?: "split-top" | "split-left" | "split-right" | "split-bottom" | "tab-before" | "tab-after";
713
985
  }
714
986
 
715
987
  export namespace TaskConfig {
716
988
  export function is(config: any): config is TaskConfig {
717
- return config
718
- && ('command' in config || 'init' in config || 'before' in config);
989
+ return config && ("command" in config || "init" in config || "before" in config);
719
990
  }
720
991
  }
721
992
 
722
993
  export namespace WorkspaceImageBuild {
723
- export type Phase = 'BaseImage' | 'GitpodLayer' | 'Error' | 'Done';
994
+ export type Phase = "BaseImage" | "GitpodLayer" | "Error" | "Done";
724
995
  export interface StateInfo {
725
- phase: Phase
726
- currentStep?: number
727
- maxSteps?: number
996
+ phase: Phase;
997
+ currentStep?: number;
998
+ maxSteps?: number;
728
999
  }
729
1000
  export interface LogContent {
730
- text: string
731
- upToLine?: number
732
- isDiff?: boolean
1001
+ text: string;
1002
+ upToLine?: number;
1003
+ isDiff?: boolean;
733
1004
  }
734
1005
  export type LogCallback = (info: StateInfo, content: LogContent | undefined) => void;
735
1006
  export namespace LogLine {
736
- export const DELIMITER = '\r\n';
1007
+ export const DELIMITER = "\r\n";
737
1008
  export const DELIMITER_REGEX = /\r?\n/;
738
1009
  }
739
1010
  }
@@ -742,20 +1013,18 @@ export type ImageConfig = ImageConfigString | ImageConfigFile;
742
1013
  export type ImageConfigString = string;
743
1014
  export namespace ImageConfigString {
744
1015
  export function is(config: ImageConfig | undefined): config is ImageConfigString {
745
- return typeof config === 'string';
1016
+ return typeof config === "string";
746
1017
  }
747
-
748
1018
  }
749
1019
  export interface ImageConfigFile {
750
1020
  // Path to the Dockerfile relative to repository root
751
- file: string,
1021
+ file: string;
752
1022
  // Path to the docker build context relative to repository root
753
- context?: string
1023
+ context?: string;
754
1024
  }
755
1025
  export namespace ImageConfigFile {
756
1026
  export function is(config: ImageConfig | undefined): config is ImageConfigFile {
757
- return typeof config === 'object'
758
- && 'file' in config;
1027
+ return typeof config === "object" && "file" in config;
759
1028
  }
760
1029
  }
761
1030
  export interface ExternalImageConfigFile extends ImageConfigFile {
@@ -763,14 +1032,13 @@ export interface ExternalImageConfigFile extends ImageConfigFile {
763
1032
  }
764
1033
  export namespace ExternalImageConfigFile {
765
1034
  export function is(config: any | undefined): config is ExternalImageConfigFile {
766
- return typeof config === 'object'
767
- && 'file' in config
768
- && 'externalSource' in config;
1035
+ return typeof config === "object" && "file" in config && "externalSource" in config;
769
1036
  }
770
1037
  }
771
1038
 
772
1039
  export interface WorkspaceContext {
773
1040
  title: string;
1041
+ ref?: string;
774
1042
  /** 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. */
775
1043
  normalizedContextURL?: string;
776
1044
  forceCreateNewWorkspace?: boolean;
@@ -779,8 +1047,7 @@ export interface WorkspaceContext {
779
1047
 
780
1048
  export namespace WorkspaceContext {
781
1049
  export function is(context: any): context is WorkspaceContext {
782
- return context
783
- && 'title' in context;
1050
+ return context && "title" in context;
784
1051
  }
785
1052
  }
786
1053
 
@@ -789,22 +1056,17 @@ export interface WithSnapshot {
789
1056
  }
790
1057
  export namespace WithSnapshot {
791
1058
  export function is(context: any): context is WithSnapshot {
792
- return context
793
- && 'snapshotBucketId' in context;
1059
+ return context && "snapshotBucketId" in context;
794
1060
  }
795
1061
  }
796
1062
 
797
- export interface WithPrebuild {
798
- snapshotBucketId: string;
1063
+ export interface WithPrebuild extends WithSnapshot {
799
1064
  prebuildWorkspaceId: string;
800
1065
  wasPrebuilt: true;
801
1066
  }
802
1067
  export namespace WithPrebuild {
803
1068
  export function is(context: any): context is WithPrebuild {
804
- return context
805
- && 'snapshotBucketId' in context
806
- && 'prebuildWorkspaceId' in context
807
- && 'wasPrebuilt' in context;
1069
+ return context && WithSnapshot.is(context) && "prebuildWorkspaceId" in context && "wasPrebuilt" in context;
808
1070
  }
809
1071
  }
810
1072
 
@@ -818,16 +1080,14 @@ export interface WithDefaultConfig {
818
1080
 
819
1081
  export namespace WithDefaultConfig {
820
1082
  export function is(context: any): context is WithDefaultConfig {
821
- return context
822
- && 'withDefaultConfig' in context
823
- && context.withDefaultConfig;
1083
+ return context && "withDefaultConfig" in context && context.withDefaultConfig;
824
1084
  }
825
1085
 
826
1086
  export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
827
1087
  return {
828
1088
  ...ctx,
829
- withDefaultConfig: true
830
- }
1089
+ withDefaultConfig: true,
1090
+ };
831
1091
  }
832
1092
  }
833
1093
 
@@ -837,23 +1097,27 @@ export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
837
1097
 
838
1098
  export namespace SnapshotContext {
839
1099
  export function is(context: any): context is SnapshotContext {
840
- return context
841
- && WithSnapshot.is(context)
842
- && 'snapshotId' in context;
1100
+ return context && WithSnapshot.is(context) && "snapshotId" in context;
843
1101
  }
844
1102
  }
845
1103
 
846
- export interface StartPrebuildContext extends WorkspaceContext {
847
- actual: WorkspaceContext;
1104
+ export interface WithCommitHistory {
848
1105
  commitHistory?: string[];
849
- project?: Project;
1106
+ additionalRepositoryCommitHistories?: {
1107
+ cloneUrl: string;
1108
+ commitHistory: string[];
1109
+ }[];
1110
+ }
1111
+
1112
+ export interface StartPrebuildContext extends WorkspaceContext, WithCommitHistory {
1113
+ actual: WorkspaceContext;
1114
+ project: Project;
850
1115
  branch?: string;
851
1116
  }
852
1117
 
853
1118
  export namespace StartPrebuildContext {
854
1119
  export function is(context: any): context is StartPrebuildContext {
855
- return context
856
- && 'actual' in context;
1120
+ return context && "actual" in context;
857
1121
  }
858
1122
  }
859
1123
 
@@ -865,33 +1129,28 @@ export interface PrebuiltWorkspaceContext extends WorkspaceContext {
865
1129
 
866
1130
  export namespace PrebuiltWorkspaceContext {
867
1131
  export function is(context: any): context is PrebuiltWorkspaceContext {
868
- return context
869
- && 'originalContext' in context
870
- && 'prebuiltWorkspace' in context;
1132
+ return context && "originalContext" in context && "prebuiltWorkspace" in context;
871
1133
  }
872
1134
  }
873
1135
 
874
- export interface WithEnvvarsContext extends WorkspaceContext {
875
- envvars: UserEnvVarValue[];
1136
+ export interface WithReferrerContext extends WorkspaceContext {
1137
+ referrer: string;
1138
+ referrerIde?: string;
876
1139
  }
877
1140
 
878
- export namespace WithEnvvarsContext {
879
- export function is(context: any): context is WithEnvvarsContext {
880
- return context
881
- && 'envvars' in context
1141
+ export namespace WithReferrerContext {
1142
+ export function is(context: any): context is WithReferrerContext {
1143
+ return context && "referrer" in context;
882
1144
  }
883
1145
  }
884
1146
 
885
- export interface WorkspaceProbeContext extends WorkspaceContext {
886
- responseURL: string
887
- responseToken: string
1147
+ export interface WithEnvvarsContext extends WorkspaceContext {
1148
+ envvars: EnvVarWithValue[];
888
1149
  }
889
1150
 
890
- export namespace WorkspaceProbeContext {
891
- export function is(context: any): context is WorkspaceProbeContext {
892
- return context
893
- && 'responseURL' in context
894
- && 'responseToken' in context;
1151
+ export namespace WithEnvvarsContext {
1152
+ export function is(context: any): context is WithEnvvarsContext {
1153
+ return context && "envvars" in context;
895
1154
  }
896
1155
  }
897
1156
 
@@ -903,32 +1162,30 @@ export namespace RefType {
903
1162
  }
904
1163
  // This fallback is meant to handle the cases where (for historic reasons) ref is present but refType is missing
905
1164
  return commit.refType || "branch";
906
- }
1165
+ };
907
1166
  }
908
1167
 
909
1168
  export interface Commit {
910
- repository: Repository
911
- revision: string
1169
+ repository: Repository;
1170
+ revision: string;
912
1171
 
913
1172
  // Might contain either a branch or a tag (determined by refType)
914
- ref?: string
1173
+ ref?: string;
915
1174
 
916
1175
  // refType is only set if ref is present (and not for old workspaces, before this feature was added)
917
- refType?: RefType
1176
+ refType?: RefType;
918
1177
  }
919
1178
 
920
1179
  export interface AdditionalContentContext extends WorkspaceContext {
921
-
922
1180
  /**
923
1181
  * utf-8 encoded contents that will be copied on top of the workspace's filesystem
924
1182
  */
925
- additionalFiles: {[filePath: string]: string};
926
-
1183
+ additionalFiles: { [filePath: string]: string };
927
1184
  }
928
1185
 
929
1186
  export namespace AdditionalContentContext {
930
1187
  export function is(ctx: any): ctx is AdditionalContentContext {
931
- return 'additionalFiles' in ctx;
1188
+ return "additionalFiles" in ctx;
932
1189
  }
933
1190
 
934
1191
  export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
@@ -936,16 +1193,59 @@ export namespace AdditionalContentContext {
936
1193
  }
937
1194
  }
938
1195
 
939
- export interface CommitContext extends WorkspaceContext, Commit {
1196
+ export interface OpenPrebuildContext extends WorkspaceContext {
1197
+ openPrebuildID: string;
1198
+ }
1199
+
1200
+ export namespace OpenPrebuildContext {
1201
+ export function is(ctx: any): ctx is OpenPrebuildContext {
1202
+ return "openPrebuildID" in ctx;
1203
+ }
1204
+ }
1205
+
1206
+ export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
940
1207
  /** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
941
- cloneUrl?: string
1208
+ cloneUrl?: string;
1209
+
1210
+ /**
1211
+ * The clone and checkout information for additional repositories in case of multi-repo projects.
1212
+ */
1213
+ additionalRepositoryCheckoutInfo?: GitCheckoutInfo[];
1214
+ }
1215
+
1216
+ export namespace CommitContext {
1217
+ /**
1218
+ * Creates a hash for all the commits of the CommitContext and all sub-repo commit infos.
1219
+ * The hash is max 255 chars long.
1220
+ * @param commitContext
1221
+ * @returns hash for commitcontext
1222
+ */
1223
+ export function computeHash(commitContext: CommitContext): string {
1224
+ // for single commits we use the revision to be backward compatible.
1225
+ if (
1226
+ !commitContext.additionalRepositoryCheckoutInfo ||
1227
+ commitContext.additionalRepositoryCheckoutInfo.length === 0
1228
+ ) {
1229
+ return commitContext.revision;
1230
+ }
1231
+ const hasher = createHash("sha256");
1232
+ hasher.update(commitContext.revision);
1233
+ for (const info of commitContext.additionalRepositoryCheckoutInfo) {
1234
+ hasher.update(info.revision);
1235
+ }
1236
+ return hasher.digest("hex");
1237
+ }
1238
+ }
1239
+
1240
+ export interface GitCheckoutInfo extends Commit {
1241
+ checkoutLocation?: string;
1242
+ upstreamRemoteURI?: string;
1243
+ localBranch?: string;
942
1244
  }
943
1245
 
944
1246
  export namespace CommitContext {
945
1247
  export function is(commit: any): commit is CommitContext {
946
- return WorkspaceContext.is(commit)
947
- && 'repository' in commit
948
- && 'revision' in commit
1248
+ return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
949
1249
  }
950
1250
  }
951
1251
 
@@ -953,17 +1253,14 @@ export interface PullRequestContext extends CommitContext {
953
1253
  nr: number;
954
1254
  ref: string;
955
1255
  base: {
956
- repository: Repository
957
- ref: string
958
- }
1256
+ repository: Repository;
1257
+ ref: string;
1258
+ };
959
1259
  }
960
1260
 
961
1261
  export namespace PullRequestContext {
962
1262
  export function is(ctx: any): ctx is PullRequestContext {
963
- return CommitContext.is(ctx)
964
- && 'nr' in ctx
965
- && 'ref' in ctx
966
- && 'base' in ctx
1263
+ return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
967
1264
  }
968
1265
  }
969
1266
 
@@ -975,10 +1272,7 @@ export interface IssueContext extends CommitContext {
975
1272
 
976
1273
  export namespace IssueContext {
977
1274
  export function is(ctx: any): ctx is IssueContext {
978
- return CommitContext.is(ctx)
979
- && 'nr' in ctx
980
- && 'ref' in ctx
981
- && 'localBranch' in ctx
1275
+ return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
982
1276
  }
983
1277
  }
984
1278
 
@@ -989,9 +1283,7 @@ export interface NavigatorContext extends CommitContext {
989
1283
 
990
1284
  export namespace NavigatorContext {
991
1285
  export function is(ctx: any): ctx is NavigatorContext {
992
- return CommitContext.is(ctx)
993
- && 'path' in ctx
994
- && 'isFile' in ctx
1286
+ return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
995
1287
  }
996
1288
  }
997
1289
 
@@ -1000,6 +1292,8 @@ export interface Repository {
1000
1292
  owner: string;
1001
1293
  name: string;
1002
1294
  cloneUrl: string;
1295
+ /* Optional kind to differentiate between repositories of orgs/groups/projects and personal repos. */
1296
+ repoKind?: string;
1003
1297
  description?: string;
1004
1298
  avatarUrl?: string;
1005
1299
  webUrl?: string;
@@ -1008,8 +1302,8 @@ export interface Repository {
1008
1302
  private?: boolean;
1009
1303
  fork?: {
1010
1304
  // The direct parent of this fork
1011
- parent: Repository
1012
- }
1305
+ parent: Repository;
1306
+ };
1013
1307
  }
1014
1308
  export interface Branch {
1015
1309
  name: string;
@@ -1034,21 +1328,19 @@ export namespace Repository {
1034
1328
  export interface WorkspaceInstancePortsChangedEvent {
1035
1329
  type: "PortsChanged";
1036
1330
  instanceID: string;
1037
- portsOpened: number[]
1038
- portsClosed: number[]
1331
+ portsOpened: number[];
1332
+ portsClosed: number[];
1039
1333
  }
1040
1334
 
1041
1335
  export namespace WorkspaceInstancePortsChangedEvent {
1042
-
1043
1336
  export function is(data: any): data is WorkspaceInstancePortsChangedEvent {
1044
1337
  return data && data.type == "PortsChanged";
1045
1338
  }
1046
-
1047
1339
  }
1048
1340
 
1049
1341
  export interface WorkspaceInfo {
1050
- workspace: Workspace
1051
- latestInstance?: WorkspaceInstance
1342
+ workspace: Workspace;
1343
+ latestInstance?: WorkspaceInstance;
1052
1344
  }
1053
1345
 
1054
1346
  export namespace WorkspaceInfo {
@@ -1064,35 +1356,25 @@ export interface WorkspaceCreationResult {
1064
1356
  workspaceURL?: string;
1065
1357
  existingWorkspaces?: WorkspaceInfo[];
1066
1358
  runningWorkspacePrebuild?: {
1067
- prebuildID: string
1068
- workspaceID: string
1069
- instanceID: string
1070
- starting: RunningWorkspacePrebuildStarting
1071
- sameCluster: boolean
1072
- }
1359
+ prebuildID: string;
1360
+ workspaceID: string;
1361
+ instanceID: string;
1362
+ starting: RunningWorkspacePrebuildStarting;
1363
+ sameCluster: boolean;
1364
+ };
1073
1365
  runningPrebuildWorkspaceID?: string;
1074
1366
  }
1075
- export type RunningWorkspacePrebuildStarting = 'queued' | 'starting' | 'running';
1076
-
1077
- export enum CreateWorkspaceMode {
1078
- // Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
1079
- Default = 'default',
1080
- // 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.
1081
- ForceNew = 'force-new',
1082
- // UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
1083
- UsePrebuild = 'use-prebuild',
1084
- // SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
1085
- SelectIfRunning = 'select-if-running',
1086
- }
1367
+ export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
1087
1368
 
1088
1369
  export namespace WorkspaceCreationResult {
1089
1370
  export function is(data: any): data is WorkspaceCreationResult {
1090
- return data && (
1091
- 'createdWorkspaceId' in data
1092
- || 'existingWorkspaces' in data
1093
- || 'runningWorkspacePrebuild' in data
1094
- || 'runningPrebuildWorkspaceID' in data
1095
- )
1371
+ return (
1372
+ data &&
1373
+ ("createdWorkspaceId" in data ||
1374
+ "existingWorkspaces" in data ||
1375
+ "runningWorkspacePrebuild" in data ||
1376
+ "runningPrebuildWorkspaceID" in data)
1377
+ );
1096
1378
  }
1097
1379
  }
1098
1380
 
@@ -1126,7 +1408,7 @@ export interface AuthProviderInfo {
1126
1408
  readonly default: string[];
1127
1409
  readonly publicRepo: string[];
1128
1410
  readonly privateRepo: string[];
1129
- }
1411
+ };
1130
1412
  }
1131
1413
 
1132
1414
  export interface AuthProviderEntry {
@@ -1138,6 +1420,8 @@ export interface AuthProviderEntry {
1138
1420
  readonly status: AuthProviderEntry.Status;
1139
1421
 
1140
1422
  readonly oauth: OAuth2Config;
1423
+ /** A random string that is to change whenever oauth changes (enforced on DB level) */
1424
+ readonly oauthRevision?: string;
1141
1425
  }
1142
1426
 
1143
1427
  export interface OAuth2Config {
@@ -1150,56 +1434,27 @@ export interface OAuth2Config {
1150
1434
  readonly scopeSeparator?: string;
1151
1435
 
1152
1436
  readonly settingsUrl?: string;
1153
- readonly authorizationParams?: { [key: string]: string }
1437
+ readonly authorizationParams?: { [key: string]: string };
1154
1438
  readonly configURL?: string;
1155
1439
  }
1156
1440
 
1157
1441
  export namespace AuthProviderEntry {
1158
1442
  export type Type = "GitHub" | "GitLab" | string;
1159
1443
  export type Status = "pending" | "verified";
1160
- export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & { clientId?: string, clientSecret?: string };
1161
- export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> & Pick<OAuth2Config, "clientId" | "clientSecret">;
1444
+ export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & {
1445
+ clientId?: string;
1446
+ clientSecret?: string;
1447
+ };
1448
+ export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> &
1449
+ Pick<OAuth2Config, "clientId" | "clientSecret">;
1162
1450
  export function redact(entry: AuthProviderEntry): AuthProviderEntry {
1163
1451
  return {
1164
1452
  ...entry,
1165
1453
  oauth: {
1166
1454
  ...entry.oauth,
1167
- clientSecret: "redacted"
1168
- }
1169
- }
1170
- }
1171
- }
1172
-
1173
- export interface Branding {
1174
- readonly name: string;
1175
- readonly favicon?: string;
1176
- /** Either including domain OR absolute path (interpreted relative to host URL) */
1177
- readonly logo: string;
1178
- readonly startupLogo: string;
1179
- readonly showProductivityTips: boolean;
1180
- readonly redirectUrlIfNotAuthenticated?: string;
1181
- readonly redirectUrlAfterLogout?: string;
1182
- readonly homepage: string;
1183
- readonly ide?: {
1184
- readonly logo: string;
1185
- readonly showReleaseNotes: boolean;
1186
- readonly helpMenu: Branding.Link[];
1187
- }
1188
- readonly links: {
1189
- readonly header: Branding.Link[];
1190
- readonly footer: Branding.Link[];
1191
- readonly social: Branding.SocialLink[];
1192
- readonly legal: Branding.Link[];
1193
- }
1194
- }
1195
- export namespace Branding {
1196
- export interface Link {
1197
- readonly name: string;
1198
- readonly url: string;
1199
- }
1200
- export interface SocialLink {
1201
- readonly type: string;
1202
- readonly url: string;
1455
+ clientSecret: "redacted",
1456
+ },
1457
+ };
1203
1458
  }
1204
1459
  }
1205
1460
 
@@ -1243,3 +1498,8 @@ export interface Terms {
1243
1498
  readonly content: string;
1244
1499
  readonly formElements?: object;
1245
1500
  }
1501
+
1502
+ export interface StripeConfig {
1503
+ individualUsagePriceIds: { [currency: string]: string };
1504
+ teamUsagePriceIds: { [currency: string]: string };
1505
+ }