@gitpod/gitpod-protocol 0.1.5-to-code-reading.1 → 0.1.5-to-monitor-delete.18

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