@gitpod/gitpod-protocol 0.1.5-me-version.1 → 0.1.5-me-image.2
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.
- package/data/gitpod-schema.json +23 -4
- package/lib/accounting-protocol.d.ts +3 -6
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +10 -16
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +19 -4
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +2 -13
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +44 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/context-url.d.ts +31 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +102 -0
- package/lib/context-url.js.map +1 -0
- package/lib/{util/context-url.spec.d.ts → context-url.spec.d.ts} +4 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +94 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/email-protocol.d.ts +1 -2
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js +4 -4
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.js +4 -4
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.js +19 -20
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +29 -36
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.js +29 -43
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.js +25 -30
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +1 -2
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +20 -21
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.js +25 -41
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +116 -116
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +108 -10
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +152 -295
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +8 -11
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +4 -7
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-protocol.d.ts +105 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/ide-protocol.js +8 -0
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +27 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +30 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- package/lib/messaging/browser/connection.d.ts +3 -3
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +172 -35
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.js +35 -55
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +35 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +83 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/error.d.ts +3 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +6 -2
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +23 -59
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +2 -0
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +74 -159
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/oss-allowlist.d.ts +14 -0
- package/lib/oss-allowlist.d.ts.map +1 -0
- package/lib/oss-allowlist.js +8 -0
- package/lib/oss-allowlist.js.map +1 -0
- package/lib/permission.d.ts +7 -2
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +34 -15
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +1 -1
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +38 -57
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +72 -87
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +70 -115
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.d.ts +3 -3
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +15 -12
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +113 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +30 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/util/analytics.d.ts +1 -26
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +36 -28
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.js +55 -133
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js +17 -59
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +8 -8
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/deferred.js +10 -12
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.js +26 -39
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.js +58 -74
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -0
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +26 -46
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +1 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +30 -68
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +57 -78
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +44 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +1 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +93 -103
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +87 -135
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +15 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +18 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/jaeger-client-types.d.ts +68 -0
- package/lib/util/jaeger-client-types.d.ts.map +1 -0
- package/lib/util/{without.js → jaeger-client-types.js} +1 -1
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +49 -33
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +107 -110
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +2 -2
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +10 -0
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +31 -7
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +4 -0
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +123 -84
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.js +16 -55
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.js +144 -288
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeat.d.ts +15 -0
- package/lib/util/repeat.d.ts.map +1 -0
- package/lib/util/repeat.js +55 -0
- package/lib/util/repeat.js.map +1 -0
- package/lib/util/semaphore.js +15 -46
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.js +6 -6
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.js +16 -16
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.js +21 -24
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +51 -5
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +197 -62
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.d.ts +7 -0
- package/lib/util/tracing.spec.d.ts.map +1 -0
- package/lib/util/tracing.spec.js +121 -0
- package/lib/util/tracing.spec.js.map +1 -0
- package/lib/util/workspace-port-authentication.js +2 -2
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +15 -4
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +21 -4
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +24 -2
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.js +1 -1
- package/package.json +24 -13
- package/pkg-yarn.lock +14 -7
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +4 -10
- package/src/admin-protocol.ts +25 -7
- package/src/analytics.ts +52 -0
- package/src/context-url.spec.ts +53 -0
- package/src/context-url.ts +107 -0
- package/src/email-protocol.ts +2 -3
- package/src/env.ts +10 -10
- package/src/gitpod-service.ts +133 -22
- package/src/headless-workspace-log.ts +7 -11
- package/src/ide-frontend-service.ts +1 -1
- package/src/ide-protocol.ts +119 -0
- package/src/index.ts +5 -0
- package/src/installation-admin-protocol.ts +42 -0
- package/src/messaging/browser/connection.ts +176 -10
- package/src/messaging/client-call-metrics.ts +97 -0
- package/src/messaging/error.ts +8 -2
- package/src/messaging/handler.ts +12 -0
- package/src/messaging/node/connection.ts +21 -68
- package/src/messaging/proxy-factory.ts +13 -5
- package/src/oss-allowlist.ts +15 -0
- package/src/permission.ts +22 -4
- package/src/protocol.ts +105 -99
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +6 -4
- package/src/teams-projects-protocol.ts +147 -0
- package/src/util/analytics.ts +17 -30
- package/src/util/garbage-collected-cache.ts +7 -1
- package/src/util/generate-workspace-id.spec.ts +17 -0
- package/src/util/generate-workspace-id.ts +21 -2
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.ts +11 -11
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +102 -38
- package/src/util/parse-workspace-id.spec.ts +21 -1
- package/src/util/parse-workspace-id.ts +32 -6
- package/src/util/repeat.ts +45 -0
- package/src/util/tracing.spec.ts +83 -0
- package/src/util/tracing.ts +183 -17
- package/src/workspace-cluster.ts +19 -5
- package/src/workspace-instance.ts +38 -6
- package/src/wsready.ts +1 -1
- package/lib/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -46
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/util/context-url.d.ts +0 -13
- package/lib/util/context-url.d.ts.map +0 -1
- package/lib/util/context-url.js +0 -26
- package/lib/util/context-url.js.map +0 -1
- package/lib/util/context-url.spec.d.ts.map +0 -1
- package/lib/util/context-url.spec.js +0 -52
- package/lib/util/context-url.spec.js.map +0 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/lib/util/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -34
- package/lib/util/safe-promise.js.map +0 -1
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js.map +0 -1
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/util/context-url.spec.ts +0 -25
- package/src/util/context-url.ts +0 -23
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
import { Workspace } from ".";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The whole point of these methods is to overcome inconsistencies in our data model.
|
|
11
|
+
* Ideally we remove it at some point once we fixed our model, as it:
|
|
12
|
+
* - duplicates logic
|
|
13
|
+
* - but additional burden on clients (using this, copying this to other languages!)
|
|
14
|
+
*
|
|
15
|
+
* TODO(gpl) See if we can get this into `server` code to remove the burden from clients
|
|
16
|
+
*/
|
|
17
|
+
export namespace ContextURL {
|
|
18
|
+
export const INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
|
|
19
|
+
export const PREBUILD_PREFIX = "prebuild";
|
|
20
|
+
export const IMAGEBUILD_PREFIX = "imagebuild";
|
|
21
|
+
export const SNAPSHOT_PREFIX = "snapshot";
|
|
22
|
+
export const REFERRER_PREFIX = 'referrer:';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This function will (try to) return the HTTP(S) URL of the context the user originally created this workspace on.
|
|
26
|
+
* Especially it will not contain any modifiers or be of different scheme than HTTP(S).
|
|
27
|
+
*
|
|
28
|
+
* Use this function if you need to provided a _working_ URL to the original context.
|
|
29
|
+
* @param ws
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
export function getNormalizedURL(ws: Pick<Workspace, "context" | "contextURL"> | undefined): URL | undefined {
|
|
33
|
+
const normalized = normalize(ws);
|
|
34
|
+
if (!normalized) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
return new URL(normalized);
|
|
40
|
+
} catch (err) {
|
|
41
|
+
console.error(`unable to parse URL from normalized contextURL: '${normalized}'`, err);
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function normalize(ws: Pick<Workspace, "context" | "contextURL"> | undefined): string | undefined {
|
|
47
|
+
if (!ws) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
if (ws.context.normalizedContextURL) {
|
|
51
|
+
return ws.context.normalizedContextURL;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// fallback: we do not yet set normalizedContextURL on all workspaces, yet, let alone older existing workspaces
|
|
55
|
+
let fallback: string | undefined = undefined;
|
|
56
|
+
try {
|
|
57
|
+
fallback = removePrefixes(ws.contextURL);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
console.error(`unable to remove prefixes from contextURL: '${ws.contextURL}'`, err);
|
|
60
|
+
}
|
|
61
|
+
return fallback;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The field "contextUrl" might contain prefixes like:
|
|
66
|
+
* - envvar1=value1/...
|
|
67
|
+
* - prebuild/...
|
|
68
|
+
* This is the analogon to the (Prefix)ContextParser structure in "server".
|
|
69
|
+
*/
|
|
70
|
+
function removePrefixes(contextUrl: string | undefined): string | undefined {
|
|
71
|
+
if (contextUrl === undefined) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const segments = contextUrl.split("/");
|
|
76
|
+
if (segments.length === 1) {
|
|
77
|
+
return segments[0]; // this might be something, we just try
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const segmentsToURL = (offset: number): string => {
|
|
81
|
+
let rest = segments.slice(offset).join("/");
|
|
82
|
+
if (/^git@[^:\/]+:/.test(rest)) {
|
|
83
|
+
rest = rest.replace(/^git@([^:\/]+):/, 'https://$1/');
|
|
84
|
+
}
|
|
85
|
+
if (!rest.startsWith("http")) {
|
|
86
|
+
rest = 'https://' + rest;
|
|
87
|
+
}
|
|
88
|
+
return rest;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const firstSegment = segments[0];
|
|
92
|
+
if (firstSegment === PREBUILD_PREFIX ||
|
|
93
|
+
firstSegment === INCREMENTAL_PREBUILD_PREFIX ||
|
|
94
|
+
firstSegment === IMAGEBUILD_PREFIX ||
|
|
95
|
+
firstSegment === SNAPSHOT_PREFIX ||
|
|
96
|
+
firstSegment.startsWith(REFERRER_PREFIX)) {
|
|
97
|
+
return segmentsToURL(1);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// check for env vars
|
|
101
|
+
if (firstSegment.indexOf("=") !== -1) {
|
|
102
|
+
return segmentsToURL(1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return segmentsToURL(0);
|
|
106
|
+
}
|
|
107
|
+
}
|
package/src/email-protocol.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import uuidv4 = require("uuid/v4");
|
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
9
8
|
|
|
10
9
|
export type EMailState = "scheduledInternal"
|
|
11
10
|
| "scheduledSendgrid";
|
|
@@ -59,7 +58,7 @@ export type EMail = {
|
|
|
59
58
|
} & EMailStatus;
|
|
60
59
|
|
|
61
60
|
export namespace EMail {
|
|
62
|
-
export const create = (ts:
|
|
61
|
+
export const create = (ts: Omit<EMail, 'uid'>): EMail => {
|
|
63
62
|
const withId = ts as EMail;
|
|
64
63
|
withId.uid = uuidv4();
|
|
65
64
|
return withId;
|
package/src/env.ts
CHANGED
|
@@ -13,18 +13,18 @@ const legacyStagenameTranslation: { [key: string]: KubeStage } = {
|
|
|
13
13
|
"dev": "dev"
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export function translateLegacyStagename(kubeStage: string): KubeStage {
|
|
17
|
+
const stage = legacyStagenameTranslation[kubeStage];
|
|
18
|
+
if (!stage) {
|
|
19
|
+
throw new Error(`Invalid KUBE_STAGE: ${kubeStage}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return stage;
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
@injectable()
|
|
17
26
|
export abstract class AbstractComponentEnv {
|
|
18
|
-
readonly kubeStage: KubeStage = getEnvVarParsed('KUBE_STAGE',
|
|
19
|
-
const stage = legacyStagenameTranslation[kubeStage];
|
|
20
|
-
if (!stage) {
|
|
21
|
-
throw new Error(`Environment variable invalid: KUBE_STAGE=${kubeStage}`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return stage;
|
|
25
|
-
});
|
|
26
|
-
readonly kubeNamespace: string = getEnvVar('KUBE_NAMESPACE');
|
|
27
|
-
readonly version: string = getEnvVar('VERSION');
|
|
27
|
+
readonly kubeStage: KubeStage = getEnvVarParsed('KUBE_STAGE', translateLegacyStagename);
|
|
28
28
|
|
|
29
29
|
readonly installationLongname: string = getEnvVar("GITPOD_INSTALLATION_LONGNAME")
|
|
30
30
|
readonly installationShortname: string = getEnvVar("GITPOD_INSTALLATION_SHORTNAME")
|
package/src/gitpod-service.ts
CHANGED
|
@@ -6,14 +6,18 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
User, WorkspaceInfo, WorkspaceCreationResult, WorkspaceInstanceUser,
|
|
9
|
-
WhitelistedRepository, WorkspaceImageBuild, AuthProviderInfo,
|
|
9
|
+
WhitelistedRepository, WorkspaceImageBuild, AuthProviderInfo, CreateWorkspaceMode,
|
|
10
10
|
Token, UserEnvVarValue, ResolvePluginsParams, PreparePluginUploadParams, Terms,
|
|
11
11
|
ResolvedPlugins, Configuration, InstallPluginsParams, UninstallPluginParams, UserInfo, GitpodTokenType,
|
|
12
|
-
GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes,
|
|
12
|
+
GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes, ProjectEnvVar
|
|
13
13
|
} from './protocol';
|
|
14
|
+
import {
|
|
15
|
+
Team, TeamMemberInfo,
|
|
16
|
+
TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult, PartialProject
|
|
17
|
+
} from './teams-projects-protocol';
|
|
14
18
|
import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
|
|
15
19
|
import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
|
|
16
|
-
import {
|
|
20
|
+
import { HeadlessLogUrls } from './headless-workspace-log';
|
|
17
21
|
import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from './workspace-instance';
|
|
18
22
|
import { AdminServer } from './admin-protocol';
|
|
19
23
|
import { GitpodHostUrl } from './util/gitpod-host-url';
|
|
@@ -24,11 +28,15 @@ import { Emitter } from './util/event';
|
|
|
24
28
|
import { AccountStatement, CreditAlert } from './accounting-protocol';
|
|
25
29
|
import { GithubUpgradeURL, PlanCoupon } from './payment-protocol';
|
|
26
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';
|
|
27
34
|
|
|
28
35
|
export interface GitpodClient {
|
|
29
36
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
30
37
|
onWorkspaceImageBuildLogs: WorkspaceImageBuild.LogCallback;
|
|
31
|
-
|
|
38
|
+
|
|
39
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void;
|
|
32
40
|
|
|
33
41
|
onCreditAlert(creditAlert: CreditAlert): void;
|
|
34
42
|
|
|
@@ -39,7 +47,7 @@ export interface GitpodClient {
|
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
export const GitpodServer = Symbol('GitpodServer');
|
|
42
|
-
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
|
|
50
|
+
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
43
51
|
// User related API
|
|
44
52
|
getLoggedInUser(): Promise<User>;
|
|
45
53
|
getTerms(): Promise<Terms>;
|
|
@@ -48,9 +56,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
48
56
|
getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
|
|
49
57
|
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
|
|
50
58
|
deleteOwnAuthProvider(params: GitpodServer.DeleteOwnAuthProviderParams): Promise<void>;
|
|
51
|
-
getBranding(): Promise<Branding>;
|
|
52
59
|
getConfiguration(): Promise<Configuration>;
|
|
53
60
|
getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
|
|
61
|
+
getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
|
|
54
62
|
/**
|
|
55
63
|
* @deprecated
|
|
56
64
|
*/
|
|
@@ -64,8 +72,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
64
72
|
getWorkspaceOwner(workspaceId: string): Promise<UserInfo | undefined>;
|
|
65
73
|
getWorkspaceUsers(workspaceId: string): Promise<WorkspaceInstanceUser[]>;
|
|
66
74
|
getFeaturedRepositories(): Promise<WhitelistedRepository[]>;
|
|
75
|
+
getSuggestedContextURLs(): Promise<string[]>;
|
|
76
|
+
/**
|
|
77
|
+
* **Security:**
|
|
78
|
+
* Sensitive information like an owner token is erased, since it allows access for all team members.
|
|
79
|
+
* If you need to access an owner token use `getOwnerToken` instead.
|
|
80
|
+
*/
|
|
67
81
|
getWorkspace(id: string): Promise<WorkspaceInfo>;
|
|
68
82
|
isWorkspaceOwner(workspaceId: string): Promise<boolean>;
|
|
83
|
+
getOwnerToken(workspaceId: string): Promise<string>;
|
|
69
84
|
|
|
70
85
|
/**
|
|
71
86
|
* Creates and starts a workspace for the given context URL.
|
|
@@ -82,8 +97,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
82
97
|
updateWorkspaceUserPin(id: string, action: GitpodServer.PinAction): Promise<void>;
|
|
83
98
|
sendHeartBeat(options: GitpodServer.SendHeartBeatOptions): Promise<void>;
|
|
84
99
|
watchWorkspaceImageBuildLogs(workspaceId: string): Promise<void>;
|
|
85
|
-
watchHeadlessWorkspaceLogs(workspaceId: string): Promise<void>;
|
|
86
100
|
isPrebuildDone(pwsid: string): Promise<boolean>;
|
|
101
|
+
getHeadlessLog(instanceId: string): Promise<HeadlessLogUrls>;
|
|
87
102
|
|
|
88
103
|
// Workspace timeout
|
|
89
104
|
setWorkspaceTimeout(workspaceId: string, duration: WorkspaceTimeoutDuration): Promise<SetWorkspaceTimeoutResult>;
|
|
@@ -101,19 +116,47 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
101
116
|
getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
|
|
102
117
|
updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
|
|
103
118
|
|
|
104
|
-
//
|
|
119
|
+
// User env vars
|
|
105
120
|
getEnvVars(): Promise<UserEnvVarValue[]>;
|
|
106
121
|
getAllEnvVars(): Promise<UserEnvVarValue[]>;
|
|
107
122
|
setEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
108
123
|
deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
109
124
|
|
|
110
|
-
//
|
|
125
|
+
// Teams
|
|
111
126
|
getTeams(): Promise<Team[]>;
|
|
112
127
|
getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
|
|
113
128
|
createTeam(name: string): Promise<Team>;
|
|
114
129
|
joinTeam(inviteId: string): Promise<Team>;
|
|
130
|
+
setTeamMemberRole(teamId: string, userId: string, role: TeamMemberRole): Promise<void>;
|
|
131
|
+
removeTeamMember(teamId: string, userId: string): Promise<void>;
|
|
115
132
|
getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
|
|
116
133
|
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
134
|
+
deleteTeam(teamId: string, userId: string): Promise<void>;
|
|
135
|
+
|
|
136
|
+
// Admin Settings
|
|
137
|
+
adminGetSettings(): Promise<InstallationAdminSettings>;
|
|
138
|
+
adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
|
|
139
|
+
adminGetTelemetryData(): Promise<TelemetryData>;
|
|
140
|
+
|
|
141
|
+
// Projects
|
|
142
|
+
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
143
|
+
createProject(params: CreateProjectParams): Promise<Project>;
|
|
144
|
+
deleteProject(projectId: string): Promise<void>;
|
|
145
|
+
getTeamProjects(teamId: string): Promise<Project[]>;
|
|
146
|
+
getUserProjects(): Promise<Project[]>;
|
|
147
|
+
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
148
|
+
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
149
|
+
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
150
|
+
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
151
|
+
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
152
|
+
guessProjectConfiguration(projectId: string): Promise<string | undefined>;
|
|
153
|
+
fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
154
|
+
guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
155
|
+
setProjectConfiguration(projectId: string, configString: string): Promise<void>;
|
|
156
|
+
updateProjectPartial(partialProject: PartialProject): Promise<void>;
|
|
157
|
+
setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
|
|
158
|
+
getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
|
|
159
|
+
deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
|
|
117
160
|
|
|
118
161
|
// content service
|
|
119
162
|
getContentBlobUploadUrl(name: string): Promise<string>
|
|
@@ -129,10 +172,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
129
172
|
registerGithubApp(installationId: string): Promise<void>;
|
|
130
173
|
|
|
131
174
|
/**
|
|
132
|
-
* Stores a new snapshot for the given workspace and bucketId
|
|
175
|
+
* Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
|
|
133
176
|
* @return the snapshot id
|
|
134
177
|
*/
|
|
135
178
|
takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
|
|
179
|
+
/**
|
|
180
|
+
*
|
|
181
|
+
* @param snapshotId
|
|
182
|
+
*/
|
|
183
|
+
waitForSnapshot(snapshotId: string): Promise<void>;
|
|
136
184
|
|
|
137
185
|
/**
|
|
138
186
|
* Returns the list of snapshots that exist for a workspace.
|
|
@@ -164,8 +212,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
164
212
|
* gitpod.io concerns
|
|
165
213
|
*/
|
|
166
214
|
isStudent(): Promise<boolean>;
|
|
167
|
-
getPrivateRepoTrialEndDate(): Promise<string | undefined>;
|
|
168
|
-
|
|
169
215
|
/**
|
|
170
216
|
*
|
|
171
217
|
*/
|
|
@@ -183,7 +229,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
183
229
|
|
|
184
230
|
getShowPaymentUI(): Promise<boolean>;
|
|
185
231
|
isChargebeeCustomer(): Promise<boolean>;
|
|
186
|
-
mayAccessPrivateRepo(): Promise<boolean>;
|
|
187
232
|
|
|
188
233
|
subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
189
234
|
subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
@@ -201,6 +246,64 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
201
246
|
|
|
202
247
|
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
203
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Analytics
|
|
251
|
+
*/
|
|
252
|
+
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
253
|
+
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
254
|
+
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface RateLimiterError {
|
|
258
|
+
method?: string,
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Retry after this many seconds, earliest.
|
|
262
|
+
* cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
263
|
+
*/
|
|
264
|
+
retryAfter: number,
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface CreateProjectParams {
|
|
268
|
+
name: string;
|
|
269
|
+
slug?: string;
|
|
270
|
+
account: string;
|
|
271
|
+
provider: string;
|
|
272
|
+
cloneUrl: string;
|
|
273
|
+
teamId?: string;
|
|
274
|
+
userId?: string;
|
|
275
|
+
appInstallationId: string;
|
|
276
|
+
}
|
|
277
|
+
export interface FindPrebuildsParams {
|
|
278
|
+
projectId: string;
|
|
279
|
+
branch?: string;
|
|
280
|
+
latest?: boolean;
|
|
281
|
+
prebuildId?: string;
|
|
282
|
+
// default: 30
|
|
283
|
+
limit?: number;
|
|
284
|
+
}
|
|
285
|
+
export interface GetProviderRepositoriesParams {
|
|
286
|
+
provider: string;
|
|
287
|
+
hints?: { installationId: string } | object;
|
|
288
|
+
}
|
|
289
|
+
export interface ProviderRepository {
|
|
290
|
+
name: string;
|
|
291
|
+
path?: string;
|
|
292
|
+
account: string;
|
|
293
|
+
accountAvatarUrl: string;
|
|
294
|
+
cloneUrl: string;
|
|
295
|
+
updatedAt: string;
|
|
296
|
+
installationId?: number;
|
|
297
|
+
installationUpdatedAt?: string;
|
|
298
|
+
|
|
299
|
+
inUse?: { userName: string };
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface ClientHeaderFields {
|
|
303
|
+
ip?: string;
|
|
304
|
+
userAgent?: string;
|
|
305
|
+
dnt?: string;
|
|
306
|
+
clientRegion?: string;
|
|
204
307
|
}
|
|
205
308
|
|
|
206
309
|
export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
|
|
@@ -213,6 +316,7 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
|
|
|
213
316
|
methods.setClient = methods.setClient || (() => { });
|
|
214
317
|
methods.dispose = methods.dispose || (() => { });
|
|
215
318
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
319
|
+
// @ts-ignore
|
|
216
320
|
get: (target: S, property: keyof S) => {
|
|
217
321
|
const result = target[property];
|
|
218
322
|
if (!result) {
|
|
@@ -245,6 +349,8 @@ export namespace GitpodServer {
|
|
|
245
349
|
limit?: number;
|
|
246
350
|
searchString?: string;
|
|
247
351
|
pinnedOnly?: boolean;
|
|
352
|
+
projectId?: string | string[];
|
|
353
|
+
includeWithoutProject?: boolean;
|
|
248
354
|
}
|
|
249
355
|
export interface GetAccountStatementOptions {
|
|
250
356
|
date?: string;
|
|
@@ -252,6 +358,7 @@ export namespace GitpodServer {
|
|
|
252
358
|
export interface CreateWorkspaceOptions {
|
|
253
359
|
contextUrl: string;
|
|
254
360
|
mode?: CreateWorkspaceMode;
|
|
361
|
+
forceDefaultConfig?: boolean;
|
|
255
362
|
}
|
|
256
363
|
export interface StartWorkspaceOptions {
|
|
257
364
|
forceDefaultImage: boolean;
|
|
@@ -259,6 +366,8 @@ export namespace GitpodServer {
|
|
|
259
366
|
export interface TakeSnapshotOptions {
|
|
260
367
|
workspaceId: string;
|
|
261
368
|
layoutData?: string;
|
|
369
|
+
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
370
|
+
dontWait?: boolean;
|
|
262
371
|
}
|
|
263
372
|
export interface GetUserStorageResourceOptions {
|
|
264
373
|
readonly uri: string;
|
|
@@ -300,10 +409,12 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
300
409
|
|
|
301
410
|
public registerClient(client: Partial<Client>): Disposable {
|
|
302
411
|
this.clients.push(client);
|
|
303
|
-
const index = this.clients.length;
|
|
304
412
|
return {
|
|
305
413
|
dispose: () => {
|
|
306
|
-
this.clients.
|
|
414
|
+
const index = this.clients.indexOf(client);
|
|
415
|
+
if (index > -1) {
|
|
416
|
+
this.clients.splice(index, 1);
|
|
417
|
+
}
|
|
307
418
|
}
|
|
308
419
|
}
|
|
309
420
|
}
|
|
@@ -320,11 +431,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
320
431
|
}
|
|
321
432
|
}
|
|
322
433
|
|
|
323
|
-
|
|
434
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void {
|
|
324
435
|
for (const client of this.clients) {
|
|
325
|
-
if (client.
|
|
436
|
+
if (client.onPrebuildUpdate) {
|
|
326
437
|
try {
|
|
327
|
-
client.
|
|
438
|
+
client.onPrebuildUpdate(update);
|
|
328
439
|
} catch (error) {
|
|
329
440
|
console.error(error)
|
|
330
441
|
}
|
|
@@ -332,11 +443,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
332
443
|
}
|
|
333
444
|
}
|
|
334
445
|
|
|
335
|
-
|
|
446
|
+
onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
|
|
336
447
|
for (const client of this.clients) {
|
|
337
|
-
if (client.
|
|
448
|
+
if (client.onWorkspaceImageBuildLogs) {
|
|
338
449
|
try {
|
|
339
|
-
client.
|
|
450
|
+
client.onWorkspaceImageBuildLogs(info, content);
|
|
340
451
|
} catch (error) {
|
|
341
452
|
console.error(error)
|
|
342
453
|
}
|
|
@@ -493,7 +604,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
493
604
|
}
|
|
494
605
|
|
|
495
606
|
export interface GitpodServiceOptions {
|
|
496
|
-
onReconnect?: () => (void |
|
|
607
|
+
onReconnect?: () => (void | Promise<void>)
|
|
497
608
|
}
|
|
498
609
|
|
|
499
610
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
@@ -22,21 +22,17 @@ export namespace HeadlessWorkspaceEventType {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export interface
|
|
25
|
+
export interface HeadlessWorkspaceEvent {
|
|
26
26
|
workspaceID: string;
|
|
27
27
|
text: string;
|
|
28
28
|
type: HeadlessWorkspaceEventType;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
TaskSuccessfulLabel = "workspaceTaskDone"
|
|
31
|
+
export interface HeadlessLogUrls {
|
|
32
|
+
// A map of id to URL
|
|
33
|
+
streams: { [streamID: string]: string };
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
error?: string;
|
|
41
|
-
snapshotURL?: string;
|
|
42
|
-
}
|
|
36
|
+
/** cmp. @const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX */
|
|
37
|
+
export const HEADLESS_LOG_STREAM_STATUS_CODE = "X-LogStream-StatusCode";
|
|
38
|
+
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' |
|
|
10
|
+
export type IDEFrontendState = 'init' | 'ready' | 'terminated';
|
|
11
11
|
|
|
12
12
|
export interface IDEFrontendService {
|
|
13
13
|
readonly state: IDEFrontendState;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 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
|
+
* `IDEServer` provides a list of available IDEs.
|
|
9
|
+
*/
|
|
10
|
+
export interface IDEServer {
|
|
11
|
+
/**
|
|
12
|
+
* Returns the IDE preferences.
|
|
13
|
+
*/
|
|
14
|
+
getIDEOptions(): Promise<IDEOptions>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IDEOptions {
|
|
18
|
+
/**
|
|
19
|
+
* A list of available IDEs.
|
|
20
|
+
*/
|
|
21
|
+
options: { [key: string]: IDEOption };
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The default (browser) IDE when the user has not specified one.
|
|
25
|
+
*/
|
|
26
|
+
defaultIde: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The default desktop IDE when the user has not specified one.
|
|
30
|
+
*/
|
|
31
|
+
defaultDesktopIde: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Client specific IDE options.
|
|
35
|
+
*/
|
|
36
|
+
clients?: { [id: string]: IDEClient };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface IDEClient {
|
|
40
|
+
/**
|
|
41
|
+
* The default desktop IDE when the user has not specified one.
|
|
42
|
+
*/
|
|
43
|
+
defaultDesktopIDE?: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Desktop IDEs supported by the client.
|
|
47
|
+
*/
|
|
48
|
+
desktopIDEs?: string[]
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Steps to install the client on user machine.
|
|
52
|
+
*/
|
|
53
|
+
installationSteps?: string[]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface IDEOption {
|
|
57
|
+
/**
|
|
58
|
+
* To ensure a stable order one can set an `orderKey`.
|
|
59
|
+
*/
|
|
60
|
+
orderKey?: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Human readable title text of the IDE (plain text only).
|
|
64
|
+
*/
|
|
65
|
+
title: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The type of the IDE, currently 'browser' or 'desktop'.
|
|
69
|
+
*/
|
|
70
|
+
type: 'browser' | 'desktop';
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The logo for the IDE. That could be a key in (see
|
|
74
|
+
* components/dashboard/src/images/ideLogos.ts) or a URL.
|
|
75
|
+
*/
|
|
76
|
+
logo: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Text of an optional tooltip (plain text only).
|
|
80
|
+
*/
|
|
81
|
+
tooltip?: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Text of an optional label next to the IDE option like “Insiders” (plain
|
|
85
|
+
* text only).
|
|
86
|
+
*/
|
|
87
|
+
label?: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Notes to the IDE option that are renderd in the preferences when a user
|
|
91
|
+
* chooses this IDE.
|
|
92
|
+
*/
|
|
93
|
+
notes?: string[];
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* If `true` this IDE option is not visible in the IDE preferences.
|
|
97
|
+
*/
|
|
98
|
+
hidden?: boolean;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The image ref to the IDE image.
|
|
102
|
+
*/
|
|
103
|
+
image: string;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The latest image ref to the IDE image, this image ref always resolve to digest.
|
|
107
|
+
*/
|
|
108
|
+
latestImage?: string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* When this is `true`, the tag of this image is resolved to the latest
|
|
112
|
+
* image digest regularly.
|
|
113
|
+
*
|
|
114
|
+
* This is useful if this image points to a tag like `nightly` that will be
|
|
115
|
+
* updated regularly. When `resolveImageDigest` is `true`, we make sure that
|
|
116
|
+
* we resolve the tag regularly to the most recent image version.
|
|
117
|
+
*/
|
|
118
|
+
resolveImageDigest?: boolean;
|
|
119
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -15,3 +15,8 @@ export * from './permission';
|
|
|
15
15
|
export * from './admin-protocol';
|
|
16
16
|
export * from './email-protocol';
|
|
17
17
|
export * from './headless-workspace-log';
|
|
18
|
+
export * from './context-url';
|
|
19
|
+
export * from './teams-projects-protocol';
|
|
20
|
+
export * from './snapshot-url';
|
|
21
|
+
export * from './oss-allowlist';
|
|
22
|
+
export * from './installation-admin-protocol';
|
|
@@ -0,0 +1,42 @@
|
|
|
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 interface TelemetryData {
|
|
27
|
+
installationAdmin: InstallationAdmin
|
|
28
|
+
totalUsers: number
|
|
29
|
+
totalWorkspaces: number
|
|
30
|
+
totalInstances: number
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export namespace InstallationAdmin {
|
|
34
|
+
export function createDefault(): InstallationAdmin {
|
|
35
|
+
return {
|
|
36
|
+
id: uuidv4(),
|
|
37
|
+
settings: {
|
|
38
|
+
...InstallationAdminSettingsPrototype,
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|