@gitpod/gitpod-protocol 0.1.5-wth-test.80 → 0.1.5-wv-remove-without-ws-flag.5
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 +132 -5
- package/lib/accounting-protocol.d.ts +19 -11
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +35 -33
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +19 -2
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +1 -1
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/attribution.d.ts +24 -0
- package/lib/attribution.d.ts.map +1 -0
- package/lib/attribution.js +54 -0
- package/lib/attribution.js.map +1 -0
- package/lib/auth.d.ts +1 -1
- package/lib/auth.d.ts.map +1 -1
- package/lib/auth.js +1 -1
- package/lib/billing-mode.d.ts +45 -0
- package/lib/billing-mode.d.ts.map +1 -0
- package/lib/billing-mode.js +44 -0
- package/lib/billing-mode.js.map +1 -0
- package/lib/blocked-repositories-protocol.d.ts +13 -0
- package/lib/blocked-repositories-protocol.d.ts.map +1 -0
- package/lib/blocked-repositories-protocol.js +8 -0
- package/lib/blocked-repositories-protocol.js.map +1 -0
- package/lib/context-url.d.ts +1 -2
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +5 -7
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +1 -3
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +13 -26
- package/lib/context-url.spec.js.map +1 -1
- package/lib/encryption/container-module.d.ts +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +2 -2
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +10 -10
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +3 -4
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +2 -2
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +8 -10
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +1 -6
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +2 -21
- package/lib/env.js.map +1 -1
- package/lib/experiments/always-default.d.ts +8 -0
- package/lib/experiments/always-default.d.ts.map +1 -0
- package/lib/experiments/always-default.js +20 -0
- package/lib/experiments/always-default.js.map +1 -0
- package/lib/experiments/configcat-server.d.ts +10 -0
- package/lib/experiments/configcat-server.d.ts.map +1 -0
- package/lib/experiments/configcat-server.js +37 -0
- package/lib/experiments/configcat-server.js.map +1 -0
- package/lib/experiments/configcat.d.ts +21 -0
- package/lib/experiments/configcat.d.ts.map +1 -0
- package/lib/experiments/configcat.js +51 -0
- package/lib/experiments/configcat.js.map +1 -0
- package/lib/experiments/types.d.ts +22 -0
- package/lib/experiments/types.d.ts.map +1 -0
- package/lib/experiments/types.js +10 -0
- package/lib/experiments/types.js.map +1 -0
- package/lib/frontend-dashboard-service.d.ts +90 -0
- package/lib/frontend-dashboard-service.d.ts.map +1 -0
- package/lib/frontend-dashboard-service.js +49 -0
- package/lib/frontend-dashboard-service.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +7 -7
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.d.ts +1 -1
- package/lib/gitpod-file-parser.spec.js +43 -40
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +73 -55
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +61 -34
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +2 -1
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +3 -2
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +2 -2
- package/lib/ide-frontend-service.js +1 -1
- package/lib/ide-protocol.d.ts +29 -8
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/ide-protocol.js +11 -1
- package/lib/ide-protocol.js.map +1 -1
- package/lib/index.d.ts +17 -17
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +4 -1
- package/lib/installation-admin-protocol.d.ts.map +1 -1
- package/lib/installation-admin-protocol.js +4 -3
- package/lib/installation-admin-protocol.js.map +1 -1
- package/lib/license-protocol.d.ts +8 -1
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +1 -1
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +19 -19
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +5 -5
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +10 -7
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +5 -19
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +35 -23
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +10 -2
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +20 -4
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.js +8 -8
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +1 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +7 -9
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/oss-allowlist.d.ts +1 -1
- package/lib/oss-allowlist.js +1 -1
- package/lib/payment-protocol.d.ts +1 -1
- package/lib/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +2 -2
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +7 -4
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +16 -24
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +5 -4
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +211 -172
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +167 -61
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +282 -106
- package/lib/protocol.js.map +1 -1
- package/lib/protocol.spec.d.ts +7 -0
- package/lib/protocol.spec.d.ts.map +1 -0
- package/lib/protocol.spec.js +127 -0
- package/lib/protocol.spec.js.map +1 -0
- package/lib/snapshot-url.d.ts +1 -1
- package/lib/snapshot-url.js +1 -1
- package/lib/snapshot-url.spec.d.ts +1 -1
- package/lib/snapshot-url.spec.js +1 -1
- package/lib/snapshot-url.spec.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +23 -4
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +21 -6
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +29 -6
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +10 -3
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +3 -3
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/typings/globals.js +1 -1
- package/lib/usage.d.ts +73 -0
- package/lib/usage.d.ts.map +1 -0
- package/lib/usage.js +20 -0
- package/lib/usage.js.map +1 -0
- package/lib/util/analytics.d.ts +1 -1
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +7 -7
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +4 -4
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +1 -1
- package/lib/util/cancelable.js +1 -1
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +1 -1
- package/lib/util/date-time.js +7 -7
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/debug-app.d.ts +25 -0
- package/lib/util/debug-app.d.ts.map +1 -0
- package/lib/util/debug-app.js +100 -0
- package/lib/util/debug-app.js.map +1 -0
- package/lib/util/deep-partial.d.ts +1 -1
- package/lib/util/deep-partial.js +1 -1
- package/lib/util/deferred.d.ts +1 -1
- package/lib/util/deferred.js +1 -1
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +2 -2
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +5 -3
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +7 -2
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +5 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +446 -442
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.d.ts +1 -1
- package/lib/util/generate-workspace-id.spec.js +19 -8
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +2 -2
- package/lib/util/gitpod-cookie.d.ts.map +1 -1
- package/lib/util/gitpod-cookie.js +1 -4
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts +12 -3
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +69 -35
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +16 -6
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +21 -1
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js +74 -2
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/jaeger-client-types.d.ts +1 -1
- package/lib/util/jaeger-client-types.d.ts.map +1 -1
- package/lib/util/jaeger-client-types.js +1 -1
- package/lib/util/logging.d.ts +2 -2
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +32 -26
- package/lib/util/logging.js.map +1 -1
- package/lib/util/logging.spec.d.ts +7 -0
- package/lib/util/logging.spec.d.ts.map +1 -0
- package/lib/util/logging.spec.js +52 -0
- package/lib/util/logging.spec.js.map +1 -0
- package/lib/util/make-link.d.ts +1 -1
- package/lib/util/make-link.js +6 -6
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/nice-grpc.d.ts +9 -0
- package/lib/util/nice-grpc.d.ts.map +1 -0
- package/lib/util/nice-grpc.js +121 -0
- package/lib/util/nice-grpc.js.map +1 -0
- package/lib/util/parse-workspace-id.d.ts +1 -1
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +2 -3
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +1 -1
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +1 -1
- package/lib/util/queue.js +1 -1
- package/lib/util/queue.spec.d.ts +1 -1
- package/lib/util/queue.spec.js +10 -7
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeat.d.ts +1 -1
- package/lib/util/repeat.js +1 -1
- package/lib/util/semaphore.d.ts +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +1 -1
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +1 -1
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +3 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +16 -4
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +3 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +35 -1
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +7 -7
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +15 -17
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.d.ts +1 -1
- package/lib/util/tracing.spec.js +4 -4
- package/lib/util/tracing.spec.js.map +1 -1
- package/lib/util/workspace-port-authentication.d.ts +8 -8
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +9 -12
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/webhook-event.d.ts +44 -0
- package/lib/webhook-event.d.ts.map +1 -0
- package/lib/webhook-event.js +8 -0
- package/lib/webhook-event.js.map +1 -0
- package/lib/workspace-class.d.ts +14 -0
- package/lib/workspace-class.d.ts.map +1 -0
- package/lib/workspace-class.js +8 -0
- package/lib/workspace-class.js.map +1 -0
- package/lib/workspace-cluster.d.ts +13 -14
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +3 -5
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +22 -4
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +1 -1
- package/lib/wsready.d.ts +8 -2
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +3 -3
- package/package.json +14 -6
- package/pkg-yarn.lock +10 -5
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +67 -52
- package/src/admin-protocol.ts +48 -22
- package/src/analytics.ts +22 -22
- package/src/attribution.ts +63 -0
- package/src/auth.ts +3 -3
- package/src/billing-mode.ts +84 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +18 -22
- package/src/context-url.ts +79 -79
- package/src/encryption/container-module.ts +3 -4
- package/src/encryption/encryption-engine.spec.ts +10 -9
- package/src/encryption/encryption-engine.ts +21 -17
- package/src/encryption/encryption-service.ts +5 -6
- package/src/encryption/key-provider.ts +17 -20
- package/src/env.ts +2 -25
- package/src/experiments/always-default.ts +24 -0
- package/src/experiments/configcat-server.ts +42 -0
- package/src/experiments/configcat.ts +56 -0
- package/src/experiments/types.ts +34 -0
- package/src/frontend-dashboard-service.ts +125 -0
- package/src/gitpod-file-parser.spec.ts +56 -62
- package/src/gitpod-file-parser.ts +17 -18
- package/src/gitpod-service.ts +224 -142
- package/src/headless-workspace-log.ts +7 -5
- package/src/ide-frontend-service.ts +3 -3
- package/src/ide-protocol.ts +38 -10
- package/src/index.ts +17 -17
- package/src/installation-admin-protocol.ts +12 -9
- package/src/license-protocol.ts +13 -7
- package/src/messaging/browser/connection.ts +45 -47
- package/src/messaging/browser/window-connection.ts +40 -30
- package/src/messaging/client-call-metrics.ts +79 -82
- package/src/messaging/error.ts +30 -8
- package/src/messaging/handler.ts +6 -6
- package/src/messaging/node/connection.ts +8 -8
- package/src/messaging/proxy-factory.ts +23 -30
- package/src/oss-allowlist.ts +4 -4
- package/src/payment-protocol.ts +3 -3
- package/src/permission.ts +25 -32
- package/src/plans.ts +241 -190
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +527 -265
- package/src/snapshot-url.spec.ts +10 -8
- package/src/snapshot-url.ts +1 -1
- package/src/team-subscription-protocol.ts +60 -23
- package/src/teams-projects-protocol.ts +42 -12
- package/src/typings/globals.ts +6 -5
- package/src/usage.ts +85 -0
- package/src/util/analytics.ts +47 -43
- package/src/util/async-iterator.ts +5 -6
- package/src/util/cancelable.ts +4 -4
- package/src/util/date-time.ts +9 -9
- package/src/util/debug-app.ts +81 -0
- package/src/util/deep-partial.ts +1 -1
- package/src/util/deferred.ts +7 -7
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +9 -7
- package/src/util/generate-workspace-id.spec.ts +27 -17
- package/src/util/generate-workspace-id.ts +461 -455
- package/src/util/gitpod-cookie.ts +9 -10
- package/src/util/gitpod-host-url.spec.ts +41 -14
- package/src/util/gitpod-host-url.ts +82 -39
- package/src/util/grpc.ts +94 -2
- package/src/util/jaeger-client-types.ts +3 -3
- package/src/util/logging.spec.ts +23 -0
- package/src/util/logging.ts +61 -43
- package/src/util/make-link.ts +7 -8
- package/src/util/nice-grpc.ts +96 -0
- package/src/util/parse-workspace-id.spec.ts +18 -9
- package/src/util/parse-workspace-id.ts +6 -7
- package/src/util/queue.spec.ts +28 -26
- package/src/util/queue.ts +1 -1
- package/src/util/repeat.ts +2 -2
- package/src/util/semaphore.ts +5 -7
- package/src/util/skip-if.ts +10 -7
- package/src/util/timeutil.spec.ts +41 -15
- package/src/util/timeutil.ts +28 -12
- package/src/util/tracing.spec.ts +29 -24
- package/src/util/tracing.ts +55 -52
- package/src/util/workspace-port-authentication.ts +11 -14
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +25 -19
- package/src/workspace-instance.ts +67 -25
- package/src/wsready.ts +11 -4
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/email-protocol.d.ts +0 -49
- package/lib/email-protocol.d.ts.map +0 -1
- package/lib/email-protocol.js +0 -28
- package/lib/email-protocol.js.map +0 -1
- package/lib/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.js +0 -8
- package/lib/theia-plugins.js.map +0 -1
- package/src/email-protocol.ts +0 -66
- package/src/theia-plugins.ts +0 -11
|
@@ -1,97 +1,94 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { injectable } from
|
|
8
|
-
import * as prometheusClient from
|
|
9
|
-
|
|
10
|
-
type GrpcMethodType = 'unary' | 'client_stream' | 'server_stream' | 'bidi_stream';
|
|
11
|
-
export interface IGrpcCallMetricsLabels {
|
|
12
|
-
service: string,
|
|
13
|
-
method: string,
|
|
14
|
-
type: GrpcMethodType,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface IGrpcCallMetricsLabelsWithCode extends IGrpcCallMetricsLabels {
|
|
18
|
-
code: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const IClientCallMetrics = Symbol("IClientCallMetrics");
|
|
22
|
-
|
|
23
|
-
export interface IClientCallMetrics {
|
|
24
|
-
started(labels: IGrpcCallMetricsLabels) : void;
|
|
25
|
-
sent(labels: IGrpcCallMetricsLabels) : void;
|
|
26
|
-
received(labels: IGrpcCallMetricsLabels) : void;
|
|
27
|
-
handled(labels: IGrpcCallMetricsLabelsWithCode) : void;
|
|
28
|
-
}
|
|
7
|
+
import { injectable } from "inversify";
|
|
8
|
+
import * as prometheusClient from "prom-client";
|
|
9
|
+
import { IClientCallMetrics, IGrpcCallMetricsLabels, IGrpcCallMetricsLabelsWithCode } from "../util/grpc";
|
|
29
10
|
|
|
30
11
|
@injectable()
|
|
31
12
|
export class PrometheusClientCallMetrics implements IClientCallMetrics {
|
|
13
|
+
readonly startedCounter: prometheusClient.Counter<string>;
|
|
14
|
+
readonly sentCounter: prometheusClient.Counter<string>;
|
|
15
|
+
readonly receivedCounter: prometheusClient.Counter<string>;
|
|
16
|
+
readonly handledCounter: prometheusClient.Counter<string>;
|
|
17
|
+
readonly handledSecondsHistogram: prometheusClient.Histogram<string>;
|
|
32
18
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
constructor() {
|
|
20
|
+
this.startedCounter = new prometheusClient.Counter({
|
|
21
|
+
name: "grpc_client_started_total",
|
|
22
|
+
help: "Total number of RPCs started on the client.",
|
|
23
|
+
labelNames: ["grpc_service", "grpc_method", "grpc_type"],
|
|
24
|
+
registers: [prometheusClient.register],
|
|
25
|
+
});
|
|
26
|
+
this.sentCounter = new prometheusClient.Counter({
|
|
27
|
+
name: "grpc_client_msg_sent_total",
|
|
28
|
+
help: " Total number of gRPC stream messages sent by the client.",
|
|
29
|
+
labelNames: ["grpc_service", "grpc_method", "grpc_type"],
|
|
30
|
+
registers: [prometheusClient.register],
|
|
31
|
+
});
|
|
32
|
+
this.receivedCounter = new prometheusClient.Counter({
|
|
33
|
+
name: "grpc_client_msg_received_total",
|
|
34
|
+
help: "Total number of RPC stream messages received by the client.",
|
|
35
|
+
labelNames: ["grpc_service", "grpc_method", "grpc_type"],
|
|
36
|
+
registers: [prometheusClient.register],
|
|
37
|
+
});
|
|
38
|
+
this.handledCounter = new prometheusClient.Counter({
|
|
39
|
+
name: "grpc_client_handled_total",
|
|
40
|
+
help: "Total number of RPCs completed by the client, regardless of success or failure.",
|
|
41
|
+
labelNames: ["grpc_service", "grpc_method", "grpc_type", "grpc_code"],
|
|
42
|
+
registers: [prometheusClient.register],
|
|
43
|
+
});
|
|
44
|
+
this.handledSecondsHistogram = new prometheusClient.Histogram({
|
|
45
|
+
name: "grpc_client_handling_seconds",
|
|
46
|
+
help: "Histogram of response latency (seconds) of the gRPC until it is finished by the application.",
|
|
47
|
+
labelNames: ["grpc_service", "grpc_method", "grpc_type", "grpc_code"],
|
|
48
|
+
registers: [prometheusClient.register],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
37
51
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.sentCounter = new prometheusClient.Counter({
|
|
46
|
-
name: 'grpc_client_msg_sent_total',
|
|
47
|
-
help: ' Total number of gRPC stream messages sent by the client.',
|
|
48
|
-
labelNames: ['grpc_service', 'grpc_method', 'grpc_type'],
|
|
49
|
-
registers: [prometheusClient.register]
|
|
50
|
-
});
|
|
51
|
-
this.receivedCounter = new prometheusClient.Counter({
|
|
52
|
-
name: 'grpc_client_msg_received_total',
|
|
53
|
-
help: 'Total number of RPC stream messages received by the client.',
|
|
54
|
-
labelNames: ['grpc_service', 'grpc_method', 'grpc_type'],
|
|
55
|
-
registers: [prometheusClient.register]
|
|
56
|
-
});
|
|
57
|
-
this.handledCounter = new prometheusClient.Counter({
|
|
58
|
-
name: 'grpc_client_handled_total',
|
|
59
|
-
help: 'Total number of RPCs completed by the client, regardless of success or failure.',
|
|
60
|
-
labelNames: ['grpc_service', 'grpc_method', 'grpc_type', 'grpc_code'],
|
|
61
|
-
registers: [prometheusClient.register]
|
|
62
|
-
});
|
|
63
|
-
}
|
|
52
|
+
started(labels: IGrpcCallMetricsLabels): void {
|
|
53
|
+
this.startedCounter.inc({
|
|
54
|
+
grpc_service: labels.service,
|
|
55
|
+
grpc_method: labels.method,
|
|
56
|
+
grpc_type: labels.type,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
64
59
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
sent(labels: IGrpcCallMetricsLabels): void {
|
|
61
|
+
this.sentCounter.inc({
|
|
62
|
+
grpc_service: labels.service,
|
|
63
|
+
grpc_method: labels.method,
|
|
64
|
+
grpc_type: labels.type,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
72
67
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
received(labels: IGrpcCallMetricsLabels): void {
|
|
69
|
+
this.receivedCounter.inc({
|
|
70
|
+
grpc_service: labels.service,
|
|
71
|
+
grpc_method: labels.method,
|
|
72
|
+
grpc_type: labels.type,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
80
75
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
handled(labels: IGrpcCallMetricsLabelsWithCode): void {
|
|
77
|
+
this.handledCounter.inc({
|
|
78
|
+
grpc_service: labels.service,
|
|
79
|
+
grpc_method: labels.method,
|
|
80
|
+
grpc_type: labels.type,
|
|
81
|
+
grpc_code: labels.code,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
88
84
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
85
|
+
startHandleTimer(
|
|
86
|
+
labels: IGrpcCallMetricsLabelsWithCode,
|
|
87
|
+
): (labels?: Partial<Record<string, string | number>> | undefined) => number {
|
|
88
|
+
return this.handledSecondsHistogram.startTimer({
|
|
89
|
+
grpc_service: labels.service,
|
|
90
|
+
grpc_method: labels.method,
|
|
91
|
+
grpc_type: labels.type,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
97
94
|
}
|
package/src/messaging/error.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
7
|
export namespace ErrorCodes {
|
|
8
|
+
// 400 Unauthorized
|
|
9
|
+
export const BAD_REQUEST = 400;
|
|
10
|
+
|
|
10
11
|
// 401 Unauthorized
|
|
11
12
|
export const NOT_AUTHENTICATED = 401;
|
|
12
13
|
|
|
@@ -25,21 +26,36 @@ export namespace ErrorCodes {
|
|
|
25
26
|
// 410 No User
|
|
26
27
|
export const SETUP_REQUIRED = 410;
|
|
27
28
|
|
|
29
|
+
// 411 No User
|
|
30
|
+
export const NEEDS_VERIFICATION = 411;
|
|
31
|
+
|
|
28
32
|
// 429 Too Many Requests
|
|
29
33
|
export const TOO_MANY_REQUESTS = 429;
|
|
30
34
|
|
|
31
35
|
// 430 Repository not whitelisted (custom status code)
|
|
32
36
|
export const REPOSITORY_NOT_WHITELISTED = 430;
|
|
33
37
|
|
|
38
|
+
// 440 Prebuilds now always require a project (custom status code)
|
|
39
|
+
export const PROJECT_REQUIRED = 440;
|
|
40
|
+
|
|
41
|
+
// 450 Payment error
|
|
42
|
+
export const PAYMENT_ERROR = 450;
|
|
43
|
+
|
|
44
|
+
// 451 Out of credits
|
|
45
|
+
export const PAYMENT_SPENDING_LIMIT_REACHED = 451;
|
|
46
|
+
|
|
47
|
+
// 451 Error creating a subscription
|
|
48
|
+
export const SUBSCRIPTION_ERROR = 452;
|
|
49
|
+
|
|
50
|
+
// 455 Invalid cost center (custom status code)
|
|
51
|
+
export const INVALID_COST_CENTER = 455;
|
|
52
|
+
|
|
34
53
|
// 460 Context Parse Error (custom status code)
|
|
35
54
|
export const CONTEXT_PARSE_ERROR = 460;
|
|
36
55
|
|
|
37
|
-
// 461 Invalid gitpod yml
|
|
56
|
+
// 461 Invalid gitpod yml (custom status code)
|
|
38
57
|
export const INVALID_GITPOD_YML = 461;
|
|
39
58
|
|
|
40
|
-
// 450 Payment error
|
|
41
|
-
export const PAYMENT_ERROR = 450;
|
|
42
|
-
|
|
43
59
|
// 470 User Blocked (custom status code)
|
|
44
60
|
export const USER_BLOCKED = 470;
|
|
45
61
|
|
|
@@ -61,6 +77,9 @@ export namespace ErrorCodes {
|
|
|
61
77
|
// 490 Too Many Running Workspace
|
|
62
78
|
export const TOO_MANY_RUNNING_WORKSPACES = 490;
|
|
63
79
|
|
|
80
|
+
// 500 Internal Server Error
|
|
81
|
+
export const INTERNAL_SERVER_ERROR = 500;
|
|
82
|
+
|
|
64
83
|
// 501 EE Feature
|
|
65
84
|
export const EE_FEATURE = 501;
|
|
66
85
|
|
|
@@ -81,4 +100,7 @@ export namespace ErrorCodes {
|
|
|
81
100
|
|
|
82
101
|
// 640 Headless logs are not available (yet)
|
|
83
102
|
export const HEADLESS_LOG_NOT_YET_AVAILABLE = 640;
|
|
84
|
-
|
|
103
|
+
|
|
104
|
+
// 650 Invalid Value
|
|
105
|
+
export const INVALID_VALUE = 650;
|
|
106
|
+
}
|
package/src/messaging/handler.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { MessageConnection } from "vscode-jsonrpc";
|
|
9
9
|
|
|
10
|
-
export const ConnectionHandler = Symbol(
|
|
10
|
+
export const ConnectionHandler = Symbol("ConnectionHandler");
|
|
11
11
|
|
|
12
12
|
export interface ConnectionHandler {
|
|
13
13
|
readonly path: string;
|
|
@@ -18,10 +18,10 @@ export interface ConnectionEventHandler {
|
|
|
18
18
|
/**
|
|
19
19
|
* Called when the transport underpinning the connection got closed
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
onTransportDidClose(): void;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Called when the transport underpinning the connection is (re-)opened
|
|
25
|
+
*/
|
|
26
|
+
onTransportDidOpen(): void;
|
|
27
27
|
}
|
|
@@ -10,7 +10,7 @@ import { IWebSocket } from "vscode-ws-jsonrpc";
|
|
|
10
10
|
|
|
11
11
|
export function toIWebSocket(ws: ws) {
|
|
12
12
|
return <IWebSocket>{
|
|
13
|
-
send: content => {
|
|
13
|
+
send: (content) => {
|
|
14
14
|
if (ws.readyState >= ws.CLOSING) {
|
|
15
15
|
// ws is already CLOSING/CLOSED, send() would just return an error.
|
|
16
16
|
return;
|
|
@@ -18,23 +18,23 @@ export function toIWebSocket(ws: ws) {
|
|
|
18
18
|
|
|
19
19
|
// in general send-errors should trigger an 'error' event already, we just make sure it actually happens.
|
|
20
20
|
try {
|
|
21
|
-
ws.send(content, err => {
|
|
21
|
+
ws.send(content, (err) => {
|
|
22
22
|
if (!err) {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
ws.emit(
|
|
25
|
+
ws.emit("error", err);
|
|
26
26
|
});
|
|
27
27
|
} catch (err) {
|
|
28
|
-
ws.emit(
|
|
28
|
+
ws.emit("error", err);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
onMessage: cb => ws.on(
|
|
32
|
-
onError: cb => ws.on(
|
|
33
|
-
onClose: cb => ws.on(
|
|
31
|
+
onMessage: (cb) => ws.on("message", cb),
|
|
32
|
+
onError: (cb) => ws.on("error", cb),
|
|
33
|
+
onClose: (cb) => ws.on("close", cb),
|
|
34
34
|
dispose: () => {
|
|
35
35
|
if (ws.readyState < ws.CLOSING) {
|
|
36
36
|
ws.close();
|
|
37
37
|
}
|
|
38
|
-
}
|
|
38
|
+
},
|
|
39
39
|
};
|
|
40
40
|
}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { MessageConnection, ResponseError } from "vscode-jsonrpc";
|
|
9
9
|
import { Event, Emitter } from "../util/event";
|
|
10
10
|
import { Disposable } from "../util/disposable";
|
|
11
|
-
import { ConnectionHandler } from
|
|
12
|
-
import { log } from
|
|
11
|
+
import { ConnectionHandler } from "./handler";
|
|
12
|
+
import { log } from "../util/logging";
|
|
13
13
|
|
|
14
14
|
export type JsonRpcServer<Client> = Disposable & {
|
|
15
15
|
/**
|
|
@@ -27,10 +27,7 @@ export interface JsonRpcConnectionEventEmitter {
|
|
|
27
27
|
export type JsonRpcProxy<T> = T & JsonRpcConnectionEventEmitter;
|
|
28
28
|
|
|
29
29
|
export class JsonRpcConnectionHandler<T extends object> implements ConnectionHandler {
|
|
30
|
-
constructor(
|
|
31
|
-
readonly path: string,
|
|
32
|
-
readonly targetFactory: (proxy: JsonRpcProxy<T>, request?: object) => any
|
|
33
|
-
) { }
|
|
30
|
+
constructor(readonly path: string, readonly targetFactory: (proxy: JsonRpcProxy<T>, request?: object) => any) {}
|
|
34
31
|
|
|
35
32
|
onConnection(connection: MessageConnection, request?: object): void {
|
|
36
33
|
const factory = new JsonRpcProxyFactory<T>();
|
|
@@ -83,7 +80,6 @@ export class JsonRpcConnectionHandler<T extends object> implements ConnectionHan
|
|
|
83
80
|
* @param <T> - The type of the object to expose to JSON-RPC.
|
|
84
81
|
*/
|
|
85
82
|
export class JsonRpcProxyFactory<T extends object> implements ProxyHandler<T> {
|
|
86
|
-
|
|
87
83
|
protected readonly onDidOpenConnectionEmitter = new Emitter<void>();
|
|
88
84
|
protected readonly onDidCloseConnectionEmitter = new Emitter<void>();
|
|
89
85
|
|
|
@@ -101,17 +97,15 @@ export class JsonRpcProxyFactory<T extends object> implements ProxyHandler<T> {
|
|
|
101
97
|
}
|
|
102
98
|
|
|
103
99
|
protected waitForConnection(): void {
|
|
104
|
-
this.connectionPromise = new Promise(resolve =>
|
|
105
|
-
|
|
106
|
-
);
|
|
107
|
-
this.connectionPromise.then(connection => {
|
|
100
|
+
this.connectionPromise = new Promise((resolve) => (this.connectionPromiseResolve = resolve));
|
|
101
|
+
this.connectionPromise.then((connection) => {
|
|
108
102
|
connection.onClose(() => this.fireConnectionClosed());
|
|
109
103
|
this.fireConnectionOpened();
|
|
110
104
|
});
|
|
111
105
|
}
|
|
112
106
|
|
|
113
107
|
fireConnectionClosed() {
|
|
114
|
-
this.onDidCloseConnectionEmitter.fire(undefined)
|
|
108
|
+
this.onDidCloseConnectionEmitter.fire(undefined);
|
|
115
109
|
}
|
|
116
110
|
|
|
117
111
|
fireConnectionOpened() {
|
|
@@ -204,35 +198,34 @@ export class JsonRpcProxyFactory<T extends object> implements ProxyHandler<T> {
|
|
|
204
198
|
* @returns A callable that executes the JSON-RPC call.
|
|
205
199
|
*/
|
|
206
200
|
get(target: T, p: PropertyKey, receiver: any): any {
|
|
207
|
-
if (p ===
|
|
201
|
+
if (p === "setClient") {
|
|
208
202
|
return (client: any) => {
|
|
209
203
|
this.target = client;
|
|
210
204
|
};
|
|
211
205
|
}
|
|
212
|
-
if (p ===
|
|
206
|
+
if (p === "onDidOpenConnection") {
|
|
213
207
|
return this.onDidOpenConnectionEmitter.event;
|
|
214
208
|
}
|
|
215
|
-
if (p ===
|
|
209
|
+
if (p === "onDidCloseConnection") {
|
|
216
210
|
return this.onDidCloseConnectionEmitter.event;
|
|
217
211
|
}
|
|
218
212
|
const isNotify = this.isNotification(p);
|
|
219
213
|
return (...args: any[]) =>
|
|
220
|
-
this.connectionPromise.then(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
.catch((err: any) => reject(err))
|
|
230
|
-
|
|
214
|
+
this.connectionPromise.then(
|
|
215
|
+
(connection) =>
|
|
216
|
+
new Promise((resolve, reject) => {
|
|
217
|
+
try {
|
|
218
|
+
if (isNotify) {
|
|
219
|
+
connection.sendNotification(p.toString(), ...args);
|
|
220
|
+
resolve(undefined);
|
|
221
|
+
} else {
|
|
222
|
+
const resultPromise = connection.sendRequest(p.toString(), ...args) as Promise<any>;
|
|
223
|
+
resultPromise.catch((err: any) => reject(err)).then((result: any) => resolve(result));
|
|
224
|
+
}
|
|
225
|
+
} catch (err) {
|
|
226
|
+
reject(err);
|
|
231
227
|
}
|
|
232
|
-
}
|
|
233
|
-
reject(err);
|
|
234
|
-
}
|
|
235
|
-
})
|
|
228
|
+
}),
|
|
236
229
|
);
|
|
237
230
|
}
|
|
238
231
|
|
package/src/oss-allowlist.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export interface OssAllowList {
|
|
@@ -9,7 +9,7 @@ export interface OssAllowList {
|
|
|
9
9
|
* A string that identifies a GitHub/GitLab/Bitbucket identity of the form "<host>/<profilename>"
|
|
10
10
|
* E.g., "github.com/geropl"
|
|
11
11
|
*/
|
|
12
|
-
identity: string
|
|
12
|
+
identity: string;
|
|
13
13
|
|
|
14
|
-
deleted?: boolean
|
|
15
|
-
}
|
|
14
|
+
deleted?: boolean;
|
|
15
|
+
}
|
package/src/payment-protocol.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
export const UPDATE_GITPOD_SUBSCRIPTION_PATH =
|
|
7
|
+
export namespace PaymentProtocol {
|
|
8
|
+
export const UPDATE_GITPOD_SUBSCRIPTION_PATH = "/payment/chargebee";
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface PlanCoupon {
|
package/src/permission.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
// see below for explanation
|
|
9
8
|
export const Permissions = {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
monitor: undefined,
|
|
10
|
+
developer: undefined,
|
|
11
|
+
enforcement: undefined,
|
|
12
12
|
"privileged-ws": undefined,
|
|
13
13
|
"registry-access": undefined,
|
|
14
14
|
"admin-users": undefined,
|
|
@@ -18,21 +18,20 @@ export const Permissions = {
|
|
|
18
18
|
"ide-settings": undefined,
|
|
19
19
|
"new-workspace-cluster": undefined,
|
|
20
20
|
};
|
|
21
|
-
export type PermissionName = keyof
|
|
22
|
-
export const Roles = {
|
|
23
|
-
export type RoleName = keyof
|
|
21
|
+
export type PermissionName = keyof typeof Permissions;
|
|
22
|
+
export const Roles = { devops: undefined, viewer: undefined, admin: undefined };
|
|
23
|
+
export type RoleName = keyof typeof Roles;
|
|
24
24
|
export type RoleOrPermission = RoleName | PermissionName;
|
|
25
25
|
|
|
26
26
|
export namespace RoleName {
|
|
27
27
|
export const is = (o: any): o is RoleName => {
|
|
28
|
-
return typeof(
|
|
29
|
-
|
|
30
|
-
}
|
|
28
|
+
return typeof o === "string" && Role.all().some((r) => r.name === o);
|
|
29
|
+
};
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
export interface Role {
|
|
34
|
-
name: RoleName
|
|
35
|
-
permissions: PermissionName[]
|
|
33
|
+
name: RoleName;
|
|
34
|
+
permissions: PermissionName[];
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
export namespace RolesOrPermissions {
|
|
@@ -44,17 +43,20 @@ export namespace RolesOrPermissions {
|
|
|
44
43
|
if (Permission.is(rop)) {
|
|
45
44
|
permissions.add(rop);
|
|
46
45
|
} else if (RoleName.is(rop)) {
|
|
47
|
-
Role.getByName(rop).permissions.forEach(p => permissions.add(p));
|
|
46
|
+
Role.getByName(rop).permissions.forEach((p) => permissions.add(p));
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
return permissions;
|
|
51
|
-
}
|
|
50
|
+
}
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
export namespace Permission {
|
|
55
54
|
/** The permission to monitor the (live) state of a Gitpod installation */
|
|
56
55
|
export const MONITOR: PermissionName = "monitor";
|
|
57
56
|
|
|
57
|
+
/** The permission to develop on this running Gitpod installation */
|
|
58
|
+
export const DEVELOPER: PermissionName = "developer";
|
|
59
|
+
|
|
58
60
|
/** The permission for actions like block user, stop workspace, etc. */
|
|
59
61
|
export const ENFORCEMENT: PermissionName = "enforcement";
|
|
60
62
|
|
|
@@ -77,9 +79,8 @@ export namespace Permission {
|
|
|
77
79
|
export const IDE_SETTINGS: PermissionName = "ide-settings";
|
|
78
80
|
|
|
79
81
|
export const is = (o: any): o is PermissionName => {
|
|
80
|
-
return typeof(
|
|
81
|
-
|
|
82
|
-
}
|
|
82
|
+
return typeof o === "string" && Permission.all().some((p) => p === o);
|
|
83
|
+
};
|
|
83
84
|
|
|
84
85
|
export const all = (): PermissionName[] => {
|
|
85
86
|
return Object.keys(Permissions) as PermissionName[];
|
|
@@ -90,21 +91,13 @@ export namespace Role {
|
|
|
90
91
|
/** The default role for all Gitpod developers */
|
|
91
92
|
export const DEVOPS: Role = {
|
|
92
93
|
name: "devops",
|
|
93
|
-
permissions: [
|
|
94
|
-
Permission.MONITOR,
|
|
95
|
-
Permission.ENFORCEMENT,
|
|
96
|
-
Permission.REGISTRY_ACCESS,
|
|
97
|
-
Permission.IDE_SETTINGS
|
|
98
|
-
]
|
|
94
|
+
permissions: [Permission.MONITOR, Permission.ENFORCEMENT, Permission.REGISTRY_ACCESS, Permission.IDE_SETTINGS],
|
|
99
95
|
};
|
|
100
96
|
|
|
101
97
|
/** A role for people that are allowed to view Gitpod internals */
|
|
102
98
|
export const VIEWER: Role = {
|
|
103
99
|
name: "viewer",
|
|
104
|
-
permissions: [
|
|
105
|
-
Permission.MONITOR,
|
|
106
|
-
Permission.REGISTRY_ACCESS,
|
|
107
|
-
]
|
|
100
|
+
permissions: [Permission.MONITOR, Permission.REGISTRY_ACCESS],
|
|
108
101
|
};
|
|
109
102
|
|
|
110
103
|
export const ADMIN: Role = {
|
|
@@ -115,11 +108,11 @@ export namespace Role {
|
|
|
115
108
|
Permission.ADMIN_PROJECTS,
|
|
116
109
|
Permission.ADMIN_API,
|
|
117
110
|
Permission.ENFORCEMENT,
|
|
118
|
-
]
|
|
119
|
-
}
|
|
111
|
+
],
|
|
112
|
+
};
|
|
120
113
|
|
|
121
114
|
export const getByName = (name: RoleName): Role => {
|
|
122
|
-
const result = Role.all().find(r => r.name === name)
|
|
115
|
+
const result = Role.all().find((r) => r.name === name);
|
|
123
116
|
if (!result) {
|
|
124
117
|
throw Error("Unknown RoleName: " + name);
|
|
125
118
|
}
|
|
@@ -128,7 +121,7 @@ export namespace Role {
|
|
|
128
121
|
|
|
129
122
|
export const all = (): Role[] => {
|
|
130
123
|
return Object.keys(Role)
|
|
131
|
-
.map(k => (Role as any)[k])
|
|
132
|
-
.filter(k => typeof
|
|
124
|
+
.map((k) => (Role as any)[k])
|
|
125
|
+
.filter((k) => typeof k === "object");
|
|
133
126
|
};
|
|
134
127
|
}
|