@gitpod/gitpod-protocol 0.1.5-mp-workspace-region-type.7 → 0.1.5-mp-remove-slow-server-proxy.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.
@@ -117,6 +117,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
117
117
  getWorkspace(id: string): Promise<WorkspaceInfo>;
118
118
  isWorkspaceOwner(workspaceId: string): Promise<boolean>;
119
119
  getOwnerToken(workspaceId: string): Promise<string>;
120
+ getIDECredentials(workspaceId: string): Promise<string>;
120
121
 
121
122
  /**
122
123
  * Creates and starts a workspace for the given context URL.
@@ -359,17 +360,26 @@ export interface ClientHeaderFields {
359
360
  clientRegion?: string;
360
361
  }
361
362
 
363
+ const WORKSPACE_MAXIMUM_TIMEOUT_HOURS = 24;
364
+
362
365
  export type WorkspaceTimeoutDuration = string;
363
366
  export namespace WorkspaceTimeoutDuration {
364
367
  export function validate(duration: string): WorkspaceTimeoutDuration {
368
+ duration = duration.toLowerCase();
365
369
  const unit = duration.slice(-1);
366
- if (!["m", "h", "d"].includes(unit)) {
370
+ if (!["m", "h"].includes(unit)) {
367
371
  throw new Error(`Invalid timeout unit: ${unit}`);
368
372
  }
369
- const value = parseInt(duration.slice(0, -1));
373
+ const value = parseInt(duration.slice(0, -1), 10);
370
374
  if (isNaN(value) || value <= 0) {
371
375
  throw new Error(`Invalid timeout value: ${duration}`);
372
376
  }
377
+ if (
378
+ (unit === "h" && value > WORKSPACE_MAXIMUM_TIMEOUT_HOURS) ||
379
+ (unit === "m" && value > WORKSPACE_MAXIMUM_TIMEOUT_HOURS * 60)
380
+ ) {
381
+ throw new Error("Workspace inactivity timeout cannot exceed 24h");
382
+ }
373
383
  return duration;
374
384
  }
375
385
  }
@@ -403,11 +413,13 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
403
413
 
404
414
  export interface SetWorkspaceTimeoutResult {
405
415
  resetTimeoutOnWorkspaces: string[];
416
+ humanReadableDuration: string;
406
417
  }
407
418
 
408
419
  export interface GetWorkspaceTimeoutResult {
409
420
  duration: WorkspaceTimeoutDuration;
410
421
  canChange: boolean;
422
+ humanReadableDuration: string;
411
423
  }
412
424
 
413
425
  export interface StartWorkspaceResult {
@@ -428,6 +440,7 @@ export namespace GitpodServer {
428
440
  }
429
441
  export interface CreateWorkspaceOptions extends StartWorkspaceOptions {
430
442
  contextUrl: string;
443
+ organizationId?: string;
431
444
 
432
445
  // whether running workspaces on the same context should be ignored. If false (default) users will be asked.
433
446
  ignoreRunningWorkspaceOnSameCommit?: boolean;
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;
@@ -178,6 +179,17 @@ export namespace User {
178
179
  return user;
179
180
  }
180
181
 
182
+ export function getDefaultAttributionId(user: User): AttributionId {
183
+ if (user.usageAttributionId) {
184
+ const result = AttributionId.parse(user.usageAttributionId);
185
+ if (!result) {
186
+ throw new Error("Invalid attribution ID: " + user.usageAttributionId);
187
+ }
188
+ return result;
189
+ }
190
+ return AttributionId.create(user);
191
+ }
192
+
181
193
  // The actual Profile of a User
182
194
  export interface Profile {
183
195
  name: string;
@@ -830,6 +842,7 @@ export interface WorkspaceConfig {
830
842
  vscode?: VSCodeConfig;
831
843
  jetbrains?: JetBrainsConfig;
832
844
  coreDump?: CoreDumpConfig;
845
+ ideCredentials?: string;
833
846
 
834
847
  /** deprecated. Enabled by default **/
835
848
  experimentalNetwork?: boolean;
@@ -11,5 +11,9 @@ interface Window {
11
11
  loggedUserID?: string;
12
12
 
13
13
  openDesktopIDE(url: string): void;
14
+
15
+ encrypt(content: string): string;
16
+ decrypt(content: string): string;
17
+ isEncryptedData(content: string): boolean;
14
18
  };
15
19
  }
@@ -100,6 +100,10 @@ export class GitpodHostUrl {
100
100
  return this.with((url) => ({ pathname: "/" }));
101
101
  }
102
102
 
103
+ asBilling(): GitpodHostUrl {
104
+ return this.with((url) => ({ pathname: "/user/billing" }));
105
+ }
106
+
103
107
  asLogin(): GitpodHostUrl {
104
108
  return this.with((url) => ({ pathname: "/login" }));
105
109
  }
@@ -108,6 +112,10 @@ export class GitpodHostUrl {
108
112
  return this.with((url) => ({ pathname: "/integrations" }));
109
113
  }
110
114
 
115
+ asSettings(): GitpodHostUrl {
116
+ return this.with((url) => ({ pathname: "/user/account" }));
117
+ }
118
+
111
119
  asPreferences(): GitpodHostUrl {
112
120
  return this.with((url) => ({ pathname: "/user/preferences" }));
113
121
  }
package/src/wsready.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2
+ * Copyright (c) 2023 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
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-11-25 13:39:08.995865257 +0000 UTC m=+0.015035221
7
+ // generated using github.com/32leaves/bel on 2023-02-14 09:41:16.808994006 +0000 UTC m=+0.008933200
8
8
  // DO NOT MODIFY
9
9
 
10
10
  export enum WorkspaceInitSource {