@gitpod/gitpod-protocol 0.1.5-se-multi-repo.39 → 0.1.5-se-usage-view.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/gitpod-schema.json +69 -3
- package/lib/accounting-protocol.d.ts +18 -10
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +34 -32
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +5 -0
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/attribution.d.ts +20 -0
- package/lib/attribution.d.ts.map +1 -0
- package/lib/attribution.js +40 -0
- package/lib/attribution.js.map +1 -0
- package/lib/auth.d.ts.map +1 -1
- package/lib/billing-mode.d.ts +40 -0
- package/lib/billing-mode.d.ts.map +1 -0
- package/lib/billing-mode.js +36 -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.map +1 -1
- package/lib/context-url.js +4 -4
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +20 -5
- package/lib/context-url.spec.js.map +1 -1
- package/lib/email-protocol.d.ts +1 -1
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +1 -1
- 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 +7 -7
- 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 +2 -3
- 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 +1 -1
- 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 +7 -9
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +0 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +1 -20
- 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 +22 -0
- package/lib/experiments/configcat.d.ts.map +1 -0
- package/lib/experiments/configcat.js +53 -0
- package/lib/experiments/configcat.js.map +1 -0
- package/lib/experiments/types.d.ts +23 -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 +6 -6
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +42 -39
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +57 -26
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +40 -33
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +1 -1
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +1 -1
- package/lib/ide-protocol.d.ts +14 -6
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/index.d.ts +17 -16
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +3 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -1
- package/lib/installation-admin-protocol.js +3 -2
- package/lib/installation-admin-protocol.js.map +1 -1
- 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 +1 -1
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +19 -19
- 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 +9 -6
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +2 -18
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +21 -22
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +6 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +13 -3
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.js +8 -8
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +1 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +7 -9
- package/lib/messaging/proxy-factory.js.map +1 -1
- 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 +2 -2
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +12 -23
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +4 -3
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +210 -171
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +109 -35
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +248 -91
- package/lib/protocol.js.map +1 -1
- package/{src/theia-plugins.ts → lib/protocol.spec.d.ts} +2 -6
- 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.spec.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +20 -3
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +20 -5
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +21 -3
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +1 -1
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/usage.d.ts +97 -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 +6 -6
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +3 -3
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +6 -6
- 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.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +2 -2
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +5 -3
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +6 -1
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +5 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +446 -442
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +18 -7
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +1 -1
- package/lib/util/gitpod-cookie.d.ts.map +1 -1
- package/lib/util/gitpod-cookie.js +0 -3
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts +3 -0
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +49 -29
- 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 +15 -5
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +19 -0
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js +73 -1
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/jaeger-client-types.d.ts.map +1 -1
- package/lib/util/logging.d.ts +1 -1
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +31 -25
- 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/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +1 -2
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.spec.js +9 -6
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- 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 +15 -3
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +1 -0
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +10 -0
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +6 -6
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +14 -16
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.js +3 -3
- package/lib/util/tracing.spec.js.map +1 -1
- 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 +8 -11
- 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/{theia-plugins.js → webhook-event.js} +2 -2
- 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 +6 -8
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +2 -4
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +20 -3
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +3 -3
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +0 -2
- package/lib/wsready.js.map +1 -1
- package/package.json +12 -6
- package/pkg-yarn.lock +8 -5
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +66 -51
- package/src/admin-protocol.ts +30 -20
- package/src/analytics.ts +21 -21
- package/src/attribution.ts +48 -0
- package/src/auth.ts +2 -2
- package/src/billing-mode.ts +67 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +25 -11
- package/src/context-url.ts +80 -78
- package/src/email-protocol.ts +5 -6
- 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 +41 -0
- package/src/experiments/configcat.ts +58 -0
- package/src/experiments/types.ts +35 -0
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +189 -111
- package/src/headless-workspace-log.ts +5 -4
- package/src/ide-frontend-service.ts +2 -2
- package/src/ide-protocol.ts +18 -8
- package/src/index.ts +17 -16
- package/src/installation-admin-protocol.ts +11 -8
- package/src/license-protocol.ts +12 -6
- package/src/messaging/browser/connection.ts +45 -47
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +62 -82
- package/src/messaging/error.ts +20 -7
- package/src/messaging/handler.ts +6 -6
- package/src/messaging/node/connection.ts +8 -8
- package/src/messaging/proxy-factory.ts +23 -30
- package/src/oss-allowlist.ts +3 -3
- package/src/payment-protocol.ts +2 -2
- package/src/permission.ts +20 -31
- package/src/plans.ts +240 -189
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +456 -242
- package/src/snapshot-url.spec.ts +9 -7
- package/src/team-subscription-protocol.ts +57 -22
- package/src/teams-projects-protocol.ts +28 -8
- package/src/typings/globals.ts +4 -4
- package/src/usage.ts +128 -0
- package/src/util/analytics.ts +46 -42
- 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 +8 -6
- package/src/util/generate-workspace-id.spec.ts +26 -16
- package/src/util/generate-workspace-id.ts +460 -454
- package/src/util/gitpod-cookie.ts +8 -9
- package/src/util/gitpod-host-url.spec.ts +40 -13
- package/src/util/gitpod-host-url.ts +57 -33
- package/src/util/grpc.ts +90 -1
- package/src/util/jaeger-client-types.ts +2 -2
- package/src/util/logging.spec.ts +23 -0
- package/src/util/logging.ts +60 -42
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +17 -8
- package/src/util/parse-workspace-id.ts +5 -6
- package/src/util/queue.spec.ts +27 -25
- package/src/util/repeat.ts +1 -1
- package/src/util/semaphore.ts +4 -6
- package/src/util/skip-if.ts +9 -6
- package/src/util/timeutil.spec.ts +19 -14
- package/src/util/timeutil.ts +27 -11
- package/src/util/tracing.spec.ts +28 -23
- package/src/util/tracing.ts +54 -51
- 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 +14 -13
- package/src/workspace-instance.ts +60 -24
- package/src/wsready.ts +5 -4
- package/data/builtin-theia-plugins.json +0 -372
- 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/src/gitpod-service.ts
CHANGED
|
@@ -5,32 +5,64 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
User,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
PrebuiltWorkspace,
|
|
28
|
+
UserSSHPublicKeyValue,
|
|
29
|
+
SSHPublicKeyValue,
|
|
30
|
+
} from "./protocol";
|
|
14
31
|
import {
|
|
15
|
-
Team,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
32
|
+
Team,
|
|
33
|
+
TeamMemberInfo,
|
|
34
|
+
TeamMembershipInvite,
|
|
35
|
+
Project,
|
|
36
|
+
TeamMemberRole,
|
|
37
|
+
PrebuildWithStatus,
|
|
38
|
+
StartPrebuildResult,
|
|
39
|
+
PartialProject,
|
|
40
|
+
PrebuildEvent,
|
|
41
|
+
} from "./teams-projects-protocol";
|
|
42
|
+
import { JsonRpcProxy, JsonRpcServer } from "./messaging/proxy-factory";
|
|
43
|
+
import { Disposable, CancellationTokenSource } from "vscode-jsonrpc";
|
|
44
|
+
import { HeadlessLogUrls } from "./headless-workspace-log";
|
|
45
|
+
import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from "./workspace-instance";
|
|
46
|
+
import { AdminServer } from "./admin-protocol";
|
|
47
|
+
import { GitpodHostUrl } from "./util/gitpod-host-url";
|
|
48
|
+
import { WebSocketConnectionProvider } from "./messaging/browser/connection";
|
|
49
|
+
import { PermissionName } from "./permission";
|
|
50
|
+
import { LicenseService } from "./license-protocol";
|
|
51
|
+
import { Emitter } from "./util/event";
|
|
52
|
+
import { AccountStatement, CreditAlert } from "./accounting-protocol";
|
|
53
|
+
import { GithubUpgradeURL, PlanCoupon } from "./payment-protocol";
|
|
54
|
+
import {
|
|
55
|
+
TeamSubscription,
|
|
56
|
+
TeamSubscription2,
|
|
57
|
+
TeamSubscriptionSlot,
|
|
58
|
+
TeamSubscriptionSlotResolved,
|
|
59
|
+
} from "./team-subscription-protocol";
|
|
60
|
+
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
|
|
61
|
+
import { IDEServer } from "./ide-protocol";
|
|
62
|
+
import { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
|
|
63
|
+
import { ListBilledUsageResponse, ListBilledUsageRequest, ListUsageRequest, ListUsageResponse } from "./usage";
|
|
64
|
+
import { SupportedWorkspaceClass } from "./workspace-class";
|
|
65
|
+
import { BillingMode } from "./billing-mode";
|
|
34
66
|
|
|
35
67
|
export interface GitpodClient {
|
|
36
68
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
@@ -46,12 +78,14 @@ export interface GitpodClient {
|
|
|
46
78
|
//#endregion
|
|
47
79
|
}
|
|
48
80
|
|
|
49
|
-
export const GitpodServer = Symbol(
|
|
81
|
+
export const GitpodServer = Symbol("GitpodServer");
|
|
50
82
|
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
51
83
|
// User related API
|
|
52
84
|
getLoggedInUser(): Promise<User>;
|
|
53
85
|
getTerms(): Promise<Terms>;
|
|
54
86
|
updateLoggedInUser(user: Partial<User>): Promise<User>;
|
|
87
|
+
sendPhoneNumberVerificationToken(phoneNumber: string): Promise<void>;
|
|
88
|
+
verifyPhoneNumberVerificationToken(phoneNumber: string, token: string): Promise<boolean>;
|
|
55
89
|
getAuthProviders(): Promise<AuthProviderInfo[]>;
|
|
56
90
|
getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
|
|
57
91
|
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
|
|
@@ -122,6 +156,12 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
122
156
|
setEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
123
157
|
deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
124
158
|
|
|
159
|
+
// User SSH Keys
|
|
160
|
+
hasSSHPublicKey(): Promise<boolean>;
|
|
161
|
+
getSSHPublicKeys(): Promise<UserSSHPublicKeyValue[]>;
|
|
162
|
+
addSSHPublicKey(value: SSHPublicKeyValue): Promise<UserSSHPublicKeyValue>;
|
|
163
|
+
deleteSSHPublicKey(id: string): Promise<void>;
|
|
164
|
+
|
|
125
165
|
// Teams
|
|
126
166
|
getTeams(): Promise<Team[]>;
|
|
127
167
|
getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
|
|
@@ -145,7 +185,10 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
145
185
|
getTeamProjects(teamId: string): Promise<Project[]>;
|
|
146
186
|
getUserProjects(): Promise<Project[]>;
|
|
147
187
|
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
188
|
+
getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
|
|
148
189
|
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
190
|
+
findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
|
|
191
|
+
getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
|
|
149
192
|
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
150
193
|
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
151
194
|
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
@@ -159,8 +202,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
159
202
|
deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
|
|
160
203
|
|
|
161
204
|
// content service
|
|
162
|
-
getContentBlobUploadUrl(name: string): Promise<string
|
|
163
|
-
getContentBlobDownloadUrl(name: string): Promise<string
|
|
205
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
206
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
164
207
|
|
|
165
208
|
// Gitpod token
|
|
166
209
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
@@ -169,6 +212,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
169
212
|
|
|
170
213
|
// misc
|
|
171
214
|
sendFeedback(feedback: string): Promise<string | undefined>;
|
|
215
|
+
isGitHubAppEnabled(): Promise<boolean>;
|
|
172
216
|
registerGithubApp(installationId: string): Promise<void>;
|
|
173
217
|
|
|
174
218
|
/**
|
|
@@ -197,15 +241,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
197
241
|
*/
|
|
198
242
|
getLayout(workspaceId: string): Promise<string | undefined>;
|
|
199
243
|
|
|
200
|
-
/**
|
|
201
|
-
* @param params
|
|
202
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
203
|
-
*/
|
|
204
|
-
preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
|
|
205
|
-
resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
|
|
206
|
-
installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
|
|
207
|
-
uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
|
|
208
|
-
|
|
209
244
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
210
245
|
|
|
211
246
|
/**
|
|
@@ -223,7 +258,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
223
258
|
*/
|
|
224
259
|
getChargebeeSiteId(): Promise<string>;
|
|
225
260
|
createPortalSession(): Promise<{}>;
|
|
261
|
+
createTeamPortalSession(teamId: string): Promise<{}>;
|
|
226
262
|
checkout(planId: string, planQuantity?: number): Promise<{}>;
|
|
263
|
+
teamCheckout(teamId: string, planId: string): Promise<{}>;
|
|
227
264
|
getAvailableCoupons(): Promise<PlanCoupon[]>;
|
|
228
265
|
getAppliedCoupons(): Promise<PlanCoupon[]>;
|
|
229
266
|
|
|
@@ -235,33 +272,62 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
235
272
|
subscriptionCancel(subscriptionId: string): Promise<void>;
|
|
236
273
|
subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
|
|
237
274
|
|
|
275
|
+
getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
|
|
238
276
|
tsGet(): Promise<TeamSubscription[]>;
|
|
239
277
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
240
|
-
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined
|
|
278
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
241
279
|
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
242
|
-
tsAssignSlot(
|
|
280
|
+
tsAssignSlot(
|
|
281
|
+
teamSubscriptionId: string,
|
|
282
|
+
teamSubscriptionSlotId: string,
|
|
283
|
+
identityStr: string | undefined,
|
|
284
|
+
): Promise<void>;
|
|
243
285
|
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
244
286
|
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
245
287
|
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
246
288
|
|
|
247
289
|
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
248
290
|
|
|
291
|
+
getStripePublishableKey(): Promise<string>;
|
|
292
|
+
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
293
|
+
findStripeSubscriptionIdForTeam(teamId: string): Promise<string | undefined>;
|
|
294
|
+
createOrUpdateStripeCustomerForTeam(teamId: string, currency: string): Promise<void>;
|
|
295
|
+
subscribeTeamToStripe(teamId: string, setupIntentId: string): Promise<void>;
|
|
296
|
+
getStripePortalUrlForTeam(teamId: string): Promise<string>;
|
|
297
|
+
getSpendingLimitForTeam(teamId: string): Promise<number | undefined>;
|
|
298
|
+
setSpendingLimitForTeam(teamId: string, spendingLimit: number): Promise<void>;
|
|
299
|
+
|
|
300
|
+
listBilledUsage(req: ListBilledUsageRequest): Promise<ListBilledUsageResponse>;
|
|
301
|
+
listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
|
|
302
|
+
|
|
303
|
+
setUsageAttribution(usageAttribution: string): Promise<void>;
|
|
304
|
+
|
|
305
|
+
getBillingModeForUser(): Promise<BillingMode>;
|
|
306
|
+
getBillingModeForTeam(teamId: string): Promise<BillingMode>;
|
|
307
|
+
|
|
249
308
|
/**
|
|
250
309
|
* Analytics
|
|
251
310
|
*/
|
|
252
311
|
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
253
312
|
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
254
313
|
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Frontend notifications
|
|
317
|
+
*/
|
|
318
|
+
getNotifications(): Promise<string[]>;
|
|
319
|
+
|
|
320
|
+
getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
|
|
255
321
|
}
|
|
256
322
|
|
|
257
323
|
export interface RateLimiterError {
|
|
258
|
-
method?: string
|
|
324
|
+
method?: string;
|
|
259
325
|
|
|
260
326
|
/**
|
|
261
327
|
* Retry after this many seconds, earliest.
|
|
262
328
|
* cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
263
329
|
*/
|
|
264
|
-
retryAfter: number
|
|
330
|
+
retryAfter: number;
|
|
265
331
|
}
|
|
266
332
|
|
|
267
333
|
export interface CreateProjectParams {
|
|
@@ -292,7 +358,7 @@ export interface ProviderRepository {
|
|
|
292
358
|
account: string;
|
|
293
359
|
accountAvatarUrl: string;
|
|
294
360
|
cloneUrl: string;
|
|
295
|
-
updatedAt
|
|
361
|
+
updatedAt?: string;
|
|
296
362
|
installationId?: number;
|
|
297
363
|
installationUpdatedAt?: string;
|
|
298
364
|
|
|
@@ -306,42 +372,56 @@ export interface ClientHeaderFields {
|
|
|
306
372
|
clientRegion?: string;
|
|
307
373
|
}
|
|
308
374
|
|
|
309
|
-
export const
|
|
310
|
-
|
|
311
|
-
export const
|
|
375
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_SHORT = "short";
|
|
376
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_LONG = "long";
|
|
377
|
+
export const WORKSPACE_TIMEOUT_EXTENDED = "extended";
|
|
378
|
+
export const WORKSPACE_TIMEOUT_EXTENDED_ALT = "180m"; // for backwards compatibility since the IDE uses this
|
|
379
|
+
export const WorkspaceTimeoutValues = [
|
|
380
|
+
WORKSPACE_TIMEOUT_DEFAULT_SHORT,
|
|
381
|
+
WORKSPACE_TIMEOUT_DEFAULT_LONG,
|
|
382
|
+
WORKSPACE_TIMEOUT_EXTENDED,
|
|
383
|
+
WORKSPACE_TIMEOUT_EXTENDED_ALT,
|
|
384
|
+
] as const;
|
|
385
|
+
|
|
386
|
+
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
387
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
388
|
+
): GitpodServiceImpl<C, S> {
|
|
312
389
|
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
313
|
-
}
|
|
390
|
+
};
|
|
314
391
|
|
|
315
|
-
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
316
|
-
methods
|
|
317
|
-
|
|
392
|
+
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
393
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
394
|
+
): JsonRpcProxy<S> {
|
|
395
|
+
methods.setClient = methods.setClient || (() => {});
|
|
396
|
+
methods.dispose = methods.dispose || (() => {});
|
|
318
397
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
319
398
|
// @ts-ignore
|
|
320
399
|
get: (target: S, property: keyof S) => {
|
|
321
400
|
const result = target[property];
|
|
322
401
|
if (!result) {
|
|
323
|
-
throw new Error(`Method ${property} not implemented`);
|
|
402
|
+
throw new Error(`Method ${String(property)} not implemented`);
|
|
324
403
|
}
|
|
325
404
|
return result;
|
|
326
|
-
}
|
|
405
|
+
},
|
|
327
406
|
});
|
|
328
|
-
}
|
|
407
|
+
};
|
|
329
408
|
|
|
330
409
|
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
331
410
|
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
332
411
|
|
|
333
412
|
export interface SetWorkspaceTimeoutResult {
|
|
334
|
-
resetTimeoutOnWorkspaces: string[]
|
|
413
|
+
resetTimeoutOnWorkspaces: string[];
|
|
335
414
|
}
|
|
336
415
|
|
|
337
416
|
export interface GetWorkspaceTimeoutResult {
|
|
338
|
-
duration: WorkspaceTimeoutDuration
|
|
339
|
-
|
|
417
|
+
duration: WorkspaceTimeoutDuration;
|
|
418
|
+
durationRaw: string;
|
|
419
|
+
canChange: boolean;
|
|
340
420
|
}
|
|
341
421
|
|
|
342
422
|
export interface StartWorkspaceResult {
|
|
343
|
-
instanceID: string
|
|
344
|
-
workspaceURL?: string
|
|
423
|
+
instanceID: string;
|
|
424
|
+
workspaceURL?: string;
|
|
345
425
|
}
|
|
346
426
|
|
|
347
427
|
export namespace GitpodServer {
|
|
@@ -385,23 +465,23 @@ export namespace GitpodServer {
|
|
|
385
465
|
readonly roundTripTime?: number;
|
|
386
466
|
}
|
|
387
467
|
export interface UpdateOwnAuthProviderParams {
|
|
388
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
468
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
389
469
|
}
|
|
390
470
|
export interface DeleteOwnAuthProviderParams {
|
|
391
|
-
readonly id: string
|
|
471
|
+
readonly id: string;
|
|
392
472
|
}
|
|
393
473
|
export type AdmissionLevel = "owner" | "everyone";
|
|
394
474
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
395
475
|
export interface GenerateNewGitpodTokenOptions {
|
|
396
|
-
name?: string
|
|
397
|
-
type: GitpodTokenType
|
|
398
|
-
scopes?: string[]
|
|
476
|
+
name?: string;
|
|
477
|
+
type: GitpodTokenType;
|
|
478
|
+
scopes?: string[];
|
|
399
479
|
}
|
|
400
480
|
}
|
|
401
481
|
|
|
402
|
-
export const GitpodServerPath =
|
|
482
|
+
export const GitpodServerPath = "/gitpod";
|
|
403
483
|
|
|
404
|
-
export const GitpodServerProxy = Symbol(
|
|
484
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
405
485
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
406
486
|
|
|
407
487
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -415,8 +495,8 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
415
495
|
if (index > -1) {
|
|
416
496
|
this.clients.splice(index, 1);
|
|
417
497
|
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
498
|
+
},
|
|
499
|
+
};
|
|
420
500
|
}
|
|
421
501
|
|
|
422
502
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -425,7 +505,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
425
505
|
try {
|
|
426
506
|
client.onInstanceUpdate(instance);
|
|
427
507
|
} catch (error) {
|
|
428
|
-
console.error(error)
|
|
508
|
+
console.error(error);
|
|
429
509
|
}
|
|
430
510
|
}
|
|
431
511
|
}
|
|
@@ -437,19 +517,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
437
517
|
try {
|
|
438
518
|
client.onPrebuildUpdate(update);
|
|
439
519
|
} catch (error) {
|
|
440
|
-
console.error(error)
|
|
520
|
+
console.error(error);
|
|
441
521
|
}
|
|
442
522
|
}
|
|
443
523
|
}
|
|
444
524
|
}
|
|
445
525
|
|
|
446
|
-
onWorkspaceImageBuildLogs(
|
|
526
|
+
onWorkspaceImageBuildLogs(
|
|
527
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
528
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
529
|
+
): void {
|
|
447
530
|
for (const client of this.clients) {
|
|
448
531
|
if (client.onWorkspaceImageBuildLogs) {
|
|
449
532
|
try {
|
|
450
533
|
client.onWorkspaceImageBuildLogs(info, content);
|
|
451
534
|
} catch (error) {
|
|
452
|
-
console.error(error)
|
|
535
|
+
console.error(error);
|
|
453
536
|
}
|
|
454
537
|
}
|
|
455
538
|
}
|
|
@@ -461,7 +544,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
461
544
|
try {
|
|
462
545
|
client.notifyDidOpenConnection();
|
|
463
546
|
} catch (error) {
|
|
464
|
-
console.error(error)
|
|
547
|
+
console.error(error);
|
|
465
548
|
}
|
|
466
549
|
}
|
|
467
550
|
}
|
|
@@ -473,7 +556,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
473
556
|
try {
|
|
474
557
|
client.notifyDidCloseConnection();
|
|
475
558
|
} catch (error) {
|
|
476
|
-
console.error(error)
|
|
559
|
+
console.error(error);
|
|
477
560
|
}
|
|
478
561
|
}
|
|
479
562
|
}
|
|
@@ -485,64 +568,61 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
485
568
|
try {
|
|
486
569
|
client.onCreditAlert(creditAlert);
|
|
487
570
|
} catch (error) {
|
|
488
|
-
console.error(error)
|
|
571
|
+
console.error(error);
|
|
489
572
|
}
|
|
490
573
|
}
|
|
491
574
|
}
|
|
492
575
|
}
|
|
493
|
-
|
|
494
576
|
}
|
|
495
577
|
|
|
496
578
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
497
579
|
|
|
498
|
-
const hasWindow =
|
|
580
|
+
const hasWindow = typeof window !== "undefined";
|
|
499
581
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
500
582
|
unknown: 0,
|
|
501
583
|
preparing: 1,
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
584
|
+
building: 2,
|
|
585
|
+
pending: 3,
|
|
586
|
+
creating: 4,
|
|
587
|
+
initializing: 5,
|
|
588
|
+
running: 6,
|
|
589
|
+
interrupted: 7,
|
|
590
|
+
stopping: 8,
|
|
591
|
+
stopped: 9,
|
|
509
592
|
};
|
|
510
593
|
export class WorkspaceInstanceUpdateListener {
|
|
511
594
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
512
595
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
513
596
|
|
|
514
|
-
private source:
|
|
597
|
+
private source: "sync" | "update" = "sync";
|
|
515
598
|
|
|
516
599
|
get info(): WorkspaceInfo {
|
|
517
600
|
return this._info;
|
|
518
601
|
}
|
|
519
602
|
|
|
520
|
-
constructor(
|
|
521
|
-
private readonly service: GitpodService,
|
|
522
|
-
private _info: WorkspaceInfo
|
|
523
|
-
) {
|
|
603
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
524
604
|
service.registerClient({
|
|
525
|
-
onInstanceUpdate: instance => {
|
|
605
|
+
onInstanceUpdate: (instance) => {
|
|
526
606
|
if (this.isOutOfOrder(instance)) {
|
|
527
607
|
return;
|
|
528
608
|
}
|
|
529
609
|
this.cancelSync();
|
|
530
610
|
this._info.latestInstance = instance;
|
|
531
|
-
this.source =
|
|
611
|
+
this.source = "update";
|
|
532
612
|
this.onDidChangeEmitter.fire(undefined);
|
|
533
613
|
},
|
|
534
614
|
notifyDidOpenConnection: () => {
|
|
535
615
|
this.sync();
|
|
536
|
-
}
|
|
616
|
+
},
|
|
537
617
|
});
|
|
538
618
|
if (hasWindow) {
|
|
539
619
|
// learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
|
|
540
|
-
window.document.addEventListener(
|
|
541
|
-
if (window.document.visibilityState ===
|
|
620
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
621
|
+
if (window.document.visibilityState === "visible") {
|
|
542
622
|
this.sync();
|
|
543
623
|
}
|
|
544
624
|
});
|
|
545
|
-
window.addEventListener(
|
|
625
|
+
window.addEventListener("pageshow", (e) => {
|
|
546
626
|
if (e.persisted) {
|
|
547
627
|
this.sync();
|
|
548
628
|
}
|
|
@@ -570,12 +650,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
570
650
|
return;
|
|
571
651
|
}
|
|
572
652
|
this._info = info;
|
|
573
|
-
this.source =
|
|
653
|
+
this.source = "sync";
|
|
574
654
|
this.onDidChangeEmitter.fire(undefined);
|
|
575
655
|
} catch (e) {
|
|
576
|
-
console.error(
|
|
656
|
+
console.error("failed to sync workspace instance:", e);
|
|
577
657
|
}
|
|
578
|
-
})
|
|
658
|
+
});
|
|
579
659
|
}
|
|
580
660
|
private cancelSync(): void {
|
|
581
661
|
if (this.syncTokenSource) {
|
|
@@ -592,7 +672,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
592
672
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
593
673
|
return true;
|
|
594
674
|
}
|
|
595
|
-
if (this.source ===
|
|
675
|
+
if (this.source === "update") {
|
|
596
676
|
return false;
|
|
597
677
|
}
|
|
598
678
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -600,15 +680,13 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
600
680
|
}
|
|
601
681
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
602
682
|
}
|
|
603
|
-
|
|
604
683
|
}
|
|
605
684
|
|
|
606
685
|
export interface GitpodServiceOptions {
|
|
607
|
-
onReconnect?: () =>
|
|
686
|
+
onReconnect?: () => void | Promise<void>;
|
|
608
687
|
}
|
|
609
688
|
|
|
610
689
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
611
|
-
|
|
612
690
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
613
691
|
|
|
614
692
|
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
@@ -623,7 +701,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
623
701
|
|
|
624
702
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
625
703
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
626
|
-
const listener =
|
|
704
|
+
const listener =
|
|
705
|
+
this.instanceListeners.get(workspaceId) ||
|
|
627
706
|
(async () => {
|
|
628
707
|
const info = await this.server.getWorkspace(workspaceId);
|
|
629
708
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -639,26 +718,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
639
718
|
}
|
|
640
719
|
}
|
|
641
720
|
|
|
642
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
721
|
+
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
722
|
+
serverUrl: string | Promise<string>,
|
|
723
|
+
) {
|
|
643
724
|
const toWsUrl = (serverUrl: string) => {
|
|
644
|
-
return new GitpodHostUrl(serverUrl)
|
|
645
|
-
.asWebsocket()
|
|
646
|
-
.withApi({ pathname: GitpodServerPath })
|
|
647
|
-
.toString();
|
|
725
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
648
726
|
};
|
|
649
727
|
let url: string | Promise<string>;
|
|
650
728
|
if (typeof serverUrl === "string") {
|
|
651
729
|
url = toWsUrl(serverUrl);
|
|
652
730
|
} else {
|
|
653
|
-
url = serverUrl.then(url => toWsUrl(url));
|
|
731
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
654
732
|
}
|
|
655
733
|
|
|
656
734
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
657
|
-
let onReconnect = () => {
|
|
735
|
+
let onReconnect = () => {};
|
|
658
736
|
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
659
|
-
onListening: socket => {
|
|
737
|
+
onListening: (socket) => {
|
|
660
738
|
onReconnect = () => socket.reconnect();
|
|
661
|
-
}
|
|
739
|
+
},
|
|
662
740
|
});
|
|
663
741
|
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
664
|
-
}
|
|
742
|
+
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
export enum HeadlessWorkspaceEventType {
|
|
9
8
|
LogOutput = "log-output",
|
|
10
9
|
FinishedSuccessfully = "finish-success",
|
|
@@ -12,14 +11,16 @@ export enum HeadlessWorkspaceEventType {
|
|
|
12
11
|
AbortedTimedOut = "aborted-timeout",
|
|
13
12
|
Aborted = "aborted",
|
|
14
13
|
Failed = "failed",
|
|
15
|
-
Started = "started"
|
|
14
|
+
Started = "started",
|
|
16
15
|
}
|
|
17
16
|
export namespace HeadlessWorkspaceEventType {
|
|
18
17
|
export function isRunning(t: HeadlessWorkspaceEventType) {
|
|
19
18
|
return t === HeadlessWorkspaceEventType.LogOutput;
|
|
20
19
|
}
|
|
21
20
|
export function didFinish(t: HeadlessWorkspaceEventType) {
|
|
22
|
-
return
|
|
21
|
+
return (
|
|
22
|
+
t === HeadlessWorkspaceEventType.FinishedButFailed || t === HeadlessWorkspaceEventType.FinishedSuccessfully
|
|
23
|
+
);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -36,4 +37,4 @@ export interface HeadlessLogUrls {
|
|
|
36
37
|
|
|
37
38
|
/** cmp. @const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX */
|
|
38
39
|
export const HEADLESS_LOG_STREAM_STATUS_CODE = "X-LogStream-StatusCode";
|
|
39
|
-
export const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX = /X-LogStream-StatusCode: ([0-9]{3})/;
|
|
40
|
+
export const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX = /X-LogStream-StatusCode: ([0-9]{3})/;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { Event } from "./util/event";
|
|
8
8
|
import { Disposable } from "./util/disposable";
|
|
9
9
|
|
|
10
|
-
export type IDEFrontendState =
|
|
10
|
+
export type IDEFrontendState = "init" | "ready" | "terminated";
|
|
11
11
|
|
|
12
12
|
export interface IDEFrontendService {
|
|
13
13
|
readonly state: IDEFrontendState;
|
|
@@ -25,4 +25,4 @@ export interface IDEFrontendService {
|
|
|
25
25
|
* confirmation dialogs for stopped workspaces.
|
|
26
26
|
*/
|
|
27
27
|
start(): Disposable;
|
|
28
|
-
}
|
|
28
|
+
}
|