@gitpod/gitpod-protocol 0.1.5-procmount.0 → 0.1.5-protected-secrets.1

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