@gitpod/gitpod-protocol 0.1.5-tarun-telemetry-users.9 → 0.1.5-team-conns.1
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 +28 -2
- package/lib/accounting-protocol.d.ts +10 -10
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +22 -31
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +4 -2
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +4 -5
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/auth.d.ts.map +1 -1
- package/lib/connections.d.ts +14 -0
- package/lib/connections.d.ts.map +1 -0
- package/lib/{theia-plugins.js → connections.js} +2 -2
- package/lib/connections.js.map +1 -0
- package/lib/context-url.d.ts +17 -5
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +57 -6
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +2 -0
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +40 -4
- package/lib/context-url.spec.js.map +1 -1
- package/lib/email-protocol.d.ts +1 -1
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +1 -1
- 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 +7 -7
- 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 +2 -3
- 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 +1 -1
- 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 +7 -9
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +1 -1
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +5 -5
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +6 -6
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +42 -39
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +28 -24
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +21 -24
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +1 -0
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +2 -1
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +1 -1
- package/lib/ide-protocol.d.ts +10 -6
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/index.d.ts +17 -16
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +1 -1
- package/lib/installation-admin-protocol.d.ts.map +1 -1
- package/lib/installation-admin-protocol.js +2 -2
- package/lib/installation-admin-protocol.js.map +1 -1
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +1 -1
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +19 -19
- 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 +9 -6
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +2 -2
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +20 -20
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.js +8 -8
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +1 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +7 -9
- package/lib/messaging/proxy-factory.js.map +1 -1
- 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 +5 -2
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +30 -25
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +3 -3
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +206 -171
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +51 -37
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +81 -86
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.spec.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +5 -3
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +4 -4
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +3 -3
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +1 -1
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +12 -3
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +3 -3
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +6 -6
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +2 -2
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +5 -3
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +1 -1
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +435 -435
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +10 -6
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +1 -1
- package/lib/util/gitpod-cookie.d.ts.map +1 -1
- package/lib/util/gitpod-cookie.js +0 -3
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +31 -29
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +15 -5
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/jaeger-client-types.d.ts.map +1 -1
- package/lib/util/logging.d.ts +1 -1
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +22 -23
- 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.map +1 -1
- package/lib/util/parse-workspace-id.js +1 -2
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.spec.js +9 -6
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +2 -2
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +8 -8
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +19 -18
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.js +3 -3
- package/lib/util/tracing.spec.js.map +1 -1
- 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 +8 -11
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +8 -3
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +16 -1
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +2 -2
- 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 +2 -2
- package/pkg-yarn.lock +2 -2
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +53 -51
- package/src/admin-protocol.ts +25 -21
- package/src/analytics.ts +26 -28
- package/src/auth.ts +2 -2
- package/src/connections.ts +16 -0
- package/src/context-url.spec.ts +37 -9
- package/src/context-url.ts +96 -40
- package/src/email-protocol.ts +5 -6
- 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 +9 -9
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +129 -99
- package/src/headless-workspace-log.ts +6 -4
- package/src/ide-frontend-service.ts +2 -2
- package/src/ide-protocol.ts +13 -8
- package/src/index.ts +17 -16
- package/src/installation-admin-protocol.ts +9 -9
- package/src/license-protocol.ts +5 -6
- package/src/messaging/browser/connection.ts +45 -47
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +70 -71
- package/src/messaging/error.ts +1 -3
- package/src/messaging/handler.ts +6 -6
- package/src/messaging/node/connection.ts +8 -8
- package/src/messaging/proxy-factory.ts +23 -30
- package/src/oss-allowlist.ts +3 -3
- package/src/payment-protocol.ts +2 -2
- package/src/permission.ts +35 -32
- package/src/plans.ts +236 -189
- package/src/protocol.ts +232 -238
- package/src/snapshot-url.spec.ts +9 -7
- package/src/team-subscription-protocol.ts +33 -23
- package/src/teams-projects-protocol.ts +8 -8
- package/src/typings/globals.ts +4 -4
- package/src/util/analytics.ts +46 -24
- 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 +3 -6
- package/src/util/generate-workspace-id.spec.ts +18 -15
- package/src/util/generate-workspace-id.ts +453 -453
- package/src/util/gitpod-cookie.ts +8 -9
- package/src/util/gitpod-host-url.spec.ts +40 -13
- package/src/util/gitpod-host-url.ts +37 -34
- package/src/util/grpc.ts +1 -1
- package/src/util/jaeger-client-types.ts +2 -2
- package/src/util/logging.ts +49 -39
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +17 -8
- package/src/util/parse-workspace-id.ts +5 -6
- package/src/util/queue.spec.ts +27 -25
- package/src/util/repeat.ts +1 -1
- package/src/util/semaphore.ts +4 -6
- package/src/util/skip-if.ts +9 -6
- package/src/util/timeutil.spec.ts +14 -15
- package/src/util/timeutil.ts +15 -11
- package/src/util/tracing.spec.ts +28 -23
- package/src/util/tracing.ts +58 -52
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/workspace-cluster.ts +24 -8
- package/src/workspace-instance.ts +27 -23
- 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 -34
- 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/src/messaging/connection-error-handler.ts +0 -62
- package/src/theia-plugins.ts +0 -11
package/src/protocol.ts
CHANGED
|
@@ -7,26 +7,27 @@
|
|
|
7
7
|
import { WorkspaceInstance, PortVisibility } from "./workspace-instance";
|
|
8
8
|
import { RoleOrPermission } from "./permission";
|
|
9
9
|
import { Project } from "./teams-projects-protocol";
|
|
10
|
+
import { createHash } from "crypto";
|
|
10
11
|
|
|
11
12
|
export interface UserInfo {
|
|
12
|
-
name?: string
|
|
13
|
+
name?: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export interface User {
|
|
16
17
|
/** The user id */
|
|
17
|
-
id: string
|
|
18
|
+
id: string;
|
|
18
19
|
|
|
19
20
|
/** The timestamp when the user entry was created */
|
|
20
|
-
creationDate: string
|
|
21
|
+
creationDate: string;
|
|
21
22
|
|
|
22
|
-
avatarUrl?: string
|
|
23
|
+
avatarUrl?: string;
|
|
23
24
|
|
|
24
|
-
name?: string
|
|
25
|
+
name?: string;
|
|
25
26
|
|
|
26
27
|
/** Optional for backwards compatibility */
|
|
27
|
-
fullName?: string
|
|
28
|
+
fullName?: string;
|
|
28
29
|
|
|
29
|
-
identities: Identity[]
|
|
30
|
+
identities: Identity[];
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Whether the user has been blocked to use our service, because of TOS violation for example.
|
|
@@ -48,29 +49,27 @@ export interface User {
|
|
|
48
49
|
|
|
49
50
|
export namespace User {
|
|
50
51
|
export function is(data: any): data is User {
|
|
51
|
-
return data
|
|
52
|
-
&& data.hasOwnProperty('id')
|
|
53
|
-
&& data.hasOwnProperty('identities')
|
|
52
|
+
return data && data.hasOwnProperty("id") && data.hasOwnProperty("identities");
|
|
54
53
|
}
|
|
55
54
|
export function getIdentity(user: User, authProviderId: string): Identity | undefined {
|
|
56
|
-
return user.identities.find(id => id.authProviderId === authProviderId);
|
|
55
|
+
return user.identities.find((id) => id.authProviderId === authProviderId);
|
|
57
56
|
}
|
|
58
57
|
export function censor(user: User): User {
|
|
59
58
|
const res = { ...user };
|
|
60
|
-
delete
|
|
61
|
-
res.identities = res.identities.map(i => {
|
|
62
|
-
delete
|
|
59
|
+
delete res.additionalData;
|
|
60
|
+
res.identities = res.identities.map((i) => {
|
|
61
|
+
delete i.tokens;
|
|
63
62
|
|
|
64
63
|
// The user field is not in the Identity shape, but actually exists on DBIdentity.
|
|
65
64
|
// Trying to push this object out via JSON RPC will fail because of the cyclic nature
|
|
66
65
|
// of this field.
|
|
67
|
-
delete (
|
|
66
|
+
delete (i as any).user;
|
|
68
67
|
return i;
|
|
69
68
|
});
|
|
70
69
|
return res;
|
|
71
70
|
}
|
|
72
71
|
export function getPrimaryEmail(user: User): string {
|
|
73
|
-
const identities = user.identities.filter(i => !!i.primaryEmail);
|
|
72
|
+
const identities = user.identities.filter((i) => !!i.primaryEmail);
|
|
74
73
|
if (identities.length <= 0) {
|
|
75
74
|
throw new Error(`No identity with primary email for user: ${user.id}!`);
|
|
76
75
|
}
|
|
@@ -98,10 +97,10 @@ export interface AdditionalUserData {
|
|
|
98
97
|
featurePreview?: boolean;
|
|
99
98
|
ideSettings?: IDESettings;
|
|
100
99
|
// key is the name of the news, string the iso date when it was seen
|
|
101
|
-
whatsNewSeen?: { [key: string]: string }
|
|
100
|
+
whatsNewSeen?: { [key: string]: string };
|
|
102
101
|
// key is the name of the OAuth client i.e. local app, string the iso date when it was approved
|
|
103
102
|
// TODO(rl): provide a management UX to allow rescinding of approval
|
|
104
|
-
oauthClientsApproved?: { [key: string]: string }
|
|
103
|
+
oauthClientsApproved?: { [key: string]: string };
|
|
105
104
|
// to remember GH Orgs the user installed/updated the GH App for
|
|
106
105
|
knownGitHubOrgs?: string[];
|
|
107
106
|
|
|
@@ -116,10 +115,11 @@ export interface EmailNotificationSettings {
|
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
export type IDESettings = {
|
|
119
|
-
defaultIde?: string
|
|
120
|
-
useDesktopIde?: boolean
|
|
121
|
-
defaultDesktopIde?: string
|
|
122
|
-
|
|
118
|
+
defaultIde?: string;
|
|
119
|
+
useDesktopIde?: boolean;
|
|
120
|
+
defaultDesktopIde?: string;
|
|
121
|
+
useLatestVersion?: boolean;
|
|
122
|
+
};
|
|
123
123
|
|
|
124
124
|
export interface UserPlatform {
|
|
125
125
|
uid: string;
|
|
@@ -151,8 +151,8 @@ 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
|
-
export type NamedWorkspaceFeatureFlag = keyof
|
|
154
|
+
export const WorkspaceFeatureFlags = { full_workspace_backup: undefined, fixed_resources: undefined };
|
|
155
|
+
export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
|
|
156
156
|
|
|
157
157
|
export interface EnvVarWithValue {
|
|
158
158
|
name: string;
|
|
@@ -165,7 +165,7 @@ export interface ProjectEnvVarWithValue extends EnvVarWithValue {
|
|
|
165
165
|
censored: boolean;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
export type ProjectEnvVar = Omit<ProjectEnvVarWithValue,
|
|
168
|
+
export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, "value">;
|
|
169
169
|
|
|
170
170
|
export interface UserEnvVarValue extends EnvVarWithValue {
|
|
171
171
|
id?: string;
|
|
@@ -178,7 +178,6 @@ export interface UserEnvVar extends UserEnvVarValue {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
export namespace UserEnvVar {
|
|
181
|
-
|
|
182
181
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
183
182
|
export function normalizeRepoPattern(pattern: string) {
|
|
184
183
|
return pattern.toLocaleLowerCase();
|
|
@@ -198,7 +197,7 @@ export namespace UserEnvVar {
|
|
|
198
197
|
if (repoPattern == "*") {
|
|
199
198
|
score += 1;
|
|
200
199
|
}
|
|
201
|
-
if (ownerPattern ==
|
|
200
|
+
if (ownerPattern == "*") {
|
|
202
201
|
score += 2;
|
|
203
202
|
}
|
|
204
203
|
if (ownerPattern == "#" || repoPattern == "#") {
|
|
@@ -209,20 +208,20 @@ export namespace UserEnvVar {
|
|
|
209
208
|
|
|
210
209
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
211
210
|
export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
|
|
212
|
-
let result = vars.filter(e => {
|
|
211
|
+
let result = vars.filter((e) => {
|
|
213
212
|
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
214
|
-
if (ownerPattern !==
|
|
213
|
+
if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
|
|
215
214
|
return false;
|
|
216
215
|
}
|
|
217
|
-
if (repoPattern !==
|
|
216
|
+
if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
|
|
218
217
|
return false;
|
|
219
218
|
}
|
|
220
219
|
return true;
|
|
221
220
|
});
|
|
222
221
|
|
|
223
222
|
const resmap = new Map<string, T[]>();
|
|
224
|
-
result.forEach(e => {
|
|
225
|
-
const l =
|
|
223
|
+
result.forEach((e) => {
|
|
224
|
+
const l = resmap.get(e.name) || [];
|
|
226
225
|
l.push(e);
|
|
227
226
|
resmap.set(e.name, l);
|
|
228
227
|
});
|
|
@@ -257,46 +256,45 @@ export namespace UserEnvVar {
|
|
|
257
256
|
|
|
258
257
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
259
258
|
export function splitRepositoryPattern(repositoryPattern: string): string[] {
|
|
260
|
-
const patterns = repositoryPattern.split(
|
|
261
|
-
const repoPattern = patterns.slice(1).join(
|
|
259
|
+
const patterns = repositoryPattern.split("/");
|
|
260
|
+
const repoPattern = patterns.slice(1).join("/");
|
|
262
261
|
const ownerPattern = patterns[0];
|
|
263
262
|
return [ownerPattern, repoPattern];
|
|
264
263
|
}
|
|
265
264
|
}
|
|
266
265
|
|
|
267
266
|
export interface GitpodToken {
|
|
268
|
-
|
|
269
267
|
/** Hash value (SHA256) of the token (primary key). */
|
|
270
|
-
tokenHash: string
|
|
268
|
+
tokenHash: string;
|
|
271
269
|
|
|
272
270
|
/** Human readable name of the token */
|
|
273
|
-
name?: string
|
|
271
|
+
name?: string;
|
|
274
272
|
|
|
275
273
|
/** Token kind */
|
|
276
|
-
type: GitpodTokenType
|
|
274
|
+
type: GitpodTokenType;
|
|
277
275
|
|
|
278
276
|
/** The user the token belongs to. */
|
|
279
|
-
user: User
|
|
277
|
+
user: User;
|
|
280
278
|
|
|
281
279
|
/** Scopes (e.g. limition to read-only) */
|
|
282
|
-
scopes: string[]
|
|
280
|
+
scopes: string[];
|
|
283
281
|
|
|
284
282
|
/** Created timestamp */
|
|
285
|
-
created: string
|
|
283
|
+
created: string;
|
|
286
284
|
|
|
287
285
|
// token is deleted on the database and about to be collected by db-sync
|
|
288
|
-
deleted?: boolean
|
|
286
|
+
deleted?: boolean;
|
|
289
287
|
}
|
|
290
288
|
|
|
291
289
|
export enum GitpodTokenType {
|
|
292
290
|
API_AUTH_TOKEN = 0,
|
|
293
|
-
MACHINE_AUTH_TOKEN = 1
|
|
291
|
+
MACHINE_AUTH_TOKEN = 1,
|
|
294
292
|
}
|
|
295
293
|
|
|
296
294
|
export interface OneTimeSecret {
|
|
297
|
-
id: string
|
|
295
|
+
id: string;
|
|
298
296
|
|
|
299
|
-
value: string
|
|
297
|
+
value: string;
|
|
300
298
|
|
|
301
299
|
expirationTime: string;
|
|
302
300
|
|
|
@@ -328,13 +326,12 @@ export type IdentityLookup = Pick<Identity, "authProviderId" | "authId">;
|
|
|
328
326
|
|
|
329
327
|
export namespace Identity {
|
|
330
328
|
export function is(data: any): data is Identity {
|
|
331
|
-
return
|
|
332
|
-
&& data.hasOwnProperty(
|
|
333
|
-
|
|
329
|
+
return (
|
|
330
|
+
data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName")
|
|
331
|
+
);
|
|
334
332
|
}
|
|
335
333
|
export function equals(id1: IdentityLookup, id2: IdentityLookup) {
|
|
336
|
-
return id1.authProviderId === id2.authProviderId
|
|
337
|
-
&& id1.authId === id2.authId
|
|
334
|
+
return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
|
|
338
335
|
}
|
|
339
336
|
}
|
|
340
337
|
|
|
@@ -398,7 +395,7 @@ export interface Snapshot {
|
|
|
398
395
|
message?: string;
|
|
399
396
|
}
|
|
400
397
|
|
|
401
|
-
export type SnapshotState =
|
|
398
|
+
export type SnapshotState = "pending" | "available" | "error";
|
|
402
399
|
|
|
403
400
|
export interface LayoutData {
|
|
404
401
|
workspaceId: string;
|
|
@@ -427,13 +424,13 @@ export interface Workspace {
|
|
|
427
424
|
* The resolved, fix name of the workspace image. We only use this
|
|
428
425
|
* to access the logs during an image build.
|
|
429
426
|
*/
|
|
430
|
-
imageNameResolved?: string
|
|
427
|
+
imageNameResolved?: string;
|
|
431
428
|
|
|
432
429
|
/**
|
|
433
430
|
* The resolved/built fixed named of the base image. This field is only set if the workspace
|
|
434
431
|
* already has its base image built.
|
|
435
432
|
*/
|
|
436
|
-
baseImageNameResolved?: string
|
|
433
|
+
baseImageNameResolved?: string;
|
|
437
434
|
|
|
438
435
|
shareable?: boolean;
|
|
439
436
|
pinned?: boolean;
|
|
@@ -470,17 +467,16 @@ export type WorkspaceSoftDeletion = "user" | "gc";
|
|
|
470
467
|
export type WorkspaceType = "regular" | "prebuild" | "probe";
|
|
471
468
|
|
|
472
469
|
export namespace Workspace {
|
|
473
|
-
|
|
474
470
|
export function getFullRepositoryName(ws: Workspace): string | undefined {
|
|
475
471
|
if (CommitContext.is(ws.context)) {
|
|
476
|
-
return ws.context.repository.owner +
|
|
472
|
+
return ws.context.repository.owner + "/" + ws.context.repository.name;
|
|
477
473
|
}
|
|
478
474
|
return undefined;
|
|
479
475
|
}
|
|
480
476
|
|
|
481
477
|
export function getFullRepositoryUrl(ws: Workspace): string | undefined {
|
|
482
478
|
if (CommitContext.is(ws.context)) {
|
|
483
|
-
return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}
|
|
479
|
+
return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`;
|
|
484
480
|
}
|
|
485
481
|
return undefined;
|
|
486
482
|
}
|
|
@@ -514,59 +510,36 @@ export namespace Workspace {
|
|
|
514
510
|
}
|
|
515
511
|
}
|
|
516
512
|
|
|
517
|
-
export interface PreparePluginUploadParams {
|
|
518
|
-
fullPluginName: string;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
export interface ResolvePluginsParams {
|
|
522
|
-
config?: WorkspaceConfig
|
|
523
|
-
builtins?: ResolvedPlugins
|
|
524
|
-
vsxRegistryUrl?: string
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
export interface InstallPluginsParams {
|
|
528
|
-
pluginIds: string[]
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
export interface UninstallPluginParams {
|
|
532
|
-
pluginId: string;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
513
|
export interface GuessGitTokenScopesParams {
|
|
536
|
-
host: string
|
|
537
|
-
repoUrl: string
|
|
538
|
-
|
|
539
|
-
currentToken: GitToken
|
|
514
|
+
host: string;
|
|
515
|
+
repoUrl: string;
|
|
516
|
+
gitCommand: string;
|
|
517
|
+
currentToken: GitToken;
|
|
540
518
|
}
|
|
541
519
|
|
|
542
520
|
export interface GitToken {
|
|
543
|
-
token: string
|
|
544
|
-
user: string
|
|
545
|
-
scopes: string[]
|
|
521
|
+
token: string;
|
|
522
|
+
user: string;
|
|
523
|
+
scopes: string[];
|
|
546
524
|
}
|
|
547
525
|
|
|
548
526
|
export interface GuessedGitTokenScopes {
|
|
549
|
-
message?: string
|
|
550
|
-
scopes?: string[]
|
|
527
|
+
message?: string;
|
|
528
|
+
scopes?: string[];
|
|
551
529
|
}
|
|
552
530
|
|
|
553
|
-
export
|
|
554
|
-
|
|
555
|
-
export interface ResolvedPlugins {
|
|
556
|
-
[pluginId: string]: ResolvedPlugin | undefined
|
|
531
|
+
export interface VSCodeConfig {
|
|
532
|
+
extensions?: string[];
|
|
557
533
|
}
|
|
558
534
|
|
|
559
|
-
export interface
|
|
560
|
-
fullPluginName: string;
|
|
535
|
+
export interface RepositoryCloneInformation {
|
|
561
536
|
url: string;
|
|
562
|
-
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
export interface VSCodeConfig {
|
|
566
|
-
extensions?: string[];
|
|
537
|
+
checkoutLocation?: string;
|
|
567
538
|
}
|
|
568
539
|
|
|
569
540
|
export interface WorkspaceConfig {
|
|
541
|
+
mainConfiguration?: string;
|
|
542
|
+
additionalRepositories?: RepositoryCloneInformation[];
|
|
570
543
|
image?: ImageConfig;
|
|
571
544
|
ports?: PortConfig[];
|
|
572
545
|
tasks?: TaskConfig[];
|
|
@@ -589,7 +562,7 @@ export interface WorkspaceConfig {
|
|
|
589
562
|
* additional-content - config comes from additional content, usually provided through the project's configuration
|
|
590
563
|
* default - our static catch-all default config
|
|
591
564
|
*/
|
|
592
|
-
_origin?:
|
|
565
|
+
_origin?: "repo" | "project-db" | "definitely-gp" | "derived" | "additional-content" | "default";
|
|
593
566
|
|
|
594
567
|
/**
|
|
595
568
|
* Set of automatically infered feature flags. That's not something the user can set, but
|
|
@@ -599,34 +572,33 @@ export interface WorkspaceConfig {
|
|
|
599
572
|
}
|
|
600
573
|
|
|
601
574
|
export interface GithubAppConfig {
|
|
602
|
-
prebuilds?: GithubAppPrebuildConfig
|
|
575
|
+
prebuilds?: GithubAppPrebuildConfig;
|
|
603
576
|
}
|
|
604
577
|
export interface GithubAppPrebuildConfig {
|
|
605
|
-
master?: boolean
|
|
606
|
-
branches?: boolean
|
|
607
|
-
pullRequests?: boolean
|
|
608
|
-
pullRequestsFromForks?: boolean
|
|
609
|
-
addCheck?: boolean |
|
|
610
|
-
addBadge?: boolean
|
|
611
|
-
addLabel?: boolean | string
|
|
612
|
-
addComment?: boolean
|
|
578
|
+
master?: boolean;
|
|
579
|
+
branches?: boolean;
|
|
580
|
+
pullRequests?: boolean;
|
|
581
|
+
pullRequestsFromForks?: boolean;
|
|
582
|
+
addCheck?: boolean | "prevent-merge-on-error";
|
|
583
|
+
addBadge?: boolean;
|
|
584
|
+
addLabel?: boolean | string;
|
|
585
|
+
addComment?: boolean;
|
|
613
586
|
}
|
|
614
587
|
export namespace GithubAppPrebuildConfig {
|
|
615
588
|
export function is(obj: boolean | GithubAppPrebuildConfig): obj is GithubAppPrebuildConfig {
|
|
616
|
-
return !(typeof obj ===
|
|
589
|
+
return !(typeof obj === "boolean");
|
|
617
590
|
}
|
|
618
591
|
}
|
|
619
592
|
|
|
620
593
|
export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
|
|
621
594
|
export interface WorkspaceImageSourceDocker {
|
|
622
|
-
dockerFilePath: string
|
|
623
|
-
dockerFileHash: string
|
|
624
|
-
dockerFileSource?: Commit
|
|
595
|
+
dockerFilePath: string;
|
|
596
|
+
dockerFileHash: string;
|
|
597
|
+
dockerFileSource?: Commit;
|
|
625
598
|
}
|
|
626
599
|
export namespace WorkspaceImageSourceDocker {
|
|
627
600
|
export function is(obj: object): obj is WorkspaceImageSourceDocker {
|
|
628
|
-
return
|
|
629
|
-
&& 'dockerFilePath' in obj;
|
|
601
|
+
return "dockerFileHash" in obj && "dockerFilePath" in obj;
|
|
630
602
|
}
|
|
631
603
|
}
|
|
632
604
|
export interface WorkspaceImageSourceReference {
|
|
@@ -635,21 +607,23 @@ export interface WorkspaceImageSourceReference {
|
|
|
635
607
|
}
|
|
636
608
|
export namespace WorkspaceImageSourceReference {
|
|
637
609
|
export function is(obj: object): obj is WorkspaceImageSourceReference {
|
|
638
|
-
return
|
|
610
|
+
return "baseImageResolved" in obj;
|
|
639
611
|
}
|
|
640
612
|
}
|
|
641
613
|
|
|
642
|
-
export type PrebuiltWorkspaceState
|
|
614
|
+
export type PrebuiltWorkspaceState =
|
|
643
615
|
// the prebuild is queued and may start at anytime
|
|
644
|
-
|
|
616
|
+
| "queued"
|
|
645
617
|
// the workspace prebuild is currently running (i.e. there's a workspace pod deployed)
|
|
646
618
|
| "building"
|
|
647
|
-
// the prebuild
|
|
619
|
+
// the prebuild was aborted
|
|
648
620
|
| "aborted"
|
|
649
621
|
// the prebuild timed out
|
|
650
622
|
| "timeout"
|
|
651
|
-
// the prebuild has finished and a snapshot is available
|
|
652
|
-
| "available"
|
|
623
|
+
// the prebuild has finished (even if a headless task failed) and a snapshot is available
|
|
624
|
+
| "available"
|
|
625
|
+
// the prebuild (headless workspace) failed due to some system error
|
|
626
|
+
| "failed";
|
|
653
627
|
|
|
654
628
|
export interface PrebuiltWorkspace {
|
|
655
629
|
id: string;
|
|
@@ -666,7 +640,7 @@ export interface PrebuiltWorkspace {
|
|
|
666
640
|
|
|
667
641
|
export namespace PrebuiltWorkspace {
|
|
668
642
|
export function isDone(pws: PrebuiltWorkspace) {
|
|
669
|
-
return pws.state === "available" || pws.state === "timeout" || pws.state ===
|
|
643
|
+
return pws.state === "available" || pws.state === "timeout" || pws.state === "aborted";
|
|
670
644
|
}
|
|
671
645
|
|
|
672
646
|
export function isAvailable(pws: PrebuiltWorkspace) {
|
|
@@ -685,18 +659,22 @@ export interface PrebuiltWorkspaceUpdatable {
|
|
|
685
659
|
repo: string;
|
|
686
660
|
isResolved: boolean;
|
|
687
661
|
installationId: string;
|
|
662
|
+
/**
|
|
663
|
+
* the commitSHA of the commit that triggered the prebuild
|
|
664
|
+
*/
|
|
665
|
+
commitSHA?: string;
|
|
688
666
|
issue?: string;
|
|
689
667
|
contextUrl?: string;
|
|
690
668
|
}
|
|
691
669
|
|
|
692
670
|
export interface WhitelistedRepository {
|
|
693
|
-
url: string
|
|
694
|
-
name: string
|
|
695
|
-
description?: string
|
|
696
|
-
avatar?: string
|
|
671
|
+
url: string;
|
|
672
|
+
name: string;
|
|
673
|
+
description?: string;
|
|
674
|
+
avatar?: string;
|
|
697
675
|
}
|
|
698
676
|
|
|
699
|
-
export type PortOnOpen =
|
|
677
|
+
export type PortOnOpen = "open-browser" | "open-preview" | "notify" | "ignore";
|
|
700
678
|
|
|
701
679
|
export interface PortConfig {
|
|
702
680
|
port: number;
|
|
@@ -707,7 +685,7 @@ export interface PortConfig {
|
|
|
707
685
|
}
|
|
708
686
|
export namespace PortConfig {
|
|
709
687
|
export function is(config: any): config is PortConfig {
|
|
710
|
-
return config &&
|
|
688
|
+
return config && "port" in config && typeof config.port === "number";
|
|
711
689
|
}
|
|
712
690
|
}
|
|
713
691
|
|
|
@@ -717,7 +695,7 @@ export interface PortRangeConfig {
|
|
|
717
695
|
}
|
|
718
696
|
export namespace PortRangeConfig {
|
|
719
697
|
export function is(config: any): config is PortRangeConfig {
|
|
720
|
-
return config &&
|
|
698
|
+
return config && "port" in config && (typeof config.port === "string" || config.port instanceof String);
|
|
721
699
|
}
|
|
722
700
|
}
|
|
723
701
|
|
|
@@ -728,32 +706,31 @@ export interface TaskConfig {
|
|
|
728
706
|
prebuild?: string;
|
|
729
707
|
command?: string;
|
|
730
708
|
env?: { [env: string]: any };
|
|
731
|
-
openIn?:
|
|
732
|
-
openMode?:
|
|
709
|
+
openIn?: "bottom" | "main" | "left" | "right";
|
|
710
|
+
openMode?: "split-top" | "split-left" | "split-right" | "split-bottom" | "tab-before" | "tab-after";
|
|
733
711
|
}
|
|
734
712
|
|
|
735
713
|
export namespace TaskConfig {
|
|
736
714
|
export function is(config: any): config is TaskConfig {
|
|
737
|
-
return config
|
|
738
|
-
&& ('command' in config || 'init' in config || 'before' in config);
|
|
715
|
+
return config && ("command" in config || "init" in config || "before" in config);
|
|
739
716
|
}
|
|
740
717
|
}
|
|
741
718
|
|
|
742
719
|
export namespace WorkspaceImageBuild {
|
|
743
|
-
export type Phase =
|
|
720
|
+
export type Phase = "BaseImage" | "GitpodLayer" | "Error" | "Done";
|
|
744
721
|
export interface StateInfo {
|
|
745
|
-
phase: Phase
|
|
746
|
-
currentStep?: number
|
|
747
|
-
maxSteps?: number
|
|
722
|
+
phase: Phase;
|
|
723
|
+
currentStep?: number;
|
|
724
|
+
maxSteps?: number;
|
|
748
725
|
}
|
|
749
726
|
export interface LogContent {
|
|
750
|
-
text: string
|
|
751
|
-
upToLine?: number
|
|
752
|
-
isDiff?: boolean
|
|
727
|
+
text: string;
|
|
728
|
+
upToLine?: number;
|
|
729
|
+
isDiff?: boolean;
|
|
753
730
|
}
|
|
754
731
|
export type LogCallback = (info: StateInfo, content: LogContent | undefined) => void;
|
|
755
732
|
export namespace LogLine {
|
|
756
|
-
export const DELIMITER =
|
|
733
|
+
export const DELIMITER = "\r\n";
|
|
757
734
|
export const DELIMITER_REGEX = /\r?\n/;
|
|
758
735
|
}
|
|
759
736
|
}
|
|
@@ -762,20 +739,18 @@ export type ImageConfig = ImageConfigString | ImageConfigFile;
|
|
|
762
739
|
export type ImageConfigString = string;
|
|
763
740
|
export namespace ImageConfigString {
|
|
764
741
|
export function is(config: ImageConfig | undefined): config is ImageConfigString {
|
|
765
|
-
return typeof config ===
|
|
742
|
+
return typeof config === "string";
|
|
766
743
|
}
|
|
767
|
-
|
|
768
744
|
}
|
|
769
745
|
export interface ImageConfigFile {
|
|
770
746
|
// Path to the Dockerfile relative to repository root
|
|
771
|
-
file: string
|
|
747
|
+
file: string;
|
|
772
748
|
// Path to the docker build context relative to repository root
|
|
773
|
-
context?: string
|
|
749
|
+
context?: string;
|
|
774
750
|
}
|
|
775
751
|
export namespace ImageConfigFile {
|
|
776
752
|
export function is(config: ImageConfig | undefined): config is ImageConfigFile {
|
|
777
|
-
return typeof config ===
|
|
778
|
-
&& 'file' in config;
|
|
753
|
+
return typeof config === "object" && "file" in config;
|
|
779
754
|
}
|
|
780
755
|
}
|
|
781
756
|
export interface ExternalImageConfigFile extends ImageConfigFile {
|
|
@@ -783,9 +758,7 @@ export interface ExternalImageConfigFile extends ImageConfigFile {
|
|
|
783
758
|
}
|
|
784
759
|
export namespace ExternalImageConfigFile {
|
|
785
760
|
export function is(config: any | undefined): config is ExternalImageConfigFile {
|
|
786
|
-
return typeof config ===
|
|
787
|
-
&& 'file' in config
|
|
788
|
-
&& 'externalSource' in config;
|
|
761
|
+
return typeof config === "object" && "file" in config && "externalSource" in config;
|
|
789
762
|
}
|
|
790
763
|
}
|
|
791
764
|
|
|
@@ -799,8 +772,7 @@ export interface WorkspaceContext {
|
|
|
799
772
|
|
|
800
773
|
export namespace WorkspaceContext {
|
|
801
774
|
export function is(context: any): context is WorkspaceContext {
|
|
802
|
-
return context
|
|
803
|
-
&& 'title' in context;
|
|
775
|
+
return context && "title" in context;
|
|
804
776
|
}
|
|
805
777
|
}
|
|
806
778
|
|
|
@@ -809,22 +781,17 @@ export interface WithSnapshot {
|
|
|
809
781
|
}
|
|
810
782
|
export namespace WithSnapshot {
|
|
811
783
|
export function is(context: any): context is WithSnapshot {
|
|
812
|
-
return context
|
|
813
|
-
&& 'snapshotBucketId' in context;
|
|
784
|
+
return context && "snapshotBucketId" in context;
|
|
814
785
|
}
|
|
815
786
|
}
|
|
816
787
|
|
|
817
|
-
export interface WithPrebuild {
|
|
818
|
-
snapshotBucketId: string;
|
|
788
|
+
export interface WithPrebuild extends WithSnapshot {
|
|
819
789
|
prebuildWorkspaceId: string;
|
|
820
790
|
wasPrebuilt: true;
|
|
821
791
|
}
|
|
822
792
|
export namespace WithPrebuild {
|
|
823
793
|
export function is(context: any): context is WithPrebuild {
|
|
824
|
-
return context
|
|
825
|
-
&& 'snapshotBucketId' in context
|
|
826
|
-
&& 'prebuildWorkspaceId' in context
|
|
827
|
-
&& 'wasPrebuilt' in context;
|
|
794
|
+
return context && WithSnapshot.is(context) && "prebuildWorkspaceId" in context && "wasPrebuilt" in context;
|
|
828
795
|
}
|
|
829
796
|
}
|
|
830
797
|
|
|
@@ -838,16 +805,14 @@ export interface WithDefaultConfig {
|
|
|
838
805
|
|
|
839
806
|
export namespace WithDefaultConfig {
|
|
840
807
|
export function is(context: any): context is WithDefaultConfig {
|
|
841
|
-
return context
|
|
842
|
-
&& 'withDefaultConfig' in context
|
|
843
|
-
&& context.withDefaultConfig;
|
|
808
|
+
return context && "withDefaultConfig" in context && context.withDefaultConfig;
|
|
844
809
|
}
|
|
845
810
|
|
|
846
811
|
export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
|
|
847
812
|
return {
|
|
848
813
|
...ctx,
|
|
849
|
-
withDefaultConfig: true
|
|
850
|
-
}
|
|
814
|
+
withDefaultConfig: true,
|
|
815
|
+
};
|
|
851
816
|
}
|
|
852
817
|
}
|
|
853
818
|
|
|
@@ -857,23 +822,24 @@ export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
|
|
|
857
822
|
|
|
858
823
|
export namespace SnapshotContext {
|
|
859
824
|
export function is(context: any): context is SnapshotContext {
|
|
860
|
-
return context
|
|
861
|
-
&& WithSnapshot.is(context)
|
|
862
|
-
&& 'snapshotId' in context;
|
|
825
|
+
return context && WithSnapshot.is(context) && "snapshotId" in context;
|
|
863
826
|
}
|
|
864
827
|
}
|
|
865
828
|
|
|
866
829
|
export interface StartPrebuildContext extends WorkspaceContext {
|
|
867
830
|
actual: WorkspaceContext;
|
|
868
831
|
commitHistory?: string[];
|
|
832
|
+
additionalRepositoryCommitHistories?: {
|
|
833
|
+
cloneUrl: string;
|
|
834
|
+
commitHistory: string[];
|
|
835
|
+
}[];
|
|
869
836
|
project?: Project;
|
|
870
837
|
branch?: string;
|
|
871
838
|
}
|
|
872
839
|
|
|
873
840
|
export namespace StartPrebuildContext {
|
|
874
841
|
export function is(context: any): context is StartPrebuildContext {
|
|
875
|
-
return context
|
|
876
|
-
&& 'actual' in context;
|
|
842
|
+
return context && "actual" in context;
|
|
877
843
|
}
|
|
878
844
|
}
|
|
879
845
|
|
|
@@ -885,21 +851,18 @@ export interface PrebuiltWorkspaceContext extends WorkspaceContext {
|
|
|
885
851
|
|
|
886
852
|
export namespace PrebuiltWorkspaceContext {
|
|
887
853
|
export function is(context: any): context is PrebuiltWorkspaceContext {
|
|
888
|
-
return context
|
|
889
|
-
&& 'originalContext' in context
|
|
890
|
-
&& 'prebuiltWorkspace' in context;
|
|
854
|
+
return context && "originalContext" in context && "prebuiltWorkspace" in context;
|
|
891
855
|
}
|
|
892
856
|
}
|
|
893
857
|
|
|
894
858
|
export interface WithReferrerContext extends WorkspaceContext {
|
|
895
|
-
referrer: string
|
|
896
|
-
referrerIde?: string
|
|
859
|
+
referrer: string;
|
|
860
|
+
referrerIde?: string;
|
|
897
861
|
}
|
|
898
862
|
|
|
899
863
|
export namespace WithReferrerContext {
|
|
900
864
|
export function is(context: any): context is WithReferrerContext {
|
|
901
|
-
return context
|
|
902
|
-
&& 'referrer' in context;
|
|
865
|
+
return context && "referrer" in context;
|
|
903
866
|
}
|
|
904
867
|
}
|
|
905
868
|
|
|
@@ -909,21 +872,18 @@ export interface WithEnvvarsContext extends WorkspaceContext {
|
|
|
909
872
|
|
|
910
873
|
export namespace WithEnvvarsContext {
|
|
911
874
|
export function is(context: any): context is WithEnvvarsContext {
|
|
912
|
-
return context
|
|
913
|
-
&& 'envvars' in context
|
|
875
|
+
return context && "envvars" in context;
|
|
914
876
|
}
|
|
915
877
|
}
|
|
916
878
|
|
|
917
879
|
export interface WorkspaceProbeContext extends WorkspaceContext {
|
|
918
|
-
responseURL: string
|
|
919
|
-
responseToken: string
|
|
880
|
+
responseURL: string;
|
|
881
|
+
responseToken: string;
|
|
920
882
|
}
|
|
921
883
|
|
|
922
884
|
export namespace WorkspaceProbeContext {
|
|
923
885
|
export function is(context: any): context is WorkspaceProbeContext {
|
|
924
|
-
return context
|
|
925
|
-
&& 'responseURL' in context
|
|
926
|
-
&& 'responseToken' in context;
|
|
886
|
+
return context && "responseURL" in context && "responseToken" in context;
|
|
927
887
|
}
|
|
928
888
|
}
|
|
929
889
|
|
|
@@ -935,32 +895,30 @@ export namespace RefType {
|
|
|
935
895
|
}
|
|
936
896
|
// This fallback is meant to handle the cases where (for historic reasons) ref is present but refType is missing
|
|
937
897
|
return commit.refType || "branch";
|
|
938
|
-
}
|
|
898
|
+
};
|
|
939
899
|
}
|
|
940
900
|
|
|
941
901
|
export interface Commit {
|
|
942
|
-
repository: Repository
|
|
943
|
-
revision: string
|
|
902
|
+
repository: Repository;
|
|
903
|
+
revision: string;
|
|
944
904
|
|
|
945
905
|
// Might contain either a branch or a tag (determined by refType)
|
|
946
|
-
ref?: string
|
|
906
|
+
ref?: string;
|
|
947
907
|
|
|
948
908
|
// refType is only set if ref is present (and not for old workspaces, before this feature was added)
|
|
949
|
-
refType?: RefType
|
|
909
|
+
refType?: RefType;
|
|
950
910
|
}
|
|
951
911
|
|
|
952
912
|
export interface AdditionalContentContext extends WorkspaceContext {
|
|
953
|
-
|
|
954
913
|
/**
|
|
955
914
|
* utf-8 encoded contents that will be copied on top of the workspace's filesystem
|
|
956
915
|
*/
|
|
957
|
-
additionalFiles: {[filePath: string]: string};
|
|
958
|
-
|
|
916
|
+
additionalFiles: { [filePath: string]: string };
|
|
959
917
|
}
|
|
960
918
|
|
|
961
919
|
export namespace AdditionalContentContext {
|
|
962
920
|
export function is(ctx: any): ctx is AdditionalContentContext {
|
|
963
|
-
return
|
|
921
|
+
return "additionalFiles" in ctx;
|
|
964
922
|
}
|
|
965
923
|
|
|
966
924
|
export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
|
|
@@ -968,16 +926,49 @@ export namespace AdditionalContentContext {
|
|
|
968
926
|
}
|
|
969
927
|
}
|
|
970
928
|
|
|
971
|
-
export interface CommitContext extends WorkspaceContext,
|
|
929
|
+
export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
|
|
972
930
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
973
|
-
cloneUrl?: string
|
|
931
|
+
cloneUrl?: string;
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* The clone and checkout information for additional repositories in case of multi-repo projects.
|
|
935
|
+
*/
|
|
936
|
+
additionalRepositoryCheckoutInfo?: GitCheckoutInfo[];
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
export namespace CommitContext {
|
|
940
|
+
/**
|
|
941
|
+
* Creates a hash for all the commits of the CommitContext and all sub-repo commit infos.
|
|
942
|
+
* The hash is max 255 chars long.
|
|
943
|
+
* @param commitContext
|
|
944
|
+
* @returns hash for commitcontext
|
|
945
|
+
*/
|
|
946
|
+
export function computeHash(commitContext: CommitContext): string {
|
|
947
|
+
// for single commits we use the revision to be backward compatible.
|
|
948
|
+
if (
|
|
949
|
+
!commitContext.additionalRepositoryCheckoutInfo ||
|
|
950
|
+
commitContext.additionalRepositoryCheckoutInfo.length === 0
|
|
951
|
+
) {
|
|
952
|
+
return commitContext.revision;
|
|
953
|
+
}
|
|
954
|
+
const hasher = createHash("sha256");
|
|
955
|
+
hasher.update(commitContext.revision);
|
|
956
|
+
for (const info of commitContext.additionalRepositoryCheckoutInfo) {
|
|
957
|
+
hasher.update(info.revision);
|
|
958
|
+
}
|
|
959
|
+
return hasher.digest("hex");
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
export interface GitCheckoutInfo extends Commit {
|
|
964
|
+
checkoutLocation?: string;
|
|
965
|
+
upstreamRemoteURI?: string;
|
|
966
|
+
localBranch?: string;
|
|
974
967
|
}
|
|
975
968
|
|
|
976
969
|
export namespace CommitContext {
|
|
977
970
|
export function is(commit: any): commit is CommitContext {
|
|
978
|
-
return WorkspaceContext.is(commit)
|
|
979
|
-
&& 'repository' in commit
|
|
980
|
-
&& 'revision' in commit
|
|
971
|
+
return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
|
|
981
972
|
}
|
|
982
973
|
}
|
|
983
974
|
|
|
@@ -985,17 +976,14 @@ export interface PullRequestContext extends CommitContext {
|
|
|
985
976
|
nr: number;
|
|
986
977
|
ref: string;
|
|
987
978
|
base: {
|
|
988
|
-
repository: Repository
|
|
989
|
-
ref: string
|
|
990
|
-
}
|
|
979
|
+
repository: Repository;
|
|
980
|
+
ref: string;
|
|
981
|
+
};
|
|
991
982
|
}
|
|
992
983
|
|
|
993
984
|
export namespace PullRequestContext {
|
|
994
985
|
export function is(ctx: any): ctx is PullRequestContext {
|
|
995
|
-
return CommitContext.is(ctx)
|
|
996
|
-
&& 'nr' in ctx
|
|
997
|
-
&& 'ref' in ctx
|
|
998
|
-
&& 'base' in ctx
|
|
986
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
|
|
999
987
|
}
|
|
1000
988
|
}
|
|
1001
989
|
|
|
@@ -1007,10 +995,7 @@ export interface IssueContext extends CommitContext {
|
|
|
1007
995
|
|
|
1008
996
|
export namespace IssueContext {
|
|
1009
997
|
export function is(ctx: any): ctx is IssueContext {
|
|
1010
|
-
return CommitContext.is(ctx)
|
|
1011
|
-
&& 'nr' in ctx
|
|
1012
|
-
&& 'ref' in ctx
|
|
1013
|
-
&& 'localBranch' in ctx
|
|
998
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
|
|
1014
999
|
}
|
|
1015
1000
|
}
|
|
1016
1001
|
|
|
@@ -1021,9 +1006,7 @@ export interface NavigatorContext extends CommitContext {
|
|
|
1021
1006
|
|
|
1022
1007
|
export namespace NavigatorContext {
|
|
1023
1008
|
export function is(ctx: any): ctx is NavigatorContext {
|
|
1024
|
-
return CommitContext.is(ctx)
|
|
1025
|
-
&& 'path' in ctx
|
|
1026
|
-
&& 'isFile' in ctx
|
|
1009
|
+
return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
|
|
1027
1010
|
}
|
|
1028
1011
|
}
|
|
1029
1012
|
|
|
@@ -1040,8 +1023,8 @@ export interface Repository {
|
|
|
1040
1023
|
private?: boolean;
|
|
1041
1024
|
fork?: {
|
|
1042
1025
|
// The direct parent of this fork
|
|
1043
|
-
parent: Repository
|
|
1044
|
-
}
|
|
1026
|
+
parent: Repository;
|
|
1027
|
+
};
|
|
1045
1028
|
}
|
|
1046
1029
|
export interface Branch {
|
|
1047
1030
|
name: string;
|
|
@@ -1066,21 +1049,19 @@ export namespace Repository {
|
|
|
1066
1049
|
export interface WorkspaceInstancePortsChangedEvent {
|
|
1067
1050
|
type: "PortsChanged";
|
|
1068
1051
|
instanceID: string;
|
|
1069
|
-
portsOpened: number[]
|
|
1070
|
-
portsClosed: number[]
|
|
1052
|
+
portsOpened: number[];
|
|
1053
|
+
portsClosed: number[];
|
|
1071
1054
|
}
|
|
1072
1055
|
|
|
1073
1056
|
export namespace WorkspaceInstancePortsChangedEvent {
|
|
1074
|
-
|
|
1075
1057
|
export function is(data: any): data is WorkspaceInstancePortsChangedEvent {
|
|
1076
1058
|
return data && data.type == "PortsChanged";
|
|
1077
1059
|
}
|
|
1078
|
-
|
|
1079
1060
|
}
|
|
1080
1061
|
|
|
1081
1062
|
export interface WorkspaceInfo {
|
|
1082
|
-
workspace: Workspace
|
|
1083
|
-
latestInstance?: WorkspaceInstance
|
|
1063
|
+
workspace: Workspace;
|
|
1064
|
+
latestInstance?: WorkspaceInstance;
|
|
1084
1065
|
}
|
|
1085
1066
|
|
|
1086
1067
|
export namespace WorkspaceInfo {
|
|
@@ -1096,35 +1077,36 @@ export interface WorkspaceCreationResult {
|
|
|
1096
1077
|
workspaceURL?: string;
|
|
1097
1078
|
existingWorkspaces?: WorkspaceInfo[];
|
|
1098
1079
|
runningWorkspacePrebuild?: {
|
|
1099
|
-
prebuildID: string
|
|
1100
|
-
workspaceID: string
|
|
1101
|
-
instanceID: string
|
|
1102
|
-
starting: RunningWorkspacePrebuildStarting
|
|
1103
|
-
sameCluster: boolean
|
|
1104
|
-
}
|
|
1080
|
+
prebuildID: string;
|
|
1081
|
+
workspaceID: string;
|
|
1082
|
+
instanceID: string;
|
|
1083
|
+
starting: RunningWorkspacePrebuildStarting;
|
|
1084
|
+
sameCluster: boolean;
|
|
1085
|
+
};
|
|
1105
1086
|
runningPrebuildWorkspaceID?: string;
|
|
1106
1087
|
}
|
|
1107
|
-
export type RunningWorkspacePrebuildStarting =
|
|
1088
|
+
export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
|
|
1108
1089
|
|
|
1109
1090
|
export enum CreateWorkspaceMode {
|
|
1110
1091
|
// Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
|
|
1111
|
-
Default =
|
|
1092
|
+
Default = "default",
|
|
1112
1093
|
// 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.
|
|
1113
|
-
ForceNew =
|
|
1094
|
+
ForceNew = "force-new",
|
|
1114
1095
|
// UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
|
|
1115
|
-
UsePrebuild =
|
|
1096
|
+
UsePrebuild = "use-prebuild",
|
|
1116
1097
|
// SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
|
|
1117
|
-
SelectIfRunning =
|
|
1098
|
+
SelectIfRunning = "select-if-running",
|
|
1118
1099
|
}
|
|
1119
1100
|
|
|
1120
1101
|
export namespace WorkspaceCreationResult {
|
|
1121
1102
|
export function is(data: any): data is WorkspaceCreationResult {
|
|
1122
|
-
return
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1103
|
+
return (
|
|
1104
|
+
data &&
|
|
1105
|
+
("createdWorkspaceId" in data ||
|
|
1106
|
+
"existingWorkspaces" in data ||
|
|
1107
|
+
"runningWorkspacePrebuild" in data ||
|
|
1108
|
+
"runningPrebuildWorkspaceID" in data)
|
|
1109
|
+
);
|
|
1128
1110
|
}
|
|
1129
1111
|
}
|
|
1130
1112
|
|
|
@@ -1158,6 +1140,12 @@ export interface AuthProviderInfo {
|
|
|
1158
1140
|
readonly default: string[];
|
|
1159
1141
|
readonly publicRepo: string[];
|
|
1160
1142
|
readonly privateRepo: string[];
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
export namespace AuthProviderInfo {
|
|
1147
|
+
export function isGitHubEnterprise(info?: AuthProviderInfo): boolean {
|
|
1148
|
+
return !!info && info.authProviderType === "GitHub" && info.host !== "github.com";
|
|
1161
1149
|
}
|
|
1162
1150
|
}
|
|
1163
1151
|
|
|
@@ -1170,6 +1158,8 @@ export interface AuthProviderEntry {
|
|
|
1170
1158
|
readonly status: AuthProviderEntry.Status;
|
|
1171
1159
|
|
|
1172
1160
|
readonly oauth: OAuth2Config;
|
|
1161
|
+
/** A random string that is to change whenever oauth changes (enforced on DB level) */
|
|
1162
|
+
readonly oauthRevision?: string;
|
|
1173
1163
|
}
|
|
1174
1164
|
|
|
1175
1165
|
export interface OAuth2Config {
|
|
@@ -1182,23 +1172,27 @@ export interface OAuth2Config {
|
|
|
1182
1172
|
readonly scopeSeparator?: string;
|
|
1183
1173
|
|
|
1184
1174
|
readonly settingsUrl?: string;
|
|
1185
|
-
readonly authorizationParams?: { [key: string]: string }
|
|
1175
|
+
readonly authorizationParams?: { [key: string]: string };
|
|
1186
1176
|
readonly configURL?: string;
|
|
1187
1177
|
}
|
|
1188
1178
|
|
|
1189
1179
|
export namespace AuthProviderEntry {
|
|
1190
1180
|
export type Type = "GitHub" | "GitLab" | string;
|
|
1191
1181
|
export type Status = "pending" | "verified";
|
|
1192
|
-
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & {
|
|
1193
|
-
|
|
1182
|
+
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & {
|
|
1183
|
+
clientId?: string;
|
|
1184
|
+
clientSecret?: string;
|
|
1185
|
+
};
|
|
1186
|
+
export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> &
|
|
1187
|
+
Pick<OAuth2Config, "clientId" | "clientSecret">;
|
|
1194
1188
|
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
|
|
1195
1189
|
return {
|
|
1196
1190
|
...entry,
|
|
1197
1191
|
oauth: {
|
|
1198
1192
|
...entry.oauth,
|
|
1199
|
-
clientSecret: "redacted"
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1193
|
+
clientSecret: "redacted",
|
|
1194
|
+
},
|
|
1195
|
+
};
|
|
1202
1196
|
}
|
|
1203
1197
|
}
|
|
1204
1198
|
|