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