@gitpod/gitpod-protocol 0.1.5-pd-ide-service.13 → 0.1.5-pd-add-grpc-sec.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 +16 -0
- package/lib/admin-protocol.d.ts +10 -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 +4 -0
- package/lib/billing-mode.d.ts.map +1 -1
- package/lib/context-url.d.ts +0 -1
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +0 -2
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +0 -2
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +0 -28
- package/lib/context-url.spec.js.map +1 -1
- 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.map +1 -1
- package/lib/experiments/configcat-server.js +1 -0
- 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 +11 -19
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js.map +1 -1
- package/lib/ide-protocol.d.ts +9 -1
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +2 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +13 -0
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +2 -0
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +4 -0
- package/lib/messaging/error.js.map +1 -1
- package/lib/plans.js +2 -2
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +27 -41
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +10 -25
- package/lib/protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +5 -2
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/usage.d.ts +12 -0
- package/lib/usage.d.ts.map +1 -1
- package/lib/usage.js +7 -1
- package/lib/usage.js.map +1 -1
- package/lib/util/grpc.d.ts +1 -0
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/nice-grpc.d.ts.map +1 -1
- package/lib/util/nice-grpc.js +2 -0
- package/lib/util/nice-grpc.js.map +1 -1
- package/lib/workspace-class.d.ts +1 -1
- package/lib/workspace-class.d.ts.map +1 -1
- package/lib/workspace-cluster.d.ts +6 -5
- 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.d.ts +9 -3
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +2 -0
- package/lib/wsready.js.map +1 -1
- package/package.json +1 -1
- package/pkg-yarn.lock +1 -1
- package/provenance-bundle.jsonl +1 -1
- package/src/admin-protocol.ts +14 -1
- package/src/attribution.ts +15 -0
- package/src/billing-mode.ts +7 -0
- package/src/context-url.spec.ts +0 -18
- package/src/context-url.ts +0 -2
- 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 +1 -0
- package/src/experiments/configcat.ts +3 -5
- package/src/experiments/types.ts +4 -5
- package/src/gitpod-service.ts +11 -23
- package/src/ide-protocol.ts +11 -1
- package/src/index.ts +0 -1
- package/src/messaging/client-call-metrics.ts +17 -0
- package/src/messaging/error.ts +6 -0
- package/src/plans.ts +2 -2
- package/src/protocol.ts +32 -58
- package/src/teams-projects-protocol.ts +8 -3
- package/src/usage.ts +14 -0
- package/src/util/grpc.ts +3 -0
- package/src/util/nice-grpc.ts +3 -0
- package/src/workspace-class.ts +1 -1
- package/src/workspace-cluster.ts +11 -6
- package/src/workspace-instance.ts +6 -0
- package/src/wsready.ts +11 -5
- 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
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
WhitelistedRepository,
|
|
13
13
|
WorkspaceImageBuild,
|
|
14
14
|
AuthProviderInfo,
|
|
15
|
-
CreateWorkspaceMode,
|
|
16
15
|
Token,
|
|
17
16
|
UserEnvVarValue,
|
|
18
17
|
Terms,
|
|
@@ -59,8 +58,7 @@ import {
|
|
|
59
58
|
} from "./team-subscription-protocol";
|
|
60
59
|
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from "./analytics";
|
|
61
60
|
import { IDEServer } from "./ide-protocol";
|
|
62
|
-
import {
|
|
63
|
-
import { ListUsageRequest, ListUsageResponse } from "./usage";
|
|
61
|
+
import { ListUsageRequest, ListUsageResponse, CostCenterJSON } from "./usage";
|
|
64
62
|
import { SupportedWorkspaceClass } from "./workspace-class";
|
|
65
63
|
import { BillingMode } from "./billing-mode";
|
|
66
64
|
|
|
@@ -165,6 +163,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
165
163
|
deleteSSHPublicKey(id: string): Promise<void>;
|
|
166
164
|
|
|
167
165
|
// Teams
|
|
166
|
+
getTeam(teamId: string): Promise<Team>;
|
|
168
167
|
getTeams(): Promise<Team[]>;
|
|
169
168
|
getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
|
|
170
169
|
createTeam(name: string): Promise<Team>;
|
|
@@ -173,12 +172,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
173
172
|
removeTeamMember(teamId: string, userId: string): Promise<void>;
|
|
174
173
|
getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
|
|
175
174
|
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
176
|
-
deleteTeam(teamId: string
|
|
177
|
-
|
|
178
|
-
// Admin Settings
|
|
179
|
-
adminGetSettings(): Promise<InstallationAdminSettings>;
|
|
180
|
-
adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
|
|
181
|
-
adminGetTelemetryData(): Promise<TelemetryData>;
|
|
175
|
+
deleteTeam(teamId: string): Promise<void>;
|
|
182
176
|
|
|
183
177
|
// Projects
|
|
184
178
|
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
@@ -227,16 +221,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
227
221
|
*/
|
|
228
222
|
getSnapshots(workspaceID: string): Promise<string[]>;
|
|
229
223
|
|
|
230
|
-
/**
|
|
231
|
-
* stores/updates layout information for the given workspace
|
|
232
|
-
*/
|
|
233
|
-
storeLayout(workspaceId: string, layoutData: string): Promise<void>;
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* retrieves layout information for the given workspace
|
|
237
|
-
*/
|
|
238
|
-
getLayout(workspaceId: string): Promise<string | undefined>;
|
|
239
|
-
|
|
240
224
|
guessGitTokenScopes(params: GuessGitTokenScopesParams): Promise<GuessedGitTokenScopes>;
|
|
241
225
|
|
|
242
226
|
/**
|
|
@@ -288,14 +272,16 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
288
272
|
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
289
273
|
findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
|
|
290
274
|
createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
|
|
291
|
-
subscribeToStripe(attributionId: string, setupIntentId: string): Promise<
|
|
275
|
+
subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
|
|
292
276
|
getStripePortalUrl(attributionId: string): Promise<string>;
|
|
293
|
-
|
|
277
|
+
getCostCenter(attributionId: string): Promise<CostCenterJSON | undefined>;
|
|
294
278
|
setUsageLimit(attributionId: string, usageLimit: number): Promise<void>;
|
|
279
|
+
getUsageBalance(attributionId: string): Promise<number>;
|
|
295
280
|
|
|
296
281
|
listUsage(req: ListUsageRequest): Promise<ListUsageResponse>;
|
|
297
282
|
|
|
298
283
|
setUsageAttribution(usageAttribution: string): Promise<void>;
|
|
284
|
+
listAvailableUsageAttributionIds(): Promise<string[]>;
|
|
299
285
|
|
|
300
286
|
getBillingModeForUser(): Promise<BillingMode>;
|
|
301
287
|
getBillingModeForTeam(teamId: string): Promise<BillingMode>;
|
|
@@ -430,7 +416,10 @@ export namespace GitpodServer {
|
|
|
430
416
|
}
|
|
431
417
|
export interface CreateWorkspaceOptions {
|
|
432
418
|
contextUrl: string;
|
|
433
|
-
|
|
419
|
+
// whether running workspaces on the same context should be ignored. If false (default) users will be asked.
|
|
420
|
+
ignoreRunningWorkspaceOnSameCommit?: boolean;
|
|
421
|
+
ignoreRunningPrebuild?: boolean;
|
|
422
|
+
allowUsingPreviousPrebuilds?: boolean;
|
|
434
423
|
forceDefaultConfig?: boolean;
|
|
435
424
|
}
|
|
436
425
|
export interface StartWorkspaceOptions {
|
|
@@ -438,7 +427,6 @@ export namespace GitpodServer {
|
|
|
438
427
|
}
|
|
439
428
|
export interface TakeSnapshotOptions {
|
|
440
429
|
workspaceId: string;
|
|
441
|
-
layoutData?: string;
|
|
442
430
|
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
443
431
|
dontWait?: boolean;
|
|
444
432
|
}
|
package/src/ide-protocol.ts
CHANGED
|
@@ -87,7 +87,7 @@ export interface IDEOption {
|
|
|
87
87
|
label?: string;
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* Notes to the IDE option that are
|
|
90
|
+
* Notes to the IDE option that are rendered in the preferences when a user
|
|
91
91
|
* chooses this IDE.
|
|
92
92
|
*/
|
|
93
93
|
notes?: string[];
|
|
@@ -126,4 +126,14 @@ export interface IDEOption {
|
|
|
126
126
|
* The latest plugin image ref for the latest IDE image, this image ref always resolve to digest.
|
|
127
127
|
*/
|
|
128
128
|
pluginLatestImage?: string;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* ImageVersion the semantic version of the IDE image.
|
|
132
|
+
*/
|
|
133
|
+
imageVersion?: string;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* LatestImageVersion the semantic version of the latest IDE image.
|
|
137
|
+
*/
|
|
138
|
+
latestImageVersion?: string;
|
|
129
139
|
}
|
package/src/index.ts
CHANGED
|
@@ -13,7 +13,6 @@ 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";
|
|
@@ -14,6 +14,7 @@ export class PrometheusClientCallMetrics implements IClientCallMetrics {
|
|
|
14
14
|
readonly sentCounter: prometheusClient.Counter<string>;
|
|
15
15
|
readonly receivedCounter: prometheusClient.Counter<string>;
|
|
16
16
|
readonly handledCounter: prometheusClient.Counter<string>;
|
|
17
|
+
readonly handledSecondsHistogram: prometheusClient.Histogram<string>;
|
|
17
18
|
|
|
18
19
|
constructor() {
|
|
19
20
|
this.startedCounter = new prometheusClient.Counter({
|
|
@@ -40,6 +41,12 @@ export class PrometheusClientCallMetrics implements IClientCallMetrics {
|
|
|
40
41
|
labelNames: ["grpc_service", "grpc_method", "grpc_type", "grpc_code"],
|
|
41
42
|
registers: [prometheusClient.register],
|
|
42
43
|
});
|
|
44
|
+
this.handledSecondsHistogram = new prometheusClient.Histogram({
|
|
45
|
+
name: "grpc_client_handling_seconds",
|
|
46
|
+
help: "Histogram of response latency (seconds) of the gRPC until it is finished by the application.",
|
|
47
|
+
labelNames: ["grpc_service", "grpc_method", "grpc_type", "grpc_code"],
|
|
48
|
+
registers: [prometheusClient.register],
|
|
49
|
+
});
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
started(labels: IGrpcCallMetricsLabels): void {
|
|
@@ -74,4 +81,14 @@ export class PrometheusClientCallMetrics implements IClientCallMetrics {
|
|
|
74
81
|
grpc_code: labels.code,
|
|
75
82
|
});
|
|
76
83
|
}
|
|
84
|
+
|
|
85
|
+
startHandleTimer(
|
|
86
|
+
labels: IGrpcCallMetricsLabelsWithCode,
|
|
87
|
+
): (labels?: Partial<Record<string, string | number>> | undefined) => number {
|
|
88
|
+
return this.handledSecondsHistogram.startTimer({
|
|
89
|
+
grpc_service: labels.service,
|
|
90
|
+
grpc_method: labels.method,
|
|
91
|
+
grpc_type: labels.type,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
77
94
|
}
|
package/src/messaging/error.ts
CHANGED
|
@@ -35,12 +35,18 @@ export namespace ErrorCodes {
|
|
|
35
35
|
// 430 Repository not whitelisted (custom status code)
|
|
36
36
|
export const REPOSITORY_NOT_WHITELISTED = 430;
|
|
37
37
|
|
|
38
|
+
// 440 Prebuilds now always require a project (custom status code)
|
|
39
|
+
export const PROJECT_REQUIRED = 440;
|
|
40
|
+
|
|
38
41
|
// 450 Payment error
|
|
39
42
|
export const PAYMENT_ERROR = 450;
|
|
40
43
|
|
|
41
44
|
// 451 Out of credits
|
|
42
45
|
export const PAYMENT_SPENDING_LIMIT_REACHED = 451;
|
|
43
46
|
|
|
47
|
+
// 451 Error creating a subscription
|
|
48
|
+
export const SUBSCRIPTION_ERROR = 452;
|
|
49
|
+
|
|
44
50
|
// 455 Invalid cost center (custom status code)
|
|
45
51
|
export const INVALID_COST_CENTER = 455;
|
|
46
52
|
|
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,
|
package/src/protocol.ts
CHANGED
|
@@ -8,7 +8,6 @@ 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";
|
|
12
11
|
|
|
13
12
|
export interface UserInfo {
|
|
14
13
|
name?: string;
|
|
@@ -286,23 +285,21 @@ export interface UserFeatureSettings {
|
|
|
286
285
|
permanentWSFeatureFlags?: NamedWorkspaceFeatureFlag[];
|
|
287
286
|
}
|
|
288
287
|
|
|
288
|
+
export type BillingTier = "paid" | "free";
|
|
289
|
+
|
|
289
290
|
/**
|
|
290
291
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
291
292
|
* If they don't we'll break things during workspace startup.
|
|
292
293
|
*/
|
|
293
294
|
export const WorkspaceFeatureFlags = {
|
|
294
295
|
full_workspace_backup: undefined,
|
|
295
|
-
persistent_volume_claim: undefined,
|
|
296
|
-
protected_secrets: undefined,
|
|
297
296
|
workspace_class_limiting: undefined,
|
|
298
297
|
workspace_connection_limiting: undefined,
|
|
298
|
+
workspace_psi: undefined,
|
|
299
299
|
};
|
|
300
300
|
export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
|
|
301
301
|
export namespace NamedWorkspaceFeatureFlag {
|
|
302
|
-
export const WORKSPACE_PERSISTED_FEATTURE_FLAGS: NamedWorkspaceFeatureFlag[] = [
|
|
303
|
-
"full_workspace_backup",
|
|
304
|
-
"persistent_volume_claim",
|
|
305
|
-
];
|
|
302
|
+
export const WORKSPACE_PERSISTED_FEATTURE_FLAGS: NamedWorkspaceFeatureFlag[] = ["full_workspace_backup"];
|
|
306
303
|
export function isWorkspacePersisted(ff: NamedWorkspaceFeatureFlag): boolean {
|
|
307
304
|
return WORKSPACE_PERSISTED_FEATTURE_FLAGS.includes(ff);
|
|
308
305
|
}
|
|
@@ -469,7 +466,7 @@ export interface UserSSHPublicKey extends SSHPublicKeyValue {
|
|
|
469
466
|
lastUsedTime?: string;
|
|
470
467
|
}
|
|
471
468
|
|
|
472
|
-
export type UserSSHPublicKeyValue = Omit<UserSSHPublicKey, "
|
|
469
|
+
export type UserSSHPublicKeyValue = Omit<UserSSHPublicKey, "userId">;
|
|
473
470
|
|
|
474
471
|
export namespace SSHPublicKeyValue {
|
|
475
472
|
export function validate(value: SSHPublicKeyValue): string | undefined {
|
|
@@ -637,6 +634,7 @@ export interface PendingGithubEvent {
|
|
|
637
634
|
creationDate: Date;
|
|
638
635
|
type: string;
|
|
639
636
|
event: string;
|
|
637
|
+
deleted: boolean;
|
|
640
638
|
}
|
|
641
639
|
|
|
642
640
|
export interface Snapshot {
|
|
@@ -645,26 +643,12 @@ export interface Snapshot {
|
|
|
645
643
|
availableTime?: string;
|
|
646
644
|
originalWorkspaceId: string;
|
|
647
645
|
bucketId: string;
|
|
648
|
-
layoutData?: string;
|
|
649
646
|
state: SnapshotState;
|
|
650
647
|
message?: string;
|
|
651
648
|
}
|
|
652
649
|
|
|
653
|
-
export interface VolumeSnapshot {
|
|
654
|
-
id: string;
|
|
655
|
-
workspaceId: string;
|
|
656
|
-
creationTime: string;
|
|
657
|
-
volumeHandle: string;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
650
|
export type SnapshotState = "pending" | "available" | "error";
|
|
661
651
|
|
|
662
|
-
export interface LayoutData {
|
|
663
|
-
workspaceId: string;
|
|
664
|
-
lastUpdatedTime: string;
|
|
665
|
-
layoutData: string;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
652
|
export interface Workspace {
|
|
669
653
|
id: string;
|
|
670
654
|
creationTime: string;
|
|
@@ -726,7 +710,7 @@ export interface Workspace {
|
|
|
726
710
|
|
|
727
711
|
export type WorkspaceSoftDeletion = "user" | "gc";
|
|
728
712
|
|
|
729
|
-
export type WorkspaceType = "regular" | "prebuild"
|
|
713
|
+
export type WorkspaceType = "regular" | "prebuild";
|
|
730
714
|
|
|
731
715
|
export namespace Workspace {
|
|
732
716
|
export function getFullRepositoryName(ws: Workspace): string | undefined {
|
|
@@ -799,6 +783,10 @@ export interface JetBrainsConfig {
|
|
|
799
783
|
goland?: JetBrainsProductConfig;
|
|
800
784
|
pycharm?: JetBrainsProductConfig;
|
|
801
785
|
phpstorm?: JetBrainsProductConfig;
|
|
786
|
+
rubymine?: JetBrainsProductConfig;
|
|
787
|
+
webstorm?: JetBrainsProductConfig;
|
|
788
|
+
rider?: JetBrainsProductConfig;
|
|
789
|
+
clion?: JetBrainsProductConfig;
|
|
802
790
|
}
|
|
803
791
|
export interface JetBrainsProductConfig {
|
|
804
792
|
prebuilds?: JetBrainsPrebuilds;
|
|
@@ -815,8 +803,8 @@ export interface RepositoryCloneInformation {
|
|
|
815
803
|
|
|
816
804
|
export interface CoreDumpConfig {
|
|
817
805
|
enabled?: boolean;
|
|
818
|
-
|
|
819
|
-
|
|
806
|
+
softLimit?: number;
|
|
807
|
+
hardLimit?: number;
|
|
820
808
|
}
|
|
821
809
|
|
|
822
810
|
export interface WorkspaceConfig {
|
|
@@ -1113,14 +1101,17 @@ export namespace SnapshotContext {
|
|
|
1113
1101
|
}
|
|
1114
1102
|
}
|
|
1115
1103
|
|
|
1116
|
-
export interface
|
|
1117
|
-
actual: WorkspaceContext;
|
|
1104
|
+
export interface WithCommitHistory {
|
|
1118
1105
|
commitHistory?: string[];
|
|
1119
1106
|
additionalRepositoryCommitHistories?: {
|
|
1120
1107
|
cloneUrl: string;
|
|
1121
1108
|
commitHistory: string[];
|
|
1122
1109
|
}[];
|
|
1123
|
-
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
export interface StartPrebuildContext extends WorkspaceContext, WithCommitHistory {
|
|
1113
|
+
actual: WorkspaceContext;
|
|
1114
|
+
project: Project;
|
|
1124
1115
|
branch?: string;
|
|
1125
1116
|
}
|
|
1126
1117
|
|
|
@@ -1163,17 +1154,6 @@ export namespace WithEnvvarsContext {
|
|
|
1163
1154
|
}
|
|
1164
1155
|
}
|
|
1165
1156
|
|
|
1166
|
-
export interface WorkspaceProbeContext extends WorkspaceContext {
|
|
1167
|
-
responseURL: string;
|
|
1168
|
-
responseToken: string;
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
export namespace WorkspaceProbeContext {
|
|
1172
|
-
export function is(context: any): context is WorkspaceProbeContext {
|
|
1173
|
-
return context && "responseURL" in context && "responseToken" in context;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
1157
|
export type RefType = "branch" | "tag" | "revision";
|
|
1178
1158
|
export namespace RefType {
|
|
1179
1159
|
export const getRefType = (commit: Commit): RefType => {
|
|
@@ -1213,6 +1193,16 @@ export namespace AdditionalContentContext {
|
|
|
1213
1193
|
}
|
|
1214
1194
|
}
|
|
1215
1195
|
|
|
1196
|
+
export interface OpenPrebuildContext extends WorkspaceContext {
|
|
1197
|
+
openPrebuildID: string;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
export namespace OpenPrebuildContext {
|
|
1201
|
+
export function is(ctx: any): ctx is OpenPrebuildContext {
|
|
1202
|
+
return "openPrebuildID" in ctx;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1216
1206
|
export interface CommitContext extends WorkspaceContext, GitCheckoutInfo {
|
|
1217
1207
|
/** @deprecated Moved to .repository.cloneUrl, left here for backwards-compatibility for old workspace contextes in the DB */
|
|
1218
1208
|
cloneUrl?: string;
|
|
@@ -1376,17 +1366,6 @@ export interface WorkspaceCreationResult {
|
|
|
1376
1366
|
}
|
|
1377
1367
|
export type RunningWorkspacePrebuildStarting = "queued" | "starting" | "running";
|
|
1378
1368
|
|
|
1379
|
-
export enum CreateWorkspaceMode {
|
|
1380
|
-
// Default returns a running prebuild if there is any, otherwise creates a new workspace (using a prebuild if one is available)
|
|
1381
|
-
Default = "default",
|
|
1382
|
-
// ForceNew creates a new workspace irrespective of any running prebuilds. This mode is guaranteed to actually create a workspace - but may degrade user experience as currently runnig prebuilds are ignored.
|
|
1383
|
-
ForceNew = "force-new",
|
|
1384
|
-
// UsePrebuild polls the database waiting for a currently running prebuild to become available. This mode exists to handle the db-sync delay.
|
|
1385
|
-
UsePrebuild = "use-prebuild",
|
|
1386
|
-
// SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
|
|
1387
|
-
SelectIfRunning = "select-if-running",
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
1369
|
export namespace WorkspaceCreationResult {
|
|
1391
1370
|
export function is(data: any): data is WorkspaceCreationResult {
|
|
1392
1371
|
return (
|
|
@@ -1520,12 +1499,7 @@ export interface Terms {
|
|
|
1520
1499
|
readonly formElements?: object;
|
|
1521
1500
|
}
|
|
1522
1501
|
|
|
1523
|
-
export
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
/**
|
|
1527
|
-
* Unit: credits
|
|
1528
|
-
*/
|
|
1529
|
-
spendingLimit: number;
|
|
1530
|
-
billingStrategy: BillingStrategy;
|
|
1502
|
+
export interface StripeConfig {
|
|
1503
|
+
individualUsagePriceIds: { [currency: string]: string };
|
|
1504
|
+
teamUsagePriceIds: { [currency: string]: string };
|
|
1531
1505
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { PrebuiltWorkspaceState } from "./protocol";
|
|
7
|
+
import { PrebuiltWorkspaceState, WorkspaceClasses } from "./protocol";
|
|
8
8
|
import { v4 as uuidv4 } from "uuid";
|
|
9
9
|
import { DeepPartial } from "./util/deep-partial";
|
|
10
10
|
import { WebhookEvent } from "./webhook-event";
|
|
@@ -15,8 +15,13 @@ export interface ProjectConfig {
|
|
|
15
15
|
|
|
16
16
|
export interface ProjectSettings {
|
|
17
17
|
useIncrementalPrebuilds?: boolean;
|
|
18
|
-
usePersistentVolumeClaim?: boolean;
|
|
19
18
|
keepOutdatedPrebuildsRunning?: boolean;
|
|
19
|
+
// whether new workspaces can start on older prebuilds and incrementally update
|
|
20
|
+
allowUsingPreviousPrebuilds?: boolean;
|
|
21
|
+
// how many commits in the commit history a prebuild is good (undefined and 0 means every commit is prebuilt)
|
|
22
|
+
prebuildEveryNthCommit?: number;
|
|
23
|
+
// preferred workspace classes
|
|
24
|
+
workspaceClasses?: WorkspaceClasses;
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
export interface Project {
|
|
@@ -45,6 +50,7 @@ export namespace Project {
|
|
|
45
50
|
|
|
46
51
|
export interface Overview {
|
|
47
52
|
branches: BranchDetails[];
|
|
53
|
+
isConsideredInactive?: boolean;
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
export namespace Overview {
|
|
@@ -119,7 +125,6 @@ export interface StartPrebuildResult {
|
|
|
119
125
|
wsid: string;
|
|
120
126
|
done: boolean;
|
|
121
127
|
}
|
|
122
|
-
|
|
123
128
|
export interface Team {
|
|
124
129
|
id: string;
|
|
125
130
|
name: string;
|
package/src/usage.ts
CHANGED
|
@@ -69,3 +69,17 @@ export interface InvoiceUsageData {
|
|
|
69
69
|
startDate: string;
|
|
70
70
|
endDate: string;
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
export interface CostCenterJSON {
|
|
74
|
+
attributionId: string;
|
|
75
|
+
spendingLimit: number;
|
|
76
|
+
billingStrategy: CostCenter_BillingStrategy;
|
|
77
|
+
nextBillingTime?: string;
|
|
78
|
+
billingCycleStart?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export enum CostCenter_BillingStrategy {
|
|
82
|
+
BILLING_STRATEGY_STRIPE = "BILLING_STRATEGY_STRIPE",
|
|
83
|
+
BILLING_STRATEGY_OTHER = "BILLING_STRATEGY_OTHER",
|
|
84
|
+
UNRECOGNIZED = "UNRECOGNIZED",
|
|
85
|
+
}
|
package/src/util/grpc.ts
CHANGED
|
@@ -36,6 +36,9 @@ export interface IClientCallMetrics {
|
|
|
36
36
|
sent(labels: IGrpcCallMetricsLabels): void;
|
|
37
37
|
received(labels: IGrpcCallMetricsLabels): void;
|
|
38
38
|
handled(labels: IGrpcCallMetricsLabelsWithCode): void;
|
|
39
|
+
startHandleTimer(
|
|
40
|
+
labels: IGrpcCallMetricsLabels,
|
|
41
|
+
): (labels?: Partial<Record<string, string | number>> | undefined) => number;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
export function getGrpcMethodType(requestStream: boolean, responseStream: boolean): GrpcMethodType {
|
package/src/util/nice-grpc.ts
CHANGED
|
@@ -49,6 +49,8 @@ export function prometheusClientMiddleware(metrics: IClientCallMetrics): ClientM
|
|
|
49
49
|
|
|
50
50
|
metrics.started(labels);
|
|
51
51
|
|
|
52
|
+
const stopTimer = metrics.startHandleTimer(labels);
|
|
53
|
+
|
|
52
54
|
let settled = false;
|
|
53
55
|
let status: Status = Status.OK;
|
|
54
56
|
|
|
@@ -87,6 +89,7 @@ export function prometheusClientMiddleware(metrics: IClientCallMetrics): ClientM
|
|
|
87
89
|
if (!settled) {
|
|
88
90
|
status = Status.CANCELLED;
|
|
89
91
|
}
|
|
92
|
+
stopTimer({ grpc_code: Status[status] });
|
|
90
93
|
metrics.handled({ ...labels, code: Status[status] });
|
|
91
94
|
}
|
|
92
95
|
};
|
package/src/workspace-class.ts
CHANGED
package/src/workspace-cluster.ts
CHANGED
|
@@ -15,6 +15,10 @@ export interface WorkspaceCluster {
|
|
|
15
15
|
// Must be identical to the installationShortname of the cluster it represents!
|
|
16
16
|
name: string;
|
|
17
17
|
|
|
18
|
+
// The name of the application cluster to which this cluster should be registered.
|
|
19
|
+
// The name can be at most 60 characters.
|
|
20
|
+
applicationCluster: string;
|
|
21
|
+
|
|
18
22
|
// URL of the cluster's ws-manager API
|
|
19
23
|
url: string;
|
|
20
24
|
|
|
@@ -86,20 +90,21 @@ export interface WorkspaceClusterDB {
|
|
|
86
90
|
* Deletes the cluster identified by this name, if any.
|
|
87
91
|
* @param name
|
|
88
92
|
*/
|
|
89
|
-
deleteByName(name: string): Promise<void>;
|
|
93
|
+
deleteByName(name: string, applicationCluster: string): Promise<void>;
|
|
90
94
|
|
|
91
95
|
/**
|
|
92
96
|
* Finds a WorkspaceCluster with the given name. If there is none, `undefined` is returned.
|
|
93
97
|
* @param name
|
|
94
98
|
*/
|
|
95
|
-
findByName(name: string): Promise<WorkspaceCluster | undefined>;
|
|
99
|
+
findByName(name: string, applicationCluster: string): Promise<WorkspaceCluster | undefined>;
|
|
96
100
|
|
|
97
101
|
/**
|
|
98
102
|
* Lists all WorkspaceClusterWoTls for which the given predicate is true (does not return TLS for size/speed concerns)
|
|
99
103
|
* @param predicate
|
|
100
104
|
*/
|
|
101
|
-
findFiltered(predicate:
|
|
102
|
-
}
|
|
103
|
-
export interface WorkspaceClusterFilter extends Pick<WorkspaceCluster, "state" | "govern" | "url"> {
|
|
104
|
-
minScore: number;
|
|
105
|
+
findFiltered(predicate: WorkspaceClusterFilter): Promise<WorkspaceClusterWoTLS[]>;
|
|
105
106
|
}
|
|
107
|
+
|
|
108
|
+
export type WorkspaceClusterFilter = Pick<WorkspaceCluster, "applicationCluster"> &
|
|
109
|
+
DeepPartial<Pick<WorkspaceCluster, "name" | "state" | "govern" | "url">> &
|
|
110
|
+
Partial<{ minScore: number }>;
|
|
@@ -243,10 +243,16 @@ export interface WorkspaceInstanceConfiguration {
|
|
|
243
243
|
// ideImage is the ref of the IDE image this instance uses.
|
|
244
244
|
ideImage: string;
|
|
245
245
|
|
|
246
|
+
// ideImageLayers are images needed for the ide to run,
|
|
247
|
+
// including ide-desktop, desktop-plugin and so on
|
|
248
|
+
ideImageLayers?: string[];
|
|
249
|
+
|
|
246
250
|
// desktopIdeImage is the ref of the desktop IDE image this instance uses.
|
|
251
|
+
// @deprected: replaced with the ideImageLayers field
|
|
247
252
|
desktopIdeImage?: string;
|
|
248
253
|
|
|
249
254
|
// desktopIdePluginImage is the ref of the desktop IDE plugin image this instance uses.
|
|
255
|
+
// @deprected: replaced with the desktopIdePluginImage field
|
|
250
256
|
desktopIdePluginImage?: string;
|
|
251
257
|
|
|
252
258
|
// supervisorImage is the ref of the supervisor image this instance uses.
|
package/src/wsready.ts
CHANGED
|
@@ -4,15 +4,21 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
// generated using github.com/32leaves/bel on 2022-
|
|
7
|
+
// generated using github.com/32leaves/bel on 2022-11-25 13:39:08.995865257 +0000 UTC m=+0.015035221
|
|
8
8
|
// DO NOT MODIFY
|
|
9
9
|
|
|
10
|
-
export interface WorkspaceReadyMessage {
|
|
11
|
-
source: WorkspaceInitSource;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
10
|
export enum WorkspaceInitSource {
|
|
15
11
|
WorkspaceInitFromBackup = "from-backup",
|
|
16
12
|
WorkspaceInitFromPrebuild = "from-prebuild",
|
|
17
13
|
WorkspaceInitFromOther = "from-other",
|
|
18
14
|
}
|
|
15
|
+
export interface WorkspaceReadyMessage {
|
|
16
|
+
source: WorkspaceInitSource;
|
|
17
|
+
metrics: InitializerMetric[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface InitializerMetric {
|
|
21
|
+
type: string;
|
|
22
|
+
duration: number;
|
|
23
|
+
size: number;
|
|
24
|
+
}
|
package/lib/email-protocol.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
export declare type EMailState = "scheduledInternal" | "scheduledSendgrid";
|
|
7
|
-
export interface EMailStatus {
|
|
8
|
-
/** The time the email entry was inserted into the DB */
|
|
9
|
-
scheduledInternalTime: string;
|
|
10
|
-
/** The time the email state transitioned to "scheduledSendgrid" */
|
|
11
|
-
scheduledSendgridTime?: string;
|
|
12
|
-
/** In case of any errors during sending with Sendgrid it gets noted here */
|
|
13
|
-
error?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare namespace EMailStatus {
|
|
16
|
-
function getState(status: EMailStatus): EMailState;
|
|
17
|
-
}
|
|
18
|
-
export interface EmailAddress {
|
|
19
|
-
name?: string;
|
|
20
|
-
email: string;
|
|
21
|
-
}
|
|
22
|
-
export interface EMailParameters {
|
|
23
|
-
/** undefined means default from template */
|
|
24
|
-
subject?: string;
|
|
25
|
-
/** The sender address */
|
|
26
|
-
senderAddress: string | EmailAddress;
|
|
27
|
-
/** The replyTo address */
|
|
28
|
-
replyToAddress?: string | EmailAddress;
|
|
29
|
-
/** The SendGrid template id */
|
|
30
|
-
templateId: string;
|
|
31
|
-
/** The parameters for the SendGrid template */
|
|
32
|
-
templateParams: {};
|
|
33
|
-
}
|
|
34
|
-
export declare type EMail = {
|
|
35
|
-
/** The unique id of this email (uuid/v4 for now) */
|
|
36
|
-
uid: string;
|
|
37
|
-
/** The id of the user this email was sent to */
|
|
38
|
-
userId: string;
|
|
39
|
-
/** The address this email was sent to */
|
|
40
|
-
recipientAddress: string;
|
|
41
|
-
/** Which campaign scheduled this email */
|
|
42
|
-
campaignId: string;
|
|
43
|
-
/** The parameters this email was sent with (template id, template params, etc) */
|
|
44
|
-
params: EMailParameters;
|
|
45
|
-
} & EMailStatus;
|
|
46
|
-
export declare namespace EMail {
|
|
47
|
-
const create: (ts: Omit<EMail, "uid">) => EMail;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=email-protocol.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"email-protocol.d.ts","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,oBAAY,UAAU,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAEnE,MAAM,WAAW,WAAW;IACxB,wDAAwD;IACxD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mEAAmE;IACnE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,yBAAiB,WAAW,CAAC;IACzB,SAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAKxD;CACJ;AAED,MAAM,WAAW,YAAY;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC5B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,aAAa,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,0BAA0B;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACvC,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,cAAc,EAAE,EAAE,CAAC;CACtB;AAED,oBAAY,KAAK,GAAG;IAChB,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,MAAM,EAAE,eAAe,CAAC;CAC3B,GAAG,WAAW,CAAC;AAEhB,yBAAiB,KAAK,CAAC;IACZ,MAAM,MAAM,OAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,KAAG,KAI/C,CAAC;CACL"}
|