@gitpod/gitpod-protocol 0.1.5-server-vscode-ouath2.18 → 0.1.5-server-vscode-oauth2.24
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 +31 -41
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +20 -2
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +2 -13
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +12 -1
- 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 +63 -10
- 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 +81 -48
- 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 +4 -4
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +4 -4
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +25 -26
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +29 -37
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +30 -44
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +31 -38
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +1 -2
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +17 -19
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +26 -42
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +145 -142
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +67 -31
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +162 -309
- 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 +3 -3
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +173 -36
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +4 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +42 -59
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +2 -2
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +37 -38
- 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 +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +24 -60
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +3 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +74 -163
- 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 -4
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +39 -31
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +4 -4
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +225 -209
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +83 -78
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +131 -190
- 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 +17 -17
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +16 -3
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +11 -15
- 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 +44 -26
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +57 -135
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js +17 -59
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +11 -11
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/deferred.js +10 -12
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +27 -40
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +63 -77
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -0
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +27 -47
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +1 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +460 -499
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +61 -78
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +41 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +1 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +106 -114
- 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 +97 -135
- 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 +3 -3
- 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 +87 -129
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +5 -5
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +10 -0
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +30 -7
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +4 -0
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +123 -84
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.js +16 -55
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.js +147 -288
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeat.d.ts +15 -0
- package/lib/util/repeat.d.ts.map +1 -0
- package/lib/util/repeat.js +55 -0
- package/lib/util/repeat.js.map +1 -0
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +15 -46
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +6 -6
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +16 -16
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +21 -24
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +52 -6
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +199 -64
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.d.ts +7 -0
- package/lib/util/tracing.spec.d.ts.map +1 -0
- package/lib/util/tracing.spec.js +121 -0
- package/lib/util/tracing.spec.js.map +1 -0
- package/lib/util/workspace-port-authentication.d.ts +7 -7
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +9 -12
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +15 -3
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +19 -4
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +25 -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 +22 -13
- package/pkg-yarn.lock +12 -7
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +53 -53
- package/src/admin-protocol.ts +43 -20
- package/src/analytics.ts +28 -15
- 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 -10
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +174 -109
- 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 +185 -21
- 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 +13 -1
- package/src/messaging/node/connection.ts +23 -70
- package/src/messaging/proxy-factory.ts +32 -33
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +2 -2
- package/src/permission.ts +40 -33
- 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 +27 -9
- package/src/typings/globals.ts +4 -4
- package/src/util/analytics.ts +56 -18
- 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 +38 -0
- package/src/util/gitpod-host-url.spec.ts +40 -13
- package/src/util/gitpod-host-url.ts +41 -38
- package/src/util/grpc.ts +4 -4
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +109 -86
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +37 -8
- package/src/util/parse-workspace-id.ts +32 -7
- package/src/util/queue.spec.ts +27 -25
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +4 -6
- package/src/util/skip-if.ts +9 -6
- package/src/util/timeutil.spec.ts +14 -15
- package/src/util/timeutil.ts +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 -8
- package/src/workspace-instance.ts +53 -23
- package/src/wsready.ts +3 -3
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -46
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.js.map +0 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/lib/util/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -34
- package/lib/util/safe-promise.js.map +0 -1
- package/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.
|
|
@@ -123,6 +151,12 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
123
151
|
removeTeamMember(teamId: string, userId: string): Promise<void>;
|
|
124
152
|
getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
|
|
125
153
|
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
154
|
+
deleteTeam(teamId: string, userId: string): Promise<void>;
|
|
155
|
+
|
|
156
|
+
// Admin Settings
|
|
157
|
+
adminGetSettings(): Promise<InstallationAdminSettings>;
|
|
158
|
+
adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
|
|
159
|
+
adminGetTelemetryData(): Promise<TelemetryData>;
|
|
126
160
|
|
|
127
161
|
// Projects
|
|
128
162
|
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
@@ -133,13 +167,20 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
133
167
|
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
134
168
|
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
135
169
|
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
136
|
-
|
|
170
|
+
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
137
171
|
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
138
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>;
|
|
139
180
|
|
|
140
181
|
// content service
|
|
141
|
-
getContentBlobUploadUrl(name: string): Promise<string
|
|
142
|
-
getContentBlobDownloadUrl(name: string): Promise<string
|
|
182
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
183
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
143
184
|
|
|
144
185
|
// Gitpod token
|
|
145
186
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
@@ -151,10 +192,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
151
192
|
registerGithubApp(installationId: string): Promise<void>;
|
|
152
193
|
|
|
153
194
|
/**
|
|
154
|
-
* 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`.
|
|
155
196
|
* @return the snapshot id
|
|
156
197
|
*/
|
|
157
198
|
takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
|
|
199
|
+
/**
|
|
200
|
+
*
|
|
201
|
+
* @param snapshotId
|
|
202
|
+
*/
|
|
203
|
+
waitForSnapshot(snapshotId: string): Promise<void>;
|
|
158
204
|
|
|
159
205
|
/**
|
|
160
206
|
* Returns the list of snapshots that exist for a workspace.
|
|
@@ -171,23 +217,12 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
171
217
|
*/
|
|
172
218
|
getLayout(workspaceId: string): Promise<string | undefined>;
|
|
173
219
|
|
|
174
|
-
/**
|
|
175
|
-
* @param params
|
|
176
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
177
|
-
*/
|
|
178
|
-
preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
|
|
179
|
-
resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
|
|
180
|
-
installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
|
|
181
|
-
uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
|
|
182
|
-
|
|
183
220
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
184
221
|
|
|
185
222
|
/**
|
|
186
223
|
* gitpod.io concerns
|
|
187
224
|
*/
|
|
188
225
|
isStudent(): Promise<boolean>;
|
|
189
|
-
getPrivateRepoTrialEndDate(): Promise<string | undefined>;
|
|
190
|
-
|
|
191
226
|
/**
|
|
192
227
|
*
|
|
193
228
|
*/
|
|
@@ -205,7 +240,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
205
240
|
|
|
206
241
|
getShowPaymentUI(): Promise<boolean>;
|
|
207
242
|
isChargebeeCustomer(): Promise<boolean>;
|
|
208
|
-
mayAccessPrivateRepo(): Promise<boolean>;
|
|
209
243
|
|
|
210
244
|
subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
211
245
|
subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
@@ -214,9 +248,13 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
214
248
|
|
|
215
249
|
tsGet(): Promise<TeamSubscription[]>;
|
|
216
250
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
217
|
-
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined
|
|
251
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
218
252
|
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
219
|
-
tsAssignSlot(
|
|
253
|
+
tsAssignSlot(
|
|
254
|
+
teamSubscriptionId: string,
|
|
255
|
+
teamSubscriptionSlotId: string,
|
|
256
|
+
identityStr: string | undefined,
|
|
257
|
+
): Promise<void>;
|
|
220
258
|
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
221
259
|
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
222
260
|
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
@@ -227,10 +265,23 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
227
265
|
* Analytics
|
|
228
266
|
*/
|
|
229
267
|
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
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;
|
|
230
280
|
}
|
|
231
281
|
|
|
232
282
|
export interface CreateProjectParams {
|
|
233
283
|
name: string;
|
|
284
|
+
slug?: string;
|
|
234
285
|
account: string;
|
|
235
286
|
provider: string;
|
|
236
287
|
cloneUrl: string;
|
|
@@ -252,25 +303,37 @@ export interface GetProviderRepositoriesParams {
|
|
|
252
303
|
}
|
|
253
304
|
export interface ProviderRepository {
|
|
254
305
|
name: string;
|
|
306
|
+
path?: string;
|
|
255
307
|
account: string;
|
|
256
308
|
accountAvatarUrl: string;
|
|
257
309
|
cloneUrl: string;
|
|
258
|
-
updatedAt
|
|
310
|
+
updatedAt?: string;
|
|
259
311
|
installationId?: number;
|
|
260
312
|
installationUpdatedAt?: string;
|
|
261
313
|
|
|
262
|
-
inUse?:
|
|
314
|
+
inUse?: { userName: string };
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export interface ClientHeaderFields {
|
|
318
|
+
ip?: string;
|
|
319
|
+
userAgent?: string;
|
|
320
|
+
dnt?: string;
|
|
321
|
+
clientRegion?: string;
|
|
263
322
|
}
|
|
264
323
|
|
|
265
324
|
export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
|
|
266
325
|
|
|
267
|
-
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> {
|
|
268
329
|
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
269
|
-
}
|
|
330
|
+
};
|
|
270
331
|
|
|
271
|
-
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
272
|
-
methods
|
|
273
|
-
|
|
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 || (() => {});
|
|
274
337
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
275
338
|
// @ts-ignore
|
|
276
339
|
get: (target: S, property: keyof S) => {
|
|
@@ -279,25 +342,25 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
|
|
|
279
342
|
throw new Error(`Method ${property} not implemented`);
|
|
280
343
|
}
|
|
281
344
|
return result;
|
|
282
|
-
}
|
|
345
|
+
},
|
|
283
346
|
});
|
|
284
|
-
}
|
|
347
|
+
};
|
|
285
348
|
|
|
286
349
|
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
287
350
|
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
288
351
|
|
|
289
352
|
export interface SetWorkspaceTimeoutResult {
|
|
290
|
-
resetTimeoutOnWorkspaces: string[]
|
|
353
|
+
resetTimeoutOnWorkspaces: string[];
|
|
291
354
|
}
|
|
292
355
|
|
|
293
356
|
export interface GetWorkspaceTimeoutResult {
|
|
294
|
-
duration: WorkspaceTimeoutDuration
|
|
295
|
-
canChange: boolean
|
|
357
|
+
duration: WorkspaceTimeoutDuration;
|
|
358
|
+
canChange: boolean;
|
|
296
359
|
}
|
|
297
360
|
|
|
298
361
|
export interface StartWorkspaceResult {
|
|
299
|
-
instanceID: string
|
|
300
|
-
workspaceURL?: string
|
|
362
|
+
instanceID: string;
|
|
363
|
+
workspaceURL?: string;
|
|
301
364
|
}
|
|
302
365
|
|
|
303
366
|
export namespace GitpodServer {
|
|
@@ -305,7 +368,8 @@ export namespace GitpodServer {
|
|
|
305
368
|
limit?: number;
|
|
306
369
|
searchString?: string;
|
|
307
370
|
pinnedOnly?: boolean;
|
|
308
|
-
projectId?: string;
|
|
371
|
+
projectId?: string | string[];
|
|
372
|
+
includeWithoutProject?: boolean;
|
|
309
373
|
}
|
|
310
374
|
export interface GetAccountStatementOptions {
|
|
311
375
|
date?: string;
|
|
@@ -321,6 +385,8 @@ export namespace GitpodServer {
|
|
|
321
385
|
export interface TakeSnapshotOptions {
|
|
322
386
|
workspaceId: string;
|
|
323
387
|
layoutData?: string;
|
|
388
|
+
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
389
|
+
dontWait?: boolean;
|
|
324
390
|
}
|
|
325
391
|
export interface GetUserStorageResourceOptions {
|
|
326
392
|
readonly uri: string;
|
|
@@ -338,23 +404,23 @@ export namespace GitpodServer {
|
|
|
338
404
|
readonly roundTripTime?: number;
|
|
339
405
|
}
|
|
340
406
|
export interface UpdateOwnAuthProviderParams {
|
|
341
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
407
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
342
408
|
}
|
|
343
409
|
export interface DeleteOwnAuthProviderParams {
|
|
344
|
-
readonly id: string
|
|
410
|
+
readonly id: string;
|
|
345
411
|
}
|
|
346
412
|
export type AdmissionLevel = "owner" | "everyone";
|
|
347
413
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
348
414
|
export interface GenerateNewGitpodTokenOptions {
|
|
349
|
-
name?: string
|
|
350
|
-
type: GitpodTokenType
|
|
351
|
-
scopes?: string[]
|
|
415
|
+
name?: string;
|
|
416
|
+
type: GitpodTokenType;
|
|
417
|
+
scopes?: string[];
|
|
352
418
|
}
|
|
353
419
|
}
|
|
354
420
|
|
|
355
|
-
export const GitpodServerPath =
|
|
421
|
+
export const GitpodServerPath = "/gitpod";
|
|
356
422
|
|
|
357
|
-
export const GitpodServerProxy = Symbol(
|
|
423
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
358
424
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
359
425
|
|
|
360
426
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -362,12 +428,14 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
362
428
|
|
|
363
429
|
public registerClient(client: Partial<Client>): Disposable {
|
|
364
430
|
this.clients.push(client);
|
|
365
|
-
const index = this.clients.length;
|
|
366
431
|
return {
|
|
367
432
|
dispose: () => {
|
|
368
|
-
this.clients.
|
|
369
|
-
|
|
370
|
-
|
|
433
|
+
const index = this.clients.indexOf(client);
|
|
434
|
+
if (index > -1) {
|
|
435
|
+
this.clients.splice(index, 1);
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
};
|
|
371
439
|
}
|
|
372
440
|
|
|
373
441
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -376,7 +444,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
376
444
|
try {
|
|
377
445
|
client.onInstanceUpdate(instance);
|
|
378
446
|
} catch (error) {
|
|
379
|
-
console.error(error)
|
|
447
|
+
console.error(error);
|
|
380
448
|
}
|
|
381
449
|
}
|
|
382
450
|
}
|
|
@@ -388,19 +456,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
388
456
|
try {
|
|
389
457
|
client.onPrebuildUpdate(update);
|
|
390
458
|
} catch (error) {
|
|
391
|
-
console.error(error)
|
|
459
|
+
console.error(error);
|
|
392
460
|
}
|
|
393
461
|
}
|
|
394
462
|
}
|
|
395
463
|
}
|
|
396
464
|
|
|
397
|
-
onWorkspaceImageBuildLogs(
|
|
465
|
+
onWorkspaceImageBuildLogs(
|
|
466
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
467
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
468
|
+
): void {
|
|
398
469
|
for (const client of this.clients) {
|
|
399
470
|
if (client.onWorkspaceImageBuildLogs) {
|
|
400
471
|
try {
|
|
401
472
|
client.onWorkspaceImageBuildLogs(info, content);
|
|
402
473
|
} catch (error) {
|
|
403
|
-
console.error(error)
|
|
474
|
+
console.error(error);
|
|
404
475
|
}
|
|
405
476
|
}
|
|
406
477
|
}
|
|
@@ -412,7 +483,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
412
483
|
try {
|
|
413
484
|
client.notifyDidOpenConnection();
|
|
414
485
|
} catch (error) {
|
|
415
|
-
console.error(error)
|
|
486
|
+
console.error(error);
|
|
416
487
|
}
|
|
417
488
|
}
|
|
418
489
|
}
|
|
@@ -424,7 +495,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
424
495
|
try {
|
|
425
496
|
client.notifyDidCloseConnection();
|
|
426
497
|
} catch (error) {
|
|
427
|
-
console.error(error)
|
|
498
|
+
console.error(error);
|
|
428
499
|
}
|
|
429
500
|
}
|
|
430
501
|
}
|
|
@@ -436,17 +507,16 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
436
507
|
try {
|
|
437
508
|
client.onCreditAlert(creditAlert);
|
|
438
509
|
} catch (error) {
|
|
439
|
-
console.error(error)
|
|
510
|
+
console.error(error);
|
|
440
511
|
}
|
|
441
512
|
}
|
|
442
513
|
}
|
|
443
514
|
}
|
|
444
|
-
|
|
445
515
|
}
|
|
446
516
|
|
|
447
517
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
448
518
|
|
|
449
|
-
const hasWindow =
|
|
519
|
+
const hasWindow = typeof window !== "undefined";
|
|
450
520
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
451
521
|
unknown: 0,
|
|
452
522
|
preparing: 1,
|
|
@@ -456,44 +526,41 @@ const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
|
456
526
|
running: 5,
|
|
457
527
|
interrupted: 6,
|
|
458
528
|
stopping: 7,
|
|
459
|
-
stopped: 8
|
|
529
|
+
stopped: 8,
|
|
460
530
|
};
|
|
461
531
|
export class WorkspaceInstanceUpdateListener {
|
|
462
532
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
463
533
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
464
534
|
|
|
465
|
-
private source:
|
|
535
|
+
private source: "sync" | "update" = "sync";
|
|
466
536
|
|
|
467
537
|
get info(): WorkspaceInfo {
|
|
468
538
|
return this._info;
|
|
469
539
|
}
|
|
470
540
|
|
|
471
|
-
constructor(
|
|
472
|
-
private readonly service: GitpodService,
|
|
473
|
-
private _info: WorkspaceInfo
|
|
474
|
-
) {
|
|
541
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
475
542
|
service.registerClient({
|
|
476
|
-
onInstanceUpdate: instance => {
|
|
543
|
+
onInstanceUpdate: (instance) => {
|
|
477
544
|
if (this.isOutOfOrder(instance)) {
|
|
478
545
|
return;
|
|
479
546
|
}
|
|
480
547
|
this.cancelSync();
|
|
481
548
|
this._info.latestInstance = instance;
|
|
482
|
-
this.source =
|
|
549
|
+
this.source = "update";
|
|
483
550
|
this.onDidChangeEmitter.fire(undefined);
|
|
484
551
|
},
|
|
485
552
|
notifyDidOpenConnection: () => {
|
|
486
553
|
this.sync();
|
|
487
|
-
}
|
|
554
|
+
},
|
|
488
555
|
});
|
|
489
556
|
if (hasWindow) {
|
|
490
557
|
// learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
|
|
491
|
-
window.document.addEventListener(
|
|
492
|
-
if (window.document.visibilityState ===
|
|
558
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
559
|
+
if (window.document.visibilityState === "visible") {
|
|
493
560
|
this.sync();
|
|
494
561
|
}
|
|
495
562
|
});
|
|
496
|
-
window.addEventListener(
|
|
563
|
+
window.addEventListener("pageshow", (e) => {
|
|
497
564
|
if (e.persisted) {
|
|
498
565
|
this.sync();
|
|
499
566
|
}
|
|
@@ -521,12 +588,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
521
588
|
return;
|
|
522
589
|
}
|
|
523
590
|
this._info = info;
|
|
524
|
-
this.source =
|
|
591
|
+
this.source = "sync";
|
|
525
592
|
this.onDidChangeEmitter.fire(undefined);
|
|
526
593
|
} catch (e) {
|
|
527
|
-
console.error(
|
|
594
|
+
console.error("failed to sync workspace instance:", e);
|
|
528
595
|
}
|
|
529
|
-
})
|
|
596
|
+
});
|
|
530
597
|
}
|
|
531
598
|
private cancelSync(): void {
|
|
532
599
|
if (this.syncTokenSource) {
|
|
@@ -543,7 +610,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
543
610
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
544
611
|
return true;
|
|
545
612
|
}
|
|
546
|
-
if (this.source ===
|
|
613
|
+
if (this.source === "update") {
|
|
547
614
|
return false;
|
|
548
615
|
}
|
|
549
616
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -551,15 +618,13 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
551
618
|
}
|
|
552
619
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
553
620
|
}
|
|
554
|
-
|
|
555
621
|
}
|
|
556
622
|
|
|
557
623
|
export interface GitpodServiceOptions {
|
|
558
|
-
onReconnect?: () =>
|
|
624
|
+
onReconnect?: () => void | Promise<void>;
|
|
559
625
|
}
|
|
560
626
|
|
|
561
627
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
562
|
-
|
|
563
628
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
564
629
|
|
|
565
630
|
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
@@ -574,7 +639,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
574
639
|
|
|
575
640
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
576
641
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
577
|
-
const listener =
|
|
642
|
+
const listener =
|
|
643
|
+
this.instanceListeners.get(workspaceId) ||
|
|
578
644
|
(async () => {
|
|
579
645
|
const info = await this.server.getWorkspace(workspaceId);
|
|
580
646
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -590,26 +656,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
590
656
|
}
|
|
591
657
|
}
|
|
592
658
|
|
|
593
|
-
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
|
+
) {
|
|
594
662
|
const toWsUrl = (serverUrl: string) => {
|
|
595
|
-
return new GitpodHostUrl(serverUrl)
|
|
596
|
-
.asWebsocket()
|
|
597
|
-
.withApi({ pathname: GitpodServerPath })
|
|
598
|
-
.toString();
|
|
663
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
599
664
|
};
|
|
600
665
|
let url: string | Promise<string>;
|
|
601
666
|
if (typeof serverUrl === "string") {
|
|
602
667
|
url = toWsUrl(serverUrl);
|
|
603
668
|
} else {
|
|
604
|
-
url = serverUrl.then(url => toWsUrl(url));
|
|
669
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
605
670
|
}
|
|
606
671
|
|
|
607
672
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
608
|
-
let onReconnect = () => {
|
|
673
|
+
let onReconnect = () => {};
|
|
609
674
|
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
610
|
-
onListening: socket => {
|
|
675
|
+
onListening: (socket) => {
|
|
611
676
|
onReconnect = () => socket.reconnect();
|
|
612
|
-
}
|
|
677
|
+
},
|
|
613
678
|
});
|
|
614
679
|
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
615
|
-
}
|
|
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
|
+
}
|