@gitpod/gitpod-protocol 0.1.5-wth-test.80 → 0.1.5-wv-remove-without-ws-flag.5
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 +132 -5
- package/lib/accounting-protocol.d.ts +19 -11
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +35 -33
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +19 -2
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +1 -1
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/attribution.d.ts +24 -0
- package/lib/attribution.d.ts.map +1 -0
- package/lib/attribution.js +54 -0
- package/lib/attribution.js.map +1 -0
- package/lib/auth.d.ts +1 -1
- package/lib/auth.d.ts.map +1 -1
- package/lib/auth.js +1 -1
- package/lib/billing-mode.d.ts +45 -0
- package/lib/billing-mode.d.ts.map +1 -0
- package/lib/billing-mode.js +44 -0
- package/lib/billing-mode.js.map +1 -0
- package/lib/blocked-repositories-protocol.d.ts +13 -0
- package/lib/blocked-repositories-protocol.d.ts.map +1 -0
- package/lib/blocked-repositories-protocol.js +8 -0
- package/lib/blocked-repositories-protocol.js.map +1 -0
- package/lib/context-url.d.ts +1 -2
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +5 -7
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +1 -3
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +13 -26
- package/lib/context-url.spec.js.map +1 -1
- package/lib/encryption/container-module.d.ts +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +2 -2
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +10 -10
- 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.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +3 -4
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +2 -2
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +8 -10
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +1 -6
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +2 -21
- package/lib/env.js.map +1 -1
- package/lib/experiments/always-default.d.ts +8 -0
- package/lib/experiments/always-default.d.ts.map +1 -0
- package/lib/experiments/always-default.js +20 -0
- package/lib/experiments/always-default.js.map +1 -0
- package/lib/experiments/configcat-server.d.ts +10 -0
- package/lib/experiments/configcat-server.d.ts.map +1 -0
- package/lib/experiments/configcat-server.js +37 -0
- package/lib/experiments/configcat-server.js.map +1 -0
- package/lib/experiments/configcat.d.ts +21 -0
- package/lib/experiments/configcat.d.ts.map +1 -0
- package/lib/experiments/configcat.js +51 -0
- package/lib/experiments/configcat.js.map +1 -0
- package/lib/experiments/types.d.ts +22 -0
- package/lib/experiments/types.d.ts.map +1 -0
- package/lib/experiments/types.js +10 -0
- package/lib/experiments/types.js.map +1 -0
- package/lib/frontend-dashboard-service.d.ts +90 -0
- package/lib/frontend-dashboard-service.d.ts.map +1 -0
- package/lib/frontend-dashboard-service.js +49 -0
- package/lib/frontend-dashboard-service.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +7 -7
- 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 +43 -40
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +73 -55
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +61 -34
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +2 -1
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +3 -2
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +2 -2
- package/lib/ide-frontend-service.js +1 -1
- package/lib/ide-protocol.d.ts +29 -8
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/ide-protocol.js +11 -1
- package/lib/ide-protocol.js.map +1 -1
- package/lib/index.d.ts +17 -17
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +4 -1
- package/lib/installation-admin-protocol.d.ts.map +1 -1
- package/lib/installation-admin-protocol.js +4 -3
- package/lib/installation-admin-protocol.js.map +1 -1
- package/lib/license-protocol.d.ts +8 -1
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js +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 +5 -5
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +10 -7
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +5 -19
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +35 -23
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +10 -2
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +20 -4
- 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/oss-allowlist.d.ts +1 -1
- package/lib/oss-allowlist.js +1 -1
- package/lib/payment-protocol.d.ts +1 -1
- package/lib/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +2 -2
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +7 -4
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +16 -24
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +5 -4
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +211 -172
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +167 -61
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +282 -106
- package/lib/protocol.js.map +1 -1
- package/lib/protocol.spec.d.ts +7 -0
- package/lib/protocol.spec.d.ts.map +1 -0
- package/lib/protocol.spec.js +127 -0
- package/lib/protocol.spec.js.map +1 -0
- package/lib/snapshot-url.d.ts +1 -1
- package/lib/snapshot-url.js +1 -1
- package/lib/snapshot-url.spec.d.ts +1 -1
- package/lib/snapshot-url.spec.js +1 -1
- package/lib/snapshot-url.spec.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +23 -4
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +21 -6
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +29 -6
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +10 -3
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +3 -3
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/typings/globals.js +1 -1
- package/lib/usage.d.ts +73 -0
- package/lib/usage.d.ts.map +1 -0
- package/lib/usage.js +20 -0
- package/lib/usage.js.map +1 -0
- package/lib/util/analytics.d.ts +1 -1
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +7 -7
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +4 -4
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +1 -1
- package/lib/util/cancelable.js +1 -1
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +1 -1
- package/lib/util/date-time.js +7 -7
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/debug-app.d.ts +25 -0
- package/lib/util/debug-app.d.ts.map +1 -0
- package/lib/util/debug-app.js +100 -0
- package/lib/util/debug-app.js.map +1 -0
- 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 +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 +1 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +7 -2
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +5 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +446 -442
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.d.ts +1 -1
- package/lib/util/generate-workspace-id.spec.js +19 -8
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +2 -2
- package/lib/util/gitpod-cookie.d.ts.map +1 -1
- package/lib/util/gitpod-cookie.js +1 -4
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts +12 -3
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +69 -35
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +16 -6
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +21 -1
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js +74 -2
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/jaeger-client-types.d.ts +1 -1
- package/lib/util/jaeger-client-types.d.ts.map +1 -1
- package/lib/util/jaeger-client-types.js +1 -1
- package/lib/util/logging.d.ts +2 -2
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +32 -26
- package/lib/util/logging.js.map +1 -1
- package/lib/util/logging.spec.d.ts +7 -0
- package/lib/util/logging.spec.d.ts.map +1 -0
- package/lib/util/logging.spec.js +52 -0
- package/lib/util/logging.spec.js.map +1 -0
- package/lib/util/make-link.d.ts +1 -1
- package/lib/util/make-link.js +6 -6
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/nice-grpc.d.ts +9 -0
- package/lib/util/nice-grpc.d.ts.map +1 -0
- package/lib/util/nice-grpc.js +121 -0
- package/lib/util/nice-grpc.js.map +1 -0
- package/lib/util/parse-workspace-id.d.ts +1 -1
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +2 -3
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +1 -1
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +1 -1
- package/lib/util/queue.js +1 -1
- package/lib/util/queue.spec.d.ts +1 -1
- package/lib/util/queue.spec.js +10 -7
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeat.d.ts +1 -1
- package/lib/util/repeat.js +1 -1
- package/lib/util/semaphore.d.ts +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +1 -1
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +1 -1
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +3 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +16 -4
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +3 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +35 -1
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +7 -7
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +15 -17
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.d.ts +1 -1
- package/lib/util/tracing.spec.js +4 -4
- package/lib/util/tracing.spec.js.map +1 -1
- package/lib/util/workspace-port-authentication.d.ts +8 -8
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +9 -12
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/webhook-event.d.ts +44 -0
- package/lib/webhook-event.d.ts.map +1 -0
- package/lib/webhook-event.js +8 -0
- package/lib/webhook-event.js.map +1 -0
- package/lib/workspace-class.d.ts +14 -0
- package/lib/workspace-class.d.ts.map +1 -0
- package/lib/workspace-class.js +8 -0
- package/lib/workspace-class.js.map +1 -0
- package/lib/workspace-cluster.d.ts +13 -14
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +3 -5
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +22 -4
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +1 -1
- package/lib/wsready.d.ts +8 -2
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +3 -3
- package/package.json +14 -6
- package/pkg-yarn.lock +10 -5
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +67 -52
- package/src/admin-protocol.ts +48 -22
- package/src/analytics.ts +22 -22
- package/src/attribution.ts +63 -0
- package/src/auth.ts +3 -3
- package/src/billing-mode.ts +84 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +18 -22
- package/src/context-url.ts +79 -79
- package/src/encryption/container-module.ts +3 -4
- package/src/encryption/encryption-engine.spec.ts +10 -9
- package/src/encryption/encryption-engine.ts +21 -17
- package/src/encryption/encryption-service.ts +5 -6
- package/src/encryption/key-provider.ts +17 -20
- package/src/env.ts +2 -25
- package/src/experiments/always-default.ts +24 -0
- package/src/experiments/configcat-server.ts +42 -0
- package/src/experiments/configcat.ts +56 -0
- package/src/experiments/types.ts +34 -0
- package/src/frontend-dashboard-service.ts +125 -0
- package/src/gitpod-file-parser.spec.ts +56 -62
- package/src/gitpod-file-parser.ts +17 -18
- package/src/gitpod-service.ts +224 -142
- package/src/headless-workspace-log.ts +7 -5
- package/src/ide-frontend-service.ts +3 -3
- package/src/ide-protocol.ts +38 -10
- package/src/index.ts +17 -17
- package/src/installation-admin-protocol.ts +12 -9
- package/src/license-protocol.ts +13 -7
- package/src/messaging/browser/connection.ts +45 -47
- package/src/messaging/browser/window-connection.ts +40 -30
- package/src/messaging/client-call-metrics.ts +79 -82
- package/src/messaging/error.ts +30 -8
- 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 +4 -4
- package/src/payment-protocol.ts +3 -3
- package/src/permission.ts +25 -32
- package/src/plans.ts +241 -190
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +527 -265
- package/src/snapshot-url.spec.ts +10 -8
- package/src/snapshot-url.ts +1 -1
- package/src/team-subscription-protocol.ts +60 -23
- package/src/teams-projects-protocol.ts +42 -12
- package/src/typings/globals.ts +6 -5
- package/src/usage.ts +85 -0
- package/src/util/analytics.ts +47 -43
- package/src/util/async-iterator.ts +5 -6
- package/src/util/cancelable.ts +4 -4
- package/src/util/date-time.ts +9 -9
- package/src/util/debug-app.ts +81 -0
- package/src/util/deep-partial.ts +1 -1
- package/src/util/deferred.ts +7 -7
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +9 -7
- package/src/util/generate-workspace-id.spec.ts +27 -17
- package/src/util/generate-workspace-id.ts +461 -455
- package/src/util/gitpod-cookie.ts +9 -10
- package/src/util/gitpod-host-url.spec.ts +41 -14
- package/src/util/gitpod-host-url.ts +82 -39
- package/src/util/grpc.ts +94 -2
- package/src/util/jaeger-client-types.ts +3 -3
- package/src/util/logging.spec.ts +23 -0
- package/src/util/logging.ts +61 -43
- package/src/util/make-link.ts +7 -8
- package/src/util/nice-grpc.ts +96 -0
- package/src/util/parse-workspace-id.spec.ts +18 -9
- package/src/util/parse-workspace-id.ts +6 -7
- package/src/util/queue.spec.ts +28 -26
- package/src/util/queue.ts +1 -1
- package/src/util/repeat.ts +2 -2
- package/src/util/semaphore.ts +5 -7
- package/src/util/skip-if.ts +10 -7
- package/src/util/timeutil.spec.ts +41 -15
- package/src/util/timeutil.ts +28 -12
- package/src/util/tracing.spec.ts +29 -24
- package/src/util/tracing.ts +55 -52
- package/src/util/workspace-port-authentication.ts +11 -14
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +25 -19
- package/src/workspace-instance.ts +67 -25
- package/src/wsready.ts +11 -4
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/email-protocol.d.ts +0 -49
- package/lib/email-protocol.d.ts.map +0 -1
- package/lib/email-protocol.js +0 -28
- package/lib/email-protocol.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 +0 -8
- package/lib/theia-plugins.js.map +0 -1
- package/src/email-protocol.ts +0 -66
- package/src/theia-plugins.ts +0 -11
package/src/protocol.ts
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
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
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.
|
|
@@ -44,38 +45,54 @@ export interface User {
|
|
|
44
45
|
markedDeleted?: boolean;
|
|
45
46
|
|
|
46
47
|
additionalData?: AdditionalUserData;
|
|
48
|
+
|
|
49
|
+
// Identifies an explicit team or user ID to which all the user's workspace usage should be attributed to (e.g. for billing purposes)
|
|
50
|
+
usageAttributionId?: string;
|
|
51
|
+
|
|
52
|
+
// The last time this user got verified somehow. The user is not verified if this is empty.
|
|
53
|
+
lastVerificationTime?: string;
|
|
54
|
+
|
|
55
|
+
// The phone number used for the last phone verification.
|
|
56
|
+
verificationPhoneNumber?: string;
|
|
47
57
|
}
|
|
48
58
|
|
|
49
59
|
export namespace User {
|
|
50
60
|
export function is(data: any): data is User {
|
|
51
|
-
return data
|
|
52
|
-
&& data.hasOwnProperty('id')
|
|
53
|
-
&& data.hasOwnProperty('identities')
|
|
61
|
+
return data && data.hasOwnProperty("id") && data.hasOwnProperty("identities");
|
|
54
62
|
}
|
|
55
63
|
export function getIdentity(user: User, authProviderId: string): Identity | undefined {
|
|
56
|
-
return user.identities.find(id => id.authProviderId === authProviderId);
|
|
64
|
+
return user.identities.find((id) => id.authProviderId === authProviderId);
|
|
57
65
|
}
|
|
58
66
|
export function censor(user: User): User {
|
|
59
67
|
const res = { ...user };
|
|
60
|
-
delete
|
|
61
|
-
res.identities = res.identities.map(i => {
|
|
62
|
-
delete
|
|
68
|
+
delete res.additionalData;
|
|
69
|
+
res.identities = res.identities.map((i) => {
|
|
70
|
+
delete i.tokens;
|
|
63
71
|
|
|
64
72
|
// The user field is not in the Identity shape, but actually exists on DBIdentity.
|
|
65
73
|
// Trying to push this object out via JSON RPC will fail because of the cyclic nature
|
|
66
74
|
// of this field.
|
|
67
|
-
delete (
|
|
75
|
+
delete (i as any).user;
|
|
68
76
|
return i;
|
|
69
77
|
});
|
|
70
78
|
return res;
|
|
71
79
|
}
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Returns the stored email or if it doesn't exist returns the primaryEmail of the first identity this user signed up with.
|
|
83
|
+
* @param user
|
|
84
|
+
* @returns A primaryEmail, or undefined if there is none.
|
|
85
|
+
*/
|
|
86
|
+
export function getPrimaryEmail(user: User): string | undefined {
|
|
87
|
+
if (user.additionalData?.profile?.emailAddress) {
|
|
88
|
+
return user.additionalData?.profile?.emailAddress;
|
|
89
|
+
}
|
|
90
|
+
const identities = user.identities.filter((i) => !!i.primaryEmail);
|
|
74
91
|
if (identities.length <= 0) {
|
|
75
|
-
|
|
92
|
+
return undefined;
|
|
76
93
|
}
|
|
77
94
|
|
|
78
|
-
return identities[0].primaryEmail
|
|
95
|
+
return identities[0].primaryEmail || undefined;
|
|
79
96
|
}
|
|
80
97
|
export function getName(user: User): string | undefined {
|
|
81
98
|
const name = user.fullName || user.name;
|
|
@@ -90,6 +107,91 @@ export namespace User {
|
|
|
90
107
|
}
|
|
91
108
|
return undefined;
|
|
92
109
|
}
|
|
110
|
+
|
|
111
|
+
export function hasPreferredIde(user: User) {
|
|
112
|
+
return (
|
|
113
|
+
typeof user?.additionalData?.ideSettings?.defaultIde !== "undefined" ||
|
|
114
|
+
typeof user?.additionalData?.ideSettings?.useLatestVersion !== "undefined"
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function isOnboardingUser(user: User) {
|
|
119
|
+
return !hasPreferredIde(user);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function migrationIDESettings(user: User) {
|
|
123
|
+
if (
|
|
124
|
+
!user?.additionalData?.ideSettings ||
|
|
125
|
+
Object.keys(user.additionalData.ideSettings).length === 0 ||
|
|
126
|
+
user.additionalData.ideSettings.settingVersion === "2.0"
|
|
127
|
+
) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const newIDESettings: IDESettings = {
|
|
131
|
+
settingVersion: "2.0",
|
|
132
|
+
};
|
|
133
|
+
const ideSettings = user.additionalData.ideSettings;
|
|
134
|
+
if (ideSettings.useDesktopIde) {
|
|
135
|
+
if (ideSettings.defaultDesktopIde === "code-desktop") {
|
|
136
|
+
newIDESettings.defaultIde = "code-desktop";
|
|
137
|
+
} else if (ideSettings.defaultDesktopIde === "code-desktop-insiders") {
|
|
138
|
+
newIDESettings.defaultIde = "code-desktop";
|
|
139
|
+
newIDESettings.useLatestVersion = true;
|
|
140
|
+
} else {
|
|
141
|
+
newIDESettings.defaultIde = ideSettings.defaultDesktopIde;
|
|
142
|
+
newIDESettings.useLatestVersion = ideSettings.useLatestVersion;
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
const useLatest = ideSettings.defaultIde === "code-latest";
|
|
146
|
+
newIDESettings.defaultIde = "code";
|
|
147
|
+
newIDESettings.useLatestVersion = useLatest;
|
|
148
|
+
}
|
|
149
|
+
user.additionalData.ideSettings = newIDESettings;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function getProfile(user: User): Profile {
|
|
153
|
+
return {
|
|
154
|
+
name: User.getName(user!) || "",
|
|
155
|
+
email: User.getPrimaryEmail(user!) || "",
|
|
156
|
+
company: user?.additionalData?.profile?.companyName,
|
|
157
|
+
avatarURL: user?.avatarUrl,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function setProfile(user: User, profile: Profile): User {
|
|
162
|
+
user.fullName = profile.name;
|
|
163
|
+
user.avatarUrl = profile.avatarURL;
|
|
164
|
+
|
|
165
|
+
if (!user.additionalData) {
|
|
166
|
+
user.additionalData = {};
|
|
167
|
+
}
|
|
168
|
+
if (!user.additionalData.profile) {
|
|
169
|
+
user.additionalData.profile = {};
|
|
170
|
+
}
|
|
171
|
+
user.additionalData.profile.emailAddress = profile.email;
|
|
172
|
+
user.additionalData.profile.companyName = profile.company;
|
|
173
|
+
user.additionalData.profile.lastUpdatedDetailsNudge = new Date().toISOString();
|
|
174
|
+
|
|
175
|
+
return user;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// The actual Profile of a User
|
|
179
|
+
export interface Profile {
|
|
180
|
+
name: string;
|
|
181
|
+
email: string;
|
|
182
|
+
company?: string;
|
|
183
|
+
avatarURL?: string;
|
|
184
|
+
}
|
|
185
|
+
export namespace Profile {
|
|
186
|
+
export function hasChanges(before: Profile, after: Profile) {
|
|
187
|
+
return (
|
|
188
|
+
before.name !== after.name ||
|
|
189
|
+
before.email !== after.email ||
|
|
190
|
+
before.company !== after.company ||
|
|
191
|
+
before.avatarURL !== after.avatarURL
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
93
195
|
}
|
|
94
196
|
|
|
95
197
|
export interface AdditionalUserData {
|
|
@@ -98,15 +200,45 @@ export interface AdditionalUserData {
|
|
|
98
200
|
featurePreview?: boolean;
|
|
99
201
|
ideSettings?: IDESettings;
|
|
100
202
|
// key is the name of the news, string the iso date when it was seen
|
|
101
|
-
whatsNewSeen?: { [key: string]: string }
|
|
203
|
+
whatsNewSeen?: { [key: string]: string };
|
|
102
204
|
// key is the name of the OAuth client i.e. local app, string the iso date when it was approved
|
|
103
205
|
// TODO(rl): provide a management UX to allow rescinding of approval
|
|
104
|
-
oauthClientsApproved?: { [key: string]: string }
|
|
206
|
+
oauthClientsApproved?: { [key: string]: string };
|
|
105
207
|
// to remember GH Orgs the user installed/updated the GH App for
|
|
106
208
|
knownGitHubOrgs?: string[];
|
|
107
|
-
|
|
108
209
|
// Git clone URL pointing to the user's dotfile repo
|
|
109
210
|
dotfileRepo?: string;
|
|
211
|
+
// preferred workspace classes
|
|
212
|
+
workspaceClasses?: WorkspaceClasses;
|
|
213
|
+
// additional user profile data
|
|
214
|
+
profile?: ProfileDetails;
|
|
215
|
+
// whether the user has been migrated to team attribution.
|
|
216
|
+
// a corresponding feature flag (team_only_attribution) triggers the migration.
|
|
217
|
+
isMigratedToTeamOnlyAttribution?: boolean;
|
|
218
|
+
}
|
|
219
|
+
export namespace AdditionalUserData {
|
|
220
|
+
export function set(user: User, partialData: Partial<AdditionalUserData>): User {
|
|
221
|
+
if (!user.additionalData) {
|
|
222
|
+
user.additionalData = {
|
|
223
|
+
...partialData,
|
|
224
|
+
};
|
|
225
|
+
} else {
|
|
226
|
+
user.additionalData = {
|
|
227
|
+
...user.additionalData,
|
|
228
|
+
...partialData,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
return user;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// The format in which we store User Profiles in
|
|
235
|
+
export interface ProfileDetails {
|
|
236
|
+
// when was the last time the user updated their profile information or has been nudged to do so.
|
|
237
|
+
lastUpdatedDetailsNudge?: string;
|
|
238
|
+
// the user's company name
|
|
239
|
+
companyName?: string;
|
|
240
|
+
// the user's email
|
|
241
|
+
emailAddress?: string;
|
|
110
242
|
}
|
|
111
243
|
|
|
112
244
|
export interface EmailNotificationSettings {
|
|
@@ -116,10 +248,18 @@ export interface EmailNotificationSettings {
|
|
|
116
248
|
}
|
|
117
249
|
|
|
118
250
|
export type IDESettings = {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
251
|
+
settingVersion?: string;
|
|
252
|
+
defaultIde?: string;
|
|
253
|
+
// DEPRECATED: Use defaultIde after `settingVersion: 2.0`, no more specialify desktop or browser.
|
|
254
|
+
useDesktopIde?: boolean;
|
|
255
|
+
// DEPRECATED: Same with useDesktopIde.
|
|
256
|
+
defaultDesktopIde?: string;
|
|
257
|
+
useLatestVersion?: boolean;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export interface WorkspaceClasses {
|
|
261
|
+
regular?: string;
|
|
262
|
+
prebuild?: string;
|
|
123
263
|
}
|
|
124
264
|
|
|
125
265
|
export interface UserPlatform {
|
|
@@ -148,12 +288,25 @@ export interface UserFeatureSettings {
|
|
|
148
288
|
permanentWSFeatureFlags?: NamedWorkspaceFeatureFlag[];
|
|
149
289
|
}
|
|
150
290
|
|
|
291
|
+
export type BillingTier = "paid" | "free";
|
|
292
|
+
|
|
151
293
|
/**
|
|
152
294
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
153
295
|
* If they don't we'll break things during workspace startup.
|
|
154
296
|
*/
|
|
155
|
-
export const WorkspaceFeatureFlags = {
|
|
156
|
-
|
|
297
|
+
export const WorkspaceFeatureFlags = {
|
|
298
|
+
full_workspace_backup: undefined,
|
|
299
|
+
workspace_class_limiting: undefined,
|
|
300
|
+
workspace_connection_limiting: undefined,
|
|
301
|
+
workspace_psi: undefined,
|
|
302
|
+
};
|
|
303
|
+
export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
|
|
304
|
+
export namespace NamedWorkspaceFeatureFlag {
|
|
305
|
+
export const WORKSPACE_PERSISTED_FEATTURE_FLAGS: NamedWorkspaceFeatureFlag[] = ["full_workspace_backup"];
|
|
306
|
+
export function isWorkspacePersisted(ff: NamedWorkspaceFeatureFlag): boolean {
|
|
307
|
+
return WORKSPACE_PERSISTED_FEATTURE_FLAGS.includes(ff);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
157
310
|
|
|
158
311
|
export interface EnvVarWithValue {
|
|
159
312
|
name: string;
|
|
@@ -166,7 +319,7 @@ export interface ProjectEnvVarWithValue extends EnvVarWithValue {
|
|
|
166
319
|
censored: boolean;
|
|
167
320
|
}
|
|
168
321
|
|
|
169
|
-
export type ProjectEnvVar = Omit<ProjectEnvVarWithValue,
|
|
322
|
+
export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, "value">;
|
|
170
323
|
|
|
171
324
|
export interface UserEnvVarValue extends EnvVarWithValue {
|
|
172
325
|
id?: string;
|
|
@@ -179,6 +332,44 @@ export interface UserEnvVar extends UserEnvVarValue {
|
|
|
179
332
|
}
|
|
180
333
|
|
|
181
334
|
export namespace UserEnvVar {
|
|
335
|
+
/**
|
|
336
|
+
* @param variable
|
|
337
|
+
* @returns Either a string containing an error message or undefined.
|
|
338
|
+
*/
|
|
339
|
+
export function validate(variable: UserEnvVarValue): string | undefined {
|
|
340
|
+
const name = variable.name;
|
|
341
|
+
const pattern = variable.repositoryPattern;
|
|
342
|
+
if (name.trim() === "") {
|
|
343
|
+
return "Name must not be empty.";
|
|
344
|
+
}
|
|
345
|
+
if (name.length > 255) {
|
|
346
|
+
return "Name too long. Maximum name length is 255 characters.";
|
|
347
|
+
}
|
|
348
|
+
if (!/^[a-zA-Z_]+[a-zA-Z0-9_]*$/.test(name)) {
|
|
349
|
+
return "Name must match /^[a-zA-Z_]+[a-zA-Z0-9_]*$/.";
|
|
350
|
+
}
|
|
351
|
+
if (variable.value.trim() === "") {
|
|
352
|
+
return "Value must not be empty.";
|
|
353
|
+
}
|
|
354
|
+
if (variable.value.length > 32767) {
|
|
355
|
+
return "Value too long. Maximum value length is 32767 characters.";
|
|
356
|
+
}
|
|
357
|
+
if (pattern.trim() === "") {
|
|
358
|
+
return "Scope must not be empty.";
|
|
359
|
+
}
|
|
360
|
+
const split = pattern.split("/");
|
|
361
|
+
if (split.length < 2) {
|
|
362
|
+
return "A scope must use the form 'organization/repo'.";
|
|
363
|
+
}
|
|
364
|
+
for (const name of split) {
|
|
365
|
+
if (name !== "*") {
|
|
366
|
+
if (!/^[a-zA-Z0-9_\-.\*]+$/.test(name)) {
|
|
367
|
+
return "Invalid scope segment. Only ASCII characters, numbers, -, _, . or * are allowed.";
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return undefined;
|
|
372
|
+
}
|
|
182
373
|
|
|
183
374
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
184
375
|
export function normalizeRepoPattern(pattern: string) {
|
|
@@ -199,7 +390,7 @@ export namespace UserEnvVar {
|
|
|
199
390
|
if (repoPattern == "*") {
|
|
200
391
|
score += 1;
|
|
201
392
|
}
|
|
202
|
-
if (ownerPattern ==
|
|
393
|
+
if (ownerPattern == "*") {
|
|
203
394
|
score += 2;
|
|
204
395
|
}
|
|
205
396
|
if (ownerPattern == "#" || repoPattern == "#") {
|
|
@@ -210,20 +401,20 @@ export namespace UserEnvVar {
|
|
|
210
401
|
|
|
211
402
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
212
403
|
export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
|
|
213
|
-
let result = vars.filter(e => {
|
|
404
|
+
let result = vars.filter((e) => {
|
|
214
405
|
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
215
|
-
if (ownerPattern !==
|
|
406
|
+
if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
|
|
216
407
|
return false;
|
|
217
408
|
}
|
|
218
|
-
if (repoPattern !==
|
|
409
|
+
if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
|
|
219
410
|
return false;
|
|
220
411
|
}
|
|
221
412
|
return true;
|
|
222
413
|
});
|
|
223
414
|
|
|
224
415
|
const resmap = new Map<string, T[]>();
|
|
225
|
-
result.forEach(e => {
|
|
226
|
-
const l =
|
|
416
|
+
result.forEach((e) => {
|
|
417
|
+
const l = resmap.get(e.name) || [];
|
|
227
418
|
l.push(e);
|
|
228
419
|
resmap.set(e.name, l);
|
|
229
420
|
});
|
|
@@ -258,46 +449,107 @@ export namespace UserEnvVar {
|
|
|
258
449
|
|
|
259
450
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
260
451
|
export function splitRepositoryPattern(repositoryPattern: string): string[] {
|
|
261
|
-
const patterns = repositoryPattern.split(
|
|
262
|
-
const repoPattern = patterns.slice(1).join(
|
|
452
|
+
const patterns = repositoryPattern.split("/");
|
|
453
|
+
const repoPattern = patterns.slice(1).join("/");
|
|
263
454
|
const ownerPattern = patterns[0];
|
|
264
455
|
return [ownerPattern, repoPattern];
|
|
265
456
|
}
|
|
266
457
|
}
|
|
267
458
|
|
|
268
|
-
export interface
|
|
459
|
+
export interface SSHPublicKeyValue {
|
|
460
|
+
name: string;
|
|
461
|
+
key: string;
|
|
462
|
+
}
|
|
463
|
+
export interface UserSSHPublicKey extends SSHPublicKeyValue {
|
|
464
|
+
id: string;
|
|
465
|
+
key: string;
|
|
466
|
+
userId: string;
|
|
467
|
+
fingerprint: string;
|
|
468
|
+
creationTime: string;
|
|
469
|
+
lastUsedTime?: string;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export type UserSSHPublicKeyValue = Omit<UserSSHPublicKey, "userId">;
|
|
473
|
+
|
|
474
|
+
export namespace SSHPublicKeyValue {
|
|
475
|
+
export function validate(value: SSHPublicKeyValue): string | undefined {
|
|
476
|
+
if (value.name.length === 0) {
|
|
477
|
+
return "Title must not be empty.";
|
|
478
|
+
}
|
|
479
|
+
if (value.name.length > 255) {
|
|
480
|
+
return "Title too long. Maximum value length is 255 characters.";
|
|
481
|
+
}
|
|
482
|
+
if (value.key.length === 0) {
|
|
483
|
+
return "Key must not be empty.";
|
|
484
|
+
}
|
|
485
|
+
try {
|
|
486
|
+
getData(value);
|
|
487
|
+
} catch (e) {
|
|
488
|
+
return "Key is invalid. You must supply a key in OpenSSH public key format.";
|
|
489
|
+
}
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
269
492
|
|
|
493
|
+
export function getData(value: SSHPublicKeyValue) {
|
|
494
|
+
// Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'.
|
|
495
|
+
const regex =
|
|
496
|
+
/^(?<type>ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-ed25519|sk-ecdsa-sha2-nistp256@openssh\.com|sk-ssh-ed25519@openssh\.com) (?<key>.*?)( (?<email>.*?))?$/;
|
|
497
|
+
const resultGroup = regex.exec(value.key.trim());
|
|
498
|
+
if (!resultGroup) {
|
|
499
|
+
throw new Error("Key is invalid.");
|
|
500
|
+
}
|
|
501
|
+
return {
|
|
502
|
+
type: resultGroup.groups?.["type"] as string,
|
|
503
|
+
key: resultGroup.groups?.["key"] as string,
|
|
504
|
+
email: resultGroup.groups?.["email"] || undefined,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export function getFingerprint(value: SSHPublicKeyValue) {
|
|
509
|
+
const data = getData(value);
|
|
510
|
+
let buf = Buffer.from(data.key, "base64");
|
|
511
|
+
// gitlab style
|
|
512
|
+
// const hash = createHash("md5").update(buf).digest("hex");
|
|
513
|
+
// github style
|
|
514
|
+
const hash = createHash("sha256").update(buf).digest("base64");
|
|
515
|
+
return hash;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export const MAXIMUM_KEY_LENGTH = 5;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export interface GitpodToken {
|
|
270
522
|
/** Hash value (SHA256) of the token (primary key). */
|
|
271
|
-
tokenHash: string
|
|
523
|
+
tokenHash: string;
|
|
272
524
|
|
|
273
525
|
/** Human readable name of the token */
|
|
274
|
-
name?: string
|
|
526
|
+
name?: string;
|
|
275
527
|
|
|
276
528
|
/** Token kind */
|
|
277
|
-
type: GitpodTokenType
|
|
529
|
+
type: GitpodTokenType;
|
|
278
530
|
|
|
279
531
|
/** The user the token belongs to. */
|
|
280
|
-
user: User
|
|
532
|
+
user: User;
|
|
281
533
|
|
|
282
534
|
/** Scopes (e.g. limition to read-only) */
|
|
283
|
-
scopes: string[]
|
|
535
|
+
scopes: string[];
|
|
284
536
|
|
|
285
537
|
/** Created timestamp */
|
|
286
|
-
created: string
|
|
538
|
+
created: string;
|
|
287
539
|
|
|
288
540
|
// token is deleted on the database and about to be collected by db-sync
|
|
289
|
-
deleted?: boolean
|
|
541
|
+
deleted?: boolean;
|
|
290
542
|
}
|
|
291
543
|
|
|
292
544
|
export enum GitpodTokenType {
|
|
293
545
|
API_AUTH_TOKEN = 0,
|
|
294
|
-
MACHINE_AUTH_TOKEN = 1
|
|
546
|
+
MACHINE_AUTH_TOKEN = 1,
|
|
295
547
|
}
|
|
296
548
|
|
|
297
549
|
export interface OneTimeSecret {
|
|
298
|
-
id: string
|
|
550
|
+
id: string;
|
|
299
551
|
|
|
300
|
-
value: string
|
|
552
|
+
value: string;
|
|
301
553
|
|
|
302
554
|
expirationTime: string;
|
|
303
555
|
|
|
@@ -329,13 +581,12 @@ export type IdentityLookup = Pick<Identity, "authProviderId" | "authId">;
|
|
|
329
581
|
|
|
330
582
|
export namespace Identity {
|
|
331
583
|
export function is(data: any): data is Identity {
|
|
332
|
-
return
|
|
333
|
-
&& data.hasOwnProperty(
|
|
334
|
-
|
|
584
|
+
return (
|
|
585
|
+
data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName")
|
|
586
|
+
);
|
|
335
587
|
}
|
|
336
588
|
export function equals(id1: IdentityLookup, id2: IdentityLookup) {
|
|
337
|
-
return id1.authProviderId === id2.authProviderId
|
|
338
|
-
&& id1.authId === id2.authId
|
|
589
|
+
return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
|
|
339
590
|
}
|
|
340
591
|
}
|
|
341
592
|
|
|
@@ -386,6 +637,7 @@ export interface PendingGithubEvent {
|
|
|
386
637
|
creationDate: Date;
|
|
387
638
|
type: string;
|
|
388
639
|
event: string;
|
|
640
|
+
deleted: boolean;
|
|
389
641
|
}
|
|
390
642
|
|
|
391
643
|
export interface Snapshot {
|
|
@@ -394,18 +646,11 @@ export interface Snapshot {
|
|
|
394
646
|
availableTime?: string;
|
|
395
647
|
originalWorkspaceId: string;
|
|
396
648
|
bucketId: string;
|
|
397
|
-
layoutData?: string;
|
|
398
649
|
state: SnapshotState;
|
|
399
650
|
message?: string;
|
|
400
651
|
}
|
|
401
652
|
|
|
402
|
-
export type SnapshotState =
|
|
403
|
-
|
|
404
|
-
export interface LayoutData {
|
|
405
|
-
workspaceId: string;
|
|
406
|
-
lastUpdatedTime: string;
|
|
407
|
-
layoutData: string;
|
|
408
|
-
}
|
|
653
|
+
export type SnapshotState = "pending" | "available" | "error";
|
|
409
654
|
|
|
410
655
|
export interface Workspace {
|
|
411
656
|
id: string;
|
|
@@ -428,13 +673,13 @@ export interface Workspace {
|
|
|
428
673
|
* The resolved, fix name of the workspace image. We only use this
|
|
429
674
|
* to access the logs during an image build.
|
|
430
675
|
*/
|
|
431
|
-
imageNameResolved?: string
|
|
676
|
+
imageNameResolved?: string;
|
|
432
677
|
|
|
433
678
|
/**
|
|
434
679
|
* The resolved/built fixed named of the base image. This field is only set if the workspace
|
|
435
680
|
* already has its base image built.
|
|
436
681
|
*/
|
|
437
|
-
baseImageNameResolved?: string
|
|
682
|
+
baseImageNameResolved?: string;
|
|
438
683
|
|
|
439
684
|
shareable?: boolean;
|
|
440
685
|
pinned?: boolean;
|
|
@@ -468,20 +713,19 @@ export interface Workspace {
|
|
|
468
713
|
|
|
469
714
|
export type WorkspaceSoftDeletion = "user" | "gc";
|
|
470
715
|
|
|
471
|
-
export type WorkspaceType = "regular" | "prebuild"
|
|
716
|
+
export type WorkspaceType = "regular" | "prebuild";
|
|
472
717
|
|
|
473
718
|
export namespace Workspace {
|
|
474
|
-
|
|
475
719
|
export function getFullRepositoryName(ws: Workspace): string | undefined {
|
|
476
720
|
if (CommitContext.is(ws.context)) {
|
|
477
|
-
return ws.context.repository.owner +
|
|
721
|
+
return ws.context.repository.owner + "/" + ws.context.repository.name;
|
|
478
722
|
}
|
|
479
723
|
return undefined;
|
|
480
724
|
}
|
|
481
725
|
|
|
482
726
|
export function getFullRepositoryUrl(ws: Workspace): string | undefined {
|
|
483
727
|
if (CommitContext.is(ws.context)) {
|
|
484
|
-
return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}
|
|
728
|
+
return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`;
|
|
485
729
|
}
|
|
486
730
|
return undefined;
|
|
487
731
|
}
|
|
@@ -515,59 +759,60 @@ export namespace Workspace {
|
|
|
515
759
|
}
|
|
516
760
|
}
|
|
517
761
|
|
|
518
|
-
export interface PreparePluginUploadParams {
|
|
519
|
-
fullPluginName: string;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
export interface ResolvePluginsParams {
|
|
523
|
-
config?: WorkspaceConfig
|
|
524
|
-
builtins?: ResolvedPlugins
|
|
525
|
-
vsxRegistryUrl?: string
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
export interface InstallPluginsParams {
|
|
529
|
-
pluginIds: string[]
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
export interface UninstallPluginParams {
|
|
533
|
-
pluginId: string;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
762
|
export interface GuessGitTokenScopesParams {
|
|
537
|
-
host: string
|
|
538
|
-
repoUrl: string
|
|
539
|
-
|
|
540
|
-
currentToken: GitToken
|
|
763
|
+
host: string;
|
|
764
|
+
repoUrl: string;
|
|
765
|
+
gitCommand: string;
|
|
766
|
+
currentToken: GitToken;
|
|
541
767
|
}
|
|
542
768
|
|
|
543
769
|
export interface GitToken {
|
|
544
|
-
token: string
|
|
545
|
-
user: string
|
|
546
|
-
scopes: string[]
|
|
770
|
+
token: string;
|
|
771
|
+
user: string;
|
|
772
|
+
scopes: string[];
|
|
547
773
|
}
|
|
548
774
|
|
|
549
775
|
export interface GuessedGitTokenScopes {
|
|
550
|
-
message?: string
|
|
551
|
-
scopes?: string[]
|
|
776
|
+
message?: string;
|
|
777
|
+
scopes?: string[];
|
|
552
778
|
}
|
|
553
779
|
|
|
554
|
-
export
|
|
780
|
+
export interface VSCodeConfig {
|
|
781
|
+
extensions?: string[];
|
|
782
|
+
}
|
|
555
783
|
|
|
556
|
-
export interface
|
|
557
|
-
|
|
784
|
+
export interface JetBrainsConfig {
|
|
785
|
+
intellij?: JetBrainsProductConfig;
|
|
786
|
+
goland?: JetBrainsProductConfig;
|
|
787
|
+
pycharm?: JetBrainsProductConfig;
|
|
788
|
+
phpstorm?: JetBrainsProductConfig;
|
|
789
|
+
rubymine?: JetBrainsProductConfig;
|
|
790
|
+
webstorm?: JetBrainsProductConfig;
|
|
791
|
+
rider?: JetBrainsProductConfig;
|
|
792
|
+
clion?: JetBrainsProductConfig;
|
|
793
|
+
}
|
|
794
|
+
export interface JetBrainsProductConfig {
|
|
795
|
+
prebuilds?: JetBrainsPrebuilds;
|
|
796
|
+
vmoptions?: string;
|
|
797
|
+
}
|
|
798
|
+
export interface JetBrainsPrebuilds {
|
|
799
|
+
version?: "stable" | "latest" | "both";
|
|
558
800
|
}
|
|
559
801
|
|
|
560
|
-
export interface
|
|
561
|
-
fullPluginName: string;
|
|
802
|
+
export interface RepositoryCloneInformation {
|
|
562
803
|
url: string;
|
|
563
|
-
|
|
804
|
+
checkoutLocation?: string;
|
|
564
805
|
}
|
|
565
806
|
|
|
566
|
-
export interface
|
|
567
|
-
|
|
807
|
+
export interface CoreDumpConfig {
|
|
808
|
+
enabled?: boolean;
|
|
809
|
+
softLimit?: number;
|
|
810
|
+
hardLimit?: number;
|
|
568
811
|
}
|
|
569
812
|
|
|
570
813
|
export interface WorkspaceConfig {
|
|
814
|
+
mainConfiguration?: string;
|
|
815
|
+
additionalRepositories?: RepositoryCloneInformation[];
|
|
571
816
|
image?: ImageConfig;
|
|
572
817
|
ports?: PortConfig[];
|
|
573
818
|
tasks?: TaskConfig[];
|
|
@@ -576,6 +821,8 @@ export interface WorkspaceConfig {
|
|
|
576
821
|
gitConfig?: { [config: string]: string };
|
|
577
822
|
github?: GithubAppConfig;
|
|
578
823
|
vscode?: VSCodeConfig;
|
|
824
|
+
jetbrains?: JetBrainsConfig;
|
|
825
|
+
coreDump?: CoreDumpConfig;
|
|
579
826
|
|
|
580
827
|
/** deprecated. Enabled by default **/
|
|
581
828
|
experimentalNetwork?: boolean;
|
|
@@ -584,13 +831,12 @@ export interface WorkspaceConfig {
|
|
|
584
831
|
* Where the config object originates from.
|
|
585
832
|
*
|
|
586
833
|
* repo - from the repository
|
|
587
|
-
* project-db - from the "Project" stored in the database
|
|
588
834
|
* definitly-gp - from github.com/gitpod-io/definitely-gp
|
|
589
835
|
* derived - computed based on analyzing the repository
|
|
590
836
|
* additional-content - config comes from additional content, usually provided through the project's configuration
|
|
591
837
|
* default - our static catch-all default config
|
|
592
838
|
*/
|
|
593
|
-
_origin?:
|
|
839
|
+
_origin?: "repo" | "definitely-gp" | "derived" | "additional-content" | "default";
|
|
594
840
|
|
|
595
841
|
/**
|
|
596
842
|
* Set of automatically infered feature flags. That's not something the user can set, but
|
|
@@ -600,34 +846,33 @@ export interface WorkspaceConfig {
|
|
|
600
846
|
}
|
|
601
847
|
|
|
602
848
|
export interface GithubAppConfig {
|
|
603
|
-
prebuilds?: GithubAppPrebuildConfig
|
|
849
|
+
prebuilds?: GithubAppPrebuildConfig;
|
|
604
850
|
}
|
|
605
851
|
export interface GithubAppPrebuildConfig {
|
|
606
|
-
master?: boolean
|
|
607
|
-
branches?: boolean
|
|
608
|
-
pullRequests?: boolean
|
|
609
|
-
pullRequestsFromForks?: boolean
|
|
610
|
-
addCheck?: boolean |
|
|
611
|
-
addBadge?: boolean
|
|
612
|
-
addLabel?: boolean | string
|
|
613
|
-
addComment?: boolean
|
|
852
|
+
master?: boolean;
|
|
853
|
+
branches?: boolean;
|
|
854
|
+
pullRequests?: boolean;
|
|
855
|
+
pullRequestsFromForks?: boolean;
|
|
856
|
+
addCheck?: boolean | "prevent-merge-on-error";
|
|
857
|
+
addBadge?: boolean;
|
|
858
|
+
addLabel?: boolean | string;
|
|
859
|
+
addComment?: boolean;
|
|
614
860
|
}
|
|
615
861
|
export namespace GithubAppPrebuildConfig {
|
|
616
862
|
export function is(obj: boolean | GithubAppPrebuildConfig): obj is GithubAppPrebuildConfig {
|
|
617
|
-
return !(typeof obj ===
|
|
863
|
+
return !(typeof obj === "boolean");
|
|
618
864
|
}
|
|
619
865
|
}
|
|
620
866
|
|
|
621
867
|
export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
|
|
622
868
|
export interface WorkspaceImageSourceDocker {
|
|
623
|
-
dockerFilePath: string
|
|
624
|
-
dockerFileHash: string
|
|
625
|
-
dockerFileSource?: Commit
|
|
869
|
+
dockerFilePath: string;
|
|
870
|
+
dockerFileHash: string;
|
|
871
|
+
dockerFileSource?: Commit;
|
|
626
872
|
}
|
|
627
873
|
export namespace WorkspaceImageSourceDocker {
|
|
628
874
|
export function is(obj: object): obj is WorkspaceImageSourceDocker {
|
|
629
|
-
return
|
|
630
|
-
&& 'dockerFilePath' in obj;
|
|
875
|
+
return "dockerFileHash" in obj && "dockerFilePath" in obj;
|
|
631
876
|
}
|
|
632
877
|
}
|
|
633
878
|
export interface WorkspaceImageSourceReference {
|
|
@@ -636,21 +881,23 @@ export interface WorkspaceImageSourceReference {
|
|
|
636
881
|
}
|
|
637
882
|
export namespace WorkspaceImageSourceReference {
|
|
638
883
|
export function is(obj: object): obj is WorkspaceImageSourceReference {
|
|
639
|
-
return
|
|
884
|
+
return "baseImageResolved" in obj;
|
|
640
885
|
}
|
|
641
886
|
}
|
|
642
887
|
|
|
643
|
-
export type PrebuiltWorkspaceState
|
|
888
|
+
export type PrebuiltWorkspaceState =
|
|
644
889
|
// the prebuild is queued and may start at anytime
|
|
645
|
-
|
|
890
|
+
| "queued"
|
|
646
891
|
// the workspace prebuild is currently running (i.e. there's a workspace pod deployed)
|
|
647
892
|
| "building"
|
|
648
|
-
// the prebuild
|
|
893
|
+
// the prebuild was aborted
|
|
649
894
|
| "aborted"
|
|
650
895
|
// the prebuild timed out
|
|
651
896
|
| "timeout"
|
|
652
|
-
// the prebuild has finished and a snapshot is available
|
|
653
|
-
| "available"
|
|
897
|
+
// the prebuild has finished (even if a headless task failed) and a snapshot is available
|
|
898
|
+
| "available"
|
|
899
|
+
// the prebuild (headless workspace) failed due to some system error
|
|
900
|
+
| "failed";
|
|
654
901
|
|
|
655
902
|
export interface PrebuiltWorkspace {
|
|
656
903
|
id: string;
|
|
@@ -661,13 +908,16 @@ export interface PrebuiltWorkspace {
|
|
|
661
908
|
buildWorkspaceId: string;
|
|
662
909
|
creationTime: string;
|
|
663
910
|
state: PrebuiltWorkspaceState;
|
|
911
|
+
statusVersion: number;
|
|
664
912
|
error?: string;
|
|
665
913
|
snapshot?: string;
|
|
666
914
|
}
|
|
667
915
|
|
|
668
916
|
export namespace PrebuiltWorkspace {
|
|
669
917
|
export function isDone(pws: PrebuiltWorkspace) {
|
|
670
|
-
return
|
|
918
|
+
return (
|
|
919
|
+
pws.state === "available" || pws.state === "timeout" || pws.state === "aborted" || pws.state === "failed"
|
|
920
|
+
);
|
|
671
921
|
}
|
|
672
922
|
|
|
673
923
|
export function isAvailable(pws: PrebuiltWorkspace) {
|
|
@@ -686,18 +936,22 @@ export interface PrebuiltWorkspaceUpdatable {
|
|
|
686
936
|
repo: string;
|
|
687
937
|
isResolved: boolean;
|
|
688
938
|
installationId: string;
|
|
939
|
+
/**
|
|
940
|
+
* the commitSHA of the commit that triggered the prebuild
|
|
941
|
+
*/
|
|
942
|
+
commitSHA?: string;
|
|
689
943
|
issue?: string;
|
|
690
944
|
contextUrl?: string;
|
|
691
945
|
}
|
|
692
946
|
|
|
693
947
|
export interface WhitelistedRepository {
|
|
694
|
-
url: string
|
|
695
|
-
name: string
|
|
696
|
-
description?: string
|
|
697
|
-
avatar?: string
|
|
948
|
+
url: string;
|
|
949
|
+
name: string;
|
|
950
|
+
description?: string;
|
|
951
|
+
avatar?: string;
|
|
698
952
|
}
|
|
699
953
|
|
|
700
|
-
export type PortOnOpen =
|
|
954
|
+
export type PortOnOpen = "open-browser" | "open-preview" | "notify" | "ignore";
|
|
701
955
|
|
|
702
956
|
export interface PortConfig {
|
|
703
957
|
port: number;
|
|
@@ -708,7 +962,7 @@ export interface PortConfig {
|
|
|
708
962
|
}
|
|
709
963
|
export namespace PortConfig {
|
|
710
964
|
export function is(config: any): config is PortConfig {
|
|
711
|
-
return config &&
|
|
965
|
+
return config && "port" in config && typeof config.port === "number";
|
|
712
966
|
}
|
|
713
967
|
}
|
|
714
968
|
|
|
@@ -718,7 +972,7 @@ export interface PortRangeConfig {
|
|
|
718
972
|
}
|
|
719
973
|
export namespace PortRangeConfig {
|
|
720
974
|
export function is(config: any): config is PortRangeConfig {
|
|
721
|
-
return config &&
|
|
975
|
+
return config && "port" in config && (typeof config.port === "string" || config.port instanceof String);
|
|
722
976
|
}
|
|
723
977
|
}
|
|
724
978
|
|
|
@@ -729,32 +983,31 @@ export interface TaskConfig {
|
|
|
729
983
|
prebuild?: string;
|
|
730
984
|
command?: string;
|
|
731
985
|
env?: { [env: string]: any };
|
|
732
|
-
openIn?:
|
|
733
|
-
openMode?:
|
|
986
|
+
openIn?: "bottom" | "main" | "left" | "right";
|
|
987
|
+
openMode?: "split-top" | "split-left" | "split-right" | "split-bottom" | "tab-before" | "tab-after";
|
|
734
988
|
}
|
|
735
989
|
|
|
736
990
|
export namespace TaskConfig {
|
|
737
991
|
export function is(config: any): config is TaskConfig {
|
|
738
|
-
return config
|
|
739
|
-
&& ('command' in config || 'init' in config || 'before' in config);
|
|
992
|
+
return config && ("command" in config || "init" in config || "before" in config);
|
|
740
993
|
}
|
|
741
994
|
}
|
|
742
995
|
|
|
743
996
|
export namespace WorkspaceImageBuild {
|
|
744
|
-
export type Phase =
|
|
997
|
+
export type Phase = "BaseImage" | "GitpodLayer" | "Error" | "Done";
|
|
745
998
|
export interface StateInfo {
|
|
746
|
-
phase: Phase
|
|
747
|
-
currentStep?: number
|
|
748
|
-
maxSteps?: number
|
|
999
|
+
phase: Phase;
|
|
1000
|
+
currentStep?: number;
|
|
1001
|
+
maxSteps?: number;
|
|
749
1002
|
}
|
|
750
1003
|
export interface LogContent {
|
|
751
|
-
text: string
|
|
752
|
-
upToLine?: number
|
|
753
|
-
isDiff?: boolean
|
|
1004
|
+
text: string;
|
|
1005
|
+
upToLine?: number;
|
|
1006
|
+
isDiff?: boolean;
|
|
754
1007
|
}
|
|
755
1008
|
export type LogCallback = (info: StateInfo, content: LogContent | undefined) => void;
|
|
756
1009
|
export namespace LogLine {
|
|
757
|
-
export const DELIMITER =
|
|
1010
|
+
export const DELIMITER = "\r\n";
|
|
758
1011
|
export const DELIMITER_REGEX = /\r?\n/;
|
|
759
1012
|
}
|
|
760
1013
|
}
|
|
@@ -763,20 +1016,18 @@ export type ImageConfig = ImageConfigString | ImageConfigFile;
|
|
|
763
1016
|
export type ImageConfigString = string;
|
|
764
1017
|
export namespace ImageConfigString {
|
|
765
1018
|
export function is(config: ImageConfig | undefined): config is ImageConfigString {
|
|
766
|
-
return typeof config ===
|
|
1019
|
+
return typeof config === "string";
|
|
767
1020
|
}
|
|
768
|
-
|
|
769
1021
|
}
|
|
770
1022
|
export interface ImageConfigFile {
|
|
771
1023
|
// Path to the Dockerfile relative to repository root
|
|
772
|
-
file: string
|
|
1024
|
+
file: string;
|
|
773
1025
|
// Path to the docker build context relative to repository root
|
|
774
|
-
context?: string
|
|
1026
|
+
context?: string;
|
|
775
1027
|
}
|
|
776
1028
|
export namespace ImageConfigFile {
|
|
777
1029
|
export function is(config: ImageConfig | undefined): config is ImageConfigFile {
|
|
778
|
-
return typeof config ===
|
|
779
|
-
&& 'file' in config;
|
|
1030
|
+
return typeof config === "object" && "file" in config;
|
|
780
1031
|
}
|
|
781
1032
|
}
|
|
782
1033
|
export interface ExternalImageConfigFile extends ImageConfigFile {
|
|
@@ -784,14 +1035,13 @@ export interface ExternalImageConfigFile extends ImageConfigFile {
|
|
|
784
1035
|
}
|
|
785
1036
|
export namespace ExternalImageConfigFile {
|
|
786
1037
|
export function is(config: any | undefined): config is ExternalImageConfigFile {
|
|
787
|
-
return typeof config ===
|
|
788
|
-
&& 'file' in config
|
|
789
|
-
&& 'externalSource' in config;
|
|
1038
|
+
return typeof config === "object" && "file" in config && "externalSource" in config;
|
|
790
1039
|
}
|
|
791
1040
|
}
|
|
792
1041
|
|
|
793
1042
|
export interface WorkspaceContext {
|
|
794
1043
|
title: string;
|
|
1044
|
+
ref?: string;
|
|
795
1045
|
/** 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. */
|
|
796
1046
|
normalizedContextURL?: string;
|
|
797
1047
|
forceCreateNewWorkspace?: boolean;
|
|
@@ -800,8 +1050,7 @@ export interface WorkspaceContext {
|
|
|
800
1050
|
|
|
801
1051
|
export namespace WorkspaceContext {
|
|
802
1052
|
export function is(context: any): context is WorkspaceContext {
|
|
803
|
-
return context
|
|
804
|
-
&& 'title' in context;
|
|
1053
|
+
return context && "title" in context;
|
|
805
1054
|
}
|
|
806
1055
|
}
|
|
807
1056
|
|
|
@@ -810,8 +1059,7 @@ export interface WithSnapshot {
|
|
|
810
1059
|
}
|
|
811
1060
|
export namespace WithSnapshot {
|
|
812
1061
|
export function is(context: any): context is WithSnapshot {
|
|
813
|
-
return context
|
|
814
|
-
&& 'snapshotBucketId' in context;
|
|
1062
|
+
return context && "snapshotBucketId" in context;
|
|
815
1063
|
}
|
|
816
1064
|
}
|
|
817
1065
|
|
|
@@ -821,10 +1069,7 @@ export interface WithPrebuild extends WithSnapshot {
|
|
|
821
1069
|
}
|
|
822
1070
|
export namespace WithPrebuild {
|
|
823
1071
|
export function is(context: any): context is WithPrebuild {
|
|
824
|
-
return context
|
|
825
|
-
&& WithSnapshot.is(context)
|
|
826
|
-
&& 'prebuildWorkspaceId' in context
|
|
827
|
-
&& 'wasPrebuilt' in context;
|
|
1072
|
+
return context && WithSnapshot.is(context) && "prebuildWorkspaceId" in context && "wasPrebuilt" in context;
|
|
828
1073
|
}
|
|
829
1074
|
}
|
|
830
1075
|
|
|
@@ -838,16 +1083,14 @@ export interface WithDefaultConfig {
|
|
|
838
1083
|
|
|
839
1084
|
export namespace WithDefaultConfig {
|
|
840
1085
|
export function is(context: any): context is WithDefaultConfig {
|
|
841
|
-
return context
|
|
842
|
-
&& 'withDefaultConfig' in context
|
|
843
|
-
&& context.withDefaultConfig;
|
|
1086
|
+
return context && "withDefaultConfig" in context && context.withDefaultConfig;
|
|
844
1087
|
}
|
|
845
1088
|
|
|
846
1089
|
export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
|
|
847
1090
|
return {
|
|
848
1091
|
...ctx,
|
|
849
|
-
withDefaultConfig: true
|
|
850
|
-
}
|
|
1092
|
+
withDefaultConfig: true,
|
|
1093
|
+
};
|
|
851
1094
|
}
|
|
852
1095
|
}
|
|
853
1096
|
|
|
@@ -857,23 +1100,27 @@ export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
|
|
|
857
1100
|
|
|
858
1101
|
export namespace SnapshotContext {
|
|
859
1102
|
export function is(context: any): context is SnapshotContext {
|
|
860
|
-
return context
|
|
861
|
-
&& WithSnapshot.is(context)
|
|
862
|
-
&& 'snapshotId' in context;
|
|
1103
|
+
return context && WithSnapshot.is(context) && "snapshotId" in context;
|
|
863
1104
|
}
|
|
864
1105
|
}
|
|
865
1106
|
|
|
866
|
-
export interface
|
|
867
|
-
actual: WorkspaceContext;
|
|
1107
|
+
export interface WithCommitHistory {
|
|
868
1108
|
commitHistory?: string[];
|
|
869
|
-
|
|
1109
|
+
additionalRepositoryCommitHistories?: {
|
|
1110
|
+
cloneUrl: string;
|
|
1111
|
+
commitHistory: string[];
|
|
1112
|
+
}[];
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
export interface StartPrebuildContext extends WorkspaceContext, WithCommitHistory {
|
|
1116
|
+
actual: WorkspaceContext;
|
|
1117
|
+
project: Project;
|
|
870
1118
|
branch?: string;
|
|
871
1119
|
}
|
|
872
1120
|
|
|
873
1121
|
export namespace StartPrebuildContext {
|
|
874
1122
|
export function is(context: any): context is StartPrebuildContext {
|
|
875
|
-
return context
|
|
876
|
-
&& 'actual' in context;
|
|
1123
|
+
return context && "actual" in context;
|
|
877
1124
|
}
|
|
878
1125
|
}
|
|
879
1126
|
|
|
@@ -885,21 +1132,18 @@ export interface PrebuiltWorkspaceContext extends WorkspaceContext {
|
|
|
885
1132
|
|
|
886
1133
|
export namespace PrebuiltWorkspaceContext {
|
|
887
1134
|
export function is(context: any): context is PrebuiltWorkspaceContext {
|
|
888
|
-
return context
|
|
889
|
-
&& 'originalContext' in context
|
|
890
|
-
&& 'prebuiltWorkspace' in context;
|
|
1135
|
+
return context && "originalContext" in context && "prebuiltWorkspace" in context;
|
|
891
1136
|
}
|
|
892
1137
|
}
|
|
893
1138
|
|
|
894
1139
|
export interface WithReferrerContext extends WorkspaceContext {
|
|
895
|
-
referrer: string
|
|
896
|
-
referrerIde?: string
|
|
1140
|
+
referrer: string;
|
|
1141
|
+
referrerIde?: string;
|
|
897
1142
|
}
|
|
898
1143
|
|
|
899
1144
|
export namespace WithReferrerContext {
|
|
900
1145
|
export function is(context: any): context is WithReferrerContext {
|
|
901
|
-
return context
|
|
902
|
-
&& 'referrer' in context;
|
|
1146
|
+
return context && "referrer" in context;
|
|
903
1147
|
}
|
|
904
1148
|
}
|
|
905
1149
|
|
|
@@ -909,21 +1153,7 @@ export interface WithEnvvarsContext extends WorkspaceContext {
|
|
|
909
1153
|
|
|
910
1154
|
export namespace WithEnvvarsContext {
|
|
911
1155
|
export function is(context: any): context is WithEnvvarsContext {
|
|
912
|
-
return context
|
|
913
|
-
&& 'envvars' in context
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
export interface WorkspaceProbeContext extends WorkspaceContext {
|
|
918
|
-
responseURL: string
|
|
919
|
-
responseToken: string
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
export namespace WorkspaceProbeContext {
|
|
923
|
-
export function is(context: any): context is WorkspaceProbeContext {
|
|
924
|
-
return context
|
|
925
|
-
&& 'responseURL' in context
|
|
926
|
-
&& 'responseToken' in context;
|
|
1156
|
+
return context && "envvars" in context;
|
|
927
1157
|
}
|
|
928
1158
|
}
|
|
929
1159
|
|
|
@@ -935,32 +1165,30 @@ export namespace RefType {
|
|
|
935
1165
|
}
|
|
936
1166
|
// This fallback is meant to handle the cases where (for historic reasons) ref is present but refType is missing
|
|
937
1167
|
return commit.refType || "branch";
|
|
938
|
-
}
|
|
1168
|
+
};
|
|
939
1169
|
}
|
|
940
1170
|
|
|
941
1171
|
export interface Commit {
|
|
942
|
-
repository: Repository
|
|
943
|
-
revision: string
|
|
1172
|
+
repository: Repository;
|
|
1173
|
+
revision: string;
|
|
944
1174
|
|
|
945
1175
|
// Might contain either a branch or a tag (determined by refType)
|
|
946
|
-
ref?: string
|
|
1176
|
+
ref?: string;
|
|
947
1177
|
|
|
948
1178
|
// refType is only set if ref is present (and not for old workspaces, before this feature was added)
|
|
949
|
-
refType?: RefType
|
|
1179
|
+
refType?: RefType;
|
|
950
1180
|
}
|
|
951
1181
|
|
|
952
1182
|
export interface AdditionalContentContext extends WorkspaceContext {
|
|
953
|
-
|
|
954
1183
|
/**
|
|
955
1184
|
* utf-8 encoded contents that will be copied on top of the workspace's filesystem
|
|
956
1185
|
*/
|
|
957
|
-
additionalFiles: {[filePath: string]: string};
|
|
958
|
-
|
|
1186
|
+
additionalFiles: { [filePath: string]: string };
|
|
959
1187
|
}
|
|
960
1188
|
|
|
961
1189
|
export namespace AdditionalContentContext {
|
|
962
1190
|
export function is(ctx: any): ctx is AdditionalContentContext {
|
|
963
|
-
return
|
|
1191
|
+
return "additionalFiles" in ctx;
|
|
964
1192
|
}
|
|
965
1193
|
|
|
966
1194
|
export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
|
|
@@ -968,16 +1196,59 @@ export namespace AdditionalContentContext {
|
|
|
968
1196
|
}
|
|
969
1197
|
}
|
|
970
1198
|
|
|
971
|
-
export interface
|
|
1199
|
+
export interface OpenPrebuildContext extends WorkspaceContext {
|
|
1200
|
+
openPrebuildID: string;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
export namespace OpenPrebuildContext {
|
|
1204
|
+
export function is(ctx: any): ctx is OpenPrebuildContext {
|
|
1205
|
+
return "openPrebuildID" in ctx;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
|
|
972
1210
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
973
|
-
cloneUrl?: string
|
|
1211
|
+
cloneUrl?: string;
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* The clone and checkout information for additional repositories in case of multi-repo projects.
|
|
1215
|
+
*/
|
|
1216
|
+
additionalRepositoryCheckoutInfo?: GitCheckoutInfo[];
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
export namespace CommitContext {
|
|
1220
|
+
/**
|
|
1221
|
+
* Creates a hash for all the commits of the CommitContext and all sub-repo commit infos.
|
|
1222
|
+
* The hash is max 255 chars long.
|
|
1223
|
+
* @param commitContext
|
|
1224
|
+
* @returns hash for commitcontext
|
|
1225
|
+
*/
|
|
1226
|
+
export function computeHash(commitContext: CommitContext): string {
|
|
1227
|
+
// for single commits we use the revision to be backward compatible.
|
|
1228
|
+
if (
|
|
1229
|
+
!commitContext.additionalRepositoryCheckoutInfo ||
|
|
1230
|
+
commitContext.additionalRepositoryCheckoutInfo.length === 0
|
|
1231
|
+
) {
|
|
1232
|
+
return commitContext.revision;
|
|
1233
|
+
}
|
|
1234
|
+
const hasher = createHash("sha256");
|
|
1235
|
+
hasher.update(commitContext.revision);
|
|
1236
|
+
for (const info of commitContext.additionalRepositoryCheckoutInfo) {
|
|
1237
|
+
hasher.update(info.revision);
|
|
1238
|
+
}
|
|
1239
|
+
return hasher.digest("hex");
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
export interface GitCheckoutInfo extends Commit {
|
|
1244
|
+
checkoutLocation?: string;
|
|
1245
|
+
upstreamRemoteURI?: string;
|
|
1246
|
+
localBranch?: string;
|
|
974
1247
|
}
|
|
975
1248
|
|
|
976
1249
|
export namespace CommitContext {
|
|
977
1250
|
export function is(commit: any): commit is CommitContext {
|
|
978
|
-
return WorkspaceContext.is(commit)
|
|
979
|
-
&& 'repository' in commit
|
|
980
|
-
&& 'revision' in commit
|
|
1251
|
+
return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
|
|
981
1252
|
}
|
|
982
1253
|
}
|
|
983
1254
|
|
|
@@ -985,17 +1256,14 @@ export interface PullRequestContext extends CommitContext {
|
|
|
985
1256
|
nr: number;
|
|
986
1257
|
ref: string;
|
|
987
1258
|
base: {
|
|
988
|
-
repository: Repository
|
|
989
|
-
ref: string
|
|
990
|
-
}
|
|
1259
|
+
repository: Repository;
|
|
1260
|
+
ref: string;
|
|
1261
|
+
};
|
|
991
1262
|
}
|
|
992
1263
|
|
|
993
1264
|
export namespace PullRequestContext {
|
|
994
1265
|
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
|
|
1266
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
|
|
999
1267
|
}
|
|
1000
1268
|
}
|
|
1001
1269
|
|
|
@@ -1007,10 +1275,7 @@ export interface IssueContext extends CommitContext {
|
|
|
1007
1275
|
|
|
1008
1276
|
export namespace IssueContext {
|
|
1009
1277
|
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
|
|
1278
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
|
|
1014
1279
|
}
|
|
1015
1280
|
}
|
|
1016
1281
|
|
|
@@ -1021,9 +1286,7 @@ export interface NavigatorContext extends CommitContext {
|
|
|
1021
1286
|
|
|
1022
1287
|
export namespace NavigatorContext {
|
|
1023
1288
|
export function is(ctx: any): ctx is NavigatorContext {
|
|
1024
|
-
return CommitContext.is(ctx)
|
|
1025
|
-
&& 'path' in ctx
|
|
1026
|
-
&& 'isFile' in ctx
|
|
1289
|
+
return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
|
|
1027
1290
|
}
|
|
1028
1291
|
}
|
|
1029
1292
|
|
|
@@ -1032,6 +1295,8 @@ export interface Repository {
|
|
|
1032
1295
|
owner: string;
|
|
1033
1296
|
name: string;
|
|
1034
1297
|
cloneUrl: string;
|
|
1298
|
+
/* Optional kind to differentiate between repositories of orgs/groups/projects and personal repos. */
|
|
1299
|
+
repoKind?: string;
|
|
1035
1300
|
description?: string;
|
|
1036
1301
|
avatarUrl?: string;
|
|
1037
1302
|
webUrl?: string;
|
|
@@ -1040,8 +1305,8 @@ export interface Repository {
|
|
|
1040
1305
|
private?: boolean;
|
|
1041
1306
|
fork?: {
|
|
1042
1307
|
// The direct parent of this fork
|
|
1043
|
-
parent: Repository
|
|
1044
|
-
}
|
|
1308
|
+
parent: Repository;
|
|
1309
|
+
};
|
|
1045
1310
|
}
|
|
1046
1311
|
export interface Branch {
|
|
1047
1312
|
name: string;
|
|
@@ -1066,21 +1331,19 @@ export namespace Repository {
|
|
|
1066
1331
|
export interface WorkspaceInstancePortsChangedEvent {
|
|
1067
1332
|
type: "PortsChanged";
|
|
1068
1333
|
instanceID: string;
|
|
1069
|
-
portsOpened: number[]
|
|
1070
|
-
portsClosed: number[]
|
|
1334
|
+
portsOpened: number[];
|
|
1335
|
+
portsClosed: number[];
|
|
1071
1336
|
}
|
|
1072
1337
|
|
|
1073
1338
|
export namespace WorkspaceInstancePortsChangedEvent {
|
|
1074
|
-
|
|
1075
1339
|
export function is(data: any): data is WorkspaceInstancePortsChangedEvent {
|
|
1076
1340
|
return data && data.type == "PortsChanged";
|
|
1077
1341
|
}
|
|
1078
|
-
|
|
1079
1342
|
}
|
|
1080
1343
|
|
|
1081
1344
|
export interface WorkspaceInfo {
|
|
1082
|
-
workspace: Workspace
|
|
1083
|
-
latestInstance?: WorkspaceInstance
|
|
1345
|
+
workspace: Workspace;
|
|
1346
|
+
latestInstance?: WorkspaceInstance;
|
|
1084
1347
|
}
|
|
1085
1348
|
|
|
1086
1349
|
export namespace WorkspaceInfo {
|
|
@@ -1096,35 +1359,25 @@ export interface WorkspaceCreationResult {
|
|
|
1096
1359
|
workspaceURL?: string;
|
|
1097
1360
|
existingWorkspaces?: WorkspaceInfo[];
|
|
1098
1361
|
runningWorkspacePrebuild?: {
|
|
1099
|
-
prebuildID: string
|
|
1100
|
-
workspaceID: string
|
|
1101
|
-
instanceID: string
|
|
1102
|
-
starting: RunningWorkspacePrebuildStarting
|
|
1103
|
-
sameCluster: boolean
|
|
1104
|
-
}
|
|
1362
|
+
prebuildID: string;
|
|
1363
|
+
workspaceID: string;
|
|
1364
|
+
instanceID: string;
|
|
1365
|
+
starting: RunningWorkspacePrebuildStarting;
|
|
1366
|
+
sameCluster: boolean;
|
|
1367
|
+
};
|
|
1105
1368
|
runningPrebuildWorkspaceID?: string;
|
|
1106
1369
|
}
|
|
1107
|
-
export type RunningWorkspacePrebuildStarting =
|
|
1108
|
-
|
|
1109
|
-
export enum CreateWorkspaceMode {
|
|
1110
|
-
// Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
|
|
1111
|
-
Default = 'default',
|
|
1112
|
-
// 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 = 'force-new',
|
|
1114
|
-
// UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
|
|
1115
|
-
UsePrebuild = 'use-prebuild',
|
|
1116
|
-
// SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
|
|
1117
|
-
SelectIfRunning = 'select-if-running',
|
|
1118
|
-
}
|
|
1370
|
+
export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
|
|
1119
1371
|
|
|
1120
1372
|
export namespace WorkspaceCreationResult {
|
|
1121
1373
|
export function is(data: any): data is WorkspaceCreationResult {
|
|
1122
|
-
return
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1374
|
+
return (
|
|
1375
|
+
data &&
|
|
1376
|
+
("createdWorkspaceId" in data ||
|
|
1377
|
+
"existingWorkspaces" in data ||
|
|
1378
|
+
"runningWorkspacePrebuild" in data ||
|
|
1379
|
+
"runningPrebuildWorkspaceID" in data)
|
|
1380
|
+
);
|
|
1128
1381
|
}
|
|
1129
1382
|
}
|
|
1130
1383
|
|
|
@@ -1158,7 +1411,7 @@ export interface AuthProviderInfo {
|
|
|
1158
1411
|
readonly default: string[];
|
|
1159
1412
|
readonly publicRepo: string[];
|
|
1160
1413
|
readonly privateRepo: string[];
|
|
1161
|
-
}
|
|
1414
|
+
};
|
|
1162
1415
|
}
|
|
1163
1416
|
|
|
1164
1417
|
export interface AuthProviderEntry {
|
|
@@ -1184,23 +1437,27 @@ export interface OAuth2Config {
|
|
|
1184
1437
|
readonly scopeSeparator?: string;
|
|
1185
1438
|
|
|
1186
1439
|
readonly settingsUrl?: string;
|
|
1187
|
-
readonly authorizationParams?: { [key: string]: string }
|
|
1440
|
+
readonly authorizationParams?: { [key: string]: string };
|
|
1188
1441
|
readonly configURL?: string;
|
|
1189
1442
|
}
|
|
1190
1443
|
|
|
1191
1444
|
export namespace AuthProviderEntry {
|
|
1192
1445
|
export type Type = "GitHub" | "GitLab" | string;
|
|
1193
1446
|
export type Status = "pending" | "verified";
|
|
1194
|
-
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & {
|
|
1195
|
-
|
|
1447
|
+
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & {
|
|
1448
|
+
clientId?: string;
|
|
1449
|
+
clientSecret?: string;
|
|
1450
|
+
};
|
|
1451
|
+
export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> &
|
|
1452
|
+
Pick<OAuth2Config, "clientId" | "clientSecret">;
|
|
1196
1453
|
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
|
|
1197
1454
|
return {
|
|
1198
1455
|
...entry,
|
|
1199
1456
|
oauth: {
|
|
1200
1457
|
...entry.oauth,
|
|
1201
|
-
clientSecret: "redacted"
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1458
|
+
clientSecret: "redacted",
|
|
1459
|
+
},
|
|
1460
|
+
};
|
|
1204
1461
|
}
|
|
1205
1462
|
}
|
|
1206
1463
|
|
|
@@ -1244,3 +1501,8 @@ export interface Terms {
|
|
|
1244
1501
|
readonly content: string;
|
|
1245
1502
|
readonly formElements?: object;
|
|
1246
1503
|
}
|
|
1504
|
+
|
|
1505
|
+
export interface StripeConfig {
|
|
1506
|
+
individualUsagePriceIds: { [currency: string]: string };
|
|
1507
|
+
teamUsagePriceIds: { [currency: string]: string };
|
|
1508
|
+
}
|