@gitpod/gitpod-protocol 0.1.5-wth-test.41 → 0.1.5-wv-add-image-builds-to-dashboard.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/gitpod-schema.json +150 -8
- package/lib/accounting-protocol.d.ts +19 -11
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +35 -33
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +29 -1
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +5 -6
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/attribution.d.ts +24 -0
- package/lib/attribution.d.ts.map +1 -0
- package/lib/attribution.js +54 -0
- package/lib/attribution.js.map +1 -0
- package/lib/auth.d.ts +1 -1
- package/lib/auth.d.ts.map +1 -1
- package/lib/auth.js +1 -1
- package/lib/billing-mode.d.ts +45 -0
- package/lib/billing-mode.d.ts.map +1 -0
- package/lib/billing-mode.js +44 -0
- package/lib/billing-mode.js.map +1 -0
- package/lib/blocked-repositories-protocol.d.ts +13 -0
- package/lib/blocked-repositories-protocol.d.ts.map +1 -0
- package/lib/blocked-repositories-protocol.js +8 -0
- package/lib/blocked-repositories-protocol.js.map +1 -0
- package/lib/context-url.d.ts +19 -7
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +60 -9
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +3 -3
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +20 -12
- package/lib/context-url.spec.js.map +1 -1
- package/lib/encryption/container-module.d.ts +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +2 -2
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +10 -10
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +3 -4
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +2 -2
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +8 -10
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +1 -6
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +2 -21
- package/lib/env.js.map +1 -1
- package/lib/experiments/always-default.d.ts +8 -0
- package/lib/experiments/always-default.d.ts.map +1 -0
- package/lib/experiments/always-default.js +20 -0
- package/lib/experiments/always-default.js.map +1 -0
- package/lib/experiments/configcat-server.d.ts +10 -0
- package/lib/experiments/configcat-server.d.ts.map +1 -0
- package/lib/experiments/configcat-server.js +37 -0
- package/lib/experiments/configcat-server.js.map +1 -0
- package/lib/experiments/configcat.d.ts +21 -0
- package/lib/experiments/configcat.d.ts.map +1 -0
- package/lib/experiments/configcat.js +51 -0
- package/lib/experiments/configcat.js.map +1 -0
- package/lib/experiments/types.d.ts +22 -0
- package/lib/experiments/types.d.ts.map +1 -0
- package/lib/experiments/types.js +10 -0
- package/lib/experiments/types.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +7 -7
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.d.ts +1 -1
- package/lib/gitpod-file-parser.spec.js +43 -40
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +93 -48
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +57 -36
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +2 -1
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +3 -2
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +2 -2
- package/lib/ide-frontend-service.js +1 -1
- package/lib/ide-protocol.d.ts +126 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/ide-protocol.js +18 -0
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +17 -15
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +30 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +31 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- package/lib/license-protocol.d.ts +8 -1
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +1 -1
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +19 -19
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +5 -5
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +10 -7
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +5 -19
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +35 -23
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +11 -2
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +22 -4
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +23 -59
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +1 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +7 -9
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/oss-allowlist.d.ts +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 +1 -1
- package/lib/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +2 -2
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +10 -4
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +35 -26
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +5 -4
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +211 -172
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +192 -99
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +293 -105
- package/lib/protocol.js.map +1 -1
- package/lib/protocol.spec.d.ts +7 -0
- package/lib/protocol.spec.d.ts.map +1 -0
- package/lib/protocol.spec.js +127 -0
- package/lib/protocol.spec.js.map +1 -0
- package/lib/snapshot-url.d.ts +1 -1
- package/lib/snapshot-url.js +1 -1
- package/lib/snapshot-url.spec.d.ts +1 -1
- package/lib/snapshot-url.spec.js +1 -1
- package/lib/snapshot-url.spec.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +23 -4
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +21 -6
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +35 -5
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +9 -2
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +3 -3
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/typings/globals.js +1 -1
- package/lib/usage.d.ts +73 -0
- package/lib/usage.d.ts.map +1 -0
- package/lib/usage.js +20 -0
- package/lib/usage.js.map +1 -0
- package/lib/util/analytics.d.ts +1 -1
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +13 -4
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +4 -4
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +1 -1
- package/lib/util/cancelable.js +1 -1
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +1 -1
- package/lib/util/date-time.js +7 -7
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/debug-app.d.ts +25 -0
- package/lib/util/debug-app.d.ts.map +1 -0
- package/lib/util/debug-app.js +100 -0
- package/lib/util/debug-app.js.map +1 -0
- package/lib/util/deep-partial.d.ts +1 -1
- package/lib/util/deep-partial.js +1 -1
- package/lib/util/deferred.d.ts +1 -1
- package/lib/util/deferred.js +1 -1
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +2 -2
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +5 -3
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +2 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +12 -3
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +6 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +461 -440
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.d.ts +1 -1
- package/lib/util/generate-workspace-id.spec.js +37 -2
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +2 -2
- package/lib/util/gitpod-cookie.d.ts.map +1 -1
- package/lib/util/gitpod-cookie.js +1 -4
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts +6 -2
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +61 -37
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +16 -6
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +21 -1
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js +74 -2
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/jaeger-client-types.d.ts +68 -0
- package/lib/util/jaeger-client-types.d.ts.map +1 -0
- package/lib/{theia-plugins.js → util/jaeger-client-types.js} +2 -2
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +2 -2
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +32 -26
- package/lib/util/logging.js.map +1 -1
- package/lib/util/logging.spec.d.ts +7 -0
- package/lib/util/logging.spec.d.ts.map +1 -0
- package/lib/util/logging.spec.js +52 -0
- package/lib/util/logging.spec.js.map +1 -0
- package/lib/util/make-link.d.ts +1 -1
- package/lib/util/make-link.js +6 -6
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/nice-grpc.d.ts +9 -0
- package/lib/util/nice-grpc.d.ts.map +1 -0
- package/lib/util/nice-grpc.js +121 -0
- package/lib/util/nice-grpc.js.map +1 -0
- package/lib/util/parse-workspace-id.d.ts +1 -1
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +3 -4
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +1 -1
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +1 -1
- package/lib/util/queue.js +1 -1
- package/lib/util/queue.spec.d.ts +1 -1
- package/lib/util/queue.spec.js +10 -7
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeat.d.ts +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 +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +1 -1
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +1 -1
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +3 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +16 -4
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +3 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +35 -1
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +53 -7
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +157 -20
- 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 +8 -8
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +9 -12
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/webhook-event.d.ts +44 -0
- package/lib/webhook-event.d.ts.map +1 -0
- package/lib/webhook-event.js +8 -0
- package/lib/webhook-event.js.map +1 -0
- package/lib/workspace-class.d.ts +14 -0
- package/lib/workspace-class.d.ts.map +1 -0
- package/lib/workspace-class.js +8 -0
- package/lib/workspace-class.js.map +1 -0
- package/lib/workspace-cluster.d.ts +19 -18
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +17 -2
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +41 -4
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +1 -1
- package/lib/wsready.d.ts +8 -2
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +3 -3
- package/package.json +18 -8
- package/pkg-yarn.lock +11 -6
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +67 -52
- package/src/admin-protocol.ts +59 -19
- package/src/analytics.ts +27 -29
- package/src/attribution.ts +63 -0
- package/src/auth.ts +3 -3
- package/src/billing-mode.ts +84 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +25 -15
- package/src/context-url.ts +93 -37
- package/src/encryption/container-module.ts +3 -4
- package/src/encryption/encryption-engine.spec.ts +10 -9
- package/src/encryption/encryption-engine.ts +21 -17
- package/src/encryption/encryption-service.ts +5 -6
- package/src/encryption/key-provider.ts +17 -20
- package/src/env.ts +2 -25
- package/src/experiments/always-default.ts +24 -0
- package/src/experiments/configcat-server.ts +42 -0
- package/src/experiments/configcat.ts +56 -0
- package/src/experiments/types.ts +34 -0
- package/src/gitpod-file-parser.spec.ts +56 -62
- package/src/gitpod-file-parser.ts +17 -18
- package/src/gitpod-service.ts +241 -134
- package/src/headless-workspace-log.ts +7 -5
- package/src/ide-frontend-service.ts +3 -3
- package/src/ide-protocol.ts +147 -0
- package/src/index.ts +17 -15
- package/src/installation-admin-protocol.ts +45 -0
- package/src/license-protocol.ts +13 -7
- package/src/messaging/browser/connection.ts +45 -47
- package/src/messaging/browser/window-connection.ts +40 -30
- package/src/messaging/client-call-metrics.ts +79 -82
- package/src/messaging/error.ts +33 -8
- package/src/messaging/handler.ts +6 -6
- package/src/messaging/node/connection.ts +23 -70
- package/src/messaging/proxy-factory.ts +23 -30
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +3 -3
- package/src/permission.ts +41 -33
- package/src/plans.ts +241 -190
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +557 -297
- package/src/snapshot-url.spec.ts +10 -8
- package/src/snapshot-url.ts +1 -1
- package/src/team-subscription-protocol.ts +60 -23
- package/src/teams-projects-protocol.ts +51 -12
- package/src/typings/globals.ts +5 -5
- package/src/usage.ts +85 -0
- package/src/util/analytics.ts +47 -25
- package/src/util/async-iterator.ts +5 -6
- package/src/util/cancelable.ts +4 -4
- package/src/util/date-time.ts +9 -9
- package/src/util/debug-app.ts +81 -0
- package/src/util/deep-partial.ts +1 -1
- package/src/util/deferred.ts +7 -7
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +15 -7
- package/src/util/generate-workspace-id.spec.ts +35 -8
- package/src/util/generate-workspace-id.ts +465 -441
- package/src/util/gitpod-cookie.ts +9 -10
- package/src/util/gitpod-host-url.spec.ts +41 -14
- package/src/util/gitpod-host-url.ts +70 -42
- package/src/util/grpc.ts +94 -2
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.spec.ts +23 -0
- package/src/util/logging.ts +61 -43
- package/src/util/make-link.ts +7 -8
- package/src/util/nice-grpc.ts +96 -0
- package/src/util/parse-workspace-id.spec.ts +18 -9
- package/src/util/parse-workspace-id.ts +7 -8
- package/src/util/queue.spec.ts +28 -26
- package/src/util/queue.ts +1 -1
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +5 -7
- package/src/util/skip-if.ts +10 -7
- package/src/util/timeutil.spec.ts +41 -15
- package/src/util/timeutil.ts +28 -12
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +201 -32
- package/src/util/workspace-port-authentication.ts +11 -14
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +35 -21
- package/src/workspace-instance.ts +83 -21
- package/src/wsready.ts +11 -4
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/email-protocol.d.ts +0 -49
- package/lib/email-protocol.d.ts.map +0 -1
- package/lib/email-protocol.js +0 -28
- package/lib/email-protocol.js.map +0 -1
- package/lib/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 -34
- 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 -65
- 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 -31
- package/lib/util/safe-promise.js.map +0 -1
- package/src/email-protocol.ts +0 -66
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/theia-plugins.ts +0 -11
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as http from "http";
|
|
8
|
+
import * as express from "express";
|
|
9
|
+
import { injectable, postConstruct } from "inversify";
|
|
10
|
+
import { log, LogrusLogLevel } from "./logging";
|
|
11
|
+
|
|
12
|
+
export interface SetLogLevelRequest {
|
|
13
|
+
level: LogrusLogLevel;
|
|
14
|
+
}
|
|
15
|
+
export namespace SetLogLevelRequest {
|
|
16
|
+
export function is(o: any): o is SetLogLevelRequest {
|
|
17
|
+
return typeof o === "object" && "level" in o;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
export class DebugApp {
|
|
23
|
+
protected _app: express.Application;
|
|
24
|
+
protected httpServer: http.Server | undefined = undefined;
|
|
25
|
+
|
|
26
|
+
@postConstruct()
|
|
27
|
+
public ctor() {
|
|
28
|
+
this._app = this.create();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
create(): express.Application {
|
|
32
|
+
const app = express();
|
|
33
|
+
|
|
34
|
+
app.use(express.json());
|
|
35
|
+
app.use(express.urlencoded({ extended: true }));
|
|
36
|
+
|
|
37
|
+
app.post("/debug/logging", (req, res) => {
|
|
38
|
+
try {
|
|
39
|
+
const levelRequest = req.body;
|
|
40
|
+
if (!SetLogLevelRequest.is(levelRequest)) {
|
|
41
|
+
res.status(400).end("not a SetLogLevelRequest");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const newLogLevel = levelRequest.level;
|
|
46
|
+
log.setLogLevel(newLogLevel);
|
|
47
|
+
log.info("set log level", { newLogLevel });
|
|
48
|
+
res.status(200).end(JSON.stringify(levelRequest));
|
|
49
|
+
} catch (err) {
|
|
50
|
+
res.status(500).end(err);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return app;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public start(port: number = 6060) {
|
|
57
|
+
this.httpServer = this._app.listen(port, "localhost", () => {
|
|
58
|
+
log.info(`debug server listening on port: ${port}`);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public async stop() {
|
|
63
|
+
const server = this.httpServer;
|
|
64
|
+
if (!server) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
return new Promise<void>((resolve) =>
|
|
68
|
+
server.close((err: any) => {
|
|
69
|
+
if (err) {
|
|
70
|
+
log.warn(`error while closing http server`, { err });
|
|
71
|
+
}
|
|
72
|
+
this.httpServer = undefined;
|
|
73
|
+
resolve();
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public get app(): express.Application {
|
|
79
|
+
return this._app;
|
|
80
|
+
}
|
|
81
|
+
}
|
package/src/util/deep-partial.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
package/src/util/deferred.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export class Deferred<T> {
|
|
@@ -19,12 +19,12 @@ export class Deferred<T> {
|
|
|
19
19
|
promise = new Promise<T>((resolve, reject) => {
|
|
20
20
|
this.resolve = (o) => {
|
|
21
21
|
this.isResolved = true;
|
|
22
|
-
resolve(o as any)
|
|
23
|
-
clearTimeout(this.timer)
|
|
22
|
+
resolve(o as any);
|
|
23
|
+
clearTimeout(this.timer);
|
|
24
24
|
};
|
|
25
25
|
this.reject = (e) => {
|
|
26
|
-
reject(e)
|
|
27
|
-
clearTimeout(this.timer)
|
|
28
|
-
}
|
|
26
|
+
reject(e);
|
|
27
|
+
clearTimeout(this.timer);
|
|
28
|
+
};
|
|
29
29
|
});
|
|
30
|
-
}
|
|
30
|
+
}
|
package/src/util/disposable.ts
CHANGED
|
@@ -16,10 +16,10 @@ export interface Disposable {
|
|
|
16
16
|
export namespace Disposable {
|
|
17
17
|
export function create(func: () => void): Disposable {
|
|
18
18
|
return {
|
|
19
|
-
dispose: func
|
|
19
|
+
dispose: func,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
export const NULL = create(() => {
|
|
22
|
+
export const NULL = create(() => {});
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export class DisposableCollection implements Disposable {
|
|
@@ -69,9 +69,6 @@ export class DisposableCollection implements Disposable {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
pushAll(disposables: Disposable[]): Disposable[] {
|
|
72
|
-
return disposables.map(disposable =>
|
|
73
|
-
this.push(disposable)
|
|
74
|
-
);
|
|
72
|
+
return disposables.map((disposable) => this.push(disposable));
|
|
75
73
|
}
|
|
76
|
-
|
|
77
74
|
}
|
package/src/util/event.ts
CHANGED
|
@@ -6,13 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { Disposable } from "./disposable";
|
|
9
|
-
import { log } from
|
|
9
|
+
import { log } from "./logging";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Represents a typed event.
|
|
13
13
|
*/
|
|
14
14
|
export interface Event<T> {
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
*
|
|
18
17
|
* @param listener The listener function will be call when the event happens.
|
|
@@ -24,12 +23,13 @@ export interface Event<T> {
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
export namespace Event {
|
|
27
|
-
const _disposable = { dispose() {
|
|
28
|
-
export const None: Event<any> = function () {
|
|
26
|
+
const _disposable = { dispose() {} };
|
|
27
|
+
export const None: Event<any> = function () {
|
|
28
|
+
return _disposable;
|
|
29
|
+
};
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
class CallbackList {
|
|
32
|
-
|
|
33
33
|
private _callbacks: Function[] | undefined;
|
|
34
34
|
private _contexts: any[] | undefined;
|
|
35
35
|
|
|
@@ -66,7 +66,7 @@ class CallbackList {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
if (foundCallbackWithDifferentContext) {
|
|
69
|
-
throw new Error(
|
|
69
|
+
throw new Error("When adding a listener with a context, you should remove it with the same context");
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -105,14 +105,12 @@ export interface EmitterOptions {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
export class Emitter<T> {
|
|
108
|
-
|
|
109
|
-
private static _noop = function () { };
|
|
108
|
+
private static _noop = function () {};
|
|
110
109
|
|
|
111
110
|
private _event: Event<T>;
|
|
112
111
|
private _callbacks: CallbackList | undefined;
|
|
113
112
|
|
|
114
|
-
constructor(private _options?: EmitterOptions) {
|
|
115
|
-
}
|
|
113
|
+
constructor(private _options?: EmitterOptions) {}
|
|
116
114
|
|
|
117
115
|
/**
|
|
118
116
|
* For the public to allow to subscribe
|
|
@@ -137,7 +135,7 @@ export class Emitter<T> {
|
|
|
137
135
|
if (this._options && this._options.onLastListenerRemove && this._callbacks!.isEmpty()) {
|
|
138
136
|
this._options.onLastListenerRemove(this);
|
|
139
137
|
}
|
|
140
|
-
}
|
|
138
|
+
},
|
|
141
139
|
};
|
|
142
140
|
if (Array.isArray(disposables)) {
|
|
143
141
|
disposables.push(result);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { repeat } from "./repeat";
|
|
7
8
|
|
|
8
9
|
interface CacheEntry<T> {
|
|
9
10
|
key: string;
|
|
@@ -14,9 +15,7 @@ interface CacheEntry<T> {
|
|
|
14
15
|
export class GarbageCollectedCache<T> {
|
|
15
16
|
protected readonly store = new Map<string, CacheEntry<T>>();
|
|
16
17
|
|
|
17
|
-
constructor(
|
|
18
|
-
protected readonly defaultMaxAgeSeconds: number,
|
|
19
|
-
protected readonly gcIntervalSeconds: number) {
|
|
18
|
+
constructor(protected readonly defaultMaxAgeSeconds: number, protected readonly gcIntervalSeconds: number) {
|
|
20
19
|
this.regularlyCollectGarbage();
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -38,11 +37,20 @@ export class GarbageCollectedCache<T> {
|
|
|
38
37
|
if (!entry) {
|
|
39
38
|
return undefined;
|
|
40
39
|
}
|
|
40
|
+
// Still valid?
|
|
41
|
+
if (entry.expiryDate < Date.now()) {
|
|
42
|
+
this.store.delete(entry.key);
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
41
45
|
return entry.value;
|
|
42
46
|
}
|
|
43
47
|
|
|
48
|
+
public delete(key: string) {
|
|
49
|
+
this.store.delete(key);
|
|
50
|
+
}
|
|
51
|
+
|
|
44
52
|
protected regularlyCollectGarbage() {
|
|
45
|
-
|
|
53
|
+
repeat(() => this.collectGarbage(), this.gcIntervalSeconds * 1000);
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
protected collectGarbage() {
|
|
@@ -55,6 +63,6 @@ export class GarbageCollectedCache<T> {
|
|
|
55
63
|
}
|
|
56
64
|
|
|
57
65
|
protected calcExpiryDate(maxAgeSeconds?: number): number {
|
|
58
|
-
return Date.now() + (
|
|
66
|
+
return Date.now() + (maxAgeSeconds || this.defaultMaxAgeSeconds) * 1000;
|
|
59
67
|
}
|
|
60
|
-
}
|
|
68
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { suite, test } from "mocha-typescript"
|
|
8
|
-
import * as chai from "chai"
|
|
7
|
+
import { suite, test } from "mocha-typescript";
|
|
8
|
+
import * as chai from "chai";
|
|
9
9
|
import { generateWorkspaceID, colors, animals } from "./generate-workspace-id";
|
|
10
10
|
import { GitpodHostUrl } from "./gitpod-host-url";
|
|
11
11
|
|
|
12
|
-
const expect = chai.expect
|
|
13
|
-
|
|
14
|
-
@suite class TestGenerateWorkspaceId {
|
|
12
|
+
const expect = chai.expect;
|
|
15
13
|
|
|
14
|
+
@suite
|
|
15
|
+
class TestGenerateWorkspaceId {
|
|
16
16
|
@test public async testGenerateWorkspaceId() {
|
|
17
|
-
for (let i = 0; i <
|
|
17
|
+
for (let i = 0; i < 10; i++) {
|
|
18
18
|
const id = await generateWorkspaceID();
|
|
19
19
|
expect(new GitpodHostUrl().withWorkspacePrefix(id, "eu").workspaceId).to.equal(id);
|
|
20
20
|
}
|
|
@@ -27,5 +27,32 @@ const expect = chai.expect
|
|
|
27
27
|
expect(longestName.length <= 36, `"${longestName}" is longer than 36 chars (${longestName.length})`).to.be.true;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
@test public async testCustomName() {
|
|
31
|
+
const data = [
|
|
32
|
+
["foo", "bar", "foo-bar-"],
|
|
33
|
+
["f", "bar", ".{2,16}-bar-"],
|
|
34
|
+
["gitpod-io", "gitpod", "gitpodio-gitpod-"],
|
|
35
|
+
["breatheco-de", "python-flask-api-tutorial", "breathecode-pythonflask-"],
|
|
36
|
+
["short", "muchlongerthaneleven", "short-muchlongerthanel-"],
|
|
37
|
+
["muchlongerthaneleven", "short", "muchlongerthanel-short-"],
|
|
38
|
+
[
|
|
39
|
+
'this is rather long and has some "§$"% special chars',
|
|
40
|
+
"also here pretty long and needs abbreviation",
|
|
41
|
+
"thisisrathe-alsoherepre-",
|
|
42
|
+
],
|
|
43
|
+
["UPPER", "CaSe", "upper-case-"],
|
|
44
|
+
[
|
|
45
|
+
"superlongfirstsegment",
|
|
46
|
+
"---------",
|
|
47
|
+
"superlong" /* we don't mantch for the whole first segment, because it has different length depending on the animal that is used to replace the -------*/,
|
|
48
|
+
],
|
|
49
|
+
];
|
|
50
|
+
for (const d of data) {
|
|
51
|
+
const id = await generateWorkspaceID(d[0], d[1]);
|
|
52
|
+
expect(id).match(new RegExp("^" + d[2]));
|
|
53
|
+
expect(new GitpodHostUrl().withWorkspacePrefix(id, "eu").workspaceId).to.equal(id);
|
|
54
|
+
expect(id.length <= 36, `"${id}" is longer than 36 chars (${id.length})`).to.be.true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
30
57
|
}
|
|
31
|
-
module.exports = new TestGenerateWorkspaceId()
|
|
58
|
+
module.exports = new TestGenerateWorkspaceId();
|