@gitpod/gitpod-protocol 0.1.5-procmount.0 → 0.1.5-protected-secrets.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 (422) hide show
  1. package/data/gitpod-schema.json +149 -29
  2. package/lib/accounting-protocol.d.ts +163 -0
  3. package/lib/accounting-protocol.d.ts.map +1 -0
  4. package/lib/accounting-protocol.js +111 -0
  5. package/lib/accounting-protocol.js.map +1 -0
  6. package/lib/admin-protocol.d.ts +39 -4
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +15 -0
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +44 -0
  11. package/lib/analytics.d.ts.map +1 -0
  12. package/lib/analytics.js +10 -0
  13. package/lib/analytics.js.map +1 -0
  14. package/lib/attribution.d.ts +23 -0
  15. package/lib/attribution.d.ts.map +1 -0
  16. package/lib/attribution.js +50 -0
  17. package/lib/attribution.js.map +1 -0
  18. package/lib/auth.d.ts.map +1 -1
  19. package/lib/billing-mode.d.ts +43 -0
  20. package/lib/billing-mode.d.ts.map +1 -0
  21. package/lib/billing-mode.js +44 -0
  22. package/lib/billing-mode.js.map +1 -0
  23. package/lib/blocked-repositories-protocol.d.ts +13 -0
  24. package/lib/blocked-repositories-protocol.d.ts.map +1 -0
  25. package/lib/blocked-repositories-protocol.js +8 -0
  26. package/lib/blocked-repositories-protocol.js.map +1 -0
  27. package/lib/context-url.d.ts +31 -0
  28. package/lib/context-url.d.ts.map +1 -0
  29. package/lib/context-url.js +102 -0
  30. package/lib/context-url.js.map +1 -0
  31. package/lib/context-url.spec.d.ts +14 -0
  32. package/lib/context-url.spec.d.ts.map +1 -0
  33. package/lib/context-url.spec.js +109 -0
  34. package/lib/context-url.spec.js.map +1 -0
  35. package/lib/encryption/container-module.d.ts.map +1 -1
  36. package/lib/encryption/container-module.js +5 -4
  37. package/lib/encryption/container-module.js.map +1 -1
  38. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  39. package/lib/encryption/encryption-engine.js +25 -26
  40. package/lib/encryption/encryption-engine.js.map +1 -1
  41. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  42. package/lib/encryption/encryption-engine.spec.js +29 -37
  43. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  44. package/lib/encryption/encryption-service.d.ts.map +1 -1
  45. package/lib/encryption/encryption-service.js +30 -44
  46. package/lib/encryption/encryption-service.js.map +1 -1
  47. package/lib/encryption/key-provider.d.ts.map +1 -1
  48. package/lib/encryption/key-provider.js +31 -38
  49. package/lib/encryption/key-provider.js.map +1 -1
  50. package/lib/env.d.ts +0 -6
  51. package/lib/env.d.ts.map +1 -1
  52. package/lib/env.js +7 -27
  53. package/lib/env.js.map +1 -1
  54. package/lib/experiments/always-default.d.ts +8 -0
  55. package/lib/experiments/always-default.d.ts.map +1 -0
  56. package/lib/experiments/always-default.js +20 -0
  57. package/lib/experiments/always-default.js.map +1 -0
  58. package/lib/experiments/configcat-server.d.ts +10 -0
  59. package/lib/experiments/configcat-server.d.ts.map +1 -0
  60. package/lib/experiments/configcat-server.js +36 -0
  61. package/lib/experiments/configcat-server.js.map +1 -0
  62. package/lib/experiments/configcat.d.ts +21 -0
  63. package/lib/experiments/configcat.d.ts.map +1 -0
  64. package/lib/experiments/configcat.js +51 -0
  65. package/lib/experiments/configcat.js.map +1 -0
  66. package/lib/experiments/types.d.ts +22 -0
  67. package/lib/experiments/types.d.ts.map +1 -0
  68. package/lib/experiments/types.js +10 -0
  69. package/lib/experiments/types.js.map +1 -0
  70. package/lib/gitpod-file-parser.d.ts.map +1 -1
  71. package/lib/gitpod-file-parser.js +26 -42
  72. package/lib/gitpod-file-parser.js.map +1 -1
  73. package/lib/gitpod-file-parser.spec.js +145 -142
  74. package/lib/gitpod-file-parser.spec.js.map +1 -1
  75. package/lib/gitpod-service.d.ts +195 -39
  76. package/lib/gitpod-service.d.ts.map +1 -1
  77. package/lib/gitpod-service.js +204 -271
  78. package/lib/gitpod-service.js.map +1 -1
  79. package/lib/headless-workspace-log.d.ts +9 -11
  80. package/lib/headless-workspace-log.d.ts.map +1 -1
  81. package/lib/headless-workspace-log.js +6 -8
  82. package/lib/headless-workspace-log.js.map +1 -1
  83. package/lib/ide-frontend-service.d.ts +5 -1
  84. package/lib/ide-frontend-service.d.ts.map +1 -1
  85. package/lib/ide-protocol.d.ts +113 -0
  86. package/lib/ide-protocol.d.ts.map +1 -0
  87. package/lib/{util/without.js → ide-protocol.js} +2 -2
  88. package/lib/ide-protocol.js.map +1 -0
  89. package/lib/index.d.ts +16 -10
  90. package/lib/index.d.ts.map +1 -1
  91. package/lib/index.js +8 -2
  92. package/lib/index.js.map +1 -1
  93. package/lib/installation-admin-protocol.d.ts +30 -0
  94. package/lib/installation-admin-protocol.d.ts.map +1 -0
  95. package/lib/installation-admin-protocol.js +31 -0
  96. package/lib/installation-admin-protocol.js.map +1 -0
  97. package/lib/license-protocol.d.ts +7 -0
  98. package/lib/license-protocol.d.ts.map +1 -1
  99. package/lib/license-protocol.js.map +1 -1
  100. package/lib/messaging/browser/connection.d.ts +5 -3
  101. package/lib/messaging/browser/connection.d.ts.map +1 -1
  102. package/lib/messaging/browser/connection.js +184 -34
  103. package/lib/messaging/browser/connection.js.map +1 -1
  104. package/lib/messaging/browser/window-connection.d.ts +4 -4
  105. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  106. package/lib/messaging/browser/window-connection.js +42 -59
  107. package/lib/messaging/browser/window-connection.js.map +1 -1
  108. package/lib/messaging/client-call-metrics.d.ts +19 -0
  109. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  110. package/lib/messaging/client-call-metrics.js +82 -0
  111. package/lib/messaging/client-call-metrics.js.map +1 -0
  112. package/lib/messaging/error.d.ts +11 -2
  113. package/lib/messaging/error.d.ts.map +1 -1
  114. package/lib/messaging/error.js +22 -4
  115. package/lib/messaging/error.js.map +1 -1
  116. package/lib/messaging/handler.d.ts +10 -0
  117. package/lib/messaging/handler.d.ts.map +1 -1
  118. package/lib/messaging/handler.js +1 -1
  119. package/lib/messaging/node/connection.d.ts +1 -17
  120. package/lib/messaging/node/connection.d.ts.map +1 -1
  121. package/lib/messaging/node/connection.js +24 -60
  122. package/lib/messaging/node/connection.js.map +1 -1
  123. package/lib/messaging/proxy-factory.d.ts +3 -1
  124. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  125. package/lib/messaging/proxy-factory.js +75 -162
  126. package/lib/messaging/proxy-factory.js.map +1 -1
  127. package/lib/oss-allowlist.d.ts +14 -0
  128. package/lib/oss-allowlist.d.ts.map +1 -0
  129. package/lib/oss-allowlist.js +8 -0
  130. package/lib/oss-allowlist.js.map +1 -0
  131. package/lib/payment-protocol.d.ts +18 -0
  132. package/lib/payment-protocol.d.ts.map +1 -0
  133. package/lib/payment-protocol.js +13 -0
  134. package/lib/payment-protocol.js.map +1 -0
  135. package/lib/permission.d.ts +10 -3
  136. package/lib/permission.d.ts.map +1 -1
  137. package/lib/permission.js +41 -31
  138. package/lib/permission.js.map +1 -1
  139. package/lib/plans.d.ts +211 -0
  140. package/lib/plans.d.ts.map +1 -0
  141. package/lib/plans.js +609 -0
  142. package/lib/plans.js.map +1 -0
  143. package/lib/protocol.d.ts +285 -95
  144. package/lib/protocol.d.ts.map +1 -1
  145. package/lib/protocol.js +383 -206
  146. package/lib/protocol.js.map +1 -1
  147. package/{src/util/without.ts → lib/protocol.spec.d.ts} +2 -3
  148. package/lib/protocol.spec.d.ts.map +1 -0
  149. package/lib/protocol.spec.js +127 -0
  150. package/lib/protocol.spec.js.map +1 -0
  151. package/lib/snapshot-url.d.ts +14 -0
  152. package/lib/snapshot-url.d.ts.map +1 -0
  153. package/lib/snapshot-url.js +26 -0
  154. package/lib/snapshot-url.js.map +1 -0
  155. package/{src/theia-plugins.ts → lib/snapshot-url.spec.d.ts} +2 -6
  156. package/lib/snapshot-url.spec.d.ts.map +1 -0
  157. package/lib/snapshot-url.spec.js +41 -0
  158. package/lib/snapshot-url.spec.js.map +1 -0
  159. package/lib/team-subscription-protocol.d.ts +92 -0
  160. package/lib/team-subscription-protocol.d.ts.map +1 -0
  161. package/lib/team-subscription-protocol.js +78 -0
  162. package/lib/team-subscription-protocol.js.map +1 -0
  163. package/lib/teams-projects-protocol.d.ts +130 -0
  164. package/lib/teams-projects-protocol.d.ts.map +1 -0
  165. package/lib/teams-projects-protocol.js +30 -0
  166. package/lib/teams-projects-protocol.js.map +1 -0
  167. package/lib/typings/globals.d.ts +2 -2
  168. package/lib/typings/globals.d.ts.map +1 -1
  169. package/lib/usage.d.ts +61 -0
  170. package/lib/usage.d.ts.map +1 -0
  171. package/lib/usage.js +14 -0
  172. package/lib/usage.js.map +1 -0
  173. package/lib/util/analytics.d.ts +8 -0
  174. package/lib/util/analytics.d.ts.map +1 -0
  175. package/lib/util/analytics.js +88 -0
  176. package/lib/util/analytics.js.map +1 -0
  177. package/lib/util/async-iterator.d.ts.map +1 -1
  178. package/lib/util/async-iterator.js +57 -135
  179. package/lib/util/async-iterator.js.map +1 -1
  180. package/lib/util/cancelable.js +17 -59
  181. package/lib/util/cancelable.js.map +1 -1
  182. package/lib/util/date-time.js +11 -11
  183. package/lib/util/date-time.js.map +1 -1
  184. package/lib/util/debug-app.d.ts +25 -0
  185. package/lib/util/debug-app.d.ts.map +1 -0
  186. package/lib/util/debug-app.js +100 -0
  187. package/lib/util/debug-app.js.map +1 -0
  188. package/lib/util/deferred.js +10 -12
  189. package/lib/util/deferred.js.map +1 -1
  190. package/lib/util/disposable.d.ts.map +1 -1
  191. package/lib/util/disposable.js +27 -40
  192. package/lib/util/disposable.js.map +1 -1
  193. package/lib/util/event.d.ts.map +1 -1
  194. package/lib/util/event.js +63 -77
  195. package/lib/util/event.js.map +1 -1
  196. package/lib/util/garbage-collected-cache.d.ts +1 -0
  197. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  198. package/lib/util/garbage-collected-cache.js +32 -47
  199. package/lib/util/garbage-collected-cache.js.map +1 -1
  200. package/lib/util/generate-workspace-id.d.ts +6 -1
  201. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  202. package/lib/util/generate-workspace-id.js +469 -502
  203. package/lib/util/generate-workspace-id.js.map +1 -1
  204. package/lib/util/generate-workspace-id.spec.js +68 -78
  205. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  206. package/lib/util/gitpod-cookie.d.ts +20 -0
  207. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  208. package/lib/util/gitpod-cookie.js +41 -0
  209. package/lib/util/gitpod-cookie.js.map +1 -0
  210. package/lib/util/gitpod-host-url.d.ts +4 -2
  211. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  212. package/lib/util/gitpod-host-url.js +126 -109
  213. package/lib/util/gitpod-host-url.js.map +1 -1
  214. package/lib/util/gitpod-host-url.spec.d.ts +7 -1
  215. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  216. package/lib/util/gitpod-host-url.spec.js +113 -31
  217. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  218. package/lib/util/grpc.d.ts +34 -0
  219. package/lib/util/grpc.d.ts.map +1 -0
  220. package/lib/util/grpc.js +90 -0
  221. package/lib/util/grpc.js.map +1 -0
  222. package/lib/util/jaeger-client-types.d.ts +68 -0
  223. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  224. package/lib/{theia-plugins.js → util/jaeger-client-types.js} +1 -1
  225. package/lib/util/jaeger-client-types.js.map +1 -0
  226. package/lib/util/logging.d.ts +49 -33
  227. package/lib/util/logging.d.ts.map +1 -1
  228. package/lib/util/logging.js +132 -129
  229. package/lib/util/logging.js.map +1 -1
  230. package/lib/util/logging.spec.d.ts +7 -0
  231. package/lib/util/logging.spec.d.ts.map +1 -0
  232. package/lib/util/logging.spec.js +52 -0
  233. package/lib/util/logging.spec.js.map +1 -0
  234. package/lib/util/make-link.js +5 -5
  235. package/lib/util/make-link.js.map +1 -1
  236. package/lib/util/nice-grpc.d.ts +9 -0
  237. package/lib/util/nice-grpc.d.ts.map +1 -0
  238. package/lib/util/nice-grpc.js +119 -0
  239. package/lib/util/nice-grpc.js.map +1 -0
  240. package/lib/util/parse-workspace-id.d.ts +10 -0
  241. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  242. package/lib/util/parse-workspace-id.js +31 -7
  243. package/lib/util/parse-workspace-id.js.map +1 -1
  244. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  245. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  246. package/lib/util/parse-workspace-id.spec.js +123 -84
  247. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  248. package/lib/util/queue.js +16 -55
  249. package/lib/util/queue.js.map +1 -1
  250. package/lib/util/queue.spec.js +147 -288
  251. package/lib/util/queue.spec.js.map +1 -1
  252. package/lib/util/repeat.d.ts +15 -0
  253. package/lib/util/repeat.d.ts.map +1 -0
  254. package/lib/util/repeat.js +55 -0
  255. package/lib/util/repeat.js.map +1 -0
  256. package/lib/util/semaphore.d.ts.map +1 -1
  257. package/lib/util/semaphore.js +15 -46
  258. package/lib/util/semaphore.js.map +1 -1
  259. package/lib/util/skip-if.d.ts.map +1 -1
  260. package/lib/util/skip-if.js +6 -6
  261. package/lib/util/skip-if.js.map +1 -1
  262. package/lib/util/timeutil.d.ts +2 -0
  263. package/lib/util/timeutil.d.ts.map +1 -1
  264. package/lib/util/timeutil.js +41 -17
  265. package/lib/util/timeutil.js.map +1 -1
  266. package/lib/util/timeutil.spec.d.ts +2 -0
  267. package/lib/util/timeutil.spec.d.ts.map +1 -1
  268. package/lib/util/timeutil.spec.js +54 -23
  269. package/lib/util/timeutil.spec.js.map +1 -1
  270. package/lib/util/tracing.d.ts +52 -6
  271. package/lib/util/tracing.d.ts.map +1 -1
  272. package/lib/util/tracing.js +197 -64
  273. package/lib/util/tracing.js.map +1 -1
  274. package/lib/util/tracing.spec.d.ts +7 -0
  275. package/lib/util/tracing.spec.d.ts.map +1 -0
  276. package/lib/util/tracing.spec.js +121 -0
  277. package/lib/util/tracing.spec.js.map +1 -0
  278. package/lib/util/workspace-port-authentication.d.ts +7 -7
  279. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  280. package/lib/util/workspace-port-authentication.js +10 -12
  281. package/lib/util/workspace-port-authentication.js.map +1 -1
  282. package/lib/webhook-event.d.ts +44 -0
  283. package/lib/webhook-event.d.ts.map +1 -0
  284. package/lib/webhook-event.js +8 -0
  285. package/lib/webhook-event.js.map +1 -0
  286. package/lib/workspace-class.d.ts +14 -0
  287. package/lib/workspace-class.d.ts.map +1 -0
  288. package/lib/workspace-class.js +8 -0
  289. package/lib/workspace-class.js.map +1 -0
  290. package/lib/workspace-cluster.d.ts +75 -0
  291. package/lib/workspace-cluster.d.ts.map +1 -0
  292. package/lib/workspace-cluster.js +31 -0
  293. package/lib/workspace-cluster.js.map +1 -0
  294. package/lib/workspace-instance.d.ts +46 -5
  295. package/lib/workspace-instance.d.ts.map +1 -1
  296. package/lib/wsready.d.ts +1 -1
  297. package/lib/wsready.d.ts.map +1 -1
  298. package/lib/wsready.js +2 -2
  299. package/package.json +40 -18
  300. package/pkg-yarn.lock +23 -10
  301. package/provenance-bundle.jsonl +2 -0
  302. package/src/accounting-protocol.ts +244 -0
  303. package/src/admin-protocol.ts +80 -19
  304. package/src/analytics.ts +52 -0
  305. package/src/attribution.ts +59 -0
  306. package/src/auth.ts +2 -2
  307. package/src/billing-mode.ts +81 -0
  308. package/src/blocked-repositories-protocol.ts +13 -0
  309. package/src/context-url.spec.ts +67 -0
  310. package/src/context-url.ts +109 -0
  311. package/src/encryption/container-module.ts +2 -3
  312. package/src/encryption/encryption-engine.spec.ts +9 -8
  313. package/src/encryption/encryption-engine.ts +20 -16
  314. package/src/encryption/encryption-service.ts +4 -5
  315. package/src/encryption/key-provider.ts +16 -19
  316. package/src/env.ts +0 -22
  317. package/src/experiments/always-default.ts +24 -0
  318. package/src/experiments/configcat-server.ts +41 -0
  319. package/src/experiments/configcat.ts +56 -0
  320. package/src/experiments/types.ts +34 -0
  321. package/src/gitpod-file-parser.spec.ts +55 -61
  322. package/src/gitpod-file-parser.ts +16 -17
  323. package/src/gitpod-service.ts +385 -117
  324. package/src/headless-workspace-log.ts +12 -14
  325. package/src/ide-frontend-service.ts +6 -2
  326. package/src/ide-protocol.ts +129 -0
  327. package/src/index.ts +16 -10
  328. package/src/installation-admin-protocol.ts +45 -0
  329. package/src/license-protocol.ts +12 -6
  330. package/src/messaging/browser/connection.ts +197 -18
  331. package/src/messaging/browser/window-connection.ts +39 -29
  332. package/src/messaging/client-call-metrics.ts +77 -0
  333. package/src/messaging/error.ts +32 -7
  334. package/src/messaging/handler.ts +13 -1
  335. package/src/messaging/node/connection.ts +23 -70
  336. package/src/messaging/proxy-factory.ts +35 -34
  337. package/src/oss-allowlist.ts +15 -0
  338. package/src/payment-protocol.ts +20 -0
  339. package/src/permission.ts +42 -33
  340. package/src/plans.ts +683 -0
  341. package/src/protocol.spec.ts +97 -0
  342. package/src/protocol.ts +680 -282
  343. package/src/snapshot-url.spec.ts +27 -0
  344. package/src/snapshot-url.ts +27 -0
  345. package/src/team-subscription-protocol.ts +150 -0
  346. package/src/teams-projects-protocol.ts +166 -0
  347. package/src/typings/globals.ts +4 -4
  348. package/src/usage.ts +71 -0
  349. package/src/util/analytics.ts +109 -0
  350. package/src/util/async-iterator.ts +4 -5
  351. package/src/util/cancelable.ts +3 -3
  352. package/src/util/date-time.ts +8 -8
  353. package/src/util/debug-app.ts +81 -0
  354. package/src/util/deferred.ts +6 -6
  355. package/src/util/disposable.ts +3 -6
  356. package/src/util/event.ts +9 -11
  357. package/src/util/garbage-collected-cache.ts +16 -8
  358. package/src/util/generate-workspace-id.spec.ts +37 -10
  359. package/src/util/generate-workspace-id.ts +464 -438
  360. package/src/util/gitpod-cookie.ts +38 -0
  361. package/src/util/gitpod-host-url.spec.ts +59 -8
  362. package/src/util/gitpod-host-url.ts +72 -39
  363. package/src/util/grpc.ts +104 -0
  364. package/src/util/jaeger-client-types.ts +102 -0
  365. package/src/util/logging.spec.ts +23 -0
  366. package/src/util/logging.ts +156 -74
  367. package/src/util/make-link.ts +6 -7
  368. package/src/util/nice-grpc.ts +93 -0
  369. package/src/util/parse-workspace-id.spec.ts +37 -8
  370. package/src/util/parse-workspace-id.ts +32 -7
  371. package/src/util/queue.spec.ts +28 -26
  372. package/src/util/repeat.ts +45 -0
  373. package/src/util/semaphore.ts +6 -8
  374. package/src/util/skip-if.ts +10 -7
  375. package/src/util/timeutil.spec.ts +40 -14
  376. package/src/util/timeutil.ts +31 -15
  377. package/src/util/tracing.spec.ts +88 -0
  378. package/src/util/tracing.ts +200 -31
  379. package/src/util/workspace-port-authentication.ts +10 -13
  380. package/src/webhook-event.ts +55 -0
  381. package/src/workspace-class.ts +14 -0
  382. package/src/workspace-cluster.ts +109 -0
  383. package/src/workspace-instance.ts +105 -31
  384. package/src/wsready.ts +3 -3
  385. package/data/builtin-theia-plugins.json +0 -372
  386. package/lib/email-protocol.d.ts +0 -50
  387. package/lib/email-protocol.d.ts.map +0 -1
  388. package/lib/email-protocol.js +0 -28
  389. package/lib/email-protocol.js.map +0 -1
  390. package/lib/messaging/connection-error-handler.d.ts +0 -27
  391. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  392. package/lib/messaging/connection-error-handler.js +0 -46
  393. package/lib/messaging/connection-error-handler.js.map +0 -1
  394. package/lib/theia-plugins.d.ts +0 -11
  395. package/lib/theia-plugins.d.ts.map +0 -1
  396. package/lib/theia-plugins.js.map +0 -1
  397. package/lib/util/context-url.d.ts +0 -13
  398. package/lib/util/context-url.d.ts.map +0 -1
  399. package/lib/util/context-url.js +0 -26
  400. package/lib/util/context-url.js.map +0 -1
  401. package/lib/util/context-url.spec.d.ts +0 -10
  402. package/lib/util/context-url.spec.d.ts.map +0 -1
  403. package/lib/util/context-url.spec.js +0 -52
  404. package/lib/util/context-url.spec.js.map +0 -1
  405. package/lib/util/repeater.d.ts +0 -22
  406. package/lib/util/repeater.d.ts.map +0 -1
  407. package/lib/util/repeater.js +0 -118
  408. package/lib/util/repeater.js.map +0 -1
  409. package/lib/util/safe-promise.d.ts +0 -11
  410. package/lib/util/safe-promise.d.ts.map +0 -1
  411. package/lib/util/safe-promise.js +0 -34
  412. package/lib/util/safe-promise.js.map +0 -1
  413. package/lib/util/without.d.ts +0 -7
  414. package/lib/util/without.d.ts.map +0 -1
  415. package/lib/util/without.js.map +0 -1
  416. package/src/email-protocol.ts +0 -67
  417. package/src/messaging/connection-error-handler.ts +0 -62
  418. package/src/util/context-url.spec.ts +0 -25
  419. package/src/util/context-url.ts +0 -23
  420. package/src/util/jaeger-client.d.ts +0 -105
  421. package/src/util/repeater.ts +0 -49
  422. package/src/util/safe-promise.ts +0 -26
@@ -5,26 +5,74 @@
5
5
  */
6
6
 
7
7
  import {
8
- User, WorkspaceInfo, WorkspaceCreationResult, UserMessage, WorkspaceInstanceUser,
9
- WhitelistedRepository, WorkspaceImageBuild, AuthProviderInfo, Branding, CreateWorkspaceMode,
10
- Token, UserEnvVarValue, ResolvePluginsParams, PreparePluginUploadParams, Terms,
11
- ResolvedPlugins, Configuration, InstallPluginsParams, UninstallPluginParams, UserInfo, GitpodTokenType, GitpodToken, AuthProviderEntry
12
- } from './protocol';
13
- import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
14
- import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
15
- import { HeadlessLogEvent } from './headless-workspace-log';
16
- import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from './workspace-instance';
17
- import { AdminServer } from './admin-protocol';
18
- import { GitpodHostUrl } from './util/gitpod-host-url';
19
- import { WebSocketConnectionProvider } from './messaging/browser/connection';
20
- import { PermissionName } from './permission';
21
- import { LicenseService } from './license-protocol';
22
- import { Emitter } from './util/event';
8
+ User,
9
+ WorkspaceInfo,
10
+ WorkspaceCreationResult,
11
+ WorkspaceInstanceUser,
12
+ WhitelistedRepository,
13
+ WorkspaceImageBuild,
14
+ AuthProviderInfo,
15
+ CreateWorkspaceMode,
16
+ Token,
17
+ UserEnvVarValue,
18
+ Terms,
19
+ Configuration,
20
+ UserInfo,
21
+ GitpodTokenType,
22
+ GitpodToken,
23
+ AuthProviderEntry,
24
+ GuessGitTokenScopesParams,
25
+ GuessedGitTokenScopes,
26
+ ProjectEnvVar,
27
+ PrebuiltWorkspace,
28
+ UserSSHPublicKeyValue,
29
+ SSHPublicKeyValue,
30
+ } from "./protocol";
31
+ import {
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 { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
63
+ import { ListUsageRequest, ListUsageResponse } from "./usage";
64
+ import { SupportedWorkspaceClass } from "./workspace-class";
65
+ import { BillingMode } from "./billing-mode";
23
66
 
24
67
  export interface GitpodClient {
25
68
  onInstanceUpdate(instance: WorkspaceInstance): void;
26
69
  onWorkspaceImageBuildLogs: WorkspaceImageBuild.LogCallback;
27
- onHeadlessWorkspaceLogs(evt: HeadlessLogEvent): void;
70
+
71
+ onPrebuildUpdate(update: PrebuildWithStatus): void;
72
+
73
+ onNotificationUpdated(): void;
74
+
75
+ onCreditAlert(creditAlert: CreditAlert): void;
28
76
 
29
77
  //#region propagating reconnection to iframe
30
78
  notifyDidOpenConnection(): void;
@@ -32,19 +80,21 @@ export interface GitpodClient {
32
80
  //#endregion
33
81
  }
34
82
 
35
- export const GitpodServer = Symbol('GitpodServer');
36
- export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
83
+ export const GitpodServer = Symbol("GitpodServer");
84
+ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
37
85
  // User related API
38
86
  getLoggedInUser(): Promise<User>;
39
87
  getTerms(): Promise<Terms>;
40
88
  updateLoggedInUser(user: Partial<User>): Promise<User>;
89
+ sendPhoneNumberVerificationToken(phoneNumber: string): Promise<void>;
90
+ verifyPhoneNumberVerificationToken(phoneNumber: string, token: string): Promise<boolean>;
41
91
  getAuthProviders(): Promise<AuthProviderInfo[]>;
42
92
  getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
43
- updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<void>;
93
+ updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
44
94
  deleteOwnAuthProvider(params: GitpodServer.DeleteOwnAuthProviderParams): Promise<void>;
45
- getBranding(): Promise<Branding>;
46
95
  getConfiguration(): Promise<Configuration>;
47
96
  getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
97
+ getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
48
98
  /**
49
99
  * @deprecated
50
100
  */
@@ -58,8 +108,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
58
108
  getWorkspaceOwner(workspaceId: string): Promise<UserInfo | undefined>;
59
109
  getWorkspaceUsers(workspaceId: string): Promise<WorkspaceInstanceUser[]>;
60
110
  getFeaturedRepositories(): Promise<WhitelistedRepository[]>;
111
+ getSuggestedContextURLs(): Promise<string[]>;
112
+ /**
113
+ * **Security:**
114
+ * Sensitive information like an owner token is erased, since it allows access for all team members.
115
+ * If you need to access an owner token use `getOwnerToken` instead.
116
+ */
61
117
  getWorkspace(id: string): Promise<WorkspaceInfo>;
62
118
  isWorkspaceOwner(workspaceId: string): Promise<boolean>;
119
+ getOwnerToken(workspaceId: string): Promise<string>;
63
120
 
64
121
  /**
65
122
  * Creates and starts a workspace for the given context URL.
@@ -76,8 +133,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
76
133
  updateWorkspaceUserPin(id: string, action: GitpodServer.PinAction): Promise<void>;
77
134
  sendHeartBeat(options: GitpodServer.SendHeartBeatOptions): Promise<void>;
78
135
  watchWorkspaceImageBuildLogs(workspaceId: string): Promise<void>;
79
- watchHeadlessWorkspaceLogs(workspaceId: string): Promise<void>;
80
136
  isPrebuildDone(pwsid: string): Promise<boolean>;
137
+ getHeadlessLog(instanceId: string): Promise<HeadlessLogUrls>;
81
138
 
82
139
  // Workspace timeout
83
140
  setWorkspaceTimeout(workspaceId: string, duration: WorkspaceTimeoutDuration): Promise<SetWorkspaceTimeoutResult>;
@@ -91,22 +148,59 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
91
148
  openPort(workspaceId: string, port: WorkspaceInstancePort): Promise<WorkspaceInstancePort | undefined>;
92
149
  closePort(workspaceId: string, port: number): Promise<void>;
93
150
 
94
- // User messages
95
- getUserMessages(options: GitpodServer.GetUserMessagesOptions): Promise<UserMessage[]>;
96
- updateUserMessages(options: GitpodServer.UpdateUserMessagesOptions): Promise<void>;
97
-
98
151
  // User storage
99
152
  getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
100
153
  updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
101
154
 
102
- // user env vars
155
+ // User env vars
103
156
  getEnvVars(): Promise<UserEnvVarValue[]>;
157
+ getAllEnvVars(): Promise<UserEnvVarValue[]>;
104
158
  setEnvVar(variable: UserEnvVarValue): Promise<void>;
105
159
  deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
106
160
 
161
+ // User SSH Keys
162
+ hasSSHPublicKey(): Promise<boolean>;
163
+ getSSHPublicKeys(): Promise<UserSSHPublicKeyValue[]>;
164
+ addSSHPublicKey(value: SSHPublicKeyValue): Promise<UserSSHPublicKeyValue>;
165
+ deleteSSHPublicKey(id: string): Promise<void>;
166
+
167
+ // Teams
168
+ getTeams(): Promise<Team[]>;
169
+ getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
170
+ createTeam(name: string): Promise<Team>;
171
+ joinTeam(inviteId: string): Promise<Team>;
172
+ setTeamMemberRole(teamId: string, userId: string, role: TeamMemberRole): Promise<void>;
173
+ removeTeamMember(teamId: string, userId: string): Promise<void>;
174
+ getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
175
+ resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
176
+ deleteTeam(teamId: string, userId: string): Promise<void>;
177
+
178
+ // Admin Settings
179
+ adminGetSettings(): Promise<InstallationAdminSettings>;
180
+ adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
181
+ adminGetTelemetryData(): Promise<TelemetryData>;
182
+
183
+ // Projects
184
+ getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
185
+ createProject(params: CreateProjectParams): Promise<Project>;
186
+ deleteProject(projectId: string): Promise<void>;
187
+ getTeamProjects(teamId: string): Promise<Project[]>;
188
+ getUserProjects(): Promise<Project[]>;
189
+ getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
190
+ getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
191
+ findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
192
+ findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
193
+ getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
194
+ triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
195
+ cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
196
+ updateProjectPartial(partialProject: PartialProject): Promise<void>;
197
+ setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
198
+ getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
199
+ deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
200
+
107
201
  // content service
108
- getContentBlobUploadUrl(name: string): Promise<string>
109
- getContentBlobDownloadUrl(name: string): Promise<string>
202
+ getContentBlobUploadUrl(name: string): Promise<string>;
203
+ getContentBlobDownloadUrl(name: string): Promise<string>;
110
204
 
111
205
  // Gitpod token
112
206
  getGitpodTokens(): Promise<GitpodToken[]>;
@@ -114,75 +208,203 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
114
208
  deleteGitpodToken(tokenHash: string): Promise<void>;
115
209
 
116
210
  // misc
117
- sendFeedback(feedback: string): Promise<string | undefined>;
211
+ isGitHubAppEnabled(): Promise<boolean>;
118
212
  registerGithubApp(installationId: string): Promise<void>;
119
213
 
120
214
  /**
121
- * Stores a new snapshot for the given workspace and bucketId
215
+ * Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
122
216
  * @return the snapshot id
123
217
  */
124
218
  takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
219
+ /**
220
+ *
221
+ * @param snapshotId
222
+ */
223
+ waitForSnapshot(snapshotId: string): Promise<void>;
125
224
 
126
225
  /**
127
226
  * Returns the list of snapshots that exist for a workspace.
128
227
  */
129
228
  getSnapshots(workspaceID: string): Promise<string[]>;
130
229
 
230
+ guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
231
+
232
+ /**
233
+ * gitpod.io concerns
234
+ */
235
+ isStudent(): Promise<boolean>;
236
+ /**
237
+ *
238
+ */
239
+ getAccountStatement(options: GitpodServer.GetAccountStatementOptions): Promise<AccountStatement | undefined>;
240
+ getRemainingUsageHours(): Promise<number>;
241
+
242
+ /**
243
+ *
244
+ */
245
+ getChargebeeSiteId(): Promise<string>;
246
+ createPortalSession(): Promise<{}>;
247
+ createTeamPortalSession(teamId: string): Promise<{}>;
248
+ checkout(planId: string, planQuantity?: number): Promise<{}>;
249
+ teamCheckout(teamId: string, planId: string): Promise<{}>;
250
+ getAvailableCoupons(): Promise<PlanCoupon[]>;
251
+ getAppliedCoupons(): Promise<PlanCoupon[]>;
252
+
253
+ getShowPaymentUI(): Promise<boolean>;
254
+ isChargebeeCustomer(): Promise<boolean>;
255
+
256
+ subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
257
+ subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
258
+ subscriptionCancel(subscriptionId: string): Promise<void>;
259
+ subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
260
+
261
+ getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
262
+ tsGet(): Promise<TeamSubscription[]>;
263
+ tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
264
+ tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
265
+ tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
266
+ tsAssignSlot(
267
+ teamSubscriptionId: string,
268
+ teamSubscriptionSlotId: string,
269
+ identityStr: string | undefined,
270
+ ): Promise<void>;
271
+ tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
272
+ tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
273
+ tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
274
+
275
+ getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
276
+
277
+ getStripePublishableKey(): Promise<string>;
278
+ getStripeSetupIntentClientSecret(): Promise<string>;
279
+ findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
280
+ createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
281
+ subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
282
+ getStripePortalUrl(attributionId: string): Promise<string>;
283
+ getUsageLimit(attributionId: string): Promise<number | undefined>;
284
+ setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
285
+
286
+ listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
287
+
288
+ setUsageAttribution(usageAttribution: string): Promise<void>;
289
+
290
+ getBillingModeForUser(): Promise<BillingMode>;
291
+ getBillingModeForTeam(teamId: string): Promise<BillingMode>;
292
+
131
293
  /**
132
- * stores/updates layout information for the given workspace
294
+ * Analytics
133
295
  */
134
- storeLayout(workspaceId: string, layoutData: string): Promise<void>;
296
+ trackEvent(event: RemoteTrackMessage): Promise<void>;
297
+ trackLocation(event: RemotePageMessage): Promise<void>;
298
+ identifyUser(event: RemoteIdentifyMessage): Promise<void>;
135
299
 
136
300
  /**
137
- * retrieves layout information for the given workspace
301
+ * Frontend notifications
138
302
  */
139
- getLayout(workspaceId: string): Promise<string | undefined>;
303
+ getNotifications(): Promise<string[]>;
304
+
305
+ getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
306
+ }
307
+
308
+ export interface RateLimiterError {
309
+ method?: string;
140
310
 
141
311
  /**
142
- * @param params
143
- * @returns promise resolves to an URL to be used for the upload
312
+ * Retry after this many seconds, earliest.
313
+ * cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
144
314
  */
145
- preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
146
- resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
147
- installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
148
- uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
315
+ retryAfter: number;
316
+ }
317
+
318
+ export interface CreateProjectParams {
319
+ name: string;
320
+ slug: string;
321
+ cloneUrl: string;
322
+ teamId?: string;
323
+ userId?: string;
324
+ appInstallationId: string;
325
+ }
326
+ export interface FindPrebuildsParams {
327
+ projectId: string;
328
+ branch?: string;
329
+ latest?: boolean;
330
+ prebuildId?: string;
331
+ // default: 30
332
+ limit?: number;
333
+ }
334
+ export interface GetProviderRepositoriesParams {
335
+ provider: string;
336
+ hints?: { installationId: string } | object;
337
+ }
338
+ export interface ProviderRepository {
339
+ name: string;
340
+ path?: string;
341
+ account: string;
342
+ accountAvatarUrl: string;
343
+ cloneUrl: string;
344
+ updatedAt?: string;
345
+ installationId?: number;
346
+ installationUpdatedAt?: string;
347
+
348
+ inUse?: { userName: string };
149
349
  }
150
350
 
151
- export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
351
+ export interface ClientHeaderFields {
352
+ ip?: string;
353
+ userAgent?: string;
354
+ dnt?: string;
355
+ clientRegion?: string;
356
+ }
152
357
 
153
- export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(methods: Partial<JsonRpcProxy<S>>): GitpodServiceImpl<C, S> {
358
+ export const WORKSPACE_TIMEOUT_DEFAULT_SHORT = "short";
359
+ export const WORKSPACE_TIMEOUT_DEFAULT_LONG = "long";
360
+ export const WORKSPACE_TIMEOUT_EXTENDED = "extended";
361
+ export const WORKSPACE_TIMEOUT_EXTENDED_ALT = "180m"; // for backwards compatibility since the IDE uses this
362
+ export const WorkspaceTimeoutValues = [
363
+ WORKSPACE_TIMEOUT_DEFAULT_SHORT,
364
+ WORKSPACE_TIMEOUT_DEFAULT_LONG,
365
+ WORKSPACE_TIMEOUT_EXTENDED,
366
+ WORKSPACE_TIMEOUT_EXTENDED_ALT,
367
+ ] as const;
368
+
369
+ export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
370
+ methods: Partial<JsonRpcProxy<S>>,
371
+ ): GitpodServiceImpl<C, S> {
154
372
  return new GitpodServiceImpl<C, S>(createServerMock(methods));
155
- }
373
+ };
156
374
 
157
- export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(methods: Partial<JsonRpcProxy<S>>): JsonRpcProxy<S> {
158
- methods.setClient = methods.setClient || (() => { });
159
- methods.dispose = methods.dispose || (() => { });
375
+ export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
376
+ methods: Partial<JsonRpcProxy<S>>,
377
+ ): JsonRpcProxy<S> {
378
+ methods.setClient = methods.setClient || (() => {});
379
+ methods.dispose = methods.dispose || (() => {});
160
380
  return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
381
+ // @ts-ignore
161
382
  get: (target: S, property: keyof S) => {
162
383
  const result = target[property];
163
384
  if (!result) {
164
- throw new Error(`Method ${property} not implemented`);
385
+ throw new Error(`Method ${String(property)} not implemented`);
165
386
  }
166
387
  return result;
167
- }
388
+ },
168
389
  });
169
- }
390
+ };
170
391
 
171
392
  type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
172
393
  export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
173
394
 
174
395
  export interface SetWorkspaceTimeoutResult {
175
- resetTimeoutOnWorkspaces: string[]
396
+ resetTimeoutOnWorkspaces: string[];
176
397
  }
177
398
 
178
399
  export interface GetWorkspaceTimeoutResult {
179
- duration: WorkspaceTimeoutDuration
180
- canChange: boolean
400
+ duration: WorkspaceTimeoutDuration;
401
+ durationRaw: string;
402
+ canChange: boolean;
181
403
  }
182
404
 
183
405
  export interface StartWorkspaceResult {
184
- instanceID: string
185
- workspaceURL?: string
406
+ instanceID: string;
407
+ workspaceURL?: string;
186
408
  }
187
409
 
188
410
  export namespace GitpodServer {
@@ -190,6 +412,8 @@ export namespace GitpodServer {
190
412
  limit?: number;
191
413
  searchString?: string;
192
414
  pinnedOnly?: boolean;
415
+ projectId?: string | string[];
416
+ includeWithoutProject?: boolean;
193
417
  }
194
418
  export interface GetAccountStatementOptions {
195
419
  date?: string;
@@ -197,20 +421,15 @@ export namespace GitpodServer {
197
421
  export interface CreateWorkspaceOptions {
198
422
  contextUrl: string;
199
423
  mode?: CreateWorkspaceMode;
424
+ forceDefaultConfig?: boolean;
200
425
  }
201
426
  export interface StartWorkspaceOptions {
202
427
  forceDefaultImage: boolean;
203
428
  }
204
429
  export interface TakeSnapshotOptions {
205
430
  workspaceId: string;
206
- layoutData?: string;
207
- }
208
- export interface GetUserMessagesOptions {
209
- readonly releaseNotes?: boolean;
210
- readonly workspaceInstanceId: string;
211
- }
212
- export interface UpdateUserMessagesOptions {
213
- readonly messageIds: string[];
431
+ /* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
432
+ dontWait?: boolean;
214
433
  }
215
434
  export interface GetUserStorageResourceOptions {
216
435
  readonly uri: string;
@@ -228,23 +447,23 @@ export namespace GitpodServer {
228
447
  readonly roundTripTime?: number;
229
448
  }
230
449
  export interface UpdateOwnAuthProviderParams {
231
- readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
450
+ readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
232
451
  }
233
452
  export interface DeleteOwnAuthProviderParams {
234
- readonly id: string
453
+ readonly id: string;
235
454
  }
236
455
  export type AdmissionLevel = "owner" | "everyone";
237
456
  export type PinAction = "pin" | "unpin" | "toggle";
238
457
  export interface GenerateNewGitpodTokenOptions {
239
- name?: string
240
- type: GitpodTokenType
241
- scopes?: string[]
458
+ name?: string;
459
+ type: GitpodTokenType;
460
+ scopes?: string[];
242
461
  }
243
462
  }
244
463
 
245
- export const GitpodServerPath = '/gitpod';
464
+ export const GitpodServerPath = "/gitpod";
246
465
 
247
- export const GitpodServerProxy = Symbol('GitpodServerProxy');
466
+ export const GitpodServerProxy = Symbol("GitpodServerProxy");
248
467
  export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
249
468
 
250
469
  export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
@@ -252,12 +471,14 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
252
471
 
253
472
  public registerClient(client: Partial<Client>): Disposable {
254
473
  this.clients.push(client);
255
- const index = this.clients.length;
256
474
  return {
257
475
  dispose: () => {
258
- this.clients.slice(index, 1);
259
- }
260
- }
476
+ const index = this.clients.indexOf(client);
477
+ if (index > -1) {
478
+ this.clients.splice(index, 1);
479
+ }
480
+ },
481
+ };
261
482
  }
262
483
 
263
484
  onInstanceUpdate(instance: WorkspaceInstance): void {
@@ -266,31 +487,34 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
266
487
  try {
267
488
  client.onInstanceUpdate(instance);
268
489
  } catch (error) {
269
- console.error(error)
490
+ console.error(error);
270
491
  }
271
492
  }
272
493
  }
273
494
  }
274
495
 
275
- onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
496
+ onPrebuildUpdate(update: PrebuildWithStatus): void {
276
497
  for (const client of this.clients) {
277
- if (client.onWorkspaceImageBuildLogs) {
498
+ if (client.onPrebuildUpdate) {
278
499
  try {
279
- client.onWorkspaceImageBuildLogs(info, content);
500
+ client.onPrebuildUpdate(update);
280
501
  } catch (error) {
281
- console.error(error)
502
+ console.error(error);
282
503
  }
283
504
  }
284
505
  }
285
506
  }
286
507
 
287
- onHeadlessWorkspaceLogs(evt: HeadlessLogEvent): void {
508
+ onWorkspaceImageBuildLogs(
509
+ info: WorkspaceImageBuild.StateInfo,
510
+ content: WorkspaceImageBuild.LogContent | undefined,
511
+ ): void {
288
512
  for (const client of this.clients) {
289
- if (client.onHeadlessWorkspaceLogs) {
513
+ if (client.onWorkspaceImageBuildLogs) {
290
514
  try {
291
- client.onHeadlessWorkspaceLogs(evt);
515
+ client.onWorkspaceImageBuildLogs(info, content);
292
516
  } catch (error) {
293
- console.error(error)
517
+ console.error(error);
294
518
  }
295
519
  }
296
520
  }
@@ -302,7 +526,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
302
526
  try {
303
527
  client.notifyDidOpenConnection();
304
528
  } catch (error) {
305
- console.error(error)
529
+ console.error(error);
306
530
  }
307
531
  }
308
532
  }
@@ -314,64 +538,85 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
314
538
  try {
315
539
  client.notifyDidCloseConnection();
316
540
  } catch (error) {
317
- console.error(error)
541
+ console.error(error);
542
+ }
543
+ }
544
+ }
545
+ }
546
+
547
+ onCreditAlert(creditAlert: CreditAlert): void {
548
+ for (const client of this.clients) {
549
+ if (client.onCreditAlert) {
550
+ try {
551
+ client.onCreditAlert(creditAlert);
552
+ } catch (error) {
553
+ console.error(error);
318
554
  }
319
555
  }
320
556
  }
321
557
  }
322
558
 
559
+ onNotificationUpdated(): void {
560
+ for (const client of this.clients) {
561
+ if (client.onNotificationUpdated) {
562
+ try {
563
+ client.onNotificationUpdated();
564
+ } catch (error) {
565
+ console.error(error);
566
+ }
567
+ }
568
+ }
569
+ }
323
570
  }
324
571
 
325
572
  export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
326
573
 
327
- const hasWindow = (typeof window !== 'undefined');
574
+ const hasWindow = typeof window !== "undefined";
328
575
  const phasesOrder: Record<WorkspaceInstancePhase, number> = {
329
576
  unknown: 0,
330
577
  preparing: 1,
331
- pending: 2,
332
- creating: 3,
333
- initializing: 4,
334
- running: 5,
335
- interrupted: 6,
336
- stopping: 7,
337
- stopped: 8
578
+ building: 2,
579
+ pending: 3,
580
+ creating: 4,
581
+ initializing: 5,
582
+ running: 6,
583
+ interrupted: 7,
584
+ stopping: 8,
585
+ stopped: 9,
338
586
  };
339
587
  export class WorkspaceInstanceUpdateListener {
340
588
  private readonly onDidChangeEmitter = new Emitter<void>();
341
589
  readonly onDidChange = this.onDidChangeEmitter.event;
342
590
 
343
- private source: 'sync' | 'update' = 'sync';
591
+ private source: "sync" | "update" = "sync";
344
592
 
345
593
  get info(): WorkspaceInfo {
346
594
  return this._info;
347
595
  }
348
596
 
349
- constructor(
350
- private readonly service: GitpodService,
351
- private _info: WorkspaceInfo
352
- ) {
597
+ constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
353
598
  service.registerClient({
354
- onInstanceUpdate: instance => {
599
+ onInstanceUpdate: (instance) => {
355
600
  if (this.isOutOfOrder(instance)) {
356
601
  return;
357
602
  }
358
603
  this.cancelSync();
359
604
  this._info.latestInstance = instance;
360
- this.source = 'update';
605
+ this.source = "update";
361
606
  this.onDidChangeEmitter.fire(undefined);
362
607
  },
363
608
  notifyDidOpenConnection: () => {
364
609
  this.sync();
365
- }
610
+ },
366
611
  });
367
612
  if (hasWindow) {
368
613
  // learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
369
- window.document.addEventListener('visibilitychange', async () => {
370
- if (window.document.visibilityState === 'visible') {
614
+ window.document.addEventListener("visibilitychange", async () => {
615
+ if (window.document.visibilityState === "visible") {
371
616
  this.sync();
372
617
  }
373
618
  });
374
- window.addEventListener('pageshow', e => {
619
+ window.addEventListener("pageshow", (e) => {
375
620
  if (e.persisted) {
376
621
  this.sync();
377
622
  }
@@ -399,12 +644,12 @@ export class WorkspaceInstanceUpdateListener {
399
644
  return;
400
645
  }
401
646
  this._info = info;
402
- this.source = 'sync';
647
+ this.source = "sync";
403
648
  this.onDidChangeEmitter.fire(undefined);
404
649
  } catch (e) {
405
- console.error('failed to sync workspace instance:', e)
650
+ console.error("failed to sync workspace instance:", e);
406
651
  }
407
- })
652
+ });
408
653
  }
409
654
  private cancelSync(): void {
410
655
  if (this.syncTokenSource) {
@@ -421,7 +666,7 @@ export class WorkspaceInstanceUpdateListener {
421
666
  if (instance.workspaceId !== this._info.workspace.id) {
422
667
  return true;
423
668
  }
424
- if (this.source === 'update') {
669
+ if (this.source === "update") {
425
670
  return false;
426
671
  }
427
672
  if (instance.id !== this.info.latestInstance?.id) {
@@ -429,14 +674,16 @@ export class WorkspaceInstanceUpdateListener {
429
674
  }
430
675
  return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
431
676
  }
677
+ }
432
678
 
679
+ export interface GitpodServiceOptions {
680
+ onReconnect?: () => void | Promise<void>;
433
681
  }
434
682
 
435
683
  export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
436
-
437
684
  private readonly compositeClient = new GitpodCompositeClient<Client>();
438
685
 
439
- constructor(public readonly server: JsonRpcProxy<Server>) {
686
+ constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
440
687
  server.setClient(this.compositeClient);
441
688
  server.onDidOpenConnection(() => this.compositeClient.notifyDidOpenConnection());
442
689
  server.onDidCloseConnection(() => this.compositeClient.notifyDidCloseConnection());
@@ -448,7 +695,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
448
695
 
449
696
  private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
450
697
  listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
451
- const listener = this.instanceListeners.get(workspaceId) ||
698
+ const listener =
699
+ this.instanceListeners.get(workspaceId) ||
452
700
  (async () => {
453
701
  const info = await this.server.getWorkspace(workspaceId);
454
702
  return new WorkspaceInstanceUpdateListener(this, info);
@@ -456,13 +704,33 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
456
704
  this.instanceListeners.set(workspaceId, listener);
457
705
  return listener;
458
706
  }
707
+
708
+ async reconnect(): Promise<void> {
709
+ if (this.options?.onReconnect) {
710
+ await this.options.onReconnect();
711
+ }
712
+ }
459
713
  }
460
714
 
461
- export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(serverUrl: string) {
462
- const url = new GitpodHostUrl(serverUrl)
463
- .asWebsocket()
464
- .withApi({ pathname: GitpodServerPath });
715
+ export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
716
+ serverUrl: string | Promise<string>,
717
+ ) {
718
+ const toWsUrl = (serverUrl: string) => {
719
+ return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
720
+ };
721
+ let url: string | Promise<string>;
722
+ if (typeof serverUrl === "string") {
723
+ url = toWsUrl(serverUrl);
724
+ } else {
725
+ url = serverUrl.then((url) => toWsUrl(url));
726
+ }
727
+
465
728
  const connectionProvider = new WebSocketConnectionProvider();
466
- const gitpodServer = connectionProvider.createProxy<S>(url.toString());
467
- return new GitpodServiceImpl<C, S>(gitpodServer);
468
- }
729
+ let onReconnect = () => {};
730
+ const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
731
+ onListening: (socket) => {
732
+ onReconnect = () => socket.reconnect();
733
+ },
734
+ });
735
+ return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
736
+ }