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