@gitpod/gitpod-protocol 0.1.5-se-workspace-for-teams.0 → 0.1.5-se-init.1
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 +9 -2
- package/lib/accounting-protocol.d.ts +0 -1
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +10 -11
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +8 -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 +13 -1
- package/lib/analytics.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.js +45 -48
- package/lib/context-url.spec.js.map +1 -1
- package/lib/email-protocol.js +4 -4
- package/lib/email-protocol.js.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.js +19 -20
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +29 -36
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.js +29 -43
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.js +25 -30
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +0 -1
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +12 -14
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.js +25 -41
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +116 -116
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +31 -9
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +149 -295
- package/lib/gitpod-service.js.map +1 -1
- package/lib/ide-protocol.d.ts +81 -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 +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.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 +172 -35
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.js +35 -55
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +35 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +83 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/connection-error-handler.js +11 -23
- package/lib/messaging/connection-error-handler.js.map +1 -1
- package/lib/messaging/error.d.ts +1 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +2 -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/node/connection.d.ts +0 -10
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +12 -50
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +2 -0
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +74 -159
- 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/permission.d.ts +1 -2
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +12 -13
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +1 -1
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +38 -57
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +12 -8
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +44 -114
- 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/lib/snapshot-url.spec.d.ts +7 -0
- 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.js +13 -13
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +15 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +4 -15
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +35 -26
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.js +55 -133
- 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 +8 -8
- 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.js +26 -39
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.js +58 -74
- 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 +26 -46
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.js +11 -67
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +34 -79
- 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 +44 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +1 -0
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +96 -103
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +87 -135
- package/lib/util/gitpod-host-url.spec.js.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/util/jaeger-client-types.js +8 -0
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +49 -33
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +107 -110
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +2 -2
- 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 +31 -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 +144 -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/safe-promise.js +9 -12
- package/lib/util/safe-promise.js.map +1 -1
- package/lib/util/semaphore.js +15 -46
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.js +6 -6
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.js +16 -16
- package/lib/util/timeutil.js.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 +50 -5
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +171 -63
- 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.js +2 -2
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +11 -1
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +3 -3
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +4 -2
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.js +1 -1
- package/package.json +22 -12
- package/pkg-yarn.lock +14 -7
- package/src/accounting-protocol.ts +1 -3
- package/src/admin-protocol.ts +9 -3
- package/src/analytics.ts +16 -1
- package/src/email-protocol.ts +1 -1
- package/src/env.ts +0 -1
- package/src/gitpod-service.ts +31 -10
- package/src/ide-protocol.ts +92 -0
- package/src/index.ts +2 -0
- package/src/messaging/browser/connection.ts +176 -10
- package/src/messaging/client-call-metrics.ts +97 -0
- package/src/messaging/error.ts +2 -2
- package/src/messaging/handler.ts +12 -0
- package/src/messaging/node/connection.ts +3 -47
- package/src/messaging/proxy-factory.ts +13 -5
- package/src/oss-allowlist.ts +15 -0
- package/src/permission.ts +0 -1
- package/src/protocol.ts +14 -9
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +1 -1
- package/src/teams-projects-protocol.ts +19 -1
- package/src/util/analytics.ts +17 -1
- package/src/util/garbage-collected-cache.ts +7 -1
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.ts +9 -5
- package/src/util/grpc.ts +3 -3
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +102 -38
- package/src/util/parse-workspace-id.spec.ts +21 -1
- package/src/util/parse-workspace-id.ts +32 -6
- package/src/util/repeat.ts +45 -0
- package/src/util/tracing.spec.ts +83 -0
- package/src/util/tracing.ts +157 -18
- package/src/workspace-cluster.ts +8 -1
- package/src/workspace-instance.ts +12 -6
- package/src/wsready.ts +1 -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/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
package/package.json
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
+
"@types/react": "17.0.32",
|
|
3
4
|
"ajv": "^6.5.4",
|
|
4
5
|
"analytics-node": "^4.0.1",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
6
|
+
"cookie": "^0.4.1",
|
|
7
|
+
"inversify": "^5.1.1",
|
|
8
|
+
"jaeger-client": "^3.18.1",
|
|
7
9
|
"js-yaml": "^3.10.0",
|
|
8
|
-
"opentracing": "^0.14.
|
|
9
|
-
"prom-client": "^
|
|
10
|
+
"opentracing": "^0.14.5",
|
|
11
|
+
"prom-client": "^13.2.0",
|
|
10
12
|
"random-number-csprng": "^1.0.2",
|
|
13
|
+
"react": "17.0.2",
|
|
14
|
+
"react-dom": "17.0.2",
|
|
11
15
|
"reconnecting-websocket": "^4.4.0",
|
|
12
|
-
"reflect-metadata": "^0.1.
|
|
13
|
-
"uuid": "^
|
|
16
|
+
"reflect-metadata": "^0.1.13",
|
|
17
|
+
"uuid": "^8.3.2",
|
|
18
|
+
"vscode-jsonrpc": "^5.0.1",
|
|
19
|
+
"vscode-languageserver-protocol": "3.16.0",
|
|
20
|
+
"vscode-languageserver-types": "3.16.0",
|
|
14
21
|
"vscode-uri": "^1.0.1",
|
|
15
22
|
"vscode-ws-jsonrpc": "^0.2.0",
|
|
16
23
|
"ws": "^7.4.6"
|
|
17
24
|
},
|
|
18
25
|
"devDependencies": {
|
|
19
|
-
"@types/analytics-node": "^3.1.
|
|
20
|
-
"@types/chai-subset": "^1.3.
|
|
26
|
+
"@types/analytics-node": "^3.1.5",
|
|
27
|
+
"@types/chai-subset": "^1.3.3",
|
|
28
|
+
"@types/cookie": "^0.4.1",
|
|
29
|
+
"@types/jaeger-client": "^3.18.3",
|
|
21
30
|
"@types/js-yaml": "^3.10.1",
|
|
22
31
|
"@types/mocha": "^5.2.7",
|
|
32
|
+
"@types/node": "^16.11.6",
|
|
23
33
|
"@types/random-number-csprng": "^1.0.0",
|
|
24
|
-
"@types/uuid": "^3.
|
|
34
|
+
"@types/uuid": "^8.3.1",
|
|
25
35
|
"@types/ws": "^5.1.2",
|
|
26
|
-
"chai": "^4.
|
|
36
|
+
"chai": "^4.3.4",
|
|
27
37
|
"chai-subset": "^1.6.0",
|
|
28
38
|
"mocha": "^5.0.0",
|
|
29
39
|
"mocha-typescript": "^1.1.11",
|
|
30
40
|
"rimraf": "^2.6.2",
|
|
31
41
|
"ts-node": "^9.0.0",
|
|
32
|
-
"typescript": "~4.
|
|
42
|
+
"typescript": "~4.4.2",
|
|
33
43
|
"typescript-json-schema": "^0.50.1",
|
|
34
44
|
"typescript-parser": "^2.6.1"
|
|
35
45
|
},
|
|
@@ -50,5 +60,5 @@
|
|
|
50
60
|
"watch": "leeway exec --package .:lib --transitive-dependencies --filter-type yarn --components --parallel -- tsc -w --preserveWatchOutput"
|
|
51
61
|
},
|
|
52
62
|
"types": "./lib/index.d.ts",
|
|
53
|
-
"version": "0.1.5-se-
|
|
63
|
+
"version": "0.1.5-se-init.1"
|
|
54
64
|
}
|
package/pkg-yarn.lock
CHANGED
|
@@ -4,19 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
"@gitpod/gitpod-protocol@0.1.5":
|
|
6
6
|
version "0.1.5"
|
|
7
|
-
resolved "file:///tmp/cache/
|
|
7
|
+
resolved "file:///tmp/cache/0ef62aa0edd0ed76d05ebbad23f12233d1184a2c.tar.gz"
|
|
8
8
|
dependencies:
|
|
9
|
+
"@types/react" "17.0.32"
|
|
9
10
|
ajv "^6.5.4"
|
|
10
11
|
analytics-node "^4.0.1"
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
cookie "^0.4.1"
|
|
13
|
+
inversify "^5.1.1"
|
|
14
|
+
jaeger-client "^3.18.1"
|
|
13
15
|
js-yaml "^3.10.0"
|
|
14
|
-
opentracing "^0.14.
|
|
15
|
-
prom-client "^
|
|
16
|
+
opentracing "^0.14.5"
|
|
17
|
+
prom-client "^13.2.0"
|
|
16
18
|
random-number-csprng "^1.0.2"
|
|
19
|
+
react "17.0.2"
|
|
20
|
+
react-dom "17.0.2"
|
|
17
21
|
reconnecting-websocket "^4.4.0"
|
|
18
|
-
reflect-metadata "^0.1.
|
|
19
|
-
uuid "^
|
|
22
|
+
reflect-metadata "^0.1.13"
|
|
23
|
+
uuid "^8.3.2"
|
|
24
|
+
vscode-jsonrpc "^5.0.1"
|
|
25
|
+
vscode-languageserver-protocol "3.16.0"
|
|
26
|
+
vscode-languageserver-types "3.16.0"
|
|
20
27
|
vscode-uri "^1.0.1"
|
|
21
28
|
vscode-ws-jsonrpc "^0.2.0"
|
|
22
29
|
ws "^7.4.6"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
8
8
|
import { User } from './protocol';
|
|
9
9
|
import { oneMonthLater } from './util/timeutil';
|
|
10
10
|
|
|
@@ -90,7 +90,6 @@ export interface SessionDescription {
|
|
|
90
90
|
contextUrl: string;
|
|
91
91
|
workspaceId: string;
|
|
92
92
|
workspaceInstanceId: string;
|
|
93
|
-
private: boolean;
|
|
94
93
|
}
|
|
95
94
|
export namespace SessionDescription {
|
|
96
95
|
export function is(obj: any): obj is SessionDescription {
|
|
@@ -99,7 +98,6 @@ export namespace SessionDescription {
|
|
|
99
98
|
&& obj.hasOwnProperty('contextUrl')
|
|
100
99
|
&& obj.hasOwnProperty('workspaceId')
|
|
101
100
|
&& obj.hasOwnProperty('workspaceInstanceId')
|
|
102
|
-
&& obj.hasOwnProperty('private');
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
103
|
|
package/src/admin-protocol.ts
CHANGED
|
@@ -94,6 +94,12 @@ export namespace WorkspaceAndInstance {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
export
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
export type AdminGetWorkspacesRequest = AdminGetListRequest<WorkspaceAndInstance> & AdminGetWorkspacesQuery;
|
|
98
|
+
/** The fields are meant to be used either OR (not combined) */
|
|
99
|
+
export type AdminGetWorkspacesQuery = {
|
|
100
|
+
/** we use this field in case we have a UUIDv4 and don't know whether it's an (old) workspace or instance id */
|
|
101
|
+
instanceIdOrWorkspaceId?: string;
|
|
102
|
+
instanceId?: string;
|
|
103
|
+
workspaceId?: string;
|
|
104
|
+
ownerId?: string;
|
|
105
|
+
};
|
package/src/analytics.ts
CHANGED
|
@@ -28,7 +28,20 @@ export type TrackMessage = Message & Identity & {
|
|
|
28
28
|
context?: any;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export type
|
|
31
|
+
export type PageMessage = Message & Identity & {
|
|
32
|
+
properties?: any;
|
|
33
|
+
timestamp?: Date;
|
|
34
|
+
context?: any;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type RemoteTrackMessage = Omit<TrackMessage, "timestamp" | "userId" | "anonymousId"> & {
|
|
38
|
+
anonymousId?: string | number;
|
|
39
|
+
};
|
|
40
|
+
export type RemotePageMessage = Omit<PageMessage, "timestamp" | "userId"> & {
|
|
41
|
+
anonymousId?: string | number;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type RemoteIdentifyMessage = Omit<IdentifyMessage, "timestamp" | "userId" | "anonymousId">;
|
|
32
45
|
|
|
33
46
|
export interface IAnalyticsWriter {
|
|
34
47
|
|
|
@@ -36,4 +49,6 @@ export interface IAnalyticsWriter {
|
|
|
36
49
|
|
|
37
50
|
track(msg: TrackMessage): void;
|
|
38
51
|
|
|
52
|
+
page(msg: PageMessage): void;
|
|
53
|
+
|
|
39
54
|
}
|
package/src/email-protocol.ts
CHANGED
package/src/env.ts
CHANGED
|
@@ -25,7 +25,6 @@ export function translateLegacyStagename(kubeStage: string): KubeStage {
|
|
|
25
25
|
@injectable()
|
|
26
26
|
export abstract class AbstractComponentEnv {
|
|
27
27
|
readonly kubeStage: KubeStage = getEnvVarParsed('KUBE_STAGE', translateLegacyStagename);
|
|
28
|
-
readonly kubeNamespace: string = getEnvVar('KUBE_NAMESPACE');
|
|
29
28
|
|
|
30
29
|
readonly installationLongname: string = getEnvVar("GITPOD_INSTALLATION_LONGNAME")
|
|
31
30
|
readonly installationShortname: string = getEnvVar("GITPOD_INSTALLATION_SHORTNAME")
|
package/src/gitpod-service.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from './protocol';
|
|
14
14
|
import {
|
|
15
15
|
Team, TeamMemberInfo,
|
|
16
|
-
TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus
|
|
16
|
+
TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult, PartialProject
|
|
17
17
|
} from './teams-projects-protocol';
|
|
18
18
|
import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
|
|
19
19
|
import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
|
|
@@ -28,7 +28,8 @@ import { Emitter } from './util/event';
|
|
|
28
28
|
import { AccountStatement, CreditAlert } from './accounting-protocol';
|
|
29
29
|
import { GithubUpgradeURL, PlanCoupon } from './payment-protocol';
|
|
30
30
|
import { TeamSubscription, TeamSubscriptionSlot, TeamSubscriptionSlotResolved } from './team-subscription-protocol';
|
|
31
|
-
import { RemoteTrackMessage } from './analytics';
|
|
31
|
+
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from './analytics';
|
|
32
|
+
import { IDEServer } from './ide-protocol';
|
|
32
33
|
|
|
33
34
|
export interface GitpodClient {
|
|
34
35
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
@@ -45,7 +46,7 @@ export interface GitpodClient {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export const GitpodServer = Symbol('GitpodServer');
|
|
48
|
-
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
|
|
49
|
+
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
49
50
|
// User related API
|
|
50
51
|
getLoggedInUser(): Promise<User>;
|
|
51
52
|
getTerms(): Promise<Terms>;
|
|
@@ -123,6 +124,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
123
124
|
removeTeamMember(teamId: string, userId: string): Promise<void>;
|
|
124
125
|
getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
|
|
125
126
|
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
127
|
+
deleteTeam(teamId: string, userId: string): Promise<void>;
|
|
126
128
|
|
|
127
129
|
// Projects
|
|
128
130
|
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
@@ -132,10 +134,14 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
132
134
|
getUserProjects(): Promise<Project[]>;
|
|
133
135
|
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
134
136
|
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
135
|
-
triggerPrebuild(projectId: string,
|
|
136
|
-
|
|
137
|
+
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
138
|
+
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
137
139
|
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
138
140
|
guessProjectConfiguration(projectId: string): Promise<string | undefined>;
|
|
141
|
+
fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
142
|
+
guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
143
|
+
setProjectConfiguration(projectId: string, configString: string): Promise<void>;
|
|
144
|
+
updateProjectPartial(partialProject: PartialProject): Promise<void>;
|
|
139
145
|
|
|
140
146
|
// content service
|
|
141
147
|
getContentBlobUploadUrl(name: string): Promise<string>
|
|
@@ -151,10 +157,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
151
157
|
registerGithubApp(installationId: string): Promise<void>;
|
|
152
158
|
|
|
153
159
|
/**
|
|
154
|
-
* Stores a new snapshot for the given workspace and bucketId
|
|
160
|
+
* Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
|
|
155
161
|
* @return the snapshot id
|
|
156
162
|
*/
|
|
157
163
|
takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
|
|
164
|
+
/**
|
|
165
|
+
*
|
|
166
|
+
* @param snapshotId
|
|
167
|
+
*/
|
|
168
|
+
waitForSnapshot(snapshotId: string): Promise<void>;
|
|
158
169
|
|
|
159
170
|
/**
|
|
160
171
|
* Returns the list of snapshots that exist for a workspace.
|
|
@@ -186,8 +197,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
186
197
|
* gitpod.io concerns
|
|
187
198
|
*/
|
|
188
199
|
isStudent(): Promise<boolean>;
|
|
189
|
-
getPrivateRepoTrialEndDate(): Promise<string | undefined>;
|
|
190
|
-
|
|
191
200
|
/**
|
|
192
201
|
*
|
|
193
202
|
*/
|
|
@@ -205,7 +214,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
205
214
|
|
|
206
215
|
getShowPaymentUI(): Promise<boolean>;
|
|
207
216
|
isChargebeeCustomer(): Promise<boolean>;
|
|
208
|
-
mayAccessPrivateRepo(): Promise<boolean>;
|
|
209
217
|
|
|
210
218
|
subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
211
219
|
subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
@@ -227,10 +235,13 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
227
235
|
* Analytics
|
|
228
236
|
*/
|
|
229
237
|
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
238
|
+
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
239
|
+
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
230
240
|
}
|
|
231
241
|
|
|
232
242
|
export interface CreateProjectParams {
|
|
233
243
|
name: string;
|
|
244
|
+
slug?: string;
|
|
234
245
|
account: string;
|
|
235
246
|
provider: string;
|
|
236
247
|
cloneUrl: string;
|
|
@@ -252,6 +263,7 @@ export interface GetProviderRepositoriesParams {
|
|
|
252
263
|
}
|
|
253
264
|
export interface ProviderRepository {
|
|
254
265
|
name: string;
|
|
266
|
+
path?: string;
|
|
255
267
|
account: string;
|
|
256
268
|
accountAvatarUrl: string;
|
|
257
269
|
cloneUrl: string;
|
|
@@ -259,7 +271,14 @@ export interface ProviderRepository {
|
|
|
259
271
|
installationId?: number;
|
|
260
272
|
installationUpdatedAt?: string;
|
|
261
273
|
|
|
262
|
-
inUse?:
|
|
274
|
+
inUse?: { userName: string };
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface ClientHeaderFields {
|
|
278
|
+
ip?: string;
|
|
279
|
+
userAgent?: string;
|
|
280
|
+
dnt?: string;
|
|
281
|
+
clientRegion?: string;
|
|
263
282
|
}
|
|
264
283
|
|
|
265
284
|
export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
|
|
@@ -322,6 +341,8 @@ export namespace GitpodServer {
|
|
|
322
341
|
export interface TakeSnapshotOptions {
|
|
323
342
|
workspaceId: string;
|
|
324
343
|
layoutData?: string;
|
|
344
|
+
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
345
|
+
dontWait?: boolean;
|
|
325
346
|
}
|
|
326
347
|
export interface GetUserStorageResourceOptions {
|
|
327
348
|
readonly uri: string;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `IDEServer` provides a list of available IDEs.
|
|
9
|
+
*/
|
|
10
|
+
export interface IDEServer {
|
|
11
|
+
/**
|
|
12
|
+
* Returns the IDE preferences.
|
|
13
|
+
*/
|
|
14
|
+
getIDEOptions(): Promise<IDEOptions>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IDEOptions {
|
|
18
|
+
/**
|
|
19
|
+
* A list of available IDEs.
|
|
20
|
+
*/
|
|
21
|
+
options: { [key: string]: IDEOption };
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The default (browser) IDE when the user has not specified one.
|
|
25
|
+
*/
|
|
26
|
+
defaultIde: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The default desktop IDE when the user has not specified one.
|
|
30
|
+
*/
|
|
31
|
+
defaultDesktopIde: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IDEOption {
|
|
35
|
+
/**
|
|
36
|
+
* To ensure a stable order one can set an `orderKey`.
|
|
37
|
+
*/
|
|
38
|
+
orderKey?: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Human readable title text of the IDE (plain text only).
|
|
42
|
+
*/
|
|
43
|
+
title: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The type of the IDE, currently 'browser' or 'desktop'.
|
|
47
|
+
*/
|
|
48
|
+
type: 'browser' | 'desktop';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The logo for the IDE. That could be a key in (see
|
|
52
|
+
* components/dashboard/src/images/ideLogos.ts) or a URL.
|
|
53
|
+
*/
|
|
54
|
+
logo: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Text of an optional tooltip (plain text only).
|
|
58
|
+
*/
|
|
59
|
+
tooltip?: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Text of an optional label next to the IDE option like “Insiders” (plain
|
|
63
|
+
* text only).
|
|
64
|
+
*/
|
|
65
|
+
label?: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Notes to the IDE option that are renderd in the preferences when a user
|
|
69
|
+
* chooses this IDE.
|
|
70
|
+
*/
|
|
71
|
+
notes?: string[];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* If `true` this IDE option is not visible in the IDE preferences.
|
|
75
|
+
*/
|
|
76
|
+
hidden?: boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The image ref to the IDE image.
|
|
80
|
+
*/
|
|
81
|
+
image: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* When this is `true`, the tag of this image is resolved to the latest
|
|
85
|
+
* image digest regularly.
|
|
86
|
+
*
|
|
87
|
+
* This is useful if this image points to a tag like `nightly` that will be
|
|
88
|
+
* updated regularly. When `resolveImageDigest` is `true`, we make sure that
|
|
89
|
+
* we resolve the tag regularly to the most recent image version.
|
|
90
|
+
*/
|
|
91
|
+
resolveImageDigest?: boolean;
|
|
92
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -5,10 +5,13 @@
|
|
|
5
5
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Logger, ConsoleLogger, toSocket, IWebSocket } from "vscode-ws-jsonrpc";
|
|
9
|
+
import { createMessageConnection } from "vscode-jsonrpc";
|
|
10
|
+
import { AbstractMessageWriter } from "vscode-jsonrpc/lib/messageWriter";
|
|
11
|
+
import { AbstractMessageReader } from "vscode-jsonrpc/lib/messageReader";
|
|
9
12
|
import { JsonRpcProxyFactory, JsonRpcProxy } from "../proxy-factory";
|
|
10
|
-
import { ConnectionHandler } from "../handler";
|
|
11
|
-
import ReconnectingWebSocket from 'reconnecting-websocket';
|
|
13
|
+
import { ConnectionEventHandler, ConnectionHandler } from "../handler";
|
|
14
|
+
import ReconnectingWebSocket, { Event } from 'reconnecting-websocket';
|
|
12
15
|
|
|
13
16
|
export interface WebSocketOptions {
|
|
14
17
|
onerror?: (event: Event) => void;
|
|
@@ -29,7 +32,10 @@ export class WebSocketConnectionProvider {
|
|
|
29
32
|
const startListening = (path: string) => {
|
|
30
33
|
const socket = this.listen({
|
|
31
34
|
path,
|
|
32
|
-
onConnection: c => factory.listen(c)
|
|
35
|
+
onConnection: c => factory.listen(c),
|
|
36
|
+
}, {
|
|
37
|
+
onTransportDidClose: () => factory.fireConnectionClosed(),
|
|
38
|
+
onTransportDidOpen: () => factory.fireConnectionOpened(),
|
|
33
39
|
},
|
|
34
40
|
options
|
|
35
41
|
);
|
|
@@ -49,7 +55,7 @@ export class WebSocketConnectionProvider {
|
|
|
49
55
|
/**
|
|
50
56
|
* Install a connection handler for the given path.
|
|
51
57
|
*/
|
|
52
|
-
listen(handler: ConnectionHandler, options?: WebSocketOptions): WebSocket {
|
|
58
|
+
listen(handler: ConnectionHandler, eventHandler: ConnectionEventHandler, options?: WebSocketOptions): WebSocket {
|
|
53
59
|
const url = handler.path;
|
|
54
60
|
const webSocket = this.createWebSocket(url);
|
|
55
61
|
|
|
@@ -64,11 +70,12 @@ export class WebSocketConnectionProvider {
|
|
|
64
70
|
logger.error(JSON.stringify(error));
|
|
65
71
|
});
|
|
66
72
|
}
|
|
67
|
-
doListen(
|
|
68
|
-
webSocket,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
doListen(
|
|
74
|
+
webSocket as any as ReconnectingWebSocket,
|
|
75
|
+
handler,
|
|
76
|
+
eventHandler,
|
|
77
|
+
logger,
|
|
78
|
+
);
|
|
72
79
|
return webSocket;
|
|
73
80
|
}
|
|
74
81
|
|
|
@@ -91,3 +98,162 @@ export class WebSocketConnectionProvider {
|
|
|
91
98
|
}
|
|
92
99
|
|
|
93
100
|
}
|
|
101
|
+
|
|
102
|
+
// The following was extracted from vscode-ws-jsonrpc to make these changes:
|
|
103
|
+
// - switch from WebSocket to ReconnectingWebSocket
|
|
104
|
+
// - webSocket.onopen: making sure it's only ever called once so we're re-using MessageConnection
|
|
105
|
+
// - WebSocketMessageWriter: buffer and re-try messages instead of throwing an error immidiately
|
|
106
|
+
// - WebSocketMessageReader: don't close MessageConnection on 'socket.onclose'
|
|
107
|
+
function doListen(resocket: ReconnectingWebSocket, handler: ConnectionHandler, eventHandler: ConnectionEventHandler, logger: Logger) {
|
|
108
|
+
resocket.addEventListener("close", () => eventHandler.onTransportDidClose());
|
|
109
|
+
|
|
110
|
+
let alreadyOpened = false;
|
|
111
|
+
resocket.onopen = () => {
|
|
112
|
+
// trigerr "open" every time we re-open the underlying websocket
|
|
113
|
+
eventHandler.onTransportDidOpen();
|
|
114
|
+
|
|
115
|
+
// make sure we're only ever creating one MessageConnection, irregardless of how many times we have to re-open the underlying (reconnecting) websocket
|
|
116
|
+
if (alreadyOpened) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
alreadyOpened = true;
|
|
120
|
+
|
|
121
|
+
const connection = createWebSocketConnection(resocket, logger);
|
|
122
|
+
handler.onConnection(connection);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function createWebSocketConnection(resocket: ReconnectingWebSocket, logger: Logger) {
|
|
127
|
+
const socket = toSocket(resocket as any);
|
|
128
|
+
const messageReader = new NonClosingWebSocketMessageReader(socket);
|
|
129
|
+
const messageWriter = new BufferingWebSocketMessageWriter(resocket, logger);
|
|
130
|
+
const connection = createMessageConnection(messageReader, messageWriter, logger);
|
|
131
|
+
connection.onClose(() => connection.dispose());
|
|
132
|
+
return connection;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* This takes vscode-ws-jsonrpc/lib/socket/writer/WebSocketMessageWriter and adds a buffer
|
|
137
|
+
*/
|
|
138
|
+
class BufferingWebSocketMessageWriter extends AbstractMessageWriter {
|
|
139
|
+
protected readonly socket: ReconnectingWebSocket;
|
|
140
|
+
protected readonly logger: Logger;
|
|
141
|
+
protected errorCount: number = 0;
|
|
142
|
+
|
|
143
|
+
protected buffer: any[] = [];
|
|
144
|
+
|
|
145
|
+
constructor(socket: ReconnectingWebSocket, logger: Logger) {
|
|
146
|
+
super();
|
|
147
|
+
this.socket = socket;
|
|
148
|
+
this.logger = logger;
|
|
149
|
+
|
|
150
|
+
socket.addEventListener("open", (event: Event) => this.flushBuffer());
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
write(msg: any) {
|
|
154
|
+
if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
|
|
155
|
+
this.bufferMsg(msg);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
try {
|
|
160
|
+
const content = JSON.stringify(msg);
|
|
161
|
+
this.socket.send(content);
|
|
162
|
+
} catch (e) {
|
|
163
|
+
this.errorCount++;
|
|
164
|
+
this.fireError(e, msg, this.errorCount);
|
|
165
|
+
|
|
166
|
+
this.bufferMsg(msg);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
protected flushBuffer() {
|
|
171
|
+
if (this.buffer.length === 0) {
|
|
172
|
+
return
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const buffer = [...this.buffer];
|
|
176
|
+
this.buffer = [];
|
|
177
|
+
for (const msg of buffer) {
|
|
178
|
+
this.write(msg);
|
|
179
|
+
}
|
|
180
|
+
//this.logger.info(`flushed buffer (${this.buffer.length})`)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
protected bufferMsg(msg: any) {
|
|
184
|
+
this.buffer.push(msg);
|
|
185
|
+
//this.logger.info(`buffered message (${this.buffer.length})`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* This takes vscode-ws-jsonrpc/lib/socket/reader/WebSocketMessageReader and removes the "onClose -> fireClose" connection
|
|
192
|
+
*/
|
|
193
|
+
class NonClosingWebSocketMessageReader extends AbstractMessageReader {
|
|
194
|
+
protected readonly socket: IWebSocket;
|
|
195
|
+
protected readonly events: any[] = [];
|
|
196
|
+
protected state: 'initial' | 'listening' | 'closed' = 'initial';
|
|
197
|
+
protected callback: (message: any) => void = () => {};
|
|
198
|
+
|
|
199
|
+
constructor(socket: IWebSocket) {
|
|
200
|
+
super();
|
|
201
|
+
this.socket = socket;
|
|
202
|
+
this.socket.onMessage(message => this.readMessage(message));
|
|
203
|
+
this.socket.onError(error => this.fireError(error));
|
|
204
|
+
this.socket.onClose((code, reason) => {
|
|
205
|
+
if (code !== 1000) {
|
|
206
|
+
const error = {
|
|
207
|
+
name: '' + code,
|
|
208
|
+
message: `Error during socket reconnect: code = ${code}, reason = ${reason}`
|
|
209
|
+
};
|
|
210
|
+
this.fireError(error);
|
|
211
|
+
}
|
|
212
|
+
// this.fireClose(); // <-- reason for this class to be copied over
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
listen(callback: (message: any) => void) {
|
|
216
|
+
if (this.state === 'initial') {
|
|
217
|
+
this.state = 'listening';
|
|
218
|
+
this.callback = callback;
|
|
219
|
+
while (this.events.length !== 0) {
|
|
220
|
+
const event = this.events.pop();
|
|
221
|
+
if (event.message) {
|
|
222
|
+
this.readMessage(event.message);
|
|
223
|
+
}
|
|
224
|
+
else if (event.error) {
|
|
225
|
+
this.fireError(event.error);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
this.fireClose();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
readMessage(message: any) {
|
|
234
|
+
if (this.state === 'initial') {
|
|
235
|
+
this.events.splice(0, 0, { message });
|
|
236
|
+
}
|
|
237
|
+
else if (this.state === 'listening') {
|
|
238
|
+
const data = JSON.parse(message);
|
|
239
|
+
this.callback(data);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
fireError(error: any) {
|
|
243
|
+
if (this.state === 'initial') {
|
|
244
|
+
this.events.splice(0, 0, { error });
|
|
245
|
+
}
|
|
246
|
+
else if (this.state === 'listening') {
|
|
247
|
+
super.fireError(error);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
fireClose() {
|
|
251
|
+
if (this.state === 'initial') {
|
|
252
|
+
this.events.splice(0, 0, {});
|
|
253
|
+
}
|
|
254
|
+
else if (this.state === 'listening') {
|
|
255
|
+
super.fireClose();
|
|
256
|
+
}
|
|
257
|
+
this.state = 'closed';
|
|
258
|
+
}
|
|
259
|
+
}
|