@gitpod/gitpod-protocol 0.1.5-mp-papi-caddy-grpc.18 → 0.1.5-mp-usage-list-workspaces.18
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 +2 -2
- package/lib/accounting-protocol.d.ts +7 -0
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +8 -1
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/gitpod-service.d.ts +8 -1
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +8 -7
- package/lib/gitpod-service.js.map +1 -1
- package/lib/license-protocol.d.ts +7 -0
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/protocol.d.ts +9 -0
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +48 -0
- package/lib/protocol.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +16 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +12 -1
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/workspace-instance.d.ts +6 -1
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.js +1 -1
- package/package.json +1 -1
- package/pkg-yarn.lock +1 -1
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +10 -0
- package/src/gitpod-service.ts +22 -8
- package/src/license-protocol.ts +7 -0
- package/src/protocol.ts +54 -0
- package/src/team-subscription-protocol.ts +24 -0
- package/src/workspace-instance.ts +11 -1
- package/src/wsready.ts +1 -1
package/src/protocol.ts
CHANGED
|
@@ -95,6 +95,47 @@ export namespace User {
|
|
|
95
95
|
}
|
|
96
96
|
return undefined;
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
export function hasPreferredIde(user: User) {
|
|
100
|
+
return (
|
|
101
|
+
typeof user?.additionalData?.ideSettings?.defaultIde !== "undefined" ||
|
|
102
|
+
typeof user?.additionalData?.ideSettings?.useLatestVersion !== "undefined"
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function isOnboardingUser(user: User) {
|
|
107
|
+
return !hasPreferredIde(user);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function migrationIDESettings(user: User) {
|
|
111
|
+
if (
|
|
112
|
+
!user?.additionalData?.ideSettings ||
|
|
113
|
+
Object.keys(user.additionalData.ideSettings).length === 0 ||
|
|
114
|
+
user.additionalData.ideSettings.settingVersion === "2.0"
|
|
115
|
+
) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const newIDESettings: IDESettings = {
|
|
119
|
+
settingVersion: "2.0",
|
|
120
|
+
};
|
|
121
|
+
const ideSettings = user.additionalData.ideSettings;
|
|
122
|
+
if (ideSettings.useDesktopIde) {
|
|
123
|
+
if (ideSettings.defaultDesktopIde === "code-desktop") {
|
|
124
|
+
newIDESettings.defaultIde = "code-desktop";
|
|
125
|
+
} else if (ideSettings.defaultDesktopIde === "code-desktop-insiders") {
|
|
126
|
+
newIDESettings.defaultIde = "code-desktop";
|
|
127
|
+
newIDESettings.useLatestVersion = true;
|
|
128
|
+
} else {
|
|
129
|
+
newIDESettings.defaultIde = ideSettings.defaultDesktopIde;
|
|
130
|
+
newIDESettings.useLatestVersion = ideSettings.useLatestVersion;
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
const useLatest = ideSettings.defaultIde === "code-latest";
|
|
134
|
+
newIDESettings.defaultIde = "code";
|
|
135
|
+
newIDESettings.useLatestVersion = useLatest;
|
|
136
|
+
}
|
|
137
|
+
user.additionalData.ideSettings = newIDESettings;
|
|
138
|
+
}
|
|
98
139
|
}
|
|
99
140
|
|
|
100
141
|
export interface AdditionalUserData {
|
|
@@ -201,12 +242,18 @@ export namespace UserEnvVar {
|
|
|
201
242
|
if (name.trim() === "") {
|
|
202
243
|
return "Name must not be empty.";
|
|
203
244
|
}
|
|
245
|
+
if (name.length > 255) {
|
|
246
|
+
return "Name too long. Maximum name length is 255 characters.";
|
|
247
|
+
}
|
|
204
248
|
if (!/^[a-zA-Z_]+[a-zA-Z0-9_]*$/.test(name)) {
|
|
205
249
|
return "Name must match /^[a-zA-Z_]+[a-zA-Z0-9_]*$/.";
|
|
206
250
|
}
|
|
207
251
|
if (variable.value.trim() === "") {
|
|
208
252
|
return "Value must not be empty.";
|
|
209
253
|
}
|
|
254
|
+
if (variable.value.length > 32767) {
|
|
255
|
+
return "Value too long. Maximum value length is 32767 characters.";
|
|
256
|
+
}
|
|
210
257
|
if (pattern.trim() === "") {
|
|
211
258
|
return "Scope must not be empty.";
|
|
212
259
|
}
|
|
@@ -441,6 +488,12 @@ export interface Snapshot {
|
|
|
441
488
|
message?: string;
|
|
442
489
|
}
|
|
443
490
|
|
|
491
|
+
export interface VolumeSnapshot {
|
|
492
|
+
id: string;
|
|
493
|
+
creationTime: string;
|
|
494
|
+
volumeHandle: string;
|
|
495
|
+
}
|
|
496
|
+
|
|
444
497
|
export type SnapshotState = "pending" | "available" | "error";
|
|
445
498
|
|
|
446
499
|
export interface LayoutData {
|
|
@@ -825,6 +878,7 @@ export namespace ExternalImageConfigFile {
|
|
|
825
878
|
|
|
826
879
|
export interface WorkspaceContext {
|
|
827
880
|
title: string;
|
|
881
|
+
ref?: string;
|
|
828
882
|
/** 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. */
|
|
829
883
|
normalizedContextURL?: string;
|
|
830
884
|
forceCreateNewWorkspace?: boolean;
|
|
@@ -33,6 +33,30 @@ export namespace TeamSubscription {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export interface TeamSubscription2 {
|
|
37
|
+
id: string;
|
|
38
|
+
teamId: string;
|
|
39
|
+
planId: string;
|
|
40
|
+
startDate: string;
|
|
41
|
+
endDate?: string;
|
|
42
|
+
quantity: number;
|
|
43
|
+
/** The Chargebee subscription id */
|
|
44
|
+
paymentReference: string;
|
|
45
|
+
cancellationDate?: string;
|
|
46
|
+
excludeFromMoreResources: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export namespace TeamSubscription2 {
|
|
50
|
+
export const create = (ts2: Omit<TeamSubscription2, "id">): TeamSubscription2 => {
|
|
51
|
+
const withId = ts2 as TeamSubscription2;
|
|
52
|
+
withId.id = uuidv4();
|
|
53
|
+
return withId;
|
|
54
|
+
};
|
|
55
|
+
export const isActive = (ts2: TeamSubscription2, date: string): boolean => {
|
|
56
|
+
return ts2.startDate <= date && (ts2.endDate === undefined || date < ts2.endDate);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
36
60
|
/**
|
|
37
61
|
* A slot represents one unit of a TeamSubscription that gets assigned to one user at a time
|
|
38
62
|
*/
|
|
@@ -56,6 +56,12 @@ export interface WorkspaceInstance {
|
|
|
56
56
|
* Contains information about the image build, if there was any
|
|
57
57
|
*/
|
|
58
58
|
imageBuildInfo?: ImageBuildInfo;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* workspace class, also known as workspace size, determines the type of
|
|
62
|
+
* resources that are provided to the workspace.
|
|
63
|
+
*/
|
|
64
|
+
workspaceClass?: string;
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
// WorkspaceInstanceStatus describes the current state of a workspace instance
|
|
@@ -98,9 +104,13 @@ export type WorkspaceInstancePhase =
|
|
|
98
104
|
| "unknown"
|
|
99
105
|
|
|
100
106
|
// Preparing means that we haven't actually started the workspace instance just yet, but rather
|
|
101
|
-
// are still preparing for launch.
|
|
107
|
+
// are still preparing for launch.
|
|
102
108
|
| "preparing"
|
|
103
109
|
|
|
110
|
+
// Building means that we are building the Docker image for the workspace. A workspace will enter this phase only
|
|
111
|
+
// if an image build is required for that workspace.
|
|
112
|
+
| "building"
|
|
113
|
+
|
|
104
114
|
// Pending means the workspace does not yet consume resources in the cluster, but rather is looking for
|
|
105
115
|
// some space within the cluster. If for example the cluster needs to scale up to accomodate the
|
|
106
116
|
// workspace, the workspace will be in Pending state until that happened.
|
package/src/wsready.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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-05-18 18:19:49.011672619 +0000 UTC m=+0.006607361
|
|
8
8
|
// DO NOT MODIFY
|
|
9
9
|
|
|
10
10
|
export enum WorkspaceInitSource {
|