@gitpod/gitpod-protocol 0.1.5-wth-test.80 → 0.1.5-wv-remove-without-ws-flag.5

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 (413) 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/frontend-dashboard-service.d.ts +90 -0
  78. package/lib/frontend-dashboard-service.d.ts.map +1 -0
  79. package/lib/frontend-dashboard-service.js +49 -0
  80. package/lib/frontend-dashboard-service.js.map +1 -0
  81. package/lib/gitpod-file-parser.d.ts +1 -1
  82. package/lib/gitpod-file-parser.d.ts.map +1 -1
  83. package/lib/gitpod-file-parser.js +7 -7
  84. package/lib/gitpod-file-parser.js.map +1 -1
  85. package/lib/gitpod-file-parser.spec.d.ts +1 -1
  86. package/lib/gitpod-file-parser.spec.js +43 -40
  87. package/lib/gitpod-file-parser.spec.js.map +1 -1
  88. package/lib/gitpod-service.d.ts +73 -55
  89. package/lib/gitpod-service.d.ts.map +1 -1
  90. package/lib/gitpod-service.js +61 -34
  91. package/lib/gitpod-service.js.map +1 -1
  92. package/lib/headless-workspace-log.d.ts +2 -1
  93. package/lib/headless-workspace-log.d.ts.map +1 -1
  94. package/lib/headless-workspace-log.js +3 -2
  95. package/lib/headless-workspace-log.js.map +1 -1
  96. package/lib/ide-frontend-service.d.ts +2 -2
  97. package/lib/ide-frontend-service.js +1 -1
  98. package/lib/ide-protocol.d.ts +29 -8
  99. package/lib/ide-protocol.d.ts.map +1 -1
  100. package/lib/ide-protocol.js +11 -1
  101. package/lib/ide-protocol.js.map +1 -1
  102. package/lib/index.d.ts +17 -17
  103. package/lib/index.d.ts.map +1 -1
  104. package/lib/index.js +2 -2
  105. package/lib/index.js.map +1 -1
  106. package/lib/installation-admin-protocol.d.ts +4 -1
  107. package/lib/installation-admin-protocol.d.ts.map +1 -1
  108. package/lib/installation-admin-protocol.js +4 -3
  109. package/lib/installation-admin-protocol.js.map +1 -1
  110. package/lib/license-protocol.d.ts +8 -1
  111. package/lib/license-protocol.d.ts.map +1 -1
  112. package/lib/license-protocol.js +1 -1
  113. package/lib/license-protocol.js.map +1 -1
  114. package/lib/messaging/browser/connection.d.ts +1 -1
  115. package/lib/messaging/browser/connection.d.ts.map +1 -1
  116. package/lib/messaging/browser/connection.js +19 -19
  117. package/lib/messaging/browser/connection.js.map +1 -1
  118. package/lib/messaging/browser/window-connection.d.ts +5 -5
  119. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  120. package/lib/messaging/browser/window-connection.js +10 -7
  121. package/lib/messaging/browser/window-connection.js.map +1 -1
  122. package/lib/messaging/client-call-metrics.d.ts +5 -19
  123. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  124. package/lib/messaging/client-call-metrics.js +35 -23
  125. package/lib/messaging/client-call-metrics.js.map +1 -1
  126. package/lib/messaging/error.d.ts +10 -2
  127. package/lib/messaging/error.d.ts.map +1 -1
  128. package/lib/messaging/error.js +20 -4
  129. package/lib/messaging/error.js.map +1 -1
  130. package/lib/messaging/handler.d.ts.map +1 -1
  131. package/lib/messaging/handler.js +1 -1
  132. package/lib/messaging/node/connection.js +8 -8
  133. package/lib/messaging/node/connection.js.map +1 -1
  134. package/lib/messaging/proxy-factory.d.ts +1 -1
  135. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  136. package/lib/messaging/proxy-factory.js +7 -9
  137. package/lib/messaging/proxy-factory.js.map +1 -1
  138. package/lib/oss-allowlist.d.ts +1 -1
  139. package/lib/oss-allowlist.js +1 -1
  140. package/lib/payment-protocol.d.ts +1 -1
  141. package/lib/payment-protocol.d.ts.map +1 -1
  142. package/lib/payment-protocol.js +2 -2
  143. package/lib/payment-protocol.js.map +1 -1
  144. package/lib/permission.d.ts +7 -4
  145. package/lib/permission.d.ts.map +1 -1
  146. package/lib/permission.js +16 -24
  147. package/lib/permission.js.map +1 -1
  148. package/lib/plans.d.ts +5 -4
  149. package/lib/plans.d.ts.map +1 -1
  150. package/lib/plans.js +211 -172
  151. package/lib/plans.js.map +1 -1
  152. package/lib/protocol.d.ts +167 -61
  153. package/lib/protocol.d.ts.map +1 -1
  154. package/lib/protocol.js +282 -106
  155. package/lib/protocol.js.map +1 -1
  156. package/lib/protocol.spec.d.ts +7 -0
  157. package/lib/protocol.spec.d.ts.map +1 -0
  158. package/lib/protocol.spec.js +127 -0
  159. package/lib/protocol.spec.js.map +1 -0
  160. package/lib/snapshot-url.d.ts +1 -1
  161. package/lib/snapshot-url.js +1 -1
  162. package/lib/snapshot-url.spec.d.ts +1 -1
  163. package/lib/snapshot-url.spec.js +1 -1
  164. package/lib/snapshot-url.spec.js.map +1 -1
  165. package/lib/team-subscription-protocol.d.ts +23 -4
  166. package/lib/team-subscription-protocol.d.ts.map +1 -1
  167. package/lib/team-subscription-protocol.js +21 -6
  168. package/lib/team-subscription-protocol.js.map +1 -1
  169. package/lib/teams-projects-protocol.d.ts +29 -6
  170. package/lib/teams-projects-protocol.d.ts.map +1 -1
  171. package/lib/teams-projects-protocol.js +10 -3
  172. package/lib/teams-projects-protocol.js.map +1 -1
  173. package/lib/typings/globals.d.ts +3 -3
  174. package/lib/typings/globals.d.ts.map +1 -1
  175. package/lib/typings/globals.js +1 -1
  176. package/lib/usage.d.ts +73 -0
  177. package/lib/usage.d.ts.map +1 -0
  178. package/lib/usage.js +20 -0
  179. package/lib/usage.js.map +1 -0
  180. package/lib/util/analytics.d.ts +1 -1
  181. package/lib/util/analytics.d.ts.map +1 -1
  182. package/lib/util/analytics.js +7 -7
  183. package/lib/util/analytics.js.map +1 -1
  184. package/lib/util/async-iterator.d.ts +1 -1
  185. package/lib/util/async-iterator.d.ts.map +1 -1
  186. package/lib/util/async-iterator.js +4 -4
  187. package/lib/util/async-iterator.js.map +1 -1
  188. package/lib/util/cancelable.d.ts +1 -1
  189. package/lib/util/cancelable.js +1 -1
  190. package/lib/util/cancelable.js.map +1 -1
  191. package/lib/util/date-time.d.ts +1 -1
  192. package/lib/util/date-time.js +7 -7
  193. package/lib/util/date-time.js.map +1 -1
  194. package/lib/util/debug-app.d.ts +25 -0
  195. package/lib/util/debug-app.d.ts.map +1 -0
  196. package/lib/util/debug-app.js +100 -0
  197. package/lib/util/debug-app.js.map +1 -0
  198. package/lib/util/deep-partial.d.ts +1 -1
  199. package/lib/util/deep-partial.js +1 -1
  200. package/lib/util/deferred.d.ts +1 -1
  201. package/lib/util/deferred.js +1 -1
  202. package/lib/util/deferred.js.map +1 -1
  203. package/lib/util/disposable.d.ts.map +1 -1
  204. package/lib/util/disposable.js +2 -2
  205. package/lib/util/disposable.js.map +1 -1
  206. package/lib/util/event.d.ts.map +1 -1
  207. package/lib/util/event.js +5 -3
  208. package/lib/util/event.js.map +1 -1
  209. package/lib/util/garbage-collected-cache.d.ts +1 -1
  210. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  211. package/lib/util/garbage-collected-cache.js +7 -2
  212. package/lib/util/garbage-collected-cache.js.map +1 -1
  213. package/lib/util/generate-workspace-id.d.ts +5 -0
  214. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  215. package/lib/util/generate-workspace-id.js +446 -442
  216. package/lib/util/generate-workspace-id.js.map +1 -1
  217. package/lib/util/generate-workspace-id.spec.d.ts +1 -1
  218. package/lib/util/generate-workspace-id.spec.js +19 -8
  219. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  220. package/lib/util/gitpod-cookie.d.ts +2 -2
  221. package/lib/util/gitpod-cookie.d.ts.map +1 -1
  222. package/lib/util/gitpod-cookie.js +1 -4
  223. package/lib/util/gitpod-cookie.js.map +1 -1
  224. package/lib/util/gitpod-host-url.d.ts +12 -3
  225. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  226. package/lib/util/gitpod-host-url.js +69 -35
  227. package/lib/util/gitpod-host-url.js.map +1 -1
  228. package/lib/util/gitpod-host-url.spec.d.ts +1 -1
  229. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  230. package/lib/util/gitpod-host-url.spec.js +16 -6
  231. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  232. package/lib/util/grpc.d.ts +21 -1
  233. package/lib/util/grpc.d.ts.map +1 -1
  234. package/lib/util/grpc.js +74 -2
  235. package/lib/util/grpc.js.map +1 -1
  236. package/lib/util/jaeger-client-types.d.ts +1 -1
  237. package/lib/util/jaeger-client-types.d.ts.map +1 -1
  238. package/lib/util/jaeger-client-types.js +1 -1
  239. package/lib/util/logging.d.ts +2 -2
  240. package/lib/util/logging.d.ts.map +1 -1
  241. package/lib/util/logging.js +32 -26
  242. package/lib/util/logging.js.map +1 -1
  243. package/lib/util/logging.spec.d.ts +7 -0
  244. package/lib/util/logging.spec.d.ts.map +1 -0
  245. package/lib/util/logging.spec.js +52 -0
  246. package/lib/util/logging.spec.js.map +1 -0
  247. package/lib/util/make-link.d.ts +1 -1
  248. package/lib/util/make-link.js +6 -6
  249. package/lib/util/make-link.js.map +1 -1
  250. package/lib/util/nice-grpc.d.ts +9 -0
  251. package/lib/util/nice-grpc.d.ts.map +1 -0
  252. package/lib/util/nice-grpc.js +121 -0
  253. package/lib/util/nice-grpc.js.map +1 -0
  254. package/lib/util/parse-workspace-id.d.ts +1 -1
  255. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  256. package/lib/util/parse-workspace-id.js +2 -3
  257. package/lib/util/parse-workspace-id.js.map +1 -1
  258. package/lib/util/parse-workspace-id.spec.d.ts +1 -1
  259. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  260. package/lib/util/parse-workspace-id.spec.js +1 -1
  261. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  262. package/lib/util/queue.d.ts +1 -1
  263. package/lib/util/queue.js +1 -1
  264. package/lib/util/queue.spec.d.ts +1 -1
  265. package/lib/util/queue.spec.js +10 -7
  266. package/lib/util/queue.spec.js.map +1 -1
  267. package/lib/util/repeat.d.ts +1 -1
  268. package/lib/util/repeat.js +1 -1
  269. package/lib/util/semaphore.d.ts +1 -1
  270. package/lib/util/semaphore.d.ts.map +1 -1
  271. package/lib/util/semaphore.js +1 -1
  272. package/lib/util/semaphore.js.map +1 -1
  273. package/lib/util/skip-if.d.ts +1 -1
  274. package/lib/util/skip-if.d.ts.map +1 -1
  275. package/lib/util/skip-if.js +1 -1
  276. package/lib/util/skip-if.js.map +1 -1
  277. package/lib/util/timeutil.d.ts +3 -1
  278. package/lib/util/timeutil.d.ts.map +1 -1
  279. package/lib/util/timeutil.js +16 -4
  280. package/lib/util/timeutil.js.map +1 -1
  281. package/lib/util/timeutil.spec.d.ts +3 -1
  282. package/lib/util/timeutil.spec.d.ts.map +1 -1
  283. package/lib/util/timeutil.spec.js +35 -1
  284. package/lib/util/timeutil.spec.js.map +1 -1
  285. package/lib/util/tracing.d.ts +7 -7
  286. package/lib/util/tracing.d.ts.map +1 -1
  287. package/lib/util/tracing.js +15 -17
  288. package/lib/util/tracing.js.map +1 -1
  289. package/lib/util/tracing.spec.d.ts +1 -1
  290. package/lib/util/tracing.spec.js +4 -4
  291. package/lib/util/tracing.spec.js.map +1 -1
  292. package/lib/util/workspace-port-authentication.d.ts +8 -8
  293. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  294. package/lib/util/workspace-port-authentication.js +9 -12
  295. package/lib/util/workspace-port-authentication.js.map +1 -1
  296. package/lib/webhook-event.d.ts +44 -0
  297. package/lib/webhook-event.d.ts.map +1 -0
  298. package/lib/webhook-event.js +8 -0
  299. package/lib/webhook-event.js.map +1 -0
  300. package/lib/workspace-class.d.ts +14 -0
  301. package/lib/workspace-class.d.ts.map +1 -0
  302. package/lib/workspace-class.js +8 -0
  303. package/lib/workspace-class.js.map +1 -0
  304. package/lib/workspace-cluster.d.ts +13 -14
  305. package/lib/workspace-cluster.d.ts.map +1 -1
  306. package/lib/workspace-cluster.js +3 -5
  307. package/lib/workspace-cluster.js.map +1 -1
  308. package/lib/workspace-instance.d.ts +22 -4
  309. package/lib/workspace-instance.d.ts.map +1 -1
  310. package/lib/workspace-instance.js +1 -1
  311. package/lib/wsready.d.ts +8 -2
  312. package/lib/wsready.d.ts.map +1 -1
  313. package/lib/wsready.js +3 -3
  314. package/package.json +14 -6
  315. package/pkg-yarn.lock +10 -5
  316. package/provenance-bundle.jsonl +1 -1
  317. package/src/accounting-protocol.ts +67 -52
  318. package/src/admin-protocol.ts +48 -22
  319. package/src/analytics.ts +22 -22
  320. package/src/attribution.ts +63 -0
  321. package/src/auth.ts +3 -3
  322. package/src/billing-mode.ts +84 -0
  323. package/src/blocked-repositories-protocol.ts +13 -0
  324. package/src/context-url.spec.ts +18 -22
  325. package/src/context-url.ts +79 -79
  326. package/src/encryption/container-module.ts +3 -4
  327. package/src/encryption/encryption-engine.spec.ts +10 -9
  328. package/src/encryption/encryption-engine.ts +21 -17
  329. package/src/encryption/encryption-service.ts +5 -6
  330. package/src/encryption/key-provider.ts +17 -20
  331. package/src/env.ts +2 -25
  332. package/src/experiments/always-default.ts +24 -0
  333. package/src/experiments/configcat-server.ts +42 -0
  334. package/src/experiments/configcat.ts +56 -0
  335. package/src/experiments/types.ts +34 -0
  336. package/src/frontend-dashboard-service.ts +125 -0
  337. package/src/gitpod-file-parser.spec.ts +56 -62
  338. package/src/gitpod-file-parser.ts +17 -18
  339. package/src/gitpod-service.ts +224 -142
  340. package/src/headless-workspace-log.ts +7 -5
  341. package/src/ide-frontend-service.ts +3 -3
  342. package/src/ide-protocol.ts +38 -10
  343. package/src/index.ts +17 -17
  344. package/src/installation-admin-protocol.ts +12 -9
  345. package/src/license-protocol.ts +13 -7
  346. package/src/messaging/browser/connection.ts +45 -47
  347. package/src/messaging/browser/window-connection.ts +40 -30
  348. package/src/messaging/client-call-metrics.ts +79 -82
  349. package/src/messaging/error.ts +30 -8
  350. package/src/messaging/handler.ts +6 -6
  351. package/src/messaging/node/connection.ts +8 -8
  352. package/src/messaging/proxy-factory.ts +23 -30
  353. package/src/oss-allowlist.ts +4 -4
  354. package/src/payment-protocol.ts +3 -3
  355. package/src/permission.ts +25 -32
  356. package/src/plans.ts +241 -190
  357. package/src/protocol.spec.ts +97 -0
  358. package/src/protocol.ts +527 -265
  359. package/src/snapshot-url.spec.ts +10 -8
  360. package/src/snapshot-url.ts +1 -1
  361. package/src/team-subscription-protocol.ts +60 -23
  362. package/src/teams-projects-protocol.ts +42 -12
  363. package/src/typings/globals.ts +6 -5
  364. package/src/usage.ts +85 -0
  365. package/src/util/analytics.ts +47 -43
  366. package/src/util/async-iterator.ts +5 -6
  367. package/src/util/cancelable.ts +4 -4
  368. package/src/util/date-time.ts +9 -9
  369. package/src/util/debug-app.ts +81 -0
  370. package/src/util/deep-partial.ts +1 -1
  371. package/src/util/deferred.ts +7 -7
  372. package/src/util/disposable.ts +3 -6
  373. package/src/util/event.ts +9 -11
  374. package/src/util/garbage-collected-cache.ts +9 -7
  375. package/src/util/generate-workspace-id.spec.ts +27 -17
  376. package/src/util/generate-workspace-id.ts +461 -455
  377. package/src/util/gitpod-cookie.ts +9 -10
  378. package/src/util/gitpod-host-url.spec.ts +41 -14
  379. package/src/util/gitpod-host-url.ts +82 -39
  380. package/src/util/grpc.ts +94 -2
  381. package/src/util/jaeger-client-types.ts +3 -3
  382. package/src/util/logging.spec.ts +23 -0
  383. package/src/util/logging.ts +61 -43
  384. package/src/util/make-link.ts +7 -8
  385. package/src/util/nice-grpc.ts +96 -0
  386. package/src/util/parse-workspace-id.spec.ts +18 -9
  387. package/src/util/parse-workspace-id.ts +6 -7
  388. package/src/util/queue.spec.ts +28 -26
  389. package/src/util/queue.ts +1 -1
  390. package/src/util/repeat.ts +2 -2
  391. package/src/util/semaphore.ts +5 -7
  392. package/src/util/skip-if.ts +10 -7
  393. package/src/util/timeutil.spec.ts +41 -15
  394. package/src/util/timeutil.ts +28 -12
  395. package/src/util/tracing.spec.ts +29 -24
  396. package/src/util/tracing.ts +55 -52
  397. package/src/util/workspace-port-authentication.ts +11 -14
  398. package/src/webhook-event.ts +55 -0
  399. package/src/workspace-class.ts +14 -0
  400. package/src/workspace-cluster.ts +25 -19
  401. package/src/workspace-instance.ts +67 -25
  402. package/src/wsready.ts +11 -4
  403. package/data/builtin-theia-plugins.json +0 -372
  404. package/lib/email-protocol.d.ts +0 -49
  405. package/lib/email-protocol.d.ts.map +0 -1
  406. package/lib/email-protocol.js +0 -28
  407. package/lib/email-protocol.js.map +0 -1
  408. package/lib/theia-plugins.d.ts +0 -11
  409. package/lib/theia-plugins.d.ts.map +0 -1
  410. package/lib/theia-plugins.js +0 -8
  411. package/lib/theia-plugins.js.map +0 -1
  412. package/src/email-protocol.ts +0 -66
  413. 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,15 @@ 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>;
168
+ updateTeam(teamId: string, team: Pick<Team, "name">): Promise<Team>;
126
169
  getTeams(): Promise<Team[]>;
127
170
  getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
128
171
  createTeam(name: string): Promise<Team>;
@@ -131,12 +174,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
131
174
  removeTeamMember(teamId: string, userId: string): Promise<void>;
132
175
  getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
133
176
  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>;
177
+ deleteTeam(teamId: string): Promise<void>;
140
178
 
141
179
  // Projects
142
180
  getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
@@ -145,22 +183,20 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
145
183
  getTeamProjects(teamId: string): Promise<Project[]>;
146
184
  getUserProjects(): Promise<Project[]>;
147
185
  getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
186
+ getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
148
187
  findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
188
+ findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
189
+ getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
149
190
  triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
150
191
  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
192
  updateProjectPartial(partialProject: PartialProject): Promise<void>;
157
193
  setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
158
194
  getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
159
195
  deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
160
196
 
161
197
  // content service
162
- getContentBlobUploadUrl(name: string): Promise<string>
163
- getContentBlobDownloadUrl(name: string): Promise<string>
198
+ getContentBlobUploadUrl(name: string): Promise<string>;
199
+ getContentBlobDownloadUrl(name: string): Promise<string>;
164
200
 
165
201
  // Gitpod token
166
202
  getGitpodTokens(): Promise<GitpodToken[]>;
@@ -168,7 +204,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
168
204
  deleteGitpodToken(tokenHash: string): Promise<void>;
169
205
 
170
206
  // misc
171
- sendFeedback(feedback: string): Promise<string | undefined>;
207
+ isGitHubAppEnabled(): Promise<boolean>;
172
208
  registerGithubApp(installationId: string): Promise<void>;
173
209
 
174
210
  /**
@@ -187,25 +223,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
187
223
  */
188
224
  getSnapshots(workspaceID: string): Promise<string[]>;
189
225
 
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
226
  guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
210
227
 
211
228
  /**
@@ -223,7 +240,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
223
240
  */
224
241
  getChargebeeSiteId(): Promise<string>;
225
242
  createPortalSession(): Promise<{}>;
243
+ createTeamPortalSession(teamId: string): Promise<{}>;
226
244
  checkout(planId: string, planQuantity?: number): Promise<{}>;
245
+ teamCheckout(teamId: string, planId: string): Promise<{}>;
227
246
  getAvailableCoupons(): Promise<PlanCoupon[]>;
228
247
  getAppliedCoupons(): Promise<PlanCoupon[]>;
229
248
 
@@ -235,40 +254,69 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
235
254
  subscriptionCancel(subscriptionId: string): Promise<void>;
236
255
  subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
237
256
 
257
+ getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
238
258
  tsGet(): Promise<TeamSubscription[]>;
239
259
  tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
240
- tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>
260
+ tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
241
261
  tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
242
- tsAssignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, identityStr: string | undefined): Promise<void>
262
+ tsAssignSlot(
263
+ teamSubscriptionId: string,
264
+ teamSubscriptionSlotId: string,
265
+ identityStr: string | undefined,
266
+ ): Promise<void>;
243
267
  tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
244
268
  tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
245
269
  tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
246
270
 
247
271
  getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
248
272
 
273
+ getStripePublishableKey(): Promise<string>;
274
+ getStripeSetupIntentClientSecret(): Promise<string>;
275
+ findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
276
+ getPriceInformation(attributionId: string): Promise<string | undefined>;
277
+ createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
278
+ subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
279
+ getStripePortalUrl(attributionId: string): Promise<string>;
280
+ getCostCenter(attributionId: string): Promise<CostCenterJSON | undefined>;
281
+ setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
282
+ getUsageBalance(attributionId: string): Promise<number>;
283
+
284
+ listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
285
+
286
+ setUsageAttribution(usageAttribution: string): Promise<void>;
287
+ listAvailableUsageAttributionIds(): Promise<string[]>;
288
+
289
+ getBillingModeForUser(): Promise<BillingMode>;
290
+ getBillingModeForTeam(teamId: string): Promise<BillingMode>;
291
+
249
292
  /**
250
293
  * Analytics
251
294
  */
252
295
  trackEvent(event: RemoteTrackMessage): Promise<void>;
253
296
  trackLocation(event: RemotePageMessage): Promise<void>;
254
297
  identifyUser(event: RemoteIdentifyMessage): Promise<void>;
298
+
299
+ /**
300
+ * Frontend notifications
301
+ */
302
+ getNotifications(): Promise<string[]>;
303
+
304
+ getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
255
305
  }
256
306
 
257
307
  export interface RateLimiterError {
258
- method?: string,
308
+ method?: string;
259
309
 
260
310
  /**
261
311
  * Retry after this many seconds, earliest.
262
312
  * cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
263
313
  */
264
- retryAfter: number,
314
+ retryAfter: number;
265
315
  }
266
316
 
267
317
  export interface CreateProjectParams {
268
318
  name: string;
269
- slug?: string;
270
- account: string;
271
- provider: string;
319
+ slug: string;
272
320
  cloneUrl: string;
273
321
  teamId?: string;
274
322
  userId?: string;
@@ -292,7 +340,7 @@ export interface ProviderRepository {
292
340
  account: string;
293
341
  accountAvatarUrl: string;
294
342
  cloneUrl: string;
295
- updatedAt: string;
343
+ updatedAt?: string;
296
344
  installationId?: number;
297
345
  installationUpdatedAt?: string;
298
346
 
@@ -306,42 +354,60 @@ export interface ClientHeaderFields {
306
354
  clientRegion?: string;
307
355
  }
308
356
 
309
- export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
357
+ export type WorkspaceTimeoutDuration = string;
358
+ export namespace WorkspaceTimeoutDuration {
359
+ export function validate(duration: string): WorkspaceTimeoutDuration {
360
+ const unit = duration.slice(-1);
361
+ if (!["m", "h", "d"].includes(unit)) {
362
+ throw new Error(`Invalid timeout unit: ${unit}`);
363
+ }
364
+ const value = parseInt(duration.slice(0, -1));
365
+ if (isNaN(value) || value <= 0) {
366
+ throw new Error(`Invalid timeout value: ${duration}`);
367
+ }
368
+ return duration;
369
+ }
370
+ }
310
371
 
311
- export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(methods: Partial<JsonRpcProxy<S>>): GitpodServiceImpl<C, S> {
372
+ export const WORKSPACE_TIMEOUT_DEFAULT_SHORT: WorkspaceTimeoutDuration = "30m";
373
+ export const WORKSPACE_TIMEOUT_DEFAULT_LONG: WorkspaceTimeoutDuration = "60m";
374
+ export const WORKSPACE_TIMEOUT_EXTENDED: WorkspaceTimeoutDuration = "180m";
375
+
376
+ export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
377
+ methods: Partial<JsonRpcProxy<S>>,
378
+ ): GitpodServiceImpl<C, S> {
312
379
  return new GitpodServiceImpl<C, S>(createServerMock(methods));
313
- }
380
+ };
314
381
 
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 || (() => { });
382
+ export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
383
+ methods: Partial<JsonRpcProxy<S>>,
384
+ ): JsonRpcProxy<S> {
385
+ methods.setClient = methods.setClient || (() => {});
386
+ methods.dispose = methods.dispose || (() => {});
318
387
  return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
319
388
  // @ts-ignore
320
389
  get: (target: S, property: keyof S) => {
321
390
  const result = target[property];
322
391
  if (!result) {
323
- throw new Error(`Method ${property} not implemented`);
392
+ throw new Error(`Method ${String(property)} not implemented`);
324
393
  }
325
394
  return result;
326
- }
395
+ },
327
396
  });
328
- }
329
-
330
- type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
331
- export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
397
+ };
332
398
 
333
399
  export interface SetWorkspaceTimeoutResult {
334
- resetTimeoutOnWorkspaces: string[]
400
+ resetTimeoutOnWorkspaces: string[];
335
401
  }
336
402
 
337
403
  export interface GetWorkspaceTimeoutResult {
338
- duration: WorkspaceTimeoutDuration
339
- canChange: boolean
404
+ duration: WorkspaceTimeoutDuration;
405
+ canChange: boolean;
340
406
  }
341
407
 
342
408
  export interface StartWorkspaceResult {
343
- instanceID: string
344
- workspaceURL?: string
409
+ instanceID: string;
410
+ workspaceURL?: string;
345
411
  }
346
412
 
347
413
  export namespace GitpodServer {
@@ -355,17 +421,23 @@ export namespace GitpodServer {
355
421
  export interface GetAccountStatementOptions {
356
422
  date?: string;
357
423
  }
358
- export interface CreateWorkspaceOptions {
424
+ export interface CreateWorkspaceOptions extends StartWorkspaceOptions {
359
425
  contextUrl: string;
360
- mode?: CreateWorkspaceMode;
426
+
427
+ // whether running workspaces on the same context should be ignored. If false (default) users will be asked.
428
+ ignoreRunningWorkspaceOnSameCommit?: boolean;
429
+ ignoreRunningPrebuild?: boolean;
430
+ allowUsingPreviousPrebuilds?: boolean;
361
431
  forceDefaultConfig?: boolean;
362
432
  }
433
+
363
434
  export interface StartWorkspaceOptions {
364
- forceDefaultImage: boolean;
435
+ forceDefaultImage?: boolean;
436
+ workspaceClass?: string;
437
+ ideSettings?: IDESettings;
365
438
  }
366
439
  export interface TakeSnapshotOptions {
367
440
  workspaceId: string;
368
- layoutData?: string;
369
441
  /* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
370
442
  dontWait?: boolean;
371
443
  }
@@ -385,23 +457,23 @@ export namespace GitpodServer {
385
457
  readonly roundTripTime?: number;
386
458
  }
387
459
  export interface UpdateOwnAuthProviderParams {
388
- readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
460
+ readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
389
461
  }
390
462
  export interface DeleteOwnAuthProviderParams {
391
- readonly id: string
463
+ readonly id: string;
392
464
  }
393
465
  export type AdmissionLevel = "owner" | "everyone";
394
466
  export type PinAction = "pin" | "unpin" | "toggle";
395
467
  export interface GenerateNewGitpodTokenOptions {
396
- name?: string
397
- type: GitpodTokenType
398
- scopes?: string[]
468
+ name?: string;
469
+ type: GitpodTokenType;
470
+ scopes?: string[];
399
471
  }
400
472
  }
401
473
 
402
- export const GitpodServerPath = '/gitpod';
474
+ export const GitpodServerPath = "/gitpod";
403
475
 
404
- export const GitpodServerProxy = Symbol('GitpodServerProxy');
476
+ export const GitpodServerProxy = Symbol("GitpodServerProxy");
405
477
  export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
406
478
 
407
479
  export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
@@ -415,8 +487,8 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
415
487
  if (index > -1) {
416
488
  this.clients.splice(index, 1);
417
489
  }
418
- }
419
- }
490
+ },
491
+ };
420
492
  }
421
493
 
422
494
  onInstanceUpdate(instance: WorkspaceInstance): void {
@@ -425,7 +497,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
425
497
  try {
426
498
  client.onInstanceUpdate(instance);
427
499
  } catch (error) {
428
- console.error(error)
500
+ console.error(error);
429
501
  }
430
502
  }
431
503
  }
@@ -437,19 +509,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
437
509
  try {
438
510
  client.onPrebuildUpdate(update);
439
511
  } catch (error) {
440
- console.error(error)
512
+ console.error(error);
441
513
  }
442
514
  }
443
515
  }
444
516
  }
445
517
 
446
- onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
518
+ onWorkspaceImageBuildLogs(
519
+ info: WorkspaceImageBuild.StateInfo,
520
+ content: WorkspaceImageBuild.LogContent | undefined,
521
+ ): void {
447
522
  for (const client of this.clients) {
448
523
  if (client.onWorkspaceImageBuildLogs) {
449
524
  try {
450
525
  client.onWorkspaceImageBuildLogs(info, content);
451
526
  } catch (error) {
452
- console.error(error)
527
+ console.error(error);
453
528
  }
454
529
  }
455
530
  }
@@ -461,7 +536,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
461
536
  try {
462
537
  client.notifyDidOpenConnection();
463
538
  } catch (error) {
464
- console.error(error)
539
+ console.error(error);
465
540
  }
466
541
  }
467
542
  }
@@ -473,7 +548,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
473
548
  try {
474
549
  client.notifyDidCloseConnection();
475
550
  } catch (error) {
476
- console.error(error)
551
+ console.error(error);
477
552
  }
478
553
  }
479
554
  }
@@ -485,64 +560,73 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
485
560
  try {
486
561
  client.onCreditAlert(creditAlert);
487
562
  } catch (error) {
488
- console.error(error)
563
+ console.error(error);
489
564
  }
490
565
  }
491
566
  }
492
567
  }
493
568
 
569
+ onNotificationUpdated(): void {
570
+ for (const client of this.clients) {
571
+ if (client.onNotificationUpdated) {
572
+ try {
573
+ client.onNotificationUpdated();
574
+ } catch (error) {
575
+ console.error(error);
576
+ }
577
+ }
578
+ }
579
+ }
494
580
  }
495
581
 
496
582
  export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
497
583
 
498
- const hasWindow = (typeof window !== 'undefined');
584
+ const hasWindow = typeof window !== "undefined";
499
585
  const phasesOrder: Record<WorkspaceInstancePhase, number> = {
500
586
  unknown: 0,
501
587
  preparing: 1,
502
- pending: 2,
503
- creating: 3,
504
- initializing: 4,
505
- running: 5,
506
- interrupted: 6,
507
- stopping: 7,
508
- stopped: 8
588
+ building: 2,
589
+ pending: 3,
590
+ creating: 4,
591
+ initializing: 5,
592
+ running: 6,
593
+ interrupted: 7,
594
+ stopping: 8,
595
+ stopped: 9,
509
596
  };
510
597
  export class WorkspaceInstanceUpdateListener {
511
598
  private readonly onDidChangeEmitter = new Emitter<void>();
512
599
  readonly onDidChange = this.onDidChangeEmitter.event;
513
600
 
514
- private source: 'sync' | 'update' = 'sync';
601
+ private source: "sync" | "update" = "sync";
515
602
 
516
603
  get info(): WorkspaceInfo {
517
604
  return this._info;
518
605
  }
519
606
 
520
- constructor(
521
- private readonly service: GitpodService,
522
- private _info: WorkspaceInfo
523
- ) {
607
+ constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
524
608
  service.registerClient({
525
- onInstanceUpdate: instance => {
609
+ onInstanceUpdate: (instance) => {
526
610
  if (this.isOutOfOrder(instance)) {
527
611
  return;
528
612
  }
529
613
  this.cancelSync();
530
614
  this._info.latestInstance = instance;
531
- this.source = 'update';
615
+ this.source = "update";
532
616
  this.onDidChangeEmitter.fire(undefined);
533
617
  },
534
618
  notifyDidOpenConnection: () => {
535
619
  this.sync();
536
- }
620
+ },
537
621
  });
538
622
  if (hasWindow) {
539
623
  // 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') {
624
+ window.document.addEventListener("visibilitychange", async () => {
625
+ if (window.document.visibilityState === "visible") {
542
626
  this.sync();
543
627
  }
544
628
  });
545
- window.addEventListener('pageshow', e => {
629
+ window.addEventListener("pageshow", (e) => {
546
630
  if (e.persisted) {
547
631
  this.sync();
548
632
  }
@@ -570,12 +654,12 @@ export class WorkspaceInstanceUpdateListener {
570
654
  return;
571
655
  }
572
656
  this._info = info;
573
- this.source = 'sync';
657
+ this.source = "sync";
574
658
  this.onDidChangeEmitter.fire(undefined);
575
659
  } catch (e) {
576
- console.error('failed to sync workspace instance:', e)
660
+ console.error("failed to sync workspace instance:", e);
577
661
  }
578
- })
662
+ });
579
663
  }
580
664
  private cancelSync(): void {
581
665
  if (this.syncTokenSource) {
@@ -592,7 +676,7 @@ export class WorkspaceInstanceUpdateListener {
592
676
  if (instance.workspaceId !== this._info.workspace.id) {
593
677
  return true;
594
678
  }
595
- if (this.source === 'update') {
679
+ if (this.source === "update") {
596
680
  return false;
597
681
  }
598
682
  if (instance.id !== this.info.latestInstance?.id) {
@@ -600,15 +684,13 @@ export class WorkspaceInstanceUpdateListener {
600
684
  }
601
685
  return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
602
686
  }
603
-
604
687
  }
605
688
 
606
689
  export interface GitpodServiceOptions {
607
- onReconnect?: () => (void | Promise<void>)
690
+ onReconnect?: () => void | Promise<void>;
608
691
  }
609
692
 
610
693
  export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
611
-
612
694
  private readonly compositeClient = new GitpodCompositeClient<Client>();
613
695
 
614
696
  constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
@@ -623,7 +705,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
623
705
 
624
706
  private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
625
707
  listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
626
- const listener = this.instanceListeners.get(workspaceId) ||
708
+ const listener =
709
+ this.instanceListeners.get(workspaceId) ||
627
710
  (async () => {
628
711
  const info = await this.server.getWorkspace(workspaceId);
629
712
  return new WorkspaceInstanceUpdateListener(this, info);
@@ -639,26 +722,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
639
722
  }
640
723
  }
641
724
 
642
- export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(serverUrl: string | Promise<string>) {
725
+ export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
726
+ serverUrl: string | Promise<string>,
727
+ ) {
643
728
  const toWsUrl = (serverUrl: string) => {
644
- return new GitpodHostUrl(serverUrl)
645
- .asWebsocket()
646
- .withApi({ pathname: GitpodServerPath })
647
- .toString();
729
+ return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
648
730
  };
649
731
  let url: string | Promise<string>;
650
732
  if (typeof serverUrl === "string") {
651
733
  url = toWsUrl(serverUrl);
652
734
  } else {
653
- url = serverUrl.then(url => toWsUrl(url));
735
+ url = serverUrl.then((url) => toWsUrl(url));
654
736
  }
655
737
 
656
738
  const connectionProvider = new WebSocketConnectionProvider();
657
- let onReconnect = () => { };
739
+ let onReconnect = () => {};
658
740
  const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
659
- onListening: socket => {
741
+ onListening: (socket) => {
660
742
  onReconnect = () => socket.reconnect();
661
- }
743
+ },
662
744
  });
663
745
  return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
664
- }
746
+ }