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