@gitpod/gitpod-protocol 0.1.5-sje-installer-helm.3 → 0.1.5-sje-installer-namespace-docs.1
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 +4 -0
- package/lib/accounting-protocol.d.ts +0 -1
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +10 -11
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +8 -2
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +2 -13
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +1 -0
- package/lib/analytics.d.ts.map +1 -1
- package/lib/context-url.js +4 -4
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.js +45 -48
- package/lib/context-url.spec.js.map +1 -1
- package/lib/email-protocol.js +4 -4
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.js +4 -4
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.js +19 -20
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +29 -36
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.js +29 -43
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.js +25 -30
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.js +12 -13
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.js +25 -41
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +116 -116
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +20 -8
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +149 -295
- package/lib/gitpod-service.js.map +1 -1
- package/lib/ide-protocol.d.ts +81 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/ide-protocol.js +8 -0
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/messaging/browser/connection.js +91 -156
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.js +35 -55
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.js +17 -18
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/connection-error-handler.js +11 -23
- package/lib/messaging/connection-error-handler.js.map +1 -1
- package/lib/messaging/error.d.ts +1 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +2 -2
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/node/connection.d.ts +0 -10
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +11 -49
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.js +71 -162
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/oss-allowlist.d.ts +14 -0
- package/lib/oss-allowlist.d.ts.map +1 -0
- package/lib/oss-allowlist.js +8 -0
- package/lib/oss-allowlist.js.map +1 -0
- package/lib/permission.js +12 -12
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +1 -1
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +38 -57
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +9 -7
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +44 -114
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/lib/snapshot-url.spec.d.ts +7 -0
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.js +13 -13
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +9 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +4 -15
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/util/analytics.js +25 -32
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.js +55 -133
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js +17 -59
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +8 -8
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/deferred.js +10 -12
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.js +26 -39
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.js +58 -74
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -0
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +26 -46
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.js +11 -67
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +34 -79
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +44 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +1 -0
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +96 -103
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +87 -135
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.js +3 -3
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/jaeger-client-types.d.ts +68 -0
- package/lib/util/jaeger-client-types.d.ts.map +1 -0
- package/lib/util/jaeger-client-types.js +8 -0
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +32 -32
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +50 -113
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +2 -2
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +10 -0
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +31 -7
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +4 -0
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +123 -84
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.js +16 -55
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.js +144 -288
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeat.d.ts +15 -0
- package/lib/util/repeat.d.ts.map +1 -0
- package/lib/util/repeat.js +55 -0
- package/lib/util/repeat.js.map +1 -0
- package/lib/util/safe-promise.js +9 -12
- package/lib/util/safe-promise.js.map +1 -1
- package/lib/util/semaphore.js +15 -46
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.js +6 -6
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.js +16 -16
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.js +21 -24
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +50 -5
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +169 -63
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.d.ts +7 -0
- package/lib/util/tracing.spec.d.ts.map +1 -0
- package/lib/util/tracing.spec.js +121 -0
- package/lib/util/tracing.spec.js.map +1 -0
- package/lib/util/workspace-port-authentication.js +2 -2
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +11 -1
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +3 -3
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +3 -2
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.js +1 -1
- package/package.json +20 -12
- package/pkg-yarn.lock +12 -7
- package/src/accounting-protocol.ts +1 -3
- package/src/admin-protocol.ts +9 -3
- package/src/analytics.ts +2 -0
- package/src/email-protocol.ts +1 -1
- package/src/gitpod-service.ts +25 -13
- package/src/ide-protocol.ts +92 -0
- package/src/index.ts +2 -0
- package/src/messaging/error.ts +2 -2
- package/src/messaging/node/connection.ts +1 -45
- package/src/oss-allowlist.ts +15 -0
- package/src/protocol.ts +11 -8
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +1 -1
- package/src/teams-projects-protocol.ts +12 -1
- package/src/util/garbage-collected-cache.ts +7 -1
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.ts +9 -5
- package/src/util/grpc.ts +3 -3
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +32 -32
- package/src/util/parse-workspace-id.spec.ts +21 -1
- package/src/util/parse-workspace-id.ts +32 -6
- package/src/util/repeat.ts +45 -0
- package/src/util/tracing.spec.ts +83 -0
- package/src/util/tracing.ts +153 -17
- package/src/workspace-cluster.ts +8 -1
- package/src/workspace-instance.ts +9 -6
- package/src/wsready.ts +1 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
package/pkg-yarn.lock
CHANGED
|
@@ -4,21 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
"@gitpod/gitpod-protocol@0.1.5":
|
|
6
6
|
version "0.1.5"
|
|
7
|
-
resolved "file:///tmp/cache/
|
|
7
|
+
resolved "file:///tmp/cache/7584fa850a1eec7057606f96112b8e8037e9204b.tar.gz"
|
|
8
8
|
dependencies:
|
|
9
|
+
"@types/react" "17.0.32"
|
|
9
10
|
ajv "^6.5.4"
|
|
10
11
|
analytics-node "^4.0.1"
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
cookie "^0.4.1"
|
|
13
|
+
inversify "^5.1.1"
|
|
14
|
+
jaeger-client "^3.18.1"
|
|
13
15
|
js-yaml "^3.10.0"
|
|
14
|
-
opentracing "^0.14.
|
|
16
|
+
opentracing "^0.14.5"
|
|
15
17
|
prom-client "^13.2.0"
|
|
16
18
|
random-number-csprng "^1.0.2"
|
|
19
|
+
react "17.0.2"
|
|
20
|
+
react-dom "17.0.2"
|
|
17
21
|
reconnecting-websocket "^4.4.0"
|
|
18
|
-
reflect-metadata "^0.1.
|
|
19
|
-
uuid "^
|
|
22
|
+
reflect-metadata "^0.1.13"
|
|
23
|
+
uuid "^8.3.2"
|
|
20
24
|
vscode-jsonrpc "^5.0.1"
|
|
21
|
-
vscode-languageserver-protocol "3.
|
|
25
|
+
vscode-languageserver-protocol "3.16.0"
|
|
26
|
+
vscode-languageserver-types "3.16.0"
|
|
22
27
|
vscode-uri "^1.0.1"
|
|
23
28
|
vscode-ws-jsonrpc "^0.2.0"
|
|
24
29
|
ws "^7.4.6"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
8
8
|
import { User } from './protocol';
|
|
9
9
|
import { oneMonthLater } from './util/timeutil';
|
|
10
10
|
|
|
@@ -90,7 +90,6 @@ export interface SessionDescription {
|
|
|
90
90
|
contextUrl: string;
|
|
91
91
|
workspaceId: string;
|
|
92
92
|
workspaceInstanceId: string;
|
|
93
|
-
private: boolean;
|
|
94
93
|
}
|
|
95
94
|
export namespace SessionDescription {
|
|
96
95
|
export function is(obj: any): obj is SessionDescription {
|
|
@@ -99,7 +98,6 @@ export namespace SessionDescription {
|
|
|
99
98
|
&& obj.hasOwnProperty('contextUrl')
|
|
100
99
|
&& obj.hasOwnProperty('workspaceId')
|
|
101
100
|
&& obj.hasOwnProperty('workspaceInstanceId')
|
|
102
|
-
&& obj.hasOwnProperty('private');
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
103
|
|
package/src/admin-protocol.ts
CHANGED
|
@@ -94,6 +94,12 @@ export namespace WorkspaceAndInstance {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
export
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
export type AdminGetWorkspacesRequest = AdminGetListRequest<WorkspaceAndInstance> & AdminGetWorkspacesQuery;
|
|
98
|
+
/** The fields are meant to be used either OR (not combined) */
|
|
99
|
+
export type AdminGetWorkspacesQuery = {
|
|
100
|
+
/** we use this field in case we have a UUIDv4 and don't know whether it's an (old) workspace or instance id */
|
|
101
|
+
instanceIdOrWorkspaceId?: string;
|
|
102
|
+
instanceId?: string;
|
|
103
|
+
workspaceId?: string;
|
|
104
|
+
ownerId?: string;
|
|
105
|
+
};
|
package/src/analytics.ts
CHANGED
|
@@ -41,6 +41,8 @@ export type RemotePageMessage = Omit<PageMessage, "timestamp" | "userId"> & {
|
|
|
41
41
|
anonymousId?: string | number;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
export type RemoteIdentifyMessage = Omit<IdentifyMessage, "timestamp" | "userId" | "anonymousId">;
|
|
45
|
+
|
|
44
46
|
export interface IAnalyticsWriter {
|
|
45
47
|
|
|
46
48
|
identify(msg: IdentifyMessage): void;
|
package/src/email-protocol.ts
CHANGED
package/src/gitpod-service.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from './protocol';
|
|
14
14
|
import {
|
|
15
15
|
Team, TeamMemberInfo,
|
|
16
|
-
TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult
|
|
16
|
+
TeamMembershipInvite, Project, TeamMemberRole, PrebuildWithStatus, StartPrebuildResult, PartialProject
|
|
17
17
|
} from './teams-projects-protocol';
|
|
18
18
|
import { JsonRpcProxy, JsonRpcServer } from './messaging/proxy-factory';
|
|
19
19
|
import { Disposable, CancellationTokenSource } from 'vscode-jsonrpc';
|
|
@@ -28,7 +28,8 @@ import { Emitter } from './util/event';
|
|
|
28
28
|
import { AccountStatement, CreditAlert } from './accounting-protocol';
|
|
29
29
|
import { GithubUpgradeURL, PlanCoupon } from './payment-protocol';
|
|
30
30
|
import { TeamSubscription, TeamSubscriptionSlot, TeamSubscriptionSlotResolved } from './team-subscription-protocol';
|
|
31
|
-
import { RemotePageMessage, RemoteTrackMessage } from './analytics';
|
|
31
|
+
import { RemotePageMessage, RemoteTrackMessage, RemoteIdentifyMessage } from './analytics';
|
|
32
|
+
import { IDEServer } from './ide-protocol';
|
|
32
33
|
|
|
33
34
|
export interface GitpodClient {
|
|
34
35
|
onInstanceUpdate(instance: WorkspaceInstance): void;
|
|
@@ -45,7 +46,7 @@ export interface GitpodClient {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export const GitpodServer = Symbol('GitpodServer');
|
|
48
|
-
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService {
|
|
49
|
+
export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer, LicenseService, IDEServer {
|
|
49
50
|
// User related API
|
|
50
51
|
getLoggedInUser(): Promise<User>;
|
|
51
52
|
getTerms(): Promise<Terms>;
|
|
@@ -134,9 +135,13 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
134
135
|
getProjectOverview(projectId: string): Promise<Project.Overview | undefined>;
|
|
135
136
|
findPrebuilds(params: FindPrebuildsParams): Promise<PrebuildWithStatus[]>;
|
|
136
137
|
triggerPrebuild(projectId: string, branchName: string | null): Promise<StartPrebuildResult>;
|
|
137
|
-
|
|
138
|
+
cancelPrebuild(projectId: string, prebuildId: string): Promise<void>;
|
|
138
139
|
fetchProjectRepositoryConfiguration(projectId: string): Promise<string | undefined>;
|
|
139
140
|
guessProjectConfiguration(projectId: string): Promise<string | undefined>;
|
|
141
|
+
fetchRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
142
|
+
guessRepositoryConfiguration(cloneUrl: string): Promise<string | undefined>;
|
|
143
|
+
setProjectConfiguration(projectId: string, configString: string): Promise<void>;
|
|
144
|
+
updateProjectPartial(partialProject: PartialProject): Promise<void>;
|
|
140
145
|
|
|
141
146
|
// content service
|
|
142
147
|
getContentBlobUploadUrl(name: string): Promise<string>
|
|
@@ -152,10 +157,15 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
152
157
|
registerGithubApp(installationId: string): Promise<void>;
|
|
153
158
|
|
|
154
159
|
/**
|
|
155
|
-
* Stores a new snapshot for the given workspace and bucketId
|
|
160
|
+
* Stores a new snapshot for the given workspace and bucketId. Returns _before_ the actual snapshot is done. To wait for that, use `waitForSnapshot`.
|
|
156
161
|
* @return the snapshot id
|
|
157
162
|
*/
|
|
158
163
|
takeSnapshot(options: GitpodServer.TakeSnapshotOptions): Promise<string>;
|
|
164
|
+
/**
|
|
165
|
+
*
|
|
166
|
+
* @param snapshotId
|
|
167
|
+
*/
|
|
168
|
+
waitForSnapshot(snapshotId: string): Promise<void>;
|
|
159
169
|
|
|
160
170
|
/**
|
|
161
171
|
* Returns the list of snapshots that exist for a workspace.
|
|
@@ -187,8 +197,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
187
197
|
* gitpod.io concerns
|
|
188
198
|
*/
|
|
189
199
|
isStudent(): Promise<boolean>;
|
|
190
|
-
getPrivateRepoTrialEndDate(): Promise<string | undefined>;
|
|
191
|
-
|
|
192
200
|
/**
|
|
193
201
|
*
|
|
194
202
|
*/
|
|
@@ -206,7 +214,6 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
206
214
|
|
|
207
215
|
getShowPaymentUI(): Promise<boolean>;
|
|
208
216
|
isChargebeeCustomer(): Promise<boolean>;
|
|
209
|
-
mayAccessPrivateRepo(): Promise<boolean>;
|
|
210
217
|
|
|
211
218
|
subscriptionUpgradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
212
219
|
subscriptionDowngradeTo(subscriptionId: string, chargebeePlanId: string): Promise<void>;
|
|
@@ -229,10 +236,12 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
|
|
|
229
236
|
*/
|
|
230
237
|
trackEvent(event: RemoteTrackMessage): Promise<void>;
|
|
231
238
|
trackLocation(event: RemotePageMessage): Promise<void>;
|
|
239
|
+
identifyUser(event: RemoteIdentifyMessage): Promise<void>;
|
|
232
240
|
}
|
|
233
241
|
|
|
234
242
|
export interface CreateProjectParams {
|
|
235
243
|
name: string;
|
|
244
|
+
slug?: string;
|
|
236
245
|
account: string;
|
|
237
246
|
provider: string;
|
|
238
247
|
cloneUrl: string;
|
|
@@ -254,6 +263,7 @@ export interface GetProviderRepositoriesParams {
|
|
|
254
263
|
}
|
|
255
264
|
export interface ProviderRepository {
|
|
256
265
|
name: string;
|
|
266
|
+
path?: string;
|
|
257
267
|
account: string;
|
|
258
268
|
accountAvatarUrl: string;
|
|
259
269
|
cloneUrl: string;
|
|
@@ -264,11 +274,11 @@ export interface ProviderRepository {
|
|
|
264
274
|
inUse?: boolean;
|
|
265
275
|
}
|
|
266
276
|
|
|
267
|
-
export interface ClientHeaderFields{
|
|
268
|
-
ip?:string;
|
|
269
|
-
userAgent?:string;
|
|
270
|
-
dnt?:
|
|
271
|
-
clientRegion?:string;
|
|
277
|
+
export interface ClientHeaderFields {
|
|
278
|
+
ip?: string;
|
|
279
|
+
userAgent?: string;
|
|
280
|
+
dnt?: string;
|
|
281
|
+
clientRegion?: string;
|
|
272
282
|
}
|
|
273
283
|
|
|
274
284
|
export const WorkspaceTimeoutValues = ["30m", "60m", "180m"] as const;
|
|
@@ -331,6 +341,8 @@ export namespace GitpodServer {
|
|
|
331
341
|
export interface TakeSnapshotOptions {
|
|
332
342
|
workspaceId: string;
|
|
333
343
|
layoutData?: string;
|
|
344
|
+
/* this is here to enable backwards-compatibility and untangling rollout between workspace, IDE and meta */
|
|
345
|
+
dontWait?: boolean;
|
|
334
346
|
}
|
|
335
347
|
export interface GetUserStorageResourceOptions {
|
|
336
348
|
readonly uri: string;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `IDEServer` provides a list of available IDEs.
|
|
9
|
+
*/
|
|
10
|
+
export interface IDEServer {
|
|
11
|
+
/**
|
|
12
|
+
* Returns the IDE preferences.
|
|
13
|
+
*/
|
|
14
|
+
getIDEOptions(): Promise<IDEOptions>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IDEOptions {
|
|
18
|
+
/**
|
|
19
|
+
* A list of available IDEs.
|
|
20
|
+
*/
|
|
21
|
+
options: { [key: string]: IDEOption };
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The default (browser) IDE when the user has not specified one.
|
|
25
|
+
*/
|
|
26
|
+
defaultIde: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The default desktop IDE when the user has not specified one.
|
|
30
|
+
*/
|
|
31
|
+
defaultDesktopIde: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IDEOption {
|
|
35
|
+
/**
|
|
36
|
+
* To ensure a stable order one can set an `orderKey`.
|
|
37
|
+
*/
|
|
38
|
+
orderKey?: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Human readable title text of the IDE (plain text only).
|
|
42
|
+
*/
|
|
43
|
+
title: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The type of the IDE, currently 'browser' or 'desktop'.
|
|
47
|
+
*/
|
|
48
|
+
type: 'browser' | 'desktop';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The logo for the IDE. That could be a key in (see
|
|
52
|
+
* components/dashboard/src/images/ideLogos.ts) or a URL.
|
|
53
|
+
*/
|
|
54
|
+
logo: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Text of an optional tooltip (plain text only).
|
|
58
|
+
*/
|
|
59
|
+
tooltip?: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Text of an optional label next to the IDE option like “Insiders” (plain
|
|
63
|
+
* text only).
|
|
64
|
+
*/
|
|
65
|
+
label?: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Notes to the IDE option that are renderd in the preferences when a user
|
|
69
|
+
* chooses this IDE.
|
|
70
|
+
*/
|
|
71
|
+
notes?: string[];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* If `true` this IDE option is not visible in the IDE preferences.
|
|
75
|
+
*/
|
|
76
|
+
hidden?: boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The image ref to the IDE image.
|
|
80
|
+
*/
|
|
81
|
+
image: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* When this is `true`, the tag of this image is resolved to the latest
|
|
85
|
+
* image digest regularly.
|
|
86
|
+
*
|
|
87
|
+
* This is useful if this image points to a tag like `nightly` that will be
|
|
88
|
+
* updated regularly. When `resolveImageDigest` is `true`, we make sure that
|
|
89
|
+
* we resolve the tag regularly to the most recent image version.
|
|
90
|
+
*/
|
|
91
|
+
resolveImageDigest?: boolean;
|
|
92
|
+
}
|
package/src/index.ts
CHANGED
package/src/messaging/error.ts
CHANGED
|
@@ -76,6 +76,6 @@ export namespace ErrorCodes {
|
|
|
76
76
|
// 620 Team Subscription Assignment Failed
|
|
77
77
|
export const TEAM_SUBSCRIPTION_ASSIGNMENT_FAILED = 620;
|
|
78
78
|
|
|
79
|
-
//
|
|
80
|
-
export const
|
|
79
|
+
// 630 Snapshot Error
|
|
80
|
+
export const SNAPSHOT_ERROR = 630;
|
|
81
81
|
}
|
|
@@ -7,58 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
import * as ws from "ws";
|
|
9
9
|
import * as http from "http";
|
|
10
|
-
import * as https from "https";
|
|
11
|
-
import * as url from "url";
|
|
12
10
|
import * as net from "net";
|
|
13
|
-
import {
|
|
14
|
-
import { createWebSocketConnection, IWebSocket } from "vscode-ws-jsonrpc";
|
|
11
|
+
import { IWebSocket } from "vscode-ws-jsonrpc";
|
|
15
12
|
import { log } from '../../util/logging';
|
|
16
13
|
|
|
17
|
-
export interface IServerOptions {
|
|
18
|
-
readonly server: http.Server | https.Server;
|
|
19
|
-
readonly path?: string;
|
|
20
|
-
matches?(request: http.IncomingMessage): boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function createServerWebSocketConnection(options: IServerOptions, onConnect: (connection: MessageConnection) => void): void {
|
|
24
|
-
openJsonRpcSocket(options, socket => {
|
|
25
|
-
onConnect(createWebSocketConnection(socket, console));
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function openJsonRpcSocket(options: IServerOptions, onOpen: (socket: IWebSocket) => void): void {
|
|
30
|
-
openSocket(options, socket => {
|
|
31
|
-
const webSocket = toIWebSocket(socket);
|
|
32
|
-
onOpen(webSocket);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
14
|
export interface OnOpen {
|
|
37
15
|
(webSocket: ws, request: http.IncomingMessage, socket: net.Socket, head: Buffer): void;
|
|
38
16
|
}
|
|
39
17
|
|
|
40
|
-
export function openSocket(options: IServerOptions, onOpen: OnOpen): void {
|
|
41
|
-
const wss = new ws.Server({
|
|
42
|
-
noServer: true,
|
|
43
|
-
perMessageDeflate: {
|
|
44
|
-
// don't compress if a message is less than 256kb
|
|
45
|
-
threshold: 256 * 1024
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
options.server.on('upgrade', (request: http.IncomingMessage, socket: net.Socket, head: Buffer) => {
|
|
49
|
-
const pathname = request.url ? url.parse(request.url).pathname : undefined;
|
|
50
|
-
if (options.path && pathname === options.path || options.matches && options.matches(request)) {
|
|
51
|
-
wss.handleUpgrade(request, socket, head, webSocket => {
|
|
52
|
-
if (webSocket.readyState === webSocket.OPEN) {
|
|
53
|
-
onOpen(webSocket, request, socket, head);
|
|
54
|
-
} else {
|
|
55
|
-
webSocket.on('open', () => onOpen(webSocket, request, socket, head));
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
18
|
export function toIWebSocket(webSocket: ws) {
|
|
63
19
|
let sendsAfterOpen = 0;
|
|
64
20
|
return <IWebSocket>{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface OssAllowList {
|
|
8
|
+
/**
|
|
9
|
+
* A string that identifies a GitHub/GitLab/Bitbucket identity of the form "<host>/<profilename>"
|
|
10
|
+
* E.g., "github.com/geropl"
|
|
11
|
+
*/
|
|
12
|
+
identity: string,
|
|
13
|
+
|
|
14
|
+
deleted?: boolean,
|
|
15
|
+
}
|
package/src/protocol.ts
CHANGED
|
@@ -114,6 +114,8 @@ export interface EmailNotificationSettings {
|
|
|
114
114
|
|
|
115
115
|
export type IDESettings = {
|
|
116
116
|
defaultIde?: string
|
|
117
|
+
useDesktopIde?: boolean
|
|
118
|
+
defaultDesktopIde?: string
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
export interface UserPlatform {
|
|
@@ -135,14 +137,6 @@ export interface UserPlatform {
|
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
export interface UserFeatureSettings {
|
|
138
|
-
/**
|
|
139
|
-
* This field is used as marker to grant users a free trial for using private repositories,
|
|
140
|
-
* independent of any subscription or Chargebee.
|
|
141
|
-
* - it is set when the user uses their first private repo
|
|
142
|
-
* - whether the trial is expired or not is juged by the UserService
|
|
143
|
-
*/
|
|
144
|
-
privateRepoTrialStartDate?: string;
|
|
145
|
-
|
|
146
140
|
/**
|
|
147
141
|
* Permanent feature flags are added to each and every workspace instance
|
|
148
142
|
* this user starts.
|
|
@@ -378,11 +372,16 @@ export interface PendingGithubEvent {
|
|
|
378
372
|
export interface Snapshot {
|
|
379
373
|
id: string;
|
|
380
374
|
creationTime: string;
|
|
375
|
+
availableTime?: string;
|
|
381
376
|
originalWorkspaceId: string;
|
|
382
377
|
bucketId: string;
|
|
383
378
|
layoutData?: string;
|
|
379
|
+
state: SnapshotState;
|
|
380
|
+
message?: string;
|
|
384
381
|
}
|
|
385
382
|
|
|
383
|
+
export type SnapshotState = 'pending' | 'available' | 'error';
|
|
384
|
+
|
|
386
385
|
export interface LayoutData {
|
|
387
386
|
workspaceId: string;
|
|
388
387
|
lastUpdatedTime: string;
|
|
@@ -559,6 +558,9 @@ export interface WorkspaceConfig {
|
|
|
559
558
|
github?: GithubAppConfig;
|
|
560
559
|
vscode?: VSCodeConfig;
|
|
561
560
|
|
|
561
|
+
/** deprecated. Enabled by default **/
|
|
562
|
+
experimentalNetwork?: boolean;
|
|
563
|
+
|
|
562
564
|
/**
|
|
563
565
|
* Where the config object originates from.
|
|
564
566
|
*
|
|
@@ -769,6 +771,7 @@ export namespace ExternalImageConfigFile {
|
|
|
769
771
|
|
|
770
772
|
export interface WorkspaceContext {
|
|
771
773
|
title: string;
|
|
774
|
+
/** 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. */
|
|
772
775
|
normalizedContextURL?: string;
|
|
773
776
|
forceCreateNewWorkspace?: boolean;
|
|
774
777
|
forceImageBuild?: boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { suite, test } from "mocha-typescript"
|
|
8
|
+
import * as chai from "chai"
|
|
9
|
+
import { SnapshotUrl } from ".";
|
|
10
|
+
|
|
11
|
+
const expect = chai.expect
|
|
12
|
+
|
|
13
|
+
@suite class TestSnapshotUrlParser {
|
|
14
|
+
|
|
15
|
+
@test public testPositive() {
|
|
16
|
+
const actual = SnapshotUrl.parse("workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar@gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd");
|
|
17
|
+
|
|
18
|
+
expect(actual).to.deep.equal(<SnapshotUrl>{
|
|
19
|
+
bucketId: "gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd",
|
|
20
|
+
filename: "3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
|
|
21
|
+
fullPath: "workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
module.exports = new TestSnapshotUrlParser() // Only to circumvent no usage warning :-/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface SnapshotUrl {
|
|
8
|
+
bucketId: string;
|
|
9
|
+
fullPath: string;
|
|
10
|
+
filename: string;
|
|
11
|
+
}
|
|
12
|
+
export namespace SnapshotUrl {
|
|
13
|
+
export function parse(url: string): SnapshotUrl {
|
|
14
|
+
const parts = url.split("@");
|
|
15
|
+
if (parts.length !== 2) {
|
|
16
|
+
throw new Error(`cannot parse snapshot URL: ${url}`);
|
|
17
|
+
}
|
|
18
|
+
const [fullPath, bucketId] = parts;
|
|
19
|
+
|
|
20
|
+
const pathParts = fullPath.split("/");
|
|
21
|
+
if (pathParts.length < 1) {
|
|
22
|
+
throw new Error(`cannot parse snapshot URL: ${url}`);
|
|
23
|
+
}
|
|
24
|
+
const filename = pathParts[pathParts.length - 1];
|
|
25
|
+
return { bucketId, fullPath, filename };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -5,20 +5,27 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { PrebuiltWorkspaceState } from "./protocol";
|
|
8
|
-
import uuidv4
|
|
8
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
9
|
+
import { DeepPartial } from "./util/deep-partial";
|
|
9
10
|
|
|
10
11
|
export interface ProjectConfig {
|
|
11
12
|
'.gitpod.yml': string;
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
export interface ProjectSettings {
|
|
16
|
+
useIncrementalPrebuilds?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export interface Project {
|
|
15
20
|
id: string;
|
|
16
21
|
name: string;
|
|
22
|
+
slug?: string;
|
|
17
23
|
cloneUrl: string;
|
|
18
24
|
teamId?: string;
|
|
19
25
|
userId?: string;
|
|
20
26
|
appInstallationId: string;
|
|
21
27
|
config?: ProjectConfig;
|
|
28
|
+
settings?: ProjectSettings;
|
|
22
29
|
creationTime: string;
|
|
23
30
|
/** This is a flag that triggers the HARD DELETION of this entity */
|
|
24
31
|
deleted?: boolean;
|
|
@@ -54,6 +61,8 @@ export namespace Project {
|
|
|
54
61
|
}
|
|
55
62
|
}
|
|
56
63
|
|
|
64
|
+
export type PartialProject = DeepPartial<Project> & Pick<Project, 'id'>;
|
|
65
|
+
|
|
57
66
|
export interface PrebuildWithStatus {
|
|
58
67
|
info: PrebuildInfo;
|
|
59
68
|
status: PrebuiltWorkspaceState;
|
|
@@ -63,6 +72,7 @@ export interface PrebuildWithStatus {
|
|
|
63
72
|
export interface PrebuildInfo {
|
|
64
73
|
id: string;
|
|
65
74
|
buildWorkspaceId: string;
|
|
75
|
+
basedOnPrebuildId?: string;
|
|
66
76
|
|
|
67
77
|
teamId?: string;
|
|
68
78
|
userId?: string;
|
|
@@ -92,6 +102,7 @@ export namespace PrebuildInfo {
|
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
export interface StartPrebuildResult {
|
|
105
|
+
prebuildId: string;
|
|
95
106
|
wsid: string;
|
|
96
107
|
done: boolean;
|
|
97
108
|
}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { repeat } from "./repeat";
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
interface CacheEntry<T> {
|
|
9
11
|
key: string;
|
|
@@ -41,8 +43,12 @@ export class GarbageCollectedCache<T> {
|
|
|
41
43
|
return entry.value;
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
public delete(key: string) {
|
|
47
|
+
this.store.delete(key);
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
protected regularlyCollectGarbage() {
|
|
45
|
-
|
|
51
|
+
repeat(() => this.collectGarbage(), this.gcIntervalSeconds * 1000);
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
protected collectGarbage() {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
import * as cookie from 'cookie';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This cookie indicates whether the connected client is a Gitpod user (= "has logged in within the last year") or not.
|
|
11
|
+
* This is used by "gitpod.io" and "www.gitpod.io" to display different content/buttons.
|
|
12
|
+
*/
|
|
13
|
+
export const NAME = "gitpod-user";
|
|
14
|
+
export const VALUE = "true";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param domain The domain the Gitpod installation is installed onto
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export function options(domain: string): cookie.CookieSerializeOptions {
|
|
21
|
+
// Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
|
|
22
|
+
return {
|
|
23
|
+
path: "/", // make sure we send the cookie to all sub-pages
|
|
24
|
+
httpOnly: false,
|
|
25
|
+
secure: false,
|
|
26
|
+
maxAge: 60 * 60 * 24 * 365, // 1 year
|
|
27
|
+
sameSite: "lax", // default: true. "Lax" needed to ensure we see cookies from users that neavigate to gitpod.io from external sites
|
|
28
|
+
domain: `.${domain}`, // explicilty include subdomains to not only cover "gitpod.io", but also "www.gitpod.io" or workspaces
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export function generateCookie(domain: string): string {
|
|
33
|
+
return cookie.serialize(NAME, VALUE, options(domain));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export function isPresent(cookies: string): boolean {
|
|
37
|
+
// needs to match the old (gitpod-user=loggedIn) and new (gitpod-user=true) values to ensure a smooth transition during rollout.
|
|
38
|
+
return !!cookies.match(`${NAME}=`);
|
|
39
|
+
};
|
|
@@ -85,23 +85,27 @@ export class GitpodHostUrl {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
asDashboard(): GitpodHostUrl {
|
|
88
|
-
return this.with(url => ({ pathname: '/
|
|
88
|
+
return this.with(url => ({ pathname: '/' }));
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
asLogin(): GitpodHostUrl {
|
|
92
|
-
return this.with(url => ({ pathname: '/login
|
|
92
|
+
return this.with(url => ({ pathname: '/login' }));
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
asUpgradeSubscription(): GitpodHostUrl {
|
|
96
|
-
return this.with(url => ({ pathname: '/plans
|
|
96
|
+
return this.with(url => ({ pathname: '/plans' }));
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
asAccessControl(): GitpodHostUrl {
|
|
100
|
-
return this.with(url => ({ pathname: '/
|
|
100
|
+
return this.with(url => ({ pathname: '/integrations' }));
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
asSettings(): GitpodHostUrl {
|
|
104
|
-
return this.with(url => ({ pathname: '/settings
|
|
104
|
+
return this.with(url => ({ pathname: '/settings' }));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
asPreferences(): GitpodHostUrl {
|
|
108
|
+
return this.with(url => ({ pathname: '/preferences' }));
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
asGraphQLApi(): GitpodHostUrl {
|