@gitpod/gitpod-protocol 0.1.5-me-gcp-preview.69 → 0.1.5-me-ingress.19
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/builtin-theia-plugins.json +3 -3
- package/data/gitpod-schema.json +13 -24
- package/lib/accounting-protocol.d.ts +155 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +109 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +20 -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 +45 -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 +18 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +49 -0
- package/lib/context-url.js.map +1 -0
- package/lib/{util/context-url.spec.d.ts → context-url.spec.d.ts} +3 -1
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +73 -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 +139 -19
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +168 -256
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +8 -28
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +4 -26
- package/lib/headless-workspace-log.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 +5 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -1
- package/lib/index.js.map +1 -1
- 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/connection-error-handler.js +11 -23
- package/lib/messaging/connection-error-handler.js.map +1 -1
- 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 +0 -10
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +12 -50
- 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/payment-protocol.d.ts +18 -0
- package/lib/payment-protocol.d.ts.map +1 -0
- package/lib/payment-protocol.js +13 -0
- package/lib/payment-protocol.js.map +1 -0
- package/lib/permission.d.ts +2 -1
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +14 -13
- 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 +97 -26
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +104 -130
- 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 +73 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +63 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +110 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +23 -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 +79 -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 +30 -68
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +56 -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 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +98 -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/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 +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 +50 -5
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +175 -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 +3 -2
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +74 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +16 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +5 -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 +229 -0
- package/src/admin-protocol.ts +39 -5
- package/src/analytics.ts +54 -0
- package/src/context-url.spec.ts +39 -0
- package/src/context-url.ts +51 -0
- package/src/email-protocol.ts +2 -3
- package/src/env.ts +10 -10
- package/src/gitpod-service.ts +203 -34
- package/src/headless-workspace-log.ts +6 -34
- package/src/ide-protocol.ts +92 -0
- package/src/index.ts +6 -1
- 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 +3 -47
- package/src/messaging/proxy-factory.ts +14 -6
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +20 -0
- package/src/permission.ts +2 -1
- package/src/plans.ts +632 -0
- package/src/protocol.ts +158 -55
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +113 -0
- package/src/teams-projects-protocol.ts +141 -0
- package/src/util/analytics.ts +87 -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 +19 -3
- package/src/util/generate-workspace-id.ts +21 -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 +23 -10
- 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 +162 -18
- package/src/workspace-cluster.ts +96 -0
- package/src/workspace-instance.ts +25 -13
- package/src/wsready.ts +2 -2
- 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.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/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js.map +0 -1
- 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/protocol.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { WorkspaceInstance, PortVisibility } from "./workspace-instance";
|
|
8
8
|
import { RoleOrPermission } from "./permission";
|
|
9
|
+
import { Project } from "./teams-projects-protocol";
|
|
9
10
|
|
|
10
11
|
export interface UserInfo {
|
|
11
12
|
name?: string
|
|
@@ -27,8 +28,6 @@ export interface User {
|
|
|
27
28
|
|
|
28
29
|
identities: Identity[]
|
|
29
30
|
|
|
30
|
-
allowsMarketingCommunication: boolean;
|
|
31
|
-
|
|
32
31
|
/**
|
|
33
32
|
* Whether the user has been blocked to use our service, because of TOS violation for example.
|
|
34
33
|
* Optional for backwards compatibility.
|
|
@@ -98,14 +97,28 @@ export interface AdditionalUserData {
|
|
|
98
97
|
emailNotificationSettings?: EmailNotificationSettings;
|
|
99
98
|
featurePreview?: boolean;
|
|
100
99
|
ideSettings?: IDESettings;
|
|
100
|
+
// key is the name of the news, string the iso date when it was seen
|
|
101
|
+
whatsNewSeen?: { [key: string]: string }
|
|
102
|
+
// key is the name of the OAuth client i.e. local app, string the iso date when it was approved
|
|
103
|
+
// TODO(rl): provide a management UX to allow rescinding of approval
|
|
104
|
+
oauthClientsApproved?: { [key: string]: string }
|
|
105
|
+
// to remember GH Orgs the user installed/updated the GH App for
|
|
106
|
+
knownGitHubOrgs?: string[];
|
|
107
|
+
|
|
108
|
+
// Git clone URL pointing to the user's dotfile repo
|
|
109
|
+
dotfileRepo?: string;
|
|
101
110
|
}
|
|
102
111
|
|
|
103
112
|
export interface EmailNotificationSettings {
|
|
104
|
-
|
|
113
|
+
allowsChangelogMail?: boolean;
|
|
114
|
+
allowsDevXMail?: boolean;
|
|
115
|
+
allowsOnboardingMail?: boolean;
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
export type IDESettings = {
|
|
108
119
|
defaultIde?: string
|
|
120
|
+
useDesktopIde?: boolean
|
|
121
|
+
defaultDesktopIde?: string
|
|
109
122
|
}
|
|
110
123
|
|
|
111
124
|
export interface UserPlatform {
|
|
@@ -127,14 +140,6 @@ export interface UserPlatform {
|
|
|
127
140
|
}
|
|
128
141
|
|
|
129
142
|
export interface UserFeatureSettings {
|
|
130
|
-
/**
|
|
131
|
-
* This field is used as marker to grant users a free trial for using private repositories,
|
|
132
|
-
* independent of any subscription or Chargebee.
|
|
133
|
-
* - it is set when the user uses their first private repo
|
|
134
|
-
* - whether the trial is expired or not is juged by the UserService
|
|
135
|
-
*/
|
|
136
|
-
privateRepoTrialStartDate?: string;
|
|
137
|
-
|
|
138
143
|
/**
|
|
139
144
|
* Permanent feature flags are added to each and every workspace instance
|
|
140
145
|
* this user starts.
|
|
@@ -146,7 +151,7 @@ export interface UserFeatureSettings {
|
|
|
146
151
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
147
152
|
* If they don't we'll break things during workspace startup.
|
|
148
153
|
*/
|
|
149
|
-
export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined
|
|
154
|
+
export const WorkspaceFeatureFlags = { "full_workspace_backup": undefined, "fixed_resources": undefined };
|
|
150
155
|
export type NamedWorkspaceFeatureFlag = keyof (typeof WorkspaceFeatureFlags);
|
|
151
156
|
|
|
152
157
|
export interface UserEnvVarValue {
|
|
@@ -167,6 +172,28 @@ export namespace UserEnvVar {
|
|
|
167
172
|
return pattern.toLocaleLowerCase();
|
|
168
173
|
}
|
|
169
174
|
|
|
175
|
+
export function score(value: UserEnvVarValue): number {
|
|
176
|
+
// We use a score to enforce precedence:
|
|
177
|
+
// value/value = 0
|
|
178
|
+
// value/* = 1
|
|
179
|
+
// */value = 2
|
|
180
|
+
// */* = 3
|
|
181
|
+
// #/# = 4 (used for env vars passed through the URL)
|
|
182
|
+
// the lower the score, the higher the precedence.
|
|
183
|
+
const [ownerPattern, repoPattern] = splitRepositoryPattern(value.repositoryPattern);
|
|
184
|
+
let score = 0;
|
|
185
|
+
if (repoPattern == "*") {
|
|
186
|
+
score += 1;
|
|
187
|
+
}
|
|
188
|
+
if (ownerPattern == '*') {
|
|
189
|
+
score += 2;
|
|
190
|
+
}
|
|
191
|
+
if (ownerPattern == "#" || repoPattern == "#") {
|
|
192
|
+
score = 4;
|
|
193
|
+
}
|
|
194
|
+
return score;
|
|
195
|
+
}
|
|
196
|
+
|
|
170
197
|
export function filter<T extends UserEnvVarValue>(vars: T[], owner: string, repo: string): T[] {
|
|
171
198
|
let result = vars.filter(e => {
|
|
172
199
|
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
@@ -202,25 +229,7 @@ export namespace UserEnvVar {
|
|
|
202
229
|
let minscore = 10;
|
|
203
230
|
let bestCandidate: T | undefined;
|
|
204
231
|
for (const e of candidates) {
|
|
205
|
-
|
|
206
|
-
// value/value = 0
|
|
207
|
-
// value/* = 1
|
|
208
|
-
// */value = 2
|
|
209
|
-
// */* = 3
|
|
210
|
-
// #/# = 4 (used for env vars passed through the URL)
|
|
211
|
-
// the lower the score, the higher the precedence.
|
|
212
|
-
const [ownerPattern, repoPattern] = splitRepositoryPattern(e.repositoryPattern);
|
|
213
|
-
let score = 0;
|
|
214
|
-
if (repoPattern == "*") {
|
|
215
|
-
score += 1;
|
|
216
|
-
}
|
|
217
|
-
if (ownerPattern == '*') {
|
|
218
|
-
score += 2;
|
|
219
|
-
}
|
|
220
|
-
if (ownerPattern == "#" || repoPattern == "#") {
|
|
221
|
-
score = 4;
|
|
222
|
-
}
|
|
223
|
-
|
|
232
|
+
const score = UserEnvVar.score(e);
|
|
224
233
|
if (!bestCandidate || score < minscore) {
|
|
225
234
|
minscore = score;
|
|
226
235
|
bestCandidate = e;
|
|
@@ -232,7 +241,7 @@ export namespace UserEnvVar {
|
|
|
232
241
|
return result;
|
|
233
242
|
}
|
|
234
243
|
|
|
235
|
-
function splitRepositoryPattern(repositoryPattern: string): string[] {
|
|
244
|
+
export function splitRepositoryPattern(repositoryPattern: string): string[] {
|
|
236
245
|
const patterns = repositoryPattern.split('/');
|
|
237
246
|
const repoPattern = patterns.pop() || "";
|
|
238
247
|
const ownerPattern = patterns.join('/');
|
|
@@ -366,11 +375,16 @@ export interface PendingGithubEvent {
|
|
|
366
375
|
export interface Snapshot {
|
|
367
376
|
id: string;
|
|
368
377
|
creationTime: string;
|
|
378
|
+
availableTime?: string;
|
|
369
379
|
originalWorkspaceId: string;
|
|
370
380
|
bucketId: string;
|
|
371
381
|
layoutData?: string;
|
|
382
|
+
state: SnapshotState;
|
|
383
|
+
message?: string;
|
|
372
384
|
}
|
|
373
385
|
|
|
386
|
+
export type SnapshotState = 'pending' | 'available' | 'error';
|
|
387
|
+
|
|
374
388
|
export interface LayoutData {
|
|
375
389
|
workspaceId: string;
|
|
376
390
|
lastUpdatedTime: string;
|
|
@@ -383,6 +397,7 @@ export interface Workspace {
|
|
|
383
397
|
contextURL: string;
|
|
384
398
|
description: string;
|
|
385
399
|
ownerId: string;
|
|
400
|
+
projectId?: string;
|
|
386
401
|
context: WorkspaceContext;
|
|
387
402
|
config: WorkspaceConfig;
|
|
388
403
|
|
|
@@ -502,6 +517,24 @@ export interface UninstallPluginParams {
|
|
|
502
517
|
pluginId: string;
|
|
503
518
|
}
|
|
504
519
|
|
|
520
|
+
export interface GuessGitTokenScopesParams {
|
|
521
|
+
host: string
|
|
522
|
+
repoUrl: string
|
|
523
|
+
gitCommand: string
|
|
524
|
+
currentToken: GitToken
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export interface GitToken {
|
|
528
|
+
token: string
|
|
529
|
+
user: string
|
|
530
|
+
scopes: string[]
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export interface GuessedGitTokenScopes {
|
|
534
|
+
message?: string
|
|
535
|
+
scopes?: string[]
|
|
536
|
+
}
|
|
537
|
+
|
|
505
538
|
export type ResolvedPluginKind = 'user' | 'workspace' | 'builtin';
|
|
506
539
|
|
|
507
540
|
export interface ResolvedPlugins {
|
|
@@ -527,16 +560,21 @@ export interface WorkspaceConfig {
|
|
|
527
560
|
gitConfig?: { [config: string]: string };
|
|
528
561
|
github?: GithubAppConfig;
|
|
529
562
|
vscode?: VSCodeConfig;
|
|
530
|
-
|
|
563
|
+
|
|
564
|
+
/** deprecated. Enabled by default **/
|
|
565
|
+
experimentalNetwork?: boolean;
|
|
566
|
+
|
|
531
567
|
/**
|
|
532
568
|
* Where the config object originates from.
|
|
533
|
-
*
|
|
569
|
+
*
|
|
534
570
|
* repo - from the repository
|
|
571
|
+
* project-db - from the "Project" stored in the database
|
|
535
572
|
* definitly-gp - from github.com/gitpod-io/definitely-gp
|
|
536
573
|
* derived - computed based on analyzing the repository
|
|
574
|
+
* additional-content - config comes from additional content, usually provided through the project's configuration
|
|
537
575
|
* default - our static catch-all default config
|
|
538
576
|
*/
|
|
539
|
-
_origin?: 'repo' | 'definitely-gp' | 'derived' | 'default';
|
|
577
|
+
_origin?: 'repo' | 'project-db' | 'definitely-gp' | 'derived' | 'additional-content' | 'default';
|
|
540
578
|
|
|
541
579
|
/**
|
|
542
580
|
* Set of automatically infered feature flags. That's not something the user can set, but
|
|
@@ -553,7 +591,6 @@ export interface GithubAppPrebuildConfig {
|
|
|
553
591
|
branches?: boolean
|
|
554
592
|
pullRequests?: boolean
|
|
555
593
|
pullRequestsFromForks?: boolean
|
|
556
|
-
addCheck?: boolean
|
|
557
594
|
addBadge?: boolean
|
|
558
595
|
addLabel?: boolean | string
|
|
559
596
|
addComment?: boolean
|
|
@@ -566,16 +603,13 @@ export namespace GithubAppPrebuildConfig {
|
|
|
566
603
|
|
|
567
604
|
export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
|
|
568
605
|
export interface WorkspaceImageSourceDocker {
|
|
569
|
-
// TODO: clean this up. We should have the commit and an ImageSource in here, not duplicate the whole thing again.
|
|
570
|
-
// We have a ton of those objects in the database, thus cleaning this up means lengthy DB migrations. Yuck.
|
|
571
|
-
dockerFileHash: string
|
|
572
|
-
dockerFileSource: Commit
|
|
573
606
|
dockerFilePath: string
|
|
607
|
+
dockerFileHash: string
|
|
608
|
+
dockerFileSource?: Commit
|
|
574
609
|
}
|
|
575
610
|
export namespace WorkspaceImageSourceDocker {
|
|
576
611
|
export function is(obj: object): obj is WorkspaceImageSourceDocker {
|
|
577
612
|
return 'dockerFileHash' in obj
|
|
578
|
-
&& 'dockerFileSource' in obj
|
|
579
613
|
&& 'dockerFilePath' in obj;
|
|
580
614
|
}
|
|
581
615
|
}
|
|
@@ -604,6 +638,8 @@ export type PrebuiltWorkspaceState
|
|
|
604
638
|
export interface PrebuiltWorkspace {
|
|
605
639
|
id: string;
|
|
606
640
|
cloneURL: string;
|
|
641
|
+
branch?: string;
|
|
642
|
+
projectId?: string;
|
|
607
643
|
commit: string;
|
|
608
644
|
buildWorkspaceId: string;
|
|
609
645
|
creationTime: string;
|
|
@@ -614,7 +650,7 @@ export interface PrebuiltWorkspace {
|
|
|
614
650
|
|
|
615
651
|
export namespace PrebuiltWorkspace {
|
|
616
652
|
export function isDone(pws: PrebuiltWorkspace) {
|
|
617
|
-
return pws.state === "available" || pws.state === "timeout" ||
|
|
653
|
+
return pws.state === "available" || pws.state === "timeout" || pws.state === 'aborted';
|
|
618
654
|
}
|
|
619
655
|
|
|
620
656
|
export function isAvailable(pws: PrebuiltWorkspace) {
|
|
@@ -626,17 +662,6 @@ export namespace PrebuiltWorkspace {
|
|
|
626
662
|
}
|
|
627
663
|
}
|
|
628
664
|
|
|
629
|
-
export interface PrebuiltWorkspaceUpdatable {
|
|
630
|
-
id: string;
|
|
631
|
-
prebuiltWorkspaceId: string;
|
|
632
|
-
owner: string;
|
|
633
|
-
repo: string;
|
|
634
|
-
isResolved: boolean;
|
|
635
|
-
installationId: string;
|
|
636
|
-
issue?: string;
|
|
637
|
-
contextUrl?: string;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
665
|
export interface WhitelistedRepository {
|
|
641
666
|
url: string
|
|
642
667
|
name: string
|
|
@@ -650,6 +675,8 @@ export interface PortConfig {
|
|
|
650
675
|
port: number;
|
|
651
676
|
onOpen?: PortOnOpen;
|
|
652
677
|
visibility?: PortVisibility;
|
|
678
|
+
description?: string;
|
|
679
|
+
name?: string;
|
|
653
680
|
}
|
|
654
681
|
export namespace PortConfig {
|
|
655
682
|
export function is(config: any): config is PortConfig {
|
|
@@ -673,7 +700,7 @@ export interface TaskConfig {
|
|
|
673
700
|
init?: string;
|
|
674
701
|
prebuild?: string;
|
|
675
702
|
command?: string;
|
|
676
|
-
env?: { [env: string]:
|
|
703
|
+
env?: { [env: string]: any };
|
|
677
704
|
openIn?: 'bottom' | 'main' | 'left' | 'right';
|
|
678
705
|
openMode?: 'split-top' | 'split-left' | 'split-right' | 'split-bottom' | 'tab-before' | 'tab-after';
|
|
679
706
|
}
|
|
@@ -737,8 +764,10 @@ export namespace ExternalImageConfigFile {
|
|
|
737
764
|
|
|
738
765
|
export interface WorkspaceContext {
|
|
739
766
|
title: string;
|
|
767
|
+
/** This contains the URL portion of the contextURL (which might contain other modifiers as well). It's optional because it's not set for older workspaces. */
|
|
740
768
|
normalizedContextURL?: string;
|
|
741
769
|
forceCreateNewWorkspace?: boolean;
|
|
770
|
+
forceImageBuild?: boolean;
|
|
742
771
|
}
|
|
743
772
|
|
|
744
773
|
export namespace WorkspaceContext {
|
|
@@ -772,6 +801,29 @@ export namespace WithPrebuild {
|
|
|
772
801
|
}
|
|
773
802
|
}
|
|
774
803
|
|
|
804
|
+
/**
|
|
805
|
+
* WithDefaultConfig contexts disable the download of the gitpod.yml from the repository
|
|
806
|
+
* and fall back to the built-in configuration.
|
|
807
|
+
*/
|
|
808
|
+
export interface WithDefaultConfig {
|
|
809
|
+
withDefaultConfig: true;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
export namespace WithDefaultConfig {
|
|
813
|
+
export function is(context: any): context is WithDefaultConfig {
|
|
814
|
+
return context
|
|
815
|
+
&& 'withDefaultConfig' in context
|
|
816
|
+
&& context.withDefaultConfig;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
|
|
820
|
+
return {
|
|
821
|
+
...ctx,
|
|
822
|
+
withDefaultConfig: true
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
|
|
775
827
|
export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
|
|
776
828
|
snapshotId: string;
|
|
777
829
|
}
|
|
@@ -786,6 +838,9 @@ export namespace SnapshotContext {
|
|
|
786
838
|
|
|
787
839
|
export interface StartPrebuildContext extends WorkspaceContext {
|
|
788
840
|
actual: WorkspaceContext;
|
|
841
|
+
commitHistory?: string[];
|
|
842
|
+
project?: Project;
|
|
843
|
+
branch?: string;
|
|
789
844
|
}
|
|
790
845
|
|
|
791
846
|
export namespace StartPrebuildContext {
|
|
@@ -855,6 +910,25 @@ export interface Commit {
|
|
|
855
910
|
refType?: RefType
|
|
856
911
|
}
|
|
857
912
|
|
|
913
|
+
export interface AdditionalContentContext extends WorkspaceContext {
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* utf-8 encoded contents that will be copied on top of the workspace's filesystem
|
|
917
|
+
*/
|
|
918
|
+
additionalFiles: {[filePath: string]: string};
|
|
919
|
+
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
export namespace AdditionalContentContext {
|
|
923
|
+
export function is(ctx: any): ctx is AdditionalContentContext {
|
|
924
|
+
return 'additionalFiles' in ctx;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
|
|
928
|
+
return is(ctx) && ImageConfigFile.is(config.image) && !!ctx.additionalFiles[config.image.file];
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
858
932
|
export interface CommitContext extends WorkspaceContext, Commit {
|
|
859
933
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
860
934
|
cloneUrl?: string
|
|
@@ -930,6 +1004,19 @@ export interface Repository {
|
|
|
930
1004
|
parent: Repository
|
|
931
1005
|
}
|
|
932
1006
|
}
|
|
1007
|
+
export interface Branch {
|
|
1008
|
+
name: string;
|
|
1009
|
+
commit: CommitInfo;
|
|
1010
|
+
htmlUrl: string;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
export interface CommitInfo {
|
|
1014
|
+
author: string;
|
|
1015
|
+
sha: string;
|
|
1016
|
+
commitMessage: string;
|
|
1017
|
+
authorAvatarUrl?: string;
|
|
1018
|
+
authorDate?: string;
|
|
1019
|
+
}
|
|
933
1020
|
|
|
934
1021
|
export namespace Repository {
|
|
935
1022
|
export function fullRepoName(repo: Repository): string {
|
|
@@ -957,6 +1044,12 @@ export interface WorkspaceInfo {
|
|
|
957
1044
|
latestInstance?: WorkspaceInstance
|
|
958
1045
|
}
|
|
959
1046
|
|
|
1047
|
+
export namespace WorkspaceInfo {
|
|
1048
|
+
export function lastActiveISODate(info: WorkspaceInfo): string {
|
|
1049
|
+
return info.latestInstance?.creationTime || info.workspace.creationTime;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
960
1053
|
export type RunningWorkspaceInfo = WorkspaceInfo & { latestInstance: WorkspaceInstance };
|
|
961
1054
|
|
|
962
1055
|
export interface WorkspaceCreationResult {
|
|
@@ -966,6 +1059,7 @@ export interface WorkspaceCreationResult {
|
|
|
966
1059
|
runningWorkspacePrebuild?: {
|
|
967
1060
|
prebuildID: string
|
|
968
1061
|
workspaceID: string
|
|
1062
|
+
instanceID: string
|
|
969
1063
|
starting: RunningWorkspacePrebuildStarting
|
|
970
1064
|
sameCluster: boolean
|
|
971
1065
|
}
|
|
@@ -1056,8 +1150,17 @@ export interface OAuth2Config {
|
|
|
1056
1150
|
export namespace AuthProviderEntry {
|
|
1057
1151
|
export type Type = "GitHub" | "GitLab" | string;
|
|
1058
1152
|
export type Status = "pending" | "verified";
|
|
1059
|
-
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"
|
|
1153
|
+
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & { clientId?: string, clientSecret?: string };
|
|
1060
1154
|
export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> & Pick<OAuth2Config, "clientId" | "clientSecret">;
|
|
1155
|
+
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
|
|
1156
|
+
return {
|
|
1157
|
+
...entry,
|
|
1158
|
+
oauth: {
|
|
1159
|
+
...entry.oauth,
|
|
1160
|
+
clientSecret: "redacted"
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1061
1164
|
}
|
|
1062
1165
|
|
|
1063
1166
|
export interface Branding {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { suite, test } from "mocha-typescript"
|
|
8
|
+
import * as chai from "chai"
|
|
9
|
+
import { SnapshotUrl } from ".";
|
|
10
|
+
|
|
11
|
+
const expect = chai.expect
|
|
12
|
+
|
|
13
|
+
@suite class TestSnapshotUrlParser {
|
|
14
|
+
|
|
15
|
+
@test public testPositive() {
|
|
16
|
+
const actual = SnapshotUrl.parse("workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar@gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd");
|
|
17
|
+
|
|
18
|
+
expect(actual).to.deep.equal(<SnapshotUrl>{
|
|
19
|
+
bucketId: "gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd",
|
|
20
|
+
filename: "3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
|
|
21
|
+
fullPath: "workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
module.exports = new TestSnapshotUrlParser() // Only to circumvent no usage warning :-/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface SnapshotUrl {
|
|
8
|
+
bucketId: string;
|
|
9
|
+
fullPath: string;
|
|
10
|
+
filename: string;
|
|
11
|
+
}
|
|
12
|
+
export namespace SnapshotUrl {
|
|
13
|
+
export function parse(url: string): SnapshotUrl {
|
|
14
|
+
const parts = url.split("@");
|
|
15
|
+
if (parts.length !== 2) {
|
|
16
|
+
throw new Error(`cannot parse snapshot URL: ${url}`);
|
|
17
|
+
}
|
|
18
|
+
const [fullPath, bucketId] = parts;
|
|
19
|
+
|
|
20
|
+
const pathParts = fullPath.split("/");
|
|
21
|
+
if (pathParts.length < 1) {
|
|
22
|
+
throw new Error(`cannot parse snapshot URL: ${url}`);
|
|
23
|
+
}
|
|
24
|
+
const filename = pathParts[pathParts.length - 1];
|
|
25
|
+
return { bucketId, fullPath, filename };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
8
|
+
import { Subscription } from "./accounting-protocol";
|
|
9
|
+
|
|
10
|
+
export interface TeamSubscription {
|
|
11
|
+
id: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
planId: string;
|
|
14
|
+
startDate: string;
|
|
15
|
+
endDate?: string;
|
|
16
|
+
quantity: number;
|
|
17
|
+
/** The Chargebee subscription id */
|
|
18
|
+
paymentReference: string;
|
|
19
|
+
cancellationDate?: string;
|
|
20
|
+
deleted?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export namespace TeamSubscription {
|
|
24
|
+
export const create = (ts: Omit<TeamSubscription, 'id'>): TeamSubscription => {
|
|
25
|
+
const withId = ts as TeamSubscription;
|
|
26
|
+
withId.id = uuidv4();
|
|
27
|
+
return withId;
|
|
28
|
+
}
|
|
29
|
+
export const isActive = (ts: TeamSubscription, date: string): boolean => {
|
|
30
|
+
return ts.startDate <= date && (ts.endDate === undefined || date < ts.endDate);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A slot represents one unit of a TeamSubscription that gets assigned to one user at a time
|
|
36
|
+
*/
|
|
37
|
+
export interface TeamSubscriptionSlot {
|
|
38
|
+
id: string;
|
|
39
|
+
teamSubscriptionId: string;
|
|
40
|
+
assigneeId?: string;
|
|
41
|
+
assigneeIdentifier?: AssigneeIdentifier;
|
|
42
|
+
subscriptionId?: string;
|
|
43
|
+
cancellationDate?: string;
|
|
44
|
+
}
|
|
45
|
+
export type TeamSubscriptionSlotDeactivated = TeamSubscriptionSlot & { assigneeId: string, assigneeIdentifier: AssigneeIdentifier };
|
|
46
|
+
export type TeamSubscriptionSlotAssigned = TeamSubscriptionSlot & TeamSubscriptionSlotDeactivated & { subscriptionId: string };
|
|
47
|
+
|
|
48
|
+
export type TeamSubscriptionSlotState = 'unassigned' | 'assigned' | 'deactivated' | 'cancelled';
|
|
49
|
+
|
|
50
|
+
export namespace TeamSubscriptionSlot {
|
|
51
|
+
export const create = (ts: Omit<TeamSubscriptionSlot, 'id'>): TeamSubscriptionSlot => {
|
|
52
|
+
const withId = ts as TeamSubscriptionSlot;
|
|
53
|
+
withId.id = uuidv4();
|
|
54
|
+
return withId;
|
|
55
|
+
}
|
|
56
|
+
export const assign = (slot: TeamSubscriptionSlot, assigneeId: string, subscriptionId: string, assigneeIdentifier: AssigneeIdentifier) => {
|
|
57
|
+
slot.assigneeId = assigneeId;
|
|
58
|
+
slot.subscriptionId = subscriptionId;
|
|
59
|
+
slot.assigneeIdentifier = assigneeIdentifier;
|
|
60
|
+
}
|
|
61
|
+
export const deactivate = (slot: TeamSubscriptionSlot, cancellationDate: string) => {
|
|
62
|
+
slot.subscriptionId = undefined;
|
|
63
|
+
slot.cancellationDate = cancellationDate;
|
|
64
|
+
}
|
|
65
|
+
export const reactivate = (slot: TeamSubscriptionSlot, subscriptionId?: string) => {
|
|
66
|
+
slot.subscriptionId = subscriptionId;
|
|
67
|
+
slot.cancellationDate = undefined;
|
|
68
|
+
}
|
|
69
|
+
export const status = (slot: TeamSubscriptionSlot, now: string): TeamSubscriptionSlotState => {
|
|
70
|
+
if (slot.cancellationDate) {
|
|
71
|
+
if (slot.cancellationDate < now) {
|
|
72
|
+
return 'cancelled';
|
|
73
|
+
} else {
|
|
74
|
+
return 'deactivated';
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
if (slot.subscriptionId) {
|
|
78
|
+
return 'assigned';
|
|
79
|
+
} else {
|
|
80
|
+
return 'unassigned';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
export const isActive = (slot: TeamSubscriptionSlot): boolean => {
|
|
86
|
+
return !slot.cancellationDate;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The mapping between a TeamSubscription and a resulting Subscription, resolved
|
|
92
|
+
*/
|
|
93
|
+
export interface TeamSubscriptionSlotResolved {
|
|
94
|
+
id: string;
|
|
95
|
+
teamSubscription: TeamSubscription;
|
|
96
|
+
state: TeamSubscriptionSlotState;
|
|
97
|
+
assigneeId?: string;
|
|
98
|
+
assigneeIdentifier?: AssigneeIdentifier;
|
|
99
|
+
subscription?: Subscription;
|
|
100
|
+
cancellationDate?: string;
|
|
101
|
+
hoursLeft?: number;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Contains the data structure that the assigner used to identify the assignee.
|
|
106
|
+
*/
|
|
107
|
+
export type AssigneeIdentifier = AssigneeIdentityIdentifier;
|
|
108
|
+
export interface AssigneeIdentityIdentifier {
|
|
109
|
+
identity: {
|
|
110
|
+
authHost: string,
|
|
111
|
+
authName: string
|
|
112
|
+
}
|
|
113
|
+
}
|