@gitpod/gitpod-protocol 0.1.5-main.628 → 0.1.5-main.6281
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 +157 -29
- package/lib/accounting-protocol.d.ts +19 -14
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +44 -48
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +44 -5
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +16 -1
- 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 +1 -1
- package/lib/auth.d.ts.map +1 -1
- package/lib/auth.js +1 -1
- package/lib/billing-mode.d.ts +45 -0
- package/lib/billing-mode.d.ts.map +1 -0
- package/lib/billing-mode.js +44 -0
- package/lib/billing-mode.js.map +1 -0
- package/lib/blocked-repositories-protocol.d.ts +13 -0
- package/lib/blocked-repositories-protocol.d.ts.map +1 -0
- package/lib/blocked-repositories-protocol.js +8 -0
- package/lib/blocked-repositories-protocol.js.map +1 -0
- package/lib/context-url.d.ts +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 +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +5 -5
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +26 -27
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +30 -38
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +31 -45
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +32 -39
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +1 -7
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +8 -28
- 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 +85 -0
- package/lib/frontend-dashboard-service.d.ts.map +1 -0
- package/lib/frontend-dashboard-service.js +32 -0
- package/lib/frontend-dashboard-service.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +27 -43
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.d.ts +1 -1
- package/lib/gitpod-file-parser.spec.js +146 -143
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +174 -56
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +210 -294
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +10 -12
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +7 -9
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +2 -2
- package/lib/ide-frontend-service.js +1 -1
- package/lib/ide-protocol.d.ts +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 +17 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -2
- 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 +8 -1
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +5 -7
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +183 -43
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +5 -5
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +43 -60
- 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 +13 -3
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +25 -5
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +24 -60
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +3 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +75 -162
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/oss-allowlist.d.ts +14 -0
- package/lib/oss-allowlist.d.ts.map +1 -0
- package/lib/oss-allowlist.js +8 -0
- package/lib/oss-allowlist.js.map +1 -0
- package/lib/payment-protocol.d.ts +1 -1
- package/lib/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +2 -2
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +14 -4
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +45 -32
- 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 +253 -106
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +346 -205
- package/lib/protocol.js.map +1 -1
- package/{src/util/without.ts → lib/protocol.spec.d.ts} +3 -4
- 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 +25 -6
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +36 -18
- package/lib/team-subscription-protocol.js.map +1 -1
- 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 +3 -3
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/typings/globals.js +1 -1
- package/lib/usage.d.ts +73 -0
- package/lib/usage.d.ts.map +1 -0
- package/lib/usage.js +20 -0
- package/lib/usage.js.map +1 -0
- package/lib/util/analytics.d.ts +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 +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +58 -136
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +1 -1
- package/lib/util/cancelable.js +18 -60
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +1 -1
- package/lib/util/date-time.js +12 -12
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/debug-app.d.ts +25 -0
- package/lib/util/debug-app.d.ts.map +1 -0
- package/lib/util/debug-app.js +100 -0
- package/lib/util/debug-app.js.map +1 -0
- package/lib/util/deep-partial.d.ts +1 -1
- package/lib/util/deep-partial.js +1 -1
- package/lib/util/deferred.d.ts +1 -1
- package/lib/util/deferred.js +11 -13
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +27 -40
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +63 -77
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +2 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +33 -48
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +6 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +469 -502
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.d.ts +1 -1
- package/lib/util/generate-workspace-id.spec.js +69 -79
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +41 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +13 -5
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +141 -110
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +7 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +113 -31
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- 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/{theia-plugins.js → util/jaeger-client-types.js} +2 -2
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +50 -34
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +133 -130
- package/lib/util/logging.js.map +1 -1
- package/lib/util/logging.spec.d.ts +7 -0
- package/lib/util/logging.spec.d.ts.map +1 -0
- package/lib/util/logging.spec.js +52 -0
- package/lib/util/logging.spec.js.map +1 -0
- package/lib/util/make-link.d.ts +1 -1
- package/lib/util/make-link.js +6 -6
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/nice-grpc.d.ts +9 -0
- package/lib/util/nice-grpc.d.ts.map +1 -0
- package/lib/util/nice-grpc.js +121 -0
- package/lib/util/nice-grpc.js.map +1 -0
- package/lib/util/parse-workspace-id.d.ts +11 -1
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +31 -8
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +5 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +124 -85
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +1 -1
- package/lib/util/queue.js +17 -56
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.d.ts +1 -1
- package/lib/util/queue.spec.js +148 -289
- 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 +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +16 -47
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +7 -7
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +3 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +30 -18
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +3 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +55 -24
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +53 -7
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +198 -65
- 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 +8 -8
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +10 -13
- 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 +46 -6
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +1 -1
- package/lib/wsready.d.ts +8 -2
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +3 -3
- package/package.json +40 -18
- package/pkg-yarn.lock +23 -10
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +67 -58
- package/src/admin-protocol.ts +88 -20
- package/src/analytics.ts +52 -0
- package/src/attribution.ts +63 -0
- package/src/auth.ts +3 -3
- package/src/billing-mode.ts +84 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +49 -0
- package/src/context-url.ts +107 -0
- package/src/encryption/container-module.ts +3 -4
- package/src/encryption/encryption-engine.spec.ts +10 -9
- package/src/encryption/encryption-engine.ts +21 -17
- package/src/encryption/encryption-service.ts +5 -6
- package/src/encryption/key-provider.ts +17 -20
- package/src/env.ts +2 -25
- package/src/experiments/always-default.ts +24 -0
- package/src/experiments/configcat-server.ts +42 -0
- package/src/experiments/configcat.ts +56 -0
- package/src/experiments/types.ts +34 -0
- package/src/frontend-dashboard-service.ts +109 -0
- package/src/gitpod-file-parser.spec.ts +56 -62
- package/src/gitpod-file-parser.ts +17 -18
- package/src/gitpod-service.ts +359 -144
- package/src/headless-workspace-log.ts +13 -15
- package/src/ide-frontend-service.ts +3 -3
- package/src/ide-protocol.ts +147 -0
- package/src/index.ts +17 -11
- package/src/installation-admin-protocol.ts +45 -0
- package/src/license-protocol.ts +13 -7
- package/src/messaging/browser/connection.ts +196 -27
- package/src/messaging/browser/window-connection.ts +40 -30
- package/src/messaging/client-call-metrics.ts +94 -0
- package/src/messaging/error.ts +36 -8
- 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 +3 -3
- package/src/permission.ts +47 -34
- package/src/plans.ts +683 -0
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +627 -293
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +63 -24
- package/src/teams-projects-protocol.ts +177 -0
- package/src/typings/globals.ts +6 -5
- package/src/usage.ts +85 -0
- package/src/util/analytics.ts +109 -0
- package/src/util/async-iterator.ts +5 -6
- package/src/util/cancelable.ts +4 -4
- package/src/util/date-time.ts +9 -9
- package/src/util/debug-app.ts +81 -0
- package/src/util/deep-partial.ts +1 -1
- package/src/util/deferred.ts +7 -7
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +17 -9
- package/src/util/generate-workspace-id.spec.ts +38 -11
- package/src/util/generate-workspace-id.ts +465 -439
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +59 -8
- package/src/util/gitpod-host-url.ts +94 -42
- 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 +157 -75
- package/src/util/make-link.ts +7 -8
- package/src/util/nice-grpc.ts +96 -0
- package/src/util/parse-workspace-id.spec.ts +38 -9
- package/src/util/parse-workspace-id.ts +33 -8
- package/src/util/queue.spec.ts +28 -26
- package/src/util/queue.ts +1 -1
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +7 -9
- package/src/util/skip-if.ts +11 -8
- package/src/util/timeutil.spec.ts +41 -15
- package/src/util/timeutil.ts +32 -16
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +201 -32
- package/src/util/workspace-port-authentication.ts +11 -14
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +110 -0
- package/src/workspace-instance.ts +106 -32
- package/src/wsready.ts +11 -4
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/email-protocol.d.ts +0 -50
- package/lib/email-protocol.d.ts.map +0 -1
- package/lib/email-protocol.js +0 -28
- package/lib/email-protocol.js.map +0 -1
- package/lib/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -46
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.js.map +0 -1
- package/lib/util/context-url.d.ts +0 -13
- package/lib/util/context-url.d.ts.map +0 -1
- package/lib/util/context-url.js +0 -26
- package/lib/util/context-url.js.map +0 -1
- package/lib/util/context-url.spec.d.ts +0 -10
- package/lib/util/context-url.spec.d.ts.map +0 -1
- package/lib/util/context-url.spec.js +0 -52
- package/lib/util/context-url.spec.js.map +0 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/lib/util/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -34
- package/lib/util/safe-promise.js.map +0 -1
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js +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/context-url.spec.ts +0 -25
- package/src/util/context-url.ts +0 -23
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
package/src/gitpod-service.ts
CHANGED
|
@@ -1,34 +1,75 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
User,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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";
|
|
27
65
|
|
|
28
66
|
export interface GitpodClient {
|
|
29
67
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
30
68
|
onWorkspaceImageBuildLogs: WorkspaceImageBuild.LogCallback;
|
|
31
|
-
|
|
69
|
+
|
|
70
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void;
|
|
71
|
+
|
|
72
|
+
onNotificationUpdated(): void;
|
|
32
73
|
|
|
33
74
|
onCreditAlert(creditAlert: CreditAlert): void;
|
|
34
75
|
|
|
@@ -38,19 +79,21 @@ export interface GitpodClient {
|
|
|
38
79
|
//#endregion
|
|
39
80
|
}
|
|
40
81
|
|
|
41
|
-
export const GitpodServer = Symbol(
|
|
42
|
-
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
|
|
82
|
+
export const GitpodServer = Symbol("GitpodServer");
|
|
83
|
+
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
43
84
|
// User related API
|
|
44
85
|
getLoggedInUser(): Promise<User>;
|
|
45
86
|
getTerms(): Promise<Terms>;
|
|
46
87
|
updateLoggedInUser(user: Partial<User>): Promise<User>;
|
|
88
|
+
sendPhoneNumberVerificationToken(phoneNumber: string): Promise<void>;
|
|
89
|
+
verifyPhoneNumberVerificationToken(phoneNumber: string, token: string): Promise<boolean>;
|
|
47
90
|
getAuthProviders(): Promise<AuthProviderInfo[]>;
|
|
48
91
|
getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
|
|
49
92
|
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
|
|
50
93
|
deleteOwnAuthProvider(params: GitpodServer.DeleteOwnAuthProviderParams): Promise<void>;
|
|
51
|
-
getBranding(): Promise<Branding>;
|
|
52
94
|
getConfiguration(): Promise<Configuration>;
|
|
53
95
|
getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
|
|
96
|
+
getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
|
|
54
97
|
/**
|
|
55
98
|
* @deprecated
|
|
56
99
|
*/
|
|
@@ -64,8 +107,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
64
107
|
getWorkspaceOwner(workspaceId: string): Promise<UserInfo | undefined>;
|
|
65
108
|
getWorkspaceUsers(workspaceId: string): Promise<WorkspaceInstanceUser[]>;
|
|
66
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
|
+
*/
|
|
67
116
|
getWorkspace(id: string): Promise<WorkspaceInfo>;
|
|
68
117
|
isWorkspaceOwner(workspaceId: string): Promise<boolean>;
|
|
118
|
+
getOwnerToken(workspaceId: string): Promise<string>;
|
|
69
119
|
|
|
70
120
|
/**
|
|
71
121
|
* Creates and starts a workspace for the given context URL.
|
|
@@ -82,8 +132,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
82
132
|
updateWorkspaceUserPin(id: string, action: GitpodServer.PinAction): Promise<void>;
|
|
83
133
|
sendHeartBeat(options: GitpodServer.SendHeartBeatOptions): Promise<void>;
|
|
84
134
|
watchWorkspaceImageBuildLogs(workspaceId: string): Promise<void>;
|
|
85
|
-
watchHeadlessWorkspaceLogs(workspaceId: string): Promise<void>;
|
|
86
135
|
isPrebuildDone(pwsid: string): Promise<boolean>;
|
|
136
|
+
getHeadlessLog(instanceId: string): Promise<HeadlessLogUrls>;
|
|
87
137
|
|
|
88
138
|
// Workspace timeout
|
|
89
139
|
setWorkspaceTimeout(workspaceId: string, duration: WorkspaceTimeoutDuration): Promise<SetWorkspaceTimeoutResult>;
|
|
@@ -97,22 +147,56 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
97
147
|
openPort(workspaceId: string, port: WorkspaceInstancePort): Promise<WorkspaceInstancePort | undefined>;
|
|
98
148
|
closePort(workspaceId: string, port: number): Promise<void>;
|
|
99
149
|
|
|
100
|
-
// User messages
|
|
101
|
-
getUserMessages(options: GitpodServer.GetUserMessagesOptions): Promise<UserMessage[]>;
|
|
102
|
-
updateUserMessages(options: GitpodServer.UpdateUserMessagesOptions): Promise<void>;
|
|
103
|
-
|
|
104
150
|
// User storage
|
|
105
151
|
getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
|
|
106
152
|
updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
|
|
107
153
|
|
|
108
|
-
//
|
|
154
|
+
// User env vars
|
|
109
155
|
getEnvVars(): Promise<UserEnvVarValue[]>;
|
|
156
|
+
getAllEnvVars(): Promise<UserEnvVarValue[]>;
|
|
110
157
|
setEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
111
158
|
deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
112
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
|
+
|
|
113
197
|
// content service
|
|
114
|
-
getContentBlobUploadUrl(name: string): Promise<string
|
|
115
|
-
getContentBlobDownloadUrl(name: string): Promise<string
|
|
198
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
199
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
116
200
|
|
|
117
201
|
// Gitpod token
|
|
118
202
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
@@ -120,38 +204,24 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
120
204
|
deleteGitpodToken(tokenHash: string): Promise<void>;
|
|
121
205
|
|
|
122
206
|
// misc
|
|
123
|
-
|
|
207
|
+
isGitHubAppEnabled(): Promise<boolean>;
|
|
124
208
|
registerGithubApp(installationId: string): Promise<void>;
|
|
125
209
|
|
|
126
210
|
/**
|
|
127
|
-
* 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`.
|
|
128
212
|
* @return the snapshot id
|
|
129
213
|
*/
|
|
130
214
|
takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
|
|
131
|
-
|
|
132
215
|
/**
|
|
133
|
-
*
|
|
216
|
+
*
|
|
217
|
+
* @param snapshotId
|
|
134
218
|
*/
|
|
135
|
-
|
|
219
|
+
waitForSnapshot(snapshotId: string): Promise<void>;
|
|
136
220
|
|
|
137
221
|
/**
|
|
138
|
-
*
|
|
139
|
-
*/
|
|
140
|
-
storeLayout(workspaceId: string, layoutData: string): Promise<void>;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* retrieves layout information for the given workspace
|
|
144
|
-
*/
|
|
145
|
-
getLayout(workspaceId: string): Promise<string | undefined>;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @param params
|
|
149
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
222
|
+
* Returns the list of snapshots that exist for a workspace.
|
|
150
223
|
*/
|
|
151
|
-
|
|
152
|
-
resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
|
|
153
|
-
installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
|
|
154
|
-
uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
|
|
224
|
+
getSnapshots(workspaceID: string): Promise<string[]>;
|
|
155
225
|
|
|
156
226
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
157
227
|
|
|
@@ -159,80 +229,184 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
159
229
|
* gitpod.io concerns
|
|
160
230
|
*/
|
|
161
231
|
isStudent(): Promise<boolean>;
|
|
162
|
-
getPrivateRepoTrialEndDate(): Promise<string | undefined>;
|
|
163
|
-
|
|
164
232
|
/**
|
|
165
|
-
*
|
|
233
|
+
*
|
|
166
234
|
*/
|
|
167
235
|
getAccountStatement(options: GitpodServer.GetAccountStatementOptions): Promise<AccountStatement | undefined>;
|
|
168
236
|
getRemainingUsageHours(): Promise<number>;
|
|
169
237
|
|
|
170
238
|
/**
|
|
171
|
-
*
|
|
239
|
+
*
|
|
172
240
|
*/
|
|
173
241
|
getChargebeeSiteId(): Promise<string>;
|
|
174
242
|
createPortalSession(): Promise<{}>;
|
|
243
|
+
createTeamPortalSession(teamId: string): Promise<{}>;
|
|
175
244
|
checkout(planId: string, planQuantity?: number): Promise<{}>;
|
|
245
|
+
teamCheckout(teamId: string, planId: string): Promise<{}>;
|
|
176
246
|
getAvailableCoupons(): Promise<PlanCoupon[]>;
|
|
177
247
|
getAppliedCoupons(): Promise<PlanCoupon[]>;
|
|
178
248
|
|
|
179
249
|
getShowPaymentUI(): Promise<boolean>;
|
|
180
250
|
isChargebeeCustomer(): Promise<boolean>;
|
|
181
|
-
mayAccessPrivateRepo(): Promise<boolean>;
|
|
182
251
|
|
|
183
252
|
subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
184
253
|
subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
185
254
|
subscriptionCancel(subscriptionId: string): Promise<void>;
|
|
186
255
|
subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
|
|
187
256
|
|
|
257
|
+
getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
|
|
188
258
|
tsGet(): Promise<TeamSubscription[]>;
|
|
189
259
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
190
|
-
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined
|
|
260
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
191
261
|
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
192
|
-
tsAssignSlot(
|
|
262
|
+
tsAssignSlot(
|
|
263
|
+
teamSubscriptionId: string,
|
|
264
|
+
teamSubscriptionSlotId: string,
|
|
265
|
+
identityStr: string | undefined,
|
|
266
|
+
): Promise<void>;
|
|
193
267
|
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
194
268
|
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
195
269
|
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
196
270
|
|
|
197
271
|
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
198
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>;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Analytics
|
|
293
|
+
*/
|
|
294
|
+
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
295
|
+
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
296
|
+
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Frontend notifications
|
|
300
|
+
*/
|
|
301
|
+
getNotifications(): Promise<string[]>;
|
|
302
|
+
|
|
303
|
+
getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
|
|
199
304
|
}
|
|
200
305
|
|
|
201
|
-
export
|
|
306
|
+
export interface RateLimiterError {
|
|
307
|
+
method?: string;
|
|
202
308
|
|
|
203
|
-
|
|
204
|
-
|
|
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;
|
|
354
|
+
}
|
|
355
|
+
|
|
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
|
+
}
|
|
205
369
|
}
|
|
206
370
|
|
|
207
|
-
export const
|
|
208
|
-
|
|
209
|
-
|
|
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> {
|
|
384
|
+
methods.setClient = methods.setClient || (() => {});
|
|
385
|
+
methods.dispose = methods.dispose || (() => {});
|
|
210
386
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
387
|
+
// @ts-ignore
|
|
211
388
|
get: (target: S, property: keyof S) => {
|
|
212
389
|
const result = target[property];
|
|
213
390
|
if (!result) {
|
|
214
|
-
throw new Error(`Method ${property} not implemented`);
|
|
391
|
+
throw new Error(`Method ${String(property)} not implemented`);
|
|
215
392
|
}
|
|
216
393
|
return result;
|
|
217
|
-
}
|
|
394
|
+
},
|
|
218
395
|
});
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
222
|
-
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
396
|
+
};
|
|
223
397
|
|
|
224
398
|
export interface SetWorkspaceTimeoutResult {
|
|
225
|
-
resetTimeoutOnWorkspaces: string[]
|
|
399
|
+
resetTimeoutOnWorkspaces: string[];
|
|
226
400
|
}
|
|
227
401
|
|
|
228
402
|
export interface GetWorkspaceTimeoutResult {
|
|
229
|
-
duration: WorkspaceTimeoutDuration
|
|
230
|
-
canChange: boolean
|
|
403
|
+
duration: WorkspaceTimeoutDuration;
|
|
404
|
+
canChange: boolean;
|
|
231
405
|
}
|
|
232
406
|
|
|
233
407
|
export interface StartWorkspaceResult {
|
|
234
|
-
instanceID: string
|
|
235
|
-
workspaceURL?: string
|
|
408
|
+
instanceID: string;
|
|
409
|
+
workspaceURL?: string;
|
|
236
410
|
}
|
|
237
411
|
|
|
238
412
|
export namespace GitpodServer {
|
|
@@ -240,27 +414,31 @@ export namespace GitpodServer {
|
|
|
240
414
|
limit?: number;
|
|
241
415
|
searchString?: string;
|
|
242
416
|
pinnedOnly?: boolean;
|
|
417
|
+
projectId?: string | string[];
|
|
418
|
+
includeWithoutProject?: boolean;
|
|
243
419
|
}
|
|
244
420
|
export interface GetAccountStatementOptions {
|
|
245
421
|
date?: string;
|
|
246
422
|
}
|
|
247
|
-
export interface CreateWorkspaceOptions {
|
|
423
|
+
export interface CreateWorkspaceOptions extends StartWorkspaceOptions {
|
|
248
424
|
contextUrl: string;
|
|
249
|
-
|
|
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;
|
|
250
431
|
}
|
|
432
|
+
|
|
251
433
|
export interface StartWorkspaceOptions {
|
|
252
|
-
forceDefaultImage
|
|
434
|
+
forceDefaultImage?: boolean;
|
|
435
|
+
workspaceClass?: string;
|
|
436
|
+
ideSettings?: IDESettings;
|
|
253
437
|
}
|
|
254
438
|
export interface TakeSnapshotOptions {
|
|
255
439
|
workspaceId: string;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
export interface GetUserMessagesOptions {
|
|
259
|
-
readonly releaseNotes?: boolean;
|
|
260
|
-
readonly workspaceInstanceId: string;
|
|
261
|
-
}
|
|
262
|
-
export interface UpdateUserMessagesOptions {
|
|
263
|
-
readonly messageIds: string[];
|
|
440
|
+
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
441
|
+
dontWait?: boolean;
|
|
264
442
|
}
|
|
265
443
|
export interface GetUserStorageResourceOptions {
|
|
266
444
|
readonly uri: string;
|
|
@@ -278,23 +456,23 @@ export namespace GitpodServer {
|
|
|
278
456
|
readonly roundTripTime?: number;
|
|
279
457
|
}
|
|
280
458
|
export interface UpdateOwnAuthProviderParams {
|
|
281
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
459
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
282
460
|
}
|
|
283
461
|
export interface DeleteOwnAuthProviderParams {
|
|
284
|
-
readonly id: string
|
|
462
|
+
readonly id: string;
|
|
285
463
|
}
|
|
286
464
|
export type AdmissionLevel = "owner" | "everyone";
|
|
287
465
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
288
466
|
export interface GenerateNewGitpodTokenOptions {
|
|
289
|
-
name?: string
|
|
290
|
-
type: GitpodTokenType
|
|
291
|
-
scopes?: string[]
|
|
467
|
+
name?: string;
|
|
468
|
+
type: GitpodTokenType;
|
|
469
|
+
scopes?: string[];
|
|
292
470
|
}
|
|
293
471
|
}
|
|
294
472
|
|
|
295
|
-
export const GitpodServerPath =
|
|
473
|
+
export const GitpodServerPath = "/gitpod";
|
|
296
474
|
|
|
297
|
-
export const GitpodServerProxy = Symbol(
|
|
475
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
298
476
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
299
477
|
|
|
300
478
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -302,12 +480,14 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
302
480
|
|
|
303
481
|
public registerClient(client: Partial<Client>): Disposable {
|
|
304
482
|
this.clients.push(client);
|
|
305
|
-
const index = this.clients.length;
|
|
306
483
|
return {
|
|
307
484
|
dispose: () => {
|
|
308
|
-
this.clients.
|
|
309
|
-
|
|
310
|
-
|
|
485
|
+
const index = this.clients.indexOf(client);
|
|
486
|
+
if (index > -1) {
|
|
487
|
+
this.clients.splice(index, 1);
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
};
|
|
311
491
|
}
|
|
312
492
|
|
|
313
493
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -316,31 +496,34 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
316
496
|
try {
|
|
317
497
|
client.onInstanceUpdate(instance);
|
|
318
498
|
} catch (error) {
|
|
319
|
-
console.error(error)
|
|
499
|
+
console.error(error);
|
|
320
500
|
}
|
|
321
501
|
}
|
|
322
502
|
}
|
|
323
503
|
}
|
|
324
504
|
|
|
325
|
-
|
|
505
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void {
|
|
326
506
|
for (const client of this.clients) {
|
|
327
|
-
if (client.
|
|
507
|
+
if (client.onPrebuildUpdate) {
|
|
328
508
|
try {
|
|
329
|
-
client.
|
|
509
|
+
client.onPrebuildUpdate(update);
|
|
330
510
|
} catch (error) {
|
|
331
|
-
console.error(error)
|
|
511
|
+
console.error(error);
|
|
332
512
|
}
|
|
333
513
|
}
|
|
334
514
|
}
|
|
335
515
|
}
|
|
336
516
|
|
|
337
|
-
|
|
517
|
+
onWorkspaceImageBuildLogs(
|
|
518
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
519
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
520
|
+
): void {
|
|
338
521
|
for (const client of this.clients) {
|
|
339
|
-
if (client.
|
|
522
|
+
if (client.onWorkspaceImageBuildLogs) {
|
|
340
523
|
try {
|
|
341
|
-
client.
|
|
524
|
+
client.onWorkspaceImageBuildLogs(info, content);
|
|
342
525
|
} catch (error) {
|
|
343
|
-
console.error(error)
|
|
526
|
+
console.error(error);
|
|
344
527
|
}
|
|
345
528
|
}
|
|
346
529
|
}
|
|
@@ -352,7 +535,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
352
535
|
try {
|
|
353
536
|
client.notifyDidOpenConnection();
|
|
354
537
|
} catch (error) {
|
|
355
|
-
console.error(error)
|
|
538
|
+
console.error(error);
|
|
356
539
|
}
|
|
357
540
|
}
|
|
358
541
|
}
|
|
@@ -364,7 +547,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
364
547
|
try {
|
|
365
548
|
client.notifyDidCloseConnection();
|
|
366
549
|
} catch (error) {
|
|
367
|
-
console.error(error)
|
|
550
|
+
console.error(error);
|
|
368
551
|
}
|
|
369
552
|
}
|
|
370
553
|
}
|
|
@@ -376,64 +559,73 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
376
559
|
try {
|
|
377
560
|
client.onCreditAlert(creditAlert);
|
|
378
561
|
} catch (error) {
|
|
379
|
-
console.error(error)
|
|
562
|
+
console.error(error);
|
|
380
563
|
}
|
|
381
564
|
}
|
|
382
565
|
}
|
|
383
566
|
}
|
|
384
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);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
385
579
|
}
|
|
386
580
|
|
|
387
581
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
388
582
|
|
|
389
|
-
const hasWindow =
|
|
583
|
+
const hasWindow = typeof window !== "undefined";
|
|
390
584
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
391
585
|
unknown: 0,
|
|
392
586
|
preparing: 1,
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
587
|
+
building: 2,
|
|
588
|
+
pending: 3,
|
|
589
|
+
creating: 4,
|
|
590
|
+
initializing: 5,
|
|
591
|
+
running: 6,
|
|
592
|
+
interrupted: 7,
|
|
593
|
+
stopping: 8,
|
|
594
|
+
stopped: 9,
|
|
400
595
|
};
|
|
401
596
|
export class WorkspaceInstanceUpdateListener {
|
|
402
597
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
403
598
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
404
599
|
|
|
405
|
-
private source:
|
|
600
|
+
private source: "sync" | "update" = "sync";
|
|
406
601
|
|
|
407
602
|
get info(): WorkspaceInfo {
|
|
408
603
|
return this._info;
|
|
409
604
|
}
|
|
410
605
|
|
|
411
|
-
constructor(
|
|
412
|
-
private readonly service: GitpodService,
|
|
413
|
-
private _info: WorkspaceInfo
|
|
414
|
-
) {
|
|
606
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
415
607
|
service.registerClient({
|
|
416
|
-
onInstanceUpdate: instance => {
|
|
608
|
+
onInstanceUpdate: (instance) => {
|
|
417
609
|
if (this.isOutOfOrder(instance)) {
|
|
418
610
|
return;
|
|
419
611
|
}
|
|
420
612
|
this.cancelSync();
|
|
421
613
|
this._info.latestInstance = instance;
|
|
422
|
-
this.source =
|
|
614
|
+
this.source = "update";
|
|
423
615
|
this.onDidChangeEmitter.fire(undefined);
|
|
424
616
|
},
|
|
425
617
|
notifyDidOpenConnection: () => {
|
|
426
618
|
this.sync();
|
|
427
|
-
}
|
|
619
|
+
},
|
|
428
620
|
});
|
|
429
621
|
if (hasWindow) {
|
|
430
622
|
// learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
|
|
431
|
-
window.document.addEventListener(
|
|
432
|
-
if (window.document.visibilityState ===
|
|
623
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
624
|
+
if (window.document.visibilityState === "visible") {
|
|
433
625
|
this.sync();
|
|
434
626
|
}
|
|
435
627
|
});
|
|
436
|
-
window.addEventListener(
|
|
628
|
+
window.addEventListener("pageshow", (e) => {
|
|
437
629
|
if (e.persisted) {
|
|
438
630
|
this.sync();
|
|
439
631
|
}
|
|
@@ -461,12 +653,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
461
653
|
return;
|
|
462
654
|
}
|
|
463
655
|
this._info = info;
|
|
464
|
-
this.source =
|
|
656
|
+
this.source = "sync";
|
|
465
657
|
this.onDidChangeEmitter.fire(undefined);
|
|
466
658
|
} catch (e) {
|
|
467
|
-
console.error(
|
|
659
|
+
console.error("failed to sync workspace instance:", e);
|
|
468
660
|
}
|
|
469
|
-
})
|
|
661
|
+
});
|
|
470
662
|
}
|
|
471
663
|
private cancelSync(): void {
|
|
472
664
|
if (this.syncTokenSource) {
|
|
@@ -483,7 +675,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
483
675
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
484
676
|
return true;
|
|
485
677
|
}
|
|
486
|
-
if (this.source ===
|
|
678
|
+
if (this.source === "update") {
|
|
487
679
|
return false;
|
|
488
680
|
}
|
|
489
681
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -491,14 +683,16 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
491
683
|
}
|
|
492
684
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
493
685
|
}
|
|
686
|
+
}
|
|
494
687
|
|
|
688
|
+
export interface GitpodServiceOptions {
|
|
689
|
+
onReconnect?: () => void | Promise<void>;
|
|
495
690
|
}
|
|
496
691
|
|
|
497
692
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
498
|
-
|
|
499
693
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
500
694
|
|
|
501
|
-
constructor(public readonly server: JsonRpcProxy<Server
|
|
695
|
+
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
502
696
|
server.setClient(this.compositeClient);
|
|
503
697
|
server.onDidOpenConnection(() => this.compositeClient.notifyDidOpenConnection());
|
|
504
698
|
server.onDidCloseConnection(() => this.compositeClient.notifyDidCloseConnection());
|
|
@@ -510,7 +704,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
510
704
|
|
|
511
705
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
512
706
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
513
|
-
const listener =
|
|
707
|
+
const listener =
|
|
708
|
+
this.instanceListeners.get(workspaceId) ||
|
|
514
709
|
(async () => {
|
|
515
710
|
const info = await this.server.getWorkspace(workspaceId);
|
|
516
711
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -518,13 +713,33 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
518
713
|
this.instanceListeners.set(workspaceId, listener);
|
|
519
714
|
return listener;
|
|
520
715
|
}
|
|
716
|
+
|
|
717
|
+
async reconnect(): Promise<void> {
|
|
718
|
+
if (this.options?.onReconnect) {
|
|
719
|
+
await this.options.onReconnect();
|
|
720
|
+
}
|
|
721
|
+
}
|
|
521
722
|
}
|
|
522
723
|
|
|
523
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
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
|
+
|
|
527
737
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
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
|
+
}
|