@gitpod/gitpod-protocol 0.1.5-svenefftinge-dashboard-invalid-2274.4 → 0.1.5-tar-telemetry-data-settings.0
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/builtin-theia-plugins.json +28 -18
- package/data/gitpod-schema.json +25 -24
- package/lib/accounting-protocol.d.ts +155 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +109 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +32 -5
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +16 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +45 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/auth.d.ts +25 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +16 -0
- package/lib/auth.js.map +1 -0
- package/lib/context-url.d.ts +19 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +51 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +12 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +73 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/email-protocol.d.ts +2 -3
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js +5 -5
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts +1 -1
- package/lib/encryption/container-module.js +6 -5
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +1 -1
- package/lib/encryption/encryption-engine.js +20 -21
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +1 -1
- package/lib/encryption/encryption-engine.spec.js +30 -37
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +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 +1 -1
- package/lib/encryption/key-provider.js +26 -31
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +2 -3
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +21 -22
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts +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.d.ts +1 -1
- package/lib/gitpod-file-parser.spec.js +117 -117
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +156 -21
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +171 -257
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +9 -12
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +5 -8
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +5 -1
- package/lib/ide-frontend-service.d.ts.map +1 -1
- package/lib/ide-frontend-service.js +1 -1
- package/lib/ide-protocol.d.ts +101 -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 +7 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -2
- 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 +1 -1
- package/lib/license-protocol.js +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 +183 -33
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +1 -1
- package/lib/messaging/browser/window-connection.js +36 -56
- 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/connection-error-handler.js +11 -23
- package/lib/messaging/connection-error-handler.js.map +1 -1
- package/lib/messaging/error.d.ts +7 -2
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +14 -4
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +23 -59
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +2 -0
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +74 -159
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/oss-allowlist.d.ts +14 -0
- package/lib/oss-allowlist.d.ts.map +1 -0
- package/lib/oss-allowlist.js +8 -0
- package/lib/oss-allowlist.js.map +1 -0
- package/lib/payment-protocol.d.ts +18 -0
- package/lib/payment-protocol.d.ts.map +1 -0
- package/lib/payment-protocol.js +13 -0
- package/lib/payment-protocol.js.map +1 -0
- package/lib/permission.d.ts +7 -5
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +20 -19
- 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 +570 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +133 -59
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +129 -118
- 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} +3 -4
- 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 +73 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +63 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +113 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +30 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/theia-plugins.d.ts +1 -1
- package/lib/theia-plugins.js +1 -1
- package/lib/typings/globals.d.ts +1 -1
- package/lib/typings/globals.js +1 -1
- package/lib/util/analytics.d.ts +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +79 -0
- package/lib/util/analytics.js.map +1 -0
- package/lib/util/async-iterator.d.ts +1 -1
- package/lib/util/async-iterator.js +56 -134
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +1 -1
- package/lib/util/cancelable.js +18 -60
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +1 -1
- package/lib/util/date-time.js +9 -9
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/deep-partial.d.ts +1 -1
- package/lib/util/deep-partial.js +1 -1
- package/lib/util/deferred.d.ts +1 -1
- package/lib/util/deferred.js +11 -13
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.js +26 -39
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.js +58 -74
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +2 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +27 -47
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +4 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.js +487 -0
- package/lib/util/generate-workspace-id.js.map +1 -0
- package/lib/util/generate-workspace-id.spec.d.ts +7 -0
- package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.spec.js +87 -0
- package/lib/util/generate-workspace-id.spec.js.map +1 -0
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +44 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +5 -3
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +99 -92
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +16 -0
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -0
- package/lib/util/gitpod-host-url.spec.js +124 -0
- package/lib/util/gitpod-host-url.spec.js.map +1 -0
- package/lib/util/grpc.d.ts +15 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +18 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/jaeger-client-types.d.ts +68 -0
- package/lib/util/jaeger-client-types.d.ts.map +1 -0
- package/lib/util/jaeger-client-types.js +8 -0
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +57 -34
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +119 -111
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.d.ts +1 -1
- package/lib/util/make-link.js +3 -3
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +14 -4
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +39 -9
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +9 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +128 -48
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +1 -1
- package/lib/util/queue.js +17 -56
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.d.ts +1 -1
- package/lib/util/queue.spec.js +145 -289
- 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 +1 -1
- package/lib/util/semaphore.js +16 -47
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +1 -1
- package/lib/util/skip-if.js +7 -7
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +1 -1
- package/lib/util/timeutil.js +29 -17
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +1 -1
- package/lib/util/timeutil.spec.js +22 -25
- 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 -63
- 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 +1 -1
- package/lib/util/workspace-port-authentication.js +4 -3
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +71 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +16 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +27 -3
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.js +2 -2
- package/package.json +33 -17
- package/pkg-yarn.lock +18 -9
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +229 -0
- package/src/admin-protocol.ts +54 -6
- package/src/analytics.ts +54 -0
- package/src/auth.ts +27 -0
- package/src/context-url.spec.ts +39 -0
- package/src/context-url.ts +53 -0
- package/src/email-protocol.ts +3 -4
- package/src/encryption/container-module.ts +1 -1
- package/src/encryption/encryption-engine.spec.ts +1 -1
- package/src/encryption/encryption-engine.ts +1 -1
- package/src/encryption/encryption-service.ts +1 -1
- package/src/encryption/key-provider.ts +1 -1
- package/src/env.ts +11 -11
- package/src/gitpod-file-parser.spec.ts +1 -1
- package/src/gitpod-file-parser.ts +1 -1
- package/src/gitpod-service.ts +230 -40
- package/src/headless-workspace-log.ts +8 -12
- package/src/ide-frontend-service.ts +6 -2
- package/src/ide-protocol.ts +114 -0
- package/src/index.ts +8 -2
- package/src/installation-admin-protocol.ts +42 -0
- package/src/license-protocol.ts +1 -1
- package/src/messaging/browser/connection.ts +195 -14
- package/src/messaging/browser/window-connection.ts +1 -1
- package/src/messaging/client-call-metrics.ts +97 -0
- package/src/messaging/error.ts +19 -4
- package/src/messaging/handler.ts +12 -0
- package/src/messaging/node/connection.ts +21 -68
- package/src/messaging/proxy-factory.ts +14 -6
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +20 -0
- package/src/permission.ts +9 -8
- package/src/plans.ts +632 -0
- package/src/protocol.ts +222 -88
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +113 -0
- package/src/teams-projects-protocol.ts +147 -0
- package/src/theia-plugins.ts +1 -1
- package/src/typings/globals.ts +1 -1
- package/src/util/analytics.ts +87 -0
- package/src/util/async-iterator.ts +1 -1
- package/src/util/cancelable.ts +1 -1
- package/src/util/date-time.ts +1 -1
- package/src/util/deep-partial.ts +1 -1
- package/src/util/deferred.ts +2 -2
- package/src/util/garbage-collected-cache.ts +10 -4
- package/src/util/generate-workspace-id.spec.ts +48 -0
- package/src/util/generate-workspace-id.ts +475 -0
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.spec.ts +49 -0
- package/src/util/gitpod-host-url.ts +36 -14
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +111 -39
- package/src/util/make-link.ts +1 -1
- package/src/util/parse-workspace-id.spec.ts +46 -5
- package/src/util/parse-workspace-id.ts +39 -8
- package/src/util/queue.spec.ts +2 -2
- package/src/util/queue.ts +1 -1
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +3 -3
- package/src/util/skip-if.ts +2 -2
- package/src/util/timeutil.spec.ts +1 -1
- package/src/util/timeutil.ts +5 -5
- package/src/util/tracing.spec.ts +83 -0
- package/src/util/tracing.ts +184 -19
- package/src/util/workspace-port-authentication.ts +1 -1
- package/src/workspace-cluster.ts +91 -0
- package/src/workspace-instance.ts +52 -14
- package/src/wsready.ts +2 -2
- 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/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
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { WorkspaceInstance, PortVisibility } from "./workspace-instance";
|
|
8
8
|
import { RoleOrPermission } from "./permission";
|
|
9
|
+
import { Project } from "./teams-projects-protocol";
|
|
9
10
|
|
|
10
11
|
export interface UserInfo {
|
|
11
12
|
name?: string
|
|
@@ -27,19 +28,12 @@ export interface User {
|
|
|
27
28
|
|
|
28
29
|
identities: Identity[]
|
|
29
30
|
|
|
30
|
-
allowsMarketingCommunication: boolean;
|
|
31
|
-
|
|
32
31
|
/**
|
|
33
32
|
* Whether the user has been blocked to use our service, because of TOS violation for example.
|
|
34
33
|
* Optional for backwards compatibility.
|
|
35
34
|
*/
|
|
36
35
|
blocked?: boolean;
|
|
37
36
|
|
|
38
|
-
/**
|
|
39
|
-
* whether this user can run workspaces in privileged mode
|
|
40
|
-
*/
|
|
41
|
-
privileged?: boolean;
|
|
42
|
-
|
|
43
37
|
/** A map of random settings that alter the behaviour of Gitpod on a per-user basis */
|
|
44
38
|
featureFlags?: UserFeatureSettings;
|
|
45
39
|
|
|
@@ -61,6 +55,20 @@ export namespace User {
|
|
|
61
55
|
export function getIdentity(user: User, authProviderId: string): Identity | undefined {
|
|
62
56
|
return user.identities.find(id => id.authProviderId === authProviderId);
|
|
63
57
|
}
|
|
58
|
+
export function censor(user: User): User {
|
|
59
|
+
const res = { ...user };
|
|
60
|
+
delete (res.additionalData);
|
|
61
|
+
res.identities = res.identities.map(i => {
|
|
62
|
+
delete (i.tokens);
|
|
63
|
+
|
|
64
|
+
// The user field is not in the Identity shape, but actually exists on DBIdentity.
|
|
65
|
+
// Trying to push this object out via JSON RPC will fail because of the cyclic nature
|
|
66
|
+
// of this field.
|
|
67
|
+
delete ((i as any).user);
|
|
68
|
+
return i;
|
|
69
|
+
});
|
|
70
|
+
return res;
|
|
71
|
+
}
|
|
64
72
|
export function getPrimaryEmail(user: User): string {
|
|
65
73
|
const identities = user.identities.filter(i => !!i.primaryEmail);
|
|
66
74
|
if (identities.length <= 0) {
|
|
@@ -89,14 +97,28 @@ export interface AdditionalUserData {
|
|
|
89
97
|
emailNotificationSettings?: EmailNotificationSettings;
|
|
90
98
|
featurePreview?: boolean;
|
|
91
99
|
ideSettings?: IDESettings;
|
|
100
|
+
// key is the name of the news, string the iso date when it was seen
|
|
101
|
+
whatsNewSeen?: { [key: string]: string }
|
|
102
|
+
// key is the name of the OAuth client i.e. local app, string the iso date when it was approved
|
|
103
|
+
// TODO(rl): provide a management UX to allow rescinding of approval
|
|
104
|
+
oauthClientsApproved?: { [key: string]: string }
|
|
105
|
+
// to remember GH Orgs the user installed/updated the GH App for
|
|
106
|
+
knownGitHubOrgs?: string[];
|
|
107
|
+
|
|
108
|
+
// Git clone URL pointing to the user's dotfile repo
|
|
109
|
+
dotfileRepo?: string;
|
|
92
110
|
}
|
|
93
111
|
|
|
94
112
|
export interface EmailNotificationSettings {
|
|
95
|
-
|
|
113
|
+
allowsChangelogMail?: boolean;
|
|
114
|
+
allowsDevXMail?: boolean;
|
|
115
|
+
allowsOnboardingMail?: boolean;
|
|
96
116
|
}
|
|
97
117
|
|
|
98
118
|
export type IDESettings = {
|
|
99
119
|
defaultIde?: string
|
|
120
|
+
useDesktopIde?: boolean
|
|
121
|
+
defaultDesktopIde?: string
|
|
100
122
|
}
|
|
101
123
|
|
|
102
124
|
export interface UserPlatform {
|
|
@@ -118,14 +140,6 @@ export interface UserPlatform {
|
|
|
118
140
|
}
|
|
119
141
|
|
|
120
142
|
export interface UserFeatureSettings {
|
|
121
|
-
/**
|
|
122
|
-
* This field is used as marker to grant users a free trial for using private repositories,
|
|
123
|
-
* independent of any subscription or Chargebee.
|
|
124
|
-
* - it is set when the user uses their first private repo
|
|
125
|
-
* - whether the trial is expired or not is juged by the UserService
|
|
126
|
-
*/
|
|
127
|
-
privateRepoTrialStartDate?: string;
|
|
128
|
-
|
|
129
143
|
/**
|
|
130
144
|
* Permanent feature flags are added to each and every workspace instance
|
|
131
145
|
* this user starts.
|
|
@@ -137,15 +151,26 @@ export interface UserFeatureSettings {
|
|
|
137
151
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
138
152
|
* If they don't we'll break things during workspace startup.
|
|
139
153
|
*/
|
|
140
|
-
export const WorkspaceFeatureFlags = { "
|
|
154
|
+
export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
|
|
141
155
|
export type NamedWorkspaceFeatureFlag = keyof (typeof WorkspaceFeatureFlags);
|
|
142
156
|
|
|
143
|
-
export interface
|
|
144
|
-
id?: string;
|
|
157
|
+
export interface EnvVarWithValue {
|
|
145
158
|
name: string;
|
|
146
|
-
repositoryPattern: string;
|
|
147
159
|
value: string;
|
|
148
160
|
}
|
|
161
|
+
|
|
162
|
+
export interface ProjectEnvVarWithValue extends EnvVarWithValue {
|
|
163
|
+
id: string;
|
|
164
|
+
projectId: string;
|
|
165
|
+
censored: boolean;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, 'value'>;
|
|
169
|
+
|
|
170
|
+
export interface UserEnvVarValue extends EnvVarWithValue {
|
|
171
|
+
id?: string;
|
|
172
|
+
repositoryPattern: string; // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
173
|
+
}
|
|
149
174
|
export interface UserEnvVar extends UserEnvVarValue {
|
|
150
175
|
id: string;
|
|
151
176
|
userId: string;
|
|
@@ -154,10 +179,35 @@ export interface UserEnvVar extends UserEnvVarValue {
|
|
|
154
179
|
|
|
155
180
|
export namespace UserEnvVar {
|
|
156
181
|
|
|
182
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
157
183
|
export function normalizeRepoPattern(pattern: string) {
|
|
158
184
|
return pattern.toLocaleLowerCase();
|
|
159
185
|
}
|
|
160
186
|
|
|
187
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
188
|
+
export function score(value: UserEnvVarValue): number {
|
|
189
|
+
// We use a score to enforce precedence:
|
|
190
|
+
// value/value = 0
|
|
191
|
+
// value/* = 1
|
|
192
|
+
// */value = 2
|
|
193
|
+
// */* = 3
|
|
194
|
+
// #/# = 4 (used for env vars passed through the URL)
|
|
195
|
+
// the lower the score, the higher the precedence.
|
|
196
|
+
const [ownerPattern, repoPattern] = splitRepositoryPattern(value.repositoryPattern);
|
|
197
|
+
let score = 0;
|
|
198
|
+
if (repoPattern == "*") {
|
|
199
|
+
score += 1;
|
|
200
|
+
}
|
|
201
|
+
if (ownerPattern == '*') {
|
|
202
|
+
score += 2;
|
|
203
|
+
}
|
|
204
|
+
if (ownerPattern == "#" || repoPattern == "#") {
|
|
205
|
+
score = 4;
|
|
206
|
+
}
|
|
207
|
+
return score;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
161
211
|
export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
|
|
162
212
|
let result = vars.filter(e => {
|
|
163
213
|
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
@@ -193,25 +243,7 @@ export namespace UserEnvVar {
|
|
|
193
243
|
let minscore = 10;
|
|
194
244
|
let bestCandidate: T | undefined;
|
|
195
245
|
for (const e of candidates) {
|
|
196
|
-
|
|
197
|
-
// value/value = 0
|
|
198
|
-
// value/* = 1
|
|
199
|
-
// */value = 2
|
|
200
|
-
// */* = 3
|
|
201
|
-
// #/# = 4 (used for env vars passed through the URL)
|
|
202
|
-
// the lower the score, the higher the precedence.
|
|
203
|
-
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
204
|
-
let score = 0;
|
|
205
|
-
if (repoPattern == "*") {
|
|
206
|
-
score += 1;
|
|
207
|
-
}
|
|
208
|
-
if (ownerPattern == '*') {
|
|
209
|
-
score += 2;
|
|
210
|
-
}
|
|
211
|
-
if (ownerPattern == "#" || repoPattern == "#") {
|
|
212
|
-
score = 4;
|
|
213
|
-
}
|
|
214
|
-
|
|
246
|
+
const score = UserEnvVar.score(e);
|
|
215
247
|
if (!bestCandidate || score < minscore) {
|
|
216
248
|
minscore = score;
|
|
217
249
|
bestCandidate = e;
|
|
@@ -223,10 +255,11 @@ export namespace UserEnvVar {
|
|
|
223
255
|
return result;
|
|
224
256
|
}
|
|
225
257
|
|
|
226
|
-
|
|
258
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
259
|
+
export function splitRepositoryPattern(repositoryPattern: string): string[] {
|
|
227
260
|
const patterns = repositoryPattern.split('/');
|
|
228
|
-
const repoPattern = patterns.
|
|
229
|
-
const ownerPattern = patterns
|
|
261
|
+
const repoPattern = patterns.slice(1).join('/')
|
|
262
|
+
const ownerPattern = patterns[0];
|
|
230
263
|
return [ownerPattern, repoPattern];
|
|
231
264
|
}
|
|
232
265
|
}
|
|
@@ -357,11 +390,16 @@ export interface PendingGithubEvent {
|
|
|
357
390
|
export interface Snapshot {
|
|
358
391
|
id: string;
|
|
359
392
|
creationTime: string;
|
|
393
|
+
availableTime?: string;
|
|
360
394
|
originalWorkspaceId: string;
|
|
361
395
|
bucketId: string;
|
|
362
396
|
layoutData?: string;
|
|
397
|
+
state: SnapshotState;
|
|
398
|
+
message?: string;
|
|
363
399
|
}
|
|
364
400
|
|
|
401
|
+
export type SnapshotState = 'pending' | 'available' | 'error';
|
|
402
|
+
|
|
365
403
|
export interface LayoutData {
|
|
366
404
|
workspaceId: string;
|
|
367
405
|
lastUpdatedTime: string;
|
|
@@ -374,6 +412,7 @@ export interface Workspace {
|
|
|
374
412
|
contextURL: string;
|
|
375
413
|
description: string;
|
|
376
414
|
ownerId: string;
|
|
415
|
+
projectId?: string;
|
|
377
416
|
context: WorkspaceContext;
|
|
378
417
|
config: WorkspaceConfig;
|
|
379
418
|
|
|
@@ -482,6 +521,7 @@ export interface PreparePluginUploadParams {
|
|
|
482
521
|
export interface ResolvePluginsParams {
|
|
483
522
|
config?: WorkspaceConfig
|
|
484
523
|
builtins?: ResolvedPlugins
|
|
524
|
+
vsxRegistryUrl?: string
|
|
485
525
|
}
|
|
486
526
|
|
|
487
527
|
export interface InstallPluginsParams {
|
|
@@ -492,6 +532,24 @@ export interface UninstallPluginParams {
|
|
|
492
532
|
pluginId: string;
|
|
493
533
|
}
|
|
494
534
|
|
|
535
|
+
export interface GuessGitTokenScopesParams {
|
|
536
|
+
host: string
|
|
537
|
+
repoUrl: string
|
|
538
|
+
gitCommand: string
|
|
539
|
+
currentToken: GitToken
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export interface GitToken {
|
|
543
|
+
token: string
|
|
544
|
+
user: string
|
|
545
|
+
scopes: string[]
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export interface GuessedGitTokenScopes {
|
|
549
|
+
message?: string
|
|
550
|
+
scopes?: string[]
|
|
551
|
+
}
|
|
552
|
+
|
|
495
553
|
export type ResolvedPluginKind = 'user' | 'workspace' | 'builtin';
|
|
496
554
|
|
|
497
555
|
export interface ResolvedPlugins {
|
|
@@ -517,16 +575,21 @@ export interface WorkspaceConfig {
|
|
|
517
575
|
gitConfig?: { [config: string]: string };
|
|
518
576
|
github?: GithubAppConfig;
|
|
519
577
|
vscode?: VSCodeConfig;
|
|
520
|
-
|
|
578
|
+
|
|
579
|
+
/** deprecated. Enabled by default **/
|
|
580
|
+
experimentalNetwork?: boolean;
|
|
581
|
+
|
|
521
582
|
/**
|
|
522
583
|
* Where the config object originates from.
|
|
523
|
-
*
|
|
584
|
+
*
|
|
524
585
|
* repo - from the repository
|
|
586
|
+
* project-db - from the "Project" stored in the database
|
|
525
587
|
* definitly-gp - from github.com/gitpod-io/definitely-gp
|
|
526
588
|
* derived - computed based on analyzing the repository
|
|
589
|
+
* additional-content - config comes from additional content, usually provided through the project's configuration
|
|
527
590
|
* default - our static catch-all default config
|
|
528
591
|
*/
|
|
529
|
-
_origin?: 'repo' | 'definitely-gp' | 'derived' | 'default';
|
|
592
|
+
_origin?: 'repo' | 'project-db' | 'definitely-gp' | 'derived' | 'additional-content' | 'default';
|
|
530
593
|
|
|
531
594
|
/**
|
|
532
595
|
* Set of automatically infered feature flags. That's not something the user can set, but
|
|
@@ -543,7 +606,7 @@ export interface GithubAppPrebuildConfig {
|
|
|
543
606
|
branches?: boolean
|
|
544
607
|
pullRequests?: boolean
|
|
545
608
|
pullRequestsFromForks?: boolean
|
|
546
|
-
addCheck?: boolean
|
|
609
|
+
addCheck?: boolean | 'prevent-merge-on-error'
|
|
547
610
|
addBadge?: boolean
|
|
548
611
|
addLabel?: boolean | string
|
|
549
612
|
addComment?: boolean
|
|
@@ -556,16 +619,13 @@ export namespace GithubAppPrebuildConfig {
|
|
|
556
619
|
|
|
557
620
|
export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
|
|
558
621
|
export interface WorkspaceImageSourceDocker {
|
|
559
|
-
// TODO: clean this up. We should have the commit and an ImageSource in here, not duplicate the whole thing again.
|
|
560
|
-
// We have a ton of those objects in the database, thus cleaning this up means lengthy DB migrations. Yuck.
|
|
561
|
-
dockerFileHash: string
|
|
562
|
-
dockerFileSource: Commit
|
|
563
622
|
dockerFilePath: string
|
|
623
|
+
dockerFileHash: string
|
|
624
|
+
dockerFileSource?: Commit
|
|
564
625
|
}
|
|
565
626
|
export namespace WorkspaceImageSourceDocker {
|
|
566
627
|
export function is(obj: object): obj is WorkspaceImageSourceDocker {
|
|
567
628
|
return 'dockerFileHash' in obj
|
|
568
|
-
&& 'dockerFileSource' in obj
|
|
569
629
|
&& 'dockerFilePath' in obj;
|
|
570
630
|
}
|
|
571
631
|
}
|
|
@@ -594,6 +654,8 @@ export type PrebuiltWorkspaceState
|
|
|
594
654
|
export interface PrebuiltWorkspace {
|
|
595
655
|
id: string;
|
|
596
656
|
cloneURL: string;
|
|
657
|
+
branch?: string;
|
|
658
|
+
projectId?: string;
|
|
597
659
|
commit: string;
|
|
598
660
|
buildWorkspaceId: string;
|
|
599
661
|
creationTime: string;
|
|
@@ -604,7 +666,7 @@ export interface PrebuiltWorkspace {
|
|
|
604
666
|
|
|
605
667
|
export namespace PrebuiltWorkspace {
|
|
606
668
|
export function isDone(pws: PrebuiltWorkspace) {
|
|
607
|
-
return pws.state === "available" || pws.state === "timeout" ||
|
|
669
|
+
return pws.state === "available" || pws.state === "timeout" || pws.state === 'aborted';
|
|
608
670
|
}
|
|
609
671
|
|
|
610
672
|
export function isAvailable(pws: PrebuiltWorkspace) {
|
|
@@ -640,6 +702,8 @@ export interface PortConfig {
|
|
|
640
702
|
port: number;
|
|
641
703
|
onOpen?: PortOnOpen;
|
|
642
704
|
visibility?: PortVisibility;
|
|
705
|
+
description?: string;
|
|
706
|
+
name?: string;
|
|
643
707
|
}
|
|
644
708
|
export namespace PortConfig {
|
|
645
709
|
export function is(config: any): config is PortConfig {
|
|
@@ -663,7 +727,7 @@ export interface TaskConfig {
|
|
|
663
727
|
init?: string;
|
|
664
728
|
prebuild?: string;
|
|
665
729
|
command?: string;
|
|
666
|
-
env?: { [env: string]:
|
|
730
|
+
env?: { [env: string]: any };
|
|
667
731
|
openIn?: 'bottom' | 'main' | 'left' | 'right';
|
|
668
732
|
openMode?: 'split-top' | 'split-left' | 'split-right' | 'split-bottom' | 'tab-before' | 'tab-after';
|
|
669
733
|
}
|
|
@@ -727,8 +791,10 @@ export namespace ExternalImageConfigFile {
|
|
|
727
791
|
|
|
728
792
|
export interface WorkspaceContext {
|
|
729
793
|
title: string;
|
|
794
|
+
/** 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. */
|
|
730
795
|
normalizedContextURL?: string;
|
|
731
796
|
forceCreateNewWorkspace?: boolean;
|
|
797
|
+
forceImageBuild?: boolean;
|
|
732
798
|
}
|
|
733
799
|
|
|
734
800
|
export namespace WorkspaceContext {
|
|
@@ -762,6 +828,29 @@ export namespace WithPrebuild {
|
|
|
762
828
|
}
|
|
763
829
|
}
|
|
764
830
|
|
|
831
|
+
/**
|
|
832
|
+
* WithDefaultConfig contexts disable the download of the gitpod.yml from the repository
|
|
833
|
+
* and fall back to the built-in configuration.
|
|
834
|
+
*/
|
|
835
|
+
export interface WithDefaultConfig {
|
|
836
|
+
withDefaultConfig: true;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
export namespace WithDefaultConfig {
|
|
840
|
+
export function is(context: any): context is WithDefaultConfig {
|
|
841
|
+
return context
|
|
842
|
+
&& 'withDefaultConfig' in context
|
|
843
|
+
&& context.withDefaultConfig;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
|
|
847
|
+
return {
|
|
848
|
+
...ctx,
|
|
849
|
+
withDefaultConfig: true
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
765
854
|
export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
|
|
766
855
|
snapshotId: string;
|
|
767
856
|
}
|
|
@@ -776,6 +865,9 @@ export namespace SnapshotContext {
|
|
|
776
865
|
|
|
777
866
|
export interface StartPrebuildContext extends WorkspaceContext {
|
|
778
867
|
actual: WorkspaceContext;
|
|
868
|
+
commitHistory?: string[];
|
|
869
|
+
project?: Project;
|
|
870
|
+
branch?: string;
|
|
779
871
|
}
|
|
780
872
|
|
|
781
873
|
export namespace StartPrebuildContext {
|
|
@@ -799,8 +891,20 @@ export namespace PrebuiltWorkspaceContext {
|
|
|
799
891
|
}
|
|
800
892
|
}
|
|
801
893
|
|
|
894
|
+
export interface WithReferrerContext extends WorkspaceContext {
|
|
895
|
+
referrer: string
|
|
896
|
+
referrerIde?: string
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
export namespace WithReferrerContext {
|
|
900
|
+
export function is(context: any): context is WithReferrerContext {
|
|
901
|
+
return context
|
|
902
|
+
&& 'referrer' in context;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
802
906
|
export interface WithEnvvarsContext extends WorkspaceContext {
|
|
803
|
-
envvars:
|
|
907
|
+
envvars: EnvVarWithValue[];
|
|
804
908
|
}
|
|
805
909
|
|
|
806
910
|
export namespace WithEnvvarsContext {
|
|
@@ -845,6 +949,25 @@ export interface Commit {
|
|
|
845
949
|
refType?: RefType
|
|
846
950
|
}
|
|
847
951
|
|
|
952
|
+
export interface AdditionalContentContext extends WorkspaceContext {
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* utf-8 encoded contents that will be copied on top of the workspace's filesystem
|
|
956
|
+
*/
|
|
957
|
+
additionalFiles: {[filePath: string]: string};
|
|
958
|
+
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
export namespace AdditionalContentContext {
|
|
962
|
+
export function is(ctx: any): ctx is AdditionalContentContext {
|
|
963
|
+
return 'additionalFiles' in ctx;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
|
|
967
|
+
return is(ctx) && ImageConfigFile.is(config.image) && !!ctx.additionalFiles[config.image.file];
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
848
971
|
export interface CommitContext extends WorkspaceContext, Commit {
|
|
849
972
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
850
973
|
cloneUrl?: string
|
|
@@ -920,6 +1043,19 @@ export interface Repository {
|
|
|
920
1043
|
parent: Repository
|
|
921
1044
|
}
|
|
922
1045
|
}
|
|
1046
|
+
export interface Branch {
|
|
1047
|
+
name: string;
|
|
1048
|
+
commit: CommitInfo;
|
|
1049
|
+
htmlUrl: string;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
export interface CommitInfo {
|
|
1053
|
+
author: string;
|
|
1054
|
+
sha: string;
|
|
1055
|
+
commitMessage: string;
|
|
1056
|
+
authorAvatarUrl?: string;
|
|
1057
|
+
authorDate?: string;
|
|
1058
|
+
}
|
|
923
1059
|
|
|
924
1060
|
export namespace Repository {
|
|
925
1061
|
export function fullRepoName(repo: Repository): string {
|
|
@@ -947,6 +1083,12 @@ export interface WorkspaceInfo {
|
|
|
947
1083
|
latestInstance?: WorkspaceInstance
|
|
948
1084
|
}
|
|
949
1085
|
|
|
1086
|
+
export namespace WorkspaceInfo {
|
|
1087
|
+
export function lastActiveISODate(info: WorkspaceInfo): string {
|
|
1088
|
+
return info.latestInstance?.creationTime || info.workspace.creationTime;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
950
1092
|
export type RunningWorkspaceInfo = WorkspaceInfo & { latestInstance: WorkspaceInstance };
|
|
951
1093
|
|
|
952
1094
|
export interface WorkspaceCreationResult {
|
|
@@ -956,6 +1098,7 @@ export interface WorkspaceCreationResult {
|
|
|
956
1098
|
runningWorkspacePrebuild?: {
|
|
957
1099
|
prebuildID: string
|
|
958
1100
|
workspaceID: string
|
|
1101
|
+
instanceID: string
|
|
959
1102
|
starting: RunningWorkspacePrebuildStarting
|
|
960
1103
|
sameCluster: boolean
|
|
961
1104
|
}
|
|
@@ -1046,40 +1189,16 @@ export interface OAuth2Config {
|
|
|
1046
1189
|
export namespace AuthProviderEntry {
|
|
1047
1190
|
export type Type = "GitHub" | "GitLab" | string;
|
|
1048
1191
|
export type Status = "pending" | "verified";
|
|
1049
|
-
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"
|
|
1192
|
+
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & { clientId?: string, clientSecret?: string };
|
|
1050
1193
|
export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> & Pick<OAuth2Config, "clientId" | "clientSecret">;
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
readonly showProductivityTips: boolean;
|
|
1060
|
-
readonly redirectUrlIfNotAuthenticated?: string;
|
|
1061
|
-
readonly redirectUrlAfterLogout?: string;
|
|
1062
|
-
readonly homepage: string;
|
|
1063
|
-
readonly ide?: {
|
|
1064
|
-
readonly logo: string;
|
|
1065
|
-
readonly showReleaseNotes: boolean;
|
|
1066
|
-
readonly helpMenu: Branding.Link[];
|
|
1067
|
-
}
|
|
1068
|
-
readonly links: {
|
|
1069
|
-
readonly header: Branding.Link[];
|
|
1070
|
-
readonly footer: Branding.Link[];
|
|
1071
|
-
readonly social: Branding.SocialLink[];
|
|
1072
|
-
readonly legal: Branding.Link[];
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
export namespace Branding {
|
|
1076
|
-
export interface Link {
|
|
1077
|
-
readonly name: string;
|
|
1078
|
-
readonly url: string;
|
|
1079
|
-
}
|
|
1080
|
-
export interface SocialLink {
|
|
1081
|
-
readonly type: string;
|
|
1082
|
-
readonly url: string;
|
|
1194
|
+
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
|
|
1195
|
+
return {
|
|
1196
|
+
...entry,
|
|
1197
|
+
oauth: {
|
|
1198
|
+
...entry.oauth,
|
|
1199
|
+
clientSecret: "redacted"
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1083
1202
|
}
|
|
1084
1203
|
}
|
|
1085
1204
|
|
|
@@ -1108,3 +1227,18 @@ export namespace TheiaPlugin {
|
|
|
1108
1227
|
CheckinFailed = "checkin-failed",
|
|
1109
1228
|
}
|
|
1110
1229
|
}
|
|
1230
|
+
|
|
1231
|
+
export interface TermsAcceptanceEntry {
|
|
1232
|
+
readonly userId: string;
|
|
1233
|
+
readonly termsRevision: string;
|
|
1234
|
+
readonly acceptionTime: string;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
export interface Terms {
|
|
1238
|
+
readonly revision: string;
|
|
1239
|
+
readonly activeSince: string;
|
|
1240
|
+
readonly adminOnlyTerms: boolean;
|
|
1241
|
+
readonly updateMessage: string;
|
|
1242
|
+
readonly content: string;
|
|
1243
|
+
readonly formElements?: object;
|
|
1244
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { suite, test } from "mocha-typescript"
|
|
8
|
+
import * as chai from "chai"
|
|
9
|
+
import { SnapshotUrl } from ".";
|
|
10
|
+
|
|
11
|
+
const expect = chai.expect
|
|
12
|
+
|
|
13
|
+
@suite class TestSnapshotUrlParser {
|
|
14
|
+
|
|
15
|
+
@test public testPositive() {
|
|
16
|
+
const actual = SnapshotUrl.parse("workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar@gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd");
|
|
17
|
+
|
|
18
|
+
expect(actual).to.deep.equal(<SnapshotUrl>{
|
|
19
|
+
bucketId: "gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd",
|
|
20
|
+
filename: "3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
|
|
21
|
+
fullPath: "workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
module.exports = new TestSnapshotUrlParser() // Only to circumvent no usage warning :-/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface SnapshotUrl {
|
|
8
|
+
bucketId: string;
|
|
9
|
+
fullPath: string;
|
|
10
|
+
filename: string;
|
|
11
|
+
}
|
|
12
|
+
export namespace SnapshotUrl {
|
|
13
|
+
export function parse(url: string): SnapshotUrl {
|
|
14
|
+
const parts = url.split("@");
|
|
15
|
+
if (parts.length !== 2) {
|
|
16
|
+
throw new Error(`cannot parse snapshot URL: ${url}`);
|
|
17
|
+
}
|
|
18
|
+
const [fullPath, bucketId] = parts;
|
|
19
|
+
|
|
20
|
+
const pathParts = fullPath.split("/");
|
|
21
|
+
if (pathParts.length < 1) {
|
|
22
|
+
throw new Error(`cannot parse snapshot URL: ${url}`);
|
|
23
|
+
}
|
|
24
|
+
const filename = pathParts[pathParts.length - 1];
|
|
25
|
+
return { bucketId, fullPath, filename };
|
|
26
|
+
}
|
|
27
|
+
}
|