@gitpod/gitpod-protocol 0.1.5-se-multi-repo.37 → 0.1.5-se-cancel-reason.0
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 +153 -2
- 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 +4 -2
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/auth.d.ts.map +1 -1
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +4 -4
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +20 -5
- package/lib/context-url.spec.js.map +1 -1
- package/lib/email-protocol.d.ts +1 -1
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +1 -1
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +7 -7
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +2 -3
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +1 -1
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +7 -9
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +0 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +1 -20
- package/lib/env.js.map +1 -1
- package/lib/experiments/always-default.d.ts +8 -0
- package/lib/experiments/always-default.d.ts.map +1 -0
- package/lib/experiments/always-default.js +20 -0
- package/lib/experiments/always-default.js.map +1 -0
- package/lib/experiments/configcat-server.d.ts +8 -0
- package/lib/experiments/configcat-server.d.ts.map +1 -0
- package/lib/experiments/configcat-server.js +34 -0
- package/lib/experiments/configcat-server.js.map +1 -0
- package/lib/experiments/configcat.d.ts +21 -0
- package/lib/experiments/configcat.d.ts.map +1 -0
- package/lib/experiments/configcat.js +47 -0
- package/lib/experiments/configcat.js.map +1 -0
- package/lib/experiments/types.d.ts +19 -0
- package/lib/experiments/types.d.ts.map +1 -0
- package/lib/{theia-plugins.js → experiments/types.js} +2 -2
- package/lib/experiments/types.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +6 -6
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +42 -39
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +35 -26
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +39 -32
- 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 +6 -6
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/index.d.ts +16 -16
- package/lib/installation-admin-protocol.d.ts +3 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -1
- package/lib/installation-admin-protocol.js +3 -2
- package/lib/installation-admin-protocol.js.map +1 -1
- package/lib/license-protocol.d.ts +7 -0
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +1 -1
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +19 -19
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +4 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +9 -6
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +2 -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 +2 -0
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +4 -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.js +8 -8
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +1 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +7 -9
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +1 -1
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +2 -2
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +12 -23
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +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 +51 -35
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +146 -90
- 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 +9 -3
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +1 -1
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +12 -3
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +3 -3
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +6 -6
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/debug-app.d.ts +25 -0
- package/lib/util/debug-app.d.ts.map +1 -0
- package/lib/util/debug-app.js +100 -0
- package/lib/util/debug-app.js.map +1 -0
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +2 -2
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +5 -3
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +1 -1
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +5 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +446 -442
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +18 -7
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +1 -1
- package/lib/util/gitpod-cookie.d.ts.map +1 -1
- package/lib/util/gitpod-cookie.js +0 -3
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +31 -29
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +15 -5
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/jaeger-client-types.d.ts.map +1 -1
- package/lib/util/logging.d.ts +1 -1
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +31 -25
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +5 -5
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +1 -2
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.spec.js +9 -6
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +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 +6 -6
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +14 -16
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.js +3 -3
- package/lib/util/tracing.spec.js.map +1 -1
- package/lib/util/workspace-port-authentication.d.ts +7 -7
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +8 -11
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +1 -1
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +2 -4
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +18 -3
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +1 -1
- package/package.json +9 -6
- package/pkg-yarn.lock +7 -5
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +63 -51
- package/src/admin-protocol.ts +25 -21
- package/src/analytics.ts +21 -21
- package/src/auth.ts +2 -2
- package/src/context-url.spec.ts +25 -11
- package/src/context-url.ts +80 -78
- package/src/email-protocol.ts +5 -6
- package/src/encryption/container-module.ts +2 -3
- package/src/encryption/encryption-engine.spec.ts +9 -8
- package/src/encryption/encryption-engine.ts +14 -14
- package/src/encryption/encryption-service.ts +4 -5
- package/src/encryption/key-provider.ts +16 -19
- package/src/env.ts +0 -22
- package/src/experiments/always-default.ts +24 -0
- package/src/experiments/configcat-server.ts +37 -0
- package/src/experiments/configcat.ts +53 -0
- package/src/experiments/types.ts +32 -0
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +156 -110
- package/src/headless-workspace-log.ts +6 -4
- package/src/ide-frontend-service.ts +2 -2
- package/src/ide-protocol.ts +8 -8
- package/src/index.ts +16 -16
- package/src/installation-admin-protocol.ts +11 -8
- package/src/license-protocol.ts +12 -6
- package/src/messaging/browser/connection.ts +45 -47
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +70 -71
- package/src/messaging/error.ts +7 -3
- package/src/messaging/handler.ts +6 -6
- package/src/messaging/node/connection.ts +8 -8
- package/src/messaging/proxy-factory.ts +23 -30
- package/src/oss-allowlist.ts +3 -3
- package/src/payment-protocol.ts +2 -2
- package/src/permission.ts +20 -31
- package/src/plans.ts +236 -189
- package/src/protocol.ts +303 -245
- package/src/snapshot-url.spec.ts +9 -7
- package/src/team-subscription-protocol.ts +57 -23
- package/src/teams-projects-protocol.ts +15 -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/debug-app.ts +81 -0
- package/src/util/deferred.ts +6 -6
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +3 -6
- package/src/util/generate-workspace-id.spec.ts +26 -16
- package/src/util/generate-workspace-id.ts +460 -454
- package/src/util/gitpod-cookie.ts +8 -9
- package/src/util/gitpod-host-url.spec.ts +40 -13
- package/src/util/gitpod-host-url.ts +37 -34
- package/src/util/grpc.ts +1 -1
- package/src/util/jaeger-client-types.ts +2 -2
- package/src/util/logging.ts +60 -42
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +17 -8
- package/src/util/parse-workspace-id.ts +5 -6
- package/src/util/queue.spec.ts +27 -25
- package/src/util/repeat.ts +1 -1
- package/src/util/semaphore.ts +4 -6
- package/src/util/skip-if.ts +9 -6
- package/src/util/timeutil.spec.ts +14 -15
- package/src/util/timeutil.ts +21 -11
- package/src/util/tracing.spec.ts +28 -23
- package/src/util/tracing.ts +54 -51
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/workspace-cluster.ts +15 -12
- package/src/workspace-instance.ts +52 -24
- package/src/wsready.ts +2 -2
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.js.map +0 -1
- package/src/theia-plugins.ts +0 -11
|
@@ -7,40 +7,39 @@
|
|
|
7
7
|
import { injectable } from "inversify";
|
|
8
8
|
import * as yaml from "js-yaml";
|
|
9
9
|
import * as Ajv from "ajv";
|
|
10
|
-
import { log } from
|
|
10
|
+
import { log } from "./util/logging";
|
|
11
11
|
import { WorkspaceConfig, PortRangeConfig } from "./protocol";
|
|
12
12
|
|
|
13
|
-
export type MaybeConfig = WorkspaceConfig | undefined
|
|
13
|
+
export type MaybeConfig = WorkspaceConfig | undefined;
|
|
14
14
|
|
|
15
|
-
const schema = require(
|
|
15
|
+
const schema = require("../data/gitpod-schema.json");
|
|
16
16
|
const validate = new Ajv().compile(schema);
|
|
17
17
|
const defaultParseOptions = {
|
|
18
18
|
acceptPortRanges: false,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export interface ParseResult {
|
|
22
|
-
config: WorkspaceConfig
|
|
23
|
-
parsedConfig?: WorkspaceConfig
|
|
24
|
-
validationErrors?: string[]
|
|
22
|
+
config: WorkspaceConfig;
|
|
23
|
+
parsedConfig?: WorkspaceConfig;
|
|
24
|
+
validationErrors?: string[];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
@injectable()
|
|
28
28
|
export class GitpodFileParser {
|
|
29
|
-
|
|
30
29
|
public parse(content: string, parseOptions = {}, defaultConfig: WorkspaceConfig = {}): ParseResult {
|
|
31
30
|
const options = {
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
...defaultParseOptions,
|
|
32
|
+
...parseOptions,
|
|
34
33
|
};
|
|
35
34
|
try {
|
|
36
35
|
const parsedConfig = yaml.safeLoad(content) as any;
|
|
37
36
|
validate(parsedConfig);
|
|
38
|
-
const validationErrors = validate.errors ? validate.errors.map(
|
|
37
|
+
const validationErrors = validate.errors ? validate.errors.map((e) => e.message || e.keyword) : undefined;
|
|
39
38
|
if (validationErrors && validationErrors.length > 0) {
|
|
40
39
|
return {
|
|
41
40
|
config: defaultConfig,
|
|
42
41
|
parsedConfig,
|
|
43
|
-
validationErrors
|
|
42
|
+
validationErrors,
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
45
|
const overrides = {} as any;
|
|
@@ -49,17 +48,17 @@ export class GitpodFileParser {
|
|
|
49
48
|
}
|
|
50
49
|
return {
|
|
51
50
|
config: {
|
|
52
|
-
...
|
|
53
|
-
...
|
|
54
|
-
...
|
|
51
|
+
...defaultConfig,
|
|
52
|
+
...parsedConfig,
|
|
53
|
+
...overrides,
|
|
55
54
|
},
|
|
56
|
-
parsedConfig
|
|
55
|
+
parsedConfig,
|
|
57
56
|
};
|
|
58
57
|
} catch (err) {
|
|
59
|
-
log.error(
|
|
58
|
+
log.error("Unparsable Gitpod configuration", err, { content });
|
|
60
59
|
return {
|
|
61
60
|
config: defaultConfig,
|
|
62
|
-
validationErrors: [
|
|
61
|
+
validationErrors: ["Unparsable Gitpod configuration: " + err.toString()],
|
|
63
62
|
};
|
|
64
63
|
}
|
|
65
64
|
}
|
package/src/gitpod-service.ts
CHANGED
|
@@ -5,32 +5,59 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
User,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
User,
|
|
9
|
+
WorkspaceInfo,
|
|
10
|
+
WorkspaceCreationResult,
|
|
11
|
+
WorkspaceInstanceUser,
|
|
12
|
+
WhitelistedRepository,
|
|
13
|
+
WorkspaceImageBuild,
|
|
14
|
+
AuthProviderInfo,
|
|
15
|
+
CreateWorkspaceMode,
|
|
16
|
+
Token,
|
|
17
|
+
UserEnvVarValue,
|
|
18
|
+
Terms,
|
|
19
|
+
Configuration,
|
|
20
|
+
UserInfo,
|
|
21
|
+
GitpodTokenType,
|
|
22
|
+
GitpodToken,
|
|
23
|
+
AuthProviderEntry,
|
|
24
|
+
GuessGitTokenScopesParams,
|
|
25
|
+
GuessedGitTokenScopes,
|
|
26
|
+
ProjectEnvVar,
|
|
27
|
+
PrebuiltWorkspace,
|
|
28
|
+
} from "./protocol";
|
|
14
29
|
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 {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
30
|
+
Team,
|
|
31
|
+
TeamMemberInfo,
|
|
32
|
+
TeamMembershipInvite,
|
|
33
|
+
Project,
|
|
34
|
+
TeamMemberRole,
|
|
35
|
+
PrebuildWithStatus,
|
|
36
|
+
StartPrebuildResult,
|
|
37
|
+
PartialProject,
|
|
38
|
+
} from "./teams-projects-protocol";
|
|
39
|
+
import { JsonRpcProxy, JsonRpcServer } from "./messaging/proxy-factory";
|
|
40
|
+
import { Disposable, CancellationTokenSource } from "vscode-jsonrpc";
|
|
41
|
+
import { HeadlessLogUrls } from "./headless-workspace-log";
|
|
42
|
+
import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from "./workspace-instance";
|
|
43
|
+
import { AdminServer } from "./admin-protocol";
|
|
44
|
+
import { GitpodHostUrl } from "./util/gitpod-host-url";
|
|
45
|
+
import { WebSocketConnectionProvider } from "./messaging/browser/connection";
|
|
46
|
+
import { PermissionName } from "./permission";
|
|
47
|
+
import { LicenseService } from "./license-protocol";
|
|
48
|
+
import { Emitter } from "./util/event";
|
|
49
|
+
import { AccountStatement, CreditAlert } from "./accounting-protocol";
|
|
50
|
+
import { GithubUpgradeURL, PlanCoupon } from "./payment-protocol";
|
|
51
|
+
import {
|
|
52
|
+
TeamSubscription,
|
|
53
|
+
TeamSubscription2,
|
|
54
|
+
TeamSubscriptionSlot,
|
|
55
|
+
TeamSubscriptionSlotResolved,
|
|
56
|
+
} from "./team-subscription-protocol";
|
|
57
|
+
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
|
|
58
|
+
import { IDEServer } from "./ide-protocol";
|
|
59
|
+
import { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
|
|
60
|
+
import { Currency } from "./plans";
|
|
34
61
|
|
|
35
62
|
export interface GitpodClient {
|
|
36
63
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
@@ -46,7 +73,7 @@ export interface GitpodClient {
|
|
|
46
73
|
//#endregion
|
|
47
74
|
}
|
|
48
75
|
|
|
49
|
-
export const GitpodServer = Symbol(
|
|
76
|
+
export const GitpodServer = Symbol("GitpodServer");
|
|
50
77
|
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
51
78
|
// User related API
|
|
52
79
|
getLoggedInUser(): Promise<User>;
|
|
@@ -146,6 +173,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
146
173
|
getUserProjects(): Promise<Project[]>;
|
|
147
174
|
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
148
175
|
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
176
|
+
findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
|
|
177
|
+
getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
|
|
149
178
|
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
150
179
|
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
151
180
|
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
@@ -159,8 +188,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
159
188
|
deleteProjectEnvironmentVariable(variableId: string): Promise<void>;
|
|
160
189
|
|
|
161
190
|
// content service
|
|
162
|
-
getContentBlobUploadUrl(name: string): Promise<string
|
|
163
|
-
getContentBlobDownloadUrl(name: string): Promise<string
|
|
191
|
+
getContentBlobUploadUrl(name: string): Promise<string>;
|
|
192
|
+
getContentBlobDownloadUrl(name: string): Promise<string>;
|
|
164
193
|
|
|
165
194
|
// Gitpod token
|
|
166
195
|
getGitpodTokens(): Promise<GitpodToken[]>;
|
|
@@ -169,6 +198,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
169
198
|
|
|
170
199
|
// misc
|
|
171
200
|
sendFeedback(feedback: string): Promise<string | undefined>;
|
|
201
|
+
isGitHubAppEnabled(): Promise<boolean>;
|
|
172
202
|
registerGithubApp(installationId: string): Promise<void>;
|
|
173
203
|
|
|
174
204
|
/**
|
|
@@ -197,15 +227,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
197
227
|
*/
|
|
198
228
|
getLayout(workspaceId: string): Promise<string | undefined>;
|
|
199
229
|
|
|
200
|
-
/**
|
|
201
|
-
* @param params
|
|
202
|
-
* @returns promise resolves to an URL to be used for the upload
|
|
203
|
-
*/
|
|
204
|
-
preparePluginUpload(params: PreparePluginUploadParams): Promise<string>
|
|
205
|
-
resolvePlugins(workspaceId: string, params: ResolvePluginsParams): Promise<ResolvedPlugins>;
|
|
206
|
-
installUserPlugins(params: InstallPluginsParams): Promise<boolean>;
|
|
207
|
-
uninstallUserPlugin(params: UninstallPluginParams): Promise<boolean>;
|
|
208
|
-
|
|
209
230
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
210
231
|
|
|
211
232
|
/**
|
|
@@ -223,7 +244,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
223
244
|
*/
|
|
224
245
|
getChargebeeSiteId(): Promise<string>;
|
|
225
246
|
createPortalSession(): Promise<{}>;
|
|
247
|
+
createTeamPortalSession(teamId: string): Promise<{}>;
|
|
226
248
|
checkout(planId: string, planQuantity?: number): Promise<{}>;
|
|
249
|
+
teamCheckout(teamId: string, planId: string): Promise<{}>;
|
|
227
250
|
getAvailableCoupons(): Promise<PlanCoupon[]>;
|
|
228
251
|
getAppliedCoupons(): Promise<PlanCoupon[]>;
|
|
229
252
|
|
|
@@ -235,17 +258,28 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
235
258
|
subscriptionCancel(subscriptionId: string): Promise<void>;
|
|
236
259
|
subscriptionCancelDowngrade(subscriptionId: string): Promise<void>;
|
|
237
260
|
|
|
261
|
+
getTeamSubscription(teamId: string): Promise<TeamSubscription2 | undefined>;
|
|
238
262
|
tsGet(): Promise<TeamSubscription[]>;
|
|
239
263
|
tsGetSlots(): Promise<TeamSubscriptionSlotResolved[]>;
|
|
240
|
-
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined
|
|
264
|
+
tsGetUnassignedSlot(teamSubscriptionId: string): Promise<TeamSubscriptionSlot | undefined>;
|
|
241
265
|
tsAddSlots(teamSubscriptionId: string, quantity: number): Promise<void>;
|
|
242
|
-
tsAssignSlot(
|
|
266
|
+
tsAssignSlot(
|
|
267
|
+
teamSubscriptionId: string,
|
|
268
|
+
teamSubscriptionSlotId: string,
|
|
269
|
+
identityStr: string | undefined,
|
|
270
|
+
): Promise<void>;
|
|
243
271
|
tsReassignSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string, newIdentityStr: string): Promise<void>;
|
|
244
272
|
tsDeactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
245
273
|
tsReactivateSlot(teamSubscriptionId: string, teamSubscriptionSlotId: string): Promise<void>;
|
|
246
274
|
|
|
247
275
|
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
248
276
|
|
|
277
|
+
getStripePublishableKey(): Promise<string>;
|
|
278
|
+
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
279
|
+
findStripeSubscriptionIdForTeam(teamId: string): Promise<string | undefined>;
|
|
280
|
+
subscribeTeamToStripe(teamId: string, setupIntentId: string, currency: Currency): Promise<void>;
|
|
281
|
+
getStripePortalUrlForTeam(teamId: string): Promise<string>;
|
|
282
|
+
|
|
249
283
|
/**
|
|
250
284
|
* Analytics
|
|
251
285
|
*/
|
|
@@ -255,13 +289,13 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
255
289
|
}
|
|
256
290
|
|
|
257
291
|
export interface RateLimiterError {
|
|
258
|
-
method?: string
|
|
292
|
+
method?: string;
|
|
259
293
|
|
|
260
294
|
/**
|
|
261
295
|
* Retry after this many seconds, earliest.
|
|
262
296
|
* cmp.: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
263
297
|
*/
|
|
264
|
-
retryAfter: number
|
|
298
|
+
retryAfter: number;
|
|
265
299
|
}
|
|
266
300
|
|
|
267
301
|
export interface CreateProjectParams {
|
|
@@ -292,7 +326,7 @@ export interface ProviderRepository {
|
|
|
292
326
|
account: string;
|
|
293
327
|
accountAvatarUrl: string;
|
|
294
328
|
cloneUrl: string;
|
|
295
|
-
updatedAt
|
|
329
|
+
updatedAt?: string;
|
|
296
330
|
installationId?: number;
|
|
297
331
|
installationUpdatedAt?: string;
|
|
298
332
|
|
|
@@ -306,15 +340,28 @@ export interface ClientHeaderFields {
|
|
|
306
340
|
clientRegion?: string;
|
|
307
341
|
}
|
|
308
342
|
|
|
309
|
-
export const
|
|
310
|
-
|
|
311
|
-
export const
|
|
343
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_SHORT = "short";
|
|
344
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_LONG = "long";
|
|
345
|
+
export const WORKSPACE_TIMEOUT_EXTENDED = "extended";
|
|
346
|
+
export const WORKSPACE_TIMEOUT_EXTENDED_ALT = "180m"; // for backwards compatibility since the IDE uses this
|
|
347
|
+
export const WorkspaceTimeoutValues = [
|
|
348
|
+
WORKSPACE_TIMEOUT_DEFAULT_SHORT,
|
|
349
|
+
WORKSPACE_TIMEOUT_DEFAULT_LONG,
|
|
350
|
+
WORKSPACE_TIMEOUT_EXTENDED,
|
|
351
|
+
WORKSPACE_TIMEOUT_EXTENDED_ALT,
|
|
352
|
+
] as const;
|
|
353
|
+
|
|
354
|
+
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
355
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
356
|
+
): GitpodServiceImpl<C, S> {
|
|
312
357
|
return new GitpodServiceImpl<C, S>(createServerMock(methods));
|
|
313
|
-
}
|
|
358
|
+
};
|
|
314
359
|
|
|
315
|
-
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
316
|
-
methods
|
|
317
|
-
|
|
360
|
+
export const createServerMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
361
|
+
methods: Partial<JsonRpcProxy<S>>,
|
|
362
|
+
): JsonRpcProxy<S> {
|
|
363
|
+
methods.setClient = methods.setClient || (() => {});
|
|
364
|
+
methods.dispose = methods.dispose || (() => {});
|
|
318
365
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
319
366
|
// @ts-ignore
|
|
320
367
|
get: (target: S, property: keyof S) => {
|
|
@@ -323,25 +370,26 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
|
|
|
323
370
|
throw new Error(`Method ${property} not implemented`);
|
|
324
371
|
}
|
|
325
372
|
return result;
|
|
326
|
-
}
|
|
373
|
+
},
|
|
327
374
|
});
|
|
328
|
-
}
|
|
375
|
+
};
|
|
329
376
|
|
|
330
377
|
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
331
378
|
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
332
379
|
|
|
333
380
|
export interface SetWorkspaceTimeoutResult {
|
|
334
|
-
resetTimeoutOnWorkspaces: string[]
|
|
381
|
+
resetTimeoutOnWorkspaces: string[];
|
|
335
382
|
}
|
|
336
383
|
|
|
337
384
|
export interface GetWorkspaceTimeoutResult {
|
|
338
|
-
duration: WorkspaceTimeoutDuration
|
|
339
|
-
|
|
385
|
+
duration: WorkspaceTimeoutDuration;
|
|
386
|
+
durationRaw: string;
|
|
387
|
+
canChange: boolean;
|
|
340
388
|
}
|
|
341
389
|
|
|
342
390
|
export interface StartWorkspaceResult {
|
|
343
|
-
instanceID: string
|
|
344
|
-
workspaceURL?: string
|
|
391
|
+
instanceID: string;
|
|
392
|
+
workspaceURL?: string;
|
|
345
393
|
}
|
|
346
394
|
|
|
347
395
|
export namespace GitpodServer {
|
|
@@ -385,23 +433,23 @@ export namespace GitpodServer {
|
|
|
385
433
|
readonly roundTripTime?: number;
|
|
386
434
|
}
|
|
387
435
|
export interface UpdateOwnAuthProviderParams {
|
|
388
|
-
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry
|
|
436
|
+
readonly entry: AuthProviderEntry.UpdateEntry | AuthProviderEntry.NewEntry;
|
|
389
437
|
}
|
|
390
438
|
export interface DeleteOwnAuthProviderParams {
|
|
391
|
-
readonly id: string
|
|
439
|
+
readonly id: string;
|
|
392
440
|
}
|
|
393
441
|
export type AdmissionLevel = "owner" | "everyone";
|
|
394
442
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
395
443
|
export interface GenerateNewGitpodTokenOptions {
|
|
396
|
-
name?: string
|
|
397
|
-
type: GitpodTokenType
|
|
398
|
-
scopes?: string[]
|
|
444
|
+
name?: string;
|
|
445
|
+
type: GitpodTokenType;
|
|
446
|
+
scopes?: string[];
|
|
399
447
|
}
|
|
400
448
|
}
|
|
401
449
|
|
|
402
|
-
export const GitpodServerPath =
|
|
450
|
+
export const GitpodServerPath = "/gitpod";
|
|
403
451
|
|
|
404
|
-
export const GitpodServerProxy = Symbol(
|
|
452
|
+
export const GitpodServerProxy = Symbol("GitpodServerProxy");
|
|
405
453
|
export type GitpodServerProxy<S extends GitpodServer> = JsonRpcProxy<S>;
|
|
406
454
|
|
|
407
455
|
export class GitpodCompositeClient<Client extends GitpodClient> implements GitpodClient {
|
|
@@ -415,8 +463,8 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
415
463
|
if (index > -1) {
|
|
416
464
|
this.clients.splice(index, 1);
|
|
417
465
|
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
466
|
+
},
|
|
467
|
+
};
|
|
420
468
|
}
|
|
421
469
|
|
|
422
470
|
onInstanceUpdate(instance: WorkspaceInstance): void {
|
|
@@ -425,7 +473,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
425
473
|
try {
|
|
426
474
|
client.onInstanceUpdate(instance);
|
|
427
475
|
} catch (error) {
|
|
428
|
-
console.error(error)
|
|
476
|
+
console.error(error);
|
|
429
477
|
}
|
|
430
478
|
}
|
|
431
479
|
}
|
|
@@ -437,19 +485,22 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
437
485
|
try {
|
|
438
486
|
client.onPrebuildUpdate(update);
|
|
439
487
|
} catch (error) {
|
|
440
|
-
console.error(error)
|
|
488
|
+
console.error(error);
|
|
441
489
|
}
|
|
442
490
|
}
|
|
443
491
|
}
|
|
444
492
|
}
|
|
445
493
|
|
|
446
|
-
onWorkspaceImageBuildLogs(
|
|
494
|
+
onWorkspaceImageBuildLogs(
|
|
495
|
+
info: WorkspaceImageBuild.StateInfo,
|
|
496
|
+
content: WorkspaceImageBuild.LogContent | undefined,
|
|
497
|
+
): void {
|
|
447
498
|
for (const client of this.clients) {
|
|
448
499
|
if (client.onWorkspaceImageBuildLogs) {
|
|
449
500
|
try {
|
|
450
501
|
client.onWorkspaceImageBuildLogs(info, content);
|
|
451
502
|
} catch (error) {
|
|
452
|
-
console.error(error)
|
|
503
|
+
console.error(error);
|
|
453
504
|
}
|
|
454
505
|
}
|
|
455
506
|
}
|
|
@@ -461,7 +512,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
461
512
|
try {
|
|
462
513
|
client.notifyDidOpenConnection();
|
|
463
514
|
} catch (error) {
|
|
464
|
-
console.error(error)
|
|
515
|
+
console.error(error);
|
|
465
516
|
}
|
|
466
517
|
}
|
|
467
518
|
}
|
|
@@ -473,7 +524,7 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
473
524
|
try {
|
|
474
525
|
client.notifyDidCloseConnection();
|
|
475
526
|
} catch (error) {
|
|
476
|
-
console.error(error)
|
|
527
|
+
console.error(error);
|
|
477
528
|
}
|
|
478
529
|
}
|
|
479
530
|
}
|
|
@@ -485,64 +536,61 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
485
536
|
try {
|
|
486
537
|
client.onCreditAlert(creditAlert);
|
|
487
538
|
} catch (error) {
|
|
488
|
-
console.error(error)
|
|
539
|
+
console.error(error);
|
|
489
540
|
}
|
|
490
541
|
}
|
|
491
542
|
}
|
|
492
543
|
}
|
|
493
|
-
|
|
494
544
|
}
|
|
495
545
|
|
|
496
546
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
|
497
547
|
|
|
498
|
-
const hasWindow =
|
|
548
|
+
const hasWindow = typeof window !== "undefined";
|
|
499
549
|
const phasesOrder: Record<WorkspaceInstancePhase, number> = {
|
|
500
550
|
unknown: 0,
|
|
501
551
|
preparing: 1,
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
552
|
+
building: 2,
|
|
553
|
+
pending: 3,
|
|
554
|
+
creating: 4,
|
|
555
|
+
initializing: 5,
|
|
556
|
+
running: 6,
|
|
557
|
+
interrupted: 7,
|
|
558
|
+
stopping: 8,
|
|
559
|
+
stopped: 9,
|
|
509
560
|
};
|
|
510
561
|
export class WorkspaceInstanceUpdateListener {
|
|
511
562
|
private readonly onDidChangeEmitter = new Emitter<void>();
|
|
512
563
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
513
564
|
|
|
514
|
-
private source:
|
|
565
|
+
private source: "sync" | "update" = "sync";
|
|
515
566
|
|
|
516
567
|
get info(): WorkspaceInfo {
|
|
517
568
|
return this._info;
|
|
518
569
|
}
|
|
519
570
|
|
|
520
|
-
constructor(
|
|
521
|
-
private readonly service: GitpodService,
|
|
522
|
-
private _info: WorkspaceInfo
|
|
523
|
-
) {
|
|
571
|
+
constructor(private readonly service: GitpodService, private _info: WorkspaceInfo) {
|
|
524
572
|
service.registerClient({
|
|
525
|
-
onInstanceUpdate: instance => {
|
|
573
|
+
onInstanceUpdate: (instance) => {
|
|
526
574
|
if (this.isOutOfOrder(instance)) {
|
|
527
575
|
return;
|
|
528
576
|
}
|
|
529
577
|
this.cancelSync();
|
|
530
578
|
this._info.latestInstance = instance;
|
|
531
|
-
this.source =
|
|
579
|
+
this.source = "update";
|
|
532
580
|
this.onDidChangeEmitter.fire(undefined);
|
|
533
581
|
},
|
|
534
582
|
notifyDidOpenConnection: () => {
|
|
535
583
|
this.sync();
|
|
536
|
-
}
|
|
584
|
+
},
|
|
537
585
|
});
|
|
538
586
|
if (hasWindow) {
|
|
539
587
|
// learn about page lifecycle here: https://developers.google.com/web/updates/2018/07/page-lifecycle-api
|
|
540
|
-
window.document.addEventListener(
|
|
541
|
-
if (window.document.visibilityState ===
|
|
588
|
+
window.document.addEventListener("visibilitychange", async () => {
|
|
589
|
+
if (window.document.visibilityState === "visible") {
|
|
542
590
|
this.sync();
|
|
543
591
|
}
|
|
544
592
|
});
|
|
545
|
-
window.addEventListener(
|
|
593
|
+
window.addEventListener("pageshow", (e) => {
|
|
546
594
|
if (e.persisted) {
|
|
547
595
|
this.sync();
|
|
548
596
|
}
|
|
@@ -570,12 +618,12 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
570
618
|
return;
|
|
571
619
|
}
|
|
572
620
|
this._info = info;
|
|
573
|
-
this.source =
|
|
621
|
+
this.source = "sync";
|
|
574
622
|
this.onDidChangeEmitter.fire(undefined);
|
|
575
623
|
} catch (e) {
|
|
576
|
-
console.error(
|
|
624
|
+
console.error("failed to sync workspace instance:", e);
|
|
577
625
|
}
|
|
578
|
-
})
|
|
626
|
+
});
|
|
579
627
|
}
|
|
580
628
|
private cancelSync(): void {
|
|
581
629
|
if (this.syncTokenSource) {
|
|
@@ -592,7 +640,7 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
592
640
|
if (instance.workspaceId !== this._info.workspace.id) {
|
|
593
641
|
return true;
|
|
594
642
|
}
|
|
595
|
-
if (this.source ===
|
|
643
|
+
if (this.source === "update") {
|
|
596
644
|
return false;
|
|
597
645
|
}
|
|
598
646
|
if (instance.id !== this.info.latestInstance?.id) {
|
|
@@ -600,15 +648,13 @@ export class WorkspaceInstanceUpdateListener {
|
|
|
600
648
|
}
|
|
601
649
|
return phasesOrder[instance.status.phase] < phasesOrder[this.info.latestInstance.status.phase];
|
|
602
650
|
}
|
|
603
|
-
|
|
604
651
|
}
|
|
605
652
|
|
|
606
653
|
export interface GitpodServiceOptions {
|
|
607
|
-
onReconnect?: () =>
|
|
654
|
+
onReconnect?: () => void | Promise<void>;
|
|
608
655
|
}
|
|
609
656
|
|
|
610
657
|
export class GitpodServiceImpl<Client extends GitpodClient, Server extends GitpodServer> {
|
|
611
|
-
|
|
612
658
|
private readonly compositeClient = new GitpodCompositeClient<Client>();
|
|
613
659
|
|
|
614
660
|
constructor(public readonly server: JsonRpcProxy<Server>, private options?: GitpodServiceOptions) {
|
|
@@ -623,7 +669,8 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
623
669
|
|
|
624
670
|
private readonly instanceListeners = new Map<string, Promise<WorkspaceInstanceUpdateListener>>();
|
|
625
671
|
listenToInstance(workspaceId: string): Promise<WorkspaceInstanceUpdateListener> {
|
|
626
|
-
const listener =
|
|
672
|
+
const listener =
|
|
673
|
+
this.instanceListeners.get(workspaceId) ||
|
|
627
674
|
(async () => {
|
|
628
675
|
const info = await this.server.getWorkspace(workspaceId);
|
|
629
676
|
return new WorkspaceInstanceUpdateListener(this, info);
|
|
@@ -639,26 +686,25 @@ export class GitpodServiceImpl<Client extends GitpodClient, Server extends Gitpo
|
|
|
639
686
|
}
|
|
640
687
|
}
|
|
641
688
|
|
|
642
|
-
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
689
|
+
export function createGitpodService<C extends GitpodClient, S extends GitpodServer>(
|
|
690
|
+
serverUrl: string | Promise<string>,
|
|
691
|
+
) {
|
|
643
692
|
const toWsUrl = (serverUrl: string) => {
|
|
644
|
-
return new GitpodHostUrl(serverUrl)
|
|
645
|
-
.asWebsocket()
|
|
646
|
-
.withApi({ pathname: GitpodServerPath })
|
|
647
|
-
.toString();
|
|
693
|
+
return new GitpodHostUrl(serverUrl).asWebsocket().withApi({ pathname: GitpodServerPath }).toString();
|
|
648
694
|
};
|
|
649
695
|
let url: string | Promise<string>;
|
|
650
696
|
if (typeof serverUrl === "string") {
|
|
651
697
|
url = toWsUrl(serverUrl);
|
|
652
698
|
} else {
|
|
653
|
-
url = serverUrl.then(url => toWsUrl(url));
|
|
699
|
+
url = serverUrl.then((url) => toWsUrl(url));
|
|
654
700
|
}
|
|
655
701
|
|
|
656
702
|
const connectionProvider = new WebSocketConnectionProvider();
|
|
657
|
-
let onReconnect = () => {
|
|
703
|
+
let onReconnect = () => {};
|
|
658
704
|
const gitpodServer = connectionProvider.createProxy<S>(url, undefined, {
|
|
659
|
-
onListening: socket => {
|
|
705
|
+
onListening: (socket) => {
|
|
660
706
|
onReconnect = () => socket.reconnect();
|
|
661
|
-
}
|
|
707
|
+
},
|
|
662
708
|
});
|
|
663
709
|
return new GitpodServiceImpl<C, S>(gitpodServer, { onReconnect });
|
|
664
|
-
}
|
|
710
|
+
}
|
|
@@ -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
|
+
}
|