@gitpod/gitpod-protocol 0.1.5-pluggable-workspace-cluster.9 → 0.1.5-port-description-3059-fork.2

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 (273) hide show
  1. package/data/gitpod-schema.json +13 -24
  2. package/lib/accounting-protocol.d.ts +3 -6
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +10 -16
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +15 -4
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +15 -0
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +45 -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/context-url.d.ts +18 -0
  15. package/lib/context-url.d.ts.map +1 -0
  16. package/lib/context-url.js +49 -0
  17. package/lib/context-url.js.map +1 -0
  18. package/lib/{util/context-url.spec.d.ts → context-url.spec.d.ts} +2 -0
  19. package/lib/context-url.spec.d.ts.map +1 -0
  20. package/lib/context-url.spec.js +73 -0
  21. package/lib/context-url.spec.js.map +1 -0
  22. package/lib/email-protocol.d.ts +1 -2
  23. package/lib/email-protocol.d.ts.map +1 -1
  24. package/lib/email-protocol.js +4 -4
  25. package/lib/email-protocol.js.map +1 -1
  26. package/lib/encryption/container-module.js +4 -4
  27. package/lib/encryption/container-module.js.map +1 -1
  28. package/lib/encryption/encryption-engine.js +19 -20
  29. package/lib/encryption/encryption-engine.js.map +1 -1
  30. package/lib/encryption/encryption-engine.spec.js +29 -36
  31. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  32. package/lib/encryption/encryption-service.js +29 -43
  33. package/lib/encryption/encryption-service.js.map +1 -1
  34. package/lib/encryption/key-provider.js +25 -30
  35. package/lib/encryption/key-provider.js.map +1 -1
  36. package/lib/env.d.ts +1 -2
  37. package/lib/env.d.ts.map +1 -1
  38. package/lib/env.js +20 -21
  39. package/lib/env.js.map +1 -1
  40. package/lib/gitpod-file-parser.js +25 -41
  41. package/lib/gitpod-file-parser.js.map +1 -1
  42. package/lib/gitpod-file-parser.spec.js +116 -116
  43. package/lib/gitpod-file-parser.spec.js.map +1 -1
  44. package/lib/gitpod-service.d.ts +96 -19
  45. package/lib/gitpod-service.d.ts.map +1 -1
  46. package/lib/gitpod-service.js +155 -278
  47. package/lib/gitpod-service.js.map +1 -1
  48. package/lib/headless-workspace-log.d.ts +8 -11
  49. package/lib/headless-workspace-log.d.ts.map +1 -1
  50. package/lib/headless-workspace-log.js +4 -7
  51. package/lib/headless-workspace-log.js.map +1 -1
  52. package/lib/ide-protocol.d.ts +81 -0
  53. package/lib/ide-protocol.d.ts.map +1 -0
  54. package/lib/ide-protocol.js +8 -0
  55. package/lib/ide-protocol.js.map +1 -0
  56. package/lib/index.d.ts +4 -0
  57. package/lib/index.d.ts.map +1 -1
  58. package/lib/index.js +4 -0
  59. package/lib/index.js.map +1 -1
  60. package/lib/messaging/browser/connection.d.ts +4 -6
  61. package/lib/messaging/browser/connection.d.ts.map +1 -1
  62. package/lib/messaging/browser/connection.js +175 -44
  63. package/lib/messaging/browser/connection.js.map +1 -1
  64. package/lib/messaging/browser/window-connection.js +35 -55
  65. package/lib/messaging/browser/window-connection.js.map +1 -1
  66. package/lib/messaging/client-call-metrics.d.ts +35 -0
  67. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  68. package/lib/messaging/client-call-metrics.js +83 -0
  69. package/lib/messaging/client-call-metrics.js.map +1 -0
  70. package/lib/messaging/connection-error-handler.js +11 -23
  71. package/lib/messaging/connection-error-handler.js.map +1 -1
  72. package/lib/messaging/error.d.ts +2 -1
  73. package/lib/messaging/error.d.ts.map +1 -1
  74. package/lib/messaging/error.js +4 -2
  75. package/lib/messaging/error.js.map +1 -1
  76. package/lib/messaging/handler.d.ts +10 -0
  77. package/lib/messaging/handler.d.ts.map +1 -1
  78. package/lib/messaging/node/connection.d.ts +0 -10
  79. package/lib/messaging/node/connection.d.ts.map +1 -1
  80. package/lib/messaging/node/connection.js +12 -50
  81. package/lib/messaging/node/connection.js.map +1 -1
  82. package/lib/messaging/proxy-factory.d.ts +2 -0
  83. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  84. package/lib/messaging/proxy-factory.js +74 -159
  85. package/lib/messaging/proxy-factory.js.map +1 -1
  86. package/lib/permission.d.ts +2 -1
  87. package/lib/permission.d.ts.map +1 -1
  88. package/lib/permission.js +14 -13
  89. package/lib/permission.js.map +1 -1
  90. package/lib/plans.d.ts +210 -0
  91. package/lib/plans.d.ts.map +1 -0
  92. package/lib/plans.js +570 -0
  93. package/lib/plans.js.map +1 -0
  94. package/lib/protocol.d.ts +66 -13
  95. package/lib/protocol.d.ts.map +1 -1
  96. package/lib/protocol.js +68 -115
  97. package/lib/protocol.js.map +1 -1
  98. package/lib/snapshot-url.d.ts +14 -0
  99. package/lib/snapshot-url.d.ts.map +1 -0
  100. package/lib/snapshot-url.js +26 -0
  101. package/lib/snapshot-url.js.map +1 -0
  102. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
  103. package/lib/snapshot-url.spec.d.ts.map +1 -0
  104. package/lib/snapshot-url.spec.js +41 -0
  105. package/lib/snapshot-url.spec.js.map +1 -0
  106. package/lib/team-subscription-protocol.d.ts +4 -4
  107. package/lib/team-subscription-protocol.d.ts.map +1 -1
  108. package/lib/team-subscription-protocol.js +15 -12
  109. package/lib/team-subscription-protocol.js.map +1 -1
  110. package/lib/teams-projects-protocol.d.ts +103 -0
  111. package/lib/teams-projects-protocol.d.ts.map +1 -0
  112. package/lib/teams-projects-protocol.js +23 -0
  113. package/lib/teams-projects-protocol.js.map +1 -0
  114. package/lib/util/analytics.d.ts +8 -0
  115. package/lib/util/analytics.d.ts.map +1 -0
  116. package/lib/util/analytics.js +79 -0
  117. package/lib/util/analytics.js.map +1 -0
  118. package/lib/util/async-iterator.js +55 -133
  119. package/lib/util/async-iterator.js.map +1 -1
  120. package/lib/util/cancelable.js +17 -59
  121. package/lib/util/cancelable.js.map +1 -1
  122. package/lib/util/date-time.js +8 -8
  123. package/lib/util/date-time.js.map +1 -1
  124. package/lib/util/deferred.js +10 -12
  125. package/lib/util/deferred.js.map +1 -1
  126. package/lib/util/disposable.js +26 -39
  127. package/lib/util/disposable.js.map +1 -1
  128. package/lib/util/event.js +58 -74
  129. package/lib/util/event.js.map +1 -1
  130. package/lib/util/garbage-collected-cache.d.ts +1 -0
  131. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  132. package/lib/util/garbage-collected-cache.js +26 -46
  133. package/lib/util/garbage-collected-cache.js.map +1 -1
  134. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  135. package/lib/util/generate-workspace-id.js +13 -67
  136. package/lib/util/generate-workspace-id.js.map +1 -1
  137. package/lib/util/generate-workspace-id.spec.js +34 -79
  138. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  139. package/lib/util/gitpod-cookie.d.ts +20 -0
  140. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  141. package/lib/util/gitpod-cookie.js +44 -0
  142. package/lib/util/gitpod-cookie.js.map +1 -0
  143. package/lib/util/gitpod-host-url.d.ts +1 -1
  144. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  145. package/lib/util/gitpod-host-url.js +98 -98
  146. package/lib/util/gitpod-host-url.js.map +1 -1
  147. package/lib/util/gitpod-host-url.spec.d.ts +6 -0
  148. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  149. package/lib/util/gitpod-host-url.spec.js +102 -30
  150. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  151. package/lib/util/grpc.d.ts +15 -0
  152. package/lib/util/grpc.d.ts.map +1 -0
  153. package/lib/util/grpc.js +18 -0
  154. package/lib/util/grpc.js.map +1 -0
  155. package/lib/util/jaeger-client-types.d.ts +68 -0
  156. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  157. package/lib/util/{without.js → jaeger-client-types.js} +1 -1
  158. package/lib/util/jaeger-client-types.js.map +1 -0
  159. package/lib/util/logging.d.ts +49 -33
  160. package/lib/util/logging.d.ts.map +1 -1
  161. package/lib/util/logging.js +107 -110
  162. package/lib/util/logging.js.map +1 -1
  163. package/lib/util/make-link.js +2 -2
  164. package/lib/util/make-link.js.map +1 -1
  165. package/lib/util/parse-workspace-id.d.ts +10 -0
  166. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  167. package/lib/util/parse-workspace-id.js +31 -7
  168. package/lib/util/parse-workspace-id.js.map +1 -1
  169. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  170. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  171. package/lib/util/parse-workspace-id.spec.js +123 -84
  172. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  173. package/lib/util/queue.js +16 -55
  174. package/lib/util/queue.js.map +1 -1
  175. package/lib/util/queue.spec.js +144 -288
  176. package/lib/util/queue.spec.js.map +1 -1
  177. package/lib/util/repeat.d.ts +15 -0
  178. package/lib/util/repeat.d.ts.map +1 -0
  179. package/lib/util/repeat.js +55 -0
  180. package/lib/util/repeat.js.map +1 -0
  181. package/lib/util/safe-promise.js +9 -12
  182. package/lib/util/safe-promise.js.map +1 -1
  183. package/lib/util/semaphore.js +15 -46
  184. package/lib/util/semaphore.js.map +1 -1
  185. package/lib/util/skip-if.js +6 -6
  186. package/lib/util/skip-if.js.map +1 -1
  187. package/lib/util/timeutil.js +16 -16
  188. package/lib/util/timeutil.js.map +1 -1
  189. package/lib/util/timeutil.spec.js +21 -24
  190. package/lib/util/timeutil.spec.js.map +1 -1
  191. package/lib/util/tracing.d.ts +50 -5
  192. package/lib/util/tracing.d.ts.map +1 -1
  193. package/lib/util/tracing.js +169 -63
  194. package/lib/util/tracing.js.map +1 -1
  195. package/lib/util/tracing.spec.d.ts +7 -0
  196. package/lib/util/tracing.spec.d.ts.map +1 -0
  197. package/lib/util/tracing.spec.js +121 -0
  198. package/lib/util/tracing.spec.js.map +1 -0
  199. package/lib/util/workspace-port-authentication.js +2 -2
  200. package/lib/util/workspace-port-authentication.js.map +1 -1
  201. package/lib/workspace-cluster.d.ts +26 -4
  202. package/lib/workspace-cluster.d.ts.map +1 -1
  203. package/lib/workspace-cluster.js +3 -3
  204. package/lib/workspace-cluster.js.map +1 -1
  205. package/lib/workspace-instance.d.ts +5 -2
  206. package/lib/workspace-instance.d.ts.map +1 -1
  207. package/lib/wsready.d.ts +1 -1
  208. package/lib/wsready.js +2 -2
  209. package/package.json +29 -16
  210. package/pkg-yarn.lock +17 -9
  211. package/src/accounting-protocol.ts +4 -10
  212. package/src/admin-protocol.ts +33 -5
  213. package/src/analytics.ts +54 -0
  214. package/src/context-url.spec.ts +39 -0
  215. package/src/context-url.ts +51 -0
  216. package/src/email-protocol.ts +2 -3
  217. package/src/env.ts +10 -10
  218. package/src/gitpod-service.ts +131 -35
  219. package/src/headless-workspace-log.ts +7 -11
  220. package/src/ide-protocol.ts +92 -0
  221. package/src/index.ts +5 -1
  222. package/src/messaging/browser/connection.ts +184 -23
  223. package/src/messaging/client-call-metrics.ts +97 -0
  224. package/src/messaging/error.ts +5 -2
  225. package/src/messaging/handler.ts +12 -0
  226. package/src/messaging/node/connection.ts +3 -47
  227. package/src/messaging/proxy-factory.ts +13 -5
  228. package/src/permission.ts +2 -1
  229. package/src/plans.ts +632 -0
  230. package/src/protocol.ts +89 -18
  231. package/src/snapshot-url.spec.ts +25 -0
  232. package/src/snapshot-url.ts +27 -0
  233. package/src/team-subscription-protocol.ts +7 -5
  234. package/src/teams-projects-protocol.ts +132 -0
  235. package/src/util/analytics.ts +87 -0
  236. package/src/util/garbage-collected-cache.ts +9 -3
  237. package/src/util/generate-workspace-id.spec.ts +3 -3
  238. package/src/util/generate-workspace-id.ts +2 -0
  239. package/src/util/gitpod-cookie.ts +39 -0
  240. package/src/util/gitpod-host-url.spec.ts +24 -0
  241. package/src/util/gitpod-host-url.ts +23 -10
  242. package/src/util/grpc.ts +15 -0
  243. package/src/util/jaeger-client-types.ts +102 -0
  244. package/src/util/logging.ts +102 -38
  245. package/src/util/parse-workspace-id.spec.ts +21 -1
  246. package/src/util/parse-workspace-id.ts +32 -6
  247. package/src/util/repeat.ts +45 -0
  248. package/src/util/semaphore.ts +2 -2
  249. package/src/util/skip-if.ts +1 -1
  250. package/src/util/timeutil.ts +4 -4
  251. package/src/util/tracing.spec.ts +83 -0
  252. package/src/util/tracing.ts +153 -17
  253. package/src/workspace-cluster.ts +28 -10
  254. package/src/workspace-instance.ts +25 -13
  255. package/src/wsready.ts +2 -2
  256. package/lib/util/context-url.d.ts +0 -13
  257. package/lib/util/context-url.d.ts.map +0 -1
  258. package/lib/util/context-url.js +0 -26
  259. package/lib/util/context-url.js.map +0 -1
  260. package/lib/util/context-url.spec.d.ts.map +0 -1
  261. package/lib/util/context-url.spec.js +0 -52
  262. package/lib/util/context-url.spec.js.map +0 -1
  263. package/lib/util/repeater.d.ts +0 -22
  264. package/lib/util/repeater.d.ts.map +0 -1
  265. package/lib/util/repeater.js +0 -118
  266. package/lib/util/repeater.js.map +0 -1
  267. package/lib/util/without.d.ts +0 -7
  268. package/lib/util/without.d.ts.map +0 -1
  269. package/lib/util/without.js.map +0 -1
  270. package/src/util/context-url.spec.ts +0 -25
  271. package/src/util/context-url.ts +0 -23
  272. package/src/util/jaeger-client.d.ts +0 -105
  273. package/src/util/repeater.ts +0 -49
@@ -5,15 +5,19 @@
5
5
  */
6
6
 
7
7
  import {
8
- User, WorkspaceInfo, WorkspaceCreationResult, UserMessage, WorkspaceInstanceUser,
8
+ User, WorkspaceInfo, WorkspaceCreationResult, WorkspaceInstanceUser,
9
9
  WhitelistedRepository, WorkspaceImageBuild, AuthProviderInfo, Branding, CreateWorkspaceMode,
10
10
  Token, UserEnvVarValue, ResolvePluginsParams, PreparePluginUploadParams, Terms,
11
- ResolvedPlugins, Configuration, InstallPluginsParams, UninstallPluginParams, UserInfo, GitpodTokenType,
11
+ ResolvedPlugins, Configuration, InstallPluginsParams, UninstallPluginParams, UserInfo, GitpodTokenType,
12
12
  GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes
13
13
  } from './protocol';
14
+ import {
15
+ Team, TeamMemberInfo,
16
+ TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult
17
+ } from './teams-projects-protocol';
14
18
  import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
15
19
  import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
16
- import { HeadlessLogEvent } from './headless-workspace-log';
20
+ import { HeadlessLogUrls } from './headless-workspace-log';
17
21
  import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from './workspace-instance';
18
22
  import { AdminServer } from './admin-protocol';
19
23
  import { GitpodHostUrl } from './util/gitpod-host-url';
@@ -24,11 +28,14 @@ import { Emitter } from './util/event';
24
28
  import { AccountStatement, CreditAlert } from './accounting-protocol';
25
29
  import { GithubUpgradeURL, PlanCoupon } from './payment-protocol';
26
30
  import { TeamSubscription, TeamSubscriptionSlot, TeamSubscriptionSlotResolved } from './team-subscription-protocol';
31
+ import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from './analytics';
32
+ import { IDEServer } from './ide-protocol';
27
33
 
28
34
  export interface GitpodClient {
29
35
  onInstanceUpdate(instance: WorkspaceInstance): void;
30
36
  onWorkspaceImageBuildLogs: WorkspaceImageBuild.LogCallback;
31
- onHeadlessWorkspaceLogs(evt: HeadlessLogEvent): void;
37
+
38
+ onPrebuildUpdate(update: PrebuildWithStatus): void;
32
39
 
33
40
  onCreditAlert(creditAlert: CreditAlert): void;
34
41
 
@@ -39,7 +46,7 @@ export interface GitpodClient {
39
46
  }
40
47
 
41
48
  export const GitpodServer = Symbol('GitpodServer');
42
- export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
49
+ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
43
50
  // User related API
44
51
  getLoggedInUser(): Promise<User>;
45
52
  getTerms(): Promise<Terms>;
@@ -51,6 +58,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
51
58
  getBranding(): Promise<Branding>;
52
59
  getConfiguration(): Promise<Configuration>;
53
60
  getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
61
+ getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
54
62
  /**
55
63
  * @deprecated
56
64
  */
@@ -82,8 +90,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
82
90
  updateWorkspaceUserPin(id: string, action: GitpodServer.PinAction): Promise<void>;
83
91
  sendHeartBeat(options: GitpodServer.SendHeartBeatOptions): Promise<void>;
84
92
  watchWorkspaceImageBuildLogs(workspaceId: string): Promise<void>;
85
- watchHeadlessWorkspaceLogs(workspaceId: string): Promise<void>;
86
93
  isPrebuildDone(pwsid: string): Promise<boolean>;
94
+ getHeadlessLog(instanceId: string): Promise<HeadlessLogUrls>;
87
95
 
88
96
  // Workspace timeout
89
97
  setWorkspaceTimeout(workspaceId: string, duration: WorkspaceTimeoutDuration): Promise<SetWorkspaceTimeoutResult>;
@@ -97,19 +105,43 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
97
105
  openPort(workspaceId: string, port: WorkspaceInstancePort): Promise<WorkspaceInstancePort | undefined>;
98
106
  closePort(workspaceId: string, port: number): Promise<void>;
99
107
 
100
- // User messages
101
- getUserMessages(options: GitpodServer.GetUserMessagesOptions): Promise<UserMessage[]>;
102
- updateUserMessages(options: GitpodServer.UpdateUserMessagesOptions): Promise<void>;
103
-
104
108
  // User storage
105
109
  getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
106
110
  updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
107
111
 
108
- // user env vars
112
+ // User env vars
109
113
  getEnvVars(): Promise<UserEnvVarValue[]>;
114
+ getAllEnvVars(): Promise<UserEnvVarValue[]>;
110
115
  setEnvVar(variable: UserEnvVarValue): Promise<void>;
111
116
  deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
112
117
 
118
+ // Teams
119
+ getTeams(): Promise<Team[]>;
120
+ getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
121
+ createTeam(name: string): Promise<Team>;
122
+ joinTeam(inviteId: string): Promise<Team>;
123
+ setTeamMemberRole(teamId: string, userId: string, role: TeamMemberRole): Promise<void>;
124
+ removeTeamMember(teamId: string, userId: string): Promise<void>;
125
+ getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
126
+ resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
127
+ deleteTeam(teamId: string, userId: string): Promise<void>;
128
+
129
+ // Projects
130
+ getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
131
+ createProject(params: CreateProjectParams): Promise<Project>;
132
+ deleteProject(projectId: string): Promise<void>;
133
+ getTeamProjects(teamId: string): Promise<Project[]>;
134
+ getUserProjects(): Promise<Project[]>;
135
+ getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
136
+ findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
137
+ triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
138
+ cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
139
+ setProjectConfiguration(projectId: string, configString: string): Promise<void>;
140
+ fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
141
+ guessProjectConfiguration(projectId: string): Promise<string | undefined>;
142
+ fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
143
+ guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
144
+
113
145
  // content service
114
146
  getContentBlobUploadUrl(name: string): Promise<string>
115
147
  getContentBlobDownloadUrl(name: string): Promise<string>
@@ -124,10 +156,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
124
156
  registerGithubApp(installationId: string): Promise<void>;
125
157
 
126
158
  /**
127
- * Stores a new snapshot for the given workspace and bucketId
159
+ * Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
128
160
  * @return the snapshot id
129
161
  */
130
162
  takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
163
+ /**
164
+ *
165
+ * @param snapshotId
166
+ */
167
+ waitForSnapshot(snapshotId: string): Promise<void>;
131
168
 
132
169
  /**
133
170
  * Returns the list of snapshots that exist for a workspace.
@@ -159,16 +196,14 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
159
196
  * gitpod.io concerns
160
197
  */
161
198
  isStudent(): Promise<boolean>;
162
- getPrivateRepoTrialEndDate(): Promise<string | undefined>;
163
-
164
199
  /**
165
- *
200
+ *
166
201
  */
167
202
  getAccountStatement(options: GitpodServer.GetAccountStatementOptions): Promise<AccountStatement | undefined>;
168
203
  getRemainingUsageHours(): Promise<number>;
169
204
 
170
205
  /**
171
- *
206
+ *
172
207
  */
173
208
  getChargebeeSiteId(): Promise<string>;
174
209
  createPortalSession(): Promise<{}>;
@@ -178,7 +213,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
178
213
 
179
214
  getShowPaymentUI(): Promise<boolean>;
180
215
  isChargebeeCustomer(): Promise<boolean>;
181
- mayAccessPrivateRepo(): Promise<boolean>;
182
216
 
183
217
  subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
184
218
  subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
@@ -189,13 +223,61 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
189
223
  tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
190
224
  tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>
191
225
  tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
192
- tsAssignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, identityStr: string|undefined): Promise<void>
226
+ tsAssignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, identityStr: string | undefined): Promise<void>
193
227
  tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
194
228
  tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
195
229
  tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
196
230
 
197
231
  getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
198
232
 
233
+ /**
234
+ * Analytics
235
+ */
236
+ trackEvent(event: RemoteTrackMessage): Promise<void>;
237
+ trackLocation(event: RemotePageMessage): Promise<void>;
238
+ identifyUser(event: RemoteIdentifyMessage): Promise<void>;
239
+ }
240
+
241
+ export interface CreateProjectParams {
242
+ name: string;
243
+ slug?: string;
244
+ account: string;
245
+ provider: string;
246
+ cloneUrl: string;
247
+ teamId?: string;
248
+ userId?: string;
249
+ appInstallationId: string;
250
+ }
251
+ export interface FindPrebuildsParams {
252
+ projectId: string;
253
+ branch?: string;
254
+ latest?: boolean;
255
+ prebuildId?: string;
256
+ // default: 30
257
+ limit?: number;
258
+ }
259
+ export interface GetProviderRepositoriesParams {
260
+ provider: string;
261
+ hints?: { installationId: string } | object;
262
+ }
263
+ export interface ProviderRepository {
264
+ name: string;
265
+ path?: string;
266
+ account: string;
267
+ accountAvatarUrl: string;
268
+ cloneUrl: string;
269
+ updatedAt: string;
270
+ installationId?: number;
271
+ installationUpdatedAt?: string;
272
+
273
+ inUse?: boolean;
274
+ }
275
+
276
+ export interface ClientHeaderFields {
277
+ ip?: string;
278
+ userAgent?: string;
279
+ dnt?: string;
280
+ clientRegion?: string;
199
281
  }
200
282
 
201
283
  export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
@@ -208,6 +290,7 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
208
290
  methods.setClient = methods.setClient || (() => { });
209
291
  methods.dispose = methods.dispose || (() => { });
210
292
  return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
293
+ // @ts-ignore
211
294
  get: (target: S, property: keyof S) => {
212
295
  const result = target[property];
213
296
  if (!result) {
@@ -240,6 +323,8 @@ export namespace GitpodServer {
240
323
  limit?: number;
241
324
  searchString?: string;
242
325
  pinnedOnly?: boolean;
326
+ projectId?: string | string[];
327
+ includeWithoutProject?: boolean;
243
328
  }
244
329
  export interface GetAccountStatementOptions {
245
330
  date?: string;
@@ -247,6 +332,7 @@ export namespace GitpodServer {
247
332
  export interface CreateWorkspaceOptions {
248
333
  contextUrl: string;
249
334
  mode?: CreateWorkspaceMode;
335
+ forceDefaultConfig?: boolean;
250
336
  }
251
337
  export interface StartWorkspaceOptions {
252
338
  forceDefaultImage: boolean;
@@ -254,13 +340,8 @@ export namespace GitpodServer {
254
340
  export interface TakeSnapshotOptions {
255
341
  workspaceId: string;
256
342
  layoutData?: string;
257
- }
258
- export interface GetUserMessagesOptions {
259
- readonly releaseNotes?: boolean;
260
- readonly workspaceInstanceId: string;
261
- }
262
- export interface UpdateUserMessagesOptions {
263
- readonly messageIds: string[];
343
+ /* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
344
+ dontWait?: boolean;
264
345
  }
265
346
  export interface GetUserStorageResourceOptions {
266
347
  readonly uri: string;
@@ -322,11 +403,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
322
403
  }
323
404
  }
324
405
 
325
- onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
406
+ onPrebuildUpdate(update: PrebuildWithStatus): void {
326
407
  for (const client of this.clients) {
327
- if (client.onWorkspaceImageBuildLogs) {
408
+ if (client.onPrebuildUpdate) {
328
409
  try {
329
- client.onWorkspaceImageBuildLogs(info, content);
410
+ client.onPrebuildUpdate(update);
330
411
  } catch (error) {
331
412
  console.error(error)
332
413
  }
@@ -334,11 +415,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
334
415
  }
335
416
  }
336
417
 
337
- onHeadlessWorkspaceLogs(evt: HeadlessLogEvent): void {
418
+ onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
338
419
  for (const client of this.clients) {
339
- if (client.onHeadlessWorkspaceLogs) {
420
+ if (client.onWorkspaceImageBuildLogs) {
340
421
  try {
341
- client.onHeadlessWorkspaceLogs(evt);
422
+ client.onWorkspaceImageBuildLogs(info, content);
342
423
  } catch (error) {
343
424
  console.error(error)
344
425
  }
@@ -402,7 +483,7 @@ export class WorkspaceInstanceUpdateListener {
402
483
  private readonly onDidChangeEmitter = new Emitter<void>();
403
484
  readonly onDidChange = this.onDidChangeEmitter.event;
404
485
 
405
- private source: 'sync' | 'update' = 'sync';
486
+ private source: 'sync' | 'update' = 'sync';
406
487
 
407
488
  get info(): WorkspaceInfo {
408
489
  return this._info;
@@ -494,11 +575,15 @@ export class WorkspaceInstanceUpdateListener {
494
575
 
495
576
  }
496
577
 
578
+ export interface GitpodServiceOptions {
579
+ onReconnect?: () => (void | Promise<void>)
580
+ }
581
+
497
582
  export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
498
583
 
499
584
  private readonly compositeClient = new GitpodCompositeClient<Client>();
500
585
 
501
- constructor(public readonly server: JsonRpcProxy<Server>) {
586
+ constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
502
587
  server.setClient(this.compositeClient);
503
588
  server.onDidOpenConnection(() => this.compositeClient.notifyDidOpenConnection());
504
589
  server.onDidCloseConnection(() => this.compositeClient.notifyDidCloseConnection());
@@ -518,6 +603,12 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
518
603
  this.instanceListeners.set(workspaceId, listener);
519
604
  return listener;
520
605
  }
606
+
607
+ async reconnect(): Promise<void> {
608
+ if (this.options?.onReconnect) {
609
+ await this.options.onReconnect();
610
+ }
611
+ }
521
612
  }
522
613
 
523
614
  export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(serverUrl: string | Promise<string>) {
@@ -535,6 +626,11 @@ export function createGitpodService<C extends GitpodClient, S extends GitpodServ
535
626
  }
536
627
 
537
628
  const connectionProvider = new WebSocketConnectionProvider();
538
- const gitpodServer = connectionProvider.createProxy<S>(url);
539
- return new GitpodServiceImpl<C, S>(gitpodServer);
629
+ let onReconnect = () => { };
630
+ const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
631
+ onListening: socket => {
632
+ onReconnect = () => socket.reconnect();
633
+ }
634
+ });
635
+ return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
540
636
  }
@@ -22,21 +22,17 @@ export namespace HeadlessWorkspaceEventType {
22
22
  }
23
23
  }
24
24
 
25
- export interface HeadlessLogEvent {
25
+ export interface HeadlessWorkspaceEvent {
26
26
  workspaceID: string;
27
27
  text: string;
28
28
  type: HeadlessWorkspaceEventType;
29
29
  }
30
30
 
31
- export enum TheiaHeadlessLogType {
32
- TaskLogLabel = "workspaceTaskOutput",
33
- TaskFailedLabel = "workspaceTaskFailed",
34
- TaskSuccessfulLabel = "workspaceTaskDone"
31
+ export interface HeadlessLogUrls {
32
+ // A map of id to URL
33
+ streams: { [streamID: string]: string };
35
34
  }
36
35
 
37
- export interface TheiaHeadlessLogMessage {
38
- type: TheiaHeadlessLogType;
39
- data?: string;
40
- error?: string;
41
- snapshotURL?: string;
42
- }
36
+ /** cmp. @const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX */
37
+ export const HEADLESS_LOG_STREAM_STATUS_CODE = "X-LogStream-StatusCode";
38
+ export const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX = /X-LogStream-StatusCode: ([0-9]{3})/;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+
7
+ /**
8
+ * `IDEServer` provides a list of available IDEs.
9
+ */
10
+ export interface IDEServer {
11
+ /**
12
+ * Returns the IDE preferences.
13
+ */
14
+ getIDEOptions(): Promise<IDEOptions>;
15
+ }
16
+
17
+ export interface IDEOptions {
18
+ /**
19
+ * A list of available IDEs.
20
+ */
21
+ options: { [key: string]: IDEOption };
22
+
23
+ /**
24
+ * The default (browser) IDE when the user has not specified one.
25
+ */
26
+ defaultIde: string;
27
+
28
+ /**
29
+ * The default desktop IDE when the user has not specified one.
30
+ */
31
+ defaultDesktopIde: string;
32
+ }
33
+
34
+ export interface IDEOption {
35
+ /**
36
+ * To ensure a stable order one can set an `orderKey`.
37
+ */
38
+ orderKey?: string;
39
+
40
+ /**
41
+ * Human readable title text of the IDE (plain text only).
42
+ */
43
+ title: string;
44
+
45
+ /**
46
+ * The type of the IDE, currently 'browser' or 'desktop'.
47
+ */
48
+ type: 'browser' | 'desktop';
49
+
50
+ /**
51
+ * The logo for the IDE. That could be a key in (see
52
+ * components/dashboard/src/images/ideLogos.ts) or a URL.
53
+ */
54
+ logo: string;
55
+
56
+ /**
57
+ * Text of an optional tooltip (plain text only).
58
+ */
59
+ tooltip?: string;
60
+
61
+ /**
62
+ * Text of an optional label next to the IDE option like “Insiders” (plain
63
+ * text only).
64
+ */
65
+ label?: string;
66
+
67
+ /**
68
+ * Notes to the IDE option that are renderd in the preferences when a user
69
+ * chooses this IDE.
70
+ */
71
+ notes?: string[];
72
+
73
+ /**
74
+ * If `true` this IDE option is not visible in the IDE preferences.
75
+ */
76
+ hidden?: boolean;
77
+
78
+ /**
79
+ * The image ref to the IDE image.
80
+ */
81
+ image: string;
82
+
83
+ /**
84
+ * When this is `true`, the tag of this image is resolved to the latest
85
+ * image digest regularly.
86
+ *
87
+ * This is useful if this image points to a tag like `nightly` that will be
88
+ * updated regularly. When `resolveImageDigest` is `true`, we make sure that
89
+ * we resolve the tag regularly to the most recent image version.
90
+ */
91
+ resolveImageDigest?: boolean;
92
+ }
package/src/index.ts CHANGED
@@ -13,4 +13,8 @@ export * from './license-protocol';
13
13
  export * from './workspace-instance';
14
14
  export * from './permission';
15
15
  export * from './admin-protocol';
16
- export * from './email-protocol';
16
+ export * from './email-protocol';
17
+ export * from './headless-workspace-log';
18
+ export * from './context-url';
19
+ export * from './teams-projects-protocol';
20
+ export * from './snapshot-url';