@gitpod/gitpod-protocol 0.1.5-private-repos-after-cancellation.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 +145 -7
- package/lib/accounting-protocol.d.ts +18 -12
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +43 -42
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +28 -4
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +2 -13
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +12 -2
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js.map +1 -1
- 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 +18 -5
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +63 -10
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +2 -0
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +81 -48
- package/lib/context-url.spec.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +4 -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 +127 -52
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +190 -315
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +3 -13
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +3 -8
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +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 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -1
- 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 +3 -3
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +173 -36
- 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 +10 -2
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +20 -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.map +1 -1
- package/lib/payment-protocol.js +1 -1
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +9 -4
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +39 -31
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +5 -4
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +229 -209
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +234 -143
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +339 -193
- 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 +22 -4
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +33 -18
- package/lib/team-subscription-protocol.js.map +1 -1
- 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.map +1 -1
- package/lib/util/analytics.js +44 -26
- package/lib/util/analytics.js.map +1 -1
- 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 -504
- 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 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +124 -114
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +97 -135
- 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 +30 -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 +29 -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 +9 -12
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/webhook-event.d.ts +44 -0
- package/lib/webhook-event.d.ts.map +1 -0
- package/lib/webhook-event.js +8 -0
- package/lib/webhook-event.js.map +1 -0
- package/lib/workspace-class.d.ts +14 -0
- package/lib/workspace-class.d.ts.map +1 -0
- package/lib/workspace-class.js +8 -0
- package/lib/workspace-class.js.map +1 -0
- package/lib/workspace-cluster.d.ts +15 -5
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +19 -4
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +44 -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 +34 -15
- package/pkg-yarn.lock +21 -9
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +66 -54
- package/src/admin-protocol.ts +53 -21
- package/src/analytics.ts +28 -16
- 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 +37 -9
- package/src/context-url.ts +94 -36
- 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 +286 -143
- package/src/headless-workspace-log.ts +8 -19
- package/src/ide-frontend-service.ts +2 -2
- package/src/ide-protocol.ts +129 -0
- package/src/index.ts +16 -12
- package/src/installation-admin-protocol.ts +45 -0
- package/src/license-protocol.ts +12 -6
- package/src/messaging/browser/connection.ts +185 -21
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +77 -0
- package/src/messaging/error.ts +29 -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 +2 -2
- package/src/permission.ts +40 -33
- package/src/plans.ts +240 -189
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +612 -340
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +59 -23
- 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 +56 -18
- 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 +14 -6
- package/src/util/generate-workspace-id.spec.ts +34 -7
- package/src/util/generate-workspace-id.ts +464 -440
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +40 -13
- package/src/util/gitpod-host-url.ts +61 -37
- 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 +27 -25
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +4 -6
- package/src/util/skip-if.ts +9 -6
- package/src/util/timeutil.spec.ts +40 -14
- package/src/util/timeutil.ts +27 -11
- 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 +29 -10
- package/src/workspace-instance.ts +89 -24
- 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/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/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
|
|
27
|
-
|
|
28
|
-
identities: Identity[]
|
|
29
|
+
fullName?: string;
|
|
29
30
|
|
|
30
|
-
|
|
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 {
|
|
@@ -99,20 +201,63 @@ export interface AdditionalUserData {
|
|
|
99
201
|
featurePreview?: boolean;
|
|
100
202
|
ideSettings?: IDESettings;
|
|
101
203
|
// key is the name of the news, string the iso date when it was seen
|
|
102
|
-
whatsNewSeen?: { [key: string]: string }
|
|
204
|
+
whatsNewSeen?: { [key: string]: string };
|
|
103
205
|
// key is the name of the OAuth client i.e. local app, string the iso date when it was approved
|
|
104
206
|
// TODO(rl): provide a management UX to allow rescinding of approval
|
|
105
|
-
oauthClientsApproved?: { [key: string]: string }
|
|
207
|
+
oauthClientsApproved?: { [key: string]: string };
|
|
106
208
|
// to remember GH Orgs the user installed/updated the GH App for
|
|
107
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;
|
|
108
240
|
}
|
|
109
241
|
|
|
110
242
|
export interface EmailNotificationSettings {
|
|
111
|
-
|
|
243
|
+
allowsChangelogMail?: boolean;
|
|
244
|
+
allowsDevXMail?: boolean;
|
|
245
|
+
allowsOnboardingMail?: boolean;
|
|
112
246
|
}
|
|
113
247
|
|
|
114
248
|
export type IDESettings = {
|
|
115
|
-
|
|
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;
|
|
116
261
|
}
|
|
117
262
|
|
|
118
263
|
export interface UserPlatform {
|
|
@@ -134,14 +279,6 @@ export interface UserPlatform {
|
|
|
134
279
|
}
|
|
135
280
|
|
|
136
281
|
export interface UserFeatureSettings {
|
|
137
|
-
/**
|
|
138
|
-
* This field is used as marker to grant users a free trial for using private repositories,
|
|
139
|
-
* independent of any subscription or Chargebee.
|
|
140
|
-
* - it is set when the user uses their first private repo
|
|
141
|
-
* - whether the trial is expired or not is juged by the UserService
|
|
142
|
-
*/
|
|
143
|
-
privateRepoTrialStartDate?: string;
|
|
144
|
-
|
|
145
282
|
/**
|
|
146
283
|
* Permanent feature flags are added to each and every workspace instance
|
|
147
284
|
* this user starts.
|
|
@@ -149,19 +286,47 @@ export interface UserFeatureSettings {
|
|
|
149
286
|
permanentWSFeatureFlags?: NamedWorkspaceFeatureFlag[];
|
|
150
287
|
}
|
|
151
288
|
|
|
289
|
+
export type BillingTier = "paid" | "free";
|
|
290
|
+
|
|
152
291
|
/**
|
|
153
292
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
154
293
|
* If they don't we'll break things during workspace startup.
|
|
155
294
|
*/
|
|
156
|
-
export const WorkspaceFeatureFlags = {
|
|
157
|
-
|
|
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
|
+
}
|
|
158
312
|
|
|
159
|
-
export interface
|
|
160
|
-
id?: string;
|
|
313
|
+
export interface EnvVarWithValue {
|
|
161
314
|
name: string;
|
|
162
|
-
repositoryPattern: string;
|
|
163
315
|
value: string;
|
|
164
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
|
+
}
|
|
165
330
|
export interface UserEnvVar extends UserEnvVarValue {
|
|
166
331
|
id: string;
|
|
167
332
|
userId: string;
|
|
@@ -169,11 +334,51 @@ export interface UserEnvVar extends UserEnvVarValue {
|
|
|
169
334
|
}
|
|
170
335
|
|
|
171
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
|
+
}
|
|
172
375
|
|
|
376
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
173
377
|
export function normalizeRepoPattern(pattern: string) {
|
|
174
378
|
return pattern.toLocaleLowerCase();
|
|
175
379
|
}
|
|
176
380
|
|
|
381
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
177
382
|
export function score(value: UserEnvVarValue): number {
|
|
178
383
|
// We use a score to enforce precedence:
|
|
179
384
|
// value/value = 0
|
|
@@ -187,7 +392,7 @@ export namespace UserEnvVar {
|
|
|
187
392
|
if (repoPattern == "*") {
|
|
188
393
|
score += 1;
|
|
189
394
|
}
|
|
190
|
-
if (ownerPattern ==
|
|
395
|
+
if (ownerPattern == "*") {
|
|
191
396
|
score += 2;
|
|
192
397
|
}
|
|
193
398
|
if (ownerPattern == "#" || repoPattern == "#") {
|
|
@@ -196,21 +401,22 @@ export namespace UserEnvVar {
|
|
|
196
401
|
return score;
|
|
197
402
|
}
|
|
198
403
|
|
|
404
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
199
405
|
export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
|
|
200
|
-
let result = vars.filter(e => {
|
|
406
|
+
let result = vars.filter((e) => {
|
|
201
407
|
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
202
|
-
if (ownerPattern !==
|
|
408
|
+
if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
|
|
203
409
|
return false;
|
|
204
410
|
}
|
|
205
|
-
if (repoPattern !==
|
|
411
|
+
if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
|
|
206
412
|
return false;
|
|
207
413
|
}
|
|
208
414
|
return true;
|
|
209
415
|
});
|
|
210
416
|
|
|
211
417
|
const resmap = new Map<string, T[]>();
|
|
212
|
-
result.forEach(e => {
|
|
213
|
-
const l =
|
|
418
|
+
result.forEach((e) => {
|
|
419
|
+
const l = resmap.get(e.name) || [];
|
|
214
420
|
l.push(e);
|
|
215
421
|
resmap.set(e.name, l);
|
|
216
422
|
});
|
|
@@ -243,47 +449,109 @@ export namespace UserEnvVar {
|
|
|
243
449
|
return result;
|
|
244
450
|
}
|
|
245
451
|
|
|
452
|
+
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
246
453
|
export function splitRepositoryPattern(repositoryPattern: string): string[] {
|
|
247
|
-
const patterns = repositoryPattern.split(
|
|
248
|
-
const repoPattern = patterns.
|
|
249
|
-
const ownerPattern = patterns
|
|
454
|
+
const patterns = repositoryPattern.split("/");
|
|
455
|
+
const repoPattern = patterns.slice(1).join("/");
|
|
456
|
+
const ownerPattern = patterns[0];
|
|
250
457
|
return [ownerPattern, repoPattern];
|
|
251
458
|
}
|
|
252
459
|
}
|
|
253
460
|
|
|
254
|
-
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
|
+
}
|
|
255
522
|
|
|
523
|
+
export interface GitpodToken {
|
|
256
524
|
/** Hash value (SHA256) of the token (primary key). */
|
|
257
|
-
tokenHash: string
|
|
525
|
+
tokenHash: string;
|
|
258
526
|
|
|
259
527
|
/** Human readable name of the token */
|
|
260
|
-
name?: string
|
|
528
|
+
name?: string;
|
|
261
529
|
|
|
262
530
|
/** Token kind */
|
|
263
|
-
type: GitpodTokenType
|
|
531
|
+
type: GitpodTokenType;
|
|
264
532
|
|
|
265
533
|
/** The user the token belongs to. */
|
|
266
|
-
user: User
|
|
534
|
+
user: User;
|
|
267
535
|
|
|
268
536
|
/** Scopes (e.g. limition to read-only) */
|
|
269
|
-
scopes: string[]
|
|
537
|
+
scopes: string[];
|
|
270
538
|
|
|
271
539
|
/** Created timestamp */
|
|
272
|
-
created: string
|
|
540
|
+
created: string;
|
|
273
541
|
|
|
274
542
|
// token is deleted on the database and about to be collected by db-sync
|
|
275
|
-
deleted?: boolean
|
|
543
|
+
deleted?: boolean;
|
|
276
544
|
}
|
|
277
545
|
|
|
278
546
|
export enum GitpodTokenType {
|
|
279
547
|
API_AUTH_TOKEN = 0,
|
|
280
|
-
MACHINE_AUTH_TOKEN = 1
|
|
548
|
+
MACHINE_AUTH_TOKEN = 1,
|
|
281
549
|
}
|
|
282
550
|
|
|
283
551
|
export interface OneTimeSecret {
|
|
284
|
-
id: string
|
|
552
|
+
id: string;
|
|
285
553
|
|
|
286
|
-
value: string
|
|
554
|
+
value: string;
|
|
287
555
|
|
|
288
556
|
expirationTime: string;
|
|
289
557
|
|
|
@@ -315,13 +583,12 @@ export type IdentityLookup = Pick<Identity, "authProviderId" | "authId">;
|
|
|
315
583
|
|
|
316
584
|
export namespace Identity {
|
|
317
585
|
export function is(data: any): data is Identity {
|
|
318
|
-
return
|
|
319
|
-
&& data.hasOwnProperty(
|
|
320
|
-
|
|
586
|
+
return (
|
|
587
|
+
data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName")
|
|
588
|
+
);
|
|
321
589
|
}
|
|
322
590
|
export function equals(id1: IdentityLookup, id2: IdentityLookup) {
|
|
323
|
-
return id1.authProviderId === id2.authProviderId
|
|
324
|
-
&& id1.authId === id2.authId
|
|
591
|
+
return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
|
|
325
592
|
}
|
|
326
593
|
}
|
|
327
594
|
|
|
@@ -372,28 +639,35 @@ export interface PendingGithubEvent {
|
|
|
372
639
|
creationDate: Date;
|
|
373
640
|
type: string;
|
|
374
641
|
event: string;
|
|
642
|
+
deleted: boolean;
|
|
375
643
|
}
|
|
376
644
|
|
|
377
645
|
export interface Snapshot {
|
|
378
646
|
id: string;
|
|
379
647
|
creationTime: string;
|
|
648
|
+
availableTime?: string;
|
|
380
649
|
originalWorkspaceId: string;
|
|
381
650
|
bucketId: string;
|
|
382
|
-
|
|
651
|
+
state: SnapshotState;
|
|
652
|
+
message?: string;
|
|
383
653
|
}
|
|
384
654
|
|
|
385
|
-
export interface
|
|
655
|
+
export interface VolumeSnapshot {
|
|
656
|
+
id: string;
|
|
386
657
|
workspaceId: string;
|
|
387
|
-
|
|
388
|
-
|
|
658
|
+
creationTime: string;
|
|
659
|
+
volumeHandle: string;
|
|
389
660
|
}
|
|
390
661
|
|
|
662
|
+
export type SnapshotState = "pending" | "available" | "error";
|
|
663
|
+
|
|
391
664
|
export interface Workspace {
|
|
392
665
|
id: string;
|
|
393
666
|
creationTime: string;
|
|
394
667
|
contextURL: string;
|
|
395
668
|
description: string;
|
|
396
669
|
ownerId: string;
|
|
670
|
+
projectId?: string;
|
|
397
671
|
context: WorkspaceContext;
|
|
398
672
|
config: WorkspaceConfig;
|
|
399
673
|
|
|
@@ -408,13 +682,13 @@ export interface Workspace {
|
|
|
408
682
|
* The resolved, fix name of the workspace image. We only use this
|
|
409
683
|
* to access the logs during an image build.
|
|
410
684
|
*/
|
|
411
|
-
imageNameResolved?: string
|
|
685
|
+
imageNameResolved?: string;
|
|
412
686
|
|
|
413
687
|
/**
|
|
414
688
|
* The resolved/built fixed named of the base image. This field is only set if the workspace
|
|
415
689
|
* already has its base image built.
|
|
416
690
|
*/
|
|
417
|
-
baseImageNameResolved?: string
|
|
691
|
+
baseImageNameResolved?: string;
|
|
418
692
|
|
|
419
693
|
shareable?: boolean;
|
|
420
694
|
pinned?: boolean;
|
|
@@ -448,20 +722,19 @@ export interface Workspace {
|
|
|
448
722
|
|
|
449
723
|
export type WorkspaceSoftDeletion = "user" | "gc";
|
|
450
724
|
|
|
451
|
-
export type WorkspaceType = "regular" | "prebuild"
|
|
725
|
+
export type WorkspaceType = "regular" | "prebuild";
|
|
452
726
|
|
|
453
727
|
export namespace Workspace {
|
|
454
|
-
|
|
455
728
|
export function getFullRepositoryName(ws: Workspace): string | undefined {
|
|
456
729
|
if (CommitContext.is(ws.context)) {
|
|
457
|
-
return ws.context.repository.owner +
|
|
730
|
+
return ws.context.repository.owner + "/" + ws.context.repository.name;
|
|
458
731
|
}
|
|
459
732
|
return undefined;
|
|
460
733
|
}
|
|
461
734
|
|
|
462
735
|
export function getFullRepositoryUrl(ws: Workspace): string | undefined {
|
|
463
736
|
if (CommitContext.is(ws.context)) {
|
|
464
|
-
return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}
|
|
737
|
+
return `https://${ws.context.repository.host}/${getFullRepositoryName(ws)}`;
|
|
465
738
|
}
|
|
466
739
|
return undefined;
|
|
467
740
|
}
|
|
@@ -495,59 +768,58 @@ export namespace Workspace {
|
|
|
495
768
|
}
|
|
496
769
|
}
|
|
497
770
|
|
|
498
|
-
export interface PreparePluginUploadParams {
|
|
499
|
-
fullPluginName: string;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
export interface ResolvePluginsParams {
|
|
503
|
-
config?: WorkspaceConfig
|
|
504
|
-
builtins?: ResolvedPlugins
|
|
505
|
-
vsxRegistryUrl?: string
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
export interface InstallPluginsParams {
|
|
509
|
-
pluginIds: string[]
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
export interface UninstallPluginParams {
|
|
513
|
-
pluginId: string;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
771
|
export interface GuessGitTokenScopesParams {
|
|
517
|
-
host: string
|
|
518
|
-
repoUrl: string
|
|
519
|
-
|
|
520
|
-
currentToken: GitToken
|
|
772
|
+
host: string;
|
|
773
|
+
repoUrl: string;
|
|
774
|
+
gitCommand: string;
|
|
775
|
+
currentToken: GitToken;
|
|
521
776
|
}
|
|
522
777
|
|
|
523
778
|
export interface GitToken {
|
|
524
|
-
token: string
|
|
525
|
-
user: string
|
|
526
|
-
scopes: string[]
|
|
779
|
+
token: string;
|
|
780
|
+
user: string;
|
|
781
|
+
scopes: string[];
|
|
527
782
|
}
|
|
528
783
|
|
|
529
784
|
export interface GuessedGitTokenScopes {
|
|
530
|
-
message?: string
|
|
531
|
-
scopes?: string[]
|
|
785
|
+
message?: string;
|
|
786
|
+
scopes?: string[];
|
|
532
787
|
}
|
|
533
788
|
|
|
534
|
-
export
|
|
789
|
+
export interface VSCodeConfig {
|
|
790
|
+
extensions?: string[];
|
|
791
|
+
}
|
|
535
792
|
|
|
536
|
-
export interface
|
|
537
|
-
|
|
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";
|
|
538
807
|
}
|
|
539
808
|
|
|
540
|
-
export interface
|
|
541
|
-
fullPluginName: string;
|
|
809
|
+
export interface RepositoryCloneInformation {
|
|
542
810
|
url: string;
|
|
543
|
-
|
|
811
|
+
checkoutLocation?: string;
|
|
544
812
|
}
|
|
545
813
|
|
|
546
|
-
export interface
|
|
547
|
-
|
|
814
|
+
export interface CoreDumpConfig {
|
|
815
|
+
enabled?: boolean;
|
|
816
|
+
softLimit?: number;
|
|
817
|
+
hardLimit?: number;
|
|
548
818
|
}
|
|
549
819
|
|
|
550
820
|
export interface WorkspaceConfig {
|
|
821
|
+
mainConfiguration?: string;
|
|
822
|
+
additionalRepositories?: RepositoryCloneInformation[];
|
|
551
823
|
image?: ImageConfig;
|
|
552
824
|
ports?: PortConfig[];
|
|
553
825
|
tasks?: TaskConfig[];
|
|
@@ -556,6 +828,11 @@ export interface WorkspaceConfig {
|
|
|
556
828
|
gitConfig?: { [config: string]: string };
|
|
557
829
|
github?: GithubAppConfig;
|
|
558
830
|
vscode?: VSCodeConfig;
|
|
831
|
+
jetbrains?: JetBrainsConfig;
|
|
832
|
+
coreDump?: CoreDumpConfig;
|
|
833
|
+
|
|
834
|
+
/** deprecated. Enabled by default **/
|
|
835
|
+
experimentalNetwork?: boolean;
|
|
559
836
|
|
|
560
837
|
/**
|
|
561
838
|
* Where the config object originates from.
|
|
@@ -566,7 +843,7 @@ export interface WorkspaceConfig {
|
|
|
566
843
|
* additional-content - config comes from additional content, usually provided through the project's configuration
|
|
567
844
|
* default - our static catch-all default config
|
|
568
845
|
*/
|
|
569
|
-
_origin?:
|
|
846
|
+
_origin?: "repo" | "definitely-gp" | "derived" | "additional-content" | "default";
|
|
570
847
|
|
|
571
848
|
/**
|
|
572
849
|
* Set of automatically infered feature flags. That's not something the user can set, but
|
|
@@ -576,34 +853,33 @@ export interface WorkspaceConfig {
|
|
|
576
853
|
}
|
|
577
854
|
|
|
578
855
|
export interface GithubAppConfig {
|
|
579
|
-
prebuilds?: GithubAppPrebuildConfig
|
|
856
|
+
prebuilds?: GithubAppPrebuildConfig;
|
|
580
857
|
}
|
|
581
858
|
export interface GithubAppPrebuildConfig {
|
|
582
|
-
master?: boolean
|
|
583
|
-
branches?: boolean
|
|
584
|
-
pullRequests?: boolean
|
|
585
|
-
pullRequestsFromForks?: boolean
|
|
586
|
-
addCheck?: boolean
|
|
587
|
-
addBadge?: boolean
|
|
588
|
-
addLabel?: boolean | string
|
|
589
|
-
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;
|
|
590
867
|
}
|
|
591
868
|
export namespace GithubAppPrebuildConfig {
|
|
592
869
|
export function is(obj: boolean | GithubAppPrebuildConfig): obj is GithubAppPrebuildConfig {
|
|
593
|
-
return !(typeof obj ===
|
|
870
|
+
return !(typeof obj === "boolean");
|
|
594
871
|
}
|
|
595
872
|
}
|
|
596
873
|
|
|
597
874
|
export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
|
|
598
875
|
export interface WorkspaceImageSourceDocker {
|
|
599
|
-
dockerFilePath: string
|
|
600
|
-
dockerFileHash: string
|
|
601
|
-
dockerFileSource?: Commit
|
|
876
|
+
dockerFilePath: string;
|
|
877
|
+
dockerFileHash: string;
|
|
878
|
+
dockerFileSource?: Commit;
|
|
602
879
|
}
|
|
603
880
|
export namespace WorkspaceImageSourceDocker {
|
|
604
881
|
export function is(obj: object): obj is WorkspaceImageSourceDocker {
|
|
605
|
-
return
|
|
606
|
-
&& 'dockerFilePath' in obj;
|
|
882
|
+
return "dockerFileHash" in obj && "dockerFilePath" in obj;
|
|
607
883
|
}
|
|
608
884
|
}
|
|
609
885
|
export interface WorkspaceImageSourceReference {
|
|
@@ -612,21 +888,23 @@ export interface WorkspaceImageSourceReference {
|
|
|
612
888
|
}
|
|
613
889
|
export namespace WorkspaceImageSourceReference {
|
|
614
890
|
export function is(obj: object): obj is WorkspaceImageSourceReference {
|
|
615
|
-
return
|
|
891
|
+
return "baseImageResolved" in obj;
|
|
616
892
|
}
|
|
617
893
|
}
|
|
618
894
|
|
|
619
|
-
export type PrebuiltWorkspaceState
|
|
895
|
+
export type PrebuiltWorkspaceState =
|
|
620
896
|
// the prebuild is queued and may start at anytime
|
|
621
|
-
|
|
897
|
+
| "queued"
|
|
622
898
|
// the workspace prebuild is currently running (i.e. there's a workspace pod deployed)
|
|
623
899
|
| "building"
|
|
624
|
-
// the prebuild
|
|
900
|
+
// the prebuild was aborted
|
|
625
901
|
| "aborted"
|
|
626
902
|
// the prebuild timed out
|
|
627
903
|
| "timeout"
|
|
628
|
-
// the prebuild has finished and a snapshot is available
|
|
629
|
-
| "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";
|
|
630
908
|
|
|
631
909
|
export interface PrebuiltWorkspace {
|
|
632
910
|
id: string;
|
|
@@ -637,13 +915,16 @@ export interface PrebuiltWorkspace {
|
|
|
637
915
|
buildWorkspaceId: string;
|
|
638
916
|
creationTime: string;
|
|
639
917
|
state: PrebuiltWorkspaceState;
|
|
918
|
+
statusVersion: number;
|
|
640
919
|
error?: string;
|
|
641
920
|
snapshot?: string;
|
|
642
921
|
}
|
|
643
922
|
|
|
644
923
|
export namespace PrebuiltWorkspace {
|
|
645
924
|
export function isDone(pws: PrebuiltWorkspace) {
|
|
646
|
-
return
|
|
925
|
+
return (
|
|
926
|
+
pws.state === "available" || pws.state === "timeout" || pws.state === "aborted" || pws.state === "failed"
|
|
927
|
+
);
|
|
647
928
|
}
|
|
648
929
|
|
|
649
930
|
export function isAvailable(pws: PrebuiltWorkspace) {
|
|
@@ -662,27 +943,33 @@ export interface PrebuiltWorkspaceUpdatable {
|
|
|
662
943
|
repo: string;
|
|
663
944
|
isResolved: boolean;
|
|
664
945
|
installationId: string;
|
|
946
|
+
/**
|
|
947
|
+
* the commitSHA of the commit that triggered the prebuild
|
|
948
|
+
*/
|
|
949
|
+
commitSHA?: string;
|
|
665
950
|
issue?: string;
|
|
666
951
|
contextUrl?: string;
|
|
667
952
|
}
|
|
668
953
|
|
|
669
954
|
export interface WhitelistedRepository {
|
|
670
|
-
url: string
|
|
671
|
-
name: string
|
|
672
|
-
description?: string
|
|
673
|
-
avatar?: string
|
|
955
|
+
url: string;
|
|
956
|
+
name: string;
|
|
957
|
+
description?: string;
|
|
958
|
+
avatar?: string;
|
|
674
959
|
}
|
|
675
960
|
|
|
676
|
-
export type PortOnOpen =
|
|
961
|
+
export type PortOnOpen = "open-browser" | "open-preview" | "notify" | "ignore";
|
|
677
962
|
|
|
678
963
|
export interface PortConfig {
|
|
679
964
|
port: number;
|
|
680
965
|
onOpen?: PortOnOpen;
|
|
681
966
|
visibility?: PortVisibility;
|
|
967
|
+
description?: string;
|
|
968
|
+
name?: string;
|
|
682
969
|
}
|
|
683
970
|
export namespace PortConfig {
|
|
684
971
|
export function is(config: any): config is PortConfig {
|
|
685
|
-
return config &&
|
|
972
|
+
return config && "port" in config && typeof config.port === "number";
|
|
686
973
|
}
|
|
687
974
|
}
|
|
688
975
|
|
|
@@ -692,7 +979,7 @@ export interface PortRangeConfig {
|
|
|
692
979
|
}
|
|
693
980
|
export namespace PortRangeConfig {
|
|
694
981
|
export function is(config: any): config is PortRangeConfig {
|
|
695
|
-
return config &&
|
|
982
|
+
return config && "port" in config && (typeof config.port === "string" || config.port instanceof String);
|
|
696
983
|
}
|
|
697
984
|
}
|
|
698
985
|
|
|
@@ -702,33 +989,32 @@ export interface TaskConfig {
|
|
|
702
989
|
init?: string;
|
|
703
990
|
prebuild?: string;
|
|
704
991
|
command?: string;
|
|
705
|
-
env?: { [env: string]:
|
|
706
|
-
openIn?:
|
|
707
|
-
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";
|
|
708
995
|
}
|
|
709
996
|
|
|
710
997
|
export namespace TaskConfig {
|
|
711
998
|
export function is(config: any): config is TaskConfig {
|
|
712
|
-
return config
|
|
713
|
-
&& ('command' in config || 'init' in config || 'before' in config);
|
|
999
|
+
return config && ("command" in config || "init" in config || "before" in config);
|
|
714
1000
|
}
|
|
715
1001
|
}
|
|
716
1002
|
|
|
717
1003
|
export namespace WorkspaceImageBuild {
|
|
718
|
-
export type Phase =
|
|
1004
|
+
export type Phase = "BaseImage" | "GitpodLayer" | "Error" | "Done";
|
|
719
1005
|
export interface StateInfo {
|
|
720
|
-
phase: Phase
|
|
721
|
-
currentStep?: number
|
|
722
|
-
maxSteps?: number
|
|
1006
|
+
phase: Phase;
|
|
1007
|
+
currentStep?: number;
|
|
1008
|
+
maxSteps?: number;
|
|
723
1009
|
}
|
|
724
1010
|
export interface LogContent {
|
|
725
|
-
text: string
|
|
726
|
-
upToLine?: number
|
|
727
|
-
isDiff?: boolean
|
|
1011
|
+
text: string;
|
|
1012
|
+
upToLine?: number;
|
|
1013
|
+
isDiff?: boolean;
|
|
728
1014
|
}
|
|
729
1015
|
export type LogCallback = (info: StateInfo, content: LogContent | undefined) => void;
|
|
730
1016
|
export namespace LogLine {
|
|
731
|
-
export const DELIMITER =
|
|
1017
|
+
export const DELIMITER = "\r\n";
|
|
732
1018
|
export const DELIMITER_REGEX = /\r?\n/;
|
|
733
1019
|
}
|
|
734
1020
|
}
|
|
@@ -737,20 +1023,18 @@ export type ImageConfig = ImageConfigString | ImageConfigFile;
|
|
|
737
1023
|
export type ImageConfigString = string;
|
|
738
1024
|
export namespace ImageConfigString {
|
|
739
1025
|
export function is(config: ImageConfig | undefined): config is ImageConfigString {
|
|
740
|
-
return typeof config ===
|
|
1026
|
+
return typeof config === "string";
|
|
741
1027
|
}
|
|
742
|
-
|
|
743
1028
|
}
|
|
744
1029
|
export interface ImageConfigFile {
|
|
745
1030
|
// Path to the Dockerfile relative to repository root
|
|
746
|
-
file: string
|
|
1031
|
+
file: string;
|
|
747
1032
|
// Path to the docker build context relative to repository root
|
|
748
|
-
context?: string
|
|
1033
|
+
context?: string;
|
|
749
1034
|
}
|
|
750
1035
|
export namespace ImageConfigFile {
|
|
751
1036
|
export function is(config: ImageConfig | undefined): config is ImageConfigFile {
|
|
752
|
-
return typeof config ===
|
|
753
|
-
&& 'file' in config;
|
|
1037
|
+
return typeof config === "object" && "file" in config;
|
|
754
1038
|
}
|
|
755
1039
|
}
|
|
756
1040
|
export interface ExternalImageConfigFile extends ImageConfigFile {
|
|
@@ -758,14 +1042,14 @@ export interface ExternalImageConfigFile extends ImageConfigFile {
|
|
|
758
1042
|
}
|
|
759
1043
|
export namespace ExternalImageConfigFile {
|
|
760
1044
|
export function is(config: any | undefined): config is ExternalImageConfigFile {
|
|
761
|
-
return typeof config ===
|
|
762
|
-
&& 'file' in config
|
|
763
|
-
&& 'externalSource' in config;
|
|
1045
|
+
return typeof config === "object" && "file" in config && "externalSource" in config;
|
|
764
1046
|
}
|
|
765
1047
|
}
|
|
766
1048
|
|
|
767
1049
|
export interface WorkspaceContext {
|
|
768
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. */
|
|
769
1053
|
normalizedContextURL?: string;
|
|
770
1054
|
forceCreateNewWorkspace?: boolean;
|
|
771
1055
|
forceImageBuild?: boolean;
|
|
@@ -773,8 +1057,7 @@ export interface WorkspaceContext {
|
|
|
773
1057
|
|
|
774
1058
|
export namespace WorkspaceContext {
|
|
775
1059
|
export function is(context: any): context is WorkspaceContext {
|
|
776
|
-
return context
|
|
777
|
-
&& 'title' in context;
|
|
1060
|
+
return context && "title" in context;
|
|
778
1061
|
}
|
|
779
1062
|
}
|
|
780
1063
|
|
|
@@ -783,22 +1066,38 @@ export interface WithSnapshot {
|
|
|
783
1066
|
}
|
|
784
1067
|
export namespace WithSnapshot {
|
|
785
1068
|
export function is(context: any): context is WithSnapshot {
|
|
786
|
-
return context
|
|
787
|
-
&& 'snapshotBucketId' in context;
|
|
1069
|
+
return context && "snapshotBucketId" in context;
|
|
788
1070
|
}
|
|
789
1071
|
}
|
|
790
1072
|
|
|
791
|
-
export interface WithPrebuild {
|
|
792
|
-
snapshotBucketId: string;
|
|
1073
|
+
export interface WithPrebuild extends WithSnapshot {
|
|
793
1074
|
prebuildWorkspaceId: string;
|
|
794
1075
|
wasPrebuilt: true;
|
|
795
1076
|
}
|
|
796
1077
|
export namespace WithPrebuild {
|
|
797
1078
|
export function is(context: any): context is WithPrebuild {
|
|
798
|
-
return context
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
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
|
+
};
|
|
802
1101
|
}
|
|
803
1102
|
}
|
|
804
1103
|
|
|
@@ -808,23 +1107,24 @@ export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
|
|
|
808
1107
|
|
|
809
1108
|
export namespace SnapshotContext {
|
|
810
1109
|
export function is(context: any): context is SnapshotContext {
|
|
811
|
-
return context
|
|
812
|
-
&& WithSnapshot.is(context)
|
|
813
|
-
&& 'snapshotId' in context;
|
|
1110
|
+
return context && WithSnapshot.is(context) && "snapshotId" in context;
|
|
814
1111
|
}
|
|
815
1112
|
}
|
|
816
1113
|
|
|
817
1114
|
export interface StartPrebuildContext extends WorkspaceContext {
|
|
818
1115
|
actual: WorkspaceContext;
|
|
819
1116
|
commitHistory?: string[];
|
|
1117
|
+
additionalRepositoryCommitHistories?: {
|
|
1118
|
+
cloneUrl: string;
|
|
1119
|
+
commitHistory: string[];
|
|
1120
|
+
}[];
|
|
820
1121
|
project?: Project;
|
|
821
1122
|
branch?: string;
|
|
822
1123
|
}
|
|
823
1124
|
|
|
824
1125
|
export namespace StartPrebuildContext {
|
|
825
1126
|
export function is(context: any): context is StartPrebuildContext {
|
|
826
|
-
return context
|
|
827
|
-
&& 'actual' in context;
|
|
1127
|
+
return context && "actual" in context;
|
|
828
1128
|
}
|
|
829
1129
|
}
|
|
830
1130
|
|
|
@@ -836,33 +1136,28 @@ export interface PrebuiltWorkspaceContext extends WorkspaceContext {
|
|
|
836
1136
|
|
|
837
1137
|
export namespace PrebuiltWorkspaceContext {
|
|
838
1138
|
export function is(context: any): context is PrebuiltWorkspaceContext {
|
|
839
|
-
return context
|
|
840
|
-
&& 'originalContext' in context
|
|
841
|
-
&& 'prebuiltWorkspace' in context;
|
|
1139
|
+
return context && "originalContext" in context && "prebuiltWorkspace" in context;
|
|
842
1140
|
}
|
|
843
1141
|
}
|
|
844
1142
|
|
|
845
|
-
export interface
|
|
846
|
-
|
|
1143
|
+
export interface WithReferrerContext extends WorkspaceContext {
|
|
1144
|
+
referrer: string;
|
|
1145
|
+
referrerIde?: string;
|
|
847
1146
|
}
|
|
848
1147
|
|
|
849
|
-
export namespace
|
|
850
|
-
export function is(context: any): context is
|
|
851
|
-
return context
|
|
852
|
-
&& 'envvars' in context
|
|
1148
|
+
export namespace WithReferrerContext {
|
|
1149
|
+
export function is(context: any): context is WithReferrerContext {
|
|
1150
|
+
return context && "referrer" in context;
|
|
853
1151
|
}
|
|
854
1152
|
}
|
|
855
1153
|
|
|
856
|
-
export interface
|
|
857
|
-
|
|
858
|
-
responseToken: string
|
|
1154
|
+
export interface WithEnvvarsContext extends WorkspaceContext {
|
|
1155
|
+
envvars: EnvVarWithValue[];
|
|
859
1156
|
}
|
|
860
1157
|
|
|
861
|
-
export namespace
|
|
862
|
-
export function is(context: any): context is
|
|
863
|
-
return context
|
|
864
|
-
&& 'responseURL' in context
|
|
865
|
-
&& 'responseToken' in context;
|
|
1158
|
+
export namespace WithEnvvarsContext {
|
|
1159
|
+
export function is(context: any): context is WithEnvvarsContext {
|
|
1160
|
+
return context && "envvars" in context;
|
|
866
1161
|
}
|
|
867
1162
|
}
|
|
868
1163
|
|
|
@@ -874,32 +1169,30 @@ export namespace RefType {
|
|
|
874
1169
|
}
|
|
875
1170
|
// This fallback is meant to handle the cases where (for historic reasons) ref is present but refType is missing
|
|
876
1171
|
return commit.refType || "branch";
|
|
877
|
-
}
|
|
1172
|
+
};
|
|
878
1173
|
}
|
|
879
1174
|
|
|
880
1175
|
export interface Commit {
|
|
881
|
-
repository: Repository
|
|
882
|
-
revision: string
|
|
1176
|
+
repository: Repository;
|
|
1177
|
+
revision: string;
|
|
883
1178
|
|
|
884
1179
|
// Might contain either a branch or a tag (determined by refType)
|
|
885
|
-
ref?: string
|
|
1180
|
+
ref?: string;
|
|
886
1181
|
|
|
887
1182
|
// refType is only set if ref is present (and not for old workspaces, before this feature was added)
|
|
888
|
-
refType?: RefType
|
|
1183
|
+
refType?: RefType;
|
|
889
1184
|
}
|
|
890
1185
|
|
|
891
|
-
export interface AdditionalContentContext {
|
|
892
|
-
|
|
1186
|
+
export interface AdditionalContentContext extends WorkspaceContext {
|
|
893
1187
|
/**
|
|
894
1188
|
* utf-8 encoded contents that will be copied on top of the workspace's filesystem
|
|
895
1189
|
*/
|
|
896
|
-
additionalFiles: {[filePath: string]: string};
|
|
897
|
-
|
|
1190
|
+
additionalFiles: { [filePath: string]: string };
|
|
898
1191
|
}
|
|
899
1192
|
|
|
900
1193
|
export namespace AdditionalContentContext {
|
|
901
1194
|
export function is(ctx: any): ctx is AdditionalContentContext {
|
|
902
|
-
return
|
|
1195
|
+
return "additionalFiles" in ctx;
|
|
903
1196
|
}
|
|
904
1197
|
|
|
905
1198
|
export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
|
|
@@ -907,16 +1200,59 @@ export namespace AdditionalContentContext {
|
|
|
907
1200
|
}
|
|
908
1201
|
}
|
|
909
1202
|
|
|
910
|
-
export interface
|
|
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 {
|
|
911
1214
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
912
|
-
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;
|
|
913
1251
|
}
|
|
914
1252
|
|
|
915
1253
|
export namespace CommitContext {
|
|
916
1254
|
export function is(commit: any): commit is CommitContext {
|
|
917
|
-
return WorkspaceContext.is(commit)
|
|
918
|
-
&& 'repository' in commit
|
|
919
|
-
&& 'revision' in commit
|
|
1255
|
+
return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
|
|
920
1256
|
}
|
|
921
1257
|
}
|
|
922
1258
|
|
|
@@ -924,17 +1260,14 @@ export interface PullRequestContext extends CommitContext {
|
|
|
924
1260
|
nr: number;
|
|
925
1261
|
ref: string;
|
|
926
1262
|
base: {
|
|
927
|
-
repository: Repository
|
|
928
|
-
ref: string
|
|
929
|
-
}
|
|
1263
|
+
repository: Repository;
|
|
1264
|
+
ref: string;
|
|
1265
|
+
};
|
|
930
1266
|
}
|
|
931
1267
|
|
|
932
1268
|
export namespace PullRequestContext {
|
|
933
1269
|
export function is(ctx: any): ctx is PullRequestContext {
|
|
934
|
-
return CommitContext.is(ctx)
|
|
935
|
-
&& 'nr' in ctx
|
|
936
|
-
&& 'ref' in ctx
|
|
937
|
-
&& 'base' in ctx
|
|
1270
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
|
|
938
1271
|
}
|
|
939
1272
|
}
|
|
940
1273
|
|
|
@@ -946,10 +1279,7 @@ export interface IssueContext extends CommitContext {
|
|
|
946
1279
|
|
|
947
1280
|
export namespace IssueContext {
|
|
948
1281
|
export function is(ctx: any): ctx is IssueContext {
|
|
949
|
-
return CommitContext.is(ctx)
|
|
950
|
-
&& 'nr' in ctx
|
|
951
|
-
&& 'ref' in ctx
|
|
952
|
-
&& 'localBranch' in ctx
|
|
1282
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
|
|
953
1283
|
}
|
|
954
1284
|
}
|
|
955
1285
|
|
|
@@ -960,9 +1290,7 @@ export interface NavigatorContext extends CommitContext {
|
|
|
960
1290
|
|
|
961
1291
|
export namespace NavigatorContext {
|
|
962
1292
|
export function is(ctx: any): ctx is NavigatorContext {
|
|
963
|
-
return CommitContext.is(ctx)
|
|
964
|
-
&& 'path' in ctx
|
|
965
|
-
&& 'isFile' in ctx
|
|
1293
|
+
return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
|
|
966
1294
|
}
|
|
967
1295
|
}
|
|
968
1296
|
|
|
@@ -971,6 +1299,8 @@ export interface Repository {
|
|
|
971
1299
|
owner: string;
|
|
972
1300
|
name: string;
|
|
973
1301
|
cloneUrl: string;
|
|
1302
|
+
/* Optional kind to differentiate between repositories of orgs/groups/projects and personal repos. */
|
|
1303
|
+
repoKind?: string;
|
|
974
1304
|
description?: string;
|
|
975
1305
|
avatarUrl?: string;
|
|
976
1306
|
webUrl?: string;
|
|
@@ -979,8 +1309,21 @@ export interface Repository {
|
|
|
979
1309
|
private?: boolean;
|
|
980
1310
|
fork?: {
|
|
981
1311
|
// The direct parent of this fork
|
|
982
|
-
parent: Repository
|
|
983
|
-
}
|
|
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;
|
|
984
1327
|
}
|
|
985
1328
|
|
|
986
1329
|
export namespace Repository {
|
|
@@ -992,21 +1335,19 @@ export namespace Repository {
|
|
|
992
1335
|
export interface WorkspaceInstancePortsChangedEvent {
|
|
993
1336
|
type: "PortsChanged";
|
|
994
1337
|
instanceID: string;
|
|
995
|
-
portsOpened: number[]
|
|
996
|
-
portsClosed: number[]
|
|
1338
|
+
portsOpened: number[];
|
|
1339
|
+
portsClosed: number[];
|
|
997
1340
|
}
|
|
998
1341
|
|
|
999
1342
|
export namespace WorkspaceInstancePortsChangedEvent {
|
|
1000
|
-
|
|
1001
1343
|
export function is(data: any): data is WorkspaceInstancePortsChangedEvent {
|
|
1002
1344
|
return data && data.type == "PortsChanged";
|
|
1003
1345
|
}
|
|
1004
|
-
|
|
1005
1346
|
}
|
|
1006
1347
|
|
|
1007
1348
|
export interface WorkspaceInfo {
|
|
1008
|
-
workspace: Workspace
|
|
1009
|
-
latestInstance?: WorkspaceInstance
|
|
1349
|
+
workspace: Workspace;
|
|
1350
|
+
latestInstance?: WorkspaceInstance;
|
|
1010
1351
|
}
|
|
1011
1352
|
|
|
1012
1353
|
export namespace WorkspaceInfo {
|
|
@@ -1022,35 +1363,36 @@ export interface WorkspaceCreationResult {
|
|
|
1022
1363
|
workspaceURL?: string;
|
|
1023
1364
|
existingWorkspaces?: WorkspaceInfo[];
|
|
1024
1365
|
runningWorkspacePrebuild?: {
|
|
1025
|
-
prebuildID: string
|
|
1026
|
-
workspaceID: string
|
|
1027
|
-
instanceID: string
|
|
1028
|
-
starting: RunningWorkspacePrebuildStarting
|
|
1029
|
-
sameCluster: boolean
|
|
1030
|
-
}
|
|
1366
|
+
prebuildID: string;
|
|
1367
|
+
workspaceID: string;
|
|
1368
|
+
instanceID: string;
|
|
1369
|
+
starting: RunningWorkspacePrebuildStarting;
|
|
1370
|
+
sameCluster: boolean;
|
|
1371
|
+
};
|
|
1031
1372
|
runningPrebuildWorkspaceID?: string;
|
|
1032
1373
|
}
|
|
1033
|
-
export type RunningWorkspacePrebuildStarting =
|
|
1374
|
+
export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
|
|
1034
1375
|
|
|
1035
1376
|
export enum CreateWorkspaceMode {
|
|
1036
1377
|
// Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
|
|
1037
|
-
Default =
|
|
1378
|
+
Default = "default",
|
|
1038
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.
|
|
1039
|
-
ForceNew =
|
|
1380
|
+
ForceNew = "force-new",
|
|
1040
1381
|
// UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
|
|
1041
|
-
UsePrebuild =
|
|
1382
|
+
UsePrebuild = "use-prebuild",
|
|
1042
1383
|
// SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
|
|
1043
|
-
SelectIfRunning =
|
|
1384
|
+
SelectIfRunning = "select-if-running",
|
|
1044
1385
|
}
|
|
1045
1386
|
|
|
1046
1387
|
export namespace WorkspaceCreationResult {
|
|
1047
1388
|
export function is(data: any): data is WorkspaceCreationResult {
|
|
1048
|
-
return
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1389
|
+
return (
|
|
1390
|
+
data &&
|
|
1391
|
+
("createdWorkspaceId" in data ||
|
|
1392
|
+
"existingWorkspaces" in data ||
|
|
1393
|
+
"runningWorkspacePrebuild" in data ||
|
|
1394
|
+
"runningPrebuildWorkspaceID" in data)
|
|
1395
|
+
);
|
|
1054
1396
|
}
|
|
1055
1397
|
}
|
|
1056
1398
|
|
|
@@ -1084,7 +1426,7 @@ export interface AuthProviderInfo {
|
|
|
1084
1426
|
readonly default: string[];
|
|
1085
1427
|
readonly publicRepo: string[];
|
|
1086
1428
|
readonly privateRepo: string[];
|
|
1087
|
-
}
|
|
1429
|
+
};
|
|
1088
1430
|
}
|
|
1089
1431
|
|
|
1090
1432
|
export interface AuthProviderEntry {
|
|
@@ -1096,6 +1438,8 @@ export interface AuthProviderEntry {
|
|
|
1096
1438
|
readonly status: AuthProviderEntry.Status;
|
|
1097
1439
|
|
|
1098
1440
|
readonly oauth: OAuth2Config;
|
|
1441
|
+
/** A random string that is to change whenever oauth changes (enforced on DB level) */
|
|
1442
|
+
readonly oauthRevision?: string;
|
|
1099
1443
|
}
|
|
1100
1444
|
|
|
1101
1445
|
export interface OAuth2Config {
|
|
@@ -1108,56 +1452,27 @@ export interface OAuth2Config {
|
|
|
1108
1452
|
readonly scopeSeparator?: string;
|
|
1109
1453
|
|
|
1110
1454
|
readonly settingsUrl?: string;
|
|
1111
|
-
readonly authorizationParams?: { [key: string]: string }
|
|
1455
|
+
readonly authorizationParams?: { [key: string]: string };
|
|
1112
1456
|
readonly configURL?: string;
|
|
1113
1457
|
}
|
|
1114
1458
|
|
|
1115
1459
|
export namespace AuthProviderEntry {
|
|
1116
1460
|
export type Type = "GitHub" | "GitLab" | string;
|
|
1117
1461
|
export type Status = "pending" | "verified";
|
|
1118
|
-
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & {
|
|
1119
|
-
|
|
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">;
|
|
1120
1468
|
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
|
|
1121
1469
|
return {
|
|
1122
1470
|
...entry,
|
|
1123
1471
|
oauth: {
|
|
1124
1472
|
...entry.oauth,
|
|
1125
|
-
clientSecret: "redacted"
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
export interface Branding {
|
|
1132
|
-
readonly name: string;
|
|
1133
|
-
readonly favicon?: string;
|
|
1134
|
-
/** Either including domain OR absolute path (interpreted relative to host URL) */
|
|
1135
|
-
readonly logo: string;
|
|
1136
|
-
readonly startupLogo: string;
|
|
1137
|
-
readonly showProductivityTips: boolean;
|
|
1138
|
-
readonly redirectUrlIfNotAuthenticated?: string;
|
|
1139
|
-
readonly redirectUrlAfterLogout?: string;
|
|
1140
|
-
readonly homepage: string;
|
|
1141
|
-
readonly ide?: {
|
|
1142
|
-
readonly logo: string;
|
|
1143
|
-
readonly showReleaseNotes: boolean;
|
|
1144
|
-
readonly helpMenu: Branding.Link[];
|
|
1145
|
-
}
|
|
1146
|
-
readonly links: {
|
|
1147
|
-
readonly header: Branding.Link[];
|
|
1148
|
-
readonly footer: Branding.Link[];
|
|
1149
|
-
readonly social: Branding.SocialLink[];
|
|
1150
|
-
readonly legal: Branding.Link[];
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
export namespace Branding {
|
|
1154
|
-
export interface Link {
|
|
1155
|
-
readonly name: string;
|
|
1156
|
-
readonly url: string;
|
|
1157
|
-
}
|
|
1158
|
-
export interface SocialLink {
|
|
1159
|
-
readonly type: string;
|
|
1160
|
-
readonly url: string;
|
|
1473
|
+
clientSecret: "redacted",
|
|
1474
|
+
},
|
|
1475
|
+
};
|
|
1161
1476
|
}
|
|
1162
1477
|
}
|
|
1163
1478
|
|
|
@@ -1202,60 +1517,17 @@ export interface Terms {
|
|
|
1202
1517
|
readonly formElements?: object;
|
|
1203
1518
|
}
|
|
1204
1519
|
|
|
1205
|
-
export interface
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
cloneUrl: string;
|
|
1209
|
-
teamId: string;
|
|
1210
|
-
appInstallationId: string;
|
|
1211
|
-
creationTime: string;
|
|
1212
|
-
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
1213
|
-
deleted?: boolean;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
export interface ProjectInfo extends Project {
|
|
1217
|
-
lastPrebuild?: PrebuildInfo;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
export interface PrebuildInfo {
|
|
1221
|
-
id: string;
|
|
1222
|
-
teamId: string;
|
|
1223
|
-
project: string;
|
|
1224
|
-
cloneUrl: string;
|
|
1225
|
-
branch: string;
|
|
1226
|
-
startedAt: string;
|
|
1227
|
-
startedBy: string;
|
|
1228
|
-
status: PrebuiltWorkspaceState;
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
export interface Team {
|
|
1232
|
-
id: string;
|
|
1233
|
-
name: string;
|
|
1234
|
-
slug: string;
|
|
1235
|
-
creationTime: string;
|
|
1236
|
-
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
1237
|
-
deleted?: boolean;
|
|
1520
|
+
export interface StripeConfig {
|
|
1521
|
+
individualUsagePriceIds: { [currency: string]: string };
|
|
1522
|
+
teamUsagePriceIds: { [currency: string]: string };
|
|
1238
1523
|
}
|
|
1239
1524
|
|
|
1240
|
-
export type
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
memberSince: string;
|
|
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;
|
|
1249
1533
|
}
|
|
1250
|
-
|
|
1251
|
-
export interface TeamMembershipInvite {
|
|
1252
|
-
id: string;
|
|
1253
|
-
teamId: string;
|
|
1254
|
-
role: TeamMemberRole;
|
|
1255
|
-
creationTime: string;
|
|
1256
|
-
invalidationTime: string;
|
|
1257
|
-
invitedEmail?: string;
|
|
1258
|
-
|
|
1259
|
-
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
1260
|
-
deleted?: boolean;
|
|
1261
|
-
}
|