@gitpod/gitpod-protocol 0.1.5-wth-test.80 → 0.1.5-wv-remove-without-ws-flag.5

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