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