@gitpod/gitpod-protocol 0.1.5-tar-telemetry-settings-data.0 → 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 +57 -27
- 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 +5 -1
- 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 +189 -112
- 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 +13 -9
- 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/lib/protocol.js
CHANGED
|
@@ -5,39 +5,47 @@
|
|
|
5
5
|
* See License-AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.TheiaPlugin = exports.AuthProviderEntry = exports.WorkspaceCreationResult = exports.CreateWorkspaceMode = exports.WorkspaceInfo = exports.WorkspaceInstancePortsChangedEvent = exports.Repository = exports.NavigatorContext = exports.IssueContext = exports.PullRequestContext = exports.CommitContext = exports.AdditionalContentContext = exports.RefType = exports.WorkspaceProbeContext = exports.WithEnvvarsContext = exports.WithReferrerContext = exports.PrebuiltWorkspaceContext = exports.StartPrebuildContext = exports.SnapshotContext = exports.WithDefaultConfig = exports.WithPrebuild = exports.WithSnapshot = exports.WorkspaceContext = exports.ExternalImageConfigFile = exports.ImageConfigFile = exports.ImageConfigString = exports.WorkspaceImageBuild = exports.TaskConfig = exports.PortRangeConfig = exports.PortConfig = exports.PrebuiltWorkspace = exports.WorkspaceImageSourceReference = exports.WorkspaceImageSourceDocker = exports.GithubAppPrebuildConfig = exports.Workspace = exports.Identity = exports.GitpodTokenType = exports.UserEnvVar = exports.WorkspaceFeatureFlags = exports.User = void 0;
|
|
8
|
+
exports.TheiaPlugin = exports.AuthProviderEntry = exports.WorkspaceCreationResult = exports.CreateWorkspaceMode = exports.WorkspaceInfo = exports.WorkspaceInstancePortsChangedEvent = exports.Repository = exports.NavigatorContext = exports.IssueContext = exports.PullRequestContext = exports.CommitContext = exports.AdditionalContentContext = exports.RefType = exports.WorkspaceProbeContext = exports.WithEnvvarsContext = exports.WithReferrerContext = exports.PrebuiltWorkspaceContext = exports.StartPrebuildContext = exports.SnapshotContext = exports.WithDefaultConfig = exports.WithPrebuild = exports.WithSnapshot = exports.WorkspaceContext = exports.ExternalImageConfigFile = exports.ImageConfigFile = exports.ImageConfigString = exports.WorkspaceImageBuild = exports.TaskConfig = exports.PortRangeConfig = exports.PortConfig = exports.PrebuiltWorkspace = exports.WorkspaceImageSourceReference = exports.WorkspaceImageSourceDocker = exports.GithubAppPrebuildConfig = exports.Workspace = exports.Identity = exports.GitpodTokenType = exports.SSHPublicKeyValue = exports.UserEnvVar = exports.WorkspaceFeatureFlags = exports.AdditionalUserData = exports.User = void 0;
|
|
9
|
+
const crypto_1 = require("crypto");
|
|
9
10
|
var User;
|
|
10
11
|
(function (User) {
|
|
11
12
|
function is(data) {
|
|
12
|
-
return data
|
|
13
|
-
&& data.hasOwnProperty('id')
|
|
14
|
-
&& data.hasOwnProperty('identities');
|
|
13
|
+
return data && data.hasOwnProperty("id") && data.hasOwnProperty("identities");
|
|
15
14
|
}
|
|
16
15
|
User.is = is;
|
|
17
16
|
function getIdentity(user, authProviderId) {
|
|
18
|
-
return user.identities.find(id => id.authProviderId === authProviderId);
|
|
17
|
+
return user.identities.find((id) => id.authProviderId === authProviderId);
|
|
19
18
|
}
|
|
20
19
|
User.getIdentity = getIdentity;
|
|
21
20
|
function censor(user) {
|
|
22
21
|
const res = Object.assign({}, user);
|
|
23
|
-
delete
|
|
24
|
-
res.identities = res.identities.map(i => {
|
|
25
|
-
delete
|
|
22
|
+
delete res.additionalData;
|
|
23
|
+
res.identities = res.identities.map((i) => {
|
|
24
|
+
delete i.tokens;
|
|
26
25
|
// The user field is not in the Identity shape, but actually exists on DBIdentity.
|
|
27
26
|
// Trying to push this object out via JSON RPC will fail because of the cyclic nature
|
|
28
27
|
// of this field.
|
|
29
|
-
delete
|
|
28
|
+
delete i.user;
|
|
30
29
|
return i;
|
|
31
30
|
});
|
|
32
31
|
return res;
|
|
33
32
|
}
|
|
34
33
|
User.censor = censor;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the stored email or if it doesn't exist returns the primaryEmail of the first identity this user signed up with.
|
|
36
|
+
* @param user
|
|
37
|
+
* @returns A primaryEmail, or undefined if there is none.
|
|
38
|
+
*/
|
|
35
39
|
function getPrimaryEmail(user) {
|
|
36
|
-
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
if ((_b = (_a = user.additionalData) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.emailAddress) {
|
|
42
|
+
return (_d = (_c = user.additionalData) === null || _c === void 0 ? void 0 : _c.profile) === null || _d === void 0 ? void 0 : _d.emailAddress;
|
|
43
|
+
}
|
|
44
|
+
const identities = user.identities.filter((i) => !!i.primaryEmail);
|
|
37
45
|
if (identities.length <= 0) {
|
|
38
|
-
|
|
46
|
+
return undefined;
|
|
39
47
|
}
|
|
40
|
-
return identities[0].primaryEmail;
|
|
48
|
+
return identities[0].primaryEmail || undefined;
|
|
41
49
|
}
|
|
42
50
|
User.getPrimaryEmail = getPrimaryEmail;
|
|
43
51
|
function getName(user) {
|
|
@@ -53,14 +61,148 @@ var User;
|
|
|
53
61
|
return undefined;
|
|
54
62
|
}
|
|
55
63
|
User.getName = getName;
|
|
64
|
+
function hasPreferredIde(user) {
|
|
65
|
+
var _a, _b, _c, _d;
|
|
66
|
+
return (typeof ((_b = (_a = user === null || user === void 0 ? void 0 : user.additionalData) === null || _a === void 0 ? void 0 : _a.ideSettings) === null || _b === void 0 ? void 0 : _b.defaultIde) !== "undefined" ||
|
|
67
|
+
typeof ((_d = (_c = user === null || user === void 0 ? void 0 : user.additionalData) === null || _c === void 0 ? void 0 : _c.ideSettings) === null || _d === void 0 ? void 0 : _d.useLatestVersion) !== "undefined");
|
|
68
|
+
}
|
|
69
|
+
User.hasPreferredIde = hasPreferredIde;
|
|
70
|
+
function isOnboardingUser(user) {
|
|
71
|
+
return !hasPreferredIde(user);
|
|
72
|
+
}
|
|
73
|
+
User.isOnboardingUser = isOnboardingUser;
|
|
74
|
+
function migrationIDESettings(user) {
|
|
75
|
+
var _a;
|
|
76
|
+
if (!((_a = user === null || user === void 0 ? void 0 : user.additionalData) === null || _a === void 0 ? void 0 : _a.ideSettings) ||
|
|
77
|
+
Object.keys(user.additionalData.ideSettings).length === 0 ||
|
|
78
|
+
user.additionalData.ideSettings.settingVersion === "2.0") {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const newIDESettings = {
|
|
82
|
+
settingVersion: "2.0",
|
|
83
|
+
};
|
|
84
|
+
const ideSettings = user.additionalData.ideSettings;
|
|
85
|
+
if (ideSettings.useDesktopIde) {
|
|
86
|
+
if (ideSettings.defaultDesktopIde === "code-desktop") {
|
|
87
|
+
newIDESettings.defaultIde = "code-desktop";
|
|
88
|
+
}
|
|
89
|
+
else if (ideSettings.defaultDesktopIde === "code-desktop-insiders") {
|
|
90
|
+
newIDESettings.defaultIde = "code-desktop";
|
|
91
|
+
newIDESettings.useLatestVersion = true;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
newIDESettings.defaultIde = ideSettings.defaultDesktopIde;
|
|
95
|
+
newIDESettings.useLatestVersion = ideSettings.useLatestVersion;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const useLatest = ideSettings.defaultIde === "code-latest";
|
|
100
|
+
newIDESettings.defaultIde = "code";
|
|
101
|
+
newIDESettings.useLatestVersion = useLatest;
|
|
102
|
+
}
|
|
103
|
+
user.additionalData.ideSettings = newIDESettings;
|
|
104
|
+
}
|
|
105
|
+
User.migrationIDESettings = migrationIDESettings;
|
|
106
|
+
function getProfile(user) {
|
|
107
|
+
var _a, _b;
|
|
108
|
+
return {
|
|
109
|
+
name: User.getName(user) || "",
|
|
110
|
+
email: User.getPrimaryEmail(user) || "",
|
|
111
|
+
company: (_b = (_a = user === null || user === void 0 ? void 0 : user.additionalData) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.companyName,
|
|
112
|
+
avatarURL: user === null || user === void 0 ? void 0 : user.avatarUrl,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
User.getProfile = getProfile;
|
|
116
|
+
function setProfile(user, profile) {
|
|
117
|
+
user.fullName = profile.name;
|
|
118
|
+
user.avatarUrl = profile.avatarURL;
|
|
119
|
+
if (!user.additionalData) {
|
|
120
|
+
user.additionalData = {};
|
|
121
|
+
}
|
|
122
|
+
if (!user.additionalData.profile) {
|
|
123
|
+
user.additionalData.profile = {};
|
|
124
|
+
}
|
|
125
|
+
user.additionalData.profile.emailAddress = profile.email;
|
|
126
|
+
user.additionalData.profile.companyName = profile.company;
|
|
127
|
+
user.additionalData.profile.lastUpdatedDetailsNudge = new Date().toISOString();
|
|
128
|
+
return user;
|
|
129
|
+
}
|
|
130
|
+
User.setProfile = setProfile;
|
|
131
|
+
let Profile;
|
|
132
|
+
(function (Profile) {
|
|
133
|
+
function hasChanges(before, after) {
|
|
134
|
+
return (before.name !== after.name ||
|
|
135
|
+
before.email !== after.email ||
|
|
136
|
+
before.company !== after.company ||
|
|
137
|
+
before.avatarURL !== after.avatarURL);
|
|
138
|
+
}
|
|
139
|
+
Profile.hasChanges = hasChanges;
|
|
140
|
+
})(Profile = User.Profile || (User.Profile = {}));
|
|
56
141
|
})(User = exports.User || (exports.User = {}));
|
|
142
|
+
var AdditionalUserData;
|
|
143
|
+
(function (AdditionalUserData) {
|
|
144
|
+
function set(user, partialData) {
|
|
145
|
+
if (!user.additionalData) {
|
|
146
|
+
user.additionalData = Object.assign({}, partialData);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
user.additionalData = Object.assign(Object.assign({}, user.additionalData), partialData);
|
|
150
|
+
}
|
|
151
|
+
return user;
|
|
152
|
+
}
|
|
153
|
+
AdditionalUserData.set = set;
|
|
154
|
+
})(AdditionalUserData = exports.AdditionalUserData || (exports.AdditionalUserData = {}));
|
|
57
155
|
/**
|
|
58
156
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
59
157
|
* If they don't we'll break things during workspace startup.
|
|
60
158
|
*/
|
|
61
|
-
exports.WorkspaceFeatureFlags = {
|
|
159
|
+
exports.WorkspaceFeatureFlags = {
|
|
160
|
+
full_workspace_backup: undefined,
|
|
161
|
+
persistent_volume_claim: undefined,
|
|
162
|
+
protected_secrets: undefined,
|
|
163
|
+
workspace_class_limiting: undefined,
|
|
164
|
+
};
|
|
62
165
|
var UserEnvVar;
|
|
63
166
|
(function (UserEnvVar) {
|
|
167
|
+
/**
|
|
168
|
+
* @param variable
|
|
169
|
+
* @returns Either a string containing an error message or undefined.
|
|
170
|
+
*/
|
|
171
|
+
function validate(variable) {
|
|
172
|
+
const name = variable.name;
|
|
173
|
+
const pattern = variable.repositoryPattern;
|
|
174
|
+
if (name.trim() === "") {
|
|
175
|
+
return "Name must not be empty.";
|
|
176
|
+
}
|
|
177
|
+
if (name.length > 255) {
|
|
178
|
+
return "Name too long. Maximum name length is 255 characters.";
|
|
179
|
+
}
|
|
180
|
+
if (!/^[a-zA-Z_]+[a-zA-Z0-9_]*$/.test(name)) {
|
|
181
|
+
return "Name must match /^[a-zA-Z_]+[a-zA-Z0-9_]*$/.";
|
|
182
|
+
}
|
|
183
|
+
if (variable.value.trim() === "") {
|
|
184
|
+
return "Value must not be empty.";
|
|
185
|
+
}
|
|
186
|
+
if (variable.value.length > 32767) {
|
|
187
|
+
return "Value too long. Maximum value length is 32767 characters.";
|
|
188
|
+
}
|
|
189
|
+
if (pattern.trim() === "") {
|
|
190
|
+
return "Scope must not be empty.";
|
|
191
|
+
}
|
|
192
|
+
const split = pattern.split("/");
|
|
193
|
+
if (split.length < 2) {
|
|
194
|
+
return "A scope must use the form 'organization/repo'.";
|
|
195
|
+
}
|
|
196
|
+
for (const name of split) {
|
|
197
|
+
if (name !== "*") {
|
|
198
|
+
if (!/^[a-zA-Z0-9_\-.\*]+$/.test(name)) {
|
|
199
|
+
return "Invalid scope segment. Only ASCII characters, numbers, -, _, . or * are allowed.";
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
UserEnvVar.validate = validate;
|
|
64
206
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
65
207
|
function normalizeRepoPattern(pattern) {
|
|
66
208
|
return pattern.toLocaleLowerCase();
|
|
@@ -80,7 +222,7 @@ var UserEnvVar;
|
|
|
80
222
|
if (repoPattern == "*") {
|
|
81
223
|
score += 1;
|
|
82
224
|
}
|
|
83
|
-
if (ownerPattern ==
|
|
225
|
+
if (ownerPattern == "*") {
|
|
84
226
|
score += 2;
|
|
85
227
|
}
|
|
86
228
|
if (ownerPattern == "#" || repoPattern == "#") {
|
|
@@ -91,19 +233,19 @@ var UserEnvVar;
|
|
|
91
233
|
UserEnvVar.score = score;
|
|
92
234
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
93
235
|
function filter(vars, owner, repo) {
|
|
94
|
-
let result = vars.filter(e => {
|
|
236
|
+
let result = vars.filter((e) => {
|
|
95
237
|
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
96
|
-
if (ownerPattern !==
|
|
238
|
+
if (ownerPattern !== "*" && ownerPattern !== "#" && !!owner && ownerPattern !== owner.toLocaleLowerCase()) {
|
|
97
239
|
return false;
|
|
98
240
|
}
|
|
99
|
-
if (repoPattern !==
|
|
241
|
+
if (repoPattern !== "*" && repoPattern !== "#" && !!repo && repoPattern !== repo.toLocaleLowerCase()) {
|
|
100
242
|
return false;
|
|
101
243
|
}
|
|
102
244
|
return true;
|
|
103
245
|
});
|
|
104
246
|
const resmap = new Map();
|
|
105
|
-
result.forEach(e => {
|
|
106
|
-
const l =
|
|
247
|
+
result.forEach((e) => {
|
|
248
|
+
const l = resmap.get(e.name) || [];
|
|
107
249
|
l.push(e);
|
|
108
250
|
resmap.set(e.name, l);
|
|
109
251
|
});
|
|
@@ -134,13 +276,61 @@ var UserEnvVar;
|
|
|
134
276
|
UserEnvVar.filter = filter;
|
|
135
277
|
// DEPRECATED: Use ProjectEnvVar instead of repositoryPattern - https://github.com/gitpod-com/gitpod/issues/5322
|
|
136
278
|
function splitRepositoryPattern(repositoryPattern) {
|
|
137
|
-
const patterns = repositoryPattern.split(
|
|
138
|
-
const repoPattern = patterns.slice(1).join(
|
|
279
|
+
const patterns = repositoryPattern.split("/");
|
|
280
|
+
const repoPattern = patterns.slice(1).join("/");
|
|
139
281
|
const ownerPattern = patterns[0];
|
|
140
282
|
return [ownerPattern, repoPattern];
|
|
141
283
|
}
|
|
142
284
|
UserEnvVar.splitRepositoryPattern = splitRepositoryPattern;
|
|
143
285
|
})(UserEnvVar = exports.UserEnvVar || (exports.UserEnvVar = {}));
|
|
286
|
+
var SSHPublicKeyValue;
|
|
287
|
+
(function (SSHPublicKeyValue) {
|
|
288
|
+
function validate(value) {
|
|
289
|
+
if (value.name.length === 0) {
|
|
290
|
+
return "Title must not be empty.";
|
|
291
|
+
}
|
|
292
|
+
if (value.name.length > 255) {
|
|
293
|
+
return "Title too long. Maximum value length is 255 characters.";
|
|
294
|
+
}
|
|
295
|
+
if (value.key.length === 0) {
|
|
296
|
+
return "Key must not be empty.";
|
|
297
|
+
}
|
|
298
|
+
try {
|
|
299
|
+
getData(value);
|
|
300
|
+
}
|
|
301
|
+
catch (e) {
|
|
302
|
+
return "Key is invalid. You must supply a key in OpenSSH public key format.";
|
|
303
|
+
}
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
SSHPublicKeyValue.validate = validate;
|
|
307
|
+
function getData(value) {
|
|
308
|
+
var _a, _b, _c;
|
|
309
|
+
// Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'.
|
|
310
|
+
const regex = /^(?<type>ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-ed25519|sk-ecdsa-sha2-nistp256@openssh\.com|sk-ssh-ed25519@openssh\.com) (?<key>.*?)( (?<email>.*?))?$/;
|
|
311
|
+
const resultGroup = regex.exec(value.key.trim());
|
|
312
|
+
if (!resultGroup) {
|
|
313
|
+
throw new Error("Key is invalid.");
|
|
314
|
+
}
|
|
315
|
+
return {
|
|
316
|
+
type: (_a = resultGroup.groups) === null || _a === void 0 ? void 0 : _a["type"],
|
|
317
|
+
key: (_b = resultGroup.groups) === null || _b === void 0 ? void 0 : _b["key"],
|
|
318
|
+
email: ((_c = resultGroup.groups) === null || _c === void 0 ? void 0 : _c["email"]) || undefined,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
SSHPublicKeyValue.getData = getData;
|
|
322
|
+
function getFingerprint(value) {
|
|
323
|
+
const data = getData(value);
|
|
324
|
+
let buf = Buffer.from(data.key, "base64");
|
|
325
|
+
// gitlab style
|
|
326
|
+
// const hash = createHash("md5").update(buf).digest("hex");
|
|
327
|
+
// github style
|
|
328
|
+
const hash = (0, crypto_1.createHash)("sha256").update(buf).digest("base64");
|
|
329
|
+
return hash;
|
|
330
|
+
}
|
|
331
|
+
SSHPublicKeyValue.getFingerprint = getFingerprint;
|
|
332
|
+
SSHPublicKeyValue.MAXIMUM_KEY_LENGTH = 5;
|
|
333
|
+
})(SSHPublicKeyValue = exports.SSHPublicKeyValue || (exports.SSHPublicKeyValue = {}));
|
|
144
334
|
var GitpodTokenType;
|
|
145
335
|
(function (GitpodTokenType) {
|
|
146
336
|
GitpodTokenType[GitpodTokenType["API_AUTH_TOKEN"] = 0] = "API_AUTH_TOKEN";
|
|
@@ -149,14 +339,11 @@ var GitpodTokenType;
|
|
|
149
339
|
var Identity;
|
|
150
340
|
(function (Identity) {
|
|
151
341
|
function is(data) {
|
|
152
|
-
return data.hasOwnProperty(
|
|
153
|
-
&& data.hasOwnProperty('authId')
|
|
154
|
-
&& data.hasOwnProperty('authName');
|
|
342
|
+
return (data.hasOwnProperty("authProviderId") && data.hasOwnProperty("authId") && data.hasOwnProperty("authName"));
|
|
155
343
|
}
|
|
156
344
|
Identity.is = is;
|
|
157
345
|
function equals(id1, id2) {
|
|
158
|
-
return id1.authProviderId === id2.authProviderId
|
|
159
|
-
&& id1.authId === id2.authId;
|
|
346
|
+
return id1.authProviderId === id2.authProviderId && id1.authId === id2.authId;
|
|
160
347
|
}
|
|
161
348
|
Identity.equals = equals;
|
|
162
349
|
})(Identity = exports.Identity || (exports.Identity = {}));
|
|
@@ -164,7 +351,7 @@ var Workspace;
|
|
|
164
351
|
(function (Workspace) {
|
|
165
352
|
function getFullRepositoryName(ws) {
|
|
166
353
|
if (CommitContext.is(ws.context)) {
|
|
167
|
-
return ws.context.repository.owner +
|
|
354
|
+
return ws.context.repository.owner + "/" + ws.context.repository.name;
|
|
168
355
|
}
|
|
169
356
|
return undefined;
|
|
170
357
|
}
|
|
@@ -208,29 +395,28 @@ var Workspace;
|
|
|
208
395
|
var GithubAppPrebuildConfig;
|
|
209
396
|
(function (GithubAppPrebuildConfig) {
|
|
210
397
|
function is(obj) {
|
|
211
|
-
return !(typeof obj ===
|
|
398
|
+
return !(typeof obj === "boolean");
|
|
212
399
|
}
|
|
213
400
|
GithubAppPrebuildConfig.is = is;
|
|
214
401
|
})(GithubAppPrebuildConfig = exports.GithubAppPrebuildConfig || (exports.GithubAppPrebuildConfig = {}));
|
|
215
402
|
var WorkspaceImageSourceDocker;
|
|
216
403
|
(function (WorkspaceImageSourceDocker) {
|
|
217
404
|
function is(obj) {
|
|
218
|
-
return
|
|
219
|
-
&& 'dockerFilePath' in obj;
|
|
405
|
+
return "dockerFileHash" in obj && "dockerFilePath" in obj;
|
|
220
406
|
}
|
|
221
407
|
WorkspaceImageSourceDocker.is = is;
|
|
222
408
|
})(WorkspaceImageSourceDocker = exports.WorkspaceImageSourceDocker || (exports.WorkspaceImageSourceDocker = {}));
|
|
223
409
|
var WorkspaceImageSourceReference;
|
|
224
410
|
(function (WorkspaceImageSourceReference) {
|
|
225
411
|
function is(obj) {
|
|
226
|
-
return
|
|
412
|
+
return "baseImageResolved" in obj;
|
|
227
413
|
}
|
|
228
414
|
WorkspaceImageSourceReference.is = is;
|
|
229
415
|
})(WorkspaceImageSourceReference = exports.WorkspaceImageSourceReference || (exports.WorkspaceImageSourceReference = {}));
|
|
230
416
|
var PrebuiltWorkspace;
|
|
231
417
|
(function (PrebuiltWorkspace) {
|
|
232
418
|
function isDone(pws) {
|
|
233
|
-
return pws.state === "available" || pws.state === "timeout" || pws.state ===
|
|
419
|
+
return (pws.state === "available" || pws.state === "timeout" || pws.state === "aborted" || pws.state === "failed");
|
|
234
420
|
}
|
|
235
421
|
PrebuiltWorkspace.isDone = isDone;
|
|
236
422
|
function isAvailable(pws) {
|
|
@@ -245,22 +431,21 @@ var PrebuiltWorkspace;
|
|
|
245
431
|
var PortConfig;
|
|
246
432
|
(function (PortConfig) {
|
|
247
433
|
function is(config) {
|
|
248
|
-
return config &&
|
|
434
|
+
return config && "port" in config && typeof config.port === "number";
|
|
249
435
|
}
|
|
250
436
|
PortConfig.is = is;
|
|
251
437
|
})(PortConfig = exports.PortConfig || (exports.PortConfig = {}));
|
|
252
438
|
var PortRangeConfig;
|
|
253
439
|
(function (PortRangeConfig) {
|
|
254
440
|
function is(config) {
|
|
255
|
-
return config &&
|
|
441
|
+
return config && "port" in config && (typeof config.port === "string" || config.port instanceof String);
|
|
256
442
|
}
|
|
257
443
|
PortRangeConfig.is = is;
|
|
258
444
|
})(PortRangeConfig = exports.PortRangeConfig || (exports.PortRangeConfig = {}));
|
|
259
445
|
var TaskConfig;
|
|
260
446
|
(function (TaskConfig) {
|
|
261
447
|
function is(config) {
|
|
262
|
-
return config
|
|
263
|
-
&& ('command' in config || 'init' in config || 'before' in config);
|
|
448
|
+
return config && ("command" in config || "init" in config || "before" in config);
|
|
264
449
|
}
|
|
265
450
|
TaskConfig.is = is;
|
|
266
451
|
})(TaskConfig = exports.TaskConfig || (exports.TaskConfig = {}));
|
|
@@ -268,66 +453,56 @@ var WorkspaceImageBuild;
|
|
|
268
453
|
(function (WorkspaceImageBuild) {
|
|
269
454
|
let LogLine;
|
|
270
455
|
(function (LogLine) {
|
|
271
|
-
LogLine.DELIMITER =
|
|
456
|
+
LogLine.DELIMITER = "\r\n";
|
|
272
457
|
LogLine.DELIMITER_REGEX = /\r?\n/;
|
|
273
458
|
})(LogLine = WorkspaceImageBuild.LogLine || (WorkspaceImageBuild.LogLine = {}));
|
|
274
459
|
})(WorkspaceImageBuild = exports.WorkspaceImageBuild || (exports.WorkspaceImageBuild = {}));
|
|
275
460
|
var ImageConfigString;
|
|
276
461
|
(function (ImageConfigString) {
|
|
277
462
|
function is(config) {
|
|
278
|
-
return typeof config ===
|
|
463
|
+
return typeof config === "string";
|
|
279
464
|
}
|
|
280
465
|
ImageConfigString.is = is;
|
|
281
466
|
})(ImageConfigString = exports.ImageConfigString || (exports.ImageConfigString = {}));
|
|
282
467
|
var ImageConfigFile;
|
|
283
468
|
(function (ImageConfigFile) {
|
|
284
469
|
function is(config) {
|
|
285
|
-
return typeof config ===
|
|
286
|
-
&& 'file' in config;
|
|
470
|
+
return typeof config === "object" && "file" in config;
|
|
287
471
|
}
|
|
288
472
|
ImageConfigFile.is = is;
|
|
289
473
|
})(ImageConfigFile = exports.ImageConfigFile || (exports.ImageConfigFile = {}));
|
|
290
474
|
var ExternalImageConfigFile;
|
|
291
475
|
(function (ExternalImageConfigFile) {
|
|
292
476
|
function is(config) {
|
|
293
|
-
return typeof config ===
|
|
294
|
-
&& 'file' in config
|
|
295
|
-
&& 'externalSource' in config;
|
|
477
|
+
return typeof config === "object" && "file" in config && "externalSource" in config;
|
|
296
478
|
}
|
|
297
479
|
ExternalImageConfigFile.is = is;
|
|
298
480
|
})(ExternalImageConfigFile = exports.ExternalImageConfigFile || (exports.ExternalImageConfigFile = {}));
|
|
299
481
|
var WorkspaceContext;
|
|
300
482
|
(function (WorkspaceContext) {
|
|
301
483
|
function is(context) {
|
|
302
|
-
return context
|
|
303
|
-
&& 'title' in context;
|
|
484
|
+
return context && "title" in context;
|
|
304
485
|
}
|
|
305
486
|
WorkspaceContext.is = is;
|
|
306
487
|
})(WorkspaceContext = exports.WorkspaceContext || (exports.WorkspaceContext = {}));
|
|
307
488
|
var WithSnapshot;
|
|
308
489
|
(function (WithSnapshot) {
|
|
309
490
|
function is(context) {
|
|
310
|
-
return context
|
|
311
|
-
&& 'snapshotBucketId' in context;
|
|
491
|
+
return context && "snapshotBucketId" in context;
|
|
312
492
|
}
|
|
313
493
|
WithSnapshot.is = is;
|
|
314
494
|
})(WithSnapshot = exports.WithSnapshot || (exports.WithSnapshot = {}));
|
|
315
495
|
var WithPrebuild;
|
|
316
496
|
(function (WithPrebuild) {
|
|
317
497
|
function is(context) {
|
|
318
|
-
return context
|
|
319
|
-
&& 'snapshotBucketId' in context
|
|
320
|
-
&& 'prebuildWorkspaceId' in context
|
|
321
|
-
&& 'wasPrebuilt' in context;
|
|
498
|
+
return context && WithSnapshot.is(context) && "prebuildWorkspaceId" in context && "wasPrebuilt" in context;
|
|
322
499
|
}
|
|
323
500
|
WithPrebuild.is = is;
|
|
324
501
|
})(WithPrebuild = exports.WithPrebuild || (exports.WithPrebuild = {}));
|
|
325
502
|
var WithDefaultConfig;
|
|
326
503
|
(function (WithDefaultConfig) {
|
|
327
504
|
function is(context) {
|
|
328
|
-
return context
|
|
329
|
-
&& 'withDefaultConfig' in context
|
|
330
|
-
&& context.withDefaultConfig;
|
|
505
|
+
return context && "withDefaultConfig" in context && context.withDefaultConfig;
|
|
331
506
|
}
|
|
332
507
|
WithDefaultConfig.is = is;
|
|
333
508
|
function mark(ctx) {
|
|
@@ -338,51 +513,42 @@ var WithDefaultConfig;
|
|
|
338
513
|
var SnapshotContext;
|
|
339
514
|
(function (SnapshotContext) {
|
|
340
515
|
function is(context) {
|
|
341
|
-
return context
|
|
342
|
-
&& WithSnapshot.is(context)
|
|
343
|
-
&& 'snapshotId' in context;
|
|
516
|
+
return context && WithSnapshot.is(context) && "snapshotId" in context;
|
|
344
517
|
}
|
|
345
518
|
SnapshotContext.is = is;
|
|
346
519
|
})(SnapshotContext = exports.SnapshotContext || (exports.SnapshotContext = {}));
|
|
347
520
|
var StartPrebuildContext;
|
|
348
521
|
(function (StartPrebuildContext) {
|
|
349
522
|
function is(context) {
|
|
350
|
-
return context
|
|
351
|
-
&& 'actual' in context;
|
|
523
|
+
return context && "actual" in context;
|
|
352
524
|
}
|
|
353
525
|
StartPrebuildContext.is = is;
|
|
354
526
|
})(StartPrebuildContext = exports.StartPrebuildContext || (exports.StartPrebuildContext = {}));
|
|
355
527
|
var PrebuiltWorkspaceContext;
|
|
356
528
|
(function (PrebuiltWorkspaceContext) {
|
|
357
529
|
function is(context) {
|
|
358
|
-
return context
|
|
359
|
-
&& 'originalContext' in context
|
|
360
|
-
&& 'prebuiltWorkspace' in context;
|
|
530
|
+
return context && "originalContext" in context && "prebuiltWorkspace" in context;
|
|
361
531
|
}
|
|
362
532
|
PrebuiltWorkspaceContext.is = is;
|
|
363
533
|
})(PrebuiltWorkspaceContext = exports.PrebuiltWorkspaceContext || (exports.PrebuiltWorkspaceContext = {}));
|
|
364
534
|
var WithReferrerContext;
|
|
365
535
|
(function (WithReferrerContext) {
|
|
366
536
|
function is(context) {
|
|
367
|
-
return context
|
|
368
|
-
&& 'referrer' in context;
|
|
537
|
+
return context && "referrer" in context;
|
|
369
538
|
}
|
|
370
539
|
WithReferrerContext.is = is;
|
|
371
540
|
})(WithReferrerContext = exports.WithReferrerContext || (exports.WithReferrerContext = {}));
|
|
372
541
|
var WithEnvvarsContext;
|
|
373
542
|
(function (WithEnvvarsContext) {
|
|
374
543
|
function is(context) {
|
|
375
|
-
return context
|
|
376
|
-
&& 'envvars' in context;
|
|
544
|
+
return context && "envvars" in context;
|
|
377
545
|
}
|
|
378
546
|
WithEnvvarsContext.is = is;
|
|
379
547
|
})(WithEnvvarsContext = exports.WithEnvvarsContext || (exports.WithEnvvarsContext = {}));
|
|
380
548
|
var WorkspaceProbeContext;
|
|
381
549
|
(function (WorkspaceProbeContext) {
|
|
382
550
|
function is(context) {
|
|
383
|
-
return context
|
|
384
|
-
&& 'responseURL' in context
|
|
385
|
-
&& 'responseToken' in context;
|
|
551
|
+
return context && "responseURL" in context && "responseToken" in context;
|
|
386
552
|
}
|
|
387
553
|
WorkspaceProbeContext.is = is;
|
|
388
554
|
})(WorkspaceProbeContext = exports.WorkspaceProbeContext || (exports.WorkspaceProbeContext = {}));
|
|
@@ -399,7 +565,7 @@ var RefType;
|
|
|
399
565
|
var AdditionalContentContext;
|
|
400
566
|
(function (AdditionalContentContext) {
|
|
401
567
|
function is(ctx) {
|
|
402
|
-
return
|
|
568
|
+
return "additionalFiles" in ctx;
|
|
403
569
|
}
|
|
404
570
|
AdditionalContentContext.is = is;
|
|
405
571
|
function hasDockerConfig(ctx, config) {
|
|
@@ -408,40 +574,52 @@ var AdditionalContentContext;
|
|
|
408
574
|
AdditionalContentContext.hasDockerConfig = hasDockerConfig;
|
|
409
575
|
})(AdditionalContentContext = exports.AdditionalContentContext || (exports.AdditionalContentContext = {}));
|
|
410
576
|
var CommitContext;
|
|
577
|
+
(function (CommitContext) {
|
|
578
|
+
/**
|
|
579
|
+
* Creates a hash for all the commits of the CommitContext and all sub-repo commit infos.
|
|
580
|
+
* The hash is max 255 chars long.
|
|
581
|
+
* @param commitContext
|
|
582
|
+
* @returns hash for commitcontext
|
|
583
|
+
*/
|
|
584
|
+
function computeHash(commitContext) {
|
|
585
|
+
// for single commits we use the revision to be backward compatible.
|
|
586
|
+
if (!commitContext.additionalRepositoryCheckoutInfo ||
|
|
587
|
+
commitContext.additionalRepositoryCheckoutInfo.length === 0) {
|
|
588
|
+
return commitContext.revision;
|
|
589
|
+
}
|
|
590
|
+
const hasher = (0, crypto_1.createHash)("sha256");
|
|
591
|
+
hasher.update(commitContext.revision);
|
|
592
|
+
for (const info of commitContext.additionalRepositoryCheckoutInfo) {
|
|
593
|
+
hasher.update(info.revision);
|
|
594
|
+
}
|
|
595
|
+
return hasher.digest("hex");
|
|
596
|
+
}
|
|
597
|
+
CommitContext.computeHash = computeHash;
|
|
598
|
+
})(CommitContext = exports.CommitContext || (exports.CommitContext = {}));
|
|
411
599
|
(function (CommitContext) {
|
|
412
600
|
function is(commit) {
|
|
413
|
-
return WorkspaceContext.is(commit)
|
|
414
|
-
&& 'repository' in commit
|
|
415
|
-
&& 'revision' in commit;
|
|
601
|
+
return WorkspaceContext.is(commit) && "repository" in commit && "revision" in commit;
|
|
416
602
|
}
|
|
417
603
|
CommitContext.is = is;
|
|
418
604
|
})(CommitContext = exports.CommitContext || (exports.CommitContext = {}));
|
|
419
605
|
var PullRequestContext;
|
|
420
606
|
(function (PullRequestContext) {
|
|
421
607
|
function is(ctx) {
|
|
422
|
-
return CommitContext.is(ctx)
|
|
423
|
-
&& 'nr' in ctx
|
|
424
|
-
&& 'ref' in ctx
|
|
425
|
-
&& 'base' in ctx;
|
|
608
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "base" in ctx;
|
|
426
609
|
}
|
|
427
610
|
PullRequestContext.is = is;
|
|
428
611
|
})(PullRequestContext = exports.PullRequestContext || (exports.PullRequestContext = {}));
|
|
429
612
|
var IssueContext;
|
|
430
613
|
(function (IssueContext) {
|
|
431
614
|
function is(ctx) {
|
|
432
|
-
return CommitContext.is(ctx)
|
|
433
|
-
&& 'nr' in ctx
|
|
434
|
-
&& 'ref' in ctx
|
|
435
|
-
&& 'localBranch' in ctx;
|
|
615
|
+
return CommitContext.is(ctx) && "nr" in ctx && "ref" in ctx && "localBranch" in ctx;
|
|
436
616
|
}
|
|
437
617
|
IssueContext.is = is;
|
|
438
618
|
})(IssueContext = exports.IssueContext || (exports.IssueContext = {}));
|
|
439
619
|
var NavigatorContext;
|
|
440
620
|
(function (NavigatorContext) {
|
|
441
621
|
function is(ctx) {
|
|
442
|
-
return CommitContext.is(ctx)
|
|
443
|
-
&& 'path' in ctx
|
|
444
|
-
&& 'isFile' in ctx;
|
|
622
|
+
return CommitContext.is(ctx) && "path" in ctx && "isFile" in ctx;
|
|
445
623
|
}
|
|
446
624
|
NavigatorContext.is = is;
|
|
447
625
|
})(NavigatorContext = exports.NavigatorContext || (exports.NavigatorContext = {}));
|
|
@@ -481,10 +659,11 @@ var CreateWorkspaceMode;
|
|
|
481
659
|
var WorkspaceCreationResult;
|
|
482
660
|
(function (WorkspaceCreationResult) {
|
|
483
661
|
function is(data) {
|
|
484
|
-
return data &&
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
662
|
+
return (data &&
|
|
663
|
+
("createdWorkspaceId" in data ||
|
|
664
|
+
"existingWorkspaces" in data ||
|
|
665
|
+
"runningWorkspacePrebuild" in data ||
|
|
666
|
+
"runningPrebuildWorkspaceID" in data));
|
|
488
667
|
}
|
|
489
668
|
WorkspaceCreationResult.is = is;
|
|
490
669
|
})(WorkspaceCreationResult = exports.WorkspaceCreationResult || (exports.WorkspaceCreationResult = {}));
|