@gitpod/gitpod-protocol 0.1.5-se-multi-repo.39 → 0.1.5-se-playground.14

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 (292) hide show
  1. package/data/gitpod-schema.json +153 -2
  2. package/lib/accounting-protocol.d.ts +17 -10
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +30 -32
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts.map +1 -1
  7. package/lib/admin-protocol.js.map +1 -1
  8. package/lib/analytics.d.ts.map +1 -1
  9. package/lib/analytics.js.map +1 -1
  10. package/lib/auth.d.ts.map +1 -1
  11. package/lib/context-url.d.ts.map +1 -1
  12. package/lib/context-url.js +4 -4
  13. package/lib/context-url.js.map +1 -1
  14. package/lib/context-url.spec.d.ts.map +1 -1
  15. package/lib/context-url.spec.js +20 -5
  16. package/lib/context-url.spec.js.map +1 -1
  17. package/lib/email-protocol.d.ts +1 -1
  18. package/lib/email-protocol.d.ts.map +1 -1
  19. package/lib/email-protocol.js.map +1 -1
  20. package/lib/encryption/container-module.d.ts.map +1 -1
  21. package/lib/encryption/container-module.js +1 -1
  22. package/lib/encryption/container-module.js.map +1 -1
  23. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  24. package/lib/encryption/encryption-engine.js +7 -7
  25. package/lib/encryption/encryption-engine.js.map +1 -1
  26. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  27. package/lib/encryption/encryption-engine.spec.js +2 -3
  28. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  29. package/lib/encryption/encryption-service.d.ts.map +1 -1
  30. package/lib/encryption/encryption-service.js +1 -1
  31. package/lib/encryption/encryption-service.js.map +1 -1
  32. package/lib/encryption/key-provider.d.ts.map +1 -1
  33. package/lib/encryption/key-provider.js +7 -9
  34. package/lib/encryption/key-provider.js.map +1 -1
  35. package/lib/env.d.ts +0 -5
  36. package/lib/env.d.ts.map +1 -1
  37. package/lib/env.js +1 -20
  38. package/lib/env.js.map +1 -1
  39. package/lib/experiments/always-default.d.ts +8 -0
  40. package/lib/experiments/always-default.d.ts.map +1 -0
  41. package/lib/experiments/always-default.js +20 -0
  42. package/lib/experiments/always-default.js.map +1 -0
  43. package/lib/experiments/configcat-server.d.ts +8 -0
  44. package/lib/experiments/configcat-server.d.ts.map +1 -0
  45. package/lib/experiments/configcat-server.js +34 -0
  46. package/lib/experiments/configcat-server.js.map +1 -0
  47. package/lib/experiments/configcat.d.ts +21 -0
  48. package/lib/experiments/configcat.d.ts.map +1 -0
  49. package/lib/experiments/configcat.js +47 -0
  50. package/lib/experiments/configcat.js.map +1 -0
  51. package/lib/experiments/types.d.ts +19 -0
  52. package/lib/experiments/types.d.ts.map +1 -0
  53. package/lib/{theia-plugins.js → experiments/types.js} +2 -2
  54. package/lib/experiments/types.js.map +1 -0
  55. package/lib/gitpod-file-parser.d.ts.map +1 -1
  56. package/lib/gitpod-file-parser.js +6 -6
  57. package/lib/gitpod-file-parser.js.map +1 -1
  58. package/lib/gitpod-file-parser.spec.js +42 -39
  59. package/lib/gitpod-file-parser.spec.js.map +1 -1
  60. package/lib/gitpod-service.d.ts +33 -26
  61. package/lib/gitpod-service.d.ts.map +1 -1
  62. package/lib/gitpod-service.js +39 -32
  63. package/lib/gitpod-service.js.map +1 -1
  64. package/lib/headless-workspace-log.d.ts.map +1 -1
  65. package/lib/headless-workspace-log.js +1 -1
  66. package/lib/headless-workspace-log.js.map +1 -1
  67. package/lib/ide-frontend-service.d.ts +1 -1
  68. package/lib/ide-protocol.d.ts +6 -6
  69. package/lib/ide-protocol.d.ts.map +1 -1
  70. package/lib/index.d.ts +16 -16
  71. package/lib/installation-admin-protocol.d.ts +3 -0
  72. package/lib/installation-admin-protocol.d.ts.map +1 -1
  73. package/lib/installation-admin-protocol.js +3 -2
  74. package/lib/installation-admin-protocol.js.map +1 -1
  75. package/lib/license-protocol.d.ts +7 -0
  76. package/lib/license-protocol.d.ts.map +1 -1
  77. package/lib/license-protocol.js.map +1 -1
  78. package/lib/messaging/browser/connection.d.ts +1 -1
  79. package/lib/messaging/browser/connection.d.ts.map +1 -1
  80. package/lib/messaging/browser/connection.js +19 -19
  81. package/lib/messaging/browser/connection.js.map +1 -1
  82. package/lib/messaging/browser/window-connection.d.ts +4 -4
  83. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  84. package/lib/messaging/browser/window-connection.js +9 -6
  85. package/lib/messaging/browser/window-connection.js.map +1 -1
  86. package/lib/messaging/client-call-metrics.d.ts +2 -2
  87. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  88. package/lib/messaging/client-call-metrics.js +20 -20
  89. package/lib/messaging/client-call-metrics.js.map +1 -1
  90. package/lib/messaging/error.d.ts +2 -0
  91. package/lib/messaging/error.d.ts.map +1 -1
  92. package/lib/messaging/error.js +4 -0
  93. package/lib/messaging/error.js.map +1 -1
  94. package/lib/messaging/handler.d.ts.map +1 -1
  95. package/lib/messaging/handler.js +1 -1
  96. package/lib/messaging/node/connection.js +8 -8
  97. package/lib/messaging/node/connection.js.map +1 -1
  98. package/lib/messaging/proxy-factory.d.ts +1 -1
  99. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  100. package/lib/messaging/proxy-factory.js +7 -9
  101. package/lib/messaging/proxy-factory.js.map +1 -1
  102. package/lib/payment-protocol.d.ts.map +1 -1
  103. package/lib/payment-protocol.js +1 -1
  104. package/lib/payment-protocol.js.map +1 -1
  105. package/lib/permission.d.ts +2 -2
  106. package/lib/permission.d.ts.map +1 -1
  107. package/lib/permission.js +12 -23
  108. package/lib/permission.js.map +1 -1
  109. package/lib/plans.d.ts +3 -3
  110. package/lib/plans.d.ts.map +1 -1
  111. package/lib/plans.js +206 -171
  112. package/lib/plans.js.map +1 -1
  113. package/lib/protocol.d.ts +50 -34
  114. package/lib/protocol.d.ts.map +1 -1
  115. package/lib/protocol.js +146 -90
  116. package/lib/protocol.js.map +1 -1
  117. package/lib/snapshot-url.spec.js.map +1 -1
  118. package/lib/team-subscription-protocol.d.ts +19 -3
  119. package/lib/team-subscription-protocol.d.ts.map +1 -1
  120. package/lib/team-subscription-protocol.js +16 -5
  121. package/lib/team-subscription-protocol.js.map +1 -1
  122. package/lib/teams-projects-protocol.d.ts +9 -3
  123. package/lib/teams-projects-protocol.d.ts.map +1 -1
  124. package/lib/teams-projects-protocol.js +1 -1
  125. package/lib/teams-projects-protocol.js.map +1 -1
  126. package/lib/typings/globals.d.ts +2 -2
  127. package/lib/typings/globals.d.ts.map +1 -1
  128. package/lib/util/analytics.d.ts.map +1 -1
  129. package/lib/util/analytics.js +6 -6
  130. package/lib/util/analytics.js.map +1 -1
  131. package/lib/util/async-iterator.d.ts.map +1 -1
  132. package/lib/util/async-iterator.js +3 -3
  133. package/lib/util/async-iterator.js.map +1 -1
  134. package/lib/util/cancelable.js.map +1 -1
  135. package/lib/util/date-time.js +6 -6
  136. package/lib/util/date-time.js.map +1 -1
  137. package/lib/util/debug-app.d.ts +25 -0
  138. package/lib/util/debug-app.d.ts.map +1 -0
  139. package/lib/util/debug-app.js +100 -0
  140. package/lib/util/debug-app.js.map +1 -0
  141. package/lib/util/deferred.js.map +1 -1
  142. package/lib/util/disposable.d.ts.map +1 -1
  143. package/lib/util/disposable.js +2 -2
  144. package/lib/util/disposable.js.map +1 -1
  145. package/lib/util/event.d.ts.map +1 -1
  146. package/lib/util/event.js +5 -3
  147. package/lib/util/event.js.map +1 -1
  148. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  149. package/lib/util/garbage-collected-cache.js +1 -1
  150. package/lib/util/garbage-collected-cache.js.map +1 -1
  151. package/lib/util/generate-workspace-id.d.ts +5 -0
  152. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  153. package/lib/util/generate-workspace-id.js +446 -442
  154. package/lib/util/generate-workspace-id.js.map +1 -1
  155. package/lib/util/generate-workspace-id.spec.js +18 -7
  156. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  157. package/lib/util/gitpod-cookie.d.ts +1 -1
  158. package/lib/util/gitpod-cookie.d.ts.map +1 -1
  159. package/lib/util/gitpod-cookie.js +0 -3
  160. package/lib/util/gitpod-cookie.js.map +1 -1
  161. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  162. package/lib/util/gitpod-host-url.js +31 -29
  163. package/lib/util/gitpod-host-url.js.map +1 -1
  164. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  165. package/lib/util/gitpod-host-url.spec.js +15 -5
  166. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  167. package/lib/util/grpc.d.ts.map +1 -1
  168. package/lib/util/grpc.js.map +1 -1
  169. package/lib/util/jaeger-client-types.d.ts.map +1 -1
  170. package/lib/util/logging.d.ts +1 -1
  171. package/lib/util/logging.d.ts.map +1 -1
  172. package/lib/util/logging.js +31 -25
  173. package/lib/util/logging.js.map +1 -1
  174. package/lib/util/make-link.js +5 -5
  175. package/lib/util/make-link.js.map +1 -1
  176. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  177. package/lib/util/parse-workspace-id.js +1 -2
  178. package/lib/util/parse-workspace-id.js.map +1 -1
  179. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  180. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  181. package/lib/util/queue.spec.js +9 -6
  182. package/lib/util/queue.spec.js.map +1 -1
  183. package/lib/util/semaphore.d.ts.map +1 -1
  184. package/lib/util/semaphore.js.map +1 -1
  185. package/lib/util/skip-if.d.ts.map +1 -1
  186. package/lib/util/skip-if.js.map +1 -1
  187. package/lib/util/timeutil.d.ts +1 -0
  188. package/lib/util/timeutil.d.ts.map +1 -1
  189. package/lib/util/timeutil.js +9 -3
  190. package/lib/util/timeutil.js.map +1 -1
  191. package/lib/util/timeutil.spec.d.ts.map +1 -1
  192. package/lib/util/timeutil.spec.js.map +1 -1
  193. package/lib/util/tracing.d.ts +6 -6
  194. package/lib/util/tracing.d.ts.map +1 -1
  195. package/lib/util/tracing.js +14 -16
  196. package/lib/util/tracing.js.map +1 -1
  197. package/lib/util/tracing.spec.js +3 -3
  198. package/lib/util/tracing.spec.js.map +1 -1
  199. package/lib/util/workspace-port-authentication.d.ts +7 -7
  200. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  201. package/lib/util/workspace-port-authentication.js +8 -11
  202. package/lib/util/workspace-port-authentication.js.map +1 -1
  203. package/lib/workspace-cluster.d.ts +1 -1
  204. package/lib/workspace-cluster.d.ts.map +1 -1
  205. package/lib/workspace-cluster.js +2 -4
  206. package/lib/workspace-cluster.js.map +1 -1
  207. package/lib/workspace-instance.d.ts +18 -3
  208. package/lib/workspace-instance.d.ts.map +1 -1
  209. package/lib/wsready.d.ts.map +1 -1
  210. package/lib/wsready.js +1 -1
  211. package/package.json +9 -6
  212. package/pkg-yarn.lock +7 -5
  213. package/provenance-bundle.jsonl +1 -1
  214. package/src/accounting-protocol.ts +63 -51
  215. package/src/admin-protocol.ts +22 -20
  216. package/src/analytics.ts +21 -21
  217. package/src/auth.ts +2 -2
  218. package/src/context-url.spec.ts +25 -11
  219. package/src/context-url.ts +80 -78
  220. package/src/email-protocol.ts +5 -6
  221. package/src/encryption/container-module.ts +2 -3
  222. package/src/encryption/encryption-engine.spec.ts +9 -8
  223. package/src/encryption/encryption-engine.ts +14 -14
  224. package/src/encryption/encryption-service.ts +4 -5
  225. package/src/encryption/key-provider.ts +16 -19
  226. package/src/env.ts +0 -22
  227. package/src/experiments/always-default.ts +24 -0
  228. package/src/experiments/configcat-server.ts +37 -0
  229. package/src/experiments/configcat.ts +53 -0
  230. package/src/experiments/types.ts +32 -0
  231. package/src/gitpod-file-parser.spec.ts +55 -61
  232. package/src/gitpod-file-parser.ts +16 -17
  233. package/src/gitpod-service.ts +153 -110
  234. package/src/headless-workspace-log.ts +5 -4
  235. package/src/ide-frontend-service.ts +2 -2
  236. package/src/ide-protocol.ts +8 -8
  237. package/src/index.ts +16 -16
  238. package/src/installation-admin-protocol.ts +11 -8
  239. package/src/license-protocol.ts +12 -6
  240. package/src/messaging/browser/connection.ts +45 -47
  241. package/src/messaging/browser/window-connection.ts +39 -29
  242. package/src/messaging/client-call-metrics.ts +70 -71
  243. package/src/messaging/error.ts +7 -3
  244. package/src/messaging/handler.ts +6 -6
  245. package/src/messaging/node/connection.ts +8 -8
  246. package/src/messaging/proxy-factory.ts +23 -30
  247. package/src/oss-allowlist.ts +3 -3
  248. package/src/payment-protocol.ts +2 -2
  249. package/src/permission.ts +20 -31
  250. package/src/plans.ts +236 -189
  251. package/src/protocol.ts +298 -242
  252. package/src/snapshot-url.spec.ts +9 -7
  253. package/src/team-subscription-protocol.ts +55 -23
  254. package/src/teams-projects-protocol.ts +15 -8
  255. package/src/typings/globals.ts +4 -4
  256. package/src/util/analytics.ts +46 -42
  257. package/src/util/async-iterator.ts +4 -5
  258. package/src/util/cancelable.ts +3 -3
  259. package/src/util/date-time.ts +8 -8
  260. package/src/util/debug-app.ts +81 -0
  261. package/src/util/deferred.ts +6 -6
  262. package/src/util/disposable.ts +3 -6
  263. package/src/util/event.ts +9 -11
  264. package/src/util/garbage-collected-cache.ts +3 -6
  265. package/src/util/generate-workspace-id.spec.ts +26 -16
  266. package/src/util/generate-workspace-id.ts +460 -454
  267. package/src/util/gitpod-cookie.ts +8 -9
  268. package/src/util/gitpod-host-url.spec.ts +40 -13
  269. package/src/util/gitpod-host-url.ts +37 -34
  270. package/src/util/grpc.ts +1 -1
  271. package/src/util/jaeger-client-types.ts +2 -2
  272. package/src/util/logging.ts +60 -42
  273. package/src/util/make-link.ts +6 -7
  274. package/src/util/parse-workspace-id.spec.ts +17 -8
  275. package/src/util/parse-workspace-id.ts +5 -6
  276. package/src/util/queue.spec.ts +27 -25
  277. package/src/util/repeat.ts +1 -1
  278. package/src/util/semaphore.ts +4 -6
  279. package/src/util/skip-if.ts +9 -6
  280. package/src/util/timeutil.spec.ts +14 -15
  281. package/src/util/timeutil.ts +21 -11
  282. package/src/util/tracing.spec.ts +28 -23
  283. package/src/util/tracing.ts +54 -51
  284. package/src/util/workspace-port-authentication.ts +10 -13
  285. package/src/workspace-cluster.ts +15 -12
  286. package/src/workspace-instance.ts +52 -24
  287. package/src/wsready.ts +2 -2
  288. package/data/builtin-theia-plugins.json +0 -372
  289. package/lib/theia-plugins.d.ts +0 -11
  290. package/lib/theia-plugins.d.ts.map +0 -1
  291. package/lib/theia-plugins.js.map +0 -1
  292. package/src/theia-plugins.ts +0 -11
@@ -7,40 +7,39 @@
7
7
  import { injectable } from "inversify";
8
8
  import * as yaml from "js-yaml";
9
9
  import * as Ajv from "ajv";
10
- import { log } from './util/logging';
10
+ import { log } from "./util/logging";
11
11
  import { WorkspaceConfig, PortRangeConfig } from "./protocol";
12
12
 
13
- export type MaybeConfig = WorkspaceConfig | undefined
13
+ export type MaybeConfig = WorkspaceConfig | undefined;
14
14
 
15
- const schema = require('../data/gitpod-schema.json');
15
+ const schema = require("../data/gitpod-schema.json");
16
16
  const validate = new Ajv().compile(schema);
17
17
  const defaultParseOptions = {
18
18
  acceptPortRanges: false,
19
19
  };
20
20
 
21
21
  export interface ParseResult {
22
- config: WorkspaceConfig
23
- parsedConfig?: WorkspaceConfig
24
- validationErrors?: string[]
22
+ config: WorkspaceConfig;
23
+ parsedConfig?: WorkspaceConfig;
24
+ validationErrors?: string[];
25
25
  }
26
26
 
27
27
  @injectable()
28
28
  export class GitpodFileParser {
29
-
30
29
  public parse(content: string, parseOptions = {}, defaultConfig: WorkspaceConfig = {}): ParseResult {
31
30
  const options = {
32
- ...defaultParseOptions,
33
- ...parseOptions,
31
+ ...defaultParseOptions,
32
+ ...parseOptions,
34
33
  };
35
34
  try {
36
35
  const parsedConfig = yaml.safeLoad(content) as any;
37
36
  validate(parsedConfig);
38
- const validationErrors = validate.errors ? validate.errors.map( e => e.message || e.keyword ) : undefined;
37
+ const validationErrors = validate.errors ? validate.errors.map((e) => e.message || e.keyword) : undefined;
39
38
  if (validationErrors && validationErrors.length > 0) {
40
39
  return {
41
40
  config: defaultConfig,
42
41
  parsedConfig,
43
- validationErrors
42
+ validationErrors,
44
43
  };
45
44
  }
46
45
  const overrides = {} as any;
@@ -49,17 +48,17 @@ export class GitpodFileParser {
49
48
  }
50
49
  return {
51
50
  config: {
52
- ... defaultConfig,
53
- ... parsedConfig,
54
- ... overrides,
51
+ ...defaultConfig,
52
+ ...parsedConfig,
53
+ ...overrides,
55
54
  },
56
- parsedConfig
55
+ parsedConfig,
57
56
  };
58
57
  } catch (err) {
59
- log.error('Unparsable Gitpod configuration', err, { content });
58
+ log.error("Unparsable Gitpod configuration", err, { content });
60
59
  return {
61
60
  config: defaultConfig,
62
- validationErrors: ['Unparsable Gitpod configuration: ' + err.toString()]
61
+ validationErrors: ["Unparsable Gitpod configuration: " + err.toString()],
63
62
  };
64
63
  }
65
64
  }
@@ -5,32 +5,58 @@
5
5
  */
6
6
 
7
7
  import {
8
- User, WorkspaceInfo, WorkspaceCreationResult, WorkspaceInstanceUser,
9
- WhitelistedRepository, WorkspaceImageBuild, AuthProviderInfo, CreateWorkspaceMode,
10
- Token, UserEnvVarValue, ResolvePluginsParams, PreparePluginUploadParams, Terms,
11
- ResolvedPlugins, Configuration, InstallPluginsParams, UninstallPluginParams, UserInfo, GitpodTokenType,
12
- GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes, ProjectEnvVar
13
- } from './protocol';
8
+ User,
9
+ WorkspaceInfo,
10
+ WorkspaceCreationResult,
11
+ WorkspaceInstanceUser,
12
+ WhitelistedRepository,
13
+ WorkspaceImageBuild,
14
+ AuthProviderInfo,
15
+ CreateWorkspaceMode,
16
+ Token,
17
+ UserEnvVarValue,
18
+ Terms,
19
+ Configuration,
20
+ UserInfo,
21
+ GitpodTokenType,
22
+ GitpodToken,
23
+ AuthProviderEntry,
24
+ GuessGitTokenScopesParams,
25
+ GuessedGitTokenScopes,
26
+ ProjectEnvVar,
27
+ } from "./protocol";
14
28
  import {
15
- Team, TeamMemberInfo,
16
- TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult, PartialProject
17
- } from './teams-projects-protocol';
18
- import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
19
- import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
20
- import { HeadlessLogUrls } from './headless-workspace-log';
21
- import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from './workspace-instance';
22
- import { AdminServer } from './admin-protocol';
23
- import { GitpodHostUrl } from './util/gitpod-host-url';
24
- import { WebSocketConnectionProvider } from './messaging/browser/connection';
25
- import { PermissionName } from './permission';
26
- import { LicenseService } from './license-protocol';
27
- import { Emitter } from './util/event';
28
- import { AccountStatement, CreditAlert } from './accounting-protocol';
29
- import { GithubUpgradeURL, PlanCoupon } from './payment-protocol';
30
- import { TeamSubscription, TeamSubscriptionSlot, TeamSubscriptionSlotResolved } from './team-subscription-protocol';
31
- import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from './analytics';
32
- import { IDEServer } from './ide-protocol';
33
- import { InstallationAdminSettings, TelemetryData } from './installation-admin-protocol';
29
+ Team,
30
+ TeamMemberInfo,
31
+ TeamMembershipInvite,
32
+ Project,
33
+ TeamMemberRole,
34
+ PrebuildWithStatus,
35
+ StartPrebuildResult,
36
+ PartialProject,
37
+ } from "./teams-projects-protocol";
38
+ import { JsonRpcProxy, JsonRpcServer } from "./messaging/proxy-factory";
39
+ import { Disposable, CancellationTokenSource } from "vscode-jsonrpc";
40
+ import { HeadlessLogUrls } from "./headless-workspace-log";
41
+ import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from "./workspace-instance";
42
+ import { AdminServer } from "./admin-protocol";
43
+ import { GitpodHostUrl } from "./util/gitpod-host-url";
44
+ import { WebSocketConnectionProvider } from "./messaging/browser/connection";
45
+ import { PermissionName } from "./permission";
46
+ import { LicenseService } from "./license-protocol";
47
+ import { Emitter } from "./util/event";
48
+ import { AccountStatement, CreditAlert } from "./accounting-protocol";
49
+ import { GithubUpgradeURL, PlanCoupon } from "./payment-protocol";
50
+ import {
51
+ TeamSubscription,
52
+ TeamSubscription2,
53
+ TeamSubscriptionSlot,
54
+ TeamSubscriptionSlotResolved,
55
+ } from "./team-subscription-protocol";
56
+ import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
57
+ import { IDEServer } from "./ide-protocol";
58
+ import { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
59
+ import { Currency } from "./plans";
34
60
 
35
61
  export interface GitpodClient {
36
62
  onInstanceUpdate(instance: WorkspaceInstance): void;
@@ -46,7 +72,7 @@ export interface GitpodClient {
46
72
  //#endregion
47
73
  }
48
74
 
49
- export const GitpodServer = Symbol('GitpodServer');
75
+ export const GitpodServer = Symbol("GitpodServer");
50
76
  export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
51
77
  // User related API
52
78
  getLoggedInUser(): Promise<User>;
@@ -159,8 +185,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
159
185
  deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
160
186
 
161
187
  // content service
162
- getContentBlobUploadUrl(name: string): Promise<string>
163
- getContentBlobDownloadUrl(name: string): Promise<string>
188
+ getContentBlobUploadUrl(name: string): Promise<string>;
189
+ getContentBlobDownloadUrl(name: string): Promise<string>;
164
190
 
165
191
  // Gitpod token
166
192
  getGitpodTokens(): Promise<GitpodToken[]>;
@@ -169,6 +195,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
169
195
 
170
196
  // misc
171
197
  sendFeedback(feedback: string): Promise<string | undefined>;
198
+ isGitHubAppEnabled(): Promise<boolean>;
172
199
  registerGithubApp(installationId: string): Promise<void>;
173
200
 
174
201
  /**
@@ -197,15 +224,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
197
224
  */
198
225
  getLayout(workspaceId: string): Promise<string | undefined>;
199
226
 
200
- /**
201
- * @param params
202
- * @returns promise resolves to an URL to be used for the upload
203
- */
204
- preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
205
- resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
206
- installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
207
- uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
208
-
209
227
  guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
210
228
 
211
229
  /**
@@ -223,7 +241,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
223
241
  */
224
242
  getChargebeeSiteId(): Promise<string>;
225
243
  createPortalSession(): Promise<{}>;
244
+ createTeamPortalSession(teamId: string): Promise<{}>;
226
245
  checkout(planId: string, planQuantity?: number): Promise<{}>;
246
+ teamCheckout(teamId: string, planId: string): Promise<{}>;
227
247
  getAvailableCoupons(): Promise<PlanCoupon[]>;
228
248
  getAppliedCoupons(): Promise<PlanCoupon[]>;
229
249
 
@@ -235,17 +255,28 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
235
255
  subscriptionCancel(subscriptionId: string): Promise<void>;
236
256
  subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
237
257
 
258
+ getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
238
259
  tsGet(): Promise<TeamSubscription[]>;
239
260
  tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
240
- tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>
261
+ tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
241
262
  tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
242
- tsAssignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, identityStr: string | undefined): Promise<void>
263
+ tsAssignSlot(
264
+ teamSubscriptionId: string,
265
+ teamSubscriptionSlotId: string,
266
+ identityStr: string | undefined,
267
+ ): Promise<void>;
243
268
  tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
244
269
  tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
245
270
  tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
246
271
 
247
272
  getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
248
273
 
274
+ getStripePublishableKey(): Promise<string>;
275
+ getStripeSetupIntentClientSecret(): Promise<string>;
276
+ findStripeSubscriptionIdForTeam(teamId: string): Promise<string | undefined>;
277
+ subscribeTeamToStripe(teamId: string, setupIntentId: string, currency: Currency): Promise<void>;
278
+ getStripePortalUrlForTeam(teamId: string): Promise<string>;
279
+
249
280
  /**
250
281
  * Analytics
251
282
  */
@@ -255,13 +286,13 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
255
286
  }
256
287
 
257
288
  export interface RateLimiterError {
258
- method?: string,
289
+ method?: string;
259
290
 
260
291
  /**
261
292
  * Retry after this many seconds, earliest.
262
293
  * cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
263
294
  */
264
- retryAfter: number,
295
+ retryAfter: number;
265
296
  }
266
297
 
267
298
  export interface CreateProjectParams {
@@ -292,7 +323,7 @@ export interface ProviderRepository {
292
323
  account: string;
293
324
  accountAvatarUrl: string;
294
325
  cloneUrl: string;
295
- updatedAt: string;
326
+ updatedAt?: string;
296
327
  installationId?: number;
297
328
  installationUpdatedAt?: string;
298
329
 
@@ -306,15 +337,28 @@ export interface ClientHeaderFields {
306
337
  clientRegion?: string;
307
338
  }
308
339
 
309
- export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
310
-
311
- export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(methods: Partial<JsonRpcProxy<S>>): GitpodServiceImpl<C, S> {
340
+ export const WORKSPACE_TIMEOUT_DEFAULT_SHORT = "short";
341
+ export const WORKSPACE_TIMEOUT_DEFAULT_LONG = "long";
342
+ export const WORKSPACE_TIMEOUT_EXTENDED = "extended";
343
+ export const WORKSPACE_TIMEOUT_EXTENDED_ALT = "180m"; // for backwards compatibility since the IDE uses this
344
+ export const WorkspaceTimeoutValues = [
345
+ WORKSPACE_TIMEOUT_DEFAULT_SHORT,
346
+ WORKSPACE_TIMEOUT_DEFAULT_LONG,
347
+ WORKSPACE_TIMEOUT_EXTENDED,
348
+ WORKSPACE_TIMEOUT_EXTENDED_ALT,
349
+ ] as const;
350
+
351
+ export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
352
+ methods: Partial<JsonRpcProxy<S>>,
353
+ ): GitpodServiceImpl<C, S> {
312
354
  return new GitpodServiceImpl<C, S>(createServerMock(methods));
313
- }
355
+ };
314
356
 
315
- export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(methods: Partial<JsonRpcProxy<S>>): JsonRpcProxy<S> {
316
- methods.setClient = methods.setClient || (() => { });
317
- methods.dispose = methods.dispose || (() => { });
357
+ export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
358
+ methods: Partial<JsonRpcProxy<S>>,
359
+ ): JsonRpcProxy<S> {
360
+ methods.setClient = methods.setClient || (() => {});
361
+ methods.dispose = methods.dispose || (() => {});
318
362
  return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
319
363
  // @ts-ignore
320
364
  get: (target: S, property: keyof S) => {
@@ -323,25 +367,26 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
323
367
  throw new Error(`Method ${property} not implemented`);
324
368
  }
325
369
  return result;
326
- }
370
+ },
327
371
  });
328
- }
372
+ };
329
373
 
330
374
  type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
331
375
  export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
332
376
 
333
377
  export interface SetWorkspaceTimeoutResult {
334
- resetTimeoutOnWorkspaces: string[]
378
+ resetTimeoutOnWorkspaces: string[];
335
379
  }
336
380
 
337
381
  export interface GetWorkspaceTimeoutResult {
338
- duration: WorkspaceTimeoutDuration
339
- canChange: boolean
382
+ duration: WorkspaceTimeoutDuration;
383
+ durationRaw: string;
384
+ canChange: boolean;
340
385
  }
341
386
 
342
387
  export interface StartWorkspaceResult {
343
- instanceID: string
344
- workspaceURL?: string
388
+ instanceID: string;
389
+ workspaceURL?: string;
345
390
  }
346
391
 
347
392
  export namespace GitpodServer {
@@ -385,23 +430,23 @@ export namespace GitpodServer {
385
430
  readonly roundTripTime?: number;
386
431
  }
387
432
  export interface UpdateOwnAuthProviderParams {
388
- readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
433
+ readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
389
434
  }
390
435
  export interface DeleteOwnAuthProviderParams {
391
- readonly id: string
436
+ readonly id: string;
392
437
  }
393
438
  export type AdmissionLevel = "owner" | "everyone";
394
439
  export type PinAction = "pin" | "unpin" | "toggle";
395
440
  export interface GenerateNewGitpodTokenOptions {
396
- name?: string
397
- type: GitpodTokenType
398
- scopes?: string[]
441
+ name?: string;
442
+ type: GitpodTokenType;
443
+ scopes?: string[];
399
444
  }
400
445
  }
401
446
 
402
- export const GitpodServerPath = '/gitpod';
447
+ export const GitpodServerPath = "/gitpod";
403
448
 
404
- export const GitpodServerProxy = Symbol('GitpodServerProxy');
449
+ export const GitpodServerProxy = Symbol("GitpodServerProxy");
405
450
  export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
406
451
 
407
452
  export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
@@ -415,8 +460,8 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
415
460
  if (index > -1) {
416
461
  this.clients.splice(index, 1);
417
462
  }
418
- }
419
- }
463
+ },
464
+ };
420
465
  }
421
466
 
422
467
  onInstanceUpdate(instance: WorkspaceInstance): void {
@@ -425,7 +470,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
425
470
  try {
426
471
  client.onInstanceUpdate(instance);
427
472
  } catch (error) {
428
- console.error(error)
473
+ console.error(error);
429
474
  }
430
475
  }
431
476
  }
@@ -437,19 +482,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
437
482
  try {
438
483
  client.onPrebuildUpdate(update);
439
484
  } catch (error) {
440
- console.error(error)
485
+ console.error(error);
441
486
  }
442
487
  }
443
488
  }
444
489
  }
445
490
 
446
- onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
491
+ onWorkspaceImageBuildLogs(
492
+ info: WorkspaceImageBuild.StateInfo,
493
+ content: WorkspaceImageBuild.LogContent | undefined,
494
+ ): void {
447
495
  for (const client of this.clients) {
448
496
  if (client.onWorkspaceImageBuildLogs) {
449
497
  try {
450
498
  client.onWorkspaceImageBuildLogs(info, content);
451
499
  } catch (error) {
452
- console.error(error)
500
+ console.error(error);
453
501
  }
454
502
  }
455
503
  }
@@ -461,7 +509,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
461
509
  try {
462
510
  client.notifyDidOpenConnection();
463
511
  } catch (error) {
464
- console.error(error)
512
+ console.error(error);
465
513
  }
466
514
  }
467
515
  }
@@ -473,7 +521,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
473
521
  try {
474
522
  client.notifyDidCloseConnection();
475
523
  } catch (error) {
476
- console.error(error)
524
+ console.error(error);
477
525
  }
478
526
  }
479
527
  }
@@ -485,64 +533,61 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
485
533
  try {
486
534
  client.onCreditAlert(creditAlert);
487
535
  } catch (error) {
488
- console.error(error)
536
+ console.error(error);
489
537
  }
490
538
  }
491
539
  }
492
540
  }
493
-
494
541
  }
495
542
 
496
543
  export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
497
544
 
498
- const hasWindow = (typeof window !== 'undefined');
545
+ const hasWindow = typeof window !== "undefined";
499
546
  const phasesOrder: Record<WorkspaceInstancePhase, number> = {
500
547
  unknown: 0,
501
548
  preparing: 1,
502
- pending: 2,
503
- creating: 3,
504
- initializing: 4,
505
- running: 5,
506
- interrupted: 6,
507
- stopping: 7,
508
- stopped: 8
549
+ building: 2,
550
+ pending: 3,
551
+ creating: 4,
552
+ initializing: 5,
553
+ running: 6,
554
+ interrupted: 7,
555
+ stopping: 8,
556
+ stopped: 9,
509
557
  };
510
558
  export class WorkspaceInstanceUpdateListener {
511
559
  private readonly onDidChangeEmitter = new Emitter<void>();
512
560
  readonly onDidChange = this.onDidChangeEmitter.event;
513
561
 
514
- private source: 'sync' | 'update' = 'sync';
562
+ private source: "sync" | "update" = "sync";
515
563
 
516
564
  get info(): WorkspaceInfo {
517
565
  return this._info;
518
566
  }
519
567
 
520
- constructor(
521
- private readonly service: GitpodService,
522
- private _info: WorkspaceInfo
523
- ) {
568
+ constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
524
569
  service.registerClient({
525
- onInstanceUpdate: instance => {
570
+ onInstanceUpdate: (instance) => {
526
571
  if (this.isOutOfOrder(instance)) {
527
572
  return;
528
573
  }
529
574
  this.cancelSync();
530
575
  this._info.latestInstance = instance;
531
- this.source = 'update';
576
+ this.source = "update";
532
577
  this.onDidChangeEmitter.fire(undefined);
533
578
  },
534
579
  notifyDidOpenConnection: () => {
535
580
  this.sync();
536
- }
581
+ },
537
582
  });
538
583
  if (hasWindow) {
539
584
  // learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
540
- window.document.addEventListener('visibilitychange', async () => {
541
- if (window.document.visibilityState === 'visible') {
585
+ window.document.addEventListener("visibilitychange", async () => {
586
+ if (window.document.visibilityState === "visible") {
542
587
  this.sync();
543
588
  }
544
589
  });
545
- window.addEventListener('pageshow', e => {
590
+ window.addEventListener("pageshow", (e) => {
546
591
  if (e.persisted) {
547
592
  this.sync();
548
593
  }
@@ -570,12 +615,12 @@ export class WorkspaceInstanceUpdateListener {
570
615
  return;
571
616
  }
572
617
  this._info = info;
573
- this.source = 'sync';
618
+ this.source = "sync";
574
619
  this.onDidChangeEmitter.fire(undefined);
575
620
  } catch (e) {
576
- console.error('failed to sync workspace instance:', e)
621
+ console.error("failed to sync workspace instance:", e);
577
622
  }
578
- })
623
+ });
579
624
  }
580
625
  private cancelSync(): void {
581
626
  if (this.syncTokenSource) {
@@ -592,7 +637,7 @@ export class WorkspaceInstanceUpdateListener {
592
637
  if (instance.workspaceId !== this._info.workspace.id) {
593
638
  return true;
594
639
  }
595
- if (this.source === 'update') {
640
+ if (this.source === "update") {
596
641
  return false;
597
642
  }
598
643
  if (instance.id !== this.info.latestInstance?.id) {
@@ -600,15 +645,13 @@ export class WorkspaceInstanceUpdateListener {
600
645
  }
601
646
  return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
602
647
  }
603
-
604
648
  }
605
649
 
606
650
  export interface GitpodServiceOptions {
607
- onReconnect?: () => (void | Promise<void>)
651
+ onReconnect?: () => void | Promise<void>;
608
652
  }
609
653
 
610
654
  export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
611
-
612
655
  private readonly compositeClient = new GitpodCompositeClient<Client>();
613
656
 
614
657
  constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
@@ -623,7 +666,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
623
666
 
624
667
  private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
625
668
  listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
626
- const listener = this.instanceListeners.get(workspaceId) ||
669
+ const listener =
670
+ this.instanceListeners.get(workspaceId) ||
627
671
  (async () => {
628
672
  const info = await this.server.getWorkspace(workspaceId);
629
673
  return new WorkspaceInstanceUpdateListener(this, info);
@@ -639,26 +683,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
639
683
  }
640
684
  }
641
685
 
642
- export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(serverUrl: string | Promise<string>) {
686
+ export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
687
+ serverUrl: string | Promise<string>,
688
+ ) {
643
689
  const toWsUrl = (serverUrl: string) => {
644
- return new GitpodHostUrl(serverUrl)
645
- .asWebsocket()
646
- .withApi({ pathname: GitpodServerPath })
647
- .toString();
690
+ return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
648
691
  };
649
692
  let url: string | Promise<string>;
650
693
  if (typeof serverUrl === "string") {
651
694
  url = toWsUrl(serverUrl);
652
695
  } else {
653
- url = serverUrl.then(url => toWsUrl(url));
696
+ url = serverUrl.then((url) => toWsUrl(url));
654
697
  }
655
698
 
656
699
  const connectionProvider = new WebSocketConnectionProvider();
657
- let onReconnect = () => { };
700
+ let onReconnect = () => {};
658
701
  const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
659
- onListening: socket => {
702
+ onListening: (socket) => {
660
703
  onReconnect = () => socket.reconnect();
661
- }
704
+ },
662
705
  });
663
706
  return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
664
- }
707
+ }
@@ -4,7 +4,6 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
-
8
7
  export enum HeadlessWorkspaceEventType {
9
8
  LogOutput = "log-output",
10
9
  FinishedSuccessfully = "finish-success",
@@ -12,14 +11,16 @@ export enum HeadlessWorkspaceEventType {
12
11
  AbortedTimedOut = "aborted-timeout",
13
12
  Aborted = "aborted",
14
13
  Failed = "failed",
15
- Started = "started"
14
+ Started = "started",
16
15
  }
17
16
  export namespace HeadlessWorkspaceEventType {
18
17
  export function isRunning(t: HeadlessWorkspaceEventType) {
19
18
  return t === HeadlessWorkspaceEventType.LogOutput;
20
19
  }
21
20
  export function didFinish(t: HeadlessWorkspaceEventType) {
22
- return t === HeadlessWorkspaceEventType.FinishedButFailed || t === HeadlessWorkspaceEventType.FinishedSuccessfully;
21
+ return (
22
+ t === HeadlessWorkspaceEventType.FinishedButFailed || t === HeadlessWorkspaceEventType.FinishedSuccessfully
23
+ );
23
24
  }
24
25
  }
25
26
 
@@ -36,4 +37,4 @@ export interface HeadlessLogUrls {
36
37
 
37
38
  /** cmp. @const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX */
38
39
  export const HEADLESS_LOG_STREAM_STATUS_CODE = "X-LogStream-StatusCode";
39
- export const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX = /X-LogStream-StatusCode: ([0-9]{3})/;
40
+ export const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX = /X-LogStream-StatusCode: ([0-9]{3})/;
@@ -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;
@@ -25,4 +25,4 @@ export interface IDEFrontendService {
25
25
  * confirmation dialogs for stopped workspaces.
26
26
  */
27
27
  start(): Disposable;
28
- }
28
+ }