@gitpod/gitpod-protocol 0.1.5-sefftinge-create-feature-flag-for-4354.0 → 0.1.5-server-vscode-oauth2.11
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 +4 -22
- package/lib/accounting-protocol.d.ts +3 -5
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +6 -11
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +9 -4
- 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 +44 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/{util/without.js → analytics.js} +4 -2
- package/lib/analytics.js.map +1 -0
- package/lib/context-url.d.ts +18 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +49 -0
- package/lib/context-url.js.map +1 -0
- package/lib/{util/context-url.spec.d.ts → context-url.spec.d.ts} +2 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +73 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/email-protocol.d.ts +1 -2
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js +3 -3
- 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 +1 -2
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +20 -21
- 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 +74 -5
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +149 -294
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +8 -11
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +4 -7
- package/lib/headless-workspace-log.js.map +1 -1
- 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 +34 -54
- 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 -0
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +2 -0
- 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.js +21 -21
- 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/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.js +38 -57
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +52 -22
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +68 -115
- package/lib/protocol.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +3 -3
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +13 -10
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +102 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +23 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/util/analytics.d.ts +1 -26
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +36 -28
- 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.js +22 -46
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +12 -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.js +93 -103
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +5 -0
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +92 -70
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +15 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +18 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/logging.d.ts +17 -1
- 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/repeater.js +35 -88
- package/lib/util/repeater.js.map +1 -1
- 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.js +43 -47
- package/lib/util/tracing.js.map +1 -1
- 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 +12 -3
- 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 +3 -0
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.js +1 -1
- package/lib/wsready.js.map +1 -1
- package/package.json +11 -6
- package/pkg-yarn.lock +7 -4
- package/src/accounting-protocol.ts +3 -7
- package/src/admin-protocol.ts +10 -5
- package/src/analytics.ts +52 -0
- package/src/context-url.spec.ts +39 -0
- package/src/context-url.ts +51 -0
- package/src/email-protocol.ts +1 -2
- package/src/env.ts +10 -10
- package/src/gitpod-service.ts +90 -12
- package/src/headless-workspace-log.ts +7 -11
- 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 +3 -0
- package/src/messaging/handler.ts +12 -0
- package/src/messaging/node/connection.ts +2 -2
- package/src/messaging/proxy-factory.ts +13 -5
- package/src/permission.ts +0 -1
- package/src/protocol.ts +73 -28
- package/src/team-subscription-protocol.ts +5 -3
- package/src/teams-projects-protocol.ts +131 -0
- package/src/util/analytics.ts +17 -30
- package/src/util/generate-workspace-id.ts +1 -0
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.spec.ts +20 -0
- package/src/util/gitpod-host-url.ts +1 -1
- package/src/util/grpc.ts +15 -0
- package/src/util/logging.ts +70 -6
- package/src/util/parse-workspace-id.spec.ts +21 -1
- package/src/util/parse-workspace-id.ts +32 -6
- package/src/workspace-cluster.ts +9 -3
- package/src/workspace-instance.ts +19 -7
- package/src/wsready.ts +1 -1
- package/lib/util/context-url.d.ts +0 -13
- package/lib/util/context-url.d.ts.map +0 -1
- package/lib/util/context-url.js +0 -26
- package/lib/util/context-url.js.map +0 -1
- package/lib/util/context-url.spec.d.ts.map +0 -1
- package/lib/util/context-url.spec.js +0 -52
- package/lib/util/context-url.spec.js.map +0 -1
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js.map +0 -1
- package/src/util/context-url.spec.ts +0 -25
- package/src/util/context-url.ts +0 -23
- package/src/util/without.ts +0 -8
package/lib/wsready.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.WorkspaceInitSource = void 0;
|
|
9
|
-
// generated using github.com/32leaves/bel on 2021-
|
|
9
|
+
// generated using github.com/32leaves/bel on 2021-08-03 10:42:32.582603295 +0000 UTC m=+0.005734479
|
|
10
10
|
// DO NOT MODIFY
|
|
11
11
|
var WorkspaceInitSource;
|
|
12
12
|
(function (WorkspaceInitSource) {
|
package/lib/wsready.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wsready.js","sourceRoot":"","sources":["../src/wsready.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"wsready.js","sourceRoot":"","sources":["../src/wsready.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,oGAAoG;AACpG,gBAAgB;AAEhB,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC3B,8DAAuC,CAAA;IACvC,kEAA2C,CAAA;IAC3C,4DAAqC,CAAA;AACzC,CAAC,EAJW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAI9B"}
|
package/package.json
CHANGED
|
@@ -2,23 +2,28 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"ajv": "^6.5.4",
|
|
4
4
|
"analytics-node": "^4.0.1",
|
|
5
|
+
"cookie": "^0.4.1",
|
|
5
6
|
"inversify": "^5.0.1",
|
|
6
7
|
"jaeger-client": "3.17.2",
|
|
7
8
|
"js-yaml": "^3.10.0",
|
|
8
9
|
"opentracing": "^0.14.4",
|
|
9
|
-
"prom-client": "^
|
|
10
|
+
"prom-client": "^13.2.0",
|
|
10
11
|
"random-number-csprng": "^1.0.2",
|
|
11
|
-
"reconnecting-websocket": "^4.
|
|
12
|
+
"reconnecting-websocket": "^4.4.0",
|
|
12
13
|
"reflect-metadata": "^0.1.10",
|
|
13
14
|
"uuid": "^3.3.3",
|
|
15
|
+
"vscode-jsonrpc": "^5.0.1",
|
|
16
|
+
"vscode-languageserver-protocol": "3.15.3",
|
|
14
17
|
"vscode-uri": "^1.0.1",
|
|
15
18
|
"vscode-ws-jsonrpc": "^0.2.0",
|
|
16
|
-
"ws": "^
|
|
19
|
+
"ws": "^7.4.6"
|
|
17
20
|
},
|
|
18
21
|
"devDependencies": {
|
|
19
22
|
"@types/analytics-node": "^3.1.4",
|
|
20
23
|
"@types/chai-subset": "^1.3.1",
|
|
24
|
+
"@types/cookie": "^0.4.1",
|
|
21
25
|
"@types/js-yaml": "^3.10.1",
|
|
26
|
+
"@types/mocha": "^5.2.7",
|
|
22
27
|
"@types/random-number-csprng": "^1.0.0",
|
|
23
28
|
"@types/uuid": "^3.4.5",
|
|
24
29
|
"@types/ws": "^5.1.2",
|
|
@@ -29,7 +34,7 @@
|
|
|
29
34
|
"rimraf": "^2.6.2",
|
|
30
35
|
"ts-node": "^9.0.0",
|
|
31
36
|
"typescript": "~4.1.2",
|
|
32
|
-
"typescript-json-schema": "^0.
|
|
37
|
+
"typescript-json-schema": "^0.50.1",
|
|
33
38
|
"typescript-parser": "^2.6.1"
|
|
34
39
|
},
|
|
35
40
|
"files": [
|
|
@@ -45,9 +50,9 @@
|
|
|
45
50
|
"build": "tsc",
|
|
46
51
|
"clean": "rimraf lib",
|
|
47
52
|
"prepare": "yarn run clean && yarn run build",
|
|
48
|
-
"test": "mocha --opts mocha.opts '
|
|
53
|
+
"test": "mocha --opts mocha.opts './**/*.spec.ts' --exclude './node_modules/**'",
|
|
49
54
|
"watch": "leeway exec --package .:lib --transitive-dependencies --filter-type yarn --components --parallel -- tsc -w --preserveWatchOutput"
|
|
50
55
|
},
|
|
51
56
|
"types": "./lib/index.d.ts",
|
|
52
|
-
"version": "0.1.5-
|
|
57
|
+
"version": "0.1.5-server-vscode-oauth2.11"
|
|
53
58
|
}
|
package/pkg-yarn.lock
CHANGED
|
@@ -4,20 +4,23 @@
|
|
|
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/e6ff35b3336fea858846625b6cfeaf6534895151.tar.gz"
|
|
8
8
|
dependencies:
|
|
9
9
|
ajv "^6.5.4"
|
|
10
10
|
analytics-node "^4.0.1"
|
|
11
|
+
cookie "^0.4.1"
|
|
11
12
|
inversify "^5.0.1"
|
|
12
13
|
jaeger-client "3.17.2"
|
|
13
14
|
js-yaml "^3.10.0"
|
|
14
15
|
opentracing "^0.14.4"
|
|
15
|
-
prom-client "^
|
|
16
|
+
prom-client "^13.2.0"
|
|
16
17
|
random-number-csprng "^1.0.2"
|
|
17
|
-
reconnecting-websocket "^4.
|
|
18
|
+
reconnecting-websocket "^4.4.0"
|
|
18
19
|
reflect-metadata "^0.1.10"
|
|
19
20
|
uuid "^3.3.3"
|
|
21
|
+
vscode-jsonrpc "^5.0.1"
|
|
22
|
+
vscode-languageserver-protocol "3.15.3"
|
|
20
23
|
vscode-uri "^1.0.1"
|
|
21
24
|
vscode-ws-jsonrpc "^0.2.0"
|
|
22
|
-
ws "^
|
|
25
|
+
ws "^7.4.6"
|
|
23
26
|
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as uuidv4 from 'uuid/v4';
|
|
8
|
-
import { Without } from "./util/without";
|
|
9
8
|
import { User } from './protocol';
|
|
10
9
|
import { oneMonthLater } from './util/timeutil';
|
|
11
10
|
|
|
@@ -47,7 +46,7 @@ export interface AccountEntry {
|
|
|
47
46
|
description?: object;
|
|
48
47
|
}
|
|
49
48
|
export namespace AccountEntry {
|
|
50
|
-
export function create<T extends AccountEntry>(entry:
|
|
49
|
+
export function create<T extends AccountEntry>(entry: Omit<T, 'uid'>): T {
|
|
51
50
|
const result = entry as T;
|
|
52
51
|
result.uid = uuidv4();
|
|
53
52
|
return result;
|
|
@@ -164,7 +163,7 @@ export namespace AssignedTeamSubscription {
|
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
export namespace Subscription {
|
|
167
|
-
export function create(newSubscription:
|
|
166
|
+
export function create(newSubscription: Omit<Subscription, 'uid'>) {
|
|
168
167
|
const subscription = newSubscription as Subscription;
|
|
169
168
|
subscription.uid = uuidv4();
|
|
170
169
|
return subscription;
|
|
@@ -193,9 +192,6 @@ export namespace Subscription {
|
|
|
193
192
|
export function isDowngraded(s: Subscription) {
|
|
194
193
|
return s.paymentData && s.paymentData.downgradeDate;
|
|
195
194
|
};
|
|
196
|
-
export function isCancelled(s: Subscription) {
|
|
197
|
-
return !!s.cancellationDate;
|
|
198
|
-
};
|
|
199
195
|
export function calculateCurrentPeriod(startDate: string, now: Date) {
|
|
200
196
|
let nextStartDate = startDate;
|
|
201
197
|
do {
|
|
@@ -215,7 +211,7 @@ export interface Period {
|
|
|
215
211
|
|
|
216
212
|
export type MaybePeriod = Period | undefined;
|
|
217
213
|
|
|
218
|
-
export type AccountEntryFixedPeriod =
|
|
214
|
+
export type AccountEntryFixedPeriod = Omit<AccountEntry, 'uid'> & { expiryDate: string };
|
|
219
215
|
export interface AccountStatement extends Period {
|
|
220
216
|
userId: string;
|
|
221
217
|
/**
|
package/src/admin-protocol.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { User, Workspace, NamedWorkspaceFeatureFlag } from "./protocol";
|
|
8
|
-
import { Without } from "./util/without";
|
|
9
8
|
import { WorkspaceInstance, WorkspaceInstancePhase } from "./workspace-instance";
|
|
10
9
|
import { RoleOrPermission } from "./permission";
|
|
11
10
|
import { AccountStatement } from "./accounting-protocol";
|
|
@@ -66,7 +65,7 @@ export interface AdminModifyPermanentWorkspaceFeatureFlagRequest {
|
|
|
66
65
|
}[]
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
export interface WorkspaceAndInstance extends
|
|
68
|
+
export interface WorkspaceAndInstance extends Omit<Workspace, "id"|"creationTime">, Omit<WorkspaceInstance, "id"|"creationTime"> {
|
|
70
69
|
workspaceId: string;
|
|
71
70
|
workspaceCreationTime: string;
|
|
72
71
|
instanceId: string;
|
|
@@ -95,6 +94,12 @@ export namespace WorkspaceAndInstance {
|
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
export
|
|
99
|
-
|
|
100
|
-
|
|
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
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
export const IAnalyticsWriter = Symbol("IAnalyticsWriter");
|
|
9
|
+
|
|
10
|
+
type Identity =
|
|
11
|
+
| { userId: string | number }
|
|
12
|
+
| { userId?: string | number; anonymousId: string | number };
|
|
13
|
+
|
|
14
|
+
interface Message {
|
|
15
|
+
messageId?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type IdentifyMessage = Message & Identity & {
|
|
19
|
+
traits?: any;
|
|
20
|
+
timestamp?: Date;
|
|
21
|
+
context?: any;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type TrackMessage = Message & Identity & {
|
|
25
|
+
event: string;
|
|
26
|
+
properties?: any;
|
|
27
|
+
timestamp?: Date;
|
|
28
|
+
context?: any;
|
|
29
|
+
};
|
|
30
|
+
|
|
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 interface IAnalyticsWriter {
|
|
45
|
+
|
|
46
|
+
identify(msg: IdentifyMessage): void;
|
|
47
|
+
|
|
48
|
+
track(msg: TrackMessage): void;
|
|
49
|
+
|
|
50
|
+
page(msg: PageMessage): void;
|
|
51
|
+
|
|
52
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020 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
|
+
import * as chai from 'chai';
|
|
8
|
+
import { suite, test } from 'mocha-typescript';
|
|
9
|
+
import { ContextURL } from './context-url';
|
|
10
|
+
const expect = chai.expect;
|
|
11
|
+
|
|
12
|
+
@suite
|
|
13
|
+
export class ContextUrlTest {
|
|
14
|
+
|
|
15
|
+
@test public parseContextUrl_withEnvVar() {
|
|
16
|
+
const actual = ContextURL.parseToURL("passedin=test%20value/https://github.com/gitpod-io/gitpod-test-repo");
|
|
17
|
+
expect(actual?.host).to.equal("github.com");
|
|
18
|
+
expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@test public parseContextUrl_withEnvVar_withoutSchema() {
|
|
22
|
+
const actual = ContextURL.parseToURL("passedin=test%20value/github.com/gitpod-io/gitpod-test-repo");
|
|
23
|
+
expect(actual?.host).to.equal("github.com");
|
|
24
|
+
expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@test public parseContextUrl_withPrebuild() {
|
|
28
|
+
const actual = ContextURL.parseToURL("prebuild/https://github.com/gitpod-io/gitpod-test-repo");
|
|
29
|
+
expect(actual?.host).to.equal("github.com");
|
|
30
|
+
expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@test public parseContextUrl_withPrebuild_withoutSchema() {
|
|
34
|
+
const actual = ContextURL.parseToURL("prebuild/github.com/gitpod-io/gitpod-test-repo");
|
|
35
|
+
expect(actual?.host).to.equal("github.com");
|
|
36
|
+
expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
module.exports = new ContextUrlTest()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020 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
|
+
export namespace ContextURL {
|
|
8
|
+
export const INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
|
|
9
|
+
export const PREBUILD_PREFIX = "prebuild";
|
|
10
|
+
export const IMAGEBUILD_PREFIX = "imagebuild";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The field "contextUrl" might contain prefixes like:
|
|
14
|
+
* - envvar1=value1/...
|
|
15
|
+
* - prebuild/...
|
|
16
|
+
* This is the analogon to the (Prefix)ContextParser structure in "server".
|
|
17
|
+
*/
|
|
18
|
+
export function parseToURL(contextUrl: string | undefined): URL | undefined {
|
|
19
|
+
if (contextUrl === undefined) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const segments = contextUrl.split("/");
|
|
24
|
+
if (segments.length === 1) {
|
|
25
|
+
return new URL(segments[0]); // this might be something, we just try
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const segmentsToURL = (offset: number): URL => {
|
|
29
|
+
let rest = segments.slice(offset).join("/");
|
|
30
|
+
if (!rest.startsWith("http")) {
|
|
31
|
+
rest = 'https://' + rest;
|
|
32
|
+
}
|
|
33
|
+
return new URL(rest);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
const firstSegment = segments[0];
|
|
38
|
+
if (firstSegment === PREBUILD_PREFIX ||
|
|
39
|
+
firstSegment === INCREMENTAL_PREBUILD_PREFIX ||
|
|
40
|
+
firstSegment === IMAGEBUILD_PREFIX) {
|
|
41
|
+
return segmentsToURL(1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// check for env vars
|
|
45
|
+
if (firstSegment.indexOf("=") !== -1) {
|
|
46
|
+
return segmentsToURL(1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return segmentsToURL(0);
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/email-protocol.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Without } from "./util/without";
|
|
8
7
|
import uuidv4 = require("uuid/v4");
|
|
9
8
|
|
|
10
9
|
export type EMailState = "scheduledInternal"
|
|
@@ -59,7 +58,7 @@ export type EMail = {
|
|
|
59
58
|
} & EMailStatus;
|
|
60
59
|
|
|
61
60
|
export namespace EMail {
|
|
62
|
-
export const create = (ts:
|
|
61
|
+
export const create = (ts: Omit<EMail, 'uid'>): EMail => {
|
|
63
62
|
const withId = ts as EMail;
|
|
64
63
|
withId.uid = uuidv4();
|
|
65
64
|
return withId;
|
package/src/env.ts
CHANGED
|
@@ -13,18 +13,18 @@ const legacyStagenameTranslation: { [key: string]: KubeStage } = {
|
|
|
13
13
|
"dev": "dev"
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export function translateLegacyStagename(kubeStage: string): KubeStage {
|
|
17
|
+
const stage = legacyStagenameTranslation[kubeStage];
|
|
18
|
+
if (!stage) {
|
|
19
|
+
throw new Error(`Invalid KUBE_STAGE: ${kubeStage}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return stage;
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
@injectable()
|
|
17
26
|
export abstract class AbstractComponentEnv {
|
|
18
|
-
readonly kubeStage: KubeStage = getEnvVarParsed('KUBE_STAGE',
|
|
19
|
-
const stage = legacyStagenameTranslation[kubeStage];
|
|
20
|
-
if (!stage) {
|
|
21
|
-
throw new Error(`Environment variable invalid: KUBE_STAGE=${kubeStage}`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return stage;
|
|
25
|
-
});
|
|
26
|
-
readonly kubeNamespace: string = getEnvVar('KUBE_NAMESPACE');
|
|
27
|
-
readonly version: string = getEnvVar('VERSION');
|
|
27
|
+
readonly kubeStage: KubeStage = getEnvVarParsed('KUBE_STAGE', translateLegacyStagename);
|
|
28
28
|
|
|
29
29
|
readonly installationLongname: string = getEnvVar("GITPOD_INSTALLATION_LONGNAME")
|
|
30
30
|
readonly installationShortname: string = getEnvVar("GITPOD_INSTALLATION_SHORTNAME")
|
package/src/gitpod-service.ts
CHANGED
|
@@ -9,11 +9,15 @@ import {
|
|
|
9
9
|
WhitelistedRepository, WorkspaceImageBuild, AuthProviderInfo, Branding, CreateWorkspaceMode,
|
|
10
10
|
Token, UserEnvVarValue, ResolvePluginsParams, PreparePluginUploadParams, Terms,
|
|
11
11
|
ResolvedPlugins, Configuration, InstallPluginsParams, UninstallPluginParams, UserInfo, GitpodTokenType,
|
|
12
|
-
GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes
|
|
12
|
+
GitpodToken, AuthProviderEntry, GuessGitTokenScopesParams, GuessedGitTokenScopes
|
|
13
13
|
} from './protocol';
|
|
14
|
+
import {
|
|
15
|
+
Team, TeamMemberInfo,
|
|
16
|
+
TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult
|
|
17
|
+
} from './teams-projects-protocol';
|
|
14
18
|
import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
|
|
15
19
|
import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
|
|
16
|
-
import {
|
|
20
|
+
import { HeadlessLogUrls } from './headless-workspace-log';
|
|
17
21
|
import { WorkspaceInstance, WorkspaceInstancePort, WorkspaceInstancePhase } from './workspace-instance';
|
|
18
22
|
import { AdminServer } from './admin-protocol';
|
|
19
23
|
import { GitpodHostUrl } from './util/gitpod-host-url';
|
|
@@ -24,11 +28,13 @@ import { Emitter } from './util/event';
|
|
|
24
28
|
import { AccountStatement, CreditAlert } from './accounting-protocol';
|
|
25
29
|
import { GithubUpgradeURL, PlanCoupon } from './payment-protocol';
|
|
26
30
|
import { TeamSubscription, TeamSubscriptionSlot, TeamSubscriptionSlotResolved } from './team-subscription-protocol';
|
|
31
|
+
import { RemotePageMessage, RemoteTrackMessage } from './analytics';
|
|
27
32
|
|
|
28
33
|
export interface GitpodClient {
|
|
29
34
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
30
35
|
onWorkspaceImageBuildLogs: WorkspaceImageBuild.LogCallback;
|
|
31
|
-
|
|
36
|
+
|
|
37
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void;
|
|
32
38
|
|
|
33
39
|
onCreditAlert(creditAlert: CreditAlert): void;
|
|
34
40
|
|
|
@@ -51,6 +57,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
51
57
|
getBranding(): Promise<Branding>;
|
|
52
58
|
getConfiguration(): Promise<Configuration>;
|
|
53
59
|
getToken(query: GitpodServer.GetTokenSearchOptions): Promise<Token | undefined>;
|
|
60
|
+
getGitpodTokenScopes(tokenHash: string): Promise<string[]>;
|
|
54
61
|
/**
|
|
55
62
|
* @deprecated
|
|
56
63
|
*/
|
|
@@ -82,8 +89,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
82
89
|
updateWorkspaceUserPin(id: string, action: GitpodServer.PinAction): Promise<void>;
|
|
83
90
|
sendHeartBeat(options: GitpodServer.SendHeartBeatOptions): Promise<void>;
|
|
84
91
|
watchWorkspaceImageBuildLogs(workspaceId: string): Promise<void>;
|
|
85
|
-
watchHeadlessWorkspaceLogs(workspaceId: string): Promise<void>;
|
|
86
92
|
isPrebuildDone(pwsid: string): Promise<boolean>;
|
|
93
|
+
getHeadlessLog(instanceId: string): Promise<HeadlessLogUrls>;
|
|
87
94
|
|
|
88
95
|
// Workspace timeout
|
|
89
96
|
setWorkspaceTimeout(workspaceId: string, duration: WorkspaceTimeoutDuration): Promise<SetWorkspaceTimeoutResult>;
|
|
@@ -101,14 +108,36 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
101
108
|
getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
|
|
102
109
|
updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
|
|
103
110
|
|
|
104
|
-
//
|
|
111
|
+
// User env vars
|
|
105
112
|
getEnvVars(): Promise<UserEnvVarValue[]>;
|
|
106
113
|
getAllEnvVars(): Promise<UserEnvVarValue[]>;
|
|
107
114
|
setEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
108
115
|
deleteEnvVar(variable: UserEnvVarValue): Promise<void>;
|
|
109
116
|
|
|
110
|
-
//
|
|
117
|
+
// Teams
|
|
111
118
|
getTeams(): Promise<Team[]>;
|
|
119
|
+
getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
|
|
120
|
+
createTeam(name: string): Promise<Team>;
|
|
121
|
+
joinTeam(inviteId: string): Promise<Team>;
|
|
122
|
+
setTeamMemberRole(teamId: string, userId: string, role: TeamMemberRole): Promise<void>;
|
|
123
|
+
removeTeamMember(teamId: string, userId: string): Promise<void>;
|
|
124
|
+
getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
|
|
125
|
+
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
126
|
+
deleteTeam(teamId: string, userId: string): Promise<void>;
|
|
127
|
+
|
|
128
|
+
// Projects
|
|
129
|
+
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
130
|
+
createProject(params: CreateProjectParams): Promise<Project>;
|
|
131
|
+
deleteProject(projectId: string): Promise<void>;
|
|
132
|
+
getTeamProjects(teamId: string): Promise<Project[]>;
|
|
133
|
+
getUserProjects(): Promise<Project[]>;
|
|
134
|
+
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
135
|
+
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
136
|
+
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
137
|
+
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
138
|
+
setProjectConfiguration(projectId: string, configString: string): Promise<void>;
|
|
139
|
+
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
140
|
+
guessProjectConfiguration(projectId: string): Promise<string | undefined>;
|
|
112
141
|
|
|
113
142
|
// content service
|
|
114
143
|
getContentBlobUploadUrl(name: string): Promise<string>
|
|
@@ -196,6 +225,51 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
196
225
|
|
|
197
226
|
getGithubUpgradeUrls(): Promise<GithubUpgradeURL[]>;
|
|
198
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Analytics
|
|
230
|
+
*/
|
|
231
|
+
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
232
|
+
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface CreateProjectParams {
|
|
236
|
+
name: string;
|
|
237
|
+
account: string;
|
|
238
|
+
provider: string;
|
|
239
|
+
cloneUrl: string;
|
|
240
|
+
teamId?: string;
|
|
241
|
+
userId?: string;
|
|
242
|
+
appInstallationId: string;
|
|
243
|
+
}
|
|
244
|
+
export interface FindPrebuildsParams {
|
|
245
|
+
projectId: string;
|
|
246
|
+
branch?: string;
|
|
247
|
+
latest?: boolean;
|
|
248
|
+
prebuildId?: string;
|
|
249
|
+
// default: 30
|
|
250
|
+
limit?: number;
|
|
251
|
+
}
|
|
252
|
+
export interface GetProviderRepositoriesParams {
|
|
253
|
+
provider: string;
|
|
254
|
+
hints?: { installationId: string } | object;
|
|
255
|
+
}
|
|
256
|
+
export interface ProviderRepository {
|
|
257
|
+
name: string;
|
|
258
|
+
account: string;
|
|
259
|
+
accountAvatarUrl: string;
|
|
260
|
+
cloneUrl: string;
|
|
261
|
+
updatedAt: string;
|
|
262
|
+
installationId?: number;
|
|
263
|
+
installationUpdatedAt?: string;
|
|
264
|
+
|
|
265
|
+
inUse?: boolean;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface ClientHeaderFields{
|
|
269
|
+
ip?:string;
|
|
270
|
+
userAgent?:string;
|
|
271
|
+
dnt?:number;
|
|
272
|
+
clientRegion?:string;
|
|
199
273
|
}
|
|
200
274
|
|
|
201
275
|
export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
|
|
@@ -208,6 +282,7 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
|
|
|
208
282
|
methods.setClient = methods.setClient || (() => { });
|
|
209
283
|
methods.dispose = methods.dispose || (() => { });
|
|
210
284
|
return new Proxy<JsonRpcProxy<S>>(methods as any as JsonRpcProxy<S>, {
|
|
285
|
+
// @ts-ignore
|
|
211
286
|
get: (target: S, property: keyof S) => {
|
|
212
287
|
const result = target[property];
|
|
213
288
|
if (!result) {
|
|
@@ -240,6 +315,8 @@ export namespace GitpodServer {
|
|
|
240
315
|
limit?: number;
|
|
241
316
|
searchString?: string;
|
|
242
317
|
pinnedOnly?: boolean;
|
|
318
|
+
projectId?: string | string[];
|
|
319
|
+
includeWithoutProject?: boolean;
|
|
243
320
|
}
|
|
244
321
|
export interface GetAccountStatementOptions {
|
|
245
322
|
date?: string;
|
|
@@ -247,6 +324,7 @@ export namespace GitpodServer {
|
|
|
247
324
|
export interface CreateWorkspaceOptions {
|
|
248
325
|
contextUrl: string;
|
|
249
326
|
mode?: CreateWorkspaceMode;
|
|
327
|
+
forceDefaultConfig?: boolean;
|
|
250
328
|
}
|
|
251
329
|
export interface StartWorkspaceOptions {
|
|
252
330
|
forceDefaultImage: boolean;
|
|
@@ -315,11 +393,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
315
393
|
}
|
|
316
394
|
}
|
|
317
395
|
|
|
318
|
-
|
|
396
|
+
onPrebuildUpdate(update: PrebuildWithStatus): void {
|
|
319
397
|
for (const client of this.clients) {
|
|
320
|
-
if (client.
|
|
398
|
+
if (client.onPrebuildUpdate) {
|
|
321
399
|
try {
|
|
322
|
-
client.
|
|
400
|
+
client.onPrebuildUpdate(update);
|
|
323
401
|
} catch (error) {
|
|
324
402
|
console.error(error)
|
|
325
403
|
}
|
|
@@ -327,11 +405,11 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
327
405
|
}
|
|
328
406
|
}
|
|
329
407
|
|
|
330
|
-
|
|
408
|
+
onWorkspaceImageBuildLogs(info: WorkspaceImageBuild.StateInfo, content: WorkspaceImageBuild.LogContent | undefined): void {
|
|
331
409
|
for (const client of this.clients) {
|
|
332
|
-
if (client.
|
|
410
|
+
if (client.onWorkspaceImageBuildLogs) {
|
|
333
411
|
try {
|
|
334
|
-
client.
|
|
412
|
+
client.onWorkspaceImageBuildLogs(info, content);
|
|
335
413
|
} catch (error) {
|
|
336
414
|
console.error(error)
|
|
337
415
|
}
|
|
@@ -22,21 +22,17 @@ export namespace HeadlessWorkspaceEventType {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export interface
|
|
25
|
+
export interface HeadlessWorkspaceEvent {
|
|
26
26
|
workspaceID: string;
|
|
27
27
|
text: string;
|
|
28
28
|
type: HeadlessWorkspaceEventType;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
TaskSuccessfulLabel = "workspaceTaskDone"
|
|
31
|
+
export interface HeadlessLogUrls {
|
|
32
|
+
// A map of id to URL
|
|
33
|
+
streams: { [streamID: string]: string };
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
error?: string;
|
|
41
|
-
snapshotURL?: string;
|
|
42
|
-
}
|
|
36
|
+
/** cmp. @const HEADLESS_LOG_STREAM_STATUS_CODE_REGEX */
|
|
37
|
+
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})/;
|