@gitpod/gitpod-protocol 0.1.5-prs-loadgen-update.1 → 0.1.5-prs-test-dazzle-rewrite.22

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 (255) hide show
  1. package/data/gitpod-schema.json +9 -2
  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 +9 -4
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +2 -13
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +13 -2
  11. package/lib/analytics.d.ts.map +1 -1
  12. package/lib/analytics.js.map +1 -1
  13. package/lib/context-url.js +4 -4
  14. package/lib/context-url.js.map +1 -1
  15. package/lib/context-url.spec.js +45 -48
  16. package/lib/context-url.spec.js.map +1 -1
  17. package/lib/email-protocol.d.ts +1 -2
  18. package/lib/email-protocol.d.ts.map +1 -1
  19. package/lib/email-protocol.js +4 -4
  20. package/lib/email-protocol.js.map +1 -1
  21. package/lib/encryption/container-module.js +4 -4
  22. package/lib/encryption/container-module.js.map +1 -1
  23. package/lib/encryption/encryption-engine.js +19 -20
  24. package/lib/encryption/encryption-engine.js.map +1 -1
  25. package/lib/encryption/encryption-engine.spec.js +29 -36
  26. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  27. package/lib/encryption/encryption-service.js +29 -43
  28. package/lib/encryption/encryption-service.js.map +1 -1
  29. package/lib/encryption/key-provider.js +25 -30
  30. package/lib/encryption/key-provider.js.map +1 -1
  31. package/lib/env.d.ts +1 -2
  32. package/lib/env.d.ts.map +1 -1
  33. package/lib/env.js +20 -21
  34. package/lib/env.js.map +1 -1
  35. package/lib/gitpod-file-parser.js +25 -41
  36. package/lib/gitpod-file-parser.js.map +1 -1
  37. package/lib/gitpod-file-parser.spec.js +116 -116
  38. package/lib/gitpod-file-parser.spec.js.map +1 -1
  39. package/lib/gitpod-service.d.ts +58 -20
  40. package/lib/gitpod-service.d.ts.map +1 -1
  41. package/lib/gitpod-service.js +149 -295
  42. package/lib/gitpod-service.js.map +1 -1
  43. package/lib/headless-workspace-log.d.ts +2 -13
  44. package/lib/headless-workspace-log.d.ts.map +1 -1
  45. package/lib/headless-workspace-log.js +1 -7
  46. package/lib/headless-workspace-log.js.map +1 -1
  47. package/lib/ide-protocol.d.ts +81 -0
  48. package/lib/ide-protocol.d.ts.map +1 -0
  49. package/lib/ide-protocol.js +8 -0
  50. package/lib/ide-protocol.js.map +1 -0
  51. package/lib/index.d.ts +3 -0
  52. package/lib/index.d.ts.map +1 -1
  53. package/lib/index.js +3 -0
  54. package/lib/index.js.map +1 -1
  55. package/lib/messaging/browser/connection.d.ts +3 -3
  56. package/lib/messaging/browser/connection.d.ts.map +1 -1
  57. package/lib/messaging/browser/connection.js +172 -35
  58. package/lib/messaging/browser/connection.js.map +1 -1
  59. package/lib/messaging/browser/window-connection.js +35 -55
  60. package/lib/messaging/browser/window-connection.js.map +1 -1
  61. package/lib/messaging/client-call-metrics.d.ts +35 -0
  62. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  63. package/lib/messaging/client-call-metrics.js +83 -0
  64. package/lib/messaging/client-call-metrics.js.map +1 -0
  65. package/lib/messaging/connection-error-handler.js +11 -23
  66. package/lib/messaging/connection-error-handler.js.map +1 -1
  67. package/lib/messaging/error.d.ts +2 -1
  68. package/lib/messaging/error.d.ts.map +1 -1
  69. package/lib/messaging/error.js +4 -2
  70. package/lib/messaging/error.js.map +1 -1
  71. package/lib/messaging/handler.d.ts +10 -0
  72. package/lib/messaging/handler.d.ts.map +1 -1
  73. package/lib/messaging/node/connection.d.ts +0 -10
  74. package/lib/messaging/node/connection.d.ts.map +1 -1
  75. package/lib/messaging/node/connection.js +12 -50
  76. package/lib/messaging/node/connection.js.map +1 -1
  77. package/lib/messaging/proxy-factory.d.ts +2 -0
  78. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  79. package/lib/messaging/proxy-factory.js +74 -159
  80. package/lib/messaging/proxy-factory.js.map +1 -1
  81. package/lib/oss-allowlist.d.ts +14 -0
  82. package/lib/oss-allowlist.d.ts.map +1 -0
  83. package/lib/oss-allowlist.js +8 -0
  84. package/lib/oss-allowlist.js.map +1 -0
  85. package/lib/permission.d.ts +1 -2
  86. package/lib/permission.d.ts.map +1 -1
  87. package/lib/permission.js +12 -13
  88. package/lib/permission.js.map +1 -1
  89. package/lib/plans.d.ts +1 -1
  90. package/lib/plans.d.ts.map +1 -1
  91. package/lib/plans.js +38 -57
  92. package/lib/plans.js.map +1 -1
  93. package/lib/protocol.d.ts +44 -94
  94. package/lib/protocol.d.ts.map +1 -1
  95. package/lib/protocol.js +57 -114
  96. package/lib/protocol.js.map +1 -1
  97. package/lib/snapshot-url.d.ts +14 -0
  98. package/lib/snapshot-url.d.ts.map +1 -0
  99. package/lib/snapshot-url.js +26 -0
  100. package/lib/snapshot-url.js.map +1 -0
  101. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
  102. package/lib/snapshot-url.spec.d.ts.map +1 -0
  103. package/lib/snapshot-url.spec.js +41 -0
  104. package/lib/snapshot-url.spec.js.map +1 -0
  105. package/lib/team-subscription-protocol.d.ts +2 -3
  106. package/lib/team-subscription-protocol.d.ts.map +1 -1
  107. package/lib/team-subscription-protocol.js +13 -13
  108. package/lib/team-subscription-protocol.js.map +1 -1
  109. package/lib/teams-projects-protocol.d.ts +110 -0
  110. package/lib/teams-projects-protocol.d.ts.map +1 -0
  111. package/lib/teams-projects-protocol.js +23 -0
  112. package/lib/teams-projects-protocol.js.map +1 -0
  113. package/lib/util/analytics.d.ts.map +1 -1
  114. package/lib/util/analytics.js +35 -26
  115. package/lib/util/analytics.js.map +1 -1
  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.d.ts +1 -0
  129. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  130. package/lib/util/garbage-collected-cache.js +26 -46
  131. package/lib/util/garbage-collected-cache.js.map +1 -1
  132. package/lib/util/generate-workspace-id.d.ts +1 -1
  133. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  134. package/lib/util/generate-workspace-id.js +28 -68
  135. package/lib/util/generate-workspace-id.js.map +1 -1
  136. package/lib/util/generate-workspace-id.spec.js +56 -78
  137. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  138. package/lib/util/gitpod-cookie.d.ts +20 -0
  139. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  140. package/lib/util/gitpod-cookie.js +44 -0
  141. package/lib/util/gitpod-cookie.js.map +1 -0
  142. package/lib/util/gitpod-host-url.d.ts +1 -1
  143. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  144. package/lib/util/gitpod-host-url.js +93 -103
  145. package/lib/util/gitpod-host-url.js.map +1 -1
  146. package/lib/util/gitpod-host-url.spec.js +87 -135
  147. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  148. package/lib/util/grpc.d.ts +15 -0
  149. package/lib/util/grpc.d.ts.map +1 -0
  150. package/lib/util/grpc.js +18 -0
  151. package/lib/util/grpc.js.map +1 -0
  152. package/lib/util/jaeger-client-types.d.ts +68 -0
  153. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  154. package/lib/util/{without.js → jaeger-client-types.js} +1 -1
  155. package/lib/util/jaeger-client-types.js.map +1 -0
  156. package/lib/util/logging.d.ts +49 -33
  157. package/lib/util/logging.d.ts.map +1 -1
  158. package/lib/util/logging.js +107 -110
  159. package/lib/util/logging.js.map +1 -1
  160. package/lib/util/make-link.js +2 -2
  161. package/lib/util/make-link.js.map +1 -1
  162. package/lib/util/parse-workspace-id.d.ts +10 -0
  163. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  164. package/lib/util/parse-workspace-id.js +31 -7
  165. package/lib/util/parse-workspace-id.js.map +1 -1
  166. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  167. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  168. package/lib/util/parse-workspace-id.spec.js +123 -84
  169. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  170. package/lib/util/queue.js +16 -55
  171. package/lib/util/queue.js.map +1 -1
  172. package/lib/util/queue.spec.js +144 -288
  173. package/lib/util/queue.spec.js.map +1 -1
  174. package/lib/util/repeat.d.ts +15 -0
  175. package/lib/util/repeat.d.ts.map +1 -0
  176. package/lib/util/repeat.js +55 -0
  177. package/lib/util/repeat.js.map +1 -0
  178. package/lib/util/safe-promise.js +9 -12
  179. package/lib/util/safe-promise.js.map +1 -1
  180. package/lib/util/semaphore.js +15 -46
  181. package/lib/util/semaphore.js.map +1 -1
  182. package/lib/util/skip-if.js +6 -6
  183. package/lib/util/skip-if.js.map +1 -1
  184. package/lib/util/timeutil.js +16 -16
  185. package/lib/util/timeutil.js.map +1 -1
  186. package/lib/util/timeutil.spec.js +21 -24
  187. package/lib/util/timeutil.spec.js.map +1 -1
  188. package/lib/util/tracing.d.ts +50 -5
  189. package/lib/util/tracing.d.ts.map +1 -1
  190. package/lib/util/tracing.js +175 -63
  191. package/lib/util/tracing.js.map +1 -1
  192. package/lib/util/tracing.spec.d.ts +7 -0
  193. package/lib/util/tracing.spec.d.ts.map +1 -0
  194. package/lib/util/tracing.spec.js +121 -0
  195. package/lib/util/tracing.spec.js.map +1 -0
  196. package/lib/util/workspace-port-authentication.js +2 -2
  197. package/lib/util/workspace-port-authentication.js.map +1 -1
  198. package/lib/workspace-cluster.d.ts +12 -3
  199. package/lib/workspace-cluster.d.ts.map +1 -1
  200. package/lib/workspace-cluster.js +3 -3
  201. package/lib/workspace-cluster.js.map +1 -1
  202. package/lib/workspace-instance.d.ts +5 -2
  203. package/lib/workspace-instance.d.ts.map +1 -1
  204. package/lib/wsready.js +1 -1
  205. package/package.json +24 -13
  206. package/pkg-yarn.lock +14 -7
  207. package/provenance-bundle.jsonl +2 -0
  208. package/src/accounting-protocol.ts +4 -10
  209. package/src/admin-protocol.ts +10 -5
  210. package/src/analytics.ts +16 -2
  211. package/src/email-protocol.ts +2 -3
  212. package/src/env.ts +10 -10
  213. package/src/gitpod-service.ts +74 -31
  214. package/src/headless-workspace-log.ts +2 -15
  215. package/src/ide-protocol.ts +92 -0
  216. package/src/index.ts +3 -0
  217. package/src/messaging/browser/connection.ts +176 -10
  218. package/src/messaging/client-call-metrics.ts +97 -0
  219. package/src/messaging/error.ts +5 -2
  220. package/src/messaging/handler.ts +12 -0
  221. package/src/messaging/node/connection.ts +3 -47
  222. package/src/messaging/proxy-factory.ts +13 -5
  223. package/src/oss-allowlist.ts +15 -0
  224. package/src/permission.ts +0 -1
  225. package/src/protocol.ts +61 -105
  226. package/src/snapshot-url.spec.ts +25 -0
  227. package/src/snapshot-url.ts +27 -0
  228. package/src/team-subscription-protocol.ts +3 -4
  229. package/src/teams-projects-protocol.ts +141 -0
  230. package/src/util/analytics.ts +17 -1
  231. package/src/util/garbage-collected-cache.ts +7 -1
  232. package/src/util/generate-workspace-id.spec.ts +16 -0
  233. package/src/util/generate-workspace-id.ts +19 -2
  234. package/src/util/gitpod-cookie.ts +39 -0
  235. package/src/util/gitpod-host-url.ts +10 -10
  236. package/src/util/grpc.ts +15 -0
  237. package/src/util/jaeger-client-types.ts +102 -0
  238. package/src/util/logging.ts +102 -38
  239. package/src/util/parse-workspace-id.spec.ts +21 -1
  240. package/src/util/parse-workspace-id.ts +32 -6
  241. package/src/util/repeat.ts +45 -0
  242. package/src/util/tracing.spec.ts +83 -0
  243. package/src/util/tracing.ts +162 -18
  244. package/src/workspace-cluster.ts +9 -3
  245. package/src/workspace-instance.ts +15 -6
  246. package/src/wsready.ts +1 -1
  247. package/lib/util/repeater.d.ts +0 -22
  248. package/lib/util/repeater.d.ts.map +0 -1
  249. package/lib/util/repeater.js +0 -118
  250. package/lib/util/repeater.js.map +0 -1
  251. package/lib/util/without.d.ts +0 -7
  252. package/lib/util/without.d.ts.map +0 -1
  253. package/lib/util/without.js.map +0 -1
  254. package/src/util/jaeger-client.d.ts +0 -105
  255. package/src/util/repeater.ts +0 -49
@@ -6,15 +6,18 @@
6
6
 
7
7
  import {
8
8
  User, WorkspaceInfo, WorkspaceCreationResult, WorkspaceInstanceUser,
9
- WhitelistedRepository, WorkspaceImageBuild, AuthProviderInfo, Branding, CreateWorkspaceMode,
9
+ WhitelistedRepository, WorkspaceImageBuild, AuthProviderInfo, CreateWorkspaceMode,
10
10
  Token, UserEnvVarValue, ResolvePluginsParams, PreparePluginUploadParams, Terms,
11
11
  ResolvedPlugins, Configuration, InstallPluginsParams, UninstallPluginParams, UserInfo, GitpodTokenType,
12
- GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes, Team, TeamMemberInfo,
13
- TeamMembershipInvite, Project, ProjectInfo, PrebuildInfo, TeamMemberRole
12
+ GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes
14
13
  } from './protocol';
14
+ import {
15
+ Team, TeamMemberInfo,
16
+ TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult, PartialProject
17
+ } from './teams-projects-protocol';
15
18
  import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
16
19
  import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
17
- import { HeadlessLogEvent, HeadlessLogSources } from './headless-workspace-log';
20
+ import { HeadlessLogUrls } from './headless-workspace-log';
18
21
  import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from './workspace-instance';
19
22
  import { AdminServer } from './admin-protocol';
20
23
  import { GitpodHostUrl } from './util/gitpod-host-url';
@@ -25,12 +28,14 @@ import { Emitter } from './util/event';
25
28
  import { AccountStatement, CreditAlert } from './accounting-protocol';
26
29
  import { GithubUpgradeURL, PlanCoupon } from './payment-protocol';
27
30
  import { TeamSubscription, TeamSubscriptionSlot, TeamSubscriptionSlotResolved } from './team-subscription-protocol';
28
- import { RemoteTrackMessage } from './analytics';
31
+ import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from './analytics';
32
+ import { IDEServer } from './ide-protocol';
29
33
 
30
34
  export interface GitpodClient {
31
35
  onInstanceUpdate(instance: WorkspaceInstance): void;
32
36
  onWorkspaceImageBuildLogs: WorkspaceImageBuild.LogCallback;
33
- onHeadlessWorkspaceLogs(evt: HeadlessLogEvent): void;
37
+
38
+ onPrebuildUpdate(update: PrebuildWithStatus): void;
34
39
 
35
40
  onCreditAlert(creditAlert: CreditAlert): void;
36
41
 
@@ -41,7 +46,7 @@ export interface GitpodClient {
41
46
  }
42
47
 
43
48
  export const GitpodServer = Symbol('GitpodServer');
44
- export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
49
+ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
45
50
  // User related API
46
51
  getLoggedInUser(): Promise<User>;
47
52
  getTerms(): Promise<Terms>;
@@ -50,9 +55,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
50
55
  getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
51
56
  updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
52
57
  deleteOwnAuthProvider(params: GitpodServer.DeleteOwnAuthProviderParams): Promise<void>;
53
- getBranding(): Promise<Branding>;
54
58
  getConfiguration(): Promise<Configuration>;
55
59
  getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
60
+ getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
56
61
  /**
57
62
  * @deprecated
58
63
  */
@@ -84,9 +89,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
84
89
  updateWorkspaceUserPin(id: string, action: GitpodServer.PinAction): Promise<void>;
85
90
  sendHeartBeat(options: GitpodServer.SendHeartBeatOptions): Promise<void>;
86
91
  watchWorkspaceImageBuildLogs(workspaceId: string): Promise<void>;
87
- watchHeadlessWorkspaceLogs(workspaceId: string): Promise<void>;
88
92
  isPrebuildDone(pwsid: string): Promise<boolean>;
89
- getHeadlessLog(instanceId: string): Promise<HeadlessLogSources>;
93
+ getHeadlessLog(instanceId: string): Promise<HeadlessLogUrls>;
90
94
 
91
95
  // Workspace timeout
92
96
  setWorkspaceTimeout(workspaceId: string, duration: WorkspaceTimeoutDuration): Promise<SetWorkspaceTimeoutResult>;
@@ -104,13 +108,13 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
104
108
  getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
105
109
  updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
106
110
 
107
- // user env vars
111
+ // User env vars
108
112
  getEnvVars(): Promise<UserEnvVarValue[]>;
109
113
  getAllEnvVars(): Promise<UserEnvVarValue[]>;
110
114
  setEnvVar(variable: UserEnvVarValue): Promise<void>;
111
115
  deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
112
116
 
113
- // teams and projects
117
+ // Teams
114
118
  getTeams(): Promise<Team[]>;
115
119
  getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
116
120
  createTeam(name: string): Promise<Team>;
@@ -119,6 +123,24 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
119
123
  removeTeamMember(teamId: string, userId: string): Promise<void>;
120
124
  getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
121
125
  resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
126
+ deleteTeam(teamId: string, userId: string): Promise<void>;
127
+
128
+ // Projects
129
+ getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
130
+ createProject(params: CreateProjectParams): Promise<Project>;
131
+ deleteProject(projectId: string): Promise<void>;
132
+ getTeamProjects(teamId: string): Promise<Project[]>;
133
+ getUserProjects(): Promise<Project[]>;
134
+ getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
135
+ findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
136
+ triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
137
+ cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
138
+ fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
139
+ guessProjectConfiguration(projectId: string): Promise<string | undefined>;
140
+ fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
141
+ guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
142
+ setProjectConfiguration(projectId: string, configString: string): Promise<void>;
143
+ updateProjectPartial(partialProject: PartialProject): Promise<void>;
122
144
 
123
145
  // content service
124
146
  getContentBlobUploadUrl(name: string): Promise<string>
@@ -134,10 +156,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
134
156
  registerGithubApp(installationId: string): Promise<void>;
135
157
 
136
158
  /**
137
- * 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`.
138
160
  * @return the snapshot id
139
161
  */
140
162
  takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
163
+ /**
164
+ *
165
+ * @param snapshotId
166
+ */
167
+ waitForSnapshot(snapshotId: string): Promise<void>;
141
168
 
142
169
  /**
143
170
  * Returns the list of snapshots that exist for a workspace.
@@ -169,8 +196,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
169
196
  * gitpod.io concerns
170
197
  */
171
198
  isStudent(): Promise<boolean>;
172
- getPrivateRepoTrialEndDate(): Promise<string | undefined>;
173
-
174
199
  /**
175
200
  *
176
201
  */
@@ -188,7 +213,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
188
213
 
189
214
  getShowPaymentUI(): Promise<boolean>;
190
215
  isChargebeeCustomer(): Promise<boolean>;
191
- mayAccessPrivateRepo(): Promise<boolean>;
192
216
 
193
217
  subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
194
218
  subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
@@ -206,40 +230,54 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
206
230
 
207
231
  getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
208
232
 
209
- /**
210
- * projects
211
- */
212
- getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
213
- createProject(params: CreateProjectParams): Promise<Project>;
214
- getProjects(teamId: string): Promise<ProjectInfo[]>;
215
- getPrebuilds(teamId: string, project: string): Promise<PrebuildInfo[]>;
216
-
217
233
  /**
218
234
  * Analytics
219
235
  */
220
236
  trackEvent(event: RemoteTrackMessage): Promise<void>;
237
+ trackLocation(event: RemotePageMessage): Promise<void>;
238
+ identifyUser(event: RemoteIdentifyMessage): Promise<void>;
221
239
  }
222
240
 
223
241
  export interface CreateProjectParams {
224
242
  name: string;
243
+ slug?: string;
225
244
  account: string;
226
245
  provider: string;
227
246
  cloneUrl: string;
228
- teamId: string;
247
+ teamId?: string;
248
+ userId?: string;
229
249
  appInstallationId: string;
230
250
  }
251
+ export interface FindPrebuildsParams {
252
+ projectId: string;
253
+ branch?: string;
254
+ latest?: boolean;
255
+ prebuildId?: string;
256
+ // default: 30
257
+ limit?: number;
258
+ }
231
259
  export interface GetProviderRepositoriesParams {
232
260
  provider: string;
233
261
  hints?: { installationId: string } | object;
234
262
  }
235
263
  export interface ProviderRepository {
236
264
  name: string;
265
+ path?: string;
237
266
  account: string;
238
267
  accountAvatarUrl: string;
239
268
  cloneUrl: string;
240
269
  updatedAt: string;
241
270
  installationId?: number;
242
271
  installationUpdatedAt?: string;
272
+
273
+ inUse?: { userName: string };
274
+ }
275
+
276
+ export interface ClientHeaderFields {
277
+ ip?: string;
278
+ userAgent?: string;
279
+ dnt?: string;
280
+ clientRegion?: string;
243
281
  }
244
282
 
245
283
  export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
@@ -285,6 +323,8 @@ export namespace GitpodServer {
285
323
  limit?: number;
286
324
  searchString?: string;
287
325
  pinnedOnly?: boolean;
326
+ projectId?: string | string[];
327
+ includeWithoutProject?: boolean;
288
328
  }
289
329
  export interface GetAccountStatementOptions {
290
330
  date?: string;
@@ -292,6 +332,7 @@ export namespace GitpodServer {
292
332
  export interface CreateWorkspaceOptions {
293
333
  contextUrl: string;
294
334
  mode?: CreateWorkspaceMode;
335
+ forceDefaultConfig?: boolean;
295
336
  }
296
337
  export interface StartWorkspaceOptions {
297
338
  forceDefaultImage: boolean;
@@ -299,6 +340,8 @@ export namespace GitpodServer {
299
340
  export interface TakeSnapshotOptions {
300
341
  workspaceId: string;
301
342
  layoutData?: string;
343
+ /* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
344
+ dontWait?: boolean;
302
345
  }
303
346
  export interface GetUserStorageResourceOptions {
304
347
  readonly uri: string;
@@ -360,11 +403,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
360
403
  }
361
404
  }
362
405
 
363
- onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
406
+ onPrebuildUpdate(update: PrebuildWithStatus): void {
364
407
  for (const client of this.clients) {
365
- if (client.onWorkspaceImageBuildLogs) {
408
+ if (client.onPrebuildUpdate) {
366
409
  try {
367
- client.onWorkspaceImageBuildLogs(info, content);
410
+ client.onPrebuildUpdate(update);
368
411
  } catch (error) {
369
412
  console.error(error)
370
413
  }
@@ -372,11 +415,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
372
415
  }
373
416
  }
374
417
 
375
- onHeadlessWorkspaceLogs(evt: HeadlessLogEvent): void {
418
+ onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
376
419
  for (const client of this.clients) {
377
- if (client.onHeadlessWorkspaceLogs) {
420
+ if (client.onWorkspaceImageBuildLogs) {
378
421
  try {
379
- client.onHeadlessWorkspaceLogs(evt);
422
+ client.onWorkspaceImageBuildLogs(info, content);
380
423
  } catch (error) {
381
424
  console.error(error)
382
425
  }
@@ -22,26 +22,13 @@ 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"
35
- }
36
-
37
- export interface TheiaHeadlessLogMessage {
38
- type: TheiaHeadlessLogType;
39
- data?: string;
40
- error?: string;
41
- snapshotURL?: string;
42
- }
43
-
44
- export interface HeadlessLogSources {
31
+ export interface HeadlessLogUrls {
45
32
  // A map of id to URL
46
33
  streams: { [streamID: string]: string };
47
34
  }
@@ -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
@@ -16,3 +16,6 @@ export * from './admin-protocol';
16
16
  export * from './email-protocol';
17
17
  export * from './headless-workspace-log';
18
18
  export * from './context-url';
19
+ export * from './teams-projects-protocol';
20
+ export * from './snapshot-url';
21
+ export * from './oss-allowlist';
@@ -5,10 +5,13 @@
5
5
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
6
  */
7
7
 
8
- import { listen as doListen, Logger, ConsoleLogger } from "vscode-ws-jsonrpc";
8
+ import { Logger, ConsoleLogger, toSocket, IWebSocket } from "vscode-ws-jsonrpc";
9
+ import { createMessageConnection } from "vscode-jsonrpc";
10
+ import { AbstractMessageWriter } from "vscode-jsonrpc/lib/messageWriter";
11
+ import { AbstractMessageReader } from "vscode-jsonrpc/lib/messageReader";
9
12
  import { JsonRpcProxyFactory, JsonRpcProxy } from "../proxy-factory";
10
- import { ConnectionHandler } from "../handler";
11
- import ReconnectingWebSocket from 'reconnecting-websocket';
13
+ import { ConnectionEventHandler, ConnectionHandler } from "../handler";
14
+ import ReconnectingWebSocket, { Event } from 'reconnecting-websocket';
12
15
 
13
16
  export interface WebSocketOptions {
14
17
  onerror?: (event: Event) => void;
@@ -29,7 +32,10 @@ export class WebSocketConnectionProvider {
29
32
  const startListening = (path: string) => {
30
33
  const socket = this.listen({
31
34
  path,
32
- onConnection: c => factory.listen(c)
35
+ onConnection: c => factory.listen(c),
36
+ }, {
37
+ onTransportDidClose: () => factory.fireConnectionClosed(),
38
+ onTransportDidOpen: () => factory.fireConnectionOpened(),
33
39
  },
34
40
  options
35
41
  );
@@ -49,7 +55,7 @@ export class WebSocketConnectionProvider {
49
55
  /**
50
56
  * Install a connection handler for the given path.
51
57
  */
52
- listen(handler: ConnectionHandler, options?: WebSocketOptions): WebSocket {
58
+ listen(handler: ConnectionHandler, eventHandler: ConnectionEventHandler, options?: WebSocketOptions): WebSocket {
53
59
  const url = handler.path;
54
60
  const webSocket = this.createWebSocket(url);
55
61
 
@@ -64,11 +70,12 @@ export class WebSocketConnectionProvider {
64
70
  logger.error(JSON.stringify(error));
65
71
  });
66
72
  }
67
- doListen({
68
- webSocket,
69
- onConnection: connection => handler.onConnection(connection),
70
- logger
71
- });
73
+ doListen(
74
+ webSocket as any as ReconnectingWebSocket,
75
+ handler,
76
+ eventHandler,
77
+ logger,
78
+ );
72
79
  return webSocket;
73
80
  }
74
81
 
@@ -91,3 +98,162 @@ export class WebSocketConnectionProvider {
91
98
  }
92
99
 
93
100
  }
101
+
102
+ // The following was extracted from vscode-ws-jsonrpc to make these changes:
103
+ // - switch from WebSocket to ReconnectingWebSocket
104
+ // - webSocket.onopen: making sure it's only ever called once so we're re-using MessageConnection
105
+ // - WebSocketMessageWriter: buffer and re-try messages instead of throwing an error immidiately
106
+ // - WebSocketMessageReader: don't close MessageConnection on 'socket.onclose'
107
+ function doListen(resocket: ReconnectingWebSocket, handler: ConnectionHandler, eventHandler: ConnectionEventHandler, logger: Logger) {
108
+ resocket.addEventListener("close", () => eventHandler.onTransportDidClose());
109
+
110
+ let alreadyOpened = false;
111
+ resocket.onopen = () => {
112
+ // trigerr "open" every time we re-open the underlying websocket
113
+ eventHandler.onTransportDidOpen();
114
+
115
+ // make sure we're only ever creating one MessageConnection, irregardless of how many times we have to re-open the underlying (reconnecting) websocket
116
+ if (alreadyOpened) {
117
+ return;
118
+ }
119
+ alreadyOpened = true;
120
+
121
+ const connection = createWebSocketConnection(resocket, logger);
122
+ handler.onConnection(connection);
123
+ };
124
+ }
125
+
126
+ function createWebSocketConnection(resocket: ReconnectingWebSocket, logger: Logger) {
127
+ const socket = toSocket(resocket as any);
128
+ const messageReader = new NonClosingWebSocketMessageReader(socket);
129
+ const messageWriter = new BufferingWebSocketMessageWriter(resocket, logger);
130
+ const connection = createMessageConnection(messageReader, messageWriter, logger);
131
+ connection.onClose(() => connection.dispose());
132
+ return connection;
133
+ }
134
+
135
+ /**
136
+ * This takes vscode-ws-jsonrpc/lib/socket/writer/WebSocketMessageWriter and adds a buffer
137
+ */
138
+ class BufferingWebSocketMessageWriter extends AbstractMessageWriter {
139
+ protected readonly socket: ReconnectingWebSocket;
140
+ protected readonly logger: Logger;
141
+ protected errorCount: number = 0;
142
+
143
+ protected buffer: any[] = [];
144
+
145
+ constructor(socket: ReconnectingWebSocket, logger: Logger) {
146
+ super();
147
+ this.socket = socket;
148
+ this.logger = logger;
149
+
150
+ socket.addEventListener("open", (event: Event) => this.flushBuffer());
151
+ }
152
+
153
+ write(msg: any) {
154
+ if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
155
+ this.bufferMsg(msg);
156
+ return;
157
+ }
158
+
159
+ try {
160
+ const content = JSON.stringify(msg);
161
+ this.socket.send(content);
162
+ } catch (e) {
163
+ this.errorCount++;
164
+ this.fireError(e, msg, this.errorCount);
165
+
166
+ this.bufferMsg(msg);
167
+ }
168
+ }
169
+
170
+ protected flushBuffer() {
171
+ if (this.buffer.length === 0) {
172
+ return
173
+ }
174
+
175
+ const buffer = [...this.buffer];
176
+ this.buffer = [];
177
+ for (const msg of buffer) {
178
+ this.write(msg);
179
+ }
180
+ //this.logger.info(`flushed buffer (${this.buffer.length})`)
181
+ }
182
+
183
+ protected bufferMsg(msg: any) {
184
+ this.buffer.push(msg);
185
+ //this.logger.info(`buffered message (${this.buffer.length})`);
186
+ }
187
+ }
188
+
189
+
190
+ /**
191
+ * This takes vscode-ws-jsonrpc/lib/socket/reader/WebSocketMessageReader and removes the "onClose -> fireClose" connection
192
+ */
193
+ class NonClosingWebSocketMessageReader extends AbstractMessageReader {
194
+ protected readonly socket: IWebSocket;
195
+ protected readonly events: any[] = [];
196
+ protected state: 'initial' | 'listening' | 'closed' = 'initial';
197
+ protected callback: (message: any) => void = () => {};
198
+
199
+ constructor(socket: IWebSocket) {
200
+ super();
201
+ this.socket = socket;
202
+ this.socket.onMessage(message => this.readMessage(message));
203
+ this.socket.onError(error => this.fireError(error));
204
+ this.socket.onClose((code, reason) => {
205
+ if (code !== 1000) {
206
+ const error = {
207
+ name: '' + code,
208
+ message: `Error during socket reconnect: code = ${code}, reason = ${reason}`
209
+ };
210
+ this.fireError(error);
211
+ }
212
+ // this.fireClose(); // <-- reason for this class to be copied over
213
+ });
214
+ }
215
+ listen(callback: (message: any) => void) {
216
+ if (this.state === 'initial') {
217
+ this.state = 'listening';
218
+ this.callback = callback;
219
+ while (this.events.length !== 0) {
220
+ const event = this.events.pop();
221
+ if (event.message) {
222
+ this.readMessage(event.message);
223
+ }
224
+ else if (event.error) {
225
+ this.fireError(event.error);
226
+ }
227
+ else {
228
+ this.fireClose();
229
+ }
230
+ }
231
+ }
232
+ }
233
+ readMessage(message: any) {
234
+ if (this.state === 'initial') {
235
+ this.events.splice(0, 0, { message });
236
+ }
237
+ else if (this.state === 'listening') {
238
+ const data = JSON.parse(message);
239
+ this.callback(data);
240
+ }
241
+ }
242
+ fireError(error: any) {
243
+ if (this.state === 'initial') {
244
+ this.events.splice(0, 0, { error });
245
+ }
246
+ else if (this.state === 'listening') {
247
+ super.fireError(error);
248
+ }
249
+ }
250
+ fireClose() {
251
+ if (this.state === 'initial') {
252
+ this.events.splice(0, 0, {});
253
+ }
254
+ else if (this.state === 'listening') {
255
+ super.fireClose();
256
+ }
257
+ this.state = 'closed';
258
+ }
259
+ }