@gitpod/gitpod-protocol 0.1.5-sh-ace-test.0 → 0.1.5-siddhant-k-code-allow-github-prebuilds-10358.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/gitpod-schema.json +163 -74
- package/lib/accounting-protocol.d.ts +163 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +111 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +51 -6
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +17 -2
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +44 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/attribution.d.ts +24 -0
- package/lib/attribution.d.ts.map +1 -0
- package/lib/attribution.js +54 -0
- package/lib/attribution.js.map +1 -0
- package/lib/auth.d.ts +25 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +16 -0
- package/lib/auth.js.map +1 -0
- package/lib/billing-mode.d.ts +45 -0
- package/lib/billing-mode.d.ts.map +1 -0
- package/lib/billing-mode.js +44 -0
- package/lib/billing-mode.js.map +1 -0
- package/lib/blocked-repositories-protocol.d.ts +13 -0
- package/lib/blocked-repositories-protocol.d.ts.map +1 -0
- package/lib/blocked-repositories-protocol.js +8 -0
- package/lib/blocked-repositories-protocol.js.map +1 -0
- package/lib/context-url.d.ts +30 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +100 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +12 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +81 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/encryption/container-module.d.ts +2 -2
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +8 -6
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +2 -2
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +28 -28
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +3 -3
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +32 -39
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +2 -2
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +33 -46
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +3 -3
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +34 -40
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +2 -8
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +10 -29
- package/lib/env.js.map +1 -1
- package/lib/experiments/always-default.d.ts +8 -0
- package/lib/experiments/always-default.d.ts.map +1 -0
- package/lib/experiments/always-default.js +20 -0
- package/lib/experiments/always-default.js.map +1 -0
- package/lib/experiments/configcat-server.d.ts +10 -0
- package/lib/experiments/configcat-server.d.ts.map +1 -0
- package/lib/experiments/configcat-server.js +37 -0
- package/lib/experiments/configcat-server.js.map +1 -0
- package/lib/experiments/configcat.d.ts +21 -0
- package/lib/experiments/configcat.d.ts.map +1 -0
- package/lib/experiments/configcat.js +51 -0
- package/lib/experiments/configcat.js.map +1 -0
- package/lib/experiments/types.d.ts +22 -0
- package/lib/experiments/types.d.ts.map +1 -0
- package/lib/experiments/types.js +10 -0
- package/lib/experiments/types.js.map +1 -0
- package/lib/frontend-dashboard-service.d.ts +90 -0
- package/lib/frontend-dashboard-service.d.ts.map +1 -0
- package/lib/frontend-dashboard-service.js +49 -0
- package/lib/frontend-dashboard-service.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts +2 -2
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +29 -44
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.d.ts +2 -2
- package/lib/gitpod-file-parser.spec.js +147 -144
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +241 -50
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +275 -123
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +11 -13
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +8 -9
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +26 -0
- package/lib/ide-frontend-service.d.ts.map +1 -0
- package/lib/ide-frontend-service.js +8 -0
- package/lib/ide-frontend-service.js.map +1 -0
- package/lib/ide-protocol.d.ts +126 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/ide-protocol.js +18 -0
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +18 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +28 -13
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +30 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +31 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- package/lib/license-protocol.d.ts +9 -2
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js +3 -2
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +6 -4
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +188 -48
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +9 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +48 -59
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +21 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +95 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/error.d.ts +17 -4
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +34 -7
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +2 -1
- package/lib/messaging/handler.js.map +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +24 -59
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +3 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +76 -162
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/oss-allowlist.d.ts +14 -0
- package/lib/oss-allowlist.d.ts.map +1 -0
- package/lib/oss-allowlist.js +8 -0
- package/lib/oss-allowlist.js.map +1 -0
- package/lib/payment-protocol.d.ts +18 -0
- package/lib/payment-protocol.d.ts.map +1 -0
- package/lib/payment-protocol.js +13 -0
- package/lib/payment-protocol.js.map +1 -0
- package/lib/permission.d.ts +26 -15
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +50 -36
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +211 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +609 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +300 -112
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +393 -201
- package/lib/protocol.js.map +1 -1
- package/lib/protocol.spec.d.ts +7 -0
- package/lib/protocol.spec.d.ts.map +1 -0
- package/lib/protocol.spec.js +127 -0
- package/lib/protocol.spec.js.map +1 -0
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/lib/snapshot-url.spec.d.ts +7 -0
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.d.ts +92 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +78 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +136 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +37 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/typings/globals.d.ts +4 -3
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/typings/globals.js +2 -2
- package/lib/usage.d.ts +73 -0
- package/lib/usage.d.ts.map +1 -0
- package/lib/usage.js +20 -0
- package/lib/usage.js.map +1 -0
- package/lib/util/analytics.d.ts +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +88 -0
- package/lib/util/analytics.js.map +1 -0
- package/lib/util/async-iterator.d.ts +2 -2
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +60 -137
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +2 -2
- package/lib/util/cancelable.js +20 -61
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +2 -2
- package/lib/util/date-time.js +14 -13
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/debug-app.d.ts +25 -0
- package/lib/util/debug-app.d.ts.map +1 -0
- package/lib/util/debug-app.js +100 -0
- package/lib/util/debug-app.js.map +1 -0
- package/lib/util/deep-partial.d.ts +2 -2
- package/lib/util/deep-partial.js +2 -2
- package/lib/util/deferred.d.ts +2 -2
- package/lib/util/deferred.js +13 -14
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts +2 -2
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +28 -40
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +64 -77
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +3 -2
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +35 -49
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +9 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.js +491 -0
- package/lib/util/generate-workspace-id.js.map +1 -0
- package/lib/util/generate-workspace-id.spec.d.ts +7 -0
- package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.spec.js +98 -0
- package/lib/util/generate-workspace-id.spec.js.map +1 -0
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +41 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +20 -7
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +146 -85
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +16 -0
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -0
- package/lib/util/gitpod-host-url.spec.js +134 -0
- package/lib/util/gitpod-host-url.spec.js.map +1 -0
- package/lib/util/grpc.d.ts +35 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +90 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/jaeger-client-types.d.ts +68 -0
- package/lib/util/jaeger-client-types.d.ts.map +1 -0
- package/lib/util/jaeger-client-types.js +8 -0
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +58 -35
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +144 -129
- package/lib/util/logging.js.map +1 -1
- package/lib/util/logging.spec.d.ts +7 -0
- package/lib/util/logging.spec.d.ts.map +1 -0
- package/lib/util/logging.spec.js +52 -0
- package/lib/util/logging.spec.js.map +1 -0
- package/lib/util/make-link.d.ts +2 -2
- package/lib/util/make-link.js +8 -7
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/nice-grpc.d.ts +9 -0
- package/lib/util/nice-grpc.d.ts.map +1 -0
- package/lib/util/nice-grpc.js +121 -0
- package/lib/util/nice-grpc.js.map +1 -0
- package/lib/util/parse-workspace-id.d.ts +15 -5
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +39 -9
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +10 -2
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +130 -49
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +2 -2
- package/lib/util/queue.js +19 -57
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.d.ts +2 -2
- package/lib/util/queue.spec.js +149 -288
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeat.d.ts +15 -0
- package/lib/util/repeat.d.ts.map +1 -0
- package/lib/util/repeat.js +55 -0
- package/lib/util/repeat.js.map +1 -0
- package/lib/util/semaphore.d.ts +2 -2
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +18 -48
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +2 -2
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +9 -8
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +4 -2
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +43 -18
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +4 -2
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +57 -25
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +54 -8
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +200 -66
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.d.ts +7 -0
- package/lib/util/tracing.spec.d.ts.map +1 -0
- package/lib/util/tracing.spec.js +121 -0
- package/lib/util/tracing.spec.js.map +1 -0
- package/lib/util/workspace-port-authentication.d.ts +9 -9
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +13 -14
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/webhook-event.d.ts +44 -0
- package/lib/webhook-event.d.ts.map +1 -0
- package/lib/webhook-event.js +8 -0
- package/lib/webhook-event.js.map +1 -0
- package/lib/workspace-class.d.ts +14 -0
- package/lib/workspace-class.d.ts.map +1 -0
- package/lib/workspace-class.js +8 -0
- package/lib/workspace-class.js.map +1 -0
- package/lib/workspace-cluster.d.ts +75 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +31 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +51 -8
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +2 -2
- package/lib/wsready.d.ts +8 -2
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +4 -3
- package/lib/wsready.js.map +1 -1
- package/package.json +42 -18
- package/pkg-yarn.lock +24 -10
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +244 -0
- package/src/admin-protocol.ts +96 -21
- package/src/analytics.ts +52 -0
- package/src/attribution.ts +63 -0
- package/src/auth.ts +27 -0
- package/src/billing-mode.ts +84 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +49 -0
- package/src/context-url.ts +107 -0
- package/src/encryption/container-module.ts +4 -5
- package/src/encryption/encryption-engine.spec.ts +11 -10
- package/src/encryption/encryption-engine.ts +22 -18
- package/src/encryption/encryption-service.ts +6 -7
- package/src/encryption/key-provider.ts +18 -21
- package/src/env.ts +3 -26
- package/src/experiments/always-default.ts +24 -0
- package/src/experiments/configcat-server.ts +42 -0
- package/src/experiments/configcat.ts +56 -0
- package/src/experiments/types.ts +34 -0
- package/src/frontend-dashboard-service.ts +125 -0
- package/src/gitpod-file-parser.spec.ts +57 -63
- package/src/gitpod-file-parser.ts +18 -19
- package/src/gitpod-service.ts +534 -99
- package/src/headless-workspace-log.ts +14 -16
- package/src/ide-frontend-service.ts +28 -0
- package/src/ide-protocol.ts +147 -0
- package/src/index.ts +18 -12
- package/src/installation-admin-protocol.ts +45 -0
- package/src/license-protocol.ts +14 -8
- package/src/messaging/browser/connection.ts +202 -26
- package/src/messaging/browser/window-connection.ts +45 -29
- package/src/messaging/client-call-metrics.ts +94 -0
- package/src/messaging/error.ts +47 -10
- package/src/messaging/handler.ts +13 -1
- package/src/messaging/node/connection.ts +23 -70
- package/src/messaging/proxy-factory.ts +35 -34
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +20 -0
- package/src/permission.ts +53 -40
- package/src/plans.ts +683 -0
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +706 -299
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +150 -0
- package/src/teams-projects-protocol.ts +177 -0
- package/src/typings/globals.ts +7 -5
- package/src/usage.ts +85 -0
- package/src/util/analytics.ts +109 -0
- package/src/util/async-iterator.ts +6 -7
- package/src/util/cancelable.ts +5 -5
- package/src/util/date-time.ts +10 -10
- package/src/util/debug-app.ts +81 -0
- package/src/util/deep-partial.ts +2 -2
- package/src/util/deferred.ts +8 -8
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +18 -10
- package/src/util/generate-workspace-id.spec.ts +58 -0
- package/src/util/generate-workspace-id.ts +481 -0
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +76 -0
- package/src/util/gitpod-host-url.ts +121 -38
- package/src/util/grpc.ts +107 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.spec.ts +23 -0
- package/src/util/logging.ts +163 -73
- package/src/util/make-link.ts +8 -9
- package/src/util/nice-grpc.ts +96 -0
- package/src/util/parse-workspace-id.spec.ts +62 -12
- package/src/util/parse-workspace-id.ts +40 -10
- package/src/util/queue.spec.ts +30 -28
- package/src/util/queue.ts +2 -2
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +8 -10
- package/src/util/skip-if.ts +12 -9
- package/src/util/timeutil.spec.ts +42 -16
- package/src/util/timeutil.ts +33 -17
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +202 -33
- package/src/util/workspace-port-authentication.ts +12 -15
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +110 -0
- package/src/workspace-instance.ts +119 -35
- package/src/wsready.ts +11 -4
- package/data/builtin-theia-plugins.json +0 -362
- package/lib/email-protocol.d.ts +0 -49
- package/lib/email-protocol.d.ts.map +0 -1
- package/lib/email-protocol.js +0 -27
- package/lib/email-protocol.js.map +0 -1
- package/lib/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -45
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.js +0 -8
- package/lib/theia-plugins.js.map +0 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -117
- package/lib/util/repeater.js.map +0 -1
- package/lib/util/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -33
- package/lib/util/safe-promise.js.map +0 -1
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js +0 -8
- package/lib/util/without.js.map +0 -1
- package/src/email-protocol.ts +0 -67
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/theia-plugins.ts +0 -11
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
- package/src/util/without.ts +0 -8
package/src/protocol.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { WorkspaceInstance, PortVisibility } from "./workspace-instance";
|
|
8
8
|
import { RoleOrPermission } from "./permission";
|
|
9
|
+
import { Project } from "./teams-projects-protocol";
|
|
10
|
+
import { createHash } from "crypto";
|
|
9
11
|
|
|
10
|
-
export interface UserInfo
|
|
11
|
-
name?: string
|
|
12
|
+
export interface UserInfo {
|
|
13
|
+
name?: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export interface User {
|
|
15
17
|
/** The user id */
|
|
16
|
-
id: string
|
|
18
|
+
id: string;
|
|
17
19
|
|
|
18
20
|
/** The timestamp when the user entry was created */
|
|
19
|
-
creationDate: string
|
|
21
|
+
creationDate: string;
|
|
20
22
|
|
|
21
|
-
avatarUrl?: string
|
|
23
|
+
avatarUrl?: string;
|
|
22
24
|
|
|
23
|
-
name?: string
|
|
25
|
+
name?: string;
|
|
24
26
|
|
|
25
27
|
/** Optional for backwards compatibility */
|
|
26
|
-
fullName?: string
|
|
28
|
+
fullName?: string;
|
|
27
29
|
|
|
28
|
-
identities: Identity[]
|
|
29
|
-
|
|
30
|
-
allowsMarketingCommunication: boolean;
|
|
30
|
+
identities: Identity[];
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Whether the user has been blocked to use our service, because of TOS violation for example.
|
|
@@ -35,11 +35,6 @@ export interface User {
|
|
|
35
35
|
*/
|
|
36
36
|
blocked?: boolean;
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
* whether this user can run workspaces in privileged mode
|
|
40
|
-
*/
|
|
41
|
-
privileged?: boolean;
|
|
42
|
-
|
|
43
38
|
/** A map of random settings that alter the behaviour of Gitpod on a per-user basis */
|
|
44
39
|
featureFlags?: UserFeatureSettings;
|
|
45
40
|
|
|
@@ -50,31 +45,61 @@ export interface User {
|
|
|
50
45
|
markedDeleted?: boolean;
|
|
51
46
|
|
|
52
47
|
additionalData?: AdditionalUserData;
|
|
48
|
+
|
|
49
|
+
// Identifies an explicit team or user ID to which all the user's workspace usage should be attributed to (e.g. for billing purposes)
|
|
50
|
+
usageAttributionId?: string;
|
|
51
|
+
|
|
52
|
+
// The last time this user got verified somehow. The user is not verified if this is empty.
|
|
53
|
+
lastVerificationTime?: string;
|
|
54
|
+
|
|
55
|
+
// The phone number used for the last phone verification.
|
|
56
|
+
verificationPhoneNumber?: string;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
export namespace User {
|
|
56
60
|
export function is(data: any): data is User {
|
|
57
|
-
return data
|
|
58
|
-
&& data.hasOwnProperty('id')
|
|
59
|
-
&& data.hasOwnProperty('identities')
|
|
61
|
+
return data && data.hasOwnProperty("id") && data.hasOwnProperty("identities");
|
|
60
62
|
}
|
|
61
63
|
export function getIdentity(user: User, authProviderId: string): Identity | undefined {
|
|
62
|
-
return user.identities.find(id => id.authProviderId === authProviderId);
|
|
64
|
+
return user.identities.find((id) => id.authProviderId === authProviderId);
|
|
63
65
|
}
|
|
64
|
-
export function
|
|
65
|
-
const
|
|
66
|
+
export function censor(user: User): User {
|
|
67
|
+
const res = { ...user };
|
|
68
|
+
delete res.additionalData;
|
|
69
|
+
res.identities = res.identities.map((i) => {
|
|
70
|
+
delete i.tokens;
|
|
71
|
+
|
|
72
|
+
// The user field is not in the Identity shape, but actually exists on DBIdentity.
|
|
73
|
+
// Trying to push this object out via JSON RPC will fail because of the cyclic nature
|
|
74
|
+
// of this field.
|
|
75
|
+
delete (i as any).user;
|
|
76
|
+
return i;
|
|
77
|
+
});
|
|
78
|
+
return res;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Returns the stored email or if it doesn't exist returns the primaryEmail of the first identity this user signed up with.
|
|
83
|
+
* @param user
|
|
84
|
+
* @returns A primaryEmail, or undefined if there is none.
|
|
85
|
+
*/
|
|
86
|
+
export function getPrimaryEmail(user: User): string | undefined {
|
|
87
|
+
if (user.additionalData?.profile?.emailAddress) {
|
|
88
|
+
return user.additionalData?.profile?.emailAddress;
|
|
89
|
+
}
|
|
90
|
+
const identities = user.identities.filter((i) => !!i.primaryEmail);
|
|
66
91
|
if (identities.length <= 0) {
|
|
67
|
-
|
|
92
|
+
return undefined;
|
|
68
93
|
}
|
|
69
94
|
|
|
70
|
-
return identities[0].primaryEmail
|
|
95
|
+
return identities[0].primaryEmail || undefined;
|
|
71
96
|
}
|
|
72
97
|
export function getName(user: User): string | undefined {
|
|
73
98
|
const name = user.fullName || user.name;
|
|
74
99
|
if (name) {
|
|
75
100
|
return name;
|
|
76
101
|
}
|
|
77
|
-
|
|
102
|
+
|
|
78
103
|
for (const id of user.identities) {
|
|
79
104
|
if (id.authName !== "") {
|
|
80
105
|
return id.authName;
|
|
@@ -82,15 +107,159 @@ export namespace User {
|
|
|
82
107
|
}
|
|
83
108
|
return undefined;
|
|
84
109
|
}
|
|
110
|
+
|
|
111
|
+
export function hasPreferredIde(user: User) {
|
|
112
|
+
return (
|
|
113
|
+
typeof user?.additionalData?.ideSettings?.defaultIde !== "undefined" ||
|
|
114
|
+
typeof user?.additionalData?.ideSettings?.useLatestVersion !== "undefined"
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function isOnboardingUser(user: User) {
|
|
119
|
+
return !hasPreferredIde(user);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function migrationIDESettings(user: User) {
|
|
123
|
+
if (
|
|
124
|
+
!user?.additionalData?.ideSettings ||
|
|
125
|
+
Object.keys(user.additionalData.ideSettings).length === 0 ||
|
|
126
|
+
user.additionalData.ideSettings.settingVersion === "2.0"
|
|
127
|
+
) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const newIDESettings: IDESettings = {
|
|
131
|
+
settingVersion: "2.0",
|
|
132
|
+
};
|
|
133
|
+
const ideSettings = user.additionalData.ideSettings;
|
|
134
|
+
if (ideSettings.useDesktopIde) {
|
|
135
|
+
if (ideSettings.defaultDesktopIde === "code-desktop") {
|
|
136
|
+
newIDESettings.defaultIde = "code-desktop";
|
|
137
|
+
} else if (ideSettings.defaultDesktopIde === "code-desktop-insiders") {
|
|
138
|
+
newIDESettings.defaultIde = "code-desktop";
|
|
139
|
+
newIDESettings.useLatestVersion = true;
|
|
140
|
+
} else {
|
|
141
|
+
newIDESettings.defaultIde = ideSettings.defaultDesktopIde;
|
|
142
|
+
newIDESettings.useLatestVersion = ideSettings.useLatestVersion;
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
const useLatest = ideSettings.defaultIde === "code-latest";
|
|
146
|
+
newIDESettings.defaultIde = "code";
|
|
147
|
+
newIDESettings.useLatestVersion = useLatest;
|
|
148
|
+
}
|
|
149
|
+
user.additionalData.ideSettings = newIDESettings;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function getProfile(user: User): Profile {
|
|
153
|
+
return {
|
|
154
|
+
name: User.getName(user!) || "",
|
|
155
|
+
email: User.getPrimaryEmail(user!) || "",
|
|
156
|
+
company: user?.additionalData?.profile?.companyName,
|
|
157
|
+
avatarURL: user?.avatarUrl,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function setProfile(user: User, profile: Profile): User {
|
|
162
|
+
user.fullName = profile.name;
|
|
163
|
+
user.avatarUrl = profile.avatarURL;
|
|
164
|
+
|
|
165
|
+
if (!user.additionalData) {
|
|
166
|
+
user.additionalData = {};
|
|
167
|
+
}
|
|
168
|
+
if (!user.additionalData.profile) {
|
|
169
|
+
user.additionalData.profile = {};
|
|
170
|
+
}
|
|
171
|
+
user.additionalData.profile.emailAddress = profile.email;
|
|
172
|
+
user.additionalData.profile.companyName = profile.company;
|
|
173
|
+
user.additionalData.profile.lastUpdatedDetailsNudge = new Date().toISOString();
|
|
174
|
+
|
|
175
|
+
return user;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// The actual Profile of a User
|
|
179
|
+
export interface Profile {
|
|
180
|
+
name: string;
|
|
181
|
+
email: string;
|
|
182
|
+
company?: string;
|
|
183
|
+
avatarURL?: string;
|
|
184
|
+
}
|
|
185
|
+
export namespace Profile {
|
|
186
|
+
export function hasChanges(before: Profile, after: Profile) {
|
|
187
|
+
return (
|
|
188
|
+
before.name !== after.name ||
|
|
189
|
+
before.email !== after.email ||
|
|
190
|
+
before.company !== after.company ||
|
|
191
|
+
before.avatarURL !== after.avatarURL
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
85
195
|
}
|
|
86
196
|
|
|
87
197
|
export interface AdditionalUserData {
|
|
88
198
|
platforms?: UserPlatform[];
|
|
89
199
|
emailNotificationSettings?: EmailNotificationSettings;
|
|
200
|
+
featurePreview?: boolean;
|
|
201
|
+
ideSettings?: IDESettings;
|
|
202
|
+
// key is the name of the news, string the iso date when it was seen
|
|
203
|
+
whatsNewSeen?: { [key: string]: string };
|
|
204
|
+
// key is the name of the OAuth client i.e. local app, string the iso date when it was approved
|
|
205
|
+
// TODO(rl): provide a management UX to allow rescinding of approval
|
|
206
|
+
oauthClientsApproved?: { [key: string]: string };
|
|
207
|
+
// to remember GH Orgs the user installed/updated the GH App for
|
|
208
|
+
knownGitHubOrgs?: string[];
|
|
209
|
+
// Git clone URL pointing to the user's dotfile repo
|
|
210
|
+
dotfileRepo?: string;
|
|
211
|
+
// preferred workspace classes
|
|
212
|
+
workspaceClasses?: WorkspaceClasses;
|
|
213
|
+
// additional user profile data
|
|
214
|
+
profile?: ProfileDetails;
|
|
215
|
+
// whether the user has been migrated to team attribution.
|
|
216
|
+
// a corresponding feature flag (team_only_attribution) triggers the migration.
|
|
217
|
+
isMigratedToTeamOnlyAttribution?: boolean;
|
|
218
|
+
}
|
|
219
|
+
export namespace AdditionalUserData {
|
|
220
|
+
export function set(user: User, partialData: Partial<AdditionalUserData>): User {
|
|
221
|
+
if (!user.additionalData) {
|
|
222
|
+
user.additionalData = {
|
|
223
|
+
...partialData,
|
|
224
|
+
};
|
|
225
|
+
} else {
|
|
226
|
+
user.additionalData = {
|
|
227
|
+
...user.additionalData,
|
|
228
|
+
...partialData,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
return user;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// The format in which we store User Profiles in
|
|
235
|
+
export interface ProfileDetails {
|
|
236
|
+
// when was the last time the user updated their profile information or has been nudged to do so.
|
|
237
|
+
lastUpdatedDetailsNudge?: string;
|
|
238
|
+
// the user's company name
|
|
239
|
+
companyName?: string;
|
|
240
|
+
// the user's email
|
|
241
|
+
emailAddress?: string;
|
|
90
242
|
}
|
|
91
243
|
|
|
92
244
|
export interface EmailNotificationSettings {
|
|
93
|
-
|
|
245
|
+
allowsChangelogMail?: boolean;
|
|
246
|
+
allowsDevXMail?: boolean;
|
|
247
|
+
allowsOnboardingMail?: boolean;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export type IDESettings = {
|
|
251
|
+
settingVersion?: string;
|
|
252
|
+
defaultIde?: string;
|
|
253
|
+
// DEPRECATED: Use defaultIde after `settingVersion: 2.0`, no more specialify desktop or browser.
|
|
254
|
+
useDesktopIde?: boolean;
|
|
255
|
+
// DEPRECATED: Same with useDesktopIde.
|
|
256
|
+
defaultDesktopIde?: string;
|
|
257
|
+
useLatestVersion?: boolean;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export interface WorkspaceClasses {
|
|
261
|
+
regular?: string;
|
|
262
|
+
prebuild?: string;
|
|
94
263
|
}
|
|
95
264
|
|
|
96
265
|
export interface UserPlatform {
|
|
@@ -104,7 +273,7 @@ export interface UserPlatform {
|
|
|
104
273
|
* Since when does the user have the browser extension installe don this device.
|
|
105
274
|
*/
|
|
106
275
|
browserExtensionInstalledSince?: string;
|
|
107
|
-
|
|
276
|
+
|
|
108
277
|
/**
|
|
109
278
|
* Since when does the user not have the browser extension installed anymore (but previously had).
|
|
110
279
|
*/
|
|
@@ -112,14 +281,6 @@ export interface UserPlatform {
|
|
|
112
281
|
}
|
|
113
282
|
|
|
114
283
|
export interface UserFeatureSettings {
|
|
115
|
-
/**
|
|
116
|
-
* This field is used as marker to grant users a free trial for using private repositories,
|
|
117
|
-
* independent of any subscription or Chargebee.
|
|
118
|
-
* - it is set when the user uses their first private repo
|
|
119
|
-
* - whether the trial is expired or not is juged by the UserService
|
|
120
|
-
*/
|
|
121
|
-
privateRepoTrialStartDate?: string;
|
|
122
|
-
|
|
123
284
|
/**
|
|
124
285
|
* Permanent feature flags are added to each and every workspace instance
|
|
125
286
|
* this user starts.
|
|
@@ -127,19 +288,43 @@ export interface UserFeatureSettings {
|
|
|
127
288
|
permanentWSFeatureFlags?: NamedWorkspaceFeatureFlag[];
|
|
128
289
|
}
|
|
129
290
|
|
|
291
|
+
export type BillingTier = "paid" | "free";
|
|
292
|
+
|
|
130
293
|
/**
|
|
131
294
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
132
295
|
* If they don't we'll break things during workspace startup.
|
|
133
296
|
*/
|
|
134
|
-
export const WorkspaceFeatureFlags = {
|
|
135
|
-
|
|
297
|
+
export const WorkspaceFeatureFlags = {
|
|
298
|
+
full_workspace_backup: undefined,
|
|
299
|
+
workspace_class_limiting: undefined,
|
|
300
|
+
workspace_connection_limiting: undefined,
|
|
301
|
+
workspace_psi: undefined,
|
|
302
|
+
};
|
|
303
|
+
export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
|
|
304
|
+
export namespace NamedWorkspaceFeatureFlag {
|
|
305
|
+
export const WORKSPACE_PERSISTED_FEATTURE_FLAGS: NamedWorkspaceFeatureFlag[] = ["full_workspace_backup"];
|
|
306
|
+
export function isWorkspacePersisted(ff: NamedWorkspaceFeatureFlag): boolean {
|
|
307
|
+
return WORKSPACE_PERSISTED_FEATTURE_FLAGS.includes(ff);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
136
310
|
|
|
137
|
-
export interface
|
|
138
|
-
id?: string;
|
|
311
|
+
export interface EnvVarWithValue {
|
|
139
312
|
name: string;
|
|
140
|
-
repositoryPattern: string;
|
|
141
313
|
value: string;
|
|
142
314
|
}
|
|
315
|
+
|
|
316
|
+
export interface ProjectEnvVarWithValue extends EnvVarWithValue {
|
|
317
|
+
id: string;
|
|
318
|
+
projectId: string;
|
|
319
|
+
censored: boolean;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export type ProjectEnvVar = Omit<ProjectEnvVarWithValue, "value">;
|
|
323
|
+
|
|
324
|
+
export interface UserEnvVarValue extends EnvVarWithValue {
|
|
325
|
+
id?: string;
|
|
326
|
+
repositoryPattern: string; // DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
327
|
+
}
|
|
143
328
|
export interface UserEnvVar extends UserEnvVarValue {
|
|
144
329
|
id: string;
|
|
145
330
|
userId: string;
|
|
@@ -147,26 +332,89 @@ export interface UserEnvVar extends UserEnvVarValue {
|
|
|
147
332
|
}
|
|
148
333
|
|
|
149
334
|
export namespace UserEnvVar {
|
|
335
|
+
/**
|
|
336
|
+
* @param variable
|
|
337
|
+
* @returns Either a string containing an error message or undefined.
|
|
338
|
+
*/
|
|
339
|
+
export function validate(variable: UserEnvVarValue): string | undefined {
|
|
340
|
+
const name = variable.name;
|
|
341
|
+
const pattern = variable.repositoryPattern;
|
|
342
|
+
if (name.trim() === "") {
|
|
343
|
+
return "Name must not be empty.";
|
|
344
|
+
}
|
|
345
|
+
if (name.length > 255) {
|
|
346
|
+
return "Name too long. Maximum name length is 255 characters.";
|
|
347
|
+
}
|
|
348
|
+
if (!/^[a-zA-Z_]+[a-zA-Z0-9_]*$/.test(name)) {
|
|
349
|
+
return "Name must match /^[a-zA-Z_]+[a-zA-Z0-9_]*$/.";
|
|
350
|
+
}
|
|
351
|
+
if (variable.value.trim() === "") {
|
|
352
|
+
return "Value must not be empty.";
|
|
353
|
+
}
|
|
354
|
+
if (variable.value.length > 32767) {
|
|
355
|
+
return "Value too long. Maximum value length is 32767 characters.";
|
|
356
|
+
}
|
|
357
|
+
if (pattern.trim() === "") {
|
|
358
|
+
return "Scope must not be empty.";
|
|
359
|
+
}
|
|
360
|
+
const split = pattern.split("/");
|
|
361
|
+
if (split.length < 2) {
|
|
362
|
+
return "A scope must use the form 'organization/repo'.";
|
|
363
|
+
}
|
|
364
|
+
for (const name of split) {
|
|
365
|
+
if (name !== "*") {
|
|
366
|
+
if (!/^[a-zA-Z0-9_\-.\*]+$/.test(name)) {
|
|
367
|
+
return "Invalid scope segment. Only ASCII characters, numbers, -, _, . or * are allowed.";
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return undefined;
|
|
372
|
+
}
|
|
150
373
|
|
|
374
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
151
375
|
export function normalizeRepoPattern(pattern: string) {
|
|
152
376
|
return pattern.toLocaleLowerCase();
|
|
153
377
|
}
|
|
154
378
|
|
|
379
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
380
|
+
export function score(value: UserEnvVarValue): number {
|
|
381
|
+
// We use a score to enforce precedence:
|
|
382
|
+
// value/value = 0
|
|
383
|
+
// value/* = 1
|
|
384
|
+
// */value = 2
|
|
385
|
+
// */* = 3
|
|
386
|
+
// #/# = 4 (used for env vars passed through the URL)
|
|
387
|
+
// the lower the score, the higher the precedence.
|
|
388
|
+
const [ownerPattern, repoPattern] = splitRepositoryPattern(value.repositoryPattern);
|
|
389
|
+
let score = 0;
|
|
390
|
+
if (repoPattern == "*") {
|
|
391
|
+
score += 1;
|
|
392
|
+
}
|
|
393
|
+
if (ownerPattern == "*") {
|
|
394
|
+
score += 2;
|
|
395
|
+
}
|
|
396
|
+
if (ownerPattern == "#" || repoPattern == "#") {
|
|
397
|
+
score = 4;
|
|
398
|
+
}
|
|
399
|
+
return score;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
155
403
|
export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
|
|
156
|
-
let result = vars.filter(e => {
|
|
404
|
+
let result = vars.filter((e) => {
|
|
157
405
|
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
158
|
-
if (ownerPattern !==
|
|
406
|
+
if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
|
|
159
407
|
return false;
|
|
160
408
|
}
|
|
161
|
-
if (repoPattern !==
|
|
409
|
+
if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
|
|
162
410
|
return false;
|
|
163
411
|
}
|
|
164
412
|
return true;
|
|
165
413
|
});
|
|
166
414
|
|
|
167
415
|
const resmap = new Map<string, T[]>();
|
|
168
|
-
result.forEach(e => {
|
|
169
|
-
const l =
|
|
416
|
+
result.forEach((e) => {
|
|
417
|
+
const l = resmap.get(e.name) || [];
|
|
170
418
|
l.push(e);
|
|
171
419
|
resmap.set(e.name, l);
|
|
172
420
|
});
|
|
@@ -187,25 +435,7 @@ export namespace UserEnvVar {
|
|
|
187
435
|
let minscore = 10;
|
|
188
436
|
let bestCandidate: T | undefined;
|
|
189
437
|
for (const e of candidates) {
|
|
190
|
-
|
|
191
|
-
// value/value = 0
|
|
192
|
-
// value/* = 1
|
|
193
|
-
// */value = 2
|
|
194
|
-
// */* = 3
|
|
195
|
-
// #/# = 4 (used for env vars passed through the URL)
|
|
196
|
-
// the lower the score, the higher the precedence.
|
|
197
|
-
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
198
|
-
let score = 0;
|
|
199
|
-
if (repoPattern == "*") {
|
|
200
|
-
score += 1;
|
|
201
|
-
}
|
|
202
|
-
if (ownerPattern == '*') {
|
|
203
|
-
score += 2;
|
|
204
|
-
}
|
|
205
|
-
if (ownerPattern == "#" || repoPattern == "#") {
|
|
206
|
-
score = 4;
|
|
207
|
-
}
|
|
208
|
-
|
|
438
|
+
const score = UserEnvVar.score(e);
|
|
209
439
|
if (!bestCandidate || score < minscore) {
|
|
210
440
|
minscore = score;
|
|
211
441
|
bestCandidate = e;
|
|
@@ -217,47 +447,109 @@ export namespace UserEnvVar {
|
|
|
217
447
|
return result;
|
|
218
448
|
}
|
|
219
449
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
const
|
|
450
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
451
|
+
export function splitRepositoryPattern(repositoryPattern: string): string[] {
|
|
452
|
+
const patterns = repositoryPattern.split("/");
|
|
453
|
+
const repoPattern = patterns.slice(1).join("/");
|
|
454
|
+
const ownerPattern = patterns[0];
|
|
224
455
|
return [ownerPattern, repoPattern];
|
|
225
456
|
}
|
|
226
457
|
}
|
|
227
458
|
|
|
228
|
-
export interface
|
|
459
|
+
export interface SSHPublicKeyValue {
|
|
460
|
+
name: string;
|
|
461
|
+
key: string;
|
|
462
|
+
}
|
|
463
|
+
export interface UserSSHPublicKey extends SSHPublicKeyValue {
|
|
464
|
+
id: string;
|
|
465
|
+
key: string;
|
|
466
|
+
userId: string;
|
|
467
|
+
fingerprint: string;
|
|
468
|
+
creationTime: string;
|
|
469
|
+
lastUsedTime?: string;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export type UserSSHPublicKeyValue = Omit<UserSSHPublicKey, "userId">;
|
|
473
|
+
|
|
474
|
+
export namespace SSHPublicKeyValue {
|
|
475
|
+
export function validate(value: SSHPublicKeyValue): string | undefined {
|
|
476
|
+
if (value.name.length === 0) {
|
|
477
|
+
return "Title must not be empty.";
|
|
478
|
+
}
|
|
479
|
+
if (value.name.length > 255) {
|
|
480
|
+
return "Title too long. Maximum value length is 255 characters.";
|
|
481
|
+
}
|
|
482
|
+
if (value.key.length === 0) {
|
|
483
|
+
return "Key must not be empty.";
|
|
484
|
+
}
|
|
485
|
+
try {
|
|
486
|
+
getData(value);
|
|
487
|
+
} catch (e) {
|
|
488
|
+
return "Key is invalid. You must supply a key in OpenSSH public key format.";
|
|
489
|
+
}
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
229
492
|
|
|
493
|
+
export function getData(value: SSHPublicKeyValue) {
|
|
494
|
+
// Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'.
|
|
495
|
+
const regex =
|
|
496
|
+
/^(?<type>ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-ed25519|sk-ecdsa-sha2-nistp256@openssh\.com|sk-ssh-ed25519@openssh\.com) (?<key>.*?)( (?<email>.*?))?$/;
|
|
497
|
+
const resultGroup = regex.exec(value.key.trim());
|
|
498
|
+
if (!resultGroup) {
|
|
499
|
+
throw new Error("Key is invalid.");
|
|
500
|
+
}
|
|
501
|
+
return {
|
|
502
|
+
type: resultGroup.groups?.["type"] as string,
|
|
503
|
+
key: resultGroup.groups?.["key"] as string,
|
|
504
|
+
email: resultGroup.groups?.["email"] || undefined,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export function getFingerprint(value: SSHPublicKeyValue) {
|
|
509
|
+
const data = getData(value);
|
|
510
|
+
let buf = Buffer.from(data.key, "base64");
|
|
511
|
+
// gitlab style
|
|
512
|
+
// const hash = createHash("md5").update(buf).digest("hex");
|
|
513
|
+
// github style
|
|
514
|
+
const hash = createHash("sha256").update(buf).digest("base64");
|
|
515
|
+
return hash;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export const MAXIMUM_KEY_LENGTH = 5;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export interface GitpodToken {
|
|
230
522
|
/** Hash value (SHA256) of the token (primary key). */
|
|
231
|
-
tokenHash: string
|
|
523
|
+
tokenHash: string;
|
|
232
524
|
|
|
233
525
|
/** Human readable name of the token */
|
|
234
|
-
name?: string
|
|
526
|
+
name?: string;
|
|
235
527
|
|
|
236
528
|
/** Token kind */
|
|
237
|
-
type: GitpodTokenType
|
|
529
|
+
type: GitpodTokenType;
|
|
238
530
|
|
|
239
531
|
/** The user the token belongs to. */
|
|
240
|
-
user: User
|
|
241
|
-
|
|
532
|
+
user: User;
|
|
533
|
+
|
|
242
534
|
/** Scopes (e.g. limition to read-only) */
|
|
243
|
-
scopes: string[]
|
|
535
|
+
scopes: string[];
|
|
244
536
|
|
|
245
537
|
/** Created timestamp */
|
|
246
|
-
created: string
|
|
247
|
-
|
|
538
|
+
created: string;
|
|
539
|
+
|
|
248
540
|
// token is deleted on the database and about to be collected by db-sync
|
|
249
|
-
deleted?: boolean
|
|
541
|
+
deleted?: boolean;
|
|
250
542
|
}
|
|
251
543
|
|
|
252
544
|
export enum GitpodTokenType {
|
|
253
545
|
API_AUTH_TOKEN = 0,
|
|
254
|
-
MACHINE_AUTH_TOKEN = 1
|
|
546
|
+
MACHINE_AUTH_TOKEN = 1,
|
|
255
547
|
}
|
|
256
548
|
|
|
257
549
|
export interface OneTimeSecret {
|
|
258
|
-
id: string
|
|
550
|
+
id: string;
|
|
259
551
|
|
|
260
|
-
value: string
|
|
552
|
+
value: string;
|
|
261
553
|
|
|
262
554
|
expirationTime: string;
|
|
263
555
|
|
|
@@ -289,13 +581,12 @@ export type IdentityLookup = Pick<Identity, "authProviderId" | "authId">;
|
|
|
289
581
|
|
|
290
582
|
export namespace Identity {
|
|
291
583
|
export function is(data: any): data is Identity {
|
|
292
|
-
return
|
|
293
|
-
&& data.hasOwnProperty(
|
|
294
|
-
|
|
584
|
+
return (
|
|
585
|
+
data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName")
|
|
586
|
+
);
|
|
295
587
|
}
|
|
296
588
|
export function equals(id1: IdentityLookup, id2: IdentityLookup) {
|
|
297
|
-
return id1.authProviderId === id2.authProviderId
|
|
298
|
-
&& id1.authId === id2.authId
|
|
589
|
+
return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
|
|
299
590
|
}
|
|
300
591
|
}
|
|
301
592
|
|
|
@@ -346,21 +637,20 @@ export interface PendingGithubEvent {
|
|
|
346
637
|
creationDate: Date;
|
|
347
638
|
type: string;
|
|
348
639
|
event: string;
|
|
640
|
+
deleted: boolean;
|
|
349
641
|
}
|
|
350
642
|
|
|
351
643
|
export interface Snapshot {
|
|
352
644
|
id: string;
|
|
353
645
|
creationTime: string;
|
|
646
|
+
availableTime?: string;
|
|
354
647
|
originalWorkspaceId: string;
|
|
355
648
|
bucketId: string;
|
|
356
|
-
|
|
649
|
+
state: SnapshotState;
|
|
650
|
+
message?: string;
|
|
357
651
|
}
|
|
358
652
|
|
|
359
|
-
export
|
|
360
|
-
workspaceId: string;
|
|
361
|
-
lastUpdatedTime: string;
|
|
362
|
-
layoutData: string;
|
|
363
|
-
}
|
|
653
|
+
export type SnapshotState = "pending" | "available" | "error";
|
|
364
654
|
|
|
365
655
|
export interface Workspace {
|
|
366
656
|
id: string;
|
|
@@ -368,9 +658,10 @@ export interface Workspace {
|
|
|
368
658
|
contextURL: string;
|
|
369
659
|
description: string;
|
|
370
660
|
ownerId: string;
|
|
661
|
+
projectId?: string;
|
|
371
662
|
context: WorkspaceContext;
|
|
372
663
|
config: WorkspaceConfig;
|
|
373
|
-
|
|
664
|
+
|
|
374
665
|
/**
|
|
375
666
|
* The source where to get the workspace base image from. This source is resolved
|
|
376
667
|
* during workspace creation. Once a base image has been built the information in here
|
|
@@ -382,13 +673,13 @@ export interface Workspace {
|
|
|
382
673
|
* The resolved, fix name of the workspace image. We only use this
|
|
383
674
|
* to access the logs during an image build.
|
|
384
675
|
*/
|
|
385
|
-
imageNameResolved?: string
|
|
676
|
+
imageNameResolved?: string;
|
|
386
677
|
|
|
387
678
|
/**
|
|
388
679
|
* The resolved/built fixed named of the base image. This field is only set if the workspace
|
|
389
680
|
* already has its base image built.
|
|
390
681
|
*/
|
|
391
|
-
baseImageNameResolved?: string
|
|
682
|
+
baseImageNameResolved?: string;
|
|
392
683
|
|
|
393
684
|
shareable?: boolean;
|
|
394
685
|
pinned?: boolean;
|
|
@@ -422,20 +713,19 @@ export interface Workspace {
|
|
|
422
713
|
|
|
423
714
|
export type WorkspaceSoftDeletion = "user" | "gc";
|
|
424
715
|
|
|
425
|
-
export type WorkspaceType = "regular" | "prebuild"
|
|
716
|
+
export type WorkspaceType = "regular" | "prebuild";
|
|
426
717
|
|
|
427
718
|
export namespace Workspace {
|
|
428
|
-
|
|
429
719
|
export function getFullRepositoryName(ws: Workspace): string | undefined {
|
|
430
720
|
if (CommitContext.is(ws.context)) {
|
|
431
|
-
return ws.context.repository.owner +
|
|
721
|
+
return ws.context.repository.owner + "/" + ws.context.repository.name;
|
|
432
722
|
}
|
|
433
723
|
return undefined;
|
|
434
724
|
}
|
|
435
725
|
|
|
436
726
|
export function getFullRepositoryUrl(ws: Workspace): string | undefined {
|
|
437
727
|
if (CommitContext.is(ws.context)) {
|
|
438
|
-
return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}
|
|
728
|
+
return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`;
|
|
439
729
|
}
|
|
440
730
|
return undefined;
|
|
441
731
|
}
|
|
@@ -469,60 +759,84 @@ export namespace Workspace {
|
|
|
469
759
|
}
|
|
470
760
|
}
|
|
471
761
|
|
|
472
|
-
export interface
|
|
473
|
-
|
|
762
|
+
export interface GuessGitTokenScopesParams {
|
|
763
|
+
host: string;
|
|
764
|
+
repoUrl: string;
|
|
765
|
+
gitCommand: string;
|
|
766
|
+
currentToken: GitToken;
|
|
474
767
|
}
|
|
475
768
|
|
|
476
|
-
export interface
|
|
477
|
-
|
|
478
|
-
|
|
769
|
+
export interface GitToken {
|
|
770
|
+
token: string;
|
|
771
|
+
user: string;
|
|
772
|
+
scopes: string[];
|
|
479
773
|
}
|
|
480
774
|
|
|
481
|
-
export interface
|
|
482
|
-
|
|
775
|
+
export interface GuessedGitTokenScopes {
|
|
776
|
+
message?: string;
|
|
777
|
+
scopes?: string[];
|
|
483
778
|
}
|
|
484
779
|
|
|
485
|
-
export interface
|
|
486
|
-
|
|
780
|
+
export interface VSCodeConfig {
|
|
781
|
+
extensions?: string[];
|
|
487
782
|
}
|
|
488
783
|
|
|
489
|
-
export
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
784
|
+
export interface JetBrainsConfig {
|
|
785
|
+
intellij?: JetBrainsProductConfig;
|
|
786
|
+
goland?: JetBrainsProductConfig;
|
|
787
|
+
pycharm?: JetBrainsProductConfig;
|
|
788
|
+
phpstorm?: JetBrainsProductConfig;
|
|
789
|
+
rubymine?: JetBrainsProductConfig;
|
|
790
|
+
webstorm?: JetBrainsProductConfig;
|
|
791
|
+
rider?: JetBrainsProductConfig;
|
|
792
|
+
clion?: JetBrainsProductConfig;
|
|
793
|
+
}
|
|
794
|
+
export interface JetBrainsProductConfig {
|
|
795
|
+
prebuilds?: JetBrainsPrebuilds;
|
|
796
|
+
vmoptions?: string;
|
|
797
|
+
}
|
|
798
|
+
export interface JetBrainsPrebuilds {
|
|
799
|
+
version?: "stable" | "latest" | "both";
|
|
493
800
|
}
|
|
494
801
|
|
|
495
|
-
export interface
|
|
496
|
-
fullPluginName: string;
|
|
802
|
+
export interface RepositoryCloneInformation {
|
|
497
803
|
url: string;
|
|
498
|
-
|
|
804
|
+
checkoutLocation?: string;
|
|
499
805
|
}
|
|
500
806
|
|
|
501
|
-
export interface
|
|
502
|
-
|
|
807
|
+
export interface CoreDumpConfig {
|
|
808
|
+
enabled?: boolean;
|
|
809
|
+
softLimit?: number;
|
|
810
|
+
hardLimit?: number;
|
|
503
811
|
}
|
|
504
812
|
|
|
505
813
|
export interface WorkspaceConfig {
|
|
814
|
+
mainConfiguration?: string;
|
|
815
|
+
additionalRepositories?: RepositoryCloneInformation[];
|
|
506
816
|
image?: ImageConfig;
|
|
507
817
|
ports?: PortConfig[];
|
|
508
818
|
tasks?: TaskConfig[];
|
|
509
819
|
checkoutLocation?: string;
|
|
510
820
|
workspaceLocation?: string;
|
|
511
|
-
privileged?: boolean;
|
|
512
821
|
gitConfig?: { [config: string]: string };
|
|
513
822
|
github?: GithubAppConfig;
|
|
514
823
|
vscode?: VSCodeConfig;
|
|
515
|
-
|
|
824
|
+
jetbrains?: JetBrainsConfig;
|
|
825
|
+
coreDump?: CoreDumpConfig;
|
|
826
|
+
|
|
827
|
+
/** deprecated. Enabled by default **/
|
|
828
|
+
experimentalNetwork?: boolean;
|
|
516
829
|
|
|
517
830
|
/**
|
|
518
831
|
* Where the config object originates from.
|
|
519
|
-
*
|
|
832
|
+
*
|
|
520
833
|
* repo - from the repository
|
|
521
834
|
* definitly-gp - from github.com/gitpod-io/definitely-gp
|
|
522
835
|
* derived - computed based on analyzing the repository
|
|
836
|
+
* additional-content - config comes from additional content, usually provided through the project's configuration
|
|
523
837
|
* default - our static catch-all default config
|
|
524
838
|
*/
|
|
525
|
-
_origin?:
|
|
839
|
+
_origin?: "repo" | "definitely-gp" | "derived" | "additional-content" | "default";
|
|
526
840
|
|
|
527
841
|
/**
|
|
528
842
|
* Set of automatically infered feature flags. That's not something the user can set, but
|
|
@@ -532,37 +846,34 @@ export interface WorkspaceConfig {
|
|
|
532
846
|
}
|
|
533
847
|
|
|
534
848
|
export interface GithubAppConfig {
|
|
535
|
-
prebuilds?: GithubAppPrebuildConfig
|
|
849
|
+
prebuilds?: GithubAppPrebuildConfig;
|
|
536
850
|
}
|
|
537
851
|
export interface GithubAppPrebuildConfig {
|
|
538
|
-
master?: boolean
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
852
|
+
master?: boolean; // Deprecated: use defaultBranch instead
|
|
853
|
+
defaultBranch?: boolean;
|
|
854
|
+
branches?: boolean;
|
|
855
|
+
pullRequests?: boolean;
|
|
856
|
+
pullRequestsFromForks?: boolean;
|
|
857
|
+
addCheck?: boolean | "prevent-merge-on-error";
|
|
858
|
+
addBadge?: boolean;
|
|
859
|
+
addLabel?: boolean | string;
|
|
860
|
+
addComment?: boolean;
|
|
546
861
|
}
|
|
547
862
|
export namespace GithubAppPrebuildConfig {
|
|
548
863
|
export function is(obj: boolean | GithubAppPrebuildConfig): obj is GithubAppPrebuildConfig {
|
|
549
|
-
return !(typeof obj ===
|
|
864
|
+
return !(typeof obj === "boolean");
|
|
550
865
|
}
|
|
551
866
|
}
|
|
552
867
|
|
|
553
868
|
export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
|
|
554
869
|
export interface WorkspaceImageSourceDocker {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
dockerFileSource: Commit
|
|
559
|
-
dockerFilePath: string
|
|
870
|
+
dockerFilePath: string;
|
|
871
|
+
dockerFileHash: string;
|
|
872
|
+
dockerFileSource?: Commit;
|
|
560
873
|
}
|
|
561
874
|
export namespace WorkspaceImageSourceDocker {
|
|
562
875
|
export function is(obj: object): obj is WorkspaceImageSourceDocker {
|
|
563
|
-
return
|
|
564
|
-
&& 'dockerFileSource' in obj
|
|
565
|
-
&& 'dockerFilePath' in obj;
|
|
876
|
+
return "dockerFileHash" in obj && "dockerFilePath" in obj;
|
|
566
877
|
}
|
|
567
878
|
}
|
|
568
879
|
export interface WorkspaceImageSourceReference {
|
|
@@ -571,34 +882,45 @@ export interface WorkspaceImageSourceReference {
|
|
|
571
882
|
}
|
|
572
883
|
export namespace WorkspaceImageSourceReference {
|
|
573
884
|
export function is(obj: object): obj is WorkspaceImageSourceReference {
|
|
574
|
-
return
|
|
885
|
+
return "baseImageResolved" in obj;
|
|
575
886
|
}
|
|
576
887
|
}
|
|
577
888
|
|
|
578
|
-
export type PrebuiltWorkspaceState
|
|
889
|
+
export type PrebuiltWorkspaceState =
|
|
579
890
|
// the prebuild is queued and may start at anytime
|
|
580
|
-
|
|
891
|
+
| "queued"
|
|
581
892
|
// the workspace prebuild is currently running (i.e. there's a workspace pod deployed)
|
|
582
893
|
| "building"
|
|
583
|
-
// the prebuild
|
|
894
|
+
// the prebuild was aborted
|
|
584
895
|
| "aborted"
|
|
585
896
|
// the prebuild timed out
|
|
586
897
|
| "timeout"
|
|
587
|
-
// the prebuild has finished and a snapshot is available
|
|
588
|
-
| "available"
|
|
898
|
+
// the prebuild has finished (even if a headless task failed) and a snapshot is available
|
|
899
|
+
| "available"
|
|
900
|
+
// the prebuild (headless workspace) failed due to some system error
|
|
901
|
+
| "failed";
|
|
589
902
|
|
|
590
903
|
export interface PrebuiltWorkspace {
|
|
591
904
|
id: string;
|
|
592
905
|
cloneURL: string;
|
|
906
|
+
branch?: string;
|
|
907
|
+
projectId?: string;
|
|
593
908
|
commit: string;
|
|
594
909
|
buildWorkspaceId: string;
|
|
595
910
|
creationTime: string;
|
|
596
911
|
state: PrebuiltWorkspaceState;
|
|
912
|
+
statusVersion: number;
|
|
597
913
|
error?: string;
|
|
598
914
|
snapshot?: string;
|
|
599
915
|
}
|
|
600
916
|
|
|
601
917
|
export namespace PrebuiltWorkspace {
|
|
918
|
+
export function isDone(pws: PrebuiltWorkspace) {
|
|
919
|
+
return (
|
|
920
|
+
pws.state === "available" || pws.state === "timeout" || pws.state === "aborted" || pws.state === "failed"
|
|
921
|
+
);
|
|
922
|
+
}
|
|
923
|
+
|
|
602
924
|
export function isAvailable(pws: PrebuiltWorkspace) {
|
|
603
925
|
return pws.state === "available" && !!pws.snapshot;
|
|
604
926
|
}
|
|
@@ -615,27 +937,33 @@ export interface PrebuiltWorkspaceUpdatable {
|
|
|
615
937
|
repo: string;
|
|
616
938
|
isResolved: boolean;
|
|
617
939
|
installationId: string;
|
|
940
|
+
/**
|
|
941
|
+
* the commitSHA of the commit that triggered the prebuild
|
|
942
|
+
*/
|
|
943
|
+
commitSHA?: string;
|
|
618
944
|
issue?: string;
|
|
619
945
|
contextUrl?: string;
|
|
620
946
|
}
|
|
621
947
|
|
|
622
948
|
export interface WhitelistedRepository {
|
|
623
|
-
url: string
|
|
624
|
-
name: string
|
|
625
|
-
description?: string
|
|
626
|
-
avatar?: string
|
|
949
|
+
url: string;
|
|
950
|
+
name: string;
|
|
951
|
+
description?: string;
|
|
952
|
+
avatar?: string;
|
|
627
953
|
}
|
|
628
954
|
|
|
629
|
-
export type PortOnOpen =
|
|
955
|
+
export type PortOnOpen = "open-browser" | "open-preview" | "notify" | "ignore";
|
|
630
956
|
|
|
631
957
|
export interface PortConfig {
|
|
632
958
|
port: number;
|
|
633
959
|
onOpen?: PortOnOpen;
|
|
634
960
|
visibility?: PortVisibility;
|
|
961
|
+
description?: string;
|
|
962
|
+
name?: string;
|
|
635
963
|
}
|
|
636
964
|
export namespace PortConfig {
|
|
637
965
|
export function is(config: any): config is PortConfig {
|
|
638
|
-
return config &&
|
|
966
|
+
return config && "port" in config && typeof config.port === "number";
|
|
639
967
|
}
|
|
640
968
|
}
|
|
641
969
|
|
|
@@ -645,7 +973,7 @@ export interface PortRangeConfig {
|
|
|
645
973
|
}
|
|
646
974
|
export namespace PortRangeConfig {
|
|
647
975
|
export function is(config: any): config is PortRangeConfig {
|
|
648
|
-
return config &&
|
|
976
|
+
return config && "port" in config && (typeof config.port === "string" || config.port instanceof String);
|
|
649
977
|
}
|
|
650
978
|
}
|
|
651
979
|
|
|
@@ -655,33 +983,32 @@ export interface TaskConfig {
|
|
|
655
983
|
init?: string;
|
|
656
984
|
prebuild?: string;
|
|
657
985
|
command?: string;
|
|
658
|
-
env?: { [env: string]:
|
|
659
|
-
openIn?:
|
|
660
|
-
openMode?:
|
|
986
|
+
env?: { [env: string]: any };
|
|
987
|
+
openIn?: "bottom" | "main" | "left" | "right";
|
|
988
|
+
openMode?: "split-top" | "split-left" | "split-right" | "split-bottom" | "tab-before" | "tab-after";
|
|
661
989
|
}
|
|
662
990
|
|
|
663
991
|
export namespace TaskConfig {
|
|
664
992
|
export function is(config: any): config is TaskConfig {
|
|
665
|
-
return config
|
|
666
|
-
&& ('command' in config || 'init' in config || 'before' in config);
|
|
993
|
+
return config && ("command" in config || "init" in config || "before" in config);
|
|
667
994
|
}
|
|
668
995
|
}
|
|
669
996
|
|
|
670
997
|
export namespace WorkspaceImageBuild {
|
|
671
|
-
export type Phase =
|
|
998
|
+
export type Phase = "BaseImage" | "GitpodLayer" | "Error" | "Done";
|
|
672
999
|
export interface StateInfo {
|
|
673
|
-
phase: Phase
|
|
674
|
-
currentStep?: number
|
|
675
|
-
maxSteps?: number
|
|
1000
|
+
phase: Phase;
|
|
1001
|
+
currentStep?: number;
|
|
1002
|
+
maxSteps?: number;
|
|
676
1003
|
}
|
|
677
1004
|
export interface LogContent {
|
|
678
|
-
text: string
|
|
679
|
-
upToLine?: number
|
|
680
|
-
isDiff?: boolean
|
|
1005
|
+
text: string;
|
|
1006
|
+
upToLine?: number;
|
|
1007
|
+
isDiff?: boolean;
|
|
681
1008
|
}
|
|
682
1009
|
export type LogCallback = (info: StateInfo, content: LogContent | undefined) => void;
|
|
683
1010
|
export namespace LogLine {
|
|
684
|
-
export const DELIMITER =
|
|
1011
|
+
export const DELIMITER = "\r\n";
|
|
685
1012
|
export const DELIMITER_REGEX = /\r?\n/;
|
|
686
1013
|
}
|
|
687
1014
|
}
|
|
@@ -690,20 +1017,18 @@ export type ImageConfig = ImageConfigString | ImageConfigFile;
|
|
|
690
1017
|
export type ImageConfigString = string;
|
|
691
1018
|
export namespace ImageConfigString {
|
|
692
1019
|
export function is(config: ImageConfig | undefined): config is ImageConfigString {
|
|
693
|
-
return typeof config ===
|
|
1020
|
+
return typeof config === "string";
|
|
694
1021
|
}
|
|
695
|
-
|
|
696
1022
|
}
|
|
697
1023
|
export interface ImageConfigFile {
|
|
698
1024
|
// Path to the Dockerfile relative to repository root
|
|
699
|
-
file: string
|
|
1025
|
+
file: string;
|
|
700
1026
|
// Path to the docker build context relative to repository root
|
|
701
|
-
context?: string
|
|
1027
|
+
context?: string;
|
|
702
1028
|
}
|
|
703
1029
|
export namespace ImageConfigFile {
|
|
704
1030
|
export function is(config: ImageConfig | undefined): config is ImageConfigFile {
|
|
705
|
-
return typeof config ===
|
|
706
|
-
&& 'file' in config;
|
|
1031
|
+
return typeof config === "object" && "file" in config;
|
|
707
1032
|
}
|
|
708
1033
|
}
|
|
709
1034
|
export interface ExternalImageConfigFile extends ImageConfigFile {
|
|
@@ -711,22 +1036,22 @@ export interface ExternalImageConfigFile extends ImageConfigFile {
|
|
|
711
1036
|
}
|
|
712
1037
|
export namespace ExternalImageConfigFile {
|
|
713
1038
|
export function is(config: any | undefined): config is ExternalImageConfigFile {
|
|
714
|
-
return typeof config ===
|
|
715
|
-
&& 'file' in config
|
|
716
|
-
&& 'externalSource' in config;
|
|
1039
|
+
return typeof config === "object" && "file" in config && "externalSource" in config;
|
|
717
1040
|
}
|
|
718
1041
|
}
|
|
719
1042
|
|
|
720
1043
|
export interface WorkspaceContext {
|
|
721
1044
|
title: string;
|
|
1045
|
+
ref?: string;
|
|
1046
|
+
/** This contains the URL portion of the contextURL (which might contain other modifiers as well). It's optional because it's not set for older workspaces. */
|
|
722
1047
|
normalizedContextURL?: string;
|
|
723
1048
|
forceCreateNewWorkspace?: boolean;
|
|
1049
|
+
forceImageBuild?: boolean;
|
|
724
1050
|
}
|
|
725
1051
|
|
|
726
1052
|
export namespace WorkspaceContext {
|
|
727
1053
|
export function is(context: any): context is WorkspaceContext {
|
|
728
|
-
return context
|
|
729
|
-
&& 'title' in context;
|
|
1054
|
+
return context && "title" in context;
|
|
730
1055
|
}
|
|
731
1056
|
}
|
|
732
1057
|
|
|
@@ -735,22 +1060,38 @@ export interface WithSnapshot {
|
|
|
735
1060
|
}
|
|
736
1061
|
export namespace WithSnapshot {
|
|
737
1062
|
export function is(context: any): context is WithSnapshot {
|
|
738
|
-
return context
|
|
739
|
-
&& 'snapshotBucketId' in context;
|
|
1063
|
+
return context && "snapshotBucketId" in context;
|
|
740
1064
|
}
|
|
741
1065
|
}
|
|
742
1066
|
|
|
743
|
-
export interface WithPrebuild {
|
|
744
|
-
snapshotBucketId: string;
|
|
1067
|
+
export interface WithPrebuild extends WithSnapshot {
|
|
745
1068
|
prebuildWorkspaceId: string;
|
|
746
1069
|
wasPrebuilt: true;
|
|
747
1070
|
}
|
|
748
1071
|
export namespace WithPrebuild {
|
|
749
1072
|
export function is(context: any): context is WithPrebuild {
|
|
750
|
-
return context
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
1073
|
+
return context && WithSnapshot.is(context) && "prebuildWorkspaceId" in context && "wasPrebuilt" in context;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* WithDefaultConfig contexts disable the download of the gitpod.yml from the repository
|
|
1079
|
+
* and fall back to the built-in configuration.
|
|
1080
|
+
*/
|
|
1081
|
+
export interface WithDefaultConfig {
|
|
1082
|
+
withDefaultConfig: true;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
export namespace WithDefaultConfig {
|
|
1086
|
+
export function is(context: any): context is WithDefaultConfig {
|
|
1087
|
+
return context && "withDefaultConfig" in context && context.withDefaultConfig;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
|
|
1091
|
+
return {
|
|
1092
|
+
...ctx,
|
|
1093
|
+
withDefaultConfig: true,
|
|
1094
|
+
};
|
|
754
1095
|
}
|
|
755
1096
|
}
|
|
756
1097
|
|
|
@@ -760,20 +1101,27 @@ export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
|
|
|
760
1101
|
|
|
761
1102
|
export namespace SnapshotContext {
|
|
762
1103
|
export function is(context: any): context is SnapshotContext {
|
|
763
|
-
return context
|
|
764
|
-
&& WithSnapshot.is(context)
|
|
765
|
-
&& 'snapshotId' in context;
|
|
1104
|
+
return context && WithSnapshot.is(context) && "snapshotId" in context;
|
|
766
1105
|
}
|
|
767
1106
|
}
|
|
768
1107
|
|
|
769
|
-
export interface
|
|
1108
|
+
export interface WithCommitHistory {
|
|
1109
|
+
commitHistory?: string[];
|
|
1110
|
+
additionalRepositoryCommitHistories?: {
|
|
1111
|
+
cloneUrl: string;
|
|
1112
|
+
commitHistory: string[];
|
|
1113
|
+
}[];
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
export interface StartPrebuildContext extends WorkspaceContext, WithCommitHistory {
|
|
770
1117
|
actual: WorkspaceContext;
|
|
1118
|
+
project: Project;
|
|
1119
|
+
branch?: string;
|
|
771
1120
|
}
|
|
772
1121
|
|
|
773
1122
|
export namespace StartPrebuildContext {
|
|
774
1123
|
export function is(context: any): context is StartPrebuildContext {
|
|
775
|
-
return context
|
|
776
|
-
&& 'actual' in context;
|
|
1124
|
+
return context && "actual" in context;
|
|
777
1125
|
}
|
|
778
1126
|
}
|
|
779
1127
|
|
|
@@ -785,33 +1133,28 @@ export interface PrebuiltWorkspaceContext extends WorkspaceContext {
|
|
|
785
1133
|
|
|
786
1134
|
export namespace PrebuiltWorkspaceContext {
|
|
787
1135
|
export function is(context: any): context is PrebuiltWorkspaceContext {
|
|
788
|
-
return context
|
|
789
|
-
&& 'originalContext' in context
|
|
790
|
-
&& 'prebuiltWorkspace' in context;
|
|
1136
|
+
return context && "originalContext" in context && "prebuiltWorkspace" in context;
|
|
791
1137
|
}
|
|
792
1138
|
}
|
|
793
1139
|
|
|
794
|
-
export interface
|
|
795
|
-
|
|
1140
|
+
export interface WithReferrerContext extends WorkspaceContext {
|
|
1141
|
+
referrer: string;
|
|
1142
|
+
referrerIde?: string;
|
|
796
1143
|
}
|
|
797
1144
|
|
|
798
|
-
export namespace
|
|
799
|
-
export function is(context: any): context is
|
|
800
|
-
return context
|
|
801
|
-
&& 'envvars' in context
|
|
1145
|
+
export namespace WithReferrerContext {
|
|
1146
|
+
export function is(context: any): context is WithReferrerContext {
|
|
1147
|
+
return context && "referrer" in context;
|
|
802
1148
|
}
|
|
803
1149
|
}
|
|
804
1150
|
|
|
805
|
-
export interface
|
|
806
|
-
|
|
807
|
-
responseToken: string
|
|
1151
|
+
export interface WithEnvvarsContext extends WorkspaceContext {
|
|
1152
|
+
envvars: EnvVarWithValue[];
|
|
808
1153
|
}
|
|
809
1154
|
|
|
810
|
-
export namespace
|
|
811
|
-
export function is(context: any): context is
|
|
812
|
-
return context
|
|
813
|
-
&& 'responseURL' in context
|
|
814
|
-
&& 'responseToken' in context;
|
|
1155
|
+
export namespace WithEnvvarsContext {
|
|
1156
|
+
export function is(context: any): context is WithEnvvarsContext {
|
|
1157
|
+
return context && "envvars" in context;
|
|
815
1158
|
}
|
|
816
1159
|
}
|
|
817
1160
|
|
|
@@ -823,30 +1166,90 @@ export namespace RefType {
|
|
|
823
1166
|
}
|
|
824
1167
|
// This fallback is meant to handle the cases where (for historic reasons) ref is present but refType is missing
|
|
825
1168
|
return commit.refType || "branch";
|
|
826
|
-
}
|
|
1169
|
+
};
|
|
827
1170
|
}
|
|
828
1171
|
|
|
829
1172
|
export interface Commit {
|
|
830
|
-
repository: Repository
|
|
831
|
-
revision: string
|
|
1173
|
+
repository: Repository;
|
|
1174
|
+
revision: string;
|
|
832
1175
|
|
|
833
1176
|
// Might contain either a branch or a tag (determined by refType)
|
|
834
|
-
ref?: string
|
|
1177
|
+
ref?: string;
|
|
835
1178
|
|
|
836
1179
|
// refType is only set if ref is present (and not for old workspaces, before this feature was added)
|
|
837
|
-
refType?: RefType
|
|
1180
|
+
refType?: RefType;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
export interface AdditionalContentContext extends WorkspaceContext {
|
|
1184
|
+
/**
|
|
1185
|
+
* utf-8 encoded contents that will be copied on top of the workspace's filesystem
|
|
1186
|
+
*/
|
|
1187
|
+
additionalFiles: { [filePath: string]: string };
|
|
838
1188
|
}
|
|
839
1189
|
|
|
840
|
-
export
|
|
1190
|
+
export namespace AdditionalContentContext {
|
|
1191
|
+
export function is(ctx: any): ctx is AdditionalContentContext {
|
|
1192
|
+
return "additionalFiles" in ctx;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
|
|
1196
|
+
return is(ctx) && ImageConfigFile.is(config.image) && !!ctx.additionalFiles[config.image.file];
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
export interface OpenPrebuildContext extends WorkspaceContext {
|
|
1201
|
+
openPrebuildID: string;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
export namespace OpenPrebuildContext {
|
|
1205
|
+
export function is(ctx: any): ctx is OpenPrebuildContext {
|
|
1206
|
+
return "openPrebuildID" in ctx;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
|
|
841
1211
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
842
|
-
cloneUrl?: string
|
|
1212
|
+
cloneUrl?: string;
|
|
1213
|
+
|
|
1214
|
+
/**
|
|
1215
|
+
* The clone and checkout information for additional repositories in case of multi-repo projects.
|
|
1216
|
+
*/
|
|
1217
|
+
additionalRepositoryCheckoutInfo?: GitCheckoutInfo[];
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
export namespace CommitContext {
|
|
1221
|
+
/**
|
|
1222
|
+
* Creates a hash for all the commits of the CommitContext and all sub-repo commit infos.
|
|
1223
|
+
* The hash is max 255 chars long.
|
|
1224
|
+
* @param commitContext
|
|
1225
|
+
* @returns hash for commitcontext
|
|
1226
|
+
*/
|
|
1227
|
+
export function computeHash(commitContext: CommitContext): string {
|
|
1228
|
+
// for single commits we use the revision to be backward compatible.
|
|
1229
|
+
if (
|
|
1230
|
+
!commitContext.additionalRepositoryCheckoutInfo ||
|
|
1231
|
+
commitContext.additionalRepositoryCheckoutInfo.length === 0
|
|
1232
|
+
) {
|
|
1233
|
+
return commitContext.revision;
|
|
1234
|
+
}
|
|
1235
|
+
const hasher = createHash("sha256");
|
|
1236
|
+
hasher.update(commitContext.revision);
|
|
1237
|
+
for (const info of commitContext.additionalRepositoryCheckoutInfo) {
|
|
1238
|
+
hasher.update(info.revision);
|
|
1239
|
+
}
|
|
1240
|
+
return hasher.digest("hex");
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
export interface GitCheckoutInfo extends Commit {
|
|
1245
|
+
checkoutLocation?: string;
|
|
1246
|
+
upstreamRemoteURI?: string;
|
|
1247
|
+
localBranch?: string;
|
|
843
1248
|
}
|
|
844
1249
|
|
|
845
1250
|
export namespace CommitContext {
|
|
846
1251
|
export function is(commit: any): commit is CommitContext {
|
|
847
|
-
return WorkspaceContext.is(commit)
|
|
848
|
-
&& 'repository' in commit
|
|
849
|
-
&& 'revision' in commit
|
|
1252
|
+
return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
|
|
850
1253
|
}
|
|
851
1254
|
}
|
|
852
1255
|
|
|
@@ -854,17 +1257,14 @@ export interface PullRequestContext extends CommitContext {
|
|
|
854
1257
|
nr: number;
|
|
855
1258
|
ref: string;
|
|
856
1259
|
base: {
|
|
857
|
-
repository: Repository
|
|
858
|
-
ref: string
|
|
859
|
-
}
|
|
1260
|
+
repository: Repository;
|
|
1261
|
+
ref: string;
|
|
1262
|
+
};
|
|
860
1263
|
}
|
|
861
1264
|
|
|
862
1265
|
export namespace PullRequestContext {
|
|
863
1266
|
export function is(ctx: any): ctx is PullRequestContext {
|
|
864
|
-
return CommitContext.is(ctx)
|
|
865
|
-
&& 'nr' in ctx
|
|
866
|
-
&& 'ref' in ctx
|
|
867
|
-
&& 'base' in ctx
|
|
1267
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
|
|
868
1268
|
}
|
|
869
1269
|
}
|
|
870
1270
|
|
|
@@ -876,10 +1276,7 @@ export interface IssueContext extends CommitContext {
|
|
|
876
1276
|
|
|
877
1277
|
export namespace IssueContext {
|
|
878
1278
|
export function is(ctx: any): ctx is IssueContext {
|
|
879
|
-
return CommitContext.is(ctx)
|
|
880
|
-
&& 'nr' in ctx
|
|
881
|
-
&& 'ref' in ctx
|
|
882
|
-
&& 'localBranch' in ctx
|
|
1279
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
|
|
883
1280
|
}
|
|
884
1281
|
}
|
|
885
1282
|
|
|
@@ -890,9 +1287,7 @@ export interface NavigatorContext extends CommitContext {
|
|
|
890
1287
|
|
|
891
1288
|
export namespace NavigatorContext {
|
|
892
1289
|
export function is(ctx: any): ctx is NavigatorContext {
|
|
893
|
-
return CommitContext.is(ctx)
|
|
894
|
-
&& 'path' in ctx
|
|
895
|
-
&& 'isFile' in ctx
|
|
1290
|
+
return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
|
|
896
1291
|
}
|
|
897
1292
|
}
|
|
898
1293
|
|
|
@@ -901,6 +1296,8 @@ export interface Repository {
|
|
|
901
1296
|
owner: string;
|
|
902
1297
|
name: string;
|
|
903
1298
|
cloneUrl: string;
|
|
1299
|
+
/* Optional kind to differentiate between repositories of orgs/groups/projects and personal repos. */
|
|
1300
|
+
repoKind?: string;
|
|
904
1301
|
description?: string;
|
|
905
1302
|
avatarUrl?: string;
|
|
906
1303
|
webUrl?: string;
|
|
@@ -909,8 +1306,21 @@ export interface Repository {
|
|
|
909
1306
|
private?: boolean;
|
|
910
1307
|
fork?: {
|
|
911
1308
|
// The direct parent of this fork
|
|
912
|
-
parent: Repository
|
|
913
|
-
}
|
|
1309
|
+
parent: Repository;
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
export interface Branch {
|
|
1313
|
+
name: string;
|
|
1314
|
+
commit: CommitInfo;
|
|
1315
|
+
htmlUrl: string;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
export interface CommitInfo {
|
|
1319
|
+
author: string;
|
|
1320
|
+
sha: string;
|
|
1321
|
+
commitMessage: string;
|
|
1322
|
+
authorAvatarUrl?: string;
|
|
1323
|
+
authorDate?: string;
|
|
914
1324
|
}
|
|
915
1325
|
|
|
916
1326
|
export namespace Repository {
|
|
@@ -922,21 +1332,25 @@ export namespace Repository {
|
|
|
922
1332
|
export interface WorkspaceInstancePortsChangedEvent {
|
|
923
1333
|
type: "PortsChanged";
|
|
924
1334
|
instanceID: string;
|
|
925
|
-
portsOpened: number[]
|
|
926
|
-
portsClosed: number[]
|
|
1335
|
+
portsOpened: number[];
|
|
1336
|
+
portsClosed: number[];
|
|
927
1337
|
}
|
|
928
1338
|
|
|
929
1339
|
export namespace WorkspaceInstancePortsChangedEvent {
|
|
930
|
-
|
|
931
1340
|
export function is(data: any): data is WorkspaceInstancePortsChangedEvent {
|
|
932
1341
|
return data && data.type == "PortsChanged";
|
|
933
1342
|
}
|
|
934
|
-
|
|
935
1343
|
}
|
|
936
1344
|
|
|
937
1345
|
export interface WorkspaceInfo {
|
|
938
|
-
workspace: Workspace
|
|
939
|
-
latestInstance?: WorkspaceInstance
|
|
1346
|
+
workspace: Workspace;
|
|
1347
|
+
latestInstance?: WorkspaceInstance;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
export namespace WorkspaceInfo {
|
|
1351
|
+
export function lastActiveISODate(info: WorkspaceInfo): string {
|
|
1352
|
+
return info.latestInstance?.creationTime || info.workspace.creationTime;
|
|
1353
|
+
}
|
|
940
1354
|
}
|
|
941
1355
|
|
|
942
1356
|
export type RunningWorkspaceInfo = WorkspaceInfo & { latestInstance: WorkspaceInstance };
|
|
@@ -946,34 +1360,25 @@ export interface WorkspaceCreationResult {
|
|
|
946
1360
|
workspaceURL?: string;
|
|
947
1361
|
existingWorkspaces?: WorkspaceInfo[];
|
|
948
1362
|
runningWorkspacePrebuild?: {
|
|
949
|
-
prebuildID: string
|
|
950
|
-
workspaceID: string
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1363
|
+
prebuildID: string;
|
|
1364
|
+
workspaceID: string;
|
|
1365
|
+
instanceID: string;
|
|
1366
|
+
starting: RunningWorkspacePrebuildStarting;
|
|
1367
|
+
sameCluster: boolean;
|
|
1368
|
+
};
|
|
954
1369
|
runningPrebuildWorkspaceID?: string;
|
|
955
1370
|
}
|
|
956
|
-
export type RunningWorkspacePrebuildStarting =
|
|
957
|
-
|
|
958
|
-
export enum CreateWorkspaceMode {
|
|
959
|
-
// Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
|
|
960
|
-
Default = 'default',
|
|
961
|
-
// ForceNew creates a new workspace irrespective of any running prebuilds. This mode is guaranteed to actually create a workspace - but may degrade user experience as currently runnig prebuilds are ignored.
|
|
962
|
-
ForceNew = 'force-new',
|
|
963
|
-
// UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
|
|
964
|
-
UsePrebuild = 'use-prebuild',
|
|
965
|
-
// SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
|
|
966
|
-
SelectIfRunning = 'select-if-running',
|
|
967
|
-
}
|
|
1371
|
+
export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
|
|
968
1372
|
|
|
969
1373
|
export namespace WorkspaceCreationResult {
|
|
970
1374
|
export function is(data: any): data is WorkspaceCreationResult {
|
|
971
|
-
return
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1375
|
+
return (
|
|
1376
|
+
data &&
|
|
1377
|
+
("createdWorkspaceId" in data ||
|
|
1378
|
+
"existingWorkspaces" in data ||
|
|
1379
|
+
"runningWorkspacePrebuild" in data ||
|
|
1380
|
+
"runningPrebuildWorkspaceID" in data)
|
|
1381
|
+
);
|
|
977
1382
|
}
|
|
978
1383
|
}
|
|
979
1384
|
|
|
@@ -1007,7 +1412,7 @@ export interface AuthProviderInfo {
|
|
|
1007
1412
|
readonly default: string[];
|
|
1008
1413
|
readonly publicRepo: string[];
|
|
1009
1414
|
readonly privateRepo: string[];
|
|
1010
|
-
}
|
|
1415
|
+
};
|
|
1011
1416
|
}
|
|
1012
1417
|
|
|
1013
1418
|
export interface AuthProviderEntry {
|
|
@@ -1019,6 +1424,8 @@ export interface AuthProviderEntry {
|
|
|
1019
1424
|
readonly status: AuthProviderEntry.Status;
|
|
1020
1425
|
|
|
1021
1426
|
readonly oauth: OAuth2Config;
|
|
1427
|
+
/** A random string that is to change whenever oauth changes (enforced on DB level) */
|
|
1428
|
+
readonly oauthRevision?: string;
|
|
1022
1429
|
}
|
|
1023
1430
|
|
|
1024
1431
|
export interface OAuth2Config {
|
|
@@ -1031,47 +1438,27 @@ export interface OAuth2Config {
|
|
|
1031
1438
|
readonly scopeSeparator?: string;
|
|
1032
1439
|
|
|
1033
1440
|
readonly settingsUrl?: string;
|
|
1034
|
-
readonly authorizationParams?: { [key: string]: string }
|
|
1441
|
+
readonly authorizationParams?: { [key: string]: string };
|
|
1035
1442
|
readonly configURL?: string;
|
|
1036
1443
|
}
|
|
1037
1444
|
|
|
1038
1445
|
export namespace AuthProviderEntry {
|
|
1039
1446
|
export type Type = "GitHub" | "GitLab" | string;
|
|
1040
1447
|
export type Status = "pending" | "verified";
|
|
1041
|
-
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
export
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
readonly ide?: {
|
|
1056
|
-
readonly logo: string;
|
|
1057
|
-
readonly showReleaseNotes: boolean;
|
|
1058
|
-
readonly helpMenu: Branding.Link[];
|
|
1059
|
-
}
|
|
1060
|
-
readonly links: {
|
|
1061
|
-
readonly header: Branding.Link[];
|
|
1062
|
-
readonly footer: Branding.Link[];
|
|
1063
|
-
readonly social: Branding.SocialLink[];
|
|
1064
|
-
readonly legal: Branding.Link[];
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
export namespace Branding {
|
|
1068
|
-
export interface Link {
|
|
1069
|
-
readonly name: string;
|
|
1070
|
-
readonly url: string;
|
|
1071
|
-
}
|
|
1072
|
-
export interface SocialLink {
|
|
1073
|
-
readonly type: string;
|
|
1074
|
-
readonly url: string;
|
|
1448
|
+
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & {
|
|
1449
|
+
clientId?: string;
|
|
1450
|
+
clientSecret?: string;
|
|
1451
|
+
};
|
|
1452
|
+
export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> &
|
|
1453
|
+
Pick<OAuth2Config, "clientId" | "clientSecret">;
|
|
1454
|
+
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
|
|
1455
|
+
return {
|
|
1456
|
+
...entry,
|
|
1457
|
+
oauth: {
|
|
1458
|
+
...entry.oauth,
|
|
1459
|
+
clientSecret: "redacted",
|
|
1460
|
+
},
|
|
1461
|
+
};
|
|
1075
1462
|
}
|
|
1076
1463
|
}
|
|
1077
1464
|
|
|
@@ -1100,3 +1487,23 @@ export namespace TheiaPlugin {
|
|
|
1100
1487
|
CheckinFailed = "checkin-failed",
|
|
1101
1488
|
}
|
|
1102
1489
|
}
|
|
1490
|
+
|
|
1491
|
+
export interface TermsAcceptanceEntry {
|
|
1492
|
+
readonly userId: string;
|
|
1493
|
+
readonly termsRevision: string;
|
|
1494
|
+
readonly acceptionTime: string;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
export interface Terms {
|
|
1498
|
+
readonly revision: string;
|
|
1499
|
+
readonly activeSince: string;
|
|
1500
|
+
readonly adminOnlyTerms: boolean;
|
|
1501
|
+
readonly updateMessage: string;
|
|
1502
|
+
readonly content: string;
|
|
1503
|
+
readonly formElements?: object;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
export interface StripeConfig {
|
|
1507
|
+
individualUsagePriceIds: { [currency: string]: string };
|
|
1508
|
+
teamUsagePriceIds: { [currency: string]: string };
|
|
1509
|
+
}
|