@gitpod/gitpod-protocol 0.1.5-update-ovsx.0 → 0.1.5-update-yarnlock.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 +159 -25
- package/lib/accounting-protocol.d.ts +165 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +120 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +51 -6
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +17 -2
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +44 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/attribution.d.ts +25 -0
- package/lib/attribution.d.ts.map +1 -0
- package/lib/attribution.js +58 -0
- package/lib/attribution.js.map +1 -0
- package/lib/auth.d.ts +25 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +16 -0
- package/lib/auth.js.map +1 -0
- package/lib/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 +30 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +100 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +12 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +81 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/encryption/container-module.d.ts +2 -2
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +8 -6
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +2 -2
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +28 -28
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +3 -3
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +32 -39
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +2 -2
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +33 -46
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +3 -3
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +34 -40
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +2 -8
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +10 -29
- 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 +99 -0
- package/lib/frontend-dashboard-service.d.ts.map +1 -0
- package/lib/frontend-dashboard-service.js +55 -0
- package/lib/frontend-dashboard-service.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts +2 -2
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +29 -44
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.d.ts +2 -2
- package/lib/gitpod-file-parser.spec.js +147 -144
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +290 -50
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +288 -123
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +11 -13
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +8 -9
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +26 -0
- package/lib/ide-frontend-service.d.ts.map +1 -0
- package/lib/ide-frontend-service.js +8 -0
- package/lib/ide-frontend-service.js.map +1 -0
- package/lib/ide-protocol.d.ts +126 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/ide-protocol.js +18 -0
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +18 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +28 -13
- 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 +9 -2
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js +3 -2
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +6 -4
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +188 -48
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +9 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +48 -59
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +21 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +95 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/error.d.ts +18 -4
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +38 -7
- 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 +2 -1
- package/lib/messaging/handler.js.map +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +24 -59
- 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 +76 -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 +18 -0
- package/lib/payment-protocol.d.ts.map +1 -0
- package/lib/payment-protocol.js +13 -0
- package/lib/payment-protocol.js.map +1 -0
- package/lib/permission.d.ts +26 -15
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +50 -36
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +213 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +625 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +338 -111
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +422 -201
- 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 +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/lib/snapshot-url.spec.d.ts +7 -0
- 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 +93 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +82 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +136 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +41 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/typings/globals.d.ts +8 -3
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/typings/globals.js +2 -2
- 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 +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +88 -0
- package/lib/util/analytics.js.map +1 -0
- package/lib/util/async-iterator.d.ts +2 -2
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +60 -137
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +2 -2
- package/lib/util/cancelable.js +20 -61
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +2 -2
- package/lib/util/date-time.js +14 -13
- 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 +2 -2
- package/lib/util/deep-partial.js +2 -2
- package/lib/util/deferred.d.ts +2 -2
- package/lib/util/deferred.js +13 -14
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts +2 -2
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +28 -40
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +64 -77
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +3 -2
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +35 -49
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +9 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.js +491 -0
- package/lib/util/generate-workspace-id.js.map +1 -0
- package/lib/util/generate-workspace-id.spec.d.ts +7 -0
- package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.spec.js +98 -0
- package/lib/util/generate-workspace-id.spec.js.map +1 -0
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +41 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +20 -8
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +143 -85
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +16 -0
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -0
- package/lib/util/gitpod-host-url.spec.js +134 -0
- package/lib/util/gitpod-host-url.spec.js.map +1 -0
- package/lib/util/grpc.d.ts +35 -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/util/jaeger-client-types.js +8 -0
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +58 -35
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +144 -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.d.ts +2 -2
- package/lib/util/make-link.js +8 -7
- 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 +15 -5
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +39 -9
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +10 -2
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +130 -49
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +2 -2
- package/lib/util/queue.js +19 -57
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.d.ts +2 -2
- package/lib/util/queue.spec.js +149 -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 +2 -2
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +18 -48
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +2 -2
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +9 -8
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +4 -2
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +43 -18
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +4 -2
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +57 -25
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +55 -8
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +210 -66
- 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 +9 -9
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +13 -14
- 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 +80 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +36 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +51 -8
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +2 -2
- package/lib/wsready.d.ts +8 -2
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +4 -3
- package/lib/wsready.js.map +1 -1
- package/package.json +42 -18
- package/pkg-yarn.lock +24 -10
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +253 -0
- package/src/admin-protocol.ts +96 -21
- package/src/analytics.ts +52 -0
- package/src/attribution.ts +67 -0
- package/src/auth.ts +27 -0
- package/src/billing-mode.ts +84 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +49 -0
- package/src/context-url.ts +107 -0
- package/src/encryption/container-module.ts +4 -5
- package/src/encryption/encryption-engine.spec.ts +11 -10
- package/src/encryption/encryption-engine.ts +22 -18
- package/src/encryption/encryption-service.ts +6 -7
- package/src/encryption/key-provider.ts +18 -21
- package/src/env.ts +3 -26
- 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 +148 -0
- package/src/gitpod-file-parser.spec.ts +57 -63
- package/src/gitpod-file-parser.ts +18 -19
- package/src/gitpod-service.ts +602 -99
- package/src/headless-workspace-log.ts +14 -16
- package/src/ide-frontend-service.ts +28 -0
- package/src/ide-protocol.ts +147 -0
- package/src/index.ts +18 -12
- package/src/installation-admin-protocol.ts +45 -0
- package/src/license-protocol.ts +14 -8
- package/src/messaging/browser/connection.ts +202 -26
- package/src/messaging/browser/window-connection.ts +45 -29
- package/src/messaging/client-call-metrics.ts +94 -0
- package/src/messaging/error.ts +51 -10
- 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 +20 -0
- package/src/permission.ts +53 -40
- package/src/plans.ts +699 -0
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +790 -302
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +153 -0
- package/src/teams-projects-protocol.ts +180 -0
- package/src/typings/globals.ts +13 -5
- package/src/usage.ts +85 -0
- package/src/util/analytics.ts +109 -0
- package/src/util/async-iterator.ts +6 -7
- package/src/util/cancelable.ts +5 -5
- package/src/util/date-time.ts +10 -10
- package/src/util/debug-app.ts +81 -0
- package/src/util/deep-partial.ts +2 -2
- package/src/util/deferred.ts +8 -8
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +18 -10
- package/src/util/generate-workspace-id.spec.ts +58 -0
- package/src/util/generate-workspace-id.ts +481 -0
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +76 -0
- package/src/util/gitpod-host-url.ts +119 -40
- package/src/util/grpc.ts +107 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.spec.ts +23 -0
- package/src/util/logging.ts +163 -73
- package/src/util/make-link.ts +8 -9
- package/src/util/nice-grpc.ts +96 -0
- package/src/util/parse-workspace-id.spec.ts +62 -12
- package/src/util/parse-workspace-id.ts +40 -10
- package/src/util/queue.spec.ts +30 -28
- package/src/util/queue.ts +2 -2
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +8 -10
- package/src/util/skip-if.ts +12 -9
- package/src/util/timeutil.spec.ts +42 -16
- package/src/util/timeutil.ts +33 -17
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +211 -33
- package/src/util/workspace-port-authentication.ts +12 -15
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +121 -0
- package/src/workspace-instance.ts +120 -36
- package/src/wsready.ts +11 -4
- package/data/builtin-theia-plugins.json +0 -362
- package/lib/email-protocol.d.ts +0 -49
- package/lib/email-protocol.d.ts.map +0 -1
- package/lib/email-protocol.js +0 -27
- 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 -45
- 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 +0 -8
- 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 -117
- 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 -33
- 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 +0 -8
- 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/theia-plugins.ts +0 -11
- 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/util/without.ts +0 -8
package/src/gitpod-service.ts
CHANGED
|
@@ -1,42 +1,105 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
import {
|
|
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
|
+
EnvVarWithValue,
|
|
31
|
+
WorkspaceTimeoutSetting,
|
|
32
|
+
} from "./protocol";
|
|
33
|
+
import {
|
|
34
|
+
Team,
|
|
35
|
+
TeamMemberInfo,
|
|
36
|
+
TeamMembershipInvite,
|
|
37
|
+
Project,
|
|
38
|
+
TeamMemberRole,
|
|
39
|
+
PrebuildWithStatus,
|
|
40
|
+
StartPrebuildResult,
|
|
41
|
+
PartialProject,
|
|
42
|
+
PrebuildEvent,
|
|
43
|
+
} from "./teams-projects-protocol";
|
|
44
|
+
import { JsonRpcProxy, JsonRpcServer } from "./messaging/proxy-factory";
|
|
45
|
+
import { Disposable, CancellationTokenSource } from "vscode-jsonrpc";
|
|
46
|
+
import { HeadlessLogUrls } from "./headless-workspace-log";
|
|
47
|
+
import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from "./workspace-instance";
|
|
48
|
+
import { AdminServer } from "./admin-protocol";
|
|
49
|
+
import { GitpodHostUrl } from "./util/gitpod-host-url";
|
|
50
|
+
import { WebSocketConnectionProvider } from "./messaging/browser/connection";
|
|
51
|
+
import { PermissionName } from "./permission";
|
|
52
|
+
import { LicenseService } from "./license-protocol";
|
|
53
|
+
import { Emitter } from "./util/event";
|
|
54
|
+
import { AccountStatement, CreditAlert } from "./accounting-protocol";
|
|
55
|
+
import { GithubUpgradeURL, PlanCoupon } from "./payment-protocol";
|
|
56
|
+
import {
|
|
57
|
+
TeamSubscription,
|
|
58
|
+
TeamSubscription2,
|
|
59
|
+
TeamSubscriptionSlot,
|
|
60
|
+
TeamSubscriptionSlotResolved,
|
|
61
|
+
} from "./team-subscription-protocol";
|
|
62
|
+
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
|
|
63
|
+
import { IDEServer } from "./ide-protocol";
|
|
64
|
+
import { ListUsageRequest, ListUsageResponse, CostCenterJSON } from "./usage";
|
|
65
|
+
import { SupportedWorkspaceClass } from "./workspace-class";
|
|
66
|
+
import { BillingMode } from "./billing-mode";
|
|
67
|
+
import { WorkspaceRegion } from "./workspace-cluster";
|
|
21
68
|
|
|
22
69
|
export interface GitpodClient {
|
|
23
70
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
24
71
|
onWorkspaceImageBuildLogs: WorkspaceImageBuild.LogCallback;
|
|
25
|
-
|
|
72
|
+
|
|
73
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void;
|
|
74
|
+
|
|
75
|
+
onNotificationUpdated(): void;
|
|
76
|
+
|
|
77
|
+
onCreditAlert(creditAlert: CreditAlert): void;
|
|
78
|
+
|
|
79
|
+
//#region propagating reconnection to iframe
|
|
80
|
+
notifyDidOpenConnection(): void;
|
|
81
|
+
notifyDidCloseConnection(): void;
|
|
82
|
+
//#endregion
|
|
26
83
|
}
|
|
27
84
|
|
|
28
|
-
export const GitpodServer = Symbol(
|
|
29
|
-
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
|
|
85
|
+
export const GitpodServer = Symbol("GitpodServer");
|
|
86
|
+
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
30
87
|
// User related API
|
|
31
88
|
getLoggedInUser(): Promise<User>;
|
|
89
|
+
getTerms(): Promise<Terms>;
|
|
32
90
|
updateLoggedInUser(user: Partial<User>): Promise<User>;
|
|
91
|
+
sendPhoneNumberVerificationToken(phoneNumber: string): Promise<void>;
|
|
92
|
+
verifyPhoneNumberVerificationToken(phoneNumber: string, token: string): Promise<boolean>;
|
|
33
93
|
getAuthProviders(): Promise<AuthProviderInfo[]>;
|
|
34
94
|
getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
|
|
35
|
-
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<
|
|
95
|
+
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
|
|
36
96
|
deleteOwnAuthProvider(params: GitpodServer.DeleteOwnAuthProviderParams): Promise<void>;
|
|
37
|
-
getBranding(): Promise<Branding>;
|
|
38
97
|
getConfiguration(): Promise<Configuration>;
|
|
39
98
|
getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
|
|
99
|
+
getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated
|
|
102
|
+
*/
|
|
40
103
|
getPortAuthenticationToken(workspaceId: string): Promise<Token>;
|
|
41
104
|
deleteAccount(): Promise<void>;
|
|
42
105
|
getClientRegion(): Promise<string | undefined>;
|
|
@@ -47,8 +110,16 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
47
110
|
getWorkspaceOwner(workspaceId: string): Promise<UserInfo | undefined>;
|
|
48
111
|
getWorkspaceUsers(workspaceId: string): Promise<WorkspaceInstanceUser[]>;
|
|
49
112
|
getFeaturedRepositories(): Promise<WhitelistedRepository[]>;
|
|
113
|
+
getSuggestedContextURLs(): Promise<string[]>;
|
|
114
|
+
/**
|
|
115
|
+
* **Security:**
|
|
116
|
+
* Sensitive information like an owner token is erased, since it allows access for all team members.
|
|
117
|
+
* If you need to access an owner token use `getOwnerToken` instead.
|
|
118
|
+
*/
|
|
50
119
|
getWorkspace(id: string): Promise<WorkspaceInfo>;
|
|
51
120
|
isWorkspaceOwner(workspaceId: string): Promise<boolean>;
|
|
121
|
+
getOwnerToken(workspaceId: string): Promise<string>;
|
|
122
|
+
getIDECredentials(workspaceId: string): Promise<string>;
|
|
52
123
|
|
|
53
124
|
/**
|
|
54
125
|
* Creates and starts a workspace for the given context URL.
|
|
@@ -65,9 +136,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
65
136
|
updateWorkspaceUserPin(id: string, action: GitpodServer.PinAction): Promise<void>;
|
|
66
137
|
sendHeartBeat(options: GitpodServer.SendHeartBeatOptions): Promise<void>;
|
|
67
138
|
watchWorkspaceImageBuildLogs(workspaceId: string): Promise<void>;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
139
|
+
isPrebuildDone(pwsid: string): Promise<boolean>;
|
|
140
|
+
getHeadlessLog(instanceId: string): Promise<HeadlessLogUrls>;
|
|
141
|
+
|
|
71
142
|
// Workspace timeout
|
|
72
143
|
setWorkspaceTimeout(workspaceId: string, duration: WorkspaceTimeoutDuration): Promise<SetWorkspaceTimeoutResult>;
|
|
73
144
|
getWorkspaceTimeout(workspaceId: string): Promise<GetWorkspaceTimeoutResult>;
|
|
@@ -80,94 +151,314 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
80
151
|
openPort(workspaceId: string, port: WorkspaceInstancePort): Promise<WorkspaceInstancePort | undefined>;
|
|
81
152
|
closePort(workspaceId: string, port: number): Promise<void>;
|
|
82
153
|
|
|
83
|
-
// User messages
|
|
84
|
-
getUserMessages(options: GitpodServer.GetUserMessagesOptions): Promise<UserMessage[]>;
|
|
85
|
-
updateUserMessages(options: GitpodServer.UpdateUserMessagesOptions): Promise<void>;
|
|
86
|
-
|
|
87
154
|
// User storage
|
|
88
155
|
getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
|
|
89
156
|
updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
|
|
90
157
|
|
|
91
|
-
//
|
|
158
|
+
// Workspace env vars
|
|
159
|
+
getWorkspaceEnvVars(workspaceId: string): Promise<EnvVarWithValue[]>;
|
|
160
|
+
|
|
161
|
+
// User env vars
|
|
92
162
|
getEnvVars(): Promise<UserEnvVarValue[]>;
|
|
163
|
+
getAllEnvVars(): Promise<UserEnvVarValue[]>;
|
|
93
164
|
setEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
94
165
|
deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
95
166
|
|
|
167
|
+
// User SSH Keys
|
|
168
|
+
hasSSHPublicKey(): Promise<boolean>;
|
|
169
|
+
getSSHPublicKeys(): Promise<UserSSHPublicKeyValue[]>;
|
|
170
|
+
addSSHPublicKey(value: SSHPublicKeyValue): Promise<UserSSHPublicKeyValue>;
|
|
171
|
+
deleteSSHPublicKey(id: string): Promise<void>;
|
|
172
|
+
|
|
173
|
+
// Teams
|
|
174
|
+
getTeam(teamId: string): Promise<Team>;
|
|
175
|
+
updateTeam(teamId: string, team: Pick<Team, "name">): Promise<Team>;
|
|
176
|
+
getTeams(): Promise<Team[]>;
|
|
177
|
+
getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
|
|
178
|
+
createTeam(name: string): Promise<Team>;
|
|
179
|
+
joinTeam(inviteId: string): Promise<Team>;
|
|
180
|
+
setTeamMemberRole(teamId: string, userId: string, role: TeamMemberRole): Promise<void>;
|
|
181
|
+
removeTeamMember(teamId: string, userId: string): Promise<void>;
|
|
182
|
+
getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
|
|
183
|
+
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
184
|
+
deleteTeam(teamId: string): Promise<void>;
|
|
185
|
+
createOrgAuthProvider(params: GitpodServer.CreateOrgAuthProviderParams): Promise<AuthProviderEntry>;
|
|
186
|
+
updateOrgAuthProvider(params: GitpodServer.UpdateOrgAuthProviderParams): Promise<AuthProviderEntry>;
|
|
187
|
+
getOrgAuthProviders(params: GitpodServer.GetOrgAuthProviderParams): Promise<AuthProviderEntry[]>;
|
|
188
|
+
deleteOrgAuthProvider(params: GitpodServer.DeleteOrgAuthProviderParams): Promise<void>;
|
|
189
|
+
|
|
190
|
+
// Projects
|
|
191
|
+
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
192
|
+
createProject(params: CreateProjectParams): Promise<Project>;
|
|
193
|
+
deleteProject(projectId: string): Promise<void>;
|
|
194
|
+
getTeamProjects(teamId: string): Promise<Project[]>;
|
|
195
|
+
getUserProjects(): Promise<Project[]>;
|
|
196
|
+
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
197
|
+
getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
|
|
198
|
+
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
199
|
+
findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
|
|
200
|
+
getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
|
|
201
|
+
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
202
|
+
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
203
|
+
updateProjectPartial(partialProject: PartialProject): Promise<void>;
|
|
204
|
+
setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
|
|
205
|
+
getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
|
|
206
|
+
deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
|
|
207
|
+
|
|
208
|
+
// content service
|
|
209
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
210
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
211
|
+
|
|
96
212
|
// Gitpod token
|
|
97
213
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
98
214
|
generateNewGitpodToken(options: GitpodServer.GenerateNewGitpodTokenOptions): Promise<string>;
|
|
99
215
|
deleteGitpodToken(tokenHash: string): Promise<void>;
|
|
100
216
|
|
|
101
217
|
// misc
|
|
102
|
-
|
|
218
|
+
isGitHubAppEnabled(): Promise<boolean>;
|
|
103
219
|
registerGithubApp(installationId: string): Promise<void>;
|
|
104
220
|
|
|
105
221
|
/**
|
|
106
|
-
* Stores a new snapshot for the given workspace and bucketId
|
|
222
|
+
* Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
|
|
107
223
|
* @return the snapshot id
|
|
108
224
|
*/
|
|
109
225
|
takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
|
|
226
|
+
/**
|
|
227
|
+
*
|
|
228
|
+
* @param snapshotId
|
|
229
|
+
*/
|
|
230
|
+
waitForSnapshot(snapshotId: string): Promise<void>;
|
|
110
231
|
|
|
111
232
|
/**
|
|
112
233
|
* Returns the list of snapshots that exist for a workspace.
|
|
113
234
|
*/
|
|
114
235
|
getSnapshots(workspaceID: string): Promise<string[]>;
|
|
115
236
|
|
|
237
|
+
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* gitpod.io concerns
|
|
241
|
+
*/
|
|
242
|
+
isStudent(): Promise<boolean>;
|
|
243
|
+
/**
|
|
244
|
+
*
|
|
245
|
+
*/
|
|
246
|
+
getAccountStatement(options: GitpodServer.GetAccountStatementOptions): Promise<AccountStatement | undefined>;
|
|
247
|
+
getRemainingUsageHours(): Promise<number>;
|
|
248
|
+
|
|
116
249
|
/**
|
|
117
|
-
*
|
|
250
|
+
*
|
|
118
251
|
*/
|
|
119
|
-
|
|
252
|
+
getChargebeeSiteId(): Promise<string>;
|
|
253
|
+
createPortalSession(): Promise<{}>;
|
|
254
|
+
createTeamPortalSession(teamId: string): Promise<{}>;
|
|
255
|
+
checkout(planId: string, planQuantity?: number): Promise<{}>;
|
|
256
|
+
teamCheckout(teamId: string, planId: string): Promise<{}>;
|
|
257
|
+
getAvailableCoupons(): Promise<PlanCoupon[]>;
|
|
258
|
+
getAppliedCoupons(): Promise<PlanCoupon[]>;
|
|
259
|
+
|
|
260
|
+
getShowPaymentUI(): Promise<boolean>;
|
|
261
|
+
isChargebeeCustomer(): Promise<boolean>;
|
|
262
|
+
|
|
263
|
+
subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
264
|
+
subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
265
|
+
subscriptionCancel(subscriptionId: string): Promise<void>;
|
|
266
|
+
subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
|
|
267
|
+
|
|
268
|
+
getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
|
|
269
|
+
cancelTeamSubscription(teamId: string): Promise<void>;
|
|
270
|
+
tsCancel(teamSubscriptionId: string): Promise<void>;
|
|
271
|
+
tsGet(): Promise<TeamSubscription[]>;
|
|
272
|
+
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
273
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
274
|
+
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
275
|
+
tsAssignSlot(
|
|
276
|
+
teamSubscriptionId: string,
|
|
277
|
+
teamSubscriptionSlotId: string,
|
|
278
|
+
identityStr: string | undefined,
|
|
279
|
+
): Promise<void>;
|
|
280
|
+
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
281
|
+
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
282
|
+
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
283
|
+
tsAddMembersToOrg(teamSubscriptionId: string, organizationId: string): Promise<void>;
|
|
284
|
+
|
|
285
|
+
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
286
|
+
|
|
287
|
+
getStripePublishableKey(): Promise<string>;
|
|
288
|
+
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
289
|
+
findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
|
|
290
|
+
getPriceInformation(attributionId: string): Promise<string | undefined>;
|
|
291
|
+
createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
|
|
292
|
+
subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
|
|
293
|
+
getStripePortalUrl(attributionId: string): Promise<string>;
|
|
294
|
+
getCostCenter(attributionId: string): Promise<CostCenterJSON | undefined>;
|
|
295
|
+
setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
|
|
296
|
+
getUsageBalance(attributionId: string): Promise<number>;
|
|
297
|
+
|
|
298
|
+
listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
|
|
299
|
+
|
|
300
|
+
setUsageAttribution(usageAttribution: string): Promise<void>;
|
|
301
|
+
listAvailableUsageAttributionIds(): Promise<string[]>;
|
|
302
|
+
|
|
303
|
+
getBillingModeForUser(): Promise<BillingMode>;
|
|
304
|
+
getBillingModeForTeam(teamId: string): Promise<BillingMode>;
|
|
120
305
|
|
|
121
306
|
/**
|
|
122
|
-
*
|
|
307
|
+
* Analytics
|
|
123
308
|
*/
|
|
124
|
-
|
|
309
|
+
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
310
|
+
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
311
|
+
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
125
312
|
|
|
126
313
|
/**
|
|
127
|
-
*
|
|
128
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
314
|
+
* Frontend notifications
|
|
129
315
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
316
|
+
getNotifications(): Promise<AppNotification[]>;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Frontend metrics
|
|
320
|
+
*/
|
|
321
|
+
reportErrorBoundary(url: string, message: string): Promise<void>;
|
|
322
|
+
|
|
323
|
+
getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
|
|
324
|
+
maySetTimeout(): Promise<boolean>;
|
|
325
|
+
updateWorkspaceTimeoutSetting(setting: Partial<WorkspaceTimeoutSetting>): Promise<void>;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* getIDToken - doesn't actually do anything, just used to authenticat/authorise
|
|
329
|
+
*/
|
|
330
|
+
getIDToken(): Promise<void>;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface AppNotification {
|
|
334
|
+
message: string;
|
|
335
|
+
action?: {
|
|
336
|
+
url: string;
|
|
337
|
+
label: string;
|
|
338
|
+
};
|
|
339
|
+
notClosable?: boolean;
|
|
340
|
+
}
|
|
341
|
+
export namespace AppNotification {
|
|
342
|
+
export function is(data: any): data is AppNotification {
|
|
343
|
+
return data && typeof data === "object" && data.hasOwnProperty("message");
|
|
344
|
+
}
|
|
134
345
|
}
|
|
135
346
|
|
|
136
|
-
export
|
|
347
|
+
export interface RateLimiterError {
|
|
348
|
+
method?: string;
|
|
137
349
|
|
|
138
|
-
|
|
139
|
-
|
|
350
|
+
/**
|
|
351
|
+
* Retry after this many seconds, earliest.
|
|
352
|
+
* cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
353
|
+
*/
|
|
354
|
+
retryAfter: number;
|
|
140
355
|
}
|
|
141
356
|
|
|
142
|
-
export
|
|
357
|
+
export interface CreateProjectParams {
|
|
358
|
+
name: string;
|
|
359
|
+
slug: string;
|
|
360
|
+
cloneUrl: string;
|
|
361
|
+
teamId?: string;
|
|
362
|
+
userId?: string;
|
|
363
|
+
appInstallationId: string;
|
|
364
|
+
}
|
|
365
|
+
export interface FindPrebuildsParams {
|
|
366
|
+
projectId: string;
|
|
367
|
+
branch?: string;
|
|
368
|
+
latest?: boolean;
|
|
369
|
+
prebuildId?: string;
|
|
370
|
+
// default: 30
|
|
371
|
+
limit?: number;
|
|
372
|
+
}
|
|
373
|
+
export interface GetProviderRepositoriesParams {
|
|
374
|
+
provider: string;
|
|
375
|
+
hints?: { installationId: string } | object;
|
|
376
|
+
}
|
|
377
|
+
export interface ProviderRepository {
|
|
378
|
+
name: string;
|
|
379
|
+
path?: string;
|
|
380
|
+
account: string;
|
|
381
|
+
accountAvatarUrl: string;
|
|
382
|
+
cloneUrl: string;
|
|
383
|
+
updatedAt?: string;
|
|
384
|
+
installationId?: number;
|
|
385
|
+
installationUpdatedAt?: string;
|
|
386
|
+
|
|
387
|
+
inUse?: { userName: string };
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export interface ClientHeaderFields {
|
|
391
|
+
ip?: string;
|
|
392
|
+
userAgent?: string;
|
|
393
|
+
dnt?: string;
|
|
394
|
+
clientRegion?: string;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const WORKSPACE_MAXIMUM_TIMEOUT_HOURS = 24;
|
|
398
|
+
|
|
399
|
+
export type WorkspaceTimeoutDuration = string;
|
|
400
|
+
export namespace WorkspaceTimeoutDuration {
|
|
401
|
+
export function validate(duration: string): WorkspaceTimeoutDuration {
|
|
402
|
+
duration = duration.toLowerCase();
|
|
403
|
+
const unit = duration.slice(-1);
|
|
404
|
+
if (!["m", "h"].includes(unit)) {
|
|
405
|
+
throw new Error(`Invalid timeout unit: ${unit}`);
|
|
406
|
+
}
|
|
407
|
+
const value = parseInt(duration.slice(0, -1), 10);
|
|
408
|
+
if (isNaN(value) || value <= 0) {
|
|
409
|
+
throw new Error(`Invalid timeout value: ${duration}`);
|
|
410
|
+
}
|
|
411
|
+
if (
|
|
412
|
+
(unit === "h" && value > WORKSPACE_MAXIMUM_TIMEOUT_HOURS) ||
|
|
413
|
+
(unit === "m" && value > WORKSPACE_MAXIMUM_TIMEOUT_HOURS * 60)
|
|
414
|
+
) {
|
|
415
|
+
throw new Error("Workspace inactivity timeout cannot exceed 24h");
|
|
416
|
+
}
|
|
417
|
+
return duration;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_SHORT: WorkspaceTimeoutDuration = "30m";
|
|
422
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_LONG: WorkspaceTimeoutDuration = "60m";
|
|
423
|
+
export const WORKSPACE_TIMEOUT_EXTENDED: WorkspaceTimeoutDuration = "180m";
|
|
424
|
+
|
|
425
|
+
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
426
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
427
|
+
): GitpodServiceImpl<C, S> {
|
|
428
|
+
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
432
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
433
|
+
): JsonRpcProxy<S> {
|
|
143
434
|
methods.setClient = methods.setClient || (() => {});
|
|
144
435
|
methods.dispose = methods.dispose || (() => {});
|
|
145
436
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
437
|
+
// @ts-ignore
|
|
146
438
|
get: (target: S, property: keyof S) => {
|
|
147
439
|
const result = target[property];
|
|
148
440
|
if (!result) {
|
|
149
|
-
throw new Error(`Method ${property} not implemented`);
|
|
441
|
+
throw new Error(`Method ${String(property)} not implemented`);
|
|
150
442
|
}
|
|
151
443
|
return result;
|
|
152
|
-
}
|
|
444
|
+
},
|
|
153
445
|
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
157
|
-
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
446
|
+
};
|
|
158
447
|
|
|
159
448
|
export interface SetWorkspaceTimeoutResult {
|
|
160
|
-
resetTimeoutOnWorkspaces: string[]
|
|
449
|
+
resetTimeoutOnWorkspaces: string[];
|
|
450
|
+
humanReadableDuration: string;
|
|
161
451
|
}
|
|
162
452
|
|
|
163
453
|
export interface GetWorkspaceTimeoutResult {
|
|
164
|
-
duration: WorkspaceTimeoutDuration
|
|
165
|
-
canChange: boolean
|
|
454
|
+
duration: WorkspaceTimeoutDuration;
|
|
455
|
+
canChange: boolean;
|
|
456
|
+
humanReadableDuration: string;
|
|
166
457
|
}
|
|
167
458
|
|
|
168
459
|
export interface StartWorkspaceResult {
|
|
169
|
-
instanceID: string
|
|
170
|
-
workspaceURL?: string
|
|
460
|
+
instanceID: string;
|
|
461
|
+
workspaceURL?: string;
|
|
171
462
|
}
|
|
172
463
|
|
|
173
464
|
export namespace GitpodServer {
|
|
@@ -175,27 +466,33 @@ export namespace GitpodServer {
|
|
|
175
466
|
limit?: number;
|
|
176
467
|
searchString?: string;
|
|
177
468
|
pinnedOnly?: boolean;
|
|
469
|
+
projectId?: string | string[];
|
|
470
|
+
includeWithoutProject?: boolean;
|
|
178
471
|
}
|
|
179
472
|
export interface GetAccountStatementOptions {
|
|
180
473
|
date?: string;
|
|
181
474
|
}
|
|
182
|
-
export interface CreateWorkspaceOptions {
|
|
475
|
+
export interface CreateWorkspaceOptions extends StartWorkspaceOptions {
|
|
183
476
|
contextUrl: string;
|
|
184
|
-
|
|
477
|
+
organizationId?: string;
|
|
478
|
+
|
|
479
|
+
// whether running workspaces on the same context should be ignored. If false (default) users will be asked.
|
|
480
|
+
ignoreRunningWorkspaceOnSameCommit?: boolean;
|
|
481
|
+
ignoreRunningPrebuild?: boolean;
|
|
482
|
+
allowUsingPreviousPrebuilds?: boolean;
|
|
483
|
+
forceDefaultConfig?: boolean;
|
|
185
484
|
}
|
|
485
|
+
|
|
186
486
|
export interface StartWorkspaceOptions {
|
|
187
|
-
forceDefaultImage
|
|
487
|
+
forceDefaultImage?: boolean;
|
|
488
|
+
workspaceClass?: string;
|
|
489
|
+
ideSettings?: IDESettings;
|
|
490
|
+
region?: WorkspaceRegion;
|
|
188
491
|
}
|
|
189
492
|
export interface TakeSnapshotOptions {
|
|
190
493
|
workspaceId: string;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
export interface GetUserMessagesOptions {
|
|
194
|
-
readonly releaseNotes?: boolean;
|
|
195
|
-
readonly workspaceInstanceId: string;
|
|
196
|
-
}
|
|
197
|
-
export interface UpdateUserMessagesOptions {
|
|
198
|
-
readonly messageIds: string[];
|
|
494
|
+
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
495
|
+
dontWait?: boolean;
|
|
199
496
|
}
|
|
200
497
|
export interface GetUserStorageResourceOptions {
|
|
201
498
|
readonly uri: string;
|
|
@@ -213,37 +510,52 @@ export namespace GitpodServer {
|
|
|
213
510
|
readonly roundTripTime?: number;
|
|
214
511
|
}
|
|
215
512
|
export interface UpdateOwnAuthProviderParams {
|
|
216
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
513
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
217
514
|
}
|
|
218
515
|
export interface DeleteOwnAuthProviderParams {
|
|
219
|
-
readonly id: string
|
|
516
|
+
readonly id: string;
|
|
517
|
+
}
|
|
518
|
+
export interface CreateOrgAuthProviderParams {
|
|
519
|
+
// ownerId is automatically set to the authenticated user
|
|
520
|
+
readonly entry: Omit<AuthProviderEntry.NewOrgEntry, "ownerId">;
|
|
521
|
+
}
|
|
522
|
+
export interface UpdateOrgAuthProviderParams {
|
|
523
|
+
readonly entry: AuthProviderEntry.UpdateOrgEntry;
|
|
524
|
+
}
|
|
525
|
+
export interface GetOrgAuthProviderParams {
|
|
526
|
+
readonly organizationId: string;
|
|
527
|
+
}
|
|
528
|
+
export interface DeleteOrgAuthProviderParams {
|
|
529
|
+
readonly id: string;
|
|
530
|
+
readonly organizationId: string;
|
|
220
531
|
}
|
|
221
532
|
export type AdmissionLevel = "owner" | "everyone";
|
|
222
533
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
223
534
|
export interface GenerateNewGitpodTokenOptions {
|
|
224
|
-
name?: string
|
|
225
|
-
type: GitpodTokenType
|
|
226
|
-
scopes?: string[]
|
|
535
|
+
name?: string;
|
|
536
|
+
type: GitpodTokenType;
|
|
537
|
+
scopes?: string[];
|
|
227
538
|
}
|
|
228
539
|
}
|
|
229
540
|
|
|
230
|
-
export const GitpodServerPath =
|
|
541
|
+
export const GitpodServerPath = "/gitpod";
|
|
231
542
|
|
|
232
|
-
export const GitpodServerProxy = Symbol(
|
|
543
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
233
544
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
234
545
|
|
|
235
546
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
236
|
-
|
|
237
547
|
protected clients: Partial<Client>[] = [];
|
|
238
548
|
|
|
239
549
|
public registerClient(client: Partial<Client>): Disposable {
|
|
240
550
|
this.clients.push(client);
|
|
241
|
-
const index = this.clients.length;
|
|
242
551
|
return {
|
|
243
552
|
dispose: () => {
|
|
244
|
-
this.clients.
|
|
245
|
-
|
|
246
|
-
|
|
553
|
+
const index = this.clients.indexOf(client);
|
|
554
|
+
if (index > -1) {
|
|
555
|
+
this.clients.splice(index, 1);
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
};
|
|
247
559
|
}
|
|
248
560
|
|
|
249
561
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -252,59 +564,250 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
252
564
|
try {
|
|
253
565
|
client.onInstanceUpdate(instance);
|
|
254
566
|
} catch (error) {
|
|
255
|
-
console.error(error)
|
|
567
|
+
console.error(error);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void {
|
|
574
|
+
for (const client of this.clients) {
|
|
575
|
+
if (client.onPrebuildUpdate) {
|
|
576
|
+
try {
|
|
577
|
+
client.onPrebuildUpdate(update);
|
|
578
|
+
} catch (error) {
|
|
579
|
+
console.error(error);
|
|
256
580
|
}
|
|
257
581
|
}
|
|
258
582
|
}
|
|
259
583
|
}
|
|
260
584
|
|
|
261
|
-
onWorkspaceImageBuildLogs(
|
|
585
|
+
onWorkspaceImageBuildLogs(
|
|
586
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
587
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
588
|
+
): void {
|
|
262
589
|
for (const client of this.clients) {
|
|
263
590
|
if (client.onWorkspaceImageBuildLogs) {
|
|
264
591
|
try {
|
|
265
592
|
client.onWorkspaceImageBuildLogs(info, content);
|
|
266
593
|
} catch (error) {
|
|
267
|
-
console.error(error)
|
|
594
|
+
console.error(error);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
notifyDidOpenConnection(): void {
|
|
601
|
+
for (const client of this.clients) {
|
|
602
|
+
if (client.notifyDidOpenConnection) {
|
|
603
|
+
try {
|
|
604
|
+
client.notifyDidOpenConnection();
|
|
605
|
+
} catch (error) {
|
|
606
|
+
console.error(error);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
notifyDidCloseConnection(): void {
|
|
613
|
+
for (const client of this.clients) {
|
|
614
|
+
if (client.notifyDidCloseConnection) {
|
|
615
|
+
try {
|
|
616
|
+
client.notifyDidCloseConnection();
|
|
617
|
+
} catch (error) {
|
|
618
|
+
console.error(error);
|
|
268
619
|
}
|
|
269
620
|
}
|
|
270
621
|
}
|
|
271
622
|
}
|
|
272
623
|
|
|
273
|
-
|
|
624
|
+
onCreditAlert(creditAlert: CreditAlert): void {
|
|
274
625
|
for (const client of this.clients) {
|
|
275
|
-
if (client.
|
|
626
|
+
if (client.onCreditAlert) {
|
|
276
627
|
try {
|
|
277
|
-
client.
|
|
628
|
+
client.onCreditAlert(creditAlert);
|
|
278
629
|
} catch (error) {
|
|
279
|
-
console.error(error)
|
|
630
|
+
console.error(error);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
onNotificationUpdated(): void {
|
|
637
|
+
for (const client of this.clients) {
|
|
638
|
+
if (client.onNotificationUpdated) {
|
|
639
|
+
try {
|
|
640
|
+
client.onNotificationUpdated();
|
|
641
|
+
} catch (error) {
|
|
642
|
+
console.error(error);
|
|
280
643
|
}
|
|
281
644
|
}
|
|
282
645
|
}
|
|
283
646
|
}
|
|
284
647
|
}
|
|
285
648
|
|
|
286
|
-
export
|
|
287
|
-
|
|
649
|
+
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
650
|
+
|
|
651
|
+
const hasWindow = typeof window !== "undefined";
|
|
652
|
+
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
653
|
+
unknown: 0,
|
|
654
|
+
preparing: 1,
|
|
655
|
+
building: 2,
|
|
656
|
+
pending: 3,
|
|
657
|
+
creating: 4,
|
|
658
|
+
initializing: 5,
|
|
659
|
+
running: 6,
|
|
660
|
+
interrupted: 7,
|
|
661
|
+
stopping: 8,
|
|
662
|
+
stopped: 9,
|
|
663
|
+
};
|
|
664
|
+
export class WorkspaceInstanceUpdateListener {
|
|
665
|
+
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
666
|
+
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
667
|
+
|
|
668
|
+
private source: "sync" | "update" = "sync";
|
|
669
|
+
|
|
670
|
+
get info(): WorkspaceInfo {
|
|
671
|
+
return this._info;
|
|
672
|
+
}
|
|
288
673
|
|
|
289
|
-
|
|
290
|
-
|
|
674
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
675
|
+
service.registerClient({
|
|
676
|
+
onInstanceUpdate: (instance) => {
|
|
677
|
+
if (this.isOutOfOrder(instance)) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
this.cancelSync();
|
|
681
|
+
this._info.latestInstance = instance;
|
|
682
|
+
this.source = "update";
|
|
683
|
+
this.onDidChangeEmitter.fire(undefined);
|
|
684
|
+
},
|
|
685
|
+
notifyDidOpenConnection: () => {
|
|
686
|
+
this.sync();
|
|
687
|
+
},
|
|
688
|
+
});
|
|
689
|
+
if (hasWindow) {
|
|
690
|
+
// learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
|
|
691
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
692
|
+
if (window.document.visibilityState === "visible") {
|
|
693
|
+
this.sync();
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
window.addEventListener("pageshow", (e) => {
|
|
697
|
+
if (e.persisted) {
|
|
698
|
+
this.sync();
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
}
|
|
291
703
|
|
|
292
|
-
|
|
704
|
+
private syncQueue = Promise.resolve();
|
|
705
|
+
private syncTokenSource: CancellationTokenSource | undefined;
|
|
706
|
+
/**
|
|
707
|
+
* Only one sync can be performed at the same time.
|
|
708
|
+
* Any new sync request or instance update cancels all previously scheduled sync requests.
|
|
709
|
+
*/
|
|
710
|
+
private sync(): void {
|
|
711
|
+
this.cancelSync();
|
|
712
|
+
this.syncTokenSource = new CancellationTokenSource();
|
|
713
|
+
const token = this.syncTokenSource.token;
|
|
714
|
+
this.syncQueue = this.syncQueue.then(async () => {
|
|
715
|
+
if (token.isCancellationRequested) {
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
try {
|
|
719
|
+
const info = await this.service.server.getWorkspace(this._info.workspace.id);
|
|
720
|
+
if (token.isCancellationRequested) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
this._info = info;
|
|
724
|
+
this.source = "sync";
|
|
725
|
+
this.onDidChangeEmitter.fire(undefined);
|
|
726
|
+
} catch (e) {
|
|
727
|
+
console.error("failed to sync workspace instance:", e);
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
private cancelSync(): void {
|
|
732
|
+
if (this.syncTokenSource) {
|
|
733
|
+
this.syncTokenSource.cancel();
|
|
734
|
+
this.syncTokenSource = undefined;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
293
737
|
|
|
294
|
-
|
|
738
|
+
/**
|
|
739
|
+
* If sync seen more recent update then ignore all updates with previous phases.
|
|
740
|
+
* Within the same phase still the race can occur but which should be eventually consistent.
|
|
741
|
+
*/
|
|
742
|
+
private isOutOfOrder(instance: WorkspaceInstance): boolean {
|
|
743
|
+
if (instance.workspaceId !== this._info.workspace.id) {
|
|
744
|
+
return true;
|
|
745
|
+
}
|
|
746
|
+
if (this.source === "update") {
|
|
747
|
+
return false;
|
|
748
|
+
}
|
|
749
|
+
if (instance.id !== this.info.latestInstance?.id) {
|
|
750
|
+
return false;
|
|
751
|
+
}
|
|
752
|
+
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
export interface GitpodServiceOptions {
|
|
757
|
+
onReconnect?: () => void | Promise<void>;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
761
|
+
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
762
|
+
|
|
763
|
+
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
295
764
|
server.setClient(this.compositeClient);
|
|
765
|
+
server.onDidOpenConnection(() => this.compositeClient.notifyDidOpenConnection());
|
|
766
|
+
server.onDidCloseConnection(() => this.compositeClient.notifyDidCloseConnection());
|
|
296
767
|
}
|
|
297
768
|
|
|
298
769
|
public registerClient(client: Partial<Client>): Disposable {
|
|
299
770
|
return this.compositeClient.registerClient(client);
|
|
300
771
|
}
|
|
772
|
+
|
|
773
|
+
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
774
|
+
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
775
|
+
const listener =
|
|
776
|
+
this.instanceListeners.get(workspaceId) ||
|
|
777
|
+
(async () => {
|
|
778
|
+
const info = await this.server.getWorkspace(workspaceId);
|
|
779
|
+
return new WorkspaceInstanceUpdateListener(this, info);
|
|
780
|
+
})();
|
|
781
|
+
this.instanceListeners.set(workspaceId, listener);
|
|
782
|
+
return listener;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
async reconnect(): Promise<void> {
|
|
786
|
+
if (this.options?.onReconnect) {
|
|
787
|
+
await this.options.onReconnect();
|
|
788
|
+
}
|
|
789
|
+
}
|
|
301
790
|
}
|
|
302
791
|
|
|
303
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
792
|
+
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
793
|
+
serverUrl: string | Promise<string>,
|
|
794
|
+
) {
|
|
795
|
+
const toWsUrl = (serverUrl: string) => {
|
|
796
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
797
|
+
};
|
|
798
|
+
let url: string | Promise<string>;
|
|
799
|
+
if (typeof serverUrl === "string") {
|
|
800
|
+
url = toWsUrl(serverUrl);
|
|
801
|
+
} else {
|
|
802
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
803
|
+
}
|
|
804
|
+
|
|
307
805
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
806
|
+
let onReconnect = () => {};
|
|
807
|
+
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
808
|
+
onListening: (socket) => {
|
|
809
|
+
onReconnect = () => socket.reconnect();
|
|
810
|
+
},
|
|
811
|
+
});
|
|
812
|
+
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
813
|
+
}
|