@gitpod/gitpod-protocol 0.1.5-se-flexible-termination-period.13 → 0.1.5-se-inc-ws.1

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 (41) hide show
  1. package/data/gitpod-schema.json +0 -4
  2. package/lib/attribution.d.ts +1 -0
  3. package/lib/attribution.d.ts.map +1 -1
  4. package/lib/attribution.js +4 -0
  5. package/lib/attribution.js.map +1 -1
  6. package/lib/billing-mode.d.ts +2 -0
  7. package/lib/billing-mode.d.ts.map +1 -1
  8. package/lib/experiments/configcat.d.ts +0 -2
  9. package/lib/experiments/configcat.d.ts.map +1 -1
  10. package/lib/experiments/configcat.js +1 -7
  11. package/lib/experiments/configcat.js.map +1 -1
  12. package/lib/experiments/types.d.ts +0 -2
  13. package/lib/experiments/types.d.ts.map +1 -1
  14. package/lib/experiments/types.js.map +1 -1
  15. package/lib/gitpod-service.d.ts +6 -3
  16. package/lib/gitpod-service.d.ts.map +1 -1
  17. package/lib/gitpod-service.js.map +1 -1
  18. package/lib/protocol.d.ts +14 -9
  19. package/lib/protocol.d.ts.map +1 -1
  20. package/lib/protocol.js +9 -12
  21. package/lib/protocol.js.map +1 -1
  22. package/lib/teams-projects-protocol.d.ts +1 -0
  23. package/lib/teams-projects-protocol.d.ts.map +1 -1
  24. package/lib/teams-projects-protocol.js.map +1 -1
  25. package/lib/workspace-cluster.d.ts +6 -5
  26. package/lib/workspace-cluster.d.ts.map +1 -1
  27. package/lib/workspace-cluster.js.map +1 -1
  28. package/lib/wsready.d.ts.map +1 -1
  29. package/lib/wsready.js +1 -1
  30. package/package.json +1 -1
  31. package/pkg-yarn.lock +1 -1
  32. package/provenance-bundle.jsonl +1 -1
  33. package/src/attribution.ts +4 -0
  34. package/src/billing-mode.ts +4 -0
  35. package/src/experiments/configcat.ts +0 -6
  36. package/src/experiments/types.ts +0 -4
  37. package/src/gitpod-service.ts +8 -3
  38. package/src/protocol.ts +22 -14
  39. package/src/teams-projects-protocol.ts +1 -0
  40. package/src/workspace-cluster.ts +11 -6
  41. package/src/wsready.ts +2 -2
@@ -56,4 +56,8 @@ export namespace AttributionId {
56
56
  return `team${SEPARATOR}${id.teamId}`;
57
57
  }
58
58
  }
59
+
60
+ export function equals(a: AttributionId, b: AttributionId): boolean {
61
+ return render(a) === render(b);
62
+ }
59
63
  }
@@ -59,6 +59,10 @@ interface None {
59
59
  /** Sessions is handled with old subscription logic based on Chargebee */
60
60
  interface Chargebee {
61
61
  mode: "chargebee";
62
+
63
+ /** True iff this is a team, and is based on a paid plan. Currently only set for teams! */
64
+ paid?: boolean;
65
+
62
66
  canUpgradeToUBB?: boolean;
63
67
  }
64
68
 
@@ -12,9 +12,7 @@ import { User } from "../protocol";
12
12
  export const USER_ID_ATTRIBUTE = "user_id";
13
13
  export const PROJECT_ID_ATTRIBUTE = "project_id";
14
14
  export const TEAM_ID_ATTRIBUTE = "team_id";
15
- export const TEAM_IDS_ATTRIBUTE = "team_ids";
16
15
  export const TEAM_NAME_ATTRIBUTE = "team_name";
17
- export const TEAM_NAMES_ATTRIBUTE = "team_names";
18
16
  export const BILLING_TIER_ATTRIBUTE = "billing_tier";
19
17
 
20
18
  export class ConfigCatClient implements Client {
@@ -50,10 +48,6 @@ export function attributesToUser(attributes: Attributes): ConfigCatUser {
50
48
  if (attributes.teamName) {
51
49
  custom[TEAM_NAME_ATTRIBUTE] = attributes.teamName;
52
50
  }
53
- if (attributes.teams) {
54
- custom[TEAM_NAMES_ATTRIBUTE] = attributes.teams.map((t) => t.name).join(",");
55
- custom[TEAM_IDS_ATTRIBUTE] = attributes.teams.map((t) => t.id).join(",");
56
- }
57
51
  if (attributes.billingTier) {
58
52
  custom[BILLING_TIER_ATTRIBUTE] = attributes.billingTier;
59
53
  }
@@ -5,7 +5,6 @@
5
5
  */
6
6
 
7
7
  import { BillingTier, User } from "../protocol";
8
- import { Team } from "../teams-projects-protocol";
9
8
 
10
9
  export const Client = Symbol("Client");
11
10
 
@@ -25,9 +24,6 @@ export interface Attributes {
25
24
  teamId?: string;
26
25
  // Currently selected Gitpod Team Name (mapped to "custom.team_name")
27
26
  teamName?: string;
28
-
29
- // All the Gitpod Teams that the user is a member (or owner) of (mapped to "custom.team_names" and "custom.team_ids")
30
- teams?: Team[];
31
27
  }
32
28
 
33
29
  export interface Client {
@@ -12,7 +12,6 @@ import {
12
12
  WhitelistedRepository,
13
13
  WorkspaceImageBuild,
14
14
  AuthProviderInfo,
15
- CreateWorkspaceMode,
16
15
  Token,
17
16
  UserEnvVarValue,
18
17
  Terms,
@@ -278,7 +277,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
278
277
  getStripeSetupIntentClientSecret(): Promise<string>;
279
278
  findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
280
279
  createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
281
- subscribeToStripe(attributionId: string, setupIntentId: string): Promise<void>;
280
+ subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
282
281
  getStripePortalUrl(attributionId: string): Promise<string>;
283
282
  getUsageLimit(attributionId: string): Promise<number | undefined>;
284
283
  setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
@@ -286,6 +285,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
286
285
  listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
287
286
 
288
287
  setUsageAttribution(usageAttribution: string): Promise<void>;
288
+ listAvailableUsageAttributionIds(): Promise<string[]>;
289
289
 
290
290
  getBillingModeForUser(): Promise<BillingMode>;
291
291
  getBillingModeForTeam(teamId: string): Promise<BillingMode>;
@@ -420,7 +420,12 @@ export namespace GitpodServer {
420
420
  }
421
421
  export interface CreateWorkspaceOptions {
422
422
  contextUrl: string;
423
- mode?: CreateWorkspaceMode;
423
+ // whether running prebuilds should be ignored.
424
+ ignoreRunningPrebuild?: boolean;
425
+ // whether running workspaces on the same context should be ignored. If false (default) users will be asked.
426
+ ignoreRunningWorkspaceOnSameCommit?: boolean;
427
+ // whether older prebuilds can be used and incrementally updated.
428
+ allowUsingPreviousPrebuilds?: boolean;
424
429
  forceDefaultConfig?: boolean;
425
430
  }
426
431
  export interface StartWorkspaceOptions {
package/src/protocol.ts CHANGED
@@ -211,6 +211,12 @@ export interface AdditionalUserData {
211
211
  dotfileRepo?: string;
212
212
  // preferred workspace classes
213
213
  workspaceClasses?: WorkspaceClasses;
214
+ // whether running prebuilds should be ignored on start
215
+ ignoreRunnningPrebuilds?: boolean;
216
+ // whether new workspaces can start on older prebuilds and incrementally update
217
+ allowUsingPreviousPrebuilds?: boolean;
218
+ // whether running workspaces for the same git context should be ignored on start so that users are not prompted
219
+ ignoreRunningWorkspaceOnSameCommit?: boolean;
214
220
  // additional user profile data
215
221
  profile?: ProfileDetails;
216
222
  }
@@ -298,6 +304,7 @@ export const WorkspaceFeatureFlags = {
298
304
  protected_secrets: undefined,
299
305
  workspace_class_limiting: undefined,
300
306
  workspace_connection_limiting: undefined,
307
+ workspace_psi: undefined,
301
308
  };
302
309
  export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
303
310
  export namespace NamedWorkspaceFeatureFlag {
@@ -830,7 +837,6 @@ export interface WorkspaceConfig {
830
837
  vscode?: VSCodeConfig;
831
838
  jetbrains?: JetBrainsConfig;
832
839
  coreDump?: CoreDumpConfig;
833
- terminationGracePeriodSeconds?: number;
834
840
 
835
841
  /** deprecated. Enabled by default **/
836
842
  experimentalNetwork?: boolean;
@@ -1112,13 +1118,16 @@ export namespace SnapshotContext {
1112
1118
  }
1113
1119
  }
1114
1120
 
1115
- export interface StartPrebuildContext extends WorkspaceContext {
1116
- actual: WorkspaceContext;
1121
+ export interface WithCommitHistory {
1117
1122
  commitHistory?: string[];
1118
1123
  additionalRepositoryCommitHistories?: {
1119
1124
  cloneUrl: string;
1120
1125
  commitHistory: string[];
1121
1126
  }[];
1127
+ }
1128
+
1129
+ export interface StartPrebuildContext extends WorkspaceContext, WithCommitHistory {
1130
+ actual: WorkspaceContext;
1122
1131
  project?: Project;
1123
1132
  branch?: string;
1124
1133
  }
@@ -1201,6 +1210,16 @@ export namespace AdditionalContentContext {
1201
1210
  }
1202
1211
  }
1203
1212
 
1213
+ export interface OpenPrebuildContext extends WorkspaceContext {
1214
+ openPrebuildID: string;
1215
+ }
1216
+
1217
+ export namespace OpenPrebuildContext {
1218
+ export function is(ctx: any): ctx is OpenPrebuildContext {
1219
+ return "openPrebuildID" in ctx;
1220
+ }
1221
+ }
1222
+
1204
1223
  export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
1205
1224
  /** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
1206
1225
  cloneUrl?: string;
@@ -1364,17 +1383,6 @@ export interface WorkspaceCreationResult {
1364
1383
  }
1365
1384
  export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
1366
1385
 
1367
- export enum CreateWorkspaceMode {
1368
- // Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
1369
- Default = "default",
1370
- // ForceNew creates a new workspace irrespective of any running prebuilds. This mode is guaranteed to actually create a workspace - but may degrade user experience as currently runnig prebuilds are ignored.
1371
- ForceNew = "force-new",
1372
- // UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
1373
- UsePrebuild = "use-prebuild",
1374
- // SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
1375
- SelectIfRunning = "select-if-running",
1376
- }
1377
-
1378
1386
  export namespace WorkspaceCreationResult {
1379
1387
  export function is(data: any): data is WorkspaceCreationResult {
1380
1388
  return (
@@ -45,6 +45,7 @@ export namespace Project {
45
45
 
46
46
  export interface Overview {
47
47
  branches: BranchDetails[];
48
+ isConsideredInactive?: boolean;
48
49
  }
49
50
 
50
51
  export namespace Overview {
@@ -15,6 +15,10 @@ export interface WorkspaceCluster {
15
15
  // Must be identical to the installationShortname of the cluster it represents!
16
16
  name: string;
17
17
 
18
+ // The name of the application cluster to which this cluster should be registered.
19
+ // The name can be at most 60 characters.
20
+ applicationCluster: string;
21
+
18
22
  // URL of the cluster's ws-manager API
19
23
  url: string;
20
24
 
@@ -86,20 +90,21 @@ export interface WorkspaceClusterDB {
86
90
  * Deletes the cluster identified by this name, if any.
87
91
  * @param name
88
92
  */
89
- deleteByName(name: string): Promise<void>;
93
+ deleteByName(name: string, applicationCluster: string): Promise<void>;
90
94
 
91
95
  /**
92
96
  * Finds a WorkspaceCluster with the given name. If there is none, `undefined` is returned.
93
97
  * @param name
94
98
  */
95
- findByName(name: string): Promise<WorkspaceCluster | undefined>;
99
+ findByName(name: string, applicationCluster: string): Promise<WorkspaceCluster | undefined>;
96
100
 
97
101
  /**
98
102
  * Lists all WorkspaceClusterWoTls for which the given predicate is true (does not return TLS for size/speed concerns)
99
103
  * @param predicate
100
104
  */
101
- findFiltered(predicate: DeepPartial<WorkspaceClusterFilter>): Promise<WorkspaceClusterWoTLS[]>;
102
- }
103
- export interface WorkspaceClusterFilter extends Pick<WorkspaceCluster, "state" | "govern" | "url"> {
104
- minScore: number;
105
+ findFiltered(predicate: WorkspaceClusterFilter): Promise<WorkspaceClusterWoTLS[]>;
105
106
  }
107
+
108
+ export type WorkspaceClusterFilter = Pick<WorkspaceCluster, "applicationCluster"> &
109
+ DeepPartial<Pick<WorkspaceCluster, "name" | "state" | "govern" | "url">> &
110
+ Partial<{ minScore: number }>;
package/src/wsready.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- // generated using github.com/32leaves/bel on 2022-09-26 00:48:43.566671023 +0000 UTC m=+0.008587770
7
+ // generated using github.com/32leaves/bel on 2022-10-10 21:41:56.018177383 +0000 UTC m=+0.010324839
8
8
  // DO NOT MODIFY
9
9
 
10
10
  export enum WorkspaceInitSource {
@@ -13,5 +13,5 @@ export enum WorkspaceInitSource {
13
13
  WorkspaceInitFromOther = "from-other",
14
14
  }
15
15
  export interface WorkspaceReadyMessage {
16
- source: WorkspaceInitSource
16
+ source: WorkspaceInitSource;
17
17
  }