@gitpod/gitpod-protocol 0.1.5-wth-update-mysql-dependencies-2.31 → 0.1.5-wth-test.80
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 +25 -24
- package/lib/accounting-protocol.d.ts +3 -6
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +10 -16
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +26 -4
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +15 -0
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +44 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/context-url.d.ts +31 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +102 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +14 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +94 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/email-protocol.d.ts +1 -2
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js +4 -4
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.js +5 -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.d.ts +1 -2
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +20 -21
- 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 +124 -22
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +169 -278
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +8 -11
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +4 -7
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-protocol.d.ts +105 -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 +6 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +27 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +30 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- package/lib/messaging/browser/connection.d.ts +5 -3
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +183 -33
- 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.d.ts +35 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +83 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/error.d.ts +3 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +6 -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 +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +23 -59
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +2 -0
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +74 -159
- 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.d.ts +8 -1
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +36 -15
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +210 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +570 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +121 -54
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +117 -131
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.d.ts +4 -4
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +15 -12
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +113 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +30 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/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.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.d.ts +1 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +31 -68
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +57 -78
- 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 -2
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +95 -98
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +7 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +103 -31
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +15 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +18 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/jaeger-client-types.d.ts +68 -0
- package/lib/util/jaeger-client-types.d.ts.map +1 -0
- package/lib/util/{without.js → jaeger-client-types.js} +1 -1
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +49 -33
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +107 -110
- 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 +32 -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/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 +28 -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 +51 -5
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +197 -62
- 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 +3 -2
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +76 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +33 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +24 -2
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.js +2 -2
- package/package.json +31 -17
- package/pkg-yarn.lock +17 -9
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +4 -10
- package/src/admin-protocol.ts +47 -5
- package/src/analytics.ts +52 -0
- package/src/context-url.spec.ts +53 -0
- package/src/context-url.ts +107 -0
- package/src/email-protocol.ts +2 -3
- package/src/env.ts +10 -10
- package/src/gitpod-service.ts +181 -44
- package/src/headless-workspace-log.ts +7 -11
- package/src/ide-frontend-service.ts +1 -1
- package/src/ide-protocol.ts +119 -0
- package/src/index.ts +7 -1
- package/src/installation-admin-protocol.ts +42 -0
- package/src/messaging/browser/connection.ts +195 -14
- package/src/messaging/client-call-metrics.ts +97 -0
- package/src/messaging/error.ts +8 -2
- package/src/messaging/handler.ts +12 -0
- package/src/messaging/node/connection.ts +21 -68
- package/src/messaging/proxy-factory.ts +14 -6
- package/src/oss-allowlist.ts +15 -0
- package/src/permission.ts +24 -4
- package/src/plans.ts +632 -0
- package/src/protocol.ts +196 -85
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +7 -5
- package/src/teams-projects-protocol.ts +147 -0
- package/src/util/analytics.ts +105 -0
- package/src/util/deferred.ts +1 -1
- package/src/util/garbage-collected-cache.ts +9 -3
- package/src/util/generate-workspace-id.spec.ts +20 -3
- package/src/util/generate-workspace-id.ts +22 -2
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.spec.ts +25 -1
- package/src/util/gitpod-host-url.ts +22 -13
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +102 -38
- package/src/util/parse-workspace-id.spec.ts +21 -1
- package/src/util/parse-workspace-id.ts +32 -6
- package/src/util/queue.spec.ts +1 -1
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +2 -2
- package/src/util/skip-if.ts +1 -1
- package/src/util/timeutil.ts +4 -4
- package/src/util/tracing.spec.ts +83 -0
- package/src/util/tracing.ts +183 -17
- package/src/workspace-cluster.ts +104 -0
- package/src/workspace-instance.ts +45 -13
- package/src/wsready.ts +2 -2
- package/lib/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -46
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/util/context-url.d.ts +0 -13
- package/lib/util/context-url.d.ts.map +0 -1
- package/lib/util/context-url.js +0 -26
- package/lib/util/context-url.js.map +0 -1
- package/lib/util/context-url.spec.d.ts +0 -10
- package/lib/util/context-url.spec.d.ts.map +0 -1
- package/lib/util/context-url.spec.js +0 -52
- package/lib/util/context-url.spec.js.map +0 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/lib/util/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -34
- package/lib/util/safe-promise.js.map +0 -1
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js.map +0 -1
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/util/context-url.spec.ts +0 -25
- package/src/util/context-url.ts +0 -23
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
|
@@ -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,40 @@ 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
|
-
|
|
46
|
-
function generateWorkspaceID() {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
});
|
|
18
|
+
const randomNumber = require("random-number-csprng");
|
|
19
|
+
function generateWorkspaceID(firstSegment, secondSegment) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const firstSeg = clean(firstSegment) || (yield random(exports.colors));
|
|
22
|
+
const secSeg = clean(secondSegment, Math.min(15, 23 - firstSeg.length)) || (yield random(exports.animals));
|
|
23
|
+
return firstSeg + '-' + secSeg + '-' + (yield random(characters, 11));
|
|
61
24
|
});
|
|
62
25
|
}
|
|
63
26
|
exports.generateWorkspaceID = generateWorkspaceID;
|
|
64
|
-
function
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
});
|
|
27
|
+
function clean(segment, maxChars = 15) {
|
|
28
|
+
if (!segment) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
segment = segment.toLowerCase();
|
|
32
|
+
let result = '';
|
|
33
|
+
for (let i = 0; i < segment.length; i++) {
|
|
34
|
+
if (characters.indexOf(segment[i]) !== -1) {
|
|
35
|
+
result += segment[i];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (result.length >= 2) {
|
|
39
|
+
return result.substring(0, maxChars);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function random(array, length = 1) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
var result = '';
|
|
45
|
+
for (var i = 0; i < length; i++) {
|
|
46
|
+
result += array[yield randomNumber(0, array.length - 1)];
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
88
49
|
});
|
|
89
50
|
}
|
|
90
|
-
|
|
51
|
+
const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'.split('');
|
|
91
52
|
exports.colors = [
|
|
92
53
|
'amaranth',
|
|
93
54
|
'amber',
|
|
@@ -117,6 +78,7 @@ exports.colors = [
|
|
|
117
78
|
'indigo',
|
|
118
79
|
'ivory',
|
|
119
80
|
'jade',
|
|
81
|
+
'kumquat',
|
|
120
82
|
'lavender',
|
|
121
83
|
'lime',
|
|
122
84
|
'magenta',
|
|
@@ -240,6 +202,7 @@ exports.animals = [
|
|
|
240
202
|
'deer',
|
|
241
203
|
'dingo',
|
|
242
204
|
'dinosaur',
|
|
205
|
+
'dodo',
|
|
243
206
|
'dog',
|
|
244
207
|
'dolphin',
|
|
245
208
|
'donkey',
|
|
@@ -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,CAAC,YAAqB,EAAE,aAAsB;;QACnF,MAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,KAAI,MAAM,MAAM,CAAC,cAAM,CAAC,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AAA"}
|
|
@@ -22,87 +22,66 @@ 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
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
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
|
-
});
|
|
46
|
+
testCustomName() {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const data = [
|
|
49
|
+
['foo', 'bar', 'foo-bar-'],
|
|
50
|
+
['f', 'bar', '.{2,16}-bar-'],
|
|
51
|
+
['gitpod-io', 'gitpod', 'gitpodio-gitpod-'],
|
|
52
|
+
['this is rather long and has some "§$"% special chars', 'also here pretty long and needs abbreviation', 'thisisratherlon-alsohere-'],
|
|
53
|
+
['breatheco-de', 'python-flask-api-tutorial', 'breathecode-pythonflaska-'],
|
|
54
|
+
['UPPER', "CaSe", "upper-case-"]
|
|
55
|
+
];
|
|
56
|
+
for (const d of data) {
|
|
57
|
+
const id = yield (0, generate_workspace_id_1.generateWorkspaceID)(d[0], d[1]);
|
|
58
|
+
expect(id).match(new RegExp("^" + d[2]));
|
|
59
|
+
expect(new gitpod_host_url_1.GitpodHostUrl().withWorkspacePrefix(id, "eu").workspaceId).to.equal(id);
|
|
60
|
+
expect(id.length <= 36, `"${id}" is longer than 36 chars (${id.length})`).to.be.true;
|
|
61
|
+
}
|
|
82
62
|
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}());
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
__decorate([
|
|
66
|
+
mocha_typescript_1.test,
|
|
67
|
+
__metadata("design:type", Function),
|
|
68
|
+
__metadata("design:paramtypes", []),
|
|
69
|
+
__metadata("design:returntype", Promise)
|
|
70
|
+
], TestGenerateWorkspaceId.prototype, "testGenerateWorkspaceId", null);
|
|
71
|
+
__decorate([
|
|
72
|
+
mocha_typescript_1.test,
|
|
73
|
+
__metadata("design:type", Function),
|
|
74
|
+
__metadata("design:paramtypes", []),
|
|
75
|
+
__metadata("design:returntype", void 0)
|
|
76
|
+
], TestGenerateWorkspaceId.prototype, "testLongestName", null);
|
|
77
|
+
__decorate([
|
|
78
|
+
mocha_typescript_1.test,
|
|
79
|
+
__metadata("design:type", Function),
|
|
80
|
+
__metadata("design:paramtypes", []),
|
|
81
|
+
__metadata("design:returntype", Promise)
|
|
82
|
+
], TestGenerateWorkspaceId.prototype, "testCustomName", null);
|
|
83
|
+
TestGenerateWorkspaceId = __decorate([
|
|
84
|
+
mocha_typescript_1.suite
|
|
85
|
+
], TestGenerateWorkspaceId);
|
|
107
86
|
module.exports = new TestGenerateWorkspaceId();
|
|
108
87
|
//# 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,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,CAAC,EAAE,CAAC,IAAI,CAAC;aACxF;QACL,CAAC;KAAA;CAEJ,CAAA;AA/BS;IAAL,uBAAI;;;;sEAKJ;AAEK;IAAL,uBAAI;;;;8DAKJ;AAEK;IAAL,uBAAI;;;;6DAeJ;AA/BQ,uBAAuB;IAAnC,wBAAK;GAAO,uBAAuB,CAiCnC;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"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPresent = exports.generateCookie = exports.options = exports.VALUE = exports.NAME = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
6
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
7
|
+
* See License-AGPL.txt in the project root for license information.
|
|
8
|
+
*/
|
|
9
|
+
const cookie = require("cookie");
|
|
10
|
+
/**
|
|
11
|
+
* This cookie indicates whether the connected client is a Gitpod user (= "has logged in within the last year") or not.
|
|
12
|
+
* This is used by "gitpod.io" and "www.gitpod.io" to display different content/buttons.
|
|
13
|
+
*/
|
|
14
|
+
exports.NAME = "gitpod-user";
|
|
15
|
+
exports.VALUE = "true";
|
|
16
|
+
/**
|
|
17
|
+
* @param domain The domain the Gitpod installation is installed onto
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
function options(domain) {
|
|
21
|
+
// Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
|
|
22
|
+
return {
|
|
23
|
+
path: "/",
|
|
24
|
+
httpOnly: false,
|
|
25
|
+
secure: false,
|
|
26
|
+
maxAge: 60 * 60 * 24 * 365,
|
|
27
|
+
sameSite: "lax",
|
|
28
|
+
domain: `.${domain}`, // explicilty include subdomains to not only cover "gitpod.io", but also "www.gitpod.io" or workspaces
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.options = options;
|
|
32
|
+
;
|
|
33
|
+
function generateCookie(domain) {
|
|
34
|
+
return cookie.serialize(exports.NAME, exports.VALUE, options(domain));
|
|
35
|
+
}
|
|
36
|
+
exports.generateCookie = generateCookie;
|
|
37
|
+
;
|
|
38
|
+
function isPresent(cookies) {
|
|
39
|
+
// needs to match the old (gitpod-user=loggedIn) and new (gitpod-user=true) values to ensure a smooth transition during rollout.
|
|
40
|
+
return !!cookies.match(`${exports.NAME}=`);
|
|
41
|
+
}
|
|
42
|
+
exports.isPresent = isPresent;
|
|
43
|
+
;
|
|
44
|
+
//# sourceMappingURL=gitpod-cookie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitpod-cookie.js","sourceRoot":"","sources":["../../src/util/gitpod-cookie.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,iCAAiC;AAGjC;;;GAGG;AACU,QAAA,IAAI,GAAG,aAAa,CAAC;AACrB,QAAA,KAAK,GAAG,MAAM,CAAC;AAE5B;;;GAGG;AACH,SAAgB,OAAO,CAAC,MAAc;IAClC,uEAAuE;IACvE,OAAO;QACH,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG;QAC1B,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,IAAI,MAAM,EAAE,EAAgB,sGAAsG;KAC7I,CAAC;AACN,CAAC;AAVD,0BAUC;AAAA,CAAC;AAEF,SAAgB,cAAc,CAAC,MAAc;IACzC,OAAO,MAAM,CAAC,SAAS,CAAC,YAAI,EAAE,aAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1D,CAAC;AAFD,wCAEC;AAAA,CAAC;AAEF,SAAgB,SAAS,CAAC,OAAe;IACrC,gIAAgI;IAChI,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,YAAI,GAAG,CAAC,CAAC;AACvC,CAAC;AAHD,8BAGC;AAAA,CAAC"}
|
|
@@ -7,7 +7,6 @@ export interface UrlChange {
|
|
|
7
7
|
(old: URL): Partial<URL>;
|
|
8
8
|
}
|
|
9
9
|
export declare type UrlUpdate = UrlChange | Partial<URL>;
|
|
10
|
-
export declare const workspaceIDRegex: RegExp;
|
|
11
10
|
export declare class GitpodHostUrl {
|
|
12
11
|
readonly url: URL;
|
|
13
12
|
constructor(urlParam?: string | URL);
|
|
@@ -25,7 +24,7 @@ export declare class GitpodHostUrl {
|
|
|
25
24
|
asUpgradeSubscription(): GitpodHostUrl;
|
|
26
25
|
asAccessControl(): GitpodHostUrl;
|
|
27
26
|
asSettings(): GitpodHostUrl;
|
|
28
|
-
|
|
27
|
+
asPreferences(): GitpodHostUrl;
|
|
29
28
|
asStart(workspaceId?: string | undefined): GitpodHostUrl;
|
|
30
29
|
asWorkspaceAuth(instanceID: string, redirect?: boolean): GitpodHostUrl;
|
|
31
30
|
toString(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitpod-host-url.d.ts","sourceRoot":"","sources":["../../src/util/gitpod-host-url.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,SAAS;IACtB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;CAC3B;AACD,oBAAY,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"gitpod-host-url.d.ts","sourceRoot":"","sources":["../../src/util/gitpod-host-url.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,SAAS;IACtB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;CAC3B;AACD,oBAAY,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAUjD,qBAAa,aAAa;IACtB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;gBAEN,QAAQ,CAAC,EAAE,MAAM,GAAG,GAAG;IAanC,MAAM,CAAC,gBAAgB,CAAC,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