@gitpod/gitpod-protocol 0.1.5-v0.6.0-beta4 → 0.1.5-vn-6525.75
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 +68 -26
- package/lib/accounting-protocol.d.ts +155 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +100 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +33 -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 +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 +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 +2 -3
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +24 -25
- 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 +172 -33
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +187 -267
- 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.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 +5 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +10 -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 -5
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +41 -35
- 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 +164 -88
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +184 -199
- 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 +75 -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 +113 -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 +4 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.js +487 -0
- package/lib/util/generate-workspace-id.js.map +1 -0
- package/{src/theia-plugins.ts → lib/util/generate-workspace-id.spec.d.ts} +2 -6
- package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.spec.js +91 -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 +41 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +2 -2
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +109 -106
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +8 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +114 -22
- 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 +13 -3
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +37 -8
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +8 -0
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +127 -47
- 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.map +1 -1
- package/lib/util/timeutil.js +28 -16
- 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 +199 -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 +28 -4
- 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 +33 -17
- package/pkg-yarn.lock +18 -9
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +231 -0
- package/src/admin-protocol.ts +71 -19
- package/src/analytics.ts +52 -0
- package/src/auth.ts +27 -0
- 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 +18 -18
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +327 -102
- 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 +5 -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 +15 -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 -38
- package/src/plans.ts +679 -0
- package/src/protocol.ts +384 -279
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +123 -0
- package/src/teams-projects-protocol.ts +147 -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 +51 -0
- package/src/util/generate-workspace-id.ts +475 -0
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +63 -7
- package/src/util/gitpod-host-url.ts +55 -38
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +145 -71
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +60 -10
- package/src/util/parse-workspace-id.ts +38 -8
- 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 +19 -15
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +202 -31
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/workspace-cluster.ts +107 -0
- package/src/workspace-instance.ts +72 -30
- 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/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/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
package/lib/util/logging.d.ts
CHANGED
|
@@ -19,58 +19,74 @@ export declare namespace LogContext {
|
|
|
19
19
|
export interface LogPayload {
|
|
20
20
|
}
|
|
21
21
|
export declare namespace log {
|
|
22
|
-
function error(context: LogContext, message: string, error:
|
|
23
|
-
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;
|
|
24
24
|
function error(context: LogContext, message: string, payload: LogPayload): void;
|
|
25
25
|
function error(context: LogContext, message: string): void;
|
|
26
|
-
function error(context: LogContext, error:
|
|
27
|
-
function error(context: LogContext, error:
|
|
28
|
-
function error(message: string, error:
|
|
29
|
-
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;
|
|
30
30
|
function error(message: string, payload: LogPayload): void;
|
|
31
31
|
function error(message: string): void;
|
|
32
|
-
function error(error:
|
|
33
|
-
function error(error:
|
|
34
|
-
function warn(context: LogContext, message: string, error:
|
|
35
|
-
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;
|
|
36
36
|
function warn(context: LogContext, message: string, payload: LogPayload): void;
|
|
37
37
|
function warn(context: LogContext, message: string): void;
|
|
38
|
-
function warn(context: LogContext, error:
|
|
39
|
-
function warn(context: LogContext, error:
|
|
40
|
-
function warn(message: string, error:
|
|
41
|
-
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;
|
|
42
42
|
function warn(message: string, payload: LogPayload): void;
|
|
43
43
|
function warn(message: string): void;
|
|
44
|
-
function warn(error:
|
|
45
|
-
function warn(error:
|
|
46
|
-
function info(context: LogContext, message: string, error:
|
|
47
|
-
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;
|
|
48
48
|
function info(context: LogContext, message: string, payload: LogPayload): void;
|
|
49
49
|
function info(context: LogContext, message: string): void;
|
|
50
|
-
function info(context: LogContext, error:
|
|
51
|
-
function info(context: LogContext, error:
|
|
52
|
-
function info(message: string, error:
|
|
53
|
-
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;
|
|
54
54
|
function info(message: string, payload: LogPayload): void;
|
|
55
55
|
function info(message: string): void;
|
|
56
|
-
function info(error:
|
|
57
|
-
function info(error:
|
|
58
|
-
function debug(context: LogContext, message: string, error:
|
|
59
|
-
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;
|
|
60
60
|
function debug(context: LogContext, message: string, payload: LogPayload): void;
|
|
61
61
|
function debug(context: LogContext, message: string): void;
|
|
62
|
-
function debug(context: LogContext, error:
|
|
63
|
-
function debug(context: LogContext, error:
|
|
64
|
-
function debug(message: string, error:
|
|
65
|
-
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;
|
|
66
66
|
function debug(message: string, payload: LogPayload): void;
|
|
67
67
|
function debug(message: string): void;
|
|
68
|
-
function debug(error:
|
|
69
|
-
function debug(error:
|
|
68
|
+
function debug(error: any, payload: LogPayload): void;
|
|
69
|
+
function debug(error: any): void;
|
|
70
70
|
/**
|
|
71
71
|
* Do not use in frontend.
|
|
72
72
|
*/
|
|
73
|
-
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;
|
|
74
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;
|
|
75
91
|
}
|
|
76
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;AACD,yBAAiB,UAAU,CAAC;IACxB,SAAgB,IAAI,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/util/logging.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH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IAKxC;;OAEG;IACH,SAAgB,iBAAiB,CAC7B,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,CAAC,EAAE,cAAc,GAC1B,IAAI,CAKN;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,OAAO,eAAe,CAAC;AAC1D,eAAO,MAAM,eAAe;;;;;;;;CAQ3B,CAAC;AACF,yBAAiB,cAAc,CAAC;IAC5B,SAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,SAAS,EAAE,GAAG,EAAE,cAAc,GAAG,SAAS,GAAG,OAAO,CAQ3G;IAID,SAAgB,UAAU,IAAI,cAAc,GAAG,SAAS,CAWvD;CACJ"}
|
package/lib/util/logging.js
CHANGED
|
@@ -4,129 +4,77 @@
|
|
|
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
|
-
exports.log = exports.LogContext = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
;
|
|
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;
|
|
45
13
|
var LogContext;
|
|
46
14
|
(function (LogContext) {
|
|
47
15
|
function from(params) {
|
|
48
16
|
var _a, _b;
|
|
49
17
|
return {
|
|
50
18
|
sessionId: (_a = params.request) === null || _a === void 0 ? void 0 : _a.requestID,
|
|
51
|
-
userId: params.userId || ((_b = params.user) === null || _b === void 0 ? void 0 : _b.id)
|
|
19
|
+
userId: params.userId || ((_b = params.user) === null || _b === void 0 ? void 0 : _b.id),
|
|
52
20
|
};
|
|
53
21
|
}
|
|
54
22
|
LogContext.from = from;
|
|
55
23
|
})(LogContext = exports.LogContext || (exports.LogContext = {}));
|
|
56
|
-
;
|
|
57
24
|
var log;
|
|
58
25
|
(function (log) {
|
|
59
|
-
function error() {
|
|
60
|
-
var args = [];
|
|
61
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
62
|
-
args[_i] = arguments[_i];
|
|
63
|
-
}
|
|
26
|
+
function error(...args) {
|
|
64
27
|
errorLog(false, args);
|
|
65
28
|
}
|
|
66
29
|
log.error = error;
|
|
67
|
-
function warn() {
|
|
68
|
-
var args = [];
|
|
69
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
70
|
-
args[_i] = arguments[_i];
|
|
71
|
-
}
|
|
30
|
+
function warn(...args) {
|
|
72
31
|
warnLog(false, args);
|
|
73
32
|
}
|
|
74
33
|
log.warn = warn;
|
|
75
|
-
function info() {
|
|
76
|
-
var args = [];
|
|
77
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
78
|
-
args[_i] = arguments[_i];
|
|
79
|
-
}
|
|
34
|
+
function info(...args) {
|
|
80
35
|
infoLog(false, args);
|
|
81
36
|
}
|
|
82
37
|
log.info = info;
|
|
83
|
-
function debug() {
|
|
84
|
-
var args = [];
|
|
85
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
86
|
-
args[_i] = arguments[_i];
|
|
87
|
-
}
|
|
38
|
+
function debug(...args) {
|
|
88
39
|
debugLog(false, args);
|
|
89
40
|
}
|
|
90
41
|
log.debug = debug;
|
|
91
42
|
/**
|
|
92
43
|
* Do not use in frontend.
|
|
93
44
|
*/
|
|
94
|
-
function enableJSONLogging(componentArg, versionArg) {
|
|
45
|
+
function enableJSONLogging(componentArg, versionArg, logLevel) {
|
|
95
46
|
component = componentArg;
|
|
96
47
|
version = versionArg;
|
|
48
|
+
setLogLevel(logLevel);
|
|
49
|
+
}
|
|
50
|
+
log.enableJSONLogging = enableJSONLogging;
|
|
51
|
+
function setLogLevel(logLevel) {
|
|
97
52
|
jsonLogging = true;
|
|
98
|
-
console.error = function () {
|
|
99
|
-
var args = [];
|
|
100
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
101
|
-
args[_i] = arguments[_i];
|
|
102
|
-
}
|
|
53
|
+
console.error = function (...args) {
|
|
103
54
|
errorLog(true, args);
|
|
104
55
|
};
|
|
105
|
-
console.warn = function () {
|
|
106
|
-
var args = [];
|
|
107
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
108
|
-
args[_i] = arguments[_i];
|
|
109
|
-
}
|
|
56
|
+
console.warn = function (...args) {
|
|
110
57
|
warnLog(true, args);
|
|
111
58
|
};
|
|
112
|
-
console.info = function () {
|
|
113
|
-
var args = [];
|
|
114
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
115
|
-
args[_i] = arguments[_i];
|
|
116
|
-
}
|
|
59
|
+
console.info = function (...args) {
|
|
117
60
|
infoLog(true, args);
|
|
118
61
|
};
|
|
119
|
-
console.debug = function () {
|
|
120
|
-
var args = [];
|
|
121
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
122
|
-
args[_i] = arguments[_i];
|
|
123
|
-
}
|
|
62
|
+
console.debug = function (...args) {
|
|
124
63
|
debugLog(true, args);
|
|
125
64
|
};
|
|
126
65
|
console.log = console.info;
|
|
127
66
|
// FIXME wrap also other console methods (e.g. trace())
|
|
67
|
+
// set/unset log functions based on loglevel so we only have to evaluate once, not every call
|
|
68
|
+
const noop = () => { };
|
|
69
|
+
const setLog = (logFunc, funcLevel) => {
|
|
70
|
+
return LogrusLogLevel.isGreatherOrEqual(funcLevel, logLevel) ? logFunc : noop;
|
|
71
|
+
};
|
|
72
|
+
errorLog = setLog(doErrorLog, "error");
|
|
73
|
+
warnLog = setLog(doWarnLog, "warning");
|
|
74
|
+
infoLog = setLog(doInfoLog, "info");
|
|
75
|
+
debugLog = setLog(doDebugLog, "debug");
|
|
128
76
|
}
|
|
129
|
-
log.
|
|
77
|
+
log.setLogLevel = setLogLevel;
|
|
130
78
|
function resetToDefaultLogging() {
|
|
131
79
|
jsonLogging = false;
|
|
132
80
|
console.log = logConsoleLog;
|
|
@@ -136,25 +84,71 @@ var log;
|
|
|
136
84
|
console.debug = debugConsoleLog;
|
|
137
85
|
}
|
|
138
86
|
log.resetToDefaultLogging = resetToDefaultLogging;
|
|
87
|
+
function setVersion(versionArg) {
|
|
88
|
+
version = versionArg;
|
|
89
|
+
}
|
|
90
|
+
log.setVersion = setVersion;
|
|
139
91
|
})(log = exports.log || (exports.log = {}));
|
|
140
|
-
|
|
141
|
-
|
|
92
|
+
let errorLog = doErrorLog;
|
|
93
|
+
function doErrorLog(calledViaConsole, args) {
|
|
94
|
+
doLog(calledViaConsole, errorConsoleLog, "ERROR", args);
|
|
142
95
|
}
|
|
143
|
-
|
|
144
|
-
|
|
96
|
+
let warnLog = doWarnLog;
|
|
97
|
+
function doWarnLog(calledViaConsole, args) {
|
|
98
|
+
doLog(calledViaConsole, warnConsoleLog, "WARNING", args);
|
|
145
99
|
}
|
|
146
|
-
|
|
147
|
-
|
|
100
|
+
let infoLog = doInfoLog;
|
|
101
|
+
function doInfoLog(calledViaConsole, args) {
|
|
102
|
+
doLog(calledViaConsole, infoConsoleLog, "INFO", args);
|
|
148
103
|
}
|
|
149
|
-
|
|
150
|
-
|
|
104
|
+
let debugLog = doDebugLog;
|
|
105
|
+
function doDebugLog(calledViaConsole, args) {
|
|
106
|
+
doLog(calledViaConsole, debugConsoleLog, "DEBUG", args);
|
|
151
107
|
}
|
|
108
|
+
exports.LogrusLogLevels = {
|
|
109
|
+
trace: true,
|
|
110
|
+
debug: true,
|
|
111
|
+
info: true,
|
|
112
|
+
warning: true,
|
|
113
|
+
error: true,
|
|
114
|
+
fatal: true,
|
|
115
|
+
panic: true,
|
|
116
|
+
};
|
|
117
|
+
var LogrusLogLevel;
|
|
118
|
+
(function (LogrusLogLevel) {
|
|
119
|
+
function isGreatherOrEqual(lvl, ref) {
|
|
120
|
+
if (lvl === undefined) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
if (ref === undefined) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
return getLevelArity(lvl) >= getLevelArity(ref);
|
|
127
|
+
}
|
|
128
|
+
LogrusLogLevel.isGreatherOrEqual = isGreatherOrEqual;
|
|
129
|
+
function getLevelArity(lvl) {
|
|
130
|
+
return Object.keys(exports.LogrusLogLevels).findIndex((l) => l === lvl);
|
|
131
|
+
}
|
|
132
|
+
function getFromEnv() {
|
|
133
|
+
const lvlStr = process.env.LOG_LEVEL;
|
|
134
|
+
if (!lvlStr) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
const lvl = lvlStr;
|
|
138
|
+
const exists = exports.LogrusLogLevels[lvl];
|
|
139
|
+
if (!exists) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
return lvl;
|
|
143
|
+
}
|
|
144
|
+
LogrusLogLevel.getFromEnv = getFromEnv;
|
|
145
|
+
})(LogrusLogLevel = exports.LogrusLogLevel || (exports.LogrusLogLevel = {}));
|
|
152
146
|
var GoogleLogSeverity;
|
|
153
147
|
(function (GoogleLogSeverity) {
|
|
154
|
-
GoogleLogSeverity.isGreaterOrEqualThanWarning =
|
|
148
|
+
GoogleLogSeverity.isGreaterOrEqualThanWarning = (severity) => {
|
|
155
149
|
switch (severity) {
|
|
156
|
-
case
|
|
157
|
-
case
|
|
150
|
+
case "INFO":
|
|
151
|
+
case "DEBUG":
|
|
158
152
|
return false;
|
|
159
153
|
default:
|
|
160
154
|
return true;
|
|
@@ -163,23 +157,23 @@ var GoogleLogSeverity;
|
|
|
163
157
|
})(GoogleLogSeverity || (GoogleLogSeverity = {}));
|
|
164
158
|
function doLog(calledViaConsole, consoleLog, severity, args) {
|
|
165
159
|
if (!jsonLogging) {
|
|
166
|
-
consoleLog
|
|
160
|
+
consoleLog(...args);
|
|
167
161
|
return;
|
|
168
162
|
}
|
|
169
163
|
if (args.length == 0) {
|
|
170
164
|
// console.xyz()
|
|
171
165
|
return;
|
|
172
166
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
let context;
|
|
168
|
+
let message;
|
|
169
|
+
let error;
|
|
170
|
+
let payloadArgs;
|
|
177
171
|
if (args[0] instanceof Error) {
|
|
178
172
|
// console.xyz(Error, ...any) / log.xyz(Error) / log.xyz(Error, LogPayload)
|
|
179
173
|
error = args[0];
|
|
180
174
|
payloadArgs = args.slice(1);
|
|
181
175
|
}
|
|
182
|
-
else if (typeof args[0] ===
|
|
176
|
+
else if (typeof args[0] === "string") {
|
|
183
177
|
message = args[0];
|
|
184
178
|
if (args.length < 2 || !(args[1] instanceof Error)) {
|
|
185
179
|
// console.xyz(string) / console.xyz(string, !Error, ...any) / log.xyz(string) / log.xyz(string, LogPayload)
|
|
@@ -203,7 +197,7 @@ function doLog(calledViaConsole, consoleLog, severity, args) {
|
|
|
203
197
|
error = args[1];
|
|
204
198
|
payloadArgs = args.slice(2);
|
|
205
199
|
}
|
|
206
|
-
else if (typeof args[1] ===
|
|
200
|
+
else if (typeof args[1] === "string") {
|
|
207
201
|
message = args[1];
|
|
208
202
|
if (args.length < 3 || !(args[2] instanceof Error)) {
|
|
209
203
|
// log.xyz(LogContext, string) / log.xyz(LogContext, string, LogPayload)
|
|
@@ -221,7 +215,7 @@ function doLog(calledViaConsole, consoleLog, severity, args) {
|
|
|
221
215
|
payloadArgs = args;
|
|
222
216
|
}
|
|
223
217
|
}
|
|
224
|
-
|
|
218
|
+
const logItem = makeLogItem(severity, context, message, error, payloadArgs, calledViaConsole);
|
|
225
219
|
if (logItem !== undefined) {
|
|
226
220
|
consoleLog(logItem);
|
|
227
221
|
}
|
|
@@ -230,27 +224,27 @@ function makeLogItem(severity, context, message, error, payloadArgs, calledViaCo
|
|
|
230
224
|
if (context !== undefined && Object.keys(context).length == 0) {
|
|
231
225
|
context = undefined;
|
|
232
226
|
}
|
|
233
|
-
|
|
227
|
+
let reportedErrorEvent = {};
|
|
234
228
|
if (GoogleLogSeverity.isGreaterOrEqualThanWarning(severity)) {
|
|
235
229
|
reportedErrorEvent = makeReportedErrorEvent(error);
|
|
236
230
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
severity
|
|
240
|
-
message
|
|
241
|
-
error
|
|
242
|
-
payload
|
|
243
|
-
|
|
231
|
+
const payload = payloadArgs.length == 0 ? undefined : payloadArgs.length == 1 ? payloadArgs[0] : payloadArgs;
|
|
232
|
+
const logItem = Object.assign(Object.assign({}, reportedErrorEvent), { component,
|
|
233
|
+
severity, time: new Date().toISOString(), environment: process.env.KUBE_STAGE, context,
|
|
234
|
+
message,
|
|
235
|
+
error,
|
|
236
|
+
payload, loggedViaConsole: calledViaConsole ? true : undefined });
|
|
237
|
+
let result = stringifyLogItem(logItem);
|
|
244
238
|
if (result.length > maxAllowedLogItemLength && payload !== undefined) {
|
|
245
239
|
delete logItem.payload;
|
|
246
|
-
logItem.payloadStub =
|
|
240
|
+
logItem.payloadStub = `Payload stripped as log item was longer than ${maxAllowedLogItemLength} characters`;
|
|
247
241
|
result = stringifyLogItem(logItem);
|
|
248
242
|
if (result.length <= maxAllowedLogItemLength) {
|
|
249
|
-
log.warn(
|
|
243
|
+
log.warn("Log item too large, stripping payload", { logItemStub: makeLogItemStub(logItem) });
|
|
250
244
|
}
|
|
251
245
|
}
|
|
252
246
|
if (result.length > maxAllowedLogItemLength) {
|
|
253
|
-
log.error(
|
|
247
|
+
log.error("Log item too large w/o payload, discarding", { logItemStub: makeLogItemStub(logItem) });
|
|
254
248
|
return undefined;
|
|
255
249
|
}
|
|
256
250
|
return result;
|
|
@@ -258,18 +252,18 @@ function makeLogItem(severity, context, message, error, payloadArgs, calledViaCo
|
|
|
258
252
|
// See https://cloud.google.com/error-reporting/docs/formatting-error-messages
|
|
259
253
|
// and https://cloud.google.com/error-reporting/reference/rest/v1beta1/projects.events/report#ReportedErrorEvent
|
|
260
254
|
function makeReportedErrorEvent(error) {
|
|
261
|
-
|
|
255
|
+
const result = {
|
|
262
256
|
// Serves as marker only
|
|
263
257
|
"@type": "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent",
|
|
264
258
|
// This is useful for filtering in the UI
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
259
|
+
serviceContext: {
|
|
260
|
+
service: component || "<ts-not-set>",
|
|
261
|
+
version: version || "<ts-not-set>",
|
|
262
|
+
},
|
|
269
263
|
};
|
|
270
264
|
if (error) {
|
|
271
265
|
// According to: https://cloud.google.com/error-reporting/docs/formatting-error-messages#json_representation
|
|
272
|
-
|
|
266
|
+
const stackTrace = error.stack;
|
|
273
267
|
if (stackTrace) {
|
|
274
268
|
result.stack_trace = stackTrace;
|
|
275
269
|
}
|
|
@@ -277,14 +271,14 @@ function makeReportedErrorEvent(error) {
|
|
|
277
271
|
return result;
|
|
278
272
|
}
|
|
279
273
|
function makeLogItemStub(logItem) {
|
|
280
|
-
|
|
274
|
+
const result = {
|
|
281
275
|
component: logItem.component,
|
|
282
276
|
severity: logItem.severity,
|
|
283
277
|
time: logItem.time,
|
|
284
278
|
environment: logItem.environment,
|
|
285
|
-
region: logItem.region
|
|
279
|
+
region: logItem.region,
|
|
286
280
|
};
|
|
287
|
-
if (typeof
|
|
281
|
+
if (typeof logItem.message === "string") {
|
|
288
282
|
if (logItem.message.length <= maxMessageStubLength) {
|
|
289
283
|
result.message = logItem.message;
|
|
290
284
|
}
|
|
@@ -319,16 +313,18 @@ function stringifyLogItem(logItem) {
|
|
|
319
313
|
* Jsonifies Errors properly, not as {} only.
|
|
320
314
|
*/
|
|
321
315
|
function jsonStringifyWithErrors(value) {
|
|
322
|
-
return JSON.stringify(value,
|
|
316
|
+
return JSON.stringify(value, (key, value) => {
|
|
317
|
+
return value instanceof Error ? value.stack : value;
|
|
318
|
+
});
|
|
323
319
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
320
|
+
const logConsoleLog = console.log;
|
|
321
|
+
const errorConsoleLog = console.error;
|
|
322
|
+
const warnConsoleLog = console.warn;
|
|
323
|
+
const infoConsoleLog = console.info;
|
|
324
|
+
const debugConsoleLog = console.debug;
|
|
329
325
|
// according to https://cloud.google.com/logging/quotas#logging_usage_limits, the log item must fit in 100 KB (internal data
|
|
330
326
|
// size; its relation to the stringified JSON's size is unknown), so let's have a sufficient safe margin
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
327
|
+
const maxAllowedLogItemLength = 32 * 1024;
|
|
328
|
+
const maxMessageStubLength = 1024;
|
|
329
|
+
const maxErrorStubLength = 4096;
|
|
334
330
|
//# 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,CAAC,wBAAwB;AAE1F,IAAI,WAAW,GAAY,KAAK,CAAC;AACjC,IAAI,SAA6B,CAAC;AAClC,IAAI,OAA2B,CAAC;AAQhC,IAAiB,UAAU,CAO1B;AAPD,WAAiB,UAAU;IACvB,SAAgB,IAAI,CAAC,MAAsD;;QACvE,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,CAAC;IACN,CAAC;IALe,eAAI,OAKnB,CAAA;AACL,CAAC,EAPgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAO1B;AAMD,IAAiB,GAAG,CA2HnB;AA3HD,WAAiB,GAAG;IAahB,SAAgB,KAAK,CAAC,GAAG,IAAW;QAChC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;IAFe,SAAK,QAEpB,CAAA;IAcD,SAAgB,IAAI,CAAC,GAAG,IAAW;QAC/B,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACzB,CAAC;IAFe,QAAI,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AAM,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.js
CHANGED
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.makeLink = void 0;
|
|
9
9
|
function isOpenNewTab(event) {
|
|
10
|
-
return event.metaKey ||
|
|
10
|
+
return event.metaKey || event.ctrlKey;
|
|
11
11
|
}
|
|
12
12
|
function makeLink(node, url, hover) {
|
|
13
|
-
node.onclick =
|
|
14
|
-
|
|
13
|
+
node.onclick = (event) => {
|
|
14
|
+
let target = "_self";
|
|
15
15
|
if (isOpenNewTab(event)) {
|
|
16
|
-
target =
|
|
16
|
+
target = "_blank";
|
|
17
17
|
}
|
|
18
18
|
window.open(url, target);
|
|
19
19
|
};
|
|
20
|
-
node.style.cursor =
|
|
20
|
+
node.style.cursor = "pointer";
|
|
21
21
|
node.title = hover;
|
|
22
22
|
}
|
|
23
23
|
exports.makeLink = makeLink;
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,KAAK,CAAC,OAAO,CAAC;AAC1C,CAAC;AAED,SAAgB,QAAQ,CAAC,IAAiB,EAAE,GAAW,EAAE,KAAa;IAClE,IAAI,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE;QACrB,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,CAAC;IACF,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACvB,CAAC;AAVD,4BAUC"}
|
|
@@ -5,10 +5,20 @@
|
|
|
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,aAAuB,MAAM,uBAWrE,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,2CAA2C,YAAsB,MAAM,KAAG,OAEtF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,qBAA+B,MAAM,KAAG,OAEhF,CAAC"}
|