@gitpod/gitpod-protocol 0.1.5-wth-argo.0 → 0.1.5-yh-vmoptions-fork.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/gitpod-schema.json +206 -28
- package/lib/accounting-protocol.d.ts +162 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +107 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +32 -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 +44 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/auth.d.ts.map +1 -1
- package/lib/context-url.d.ts +31 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +102 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +14 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +109 -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.d.ts.map +1 -1
- package/lib/encryption/container-module.js +5 -4
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +25 -26
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +29 -37
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +30 -44
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +31 -38
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +0 -6
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +7 -27
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +26 -42
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +145 -142
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +180 -33
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +194 -273
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +9 -11
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +6 -8
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +5 -1
- package/lib/ide-frontend-service.d.ts.map +1 -1
- package/lib/ide-protocol.d.ts +105 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/{util/without.js → ide-protocol.js} +2 -2
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +16 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +27 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +30 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- package/lib/license-protocol.d.ts +7 -0
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +5 -3
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +184 -34
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +4 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +42 -59
- 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/error.d.ts +6 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +12 -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/handler.js +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +24 -60
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +3 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +75 -162
- 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/payment-protocol.d.ts +18 -0
- package/lib/payment-protocol.d.ts.map +1 -0
- package/lib/payment-protocol.js +13 -0
- package/lib/payment-protocol.js.map +1 -0
- package/lib/permission.d.ts +10 -3
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +41 -31
- 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 +605 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +196 -83
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +264 -200
- 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 +91 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +74 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +118 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +30 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/util/analytics.d.ts +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +88 -0
- package/lib/util/analytics.js.map +1 -0
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +57 -135
- 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 +11 -11
- 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.d.ts.map +1 -1
- package/lib/util/disposable.js +27 -40
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +63 -77
- 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 +27 -47
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +6 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +469 -502
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +68 -78
- 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 +41 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +1 -2
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +108 -109
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +7 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +113 -31
- 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/{theia-plugins.js → util/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 +125 -129
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +5 -5
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +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 +147 -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/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +15 -46
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +6 -6
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +1 -0
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +35 -17
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.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 +52 -6
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +197 -64
- 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.d.ts +7 -7
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +10 -12
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +76 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +31 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +45 -5
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +2 -2
- package/package.json +32 -18
- package/pkg-yarn.lock +18 -10
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +241 -0
- package/src/admin-protocol.ts +70 -19
- package/src/analytics.ts +52 -0
- package/src/auth.ts +2 -2
- package/src/context-url.spec.ts +67 -0
- package/src/context-url.ts +109 -0
- package/src/email-protocol.ts +5 -7
- package/src/encryption/container-module.ts +2 -3
- package/src/encryption/encryption-engine.spec.ts +9 -8
- package/src/encryption/encryption-engine.ts +14 -14
- package/src/encryption/encryption-service.ts +4 -5
- package/src/encryption/key-provider.ts +16 -19
- package/src/env.ts +0 -22
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +348 -110
- package/src/headless-workspace-log.ts +12 -14
- package/src/ide-frontend-service.ts +6 -2
- package/src/ide-protocol.ts +119 -0
- package/src/index.ts +16 -10
- package/src/installation-admin-protocol.ts +42 -0
- package/src/license-protocol.ts +12 -6
- package/src/messaging/browser/connection.ts +197 -18
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +96 -0
- package/src/messaging/error.ts +18 -5
- package/src/messaging/handler.ts +13 -1
- package/src/messaging/node/connection.ts +23 -70
- package/src/messaging/proxy-factory.ts +35 -34
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +20 -0
- package/src/permission.ts +42 -33
- package/src/plans.ts +679 -0
- package/src/protocol.ts +493 -275
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +147 -0
- package/src/teams-projects-protocol.ts +153 -0
- package/src/typings/globals.ts +4 -4
- package/src/util/analytics.ts +109 -0
- package/src/util/async-iterator.ts +4 -5
- package/src/util/cancelable.ts +3 -3
- package/src/util/date-time.ts +8 -8
- package/src/util/deferred.ts +6 -6
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +11 -8
- package/src/util/generate-workspace-id.spec.ts +37 -10
- package/src/util/generate-workspace-id.ts +464 -438
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +59 -8
- package/src/util/gitpod-host-url.ts +52 -40
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +145 -72
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +37 -8
- package/src/util/parse-workspace-id.ts +32 -7
- package/src/util/queue.spec.ts +28 -26
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +6 -8
- package/src/util/skip-if.ts +10 -7
- package/src/util/timeutil.spec.ts +14 -15
- package/src/util/timeutil.ts +25 -15
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +200 -31
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/workspace-cluster.ts +107 -0
- package/src/workspace-instance.ts +98 -31
- package/src/wsready.ts +3 -3
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -46
- package/lib/messaging/connection-error-handler.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.map +0 -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 +0 -10
- 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/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -34
- package/lib/util/safe-promise.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/messaging/connection-error-handler.ts +0 -62
- package/src/theia-plugins.ts +0 -11
- 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/src/util/safe-promise.ts +0 -26
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
import { injectable } from "inversify";
|
|
8
|
+
import * as prometheusClient from "prom-client";
|
|
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
|
+
}
|
|
29
|
+
|
|
30
|
+
@injectable()
|
|
31
|
+
export class PrometheusClientCallMetrics implements IClientCallMetrics {
|
|
32
|
+
readonly startedCounter: prometheusClient.Counter<string>;
|
|
33
|
+
readonly sentCounter: prometheusClient.Counter<string>;
|
|
34
|
+
readonly receivedCounter: prometheusClient.Counter<string>;
|
|
35
|
+
readonly handledCounter: prometheusClient.Counter<string>;
|
|
36
|
+
|
|
37
|
+
constructor() {
|
|
38
|
+
this.startedCounter = new prometheusClient.Counter({
|
|
39
|
+
name: "grpc_client_started_total",
|
|
40
|
+
help: "Total number of RPCs started on the client.",
|
|
41
|
+
labelNames: ["grpc_service", "grpc_method", "grpc_type"],
|
|
42
|
+
registers: [prometheusClient.register],
|
|
43
|
+
});
|
|
44
|
+
this.sentCounter = new prometheusClient.Counter({
|
|
45
|
+
name: "grpc_client_msg_sent_total",
|
|
46
|
+
help: " Total number of gRPC stream messages sent by the client.",
|
|
47
|
+
labelNames: ["grpc_service", "grpc_method", "grpc_type"],
|
|
48
|
+
registers: [prometheusClient.register],
|
|
49
|
+
});
|
|
50
|
+
this.receivedCounter = new prometheusClient.Counter({
|
|
51
|
+
name: "grpc_client_msg_received_total",
|
|
52
|
+
help: "Total number of RPC stream messages received by the client.",
|
|
53
|
+
labelNames: ["grpc_service", "grpc_method", "grpc_type"],
|
|
54
|
+
registers: [prometheusClient.register],
|
|
55
|
+
});
|
|
56
|
+
this.handledCounter = new prometheusClient.Counter({
|
|
57
|
+
name: "grpc_client_handled_total",
|
|
58
|
+
help: "Total number of RPCs completed by the client, regardless of success or failure.",
|
|
59
|
+
labelNames: ["grpc_service", "grpc_method", "grpc_type", "grpc_code"],
|
|
60
|
+
registers: [prometheusClient.register],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
started(labels: IGrpcCallMetricsLabels): void {
|
|
65
|
+
this.startedCounter.inc({
|
|
66
|
+
grpc_service: labels.service,
|
|
67
|
+
grpc_method: labels.method,
|
|
68
|
+
grpc_type: labels.type,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
sent(labels: IGrpcCallMetricsLabels): void {
|
|
73
|
+
this.sentCounter.inc({
|
|
74
|
+
grpc_service: labels.service,
|
|
75
|
+
grpc_method: labels.method,
|
|
76
|
+
grpc_type: labels.type,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
received(labels: IGrpcCallMetricsLabels): void {
|
|
81
|
+
this.receivedCounter.inc({
|
|
82
|
+
grpc_service: labels.service,
|
|
83
|
+
grpc_method: labels.method,
|
|
84
|
+
grpc_type: labels.type,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
handled(labels: IGrpcCallMetricsLabelsWithCode): void {
|
|
89
|
+
this.handledCounter.inc({
|
|
90
|
+
grpc_service: labels.service,
|
|
91
|
+
grpc_method: labels.method,
|
|
92
|
+
grpc_type: labels.type,
|
|
93
|
+
grpc_code: labels.code,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
package/src/messaging/error.ts
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
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
|
|
|
@@ -34,6 +35,9 @@ export namespace ErrorCodes {
|
|
|
34
35
|
// 460 Context Parse Error (custom status code)
|
|
35
36
|
export const CONTEXT_PARSE_ERROR = 460;
|
|
36
37
|
|
|
38
|
+
// 461 Invalid gitpod yml
|
|
39
|
+
export const INVALID_GITPOD_YML = 461;
|
|
40
|
+
|
|
37
41
|
// 450 Payment error
|
|
38
42
|
export const PAYMENT_ERROR = 450;
|
|
39
43
|
|
|
@@ -58,18 +62,27 @@ export namespace ErrorCodes {
|
|
|
58
62
|
// 490 Too Many Running Workspace
|
|
59
63
|
export const TOO_MANY_RUNNING_WORKSPACES = 490;
|
|
60
64
|
|
|
65
|
+
// 500 Internal Server Error
|
|
66
|
+
export const INTERNAL_SERVER_ERROR = 500;
|
|
67
|
+
|
|
61
68
|
// 501 EE Feature
|
|
62
69
|
export const EE_FEATURE = 501;
|
|
63
70
|
|
|
64
71
|
// 555 EE License Required
|
|
65
72
|
export const EE_LICENSE_REQUIRED = 555;
|
|
66
73
|
|
|
74
|
+
// 601 SaaS Feature
|
|
75
|
+
export const SAAS_FEATURE = 601;
|
|
76
|
+
|
|
67
77
|
// 610 Invalid Team Subscription Quantity
|
|
68
78
|
export const TEAM_SUBSCRIPTION_INVALID_QUANTITY = 610;
|
|
69
79
|
|
|
70
80
|
// 620 Team Subscription Assignment Failed
|
|
71
81
|
export const TEAM_SUBSCRIPTION_ASSIGNMENT_FAILED = 620;
|
|
72
82
|
|
|
73
|
-
//
|
|
74
|
-
export const
|
|
75
|
-
|
|
83
|
+
// 630 Snapshot Error
|
|
84
|
+
export const SNAPSHOT_ERROR = 630;
|
|
85
|
+
|
|
86
|
+
// 640 Headless logs are not available (yet)
|
|
87
|
+
export const HEADLESS_LOG_NOT_YET_AVAILABLE = 640;
|
|
88
|
+
}
|
package/src/messaging/handler.ts
CHANGED
|
@@ -7,9 +7,21 @@
|
|
|
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;
|
|
14
14
|
onConnection(connection: MessageConnection, session?: object): void;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
export interface ConnectionEventHandler {
|
|
18
|
+
/**
|
|
19
|
+
* Called when the transport underpinning the connection got closed
|
|
20
|
+
*/
|
|
21
|
+
onTransportDidClose(): void;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Called when the transport underpinning the connection is (re-)opened
|
|
25
|
+
*/
|
|
26
|
+
onTransportDidOpen(): void;
|
|
27
|
+
}
|
|
@@ -6,82 +6,35 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import * as ws from "ws";
|
|
9
|
-
import
|
|
10
|
-
import * as https from "https";
|
|
11
|
-
import * as url from "url";
|
|
12
|
-
import * as net from "net";
|
|
13
|
-
import { MessageConnection } from "vscode-jsonrpc";
|
|
14
|
-
import { createWebSocketConnection, IWebSocket } from "vscode-ws-jsonrpc";
|
|
15
|
-
import { log } from '../../util/logging';
|
|
9
|
+
import { IWebSocket } from "vscode-ws-jsonrpc";
|
|
16
10
|
|
|
17
|
-
export
|
|
18
|
-
readonly server: http.Server | https.Server;
|
|
19
|
-
readonly path?: string;
|
|
20
|
-
matches?(request: http.IncomingMessage): boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function createServerWebSocketConnection(options: IServerOptions, onConnect: (connection: MessageConnection) => void): void {
|
|
24
|
-
openJsonRpcSocket(options, socket => {
|
|
25
|
-
onConnect(createWebSocketConnection(socket, console));
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function openJsonRpcSocket(options: IServerOptions, onOpen: (socket: IWebSocket) => void): void {
|
|
30
|
-
openSocket(options, socket => {
|
|
31
|
-
const webSocket = toIWebSocket(socket);
|
|
32
|
-
onOpen(webSocket);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface OnOpen {
|
|
37
|
-
(webSocket: ws, request: http.IncomingMessage, socket: net.Socket, head: Buffer): void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function openSocket(options: IServerOptions, onOpen: OnOpen): void {
|
|
41
|
-
const wss = new ws.Server({
|
|
42
|
-
noServer: true,
|
|
43
|
-
perMessageDeflate: {
|
|
44
|
-
// don't compress if a message is less than 256kb
|
|
45
|
-
threshold: 256 * 1024
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
options.server.on('upgrade', (request: http.IncomingMessage, socket: net.Socket, head: Buffer) => {
|
|
49
|
-
const pathname = request.url ? url.parse(request.url).pathname : undefined;
|
|
50
|
-
if (options.path && pathname === options.path || options.matches && options.matches(request)) {
|
|
51
|
-
wss.handleUpgrade(request, socket, head, webSocket => {
|
|
52
|
-
if (webSocket.readyState === webSocket.OPEN) {
|
|
53
|
-
onOpen(webSocket, request, socket, head);
|
|
54
|
-
} else {
|
|
55
|
-
webSocket.on('open', () => onOpen(webSocket, request, socket, head));
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function toIWebSocket(webSocket: ws) {
|
|
63
|
-
let sendsAfterOpen = 0;
|
|
11
|
+
export function toIWebSocket(ws: ws) {
|
|
64
12
|
return <IWebSocket>{
|
|
65
|
-
send: content => {
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
log.error(`Repeated try to send on closed web socket (readyState was ${webSocket.readyState})`, { ws });
|
|
69
|
-
}
|
|
13
|
+
send: (content) => {
|
|
14
|
+
if (ws.readyState >= ws.CLOSING) {
|
|
15
|
+
// ws is already CLOSING/CLOSED, send() would just return an error.
|
|
70
16
|
return;
|
|
71
17
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
18
|
+
|
|
19
|
+
// in general send-errors should trigger an 'error' event already, we just make sure it actually happens.
|
|
20
|
+
try {
|
|
21
|
+
ws.send(content, (err) => {
|
|
22
|
+
if (!err) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
ws.emit("error", err);
|
|
26
|
+
});
|
|
27
|
+
} catch (err) {
|
|
28
|
+
ws.emit("error", err);
|
|
29
|
+
}
|
|
77
30
|
},
|
|
78
|
-
onMessage: cb =>
|
|
79
|
-
onError: cb =>
|
|
80
|
-
onClose: cb =>
|
|
31
|
+
onMessage: (cb) => ws.on("message", cb),
|
|
32
|
+
onError: (cb) => ws.on("error", cb),
|
|
33
|
+
onClose: (cb) => ws.on("close", cb),
|
|
81
34
|
dispose: () => {
|
|
82
|
-
if (
|
|
83
|
-
|
|
35
|
+
if (ws.readyState < ws.CLOSING) {
|
|
36
|
+
ws.close();
|
|
84
37
|
}
|
|
85
|
-
}
|
|
38
|
+
},
|
|
86
39
|
};
|
|
87
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,21 @@ 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
|
-
|
|
108
|
-
connection.onClose(() =>
|
|
109
|
-
this.onDidCloseConnectionEmitter.fire(undefined)
|
|
110
|
-
);
|
|
111
|
-
this.onDidOpenConnectionEmitter.fire(undefined);
|
|
100
|
+
this.connectionPromise = new Promise((resolve) => (this.connectionPromiseResolve = resolve));
|
|
101
|
+
this.connectionPromise.then((connection) => {
|
|
102
|
+
connection.onClose(() => this.fireConnectionClosed());
|
|
103
|
+
this.fireConnectionOpened();
|
|
112
104
|
});
|
|
113
105
|
}
|
|
114
106
|
|
|
107
|
+
fireConnectionClosed() {
|
|
108
|
+
this.onDidCloseConnectionEmitter.fire(undefined);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
fireConnectionOpened() {
|
|
112
|
+
this.onDidOpenConnectionEmitter.fire(undefined);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
115
|
/**
|
|
116
116
|
* Connect a MessageConnection to the factory.
|
|
117
117
|
*
|
|
@@ -158,7 +158,9 @@ export class JsonRpcProxyFactory<T extends object> implements ProxyHandler<T> {
|
|
|
158
158
|
* methods calls.
|
|
159
159
|
*/
|
|
160
160
|
protected onNotification(method: string, ...args: any[]): void {
|
|
161
|
-
this.target[method]
|
|
161
|
+
if (this.target[method]) {
|
|
162
|
+
this.target[method](...args);
|
|
163
|
+
}
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
/**
|
|
@@ -196,35 +198,34 @@ export class JsonRpcProxyFactory<T extends object> implements ProxyHandler<T> {
|
|
|
196
198
|
* @returns A callable that executes the JSON-RPC call.
|
|
197
199
|
*/
|
|
198
200
|
get(target: T, p: PropertyKey, receiver: any): any {
|
|
199
|
-
if (p ===
|
|
201
|
+
if (p === "setClient") {
|
|
200
202
|
return (client: any) => {
|
|
201
203
|
this.target = client;
|
|
202
204
|
};
|
|
203
205
|
}
|
|
204
|
-
if (p ===
|
|
206
|
+
if (p === "onDidOpenConnection") {
|
|
205
207
|
return this.onDidOpenConnectionEmitter.event;
|
|
206
208
|
}
|
|
207
|
-
if (p ===
|
|
209
|
+
if (p === "onDidCloseConnection") {
|
|
208
210
|
return this.onDidCloseConnectionEmitter.event;
|
|
209
211
|
}
|
|
210
212
|
const isNotify = this.isNotification(p);
|
|
211
213
|
return (...args: any[]) =>
|
|
212
|
-
this.connectionPromise.then(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
.catch((err: any) => reject(err))
|
|
222
|
-
|
|
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);
|
|
223
227
|
}
|
|
224
|
-
}
|
|
225
|
-
reject(err);
|
|
226
|
-
}
|
|
227
|
-
})
|
|
228
|
+
}),
|
|
228
229
|
);
|
|
229
230
|
}
|
|
230
231
|
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export interface OssAllowList {
|
|
8
|
+
/**
|
|
9
|
+
* A string that identifies a GitHub/GitLab/Bitbucket identity of the form "<host>/<profilename>"
|
|
10
|
+
* E.g., "github.com/geropl"
|
|
11
|
+
*/
|
|
12
|
+
identity: string;
|
|
13
|
+
|
|
14
|
+
deleted?: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
export namespace PaymentProtocol {
|
|
8
|
+
export const UPDATE_GITPOD_SUBSCRIPTION_PATH = "/payment/chargebee";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface PlanCoupon {
|
|
12
|
+
chargebeePlanID: string;
|
|
13
|
+
newPrice: number;
|
|
14
|
+
description: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GithubUpgradeURL {
|
|
18
|
+
url: string;
|
|
19
|
+
planID: number;
|
|
20
|
+
}
|
package/src/permission.ts
CHANGED
|
@@ -4,33 +4,49 @@
|
|
|
4
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
|
+
enforcement: undefined,
|
|
12
11
|
"privileged-ws": undefined,
|
|
13
12
|
"registry-access": undefined,
|
|
14
13
|
"admin-users": undefined,
|
|
15
14
|
"admin-workspaces": undefined,
|
|
15
|
+
"admin-projects": undefined,
|
|
16
16
|
"admin-api": undefined,
|
|
17
|
-
"ide-settings": undefined
|
|
17
|
+
"ide-settings": undefined,
|
|
18
|
+
"new-workspace-cluster": undefined,
|
|
18
19
|
};
|
|
19
|
-
export type PermissionName = keyof
|
|
20
|
-
export const Roles = {
|
|
21
|
-
export type RoleName = keyof
|
|
20
|
+
export type PermissionName = keyof typeof Permissions;
|
|
21
|
+
export const Roles = { devops: undefined, viewer: undefined, admin: undefined };
|
|
22
|
+
export type RoleName = keyof typeof Roles;
|
|
22
23
|
export type RoleOrPermission = RoleName | PermissionName;
|
|
23
24
|
|
|
24
25
|
export namespace RoleName {
|
|
25
26
|
export const is = (o: any): o is RoleName => {
|
|
26
|
-
return typeof(
|
|
27
|
-
|
|
28
|
-
}
|
|
27
|
+
return typeof o === "string" && Role.all().some((r) => r.name === o);
|
|
28
|
+
};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface Role {
|
|
32
|
-
name: RoleName
|
|
33
|
-
permissions: PermissionName[]
|
|
32
|
+
name: RoleName;
|
|
33
|
+
permissions: PermissionName[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export namespace RolesOrPermissions {
|
|
37
|
+
export function toPermissionSet(rolesOrPermissions: RoleOrPermission[] | undefined): Set<PermissionName> {
|
|
38
|
+
rolesOrPermissions = rolesOrPermissions || [];
|
|
39
|
+
|
|
40
|
+
const permissions = new Set<PermissionName>();
|
|
41
|
+
for (const rop of rolesOrPermissions) {
|
|
42
|
+
if (Permission.is(rop)) {
|
|
43
|
+
permissions.add(rop);
|
|
44
|
+
} else if (RoleName.is(rop)) {
|
|
45
|
+
Role.getByName(rop).permissions.forEach((p) => permissions.add(p));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return permissions;
|
|
49
|
+
}
|
|
34
50
|
}
|
|
35
51
|
|
|
36
52
|
export namespace Permission {
|
|
@@ -49,6 +65,9 @@ export namespace Permission {
|
|
|
49
65
|
/** The permission for accessing all workspace data */
|
|
50
66
|
export const ADMIN_WORKSPACES: PermissionName = "admin-workspaces";
|
|
51
67
|
|
|
68
|
+
/** The permission for accessing all projects data */
|
|
69
|
+
export const ADMIN_PROJECTS: PermissionName = "admin-projects";
|
|
70
|
+
|
|
52
71
|
/** The permission to access the admin API */
|
|
53
72
|
export const ADMIN_API: PermissionName = "admin-api";
|
|
54
73
|
|
|
@@ -56,14 +75,11 @@ export namespace Permission {
|
|
|
56
75
|
export const IDE_SETTINGS: PermissionName = "ide-settings";
|
|
57
76
|
|
|
58
77
|
export const is = (o: any): o is PermissionName => {
|
|
59
|
-
return typeof(
|
|
60
|
-
|
|
61
|
-
}
|
|
78
|
+
return typeof o === "string" && Permission.all().some((p) => p === o);
|
|
79
|
+
};
|
|
62
80
|
|
|
63
81
|
export const all = (): PermissionName[] => {
|
|
64
|
-
return Object.keys(
|
|
65
|
-
.map(k => (Permission as any)[k])
|
|
66
|
-
.filter(k => typeof(k) === 'string');
|
|
82
|
+
return Object.keys(Permissions) as PermissionName[];
|
|
67
83
|
};
|
|
68
84
|
}
|
|
69
85
|
|
|
@@ -71,21 +87,13 @@ export namespace Role {
|
|
|
71
87
|
/** The default role for all Gitpod developers */
|
|
72
88
|
export const DEVOPS: Role = {
|
|
73
89
|
name: "devops",
|
|
74
|
-
permissions: [
|
|
75
|
-
Permission.MONITOR,
|
|
76
|
-
Permission.ENFORCEMENT,
|
|
77
|
-
Permission.REGISTRY_ACCESS,
|
|
78
|
-
Permission.IDE_SETTINGS
|
|
79
|
-
]
|
|
90
|
+
permissions: [Permission.MONITOR, Permission.ENFORCEMENT, Permission.REGISTRY_ACCESS, Permission.IDE_SETTINGS],
|
|
80
91
|
};
|
|
81
92
|
|
|
82
93
|
/** A role for people that are allowed to view Gitpod internals */
|
|
83
94
|
export const VIEWER: Role = {
|
|
84
95
|
name: "viewer",
|
|
85
|
-
permissions: [
|
|
86
|
-
Permission.MONITOR,
|
|
87
|
-
Permission.REGISTRY_ACCESS,
|
|
88
|
-
]
|
|
96
|
+
permissions: [Permission.MONITOR, Permission.REGISTRY_ACCESS],
|
|
89
97
|
};
|
|
90
98
|
|
|
91
99
|
export const ADMIN: Role = {
|
|
@@ -93,13 +101,14 @@ export namespace Role {
|
|
|
93
101
|
permissions: [
|
|
94
102
|
Permission.ADMIN_USERS,
|
|
95
103
|
Permission.ADMIN_WORKSPACES,
|
|
104
|
+
Permission.ADMIN_PROJECTS,
|
|
96
105
|
Permission.ADMIN_API,
|
|
97
106
|
Permission.ENFORCEMENT,
|
|
98
|
-
]
|
|
99
|
-
}
|
|
107
|
+
],
|
|
108
|
+
};
|
|
100
109
|
|
|
101
110
|
export const getByName = (name: RoleName): Role => {
|
|
102
|
-
const result = Role.all().find(r => r.name === name)
|
|
111
|
+
const result = Role.all().find((r) => r.name === name);
|
|
103
112
|
if (!result) {
|
|
104
113
|
throw Error("Unknown RoleName: " + name);
|
|
105
114
|
}
|
|
@@ -108,7 +117,7 @@ export namespace Role {
|
|
|
108
117
|
|
|
109
118
|
export const all = (): Role[] => {
|
|
110
119
|
return Object.keys(Role)
|
|
111
|
-
.map(k => (Role as any)[k])
|
|
112
|
-
.filter(k => typeof
|
|
120
|
+
.map((k) => (Role as any)[k])
|
|
121
|
+
.filter((k) => typeof k === "object");
|
|
113
122
|
};
|
|
114
123
|
}
|