@gitpod/gitpod-protocol 0.1.5-main.648 → 0.1.5-main.6480

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 (455) hide show
  1. package/data/gitpod-schema.json +157 -29
  2. package/lib/accounting-protocol.d.ts +19 -14
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +44 -48
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +44 -5
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +16 -1
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +44 -0
  11. package/lib/analytics.d.ts.map +1 -0
  12. package/lib/analytics.js +10 -0
  13. package/lib/analytics.js.map +1 -0
  14. package/lib/attribution.d.ts +24 -0
  15. package/lib/attribution.d.ts.map +1 -0
  16. package/lib/attribution.js +54 -0
  17. package/lib/attribution.js.map +1 -0
  18. package/lib/auth.d.ts +1 -1
  19. package/lib/auth.d.ts.map +1 -1
  20. package/lib/auth.js +1 -1
  21. package/lib/billing-mode.d.ts +45 -0
  22. package/lib/billing-mode.d.ts.map +1 -0
  23. package/lib/billing-mode.js +44 -0
  24. package/lib/billing-mode.js.map +1 -0
  25. package/lib/blocked-repositories-protocol.d.ts +13 -0
  26. package/lib/blocked-repositories-protocol.d.ts.map +1 -0
  27. package/lib/blocked-repositories-protocol.js +8 -0
  28. package/lib/blocked-repositories-protocol.js.map +1 -0
  29. package/lib/context-url.d.ts +30 -0
  30. package/lib/context-url.d.ts.map +1 -0
  31. package/lib/context-url.js +100 -0
  32. package/lib/context-url.js.map +1 -0
  33. package/lib/context-url.spec.d.ts +12 -0
  34. package/lib/context-url.spec.d.ts.map +1 -0
  35. package/lib/context-url.spec.js +81 -0
  36. package/lib/context-url.spec.js.map +1 -0
  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 +5 -5
  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 +26 -27
  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 +30 -38
  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 +31 -45
  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 +32 -39
  56. package/lib/encryption/key-provider.js.map +1 -1
  57. package/lib/env.d.ts +1 -7
  58. package/lib/env.d.ts.map +1 -1
  59. package/lib/env.js +8 -28
  60. package/lib/env.js.map +1 -1
  61. package/lib/experiments/always-default.d.ts +8 -0
  62. package/lib/experiments/always-default.d.ts.map +1 -0
  63. package/lib/experiments/always-default.js +20 -0
  64. package/lib/experiments/always-default.js.map +1 -0
  65. package/lib/experiments/configcat-server.d.ts +10 -0
  66. package/lib/experiments/configcat-server.d.ts.map +1 -0
  67. package/lib/experiments/configcat-server.js +37 -0
  68. package/lib/experiments/configcat-server.js.map +1 -0
  69. package/lib/experiments/configcat.d.ts +21 -0
  70. package/lib/experiments/configcat.d.ts.map +1 -0
  71. package/lib/experiments/configcat.js +51 -0
  72. package/lib/experiments/configcat.js.map +1 -0
  73. package/lib/experiments/types.d.ts +22 -0
  74. package/lib/experiments/types.d.ts.map +1 -0
  75. package/lib/experiments/types.js +10 -0
  76. package/lib/experiments/types.js.map +1 -0
  77. package/lib/frontend-dashboard-service.d.ts +90 -0
  78. package/lib/frontend-dashboard-service.d.ts.map +1 -0
  79. package/lib/frontend-dashboard-service.js +49 -0
  80. package/lib/frontend-dashboard-service.js.map +1 -0
  81. package/lib/gitpod-file-parser.d.ts +1 -1
  82. package/lib/gitpod-file-parser.d.ts.map +1 -1
  83. package/lib/gitpod-file-parser.js +27 -43
  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 +146 -143
  87. package/lib/gitpod-file-parser.spec.js.map +1 -1
  88. package/lib/gitpod-service.d.ts +191 -55
  89. package/lib/gitpod-service.d.ts.map +1 -1
  90. package/lib/gitpod-service.js +204 -298
  91. package/lib/gitpod-service.js.map +1 -1
  92. package/lib/headless-workspace-log.d.ts +10 -12
  93. package/lib/headless-workspace-log.d.ts.map +1 -1
  94. package/lib/headless-workspace-log.js +7 -9
  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 +126 -0
  99. package/lib/ide-protocol.d.ts.map +1 -0
  100. package/lib/ide-protocol.js +18 -0
  101. package/lib/ide-protocol.js.map +1 -0
  102. package/lib/index.d.ts +17 -11
  103. package/lib/index.d.ts.map +1 -1
  104. package/lib/index.js +8 -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 +4 -6
  115. package/lib/messaging/browser/connection.d.ts.map +1 -1
  116. package/lib/messaging/browser/connection.js +176 -45
  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 +43 -60
  121. package/lib/messaging/browser/window-connection.js.map +1 -1
  122. package/lib/messaging/client-call-metrics.d.ts +21 -0
  123. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  124. package/lib/messaging/client-call-metrics.js +95 -0
  125. package/lib/messaging/client-call-metrics.js.map +1 -0
  126. package/lib/messaging/error.d.ts +13 -3
  127. package/lib/messaging/error.d.ts.map +1 -1
  128. package/lib/messaging/error.js +25 -5
  129. package/lib/messaging/error.js.map +1 -1
  130. package/lib/messaging/handler.d.ts +10 -0
  131. package/lib/messaging/handler.d.ts.map +1 -1
  132. package/lib/messaging/handler.js +1 -1
  133. package/lib/messaging/node/connection.d.ts +1 -17
  134. package/lib/messaging/node/connection.d.ts.map +1 -1
  135. package/lib/messaging/node/connection.js +24 -60
  136. package/lib/messaging/node/connection.js.map +1 -1
  137. package/lib/messaging/proxy-factory.d.ts +3 -1
  138. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  139. package/lib/messaging/proxy-factory.js +75 -162
  140. package/lib/messaging/proxy-factory.js.map +1 -1
  141. package/lib/oss-allowlist.d.ts +14 -0
  142. package/lib/oss-allowlist.d.ts.map +1 -0
  143. package/lib/oss-allowlist.js +8 -0
  144. package/lib/oss-allowlist.js.map +1 -0
  145. package/lib/payment-protocol.d.ts +1 -1
  146. package/lib/payment-protocol.d.ts.map +1 -1
  147. package/lib/payment-protocol.js +2 -2
  148. package/lib/payment-protocol.js.map +1 -1
  149. package/lib/permission.d.ts +14 -4
  150. package/lib/permission.d.ts.map +1 -1
  151. package/lib/permission.js +45 -32
  152. package/lib/permission.js.map +1 -1
  153. package/lib/plans.d.ts +6 -5
  154. package/lib/plans.d.ts.map +1 -1
  155. package/lib/plans.js +230 -210
  156. package/lib/plans.js.map +1 -1
  157. package/lib/protocol.d.ts +261 -105
  158. package/lib/protocol.d.ts.map +1 -1
  159. package/lib/protocol.js +346 -205
  160. package/lib/protocol.js.map +1 -1
  161. package/{src/util/without.ts → lib/protocol.spec.d.ts} +3 -4
  162. package/lib/protocol.spec.d.ts.map +1 -0
  163. package/lib/protocol.spec.js +127 -0
  164. package/lib/protocol.spec.js.map +1 -0
  165. package/lib/snapshot-url.d.ts +14 -0
  166. package/lib/snapshot-url.d.ts.map +1 -0
  167. package/lib/snapshot-url.js +26 -0
  168. package/lib/snapshot-url.js.map +1 -0
  169. package/lib/snapshot-url.spec.d.ts +7 -0
  170. package/lib/snapshot-url.spec.d.ts.map +1 -0
  171. package/lib/snapshot-url.spec.js +41 -0
  172. package/lib/snapshot-url.spec.js.map +1 -0
  173. package/lib/team-subscription-protocol.d.ts +24 -5
  174. package/lib/team-subscription-protocol.d.ts.map +1 -1
  175. package/lib/team-subscription-protocol.js +36 -18
  176. package/lib/team-subscription-protocol.js.map +1 -1
  177. package/lib/teams-projects-protocol.d.ts +137 -0
  178. package/lib/teams-projects-protocol.d.ts.map +1 -0
  179. package/lib/teams-projects-protocol.js +41 -0
  180. package/lib/teams-projects-protocol.js.map +1 -0
  181. package/lib/typings/globals.d.ts +3 -3
  182. package/lib/typings/globals.d.ts.map +1 -1
  183. package/lib/typings/globals.js +1 -1
  184. package/lib/usage.d.ts +73 -0
  185. package/lib/usage.d.ts.map +1 -0
  186. package/lib/usage.js +20 -0
  187. package/lib/usage.js.map +1 -0
  188. package/lib/util/analytics.d.ts +8 -0
  189. package/lib/util/analytics.d.ts.map +1 -0
  190. package/lib/util/analytics.js +88 -0
  191. package/lib/util/analytics.js.map +1 -0
  192. package/lib/util/async-iterator.d.ts +1 -1
  193. package/lib/util/async-iterator.d.ts.map +1 -1
  194. package/lib/util/async-iterator.js +58 -136
  195. package/lib/util/async-iterator.js.map +1 -1
  196. package/lib/util/cancelable.d.ts +1 -1
  197. package/lib/util/cancelable.js +18 -60
  198. package/lib/util/cancelable.js.map +1 -1
  199. package/lib/util/date-time.d.ts +1 -1
  200. package/lib/util/date-time.js +12 -12
  201. package/lib/util/date-time.js.map +1 -1
  202. package/lib/util/debug-app.d.ts +25 -0
  203. package/lib/util/debug-app.d.ts.map +1 -0
  204. package/lib/util/debug-app.js +100 -0
  205. package/lib/util/debug-app.js.map +1 -0
  206. package/lib/util/deep-partial.d.ts +1 -1
  207. package/lib/util/deep-partial.js +1 -1
  208. package/lib/util/deferred.d.ts +1 -1
  209. package/lib/util/deferred.js +11 -13
  210. package/lib/util/deferred.js.map +1 -1
  211. package/lib/util/disposable.d.ts.map +1 -1
  212. package/lib/util/disposable.js +27 -40
  213. package/lib/util/disposable.js.map +1 -1
  214. package/lib/util/event.d.ts.map +1 -1
  215. package/lib/util/event.js +63 -77
  216. package/lib/util/event.js.map +1 -1
  217. package/lib/util/garbage-collected-cache.d.ts +2 -1
  218. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  219. package/lib/util/garbage-collected-cache.js +33 -48
  220. package/lib/util/garbage-collected-cache.js.map +1 -1
  221. package/lib/util/generate-workspace-id.d.ts +6 -1
  222. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  223. package/lib/util/generate-workspace-id.js +469 -502
  224. package/lib/util/generate-workspace-id.js.map +1 -1
  225. package/lib/util/generate-workspace-id.spec.d.ts +1 -1
  226. package/lib/util/generate-workspace-id.spec.js +69 -79
  227. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  228. package/lib/util/gitpod-cookie.d.ts +20 -0
  229. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  230. package/lib/util/gitpod-cookie.js +41 -0
  231. package/lib/util/gitpod-cookie.js.map +1 -0
  232. package/lib/util/gitpod-host-url.d.ts +12 -7
  233. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  234. package/lib/util/gitpod-host-url.js +132 -110
  235. package/lib/util/gitpod-host-url.js.map +1 -1
  236. package/lib/util/gitpod-host-url.spec.d.ts +7 -1
  237. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  238. package/lib/util/gitpod-host-url.spec.js +113 -31
  239. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  240. package/lib/util/grpc.d.ts +35 -0
  241. package/lib/util/grpc.d.ts.map +1 -0
  242. package/lib/util/grpc.js +90 -0
  243. package/lib/util/grpc.js.map +1 -0
  244. package/lib/util/jaeger-client-types.d.ts +68 -0
  245. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  246. package/lib/{theia-plugins.js → util/jaeger-client-types.js} +2 -2
  247. package/lib/util/jaeger-client-types.js.map +1 -0
  248. package/lib/util/logging.d.ts +50 -34
  249. package/lib/util/logging.d.ts.map +1 -1
  250. package/lib/util/logging.js +133 -130
  251. package/lib/util/logging.js.map +1 -1
  252. package/lib/util/logging.spec.d.ts +7 -0
  253. package/lib/util/logging.spec.d.ts.map +1 -0
  254. package/lib/util/logging.spec.js +52 -0
  255. package/lib/util/logging.spec.js.map +1 -0
  256. package/lib/util/make-link.d.ts +1 -1
  257. package/lib/util/make-link.js +6 -6
  258. package/lib/util/make-link.js.map +1 -1
  259. package/lib/util/nice-grpc.d.ts +9 -0
  260. package/lib/util/nice-grpc.d.ts.map +1 -0
  261. package/lib/util/nice-grpc.js +121 -0
  262. package/lib/util/nice-grpc.js.map +1 -0
  263. package/lib/util/parse-workspace-id.d.ts +11 -1
  264. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  265. package/lib/util/parse-workspace-id.js +31 -8
  266. package/lib/util/parse-workspace-id.js.map +1 -1
  267. package/lib/util/parse-workspace-id.spec.d.ts +5 -1
  268. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  269. package/lib/util/parse-workspace-id.spec.js +124 -85
  270. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  271. package/lib/util/queue.d.ts +1 -1
  272. package/lib/util/queue.js +17 -56
  273. package/lib/util/queue.js.map +1 -1
  274. package/lib/util/queue.spec.d.ts +1 -1
  275. package/lib/util/queue.spec.js +148 -289
  276. package/lib/util/queue.spec.js.map +1 -1
  277. package/lib/util/repeat.d.ts +15 -0
  278. package/lib/util/repeat.d.ts.map +1 -0
  279. package/lib/util/repeat.js +55 -0
  280. package/lib/util/repeat.js.map +1 -0
  281. package/lib/util/semaphore.d.ts +1 -1
  282. package/lib/util/semaphore.d.ts.map +1 -1
  283. package/lib/util/semaphore.js +16 -47
  284. package/lib/util/semaphore.js.map +1 -1
  285. package/lib/util/skip-if.d.ts +1 -1
  286. package/lib/util/skip-if.d.ts.map +1 -1
  287. package/lib/util/skip-if.js +7 -7
  288. package/lib/util/skip-if.js.map +1 -1
  289. package/lib/util/timeutil.d.ts +3 -1
  290. package/lib/util/timeutil.d.ts.map +1 -1
  291. package/lib/util/timeutil.js +30 -18
  292. package/lib/util/timeutil.js.map +1 -1
  293. package/lib/util/timeutil.spec.d.ts +3 -1
  294. package/lib/util/timeutil.spec.d.ts.map +1 -1
  295. package/lib/util/timeutil.spec.js +55 -24
  296. package/lib/util/timeutil.spec.js.map +1 -1
  297. package/lib/util/tracing.d.ts +53 -7
  298. package/lib/util/tracing.d.ts.map +1 -1
  299. package/lib/util/tracing.js +198 -65
  300. package/lib/util/tracing.js.map +1 -1
  301. package/lib/util/tracing.spec.d.ts +7 -0
  302. package/lib/util/tracing.spec.d.ts.map +1 -0
  303. package/lib/util/tracing.spec.js +121 -0
  304. package/lib/util/tracing.spec.js.map +1 -0
  305. package/lib/util/workspace-port-authentication.d.ts +8 -8
  306. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  307. package/lib/util/workspace-port-authentication.js +10 -13
  308. package/lib/util/workspace-port-authentication.js.map +1 -1
  309. package/lib/webhook-event.d.ts +44 -0
  310. package/lib/webhook-event.d.ts.map +1 -0
  311. package/lib/webhook-event.js +8 -0
  312. package/lib/webhook-event.js.map +1 -0
  313. package/lib/workspace-class.d.ts +14 -0
  314. package/lib/workspace-class.d.ts.map +1 -0
  315. package/lib/workspace-class.js +8 -0
  316. package/lib/workspace-class.js.map +1 -0
  317. package/lib/workspace-cluster.d.ts +28 -8
  318. package/lib/workspace-cluster.d.ts.map +1 -1
  319. package/lib/workspace-cluster.js +20 -5
  320. package/lib/workspace-cluster.js.map +1 -1
  321. package/lib/workspace-instance.d.ts +46 -6
  322. package/lib/workspace-instance.d.ts.map +1 -1
  323. package/lib/workspace-instance.js +1 -1
  324. package/lib/wsready.d.ts +8 -2
  325. package/lib/wsready.d.ts.map +1 -1
  326. package/lib/wsready.js +3 -3
  327. package/package.json +40 -18
  328. package/pkg-yarn.lock +23 -10
  329. package/provenance-bundle.jsonl +2 -0
  330. package/src/accounting-protocol.ts +67 -58
  331. package/src/admin-protocol.ts +88 -20
  332. package/src/analytics.ts +52 -0
  333. package/src/attribution.ts +63 -0
  334. package/src/auth.ts +3 -3
  335. package/src/billing-mode.ts +84 -0
  336. package/src/blocked-repositories-protocol.ts +13 -0
  337. package/src/context-url.spec.ts +49 -0
  338. package/src/context-url.ts +107 -0
  339. package/src/encryption/container-module.ts +3 -4
  340. package/src/encryption/encryption-engine.spec.ts +10 -9
  341. package/src/encryption/encryption-engine.ts +21 -17
  342. package/src/encryption/encryption-service.ts +5 -6
  343. package/src/encryption/key-provider.ts +17 -20
  344. package/src/env.ts +2 -25
  345. package/src/experiments/always-default.ts +24 -0
  346. package/src/experiments/configcat-server.ts +42 -0
  347. package/src/experiments/configcat.ts +56 -0
  348. package/src/experiments/types.ts +34 -0
  349. package/src/frontend-dashboard-service.ts +125 -0
  350. package/src/gitpod-file-parser.spec.ts +56 -62
  351. package/src/gitpod-file-parser.ts +17 -18
  352. package/src/gitpod-service.ts +369 -146
  353. package/src/headless-workspace-log.ts +13 -15
  354. package/src/ide-frontend-service.ts +3 -3
  355. package/src/ide-protocol.ts +147 -0
  356. package/src/index.ts +17 -11
  357. package/src/installation-admin-protocol.ts +45 -0
  358. package/src/license-protocol.ts +13 -7
  359. package/src/messaging/browser/connection.ts +187 -28
  360. package/src/messaging/browser/window-connection.ts +40 -30
  361. package/src/messaging/client-call-metrics.ts +94 -0
  362. package/src/messaging/error.ts +36 -8
  363. package/src/messaging/handler.ts +13 -1
  364. package/src/messaging/node/connection.ts +23 -70
  365. package/src/messaging/proxy-factory.ts +35 -34
  366. package/src/oss-allowlist.ts +15 -0
  367. package/src/payment-protocol.ts +3 -3
  368. package/src/permission.ts +47 -34
  369. package/src/plans.ts +250 -199
  370. package/src/protocol.spec.ts +97 -0
  371. package/src/protocol.ts +636 -293
  372. package/src/snapshot-url.spec.ts +27 -0
  373. package/src/snapshot-url.ts +27 -0
  374. package/src/team-subscription-protocol.ts +62 -23
  375. package/src/teams-projects-protocol.ts +181 -0
  376. package/src/typings/globals.ts +6 -5
  377. package/src/usage.ts +85 -0
  378. package/src/util/analytics.ts +109 -0
  379. package/src/util/async-iterator.ts +5 -6
  380. package/src/util/cancelable.ts +4 -4
  381. package/src/util/date-time.ts +9 -9
  382. package/src/util/debug-app.ts +81 -0
  383. package/src/util/deep-partial.ts +1 -1
  384. package/src/util/deferred.ts +7 -7
  385. package/src/util/disposable.ts +3 -6
  386. package/src/util/event.ts +9 -11
  387. package/src/util/garbage-collected-cache.ts +17 -9
  388. package/src/util/generate-workspace-id.spec.ts +38 -11
  389. package/src/util/generate-workspace-id.ts +465 -439
  390. package/src/util/gitpod-cookie.ts +38 -0
  391. package/src/util/gitpod-host-url.spec.ts +59 -8
  392. package/src/util/gitpod-host-url.ts +88 -48
  393. package/src/util/grpc.ts +107 -0
  394. package/src/util/jaeger-client-types.ts +102 -0
  395. package/src/util/logging.spec.ts +23 -0
  396. package/src/util/logging.ts +157 -75
  397. package/src/util/make-link.ts +7 -8
  398. package/src/util/nice-grpc.ts +96 -0
  399. package/src/util/parse-workspace-id.spec.ts +38 -9
  400. package/src/util/parse-workspace-id.ts +33 -8
  401. package/src/util/queue.spec.ts +28 -26
  402. package/src/util/queue.ts +1 -1
  403. package/src/util/repeat.ts +45 -0
  404. package/src/util/semaphore.ts +7 -9
  405. package/src/util/skip-if.ts +11 -8
  406. package/src/util/timeutil.spec.ts +41 -15
  407. package/src/util/timeutil.ts +32 -16
  408. package/src/util/tracing.spec.ts +88 -0
  409. package/src/util/tracing.ts +201 -32
  410. package/src/util/workspace-port-authentication.ts +11 -14
  411. package/src/webhook-event.ts +55 -0
  412. package/src/workspace-class.ts +14 -0
  413. package/src/workspace-cluster.ts +47 -17
  414. package/src/workspace-instance.ts +106 -32
  415. package/src/wsready.ts +11 -4
  416. package/data/builtin-theia-plugins.json +0 -372
  417. package/lib/email-protocol.d.ts +0 -50
  418. package/lib/email-protocol.d.ts.map +0 -1
  419. package/lib/email-protocol.js +0 -28
  420. package/lib/email-protocol.js.map +0 -1
  421. package/lib/messaging/connection-error-handler.d.ts +0 -27
  422. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  423. package/lib/messaging/connection-error-handler.js +0 -46
  424. package/lib/messaging/connection-error-handler.js.map +0 -1
  425. package/lib/theia-plugins.d.ts +0 -11
  426. package/lib/theia-plugins.d.ts.map +0 -1
  427. package/lib/theia-plugins.js.map +0 -1
  428. package/lib/util/context-url.d.ts +0 -13
  429. package/lib/util/context-url.d.ts.map +0 -1
  430. package/lib/util/context-url.js +0 -26
  431. package/lib/util/context-url.js.map +0 -1
  432. package/lib/util/context-url.spec.d.ts +0 -10
  433. package/lib/util/context-url.spec.d.ts.map +0 -1
  434. package/lib/util/context-url.spec.js +0 -52
  435. package/lib/util/context-url.spec.js.map +0 -1
  436. package/lib/util/repeater.d.ts +0 -22
  437. package/lib/util/repeater.d.ts.map +0 -1
  438. package/lib/util/repeater.js +0 -118
  439. package/lib/util/repeater.js.map +0 -1
  440. package/lib/util/safe-promise.d.ts +0 -11
  441. package/lib/util/safe-promise.d.ts.map +0 -1
  442. package/lib/util/safe-promise.js +0 -34
  443. package/lib/util/safe-promise.js.map +0 -1
  444. package/lib/util/without.d.ts +0 -7
  445. package/lib/util/without.d.ts.map +0 -1
  446. package/lib/util/without.js +0 -8
  447. package/lib/util/without.js.map +0 -1
  448. package/src/email-protocol.ts +0 -67
  449. package/src/messaging/connection-error-handler.ts +0 -62
  450. package/src/theia-plugins.ts +0 -11
  451. package/src/util/context-url.spec.ts +0 -25
  452. package/src/util/context-url.ts +0 -23
  453. package/src/util/jaeger-client.d.ts +0 -105
  454. package/src/util/repeater.ts +0 -49
  455. package/src/util/safe-promise.ts +0 -26
package/lib/protocol.js CHANGED
@@ -2,118 +2,221 @@
2
2
  /**
3
3
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
4
  * Licensed under the GNU Affero General Public License (AGPL).
5
- * See License-AGPL.txt in the project root for license information.
5
+ * See License.AGPL.txt in the project root for license information.
6
6
  */
7
- var __assign = (this && this.__assign) || function () {
8
- __assign = Object.assign || function(t) {
9
- for (var s, i = 1, n = arguments.length; i < n; i++) {
10
- s = arguments[i];
11
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
12
- t[p] = s[p];
13
- }
14
- return t;
15
- };
16
- return __assign.apply(this, arguments);
17
- };
18
- var __values = (this && this.__values) || function(o) {
19
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
20
- if (m) return m.call(o);
21
- if (o && typeof o.length === "number") return {
22
- next: function () {
23
- if (o && i >= o.length) o = void 0;
24
- return { value: o && o[i++], done: !o };
25
- }
26
- };
27
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
28
- };
29
- var __read = (this && this.__read) || function (o, n) {
30
- var m = typeof Symbol === "function" && o[Symbol.iterator];
31
- if (!m) return o;
32
- var i = m.call(o), r, ar = [], e;
33
- try {
34
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
35
- }
36
- catch (error) { e = { error: error }; }
37
- finally {
38
- try {
39
- if (r && !r.done && (m = i["return"])) m.call(i);
40
- }
41
- finally { if (e) throw e.error; }
42
- }
43
- return ar;
44
- };
45
7
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.TheiaPlugin = exports.AuthProviderEntry = exports.WorkspaceCreationResult = exports.CreateWorkspaceMode = exports.WorkspaceInfo = exports.WorkspaceInstancePortsChangedEvent = exports.Repository = exports.NavigatorContext = exports.IssueContext = exports.PullRequestContext = exports.CommitContext = exports.RefType = exports.WorkspaceProbeContext = exports.WithEnvvarsContext = exports.PrebuiltWorkspaceContext = exports.StartPrebuildContext = exports.SnapshotContext = exports.WithPrebuild = exports.WithSnapshot = exports.WorkspaceContext = exports.ExternalImageConfigFile = exports.ImageConfigFile = exports.ImageConfigString = exports.WorkspaceImageBuild = exports.TaskConfig = exports.PortRangeConfig = exports.PortConfig = exports.PrebuiltWorkspace = exports.WorkspaceImageSourceReference = exports.WorkspaceImageSourceDocker = exports.GithubAppPrebuildConfig = exports.Workspace = exports.Identity = exports.GitpodTokenType = exports.UserEnvVar = exports.WorkspaceFeatureFlags = exports.User = void 0;
8
+ exports.TheiaPlugin = exports.AuthProviderEntry = exports.WorkspaceCreationResult = exports.WorkspaceInfo = exports.WorkspaceInstancePortsChangedEvent = exports.Repository = exports.NavigatorContext = exports.IssueContext = exports.PullRequestContext = exports.CommitContext = exports.OpenPrebuildContext = exports.AdditionalContentContext = exports.RefType = exports.WithEnvvarsContext = exports.WithReferrerContext = exports.PrebuiltWorkspaceContext = exports.StartPrebuildContext = exports.SnapshotContext = exports.WithDefaultConfig = exports.WithPrebuild = exports.WithSnapshot = exports.WorkspaceContext = exports.ExternalImageConfigFile = exports.ImageConfigFile = exports.ImageConfigString = exports.WorkspaceImageBuild = exports.TaskConfig = exports.PortRangeConfig = exports.PortConfig = exports.PrebuiltWorkspace = exports.WorkspaceImageSourceReference = exports.WorkspaceImageSourceDocker = exports.GithubAppPrebuildConfig = exports.Workspace = exports.Identity = exports.GitpodTokenType = exports.SSHPublicKeyValue = exports.UserEnvVar = exports.NamedWorkspaceFeatureFlag = exports.WorkspaceFeatureFlags = exports.AdditionalUserData = exports.User = void 0;
9
+ const crypto_1 = require("crypto");
47
10
  var User;
48
11
  (function (User) {
49
12
  function is(data) {
50
- return data
51
- && data.hasOwnProperty('id')
52
- && data.hasOwnProperty('identities');
13
+ return data && data.hasOwnProperty("id") && data.hasOwnProperty("identities");
53
14
  }
54
15
  User.is = is;
55
16
  function getIdentity(user, authProviderId) {
56
- return user.identities.find(function (id) { return id.authProviderId === authProviderId; });
17
+ return user.identities.find((id) => id.authProviderId === authProviderId);
57
18
  }
58
19
  User.getIdentity = getIdentity;
59
20
  function censor(user) {
60
- var res = __assign({}, user);
61
- delete (res.additionalData);
62
- res.identities = res.identities.map(function (i) {
63
- delete (i.tokens);
21
+ const res = Object.assign({}, user);
22
+ delete res.additionalData;
23
+ res.identities = res.identities.map((i) => {
24
+ delete i.tokens;
64
25
  // The user field is not in the Identity shape, but actually exists on DBIdentity.
65
26
  // Trying to push this object out via JSON RPC will fail because of the cyclic nature
66
27
  // of this field.
67
- delete (i.user);
28
+ delete i.user;
68
29
  return i;
69
30
  });
70
31
  return res;
71
32
  }
72
33
  User.censor = censor;
34
+ /**
35
+ * Returns the stored email or if it doesn't exist returns the primaryEmail of the first identity this user signed up with.
36
+ * @param user
37
+ * @returns A primaryEmail, or undefined if there is none.
38
+ */
73
39
  function getPrimaryEmail(user) {
74
- var identities = user.identities.filter(function (i) { return !!i.primaryEmail; });
40
+ var _a, _b, _c, _d;
41
+ if ((_b = (_a = user.additionalData) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.emailAddress) {
42
+ return (_d = (_c = user.additionalData) === null || _c === void 0 ? void 0 : _c.profile) === null || _d === void 0 ? void 0 : _d.emailAddress;
43
+ }
44
+ const identities = user.identities.filter((i) => !!i.primaryEmail);
75
45
  if (identities.length <= 0) {
76
- throw new Error("No identity with primary email for user: " + user.id + "!");
46
+ return undefined;
77
47
  }
78
- return identities[0].primaryEmail;
48
+ return identities[0].primaryEmail || undefined;
79
49
  }
80
50
  User.getPrimaryEmail = getPrimaryEmail;
81
51
  function getName(user) {
82
- var e_1, _a;
83
- var name = user.fullName || user.name;
52
+ const name = user.fullName || user.name;
84
53
  if (name) {
85
54
  return name;
86
55
  }
87
- try {
88
- for (var _b = __values(user.identities), _c = _b.next(); !_c.done; _c = _b.next()) {
89
- var id = _c.value;
90
- if (id.authName !== "") {
91
- return id.authName;
92
- }
56
+ for (const id of user.identities) {
57
+ if (id.authName !== "") {
58
+ return id.authName;
93
59
  }
94
60
  }
95
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
96
- finally {
97
- try {
98
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
99
- }
100
- finally { if (e_1) throw e_1.error; }
101
- }
102
61
  return undefined;
103
62
  }
104
63
  User.getName = getName;
64
+ function hasPreferredIde(user) {
65
+ var _a, _b, _c, _d;
66
+ return (typeof ((_b = (_a = user === null || user === void 0 ? void 0 : user.additionalData) === null || _a === void 0 ? void 0 : _a.ideSettings) === null || _b === void 0 ? void 0 : _b.defaultIde) !== "undefined" ||
67
+ typeof ((_d = (_c = user === null || user === void 0 ? void 0 : user.additionalData) === null || _c === void 0 ? void 0 : _c.ideSettings) === null || _d === void 0 ? void 0 : _d.useLatestVersion) !== "undefined");
68
+ }
69
+ User.hasPreferredIde = hasPreferredIde;
70
+ function isOnboardingUser(user) {
71
+ return !hasPreferredIde(user);
72
+ }
73
+ User.isOnboardingUser = isOnboardingUser;
74
+ function migrationIDESettings(user) {
75
+ var _a;
76
+ if (!((_a = user === null || user === void 0 ? void 0 : user.additionalData) === null || _a === void 0 ? void 0 : _a.ideSettings) ||
77
+ Object.keys(user.additionalData.ideSettings).length === 0 ||
78
+ user.additionalData.ideSettings.settingVersion === "2.0") {
79
+ return;
80
+ }
81
+ const newIDESettings = {
82
+ settingVersion: "2.0",
83
+ };
84
+ const ideSettings = user.additionalData.ideSettings;
85
+ if (ideSettings.useDesktopIde) {
86
+ if (ideSettings.defaultDesktopIde === "code-desktop") {
87
+ newIDESettings.defaultIde = "code-desktop";
88
+ }
89
+ else if (ideSettings.defaultDesktopIde === "code-desktop-insiders") {
90
+ newIDESettings.defaultIde = "code-desktop";
91
+ newIDESettings.useLatestVersion = true;
92
+ }
93
+ else {
94
+ newIDESettings.defaultIde = ideSettings.defaultDesktopIde;
95
+ newIDESettings.useLatestVersion = ideSettings.useLatestVersion;
96
+ }
97
+ }
98
+ else {
99
+ const useLatest = ideSettings.defaultIde === "code-latest";
100
+ newIDESettings.defaultIde = "code";
101
+ newIDESettings.useLatestVersion = useLatest;
102
+ }
103
+ user.additionalData.ideSettings = newIDESettings;
104
+ }
105
+ User.migrationIDESettings = migrationIDESettings;
106
+ function getProfile(user) {
107
+ var _a, _b;
108
+ return {
109
+ name: User.getName(user) || "",
110
+ email: User.getPrimaryEmail(user) || "",
111
+ company: (_b = (_a = user === null || user === void 0 ? void 0 : user.additionalData) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.companyName,
112
+ avatarURL: user === null || user === void 0 ? void 0 : user.avatarUrl,
113
+ };
114
+ }
115
+ User.getProfile = getProfile;
116
+ function setProfile(user, profile) {
117
+ user.fullName = profile.name;
118
+ user.avatarUrl = profile.avatarURL;
119
+ if (!user.additionalData) {
120
+ user.additionalData = {};
121
+ }
122
+ if (!user.additionalData.profile) {
123
+ user.additionalData.profile = {};
124
+ }
125
+ user.additionalData.profile.emailAddress = profile.email;
126
+ user.additionalData.profile.companyName = profile.company;
127
+ user.additionalData.profile.lastUpdatedDetailsNudge = new Date().toISOString();
128
+ return user;
129
+ }
130
+ User.setProfile = setProfile;
131
+ let Profile;
132
+ (function (Profile) {
133
+ function hasChanges(before, after) {
134
+ return (before.name !== after.name ||
135
+ before.email !== after.email ||
136
+ before.company !== after.company ||
137
+ before.avatarURL !== after.avatarURL);
138
+ }
139
+ Profile.hasChanges = hasChanges;
140
+ })(Profile = User.Profile || (User.Profile = {}));
105
141
  })(User = exports.User || (exports.User = {}));
142
+ var AdditionalUserData;
143
+ (function (AdditionalUserData) {
144
+ function set(user, partialData) {
145
+ if (!user.additionalData) {
146
+ user.additionalData = Object.assign({}, partialData);
147
+ }
148
+ else {
149
+ user.additionalData = Object.assign(Object.assign({}, user.additionalData), partialData);
150
+ }
151
+ return user;
152
+ }
153
+ AdditionalUserData.set = set;
154
+ })(AdditionalUserData = exports.AdditionalUserData || (exports.AdditionalUserData = {}));
106
155
  /**
107
156
  * The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
108
157
  * If they don't we'll break things during workspace startup.
109
158
  */
110
- exports.WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
159
+ exports.WorkspaceFeatureFlags = {
160
+ full_workspace_backup: undefined,
161
+ workspace_class_limiting: undefined,
162
+ workspace_connection_limiting: undefined,
163
+ workspace_psi: undefined,
164
+ };
165
+ var NamedWorkspaceFeatureFlag;
166
+ (function (NamedWorkspaceFeatureFlag) {
167
+ NamedWorkspaceFeatureFlag.WORKSPACE_PERSISTED_FEATTURE_FLAGS = ["full_workspace_backup"];
168
+ function isWorkspacePersisted(ff) {
169
+ return NamedWorkspaceFeatureFlag.WORKSPACE_PERSISTED_FEATTURE_FLAGS.includes(ff);
170
+ }
171
+ NamedWorkspaceFeatureFlag.isWorkspacePersisted = isWorkspacePersisted;
172
+ })(NamedWorkspaceFeatureFlag = exports.NamedWorkspaceFeatureFlag || (exports.NamedWorkspaceFeatureFlag = {}));
111
173
  var UserEnvVar;
112
174
  (function (UserEnvVar) {
175
+ /**
176
+ * @param variable
177
+ * @returns Either a string containing an error message or undefined.
178
+ */
179
+ function validate(variable) {
180
+ const name = variable.name;
181
+ const pattern = variable.repositoryPattern;
182
+ if (name.trim() === "") {
183
+ return "Name must not be empty.";
184
+ }
185
+ if (name.length > 255) {
186
+ return "Name too long. Maximum name length is 255 characters.";
187
+ }
188
+ if (!/^[a-zA-Z_]+[a-zA-Z0-9_]*$/.test(name)) {
189
+ return "Name must match /^[a-zA-Z_]+[a-zA-Z0-9_]*$/.";
190
+ }
191
+ if (variable.value.trim() === "") {
192
+ return "Value must not be empty.";
193
+ }
194
+ if (variable.value.length > 32767) {
195
+ return "Value too long. Maximum value length is 32767 characters.";
196
+ }
197
+ if (pattern.trim() === "") {
198
+ return "Scope must not be empty.";
199
+ }
200
+ const split = pattern.split("/");
201
+ if (split.length < 2) {
202
+ return "A scope must use the form 'organization/repo'.";
203
+ }
204
+ for (const name of split) {
205
+ if (name !== "*") {
206
+ if (!/^[a-zA-Z0-9_\-.\*]+$/.test(name)) {
207
+ return "Invalid scope segment. Only ASCII characters, numbers, -, _, . or * are allowed.";
208
+ }
209
+ }
210
+ }
211
+ return undefined;
212
+ }
213
+ UserEnvVar.validate = validate;
214
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
113
215
  function normalizeRepoPattern(pattern) {
114
216
  return pattern.toLocaleLowerCase();
115
217
  }
116
218
  UserEnvVar.normalizeRepoPattern = normalizeRepoPattern;
219
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
117
220
  function score(value) {
118
221
  // We use a score to enforce precedence:
119
222
  // value/value = 0
@@ -122,12 +225,12 @@ var UserEnvVar;
122
225
  // */* = 3
123
226
  // #/# = 4 (used for env vars passed through the URL)
124
227
  // the lower the score, the higher the precedence.
125
- var _a = __read(splitRepositoryPattern(value.repositoryPattern), 2), ownerPattern = _a[0], repoPattern = _a[1];
126
- var score = 0;
228
+ const [ownerPattern, repoPattern] = splitRepositoryPattern(value.repositoryPattern);
229
+ let score = 0;
127
230
  if (repoPattern == "*") {
128
231
  score += 1;
129
232
  }
130
- if (ownerPattern == '*') {
233
+ if (ownerPattern == "*") {
131
234
  score += 2;
132
235
  }
133
236
  if (ownerPattern == "#" || repoPattern == "#") {
@@ -136,77 +239,106 @@ var UserEnvVar;
136
239
  return score;
137
240
  }
138
241
  UserEnvVar.score = score;
242
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
139
243
  function filter(vars, owner, repo) {
140
- var e_2, _a, e_3, _b;
141
- var result = vars.filter(function (e) {
142
- var _a = __read(splitRepositoryPattern(e.repositoryPattern), 2), ownerPattern = _a[0], repoPattern = _a[1];
143
- if (ownerPattern !== '*' && ownerPattern !== '#' && (!!owner && ownerPattern !== owner.toLocaleLowerCase())) {
244
+ let result = vars.filter((e) => {
245
+ const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
246
+ if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
144
247
  return false;
145
248
  }
146
- if (repoPattern !== '*' && repoPattern !== '#' && (!!repo && repoPattern !== repo.toLocaleLowerCase())) {
249
+ if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
147
250
  return false;
148
251
  }
149
252
  return true;
150
253
  });
151
- var resmap = new Map();
152
- result.forEach(function (e) {
153
- var l = (resmap.get(e.name) || []);
254
+ const resmap = new Map();
255
+ result.forEach((e) => {
256
+ const l = resmap.get(e.name) || [];
154
257
  l.push(e);
155
258
  resmap.set(e.name, l);
156
259
  });
157
260
  result = [];
158
- try {
159
- for (var _c = __values(resmap.keys()), _d = _c.next(); !_d.done; _d = _c.next()) {
160
- var name_1 = _d.value;
161
- var candidates = resmap.get(name_1);
162
- if (!candidates) {
163
- // not sure how this can happen, but so be it
164
- continue;
165
- }
166
- if (candidates.length == 1) {
167
- result.push(candidates[0]);
168
- continue;
169
- }
170
- var minscore = 10;
171
- var bestCandidate = void 0;
172
- try {
173
- for (var candidates_1 = (e_3 = void 0, __values(candidates)), candidates_1_1 = candidates_1.next(); !candidates_1_1.done; candidates_1_1 = candidates_1.next()) {
174
- var e = candidates_1_1.value;
175
- var score_1 = UserEnvVar.score(e);
176
- if (!bestCandidate || score_1 < minscore) {
177
- minscore = score_1;
178
- bestCandidate = e;
179
- }
180
- }
181
- }
182
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
183
- finally {
184
- try {
185
- if (candidates_1_1 && !candidates_1_1.done && (_b = candidates_1.return)) _b.call(candidates_1);
186
- }
187
- finally { if (e_3) throw e_3.error; }
188
- }
189
- result.push(bestCandidate);
261
+ for (const name of resmap.keys()) {
262
+ const candidates = resmap.get(name);
263
+ if (!candidates) {
264
+ // not sure how this can happen, but so be it
265
+ continue;
190
266
  }
191
- }
192
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
193
- finally {
194
- try {
195
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
267
+ if (candidates.length == 1) {
268
+ result.push(candidates[0]);
269
+ continue;
270
+ }
271
+ let minscore = 10;
272
+ let bestCandidate;
273
+ for (const e of candidates) {
274
+ const score = UserEnvVar.score(e);
275
+ if (!bestCandidate || score < minscore) {
276
+ minscore = score;
277
+ bestCandidate = e;
278
+ }
196
279
  }
197
- finally { if (e_2) throw e_2.error; }
280
+ result.push(bestCandidate);
198
281
  }
199
282
  return result;
200
283
  }
201
284
  UserEnvVar.filter = filter;
285
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
202
286
  function splitRepositoryPattern(repositoryPattern) {
203
- var patterns = repositoryPattern.split('/');
204
- var repoPattern = patterns.pop() || "";
205
- var ownerPattern = patterns.join('/');
287
+ const patterns = repositoryPattern.split("/");
288
+ const repoPattern = patterns.slice(1).join("/");
289
+ const ownerPattern = patterns[0];
206
290
  return [ownerPattern, repoPattern];
207
291
  }
208
292
  UserEnvVar.splitRepositoryPattern = splitRepositoryPattern;
209
293
  })(UserEnvVar = exports.UserEnvVar || (exports.UserEnvVar = {}));
294
+ var SSHPublicKeyValue;
295
+ (function (SSHPublicKeyValue) {
296
+ function validate(value) {
297
+ if (value.name.length === 0) {
298
+ return "Title must not be empty.";
299
+ }
300
+ if (value.name.length > 255) {
301
+ return "Title too long. Maximum value length is 255 characters.";
302
+ }
303
+ if (value.key.length === 0) {
304
+ return "Key must not be empty.";
305
+ }
306
+ try {
307
+ getData(value);
308
+ }
309
+ catch (e) {
310
+ return "Key is invalid. You must supply a key in OpenSSH public key format.";
311
+ }
312
+ return;
313
+ }
314
+ SSHPublicKeyValue.validate = validate;
315
+ function getData(value) {
316
+ var _a, _b, _c;
317
+ // Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'.
318
+ const regex = /^(?<type>ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-ed25519|sk-ecdsa-sha2-nistp256@openssh\.com|sk-ssh-ed25519@openssh\.com) (?<key>.*?)( (?<email>.*?))?$/;
319
+ const resultGroup = regex.exec(value.key.trim());
320
+ if (!resultGroup) {
321
+ throw new Error("Key is invalid.");
322
+ }
323
+ return {
324
+ type: (_a = resultGroup.groups) === null || _a === void 0 ? void 0 : _a["type"],
325
+ key: (_b = resultGroup.groups) === null || _b === void 0 ? void 0 : _b["key"],
326
+ email: ((_c = resultGroup.groups) === null || _c === void 0 ? void 0 : _c["email"]) || undefined,
327
+ };
328
+ }
329
+ SSHPublicKeyValue.getData = getData;
330
+ function getFingerprint(value) {
331
+ const data = getData(value);
332
+ let buf = Buffer.from(data.key, "base64");
333
+ // gitlab style
334
+ // const hash = createHash("md5").update(buf).digest("hex");
335
+ // github style
336
+ const hash = (0, crypto_1.createHash)("sha256").update(buf).digest("base64");
337
+ return hash;
338
+ }
339
+ SSHPublicKeyValue.getFingerprint = getFingerprint;
340
+ SSHPublicKeyValue.MAXIMUM_KEY_LENGTH = 5;
341
+ })(SSHPublicKeyValue = exports.SSHPublicKeyValue || (exports.SSHPublicKeyValue = {}));
210
342
  var GitpodTokenType;
211
343
  (function (GitpodTokenType) {
212
344
  GitpodTokenType[GitpodTokenType["API_AUTH_TOKEN"] = 0] = "API_AUTH_TOKEN";
@@ -215,14 +347,11 @@ var GitpodTokenType;
215
347
  var Identity;
216
348
  (function (Identity) {
217
349
  function is(data) {
218
- return data.hasOwnProperty('authProviderId')
219
- && data.hasOwnProperty('authId')
220
- && data.hasOwnProperty('authName');
350
+ return (data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName"));
221
351
  }
222
352
  Identity.is = is;
223
353
  function equals(id1, id2) {
224
- return id1.authProviderId === id2.authProviderId
225
- && id1.authId === id2.authId;
354
+ return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
226
355
  }
227
356
  Identity.equals = equals;
228
357
  })(Identity = exports.Identity || (exports.Identity = {}));
@@ -230,14 +359,14 @@ var Workspace;
230
359
  (function (Workspace) {
231
360
  function getFullRepositoryName(ws) {
232
361
  if (CommitContext.is(ws.context)) {
233
- return ws.context.repository.owner + '/' + ws.context.repository.name;
362
+ return ws.context.repository.owner + "/" + ws.context.repository.name;
234
363
  }
235
364
  return undefined;
236
365
  }
237
366
  Workspace.getFullRepositoryName = getFullRepositoryName;
238
367
  function getFullRepositoryUrl(ws) {
239
368
  if (CommitContext.is(ws.context)) {
240
- return "https://" + ws.context.repository.host + "/" + getFullRepositoryName(ws);
369
+ return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`;
241
370
  }
242
371
  return undefined;
243
372
  }
@@ -274,30 +403,28 @@ var Workspace;
274
403
  var GithubAppPrebuildConfig;
275
404
  (function (GithubAppPrebuildConfig) {
276
405
  function is(obj) {
277
- return !(typeof obj === 'boolean');
406
+ return !(typeof obj === "boolean");
278
407
  }
279
408
  GithubAppPrebuildConfig.is = is;
280
409
  })(GithubAppPrebuildConfig = exports.GithubAppPrebuildConfig || (exports.GithubAppPrebuildConfig = {}));
281
410
  var WorkspaceImageSourceDocker;
282
411
  (function (WorkspaceImageSourceDocker) {
283
412
  function is(obj) {
284
- return 'dockerFileHash' in obj
285
- && 'dockerFileSource' in obj
286
- && 'dockerFilePath' in obj;
413
+ return "dockerFileHash" in obj && "dockerFilePath" in obj;
287
414
  }
288
415
  WorkspaceImageSourceDocker.is = is;
289
416
  })(WorkspaceImageSourceDocker = exports.WorkspaceImageSourceDocker || (exports.WorkspaceImageSourceDocker = {}));
290
417
  var WorkspaceImageSourceReference;
291
418
  (function (WorkspaceImageSourceReference) {
292
419
  function is(obj) {
293
- return 'baseImageResolved' in obj;
420
+ return "baseImageResolved" in obj;
294
421
  }
295
422
  WorkspaceImageSourceReference.is = is;
296
423
  })(WorkspaceImageSourceReference = exports.WorkspaceImageSourceReference || (exports.WorkspaceImageSourceReference = {}));
297
424
  var PrebuiltWorkspace;
298
425
  (function (PrebuiltWorkspace) {
299
426
  function isDone(pws) {
300
- return pws.state === "available" || pws.state === "timeout" || pws.state === 'aborted';
427
+ return (pws.state === "available" || pws.state === "timeout" || pws.state === "aborted" || pws.state === "failed");
301
428
  }
302
429
  PrebuiltWorkspace.isDone = isDone;
303
430
  function isAvailable(pws) {
@@ -312,129 +439,123 @@ var PrebuiltWorkspace;
312
439
  var PortConfig;
313
440
  (function (PortConfig) {
314
441
  function is(config) {
315
- return config && ('port' in config) && (typeof config.port === 'number');
442
+ return config && "port" in config && typeof config.port === "number";
316
443
  }
317
444
  PortConfig.is = is;
318
445
  })(PortConfig = exports.PortConfig || (exports.PortConfig = {}));
319
446
  var PortRangeConfig;
320
447
  (function (PortRangeConfig) {
321
448
  function is(config) {
322
- return config && ('port' in config) && (typeof config.port === 'string' || config.port instanceof String);
449
+ return config && "port" in config && (typeof config.port === "string" || config.port instanceof String);
323
450
  }
324
451
  PortRangeConfig.is = is;
325
452
  })(PortRangeConfig = exports.PortRangeConfig || (exports.PortRangeConfig = {}));
326
453
  var TaskConfig;
327
454
  (function (TaskConfig) {
328
455
  function is(config) {
329
- return config
330
- && ('command' in config || 'init' in config || 'before' in config);
456
+ return config && ("command" in config || "init" in config || "before" in config);
331
457
  }
332
458
  TaskConfig.is = is;
333
459
  })(TaskConfig = exports.TaskConfig || (exports.TaskConfig = {}));
334
460
  var WorkspaceImageBuild;
335
461
  (function (WorkspaceImageBuild) {
336
- var LogLine;
462
+ let LogLine;
337
463
  (function (LogLine) {
338
- LogLine.DELIMITER = '\r\n';
464
+ LogLine.DELIMITER = "\r\n";
339
465
  LogLine.DELIMITER_REGEX = /\r?\n/;
340
466
  })(LogLine = WorkspaceImageBuild.LogLine || (WorkspaceImageBuild.LogLine = {}));
341
467
  })(WorkspaceImageBuild = exports.WorkspaceImageBuild || (exports.WorkspaceImageBuild = {}));
342
468
  var ImageConfigString;
343
469
  (function (ImageConfigString) {
344
470
  function is(config) {
345
- return typeof config === 'string';
471
+ return typeof config === "string";
346
472
  }
347
473
  ImageConfigString.is = is;
348
474
  })(ImageConfigString = exports.ImageConfigString || (exports.ImageConfigString = {}));
349
475
  var ImageConfigFile;
350
476
  (function (ImageConfigFile) {
351
477
  function is(config) {
352
- return typeof config === 'object'
353
- && 'file' in config;
478
+ return typeof config === "object" && "file" in config;
354
479
  }
355
480
  ImageConfigFile.is = is;
356
481
  })(ImageConfigFile = exports.ImageConfigFile || (exports.ImageConfigFile = {}));
357
482
  var ExternalImageConfigFile;
358
483
  (function (ExternalImageConfigFile) {
359
484
  function is(config) {
360
- return typeof config === 'object'
361
- && 'file' in config
362
- && 'externalSource' in config;
485
+ return typeof config === "object" && "file" in config && "externalSource" in config;
363
486
  }
364
487
  ExternalImageConfigFile.is = is;
365
488
  })(ExternalImageConfigFile = exports.ExternalImageConfigFile || (exports.ExternalImageConfigFile = {}));
366
489
  var WorkspaceContext;
367
490
  (function (WorkspaceContext) {
368
491
  function is(context) {
369
- return context
370
- && 'title' in context;
492
+ return context && "title" in context;
371
493
  }
372
494
  WorkspaceContext.is = is;
373
495
  })(WorkspaceContext = exports.WorkspaceContext || (exports.WorkspaceContext = {}));
374
496
  var WithSnapshot;
375
497
  (function (WithSnapshot) {
376
498
  function is(context) {
377
- return context
378
- && 'snapshotBucketId' in context;
499
+ return context && "snapshotBucketId" in context;
379
500
  }
380
501
  WithSnapshot.is = is;
381
502
  })(WithSnapshot = exports.WithSnapshot || (exports.WithSnapshot = {}));
382
503
  var WithPrebuild;
383
504
  (function (WithPrebuild) {
384
505
  function is(context) {
385
- return context
386
- && 'snapshotBucketId' in context
387
- && 'prebuildWorkspaceId' in context
388
- && 'wasPrebuilt' in context;
506
+ return context && WithSnapshot.is(context) && "prebuildWorkspaceId" in context && "wasPrebuilt" in context;
389
507
  }
390
508
  WithPrebuild.is = is;
391
509
  })(WithPrebuild = exports.WithPrebuild || (exports.WithPrebuild = {}));
510
+ var WithDefaultConfig;
511
+ (function (WithDefaultConfig) {
512
+ function is(context) {
513
+ return context && "withDefaultConfig" in context && context.withDefaultConfig;
514
+ }
515
+ WithDefaultConfig.is = is;
516
+ function mark(ctx) {
517
+ return Object.assign(Object.assign({}, ctx), { withDefaultConfig: true });
518
+ }
519
+ WithDefaultConfig.mark = mark;
520
+ })(WithDefaultConfig = exports.WithDefaultConfig || (exports.WithDefaultConfig = {}));
392
521
  var SnapshotContext;
393
522
  (function (SnapshotContext) {
394
523
  function is(context) {
395
- return context
396
- && WithSnapshot.is(context)
397
- && 'snapshotId' in context;
524
+ return context && WithSnapshot.is(context) && "snapshotId" in context;
398
525
  }
399
526
  SnapshotContext.is = is;
400
527
  })(SnapshotContext = exports.SnapshotContext || (exports.SnapshotContext = {}));
401
528
  var StartPrebuildContext;
402
529
  (function (StartPrebuildContext) {
403
530
  function is(context) {
404
- return context
405
- && 'actual' in context;
531
+ return context && "actual" in context;
406
532
  }
407
533
  StartPrebuildContext.is = is;
408
534
  })(StartPrebuildContext = exports.StartPrebuildContext || (exports.StartPrebuildContext = {}));
409
535
  var PrebuiltWorkspaceContext;
410
536
  (function (PrebuiltWorkspaceContext) {
411
537
  function is(context) {
412
- return context
413
- && 'originalContext' in context
414
- && 'prebuiltWorkspace' in context;
538
+ return context && "originalContext" in context && "prebuiltWorkspace" in context;
415
539
  }
416
540
  PrebuiltWorkspaceContext.is = is;
417
541
  })(PrebuiltWorkspaceContext = exports.PrebuiltWorkspaceContext || (exports.PrebuiltWorkspaceContext = {}));
542
+ var WithReferrerContext;
543
+ (function (WithReferrerContext) {
544
+ function is(context) {
545
+ return context && "referrer" in context;
546
+ }
547
+ WithReferrerContext.is = is;
548
+ })(WithReferrerContext = exports.WithReferrerContext || (exports.WithReferrerContext = {}));
418
549
  var WithEnvvarsContext;
419
550
  (function (WithEnvvarsContext) {
420
551
  function is(context) {
421
- return context
422
- && 'envvars' in context;
552
+ return context && "envvars" in context;
423
553
  }
424
554
  WithEnvvarsContext.is = is;
425
555
  })(WithEnvvarsContext = exports.WithEnvvarsContext || (exports.WithEnvvarsContext = {}));
426
- var WorkspaceProbeContext;
427
- (function (WorkspaceProbeContext) {
428
- function is(context) {
429
- return context
430
- && 'responseURL' in context
431
- && 'responseToken' in context;
432
- }
433
- WorkspaceProbeContext.is = is;
434
- })(WorkspaceProbeContext = exports.WorkspaceProbeContext || (exports.WorkspaceProbeContext = {}));
435
556
  var RefType;
436
557
  (function (RefType) {
437
- RefType.getRefType = function (commit) {
558
+ RefType.getRefType = (commit) => {
438
559
  if (!commit.ref) {
439
560
  return "revision";
440
561
  }
@@ -442,48 +563,78 @@ var RefType;
442
563
  return commit.refType || "branch";
443
564
  };
444
565
  })(RefType = exports.RefType || (exports.RefType = {}));
566
+ var AdditionalContentContext;
567
+ (function (AdditionalContentContext) {
568
+ function is(ctx) {
569
+ return "additionalFiles" in ctx;
570
+ }
571
+ AdditionalContentContext.is = is;
572
+ function hasDockerConfig(ctx, config) {
573
+ return is(ctx) && ImageConfigFile.is(config.image) && !!ctx.additionalFiles[config.image.file];
574
+ }
575
+ AdditionalContentContext.hasDockerConfig = hasDockerConfig;
576
+ })(AdditionalContentContext = exports.AdditionalContentContext || (exports.AdditionalContentContext = {}));
577
+ var OpenPrebuildContext;
578
+ (function (OpenPrebuildContext) {
579
+ function is(ctx) {
580
+ return "openPrebuildID" in ctx;
581
+ }
582
+ OpenPrebuildContext.is = is;
583
+ })(OpenPrebuildContext = exports.OpenPrebuildContext || (exports.OpenPrebuildContext = {}));
445
584
  var CommitContext;
585
+ (function (CommitContext) {
586
+ /**
587
+ * Creates a hash for all the commits of the CommitContext and all sub-repo commit infos.
588
+ * The hash is max 255 chars long.
589
+ * @param commitContext
590
+ * @returns hash for commitcontext
591
+ */
592
+ function computeHash(commitContext) {
593
+ // for single commits we use the revision to be backward compatible.
594
+ if (!commitContext.additionalRepositoryCheckoutInfo ||
595
+ commitContext.additionalRepositoryCheckoutInfo.length === 0) {
596
+ return commitContext.revision;
597
+ }
598
+ const hasher = (0, crypto_1.createHash)("sha256");
599
+ hasher.update(commitContext.revision);
600
+ for (const info of commitContext.additionalRepositoryCheckoutInfo) {
601
+ hasher.update(info.revision);
602
+ }
603
+ return hasher.digest("hex");
604
+ }
605
+ CommitContext.computeHash = computeHash;
606
+ })(CommitContext = exports.CommitContext || (exports.CommitContext = {}));
446
607
  (function (CommitContext) {
447
608
  function is(commit) {
448
- return WorkspaceContext.is(commit)
449
- && 'repository' in commit
450
- && 'revision' in commit;
609
+ return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
451
610
  }
452
611
  CommitContext.is = is;
453
612
  })(CommitContext = exports.CommitContext || (exports.CommitContext = {}));
454
613
  var PullRequestContext;
455
614
  (function (PullRequestContext) {
456
615
  function is(ctx) {
457
- return CommitContext.is(ctx)
458
- && 'nr' in ctx
459
- && 'ref' in ctx
460
- && 'base' in ctx;
616
+ return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
461
617
  }
462
618
  PullRequestContext.is = is;
463
619
  })(PullRequestContext = exports.PullRequestContext || (exports.PullRequestContext = {}));
464
620
  var IssueContext;
465
621
  (function (IssueContext) {
466
622
  function is(ctx) {
467
- return CommitContext.is(ctx)
468
- && 'nr' in ctx
469
- && 'ref' in ctx
470
- && 'localBranch' in ctx;
623
+ return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
471
624
  }
472
625
  IssueContext.is = is;
473
626
  })(IssueContext = exports.IssueContext || (exports.IssueContext = {}));
474
627
  var NavigatorContext;
475
628
  (function (NavigatorContext) {
476
629
  function is(ctx) {
477
- return CommitContext.is(ctx)
478
- && 'path' in ctx
479
- && 'isFile' in ctx;
630
+ return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
480
631
  }
481
632
  NavigatorContext.is = is;
482
633
  })(NavigatorContext = exports.NavigatorContext || (exports.NavigatorContext = {}));
483
634
  var Repository;
484
635
  (function (Repository) {
485
636
  function fullRepoName(repo) {
486
- return repo.host + "/" + repo.owner + "/" + repo.name;
637
+ return `${repo.host}/${repo.owner}/${repo.name}`;
487
638
  }
488
639
  Repository.fullRepoName = fullRepoName;
489
640
  })(Repository = exports.Repository || (exports.Repository = {}));
@@ -502,37 +653,27 @@ var WorkspaceInfo;
502
653
  }
503
654
  WorkspaceInfo.lastActiveISODate = lastActiveISODate;
504
655
  })(WorkspaceInfo = exports.WorkspaceInfo || (exports.WorkspaceInfo = {}));
505
- var CreateWorkspaceMode;
506
- (function (CreateWorkspaceMode) {
507
- // Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
508
- CreateWorkspaceMode["Default"] = "default";
509
- // ForceNew creates a new workspace irrespective of any running prebuilds. This mode is guaranteed to actually create a workspace - but may degrade user experience as currently runnig prebuilds are ignored.
510
- CreateWorkspaceMode["ForceNew"] = "force-new";
511
- // UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
512
- CreateWorkspaceMode["UsePrebuild"] = "use-prebuild";
513
- // SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
514
- CreateWorkspaceMode["SelectIfRunning"] = "select-if-running";
515
- })(CreateWorkspaceMode = exports.CreateWorkspaceMode || (exports.CreateWorkspaceMode = {}));
516
656
  var WorkspaceCreationResult;
517
657
  (function (WorkspaceCreationResult) {
518
658
  function is(data) {
519
- return data && ('createdWorkspaceId' in data
520
- || 'existingWorkspaces' in data
521
- || 'runningWorkspacePrebuild' in data
522
- || 'runningPrebuildWorkspaceID' in data);
659
+ return (data &&
660
+ ("createdWorkspaceId" in data ||
661
+ "existingWorkspaces" in data ||
662
+ "runningWorkspacePrebuild" in data ||
663
+ "runningPrebuildWorkspaceID" in data));
523
664
  }
524
665
  WorkspaceCreationResult.is = is;
525
666
  })(WorkspaceCreationResult = exports.WorkspaceCreationResult || (exports.WorkspaceCreationResult = {}));
526
667
  var AuthProviderEntry;
527
668
  (function (AuthProviderEntry) {
528
669
  function redact(entry) {
529
- return __assign(__assign({}, entry), { oauth: __assign(__assign({}, entry.oauth), { clientSecret: "redacted" }) });
670
+ return Object.assign(Object.assign({}, entry), { oauth: Object.assign(Object.assign({}, entry.oauth), { clientSecret: "redacted" }) });
530
671
  }
531
672
  AuthProviderEntry.redact = redact;
532
673
  })(AuthProviderEntry = exports.AuthProviderEntry || (exports.AuthProviderEntry = {}));
533
674
  var TheiaPlugin;
534
675
  (function (TheiaPlugin) {
535
- var State;
676
+ let State;
536
677
  (function (State) {
537
678
  State["Uploading"] = "uploading";
538
679
  State["Uploaded"] = "uploaded";