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