@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/gitpod-service.ts
CHANGED
|
@@ -1,36 +1,67 @@
|
|
|
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 {
|
|
8
|
-
User,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
User,
|
|
9
|
+
WorkspaceInfo,
|
|
10
|
+
WorkspaceCreationResult,
|
|
11
|
+
WorkspaceInstanceUser,
|
|
12
|
+
WhitelistedRepository,
|
|
13
|
+
WorkspaceImageBuild,
|
|
14
|
+
AuthProviderInfo,
|
|
15
|
+
Token,
|
|
16
|
+
UserEnvVarValue,
|
|
17
|
+
Terms,
|
|
18
|
+
Configuration,
|
|
19
|
+
UserInfo,
|
|
20
|
+
GitpodTokenType,
|
|
21
|
+
GitpodToken,
|
|
22
|
+
AuthProviderEntry,
|
|
23
|
+
GuessGitTokenScopesParams,
|
|
24
|
+
GuessedGitTokenScopes,
|
|
25
|
+
ProjectEnvVar,
|
|
26
|
+
PrebuiltWorkspace,
|
|
27
|
+
UserSSHPublicKeyValue,
|
|
28
|
+
SSHPublicKeyValue,
|
|
29
|
+
IDESettings,
|
|
30
|
+
} from "./protocol";
|
|
14
31
|
import {
|
|
15
|
-
Team,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
32
|
+
Team,
|
|
33
|
+
TeamMemberInfo,
|
|
34
|
+
TeamMembershipInvite,
|
|
35
|
+
Project,
|
|
36
|
+
TeamMemberRole,
|
|
37
|
+
PrebuildWithStatus,
|
|
38
|
+
StartPrebuildResult,
|
|
39
|
+
PartialProject,
|
|
40
|
+
PrebuildEvent,
|
|
41
|
+
} from "./teams-projects-protocol";
|
|
42
|
+
import { JsonRpcProxy, JsonRpcServer } from "./messaging/proxy-factory";
|
|
43
|
+
import { Disposable, CancellationTokenSource } from "vscode-jsonrpc";
|
|
44
|
+
import { HeadlessLogUrls } from "./headless-workspace-log";
|
|
45
|
+
import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from "./workspace-instance";
|
|
46
|
+
import { AdminServer } from "./admin-protocol";
|
|
47
|
+
import { GitpodHostUrl } from "./util/gitpod-host-url";
|
|
48
|
+
import { WebSocketConnectionProvider } from "./messaging/browser/connection";
|
|
49
|
+
import { PermissionName } from "./permission";
|
|
50
|
+
import { LicenseService } from "./license-protocol";
|
|
51
|
+
import { Emitter } from "./util/event";
|
|
52
|
+
import { AccountStatement, CreditAlert } from "./accounting-protocol";
|
|
53
|
+
import { GithubUpgradeURL, PlanCoupon } from "./payment-protocol";
|
|
54
|
+
import {
|
|
55
|
+
TeamSubscription,
|
|
56
|
+
TeamSubscription2,
|
|
57
|
+
TeamSubscriptionSlot,
|
|
58
|
+
TeamSubscriptionSlotResolved,
|
|
59
|
+
} from "./team-subscription-protocol";
|
|
60
|
+
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
|
|
61
|
+
import { IDEServer } from "./ide-protocol";
|
|
62
|
+
import { ListUsageRequest, ListUsageResponse, CostCenterJSON } from "./usage";
|
|
63
|
+
import { SupportedWorkspaceClass } from "./workspace-class";
|
|
64
|
+
import { BillingMode } from "./billing-mode";
|
|
34
65
|
|
|
35
66
|
export interface GitpodClient {
|
|
36
67
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
@@ -38,6 +69,8 @@ export interface GitpodClient {
|
|
|
38
69
|
|
|
39
70
|
onPrebuildUpdate(update: PrebuildWithStatus): void;
|
|
40
71
|
|
|
72
|
+
onNotificationUpdated(): void;
|
|
73
|
+
|
|
41
74
|
onCreditAlert(creditAlert: CreditAlert): void;
|
|
42
75
|
|
|
43
76
|
//#region propagating reconnection to iframe
|
|
@@ -46,12 +79,14 @@ export interface GitpodClient {
|
|
|
46
79
|
//#endregion
|
|
47
80
|
}
|
|
48
81
|
|
|
49
|
-
export const GitpodServer = Symbol(
|
|
82
|
+
export const GitpodServer = Symbol("GitpodServer");
|
|
50
83
|
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
51
84
|
// User related API
|
|
52
85
|
getLoggedInUser(): Promise<User>;
|
|
53
86
|
getTerms(): Promise<Terms>;
|
|
54
87
|
updateLoggedInUser(user: Partial<User>): Promise<User>;
|
|
88
|
+
sendPhoneNumberVerificationToken(phoneNumber: string): Promise<void>;
|
|
89
|
+
verifyPhoneNumberVerificationToken(phoneNumber: string, token: string): Promise<boolean>;
|
|
55
90
|
getAuthProviders(): Promise<AuthProviderInfo[]>;
|
|
56
91
|
getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
|
|
57
92
|
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
|
|
@@ -122,7 +157,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
122
157
|
setEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
123
158
|
deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
124
159
|
|
|
160
|
+
// User SSH Keys
|
|
161
|
+
hasSSHPublicKey(): Promise<boolean>;
|
|
162
|
+
getSSHPublicKeys(): Promise<UserSSHPublicKeyValue[]>;
|
|
163
|
+
addSSHPublicKey(value: SSHPublicKeyValue): Promise<UserSSHPublicKeyValue>;
|
|
164
|
+
deleteSSHPublicKey(id: string): Promise<void>;
|
|
165
|
+
|
|
125
166
|
// Teams
|
|
167
|
+
getTeam(teamId: string): Promise<Team>;
|
|
168
|
+
updateTeam(teamId: string, team: Pick<Team, "name">): Promise<Team>;
|
|
126
169
|
getTeams(): Promise<Team[]>;
|
|
127
170
|
getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
|
|
128
171
|
createTeam(name: string): Promise<Team>;
|
|
@@ -131,12 +174,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
131
174
|
removeTeamMember(teamId: string, userId: string): Promise<void>;
|
|
132
175
|
getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
|
|
133
176
|
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
134
|
-
deleteTeam(teamId: string
|
|
135
|
-
|
|
136
|
-
// Admin Settings
|
|
137
|
-
adminGetSettings(): Promise<InstallationAdminSettings>;
|
|
138
|
-
adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
|
|
139
|
-
adminGetTelemetryData(): Promise<TelemetryData>;
|
|
177
|
+
deleteTeam(teamId: string): Promise<void>;
|
|
140
178
|
|
|
141
179
|
// Projects
|
|
142
180
|
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
@@ -145,22 +183,20 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
145
183
|
getTeamProjects(teamId: string): Promise<Project[]>;
|
|
146
184
|
getUserProjects(): Promise<Project[]>;
|
|
147
185
|
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
186
|
+
getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
|
|
148
187
|
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
188
|
+
findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
|
|
189
|
+
getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
|
|
149
190
|
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
150
191
|
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
151
|
-
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
152
|
-
guessProjectConfiguration(projectId: string): Promise<string | undefined>;
|
|
153
|
-
fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
154
|
-
guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
155
|
-
setProjectConfiguration(projectId: string, configString: string): Promise<void>;
|
|
156
192
|
updateProjectPartial(partialProject: PartialProject): Promise<void>;
|
|
157
193
|
setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
|
|
158
194
|
getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
|
|
159
195
|
deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
|
|
160
196
|
|
|
161
197
|
// content service
|
|
162
|
-
getContentBlobUploadUrl(name: string): Promise<string
|
|
163
|
-
getContentBlobDownloadUrl(name: string): Promise<string
|
|
198
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
199
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
164
200
|
|
|
165
201
|
// Gitpod token
|
|
166
202
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
@@ -168,7 +204,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
168
204
|
deleteGitpodToken(tokenHash: string): Promise<void>;
|
|
169
205
|
|
|
170
206
|
// misc
|
|
171
|
-
|
|
207
|
+
isGitHubAppEnabled(): Promise<boolean>;
|
|
172
208
|
registerGithubApp(installationId: string): Promise<void>;
|
|
173
209
|
|
|
174
210
|
/**
|
|
@@ -187,25 +223,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
187
223
|
*/
|
|
188
224
|
getSnapshots(workspaceID: string): Promise<string[]>;
|
|
189
225
|
|
|
190
|
-
/**
|
|
191
|
-
* stores/updates layout information for the given workspace
|
|
192
|
-
*/
|
|
193
|
-
storeLayout(workspaceId: string, layoutData: string): Promise<void>;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* retrieves layout information for the given workspace
|
|
197
|
-
*/
|
|
198
|
-
getLayout(workspaceId: string): Promise<string | undefined>;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* @param params
|
|
202
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
203
|
-
*/
|
|
204
|
-
preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
|
|
205
|
-
resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
|
|
206
|
-
installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
|
|
207
|
-
uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
|
|
208
|
-
|
|
209
226
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
210
227
|
|
|
211
228
|
/**
|
|
@@ -223,7 +240,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
223
240
|
*/
|
|
224
241
|
getChargebeeSiteId(): Promise<string>;
|
|
225
242
|
createPortalSession(): Promise<{}>;
|
|
243
|
+
createTeamPortalSession(teamId: string): Promise<{}>;
|
|
226
244
|
checkout(planId: string, planQuantity?: number): Promise<{}>;
|
|
245
|
+
teamCheckout(teamId: string, planId: string): Promise<{}>;
|
|
227
246
|
getAvailableCoupons(): Promise<PlanCoupon[]>;
|
|
228
247
|
getAppliedCoupons(): Promise<PlanCoupon[]>;
|
|
229
248
|
|
|
@@ -235,40 +254,69 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
235
254
|
subscriptionCancel(subscriptionId: string): Promise<void>;
|
|
236
255
|
subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
|
|
237
256
|
|
|
257
|
+
getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
|
|
238
258
|
tsGet(): Promise<TeamSubscription[]>;
|
|
239
259
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
240
|
-
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined
|
|
260
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
241
261
|
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
242
|
-
tsAssignSlot(
|
|
262
|
+
tsAssignSlot(
|
|
263
|
+
teamSubscriptionId: string,
|
|
264
|
+
teamSubscriptionSlotId: string,
|
|
265
|
+
identityStr: string | undefined,
|
|
266
|
+
): Promise<void>;
|
|
243
267
|
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
244
268
|
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
245
269
|
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
246
270
|
|
|
247
271
|
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
248
272
|
|
|
273
|
+
getStripePublishableKey(): Promise<string>;
|
|
274
|
+
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
275
|
+
findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
|
|
276
|
+
getPriceInformation(attributionId: string): Promise<string | undefined>;
|
|
277
|
+
createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
|
|
278
|
+
subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
|
|
279
|
+
getStripePortalUrl(attributionId: string): Promise<string>;
|
|
280
|
+
getCostCenter(attributionId: string): Promise<CostCenterJSON | undefined>;
|
|
281
|
+
setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
|
|
282
|
+
getUsageBalance(attributionId: string): Promise<number>;
|
|
283
|
+
|
|
284
|
+
listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
|
|
285
|
+
|
|
286
|
+
setUsageAttribution(usageAttribution: string): Promise<void>;
|
|
287
|
+
listAvailableUsageAttributionIds(): Promise<string[]>;
|
|
288
|
+
|
|
289
|
+
getBillingModeForUser(): Promise<BillingMode>;
|
|
290
|
+
getBillingModeForTeam(teamId: string): Promise<BillingMode>;
|
|
291
|
+
|
|
249
292
|
/**
|
|
250
293
|
* Analytics
|
|
251
294
|
*/
|
|
252
295
|
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
253
296
|
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
254
297
|
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Frontend notifications
|
|
301
|
+
*/
|
|
302
|
+
getNotifications(): Promise<string[]>;
|
|
303
|
+
|
|
304
|
+
getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
|
|
255
305
|
}
|
|
256
306
|
|
|
257
307
|
export interface RateLimiterError {
|
|
258
|
-
method?: string
|
|
308
|
+
method?: string;
|
|
259
309
|
|
|
260
310
|
/**
|
|
261
311
|
* Retry after this many seconds, earliest.
|
|
262
312
|
* cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
263
313
|
*/
|
|
264
|
-
retryAfter: number
|
|
314
|
+
retryAfter: number;
|
|
265
315
|
}
|
|
266
316
|
|
|
267
317
|
export interface CreateProjectParams {
|
|
268
318
|
name: string;
|
|
269
|
-
slug
|
|
270
|
-
account: string;
|
|
271
|
-
provider: string;
|
|
319
|
+
slug: string;
|
|
272
320
|
cloneUrl: string;
|
|
273
321
|
teamId?: string;
|
|
274
322
|
userId?: string;
|
|
@@ -292,7 +340,7 @@ export interface ProviderRepository {
|
|
|
292
340
|
account: string;
|
|
293
341
|
accountAvatarUrl: string;
|
|
294
342
|
cloneUrl: string;
|
|
295
|
-
updatedAt
|
|
343
|
+
updatedAt?: string;
|
|
296
344
|
installationId?: number;
|
|
297
345
|
installationUpdatedAt?: string;
|
|
298
346
|
|
|
@@ -306,42 +354,60 @@ export interface ClientHeaderFields {
|
|
|
306
354
|
clientRegion?: string;
|
|
307
355
|
}
|
|
308
356
|
|
|
309
|
-
export
|
|
357
|
+
export type WorkspaceTimeoutDuration = string;
|
|
358
|
+
export namespace WorkspaceTimeoutDuration {
|
|
359
|
+
export function validate(duration: string): WorkspaceTimeoutDuration {
|
|
360
|
+
const unit = duration.slice(-1);
|
|
361
|
+
if (!["m", "h", "d"].includes(unit)) {
|
|
362
|
+
throw new Error(`Invalid timeout unit: ${unit}`);
|
|
363
|
+
}
|
|
364
|
+
const value = parseInt(duration.slice(0, -1));
|
|
365
|
+
if (isNaN(value) || value <= 0) {
|
|
366
|
+
throw new Error(`Invalid timeout value: ${duration}`);
|
|
367
|
+
}
|
|
368
|
+
return duration;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
310
371
|
|
|
311
|
-
export const
|
|
372
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_SHORT: WorkspaceTimeoutDuration = "30m";
|
|
373
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_LONG: WorkspaceTimeoutDuration = "60m";
|
|
374
|
+
export const WORKSPACE_TIMEOUT_EXTENDED: WorkspaceTimeoutDuration = "180m";
|
|
375
|
+
|
|
376
|
+
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
377
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
378
|
+
): GitpodServiceImpl<C, S> {
|
|
312
379
|
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
313
|
-
}
|
|
380
|
+
};
|
|
314
381
|
|
|
315
|
-
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
316
|
-
methods
|
|
317
|
-
|
|
382
|
+
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
383
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
384
|
+
): JsonRpcProxy<S> {
|
|
385
|
+
methods.setClient = methods.setClient || (() => {});
|
|
386
|
+
methods.dispose = methods.dispose || (() => {});
|
|
318
387
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
319
388
|
// @ts-ignore
|
|
320
389
|
get: (target: S, property: keyof S) => {
|
|
321
390
|
const result = target[property];
|
|
322
391
|
if (!result) {
|
|
323
|
-
throw new Error(`Method ${property} not implemented`);
|
|
392
|
+
throw new Error(`Method ${String(property)} not implemented`);
|
|
324
393
|
}
|
|
325
394
|
return result;
|
|
326
|
-
}
|
|
395
|
+
},
|
|
327
396
|
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
331
|
-
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
397
|
+
};
|
|
332
398
|
|
|
333
399
|
export interface SetWorkspaceTimeoutResult {
|
|
334
|
-
resetTimeoutOnWorkspaces: string[]
|
|
400
|
+
resetTimeoutOnWorkspaces: string[];
|
|
335
401
|
}
|
|
336
402
|
|
|
337
403
|
export interface GetWorkspaceTimeoutResult {
|
|
338
|
-
duration: WorkspaceTimeoutDuration
|
|
339
|
-
canChange: boolean
|
|
404
|
+
duration: WorkspaceTimeoutDuration;
|
|
405
|
+
canChange: boolean;
|
|
340
406
|
}
|
|
341
407
|
|
|
342
408
|
export interface StartWorkspaceResult {
|
|
343
|
-
instanceID: string
|
|
344
|
-
workspaceURL?: string
|
|
409
|
+
instanceID: string;
|
|
410
|
+
workspaceURL?: string;
|
|
345
411
|
}
|
|
346
412
|
|
|
347
413
|
export namespace GitpodServer {
|
|
@@ -355,17 +421,23 @@ export namespace GitpodServer {
|
|
|
355
421
|
export interface GetAccountStatementOptions {
|
|
356
422
|
date?: string;
|
|
357
423
|
}
|
|
358
|
-
export interface CreateWorkspaceOptions {
|
|
424
|
+
export interface CreateWorkspaceOptions extends StartWorkspaceOptions {
|
|
359
425
|
contextUrl: string;
|
|
360
|
-
|
|
426
|
+
|
|
427
|
+
// whether running workspaces on the same context should be ignored. If false (default) users will be asked.
|
|
428
|
+
ignoreRunningWorkspaceOnSameCommit?: boolean;
|
|
429
|
+
ignoreRunningPrebuild?: boolean;
|
|
430
|
+
allowUsingPreviousPrebuilds?: boolean;
|
|
361
431
|
forceDefaultConfig?: boolean;
|
|
362
432
|
}
|
|
433
|
+
|
|
363
434
|
export interface StartWorkspaceOptions {
|
|
364
|
-
forceDefaultImage
|
|
435
|
+
forceDefaultImage?: boolean;
|
|
436
|
+
workspaceClass?: string;
|
|
437
|
+
ideSettings?: IDESettings;
|
|
365
438
|
}
|
|
366
439
|
export interface TakeSnapshotOptions {
|
|
367
440
|
workspaceId: string;
|
|
368
|
-
layoutData?: string;
|
|
369
441
|
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
370
442
|
dontWait?: boolean;
|
|
371
443
|
}
|
|
@@ -385,23 +457,23 @@ export namespace GitpodServer {
|
|
|
385
457
|
readonly roundTripTime?: number;
|
|
386
458
|
}
|
|
387
459
|
export interface UpdateOwnAuthProviderParams {
|
|
388
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
460
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
389
461
|
}
|
|
390
462
|
export interface DeleteOwnAuthProviderParams {
|
|
391
|
-
readonly id: string
|
|
463
|
+
readonly id: string;
|
|
392
464
|
}
|
|
393
465
|
export type AdmissionLevel = "owner" | "everyone";
|
|
394
466
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
395
467
|
export interface GenerateNewGitpodTokenOptions {
|
|
396
|
-
name?: string
|
|
397
|
-
type: GitpodTokenType
|
|
398
|
-
scopes?: string[]
|
|
468
|
+
name?: string;
|
|
469
|
+
type: GitpodTokenType;
|
|
470
|
+
scopes?: string[];
|
|
399
471
|
}
|
|
400
472
|
}
|
|
401
473
|
|
|
402
|
-
export const GitpodServerPath =
|
|
474
|
+
export const GitpodServerPath = "/gitpod";
|
|
403
475
|
|
|
404
|
-
export const GitpodServerProxy = Symbol(
|
|
476
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
405
477
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
406
478
|
|
|
407
479
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -415,8 +487,8 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
415
487
|
if (index > -1) {
|
|
416
488
|
this.clients.splice(index, 1);
|
|
417
489
|
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
490
|
+
},
|
|
491
|
+
};
|
|
420
492
|
}
|
|
421
493
|
|
|
422
494
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -425,7 +497,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
425
497
|
try {
|
|
426
498
|
client.onInstanceUpdate(instance);
|
|
427
499
|
} catch (error) {
|
|
428
|
-
console.error(error)
|
|
500
|
+
console.error(error);
|
|
429
501
|
}
|
|
430
502
|
}
|
|
431
503
|
}
|
|
@@ -437,19 +509,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
437
509
|
try {
|
|
438
510
|
client.onPrebuildUpdate(update);
|
|
439
511
|
} catch (error) {
|
|
440
|
-
console.error(error)
|
|
512
|
+
console.error(error);
|
|
441
513
|
}
|
|
442
514
|
}
|
|
443
515
|
}
|
|
444
516
|
}
|
|
445
517
|
|
|
446
|
-
onWorkspaceImageBuildLogs(
|
|
518
|
+
onWorkspaceImageBuildLogs(
|
|
519
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
520
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
521
|
+
): void {
|
|
447
522
|
for (const client of this.clients) {
|
|
448
523
|
if (client.onWorkspaceImageBuildLogs) {
|
|
449
524
|
try {
|
|
450
525
|
client.onWorkspaceImageBuildLogs(info, content);
|
|
451
526
|
} catch (error) {
|
|
452
|
-
console.error(error)
|
|
527
|
+
console.error(error);
|
|
453
528
|
}
|
|
454
529
|
}
|
|
455
530
|
}
|
|
@@ -461,7 +536,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
461
536
|
try {
|
|
462
537
|
client.notifyDidOpenConnection();
|
|
463
538
|
} catch (error) {
|
|
464
|
-
console.error(error)
|
|
539
|
+
console.error(error);
|
|
465
540
|
}
|
|
466
541
|
}
|
|
467
542
|
}
|
|
@@ -473,7 +548,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
473
548
|
try {
|
|
474
549
|
client.notifyDidCloseConnection();
|
|
475
550
|
} catch (error) {
|
|
476
|
-
console.error(error)
|
|
551
|
+
console.error(error);
|
|
477
552
|
}
|
|
478
553
|
}
|
|
479
554
|
}
|
|
@@ -485,64 +560,73 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
485
560
|
try {
|
|
486
561
|
client.onCreditAlert(creditAlert);
|
|
487
562
|
} catch (error) {
|
|
488
|
-
console.error(error)
|
|
563
|
+
console.error(error);
|
|
489
564
|
}
|
|
490
565
|
}
|
|
491
566
|
}
|
|
492
567
|
}
|
|
493
568
|
|
|
569
|
+
onNotificationUpdated(): void {
|
|
570
|
+
for (const client of this.clients) {
|
|
571
|
+
if (client.onNotificationUpdated) {
|
|
572
|
+
try {
|
|
573
|
+
client.onNotificationUpdated();
|
|
574
|
+
} catch (error) {
|
|
575
|
+
console.error(error);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
494
580
|
}
|
|
495
581
|
|
|
496
582
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
497
583
|
|
|
498
|
-
const hasWindow =
|
|
584
|
+
const hasWindow = typeof window !== "undefined";
|
|
499
585
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
500
586
|
unknown: 0,
|
|
501
587
|
preparing: 1,
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
588
|
+
building: 2,
|
|
589
|
+
pending: 3,
|
|
590
|
+
creating: 4,
|
|
591
|
+
initializing: 5,
|
|
592
|
+
running: 6,
|
|
593
|
+
interrupted: 7,
|
|
594
|
+
stopping: 8,
|
|
595
|
+
stopped: 9,
|
|
509
596
|
};
|
|
510
597
|
export class WorkspaceInstanceUpdateListener {
|
|
511
598
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
512
599
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
513
600
|
|
|
514
|
-
private source:
|
|
601
|
+
private source: "sync" | "update" = "sync";
|
|
515
602
|
|
|
516
603
|
get info(): WorkspaceInfo {
|
|
517
604
|
return this._info;
|
|
518
605
|
}
|
|
519
606
|
|
|
520
|
-
constructor(
|
|
521
|
-
private readonly service: GitpodService,
|
|
522
|
-
private _info: WorkspaceInfo
|
|
523
|
-
) {
|
|
607
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
524
608
|
service.registerClient({
|
|
525
|
-
onInstanceUpdate: instance => {
|
|
609
|
+
onInstanceUpdate: (instance) => {
|
|
526
610
|
if (this.isOutOfOrder(instance)) {
|
|
527
611
|
return;
|
|
528
612
|
}
|
|
529
613
|
this.cancelSync();
|
|
530
614
|
this._info.latestInstance = instance;
|
|
531
|
-
this.source =
|
|
615
|
+
this.source = "update";
|
|
532
616
|
this.onDidChangeEmitter.fire(undefined);
|
|
533
617
|
},
|
|
534
618
|
notifyDidOpenConnection: () => {
|
|
535
619
|
this.sync();
|
|
536
|
-
}
|
|
620
|
+
},
|
|
537
621
|
});
|
|
538
622
|
if (hasWindow) {
|
|
539
623
|
// learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
|
|
540
|
-
window.document.addEventListener(
|
|
541
|
-
if (window.document.visibilityState ===
|
|
624
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
625
|
+
if (window.document.visibilityState === "visible") {
|
|
542
626
|
this.sync();
|
|
543
627
|
}
|
|
544
628
|
});
|
|
545
|
-
window.addEventListener(
|
|
629
|
+
window.addEventListener("pageshow", (e) => {
|
|
546
630
|
if (e.persisted) {
|
|
547
631
|
this.sync();
|
|
548
632
|
}
|
|
@@ -570,12 +654,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
570
654
|
return;
|
|
571
655
|
}
|
|
572
656
|
this._info = info;
|
|
573
|
-
this.source =
|
|
657
|
+
this.source = "sync";
|
|
574
658
|
this.onDidChangeEmitter.fire(undefined);
|
|
575
659
|
} catch (e) {
|
|
576
|
-
console.error(
|
|
660
|
+
console.error("failed to sync workspace instance:", e);
|
|
577
661
|
}
|
|
578
|
-
})
|
|
662
|
+
});
|
|
579
663
|
}
|
|
580
664
|
private cancelSync(): void {
|
|
581
665
|
if (this.syncTokenSource) {
|
|
@@ -592,7 +676,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
592
676
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
593
677
|
return true;
|
|
594
678
|
}
|
|
595
|
-
if (this.source ===
|
|
679
|
+
if (this.source === "update") {
|
|
596
680
|
return false;
|
|
597
681
|
}
|
|
598
682
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -600,15 +684,13 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
600
684
|
}
|
|
601
685
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
602
686
|
}
|
|
603
|
-
|
|
604
687
|
}
|
|
605
688
|
|
|
606
689
|
export interface GitpodServiceOptions {
|
|
607
|
-
onReconnect?: () =>
|
|
690
|
+
onReconnect?: () => void | Promise<void>;
|
|
608
691
|
}
|
|
609
692
|
|
|
610
693
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
611
|
-
|
|
612
694
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
613
695
|
|
|
614
696
|
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
@@ -623,7 +705,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
623
705
|
|
|
624
706
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
625
707
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
626
|
-
const listener =
|
|
708
|
+
const listener =
|
|
709
|
+
this.instanceListeners.get(workspaceId) ||
|
|
627
710
|
(async () => {
|
|
628
711
|
const info = await this.server.getWorkspace(workspaceId);
|
|
629
712
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -639,26 +722,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
639
722
|
}
|
|
640
723
|
}
|
|
641
724
|
|
|
642
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
725
|
+
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
726
|
+
serverUrl: string | Promise<string>,
|
|
727
|
+
) {
|
|
643
728
|
const toWsUrl = (serverUrl: string) => {
|
|
644
|
-
return new GitpodHostUrl(serverUrl)
|
|
645
|
-
.asWebsocket()
|
|
646
|
-
.withApi({ pathname: GitpodServerPath })
|
|
647
|
-
.toString();
|
|
729
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
648
730
|
};
|
|
649
731
|
let url: string | Promise<string>;
|
|
650
732
|
if (typeof serverUrl === "string") {
|
|
651
733
|
url = toWsUrl(serverUrl);
|
|
652
734
|
} else {
|
|
653
|
-
url = serverUrl.then(url => toWsUrl(url));
|
|
735
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
654
736
|
}
|
|
655
737
|
|
|
656
738
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
657
|
-
let onReconnect = () => {
|
|
739
|
+
let onReconnect = () => {};
|
|
658
740
|
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
659
|
-
onListening: socket => {
|
|
741
|
+
onListening: (socket) => {
|
|
660
742
|
onReconnect = () => socket.reconnect();
|
|
661
|
-
}
|
|
743
|
+
},
|
|
662
744
|
});
|
|
663
745
|
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
664
|
-
}
|
|
746
|
+
}
|