@gitpod/gitpod-protocol 0.1.5-ps-commit-email-fork.0 → 0.1.5-release-2022.6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/data/gitpod-schema.json +206 -28
  2. package/lib/accounting-protocol.d.ts +17 -13
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +39 -47
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +21 -4
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +2 -13
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +44 -0
  11. package/lib/analytics.d.ts.map +1 -0
  12. package/lib/analytics.js +10 -0
  13. package/lib/analytics.js.map +1 -0
  14. package/lib/auth.d.ts.map +1 -1
  15. package/lib/context-url.d.ts +31 -0
  16. package/lib/context-url.d.ts.map +1 -0
  17. package/lib/context-url.js +102 -0
  18. package/lib/context-url.js.map +1 -0
  19. package/lib/{util/context-url.spec.d.ts → context-url.spec.d.ts} +4 -0
  20. package/lib/context-url.spec.d.ts.map +1 -0
  21. package/lib/context-url.spec.js +109 -0
  22. package/lib/context-url.spec.js.map +1 -0
  23. package/lib/email-protocol.d.ts +1 -2
  24. package/lib/email-protocol.d.ts.map +1 -1
  25. package/lib/email-protocol.js +4 -4
  26. package/lib/email-protocol.js.map +1 -1
  27. package/lib/encryption/container-module.d.ts.map +1 -1
  28. package/lib/encryption/container-module.js +4 -4
  29. package/lib/encryption/container-module.js.map +1 -1
  30. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  31. package/lib/encryption/encryption-engine.js +25 -26
  32. package/lib/encryption/encryption-engine.js.map +1 -1
  33. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  34. package/lib/encryption/encryption-engine.spec.js +29 -37
  35. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  36. package/lib/encryption/encryption-service.d.ts.map +1 -1
  37. package/lib/encryption/encryption-service.js +30 -44
  38. package/lib/encryption/encryption-service.js.map +1 -1
  39. package/lib/encryption/key-provider.d.ts.map +1 -1
  40. package/lib/encryption/key-provider.js +31 -38
  41. package/lib/encryption/key-provider.js.map +1 -1
  42. package/lib/env.d.ts +0 -6
  43. package/lib/env.d.ts.map +1 -1
  44. package/lib/env.js +7 -27
  45. package/lib/env.js.map +1 -1
  46. package/lib/experiments/always-default.d.ts +8 -0
  47. package/lib/experiments/always-default.d.ts.map +1 -0
  48. package/lib/experiments/always-default.js +20 -0
  49. package/lib/experiments/always-default.js.map +1 -0
  50. package/lib/experiments/configcat-server.d.ts +8 -0
  51. package/lib/experiments/configcat-server.d.ts.map +1 -0
  52. package/lib/experiments/configcat-server.js +34 -0
  53. package/lib/experiments/configcat-server.js.map +1 -0
  54. package/lib/experiments/configcat.d.ts +21 -0
  55. package/lib/experiments/configcat.d.ts.map +1 -0
  56. package/lib/experiments/configcat.js +47 -0
  57. package/lib/experiments/configcat.js.map +1 -0
  58. package/lib/experiments/types.d.ts +19 -0
  59. package/lib/experiments/types.d.ts.map +1 -0
  60. package/lib/{util/without.js → experiments/types.js} +2 -2
  61. package/lib/experiments/types.js.map +1 -0
  62. package/lib/gitpod-file-parser.d.ts.map +1 -1
  63. package/lib/gitpod-file-parser.js +26 -42
  64. package/lib/gitpod-file-parser.js.map +1 -1
  65. package/lib/gitpod-file-parser.spec.js +145 -142
  66. package/lib/gitpod-file-parser.spec.js.map +1 -1
  67. package/lib/gitpod-service.d.ts +140 -38
  68. package/lib/gitpod-service.d.ts.map +1 -1
  69. package/lib/gitpod-service.js +181 -317
  70. package/lib/gitpod-service.js.map +1 -1
  71. package/lib/headless-workspace-log.d.ts +9 -11
  72. package/lib/headless-workspace-log.d.ts.map +1 -1
  73. package/lib/headless-workspace-log.js +6 -8
  74. package/lib/headless-workspace-log.js.map +1 -1
  75. package/lib/ide-frontend-service.d.ts +1 -1
  76. package/lib/ide-protocol.d.ts +105 -0
  77. package/lib/ide-protocol.d.ts.map +1 -0
  78. package/lib/ide-protocol.js +8 -0
  79. package/lib/ide-protocol.js.map +1 -0
  80. package/lib/index.d.ts +16 -10
  81. package/lib/index.d.ts.map +1 -1
  82. package/lib/index.js +6 -0
  83. package/lib/index.js.map +1 -1
  84. package/lib/installation-admin-protocol.d.ts +30 -0
  85. package/lib/installation-admin-protocol.d.ts.map +1 -0
  86. package/lib/installation-admin-protocol.js +31 -0
  87. package/lib/installation-admin-protocol.js.map +1 -0
  88. package/lib/license-protocol.d.ts +7 -0
  89. package/lib/license-protocol.d.ts.map +1 -1
  90. package/lib/license-protocol.js.map +1 -1
  91. package/lib/messaging/browser/connection.d.ts +3 -3
  92. package/lib/messaging/browser/connection.d.ts.map +1 -1
  93. package/lib/messaging/browser/connection.js +173 -36
  94. package/lib/messaging/browser/connection.js.map +1 -1
  95. package/lib/messaging/browser/window-connection.d.ts +4 -4
  96. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  97. package/lib/messaging/browser/window-connection.js +42 -59
  98. package/lib/messaging/browser/window-connection.js.map +1 -1
  99. package/lib/messaging/client-call-metrics.d.ts +35 -0
  100. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  101. package/lib/messaging/client-call-metrics.js +83 -0
  102. package/lib/messaging/client-call-metrics.js.map +1 -0
  103. package/lib/messaging/error.d.ts +5 -1
  104. package/lib/messaging/error.d.ts.map +1 -1
  105. package/lib/messaging/error.js +10 -2
  106. package/lib/messaging/error.js.map +1 -1
  107. package/lib/messaging/handler.d.ts +10 -0
  108. package/lib/messaging/handler.d.ts.map +1 -1
  109. package/lib/messaging/handler.js +1 -1
  110. package/lib/messaging/node/connection.d.ts +1 -17
  111. package/lib/messaging/node/connection.d.ts.map +1 -1
  112. package/lib/messaging/node/connection.js +24 -60
  113. package/lib/messaging/node/connection.js.map +1 -1
  114. package/lib/messaging/proxy-factory.d.ts +3 -1
  115. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  116. package/lib/messaging/proxy-factory.js +75 -162
  117. package/lib/messaging/proxy-factory.js.map +1 -1
  118. package/lib/oss-allowlist.d.ts +14 -0
  119. package/lib/oss-allowlist.d.ts.map +1 -0
  120. package/lib/oss-allowlist.js +8 -0
  121. package/lib/oss-allowlist.js.map +1 -0
  122. package/lib/payment-protocol.d.ts.map +1 -1
  123. package/lib/payment-protocol.js +1 -1
  124. package/lib/payment-protocol.js.map +1 -1
  125. package/lib/permission.d.ts +10 -3
  126. package/lib/permission.d.ts.map +1 -1
  127. package/lib/permission.js +41 -31
  128. package/lib/permission.js.map +1 -1
  129. package/lib/plans.d.ts +4 -4
  130. package/lib/plans.d.ts.map +1 -1
  131. package/lib/plans.js +225 -209
  132. package/lib/plans.js.map +1 -1
  133. package/lib/protocol.d.ts +172 -85
  134. package/lib/protocol.d.ts.map +1 -1
  135. package/lib/protocol.js +230 -187
  136. package/lib/protocol.js.map +1 -1
  137. package/lib/snapshot-url.d.ts +14 -0
  138. package/lib/snapshot-url.d.ts.map +1 -0
  139. package/lib/snapshot-url.js +26 -0
  140. package/lib/snapshot-url.js.map +1 -0
  141. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
  142. package/lib/snapshot-url.spec.d.ts.map +1 -0
  143. package/lib/snapshot-url.spec.js +41 -0
  144. package/lib/snapshot-url.spec.js.map +1 -0
  145. package/lib/team-subscription-protocol.d.ts +22 -4
  146. package/lib/team-subscription-protocol.d.ts.map +1 -1
  147. package/lib/team-subscription-protocol.js +31 -17
  148. package/lib/team-subscription-protocol.js.map +1 -1
  149. package/lib/teams-projects-protocol.d.ts +118 -0
  150. package/lib/teams-projects-protocol.d.ts.map +1 -0
  151. package/lib/teams-projects-protocol.js +30 -0
  152. package/lib/teams-projects-protocol.js.map +1 -0
  153. package/lib/typings/globals.d.ts +2 -2
  154. package/lib/typings/globals.d.ts.map +1 -1
  155. package/lib/util/analytics.d.ts +8 -0
  156. package/lib/util/analytics.d.ts.map +1 -0
  157. package/lib/util/analytics.js +88 -0
  158. package/lib/util/analytics.js.map +1 -0
  159. package/lib/util/async-iterator.d.ts.map +1 -1
  160. package/lib/util/async-iterator.js +57 -135
  161. package/lib/util/async-iterator.js.map +1 -1
  162. package/lib/util/cancelable.js +17 -59
  163. package/lib/util/cancelable.js.map +1 -1
  164. package/lib/util/date-time.js +11 -11
  165. package/lib/util/date-time.js.map +1 -1
  166. package/lib/util/debug-app.d.ts +25 -0
  167. package/lib/util/debug-app.d.ts.map +1 -0
  168. package/lib/util/debug-app.js +100 -0
  169. package/lib/util/debug-app.js.map +1 -0
  170. package/lib/util/deferred.js +10 -12
  171. package/lib/util/deferred.js.map +1 -1
  172. package/lib/util/disposable.d.ts.map +1 -1
  173. package/lib/util/disposable.js +27 -40
  174. package/lib/util/disposable.js.map +1 -1
  175. package/lib/util/event.d.ts.map +1 -1
  176. package/lib/util/event.js +63 -77
  177. package/lib/util/event.js.map +1 -1
  178. package/lib/util/garbage-collected-cache.d.ts +1 -0
  179. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  180. package/lib/util/garbage-collected-cache.js +27 -47
  181. package/lib/util/garbage-collected-cache.js.map +1 -1
  182. package/lib/util/generate-workspace-id.d.ts +6 -1
  183. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  184. package/lib/util/generate-workspace-id.js +469 -502
  185. package/lib/util/generate-workspace-id.js.map +1 -1
  186. package/lib/util/generate-workspace-id.spec.js +68 -78
  187. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  188. package/lib/util/gitpod-cookie.d.ts +20 -0
  189. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  190. package/lib/util/gitpod-cookie.js +41 -0
  191. package/lib/util/gitpod-cookie.js.map +1 -0
  192. package/lib/util/gitpod-host-url.d.ts +1 -2
  193. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  194. package/lib/util/gitpod-host-url.js +108 -109
  195. package/lib/util/gitpod-host-url.js.map +1 -1
  196. package/lib/util/gitpod-host-url.spec.d.ts +6 -0
  197. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  198. package/lib/util/gitpod-host-url.spec.js +112 -30
  199. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  200. package/lib/util/grpc.d.ts +15 -0
  201. package/lib/util/grpc.d.ts.map +1 -0
  202. package/lib/util/grpc.js +18 -0
  203. package/lib/util/grpc.js.map +1 -0
  204. package/lib/util/jaeger-client-types.d.ts +68 -0
  205. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  206. package/lib/{theia-plugins.js → util/jaeger-client-types.js} +1 -1
  207. package/lib/util/jaeger-client-types.js.map +1 -0
  208. package/lib/util/logging.d.ts +49 -33
  209. package/lib/util/logging.d.ts.map +1 -1
  210. package/lib/util/logging.js +125 -129
  211. package/lib/util/logging.js.map +1 -1
  212. package/lib/util/make-link.js +5 -5
  213. package/lib/util/make-link.js.map +1 -1
  214. package/lib/util/parse-workspace-id.d.ts +10 -0
  215. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  216. package/lib/util/parse-workspace-id.js +30 -7
  217. package/lib/util/parse-workspace-id.js.map +1 -1
  218. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  219. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  220. package/lib/util/parse-workspace-id.spec.js +123 -84
  221. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  222. package/lib/util/queue.js +16 -55
  223. package/lib/util/queue.js.map +1 -1
  224. package/lib/util/queue.spec.js +147 -288
  225. package/lib/util/queue.spec.js.map +1 -1
  226. package/lib/util/repeat.d.ts +15 -0
  227. package/lib/util/repeat.d.ts.map +1 -0
  228. package/lib/util/repeat.js +55 -0
  229. package/lib/util/repeat.js.map +1 -0
  230. package/lib/util/semaphore.d.ts.map +1 -1
  231. package/lib/util/semaphore.js +15 -46
  232. package/lib/util/semaphore.js.map +1 -1
  233. package/lib/util/skip-if.d.ts.map +1 -1
  234. package/lib/util/skip-if.js +6 -6
  235. package/lib/util/skip-if.js.map +1 -1
  236. package/lib/util/timeutil.d.ts +1 -0
  237. package/lib/util/timeutil.d.ts.map +1 -1
  238. package/lib/util/timeutil.js +23 -17
  239. package/lib/util/timeutil.js.map +1 -1
  240. package/lib/util/timeutil.spec.d.ts.map +1 -1
  241. package/lib/util/timeutil.spec.js +21 -24
  242. package/lib/util/timeutil.spec.js.map +1 -1
  243. package/lib/util/tracing.d.ts +52 -6
  244. package/lib/util/tracing.d.ts.map +1 -1
  245. package/lib/util/tracing.js +197 -64
  246. package/lib/util/tracing.js.map +1 -1
  247. package/lib/util/tracing.spec.d.ts +7 -0
  248. package/lib/util/tracing.spec.d.ts.map +1 -0
  249. package/lib/util/tracing.spec.js +121 -0
  250. package/lib/util/tracing.spec.js.map +1 -0
  251. package/lib/util/workspace-port-authentication.d.ts +7 -7
  252. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  253. package/lib/util/workspace-port-authentication.js +9 -12
  254. package/lib/util/workspace-port-authentication.js.map +1 -1
  255. package/lib/workspace-cluster.d.ts +24 -3
  256. package/lib/workspace-cluster.d.ts.map +1 -1
  257. package/lib/workspace-cluster.js +19 -4
  258. package/lib/workspace-cluster.js.map +1 -1
  259. package/lib/workspace-instance.d.ts +42 -5
  260. package/lib/workspace-instance.d.ts.map +1 -1
  261. package/lib/wsready.d.ts +1 -1
  262. package/lib/wsready.d.ts.map +1 -1
  263. package/lib/wsready.js +2 -2
  264. package/lib/wsready.js.map +1 -1
  265. package/package.json +35 -18
  266. package/pkg-yarn.lock +20 -10
  267. package/provenance-bundle.jsonl +2 -0
  268. package/src/accounting-protocol.ts +63 -57
  269. package/src/admin-protocol.ts +43 -21
  270. package/src/analytics.ts +52 -0
  271. package/src/auth.ts +2 -2
  272. package/src/context-url.spec.ts +67 -0
  273. package/src/context-url.ts +109 -0
  274. package/src/email-protocol.ts +5 -7
  275. package/src/encryption/container-module.ts +2 -3
  276. package/src/encryption/encryption-engine.spec.ts +9 -8
  277. package/src/encryption/encryption-engine.ts +14 -14
  278. package/src/encryption/encryption-service.ts +4 -5
  279. package/src/encryption/key-provider.ts +16 -19
  280. package/src/env.ts +0 -22
  281. package/src/experiments/always-default.ts +24 -0
  282. package/src/experiments/configcat-server.ts +37 -0
  283. package/src/experiments/configcat.ts +53 -0
  284. package/src/experiments/types.ts +32 -0
  285. package/src/gitpod-file-parser.spec.ts +55 -61
  286. package/src/gitpod-file-parser.ts +16 -17
  287. package/src/gitpod-service.ts +278 -127
  288. package/src/headless-workspace-log.ts +12 -14
  289. package/src/ide-frontend-service.ts +2 -2
  290. package/src/ide-protocol.ts +119 -0
  291. package/src/index.ts +16 -10
  292. package/src/installation-admin-protocol.ts +45 -0
  293. package/src/license-protocol.ts +12 -6
  294. package/src/messaging/browser/connection.ts +185 -21
  295. package/src/messaging/browser/window-connection.ts +39 -29
  296. package/src/messaging/client-call-metrics.ts +96 -0
  297. package/src/messaging/error.ts +15 -5
  298. package/src/messaging/handler.ts +13 -1
  299. package/src/messaging/node/connection.ts +23 -70
  300. package/src/messaging/proxy-factory.ts +35 -34
  301. package/src/oss-allowlist.ts +15 -0
  302. package/src/payment-protocol.ts +2 -2
  303. package/src/permission.ts +42 -33
  304. package/src/plans.ts +236 -189
  305. package/src/protocol.ts +454 -276
  306. package/src/snapshot-url.spec.ts +27 -0
  307. package/src/snapshot-url.ts +27 -0
  308. package/src/team-subscription-protocol.ts +59 -23
  309. package/src/teams-projects-protocol.ts +153 -0
  310. package/src/typings/globals.ts +4 -4
  311. package/src/util/analytics.ts +109 -0
  312. package/src/util/async-iterator.ts +4 -5
  313. package/src/util/cancelable.ts +3 -3
  314. package/src/util/date-time.ts +8 -8
  315. package/src/util/debug-app.ts +81 -0
  316. package/src/util/deferred.ts +6 -6
  317. package/src/util/disposable.ts +3 -6
  318. package/src/util/event.ts +9 -11
  319. package/src/util/garbage-collected-cache.ts +9 -6
  320. package/src/util/generate-workspace-id.spec.ts +37 -10
  321. package/src/util/generate-workspace-id.ts +464 -438
  322. package/src/util/gitpod-cookie.ts +38 -0
  323. package/src/util/gitpod-host-url.spec.ts +58 -7
  324. package/src/util/gitpod-host-url.ts +52 -40
  325. package/src/util/grpc.ts +15 -0
  326. package/src/util/jaeger-client-types.ts +102 -0
  327. package/src/util/logging.ts +145 -72
  328. package/src/util/make-link.ts +6 -7
  329. package/src/util/parse-workspace-id.spec.ts +37 -8
  330. package/src/util/parse-workspace-id.ts +32 -7
  331. package/src/util/queue.spec.ts +27 -25
  332. package/src/util/repeat.ts +45 -0
  333. package/src/util/semaphore.ts +4 -6
  334. package/src/util/skip-if.ts +9 -6
  335. package/src/util/timeutil.spec.ts +14 -15
  336. package/src/util/timeutil.ts +21 -11
  337. package/src/util/tracing.spec.ts +88 -0
  338. package/src/util/tracing.ts +200 -31
  339. package/src/util/workspace-port-authentication.ts +10 -13
  340. package/src/workspace-cluster.ts +34 -7
  341. package/src/workspace-instance.ts +91 -31
  342. package/src/wsready.ts +3 -3
  343. package/data/builtin-theia-plugins.json +0 -372
  344. package/lib/messaging/connection-error-handler.d.ts +0 -27
  345. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  346. package/lib/messaging/connection-error-handler.js +0 -46
  347. package/lib/messaging/connection-error-handler.js.map +0 -1
  348. package/lib/theia-plugins.d.ts +0 -11
  349. package/lib/theia-plugins.d.ts.map +0 -1
  350. package/lib/theia-plugins.js.map +0 -1
  351. package/lib/util/context-url.d.ts +0 -13
  352. package/lib/util/context-url.d.ts.map +0 -1
  353. package/lib/util/context-url.js +0 -26
  354. package/lib/util/context-url.js.map +0 -1
  355. package/lib/util/context-url.spec.d.ts.map +0 -1
  356. package/lib/util/context-url.spec.js +0 -52
  357. package/lib/util/context-url.spec.js.map +0 -1
  358. package/lib/util/repeater.d.ts +0 -22
  359. package/lib/util/repeater.d.ts.map +0 -1
  360. package/lib/util/repeater.js +0 -118
  361. package/lib/util/repeater.js.map +0 -1
  362. package/lib/util/safe-promise.d.ts +0 -11
  363. package/lib/util/safe-promise.d.ts.map +0 -1
  364. package/lib/util/safe-promise.js +0 -34
  365. package/lib/util/safe-promise.js.map +0 -1
  366. package/lib/util/without.d.ts +0 -7
  367. package/lib/util/without.d.ts.map +0 -1
  368. package/lib/util/without.js.map +0 -1
  369. package/src/messaging/connection-error-handler.ts +0 -62
  370. package/src/theia-plugins.ts +0 -11
  371. package/src/util/context-url.spec.ts +0 -25
  372. package/src/util/context-url.ts +0 -23
  373. package/src/util/jaeger-client.d.ts +0 -105
  374. package/src/util/repeater.ts +0 -49
  375. package/src/util/safe-promise.ts +0 -26
package/src/protocol.ts CHANGED
@@ -6,28 +6,28 @@
6
6
 
7
7
  import { WorkspaceInstance, PortVisibility } from "./workspace-instance";
8
8
  import { RoleOrPermission } from "./permission";
9
+ import { Project } from "./teams-projects-protocol";
10
+ import { createHash } from "crypto";
9
11
 
10
12
  export interface UserInfo {
11
- name?: string
13
+ name?: string;
12
14
  }
13
15
 
14
16
  export interface User {
15
17
  /** The user id */
16
- id: string
18
+ id: string;
17
19
 
18
20
  /** The timestamp when the user entry was created */
19
- creationDate: string
21
+ creationDate: string;
20
22
 
21
- avatarUrl?: string
23
+ avatarUrl?: string;
22
24
 
23
- name?: string
25
+ name?: string;
24
26
 
25
27
  /** Optional for backwards compatibility */
26
- fullName?: string
27
-
28
- identities: Identity[]
28
+ fullName?: string;
29
29
 
30
- allowsMarketingCommunication: boolean;
30
+ identities: Identity[];
31
31
 
32
32
  /**
33
33
  * Whether the user has been blocked to use our service, because of TOS violation for example.
@@ -49,34 +49,38 @@ export interface User {
49
49
 
50
50
  export namespace User {
51
51
  export function is(data: any): data is User {
52
- return data
53
- && data.hasOwnProperty('id')
54
- && data.hasOwnProperty('identities')
52
+ return data && data.hasOwnProperty("id") && data.hasOwnProperty("identities");
55
53
  }
56
54
  export function getIdentity(user: User, authProviderId: string): Identity | undefined {
57
- return user.identities.find(id => id.authProviderId === authProviderId);
55
+ return user.identities.find((id) => id.authProviderId === authProviderId);
58
56
  }
59
57
  export function censor(user: User): User {
60
58
  const res = { ...user };
61
- delete (res.additionalData);
62
- res.identities = res.identities.map(i => {
63
- delete (i.tokens);
59
+ delete res.additionalData;
60
+ res.identities = res.identities.map((i) => {
61
+ delete i.tokens;
64
62
 
65
63
  // The user field is not in the Identity shape, but actually exists on DBIdentity.
66
64
  // Trying to push this object out via JSON RPC will fail because of the cyclic nature
67
65
  // of this field.
68
- delete ((i as any).user);
66
+ delete (i as any).user;
69
67
  return i;
70
68
  });
71
69
  return res;
72
70
  }
73
- export function getPrimaryEmail(user: User): string {
74
- const identities = user.identities.filter(i => !!i.primaryEmail);
71
+
72
+ /**
73
+ * Tries to return the primaryEmail of the first identity this user signed up with.
74
+ * @param user
75
+ * @returns A primaryEmail, or undefined if there is none.
76
+ */
77
+ export function getPrimaryEmail(user: User): string | undefined {
78
+ const identities = user.identities.filter((i) => !!i.primaryEmail);
75
79
  if (identities.length <= 0) {
76
- throw new Error(`No identity with primary email for user: ${user.id}!`);
80
+ return undefined;
77
81
  }
78
82
 
79
- return identities[0].primaryEmail!;
83
+ return identities[0].primaryEmail || undefined;
80
84
  }
81
85
  export function getName(user: User): string | undefined {
82
86
  const name = user.fullName || user.name;
@@ -91,6 +95,47 @@ export namespace User {
91
95
  }
92
96
  return undefined;
93
97
  }
98
+
99
+ export function hasPreferredIde(user: User) {
100
+ return (
101
+ typeof user?.additionalData?.ideSettings?.defaultIde !== "undefined" ||
102
+ typeof user?.additionalData?.ideSettings?.useLatestVersion !== "undefined"
103
+ );
104
+ }
105
+
106
+ export function isOnboardingUser(user: User) {
107
+ return !hasPreferredIde(user);
108
+ }
109
+
110
+ export function migrationIDESettings(user: User) {
111
+ if (
112
+ !user?.additionalData?.ideSettings ||
113
+ Object.keys(user.additionalData.ideSettings).length === 0 ||
114
+ user.additionalData.ideSettings.settingVersion === "2.0"
115
+ ) {
116
+ return;
117
+ }
118
+ const newIDESettings: IDESettings = {
119
+ settingVersion: "2.0",
120
+ };
121
+ const ideSettings = user.additionalData.ideSettings;
122
+ if (ideSettings.useDesktopIde) {
123
+ if (ideSettings.defaultDesktopIde === "code-desktop") {
124
+ newIDESettings.defaultIde = "code-desktop";
125
+ } else if (ideSettings.defaultDesktopIde === "code-desktop-insiders") {
126
+ newIDESettings.defaultIde = "code-desktop";
127
+ newIDESettings.useLatestVersion = true;
128
+ } else {
129
+ newIDESettings.defaultIde = ideSettings.defaultDesktopIde;
130
+ newIDESettings.useLatestVersion = ideSettings.useLatestVersion;
131
+ }
132
+ } else {
133
+ const useLatest = ideSettings.defaultIde === "code-latest";
134
+ newIDESettings.defaultIde = "code";
135
+ newIDESettings.useLatestVersion = useLatest;
136
+ }
137
+ user.additionalData.ideSettings = newIDESettings;
138
+ }
94
139
  }
95
140
 
96
141
  export interface AdditionalUserData {
@@ -99,16 +144,32 @@ export interface AdditionalUserData {
99
144
  featurePreview?: boolean;
100
145
  ideSettings?: IDESettings;
101
146
  // key is the name of the news, string the iso date when it was seen
102
- whatsNewSeen?: { [key: string]: string }
147
+ whatsNewSeen?: { [key: string]: string };
148
+ // key is the name of the OAuth client i.e. local app, string the iso date when it was approved
149
+ // TODO(rl): provide a management UX to allow rescinding of approval
150
+ oauthClientsApproved?: { [key: string]: string };
151
+ // to remember GH Orgs the user installed/updated the GH App for
152
+ knownGitHubOrgs?: string[];
153
+
154
+ // Git clone URL pointing to the user's dotfile repo
155
+ dotfileRepo?: string;
103
156
  }
104
157
 
105
158
  export interface EmailNotificationSettings {
106
- disallowTransactionalEmails?: boolean;
159
+ allowsChangelogMail?: boolean;
160
+ allowsDevXMail?: boolean;
161
+ allowsOnboardingMail?: boolean;
107
162
  }
108
163
 
109
164
  export type IDESettings = {
110
- defaultIde?: string
111
- }
165
+ settingVersion?: string;
166
+ defaultIde?: string;
167
+ // DEPRECATED: Use defaultIde after `settingVersion: 2.0`, no more specialify desktop or browser.
168
+ useDesktopIde?: boolean;
169
+ // DEPRECATED: Same with useDesktopIde.
170
+ defaultDesktopIde?: string;
171
+ useLatestVersion?: boolean;
172
+ };
112
173
 
113
174
  export interface UserPlatform {
114
175
  uid: string;
@@ -129,14 +190,6 @@ export interface UserPlatform {
129
190
  }
130
191
 
131
192
  export interface UserFeatureSettings {
132
- /**
133
- * This field is used as marker to grant users a free trial for using private repositories,
134
- * independent of any subscription or Chargebee.
135
- * - it is set when the user uses their first private repo
136
- * - whether the trial is expired or not is juged by the UserService
137
- */
138
- privateRepoTrialStartDate?: string;
139
-
140
193
  /**
141
194
  * Permanent feature flags are added to each and every workspace instance
142
195
  * this user starts.
@@ -148,15 +201,30 @@ export interface UserFeatureSettings {
148
201
  * The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
149
202
  * If they don't we'll break things during workspace startup.
150
203
  */
151
- export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
152
- export type NamedWorkspaceFeatureFlag = keyof (typeof WorkspaceFeatureFlags);
153
-
154
- export interface UserEnvVarValue {
155
- id?: string;
204
+ export const WorkspaceFeatureFlags = {
205
+ full_workspace_backup: undefined,
206
+ fixed_resources: undefined,
207
+ persistent_volume_claim: undefined,
208
+ };
209
+ export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
210
+
211
+ export interface EnvVarWithValue {
156
212
  name: string;
157
- repositoryPattern: string;
158
213
  value: string;
159
214
  }
215
+
216
+ export interface ProjectEnvVarWithValue extends EnvVarWithValue {
217
+ id: string;
218
+ projectId: string;
219
+ censored: boolean;
220
+ }
221
+
222
+ export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, "value">;
223
+
224
+ export interface UserEnvVarValue extends EnvVarWithValue {
225
+ id?: string;
226
+ repositoryPattern: string; // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
227
+ }
160
228
  export interface UserEnvVar extends UserEnvVarValue {
161
229
  id: string;
162
230
  userId: string;
@@ -164,11 +232,51 @@ export interface UserEnvVar extends UserEnvVarValue {
164
232
  }
165
233
 
166
234
  export namespace UserEnvVar {
235
+ /**
236
+ * @param variable
237
+ * @returns Either a string containing an error message or undefined.
238
+ */
239
+ export function validate(variable: UserEnvVarValue): string | undefined {
240
+ const name = variable.name;
241
+ const pattern = variable.repositoryPattern;
242
+ if (name.trim() === "") {
243
+ return "Name must not be empty.";
244
+ }
245
+ if (name.length > 255) {
246
+ return "Name too long. Maximum name length is 255 characters.";
247
+ }
248
+ if (!/^[a-zA-Z_]+[a-zA-Z0-9_]*$/.test(name)) {
249
+ return "Name must match /^[a-zA-Z_]+[a-zA-Z0-9_]*$/.";
250
+ }
251
+ if (variable.value.trim() === "") {
252
+ return "Value must not be empty.";
253
+ }
254
+ if (variable.value.length > 32767) {
255
+ return "Value too long. Maximum value length is 32767 characters.";
256
+ }
257
+ if (pattern.trim() === "") {
258
+ return "Scope must not be empty.";
259
+ }
260
+ const split = pattern.split("/");
261
+ if (split.length < 2) {
262
+ return "A scope must use the form 'organization/repo'.";
263
+ }
264
+ for (const name of split) {
265
+ if (name !== "*") {
266
+ if (!/^[a-zA-Z0-9_\-.\*]+$/.test(name)) {
267
+ return "Invalid scope segment. Only ASCII characters, numbers, -, _, . or * are allowed.";
268
+ }
269
+ }
270
+ }
271
+ return undefined;
272
+ }
167
273
 
274
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
168
275
  export function normalizeRepoPattern(pattern: string) {
169
276
  return pattern.toLocaleLowerCase();
170
277
  }
171
278
 
279
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
172
280
  export function score(value: UserEnvVarValue): number {
173
281
  // We use a score to enforce precedence:
174
282
  // value/value = 0
@@ -182,7 +290,7 @@ export namespace UserEnvVar {
182
290
  if (repoPattern == "*") {
183
291
  score += 1;
184
292
  }
185
- if (ownerPattern == '*') {
293
+ if (ownerPattern == "*") {
186
294
  score += 2;
187
295
  }
188
296
  if (ownerPattern == "#" || repoPattern == "#") {
@@ -191,21 +299,22 @@ export namespace UserEnvVar {
191
299
  return score;
192
300
  }
193
301
 
302
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
194
303
  export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
195
- let result = vars.filter(e => {
304
+ let result = vars.filter((e) => {
196
305
  const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
197
- if (ownerPattern !== '*' && ownerPattern !== '#' && (!!owner && ownerPattern !== owner.toLocaleLowerCase())) {
306
+ if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
198
307
  return false;
199
308
  }
200
- if (repoPattern !== '*' && repoPattern !== '#' && (!!repo && repoPattern !== repo.toLocaleLowerCase())) {
309
+ if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
201
310
  return false;
202
311
  }
203
312
  return true;
204
313
  });
205
314
 
206
315
  const resmap = new Map<string, T[]>();
207
- result.forEach(e => {
208
- const l = (resmap.get(e.name) || []);
316
+ result.forEach((e) => {
317
+ const l = resmap.get(e.name) || [];
209
318
  l.push(e);
210
319
  resmap.set(e.name, l);
211
320
  });
@@ -238,47 +347,47 @@ export namespace UserEnvVar {
238
347
  return result;
239
348
  }
240
349
 
350
+ // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
241
351
  export function splitRepositoryPattern(repositoryPattern: string): string[] {
242
- const patterns = repositoryPattern.split('/');
243
- const repoPattern = patterns.pop() || "";
244
- const ownerPattern = patterns.join('/');
352
+ const patterns = repositoryPattern.split("/");
353
+ const repoPattern = patterns.slice(1).join("/");
354
+ const ownerPattern = patterns[0];
245
355
  return [ownerPattern, repoPattern];
246
356
  }
247
357
  }
248
358
 
249
359
  export interface GitpodToken {
250
-
251
360
  /** Hash value (SHA256) of the token (primary key). */
252
- tokenHash: string
361
+ tokenHash: string;
253
362
 
254
363
  /** Human readable name of the token */
255
- name?: string
364
+ name?: string;
256
365
 
257
366
  /** Token kind */
258
- type: GitpodTokenType
367
+ type: GitpodTokenType;
259
368
 
260
369
  /** The user the token belongs to. */
261
- user: User
370
+ user: User;
262
371
 
263
372
  /** Scopes (e.g. limition to read-only) */
264
- scopes: string[]
373
+ scopes: string[];
265
374
 
266
375
  /** Created timestamp */
267
- created: string
376
+ created: string;
268
377
 
269
378
  // token is deleted on the database and about to be collected by db-sync
270
- deleted?: boolean
379
+ deleted?: boolean;
271
380
  }
272
381
 
273
382
  export enum GitpodTokenType {
274
383
  API_AUTH_TOKEN = 0,
275
- MACHINE_AUTH_TOKEN = 1
384
+ MACHINE_AUTH_TOKEN = 1,
276
385
  }
277
386
 
278
387
  export interface OneTimeSecret {
279
- id: string
388
+ id: string;
280
389
 
281
- value: string
390
+ value: string;
282
391
 
283
392
  expirationTime: string;
284
393
 
@@ -298,7 +407,6 @@ export interface Identity {
298
407
  authId: string;
299
408
  authName: string;
300
409
  primaryEmail?: string;
301
- commitEmail?: string;
302
410
  /** @deprecated */
303
411
  tokens?: Token[];
304
412
  /** This is a flag that triggers the HARD DELETION of this entity */
@@ -311,13 +419,12 @@ export type IdentityLookup = Pick<Identity, "authProviderId" | "authId">;
311
419
 
312
420
  export namespace Identity {
313
421
  export function is(data: any): data is Identity {
314
- return data.hasOwnProperty('authProviderId')
315
- && data.hasOwnProperty('authId')
316
- && data.hasOwnProperty('authName')
422
+ return (
423
+ data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName")
424
+ );
317
425
  }
318
426
  export function equals(id1: IdentityLookup, id2: IdentityLookup) {
319
- return id1.authProviderId === id2.authProviderId
320
- && id1.authId === id2.authId
427
+ return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
321
428
  }
322
429
  }
323
430
 
@@ -373,11 +480,23 @@ export interface PendingGithubEvent {
373
480
  export interface Snapshot {
374
481
  id: string;
375
482
  creationTime: string;
483
+ availableTime?: string;
376
484
  originalWorkspaceId: string;
377
485
  bucketId: string;
378
486
  layoutData?: string;
487
+ state: SnapshotState;
488
+ message?: string;
489
+ }
490
+
491
+ export interface VolumeSnapshot {
492
+ id: string;
493
+ workspaceId: string;
494
+ creationTime: string;
495
+ volumeHandle: string;
379
496
  }
380
497
 
498
+ export type SnapshotState = "pending" | "available" | "error";
499
+
381
500
  export interface LayoutData {
382
501
  workspaceId: string;
383
502
  lastUpdatedTime: string;
@@ -390,6 +509,7 @@ export interface Workspace {
390
509
  contextURL: string;
391
510
  description: string;
392
511
  ownerId: string;
512
+ projectId?: string;
393
513
  context: WorkspaceContext;
394
514
  config: WorkspaceConfig;
395
515
 
@@ -404,13 +524,13 @@ export interface Workspace {
404
524
  * The resolved, fix name of the workspace image. We only use this
405
525
  * to access the logs during an image build.
406
526
  */
407
- imageNameResolved?: string
527
+ imageNameResolved?: string;
408
528
 
409
529
  /**
410
530
  * The resolved/built fixed named of the base image. This field is only set if the workspace
411
531
  * already has its base image built.
412
532
  */
413
- baseImageNameResolved?: string
533
+ baseImageNameResolved?: string;
414
534
 
415
535
  shareable?: boolean;
416
536
  pinned?: boolean;
@@ -447,17 +567,16 @@ export type WorkspaceSoftDeletion = "user" | "gc";
447
567
  export type WorkspaceType = "regular" | "prebuild" | "probe";
448
568
 
449
569
  export namespace Workspace {
450
-
451
570
  export function getFullRepositoryName(ws: Workspace): string | undefined {
452
571
  if (CommitContext.is(ws.context)) {
453
- return ws.context.repository.owner + '/' + ws.context.repository.name
572
+ return ws.context.repository.owner + "/" + ws.context.repository.name;
454
573
  }
455
574
  return undefined;
456
575
  }
457
576
 
458
577
  export function getFullRepositoryUrl(ws: Workspace): string | undefined {
459
578
  if (CommitContext.is(ws.context)) {
460
- return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`
579
+ return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`;
461
580
  }
462
581
  return undefined;
463
582
  }
@@ -491,59 +610,50 @@ export namespace Workspace {
491
610
  }
492
611
  }
493
612
 
494
- export interface PreparePluginUploadParams {
495
- fullPluginName: string;
496
- }
497
-
498
- export interface ResolvePluginsParams {
499
- config?: WorkspaceConfig
500
- builtins?: ResolvedPlugins
501
- vsxRegistryUrl?: string
502
- }
503
-
504
- export interface InstallPluginsParams {
505
- pluginIds: string[]
506
- }
507
-
508
- export interface UninstallPluginParams {
509
- pluginId: string;
510
- }
511
-
512
613
  export interface GuessGitTokenScopesParams {
513
- host: string
514
- repoUrl: string
515
- gitCommand: string
516
- currentToken: GitToken
614
+ host: string;
615
+ repoUrl: string;
616
+ gitCommand: string;
617
+ currentToken: GitToken;
517
618
  }
518
619
 
519
620
  export interface GitToken {
520
- token: string
521
- user: string
522
- scopes: string[]
621
+ token: string;
622
+ user: string;
623
+ scopes: string[];
523
624
  }
524
625
 
525
626
  export interface GuessedGitTokenScopes {
526
- message?: string
527
- scopes?: string[]
627
+ message?: string;
628
+ scopes?: string[];
528
629
  }
529
630
 
530
- export type ResolvedPluginKind = 'user' | 'workspace' | 'builtin';
531
-
532
- export interface ResolvedPlugins {
533
- [pluginId: string]: ResolvedPlugin | undefined
631
+ export interface VSCodeConfig {
632
+ extensions?: string[];
534
633
  }
535
634
 
536
- export interface ResolvedPlugin {
537
- fullPluginName: string;
538
- url: string;
539
- kind: ResolvedPluginKind;
635
+ export interface JetBrainsConfig {
636
+ intellij?: JetBrainsProductConfig;
637
+ goland?: JetBrainsProductConfig;
638
+ pycharm?: JetBrainsProductConfig;
639
+ phpstorm?: JetBrainsProductConfig;
640
+ }
641
+ export interface JetBrainsProductConfig {
642
+ prebuilds?: JetBrainsPrebuilds;
643
+ vmoptions?: string;
644
+ }
645
+ export interface JetBrainsPrebuilds {
646
+ version?: "stable" | "latest" | "both";
540
647
  }
541
648
 
542
- export interface VSCodeConfig {
543
- extensions?: string[];
649
+ export interface RepositoryCloneInformation {
650
+ url: string;
651
+ checkoutLocation?: string;
544
652
  }
545
653
 
546
654
  export interface WorkspaceConfig {
655
+ mainConfiguration?: string;
656
+ additionalRepositories?: RepositoryCloneInformation[];
547
657
  image?: ImageConfig;
548
658
  ports?: PortConfig[];
549
659
  tasks?: TaskConfig[];
@@ -552,16 +662,22 @@ export interface WorkspaceConfig {
552
662
  gitConfig?: { [config: string]: string };
553
663
  github?: GithubAppConfig;
554
664
  vscode?: VSCodeConfig;
665
+ jetbrains?: JetBrainsConfig;
666
+
667
+ /** deprecated. Enabled by default **/
668
+ experimentalNetwork?: boolean;
555
669
 
556
670
  /**
557
671
  * Where the config object originates from.
558
672
  *
559
673
  * repo - from the repository
674
+ * project-db - from the "Project" stored in the database
560
675
  * definitly-gp - from github.com/gitpod-io/definitely-gp
561
676
  * derived - computed based on analyzing the repository
677
+ * additional-content - config comes from additional content, usually provided through the project's configuration
562
678
  * default - our static catch-all default config
563
679
  */
564
- _origin?: 'repo' | 'definitely-gp' | 'derived' | 'default';
680
+ _origin?: "repo" | "project-db" | "definitely-gp" | "derived" | "additional-content" | "default";
565
681
 
566
682
  /**
567
683
  * Set of automatically infered feature flags. That's not something the user can set, but
@@ -571,37 +687,33 @@ export interface WorkspaceConfig {
571
687
  }
572
688
 
573
689
  export interface GithubAppConfig {
574
- prebuilds?: GithubAppPrebuildConfig
690
+ prebuilds?: GithubAppPrebuildConfig;
575
691
  }
576
692
  export interface GithubAppPrebuildConfig {
577
- master?: boolean
578
- branches?: boolean
579
- pullRequests?: boolean
580
- pullRequestsFromForks?: boolean
581
- addCheck?: boolean
582
- addBadge?: boolean
583
- addLabel?: boolean | string
584
- addComment?: boolean
693
+ master?: boolean;
694
+ branches?: boolean;
695
+ pullRequests?: boolean;
696
+ pullRequestsFromForks?: boolean;
697
+ addCheck?: boolean | "prevent-merge-on-error";
698
+ addBadge?: boolean;
699
+ addLabel?: boolean | string;
700
+ addComment?: boolean;
585
701
  }
586
702
  export namespace GithubAppPrebuildConfig {
587
703
  export function is(obj: boolean | GithubAppPrebuildConfig): obj is GithubAppPrebuildConfig {
588
- return !(typeof obj === 'boolean');
704
+ return !(typeof obj === "boolean");
589
705
  }
590
706
  }
591
707
 
592
708
  export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
593
709
  export interface WorkspaceImageSourceDocker {
594
- // TODO: clean this up. We should have the commit and an ImageSource in here, not duplicate the whole thing again.
595
- // We have a ton of those objects in the database, thus cleaning this up means lengthy DB migrations. Yuck.
596
- dockerFileHash: string
597
- dockerFileSource: Commit
598
- dockerFilePath: string
710
+ dockerFilePath: string;
711
+ dockerFileHash: string;
712
+ dockerFileSource?: Commit;
599
713
  }
600
714
  export namespace WorkspaceImageSourceDocker {
601
715
  export function is(obj: object): obj is WorkspaceImageSourceDocker {
602
- return 'dockerFileHash' in obj
603
- && 'dockerFileSource' in obj
604
- && 'dockerFilePath' in obj;
716
+ return "dockerFileHash" in obj && "dockerFilePath" in obj;
605
717
  }
606
718
  }
607
719
  export interface WorkspaceImageSourceReference {
@@ -610,36 +722,43 @@ export interface WorkspaceImageSourceReference {
610
722
  }
611
723
  export namespace WorkspaceImageSourceReference {
612
724
  export function is(obj: object): obj is WorkspaceImageSourceReference {
613
- return 'baseImageResolved' in obj;
725
+ return "baseImageResolved" in obj;
614
726
  }
615
727
  }
616
728
 
617
- export type PrebuiltWorkspaceState
729
+ export type PrebuiltWorkspaceState =
618
730
  // the prebuild is queued and may start at anytime
619
- = "queued"
731
+ | "queued"
620
732
  // the workspace prebuild is currently running (i.e. there's a workspace pod deployed)
621
733
  | "building"
622
- // the prebuild failed due to some issue with the system (e.g. missed a message, could not start workspace)
734
+ // the prebuild was aborted
623
735
  | "aborted"
624
736
  // the prebuild timed out
625
737
  | "timeout"
626
- // the prebuild has finished and a snapshot is available
627
- | "available";
738
+ // the prebuild has finished (even if a headless task failed) and a snapshot is available
739
+ | "available"
740
+ // the prebuild (headless workspace) failed due to some system error
741
+ | "failed";
628
742
 
629
743
  export interface PrebuiltWorkspace {
630
744
  id: string;
631
745
  cloneURL: string;
746
+ branch?: string;
747
+ projectId?: string;
632
748
  commit: string;
633
749
  buildWorkspaceId: string;
634
750
  creationTime: string;
635
751
  state: PrebuiltWorkspaceState;
752
+ statusVersion: number;
636
753
  error?: string;
637
754
  snapshot?: string;
638
755
  }
639
756
 
640
757
  export namespace PrebuiltWorkspace {
641
758
  export function isDone(pws: PrebuiltWorkspace) {
642
- return pws.state === "available" || pws.state === "timeout" || pws.state === 'aborted';
759
+ return (
760
+ pws.state === "available" || pws.state === "timeout" || pws.state === "aborted" || pws.state === "failed"
761
+ );
643
762
  }
644
763
 
645
764
  export function isAvailable(pws: PrebuiltWorkspace) {
@@ -658,27 +777,33 @@ export interface PrebuiltWorkspaceUpdatable {
658
777
  repo: string;
659
778
  isResolved: boolean;
660
779
  installationId: string;
780
+ /**
781
+ * the commitSHA of the commit that triggered the prebuild
782
+ */
783
+ commitSHA?: string;
661
784
  issue?: string;
662
785
  contextUrl?: string;
663
786
  }
664
787
 
665
788
  export interface WhitelistedRepository {
666
- url: string
667
- name: string
668
- description?: string
669
- avatar?: string
789
+ url: string;
790
+ name: string;
791
+ description?: string;
792
+ avatar?: string;
670
793
  }
671
794
 
672
- export type PortOnOpen = 'open-browser' | 'open-preview' | 'notify' | 'ignore';
795
+ export type PortOnOpen = "open-browser" | "open-preview" | "notify" | "ignore";
673
796
 
674
797
  export interface PortConfig {
675
798
  port: number;
676
799
  onOpen?: PortOnOpen;
677
800
  visibility?: PortVisibility;
801
+ description?: string;
802
+ name?: string;
678
803
  }
679
804
  export namespace PortConfig {
680
805
  export function is(config: any): config is PortConfig {
681
- return config && ('port' in config) && (typeof config.port === 'number');
806
+ return config && "port" in config && typeof config.port === "number";
682
807
  }
683
808
  }
684
809
 
@@ -688,7 +813,7 @@ export interface PortRangeConfig {
688
813
  }
689
814
  export namespace PortRangeConfig {
690
815
  export function is(config: any): config is PortRangeConfig {
691
- return config && ('port' in config) && (typeof config.port === 'string' || config.port instanceof String);
816
+ return config && "port" in config && (typeof config.port === "string" || config.port instanceof String);
692
817
  }
693
818
  }
694
819
 
@@ -698,33 +823,32 @@ export interface TaskConfig {
698
823
  init?: string;
699
824
  prebuild?: string;
700
825
  command?: string;
701
- env?: { [env: string]: string };
702
- openIn?: 'bottom' | 'main' | 'left' | 'right';
703
- openMode?: 'split-top' | 'split-left' | 'split-right' | 'split-bottom' | 'tab-before' | 'tab-after';
826
+ env?: { [env: string]: any };
827
+ openIn?: "bottom" | "main" | "left" | "right";
828
+ openMode?: "split-top" | "split-left" | "split-right" | "split-bottom" | "tab-before" | "tab-after";
704
829
  }
705
830
 
706
831
  export namespace TaskConfig {
707
832
  export function is(config: any): config is TaskConfig {
708
- return config
709
- && ('command' in config || 'init' in config || 'before' in config);
833
+ return config && ("command" in config || "init" in config || "before" in config);
710
834
  }
711
835
  }
712
836
 
713
837
  export namespace WorkspaceImageBuild {
714
- export type Phase = 'BaseImage' | 'GitpodLayer' | 'Error' | 'Done';
838
+ export type Phase = "BaseImage" | "GitpodLayer" | "Error" | "Done";
715
839
  export interface StateInfo {
716
- phase: Phase
717
- currentStep?: number
718
- maxSteps?: number
840
+ phase: Phase;
841
+ currentStep?: number;
842
+ maxSteps?: number;
719
843
  }
720
844
  export interface LogContent {
721
- text: string
722
- upToLine?: number
723
- isDiff?: boolean
845
+ text: string;
846
+ upToLine?: number;
847
+ isDiff?: boolean;
724
848
  }
725
849
  export type LogCallback = (info: StateInfo, content: LogContent | undefined) => void;
726
850
  export namespace LogLine {
727
- export const DELIMITER = '\r\n';
851
+ export const DELIMITER = "\r\n";
728
852
  export const DELIMITER_REGEX = /\r?\n/;
729
853
  }
730
854
  }
@@ -733,20 +857,18 @@ export type ImageConfig = ImageConfigString | ImageConfigFile;
733
857
  export type ImageConfigString = string;
734
858
  export namespace ImageConfigString {
735
859
  export function is(config: ImageConfig | undefined): config is ImageConfigString {
736
- return typeof config === 'string';
860
+ return typeof config === "string";
737
861
  }
738
-
739
862
  }
740
863
  export interface ImageConfigFile {
741
864
  // Path to the Dockerfile relative to repository root
742
- file: string,
865
+ file: string;
743
866
  // Path to the docker build context relative to repository root
744
- context?: string
867
+ context?: string;
745
868
  }
746
869
  export namespace ImageConfigFile {
747
870
  export function is(config: ImageConfig | undefined): config is ImageConfigFile {
748
- return typeof config === 'object'
749
- && 'file' in config;
871
+ return typeof config === "object" && "file" in config;
750
872
  }
751
873
  }
752
874
  export interface ExternalImageConfigFile extends ImageConfigFile {
@@ -754,22 +876,22 @@ export interface ExternalImageConfigFile extends ImageConfigFile {
754
876
  }
755
877
  export namespace ExternalImageConfigFile {
756
878
  export function is(config: any | undefined): config is ExternalImageConfigFile {
757
- return typeof config === 'object'
758
- && 'file' in config
759
- && 'externalSource' in config;
879
+ return typeof config === "object" && "file" in config && "externalSource" in config;
760
880
  }
761
881
  }
762
882
 
763
883
  export interface WorkspaceContext {
764
884
  title: string;
885
+ ref?: string;
886
+ /** This contains the URL portion of the contextURL (which might contain other modifiers as well). It's optional because it's not set for older workspaces. */
765
887
  normalizedContextURL?: string;
766
888
  forceCreateNewWorkspace?: boolean;
889
+ forceImageBuild?: boolean;
767
890
  }
768
891
 
769
892
  export namespace WorkspaceContext {
770
893
  export function is(context: any): context is WorkspaceContext {
771
- return context
772
- && 'title' in context;
894
+ return context && "title" in context;
773
895
  }
774
896
  }
775
897
 
@@ -778,22 +900,38 @@ export interface WithSnapshot {
778
900
  }
779
901
  export namespace WithSnapshot {
780
902
  export function is(context: any): context is WithSnapshot {
781
- return context
782
- && 'snapshotBucketId' in context;
903
+ return context && "snapshotBucketId" in context;
783
904
  }
784
905
  }
785
906
 
786
- export interface WithPrebuild {
787
- snapshotBucketId: string;
907
+ export interface WithPrebuild extends WithSnapshot {
788
908
  prebuildWorkspaceId: string;
789
909
  wasPrebuilt: true;
790
910
  }
791
911
  export namespace WithPrebuild {
792
912
  export function is(context: any): context is WithPrebuild {
793
- return context
794
- && 'snapshotBucketId' in context
795
- && 'prebuildWorkspaceId' in context
796
- && 'wasPrebuilt' in context;
913
+ return context && WithSnapshot.is(context) && "prebuildWorkspaceId" in context && "wasPrebuilt" in context;
914
+ }
915
+ }
916
+
917
+ /**
918
+ * WithDefaultConfig contexts disable the download of the gitpod.yml from the repository
919
+ * and fall back to the built-in configuration.
920
+ */
921
+ export interface WithDefaultConfig {
922
+ withDefaultConfig: true;
923
+ }
924
+
925
+ export namespace WithDefaultConfig {
926
+ export function is(context: any): context is WithDefaultConfig {
927
+ return context && "withDefaultConfig" in context && context.withDefaultConfig;
928
+ }
929
+
930
+ export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
931
+ return {
932
+ ...ctx,
933
+ withDefaultConfig: true,
934
+ };
797
935
  }
798
936
  }
799
937
 
@@ -803,20 +941,24 @@ export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
803
941
 
804
942
  export namespace SnapshotContext {
805
943
  export function is(context: any): context is SnapshotContext {
806
- return context
807
- && WithSnapshot.is(context)
808
- && 'snapshotId' in context;
944
+ return context && WithSnapshot.is(context) && "snapshotId" in context;
809
945
  }
810
946
  }
811
947
 
812
948
  export interface StartPrebuildContext extends WorkspaceContext {
813
949
  actual: WorkspaceContext;
950
+ commitHistory?: string[];
951
+ additionalRepositoryCommitHistories?: {
952
+ cloneUrl: string;
953
+ commitHistory: string[];
954
+ }[];
955
+ project?: Project;
956
+ branch?: string;
814
957
  }
815
958
 
816
959
  export namespace StartPrebuildContext {
817
960
  export function is(context: any): context is StartPrebuildContext {
818
- return context
819
- && 'actual' in context;
961
+ return context && "actual" in context;
820
962
  }
821
963
  }
822
964
 
@@ -828,33 +970,39 @@ export interface PrebuiltWorkspaceContext extends WorkspaceContext {
828
970
 
829
971
  export namespace PrebuiltWorkspaceContext {
830
972
  export function is(context: any): context is PrebuiltWorkspaceContext {
831
- return context
832
- && 'originalContext' in context
833
- && 'prebuiltWorkspace' in context;
973
+ return context && "originalContext" in context && "prebuiltWorkspace" in context;
974
+ }
975
+ }
976
+
977
+ export interface WithReferrerContext extends WorkspaceContext {
978
+ referrer: string;
979
+ referrerIde?: string;
980
+ }
981
+
982
+ export namespace WithReferrerContext {
983
+ export function is(context: any): context is WithReferrerContext {
984
+ return context && "referrer" in context;
834
985
  }
835
986
  }
836
987
 
837
988
  export interface WithEnvvarsContext extends WorkspaceContext {
838
- envvars: UserEnvVarValue[];
989
+ envvars: EnvVarWithValue[];
839
990
  }
840
991
 
841
992
  export namespace WithEnvvarsContext {
842
993
  export function is(context: any): context is WithEnvvarsContext {
843
- return context
844
- && 'envvars' in context
994
+ return context && "envvars" in context;
845
995
  }
846
996
  }
847
997
 
848
998
  export interface WorkspaceProbeContext extends WorkspaceContext {
849
- responseURL: string
850
- responseToken: string
999
+ responseURL: string;
1000
+ responseToken: string;
851
1001
  }
852
1002
 
853
1003
  export namespace WorkspaceProbeContext {
854
1004
  export function is(context: any): context is WorkspaceProbeContext {
855
- return context
856
- && 'responseURL' in context
857
- && 'responseToken' in context;
1005
+ return context && "responseURL" in context && "responseToken" in context;
858
1006
  }
859
1007
  }
860
1008
 
@@ -866,30 +1014,80 @@ export namespace RefType {
866
1014
  }
867
1015
  // This fallback is meant to handle the cases where (for historic reasons) ref is present but refType is missing
868
1016
  return commit.refType || "branch";
869
- }
1017
+ };
870
1018
  }
871
1019
 
872
1020
  export interface Commit {
873
- repository: Repository
874
- revision: string
1021
+ repository: Repository;
1022
+ revision: string;
875
1023
 
876
1024
  // Might contain either a branch or a tag (determined by refType)
877
- ref?: string
1025
+ ref?: string;
878
1026
 
879
1027
  // refType is only set if ref is present (and not for old workspaces, before this feature was added)
880
- refType?: RefType
1028
+ refType?: RefType;
881
1029
  }
882
1030
 
883
- export interface CommitContext extends WorkspaceContext, Commit {
1031
+ export interface AdditionalContentContext extends WorkspaceContext {
1032
+ /**
1033
+ * utf-8 encoded contents that will be copied on top of the workspace's filesystem
1034
+ */
1035
+ additionalFiles: { [filePath: string]: string };
1036
+ }
1037
+
1038
+ export namespace AdditionalContentContext {
1039
+ export function is(ctx: any): ctx is AdditionalContentContext {
1040
+ return "additionalFiles" in ctx;
1041
+ }
1042
+
1043
+ export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
1044
+ return is(ctx) && ImageConfigFile.is(config.image) && !!ctx.additionalFiles[config.image.file];
1045
+ }
1046
+ }
1047
+
1048
+ export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
884
1049
  /** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
885
- cloneUrl?: string
1050
+ cloneUrl?: string;
1051
+
1052
+ /**
1053
+ * The clone and checkout information for additional repositories in case of multi-repo projects.
1054
+ */
1055
+ additionalRepositoryCheckoutInfo?: GitCheckoutInfo[];
1056
+ }
1057
+
1058
+ export namespace CommitContext {
1059
+ /**
1060
+ * Creates a hash for all the commits of the CommitContext and all sub-repo commit infos.
1061
+ * The hash is max 255 chars long.
1062
+ * @param commitContext
1063
+ * @returns hash for commitcontext
1064
+ */
1065
+ export function computeHash(commitContext: CommitContext): string {
1066
+ // for single commits we use the revision to be backward compatible.
1067
+ if (
1068
+ !commitContext.additionalRepositoryCheckoutInfo ||
1069
+ commitContext.additionalRepositoryCheckoutInfo.length === 0
1070
+ ) {
1071
+ return commitContext.revision;
1072
+ }
1073
+ const hasher = createHash("sha256");
1074
+ hasher.update(commitContext.revision);
1075
+ for (const info of commitContext.additionalRepositoryCheckoutInfo) {
1076
+ hasher.update(info.revision);
1077
+ }
1078
+ return hasher.digest("hex");
1079
+ }
1080
+ }
1081
+
1082
+ export interface GitCheckoutInfo extends Commit {
1083
+ checkoutLocation?: string;
1084
+ upstreamRemoteURI?: string;
1085
+ localBranch?: string;
886
1086
  }
887
1087
 
888
1088
  export namespace CommitContext {
889
1089
  export function is(commit: any): commit is CommitContext {
890
- return WorkspaceContext.is(commit)
891
- && 'repository' in commit
892
- && 'revision' in commit
1090
+ return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
893
1091
  }
894
1092
  }
895
1093
 
@@ -897,17 +1095,14 @@ export interface PullRequestContext extends CommitContext {
897
1095
  nr: number;
898
1096
  ref: string;
899
1097
  base: {
900
- repository: Repository
901
- ref: string
902
- }
1098
+ repository: Repository;
1099
+ ref: string;
1100
+ };
903
1101
  }
904
1102
 
905
1103
  export namespace PullRequestContext {
906
1104
  export function is(ctx: any): ctx is PullRequestContext {
907
- return CommitContext.is(ctx)
908
- && 'nr' in ctx
909
- && 'ref' in ctx
910
- && 'base' in ctx
1105
+ return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
911
1106
  }
912
1107
  }
913
1108
 
@@ -919,10 +1114,7 @@ export interface IssueContext extends CommitContext {
919
1114
 
920
1115
  export namespace IssueContext {
921
1116
  export function is(ctx: any): ctx is IssueContext {
922
- return CommitContext.is(ctx)
923
- && 'nr' in ctx
924
- && 'ref' in ctx
925
- && 'localBranch' in ctx
1117
+ return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
926
1118
  }
927
1119
  }
928
1120
 
@@ -933,9 +1125,7 @@ export interface NavigatorContext extends CommitContext {
933
1125
 
934
1126
  export namespace NavigatorContext {
935
1127
  export function is(ctx: any): ctx is NavigatorContext {
936
- return CommitContext.is(ctx)
937
- && 'path' in ctx
938
- && 'isFile' in ctx
1128
+ return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
939
1129
  }
940
1130
  }
941
1131
 
@@ -944,6 +1134,8 @@ export interface Repository {
944
1134
  owner: string;
945
1135
  name: string;
946
1136
  cloneUrl: string;
1137
+ /* Optional kind to differentiate between repositories of orgs/groups/projects and personal repos. */
1138
+ repoKind?: string;
947
1139
  description?: string;
948
1140
  avatarUrl?: string;
949
1141
  webUrl?: string;
@@ -952,8 +1144,21 @@ export interface Repository {
952
1144
  private?: boolean;
953
1145
  fork?: {
954
1146
  // The direct parent of this fork
955
- parent: Repository
956
- }
1147
+ parent: Repository;
1148
+ };
1149
+ }
1150
+ export interface Branch {
1151
+ name: string;
1152
+ commit: CommitInfo;
1153
+ htmlUrl: string;
1154
+ }
1155
+
1156
+ export interface CommitInfo {
1157
+ author: string;
1158
+ sha: string;
1159
+ commitMessage: string;
1160
+ authorAvatarUrl?: string;
1161
+ authorDate?: string;
957
1162
  }
958
1163
 
959
1164
  export namespace Repository {
@@ -965,21 +1170,19 @@ export namespace Repository {
965
1170
  export interface WorkspaceInstancePortsChangedEvent {
966
1171
  type: "PortsChanged";
967
1172
  instanceID: string;
968
- portsOpened: number[]
969
- portsClosed: number[]
1173
+ portsOpened: number[];
1174
+ portsClosed: number[];
970
1175
  }
971
1176
 
972
1177
  export namespace WorkspaceInstancePortsChangedEvent {
973
-
974
1178
  export function is(data: any): data is WorkspaceInstancePortsChangedEvent {
975
1179
  return data && data.type == "PortsChanged";
976
1180
  }
977
-
978
1181
  }
979
1182
 
980
1183
  export interface WorkspaceInfo {
981
- workspace: Workspace
982
- latestInstance?: WorkspaceInstance
1184
+ workspace: Workspace;
1185
+ latestInstance?: WorkspaceInstance;
983
1186
  }
984
1187
 
985
1188
  export namespace WorkspaceInfo {
@@ -995,34 +1198,36 @@ export interface WorkspaceCreationResult {
995
1198
  workspaceURL?: string;
996
1199
  existingWorkspaces?: WorkspaceInfo[];
997
1200
  runningWorkspacePrebuild?: {
998
- prebuildID: string
999
- workspaceID: string
1000
- starting: RunningWorkspacePrebuildStarting
1001
- sameCluster: boolean
1002
- }
1201
+ prebuildID: string;
1202
+ workspaceID: string;
1203
+ instanceID: string;
1204
+ starting: RunningWorkspacePrebuildStarting;
1205
+ sameCluster: boolean;
1206
+ };
1003
1207
  runningPrebuildWorkspaceID?: string;
1004
1208
  }
1005
- export type RunningWorkspacePrebuildStarting = 'queued' | 'starting' | 'running';
1209
+ export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
1006
1210
 
1007
1211
  export enum CreateWorkspaceMode {
1008
1212
  // Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
1009
- Default = 'default',
1213
+ Default = "default",
1010
1214
  // 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.
1011
- ForceNew = 'force-new',
1215
+ ForceNew = "force-new",
1012
1216
  // UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
1013
- UsePrebuild = 'use-prebuild',
1217
+ UsePrebuild = "use-prebuild",
1014
1218
  // SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
1015
- SelectIfRunning = 'select-if-running',
1219
+ SelectIfRunning = "select-if-running",
1016
1220
  }
1017
1221
 
1018
1222
  export namespace WorkspaceCreationResult {
1019
1223
  export function is(data: any): data is WorkspaceCreationResult {
1020
- return data && (
1021
- 'createdWorkspaceId' in data
1022
- || 'existingWorkspaces' in data
1023
- || 'runningWorkspacePrebuild' in data
1024
- || 'runningPrebuildWorkspaceID' in data
1025
- )
1224
+ return (
1225
+ data &&
1226
+ ("createdWorkspaceId" in data ||
1227
+ "existingWorkspaces" in data ||
1228
+ "runningWorkspacePrebuild" in data ||
1229
+ "runningPrebuildWorkspaceID" in data)
1230
+ );
1026
1231
  }
1027
1232
  }
1028
1233
 
@@ -1056,7 +1261,7 @@ export interface AuthProviderInfo {
1056
1261
  readonly default: string[];
1057
1262
  readonly publicRepo: string[];
1058
1263
  readonly privateRepo: string[];
1059
- }
1264
+ };
1060
1265
  }
1061
1266
 
1062
1267
  export interface AuthProviderEntry {
@@ -1068,6 +1273,8 @@ export interface AuthProviderEntry {
1068
1273
  readonly status: AuthProviderEntry.Status;
1069
1274
 
1070
1275
  readonly oauth: OAuth2Config;
1276
+ /** A random string that is to change whenever oauth changes (enforced on DB level) */
1277
+ readonly oauthRevision?: string;
1071
1278
  }
1072
1279
 
1073
1280
  export interface OAuth2Config {
@@ -1080,56 +1287,27 @@ export interface OAuth2Config {
1080
1287
  readonly scopeSeparator?: string;
1081
1288
 
1082
1289
  readonly settingsUrl?: string;
1083
- readonly authorizationParams?: { [key: string]: string }
1290
+ readonly authorizationParams?: { [key: string]: string };
1084
1291
  readonly configURL?: string;
1085
1292
  }
1086
1293
 
1087
1294
  export namespace AuthProviderEntry {
1088
1295
  export type Type = "GitHub" | "GitLab" | string;
1089
1296
  export type Status = "pending" | "verified";
1090
- export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & { clientId?: string, clientSecret?: string };
1091
- export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> & Pick<OAuth2Config, "clientId" | "clientSecret">;
1297
+ export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & {
1298
+ clientId?: string;
1299
+ clientSecret?: string;
1300
+ };
1301
+ export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> &
1302
+ Pick<OAuth2Config, "clientId" | "clientSecret">;
1092
1303
  export function redact(entry: AuthProviderEntry): AuthProviderEntry {
1093
1304
  return {
1094
1305
  ...entry,
1095
1306
  oauth: {
1096
1307
  ...entry.oauth,
1097
- clientSecret: "redacted"
1098
- }
1099
- }
1100
- }
1101
- }
1102
-
1103
- export interface Branding {
1104
- readonly name: string;
1105
- readonly favicon?: string;
1106
- /** Either including domain OR absolute path (interpreted relative to host URL) */
1107
- readonly logo: string;
1108
- readonly startupLogo: string;
1109
- readonly showProductivityTips: boolean;
1110
- readonly redirectUrlIfNotAuthenticated?: string;
1111
- readonly redirectUrlAfterLogout?: string;
1112
- readonly homepage: string;
1113
- readonly ide?: {
1114
- readonly logo: string;
1115
- readonly showReleaseNotes: boolean;
1116
- readonly helpMenu: Branding.Link[];
1117
- }
1118
- readonly links: {
1119
- readonly header: Branding.Link[];
1120
- readonly footer: Branding.Link[];
1121
- readonly social: Branding.SocialLink[];
1122
- readonly legal: Branding.Link[];
1123
- }
1124
- }
1125
- export namespace Branding {
1126
- export interface Link {
1127
- readonly name: string;
1128
- readonly url: string;
1129
- }
1130
- export interface SocialLink {
1131
- readonly type: string;
1132
- readonly url: string;
1308
+ clientSecret: "redacted",
1309
+ },
1310
+ };
1133
1311
  }
1134
1312
  }
1135
1313