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