@gitpod/gitpod-protocol 0.1.5-me-gcp-preview.68 → 0.1.5-me-ingress.14
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 -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 +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 -15
- 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 +7 -11
- 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 -43
- 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
|
|
@@ -566,16 +604,13 @@ export namespace GithubAppPrebuildConfig {
|
|
|
566
604
|
|
|
567
605
|
export type WorkspaceImageSource = WorkspaceImageSourceDocker | WorkspaceImageSourceReference;
|
|
568
606
|
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
607
|
dockerFilePath: string
|
|
608
|
+
dockerFileHash: string
|
|
609
|
+
dockerFileSource?: Commit
|
|
574
610
|
}
|
|
575
611
|
export namespace WorkspaceImageSourceDocker {
|
|
576
612
|
export function is(obj: object): obj is WorkspaceImageSourceDocker {
|
|
577
613
|
return 'dockerFileHash' in obj
|
|
578
|
-
&& 'dockerFileSource' in obj
|
|
579
614
|
&& 'dockerFilePath' in obj;
|
|
580
615
|
}
|
|
581
616
|
}
|
|
@@ -604,6 +639,8 @@ export type PrebuiltWorkspaceState
|
|
|
604
639
|
export interface PrebuiltWorkspace {
|
|
605
640
|
id: string;
|
|
606
641
|
cloneURL: string;
|
|
642
|
+
branch?: string;
|
|
643
|
+
projectId?: string;
|
|
607
644
|
commit: string;
|
|
608
645
|
buildWorkspaceId: string;
|
|
609
646
|
creationTime: string;
|
|
@@ -614,7 +651,7 @@ export interface PrebuiltWorkspace {
|
|
|
614
651
|
|
|
615
652
|
export namespace PrebuiltWorkspace {
|
|
616
653
|
export function isDone(pws: PrebuiltWorkspace) {
|
|
617
|
-
return pws.state === "available" || pws.state === "timeout" ||
|
|
654
|
+
return pws.state === "available" || pws.state === "timeout" || pws.state === 'aborted';
|
|
618
655
|
}
|
|
619
656
|
|
|
620
657
|
export function isAvailable(pws: PrebuiltWorkspace) {
|
|
@@ -650,6 +687,8 @@ export interface PortConfig {
|
|
|
650
687
|
port: number;
|
|
651
688
|
onOpen?: PortOnOpen;
|
|
652
689
|
visibility?: PortVisibility;
|
|
690
|
+
description?: string;
|
|
691
|
+
name?: string;
|
|
653
692
|
}
|
|
654
693
|
export namespace PortConfig {
|
|
655
694
|
export function is(config: any): config is PortConfig {
|
|
@@ -673,7 +712,7 @@ export interface TaskConfig {
|
|
|
673
712
|
init?: string;
|
|
674
713
|
prebuild?: string;
|
|
675
714
|
command?: string;
|
|
676
|
-
env?: { [env: string]:
|
|
715
|
+
env?: { [env: string]: any };
|
|
677
716
|
openIn?: 'bottom' | 'main' | 'left' | 'right';
|
|
678
717
|
openMode?: 'split-top' | 'split-left' | 'split-right' | 'split-bottom' | 'tab-before' | 'tab-after';
|
|
679
718
|
}
|
|
@@ -737,8 +776,10 @@ export namespace ExternalImageConfigFile {
|
|
|
737
776
|
|
|
738
777
|
export interface WorkspaceContext {
|
|
739
778
|
title: string;
|
|
779
|
+
/** 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
780
|
normalizedContextURL?: string;
|
|
741
781
|
forceCreateNewWorkspace?: boolean;
|
|
782
|
+
forceImageBuild?: boolean;
|
|
742
783
|
}
|
|
743
784
|
|
|
744
785
|
export namespace WorkspaceContext {
|
|
@@ -772,6 +813,29 @@ export namespace WithPrebuild {
|
|
|
772
813
|
}
|
|
773
814
|
}
|
|
774
815
|
|
|
816
|
+
/**
|
|
817
|
+
* WithDefaultConfig contexts disable the download of the gitpod.yml from the repository
|
|
818
|
+
* and fall back to the built-in configuration.
|
|
819
|
+
*/
|
|
820
|
+
export interface WithDefaultConfig {
|
|
821
|
+
withDefaultConfig: true;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
export namespace WithDefaultConfig {
|
|
825
|
+
export function is(context: any): context is WithDefaultConfig {
|
|
826
|
+
return context
|
|
827
|
+
&& 'withDefaultConfig' in context
|
|
828
|
+
&& context.withDefaultConfig;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
export function mark(ctx: WorkspaceContext): WorkspaceContext & WithDefaultConfig {
|
|
832
|
+
return {
|
|
833
|
+
...ctx,
|
|
834
|
+
withDefaultConfig: true
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
|
|
775
839
|
export interface SnapshotContext extends WorkspaceContext, WithSnapshot {
|
|
776
840
|
snapshotId: string;
|
|
777
841
|
}
|
|
@@ -786,6 +850,9 @@ export namespace SnapshotContext {
|
|
|
786
850
|
|
|
787
851
|
export interface StartPrebuildContext extends WorkspaceContext {
|
|
788
852
|
actual: WorkspaceContext;
|
|
853
|
+
commitHistory?: string[];
|
|
854
|
+
project?: Project;
|
|
855
|
+
branch?: string;
|
|
789
856
|
}
|
|
790
857
|
|
|
791
858
|
export namespace StartPrebuildContext {
|
|
@@ -855,6 +922,25 @@ export interface Commit {
|
|
|
855
922
|
refType?: RefType
|
|
856
923
|
}
|
|
857
924
|
|
|
925
|
+
export interface AdditionalContentContext extends WorkspaceContext {
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* utf-8 encoded contents that will be copied on top of the workspace's filesystem
|
|
929
|
+
*/
|
|
930
|
+
additionalFiles: {[filePath: string]: string};
|
|
931
|
+
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export namespace AdditionalContentContext {
|
|
935
|
+
export function is(ctx: any): ctx is AdditionalContentContext {
|
|
936
|
+
return 'additionalFiles' in ctx;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
export function hasDockerConfig(ctx: any, config: WorkspaceConfig): boolean {
|
|
940
|
+
return is(ctx) && ImageConfigFile.is(config.image) && !!ctx.additionalFiles[config.image.file];
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
858
944
|
export interface CommitContext extends WorkspaceContext, Commit {
|
|
859
945
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
860
946
|
cloneUrl?: string
|
|
@@ -930,6 +1016,19 @@ export interface Repository {
|
|
|
930
1016
|
parent: Repository
|
|
931
1017
|
}
|
|
932
1018
|
}
|
|
1019
|
+
export interface Branch {
|
|
1020
|
+
name: string;
|
|
1021
|
+
commit: CommitInfo;
|
|
1022
|
+
htmlUrl: string;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
export interface CommitInfo {
|
|
1026
|
+
author: string;
|
|
1027
|
+
sha: string;
|
|
1028
|
+
commitMessage: string;
|
|
1029
|
+
authorAvatarUrl?: string;
|
|
1030
|
+
authorDate?: string;
|
|
1031
|
+
}
|
|
933
1032
|
|
|
934
1033
|
export namespace Repository {
|
|
935
1034
|
export function fullRepoName(repo: Repository): string {
|
|
@@ -957,6 +1056,12 @@ export interface WorkspaceInfo {
|
|
|
957
1056
|
latestInstance?: WorkspaceInstance
|
|
958
1057
|
}
|
|
959
1058
|
|
|
1059
|
+
export namespace WorkspaceInfo {
|
|
1060
|
+
export function lastActiveISODate(info: WorkspaceInfo): string {
|
|
1061
|
+
return info.latestInstance?.creationTime || info.workspace.creationTime;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
|
|
960
1065
|
export type RunningWorkspaceInfo = WorkspaceInfo & { latestInstance: WorkspaceInstance };
|
|
961
1066
|
|
|
962
1067
|
export interface WorkspaceCreationResult {
|
|
@@ -966,6 +1071,7 @@ export interface WorkspaceCreationResult {
|
|
|
966
1071
|
runningWorkspacePrebuild?: {
|
|
967
1072
|
prebuildID: string
|
|
968
1073
|
workspaceID: string
|
|
1074
|
+
instanceID: string
|
|
969
1075
|
starting: RunningWorkspacePrebuildStarting
|
|
970
1076
|
sameCluster: boolean
|
|
971
1077
|
}
|
|
@@ -1056,8 +1162,17 @@ export interface OAuth2Config {
|
|
|
1056
1162
|
export namespace AuthProviderEntry {
|
|
1057
1163
|
export type Type = "GitHub" | "GitLab" | string;
|
|
1058
1164
|
export type Status = "pending" | "verified";
|
|
1059
|
-
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"
|
|
1165
|
+
export type NewEntry = Pick<AuthProviderEntry, "ownerId" | "host" | "type"> & { clientId?: string, clientSecret?: string };
|
|
1060
1166
|
export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> & Pick<OAuth2Config, "clientId" | "clientSecret">;
|
|
1167
|
+
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
|
|
1168
|
+
return {
|
|
1169
|
+
...entry,
|
|
1170
|
+
oauth: {
|
|
1171
|
+
...entry.oauth,
|
|
1172
|
+
clientSecret: "redacted"
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1061
1176
|
}
|
|
1062
1177
|
|
|
1063
1178
|
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
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
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 { PrebuiltWorkspaceState } from "./protocol";
|
|
8
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
9
|
+
import { DeepPartial } from "./util/deep-partial";
|
|
10
|
+
|
|
11
|
+
export interface ProjectConfig {
|
|
12
|
+
'.gitpod.yml': string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ProjectSettings {
|
|
16
|
+
useIncrementalPrebuilds?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface Project {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
slug?: string;
|
|
23
|
+
cloneUrl: string;
|
|
24
|
+
teamId?: string;
|
|
25
|
+
userId?: string;
|
|
26
|
+
appInstallationId: string;
|
|
27
|
+
config?: ProjectConfig;
|
|
28
|
+
settings?: ProjectSettings;
|
|
29
|
+
creationTime: string;
|
|
30
|
+
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
31
|
+
deleted?: boolean;
|
|
32
|
+
markedDeleted?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export namespace Project {
|
|
36
|
+
export const create = (project: Omit<Project, 'id' | 'creationTime'>): Project => {
|
|
37
|
+
return {
|
|
38
|
+
...project,
|
|
39
|
+
id: uuidv4(),
|
|
40
|
+
creationTime: new Date().toISOString()
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface Overview {
|
|
45
|
+
branches: BranchDetails[]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface BranchDetails {
|
|
49
|
+
name: string;
|
|
50
|
+
url: string;
|
|
51
|
+
isDefault: boolean;
|
|
52
|
+
|
|
53
|
+
// Latest commit
|
|
54
|
+
changeTitle: string;
|
|
55
|
+
changeDate?: string;
|
|
56
|
+
changeAuthor?: string;
|
|
57
|
+
changeAuthorAvatar?: string;
|
|
58
|
+
changePR?: string;
|
|
59
|
+
changeUrl?: string;
|
|
60
|
+
changeHash: string;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type PartialProject = DeepPartial<Project> & Pick<Project, 'id'>;
|
|
65
|
+
|
|
66
|
+
export interface PrebuildWithStatus {
|
|
67
|
+
info: PrebuildInfo;
|
|
68
|
+
status: PrebuiltWorkspaceState;
|
|
69
|
+
error?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface PrebuildInfo {
|
|
73
|
+
id: string;
|
|
74
|
+
buildWorkspaceId: string;
|
|
75
|
+
basedOnPrebuildId?: string;
|
|
76
|
+
|
|
77
|
+
teamId?: string;
|
|
78
|
+
userId?: string;
|
|
79
|
+
|
|
80
|
+
projectId: string;
|
|
81
|
+
projectName: string;
|
|
82
|
+
|
|
83
|
+
cloneUrl: string;
|
|
84
|
+
branch: string;
|
|
85
|
+
|
|
86
|
+
startedAt: string;
|
|
87
|
+
startedBy: string;
|
|
88
|
+
startedByAvatar?: string;
|
|
89
|
+
|
|
90
|
+
changeTitle: string;
|
|
91
|
+
changeDate: string;
|
|
92
|
+
changeAuthor: string;
|
|
93
|
+
changeAuthorAvatar?: string;
|
|
94
|
+
changePR?: string;
|
|
95
|
+
changeUrl?: string;
|
|
96
|
+
changeHash: string;
|
|
97
|
+
}
|
|
98
|
+
export namespace PrebuildInfo {
|
|
99
|
+
export function is(data?: any): data is PrebuildInfo {
|
|
100
|
+
return typeof data === "object" && ["id", "buildWorkspaceId", "projectId", "branch"].every(p => p in data);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface StartPrebuildResult {
|
|
105
|
+
prebuildId: string;
|
|
106
|
+
wsid: string;
|
|
107
|
+
done: boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface Team {
|
|
111
|
+
id: string;
|
|
112
|
+
name: string;
|
|
113
|
+
slug: string;
|
|
114
|
+
creationTime: string;
|
|
115
|
+
markedDeleted?: boolean;
|
|
116
|
+
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
117
|
+
deleted?: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type TeamMemberRole = "owner" | "member";
|
|
121
|
+
|
|
122
|
+
export interface TeamMemberInfo {
|
|
123
|
+
userId: string;
|
|
124
|
+
fullName?: string;
|
|
125
|
+
primaryEmail?: string;
|
|
126
|
+
avatarUrl?: string;
|
|
127
|
+
role: TeamMemberRole;
|
|
128
|
+
memberSince: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface TeamMembershipInvite {
|
|
132
|
+
id: string;
|
|
133
|
+
teamId: string;
|
|
134
|
+
role: TeamMemberRole;
|
|
135
|
+
creationTime: string;
|
|
136
|
+
invalidationTime: string;
|
|
137
|
+
invitedEmail?: string;
|
|
138
|
+
|
|
139
|
+
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
140
|
+
deleted?: boolean;
|
|
141
|
+
}
|