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