@gitpod/gitpod-protocol 0.1.5-pluggable-workspace-cluster.21 → 0.1.5-port-description-3059-fork.6
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 +13 -24
- package/lib/accounting-protocol.d.ts +3 -6
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +10 -16
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +15 -4
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +15 -0
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +45 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- 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 +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 +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 +97 -19
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +155 -278
- 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/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 +5 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +4 -6
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +175 -44
- 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 +2 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +4 -2
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/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 +2 -1
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +14 -13
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +210 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +570 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +68 -13
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +68 -115
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.d.ts +4 -4
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +15 -12
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +110 -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 +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +79 -0
- package/lib/util/analytics.js.map +1 -0
- 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.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +13 -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 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +98 -98
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +6 -0
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +102 -30
- 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/jaeger-client-types.d.ts +68 -0
- package/lib/util/jaeger-client-types.d.ts.map +1 -0
- package/lib/util/{without.js → jaeger-client-types.js} +1 -1
- 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 +22 -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 +5 -2
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.js +2 -2
- package/package.json +29 -16
- package/pkg-yarn.lock +17 -9
- package/src/accounting-protocol.ts +4 -10
- package/src/admin-protocol.ts +33 -5
- package/src/analytics.ts +54 -0
- package/src/context-url.spec.ts +39 -0
- package/src/context-url.ts +51 -0
- package/src/email-protocol.ts +2 -3
- package/src/env.ts +10 -10
- package/src/gitpod-service.ts +132 -35
- package/src/headless-workspace-log.ts +7 -11
- package/src/ide-protocol.ts +92 -0
- package/src/index.ts +6 -1
- package/src/messaging/browser/connection.ts +184 -23
- package/src/messaging/client-call-metrics.ts +97 -0
- package/src/messaging/error.ts +5 -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 +2 -1
- package/src/plans.ts +632 -0
- package/src/protocol.ts +91 -18
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +7 -5
- package/src/teams-projects-protocol.ts +141 -0
- package/src/util/analytics.ts +87 -0
- package/src/util/garbage-collected-cache.ts +9 -3
- package/src/util/generate-workspace-id.spec.ts +3 -3
- package/src/util/generate-workspace-id.ts +2 -0
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.spec.ts +24 -0
- package/src/util/gitpod-host-url.ts +23 -10
- package/src/util/grpc.ts +15 -0
- 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/semaphore.ts +2 -2
- package/src/util/skip-if.ts +1 -1
- package/src/util/timeutil.ts +4 -4
- package/src/util/tracing.spec.ts +83 -0
- package/src/util/tracing.ts +157 -18
- package/src/workspace-cluster.ts +24 -8
- package/src/workspace-instance.ts +25 -13
- package/src/wsready.ts +2 -2
- 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/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/lib/util/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/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
package/package.json
CHANGED
|
@@ -1,33 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
+
"@types/react": "17.0.32",
|
|
3
4
|
"ajv": "^6.5.4",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
5
|
+
"analytics-node": "^4.0.1",
|
|
6
|
+
"cookie": "^0.4.1",
|
|
7
|
+
"inversify": "^5.1.1",
|
|
8
|
+
"jaeger-client": "^3.18.1",
|
|
6
9
|
"js-yaml": "^3.10.0",
|
|
7
|
-
"opentracing": "^0.14.
|
|
8
|
-
"prom-client": "^
|
|
10
|
+
"opentracing": "^0.14.5",
|
|
11
|
+
"prom-client": "^13.2.0",
|
|
9
12
|
"random-number-csprng": "^1.0.2",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
+
"react": "17.0.2",
|
|
14
|
+
"react-dom": "17.0.2",
|
|
15
|
+
"reconnecting-websocket": "^4.4.0",
|
|
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",
|
|
13
21
|
"vscode-uri": "^1.0.1",
|
|
14
22
|
"vscode-ws-jsonrpc": "^0.2.0",
|
|
15
|
-
"ws": "^
|
|
23
|
+
"ws": "^7.4.6"
|
|
16
24
|
},
|
|
17
25
|
"devDependencies": {
|
|
18
|
-
"@types/
|
|
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",
|
|
19
30
|
"@types/js-yaml": "^3.10.1",
|
|
31
|
+
"@types/mocha": "^5.2.7",
|
|
32
|
+
"@types/node": "^16.11.6",
|
|
20
33
|
"@types/random-number-csprng": "^1.0.0",
|
|
21
|
-
"@types/uuid": "^3.
|
|
34
|
+
"@types/uuid": "^8.3.1",
|
|
22
35
|
"@types/ws": "^5.1.2",
|
|
23
|
-
"chai": "^4.
|
|
36
|
+
"chai": "^4.3.4",
|
|
24
37
|
"chai-subset": "^1.6.0",
|
|
25
38
|
"mocha": "^5.0.0",
|
|
26
39
|
"mocha-typescript": "^1.1.11",
|
|
27
40
|
"rimraf": "^2.6.2",
|
|
28
41
|
"ts-node": "^9.0.0",
|
|
29
|
-
"typescript": "~4.
|
|
30
|
-
"typescript-json-schema": "^0.
|
|
42
|
+
"typescript": "~4.4.2",
|
|
43
|
+
"typescript-json-schema": "^0.50.1",
|
|
31
44
|
"typescript-parser": "^2.6.1"
|
|
32
45
|
},
|
|
33
46
|
"files": [
|
|
@@ -43,9 +56,9 @@
|
|
|
43
56
|
"build": "tsc",
|
|
44
57
|
"clean": "rimraf lib",
|
|
45
58
|
"prepare": "yarn run clean && yarn run build",
|
|
46
|
-
"test": "mocha --opts mocha.opts '
|
|
59
|
+
"test": "mocha --opts mocha.opts './**/*.spec.ts' --exclude './node_modules/**'",
|
|
47
60
|
"watch": "leeway exec --package .:lib --transitive-dependencies --filter-type yarn --components --parallel -- tsc -w --preserveWatchOutput"
|
|
48
61
|
},
|
|
49
62
|
"types": "./lib/index.d.ts",
|
|
50
|
-
"version": "0.1.5-
|
|
51
|
-
}
|
|
63
|
+
"version": "0.1.5-port-description-3059-fork.6"
|
|
64
|
+
}
|
package/pkg-yarn.lock
CHANGED
|
@@ -4,19 +4,27 @@
|
|
|
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/d0a684835a74e617295f530ab6aab84f9c1529e5.tar.gz"
|
|
8
8
|
dependencies:
|
|
9
|
+
"@types/react" "17.0.32"
|
|
9
10
|
ajv "^6.5.4"
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
analytics-node "^4.0.1"
|
|
12
|
+
cookie "^0.4.1"
|
|
13
|
+
inversify "^5.1.1"
|
|
14
|
+
jaeger-client "^3.18.1"
|
|
12
15
|
js-yaml "^3.10.0"
|
|
13
|
-
opentracing "^0.14.
|
|
14
|
-
prom-client "^
|
|
16
|
+
opentracing "^0.14.5"
|
|
17
|
+
prom-client "^13.2.0"
|
|
15
18
|
random-number-csprng "^1.0.2"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
react "17.0.2"
|
|
20
|
+
react-dom "17.0.2"
|
|
21
|
+
reconnecting-websocket "^4.4.0"
|
|
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"
|
|
19
27
|
vscode-uri "^1.0.1"
|
|
20
28
|
vscode-ws-jsonrpc "^0.2.0"
|
|
21
|
-
ws "^
|
|
29
|
+
ws "^7.4.6"
|
|
22
30
|
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import { Without } from "./util/without";
|
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
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;
|
|
@@ -91,7 +90,6 @@ export interface SessionDescription {
|
|
|
91
90
|
contextUrl: string;
|
|
92
91
|
workspaceId: string;
|
|
93
92
|
workspaceInstanceId: string;
|
|
94
|
-
private: boolean;
|
|
95
93
|
}
|
|
96
94
|
export namespace SessionDescription {
|
|
97
95
|
export function is(obj: any): obj is SessionDescription {
|
|
@@ -100,7 +98,6 @@ export namespace SessionDescription {
|
|
|
100
98
|
&& obj.hasOwnProperty('contextUrl')
|
|
101
99
|
&& obj.hasOwnProperty('workspaceId')
|
|
102
100
|
&& obj.hasOwnProperty('workspaceInstanceId')
|
|
103
|
-
&& obj.hasOwnProperty('private');
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
|
|
@@ -164,7 +161,7 @@ export namespace AssignedTeamSubscription {
|
|
|
164
161
|
}
|
|
165
162
|
|
|
166
163
|
export namespace Subscription {
|
|
167
|
-
export function create(newSubscription:
|
|
164
|
+
export function create(newSubscription: Omit<Subscription, 'uid'>) {
|
|
168
165
|
const subscription = newSubscription as Subscription;
|
|
169
166
|
subscription.uid = uuidv4();
|
|
170
167
|
return subscription;
|
|
@@ -193,9 +190,6 @@ export namespace Subscription {
|
|
|
193
190
|
export function isDowngraded(s: Subscription) {
|
|
194
191
|
return s.paymentData && s.paymentData.downgradeDate;
|
|
195
192
|
};
|
|
196
|
-
export function isCancelled(s: Subscription) {
|
|
197
|
-
return !!s.cancellationDate;
|
|
198
|
-
};
|
|
199
193
|
export function calculateCurrentPeriod(startDate: string, now: Date) {
|
|
200
194
|
let nextStartDate = startDate;
|
|
201
195
|
do {
|
|
@@ -215,7 +209,7 @@ export interface Period {
|
|
|
215
209
|
|
|
216
210
|
export type MaybePeriod = Period | undefined;
|
|
217
211
|
|
|
218
|
-
export type AccountEntryFixedPeriod =
|
|
212
|
+
export type AccountEntryFixedPeriod = Omit<AccountEntry, 'uid'> & { expiryDate: string };
|
|
219
213
|
export interface AccountStatement extends Period {
|
|
220
214
|
userId: string;
|
|
221
215
|
/**
|
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";
|
|
@@ -21,6 +20,7 @@ export interface AdminServer {
|
|
|
21
20
|
adminGetWorkspaces(req: AdminGetWorkspacesRequest): Promise<AdminGetListResult<WorkspaceAndInstance>>;
|
|
22
21
|
adminGetWorkspace(id: string): Promise<WorkspaceAndInstance>;
|
|
23
22
|
adminForceStopWorkspace(id: string): Promise<void>;
|
|
23
|
+
adminRestoreSoftDeletedWorkspace(id: string): Promise<void>;
|
|
24
24
|
|
|
25
25
|
adminSetLicense(key: string): Promise<void>;
|
|
26
26
|
|
|
@@ -28,6 +28,7 @@ export interface AdminServer {
|
|
|
28
28
|
adminSetProfessionalOpenSource(userId: string, shouldGetProfOSS: boolean): Promise<void>;
|
|
29
29
|
adminIsStudent(userId: string): Promise<boolean>;
|
|
30
30
|
adminAddStudentEmailDomain(userId: string, domain: string): Promise<void>;
|
|
31
|
+
adminGrantExtraHours(userId: string, extraHours: number): Promise<void>;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export interface AdminGetListRequest<T> {
|
|
@@ -64,7 +65,7 @@ export interface AdminModifyPermanentWorkspaceFeatureFlagRequest {
|
|
|
64
65
|
}[]
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
export interface WorkspaceAndInstance extends
|
|
68
|
+
export interface WorkspaceAndInstance extends Omit<Workspace, "id"|"creationTime">, Omit<WorkspaceInstance, "id"|"creationTime"> {
|
|
68
69
|
workspaceId: string;
|
|
69
70
|
workspaceCreationTime: string;
|
|
70
71
|
instanceId: string;
|
|
@@ -72,6 +73,33 @@ export interface WorkspaceAndInstance extends Without<Workspace, "id"|"creationT
|
|
|
72
73
|
phase: WorkspaceInstancePhase;
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
export
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
export namespace WorkspaceAndInstance {
|
|
77
|
+
export function toWorkspace(wai: WorkspaceAndInstance): Workspace {
|
|
78
|
+
return {
|
|
79
|
+
id: wai.workspaceId,
|
|
80
|
+
creationTime: wai.workspaceCreationTime,
|
|
81
|
+
... wai
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function toInstance(wai: WorkspaceAndInstance): WorkspaceInstance | undefined {
|
|
86
|
+
if (!wai.instanceId) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
id: wai.instanceId,
|
|
91
|
+
creationTime: wai.instanceCreationTime,
|
|
92
|
+
... wai
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
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,54 @@
|
|
|
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 type RemoteIdentifyMessage = Omit<IdentifyMessage, "timestamp" | "userId" | "anonymousId">;
|
|
45
|
+
|
|
46
|
+
export interface IAnalyticsWriter {
|
|
47
|
+
|
|
48
|
+
identify(msg: IdentifyMessage): void;
|
|
49
|
+
|
|
50
|
+
track(msg: TrackMessage): void;
|
|
51
|
+
|
|
52
|
+
page(msg: PageMessage): void;
|
|
53
|
+
|
|
54
|
+
}
|
|
@@ -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,8 +4,7 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import uuidv4 = require("uuid/v4");
|
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
9
8
|
|
|
10
9
|
export type EMailState = "scheduledInternal"
|
|
11
10
|
| "scheduledSendgrid";
|
|
@@ -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")
|