@gitpod/gitpod-protocol 0.1.5-private-repos-after-cancellation.0 → 0.1.5-protected-secrets.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 (407) hide show
  1. package/data/gitpod-schema.json +145 -7
  2. package/lib/accounting-protocol.d.ts +18 -12
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +43 -42
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +28 -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 +12 -2
  11. package/lib/analytics.d.ts.map +1 -1
  12. package/lib/analytics.js.map +1 -1
  13. package/lib/attribution.d.ts +23 -0
  14. package/lib/attribution.d.ts.map +1 -0
  15. package/lib/attribution.js +50 -0
  16. package/lib/attribution.js.map +1 -0
  17. package/lib/auth.d.ts.map +1 -1
  18. package/lib/billing-mode.d.ts +43 -0
  19. package/lib/billing-mode.d.ts.map +1 -0
  20. package/lib/billing-mode.js +44 -0
  21. package/lib/billing-mode.js.map +1 -0
  22. package/lib/blocked-repositories-protocol.d.ts +13 -0
  23. package/lib/blocked-repositories-protocol.d.ts.map +1 -0
  24. package/lib/blocked-repositories-protocol.js +8 -0
  25. package/lib/blocked-repositories-protocol.js.map +1 -0
  26. package/lib/context-url.d.ts +18 -5
  27. package/lib/context-url.d.ts.map +1 -1
  28. package/lib/context-url.js +63 -10
  29. package/lib/context-url.js.map +1 -1
  30. package/lib/context-url.spec.d.ts +2 -0
  31. package/lib/context-url.spec.d.ts.map +1 -1
  32. package/lib/context-url.spec.js +81 -48
  33. package/lib/context-url.spec.js.map +1 -1
  34. package/lib/encryption/container-module.d.ts.map +1 -1
  35. package/lib/encryption/container-module.js +4 -4
  36. package/lib/encryption/container-module.js.map +1 -1
  37. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  38. package/lib/encryption/encryption-engine.js +25 -26
  39. package/lib/encryption/encryption-engine.js.map +1 -1
  40. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  41. package/lib/encryption/encryption-engine.spec.js +29 -37
  42. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  43. package/lib/encryption/encryption-service.d.ts.map +1 -1
  44. package/lib/encryption/encryption-service.js +30 -44
  45. package/lib/encryption/encryption-service.js.map +1 -1
  46. package/lib/encryption/key-provider.d.ts.map +1 -1
  47. package/lib/encryption/key-provider.js +31 -38
  48. package/lib/encryption/key-provider.js.map +1 -1
  49. package/lib/env.d.ts +0 -6
  50. package/lib/env.d.ts.map +1 -1
  51. package/lib/env.js +7 -27
  52. package/lib/env.js.map +1 -1
  53. package/lib/experiments/always-default.d.ts +8 -0
  54. package/lib/experiments/always-default.d.ts.map +1 -0
  55. package/lib/experiments/always-default.js +20 -0
  56. package/lib/experiments/always-default.js.map +1 -0
  57. package/lib/experiments/configcat-server.d.ts +10 -0
  58. package/lib/experiments/configcat-server.d.ts.map +1 -0
  59. package/lib/experiments/configcat-server.js +36 -0
  60. package/lib/experiments/configcat-server.js.map +1 -0
  61. package/lib/experiments/configcat.d.ts +21 -0
  62. package/lib/experiments/configcat.d.ts.map +1 -0
  63. package/lib/experiments/configcat.js +51 -0
  64. package/lib/experiments/configcat.js.map +1 -0
  65. package/lib/experiments/types.d.ts +22 -0
  66. package/lib/experiments/types.d.ts.map +1 -0
  67. package/lib/experiments/types.js +10 -0
  68. package/lib/experiments/types.js.map +1 -0
  69. package/lib/gitpod-file-parser.d.ts.map +1 -1
  70. package/lib/gitpod-file-parser.js +26 -42
  71. package/lib/gitpod-file-parser.js.map +1 -1
  72. package/lib/gitpod-file-parser.spec.js +145 -142
  73. package/lib/gitpod-file-parser.spec.js.map +1 -1
  74. package/lib/gitpod-service.d.ts +127 -52
  75. package/lib/gitpod-service.d.ts.map +1 -1
  76. package/lib/gitpod-service.js +190 -315
  77. package/lib/gitpod-service.js.map +1 -1
  78. package/lib/headless-workspace-log.d.ts +3 -13
  79. package/lib/headless-workspace-log.d.ts.map +1 -1
  80. package/lib/headless-workspace-log.js +3 -8
  81. package/lib/headless-workspace-log.js.map +1 -1
  82. package/lib/ide-frontend-service.d.ts +1 -1
  83. package/lib/ide-protocol.d.ts +113 -0
  84. package/lib/ide-protocol.d.ts.map +1 -0
  85. package/lib/{util/without.js → ide-protocol.js} +2 -2
  86. package/lib/ide-protocol.js.map +1 -0
  87. package/lib/index.d.ts +16 -12
  88. package/lib/index.d.ts.map +1 -1
  89. package/lib/index.js +5 -1
  90. package/lib/index.js.map +1 -1
  91. package/lib/installation-admin-protocol.d.ts +30 -0
  92. package/lib/installation-admin-protocol.d.ts.map +1 -0
  93. package/lib/installation-admin-protocol.js +31 -0
  94. package/lib/installation-admin-protocol.js.map +1 -0
  95. package/lib/license-protocol.d.ts +7 -0
  96. package/lib/license-protocol.d.ts.map +1 -1
  97. package/lib/license-protocol.js.map +1 -1
  98. package/lib/messaging/browser/connection.d.ts +3 -3
  99. package/lib/messaging/browser/connection.d.ts.map +1 -1
  100. package/lib/messaging/browser/connection.js +173 -36
  101. package/lib/messaging/browser/connection.js.map +1 -1
  102. package/lib/messaging/browser/window-connection.d.ts +4 -4
  103. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  104. package/lib/messaging/browser/window-connection.js +42 -59
  105. package/lib/messaging/browser/window-connection.js.map +1 -1
  106. package/lib/messaging/client-call-metrics.d.ts +19 -0
  107. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  108. package/lib/messaging/client-call-metrics.js +82 -0
  109. package/lib/messaging/client-call-metrics.js.map +1 -0
  110. package/lib/messaging/error.d.ts +10 -2
  111. package/lib/messaging/error.d.ts.map +1 -1
  112. package/lib/messaging/error.js +20 -4
  113. package/lib/messaging/error.js.map +1 -1
  114. package/lib/messaging/handler.d.ts +10 -0
  115. package/lib/messaging/handler.d.ts.map +1 -1
  116. package/lib/messaging/handler.js +1 -1
  117. package/lib/messaging/node/connection.d.ts +1 -17
  118. package/lib/messaging/node/connection.d.ts.map +1 -1
  119. package/lib/messaging/node/connection.js +24 -60
  120. package/lib/messaging/node/connection.js.map +1 -1
  121. package/lib/messaging/proxy-factory.d.ts +3 -1
  122. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  123. package/lib/messaging/proxy-factory.js +75 -162
  124. package/lib/messaging/proxy-factory.js.map +1 -1
  125. package/lib/oss-allowlist.d.ts +14 -0
  126. package/lib/oss-allowlist.d.ts.map +1 -0
  127. package/lib/oss-allowlist.js +8 -0
  128. package/lib/oss-allowlist.js.map +1 -0
  129. package/lib/payment-protocol.d.ts.map +1 -1
  130. package/lib/payment-protocol.js +1 -1
  131. package/lib/payment-protocol.js.map +1 -1
  132. package/lib/permission.d.ts +9 -4
  133. package/lib/permission.d.ts.map +1 -1
  134. package/lib/permission.js +39 -31
  135. package/lib/permission.js.map +1 -1
  136. package/lib/plans.d.ts +5 -4
  137. package/lib/plans.d.ts.map +1 -1
  138. package/lib/plans.js +229 -209
  139. package/lib/plans.js.map +1 -1
  140. package/lib/protocol.d.ts +234 -143
  141. package/lib/protocol.d.ts.map +1 -1
  142. package/lib/protocol.js +339 -193
  143. package/lib/protocol.js.map +1 -1
  144. package/{src/util/without.ts → lib/protocol.spec.d.ts} +2 -3
  145. package/lib/protocol.spec.d.ts.map +1 -0
  146. package/lib/protocol.spec.js +127 -0
  147. package/lib/protocol.spec.js.map +1 -0
  148. package/lib/snapshot-url.d.ts +14 -0
  149. package/lib/snapshot-url.d.ts.map +1 -0
  150. package/lib/snapshot-url.js +26 -0
  151. package/lib/snapshot-url.js.map +1 -0
  152. package/{src/theia-plugins.ts → lib/snapshot-url.spec.d.ts} +2 -6
  153. package/lib/snapshot-url.spec.d.ts.map +1 -0
  154. package/lib/snapshot-url.spec.js +41 -0
  155. package/lib/snapshot-url.spec.js.map +1 -0
  156. package/lib/team-subscription-protocol.d.ts +22 -4
  157. package/lib/team-subscription-protocol.d.ts.map +1 -1
  158. package/lib/team-subscription-protocol.js +33 -18
  159. package/lib/team-subscription-protocol.js.map +1 -1
  160. package/lib/teams-projects-protocol.d.ts +130 -0
  161. package/lib/teams-projects-protocol.d.ts.map +1 -0
  162. package/lib/teams-projects-protocol.js +30 -0
  163. package/lib/teams-projects-protocol.js.map +1 -0
  164. package/lib/typings/globals.d.ts +2 -2
  165. package/lib/typings/globals.d.ts.map +1 -1
  166. package/lib/usage.d.ts +61 -0
  167. package/lib/usage.d.ts.map +1 -0
  168. package/lib/usage.js +14 -0
  169. package/lib/usage.js.map +1 -0
  170. package/lib/util/analytics.d.ts.map +1 -1
  171. package/lib/util/analytics.js +44 -26
  172. package/lib/util/analytics.js.map +1 -1
  173. package/lib/util/async-iterator.d.ts.map +1 -1
  174. package/lib/util/async-iterator.js +57 -135
  175. package/lib/util/async-iterator.js.map +1 -1
  176. package/lib/util/cancelable.js +17 -59
  177. package/lib/util/cancelable.js.map +1 -1
  178. package/lib/util/date-time.js +11 -11
  179. package/lib/util/date-time.js.map +1 -1
  180. package/lib/util/debug-app.d.ts +25 -0
  181. package/lib/util/debug-app.d.ts.map +1 -0
  182. package/lib/util/debug-app.js +100 -0
  183. package/lib/util/debug-app.js.map +1 -0
  184. package/lib/util/deferred.js +10 -12
  185. package/lib/util/deferred.js.map +1 -1
  186. package/lib/util/disposable.d.ts.map +1 -1
  187. package/lib/util/disposable.js +27 -40
  188. package/lib/util/disposable.js.map +1 -1
  189. package/lib/util/event.d.ts.map +1 -1
  190. package/lib/util/event.js +63 -77
  191. package/lib/util/event.js.map +1 -1
  192. package/lib/util/garbage-collected-cache.d.ts +1 -0
  193. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  194. package/lib/util/garbage-collected-cache.js +32 -47
  195. package/lib/util/garbage-collected-cache.js.map +1 -1
  196. package/lib/util/generate-workspace-id.d.ts +6 -1
  197. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  198. package/lib/util/generate-workspace-id.js +469 -504
  199. package/lib/util/generate-workspace-id.js.map +1 -1
  200. package/lib/util/generate-workspace-id.spec.js +68 -78
  201. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  202. package/lib/util/gitpod-cookie.d.ts +20 -0
  203. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  204. package/lib/util/gitpod-cookie.js +41 -0
  205. package/lib/util/gitpod-cookie.js.map +1 -0
  206. package/lib/util/gitpod-host-url.d.ts +4 -1
  207. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  208. package/lib/util/gitpod-host-url.js +124 -114
  209. package/lib/util/gitpod-host-url.js.map +1 -1
  210. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  211. package/lib/util/gitpod-host-url.spec.js +97 -135
  212. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  213. package/lib/util/grpc.d.ts +34 -0
  214. package/lib/util/grpc.d.ts.map +1 -0
  215. package/lib/util/grpc.js +90 -0
  216. package/lib/util/grpc.js.map +1 -0
  217. package/lib/util/jaeger-client-types.d.ts +68 -0
  218. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  219. package/lib/{theia-plugins.js → util/jaeger-client-types.js} +1 -1
  220. package/lib/util/jaeger-client-types.js.map +1 -0
  221. package/lib/util/logging.d.ts +49 -33
  222. package/lib/util/logging.d.ts.map +1 -1
  223. package/lib/util/logging.js +132 -129
  224. package/lib/util/logging.js.map +1 -1
  225. package/lib/util/logging.spec.d.ts +7 -0
  226. package/lib/util/logging.spec.d.ts.map +1 -0
  227. package/lib/util/logging.spec.js +52 -0
  228. package/lib/util/logging.spec.js.map +1 -0
  229. package/lib/util/make-link.js +5 -5
  230. package/lib/util/make-link.js.map +1 -1
  231. package/lib/util/nice-grpc.d.ts +9 -0
  232. package/lib/util/nice-grpc.d.ts.map +1 -0
  233. package/lib/util/nice-grpc.js +119 -0
  234. package/lib/util/nice-grpc.js.map +1 -0
  235. package/lib/util/parse-workspace-id.d.ts +10 -0
  236. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  237. package/lib/util/parse-workspace-id.js +30 -7
  238. package/lib/util/parse-workspace-id.js.map +1 -1
  239. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  240. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  241. package/lib/util/parse-workspace-id.spec.js +123 -84
  242. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  243. package/lib/util/queue.js +16 -55
  244. package/lib/util/queue.js.map +1 -1
  245. package/lib/util/queue.spec.js +147 -288
  246. package/lib/util/queue.spec.js.map +1 -1
  247. package/lib/util/repeat.d.ts +15 -0
  248. package/lib/util/repeat.d.ts.map +1 -0
  249. package/lib/util/repeat.js +55 -0
  250. package/lib/util/repeat.js.map +1 -0
  251. package/lib/util/semaphore.d.ts.map +1 -1
  252. package/lib/util/semaphore.js +15 -46
  253. package/lib/util/semaphore.js.map +1 -1
  254. package/lib/util/skip-if.d.ts.map +1 -1
  255. package/lib/util/skip-if.js +6 -6
  256. package/lib/util/skip-if.js.map +1 -1
  257. package/lib/util/timeutil.d.ts +2 -0
  258. package/lib/util/timeutil.d.ts.map +1 -1
  259. package/lib/util/timeutil.js +29 -17
  260. package/lib/util/timeutil.js.map +1 -1
  261. package/lib/util/timeutil.spec.d.ts +2 -0
  262. package/lib/util/timeutil.spec.d.ts.map +1 -1
  263. package/lib/util/timeutil.spec.js +54 -23
  264. package/lib/util/timeutil.spec.js.map +1 -1
  265. package/lib/util/tracing.d.ts +52 -6
  266. package/lib/util/tracing.d.ts.map +1 -1
  267. package/lib/util/tracing.js +197 -64
  268. package/lib/util/tracing.js.map +1 -1
  269. package/lib/util/tracing.spec.d.ts +7 -0
  270. package/lib/util/tracing.spec.d.ts.map +1 -0
  271. package/lib/util/tracing.spec.js +121 -0
  272. package/lib/util/tracing.spec.js.map +1 -0
  273. package/lib/util/workspace-port-authentication.d.ts +7 -7
  274. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  275. package/lib/util/workspace-port-authentication.js +9 -12
  276. package/lib/util/workspace-port-authentication.js.map +1 -1
  277. package/lib/webhook-event.d.ts +44 -0
  278. package/lib/webhook-event.d.ts.map +1 -0
  279. package/lib/webhook-event.js +8 -0
  280. package/lib/webhook-event.js.map +1 -0
  281. package/lib/workspace-class.d.ts +14 -0
  282. package/lib/workspace-class.d.ts.map +1 -0
  283. package/lib/workspace-class.js +8 -0
  284. package/lib/workspace-class.js.map +1 -0
  285. package/lib/workspace-cluster.d.ts +15 -5
  286. package/lib/workspace-cluster.d.ts.map +1 -1
  287. package/lib/workspace-cluster.js +19 -4
  288. package/lib/workspace-cluster.js.map +1 -1
  289. package/lib/workspace-instance.d.ts +44 -5
  290. package/lib/workspace-instance.d.ts.map +1 -1
  291. package/lib/wsready.d.ts +1 -1
  292. package/lib/wsready.d.ts.map +1 -1
  293. package/lib/wsready.js +2 -2
  294. package/package.json +34 -15
  295. package/pkg-yarn.lock +21 -9
  296. package/provenance-bundle.jsonl +2 -0
  297. package/src/accounting-protocol.ts +66 -54
  298. package/src/admin-protocol.ts +53 -21
  299. package/src/analytics.ts +28 -16
  300. package/src/attribution.ts +59 -0
  301. package/src/auth.ts +2 -2
  302. package/src/billing-mode.ts +81 -0
  303. package/src/blocked-repositories-protocol.ts +13 -0
  304. package/src/context-url.spec.ts +37 -9
  305. package/src/context-url.ts +94 -36
  306. package/src/encryption/container-module.ts +2 -3
  307. package/src/encryption/encryption-engine.spec.ts +9 -8
  308. package/src/encryption/encryption-engine.ts +20 -16
  309. package/src/encryption/encryption-service.ts +4 -5
  310. package/src/encryption/key-provider.ts +16 -19
  311. package/src/env.ts +0 -22
  312. package/src/experiments/always-default.ts +24 -0
  313. package/src/experiments/configcat-server.ts +41 -0
  314. package/src/experiments/configcat.ts +56 -0
  315. package/src/experiments/types.ts +34 -0
  316. package/src/gitpod-file-parser.spec.ts +55 -61
  317. package/src/gitpod-file-parser.ts +16 -17
  318. package/src/gitpod-service.ts +286 -143
  319. package/src/headless-workspace-log.ts +8 -19
  320. package/src/ide-frontend-service.ts +2 -2
  321. package/src/ide-protocol.ts +129 -0
  322. package/src/index.ts +16 -12
  323. package/src/installation-admin-protocol.ts +45 -0
  324. package/src/license-protocol.ts +12 -6
  325. package/src/messaging/browser/connection.ts +185 -21
  326. package/src/messaging/browser/window-connection.ts +39 -29
  327. package/src/messaging/client-call-metrics.ts +77 -0
  328. package/src/messaging/error.ts +29 -7
  329. package/src/messaging/handler.ts +13 -1
  330. package/src/messaging/node/connection.ts +23 -70
  331. package/src/messaging/proxy-factory.ts +35 -34
  332. package/src/oss-allowlist.ts +15 -0
  333. package/src/payment-protocol.ts +2 -2
  334. package/src/permission.ts +40 -33
  335. package/src/plans.ts +240 -189
  336. package/src/protocol.spec.ts +97 -0
  337. package/src/protocol.ts +612 -340
  338. package/src/snapshot-url.spec.ts +27 -0
  339. package/src/snapshot-url.ts +27 -0
  340. package/src/team-subscription-protocol.ts +59 -23
  341. package/src/teams-projects-protocol.ts +166 -0
  342. package/src/typings/globals.ts +4 -4
  343. package/src/usage.ts +71 -0
  344. package/src/util/analytics.ts +56 -18
  345. package/src/util/async-iterator.ts +4 -5
  346. package/src/util/cancelable.ts +3 -3
  347. package/src/util/date-time.ts +8 -8
  348. package/src/util/debug-app.ts +81 -0
  349. package/src/util/deferred.ts +6 -6
  350. package/src/util/disposable.ts +3 -6
  351. package/src/util/event.ts +9 -11
  352. package/src/util/garbage-collected-cache.ts +14 -6
  353. package/src/util/generate-workspace-id.spec.ts +34 -7
  354. package/src/util/generate-workspace-id.ts +464 -440
  355. package/src/util/gitpod-cookie.ts +38 -0
  356. package/src/util/gitpod-host-url.spec.ts +40 -13
  357. package/src/util/gitpod-host-url.ts +61 -37
  358. package/src/util/grpc.ts +104 -0
  359. package/src/util/jaeger-client-types.ts +102 -0
  360. package/src/util/logging.spec.ts +23 -0
  361. package/src/util/logging.ts +156 -74
  362. package/src/util/make-link.ts +6 -7
  363. package/src/util/nice-grpc.ts +93 -0
  364. package/src/util/parse-workspace-id.spec.ts +37 -8
  365. package/src/util/parse-workspace-id.ts +32 -7
  366. package/src/util/queue.spec.ts +27 -25
  367. package/src/util/repeat.ts +45 -0
  368. package/src/util/semaphore.ts +4 -6
  369. package/src/util/skip-if.ts +9 -6
  370. package/src/util/timeutil.spec.ts +40 -14
  371. package/src/util/timeutil.ts +27 -11
  372. package/src/util/tracing.spec.ts +88 -0
  373. package/src/util/tracing.ts +200 -31
  374. package/src/util/workspace-port-authentication.ts +10 -13
  375. package/src/webhook-event.ts +55 -0
  376. package/src/workspace-class.ts +14 -0
  377. package/src/workspace-cluster.ts +29 -10
  378. package/src/workspace-instance.ts +89 -24
  379. package/src/wsready.ts +3 -3
  380. package/data/builtin-theia-plugins.json +0 -372
  381. package/lib/email-protocol.d.ts +0 -50
  382. package/lib/email-protocol.d.ts.map +0 -1
  383. package/lib/email-protocol.js +0 -28
  384. package/lib/email-protocol.js.map +0 -1
  385. package/lib/messaging/connection-error-handler.d.ts +0 -27
  386. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  387. package/lib/messaging/connection-error-handler.js +0 -46
  388. package/lib/messaging/connection-error-handler.js.map +0 -1
  389. package/lib/theia-plugins.d.ts +0 -11
  390. package/lib/theia-plugins.d.ts.map +0 -1
  391. package/lib/theia-plugins.js.map +0 -1
  392. package/lib/util/repeater.d.ts +0 -22
  393. package/lib/util/repeater.d.ts.map +0 -1
  394. package/lib/util/repeater.js +0 -118
  395. package/lib/util/repeater.js.map +0 -1
  396. package/lib/util/safe-promise.d.ts +0 -11
  397. package/lib/util/safe-promise.d.ts.map +0 -1
  398. package/lib/util/safe-promise.js +0 -34
  399. package/lib/util/safe-promise.js.map +0 -1
  400. package/lib/util/without.d.ts +0 -7
  401. package/lib/util/without.d.ts.map +0 -1
  402. package/lib/util/without.js.map +0 -1
  403. package/src/email-protocol.ts +0 -67
  404. package/src/messaging/connection-error-handler.ts +0 -62
  405. package/src/util/jaeger-client.d.ts +0 -105
  406. package/src/util/repeater.ts +0 -49
  407. package/src/util/safe-promise.ts +0 -26
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+
7
+ import { suite, test } from "mocha-typescript";
8
+ import * as chai from "chai";
9
+ import { SnapshotUrl } from ".";
10
+
11
+ const expect = chai.expect;
12
+
13
+ @suite
14
+ class TestSnapshotUrlParser {
15
+ @test public testPositive() {
16
+ const actual = SnapshotUrl.parse(
17
+ "workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar@gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd",
18
+ );
19
+
20
+ expect(actual).to.deep.equal(<SnapshotUrl>{
21
+ bucketId: "gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd",
22
+ filename: "3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
23
+ fullPath: "workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar",
24
+ });
25
+ }
26
+ }
27
+ module.exports = new TestSnapshotUrlParser(); // Only to circumvent no usage warning :-/
@@ -0,0 +1,27 @@
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
+
7
+ export interface SnapshotUrl {
8
+ bucketId: string;
9
+ fullPath: string;
10
+ filename: string;
11
+ }
12
+ export namespace SnapshotUrl {
13
+ export function parse(url: string): SnapshotUrl {
14
+ const parts = url.split("@");
15
+ if (parts.length !== 2) {
16
+ throw new Error(`cannot parse snapshot URL: ${url}`);
17
+ }
18
+ const [fullPath, bucketId] = parts;
19
+
20
+ const pathParts = fullPath.split("/");
21
+ if (pathParts.length < 1) {
22
+ throw new Error(`cannot parse snapshot URL: ${url}`);
23
+ }
24
+ const filename = pathParts[pathParts.length - 1];
25
+ return { bucketId, fullPath, filename };
26
+ }
27
+ }
@@ -4,8 +4,7 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- import { Without } from "./util/without";
8
- import uuidv4 = require("uuid/v4");
7
+ import { v4 as uuidv4 } from "uuid";
9
8
  import { Subscription } from "./accounting-protocol";
10
9
 
11
10
  export interface TeamSubscription {
@@ -19,16 +18,45 @@ export interface TeamSubscription {
19
18
  paymentReference: string;
20
19
  cancellationDate?: string;
21
20
  deleted?: boolean;
21
+ /** If this flag is set slots are not eligibile for clusters with "more-resources" - even if their plan might be */
22
+ excludeFromMoreResources: boolean;
22
23
  }
23
24
 
24
25
  export namespace TeamSubscription {
25
- export const create = (ts: Without<TeamSubscription, 'id'>): TeamSubscription => {
26
+ export const create = (ts: Omit<TeamSubscription, "id">): TeamSubscription => {
26
27
  const withId = ts as TeamSubscription;
27
28
  withId.id = uuidv4();
28
29
  return withId;
29
- }
30
+ };
30
31
  export const isActive = (ts: TeamSubscription, date: string): boolean => {
31
32
  return ts.startDate <= date && (ts.endDate === undefined || date < ts.endDate);
33
+ };
34
+ }
35
+
36
+ export interface TeamSubscription2 {
37
+ id: string;
38
+ teamId: string;
39
+ planId: string;
40
+ startDate: string;
41
+ endDate?: string;
42
+ quantity: number;
43
+ /** The Chargebee subscription id */
44
+ paymentReference: string;
45
+ cancellationDate?: string;
46
+ excludeFromMoreResources: boolean;
47
+ }
48
+
49
+ export namespace TeamSubscription2 {
50
+ export const create = (ts2: Omit<TeamSubscription2, "id">): TeamSubscription2 => {
51
+ const withId = ts2 as TeamSubscription2;
52
+ withId.id = uuidv4();
53
+ return withId;
54
+ };
55
+ export const isActive = (ts2: TeamSubscription2, date: string): boolean => {
56
+ return ts2.startDate <= date && (ts2.endDate === undefined || date < ts2.endDate);
57
+ };
58
+ export function isCancelled(s: TeamSubscription2, date: string): boolean {
59
+ return (!!s.cancellationDate && s.cancellationDate < date) || (!!s.endDate && s.endDate < date); // This edge case is meant to handle bad data: If for whatever reason cancellationDate has not been set: treat endDate as such
32
60
  }
33
61
  }
34
62
 
@@ -43,49 +71,57 @@ export interface TeamSubscriptionSlot {
43
71
  subscriptionId?: string;
44
72
  cancellationDate?: string;
45
73
  }
46
- export type TeamSubscriptionSlotDeactivated = TeamSubscriptionSlot & { assigneeId: string, assigneeIdentifier: AssigneeIdentifier };
47
- export type TeamSubscriptionSlotAssigned = TeamSubscriptionSlot & TeamSubscriptionSlotDeactivated & { subscriptionId: string };
74
+ export type TeamSubscriptionSlotDeactivated = TeamSubscriptionSlot & {
75
+ assigneeId: string;
76
+ assigneeIdentifier: AssigneeIdentifier;
77
+ };
78
+ export type TeamSubscriptionSlotAssigned = TeamSubscriptionSlot &
79
+ TeamSubscriptionSlotDeactivated & { subscriptionId: string };
48
80
 
49
- export type TeamSubscriptionSlotState = 'unassigned' | 'assigned' | 'deactivated' | 'cancelled';
81
+ export type TeamSubscriptionSlotState = "unassigned" | "assigned" | "deactivated" | "cancelled";
50
82
 
51
83
  export namespace TeamSubscriptionSlot {
52
- export const create = (ts: Without<TeamSubscriptionSlot, 'id'>): TeamSubscriptionSlot => {
84
+ export const create = (ts: Omit<TeamSubscriptionSlot, "id">): TeamSubscriptionSlot => {
53
85
  const withId = ts as TeamSubscriptionSlot;
54
86
  withId.id = uuidv4();
55
87
  return withId;
56
- }
57
- export const assign = (slot: TeamSubscriptionSlot, assigneeId: string, subscriptionId: string, assigneeIdentifier: AssigneeIdentifier) => {
88
+ };
89
+ export const assign = (
90
+ slot: TeamSubscriptionSlot,
91
+ assigneeId: string,
92
+ subscriptionId: string,
93
+ assigneeIdentifier: AssigneeIdentifier,
94
+ ) => {
58
95
  slot.assigneeId = assigneeId;
59
96
  slot.subscriptionId = subscriptionId;
60
97
  slot.assigneeIdentifier = assigneeIdentifier;
61
- }
98
+ };
62
99
  export const deactivate = (slot: TeamSubscriptionSlot, cancellationDate: string) => {
63
100
  slot.subscriptionId = undefined;
64
101
  slot.cancellationDate = cancellationDate;
65
- }
102
+ };
66
103
  export const reactivate = (slot: TeamSubscriptionSlot, subscriptionId?: string) => {
67
104
  slot.subscriptionId = subscriptionId;
68
105
  slot.cancellationDate = undefined;
69
- }
106
+ };
70
107
  export const status = (slot: TeamSubscriptionSlot, now: string): TeamSubscriptionSlotState => {
71
108
  if (slot.cancellationDate) {
72
109
  if (slot.cancellationDate < now) {
73
- return 'cancelled';
110
+ return "cancelled";
74
111
  } else {
75
- return 'deactivated';
112
+ return "deactivated";
76
113
  }
77
114
  } else {
78
115
  if (slot.subscriptionId) {
79
- return 'assigned';
116
+ return "assigned";
80
117
  } else {
81
- return 'unassigned';
118
+ return "unassigned";
82
119
  }
83
120
  }
84
-
85
- }
121
+ };
86
122
  export const isActive = (slot: TeamSubscriptionSlot): boolean => {
87
123
  return !slot.cancellationDate;
88
- }
124
+ };
89
125
  }
90
126
 
91
127
  /**
@@ -108,7 +144,7 @@ export interface TeamSubscriptionSlotResolved {
108
144
  export type AssigneeIdentifier = AssigneeIdentityIdentifier;
109
145
  export interface AssigneeIdentityIdentifier {
110
146
  identity: {
111
- authHost: string,
112
- authName: string
113
- }
147
+ authHost: string;
148
+ authName: string;
149
+ };
114
150
  }
@@ -0,0 +1,166 @@
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
+
7
+ import { PrebuiltWorkspaceState } from "./protocol";
8
+ import { v4 as uuidv4 } from "uuid";
9
+ import { DeepPartial } from "./util/deep-partial";
10
+ import { WebhookEvent } from "./webhook-event";
11
+
12
+ export interface ProjectConfig {
13
+ ".gitpod.yml": string;
14
+ }
15
+
16
+ export interface ProjectSettings {
17
+ useIncrementalPrebuilds?: boolean;
18
+ usePersistentVolumeClaim?: boolean;
19
+ keepOutdatedPrebuildsRunning?: boolean;
20
+ }
21
+
22
+ export interface Project {
23
+ id: string;
24
+ name: string;
25
+ slug?: string;
26
+ cloneUrl: string;
27
+ teamId?: string;
28
+ userId?: string;
29
+ appInstallationId: string;
30
+ settings?: ProjectSettings;
31
+ creationTime: string;
32
+ /** This is a flag that triggers the HARD DELETION of this entity */
33
+ deleted?: boolean;
34
+ markedDeleted?: boolean;
35
+ }
36
+
37
+ export namespace Project {
38
+ export const create = (project: Omit<Project, "id" | "creationTime">): Project => {
39
+ return {
40
+ ...project,
41
+ id: uuidv4(),
42
+ creationTime: new Date().toISOString(),
43
+ };
44
+ };
45
+
46
+ export interface Overview {
47
+ branches: BranchDetails[];
48
+ }
49
+
50
+ export namespace Overview {
51
+ export function is(data?: any): data is Project.Overview {
52
+ return Array.isArray(data?.branches);
53
+ }
54
+ }
55
+
56
+ export interface BranchDetails {
57
+ name: string;
58
+ url: string;
59
+ isDefault: boolean;
60
+
61
+ // Latest commit
62
+ changeTitle: string;
63
+ changeDate?: string;
64
+ changeAuthor?: string;
65
+ changeAuthorAvatar?: string;
66
+ changePR?: string;
67
+ changeUrl?: string;
68
+ changeHash: string;
69
+ }
70
+ }
71
+
72
+ export type PartialProject = DeepPartial<Project> & Pick<Project, "id">;
73
+
74
+ export interface ProjectUsage {
75
+ lastWebhookReceived: string;
76
+ lastWorkspaceStart: string;
77
+ }
78
+
79
+ export interface PrebuildWithStatus {
80
+ info: PrebuildInfo;
81
+ status: PrebuiltWorkspaceState;
82
+ error?: string;
83
+ }
84
+
85
+ export interface PrebuildInfo {
86
+ id: string;
87
+ buildWorkspaceId: string;
88
+ basedOnPrebuildId?: string;
89
+
90
+ teamId?: string;
91
+ userId?: string;
92
+
93
+ projectId: string;
94
+ projectName: string;
95
+
96
+ cloneUrl: string;
97
+ branch: string;
98
+
99
+ startedAt: string;
100
+ startedBy: string;
101
+ startedByAvatar?: string;
102
+
103
+ changeTitle: string;
104
+ changeDate: string;
105
+ changeAuthor: string;
106
+ changeAuthorAvatar?: string;
107
+ changePR?: string;
108
+ changeUrl?: string;
109
+ changeHash: string;
110
+ }
111
+ export namespace PrebuildInfo {
112
+ export function is(data?: any): data is PrebuildInfo {
113
+ return typeof data === "object" && ["id", "buildWorkspaceId", "projectId", "branch"].every((p) => p in data);
114
+ }
115
+ }
116
+
117
+ export interface StartPrebuildResult {
118
+ prebuildId: string;
119
+ wsid: string;
120
+ done: boolean;
121
+ }
122
+
123
+ export interface Team {
124
+ id: string;
125
+ name: string;
126
+ slug: string;
127
+ creationTime: string;
128
+ markedDeleted?: boolean;
129
+ /** This is a flag that triggers the HARD DELETION of this entity */
130
+ deleted?: boolean;
131
+ }
132
+
133
+ export type TeamMemberRole = "owner" | "member";
134
+
135
+ export interface TeamMemberInfo {
136
+ userId: string;
137
+ fullName?: string;
138
+ primaryEmail?: string;
139
+ avatarUrl?: string;
140
+ role: TeamMemberRole;
141
+ memberSince: string;
142
+ }
143
+
144
+ export interface TeamMembershipInvite {
145
+ id: string;
146
+ teamId: string;
147
+ role: TeamMemberRole;
148
+ creationTime: string;
149
+ invalidationTime: string;
150
+ invitedEmail?: string;
151
+
152
+ /** This is a flag that triggers the HARD DELETION of this entity */
153
+ deleted?: boolean;
154
+ }
155
+
156
+ export interface PrebuildEvent {
157
+ id: string;
158
+ creationTime: string;
159
+ status: WebhookEvent.Status | WebhookEvent.PrebuildStatus;
160
+ message?: string;
161
+ prebuildId?: string;
162
+ projectId?: string;
163
+ cloneUrl?: string;
164
+ branch?: string;
165
+ commit?: string;
166
+ }
@@ -6,7 +6,7 @@
6
6
 
7
7
  interface Window {
8
8
  gitpod: {
9
- service: import('../gitpod-service').GitpodService
10
- ideService?: import('../ide-frontend-service').IDEFrontendService
11
- }
12
- }
9
+ service: import("../gitpod-service").GitpodService;
10
+ ideService?: import("../ide-frontend-service").IDEFrontendService;
11
+ };
12
+ }
package/src/usage.ts ADDED
@@ -0,0 +1,71 @@
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 { WorkspaceType } from "./protocol";
8
+
9
+ // types below are copied over from components/usage-api/typescript/src/usage/v1/usage_pb.d.ts
10
+ export interface ListUsageRequest {
11
+ attributionId: string;
12
+ from?: number;
13
+ to?: number;
14
+ order: Ordering;
15
+ pagination?: PaginationRequest;
16
+ }
17
+
18
+ export enum Ordering {
19
+ ORDERING_DESCENDING = 0,
20
+ ORDERING_ASCENDING = 1,
21
+ }
22
+
23
+ export interface PaginationRequest {
24
+ perPage: number;
25
+ page: number;
26
+ }
27
+
28
+ export interface ListUsageResponse {
29
+ usageEntriesList: Usage[];
30
+ pagination?: PaginationResponse;
31
+ creditsUsed: number;
32
+ }
33
+
34
+ export interface PaginationResponse {
35
+ perPage: number;
36
+ totalPages: number;
37
+ total: number;
38
+ page: number;
39
+ }
40
+
41
+ export type UsageKind = "workspaceinstance" | "invoice";
42
+ export interface Usage {
43
+ id: string;
44
+ attributionId: string;
45
+ description: string;
46
+ credits: number;
47
+ effectiveTime?: number;
48
+ kind: UsageKind;
49
+ workspaceInstanceId: string;
50
+ draft: boolean;
51
+ metadata: WorkspaceInstanceUsageData | InvoiceUsageData;
52
+ }
53
+
54
+ // the equivalent golang shape is maintained in `/workspace/gitpod/`components/usage/pkg/db/usage.go`
55
+ export interface WorkspaceInstanceUsageData {
56
+ workspaceId: string;
57
+ workspaceType: WorkspaceType;
58
+ workspaceClass: string;
59
+ contextURL: string;
60
+ startTime: string;
61
+ endTime?: string;
62
+ userId: string;
63
+ userName: string;
64
+ userAvatarURL: string;
65
+ }
66
+
67
+ export interface InvoiceUsageData {
68
+ invoiceId: string;
69
+ startDate: string;
70
+ endDate: string;
71
+ }
@@ -5,9 +5,8 @@
5
5
  */
6
6
 
7
7
  import Analytics = require("analytics-node");
8
- import { IAnalyticsWriter, IdentifyMessage, TrackMessage } from "../analytics";
9
- import { log } from './logging';
10
-
8
+ import { IAnalyticsWriter, IdentifyMessage, TrackMessage, PageMessage } from "../analytics";
9
+ import { log } from "./logging";
11
10
 
12
11
  export function newAnalyticsWriterFromEnv(): IAnalyticsWriter {
13
12
  switch (process.env.GITPOD_ANALYTICS_WRITER) {
@@ -21,20 +20,28 @@ export function newAnalyticsWriterFromEnv(): IAnalyticsWriter {
21
20
  }
22
21
 
23
22
  class SegmentAnalyticsWriter implements IAnalyticsWriter {
24
-
25
23
  protected readonly analytics: Analytics;
26
24
 
27
25
  constructor(writeKey: string) {
28
26
  this.analytics = new Analytics(writeKey);
29
27
  }
30
28
 
31
- identify(msg: IdentifyMessage) {
29
+ identify(msg: IdentifyMessage) {
32
30
  try {
33
- this.analytics.identify(msg, (err: Error) => {
34
- if (err) {
35
- log.warn("analytics.identify failed", err);
36
- }
37
- });
31
+ this.analytics.identify(
32
+ {
33
+ ...msg,
34
+ integrations: {
35
+ All: true,
36
+ Mixpanel: !!msg.userId,
37
+ },
38
+ },
39
+ (err: Error) => {
40
+ if (err) {
41
+ log.warn("analytics.identify failed", err);
42
+ }
43
+ },
44
+ );
38
45
  } catch (err) {
39
46
  log.warn("analytics.identify failed", err);
40
47
  }
@@ -42,30 +49,61 @@ class SegmentAnalyticsWriter implements IAnalyticsWriter {
42
49
 
43
50
  track(msg: TrackMessage) {
44
51
  try {
45
- this.analytics.track(msg, (err: Error) => {
46
- if (err) {
47
- log.warn("analytics.track failed", err);
48
- }
49
- });
52
+ this.analytics.track(
53
+ {
54
+ ...msg,
55
+ integrations: {
56
+ All: true,
57
+ Mixpanel: !!msg.userId,
58
+ },
59
+ },
60
+ (err: Error) => {
61
+ if (err) {
62
+ log.warn("analytics.track failed", err);
63
+ }
64
+ },
65
+ );
50
66
  } catch (err) {
51
67
  log.warn("analytics.track failed", err);
52
68
  }
53
69
  }
54
70
 
71
+ page(msg: PageMessage) {
72
+ try {
73
+ this.analytics.page(
74
+ {
75
+ ...msg,
76
+ integrations: {
77
+ All: true,
78
+ Mixpanel: !!msg.userId,
79
+ },
80
+ },
81
+ (err: Error) => {
82
+ if (err) {
83
+ log.warn("analytics.page failed", err);
84
+ }
85
+ },
86
+ );
87
+ } catch (err) {
88
+ log.warn("analytics.page failed", err);
89
+ }
90
+ }
55
91
  }
56
92
 
57
93
  class LogAnalyticsWriter implements IAnalyticsWriter {
58
-
59
94
  identify(msg: IdentifyMessage): void {
60
95
  log.debug("analytics identify", msg);
61
96
  }
62
97
  track(msg: TrackMessage): void {
63
98
  log.debug("analytics track", msg);
64
99
  }
65
-
100
+ page(msg: PageMessage): void {
101
+ log.debug("analytics page", msg);
102
+ }
66
103
  }
67
104
 
68
105
  class NoAnalyticsWriter implements IAnalyticsWriter {
69
106
  identify(msg: IdentifyMessage): void {}
70
107
  track(msg: TrackMessage): void {}
71
- }
108
+ page(msg: PageMessage): void {}
109
+ }
@@ -5,8 +5,8 @@
5
5
  */
6
6
 
7
7
  // Use asyncIterators with es2015
8
- if (typeof (Symbol as any).asyncIterator === 'undefined') {
9
- (Symbol as any).asyncIterator = Symbol.asyncIterator || Symbol('asyncIterator');
8
+ if (typeof (Symbol as any).asyncIterator === "undefined") {
9
+ (Symbol as any).asyncIterator = Symbol.asyncIterator || Symbol("asyncIterator");
10
10
  }
11
11
 
12
12
  export async function find<T>(it: AsyncIterableIterator<T>, predicate: (value: T) => boolean): Promise<T | undefined> {
@@ -31,12 +31,11 @@ export interface AsyncCachingIterator<T> extends AsyncIterableIterator<T> {
31
31
  resetCursor(): void;
32
32
  }
33
33
  export class AsyncCachingIteratorImpl<T> implements AsyncIterableIterator<T>, AsyncCachingIterator<T> {
34
-
35
34
  protected cache: T[] = [];
36
35
  protected cursor = 0;
37
36
  protected cacheRead = false;
38
37
 
39
- constructor(protected readonly iterable: AsyncIterableIterator<T>) { }
38
+ constructor(protected readonly iterable: AsyncIterableIterator<T>) {}
40
39
 
41
40
  public resetCursor() {
42
41
  this.cursor = 0;
@@ -47,7 +46,7 @@ export class AsyncCachingIteratorImpl<T> implements AsyncIterableIterator<T>, As
47
46
  if (!this.cacheRead && this.cursor < this.cache.length) {
48
47
  return {
49
48
  done: false,
50
- value: this.cache[this.cursor++]
49
+ value: this.cache[this.cursor++],
51
50
  };
52
51
  }
53
52
  this.cacheRead = true;
@@ -9,10 +9,10 @@ import { Disposable } from "./disposable";
9
9
  export class Cancelable<T> implements Disposable {
10
10
  protected canceled: boolean;
11
11
 
12
- constructor(protected readonly activity: (cancel: boolean) => Promise<T> | undefined) { }
12
+ constructor(protected readonly activity: (cancel: boolean) => Promise<T> | undefined) {}
13
13
 
14
14
  public async run(): Promise<T | undefined> {
15
- for(let r = await this.activity(this.canceled); ; r = await this.activity(this.canceled)) {
15
+ for (let r = await this.activity(this.canceled); ; r = await this.activity(this.canceled)) {
16
16
  if (this.canceled) {
17
17
  return;
18
18
  } else if (r !== undefined) {
@@ -28,4 +28,4 @@ export class Cancelable<T> implements Disposable {
28
28
  dispose(): void {
29
29
  this.cancel();
30
30
  }
31
- }
31
+ }
@@ -5,26 +5,26 @@
5
5
  */
6
6
 
7
7
  export function formatDate(date?: string) {
8
- return date ? new Date(date).toLocaleString() : '';
8
+ return date ? new Date(date).toLocaleString() : "";
9
9
  }
10
10
 
11
11
  export function formatHours(hours?: number) {
12
12
  if (hours === undefined) {
13
- return '';
13
+ return "";
14
14
  }
15
15
  const h = Math.floor(Math.abs(hours));
16
- const rm = (Math.abs(hours) - h) * 60.;
16
+ const rm = (Math.abs(hours) - h) * 60;
17
17
  const m = Math.floor(rm);
18
- const rs = (rm - m) * 60.;
18
+ const rs = (rm - m) * 60;
19
19
  const s = Math.floor(rs);
20
- const result = h + ':' + pad2(m) + ':' + pad2(s);
20
+ const result = h + ":" + pad2(m) + ":" + pad2(s);
21
21
  if (hours < 0) {
22
- return `-${result}`
22
+ return `-${result}`;
23
23
  } else {
24
- return `${result}`
24
+ return `${result}`;
25
25
  }
26
26
  }
27
27
 
28
28
  function pad2(n: number) {
29
- return n < 10 ? '0' + n : '' + n;
29
+ return n < 10 ? "0" + n : "" + n;
30
30
  }