@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
@@ -1,36 +1,67 @@
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 {
8
- User, WorkspaceInfo, WorkspaceCreationResult, WorkspaceInstanceUser,
9
- WhitelistedRepository, WorkspaceImageBuild, AuthProviderInfo, CreateWorkspaceMode,
10
- Token, UserEnvVarValue, ResolvePluginsParams, PreparePluginUploadParams, Terms,
11
- ResolvedPlugins, Configuration, InstallPluginsParams, UninstallPluginParams, UserInfo, GitpodTokenType,
12
- GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes, ProjectEnvVar
13
- } from './protocol';
8
+ User,
9
+ WorkspaceInfo,
10
+ WorkspaceCreationResult,
11
+ WorkspaceInstanceUser,
12
+ WhitelistedRepository,
13
+ WorkspaceImageBuild,
14
+ AuthProviderInfo,
15
+ Token,
16
+ UserEnvVarValue,
17
+ Terms,
18
+ Configuration,
19
+ UserInfo,
20
+ GitpodTokenType,
21
+ GitpodToken,
22
+ AuthProviderEntry,
23
+ GuessGitTokenScopesParams,
24
+ GuessedGitTokenScopes,
25
+ ProjectEnvVar,
26
+ PrebuiltWorkspace,
27
+ UserSSHPublicKeyValue,
28
+ SSHPublicKeyValue,
29
+ IDESettings,
30
+ } from "./protocol";
14
31
  import {
15
- Team, TeamMemberInfo,
16
- TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult, PartialProject
17
- } from './teams-projects-protocol';
18
- import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
19
- import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
20
- import { HeadlessLogUrls } from './headless-workspace-log';
21
- import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from './workspace-instance';
22
- import { AdminServer } from './admin-protocol';
23
- import { GitpodHostUrl } from './util/gitpod-host-url';
24
- import { WebSocketConnectionProvider } from './messaging/browser/connection';
25
- import { PermissionName } from './permission';
26
- import { LicenseService } from './license-protocol';
27
- import { Emitter } from './util/event';
28
- import { AccountStatement, CreditAlert } from './accounting-protocol';
29
- import { GithubUpgradeURL, PlanCoupon } from './payment-protocol';
30
- import { TeamSubscription, TeamSubscriptionSlot, TeamSubscriptionSlotResolved } from './team-subscription-protocol';
31
- import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from './analytics';
32
- import { IDEServer } from './ide-protocol';
33
- import { InstallationAdminSettings, TelemetryData } from './installation-admin-protocol';
32
+ Team,
33
+ TeamMemberInfo,
34
+ TeamMembershipInvite,
35
+ Project,
36
+ TeamMemberRole,
37
+ PrebuildWithStatus,
38
+ StartPrebuildResult,
39
+ PartialProject,
40
+ PrebuildEvent,
41
+ } from "./teams-projects-protocol";
42
+ import { JsonRpcProxy, JsonRpcServer } from "./messaging/proxy-factory";
43
+ import { Disposable, CancellationTokenSource } from "vscode-jsonrpc";
44
+ import { HeadlessLogUrls } from "./headless-workspace-log";
45
+ import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from "./workspace-instance";
46
+ import { AdminServer } from "./admin-protocol";
47
+ import { GitpodHostUrl } from "./util/gitpod-host-url";
48
+ import { WebSocketConnectionProvider } from "./messaging/browser/connection";
49
+ import { PermissionName } from "./permission";
50
+ import { LicenseService } from "./license-protocol";
51
+ import { Emitter } from "./util/event";
52
+ import { AccountStatement, CreditAlert } from "./accounting-protocol";
53
+ import { GithubUpgradeURL, PlanCoupon } from "./payment-protocol";
54
+ import {
55
+ TeamSubscription,
56
+ TeamSubscription2,
57
+ TeamSubscriptionSlot,
58
+ TeamSubscriptionSlotResolved,
59
+ } from "./team-subscription-protocol";
60
+ import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
61
+ import { IDEServer } from "./ide-protocol";
62
+ import { ListUsageRequest, ListUsageResponse, CostCenterJSON } from "./usage";
63
+ import { SupportedWorkspaceClass } from "./workspace-class";
64
+ import { BillingMode } from "./billing-mode";
34
65
 
35
66
  export interface GitpodClient {
36
67
  onInstanceUpdate(instance: WorkspaceInstance): void;
@@ -38,6 +69,8 @@ export interface GitpodClient {
38
69
 
39
70
  onPrebuildUpdate(update: PrebuildWithStatus): void;
40
71
 
72
+ onNotificationUpdated(): void;
73
+
41
74
  onCreditAlert(creditAlert: CreditAlert): void;
42
75
 
43
76
  //#region propagating reconnection to iframe
@@ -46,12 +79,14 @@ export interface GitpodClient {
46
79
  //#endregion
47
80
  }
48
81
 
49
- export const GitpodServer = Symbol('GitpodServer');
82
+ export const GitpodServer = Symbol("GitpodServer");
50
83
  export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
51
84
  // User related API
52
85
  getLoggedInUser(): Promise<User>;
53
86
  getTerms(): Promise<Terms>;
54
87
  updateLoggedInUser(user: Partial<User>): Promise<User>;
88
+ sendPhoneNumberVerificationToken(phoneNumber: string): Promise<void>;
89
+ verifyPhoneNumberVerificationToken(phoneNumber: string, token: string): Promise<boolean>;
55
90
  getAuthProviders(): Promise<AuthProviderInfo[]>;
56
91
  getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
57
92
  updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
@@ -122,7 +157,14 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
122
157
  setEnvVar(variable: UserEnvVarValue): Promise<void>;
123
158
  deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
124
159
 
160
+ // User SSH Keys
161
+ hasSSHPublicKey(): Promise<boolean>;
162
+ getSSHPublicKeys(): Promise<UserSSHPublicKeyValue[]>;
163
+ addSSHPublicKey(value: SSHPublicKeyValue): Promise<UserSSHPublicKeyValue>;
164
+ deleteSSHPublicKey(id: string): Promise<void>;
165
+
125
166
  // Teams
167
+ getTeam(teamId: string): Promise<Team>;
126
168
  getTeams(): Promise<Team[]>;
127
169
  getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
128
170
  createTeam(name: string): Promise<Team>;
@@ -131,12 +173,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
131
173
  removeTeamMember(teamId: string, userId: string): Promise<void>;
132
174
  getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
133
175
  resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
134
- deleteTeam(teamId: string, userId: string): Promise<void>;
135
-
136
- // Admin Settings
137
- adminGetSettings(): Promise<InstallationAdminSettings>;
138
- adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
139
- adminGetTelemetryData(): Promise<TelemetryData>;
176
+ deleteTeam(teamId: string): Promise<void>;
140
177
 
141
178
  // Projects
142
179
  getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
@@ -145,22 +182,20 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
145
182
  getTeamProjects(teamId: string): Promise<Project[]>;
146
183
  getUserProjects(): Promise<Project[]>;
147
184
  getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
185
+ getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
148
186
  findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
187
+ findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
188
+ getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
149
189
  triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
150
190
  cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
151
- fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
152
- guessProjectConfiguration(projectId: string): Promise<string | undefined>;
153
- fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
154
- guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
155
- setProjectConfiguration(projectId: string, configString: string): Promise<void>;
156
191
  updateProjectPartial(partialProject: PartialProject): Promise<void>;
157
192
  setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
158
193
  getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
159
194
  deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
160
195
 
161
196
  // content service
162
- getContentBlobUploadUrl(name: string): Promise<string>
163
- getContentBlobDownloadUrl(name: string): Promise<string>
197
+ getContentBlobUploadUrl(name: string): Promise<string>;
198
+ getContentBlobDownloadUrl(name: string): Promise<string>;
164
199
 
165
200
  // Gitpod token
166
201
  getGitpodTokens(): Promise<GitpodToken[]>;
@@ -168,7 +203,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
168
203
  deleteGitpodToken(tokenHash: string): Promise<void>;
169
204
 
170
205
  // misc
171
- sendFeedback(feedback: string): Promise<string | undefined>;
206
+ isGitHubAppEnabled(): Promise<boolean>;
172
207
  registerGithubApp(installationId: string): Promise<void>;
173
208
 
174
209
  /**
@@ -187,25 +222,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
187
222
  */
188
223
  getSnapshots(workspaceID: string): Promise<string[]>;
189
224
 
190
- /**
191
- * stores/updates layout information for the given workspace
192
- */
193
- storeLayout(workspaceId: string, layoutData: string): Promise<void>;
194
-
195
- /**
196
- * retrieves layout information for the given workspace
197
- */
198
- getLayout(workspaceId: string): Promise<string | undefined>;
199
-
200
- /**
201
- * @param params
202
- * @returns promise resolves to an URL to be used for the upload
203
- */
204
- preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
205
- resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
206
- installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
207
- uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
208
-
209
225
  guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
210
226
 
211
227
  /**
@@ -223,7 +239,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
223
239
  */
224
240
  getChargebeeSiteId(): Promise<string>;
225
241
  createPortalSession(): Promise<{}>;
242
+ createTeamPortalSession(teamId: string): Promise<{}>;
226
243
  checkout(planId: string, planQuantity?: number): Promise<{}>;
244
+ teamCheckout(teamId: string, planId: string): Promise<{}>;
227
245
  getAvailableCoupons(): Promise<PlanCoupon[]>;
228
246
  getAppliedCoupons(): Promise<PlanCoupon[]>;
229
247
 
@@ -235,40 +253,68 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
235
253
  subscriptionCancel(subscriptionId: string): Promise<void>;
236
254
  subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
237
255
 
256
+ getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
238
257
  tsGet(): Promise<TeamSubscription[]>;
239
258
  tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
240
- tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>
259
+ tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
241
260
  tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
242
- tsAssignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, identityStr: string | undefined): Promise<void>
261
+ tsAssignSlot(
262
+ teamSubscriptionId: string,
263
+ teamSubscriptionSlotId: string,
264
+ identityStr: string | undefined,
265
+ ): Promise<void>;
243
266
  tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
244
267
  tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
245
268
  tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
246
269
 
247
270
  getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
248
271
 
272
+ getStripePublishableKey(): Promise<string>;
273
+ getStripeSetupIntentClientSecret(): Promise<string>;
274
+ findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
275
+ createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
276
+ subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
277
+ getStripePortalUrl(attributionId: string): Promise<string>;
278
+ getCostCenter(attributionId: string): Promise<CostCenterJSON | undefined>;
279
+ setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
280
+ getUsageBalance(attributionId: string): Promise<number>;
281
+
282
+ listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
283
+
284
+ setUsageAttribution(usageAttribution: string): Promise<void>;
285
+ listAvailableUsageAttributionIds(): Promise<string[]>;
286
+
287
+ getBillingModeForUser(): Promise<BillingMode>;
288
+ getBillingModeForTeam(teamId: string): Promise<BillingMode>;
289
+
249
290
  /**
250
291
  * Analytics
251
292
  */
252
293
  trackEvent(event: RemoteTrackMessage): Promise<void>;
253
294
  trackLocation(event: RemotePageMessage): Promise<void>;
254
295
  identifyUser(event: RemoteIdentifyMessage): Promise<void>;
296
+
297
+ /**
298
+ * Frontend notifications
299
+ */
300
+ getNotifications(): Promise<string[]>;
301
+
302
+ getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
255
303
  }
256
304
 
257
305
  export interface RateLimiterError {
258
- method?: string,
306
+ method?: string;
259
307
 
260
308
  /**
261
309
  * Retry after this many seconds, earliest.
262
310
  * cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
263
311
  */
264
- retryAfter: number,
312
+ retryAfter: number;
265
313
  }
266
314
 
267
315
  export interface CreateProjectParams {
268
316
  name: string;
269
- slug?: string;
270
- account: string;
271
- provider: string;
317
+ slug: string;
272
318
  cloneUrl: string;
273
319
  teamId?: string;
274
320
  userId?: string;
@@ -292,7 +338,7 @@ export interface ProviderRepository {
292
338
  account: string;
293
339
  accountAvatarUrl: string;
294
340
  cloneUrl: string;
295
- updatedAt: string;
341
+ updatedAt?: string;
296
342
  installationId?: number;
297
343
  installationUpdatedAt?: string;
298
344
 
@@ -306,42 +352,56 @@ export interface ClientHeaderFields {
306
352
  clientRegion?: string;
307
353
  }
308
354
 
309
- export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
310
-
311
- export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(methods: Partial<JsonRpcProxy<S>>): GitpodServiceImpl<C, S> {
355
+ export const WORKSPACE_TIMEOUT_DEFAULT_SHORT = "short";
356
+ export const WORKSPACE_TIMEOUT_DEFAULT_LONG = "long";
357
+ export const WORKSPACE_TIMEOUT_EXTENDED = "extended";
358
+ export const WORKSPACE_TIMEOUT_EXTENDED_ALT = "180m"; // for backwards compatibility since the IDE uses this
359
+ export const WorkspaceTimeoutValues = [
360
+ WORKSPACE_TIMEOUT_DEFAULT_SHORT,
361
+ WORKSPACE_TIMEOUT_DEFAULT_LONG,
362
+ WORKSPACE_TIMEOUT_EXTENDED,
363
+ WORKSPACE_TIMEOUT_EXTENDED_ALT,
364
+ ] as const;
365
+
366
+ export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
367
+ methods: Partial<JsonRpcProxy<S>>,
368
+ ): GitpodServiceImpl<C, S> {
312
369
  return new GitpodServiceImpl<C, S>(createServerMock(methods));
313
- }
370
+ };
314
371
 
315
- export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(methods: Partial<JsonRpcProxy<S>>): JsonRpcProxy<S> {
316
- methods.setClient = methods.setClient || (() => { });
317
- methods.dispose = methods.dispose || (() => { });
372
+ export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
373
+ methods: Partial<JsonRpcProxy<S>>,
374
+ ): JsonRpcProxy<S> {
375
+ methods.setClient = methods.setClient || (() => {});
376
+ methods.dispose = methods.dispose || (() => {});
318
377
  return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
319
378
  // @ts-ignore
320
379
  get: (target: S, property: keyof S) => {
321
380
  const result = target[property];
322
381
  if (!result) {
323
- throw new Error(`Method ${property} not implemented`);
382
+ throw new Error(`Method ${String(property)} not implemented`);
324
383
  }
325
384
  return result;
326
- }
385
+ },
327
386
  });
328
- }
387
+ };
329
388
 
330
389
  type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
331
390
  export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
332
391
 
333
392
  export interface SetWorkspaceTimeoutResult {
334
- resetTimeoutOnWorkspaces: string[]
393
+ resetTimeoutOnWorkspaces: string[];
335
394
  }
336
395
 
337
396
  export interface GetWorkspaceTimeoutResult {
338
- duration: WorkspaceTimeoutDuration
339
- canChange: boolean
397
+ duration: WorkspaceTimeoutDuration;
398
+ durationRaw: string;
399
+ canChange: boolean;
340
400
  }
341
401
 
342
402
  export interface StartWorkspaceResult {
343
- instanceID: string
344
- workspaceURL?: string
403
+ instanceID: string;
404
+ workspaceURL?: string;
345
405
  }
346
406
 
347
407
  export namespace GitpodServer {
@@ -355,17 +415,23 @@ export namespace GitpodServer {
355
415
  export interface GetAccountStatementOptions {
356
416
  date?: string;
357
417
  }
358
- export interface CreateWorkspaceOptions {
418
+ export interface CreateWorkspaceOptions extends StartWorkspaceOptions {
359
419
  contextUrl: string;
360
- mode?: CreateWorkspaceMode;
420
+
421
+ // whether running workspaces on the same context should be ignored. If false (default) users will be asked.
422
+ ignoreRunningWorkspaceOnSameCommit?: boolean;
423
+ ignoreRunningPrebuild?: boolean;
424
+ allowUsingPreviousPrebuilds?: boolean;
361
425
  forceDefaultConfig?: boolean;
362
426
  }
427
+
363
428
  export interface StartWorkspaceOptions {
364
- forceDefaultImage: boolean;
429
+ forceDefaultImage?: boolean;
430
+ workspaceClass?: string;
431
+ ideSettings?: IDESettings;
365
432
  }
366
433
  export interface TakeSnapshotOptions {
367
434
  workspaceId: string;
368
- layoutData?: string;
369
435
  /* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
370
436
  dontWait?: boolean;
371
437
  }
@@ -385,23 +451,23 @@ export namespace GitpodServer {
385
451
  readonly roundTripTime?: number;
386
452
  }
387
453
  export interface UpdateOwnAuthProviderParams {
388
- readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
454
+ readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
389
455
  }
390
456
  export interface DeleteOwnAuthProviderParams {
391
- readonly id: string
457
+ readonly id: string;
392
458
  }
393
459
  export type AdmissionLevel = "owner" | "everyone";
394
460
  export type PinAction = "pin" | "unpin" | "toggle";
395
461
  export interface GenerateNewGitpodTokenOptions {
396
- name?: string
397
- type: GitpodTokenType
398
- scopes?: string[]
462
+ name?: string;
463
+ type: GitpodTokenType;
464
+ scopes?: string[];
399
465
  }
400
466
  }
401
467
 
402
- export const GitpodServerPath = '/gitpod';
468
+ export const GitpodServerPath = "/gitpod";
403
469
 
404
- export const GitpodServerProxy = Symbol('GitpodServerProxy');
470
+ export const GitpodServerProxy = Symbol("GitpodServerProxy");
405
471
  export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
406
472
 
407
473
  export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
@@ -415,8 +481,8 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
415
481
  if (index > -1) {
416
482
  this.clients.splice(index, 1);
417
483
  }
418
- }
419
- }
484
+ },
485
+ };
420
486
  }
421
487
 
422
488
  onInstanceUpdate(instance: WorkspaceInstance): void {
@@ -425,7 +491,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
425
491
  try {
426
492
  client.onInstanceUpdate(instance);
427
493
  } catch (error) {
428
- console.error(error)
494
+ console.error(error);
429
495
  }
430
496
  }
431
497
  }
@@ -437,19 +503,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
437
503
  try {
438
504
  client.onPrebuildUpdate(update);
439
505
  } catch (error) {
440
- console.error(error)
506
+ console.error(error);
441
507
  }
442
508
  }
443
509
  }
444
510
  }
445
511
 
446
- onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
512
+ onWorkspaceImageBuildLogs(
513
+ info: WorkspaceImageBuild.StateInfo,
514
+ content: WorkspaceImageBuild.LogContent | undefined,
515
+ ): void {
447
516
  for (const client of this.clients) {
448
517
  if (client.onWorkspaceImageBuildLogs) {
449
518
  try {
450
519
  client.onWorkspaceImageBuildLogs(info, content);
451
520
  } catch (error) {
452
- console.error(error)
521
+ console.error(error);
453
522
  }
454
523
  }
455
524
  }
@@ -461,7 +530,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
461
530
  try {
462
531
  client.notifyDidOpenConnection();
463
532
  } catch (error) {
464
- console.error(error)
533
+ console.error(error);
465
534
  }
466
535
  }
467
536
  }
@@ -473,7 +542,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
473
542
  try {
474
543
  client.notifyDidCloseConnection();
475
544
  } catch (error) {
476
- console.error(error)
545
+ console.error(error);
477
546
  }
478
547
  }
479
548
  }
@@ -485,64 +554,73 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
485
554
  try {
486
555
  client.onCreditAlert(creditAlert);
487
556
  } catch (error) {
488
- console.error(error)
557
+ console.error(error);
489
558
  }
490
559
  }
491
560
  }
492
561
  }
493
562
 
563
+ onNotificationUpdated(): void {
564
+ for (const client of this.clients) {
565
+ if (client.onNotificationUpdated) {
566
+ try {
567
+ client.onNotificationUpdated();
568
+ } catch (error) {
569
+ console.error(error);
570
+ }
571
+ }
572
+ }
573
+ }
494
574
  }
495
575
 
496
576
  export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
497
577
 
498
- const hasWindow = (typeof window !== 'undefined');
578
+ const hasWindow = typeof window !== "undefined";
499
579
  const phasesOrder: Record<WorkspaceInstancePhase, number> = {
500
580
  unknown: 0,
501
581
  preparing: 1,
502
- pending: 2,
503
- creating: 3,
504
- initializing: 4,
505
- running: 5,
506
- interrupted: 6,
507
- stopping: 7,
508
- stopped: 8
582
+ building: 2,
583
+ pending: 3,
584
+ creating: 4,
585
+ initializing: 5,
586
+ running: 6,
587
+ interrupted: 7,
588
+ stopping: 8,
589
+ stopped: 9,
509
590
  };
510
591
  export class WorkspaceInstanceUpdateListener {
511
592
  private readonly onDidChangeEmitter = new Emitter<void>();
512
593
  readonly onDidChange = this.onDidChangeEmitter.event;
513
594
 
514
- private source: 'sync' | 'update' = 'sync';
595
+ private source: "sync" | "update" = "sync";
515
596
 
516
597
  get info(): WorkspaceInfo {
517
598
  return this._info;
518
599
  }
519
600
 
520
- constructor(
521
- private readonly service: GitpodService,
522
- private _info: WorkspaceInfo
523
- ) {
601
+ constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
524
602
  service.registerClient({
525
- onInstanceUpdate: instance => {
603
+ onInstanceUpdate: (instance) => {
526
604
  if (this.isOutOfOrder(instance)) {
527
605
  return;
528
606
  }
529
607
  this.cancelSync();
530
608
  this._info.latestInstance = instance;
531
- this.source = 'update';
609
+ this.source = "update";
532
610
  this.onDidChangeEmitter.fire(undefined);
533
611
  },
534
612
  notifyDidOpenConnection: () => {
535
613
  this.sync();
536
- }
614
+ },
537
615
  });
538
616
  if (hasWindow) {
539
617
  // learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
540
- window.document.addEventListener('visibilitychange', async () => {
541
- if (window.document.visibilityState === 'visible') {
618
+ window.document.addEventListener("visibilitychange", async () => {
619
+ if (window.document.visibilityState === "visible") {
542
620
  this.sync();
543
621
  }
544
622
  });
545
- window.addEventListener('pageshow', e => {
623
+ window.addEventListener("pageshow", (e) => {
546
624
  if (e.persisted) {
547
625
  this.sync();
548
626
  }
@@ -570,12 +648,12 @@ export class WorkspaceInstanceUpdateListener {
570
648
  return;
571
649
  }
572
650
  this._info = info;
573
- this.source = 'sync';
651
+ this.source = "sync";
574
652
  this.onDidChangeEmitter.fire(undefined);
575
653
  } catch (e) {
576
- console.error('failed to sync workspace instance:', e)
654
+ console.error("failed to sync workspace instance:", e);
577
655
  }
578
- })
656
+ });
579
657
  }
580
658
  private cancelSync(): void {
581
659
  if (this.syncTokenSource) {
@@ -592,7 +670,7 @@ export class WorkspaceInstanceUpdateListener {
592
670
  if (instance.workspaceId !== this._info.workspace.id) {
593
671
  return true;
594
672
  }
595
- if (this.source === 'update') {
673
+ if (this.source === "update") {
596
674
  return false;
597
675
  }
598
676
  if (instance.id !== this.info.latestInstance?.id) {
@@ -600,15 +678,13 @@ export class WorkspaceInstanceUpdateListener {
600
678
  }
601
679
  return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
602
680
  }
603
-
604
681
  }
605
682
 
606
683
  export interface GitpodServiceOptions {
607
- onReconnect?: () => (void | Promise<void>)
684
+ onReconnect?: () => void | Promise<void>;
608
685
  }
609
686
 
610
687
  export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
611
-
612
688
  private readonly compositeClient = new GitpodCompositeClient<Client>();
613
689
 
614
690
  constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
@@ -623,7 +699,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
623
699
 
624
700
  private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
625
701
  listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
626
- const listener = this.instanceListeners.get(workspaceId) ||
702
+ const listener =
703
+ this.instanceListeners.get(workspaceId) ||
627
704
  (async () => {
628
705
  const info = await this.server.getWorkspace(workspaceId);
629
706
  return new WorkspaceInstanceUpdateListener(this, info);
@@ -639,26 +716,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
639
716
  }
640
717
  }
641
718
 
642
- export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(serverUrl: string | Promise<string>) {
719
+ export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
720
+ serverUrl: string | Promise<string>,
721
+ ) {
643
722
  const toWsUrl = (serverUrl: string) => {
644
- return new GitpodHostUrl(serverUrl)
645
- .asWebsocket()
646
- .withApi({ pathname: GitpodServerPath })
647
- .toString();
723
+ return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
648
724
  };
649
725
  let url: string | Promise<string>;
650
726
  if (typeof serverUrl === "string") {
651
727
  url = toWsUrl(serverUrl);
652
728
  } else {
653
- url = serverUrl.then(url => toWsUrl(url));
729
+ url = serverUrl.then((url) => toWsUrl(url));
654
730
  }
655
731
 
656
732
  const connectionProvider = new WebSocketConnectionProvider();
657
- let onReconnect = () => { };
733
+ let onReconnect = () => {};
658
734
  const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
659
- onListening: socket => {
735
+ onListening: (socket) => {
660
736
  onReconnect = () => socket.reconnect();
661
- }
737
+ },
662
738
  });
663
739
  return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
664
- }
740
+ }