@gitpod/gitpod-protocol 0.1.5-svenefftinge-patch-1.3 → 0.1.5-tar-telemetry-settings-data.3

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 (265) hide show
  1. package/data/gitpod-schema.json +21 -2
  2. package/lib/accounting-protocol.d.ts +0 -1
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +10 -11
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +18 -2
  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 -1
  11. package/lib/analytics.d.ts.map +1 -1
  12. package/lib/context-url.d.ts +18 -5
  13. package/lib/context-url.d.ts.map +1 -1
  14. package/lib/context-url.js +62 -9
  15. package/lib/context-url.js.map +1 -1
  16. package/lib/context-url.spec.d.ts +2 -0
  17. package/lib/context-url.spec.d.ts.map +1 -1
  18. package/lib/context-url.spec.js +66 -48
  19. package/lib/context-url.spec.js.map +1 -1
  20. package/lib/email-protocol.js +4 -4
  21. package/lib/email-protocol.js.map +1 -1
  22. package/lib/encryption/container-module.js +4 -4
  23. package/lib/encryption/container-module.js.map +1 -1
  24. package/lib/encryption/encryption-engine.js +19 -20
  25. package/lib/encryption/encryption-engine.js.map +1 -1
  26. package/lib/encryption/encryption-engine.spec.js +29 -36
  27. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  28. package/lib/encryption/encryption-service.js +29 -43
  29. package/lib/encryption/encryption-service.js.map +1 -1
  30. package/lib/encryption/key-provider.js +25 -30
  31. package/lib/encryption/key-provider.js.map +1 -1
  32. package/lib/env.d.ts +1 -2
  33. package/lib/env.d.ts.map +1 -1
  34. package/lib/env.js +20 -21
  35. package/lib/env.js.map +1 -1
  36. package/lib/gitpod-file-parser.js +25 -41
  37. package/lib/gitpod-file-parser.js.map +1 -1
  38. package/lib/gitpod-file-parser.spec.js +116 -116
  39. package/lib/gitpod-file-parser.spec.js.map +1 -1
  40. package/lib/gitpod-service.d.ts +78 -20
  41. package/lib/gitpod-service.d.ts.map +1 -1
  42. package/lib/gitpod-service.js +151 -295
  43. package/lib/gitpod-service.js.map +1 -1
  44. package/lib/headless-workspace-log.d.ts +1 -12
  45. package/lib/headless-workspace-log.d.ts.map +1 -1
  46. package/lib/headless-workspace-log.js +1 -7
  47. package/lib/headless-workspace-log.js.map +1 -1
  48. package/lib/ide-protocol.d.ts +105 -0
  49. package/lib/ide-protocol.d.ts.map +1 -0
  50. package/lib/ide-protocol.js +8 -0
  51. package/lib/ide-protocol.js.map +1 -0
  52. package/lib/index.d.ts +3 -0
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +3 -0
  55. package/lib/index.js.map +1 -1
  56. package/lib/installation-admin-protocol.d.ts +27 -0
  57. package/lib/installation-admin-protocol.d.ts.map +1 -0
  58. package/lib/installation-admin-protocol.js +30 -0
  59. package/lib/installation-admin-protocol.js.map +1 -0
  60. package/lib/messaging/browser/connection.d.ts +3 -3
  61. package/lib/messaging/browser/connection.d.ts.map +1 -1
  62. package/lib/messaging/browser/connection.js +172 -35
  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/error.d.ts +2 -1
  71. package/lib/messaging/error.d.ts.map +1 -1
  72. package/lib/messaging/error.js +4 -2
  73. package/lib/messaging/error.js.map +1 -1
  74. package/lib/messaging/handler.d.ts +10 -0
  75. package/lib/messaging/handler.d.ts.map +1 -1
  76. package/lib/messaging/node/connection.d.ts +1 -17
  77. package/lib/messaging/node/connection.d.ts.map +1 -1
  78. package/lib/messaging/node/connection.js +23 -59
  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/oss-allowlist.d.ts +14 -0
  85. package/lib/oss-allowlist.d.ts.map +1 -0
  86. package/lib/oss-allowlist.js +8 -0
  87. package/lib/oss-allowlist.js.map +1 -0
  88. package/lib/permission.d.ts +7 -2
  89. package/lib/permission.d.ts.map +1 -1
  90. package/lib/permission.js +34 -15
  91. package/lib/permission.js.map +1 -1
  92. package/lib/plans.d.ts +1 -1
  93. package/lib/plans.d.ts.map +1 -1
  94. package/lib/plans.js +38 -57
  95. package/lib/plans.js.map +1 -1
  96. package/lib/protocol.d.ts +52 -49
  97. package/lib/protocol.d.ts.map +1 -1
  98. package/lib/protocol.js +57 -115
  99. package/lib/protocol.js.map +1 -1
  100. package/lib/snapshot-url.d.ts +14 -0
  101. package/lib/snapshot-url.d.ts.map +1 -0
  102. package/lib/snapshot-url.js +26 -0
  103. package/lib/snapshot-url.js.map +1 -0
  104. package/lib/snapshot-url.spec.d.ts +7 -0
  105. package/lib/snapshot-url.spec.d.ts.map +1 -0
  106. package/lib/snapshot-url.spec.js +41 -0
  107. package/lib/snapshot-url.spec.js.map +1 -0
  108. package/lib/team-subscription-protocol.js +13 -13
  109. package/lib/team-subscription-protocol.js.map +1 -1
  110. package/lib/teams-projects-protocol.d.ts +59 -6
  111. package/lib/teams-projects-protocol.d.ts.map +1 -1
  112. package/lib/teams-projects-protocol.js +18 -15
  113. package/lib/teams-projects-protocol.js.map +1 -1
  114. package/lib/util/analytics.d.ts.map +1 -1
  115. package/lib/util/analytics.js +35 -26
  116. package/lib/util/analytics.js.map +1 -1
  117. package/lib/util/async-iterator.js +55 -133
  118. package/lib/util/async-iterator.js.map +1 -1
  119. package/lib/util/cancelable.js +17 -59
  120. package/lib/util/cancelable.js.map +1 -1
  121. package/lib/util/date-time.js +8 -8
  122. package/lib/util/date-time.js.map +1 -1
  123. package/lib/util/deferred.js +10 -12
  124. package/lib/util/deferred.js.map +1 -1
  125. package/lib/util/disposable.js +26 -39
  126. package/lib/util/disposable.js.map +1 -1
  127. package/lib/util/event.js +58 -74
  128. package/lib/util/event.js.map +1 -1
  129. package/lib/util/garbage-collected-cache.d.ts +1 -0
  130. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  131. package/lib/util/garbage-collected-cache.js +26 -46
  132. package/lib/util/garbage-collected-cache.js.map +1 -1
  133. package/lib/util/generate-workspace-id.d.ts +1 -1
  134. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  135. package/lib/util/generate-workspace-id.js +29 -68
  136. package/lib/util/generate-workspace-id.js.map +1 -1
  137. package/lib/util/generate-workspace-id.spec.js +57 -78
  138. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  139. package/lib/util/gitpod-cookie.d.ts +20 -0
  140. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  141. package/lib/util/gitpod-cookie.js +44 -0
  142. package/lib/util/gitpod-cookie.js.map +1 -0
  143. package/lib/util/gitpod-host-url.d.ts +1 -1
  144. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  145. package/lib/util/gitpod-host-url.js +93 -103
  146. package/lib/util/gitpod-host-url.js.map +1 -1
  147. package/lib/util/gitpod-host-url.spec.js +87 -135
  148. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  149. package/lib/util/grpc.d.ts +15 -0
  150. package/lib/util/grpc.d.ts.map +1 -0
  151. package/lib/util/grpc.js +18 -0
  152. package/lib/util/grpc.js.map +1 -0
  153. package/lib/util/jaeger-client-types.d.ts +68 -0
  154. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  155. package/lib/util/jaeger-client-types.js +8 -0
  156. package/lib/util/jaeger-client-types.js.map +1 -0
  157. package/lib/util/logging.d.ts +49 -33
  158. package/lib/util/logging.d.ts.map +1 -1
  159. package/lib/util/logging.js +107 -110
  160. package/lib/util/logging.js.map +1 -1
  161. package/lib/util/make-link.js +2 -2
  162. package/lib/util/make-link.js.map +1 -1
  163. package/lib/util/parse-workspace-id.d.ts +10 -0
  164. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  165. package/lib/util/parse-workspace-id.js +31 -7
  166. package/lib/util/parse-workspace-id.js.map +1 -1
  167. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  168. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  169. package/lib/util/parse-workspace-id.spec.js +123 -84
  170. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  171. package/lib/util/queue.js +16 -55
  172. package/lib/util/queue.js.map +1 -1
  173. package/lib/util/queue.spec.js +144 -288
  174. package/lib/util/queue.spec.js.map +1 -1
  175. package/lib/util/repeat.d.ts +15 -0
  176. package/lib/util/repeat.d.ts.map +1 -0
  177. package/lib/util/repeat.js +55 -0
  178. package/lib/util/repeat.js.map +1 -0
  179. package/lib/util/semaphore.js +15 -46
  180. package/lib/util/semaphore.js.map +1 -1
  181. package/lib/util/skip-if.js +6 -6
  182. package/lib/util/skip-if.js.map +1 -1
  183. package/lib/util/timeutil.js +16 -16
  184. package/lib/util/timeutil.js.map +1 -1
  185. package/lib/util/timeutil.spec.js +21 -24
  186. package/lib/util/timeutil.spec.js.map +1 -1
  187. package/lib/util/tracing.d.ts +51 -5
  188. package/lib/util/tracing.d.ts.map +1 -1
  189. package/lib/util/tracing.js +197 -62
  190. package/lib/util/tracing.js.map +1 -1
  191. package/lib/util/tracing.spec.d.ts +7 -0
  192. package/lib/util/tracing.spec.d.ts.map +1 -0
  193. package/lib/util/tracing.spec.js +121 -0
  194. package/lib/util/tracing.spec.js.map +1 -0
  195. package/lib/util/workspace-port-authentication.js +2 -2
  196. package/lib/util/workspace-port-authentication.js.map +1 -1
  197. package/lib/workspace-cluster.d.ts +14 -2
  198. package/lib/workspace-cluster.d.ts.map +1 -1
  199. package/lib/workspace-cluster.js +21 -4
  200. package/lib/workspace-cluster.js.map +1 -1
  201. package/lib/workspace-instance.d.ts +24 -2
  202. package/lib/workspace-instance.d.ts.map +1 -1
  203. package/lib/wsready.js +1 -1
  204. package/package.json +24 -13
  205. package/pkg-yarn.lock +14 -7
  206. package/provenance-bundle.jsonl +2 -0
  207. package/src/accounting-protocol.ts +1 -3
  208. package/src/admin-protocol.ts +25 -6
  209. package/src/analytics.ts +16 -1
  210. package/src/context-url.spec.ts +18 -4
  211. package/src/context-url.ts +62 -6
  212. package/src/email-protocol.ts +1 -1
  213. package/src/env.ts +10 -10
  214. package/src/gitpod-service.ts +99 -32
  215. package/src/headless-workspace-log.ts +1 -14
  216. package/src/ide-frontend-service.ts +1 -1
  217. package/src/ide-protocol.ts +119 -0
  218. package/src/index.ts +3 -0
  219. package/src/installation-admin-protocol.ts +42 -0
  220. package/src/messaging/browser/connection.ts +176 -10
  221. package/src/messaging/client-call-metrics.ts +97 -0
  222. package/src/messaging/error.ts +5 -2
  223. package/src/messaging/handler.ts +12 -0
  224. package/src/messaging/node/connection.ts +21 -68
  225. package/src/messaging/proxy-factory.ts +13 -5
  226. package/src/oss-allowlist.ts +15 -0
  227. package/src/permission.ts +22 -4
  228. package/src/protocol.ts +71 -54
  229. package/src/snapshot-url.spec.ts +25 -0
  230. package/src/snapshot-url.ts +27 -0
  231. package/src/team-subscription-protocol.ts +1 -1
  232. package/src/teams-projects-protocol.ts +78 -7
  233. package/src/util/analytics.ts +17 -1
  234. package/src/util/garbage-collected-cache.ts +7 -1
  235. package/src/util/generate-workspace-id.spec.ts +17 -0
  236. package/src/util/generate-workspace-id.ts +20 -2
  237. package/src/util/gitpod-cookie.ts +39 -0
  238. package/src/util/gitpod-host-url.ts +11 -11
  239. package/src/util/grpc.ts +15 -0
  240. package/src/util/jaeger-client-types.ts +102 -0
  241. package/src/util/logging.ts +102 -38
  242. package/src/util/parse-workspace-id.spec.ts +21 -1
  243. package/src/util/parse-workspace-id.ts +32 -6
  244. package/src/util/repeat.ts +45 -0
  245. package/src/util/tracing.spec.ts +83 -0
  246. package/src/util/tracing.ts +183 -17
  247. package/src/workspace-cluster.ts +18 -3
  248. package/src/workspace-instance.ts +35 -6
  249. package/src/wsready.ts +1 -1
  250. package/lib/messaging/connection-error-handler.d.ts +0 -27
  251. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  252. package/lib/messaging/connection-error-handler.js +0 -46
  253. package/lib/messaging/connection-error-handler.js.map +0 -1
  254. package/lib/util/repeater.d.ts +0 -22
  255. package/lib/util/repeater.d.ts.map +0 -1
  256. package/lib/util/repeater.js +0 -118
  257. package/lib/util/repeater.js.map +0 -1
  258. package/lib/util/safe-promise.d.ts +0 -11
  259. package/lib/util/safe-promise.d.ts.map +0 -1
  260. package/lib/util/safe-promise.js +0 -34
  261. package/lib/util/safe-promise.js.map +0 -1
  262. package/src/messaging/connection-error-handler.ts +0 -62
  263. package/src/util/jaeger-client.d.ts +0 -105
  264. package/src/util/repeater.ts +0 -49
  265. package/src/util/safe-promise.ts +0 -26
package/src/env.ts CHANGED
@@ -13,18 +13,18 @@ const legacyStagenameTranslation: { [key: string]: KubeStage } = {
13
13
  "dev": "dev"
14
14
  }
15
15
 
16
+ export function translateLegacyStagename(kubeStage: string): KubeStage {
17
+ const stage = legacyStagenameTranslation[kubeStage];
18
+ if (!stage) {
19
+ throw new Error(`Invalid KUBE_STAGE: ${kubeStage}`);
20
+ }
21
+
22
+ return stage;
23
+ }
24
+
16
25
  @injectable()
17
26
  export abstract class AbstractComponentEnv {
18
- readonly kubeStage: KubeStage = getEnvVarParsed('KUBE_STAGE', (kubeStage) => {
19
- const stage = legacyStagenameTranslation[kubeStage];
20
- if (!stage) {
21
- throw new Error(`Environment variable invalid: KUBE_STAGE=${kubeStage}`);
22
- }
23
-
24
- return stage;
25
- });
26
- readonly kubeNamespace: string = getEnvVar('KUBE_NAMESPACE');
27
- readonly version: string = getEnvVar('VERSION');
27
+ readonly kubeStage: KubeStage = getEnvVarParsed('KUBE_STAGE', translateLegacyStagename);
28
28
 
29
29
  readonly installationLongname: string = getEnvVar("GITPOD_INSTALLATION_LONGNAME")
30
30
  readonly installationShortname: string = getEnvVar("GITPOD_INSTALLATION_SHORTNAME")
@@ -6,18 +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
12
+ GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes, ProjectEnvVar
13
13
  } from './protocol';
14
14
  import {
15
15
  Team, TeamMemberInfo,
16
- TeamMembershipInvite, Project, ProjectInfo, PrebuildInfo, TeamMemberRole
16
+ TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult, PartialProject
17
17
  } from './teams-projects-protocol';
18
18
  import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
19
19
  import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
20
- import { HeadlessLogEvent, HeadlessLogUrls } from './headless-workspace-log';
20
+ import { HeadlessLogUrls } from './headless-workspace-log';
21
21
  import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from './workspace-instance';
22
22
  import { AdminServer } from './admin-protocol';
23
23
  import { GitpodHostUrl } from './util/gitpod-host-url';
@@ -28,12 +28,15 @@ import { Emitter } from './util/event';
28
28
  import { AccountStatement, CreditAlert } from './accounting-protocol';
29
29
  import { GithubUpgradeURL, PlanCoupon } from './payment-protocol';
30
30
  import { TeamSubscription, TeamSubscriptionSlot, TeamSubscriptionSlotResolved } from './team-subscription-protocol';
31
- import { RemoteTrackMessage } from './analytics';
31
+ import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from './analytics';
32
+ import { IDEServer } from './ide-protocol';
33
+ import { InstallationAdminSettings, TelemetryData } from './installation-admin-protocol';
32
34
 
33
35
  export interface GitpodClient {
34
36
  onInstanceUpdate(instance: WorkspaceInstance): void;
35
37
  onWorkspaceImageBuildLogs: WorkspaceImageBuild.LogCallback;
36
- onHeadlessWorkspaceLogs(evt: HeadlessLogEvent): void;
38
+
39
+ onPrebuildUpdate(update: PrebuildWithStatus): void;
37
40
 
38
41
  onCreditAlert(creditAlert: CreditAlert): void;
39
42
 
@@ -44,7 +47,7 @@ export interface GitpodClient {
44
47
  }
45
48
 
46
49
  export const GitpodServer = Symbol('GitpodServer');
47
- export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
50
+ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
48
51
  // User related API
49
52
  getLoggedInUser(): Promise<User>;
50
53
  getTerms(): Promise<Terms>;
@@ -53,9 +56,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
53
56
  getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
54
57
  updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
55
58
  deleteOwnAuthProvider(params: GitpodServer.DeleteOwnAuthProviderParams): Promise<void>;
56
- getBranding(): Promise<Branding>;
57
59
  getConfiguration(): Promise<Configuration>;
58
60
  getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
61
+ getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
59
62
  /**
60
63
  * @deprecated
61
64
  */
@@ -69,8 +72,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
69
72
  getWorkspaceOwner(workspaceId: string): Promise<UserInfo | undefined>;
70
73
  getWorkspaceUsers(workspaceId: string): Promise<WorkspaceInstanceUser[]>;
71
74
  getFeaturedRepositories(): Promise<WhitelistedRepository[]>;
75
+ getSuggestedContextURLs(): Promise<string[]>;
76
+ /**
77
+ * **Security:**
78
+ * Sensitive information like an owner token is erased, since it allows access for all team members.
79
+ * If you need to access an owner token use `getOwnerToken` instead.
80
+ */
72
81
  getWorkspace(id: string): Promise<WorkspaceInfo>;
73
82
  isWorkspaceOwner(workspaceId: string): Promise<boolean>;
83
+ getOwnerToken(workspaceId: string): Promise<string>;
74
84
 
75
85
  /**
76
86
  * Creates and starts a workspace for the given context URL.
@@ -87,7 +97,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
87
97
  updateWorkspaceUserPin(id: string, action: GitpodServer.PinAction): Promise<void>;
88
98
  sendHeartBeat(options: GitpodServer.SendHeartBeatOptions): Promise<void>;
89
99
  watchWorkspaceImageBuildLogs(workspaceId: string): Promise<void>;
90
- watchHeadlessWorkspaceLogs(workspaceId: string): Promise<void>;
91
100
  isPrebuildDone(pwsid: string): Promise<boolean>;
92
101
  getHeadlessLog(instanceId: string): Promise<HeadlessLogUrls>;
93
102
 
@@ -107,13 +116,13 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
107
116
  getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
108
117
  updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
109
118
 
110
- // user env vars
119
+ // User env vars
111
120
  getEnvVars(): Promise<UserEnvVarValue[]>;
112
121
  getAllEnvVars(): Promise<UserEnvVarValue[]>;
113
122
  setEnvVar(variable: UserEnvVarValue): Promise<void>;
114
123
  deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
115
124
 
116
- // teams and projects
125
+ // Teams
117
126
  getTeams(): Promise<Team[]>;
118
127
  getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
119
128
  createTeam(name: string): Promise<Team>;
@@ -122,6 +131,32 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
122
131
  removeTeamMember(teamId: string, userId: string): Promise<void>;
123
132
  getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
124
133
  resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
134
+ deleteTeam(teamId: string, userId: string): Promise<void>;
135
+
136
+ // Admin Settings
137
+ adminGetSettings(): Promise<InstallationAdminSettings>;
138
+ adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
139
+ adminGetTelemetryData(): Promise<TelemetryData>;
140
+
141
+ // Projects
142
+ getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
143
+ createProject(params: CreateProjectParams): Promise<Project>;
144
+ deleteProject(projectId: string): Promise<void>;
145
+ getTeamProjects(teamId: string): Promise<Project[]>;
146
+ getUserProjects(): Promise<Project[]>;
147
+ getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
148
+ findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
149
+ triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
150
+ cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
151
+ fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
152
+ guessProjectConfiguration(projectId: string): Promise<string | undefined>;
153
+ fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
154
+ guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
155
+ setProjectConfiguration(projectId: string, configString: string): Promise<void>;
156
+ updateProjectPartial(partialProject: PartialProject): Promise<void>;
157
+ setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
158
+ getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
159
+ deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
125
160
 
126
161
  // content service
127
162
  getContentBlobUploadUrl(name: string): Promise<string>
@@ -137,10 +172,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
137
172
  registerGithubApp(installationId: string): Promise<void>;
138
173
 
139
174
  /**
140
- * Stores a new snapshot for the given workspace and bucketId
175
+ * Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
141
176
  * @return the snapshot id
142
177
  */
143
178
  takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
179
+ /**
180
+ *
181
+ * @param snapshotId
182
+ */
183
+ waitForSnapshot(snapshotId: string): Promise<void>;
144
184
 
145
185
  /**
146
186
  * Returns the list of snapshots that exist for a workspace.
@@ -172,8 +212,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
172
212
  * gitpod.io concerns
173
213
  */
174
214
  isStudent(): Promise<boolean>;
175
- getPrivateRepoTrialEndDate(): Promise<string | undefined>;
176
-
177
215
  /**
178
216
  *
179
217
  */
@@ -191,7 +229,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
191
229
 
192
230
  getShowPaymentUI(): Promise<boolean>;
193
231
  isChargebeeCustomer(): Promise<boolean>;
194
- mayAccessPrivateRepo(): Promise<boolean>;
195
232
 
196
233
  subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
197
234
  subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
@@ -210,39 +247,63 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
210
247
  getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
211
248
 
212
249
  /**
213
- * projects
250
+ * Analytics
214
251
  */
215
- getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
216
- createProject(params: CreateProjectParams): Promise<Project>;
217
- getProjects(teamId: string): Promise<ProjectInfo[]>;
218
- getPrebuilds(teamId: string, project: string): Promise<PrebuildInfo[]>;
252
+ trackEvent(event: RemoteTrackMessage): Promise<void>;
253
+ trackLocation(event: RemotePageMessage): Promise<void>;
254
+ identifyUser(event: RemoteIdentifyMessage): Promise<void>;
255
+ }
256
+
257
+ export interface RateLimiterError {
258
+ method?: string,
219
259
 
220
260
  /**
221
- * Analytics
261
+ * Retry after this many seconds, earliest.
262
+ * cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
222
263
  */
223
- trackEvent(event: RemoteTrackMessage): Promise<void>;
264
+ retryAfter: number,
224
265
  }
225
266
 
226
267
  export interface CreateProjectParams {
227
268
  name: string;
269
+ slug?: string;
228
270
  account: string;
229
271
  provider: string;
230
272
  cloneUrl: string;
231
- teamId: string;
273
+ teamId?: string;
274
+ userId?: string;
232
275
  appInstallationId: string;
233
276
  }
277
+ export interface FindPrebuildsParams {
278
+ projectId: string;
279
+ branch?: string;
280
+ latest?: boolean;
281
+ prebuildId?: string;
282
+ // default: 30
283
+ limit?: number;
284
+ }
234
285
  export interface GetProviderRepositoriesParams {
235
286
  provider: string;
236
287
  hints?: { installationId: string } | object;
237
288
  }
238
289
  export interface ProviderRepository {
239
290
  name: string;
291
+ path?: string;
240
292
  account: string;
241
293
  accountAvatarUrl: string;
242
294
  cloneUrl: string;
243
295
  updatedAt: string;
244
296
  installationId?: number;
245
297
  installationUpdatedAt?: string;
298
+
299
+ inUse?: { userName: string };
300
+ }
301
+
302
+ export interface ClientHeaderFields {
303
+ ip?: string;
304
+ userAgent?: string;
305
+ dnt?: string;
306
+ clientRegion?: string;
246
307
  }
247
308
 
248
309
  export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
@@ -288,6 +349,8 @@ export namespace GitpodServer {
288
349
  limit?: number;
289
350
  searchString?: string;
290
351
  pinnedOnly?: boolean;
352
+ projectId?: string | string[];
353
+ includeWithoutProject?: boolean;
291
354
  }
292
355
  export interface GetAccountStatementOptions {
293
356
  date?: string;
@@ -303,6 +366,8 @@ export namespace GitpodServer {
303
366
  export interface TakeSnapshotOptions {
304
367
  workspaceId: string;
305
368
  layoutData?: string;
369
+ /* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
370
+ dontWait?: boolean;
306
371
  }
307
372
  export interface GetUserStorageResourceOptions {
308
373
  readonly uri: string;
@@ -344,10 +409,12 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
344
409
 
345
410
  public registerClient(client: Partial<Client>): Disposable {
346
411
  this.clients.push(client);
347
- const index = this.clients.length;
348
412
  return {
349
413
  dispose: () => {
350
- this.clients.slice(index, 1);
414
+ const index = this.clients.indexOf(client);
415
+ if (index > -1) {
416
+ this.clients.splice(index, 1);
417
+ }
351
418
  }
352
419
  }
353
420
  }
@@ -364,11 +431,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
364
431
  }
365
432
  }
366
433
 
367
- onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
434
+ onPrebuildUpdate(update: PrebuildWithStatus): void {
368
435
  for (const client of this.clients) {
369
- if (client.onWorkspaceImageBuildLogs) {
436
+ if (client.onPrebuildUpdate) {
370
437
  try {
371
- client.onWorkspaceImageBuildLogs(info, content);
438
+ client.onPrebuildUpdate(update);
372
439
  } catch (error) {
373
440
  console.error(error)
374
441
  }
@@ -376,11 +443,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
376
443
  }
377
444
  }
378
445
 
379
- onHeadlessWorkspaceLogs(evt: HeadlessLogEvent): void {
446
+ onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
380
447
  for (const client of this.clients) {
381
- if (client.onHeadlessWorkspaceLogs) {
448
+ if (client.onWorkspaceImageBuildLogs) {
382
449
  try {
383
- client.onHeadlessWorkspaceLogs(evt);
450
+ client.onWorkspaceImageBuildLogs(info, content);
384
451
  } catch (error) {
385
452
  console.error(error)
386
453
  }
@@ -537,7 +604,7 @@ export class WorkspaceInstanceUpdateListener {
537
604
  }
538
605
 
539
606
  export interface GitpodServiceOptions {
540
- onReconnect?: () => (void | Promise<void>)
607
+ onReconnect?: () => (void | Promise<void>)
541
608
  }
542
609
 
543
610
  export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
@@ -22,25 +22,12 @@ 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
31
  export interface HeadlessLogUrls {
45
32
  // A map of id to URL
46
33
  streams: { [streamID: string]: string };
@@ -7,7 +7,7 @@
7
7
  import { Event } from "./util/event";
8
8
  import { Disposable } from "./util/disposable";
9
9
 
10
- export type IDEFrontendState = 'init' | 'ready' | 'terminated';
10
+ export type IDEFrontendState = 'init' | 'ready' | 'terminated';
11
11
 
12
12
  export interface IDEFrontendService {
13
13
  readonly state: IDEFrontendState;
@@ -0,0 +1,119 @@
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
+ * Client specific IDE options.
35
+ */
36
+ clients?: { [id: string]: IDEClient };
37
+ }
38
+
39
+ export interface IDEClient {
40
+ /**
41
+ * The default desktop IDE when the user has not specified one.
42
+ */
43
+ defaultDesktopIDE?: string;
44
+
45
+ /**
46
+ * Desktop IDEs supported by the client.
47
+ */
48
+ desktopIDEs?: string[]
49
+
50
+ /**
51
+ * Steps to install the client on user machine.
52
+ */
53
+ installationSteps?: string[]
54
+ }
55
+
56
+ export interface IDEOption {
57
+ /**
58
+ * To ensure a stable order one can set an `orderKey`.
59
+ */
60
+ orderKey?: string;
61
+
62
+ /**
63
+ * Human readable title text of the IDE (plain text only).
64
+ */
65
+ title: string;
66
+
67
+ /**
68
+ * The type of the IDE, currently 'browser' or 'desktop'.
69
+ */
70
+ type: 'browser' | 'desktop';
71
+
72
+ /**
73
+ * The logo for the IDE. That could be a key in (see
74
+ * components/dashboard/src/images/ideLogos.ts) or a URL.
75
+ */
76
+ logo: string;
77
+
78
+ /**
79
+ * Text of an optional tooltip (plain text only).
80
+ */
81
+ tooltip?: string;
82
+
83
+ /**
84
+ * Text of an optional label next to the IDE option like “Insiders” (plain
85
+ * text only).
86
+ */
87
+ label?: string;
88
+
89
+ /**
90
+ * Notes to the IDE option that are renderd in the preferences when a user
91
+ * chooses this IDE.
92
+ */
93
+ notes?: string[];
94
+
95
+ /**
96
+ * If `true` this IDE option is not visible in the IDE preferences.
97
+ */
98
+ hidden?: boolean;
99
+
100
+ /**
101
+ * The image ref to the IDE image.
102
+ */
103
+ image: string;
104
+
105
+ /**
106
+ * The latest image ref to the IDE image, this image ref always resolve to digest.
107
+ */
108
+ latestImage?: string;
109
+
110
+ /**
111
+ * When this is `true`, the tag of this image is resolved to the latest
112
+ * image digest regularly.
113
+ *
114
+ * This is useful if this image points to a tag like `nightly` that will be
115
+ * updated regularly. When `resolveImageDigest` is `true`, we make sure that
116
+ * we resolve the tag regularly to the most recent image version.
117
+ */
118
+ resolveImageDigest?: boolean;
119
+ }
package/src/index.ts CHANGED
@@ -17,3 +17,6 @@ export * from './email-protocol';
17
17
  export * from './headless-workspace-log';
18
18
  export * from './context-url';
19
19
  export * from './teams-projects-protocol';
20
+ export * from './snapshot-url';
21
+ export * from './oss-allowlist';
22
+ export * from './installation-admin-protocol';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) 2022 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
+ import { v4 as uuidv4 } from 'uuid';
8
+
9
+ const InstallationAdminSettingsPrototype = {
10
+ sendTelemetry: true
11
+ }
12
+
13
+ export type InstallationAdminSettings = typeof InstallationAdminSettingsPrototype;
14
+
15
+ export namespace InstallationAdminSettings {
16
+ export function fields(): (keyof InstallationAdminSettings)[] {
17
+ return Object.keys(InstallationAdminSettingsPrototype) as (keyof InstallationAdminSettings)[];
18
+ }
19
+ }
20
+
21
+ export interface InstallationAdmin {
22
+ id: string;
23
+ settings: InstallationAdminSettings;
24
+ }
25
+
26
+ export interface TelemetryData {
27
+ installationAdmin: InstallationAdmin
28
+ totalUsers: number
29
+ totalWorkspaces: number
30
+ totalInstances: number
31
+ }
32
+
33
+ export namespace InstallationAdmin {
34
+ export function createDefault(): InstallationAdmin {
35
+ return {
36
+ id: uuidv4(),
37
+ settings: {
38
+ ...InstallationAdminSettingsPrototype,
39
+ }
40
+ };
41
+ }
42
+ }