@gitpod/gitpod-protocol 0.1.5-wth-test.41 → 0.1.5-yh-vmoptions-fork.3
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 +199 -7
- package/lib/accounting-protocol.d.ts +17 -10
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +30 -32
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +12 -0
- 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/auth.d.ts.map +1 -1
- package/lib/context-url.d.ts +18 -5
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +59 -6
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +2 -0
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +40 -4
- 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/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 +61 -28
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +43 -34
- 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 +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 -14
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +27 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +30 -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 +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 -2
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +20 -20
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +3 -0
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +6 -0
- 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.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +23 -59
- 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/oss-allowlist.d.ts +14 -0
- package/lib/oss-allowlist.d.ts.map +1 -0
- package/lib/oss-allowlist.js +8 -0
- package/lib/oss-allowlist.js.map +1 -0
- package/lib/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +1 -1
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +9 -3
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +34 -25
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +3 -3
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +206 -171
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +109 -74
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +177 -87
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.spec.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +21 -3
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +16 -5
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +17 -2
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +8 -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/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/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 +1 -0
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +6 -2
- 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 +461 -440
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +36 -1
- 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 +0 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +34 -35
- 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.map +1 -1
- package/lib/util/grpc.js.map +1 -1
- 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 +1 -1
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +23 -24
- 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.map +1 -1
- package/lib/util/parse-workspace-id.js +2 -3
- 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/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.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 +1 -0
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +9 -3
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- 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 +156 -19
- 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 +8 -11
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +10 -8
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +16 -1
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +38 -3
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +2 -2
- package/package.json +10 -8
- package/pkg-yarn.lock +6 -6
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +63 -51
- package/src/admin-protocol.ts +35 -18
- package/src/analytics.ts +26 -28
- package/src/auth.ts +2 -2
- package/src/context-url.spec.ts +37 -9
- package/src/context-url.ts +94 -36
- 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/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +185 -112
- package/src/headless-workspace-log.ts +6 -4
- package/src/ide-frontend-service.ts +2 -2
- package/src/ide-protocol.ts +119 -0
- package/src/index.ts +16 -14
- package/src/installation-admin-protocol.ts +42 -0
- 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 +70 -71
- package/src/messaging/error.ts +10 -3
- package/src/messaging/handler.ts +6 -6
- package/src/messaging/node/connection.ts +23 -70
- package/src/messaging/proxy-factory.ts +23 -30
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +2 -2
- package/src/permission.ts +40 -32
- package/src/plans.ts +236 -189
- package/src/protocol.ts +383 -275
- package/src/snapshot-url.spec.ts +9 -7
- package/src/team-subscription-protocol.ts +57 -23
- package/src/teams-projects-protocol.ts +29 -8
- package/src/typings/globals.ts +4 -4
- 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/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 +34 -7
- package/src/util/generate-workspace-id.ts +464 -440
- 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 +40 -41
- package/src/util/grpc.ts +1 -1
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +49 -40
- 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 +6 -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 +26 -15
- package/src/workspace-instance.ts +69 -20
- 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 -34
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.js.map +0 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -65
- 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 -31
- package/lib/util/safe-promise.js.map +0 -1
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/theia-plugins.ts +0 -11
- 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,58 @@
|
|
|
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
|
+
} from "./protocol";
|
|
14
28
|
import {
|
|
15
|
-
Team,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
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";
|
|
32
60
|
|
|
33
61
|
export interface GitpodClient {
|
|
34
62
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
@@ -44,8 +72,8 @@ export interface GitpodClient {
|
|
|
44
72
|
//#endregion
|
|
45
73
|
}
|
|
46
74
|
|
|
47
|
-
export const GitpodServer = Symbol(
|
|
48
|
-
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
|
|
75
|
+
export const GitpodServer = Symbol("GitpodServer");
|
|
76
|
+
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
49
77
|
// User related API
|
|
50
78
|
getLoggedInUser(): Promise<User>;
|
|
51
79
|
getTerms(): Promise<Terms>;
|
|
@@ -54,7 +82,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
54
82
|
getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
|
|
55
83
|
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
|
|
56
84
|
deleteOwnAuthProvider(params: GitpodServer.DeleteOwnAuthProviderParams): Promise<void>;
|
|
57
|
-
getBranding(): Promise<Branding>;
|
|
58
85
|
getConfiguration(): Promise<Configuration>;
|
|
59
86
|
getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
|
|
60
87
|
getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
|
|
@@ -71,8 +98,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
71
98
|
getWorkspaceOwner(workspaceId: string): Promise<UserInfo | undefined>;
|
|
72
99
|
getWorkspaceUsers(workspaceId: string): Promise<WorkspaceInstanceUser[]>;
|
|
73
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
|
+
*/
|
|
74
107
|
getWorkspace(id: string): Promise<WorkspaceInfo>;
|
|
75
108
|
isWorkspaceOwner(workspaceId: string): Promise<boolean>;
|
|
109
|
+
getOwnerToken(workspaceId: string): Promise<string>;
|
|
76
110
|
|
|
77
111
|
/**
|
|
78
112
|
* Creates and starts a workspace for the given context URL.
|
|
@@ -125,6 +159,11 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
125
159
|
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
126
160
|
deleteTeam(teamId: string, userId: string): Promise<void>;
|
|
127
161
|
|
|
162
|
+
// Admin Settings
|
|
163
|
+
adminGetSettings(): Promise<InstallationAdminSettings>;
|
|
164
|
+
adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
|
|
165
|
+
adminGetTelemetryData(): Promise<TelemetryData>;
|
|
166
|
+
|
|
128
167
|
// Projects
|
|
129
168
|
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
130
169
|
createProject(params: CreateProjectParams): Promise<Project>;
|
|
@@ -135,13 +174,19 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
135
174
|
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
136
175
|
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
137
176
|
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
138
|
-
setProjectConfiguration(projectId: string, configString: string): Promise<void>;
|
|
139
177
|
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
140
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>;
|
|
141
186
|
|
|
142
187
|
// content service
|
|
143
|
-
getContentBlobUploadUrl(name: string): Promise<string
|
|
144
|
-
getContentBlobDownloadUrl(name: string): Promise<string
|
|
188
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
189
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
145
190
|
|
|
146
191
|
// Gitpod token
|
|
147
192
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
@@ -150,6 +195,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
150
195
|
|
|
151
196
|
// misc
|
|
152
197
|
sendFeedback(feedback: string): Promise<string | undefined>;
|
|
198
|
+
isGitHubAppEnabled(): Promise<boolean>;
|
|
153
199
|
registerGithubApp(installationId: string): Promise<void>;
|
|
154
200
|
|
|
155
201
|
/**
|
|
@@ -178,15 +224,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
178
224
|
*/
|
|
179
225
|
getLayout(workspaceId: string): Promise<string | undefined>;
|
|
180
226
|
|
|
181
|
-
/**
|
|
182
|
-
* @param params
|
|
183
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
184
|
-
*/
|
|
185
|
-
preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
|
|
186
|
-
resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
|
|
187
|
-
installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
|
|
188
|
-
uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
|
|
189
|
-
|
|
190
227
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
191
228
|
|
|
192
229
|
/**
|
|
@@ -204,7 +241,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
204
241
|
*/
|
|
205
242
|
getChargebeeSiteId(): Promise<string>;
|
|
206
243
|
createPortalSession(): Promise<{}>;
|
|
244
|
+
createTeamPortalSession(teamId: string): Promise<{}>;
|
|
207
245
|
checkout(planId: string, planQuantity?: number): Promise<{}>;
|
|
246
|
+
teamCheckout(teamId: string, planId: string): Promise<{}>;
|
|
208
247
|
getAvailableCoupons(): Promise<PlanCoupon[]>;
|
|
209
248
|
getAppliedCoupons(): Promise<PlanCoupon[]>;
|
|
210
249
|
|
|
@@ -216,17 +255,28 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
216
255
|
subscriptionCancel(subscriptionId: string): Promise<void>;
|
|
217
256
|
subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
|
|
218
257
|
|
|
258
|
+
getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
|
|
219
259
|
tsGet(): Promise<TeamSubscription[]>;
|
|
220
260
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
221
|
-
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined
|
|
261
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
222
262
|
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
223
|
-
tsAssignSlot(
|
|
263
|
+
tsAssignSlot(
|
|
264
|
+
teamSubscriptionId: string,
|
|
265
|
+
teamSubscriptionSlotId: string,
|
|
266
|
+
identityStr: string | undefined,
|
|
267
|
+
): Promise<void>;
|
|
224
268
|
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
225
269
|
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
226
270
|
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
227
271
|
|
|
228
272
|
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
229
273
|
|
|
274
|
+
getStripePublishableKey(): Promise<string>;
|
|
275
|
+
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
276
|
+
findStripeCustomerIdForTeam(teamId: string): Promise<string | undefined>;
|
|
277
|
+
subscribeTeamToStripe(teamId: string, setupIntentId: string, currency: Currency): Promise<void>;
|
|
278
|
+
getStripePortalUrlForTeam(teamId: string): Promise<string>;
|
|
279
|
+
|
|
230
280
|
/**
|
|
231
281
|
* Analytics
|
|
232
282
|
*/
|
|
@@ -235,6 +285,16 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
235
285
|
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
236
286
|
}
|
|
237
287
|
|
|
288
|
+
export interface RateLimiterError {
|
|
289
|
+
method?: string;
|
|
290
|
+
|
|
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;
|
|
296
|
+
}
|
|
297
|
+
|
|
238
298
|
export interface CreateProjectParams {
|
|
239
299
|
name: string;
|
|
240
300
|
slug?: string;
|
|
@@ -263,11 +323,11 @@ export interface ProviderRepository {
|
|
|
263
323
|
account: string;
|
|
264
324
|
accountAvatarUrl: string;
|
|
265
325
|
cloneUrl: string;
|
|
266
|
-
updatedAt
|
|
326
|
+
updatedAt?: string;
|
|
267
327
|
installationId?: number;
|
|
268
328
|
installationUpdatedAt?: string;
|
|
269
329
|
|
|
270
|
-
inUse?:
|
|
330
|
+
inUse?: { userName: string };
|
|
271
331
|
}
|
|
272
332
|
|
|
273
333
|
export interface ClientHeaderFields {
|
|
@@ -277,15 +337,28 @@ export interface ClientHeaderFields {
|
|
|
277
337
|
clientRegion?: string;
|
|
278
338
|
}
|
|
279
339
|
|
|
280
|
-
export const
|
|
281
|
-
|
|
282
|
-
export const
|
|
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> {
|
|
283
354
|
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
284
|
-
}
|
|
355
|
+
};
|
|
285
356
|
|
|
286
|
-
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
287
|
-
methods
|
|
288
|
-
|
|
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 || (() => {});
|
|
289
362
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
290
363
|
// @ts-ignore
|
|
291
364
|
get: (target: S, property: keyof S) => {
|
|
@@ -294,25 +367,25 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
|
|
|
294
367
|
throw new Error(`Method ${property} not implemented`);
|
|
295
368
|
}
|
|
296
369
|
return result;
|
|
297
|
-
}
|
|
370
|
+
},
|
|
298
371
|
});
|
|
299
|
-
}
|
|
372
|
+
};
|
|
300
373
|
|
|
301
374
|
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
302
375
|
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
303
376
|
|
|
304
377
|
export interface SetWorkspaceTimeoutResult {
|
|
305
|
-
resetTimeoutOnWorkspaces: string[]
|
|
378
|
+
resetTimeoutOnWorkspaces: string[];
|
|
306
379
|
}
|
|
307
380
|
|
|
308
381
|
export interface GetWorkspaceTimeoutResult {
|
|
309
|
-
duration: WorkspaceTimeoutDuration
|
|
310
|
-
canChange: boolean
|
|
382
|
+
duration: WorkspaceTimeoutDuration;
|
|
383
|
+
canChange: boolean;
|
|
311
384
|
}
|
|
312
385
|
|
|
313
386
|
export interface StartWorkspaceResult {
|
|
314
|
-
instanceID: string
|
|
315
|
-
workspaceURL?: string
|
|
387
|
+
instanceID: string;
|
|
388
|
+
workspaceURL?: string;
|
|
316
389
|
}
|
|
317
390
|
|
|
318
391
|
export namespace GitpodServer {
|
|
@@ -356,23 +429,23 @@ export namespace GitpodServer {
|
|
|
356
429
|
readonly roundTripTime?: number;
|
|
357
430
|
}
|
|
358
431
|
export interface UpdateOwnAuthProviderParams {
|
|
359
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
432
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
360
433
|
}
|
|
361
434
|
export interface DeleteOwnAuthProviderParams {
|
|
362
|
-
readonly id: string
|
|
435
|
+
readonly id: string;
|
|
363
436
|
}
|
|
364
437
|
export type AdmissionLevel = "owner" | "everyone";
|
|
365
438
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
366
439
|
export interface GenerateNewGitpodTokenOptions {
|
|
367
|
-
name?: string
|
|
368
|
-
type: GitpodTokenType
|
|
369
|
-
scopes?: string[]
|
|
440
|
+
name?: string;
|
|
441
|
+
type: GitpodTokenType;
|
|
442
|
+
scopes?: string[];
|
|
370
443
|
}
|
|
371
444
|
}
|
|
372
445
|
|
|
373
|
-
export const GitpodServerPath =
|
|
446
|
+
export const GitpodServerPath = "/gitpod";
|
|
374
447
|
|
|
375
|
-
export const GitpodServerProxy = Symbol(
|
|
448
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
376
449
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
377
450
|
|
|
378
451
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -380,12 +453,14 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
380
453
|
|
|
381
454
|
public registerClient(client: Partial<Client>): Disposable {
|
|
382
455
|
this.clients.push(client);
|
|
383
|
-
const index = this.clients.length;
|
|
384
456
|
return {
|
|
385
457
|
dispose: () => {
|
|
386
|
-
this.clients.
|
|
387
|
-
|
|
388
|
-
|
|
458
|
+
const index = this.clients.indexOf(client);
|
|
459
|
+
if (index > -1) {
|
|
460
|
+
this.clients.splice(index, 1);
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
};
|
|
389
464
|
}
|
|
390
465
|
|
|
391
466
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -394,7 +469,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
394
469
|
try {
|
|
395
470
|
client.onInstanceUpdate(instance);
|
|
396
471
|
} catch (error) {
|
|
397
|
-
console.error(error)
|
|
472
|
+
console.error(error);
|
|
398
473
|
}
|
|
399
474
|
}
|
|
400
475
|
}
|
|
@@ -406,19 +481,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
406
481
|
try {
|
|
407
482
|
client.onPrebuildUpdate(update);
|
|
408
483
|
} catch (error) {
|
|
409
|
-
console.error(error)
|
|
484
|
+
console.error(error);
|
|
410
485
|
}
|
|
411
486
|
}
|
|
412
487
|
}
|
|
413
488
|
}
|
|
414
489
|
|
|
415
|
-
onWorkspaceImageBuildLogs(
|
|
490
|
+
onWorkspaceImageBuildLogs(
|
|
491
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
492
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
493
|
+
): void {
|
|
416
494
|
for (const client of this.clients) {
|
|
417
495
|
if (client.onWorkspaceImageBuildLogs) {
|
|
418
496
|
try {
|
|
419
497
|
client.onWorkspaceImageBuildLogs(info, content);
|
|
420
498
|
} catch (error) {
|
|
421
|
-
console.error(error)
|
|
499
|
+
console.error(error);
|
|
422
500
|
}
|
|
423
501
|
}
|
|
424
502
|
}
|
|
@@ -430,7 +508,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
430
508
|
try {
|
|
431
509
|
client.notifyDidOpenConnection();
|
|
432
510
|
} catch (error) {
|
|
433
|
-
console.error(error)
|
|
511
|
+
console.error(error);
|
|
434
512
|
}
|
|
435
513
|
}
|
|
436
514
|
}
|
|
@@ -442,7 +520,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
442
520
|
try {
|
|
443
521
|
client.notifyDidCloseConnection();
|
|
444
522
|
} catch (error) {
|
|
445
|
-
console.error(error)
|
|
523
|
+
console.error(error);
|
|
446
524
|
}
|
|
447
525
|
}
|
|
448
526
|
}
|
|
@@ -454,64 +532,61 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
454
532
|
try {
|
|
455
533
|
client.onCreditAlert(creditAlert);
|
|
456
534
|
} catch (error) {
|
|
457
|
-
console.error(error)
|
|
535
|
+
console.error(error);
|
|
458
536
|
}
|
|
459
537
|
}
|
|
460
538
|
}
|
|
461
539
|
}
|
|
462
|
-
|
|
463
540
|
}
|
|
464
541
|
|
|
465
542
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
466
543
|
|
|
467
|
-
const hasWindow =
|
|
544
|
+
const hasWindow = typeof window !== "undefined";
|
|
468
545
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
469
546
|
unknown: 0,
|
|
470
547
|
preparing: 1,
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
548
|
+
building: 2,
|
|
549
|
+
pending: 3,
|
|
550
|
+
creating: 4,
|
|
551
|
+
initializing: 5,
|
|
552
|
+
running: 6,
|
|
553
|
+
interrupted: 7,
|
|
554
|
+
stopping: 8,
|
|
555
|
+
stopped: 9,
|
|
478
556
|
};
|
|
479
557
|
export class WorkspaceInstanceUpdateListener {
|
|
480
558
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
481
559
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
482
560
|
|
|
483
|
-
private source:
|
|
561
|
+
private source: "sync" | "update" = "sync";
|
|
484
562
|
|
|
485
563
|
get info(): WorkspaceInfo {
|
|
486
564
|
return this._info;
|
|
487
565
|
}
|
|
488
566
|
|
|
489
|
-
constructor(
|
|
490
|
-
private readonly service: GitpodService,
|
|
491
|
-
private _info: WorkspaceInfo
|
|
492
|
-
) {
|
|
567
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
493
568
|
service.registerClient({
|
|
494
|
-
onInstanceUpdate: instance => {
|
|
569
|
+
onInstanceUpdate: (instance) => {
|
|
495
570
|
if (this.isOutOfOrder(instance)) {
|
|
496
571
|
return;
|
|
497
572
|
}
|
|
498
573
|
this.cancelSync();
|
|
499
574
|
this._info.latestInstance = instance;
|
|
500
|
-
this.source =
|
|
575
|
+
this.source = "update";
|
|
501
576
|
this.onDidChangeEmitter.fire(undefined);
|
|
502
577
|
},
|
|
503
578
|
notifyDidOpenConnection: () => {
|
|
504
579
|
this.sync();
|
|
505
|
-
}
|
|
580
|
+
},
|
|
506
581
|
});
|
|
507
582
|
if (hasWindow) {
|
|
508
583
|
// learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
|
|
509
|
-
window.document.addEventListener(
|
|
510
|
-
if (window.document.visibilityState ===
|
|
584
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
585
|
+
if (window.document.visibilityState === "visible") {
|
|
511
586
|
this.sync();
|
|
512
587
|
}
|
|
513
588
|
});
|
|
514
|
-
window.addEventListener(
|
|
589
|
+
window.addEventListener("pageshow", (e) => {
|
|
515
590
|
if (e.persisted) {
|
|
516
591
|
this.sync();
|
|
517
592
|
}
|
|
@@ -539,12 +614,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
539
614
|
return;
|
|
540
615
|
}
|
|
541
616
|
this._info = info;
|
|
542
|
-
this.source =
|
|
617
|
+
this.source = "sync";
|
|
543
618
|
this.onDidChangeEmitter.fire(undefined);
|
|
544
619
|
} catch (e) {
|
|
545
|
-
console.error(
|
|
620
|
+
console.error("failed to sync workspace instance:", e);
|
|
546
621
|
}
|
|
547
|
-
})
|
|
622
|
+
});
|
|
548
623
|
}
|
|
549
624
|
private cancelSync(): void {
|
|
550
625
|
if (this.syncTokenSource) {
|
|
@@ -561,7 +636,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
561
636
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
562
637
|
return true;
|
|
563
638
|
}
|
|
564
|
-
if (this.source ===
|
|
639
|
+
if (this.source === "update") {
|
|
565
640
|
return false;
|
|
566
641
|
}
|
|
567
642
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -569,15 +644,13 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
569
644
|
}
|
|
570
645
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
571
646
|
}
|
|
572
|
-
|
|
573
647
|
}
|
|
574
648
|
|
|
575
649
|
export interface GitpodServiceOptions {
|
|
576
|
-
onReconnect?: () =>
|
|
650
|
+
onReconnect?: () => void | Promise<void>;
|
|
577
651
|
}
|
|
578
652
|
|
|
579
653
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
580
|
-
|
|
581
654
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
582
655
|
|
|
583
656
|
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
@@ -592,7 +665,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
592
665
|
|
|
593
666
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
594
667
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
595
|
-
const listener =
|
|
668
|
+
const listener =
|
|
669
|
+
this.instanceListeners.get(workspaceId) ||
|
|
596
670
|
(async () => {
|
|
597
671
|
const info = await this.server.getWorkspace(workspaceId);
|
|
598
672
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -608,26 +682,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
608
682
|
}
|
|
609
683
|
}
|
|
610
684
|
|
|
611
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
685
|
+
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
686
|
+
serverUrl: string | Promise<string>,
|
|
687
|
+
) {
|
|
612
688
|
const toWsUrl = (serverUrl: string) => {
|
|
613
|
-
return new GitpodHostUrl(serverUrl)
|
|
614
|
-
.asWebsocket()
|
|
615
|
-
.withApi({ pathname: GitpodServerPath })
|
|
616
|
-
.toString();
|
|
689
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
617
690
|
};
|
|
618
691
|
let url: string | Promise<string>;
|
|
619
692
|
if (typeof serverUrl === "string") {
|
|
620
693
|
url = toWsUrl(serverUrl);
|
|
621
694
|
} else {
|
|
622
|
-
url = serverUrl.then(url => toWsUrl(url));
|
|
695
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
623
696
|
}
|
|
624
697
|
|
|
625
698
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
626
|
-
let onReconnect = () => {
|
|
699
|
+
let onReconnect = () => {};
|
|
627
700
|
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
628
|
-
onListening: socket => {
|
|
701
|
+
onListening: (socket) => {
|
|
629
702
|
onReconnect = () => socket.reconnect();
|
|
630
|
-
}
|
|
703
|
+
},
|
|
631
704
|
});
|
|
632
705
|
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
633
|
-
}
|
|
706
|
+
}
|
|
@@ -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
|
+
}
|