@gitpod/gitpod-protocol 0.1.5-to-new-image.2 → 0.1.5-to-monitor-delete.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/data/gitpod-schema.json +124 -5
  2. package/lib/accounting-protocol.d.ts +18 -10
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +34 -32
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +7 -0
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js.map +1 -1
  9. package/lib/analytics.d.ts.map +1 -1
  10. package/lib/analytics.js.map +1 -1
  11. package/lib/attribution.d.ts +24 -0
  12. package/lib/attribution.d.ts.map +1 -0
  13. package/lib/attribution.js +54 -0
  14. package/lib/attribution.js.map +1 -0
  15. package/lib/auth.d.ts.map +1 -1
  16. package/lib/billing-mode.d.ts +45 -0
  17. package/lib/billing-mode.d.ts.map +1 -0
  18. package/lib/billing-mode.js +44 -0
  19. package/lib/billing-mode.js.map +1 -0
  20. package/lib/blocked-repositories-protocol.d.ts +13 -0
  21. package/lib/blocked-repositories-protocol.d.ts.map +1 -0
  22. package/lib/blocked-repositories-protocol.js +8 -0
  23. package/lib/blocked-repositories-protocol.js.map +1 -0
  24. package/lib/context-url.d.ts.map +1 -1
  25. package/lib/context-url.js +4 -4
  26. package/lib/context-url.js.map +1 -1
  27. package/lib/context-url.spec.d.ts.map +1 -1
  28. package/lib/context-url.spec.js +20 -5
  29. package/lib/context-url.spec.js.map +1 -1
  30. package/lib/encryption/container-module.d.ts.map +1 -1
  31. package/lib/encryption/container-module.js +1 -1
  32. package/lib/encryption/container-module.js.map +1 -1
  33. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  34. package/lib/encryption/encryption-engine.js +9 -9
  35. package/lib/encryption/encryption-engine.js.map +1 -1
  36. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  37. package/lib/encryption/encryption-engine.spec.js +2 -3
  38. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  39. package/lib/encryption/encryption-service.d.ts.map +1 -1
  40. package/lib/encryption/encryption-service.js +1 -1
  41. package/lib/encryption/encryption-service.js.map +1 -1
  42. package/lib/encryption/key-provider.d.ts.map +1 -1
  43. package/lib/encryption/key-provider.js +7 -9
  44. package/lib/encryption/key-provider.js.map +1 -1
  45. package/lib/env.d.ts +0 -5
  46. package/lib/env.d.ts.map +1 -1
  47. package/lib/env.js +1 -20
  48. package/lib/env.js.map +1 -1
  49. package/lib/experiments/always-default.d.ts +8 -0
  50. package/lib/experiments/always-default.d.ts.map +1 -0
  51. package/lib/experiments/always-default.js +20 -0
  52. package/lib/experiments/always-default.js.map +1 -0
  53. package/lib/experiments/configcat-server.d.ts +10 -0
  54. package/lib/experiments/configcat-server.d.ts.map +1 -0
  55. package/lib/experiments/configcat-server.js +36 -0
  56. package/lib/experiments/configcat-server.js.map +1 -0
  57. package/lib/experiments/configcat.d.ts +21 -0
  58. package/lib/experiments/configcat.d.ts.map +1 -0
  59. package/lib/experiments/configcat.js +51 -0
  60. package/lib/experiments/configcat.js.map +1 -0
  61. package/lib/experiments/types.d.ts +22 -0
  62. package/lib/experiments/types.d.ts.map +1 -0
  63. package/lib/experiments/types.js +10 -0
  64. package/lib/experiments/types.js.map +1 -0
  65. package/lib/gitpod-file-parser.d.ts.map +1 -1
  66. package/lib/gitpod-file-parser.js +6 -6
  67. package/lib/gitpod-file-parser.js.map +1 -1
  68. package/lib/gitpod-file-parser.spec.js +42 -39
  69. package/lib/gitpod-file-parser.spec.js.map +1 -1
  70. package/lib/gitpod-service.d.ts +65 -46
  71. package/lib/gitpod-service.d.ts.map +1 -1
  72. package/lib/gitpod-service.js +52 -33
  73. package/lib/gitpod-service.js.map +1 -1
  74. package/lib/headless-workspace-log.d.ts +1 -0
  75. package/lib/headless-workspace-log.d.ts.map +1 -1
  76. package/lib/headless-workspace-log.js +2 -1
  77. package/lib/headless-workspace-log.js.map +1 -1
  78. package/lib/ide-frontend-service.d.ts +1 -1
  79. package/lib/ide-protocol.d.ts +14 -6
  80. package/lib/ide-protocol.d.ts.map +1 -1
  81. package/lib/index.d.ts +16 -16
  82. package/lib/index.d.ts.map +1 -1
  83. package/lib/index.js +1 -1
  84. package/lib/index.js.map +1 -1
  85. package/lib/installation-admin-protocol.d.ts +3 -0
  86. package/lib/installation-admin-protocol.d.ts.map +1 -1
  87. package/lib/installation-admin-protocol.js +3 -2
  88. package/lib/installation-admin-protocol.js.map +1 -1
  89. package/lib/license-protocol.d.ts +7 -0
  90. package/lib/license-protocol.d.ts.map +1 -1
  91. package/lib/license-protocol.js.map +1 -1
  92. package/lib/messaging/browser/connection.d.ts +1 -1
  93. package/lib/messaging/browser/connection.d.ts.map +1 -1
  94. package/lib/messaging/browser/connection.js +19 -19
  95. package/lib/messaging/browser/connection.js.map +1 -1
  96. package/lib/messaging/browser/window-connection.d.ts +4 -4
  97. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  98. package/lib/messaging/browser/window-connection.js +9 -6
  99. package/lib/messaging/browser/window-connection.js.map +1 -1
  100. package/lib/messaging/client-call-metrics.d.ts +2 -18
  101. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  102. package/lib/messaging/client-call-metrics.js +21 -22
  103. package/lib/messaging/client-call-metrics.js.map +1 -1
  104. package/lib/messaging/error.d.ts +7 -1
  105. package/lib/messaging/error.d.ts.map +1 -1
  106. package/lib/messaging/error.js +15 -3
  107. package/lib/messaging/error.js.map +1 -1
  108. package/lib/messaging/handler.d.ts.map +1 -1
  109. package/lib/messaging/handler.js +1 -1
  110. package/lib/messaging/node/connection.js +8 -8
  111. package/lib/messaging/node/connection.js.map +1 -1
  112. package/lib/messaging/proxy-factory.d.ts +1 -1
  113. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  114. package/lib/messaging/proxy-factory.js +7 -9
  115. package/lib/messaging/proxy-factory.js.map +1 -1
  116. package/lib/payment-protocol.d.ts.map +1 -1
  117. package/lib/payment-protocol.js +1 -1
  118. package/lib/payment-protocol.js.map +1 -1
  119. package/lib/permission.d.ts +2 -2
  120. package/lib/permission.d.ts.map +1 -1
  121. package/lib/permission.js +12 -23
  122. package/lib/permission.js.map +1 -1
  123. package/lib/plans.d.ts +4 -3
  124. package/lib/plans.d.ts.map +1 -1
  125. package/lib/plans.js +210 -171
  126. package/lib/plans.js.map +1 -1
  127. package/lib/protocol.d.ts +181 -57
  128. package/lib/protocol.d.ts.map +1 -1
  129. package/lib/protocol.js +285 -105
  130. package/lib/protocol.js.map +1 -1
  131. package/{src/theia-plugins.ts → lib/protocol.spec.d.ts} +2 -6
  132. package/lib/protocol.spec.d.ts.map +1 -0
  133. package/lib/protocol.spec.js +127 -0
  134. package/lib/protocol.spec.js.map +1 -0
  135. package/lib/snapshot-url.spec.js.map +1 -1
  136. package/lib/team-subscription-protocol.d.ts +22 -3
  137. package/lib/team-subscription-protocol.d.ts.map +1 -1
  138. package/lib/team-subscription-protocol.js +20 -5
  139. package/lib/team-subscription-protocol.js.map +1 -1
  140. package/lib/teams-projects-protocol.d.ts +26 -5
  141. package/lib/teams-projects-protocol.d.ts.map +1 -1
  142. package/lib/teams-projects-protocol.js +1 -1
  143. package/lib/teams-projects-protocol.js.map +1 -1
  144. package/lib/typings/globals.d.ts +2 -2
  145. package/lib/typings/globals.d.ts.map +1 -1
  146. package/lib/usage.d.ts +61 -0
  147. package/lib/usage.d.ts.map +1 -0
  148. package/lib/usage.js +14 -0
  149. package/lib/usage.js.map +1 -0
  150. package/lib/util/analytics.d.ts.map +1 -1
  151. package/lib/util/analytics.js +12 -3
  152. package/lib/util/analytics.js.map +1 -1
  153. package/lib/util/async-iterator.d.ts.map +1 -1
  154. package/lib/util/async-iterator.js +3 -3
  155. package/lib/util/async-iterator.js.map +1 -1
  156. package/lib/util/cancelable.js.map +1 -1
  157. package/lib/util/date-time.js +6 -6
  158. package/lib/util/date-time.js.map +1 -1
  159. package/lib/util/debug-app.d.ts +25 -0
  160. package/lib/util/debug-app.d.ts.map +1 -0
  161. package/lib/util/debug-app.js +100 -0
  162. package/lib/util/debug-app.js.map +1 -0
  163. package/lib/util/deferred.js.map +1 -1
  164. package/lib/util/disposable.d.ts.map +1 -1
  165. package/lib/util/disposable.js +2 -2
  166. package/lib/util/disposable.js.map +1 -1
  167. package/lib/util/event.d.ts.map +1 -1
  168. package/lib/util/event.js +5 -3
  169. package/lib/util/event.js.map +1 -1
  170. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  171. package/lib/util/garbage-collected-cache.js +6 -1
  172. package/lib/util/garbage-collected-cache.js.map +1 -1
  173. package/lib/util/generate-workspace-id.d.ts +5 -0
  174. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  175. package/lib/util/generate-workspace-id.js +446 -442
  176. package/lib/util/generate-workspace-id.js.map +1 -1
  177. package/lib/util/generate-workspace-id.spec.js +18 -7
  178. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  179. package/lib/util/gitpod-cookie.d.ts +1 -1
  180. package/lib/util/gitpod-cookie.d.ts.map +1 -1
  181. package/lib/util/gitpod-cookie.js +0 -3
  182. package/lib/util/gitpod-cookie.js.map +1 -1
  183. package/lib/util/gitpod-host-url.d.ts +3 -0
  184. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  185. package/lib/util/gitpod-host-url.js +49 -29
  186. package/lib/util/gitpod-host-url.js.map +1 -1
  187. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  188. package/lib/util/gitpod-host-url.spec.js +15 -5
  189. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  190. package/lib/util/grpc.d.ts +19 -0
  191. package/lib/util/grpc.d.ts.map +1 -1
  192. package/lib/util/grpc.js +73 -1
  193. package/lib/util/grpc.js.map +1 -1
  194. package/lib/util/jaeger-client-types.d.ts.map +1 -1
  195. package/lib/util/logging.d.ts +1 -1
  196. package/lib/util/logging.d.ts.map +1 -1
  197. package/lib/util/logging.js +31 -25
  198. package/lib/util/logging.js.map +1 -1
  199. package/lib/util/logging.spec.d.ts +7 -0
  200. package/lib/util/logging.spec.d.ts.map +1 -0
  201. package/lib/util/logging.spec.js +52 -0
  202. package/lib/util/logging.spec.js.map +1 -0
  203. package/lib/util/make-link.js +5 -5
  204. package/lib/util/make-link.js.map +1 -1
  205. package/lib/util/nice-grpc.d.ts +9 -0
  206. package/lib/util/nice-grpc.d.ts.map +1 -0
  207. package/lib/util/nice-grpc.js +119 -0
  208. package/lib/util/nice-grpc.js.map +1 -0
  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 +2 -0
  225. package/lib/util/timeutil.spec.d.ts.map +1 -1
  226. package/lib/util/timeutil.spec.js +34 -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/{theia-plugins.js → webhook-event.js} +2 -2
  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 +12 -13
  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 +1 -1
  253. package/lib/wsready.d.ts.map +1 -1
  254. package/lib/wsready.js +2 -2
  255. package/package.json +14 -6
  256. package/pkg-yarn.lock +10 -5
  257. package/provenance-bundle.jsonl +3 -1
  258. package/src/accounting-protocol.ts +66 -51
  259. package/src/admin-protocol.ts +32 -20
  260. package/src/analytics.ts +21 -21
  261. package/src/attribution.ts +63 -0
  262. package/src/auth.ts +2 -2
  263. package/src/billing-mode.ts +84 -0
  264. package/src/blocked-repositories-protocol.ts +13 -0
  265. package/src/context-url.spec.ts +25 -11
  266. package/src/context-url.ts +80 -78
  267. package/src/encryption/container-module.ts +2 -3
  268. package/src/encryption/encryption-engine.spec.ts +9 -8
  269. package/src/encryption/encryption-engine.ts +20 -16
  270. package/src/encryption/encryption-service.ts +4 -5
  271. package/src/encryption/key-provider.ts +16 -19
  272. package/src/env.ts +0 -22
  273. package/src/experiments/always-default.ts +24 -0
  274. package/src/experiments/configcat-server.ts +41 -0
  275. package/src/experiments/configcat.ts +56 -0
  276. package/src/experiments/types.ts +34 -0
  277. package/src/gitpod-file-parser.spec.ts +55 -61
  278. package/src/gitpod-file-parser.ts +16 -17
  279. package/src/gitpod-service.ts +208 -132
  280. package/src/headless-workspace-log.ts +6 -4
  281. package/src/ide-frontend-service.ts +2 -2
  282. package/src/ide-protocol.ts +18 -8
  283. package/src/index.ts +16 -16
  284. package/src/installation-admin-protocol.ts +11 -8
  285. package/src/license-protocol.ts +12 -6
  286. package/src/messaging/browser/connection.ts +45 -47
  287. package/src/messaging/browser/window-connection.ts +39 -29
  288. package/src/messaging/client-call-metrics.ts +62 -82
  289. package/src/messaging/error.ts +23 -7
  290. package/src/messaging/handler.ts +6 -6
  291. package/src/messaging/node/connection.ts +8 -8
  292. package/src/messaging/proxy-factory.ts +23 -30
  293. package/src/oss-allowlist.ts +3 -3
  294. package/src/payment-protocol.ts +2 -2
  295. package/src/permission.ts +20 -31
  296. package/src/plans.ts +240 -189
  297. package/src/protocol.spec.ts +97 -0
  298. package/src/protocol.ts +545 -261
  299. package/src/snapshot-url.spec.ts +9 -7
  300. package/src/team-subscription-protocol.ts +59 -22
  301. package/src/teams-projects-protocol.ts +36 -11
  302. package/src/typings/globals.ts +4 -4
  303. package/src/usage.ts +71 -0
  304. package/src/util/analytics.ts +46 -24
  305. package/src/util/async-iterator.ts +4 -5
  306. package/src/util/cancelable.ts +3 -3
  307. package/src/util/date-time.ts +8 -8
  308. package/src/util/debug-app.ts +81 -0
  309. package/src/util/deferred.ts +6 -6
  310. package/src/util/disposable.ts +3 -6
  311. package/src/util/event.ts +9 -11
  312. package/src/util/garbage-collected-cache.ts +8 -6
  313. package/src/util/generate-workspace-id.spec.ts +26 -16
  314. package/src/util/generate-workspace-id.ts +460 -454
  315. package/src/util/gitpod-cookie.ts +8 -9
  316. package/src/util/gitpod-host-url.spec.ts +40 -13
  317. package/src/util/gitpod-host-url.ts +57 -33
  318. package/src/util/grpc.ts +90 -1
  319. package/src/util/jaeger-client-types.ts +2 -2
  320. package/src/util/logging.spec.ts +23 -0
  321. package/src/util/logging.ts +60 -42
  322. package/src/util/make-link.ts +6 -7
  323. package/src/util/nice-grpc.ts +93 -0
  324. package/src/util/parse-workspace-id.spec.ts +17 -8
  325. package/src/util/parse-workspace-id.ts +5 -6
  326. package/src/util/queue.spec.ts +27 -25
  327. package/src/util/repeat.ts +1 -1
  328. package/src/util/semaphore.ts +4 -6
  329. package/src/util/skip-if.ts +9 -6
  330. package/src/util/timeutil.spec.ts +40 -14
  331. package/src/util/timeutil.ts +27 -11
  332. package/src/util/tracing.spec.ts +28 -23
  333. package/src/util/tracing.ts +54 -51
  334. package/src/util/workspace-port-authentication.ts +10 -13
  335. package/src/webhook-event.ts +55 -0
  336. package/src/workspace-class.ts +14 -0
  337. package/src/workspace-cluster.ts +24 -18
  338. package/src/workspace-instance.ts +60 -24
  339. package/src/wsready.ts +3 -3
  340. package/data/builtin-theia-plugins.json +0 -372
  341. package/lib/email-protocol.d.ts +0 -49
  342. package/lib/email-protocol.d.ts.map +0 -1
  343. package/lib/email-protocol.js +0 -28
  344. package/lib/email-protocol.js.map +0 -1
  345. package/lib/theia-plugins.d.ts +0 -11
  346. package/lib/theia-plugins.d.ts.map +0 -1
  347. package/lib/theia-plugins.js.map +0 -1
  348. package/src/email-protocol.ts +0 -66
@@ -5,32 +5,63 @@
5
5
  */
6
6
 
7
7
  import {
8
- User, WorkspaceInfo, WorkspaceCreationResult, WorkspaceInstanceUser,
9
- WhitelistedRepository, WorkspaceImageBuild, AuthProviderInfo, CreateWorkspaceMode,
10
- Token, UserEnvVarValue, ResolvePluginsParams, PreparePluginUploadParams, Terms,
11
- ResolvedPlugins, Configuration, InstallPluginsParams, UninstallPluginParams, UserInfo, GitpodTokenType,
12
- GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes, ProjectEnvVar
13
- } from './protocol';
8
+ User,
9
+ WorkspaceInfo,
10
+ WorkspaceCreationResult,
11
+ WorkspaceInstanceUser,
12
+ WhitelistedRepository,
13
+ WorkspaceImageBuild,
14
+ AuthProviderInfo,
15
+ Token,
16
+ UserEnvVarValue,
17
+ Terms,
18
+ Configuration,
19
+ UserInfo,
20
+ GitpodTokenType,
21
+ GitpodToken,
22
+ AuthProviderEntry,
23
+ GuessGitTokenScopesParams,
24
+ GuessedGitTokenScopes,
25
+ ProjectEnvVar,
26
+ PrebuiltWorkspace,
27
+ UserSSHPublicKeyValue,
28
+ SSHPublicKeyValue,
29
+ } from "./protocol";
14
30
  import {
15
- Team, TeamMemberInfo,
16
- TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult, PartialProject
17
- } from './teams-projects-protocol';
18
- import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
19
- import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
20
- import { HeadlessLogUrls } from './headless-workspace-log';
21
- import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from './workspace-instance';
22
- import { AdminServer } from './admin-protocol';
23
- import { GitpodHostUrl } from './util/gitpod-host-url';
24
- import { WebSocketConnectionProvider } from './messaging/browser/connection';
25
- import { PermissionName } from './permission';
26
- import { LicenseService } from './license-protocol';
27
- import { Emitter } from './util/event';
28
- import { AccountStatement, CreditAlert } from './accounting-protocol';
29
- import { GithubUpgradeURL, PlanCoupon } from './payment-protocol';
30
- import { TeamSubscription, TeamSubscriptionSlot, TeamSubscriptionSlotResolved } from './team-subscription-protocol';
31
- import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from './analytics';
32
- import { IDEServer } from './ide-protocol';
33
- import { InstallationAdminSettings, TelemetryData } from './installation-admin-protocol';
31
+ Team,
32
+ TeamMemberInfo,
33
+ TeamMembershipInvite,
34
+ Project,
35
+ TeamMemberRole,
36
+ PrebuildWithStatus,
37
+ StartPrebuildResult,
38
+ PartialProject,
39
+ PrebuildEvent,
40
+ } from "./teams-projects-protocol";
41
+ import { JsonRpcProxy, JsonRpcServer } from "./messaging/proxy-factory";
42
+ import { Disposable, CancellationTokenSource } from "vscode-jsonrpc";
43
+ import { HeadlessLogUrls } from "./headless-workspace-log";
44
+ import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from "./workspace-instance";
45
+ import { AdminServer } from "./admin-protocol";
46
+ import { GitpodHostUrl } from "./util/gitpod-host-url";
47
+ import { WebSocketConnectionProvider } from "./messaging/browser/connection";
48
+ import { PermissionName } from "./permission";
49
+ import { LicenseService } from "./license-protocol";
50
+ import { Emitter } from "./util/event";
51
+ import { AccountStatement, CreditAlert } from "./accounting-protocol";
52
+ import { GithubUpgradeURL, PlanCoupon } from "./payment-protocol";
53
+ import {
54
+ TeamSubscription,
55
+ TeamSubscription2,
56
+ TeamSubscriptionSlot,
57
+ TeamSubscriptionSlotResolved,
58
+ } from "./team-subscription-protocol";
59
+ import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
60
+ import { IDEServer } from "./ide-protocol";
61
+ import { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
62
+ import { ListUsageRequest, ListUsageResponse } from "./usage";
63
+ import { SupportedWorkspaceClass } from "./workspace-class";
64
+ import { BillingMode } from "./billing-mode";
34
65
 
35
66
  export interface GitpodClient {
36
67
  onInstanceUpdate(instance: WorkspaceInstance): void;
@@ -38,6 +69,8 @@ export interface GitpodClient {
38
69
 
39
70
  onPrebuildUpdate(update: PrebuildWithStatus): void;
40
71
 
72
+ onNotificationUpdated(): void;
73
+
41
74
  onCreditAlert(creditAlert: CreditAlert): void;
42
75
 
43
76
  //#region propagating reconnection to iframe
@@ -46,12 +79,14 @@ export interface GitpodClient {
46
79
  //#endregion
47
80
  }
48
81
 
49
- export const GitpodServer = Symbol('GitpodServer');
82
+ export const GitpodServer = Symbol("GitpodServer");
50
83
  export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
51
84
  // User related API
52
85
  getLoggedInUser(): Promise<User>;
53
86
  getTerms(): Promise<Terms>;
54
87
  updateLoggedInUser(user: Partial<User>): Promise<User>;
88
+ sendPhoneNumberVerificationToken(phoneNumber: string): Promise<void>;
89
+ verifyPhoneNumberVerificationToken(phoneNumber: string, token: string): Promise<boolean>;
55
90
  getAuthProviders(): Promise<AuthProviderInfo[]>;
56
91
  getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
57
92
  updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
@@ -122,7 +157,14 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
122
157
  setEnvVar(variable: UserEnvVarValue): Promise<void>;
123
158
  deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
124
159
 
160
+ // User SSH Keys
161
+ hasSSHPublicKey(): Promise<boolean>;
162
+ getSSHPublicKeys(): Promise<UserSSHPublicKeyValue[]>;
163
+ addSSHPublicKey(value: SSHPublicKeyValue): Promise<UserSSHPublicKeyValue>;
164
+ deleteSSHPublicKey(id: string): Promise<void>;
165
+
125
166
  // Teams
167
+ getTeam(teamId: string): Promise<Team>;
126
168
  getTeams(): Promise<Team[]>;
127
169
  getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
128
170
  createTeam(name: string): Promise<Team>;
@@ -131,7 +173,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
131
173
  removeTeamMember(teamId: string, userId: string): Promise<void>;
132
174
  getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
133
175
  resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
134
- deleteTeam(teamId: string, userId: string): Promise<void>;
176
+ deleteTeam(teamId: string): Promise<void>;
135
177
 
136
178
  // Admin Settings
137
179
  adminGetSettings(): Promise<InstallationAdminSettings>;
@@ -145,22 +187,20 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
145
187
  getTeamProjects(teamId: string): Promise<Project[]>;
146
188
  getUserProjects(): Promise<Project[]>;
147
189
  getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
190
+ getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
148
191
  findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
192
+ findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
193
+ getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
149
194
  triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
150
195
  cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
151
- fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
152
- guessProjectConfiguration(projectId: string): Promise<string | undefined>;
153
- fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
154
- guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
155
- setProjectConfiguration(projectId: string, configString: string): Promise<void>;
156
196
  updateProjectPartial(partialProject: PartialProject): Promise<void>;
157
197
  setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
158
198
  getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
159
199
  deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
160
200
 
161
201
  // content service
162
- getContentBlobUploadUrl(name: string): Promise<string>
163
- getContentBlobDownloadUrl(name: string): Promise<string>
202
+ getContentBlobUploadUrl(name: string): Promise<string>;
203
+ getContentBlobDownloadUrl(name: string): Promise<string>;
164
204
 
165
205
  // Gitpod token
166
206
  getGitpodTokens(): Promise<GitpodToken[]>;
@@ -168,7 +208,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
168
208
  deleteGitpodToken(tokenHash: string): Promise<void>;
169
209
 
170
210
  // misc
171
- sendFeedback(feedback: string): Promise<string | undefined>;
211
+ isGitHubAppEnabled(): Promise<boolean>;
172
212
  registerGithubApp(installationId: string): Promise<void>;
173
213
 
174
214
  /**
@@ -187,25 +227,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
187
227
  */
188
228
  getSnapshots(workspaceID: string): Promise<string[]>;
189
229
 
190
- /**
191
- * stores/updates layout information for the given workspace
192
- */
193
- storeLayout(workspaceId: string, layoutData: string): Promise<void>;
194
-
195
- /**
196
- * retrieves layout information for the given workspace
197
- */
198
- getLayout(workspaceId: string): Promise<string | undefined>;
199
-
200
- /**
201
- * @param params
202
- * @returns promise resolves to an URL to be used for the upload
203
- */
204
- preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
205
- resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
206
- installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
207
- uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
208
-
209
230
  guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
210
231
 
211
232
  /**
@@ -223,7 +244,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
223
244
  */
224
245
  getChargebeeSiteId(): Promise<string>;
225
246
  createPortalSession(): Promise<{}>;
247
+ createTeamPortalSession(teamId: string): Promise<{}>;
226
248
  checkout(planId: string, planQuantity?: number): Promise<{}>;
249
+ teamCheckout(teamId: string, planId: string): Promise<{}>;
227
250
  getAvailableCoupons(): Promise<PlanCoupon[]>;
228
251
  getAppliedCoupons(): Promise<PlanCoupon[]>;
229
252
 
@@ -235,40 +258,67 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
235
258
  subscriptionCancel(subscriptionId: string): Promise<void>;
236
259
  subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
237
260
 
261
+ getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
238
262
  tsGet(): Promise<TeamSubscription[]>;
239
263
  tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
240
- tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>
264
+ tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
241
265
  tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
242
- tsAssignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, identityStr: string | undefined): Promise<void>
266
+ tsAssignSlot(
267
+ teamSubscriptionId: string,
268
+ teamSubscriptionSlotId: string,
269
+ identityStr: string | undefined,
270
+ ): Promise<void>;
243
271
  tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
244
272
  tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
245
273
  tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
246
274
 
247
275
  getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
248
276
 
277
+ getStripePublishableKey(): Promise<string>;
278
+ getStripeSetupIntentClientSecret(): Promise<string>;
279
+ findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
280
+ createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
281
+ subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
282
+ getStripePortalUrl(attributionId: string): Promise<string>;
283
+ getUsageLimit(attributionId: string): Promise<number | undefined>;
284
+ setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
285
+
286
+ listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
287
+
288
+ setUsageAttribution(usageAttribution: string): Promise<void>;
289
+ listAvailableUsageAttributionIds(): Promise<string[]>;
290
+
291
+ getBillingModeForUser(): Promise<BillingMode>;
292
+ getBillingModeForTeam(teamId: string): Promise<BillingMode>;
293
+
249
294
  /**
250
295
  * Analytics
251
296
  */
252
297
  trackEvent(event: RemoteTrackMessage): Promise<void>;
253
298
  trackLocation(event: RemotePageMessage): Promise<void>;
254
299
  identifyUser(event: RemoteIdentifyMessage): Promise<void>;
300
+
301
+ /**
302
+ * Frontend notifications
303
+ */
304
+ getNotifications(): Promise<string[]>;
305
+
306
+ getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
255
307
  }
256
308
 
257
309
  export interface RateLimiterError {
258
- method?: string,
310
+ method?: string;
259
311
 
260
312
  /**
261
313
  * Retry after this many seconds, earliest.
262
314
  * cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
263
315
  */
264
- retryAfter: number,
316
+ retryAfter: number;
265
317
  }
266
318
 
267
319
  export interface CreateProjectParams {
268
320
  name: string;
269
- slug?: string;
270
- account: string;
271
- provider: string;
321
+ slug: string;
272
322
  cloneUrl: string;
273
323
  teamId?: string;
274
324
  userId?: string;
@@ -292,7 +342,7 @@ export interface ProviderRepository {
292
342
  account: string;
293
343
  accountAvatarUrl: string;
294
344
  cloneUrl: string;
295
- updatedAt: string;
345
+ updatedAt?: string;
296
346
  installationId?: number;
297
347
  installationUpdatedAt?: string;
298
348
 
@@ -306,42 +356,56 @@ export interface ClientHeaderFields {
306
356
  clientRegion?: string;
307
357
  }
308
358
 
309
- export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
310
-
311
- export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(methods: Partial<JsonRpcProxy<S>>): GitpodServiceImpl<C, S> {
359
+ export const WORKSPACE_TIMEOUT_DEFAULT_SHORT = "short";
360
+ export const WORKSPACE_TIMEOUT_DEFAULT_LONG = "long";
361
+ export const WORKSPACE_TIMEOUT_EXTENDED = "extended";
362
+ export const WORKSPACE_TIMEOUT_EXTENDED_ALT = "180m"; // for backwards compatibility since the IDE uses this
363
+ export const WorkspaceTimeoutValues = [
364
+ WORKSPACE_TIMEOUT_DEFAULT_SHORT,
365
+ WORKSPACE_TIMEOUT_DEFAULT_LONG,
366
+ WORKSPACE_TIMEOUT_EXTENDED,
367
+ WORKSPACE_TIMEOUT_EXTENDED_ALT,
368
+ ] as const;
369
+
370
+ export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
371
+ methods: Partial<JsonRpcProxy<S>>,
372
+ ): GitpodServiceImpl<C, S> {
312
373
  return new GitpodServiceImpl<C, S>(createServerMock(methods));
313
- }
374
+ };
314
375
 
315
- export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(methods: Partial<JsonRpcProxy<S>>): JsonRpcProxy<S> {
316
- methods.setClient = methods.setClient || (() => { });
317
- methods.dispose = methods.dispose || (() => { });
376
+ export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
377
+ methods: Partial<JsonRpcProxy<S>>,
378
+ ): JsonRpcProxy<S> {
379
+ methods.setClient = methods.setClient || (() => {});
380
+ methods.dispose = methods.dispose || (() => {});
318
381
  return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
319
382
  // @ts-ignore
320
383
  get: (target: S, property: keyof S) => {
321
384
  const result = target[property];
322
385
  if (!result) {
323
- throw new Error(`Method ${property} not implemented`);
386
+ throw new Error(`Method ${String(property)} not implemented`);
324
387
  }
325
388
  return result;
326
- }
389
+ },
327
390
  });
328
- }
391
+ };
329
392
 
330
393
  type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
331
394
  export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
332
395
 
333
396
  export interface SetWorkspaceTimeoutResult {
334
- resetTimeoutOnWorkspaces: string[]
397
+ resetTimeoutOnWorkspaces: string[];
335
398
  }
336
399
 
337
400
  export interface GetWorkspaceTimeoutResult {
338
- duration: WorkspaceTimeoutDuration
339
- canChange: boolean
401
+ duration: WorkspaceTimeoutDuration;
402
+ durationRaw: string;
403
+ canChange: boolean;
340
404
  }
341
405
 
342
406
  export interface StartWorkspaceResult {
343
- instanceID: string
344
- workspaceURL?: string
407
+ instanceID: string;
408
+ workspaceURL?: string;
345
409
  }
346
410
 
347
411
  export namespace GitpodServer {
@@ -357,7 +421,10 @@ export namespace GitpodServer {
357
421
  }
358
422
  export interface CreateWorkspaceOptions {
359
423
  contextUrl: string;
360
- mode?: CreateWorkspaceMode;
424
+ // whether running workspaces on the same context should be ignored. If false (default) users will be asked.
425
+ ignoreRunningWorkspaceOnSameCommit?: boolean;
426
+ ignoreRunningPrebuild?: boolean;
427
+ allowUsingPreviousPrebuilds?: boolean;
361
428
  forceDefaultConfig?: boolean;
362
429
  }
363
430
  export interface StartWorkspaceOptions {
@@ -365,7 +432,6 @@ export namespace GitpodServer {
365
432
  }
366
433
  export interface TakeSnapshotOptions {
367
434
  workspaceId: string;
368
- layoutData?: string;
369
435
  /* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
370
436
  dontWait?: boolean;
371
437
  }
@@ -385,23 +451,23 @@ export namespace GitpodServer {
385
451
  readonly roundTripTime?: number;
386
452
  }
387
453
  export interface UpdateOwnAuthProviderParams {
388
- readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
454
+ readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
389
455
  }
390
456
  export interface DeleteOwnAuthProviderParams {
391
- readonly id: string
457
+ readonly id: string;
392
458
  }
393
459
  export type AdmissionLevel = "owner" | "everyone";
394
460
  export type PinAction = "pin" | "unpin" | "toggle";
395
461
  export interface GenerateNewGitpodTokenOptions {
396
- name?: string
397
- type: GitpodTokenType
398
- scopes?: string[]
462
+ name?: string;
463
+ type: GitpodTokenType;
464
+ scopes?: string[];
399
465
  }
400
466
  }
401
467
 
402
- export const GitpodServerPath = '/gitpod';
468
+ export const GitpodServerPath = "/gitpod";
403
469
 
404
- export const GitpodServerProxy = Symbol('GitpodServerProxy');
470
+ export const GitpodServerProxy = Symbol("GitpodServerProxy");
405
471
  export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
406
472
 
407
473
  export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
@@ -415,8 +481,8 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
415
481
  if (index > -1) {
416
482
  this.clients.splice(index, 1);
417
483
  }
418
- }
419
- }
484
+ },
485
+ };
420
486
  }
421
487
 
422
488
  onInstanceUpdate(instance: WorkspaceInstance): void {
@@ -425,7 +491,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
425
491
  try {
426
492
  client.onInstanceUpdate(instance);
427
493
  } catch (error) {
428
- console.error(error)
494
+ console.error(error);
429
495
  }
430
496
  }
431
497
  }
@@ -437,19 +503,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
437
503
  try {
438
504
  client.onPrebuildUpdate(update);
439
505
  } catch (error) {
440
- console.error(error)
506
+ console.error(error);
441
507
  }
442
508
  }
443
509
  }
444
510
  }
445
511
 
446
- onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
512
+ onWorkspaceImageBuildLogs(
513
+ info: WorkspaceImageBuild.StateInfo,
514
+ content: WorkspaceImageBuild.LogContent | undefined,
515
+ ): void {
447
516
  for (const client of this.clients) {
448
517
  if (client.onWorkspaceImageBuildLogs) {
449
518
  try {
450
519
  client.onWorkspaceImageBuildLogs(info, content);
451
520
  } catch (error) {
452
- console.error(error)
521
+ console.error(error);
453
522
  }
454
523
  }
455
524
  }
@@ -461,7 +530,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
461
530
  try {
462
531
  client.notifyDidOpenConnection();
463
532
  } catch (error) {
464
- console.error(error)
533
+ console.error(error);
465
534
  }
466
535
  }
467
536
  }
@@ -473,7 +542,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
473
542
  try {
474
543
  client.notifyDidCloseConnection();
475
544
  } catch (error) {
476
- console.error(error)
545
+ console.error(error);
477
546
  }
478
547
  }
479
548
  }
@@ -485,64 +554,73 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
485
554
  try {
486
555
  client.onCreditAlert(creditAlert);
487
556
  } catch (error) {
488
- console.error(error)
557
+ console.error(error);
489
558
  }
490
559
  }
491
560
  }
492
561
  }
493
562
 
563
+ onNotificationUpdated(): void {
564
+ for (const client of this.clients) {
565
+ if (client.onNotificationUpdated) {
566
+ try {
567
+ client.onNotificationUpdated();
568
+ } catch (error) {
569
+ console.error(error);
570
+ }
571
+ }
572
+ }
573
+ }
494
574
  }
495
575
 
496
576
  export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
497
577
 
498
- const hasWindow = (typeof window !== 'undefined');
578
+ const hasWindow = typeof window !== "undefined";
499
579
  const phasesOrder: Record<WorkspaceInstancePhase, number> = {
500
580
  unknown: 0,
501
581
  preparing: 1,
502
- pending: 2,
503
- creating: 3,
504
- initializing: 4,
505
- running: 5,
506
- interrupted: 6,
507
- stopping: 7,
508
- stopped: 8
582
+ building: 2,
583
+ pending: 3,
584
+ creating: 4,
585
+ initializing: 5,
586
+ running: 6,
587
+ interrupted: 7,
588
+ stopping: 8,
589
+ stopped: 9,
509
590
  };
510
591
  export class WorkspaceInstanceUpdateListener {
511
592
  private readonly onDidChangeEmitter = new Emitter<void>();
512
593
  readonly onDidChange = this.onDidChangeEmitter.event;
513
594
 
514
- private source: 'sync' | 'update' = 'sync';
595
+ private source: "sync" | "update" = "sync";
515
596
 
516
597
  get info(): WorkspaceInfo {
517
598
  return this._info;
518
599
  }
519
600
 
520
- constructor(
521
- private readonly service: GitpodService,
522
- private _info: WorkspaceInfo
523
- ) {
601
+ constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
524
602
  service.registerClient({
525
- onInstanceUpdate: instance => {
603
+ onInstanceUpdate: (instance) => {
526
604
  if (this.isOutOfOrder(instance)) {
527
605
  return;
528
606
  }
529
607
  this.cancelSync();
530
608
  this._info.latestInstance = instance;
531
- this.source = 'update';
609
+ this.source = "update";
532
610
  this.onDidChangeEmitter.fire(undefined);
533
611
  },
534
612
  notifyDidOpenConnection: () => {
535
613
  this.sync();
536
- }
614
+ },
537
615
  });
538
616
  if (hasWindow) {
539
617
  // learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
540
- window.document.addEventListener('visibilitychange', async () => {
541
- if (window.document.visibilityState === 'visible') {
618
+ window.document.addEventListener("visibilitychange", async () => {
619
+ if (window.document.visibilityState === "visible") {
542
620
  this.sync();
543
621
  }
544
622
  });
545
- window.addEventListener('pageshow', e => {
623
+ window.addEventListener("pageshow", (e) => {
546
624
  if (e.persisted) {
547
625
  this.sync();
548
626
  }
@@ -570,12 +648,12 @@ export class WorkspaceInstanceUpdateListener {
570
648
  return;
571
649
  }
572
650
  this._info = info;
573
- this.source = 'sync';
651
+ this.source = "sync";
574
652
  this.onDidChangeEmitter.fire(undefined);
575
653
  } catch (e) {
576
- console.error('failed to sync workspace instance:', e)
654
+ console.error("failed to sync workspace instance:", e);
577
655
  }
578
- })
656
+ });
579
657
  }
580
658
  private cancelSync(): void {
581
659
  if (this.syncTokenSource) {
@@ -592,7 +670,7 @@ export class WorkspaceInstanceUpdateListener {
592
670
  if (instance.workspaceId !== this._info.workspace.id) {
593
671
  return true;
594
672
  }
595
- if (this.source === 'update') {
673
+ if (this.source === "update") {
596
674
  return false;
597
675
  }
598
676
  if (instance.id !== this.info.latestInstance?.id) {
@@ -600,15 +678,13 @@ export class WorkspaceInstanceUpdateListener {
600
678
  }
601
679
  return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
602
680
  }
603
-
604
681
  }
605
682
 
606
683
  export interface GitpodServiceOptions {
607
- onReconnect?: () => (void | Promise<void>)
684
+ onReconnect?: () => void | Promise<void>;
608
685
  }
609
686
 
610
687
  export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
611
-
612
688
  private readonly compositeClient = new GitpodCompositeClient<Client>();
613
689
 
614
690
  constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
@@ -623,7 +699,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
623
699
 
624
700
  private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
625
701
  listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
626
- const listener = this.instanceListeners.get(workspaceId) ||
702
+ const listener =
703
+ this.instanceListeners.get(workspaceId) ||
627
704
  (async () => {
628
705
  const info = await this.server.getWorkspace(workspaceId);
629
706
  return new WorkspaceInstanceUpdateListener(this, info);
@@ -639,26 +716,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
639
716
  }
640
717
  }
641
718
 
642
- export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(serverUrl: string | Promise<string>) {
719
+ export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
720
+ serverUrl: string | Promise<string>,
721
+ ) {
643
722
  const toWsUrl = (serverUrl: string) => {
644
- return new GitpodHostUrl(serverUrl)
645
- .asWebsocket()
646
- .withApi({ pathname: GitpodServerPath })
647
- .toString();
723
+ return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
648
724
  };
649
725
  let url: string | Promise<string>;
650
726
  if (typeof serverUrl === "string") {
651
727
  url = toWsUrl(serverUrl);
652
728
  } else {
653
- url = serverUrl.then(url => toWsUrl(url));
729
+ url = serverUrl.then((url) => toWsUrl(url));
654
730
  }
655
731
 
656
732
  const connectionProvider = new WebSocketConnectionProvider();
657
- let onReconnect = () => { };
733
+ let onReconnect = () => {};
658
734
  const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
659
- onListening: socket => {
735
+ onListening: (socket) => {
660
736
  onReconnect = () => socket.reconnect();
661
- }
737
+ },
662
738
  });
663
739
  return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
664
- }
740
+ }