@gitpod/gitpod-protocol 0.1.5-tar-telemetry-settings-data.2 → 0.1.5-tar-sh-active-users.8
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 +97 -5
- 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 +9 -2
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +4 -5
- 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 +56 -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 +1 -0
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +2 -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 +4 -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 +146 -39
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +267 -88
- 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 +22 -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 +43 -0
- package/lib/usage.d.ts.map +1 -0
- package/lib/{theia-plugins.js → usage.js} +2 -2
- package/lib/usage.js.map +1 -0
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +12 -3
- 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/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 +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 +4 -4
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +1 -3
- package/lib/wsready.js.map +1 -1
- package/package.json +13 -7
- package/pkg-yarn.lock +9 -6
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +66 -51
- package/src/admin-protocol.ts +33 -21
- package/src/analytics.ts +26 -28
- 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 +188 -111
- package/src/headless-workspace-log.ts +6 -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 +12 -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 +509 -242
- package/src/snapshot-url.spec.ts +9 -7
- package/src/team-subscription-protocol.ts +59 -22
- package/src/teams-projects-protocol.ts +28 -8
- package/src/typings/globals.ts +4 -4
- package/src/usage.ts +63 -0
- package/src/util/analytics.ts +46 -24
- 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 +6 -5
- 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 } 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,61 @@ 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
|
+
|
|
302
|
+
setUsageAttribution(usageAttribution: string): Promise<void>;
|
|
303
|
+
|
|
304
|
+
getBillingModeForUser(): Promise<BillingMode>;
|
|
305
|
+
getBillingModeForTeam(teamId: string): Promise<BillingMode>;
|
|
306
|
+
|
|
249
307
|
/**
|
|
250
308
|
* Analytics
|
|
251
309
|
*/
|
|
252
310
|
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
253
311
|
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
254
312
|
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Frontend notifications
|
|
316
|
+
*/
|
|
317
|
+
getNotifications(): Promise<string[]>;
|
|
318
|
+
|
|
319
|
+
getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
|
|
255
320
|
}
|
|
256
321
|
|
|
257
322
|
export interface RateLimiterError {
|
|
258
|
-
method?: string
|
|
323
|
+
method?: string;
|
|
259
324
|
|
|
260
325
|
/**
|
|
261
326
|
* Retry after this many seconds, earliest.
|
|
262
327
|
* cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
263
328
|
*/
|
|
264
|
-
retryAfter: number
|
|
329
|
+
retryAfter: number;
|
|
265
330
|
}
|
|
266
331
|
|
|
267
332
|
export interface CreateProjectParams {
|
|
@@ -292,7 +357,7 @@ export interface ProviderRepository {
|
|
|
292
357
|
account: string;
|
|
293
358
|
accountAvatarUrl: string;
|
|
294
359
|
cloneUrl: string;
|
|
295
|
-
updatedAt
|
|
360
|
+
updatedAt?: string;
|
|
296
361
|
installationId?: number;
|
|
297
362
|
installationUpdatedAt?: string;
|
|
298
363
|
|
|
@@ -306,42 +371,56 @@ export interface ClientHeaderFields {
|
|
|
306
371
|
clientRegion?: string;
|
|
307
372
|
}
|
|
308
373
|
|
|
309
|
-
export const
|
|
310
|
-
|
|
311
|
-
export const
|
|
374
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_SHORT = "short";
|
|
375
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_LONG = "long";
|
|
376
|
+
export const WORKSPACE_TIMEOUT_EXTENDED = "extended";
|
|
377
|
+
export const WORKSPACE_TIMEOUT_EXTENDED_ALT = "180m"; // for backwards compatibility since the IDE uses this
|
|
378
|
+
export const WorkspaceTimeoutValues = [
|
|
379
|
+
WORKSPACE_TIMEOUT_DEFAULT_SHORT,
|
|
380
|
+
WORKSPACE_TIMEOUT_DEFAULT_LONG,
|
|
381
|
+
WORKSPACE_TIMEOUT_EXTENDED,
|
|
382
|
+
WORKSPACE_TIMEOUT_EXTENDED_ALT,
|
|
383
|
+
] as const;
|
|
384
|
+
|
|
385
|
+
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
386
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
387
|
+
): GitpodServiceImpl<C, S> {
|
|
312
388
|
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
313
|
-
}
|
|
389
|
+
};
|
|
314
390
|
|
|
315
|
-
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
316
|
-
methods
|
|
317
|
-
|
|
391
|
+
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
392
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
393
|
+
): JsonRpcProxy<S> {
|
|
394
|
+
methods.setClient = methods.setClient || (() => {});
|
|
395
|
+
methods.dispose = methods.dispose || (() => {});
|
|
318
396
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
319
397
|
// @ts-ignore
|
|
320
398
|
get: (target: S, property: keyof S) => {
|
|
321
399
|
const result = target[property];
|
|
322
400
|
if (!result) {
|
|
323
|
-
throw new Error(`Method ${property} not implemented`);
|
|
401
|
+
throw new Error(`Method ${String(property)} not implemented`);
|
|
324
402
|
}
|
|
325
403
|
return result;
|
|
326
|
-
}
|
|
404
|
+
},
|
|
327
405
|
});
|
|
328
|
-
}
|
|
406
|
+
};
|
|
329
407
|
|
|
330
408
|
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
331
409
|
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
332
410
|
|
|
333
411
|
export interface SetWorkspaceTimeoutResult {
|
|
334
|
-
resetTimeoutOnWorkspaces: string[]
|
|
412
|
+
resetTimeoutOnWorkspaces: string[];
|
|
335
413
|
}
|
|
336
414
|
|
|
337
415
|
export interface GetWorkspaceTimeoutResult {
|
|
338
|
-
duration: WorkspaceTimeoutDuration
|
|
339
|
-
|
|
416
|
+
duration: WorkspaceTimeoutDuration;
|
|
417
|
+
durationRaw: string;
|
|
418
|
+
canChange: boolean;
|
|
340
419
|
}
|
|
341
420
|
|
|
342
421
|
export interface StartWorkspaceResult {
|
|
343
|
-
instanceID: string
|
|
344
|
-
workspaceURL?: string
|
|
422
|
+
instanceID: string;
|
|
423
|
+
workspaceURL?: string;
|
|
345
424
|
}
|
|
346
425
|
|
|
347
426
|
export namespace GitpodServer {
|
|
@@ -385,23 +464,23 @@ export namespace GitpodServer {
|
|
|
385
464
|
readonly roundTripTime?: number;
|
|
386
465
|
}
|
|
387
466
|
export interface UpdateOwnAuthProviderParams {
|
|
388
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
467
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
389
468
|
}
|
|
390
469
|
export interface DeleteOwnAuthProviderParams {
|
|
391
|
-
readonly id: string
|
|
470
|
+
readonly id: string;
|
|
392
471
|
}
|
|
393
472
|
export type AdmissionLevel = "owner" | "everyone";
|
|
394
473
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
395
474
|
export interface GenerateNewGitpodTokenOptions {
|
|
396
|
-
name?: string
|
|
397
|
-
type: GitpodTokenType
|
|
398
|
-
scopes?: string[]
|
|
475
|
+
name?: string;
|
|
476
|
+
type: GitpodTokenType;
|
|
477
|
+
scopes?: string[];
|
|
399
478
|
}
|
|
400
479
|
}
|
|
401
480
|
|
|
402
|
-
export const GitpodServerPath =
|
|
481
|
+
export const GitpodServerPath = "/gitpod";
|
|
403
482
|
|
|
404
|
-
export const GitpodServerProxy = Symbol(
|
|
483
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
405
484
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
406
485
|
|
|
407
486
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -415,8 +494,8 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
415
494
|
if (index > -1) {
|
|
416
495
|
this.clients.splice(index, 1);
|
|
417
496
|
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
497
|
+
},
|
|
498
|
+
};
|
|
420
499
|
}
|
|
421
500
|
|
|
422
501
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -425,7 +504,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
425
504
|
try {
|
|
426
505
|
client.onInstanceUpdate(instance);
|
|
427
506
|
} catch (error) {
|
|
428
|
-
console.error(error)
|
|
507
|
+
console.error(error);
|
|
429
508
|
}
|
|
430
509
|
}
|
|
431
510
|
}
|
|
@@ -437,19 +516,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
437
516
|
try {
|
|
438
517
|
client.onPrebuildUpdate(update);
|
|
439
518
|
} catch (error) {
|
|
440
|
-
console.error(error)
|
|
519
|
+
console.error(error);
|
|
441
520
|
}
|
|
442
521
|
}
|
|
443
522
|
}
|
|
444
523
|
}
|
|
445
524
|
|
|
446
|
-
onWorkspaceImageBuildLogs(
|
|
525
|
+
onWorkspaceImageBuildLogs(
|
|
526
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
527
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
528
|
+
): void {
|
|
447
529
|
for (const client of this.clients) {
|
|
448
530
|
if (client.onWorkspaceImageBuildLogs) {
|
|
449
531
|
try {
|
|
450
532
|
client.onWorkspaceImageBuildLogs(info, content);
|
|
451
533
|
} catch (error) {
|
|
452
|
-
console.error(error)
|
|
534
|
+
console.error(error);
|
|
453
535
|
}
|
|
454
536
|
}
|
|
455
537
|
}
|
|
@@ -461,7 +543,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
461
543
|
try {
|
|
462
544
|
client.notifyDidOpenConnection();
|
|
463
545
|
} catch (error) {
|
|
464
|
-
console.error(error)
|
|
546
|
+
console.error(error);
|
|
465
547
|
}
|
|
466
548
|
}
|
|
467
549
|
}
|
|
@@ -473,7 +555,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
473
555
|
try {
|
|
474
556
|
client.notifyDidCloseConnection();
|
|
475
557
|
} catch (error) {
|
|
476
|
-
console.error(error)
|
|
558
|
+
console.error(error);
|
|
477
559
|
}
|
|
478
560
|
}
|
|
479
561
|
}
|
|
@@ -485,64 +567,61 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
485
567
|
try {
|
|
486
568
|
client.onCreditAlert(creditAlert);
|
|
487
569
|
} catch (error) {
|
|
488
|
-
console.error(error)
|
|
570
|
+
console.error(error);
|
|
489
571
|
}
|
|
490
572
|
}
|
|
491
573
|
}
|
|
492
574
|
}
|
|
493
|
-
|
|
494
575
|
}
|
|
495
576
|
|
|
496
577
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
497
578
|
|
|
498
|
-
const hasWindow =
|
|
579
|
+
const hasWindow = typeof window !== "undefined";
|
|
499
580
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
500
581
|
unknown: 0,
|
|
501
582
|
preparing: 1,
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
583
|
+
building: 2,
|
|
584
|
+
pending: 3,
|
|
585
|
+
creating: 4,
|
|
586
|
+
initializing: 5,
|
|
587
|
+
running: 6,
|
|
588
|
+
interrupted: 7,
|
|
589
|
+
stopping: 8,
|
|
590
|
+
stopped: 9,
|
|
509
591
|
};
|
|
510
592
|
export class WorkspaceInstanceUpdateListener {
|
|
511
593
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
512
594
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
513
595
|
|
|
514
|
-
private source:
|
|
596
|
+
private source: "sync" | "update" = "sync";
|
|
515
597
|
|
|
516
598
|
get info(): WorkspaceInfo {
|
|
517
599
|
return this._info;
|
|
518
600
|
}
|
|
519
601
|
|
|
520
|
-
constructor(
|
|
521
|
-
private readonly service: GitpodService,
|
|
522
|
-
private _info: WorkspaceInfo
|
|
523
|
-
) {
|
|
602
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
524
603
|
service.registerClient({
|
|
525
|
-
onInstanceUpdate: instance => {
|
|
604
|
+
onInstanceUpdate: (instance) => {
|
|
526
605
|
if (this.isOutOfOrder(instance)) {
|
|
527
606
|
return;
|
|
528
607
|
}
|
|
529
608
|
this.cancelSync();
|
|
530
609
|
this._info.latestInstance = instance;
|
|
531
|
-
this.source =
|
|
610
|
+
this.source = "update";
|
|
532
611
|
this.onDidChangeEmitter.fire(undefined);
|
|
533
612
|
},
|
|
534
613
|
notifyDidOpenConnection: () => {
|
|
535
614
|
this.sync();
|
|
536
|
-
}
|
|
615
|
+
},
|
|
537
616
|
});
|
|
538
617
|
if (hasWindow) {
|
|
539
618
|
// 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 ===
|
|
619
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
620
|
+
if (window.document.visibilityState === "visible") {
|
|
542
621
|
this.sync();
|
|
543
622
|
}
|
|
544
623
|
});
|
|
545
|
-
window.addEventListener(
|
|
624
|
+
window.addEventListener("pageshow", (e) => {
|
|
546
625
|
if (e.persisted) {
|
|
547
626
|
this.sync();
|
|
548
627
|
}
|
|
@@ -570,12 +649,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
570
649
|
return;
|
|
571
650
|
}
|
|
572
651
|
this._info = info;
|
|
573
|
-
this.source =
|
|
652
|
+
this.source = "sync";
|
|
574
653
|
this.onDidChangeEmitter.fire(undefined);
|
|
575
654
|
} catch (e) {
|
|
576
|
-
console.error(
|
|
655
|
+
console.error("failed to sync workspace instance:", e);
|
|
577
656
|
}
|
|
578
|
-
})
|
|
657
|
+
});
|
|
579
658
|
}
|
|
580
659
|
private cancelSync(): void {
|
|
581
660
|
if (this.syncTokenSource) {
|
|
@@ -592,7 +671,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
592
671
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
593
672
|
return true;
|
|
594
673
|
}
|
|
595
|
-
if (this.source ===
|
|
674
|
+
if (this.source === "update") {
|
|
596
675
|
return false;
|
|
597
676
|
}
|
|
598
677
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -600,15 +679,13 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
600
679
|
}
|
|
601
680
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
602
681
|
}
|
|
603
|
-
|
|
604
682
|
}
|
|
605
683
|
|
|
606
684
|
export interface GitpodServiceOptions {
|
|
607
|
-
onReconnect?: () =>
|
|
685
|
+
onReconnect?: () => void | Promise<void>;
|
|
608
686
|
}
|
|
609
687
|
|
|
610
688
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
611
|
-
|
|
612
689
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
613
690
|
|
|
614
691
|
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
@@ -623,7 +700,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
623
700
|
|
|
624
701
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
625
702
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
626
|
-
const listener =
|
|
703
|
+
const listener =
|
|
704
|
+
this.instanceListeners.get(workspaceId) ||
|
|
627
705
|
(async () => {
|
|
628
706
|
const info = await this.server.getWorkspace(workspaceId);
|
|
629
707
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -639,26 +717,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
639
717
|
}
|
|
640
718
|
}
|
|
641
719
|
|
|
642
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
720
|
+
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
721
|
+
serverUrl: string | Promise<string>,
|
|
722
|
+
) {
|
|
643
723
|
const toWsUrl = (serverUrl: string) => {
|
|
644
|
-
return new GitpodHostUrl(serverUrl)
|
|
645
|
-
.asWebsocket()
|
|
646
|
-
.withApi({ pathname: GitpodServerPath })
|
|
647
|
-
.toString();
|
|
724
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
648
725
|
};
|
|
649
726
|
let url: string | Promise<string>;
|
|
650
727
|
if (typeof serverUrl === "string") {
|
|
651
728
|
url = toWsUrl(serverUrl);
|
|
652
729
|
} else {
|
|
653
|
-
url = serverUrl.then(url => toWsUrl(url));
|
|
730
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
654
731
|
}
|
|
655
732
|
|
|
656
733
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
657
|
-
let onReconnect = () => {
|
|
734
|
+
let onReconnect = () => {};
|
|
658
735
|
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
659
|
-
onListening: socket => {
|
|
736
|
+
onListening: (socket) => {
|
|
660
737
|
onReconnect = () => socket.reconnect();
|
|
661
|
-
}
|
|
738
|
+
},
|
|
662
739
|
});
|
|
663
740
|
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
664
|
-
}
|
|
741
|
+
}
|
|
@@ -4,21 +4,23 @@
|
|
|
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",
|
|
11
10
|
FinishedButFailed = "finish-fail",
|
|
12
11
|
AbortedTimedOut = "aborted-timeout",
|
|
13
12
|
Aborted = "aborted",
|
|
14
|
-
|
|
13
|
+
Failed = "failed",
|
|
14
|
+
Started = "started",
|
|
15
15
|
}
|
|
16
16
|
export namespace HeadlessWorkspaceEventType {
|
|
17
17
|
export function isRunning(t: HeadlessWorkspaceEventType) {
|
|
18
18
|
return t === HeadlessWorkspaceEventType.LogOutput;
|
|
19
19
|
}
|
|
20
20
|
export function didFinish(t: HeadlessWorkspaceEventType) {
|
|
21
|
-
return
|
|
21
|
+
return (
|
|
22
|
+
t === HeadlessWorkspaceEventType.FinishedButFailed || t === HeadlessWorkspaceEventType.FinishedSuccessfully
|
|
23
|
+
);
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -35,4 +37,4 @@ export interface HeadlessLogUrls {
|
|
|
35
37
|
|
|
36
38
|
/** cmp. @const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX */
|
|
37
39
|
export const HEADLESS_LOG_STREAM_STATUS_CODE = "X-LogStream-StatusCode";
|
|
38
|
-
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
|
+
}
|