@gitpod/gitpod-protocol 0.1.5-server-vscode-oauth2.11 → 0.1.5-server-vscode-oauth2.14
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 +49 -4
- package/lib/accounting-protocol.d.ts +10 -11
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +26 -36
- 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 -4
- 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 +2 -2
- 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 +8 -8
- 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 +4 -4
- 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 +9 -11
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +1 -1
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +6 -6
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +7 -7
- 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 -31
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +26 -27
- 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 -13
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -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.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 +21 -21
- 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 +10 -7
- 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 +21 -21
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +2 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +4 -2
- 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 +4 -4
- 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 +83 -78
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +96 -85
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/{src/theia-plugins.ts → lib/snapshot-url.spec.d.ts} +2 -6
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.d.ts +5 -3
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +7 -7
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +13 -2
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +10 -3
- 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 +1 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +452 -435
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +29 -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 +1 -4
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts +1 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +35 -33
- 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 +33 -33
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +22 -23
- 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 +12 -12
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.spec.js +13 -10
- 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.map +1 -1
- package/lib/util/timeutil.js +8 -8
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +2 -2
- 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 +161 -22
- 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 +17 -2
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +23 -4
- 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 +21 -14
- package/pkg-yarn.lock +12 -8
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +53 -53
- package/src/admin-protocol.ts +35 -18
- package/src/analytics.ts +27 -27
- 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 +9 -9
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +167 -113
- 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 -13
- package/src/installation-admin-protocol.ts +42 -0
- package/src/license-protocol.ts +5 -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 +6 -5
- 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 +280 -277
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +33 -23
- package/src/teams-projects-protocol.ts +24 -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 +26 -6
- package/src/util/generate-workspace-id.ts +458 -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 +41 -38
- package/src/util/grpc.ts +1 -1
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +81 -71
- 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 +15 -11
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +202 -31
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/workspace-cluster.ts +26 -15
- package/src/workspace-instance.ts +48 -24
- 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/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,52 @@
|
|
|
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 { TeamSubscription, TeamSubscriptionSlot, TeamSubscriptionSlotResolved } from "./team-subscription-protocol";
|
|
51
|
+
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
|
|
52
|
+
import { IDEServer } from "./ide-protocol";
|
|
53
|
+
import { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
|
|
32
54
|
|
|
33
55
|
export interface GitpodClient {
|
|
34
56
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
@@ -44,8 +66,8 @@ export interface GitpodClient {
|
|
|
44
66
|
//#endregion
|
|
45
67
|
}
|
|
46
68
|
|
|
47
|
-
export const GitpodServer = Symbol(
|
|
48
|
-
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
|
|
69
|
+
export const GitpodServer = Symbol("GitpodServer");
|
|
70
|
+
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
49
71
|
// User related API
|
|
50
72
|
getLoggedInUser(): Promise<User>;
|
|
51
73
|
getTerms(): Promise<Terms>;
|
|
@@ -54,7 +76,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
54
76
|
getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
|
|
55
77
|
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
|
|
56
78
|
deleteOwnAuthProvider(params: GitpodServer.DeleteOwnAuthProviderParams): Promise<void>;
|
|
57
|
-
getBranding(): Promise<Branding>;
|
|
58
79
|
getConfiguration(): Promise<Configuration>;
|
|
59
80
|
getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
|
|
60
81
|
getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
|
|
@@ -71,8 +92,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
71
92
|
getWorkspaceOwner(workspaceId: string): Promise<UserInfo | undefined>;
|
|
72
93
|
getWorkspaceUsers(workspaceId: string): Promise<WorkspaceInstanceUser[]>;
|
|
73
94
|
getFeaturedRepositories(): Promise<WhitelistedRepository[]>;
|
|
95
|
+
getSuggestedContextURLs(): Promise<string[]>;
|
|
96
|
+
/**
|
|
97
|
+
* **Security:**
|
|
98
|
+
* Sensitive information like an owner token is erased, since it allows access for all team members.
|
|
99
|
+
* If you need to access an owner token use `getOwnerToken` instead.
|
|
100
|
+
*/
|
|
74
101
|
getWorkspace(id: string): Promise<WorkspaceInfo>;
|
|
75
102
|
isWorkspaceOwner(workspaceId: string): Promise<boolean>;
|
|
103
|
+
getOwnerToken(workspaceId: string): Promise<string>;
|
|
76
104
|
|
|
77
105
|
/**
|
|
78
106
|
* Creates and starts a workspace for the given context URL.
|
|
@@ -125,6 +153,11 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
125
153
|
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
126
154
|
deleteTeam(teamId: string, userId: string): Promise<void>;
|
|
127
155
|
|
|
156
|
+
// Admin Settings
|
|
157
|
+
adminGetSettings(): Promise<InstallationAdminSettings>;
|
|
158
|
+
adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
|
|
159
|
+
adminGetTelemetryData(): Promise<TelemetryData>;
|
|
160
|
+
|
|
128
161
|
// Projects
|
|
129
162
|
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
130
163
|
createProject(params: CreateProjectParams): Promise<Project>;
|
|
@@ -135,13 +168,19 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
135
168
|
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
136
169
|
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
137
170
|
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
138
|
-
setProjectConfiguration(projectId: string, configString: string): Promise<void>;
|
|
139
171
|
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
140
172
|
guessProjectConfiguration(projectId: string): Promise<string | undefined>;
|
|
173
|
+
fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
174
|
+
guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
175
|
+
setProjectConfiguration(projectId: string, configString: string): Promise<void>;
|
|
176
|
+
updateProjectPartial(partialProject: PartialProject): Promise<void>;
|
|
177
|
+
setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
|
|
178
|
+
getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
|
|
179
|
+
deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
|
|
141
180
|
|
|
142
181
|
// content service
|
|
143
|
-
getContentBlobUploadUrl(name: string): Promise<string
|
|
144
|
-
getContentBlobDownloadUrl(name: string): Promise<string
|
|
182
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
183
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
145
184
|
|
|
146
185
|
// Gitpod token
|
|
147
186
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
@@ -153,10 +192,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
153
192
|
registerGithubApp(installationId: string): Promise<void>;
|
|
154
193
|
|
|
155
194
|
/**
|
|
156
|
-
* Stores a new snapshot for the given workspace and bucketId
|
|
195
|
+
* Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
|
|
157
196
|
* @return the snapshot id
|
|
158
197
|
*/
|
|
159
198
|
takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
|
|
199
|
+
/**
|
|
200
|
+
*
|
|
201
|
+
* @param snapshotId
|
|
202
|
+
*/
|
|
203
|
+
waitForSnapshot(snapshotId: string): Promise<void>;
|
|
160
204
|
|
|
161
205
|
/**
|
|
162
206
|
* Returns the list of snapshots that exist for a workspace.
|
|
@@ -173,23 +217,12 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
173
217
|
*/
|
|
174
218
|
getLayout(workspaceId: string): Promise<string | undefined>;
|
|
175
219
|
|
|
176
|
-
/**
|
|
177
|
-
* @param params
|
|
178
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
179
|
-
*/
|
|
180
|
-
preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
|
|
181
|
-
resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
|
|
182
|
-
installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
|
|
183
|
-
uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
|
|
184
|
-
|
|
185
220
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
186
221
|
|
|
187
222
|
/**
|
|
188
223
|
* gitpod.io concerns
|
|
189
224
|
*/
|
|
190
225
|
isStudent(): Promise<boolean>;
|
|
191
|
-
getPrivateRepoTrialEndDate(): Promise<string | undefined>;
|
|
192
|
-
|
|
193
226
|
/**
|
|
194
227
|
*
|
|
195
228
|
*/
|
|
@@ -207,7 +240,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
207
240
|
|
|
208
241
|
getShowPaymentUI(): Promise<boolean>;
|
|
209
242
|
isChargebeeCustomer(): Promise<boolean>;
|
|
210
|
-
mayAccessPrivateRepo(): Promise<boolean>;
|
|
211
243
|
|
|
212
244
|
subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
213
245
|
subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
@@ -216,9 +248,13 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
216
248
|
|
|
217
249
|
tsGet(): Promise<TeamSubscription[]>;
|
|
218
250
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
219
|
-
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined
|
|
251
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
220
252
|
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
221
|
-
tsAssignSlot(
|
|
253
|
+
tsAssignSlot(
|
|
254
|
+
teamSubscriptionId: string,
|
|
255
|
+
teamSubscriptionSlotId: string,
|
|
256
|
+
identityStr: string | undefined,
|
|
257
|
+
): Promise<void>;
|
|
222
258
|
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
223
259
|
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
224
260
|
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
@@ -230,10 +266,22 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
230
266
|
*/
|
|
231
267
|
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
232
268
|
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
269
|
+
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface RateLimiterError {
|
|
273
|
+
method?: string;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Retry after this many seconds, earliest.
|
|
277
|
+
* cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
278
|
+
*/
|
|
279
|
+
retryAfter: number;
|
|
233
280
|
}
|
|
234
281
|
|
|
235
282
|
export interface CreateProjectParams {
|
|
236
283
|
name: string;
|
|
284
|
+
slug?: string;
|
|
237
285
|
account: string;
|
|
238
286
|
provider: string;
|
|
239
287
|
cloneUrl: string;
|
|
@@ -255,32 +303,37 @@ export interface GetProviderRepositoriesParams {
|
|
|
255
303
|
}
|
|
256
304
|
export interface ProviderRepository {
|
|
257
305
|
name: string;
|
|
306
|
+
path?: string;
|
|
258
307
|
account: string;
|
|
259
308
|
accountAvatarUrl: string;
|
|
260
309
|
cloneUrl: string;
|
|
261
|
-
updatedAt
|
|
310
|
+
updatedAt?: string;
|
|
262
311
|
installationId?: number;
|
|
263
312
|
installationUpdatedAt?: string;
|
|
264
313
|
|
|
265
|
-
inUse?:
|
|
314
|
+
inUse?: { userName: string };
|
|
266
315
|
}
|
|
267
316
|
|
|
268
|
-
export interface ClientHeaderFields{
|
|
269
|
-
ip?:string;
|
|
270
|
-
userAgent?:string;
|
|
271
|
-
dnt?:
|
|
272
|
-
clientRegion?:string;
|
|
317
|
+
export interface ClientHeaderFields {
|
|
318
|
+
ip?: string;
|
|
319
|
+
userAgent?: string;
|
|
320
|
+
dnt?: string;
|
|
321
|
+
clientRegion?: string;
|
|
273
322
|
}
|
|
274
323
|
|
|
275
324
|
export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
|
|
276
325
|
|
|
277
|
-
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
326
|
+
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
327
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
328
|
+
): GitpodServiceImpl<C, S> {
|
|
278
329
|
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
279
|
-
}
|
|
330
|
+
};
|
|
280
331
|
|
|
281
|
-
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
282
|
-
methods
|
|
283
|
-
|
|
332
|
+
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
333
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
334
|
+
): JsonRpcProxy<S> {
|
|
335
|
+
methods.setClient = methods.setClient || (() => {});
|
|
336
|
+
methods.dispose = methods.dispose || (() => {});
|
|
284
337
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
285
338
|
// @ts-ignore
|
|
286
339
|
get: (target: S, property: keyof S) => {
|
|
@@ -289,25 +342,25 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
|
|
|
289
342
|
throw new Error(`Method ${property} not implemented`);
|
|
290
343
|
}
|
|
291
344
|
return result;
|
|
292
|
-
}
|
|
345
|
+
},
|
|
293
346
|
});
|
|
294
|
-
}
|
|
347
|
+
};
|
|
295
348
|
|
|
296
349
|
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
297
350
|
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
298
351
|
|
|
299
352
|
export interface SetWorkspaceTimeoutResult {
|
|
300
|
-
resetTimeoutOnWorkspaces: string[]
|
|
353
|
+
resetTimeoutOnWorkspaces: string[];
|
|
301
354
|
}
|
|
302
355
|
|
|
303
356
|
export interface GetWorkspaceTimeoutResult {
|
|
304
|
-
duration: WorkspaceTimeoutDuration
|
|
305
|
-
canChange: boolean
|
|
357
|
+
duration: WorkspaceTimeoutDuration;
|
|
358
|
+
canChange: boolean;
|
|
306
359
|
}
|
|
307
360
|
|
|
308
361
|
export interface StartWorkspaceResult {
|
|
309
|
-
instanceID: string
|
|
310
|
-
workspaceURL?: string
|
|
362
|
+
instanceID: string;
|
|
363
|
+
workspaceURL?: string;
|
|
311
364
|
}
|
|
312
365
|
|
|
313
366
|
export namespace GitpodServer {
|
|
@@ -332,6 +385,8 @@ export namespace GitpodServer {
|
|
|
332
385
|
export interface TakeSnapshotOptions {
|
|
333
386
|
workspaceId: string;
|
|
334
387
|
layoutData?: string;
|
|
388
|
+
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
389
|
+
dontWait?: boolean;
|
|
335
390
|
}
|
|
336
391
|
export interface GetUserStorageResourceOptions {
|
|
337
392
|
readonly uri: string;
|
|
@@ -349,23 +404,23 @@ export namespace GitpodServer {
|
|
|
349
404
|
readonly roundTripTime?: number;
|
|
350
405
|
}
|
|
351
406
|
export interface UpdateOwnAuthProviderParams {
|
|
352
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
407
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
353
408
|
}
|
|
354
409
|
export interface DeleteOwnAuthProviderParams {
|
|
355
|
-
readonly id: string
|
|
410
|
+
readonly id: string;
|
|
356
411
|
}
|
|
357
412
|
export type AdmissionLevel = "owner" | "everyone";
|
|
358
413
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
359
414
|
export interface GenerateNewGitpodTokenOptions {
|
|
360
|
-
name?: string
|
|
361
|
-
type: GitpodTokenType
|
|
362
|
-
scopes?: string[]
|
|
415
|
+
name?: string;
|
|
416
|
+
type: GitpodTokenType;
|
|
417
|
+
scopes?: string[];
|
|
363
418
|
}
|
|
364
419
|
}
|
|
365
420
|
|
|
366
|
-
export const GitpodServerPath =
|
|
421
|
+
export const GitpodServerPath = "/gitpod";
|
|
367
422
|
|
|
368
|
-
export const GitpodServerProxy = Symbol(
|
|
423
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
369
424
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
370
425
|
|
|
371
426
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -373,12 +428,14 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
373
428
|
|
|
374
429
|
public registerClient(client: Partial<Client>): Disposable {
|
|
375
430
|
this.clients.push(client);
|
|
376
|
-
const index = this.clients.length;
|
|
377
431
|
return {
|
|
378
432
|
dispose: () => {
|
|
379
|
-
this.clients.
|
|
380
|
-
|
|
381
|
-
|
|
433
|
+
const index = this.clients.indexOf(client);
|
|
434
|
+
if (index > -1) {
|
|
435
|
+
this.clients.splice(index, 1);
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
};
|
|
382
439
|
}
|
|
383
440
|
|
|
384
441
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -387,7 +444,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
387
444
|
try {
|
|
388
445
|
client.onInstanceUpdate(instance);
|
|
389
446
|
} catch (error) {
|
|
390
|
-
console.error(error)
|
|
447
|
+
console.error(error);
|
|
391
448
|
}
|
|
392
449
|
}
|
|
393
450
|
}
|
|
@@ -399,19 +456,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
399
456
|
try {
|
|
400
457
|
client.onPrebuildUpdate(update);
|
|
401
458
|
} catch (error) {
|
|
402
|
-
console.error(error)
|
|
459
|
+
console.error(error);
|
|
403
460
|
}
|
|
404
461
|
}
|
|
405
462
|
}
|
|
406
463
|
}
|
|
407
464
|
|
|
408
|
-
onWorkspaceImageBuildLogs(
|
|
465
|
+
onWorkspaceImageBuildLogs(
|
|
466
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
467
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
468
|
+
): void {
|
|
409
469
|
for (const client of this.clients) {
|
|
410
470
|
if (client.onWorkspaceImageBuildLogs) {
|
|
411
471
|
try {
|
|
412
472
|
client.onWorkspaceImageBuildLogs(info, content);
|
|
413
473
|
} catch (error) {
|
|
414
|
-
console.error(error)
|
|
474
|
+
console.error(error);
|
|
415
475
|
}
|
|
416
476
|
}
|
|
417
477
|
}
|
|
@@ -423,7 +483,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
423
483
|
try {
|
|
424
484
|
client.notifyDidOpenConnection();
|
|
425
485
|
} catch (error) {
|
|
426
|
-
console.error(error)
|
|
486
|
+
console.error(error);
|
|
427
487
|
}
|
|
428
488
|
}
|
|
429
489
|
}
|
|
@@ -435,7 +495,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
435
495
|
try {
|
|
436
496
|
client.notifyDidCloseConnection();
|
|
437
497
|
} catch (error) {
|
|
438
|
-
console.error(error)
|
|
498
|
+
console.error(error);
|
|
439
499
|
}
|
|
440
500
|
}
|
|
441
501
|
}
|
|
@@ -447,17 +507,16 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
447
507
|
try {
|
|
448
508
|
client.onCreditAlert(creditAlert);
|
|
449
509
|
} catch (error) {
|
|
450
|
-
console.error(error)
|
|
510
|
+
console.error(error);
|
|
451
511
|
}
|
|
452
512
|
}
|
|
453
513
|
}
|
|
454
514
|
}
|
|
455
|
-
|
|
456
515
|
}
|
|
457
516
|
|
|
458
517
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
459
518
|
|
|
460
|
-
const hasWindow =
|
|
519
|
+
const hasWindow = typeof window !== "undefined";
|
|
461
520
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
462
521
|
unknown: 0,
|
|
463
522
|
preparing: 1,
|
|
@@ -467,44 +526,41 @@ const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
|
467
526
|
running: 5,
|
|
468
527
|
interrupted: 6,
|
|
469
528
|
stopping: 7,
|
|
470
|
-
stopped: 8
|
|
529
|
+
stopped: 8,
|
|
471
530
|
};
|
|
472
531
|
export class WorkspaceInstanceUpdateListener {
|
|
473
532
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
474
533
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
475
534
|
|
|
476
|
-
private source:
|
|
535
|
+
private source: "sync" | "update" = "sync";
|
|
477
536
|
|
|
478
537
|
get info(): WorkspaceInfo {
|
|
479
538
|
return this._info;
|
|
480
539
|
}
|
|
481
540
|
|
|
482
|
-
constructor(
|
|
483
|
-
private readonly service: GitpodService,
|
|
484
|
-
private _info: WorkspaceInfo
|
|
485
|
-
) {
|
|
541
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
486
542
|
service.registerClient({
|
|
487
|
-
onInstanceUpdate: instance => {
|
|
543
|
+
onInstanceUpdate: (instance) => {
|
|
488
544
|
if (this.isOutOfOrder(instance)) {
|
|
489
545
|
return;
|
|
490
546
|
}
|
|
491
547
|
this.cancelSync();
|
|
492
548
|
this._info.latestInstance = instance;
|
|
493
|
-
this.source =
|
|
549
|
+
this.source = "update";
|
|
494
550
|
this.onDidChangeEmitter.fire(undefined);
|
|
495
551
|
},
|
|
496
552
|
notifyDidOpenConnection: () => {
|
|
497
553
|
this.sync();
|
|
498
|
-
}
|
|
554
|
+
},
|
|
499
555
|
});
|
|
500
556
|
if (hasWindow) {
|
|
501
557
|
// learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
|
|
502
|
-
window.document.addEventListener(
|
|
503
|
-
if (window.document.visibilityState ===
|
|
558
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
559
|
+
if (window.document.visibilityState === "visible") {
|
|
504
560
|
this.sync();
|
|
505
561
|
}
|
|
506
562
|
});
|
|
507
|
-
window.addEventListener(
|
|
563
|
+
window.addEventListener("pageshow", (e) => {
|
|
508
564
|
if (e.persisted) {
|
|
509
565
|
this.sync();
|
|
510
566
|
}
|
|
@@ -532,12 +588,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
532
588
|
return;
|
|
533
589
|
}
|
|
534
590
|
this._info = info;
|
|
535
|
-
this.source =
|
|
591
|
+
this.source = "sync";
|
|
536
592
|
this.onDidChangeEmitter.fire(undefined);
|
|
537
593
|
} catch (e) {
|
|
538
|
-
console.error(
|
|
594
|
+
console.error("failed to sync workspace instance:", e);
|
|
539
595
|
}
|
|
540
|
-
})
|
|
596
|
+
});
|
|
541
597
|
}
|
|
542
598
|
private cancelSync(): void {
|
|
543
599
|
if (this.syncTokenSource) {
|
|
@@ -554,7 +610,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
554
610
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
555
611
|
return true;
|
|
556
612
|
}
|
|
557
|
-
if (this.source ===
|
|
613
|
+
if (this.source === "update") {
|
|
558
614
|
return false;
|
|
559
615
|
}
|
|
560
616
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -562,15 +618,13 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
562
618
|
}
|
|
563
619
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
564
620
|
}
|
|
565
|
-
|
|
566
621
|
}
|
|
567
622
|
|
|
568
623
|
export interface GitpodServiceOptions {
|
|
569
|
-
onReconnect?: () =>
|
|
624
|
+
onReconnect?: () => void | Promise<void>;
|
|
570
625
|
}
|
|
571
626
|
|
|
572
627
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
573
|
-
|
|
574
628
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
575
629
|
|
|
576
630
|
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
@@ -585,7 +639,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
585
639
|
|
|
586
640
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
587
641
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
588
|
-
const listener =
|
|
642
|
+
const listener =
|
|
643
|
+
this.instanceListeners.get(workspaceId) ||
|
|
589
644
|
(async () => {
|
|
590
645
|
const info = await this.server.getWorkspace(workspaceId);
|
|
591
646
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -601,26 +656,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
601
656
|
}
|
|
602
657
|
}
|
|
603
658
|
|
|
604
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
659
|
+
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
660
|
+
serverUrl: string | Promise<string>,
|
|
661
|
+
) {
|
|
605
662
|
const toWsUrl = (serverUrl: string) => {
|
|
606
|
-
return new GitpodHostUrl(serverUrl)
|
|
607
|
-
.asWebsocket()
|
|
608
|
-
.withApi({ pathname: GitpodServerPath })
|
|
609
|
-
.toString();
|
|
663
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
610
664
|
};
|
|
611
665
|
let url: string | Promise<string>;
|
|
612
666
|
if (typeof serverUrl === "string") {
|
|
613
667
|
url = toWsUrl(serverUrl);
|
|
614
668
|
} else {
|
|
615
|
-
url = serverUrl.then(url => toWsUrl(url));
|
|
669
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
616
670
|
}
|
|
617
671
|
|
|
618
672
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
619
|
-
let onReconnect = () => {
|
|
673
|
+
let onReconnect = () => {};
|
|
620
674
|
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
621
|
-
onListening: socket => {
|
|
675
|
+
onListening: (socket) => {
|
|
622
676
|
onReconnect = () => socket.reconnect();
|
|
623
|
-
}
|
|
677
|
+
},
|
|
624
678
|
});
|
|
625
679
|
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
626
|
-
}
|
|
680
|
+
}
|
|
@@ -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
|
+
}
|