@gitpod/gitpod-protocol 0.1.5-v0.6.0-beta4 → 0.1.5-vn-6525.75
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 +68 -26
- package/lib/accounting-protocol.d.ts +155 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +100 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +33 -4
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +15 -0
- 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/auth.d.ts +25 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +16 -0
- package/lib/auth.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/context-url.spec.d.ts +14 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +109 -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.d.ts.map +1 -1
- package/lib/encryption/container-module.js +5 -4
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +25 -26
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +29 -37
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +30 -44
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +31 -38
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +2 -3
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +24 -25
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +26 -42
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +145 -142
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +172 -33
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +187 -267
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +9 -11
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +6 -8
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +5 -1
- package/lib/ide-frontend-service.d.ts.map +1 -1
- package/lib/ide-protocol.d.ts +105 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/{util/without.js → ide-protocol.js} +2 -2
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +16 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -1
- 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/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +5 -3
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +184 -34
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +4 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +42 -59
- 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 +5 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +10 -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/handler.js +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 +24 -60
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +3 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +75 -162
- 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/payment-protocol.d.ts +18 -0
- package/lib/payment-protocol.d.ts.map +1 -0
- package/lib/payment-protocol.js +13 -0
- package/lib/payment-protocol.js.map +1 -0
- package/lib/permission.d.ts +10 -5
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +41 -35
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +210 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +605 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +164 -88
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +184 -199
- 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 +75 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +63 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- 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/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/util/analytics.d.ts +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +88 -0
- package/lib/util/analytics.js.map +1 -0
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +57 -135
- 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 +11 -11
- 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.d.ts.map +1 -1
- package/lib/util/disposable.js +27 -40
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +63 -77
- 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 +27 -47
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +4 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.js +487 -0
- package/lib/util/generate-workspace-id.js.map +1 -0
- package/{src/theia-plugins.ts → lib/util/generate-workspace-id.spec.d.ts} +2 -6
- package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.spec.js +91 -0
- package/lib/util/generate-workspace-id.spec.js.map +1 -0
- 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 +41 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +2 -2
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +109 -106
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +8 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +114 -22
- 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/{theia-plugins.js → util/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 +125 -129
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +5 -5
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +13 -3
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +37 -8
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +8 -0
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +127 -47
- 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 +147 -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.d.ts.map +1 -1
- package/lib/util/semaphore.js +15 -46
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +6 -6
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +28 -16
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.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 +52 -6
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +199 -64
- 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.d.ts +7 -7
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +10 -12
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +76 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +31 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +28 -4
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +2 -2
- package/package.json +33 -17
- package/pkg-yarn.lock +18 -9
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +231 -0
- package/src/admin-protocol.ts +71 -19
- package/src/analytics.ts +52 -0
- package/src/auth.ts +27 -0
- package/src/context-url.spec.ts +67 -0
- package/src/context-url.ts +109 -0
- package/src/email-protocol.ts +5 -7
- package/src/encryption/container-module.ts +2 -3
- package/src/encryption/encryption-engine.spec.ts +9 -8
- package/src/encryption/encryption-engine.ts +14 -14
- package/src/encryption/encryption-service.ts +4 -5
- package/src/encryption/key-provider.ts +16 -19
- package/src/env.ts +18 -18
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +327 -102
- package/src/headless-workspace-log.ts +12 -14
- package/src/ide-frontend-service.ts +6 -2
- package/src/ide-protocol.ts +119 -0
- package/src/index.ts +16 -10
- package/src/installation-admin-protocol.ts +42 -0
- package/src/license-protocol.ts +5 -6
- package/src/messaging/browser/connection.ts +197 -18
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +96 -0
- package/src/messaging/error.ts +15 -5
- package/src/messaging/handler.ts +13 -1
- package/src/messaging/node/connection.ts +23 -70
- package/src/messaging/proxy-factory.ts +35 -34
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +20 -0
- package/src/permission.ts +42 -38
- package/src/plans.ts +679 -0
- package/src/protocol.ts +384 -279
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +123 -0
- package/src/teams-projects-protocol.ts +147 -0
- package/src/typings/globals.ts +4 -4
- package/src/util/analytics.ts +109 -0
- package/src/util/async-iterator.ts +4 -5
- package/src/util/cancelable.ts +3 -3
- package/src/util/date-time.ts +8 -8
- package/src/util/deferred.ts +6 -6
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +11 -8
- package/src/util/generate-workspace-id.spec.ts +51 -0
- package/src/util/generate-workspace-id.ts +475 -0
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +63 -7
- package/src/util/gitpod-host-url.ts +55 -38
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +145 -71
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +60 -10
- package/src/util/parse-workspace-id.ts +38 -8
- package/src/util/queue.spec.ts +28 -26
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +6 -8
- package/src/util/skip-if.ts +10 -7
- package/src/util/timeutil.spec.ts +14 -15
- package/src/util/timeutil.ts +19 -15
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +202 -31
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/workspace-cluster.ts +107 -0
- package/src/workspace-instance.ts +72 -30
- package/src/wsready.ts +3 -3
- package/data/builtin-theia-plugins.json +0 -372
- 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/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.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/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
package/src/protocol.ts
CHANGED
|
@@ -6,28 +6,28 @@
|
|
|
6
6
|
|
|
7
7
|
import { WorkspaceInstance, PortVisibility } from "./workspace-instance";
|
|
8
8
|
import { RoleOrPermission } from "./permission";
|
|
9
|
+
import { Project } from "./teams-projects-protocol";
|
|
10
|
+
import { createHash } from "crypto";
|
|
9
11
|
|
|
10
12
|
export interface UserInfo {
|
|
11
|
-
name?: string
|
|
13
|
+
name?: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export interface User {
|
|
15
17
|
/** The user id */
|
|
16
|
-
id: string
|
|
18
|
+
id: string;
|
|
17
19
|
|
|
18
20
|
/** The timestamp when the user entry was created */
|
|
19
|
-
creationDate: string
|
|
21
|
+
creationDate: string;
|
|
20
22
|
|
|
21
|
-
avatarUrl?: string
|
|
23
|
+
avatarUrl?: string;
|
|
22
24
|
|
|
23
|
-
name?: string
|
|
25
|
+
name?: string;
|
|
24
26
|
|
|
25
27
|
/** Optional for backwards compatibility */
|
|
26
|
-
fullName?: string
|
|
28
|
+
fullName?: string;
|
|
27
29
|
|
|
28
|
-
identities: Identity[]
|
|
29
|
-
|
|
30
|
-
allowsMarketingCommunication: boolean;
|
|
30
|
+
identities: Identity[];
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Whether the user has been blocked to use our service, because of TOS violation for example.
|
|
@@ -35,11 +35,6 @@ export interface User {
|
|
|
35
35
|
*/
|
|
36
36
|
blocked?: boolean;
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
* whether this user can run workspaces in privileged mode
|
|
40
|
-
*/
|
|
41
|
-
privileged?: boolean;
|
|
42
|
-
|
|
43
38
|
/** A map of random settings that alter the behaviour of Gitpod on a per-user basis */
|
|
44
39
|
featureFlags?: UserFeatureSettings;
|
|
45
40
|
|
|
@@ -54,29 +49,27 @@ export interface User {
|
|
|
54
49
|
|
|
55
50
|
export namespace User {
|
|
56
51
|
export function is(data: any): data is User {
|
|
57
|
-
return data
|
|
58
|
-
&& data.hasOwnProperty('id')
|
|
59
|
-
&& data.hasOwnProperty('identities')
|
|
52
|
+
return data && data.hasOwnProperty("id") && data.hasOwnProperty("identities");
|
|
60
53
|
}
|
|
61
54
|
export function getIdentity(user: User, authProviderId: string): Identity | undefined {
|
|
62
|
-
return user.identities.find(id => id.authProviderId === authProviderId);
|
|
55
|
+
return user.identities.find((id) => id.authProviderId === authProviderId);
|
|
63
56
|
}
|
|
64
57
|
export function censor(user: User): User {
|
|
65
58
|
const res = { ...user };
|
|
66
|
-
delete
|
|
67
|
-
res.identities = res.identities.map(i => {
|
|
68
|
-
delete
|
|
59
|
+
delete res.additionalData;
|
|
60
|
+
res.identities = res.identities.map((i) => {
|
|
61
|
+
delete i.tokens;
|
|
69
62
|
|
|
70
63
|
// The user field is not in the Identity shape, but actually exists on DBIdentity.
|
|
71
64
|
// Trying to push this object out via JSON RPC will fail because of the cyclic nature
|
|
72
65
|
// of this field.
|
|
73
|
-
delete (
|
|
66
|
+
delete (i as any).user;
|
|
74
67
|
return i;
|
|
75
68
|
});
|
|
76
69
|
return res;
|
|
77
70
|
}
|
|
78
71
|
export function getPrimaryEmail(user: User): string {
|
|
79
|
-
const identities = user.identities.filter(i => !!i.primaryEmail);
|
|
72
|
+
const identities = user.identities.filter((i) => !!i.primaryEmail);
|
|
80
73
|
if (identities.length <= 0) {
|
|
81
74
|
throw new Error(`No identity with primary email for user: ${user.id}!`);
|
|
82
75
|
}
|
|
@@ -103,15 +96,30 @@ export interface AdditionalUserData {
|
|
|
103
96
|
emailNotificationSettings?: EmailNotificationSettings;
|
|
104
97
|
featurePreview?: boolean;
|
|
105
98
|
ideSettings?: IDESettings;
|
|
99
|
+
// key is the name of the news, string the iso date when it was seen
|
|
100
|
+
whatsNewSeen?: { [key: string]: string };
|
|
101
|
+
// key is the name of the OAuth client i.e. local app, string the iso date when it was approved
|
|
102
|
+
// TODO(rl): provide a management UX to allow rescinding of approval
|
|
103
|
+
oauthClientsApproved?: { [key: string]: string };
|
|
104
|
+
// to remember GH Orgs the user installed/updated the GH App for
|
|
105
|
+
knownGitHubOrgs?: string[];
|
|
106
|
+
|
|
107
|
+
// Git clone URL pointing to the user's dotfile repo
|
|
108
|
+
dotfileRepo?: string;
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
export interface EmailNotificationSettings {
|
|
109
|
-
|
|
112
|
+
allowsChangelogMail?: boolean;
|
|
113
|
+
allowsDevXMail?: boolean;
|
|
114
|
+
allowsOnboardingMail?: boolean;
|
|
110
115
|
}
|
|
111
116
|
|
|
112
117
|
export type IDESettings = {
|
|
113
|
-
defaultIde?: string
|
|
114
|
-
|
|
118
|
+
defaultIde?: string;
|
|
119
|
+
useDesktopIde?: boolean;
|
|
120
|
+
defaultDesktopIde?: string;
|
|
121
|
+
useLatestVersion?: boolean;
|
|
122
|
+
};
|
|
115
123
|
|
|
116
124
|
export interface UserPlatform {
|
|
117
125
|
uid: string;
|
|
@@ -132,14 +140,6 @@ export interface UserPlatform {
|
|
|
132
140
|
}
|
|
133
141
|
|
|
134
142
|
export interface UserFeatureSettings {
|
|
135
|
-
/**
|
|
136
|
-
* This field is used as marker to grant users a free trial for using private repositories,
|
|
137
|
-
* independent of any subscription or Chargebee.
|
|
138
|
-
* - it is set when the user uses their first private repo
|
|
139
|
-
* - whether the trial is expired or not is juged by the UserService
|
|
140
|
-
*/
|
|
141
|
-
privateRepoTrialStartDate?: string;
|
|
142
|
-
|
|
143
143
|
/**
|
|
144
144
|
* Permanent feature flags are added to each and every workspace instance
|
|
145
145
|
* this user starts.
|
|
@@ -151,15 +151,30 @@ export interface UserFeatureSettings {
|
|
|
151
151
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
152
152
|
* If they don't we'll break things during workspace startup.
|
|
153
153
|
*/
|
|
154
|
-
export const WorkspaceFeatureFlags = {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
export const WorkspaceFeatureFlags = {
|
|
155
|
+
full_workspace_backup: undefined,
|
|
156
|
+
fixed_resources: undefined,
|
|
157
|
+
persistent_volume_claim: undefined,
|
|
158
|
+
};
|
|
159
|
+
export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
|
|
160
|
+
|
|
161
|
+
export interface EnvVarWithValue {
|
|
159
162
|
name: string;
|
|
160
|
-
repositoryPattern: string;
|
|
161
163
|
value: string;
|
|
162
164
|
}
|
|
165
|
+
|
|
166
|
+
export interface ProjectEnvVarWithValue extends EnvVarWithValue {
|
|
167
|
+
id: string;
|
|
168
|
+
projectId: string;
|
|
169
|
+
censored: boolean;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, "value">;
|
|
173
|
+
|
|
174
|
+
export interface UserEnvVarValue extends EnvVarWithValue {
|
|
175
|
+
id?: string;
|
|
176
|
+
repositoryPattern: string; // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
177
|
+
}
|
|
163
178
|
export interface UserEnvVar extends UserEnvVarValue {
|
|
164
179
|
id: string;
|
|
165
180
|
userId: string;
|
|
@@ -167,26 +182,50 @@ export interface UserEnvVar extends UserEnvVarValue {
|
|
|
167
182
|
}
|
|
168
183
|
|
|
169
184
|
export namespace UserEnvVar {
|
|
170
|
-
|
|
185
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
171
186
|
export function normalizeRepoPattern(pattern: string) {
|
|
172
187
|
return pattern.toLocaleLowerCase();
|
|
173
188
|
}
|
|
174
189
|
|
|
190
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
191
|
+
export function score(value: UserEnvVarValue): number {
|
|
192
|
+
// We use a score to enforce precedence:
|
|
193
|
+
// value/value = 0
|
|
194
|
+
// value/* = 1
|
|
195
|
+
// */value = 2
|
|
196
|
+
// */* = 3
|
|
197
|
+
// #/# = 4 (used for env vars passed through the URL)
|
|
198
|
+
// the lower the score, the higher the precedence.
|
|
199
|
+
const [ownerPattern, repoPattern] = splitRepositoryPattern(value.repositoryPattern);
|
|
200
|
+
let score = 0;
|
|
201
|
+
if (repoPattern == "*") {
|
|
202
|
+
score += 1;
|
|
203
|
+
}
|
|
204
|
+
if (ownerPattern == "*") {
|
|
205
|
+
score += 2;
|
|
206
|
+
}
|
|
207
|
+
if (ownerPattern == "#" || repoPattern == "#") {
|
|
208
|
+
score = 4;
|
|
209
|
+
}
|
|
210
|
+
return score;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
175
214
|
export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
|
|
176
|
-
let result = vars.filter(e => {
|
|
215
|
+
let result = vars.filter((e) => {
|
|
177
216
|
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
178
|
-
if (ownerPattern !==
|
|
217
|
+
if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
|
|
179
218
|
return false;
|
|
180
219
|
}
|
|
181
|
-
if (repoPattern !==
|
|
220
|
+
if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
|
|
182
221
|
return false;
|
|
183
222
|
}
|
|
184
223
|
return true;
|
|
185
224
|
});
|
|
186
225
|
|
|
187
226
|
const resmap = new Map<string, T[]>();
|
|
188
|
-
result.forEach(e => {
|
|
189
|
-
const l =
|
|
227
|
+
result.forEach((e) => {
|
|
228
|
+
const l = resmap.get(e.name) || [];
|
|
190
229
|
l.push(e);
|
|
191
230
|
resmap.set(e.name, l);
|
|
192
231
|
});
|
|
@@ -207,25 +246,7 @@ export namespace UserEnvVar {
|
|
|
207
246
|
let minscore = 10;
|
|
208
247
|
let bestCandidate: T | undefined;
|
|
209
248
|
for (const e of candidates) {
|
|
210
|
-
|
|
211
|
-
// value/value = 0
|
|
212
|
-
// value/* = 1
|
|
213
|
-
// */value = 2
|
|
214
|
-
// */* = 3
|
|
215
|
-
// #/# = 4 (used for env vars passed through the URL)
|
|
216
|
-
// the lower the score, the higher the precedence.
|
|
217
|
-
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
218
|
-
let score = 0;
|
|
219
|
-
if (repoPattern == "*") {
|
|
220
|
-
score += 1;
|
|
221
|
-
}
|
|
222
|
-
if (ownerPattern == '*') {
|
|
223
|
-
score += 2;
|
|
224
|
-
}
|
|
225
|
-
if (ownerPattern == "#" || repoPattern == "#") {
|
|
226
|
-
score = 4;
|
|
227
|
-
}
|
|
228
|
-
|
|
249
|
+
const score = UserEnvVar.score(e);
|
|
229
250
|
if (!bestCandidate || score < minscore) {
|
|
230
251
|
minscore = score;
|
|
231
252
|
bestCandidate = e;
|
|
@@ -237,47 +258,47 @@ export namespace UserEnvVar {
|
|
|
237
258
|
return result;
|
|
238
259
|
}
|
|
239
260
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
const
|
|
261
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
262
|
+
export function splitRepositoryPattern(repositoryPattern: string): string[] {
|
|
263
|
+
const patterns = repositoryPattern.split("/");
|
|
264
|
+
const repoPattern = patterns.slice(1).join("/");
|
|
265
|
+
const ownerPattern = patterns[0];
|
|
244
266
|
return [ownerPattern, repoPattern];
|
|
245
267
|
}
|
|
246
268
|
}
|
|
247
269
|
|
|
248
270
|
export interface GitpodToken {
|
|
249
|
-
|
|
250
271
|
/** Hash value (SHA256) of the token (primary key). */
|
|
251
|
-
tokenHash: string
|
|
272
|
+
tokenHash: string;
|
|
252
273
|
|
|
253
274
|
/** Human readable name of the token */
|
|
254
|
-
name?: string
|
|
275
|
+
name?: string;
|
|
255
276
|
|
|
256
277
|
/** Token kind */
|
|
257
|
-
type: GitpodTokenType
|
|
278
|
+
type: GitpodTokenType;
|
|
258
279
|
|
|
259
280
|
/** The user the token belongs to. */
|
|
260
|
-
user: User
|
|
281
|
+
user: User;
|
|
261
282
|
|
|
262
283
|
/** Scopes (e.g. limition to read-only) */
|
|
263
|
-
scopes: string[]
|
|
284
|
+
scopes: string[];
|
|
264
285
|
|
|
265
286
|
/** Created timestamp */
|
|
266
|
-
created: string
|
|
287
|
+
created: string;
|
|
267
288
|
|
|
268
289
|
// token is deleted on the database and about to be collected by db-sync
|
|
269
|
-
deleted?: boolean
|
|
290
|
+
deleted?: boolean;
|
|
270
291
|
}
|
|
271
292
|
|
|
272
293
|
export enum GitpodTokenType {
|
|
273
294
|
API_AUTH_TOKEN = 0,
|
|
274
|
-
MACHINE_AUTH_TOKEN = 1
|
|
295
|
+
MACHINE_AUTH_TOKEN = 1,
|
|
275
296
|
}
|
|
276
297
|
|
|
277
298
|
export interface OneTimeSecret {
|
|
278
|
-
id: string
|
|
299
|
+
id: string;
|
|
279
300
|
|
|
280
|
-
value: string
|
|
301
|
+
value: string;
|
|
281
302
|
|
|
282
303
|
expirationTime: string;
|
|
283
304
|
|
|
@@ -309,13 +330,12 @@ export type IdentityLookup = Pick<Identity, "authProviderId" | "authId">;
|
|
|
309
330
|
|
|
310
331
|
export namespace Identity {
|
|
311
332
|
export function is(data: any): data is Identity {
|
|
312
|
-
return
|
|
313
|
-
&& data.hasOwnProperty(
|
|
314
|
-
|
|
333
|
+
return (
|
|
334
|
+
data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName")
|
|
335
|
+
);
|
|
315
336
|
}
|
|
316
337
|
export function equals(id1: IdentityLookup, id2: IdentityLookup) {
|
|
317
|
-
return id1.authProviderId === id2.authProviderId
|
|
318
|
-
&& id1.authId === id2.authId
|
|
338
|
+
return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
|
|
319
339
|
}
|
|
320
340
|
}
|
|
321
341
|
|
|
@@ -371,11 +391,16 @@ export interface PendingGithubEvent {
|
|
|
371
391
|
export interface Snapshot {
|
|
372
392
|
id: string;
|
|
373
393
|
creationTime: string;
|
|
394
|
+
availableTime?: string;
|
|
374
395
|
originalWorkspaceId: string;
|
|
375
396
|
bucketId: string;
|
|
376
397
|
layoutData?: string;
|
|
398
|
+
state: SnapshotState;
|
|
399
|
+
message?: string;
|
|
377
400
|
}
|
|
378
401
|
|
|
402
|
+
export type SnapshotState = "pending" | "available" | "error";
|
|
403
|
+
|
|
379
404
|
export interface LayoutData {
|
|
380
405
|
workspaceId: string;
|
|
381
406
|
lastUpdatedTime: string;
|
|
@@ -388,6 +413,7 @@ export interface Workspace {
|
|
|
388
413
|
contextURL: string;
|
|
389
414
|
description: string;
|
|
390
415
|
ownerId: string;
|
|
416
|
+
projectId?: string;
|
|
391
417
|
context: WorkspaceContext;
|
|
392
418
|
config: WorkspaceConfig;
|
|
393
419
|
|
|
@@ -402,13 +428,13 @@ export interface Workspace {
|
|
|
402
428
|
* The resolved, fix name of the workspace image. We only use this
|
|
403
429
|
* to access the logs during an image build.
|
|
404
430
|
*/
|
|
405
|
-
imageNameResolved?: string
|
|
431
|
+
imageNameResolved?: string;
|
|
406
432
|
|
|
407
433
|
/**
|
|
408
434
|
* The resolved/built fixed named of the base image. This field is only set if the workspace
|
|
409
435
|
* already has its base image built.
|
|
410
436
|
*/
|
|
411
|
-
baseImageNameResolved?: string
|
|
437
|
+
baseImageNameResolved?: string;
|
|
412
438
|
|
|
413
439
|
shareable?: boolean;
|
|
414
440
|
pinned?: boolean;
|
|
@@ -445,17 +471,16 @@ export type WorkspaceSoftDeletion = "user" | "gc";
|
|
|
445
471
|
export type WorkspaceType = "regular" | "prebuild" | "probe";
|
|
446
472
|
|
|
447
473
|
export namespace Workspace {
|
|
448
|
-
|
|
449
474
|
export function getFullRepositoryName(ws: Workspace): string | undefined {
|
|
450
475
|
if (CommitContext.is(ws.context)) {
|
|
451
|
-
return ws.context.repository.owner +
|
|
476
|
+
return ws.context.repository.owner + "/" + ws.context.repository.name;
|
|
452
477
|
}
|
|
453
478
|
return undefined;
|
|
454
479
|
}
|
|
455
480
|
|
|
456
481
|
export function getFullRepositoryUrl(ws: Workspace): string | undefined {
|
|
457
482
|
if (CommitContext.is(ws.context)) {
|
|
458
|
-
return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}
|
|
483
|
+
return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`;
|
|
459
484
|
}
|
|
460
485
|
return undefined;
|
|
461
486
|
}
|
|
@@ -489,41 +514,36 @@ export namespace Workspace {
|
|
|
489
514
|
}
|
|
490
515
|
}
|
|
491
516
|
|
|
492
|
-
export interface
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
config?: WorkspaceConfig
|
|
498
|
-
builtins?: ResolvedPlugins
|
|
499
|
-
vsxRegistryUrl?: string
|
|
517
|
+
export interface GuessGitTokenScopesParams {
|
|
518
|
+
host: string;
|
|
519
|
+
repoUrl: string;
|
|
520
|
+
gitCommand: string;
|
|
521
|
+
currentToken: GitToken;
|
|
500
522
|
}
|
|
501
523
|
|
|
502
|
-
export interface
|
|
503
|
-
|
|
524
|
+
export interface GitToken {
|
|
525
|
+
token: string;
|
|
526
|
+
user: string;
|
|
527
|
+
scopes: string[];
|
|
504
528
|
}
|
|
505
529
|
|
|
506
|
-
export interface
|
|
507
|
-
|
|
530
|
+
export interface GuessedGitTokenScopes {
|
|
531
|
+
message?: string;
|
|
532
|
+
scopes?: string[];
|
|
508
533
|
}
|
|
509
534
|
|
|
510
|
-
export
|
|
511
|
-
|
|
512
|
-
export interface ResolvedPlugins {
|
|
513
|
-
[pluginId: string]: ResolvedPlugin | undefined
|
|
535
|
+
export interface VSCodeConfig {
|
|
536
|
+
extensions?: string[];
|
|
514
537
|
}
|
|
515
538
|
|
|
516
|
-
export interface
|
|
517
|
-
fullPluginName: string;
|
|
539
|
+
export interface RepositoryCloneInformation {
|
|
518
540
|
url: string;
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
export interface VSCodeConfig {
|
|
523
|
-
extensions?: string[];
|
|
541
|
+
checkoutLocation?: string;
|
|
524
542
|
}
|
|
525
543
|
|
|
526
544
|
export interface WorkspaceConfig {
|
|
545
|
+
mainConfiguration?: string;
|
|
546
|
+
additionalRepositories?: RepositoryCloneInformation[];
|
|
527
547
|
image?: ImageConfig;
|
|
528
548
|
ports?: PortConfig[];
|
|
529
549
|
tasks?: TaskConfig[];
|
|
@@ -532,16 +552,21 @@ export interface WorkspaceConfig {
|
|
|
532
552
|
gitConfig?: { [config: string]: string };
|
|
533
553
|
github?: GithubAppConfig;
|
|
534
554
|
vscode?: VSCodeConfig;
|
|
535
|
-
|
|
555
|
+
|
|
556
|
+
/** deprecated. Enabled by default **/
|
|
557
|
+
experimentalNetwork?: boolean;
|
|
558
|
+
|
|
536
559
|
/**
|
|
537
560
|
* Where the config object originates from.
|
|
538
|
-
*
|
|
561
|
+
*
|
|
539
562
|
* repo - from the repository
|
|
563
|
+
* project-db - from the "Project" stored in the database
|
|
540
564
|
* definitly-gp - from github.com/gitpod-io/definitely-gp
|
|
541
565
|
* derived - computed based on analyzing the repository
|
|
566
|
+
* additional-content - config comes from additional content, usually provided through the project's configuration
|
|
542
567
|
* default - our static catch-all default config
|
|
543
568
|
*/
|
|
544
|
-
_origin?:
|
|
569
|
+
_origin?: "repo" | "project-db" | "definitely-gp" | "derived" | "additional-content" | "default";
|
|
545
570
|
|
|
546
571
|
/**
|
|
547
572
|
* Set of automatically infered feature flags. That's not something the user can set, but
|
|
@@ -551,37 +576,33 @@ export interface WorkspaceConfig {
|
|
|
551
576
|
}
|
|
552
577
|
|
|
553
578
|
export interface GithubAppConfig {
|
|
554
|
-
prebuilds?: GithubAppPrebuildConfig
|
|
579
|
+
prebuilds?: GithubAppPrebuildConfig;
|
|
555
580
|
}
|
|
556
581
|
export interface GithubAppPrebuildConfig {
|
|
557
|
-
master?: boolean
|
|
558
|
-
branches?: boolean
|
|
559
|
-
pullRequests?: boolean
|
|
560
|
-
pullRequestsFromForks?: boolean
|
|
561
|
-
addCheck?: boolean
|
|
562
|
-
addBadge?: boolean
|
|
563
|
-
addLabel?: boolean | string
|
|
564
|
-
addComment?: boolean
|
|
582
|
+
master?: boolean;
|
|
583
|
+
branches?: boolean;
|
|
584
|
+
pullRequests?: boolean;
|
|
585
|
+
pullRequestsFromForks?: boolean;
|
|
586
|
+
addCheck?: boolean | "prevent-merge-on-error";
|
|
587
|
+
addBadge?: boolean;
|
|
588
|
+
addLabel?: boolean | string;
|
|
589
|
+
addComment?: boolean;
|
|
565
590
|
}
|
|
566
591
|
export namespace GithubAppPrebuildConfig {
|
|
567
592
|
export function is(obj: boolean | GithubAppPrebuildConfig): obj is GithubAppPrebuildConfig {
|
|
568
|
-
return !(typeof obj ===
|
|
593
|
+
return !(typeof obj === "boolean");
|
|
569
594
|
}
|
|
570
595
|
}
|
|
571
596
|
|
|
572
597
|
export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
|
|
573
598
|
export interface WorkspaceImageSourceDocker {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
dockerFileSource: Commit
|
|
578
|
-
dockerFilePath: string
|
|
599
|
+
dockerFilePath: string;
|
|
600
|
+
dockerFileHash: string;
|
|
601
|
+
dockerFileSource?: Commit;
|
|
579
602
|
}
|
|
580
603
|
export namespace WorkspaceImageSourceDocker {
|
|
581
604
|
export function is(obj: object): obj is WorkspaceImageSourceDocker {
|
|
582
|
-
return
|
|
583
|
-
&& 'dockerFileSource' in obj
|
|
584
|
-
&& 'dockerFilePath' in obj;
|
|
605
|
+
return "dockerFileHash" in obj && "dockerFilePath" in obj;
|
|
585
606
|
}
|
|
586
607
|
}
|
|
587
608
|
export interface WorkspaceImageSourceReference {
|
|
@@ -590,36 +611,41 @@ export interface WorkspaceImageSourceReference {
|
|
|
590
611
|
}
|
|
591
612
|
export namespace WorkspaceImageSourceReference {
|
|
592
613
|
export function is(obj: object): obj is WorkspaceImageSourceReference {
|
|
593
|
-
return
|
|
614
|
+
return "baseImageResolved" in obj;
|
|
594
615
|
}
|
|
595
616
|
}
|
|
596
617
|
|
|
597
|
-
export type PrebuiltWorkspaceState
|
|
618
|
+
export type PrebuiltWorkspaceState =
|
|
598
619
|
// the prebuild is queued and may start at anytime
|
|
599
|
-
|
|
620
|
+
| "queued"
|
|
600
621
|
// the workspace prebuild is currently running (i.e. there's a workspace pod deployed)
|
|
601
622
|
| "building"
|
|
602
|
-
// the prebuild
|
|
623
|
+
// the prebuild was aborted
|
|
603
624
|
| "aborted"
|
|
604
625
|
// the prebuild timed out
|
|
605
626
|
| "timeout"
|
|
606
|
-
// the prebuild has finished and a snapshot is available
|
|
607
|
-
| "available"
|
|
627
|
+
// the prebuild has finished (even if a headless task failed) and a snapshot is available
|
|
628
|
+
| "available"
|
|
629
|
+
// the prebuild (headless workspace) failed due to some system error
|
|
630
|
+
| "failed";
|
|
608
631
|
|
|
609
632
|
export interface PrebuiltWorkspace {
|
|
610
633
|
id: string;
|
|
611
634
|
cloneURL: string;
|
|
635
|
+
branch?: string;
|
|
636
|
+
projectId?: string;
|
|
612
637
|
commit: string;
|
|
613
638
|
buildWorkspaceId: string;
|
|
614
639
|
creationTime: string;
|
|
615
640
|
state: PrebuiltWorkspaceState;
|
|
641
|
+
statusVersion: number;
|
|
616
642
|
error?: string;
|
|
617
643
|
snapshot?: string;
|
|
618
644
|
}
|
|
619
645
|
|
|
620
646
|
export namespace PrebuiltWorkspace {
|
|
621
647
|
export function isDone(pws: PrebuiltWorkspace) {
|
|
622
|
-
return pws.state === "available" || pws.state === "timeout" ||
|
|
648
|
+
return pws.state === "available" || pws.state === "timeout" || pws.state === "aborted";
|
|
623
649
|
}
|
|
624
650
|
|
|
625
651
|
export function isAvailable(pws: PrebuiltWorkspace) {
|
|
@@ -638,27 +664,33 @@ export interface PrebuiltWorkspaceUpdatable {
|
|
|
638
664
|
repo: string;
|
|
639
665
|
isResolved: boolean;
|
|
640
666
|
installationId: string;
|
|
667
|
+
/**
|
|
668
|
+
* the commitSHA of the commit that triggered the prebuild
|
|
669
|
+
*/
|
|
670
|
+
commitSHA?: string;
|
|
641
671
|
issue?: string;
|
|
642
672
|
contextUrl?: string;
|
|
643
673
|
}
|
|
644
674
|
|
|
645
675
|
export interface WhitelistedRepository {
|
|
646
|
-
url: string
|
|
647
|
-
name: string
|
|
648
|
-
description?: string
|
|
649
|
-
avatar?: string
|
|
676
|
+
url: string;
|
|
677
|
+
name: string;
|
|
678
|
+
description?: string;
|
|
679
|
+
avatar?: string;
|
|
650
680
|
}
|
|
651
681
|
|
|
652
|
-
export type PortOnOpen =
|
|
682
|
+
export type PortOnOpen = "open-browser" | "open-preview" | "notify" | "ignore";
|
|
653
683
|
|
|
654
684
|
export interface PortConfig {
|
|
655
685
|
port: number;
|
|
656
686
|
onOpen?: PortOnOpen;
|
|
657
687
|
visibility?: PortVisibility;
|
|
688
|
+
description?: string;
|
|
689
|
+
name?: string;
|
|
658
690
|
}
|
|
659
691
|
export namespace PortConfig {
|
|
660
692
|
export function is(config: any): config is PortConfig {
|
|
661
|
-
return config &&
|
|
693
|
+
return config && "port" in config && typeof config.port === "number";
|
|
662
694
|
}
|
|
663
695
|
}
|
|
664
696
|
|
|
@@ -668,7 +700,7 @@ export interface PortRangeConfig {
|
|
|
668
700
|
}
|
|
669
701
|
export namespace PortRangeConfig {
|
|
670
702
|
export function is(config: any): config is PortRangeConfig {
|
|
671
|
-
return config &&
|
|
703
|
+
return config && "port" in config && (typeof config.port === "string" || config.port instanceof String);
|
|
672
704
|
}
|
|
673
705
|
}
|
|
674
706
|
|
|
@@ -678,33 +710,32 @@ export interface TaskConfig {
|
|
|
678
710
|
init?: string;
|
|
679
711
|
prebuild?: string;
|
|
680
712
|
command?: string;
|
|
681
|
-
env?: { [env: string]:
|
|
682
|
-
openIn?:
|
|
683
|
-
openMode?:
|
|
713
|
+
env?: { [env: string]: any };
|
|
714
|
+
openIn?: "bottom" | "main" | "left" | "right";
|
|
715
|
+
openMode?: "split-top" | "split-left" | "split-right" | "split-bottom" | "tab-before" | "tab-after";
|
|
684
716
|
}
|
|
685
717
|
|
|
686
718
|
export namespace TaskConfig {
|
|
687
719
|
export function is(config: any): config is TaskConfig {
|
|
688
|
-
return config
|
|
689
|
-
&& ('command' in config || 'init' in config || 'before' in config);
|
|
720
|
+
return config && ("command" in config || "init" in config || "before" in config);
|
|
690
721
|
}
|
|
691
722
|
}
|
|
692
723
|
|
|
693
724
|
export namespace WorkspaceImageBuild {
|
|
694
|
-
export type Phase =
|
|
725
|
+
export type Phase = "BaseImage" | "GitpodLayer" | "Error" | "Done";
|
|
695
726
|
export interface StateInfo {
|
|
696
|
-
phase: Phase
|
|
697
|
-
currentStep?: number
|
|
698
|
-
maxSteps?: number
|
|
727
|
+
phase: Phase;
|
|
728
|
+
currentStep?: number;
|
|
729
|
+
maxSteps?: number;
|
|
699
730
|
}
|
|
700
731
|
export interface LogContent {
|
|
701
|
-
text: string
|
|
702
|
-
upToLine?: number
|
|
703
|
-
isDiff?: boolean
|
|
732
|
+
text: string;
|
|
733
|
+
upToLine?: number;
|
|
734
|
+
isDiff?: boolean;
|
|
704
735
|
}
|
|
705
736
|
export type LogCallback = (info: StateInfo, content: LogContent | undefined) => void;
|
|
706
737
|
export namespace LogLine {
|
|
707
|
-
export const DELIMITER =
|
|
738
|
+
export const DELIMITER = "\r\n";
|
|
708
739
|
export const DELIMITER_REGEX = /\r?\n/;
|
|
709
740
|
}
|
|
710
741
|
}
|
|
@@ -713,20 +744,18 @@ export type ImageConfig = ImageConfigString | ImageConfigFile;
|
|
|
713
744
|
export type ImageConfigString = string;
|
|
714
745
|
export namespace ImageConfigString {
|
|
715
746
|
export function is(config: ImageConfig | undefined): config is ImageConfigString {
|
|
716
|
-
return typeof config ===
|
|
747
|
+
return typeof config === "string";
|
|
717
748
|
}
|
|
718
|
-
|
|
719
749
|
}
|
|
720
750
|
export interface ImageConfigFile {
|
|
721
751
|
// Path to the Dockerfile relative to repository root
|
|
722
|
-
file: string
|
|
752
|
+
file: string;
|
|
723
753
|
// Path to the docker build context relative to repository root
|
|
724
|
-
context?: string
|
|
754
|
+
context?: string;
|
|
725
755
|
}
|
|
726
756
|
export namespace ImageConfigFile {
|
|
727
757
|
export function is(config: ImageConfig | undefined): config is ImageConfigFile {
|
|
728
|
-
return typeof config ===
|
|
729
|
-
&& 'file' in config;
|
|
758
|
+
return typeof config === "object" && "file" in config;
|
|
730
759
|
}
|
|
731
760
|
}
|
|
732
761
|
export interface ExternalImageConfigFile extends ImageConfigFile {
|
|
@@ -734,22 +763,21 @@ export interface ExternalImageConfigFile extends ImageConfigFile {
|
|
|
734
763
|
}
|
|
735
764
|
export namespace ExternalImageConfigFile {
|
|
736
765
|
export function is(config: any | undefined): config is ExternalImageConfigFile {
|
|
737
|
-
return typeof config ===
|
|
738
|
-
&& 'file' in config
|
|
739
|
-
&& 'externalSource' in config;
|
|
766
|
+
return typeof config === "object" && "file" in config && "externalSource" in config;
|
|
740
767
|
}
|
|
741
768
|
}
|
|
742
769
|
|
|
743
770
|
export interface WorkspaceContext {
|
|
744
771
|
title: string;
|
|
772
|
+
/** This contains the URL portion of the contextURL (which might contain other modifiers as well). It's optional because it's not set for older workspaces. */
|
|
745
773
|
normalizedContextURL?: string;
|
|
746
774
|
forceCreateNewWorkspace?: boolean;
|
|
775
|
+
forceImageBuild?: boolean;
|
|
747
776
|
}
|
|
748
777
|
|
|
749
778
|
export namespace WorkspaceContext {
|
|
750
779
|
export function is(context: any): context is WorkspaceContext {
|
|
751
|
-
return context
|
|
752
|
-
&& 'title' in context;
|
|
780
|
+
return context && "title" in context;
|
|
753
781
|
}
|
|
754
782
|
}
|
|
755
783
|
|
|
@@ -758,22 +786,38 @@ export interface WithSnapshot {
|
|
|
758
786
|
}
|
|
759
787
|
export namespace WithSnapshot {
|
|
760
788
|
export function is(context: any): context is WithSnapshot {
|
|
761
|
-
return context
|
|
762
|
-
&& 'snapshotBucketId' in context;
|
|
789
|
+
return context && "snapshotBucketId" in context;
|
|
763
790
|
}
|
|
764
791
|
}
|
|
765
792
|
|
|
766
|
-
export interface WithPrebuild {
|
|
767
|
-
snapshotBucketId: string;
|
|
793
|
+
export interface WithPrebuild extends WithSnapshot {
|
|
768
794
|
prebuildWorkspaceId: string;
|
|
769
795
|
wasPrebuilt: true;
|
|
770
796
|
}
|
|
771
797
|
export namespace WithPrebuild {
|
|
772
798
|
export function is(context: any): context is WithPrebuild {
|
|
773
|
-
return context
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
799
|
+
return context && WithSnapshot.is(context) && "prebuildWorkspaceId" in context && "wasPrebuilt" in context;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* WithDefaultConfig contexts disable the download of the gitpod.yml from the repository
|
|
805
|
+
* and fall back to the built-in configuration.
|
|
806
|
+
*/
|
|
807
|
+
export interface WithDefaultConfig {
|
|
808
|
+
withDefaultConfig: true;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
export namespace WithDefaultConfig {
|
|
812
|
+
export function is(context: any): context is WithDefaultConfig {
|
|
813
|
+
return context && "withDefaultConfig" in context && context.withDefaultConfig;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
|
|
817
|
+
return {
|
|
818
|
+
...ctx,
|
|
819
|
+
withDefaultConfig: true,
|
|
820
|
+
};
|
|
777
821
|
}
|
|
778
822
|
}
|
|
779
823
|
|
|
@@ -783,20 +827,24 @@ export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
|
|
|
783
827
|
|
|
784
828
|
export namespace SnapshotContext {
|
|
785
829
|
export function is(context: any): context is SnapshotContext {
|
|
786
|
-
return context
|
|
787
|
-
&& WithSnapshot.is(context)
|
|
788
|
-
&& 'snapshotId' in context;
|
|
830
|
+
return context && WithSnapshot.is(context) && "snapshotId" in context;
|
|
789
831
|
}
|
|
790
832
|
}
|
|
791
833
|
|
|
792
834
|
export interface StartPrebuildContext extends WorkspaceContext {
|
|
793
835
|
actual: WorkspaceContext;
|
|
836
|
+
commitHistory?: string[];
|
|
837
|
+
additionalRepositoryCommitHistories?: {
|
|
838
|
+
cloneUrl: string;
|
|
839
|
+
commitHistory: string[];
|
|
840
|
+
}[];
|
|
841
|
+
project?: Project;
|
|
842
|
+
branch?: string;
|
|
794
843
|
}
|
|
795
844
|
|
|
796
845
|
export namespace StartPrebuildContext {
|
|
797
846
|
export function is(context: any): context is StartPrebuildContext {
|
|
798
|
-
return context
|
|
799
|
-
&& 'actual' in context;
|
|
847
|
+
return context && "actual" in context;
|
|
800
848
|
}
|
|
801
849
|
}
|
|
802
850
|
|
|
@@ -808,33 +856,39 @@ export interface PrebuiltWorkspaceContext extends WorkspaceContext {
|
|
|
808
856
|
|
|
809
857
|
export namespace PrebuiltWorkspaceContext {
|
|
810
858
|
export function is(context: any): context is PrebuiltWorkspaceContext {
|
|
811
|
-
return context
|
|
812
|
-
|
|
813
|
-
|
|
859
|
+
return context && "originalContext" in context && "prebuiltWorkspace" in context;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
export interface WithReferrerContext extends WorkspaceContext {
|
|
864
|
+
referrer: string;
|
|
865
|
+
referrerIde?: string;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
export namespace WithReferrerContext {
|
|
869
|
+
export function is(context: any): context is WithReferrerContext {
|
|
870
|
+
return context && "referrer" in context;
|
|
814
871
|
}
|
|
815
872
|
}
|
|
816
873
|
|
|
817
874
|
export interface WithEnvvarsContext extends WorkspaceContext {
|
|
818
|
-
envvars:
|
|
875
|
+
envvars: EnvVarWithValue[];
|
|
819
876
|
}
|
|
820
877
|
|
|
821
878
|
export namespace WithEnvvarsContext {
|
|
822
879
|
export function is(context: any): context is WithEnvvarsContext {
|
|
823
|
-
return context
|
|
824
|
-
&& 'envvars' in context
|
|
880
|
+
return context && "envvars" in context;
|
|
825
881
|
}
|
|
826
882
|
}
|
|
827
883
|
|
|
828
884
|
export interface WorkspaceProbeContext extends WorkspaceContext {
|
|
829
|
-
responseURL: string
|
|
830
|
-
responseToken: string
|
|
885
|
+
responseURL: string;
|
|
886
|
+
responseToken: string;
|
|
831
887
|
}
|
|
832
888
|
|
|
833
889
|
export namespace WorkspaceProbeContext {
|
|
834
890
|
export function is(context: any): context is WorkspaceProbeContext {
|
|
835
|
-
return context
|
|
836
|
-
&& 'responseURL' in context
|
|
837
|
-
&& 'responseToken' in context;
|
|
891
|
+
return context && "responseURL" in context && "responseToken" in context;
|
|
838
892
|
}
|
|
839
893
|
}
|
|
840
894
|
|
|
@@ -846,30 +900,80 @@ export namespace RefType {
|
|
|
846
900
|
}
|
|
847
901
|
// This fallback is meant to handle the cases where (for historic reasons) ref is present but refType is missing
|
|
848
902
|
return commit.refType || "branch";
|
|
849
|
-
}
|
|
903
|
+
};
|
|
850
904
|
}
|
|
851
905
|
|
|
852
906
|
export interface Commit {
|
|
853
|
-
repository: Repository
|
|
854
|
-
revision: string
|
|
907
|
+
repository: Repository;
|
|
908
|
+
revision: string;
|
|
855
909
|
|
|
856
910
|
// Might contain either a branch or a tag (determined by refType)
|
|
857
|
-
ref?: string
|
|
911
|
+
ref?: string;
|
|
858
912
|
|
|
859
913
|
// refType is only set if ref is present (and not for old workspaces, before this feature was added)
|
|
860
|
-
refType?: RefType
|
|
914
|
+
refType?: RefType;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
export interface AdditionalContentContext extends WorkspaceContext {
|
|
918
|
+
/**
|
|
919
|
+
* utf-8 encoded contents that will be copied on top of the workspace's filesystem
|
|
920
|
+
*/
|
|
921
|
+
additionalFiles: { [filePath: string]: string };
|
|
861
922
|
}
|
|
862
923
|
|
|
863
|
-
export
|
|
924
|
+
export namespace AdditionalContentContext {
|
|
925
|
+
export function is(ctx: any): ctx is AdditionalContentContext {
|
|
926
|
+
return "additionalFiles" in ctx;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
|
|
930
|
+
return is(ctx) && ImageConfigFile.is(config.image) && !!ctx.additionalFiles[config.image.file];
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
|
|
864
935
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
865
|
-
cloneUrl?: string
|
|
936
|
+
cloneUrl?: string;
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* The clone and checkout information for additional repositories in case of multi-repo projects.
|
|
940
|
+
*/
|
|
941
|
+
additionalRepositoryCheckoutInfo?: GitCheckoutInfo[];
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
export namespace CommitContext {
|
|
945
|
+
/**
|
|
946
|
+
* Creates a hash for all the commits of the CommitContext and all sub-repo commit infos.
|
|
947
|
+
* The hash is max 255 chars long.
|
|
948
|
+
* @param commitContext
|
|
949
|
+
* @returns hash for commitcontext
|
|
950
|
+
*/
|
|
951
|
+
export function computeHash(commitContext: CommitContext): string {
|
|
952
|
+
// for single commits we use the revision to be backward compatible.
|
|
953
|
+
if (
|
|
954
|
+
!commitContext.additionalRepositoryCheckoutInfo ||
|
|
955
|
+
commitContext.additionalRepositoryCheckoutInfo.length === 0
|
|
956
|
+
) {
|
|
957
|
+
return commitContext.revision;
|
|
958
|
+
}
|
|
959
|
+
const hasher = createHash("sha256");
|
|
960
|
+
hasher.update(commitContext.revision);
|
|
961
|
+
for (const info of commitContext.additionalRepositoryCheckoutInfo) {
|
|
962
|
+
hasher.update(info.revision);
|
|
963
|
+
}
|
|
964
|
+
return hasher.digest("hex");
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
export interface GitCheckoutInfo extends Commit {
|
|
969
|
+
checkoutLocation?: string;
|
|
970
|
+
upstreamRemoteURI?: string;
|
|
971
|
+
localBranch?: string;
|
|
866
972
|
}
|
|
867
973
|
|
|
868
974
|
export namespace CommitContext {
|
|
869
975
|
export function is(commit: any): commit is CommitContext {
|
|
870
|
-
return WorkspaceContext.is(commit)
|
|
871
|
-
&& 'repository' in commit
|
|
872
|
-
&& 'revision' in commit
|
|
976
|
+
return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
|
|
873
977
|
}
|
|
874
978
|
}
|
|
875
979
|
|
|
@@ -877,17 +981,14 @@ export interface PullRequestContext extends CommitContext {
|
|
|
877
981
|
nr: number;
|
|
878
982
|
ref: string;
|
|
879
983
|
base: {
|
|
880
|
-
repository: Repository
|
|
881
|
-
ref: string
|
|
882
|
-
}
|
|
984
|
+
repository: Repository;
|
|
985
|
+
ref: string;
|
|
986
|
+
};
|
|
883
987
|
}
|
|
884
988
|
|
|
885
989
|
export namespace PullRequestContext {
|
|
886
990
|
export function is(ctx: any): ctx is PullRequestContext {
|
|
887
|
-
return CommitContext.is(ctx)
|
|
888
|
-
&& 'nr' in ctx
|
|
889
|
-
&& 'ref' in ctx
|
|
890
|
-
&& 'base' in ctx
|
|
991
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
|
|
891
992
|
}
|
|
892
993
|
}
|
|
893
994
|
|
|
@@ -899,10 +1000,7 @@ export interface IssueContext extends CommitContext {
|
|
|
899
1000
|
|
|
900
1001
|
export namespace IssueContext {
|
|
901
1002
|
export function is(ctx: any): ctx is IssueContext {
|
|
902
|
-
return CommitContext.is(ctx)
|
|
903
|
-
&& 'nr' in ctx
|
|
904
|
-
&& 'ref' in ctx
|
|
905
|
-
&& 'localBranch' in ctx
|
|
1003
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
|
|
906
1004
|
}
|
|
907
1005
|
}
|
|
908
1006
|
|
|
@@ -913,9 +1011,7 @@ export interface NavigatorContext extends CommitContext {
|
|
|
913
1011
|
|
|
914
1012
|
export namespace NavigatorContext {
|
|
915
1013
|
export function is(ctx: any): ctx is NavigatorContext {
|
|
916
|
-
return CommitContext.is(ctx)
|
|
917
|
-
&& 'path' in ctx
|
|
918
|
-
&& 'isFile' in ctx
|
|
1014
|
+
return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
|
|
919
1015
|
}
|
|
920
1016
|
}
|
|
921
1017
|
|
|
@@ -924,6 +1020,8 @@ export interface Repository {
|
|
|
924
1020
|
owner: string;
|
|
925
1021
|
name: string;
|
|
926
1022
|
cloneUrl: string;
|
|
1023
|
+
/* Optional kind to differentiate between repositories of orgs/groups/projects and personal repos. */
|
|
1024
|
+
repoKind?: string;
|
|
927
1025
|
description?: string;
|
|
928
1026
|
avatarUrl?: string;
|
|
929
1027
|
webUrl?: string;
|
|
@@ -932,8 +1030,21 @@ export interface Repository {
|
|
|
932
1030
|
private?: boolean;
|
|
933
1031
|
fork?: {
|
|
934
1032
|
// The direct parent of this fork
|
|
935
|
-
parent: Repository
|
|
936
|
-
}
|
|
1033
|
+
parent: Repository;
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
export interface Branch {
|
|
1037
|
+
name: string;
|
|
1038
|
+
commit: CommitInfo;
|
|
1039
|
+
htmlUrl: string;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
export interface CommitInfo {
|
|
1043
|
+
author: string;
|
|
1044
|
+
sha: string;
|
|
1045
|
+
commitMessage: string;
|
|
1046
|
+
authorAvatarUrl?: string;
|
|
1047
|
+
authorDate?: string;
|
|
937
1048
|
}
|
|
938
1049
|
|
|
939
1050
|
export namespace Repository {
|
|
@@ -945,21 +1056,25 @@ export namespace Repository {
|
|
|
945
1056
|
export interface WorkspaceInstancePortsChangedEvent {
|
|
946
1057
|
type: "PortsChanged";
|
|
947
1058
|
instanceID: string;
|
|
948
|
-
portsOpened: number[]
|
|
949
|
-
portsClosed: number[]
|
|
1059
|
+
portsOpened: number[];
|
|
1060
|
+
portsClosed: number[];
|
|
950
1061
|
}
|
|
951
1062
|
|
|
952
1063
|
export namespace WorkspaceInstancePortsChangedEvent {
|
|
953
|
-
|
|
954
1064
|
export function is(data: any): data is WorkspaceInstancePortsChangedEvent {
|
|
955
1065
|
return data && data.type == "PortsChanged";
|
|
956
1066
|
}
|
|
957
|
-
|
|
958
1067
|
}
|
|
959
1068
|
|
|
960
1069
|
export interface WorkspaceInfo {
|
|
961
|
-
workspace: Workspace
|
|
962
|
-
latestInstance?: WorkspaceInstance
|
|
1070
|
+
workspace: Workspace;
|
|
1071
|
+
latestInstance?: WorkspaceInstance;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
export namespace WorkspaceInfo {
|
|
1075
|
+
export function lastActiveISODate(info: WorkspaceInfo): string {
|
|
1076
|
+
return info.latestInstance?.creationTime || info.workspace.creationTime;
|
|
1077
|
+
}
|
|
963
1078
|
}
|
|
964
1079
|
|
|
965
1080
|
export type RunningWorkspaceInfo = WorkspaceInfo & { latestInstance: WorkspaceInstance };
|
|
@@ -969,34 +1084,36 @@ export interface WorkspaceCreationResult {
|
|
|
969
1084
|
workspaceURL?: string;
|
|
970
1085
|
existingWorkspaces?: WorkspaceInfo[];
|
|
971
1086
|
runningWorkspacePrebuild?: {
|
|
972
|
-
prebuildID: string
|
|
973
|
-
workspaceID: string
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1087
|
+
prebuildID: string;
|
|
1088
|
+
workspaceID: string;
|
|
1089
|
+
instanceID: string;
|
|
1090
|
+
starting: RunningWorkspacePrebuildStarting;
|
|
1091
|
+
sameCluster: boolean;
|
|
1092
|
+
};
|
|
977
1093
|
runningPrebuildWorkspaceID?: string;
|
|
978
1094
|
}
|
|
979
|
-
export type RunningWorkspacePrebuildStarting =
|
|
1095
|
+
export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
|
|
980
1096
|
|
|
981
1097
|
export enum CreateWorkspaceMode {
|
|
982
1098
|
// Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
|
|
983
|
-
Default =
|
|
1099
|
+
Default = "default",
|
|
984
1100
|
// 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.
|
|
985
|
-
ForceNew =
|
|
1101
|
+
ForceNew = "force-new",
|
|
986
1102
|
// UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
|
|
987
|
-
UsePrebuild =
|
|
1103
|
+
UsePrebuild = "use-prebuild",
|
|
988
1104
|
// SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
|
|
989
|
-
SelectIfRunning =
|
|
1105
|
+
SelectIfRunning = "select-if-running",
|
|
990
1106
|
}
|
|
991
1107
|
|
|
992
1108
|
export namespace WorkspaceCreationResult {
|
|
993
1109
|
export function is(data: any): data is WorkspaceCreationResult {
|
|
994
|
-
return
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1110
|
+
return (
|
|
1111
|
+
data &&
|
|
1112
|
+
("createdWorkspaceId" in data ||
|
|
1113
|
+
"existingWorkspaces" in data ||
|
|
1114
|
+
"runningWorkspacePrebuild" in data ||
|
|
1115
|
+
"runningPrebuildWorkspaceID" in data)
|
|
1116
|
+
);
|
|
1000
1117
|
}
|
|
1001
1118
|
}
|
|
1002
1119
|
|
|
@@ -1030,6 +1147,12 @@ export interface AuthProviderInfo {
|
|
|
1030
1147
|
readonly default: string[];
|
|
1031
1148
|
readonly publicRepo: string[];
|
|
1032
1149
|
readonly privateRepo: string[];
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
export namespace AuthProviderInfo {
|
|
1154
|
+
export function isGitHubEnterprise(info?: AuthProviderInfo): boolean {
|
|
1155
|
+
return !!info && info.authProviderType === "GitHub" && info.host !== "github.com";
|
|
1033
1156
|
}
|
|
1034
1157
|
}
|
|
1035
1158
|
|
|
@@ -1042,6 +1165,8 @@ export interface AuthProviderEntry {
|
|
|
1042
1165
|
readonly status: AuthProviderEntry.Status;
|
|
1043
1166
|
|
|
1044
1167
|
readonly oauth: OAuth2Config;
|
|
1168
|
+
/** A random string that is to change whenever oauth changes (enforced on DB level) */
|
|
1169
|
+
readonly oauthRevision?: string;
|
|
1045
1170
|
}
|
|
1046
1171
|
|
|
1047
1172
|
export interface OAuth2Config {
|
|
@@ -1054,47 +1179,27 @@ export interface OAuth2Config {
|
|
|
1054
1179
|
readonly scopeSeparator?: string;
|
|
1055
1180
|
|
|
1056
1181
|
readonly settingsUrl?: string;
|
|
1057
|
-
readonly authorizationParams?: { [key: string]: string }
|
|
1182
|
+
readonly authorizationParams?: { [key: string]: string };
|
|
1058
1183
|
readonly configURL?: string;
|
|
1059
1184
|
}
|
|
1060
1185
|
|
|
1061
1186
|
export namespace AuthProviderEntry {
|
|
1062
1187
|
export type Type = "GitHub" | "GitLab" | string;
|
|
1063
1188
|
export type Status = "pending" | "verified";
|
|
1064
|
-
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
export
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
readonly ide?: {
|
|
1079
|
-
readonly logo: string;
|
|
1080
|
-
readonly showReleaseNotes: boolean;
|
|
1081
|
-
readonly helpMenu: Branding.Link[];
|
|
1082
|
-
}
|
|
1083
|
-
readonly links: {
|
|
1084
|
-
readonly header: Branding.Link[];
|
|
1085
|
-
readonly footer: Branding.Link[];
|
|
1086
|
-
readonly social: Branding.SocialLink[];
|
|
1087
|
-
readonly legal: Branding.Link[];
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
export namespace Branding {
|
|
1091
|
-
export interface Link {
|
|
1092
|
-
readonly name: string;
|
|
1093
|
-
readonly url: string;
|
|
1094
|
-
}
|
|
1095
|
-
export interface SocialLink {
|
|
1096
|
-
readonly type: string;
|
|
1097
|
-
readonly url: string;
|
|
1189
|
+
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & {
|
|
1190
|
+
clientId?: string;
|
|
1191
|
+
clientSecret?: string;
|
|
1192
|
+
};
|
|
1193
|
+
export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> &
|
|
1194
|
+
Pick<OAuth2Config, "clientId" | "clientSecret">;
|
|
1195
|
+
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
|
|
1196
|
+
return {
|
|
1197
|
+
...entry,
|
|
1198
|
+
oauth: {
|
|
1199
|
+
...entry.oauth,
|
|
1200
|
+
clientSecret: "redacted",
|
|
1201
|
+
},
|
|
1202
|
+
};
|
|
1098
1203
|
}
|
|
1099
1204
|
}
|
|
1100
1205
|
|