@gitpod/gitpod-protocol 0.1.5-sje-installer-helm.1 → 0.1.5-sje-installer-namespace-docs.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 +4 -0
- package/lib/accounting-protocol.d.ts +0 -1
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +10 -11
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +8 -2
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +2 -13
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +1 -0
- package/lib/analytics.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.js +45 -48
- package/lib/context-url.spec.js.map +1 -1
- package/lib/email-protocol.js +4 -4
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.js +4 -4
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.js +19 -20
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +29 -36
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.js +29 -43
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.js +25 -30
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.js +12 -13
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.js +25 -41
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +116 -116
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +20 -8
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +149 -295
- package/lib/gitpod-service.js.map +1 -1
- package/lib/ide-protocol.d.ts +81 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/ide-protocol.js +8 -0
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +3 -3
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +172 -35
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.js +35 -55
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.js +17 -18
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/connection-error-handler.js +11 -23
- package/lib/messaging/connection-error-handler.js.map +1 -1
- package/lib/messaging/error.d.ts +1 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +2 -2
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/node/connection.d.ts +0 -10
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +11 -49
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +2 -0
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +73 -160
- 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/permission.js +12 -12
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +1 -1
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +38 -57
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +9 -7
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +44 -114
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/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.js +13 -13
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +9 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +4 -15
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/util/analytics.js +25 -32
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.js +55 -133
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js +17 -59
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +8 -8
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/deferred.js +10 -12
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.js +26 -39
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.js +58 -74
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -0
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +26 -46
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.js +11 -67
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +34 -79
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +44 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +1 -0
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +96 -103
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +87 -135
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.js +3 -3
- 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/util/jaeger-client-types.js +8 -0
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +32 -32
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +50 -113
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +2 -2
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +10 -0
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +31 -7
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +4 -0
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +123 -84
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.js +16 -55
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.js +144 -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/safe-promise.js +9 -12
- package/lib/util/safe-promise.js.map +1 -1
- package/lib/util/semaphore.js +15 -46
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.js +6 -6
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.js +16 -16
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.js +21 -24
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +50 -5
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +169 -63
- 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.js +2 -2
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +11 -1
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +3 -3
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +3 -2
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.js +1 -1
- package/package.json +20 -12
- package/pkg-yarn.lock +12 -7
- package/src/accounting-protocol.ts +1 -3
- package/src/admin-protocol.ts +9 -3
- package/src/analytics.ts +2 -0
- package/src/email-protocol.ts +1 -1
- package/src/gitpod-service.ts +25 -13
- package/src/ide-protocol.ts +92 -0
- package/src/index.ts +2 -0
- package/src/messaging/browser/connection.ts +176 -10
- package/src/messaging/error.ts +2 -2
- package/src/messaging/handler.ts +12 -0
- package/src/messaging/node/connection.ts +1 -45
- package/src/messaging/proxy-factory.ts +10 -4
- package/src/oss-allowlist.ts +15 -0
- package/src/protocol.ts +11 -8
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +1 -1
- package/src/teams-projects-protocol.ts +12 -1
- package/src/util/garbage-collected-cache.ts +7 -1
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.ts +9 -5
- package/src/util/grpc.ts +3 -3
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +32 -32
- package/src/util/parse-workspace-id.spec.ts +21 -1
- package/src/util/parse-workspace-id.ts +32 -6
- package/src/util/repeat.ts +45 -0
- package/src/util/tracing.spec.ts +83 -0
- package/src/util/tracing.ts +153 -17
- package/src/workspace-cluster.ts +8 -1
- package/src/workspace-instance.ts +9 -6
- package/src/wsready.ts +1 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
package/lib/util/event.js
CHANGED
|
@@ -7,18 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.Emitter = exports.Event = void 0;
|
|
10
|
-
|
|
10
|
+
const logging_1 = require("./logging");
|
|
11
11
|
var Event;
|
|
12
12
|
(function (Event) {
|
|
13
|
-
|
|
13
|
+
const _disposable = { dispose() { } };
|
|
14
14
|
Event.None = function () { return _disposable; };
|
|
15
15
|
})(Event = exports.Event || (exports.Event = {}));
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
CallbackList.prototype.add = function (callback, context, bucket) {
|
|
20
|
-
var _this = this;
|
|
21
|
-
if (context === void 0) { context = null; }
|
|
16
|
+
class CallbackList {
|
|
17
|
+
add(callback, context = null, bucket) {
|
|
22
18
|
if (!this._callbacks) {
|
|
23
19
|
this._callbacks = [];
|
|
24
20
|
this._contexts = [];
|
|
@@ -26,16 +22,15 @@ var CallbackList = /** @class */ (function () {
|
|
|
26
22
|
this._callbacks.push(callback);
|
|
27
23
|
this._contexts.push(context);
|
|
28
24
|
if (Array.isArray(bucket)) {
|
|
29
|
-
bucket.push({ dispose:
|
|
25
|
+
bucket.push({ dispose: () => this.remove(callback, context) });
|
|
30
26
|
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (context === void 0) { context = null; }
|
|
27
|
+
}
|
|
28
|
+
remove(callback, context = null) {
|
|
34
29
|
if (!this._callbacks) {
|
|
35
30
|
return;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
|
-
for (
|
|
32
|
+
let foundCallbackWithDifferentContext = false;
|
|
33
|
+
for (let i = 0, len = this._callbacks.length; i < len; i++) {
|
|
39
34
|
if (this._callbacks[i] === callback) {
|
|
40
35
|
if (this._contexts[i] === context) {
|
|
41
36
|
// callback & context match => remove it
|
|
@@ -51,19 +46,15 @@ var CallbackList = /** @class */ (function () {
|
|
|
51
46
|
if (foundCallbackWithDifferentContext) {
|
|
52
47
|
throw new Error('When adding a listener with a context, you should remove it with the same context');
|
|
53
48
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
var args = [];
|
|
57
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
58
|
-
args[_i] = arguments[_i];
|
|
59
|
-
}
|
|
49
|
+
}
|
|
50
|
+
invoke(...args) {
|
|
60
51
|
if (!this._callbacks) {
|
|
61
52
|
return [];
|
|
62
53
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
for (
|
|
54
|
+
const ret = [];
|
|
55
|
+
const callbacks = this._callbacks.slice(0);
|
|
56
|
+
const contexts = this._contexts.slice(0);
|
|
57
|
+
for (let i = 0, len = callbacks.length; i < len; i++) {
|
|
67
58
|
try {
|
|
68
59
|
ret.push(callbacks[i].apply(contexts[i], args));
|
|
69
60
|
}
|
|
@@ -72,74 +63,67 @@ var CallbackList = /** @class */ (function () {
|
|
|
72
63
|
}
|
|
73
64
|
}
|
|
74
65
|
return ret;
|
|
75
|
-
}
|
|
76
|
-
|
|
66
|
+
}
|
|
67
|
+
isEmpty() {
|
|
77
68
|
return !this._callbacks || this._callbacks.length === 0;
|
|
78
|
-
}
|
|
79
|
-
|
|
69
|
+
}
|
|
70
|
+
dispose() {
|
|
80
71
|
this._callbacks = undefined;
|
|
81
72
|
this._contexts = undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
function Emitter(_options) {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class Emitter {
|
|
76
|
+
constructor(_options) {
|
|
87
77
|
this._options = _options;
|
|
88
78
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
dispose
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (_this._options && _this._options.onLastListenerRemove && _this._callbacks.isEmpty()) {
|
|
111
|
-
_this._options.onLastListenerRemove(_this);
|
|
112
|
-
}
|
|
79
|
+
/**
|
|
80
|
+
* For the public to allow to subscribe
|
|
81
|
+
* to events from this Emitter
|
|
82
|
+
*/
|
|
83
|
+
get event() {
|
|
84
|
+
if (!this._event) {
|
|
85
|
+
this._event = (listener, thisArgs, disposables) => {
|
|
86
|
+
if (!this._callbacks) {
|
|
87
|
+
this._callbacks = new CallbackList();
|
|
88
|
+
}
|
|
89
|
+
if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
|
|
90
|
+
this._options.onFirstListenerAdd(this);
|
|
91
|
+
}
|
|
92
|
+
this._callbacks.add(listener, thisArgs);
|
|
93
|
+
let result;
|
|
94
|
+
result = {
|
|
95
|
+
dispose: () => {
|
|
96
|
+
this._callbacks.remove(listener, thisArgs);
|
|
97
|
+
result.dispose = Emitter._noop;
|
|
98
|
+
if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
|
|
99
|
+
this._options.onLastListenerRemove(this);
|
|
113
100
|
}
|
|
114
|
-
};
|
|
115
|
-
if (Array.isArray(disposables)) {
|
|
116
|
-
disposables.push(result);
|
|
117
101
|
}
|
|
118
|
-
return result;
|
|
119
102
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
103
|
+
if (Array.isArray(disposables)) {
|
|
104
|
+
disposables.push(result);
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return this._event;
|
|
110
|
+
}
|
|
126
111
|
/**
|
|
127
112
|
* To be kept private to fire an event to
|
|
128
113
|
* subscribers
|
|
129
114
|
*/
|
|
130
|
-
|
|
115
|
+
fire(event) {
|
|
131
116
|
if (this._callbacks) {
|
|
132
117
|
this._callbacks.invoke.call(this._callbacks, event);
|
|
133
118
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
119
|
+
}
|
|
120
|
+
dispose() {
|
|
136
121
|
if (this._callbacks) {
|
|
137
122
|
this._callbacks.dispose();
|
|
138
123
|
this._callbacks = undefined;
|
|
139
124
|
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return Emitter;
|
|
143
|
-
}());
|
|
125
|
+
}
|
|
126
|
+
}
|
|
144
127
|
exports.Emitter = Emitter;
|
|
128
|
+
Emitter._noop = function () { };
|
|
145
129
|
//# sourceMappingURL=event.js.map
|
package/lib/util/event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../src/util/event.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../src/util/event.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,uCAAgC;AAiBhC,IAAiB,KAAK,CAGrB;AAHD,WAAiB,KAAK;IAClB,MAAM,WAAW,GAAG,EAAE,OAAO,KAAK,CAAC,EAAE,CAAC;IACzB,UAAI,GAAe,cAAc,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC,EAHgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAGrB;AAED,MAAM,YAAY;IAKP,GAAG,CAAC,QAAkB,EAAE,UAAe,IAAI,EAAE,MAAqB;QACrE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;YACrB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;SACvB;QACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B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CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAExC,IAAI,MAAkB,CAAC;gBACvB,MAAM,GAAG;oBACL,OAAO,EAAE,GAAG,EAAE;wBACV,IAAI,CAAC,UAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;wBAC5C,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;wBAC/B,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,oBAAoB,IAAI,IAAI,CAAC,UAAW,CAAC,OAAO,EAAE,EAAE;4BACnF,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;yBAC5C;oBACL,CAAC;iBACJ,CAAC;gBACF,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;oBAC5B,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;iBAC5B;gBAED,OAAO,MAAM,CAAC;YAClB,CAAC,CAAC;SACL;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,KAAQ;QACT,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;SACvD;IACL,CAAC;IAED,OAAO;QACH,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;SAC/B;IACL,CAAC;;AA5DL,0BA6DC;AA3DkB,aAAK,GAAG,cAAc,CAAC,CAAC"}
|
|
@@ -15,6 +15,7 @@ export declare class GarbageCollectedCache<T> {
|
|
|
15
15
|
constructor(defaultMaxAgeSeconds: number, gcIntervalSeconds: number);
|
|
16
16
|
set(key: string, value: T): void;
|
|
17
17
|
get(key: string): T | undefined;
|
|
18
|
+
delete(key: string): void;
|
|
18
19
|
protected regularlyCollectGarbage(): void;
|
|
19
20
|
protected collectGarbage(): void;
|
|
20
21
|
protected calcExpiryDate(maxAgeSeconds?: number): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"garbage-collected-cache.d.ts","sourceRoot":"","sources":["../../src/util/garbage-collected-cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"garbage-collected-cache.d.ts","sourceRoot":"","sources":["../../src/util/garbage-collected-cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,UAAU,UAAU,CAAC,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,CAAC,CAAC;IACT,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,qBAAqB,CAAC,CAAC;IAI5B,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,MAAM;IAC/C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IAJhD,SAAS,CAAC,QAAQ,CAAC,KAAK,6BAAoC;gBAGrC,oBAAoB,EAAE,MAAM,EAC5B,iBAAiB,EAAE,MAAM;IAIzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAazB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAQ/B,MAAM,CAAC,GAAG,EAAE,MAAM;IAIzB,SAAS,CAAC,uBAAuB;IAIjC,SAAS,CAAC,cAAc;IASxB,SAAS,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM;CAG3D"}
|
|
@@ -4,72 +4,52 @@
|
|
|
4
4
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
5
|
* See License-AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
7
|
-
var __values = (this && this.__values) || function(o) {
|
|
8
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
9
|
-
if (m) return m.call(o);
|
|
10
|
-
if (o && typeof o.length === "number") return {
|
|
11
|
-
next: function () {
|
|
12
|
-
if (o && i >= o.length) o = void 0;
|
|
13
|
-
return { value: o && o[i++], done: !o };
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
17
|
-
};
|
|
18
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
8
|
exports.GarbageCollectedCache = void 0;
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const repeat_1 = require("./repeat");
|
|
10
|
+
class GarbageCollectedCache {
|
|
11
|
+
constructor(defaultMaxAgeSeconds, gcIntervalSeconds) {
|
|
22
12
|
this.defaultMaxAgeSeconds = defaultMaxAgeSeconds;
|
|
23
13
|
this.gcIntervalSeconds = gcIntervalSeconds;
|
|
24
14
|
this.store = new Map();
|
|
25
15
|
this.regularlyCollectGarbage();
|
|
26
16
|
}
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
set(key, value) {
|
|
18
|
+
const oldValue = this.store.get(key);
|
|
29
19
|
if (oldValue) {
|
|
30
20
|
// We don't want values to be cached indefinitely just because their queried often
|
|
31
21
|
return;
|
|
32
22
|
}
|
|
33
23
|
this.store.set(key, {
|
|
34
|
-
key
|
|
35
|
-
value
|
|
24
|
+
key,
|
|
25
|
+
value,
|
|
36
26
|
expiryDate: this.calcExpiryDate(),
|
|
37
27
|
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
}
|
|
29
|
+
get(key) {
|
|
30
|
+
const entry = this.store.get(key);
|
|
41
31
|
if (!entry) {
|
|
42
32
|
return undefined;
|
|
43
33
|
}
|
|
44
34
|
return entry.value;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.store.delete(entry.key);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
62
|
-
finally {
|
|
63
|
-
try {
|
|
64
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
35
|
+
}
|
|
36
|
+
delete(key) {
|
|
37
|
+
this.store.delete(key);
|
|
38
|
+
}
|
|
39
|
+
regularlyCollectGarbage() {
|
|
40
|
+
(0, repeat_1.repeat)(() => this.collectGarbage(), this.gcIntervalSeconds * 1000);
|
|
41
|
+
}
|
|
42
|
+
collectGarbage() {
|
|
43
|
+
const now = Date.now();
|
|
44
|
+
for (const entry of this.store.values()) {
|
|
45
|
+
if (entry.expiryDate < now) {
|
|
46
|
+
this.store.delete(entry.key);
|
|
65
47
|
}
|
|
66
|
-
finally { if (e_1) throw e_1.error; }
|
|
67
48
|
}
|
|
68
|
-
}
|
|
69
|
-
|
|
49
|
+
}
|
|
50
|
+
calcExpiryDate(maxAgeSeconds) {
|
|
70
51
|
return Date.now() + ((maxAgeSeconds || this.defaultMaxAgeSeconds) * 1000);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}());
|
|
52
|
+
}
|
|
53
|
+
}
|
|
74
54
|
exports.GarbageCollectedCache = GarbageCollectedCache;
|
|
75
55
|
//# sourceMappingURL=garbage-collected-cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"garbage-collected-cache.js","sourceRoot":"","sources":["../../src/util/garbage-collected-cache.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"garbage-collected-cache.js","sourceRoot":"","sources":["../../src/util/garbage-collected-cache.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,qCAAkC;AASlC,MAAa,qBAAqB;IAG9B,YACuB,oBAA4B,EAC5B,iBAAyB;QADzB,yBAAoB,GA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3C,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAAC;IAC9E,CAAC;CACJ;AAlDD,sDAkDC"}
|
|
@@ -8,33 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.animals = exports.colors = exports.generateWorkspaceID = void 0;
|
|
40
13
|
/**
|
|
@@ -42,52 +15,23 @@ exports.animals = exports.colors = exports.generateWorkspaceID = void 0;
|
|
|
42
15
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
43
16
|
* See License-AGPL.txt in the project root for license information.
|
|
44
17
|
*/
|
|
45
|
-
|
|
18
|
+
const randomNumber = require("random-number-csprng");
|
|
46
19
|
function generateWorkspaceID() {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
-
|
|
49
|
-
return __generator(this, function (_c) {
|
|
50
|
-
switch (_c.label) {
|
|
51
|
-
case 0: return [4 /*yield*/, random(exports.colors)];
|
|
52
|
-
case 1:
|
|
53
|
-
_a = (_c.sent()) + '-';
|
|
54
|
-
return [4 /*yield*/, random(exports.animals)];
|
|
55
|
-
case 2:
|
|
56
|
-
_b = _a + (_c.sent()) + '-';
|
|
57
|
-
return [4 /*yield*/, random(characters, 8)];
|
|
58
|
-
case 3: return [2 /*return*/, _b + (_c.sent())];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
return (yield random(exports.colors)) + '-' + (yield random(exports.animals)) + '-' + (yield random(characters, 8));
|
|
61
22
|
});
|
|
62
23
|
}
|
|
63
24
|
exports.generateWorkspaceID = generateWorkspaceID;
|
|
64
|
-
function random(array, length) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
result = '';
|
|
72
|
-
i = 0;
|
|
73
|
-
_c.label = 1;
|
|
74
|
-
case 1:
|
|
75
|
-
if (!(i < length)) return [3 /*break*/, 4];
|
|
76
|
-
_a = result;
|
|
77
|
-
_b = array;
|
|
78
|
-
return [4 /*yield*/, randomNumber(0, array.length - 1)];
|
|
79
|
-
case 2:
|
|
80
|
-
result = _a + _b[_c.sent()];
|
|
81
|
-
_c.label = 3;
|
|
82
|
-
case 3:
|
|
83
|
-
i++;
|
|
84
|
-
return [3 /*break*/, 1];
|
|
85
|
-
case 4: return [2 /*return*/, result];
|
|
86
|
-
}
|
|
87
|
-
});
|
|
25
|
+
function random(array, length = 1) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var result = '';
|
|
28
|
+
for (var i = 0; i < length; i++) {
|
|
29
|
+
result += array[yield randomNumber(0, array.length - 1)];
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
88
32
|
});
|
|
89
33
|
}
|
|
90
|
-
|
|
34
|
+
const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'.split('');
|
|
91
35
|
exports.colors = [
|
|
92
36
|
'amaranth',
|
|
93
37
|
'amber',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-workspace-id.js","sourceRoot":"","sources":["../../src/util/generate-workspace-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-workspace-id.js","sourceRoot":"","sources":["../../src/util/generate-workspace-id.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,qDAAsD;AAEtD,SAAsB,mBAAmB;;QACrC,OAAO,CAAC,MAAM,MAAM,CAAC,cAAM,CAAC,CAAC,GAAC,GAAG,GAAC,CAAC,MAAM,MAAM,CAAC,eAAO,CAAC,CAAC,GAAC,GAAG,GAAC,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAA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ACN,SAAS;IACT,QAAQ;IACR,OAAO;IACP,SAAS;IACT,WAAW;IACX,SAAS;IACT,YAAY;IACZ,UAAU;IACV,MAAM;IACN,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,MAAM;IACN,MAAM;IACN,SAAS;IACT,KAAK;IACL,OAAO;IACP,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,SAAS;IACT,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,UAAU;IACV,OAAO;IACP,OAAO;IACP,KAAK;IACL,OAAO;IACP,OAAO;IACP,KAAK;IACL,SAAS;CACV,CAAA"}
|
|
@@ -22,87 +22,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
-
default:
|
|
40
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
-
if (t[2]) _.ops.pop();
|
|
45
|
-
_.trys.pop(); continue;
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const mocha_typescript_1 = require("mocha-typescript");
|
|
27
|
+
const chai = require("chai");
|
|
28
|
+
const generate_workspace_id_1 = require("./generate-workspace-id");
|
|
29
|
+
const gitpod_host_url_1 = require("./gitpod-host-url");
|
|
30
|
+
const expect = chai.expect;
|
|
31
|
+
let TestGenerateWorkspaceId = class TestGenerateWorkspaceId {
|
|
32
|
+
testGenerateWorkspaceId() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
for (let i = 0; i < 100; i++) {
|
|
35
|
+
const id = yield (0, generate_workspace_id_1.generateWorkspaceID)();
|
|
36
|
+
expect(new gitpod_host_url_1.GitpodHostUrl().withWorkspacePrefix(id, "eu").workspaceId).to.equal(id);
|
|
46
37
|
}
|
|
47
|
-
|
|
48
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
38
|
+
});
|
|
50
39
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var gitpod_host_url_1 = require("./gitpod-host-url");
|
|
57
|
-
var expect = chai.expect;
|
|
58
|
-
var TestGenerateWorkspaceId = /** @class */ (function () {
|
|
59
|
-
function TestGenerateWorkspaceId() {
|
|
40
|
+
testLongestName() {
|
|
41
|
+
const longestColor = generate_workspace_id_1.colors.sort((a, b) => b.length - a.length)[0];
|
|
42
|
+
const longestAnimal = generate_workspace_id_1.animals.sort((a, b) => b.length - a.length)[0];
|
|
43
|
+
const longestName = `${longestColor}-${longestAnimal}-12345678`;
|
|
44
|
+
expect(longestName.length <= 36, `"${longestName}" is longer than 36 chars (${longestName.length})`).to.be.true;
|
|
60
45
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
i++;
|
|
78
|
-
return [3 /*break*/, 1];
|
|
79
|
-
case 4: return [2 /*return*/];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
TestGenerateWorkspaceId.prototype.testLongestName = function () {
|
|
85
|
-
var longestColor = generate_workspace_id_1.colors.sort(function (a, b) { return b.length - a.length; })[0];
|
|
86
|
-
var longestAnimal = generate_workspace_id_1.animals.sort(function (a, b) { return b.length - a.length; })[0];
|
|
87
|
-
var longestName = longestColor + "-" + longestAnimal + "-12345678";
|
|
88
|
-
expect(longestName.length <= 36, "\"" + longestName + "\" is longer than 36 chars (" + longestName.length + ")").to.be.true;
|
|
89
|
-
};
|
|
90
|
-
__decorate([
|
|
91
|
-
mocha_typescript_1.test,
|
|
92
|
-
__metadata("design:type", Function),
|
|
93
|
-
__metadata("design:paramtypes", []),
|
|
94
|
-
__metadata("design:returntype", Promise)
|
|
95
|
-
], TestGenerateWorkspaceId.prototype, "testGenerateWorkspaceId", null);
|
|
96
|
-
__decorate([
|
|
97
|
-
mocha_typescript_1.test,
|
|
98
|
-
__metadata("design:type", Function),
|
|
99
|
-
__metadata("design:paramtypes", []),
|
|
100
|
-
__metadata("design:returntype", void 0)
|
|
101
|
-
], TestGenerateWorkspaceId.prototype, "testLongestName", null);
|
|
102
|
-
TestGenerateWorkspaceId = __decorate([
|
|
103
|
-
mocha_typescript_1.suite
|
|
104
|
-
], TestGenerateWorkspaceId);
|
|
105
|
-
return TestGenerateWorkspaceId;
|
|
106
|
-
}());
|
|
46
|
+
};
|
|
47
|
+
__decorate([
|
|
48
|
+
mocha_typescript_1.test,
|
|
49
|
+
__metadata("design:type", Function),
|
|
50
|
+
__metadata("design:paramtypes", []),
|
|
51
|
+
__metadata("design:returntype", Promise)
|
|
52
|
+
], TestGenerateWorkspaceId.prototype, "testGenerateWorkspaceId", null);
|
|
53
|
+
__decorate([
|
|
54
|
+
mocha_typescript_1.test,
|
|
55
|
+
__metadata("design:type", Function),
|
|
56
|
+
__metadata("design:paramtypes", []),
|
|
57
|
+
__metadata("design:returntype", void 0)
|
|
58
|
+
], TestGenerateWorkspaceId.prototype, "testLongestName", null);
|
|
59
|
+
TestGenerateWorkspaceId = __decorate([
|
|
60
|
+
mocha_typescript_1.suite
|
|
61
|
+
], TestGenerateWorkspaceId);
|
|
107
62
|
module.exports = new TestGenerateWorkspaceId();
|
|
108
63
|
//# sourceMappingURL=generate-workspace-id.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-workspace-id.spec.js","sourceRoot":"","sources":["../../src/util/generate-workspace-id.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"generate-workspace-id.spec.js","sourceRoot":"","sources":["../../src/util/generate-workspace-id.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;AAEH,uDAA8C;AAC9C,6BAA4B;AAC5B,mEAA+E;AAC/E,uDAAkD;AAElD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;AAEnB,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAEb,uBAAuB;;YACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;gBAC1B,MAAM,EAAE,GAAG,MAAM,IAAA,2CAAmB,GAAE,CAAC;gBACvC,MAAM,CAAC,IAAI,+BAAa,EAAE,CAAC,mBAAmB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aACtF;QACL,CAAC;KAAA;IAEY,eAAe;QACxB,MAAM,YAAY,GAAG,8BAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,MAAM,aAAa,GAAG,+BAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,MAAM,WAAW,GAAG,GAAG,YAAY,IAAI,aAAa,WAAW,CAAC;QAChE,MAAM,CAAC,WAAW,CAAC,MAAM,IAAI,EAAE,EAAE,IAAI,WAAW,8BAA8B,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACpH,CAAC;CAEJ,CAAA;AAdS;IAAL,uBAAI;;;;sEAKJ;AAEK;IAAL,uBAAI;;;;8DAKJ;AAdQ,uBAAuB;IAAnC,wBAAK;GAAO,uBAAuB,CAgBnC;AACD,MAAM,CAAC,OAAO,GAAG,IAAI,uBAAuB,EAAE,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
import * as cookie from 'cookie';
|
|
7
|
+
/**
|
|
8
|
+
* This cookie indicates whether the connected client is a Gitpod user (= "has logged in within the last year") or not.
|
|
9
|
+
* This is used by "gitpod.io" and "www.gitpod.io" to display different content/buttons.
|
|
10
|
+
*/
|
|
11
|
+
export declare const NAME = "gitpod-user";
|
|
12
|
+
export declare const VALUE = "true";
|
|
13
|
+
/**
|
|
14
|
+
* @param domain The domain the Gitpod installation is installed onto
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export declare function options(domain: string): cookie.CookieSerializeOptions;
|
|
18
|
+
export declare function generateCookie(domain: string): string;
|
|
19
|
+
export declare function isPresent(cookies: string): boolean;
|
|
20
|
+
//# sourceMappingURL=gitpod-cookie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitpod-cookie.d.ts","sourceRoot":"","sources":["../../src/util/gitpod-cookie.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC;;;GAGG;AACH,eAAO,MAAM,IAAI,gBAAgB,CAAC;AAClC,eAAO,MAAM,KAAK,SAAS,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,sBAAsB,CAUrE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAGlD"}
|