@gitpod/gitpod-protocol 0.1.5-svenefftinge-dashboard-invalid-2274.5 → 0.1.5-tar-telemetry-settings-data.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 +31 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +102 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +14 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +94 -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 +165 -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 +105 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/{util/without.js → ide-protocol.js} +2 -2
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +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/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 +10 -5
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +38 -21
- 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 +134 -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 +198 -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 +76 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +33 -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 +53 -0
- package/src/context-url.ts +107 -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 +241 -40
- package/src/headless-workspace-log.ts +8 -12
- package/src/ide-frontend-service.ts +6 -2
- package/src/ide-protocol.ts +119 -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 +26 -11
- package/src/plans.ts +632 -0
- package/src/protocol.ts +223 -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 -18
- package/src/util/workspace-port-authentication.ts +1 -1
- package/src/workspace-cluster.ts +104 -0
- package/src/workspace-instance.ts +52 -14
- package/src/wsready.ts +2 -2
- package/lib/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -46
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/lib/util/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -34
- package/lib/util/safe-promise.js.map +0 -1
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js.map +0 -1
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
package/src/protocol.ts
CHANGED
|
@@ -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,29 @@ 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
|
|
122
|
+
useLatestVersion?: boolean
|
|
100
123
|
}
|
|
101
124
|
|
|
102
125
|
export interface UserPlatform {
|
|
@@ -118,14 +141,6 @@ export interface UserPlatform {
|
|
|
118
141
|
}
|
|
119
142
|
|
|
120
143
|
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
144
|
/**
|
|
130
145
|
* Permanent feature flags are added to each and every workspace instance
|
|
131
146
|
* this user starts.
|
|
@@ -137,15 +152,26 @@ export interface UserFeatureSettings {
|
|
|
137
152
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
138
153
|
* If they don't we'll break things during workspace startup.
|
|
139
154
|
*/
|
|
140
|
-
export const WorkspaceFeatureFlags = { "
|
|
155
|
+
export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
|
|
141
156
|
export type NamedWorkspaceFeatureFlag = keyof (typeof WorkspaceFeatureFlags);
|
|
142
157
|
|
|
143
|
-
export interface
|
|
144
|
-
id?: string;
|
|
158
|
+
export interface EnvVarWithValue {
|
|
145
159
|
name: string;
|
|
146
|
-
repositoryPattern: string;
|
|
147
160
|
value: string;
|
|
148
161
|
}
|
|
162
|
+
|
|
163
|
+
export interface ProjectEnvVarWithValue extends EnvVarWithValue {
|
|
164
|
+
id: string;
|
|
165
|
+
projectId: string;
|
|
166
|
+
censored: boolean;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, 'value'>;
|
|
170
|
+
|
|
171
|
+
export interface UserEnvVarValue extends EnvVarWithValue {
|
|
172
|
+
id?: string;
|
|
173
|
+
repositoryPattern: string; // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
174
|
+
}
|
|
149
175
|
export interface UserEnvVar extends UserEnvVarValue {
|
|
150
176
|
id: string;
|
|
151
177
|
userId: string;
|
|
@@ -154,10 +180,35 @@ export interface UserEnvVar extends UserEnvVarValue {
|
|
|
154
180
|
|
|
155
181
|
export namespace UserEnvVar {
|
|
156
182
|
|
|
183
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
157
184
|
export function normalizeRepoPattern(pattern: string) {
|
|
158
185
|
return pattern.toLocaleLowerCase();
|
|
159
186
|
}
|
|
160
187
|
|
|
188
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
189
|
+
export function score(value: UserEnvVarValue): number {
|
|
190
|
+
// We use a score to enforce precedence:
|
|
191
|
+
// value/value = 0
|
|
192
|
+
// value/* = 1
|
|
193
|
+
// */value = 2
|
|
194
|
+
// */* = 3
|
|
195
|
+
// #/# = 4 (used for env vars passed through the URL)
|
|
196
|
+
// the lower the score, the higher the precedence.
|
|
197
|
+
const [ownerPattern, repoPattern] = splitRepositoryPattern(value.repositoryPattern);
|
|
198
|
+
let score = 0;
|
|
199
|
+
if (repoPattern == "*") {
|
|
200
|
+
score += 1;
|
|
201
|
+
}
|
|
202
|
+
if (ownerPattern == '*') {
|
|
203
|
+
score += 2;
|
|
204
|
+
}
|
|
205
|
+
if (ownerPattern == "#" || repoPattern == "#") {
|
|
206
|
+
score = 4;
|
|
207
|
+
}
|
|
208
|
+
return score;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
161
212
|
export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
|
|
162
213
|
let result = vars.filter(e => {
|
|
163
214
|
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
@@ -193,25 +244,7 @@ export namespace UserEnvVar {
|
|
|
193
244
|
let minscore = 10;
|
|
194
245
|
let bestCandidate: T | undefined;
|
|
195
246
|
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
|
-
|
|
247
|
+
const score = UserEnvVar.score(e);
|
|
215
248
|
if (!bestCandidate || score < minscore) {
|
|
216
249
|
minscore = score;
|
|
217
250
|
bestCandidate = e;
|
|
@@ -223,10 +256,11 @@ export namespace UserEnvVar {
|
|
|
223
256
|
return result;
|
|
224
257
|
}
|
|
225
258
|
|
|
226
|
-
|
|
259
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
260
|
+
export function splitRepositoryPattern(repositoryPattern: string): string[] {
|
|
227
261
|
const patterns = repositoryPattern.split('/');
|
|
228
|
-
const repoPattern = patterns.
|
|
229
|
-
const ownerPattern = patterns
|
|
262
|
+
const repoPattern = patterns.slice(1).join('/')
|
|
263
|
+
const ownerPattern = patterns[0];
|
|
230
264
|
return [ownerPattern, repoPattern];
|
|
231
265
|
}
|
|
232
266
|
}
|
|
@@ -357,11 +391,16 @@ export interface PendingGithubEvent {
|
|
|
357
391
|
export interface Snapshot {
|
|
358
392
|
id: string;
|
|
359
393
|
creationTime: string;
|
|
394
|
+
availableTime?: string;
|
|
360
395
|
originalWorkspaceId: string;
|
|
361
396
|
bucketId: string;
|
|
362
397
|
layoutData?: string;
|
|
398
|
+
state: SnapshotState;
|
|
399
|
+
message?: string;
|
|
363
400
|
}
|
|
364
401
|
|
|
402
|
+
export type SnapshotState = 'pending' | 'available' | 'error';
|
|
403
|
+
|
|
365
404
|
export interface LayoutData {
|
|
366
405
|
workspaceId: string;
|
|
367
406
|
lastUpdatedTime: string;
|
|
@@ -374,6 +413,7 @@ export interface Workspace {
|
|
|
374
413
|
contextURL: string;
|
|
375
414
|
description: string;
|
|
376
415
|
ownerId: string;
|
|
416
|
+
projectId?: string;
|
|
377
417
|
context: WorkspaceContext;
|
|
378
418
|
config: WorkspaceConfig;
|
|
379
419
|
|
|
@@ -482,6 +522,7 @@ export interface PreparePluginUploadParams {
|
|
|
482
522
|
export interface ResolvePluginsParams {
|
|
483
523
|
config?: WorkspaceConfig
|
|
484
524
|
builtins?: ResolvedPlugins
|
|
525
|
+
vsxRegistryUrl?: string
|
|
485
526
|
}
|
|
486
527
|
|
|
487
528
|
export interface InstallPluginsParams {
|
|
@@ -492,6 +533,24 @@ export interface UninstallPluginParams {
|
|
|
492
533
|
pluginId: string;
|
|
493
534
|
}
|
|
494
535
|
|
|
536
|
+
export interface GuessGitTokenScopesParams {
|
|
537
|
+
host: string
|
|
538
|
+
repoUrl: string
|
|
539
|
+
gitCommand: string
|
|
540
|
+
currentToken: GitToken
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export interface GitToken {
|
|
544
|
+
token: string
|
|
545
|
+
user: string
|
|
546
|
+
scopes: string[]
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export interface GuessedGitTokenScopes {
|
|
550
|
+
message?: string
|
|
551
|
+
scopes?: string[]
|
|
552
|
+
}
|
|
553
|
+
|
|
495
554
|
export type ResolvedPluginKind = 'user' | 'workspace' | 'builtin';
|
|
496
555
|
|
|
497
556
|
export interface ResolvedPlugins {
|
|
@@ -517,16 +576,21 @@ export interface WorkspaceConfig {
|
|
|
517
576
|
gitConfig?: { [config: string]: string };
|
|
518
577
|
github?: GithubAppConfig;
|
|
519
578
|
vscode?: VSCodeConfig;
|
|
520
|
-
|
|
579
|
+
|
|
580
|
+
/** deprecated. Enabled by default **/
|
|
581
|
+
experimentalNetwork?: boolean;
|
|
582
|
+
|
|
521
583
|
/**
|
|
522
584
|
* Where the config object originates from.
|
|
523
|
-
*
|
|
585
|
+
*
|
|
524
586
|
* repo - from the repository
|
|
587
|
+
* project-db - from the "Project" stored in the database
|
|
525
588
|
* definitly-gp - from github.com/gitpod-io/definitely-gp
|
|
526
589
|
* derived - computed based on analyzing the repository
|
|
590
|
+
* additional-content - config comes from additional content, usually provided through the project's configuration
|
|
527
591
|
* default - our static catch-all default config
|
|
528
592
|
*/
|
|
529
|
-
_origin?: 'repo' | 'definitely-gp' | 'derived' | 'default';
|
|
593
|
+
_origin?: 'repo' | 'project-db' | 'definitely-gp' | 'derived' | 'additional-content' | 'default';
|
|
530
594
|
|
|
531
595
|
/**
|
|
532
596
|
* Set of automatically infered feature flags. That's not something the user can set, but
|
|
@@ -543,7 +607,7 @@ export interface GithubAppPrebuildConfig {
|
|
|
543
607
|
branches?: boolean
|
|
544
608
|
pullRequests?: boolean
|
|
545
609
|
pullRequestsFromForks?: boolean
|
|
546
|
-
addCheck?: boolean
|
|
610
|
+
addCheck?: boolean | 'prevent-merge-on-error'
|
|
547
611
|
addBadge?: boolean
|
|
548
612
|
addLabel?: boolean | string
|
|
549
613
|
addComment?: boolean
|
|
@@ -556,16 +620,13 @@ export namespace GithubAppPrebuildConfig {
|
|
|
556
620
|
|
|
557
621
|
export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
|
|
558
622
|
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
623
|
dockerFilePath: string
|
|
624
|
+
dockerFileHash: string
|
|
625
|
+
dockerFileSource?: Commit
|
|
564
626
|
}
|
|
565
627
|
export namespace WorkspaceImageSourceDocker {
|
|
566
628
|
export function is(obj: object): obj is WorkspaceImageSourceDocker {
|
|
567
629
|
return 'dockerFileHash' in obj
|
|
568
|
-
&& 'dockerFileSource' in obj
|
|
569
630
|
&& 'dockerFilePath' in obj;
|
|
570
631
|
}
|
|
571
632
|
}
|
|
@@ -594,6 +655,8 @@ export type PrebuiltWorkspaceState
|
|
|
594
655
|
export interface PrebuiltWorkspace {
|
|
595
656
|
id: string;
|
|
596
657
|
cloneURL: string;
|
|
658
|
+
branch?: string;
|
|
659
|
+
projectId?: string;
|
|
597
660
|
commit: string;
|
|
598
661
|
buildWorkspaceId: string;
|
|
599
662
|
creationTime: string;
|
|
@@ -604,7 +667,7 @@ export interface PrebuiltWorkspace {
|
|
|
604
667
|
|
|
605
668
|
export namespace PrebuiltWorkspace {
|
|
606
669
|
export function isDone(pws: PrebuiltWorkspace) {
|
|
607
|
-
return pws.state === "available" || pws.state === "timeout" ||
|
|
670
|
+
return pws.state === "available" || pws.state === "timeout" || pws.state === 'aborted';
|
|
608
671
|
}
|
|
609
672
|
|
|
610
673
|
export function isAvailable(pws: PrebuiltWorkspace) {
|
|
@@ -640,6 +703,8 @@ export interface PortConfig {
|
|
|
640
703
|
port: number;
|
|
641
704
|
onOpen?: PortOnOpen;
|
|
642
705
|
visibility?: PortVisibility;
|
|
706
|
+
description?: string;
|
|
707
|
+
name?: string;
|
|
643
708
|
}
|
|
644
709
|
export namespace PortConfig {
|
|
645
710
|
export function is(config: any): config is PortConfig {
|
|
@@ -663,7 +728,7 @@ export interface TaskConfig {
|
|
|
663
728
|
init?: string;
|
|
664
729
|
prebuild?: string;
|
|
665
730
|
command?: string;
|
|
666
|
-
env?: { [env: string]:
|
|
731
|
+
env?: { [env: string]: any };
|
|
667
732
|
openIn?: 'bottom' | 'main' | 'left' | 'right';
|
|
668
733
|
openMode?: 'split-top' | 'split-left' | 'split-right' | 'split-bottom' | 'tab-before' | 'tab-after';
|
|
669
734
|
}
|
|
@@ -727,8 +792,10 @@ export namespace ExternalImageConfigFile {
|
|
|
727
792
|
|
|
728
793
|
export interface WorkspaceContext {
|
|
729
794
|
title: string;
|
|
795
|
+
/** 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
796
|
normalizedContextURL?: string;
|
|
731
797
|
forceCreateNewWorkspace?: boolean;
|
|
798
|
+
forceImageBuild?: boolean;
|
|
732
799
|
}
|
|
733
800
|
|
|
734
801
|
export namespace WorkspaceContext {
|
|
@@ -762,6 +829,29 @@ export namespace WithPrebuild {
|
|
|
762
829
|
}
|
|
763
830
|
}
|
|
764
831
|
|
|
832
|
+
/**
|
|
833
|
+
* WithDefaultConfig contexts disable the download of the gitpod.yml from the repository
|
|
834
|
+
* and fall back to the built-in configuration.
|
|
835
|
+
*/
|
|
836
|
+
export interface WithDefaultConfig {
|
|
837
|
+
withDefaultConfig: true;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
export namespace WithDefaultConfig {
|
|
841
|
+
export function is(context: any): context is WithDefaultConfig {
|
|
842
|
+
return context
|
|
843
|
+
&& 'withDefaultConfig' in context
|
|
844
|
+
&& context.withDefaultConfig;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
|
|
848
|
+
return {
|
|
849
|
+
...ctx,
|
|
850
|
+
withDefaultConfig: true
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
765
855
|
export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
|
|
766
856
|
snapshotId: string;
|
|
767
857
|
}
|
|
@@ -776,6 +866,9 @@ export namespace SnapshotContext {
|
|
|
776
866
|
|
|
777
867
|
export interface StartPrebuildContext extends WorkspaceContext {
|
|
778
868
|
actual: WorkspaceContext;
|
|
869
|
+
commitHistory?: string[];
|
|
870
|
+
project?: Project;
|
|
871
|
+
branch?: string;
|
|
779
872
|
}
|
|
780
873
|
|
|
781
874
|
export namespace StartPrebuildContext {
|
|
@@ -799,8 +892,20 @@ export namespace PrebuiltWorkspaceContext {
|
|
|
799
892
|
}
|
|
800
893
|
}
|
|
801
894
|
|
|
895
|
+
export interface WithReferrerContext extends WorkspaceContext {
|
|
896
|
+
referrer: string
|
|
897
|
+
referrerIde?: string
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
export namespace WithReferrerContext {
|
|
901
|
+
export function is(context: any): context is WithReferrerContext {
|
|
902
|
+
return context
|
|
903
|
+
&& 'referrer' in context;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
802
907
|
export interface WithEnvvarsContext extends WorkspaceContext {
|
|
803
|
-
envvars:
|
|
908
|
+
envvars: EnvVarWithValue[];
|
|
804
909
|
}
|
|
805
910
|
|
|
806
911
|
export namespace WithEnvvarsContext {
|
|
@@ -845,6 +950,25 @@ export interface Commit {
|
|
|
845
950
|
refType?: RefType
|
|
846
951
|
}
|
|
847
952
|
|
|
953
|
+
export interface AdditionalContentContext extends WorkspaceContext {
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* utf-8 encoded contents that will be copied on top of the workspace's filesystem
|
|
957
|
+
*/
|
|
958
|
+
additionalFiles: {[filePath: string]: string};
|
|
959
|
+
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
export namespace AdditionalContentContext {
|
|
963
|
+
export function is(ctx: any): ctx is AdditionalContentContext {
|
|
964
|
+
return 'additionalFiles' in ctx;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
|
|
968
|
+
return is(ctx) && ImageConfigFile.is(config.image) && !!ctx.additionalFiles[config.image.file];
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
|
|
848
972
|
export interface CommitContext extends WorkspaceContext, Commit {
|
|
849
973
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
850
974
|
cloneUrl?: string
|
|
@@ -920,6 +1044,19 @@ export interface Repository {
|
|
|
920
1044
|
parent: Repository
|
|
921
1045
|
}
|
|
922
1046
|
}
|
|
1047
|
+
export interface Branch {
|
|
1048
|
+
name: string;
|
|
1049
|
+
commit: CommitInfo;
|
|
1050
|
+
htmlUrl: string;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
export interface CommitInfo {
|
|
1054
|
+
author: string;
|
|
1055
|
+
sha: string;
|
|
1056
|
+
commitMessage: string;
|
|
1057
|
+
authorAvatarUrl?: string;
|
|
1058
|
+
authorDate?: string;
|
|
1059
|
+
}
|
|
923
1060
|
|
|
924
1061
|
export namespace Repository {
|
|
925
1062
|
export function fullRepoName(repo: Repository): string {
|
|
@@ -947,6 +1084,12 @@ export interface WorkspaceInfo {
|
|
|
947
1084
|
latestInstance?: WorkspaceInstance
|
|
948
1085
|
}
|
|
949
1086
|
|
|
1087
|
+
export namespace WorkspaceInfo {
|
|
1088
|
+
export function lastActiveISODate(info: WorkspaceInfo): string {
|
|
1089
|
+
return info.latestInstance?.creationTime || info.workspace.creationTime;
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
|
|
950
1093
|
export type RunningWorkspaceInfo = WorkspaceInfo & { latestInstance: WorkspaceInstance };
|
|
951
1094
|
|
|
952
1095
|
export interface WorkspaceCreationResult {
|
|
@@ -956,6 +1099,7 @@ export interface WorkspaceCreationResult {
|
|
|
956
1099
|
runningWorkspacePrebuild?: {
|
|
957
1100
|
prebuildID: string
|
|
958
1101
|
workspaceID: string
|
|
1102
|
+
instanceID: string
|
|
959
1103
|
starting: RunningWorkspacePrebuildStarting
|
|
960
1104
|
sameCluster: boolean
|
|
961
1105
|
}
|
|
@@ -1046,40 +1190,16 @@ export interface OAuth2Config {
|
|
|
1046
1190
|
export namespace AuthProviderEntry {
|
|
1047
1191
|
export type Type = "GitHub" | "GitLab" | string;
|
|
1048
1192
|
export type Status = "pending" | "verified";
|
|
1049
|
-
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"
|
|
1193
|
+
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & { clientId?: string, clientSecret?: string };
|
|
1050
1194
|
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;
|
|
1195
|
+
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
|
|
1196
|
+
return {
|
|
1197
|
+
...entry,
|
|
1198
|
+
oauth: {
|
|
1199
|
+
...entry.oauth,
|
|
1200
|
+
clientSecret: "redacted"
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1083
1203
|
}
|
|
1084
1204
|
}
|
|
1085
1205
|
|
|
@@ -1108,3 +1228,18 @@ export namespace TheiaPlugin {
|
|
|
1108
1228
|
CheckinFailed = "checkin-failed",
|
|
1109
1229
|
}
|
|
1110
1230
|
}
|
|
1231
|
+
|
|
1232
|
+
export interface TermsAcceptanceEntry {
|
|
1233
|
+
readonly userId: string;
|
|
1234
|
+
readonly termsRevision: string;
|
|
1235
|
+
readonly acceptionTime: string;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
export interface Terms {
|
|
1239
|
+
readonly revision: string;
|
|
1240
|
+
readonly activeSince: string;
|
|
1241
|
+
readonly adminOnlyTerms: boolean;
|
|
1242
|
+
readonly updateMessage: string;
|
|
1243
|
+
readonly content: string;
|
|
1244
|
+
readonly formElements?: object;
|
|
1245
|
+
}
|
|
@@ -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
|
+
}
|