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