@gitpod/gitpod-protocol 0.1.5-se-multi-repo.1 → 0.1.5-se-multi-repo.13

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 (61) hide show
  1. package/lib/admin-protocol.d.ts +10 -0
  2. package/lib/admin-protocol.d.ts.map +1 -1
  3. package/lib/admin-protocol.js.map +1 -1
  4. package/lib/context-url.d.ts +1 -0
  5. package/lib/context-url.d.ts.map +1 -1
  6. package/lib/context-url.js +3 -1
  7. package/lib/context-url.js.map +1 -1
  8. package/lib/gitpod-service.d.ts +9 -0
  9. package/lib/gitpod-service.d.ts.map +1 -1
  10. package/lib/gitpod-service.js.map +1 -1
  11. package/lib/ide-protocol.d.ts +20 -0
  12. package/lib/ide-protocol.d.ts.map +1 -1
  13. package/lib/index.d.ts +1 -0
  14. package/lib/index.d.ts.map +1 -1
  15. package/lib/index.js +1 -0
  16. package/lib/index.js.map +1 -1
  17. package/lib/installation-admin-protocol.d.ts +21 -0
  18. package/lib/installation-admin-protocol.d.ts.map +1 -0
  19. package/lib/installation-admin-protocol.js +30 -0
  20. package/lib/installation-admin-protocol.js.map +1 -0
  21. package/lib/messaging/error.d.ts +1 -0
  22. package/lib/messaging/error.d.ts.map +1 -1
  23. package/lib/messaging/error.js +2 -0
  24. package/lib/messaging/error.js.map +1 -1
  25. package/lib/permission.d.ts +4 -1
  26. package/lib/permission.d.ts.map +1 -1
  27. package/lib/permission.js +4 -0
  28. package/lib/permission.js.map +1 -1
  29. package/lib/protocol.d.ts +8 -0
  30. package/lib/protocol.d.ts.map +1 -1
  31. package/lib/protocol.js +11 -3
  32. package/lib/protocol.js.map +1 -1
  33. package/lib/teams-projects-protocol.d.ts +3 -0
  34. package/lib/teams-projects-protocol.d.ts.map +1 -1
  35. package/lib/teams-projects-protocol.js +7 -0
  36. package/lib/teams-projects-protocol.js.map +1 -1
  37. package/lib/workspace-cluster.d.ts +3 -6
  38. package/lib/workspace-cluster.d.ts.map +1 -1
  39. package/lib/workspace-cluster.js.map +1 -1
  40. package/lib/workspace-instance.d.ts +19 -0
  41. package/lib/workspace-instance.d.ts.map +1 -1
  42. package/package.json +1 -1
  43. package/pkg-yarn.lock +1 -1
  44. package/provenance-bundle.jsonl +1 -1
  45. package/src/admin-protocol.ts +17 -4
  46. package/src/context-url.ts +3 -1
  47. package/src/gitpod-service.ts +11 -0
  48. package/src/ide-protocol.ts +22 -0
  49. package/src/index.ts +1 -0
  50. package/src/installation-admin-protocol.ts +35 -0
  51. package/src/messaging/error.ts +3 -0
  52. package/src/permission.ts +5 -0
  53. package/src/protocol.ts +15 -2
  54. package/src/teams-projects-protocol.ts +7 -1
  55. package/src/workspace-cluster.ts +2 -7
  56. package/src/workspace-instance.ts +20 -0
  57. package/lib/util/safe-promise.d.ts +0 -11
  58. package/lib/util/safe-promise.d.ts.map +0 -1
  59. package/lib/util/safe-promise.js +0 -31
  60. package/lib/util/safe-promise.js.map +0 -1
  61. package/src/util/safe-promise.ts +0 -26
@@ -0,0 +1,35 @@
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 namespace InstallationAdmin {
27
+ export function createDefault(): InstallationAdmin {
28
+ return {
29
+ id: uuidv4(),
30
+ settings: {
31
+ ...InstallationAdminSettingsPrototype,
32
+ }
33
+ };
34
+ }
35
+ }
@@ -78,4 +78,7 @@ export namespace ErrorCodes {
78
78
 
79
79
  // 630 Snapshot Error
80
80
  export const SNAPSHOT_ERROR = 630;
81
+
82
+ // 640 Headless logs are not available (yet)
83
+ export const HEADLESS_LOG_NOT_YET_AVAILABLE = 640;
81
84
  }
package/src/permission.ts CHANGED
@@ -13,6 +13,7 @@ export const Permissions = {
13
13
  "registry-access": undefined,
14
14
  "admin-users": undefined,
15
15
  "admin-workspaces": undefined,
16
+ "admin-projects": undefined,
16
17
  "admin-api": undefined,
17
18
  "ide-settings": undefined,
18
19
  "new-workspace-cluster": undefined,
@@ -50,6 +51,9 @@ export namespace Permission {
50
51
  /** The permission for accessing all workspace data */
51
52
  export const ADMIN_WORKSPACES: PermissionName = "admin-workspaces";
52
53
 
54
+ /** The permission for accessing all projects data */
55
+ export const ADMIN_PROJECTS: PermissionName = "admin-projects";
56
+
53
57
  /** The permission to access the admin API */
54
58
  export const ADMIN_API: PermissionName = "admin-api";
55
59
 
@@ -94,6 +98,7 @@ export namespace Role {
94
98
  permissions: [
95
99
  Permission.ADMIN_USERS,
96
100
  Permission.ADMIN_WORKSPACES,
101
+ Permission.ADMIN_PROJECTS,
97
102
  Permission.ADMIN_API,
98
103
  Permission.ENFORCEMENT,
99
104
  ]
package/src/protocol.ts CHANGED
@@ -258,8 +258,8 @@ export namespace UserEnvVar {
258
258
  // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
259
259
  export function splitRepositoryPattern(repositoryPattern: string): string[] {
260
260
  const patterns = repositoryPattern.split('/');
261
- const repoPattern = patterns.pop() || "";
262
- const ownerPattern = patterns.join('/');
261
+ const repoPattern = patterns.slice(1).join('/')
262
+ const ownerPattern = patterns[0];
263
263
  return [ownerPattern, repoPattern];
264
264
  }
265
265
  }
@@ -692,6 +692,7 @@ export interface PrebuiltWorkspaceUpdatable {
692
692
  repo: string;
693
693
  isResolved: boolean;
694
694
  installationId: string;
695
+ commitSHA?: string;
695
696
  issue?: string;
696
697
  contextUrl?: string;
697
698
  }
@@ -899,6 +900,18 @@ export namespace PrebuiltWorkspaceContext {
899
900
  }
900
901
  }
901
902
 
903
+ export interface WithReferrerContext extends WorkspaceContext {
904
+ referrer: string
905
+ referrerIde?: string
906
+ }
907
+
908
+ export namespace WithReferrerContext {
909
+ export function is(context: any): context is WithReferrerContext {
910
+ return context
911
+ && 'referrer' in context;
912
+ }
913
+ }
914
+
902
915
  export interface WithEnvvarsContext extends WorkspaceContext {
903
916
  envvars: EnvVarWithValue[];
904
917
  }
@@ -42,7 +42,13 @@ export namespace Project {
42
42
  }
43
43
 
44
44
  export interface Overview {
45
- branches: BranchDetails[]
45
+ branches: BranchDetails[];
46
+ }
47
+
48
+ export namespace Overview {
49
+ export function is(data?: any): data is Project.Overview {
50
+ return Array.isArray(data?.branches);
51
+ }
46
52
  }
47
53
 
48
54
  export interface BranchDetails {
@@ -35,9 +35,6 @@ export interface WorkspaceCluster {
35
35
 
36
36
  // An optional set of constraints that limit who can start workspaces on the cluster
37
37
  admissionConstraints?: AdmissionConstraint[];
38
-
39
- // An optional set of admission preferences that guide cluster selection
40
- admissionPreferences?: AdmissionPreference[];
41
38
  }
42
39
 
43
40
  export type WorkspaceClusterState = "available" | "cordoned" | "draining";
@@ -55,13 +52,11 @@ export namespace TLSConfig {
55
52
  export type WorkspaceClusterWoTLS = Omit<WorkspaceCluster, "tls">;
56
53
  export type WorkspaceManagerConnectionInfo = Pick<WorkspaceCluster, "name" | "url" | "tls">;
57
54
 
58
- export type AdmissionConstraint = AdmissionConstraintFeaturePreview | AdmissionConstraintHasRole | AdmissionConstraintHasUserLevel;
55
+ export type AdmissionConstraint = AdmissionConstraintFeaturePreview | AdmissionConstraintHasRole | AdmissionConstraintHasUserLevel | AdmissionConstraintHasMoreResources;
59
56
  export type AdmissionConstraintFeaturePreview = { type: "has-feature-preview" };
60
57
  export type AdmissionConstraintHasRole = { type: "has-permission", permission: PermissionName };
61
58
  export type AdmissionConstraintHasUserLevel = { type: "has-user-level", level: string };
62
-
63
- export type AdmissionPreference = AdmissionPreferenceUserLevel;
64
- export type AdmissionPreferenceUserLevel = { type: 'user-level', level: string };
59
+ export type AdmissionConstraintHasMoreResources = { type: "has-more-resources" };
65
60
 
66
61
 
67
62
  export const WorkspaceClusterDB = Symbol("WorkspaceClusterDB");
@@ -51,6 +51,11 @@ export interface WorkspaceInstance {
51
51
 
52
52
  // instance is hard-deleted on the database and about to be collected by db-sync
53
53
  readonly deleted?: boolean;
54
+
55
+ /**
56
+ * Contains information about the image build, if there was any
57
+ */
58
+ imageBuildInfo?: ImageBuildInfo;
54
59
  }
55
60
 
56
61
  // WorkspaceInstanceStatus describes the current state of a workspace instance
@@ -213,3 +218,18 @@ export interface WorkspaceInstanceConfiguration {
213
218
  // supervisorImage is the ref of the supervisor image this instance uses.
214
219
  supervisorImage?: string;
215
220
  }
221
+
222
+ /**
223
+ * Holds information about the image build (if there was one) for this WorkspaceInstance
224
+ */
225
+ export interface ImageBuildInfo {
226
+ log?: ImageBuildLogInfo,
227
+ }
228
+
229
+ /**
230
+ * Holds information about how to access logs for this an image build
231
+ */
232
+ export interface ImageBuildLogInfo {
233
+ url: string,
234
+ headers: { [key: string]: string },
235
+ }
@@ -1,11 +0,0 @@
1
- /**
2
- * Copyright (c) 2020 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
- import { LogContext } from './logging';
7
- export declare class SafePromise {
8
- static catchAndLog<T>(p: Promise<T>, logCtx?: LogContext): Promise<T>;
9
- static catch<T>(p: Promise<T>, handler: (err: any) => void): Promise<T>;
10
- }
11
- //# sourceMappingURL=safe-promise.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"safe-promise.d.ts","sourceRoot":"","sources":["../../src/util/safe-promise.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAO,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,WAAW;WACN,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,UAAU;WASjD,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;CAMjF"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
- * Licensed under the GNU Affero General Public License (AGPL).
5
- * See License-AGPL.txt in the project root for license information.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.SafePromise = void 0;
9
- const logging_1 = require("./logging");
10
- class SafePromise {
11
- static catchAndLog(p, logCtx) {
12
- return SafePromise.catch(p, (err) => {
13
- if (logCtx) {
14
- logging_1.log.error(logCtx, err);
15
- }
16
- else {
17
- logging_1.log.error(err);
18
- }
19
- });
20
- }
21
- ;
22
- static catch(p, handler) {
23
- return p.catch((err) => {
24
- handler(err);
25
- return {}; // Nobody will ever see this value as the Promise already failed. It's just there to please the compiler
26
- });
27
- }
28
- ;
29
- }
30
- exports.SafePromise = SafePromise;
31
- //# sourceMappingURL=safe-promise.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"safe-promise.js","sourceRoot":"","sources":["../../src/util/safe-promise.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,uCAA4C;AAE5C,MAAa,WAAW;IACb,MAAM,CAAC,WAAW,CAAI,CAAa,EAAE,MAAmB;QAC3D,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;YAChC,IAAI,MAAM,EAAE;gBACR,aAAG,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;aAC1B;iBAAM;gBACH,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aAClB;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAAA,CAAC;IACK,MAAM,CAAC,KAAK,CAAI,CAAa,EAAE,OAA2B;QAC7D,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,OAAO,CAAC,GAAG,CAAC,CAAC;YACb,OAAO,EAAO,CAAC,CAAC,wGAAwG;QAC5H,CAAC,CAAC,CAAC;IACP,CAAC;IAAA,CAAC;CACL;AAhBD,kCAgBC"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Copyright (c) 2020 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
- import { log, LogContext } from './logging';
9
-
10
- export class SafePromise {
11
- public static catchAndLog<T>(p: Promise<T>, logCtx?: LogContext) {
12
- return SafePromise.catch(p, (err) => {
13
- if (logCtx) {
14
- log.error(logCtx, err);
15
- } else {
16
- log.error(err);
17
- }
18
- });
19
- };
20
- public static catch<T>(p: Promise<T>, handler: (err: any) => void): Promise<T> {
21
- return p.catch((err) => {
22
- handler(err);
23
- return {} as T; // Nobody will ever see this value as the Promise already failed. It's just there to please the compiler
24
- });
25
- };
26
- }