@gitpod/gitpod-protocol 0.1.5-pavel-git-status-fix.5 → 0.1.5-pavel-vswithtype.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/gitpod-schema.json +71 -129
- package/lib/accounting-protocol.d.ts +1 -0
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +4 -0
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +4 -1
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/attribution.d.ts +4 -0
- package/lib/attribution.d.ts.map +1 -1
- package/lib/attribution.js +14 -0
- package/lib/attribution.js.map +1 -1
- package/lib/billing-mode.d.ts +43 -0
- package/lib/billing-mode.d.ts.map +1 -0
- package/lib/billing-mode.js +44 -0
- package/lib/billing-mode.js.map +1 -0
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +3 -3
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +1 -1
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/key-provider.js +1 -1
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/experiments/configcat-server.d.ts +2 -0
- package/lib/experiments/configcat-server.d.ts.map +1 -1
- package/lib/experiments/configcat-server.js +2 -1
- package/lib/experiments/configcat-server.js.map +1 -1
- package/lib/experiments/configcat.d.ts +1 -2
- package/lib/experiments/configcat.d.ts.map +1 -1
- package/lib/experiments/configcat.js +4 -6
- package/lib/experiments/configcat.js.map +1 -1
- package/lib/experiments/types.d.ts +2 -3
- package/lib/experiments/types.d.ts.map +1 -1
- package/lib/experiments/types.js.map +1 -1
- package/lib/gitpod-service.d.ts +26 -25
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +13 -1
- package/lib/gitpod-service.js.map +1 -1
- package/lib/ide-protocol.d.ts +8 -0
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +1 -17
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +1 -2
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +5 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +11 -3
- package/lib/messaging/error.js.map +1 -1
- package/lib/plans.d.ts +1 -0
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +6 -2
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +59 -21
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +37 -9
- package/lib/protocol.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +1 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +4 -0
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +12 -1
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/usage.d.ts +49 -10
- package/lib/usage.d.ts.map +1 -1
- package/lib/usage.js +6 -107
- package/lib/usage.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +5 -0
- package/lib/util/garbage-collected-cache.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 +18 -0
- package/lib/util/gitpod-host-url.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/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/nice-grpc.d.ts +9 -0
- package/lib/util/nice-grpc.d.ts.map +1 -0
- package/lib/util/nice-grpc.js +119 -0
- package/lib/util/nice-grpc.js.map +1 -0
- package/lib/util/timeutil.d.ts +1 -0
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +7 -1
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +2 -0
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +34 -0
- package/lib/util/timeutil.spec.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 +7 -13
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +1 -0
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.js +1 -1
- package/package.json +7 -2
- package/pkg-yarn.lock +5 -2
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +3 -0
- package/src/admin-protocol.ts +4 -1
- package/src/attribution.ts +15 -0
- package/src/billing-mode.ts +81 -0
- package/src/encryption/encryption-engine.spec.ts +1 -1
- package/src/encryption/encryption-engine.ts +7 -3
- package/src/encryption/key-provider.ts +1 -1
- package/src/experiments/configcat-server.ts +3 -0
- package/src/experiments/configcat.ts +3 -5
- package/src/experiments/types.ts +4 -5
- package/src/gitpod-service.ts +43 -27
- package/src/ide-protocol.ts +10 -0
- package/src/index.ts +1 -1
- package/src/messaging/client-call-metrics.ts +1 -20
- package/src/messaging/error.ts +16 -4
- package/src/plans.ts +6 -2
- package/src/protocol.ts +88 -27
- package/src/team-subscription-protocol.ts +3 -0
- package/src/teams-projects-protocol.ts +13 -1
- package/src/usage.ts +53 -128
- package/src/util/garbage-collected-cache.ts +5 -0
- package/src/util/gitpod-host-url.ts +21 -0
- package/src/util/grpc.ts +89 -0
- package/src/util/logging.spec.ts +23 -0
- package/src/util/nice-grpc.ts +93 -0
- package/src/util/timeutil.spec.ts +28 -1
- package/src/util/timeutil.ts +6 -0
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +11 -10
- package/src/workspace-instance.ts +3 -0
- package/src/wsready.ts +1 -1
- package/lib/email-protocol.d.ts +0 -49
- package/lib/email-protocol.d.ts.map +0 -1
- package/lib/email-protocol.js +0 -28
- package/lib/email-protocol.js.map +0 -1
- package/src/email-protocol.ts +0 -65
package/src/experiments/types.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { User } from "../protocol";
|
|
8
|
-
import { Team } from "../teams-projects-protocol";
|
|
7
|
+
import { BillingTier, User } from "../protocol";
|
|
9
8
|
|
|
10
9
|
export const Client = Symbol("Client");
|
|
11
10
|
|
|
@@ -15,6 +14,9 @@ export interface Attributes {
|
|
|
15
14
|
// user.id is mapped to ConfigCat's "identifier" + "custom.user_id"
|
|
16
15
|
user?: User | { id: string; email?: string };
|
|
17
16
|
|
|
17
|
+
// The BillingTier of this particular user
|
|
18
|
+
billingTier?: BillingTier;
|
|
19
|
+
|
|
18
20
|
// Currently selected Gitpod Project ID (mapped to "custom.project_id")
|
|
19
21
|
projectId?: string;
|
|
20
22
|
|
|
@@ -22,9 +24,6 @@ export interface Attributes {
|
|
|
22
24
|
teamId?: string;
|
|
23
25
|
// Currently selected Gitpod Team Name (mapped to "custom.team_name")
|
|
24
26
|
teamName?: string;
|
|
25
|
-
|
|
26
|
-
// All the Gitpod Teams that the user is a member (or owner) of (mapped to "custom.team_names" and "custom.team_ids")
|
|
27
|
-
teams?: Team[];
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export interface Client {
|
package/src/gitpod-service.ts
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
PrebuildWithStatus,
|
|
38
38
|
StartPrebuildResult,
|
|
39
39
|
PartialProject,
|
|
40
|
+
PrebuildEvent,
|
|
40
41
|
} from "./teams-projects-protocol";
|
|
41
42
|
import { JsonRpcProxy, JsonRpcServer } from "./messaging/proxy-factory";
|
|
42
43
|
import { Disposable, CancellationTokenSource } from "vscode-jsonrpc";
|
|
@@ -59,8 +60,9 @@ import {
|
|
|
59
60
|
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
|
|
60
61
|
import { IDEServer } from "./ide-protocol";
|
|
61
62
|
import { InstallationAdminSettings, TelemetryData } from "./installation-admin-protocol";
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
63
|
+
import { ListUsageRequest, ListUsageResponse } from "./usage";
|
|
64
|
+
import { SupportedWorkspaceClass } from "./workspace-class";
|
|
65
|
+
import { BillingMode } from "./billing-mode";
|
|
64
66
|
|
|
65
67
|
export interface GitpodClient {
|
|
66
68
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
@@ -68,6 +70,8 @@ export interface GitpodClient {
|
|
|
68
70
|
|
|
69
71
|
onPrebuildUpdate(update: PrebuildWithStatus): void;
|
|
70
72
|
|
|
73
|
+
onNotificationUpdated(): void;
|
|
74
|
+
|
|
71
75
|
onCreditAlert(creditAlert: CreditAlert): void;
|
|
72
76
|
|
|
73
77
|
//#region propagating reconnection to iframe
|
|
@@ -82,6 +86,8 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
82
86
|
getLoggedInUser(): Promise<User>;
|
|
83
87
|
getTerms(): Promise<Terms>;
|
|
84
88
|
updateLoggedInUser(user: Partial<User>): Promise<User>;
|
|
89
|
+
sendPhoneNumberVerificationToken(phoneNumber: string): Promise<void>;
|
|
90
|
+
verifyPhoneNumberVerificationToken(phoneNumber: string, token: string): Promise<boolean>;
|
|
85
91
|
getAuthProviders(): Promise<AuthProviderInfo[]>;
|
|
86
92
|
getOwnAuthProviders(): Promise<AuthProviderEntry[]>;
|
|
87
93
|
updateOwnAuthProvider(params: GitpodServer.UpdateOwnAuthProviderParams): Promise<AuthProviderEntry>;
|
|
@@ -181,16 +187,12 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
181
187
|
getTeamProjects(teamId: string): Promise<Project[]>;
|
|
182
188
|
getUserProjects(): Promise<Project[]>;
|
|
183
189
|
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
190
|
+
getPrebuildEvents(projectId: string): Promise<PrebuildEvent[]>;
|
|
184
191
|
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
185
192
|
findPrebuildByWorkspaceID(workspaceId: string): Promise<PrebuiltWorkspace | undefined>;
|
|
186
193
|
getPrebuild(prebuildId: string): Promise<PrebuildWithStatus | undefined>;
|
|
187
194
|
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
188
195
|
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
189
|
-
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
190
|
-
guessProjectConfiguration(projectId: string): Promise<string | undefined>;
|
|
191
|
-
fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
192
|
-
guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
193
|
-
setProjectConfiguration(projectId: string, configString: string): Promise<void>;
|
|
194
196
|
updateProjectPartial(partialProject: PartialProject): Promise<void>;
|
|
195
197
|
setProjectEnvironmentVariable(projectId: string, name: string, value: string, censored: boolean): Promise<void>;
|
|
196
198
|
getProjectEnvironmentVariables(projectId: string): Promise<ProjectEnvVar[]>;
|
|
@@ -206,7 +208,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
206
208
|
deleteGitpodToken(tokenHash: string): Promise<void>;
|
|
207
209
|
|
|
208
210
|
// misc
|
|
209
|
-
sendFeedback(feedback: string): Promise<string | undefined>;
|
|
210
211
|
isGitHubAppEnabled(): Promise<boolean>;
|
|
211
212
|
registerGithubApp(installationId: string): Promise<void>;
|
|
212
213
|
|
|
@@ -226,16 +227,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
226
227
|
*/
|
|
227
228
|
getSnapshots(workspaceID: string): Promise<string[]>;
|
|
228
229
|
|
|
229
|
-
/**
|
|
230
|
-
* stores/updates layout information for the given workspace
|
|
231
|
-
*/
|
|
232
|
-
storeLayout(workspaceId: string, layoutData: string): Promise<void>;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* retrieves layout information for the given workspace
|
|
236
|
-
*/
|
|
237
|
-
getLayout(workspaceId: string): Promise<string | undefined>;
|
|
238
|
-
|
|
239
230
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
240
231
|
|
|
241
232
|
/**
|
|
@@ -285,11 +276,20 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
285
276
|
|
|
286
277
|
getStripePublishableKey(): Promise<string>;
|
|
287
278
|
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
279
|
+
findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
|
|
280
|
+
createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
|
|
281
|
+
subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
|
|
282
|
+
getStripePortalUrl(attributionId: string): Promise<string>;
|
|
283
|
+
getUsageLimit(attributionId: string): Promise<number | undefined>;
|
|
284
|
+
setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
|
|
285
|
+
|
|
286
|
+
listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
|
|
287
|
+
|
|
288
|
+
setUsageAttribution(usageAttribution: string): Promise<void>;
|
|
289
|
+
listAvailableUsageAttributionIds(): Promise<string[]>;
|
|
291
290
|
|
|
292
|
-
|
|
291
|
+
getBillingModeForUser(): Promise<BillingMode>;
|
|
292
|
+
getBillingModeForTeam(teamId: string): Promise<BillingMode>;
|
|
293
293
|
|
|
294
294
|
/**
|
|
295
295
|
* Analytics
|
|
@@ -297,6 +297,13 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
297
297
|
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
298
298
|
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
299
299
|
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Frontend notifications
|
|
303
|
+
*/
|
|
304
|
+
getNotifications(): Promise<string[]>;
|
|
305
|
+
|
|
306
|
+
getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
|
|
300
307
|
}
|
|
301
308
|
|
|
302
309
|
export interface RateLimiterError {
|
|
@@ -311,9 +318,7 @@ export interface RateLimiterError {
|
|
|
311
318
|
|
|
312
319
|
export interface CreateProjectParams {
|
|
313
320
|
name: string;
|
|
314
|
-
slug
|
|
315
|
-
account: string;
|
|
316
|
-
provider: string;
|
|
321
|
+
slug: string;
|
|
317
322
|
cloneUrl: string;
|
|
318
323
|
teamId?: string;
|
|
319
324
|
userId?: string;
|
|
@@ -378,7 +383,7 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
|
|
|
378
383
|
get: (target: S, property: keyof S) => {
|
|
379
384
|
const result = target[property];
|
|
380
385
|
if (!result) {
|
|
381
|
-
throw new Error(`Method ${property} not implemented`);
|
|
386
|
+
throw new Error(`Method ${String(property)} not implemented`);
|
|
382
387
|
}
|
|
383
388
|
return result;
|
|
384
389
|
},
|
|
@@ -424,7 +429,6 @@ export namespace GitpodServer {
|
|
|
424
429
|
}
|
|
425
430
|
export interface TakeSnapshotOptions {
|
|
426
431
|
workspaceId: string;
|
|
427
|
-
layoutData?: string;
|
|
428
432
|
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
429
433
|
dontWait?: boolean;
|
|
430
434
|
}
|
|
@@ -552,6 +556,18 @@ export class GitpodCompositeClient<Client extends GitpodClient> implements Gitpo
|
|
|
552
556
|
}
|
|
553
557
|
}
|
|
554
558
|
}
|
|
559
|
+
|
|
560
|
+
onNotificationUpdated(): void {
|
|
561
|
+
for (const client of this.clients) {
|
|
562
|
+
if (client.onNotificationUpdated) {
|
|
563
|
+
try {
|
|
564
|
+
client.onNotificationUpdated();
|
|
565
|
+
} catch (error) {
|
|
566
|
+
console.error(error);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
555
571
|
}
|
|
556
572
|
|
|
557
573
|
export type GitpodService = GitpodServiceImpl<GitpodClient, GitpodServer>;
|
package/src/ide-protocol.ts
CHANGED
|
@@ -116,4 +116,14 @@ export interface IDEOption {
|
|
|
116
116
|
* we resolve the tag regularly to the most recent image version.
|
|
117
117
|
*/
|
|
118
118
|
resolveImageDigest?: boolean;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The plugin image ref for the IDE image, this image ref always resolve to digest.
|
|
122
|
+
*/
|
|
123
|
+
pluginImage?: string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The latest plugin image ref for the latest IDE image, this image ref always resolve to digest.
|
|
127
|
+
*/
|
|
128
|
+
pluginLatestImage?: string;
|
|
119
129
|
}
|
package/src/index.ts
CHANGED
|
@@ -13,10 +13,10 @@ export * from "./license-protocol";
|
|
|
13
13
|
export * from "./workspace-instance";
|
|
14
14
|
export * from "./permission";
|
|
15
15
|
export * from "./admin-protocol";
|
|
16
|
-
export * from "./email-protocol";
|
|
17
16
|
export * from "./headless-workspace-log";
|
|
18
17
|
export * from "./context-url";
|
|
19
18
|
export * from "./teams-projects-protocol";
|
|
20
19
|
export * from "./snapshot-url";
|
|
21
20
|
export * from "./oss-allowlist";
|
|
22
21
|
export * from "./installation-admin-protocol";
|
|
22
|
+
export * from "./webhook-event";
|
|
@@ -6,26 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { injectable } from "inversify";
|
|
8
8
|
import * as prometheusClient from "prom-client";
|
|
9
|
-
|
|
10
|
-
type GrpcMethodType = "unary" | "client_stream" | "server_stream" | "bidi_stream";
|
|
11
|
-
export interface IGrpcCallMetricsLabels {
|
|
12
|
-
service: string;
|
|
13
|
-
method: string;
|
|
14
|
-
type: GrpcMethodType;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface IGrpcCallMetricsLabelsWithCode extends IGrpcCallMetricsLabels {
|
|
18
|
-
code: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const IClientCallMetrics = Symbol("IClientCallMetrics");
|
|
22
|
-
|
|
23
|
-
export interface IClientCallMetrics {
|
|
24
|
-
started(labels: IGrpcCallMetricsLabels): void;
|
|
25
|
-
sent(labels: IGrpcCallMetricsLabels): void;
|
|
26
|
-
received(labels: IGrpcCallMetricsLabels): void;
|
|
27
|
-
handled(labels: IGrpcCallMetricsLabelsWithCode): void;
|
|
28
|
-
}
|
|
9
|
+
import { IClientCallMetrics, IGrpcCallMetricsLabels, IGrpcCallMetricsLabelsWithCode } from "../util/grpc";
|
|
29
10
|
|
|
30
11
|
@injectable()
|
|
31
12
|
export class PrometheusClientCallMetrics implements IClientCallMetrics {
|
package/src/messaging/error.ts
CHANGED
|
@@ -26,21 +26,30 @@ export namespace ErrorCodes {
|
|
|
26
26
|
// 410 No User
|
|
27
27
|
export const SETUP_REQUIRED = 410;
|
|
28
28
|
|
|
29
|
+
// 411 No User
|
|
30
|
+
export const NEEDS_VERIFICATION = 411;
|
|
31
|
+
|
|
29
32
|
// 429 Too Many Requests
|
|
30
33
|
export const TOO_MANY_REQUESTS = 429;
|
|
31
34
|
|
|
32
35
|
// 430 Repository not whitelisted (custom status code)
|
|
33
36
|
export const REPOSITORY_NOT_WHITELISTED = 430;
|
|
34
37
|
|
|
38
|
+
// 450 Payment error
|
|
39
|
+
export const PAYMENT_ERROR = 450;
|
|
40
|
+
|
|
41
|
+
// 451 Out of credits
|
|
42
|
+
export const PAYMENT_SPENDING_LIMIT_REACHED = 451;
|
|
43
|
+
|
|
44
|
+
// 455 Invalid cost center (custom status code)
|
|
45
|
+
export const INVALID_COST_CENTER = 455;
|
|
46
|
+
|
|
35
47
|
// 460 Context Parse Error (custom status code)
|
|
36
48
|
export const CONTEXT_PARSE_ERROR = 460;
|
|
37
49
|
|
|
38
|
-
// 461 Invalid gitpod yml
|
|
50
|
+
// 461 Invalid gitpod yml (custom status code)
|
|
39
51
|
export const INVALID_GITPOD_YML = 461;
|
|
40
52
|
|
|
41
|
-
// 450 Payment error
|
|
42
|
-
export const PAYMENT_ERROR = 450;
|
|
43
|
-
|
|
44
53
|
// 470 User Blocked (custom status code)
|
|
45
54
|
export const USER_BLOCKED = 470;
|
|
46
55
|
|
|
@@ -85,4 +94,7 @@ export namespace ErrorCodes {
|
|
|
85
94
|
|
|
86
95
|
// 640 Headless logs are not available (yet)
|
|
87
96
|
export const HEADLESS_LOG_NOT_YET_AVAILABLE = 640;
|
|
97
|
+
|
|
98
|
+
// 650 Invalid Value
|
|
99
|
+
export const INVALID_VALUE = 650;
|
|
88
100
|
}
|
package/src/plans.ts
CHANGED
|
@@ -131,7 +131,7 @@ export namespace Plans {
|
|
|
131
131
|
githubPlanNumber: 1,
|
|
132
132
|
|
|
133
133
|
type: "free",
|
|
134
|
-
name: "
|
|
134
|
+
name: "Free",
|
|
135
135
|
currency: "USD",
|
|
136
136
|
pricePerMonth: 0,
|
|
137
137
|
hoursPerMonth: 100,
|
|
@@ -146,7 +146,7 @@ export namespace Plans {
|
|
|
146
146
|
githubPlanNumber: 5,
|
|
147
147
|
|
|
148
148
|
type: "free-50",
|
|
149
|
-
name: "
|
|
149
|
+
name: "Free",
|
|
150
150
|
currency: "USD",
|
|
151
151
|
pricePerMonth: 0,
|
|
152
152
|
hoursPerMonth: 50,
|
|
@@ -482,6 +482,10 @@ export namespace Plans {
|
|
|
482
482
|
);
|
|
483
483
|
}
|
|
484
484
|
|
|
485
|
+
export function isFreeTier(chargebeeId: string | undefined): boolean {
|
|
486
|
+
return chargebeeId === Plans.FREE.chargebeeId || chargebeeId === Plans.FREE_50.chargebeeId;
|
|
487
|
+
}
|
|
488
|
+
|
|
485
489
|
export function isFreeNonTransientPlan(chargebeeId: string | undefined): boolean {
|
|
486
490
|
return chargebeeId === Plans.FREE_OPEN_SOURCE.chargebeeId;
|
|
487
491
|
}
|
package/src/protocol.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { WorkspaceInstance, PortVisibility } from "./workspace-instance";
|
|
|
8
8
|
import { RoleOrPermission } from "./permission";
|
|
9
9
|
import { Project } from "./teams-projects-protocol";
|
|
10
10
|
import { createHash } from "crypto";
|
|
11
|
+
import { AttributionId } from "./attribution";
|
|
11
12
|
|
|
12
13
|
export interface UserInfo {
|
|
13
14
|
name?: string;
|
|
@@ -45,6 +46,15 @@ export interface User {
|
|
|
45
46
|
markedDeleted?: boolean;
|
|
46
47
|
|
|
47
48
|
additionalData?: AdditionalUserData;
|
|
49
|
+
|
|
50
|
+
// Identifies an explicit team or user ID to which all the user's workspace usage should be attributed to (e.g. for billing purposes)
|
|
51
|
+
usageAttributionId?: string;
|
|
52
|
+
|
|
53
|
+
// The last time this user got verified somehow. The user is not verified if this is empty.
|
|
54
|
+
lastVerificationTime?: string;
|
|
55
|
+
|
|
56
|
+
// The phone number used for the last phone verification.
|
|
57
|
+
verificationPhoneNumber?: string;
|
|
48
58
|
}
|
|
49
59
|
|
|
50
60
|
export namespace User {
|
|
@@ -199,14 +209,26 @@ export interface AdditionalUserData {
|
|
|
199
209
|
knownGitHubOrgs?: string[];
|
|
200
210
|
// Git clone URL pointing to the user's dotfile repo
|
|
201
211
|
dotfileRepo?: string;
|
|
202
|
-
// Identifies an explicit team or user ID to which all the user's workspace usage should be attributed to (e.g. for billing purposes)
|
|
203
|
-
usageAttributionId?: string;
|
|
204
212
|
// preferred workspace classes
|
|
205
213
|
workspaceClasses?: WorkspaceClasses;
|
|
206
214
|
// additional user profile data
|
|
207
215
|
profile?: ProfileDetails;
|
|
208
216
|
}
|
|
209
|
-
|
|
217
|
+
export namespace AdditionalUserData {
|
|
218
|
+
export function set(user: User, partialData: Partial<AdditionalUserData>): User {
|
|
219
|
+
if (!user.additionalData) {
|
|
220
|
+
user.additionalData = {
|
|
221
|
+
...partialData,
|
|
222
|
+
};
|
|
223
|
+
} else {
|
|
224
|
+
user.additionalData = {
|
|
225
|
+
...user.additionalData,
|
|
226
|
+
...partialData,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
return user;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
210
232
|
// The format in which we store User Profiles in
|
|
211
233
|
export interface ProfileDetails {
|
|
212
234
|
// when was the last time the user updated their profile information or has been nudged to do so.
|
|
@@ -264,17 +286,30 @@ export interface UserFeatureSettings {
|
|
|
264
286
|
permanentWSFeatureFlags?: NamedWorkspaceFeatureFlag[];
|
|
265
287
|
}
|
|
266
288
|
|
|
289
|
+
export type BillingTier = "paid" | "free";
|
|
290
|
+
|
|
267
291
|
/**
|
|
268
292
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
269
293
|
* If they don't we'll break things during workspace startup.
|
|
270
294
|
*/
|
|
271
295
|
export const WorkspaceFeatureFlags = {
|
|
272
296
|
full_workspace_backup: undefined,
|
|
273
|
-
fixed_resources: undefined,
|
|
274
297
|
persistent_volume_claim: undefined,
|
|
275
298
|
protected_secrets: undefined,
|
|
299
|
+
workspace_class_limiting: undefined,
|
|
300
|
+
workspace_connection_limiting: undefined,
|
|
301
|
+
workspace_psi: undefined,
|
|
276
302
|
};
|
|
277
303
|
export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
|
|
304
|
+
export namespace NamedWorkspaceFeatureFlag {
|
|
305
|
+
export const WORKSPACE_PERSISTED_FEATTURE_FLAGS: NamedWorkspaceFeatureFlag[] = [
|
|
306
|
+
"full_workspace_backup",
|
|
307
|
+
"persistent_volume_claim",
|
|
308
|
+
];
|
|
309
|
+
export function isWorkspacePersisted(ff: NamedWorkspaceFeatureFlag): boolean {
|
|
310
|
+
return WORKSPACE_PERSISTED_FEATTURE_FLAGS.includes(ff);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
278
313
|
|
|
279
314
|
export interface EnvVarWithValue {
|
|
280
315
|
name: string;
|
|
@@ -605,6 +640,7 @@ export interface PendingGithubEvent {
|
|
|
605
640
|
creationDate: Date;
|
|
606
641
|
type: string;
|
|
607
642
|
event: string;
|
|
643
|
+
deleted: boolean;
|
|
608
644
|
}
|
|
609
645
|
|
|
610
646
|
export interface Snapshot {
|
|
@@ -613,7 +649,6 @@ export interface Snapshot {
|
|
|
613
649
|
availableTime?: string;
|
|
614
650
|
originalWorkspaceId: string;
|
|
615
651
|
bucketId: string;
|
|
616
|
-
layoutData?: string;
|
|
617
652
|
state: SnapshotState;
|
|
618
653
|
message?: string;
|
|
619
654
|
}
|
|
@@ -625,14 +660,13 @@ export interface VolumeSnapshot {
|
|
|
625
660
|
volumeHandle: string;
|
|
626
661
|
}
|
|
627
662
|
|
|
628
|
-
export
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
workspaceId: string;
|
|
632
|
-
lastUpdatedTime: string;
|
|
633
|
-
layoutData: string;
|
|
663
|
+
export interface VolumeSnapshotWithWSType {
|
|
664
|
+
vs: VolumeSnapshot;
|
|
665
|
+
wsType: WorkspaceType;
|
|
634
666
|
}
|
|
635
667
|
|
|
668
|
+
export type SnapshotState = "pending" | "available" | "error";
|
|
669
|
+
|
|
636
670
|
export interface Workspace {
|
|
637
671
|
id: string;
|
|
638
672
|
creationTime: string;
|
|
@@ -694,7 +728,7 @@ export interface Workspace {
|
|
|
694
728
|
|
|
695
729
|
export type WorkspaceSoftDeletion = "user" | "gc";
|
|
696
730
|
|
|
697
|
-
export type WorkspaceType = "regular" | "prebuild"
|
|
731
|
+
export type WorkspaceType = "regular" | "prebuild";
|
|
698
732
|
|
|
699
733
|
export namespace Workspace {
|
|
700
734
|
export function getFullRepositoryName(ws: Workspace): string | undefined {
|
|
@@ -767,6 +801,8 @@ export interface JetBrainsConfig {
|
|
|
767
801
|
goland?: JetBrainsProductConfig;
|
|
768
802
|
pycharm?: JetBrainsProductConfig;
|
|
769
803
|
phpstorm?: JetBrainsProductConfig;
|
|
804
|
+
rubymine?: JetBrainsProductConfig;
|
|
805
|
+
webstorm?: JetBrainsProductConfig;
|
|
770
806
|
}
|
|
771
807
|
export interface JetBrainsProductConfig {
|
|
772
808
|
prebuilds?: JetBrainsPrebuilds;
|
|
@@ -781,6 +817,12 @@ export interface RepositoryCloneInformation {
|
|
|
781
817
|
checkoutLocation?: string;
|
|
782
818
|
}
|
|
783
819
|
|
|
820
|
+
export interface CoreDumpConfig {
|
|
821
|
+
enabled?: boolean;
|
|
822
|
+
softLimit?: number;
|
|
823
|
+
hardLimit?: number;
|
|
824
|
+
}
|
|
825
|
+
|
|
784
826
|
export interface WorkspaceConfig {
|
|
785
827
|
mainConfiguration?: string;
|
|
786
828
|
additionalRepositories?: RepositoryCloneInformation[];
|
|
@@ -793,6 +835,7 @@ export interface WorkspaceConfig {
|
|
|
793
835
|
github?: GithubAppConfig;
|
|
794
836
|
vscode?: VSCodeConfig;
|
|
795
837
|
jetbrains?: JetBrainsConfig;
|
|
838
|
+
coreDump?: CoreDumpConfig;
|
|
796
839
|
|
|
797
840
|
/** deprecated. Enabled by default **/
|
|
798
841
|
experimentalNetwork?: boolean;
|
|
@@ -801,13 +844,12 @@ export interface WorkspaceConfig {
|
|
|
801
844
|
* Where the config object originates from.
|
|
802
845
|
*
|
|
803
846
|
* repo - from the repository
|
|
804
|
-
* project-db - from the "Project" stored in the database
|
|
805
847
|
* definitly-gp - from github.com/gitpod-io/definitely-gp
|
|
806
848
|
* derived - computed based on analyzing the repository
|
|
807
849
|
* additional-content - config comes from additional content, usually provided through the project's configuration
|
|
808
850
|
* default - our static catch-all default config
|
|
809
851
|
*/
|
|
810
|
-
_origin?: "repo" | "
|
|
852
|
+
_origin?: "repo" | "definitely-gp" | "derived" | "additional-content" | "default";
|
|
811
853
|
|
|
812
854
|
/**
|
|
813
855
|
* Set of automatically infered feature flags. That's not something the user can set, but
|
|
@@ -1075,13 +1117,16 @@ export namespace SnapshotContext {
|
|
|
1075
1117
|
}
|
|
1076
1118
|
}
|
|
1077
1119
|
|
|
1078
|
-
export interface
|
|
1079
|
-
actual: WorkspaceContext;
|
|
1120
|
+
export interface WithCommitHistory {
|
|
1080
1121
|
commitHistory?: string[];
|
|
1081
1122
|
additionalRepositoryCommitHistories?: {
|
|
1082
1123
|
cloneUrl: string;
|
|
1083
1124
|
commitHistory: string[];
|
|
1084
1125
|
}[];
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
export interface StartPrebuildContext extends WorkspaceContext, WithCommitHistory {
|
|
1129
|
+
actual: WorkspaceContext;
|
|
1085
1130
|
project?: Project;
|
|
1086
1131
|
branch?: string;
|
|
1087
1132
|
}
|
|
@@ -1125,17 +1170,6 @@ export namespace WithEnvvarsContext {
|
|
|
1125
1170
|
}
|
|
1126
1171
|
}
|
|
1127
1172
|
|
|
1128
|
-
export interface WorkspaceProbeContext extends WorkspaceContext {
|
|
1129
|
-
responseURL: string;
|
|
1130
|
-
responseToken: string;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
export namespace WorkspaceProbeContext {
|
|
1134
|
-
export function is(context: any): context is WorkspaceProbeContext {
|
|
1135
|
-
return context && "responseURL" in context && "responseToken" in context;
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
1173
|
export type RefType = "branch" | "tag" | "revision";
|
|
1140
1174
|
export namespace RefType {
|
|
1141
1175
|
export const getRefType = (commit: Commit): RefType => {
|
|
@@ -1175,6 +1209,16 @@ export namespace AdditionalContentContext {
|
|
|
1175
1209
|
}
|
|
1176
1210
|
}
|
|
1177
1211
|
|
|
1212
|
+
export interface OpenPrebuildContext extends WorkspaceContext {
|
|
1213
|
+
openPrebuildID: string;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
export namespace OpenPrebuildContext {
|
|
1217
|
+
export function is(ctx: any): ctx is OpenPrebuildContext {
|
|
1218
|
+
return "openPrebuildID" in ctx;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1178
1222
|
export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
|
|
1179
1223
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
1180
1224
|
cloneUrl?: string;
|
|
@@ -1347,6 +1391,8 @@ export enum CreateWorkspaceMode {
|
|
|
1347
1391
|
UsePrebuild = "use-prebuild",
|
|
1348
1392
|
// SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
|
|
1349
1393
|
SelectIfRunning = "select-if-running",
|
|
1394
|
+
// UseLastSuccessfulPrebuild returns ...
|
|
1395
|
+
UseLastSuccessfulPrebuild = "use-last-successful-prebuild",
|
|
1350
1396
|
}
|
|
1351
1397
|
|
|
1352
1398
|
export namespace WorkspaceCreationResult {
|
|
@@ -1481,3 +1527,18 @@ export interface Terms {
|
|
|
1481
1527
|
readonly content: string;
|
|
1482
1528
|
readonly formElements?: object;
|
|
1483
1529
|
}
|
|
1530
|
+
|
|
1531
|
+
export interface StripeConfig {
|
|
1532
|
+
individualUsagePriceIds: { [currency: string]: string };
|
|
1533
|
+
teamUsagePriceIds: { [currency: string]: string };
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
export type BillingStrategy = "other" | "stripe";
|
|
1537
|
+
export interface CostCenter {
|
|
1538
|
+
readonly id: AttributionId;
|
|
1539
|
+
/**
|
|
1540
|
+
* Unit: credits
|
|
1541
|
+
*/
|
|
1542
|
+
spendingLimit: number;
|
|
1543
|
+
billingStrategy: BillingStrategy;
|
|
1544
|
+
}
|
|
@@ -55,6 +55,9 @@ export namespace TeamSubscription2 {
|
|
|
55
55
|
export const isActive = (ts2: TeamSubscription2, date: string): boolean => {
|
|
56
56
|
return ts2.startDate <= date && (ts2.endDate === undefined || date < ts2.endDate);
|
|
57
57
|
};
|
|
58
|
+
export function isCancelled(s: TeamSubscription2, date: string): boolean {
|
|
59
|
+
return (!!s.cancellationDate && s.cancellationDate < date) || (!!s.endDate && s.endDate < date); // This edge case is meant to handle bad data: If for whatever reason cancellationDate has not been set: treat endDate as such
|
|
60
|
+
}
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
/**
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { PrebuiltWorkspaceState } from "./protocol";
|
|
8
8
|
import { v4 as uuidv4 } from "uuid";
|
|
9
9
|
import { DeepPartial } from "./util/deep-partial";
|
|
10
|
+
import { WebhookEvent } from "./webhook-event";
|
|
10
11
|
|
|
11
12
|
export interface ProjectConfig {
|
|
12
13
|
".gitpod.yml": string;
|
|
@@ -26,7 +27,6 @@ export interface Project {
|
|
|
26
27
|
teamId?: string;
|
|
27
28
|
userId?: string;
|
|
28
29
|
appInstallationId: string;
|
|
29
|
-
config?: ProjectConfig;
|
|
30
30
|
settings?: ProjectSettings;
|
|
31
31
|
creationTime: string;
|
|
32
32
|
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
@@ -152,3 +152,15 @@ export interface TeamMembershipInvite {
|
|
|
152
152
|
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
153
153
|
deleted?: boolean;
|
|
154
154
|
}
|
|
155
|
+
|
|
156
|
+
export interface PrebuildEvent {
|
|
157
|
+
id: string;
|
|
158
|
+
creationTime: string;
|
|
159
|
+
status: WebhookEvent.Status | WebhookEvent.PrebuildStatus;
|
|
160
|
+
message?: string;
|
|
161
|
+
prebuildId?: string;
|
|
162
|
+
projectId?: string;
|
|
163
|
+
cloneUrl?: string;
|
|
164
|
+
branch?: string;
|
|
165
|
+
commit?: string;
|
|
166
|
+
}
|