@gitpod/gitpod-protocol 0.1.5-wth-test.80 → 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 +181 -4
- package/lib/accounting-protocol.d.ts +17 -10
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +30 -32
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +1 -0
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/auth.d.ts.map +1 -1
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +3 -3
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +20 -5
- package/lib/context-url.spec.js.map +1 -1
- package/lib/email-protocol.d.ts +1 -1
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +1 -1
- 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 +7 -7
- 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 +2 -3
- 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 +1 -1
- 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 +7 -9
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +0 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +1 -20
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +6 -6
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +42 -39
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +32 -26
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +39 -32
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +1 -0
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +2 -1
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +1 -1
- package/lib/ide-protocol.d.ts +6 -6
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/index.d.ts +16 -16
- package/lib/installation-admin-protocol.d.ts.map +1 -1
- package/lib/installation-admin-protocol.js +2 -2
- package/lib/installation-admin-protocol.js.map +1 -1
- 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 +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 +4 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +9 -6
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +2 -2
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +20 -20
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +2 -0
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +4 -0
- 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/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +1 -1
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +2 -2
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +12 -23
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +3 -3
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +206 -171
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +83 -36
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +165 -87
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.spec.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +21 -3
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +16 -5
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +8 -3
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +1 -1
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +6 -6
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +3 -3
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +6 -6
- package/lib/util/date-time.js.map +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.map +1 -1
- package/lib/util/garbage-collected-cache.js +1 -1
- 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.js +18 -7
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +1 -1
- package/lib/util/gitpod-cookie.d.ts.map +1 -1
- package/lib/util/gitpod-cookie.js +0 -3
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +31 -29
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +15 -5
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/jaeger-client-types.d.ts.map +1 -1
- package/lib/util/logging.d.ts +1 -1
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +23 -24
- 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.map +1 -1
- package/lib/util/parse-workspace-id.js +1 -2
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.spec.js +9 -6
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- 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 +9 -3
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +6 -6
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +14 -16
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.js +3 -3
- package/lib/util/tracing.spec.js.map +1 -1
- 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 +8 -11
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +1 -1
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +2 -4
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +19 -3
- 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 +6 -6
- package/pkg-yarn.lock +5 -5
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +63 -51
- package/src/admin-protocol.ts +23 -20
- package/src/analytics.ts +21 -21
- package/src/auth.ts +2 -2
- package/src/context-url.spec.ts +25 -11
- package/src/context-url.ts +80 -78
- package/src/email-protocol.ts +5 -6
- 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 +152 -110
- package/src/headless-workspace-log.ts +6 -4
- package/src/ide-frontend-service.ts +2 -2
- package/src/ide-protocol.ts +8 -8
- package/src/index.ts +16 -16
- package/src/installation-admin-protocol.ts +8 -8
- package/src/license-protocol.ts +12 -6
- package/src/messaging/browser/connection.ts +45 -47
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +70 -71
- package/src/messaging/error.ts +7 -3
- 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 +3 -3
- package/src/payment-protocol.ts +2 -2
- package/src/permission.ts +20 -31
- package/src/plans.ts +236 -189
- package/src/protocol.ts +346 -239
- package/src/snapshot-url.spec.ts +9 -7
- package/src/team-subscription-protocol.ts +57 -23
- package/src/teams-projects-protocol.ts +14 -8
- package/src/typings/globals.ts +4 -4
- package/src/util/analytics.ts +46 -42
- 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 +3 -6
- package/src/util/generate-workspace-id.spec.ts +26 -16
- package/src/util/generate-workspace-id.ts +460 -454
- package/src/util/gitpod-cookie.ts +8 -9
- package/src/util/gitpod-host-url.spec.ts +40 -13
- package/src/util/gitpod-host-url.ts +37 -34
- package/src/util/grpc.ts +1 -1
- package/src/util/jaeger-client-types.ts +2 -2
- package/src/util/logging.ts +49 -40
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +17 -8
- package/src/util/parse-workspace-id.ts +5 -6
- package/src/util/queue.spec.ts +27 -25
- package/src/util/repeat.ts +1 -1
- package/src/util/semaphore.ts +4 -6
- package/src/util/skip-if.ts +9 -6
- package/src/util/timeutil.spec.ts +14 -15
- package/src/util/timeutil.ts +21 -11
- package/src/util/tracing.spec.ts +28 -23
- package/src/util/tracing.ts +54 -51
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/workspace-cluster.ts +15 -12
- package/src/workspace-instance.ts +53 -24
- package/src/wsready.ts +3 -3
- package/data/builtin-theia-plugins.json +0 -372
- 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/theia-plugins.ts +0 -11
|
@@ -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
|
@@ -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
|
@@ -4,8 +4,8 @@
|
|
|
4
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
|
@@ -4,11 +4,10 @@
|
|
|
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,
|
|
@@ -18,21 +17,20 @@ export const Permissions = {
|
|
|
18
17
|
"ide-settings": undefined,
|
|
19
18
|
"new-workspace-cluster": undefined,
|
|
20
19
|
};
|
|
21
|
-
export type PermissionName = keyof
|
|
22
|
-
export const Roles = {
|
|
23
|
-
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;
|
|
24
23
|
export type RoleOrPermission = RoleName | PermissionName;
|
|
25
24
|
|
|
26
25
|
export namespace RoleName {
|
|
27
26
|
export const is = (o: any): o is RoleName => {
|
|
28
|
-
return typeof(
|
|
29
|
-
|
|
30
|
-
}
|
|
27
|
+
return typeof o === "string" && Role.all().some((r) => r.name === o);
|
|
28
|
+
};
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
export interface Role {
|
|
34
|
-
name: RoleName
|
|
35
|
-
permissions: PermissionName[]
|
|
32
|
+
name: RoleName;
|
|
33
|
+
permissions: PermissionName[];
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
export namespace RolesOrPermissions {
|
|
@@ -44,11 +42,11 @@ export namespace RolesOrPermissions {
|
|
|
44
42
|
if (Permission.is(rop)) {
|
|
45
43
|
permissions.add(rop);
|
|
46
44
|
} else if (RoleName.is(rop)) {
|
|
47
|
-
Role.getByName(rop).permissions.forEach(p => permissions.add(p));
|
|
45
|
+
Role.getByName(rop).permissions.forEach((p) => permissions.add(p));
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
return permissions;
|
|
51
|
-
}
|
|
49
|
+
}
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
export namespace Permission {
|
|
@@ -77,9 +75,8 @@ export namespace Permission {
|
|
|
77
75
|
export const IDE_SETTINGS: PermissionName = "ide-settings";
|
|
78
76
|
|
|
79
77
|
export const is = (o: any): o is PermissionName => {
|
|
80
|
-
return typeof(
|
|
81
|
-
|
|
82
|
-
}
|
|
78
|
+
return typeof o === "string" && Permission.all().some((p) => p === o);
|
|
79
|
+
};
|
|
83
80
|
|
|
84
81
|
export const all = (): PermissionName[] => {
|
|
85
82
|
return Object.keys(Permissions) as PermissionName[];
|
|
@@ -90,21 +87,13 @@ export namespace Role {
|
|
|
90
87
|
/** The default role for all Gitpod developers */
|
|
91
88
|
export const DEVOPS: Role = {
|
|
92
89
|
name: "devops",
|
|
93
|
-
permissions: [
|
|
94
|
-
Permission.MONITOR,
|
|
95
|
-
Permission.ENFORCEMENT,
|
|
96
|
-
Permission.REGISTRY_ACCESS,
|
|
97
|
-
Permission.IDE_SETTINGS
|
|
98
|
-
]
|
|
90
|
+
permissions: [Permission.MONITOR, Permission.ENFORCEMENT, Permission.REGISTRY_ACCESS, Permission.IDE_SETTINGS],
|
|
99
91
|
};
|
|
100
92
|
|
|
101
93
|
/** A role for people that are allowed to view Gitpod internals */
|
|
102
94
|
export const VIEWER: Role = {
|
|
103
95
|
name: "viewer",
|
|
104
|
-
permissions: [
|
|
105
|
-
Permission.MONITOR,
|
|
106
|
-
Permission.REGISTRY_ACCESS,
|
|
107
|
-
]
|
|
96
|
+
permissions: [Permission.MONITOR, Permission.REGISTRY_ACCESS],
|
|
108
97
|
};
|
|
109
98
|
|
|
110
99
|
export const ADMIN: Role = {
|
|
@@ -115,11 +104,11 @@ export namespace Role {
|
|
|
115
104
|
Permission.ADMIN_PROJECTS,
|
|
116
105
|
Permission.ADMIN_API,
|
|
117
106
|
Permission.ENFORCEMENT,
|
|
118
|
-
]
|
|
119
|
-
}
|
|
107
|
+
],
|
|
108
|
+
};
|
|
120
109
|
|
|
121
110
|
export const getByName = (name: RoleName): Role => {
|
|
122
|
-
const result = Role.all().find(r => r.name === name)
|
|
111
|
+
const result = Role.all().find((r) => r.name === name);
|
|
123
112
|
if (!result) {
|
|
124
113
|
throw Error("Unknown RoleName: " + name);
|
|
125
114
|
}
|
|
@@ -128,7 +117,7 @@ export namespace Role {
|
|
|
128
117
|
|
|
129
118
|
export const all = (): Role[] => {
|
|
130
119
|
return Object.keys(Role)
|
|
131
|
-
.map(k => (Role as any)[k])
|
|
132
|
-
.filter(k => typeof
|
|
120
|
+
.map((k) => (Role as any)[k])
|
|
121
|
+
.filter((k) => typeof k === "object");
|
|
133
122
|
};
|
|
134
123
|
}
|