@gitpod/gitpod-protocol 0.1.5-private-repos-after-cancellation.0 → 0.1.5-protected-secrets.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/gitpod-schema.json +145 -7
- package/lib/accounting-protocol.d.ts +18 -12
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +43 -42
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +28 -4
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +2 -13
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +12 -2
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/attribution.d.ts +23 -0
- package/lib/attribution.d.ts.map +1 -0
- package/lib/attribution.js +50 -0
- package/lib/attribution.js.map +1 -0
- package/lib/auth.d.ts.map +1 -1
- package/lib/billing-mode.d.ts +43 -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 +18 -5
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +63 -10
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +2 -0
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +81 -48
- package/lib/context-url.spec.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +4 -4
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +25 -26
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +29 -37
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +30 -44
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +31 -38
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +0 -6
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +7 -27
- 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 +36 -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/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +26 -42
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +145 -142
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +127 -52
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +190 -315
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +3 -13
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +3 -8
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +1 -1
- package/lib/ide-protocol.d.ts +113 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/{util/without.js → ide-protocol.js} +2 -2
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +16 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +30 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +31 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- package/lib/license-protocol.d.ts +7 -0
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +3 -3
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +173 -36
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +4 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +42 -59
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +19 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +82 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- 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 +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +24 -60
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +3 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +75 -162
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/oss-allowlist.d.ts +14 -0
- package/lib/oss-allowlist.d.ts.map +1 -0
- package/lib/oss-allowlist.js +8 -0
- package/lib/oss-allowlist.js.map +1 -0
- package/lib/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +1 -1
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +9 -4
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +39 -31
- 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 +229 -209
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +234 -143
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +339 -193
- package/lib/protocol.js.map +1 -1
- package/{src/util/without.ts → lib/protocol.spec.d.ts} +2 -3
- 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 +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/{src/theia-plugins.ts → lib/snapshot-url.spec.d.ts} +2 -6
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.d.ts +22 -4
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +33 -18
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +130 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +30 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/usage.d.ts +61 -0
- package/lib/usage.d.ts.map +1 -0
- package/lib/usage.js +14 -0
- package/lib/usage.js.map +1 -0
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +44 -26
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +57 -135
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js +17 -59
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +11 -11
- 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/deferred.js +10 -12
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +27 -40
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +63 -77
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -0
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +32 -47
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +6 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +469 -504
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +68 -78
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +41 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +4 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +124 -114
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +97 -135
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +34 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +90 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/jaeger-client-types.d.ts +68 -0
- package/lib/util/jaeger-client-types.d.ts.map +1 -0
- package/lib/{theia-plugins.js → util/jaeger-client-types.js} +1 -1
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +49 -33
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +132 -129
- 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.js +5 -5
- 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 +119 -0
- package/lib/util/nice-grpc.js.map +1 -0
- package/lib/util/parse-workspace-id.d.ts +10 -0
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +30 -7
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +4 -0
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +123 -84
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.js +16 -55
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.js +147 -288
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeat.d.ts +15 -0
- package/lib/util/repeat.d.ts.map +1 -0
- package/lib/util/repeat.js +55 -0
- package/lib/util/repeat.js.map +1 -0
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +15 -46
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +6 -6
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +2 -0
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +29 -17
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +2 -0
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +54 -23
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +52 -6
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +197 -64
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.d.ts +7 -0
- package/lib/util/tracing.spec.d.ts.map +1 -0
- package/lib/util/tracing.spec.js +121 -0
- package/lib/util/tracing.spec.js.map +1 -0
- package/lib/util/workspace-port-authentication.d.ts +7 -7
- 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 +15 -5
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +19 -4
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +44 -5
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +2 -2
- package/package.json +34 -15
- package/pkg-yarn.lock +21 -9
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +66 -54
- package/src/admin-protocol.ts +53 -21
- package/src/analytics.ts +28 -16
- package/src/attribution.ts +59 -0
- package/src/auth.ts +2 -2
- package/src/billing-mode.ts +81 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +37 -9
- package/src/context-url.ts +94 -36
- package/src/encryption/container-module.ts +2 -3
- package/src/encryption/encryption-engine.spec.ts +9 -8
- package/src/encryption/encryption-engine.ts +20 -16
- package/src/encryption/encryption-service.ts +4 -5
- package/src/encryption/key-provider.ts +16 -19
- package/src/env.ts +0 -22
- package/src/experiments/always-default.ts +24 -0
- package/src/experiments/configcat-server.ts +41 -0
- package/src/experiments/configcat.ts +56 -0
- package/src/experiments/types.ts +34 -0
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +286 -143
- package/src/headless-workspace-log.ts +8 -19
- package/src/ide-frontend-service.ts +2 -2
- package/src/ide-protocol.ts +129 -0
- package/src/index.ts +16 -12
- package/src/installation-admin-protocol.ts +45 -0
- package/src/license-protocol.ts +12 -6
- package/src/messaging/browser/connection.ts +185 -21
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +77 -0
- package/src/messaging/error.ts +29 -7
- package/src/messaging/handler.ts +13 -1
- package/src/messaging/node/connection.ts +23 -70
- package/src/messaging/proxy-factory.ts +35 -34
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +2 -2
- package/src/permission.ts +40 -33
- package/src/plans.ts +240 -189
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +612 -340
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +59 -23
- package/src/teams-projects-protocol.ts +166 -0
- package/src/typings/globals.ts +4 -4
- package/src/usage.ts +71 -0
- package/src/util/analytics.ts +56 -18
- package/src/util/async-iterator.ts +4 -5
- package/src/util/cancelable.ts +3 -3
- package/src/util/date-time.ts +8 -8
- package/src/util/debug-app.ts +81 -0
- package/src/util/deferred.ts +6 -6
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +14 -6
- package/src/util/generate-workspace-id.spec.ts +34 -7
- package/src/util/generate-workspace-id.ts +464 -440
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +40 -13
- package/src/util/gitpod-host-url.ts +61 -37
- package/src/util/grpc.ts +104 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.spec.ts +23 -0
- package/src/util/logging.ts +156 -74
- package/src/util/make-link.ts +6 -7
- package/src/util/nice-grpc.ts +93 -0
- package/src/util/parse-workspace-id.spec.ts +37 -8
- package/src/util/parse-workspace-id.ts +32 -7
- package/src/util/queue.spec.ts +27 -25
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +4 -6
- package/src/util/skip-if.ts +9 -6
- package/src/util/timeutil.spec.ts +40 -14
- package/src/util/timeutil.ts +27 -11
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +200 -31
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +29 -10
- package/src/workspace-instance.ts +89 -24
- package/src/wsready.ts +3 -3
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/email-protocol.d.ts +0 -50
- 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/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -46
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.js.map +0 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/lib/util/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -34
- package/lib/util/safe-promise.js.map +0 -1
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js.map +0 -1
- package/src/email-protocol.ts +0 -67
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
package/src/gitpod-service.ts
CHANGED
|
@@ -5,32 +5,72 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
User,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
User,
|
|
9
|
+
WorkspaceInfo,
|
|
10
|
+
WorkspaceCreationResult,
|
|
11
|
+
WorkspaceInstanceUser,
|
|
12
|
+
WhitelistedRepository,
|
|
13
|
+
WorkspaceImageBuild,
|
|
14
|
+
AuthProviderInfo,
|
|
15
|
+
CreateWorkspaceMode,
|
|
16
|
+
Token,
|
|
17
|
+
UserEnvVarValue,
|
|
18
|
+
Terms,
|
|
19
|
+
Configuration,
|
|
20
|
+
UserInfo,
|
|
21
|
+
GitpodTokenType,
|
|
22
|
+
GitpodToken,
|
|
23
|
+
AuthProviderEntry,
|
|
24
|
+
GuessGitTokenScopesParams,
|
|
25
|
+
GuessedGitTokenScopes,
|
|
26
|
+
ProjectEnvVar,
|
|
27
|
+
PrebuiltWorkspace,
|
|
28
|
+
UserSSHPublicKeyValue,
|
|
29
|
+
SSHPublicKeyValue,
|
|
30
|
+
} from "./protocol";
|
|
31
|
+
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 { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
|
|
63
|
+
import { ListUsageRequest, ListUsageResponse } from "./usage";
|
|
64
|
+
import { SupportedWorkspaceClass } from "./workspace-class";
|
|
65
|
+
import { BillingMode } from "./billing-mode";
|
|
29
66
|
|
|
30
67
|
export interface GitpodClient {
|
|
31
68
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
32
69
|
onWorkspaceImageBuildLogs: WorkspaceImageBuild.LogCallback;
|
|
33
|
-
|
|
70
|
+
|
|
71
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void;
|
|
72
|
+
|
|
73
|
+
onNotificationUpdated(): void;
|
|
34
74
|
|
|
35
75
|
onCreditAlert(creditAlert: CreditAlert): void;
|
|
36
76
|
|
|
@@ -40,19 +80,21 @@ export interface GitpodClient {
|
|
|
40
80
|
//#endregion
|
|
41
81
|
}
|
|
42
82
|
|
|
43
|
-
export const GitpodServer = Symbol(
|
|
44
|
-
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
|
|
83
|
+
export const GitpodServer = Symbol("GitpodServer");
|
|
84
|
+
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
45
85
|
// User related API
|
|
46
86
|
getLoggedInUser(): Promise<User>;
|
|
47
87
|
getTerms(): Promise<Terms>;
|
|
48
88
|
updateLoggedInUser(user: Partial<User>): Promise<User>;
|
|
89
|
+
sendPhoneNumberVerificationToken(phoneNumber: string): Promise<void>;
|
|
90
|
+
verifyPhoneNumberVerificationToken(phoneNumber: string, token: string): Promise<boolean>;
|
|
49
91
|
getAuthProviders(): Promise<AuthProviderInfo[]>;
|
|
50
92
|
getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
|
|
51
93
|
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
|
|
52
94
|
deleteOwnAuthProvider(params: GitpodServer.DeleteOwnAuthProviderParams): Promise<void>;
|
|
53
|
-
getBranding(): Promise<Branding>;
|
|
54
95
|
getConfiguration(): Promise<Configuration>;
|
|
55
96
|
getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
|
|
97
|
+
getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
|
|
56
98
|
/**
|
|
57
99
|
* @deprecated
|
|
58
100
|
*/
|
|
@@ -66,8 +108,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
66
108
|
getWorkspaceOwner(workspaceId: string): Promise<UserInfo | undefined>;
|
|
67
109
|
getWorkspaceUsers(workspaceId: string): Promise<WorkspaceInstanceUser[]>;
|
|
68
110
|
getFeaturedRepositories(): Promise<WhitelistedRepository[]>;
|
|
111
|
+
getSuggestedContextURLs(): Promise<string[]>;
|
|
112
|
+
/**
|
|
113
|
+
* **Security:**
|
|
114
|
+
* Sensitive information like an owner token is erased, since it allows access for all team members.
|
|
115
|
+
* If you need to access an owner token use `getOwnerToken` instead.
|
|
116
|
+
*/
|
|
69
117
|
getWorkspace(id: string): Promise<WorkspaceInfo>;
|
|
70
118
|
isWorkspaceOwner(workspaceId: string): Promise<boolean>;
|
|
119
|
+
getOwnerToken(workspaceId: string): Promise<string>;
|
|
71
120
|
|
|
72
121
|
/**
|
|
73
122
|
* Creates and starts a workspace for the given context URL.
|
|
@@ -84,9 +133,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
84
133
|
updateWorkspaceUserPin(id: string, action: GitpodServer.PinAction): Promise<void>;
|
|
85
134
|
sendHeartBeat(options: GitpodServer.SendHeartBeatOptions): Promise<void>;
|
|
86
135
|
watchWorkspaceImageBuildLogs(workspaceId: string): Promise<void>;
|
|
87
|
-
watchHeadlessWorkspaceLogs(workspaceId: string): Promise<void>;
|
|
88
136
|
isPrebuildDone(pwsid: string): Promise<boolean>;
|
|
89
|
-
getHeadlessLog(instanceId: string): Promise<
|
|
137
|
+
getHeadlessLog(instanceId: string): Promise<HeadlessLogUrls>;
|
|
90
138
|
|
|
91
139
|
// Workspace timeout
|
|
92
140
|
setWorkspaceTimeout(workspaceId: string, duration: WorkspaceTimeoutDuration): Promise<SetWorkspaceTimeoutResult>;
|
|
@@ -104,13 +152,19 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
104
152
|
getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
|
|
105
153
|
updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
|
|
106
154
|
|
|
107
|
-
//
|
|
155
|
+
// User env vars
|
|
108
156
|
getEnvVars(): Promise<UserEnvVarValue[]>;
|
|
109
157
|
getAllEnvVars(): Promise<UserEnvVarValue[]>;
|
|
110
158
|
setEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
111
159
|
deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
112
160
|
|
|
113
|
-
//
|
|
161
|
+
// User SSH Keys
|
|
162
|
+
hasSSHPublicKey(): Promise<boolean>;
|
|
163
|
+
getSSHPublicKeys(): Promise<UserSSHPublicKeyValue[]>;
|
|
164
|
+
addSSHPublicKey(value: SSHPublicKeyValue): Promise<UserSSHPublicKeyValue>;
|
|
165
|
+
deleteSSHPublicKey(id: string): Promise<void>;
|
|
166
|
+
|
|
167
|
+
// Teams
|
|
114
168
|
getTeams(): Promise<Team[]>;
|
|
115
169
|
getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
|
|
116
170
|
createTeam(name: string): Promise<Team>;
|
|
@@ -119,10 +173,34 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
119
173
|
removeTeamMember(teamId: string, userId: string): Promise<void>;
|
|
120
174
|
getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
|
|
121
175
|
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
176
|
+
deleteTeam(teamId: string, userId: string): Promise<void>;
|
|
177
|
+
|
|
178
|
+
// Admin Settings
|
|
179
|
+
adminGetSettings(): Promise<InstallationAdminSettings>;
|
|
180
|
+
adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
|
|
181
|
+
adminGetTelemetryData(): Promise<TelemetryData>;
|
|
182
|
+
|
|
183
|
+
// Projects
|
|
184
|
+
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
185
|
+
createProject(params: CreateProjectParams): Promise<Project>;
|
|
186
|
+
deleteProject(projectId: string): Promise<void>;
|
|
187
|
+
getTeamProjects(teamId: string): Promise<Project[]>;
|
|
188
|
+
getUserProjects(): Promise<Project[]>;
|
|
189
|
+
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
190
|
+
getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
|
|
191
|
+
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
192
|
+
findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
|
|
193
|
+
getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
|
|
194
|
+
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
195
|
+
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
196
|
+
updateProjectPartial(partialProject: PartialProject): Promise<void>;
|
|
197
|
+
setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
|
|
198
|
+
getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
|
|
199
|
+
deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
|
|
122
200
|
|
|
123
201
|
// content service
|
|
124
|
-
getContentBlobUploadUrl(name: string): Promise<string
|
|
125
|
-
getContentBlobDownloadUrl(name: string): Promise<string
|
|
202
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
203
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
126
204
|
|
|
127
205
|
// Gitpod token
|
|
128
206
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
@@ -130,38 +208,24 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
130
208
|
deleteGitpodToken(tokenHash: string): Promise<void>;
|
|
131
209
|
|
|
132
210
|
// misc
|
|
133
|
-
|
|
211
|
+
isGitHubAppEnabled(): Promise<boolean>;
|
|
134
212
|
registerGithubApp(installationId: string): Promise<void>;
|
|
135
213
|
|
|
136
214
|
/**
|
|
137
|
-
* Stores a new snapshot for the given workspace and bucketId
|
|
215
|
+
* Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
|
|
138
216
|
* @return the snapshot id
|
|
139
217
|
*/
|
|
140
218
|
takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Returns the list of snapshots that exist for a workspace.
|
|
144
|
-
*/
|
|
145
|
-
getSnapshots(workspaceID: string): Promise<string[]>;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* stores/updates layout information for the given workspace
|
|
149
|
-
*/
|
|
150
|
-
storeLayout(workspaceId: string, layoutData: string): Promise<void>;
|
|
151
|
-
|
|
152
219
|
/**
|
|
153
|
-
*
|
|
220
|
+
*
|
|
221
|
+
* @param snapshotId
|
|
154
222
|
*/
|
|
155
|
-
|
|
223
|
+
waitForSnapshot(snapshotId: string): Promise<void>;
|
|
156
224
|
|
|
157
225
|
/**
|
|
158
|
-
*
|
|
159
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
226
|
+
* Returns the list of snapshots that exist for a workspace.
|
|
160
227
|
*/
|
|
161
|
-
|
|
162
|
-
resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
|
|
163
|
-
installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
|
|
164
|
-
uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
|
|
228
|
+
getSnapshots(workspaceID: string): Promise<string[]>;
|
|
165
229
|
|
|
166
230
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
167
231
|
|
|
@@ -169,8 +233,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
169
233
|
* gitpod.io concerns
|
|
170
234
|
*/
|
|
171
235
|
isStudent(): Promise<boolean>;
|
|
172
|
-
getPrivateRepoTrialEndDate(): Promise<string | undefined>;
|
|
173
|
-
|
|
174
236
|
/**
|
|
175
237
|
*
|
|
176
238
|
*/
|
|
@@ -182,102 +244,167 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
182
244
|
*/
|
|
183
245
|
getChargebeeSiteId(): Promise<string>;
|
|
184
246
|
createPortalSession(): Promise<{}>;
|
|
247
|
+
createTeamPortalSession(teamId: string): Promise<{}>;
|
|
185
248
|
checkout(planId: string, planQuantity?: number): Promise<{}>;
|
|
249
|
+
teamCheckout(teamId: string, planId: string): Promise<{}>;
|
|
186
250
|
getAvailableCoupons(): Promise<PlanCoupon[]>;
|
|
187
251
|
getAppliedCoupons(): Promise<PlanCoupon[]>;
|
|
188
252
|
|
|
189
253
|
getShowPaymentUI(): Promise<boolean>;
|
|
190
254
|
isChargebeeCustomer(): Promise<boolean>;
|
|
191
|
-
mayAccessPrivateRepo(): Promise<boolean>;
|
|
192
255
|
|
|
193
256
|
subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
194
257
|
subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
195
258
|
subscriptionCancel(subscriptionId: string): Promise<void>;
|
|
196
259
|
subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
|
|
197
260
|
|
|
261
|
+
getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
|
|
198
262
|
tsGet(): Promise<TeamSubscription[]>;
|
|
199
263
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
200
|
-
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined
|
|
264
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
201
265
|
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
202
|
-
tsAssignSlot(
|
|
266
|
+
tsAssignSlot(
|
|
267
|
+
teamSubscriptionId: string,
|
|
268
|
+
teamSubscriptionSlotId: string,
|
|
269
|
+
identityStr: string | undefined,
|
|
270
|
+
): Promise<void>;
|
|
203
271
|
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
204
272
|
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
205
273
|
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
206
274
|
|
|
207
275
|
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
208
276
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
277
|
+
getStripePublishableKey(): Promise<string>;
|
|
278
|
+
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
279
|
+
findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
|
|
280
|
+
createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
|
|
281
|
+
subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
|
|
282
|
+
getStripePortalUrl(attributionId: string): Promise<string>;
|
|
283
|
+
getUsageLimit(attributionId: string): Promise<number | undefined>;
|
|
284
|
+
setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
|
|
285
|
+
|
|
286
|
+
listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
|
|
287
|
+
|
|
288
|
+
setUsageAttribution(usageAttribution: string): Promise<void>;
|
|
289
|
+
|
|
290
|
+
getBillingModeForUser(): Promise<BillingMode>;
|
|
291
|
+
getBillingModeForTeam(teamId: string): Promise<BillingMode>;
|
|
216
292
|
|
|
217
293
|
/**
|
|
218
294
|
* Analytics
|
|
219
295
|
*/
|
|
220
296
|
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
297
|
+
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
298
|
+
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Frontend notifications
|
|
302
|
+
*/
|
|
303
|
+
getNotifications(): Promise<string[]>;
|
|
304
|
+
|
|
305
|
+
getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface RateLimiterError {
|
|
309
|
+
method?: string;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Retry after this many seconds, earliest.
|
|
313
|
+
* cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
314
|
+
*/
|
|
315
|
+
retryAfter: number;
|
|
221
316
|
}
|
|
222
317
|
|
|
223
318
|
export interface CreateProjectParams {
|
|
224
319
|
name: string;
|
|
225
|
-
|
|
226
|
-
provider: string;
|
|
320
|
+
slug: string;
|
|
227
321
|
cloneUrl: string;
|
|
228
|
-
teamId
|
|
322
|
+
teamId?: string;
|
|
323
|
+
userId?: string;
|
|
229
324
|
appInstallationId: string;
|
|
230
325
|
}
|
|
326
|
+
export interface FindPrebuildsParams {
|
|
327
|
+
projectId: string;
|
|
328
|
+
branch?: string;
|
|
329
|
+
latest?: boolean;
|
|
330
|
+
prebuildId?: string;
|
|
331
|
+
// default: 30
|
|
332
|
+
limit?: number;
|
|
333
|
+
}
|
|
231
334
|
export interface GetProviderRepositoriesParams {
|
|
232
335
|
provider: string;
|
|
233
336
|
hints?: { installationId: string } | object;
|
|
234
337
|
}
|
|
235
338
|
export interface ProviderRepository {
|
|
236
339
|
name: string;
|
|
340
|
+
path?: string;
|
|
237
341
|
account: string;
|
|
238
342
|
accountAvatarUrl: string;
|
|
239
343
|
cloneUrl: string;
|
|
240
|
-
updatedAt
|
|
344
|
+
updatedAt?: string;
|
|
241
345
|
installationId?: number;
|
|
242
346
|
installationUpdatedAt?: string;
|
|
347
|
+
|
|
348
|
+
inUse?: { userName: string };
|
|
243
349
|
}
|
|
244
350
|
|
|
245
|
-
export
|
|
351
|
+
export interface ClientHeaderFields {
|
|
352
|
+
ip?: string;
|
|
353
|
+
userAgent?: string;
|
|
354
|
+
dnt?: string;
|
|
355
|
+
clientRegion?: string;
|
|
356
|
+
}
|
|
246
357
|
|
|
247
|
-
export const
|
|
358
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_SHORT = "short";
|
|
359
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_LONG = "long";
|
|
360
|
+
export const WORKSPACE_TIMEOUT_EXTENDED = "extended";
|
|
361
|
+
export const WORKSPACE_TIMEOUT_EXTENDED_ALT = "180m"; // for backwards compatibility since the IDE uses this
|
|
362
|
+
export const WorkspaceTimeoutValues = [
|
|
363
|
+
WORKSPACE_TIMEOUT_DEFAULT_SHORT,
|
|
364
|
+
WORKSPACE_TIMEOUT_DEFAULT_LONG,
|
|
365
|
+
WORKSPACE_TIMEOUT_EXTENDED,
|
|
366
|
+
WORKSPACE_TIMEOUT_EXTENDED_ALT,
|
|
367
|
+
] as const;
|
|
368
|
+
|
|
369
|
+
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
370
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
371
|
+
): GitpodServiceImpl<C, S> {
|
|
248
372
|
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
249
|
-
}
|
|
373
|
+
};
|
|
250
374
|
|
|
251
|
-
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
252
|
-
methods
|
|
253
|
-
|
|
375
|
+
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
376
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
377
|
+
): JsonRpcProxy<S> {
|
|
378
|
+
methods.setClient = methods.setClient || (() => {});
|
|
379
|
+
methods.dispose = methods.dispose || (() => {});
|
|
254
380
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
255
381
|
// @ts-ignore
|
|
256
382
|
get: (target: S, property: keyof S) => {
|
|
257
383
|
const result = target[property];
|
|
258
384
|
if (!result) {
|
|
259
|
-
throw new Error(`Method ${property} not implemented`);
|
|
385
|
+
throw new Error(`Method ${String(property)} not implemented`);
|
|
260
386
|
}
|
|
261
387
|
return result;
|
|
262
|
-
}
|
|
388
|
+
},
|
|
263
389
|
});
|
|
264
|
-
}
|
|
390
|
+
};
|
|
265
391
|
|
|
266
392
|
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
267
393
|
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
268
394
|
|
|
269
395
|
export interface SetWorkspaceTimeoutResult {
|
|
270
|
-
resetTimeoutOnWorkspaces: string[]
|
|
396
|
+
resetTimeoutOnWorkspaces: string[];
|
|
271
397
|
}
|
|
272
398
|
|
|
273
399
|
export interface GetWorkspaceTimeoutResult {
|
|
274
|
-
duration: WorkspaceTimeoutDuration
|
|
275
|
-
|
|
400
|
+
duration: WorkspaceTimeoutDuration;
|
|
401
|
+
durationRaw: string;
|
|
402
|
+
canChange: boolean;
|
|
276
403
|
}
|
|
277
404
|
|
|
278
405
|
export interface StartWorkspaceResult {
|
|
279
|
-
instanceID: string
|
|
280
|
-
workspaceURL?: string
|
|
406
|
+
instanceID: string;
|
|
407
|
+
workspaceURL?: string;
|
|
281
408
|
}
|
|
282
409
|
|
|
283
410
|
export namespace GitpodServer {
|
|
@@ -285,6 +412,8 @@ export namespace GitpodServer {
|
|
|
285
412
|
limit?: number;
|
|
286
413
|
searchString?: string;
|
|
287
414
|
pinnedOnly?: boolean;
|
|
415
|
+
projectId?: string | string[];
|
|
416
|
+
includeWithoutProject?: boolean;
|
|
288
417
|
}
|
|
289
418
|
export interface GetAccountStatementOptions {
|
|
290
419
|
date?: string;
|
|
@@ -292,13 +421,15 @@ export namespace GitpodServer {
|
|
|
292
421
|
export interface CreateWorkspaceOptions {
|
|
293
422
|
contextUrl: string;
|
|
294
423
|
mode?: CreateWorkspaceMode;
|
|
424
|
+
forceDefaultConfig?: boolean;
|
|
295
425
|
}
|
|
296
426
|
export interface StartWorkspaceOptions {
|
|
297
427
|
forceDefaultImage: boolean;
|
|
298
428
|
}
|
|
299
429
|
export interface TakeSnapshotOptions {
|
|
300
430
|
workspaceId: string;
|
|
301
|
-
|
|
431
|
+
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
432
|
+
dontWait?: boolean;
|
|
302
433
|
}
|
|
303
434
|
export interface GetUserStorageResourceOptions {
|
|
304
435
|
readonly uri: string;
|
|
@@ -316,23 +447,23 @@ export namespace GitpodServer {
|
|
|
316
447
|
readonly roundTripTime?: number;
|
|
317
448
|
}
|
|
318
449
|
export interface UpdateOwnAuthProviderParams {
|
|
319
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
450
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
320
451
|
}
|
|
321
452
|
export interface DeleteOwnAuthProviderParams {
|
|
322
|
-
readonly id: string
|
|
453
|
+
readonly id: string;
|
|
323
454
|
}
|
|
324
455
|
export type AdmissionLevel = "owner" | "everyone";
|
|
325
456
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
326
457
|
export interface GenerateNewGitpodTokenOptions {
|
|
327
|
-
name?: string
|
|
328
|
-
type: GitpodTokenType
|
|
329
|
-
scopes?: string[]
|
|
458
|
+
name?: string;
|
|
459
|
+
type: GitpodTokenType;
|
|
460
|
+
scopes?: string[];
|
|
330
461
|
}
|
|
331
462
|
}
|
|
332
463
|
|
|
333
|
-
export const GitpodServerPath =
|
|
464
|
+
export const GitpodServerPath = "/gitpod";
|
|
334
465
|
|
|
335
|
-
export const GitpodServerProxy = Symbol(
|
|
466
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
336
467
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
337
468
|
|
|
338
469
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -340,12 +471,14 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
340
471
|
|
|
341
472
|
public registerClient(client: Partial<Client>): Disposable {
|
|
342
473
|
this.clients.push(client);
|
|
343
|
-
const index = this.clients.length;
|
|
344
474
|
return {
|
|
345
475
|
dispose: () => {
|
|
346
|
-
this.clients.
|
|
347
|
-
|
|
348
|
-
|
|
476
|
+
const index = this.clients.indexOf(client);
|
|
477
|
+
if (index > -1) {
|
|
478
|
+
this.clients.splice(index, 1);
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
};
|
|
349
482
|
}
|
|
350
483
|
|
|
351
484
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -354,31 +487,34 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
354
487
|
try {
|
|
355
488
|
client.onInstanceUpdate(instance);
|
|
356
489
|
} catch (error) {
|
|
357
|
-
console.error(error)
|
|
490
|
+
console.error(error);
|
|
358
491
|
}
|
|
359
492
|
}
|
|
360
493
|
}
|
|
361
494
|
}
|
|
362
495
|
|
|
363
|
-
|
|
496
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void {
|
|
364
497
|
for (const client of this.clients) {
|
|
365
|
-
if (client.
|
|
498
|
+
if (client.onPrebuildUpdate) {
|
|
366
499
|
try {
|
|
367
|
-
client.
|
|
500
|
+
client.onPrebuildUpdate(update);
|
|
368
501
|
} catch (error) {
|
|
369
|
-
console.error(error)
|
|
502
|
+
console.error(error);
|
|
370
503
|
}
|
|
371
504
|
}
|
|
372
505
|
}
|
|
373
506
|
}
|
|
374
507
|
|
|
375
|
-
|
|
508
|
+
onWorkspaceImageBuildLogs(
|
|
509
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
510
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
511
|
+
): void {
|
|
376
512
|
for (const client of this.clients) {
|
|
377
|
-
if (client.
|
|
513
|
+
if (client.onWorkspaceImageBuildLogs) {
|
|
378
514
|
try {
|
|
379
|
-
client.
|
|
515
|
+
client.onWorkspaceImageBuildLogs(info, content);
|
|
380
516
|
} catch (error) {
|
|
381
|
-
console.error(error)
|
|
517
|
+
console.error(error);
|
|
382
518
|
}
|
|
383
519
|
}
|
|
384
520
|
}
|
|
@@ -390,7 +526,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
390
526
|
try {
|
|
391
527
|
client.notifyDidOpenConnection();
|
|
392
528
|
} catch (error) {
|
|
393
|
-
console.error(error)
|
|
529
|
+
console.error(error);
|
|
394
530
|
}
|
|
395
531
|
}
|
|
396
532
|
}
|
|
@@ -402,7 +538,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
402
538
|
try {
|
|
403
539
|
client.notifyDidCloseConnection();
|
|
404
540
|
} catch (error) {
|
|
405
|
-
console.error(error)
|
|
541
|
+
console.error(error);
|
|
406
542
|
}
|
|
407
543
|
}
|
|
408
544
|
}
|
|
@@ -414,64 +550,73 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
414
550
|
try {
|
|
415
551
|
client.onCreditAlert(creditAlert);
|
|
416
552
|
} catch (error) {
|
|
417
|
-
console.error(error)
|
|
553
|
+
console.error(error);
|
|
418
554
|
}
|
|
419
555
|
}
|
|
420
556
|
}
|
|
421
557
|
}
|
|
422
558
|
|
|
559
|
+
onNotificationUpdated(): void {
|
|
560
|
+
for (const client of this.clients) {
|
|
561
|
+
if (client.onNotificationUpdated) {
|
|
562
|
+
try {
|
|
563
|
+
client.onNotificationUpdated();
|
|
564
|
+
} catch (error) {
|
|
565
|
+
console.error(error);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
423
570
|
}
|
|
424
571
|
|
|
425
572
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
426
573
|
|
|
427
|
-
const hasWindow =
|
|
574
|
+
const hasWindow = typeof window !== "undefined";
|
|
428
575
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
429
576
|
unknown: 0,
|
|
430
577
|
preparing: 1,
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
578
|
+
building: 2,
|
|
579
|
+
pending: 3,
|
|
580
|
+
creating: 4,
|
|
581
|
+
initializing: 5,
|
|
582
|
+
running: 6,
|
|
583
|
+
interrupted: 7,
|
|
584
|
+
stopping: 8,
|
|
585
|
+
stopped: 9,
|
|
438
586
|
};
|
|
439
587
|
export class WorkspaceInstanceUpdateListener {
|
|
440
588
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
441
589
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
442
590
|
|
|
443
|
-
private source:
|
|
591
|
+
private source: "sync" | "update" = "sync";
|
|
444
592
|
|
|
445
593
|
get info(): WorkspaceInfo {
|
|
446
594
|
return this._info;
|
|
447
595
|
}
|
|
448
596
|
|
|
449
|
-
constructor(
|
|
450
|
-
private readonly service: GitpodService,
|
|
451
|
-
private _info: WorkspaceInfo
|
|
452
|
-
) {
|
|
597
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
453
598
|
service.registerClient({
|
|
454
|
-
onInstanceUpdate: instance => {
|
|
599
|
+
onInstanceUpdate: (instance) => {
|
|
455
600
|
if (this.isOutOfOrder(instance)) {
|
|
456
601
|
return;
|
|
457
602
|
}
|
|
458
603
|
this.cancelSync();
|
|
459
604
|
this._info.latestInstance = instance;
|
|
460
|
-
this.source =
|
|
605
|
+
this.source = "update";
|
|
461
606
|
this.onDidChangeEmitter.fire(undefined);
|
|
462
607
|
},
|
|
463
608
|
notifyDidOpenConnection: () => {
|
|
464
609
|
this.sync();
|
|
465
|
-
}
|
|
610
|
+
},
|
|
466
611
|
});
|
|
467
612
|
if (hasWindow) {
|
|
468
613
|
// learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
|
|
469
|
-
window.document.addEventListener(
|
|
470
|
-
if (window.document.visibilityState ===
|
|
614
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
615
|
+
if (window.document.visibilityState === "visible") {
|
|
471
616
|
this.sync();
|
|
472
617
|
}
|
|
473
618
|
});
|
|
474
|
-
window.addEventListener(
|
|
619
|
+
window.addEventListener("pageshow", (e) => {
|
|
475
620
|
if (e.persisted) {
|
|
476
621
|
this.sync();
|
|
477
622
|
}
|
|
@@ -499,12 +644,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
499
644
|
return;
|
|
500
645
|
}
|
|
501
646
|
this._info = info;
|
|
502
|
-
this.source =
|
|
647
|
+
this.source = "sync";
|
|
503
648
|
this.onDidChangeEmitter.fire(undefined);
|
|
504
649
|
} catch (e) {
|
|
505
|
-
console.error(
|
|
650
|
+
console.error("failed to sync workspace instance:", e);
|
|
506
651
|
}
|
|
507
|
-
})
|
|
652
|
+
});
|
|
508
653
|
}
|
|
509
654
|
private cancelSync(): void {
|
|
510
655
|
if (this.syncTokenSource) {
|
|
@@ -521,7 +666,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
521
666
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
522
667
|
return true;
|
|
523
668
|
}
|
|
524
|
-
if (this.source ===
|
|
669
|
+
if (this.source === "update") {
|
|
525
670
|
return false;
|
|
526
671
|
}
|
|
527
672
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -529,15 +674,13 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
529
674
|
}
|
|
530
675
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
531
676
|
}
|
|
532
|
-
|
|
533
677
|
}
|
|
534
678
|
|
|
535
679
|
export interface GitpodServiceOptions {
|
|
536
|
-
onReconnect?: () =>
|
|
680
|
+
onReconnect?: () => void | Promise<void>;
|
|
537
681
|
}
|
|
538
682
|
|
|
539
683
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
540
|
-
|
|
541
684
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
542
685
|
|
|
543
686
|
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
@@ -552,7 +695,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
552
695
|
|
|
553
696
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
554
697
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
555
|
-
const listener =
|
|
698
|
+
const listener =
|
|
699
|
+
this.instanceListeners.get(workspaceId) ||
|
|
556
700
|
(async () => {
|
|
557
701
|
const info = await this.server.getWorkspace(workspaceId);
|
|
558
702
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -568,26 +712,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
568
712
|
}
|
|
569
713
|
}
|
|
570
714
|
|
|
571
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
715
|
+
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
716
|
+
serverUrl: string | Promise<string>,
|
|
717
|
+
) {
|
|
572
718
|
const toWsUrl = (serverUrl: string) => {
|
|
573
|
-
return new GitpodHostUrl(serverUrl)
|
|
574
|
-
.asWebsocket()
|
|
575
|
-
.withApi({ pathname: GitpodServerPath })
|
|
576
|
-
.toString();
|
|
719
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
577
720
|
};
|
|
578
721
|
let url: string | Promise<string>;
|
|
579
722
|
if (typeof serverUrl === "string") {
|
|
580
723
|
url = toWsUrl(serverUrl);
|
|
581
724
|
} else {
|
|
582
|
-
url = serverUrl.then(url => toWsUrl(url));
|
|
725
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
583
726
|
}
|
|
584
727
|
|
|
585
728
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
586
|
-
let onReconnect = () => {
|
|
729
|
+
let onReconnect = () => {};
|
|
587
730
|
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
588
|
-
onListening: socket => {
|
|
731
|
+
onListening: (socket) => {
|
|
589
732
|
onReconnect = () => socket.reconnect();
|
|
590
|
-
}
|
|
733
|
+
},
|
|
591
734
|
});
|
|
592
735
|
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
593
|
-
}
|
|
736
|
+
}
|