@gitpod/gitpod-protocol 0.1.5-pd-pd-wskit-2.5 → 0.1.5-pd-proto-ide.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/lib/billing-mode.js +2 -2
- package/lib/billing-mode.js.map +1 -1
- package/lib/frontend-dashboard-service.d.ts +90 -0
- package/lib/frontend-dashboard-service.d.ts.map +1 -0
- package/lib/frontend-dashboard-service.js +49 -0
- package/lib/frontend-dashboard-service.js.map +1 -0
- package/lib/gitpod-service.d.ts +29 -9
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +25 -11
- package/lib/gitpod-service.js.map +1 -1
- package/lib/permission.d.ts +4 -1
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +3 -0
- package/lib/permission.js.map +1 -1
- package/lib/protocol.d.ts +16 -0
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +1 -1
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +4 -0
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +1 -1
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.d.ts +5 -2
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +13 -8
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/tracing.d.ts +1 -0
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +10 -0
- package/lib/util/tracing.js.map +1 -1
- package/lib/workspace-cluster.d.ts +1 -0
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js.map +1 -1
- package/package.json +1 -1
- package/pkg-yarn.lock +1 -1
- package/provenance-bundle.jsonl +1 -1
- package/src/billing-mode.ts +2 -2
- package/src/frontend-dashboard-service.ts +125 -0
- package/src/gitpod-service.ts +50 -14
- package/src/permission.ts +4 -0
- package/src/protocol.ts +19 -0
- package/src/teams-projects-protocol.ts +4 -1
- package/src/typings/globals.ts +2 -1
- package/src/util/gitpod-host-url.ts +17 -9
- package/src/util/tracing.ts +9 -0
- package/src/workspace-cluster.ts +4 -0
package/src/gitpod-service.ts
CHANGED
|
@@ -165,6 +165,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
165
165
|
|
|
166
166
|
// Teams
|
|
167
167
|
getTeam(teamId: string): Promise<Team>;
|
|
168
|
+
updateTeam(teamId: string, team: Pick<Team, "name">): Promise<Team>;
|
|
168
169
|
getTeams(): Promise<Team[]>;
|
|
169
170
|
getTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
|
|
170
171
|
createTeam(name: string): Promise<Team>;
|
|
@@ -174,6 +175,10 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
174
175
|
getGenericInvite(teamId: string): Promise<TeamMembershipInvite>;
|
|
175
176
|
resetGenericInvite(inviteId: string): Promise<TeamMembershipInvite>;
|
|
176
177
|
deleteTeam(teamId: string): Promise<void>;
|
|
178
|
+
createOrgAuthProvider(params: GitpodServer.CreateOrgAuthProviderParams): Promise<AuthProviderEntry>;
|
|
179
|
+
updateOrgAuthProvider(params: GitpodServer.UpdateOrgAuthProviderParams): Promise<AuthProviderEntry>;
|
|
180
|
+
getOrgAuthProviders(params: GitpodServer.GetOrgAuthProviderParams): Promise<AuthProviderEntry[]>;
|
|
181
|
+
deleteOrgAuthProvider(params: GitpodServer.DeleteOrgAuthProviderParams): Promise<void>;
|
|
177
182
|
|
|
178
183
|
// Projects
|
|
179
184
|
getProviderRepositoriesForUser(params: GetProviderRepositoriesParams): Promise<ProviderRepository[]>;
|
|
@@ -272,6 +277,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
272
277
|
getStripePublishableKey(): Promise<string>;
|
|
273
278
|
getStripeSetupIntentClientSecret(): Promise<string>;
|
|
274
279
|
findStripeSubscriptionId(attributionId: string): Promise<string | undefined>;
|
|
280
|
+
getPriceInformation(attributionId: string): Promise<string | undefined>;
|
|
275
281
|
createStripeCustomerIfNeeded(attributionId: string, currency: string): Promise<void>;
|
|
276
282
|
subscribeToStripe(attributionId: string, setupIntentId: string, usageLimit: number): Promise<number | undefined>;
|
|
277
283
|
getStripePortalUrl(attributionId: string): Promise<string>;
|
|
@@ -352,16 +358,33 @@ export interface ClientHeaderFields {
|
|
|
352
358
|
clientRegion?: string;
|
|
353
359
|
}
|
|
354
360
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
export
|
|
358
|
-
export
|
|
359
|
-
export
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
361
|
+
const WORKSPACE_MAXIMUM_TIMEOUT_HOURS = 24;
|
|
362
|
+
|
|
363
|
+
export type WorkspaceTimeoutDuration = string;
|
|
364
|
+
export namespace WorkspaceTimeoutDuration {
|
|
365
|
+
export function validate(duration: string): WorkspaceTimeoutDuration {
|
|
366
|
+
duration = duration.toLowerCase();
|
|
367
|
+
const unit = duration.slice(-1);
|
|
368
|
+
if (!["m", "h"].includes(unit)) {
|
|
369
|
+
throw new Error(`Invalid timeout unit: ${unit}`);
|
|
370
|
+
}
|
|
371
|
+
const value = parseInt(duration.slice(0, -1), 10);
|
|
372
|
+
if (isNaN(value) || value <= 0) {
|
|
373
|
+
throw new Error(`Invalid timeout value: ${duration}`);
|
|
374
|
+
}
|
|
375
|
+
if (
|
|
376
|
+
(unit === "h" && value > WORKSPACE_MAXIMUM_TIMEOUT_HOURS) ||
|
|
377
|
+
(unit === "m" && value > WORKSPACE_MAXIMUM_TIMEOUT_HOURS * 60)
|
|
378
|
+
) {
|
|
379
|
+
throw new Error("Workspace inactivity timeout cannot exceed 24h");
|
|
380
|
+
}
|
|
381
|
+
return duration;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_SHORT: WorkspaceTimeoutDuration = "30m";
|
|
386
|
+
export const WORKSPACE_TIMEOUT_DEFAULT_LONG: WorkspaceTimeoutDuration = "60m";
|
|
387
|
+
export const WORKSPACE_TIMEOUT_EXTENDED: WorkspaceTimeoutDuration = "180m";
|
|
365
388
|
|
|
366
389
|
export const createServiceMock = function <C extends GitpodClient, S extends GitpodServer>(
|
|
367
390
|
methods: Partial<JsonRpcProxy<S>>,
|
|
@@ -386,17 +409,15 @@ export const createServerMock = function <C extends GitpodClient, S extends Gitp
|
|
|
386
409
|
});
|
|
387
410
|
};
|
|
388
411
|
|
|
389
|
-
type WorkspaceTimeoutDurationTuple = typeof WorkspaceTimeoutValues;
|
|
390
|
-
export type WorkspaceTimeoutDuration = WorkspaceTimeoutDurationTuple[number];
|
|
391
|
-
|
|
392
412
|
export interface SetWorkspaceTimeoutResult {
|
|
393
413
|
resetTimeoutOnWorkspaces: string[];
|
|
414
|
+
humanReadableDuration: string;
|
|
394
415
|
}
|
|
395
416
|
|
|
396
417
|
export interface GetWorkspaceTimeoutResult {
|
|
397
418
|
duration: WorkspaceTimeoutDuration;
|
|
398
|
-
durationRaw: string;
|
|
399
419
|
canChange: boolean;
|
|
420
|
+
humanReadableDuration: string;
|
|
400
421
|
}
|
|
401
422
|
|
|
402
423
|
export interface StartWorkspaceResult {
|
|
@@ -429,6 +450,7 @@ export namespace GitpodServer {
|
|
|
429
450
|
forceDefaultImage?: boolean;
|
|
430
451
|
workspaceClass?: string;
|
|
431
452
|
ideSettings?: IDESettings;
|
|
453
|
+
region?: string;
|
|
432
454
|
}
|
|
433
455
|
export interface TakeSnapshotOptions {
|
|
434
456
|
workspaceId: string;
|
|
@@ -456,6 +478,20 @@ export namespace GitpodServer {
|
|
|
456
478
|
export interface DeleteOwnAuthProviderParams {
|
|
457
479
|
readonly id: string;
|
|
458
480
|
}
|
|
481
|
+
export interface CreateOrgAuthProviderParams {
|
|
482
|
+
// ownerId is automatically set to the authenticated user
|
|
483
|
+
readonly entry: Omit<AuthProviderEntry.NewOrgEntry, "ownerId">;
|
|
484
|
+
}
|
|
485
|
+
export interface UpdateOrgAuthProviderParams {
|
|
486
|
+
readonly entry: AuthProviderEntry.UpdateOrgEntry;
|
|
487
|
+
}
|
|
488
|
+
export interface GetOrgAuthProviderParams {
|
|
489
|
+
readonly organizationId: string;
|
|
490
|
+
}
|
|
491
|
+
export interface DeleteOrgAuthProviderParams {
|
|
492
|
+
readonly id: string;
|
|
493
|
+
readonly organizationId: string;
|
|
494
|
+
}
|
|
459
495
|
export type AdmissionLevel = "owner" | "everyone";
|
|
460
496
|
export type PinAction = "pin" | "unpin" | "toggle";
|
|
461
497
|
export interface GenerateNewGitpodTokenOptions {
|
package/src/permission.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// see below for explanation
|
|
8
8
|
export const Permissions = {
|
|
9
9
|
monitor: undefined,
|
|
10
|
+
developer: undefined,
|
|
10
11
|
enforcement: undefined,
|
|
11
12
|
"privileged-ws": undefined,
|
|
12
13
|
"registry-access": undefined,
|
|
@@ -53,6 +54,9 @@ export namespace Permission {
|
|
|
53
54
|
/** The permission to monitor the (live) state of a Gitpod installation */
|
|
54
55
|
export const MONITOR: PermissionName = "monitor";
|
|
55
56
|
|
|
57
|
+
/** The permission to develop on this running Gitpod installation */
|
|
58
|
+
export const DEVELOPER: PermissionName = "developer";
|
|
59
|
+
|
|
56
60
|
/** The permission for actions like block user, stop workspace, etc. */
|
|
57
61
|
export const ENFORCEMENT: PermissionName = "enforcement";
|
|
58
62
|
|
package/src/protocol.ts
CHANGED
|
@@ -17,6 +17,9 @@ export interface User {
|
|
|
17
17
|
/** The user id */
|
|
18
18
|
id: string;
|
|
19
19
|
|
|
20
|
+
/** The ID of the Organization this user is owned by. If undefined, the user is owned by the installation */
|
|
21
|
+
organizationId?: string;
|
|
22
|
+
|
|
20
23
|
/** The timestamp when the user entry was created */
|
|
21
24
|
creationDate: string;
|
|
22
25
|
|
|
@@ -212,6 +215,9 @@ export interface AdditionalUserData {
|
|
|
212
215
|
workspaceClasses?: WorkspaceClasses;
|
|
213
216
|
// additional user profile data
|
|
214
217
|
profile?: ProfileDetails;
|
|
218
|
+
// whether the user has been migrated to team attribution.
|
|
219
|
+
// a corresponding feature flag (team_only_attribution) triggers the migration.
|
|
220
|
+
isMigratedToTeamOnlyAttribution?: boolean;
|
|
215
221
|
}
|
|
216
222
|
export namespace AdditionalUserData {
|
|
217
223
|
export function set(user: User, partialData: Partial<AdditionalUserData>): User {
|
|
@@ -652,6 +658,10 @@ export type SnapshotState = "pending" | "available" | "error";
|
|
|
652
658
|
export interface Workspace {
|
|
653
659
|
id: string;
|
|
654
660
|
creationTime: string;
|
|
661
|
+
/**
|
|
662
|
+
* undefined means it is owned by the user (legacy mode, soon to be removed)
|
|
663
|
+
*/
|
|
664
|
+
organizationId?: string;
|
|
655
665
|
contextURL: string;
|
|
656
666
|
description: string;
|
|
657
667
|
ownerId: string;
|
|
@@ -1416,6 +1426,7 @@ export interface AuthProviderEntry {
|
|
|
1416
1426
|
readonly type: AuthProviderEntry.Type;
|
|
1417
1427
|
readonly host: string;
|
|
1418
1428
|
readonly ownerId: string;
|
|
1429
|
+
readonly organizationId?: string;
|
|
1419
1430
|
|
|
1420
1431
|
readonly status: AuthProviderEntry.Status;
|
|
1421
1432
|
|
|
@@ -1447,6 +1458,14 @@ export namespace AuthProviderEntry {
|
|
|
1447
1458
|
};
|
|
1448
1459
|
export type UpdateEntry = Pick<AuthProviderEntry, "id" | "ownerId"> &
|
|
1449
1460
|
Pick<OAuth2Config, "clientId" | "clientSecret">;
|
|
1461
|
+
export type NewOrgEntry = NewEntry & {
|
|
1462
|
+
organizationId: string;
|
|
1463
|
+
};
|
|
1464
|
+
export type UpdateOrgEntry = Pick<AuthProviderEntry, "id"> & {
|
|
1465
|
+
clientId: string;
|
|
1466
|
+
clientSecret: string;
|
|
1467
|
+
organizationId: string;
|
|
1468
|
+
};
|
|
1450
1469
|
export function redact(entry: AuthProviderEntry): AuthProviderEntry {
|
|
1451
1470
|
return {
|
|
1452
1471
|
...entry,
|
|
@@ -48,6 +48,10 @@ export namespace Project {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
export function slug(p: Project): string {
|
|
52
|
+
return p.slug || p.name || p.id;
|
|
53
|
+
}
|
|
54
|
+
|
|
51
55
|
export interface Overview {
|
|
52
56
|
branches: BranchDetails[];
|
|
53
57
|
isConsideredInactive?: boolean;
|
|
@@ -128,7 +132,6 @@ export interface StartPrebuildResult {
|
|
|
128
132
|
export interface Team {
|
|
129
133
|
id: string;
|
|
130
134
|
name: string;
|
|
131
|
-
slug: string;
|
|
132
135
|
creationTime: string;
|
|
133
136
|
markedDeleted?: boolean;
|
|
134
137
|
/** This is a flag that triggers the HARD DELETION of this entity */
|
package/src/typings/globals.ts
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
interface Window {
|
|
8
8
|
// gitpod is used by supervisor/frontend and vscode browser https://github.com/gitpod-io/openvscode-server/blob/dadd40deda5959c0efdaa0c7d02ab64b6f8b5ad0/src/vs/gitpod/browser/workbench/workbench.ts#L7
|
|
9
9
|
gitpod: {
|
|
10
|
-
service: import("../gitpod-service").GitpodService;
|
|
11
10
|
ideService?: import("../ide-frontend-service").IDEFrontendService;
|
|
12
11
|
loggedUserID?: string;
|
|
12
|
+
|
|
13
|
+
openDesktopIDE(url: string): void;
|
|
13
14
|
};
|
|
14
15
|
}
|
|
@@ -77,8 +77,15 @@ export class GitpodHostUrl {
|
|
|
77
77
|
return updated.with((url) => ({ pathname: `/api${url.pathname}` }));
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
withContext(
|
|
81
|
-
|
|
80
|
+
withContext(
|
|
81
|
+
contextUrl: string,
|
|
82
|
+
startOptions?: { showOptions?: boolean; editor?: string; workspaceClass?: string },
|
|
83
|
+
) {
|
|
84
|
+
const searchParams = new URLSearchParams();
|
|
85
|
+
if (startOptions?.showOptions) {
|
|
86
|
+
searchParams.append("showOptions", "true");
|
|
87
|
+
}
|
|
88
|
+
return this.with((url) => ({ hash: contextUrl, search: searchParams.toString() }));
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
asWebsocket(): GitpodHostUrl {
|
|
@@ -94,27 +101,23 @@ export class GitpodHostUrl {
|
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
asBilling(): GitpodHostUrl {
|
|
97
|
-
return this.with((url) => ({ pathname: "/billing" }));
|
|
104
|
+
return this.with((url) => ({ pathname: "/user/billing" }));
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
asLogin(): GitpodHostUrl {
|
|
101
108
|
return this.with((url) => ({ pathname: "/login" }));
|
|
102
109
|
}
|
|
103
110
|
|
|
104
|
-
asUpgradeSubscription(): GitpodHostUrl {
|
|
105
|
-
return this.with((url) => ({ pathname: "/plans" }));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
111
|
asAccessControl(): GitpodHostUrl {
|
|
109
112
|
return this.with((url) => ({ pathname: "/integrations" }));
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
asSettings(): GitpodHostUrl {
|
|
113
|
-
return this.with((url) => ({ pathname: "/
|
|
116
|
+
return this.with((url) => ({ pathname: "/user/account" }));
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
asPreferences(): GitpodHostUrl {
|
|
117
|
-
return this.with((url) => ({ pathname: "/preferences" }));
|
|
120
|
+
return this.with((url) => ({ pathname: "/user/preferences" }));
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
asStart(workspaceId = this.workspaceId): GitpodHostUrl {
|
|
@@ -162,6 +165,11 @@ export class GitpodHostUrl {
|
|
|
162
165
|
return pathSegs[2];
|
|
163
166
|
}
|
|
164
167
|
|
|
168
|
+
const cleanHash = this.url.hash.replace(/^#/, "");
|
|
169
|
+
if (this.url.pathname == "/start/" && cleanHash.match(workspaceIDRegex)) {
|
|
170
|
+
return cleanHash;
|
|
171
|
+
}
|
|
172
|
+
|
|
165
173
|
return undefined;
|
|
166
174
|
}
|
|
167
175
|
|
package/src/util/tracing.ts
CHANGED
|
@@ -186,6 +186,15 @@ export namespace TraceContext {
|
|
|
186
186
|
context: owi,
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
+
|
|
190
|
+
export function finishOnce(span: opentracing.Span): () => void {
|
|
191
|
+
let done = false;
|
|
192
|
+
return () => {
|
|
193
|
+
if (done) return;
|
|
194
|
+
span.finish();
|
|
195
|
+
done = true;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
189
198
|
}
|
|
190
199
|
|
|
191
200
|
@injectable()
|
package/src/workspace-cluster.ts
CHANGED
|
@@ -19,6 +19,10 @@ export interface WorkspaceCluster {
|
|
|
19
19
|
// The name can be at most 60 characters.
|
|
20
20
|
applicationCluster: string;
|
|
21
21
|
|
|
22
|
+
// The name of the region this cluster belongs to. E.g. us-west1 or europe-west1
|
|
23
|
+
// The name can be at most 60 characters.
|
|
24
|
+
region: string;
|
|
25
|
+
|
|
22
26
|
// URL of the cluster's ws-manager API
|
|
23
27
|
url: string;
|
|
24
28
|
|