@gitpod/gitpod-protocol 0.1.5-sje-kots-node-reqs.1 → 0.1.5-sje-no-log-envvars.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/data/gitpod-schema.json +71 -129
  2. package/lib/accounting-protocol.d.ts +1 -0
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +4 -0
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +4 -1
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js.map +1 -1
  9. package/lib/attribution.d.ts +3 -0
  10. package/lib/attribution.d.ts.map +1 -1
  11. package/lib/attribution.js +10 -0
  12. package/lib/attribution.js.map +1 -1
  13. package/lib/billing-mode.d.ts +41 -0
  14. package/lib/billing-mode.d.ts.map +1 -0
  15. package/lib/billing-mode.js +44 -0
  16. package/lib/billing-mode.js.map +1 -0
  17. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  18. package/lib/encryption/encryption-engine.js +3 -3
  19. package/lib/encryption/encryption-engine.js.map +1 -1
  20. package/lib/encryption/encryption-engine.spec.js +1 -1
  21. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  22. package/lib/encryption/key-provider.js +1 -1
  23. package/lib/encryption/key-provider.js.map +1 -1
  24. package/lib/experiments/configcat-server.d.ts +2 -0
  25. package/lib/experiments/configcat-server.d.ts.map +1 -1
  26. package/lib/experiments/configcat-server.js +2 -1
  27. package/lib/experiments/configcat-server.js.map +1 -1
  28. package/lib/experiments/configcat.d.ts +1 -1
  29. package/lib/experiments/configcat.d.ts.map +1 -1
  30. package/lib/experiments/configcat.js +4 -5
  31. package/lib/experiments/configcat.js.map +1 -1
  32. package/lib/experiments/types.d.ts +2 -3
  33. package/lib/experiments/types.d.ts.map +1 -1
  34. package/lib/experiments/types.js.map +1 -1
  35. package/lib/gitpod-service.d.ts +23 -24
  36. package/lib/gitpod-service.d.ts.map +1 -1
  37. package/lib/gitpod-service.js +12 -0
  38. package/lib/gitpod-service.js.map +1 -1
  39. package/lib/ide-protocol.d.ts +8 -0
  40. package/lib/ide-protocol.d.ts.map +1 -1
  41. package/lib/index.d.ts +0 -1
  42. package/lib/index.d.ts.map +1 -1
  43. package/lib/index.js +0 -1
  44. package/lib/index.js.map +1 -1
  45. package/lib/messaging/client-call-metrics.d.ts +1 -17
  46. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  47. package/lib/messaging/client-call-metrics.js +1 -2
  48. package/lib/messaging/client-call-metrics.js.map +1 -1
  49. package/lib/messaging/error.d.ts +5 -1
  50. package/lib/messaging/error.d.ts.map +1 -1
  51. package/lib/messaging/error.js +11 -3
  52. package/lib/messaging/error.js.map +1 -1
  53. package/lib/plans.d.ts +1 -0
  54. package/lib/plans.d.ts.map +1 -1
  55. package/lib/plans.js +6 -2
  56. package/lib/plans.js.map +1 -1
  57. package/lib/protocol.d.ts +48 -18
  58. package/lib/protocol.d.ts.map +1 -1
  59. package/lib/protocol.js +34 -9
  60. package/lib/protocol.js.map +1 -1
  61. package/lib/team-subscription-protocol.d.ts +1 -0
  62. package/lib/team-subscription-protocol.d.ts.map +1 -1
  63. package/lib/team-subscription-protocol.js +4 -0
  64. package/lib/team-subscription-protocol.js.map +1 -1
  65. package/lib/teams-projects-protocol.d.ts +0 -1
  66. package/lib/teams-projects-protocol.d.ts.map +1 -1
  67. package/lib/teams-projects-protocol.js.map +1 -1
  68. package/lib/usage.d.ts +49 -10
  69. package/lib/usage.d.ts.map +1 -1
  70. package/lib/usage.js +6 -107
  71. package/lib/usage.js.map +1 -1
  72. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  73. package/lib/util/garbage-collected-cache.js +5 -0
  74. package/lib/util/garbage-collected-cache.js.map +1 -1
  75. package/lib/util/gitpod-host-url.d.ts +3 -0
  76. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  77. package/lib/util/gitpod-host-url.js +18 -0
  78. package/lib/util/gitpod-host-url.js.map +1 -1
  79. package/lib/util/grpc.d.ts +19 -0
  80. package/lib/util/grpc.d.ts.map +1 -1
  81. package/lib/util/grpc.js +73 -1
  82. package/lib/util/grpc.js.map +1 -1
  83. package/lib/util/logging.spec.d.ts +7 -0
  84. package/lib/util/logging.spec.d.ts.map +1 -0
  85. package/lib/util/logging.spec.js +52 -0
  86. package/lib/util/logging.spec.js.map +1 -0
  87. package/lib/util/nice-grpc.d.ts +9 -0
  88. package/lib/util/nice-grpc.d.ts.map +1 -0
  89. package/lib/util/nice-grpc.js +119 -0
  90. package/lib/util/nice-grpc.js.map +1 -0
  91. package/lib/util/timeutil.d.ts +1 -0
  92. package/lib/util/timeutil.d.ts.map +1 -1
  93. package/lib/util/timeutil.js +7 -1
  94. package/lib/util/timeutil.js.map +1 -1
  95. package/lib/util/timeutil.spec.d.ts +2 -0
  96. package/lib/util/timeutil.spec.d.ts.map +1 -1
  97. package/lib/util/timeutil.spec.js +34 -0
  98. package/lib/util/timeutil.spec.js.map +1 -1
  99. package/lib/workspace-class.d.ts +14 -0
  100. package/lib/workspace-class.d.ts.map +1 -0
  101. package/lib/workspace-class.js +8 -0
  102. package/lib/workspace-class.js.map +1 -0
  103. package/lib/workspace-cluster.d.ts +1 -0
  104. package/lib/workspace-cluster.d.ts.map +1 -1
  105. package/lib/workspace-cluster.js.map +1 -1
  106. package/lib/workspace-instance.d.ts +1 -0
  107. package/lib/workspace-instance.d.ts.map +1 -1
  108. package/lib/wsready.js +1 -1
  109. package/package.json +7 -2
  110. package/pkg-yarn.lock +5 -2
  111. package/provenance-bundle.jsonl +1 -1
  112. package/src/accounting-protocol.ts +3 -0
  113. package/src/admin-protocol.ts +4 -1
  114. package/src/attribution.ts +11 -0
  115. package/src/billing-mode.ts +77 -0
  116. package/src/encryption/encryption-engine.spec.ts +1 -1
  117. package/src/encryption/encryption-engine.ts +7 -3
  118. package/src/encryption/key-provider.ts +1 -1
  119. package/src/experiments/configcat-server.ts +3 -0
  120. package/src/experiments/configcat.ts +3 -4
  121. package/src/experiments/types.ts +4 -5
  122. package/src/gitpod-service.ts +39 -26
  123. package/src/ide-protocol.ts +10 -0
  124. package/src/index.ts +0 -1
  125. package/src/messaging/client-call-metrics.ts +1 -20
  126. package/src/messaging/error.ts +16 -4
  127. package/src/plans.ts +6 -2
  128. package/src/protocol.ts +75 -25
  129. package/src/team-subscription-protocol.ts +3 -0
  130. package/src/teams-projects-protocol.ts +0 -1
  131. package/src/usage.ts +53 -128
  132. package/src/util/garbage-collected-cache.ts +5 -0
  133. package/src/util/gitpod-host-url.ts +21 -0
  134. package/src/util/grpc.ts +89 -0
  135. package/src/util/logging.spec.ts +23 -0
  136. package/src/util/nice-grpc.ts +93 -0
  137. package/src/util/timeutil.spec.ts +28 -1
  138. package/src/util/timeutil.ts +6 -0
  139. package/src/workspace-class.ts +14 -0
  140. package/src/workspace-cluster.ts +4 -0
  141. package/src/workspace-instance.ts +3 -0
  142. package/src/wsready.ts +1 -1
  143. package/lib/email-protocol.d.ts +0 -49
  144. package/lib/email-protocol.d.ts.map +0 -1
  145. package/lib/email-protocol.js +0 -28
  146. package/lib/email-protocol.js.map +0 -1
  147. package/src/email-protocol.ts +0 -65
@@ -60,8 +60,9 @@ import {
60
60
  import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
61
61
  import { IDEServer } from "./ide-protocol";
62
62
  import { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
63
- import { Currency } from "./plans";
64
- import { BillableSession } from "./usage";
63
+ import { ListUsageRequest, ListUsageResponse } from "./usage";
64
+ import { SupportedWorkspaceClass } from "./workspace-class";
65
+ import { BillingMode } from "./billing-mode";
65
66
 
66
67
  export interface GitpodClient {
67
68
  onInstanceUpdate(instance: WorkspaceInstance): void;
@@ -69,6 +70,8 @@ export interface GitpodClient {
69
70
 
70
71
  onPrebuildUpdate(update: PrebuildWithStatus): void;
71
72
 
73
+ onNotificationUpdated(): void;
74
+
72
75
  onCreditAlert(creditAlert: CreditAlert): void;
73
76
 
74
77
  //#region propagating reconnection to iframe
@@ -83,6 +86,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
83
86
  getLoggedInUser(): Promise<User>;
84
87
  getTerms(): Promise<Terms>;
85
88
  updateLoggedInUser(user: Partial<User>): Promise<User>;
89
+ sendPhoneNumberVerificationToken(phoneNumber: string): Promise<void>;
90
+ verifyPhoneNumberVerificationToken(phoneNumber: string, token: string): Promise<boolean>;
86
91
  getAuthProviders(): Promise<AuthProviderInfo[]>;
87
92
  getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
88
93
  updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
@@ -188,11 +193,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
188
193
  getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
189
194
  triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
190
195
  cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
191
- fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
192
- guessProjectConfiguration(projectId: string): Promise<string | undefined>;
193
- fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
194
- guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
195
- setProjectConfiguration(projectId: string, configString: string): Promise<void>;
196
196
  updateProjectPartial(partialProject: PartialProject): Promise<void>;
197
197
  setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
198
198
  getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
@@ -208,7 +208,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
208
208
  deleteGitpodToken(tokenHash: string): Promise<void>;
209
209
 
210
210
  // misc
211
- sendFeedback(feedback: string): Promise<string | undefined>;
212
211
  isGitHubAppEnabled(): Promise<boolean>;
213
212
  registerGithubApp(installationId: string): Promise<void>;
214
213
 
@@ -228,16 +227,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
228
227
  */
229
228
  getSnapshots(workspaceID: string): Promise<string[]>;
230
229
 
231
- /**
232
- * stores/updates layout information for the given workspace
233
- */
234
- storeLayout(workspaceId: string, layoutData: string): Promise<void>;
235
-
236
- /**
237
- * retrieves layout information for the given workspace
238
- */
239
- getLayout(workspaceId: string): Promise<string | undefined>;
240
-
241
230
  guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
242
231
 
243
232
  /**
@@ -287,11 +276,19 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
287
276
 
288
277
  getStripePublishableKey(): Promise<string>;
289
278
  getStripeSetupIntentClientSecret(): Promise<string>;
290
- findStripeSubscriptionIdForTeam(teamId: string): Promise<string | undefined>;
291
- subscribeTeamToStripe(teamId: string, setupIntentId: string, currency: Currency): Promise<void>;
292
- getStripePortalUrlForTeam(teamId: string): Promise<string>;
279
+ findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
280
+ createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
281
+ subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
282
+ getStripePortalUrl(attributionId: string): Promise<string>;
283
+ getUsageLimit(attributionId: string): Promise<number | undefined>;
284
+ setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
285
+
286
+ listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
287
+
288
+ setUsageAttribution(usageAttribution: string): Promise<void>;
293
289
 
294
- getBilledUsage(attributionId: string): Promise<BillableSession[]>;
290
+ getBillingModeForUser(): Promise<BillingMode>;
291
+ getBillingModeForTeam(teamId: string): Promise<BillingMode>;
295
292
 
296
293
  /**
297
294
  * Analytics
@@ -299,6 +296,13 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
299
296
  trackEvent(event: RemoteTrackMessage): Promise<void>;
300
297
  trackLocation(event: RemotePageMessage): Promise<void>;
301
298
  identifyUser(event: RemoteIdentifyMessage): Promise<void>;
299
+
300
+ /**
301
+ * Frontend notifications
302
+ */
303
+ getNotifications(): Promise<string[]>;
304
+
305
+ getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
302
306
  }
303
307
 
304
308
  export interface RateLimiterError {
@@ -313,9 +317,7 @@ export interface RateLimiterError {
313
317
 
314
318
  export interface CreateProjectParams {
315
319
  name: string;
316
- slug?: string;
317
- account: string;
318
- provider: string;
320
+ slug: string;
319
321
  cloneUrl: string;
320
322
  teamId?: string;
321
323
  userId?: string;
@@ -426,7 +428,6 @@ export namespace GitpodServer {
426
428
  }
427
429
  export interface TakeSnapshotOptions {
428
430
  workspaceId: string;
429
- layoutData?: string;
430
431
  /* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
431
432
  dontWait?: boolean;
432
433
  }
@@ -554,6 +555,18 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
554
555
  }
555
556
  }
556
557
  }
558
+
559
+ onNotificationUpdated(): void {
560
+ for (const client of this.clients) {
561
+ if (client.onNotificationUpdated) {
562
+ try {
563
+ client.onNotificationUpdated();
564
+ } catch (error) {
565
+ console.error(error);
566
+ }
567
+ }
568
+ }
569
+ }
557
570
  }
558
571
 
559
572
  export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
@@ -116,4 +116,14 @@ export interface IDEOption {
116
116
  * we resolve the tag regularly to the most recent image version.
117
117
  */
118
118
  resolveImageDigest?: boolean;
119
+
120
+ /**
121
+ * The plugin image ref for the IDE image, this image ref always resolve to digest.
122
+ */
123
+ pluginImage?: string;
124
+
125
+ /**
126
+ * The latest plugin image ref for the latest IDE image, this image ref always resolve to digest.
127
+ */
128
+ pluginLatestImage?: string;
119
129
  }
package/src/index.ts CHANGED
@@ -13,7 +13,6 @@ export * from "./license-protocol";
13
13
  export * from "./workspace-instance";
14
14
  export * from "./permission";
15
15
  export * from "./admin-protocol";
16
- export * from "./email-protocol";
17
16
  export * from "./headless-workspace-log";
18
17
  export * from "./context-url";
19
18
  export * from "./teams-projects-protocol";
@@ -6,26 +6,7 @@
6
6
 
7
7
  import { injectable } from "inversify";
8
8
  import * as prometheusClient from "prom-client";
9
-
10
- type GrpcMethodType = "unary" | "client_stream" | "server_stream" | "bidi_stream";
11
- export interface IGrpcCallMetricsLabels {
12
- service: string;
13
- method: string;
14
- type: GrpcMethodType;
15
- }
16
-
17
- export interface IGrpcCallMetricsLabelsWithCode extends IGrpcCallMetricsLabels {
18
- code: string;
19
- }
20
-
21
- export const IClientCallMetrics = Symbol("IClientCallMetrics");
22
-
23
- export interface IClientCallMetrics {
24
- started(labels: IGrpcCallMetricsLabels): void;
25
- sent(labels: IGrpcCallMetricsLabels): void;
26
- received(labels: IGrpcCallMetricsLabels): void;
27
- handled(labels: IGrpcCallMetricsLabelsWithCode): void;
28
- }
9
+ import { IClientCallMetrics, IGrpcCallMetricsLabels, IGrpcCallMetricsLabelsWithCode } from "../util/grpc";
29
10
 
30
11
  @injectable()
31
12
  export class PrometheusClientCallMetrics implements IClientCallMetrics {
@@ -26,21 +26,30 @@ export namespace ErrorCodes {
26
26
  // 410 No User
27
27
  export const SETUP_REQUIRED = 410;
28
28
 
29
+ // 411 No User
30
+ export const NEEDS_VERIFICATION = 411;
31
+
29
32
  // 429 Too Many Requests
30
33
  export const TOO_MANY_REQUESTS = 429;
31
34
 
32
35
  // 430 Repository not whitelisted (custom status code)
33
36
  export const REPOSITORY_NOT_WHITELISTED = 430;
34
37
 
38
+ // 450 Payment error
39
+ export const PAYMENT_ERROR = 450;
40
+
41
+ // 451 Out of credits
42
+ export const PAYMENT_SPENDING_LIMIT_REACHED = 451;
43
+
44
+ // 455 Invalid cost center (custom status code)
45
+ export const INVALID_COST_CENTER = 455;
46
+
35
47
  // 460 Context Parse Error (custom status code)
36
48
  export const CONTEXT_PARSE_ERROR = 460;
37
49
 
38
- // 461 Invalid gitpod yml
50
+ // 461 Invalid gitpod yml (custom status code)
39
51
  export const INVALID_GITPOD_YML = 461;
40
52
 
41
- // 450 Payment error
42
- export const PAYMENT_ERROR = 450;
43
-
44
53
  // 470 User Blocked (custom status code)
45
54
  export const USER_BLOCKED = 470;
46
55
 
@@ -85,4 +94,7 @@ export namespace ErrorCodes {
85
94
 
86
95
  // 640 Headless logs are not available (yet)
87
96
  export const HEADLESS_LOG_NOT_YET_AVAILABLE = 640;
97
+
98
+ // 650 Invalid Value
99
+ export const INVALID_VALUE = 650;
88
100
  }
package/src/plans.ts CHANGED
@@ -131,7 +131,7 @@ export namespace Plans {
131
131
  githubPlanNumber: 1,
132
132
 
133
133
  type: "free",
134
- name: "Open Source",
134
+ name: "Free",
135
135
  currency: "USD",
136
136
  pricePerMonth: 0,
137
137
  hoursPerMonth: 100,
@@ -146,7 +146,7 @@ export namespace Plans {
146
146
  githubPlanNumber: 5,
147
147
 
148
148
  type: "free-50",
149
- name: "Open Source",
149
+ name: "Free",
150
150
  currency: "USD",
151
151
  pricePerMonth: 0,
152
152
  hoursPerMonth: 50,
@@ -482,6 +482,10 @@ export namespace Plans {
482
482
  );
483
483
  }
484
484
 
485
+ export function isFreeTier(chargebeeId: string | undefined): boolean {
486
+ return chargebeeId === Plans.FREE.chargebeeId || chargebeeId === Plans.FREE_50.chargebeeId;
487
+ }
488
+
485
489
  export function isFreeNonTransientPlan(chargebeeId: string | undefined): boolean {
486
490
  return chargebeeId === Plans.FREE_OPEN_SOURCE.chargebeeId;
487
491
  }
package/src/protocol.ts CHANGED
@@ -8,6 +8,7 @@ import { WorkspaceInstance, PortVisibility } from "./workspace-instance";
8
8
  import { RoleOrPermission } from "./permission";
9
9
  import { Project } from "./teams-projects-protocol";
10
10
  import { createHash } from "crypto";
11
+ import { AttributionId } from "./attribution";
11
12
 
12
13
  export interface UserInfo {
13
14
  name?: string;
@@ -45,6 +46,15 @@ export interface User {
45
46
  markedDeleted?: boolean;
46
47
 
47
48
  additionalData?: AdditionalUserData;
49
+
50
+ // Identifies an explicit team or user ID to which all the user's workspace usage should be attributed to (e.g. for billing purposes)
51
+ usageAttributionId?: string;
52
+
53
+ // The last time this user got verified somehow. The user is not verified if this is empty.
54
+ lastVerificationTime?: string;
55
+
56
+ // The phone number used for the last phone verification.
57
+ verificationPhoneNumber?: string;
48
58
  }
49
59
 
50
60
  export namespace User {
@@ -199,14 +209,26 @@ export interface AdditionalUserData {
199
209
  knownGitHubOrgs?: string[];
200
210
  // Git clone URL pointing to the user's dotfile repo
201
211
  dotfileRepo?: string;
202
- // Identifies an explicit team or user ID to which all the user's workspace usage should be attributed to (e.g. for billing purposes)
203
- usageAttributionId?: string;
204
212
  // preferred workspace classes
205
213
  workspaceClasses?: WorkspaceClasses;
206
214
  // additional user profile data
207
215
  profile?: ProfileDetails;
208
216
  }
209
-
217
+ export namespace AdditionalUserData {
218
+ export function set(user: User, partialData: Partial<AdditionalUserData>): User {
219
+ if (!user.additionalData) {
220
+ user.additionalData = {
221
+ ...partialData,
222
+ };
223
+ } else {
224
+ user.additionalData = {
225
+ ...user.additionalData,
226
+ ...partialData,
227
+ };
228
+ }
229
+ return user;
230
+ }
231
+ }
210
232
  // The format in which we store User Profiles in
211
233
  export interface ProfileDetails {
212
234
  // when was the last time the user updated their profile information or has been nudged to do so.
@@ -264,17 +286,29 @@ export interface UserFeatureSettings {
264
286
  permanentWSFeatureFlags?: NamedWorkspaceFeatureFlag[];
265
287
  }
266
288
 
289
+ export type BillingTier = "paid" | "free";
290
+
267
291
  /**
268
292
  * The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
269
293
  * If they don't we'll break things during workspace startup.
270
294
  */
271
295
  export const WorkspaceFeatureFlags = {
272
296
  full_workspace_backup: undefined,
273
- fixed_resources: undefined,
274
297
  persistent_volume_claim: undefined,
275
298
  protected_secrets: undefined,
299
+ workspace_class_limiting: undefined,
300
+ workspace_connection_limiting: undefined,
276
301
  };
277
302
  export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
303
+ export namespace NamedWorkspaceFeatureFlag {
304
+ export const WORKSPACE_PERSISTED_FEATTURE_FLAGS: NamedWorkspaceFeatureFlag[] = [
305
+ "full_workspace_backup",
306
+ "persistent_volume_claim",
307
+ ];
308
+ export function isWorkspacePersisted(ff: NamedWorkspaceFeatureFlag): boolean {
309
+ return WORKSPACE_PERSISTED_FEATTURE_FLAGS.includes(ff);
310
+ }
311
+ }
278
312
 
279
313
  export interface EnvVarWithValue {
280
314
  name: string;
@@ -605,6 +639,7 @@ export interface PendingGithubEvent {
605
639
  creationDate: Date;
606
640
  type: string;
607
641
  event: string;
642
+ deleted: boolean;
608
643
  }
609
644
 
610
645
  export interface Snapshot {
@@ -613,7 +648,6 @@ export interface Snapshot {
613
648
  availableTime?: string;
614
649
  originalWorkspaceId: string;
615
650
  bucketId: string;
616
- layoutData?: string;
617
651
  state: SnapshotState;
618
652
  message?: string;
619
653
  }
@@ -627,12 +661,6 @@ export interface VolumeSnapshot {
627
661
 
628
662
  export type SnapshotState = "pending" | "available" | "error";
629
663
 
630
- export interface LayoutData {
631
- workspaceId: string;
632
- lastUpdatedTime: string;
633
- layoutData: string;
634
- }
635
-
636
664
  export interface Workspace {
637
665
  id: string;
638
666
  creationTime: string;
@@ -694,7 +722,7 @@ export interface Workspace {
694
722
 
695
723
  export type WorkspaceSoftDeletion = "user" | "gc";
696
724
 
697
- export type WorkspaceType = "regular" | "prebuild" | "probe"; // TODO(gpl) Removed prove here
725
+ export type WorkspaceType = "regular" | "prebuild";
698
726
 
699
727
  export namespace Workspace {
700
728
  export function getFullRepositoryName(ws: Workspace): string | undefined {
@@ -767,6 +795,8 @@ export interface JetBrainsConfig {
767
795
  goland?: JetBrainsProductConfig;
768
796
  pycharm?: JetBrainsProductConfig;
769
797
  phpstorm?: JetBrainsProductConfig;
798
+ rubymine?: JetBrainsProductConfig;
799
+ webstorm?: JetBrainsProductConfig;
770
800
  }
771
801
  export interface JetBrainsProductConfig {
772
802
  prebuilds?: JetBrainsPrebuilds;
@@ -781,6 +811,12 @@ export interface RepositoryCloneInformation {
781
811
  checkoutLocation?: string;
782
812
  }
783
813
 
814
+ export interface CoreDumpConfig {
815
+ enabled?: boolean;
816
+ softLimit?: number;
817
+ hardLimit?: number;
818
+ }
819
+
784
820
  export interface WorkspaceConfig {
785
821
  mainConfiguration?: string;
786
822
  additionalRepositories?: RepositoryCloneInformation[];
@@ -793,6 +829,7 @@ export interface WorkspaceConfig {
793
829
  github?: GithubAppConfig;
794
830
  vscode?: VSCodeConfig;
795
831
  jetbrains?: JetBrainsConfig;
832
+ coreDump?: CoreDumpConfig;
796
833
 
797
834
  /** deprecated. Enabled by default **/
798
835
  experimentalNetwork?: boolean;
@@ -801,13 +838,12 @@ export interface WorkspaceConfig {
801
838
  * Where the config object originates from.
802
839
  *
803
840
  * repo - from the repository
804
- * project-db - from the "Project" stored in the database
805
841
  * definitly-gp - from github.com/gitpod-io/definitely-gp
806
842
  * derived - computed based on analyzing the repository
807
843
  * additional-content - config comes from additional content, usually provided through the project's configuration
808
844
  * default - our static catch-all default config
809
845
  */
810
- _origin?: "repo" | "project-db" | "definitely-gp" | "derived" | "additional-content" | "default";
846
+ _origin?: "repo" | "definitely-gp" | "derived" | "additional-content" | "default";
811
847
 
812
848
  /**
813
849
  * Set of automatically infered feature flags. That's not something the user can set, but
@@ -1125,17 +1161,6 @@ export namespace WithEnvvarsContext {
1125
1161
  }
1126
1162
  }
1127
1163
 
1128
- export interface WorkspaceProbeContext extends WorkspaceContext {
1129
- responseURL: string;
1130
- responseToken: string;
1131
- }
1132
-
1133
- export namespace WorkspaceProbeContext {
1134
- export function is(context: any): context is WorkspaceProbeContext {
1135
- return context && "responseURL" in context && "responseToken" in context;
1136
- }
1137
- }
1138
-
1139
1164
  export type RefType = "branch" | "tag" | "revision";
1140
1165
  export namespace RefType {
1141
1166
  export const getRefType = (commit: Commit): RefType => {
@@ -1175,6 +1200,16 @@ export namespace AdditionalContentContext {
1175
1200
  }
1176
1201
  }
1177
1202
 
1203
+ export interface OpenPrebuildContext extends WorkspaceContext {
1204
+ openPrebuildID: string;
1205
+ }
1206
+
1207
+ export namespace OpenPrebuildContext {
1208
+ export function is(ctx: any): ctx is OpenPrebuildContext {
1209
+ return "openPrebuildID" in ctx;
1210
+ }
1211
+ }
1212
+
1178
1213
  export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
1179
1214
  /** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
1180
1215
  cloneUrl?: string;
@@ -1481,3 +1516,18 @@ export interface Terms {
1481
1516
  readonly content: string;
1482
1517
  readonly formElements?: object;
1483
1518
  }
1519
+
1520
+ export interface StripeConfig {
1521
+ individualUsagePriceIds: { [currency: string]: string };
1522
+ teamUsagePriceIds: { [currency: string]: string };
1523
+ }
1524
+
1525
+ export type BillingStrategy = "other" | "stripe";
1526
+ export interface CostCenter {
1527
+ readonly id: AttributionId;
1528
+ /**
1529
+ * Unit: credits
1530
+ */
1531
+ spendingLimit: number;
1532
+ billingStrategy: BillingStrategy;
1533
+ }
@@ -55,6 +55,9 @@ export namespace TeamSubscription2 {
55
55
  export const isActive = (ts2: TeamSubscription2, date: string): boolean => {
56
56
  return ts2.startDate <= date && (ts2.endDate === undefined || date < ts2.endDate);
57
57
  };
58
+ export function isCancelled(s: TeamSubscription2, date: string): boolean {
59
+ return (!!s.cancellationDate && s.cancellationDate < date) || (!!s.endDate && s.endDate < date); // This edge case is meant to handle bad data: If for whatever reason cancellationDate has not been set: treat endDate as such
60
+ }
58
61
  }
59
62
 
60
63
  /**
@@ -27,7 +27,6 @@ export interface Project {
27
27
  teamId?: string;
28
28
  userId?: string;
29
29
  appInstallationId: string;
30
- config?: ProjectConfig;
31
30
  settings?: ProjectSettings;
32
31
  creationTime: string;
33
32
  /** This is a flag that triggers the HARD DELETION of this entity */