@gitpod/gitpod-protocol 0.1.5-update-ovsx.0 → 0.1.5-update-yarnlock.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 +159 -25
- package/lib/accounting-protocol.d.ts +165 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +120 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +51 -6
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +17 -2
- 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/attribution.d.ts +25 -0
- package/lib/attribution.d.ts.map +1 -0
- package/lib/attribution.js +58 -0
- package/lib/attribution.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/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 +30 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +100 -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 +81 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/encryption/container-module.d.ts +2 -2
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +8 -6
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +2 -2
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +28 -28
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +3 -3
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +32 -39
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +2 -2
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +33 -46
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +3 -3
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +34 -40
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +2 -8
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +10 -29
- 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/frontend-dashboard-service.d.ts +99 -0
- package/lib/frontend-dashboard-service.d.ts.map +1 -0
- package/lib/frontend-dashboard-service.js +55 -0
- package/lib/frontend-dashboard-service.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts +2 -2
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +29 -44
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.d.ts +2 -2
- package/lib/gitpod-file-parser.spec.js +147 -144
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +290 -50
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +288 -123
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +11 -13
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +8 -9
- 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 +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 +18 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +28 -13
- 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 +9 -2
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js +3 -2
- 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 +9 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +48 -59
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +21 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +95 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/error.d.ts +18 -4
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +38 -7
- 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 +2 -1
- package/lib/messaging/handler.js.map +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 -59
- 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 +76 -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 +26 -15
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +50 -36
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +213 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +625 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +338 -111
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +422 -201
- 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 +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/lib/snapshot-url.spec.d.ts +7 -0
- 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 +93 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +82 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +136 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +41 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/typings/globals.d.ts +8 -3
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/typings/globals.js +2 -2
- 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 +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 +2 -2
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +60 -137
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +2 -2
- package/lib/util/cancelable.js +20 -61
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +2 -2
- package/lib/util/date-time.js +14 -13
- 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 +2 -2
- package/lib/util/deep-partial.js +2 -2
- package/lib/util/deferred.d.ts +2 -2
- package/lib/util/deferred.js +13 -14
- 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 +28 -40
- 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 +64 -77
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +3 -2
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +35 -49
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +9 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.js +491 -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 +98 -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 +20 -8
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +143 -85
- 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 +134 -0
- package/lib/util/gitpod-host-url.spec.js.map +1 -0
- package/lib/util/grpc.d.ts +35 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +90 -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/util/jaeger-client-types.js +8 -0
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +58 -35
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +144 -129
- 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 +2 -2
- package/lib/util/make-link.js +8 -7
- 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 +15 -5
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +39 -9
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +10 -2
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +130 -49
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +2 -2
- package/lib/util/queue.js +19 -57
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.d.ts +2 -2
- package/lib/util/queue.spec.js +149 -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 +2 -2
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +18 -48
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +2 -2
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +9 -8
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +4 -2
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +43 -18
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +4 -2
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +57 -25
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +55 -8
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +210 -66
- 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 +9 -9
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +13 -14
- 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 +80 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +36 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +51 -8
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +2 -2
- package/lib/wsready.d.ts +8 -2
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +4 -3
- package/lib/wsready.js.map +1 -1
- package/package.json +42 -18
- package/pkg-yarn.lock +24 -10
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +253 -0
- package/src/admin-protocol.ts +96 -21
- package/src/analytics.ts +52 -0
- package/src/attribution.ts +67 -0
- package/src/auth.ts +27 -0
- package/src/billing-mode.ts +84 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +49 -0
- package/src/context-url.ts +107 -0
- package/src/encryption/container-module.ts +4 -5
- package/src/encryption/encryption-engine.spec.ts +11 -10
- package/src/encryption/encryption-engine.ts +22 -18
- package/src/encryption/encryption-service.ts +6 -7
- package/src/encryption/key-provider.ts +18 -21
- package/src/env.ts +3 -26
- 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/frontend-dashboard-service.ts +148 -0
- package/src/gitpod-file-parser.spec.ts +57 -63
- package/src/gitpod-file-parser.ts +18 -19
- package/src/gitpod-service.ts +602 -99
- package/src/headless-workspace-log.ts +14 -16
- package/src/ide-frontend-service.ts +28 -0
- package/src/ide-protocol.ts +147 -0
- package/src/index.ts +18 -12
- package/src/installation-admin-protocol.ts +45 -0
- package/src/license-protocol.ts +14 -8
- package/src/messaging/browser/connection.ts +202 -26
- package/src/messaging/browser/window-connection.ts +45 -29
- package/src/messaging/client-call-metrics.ts +94 -0
- package/src/messaging/error.ts +51 -10
- 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 +53 -40
- package/src/plans.ts +699 -0
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +790 -302
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +153 -0
- package/src/teams-projects-protocol.ts +180 -0
- package/src/typings/globals.ts +13 -5
- package/src/usage.ts +85 -0
- package/src/util/analytics.ts +109 -0
- package/src/util/async-iterator.ts +6 -7
- package/src/util/cancelable.ts +5 -5
- package/src/util/date-time.ts +10 -10
- package/src/util/debug-app.ts +81 -0
- package/src/util/deep-partial.ts +2 -2
- package/src/util/deferred.ts +8 -8
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +18 -10
- package/src/util/generate-workspace-id.spec.ts +58 -0
- package/src/util/generate-workspace-id.ts +481 -0
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +76 -0
- package/src/util/gitpod-host-url.ts +119 -40
- package/src/util/grpc.ts +107 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.spec.ts +23 -0
- package/src/util/logging.ts +163 -73
- package/src/util/make-link.ts +8 -9
- package/src/util/nice-grpc.ts +96 -0
- package/src/util/parse-workspace-id.spec.ts +62 -12
- package/src/util/parse-workspace-id.ts +40 -10
- package/src/util/queue.spec.ts +30 -28
- package/src/util/queue.ts +2 -2
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +8 -10
- package/src/util/skip-if.ts +12 -9
- package/src/util/timeutil.spec.ts +42 -16
- package/src/util/timeutil.ts +33 -17
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +211 -33
- package/src/util/workspace-port-authentication.ts +12 -15
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +121 -0
- package/src/workspace-instance.ts +120 -36
- package/src/wsready.ts +11 -4
- package/data/builtin-theia-plugins.json +0 -362
- package/lib/email-protocol.d.ts +0 -49
- package/lib/email-protocol.d.ts.map +0 -1
- package/lib/email-protocol.js +0 -27
- 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 -45
- 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 +0 -8
- 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 -117
- 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 -33
- 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 +0 -8
- package/lib/util/without.js.map +0 -1
- package/src/email-protocol.ts +0 -67
- 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
- package/src/util/without.ts +0 -8
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020 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 { suite, test } from "mocha-typescript";
|
|
8
|
+
import * as chai from "chai";
|
|
9
|
+
import { SnapshotUrl } from ".";
|
|
10
|
+
|
|
11
|
+
const expect = chai.expect;
|
|
12
|
+
|
|
13
|
+
@suite
|
|
14
|
+
class TestSnapshotUrlParser {
|
|
15
|
+
@test public testPositive() {
|
|
16
|
+
const actual = SnapshotUrl.parse(
|
|
17
|
+
"workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar@gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd",
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
expect(actual).to.deep.equal(<SnapshotUrl>{
|
|
21
|
+
bucketId: "gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd",
|
|
22
|
+
filename: "3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
|
|
23
|
+
fullPath: "workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
module.exports = new TestSnapshotUrlParser(); // Only to circumvent no usage warning :-/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface SnapshotUrl {
|
|
8
|
+
bucketId: string;
|
|
9
|
+
fullPath: string;
|
|
10
|
+
filename: string;
|
|
11
|
+
}
|
|
12
|
+
export namespace SnapshotUrl {
|
|
13
|
+
export function parse(url: string): SnapshotUrl {
|
|
14
|
+
const parts = url.split("@");
|
|
15
|
+
if (parts.length !== 2) {
|
|
16
|
+
throw new Error(`cannot parse snapshot URL: ${url}`);
|
|
17
|
+
}
|
|
18
|
+
const [fullPath, bucketId] = parts;
|
|
19
|
+
|
|
20
|
+
const pathParts = fullPath.split("/");
|
|
21
|
+
if (pathParts.length < 1) {
|
|
22
|
+
throw new Error(`cannot parse snapshot URL: ${url}`);
|
|
23
|
+
}
|
|
24
|
+
const filename = pathParts[pathParts.length - 1];
|
|
25
|
+
return { bucketId, fullPath, filename };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
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 { v4 as uuidv4 } from "uuid";
|
|
8
|
+
import { Subscription } from "./accounting-protocol";
|
|
9
|
+
|
|
10
|
+
export interface TeamSubscription {
|
|
11
|
+
id: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
planId: string;
|
|
14
|
+
startDate: string;
|
|
15
|
+
endDate?: string;
|
|
16
|
+
quantity: number;
|
|
17
|
+
/** The Chargebee subscription id */
|
|
18
|
+
paymentReference: string;
|
|
19
|
+
cancellationDate?: string;
|
|
20
|
+
deleted?: boolean;
|
|
21
|
+
/** If this flag is set slots are not eligibile for clusters with "more-resources" - even if their plan might be */
|
|
22
|
+
excludeFromMoreResources: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export namespace TeamSubscription {
|
|
26
|
+
export const create = (ts: Omit<TeamSubscription, "id">): TeamSubscription => {
|
|
27
|
+
const withId = ts as TeamSubscription;
|
|
28
|
+
withId.id = uuidv4();
|
|
29
|
+
return withId;
|
|
30
|
+
};
|
|
31
|
+
export const isActive = (ts: TeamSubscription, date: string): boolean => {
|
|
32
|
+
return ts.startDate <= date && (ts.endDate === undefined || date < ts.endDate);
|
|
33
|
+
};
|
|
34
|
+
export function isCancelled(s: TeamSubscription, date: string): boolean {
|
|
35
|
+
return (!!s.cancellationDate && s.cancellationDate < date) || (!!s.endDate && s.endDate < date); // This edge case is meant to handle bad data: If for whatever reason cancellationDate has not been set: treat endDate as such
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface TeamSubscription2 {
|
|
40
|
+
id: string;
|
|
41
|
+
teamId: string;
|
|
42
|
+
planId: string;
|
|
43
|
+
startDate: string;
|
|
44
|
+
endDate?: string;
|
|
45
|
+
quantity: number;
|
|
46
|
+
/** The Chargebee subscription id */
|
|
47
|
+
paymentReference: string;
|
|
48
|
+
cancellationDate?: string;
|
|
49
|
+
excludeFromMoreResources: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export namespace TeamSubscription2 {
|
|
53
|
+
export const create = (ts2: Omit<TeamSubscription2, "id">): TeamSubscription2 => {
|
|
54
|
+
const withId = ts2 as TeamSubscription2;
|
|
55
|
+
withId.id = uuidv4();
|
|
56
|
+
return withId;
|
|
57
|
+
};
|
|
58
|
+
export const isActive = (ts2: TeamSubscription2, date: string): boolean => {
|
|
59
|
+
return ts2.startDate <= date && (ts2.endDate === undefined || date < ts2.endDate);
|
|
60
|
+
};
|
|
61
|
+
export function isCancelled(s: TeamSubscription2, date: string): boolean {
|
|
62
|
+
return (!!s.cancellationDate && s.cancellationDate < date) || (!!s.endDate && s.endDate < date); // This edge case is meant to handle bad data: If for whatever reason cancellationDate has not been set: treat endDate as such
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A slot represents one unit of a TeamSubscription that gets assigned to one user at a time
|
|
68
|
+
*/
|
|
69
|
+
export interface TeamSubscriptionSlot {
|
|
70
|
+
id: string;
|
|
71
|
+
teamSubscriptionId: string;
|
|
72
|
+
assigneeId?: string;
|
|
73
|
+
assigneeIdentifier?: AssigneeIdentifier;
|
|
74
|
+
subscriptionId?: string;
|
|
75
|
+
cancellationDate?: string;
|
|
76
|
+
}
|
|
77
|
+
export type TeamSubscriptionSlotDeactivated = TeamSubscriptionSlot & {
|
|
78
|
+
assigneeId: string;
|
|
79
|
+
assigneeIdentifier: AssigneeIdentifier;
|
|
80
|
+
};
|
|
81
|
+
export type TeamSubscriptionSlotAssigned = TeamSubscriptionSlot &
|
|
82
|
+
TeamSubscriptionSlotDeactivated & { subscriptionId: string };
|
|
83
|
+
|
|
84
|
+
export type TeamSubscriptionSlotState = "unassigned" | "assigned" | "deactivated" | "cancelled";
|
|
85
|
+
|
|
86
|
+
export namespace TeamSubscriptionSlot {
|
|
87
|
+
export const create = (ts: Omit<TeamSubscriptionSlot, "id">): TeamSubscriptionSlot => {
|
|
88
|
+
const withId = ts as TeamSubscriptionSlot;
|
|
89
|
+
withId.id = uuidv4();
|
|
90
|
+
return withId;
|
|
91
|
+
};
|
|
92
|
+
export const assign = (
|
|
93
|
+
slot: TeamSubscriptionSlot,
|
|
94
|
+
assigneeId: string,
|
|
95
|
+
subscriptionId: string,
|
|
96
|
+
assigneeIdentifier: AssigneeIdentifier,
|
|
97
|
+
) => {
|
|
98
|
+
slot.assigneeId = assigneeId;
|
|
99
|
+
slot.subscriptionId = subscriptionId;
|
|
100
|
+
slot.assigneeIdentifier = assigneeIdentifier;
|
|
101
|
+
};
|
|
102
|
+
export const deactivate = (slot: TeamSubscriptionSlot, cancellationDate: string) => {
|
|
103
|
+
slot.subscriptionId = undefined;
|
|
104
|
+
slot.cancellationDate = cancellationDate;
|
|
105
|
+
};
|
|
106
|
+
export const reactivate = (slot: TeamSubscriptionSlot, subscriptionId?: string) => {
|
|
107
|
+
slot.subscriptionId = subscriptionId;
|
|
108
|
+
slot.cancellationDate = undefined;
|
|
109
|
+
};
|
|
110
|
+
export const status = (slot: TeamSubscriptionSlot, now: string): TeamSubscriptionSlotState => {
|
|
111
|
+
if (slot.cancellationDate) {
|
|
112
|
+
if (slot.cancellationDate < now) {
|
|
113
|
+
return "cancelled";
|
|
114
|
+
} else {
|
|
115
|
+
return "deactivated";
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
if (slot.subscriptionId) {
|
|
119
|
+
return "assigned";
|
|
120
|
+
} else {
|
|
121
|
+
return "unassigned";
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
export const isActive = (slot: TeamSubscriptionSlot): boolean => {
|
|
126
|
+
return !slot.cancellationDate;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The mapping between a TeamSubscription and a resulting Subscription, resolved
|
|
132
|
+
*/
|
|
133
|
+
export interface TeamSubscriptionSlotResolved {
|
|
134
|
+
id: string;
|
|
135
|
+
teamSubscription: TeamSubscription;
|
|
136
|
+
state: TeamSubscriptionSlotState;
|
|
137
|
+
assigneeId?: string;
|
|
138
|
+
assigneeIdentifier?: AssigneeIdentifier;
|
|
139
|
+
subscription?: Subscription;
|
|
140
|
+
cancellationDate?: string;
|
|
141
|
+
hoursLeft?: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Contains the data structure that the assigner used to identify the assignee.
|
|
146
|
+
*/
|
|
147
|
+
export type AssigneeIdentifier = AssigneeIdentityIdentifier;
|
|
148
|
+
export interface AssigneeIdentityIdentifier {
|
|
149
|
+
identity: {
|
|
150
|
+
authHost: string;
|
|
151
|
+
authName: string;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
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 { PrebuiltWorkspaceState, WorkspaceClasses } from "./protocol";
|
|
8
|
+
import { v4 as uuidv4 } from "uuid";
|
|
9
|
+
import { DeepPartial } from "./util/deep-partial";
|
|
10
|
+
import { WebhookEvent } from "./webhook-event";
|
|
11
|
+
|
|
12
|
+
export interface ProjectConfig {
|
|
13
|
+
".gitpod.yml": string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ProjectSettings {
|
|
17
|
+
useIncrementalPrebuilds?: boolean;
|
|
18
|
+
keepOutdatedPrebuildsRunning?: boolean;
|
|
19
|
+
// whether new workspaces can start on older prebuilds and incrementally update
|
|
20
|
+
allowUsingPreviousPrebuilds?: boolean;
|
|
21
|
+
// how many commits in the commit history a prebuild is good (undefined and 0 means every commit is prebuilt)
|
|
22
|
+
prebuildEveryNthCommit?: number;
|
|
23
|
+
// preferred workspace classes
|
|
24
|
+
workspaceClasses?: WorkspaceClasses;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Project {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
slug?: string;
|
|
31
|
+
cloneUrl: string;
|
|
32
|
+
teamId?: string;
|
|
33
|
+
userId?: string;
|
|
34
|
+
appInstallationId: string;
|
|
35
|
+
settings?: ProjectSettings;
|
|
36
|
+
creationTime: string;
|
|
37
|
+
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
38
|
+
deleted?: boolean;
|
|
39
|
+
markedDeleted?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export namespace Project {
|
|
43
|
+
export const create = (project: Omit<Project, "id" | "creationTime">): Project => {
|
|
44
|
+
return {
|
|
45
|
+
...project,
|
|
46
|
+
id: uuidv4(),
|
|
47
|
+
creationTime: new Date().toISOString(),
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export function slug(p: Project): string {
|
|
52
|
+
return p.slug || p.name || p.id;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface Overview {
|
|
56
|
+
branches: BranchDetails[];
|
|
57
|
+
isConsideredInactive?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export namespace Overview {
|
|
61
|
+
export function is(data?: any): data is Project.Overview {
|
|
62
|
+
return Array.isArray(data?.branches);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface BranchDetails {
|
|
67
|
+
name: string;
|
|
68
|
+
url: string;
|
|
69
|
+
isDefault: boolean;
|
|
70
|
+
|
|
71
|
+
// Latest commit
|
|
72
|
+
changeTitle: string;
|
|
73
|
+
changeDate?: string;
|
|
74
|
+
changeAuthor?: string;
|
|
75
|
+
changeAuthorAvatar?: string;
|
|
76
|
+
changePR?: string;
|
|
77
|
+
changeUrl?: string;
|
|
78
|
+
changeHash: string;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type PartialProject = DeepPartial<Project> & Pick<Project, "id">;
|
|
83
|
+
|
|
84
|
+
export interface ProjectUsage {
|
|
85
|
+
lastWebhookReceived: string;
|
|
86
|
+
lastWorkspaceStart: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface PrebuildWithStatus {
|
|
90
|
+
info: PrebuildInfo;
|
|
91
|
+
status: PrebuiltWorkspaceState;
|
|
92
|
+
error?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface PrebuildInfo {
|
|
96
|
+
id: string;
|
|
97
|
+
buildWorkspaceId: string;
|
|
98
|
+
basedOnPrebuildId?: string;
|
|
99
|
+
|
|
100
|
+
teamId?: string;
|
|
101
|
+
userId?: string;
|
|
102
|
+
|
|
103
|
+
projectId: string;
|
|
104
|
+
projectName: string;
|
|
105
|
+
|
|
106
|
+
cloneUrl: string;
|
|
107
|
+
branch: string;
|
|
108
|
+
|
|
109
|
+
startedAt: string;
|
|
110
|
+
startedBy: string;
|
|
111
|
+
startedByAvatar?: string;
|
|
112
|
+
|
|
113
|
+
changeTitle: string;
|
|
114
|
+
changeDate: string;
|
|
115
|
+
changeAuthor: string;
|
|
116
|
+
changeAuthorAvatar?: string;
|
|
117
|
+
changePR?: string;
|
|
118
|
+
changeUrl?: string;
|
|
119
|
+
changeHash: string;
|
|
120
|
+
}
|
|
121
|
+
export namespace PrebuildInfo {
|
|
122
|
+
export function is(data?: any): data is PrebuildInfo {
|
|
123
|
+
return typeof data === "object" && ["id", "buildWorkspaceId", "projectId", "branch"].every((p) => p in data);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface StartPrebuildResult {
|
|
128
|
+
prebuildId: string;
|
|
129
|
+
wsid: string;
|
|
130
|
+
done: boolean;
|
|
131
|
+
}
|
|
132
|
+
export interface Team {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
creationTime: string;
|
|
136
|
+
markedDeleted?: boolean;
|
|
137
|
+
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
138
|
+
deleted?: boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export type TeamMemberRole = "owner" | "member";
|
|
142
|
+
|
|
143
|
+
export namespace TeamMemberRole {
|
|
144
|
+
export function isValid(role: any): role is TeamMemberRole {
|
|
145
|
+
return role === "owner" || role === "member";
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface TeamMemberInfo {
|
|
150
|
+
userId: string;
|
|
151
|
+
fullName?: string;
|
|
152
|
+
primaryEmail?: string;
|
|
153
|
+
avatarUrl?: string;
|
|
154
|
+
role: TeamMemberRole;
|
|
155
|
+
memberSince: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface TeamMembershipInvite {
|
|
159
|
+
id: string;
|
|
160
|
+
teamId: string;
|
|
161
|
+
role: TeamMemberRole;
|
|
162
|
+
creationTime: string;
|
|
163
|
+
invalidationTime: string;
|
|
164
|
+
invitedEmail?: string;
|
|
165
|
+
|
|
166
|
+
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
167
|
+
deleted?: boolean;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface PrebuildEvent {
|
|
171
|
+
id: string;
|
|
172
|
+
creationTime: string;
|
|
173
|
+
status: WebhookEvent.Status | WebhookEvent.PrebuildStatus;
|
|
174
|
+
message?: string;
|
|
175
|
+
prebuildId?: string;
|
|
176
|
+
projectId?: string;
|
|
177
|
+
cloneUrl?: string;
|
|
178
|
+
branch?: string;
|
|
179
|
+
commit?: string;
|
|
180
|
+
}
|
package/src/typings/globals.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
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
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
interface Window {
|
|
8
|
+
// gitpod is used by supervisor/frontend and vscode browser https://github.com/gitpod-io/openvscode-server/blob/dadd40deda5959c0efdaa0c7d02ab64b6f8b5ad0/src/vs/gitpod/browser/workbench/workbench.ts#L7
|
|
8
9
|
gitpod: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
ideService?: import("../ide-frontend-service").IDEFrontendService;
|
|
11
|
+
loggedUserID?: string;
|
|
12
|
+
|
|
13
|
+
openDesktopIDE(url: string): void;
|
|
14
|
+
|
|
15
|
+
encrypt(content: string): string;
|
|
16
|
+
decrypt(content: string): string;
|
|
17
|
+
isEncryptedData(content: string): boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|
package/src/usage.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 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 { WorkspaceType } from "./protocol";
|
|
8
|
+
|
|
9
|
+
// types below are copied over from components/usage-api/typescript/src/usage/v1/usage_pb.d.ts
|
|
10
|
+
export interface ListUsageRequest {
|
|
11
|
+
attributionId: string;
|
|
12
|
+
from?: number;
|
|
13
|
+
to?: number;
|
|
14
|
+
order: Ordering;
|
|
15
|
+
pagination?: PaginationRequest;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum Ordering {
|
|
19
|
+
ORDERING_DESCENDING = 0,
|
|
20
|
+
ORDERING_ASCENDING = 1,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PaginationRequest {
|
|
24
|
+
perPage: number;
|
|
25
|
+
page: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ListUsageResponse {
|
|
29
|
+
usageEntriesList: Usage[];
|
|
30
|
+
pagination?: PaginationResponse;
|
|
31
|
+
creditsUsed: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface PaginationResponse {
|
|
35
|
+
perPage: number;
|
|
36
|
+
totalPages: number;
|
|
37
|
+
total: number;
|
|
38
|
+
page: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type UsageKind = "workspaceinstance" | "invoice";
|
|
42
|
+
export interface Usage {
|
|
43
|
+
id: string;
|
|
44
|
+
attributionId: string;
|
|
45
|
+
description: string;
|
|
46
|
+
credits: number;
|
|
47
|
+
effectiveTime?: number;
|
|
48
|
+
kind: UsageKind;
|
|
49
|
+
workspaceInstanceId: string;
|
|
50
|
+
draft: boolean;
|
|
51
|
+
metadata: WorkspaceInstanceUsageData | InvoiceUsageData;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// the equivalent golang shape is maintained in `/workspace/gitpod/`components/usage/pkg/db/usage.go`
|
|
55
|
+
export interface WorkspaceInstanceUsageData {
|
|
56
|
+
workspaceId: string;
|
|
57
|
+
workspaceType: WorkspaceType;
|
|
58
|
+
workspaceClass: string;
|
|
59
|
+
contextURL: string;
|
|
60
|
+
startTime: string;
|
|
61
|
+
endTime?: string;
|
|
62
|
+
userId: string;
|
|
63
|
+
userName: string;
|
|
64
|
+
userAvatarURL: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface InvoiceUsageData {
|
|
68
|
+
invoiceId: string;
|
|
69
|
+
startDate: string;
|
|
70
|
+
endDate: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface CostCenterJSON {
|
|
74
|
+
attributionId: string;
|
|
75
|
+
spendingLimit: number;
|
|
76
|
+
billingStrategy: CostCenter_BillingStrategy;
|
|
77
|
+
nextBillingTime?: string;
|
|
78
|
+
billingCycleStart?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export enum CostCenter_BillingStrategy {
|
|
82
|
+
BILLING_STRATEGY_STRIPE = "BILLING_STRATEGY_STRIPE",
|
|
83
|
+
BILLING_STRATEGY_OTHER = "BILLING_STRATEGY_OTHER",
|
|
84
|
+
UNRECOGNIZED = "UNRECOGNIZED",
|
|
85
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
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 Analytics = require("analytics-node");
|
|
8
|
+
import { IAnalyticsWriter, IdentifyMessage, TrackMessage, PageMessage } from "../analytics";
|
|
9
|
+
import { log } from "./logging";
|
|
10
|
+
|
|
11
|
+
export function newAnalyticsWriterFromEnv(): IAnalyticsWriter {
|
|
12
|
+
switch (process.env.GITPOD_ANALYTICS_WRITER) {
|
|
13
|
+
case "segment":
|
|
14
|
+
return new SegmentAnalyticsWriter(process.env.GITPOD_ANALYTICS_SEGMENT_KEY || "");
|
|
15
|
+
case "log":
|
|
16
|
+
return new LogAnalyticsWriter();
|
|
17
|
+
default:
|
|
18
|
+
return new NoAnalyticsWriter();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class SegmentAnalyticsWriter implements IAnalyticsWriter {
|
|
23
|
+
protected readonly analytics: Analytics;
|
|
24
|
+
|
|
25
|
+
constructor(writeKey: string) {
|
|
26
|
+
this.analytics = new Analytics(writeKey);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
identify(msg: IdentifyMessage) {
|
|
30
|
+
try {
|
|
31
|
+
this.analytics.identify(
|
|
32
|
+
{
|
|
33
|
+
...msg,
|
|
34
|
+
integrations: {
|
|
35
|
+
All: true,
|
|
36
|
+
Mixpanel: !!msg.userId,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
(err: Error) => {
|
|
40
|
+
if (err) {
|
|
41
|
+
log.warn("analytics.identify failed", err);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
log.warn("analytics.identify failed", err);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
track(msg: TrackMessage) {
|
|
51
|
+
try {
|
|
52
|
+
this.analytics.track(
|
|
53
|
+
{
|
|
54
|
+
...msg,
|
|
55
|
+
integrations: {
|
|
56
|
+
All: true,
|
|
57
|
+
Mixpanel: !!msg.userId,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
(err: Error) => {
|
|
61
|
+
if (err) {
|
|
62
|
+
log.warn("analytics.track failed", err);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
log.warn("analytics.track failed", err);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
page(msg: PageMessage) {
|
|
72
|
+
try {
|
|
73
|
+
this.analytics.page(
|
|
74
|
+
{
|
|
75
|
+
...msg,
|
|
76
|
+
integrations: {
|
|
77
|
+
All: true,
|
|
78
|
+
Mixpanel: !!msg.userId,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
(err: Error) => {
|
|
82
|
+
if (err) {
|
|
83
|
+
log.warn("analytics.page failed", err);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
} catch (err) {
|
|
88
|
+
log.warn("analytics.page failed", err);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
class LogAnalyticsWriter implements IAnalyticsWriter {
|
|
94
|
+
identify(msg: IdentifyMessage): void {
|
|
95
|
+
log.debug("analytics identify", msg);
|
|
96
|
+
}
|
|
97
|
+
track(msg: TrackMessage): void {
|
|
98
|
+
log.debug("analytics track", msg);
|
|
99
|
+
}
|
|
100
|
+
page(msg: PageMessage): void {
|
|
101
|
+
log.debug("analytics page", msg);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
class NoAnalyticsWriter implements IAnalyticsWriter {
|
|
106
|
+
identify(msg: IdentifyMessage): void {}
|
|
107
|
+
track(msg: TrackMessage): void {}
|
|
108
|
+
page(msg: PageMessage): void {}
|
|
109
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
// Use asyncIterators with es2015
|
|
8
|
-
if (typeof (Symbol as any).asyncIterator ===
|
|
9
|
-
(Symbol as any).asyncIterator = Symbol.asyncIterator || Symbol(
|
|
8
|
+
if (typeof (Symbol as any).asyncIterator === "undefined") {
|
|
9
|
+
(Symbol as any).asyncIterator = Symbol.asyncIterator || Symbol("asyncIterator");
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export async function find<T>(it: AsyncIterableIterator<T>, predicate: (value: T) => boolean): Promise<T | undefined> {
|
|
@@ -31,12 +31,11 @@ export interface AsyncCachingIterator<T> extends AsyncIterableIterator<T> {
|
|
|
31
31
|
resetCursor(): void;
|
|
32
32
|
}
|
|
33
33
|
export class AsyncCachingIteratorImpl<T> implements AsyncIterableIterator<T>, AsyncCachingIterator<T> {
|
|
34
|
-
|
|
35
34
|
protected cache: T[] = [];
|
|
36
35
|
protected cursor = 0;
|
|
37
36
|
protected cacheRead = false;
|
|
38
37
|
|
|
39
|
-
constructor(protected readonly iterable: AsyncIterableIterator<T>) {
|
|
38
|
+
constructor(protected readonly iterable: AsyncIterableIterator<T>) {}
|
|
40
39
|
|
|
41
40
|
public resetCursor() {
|
|
42
41
|
this.cursor = 0;
|
|
@@ -47,7 +46,7 @@ export class AsyncCachingIteratorImpl<T> implements AsyncIterableIterator<T>, As
|
|
|
47
46
|
if (!this.cacheRead && this.cursor < this.cache.length) {
|
|
48
47
|
return {
|
|
49
48
|
done: false,
|
|
50
|
-
value: this.cache[this.cursor++]
|
|
49
|
+
value: this.cache[this.cursor++],
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
52
|
this.cacheRead = true;
|
package/src/util/cancelable.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Disposable } from "./disposable";
|
|
@@ -9,10 +9,10 @@ import { Disposable } from "./disposable";
|
|
|
9
9
|
export class Cancelable<T> implements Disposable {
|
|
10
10
|
protected canceled: boolean;
|
|
11
11
|
|
|
12
|
-
constructor(protected readonly activity: (cancel: boolean) => Promise<T> | undefined) {
|
|
12
|
+
constructor(protected readonly activity: (cancel: boolean) => Promise<T> | undefined) {}
|
|
13
13
|
|
|
14
14
|
public async run(): Promise<T | undefined> {
|
|
15
|
-
for(let r = await this.activity(this.canceled); ; r = await this.activity(this.canceled)) {
|
|
15
|
+
for (let r = await this.activity(this.canceled); ; r = await this.activity(this.canceled)) {
|
|
16
16
|
if (this.canceled) {
|
|
17
17
|
return;
|
|
18
18
|
} else if (r !== undefined) {
|
|
@@ -28,4 +28,4 @@ export class Cancelable<T> implements Disposable {
|
|
|
28
28
|
dispose(): void {
|
|
29
29
|
this.cancel();
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|