@gitpod/gitpod-protocol 0.1.5-tar-telemetry-settings-data.3 → 0.1.5-tar-sh-active-users.1

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