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