@gitpod/gitpod-protocol 0.1.5-sje-installer-proxy-config-backup.0 → 0.1.5-sje-licensor-deprecation.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 (298) hide show
  1. package/data/gitpod-schema.json +35 -0
  2. package/lib/accounting-protocol.d.ts +1 -1
  3. package/lib/accounting-protocol.js +1 -1
  4. package/lib/admin-protocol.d.ts +11 -2
  5. package/lib/admin-protocol.d.ts.map +1 -1
  6. package/lib/admin-protocol.js +1 -1
  7. package/lib/admin-protocol.js.map +1 -1
  8. package/lib/analytics.d.ts +1 -1
  9. package/lib/analytics.js +1 -1
  10. package/lib/attribution.d.ts +5 -1
  11. package/lib/attribution.d.ts.map +1 -1
  12. package/lib/attribution.js +15 -1
  13. package/lib/attribution.js.map +1 -1
  14. package/lib/auth.d.ts +1 -1
  15. package/lib/auth.js +1 -1
  16. package/lib/billing-mode.d.ts +7 -2
  17. package/lib/billing-mode.d.ts.map +1 -1
  18. package/lib/billing-mode.js +9 -1
  19. package/lib/billing-mode.js.map +1 -1
  20. package/lib/blocked-repositories-protocol.d.ts +1 -1
  21. package/lib/blocked-repositories-protocol.js +1 -1
  22. package/lib/context-url.d.ts +1 -2
  23. package/lib/context-url.d.ts.map +1 -1
  24. package/lib/context-url.js +1 -3
  25. package/lib/context-url.js.map +1 -1
  26. package/lib/context-url.spec.d.ts +1 -3
  27. package/lib/context-url.spec.d.ts.map +1 -1
  28. package/lib/context-url.spec.js +1 -29
  29. package/lib/context-url.spec.js.map +1 -1
  30. package/lib/encryption/container-module.d.ts +1 -1
  31. package/lib/encryption/container-module.js +1 -1
  32. package/lib/encryption/encryption-engine.d.ts +1 -1
  33. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  34. package/lib/encryption/encryption-engine.js +4 -4
  35. package/lib/encryption/encryption-engine.js.map +1 -1
  36. package/lib/encryption/encryption-engine.spec.d.ts +1 -1
  37. package/lib/encryption/encryption-engine.spec.js +2 -2
  38. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  39. package/lib/encryption/encryption-service.d.ts +1 -1
  40. package/lib/encryption/encryption-service.js +1 -1
  41. package/lib/encryption/key-provider.d.ts +1 -1
  42. package/lib/encryption/key-provider.js +2 -2
  43. package/lib/encryption/key-provider.js.map +1 -1
  44. package/lib/env.d.ts +1 -1
  45. package/lib/env.d.ts.map +1 -1
  46. package/lib/env.js +1 -1
  47. package/lib/env.js.map +1 -1
  48. package/lib/experiments/always-default.d.ts +1 -1
  49. package/lib/experiments/configcat-server.d.ts +1 -1
  50. package/lib/experiments/configcat-server.d.ts.map +1 -1
  51. package/lib/experiments/configcat-server.js +2 -1
  52. package/lib/experiments/configcat-server.js.map +1 -1
  53. package/lib/experiments/configcat.d.ts +2 -3
  54. package/lib/experiments/configcat.d.ts.map +1 -1
  55. package/lib/experiments/configcat.js +5 -7
  56. package/lib/experiments/configcat.js.map +1 -1
  57. package/lib/experiments/types.d.ts +3 -4
  58. package/lib/experiments/types.d.ts.map +1 -1
  59. package/lib/experiments/types.js +1 -1
  60. package/lib/experiments/types.js.map +1 -1
  61. package/lib/gitpod-file-parser.d.ts +1 -1
  62. package/lib/gitpod-file-parser.js +1 -1
  63. package/lib/gitpod-file-parser.spec.d.ts +1 -1
  64. package/lib/gitpod-file-parser.spec.js +1 -1
  65. package/lib/gitpod-service.d.ts +23 -36
  66. package/lib/gitpod-service.d.ts.map +1 -1
  67. package/lib/gitpod-service.js +13 -1
  68. package/lib/gitpod-service.js.map +1 -1
  69. package/lib/headless-workspace-log.d.ts +1 -1
  70. package/lib/headless-workspace-log.js +1 -1
  71. package/lib/ide-frontend-service.d.ts +1 -1
  72. package/lib/ide-frontend-service.js +1 -1
  73. package/lib/ide-protocol.d.ts +15 -2
  74. package/lib/ide-protocol.d.ts.map +1 -1
  75. package/lib/ide-protocol.js +11 -1
  76. package/lib/ide-protocol.js.map +1 -1
  77. package/lib/index.d.ts +1 -2
  78. package/lib/index.d.ts.map +1 -1
  79. package/lib/index.js +1 -2
  80. package/lib/index.js.map +1 -1
  81. package/lib/installation-admin-protocol.d.ts +1 -1
  82. package/lib/installation-admin-protocol.js +1 -1
  83. package/lib/license-protocol.d.ts +1 -1
  84. package/lib/license-protocol.js +1 -1
  85. package/lib/messaging/browser/window-connection.d.ts +1 -1
  86. package/lib/messaging/browser/window-connection.js +1 -1
  87. package/lib/messaging/client-call-metrics.d.ts +3 -1
  88. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  89. package/lib/messaging/client-call-metrics.js +14 -1
  90. package/lib/messaging/client-call-metrics.js.map +1 -1
  91. package/lib/messaging/error.d.ts +4 -1
  92. package/lib/messaging/error.d.ts.map +1 -1
  93. package/lib/messaging/error.js +7 -1
  94. package/lib/messaging/error.js.map +1 -1
  95. package/lib/oss-allowlist.d.ts +1 -1
  96. package/lib/oss-allowlist.js +1 -1
  97. package/lib/payment-protocol.d.ts +1 -1
  98. package/lib/payment-protocol.js +1 -1
  99. package/lib/permission.d.ts +1 -1
  100. package/lib/permission.js +1 -1
  101. package/lib/plans.d.ts +1 -1
  102. package/lib/plans.js +3 -3
  103. package/lib/plans.js.map +1 -1
  104. package/lib/protocol.d.ts +42 -46
  105. package/lib/protocol.d.ts.map +1 -1
  106. package/lib/protocol.js +19 -22
  107. package/lib/protocol.js.map +1 -1
  108. package/lib/protocol.spec.d.ts +1 -1
  109. package/lib/protocol.spec.js +1 -1
  110. package/lib/snapshot-url.d.ts +1 -1
  111. package/lib/snapshot-url.js +1 -1
  112. package/lib/snapshot-url.spec.d.ts +1 -1
  113. package/lib/snapshot-url.spec.js +1 -1
  114. package/lib/team-subscription-protocol.d.ts +1 -1
  115. package/lib/team-subscription-protocol.js +1 -1
  116. package/lib/teams-projects-protocol.d.ts +6 -4
  117. package/lib/teams-projects-protocol.d.ts.map +1 -1
  118. package/lib/teams-projects-protocol.js +1 -1
  119. package/lib/teams-projects-protocol.js.map +1 -1
  120. package/lib/typings/globals.d.ts +1 -1
  121. package/lib/typings/globals.js +1 -1
  122. package/lib/usage.d.ts +14 -3
  123. package/lib/usage.d.ts.map +1 -1
  124. package/lib/usage.js +8 -2
  125. package/lib/usage.js.map +1 -1
  126. package/lib/util/analytics.d.ts +1 -1
  127. package/lib/util/analytics.js +1 -1
  128. package/lib/util/async-iterator.d.ts +1 -1
  129. package/lib/util/async-iterator.js +1 -1
  130. package/lib/util/cancelable.d.ts +1 -1
  131. package/lib/util/cancelable.js +1 -1
  132. package/lib/util/date-time.d.ts +1 -1
  133. package/lib/util/date-time.js +1 -1
  134. package/lib/util/debug-app.d.ts +1 -1
  135. package/lib/util/debug-app.js +1 -1
  136. package/lib/util/deep-partial.d.ts +1 -1
  137. package/lib/util/deep-partial.js +1 -1
  138. package/lib/util/deferred.d.ts +1 -1
  139. package/lib/util/deferred.js +1 -1
  140. package/lib/util/garbage-collected-cache.d.ts +1 -1
  141. package/lib/util/garbage-collected-cache.js +1 -1
  142. package/lib/util/generate-workspace-id.d.ts +1 -1
  143. package/lib/util/generate-workspace-id.js +1 -1
  144. package/lib/util/generate-workspace-id.spec.d.ts +1 -1
  145. package/lib/util/generate-workspace-id.spec.js +1 -1
  146. package/lib/util/gitpod-cookie.d.ts +1 -1
  147. package/lib/util/gitpod-cookie.js +1 -1
  148. package/lib/util/gitpod-host-url.d.ts +3 -1
  149. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  150. package/lib/util/gitpod-host-url.js +11 -4
  151. package/lib/util/gitpod-host-url.js.map +1 -1
  152. package/lib/util/gitpod-host-url.spec.d.ts +1 -1
  153. package/lib/util/gitpod-host-url.spec.js +1 -1
  154. package/lib/util/grpc.d.ts +2 -1
  155. package/lib/util/grpc.d.ts.map +1 -1
  156. package/lib/util/grpc.js +1 -1
  157. package/lib/util/grpc.js.map +1 -1
  158. package/lib/util/jaeger-client-types.d.ts +1 -1
  159. package/lib/util/jaeger-client-types.js +1 -1
  160. package/lib/util/logging.d.ts +1 -1
  161. package/lib/util/logging.js +1 -1
  162. package/lib/util/logging.spec.d.ts +1 -1
  163. package/lib/util/logging.spec.js +1 -1
  164. package/lib/util/make-link.d.ts +1 -1
  165. package/lib/util/make-link.js +1 -1
  166. package/lib/util/nice-grpc.d.ts +9 -0
  167. package/lib/util/nice-grpc.d.ts.map +1 -0
  168. package/lib/util/nice-grpc.js +121 -0
  169. package/lib/util/nice-grpc.js.map +1 -0
  170. package/lib/util/parse-workspace-id.d.ts +1 -1
  171. package/lib/util/parse-workspace-id.js +1 -1
  172. package/lib/util/parse-workspace-id.spec.d.ts +1 -1
  173. package/lib/util/parse-workspace-id.spec.js +1 -1
  174. package/lib/util/queue.d.ts +1 -1
  175. package/lib/util/queue.js +1 -1
  176. package/lib/util/queue.spec.d.ts +1 -1
  177. package/lib/util/queue.spec.js +1 -1
  178. package/lib/util/repeat.d.ts +1 -1
  179. package/lib/util/repeat.js +1 -1
  180. package/lib/util/semaphore.d.ts +1 -1
  181. package/lib/util/semaphore.js +1 -1
  182. package/lib/util/skip-if.d.ts +1 -1
  183. package/lib/util/skip-if.js +1 -1
  184. package/lib/util/timeutil.d.ts +1 -1
  185. package/lib/util/timeutil.js +1 -1
  186. package/lib/util/timeutil.spec.d.ts +2 -1
  187. package/lib/util/timeutil.spec.d.ts.map +1 -1
  188. package/lib/util/timeutil.spec.js +25 -1
  189. package/lib/util/timeutil.spec.js.map +1 -1
  190. package/lib/util/tracing.d.ts +1 -1
  191. package/lib/util/tracing.js +1 -1
  192. package/lib/util/tracing.spec.d.ts +1 -1
  193. package/lib/util/tracing.spec.js +1 -1
  194. package/lib/util/workspace-port-authentication.d.ts +1 -1
  195. package/lib/util/workspace-port-authentication.js +1 -1
  196. package/lib/webhook-event.d.ts +1 -1
  197. package/lib/webhook-event.js +1 -1
  198. package/lib/workspace-class.d.ts +2 -2
  199. package/lib/workspace-class.d.ts.map +1 -1
  200. package/lib/workspace-class.js +1 -1
  201. package/lib/workspace-cluster.d.ts +7 -6
  202. package/lib/workspace-cluster.d.ts.map +1 -1
  203. package/lib/workspace-cluster.js +1 -1
  204. package/lib/workspace-cluster.js.map +1 -1
  205. package/lib/workspace-instance.d.ts +2 -1
  206. package/lib/workspace-instance.d.ts.map +1 -1
  207. package/lib/workspace-instance.js +1 -1
  208. package/lib/wsready.d.ts +10 -4
  209. package/lib/wsready.d.ts.map +1 -1
  210. package/lib/wsready.js +3 -1
  211. package/lib/wsready.js.map +1 -1
  212. package/package.json +3 -1
  213. package/pkg-yarn.lock +3 -1
  214. package/provenance-bundle.jsonl +1 -1
  215. package/src/accounting-protocol.ts +1 -1
  216. package/src/admin-protocol.ts +15 -2
  217. package/src/analytics.ts +1 -1
  218. package/src/attribution.ts +16 -1
  219. package/src/auth.ts +1 -1
  220. package/src/billing-mode.ts +19 -2
  221. package/src/blocked-repositories-protocol.ts +1 -1
  222. package/src/context-url.spec.ts +1 -19
  223. package/src/context-url.ts +1 -3
  224. package/src/encryption/container-module.ts +1 -1
  225. package/src/encryption/encryption-engine.spec.ts +2 -2
  226. package/src/encryption/encryption-engine.ts +8 -4
  227. package/src/encryption/encryption-service.ts +1 -1
  228. package/src/encryption/key-provider.ts +2 -2
  229. package/src/env.ts +2 -3
  230. package/src/experiments/always-default.ts +1 -1
  231. package/src/experiments/configcat-server.ts +2 -1
  232. package/src/experiments/configcat.ts +4 -6
  233. package/src/experiments/types.ts +5 -6
  234. package/src/gitpod-file-parser.spec.ts +1 -1
  235. package/src/gitpod-file-parser.ts +1 -1
  236. package/src/gitpod-service.ts +38 -40
  237. package/src/headless-workspace-log.ts +1 -1
  238. package/src/ide-frontend-service.ts +1 -1
  239. package/src/ide-protocol.ts +20 -2
  240. package/src/index.ts +1 -2
  241. package/src/installation-admin-protocol.ts +1 -1
  242. package/src/license-protocol.ts +1 -1
  243. package/src/messaging/browser/window-connection.ts +1 -1
  244. package/src/messaging/client-call-metrics.ts +18 -1
  245. package/src/messaging/error.ts +10 -1
  246. package/src/oss-allowlist.ts +1 -1
  247. package/src/payment-protocol.ts +1 -1
  248. package/src/permission.ts +1 -1
  249. package/src/plans.ts +3 -3
  250. package/src/protocol.spec.ts +1 -1
  251. package/src/protocol.ts +47 -57
  252. package/src/snapshot-url.spec.ts +1 -1
  253. package/src/snapshot-url.ts +1 -1
  254. package/src/team-subscription-protocol.ts +1 -1
  255. package/src/teams-projects-protocol.ts +9 -5
  256. package/src/typings/globals.ts +1 -1
  257. package/src/usage.ts +16 -3
  258. package/src/util/analytics.ts +1 -1
  259. package/src/util/async-iterator.ts +1 -1
  260. package/src/util/cancelable.ts +1 -1
  261. package/src/util/date-time.ts +1 -1
  262. package/src/util/debug-app.ts +1 -1
  263. package/src/util/deep-partial.ts +1 -1
  264. package/src/util/deferred.ts +1 -1
  265. package/src/util/garbage-collected-cache.ts +1 -1
  266. package/src/util/generate-workspace-id.spec.ts +1 -1
  267. package/src/util/generate-workspace-id.ts +1 -1
  268. package/src/util/gitpod-cookie.ts +1 -1
  269. package/src/util/gitpod-host-url.spec.ts +1 -1
  270. package/src/util/gitpod-host-url.ts +12 -4
  271. package/src/util/grpc.ts +4 -1
  272. package/src/util/jaeger-client-types.ts +1 -1
  273. package/src/util/logging.spec.ts +1 -1
  274. package/src/util/logging.ts +1 -1
  275. package/src/util/make-link.ts +1 -1
  276. package/src/util/nice-grpc.ts +96 -0
  277. package/src/util/parse-workspace-id.spec.ts +1 -1
  278. package/src/util/parse-workspace-id.ts +1 -1
  279. package/src/util/queue.spec.ts +1 -1
  280. package/src/util/queue.ts +1 -1
  281. package/src/util/repeat.ts +1 -1
  282. package/src/util/semaphore.ts +1 -1
  283. package/src/util/skip-if.ts +1 -1
  284. package/src/util/timeutil.spec.ts +22 -1
  285. package/src/util/timeutil.ts +1 -1
  286. package/src/util/tracing.spec.ts +1 -1
  287. package/src/util/tracing.ts +1 -1
  288. package/src/util/workspace-port-authentication.ts +1 -1
  289. package/src/webhook-event.ts +1 -1
  290. package/src/workspace-class.ts +2 -2
  291. package/src/workspace-cluster.ts +12 -7
  292. package/src/workspace-instance.ts +7 -1
  293. package/src/wsready.ts +12 -6
  294. package/lib/email-protocol.d.ts +0 -49
  295. package/lib/email-protocol.d.ts.map +0 -1
  296. package/lib/email-protocol.js +0 -28
  297. package/lib/email-protocol.js.map +0 -1
  298. package/src/email-protocol.ts +0 -65
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  const URL = require("url").URL || window.URL;
@@ -16,10 +16,10 @@ const baseWorkspaceIDRegex =
16
16
  "(([a-f][0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})|([0-9a-z]{2,16}-[0-9a-z]{2,16}-[0-9a-z]{8,11}))";
17
17
 
18
18
  // this pattern matches v4 UUIDs as well as the new generated workspace ids (e.g. pink-panda-ns35kd21)
19
- const workspaceIDRegex = RegExp(`^${baseWorkspaceIDRegex}$`);
19
+ const workspaceIDRegex = RegExp(`^(?:debug-)?${baseWorkspaceIDRegex}$`);
20
20
 
21
21
  // this pattern matches URL prefixes of workspaces
22
- const workspaceUrlPrefixRegex = RegExp(`^([0-9]{4,6}-)?${baseWorkspaceIDRegex}\\.`);
22
+ const workspaceUrlPrefixRegex = RegExp(`^(([0-9]{4,6}|debug)-)?${baseWorkspaceIDRegex}\\.`);
23
23
 
24
24
  export class GitpodHostUrl {
25
25
  readonly url: URL;
@@ -93,6 +93,10 @@ export class GitpodHostUrl {
93
93
  return this.with((url) => ({ pathname: "/" }));
94
94
  }
95
95
 
96
+ asBilling(): GitpodHostUrl {
97
+ return this.with((url) => ({ pathname: "/billing" }));
98
+ }
99
+
96
100
  asLogin(): GitpodHostUrl {
97
101
  return this.with((url) => ({ pathname: "/login" }));
98
102
  }
@@ -139,6 +143,10 @@ export class GitpodHostUrl {
139
143
  return result;
140
144
  }
141
145
 
146
+ get debugWorkspace(): boolean {
147
+ return this.url.host.match(workspaceUrlPrefixRegex)?.[2] === "debug";
148
+ }
149
+
142
150
  get workspaceId(): string | undefined {
143
151
  const hostSegs = this.url.host.split(".");
144
152
  if (hostSegs.length > 1) {
@@ -146,7 +154,7 @@ export class GitpodHostUrl {
146
154
  if (matchResults) {
147
155
  // URL has a workspace prefix
148
156
  // port prefixes are excluded
149
- return matchResults[0];
157
+ return matchResults[1];
150
158
  }
151
159
  }
152
160
 
package/src/util/grpc.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import * as grpc from "@grpc/grpc-js";
@@ -36,6 +36,9 @@ export interface IClientCallMetrics {
36
36
  sent(labels: IGrpcCallMetricsLabels): void;
37
37
  received(labels: IGrpcCallMetricsLabels): void;
38
38
  handled(labels: IGrpcCallMetricsLabelsWithCode): void;
39
+ startHandleTimer(
40
+ labels: IGrpcCallMetricsLabels,
41
+ ): (labels?: Partial<Record<string, string | number>> | undefined) => number;
39
42
  }
40
43
 
41
44
  export function getGrpcMethodType(requestStream: boolean, responseStream: boolean): GrpcMethodType {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import { opentracing } from "jaeger-client";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import { suite, test } from "mocha-typescript";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  const inspect: (object: any) => string = require("util").inspect; // undefined in frontend
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  function isOpenNewTab(event: MouseEvent): boolean {
@@ -0,0 +1,96 @@
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
+ import { isAbortError } from "abort-controller-x";
8
+ import {
9
+ CallOptions,
10
+ ClientError,
11
+ ClientMiddleware,
12
+ ClientMiddlewareCall,
13
+ Status,
14
+ MethodDescriptor,
15
+ } from "nice-grpc-common";
16
+ import { GrpcMethodType, IClientCallMetrics } from "./grpc";
17
+
18
+ function getLabels(method: MethodDescriptor) {
19
+ const callType = method.requestStream
20
+ ? method.responseStream
21
+ ? "bidi_stream"
22
+ : "client_stream"
23
+ : method.responseStream
24
+ ? "server_stream"
25
+ : "unary";
26
+ const { path } = method;
27
+ const [serviceName, methodName] = path.split("/").slice(1);
28
+
29
+ return {
30
+ type: callType as GrpcMethodType,
31
+ service: serviceName,
32
+ method: methodName,
33
+ };
34
+ }
35
+
36
+ async function* incrementStreamMessagesCounter<T>(iterable: AsyncIterable<T>, callback: () => void): AsyncIterable<T> {
37
+ for await (const item of iterable) {
38
+ callback();
39
+ yield item;
40
+ }
41
+ }
42
+
43
+ export function prometheusClientMiddleware(metrics: IClientCallMetrics): ClientMiddleware {
44
+ return async function* prometheusClientMiddlewareGenerator<Request, Response>(
45
+ call: ClientMiddlewareCall<Request, Response>,
46
+ options: CallOptions,
47
+ ): AsyncGenerator<Response, Response | void, undefined> {
48
+ const labels = getLabels(call.method);
49
+
50
+ metrics.started(labels);
51
+
52
+ const stopTimer = metrics.startHandleTimer(labels);
53
+
54
+ let settled = false;
55
+ let status: Status = Status.OK;
56
+
57
+ try {
58
+ let request;
59
+
60
+ if (!call.requestStream) {
61
+ request = call.request;
62
+ } else {
63
+ request = incrementStreamMessagesCounter(call.request, metrics.sent.bind(metrics, labels));
64
+ }
65
+
66
+ if (!call.responseStream) {
67
+ const response = yield* call.next(request, options);
68
+ settled = true;
69
+ return response;
70
+ } else {
71
+ yield* incrementStreamMessagesCounter(
72
+ call.next(request, options),
73
+ metrics.received.bind(metrics, labels),
74
+ );
75
+ settled = true;
76
+ return;
77
+ }
78
+ } catch (err) {
79
+ settled = true;
80
+ if (err instanceof ClientError) {
81
+ status = err.code;
82
+ } else if (isAbortError(err)) {
83
+ status = Status.CANCELLED;
84
+ } else {
85
+ status = Status.UNKNOWN;
86
+ }
87
+ throw err;
88
+ } finally {
89
+ if (!settled) {
90
+ status = Status.CANCELLED;
91
+ }
92
+ stopTimer({ grpc_code: Status[status] });
93
+ metrics.handled({ ...labels, code: Status[status] });
94
+ }
95
+ };
96
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import * as chai from "chai";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  const REGEX_WORKSPACE_ID = /[0-9a-z]{2,16}-[0-9a-z]{2,16}-[0-9a-z]{8,11}/;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import { suite, test, slow, timeout } from "mocha-typescript";
package/src/util/queue.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import { Deferred } from "./deferred";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import { Disposable } from "..";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  export class Semaphore {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import * as chai from "chai";
@@ -45,4 +45,25 @@ export class TimeutilSpec {
45
45
  const later = oneMonthLater(from.toISOString(), day);
46
46
  expect(later, `expected ${later} to be equal ${expectation}`).to.be.equal(expectation.toISOString());
47
47
  }
48
+
49
+ @test
50
+ testDaysBefore2() {
51
+ const tests: { date: Date; daysEarlier: number; expectation: string }[] = [
52
+ {
53
+ date: new Date("2021-07-13T00:00:00.000Z"),
54
+ daysEarlier: 365,
55
+ expectation: "2020-07-13T00:00:00.000Z",
56
+ },
57
+ {
58
+ date: new Date("2019-02-01T00:00:00.000Z"),
59
+ daysEarlier: 365,
60
+ expectation: "2018-02-01T00:00:00.000Z",
61
+ },
62
+ ];
63
+
64
+ for (const t of tests) {
65
+ const actual = daysBefore(t.date.toISOString(), t.daysEarlier);
66
+ expect(actual).to.equal(t.expectation, `expected ${actual} to be equal ${t.expectation}`);
67
+ }
68
+ }
48
69
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import { suite, test } from "mocha-typescript";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import * as opentracing from "opentracing";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  export interface WebhookEvent {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  export interface SupportedWorkspaceClass {
@@ -10,5 +10,5 @@ export interface SupportedWorkspaceClass {
10
10
  displayName: string;
11
11
  description: string;
12
12
  powerups: number;
13
- isSelected: boolean;
13
+ isDefault: boolean;
14
14
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import * as fs from "fs";
@@ -15,6 +15,10 @@ export interface WorkspaceCluster {
15
15
  // Must be identical to the installationShortname of the cluster it represents!
16
16
  name: string;
17
17
 
18
+ // The name of the application cluster to which this cluster should be registered.
19
+ // The name can be at most 60 characters.
20
+ applicationCluster: string;
21
+
18
22
  // URL of the cluster's ws-manager API
19
23
  url: string;
20
24
 
@@ -86,20 +90,21 @@ export interface WorkspaceClusterDB {
86
90
  * Deletes the cluster identified by this name, if any.
87
91
  * @param name
88
92
  */
89
- deleteByName(name: string): Promise<void>;
93
+ deleteByName(name: string, applicationCluster: string): Promise<void>;
90
94
 
91
95
  /**
92
96
  * Finds a WorkspaceCluster with the given name. If there is none, `undefined` is returned.
93
97
  * @param name
94
98
  */
95
- findByName(name: string): Promise<WorkspaceCluster | undefined>;
99
+ findByName(name: string, applicationCluster: string): Promise<WorkspaceCluster | undefined>;
96
100
 
97
101
  /**
98
102
  * Lists all WorkspaceClusterWoTls for which the given predicate is true (does not return TLS for size/speed concerns)
99
103
  * @param predicate
100
104
  */
101
- findFiltered(predicate: DeepPartial<WorkspaceClusterFilter>): Promise<WorkspaceClusterWoTLS[]>;
102
- }
103
- export interface WorkspaceClusterFilter extends Pick<WorkspaceCluster, "state" | "govern" | "url"> {
104
- minScore: number;
105
+ findFiltered(predicate: WorkspaceClusterFilter): Promise<WorkspaceClusterWoTLS[]>;
105
106
  }
107
+
108
+ export type WorkspaceClusterFilter = Pick<WorkspaceCluster, "applicationCluster"> &
109
+ DeepPartial<Pick<WorkspaceCluster, "name" | "state" | "govern" | "url">> &
110
+ Partial<{ minScore: number }>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
7
  import { NamedWorkspaceFeatureFlag } from "./protocol";
@@ -243,10 +243,16 @@ export interface WorkspaceInstanceConfiguration {
243
243
  // ideImage is the ref of the IDE image this instance uses.
244
244
  ideImage: string;
245
245
 
246
+ // ideImageLayers are images needed for the ide to run,
247
+ // including ide-desktop, desktop-plugin and so on
248
+ ideImageLayers?: string[];
249
+
246
250
  // desktopIdeImage is the ref of the desktop IDE image this instance uses.
251
+ // @deprected: replaced with the ideImageLayers field
247
252
  desktopIdeImage?: string;
248
253
 
249
254
  // desktopIdePluginImage is the ref of the desktop IDE plugin image this instance uses.
255
+ // @deprected: replaced with the desktopIdePluginImage field
250
256
  desktopIdePluginImage?: string;
251
257
 
252
258
  // supervisorImage is the ref of the supervisor image this instance uses.
package/src/wsready.ts CHANGED
@@ -1,18 +1,24 @@
1
1
  /**
2
2
  * Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
4
+ * See License.AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- // generated using github.com/32leaves/bel on 2022-07-21 07:41:48.081573085 +0000 UTC m=+0.009109470
7
+ // generated using github.com/32leaves/bel on 2022-11-25 13:39:08.995865257 +0000 UTC m=+0.015035221
8
8
  // DO NOT MODIFY
9
9
 
10
- export interface WorkspaceReadyMessage {
11
- source: WorkspaceInitSource;
12
- }
13
-
14
10
  export enum WorkspaceInitSource {
15
11
  WorkspaceInitFromBackup = "from-backup",
16
12
  WorkspaceInitFromPrebuild = "from-prebuild",
17
13
  WorkspaceInitFromOther = "from-other",
18
14
  }
15
+ export interface WorkspaceReadyMessage {
16
+ source: WorkspaceInitSource;
17
+ metrics: InitializerMetric[];
18
+ }
19
+
20
+ export interface InitializerMetric {
21
+ type: string;
22
+ duration: number;
23
+ size: number;
24
+ }
@@ -1,49 +0,0 @@
1
- /**
2
- * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
- * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
5
- */
6
- export declare type EMailState = "scheduledInternal" | "scheduledSendgrid";
7
- export interface EMailStatus {
8
- /** The time the email entry was inserted into the DB */
9
- scheduledInternalTime: string;
10
- /** The time the email state transitioned to "scheduledSendgrid" */
11
- scheduledSendgridTime?: string;
12
- /** In case of any errors during sending with Sendgrid it gets noted here */
13
- error?: string;
14
- }
15
- export declare namespace EMailStatus {
16
- function getState(status: EMailStatus): EMailState;
17
- }
18
- export interface EmailAddress {
19
- name?: string;
20
- email: string;
21
- }
22
- export interface EMailParameters {
23
- /** undefined means default from template */
24
- subject?: string;
25
- /** The sender address */
26
- senderAddress: string | EmailAddress;
27
- /** The replyTo address */
28
- replyToAddress?: string | EmailAddress;
29
- /** The SendGrid template id */
30
- templateId: string;
31
- /** The parameters for the SendGrid template */
32
- templateParams: {};
33
- }
34
- export declare type EMail = {
35
- /** The unique id of this email (uuid/v4 for now) */
36
- uid: string;
37
- /** The id of the user this email was sent to */
38
- userId: string;
39
- /** The address this email was sent to */
40
- recipientAddress: string;
41
- /** Which campaign scheduled this email */
42
- campaignId: string;
43
- /** The parameters this email was sent with (template id, template params, etc) */
44
- params: EMailParameters;
45
- } & EMailStatus;
46
- export declare namespace EMail {
47
- const create: (ts: Omit<EMail, "uid">) => EMail;
48
- }
49
- //# sourceMappingURL=email-protocol.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email-protocol.d.ts","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,oBAAY,UAAU,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAEnE,MAAM,WAAW,WAAW;IACxB,wDAAwD;IACxD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mEAAmE;IACnE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,yBAAiB,WAAW,CAAC;IACzB,SAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAKxD;CACJ;AAED,MAAM,WAAW,YAAY;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC5B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,aAAa,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,0BAA0B;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACvC,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,cAAc,EAAE,EAAE,CAAC;CACtB;AAED,oBAAY,KAAK,GAAG;IAChB,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,MAAM,EAAE,eAAe,CAAC;CAC3B,GAAG,WAAW,CAAC;AAEhB,yBAAiB,KAAK,CAAC;IACZ,MAAM,MAAM,OAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,KAAG,KAI/C,CAAC;CACL"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
- * Licensed under the GNU Affero General Public License (AGPL).
5
- * See License-AGPL.txt in the project root for license information.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.EMail = exports.EMailStatus = void 0;
9
- const uuid_1 = require("uuid");
10
- var EMailStatus;
11
- (function (EMailStatus) {
12
- function getState(status) {
13
- if (status.scheduledSendgridTime) {
14
- return "scheduledSendgrid";
15
- }
16
- return "scheduledInternal";
17
- }
18
- EMailStatus.getState = getState;
19
- })(EMailStatus = exports.EMailStatus || (exports.EMailStatus = {}));
20
- var EMail;
21
- (function (EMail) {
22
- EMail.create = (ts) => {
23
- const withId = ts;
24
- withId.uid = (0, uuid_1.v4)();
25
- return withId;
26
- };
27
- })(EMail = exports.EMail || (exports.EMail = {}));
28
- //# sourceMappingURL=email-protocol.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email-protocol.js","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+BAAoC;AAYpC,IAAiB,WAAW,CAO3B;AAPD,WAAiB,WAAW;IACxB,SAAgB,QAAQ,CAAC,MAAmB;QACxC,IAAI,MAAM,CAAC,qBAAqB,EAAE;YAC9B,OAAO,mBAAmB,CAAC;SAC9B;QACD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IALe,oBAAQ,WAKvB,CAAA;AACL,CAAC,EAPgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAO3B;AAiCD,IAAiB,KAAK,CAMrB;AAND,WAAiB,KAAK;IACL,YAAM,GAAG,CAAC,EAAsB,EAAS,EAAE;QACpD,MAAM,MAAM,GAAG,EAAW,CAAC;QAC3B,MAAM,CAAC,GAAG,GAAG,IAAA,SAAM,GAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC,EANgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAMrB"}
@@ -1,65 +0,0 @@
1
- /**
2
- * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
- * Licensed under the GNU Affero General Public License (AGPL).
4
- * See License-AGPL.txt in the project root for license information.
5
- */
6
-
7
- import { v4 as uuidv4 } from "uuid";
8
-
9
- export type EMailState = "scheduledInternal" | "scheduledSendgrid";
10
-
11
- export interface EMailStatus {
12
- /** The time the email entry was inserted into the DB */
13
- scheduledInternalTime: string;
14
- /** The time the email state transitioned to "scheduledSendgrid" */
15
- scheduledSendgridTime?: string;
16
- /** In case of any errors during sending with Sendgrid it gets noted here */
17
- error?: string;
18
- }
19
- export namespace EMailStatus {
20
- export function getState(status: EMailStatus): EMailState {
21
- if (status.scheduledSendgridTime) {
22
- return "scheduledSendgrid";
23
- }
24
- return "scheduledInternal";
25
- }
26
- }
27
-
28
- export interface EmailAddress {
29
- name?: string;
30
- email: string;
31
- }
32
-
33
- export interface EMailParameters {
34
- /** undefined means default from template */
35
- subject?: string;
36
- /** The sender address */
37
- senderAddress: string | EmailAddress;
38
- /** The replyTo address */
39
- replyToAddress?: string | EmailAddress;
40
- /** The SendGrid template id */
41
- templateId: string;
42
- /** The parameters for the SendGrid template */
43
- templateParams: {};
44
- }
45
-
46
- export type EMail = {
47
- /** The unique id of this email (uuid/v4 for now) */
48
- uid: string;
49
- /** The id of the user this email was sent to */
50
- userId: string;
51
- /** The address this email was sent to */
52
- recipientAddress: string;
53
- /** Which campaign scheduled this email */
54
- campaignId: string;
55
- /** The parameters this email was sent with (template id, template params, etc) */
56
- params: EMailParameters;
57
- } & EMailStatus;
58
-
59
- export namespace EMail {
60
- export const create = (ts: Omit<EMail, "uid">): EMail => {
61
- const withId = ts as EMail;
62
- withId.uid = uuidv4();
63
- return withId;
64
- };
65
- }