@gitpod/gitpod-protocol 0.1.5-ps-commit-email-fork.0 → 0.1.5-release-2022.6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/data/gitpod-schema.json +206 -28
  2. package/lib/accounting-protocol.d.ts +17 -13
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +39 -47
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +21 -4
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +2 -13
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +44 -0
  11. package/lib/analytics.d.ts.map +1 -0
  12. package/lib/analytics.js +10 -0
  13. package/lib/analytics.js.map +1 -0
  14. package/lib/auth.d.ts.map +1 -1
  15. package/lib/context-url.d.ts +31 -0
  16. package/lib/context-url.d.ts.map +1 -0
  17. package/lib/context-url.js +102 -0
  18. package/lib/context-url.js.map +1 -0
  19. package/lib/{util/context-url.spec.d.ts → context-url.spec.d.ts} +4 -0
  20. package/lib/context-url.spec.d.ts.map +1 -0
  21. package/lib/context-url.spec.js +109 -0
  22. package/lib/context-url.spec.js.map +1 -0
  23. package/lib/email-protocol.d.ts +1 -2
  24. package/lib/email-protocol.d.ts.map +1 -1
  25. package/lib/email-protocol.js +4 -4
  26. package/lib/email-protocol.js.map +1 -1
  27. package/lib/encryption/container-module.d.ts.map +1 -1
  28. package/lib/encryption/container-module.js +4 -4
  29. package/lib/encryption/container-module.js.map +1 -1
  30. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  31. package/lib/encryption/encryption-engine.js +25 -26
  32. package/lib/encryption/encryption-engine.js.map +1 -1
  33. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  34. package/lib/encryption/encryption-engine.spec.js +29 -37
  35. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  36. package/lib/encryption/encryption-service.d.ts.map +1 -1
  37. package/lib/encryption/encryption-service.js +30 -44
  38. package/lib/encryption/encryption-service.js.map +1 -1
  39. package/lib/encryption/key-provider.d.ts.map +1 -1
  40. package/lib/encryption/key-provider.js +31 -38
  41. package/lib/encryption/key-provider.js.map +1 -1
  42. package/lib/env.d.ts +0 -6
  43. package/lib/env.d.ts.map +1 -1
  44. package/lib/env.js +7 -27
  45. package/lib/env.js.map +1 -1
  46. package/lib/experiments/always-default.d.ts +8 -0
  47. package/lib/experiments/always-default.d.ts.map +1 -0
  48. package/lib/experiments/always-default.js +20 -0
  49. package/lib/experiments/always-default.js.map +1 -0
  50. package/lib/experiments/configcat-server.d.ts +8 -0
  51. package/lib/experiments/configcat-server.d.ts.map +1 -0
  52. package/lib/experiments/configcat-server.js +34 -0
  53. package/lib/experiments/configcat-server.js.map +1 -0
  54. package/lib/experiments/configcat.d.ts +21 -0
  55. package/lib/experiments/configcat.d.ts.map +1 -0
  56. package/lib/experiments/configcat.js +47 -0
  57. package/lib/experiments/configcat.js.map +1 -0
  58. package/lib/experiments/types.d.ts +19 -0
  59. package/lib/experiments/types.d.ts.map +1 -0
  60. package/lib/{util/without.js → experiments/types.js} +2 -2
  61. package/lib/experiments/types.js.map +1 -0
  62. package/lib/gitpod-file-parser.d.ts.map +1 -1
  63. package/lib/gitpod-file-parser.js +26 -42
  64. package/lib/gitpod-file-parser.js.map +1 -1
  65. package/lib/gitpod-file-parser.spec.js +145 -142
  66. package/lib/gitpod-file-parser.spec.js.map +1 -1
  67. package/lib/gitpod-service.d.ts +140 -38
  68. package/lib/gitpod-service.d.ts.map +1 -1
  69. package/lib/gitpod-service.js +181 -317
  70. package/lib/gitpod-service.js.map +1 -1
  71. package/lib/headless-workspace-log.d.ts +9 -11
  72. package/lib/headless-workspace-log.d.ts.map +1 -1
  73. package/lib/headless-workspace-log.js +6 -8
  74. package/lib/headless-workspace-log.js.map +1 -1
  75. package/lib/ide-frontend-service.d.ts +1 -1
  76. package/lib/ide-protocol.d.ts +105 -0
  77. package/lib/ide-protocol.d.ts.map +1 -0
  78. package/lib/ide-protocol.js +8 -0
  79. package/lib/ide-protocol.js.map +1 -0
  80. package/lib/index.d.ts +16 -10
  81. package/lib/index.d.ts.map +1 -1
  82. package/lib/index.js +6 -0
  83. package/lib/index.js.map +1 -1
  84. package/lib/installation-admin-protocol.d.ts +30 -0
  85. package/lib/installation-admin-protocol.d.ts.map +1 -0
  86. package/lib/installation-admin-protocol.js +31 -0
  87. package/lib/installation-admin-protocol.js.map +1 -0
  88. package/lib/license-protocol.d.ts +7 -0
  89. package/lib/license-protocol.d.ts.map +1 -1
  90. package/lib/license-protocol.js.map +1 -1
  91. package/lib/messaging/browser/connection.d.ts +3 -3
  92. package/lib/messaging/browser/connection.d.ts.map +1 -1
  93. package/lib/messaging/browser/connection.js +173 -36
  94. package/lib/messaging/browser/connection.js.map +1 -1
  95. package/lib/messaging/browser/window-connection.d.ts +4 -4
  96. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  97. package/lib/messaging/browser/window-connection.js +42 -59
  98. package/lib/messaging/browser/window-connection.js.map +1 -1
  99. package/lib/messaging/client-call-metrics.d.ts +35 -0
  100. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  101. package/lib/messaging/client-call-metrics.js +83 -0
  102. package/lib/messaging/client-call-metrics.js.map +1 -0
  103. package/lib/messaging/error.d.ts +5 -1
  104. package/lib/messaging/error.d.ts.map +1 -1
  105. package/lib/messaging/error.js +10 -2
  106. package/lib/messaging/error.js.map +1 -1
  107. package/lib/messaging/handler.d.ts +10 -0
  108. package/lib/messaging/handler.d.ts.map +1 -1
  109. package/lib/messaging/handler.js +1 -1
  110. package/lib/messaging/node/connection.d.ts +1 -17
  111. package/lib/messaging/node/connection.d.ts.map +1 -1
  112. package/lib/messaging/node/connection.js +24 -60
  113. package/lib/messaging/node/connection.js.map +1 -1
  114. package/lib/messaging/proxy-factory.d.ts +3 -1
  115. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  116. package/lib/messaging/proxy-factory.js +75 -162
  117. package/lib/messaging/proxy-factory.js.map +1 -1
  118. package/lib/oss-allowlist.d.ts +14 -0
  119. package/lib/oss-allowlist.d.ts.map +1 -0
  120. package/lib/oss-allowlist.js +8 -0
  121. package/lib/oss-allowlist.js.map +1 -0
  122. package/lib/payment-protocol.d.ts.map +1 -1
  123. package/lib/payment-protocol.js +1 -1
  124. package/lib/payment-protocol.js.map +1 -1
  125. package/lib/permission.d.ts +10 -3
  126. package/lib/permission.d.ts.map +1 -1
  127. package/lib/permission.js +41 -31
  128. package/lib/permission.js.map +1 -1
  129. package/lib/plans.d.ts +4 -4
  130. package/lib/plans.d.ts.map +1 -1
  131. package/lib/plans.js +225 -209
  132. package/lib/plans.js.map +1 -1
  133. package/lib/protocol.d.ts +172 -85
  134. package/lib/protocol.d.ts.map +1 -1
  135. package/lib/protocol.js +230 -187
  136. package/lib/protocol.js.map +1 -1
  137. package/lib/snapshot-url.d.ts +14 -0
  138. package/lib/snapshot-url.d.ts.map +1 -0
  139. package/lib/snapshot-url.js +26 -0
  140. package/lib/snapshot-url.js.map +1 -0
  141. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
  142. package/lib/snapshot-url.spec.d.ts.map +1 -0
  143. package/lib/snapshot-url.spec.js +41 -0
  144. package/lib/snapshot-url.spec.js.map +1 -0
  145. package/lib/team-subscription-protocol.d.ts +22 -4
  146. package/lib/team-subscription-protocol.d.ts.map +1 -1
  147. package/lib/team-subscription-protocol.js +31 -17
  148. package/lib/team-subscription-protocol.js.map +1 -1
  149. package/lib/teams-projects-protocol.d.ts +118 -0
  150. package/lib/teams-projects-protocol.d.ts.map +1 -0
  151. package/lib/teams-projects-protocol.js +30 -0
  152. package/lib/teams-projects-protocol.js.map +1 -0
  153. package/lib/typings/globals.d.ts +2 -2
  154. package/lib/typings/globals.d.ts.map +1 -1
  155. package/lib/util/analytics.d.ts +8 -0
  156. package/lib/util/analytics.d.ts.map +1 -0
  157. package/lib/util/analytics.js +88 -0
  158. package/lib/util/analytics.js.map +1 -0
  159. package/lib/util/async-iterator.d.ts.map +1 -1
  160. package/lib/util/async-iterator.js +57 -135
  161. package/lib/util/async-iterator.js.map +1 -1
  162. package/lib/util/cancelable.js +17 -59
  163. package/lib/util/cancelable.js.map +1 -1
  164. package/lib/util/date-time.js +11 -11
  165. package/lib/util/date-time.js.map +1 -1
  166. package/lib/util/debug-app.d.ts +25 -0
  167. package/lib/util/debug-app.d.ts.map +1 -0
  168. package/lib/util/debug-app.js +100 -0
  169. package/lib/util/debug-app.js.map +1 -0
  170. package/lib/util/deferred.js +10 -12
  171. package/lib/util/deferred.js.map +1 -1
  172. package/lib/util/disposable.d.ts.map +1 -1
  173. package/lib/util/disposable.js +27 -40
  174. package/lib/util/disposable.js.map +1 -1
  175. package/lib/util/event.d.ts.map +1 -1
  176. package/lib/util/event.js +63 -77
  177. package/lib/util/event.js.map +1 -1
  178. package/lib/util/garbage-collected-cache.d.ts +1 -0
  179. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  180. package/lib/util/garbage-collected-cache.js +27 -47
  181. package/lib/util/garbage-collected-cache.js.map +1 -1
  182. package/lib/util/generate-workspace-id.d.ts +6 -1
  183. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  184. package/lib/util/generate-workspace-id.js +469 -502
  185. package/lib/util/generate-workspace-id.js.map +1 -1
  186. package/lib/util/generate-workspace-id.spec.js +68 -78
  187. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  188. package/lib/util/gitpod-cookie.d.ts +20 -0
  189. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  190. package/lib/util/gitpod-cookie.js +41 -0
  191. package/lib/util/gitpod-cookie.js.map +1 -0
  192. package/lib/util/gitpod-host-url.d.ts +1 -2
  193. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  194. package/lib/util/gitpod-host-url.js +108 -109
  195. package/lib/util/gitpod-host-url.js.map +1 -1
  196. package/lib/util/gitpod-host-url.spec.d.ts +6 -0
  197. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  198. package/lib/util/gitpod-host-url.spec.js +112 -30
  199. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  200. package/lib/util/grpc.d.ts +15 -0
  201. package/lib/util/grpc.d.ts.map +1 -0
  202. package/lib/util/grpc.js +18 -0
  203. package/lib/util/grpc.js.map +1 -0
  204. package/lib/util/jaeger-client-types.d.ts +68 -0
  205. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  206. package/lib/{theia-plugins.js → util/jaeger-client-types.js} +1 -1
  207. package/lib/util/jaeger-client-types.js.map +1 -0
  208. package/lib/util/logging.d.ts +49 -33
  209. package/lib/util/logging.d.ts.map +1 -1
  210. package/lib/util/logging.js +125 -129
  211. package/lib/util/logging.js.map +1 -1
  212. package/lib/util/make-link.js +5 -5
  213. package/lib/util/make-link.js.map +1 -1
  214. package/lib/util/parse-workspace-id.d.ts +10 -0
  215. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  216. package/lib/util/parse-workspace-id.js +30 -7
  217. package/lib/util/parse-workspace-id.js.map +1 -1
  218. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  219. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  220. package/lib/util/parse-workspace-id.spec.js +123 -84
  221. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  222. package/lib/util/queue.js +16 -55
  223. package/lib/util/queue.js.map +1 -1
  224. package/lib/util/queue.spec.js +147 -288
  225. package/lib/util/queue.spec.js.map +1 -1
  226. package/lib/util/repeat.d.ts +15 -0
  227. package/lib/util/repeat.d.ts.map +1 -0
  228. package/lib/util/repeat.js +55 -0
  229. package/lib/util/repeat.js.map +1 -0
  230. package/lib/util/semaphore.d.ts.map +1 -1
  231. package/lib/util/semaphore.js +15 -46
  232. package/lib/util/semaphore.js.map +1 -1
  233. package/lib/util/skip-if.d.ts.map +1 -1
  234. package/lib/util/skip-if.js +6 -6
  235. package/lib/util/skip-if.js.map +1 -1
  236. package/lib/util/timeutil.d.ts +1 -0
  237. package/lib/util/timeutil.d.ts.map +1 -1
  238. package/lib/util/timeutil.js +23 -17
  239. package/lib/util/timeutil.js.map +1 -1
  240. package/lib/util/timeutil.spec.d.ts.map +1 -1
  241. package/lib/util/timeutil.spec.js +21 -24
  242. package/lib/util/timeutil.spec.js.map +1 -1
  243. package/lib/util/tracing.d.ts +52 -6
  244. package/lib/util/tracing.d.ts.map +1 -1
  245. package/lib/util/tracing.js +197 -64
  246. package/lib/util/tracing.js.map +1 -1
  247. package/lib/util/tracing.spec.d.ts +7 -0
  248. package/lib/util/tracing.spec.d.ts.map +1 -0
  249. package/lib/util/tracing.spec.js +121 -0
  250. package/lib/util/tracing.spec.js.map +1 -0
  251. package/lib/util/workspace-port-authentication.d.ts +7 -7
  252. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  253. package/lib/util/workspace-port-authentication.js +9 -12
  254. package/lib/util/workspace-port-authentication.js.map +1 -1
  255. package/lib/workspace-cluster.d.ts +24 -3
  256. package/lib/workspace-cluster.d.ts.map +1 -1
  257. package/lib/workspace-cluster.js +19 -4
  258. package/lib/workspace-cluster.js.map +1 -1
  259. package/lib/workspace-instance.d.ts +42 -5
  260. package/lib/workspace-instance.d.ts.map +1 -1
  261. package/lib/wsready.d.ts +1 -1
  262. package/lib/wsready.d.ts.map +1 -1
  263. package/lib/wsready.js +2 -2
  264. package/lib/wsready.js.map +1 -1
  265. package/package.json +35 -18
  266. package/pkg-yarn.lock +20 -10
  267. package/provenance-bundle.jsonl +2 -0
  268. package/src/accounting-protocol.ts +63 -57
  269. package/src/admin-protocol.ts +43 -21
  270. package/src/analytics.ts +52 -0
  271. package/src/auth.ts +2 -2
  272. package/src/context-url.spec.ts +67 -0
  273. package/src/context-url.ts +109 -0
  274. package/src/email-protocol.ts +5 -7
  275. package/src/encryption/container-module.ts +2 -3
  276. package/src/encryption/encryption-engine.spec.ts +9 -8
  277. package/src/encryption/encryption-engine.ts +14 -14
  278. package/src/encryption/encryption-service.ts +4 -5
  279. package/src/encryption/key-provider.ts +16 -19
  280. package/src/env.ts +0 -22
  281. package/src/experiments/always-default.ts +24 -0
  282. package/src/experiments/configcat-server.ts +37 -0
  283. package/src/experiments/configcat.ts +53 -0
  284. package/src/experiments/types.ts +32 -0
  285. package/src/gitpod-file-parser.spec.ts +55 -61
  286. package/src/gitpod-file-parser.ts +16 -17
  287. package/src/gitpod-service.ts +278 -127
  288. package/src/headless-workspace-log.ts +12 -14
  289. package/src/ide-frontend-service.ts +2 -2
  290. package/src/ide-protocol.ts +119 -0
  291. package/src/index.ts +16 -10
  292. package/src/installation-admin-protocol.ts +45 -0
  293. package/src/license-protocol.ts +12 -6
  294. package/src/messaging/browser/connection.ts +185 -21
  295. package/src/messaging/browser/window-connection.ts +39 -29
  296. package/src/messaging/client-call-metrics.ts +96 -0
  297. package/src/messaging/error.ts +15 -5
  298. package/src/messaging/handler.ts +13 -1
  299. package/src/messaging/node/connection.ts +23 -70
  300. package/src/messaging/proxy-factory.ts +35 -34
  301. package/src/oss-allowlist.ts +15 -0
  302. package/src/payment-protocol.ts +2 -2
  303. package/src/permission.ts +42 -33
  304. package/src/plans.ts +236 -189
  305. package/src/protocol.ts +454 -276
  306. package/src/snapshot-url.spec.ts +27 -0
  307. package/src/snapshot-url.ts +27 -0
  308. package/src/team-subscription-protocol.ts +59 -23
  309. package/src/teams-projects-protocol.ts +153 -0
  310. package/src/typings/globals.ts +4 -4
  311. package/src/util/analytics.ts +109 -0
  312. package/src/util/async-iterator.ts +4 -5
  313. package/src/util/cancelable.ts +3 -3
  314. package/src/util/date-time.ts +8 -8
  315. package/src/util/debug-app.ts +81 -0
  316. package/src/util/deferred.ts +6 -6
  317. package/src/util/disposable.ts +3 -6
  318. package/src/util/event.ts +9 -11
  319. package/src/util/garbage-collected-cache.ts +9 -6
  320. package/src/util/generate-workspace-id.spec.ts +37 -10
  321. package/src/util/generate-workspace-id.ts +464 -438
  322. package/src/util/gitpod-cookie.ts +38 -0
  323. package/src/util/gitpod-host-url.spec.ts +58 -7
  324. package/src/util/gitpod-host-url.ts +52 -40
  325. package/src/util/grpc.ts +15 -0
  326. package/src/util/jaeger-client-types.ts +102 -0
  327. package/src/util/logging.ts +145 -72
  328. package/src/util/make-link.ts +6 -7
  329. package/src/util/parse-workspace-id.spec.ts +37 -8
  330. package/src/util/parse-workspace-id.ts +32 -7
  331. package/src/util/queue.spec.ts +27 -25
  332. package/src/util/repeat.ts +45 -0
  333. package/src/util/semaphore.ts +4 -6
  334. package/src/util/skip-if.ts +9 -6
  335. package/src/util/timeutil.spec.ts +14 -15
  336. package/src/util/timeutil.ts +21 -11
  337. package/src/util/tracing.spec.ts +88 -0
  338. package/src/util/tracing.ts +200 -31
  339. package/src/util/workspace-port-authentication.ts +10 -13
  340. package/src/workspace-cluster.ts +34 -7
  341. package/src/workspace-instance.ts +91 -31
  342. package/src/wsready.ts +3 -3
  343. package/data/builtin-theia-plugins.json +0 -372
  344. package/lib/messaging/connection-error-handler.d.ts +0 -27
  345. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  346. package/lib/messaging/connection-error-handler.js +0 -46
  347. package/lib/messaging/connection-error-handler.js.map +0 -1
  348. package/lib/theia-plugins.d.ts +0 -11
  349. package/lib/theia-plugins.d.ts.map +0 -1
  350. package/lib/theia-plugins.js.map +0 -1
  351. package/lib/util/context-url.d.ts +0 -13
  352. package/lib/util/context-url.d.ts.map +0 -1
  353. package/lib/util/context-url.js +0 -26
  354. package/lib/util/context-url.js.map +0 -1
  355. package/lib/util/context-url.spec.d.ts.map +0 -1
  356. package/lib/util/context-url.spec.js +0 -52
  357. package/lib/util/context-url.spec.js.map +0 -1
  358. package/lib/util/repeater.d.ts +0 -22
  359. package/lib/util/repeater.d.ts.map +0 -1
  360. package/lib/util/repeater.js +0 -118
  361. package/lib/util/repeater.js.map +0 -1
  362. package/lib/util/safe-promise.d.ts +0 -11
  363. package/lib/util/safe-promise.d.ts.map +0 -1
  364. package/lib/util/safe-promise.js +0 -34
  365. package/lib/util/safe-promise.js.map +0 -1
  366. package/lib/util/without.d.ts +0 -7
  367. package/lib/util/without.d.ts.map +0 -1
  368. package/lib/util/without.js.map +0 -1
  369. package/src/messaging/connection-error-handler.ts +0 -62
  370. package/src/theia-plugins.ts +0 -11
  371. package/src/util/context-url.spec.ts +0 -25
  372. package/src/util/context-url.ts +0 -23
  373. package/src/util/jaeger-client.d.ts +0 -105
  374. package/src/util/repeater.ts +0 -49
  375. package/src/util/safe-promise.ts +0 -26
@@ -12,55 +12,190 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.PerOperationSampler = exports.TracingManager = exports.TraceContext = void 0;
15
- var opentracing = require("opentracing");
16
- var jaeger_client_1 = require("jaeger-client");
17
- var opentracing_1 = require("opentracing");
18
- var inversify_1 = require("inversify");
15
+ const opentracing = require("opentracing");
16
+ const jaeger_client_1 = require("jaeger-client");
17
+ const opentracing_1 = require("opentracing");
18
+ const inversify_1 = require("inversify");
19
+ const logging_1 = require("./logging");
19
20
  var TraceContext;
20
21
  (function (TraceContext) {
21
- function startSpan(operation, ctx) {
22
- var options = {
23
- childOf: ctx.span
24
- };
22
+ function startSpan(operation, parentCtx) {
23
+ var _a;
24
+ const options = {};
25
+ // references should contain span id.
26
+ // cf. https://github.com/jaegertracing/jaeger-client-node/issues/432
27
+ if (!!(parentCtx === null || parentCtx === void 0 ? void 0 : parentCtx.span)) {
28
+ const ctx = (_a = parentCtx === null || parentCtx === void 0 ? void 0 : parentCtx.span) === null || _a === void 0 ? void 0 : _a.context();
29
+ if (ctx && !!ctx.toTraceId() && !!ctx.toSpanId()) {
30
+ options.references = [opentracing.followsFrom(ctx)];
31
+ }
32
+ }
25
33
  return opentracing.globalTracer().startSpan(operation, options);
26
34
  }
27
35
  TraceContext.startSpan = startSpan;
28
- function startAsyncSpan(operation, ctx) {
29
- var options = {};
30
- if (!!ctx.span) {
31
- options.references = [opentracing.followsFrom(ctx.span.context())];
36
+ function childContext(operation, parentCtx) {
37
+ const span = startSpan(operation, parentCtx);
38
+ return { span };
39
+ }
40
+ TraceContext.childContext = childContext;
41
+ function withSpan(operation, callback, ctx) {
42
+ // if we don't have a parent span, don't create a trace here as those <trace-without-root-spans> are not useful.
43
+ if (!ctx || !ctx.span || !ctx.span.context()) {
44
+ callback({});
45
+ return;
46
+ }
47
+ const span = TraceContext.startSpan(operation, ctx);
48
+ try {
49
+ callback({ span });
50
+ }
51
+ catch (e) {
52
+ TraceContext.setError({ span }, e);
53
+ throw e;
54
+ }
55
+ finally {
56
+ span.finish();
32
57
  }
33
- return opentracing.globalTracer().startSpan(operation, options);
34
58
  }
35
- TraceContext.startAsyncSpan = startAsyncSpan;
36
- function logError(ctx, err) {
59
+ TraceContext.withSpan = withSpan;
60
+ function setError(ctx, err) {
37
61
  if (!ctx.span) {
38
62
  return;
39
63
  }
40
- ctx.span.log({
41
- "error": err.message,
42
- "stacktrace": err.stack
64
+ TraceContext.addNestedTags(ctx, {
65
+ error: {
66
+ message: err.message,
67
+ stacktrace: err.stack,
68
+ },
43
69
  });
44
70
  ctx.span.setTag("error", true);
45
71
  }
46
- TraceContext.logError = logError;
72
+ TraceContext.setError = setError;
73
+ function setJsonRPCMetadata(ctx, method) {
74
+ if (!ctx.span) {
75
+ return;
76
+ }
77
+ const tags = {
78
+ rpc: {
79
+ system: "jsonrpc",
80
+ // version,
81
+ },
82
+ };
83
+ if (method) {
84
+ tags.rpc.method = method;
85
+ }
86
+ addNestedTags(ctx, tags);
87
+ }
88
+ TraceContext.setJsonRPCMetadata = setJsonRPCMetadata;
89
+ function setJsonRPCError(ctx, method, err, withStatusCode = false) {
90
+ if (!ctx.span) {
91
+ return;
92
+ }
93
+ // not use setError bc this is (most likely) a working operation
94
+ setJsonRPCMetadata(ctx, method);
95
+ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/rpc.md#json-rpc
96
+ addNestedTags(ctx, {
97
+ rpc: {
98
+ jsonrpc: {
99
+ error_code: err.code,
100
+ error_message: err.message,
101
+ },
102
+ },
103
+ });
104
+ // the field "status_code" is used by honeycomb to derive insights like success rate, etc. Defaults to "0".
105
+ if (withStatusCode) {
106
+ ctx.span.setTag("status_code", err.code);
107
+ }
108
+ }
109
+ TraceContext.setJsonRPCError = setJsonRPCError;
110
+ function addJsonRPCParameters(ctx, params) {
111
+ if (!ctx.span) {
112
+ return;
113
+ }
114
+ setJsonRPCMetadata(ctx);
115
+ addNestedTags(ctx, {
116
+ rpc: {
117
+ jsonrpc: {
118
+ parameters: params,
119
+ },
120
+ },
121
+ });
122
+ }
123
+ TraceContext.addJsonRPCParameters = addJsonRPCParameters;
124
+ /**
125
+ * Does what one would expect from `span.addTags`: Calls `span.addTag` for all keys in map, recursively for objects.
126
+ * Example:
127
+ * ```
128
+ * TraceContext.addNestedTags(ctx, {
129
+ * rpc: {
130
+ * system: "jsonrpc",
131
+ * jsonrpc: {
132
+ * version: "1.0",
133
+ * method: "test",
134
+ * parameters: ["abc", "def"],
135
+ * },
136
+ * },
137
+ * });
138
+ * ```
139
+ * gives
140
+ * rpc.system = "jsonrpc"
141
+ * rpc.jsonrpc.version = "1.0"
142
+ * rpc.jsonrpc.method = "test"
143
+ * rpc.jsonrpc.parameters.0 = "abc"
144
+ * rpc.jsonrpc.parameters.1 = "def"
145
+ * @param ctx
146
+ * @param keyValueMap
147
+ * @returns
148
+ */
149
+ function addNestedTags(ctx, keyValueMap, _namespace) {
150
+ if (!ctx.span) {
151
+ return;
152
+ }
153
+ const namespace = _namespace ? `${_namespace}.` : "";
154
+ try {
155
+ for (const k of Object.keys(keyValueMap)) {
156
+ const v = keyValueMap[k];
157
+ if (v instanceof Object) {
158
+ addNestedTags(ctx, v, `${namespace}${k}`);
159
+ }
160
+ else {
161
+ ctx.span.setTag(`${namespace}${k}`, v);
162
+ }
163
+ }
164
+ }
165
+ catch (err) {
166
+ // general resilience against odd shapes/parameters
167
+ logging_1.log.error("Tracing.addNestedTags", err, { namespace });
168
+ }
169
+ }
170
+ TraceContext.addNestedTags = addNestedTags;
171
+ function setOWI(ctx, owi) {
172
+ if (!ctx.span) {
173
+ return;
174
+ }
175
+ addNestedTags(ctx, {
176
+ context: owi,
177
+ });
178
+ }
179
+ TraceContext.setOWI = setOWI;
47
180
  })(TraceContext = exports.TraceContext || (exports.TraceContext = {}));
48
- var TracingManager = /** @class */ (function () {
49
- function TracingManager() {
50
- }
51
- TracingManager.prototype.setup = function (serviceName, opts) {
52
- opentracing_1.initGlobalTracer(this.getTracerForService(serviceName, opts));
53
- };
54
- TracingManager.prototype.getTracerForService = function (serviceName, opts) {
55
- var config = {
181
+ let TracingManager = class TracingManager {
182
+ setup(serviceName, opts) {
183
+ (0, opentracing_1.initGlobalTracer)(this.getTracerForService(serviceName, opts));
184
+ }
185
+ getTracerForService(serviceName, opts) {
186
+ const config = {
56
187
  disable: false,
57
188
  reporter: {
58
- logSpans: false
189
+ logSpans: false,
59
190
  },
60
- serviceName: serviceName
191
+ serviceName,
61
192
  };
62
- var t = jaeger_client_1.initTracerFromEnv(config, {
63
- logger: console
193
+ const t = (0, jaeger_client_1.initTracerFromEnv)(config, {
194
+ logger: console,
195
+ tags: {
196
+ "service.build.commit": process.env.GITPOD_BUILD_GIT_COMMIT,
197
+ "service.build.version": process.env.GITPOD_BUILD_VERSION,
198
+ },
64
199
  });
65
200
  if (opts) {
66
201
  if (opts.perOpSampling) {
@@ -68,26 +203,25 @@ var TracingManager = /** @class */ (function () {
68
203
  }
69
204
  }
70
205
  return t;
71
- };
72
- TracingManager = __decorate([
73
- inversify_1.injectable()
74
- ], TracingManager);
75
- return TracingManager;
76
- }());
206
+ }
207
+ };
208
+ TracingManager = __decorate([
209
+ (0, inversify_1.injectable)()
210
+ ], TracingManager);
77
211
  exports.TracingManager = TracingManager;
78
- var PerOperationSampler = /** @class */ (function () {
79
- function PerOperationSampler(fallback, strategies) {
212
+ class PerOperationSampler {
213
+ constructor(fallback, strategies) {
80
214
  this.fallback = fallback;
81
215
  this.strategies = strategies;
82
216
  }
83
- PerOperationSampler.prototype.name = function () {
84
- return 'PerOperationSampler';
85
- };
86
- PerOperationSampler.prototype.toString = function () {
87
- return "" + this.name();
88
- };
89
- PerOperationSampler.prototype.isSampled = function (operation, tags) {
90
- var shouldSample = this.strategies[operation];
217
+ name() {
218
+ return "PerOperationSampler";
219
+ }
220
+ toString() {
221
+ return `${this.name()}`;
222
+ }
223
+ isSampled(operation, tags) {
224
+ let shouldSample = this.strategies[operation];
91
225
  if (shouldSample === undefined) {
92
226
  if (!this.fallback.isSampled) {
93
227
  return false;
@@ -95,31 +229,30 @@ var PerOperationSampler = /** @class */ (function () {
95
229
  return this.fallback.isSampled(operation, tags);
96
230
  }
97
231
  return shouldSample;
98
- };
99
- PerOperationSampler.prototype.onCreateSpan = function (span) {
100
- var outTags = {};
101
- var isSampled = this.isSampled(span.operationName, outTags);
232
+ }
233
+ onCreateSpan(span) {
234
+ const outTags = {};
235
+ const isSampled = this.isSampled(span.operationName, outTags);
102
236
  // NB: return retryable=true here since we can change decision after setOperationName().
103
237
  return { sample: isSampled, retryable: true, tags: outTags };
104
- };
105
- PerOperationSampler.prototype.onSetOperationName = function (span, operationName) {
106
- var outTags = {};
107
- var isSampled = this.isSampled(span.operationName, outTags);
238
+ }
239
+ onSetOperationName(span, operationName) {
240
+ const outTags = {};
241
+ const isSampled = this.isSampled(span.operationName, outTags);
108
242
  return { sample: isSampled, retryable: false, tags: outTags };
109
- };
110
- PerOperationSampler.prototype.onSetTag = function (span, key, value) {
243
+ }
244
+ onSetTag(span, key, value) {
111
245
  return { sample: false, retryable: true, tags: null };
112
- };
113
- PerOperationSampler.prototype.equal = function (other) {
246
+ }
247
+ equal(other) {
114
248
  return false; // TODO equal should be removed
115
- };
116
- PerOperationSampler.prototype.close = function (callback) {
249
+ }
250
+ close(callback) {
117
251
  // all nested samplers are of simple types, so we do not need to Close them
118
252
  if (callback) {
119
253
  callback();
120
254
  }
121
- };
122
- return PerOperationSampler;
123
- }());
255
+ }
256
+ }
124
257
  exports.PerOperationSampler = PerOperationSampler;
125
258
  //# sourceMappingURL=tracing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/util/tracing.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;AAGH,yCAA2C;AAC3C,+CAA4F;AAC5F,2CAA+C;AAC/C,uCAAuC;AAMvC,IAAiB,YAAY,CA2B5B;AA3BD,WAAiB,YAAY;IACzB,SAAgB,SAAS,CAAC,SAAiB,EAAE,GAAiB;QAC1D,IAAM,OAAO,GAA4B;YACrC,OAAO,EAAE,GAAG,CAAC,IAAI;SACpB,CAAA;QACD,OAAO,WAAW,CAAC,YAAY,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IALe,sBAAS,YAKxB,CAAA;IAED,SAAgB,cAAc,CAAC,SAAiB,EAAE,GAAiB;QAC/D,IAAM,OAAO,GAA4B,EAAE,CAAC;QAC5C,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE;YACZ,OAAO,CAAC,UAAU,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;SACtE;QACD,OAAO,WAAW,CAAC,YAAY,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IANe,2BAAc,iBAM7B,CAAA;IAED,SAAgB,QAAQ,CAAC,GAAiB,EAAE,GAAU;QAClD,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;YACX,OAAO;SACV;QAED,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;YACT,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,YAAY,EAAE,GAAG,CAAC,KAAK;SAC1B,CAAC,CAAA;QACF,GAAG,CAAC,IAAI,CAAC,MA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AG,EAAE,CAAC;QACnB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAE,IAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACvE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAClE,CAAC;IAED,QAAQ,CAAC,IAAsB,EAAE,GAAW,EAAE,KAAU;QACpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,KAAc;QAChB,OAAO,KAAK,CAAC,CAAC,+BAA+B;IACjD,CAAC;IAED,KAAK,CAAC,QAAoB;QACtB,2EAA2E;QAC3E,IAAI,QAAQ,EAAE;YACV,QAAQ,EAAE,CAAC;SACd;IACL,CAAC;CACJ;AAlDD,kDAkDC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=tracing.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracing.spec.d.ts","sourceRoot":"","sources":["../../src/util/tracing.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2021 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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
8
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
12
+ };
13
+ var __metadata = (this && this.__metadata) || function (k, v) {
14
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
15
+ };
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const mocha_typescript_1 = require("mocha-typescript");
27
+ const chai = require("chai");
28
+ const tracing_1 = require("./tracing");
29
+ const opentracing_1 = require("opentracing");
30
+ const expect = chai.expect;
31
+ let TestTracing = class TestTracing {
32
+ testTracingContext_addNestedTags() {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const tracer = new opentracing_1.MockTracer();
35
+ const span = tracer.startSpan("testTracingContext_addNestedTags");
36
+ tracing_1.TraceContext.addNestedTags({ span }, {
37
+ rpc: {
38
+ system: "jsonrpc",
39
+ jsonrpc: {
40
+ version: "1.0",
41
+ method: "test",
42
+ parameters: ["abc", "def"],
43
+ },
44
+ },
45
+ });
46
+ const mockSpan = tracer.report().spans[0];
47
+ expect(mockSpan.tags()).to.deep.equal({
48
+ "rpc.system": "jsonrpc",
49
+ "rpc.jsonrpc.version": "1.0",
50
+ "rpc.jsonrpc.method": "test",
51
+ "rpc.jsonrpc.parameters.0": "abc",
52
+ "rpc.jsonrpc.parameters.1": "def",
53
+ });
54
+ });
55
+ }
56
+ testTracingContext_addNestedTags_null() {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ const tracer = new opentracing_1.MockTracer();
59
+ const span = tracer.startSpan("testTracingContext_addNestedTags_null");
60
+ tracing_1.TraceContext.addNestedTags({ span }, {
61
+ someShape: {
62
+ thisIsNull: null,
63
+ thisIsUndefined: undefined,
64
+ },
65
+ });
66
+ const mockSpan = tracer.report().spans[0];
67
+ expect(mockSpan.tags()).to.deep.equal({
68
+ "someShape.thisIsNull": null,
69
+ "someShape.thisIsUndefined": undefined,
70
+ });
71
+ });
72
+ }
73
+ testTracingContext_addJsonRPCParameters() {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const tracer = new opentracing_1.MockTracer();
76
+ const span = tracer.startSpan("testTracingContext_addJsonRPCParameters");
77
+ const ctx = { span };
78
+ tracing_1.TraceContext.addJsonRPCParameters(ctx, {
79
+ one: "one",
80
+ two: {
81
+ name: "two",
82
+ some: "shape",
83
+ containing: "PII",
84
+ },
85
+ three: "three",
86
+ });
87
+ const mockSpan = tracer.report().spans[0];
88
+ expect(mockSpan.tags()).to.deep.equal({
89
+ "rpc.jsonrpc.parameters.one": "one",
90
+ "rpc.jsonrpc.parameters.two.containing": "PII",
91
+ "rpc.jsonrpc.parameters.two.name": "two",
92
+ "rpc.jsonrpc.parameters.two.some": "shape",
93
+ "rpc.jsonrpc.parameters.three": "three",
94
+ "rpc.system": "jsonrpc",
95
+ });
96
+ });
97
+ }
98
+ };
99
+ __decorate([
100
+ mocha_typescript_1.test,
101
+ __metadata("design:type", Function),
102
+ __metadata("design:paramtypes", []),
103
+ __metadata("design:returntype", Promise)
104
+ ], TestTracing.prototype, "testTracingContext_addNestedTags", null);
105
+ __decorate([
106
+ mocha_typescript_1.test,
107
+ __metadata("design:type", Function),
108
+ __metadata("design:paramtypes", []),
109
+ __metadata("design:returntype", Promise)
110
+ ], TestTracing.prototype, "testTracingContext_addNestedTags_null", null);
111
+ __decorate([
112
+ mocha_typescript_1.test,
113
+ __metadata("design:type", Function),
114
+ __metadata("design:paramtypes", []),
115
+ __metadata("design:returntype", Promise)
116
+ ], TestTracing.prototype, "testTracingContext_addJsonRPCParameters", null);
117
+ TestTracing = __decorate([
118
+ mocha_typescript_1.suite
119
+ ], TestTracing);
120
+ module.exports = new TestTracing();
121
+ //# sourceMappingURL=tracing.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracing.spec.js","sourceRoot":"","sources":["../../src/util/tracing.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;AAEH,uDAA+C;AAC/C,6BAA6B;AAC7B,uCAAyC;AACzC,6CAAyC;AAEzC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAG3B,IAAM,WAAW,GAAjB,MAAM,WAAW;IACM,gCAAgC;;YAC/C,MAAM,MAAM,GAAG,IAAI,wBAAU,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;YAClE,sBAAY,CAAC,aAAa,CACtB,EAAE,IAAI,EAAE,EACR;gBACI,GAAG,EAAE;oBACD,MAAM,EAAE,SAAS;oBACjB,OAAO,EAAE;wBACL,OAAO,EAAE,KAAK;wBACd,MAAM,EAAE,MAAM;wBACd,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;qBAC7B;iBACJ;aACJ,CACJ,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC1C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;gBAClC,YAAY,EAAE,SAAS;gBACvB,qBAAqB,EAAE,KAAK;gBAC5B,oBAAoB,EAAE,MAAM;gBAC5B,0BAA0B,EAAE,KAAK;gBACjC,0BAA0B,EAAE,KAAK;aACpC,CAAC,CAAC;QACP,CAAC;KAAA;IAEkB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AC1C,8BAA8B,EAAE,OAAO;gBACvC,YAAY,EAAE,SAAS;aAC1B,CAAC,CAAC;QACP,CAAC;KAAA;CACJ,CAAA;AAvES;IAAL,uBAAI;;;;mEAyBJ;AAEK;IAAL,uBAAI;;;;wEAkBJ;AAEK;IAAL,uBAAI;;;;0EAuBJ;AAvEC,WAAW;IADhB,wBAAK;GACA,WAAW,CAwEhB;AACD,MAAM,CAAC,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC"}
@@ -4,12 +4,12 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
  /**
7
- * These cookies are set in the Theia frontend. This pattern is relied upon in:
8
- * - proxy:
9
- * - to filter it out on port locations
10
- * - to forward it to the server for authentication
11
- * - server:
12
- * - to authenticate access to port locations
13
- */
7
+ * These cookies are set in the Theia frontend. This pattern is relied upon in:
8
+ * - proxy:
9
+ * - to filter it out on port locations
10
+ * - to forward it to the server for authentication
11
+ * - server:
12
+ * - to authenticate access to port locations
13
+ */
14
14
  export declare const worspacePortAuthCookieName: (host: string, workspaceId: string) => string;
15
15
  //# sourceMappingURL=workspace-port-authentication.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-port-authentication.d.ts","sourceRoot":"","sources":["../../src/util/workspace-port-authentication.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;EAOE;AACF,eAAO,MAAM,0BAA0B,SAAkB,MAAM,eAAe,MAAM,KAAG,MAKtF,CAAC"}
1
+ {"version":3,"file":"workspace-port-authentication.d.ts","sourceRoot":"","sources":["../../src/util/workspace-port-authentication.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,SAAmB,MAAM,eAAe,MAAM,KAAG,MAEvF,CAAC"}
@@ -7,18 +7,15 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.worspacePortAuthCookieName = void 0;
9
9
  /**
10
- * These cookies are set in the Theia frontend. This pattern is relied upon in:
11
- * - proxy:
12
- * - to filter it out on port locations
13
- * - to forward it to the server for authentication
14
- * - server:
15
- * - to authenticate access to port locations
16
- */
17
- var worspacePortAuthCookieName = function (host, workspaceId) {
18
- return host
19
- .replace(/https?/, '')
20
- .replace(/[\W_]+/g, "_")
21
- + ("_ws_" + workspaceId + "_port_auth_");
10
+ * These cookies are set in the Theia frontend. This pattern is relied upon in:
11
+ * - proxy:
12
+ * - to filter it out on port locations
13
+ * - to forward it to the server for authentication
14
+ * - server:
15
+ * - to authenticate access to port locations
16
+ */
17
+ const worspacePortAuthCookieName = function (host, workspaceId) {
18
+ return host.replace(/https?/, "").replace(/[\W_]+/g, "_") + `_ws_${workspaceId}_port_auth_`;
22
19
  };
23
20
  exports.worspacePortAuthCookieName = worspacePortAuthCookieName;
24
21
  //# sourceMappingURL=workspace-port-authentication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-port-authentication.js","sourceRoot":"","sources":["../../src/util/workspace-port-authentication.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;EAOE;AACK,IAAM,0BAA0B,GAAG,UAAS,IAAY,EAAE,WAAmB;IAChF,OAAO,IAAI;SACN,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;WACtB,SAAO,WAAW,gBAAa,CAAA,CAAC;AAC1C,CAAC,CAAC;AALW,QAAA,0BAA0B,8BAKrC"}
1
+ {"version":3,"file":"workspace-port-authentication.js","sourceRoot":"","sources":["../../src/util/workspace-port-authentication.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;GAOG;AACI,MAAM,0BAA0B,GAAG,UAAU,IAAY,EAAE,WAAmB;IACjF,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,OAAO,WAAW,aAAa,CAAC;AAChG,CAAC,CAAC;AAFW,QAAA,0BAA0B,8BAErC"}
@@ -4,7 +4,7 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
  import { DeepPartial } from "./util/deep-partial";
7
- import { Without } from './util/without';
7
+ import { PermissionName } from "./permission";
8
8
  export interface WorkspaceCluster {
9
9
  name: string;
10
10
  url: string;
@@ -13,6 +13,7 @@ export interface WorkspaceCluster {
13
13
  maxScore: number;
14
14
  score: number;
15
15
  govern: boolean;
16
+ admissionConstraints?: AdmissionConstraint[];
16
17
  }
17
18
  export declare type WorkspaceClusterState = "available" | "cordoned" | "draining";
18
19
  export interface TLSConfig {
@@ -23,8 +24,28 @@ export interface TLSConfig {
23
24
  export declare namespace TLSConfig {
24
25
  const loadFromBase64File: (path: string) => string;
25
26
  }
26
- export declare type WorkspaceClusterWoTls = Without<WorkspaceCluster, "tls">;
27
+ export declare type WorkspaceClusterWoTLS = Omit<WorkspaceCluster, "tls">;
27
28
  export declare type WorkspaceManagerConnectionInfo = Pick<WorkspaceCluster, "name" | "url" | "tls">;
29
+ export declare type AdmissionConstraint = AdmissionConstraintFeaturePreview | AdmissionConstraintHasPermission | AdmissionConstraintHasUserLevel | AdmissionConstraintHasMoreResources;
30
+ export declare type AdmissionConstraintFeaturePreview = {
31
+ type: "has-feature-preview";
32
+ };
33
+ export declare type AdmissionConstraintHasPermission = {
34
+ type: "has-permission";
35
+ permission: PermissionName;
36
+ };
37
+ export declare type AdmissionConstraintHasUserLevel = {
38
+ type: "has-user-level";
39
+ level: string;
40
+ };
41
+ export declare type AdmissionConstraintHasMoreResources = {
42
+ type: "has-more-resources";
43
+ };
44
+ export declare namespace AdmissionConstraint {
45
+ function is(o: any): o is AdmissionConstraint;
46
+ function isHasPermissionConstraint(o: any): o is AdmissionConstraintHasPermission;
47
+ function hasPermission(ac: AdmissionConstraint, permission: PermissionName): boolean;
48
+ }
28
49
  export declare const WorkspaceClusterDB: unique symbol;
29
50
  export interface WorkspaceClusterDB {
30
51
  /**
@@ -47,7 +68,7 @@ export interface WorkspaceClusterDB {
47
68
  * Lists all WorkspaceClusterWoTls for which the given predicate is true (does not return TLS for size/speed concerns)
48
69
  * @param predicate
49
70
  */
50
- findFiltered(predicate: DeepPartial<WorkspaceClusterFilter>): Promise<WorkspaceClusterWoTls[]>;
71
+ findFiltered(predicate: DeepPartial<WorkspaceClusterFilter>): Promise<WorkspaceClusterWoTLS[]>;
51
72
  }
52
73
  export interface WorkspaceClusterFilter extends Pick<WorkspaceCluster, "state" | "govern" | "url"> {
53
74
  minScore: number;
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-cluster.d.ts","sourceRoot":"","sources":["../src/workspace-cluster.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAI7B,IAAI,EAAE,MAAM,CAAC;IAGb,GAAG,EAAE,MAAM,CAAC;IAGZ,GAAG,CAAC,EAAE,SAAS,CAAC;IAGhB,KAAK,EAAE,qBAAqB,CAAC;IAG7B,QAAQ,EAAE,MAAM,CAAC;IAGjB,KAAK,EAAE,MAAM,CAAC;IAGd,MAAM,EAAE,OAAO,CAAC;CACnB;AACD,oBAAY,qBAAqB,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;AAC1E,MAAM,WAAW,SAAS;IAEtB,EAAE,EAAE,MAAM,CAAC;IAEX,GAAG,EAAE,MAAM,CAAC;IAEZ,GAAG,EAAE,MAAM,CAAC;CACf;AACD,yBAAiB,SAAS,CAAC;IAChB,MAAM,kBAAkB,SAAU,MAAM,KAAG,MAA6E,CAAC;CACnI;AACD,oBAAY,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AACrE,oBAAY,8BAA8B,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC,C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,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1C;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;IAEhE;;;OAGG;IACH,YAAY,CAAC,SAAS,EAAE,WAAW,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;CAClG;AACD,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC9F,QAAQ,EAAE,MAAM,CAAC;CACpB"}
@@ -5,12 +5,27 @@
5
5
  * See License-AGPL.txt in the project root for license information.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.WorkspaceClusterDB = exports.TLSConfig = void 0;
9
- var fs = require("fs");
10
- var env_1 = require("./env");
8
+ exports.WorkspaceClusterDB = exports.AdmissionConstraint = exports.TLSConfig = void 0;
9
+ const fs = require("fs");
10
+ const env_1 = require("./env");
11
11
  var TLSConfig;
12
12
  (function (TLSConfig) {
13
- TLSConfig.loadFromBase64File = function (path) { return fs.readFileSync(env_1.filePathTelepresenceAware(path)).toString("base64"); };
13
+ TLSConfig.loadFromBase64File = (path) => fs.readFileSync((0, env_1.filePathTelepresenceAware)(path)).toString("base64");
14
14
  })(TLSConfig = exports.TLSConfig || (exports.TLSConfig = {}));
15
+ var AdmissionConstraint;
16
+ (function (AdmissionConstraint) {
17
+ function is(o) {
18
+ return !!o && "type" in o;
19
+ }
20
+ AdmissionConstraint.is = is;
21
+ function isHasPermissionConstraint(o) {
22
+ return is(o) && o.type === "has-permission";
23
+ }
24
+ AdmissionConstraint.isHasPermissionConstraint = isHasPermissionConstraint;
25
+ function hasPermission(ac, permission) {
26
+ return isHasPermissionConstraint(ac) && ac.permission === permission;
27
+ }
28
+ AdmissionConstraint.hasPermission = hasPermission;
29
+ })(AdmissionConstraint = exports.AdmissionConstraint || (exports.AdmissionConstraint = {}));
15
30
  exports.WorkspaceClusterDB = Symbol("WorkspaceClusterDB");
16
31
  //# sourceMappingURL=workspace-cluster.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-cluster.js","sourceRoot":"","sources":["../src/workspace-cluster.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,uBAAyB;AACzB,6BAAkD;AAqClD,IAAiB,SAAS,CAEzB;AAFD,WAAiB,SAAS;IACT,4BAAkB,GAAG,UAAC,IAAY,IAAa,OAAA,EAAE,CAAC,YAAY,CAAC,+BAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAnE,CAAmE,CAAC;AACpI,CAAC,EAFgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEzB;AAIY,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"workspace-cluster.js","sourceRoot":"","sources":["../src/workspace-cluster.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,yBAAyB;AACzB,+BAAkD;AAyClD,IAAiB,SAAS,CAGzB;AAHD,WAAiB,SAAS;IACT,4BAAkB,GAAG,CAAC,IAAY,EAAU,EAAE,CACvD,EAAE,CAAC,YAAY,CAAC,IAAA,+BAAyB,EAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC5E,CAAC,EAHgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGzB;AAcD,IAAiB,mBAAmB,CAUnC;AAVD,WAAiB,mBAAmB;IAChC,SAAgB,EAAE,CAAC,CAAM;QACrB,OAAO,CAAC,CAAC,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC;IAC9B,CAAC;IAFe,sBAAE,KAEjB,CAAA;IACD,SAAgB,yBAAyB,CAAC,CAAM;QAC5C,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,gBAAg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