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