@gitpod/gitpod-protocol 0.1.5-to-new-image.2 → 0.1.5-to-monitor-delete.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/data/gitpod-schema.json +124 -5
  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 +7 -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 +24 -0
  12. package/lib/attribution.d.ts.map +1 -0
  13. package/lib/attribution.js +54 -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 +45 -0
  17. package/lib/billing-mode.d.ts.map +1 -0
  18. package/lib/billing-mode.js +44 -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/encryption/container-module.d.ts.map +1 -1
  31. package/lib/encryption/container-module.js +1 -1
  32. package/lib/encryption/container-module.js.map +1 -1
  33. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  34. package/lib/encryption/encryption-engine.js +9 -9
  35. package/lib/encryption/encryption-engine.js.map +1 -1
  36. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  37. package/lib/encryption/encryption-engine.spec.js +2 -3
  38. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  39. package/lib/encryption/encryption-service.d.ts.map +1 -1
  40. package/lib/encryption/encryption-service.js +1 -1
  41. package/lib/encryption/encryption-service.js.map +1 -1
  42. package/lib/encryption/key-provider.d.ts.map +1 -1
  43. package/lib/encryption/key-provider.js +7 -9
  44. package/lib/encryption/key-provider.js.map +1 -1
  45. package/lib/env.d.ts +0 -5
  46. package/lib/env.d.ts.map +1 -1
  47. package/lib/env.js +1 -20
  48. package/lib/env.js.map +1 -1
  49. package/lib/experiments/always-default.d.ts +8 -0
  50. package/lib/experiments/always-default.d.ts.map +1 -0
  51. package/lib/experiments/always-default.js +20 -0
  52. package/lib/experiments/always-default.js.map +1 -0
  53. package/lib/experiments/configcat-server.d.ts +10 -0
  54. package/lib/experiments/configcat-server.d.ts.map +1 -0
  55. package/lib/experiments/configcat-server.js +36 -0
  56. package/lib/experiments/configcat-server.js.map +1 -0
  57. package/lib/experiments/configcat.d.ts +21 -0
  58. package/lib/experiments/configcat.d.ts.map +1 -0
  59. package/lib/experiments/configcat.js +51 -0
  60. package/lib/experiments/configcat.js.map +1 -0
  61. package/lib/experiments/types.d.ts +22 -0
  62. package/lib/experiments/types.d.ts.map +1 -0
  63. package/lib/experiments/types.js +10 -0
  64. package/lib/experiments/types.js.map +1 -0
  65. package/lib/gitpod-file-parser.d.ts.map +1 -1
  66. package/lib/gitpod-file-parser.js +6 -6
  67. package/lib/gitpod-file-parser.js.map +1 -1
  68. package/lib/gitpod-file-parser.spec.js +42 -39
  69. package/lib/gitpod-file-parser.spec.js.map +1 -1
  70. package/lib/gitpod-service.d.ts +65 -46
  71. package/lib/gitpod-service.d.ts.map +1 -1
  72. package/lib/gitpod-service.js +52 -33
  73. package/lib/gitpod-service.js.map +1 -1
  74. package/lib/headless-workspace-log.d.ts +1 -0
  75. package/lib/headless-workspace-log.d.ts.map +1 -1
  76. package/lib/headless-workspace-log.js +2 -1
  77. package/lib/headless-workspace-log.js.map +1 -1
  78. package/lib/ide-frontend-service.d.ts +1 -1
  79. package/lib/ide-protocol.d.ts +14 -6
  80. package/lib/ide-protocol.d.ts.map +1 -1
  81. package/lib/index.d.ts +16 -16
  82. package/lib/index.d.ts.map +1 -1
  83. package/lib/index.js +1 -1
  84. package/lib/index.js.map +1 -1
  85. package/lib/installation-admin-protocol.d.ts +3 -0
  86. package/lib/installation-admin-protocol.d.ts.map +1 -1
  87. package/lib/installation-admin-protocol.js +3 -2
  88. package/lib/installation-admin-protocol.js.map +1 -1
  89. package/lib/license-protocol.d.ts +7 -0
  90. package/lib/license-protocol.d.ts.map +1 -1
  91. package/lib/license-protocol.js.map +1 -1
  92. package/lib/messaging/browser/connection.d.ts +1 -1
  93. package/lib/messaging/browser/connection.d.ts.map +1 -1
  94. package/lib/messaging/browser/connection.js +19 -19
  95. package/lib/messaging/browser/connection.js.map +1 -1
  96. package/lib/messaging/browser/window-connection.d.ts +4 -4
  97. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  98. package/lib/messaging/browser/window-connection.js +9 -6
  99. package/lib/messaging/browser/window-connection.js.map +1 -1
  100. package/lib/messaging/client-call-metrics.d.ts +2 -18
  101. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  102. package/lib/messaging/client-call-metrics.js +21 -22
  103. package/lib/messaging/client-call-metrics.js.map +1 -1
  104. package/lib/messaging/error.d.ts +7 -1
  105. package/lib/messaging/error.d.ts.map +1 -1
  106. package/lib/messaging/error.js +15 -3
  107. package/lib/messaging/error.js.map +1 -1
  108. package/lib/messaging/handler.d.ts.map +1 -1
  109. package/lib/messaging/handler.js +1 -1
  110. package/lib/messaging/node/connection.js +8 -8
  111. package/lib/messaging/node/connection.js.map +1 -1
  112. package/lib/messaging/proxy-factory.d.ts +1 -1
  113. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  114. package/lib/messaging/proxy-factory.js +7 -9
  115. package/lib/messaging/proxy-factory.js.map +1 -1
  116. package/lib/payment-protocol.d.ts.map +1 -1
  117. package/lib/payment-protocol.js +1 -1
  118. package/lib/payment-protocol.js.map +1 -1
  119. package/lib/permission.d.ts +2 -2
  120. package/lib/permission.d.ts.map +1 -1
  121. package/lib/permission.js +12 -23
  122. package/lib/permission.js.map +1 -1
  123. package/lib/plans.d.ts +4 -3
  124. package/lib/plans.d.ts.map +1 -1
  125. package/lib/plans.js +210 -171
  126. package/lib/plans.js.map +1 -1
  127. package/lib/protocol.d.ts +181 -57
  128. package/lib/protocol.d.ts.map +1 -1
  129. package/lib/protocol.js +285 -105
  130. package/lib/protocol.js.map +1 -1
  131. package/{src/theia-plugins.ts → lib/protocol.spec.d.ts} +2 -6
  132. package/lib/protocol.spec.d.ts.map +1 -0
  133. package/lib/protocol.spec.js +127 -0
  134. package/lib/protocol.spec.js.map +1 -0
  135. package/lib/snapshot-url.spec.js.map +1 -1
  136. package/lib/team-subscription-protocol.d.ts +22 -3
  137. package/lib/team-subscription-protocol.d.ts.map +1 -1
  138. package/lib/team-subscription-protocol.js +20 -5
  139. package/lib/team-subscription-protocol.js.map +1 -1
  140. package/lib/teams-projects-protocol.d.ts +26 -5
  141. package/lib/teams-projects-protocol.d.ts.map +1 -1
  142. package/lib/teams-projects-protocol.js +1 -1
  143. package/lib/teams-projects-protocol.js.map +1 -1
  144. package/lib/typings/globals.d.ts +2 -2
  145. package/lib/typings/globals.d.ts.map +1 -1
  146. package/lib/usage.d.ts +61 -0
  147. package/lib/usage.d.ts.map +1 -0
  148. package/lib/usage.js +14 -0
  149. package/lib/usage.js.map +1 -0
  150. package/lib/util/analytics.d.ts.map +1 -1
  151. package/lib/util/analytics.js +12 -3
  152. package/lib/util/analytics.js.map +1 -1
  153. package/lib/util/async-iterator.d.ts.map +1 -1
  154. package/lib/util/async-iterator.js +3 -3
  155. package/lib/util/async-iterator.js.map +1 -1
  156. package/lib/util/cancelable.js.map +1 -1
  157. package/lib/util/date-time.js +6 -6
  158. package/lib/util/date-time.js.map +1 -1
  159. package/lib/util/debug-app.d.ts +25 -0
  160. package/lib/util/debug-app.d.ts.map +1 -0
  161. package/lib/util/debug-app.js +100 -0
  162. package/lib/util/debug-app.js.map +1 -0
  163. package/lib/util/deferred.js.map +1 -1
  164. package/lib/util/disposable.d.ts.map +1 -1
  165. package/lib/util/disposable.js +2 -2
  166. package/lib/util/disposable.js.map +1 -1
  167. package/lib/util/event.d.ts.map +1 -1
  168. package/lib/util/event.js +5 -3
  169. package/lib/util/event.js.map +1 -1
  170. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  171. package/lib/util/garbage-collected-cache.js +6 -1
  172. package/lib/util/garbage-collected-cache.js.map +1 -1
  173. package/lib/util/generate-workspace-id.d.ts +5 -0
  174. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  175. package/lib/util/generate-workspace-id.js +446 -442
  176. package/lib/util/generate-workspace-id.js.map +1 -1
  177. package/lib/util/generate-workspace-id.spec.js +18 -7
  178. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  179. package/lib/util/gitpod-cookie.d.ts +1 -1
  180. package/lib/util/gitpod-cookie.d.ts.map +1 -1
  181. package/lib/util/gitpod-cookie.js +0 -3
  182. package/lib/util/gitpod-cookie.js.map +1 -1
  183. package/lib/util/gitpod-host-url.d.ts +3 -0
  184. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  185. package/lib/util/gitpod-host-url.js +49 -29
  186. package/lib/util/gitpod-host-url.js.map +1 -1
  187. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  188. package/lib/util/gitpod-host-url.spec.js +15 -5
  189. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  190. package/lib/util/grpc.d.ts +19 -0
  191. package/lib/util/grpc.d.ts.map +1 -1
  192. package/lib/util/grpc.js +73 -1
  193. package/lib/util/grpc.js.map +1 -1
  194. package/lib/util/jaeger-client-types.d.ts.map +1 -1
  195. package/lib/util/logging.d.ts +1 -1
  196. package/lib/util/logging.d.ts.map +1 -1
  197. package/lib/util/logging.js +31 -25
  198. package/lib/util/logging.js.map +1 -1
  199. package/lib/util/logging.spec.d.ts +7 -0
  200. package/lib/util/logging.spec.d.ts.map +1 -0
  201. package/lib/util/logging.spec.js +52 -0
  202. package/lib/util/logging.spec.js.map +1 -0
  203. package/lib/util/make-link.js +5 -5
  204. package/lib/util/make-link.js.map +1 -1
  205. package/lib/util/nice-grpc.d.ts +9 -0
  206. package/lib/util/nice-grpc.d.ts.map +1 -0
  207. package/lib/util/nice-grpc.js +119 -0
  208. package/lib/util/nice-grpc.js.map +1 -0
  209. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  210. package/lib/util/parse-workspace-id.js +1 -2
  211. package/lib/util/parse-workspace-id.js.map +1 -1
  212. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  213. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  214. package/lib/util/queue.spec.js +9 -6
  215. package/lib/util/queue.spec.js.map +1 -1
  216. package/lib/util/semaphore.d.ts.map +1 -1
  217. package/lib/util/semaphore.js.map +1 -1
  218. package/lib/util/skip-if.d.ts.map +1 -1
  219. package/lib/util/skip-if.js.map +1 -1
  220. package/lib/util/timeutil.d.ts +2 -0
  221. package/lib/util/timeutil.d.ts.map +1 -1
  222. package/lib/util/timeutil.js +15 -3
  223. package/lib/util/timeutil.js.map +1 -1
  224. package/lib/util/timeutil.spec.d.ts +2 -0
  225. package/lib/util/timeutil.spec.d.ts.map +1 -1
  226. package/lib/util/timeutil.spec.js +34 -0
  227. package/lib/util/timeutil.spec.js.map +1 -1
  228. package/lib/util/tracing.d.ts +6 -6
  229. package/lib/util/tracing.d.ts.map +1 -1
  230. package/lib/util/tracing.js +14 -16
  231. package/lib/util/tracing.js.map +1 -1
  232. package/lib/util/tracing.spec.js +3 -3
  233. package/lib/util/tracing.spec.js.map +1 -1
  234. package/lib/util/workspace-port-authentication.d.ts +7 -7
  235. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  236. package/lib/util/workspace-port-authentication.js +8 -11
  237. package/lib/util/workspace-port-authentication.js.map +1 -1
  238. package/lib/webhook-event.d.ts +44 -0
  239. package/lib/webhook-event.d.ts.map +1 -0
  240. package/lib/{theia-plugins.js → webhook-event.js} +2 -2
  241. package/lib/webhook-event.js.map +1 -0
  242. package/lib/workspace-class.d.ts +14 -0
  243. package/lib/workspace-class.d.ts.map +1 -0
  244. package/lib/workspace-class.js +8 -0
  245. package/lib/workspace-class.js.map +1 -0
  246. package/lib/workspace-cluster.d.ts +12 -13
  247. package/lib/workspace-cluster.d.ts.map +1 -1
  248. package/lib/workspace-cluster.js +2 -4
  249. package/lib/workspace-cluster.js.map +1 -1
  250. package/lib/workspace-instance.d.ts +20 -3
  251. package/lib/workspace-instance.d.ts.map +1 -1
  252. package/lib/wsready.d.ts +1 -1
  253. package/lib/wsready.d.ts.map +1 -1
  254. package/lib/wsready.js +2 -2
  255. package/package.json +14 -6
  256. package/pkg-yarn.lock +10 -5
  257. package/provenance-bundle.jsonl +3 -1
  258. package/src/accounting-protocol.ts +66 -51
  259. package/src/admin-protocol.ts +32 -20
  260. package/src/analytics.ts +21 -21
  261. package/src/attribution.ts +63 -0
  262. package/src/auth.ts +2 -2
  263. package/src/billing-mode.ts +84 -0
  264. package/src/blocked-repositories-protocol.ts +13 -0
  265. package/src/context-url.spec.ts +25 -11
  266. package/src/context-url.ts +80 -78
  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 +20 -16
  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 +56 -0
  276. package/src/experiments/types.ts +34 -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 +208 -132
  280. package/src/headless-workspace-log.ts +6 -4
  281. package/src/ide-frontend-service.ts +2 -2
  282. package/src/ide-protocol.ts +18 -8
  283. package/src/index.ts +16 -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 +23 -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 +545 -261
  299. package/src/snapshot-url.spec.ts +9 -7
  300. package/src/team-subscription-protocol.ts +59 -22
  301. package/src/teams-projects-protocol.ts +36 -11
  302. package/src/typings/globals.ts +4 -4
  303. package/src/usage.ts +71 -0
  304. package/src/util/analytics.ts +46 -24
  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/nice-grpc.ts +93 -0
  324. package/src/util/parse-workspace-id.spec.ts +17 -8
  325. package/src/util/parse-workspace-id.ts +5 -6
  326. package/src/util/queue.spec.ts +27 -25
  327. package/src/util/repeat.ts +1 -1
  328. package/src/util/semaphore.ts +4 -6
  329. package/src/util/skip-if.ts +9 -6
  330. package/src/util/timeutil.spec.ts +40 -14
  331. package/src/util/timeutil.ts +27 -11
  332. package/src/util/tracing.spec.ts +28 -23
  333. package/src/util/tracing.ts +54 -51
  334. package/src/util/workspace-port-authentication.ts +10 -13
  335. package/src/webhook-event.ts +55 -0
  336. package/src/workspace-class.ts +14 -0
  337. package/src/workspace-cluster.ts +24 -18
  338. package/src/workspace-instance.ts +60 -24
  339. package/src/wsready.ts +3 -3
  340. package/data/builtin-theia-plugins.json +0 -372
  341. package/lib/email-protocol.d.ts +0 -49
  342. package/lib/email-protocol.d.ts.map +0 -1
  343. package/lib/email-protocol.js +0 -28
  344. package/lib/email-protocol.js.map +0 -1
  345. package/lib/theia-plugins.d.ts +0 -11
  346. package/lib/theia-plugins.d.ts.map +0 -1
  347. package/lib/theia-plugins.js.map +0 -1
  348. package/src/email-protocol.ts +0 -66
@@ -4,94 +4,74 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- import { injectable } from 'inversify';
8
- import * as prometheusClient from 'prom-client';
9
-
10
- type GrpcMethodType = 'unary' | 'client_stream' | 'server_stream' | 'bidi_stream';
11
- export interface IGrpcCallMetricsLabels {
12
- service: string,
13
- method: string,
14
- type: GrpcMethodType,
15
- }
16
-
17
- export interface IGrpcCallMetricsLabelsWithCode extends IGrpcCallMetricsLabels {
18
- code: string
19
- }
20
-
21
- export const IClientCallMetrics = Symbol("IClientCallMetrics");
22
-
23
- export interface IClientCallMetrics {
24
- started(labels: IGrpcCallMetricsLabels) : void;
25
- sent(labels: IGrpcCallMetricsLabels) : void;
26
- received(labels: IGrpcCallMetricsLabels) : void;
27
- handled(labels: IGrpcCallMetricsLabelsWithCode) : void;
28
- }
7
+ import { injectable } from "inversify";
8
+ import * as prometheusClient from "prom-client";
9
+ import { IClientCallMetrics, IGrpcCallMetricsLabels, IGrpcCallMetricsLabelsWithCode } from "../util/grpc";
29
10
 
30
11
  @injectable()
31
12
  export class PrometheusClientCallMetrics implements IClientCallMetrics {
13
+ readonly startedCounter: prometheusClient.Counter<string>;
14
+ readonly sentCounter: prometheusClient.Counter<string>;
15
+ readonly receivedCounter: prometheusClient.Counter<string>;
16
+ readonly handledCounter: prometheusClient.Counter<string>;
32
17
 
33
- readonly startedCounter: prometheusClient.Counter<string>;
34
- readonly sentCounter: prometheusClient.Counter<string>;
35
- readonly receivedCounter: prometheusClient.Counter<string>;
36
- readonly handledCounter: prometheusClient.Counter<string>;
37
-
38
- constructor() {
39
- this.startedCounter = new prometheusClient.Counter({
40
- name: 'grpc_client_started_total',
41
- help: 'Total number of RPCs started on the client.',
42
- labelNames: ['grpc_service', 'grpc_method', 'grpc_type'],
43
- registers: [prometheusClient.register]
44
- });
45
- this.sentCounter = new prometheusClient.Counter({
46
- name: 'grpc_client_msg_sent_total',
47
- help: ' Total number of gRPC stream messages sent by the client.',
48
- labelNames: ['grpc_service', 'grpc_method', 'grpc_type'],
49
- registers: [prometheusClient.register]
50
- });
51
- this.receivedCounter = new prometheusClient.Counter({
52
- name: 'grpc_client_msg_received_total',
53
- help: 'Total number of RPC stream messages received by the client.',
54
- labelNames: ['grpc_service', 'grpc_method', 'grpc_type'],
55
- registers: [prometheusClient.register]
56
- });
57
- this.handledCounter = new prometheusClient.Counter({
58
- name: 'grpc_client_handled_total',
59
- help: 'Total number of RPCs completed by the client, regardless of success or failure.',
60
- labelNames: ['grpc_service', 'grpc_method', 'grpc_type', 'grpc_code'],
61
- registers: [prometheusClient.register]
62
- });
63
- }
18
+ constructor() {
19
+ this.startedCounter = new prometheusClient.Counter({
20
+ name: "grpc_client_started_total",
21
+ help: "Total number of RPCs started on the client.",
22
+ labelNames: ["grpc_service", "grpc_method", "grpc_type"],
23
+ registers: [prometheusClient.register],
24
+ });
25
+ this.sentCounter = new prometheusClient.Counter({
26
+ name: "grpc_client_msg_sent_total",
27
+ help: " Total number of gRPC stream messages sent by the client.",
28
+ labelNames: ["grpc_service", "grpc_method", "grpc_type"],
29
+ registers: [prometheusClient.register],
30
+ });
31
+ this.receivedCounter = new prometheusClient.Counter({
32
+ name: "grpc_client_msg_received_total",
33
+ help: "Total number of RPC stream messages received by the client.",
34
+ labelNames: ["grpc_service", "grpc_method", "grpc_type"],
35
+ registers: [prometheusClient.register],
36
+ });
37
+ this.handledCounter = new prometheusClient.Counter({
38
+ name: "grpc_client_handled_total",
39
+ help: "Total number of RPCs completed by the client, regardless of success or failure.",
40
+ labelNames: ["grpc_service", "grpc_method", "grpc_type", "grpc_code"],
41
+ registers: [prometheusClient.register],
42
+ });
43
+ }
64
44
 
65
- started(labels: IGrpcCallMetricsLabels): void {
66
- this.startedCounter.inc({
67
- grpc_service: labels.service,
68
- grpc_method: labels.method,
69
- grpc_type: labels.type
70
- });
71
- }
45
+ started(labels: IGrpcCallMetricsLabels): void {
46
+ this.startedCounter.inc({
47
+ grpc_service: labels.service,
48
+ grpc_method: labels.method,
49
+ grpc_type: labels.type,
50
+ });
51
+ }
72
52
 
73
- sent(labels: IGrpcCallMetricsLabels): void {
74
- this.sentCounter.inc({
75
- grpc_service: labels.service,
76
- grpc_method: labels.method,
77
- grpc_type: labels.type
78
- });
79
- }
53
+ sent(labels: IGrpcCallMetricsLabels): void {
54
+ this.sentCounter.inc({
55
+ grpc_service: labels.service,
56
+ grpc_method: labels.method,
57
+ grpc_type: labels.type,
58
+ });
59
+ }
80
60
 
81
- received(labels: IGrpcCallMetricsLabels): void {
82
- this.receivedCounter.inc({
83
- grpc_service: labels.service,
84
- grpc_method: labels.method,
85
- grpc_type: labels.type
86
- });
87
- }
61
+ received(labels: IGrpcCallMetricsLabels): void {
62
+ this.receivedCounter.inc({
63
+ grpc_service: labels.service,
64
+ grpc_method: labels.method,
65
+ grpc_type: labels.type,
66
+ });
67
+ }
88
68
 
89
- handled(labels: IGrpcCallMetricsLabelsWithCode): void {
90
- this.handledCounter.inc({
91
- grpc_service: labels.service,
92
- grpc_method: labels.method,
93
- grpc_type: labels.type,
94
- grpc_code: labels.code
95
- });
96
- }
69
+ handled(labels: IGrpcCallMetricsLabelsWithCode): void {
70
+ this.handledCounter.inc({
71
+ grpc_service: labels.service,
72
+ grpc_method: labels.method,
73
+ grpc_type: labels.type,
74
+ grpc_code: labels.code,
75
+ });
76
+ }
97
77
  }
@@ -4,9 +4,10 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
-
8
-
9
7
  export namespace ErrorCodes {
8
+ // 400 Unauthorized
9
+ export const BAD_REQUEST = 400;
10
+
10
11
  // 401 Unauthorized
11
12
  export const NOT_AUTHENTICATED = 401;
12
13
 
@@ -25,21 +26,30 @@ export namespace ErrorCodes {
25
26
  // 410 No User
26
27
  export const SETUP_REQUIRED = 410;
27
28
 
29
+ // 411 No User
30
+ export const NEEDS_VERIFICATION = 411;
31
+
28
32
  // 429 Too Many Requests
29
33
  export const TOO_MANY_REQUESTS = 429;
30
34
 
31
35
  // 430 Repository not whitelisted (custom status code)
32
36
  export const REPOSITORY_NOT_WHITELISTED = 430;
33
37
 
38
+ // 450 Payment error
39
+ export const PAYMENT_ERROR = 450;
40
+
41
+ // 451 Out of credits
42
+ export const PAYMENT_SPENDING_LIMIT_REACHED = 451;
43
+
44
+ // 455 Invalid cost center (custom status code)
45
+ export const INVALID_COST_CENTER = 455;
46
+
34
47
  // 460 Context Parse Error (custom status code)
35
48
  export const CONTEXT_PARSE_ERROR = 460;
36
49
 
37
- // 461 Invalid gitpod yml
50
+ // 461 Invalid gitpod yml (custom status code)
38
51
  export const INVALID_GITPOD_YML = 461;
39
52
 
40
- // 450 Payment error
41
- export const PAYMENT_ERROR = 450;
42
-
43
53
  // 470 User Blocked (custom status code)
44
54
  export const USER_BLOCKED = 470;
45
55
 
@@ -61,6 +71,9 @@ export namespace ErrorCodes {
61
71
  // 490 Too Many Running Workspace
62
72
  export const TOO_MANY_RUNNING_WORKSPACES = 490;
63
73
 
74
+ // 500 Internal Server Error
75
+ export const INTERNAL_SERVER_ERROR = 500;
76
+
64
77
  // 501 EE Feature
65
78
  export const EE_FEATURE = 501;
66
79
 
@@ -81,4 +94,7 @@ export namespace ErrorCodes {
81
94
 
82
95
  // 640 Headless logs are not available (yet)
83
96
  export const HEADLESS_LOG_NOT_YET_AVAILABLE = 640;
84
- }
97
+
98
+ // 650 Invalid Value
99
+ export const INVALID_VALUE = 650;
100
+ }
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { MessageConnection } from "vscode-jsonrpc";
9
9
 
10
- export const ConnectionHandler = Symbol('ConnectionHandler');
10
+ export const ConnectionHandler = Symbol("ConnectionHandler");
11
11
 
12
12
  export interface ConnectionHandler {
13
13
  readonly path: string;
@@ -18,10 +18,10 @@ export interface ConnectionEventHandler {
18
18
  /**
19
19
  * Called when the transport underpinning the connection got closed
20
20
  */
21
- onTransportDidClose(): void;
21
+ onTransportDidClose(): void;
22
22
 
23
- /**
24
- * Called when the transport underpinning the connection is (re-)opened
25
- */
26
- onTransportDidOpen(): void;
23
+ /**
24
+ * Called when the transport underpinning the connection is (re-)opened
25
+ */
26
+ onTransportDidOpen(): void;
27
27
  }
@@ -10,7 +10,7 @@ import { IWebSocket } from "vscode-ws-jsonrpc";
10
10
 
11
11
  export function toIWebSocket(ws: ws) {
12
12
  return <IWebSocket>{
13
- send: content => {
13
+ send: (content) => {
14
14
  if (ws.readyState >= ws.CLOSING) {
15
15
  // ws is already CLOSING/CLOSED, send() would just return an error.
16
16
  return;
@@ -18,23 +18,23 @@ export function toIWebSocket(ws: ws) {
18
18
 
19
19
  // in general send-errors should trigger an 'error' event already, we just make sure it actually happens.
20
20
  try {
21
- ws.send(content, err => {
21
+ ws.send(content, (err) => {
22
22
  if (!err) {
23
23
  return;
24
24
  }
25
- ws.emit('error', err);
25
+ ws.emit("error", err);
26
26
  });
27
27
  } catch (err) {
28
- ws.emit('error', err);
28
+ ws.emit("error", err);
29
29
  }
30
30
  },
31
- onMessage: cb => ws.on('message', cb),
32
- onError: cb => ws.on('error', cb),
33
- onClose: cb => ws.on('close', cb),
31
+ onMessage: (cb) => ws.on("message", cb),
32
+ onError: (cb) => ws.on("error", cb),
33
+ onClose: (cb) => ws.on("close", cb),
34
34
  dispose: () => {
35
35
  if (ws.readyState < ws.CLOSING) {
36
36
  ws.close();
37
37
  }
38
- }
38
+ },
39
39
  };
40
40
  }
@@ -8,8 +8,8 @@
8
8
  import { MessageConnection, ResponseError } from "vscode-jsonrpc";
9
9
  import { Event, Emitter } from "../util/event";
10
10
  import { Disposable } from "../util/disposable";
11
- import { ConnectionHandler } from './handler';
12
- import { log } from '../util/logging';
11
+ import { ConnectionHandler } from "./handler";
12
+ import { log } from "../util/logging";
13
13
 
14
14
  export type JsonRpcServer<Client> = Disposable & {
15
15
  /**
@@ -27,10 +27,7 @@ export interface JsonRpcConnectionEventEmitter {
27
27
  export type JsonRpcProxy<T> = T & JsonRpcConnectionEventEmitter;
28
28
 
29
29
  export class JsonRpcConnectionHandler<T extends object> implements ConnectionHandler {
30
- constructor(
31
- readonly path: string,
32
- readonly targetFactory: (proxy: JsonRpcProxy<T>, request?: object) => any
33
- ) { }
30
+ constructor(readonly path: string, readonly targetFactory: (proxy: JsonRpcProxy<T>, request?: object) => any) {}
34
31
 
35
32
  onConnection(connection: MessageConnection, request?: object): void {
36
33
  const factory = new JsonRpcProxyFactory<T>();
@@ -83,7 +80,6 @@ export class JsonRpcConnectionHandler<T extends object> implements ConnectionHan
83
80
  * @param <T> - The type of the object to expose to JSON-RPC.
84
81
  */
85
82
  export class JsonRpcProxyFactory<T extends object> implements ProxyHandler<T> {
86
-
87
83
  protected readonly onDidOpenConnectionEmitter = new Emitter<void>();
88
84
  protected readonly onDidCloseConnectionEmitter = new Emitter<void>();
89
85
 
@@ -101,17 +97,15 @@ export class JsonRpcProxyFactory<T extends object> implements ProxyHandler<T> {
101
97
  }
102
98
 
103
99
  protected waitForConnection(): void {
104
- this.connectionPromise = new Promise(resolve =>
105
- this.connectionPromiseResolve = resolve
106
- );
107
- this.connectionPromise.then(connection => {
100
+ this.connectionPromise = new Promise((resolve) => (this.connectionPromiseResolve = resolve));
101
+ this.connectionPromise.then((connection) => {
108
102
  connection.onClose(() => this.fireConnectionClosed());
109
103
  this.fireConnectionOpened();
110
104
  });
111
105
  }
112
106
 
113
107
  fireConnectionClosed() {
114
- this.onDidCloseConnectionEmitter.fire(undefined)
108
+ this.onDidCloseConnectionEmitter.fire(undefined);
115
109
  }
116
110
 
117
111
  fireConnectionOpened() {
@@ -204,35 +198,34 @@ export class JsonRpcProxyFactory<T extends object> implements ProxyHandler<T> {
204
198
  * @returns A callable that executes the JSON-RPC call.
205
199
  */
206
200
  get(target: T, p: PropertyKey, receiver: any): any {
207
- if (p === 'setClient') {
201
+ if (p === "setClient") {
208
202
  return (client: any) => {
209
203
  this.target = client;
210
204
  };
211
205
  }
212
- if (p === 'onDidOpenConnection') {
206
+ if (p === "onDidOpenConnection") {
213
207
  return this.onDidOpenConnectionEmitter.event;
214
208
  }
215
- if (p === 'onDidCloseConnection') {
209
+ if (p === "onDidCloseConnection") {
216
210
  return this.onDidCloseConnectionEmitter.event;
217
211
  }
218
212
  const isNotify = this.isNotification(p);
219
213
  return (...args: any[]) =>
220
- this.connectionPromise.then(connection =>
221
- new Promise((resolve, reject) => {
222
- try {
223
- if (isNotify) {
224
- connection.sendNotification(p.toString(), ...args);
225
- resolve(undefined);
226
- } else {
227
- const resultPromise = connection.sendRequest(p.toString(), ...args) as Promise<any>;
228
- resultPromise
229
- .catch((err: any) => reject(err))
230
- .then((result: any) => resolve(result));
214
+ this.connectionPromise.then(
215
+ (connection) =>
216
+ new Promise((resolve, reject) => {
217
+ try {
218
+ if (isNotify) {
219
+ connection.sendNotification(p.toString(), ...args);
220
+ resolve(undefined);
221
+ } else {
222
+ const resultPromise = connection.sendRequest(p.toString(), ...args) as Promise<any>;
223
+ resultPromise.catch((err: any) => reject(err)).then((result: any) => resolve(result));
224
+ }
225
+ } catch (err) {
226
+ reject(err);
231
227
  }
232
- } catch (err) {
233
- reject(err);
234
- }
235
- })
228
+ }),
236
229
  );
237
230
  }
238
231
 
@@ -9,7 +9,7 @@ export interface OssAllowList {
9
9
  * A string that identifies a GitHub/GitLab/Bitbucket identity of the form "<host>/<profilename>"
10
10
  * E.g., "github.com/geropl"
11
11
  */
12
- identity: string,
12
+ identity: string;
13
13
 
14
- deleted?: boolean,
15
- }
14
+ deleted?: boolean;
15
+ }
@@ -4,8 +4,8 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- export namespace PaymentProtocol {
8
- export const UPDATE_GITPOD_SUBSCRIPTION_PATH = '/payment/chargebee'
7
+ export namespace PaymentProtocol {
8
+ export const UPDATE_GITPOD_SUBSCRIPTION_PATH = "/payment/chargebee";
9
9
  }
10
10
 
11
11
  export interface PlanCoupon {
package/src/permission.ts CHANGED
@@ -4,11 +4,10 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
-
8
7
  // see below for explanation
9
8
  export const Permissions = {
10
- "monitor": undefined,
11
- "enforcement": undefined,
9
+ monitor: undefined,
10
+ enforcement: undefined,
12
11
  "privileged-ws": undefined,
13
12
  "registry-access": undefined,
14
13
  "admin-users": undefined,
@@ -18,21 +17,20 @@ export const Permissions = {
18
17
  "ide-settings": undefined,
19
18
  "new-workspace-cluster": undefined,
20
19
  };
21
- export type PermissionName = keyof (typeof Permissions);
22
- export const Roles = {"devops": undefined, "viewer": undefined, "admin": undefined };
23
- export type RoleName = keyof (typeof Roles);
20
+ export type PermissionName = keyof typeof Permissions;
21
+ export const Roles = { devops: undefined, viewer: undefined, admin: undefined };
22
+ export type RoleName = keyof typeof Roles;
24
23
  export type RoleOrPermission = RoleName | PermissionName;
25
24
 
26
25
  export namespace RoleName {
27
26
  export const is = (o: any): o is RoleName => {
28
- return typeof(o) === 'string'
29
- && Role.all().some(r => r.name === o);
30
- }
27
+ return typeof o === "string" && Role.all().some((r) => r.name === o);
28
+ };
31
29
  }
32
30
 
33
31
  export interface Role {
34
- name: RoleName,
35
- permissions: PermissionName[],
32
+ name: RoleName;
33
+ permissions: PermissionName[];
36
34
  }
37
35
 
38
36
  export namespace RolesOrPermissions {
@@ -44,11 +42,11 @@ export namespace RolesOrPermissions {
44
42
  if (Permission.is(rop)) {
45
43
  permissions.add(rop);
46
44
  } else if (RoleName.is(rop)) {
47
- Role.getByName(rop).permissions.forEach(p => permissions.add(p));
45
+ Role.getByName(rop).permissions.forEach((p) => permissions.add(p));
48
46
  }
49
47
  }
50
48
  return permissions;
51
- };
49
+ }
52
50
  }
53
51
 
54
52
  export namespace Permission {
@@ -77,9 +75,8 @@ export namespace Permission {
77
75
  export const IDE_SETTINGS: PermissionName = "ide-settings";
78
76
 
79
77
  export const is = (o: any): o is PermissionName => {
80
- return typeof(o) === 'string'
81
- && Permission.all().some(p => p === o);
82
- }
78
+ return typeof o === "string" && Permission.all().some((p) => p === o);
79
+ };
83
80
 
84
81
  export const all = (): PermissionName[] => {
85
82
  return Object.keys(Permissions) as PermissionName[];
@@ -90,21 +87,13 @@ export namespace Role {
90
87
  /** The default role for all Gitpod developers */
91
88
  export const DEVOPS: Role = {
92
89
  name: "devops",
93
- permissions: [
94
- Permission.MONITOR,
95
- Permission.ENFORCEMENT,
96
- Permission.REGISTRY_ACCESS,
97
- Permission.IDE_SETTINGS
98
- ]
90
+ permissions: [Permission.MONITOR, Permission.ENFORCEMENT, Permission.REGISTRY_ACCESS, Permission.IDE_SETTINGS],
99
91
  };
100
92
 
101
93
  /** A role for people that are allowed to view Gitpod internals */
102
94
  export const VIEWER: Role = {
103
95
  name: "viewer",
104
- permissions: [
105
- Permission.MONITOR,
106
- Permission.REGISTRY_ACCESS,
107
- ]
96
+ permissions: [Permission.MONITOR, Permission.REGISTRY_ACCESS],
108
97
  };
109
98
 
110
99
  export const ADMIN: Role = {
@@ -115,11 +104,11 @@ export namespace Role {
115
104
  Permission.ADMIN_PROJECTS,
116
105
  Permission.ADMIN_API,
117
106
  Permission.ENFORCEMENT,
118
- ]
119
- }
107
+ ],
108
+ };
120
109
 
121
110
  export const getByName = (name: RoleName): Role => {
122
- const result = Role.all().find(r => r.name === name)
111
+ const result = Role.all().find((r) => r.name === name);
123
112
  if (!result) {
124
113
  throw Error("Unknown RoleName: " + name);
125
114
  }
@@ -128,7 +117,7 @@ export namespace Role {
128
117
 
129
118
  export const all = (): Role[] => {
130
119
  return Object.keys(Role)
131
- .map(k => (Role as any)[k])
132
- .filter(k => typeof(k) === 'object');
120
+ .map((k) => (Role as any)[k])
121
+ .filter((k) => typeof k === "object");
133
122
  };
134
123
  }