@gitpod/gitpod-protocol 0.1.5-ps-commit-email-fork.0 → 0.1.5-release-2022.6.1.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 +206 -28
- package/lib/accounting-protocol.d.ts +17 -13
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +39 -47
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +21 -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 +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/auth.d.ts.map +1 -1
- 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/{util/context-url.spec.d.ts → context-url.spec.d.ts} +4 -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/email-protocol.d.ts +1 -2
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js +4 -4
- package/lib/email-protocol.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 +8 -0
- package/lib/experiments/configcat-server.d.ts.map +1 -0
- package/lib/experiments/configcat-server.js +34 -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 +47 -0
- package/lib/experiments/configcat.js.map +1 -0
- package/lib/experiments/types.d.ts +19 -0
- package/lib/experiments/types.d.ts.map +1 -0
- package/lib/{util/without.js → experiments/types.js} +2 -2
- 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 +140 -38
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +181 -317
- 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 +1 -1
- package/lib/ide-protocol.d.ts +105 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/ide-protocol.js +8 -0
- 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 +6 -0
- 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 +35 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +83 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/error.d.ts +5 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +10 -2
- 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 +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 +4 -4
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +225 -209
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +172 -85
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +230 -187
- package/lib/protocol.js.map +1 -1
- 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/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
- 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 +31 -17
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +118 -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/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 +27 -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 +1 -2
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +108 -109
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +6 -0
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +112 -30
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +15 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +18 -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 +125 -129
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +5 -5
- package/lib/util/make-link.js.map +1 -1
- 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 +1 -0
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +23 -17
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +21 -24
- 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/workspace-cluster.d.ts +24 -3
- 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 +42 -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/lib/wsready.js.map +1 -1
- package/package.json +35 -18
- package/pkg-yarn.lock +20 -10
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +63 -57
- package/src/admin-protocol.ts +43 -21
- package/src/analytics.ts +52 -0
- package/src/auth.ts +2 -2
- package/src/context-url.spec.ts +67 -0
- package/src/context-url.ts +109 -0
- package/src/email-protocol.ts +5 -7
- package/src/encryption/container-module.ts +2 -3
- package/src/encryption/encryption-engine.spec.ts +9 -8
- package/src/encryption/encryption-engine.ts +14 -14
- 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 +37 -0
- package/src/experiments/configcat.ts +53 -0
- package/src/experiments/types.ts +32 -0
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +278 -127
- package/src/headless-workspace-log.ts +12 -14
- package/src/ide-frontend-service.ts +2 -2
- package/src/ide-protocol.ts +119 -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 +185 -21
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +96 -0
- package/src/messaging/error.ts +15 -5
- 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 +42 -33
- package/src/plans.ts +236 -189
- package/src/protocol.ts +454 -276
- 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 +153 -0
- package/src/typings/globals.ts +4 -4
- 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 +9 -6
- 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 +58 -7
- package/src/util/gitpod-host-url.ts +52 -40
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +145 -72
- package/src/util/make-link.ts +6 -7
- 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 +14 -15
- package/src/util/timeutil.ts +21 -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/workspace-cluster.ts +34 -7
- package/src/workspace-instance.ts +91 -31
- package/src/wsready.ts +3 -3
- package/data/builtin-theia-plugins.json +0 -372
- 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.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/messaging/connection-error-handler.ts +0 -62
- package/src/theia-plugins.ts +0 -11
- 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/gitpod-service.ts
CHANGED
|
@@ -5,30 +5,64 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
User,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
User,
|
|
9
|
+
WorkspaceInfo,
|
|
10
|
+
WorkspaceCreationResult,
|
|
11
|
+
WorkspaceInstanceUser,
|
|
12
|
+
WhitelistedRepository,
|
|
13
|
+
WorkspaceImageBuild,
|
|
14
|
+
AuthProviderInfo,
|
|
15
|
+
CreateWorkspaceMode,
|
|
16
|
+
Token,
|
|
17
|
+
UserEnvVarValue,
|
|
18
|
+
Terms,
|
|
19
|
+
Configuration,
|
|
20
|
+
UserInfo,
|
|
21
|
+
GitpodTokenType,
|
|
22
|
+
GitpodToken,
|
|
23
|
+
AuthProviderEntry,
|
|
24
|
+
GuessGitTokenScopesParams,
|
|
25
|
+
GuessedGitTokenScopes,
|
|
26
|
+
ProjectEnvVar,
|
|
27
|
+
} from "./protocol";
|
|
28
|
+
import {
|
|
29
|
+
Team,
|
|
30
|
+
TeamMemberInfo,
|
|
31
|
+
TeamMembershipInvite,
|
|
32
|
+
Project,
|
|
33
|
+
TeamMemberRole,
|
|
34
|
+
PrebuildWithStatus,
|
|
35
|
+
StartPrebuildResult,
|
|
36
|
+
PartialProject,
|
|
37
|
+
} from "./teams-projects-protocol";
|
|
38
|
+
import { JsonRpcProxy, JsonRpcServer } from "./messaging/proxy-factory";
|
|
39
|
+
import { Disposable, CancellationTokenSource } from "vscode-jsonrpc";
|
|
40
|
+
import { HeadlessLogUrls } from "./headless-workspace-log";
|
|
41
|
+
import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from "./workspace-instance";
|
|
42
|
+
import { AdminServer } from "./admin-protocol";
|
|
43
|
+
import { GitpodHostUrl } from "./util/gitpod-host-url";
|
|
44
|
+
import { WebSocketConnectionProvider } from "./messaging/browser/connection";
|
|
45
|
+
import { PermissionName } from "./permission";
|
|
46
|
+
import { LicenseService } from "./license-protocol";
|
|
47
|
+
import { Emitter } from "./util/event";
|
|
48
|
+
import { AccountStatement, CreditAlert } from "./accounting-protocol";
|
|
49
|
+
import { GithubUpgradeURL, PlanCoupon } from "./payment-protocol";
|
|
50
|
+
import {
|
|
51
|
+
TeamSubscription,
|
|
52
|
+
TeamSubscription2,
|
|
53
|
+
TeamSubscriptionSlot,
|
|
54
|
+
TeamSubscriptionSlotResolved,
|
|
55
|
+
} from "./team-subscription-protocol";
|
|
56
|
+
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
|
|
57
|
+
import { IDEServer } from "./ide-protocol";
|
|
58
|
+
import { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
|
|
59
|
+
import { Currency } from "./plans";
|
|
27
60
|
|
|
28
61
|
export interface GitpodClient {
|
|
29
62
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
30
63
|
onWorkspaceImageBuildLogs: WorkspaceImageBuild.LogCallback;
|
|
31
|
-
|
|
64
|
+
|
|
65
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void;
|
|
32
66
|
|
|
33
67
|
onCreditAlert(creditAlert: CreditAlert): void;
|
|
34
68
|
|
|
@@ -38,8 +72,8 @@ export interface GitpodClient {
|
|
|
38
72
|
//#endregion
|
|
39
73
|
}
|
|
40
74
|
|
|
41
|
-
export const GitpodServer = Symbol(
|
|
42
|
-
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
|
|
75
|
+
export const GitpodServer = Symbol("GitpodServer");
|
|
76
|
+
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
43
77
|
// User related API
|
|
44
78
|
getLoggedInUser(): Promise<User>;
|
|
45
79
|
getTerms(): Promise<Terms>;
|
|
@@ -48,9 +82,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
48
82
|
getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
|
|
49
83
|
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
|
|
50
84
|
deleteOwnAuthProvider(params: GitpodServer.DeleteOwnAuthProviderParams): Promise<void>;
|
|
51
|
-
getBranding(): Promise<Branding>;
|
|
52
85
|
getConfiguration(): Promise<Configuration>;
|
|
53
86
|
getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
|
|
87
|
+
getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
|
|
54
88
|
/**
|
|
55
89
|
* @deprecated
|
|
56
90
|
*/
|
|
@@ -64,8 +98,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
64
98
|
getWorkspaceOwner(workspaceId: string): Promise<UserInfo | undefined>;
|
|
65
99
|
getWorkspaceUsers(workspaceId: string): Promise<WorkspaceInstanceUser[]>;
|
|
66
100
|
getFeaturedRepositories(): Promise<WhitelistedRepository[]>;
|
|
101
|
+
getSuggestedContextURLs(): Promise<string[]>;
|
|
102
|
+
/**
|
|
103
|
+
* **Security:**
|
|
104
|
+
* Sensitive information like an owner token is erased, since it allows access for all team members.
|
|
105
|
+
* If you need to access an owner token use `getOwnerToken` instead.
|
|
106
|
+
*/
|
|
67
107
|
getWorkspace(id: string): Promise<WorkspaceInfo>;
|
|
68
108
|
isWorkspaceOwner(workspaceId: string): Promise<boolean>;
|
|
109
|
+
getOwnerToken(workspaceId: string): Promise<string>;
|
|
69
110
|
|
|
70
111
|
/**
|
|
71
112
|
* Creates and starts a workspace for the given context URL.
|
|
@@ -82,8 +123,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
82
123
|
updateWorkspaceUserPin(id: string, action: GitpodServer.PinAction): Promise<void>;
|
|
83
124
|
sendHeartBeat(options: GitpodServer.SendHeartBeatOptions): Promise<void>;
|
|
84
125
|
watchWorkspaceImageBuildLogs(workspaceId: string): Promise<void>;
|
|
85
|
-
watchHeadlessWorkspaceLogs(workspaceId: string): Promise<void>;
|
|
86
126
|
isPrebuildDone(pwsid: string): Promise<boolean>;
|
|
127
|
+
getHeadlessLog(instanceId: string): Promise<HeadlessLogUrls>;
|
|
87
128
|
|
|
88
129
|
// Workspace timeout
|
|
89
130
|
setWorkspaceTimeout(workspaceId: string, duration: WorkspaceTimeoutDuration): Promise<SetWorkspaceTimeoutResult>;
|
|
@@ -97,23 +138,55 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
97
138
|
openPort(workspaceId: string, port: WorkspaceInstancePort): Promise<WorkspaceInstancePort | undefined>;
|
|
98
139
|
closePort(workspaceId: string, port: number): Promise<void>;
|
|
99
140
|
|
|
100
|
-
// User messages
|
|
101
|
-
getUserMessages(options: GitpodServer.GetUserMessagesOptions): Promise<UserMessage[]>;
|
|
102
|
-
updateUserMessages(options: GitpodServer.UpdateUserMessagesOptions): Promise<void>;
|
|
103
|
-
|
|
104
141
|
// User storage
|
|
105
142
|
getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
|
|
106
143
|
updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
|
|
107
144
|
|
|
108
|
-
//
|
|
145
|
+
// User env vars
|
|
109
146
|
getEnvVars(): Promise<UserEnvVarValue[]>;
|
|
110
147
|
getAllEnvVars(): Promise<UserEnvVarValue[]>;
|
|
111
148
|
setEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
112
149
|
deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
113
150
|
|
|
151
|
+
// Teams
|
|
152
|
+
getTeams(): Promise<Team[]>;
|
|
153
|
+
getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
|
|
154
|
+
createTeam(name: string): Promise<Team>;
|
|
155
|
+
joinTeam(inviteId: string): Promise<Team>;
|
|
156
|
+
setTeamMemberRole(teamId: string, userId: string, role: TeamMemberRole): Promise<void>;
|
|
157
|
+
removeTeamMember(teamId: string, userId: string): Promise<void>;
|
|
158
|
+
getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
|
|
159
|
+
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
160
|
+
deleteTeam(teamId: string, userId: string): Promise<void>;
|
|
161
|
+
|
|
162
|
+
// Admin Settings
|
|
163
|
+
adminGetSettings(): Promise<InstallationAdminSettings>;
|
|
164
|
+
adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
|
|
165
|
+
adminGetTelemetryData(): Promise<TelemetryData>;
|
|
166
|
+
|
|
167
|
+
// Projects
|
|
168
|
+
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
169
|
+
createProject(params: CreateProjectParams): Promise<Project>;
|
|
170
|
+
deleteProject(projectId: string): Promise<void>;
|
|
171
|
+
getTeamProjects(teamId: string): Promise<Project[]>;
|
|
172
|
+
getUserProjects(): Promise<Project[]>;
|
|
173
|
+
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
174
|
+
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
175
|
+
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
176
|
+
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
177
|
+
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
178
|
+
guessProjectConfiguration(projectId: string): Promise<string | undefined>;
|
|
179
|
+
fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
180
|
+
guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
181
|
+
setProjectConfiguration(projectId: string, configString: string): Promise<void>;
|
|
182
|
+
updateProjectPartial(partialProject: PartialProject): Promise<void>;
|
|
183
|
+
setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
|
|
184
|
+
getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
|
|
185
|
+
deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
|
|
186
|
+
|
|
114
187
|
// content service
|
|
115
|
-
getContentBlobUploadUrl(name: string): Promise<string
|
|
116
|
-
getContentBlobDownloadUrl(name: string): Promise<string
|
|
188
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
189
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
117
190
|
|
|
118
191
|
// Gitpod token
|
|
119
192
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
@@ -122,13 +195,19 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
122
195
|
|
|
123
196
|
// misc
|
|
124
197
|
sendFeedback(feedback: string): Promise<string | undefined>;
|
|
198
|
+
isGitHubAppEnabled(): Promise<boolean>;
|
|
125
199
|
registerGithubApp(installationId: string): Promise<void>;
|
|
126
200
|
|
|
127
201
|
/**
|
|
128
|
-
* Stores a new snapshot for the given workspace and bucketId
|
|
202
|
+
* Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
|
|
129
203
|
* @return the snapshot id
|
|
130
204
|
*/
|
|
131
205
|
takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
|
|
206
|
+
/**
|
|
207
|
+
*
|
|
208
|
+
* @param snapshotId
|
|
209
|
+
*/
|
|
210
|
+
waitForSnapshot(snapshotId: string): Promise<void>;
|
|
132
211
|
|
|
133
212
|
/**
|
|
134
213
|
* Returns the list of snapshots that exist for a workspace.
|
|
@@ -145,23 +224,12 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
145
224
|
*/
|
|
146
225
|
getLayout(workspaceId: string): Promise<string | undefined>;
|
|
147
226
|
|
|
148
|
-
/**
|
|
149
|
-
* @param params
|
|
150
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
151
|
-
*/
|
|
152
|
-
preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
|
|
153
|
-
resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
|
|
154
|
-
installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
|
|
155
|
-
uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
|
|
156
|
-
|
|
157
227
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
158
228
|
|
|
159
229
|
/**
|
|
160
230
|
* gitpod.io concerns
|
|
161
231
|
*/
|
|
162
232
|
isStudent(): Promise<boolean>;
|
|
163
|
-
getPrivateRepoTrialEndDate(): Promise<string | undefined>;
|
|
164
|
-
|
|
165
233
|
/**
|
|
166
234
|
*
|
|
167
235
|
*/
|
|
@@ -173,67 +241,152 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
173
241
|
*/
|
|
174
242
|
getChargebeeSiteId(): Promise<string>;
|
|
175
243
|
createPortalSession(): Promise<{}>;
|
|
244
|
+
createTeamPortalSession(teamId: string): Promise<{}>;
|
|
176
245
|
checkout(planId: string, planQuantity?: number): Promise<{}>;
|
|
246
|
+
teamCheckout(teamId: string, planId: string): Promise<{}>;
|
|
177
247
|
getAvailableCoupons(): Promise<PlanCoupon[]>;
|
|
178
248
|
getAppliedCoupons(): Promise<PlanCoupon[]>;
|
|
179
249
|
|
|
180
250
|
getShowPaymentUI(): Promise<boolean>;
|
|
181
251
|
isChargebeeCustomer(): Promise<boolean>;
|
|
182
|
-
mayAccessPrivateRepo(): Promise<boolean>;
|
|
183
252
|
|
|
184
253
|
subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
185
254
|
subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
186
255
|
subscriptionCancel(subscriptionId: string): Promise<void>;
|
|
187
256
|
subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
|
|
188
257
|
|
|
258
|
+
getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
|
|
189
259
|
tsGet(): Promise<TeamSubscription[]>;
|
|
190
260
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
191
|
-
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined
|
|
261
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
192
262
|
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
193
|
-
tsAssignSlot(
|
|
263
|
+
tsAssignSlot(
|
|
264
|
+
teamSubscriptionId: string,
|
|
265
|
+
teamSubscriptionSlotId: string,
|
|
266
|
+
identityStr: string | undefined,
|
|
267
|
+
): Promise<void>;
|
|
194
268
|
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
195
269
|
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
196
270
|
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
197
271
|
|
|
198
272
|
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
199
273
|
|
|
274
|
+
getStripePublishableKey(): Promise<string>;
|
|
275
|
+
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
276
|
+
findStripeSubscriptionIdForTeam(teamId: string): Promise<string | undefined>;
|
|
277
|
+
subscribeTeamToStripe(teamId: string, setupIntentId: string, currency: Currency): Promise<void>;
|
|
278
|
+
getStripePortalUrlForTeam(teamId: string): Promise<string>;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Analytics
|
|
282
|
+
*/
|
|
283
|
+
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
284
|
+
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
285
|
+
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
200
286
|
}
|
|
201
287
|
|
|
202
|
-
export
|
|
288
|
+
export interface RateLimiterError {
|
|
289
|
+
method?: string;
|
|
203
290
|
|
|
204
|
-
|
|
205
|
-
|
|
291
|
+
/**
|
|
292
|
+
* Retry after this many seconds, earliest.
|
|
293
|
+
* cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
294
|
+
*/
|
|
295
|
+
retryAfter: number;
|
|
206
296
|
}
|
|
207
297
|
|
|
208
|
-
export
|
|
209
|
-
|
|
210
|
-
|
|
298
|
+
export interface CreateProjectParams {
|
|
299
|
+
name: string;
|
|
300
|
+
slug?: string;
|
|
301
|
+
account: string;
|
|
302
|
+
provider: string;
|
|
303
|
+
cloneUrl: string;
|
|
304
|
+
teamId?: string;
|
|
305
|
+
userId?: string;
|
|
306
|
+
appInstallationId: string;
|
|
307
|
+
}
|
|
308
|
+
export interface FindPrebuildsParams {
|
|
309
|
+
projectId: string;
|
|
310
|
+
branch?: string;
|
|
311
|
+
latest?: boolean;
|
|
312
|
+
prebuildId?: string;
|
|
313
|
+
// default: 30
|
|
314
|
+
limit?: number;
|
|
315
|
+
}
|
|
316
|
+
export interface GetProviderRepositoriesParams {
|
|
317
|
+
provider: string;
|
|
318
|
+
hints?: { installationId: string } | object;
|
|
319
|
+
}
|
|
320
|
+
export interface ProviderRepository {
|
|
321
|
+
name: string;
|
|
322
|
+
path?: string;
|
|
323
|
+
account: string;
|
|
324
|
+
accountAvatarUrl: string;
|
|
325
|
+
cloneUrl: string;
|
|
326
|
+
updatedAt?: string;
|
|
327
|
+
installationId?: number;
|
|
328
|
+
installationUpdatedAt?: string;
|
|
329
|
+
|
|
330
|
+
inUse?: { userName: string };
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface ClientHeaderFields {
|
|
334
|
+
ip?: string;
|
|
335
|
+
userAgent?: string;
|
|
336
|
+
dnt?: string;
|
|
337
|
+
clientRegion?: string;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_SHORT = "short";
|
|
341
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_LONG = "long";
|
|
342
|
+
export const WORKSPACE_TIMEOUT_EXTENDED = "extended";
|
|
343
|
+
export const WORKSPACE_TIMEOUT_EXTENDED_ALT = "180m"; // for backwards compatibility since the IDE uses this
|
|
344
|
+
export const WorkspaceTimeoutValues = [
|
|
345
|
+
WORKSPACE_TIMEOUT_DEFAULT_SHORT,
|
|
346
|
+
WORKSPACE_TIMEOUT_DEFAULT_LONG,
|
|
347
|
+
WORKSPACE_TIMEOUT_EXTENDED,
|
|
348
|
+
WORKSPACE_TIMEOUT_EXTENDED_ALT,
|
|
349
|
+
] as const;
|
|
350
|
+
|
|
351
|
+
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
352
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
353
|
+
): GitpodServiceImpl<C, S> {
|
|
354
|
+
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
358
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
359
|
+
): JsonRpcProxy<S> {
|
|
360
|
+
methods.setClient = methods.setClient || (() => {});
|
|
361
|
+
methods.dispose = methods.dispose || (() => {});
|
|
211
362
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
363
|
+
// @ts-ignore
|
|
212
364
|
get: (target: S, property: keyof S) => {
|
|
213
365
|
const result = target[property];
|
|
214
366
|
if (!result) {
|
|
215
367
|
throw new Error(`Method ${property} not implemented`);
|
|
216
368
|
}
|
|
217
369
|
return result;
|
|
218
|
-
}
|
|
370
|
+
},
|
|
219
371
|
});
|
|
220
|
-
}
|
|
372
|
+
};
|
|
221
373
|
|
|
222
374
|
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
223
375
|
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
224
376
|
|
|
225
377
|
export interface SetWorkspaceTimeoutResult {
|
|
226
|
-
resetTimeoutOnWorkspaces: string[]
|
|
378
|
+
resetTimeoutOnWorkspaces: string[];
|
|
227
379
|
}
|
|
228
380
|
|
|
229
381
|
export interface GetWorkspaceTimeoutResult {
|
|
230
|
-
duration: WorkspaceTimeoutDuration
|
|
231
|
-
|
|
382
|
+
duration: WorkspaceTimeoutDuration;
|
|
383
|
+
durationRaw: string;
|
|
384
|
+
canChange: boolean;
|
|
232
385
|
}
|
|
233
386
|
|
|
234
387
|
export interface StartWorkspaceResult {
|
|
235
|
-
instanceID: string
|
|
236
|
-
workspaceURL?: string
|
|
388
|
+
instanceID: string;
|
|
389
|
+
workspaceURL?: string;
|
|
237
390
|
}
|
|
238
391
|
|
|
239
392
|
export namespace GitpodServer {
|
|
@@ -241,6 +394,8 @@ export namespace GitpodServer {
|
|
|
241
394
|
limit?: number;
|
|
242
395
|
searchString?: string;
|
|
243
396
|
pinnedOnly?: boolean;
|
|
397
|
+
projectId?: string | string[];
|
|
398
|
+
includeWithoutProject?: boolean;
|
|
244
399
|
}
|
|
245
400
|
export interface GetAccountStatementOptions {
|
|
246
401
|
date?: string;
|
|
@@ -248,6 +403,7 @@ export namespace GitpodServer {
|
|
|
248
403
|
export interface CreateWorkspaceOptions {
|
|
249
404
|
contextUrl: string;
|
|
250
405
|
mode?: CreateWorkspaceMode;
|
|
406
|
+
forceDefaultConfig?: boolean;
|
|
251
407
|
}
|
|
252
408
|
export interface StartWorkspaceOptions {
|
|
253
409
|
forceDefaultImage: boolean;
|
|
@@ -255,13 +411,8 @@ export namespace GitpodServer {
|
|
|
255
411
|
export interface TakeSnapshotOptions {
|
|
256
412
|
workspaceId: string;
|
|
257
413
|
layoutData?: string;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
readonly releaseNotes?: boolean;
|
|
261
|
-
readonly workspaceInstanceId: string;
|
|
262
|
-
}
|
|
263
|
-
export interface UpdateUserMessagesOptions {
|
|
264
|
-
readonly messageIds: string[];
|
|
414
|
+
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
415
|
+
dontWait?: boolean;
|
|
265
416
|
}
|
|
266
417
|
export interface GetUserStorageResourceOptions {
|
|
267
418
|
readonly uri: string;
|
|
@@ -279,23 +430,23 @@ export namespace GitpodServer {
|
|
|
279
430
|
readonly roundTripTime?: number;
|
|
280
431
|
}
|
|
281
432
|
export interface UpdateOwnAuthProviderParams {
|
|
282
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
433
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
283
434
|
}
|
|
284
435
|
export interface DeleteOwnAuthProviderParams {
|
|
285
|
-
readonly id: string
|
|
436
|
+
readonly id: string;
|
|
286
437
|
}
|
|
287
438
|
export type AdmissionLevel = "owner" | "everyone";
|
|
288
439
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
289
440
|
export interface GenerateNewGitpodTokenOptions {
|
|
290
|
-
name?: string
|
|
291
|
-
type: GitpodTokenType
|
|
292
|
-
scopes?: string[]
|
|
441
|
+
name?: string;
|
|
442
|
+
type: GitpodTokenType;
|
|
443
|
+
scopes?: string[];
|
|
293
444
|
}
|
|
294
445
|
}
|
|
295
446
|
|
|
296
|
-
export const GitpodServerPath =
|
|
447
|
+
export const GitpodServerPath = "/gitpod";
|
|
297
448
|
|
|
298
|
-
export const GitpodServerProxy = Symbol(
|
|
449
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
299
450
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
300
451
|
|
|
301
452
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -303,12 +454,14 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
303
454
|
|
|
304
455
|
public registerClient(client: Partial<Client>): Disposable {
|
|
305
456
|
this.clients.push(client);
|
|
306
|
-
const index = this.clients.length;
|
|
307
457
|
return {
|
|
308
458
|
dispose: () => {
|
|
309
|
-
this.clients.
|
|
310
|
-
|
|
311
|
-
|
|
459
|
+
const index = this.clients.indexOf(client);
|
|
460
|
+
if (index > -1) {
|
|
461
|
+
this.clients.splice(index, 1);
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
};
|
|
312
465
|
}
|
|
313
466
|
|
|
314
467
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -317,31 +470,34 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
317
470
|
try {
|
|
318
471
|
client.onInstanceUpdate(instance);
|
|
319
472
|
} catch (error) {
|
|
320
|
-
console.error(error)
|
|
473
|
+
console.error(error);
|
|
321
474
|
}
|
|
322
475
|
}
|
|
323
476
|
}
|
|
324
477
|
}
|
|
325
478
|
|
|
326
|
-
|
|
479
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void {
|
|
327
480
|
for (const client of this.clients) {
|
|
328
|
-
if (client.
|
|
481
|
+
if (client.onPrebuildUpdate) {
|
|
329
482
|
try {
|
|
330
|
-
client.
|
|
483
|
+
client.onPrebuildUpdate(update);
|
|
331
484
|
} catch (error) {
|
|
332
|
-
console.error(error)
|
|
485
|
+
console.error(error);
|
|
333
486
|
}
|
|
334
487
|
}
|
|
335
488
|
}
|
|
336
489
|
}
|
|
337
490
|
|
|
338
|
-
|
|
491
|
+
onWorkspaceImageBuildLogs(
|
|
492
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
493
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
494
|
+
): void {
|
|
339
495
|
for (const client of this.clients) {
|
|
340
|
-
if (client.
|
|
496
|
+
if (client.onWorkspaceImageBuildLogs) {
|
|
341
497
|
try {
|
|
342
|
-
client.
|
|
498
|
+
client.onWorkspaceImageBuildLogs(info, content);
|
|
343
499
|
} catch (error) {
|
|
344
|
-
console.error(error)
|
|
500
|
+
console.error(error);
|
|
345
501
|
}
|
|
346
502
|
}
|
|
347
503
|
}
|
|
@@ -353,7 +509,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
353
509
|
try {
|
|
354
510
|
client.notifyDidOpenConnection();
|
|
355
511
|
} catch (error) {
|
|
356
|
-
console.error(error)
|
|
512
|
+
console.error(error);
|
|
357
513
|
}
|
|
358
514
|
}
|
|
359
515
|
}
|
|
@@ -365,7 +521,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
365
521
|
try {
|
|
366
522
|
client.notifyDidCloseConnection();
|
|
367
523
|
} catch (error) {
|
|
368
|
-
console.error(error)
|
|
524
|
+
console.error(error);
|
|
369
525
|
}
|
|
370
526
|
}
|
|
371
527
|
}
|
|
@@ -377,64 +533,61 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
377
533
|
try {
|
|
378
534
|
client.onCreditAlert(creditAlert);
|
|
379
535
|
} catch (error) {
|
|
380
|
-
console.error(error)
|
|
536
|
+
console.error(error);
|
|
381
537
|
}
|
|
382
538
|
}
|
|
383
539
|
}
|
|
384
540
|
}
|
|
385
|
-
|
|
386
541
|
}
|
|
387
542
|
|
|
388
543
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
389
544
|
|
|
390
|
-
const hasWindow =
|
|
545
|
+
const hasWindow = typeof window !== "undefined";
|
|
391
546
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
392
547
|
unknown: 0,
|
|
393
548
|
preparing: 1,
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
549
|
+
building: 2,
|
|
550
|
+
pending: 3,
|
|
551
|
+
creating: 4,
|
|
552
|
+
initializing: 5,
|
|
553
|
+
running: 6,
|
|
554
|
+
interrupted: 7,
|
|
555
|
+
stopping: 8,
|
|
556
|
+
stopped: 9,
|
|
401
557
|
};
|
|
402
558
|
export class WorkspaceInstanceUpdateListener {
|
|
403
559
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
404
560
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
405
561
|
|
|
406
|
-
private source:
|
|
562
|
+
private source: "sync" | "update" = "sync";
|
|
407
563
|
|
|
408
564
|
get info(): WorkspaceInfo {
|
|
409
565
|
return this._info;
|
|
410
566
|
}
|
|
411
567
|
|
|
412
|
-
constructor(
|
|
413
|
-
private readonly service: GitpodService,
|
|
414
|
-
private _info: WorkspaceInfo
|
|
415
|
-
) {
|
|
568
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
416
569
|
service.registerClient({
|
|
417
|
-
onInstanceUpdate: instance => {
|
|
570
|
+
onInstanceUpdate: (instance) => {
|
|
418
571
|
if (this.isOutOfOrder(instance)) {
|
|
419
572
|
return;
|
|
420
573
|
}
|
|
421
574
|
this.cancelSync();
|
|
422
575
|
this._info.latestInstance = instance;
|
|
423
|
-
this.source =
|
|
576
|
+
this.source = "update";
|
|
424
577
|
this.onDidChangeEmitter.fire(undefined);
|
|
425
578
|
},
|
|
426
579
|
notifyDidOpenConnection: () => {
|
|
427
580
|
this.sync();
|
|
428
|
-
}
|
|
581
|
+
},
|
|
429
582
|
});
|
|
430
583
|
if (hasWindow) {
|
|
431
584
|
// learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
|
|
432
|
-
window.document.addEventListener(
|
|
433
|
-
if (window.document.visibilityState ===
|
|
585
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
586
|
+
if (window.document.visibilityState === "visible") {
|
|
434
587
|
this.sync();
|
|
435
588
|
}
|
|
436
589
|
});
|
|
437
|
-
window.addEventListener(
|
|
590
|
+
window.addEventListener("pageshow", (e) => {
|
|
438
591
|
if (e.persisted) {
|
|
439
592
|
this.sync();
|
|
440
593
|
}
|
|
@@ -462,12 +615,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
462
615
|
return;
|
|
463
616
|
}
|
|
464
617
|
this._info = info;
|
|
465
|
-
this.source =
|
|
618
|
+
this.source = "sync";
|
|
466
619
|
this.onDidChangeEmitter.fire(undefined);
|
|
467
620
|
} catch (e) {
|
|
468
|
-
console.error(
|
|
621
|
+
console.error("failed to sync workspace instance:", e);
|
|
469
622
|
}
|
|
470
|
-
})
|
|
623
|
+
});
|
|
471
624
|
}
|
|
472
625
|
private cancelSync(): void {
|
|
473
626
|
if (this.syncTokenSource) {
|
|
@@ -484,7 +637,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
484
637
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
485
638
|
return true;
|
|
486
639
|
}
|
|
487
|
-
if (this.source ===
|
|
640
|
+
if (this.source === "update") {
|
|
488
641
|
return false;
|
|
489
642
|
}
|
|
490
643
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -492,15 +645,13 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
492
645
|
}
|
|
493
646
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
494
647
|
}
|
|
495
|
-
|
|
496
648
|
}
|
|
497
649
|
|
|
498
650
|
export interface GitpodServiceOptions {
|
|
499
|
-
onReconnect?: () =>
|
|
651
|
+
onReconnect?: () => void | Promise<void>;
|
|
500
652
|
}
|
|
501
653
|
|
|
502
654
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
503
|
-
|
|
504
655
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
505
656
|
|
|
506
657
|
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
@@ -515,7 +666,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
515
666
|
|
|
516
667
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
517
668
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
518
|
-
const listener =
|
|
669
|
+
const listener =
|
|
670
|
+
this.instanceListeners.get(workspaceId) ||
|
|
519
671
|
(async () => {
|
|
520
672
|
const info = await this.server.getWorkspace(workspaceId);
|
|
521
673
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -531,26 +683,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
531
683
|
}
|
|
532
684
|
}
|
|
533
685
|
|
|
534
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
686
|
+
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
687
|
+
serverUrl: string | Promise<string>,
|
|
688
|
+
) {
|
|
535
689
|
const toWsUrl = (serverUrl: string) => {
|
|
536
|
-
return new GitpodHostUrl(serverUrl)
|
|
537
|
-
.asWebsocket()
|
|
538
|
-
.withApi({ pathname: GitpodServerPath })
|
|
539
|
-
.toString();
|
|
690
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
540
691
|
};
|
|
541
692
|
let url: string | Promise<string>;
|
|
542
693
|
if (typeof serverUrl === "string") {
|
|
543
694
|
url = toWsUrl(serverUrl);
|
|
544
695
|
} else {
|
|
545
|
-
url = serverUrl.then(url => toWsUrl(url));
|
|
696
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
546
697
|
}
|
|
547
698
|
|
|
548
699
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
549
|
-
let onReconnect = () => {
|
|
700
|
+
let onReconnect = () => {};
|
|
550
701
|
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
551
|
-
onListening: socket => {
|
|
702
|
+
onListening: (socket) => {
|
|
552
703
|
onReconnect = () => socket.reconnect();
|
|
553
|
-
}
|
|
704
|
+
},
|
|
554
705
|
});
|
|
555
706
|
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
556
|
-
}
|
|
707
|
+
}
|