@gitpod/gitpod-protocol 0.1.5-tar-telemetry-settings-data.3 → 0.1.5-tar-sh-active-users.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/gitpod-schema.json +97 -5
- package/lib/accounting-protocol.d.ts +18 -10
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +34 -32
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +9 -2
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +4 -5
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/attribution.d.ts +20 -0
- package/lib/attribution.d.ts.map +1 -0
- package/lib/attribution.js +40 -0
- package/lib/attribution.js.map +1 -0
- package/lib/auth.d.ts.map +1 -1
- package/lib/billing-mode.d.ts +40 -0
- package/lib/billing-mode.d.ts.map +1 -0
- package/lib/billing-mode.js +36 -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.map +1 -1
- package/lib/context-url.js +4 -4
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +20 -5
- package/lib/context-url.spec.js.map +1 -1
- package/lib/email-protocol.d.ts +1 -1
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +1 -1
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +7 -7
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +2 -3
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +1 -1
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +7 -9
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +0 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +1 -20
- package/lib/env.js.map +1 -1
- package/lib/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 +36 -0
- package/lib/experiments/configcat-server.js.map +1 -0
- package/lib/experiments/configcat.d.ts +22 -0
- package/lib/experiments/configcat.d.ts.map +1 -0
- package/lib/experiments/configcat.js +53 -0
- package/lib/experiments/configcat.js.map +1 -0
- package/lib/experiments/types.d.ts +23 -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.map +1 -1
- package/lib/gitpod-file-parser.js +6 -6
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +42 -39
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +56 -26
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +40 -33
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +1 -0
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +2 -1
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +1 -1
- package/lib/ide-protocol.d.ts +14 -6
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/index.d.ts +17 -16
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +4 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -1
- package/lib/installation-admin-protocol.js +3 -2
- package/lib/installation-admin-protocol.js.map +1 -1
- package/lib/license-protocol.d.ts +7 -0
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +1 -1
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +19 -19
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +4 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +9 -6
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +2 -18
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +21 -22
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +6 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +13 -3
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.js +8 -8
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +1 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +7 -9
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +1 -1
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +2 -2
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +12 -23
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +4 -3
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +210 -171
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +146 -39
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +267 -88
- package/lib/protocol.js.map +1 -1
- package/{src/theia-plugins.ts → lib/protocol.spec.d.ts} +2 -6
- 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.spec.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +22 -3
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +20 -5
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +21 -3
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +1 -1
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/usage.d.ts +43 -0
- package/lib/usage.d.ts.map +1 -0
- package/lib/{theia-plugins.js → usage.js} +2 -2
- package/lib/usage.js.map +1 -0
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +12 -3
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +3 -3
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +6 -6
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/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/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +2 -2
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +5 -3
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +6 -1
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +5 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +446 -442
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +18 -7
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +1 -1
- package/lib/util/gitpod-cookie.d.ts.map +1 -1
- package/lib/util/gitpod-cookie.js +0 -3
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts +3 -0
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +49 -29
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +15 -5
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +19 -0
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js +73 -1
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/jaeger-client-types.d.ts.map +1 -1
- package/lib/util/logging.d.ts +1 -1
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +31 -25
- 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.js +5 -5
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +1 -2
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.spec.js +9 -6
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +2 -0
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +15 -3
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +1 -0
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +10 -0
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +6 -6
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +14 -16
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.js +3 -3
- package/lib/util/tracing.spec.js.map +1 -1
- package/lib/util/workspace-port-authentication.d.ts +7 -7
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +8 -11
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/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 +6 -8
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +2 -4
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +20 -3
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +4 -4
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +1 -3
- package/lib/wsready.js.map +1 -1
- package/package.json +13 -7
- package/pkg-yarn.lock +9 -6
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +66 -51
- package/src/admin-protocol.ts +33 -21
- package/src/analytics.ts +26 -28
- package/src/attribution.ts +48 -0
- package/src/auth.ts +2 -2
- package/src/billing-mode.ts +67 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +25 -11
- package/src/context-url.ts +80 -78
- package/src/email-protocol.ts +5 -6
- package/src/encryption/container-module.ts +2 -3
- package/src/encryption/encryption-engine.spec.ts +9 -8
- package/src/encryption/encryption-engine.ts +14 -14
- package/src/encryption/encryption-service.ts +4 -5
- package/src/encryption/key-provider.ts +16 -19
- package/src/env.ts +0 -22
- package/src/experiments/always-default.ts +24 -0
- package/src/experiments/configcat-server.ts +41 -0
- package/src/experiments/configcat.ts +58 -0
- package/src/experiments/types.ts +35 -0
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +188 -111
- package/src/headless-workspace-log.ts +6 -4
- package/src/ide-frontend-service.ts +2 -2
- package/src/ide-protocol.ts +18 -8
- package/src/index.ts +17 -16
- package/src/installation-admin-protocol.ts +12 -8
- package/src/license-protocol.ts +12 -6
- package/src/messaging/browser/connection.ts +45 -47
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +62 -82
- package/src/messaging/error.ts +20 -7
- package/src/messaging/handler.ts +6 -6
- package/src/messaging/node/connection.ts +8 -8
- package/src/messaging/proxy-factory.ts +23 -30
- package/src/oss-allowlist.ts +3 -3
- package/src/payment-protocol.ts +2 -2
- package/src/permission.ts +20 -31
- package/src/plans.ts +240 -189
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +509 -242
- package/src/snapshot-url.spec.ts +9 -7
- package/src/team-subscription-protocol.ts +59 -22
- package/src/teams-projects-protocol.ts +28 -8
- package/src/typings/globals.ts +4 -4
- package/src/usage.ts +63 -0
- package/src/util/analytics.ts +46 -24
- 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/debug-app.ts +81 -0
- 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 +8 -6
- package/src/util/generate-workspace-id.spec.ts +26 -16
- package/src/util/generate-workspace-id.ts +460 -454
- package/src/util/gitpod-cookie.ts +8 -9
- package/src/util/gitpod-host-url.spec.ts +40 -13
- package/src/util/gitpod-host-url.ts +57 -33
- package/src/util/grpc.ts +90 -1
- package/src/util/jaeger-client-types.ts +2 -2
- package/src/util/logging.spec.ts +23 -0
- package/src/util/logging.ts +60 -42
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +17 -8
- package/src/util/parse-workspace-id.ts +5 -6
- package/src/util/queue.spec.ts +27 -25
- package/src/util/repeat.ts +1 -1
- package/src/util/semaphore.ts +4 -6
- package/src/util/skip-if.ts +9 -6
- package/src/util/timeutil.spec.ts +19 -14
- package/src/util/timeutil.ts +27 -11
- package/src/util/tracing.spec.ts +28 -23
- package/src/util/tracing.ts +54 -51
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +14 -13
- package/src/workspace-instance.ts +60 -24
- package/src/wsready.ts +6 -5
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.js.map +0 -1
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);
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
import { repeat } from "./repeat";
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
interface CacheEntry<T> {
|
|
11
10
|
key: string;
|
|
12
11
|
value: T;
|
|
@@ -16,9 +15,7 @@ interface CacheEntry<T> {
|
|
|
16
15
|
export class GarbageCollectedCache<T> {
|
|
17
16
|
protected readonly store = new Map<string, CacheEntry<T>>();
|
|
18
17
|
|
|
19
|
-
constructor(
|
|
20
|
-
protected readonly defaultMaxAgeSeconds: number,
|
|
21
|
-
protected readonly gcIntervalSeconds: number) {
|
|
18
|
+
constructor(protected readonly defaultMaxAgeSeconds: number, protected readonly gcIntervalSeconds: number) {
|
|
22
19
|
this.regularlyCollectGarbage();
|
|
23
20
|
}
|
|
24
21
|
|
|
@@ -40,6 +37,11 @@ export class GarbageCollectedCache<T> {
|
|
|
40
37
|
if (!entry) {
|
|
41
38
|
return undefined;
|
|
42
39
|
}
|
|
40
|
+
// Still valid?
|
|
41
|
+
if (entry.expiryDate < Date.now()) {
|
|
42
|
+
this.store.delete(entry.key);
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
43
45
|
return entry.value;
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -61,6 +63,6 @@ export class GarbageCollectedCache<T> {
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
protected calcExpiryDate(maxAgeSeconds?: number): number {
|
|
64
|
-
return Date.now() + (
|
|
66
|
+
return Date.now() + (maxAgeSeconds || this.defaultMaxAgeSeconds) * 1000;
|
|
65
67
|
}
|
|
66
|
-
}
|
|
68
|
+
}
|
|
@@ -4,17 +4,17 @@
|
|
|
4
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
|
}
|
|
@@ -29,20 +29,30 @@ const expect = chai.expect
|
|
|
29
29
|
|
|
30
30
|
@test public async testCustomName() {
|
|
31
31
|
const data = [
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
|
|
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
|
+
];
|
|
39
50
|
for (const d of data) {
|
|
40
51
|
const id = await generateWorkspaceID(d[0], d[1]);
|
|
41
|
-
expect(id).match(new RegExp("^"+d[2]));
|
|
52
|
+
expect(id).match(new RegExp("^" + d[2]));
|
|
42
53
|
expect(new GitpodHostUrl().withWorkspacePrefix(id, "eu").workspaceId).to.equal(id);
|
|
43
54
|
expect(id.length <= 36, `"${id}" is longer than 36 chars (${id.length})`).to.be.true;
|
|
44
55
|
}
|
|
45
56
|
}
|
|
46
|
-
|
|
47
57
|
}
|
|
48
|
-
module.exports = new TestGenerateWorkspaceId()
|
|
58
|
+
module.exports = new TestGenerateWorkspaceId();
|