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