@gitpod/gitpod-protocol 0.1.5-pluggable-workspace-cluster.21 → 0.1.5-port-description-3059-fork.6

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 (278) 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 +97 -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 +5 -0
  57. package/lib/index.d.ts.map +1 -1
  58. package/lib/index.js +5 -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/oss-allowlist.d.ts +14 -0
  87. package/lib/oss-allowlist.d.ts.map +1 -0
  88. package/lib/oss-allowlist.js +8 -0
  89. package/lib/oss-allowlist.js.map +1 -0
  90. package/lib/permission.d.ts +2 -1
  91. package/lib/permission.d.ts.map +1 -1
  92. package/lib/permission.js +14 -13
  93. package/lib/permission.js.map +1 -1
  94. package/lib/plans.d.ts +210 -0
  95. package/lib/plans.d.ts.map +1 -0
  96. package/lib/plans.js +570 -0
  97. package/lib/plans.js.map +1 -0
  98. package/lib/protocol.d.ts +68 -13
  99. package/lib/protocol.d.ts.map +1 -1
  100. package/lib/protocol.js +68 -115
  101. package/lib/protocol.js.map +1 -1
  102. package/lib/snapshot-url.d.ts +14 -0
  103. package/lib/snapshot-url.d.ts.map +1 -0
  104. package/lib/snapshot-url.js +26 -0
  105. package/lib/snapshot-url.js.map +1 -0
  106. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
  107. package/lib/snapshot-url.spec.d.ts.map +1 -0
  108. package/lib/snapshot-url.spec.js +41 -0
  109. package/lib/snapshot-url.spec.js.map +1 -0
  110. package/lib/team-subscription-protocol.d.ts +4 -4
  111. package/lib/team-subscription-protocol.d.ts.map +1 -1
  112. package/lib/team-subscription-protocol.js +15 -12
  113. package/lib/team-subscription-protocol.js.map +1 -1
  114. package/lib/teams-projects-protocol.d.ts +110 -0
  115. package/lib/teams-projects-protocol.d.ts.map +1 -0
  116. package/lib/teams-projects-protocol.js +23 -0
  117. package/lib/teams-projects-protocol.js.map +1 -0
  118. package/lib/util/analytics.d.ts +8 -0
  119. package/lib/util/analytics.d.ts.map +1 -0
  120. package/lib/util/analytics.js +79 -0
  121. package/lib/util/analytics.js.map +1 -0
  122. package/lib/util/async-iterator.js +55 -133
  123. package/lib/util/async-iterator.js.map +1 -1
  124. package/lib/util/cancelable.js +17 -59
  125. package/lib/util/cancelable.js.map +1 -1
  126. package/lib/util/date-time.js +8 -8
  127. package/lib/util/date-time.js.map +1 -1
  128. package/lib/util/deferred.js +10 -12
  129. package/lib/util/deferred.js.map +1 -1
  130. package/lib/util/disposable.js +26 -39
  131. package/lib/util/disposable.js.map +1 -1
  132. package/lib/util/event.js +58 -74
  133. package/lib/util/event.js.map +1 -1
  134. package/lib/util/garbage-collected-cache.d.ts +1 -0
  135. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  136. package/lib/util/garbage-collected-cache.js +26 -46
  137. package/lib/util/garbage-collected-cache.js.map +1 -1
  138. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  139. package/lib/util/generate-workspace-id.js +13 -67
  140. package/lib/util/generate-workspace-id.js.map +1 -1
  141. package/lib/util/generate-workspace-id.spec.js +34 -79
  142. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  143. package/lib/util/gitpod-cookie.d.ts +20 -0
  144. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  145. package/lib/util/gitpod-cookie.js +44 -0
  146. package/lib/util/gitpod-cookie.js.map +1 -0
  147. package/lib/util/gitpod-host-url.d.ts +1 -1
  148. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  149. package/lib/util/gitpod-host-url.js +98 -98
  150. package/lib/util/gitpod-host-url.js.map +1 -1
  151. package/lib/util/gitpod-host-url.spec.d.ts +6 -0
  152. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  153. package/lib/util/gitpod-host-url.spec.js +102 -30
  154. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  155. package/lib/util/grpc.d.ts +15 -0
  156. package/lib/util/grpc.d.ts.map +1 -0
  157. package/lib/util/grpc.js +18 -0
  158. package/lib/util/grpc.js.map +1 -0
  159. package/lib/util/jaeger-client-types.d.ts +68 -0
  160. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  161. package/lib/util/{without.js → jaeger-client-types.js} +1 -1
  162. package/lib/util/jaeger-client-types.js.map +1 -0
  163. package/lib/util/logging.d.ts +49 -33
  164. package/lib/util/logging.d.ts.map +1 -1
  165. package/lib/util/logging.js +107 -110
  166. package/lib/util/logging.js.map +1 -1
  167. package/lib/util/make-link.js +2 -2
  168. package/lib/util/make-link.js.map +1 -1
  169. package/lib/util/parse-workspace-id.d.ts +10 -0
  170. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  171. package/lib/util/parse-workspace-id.js +31 -7
  172. package/lib/util/parse-workspace-id.js.map +1 -1
  173. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  174. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  175. package/lib/util/parse-workspace-id.spec.js +123 -84
  176. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  177. package/lib/util/queue.js +16 -55
  178. package/lib/util/queue.js.map +1 -1
  179. package/lib/util/queue.spec.js +144 -288
  180. package/lib/util/queue.spec.js.map +1 -1
  181. package/lib/util/repeat.d.ts +15 -0
  182. package/lib/util/repeat.d.ts.map +1 -0
  183. package/lib/util/repeat.js +55 -0
  184. package/lib/util/repeat.js.map +1 -0
  185. package/lib/util/safe-promise.js +9 -12
  186. package/lib/util/safe-promise.js.map +1 -1
  187. package/lib/util/semaphore.js +15 -46
  188. package/lib/util/semaphore.js.map +1 -1
  189. package/lib/util/skip-if.js +6 -6
  190. package/lib/util/skip-if.js.map +1 -1
  191. package/lib/util/timeutil.js +16 -16
  192. package/lib/util/timeutil.js.map +1 -1
  193. package/lib/util/timeutil.spec.js +21 -24
  194. package/lib/util/timeutil.spec.js.map +1 -1
  195. package/lib/util/tracing.d.ts +50 -5
  196. package/lib/util/tracing.d.ts.map +1 -1
  197. package/lib/util/tracing.js +171 -63
  198. package/lib/util/tracing.js.map +1 -1
  199. package/lib/util/tracing.spec.d.ts +7 -0
  200. package/lib/util/tracing.spec.d.ts.map +1 -0
  201. package/lib/util/tracing.spec.js +121 -0
  202. package/lib/util/tracing.spec.js.map +1 -0
  203. package/lib/util/workspace-port-authentication.js +2 -2
  204. package/lib/util/workspace-port-authentication.js.map +1 -1
  205. package/lib/workspace-cluster.d.ts +22 -3
  206. package/lib/workspace-cluster.d.ts.map +1 -1
  207. package/lib/workspace-cluster.js +3 -3
  208. package/lib/workspace-cluster.js.map +1 -1
  209. package/lib/workspace-instance.d.ts +5 -2
  210. package/lib/workspace-instance.d.ts.map +1 -1
  211. package/lib/wsready.d.ts +1 -1
  212. package/lib/wsready.js +2 -2
  213. package/package.json +29 -16
  214. package/pkg-yarn.lock +17 -9
  215. package/src/accounting-protocol.ts +4 -10
  216. package/src/admin-protocol.ts +33 -5
  217. package/src/analytics.ts +54 -0
  218. package/src/context-url.spec.ts +39 -0
  219. package/src/context-url.ts +51 -0
  220. package/src/email-protocol.ts +2 -3
  221. package/src/env.ts +10 -10
  222. package/src/gitpod-service.ts +132 -35
  223. package/src/headless-workspace-log.ts +7 -11
  224. package/src/ide-protocol.ts +92 -0
  225. package/src/index.ts +6 -1
  226. package/src/messaging/browser/connection.ts +184 -23
  227. package/src/messaging/client-call-metrics.ts +97 -0
  228. package/src/messaging/error.ts +5 -2
  229. package/src/messaging/handler.ts +12 -0
  230. package/src/messaging/node/connection.ts +3 -47
  231. package/src/messaging/proxy-factory.ts +13 -5
  232. package/src/oss-allowlist.ts +15 -0
  233. package/src/permission.ts +2 -1
  234. package/src/plans.ts +632 -0
  235. package/src/protocol.ts +91 -18
  236. package/src/snapshot-url.spec.ts +25 -0
  237. package/src/snapshot-url.ts +27 -0
  238. package/src/team-subscription-protocol.ts +7 -5
  239. package/src/teams-projects-protocol.ts +141 -0
  240. package/src/util/analytics.ts +87 -0
  241. package/src/util/garbage-collected-cache.ts +9 -3
  242. package/src/util/generate-workspace-id.spec.ts +3 -3
  243. package/src/util/generate-workspace-id.ts +2 -0
  244. package/src/util/gitpod-cookie.ts +39 -0
  245. package/src/util/gitpod-host-url.spec.ts +24 -0
  246. package/src/util/gitpod-host-url.ts +23 -10
  247. package/src/util/grpc.ts +15 -0
  248. package/src/util/jaeger-client-types.ts +102 -0
  249. package/src/util/logging.ts +102 -38
  250. package/src/util/parse-workspace-id.spec.ts +21 -1
  251. package/src/util/parse-workspace-id.ts +32 -6
  252. package/src/util/repeat.ts +45 -0
  253. package/src/util/semaphore.ts +2 -2
  254. package/src/util/skip-if.ts +1 -1
  255. package/src/util/timeutil.ts +4 -4
  256. package/src/util/tracing.spec.ts +83 -0
  257. package/src/util/tracing.ts +157 -18
  258. package/src/workspace-cluster.ts +24 -8
  259. package/src/workspace-instance.ts +25 -13
  260. package/src/wsready.ts +2 -2
  261. package/lib/util/context-url.d.ts +0 -13
  262. package/lib/util/context-url.d.ts.map +0 -1
  263. package/lib/util/context-url.js +0 -26
  264. package/lib/util/context-url.js.map +0 -1
  265. package/lib/util/context-url.spec.d.ts.map +0 -1
  266. package/lib/util/context-url.spec.js +0 -52
  267. package/lib/util/context-url.spec.js.map +0 -1
  268. package/lib/util/repeater.d.ts +0 -22
  269. package/lib/util/repeater.d.ts.map +0 -1
  270. package/lib/util/repeater.js +0 -118
  271. package/lib/util/repeater.js.map +0 -1
  272. package/lib/util/without.d.ts +0 -7
  273. package/lib/util/without.d.ts.map +0 -1
  274. package/lib/util/without.js.map +0 -1
  275. package/src/util/context-url.spec.ts +0 -25
  276. package/src/util/context-url.ts +0 -23
  277. package/src/util/jaeger-client.d.ts +0 -105
  278. 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, PartialProject
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,44 @@ 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
+ fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
140
+ guessProjectConfiguration(projectId: string): Promise<string | undefined>;
141
+ fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
142
+ guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
143
+ setProjectConfiguration(projectId: string, configString: string): Promise<void>;
144
+ updateProjectPartial(partialProject: PartialProject): Promise<void>;
145
+
113
146
  // content service
114
147
  getContentBlobUploadUrl(name: string): Promise<string>
115
148
  getContentBlobDownloadUrl(name: string): Promise<string>
@@ -124,10 +157,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
124
157
  registerGithubApp(installationId: string): Promise<void>;
125
158
 
126
159
  /**
127
- * Stores a new snapshot for the given workspace and bucketId
160
+ * Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
128
161
  * @return the snapshot id
129
162
  */
130
163
  takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
164
+ /**
165
+ *
166
+ * @param snapshotId
167
+ */
168
+ waitForSnapshot(snapshotId: string): Promise<void>;
131
169
 
132
170
  /**
133
171
  * Returns the list of snapshots that exist for a workspace.
@@ -159,16 +197,14 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
159
197
  * gitpod.io concerns
160
198
  */
161
199
  isStudent(): Promise<boolean>;
162
- getPrivateRepoTrialEndDate(): Promise<string | undefined>;
163
-
164
200
  /**
165
- *
201
+ *
166
202
  */
167
203
  getAccountStatement(options: GitpodServer.GetAccountStatementOptions): Promise<AccountStatement | undefined>;
168
204
  getRemainingUsageHours(): Promise<number>;
169
205
 
170
206
  /**
171
- *
207
+ *
172
208
  */
173
209
  getChargebeeSiteId(): Promise<string>;
174
210
  createPortalSession(): Promise<{}>;
@@ -178,7 +214,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
178
214
 
179
215
  getShowPaymentUI(): Promise<boolean>;
180
216
  isChargebeeCustomer(): Promise<boolean>;
181
- mayAccessPrivateRepo(): Promise<boolean>;
182
217
 
183
218
  subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
184
219
  subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
@@ -189,13 +224,61 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
189
224
  tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
190
225
  tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>
191
226
  tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
192
- tsAssignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, identityStr: string|undefined): Promise<void>
227
+ tsAssignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, identityStr: string | undefined): Promise<void>
193
228
  tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
194
229
  tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
195
230
  tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
196
231
 
197
232
  getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
198
233
 
234
+ /**
235
+ * Analytics
236
+ */
237
+ trackEvent(event: RemoteTrackMessage): Promise<void>;
238
+ trackLocation(event: RemotePageMessage): Promise<void>;
239
+ identifyUser(event: RemoteIdentifyMessage): Promise<void>;
240
+ }
241
+
242
+ export interface CreateProjectParams {
243
+ name: string;
244
+ slug?: string;
245
+ account: string;
246
+ provider: string;
247
+ cloneUrl: string;
248
+ teamId?: string;
249
+ userId?: string;
250
+ appInstallationId: string;
251
+ }
252
+ export interface FindPrebuildsParams {
253
+ projectId: string;
254
+ branch?: string;
255
+ latest?: boolean;
256
+ prebuildId?: string;
257
+ // default: 30
258
+ limit?: number;
259
+ }
260
+ export interface GetProviderRepositoriesParams {
261
+ provider: string;
262
+ hints?: { installationId: string } | object;
263
+ }
264
+ export interface ProviderRepository {
265
+ name: string;
266
+ path?: string;
267
+ account: string;
268
+ accountAvatarUrl: string;
269
+ cloneUrl: string;
270
+ updatedAt: string;
271
+ installationId?: number;
272
+ installationUpdatedAt?: string;
273
+
274
+ inUse?: boolean;
275
+ }
276
+
277
+ export interface ClientHeaderFields {
278
+ ip?: string;
279
+ userAgent?: string;
280
+ dnt?: string;
281
+ clientRegion?: string;
199
282
  }
200
283
 
201
284
  export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
@@ -208,6 +291,7 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
208
291
  methods.setClient = methods.setClient || (() => { });
209
292
  methods.dispose = methods.dispose || (() => { });
210
293
  return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
294
+ // @ts-ignore
211
295
  get: (target: S, property: keyof S) => {
212
296
  const result = target[property];
213
297
  if (!result) {
@@ -240,6 +324,8 @@ export namespace GitpodServer {
240
324
  limit?: number;
241
325
  searchString?: string;
242
326
  pinnedOnly?: boolean;
327
+ projectId?: string | string[];
328
+ includeWithoutProject?: boolean;
243
329
  }
244
330
  export interface GetAccountStatementOptions {
245
331
  date?: string;
@@ -247,6 +333,7 @@ export namespace GitpodServer {
247
333
  export interface CreateWorkspaceOptions {
248
334
  contextUrl: string;
249
335
  mode?: CreateWorkspaceMode;
336
+ forceDefaultConfig?: boolean;
250
337
  }
251
338
  export interface StartWorkspaceOptions {
252
339
  forceDefaultImage: boolean;
@@ -254,13 +341,8 @@ export namespace GitpodServer {
254
341
  export interface TakeSnapshotOptions {
255
342
  workspaceId: string;
256
343
  layoutData?: string;
257
- }
258
- export interface GetUserMessagesOptions {
259
- readonly releaseNotes?: boolean;
260
- readonly workspaceInstanceId: string;
261
- }
262
- export interface UpdateUserMessagesOptions {
263
- readonly messageIds: string[];
344
+ /* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
345
+ dontWait?: boolean;
264
346
  }
265
347
  export interface GetUserStorageResourceOptions {
266
348
  readonly uri: string;
@@ -322,11 +404,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
322
404
  }
323
405
  }
324
406
 
325
- onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
407
+ onPrebuildUpdate(update: PrebuildWithStatus): void {
326
408
  for (const client of this.clients) {
327
- if (client.onWorkspaceImageBuildLogs) {
409
+ if (client.onPrebuildUpdate) {
328
410
  try {
329
- client.onWorkspaceImageBuildLogs(info, content);
411
+ client.onPrebuildUpdate(update);
330
412
  } catch (error) {
331
413
  console.error(error)
332
414
  }
@@ -334,11 +416,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
334
416
  }
335
417
  }
336
418
 
337
- onHeadlessWorkspaceLogs(evt: HeadlessLogEvent): void {
419
+ onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
338
420
  for (const client of this.clients) {
339
- if (client.onHeadlessWorkspaceLogs) {
421
+ if (client.onWorkspaceImageBuildLogs) {
340
422
  try {
341
- client.onHeadlessWorkspaceLogs(evt);
423
+ client.onWorkspaceImageBuildLogs(info, content);
342
424
  } catch (error) {
343
425
  console.error(error)
344
426
  }
@@ -402,7 +484,7 @@ export class WorkspaceInstanceUpdateListener {
402
484
  private readonly onDidChangeEmitter = new Emitter<void>();
403
485
  readonly onDidChange = this.onDidChangeEmitter.event;
404
486
 
405
- private source: 'sync' | 'update' = 'sync';
487
+ private source: 'sync' | 'update' = 'sync';
406
488
 
407
489
  get info(): WorkspaceInfo {
408
490
  return this._info;
@@ -494,11 +576,15 @@ export class WorkspaceInstanceUpdateListener {
494
576
 
495
577
  }
496
578
 
579
+ export interface GitpodServiceOptions {
580
+ onReconnect?: () => (void | Promise<void>)
581
+ }
582
+
497
583
  export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
498
584
 
499
585
  private readonly compositeClient = new GitpodCompositeClient<Client>();
500
586
 
501
- constructor(public readonly server: JsonRpcProxy<Server>) {
587
+ constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
502
588
  server.setClient(this.compositeClient);
503
589
  server.onDidOpenConnection(() => this.compositeClient.notifyDidOpenConnection());
504
590
  server.onDidCloseConnection(() => this.compositeClient.notifyDidCloseConnection());
@@ -518,6 +604,12 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
518
604
  this.instanceListeners.set(workspaceId, listener);
519
605
  return listener;
520
606
  }
607
+
608
+ async reconnect(): Promise<void> {
609
+ if (this.options?.onReconnect) {
610
+ await this.options.onReconnect();
611
+ }
612
+ }
521
613
  }
522
614
 
523
615
  export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(serverUrl: string | Promise<string>) {
@@ -535,6 +627,11 @@ export function createGitpodService<C extends GitpodClient, S extends GitpodServ
535
627
  }
536
628
 
537
629
  const connectionProvider = new WebSocketConnectionProvider();
538
- const gitpodServer = connectionProvider.createProxy<S>(url);
539
- return new GitpodServiceImpl<C, S>(gitpodServer);
630
+ let onReconnect = () => { };
631
+ const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
632
+ onListening: socket => {
633
+ onReconnect = () => socket.reconnect();
634
+ }
635
+ });
636
+ return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
540
637
  }
@@ -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,9 @@ 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';
21
+ export * from './oss-allowlist';