@gitpod/gitpod-protocol 0.1.5-private-repos-after-cancellation.0 → 0.1.5-protected-secrets.0

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