@gitpod/gitpod-protocol 0.1.5-test.6 → 0.1.5-tweak-workspaceconfig-origin-docs-fork.0
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/builtin-theia-plugins.json +28 -18
- package/data/gitpod-schema.json +17 -17
- package/lib/accounting-protocol.d.ts +155 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +109 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +22 -5
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +16 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +45 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/auth.d.ts +25 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +16 -0
- package/lib/auth.js.map +1 -0
- package/lib/context-url.d.ts +18 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +49 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +12 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +73 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/email-protocol.d.ts +2 -2
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js +6 -5
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts +1 -1
- package/lib/encryption/container-module.js +7 -5
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +1 -1
- package/lib/encryption/encryption-engine.js +21 -21
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +2 -2
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +31 -37
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +1 -1
- package/lib/encryption/encryption-service.js +31 -44
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +2 -2
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +27 -31
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +2 -3
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +21 -21
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts +1 -1
- package/lib/gitpod-file-parser.js +27 -42
- 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 +117 -117
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +186 -34
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +239 -116
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +9 -12
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +5 -7
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +26 -0
- package/lib/ide-frontend-service.d.ts.map +1 -0
- package/lib/ide-frontend-service.js +8 -0
- package/lib/ide-frontend-service.js.map +1 -0
- package/lib/ide-protocol.d.ts +81 -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 +5 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +25 -12
- package/lib/index.js.map +1 -1
- package/lib/license-protocol.d.ts +1 -1
- package/lib/license-protocol.js +2 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +6 -4
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +188 -48
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +26 -0
- package/lib/messaging/browser/window-connection.d.ts.map +1 -0
- package/lib/messaging/browser/window-connection.js +68 -0
- package/lib/messaging/browser/window-connection.js.map +1 -0
- package/lib/messaging/client-call-metrics.d.ts +35 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +83 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/connection-error-handler.js +12 -23
- package/lib/messaging/connection-error-handler.js.map +1 -1
- package/lib/messaging/error.d.ts +6 -2
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +13 -4
- 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 -0
- package/lib/messaging/handler.js.map +1 -1
- package/lib/messaging/node/connection.js +23 -22
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +2 -0
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +75 -169
- package/lib/messaging/proxy-factory.js.map +1 -1
- 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 +14 -12
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +21 -19
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +210 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +570 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +123 -30
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +121 -117
- 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} +3 -4
- 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 +73 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +63 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +103 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +23 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/theia-plugins.d.ts +1 -1
- package/lib/theia-plugins.js +1 -1
- package/lib/typings/globals.d.ts +12 -0
- package/lib/typings/globals.d.ts.map +1 -0
- package/lib/typings/globals.js +7 -0
- package/lib/typings/globals.js.map +1 -0
- package/lib/util/analytics.d.ts +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +79 -0
- package/lib/util/analytics.js.map +1 -0
- package/lib/util/async-iterator.d.ts +1 -1
- package/lib/util/async-iterator.js +57 -134
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +1 -1
- package/lib/util/cancelable.js +19 -60
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +1 -1
- package/lib/util/date-time.js +10 -9
- package/lib/util/date-time.js.map +1 -1
- 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 +12 -13
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts +2 -2
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +27 -39
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +59 -74
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -1
- package/lib/util/garbage-collected-cache.js +24 -47
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +4 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.js +470 -0
- package/lib/util/generate-workspace-id.js.map +1 -0
- package/lib/util/generate-workspace-id.spec.d.ts +7 -0
- package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.spec.js +63 -0
- package/lib/util/generate-workspace-id.spec.js.map +1 -0
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +44 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +8 -3
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +106 -76
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +16 -0
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -0
- package/lib/util/gitpod-host-url.spec.js +124 -0
- package/lib/util/gitpod-host-url.spec.js.map +1 -0
- package/lib/util/grpc.d.ts +15 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +18 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/logging.d.ts +57 -34
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +119 -110
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.d.ts +1 -1
- package/lib/util/make-link.js +4 -3
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +14 -4
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +39 -8
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +9 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +129 -48
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +1 -1
- package/lib/util/queue.js +18 -56
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.d.ts +1 -1
- package/lib/util/queue.spec.js +145 -287
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeater.d.ts +1 -1
- package/lib/util/repeater.js +37 -89
- package/lib/util/repeater.js.map +1 -1
- package/lib/util/safe-promise.d.ts +1 -1
- package/lib/util/safe-promise.js +11 -13
- package/lib/util/safe-promise.js.map +1 -1
- package/lib/util/semaphore.d.ts +1 -1
- package/lib/util/semaphore.js +17 -47
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +1 -1
- package/lib/util/skip-if.js +8 -7
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +1 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +30 -17
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +1 -1
- package/lib/util/timeutil.spec.js +23 -25
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +15 -2
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +86 -51
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/workspace-port-authentication.d.ts +1 -1
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +5 -3
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +74 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +16 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +10 -4
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.js +3 -2
- package/lib/wsready.js.map +1 -1
- package/package.json +32 -16
- package/pkg-yarn.lock +18 -9
- package/src/accounting-protocol.ts +229 -0
- package/src/admin-protocol.ts +41 -6
- package/src/analytics.ts +54 -0
- package/src/auth.ts +27 -0
- package/src/context-url.spec.ts +39 -0
- package/src/context-url.ts +51 -0
- package/src/email-protocol.ts +3 -4
- package/src/encryption/container-module.ts +1 -1
- package/src/encryption/encryption-engine.spec.ts +1 -1
- package/src/encryption/encryption-engine.ts +1 -1
- package/src/encryption/encryption-service.ts +1 -1
- package/src/encryption/key-provider.ts +1 -1
- package/src/env.ts +11 -11
- package/src/gitpod-file-parser.spec.ts +1 -1
- package/src/gitpod-file-parser.ts +1 -1
- package/src/gitpod-service.ts +386 -52
- package/src/headless-workspace-log.ts +8 -12
- package/src/ide-frontend-service.ts +28 -0
- package/src/ide-protocol.ts +92 -0
- package/src/index.ts +6 -2
- package/src/license-protocol.ts +1 -1
- package/src/messaging/browser/connection.ts +201 -23
- package/src/messaging/browser/window-connection.ts +72 -0
- package/src/messaging/client-call-metrics.ts +97 -0
- package/src/messaging/error.ts +16 -4
- package/src/messaging/handler.ts +12 -0
- package/src/messaging/node/connection.ts +2 -2
- package/src/messaging/proxy-factory.ts +16 -14
- package/src/payment-protocol.ts +20 -0
- package/src/permission.ts +9 -8
- package/src/plans.ts +632 -0
- package/src/protocol.ts +204 -61
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +113 -0
- package/src/teams-projects-protocol.ts +132 -0
- package/src/theia-plugins.ts +1 -1
- package/src/typings/globals.ts +12 -0
- package/src/util/analytics.ts +87 -0
- package/src/util/async-iterator.ts +1 -1
- package/src/util/cancelable.ts +1 -1
- package/src/util/date-time.ts +1 -1
- package/src/util/deep-partial.ts +1 -1
- package/src/util/deferred.ts +2 -2
- package/src/util/garbage-collected-cache.ts +3 -3
- package/src/util/generate-workspace-id.spec.ts +31 -0
- package/src/util/generate-workspace-id.ts +457 -0
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.spec.ts +49 -0
- package/src/util/gitpod-host-url.ts +58 -14
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client.d.ts +1 -1
- package/src/util/logging.ts +111 -39
- package/src/util/make-link.ts +1 -1
- package/src/util/parse-workspace-id.spec.ts +46 -5
- package/src/util/parse-workspace-id.ts +39 -8
- package/src/util/queue.spec.ts +2 -2
- package/src/util/queue.ts +1 -1
- package/src/util/repeater.ts +1 -1
- package/src/util/safe-promise.ts +1 -1
- package/src/util/semaphore.ts +3 -3
- package/src/util/skip-if.ts +2 -2
- package/src/util/timeutil.spec.ts +1 -1
- package/src/util/timeutil.ts +5 -5
- package/src/util/tracing.ts +66 -4
- package/src/util/workspace-port-authentication.ts +1 -1
- package/src/workspace-cluster.ts +96 -0
- package/src/workspace-instance.ts +38 -16
- package/src/wsready.ts +2 -2
- 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/lib/util/logging.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
@@ -9,61 +9,84 @@ export interface LogContext {
|
|
|
9
9
|
userId?: string;
|
|
10
10
|
workspaceId?: string;
|
|
11
11
|
}
|
|
12
|
+
export declare namespace LogContext {
|
|
13
|
+
function from(params: {
|
|
14
|
+
userId?: string;
|
|
15
|
+
user?: any;
|
|
16
|
+
request?: any;
|
|
17
|
+
}): LogContext;
|
|
18
|
+
}
|
|
12
19
|
export interface LogPayload {
|
|
13
20
|
}
|
|
14
21
|
export declare namespace log {
|
|
15
|
-
function error(context: LogContext, message: string, error:
|
|
16
|
-
function error(context: LogContext, message: string, error:
|
|
22
|
+
function error(context: LogContext, message: string, error: any, payload: LogPayload): void;
|
|
23
|
+
function error(context: LogContext, message: string, error: any): void;
|
|
17
24
|
function error(context: LogContext, message: string, payload: LogPayload): void;
|
|
18
25
|
function error(context: LogContext, message: string): void;
|
|
19
|
-
function error(context: LogContext, error:
|
|
20
|
-
function error(context: LogContext, error:
|
|
21
|
-
function error(message: string, error:
|
|
22
|
-
function error(message: string, error:
|
|
26
|
+
function error(context: LogContext, error: any, payload: LogPayload): void;
|
|
27
|
+
function error(context: LogContext, error: any): void;
|
|
28
|
+
function error(message: string, error: any, payload: LogPayload): void;
|
|
29
|
+
function error(message: string, error: any): void;
|
|
23
30
|
function error(message: string, payload: LogPayload): void;
|
|
24
31
|
function error(message: string): void;
|
|
25
|
-
function error(error:
|
|
26
|
-
function error(error:
|
|
27
|
-
function warn(context: LogContext, message: string, error:
|
|
28
|
-
function warn(context: LogContext, message: string, error:
|
|
32
|
+
function error(error: any, payload: LogPayload): void;
|
|
33
|
+
function error(error: any): void;
|
|
34
|
+
function warn(context: LogContext, message: string, error: any, payload: LogPayload): void;
|
|
35
|
+
function warn(context: LogContext, message: string, error: any): void;
|
|
29
36
|
function warn(context: LogContext, message: string, payload: LogPayload): void;
|
|
30
37
|
function warn(context: LogContext, message: string): void;
|
|
31
|
-
function warn(context: LogContext, error:
|
|
32
|
-
function warn(context: LogContext, error:
|
|
33
|
-
function warn(message: string, error:
|
|
34
|
-
function warn(message: string, error:
|
|
38
|
+
function warn(context: LogContext, error: any, payload: LogPayload): void;
|
|
39
|
+
function warn(context: LogContext, error: any): void;
|
|
40
|
+
function warn(message: string, error: any, payload: LogPayload): void;
|
|
41
|
+
function warn(message: string, error: any): void;
|
|
35
42
|
function warn(message: string, payload: LogPayload): void;
|
|
36
43
|
function warn(message: string): void;
|
|
37
|
-
function warn(error:
|
|
38
|
-
function warn(error:
|
|
39
|
-
function info(context: LogContext, message: string, error:
|
|
40
|
-
function info(context: LogContext, message: string, error:
|
|
44
|
+
function warn(error: any, payload: LogPayload): void;
|
|
45
|
+
function warn(error: any): void;
|
|
46
|
+
function info(context: LogContext, message: string, error: any, payload: LogPayload): void;
|
|
47
|
+
function info(context: LogContext, message: string, error: any): void;
|
|
41
48
|
function info(context: LogContext, message: string, payload: LogPayload): void;
|
|
42
49
|
function info(context: LogContext, message: string): void;
|
|
43
|
-
function info(context: LogContext, error:
|
|
44
|
-
function info(context: LogContext, error:
|
|
45
|
-
function info(message: string, error:
|
|
46
|
-
function info(message: string, error:
|
|
50
|
+
function info(context: LogContext, error: any, payload: LogPayload): void;
|
|
51
|
+
function info(context: LogContext, error: any): void;
|
|
52
|
+
function info(message: string, error: any, payload: LogPayload): void;
|
|
53
|
+
function info(message: string, error: any): void;
|
|
47
54
|
function info(message: string, payload: LogPayload): void;
|
|
48
55
|
function info(message: string): void;
|
|
49
|
-
function info(error:
|
|
50
|
-
function info(error:
|
|
51
|
-
function debug(context: LogContext, message: string, error:
|
|
52
|
-
function debug(context: LogContext, message: string, error:
|
|
56
|
+
function info(error: any, payload: LogPayload): void;
|
|
57
|
+
function info(error: any): void;
|
|
58
|
+
function debug(context: LogContext, message: string, error: any, payload: LogPayload): void;
|
|
59
|
+
function debug(context: LogContext, message: string, error: any): void;
|
|
53
60
|
function debug(context: LogContext, message: string, payload: LogPayload): void;
|
|
54
61
|
function debug(context: LogContext, message: string): void;
|
|
55
|
-
function debug(context: LogContext, error:
|
|
56
|
-
function debug(context: LogContext, error:
|
|
57
|
-
function debug(message: string, error:
|
|
58
|
-
function debug(message: string, error:
|
|
62
|
+
function debug(context: LogContext, error: any, payload: LogPayload): void;
|
|
63
|
+
function debug(context: LogContext, error: any): void;
|
|
64
|
+
function debug(message: string, error: any, payload: LogPayload): void;
|
|
65
|
+
function debug(message: string, error: any): void;
|
|
59
66
|
function debug(message: string, payload: LogPayload): void;
|
|
60
67
|
function debug(message: string): void;
|
|
61
|
-
function debug(error:
|
|
62
|
-
function debug(error:
|
|
68
|
+
function debug(error: any, payload: LogPayload): void;
|
|
69
|
+
function debug(error: any): void;
|
|
63
70
|
/**
|
|
64
71
|
* Do not use in frontend.
|
|
65
72
|
*/
|
|
66
|
-
function enableJSONLogging(componentArg: string, versionArg: string | undefined): void;
|
|
73
|
+
function enableJSONLogging(componentArg: string, versionArg: string | undefined, logLevel?: LogrusLogLevel): void;
|
|
74
|
+
function setLogLevel(logLevel: LogrusLogLevel | undefined): void;
|
|
67
75
|
function resetToDefaultLogging(): void;
|
|
76
|
+
function setVersion(versionArg: string): void;
|
|
77
|
+
}
|
|
78
|
+
export declare type LogrusLogLevel = keyof (typeof LogrusLogLevels);
|
|
79
|
+
export declare const LogrusLogLevels: {
|
|
80
|
+
trace: boolean;
|
|
81
|
+
debug: boolean;
|
|
82
|
+
info: boolean;
|
|
83
|
+
warning: boolean;
|
|
84
|
+
error: boolean;
|
|
85
|
+
fatal: boolean;
|
|
86
|
+
panic: boolean;
|
|
87
|
+
};
|
|
88
|
+
export declare namespace LogrusLogLevel {
|
|
89
|
+
function isGreatherOrEqual(lvl: LogrusLogLevel | undefined, ref: LogrusLogLevel | undefined): boolean;
|
|
90
|
+
function getFromEnv(): LogrusLogLevel | undefined;
|
|
68
91
|
}
|
|
69
92
|
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/util/logging.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,WAAW,UAAU;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;CAE1B;AAED,yBAAiB,GAAG,CAAC;IACjB,SAAgB,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/util/logging.ts"],"names":[],"mappings":"AAAA;;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,IAAI,CAAC;IAKxC;;OAEG;IACH,SAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAKvH;IAED,SAAgB,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,QA6B/D;IAED,SAAgB,qBAAqB,IAAI,IAAI,CAQ5C;IAED,SAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,QAE5C;CACJ;AAyBD,oBAAY,cAAc,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAC5D,eAAO,MAAM,eAAe;;;;;;;;CAQ3B,CAAA;AACD,yBAAiB,cAAc,CAAC;IAC5B,SAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,SAAS,EAAE,GAAG,EAAE,cAAc,GAAG,SAAS,GAAG,OAAO,CAQ3G;IAKD,SAAgB,UAAU,IAAI,cAAc,GAAG,SAAS,CAWvD;CACJ"}
|
package/lib/util/logging.js
CHANGED
|
@@ -1,120 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2020
|
|
3
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
4
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
5
|
* See License-AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
7
|
-
var __assign = (this && this.__assign) || function () {
|
|
8
|
-
__assign = Object.assign || function(t) {
|
|
9
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
10
|
-
s = arguments[i];
|
|
11
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
12
|
-
t[p] = s[p];
|
|
13
|
-
}
|
|
14
|
-
return t;
|
|
15
|
-
};
|
|
16
|
-
return __assign.apply(this, arguments);
|
|
17
|
-
};
|
|
18
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
19
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
20
|
-
if (!m) return o;
|
|
21
|
-
var i = m.call(o), r, ar = [], e;
|
|
22
|
-
try {
|
|
23
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
24
|
-
}
|
|
25
|
-
catch (error) { e = { error: error }; }
|
|
26
|
-
finally {
|
|
27
|
-
try {
|
|
28
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
29
|
-
}
|
|
30
|
-
finally { if (e) throw e.error; }
|
|
31
|
-
}
|
|
32
|
-
return ar;
|
|
33
|
-
};
|
|
34
|
-
var __spread = (this && this.__spread) || function () {
|
|
35
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
36
|
-
return ar;
|
|
37
|
-
};
|
|
38
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
exports.LogrusLogLevel = exports.LogrusLogLevels = exports.log = exports.LogContext = void 0;
|
|
9
|
+
const inspect = require('util').inspect; // undefined in frontend
|
|
10
|
+
let jsonLogging = false;
|
|
11
|
+
let component;
|
|
12
|
+
let version;
|
|
43
13
|
;
|
|
14
|
+
var LogContext;
|
|
15
|
+
(function (LogContext) {
|
|
16
|
+
function from(params) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
return {
|
|
19
|
+
sessionId: (_a = params.request) === null || _a === void 0 ? void 0 : _a.requestID,
|
|
20
|
+
userId: params.userId || ((_b = params.user) === null || _b === void 0 ? void 0 : _b.id)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
LogContext.from = from;
|
|
24
|
+
})(LogContext = exports.LogContext || (exports.LogContext = {}));
|
|
44
25
|
;
|
|
45
26
|
var log;
|
|
46
27
|
(function (log) {
|
|
47
|
-
function error() {
|
|
48
|
-
var args = [];
|
|
49
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
50
|
-
args[_i] = arguments[_i];
|
|
51
|
-
}
|
|
28
|
+
function error(...args) {
|
|
52
29
|
errorLog(false, args);
|
|
53
30
|
}
|
|
54
31
|
log.error = error;
|
|
55
|
-
function warn() {
|
|
56
|
-
var args = [];
|
|
57
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
58
|
-
args[_i] = arguments[_i];
|
|
59
|
-
}
|
|
32
|
+
function warn(...args) {
|
|
60
33
|
warnLog(false, args);
|
|
61
34
|
}
|
|
62
35
|
log.warn = warn;
|
|
63
|
-
function info() {
|
|
64
|
-
var args = [];
|
|
65
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
66
|
-
args[_i] = arguments[_i];
|
|
67
|
-
}
|
|
36
|
+
function info(...args) {
|
|
68
37
|
infoLog(false, args);
|
|
69
38
|
}
|
|
70
39
|
log.info = info;
|
|
71
|
-
function debug() {
|
|
72
|
-
var args = [];
|
|
73
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
74
|
-
args[_i] = arguments[_i];
|
|
75
|
-
}
|
|
40
|
+
function debug(...args) {
|
|
76
41
|
debugLog(false, args);
|
|
77
42
|
}
|
|
78
43
|
log.debug = debug;
|
|
79
44
|
/**
|
|
80
45
|
* Do not use in frontend.
|
|
81
46
|
*/
|
|
82
|
-
function enableJSONLogging(componentArg, versionArg) {
|
|
47
|
+
function enableJSONLogging(componentArg, versionArg, logLevel) {
|
|
83
48
|
component = componentArg;
|
|
84
49
|
version = versionArg;
|
|
50
|
+
setLogLevel(logLevel);
|
|
51
|
+
}
|
|
52
|
+
log.enableJSONLogging = enableJSONLogging;
|
|
53
|
+
function setLogLevel(logLevel) {
|
|
85
54
|
jsonLogging = true;
|
|
86
|
-
console.error = function () {
|
|
87
|
-
var args = [];
|
|
88
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
89
|
-
args[_i] = arguments[_i];
|
|
90
|
-
}
|
|
55
|
+
console.error = function (...args) {
|
|
91
56
|
errorLog(true, args);
|
|
92
57
|
};
|
|
93
|
-
console.warn = function () {
|
|
94
|
-
var args = [];
|
|
95
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
96
|
-
args[_i] = arguments[_i];
|
|
97
|
-
}
|
|
58
|
+
console.warn = function (...args) {
|
|
98
59
|
warnLog(true, args);
|
|
99
60
|
};
|
|
100
|
-
console.info = function () {
|
|
101
|
-
var args = [];
|
|
102
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
103
|
-
args[_i] = arguments[_i];
|
|
104
|
-
}
|
|
61
|
+
console.info = function (...args) {
|
|
105
62
|
infoLog(true, args);
|
|
106
63
|
};
|
|
107
|
-
console.debug = function () {
|
|
108
|
-
var args = [];
|
|
109
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
110
|
-
args[_i] = arguments[_i];
|
|
111
|
-
}
|
|
64
|
+
console.debug = function (...args) {
|
|
112
65
|
debugLog(true, args);
|
|
113
66
|
};
|
|
114
67
|
console.log = console.info;
|
|
115
68
|
// FIXME wrap also other console methods (e.g. trace())
|
|
69
|
+
// set/unset log functions based on loglevel so we only have to evaluate once, not every call
|
|
70
|
+
const noop = () => { };
|
|
71
|
+
const setLog = (logFunc, funcLevel) => {
|
|
72
|
+
return LogrusLogLevel.isGreatherOrEqual(funcLevel, logLevel) ? logFunc : noop;
|
|
73
|
+
};
|
|
74
|
+
errorLog = setLog(doErrorLog, "error");
|
|
75
|
+
warnLog = setLog(doWarnLog, "warning");
|
|
76
|
+
infoLog = setLog(doInfoLog, "info");
|
|
77
|
+
debugLog = setLog(doDebugLog, "debug");
|
|
116
78
|
}
|
|
117
|
-
log.
|
|
79
|
+
log.setLogLevel = setLogLevel;
|
|
118
80
|
function resetToDefaultLogging() {
|
|
119
81
|
jsonLogging = false;
|
|
120
82
|
console.log = logConsoleLog;
|
|
@@ -124,22 +86,69 @@ var log;
|
|
|
124
86
|
console.debug = debugConsoleLog;
|
|
125
87
|
}
|
|
126
88
|
log.resetToDefaultLogging = resetToDefaultLogging;
|
|
89
|
+
function setVersion(versionArg) {
|
|
90
|
+
version = versionArg;
|
|
91
|
+
}
|
|
92
|
+
log.setVersion = setVersion;
|
|
127
93
|
})(log = exports.log || (exports.log = {}));
|
|
128
|
-
|
|
94
|
+
let errorLog = doErrorLog;
|
|
95
|
+
function doErrorLog(calledViaConsole, args) {
|
|
129
96
|
doLog(calledViaConsole, errorConsoleLog, 'ERROR', args);
|
|
130
97
|
}
|
|
131
|
-
|
|
98
|
+
let warnLog = doWarnLog;
|
|
99
|
+
function doWarnLog(calledViaConsole, args) {
|
|
132
100
|
doLog(calledViaConsole, warnConsoleLog, 'WARNING', args);
|
|
133
101
|
}
|
|
134
|
-
|
|
102
|
+
let infoLog = doInfoLog;
|
|
103
|
+
function doInfoLog(calledViaConsole, args) {
|
|
135
104
|
doLog(calledViaConsole, infoConsoleLog, 'INFO', args);
|
|
136
105
|
}
|
|
137
|
-
|
|
106
|
+
let debugLog = doDebugLog;
|
|
107
|
+
function doDebugLog(calledViaConsole, args) {
|
|
138
108
|
doLog(calledViaConsole, debugConsoleLog, 'DEBUG', args);
|
|
139
109
|
}
|
|
110
|
+
exports.LogrusLogLevels = {
|
|
111
|
+
trace: true,
|
|
112
|
+
debug: true,
|
|
113
|
+
info: true,
|
|
114
|
+
warning: true,
|
|
115
|
+
error: true,
|
|
116
|
+
fatal: true,
|
|
117
|
+
panic: true,
|
|
118
|
+
};
|
|
119
|
+
var LogrusLogLevel;
|
|
120
|
+
(function (LogrusLogLevel) {
|
|
121
|
+
function isGreatherOrEqual(lvl, ref) {
|
|
122
|
+
if (lvl === undefined) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
if (ref === undefined) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
return getLevelArity(lvl) >= getLevelArity(ref);
|
|
129
|
+
}
|
|
130
|
+
LogrusLogLevel.isGreatherOrEqual = isGreatherOrEqual;
|
|
131
|
+
function getLevelArity(lvl) {
|
|
132
|
+
return Object.keys(exports.LogrusLogLevels)
|
|
133
|
+
.findIndex((l) => l === lvl);
|
|
134
|
+
}
|
|
135
|
+
function getFromEnv() {
|
|
136
|
+
const lvlStr = process.env.LOG_LEVEL;
|
|
137
|
+
if (!lvlStr) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
const lvl = lvlStr;
|
|
141
|
+
const exists = exports.LogrusLogLevels[lvl];
|
|
142
|
+
if (!exists) {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
return lvl;
|
|
146
|
+
}
|
|
147
|
+
LogrusLogLevel.getFromEnv = getFromEnv;
|
|
148
|
+
})(LogrusLogLevel = exports.LogrusLogLevel || (exports.LogrusLogLevel = {}));
|
|
140
149
|
var GoogleLogSeverity;
|
|
141
150
|
(function (GoogleLogSeverity) {
|
|
142
|
-
GoogleLogSeverity.isGreaterOrEqualThanWarning =
|
|
151
|
+
GoogleLogSeverity.isGreaterOrEqualThanWarning = (severity) => {
|
|
143
152
|
switch (severity) {
|
|
144
153
|
case 'INFO':
|
|
145
154
|
case 'DEBUG':
|
|
@@ -151,17 +160,17 @@ var GoogleLogSeverity;
|
|
|
151
160
|
})(GoogleLogSeverity || (GoogleLogSeverity = {}));
|
|
152
161
|
function doLog(calledViaConsole, consoleLog, severity, args) {
|
|
153
162
|
if (!jsonLogging) {
|
|
154
|
-
consoleLog
|
|
163
|
+
consoleLog(...args);
|
|
155
164
|
return;
|
|
156
165
|
}
|
|
157
166
|
if (args.length == 0) {
|
|
158
167
|
// console.xyz()
|
|
159
168
|
return;
|
|
160
169
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
170
|
+
let context;
|
|
171
|
+
let message;
|
|
172
|
+
let error;
|
|
173
|
+
let payloadArgs;
|
|
165
174
|
if (args[0] instanceof Error) {
|
|
166
175
|
// console.xyz(Error, ...any) / log.xyz(Error) / log.xyz(Error, LogPayload)
|
|
167
176
|
error = args[0];
|
|
@@ -209,7 +218,7 @@ function doLog(calledViaConsole, consoleLog, severity, args) {
|
|
|
209
218
|
payloadArgs = args;
|
|
210
219
|
}
|
|
211
220
|
}
|
|
212
|
-
|
|
221
|
+
const logItem = makeLogItem(severity, context, message, error, payloadArgs, calledViaConsole);
|
|
213
222
|
if (logItem !== undefined) {
|
|
214
223
|
consoleLog(logItem);
|
|
215
224
|
}
|
|
@@ -218,20 +227,20 @@ function makeLogItem(severity, context, message, error, payloadArgs, calledViaCo
|
|
|
218
227
|
if (context !== undefined && Object.keys(context).length == 0) {
|
|
219
228
|
context = undefined;
|
|
220
229
|
}
|
|
221
|
-
|
|
230
|
+
let reportedErrorEvent = {};
|
|
222
231
|
if (GoogleLogSeverity.isGreaterOrEqualThanWarning(severity)) {
|
|
223
232
|
reportedErrorEvent = makeReportedErrorEvent(error);
|
|
224
233
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
severity
|
|
228
|
-
message
|
|
229
|
-
error
|
|
230
|
-
payload
|
|
231
|
-
|
|
234
|
+
const payload = payloadArgs.length == 0 ? undefined : payloadArgs.length == 1 ? payloadArgs[0] : payloadArgs;
|
|
235
|
+
const logItem = Object.assign(Object.assign({}, reportedErrorEvent), { component,
|
|
236
|
+
severity, time: new Date().toISOString(), environment: process.env.KUBE_STAGE, context,
|
|
237
|
+
message,
|
|
238
|
+
error,
|
|
239
|
+
payload, loggedViaConsole: calledViaConsole ? true : undefined });
|
|
240
|
+
let result = stringifyLogItem(logItem);
|
|
232
241
|
if (result.length > maxAllowedLogItemLength && payload !== undefined) {
|
|
233
242
|
delete logItem.payload;
|
|
234
|
-
logItem.payloadStub =
|
|
243
|
+
logItem.payloadStub = `Payload stripped as log item was longer than ${maxAllowedLogItemLength} characters`;
|
|
235
244
|
result = stringifyLogItem(logItem);
|
|
236
245
|
if (result.length <= maxAllowedLogItemLength) {
|
|
237
246
|
log.warn('Log item too large, stripping payload', { logItemStub: makeLogItemStub(logItem) });
|
|
@@ -246,7 +255,7 @@ function makeLogItem(severity, context, message, error, payloadArgs, calledViaCo
|
|
|
246
255
|
// See https://cloud.google.com/error-reporting/docs/formatting-error-messages
|
|
247
256
|
// and https://cloud.google.com/error-reporting/reference/rest/v1beta1/projects.events/report#ReportedErrorEvent
|
|
248
257
|
function makeReportedErrorEvent(error) {
|
|
249
|
-
|
|
258
|
+
const result = {
|
|
250
259
|
// Serves as marker only
|
|
251
260
|
"@type": "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent",
|
|
252
261
|
// This is useful for filtering in the UI
|
|
@@ -257,7 +266,7 @@ function makeReportedErrorEvent(error) {
|
|
|
257
266
|
};
|
|
258
267
|
if (error) {
|
|
259
268
|
// According to: https://cloud.google.com/error-reporting/docs/formatting-error-messages#json_representation
|
|
260
|
-
|
|
269
|
+
const stackTrace = error.stack;
|
|
261
270
|
if (stackTrace) {
|
|
262
271
|
result.stack_trace = stackTrace;
|
|
263
272
|
}
|
|
@@ -265,7 +274,7 @@ function makeReportedErrorEvent(error) {
|
|
|
265
274
|
return result;
|
|
266
275
|
}
|
|
267
276
|
function makeLogItemStub(logItem) {
|
|
268
|
-
|
|
277
|
+
const result = {
|
|
269
278
|
component: logItem.component,
|
|
270
279
|
severity: logItem.severity,
|
|
271
280
|
time: logItem.time,
|
|
@@ -307,16 +316,16 @@ function stringifyLogItem(logItem) {
|
|
|
307
316
|
* Jsonifies Errors properly, not as {} only.
|
|
308
317
|
*/
|
|
309
318
|
function jsonStringifyWithErrors(value) {
|
|
310
|
-
return JSON.stringify(value,
|
|
319
|
+
return JSON.stringify(value, (key, value) => { return value instanceof Error ? value.stack : value; });
|
|
311
320
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
321
|
+
const logConsoleLog = console.log;
|
|
322
|
+
const errorConsoleLog = console.error;
|
|
323
|
+
const warnConsoleLog = console.warn;
|
|
324
|
+
const infoConsoleLog = console.info;
|
|
325
|
+
const debugConsoleLog = console.debug;
|
|
317
326
|
// according to https://cloud.google.com/logging/quotas#logging_usage_limits, the log item must fit in 100 KB (internal data
|
|
318
327
|
// size; its relation to the stringified JSON's size is unknown), so let's have a sufficient safe margin
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
328
|
+
const maxAllowedLogItemLength = 32 * 1024;
|
|
329
|
+
const maxMessageStubLength = 1024;
|
|
330
|
+
const maxErrorStubLength = 4096;
|
|
322
331
|
//# sourceMappingURL=logging.js.map
|
package/lib/util/logging.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/util/logging.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/util/logging.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,MAAM,OAAO,GAA4B,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAG,wBAAwB;AAE5F,IAAI,WAAW,GAAY,KAAK,CAAC;AACjC,IAAI,SAA6B,CAAC;AAClC,IAAI,OAA2B,CAAC;AAO/B,CAAC;AACF,IAAiB,UAAU,CAO1B;AAPD,WAAiB,UAAU;IACvB,SAAgB,IAAI,CAAC,MAAuD;;QACxE,OAAmB;YACf,SAAS,EAAE,MAAA,MAAM,CAAC,OAAO,0CAAE,SAAS;YACpC,MAAM,EAAE,MAAM,CAAC,MAAM,KAAI,MAAA,MAAM,CAAC,IAAI,0CAAE,EAAE,CAAA;SAC3C,CAAA;IACL,CAAC;IALe,eAAI,OAKnB,CAAA;AACL,CAAC,EAPgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAO1B;AAIA,CAAC;AAEF,IAAiB,GAAG,CAuHnB;AAvHD,WAAiB,GAAG;IAahB,SAAgB,KAAK,CAAC,GAAG,IAAW;QAChC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;IAFe,SAAK,QAEpB,CAAA;IAcD,SAAgB,IAA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AK,CAAA,CAAC,CAAC,CAAC,CAAC;AAC5H,CAAC;AAGD,MAAM,aAAa,GAAe,OAAO,CAAC,GAAG,CAAC;AAC9C,MAAM,eAAe,GAAe,OAAO,CAAC,KAAK,CAAC;AAClD,MAAM,cAAc,GAAe,OAAO,CAAC,IAAI,CAAC;AAChD,MAAM,cAAc,GAAe,OAAO,CAAC,IAAI,CAAC;AAChD,MAAM,eAAe,GAAe,OAAO,CAAC,KAAK,CAAC;AAElD,4HAA4H;AAC5H,wGAAwG;AACxG,MAAM,uBAAuB,GAAW,EAAE,GAAG,IAAI,CAAC;AAClD,MAAM,oBAAoB,GAAW,IAAI,CAAC;AAC1C,MAAM,kBAAkB,GAAW,IAAI,CAAC"}
|
package/lib/util/make-link.d.ts
CHANGED
package/lib/util/make-link.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2020
|
|
3
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
4
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
5
|
* See License-AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.makeLink = void 0;
|
|
8
9
|
function isOpenNewTab(event) {
|
|
9
10
|
return event.metaKey || (event.ctrlKey);
|
|
10
11
|
}
|
|
11
12
|
function makeLink(node, url, hover) {
|
|
12
|
-
node.onclick =
|
|
13
|
-
|
|
13
|
+
node.onclick = event => {
|
|
14
|
+
let target = '_self';
|
|
14
15
|
if (isOpenNewTab(event)) {
|
|
15
16
|
target = '_blank';
|
|
16
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-link.js","sourceRoot":"","sources":["../../src/util/make-link.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"make-link.js","sourceRoot":"","sources":["../../src/util/make-link.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,SAAS,YAAY,CAAC,KAAiB;IACnC,OAAO,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,QAAQ,CAAC,IAAiB,EAAE,GAAW,EAAE,KAAa;IAClE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE;QACnB,IAAI,MAAM,GAAG,OAAO,CAAC;QACrB,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;YACrB,MAAM,GAAG,QAAQ,CAAC;SACrB;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC,CAAA;IACD,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACvB,CAAC;AAVD,4BAUC"}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* Hostname may be of the form:
|
|
8
|
-
* -
|
|
9
|
-
* - 1234-
|
|
10
|
-
* - webview-1234-
|
|
8
|
+
* - moccasin-ferret-155799b3.ws-eu01.gitpod.io
|
|
9
|
+
* - 1234-moccasin-ferret-155799b3.ws-eu01.gitpod.io
|
|
10
|
+
* - webview-1234-moccasin-ferret-155799b3.ws-eu01.gitpod.io (or any other string replacing webview)
|
|
11
11
|
* @param hostname The hostname the request is headed to
|
|
12
12
|
*/
|
|
13
13
|
export declare const parseWorkspaceIdFromHostname: (hostname: string) => string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* @param maybeId
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare const matchesInstanceIdOrLegacyWorkspaceIdExactly: (maybeId: string) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @param maybeWorkspaceId
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare const matchesNewWorkspaceIdExactly: (maybeWorkspaceId: string) => boolean;
|
|
14
24
|
//# sourceMappingURL=parse-workspace-id.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-workspace-id.d.ts","sourceRoot":"","sources":["../../src/util/parse-workspace-id.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"parse-workspace-id.d.ts","sourceRoot":"","sources":["../../src/util/parse-workspace-id.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,aAAsB,MAAM,uBAWpE,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,2CAA2C,YAAqB,MAAM,KAAG,OAGrF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,qBAA8B,MAAM,KAAG,OAE/E,CAAC"}
|