@gitpod/gitpod-protocol 0.1.5-se-multi-repo.39 → 0.1.5-se-usage-view.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.
Files changed (342) hide show
  1. package/data/gitpod-schema.json +69 -3
  2. package/lib/accounting-protocol.d.ts +18 -10
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +34 -32
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +5 -0
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js.map +1 -1
  9. package/lib/analytics.d.ts.map +1 -1
  10. package/lib/analytics.js.map +1 -1
  11. package/lib/attribution.d.ts +20 -0
  12. package/lib/attribution.d.ts.map +1 -0
  13. package/lib/attribution.js +40 -0
  14. package/lib/attribution.js.map +1 -0
  15. package/lib/auth.d.ts.map +1 -1
  16. package/lib/billing-mode.d.ts +40 -0
  17. package/lib/billing-mode.d.ts.map +1 -0
  18. package/lib/billing-mode.js +36 -0
  19. package/lib/billing-mode.js.map +1 -0
  20. package/lib/blocked-repositories-protocol.d.ts +13 -0
  21. package/lib/blocked-repositories-protocol.d.ts.map +1 -0
  22. package/lib/blocked-repositories-protocol.js +8 -0
  23. package/lib/blocked-repositories-protocol.js.map +1 -0
  24. package/lib/context-url.d.ts.map +1 -1
  25. package/lib/context-url.js +4 -4
  26. package/lib/context-url.js.map +1 -1
  27. package/lib/context-url.spec.d.ts.map +1 -1
  28. package/lib/context-url.spec.js +20 -5
  29. package/lib/context-url.spec.js.map +1 -1
  30. package/lib/email-protocol.d.ts +1 -1
  31. package/lib/email-protocol.d.ts.map +1 -1
  32. package/lib/email-protocol.js.map +1 -1
  33. package/lib/encryption/container-module.d.ts.map +1 -1
  34. package/lib/encryption/container-module.js +1 -1
  35. package/lib/encryption/container-module.js.map +1 -1
  36. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  37. package/lib/encryption/encryption-engine.js +7 -7
  38. package/lib/encryption/encryption-engine.js.map +1 -1
  39. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  40. package/lib/encryption/encryption-engine.spec.js +2 -3
  41. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  42. package/lib/encryption/encryption-service.d.ts.map +1 -1
  43. package/lib/encryption/encryption-service.js +1 -1
  44. package/lib/encryption/encryption-service.js.map +1 -1
  45. package/lib/encryption/key-provider.d.ts.map +1 -1
  46. package/lib/encryption/key-provider.js +7 -9
  47. package/lib/encryption/key-provider.js.map +1 -1
  48. package/lib/env.d.ts +0 -5
  49. package/lib/env.d.ts.map +1 -1
  50. package/lib/env.js +1 -20
  51. package/lib/env.js.map +1 -1
  52. package/lib/experiments/always-default.d.ts +8 -0
  53. package/lib/experiments/always-default.d.ts.map +1 -0
  54. package/lib/experiments/always-default.js +20 -0
  55. package/lib/experiments/always-default.js.map +1 -0
  56. package/lib/experiments/configcat-server.d.ts +10 -0
  57. package/lib/experiments/configcat-server.d.ts.map +1 -0
  58. package/lib/experiments/configcat-server.js +36 -0
  59. package/lib/experiments/configcat-server.js.map +1 -0
  60. package/lib/experiments/configcat.d.ts +22 -0
  61. package/lib/experiments/configcat.d.ts.map +1 -0
  62. package/lib/experiments/configcat.js +53 -0
  63. package/lib/experiments/configcat.js.map +1 -0
  64. package/lib/experiments/types.d.ts +23 -0
  65. package/lib/experiments/types.d.ts.map +1 -0
  66. package/lib/experiments/types.js +10 -0
  67. package/lib/experiments/types.js.map +1 -0
  68. package/lib/gitpod-file-parser.d.ts.map +1 -1
  69. package/lib/gitpod-file-parser.js +6 -6
  70. package/lib/gitpod-file-parser.js.map +1 -1
  71. package/lib/gitpod-file-parser.spec.js +42 -39
  72. package/lib/gitpod-file-parser.spec.js.map +1 -1
  73. package/lib/gitpod-service.d.ts +57 -26
  74. package/lib/gitpod-service.d.ts.map +1 -1
  75. package/lib/gitpod-service.js +40 -33
  76. package/lib/gitpod-service.js.map +1 -1
  77. package/lib/headless-workspace-log.d.ts.map +1 -1
  78. package/lib/headless-workspace-log.js +1 -1
  79. package/lib/headless-workspace-log.js.map +1 -1
  80. package/lib/ide-frontend-service.d.ts +1 -1
  81. package/lib/ide-protocol.d.ts +14 -6
  82. package/lib/ide-protocol.d.ts.map +1 -1
  83. package/lib/index.d.ts +17 -16
  84. package/lib/index.d.ts.map +1 -1
  85. package/lib/index.js +1 -0
  86. package/lib/index.js.map +1 -1
  87. package/lib/installation-admin-protocol.d.ts +3 -0
  88. package/lib/installation-admin-protocol.d.ts.map +1 -1
  89. package/lib/installation-admin-protocol.js +3 -2
  90. package/lib/installation-admin-protocol.js.map +1 -1
  91. package/lib/license-protocol.d.ts +7 -0
  92. package/lib/license-protocol.d.ts.map +1 -1
  93. package/lib/license-protocol.js.map +1 -1
  94. package/lib/messaging/browser/connection.d.ts +1 -1
  95. package/lib/messaging/browser/connection.d.ts.map +1 -1
  96. package/lib/messaging/browser/connection.js +19 -19
  97. package/lib/messaging/browser/connection.js.map +1 -1
  98. package/lib/messaging/browser/window-connection.d.ts +4 -4
  99. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  100. package/lib/messaging/browser/window-connection.js +9 -6
  101. package/lib/messaging/browser/window-connection.js.map +1 -1
  102. package/lib/messaging/client-call-metrics.d.ts +2 -18
  103. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  104. package/lib/messaging/client-call-metrics.js +21 -22
  105. package/lib/messaging/client-call-metrics.js.map +1 -1
  106. package/lib/messaging/error.d.ts +6 -1
  107. package/lib/messaging/error.d.ts.map +1 -1
  108. package/lib/messaging/error.js +13 -3
  109. package/lib/messaging/error.js.map +1 -1
  110. package/lib/messaging/handler.d.ts.map +1 -1
  111. package/lib/messaging/handler.js +1 -1
  112. package/lib/messaging/node/connection.js +8 -8
  113. package/lib/messaging/node/connection.js.map +1 -1
  114. package/lib/messaging/proxy-factory.d.ts +1 -1
  115. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  116. package/lib/messaging/proxy-factory.js +7 -9
  117. package/lib/messaging/proxy-factory.js.map +1 -1
  118. package/lib/payment-protocol.d.ts.map +1 -1
  119. package/lib/payment-protocol.js +1 -1
  120. package/lib/payment-protocol.js.map +1 -1
  121. package/lib/permission.d.ts +2 -2
  122. package/lib/permission.d.ts.map +1 -1
  123. package/lib/permission.js +12 -23
  124. package/lib/permission.js.map +1 -1
  125. package/lib/plans.d.ts +4 -3
  126. package/lib/plans.d.ts.map +1 -1
  127. package/lib/plans.js +210 -171
  128. package/lib/plans.js.map +1 -1
  129. package/lib/protocol.d.ts +109 -35
  130. package/lib/protocol.d.ts.map +1 -1
  131. package/lib/protocol.js +248 -91
  132. package/lib/protocol.js.map +1 -1
  133. package/{src/theia-plugins.ts → lib/protocol.spec.d.ts} +2 -6
  134. package/lib/protocol.spec.d.ts.map +1 -0
  135. package/lib/protocol.spec.js +127 -0
  136. package/lib/protocol.spec.js.map +1 -0
  137. package/lib/snapshot-url.spec.js.map +1 -1
  138. package/lib/team-subscription-protocol.d.ts +20 -3
  139. package/lib/team-subscription-protocol.d.ts.map +1 -1
  140. package/lib/team-subscription-protocol.js +20 -5
  141. package/lib/team-subscription-protocol.js.map +1 -1
  142. package/lib/teams-projects-protocol.d.ts +21 -3
  143. package/lib/teams-projects-protocol.d.ts.map +1 -1
  144. package/lib/teams-projects-protocol.js +1 -1
  145. package/lib/teams-projects-protocol.js.map +1 -1
  146. package/lib/typings/globals.d.ts +2 -2
  147. package/lib/typings/globals.d.ts.map +1 -1
  148. package/lib/usage.d.ts +97 -0
  149. package/lib/usage.d.ts.map +1 -0
  150. package/lib/usage.js +14 -0
  151. package/lib/usage.js.map +1 -0
  152. package/lib/util/analytics.d.ts.map +1 -1
  153. package/lib/util/analytics.js +6 -6
  154. package/lib/util/analytics.js.map +1 -1
  155. package/lib/util/async-iterator.d.ts.map +1 -1
  156. package/lib/util/async-iterator.js +3 -3
  157. package/lib/util/async-iterator.js.map +1 -1
  158. package/lib/util/cancelable.js.map +1 -1
  159. package/lib/util/date-time.js +6 -6
  160. package/lib/util/date-time.js.map +1 -1
  161. package/lib/util/debug-app.d.ts +25 -0
  162. package/lib/util/debug-app.d.ts.map +1 -0
  163. package/lib/util/debug-app.js +100 -0
  164. package/lib/util/debug-app.js.map +1 -0
  165. package/lib/util/deferred.js.map +1 -1
  166. package/lib/util/disposable.d.ts.map +1 -1
  167. package/lib/util/disposable.js +2 -2
  168. package/lib/util/disposable.js.map +1 -1
  169. package/lib/util/event.d.ts.map +1 -1
  170. package/lib/util/event.js +5 -3
  171. package/lib/util/event.js.map +1 -1
  172. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  173. package/lib/util/garbage-collected-cache.js +6 -1
  174. package/lib/util/garbage-collected-cache.js.map +1 -1
  175. package/lib/util/generate-workspace-id.d.ts +5 -0
  176. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  177. package/lib/util/generate-workspace-id.js +446 -442
  178. package/lib/util/generate-workspace-id.js.map +1 -1
  179. package/lib/util/generate-workspace-id.spec.js +18 -7
  180. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  181. package/lib/util/gitpod-cookie.d.ts +1 -1
  182. package/lib/util/gitpod-cookie.d.ts.map +1 -1
  183. package/lib/util/gitpod-cookie.js +0 -3
  184. package/lib/util/gitpod-cookie.js.map +1 -1
  185. package/lib/util/gitpod-host-url.d.ts +3 -0
  186. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  187. package/lib/util/gitpod-host-url.js +49 -29
  188. package/lib/util/gitpod-host-url.js.map +1 -1
  189. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  190. package/lib/util/gitpod-host-url.spec.js +15 -5
  191. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  192. package/lib/util/grpc.d.ts +19 -0
  193. package/lib/util/grpc.d.ts.map +1 -1
  194. package/lib/util/grpc.js +73 -1
  195. package/lib/util/grpc.js.map +1 -1
  196. package/lib/util/jaeger-client-types.d.ts.map +1 -1
  197. package/lib/util/logging.d.ts +1 -1
  198. package/lib/util/logging.d.ts.map +1 -1
  199. package/lib/util/logging.js +31 -25
  200. package/lib/util/logging.js.map +1 -1
  201. package/lib/util/logging.spec.d.ts +7 -0
  202. package/lib/util/logging.spec.d.ts.map +1 -0
  203. package/lib/util/logging.spec.js +52 -0
  204. package/lib/util/logging.spec.js.map +1 -0
  205. package/lib/util/make-link.js +5 -5
  206. package/lib/util/make-link.js.map +1 -1
  207. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  208. package/lib/util/parse-workspace-id.js +1 -2
  209. package/lib/util/parse-workspace-id.js.map +1 -1
  210. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  211. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  212. package/lib/util/queue.spec.js +9 -6
  213. package/lib/util/queue.spec.js.map +1 -1
  214. package/lib/util/semaphore.d.ts.map +1 -1
  215. package/lib/util/semaphore.js.map +1 -1
  216. package/lib/util/skip-if.d.ts.map +1 -1
  217. package/lib/util/skip-if.js.map +1 -1
  218. package/lib/util/timeutil.d.ts +2 -0
  219. package/lib/util/timeutil.d.ts.map +1 -1
  220. package/lib/util/timeutil.js +15 -3
  221. package/lib/util/timeutil.js.map +1 -1
  222. package/lib/util/timeutil.spec.d.ts +1 -0
  223. package/lib/util/timeutil.spec.d.ts.map +1 -1
  224. package/lib/util/timeutil.spec.js +10 -0
  225. package/lib/util/timeutil.spec.js.map +1 -1
  226. package/lib/util/tracing.d.ts +6 -6
  227. package/lib/util/tracing.d.ts.map +1 -1
  228. package/lib/util/tracing.js +14 -16
  229. package/lib/util/tracing.js.map +1 -1
  230. package/lib/util/tracing.spec.js +3 -3
  231. package/lib/util/tracing.spec.js.map +1 -1
  232. package/lib/util/workspace-port-authentication.d.ts +7 -7
  233. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  234. package/lib/util/workspace-port-authentication.js +8 -11
  235. package/lib/util/workspace-port-authentication.js.map +1 -1
  236. package/lib/webhook-event.d.ts +44 -0
  237. package/lib/webhook-event.d.ts.map +1 -0
  238. package/lib/{theia-plugins.js → webhook-event.js} +2 -2
  239. package/lib/webhook-event.js.map +1 -0
  240. package/lib/workspace-class.d.ts +14 -0
  241. package/lib/workspace-class.d.ts.map +1 -0
  242. package/lib/workspace-class.js +8 -0
  243. package/lib/workspace-class.js.map +1 -0
  244. package/lib/workspace-cluster.d.ts +6 -8
  245. package/lib/workspace-cluster.d.ts.map +1 -1
  246. package/lib/workspace-cluster.js +2 -4
  247. package/lib/workspace-cluster.js.map +1 -1
  248. package/lib/workspace-instance.d.ts +20 -3
  249. package/lib/workspace-instance.d.ts.map +1 -1
  250. package/lib/wsready.d.ts +3 -3
  251. package/lib/wsready.d.ts.map +1 -1
  252. package/lib/wsready.js +0 -2
  253. package/lib/wsready.js.map +1 -1
  254. package/package.json +12 -6
  255. package/pkg-yarn.lock +8 -5
  256. package/provenance-bundle.jsonl +1 -1
  257. package/src/accounting-protocol.ts +66 -51
  258. package/src/admin-protocol.ts +30 -20
  259. package/src/analytics.ts +21 -21
  260. package/src/attribution.ts +48 -0
  261. package/src/auth.ts +2 -2
  262. package/src/billing-mode.ts +67 -0
  263. package/src/blocked-repositories-protocol.ts +13 -0
  264. package/src/context-url.spec.ts +25 -11
  265. package/src/context-url.ts +80 -78
  266. package/src/email-protocol.ts +5 -6
  267. package/src/encryption/container-module.ts +2 -3
  268. package/src/encryption/encryption-engine.spec.ts +9 -8
  269. package/src/encryption/encryption-engine.ts +14 -14
  270. package/src/encryption/encryption-service.ts +4 -5
  271. package/src/encryption/key-provider.ts +16 -19
  272. package/src/env.ts +0 -22
  273. package/src/experiments/always-default.ts +24 -0
  274. package/src/experiments/configcat-server.ts +41 -0
  275. package/src/experiments/configcat.ts +58 -0
  276. package/src/experiments/types.ts +35 -0
  277. package/src/gitpod-file-parser.spec.ts +55 -61
  278. package/src/gitpod-file-parser.ts +16 -17
  279. package/src/gitpod-service.ts +189 -111
  280. package/src/headless-workspace-log.ts +5 -4
  281. package/src/ide-frontend-service.ts +2 -2
  282. package/src/ide-protocol.ts +18 -8
  283. package/src/index.ts +17 -16
  284. package/src/installation-admin-protocol.ts +11 -8
  285. package/src/license-protocol.ts +12 -6
  286. package/src/messaging/browser/connection.ts +45 -47
  287. package/src/messaging/browser/window-connection.ts +39 -29
  288. package/src/messaging/client-call-metrics.ts +62 -82
  289. package/src/messaging/error.ts +20 -7
  290. package/src/messaging/handler.ts +6 -6
  291. package/src/messaging/node/connection.ts +8 -8
  292. package/src/messaging/proxy-factory.ts +23 -30
  293. package/src/oss-allowlist.ts +3 -3
  294. package/src/payment-protocol.ts +2 -2
  295. package/src/permission.ts +20 -31
  296. package/src/plans.ts +240 -189
  297. package/src/protocol.spec.ts +97 -0
  298. package/src/protocol.ts +456 -242
  299. package/src/snapshot-url.spec.ts +9 -7
  300. package/src/team-subscription-protocol.ts +57 -22
  301. package/src/teams-projects-protocol.ts +28 -8
  302. package/src/typings/globals.ts +4 -4
  303. package/src/usage.ts +128 -0
  304. package/src/util/analytics.ts +46 -42
  305. package/src/util/async-iterator.ts +4 -5
  306. package/src/util/cancelable.ts +3 -3
  307. package/src/util/date-time.ts +8 -8
  308. package/src/util/debug-app.ts +81 -0
  309. package/src/util/deferred.ts +6 -6
  310. package/src/util/disposable.ts +3 -6
  311. package/src/util/event.ts +9 -11
  312. package/src/util/garbage-collected-cache.ts +8 -6
  313. package/src/util/generate-workspace-id.spec.ts +26 -16
  314. package/src/util/generate-workspace-id.ts +460 -454
  315. package/src/util/gitpod-cookie.ts +8 -9
  316. package/src/util/gitpod-host-url.spec.ts +40 -13
  317. package/src/util/gitpod-host-url.ts +57 -33
  318. package/src/util/grpc.ts +90 -1
  319. package/src/util/jaeger-client-types.ts +2 -2
  320. package/src/util/logging.spec.ts +23 -0
  321. package/src/util/logging.ts +60 -42
  322. package/src/util/make-link.ts +6 -7
  323. package/src/util/parse-workspace-id.spec.ts +17 -8
  324. package/src/util/parse-workspace-id.ts +5 -6
  325. package/src/util/queue.spec.ts +27 -25
  326. package/src/util/repeat.ts +1 -1
  327. package/src/util/semaphore.ts +4 -6
  328. package/src/util/skip-if.ts +9 -6
  329. package/src/util/timeutil.spec.ts +19 -14
  330. package/src/util/timeutil.ts +27 -11
  331. package/src/util/tracing.spec.ts +28 -23
  332. package/src/util/tracing.ts +54 -51
  333. package/src/util/workspace-port-authentication.ts +10 -13
  334. package/src/webhook-event.ts +55 -0
  335. package/src/workspace-class.ts +14 -0
  336. package/src/workspace-cluster.ts +14 -13
  337. package/src/workspace-instance.ts +60 -24
  338. package/src/wsready.ts +5 -4
  339. package/data/builtin-theia-plugins.json +0 -372
  340. package/lib/theia-plugins.d.ts +0 -11
  341. package/lib/theia-plugins.d.ts.map +0 -1
  342. package/lib/theia-plugins.js.map +0 -1
@@ -5,8 +5,9 @@
5
5
  */
6
6
 
7
7
  import { User, Workspace, NamedWorkspaceFeatureFlag } from "./protocol";
8
+ import { BlockedRepository } from "./blocked-repositories-protocol";
8
9
  import { FindPrebuildsParams } from "./gitpod-service";
9
- import { Project, Team, PrebuildWithStatus, TeamMemberInfo, TeamMemberRole } from "./teams-projects-protocol"
10
+ import { Project, Team, PrebuildWithStatus, TeamMemberInfo, TeamMemberRole } from "./teams-projects-protocol";
10
11
  import { WorkspaceInstance, WorkspaceInstancePhase } from "./workspace-instance";
11
12
  import { RoleOrPermission } from "./permission";
12
13
  import { AccountStatement } from "./accounting-protocol";
@@ -17,9 +18,16 @@ export interface AdminServer {
17
18
  adminGetUser(id: string): Promise<User>;
18
19
  adminBlockUser(req: AdminBlockUserRequest): Promise<User>;
19
20
  adminDeleteUser(id: string): Promise<void>;
21
+ adminVerifyUser(id: string): Promise<User>;
20
22
  adminModifyRoleOrPermission(req: AdminModifyRoleOrPermissionRequest): Promise<User>;
21
23
  adminModifyPermanentWorkspaceFeatureFlag(req: AdminModifyPermanentWorkspaceFeatureFlagRequest): Promise<User>;
22
24
 
25
+ adminCreateBlockedRepository(urlRegexp: string, blockUser: boolean): Promise<BlockedRepository>;
26
+ adminDeleteBlockedRepository(id: number): Promise<void>;
27
+ adminGetBlockedRepositories(
28
+ req: AdminGetListRequest<BlockedRepository>,
29
+ ): Promise<AdminGetListResult<BlockedRepository>>;
30
+
23
31
  adminGetTeamMembers(teamId: string): Promise<TeamMemberInfo[]>;
24
32
  adminGetTeams(req: AdminGetListRequest<Team>): Promise<AdminGetListResult<Team>>;
25
33
  adminGetTeamById(id: string): Promise<Team | undefined>;
@@ -42,45 +50,47 @@ export interface AdminServer {
42
50
  adminAddStudentEmailDomain(userId: string, domain: string): Promise<void>;
43
51
  adminGrantExtraHours(userId: string, extraHours: number): Promise<void>;
44
52
 
45
- adminGetSettings(): Promise<InstallationAdminSettings>
46
- adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>
53
+ adminGetSettings(): Promise<InstallationAdminSettings>;
54
+ adminUpdateSettings(settings: InstallationAdminSettings): Promise<void>;
47
55
  }
48
56
 
49
57
  export interface AdminGetListRequest<T> {
50
- offset: number
51
- limit: number
52
- orderBy: keyof T
53
- orderDir: "asc" | "desc"
58
+ offset: number;
59
+ limit: number;
60
+ orderBy: keyof T;
61
+ orderDir: "asc" | "desc";
54
62
  searchTerm?: string;
55
63
  }
56
64
 
57
65
  export interface AdminGetListResult<T> {
58
- total: number
59
- rows: T[]
66
+ total: number;
67
+ rows: T[];
60
68
  }
61
69
 
62
70
  export interface AdminBlockUserRequest {
63
- id: string
64
- blocked: boolean
71
+ id: string;
72
+ blocked: boolean;
65
73
  }
66
74
 
67
75
  export interface AdminModifyRoleOrPermissionRequest {
68
76
  id: string;
69
77
  rpp: {
70
- r: RoleOrPermission
71
- add: boolean
72
- }[]
78
+ r: RoleOrPermission;
79
+ add: boolean;
80
+ }[];
73
81
  }
74
82
 
75
83
  export interface AdminModifyPermanentWorkspaceFeatureFlagRequest {
76
84
  id: string;
77
85
  changes: {
78
- featureFlag: NamedWorkspaceFeatureFlag
79
- add: boolean
80
- }[]
86
+ featureFlag: NamedWorkspaceFeatureFlag;
87
+ add: boolean;
88
+ }[];
81
89
  }
82
90
 
83
- export interface WorkspaceAndInstance extends Omit<Workspace, "id" | "creationTime">, Omit<WorkspaceInstance, "id" | "creationTime"> {
91
+ export interface WorkspaceAndInstance
92
+ extends Omit<Workspace, "id" | "creationTime">,
93
+ Omit<WorkspaceInstance, "id" | "creationTime"> {
84
94
  workspaceId: string;
85
95
  workspaceCreationTime: string;
86
96
  instanceId: string;
@@ -93,7 +103,7 @@ export namespace WorkspaceAndInstance {
93
103
  return {
94
104
  id: wai.workspaceId,
95
105
  creationTime: wai.workspaceCreationTime,
96
- ...wai
106
+ ...wai,
97
107
  };
98
108
  }
99
109
 
@@ -104,7 +114,7 @@ export namespace WorkspaceAndInstance {
104
114
  return {
105
115
  id: wai.instanceId,
106
116
  creationTime: wai.instanceCreationTime,
107
- ...wai
117
+ ...wai,
108
118
  };
109
119
  }
110
120
  }
package/src/analytics.ts CHANGED
@@ -4,7 +4,6 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
-
8
7
  export const IAnalyticsWriter = Symbol("IAnalyticsWriter");
9
8
 
10
9
  type Identity =
@@ -15,24 +14,27 @@ interface Message {
15
14
  messageId?: string;
16
15
  }
17
16
 
18
- export type IdentifyMessage = Message & Identity & {
19
- traits?: any;
20
- timestamp?: Date;
21
- context?: any;
22
- };
23
-
24
- export type TrackMessage = Message & Identity & {
25
- event: string;
26
- properties?: any;
27
- timestamp?: Date;
28
- context?: any;
29
- };
30
-
31
- export type PageMessage = Message & Identity & {
32
- properties?: any;
33
- timestamp?: Date;
34
- context?: any;
35
- };
17
+ export type IdentifyMessage = Message &
18
+ Identity & {
19
+ traits?: any;
20
+ timestamp?: Date;
21
+ context?: any;
22
+ };
23
+
24
+ export type TrackMessage = Message &
25
+ Identity & {
26
+ event: string;
27
+ properties?: any;
28
+ timestamp?: Date;
29
+ context?: any;
30
+ };
31
+
32
+ export type PageMessage = Message &
33
+ Identity & {
34
+ properties?: any;
35
+ timestamp?: Date;
36
+ context?: any;
37
+ };
36
38
 
37
39
  export type RemoteTrackMessage = Omit<TrackMessage, "timestamp" | "userId">;
38
40
  export type RemotePageMessage = Omit<PageMessage, "timestamp" | "userId"> & {
@@ -42,11 +44,9 @@ export type RemotePageMessage = Omit<PageMessage, "timestamp" | "userId"> & {
42
44
  export type RemoteIdentifyMessage = Omit<IdentifyMessage, "timestamp" | "userId">;
43
45
 
44
46
  export interface IAnalyticsWriter {
45
-
46
47
  identify(msg: IdentifyMessage): void;
47
48
 
48
49
  track(msg: TrackMessage): void;
49
50
 
50
51
  page(msg: PageMessage): void;
51
-
52
52
  }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright (c) 2022 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 type AttributionId = UserAttributionId | TeamAttributionId;
8
+ export type AttributionTarget = "user" | "team";
9
+
10
+ export interface UserAttributionId {
11
+ kind: "user";
12
+ userId: string;
13
+ }
14
+ export interface TeamAttributionId {
15
+ kind: "team";
16
+ teamId: string;
17
+ }
18
+
19
+ export namespace AttributionId {
20
+ const SEPARATOR = ":";
21
+
22
+ export function parse(s: string): UserAttributionId | TeamAttributionId | undefined {
23
+ if (!s) {
24
+ return undefined;
25
+ }
26
+ const parts = s.split(":");
27
+ if (parts.length !== 2) {
28
+ return undefined;
29
+ }
30
+ switch (parts[0]) {
31
+ case "user":
32
+ return { kind: "user", userId: parts[1] };
33
+ case "team":
34
+ return { kind: "team", teamId: parts[1] };
35
+ default:
36
+ return undefined;
37
+ }
38
+ }
39
+
40
+ export function render(id: AttributionId): string {
41
+ switch (id.kind) {
42
+ case "user":
43
+ return `user${SEPARATOR}${id.userId}`;
44
+ case "team":
45
+ return `team${SEPARATOR}${id.teamId}`;
46
+ }
47
+ }
48
+ }
package/src/auth.ts CHANGED
@@ -11,14 +11,14 @@ export interface SelectAccountPayload {
11
11
  authHost: string;
12
12
  authName: string;
13
13
  authProviderType: string;
14
- },
14
+ };
15
15
  otherUser: {
16
16
  name: string;
17
17
  avatarUrl: string;
18
18
  authHost: string;
19
19
  authName: string;
20
20
  authProviderType: string;
21
- }
21
+ };
22
22
  }
23
23
  export namespace SelectAccountPayload {
24
24
  export function is(data: any): data is SelectAccountPayload {
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Copyright (c) 2022 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
+ * BillingMode is used to answer the following questions:
9
+ * - Should UI piece x be displayed for this user/team? (getBillingModeForUser/Team)
10
+ * - What model should be used to limit this workspace's capabilities (mayStartWorkspace, setTimeout, workspace class, etc...) (getBillingMode(workspaceInstance.attributionId))
11
+ * - How is a workspace session charged for? (getBillingMode(workspaceInstance.attributionId))
12
+ */
13
+ export type BillingMode = None | Chargebee | UsageBased;
14
+ export namespace BillingMode {
15
+ export const NONE: None = {
16
+ mode: "none",
17
+ };
18
+
19
+ /** Incl. upgrade and status */
20
+ export function showUsageBasedBilling(billingMode?: BillingMode): boolean {
21
+ if (!billingMode) {
22
+ return false;
23
+ }
24
+ return (
25
+ billingMode.mode === "usage-based" || (billingMode.mode === "chargebee" && !!billingMode.canUpgradeToUBB)
26
+ );
27
+ }
28
+
29
+ export function canSetWorkspaceClass(billingMode?: BillingMode): boolean {
30
+ if (!billingMode) {
31
+ return false;
32
+ }
33
+
34
+ // if has any Stripe subscription, either directly or per team
35
+ return billingMode.mode === "usage-based";
36
+ }
37
+
38
+ export function canSetCostCenter(billingMode: BillingMode): boolean {
39
+ // if has any Stripe Subscription, either directly or per team
40
+ return billingMode.mode === "usage-based";
41
+ }
42
+ }
43
+
44
+ /** Payment is disabled */
45
+ interface None {
46
+ mode: "none";
47
+ }
48
+
49
+ /** Sessions is handled with old subscription logic based on Chargebee */
50
+ interface Chargebee {
51
+ mode: "chargebee";
52
+ canUpgradeToUBB?: boolean;
53
+ }
54
+
55
+ /** Session is handld with new usage-based logic */
56
+ interface UsageBased {
57
+ mode: "usage-based";
58
+
59
+ /** True iff this is a team, and is based on a paid plan. Currently only set for teams! */
60
+ paid?: boolean;
61
+
62
+ /** User is already converted, but is member with at least one Chargebee-based "Team Plan" */
63
+ hasChargebeeTeamPlan?: boolean;
64
+
65
+ /** User is already converted, but is member in at least one Chargebee-based "Team Subscription" */
66
+ hasChargebeeTeamSubscription?: boolean;
67
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2022 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 BlockedRepository {
8
+ id: number;
9
+ urlRegexp: string;
10
+ blockUser: boolean;
11
+ createdAt: string;
12
+ updatedAt: string;
13
+ }
@@ -4,43 +4,57 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- import * as chai from 'chai';
8
- import { suite, test } from 'mocha-typescript';
9
- import { Workspace } from '.';
10
- import { ContextURL } from './context-url';
7
+ import * as chai from "chai";
8
+ import { suite, test } from "mocha-typescript";
9
+ import { Workspace } from ".";
10
+ import { ContextURL } from "./context-url";
11
11
  const expect = chai.expect;
12
12
 
13
13
  type WsContextUrl = Pick<Workspace, "context" | "contextURL">;
14
14
 
15
15
  @suite
16
16
  export class ContextUrlTest {
17
-
18
17
  @test public parseContextUrl_withEnvVar() {
19
- const actual = ContextURL.getNormalizedURL({ contextURL: "passedin=test%20value/https://github.com/gitpod-io/gitpod-test-repo", context: {} } as WsContextUrl);
18
+ const actual = ContextURL.getNormalizedURL({
19
+ contextURL: "passedin=test%20value/https://github.com/gitpod-io/gitpod-test-repo",
20
+ context: {},
21
+ } as WsContextUrl);
20
22
  expect(actual?.host).to.equal("github.com");
21
23
  expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
22
24
  }
23
25
 
24
26
  @test public parseContextUrl_withEnvVar_withoutSchema() {
25
- const actual = ContextURL.getNormalizedURL({ contextURL: "passedin=test%20value/github.com/gitpod-io/gitpod-test-repo", context: {} } as WsContextUrl);
27
+ const actual = ContextURL.getNormalizedURL({
28
+ contextURL: "passedin=test%20value/github.com/gitpod-io/gitpod-test-repo",
29
+ context: {},
30
+ } as WsContextUrl);
26
31
  expect(actual?.host).to.equal("github.com");
27
32
  expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
28
33
  }
29
34
 
30
35
  @test public parseContextUrl_withEnvVar_sshUrl() {
31
- const actual = ContextURL.getNormalizedURL({ contextURL: "passedin=test%20value/git@github.com:gitpod-io/gitpod-test-repo.git", context: {} } as WsContextUrl);
36
+ const actual = ContextURL.getNormalizedURL({
37
+ contextURL: "passedin=test%20value/git@github.com:gitpod-io/gitpod-test-repo.git",
38
+ context: {},
39
+ } as WsContextUrl);
32
40
  expect(actual?.host).to.equal("github.com");
33
41
  expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo.git");
34
42
  }
35
43
 
36
44
  @test public parseContextUrl_withPrebuild() {
37
- const actual = ContextURL.getNormalizedURL({ contextURL: "prebuild/https://github.com/gitpod-io/gitpod-test-repo", context: {} } as WsContextUrl);
45
+ const actual = ContextURL.getNormalizedURL({
46
+ contextURL: "prebuild/https://github.com/gitpod-io/gitpod-test-repo",
47
+ context: {},
48
+ } as WsContextUrl);
38
49
  expect(actual?.host).to.equal("github.com");
39
50
  expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
40
51
  }
41
52
 
42
53
  @test public parseContextUrl_withPrebuild_withoutSchema() {
43
- const actual = ContextURL.getNormalizedURL({ contextURL: "prebuild/github.com/gitpod-io/gitpod-test-repo", context: {} } as WsContextUrl);
54
+ const actual = ContextURL.getNormalizedURL({
55
+ contextURL: "prebuild/github.com/gitpod-io/gitpod-test-repo",
56
+ context: {},
57
+ } as WsContextUrl);
44
58
  expect(actual?.host).to.equal("github.com");
45
59
  expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
46
60
  }
@@ -50,4 +64,4 @@ export class ContextUrlTest {
50
64
  expect(actual).to.be.undefined;
51
65
  }
52
66
  }
53
- module.exports = new ContextUrlTest()
67
+ module.exports = new ContextUrlTest();
@@ -15,93 +15,95 @@ import { Workspace } from ".";
15
15
  * TODO(gpl) See if we can get this into `server` code to remove the burden from clients
16
16
  */
17
17
  export namespace ContextURL {
18
- export const INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
19
- export const PREBUILD_PREFIX = "prebuild";
20
- export const IMAGEBUILD_PREFIX = "imagebuild";
21
- export const SNAPSHOT_PREFIX = "snapshot";
22
- export const REFERRER_PREFIX = 'referrer:';
18
+ export const INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
19
+ export const PREBUILD_PREFIX = "prebuild";
20
+ export const IMAGEBUILD_PREFIX = "imagebuild";
21
+ export const SNAPSHOT_PREFIX = "snapshot";
22
+ export const REFERRER_PREFIX = "referrer:";
23
23
 
24
- /**
25
- * This function will (try to) return the HTTP(S) URL of the context the user originally created this workspace on.
26
- * Especially it will not contain any modifiers or be of different scheme than HTTP(S).
27
- *
28
- * Use this function if you need to provided a _working_ URL to the original context.
29
- * @param ws
30
- * @returns
31
- */
32
- export function getNormalizedURL(ws: Pick<Workspace, "context" | "contextURL"> | undefined): URL | undefined {
33
- const normalized = normalize(ws);
34
- if (!normalized) {
35
- return undefined;
36
- }
24
+ /**
25
+ * This function will (try to) return the HTTP(S) URL of the context the user originally created this workspace on.
26
+ * Especially it will not contain any modifiers or be of different scheme than HTTP(S).
27
+ *
28
+ * Use this function if you need to provided a _working_ URL to the original context.
29
+ * @param ws
30
+ * @returns
31
+ */
32
+ export function getNormalizedURL(ws: Pick<Workspace, "context" | "contextURL"> | undefined): URL | undefined {
33
+ const normalized = normalize(ws);
34
+ if (!normalized) {
35
+ return undefined;
36
+ }
37
37
 
38
- try {
39
- return new URL(normalized);
40
- } catch (err) {
41
- console.error(`unable to parse URL from normalized contextURL: '${normalized}'`, err);
38
+ try {
39
+ return new URL(normalized);
40
+ } catch (err) {
41
+ console.debug(`unable to parse URL from normalized contextURL: '${normalized}'`);
42
+ }
43
+ return undefined;
42
44
  }
43
- return undefined;
44
- }
45
45
 
46
- function normalize(ws: Pick<Workspace, "context" | "contextURL"> | undefined): string | undefined {
47
- if (!ws) {
48
- return undefined;
49
- }
50
- if (ws.context.normalizedContextURL) {
51
- return ws.context.normalizedContextURL;
52
- }
46
+ function normalize(ws: Pick<Workspace, "context" | "contextURL"> | undefined): string | undefined {
47
+ if (!ws) {
48
+ return undefined;
49
+ }
50
+ if (ws.context.normalizedContextURL) {
51
+ return ws.context.normalizedContextURL;
52
+ }
53
53
 
54
- // fallback: we do not yet set normalizedContextURL on all workspaces, yet, let alone older existing workspaces
55
- let fallback: string | undefined = undefined;
56
- try {
57
- fallback = removePrefixes(ws.contextURL);
58
- } catch (err) {
59
- console.error(`unable to remove prefixes from contextURL: '${ws.contextURL}'`, err);
54
+ // fallback: we do not yet set normalizedContextURL on all workspaces, yet, let alone older existing workspaces
55
+ let fallback: string | undefined = undefined;
56
+ try {
57
+ fallback = removePrefixes(ws.contextURL);
58
+ } catch (err) {
59
+ console.error(`unable to remove prefixes from contextURL: '${ws.contextURL}'`, err);
60
+ }
61
+ return fallback;
60
62
  }
61
- return fallback;
62
- }
63
63
 
64
- /**
65
- * The field "contextUrl" might contain prefixes like:
66
- * - envvar1=value1/...
67
- * - prebuild/...
68
- * This is the analogon to the (Prefix)ContextParser structure in "server".
69
- */
70
- function removePrefixes(contextUrl: string | undefined): string | undefined {
71
- if (contextUrl === undefined) {
72
- return undefined;
73
- }
64
+ /**
65
+ * The field "contextUrl" might contain prefixes like:
66
+ * - envvar1=value1/...
67
+ * - prebuild/...
68
+ * This is the analogon to the (Prefix)ContextParser structure in "server".
69
+ */
70
+ function removePrefixes(contextUrl: string | undefined): string | undefined {
71
+ if (contextUrl === undefined) {
72
+ return undefined;
73
+ }
74
74
 
75
- const segments = contextUrl.split("/");
76
- if (segments.length === 1) {
77
- return segments[0]; // this might be something, we just try
78
- }
75
+ const segments = contextUrl.split("/");
76
+ if (segments.length === 1) {
77
+ return segments[0]; // this might be something, we just try
78
+ }
79
79
 
80
- const segmentsToURL = (offset: number): string => {
81
- let rest = segments.slice(offset).join("/");
82
- if (/^git@[^:\/]+:/.test(rest)) {
83
- rest = rest.replace(/^git@([^:\/]+):/, 'https://$1/');
84
- }
85
- if (!rest.startsWith("http")) {
86
- rest = 'https://' + rest;
87
- }
88
- return rest;
89
- };
80
+ const segmentsToURL = (offset: number): string => {
81
+ let rest = segments.slice(offset).join("/");
82
+ if (/^git@[^:\/]+:/.test(rest)) {
83
+ rest = rest.replace(/^git@([^:\/]+):/, "https://$1/");
84
+ }
85
+ if (!rest.startsWith("http")) {
86
+ rest = "https://" + rest;
87
+ }
88
+ return rest;
89
+ };
90
90
 
91
- const firstSegment = segments[0];
92
- if (firstSegment === PREBUILD_PREFIX ||
93
- firstSegment === INCREMENTAL_PREBUILD_PREFIX ||
94
- firstSegment === IMAGEBUILD_PREFIX ||
95
- firstSegment === SNAPSHOT_PREFIX ||
96
- firstSegment.startsWith(REFERRER_PREFIX)) {
97
- return segmentsToURL(1);
98
- }
91
+ const firstSegment = segments[0];
92
+ if (
93
+ firstSegment === PREBUILD_PREFIX ||
94
+ firstSegment === INCREMENTAL_PREBUILD_PREFIX ||
95
+ firstSegment === IMAGEBUILD_PREFIX ||
96
+ firstSegment === SNAPSHOT_PREFIX ||
97
+ firstSegment.startsWith(REFERRER_PREFIX)
98
+ ) {
99
+ return segmentsToURL(1);
100
+ }
99
101
 
100
- // check for env vars
101
- if (firstSegment.indexOf("=") !== -1) {
102
- return segmentsToURL(1);
103
- }
102
+ // check for env vars
103
+ if (firstSegment.indexOf("=") !== -1) {
104
+ return segmentsToURL(1);
105
+ }
104
106
 
105
- return segmentsToURL(0);
106
- }
107
- }
107
+ return segmentsToURL(0);
108
+ }
109
+ }
@@ -4,10 +4,9 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- import { v4 as uuidv4 } from 'uuid';
7
+ import { v4 as uuidv4 } from "uuid";
8
8
 
9
- export type EMailState = "scheduledInternal"
10
- | "scheduledSendgrid";
9
+ export type EMailState = "scheduledInternal" | "scheduledSendgrid";
11
10
 
12
11
  export interface EMailStatus {
13
12
  /** The time the email entry was inserted into the DB */
@@ -58,9 +57,9 @@ export type EMail = {
58
57
  } & EMailStatus;
59
58
 
60
59
  export namespace EMail {
61
- export const create = (ts: Omit<EMail, 'uid'>): EMail => {
60
+ export const create = (ts: Omit<EMail, "uid">): EMail => {
62
61
  const withId = ts as EMail;
63
62
  withId.uid = uuidv4();
64
63
  return withId;
65
- }
66
- }
64
+ };
65
+ }
@@ -19,10 +19,9 @@ import { EncryptionService, EncryptionServiceImpl } from "./encryption-service";
19
19
  * };
20
20
  * }).inSingletonScope();
21
21
  */
22
- export const encryptionModule: interfaces.ContainerModuleCallBack = bind => {
23
-
22
+ export const encryptionModule: interfaces.ContainerModuleCallBack = (bind) => {
24
23
  bind(KeyProvider).to(KeyProviderImpl).inSingletonScope();
25
24
 
26
25
  bind(EncryptionEngine).to(EncryptionEngineImpl).inSingletonScope();
27
26
  bind(EncryptionService).to(EncryptionServiceImpl).inSingletonScope();
28
- };
27
+ };
@@ -5,25 +5,26 @@
5
5
  */
6
6
 
7
7
  import { suite, test } from "mocha-typescript";
8
- import * as chai from 'chai';
9
- import * as path from 'path';
8
+ import * as chai from "chai";
9
+ import * as path from "path";
10
10
  import * as fs from "fs";
11
11
 
12
12
  import { EncryptionEngineImpl } from "./encryption-engine";
13
13
 
14
14
  const expect = chai.expect;
15
15
 
16
- @suite class TestEncryptionEngineImpl {
16
+ @suite
17
+ class TestEncryptionEngineImpl {
17
18
  // Created with openssl rand -rand /dev/urandom -out key -base64 32
18
- protected get testkey () {
19
- const keyFilePath = path.resolve(__dirname, '../../test/fixtures/encryption/testkey');
19
+ protected get testkey() {
20
+ const keyFilePath = path.resolve(__dirname, "../../test/fixtures/encryption/testkey");
20
21
  const keyBuffer = fs.readFileSync(keyFilePath);
21
22
  return keyBuffer.toString().trim();
22
- };
23
+ }
23
24
 
24
25
  @test basicSymmetry() {
25
26
  const plaintext = "12345678901234567890";
26
- const key = new Buffer(this.testkey, 'base64');
27
+ const key = new Buffer(this.testkey, "base64");
27
28
 
28
29
  const cut = new EncryptionEngineImpl();
29
30
  const encryptedData = cut.encrypt(plaintext, key);
@@ -33,4 +34,4 @@ const expect = chai.expect;
33
34
  expect(decryptedPlaintext).equals(plaintext);
34
35
  }
35
36
  }
36
- export const t = new TestEncryptionEngineImpl();
37
+ export const t = new TestEncryptionEngineImpl();