@gitpod/gitpod-protocol 0.1.5-main.648 → 0.1.5-main.6480
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 +90 -0
- package/lib/frontend-dashboard-service.d.ts.map +1 -0
- package/lib/frontend-dashboard-service.js +49 -0
- package/lib/frontend-dashboard-service.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +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 +191 -55
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +204 -298
- 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 +4 -6
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +176 -45
- 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 +6 -5
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +230 -210
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +261 -105
- 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 +24 -5
- 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 +137 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +41 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/typings/globals.d.ts +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 +12 -7
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +132 -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 +28 -8
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +20 -5
- package/lib/workspace-cluster.js.map +1 -1
- 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 +125 -0
- package/src/gitpod-file-parser.spec.ts +56 -62
- package/src/gitpod-file-parser.ts +17 -18
- package/src/gitpod-service.ts +369 -146
- 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 +187 -28
- 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 +250 -199
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +636 -293
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +62 -23
- package/src/teams-projects-protocol.ts +181 -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 +88 -48
- 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 +47 -17
- 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,60 @@ 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
|
+
createOrgAuthProvider(params: GitpodServer.CreateOrgAuthProviderParams): Promise<AuthProviderEntry>;
|
|
179
|
+
updateOrgAuthProvider(params: GitpodServer.UpdateOrgAuthProviderParams): Promise<AuthProviderEntry>;
|
|
180
|
+
getOrgAuthProviders(params: GitpodServer.GetOrgAuthProviderParams): Promise<AuthProviderEntry[]>;
|
|
181
|
+
deleteOrgAuthProvider(params: GitpodServer.DeleteOrgAuthProviderParams): Promise<void>;
|
|
182
|
+
|
|
183
|
+
// Projects
|
|
184
|
+
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
185
|
+
createProject(params: CreateProjectParams): Promise<Project>;
|
|
186
|
+
deleteProject(projectId: string): Promise<void>;
|
|
187
|
+
getTeamProjects(teamId: string): Promise<Project[]>;
|
|
188
|
+
getUserProjects(): Promise<Project[]>;
|
|
189
|
+
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
190
|
+
getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
|
|
191
|
+
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
192
|
+
findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
|
|
193
|
+
getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
|
|
194
|
+
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
195
|
+
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
196
|
+
updateProjectPartial(partialProject: PartialProject): Promise<void>;
|
|
197
|
+
setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
|
|
198
|
+
getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
|
|
199
|
+
deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
|
|
200
|
+
|
|
113
201
|
// content service
|
|
114
|
-
getContentBlobUploadUrl(name: string): Promise<string
|
|
115
|
-
getContentBlobDownloadUrl(name: string): Promise<string
|
|
202
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
203
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
116
204
|
|
|
117
205
|
// Gitpod token
|
|
118
206
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
@@ -120,38 +208,24 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
120
208
|
deleteGitpodToken(tokenHash: string): Promise<void>;
|
|
121
209
|
|
|
122
210
|
// misc
|
|
123
|
-
|
|
211
|
+
isGitHubAppEnabled(): Promise<boolean>;
|
|
124
212
|
registerGithubApp(installationId: string): Promise<void>;
|
|
125
213
|
|
|
126
214
|
/**
|
|
127
|
-
* Stores a new snapshot for the given workspace and bucketId
|
|
215
|
+
* Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
|
|
128
216
|
* @return the snapshot id
|
|
129
217
|
*/
|
|
130
218
|
takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Returns the list of snapshots that exist for a workspace.
|
|
134
|
-
*/
|
|
135
|
-
getSnapshots(workspaceID: string): Promise<string[]>;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* stores/updates layout information for the given workspace
|
|
139
|
-
*/
|
|
140
|
-
storeLayout(workspaceId: string, layoutData: string): Promise<void>;
|
|
141
|
-
|
|
142
219
|
/**
|
|
143
|
-
*
|
|
220
|
+
*
|
|
221
|
+
* @param snapshotId
|
|
144
222
|
*/
|
|
145
|
-
|
|
223
|
+
waitForSnapshot(snapshotId: string): Promise<void>;
|
|
146
224
|
|
|
147
225
|
/**
|
|
148
|
-
*
|
|
149
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
226
|
+
* Returns the list of snapshots that exist for a workspace.
|
|
150
227
|
*/
|
|
151
|
-
|
|
152
|
-
resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
|
|
153
|
-
installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
|
|
154
|
-
uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
|
|
228
|
+
getSnapshots(workspaceID: string): Promise<string[]>;
|
|
155
229
|
|
|
156
230
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
157
231
|
|
|
@@ -159,80 +233,185 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
159
233
|
* gitpod.io concerns
|
|
160
234
|
*/
|
|
161
235
|
isStudent(): Promise<boolean>;
|
|
162
|
-
getPrivateRepoTrialEndDate(): Promise<string | undefined>;
|
|
163
|
-
|
|
164
236
|
/**
|
|
165
|
-
*
|
|
237
|
+
*
|
|
166
238
|
*/
|
|
167
239
|
getAccountStatement(options: GitpodServer.GetAccountStatementOptions): Promise<AccountStatement | undefined>;
|
|
168
240
|
getRemainingUsageHours(): Promise<number>;
|
|
169
241
|
|
|
170
242
|
/**
|
|
171
|
-
*
|
|
243
|
+
*
|
|
172
244
|
*/
|
|
173
245
|
getChargebeeSiteId(): Promise<string>;
|
|
174
246
|
createPortalSession(): Promise<{}>;
|
|
247
|
+
createTeamPortalSession(teamId: string): Promise<{}>;
|
|
175
248
|
checkout(planId: string, planQuantity?: number): Promise<{}>;
|
|
249
|
+
teamCheckout(teamId: string, planId: string): Promise<{}>;
|
|
176
250
|
getAvailableCoupons(): Promise<PlanCoupon[]>;
|
|
177
251
|
getAppliedCoupons(): Promise<PlanCoupon[]>;
|
|
178
252
|
|
|
179
253
|
getShowPaymentUI(): Promise<boolean>;
|
|
180
254
|
isChargebeeCustomer(): Promise<boolean>;
|
|
181
|
-
mayAccessPrivateRepo(): Promise<boolean>;
|
|
182
255
|
|
|
183
256
|
subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
184
257
|
subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
185
258
|
subscriptionCancel(subscriptionId: string): Promise<void>;
|
|
186
259
|
subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
|
|
187
260
|
|
|
261
|
+
getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
|
|
188
262
|
tsGet(): Promise<TeamSubscription[]>;
|
|
189
263
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
190
|
-
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined
|
|
264
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
191
265
|
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
192
|
-
tsAssignSlot(
|
|
266
|
+
tsAssignSlot(
|
|
267
|
+
teamSubscriptionId: string,
|
|
268
|
+
teamSubscriptionSlotId: string,
|
|
269
|
+
identityStr: string | undefined,
|
|
270
|
+
): Promise<void>;
|
|
193
271
|
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
194
272
|
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
195
273
|
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
196
274
|
|
|
197
275
|
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
198
276
|
|
|
277
|
+
getStripePublishableKey(): Promise<string>;
|
|
278
|
+
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
279
|
+
findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
|
|
280
|
+
getPriceInformation(attributionId: string): Promise<string | undefined>;
|
|
281
|
+
createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
|
|
282
|
+
subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
|
|
283
|
+
getStripePortalUrl(attributionId: string): Promise<string>;
|
|
284
|
+
getCostCenter(attributionId: string): Promise<CostCenterJSON | undefined>;
|
|
285
|
+
setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
|
|
286
|
+
getUsageBalance(attributionId: string): Promise<number>;
|
|
287
|
+
|
|
288
|
+
listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
|
|
289
|
+
|
|
290
|
+
setUsageAttribution(usageAttribution: string): Promise<void>;
|
|
291
|
+
listAvailableUsageAttributionIds(): Promise<string[]>;
|
|
292
|
+
|
|
293
|
+
getBillingModeForUser(): Promise<BillingMode>;
|
|
294
|
+
getBillingModeForTeam(teamId: string): Promise<BillingMode>;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Analytics
|
|
298
|
+
*/
|
|
299
|
+
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
300
|
+
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
301
|
+
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Frontend notifications
|
|
305
|
+
*/
|
|
306
|
+
getNotifications(): Promise<string[]>;
|
|
307
|
+
|
|
308
|
+
getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
|
|
199
309
|
}
|
|
200
310
|
|
|
201
|
-
export
|
|
311
|
+
export interface RateLimiterError {
|
|
312
|
+
method?: string;
|
|
202
313
|
|
|
203
|
-
|
|
204
|
-
|
|
314
|
+
/**
|
|
315
|
+
* Retry after this many seconds, earliest.
|
|
316
|
+
* cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
317
|
+
*/
|
|
318
|
+
retryAfter: number;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface CreateProjectParams {
|
|
322
|
+
name: string;
|
|
323
|
+
slug: string;
|
|
324
|
+
cloneUrl: string;
|
|
325
|
+
teamId?: string;
|
|
326
|
+
userId?: string;
|
|
327
|
+
appInstallationId: string;
|
|
328
|
+
}
|
|
329
|
+
export interface FindPrebuildsParams {
|
|
330
|
+
projectId: string;
|
|
331
|
+
branch?: string;
|
|
332
|
+
latest?: boolean;
|
|
333
|
+
prebuildId?: string;
|
|
334
|
+
// default: 30
|
|
335
|
+
limit?: number;
|
|
336
|
+
}
|
|
337
|
+
export interface GetProviderRepositoriesParams {
|
|
338
|
+
provider: string;
|
|
339
|
+
hints?: { installationId: string } | object;
|
|
340
|
+
}
|
|
341
|
+
export interface ProviderRepository {
|
|
342
|
+
name: string;
|
|
343
|
+
path?: string;
|
|
344
|
+
account: string;
|
|
345
|
+
accountAvatarUrl: string;
|
|
346
|
+
cloneUrl: string;
|
|
347
|
+
updatedAt?: string;
|
|
348
|
+
installationId?: number;
|
|
349
|
+
installationUpdatedAt?: string;
|
|
350
|
+
|
|
351
|
+
inUse?: { userName: string };
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface ClientHeaderFields {
|
|
355
|
+
ip?: string;
|
|
356
|
+
userAgent?: string;
|
|
357
|
+
dnt?: string;
|
|
358
|
+
clientRegion?: string;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export type WorkspaceTimeoutDuration = string;
|
|
362
|
+
export namespace WorkspaceTimeoutDuration {
|
|
363
|
+
export function validate(duration: string): WorkspaceTimeoutDuration {
|
|
364
|
+
const unit = duration.slice(-1);
|
|
365
|
+
if (!["m", "h", "d"].includes(unit)) {
|
|
366
|
+
throw new Error(`Invalid timeout unit: ${unit}`);
|
|
367
|
+
}
|
|
368
|
+
const value = parseInt(duration.slice(0, -1));
|
|
369
|
+
if (isNaN(value) || value <= 0) {
|
|
370
|
+
throw new Error(`Invalid timeout value: ${duration}`);
|
|
371
|
+
}
|
|
372
|
+
return duration;
|
|
373
|
+
}
|
|
205
374
|
}
|
|
206
375
|
|
|
207
|
-
export const
|
|
208
|
-
|
|
209
|
-
|
|
376
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_SHORT: WorkspaceTimeoutDuration = "30m";
|
|
377
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_LONG: WorkspaceTimeoutDuration = "60m";
|
|
378
|
+
export const WORKSPACE_TIMEOUT_EXTENDED: WorkspaceTimeoutDuration = "180m";
|
|
379
|
+
|
|
380
|
+
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
381
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
382
|
+
): GitpodServiceImpl<C, S> {
|
|
383
|
+
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
387
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
388
|
+
): JsonRpcProxy<S> {
|
|
389
|
+
methods.setClient = methods.setClient || (() => {});
|
|
390
|
+
methods.dispose = methods.dispose || (() => {});
|
|
210
391
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
392
|
+
// @ts-ignore
|
|
211
393
|
get: (target: S, property: keyof S) => {
|
|
212
394
|
const result = target[property];
|
|
213
395
|
if (!result) {
|
|
214
|
-
throw new Error(`Method ${property} not implemented`);
|
|
396
|
+
throw new Error(`Method ${String(property)} not implemented`);
|
|
215
397
|
}
|
|
216
398
|
return result;
|
|
217
|
-
}
|
|
399
|
+
},
|
|
218
400
|
});
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
222
|
-
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
401
|
+
};
|
|
223
402
|
|
|
224
403
|
export interface SetWorkspaceTimeoutResult {
|
|
225
|
-
resetTimeoutOnWorkspaces: string[]
|
|
404
|
+
resetTimeoutOnWorkspaces: string[];
|
|
226
405
|
}
|
|
227
406
|
|
|
228
407
|
export interface GetWorkspaceTimeoutResult {
|
|
229
|
-
duration: WorkspaceTimeoutDuration
|
|
230
|
-
canChange: boolean
|
|
408
|
+
duration: WorkspaceTimeoutDuration;
|
|
409
|
+
canChange: boolean;
|
|
231
410
|
}
|
|
232
411
|
|
|
233
412
|
export interface StartWorkspaceResult {
|
|
234
|
-
instanceID: string
|
|
235
|
-
workspaceURL?: string
|
|
413
|
+
instanceID: string;
|
|
414
|
+
workspaceURL?: string;
|
|
236
415
|
}
|
|
237
416
|
|
|
238
417
|
export namespace GitpodServer {
|
|
@@ -240,27 +419,31 @@ export namespace GitpodServer {
|
|
|
240
419
|
limit?: number;
|
|
241
420
|
searchString?: string;
|
|
242
421
|
pinnedOnly?: boolean;
|
|
422
|
+
projectId?: string | string[];
|
|
423
|
+
includeWithoutProject?: boolean;
|
|
243
424
|
}
|
|
244
425
|
export interface GetAccountStatementOptions {
|
|
245
426
|
date?: string;
|
|
246
427
|
}
|
|
247
|
-
export interface CreateWorkspaceOptions {
|
|
428
|
+
export interface CreateWorkspaceOptions extends StartWorkspaceOptions {
|
|
248
429
|
contextUrl: string;
|
|
249
|
-
|
|
430
|
+
|
|
431
|
+
// whether running workspaces on the same context should be ignored. If false (default) users will be asked.
|
|
432
|
+
ignoreRunningWorkspaceOnSameCommit?: boolean;
|
|
433
|
+
ignoreRunningPrebuild?: boolean;
|
|
434
|
+
allowUsingPreviousPrebuilds?: boolean;
|
|
435
|
+
forceDefaultConfig?: boolean;
|
|
250
436
|
}
|
|
437
|
+
|
|
251
438
|
export interface StartWorkspaceOptions {
|
|
252
|
-
forceDefaultImage
|
|
439
|
+
forceDefaultImage?: boolean;
|
|
440
|
+
workspaceClass?: string;
|
|
441
|
+
ideSettings?: IDESettings;
|
|
253
442
|
}
|
|
254
443
|
export interface TakeSnapshotOptions {
|
|
255
444
|
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[];
|
|
445
|
+
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
446
|
+
dontWait?: boolean;
|
|
264
447
|
}
|
|
265
448
|
export interface GetUserStorageResourceOptions {
|
|
266
449
|
readonly uri: string;
|
|
@@ -278,23 +461,36 @@ export namespace GitpodServer {
|
|
|
278
461
|
readonly roundTripTime?: number;
|
|
279
462
|
}
|
|
280
463
|
export interface UpdateOwnAuthProviderParams {
|
|
281
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
464
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
282
465
|
}
|
|
283
466
|
export interface DeleteOwnAuthProviderParams {
|
|
284
|
-
readonly id: string
|
|
467
|
+
readonly id: string;
|
|
468
|
+
}
|
|
469
|
+
export interface CreateOrgAuthProviderParams {
|
|
470
|
+
readonly entry: AuthProviderEntry.NewOrgEntry;
|
|
471
|
+
}
|
|
472
|
+
export interface UpdateOrgAuthProviderParams {
|
|
473
|
+
readonly entry: AuthProviderEntry.UpdateOrgEntry;
|
|
474
|
+
}
|
|
475
|
+
export interface GetOrgAuthProviderParams {
|
|
476
|
+
readonly organizationId: string;
|
|
477
|
+
}
|
|
478
|
+
export interface DeleteOrgAuthProviderParams {
|
|
479
|
+
readonly id: string;
|
|
480
|
+
readonly organizationId: string;
|
|
285
481
|
}
|
|
286
482
|
export type AdmissionLevel = "owner" | "everyone";
|
|
287
483
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
288
484
|
export interface GenerateNewGitpodTokenOptions {
|
|
289
|
-
name?: string
|
|
290
|
-
type: GitpodTokenType
|
|
291
|
-
scopes?: string[]
|
|
485
|
+
name?: string;
|
|
486
|
+
type: GitpodTokenType;
|
|
487
|
+
scopes?: string[];
|
|
292
488
|
}
|
|
293
489
|
}
|
|
294
490
|
|
|
295
|
-
export const GitpodServerPath =
|
|
491
|
+
export const GitpodServerPath = "/gitpod";
|
|
296
492
|
|
|
297
|
-
export const GitpodServerProxy = Symbol(
|
|
493
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
298
494
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
299
495
|
|
|
300
496
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -302,12 +498,14 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
302
498
|
|
|
303
499
|
public registerClient(client: Partial<Client>): Disposable {
|
|
304
500
|
this.clients.push(client);
|
|
305
|
-
const index = this.clients.length;
|
|
306
501
|
return {
|
|
307
502
|
dispose: () => {
|
|
308
|
-
this.clients.
|
|
309
|
-
|
|
310
|
-
|
|
503
|
+
const index = this.clients.indexOf(client);
|
|
504
|
+
if (index > -1) {
|
|
505
|
+
this.clients.splice(index, 1);
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
};
|
|
311
509
|
}
|
|
312
510
|
|
|
313
511
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -316,31 +514,34 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
316
514
|
try {
|
|
317
515
|
client.onInstanceUpdate(instance);
|
|
318
516
|
} catch (error) {
|
|
319
|
-
console.error(error)
|
|
517
|
+
console.error(error);
|
|
320
518
|
}
|
|
321
519
|
}
|
|
322
520
|
}
|
|
323
521
|
}
|
|
324
522
|
|
|
325
|
-
|
|
523
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void {
|
|
326
524
|
for (const client of this.clients) {
|
|
327
|
-
if (client.
|
|
525
|
+
if (client.onPrebuildUpdate) {
|
|
328
526
|
try {
|
|
329
|
-
client.
|
|
527
|
+
client.onPrebuildUpdate(update);
|
|
330
528
|
} catch (error) {
|
|
331
|
-
console.error(error)
|
|
529
|
+
console.error(error);
|
|
332
530
|
}
|
|
333
531
|
}
|
|
334
532
|
}
|
|
335
533
|
}
|
|
336
534
|
|
|
337
|
-
|
|
535
|
+
onWorkspaceImageBuildLogs(
|
|
536
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
537
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
538
|
+
): void {
|
|
338
539
|
for (const client of this.clients) {
|
|
339
|
-
if (client.
|
|
540
|
+
if (client.onWorkspaceImageBuildLogs) {
|
|
340
541
|
try {
|
|
341
|
-
client.
|
|
542
|
+
client.onWorkspaceImageBuildLogs(info, content);
|
|
342
543
|
} catch (error) {
|
|
343
|
-
console.error(error)
|
|
544
|
+
console.error(error);
|
|
344
545
|
}
|
|
345
546
|
}
|
|
346
547
|
}
|
|
@@ -352,7 +553,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
352
553
|
try {
|
|
353
554
|
client.notifyDidOpenConnection();
|
|
354
555
|
} catch (error) {
|
|
355
|
-
console.error(error)
|
|
556
|
+
console.error(error);
|
|
356
557
|
}
|
|
357
558
|
}
|
|
358
559
|
}
|
|
@@ -364,7 +565,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
364
565
|
try {
|
|
365
566
|
client.notifyDidCloseConnection();
|
|
366
567
|
} catch (error) {
|
|
367
|
-
console.error(error)
|
|
568
|
+
console.error(error);
|
|
368
569
|
}
|
|
369
570
|
}
|
|
370
571
|
}
|
|
@@ -376,64 +577,73 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
376
577
|
try {
|
|
377
578
|
client.onCreditAlert(creditAlert);
|
|
378
579
|
} catch (error) {
|
|
379
|
-
console.error(error)
|
|
580
|
+
console.error(error);
|
|
380
581
|
}
|
|
381
582
|
}
|
|
382
583
|
}
|
|
383
584
|
}
|
|
384
585
|
|
|
586
|
+
onNotificationUpdated(): void {
|
|
587
|
+
for (const client of this.clients) {
|
|
588
|
+
if (client.onNotificationUpdated) {
|
|
589
|
+
try {
|
|
590
|
+
client.onNotificationUpdated();
|
|
591
|
+
} catch (error) {
|
|
592
|
+
console.error(error);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
385
597
|
}
|
|
386
598
|
|
|
387
599
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
388
600
|
|
|
389
|
-
const hasWindow =
|
|
601
|
+
const hasWindow = typeof window !== "undefined";
|
|
390
602
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
391
603
|
unknown: 0,
|
|
392
604
|
preparing: 1,
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
605
|
+
building: 2,
|
|
606
|
+
pending: 3,
|
|
607
|
+
creating: 4,
|
|
608
|
+
initializing: 5,
|
|
609
|
+
running: 6,
|
|
610
|
+
interrupted: 7,
|
|
611
|
+
stopping: 8,
|
|
612
|
+
stopped: 9,
|
|
400
613
|
};
|
|
401
614
|
export class WorkspaceInstanceUpdateListener {
|
|
402
615
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
403
616
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
404
617
|
|
|
405
|
-
private source:
|
|
618
|
+
private source: "sync" | "update" = "sync";
|
|
406
619
|
|
|
407
620
|
get info(): WorkspaceInfo {
|
|
408
621
|
return this._info;
|
|
409
622
|
}
|
|
410
623
|
|
|
411
|
-
constructor(
|
|
412
|
-
private readonly service: GitpodService,
|
|
413
|
-
private _info: WorkspaceInfo
|
|
414
|
-
) {
|
|
624
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
415
625
|
service.registerClient({
|
|
416
|
-
onInstanceUpdate: instance => {
|
|
626
|
+
onInstanceUpdate: (instance) => {
|
|
417
627
|
if (this.isOutOfOrder(instance)) {
|
|
418
628
|
return;
|
|
419
629
|
}
|
|
420
630
|
this.cancelSync();
|
|
421
631
|
this._info.latestInstance = instance;
|
|
422
|
-
this.source =
|
|
632
|
+
this.source = "update";
|
|
423
633
|
this.onDidChangeEmitter.fire(undefined);
|
|
424
634
|
},
|
|
425
635
|
notifyDidOpenConnection: () => {
|
|
426
636
|
this.sync();
|
|
427
|
-
}
|
|
637
|
+
},
|
|
428
638
|
});
|
|
429
639
|
if (hasWindow) {
|
|
430
640
|
// 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 ===
|
|
641
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
642
|
+
if (window.document.visibilityState === "visible") {
|
|
433
643
|
this.sync();
|
|
434
644
|
}
|
|
435
645
|
});
|
|
436
|
-
window.addEventListener(
|
|
646
|
+
window.addEventListener("pageshow", (e) => {
|
|
437
647
|
if (e.persisted) {
|
|
438
648
|
this.sync();
|
|
439
649
|
}
|
|
@@ -461,12 +671,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
461
671
|
return;
|
|
462
672
|
}
|
|
463
673
|
this._info = info;
|
|
464
|
-
this.source =
|
|
674
|
+
this.source = "sync";
|
|
465
675
|
this.onDidChangeEmitter.fire(undefined);
|
|
466
676
|
} catch (e) {
|
|
467
|
-
console.error(
|
|
677
|
+
console.error("failed to sync workspace instance:", e);
|
|
468
678
|
}
|
|
469
|
-
})
|
|
679
|
+
});
|
|
470
680
|
}
|
|
471
681
|
private cancelSync(): void {
|
|
472
682
|
if (this.syncTokenSource) {
|
|
@@ -483,7 +693,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
483
693
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
484
694
|
return true;
|
|
485
695
|
}
|
|
486
|
-
if (this.source ===
|
|
696
|
+
if (this.source === "update") {
|
|
487
697
|
return false;
|
|
488
698
|
}
|
|
489
699
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -491,14 +701,16 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
491
701
|
}
|
|
492
702
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
493
703
|
}
|
|
704
|
+
}
|
|
494
705
|
|
|
706
|
+
export interface GitpodServiceOptions {
|
|
707
|
+
onReconnect?: () => void | Promise<void>;
|
|
495
708
|
}
|
|
496
709
|
|
|
497
710
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
498
|
-
|
|
499
711
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
500
712
|
|
|
501
|
-
constructor(public readonly server: JsonRpcProxy<Server
|
|
713
|
+
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
502
714
|
server.setClient(this.compositeClient);
|
|
503
715
|
server.onDidOpenConnection(() => this.compositeClient.notifyDidOpenConnection());
|
|
504
716
|
server.onDidCloseConnection(() => this.compositeClient.notifyDidCloseConnection());
|
|
@@ -510,7 +722,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
510
722
|
|
|
511
723
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
512
724
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
513
|
-
const listener =
|
|
725
|
+
const listener =
|
|
726
|
+
this.instanceListeners.get(workspaceId) ||
|
|
514
727
|
(async () => {
|
|
515
728
|
const info = await this.server.getWorkspace(workspaceId);
|
|
516
729
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -518,23 +731,33 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
518
731
|
this.instanceListeners.set(workspaceId, listener);
|
|
519
732
|
return listener;
|
|
520
733
|
}
|
|
734
|
+
|
|
735
|
+
async reconnect(): Promise<void> {
|
|
736
|
+
if (this.options?.onReconnect) {
|
|
737
|
+
await this.options.onReconnect();
|
|
738
|
+
}
|
|
739
|
+
}
|
|
521
740
|
}
|
|
522
741
|
|
|
523
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
742
|
+
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
743
|
+
serverUrl: string | Promise<string>,
|
|
744
|
+
) {
|
|
524
745
|
const toWsUrl = (serverUrl: string) => {
|
|
525
|
-
return new GitpodHostUrl(serverUrl)
|
|
526
|
-
.asWebsocket()
|
|
527
|
-
.withApi({ pathname: GitpodServerPath })
|
|
528
|
-
.toString();
|
|
746
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
529
747
|
};
|
|
530
748
|
let url: string | Promise<string>;
|
|
531
749
|
if (typeof serverUrl === "string") {
|
|
532
750
|
url = toWsUrl(serverUrl);
|
|
533
751
|
} else {
|
|
534
|
-
url = serverUrl.then(url => toWsUrl(url));
|
|
752
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
535
753
|
}
|
|
536
754
|
|
|
537
755
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
756
|
+
let onReconnect = () => {};
|
|
757
|
+
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
758
|
+
onListening: (socket) => {
|
|
759
|
+
onReconnect = () => socket.reconnect();
|
|
760
|
+
},
|
|
761
|
+
});
|
|
762
|
+
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
763
|
+
}
|