@gitpod/gitpod-protocol 0.1.5-wth-test.80 → 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 (408) hide show
  1. package/data/gitpod-schema.json +132 -5
  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 +19 -2
  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 +1 -1
  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 +1 -2
  30. package/lib/context-url.d.ts.map +1 -1
  31. package/lib/context-url.js +5 -7
  32. package/lib/context-url.js.map +1 -1
  33. package/lib/context-url.spec.d.ts +1 -3
  34. package/lib/context-url.spec.d.ts.map +1 -1
  35. package/lib/context-url.spec.js +13 -26
  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 +70 -52
  85. package/lib/gitpod-service.d.ts.map +1 -1
  86. package/lib/gitpod-service.js +53 -34
  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 +29 -8
  95. package/lib/ide-protocol.d.ts.map +1 -1
  96. package/lib/ide-protocol.js +11 -1
  97. package/lib/ide-protocol.js.map +1 -1
  98. package/lib/index.d.ts +17 -17
  99. package/lib/index.d.ts.map +1 -1
  100. package/lib/index.js +2 -2
  101. package/lib/index.js.map +1 -1
  102. package/lib/installation-admin-protocol.d.ts +4 -1
  103. package/lib/installation-admin-protocol.d.ts.map +1 -1
  104. package/lib/installation-admin-protocol.js +4 -3
  105. package/lib/installation-admin-protocol.js.map +1 -1
  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 +10 -2
  123. package/lib/messaging/error.d.ts.map +1 -1
  124. package/lib/messaging/error.js +20 -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.js +8 -8
  129. package/lib/messaging/node/connection.js.map +1 -1
  130. package/lib/messaging/proxy-factory.d.ts +1 -1
  131. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  132. package/lib/messaging/proxy-factory.js +7 -9
  133. package/lib/messaging/proxy-factory.js.map +1 -1
  134. package/lib/oss-allowlist.d.ts +1 -1
  135. package/lib/oss-allowlist.js +1 -1
  136. package/lib/payment-protocol.d.ts +1 -1
  137. package/lib/payment-protocol.d.ts.map +1 -1
  138. package/lib/payment-protocol.js +2 -2
  139. package/lib/payment-protocol.js.map +1 -1
  140. package/lib/permission.d.ts +3 -3
  141. package/lib/permission.d.ts.map +1 -1
  142. package/lib/permission.js +13 -24
  143. package/lib/permission.js.map +1 -1
  144. package/lib/plans.d.ts +5 -4
  145. package/lib/plans.d.ts.map +1 -1
  146. package/lib/plans.js +211 -172
  147. package/lib/plans.js.map +1 -1
  148. package/lib/protocol.d.ts +166 -61
  149. package/lib/protocol.d.ts.map +1 -1
  150. package/lib/protocol.js +282 -106
  151. package/lib/protocol.js.map +1 -1
  152. package/lib/protocol.spec.d.ts +7 -0
  153. package/lib/protocol.spec.d.ts.map +1 -0
  154. package/lib/protocol.spec.js +127 -0
  155. package/lib/protocol.spec.js.map +1 -0
  156. package/lib/snapshot-url.d.ts +1 -1
  157. package/lib/snapshot-url.js +1 -1
  158. package/lib/snapshot-url.spec.d.ts +1 -1
  159. package/lib/snapshot-url.spec.js +1 -1
  160. package/lib/snapshot-url.spec.js.map +1 -1
  161. package/lib/team-subscription-protocol.d.ts +23 -4
  162. package/lib/team-subscription-protocol.d.ts.map +1 -1
  163. package/lib/team-subscription-protocol.js +21 -6
  164. package/lib/team-subscription-protocol.js.map +1 -1
  165. package/lib/teams-projects-protocol.d.ts +26 -6
  166. package/lib/teams-projects-protocol.d.ts.map +1 -1
  167. package/lib/teams-projects-protocol.js +2 -2
  168. package/lib/teams-projects-protocol.js.map +1 -1
  169. package/lib/typings/globals.d.ts +3 -3
  170. package/lib/typings/globals.d.ts.map +1 -1
  171. package/lib/typings/globals.js +1 -1
  172. package/lib/usage.d.ts +73 -0
  173. package/lib/usage.d.ts.map +1 -0
  174. package/lib/usage.js +20 -0
  175. package/lib/usage.js.map +1 -0
  176. package/lib/util/analytics.d.ts +1 -1
  177. package/lib/util/analytics.d.ts.map +1 -1
  178. package/lib/util/analytics.js +7 -7
  179. package/lib/util/analytics.js.map +1 -1
  180. package/lib/util/async-iterator.d.ts +1 -1
  181. package/lib/util/async-iterator.d.ts.map +1 -1
  182. package/lib/util/async-iterator.js +4 -4
  183. package/lib/util/async-iterator.js.map +1 -1
  184. package/lib/util/cancelable.d.ts +1 -1
  185. package/lib/util/cancelable.js +1 -1
  186. package/lib/util/cancelable.js.map +1 -1
  187. package/lib/util/date-time.d.ts +1 -1
  188. package/lib/util/date-time.js +7 -7
  189. package/lib/util/date-time.js.map +1 -1
  190. package/lib/util/debug-app.d.ts +25 -0
  191. package/lib/util/debug-app.d.ts.map +1 -0
  192. package/lib/util/debug-app.js +100 -0
  193. package/lib/util/debug-app.js.map +1 -0
  194. package/lib/util/deep-partial.d.ts +1 -1
  195. package/lib/util/deep-partial.js +1 -1
  196. package/lib/util/deferred.d.ts +1 -1
  197. package/lib/util/deferred.js +1 -1
  198. package/lib/util/deferred.js.map +1 -1
  199. package/lib/util/disposable.d.ts.map +1 -1
  200. package/lib/util/disposable.js +2 -2
  201. package/lib/util/disposable.js.map +1 -1
  202. package/lib/util/event.d.ts.map +1 -1
  203. package/lib/util/event.js +5 -3
  204. package/lib/util/event.js.map +1 -1
  205. package/lib/util/garbage-collected-cache.d.ts +1 -1
  206. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  207. package/lib/util/garbage-collected-cache.js +7 -2
  208. package/lib/util/garbage-collected-cache.js.map +1 -1
  209. package/lib/util/generate-workspace-id.d.ts +5 -0
  210. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  211. package/lib/util/generate-workspace-id.js +446 -442
  212. package/lib/util/generate-workspace-id.js.map +1 -1
  213. package/lib/util/generate-workspace-id.spec.d.ts +1 -1
  214. package/lib/util/generate-workspace-id.spec.js +19 -8
  215. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  216. package/lib/util/gitpod-cookie.d.ts +2 -2
  217. package/lib/util/gitpod-cookie.d.ts.map +1 -1
  218. package/lib/util/gitpod-cookie.js +1 -4
  219. package/lib/util/gitpod-cookie.js.map +1 -1
  220. package/lib/util/gitpod-host-url.d.ts +6 -1
  221. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  222. package/lib/util/gitpod-host-url.js +60 -33
  223. package/lib/util/gitpod-host-url.js.map +1 -1
  224. package/lib/util/gitpod-host-url.spec.d.ts +1 -1
  225. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  226. package/lib/util/gitpod-host-url.spec.js +16 -6
  227. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  228. package/lib/util/grpc.d.ts +21 -1
  229. package/lib/util/grpc.d.ts.map +1 -1
  230. package/lib/util/grpc.js +74 -2
  231. package/lib/util/grpc.js.map +1 -1
  232. package/lib/util/jaeger-client-types.d.ts +1 -1
  233. package/lib/util/jaeger-client-types.d.ts.map +1 -1
  234. package/lib/util/jaeger-client-types.js +1 -1
  235. package/lib/util/logging.d.ts +2 -2
  236. package/lib/util/logging.d.ts.map +1 -1
  237. package/lib/util/logging.js +32 -26
  238. package/lib/util/logging.js.map +1 -1
  239. package/lib/util/logging.spec.d.ts +7 -0
  240. package/lib/util/logging.spec.d.ts.map +1 -0
  241. package/lib/util/logging.spec.js +52 -0
  242. package/lib/util/logging.spec.js.map +1 -0
  243. package/lib/util/make-link.d.ts +1 -1
  244. package/lib/util/make-link.js +6 -6
  245. package/lib/util/make-link.js.map +1 -1
  246. package/lib/util/nice-grpc.d.ts +9 -0
  247. package/lib/util/nice-grpc.d.ts.map +1 -0
  248. package/lib/util/nice-grpc.js +121 -0
  249. package/lib/util/nice-grpc.js.map +1 -0
  250. package/lib/util/parse-workspace-id.d.ts +1 -1
  251. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  252. package/lib/util/parse-workspace-id.js +2 -3
  253. package/lib/util/parse-workspace-id.js.map +1 -1
  254. package/lib/util/parse-workspace-id.spec.d.ts +1 -1
  255. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  256. package/lib/util/parse-workspace-id.spec.js +1 -1
  257. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  258. package/lib/util/queue.d.ts +1 -1
  259. package/lib/util/queue.js +1 -1
  260. package/lib/util/queue.spec.d.ts +1 -1
  261. package/lib/util/queue.spec.js +10 -7
  262. package/lib/util/queue.spec.js.map +1 -1
  263. package/lib/util/repeat.d.ts +1 -1
  264. package/lib/util/repeat.js +1 -1
  265. package/lib/util/semaphore.d.ts +1 -1
  266. package/lib/util/semaphore.d.ts.map +1 -1
  267. package/lib/util/semaphore.js +1 -1
  268. package/lib/util/semaphore.js.map +1 -1
  269. package/lib/util/skip-if.d.ts +1 -1
  270. package/lib/util/skip-if.d.ts.map +1 -1
  271. package/lib/util/skip-if.js +1 -1
  272. package/lib/util/skip-if.js.map +1 -1
  273. package/lib/util/timeutil.d.ts +3 -1
  274. package/lib/util/timeutil.d.ts.map +1 -1
  275. package/lib/util/timeutil.js +16 -4
  276. package/lib/util/timeutil.js.map +1 -1
  277. package/lib/util/timeutil.spec.d.ts +3 -1
  278. package/lib/util/timeutil.spec.d.ts.map +1 -1
  279. package/lib/util/timeutil.spec.js +35 -1
  280. package/lib/util/timeutil.spec.js.map +1 -1
  281. package/lib/util/tracing.d.ts +7 -7
  282. package/lib/util/tracing.d.ts.map +1 -1
  283. package/lib/util/tracing.js +15 -17
  284. package/lib/util/tracing.js.map +1 -1
  285. package/lib/util/tracing.spec.d.ts +1 -1
  286. package/lib/util/tracing.spec.js +4 -4
  287. package/lib/util/tracing.spec.js.map +1 -1
  288. package/lib/util/workspace-port-authentication.d.ts +8 -8
  289. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  290. package/lib/util/workspace-port-authentication.js +9 -12
  291. package/lib/util/workspace-port-authentication.js.map +1 -1
  292. package/lib/webhook-event.d.ts +44 -0
  293. package/lib/webhook-event.d.ts.map +1 -0
  294. package/lib/webhook-event.js +8 -0
  295. package/lib/webhook-event.js.map +1 -0
  296. package/lib/workspace-class.d.ts +14 -0
  297. package/lib/workspace-class.d.ts.map +1 -0
  298. package/lib/workspace-class.js +8 -0
  299. package/lib/workspace-class.js.map +1 -0
  300. package/lib/workspace-cluster.d.ts +13 -14
  301. package/lib/workspace-cluster.d.ts.map +1 -1
  302. package/lib/workspace-cluster.js +3 -5
  303. package/lib/workspace-cluster.js.map +1 -1
  304. package/lib/workspace-instance.d.ts +22 -4
  305. package/lib/workspace-instance.d.ts.map +1 -1
  306. package/lib/workspace-instance.js +1 -1
  307. package/lib/wsready.d.ts +8 -2
  308. package/lib/wsready.d.ts.map +1 -1
  309. package/lib/wsready.js +3 -3
  310. package/package.json +14 -6
  311. package/pkg-yarn.lock +10 -5
  312. package/provenance-bundle.jsonl +1 -1
  313. package/src/accounting-protocol.ts +67 -52
  314. package/src/admin-protocol.ts +48 -22
  315. package/src/analytics.ts +22 -22
  316. package/src/attribution.ts +63 -0
  317. package/src/auth.ts +3 -3
  318. package/src/billing-mode.ts +84 -0
  319. package/src/blocked-repositories-protocol.ts +13 -0
  320. package/src/context-url.spec.ts +18 -22
  321. package/src/context-url.ts +79 -79
  322. package/src/encryption/container-module.ts +3 -4
  323. package/src/encryption/encryption-engine.spec.ts +10 -9
  324. package/src/encryption/encryption-engine.ts +21 -17
  325. package/src/encryption/encryption-service.ts +5 -6
  326. package/src/encryption/key-provider.ts +17 -20
  327. package/src/env.ts +2 -25
  328. package/src/experiments/always-default.ts +24 -0
  329. package/src/experiments/configcat-server.ts +42 -0
  330. package/src/experiments/configcat.ts +56 -0
  331. package/src/experiments/types.ts +34 -0
  332. package/src/gitpod-file-parser.spec.ts +56 -62
  333. package/src/gitpod-file-parser.ts +17 -18
  334. package/src/gitpod-service.ts +216 -140
  335. package/src/headless-workspace-log.ts +7 -5
  336. package/src/ide-frontend-service.ts +3 -3
  337. package/src/ide-protocol.ts +38 -10
  338. package/src/index.ts +17 -17
  339. package/src/installation-admin-protocol.ts +12 -9
  340. package/src/license-protocol.ts +13 -7
  341. package/src/messaging/browser/connection.ts +45 -47
  342. package/src/messaging/browser/window-connection.ts +40 -30
  343. package/src/messaging/client-call-metrics.ts +79 -82
  344. package/src/messaging/error.ts +30 -8
  345. package/src/messaging/handler.ts +6 -6
  346. package/src/messaging/node/connection.ts +8 -8
  347. package/src/messaging/proxy-factory.ts +23 -30
  348. package/src/oss-allowlist.ts +4 -4
  349. package/src/payment-protocol.ts +3 -3
  350. package/src/permission.ts +21 -32
  351. package/src/plans.ts +241 -190
  352. package/src/protocol.spec.ts +97 -0
  353. package/src/protocol.ts +524 -265
  354. package/src/snapshot-url.spec.ts +10 -8
  355. package/src/snapshot-url.ts +1 -1
  356. package/src/team-subscription-protocol.ts +60 -23
  357. package/src/teams-projects-protocol.ts +36 -12
  358. package/src/typings/globals.ts +5 -5
  359. package/src/usage.ts +85 -0
  360. package/src/util/analytics.ts +47 -43
  361. package/src/util/async-iterator.ts +5 -6
  362. package/src/util/cancelable.ts +4 -4
  363. package/src/util/date-time.ts +9 -9
  364. package/src/util/debug-app.ts +81 -0
  365. package/src/util/deep-partial.ts +1 -1
  366. package/src/util/deferred.ts +7 -7
  367. package/src/util/disposable.ts +3 -6
  368. package/src/util/event.ts +9 -11
  369. package/src/util/garbage-collected-cache.ts +9 -7
  370. package/src/util/generate-workspace-id.spec.ts +27 -17
  371. package/src/util/generate-workspace-id.ts +461 -455
  372. package/src/util/gitpod-cookie.ts +9 -10
  373. package/src/util/gitpod-host-url.spec.ts +41 -14
  374. package/src/util/gitpod-host-url.ts +69 -37
  375. package/src/util/grpc.ts +94 -2
  376. package/src/util/jaeger-client-types.ts +3 -3
  377. package/src/util/logging.spec.ts +23 -0
  378. package/src/util/logging.ts +61 -43
  379. package/src/util/make-link.ts +7 -8
  380. package/src/util/nice-grpc.ts +96 -0
  381. package/src/util/parse-workspace-id.spec.ts +18 -9
  382. package/src/util/parse-workspace-id.ts +6 -7
  383. package/src/util/queue.spec.ts +28 -26
  384. package/src/util/queue.ts +1 -1
  385. package/src/util/repeat.ts +2 -2
  386. package/src/util/semaphore.ts +5 -7
  387. package/src/util/skip-if.ts +10 -7
  388. package/src/util/timeutil.spec.ts +41 -15
  389. package/src/util/timeutil.ts +28 -12
  390. package/src/util/tracing.spec.ts +29 -24
  391. package/src/util/tracing.ts +55 -52
  392. package/src/util/workspace-port-authentication.ts +11 -14
  393. package/src/webhook-event.ts +55 -0
  394. package/src/workspace-class.ts +14 -0
  395. package/src/workspace-cluster.ts +25 -19
  396. package/src/workspace-instance.ts +67 -25
  397. package/src/wsready.ts +11 -4
  398. package/data/builtin-theia-plugins.json +0 -372
  399. package/lib/email-protocol.d.ts +0 -49
  400. package/lib/email-protocol.d.ts.map +0 -1
  401. package/lib/email-protocol.js +0 -28
  402. package/lib/email-protocol.js.map +0 -1
  403. package/lib/theia-plugins.d.ts +0 -11
  404. package/lib/theia-plugins.d.ts.map +0 -1
  405. package/lib/theia-plugins.js +0 -8
  406. package/lib/theia-plugins.js.map +0 -1
  407. package/src/email-protocol.ts +0 -66
  408. package/src/theia-plugins.ts +0 -11
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,15 +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[];
107
-
108
209
  // Git clone URL pointing to the user's dotfile repo
109
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;
110
239
  }
111
240
 
112
241
  export interface EmailNotificationSettings {
@@ -116,10 +245,18 @@ export interface EmailNotificationSettings {
116
245
  }
117
246
 
118
247
  export type IDESettings = {
119
- defaultIde?: string
120
- useDesktopIde?: boolean
121
- defaultDesktopIde?: string
122
- useLatestVersion?: boolean
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;
123
260
  }
124
261
 
125
262
  export interface UserPlatform {
@@ -148,12 +285,25 @@ export interface UserFeatureSettings {
148
285
  permanentWSFeatureFlags?: NamedWorkspaceFeatureFlag[];
149
286
  }
150
287
 
288
+ export type BillingTier = "paid" | "free";
289
+
151
290
  /**
152
291
  * The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
153
292
  * If they don't we'll break things during workspace startup.
154
293
  */
155
- export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
156
- 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
+ }
157
307
 
158
308
  export interface EnvVarWithValue {
159
309
  name: string;
@@ -166,7 +316,7 @@ export interface ProjectEnvVarWithValue extends EnvVarWithValue {
166
316
  censored: boolean;
167
317
  }
168
318
 
169
- export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, 'value'>;
319
+ export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, "value">;
170
320
 
171
321
  export interface UserEnvVarValue extends EnvVarWithValue {
172
322
  id?: string;
@@ -179,6 +329,44 @@ export interface UserEnvVar extends UserEnvVarValue {
179
329
  }
180
330
 
181
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
+ }
182
370
 
183
371
  // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
184
372
  export function normalizeRepoPattern(pattern: string) {
@@ -199,7 +387,7 @@ export namespace UserEnvVar {
199
387
  if (repoPattern == "*") {
200
388
  score += 1;
201
389
  }
202
- if (ownerPattern == '*') {
390
+ if (ownerPattern == "*") {
203
391
  score += 2;
204
392
  }
205
393
  if (ownerPattern == "#" || repoPattern == "#") {
@@ -210,20 +398,20 @@ export namespace UserEnvVar {
210
398
 
211
399
  // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
212
400
  export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
213
- let result = vars.filter(e => {
401
+ let result = vars.filter((e) => {
214
402
  const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
215
- if (ownerPattern !== '*' && ownerPattern !== '#' && (!!owner && ownerPattern !== owner.toLocaleLowerCase())) {
403
+ if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
216
404
  return false;
217
405
  }
218
- if (repoPattern !== '*' && repoPattern !== '#' && (!!repo && repoPattern !== repo.toLocaleLowerCase())) {
406
+ if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
219
407
  return false;
220
408
  }
221
409
  return true;
222
410
  });
223
411
 
224
412
  const resmap = new Map<string, T[]>();
225
- result.forEach(e => {
226
- const l = (resmap.get(e.name) || []);
413
+ result.forEach((e) => {
414
+ const l = resmap.get(e.name) || [];
227
415
  l.push(e);
228
416
  resmap.set(e.name, l);
229
417
  });
@@ -258,46 +446,107 @@ export namespace UserEnvVar {
258
446
 
259
447
  // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
260
448
  export function splitRepositoryPattern(repositoryPattern: string): string[] {
261
- const patterns = repositoryPattern.split('/');
262
- const repoPattern = patterns.slice(1).join('/')
449
+ const patterns = repositoryPattern.split("/");
450
+ const repoPattern = patterns.slice(1).join("/");
263
451
  const ownerPattern = patterns[0];
264
452
  return [ownerPattern, repoPattern];
265
453
  }
266
454
  }
267
455
 
268
- 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
+ }
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
+ }
269
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 {
270
519
  /** Hash value (SHA256) of the token (primary key). */
271
- tokenHash: string
520
+ tokenHash: string;
272
521
 
273
522
  /** Human readable name of the token */
274
- name?: string
523
+ name?: string;
275
524
 
276
525
  /** Token kind */
277
- type: GitpodTokenType
526
+ type: GitpodTokenType;
278
527
 
279
528
  /** The user the token belongs to. */
280
- user: User
529
+ user: User;
281
530
 
282
531
  /** Scopes (e.g. limition to read-only) */
283
- scopes: string[]
532
+ scopes: string[];
284
533
 
285
534
  /** Created timestamp */
286
- created: string
535
+ created: string;
287
536
 
288
537
  // token is deleted on the database and about to be collected by db-sync
289
- deleted?: boolean
538
+ deleted?: boolean;
290
539
  }
291
540
 
292
541
  export enum GitpodTokenType {
293
542
  API_AUTH_TOKEN = 0,
294
- MACHINE_AUTH_TOKEN = 1
543
+ MACHINE_AUTH_TOKEN = 1,
295
544
  }
296
545
 
297
546
  export interface OneTimeSecret {
298
- id: string
547
+ id: string;
299
548
 
300
- value: string
549
+ value: string;
301
550
 
302
551
  expirationTime: string;
303
552
 
@@ -329,13 +578,12 @@ export type IdentityLookup = Pick<Identity, "authProviderId" | "authId">;
329
578
 
330
579
  export namespace Identity {
331
580
  export function is(data: any): data is Identity {
332
- return data.hasOwnProperty('authProviderId')
333
- && data.hasOwnProperty('authId')
334
- && data.hasOwnProperty('authName')
581
+ return (
582
+ data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName")
583
+ );
335
584
  }
336
585
  export function equals(id1: IdentityLookup, id2: IdentityLookup) {
337
- return id1.authProviderId === id2.authProviderId
338
- && id1.authId === id2.authId
586
+ return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
339
587
  }
340
588
  }
341
589
 
@@ -386,6 +634,7 @@ export interface PendingGithubEvent {
386
634
  creationDate: Date;
387
635
  type: string;
388
636
  event: string;
637
+ deleted: boolean;
389
638
  }
390
639
 
391
640
  export interface Snapshot {
@@ -394,18 +643,11 @@ export interface Snapshot {
394
643
  availableTime?: string;
395
644
  originalWorkspaceId: string;
396
645
  bucketId: string;
397
- layoutData?: string;
398
646
  state: SnapshotState;
399
647
  message?: string;
400
648
  }
401
649
 
402
- export type SnapshotState = 'pending' | 'available' | 'error';
403
-
404
- export interface LayoutData {
405
- workspaceId: string;
406
- lastUpdatedTime: string;
407
- layoutData: string;
408
- }
650
+ export type SnapshotState = "pending" | "available" | "error";
409
651
 
410
652
  export interface Workspace {
411
653
  id: string;
@@ -428,13 +670,13 @@ export interface Workspace {
428
670
  * The resolved, fix name of the workspace image. We only use this
429
671
  * to access the logs during an image build.
430
672
  */
431
- imageNameResolved?: string
673
+ imageNameResolved?: string;
432
674
 
433
675
  /**
434
676
  * The resolved/built fixed named of the base image. This field is only set if the workspace
435
677
  * already has its base image built.
436
678
  */
437
- baseImageNameResolved?: string
679
+ baseImageNameResolved?: string;
438
680
 
439
681
  shareable?: boolean;
440
682
  pinned?: boolean;
@@ -468,20 +710,19 @@ export interface Workspace {
468
710
 
469
711
  export type WorkspaceSoftDeletion = "user" | "gc";
470
712
 
471
- export type WorkspaceType = "regular" | "prebuild" | "probe";
713
+ export type WorkspaceType = "regular" | "prebuild";
472
714
 
473
715
  export namespace Workspace {
474
-
475
716
  export function getFullRepositoryName(ws: Workspace): string | undefined {
476
717
  if (CommitContext.is(ws.context)) {
477
- return ws.context.repository.owner + '/' + ws.context.repository.name
718
+ return ws.context.repository.owner + "/" + ws.context.repository.name;
478
719
  }
479
720
  return undefined;
480
721
  }
481
722
 
482
723
  export function getFullRepositoryUrl(ws: Workspace): string | undefined {
483
724
  if (CommitContext.is(ws.context)) {
484
- return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`
725
+ return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`;
485
726
  }
486
727
  return undefined;
487
728
  }
@@ -515,59 +756,60 @@ export namespace Workspace {
515
756
  }
516
757
  }
517
758
 
518
- export interface PreparePluginUploadParams {
519
- fullPluginName: string;
520
- }
521
-
522
- export interface ResolvePluginsParams {
523
- config?: WorkspaceConfig
524
- builtins?: ResolvedPlugins
525
- vsxRegistryUrl?: string
526
- }
527
-
528
- export interface InstallPluginsParams {
529
- pluginIds: string[]
530
- }
531
-
532
- export interface UninstallPluginParams {
533
- pluginId: string;
534
- }
535
-
536
759
  export interface GuessGitTokenScopesParams {
537
- host: string
538
- repoUrl: string
539
- gitCommand: string
540
- currentToken: GitToken
760
+ host: string;
761
+ repoUrl: string;
762
+ gitCommand: string;
763
+ currentToken: GitToken;
541
764
  }
542
765
 
543
766
  export interface GitToken {
544
- token: string
545
- user: string
546
- scopes: string[]
767
+ token: string;
768
+ user: string;
769
+ scopes: string[];
547
770
  }
548
771
 
549
772
  export interface GuessedGitTokenScopes {
550
- message?: string
551
- scopes?: string[]
773
+ message?: string;
774
+ scopes?: string[];
552
775
  }
553
776
 
554
- export type ResolvedPluginKind = 'user' | 'workspace' | 'builtin';
777
+ export interface VSCodeConfig {
778
+ extensions?: string[];
779
+ }
555
780
 
556
- export interface ResolvedPlugins {
557
- [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";
558
797
  }
559
798
 
560
- export interface ResolvedPlugin {
561
- fullPluginName: string;
799
+ export interface RepositoryCloneInformation {
562
800
  url: string;
563
- kind: ResolvedPluginKind;
801
+ checkoutLocation?: string;
564
802
  }
565
803
 
566
- export interface VSCodeConfig {
567
- extensions?: string[];
804
+ export interface CoreDumpConfig {
805
+ enabled?: boolean;
806
+ softLimit?: number;
807
+ hardLimit?: number;
568
808
  }
569
809
 
570
810
  export interface WorkspaceConfig {
811
+ mainConfiguration?: string;
812
+ additionalRepositories?: RepositoryCloneInformation[];
571
813
  image?: ImageConfig;
572
814
  ports?: PortConfig[];
573
815
  tasks?: TaskConfig[];
@@ -576,6 +818,8 @@ export interface WorkspaceConfig {
576
818
  gitConfig?: { [config: string]: string };
577
819
  github?: GithubAppConfig;
578
820
  vscode?: VSCodeConfig;
821
+ jetbrains?: JetBrainsConfig;
822
+ coreDump?: CoreDumpConfig;
579
823
 
580
824
  /** deprecated. Enabled by default **/
581
825
  experimentalNetwork?: boolean;
@@ -584,13 +828,12 @@ export interface WorkspaceConfig {
584
828
  * Where the config object originates from.
585
829
  *
586
830
  * repo - from the repository
587
- * project-db - from the "Project" stored in the database
588
831
  * definitly-gp - from github.com/gitpod-io/definitely-gp
589
832
  * derived - computed based on analyzing the repository
590
833
  * additional-content - config comes from additional content, usually provided through the project's configuration
591
834
  * default - our static catch-all default config
592
835
  */
593
- _origin?: 'repo' | 'project-db' | 'definitely-gp' | 'derived' | 'additional-content' | 'default';
836
+ _origin?: "repo" | "definitely-gp" | "derived" | "additional-content" | "default";
594
837
 
595
838
  /**
596
839
  * Set of automatically infered feature flags. That's not something the user can set, but
@@ -600,34 +843,33 @@ export interface WorkspaceConfig {
600
843
  }
601
844
 
602
845
  export interface GithubAppConfig {
603
- prebuilds?: GithubAppPrebuildConfig
846
+ prebuilds?: GithubAppPrebuildConfig;
604
847
  }
605
848
  export interface GithubAppPrebuildConfig {
606
- master?: boolean
607
- branches?: boolean
608
- pullRequests?: boolean
609
- pullRequestsFromForks?: boolean
610
- addCheck?: boolean | 'prevent-merge-on-error'
611
- addBadge?: boolean
612
- addLabel?: boolean | string
613
- addComment?: boolean
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;
614
857
  }
615
858
  export namespace GithubAppPrebuildConfig {
616
859
  export function is(obj: boolean | GithubAppPrebuildConfig): obj is GithubAppPrebuildConfig {
617
- return !(typeof obj === 'boolean');
860
+ return !(typeof obj === "boolean");
618
861
  }
619
862
  }
620
863
 
621
864
  export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
622
865
  export interface WorkspaceImageSourceDocker {
623
- dockerFilePath: string
624
- dockerFileHash: string
625
- dockerFileSource?: Commit
866
+ dockerFilePath: string;
867
+ dockerFileHash: string;
868
+ dockerFileSource?: Commit;
626
869
  }
627
870
  export namespace WorkspaceImageSourceDocker {
628
871
  export function is(obj: object): obj is WorkspaceImageSourceDocker {
629
- return 'dockerFileHash' in obj
630
- && 'dockerFilePath' in obj;
872
+ return "dockerFileHash" in obj && "dockerFilePath" in obj;
631
873
  }
632
874
  }
633
875
  export interface WorkspaceImageSourceReference {
@@ -636,21 +878,23 @@ export interface WorkspaceImageSourceReference {
636
878
  }
637
879
  export namespace WorkspaceImageSourceReference {
638
880
  export function is(obj: object): obj is WorkspaceImageSourceReference {
639
- return 'baseImageResolved' in obj;
881
+ return "baseImageResolved" in obj;
640
882
  }
641
883
  }
642
884
 
643
- export type PrebuiltWorkspaceState
885
+ export type PrebuiltWorkspaceState =
644
886
  // the prebuild is queued and may start at anytime
645
- = "queued"
887
+ | "queued"
646
888
  // the workspace prebuild is currently running (i.e. there's a workspace pod deployed)
647
889
  | "building"
648
- // the prebuild failed due to some issue with the system (e.g. missed a message, could not start workspace)
890
+ // the prebuild was aborted
649
891
  | "aborted"
650
892
  // the prebuild timed out
651
893
  | "timeout"
652
- // the prebuild has finished and a snapshot is available
653
- | "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";
654
898
 
655
899
  export interface PrebuiltWorkspace {
656
900
  id: string;
@@ -661,13 +905,16 @@ export interface PrebuiltWorkspace {
661
905
  buildWorkspaceId: string;
662
906
  creationTime: string;
663
907
  state: PrebuiltWorkspaceState;
908
+ statusVersion: number;
664
909
  error?: string;
665
910
  snapshot?: string;
666
911
  }
667
912
 
668
913
  export namespace PrebuiltWorkspace {
669
914
  export function isDone(pws: PrebuiltWorkspace) {
670
- 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
+ );
671
918
  }
672
919
 
673
920
  export function isAvailable(pws: PrebuiltWorkspace) {
@@ -686,18 +933,22 @@ export interface PrebuiltWorkspaceUpdatable {
686
933
  repo: string;
687
934
  isResolved: boolean;
688
935
  installationId: string;
936
+ /**
937
+ * the commitSHA of the commit that triggered the prebuild
938
+ */
939
+ commitSHA?: string;
689
940
  issue?: string;
690
941
  contextUrl?: string;
691
942
  }
692
943
 
693
944
  export interface WhitelistedRepository {
694
- url: string
695
- name: string
696
- description?: string
697
- avatar?: string
945
+ url: string;
946
+ name: string;
947
+ description?: string;
948
+ avatar?: string;
698
949
  }
699
950
 
700
- export type PortOnOpen = 'open-browser' | 'open-preview' | 'notify' | 'ignore';
951
+ export type PortOnOpen = "open-browser" | "open-preview" | "notify" | "ignore";
701
952
 
702
953
  export interface PortConfig {
703
954
  port: number;
@@ -708,7 +959,7 @@ export interface PortConfig {
708
959
  }
709
960
  export namespace PortConfig {
710
961
  export function is(config: any): config is PortConfig {
711
- return config && ('port' in config) && (typeof config.port === 'number');
962
+ return config && "port" in config && typeof config.port === "number";
712
963
  }
713
964
  }
714
965
 
@@ -718,7 +969,7 @@ export interface PortRangeConfig {
718
969
  }
719
970
  export namespace PortRangeConfig {
720
971
  export function is(config: any): config is PortRangeConfig {
721
- 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);
722
973
  }
723
974
  }
724
975
 
@@ -729,32 +980,31 @@ export interface TaskConfig {
729
980
  prebuild?: string;
730
981
  command?: string;
731
982
  env?: { [env: string]: any };
732
- openIn?: 'bottom' | 'main' | 'left' | 'right';
733
- 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";
734
985
  }
735
986
 
736
987
  export namespace TaskConfig {
737
988
  export function is(config: any): config is TaskConfig {
738
- return config
739
- && ('command' in config || 'init' in config || 'before' in config);
989
+ return config && ("command" in config || "init" in config || "before" in config);
740
990
  }
741
991
  }
742
992
 
743
993
  export namespace WorkspaceImageBuild {
744
- export type Phase = 'BaseImage' | 'GitpodLayer' | 'Error' | 'Done';
994
+ export type Phase = "BaseImage" | "GitpodLayer" | "Error" | "Done";
745
995
  export interface StateInfo {
746
- phase: Phase
747
- currentStep?: number
748
- maxSteps?: number
996
+ phase: Phase;
997
+ currentStep?: number;
998
+ maxSteps?: number;
749
999
  }
750
1000
  export interface LogContent {
751
- text: string
752
- upToLine?: number
753
- isDiff?: boolean
1001
+ text: string;
1002
+ upToLine?: number;
1003
+ isDiff?: boolean;
754
1004
  }
755
1005
  export type LogCallback = (info: StateInfo, content: LogContent | undefined) => void;
756
1006
  export namespace LogLine {
757
- export const DELIMITER = '\r\n';
1007
+ export const DELIMITER = "\r\n";
758
1008
  export const DELIMITER_REGEX = /\r?\n/;
759
1009
  }
760
1010
  }
@@ -763,20 +1013,18 @@ export type ImageConfig = ImageConfigString | ImageConfigFile;
763
1013
  export type ImageConfigString = string;
764
1014
  export namespace ImageConfigString {
765
1015
  export function is(config: ImageConfig | undefined): config is ImageConfigString {
766
- return typeof config === 'string';
1016
+ return typeof config === "string";
767
1017
  }
768
-
769
1018
  }
770
1019
  export interface ImageConfigFile {
771
1020
  // Path to the Dockerfile relative to repository root
772
- file: string,
1021
+ file: string;
773
1022
  // Path to the docker build context relative to repository root
774
- context?: string
1023
+ context?: string;
775
1024
  }
776
1025
  export namespace ImageConfigFile {
777
1026
  export function is(config: ImageConfig | undefined): config is ImageConfigFile {
778
- return typeof config === 'object'
779
- && 'file' in config;
1027
+ return typeof config === "object" && "file" in config;
780
1028
  }
781
1029
  }
782
1030
  export interface ExternalImageConfigFile extends ImageConfigFile {
@@ -784,14 +1032,13 @@ export interface ExternalImageConfigFile extends ImageConfigFile {
784
1032
  }
785
1033
  export namespace ExternalImageConfigFile {
786
1034
  export function is(config: any | undefined): config is ExternalImageConfigFile {
787
- return typeof config === 'object'
788
- && 'file' in config
789
- && 'externalSource' in config;
1035
+ return typeof config === "object" && "file" in config && "externalSource" in config;
790
1036
  }
791
1037
  }
792
1038
 
793
1039
  export interface WorkspaceContext {
794
1040
  title: string;
1041
+ ref?: string;
795
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. */
796
1043
  normalizedContextURL?: string;
797
1044
  forceCreateNewWorkspace?: boolean;
@@ -800,8 +1047,7 @@ export interface WorkspaceContext {
800
1047
 
801
1048
  export namespace WorkspaceContext {
802
1049
  export function is(context: any): context is WorkspaceContext {
803
- return context
804
- && 'title' in context;
1050
+ return context && "title" in context;
805
1051
  }
806
1052
  }
807
1053
 
@@ -810,8 +1056,7 @@ export interface WithSnapshot {
810
1056
  }
811
1057
  export namespace WithSnapshot {
812
1058
  export function is(context: any): context is WithSnapshot {
813
- return context
814
- && 'snapshotBucketId' in context;
1059
+ return context && "snapshotBucketId" in context;
815
1060
  }
816
1061
  }
817
1062
 
@@ -821,10 +1066,7 @@ export interface WithPrebuild extends WithSnapshot {
821
1066
  }
822
1067
  export namespace WithPrebuild {
823
1068
  export function is(context: any): context is WithPrebuild {
824
- return context
825
- && WithSnapshot.is(context)
826
- && 'prebuildWorkspaceId' in context
827
- && 'wasPrebuilt' in context;
1069
+ return context && WithSnapshot.is(context) && "prebuildWorkspaceId" in context && "wasPrebuilt" in context;
828
1070
  }
829
1071
  }
830
1072
 
@@ -838,16 +1080,14 @@ export interface WithDefaultConfig {
838
1080
 
839
1081
  export namespace WithDefaultConfig {
840
1082
  export function is(context: any): context is WithDefaultConfig {
841
- return context
842
- && 'withDefaultConfig' in context
843
- && context.withDefaultConfig;
1083
+ return context && "withDefaultConfig" in context && context.withDefaultConfig;
844
1084
  }
845
1085
 
846
1086
  export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
847
1087
  return {
848
1088
  ...ctx,
849
- withDefaultConfig: true
850
- }
1089
+ withDefaultConfig: true,
1090
+ };
851
1091
  }
852
1092
  }
853
1093
 
@@ -857,23 +1097,27 @@ export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
857
1097
 
858
1098
  export namespace SnapshotContext {
859
1099
  export function is(context: any): context is SnapshotContext {
860
- return context
861
- && WithSnapshot.is(context)
862
- && 'snapshotId' in context;
1100
+ return context && WithSnapshot.is(context) && "snapshotId" in context;
863
1101
  }
864
1102
  }
865
1103
 
866
- export interface StartPrebuildContext extends WorkspaceContext {
867
- actual: WorkspaceContext;
1104
+ export interface WithCommitHistory {
868
1105
  commitHistory?: string[];
869
- 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;
870
1115
  branch?: string;
871
1116
  }
872
1117
 
873
1118
  export namespace StartPrebuildContext {
874
1119
  export function is(context: any): context is StartPrebuildContext {
875
- return context
876
- && 'actual' in context;
1120
+ return context && "actual" in context;
877
1121
  }
878
1122
  }
879
1123
 
@@ -885,21 +1129,18 @@ export interface PrebuiltWorkspaceContext extends WorkspaceContext {
885
1129
 
886
1130
  export namespace PrebuiltWorkspaceContext {
887
1131
  export function is(context: any): context is PrebuiltWorkspaceContext {
888
- return context
889
- && 'originalContext' in context
890
- && 'prebuiltWorkspace' in context;
1132
+ return context && "originalContext" in context && "prebuiltWorkspace" in context;
891
1133
  }
892
1134
  }
893
1135
 
894
1136
  export interface WithReferrerContext extends WorkspaceContext {
895
- referrer: string
896
- referrerIde?: string
1137
+ referrer: string;
1138
+ referrerIde?: string;
897
1139
  }
898
1140
 
899
1141
  export namespace WithReferrerContext {
900
1142
  export function is(context: any): context is WithReferrerContext {
901
- return context
902
- && 'referrer' in context;
1143
+ return context && "referrer" in context;
903
1144
  }
904
1145
  }
905
1146
 
@@ -909,21 +1150,7 @@ export interface WithEnvvarsContext extends WorkspaceContext {
909
1150
 
910
1151
  export namespace WithEnvvarsContext {
911
1152
  export function is(context: any): context is WithEnvvarsContext {
912
- return context
913
- && 'envvars' in context
914
- }
915
- }
916
-
917
- export interface WorkspaceProbeContext extends WorkspaceContext {
918
- responseURL: string
919
- responseToken: string
920
- }
921
-
922
- export namespace WorkspaceProbeContext {
923
- export function is(context: any): context is WorkspaceProbeContext {
924
- return context
925
- && 'responseURL' in context
926
- && 'responseToken' in context;
1153
+ return context && "envvars" in context;
927
1154
  }
928
1155
  }
929
1156
 
@@ -935,32 +1162,30 @@ export namespace RefType {
935
1162
  }
936
1163
  // This fallback is meant to handle the cases where (for historic reasons) ref is present but refType is missing
937
1164
  return commit.refType || "branch";
938
- }
1165
+ };
939
1166
  }
940
1167
 
941
1168
  export interface Commit {
942
- repository: Repository
943
- revision: string
1169
+ repository: Repository;
1170
+ revision: string;
944
1171
 
945
1172
  // Might contain either a branch or a tag (determined by refType)
946
- ref?: string
1173
+ ref?: string;
947
1174
 
948
1175
  // refType is only set if ref is present (and not for old workspaces, before this feature was added)
949
- refType?: RefType
1176
+ refType?: RefType;
950
1177
  }
951
1178
 
952
1179
  export interface AdditionalContentContext extends WorkspaceContext {
953
-
954
1180
  /**
955
1181
  * utf-8 encoded contents that will be copied on top of the workspace's filesystem
956
1182
  */
957
- additionalFiles: {[filePath: string]: string};
958
-
1183
+ additionalFiles: { [filePath: string]: string };
959
1184
  }
960
1185
 
961
1186
  export namespace AdditionalContentContext {
962
1187
  export function is(ctx: any): ctx is AdditionalContentContext {
963
- return 'additionalFiles' in ctx;
1188
+ return "additionalFiles" in ctx;
964
1189
  }
965
1190
 
966
1191
  export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
@@ -968,16 +1193,59 @@ export namespace AdditionalContentContext {
968
1193
  }
969
1194
  }
970
1195
 
971
- 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 {
972
1207
  /** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
973
- 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;
974
1244
  }
975
1245
 
976
1246
  export namespace CommitContext {
977
1247
  export function is(commit: any): commit is CommitContext {
978
- return WorkspaceContext.is(commit)
979
- && 'repository' in commit
980
- && 'revision' in commit
1248
+ return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
981
1249
  }
982
1250
  }
983
1251
 
@@ -985,17 +1253,14 @@ export interface PullRequestContext extends CommitContext {
985
1253
  nr: number;
986
1254
  ref: string;
987
1255
  base: {
988
- repository: Repository
989
- ref: string
990
- }
1256
+ repository: Repository;
1257
+ ref: string;
1258
+ };
991
1259
  }
992
1260
 
993
1261
  export namespace PullRequestContext {
994
1262
  export function is(ctx: any): ctx is PullRequestContext {
995
- return CommitContext.is(ctx)
996
- && 'nr' in ctx
997
- && 'ref' in ctx
998
- && 'base' in ctx
1263
+ return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
999
1264
  }
1000
1265
  }
1001
1266
 
@@ -1007,10 +1272,7 @@ export interface IssueContext extends CommitContext {
1007
1272
 
1008
1273
  export namespace IssueContext {
1009
1274
  export function is(ctx: any): ctx is IssueContext {
1010
- return CommitContext.is(ctx)
1011
- && 'nr' in ctx
1012
- && 'ref' in ctx
1013
- && 'localBranch' in ctx
1275
+ return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
1014
1276
  }
1015
1277
  }
1016
1278
 
@@ -1021,9 +1283,7 @@ export interface NavigatorContext extends CommitContext {
1021
1283
 
1022
1284
  export namespace NavigatorContext {
1023
1285
  export function is(ctx: any): ctx is NavigatorContext {
1024
- return CommitContext.is(ctx)
1025
- && 'path' in ctx
1026
- && 'isFile' in ctx
1286
+ return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
1027
1287
  }
1028
1288
  }
1029
1289
 
@@ -1032,6 +1292,8 @@ export interface Repository {
1032
1292
  owner: string;
1033
1293
  name: string;
1034
1294
  cloneUrl: string;
1295
+ /* Optional kind to differentiate between repositories of orgs/groups/projects and personal repos. */
1296
+ repoKind?: string;
1035
1297
  description?: string;
1036
1298
  avatarUrl?: string;
1037
1299
  webUrl?: string;
@@ -1040,8 +1302,8 @@ export interface Repository {
1040
1302
  private?: boolean;
1041
1303
  fork?: {
1042
1304
  // The direct parent of this fork
1043
- parent: Repository
1044
- }
1305
+ parent: Repository;
1306
+ };
1045
1307
  }
1046
1308
  export interface Branch {
1047
1309
  name: string;
@@ -1066,21 +1328,19 @@ export namespace Repository {
1066
1328
  export interface WorkspaceInstancePortsChangedEvent {
1067
1329
  type: "PortsChanged";
1068
1330
  instanceID: string;
1069
- portsOpened: number[]
1070
- portsClosed: number[]
1331
+ portsOpened: number[];
1332
+ portsClosed: number[];
1071
1333
  }
1072
1334
 
1073
1335
  export namespace WorkspaceInstancePortsChangedEvent {
1074
-
1075
1336
  export function is(data: any): data is WorkspaceInstancePortsChangedEvent {
1076
1337
  return data && data.type == "PortsChanged";
1077
1338
  }
1078
-
1079
1339
  }
1080
1340
 
1081
1341
  export interface WorkspaceInfo {
1082
- workspace: Workspace
1083
- latestInstance?: WorkspaceInstance
1342
+ workspace: Workspace;
1343
+ latestInstance?: WorkspaceInstance;
1084
1344
  }
1085
1345
 
1086
1346
  export namespace WorkspaceInfo {
@@ -1096,35 +1356,25 @@ export interface WorkspaceCreationResult {
1096
1356
  workspaceURL?: string;
1097
1357
  existingWorkspaces?: WorkspaceInfo[];
1098
1358
  runningWorkspacePrebuild?: {
1099
- prebuildID: string
1100
- workspaceID: string
1101
- instanceID: string
1102
- starting: RunningWorkspacePrebuildStarting
1103
- sameCluster: boolean
1104
- }
1359
+ prebuildID: string;
1360
+ workspaceID: string;
1361
+ instanceID: string;
1362
+ starting: RunningWorkspacePrebuildStarting;
1363
+ sameCluster: boolean;
1364
+ };
1105
1365
  runningPrebuildWorkspaceID?: string;
1106
1366
  }
1107
- export type RunningWorkspacePrebuildStarting = 'queued' | 'starting' | 'running';
1108
-
1109
- export enum CreateWorkspaceMode {
1110
- // Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
1111
- Default = 'default',
1112
- // 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.
1113
- ForceNew = 'force-new',
1114
- // UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
1115
- UsePrebuild = 'use-prebuild',
1116
- // SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
1117
- SelectIfRunning = 'select-if-running',
1118
- }
1367
+ export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
1119
1368
 
1120
1369
  export namespace WorkspaceCreationResult {
1121
1370
  export function is(data: any): data is WorkspaceCreationResult {
1122
- return data && (
1123
- 'createdWorkspaceId' in data
1124
- || 'existingWorkspaces' in data
1125
- || 'runningWorkspacePrebuild' in data
1126
- || 'runningPrebuildWorkspaceID' in data
1127
- )
1371
+ return (
1372
+ data &&
1373
+ ("createdWorkspaceId" in data ||
1374
+ "existingWorkspaces" in data ||
1375
+ "runningWorkspacePrebuild" in data ||
1376
+ "runningPrebuildWorkspaceID" in data)
1377
+ );
1128
1378
  }
1129
1379
  }
1130
1380
 
@@ -1158,7 +1408,7 @@ export interface AuthProviderInfo {
1158
1408
  readonly default: string[];
1159
1409
  readonly publicRepo: string[];
1160
1410
  readonly privateRepo: string[];
1161
- }
1411
+ };
1162
1412
  }
1163
1413
 
1164
1414
  export interface AuthProviderEntry {
@@ -1184,23 +1434,27 @@ export interface OAuth2Config {
1184
1434
  readonly scopeSeparator?: string;
1185
1435
 
1186
1436
  readonly settingsUrl?: string;
1187
- readonly authorizationParams?: { [key: string]: string }
1437
+ readonly authorizationParams?: { [key: string]: string };
1188
1438
  readonly configURL?: string;
1189
1439
  }
1190
1440
 
1191
1441
  export namespace AuthProviderEntry {
1192
1442
  export type Type = "GitHub" | "GitLab" | string;
1193
1443
  export type Status = "pending" | "verified";
1194
- export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & { clientId?: string, clientSecret?: string };
1195
- 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">;
1196
1450
  export function redact(entry: AuthProviderEntry): AuthProviderEntry {
1197
1451
  return {
1198
1452
  ...entry,
1199
1453
  oauth: {
1200
1454
  ...entry.oauth,
1201
- clientSecret: "redacted"
1202
- }
1203
- }
1455
+ clientSecret: "redacted",
1456
+ },
1457
+ };
1204
1458
  }
1205
1459
  }
1206
1460
 
@@ -1244,3 +1498,8 @@ export interface Terms {
1244
1498
  readonly content: string;
1245
1499
  readonly formElements?: object;
1246
1500
  }
1501
+
1502
+ export interface StripeConfig {
1503
+ individualUsagePriceIds: { [currency: string]: string };
1504
+ teamUsagePriceIds: { [currency: string]: string };
1505
+ }