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

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